诺诺全电冲红逻辑修改未测试

DS7_JinGang
ddlucky 2 years ago
parent 891dd94e3d
commit 1c71220d7e

@ -352,7 +352,9 @@ namespace DSWeb.Areas.Account.Controllers
headData.INVITERFACE = INVITERFACE.INVITERFACE;
else
headData.INVITERFACE = "诺诺发票接口";
}
else
{
}
@ -999,7 +1001,7 @@ namespace DSWeb.Areas.Account.Controllers
// return View();
//}
private JsonResponse checkinfo(string BILLNO, string redirecturl,string redReason="")
private JsonResponse checkinfo(string BILLNO, string redirecturl, string redReason = "", bool setred = false)
{
var result = new DBResult();
var head = new ChInvoice_HangXin();
@ -1026,6 +1028,8 @@ namespace DSWeb.Areas.Account.Controllers
else head.INVITERFACE = "诺诺发票接口";
if (head.INVITERFACE == "诺诺全电发票")
{
if (setred)
{
if (!string.IsNullOrWhiteSpace(redReason))
{
@ -1038,6 +1042,7 @@ namespace DSWeb.Areas.Account.Controllers
return jsonRespose;
}
}
}
head.DbOperationType = DbOperationType.DbotUpd;
@ -1045,15 +1050,16 @@ namespace DSWeb.Areas.Account.Controllers
var modb = new ModelObjectDB();
result = modb.Save(head);
}
else {
else
{
if (head.INVITERFACE == "诺诺全电发票")
{
if (setred)
{
if (!string.IsNullOrWhiteSpace(redReason))
{
head.redReason = redReason;
head.DbOperationType = DbOperationType.DbotUpd;
head.ModelUIStatus = "E";
var modb = new ModelObjectDB();
@ -1066,6 +1072,8 @@ namespace DSWeb.Areas.Account.Controllers
return jsonRespose;
}
}
}
}
//head = list[0];
jsonRespose.Data = head;
@ -1235,7 +1243,7 @@ namespace DSWeb.Areas.Account.Controllers
}
}
else if (head.INVITERFACE == "诺诺全电发票" )
else if (head.INVITERFACE == "诺诺全电发票")
{
var hx = .getHelper(head.TAXCODE);
if (!hx.CanUse)
@ -1329,11 +1337,11 @@ namespace DSWeb.Areas.Account.Controllers
//诺诺全电发票的红票 读取其实是读取 红字确认单查询接口
if (headdata.PTORRED == "1")
{
result=Do_NuoNuoQuanDianReadInv(BILLNO);
result = Do_NuoNuoQuanDianReadInv(BILLNO);
}
if (headdata.PTORRED == "2")
{
var _r= NNRedConfirm_Read(BILLNO);
var _r = NNRedConfirm_Read(BILLNO);
return BasicDataRefDAL.GetContentResult(_r);
}
}
@ -1495,7 +1503,8 @@ namespace DSWeb.Areas.Account.Controllers
}
var result = hx.ReadInvoice(head);
if (!result.Success) {
if (!result.Success)
{
return new JsonResponse { Success = result.Success, Message = result.Message, Data = "" }; ;
}
@ -1646,7 +1655,7 @@ namespace DSWeb.Areas.Account.Controllers
if (head.INVITERFACE == "诺诺发票接口" || head.INVITERFACE == "")
{
hx=HangXinRequestHelper.getHelper(head.TAXCODE);
hx = HangXinRequestHelper.getHelper(head.TAXCODE);
}
else if (head.INVITERFACE == "瑞宏发票接口")
{
@ -1694,7 +1703,7 @@ namespace DSWeb.Areas.Account.Controllers
/// <param name="BILLNO"></param>
/// <param name="redirecturl"></param>
/// <returns></returns>
public ContentResult NNSetRed(string bill, string redirecturl,string redReason="")
public ContentResult NNSetRed(string bill, string redirecturl, string redReason = "")
{
//首先判断是否有 modInvLock 发票开出锁定
var result = new DBResult();
@ -1704,7 +1713,7 @@ namespace DSWeb.Areas.Account.Controllers
//首先判断数据完整性与合法性 及检查平台认证
var checkresult = checkinfo(bill, redirecturl, redReason);
var checkresult = checkinfo(bill, redirecturl, redReason, true);
//被冲红的蓝票信息
var BlueInvoice = ChinvoiceDAL.GetData(" cm.billno='" + bill + "'");
@ -1729,9 +1738,15 @@ namespace DSWeb.Areas.Account.Controllers
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
//else {
// return NNSetRed_QuanDian(bill);
//}
//增加判断 如果原票createtime晚于当前时间24小时之前则报错不允许开出
if (BlueInvoice.INVOICEMAKETIME == null || BlueInvoice.INVOICEMAKETIME == "" || Convert.ToDateTime(BlueInvoice.INVOICEMAKETIME) > DateTime.Now.AddDays(-1))
{
jsonRespose.Success = false;
jsonRespose.Message = $"该蓝票为{BlueInvoice.INVOICEMAKETIME}开出,当前无法冲红";
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
}
@ -1841,25 +1856,22 @@ namespace DSWeb.Areas.Account.Controllers
//红字申请单申请编号 即为发票业务编号 到时候红票的订单编号也是这个
//
head.billUuid = redhead.BILLNO;
//head.billUuid = redhead.BILLNO;
}
}
var modb = new ModelObjectDB();
if (head.INVITERFACE != "诺诺全电发票") {
if (head.INVITERFACE != "诺诺全电发票")
{
//一般的红票业务此时保存红票信息
result = ChinvoiceDAL.SaveInvDetail(head.GID, detailList);
if (result.Success == true)
{
//主要保存了红票的billno在billUuid当中
result = modb.Save(head);
//ChinvoiceDAL.UpdateInvNoUse(headData.INVOICENO, Convert.ToString(Session["USERID"]),headData.BILLNO);
//if (headData.EXCHANGERATE != 0)
//{
// ChinvoiceDAL.updateFeeTax(headData.BILLNO, headData.EXCHANGERATE);
//}
};
}
@ -1929,7 +1941,91 @@ namespace DSWeb.Areas.Account.Controllers
{
var hx = .getHelper(head.TAXCODE);
result = hx.PostRedConfirm( redhead,ref head, detailList);
//20230529
//1 如果ch_fee_invoice.billuuid有值的话
//这个值是最近一次提交的红字确认单订单编码
//用这个值读取红字确认单状态 如成功则做红票相应的处理
//如状态15申请中 则不做操作返回申请中
//如非成功和15 则返回错误 并清空billuuid
//2 如果ch_fee_invoice.billuuid无值 则重新产生值并发出红字确认单
//此时head.billUuid如果不为空 代表是第一次冲红
if (!string.IsNullOrWhiteSpace(head.billUuid))//&&
{
var _r = hx.ReadRedConfirm(ref redhead, detailList);
if (!_r.Success)
{
return BasicDataRefDAL.GetContentResult(_r);
}
else
{
//var hx = 诺诺全电发票.getHelper(head.TAXCODE);
if (!hx.CanUse)
{
result.SetErrorInfo(hx.ERRORMSG);
return BasicDataRefDAL.GetContentResult(result);
}
//if (hx.accessToken == "")
//{
// BasicDataRefDAL.SaveLog("NNReadInv;税号" + head.TAXCODE + "的 accessToken为空", "", "诺诺平台", "返回认证窗口");
// var _r = TokenPage();
// return _r;
//}
result = hx.ReadInvoice(head);
if (!result.Success)
{
return BasicDataRefDAL.GetContentResult(result);
}
//if (result.Message == "需要重新认证")
//{
// //HangXinRequestHelper.clear(hx.accessToken);
// BasicDataRefDAL.SaveLog("ReadInvoice 反回‘需要重新认证’", "", "诺诺平台", "返回认证窗口");
// var _r = TokenPage();
// return _r;
//}
returndate = ChinvoiceDAL.GetData(" BILLNO='" + head.BILLNO + "'");
if (head.PTORRED == "2")
{
ChinvoiceDAL.SetRed(head);
//将原票内的申请和费用恢复原状
//var BlueInvoice = ChinvoiceDAL.GetData(" cm.INVOICECODE='" + head.REDCODE + "' and cm.INVOICENO='" + head.REDNUM + "'");
//result = SetInvoiceFee(BlueInvoice);
}
//如果状态为开出成功 则执行锁定
if (returndate.EINVOICESTATE == "2" && returndate.BILLSTATUS == 0)
{
//ChinvoiceDAL.Lock(returndate.BILLNO);
//20200106 添加 如sys_param_set.PARAMNAME=INVOICEAUTOLOCK 没有值或值为false 则不执行锁定
var needautolock = MsSysParamSetDAL.GetSysParam("INVOICEAUTOLOCK").isnullortrue();
if (needautolock)
{
ChinvoiceDAL.Lock(returndate.BILLNO);
}
returndate = ChinvoiceDAL.GetData(" BILLNO='" + head.BILLNO + "'");
}
result.Data = returndate;
return BasicDataRefDAL.GetContentResult(result);
}
}
else
{
head.billUuid = redhead.BILLNO;
result = hx.PostRedConfirm(redhead, ref head, detailList);
}
//诺诺全电票根据红字申请单的结果读取确认单
modb.Save(head);
}
@ -1965,8 +2061,9 @@ namespace DSWeb.Areas.Account.Controllers
result = hx.ReadRedConfirm(ref head);
if (!result.Success) { return result; }
else {
var _r= Do_NuoNuoQuanDianReadInv(head.BILLNO);
else
{
var _r = Do_NuoNuoQuanDianReadInv(head.BILLNO);
result.Success = _r.Success;
result.Message = _r.Message;
@ -2029,7 +2126,8 @@ namespace DSWeb.Areas.Account.Controllers
private DBResult checkCanPost(ChInvoice_HangXin head)
{
var result = new DBResult(true, "", "");
if (head.ISFRINV) {
if (head.ISFRINV)
{
return result;
}
@ -2087,7 +2185,7 @@ namespace DSWeb.Areas.Account.Controllers
/// <param name="BILLNO"></param>
/// <param name="redirecturl"></param>
/// <returns></returns>
private JsonResponse checkCanRead(string BILLNO, string redirecturl="")
private JsonResponse checkCanRead(string BILLNO, string redirecturl = "")
{
var result = new DBResult();

@ -37,12 +37,12 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
{
#region 发票列表
static public List<ChInvoice_HangXin> GetDataList(int start, int limit, string strCondition, string userid="", string usercode="", string orgcode="", string sort = null)
static public List<ChInvoice_HangXin> GetDataList(int start, int limit, string strCondition, string userid = "", string usercode = "", string orgcode = "", string sort = null)
{
var rangstr = GetRangDAListStr("", userid, usercode, orgcode);
if (!string.IsNullOrEmpty(rangstr) &&!string.IsNullOrWhiteSpace(userid+ usercode+ orgcode))
if (!string.IsNullOrEmpty(rangstr) && !string.IsNullOrWhiteSpace(userid + usercode + orgcode))
{
if (!string.IsNullOrEmpty(strCondition))
{
@ -216,7 +216,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
static public ChInvoice_HangXin GetData(string condition, string userid = "", string usercode = "", string orgcode = "")
{
var list = GetDataList(0,1,condition,userid,usercode,orgcode,"");
var list = GetDataList(0, 1, condition, userid, usercode, orgcode, "");
if (list.Count > 0)
return list[0];
@ -270,7 +270,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
else
data.EXCHANGERATE = 0;
data.APPLICANT = Convert.ToString(reader["APPLICANT"]);
// data.APPLICANTNAME = Convert.ToString(reader["APPLICANTNAME"]);
// data.APPLICANTNAME = Convert.ToString(reader["APPLICANTNAME"]);
if (reader["APPLYTIME"] != DBNull.Value)
data.APPLYTIME = Convert.ToDateTime(reader["APPLYTIME"]);
@ -306,7 +306,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
data.SALECORP = Convert.ToString(reader["SALECORP"]);//分公司代码
data.ACCOUNT = Convert.ToString(reader["ACCOUNT"]);//分公司代码
data.BANK = Convert.ToString(reader["BANK"]);//分公司代码
data.DZSTATUS= Convert.ToString(reader["DZSTATUS"]);
data.DZSTATUS = Convert.ToString(reader["DZSTATUS"]);
data.CUSTTEL = Convert.ToString(reader["CUSTTEL"]);
data.CUSTADDR = Convert.ToString(reader["CUSTADDR"]);
@ -378,11 +378,12 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
{
strSql.Append(" where " + strCondition);
}
var result= DetailSetData(strSql);
var result = DetailSetData(strSql);
//增加三个税收属性相关的字段
var PIDList = "";
if (result.Count > 0) {
if (result.Count > 0)
{
foreach (var detail in result)
{
if (PIDList.IndexOf(detail.PID) > 0) continue;
@ -393,7 +394,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
if (PIDList != "")
{
var CodeGoodInvList = MsCodeGoodInvDAL.GetDataList(" gid in (SELECT GOODSNAME FROM ch_fee_invoicedetail where PID in( '" + PIDList + "' )) ");
if (CodeGoodInvList.Count > 0) {
if (CodeGoodInvList.Count > 0)
{
foreach (var detail in result)
{
foreach (var CodeGoodInv in CodeGoodInvList)
@ -425,7 +427,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
{
strSql.Append(" where " + strCondition);
}
return DetailSetData(strSql,db,tran);
return DetailSetData(strSql, db, tran);
}
static public ChInvoiceDetail GetDetailData(string condition)
{
@ -452,7 +454,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
data.SERIALNO = Convert.ToInt16(reader["SerialNo"]);
data.GOODSNAME = Convert.ToString(reader["GOODSNAME"]);
data.GOODSNAMEREF = Convert.ToString(reader["GOODSNAMEREF"]);
if (data.GOODSNAMEREF == "" || data.GOODSNAMEREF ==null) data.GOODSNAMEREF = data.GOODSNAME;
if (data.GOODSNAMEREF == "" || data.GOODSNAMEREF == null) data.GOODSNAMEREF = data.GOODSNAME;
data.SPEC = Convert.ToString(reader["SPEC"]);
data.UNIT = Convert.ToString(reader["UNIT"]);
data.PKGS = Convert.ToDecimal(reader["PKGS"]);
@ -461,7 +463,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
data.AMOUNT = Math.Round(Convert.ToDecimal(reader["AMOUNT"]), 2, MidpointRounding.AwayFromZero);
data.TAXRATE = Convert.ToDecimal(reader["TAXRATE"]);
data.TAX = Convert.ToDecimal(reader["TAX"]);
data.REMARK= Convert.ToString(reader["Remark"]);
data.REMARK = Convert.ToString(reader["Remark"]);
data.GOODCODE = Convert.ToString(reader["GOODCODE"]);
#endregion
headList.Add(data);
@ -473,7 +475,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
private static List<ChInvoiceDetail> DetailSetData(StringBuilder strSql, Database db, DbTransaction tran)
{
var headList = new List<ChInvoiceDetail>();
using (IDataReader reader = db.ExecuteReader(tran,CommandType.Text, strSql.ToString()))
using (IDataReader reader = db.ExecuteReader(tran, CommandType.Text, strSql.ToString()))
{
while (reader.Read())
{
@ -506,7 +508,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
}
public static List<ChInvoiceNo> GetInvoiceNo (string companyid,string userid)
public static List<ChInvoiceNo> GetInvoiceNo(string companyid, string userid)
{
var strSql = new StringBuilder();
strSql.Append("select b.INVOICECODE+i.INVOICENUM INVOICENUM from ch_fee_invoiceitems i left join ch_fee_invoicebooks b on (i.BOOKID=b.GID)");
@ -534,7 +536,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
#region 发票费用明细
static public List<Chfee_do_detail> GetBodyList(string strCondition,string sort="")
static public List<Chfee_do_detail> GetBodyList(string strCondition, string sort = "")
{
var strSql = new StringBuilder();
strSql.Append(" SELECT c.GID,c.BSNO,c.FEEID,c.FEENAME,c.CURRENCY,c.AMOUNT,c.DOAMOUNT,c.ORIGCURRENCY,c.ORIGAMOUNT,ISNULL(c.ORIGSTLAMOUNT,0) AS ORIGSTLAMOUNT,c.EXCHANGERATE ");
@ -1450,7 +1452,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
return headList;
}
#region 费用列表明细
static public List<ChFeeDetail> GetFeeDetailList(string strCondition, string userid, string usercode, string orgcode,string sort=null)
static public List<ChFeeDetail> GetFeeDetailList(string strCondition, string userid, string usercode, string orgcode, string sort = null)
{
var strSql = new StringBuilder();
@ -1761,7 +1763,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
decimal amtttl = 0;
decimal acctaxrate =0;
decimal acctaxrate = 0;
decimal doamount = 0;
decimal StlAmount = 0;
@ -1887,9 +1889,10 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
}
}
if (!isList&& amtttl!=0) {
if (!isList && amtttl != 0)
{
var dataList =GetDetailList(" PID='"+GID+"'");
var dataList = GetDetailList(" PID='" + GID + "'");
if (dataList.Count != 0)
{
var invlist = dataList[0];
@ -1897,13 +1900,14 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
db.AddInParameter(cmdUpdateInv, "@GID", DbType.String, invlist.GID);
if (acctaxrate == 0)
{
db.AddInParameter(cmdUpdateInv, "@AMOUNT", DbType.Decimal, Math.Round(invlist.AMOUNT+amtttl,2));
db.AddInParameter(cmdUpdateInv, "@TAXPRICE", DbType.Decimal, Math.Round((invlist.AMOUNT + amtttl)/invlist.PKGS,2));
db.AddInParameter(cmdUpdateInv, "@PRICE", DbType.Decimal, Math.Round((invlist.AMOUNT + amtttl) / invlist.PKGS,2));
db.AddInParameter(cmdUpdateInv, "@AMOUNT", DbType.Decimal, Math.Round(invlist.AMOUNT + amtttl, 2));
db.AddInParameter(cmdUpdateInv, "@TAXPRICE", DbType.Decimal, Math.Round((invlist.AMOUNT + amtttl) / invlist.PKGS, 2));
db.AddInParameter(cmdUpdateInv, "@PRICE", DbType.Decimal, Math.Round((invlist.AMOUNT + amtttl) / invlist.PKGS, 2));
db.AddInParameter(cmdUpdateInv, "@TAXRATE", DbType.Decimal, 0);
db.AddInParameter(cmdUpdateInv, "@TAX", DbType.Decimal,0);
db.AddInParameter(cmdUpdateInv, "@TAX", DbType.Decimal, 0);
}
else {
else
{
amtttl = amtttl + (invlist.TAXPRICE * invlist.PKGS);
@ -1927,7 +1931,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
db.ExecuteNonQuery(cmdUpdateInv, tran);
}
else {
else
{
cmdInsertInv.Parameters.Clear();
db.AddInParameter(cmdInsertInv, "@GID", DbType.String, Guid.NewGuid().ToString());
db.AddInParameter(cmdInsertInv, "@PID", DbType.String, GID);
@ -1935,7 +1940,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
if (defGOOD.GOODNAME == "")
{
db.AddInParameter(cmdInsertInv, "@GOODSNAME", DbType.String, "代理运杂费");
db.AddInParameter(cmdInsertInv, "@UNIT", DbType.String,"票");
db.AddInParameter(cmdInsertInv, "@UNIT", DbType.String, "票");
}
else
{
@ -1945,18 +1950,18 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
db.AddInParameter(cmdInsertInv, "@SPEC", DbType.String, defGOOD.SPEC);
db.AddInParameter(cmdInsertInv, "@PKGS", DbType.Decimal, 1);
db.AddInParameter(cmdInsertInv, "@TAXPRICE", DbType.Decimal, Math.Round(amtttl,2));
db.AddInParameter(cmdInsertInv, "@TAXPRICE", DbType.Decimal, Math.Round(amtttl, 2));
db.AddInParameter(cmdInsertInv, "@TAXRATE", DbType.Decimal, acctaxrate);
if (acctaxrate == 0)
{
db.AddInParameter(cmdInsertInv, "@PRICE", DbType.Decimal, Math.Round(amtttl,2));
db.AddInParameter(cmdInsertInv, "@AMOUNT", DbType.Decimal, Math.Round(amtttl,2));
db.AddInParameter(cmdInsertInv, "@PRICE", DbType.Decimal, Math.Round(amtttl, 2));
db.AddInParameter(cmdInsertInv, "@AMOUNT", DbType.Decimal, Math.Round(amtttl, 2));
db.AddInParameter(cmdInsertInv, "@TAX", DbType.Decimal, 0);
}
else
{
var tax = Math.Round(amtttl / (1 + acctaxrate / 100) * (acctaxrate / 100), 2);
var amount = amtttl-tax;
var amount = amtttl - tax;
db.AddInParameter(cmdInsertInv, "@PRICE", DbType.Decimal, amount);
db.AddInParameter(cmdInsertInv, "@AMOUNT", DbType.Decimal, amount);
db.AddInParameter(cmdInsertInv, "@TAX", DbType.Decimal, tax);
@ -2004,7 +2009,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
public static DBResult AddBill(ChInvoice_HangXin headData, string feesql, List<ChFeeExrate> exratelist, string companyid, bool isList, string GID,string userid, bool custgroup = false)
public static DBResult AddBill(ChInvoice_HangXin headData, string feesql, List<ChFeeExrate> exratelist, string companyid, bool isList, string GID, string userid, bool custgroup = false)
{
var result = new DBResult();
var defGOOD = MsCodeGoodInvDAL.GetData(" ISDEF='1' and (DEFCURR='' or DEFCURR='" + headData.RECVCURR + "') ");
@ -2038,7 +2043,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
if (!custgroup)
feesql = feesql + " AND CUSTOMERNAME='" + headData.CUSTOMERNAME + "'";
var feelist = GetFeeDetailList(feesql,userid,"",companyid);
var feelist = GetFeeDetailList(feesql, userid, "", companyid);
var cmdInsert =
@ -2107,7 +2112,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
}
}
if (!ischaoe) {
if (!ischaoe)
{
cmdInsert.Parameters.Clear();
db.AddInParameter(cmdInsert, "@GID", DbType.String, Guid.NewGuid().ToString());
db.AddInParameter(cmdInsert, "@BILLNO", DbType.String, headData.BILLNO);
@ -2133,7 +2139,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
amtttl = amtttl - enumValue.StlAmount;
else
amtttl = amtttl + enumValue.StlAmount;
enumValue.ExChangerate =1;
enumValue.ExChangerate = 1;
}
else
{
@ -2222,7 +2228,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
db.AddInParameter(cmdInsertInv, "@TAX", DbType.Decimal, tax);
}
}
else {
else
{
var UExrate = GetExrate(enumValue.Currency, exratelist);
db.AddInParameter(cmdInsertInv, "@TAXPRICE", DbType.Decimal, Math.Round(enumValue.StlAmount * UExrate, 2));
@ -2264,7 +2271,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
amtttl = amtttl + Math.Round(invfeesum.amount * invfeesum.exchange, 2, MidpointRounding.AwayFromZero);
}
}
if (!isList&& amtttl!=0)
if (!isList && amtttl != 0)
{
var dataList = GetDetailList(" PID='" + GID + "'");
@ -2275,9 +2282,9 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
db.AddInParameter(cmdUpdateInv, "@GID", DbType.String, invlist.GID);
if (acctaxrate == 0)
{
db.AddInParameter(cmdUpdateInv, "@AMOUNT", DbType.Decimal, Math.Round(invlist.AMOUNT + amtttl,2));
db.AddInParameter(cmdUpdateInv, "@TAXPRICE", DbType.Decimal, Math.Round((invlist.AMOUNT + amtttl) / invlist.PKGS,2));
db.AddInParameter(cmdUpdateInv, "@PRICE", DbType.Decimal, Math.Round((invlist.AMOUNT + amtttl) / invlist.PKGS,2));
db.AddInParameter(cmdUpdateInv, "@AMOUNT", DbType.Decimal, Math.Round(invlist.AMOUNT + amtttl, 2));
db.AddInParameter(cmdUpdateInv, "@TAXPRICE", DbType.Decimal, Math.Round((invlist.AMOUNT + amtttl) / invlist.PKGS, 2));
db.AddInParameter(cmdUpdateInv, "@PRICE", DbType.Decimal, Math.Round((invlist.AMOUNT + amtttl) / invlist.PKGS, 2));
db.AddInParameter(cmdUpdateInv, "@TAXRATE", DbType.Decimal, 0);
db.AddInParameter(cmdUpdateInv, "@TAX", DbType.Decimal, 0);
}
@ -2320,7 +2327,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
db.AddInParameter(cmdInsertInv, "@GOODSNAME", DbType.String, defGOOD.GID);
db.AddInParameter(cmdInsertInv, "@UNIT", DbType.String, defGOOD.UNIT);
}
db.AddInParameter(cmdInsertInv, "@SPEC", DbType.String,defGOOD.SPEC);
db.AddInParameter(cmdInsertInv, "@SPEC", DbType.String, defGOOD.SPEC);
db.AddInParameter(cmdInsertInv, "@PKGS", DbType.Decimal, 1);
db.AddInParameter(cmdInsertInv, "@TAXPRICE", DbType.Decimal, amtttl);
db.AddInParameter(cmdInsertInv, "@TAXRATE", DbType.Decimal, acctaxrate);
@ -2334,13 +2341,13 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
{
var tax = Math.Round(amtttl / (1 + acctaxrate / 100) * (acctaxrate / 100), 2);
var amount = amtttl - tax;
// var amount = Math.Round(amtttl / (1 + acctaxrate / 100),2);
// var amount = Math.Round(amtttl / (1 + acctaxrate / 100),2);
db.AddInParameter(cmdInsertInv, "@PRICE", DbType.Decimal, amount);
db.AddInParameter(cmdInsertInv, "@AMOUNT", DbType.Decimal, amount);
db.AddInParameter(cmdInsertInv, "@TAX", DbType.Decimal, tax);
}
db.AddInParameter(cmdInsertInv, "@Remark", DbType.String, "");
db.AddInParameter(cmdInsertInv, "@GOODCODE", DbType.String,defGOOD.GOODCODE);
db.AddInParameter(cmdInsertInv, "@GOODCODE", DbType.String, defGOOD.GOODCODE);
db.ExecuteNonQuery(cmdInsertInv, tran);
}
@ -2380,11 +2387,11 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
}
public static DBResult updateFeeTax(string billno,decimal taxrate)
public static DBResult updateFeeTax(string billno, decimal taxrate)
{
var result = new DBResult();
var dataList = ChinvoiceDAL.GetBodyList("BILLNO='"+billno+"'");
var dataList = ChinvoiceDAL.GetBodyList("BILLNO='" + billno + "'");
Database db = DatabaseFactory.CreateDatabase();
@ -2544,7 +2551,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
return result;
}
public static int p_update_Amount(string billno,string GID)
public static int p_update_Amount(string billno, string GID)
{
Database db = DatabaseFactory.CreateDatabase();
@ -2638,15 +2645,15 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
db.AddInParameter(cmdUpdateInv, "@BILLNO", DbType.String, billno);
foreach (var enumValue in bodyList)
{
currency =enumValue.CURRENCY;
rate =enumValue.RATE;
custrateno =enumValue.CUSTRATENO;
currency = enumValue.CURRENCY;
rate = enumValue.RATE;
custrateno = enumValue.CUSTRATENO;
custaddrtel = enumValue.CUSTADDRTEL;
custbank = enumValue.CUSTBANK;
INVOICECATEGORY = enumValue.INVOICECATEGORY;
ACTUALCUSTOMERNAME = enumValue.ACTUALCUSTOMERNAME;
INVOICECUSTNAME = enumValue.INVOICECUSTNAME;
REMARK = REMARK+' '+enumValue.REMARK;
REMARK = REMARK + ' ' + enumValue.REMARK;
cmdInsert.Parameters.Clear();
db.AddInParameter(cmdInsert, "@BILLNO", DbType.String, billno);
@ -2655,22 +2662,24 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
cmdUpdate.Parameters.Clear();
db.AddInParameter(cmdUpdate, "@AppBILLNO", DbType.String, enumValue.BILLNO);
db.AddInParameter(cmdUpdate, "@INVOICENUM", DbType.String,invoiceno);
db.AddInParameter(cmdUpdate, "@INVOICENUM", DbType.String, invoiceno);
db.ExecuteNonQuery(cmdUpdate, tran);
var invdetaillist = GetDetailList("PID='"+enumValue.GID+"'",db,tran);
var invdetaillist = GetDetailList("PID='" + enumValue.GID + "'", db, tran);
if (invdetaillist != null)
{
foreach (var enumInvDetail in invdetaillist)
{
bool ishave = false;
if (invdetailDataList != null) {
if (invdetailDataList != null)
{
foreach (var invdetailData in invdetailDataList)
{
if (invdetailData.GOODSNAME == enumInvDetail.GOODSNAME) {
if (invdetailData.GOODSNAME == enumInvDetail.GOODSNAME)
{
invdetailData.TAXPRICE = invdetailData.TAXPRICE + enumInvDetail.TAXPRICE;
invdetailData.PRICE = invdetailData.PRICE + enumInvDetail.PRICE;
invdetailData.AMOUNT = invdetailData.AMOUNT + enumInvDetail.AMOUNT;
@ -2680,7 +2689,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
}
}
if (!ishave) {
if (!ishave)
{
var invdetailtmp = enumInvDetail;
invdetailtmp.GID = "*";
invdetailtmp.PID = GID;
@ -2724,7 +2734,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
}
if (invdetailDataList != null) {
if (invdetailDataList != null)
{
foreach (var invdetailData in invdetailDataList)
{
if (invdetailData.GID == "*")
@ -2746,7 +2757,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
db.ExecuteNonQuery(cmdInsertInvDetail, tran);
}
else {
else
{
var cmdUpdateInvDetail =
db.GetSqlStringCommand(
@ -2893,7 +2905,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
foreach (var enumValue in bodyList)
{
var stlamount = enumValue.STLAMOUNT;
var invappdetail = ChinvoiceapplicationDAL.GetBodyList("c.BILLNO='"+enumValue.BILLNO+"'");
var invappdetail = ChinvoiceapplicationDAL.GetBodyList("c.BILLNO='" + enumValue.BILLNO + "'");
if (invappdetail != null)
@ -3037,7 +3049,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
if (invdetailData.GOODSNAME == enumInvDetail.GOODSNAME)
{
invdetailData.TAXPRICE = invdetailData.TAXPRICE + enumInvDetail.TAXPRICE * (stlinvaount / enumInvDetail.AMOUNT);
invdetailData.PRICE = invdetailData.PRICE + enumInvDetail.PRICE*(stlinvaount/ enumInvDetail.AMOUNT);
invdetailData.PRICE = invdetailData.PRICE + enumInvDetail.PRICE * (stlinvaount / enumInvDetail.AMOUNT);
invdetailData.AMOUNT = invdetailData.AMOUNT + stlinvaount;
invdetailData.TAX = invdetailData.TAX + enumInvDetail.TAX * (stlinvaount / enumInvDetail.AMOUNT);
ishave = true;
@ -3179,7 +3191,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
}
public static DBResult DelAppList(List<ChInvoiceapplication> boday,string billno)
public static DBResult DelAppList(List<ChInvoiceapplication> boday, string billno)
{
var result = new DBResult();
@ -3199,7 +3211,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
var cmddelete = db.GetSqlStringCommand("delete from ch_fee_do where BILLNO=@BILLNO AND FEEID IN (SELECT FEEID FROM CH_FEE_DO WHERE BILLNO=@AppBILLNO)");
var cmdUpdate =db.GetSqlStringCommand(
var cmdUpdate = db.GetSqlStringCommand(
@"declare @FEEID varchar(100)
declare @ORDERINVOICE numeric(19,4)
@ -3267,7 +3279,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
#endregion
public static DBResult UpdateInvNoDelete(string billno,string userid,bool isdelete=true)
public static DBResult UpdateInvNoDelete(string billno, string userid, bool isdelete = true)
{
var result = new DBResult();
@ -3291,7 +3303,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
db.GetSqlStringCommand(
@"UPDATE ch_fee_invoiceitems set ISDELETE=0 where INVOICENUM=@BILLNO");
if (billno.Length > 8) {
if (billno.Length > 8)
{
cmdUpdate =
db.GetSqlStringCommand(
@ -3315,7 +3328,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
db.AddInParameter(cmdUpdate, "@DELETETIME", DbType.String, DateTime.Now);
db.ExecuteNonQuery(cmdUpdate, tran);
}
else {
else
{
cmdUpdate2.Parameters.Clear();
db.AddInParameter(cmdUpdate2, "@BILLNO", DbType.String, billno);
@ -3346,7 +3360,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
return result;
}
public static DBResult UpdateInvNoUse(string billno, string userid,string invbillno)
public static DBResult UpdateInvNoUse(string billno, string userid, string invbillno)
{
var result = new DBResult();
@ -3371,7 +3385,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
var cmdUpdate =
db.GetSqlStringCommand(
@"UPDATE ch_fee_invoiceitems set ISMAKEOUT=1,MAKEOUTUSER=@DELETEUSER,MAKEOUTTIME=@DELETETIME,BILLNO=@INVBILLNO where INVOICENUM=@BILLNO");
if (billno.Length > 8) {
if (billno.Length > 8)
{
cmdUpdate =
db.GetSqlStringCommand(
@"UPDATE ch_fee_invoiceitems set ISMAKEOUT=1,MAKEOUTUSER=@DELETEUSER,MAKEOUTTIME=@DELETETIME,BILLNO=@INVBILLNO FROM ch_fee_invoiceitems I
@ -3430,7 +3445,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
db.GetSqlStringCommand(
@"UPDATE ch_fee_invoiceitems set ISMAKEOUT=0,MAKEOUTUSER='',MAKEOUTTIME=null,BILLNO='' where INVOICENUM=@BILLNO");
if (billno.Length > 8) {
if (billno.Length > 8)
{
cmdUpdate =
db.GetSqlStringCommand(
@ -3514,7 +3530,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
return result;
}
public static DBResult UpdateDelete(string billno,string userid,bool isdelete=true)
public static DBResult UpdateDelete(string billno, string userid, bool isdelete = true)
{
var result = new DBResult();
@ -3544,7 +3560,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
db.AddInParameter(cmdUpdate, "@BILLNO", DbType.String, billno);
db.ExecuteNonQuery(cmdUpdate, tran);
}
else {
else
{
cmdUpdate2.Parameters.Clear();
db.AddInParameter(cmdUpdate2, "@BILLNO", DbType.String, billno);
db.ExecuteNonQuery(cmdUpdate2, tran);
@ -3711,7 +3728,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
}
public static DBResult UnLock(String bill,string userid)
public static DBResult UnLock(String bill, string userid)
{
var result = new DBResult();
@ -3762,7 +3779,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
return result;
}
public static DBResult UnLockList(String bills,string userid)
public static DBResult UnLockList(String bills, string userid)
{
var result = new DBResult();
@ -3836,7 +3853,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
{
var cmdupdate = db.GetSqlStringCommand("update ch_fee_invoice set DZSTATUS='"+dzstatus+"' where BILLNO=@BILLNO");
var cmdupdate = db.GetSqlStringCommand("update ch_fee_invoice set DZSTATUS='" + dzstatus + "' where BILLNO=@BILLNO");
cmdupdate.Parameters.Clear();
@ -3925,7 +3942,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
public static DBResult GetRemarksTemplate(string companyid, string templatename = "")
{
var result = new DBResult();
if (templatename == "" || templatename ==null) { templatename = "发票备注"; };
if (templatename == "" || templatename == null) { templatename = "发票备注"; };
string str = "";
var strSql = new StringBuilder();
strSql.Append("SELECT ");
@ -3950,7 +3967,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
return result;
}
public static DBResult SaveRemarksTemplate(string Template,string companyid,string templatename="")
public static DBResult SaveRemarksTemplate(string Template, string companyid, string templatename = "")
{
var result = new DBResult();
@ -4108,8 +4125,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
//if (strl == "") strl = str + Environment.NewLine;
//else strl = strl + str + Environment.NewLine;
if (strl == "") strl = str +" ";
else strl = strl + str +" ";
if (strl == "") strl = str + " ";
else strl = strl + str + " ";
}
}
@ -4122,7 +4139,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
for (var i = 0; i <= StrList.Length - 1; i++)
{
str = StrList[i];
if (str.IndexOf("[外币金额(总计)]") >=0|| str.IndexOf("[人民币金额(总计)]") >= 0 && str.IndexOf("[折算汇率(总计)]") >= 0)
if (str.IndexOf("[外币金额(总计)]") >= 0 || str.IndexOf("[人民币金额(总计)]") >= 0 && str.IndexOf("[折算汇率(总计)]") >= 0)
{
str = str.Replace("[委托编号]", "");
str = str.Replace("[主提单号]", "");
@ -4205,7 +4222,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
r.WriteLine("<Kp>");
r.WriteLine("<Version>2.0</Version>");
r.WriteLine("<Fpxx>");
r.WriteLine("<Zsl>"+headList.Count+"</Zsl>");
r.WriteLine("<Zsl>" + headList.Count + "</Zsl>");
r.WriteLine("<Fpsj>");
foreach (var bill in headList)
{
@ -4221,18 +4238,18 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
r.WriteLine("<Fhr>" + fhr + "</Fhr>");
r.WriteLine("<Skr>" + skr + "</Skr>");
r.WriteLine("<Spbmbbh>12.0</Spbmbbh>");
if (bill.EXCHANGERATE==0)
if (bill.EXCHANGERATE == 0)
r.WriteLine("<Hsbz>0</Hsbz>");
else
r.WriteLine("<Hsbz>1</Hsbz>");
r.WriteLine("<Spxx>");
var invdetaillist = GetDetailList("PID='"+bill.GID+"'");
var invdetaillist = GetDetailList("PID='" + bill.GID + "'");
var invno = 1;
foreach (var invdetail in invdetaillist)
{
r.WriteLine("<Sph>");
r.WriteLine("<Xh>" + invno.ToString()+ "</Xh>");
r.WriteLine("<Xh>" + invno.ToString() + "</Xh>");
r.WriteLine("<Spmc>" + invdetail.GOODSNAMEREF + "</Spmc>");
r.WriteLine("<Ggxh>" + invdetail.SPEC + "</Ggxh>");
r.WriteLine("<Jldw>" + invdetail.UNIT + "</Jldw>");
@ -4244,10 +4261,10 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
r.WriteLine("<Yhzcsm>" + defGOOD.DEFREMARK + "</Yhzcsm>");
r.WriteLine("<Dj>" + Math.Round(invdetail.PRICE,2).ToString() + "</Dj>");
r.WriteLine("<Sl>" + Math.Round(invdetail.PKGS,0).ToString() + "</Sl>");
r.WriteLine("<Je>" + Math.Round(invdetail.AMOUNT,2).ToString() + "</Je>");
r.WriteLine("<Slv>" + Math.Round((invdetail.TAXRATE/100),2).ToString() + "</Slv>");
r.WriteLine("<Dj>" + Math.Round(invdetail.PRICE, 2).ToString() + "</Dj>");
r.WriteLine("<Sl>" + Math.Round(invdetail.PKGS, 0).ToString() + "</Sl>");
r.WriteLine("<Je>" + Math.Round(invdetail.AMOUNT, 2).ToString() + "</Je>");
r.WriteLine("<Slv>" + Math.Round((invdetail.TAXRATE / 100), 2).ToString() + "</Slv>");
r.WriteLine("<Kce>0</Kce>");
r.WriteLine("</Sph>");
@ -4259,9 +4276,10 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
r.WriteLine("</Spxx>");
r.WriteLine("</Fp>");
if (INVEXPLOCK.PARAMVALUE == "1") {
if (INVEXPLOCK.PARAMVALUE == "1")
{
var blUpSQL = "update ch_fee_invoice set BILLSTATUS=1 where BILLNO='" + bill.BILLNO+ "' ";
var blUpSQL = "update ch_fee_invoice set BILLSTATUS=1 where BILLNO='" + bill.BILLNO + "' ";
bool bl = T_ALL_DA.GetExecuteSqlCommand(blUpSQL);
}
@ -4274,7 +4292,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
f.Close();
return filename;
}
public static string CreateDZInvList(List<ChInvoice_HangXin> headList, string path,string companyid)
public static string CreateDZInvList(List<ChInvoice_HangXin> headList, string path, string companyid)
{
var opBill = headList[0];
string filename = path + "\\" + headList[0].INVOICENO.ToString() + "-" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xml";
@ -4306,7 +4324,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
var invdetaillist = GetDetailList("PID='" + bill.GID + "'");
foreach (var invdetail1 in invdetaillist)
{
hjse = hjse+invdetail1.TAX;
hjse = hjse + invdetail1.TAX;
}
hjje = bill.INVAMOUNT - hjse;
r.WriteLine("<COMMON_FPKJ_FPT class=\"COMMON_FPKJ_FPT\">");
@ -4315,9 +4333,9 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
r.WriteLine("<BMB_BBH>33.0</BMB_BBH>");
var company = MsCompanysDAL.GetNoPicData("GID='" + companyid + "'");
r.WriteLine("<XSF_NSRSBH>" + company.TAXCODE+ "</XSF_NSRSBH>");
r.WriteLine("<XSF_NSRSBH>" + company.TAXCODE + "</XSF_NSRSBH>");
r.WriteLine("<XSF_MC>" + company.BILLRISES + "</XSF_MC>");
r.WriteLine("<XSF_DZDH>" +company.ADDRESS + "</XSF_DZDH>");
r.WriteLine("<XSF_DZDH>" + company.ADDRESS + "</XSF_DZDH>");
r.WriteLine("<XSF_YHZH></XSF_YHZH>");
r.WriteLine("<GMF_NSRSBH>" + bill.CUSTRATENO + "</GMF_NSRSBH>");
@ -4349,7 +4367,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
r.WriteLine("<FPHXZ>0</FPHXZ>");
r.WriteLine("<SPBM>" + defGOOD.GOODCODE + "</SPBM>");
r.WriteLine("<ZXBM>" + defGOOD.GOODCODE + "</ZXBM>");
if (defGOOD.ISUSEPREF=="1")
if (defGOOD.ISUSEPREF == "1")
r.WriteLine("<YHZCBS>1</YHZCBS>");
else r.WriteLine("<YHZCBS>0</YHZCBS>");
r.WriteLine("<LSLBS>1</LSLBS>");
@ -4383,7 +4401,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
public static string CreateInvRYORDERTList(List<ChInvoice_HangXin> headList, string path,string optype,string invaccount,string invpsw)
public static string CreateInvRYORDERTList(List<ChInvoice_HangXin> headList, string path, string optype, string invaccount, string invpsw)
{
var opBill = headList[0];
string filename = path + "\\FPORDER" + headList[0].INVOICENO.ToString() + "-" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xml";
@ -4397,7 +4415,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
var ReCode = "OP01";
if (optype=="M") ReCode = "OP02";
if (optype == "M") ReCode = "OP02";
if (optype == "D") ReCode = "OP03";
Request order = new Request();
XmlHead Head = new XmlHead();
@ -4415,10 +4433,11 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
foreach (var bill in headList)
{
var bslist = GetBsList("c.BILLNO='"+bill.BILLNO+"'");
var bslist = GetBsList("c.BILLNO='" + bill.BILLNO + "'");
var bs = new Chfee_do_detail();
if (bslist.Count > 0) bs = bslist[0];
else {
else
{
bs.ETD = DateTime.Now.ToString("yyyy-MM-dd");
bs.PORTLOAD = "QINGDAO";
bs.PORTDISCHARGE = "KOBE,JAPAN";
@ -4436,18 +4455,19 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
orderdetail.order_type = "整箱";
orderdetail.order_date = bs.ETD;
orderdetail.customer_fullname = bill.INVOICECUSTNAME;
orderdetail.start_port =bs.PORTLOAD.Replace(","," ");
orderdetail.start_port = bs.PORTLOAD.Replace(",", " ");
orderdetail.end_port = bs.PORTDISCHARGE.Replace(",", " ");
orderdetail.sail_date =bs.ETD;
orderdetail.shipname =bs.VESSEL;
orderdetail.voyage_no =bs.VOYNO;
orderdetail.bill_lading_no =bs.MBLNO;
orderdetail.sail_date = bs.ETD;
orderdetail.shipname = bs.VESSEL;
orderdetail.voyage_no = bs.VOYNO;
orderdetail.bill_lading_no = bs.MBLNO;
var ctnList = new List<XmlCtn>();
var bsctnlist =MsOpSeaeDAL.GetBodyListSum("BSNO='"+bs.BSNO+"'");
foreach (var enumCtn in bsctnlist ) {
var bsctnlist = MsOpSeaeDAL.GetBodyListSum("BSNO='" + bs.BSNO + "'");
foreach (var enumCtn in bsctnlist)
{
XmlCtn ctn = new XmlCtn();
ctn.ctn_type = enumCtn.CTNALL;
ctn.ctn_quantity = enumCtn.CTNNUM.ToString();
@ -4458,7 +4478,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
XmlCtns Ctns = new XmlCtns();
Ctns.Ctns = ctnList;
orderBody.Ctns= Ctns;
orderBody.Ctns = Ctns;
var feelist = new List<Xmlexpense>();
var invdetaillist = GetDetailList("PID='" + bill.GID + "'");
var invno = 1;
@ -4468,11 +4488,11 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
fee.expense_id = invdetail.GID;
fee.expense_name = invdetail.GOODSNAMEREF;
fee.currency = "RMB";
fee.price =Math.Round(invdetail.TAXPRICE,2).ToString();
fee.price = Math.Round(invdetail.TAXPRICE, 2).ToString();
fee.unit = invdetail.UNIT;
if (fee.unit == "") fee.unit = "票";
fee.quantity = Math.Round(invdetail.PKGS,0).ToString();
if (fee.quantity == ""|| fee.quantity == "0") fee.quantity = "1";
fee.quantity = Math.Round(invdetail.PKGS, 0).ToString();
if (fee.quantity == "" || fee.quantity == "0") fee.quantity = "1";
feelist.Add(fee);
}
@ -4482,7 +4502,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
orderBody.expenses = expenses;
order.OrderBody = orderBody;
// order.OrderBody=ord
// order.OrderBody=ord
}
using (StreamWriter sw = new StreamWriter(filename))
@ -4501,7 +4521,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
}
public static string CreateInvRYTList(List<ChInvoice_HangXin> headList, string path, string optype, List<Xmlexpense> expenses,string invaccount,string invpsw,string email)
public static string CreateInvRYTList(List<ChInvoice_HangXin> headList, string path, string optype, List<Xmlexpense> expenses, string invaccount, string invpsw, string email)
{
var opBill = headList[0];
string filename = path + "\\FP" + headList[0].INVOICENO.ToString() + "-" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".xml";
@ -4550,7 +4570,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
invoice.customer_bank_name = banklist[0];
invoice.customer_bank_account = banklist[1];
}
else {
else
{
invoice.customer_bank_name = bill.CUSTBANK;
invoice.customer_bank_account = bill.CUSTBANK;
}
@ -4568,7 +4589,7 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
// order.OrderBody.Ctns.Ctns = ctnList;
// order.OrderBody.Ctns.Ctns = ctnList;
var XmlInvDetail = new List<XmlInvDetail>();
var invno = 1;
foreach (var invdetail in expenses)
@ -4589,8 +4610,8 @@ namespace DSWeb.Areas.Account.DAL.Chfee_Invoice_HangXin
invoiceBodys.InvDetail = invoicelist;
XmlInvoiceBody invoiceBody = new XmlInvoiceBody();
invoiceBody.InvoiceBodys = invoiceBodys;
order.InvoiceBody= invoiceBody;
// order.OrderBody.expenses.expenses = feelist;
order.InvoiceBody = invoiceBody;
// order.OrderBody.expenses.expenses = feelist;
}

@ -513,12 +513,14 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
public string invoiceCode
{
get {
if (string.IsNullOrWhiteSpace(ChInvoice_HangXin.REDCODE)) {
get
{
if (string.IsNullOrWhiteSpace(ChInvoice_HangXin.REDCODE))
{
return "";
}
return ChInvoice_HangXin.REDCODE.Length==11? "0"+ChInvoice_HangXin.REDCODE: ChInvoice_HangXin.REDCODE;
return ChInvoice_HangXin.REDCODE.Length == 11 ? "0" + ChInvoice_HangXin.REDCODE : ChInvoice_HangXin.REDCODE;
}
}
@ -861,7 +863,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
public string invoiceCode { get { return ChInvoice_HangXin.INVOICECODE; } }
public string invoiceNumber { get{ return ChInvoice_HangXin.INVOICENO; } }
public string invoiceNumber { get { return ChInvoice_HangXin.INVOICENO; } }
public string taxNum { get { return ChInvoice_HangXin.TAXCODE; } }
@ -1096,7 +1098,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
*/
/* 正式地址 大简云*/
public string appKey { get; set; }= "23646802";
public string appKey { get; set; } = "23646802";
public string appSecret { get; set; } = "CBFAFF5B0AED4465";
@ -1509,7 +1511,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
}
}
protected static HangXinRequestHelper getPortToken_(string taxnum )
protected static HangXinRequestHelper getPortToken_(string taxnum)
{
try
@ -1522,8 +1524,9 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
{
return result;
}
else {
result.appKey= INVITERFACE.NUONUOAPPKEY;
else
{
result.appKey = INVITERFACE.NUONUOAPPKEY;
result.appSecret = INVITERFACE.NUONUOAPPSECRET;
}
@ -1554,12 +1557,12 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
// return hx;
// }
//}
result.accessToken= pt.message;
result.accessToken = pt.message;
return result;
}
else
return new HangXinRequestHelper(taxnum,"");
return new HangXinRequestHelper(taxnum, "");
}
catch (Exception e)
{
@ -2044,7 +2047,8 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
}
public class : HangXinRequestHelper {
public class : HangXinRequestHelper
{
public static getHelper(string taxnum)
{
@ -2070,7 +2074,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
}
string method = "nuonuo.OpeMplatform.queryInvoiceResult";
var json = "{" + "\"serialNos\":[\"" + head.INVOICESERIALNUM + "\"]," + "\"orderNo\":[],"+ "\"isOfferInvoiceDetail\":0 }";
var json = "{" + "\"serialNos\":[\"" + head.INVOICESERIALNUM + "\"]," + "\"orderNo\":[]," + "\"isOfferInvoiceDetail\":0 }";
if (string.IsNullOrWhiteSpace(head.INVOICESERIALNUM))
@ -2119,7 +2123,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
{
returndate = ChinvoiceDAL.GetData("cm.BILLNO='" + head.BILLNO + "'");
}
head=returndate ;
head = returndate;
//var invoiceSerialNum = _return.result[0].invoiceSerialNum;
var info = _return.result[0];
@ -2131,7 +2135,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
head.INVOICEINFOURL = info.ofdUrl;
head.INVOICEPDFURL = info.paperPdfUrl;
head.INVOICEMAKETIME = BasicDataRefDAL. Timestamp2Datetime( info.invoiceTime).ToString("yyyy-MM-dd HH:mm:ss");
head.INVOICEMAKETIME = BasicDataRefDAL.Timestamp2Datetime(info.invoiceTime).ToString("yyyy-MM-dd HH:mm:ss");
//if (!string.IsNullOrWhiteSpace(info.invoiceSerialNum))
//{
// head.INVOICESERIALNUM = info.invoiceSerialNum;
@ -2140,6 +2144,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
head.DbOperationType = DbOperationType.DbotUpd;
head.ModelUIStatus = "E";
head.INVOICEMAKETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
var modb = new ModelObjectDB();
var result = modb.Save(head);
if (!result.Success)
@ -2155,10 +2160,11 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
var hx = getHelper(head.TAXCODE);
hx.(head);
}
else {
else
{
result.Message += ":" + info.failCause;
}
result.Data= head;
result.Data = head;
return result;
}
@ -2169,9 +2175,10 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
try
{
var info = _return.result[0];
failCause= "[" + info.failCause + "]";
failCause = "[" + info.failCause + "]";
}
catch {
catch
{
}
@ -2182,7 +2189,8 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
}
}
public DBResult (ChInvoice_HangXin head) {
public DBResult (ChInvoice_HangXin head)
{
var result = new DBResult();
if (string.IsNullOrEmpty(head.INVOICESERIALNUM))
@ -2191,7 +2199,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
return result;
}
var senid=Guid.NewGuid().ToString();
var senid = Guid.NewGuid().ToString();
string method = "nuonuo.OpeMplatform.reInvoice";
@ -2204,7 +2212,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
invoiceNumEnd = ""
};
var json = DSWeb.MvcShipping.Helper.JsonConvert.Serialize(content) ;
var json = DSWeb.MvcShipping.Helper.JsonConvert.Serialize(content);
//"{" + "\"fpqqlsh\":\"" + head.INVOICESERIALNUM + "\"," + "\"orderNo\":[]," + "\"isOfferInvoiceDetail\":0 }";
@ -2348,7 +2356,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
{
//appkey与token问题 需要重新认证
//HangXinRequestHelper.clear(accessToken);
result.SetErrorInfo( "需要重新认证");
result.SetErrorInfo("需要重新认证");
return result;
}
else if (_return.code == "E9106")
@ -2371,10 +2379,14 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
/// <param name="head"></param>
/// <param name="detailList"></param>
/// <returns></returns>
public DBResult PostRedConfirm( ChInvoice_HangXin head,ref ChInvoice_HangXin bluehead,List<ChInvoiceDetail> detailList)
public DBResult PostRedConfirm(ChInvoice_HangXin head, ref ChInvoice_HangXin bluehead, List<ChInvoiceDetail> detailList)
{
//var billno = head.BILLNO;
//20230529 增加判断 如果INVOICEMAKETIME到当前时间 小于24小时 则提示错误并返回
//
var _head = new NuoNuoQuanDian_RedConfirm(head);
var json = DSWeb.TruckMng.Helper.JsonConvert.Serialize(_head);
@ -2396,7 +2408,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
//红字申请单提交成功
//读取红字确认单
var _r= ReadRedConfirm(ref head, detailList);
var _r = ReadRedConfirm(ref head, detailList);
if (!_r.Success)
{
@ -2496,7 +2508,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
/// </summary>
/// <param name="head"></param>
/// <returns></returns>
public DBResult ReadRedConfirm(ref ChInvoice_HangXin head, List<ChInvoiceDetail> detailList=null)
public DBResult ReadRedConfirm(ref ChInvoice_HangXin head, List<ChInvoiceDetail> detailList = null)
{
//var billno = head.BILLNO;
@ -2521,12 +2533,14 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
//根据查询结果读取红票信息
//税务那边实际的红票的订单编号 即为红字申请单orderno也就是当时传过去的咱们的发票BILLNO
if (_return.()) {
if (_return.())
{
//则读取红票
//如不为空 这就是发出红字申请单之后返回结果成功立刻读的
//如为空 就是已产生的红票读取 就不保存了
if (detailList != null) {
if (detailList != null)
{
head.INVOICESERIALNUM = "";
var modb = new ModelObjectDB();
@ -2542,7 +2556,26 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
//result = ReadInvoice(head);
//return result;
; }
;
}
else
{
/* 01 02
03 04
05 06
07 72 08
09 15 16 */
if (_return.())
{
return result.SetErrorInfo("红字确认单申请中");
}
else
{
return result.SetErrorInfo(_return.());
}
}
return result.OK();
@ -2711,13 +2744,25 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
[JsonObject]
///解析开票命令返回值;作废命令返回值
public class : KPResponse
public class : KPResponse
{
public new result result { get; set; }
public bool () {
public bool ()
{
return result.billStatus() == "01";
}
public string ()
{
return result.errormsg();
}
public bool ()
{
return result.billStatus() == "15";
}
}
public class result
@ -2725,11 +2770,17 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
public int total { get; set; }
public new List<> list { get; set; }
public string billStatus() {
public string billStatus()
{
if (list == null || list.Count == 0) return null;
return list[0].billStatus;
}
public string errormsg()
{
if (list == null || list.Count == 0) return null;
return list[0].billMessage;
}
}
@ -3018,7 +3069,7 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
[JsonObject]
///解析读取发票信息命令返回值
public class ReadResponse_: ReadResponse
public class ReadResponse_ : ReadResponse
{
public List<ReadResult_> result { get; set; }
@ -3281,4 +3332,14 @@ namespace DSWeb.Areas.Account.Models.Chfee_Invoice_HangXin
{
}
public class InvoiceFeeSum
{
public string CURR { get; set; }
public decimal amount { get; set; }
public decimal exchange { get; set; }
}
}

@ -483,9 +483,29 @@ Ext.extend(Shipping.MsChInvoiceAppEdit, Ext.Panel, {
}
}
}
});
this.storeRedReason = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeRedReason.load({ params: { enumTypeId: 80008 } });
this.comboxRedReason = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: "冲红理由", //业务类型
FLEX: 0.8,
store: this.storeRedReason,
name: 'redReason',
valueField: 'EnumValueId',
displayField: 'EnumValueName',
enableKeyEvents: true,
listeners: {
//scope: this,
//'select': function (combo, records, eOpts) {
// if (records.length > 0) {
// _this.setInvTile(records[0].data.EnumValueName);
// }
//}
}
});
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsOP',
proxy: {
@ -1242,6 +1262,7 @@ Ext.extend(Shipping.MsChInvoiceAppEdit, Ext.Panel, {
}]
},
this.comboxRedReason,
//////
{
fieldLabel: '船名航次', hidden: true,
@ -5538,6 +5559,7 @@ Ext.extend(Shipping.MsChInvoiceAppEdit, Ext.Panel, {
onNNSetRedClick: function () {
var billno = this.formEdit.getForm().findField('BILLNO').getValue();
var redReason = this.formEdit.getForm().findField('redReason').getValue();
if (billno == '*' || billno == '') {

Loading…
Cancel
Save