private void btnImprot_Click(object sender, EventArgs e) { try { gridViewPL.FocusedRowHandle -= 1; gridViewPL.FocusedRowHandle += 1; } catch { } try { if (txtCurrency.Text.Trim() == "") { throw new Exception("Please set currency"); } decimal dExch = BaseFunction.ReturnDecimal(txtExchangeRate.Text.Trim()); if (dExch == 0) { throw new Exception("Please set the exchange rate"); } int iCou = gridViewPL.RowCount; if (iCou == 0) { throw new Exception("no data"); } int iCodeCou = gridViewPL.RowCount; string sErr = ""; string sWarn = ""; int iCount = 0; SqlConnection conn = new SqlConnection(Conn); conn.Open(); //启用事务 SqlTransaction tran = conn.BeginTransaction(); try { DateTime dLogDate = BaseFunction.ReturnDate(sLogDate); //string sDate = dateEdit1.DateTime.ToString("yyyy-MM-dd"); string sDate = sLogDate; string sSQL = @" select bflag_PU from gl_mend where iyear = aaaaaa and iperiod = bbbbbb "; sSQL = sSQL.Replace("aaaaaa", dLogDate.Year.ToString()); sSQL = sSQL.Replace("bbbbbb", dLogDate.Month.ToString()); DataTable dtTemp = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; if (BaseFunction.ReturnBool(dtTemp.Rows[0]["bflag_PU"])) { throw new Exception("The current date has been checked out"); } string sDateTime = dateEditQuery.DateTime.ToString("yyyy-MM-dd"); long lID = -1; long lIDDetails = -1; sSQL = @" declare @p5 int set @p5=aaaaaa declare @p6 int set @p6=bbbbbb exec sp_GetId N'00',N'dddddd',N'tr',cccccc,@p5 output,@p6 output,default select @p5, @p6 "; sSQL = sSQL.Replace("aaaaaa", lID.ToString()); sSQL = sSQL.Replace("bbbbbb", lIDDetails.ToString()); sSQL = sSQL.Replace("cccccc", iCou.ToString()); sSQL = sSQL.Replace("dddddd", sAccID); DataTable dt = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; lID = BaseFunction.ReturnLong(dt.Rows[0][0]) - 1; lIDDetails = BaseFunction.ReturnLong(dt.Rows[0][1]) - iCodeCou; sSQL = @" select a.EntryNO,b.* from RdRecords01_Import a inner join ( select a.cCode,a.cVouchType ,a.cDepCode,a.dDate,a.cBusType ,a.cPTCode ,a.cExch_Name,a.cVenCode ,a.cRdCode ,a.cWhCode ,a.bRdFlag ,a.cPersonCode ,a.cSource,a.iExchRate ,b.AutoID,b.cInvCode,b.iQuantity,b.irowno,b.iOriCost,b.iOriMoney,b.iOriTaxPrice,b.iOriSum,b.iMoney,b.iTaxPrice,b.iSum,b.iTaxRate,b.iPOsID ,b.iOriTaxCost ,a.cDefine1, a.cDefine2, a.cDefine3, a.cDefine4, a.cDefine5, a.cDefine6, a.cDefine7, a.cDefine8, a.cDefine9, a.cDefine10, a.cDefine11, a.cDefine12, a.cDefine13, a.cDefine14, a.cDefine15, a.cDefine16 ,b.cDefine22, cDefine23, b.cDefine24, b.cDefine25, b.cDefine26, b.cDefine27, b.cDefine28, b.cDefine29, b.cDefine30, b.cDefine31, cDefine32, b.cDefine33, b.cDefine34, b.cDefine35, b.cDefine36, b.cDefine37 from RdRecord01 a inner join Rdrecords01 b on a.id = b.id )b on a.Rds01ID = b.Autoid where a.InvoiceNo = 'aaaaaa' "; sSQL = sSQL.Replace("aaaaaa", txtInvoiceNO.Text.Trim()); DataTable dtRd01 = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; if (dtRd01 == null || dtRd01.Rows.Count == 0) { throw new Exception("Purchase receipt warrant is not exists"); } Model.PurBillVouch mod = new UFIDA.U8.UAP.CustomApp.ControlForm.Model.PurBillVouch(); mod.PBVID = lID.ToString(); mod.cPBVBillType = "01"; mod.cPBVCode = txtInvoiceNO.Text.Trim(); mod.cPTCode = dtRd01.Rows[0]["cPTCode"].ToString().Trim(); mod.dPBVDate = dLogDate; mod.cVenCode = dtRd01.Rows[0]["cVenCode"].ToString().Trim(); mod.cUnitCode = dtRd01.Rows[0]["cVenCode"].ToString().Trim(); //代垫单位代码 mod.cDepCode = dtRd01.Rows[0]["cDepCode"].ToString().Trim(); mod.cexch_name = txtCurrency.Text.Trim(); mod.cExchRate = dExch; mod.iPBVTaxRate = BaseFunction.ReturnDecimal(dtRd01.Rows[0]["iTaxRate"]); mod.cInCode = dtRd01.Rows[0]["cCode"].ToString().Trim(); mod.cBusType = dtRd01.Rows[0]["cBusType"].ToString().Trim(); mod.cPBVMaker = sUserName; mod.bNegative = false; mod.bOriginal = false; mod.bFirst = false; mod.iNetLock = 0; mod.dVouDate = dLogDate; mod.iVTid = 8163; mod.cSource = "采购"; mod.iDiscountTaxType = 0; //mod.cVenPUOMProtocol mod.dCreditStart = dLogDate; mod.iCreditPeriod = 0; mod.dGatheringDate = dLogDate; mod.bCredit = 1; mod.iPrintCount = 0; mod.IsWfControlled = false; mod.csysbarcode = "||puzl|" + mod.cPBVCode; mod.cmaketime = DateTime.Now; mod.cCurrentAuditor = null; mod.cDefine1 = dtRd01.Rows[0]["cDefine1"].ToString().Trim(); mod.cDefine10 = dtRd01.Rows[0]["cDefine10"].ToString().Trim(); //mod.cDefine11 = txtBL.Text.Trim(); DAL.PurBillVouch dal = new UFIDA.U8.UAP.CustomApp.ControlForm.DAL.PurBillVouch(); sSQL = dal.Add(mod); DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL); //回写采购入库单表头自定义项10 为发票号 sSQL = @" Update Rdrecord01 set cDefine10 = 'aaaaaaaa' where ID in (select ID from Rdrecords01 where Autoid = bbbbbbbb) "; sSQL = sSQL.Replace("aaaaaaaa", mod.cPBVCode); sSQL = sSQL.Replace("bbbbbbbb", gridViewPL.GetRowCellValue(0, gridColRds01ID).ToString()); DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL); int iRow = 0; for (int i = 0; i < gridViewPL.RowCount; i++) { //判断是否生成了调拨单 string sTrIDs = gridViewPL.GetRowCellValue(i, gridColU8TrsID).ToString().Trim(); if (sTrIDs != "") { sSQL = @" select autoid from TransVouchs where autoid = aaaaaaaa "; sSQL = sSQL.Replace("aaaaaaaa", sTrIDs); DataTable dtTr = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; if (dtTr == null || dtTr.Rows.Count == 0) { sWarn = sWarn + "Line " + (i + 1).ToString() + " no transfer order\n"; } } else { sWarn = sWarn + "Line " + (i + 1).ToString() + " no transfer order\n"; } //判断是否生成了发票 string sPurIDs = gridViewPL.GetRowCellValue(i, gridColPurBillIDs).ToString().Trim(); if (sPurIDs != "") { sSQL = @" select id from PurBillVouchs where ID = aaaaaaaa "; sSQL = sSQL.Replace("aaaaaaaa", sPurIDs); DataTable dtPur = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; if (dtPur != null && dtPur.Rows.Count > 0) { sErr = sErr + "Line " + (i + 1).ToString() + " imported invoice\n"; continue; } } DataRow[] drs; string sRds01ID = gridViewPL.GetRowCellValue(i, gridColRds01ID).ToString().Trim(); if (sRds01ID == "") { sErr = sErr + "Line " + (i + 1).ToString() + " purchase receipt warrant is not exists\n"; continue; } else { drs = dtRd01.Select("Autoid = " + sRds01ID); if (drs.Length == 0) { sErr = sErr + "Line " + (i + 1).ToString() + " purchase receipt warrant is not exists\n"; continue; } } Model.PurBillVouchs mods = new UFIDA.U8.UAP.CustomApp.ControlForm.Model.PurBillVouchs(); sSQL = @" Select b.iQuantity - isnull(b.iSumBillQuantity,0) as QtyUnRDIn ,b.* from Rdrecord01 a inner join Rdrecords01 b on a.ID = b.ID where AutoID = bbbbbb "; sSQL = sSQL.Replace("bbbbbb", gridViewPL.GetRowCellValue(i, gridColRds01ID).ToString()); DataTable dtRds01 = DbHelperSQL.ExecuteDataset(tran, CommandType.Text, sSQL).Tables[0]; if (dtRds01 == null || dtRds01.Rows.Count == 0) { sErr = sErr + "Line " + (i + 1).ToString() + " purchase entry form is not imported\n"; continue; } decimal dQtyUnRDIn = BaseFunction.ReturnDecimal(dtRds01.Rows[0]["QtyUnRDIn"]); lIDDetails += 1; mods.ID = lIDDetails; mods.PBVID = mod.PBVID; mods.cInvCode = gridViewPL.GetRowCellValue(i, gridColPARTNO).ToString().Trim(); mods.bExBill = false; mods.iPBVQuantity = BaseFunction.ReturnDecimal(gridViewPL.GetRowCellValue(i, gridColQUANTITY)); if (mods.iPBVQuantity > dQtyUnRDIn) { sErr = sErr + "Row " + (i + 1).ToString() + " qty err\n"; continue; } mods.iTaxRate = BaseFunction.ReturnDecimal(drs[0]["iTaxRate"]); mods.iOriCost = BaseFunction.ReturnDecimal(drs[0]["iOriCost"]); mods.iOriMoney = BaseFunction.ReturnDecimal(drs[0]["iOriMoney"]); //原币无税金额 mods.iOriSum = BaseFunction.ReturnDecimal(drs[0]["iOriSum"]); mods.iOriTaxCost = BaseFunction.ReturnDecimal(drs[0]["iOriTaxCost"]); mods.iOriTaxPrice = mods.iOriSum - mods.iOriMoney; mods.iCost = BaseFunction.ReturnDecimal(mods.iOriCost * dExch); mods.iMoney = BaseFunction.ReturnDecimal(mods.iOriMoney * dExch); mods.iSum = BaseFunction.ReturnDecimal(mods.iOriSum * dExch); mods.iOriTotal = 0; mods.iTotal = 0; mods.iTaxRate = BaseFunction.ReturnDecimal(drs[0]["iTaxRate"]); mods.iTaxPrice = mods.iSum - mods.iMoney; mods.cDefine22 = gridViewPL.GetRowCellValue(i, gridColCONTAINERNO).ToString().Trim(); mods.cDefine23 = gridViewPL.GetRowCellValue(i, gridColBOXNO).ToString().Trim(); mods.cDefine24 = gridViewPL.GetRowCellValue(i, gridColCASENO).ToString().Trim(); mods.cDefine25 = gridViewPL.GetRowCellValue(i, gridColGWKGS).ToString().Trim(); mods.cDefine28 = gridViewPL.GetRowCellValue(i, gridColNWKGS).ToString().Trim(); mods.iPOsID = BaseFunction.ReturnLong(drs[0]["iPOsID"]); mods.RdsId = BaseFunction.ReturnLong(drs[0]["AutoID"]); mods.UpSoType = "rd"; mods.bCosting = false; mods.bTaxCost = true; mods.iinvexchrate = 0; mods.brettax = 0; mods.ivouchrowno = i + 1; mods.cbsysbarcode = "||puzl|" + mod.cPBVCode + "|" + mods.ivouchrowno.ToString(); DAL.PurBillVouchs dals = new UFIDA.U8.UAP.CustomApp.ControlForm.DAL.PurBillVouchs(); sSQL = dals.Add(mods); iCount += DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL); //回写导入中间表 Rdrecords10_Import sSQL = @" update RdRecords01_Import set PurBillIDs = AAAAAA WHERE AUTOID = BBBBBB "; sSQL = sSQL.Replace("AAAAAA", mods.ID.ToString()); sSQL = sSQL.Replace("BBBBBB", gridViewPL.GetRowCellValue(i, gridColAutoID).ToString()); int iRet = DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL); if (iRet != 1) { sErr = sErr + "Row " + (i + 1) + " update dl err\n"; } //回写采购入库单 sSQL = @" update Rdrecords01 set iSumBillQuantity = isnull(iSumBillQuantity,0) + aaaaaa where AutoID = bbbbbb "; sSQL = sSQL.Replace("aaaaaa", gridViewPL.GetRowCellValue(i, gridColQUANTITY).ToString()); sSQL = sSQL.Replace("bbbbbb", gridViewPL.GetRowCellValue(i, gridColRds01ID).ToString()); DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL); //回写采购订单 sSQL = @" update PO_Podetails set iInvQTY = isnull(iInvQTY ,0) + aaaaaa,iInvMoney = isnull(iInvMoney ,0) + cccccc,iNatInvMoney = isnull(iNatInvMoney ,0) + dddddd where ID = bbbbbb "; sSQL = sSQL.Replace("aaaaaa", mods.iPBVQuantity.ToString()); sSQL = sSQL.Replace("bbbbbb", mods.iPOsID.ToString()); sSQL = sSQL.Replace("cccccc", mods.iOriMoney.ToString()); sSQL = sSQL.Replace("dddddd", mods.iMoney.ToString()); DbHelperSQL.ExecuteNonQuery(tran, CommandType.Text, sSQL); } if (sErr != "") { throw new Exception(sErr); } if (sWarn != "") { if (MessageBox.Show(sWarn, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) != DialogResult.Yes) { throw new Exception("User canceled "); } } if (iCount > 0) { tran.Commit(); MessageBox.Show("Success:" + mod.cPBVCode); SetTxtNull(); } else { throw new Exception("Save failed"); } } catch (Exception error) { tran.Rollback(); throw new Exception(error.Message); } } catch (Exception ee) { FrmMsgBox frm = new FrmMsgBox(); frm.richTextBox1.Text = ee.Message; frm.ShowDialog(); } }
/// <summary> /// 增加一条数据 /// </summary> public string Add(UFIDA.U8.UAP.CustomApp.ControlForm.Model.PurBillVouch model) { StringBuilder strSql = new StringBuilder(); StringBuilder strSql1 = new StringBuilder(); StringBuilder strSql2 = new StringBuilder(); if (model.PBVID != null) { strSql1.Append("PBVID,"); strSql2.Append("'" + model.PBVID + "',"); } if (model.cPBVBillType != null) { strSql1.Append("cPBVBillType,"); strSql2.Append("'" + model.cPBVBillType + "',"); } if (model.cPBVCode != null) { strSql1.Append("cPBVCode,"); strSql2.Append("'" + model.cPBVCode + "',"); } if (model.cPTCode != null) { strSql1.Append("cPTCode,"); strSql2.Append("'" + model.cPTCode + "',"); } if (model.dPBVDate != null) { strSql1.Append("dPBVDate,"); strSql2.Append("'" + model.dPBVDate + "',"); } if (model.cVenCode != null) { strSql1.Append("cVenCode,"); strSql2.Append("'" + model.cVenCode + "',"); } if (model.cUnitCode != null) { strSql1.Append("cUnitCode,"); strSql2.Append("'" + model.cUnitCode + "',"); } if (model.cDepCode != null) { strSql1.Append("cDepCode,"); strSql2.Append("'" + model.cDepCode + "',"); } if (model.cPersonCode != null) { strSql1.Append("cPersonCode,"); strSql2.Append("'" + model.cPersonCode + "',"); } if (model.cPayCode != null) { strSql1.Append("cPayCode,"); strSql2.Append("'" + model.cPayCode + "',"); } if (model.cexch_name != null) { strSql1.Append("cexch_name,"); strSql2.Append("'" + model.cexch_name + "',"); } if (model.cExchRate != null) { strSql1.Append("cExchRate,"); strSql2.Append("" + model.cExchRate + ","); } if (model.iPBVTaxRate != null) { strSql1.Append("iPBVTaxRate,"); strSql2.Append("" + model.iPBVTaxRate + ","); } if (model.cPBVMemo != null) { strSql1.Append("cPBVMemo,"); strSql2.Append("'" + model.cPBVMemo + "',"); } if (model.cOrderCode != null) { strSql1.Append("cOrderCode,"); strSql2.Append("'" + model.cOrderCode + "',"); } if (model.cInCode != null) { strSql1.Append("cInCode,"); strSql2.Append("'" + model.cInCode + "',"); } if (model.cBusType != null) { strSql1.Append("cBusType,"); strSql2.Append("'" + model.cBusType + "',"); } if (model.dSDate != null) { strSql1.Append("dSDate,"); strSql2.Append("'" + model.dSDate + "',"); } if (model.cPBVMaker != null) { strSql1.Append("cPBVMaker,"); strSql2.Append("'" + model.cPBVMaker + "',"); } if (model.cPBVVerifier != null) { strSql1.Append("cPBVVerifier,"); strSql2.Append("'" + model.cPBVVerifier + "',"); } if (model.bNegative != null) { strSql1.Append("bNegative,"); strSql2.Append("" + (model.bNegative ? 1 : 0) + ","); } if (model.bOriginal != null) { strSql1.Append("bOriginal,"); strSql2.Append("" + (model.bOriginal ? 1 : 0) + ","); } if (model.bFirst != null) { strSql1.Append("bFirst,"); strSql2.Append("" + (model.bFirst ? 1 : 0) + ","); } if (model.citem_class != null) { strSql1.Append("citem_class,"); strSql2.Append("'" + model.citem_class + "',"); } if (model.citemcode != null) { strSql1.Append("citemcode,"); strSql2.Append("'" + model.citemcode + "',"); } if (model.cHeadCode != null) { strSql1.Append("cHeadCode,"); strSql2.Append("'" + model.cHeadCode + "',"); } if (model.iNetLock != null) { strSql1.Append("iNetLock,"); strSql2.Append("" + model.iNetLock + ","); } if (model.cDefine1 != null) { strSql1.Append("cDefine1,"); strSql2.Append("'" + model.cDefine1 + "',"); } if (model.cDefine2 != null) { strSql1.Append("cDefine2,"); strSql2.Append("'" + model.cDefine2 + "',"); } if (model.cDefine3 != null) { strSql1.Append("cDefine3,"); strSql2.Append("'" + model.cDefine3 + "',"); } if (model.cDefine4 != null) { strSql1.Append("cDefine4,"); strSql2.Append("'" + model.cDefine4 + "',"); } if (model.cDefine5 != null) { strSql1.Append("cDefine5,"); strSql2.Append("" + model.cDefine5 + ","); } if (model.cDefine6 != null) { strSql1.Append("cDefine6,"); strSql2.Append("'" + model.cDefine6 + "',"); } if (model.cDefine7 != null) { strSql1.Append("cDefine7,"); strSql2.Append("" + model.cDefine7 + ","); } if (model.cDefine8 != null) { strSql1.Append("cDefine8,"); strSql2.Append("'" + model.cDefine8 + "',"); } if (model.cDefine9 != null) { strSql1.Append("cDefine9,"); strSql2.Append("'" + model.cDefine9 + "',"); } if (model.cDefine10 != null) { strSql1.Append("cDefine10,"); strSql2.Append("'" + model.cDefine10 + "',"); } if (model.bPayment != null) { strSql1.Append("bPayment,"); strSql2.Append("'" + model.bPayment + "',"); } if (model.dVouDate != null) { strSql1.Append("dVouDate,"); strSql2.Append("'" + model.dVouDate + "',"); } if (model.iVTid != null) { strSql1.Append("iVTid,"); strSql2.Append("" + model.iVTid + ","); } if (model.ufts != null) { strSql1.Append("ufts,"); strSql2.Append("" + model.ufts + ","); } if (model.cAccounter != null) { strSql1.Append("cAccounter,"); strSql2.Append("'" + model.cAccounter + "',"); } if (model.cSource != null) { strSql1.Append("cSource,"); strSql2.Append("'" + model.cSource + "',"); } if (model.cDefine11 != null) { strSql1.Append("cDefine11,"); strSql2.Append("'" + model.cDefine11 + "',"); } if (model.cDefine12 != null) { strSql1.Append("cDefine12,"); strSql2.Append("'" + model.cDefine12 + "',"); } if (model.cDefine13 != null) { strSql1.Append("cDefine13,"); strSql2.Append("'" + model.cDefine13 + "',"); } if (model.cDefine14 != null) { strSql1.Append("cDefine14,"); strSql2.Append("'" + model.cDefine14 + "',"); } if (model.cDefine15 != null) { strSql1.Append("cDefine15,"); strSql2.Append("" + model.cDefine15 + ","); } if (model.cDefine16 != null) { strSql1.Append("cDefine16,"); strSql2.Append("" + model.cDefine16 + ","); } if (model.bIAFirst != null) { strSql1.Append("bIAFirst,"); strSql2.Append("" + (model.bIAFirst ? 1 : 0) + ","); } if (model.iDiscountTaxType != null) { strSql1.Append("iDiscountTaxType,"); strSql2.Append("" + model.iDiscountTaxType + ","); } if (model.cVenPUOMProtocol != null) { strSql1.Append("cVenPUOMProtocol,"); strSql2.Append("'" + model.cVenPUOMProtocol + "',"); } if (model.dCreditStart != null) { strSql1.Append("dCreditStart,"); strSql2.Append("'" + model.dCreditStart + "',"); } if (model.iCreditPeriod != null) { strSql1.Append("iCreditPeriod,"); strSql2.Append("" + model.iCreditPeriod + ","); } if (model.dGatheringDate != null) { strSql1.Append("dGatheringDate,"); strSql2.Append("'" + model.dGatheringDate + "',"); } if (model.cModifyDate != null) { strSql1.Append("cModifyDate,"); strSql2.Append("'" + model.cModifyDate + "',"); } if (model.cReviser != null) { strSql1.Append("cReviser,"); strSql2.Append("'" + model.cReviser + "',"); } if (model.bCredit != null) { strSql1.Append("bCredit,"); strSql2.Append("" + model.bCredit + ","); } if (model.iBG_OverFlag != null) { strSql1.Append("iBG_OverFlag,"); strSql2.Append("" + model.iBG_OverFlag + ","); } if (model.cBG_Auditor != null) { strSql1.Append("cBG_Auditor,"); strSql2.Append("'" + model.cBG_Auditor + "',"); } if (model.cBG_AuditTime != null) { strSql1.Append("cBG_AuditTime,"); strSql2.Append("'" + model.cBG_AuditTime + "',"); } if (model.ControlResult != null) { strSql1.Append("ControlResult,"); strSql2.Append("" + model.ControlResult + ","); } if (model.iflowid != null) { strSql1.Append("iflowid,"); strSql2.Append("" + model.iflowid + ","); } if (model.dverifydate != null) { strSql1.Append("dverifydate,"); strSql2.Append("'" + model.dverifydate + "',"); } if (model.dverifysystime != null) { strSql1.Append("dverifysystime,"); strSql2.Append("'" + model.dverifysystime + "',"); } if (model.cVenAccount != null) { strSql1.Append("cVenAccount,"); strSql2.Append("'" + model.cVenAccount + "',"); } if (model.iPrintCount != null) { strSql1.Append("iPrintCount,"); strSql2.Append("" + model.iPrintCount + ","); } if (model.ccleanver != null) { strSql1.Append("ccleanver,"); strSql2.Append("'" + model.ccleanver + "',"); } if (model.cContactCode != null) { strSql1.Append("cContactCode,"); strSql2.Append("'" + model.cContactCode + "',"); } if (model.cVenPerson != null) { strSql1.Append("cVenPerson,"); strSql2.Append("'" + model.cVenPerson + "',"); } if (model.cVenBank != null) { strSql1.Append("cVenBank,"); strSql2.Append("'" + model.cVenBank + "',"); } if (model.cVerifier != null) { strSql1.Append("cVerifier,"); strSql2.Append("'" + model.cVerifier + "',"); } if (model.cAuditDate != null) { strSql1.Append("cAuditDate,"); strSql2.Append("'" + model.cAuditDate + "',"); } if (model.cAuditTime != null) { strSql1.Append("cAuditTime,"); strSql2.Append("'" + model.cAuditTime + "',"); } if (model.iverifystateex != null) { strSql1.Append("iverifystateex,"); strSql2.Append("" + model.iverifystateex + ","); } if (model.ireturncount != null) { strSql1.Append("ireturncount,"); strSql2.Append("" + model.ireturncount + ","); } if (model.IsWfControlled != null) { strSql1.Append("IsWfControlled,"); strSql2.Append("" + (model.IsWfControlled ? 1 : 0) + ","); } if (model.csysbarcode != null) { strSql1.Append("csysbarcode,"); strSql2.Append("'" + model.csysbarcode + "',"); } if (model.cCurrentAuditor != null) { strSql1.Append("cCurrentAuditor,"); strSql2.Append("'" + model.cCurrentAuditor + "',"); } if (model.cmaketime != null) { strSql1.Append("cmaketime,"); strSql2.Append("'" + model.cmaketime + "',"); } if (model.cmodifytime != null) { strSql1.Append("cmodifytime,"); strSql2.Append("'" + model.cmodifytime + "',"); } strSql.Append("insert into PurBillVouch("); strSql.Append(strSql1.ToString().Remove(strSql1.Length - 1)); strSql.Append(")"); strSql.Append(" values ("); strSql.Append(strSql2.ToString().Remove(strSql2.Length - 1)); strSql.Append(")"); return(strSql.ToString()); }