|
@@ -954,6 +954,102 @@ namespace SiteCore.Handler
|
|
|
}
|
|
}
|
|
|
returnErrorMsg("缺少必要的参数id");
|
|
returnErrorMsg("缺少必要的参数id");
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public void save_erp_billinfo()
|
|
|
|
|
+ {
|
|
|
|
|
+ if (UrlPostParmsCheck("ctid"))
|
|
|
|
|
+ {
|
|
|
|
|
+ string eid = GetPostString("ctid");
|
|
|
|
|
+ CeErpTradeCell entity = null;
|
|
|
|
|
+ if (eid != "") entity = CeErpTradeCell.GetByCtid(eid);
|
|
|
|
|
+ if (entity != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ CeErpBill bill = CeErpBill.GetByTid(eid);
|
|
|
|
|
+ bool isHave = false;
|
|
|
|
|
+ if (bill != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ isHave = true;
|
|
|
|
|
+ if (bill.state != 4)
|
|
|
|
|
+ {
|
|
|
|
|
+ returnErrorMsg("此单已经申请过发票了");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if (entity.IsNeedBill == 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ entity.IsNeedBill = 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ entity.Update();
|
|
|
|
|
+ string errjson = "";
|
|
|
|
|
+ try
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ CeErpBill bill_entity = new CeErpBill();
|
|
|
|
|
+ bill_entity.tid = entity.tid;
|
|
|
|
|
+
|
|
|
|
|
+ bill_entity.title = GetPostString("title");
|
|
|
|
|
+ string taxstr = GetPostString("tax");
|
|
|
|
|
+ taxstr = taxstr.Replace(" ", "");
|
|
|
|
|
+ bill_entity.tax = taxstr;
|
|
|
|
|
+ bill_entity.bank = GetPostString("bank");
|
|
|
|
|
+ string bankacstr = GetPostString("bankac");
|
|
|
|
|
+ bankacstr = bankacstr.Replace(" ", "");
|
|
|
|
|
+ bill_entity.bankac = bankacstr;
|
|
|
|
|
+ bill_entity.address = GetPostString("address");
|
|
|
|
|
+ bill_entity.phone = GetPostString("phone");
|
|
|
|
|
+ bill_entity.price = GetPostString("price");
|
|
|
|
|
+
|
|
|
|
|
+ int billCount = (int)Math.Floor(Convert.ToDouble(bill_entity.price) / 1000.00);
|
|
|
|
|
+ if (Convert.ToDouble(bill_entity.price) % 1000.00 > 0.00001)
|
|
|
|
|
+ {
|
|
|
|
|
+ billCount += 1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ string prebill = "ltb";
|
|
|
|
|
+ for (int idx = 1; idx <= billCount; idx++)
|
|
|
|
|
+ {
|
|
|
|
|
+ string dtstr = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
|
|
|
+ string billoid = prebill + idx + dtstr;
|
|
|
|
|
+ bill_entity.billOrderId += billoid;
|
|
|
|
|
+ if (idx < billCount)
|
|
|
|
|
+ {
|
|
|
|
|
+ bill_entity.billOrderId += ",";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ bill_entity.productId = GetPostInt("ProductName");
|
|
|
|
|
+ bill_entity.num = GetPostInt("num");
|
|
|
|
|
+ bill_entity.unit = GetPostString("unit");
|
|
|
|
|
+ bill_entity.type = GetPostString("type");
|
|
|
|
|
+ bill_entity.sendType = GetPostString("SendType");
|
|
|
|
|
+ bill_entity.email = GetPostString("email");
|
|
|
|
|
+ bill_entity.buyer_nick = GetPostString("buyer_nick");
|
|
|
|
|
+ bill_entity.shopName = GetPostString("ShopName");
|
|
|
|
|
+ bill_entity.applymemo = GetPostString("applyMemo");
|
|
|
|
|
+ bill_entity.createTime = DateTime.Now;
|
|
|
|
|
+ bill_entity.state = 0;
|
|
|
|
|
+ bill_entity.userId = 11;
|
|
|
|
|
+ errjson = Utils.Serialization.JsonString.ConvertObject(bill_entity);
|
|
|
|
|
+ bill_entity.Create();
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ catch (Exception ex)
|
|
|
|
|
+ {
|
|
|
|
|
+ XLog.SaveLog(0, errjson + "创建发票出错," + ex.Message);
|
|
|
|
|
+ returnErrorMsg("创建发票出错!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ LogHelper.addLog(entity.ctid, CurrentUser.UserID, "申请发票", entity.OrderState, 1);
|
|
|
|
|
+ returnSuccessMsg("发票申请成功!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ returnErrorMsg("找不到记录");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
/**
|
|
/**
|
|
|
* 查货
|
|
* 查货
|
|
|
* ctid
|
|
* ctid
|