protected void grd_Photo_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e) { e.NewValues["FileNote"] = " "; e.NewValues["CreateBy"] = EzshipHelper.GetUserName(); e.NewValues["CreateDateTime"] = DateTime.Now; }
private int InsertTripLog(string jobNo, string jobType, string driver, string status, string logDate, string logTime, string rmk) { string sql = string.Format(@"INSERT INTO [CTM_TripLog]([JobNo],[JobType],[Driver],[Status],[LogDate],[LogTime],[Remark],[CreateDateTime],[CreateBy],[UpdateDateTime],[UpdateBy]) VALUES('{0}' ,'{1}' ,'{2}' ,'{3}' ,'{4}' ,'{5}' ,'{6}' ,'{8}' ,'{7}' ,'{8}' ,'{7}')", jobNo, jobType, driver, status, logDate, logTime, rmk, EzshipHelper.GetUserName(), DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); return(ConnectSql.ExecuteSql(sql)); }
protected void grid_Log_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e) { e.NewValues["UpdateBy"] = EzshipHelper.GetUserName(); e.NewValues["UpdateDateTime"] = DateTime.Now; }
/// <summary> /// if dotype=in, then calc lastschqty and preqty /// if dotype=out , calc preqty /// don't calc the transfer data(which dono=''). /// for do in /// if isSch= N , only get lastSchQty /// if isSch=Y , need LastSchQty and qty-preQty /// for do out /// only get the qty-preqty /// /// update create invoice, /// update preqty=qty,lastschqty=inqty-outqty where dotype=in and dono!='' /// update preqty=qty,lastschqty=0 where dotype=out and dono!='' /// </summary> protected void btn_CreateIV_Click1(object sender, EventArgs e) { //1: issch=false , the qty=qty1 n=schdate-dodate //2:issch=true, qty=lastschqty n=currentschdate-lastschdate //3:issch=true, qty=qty-preqty n=schdate-dodate string sql = @"select * from (select mast.DoNo,mast.DoDate,mast.DoType,mast.PartyId,mast.Quotation as ContractNo,det.Product as Sku,det.LotNo ,Case when isnull(det.isSch,0)=0 then isnull(det.Qty1,0) else isnull(det.Qty1,0)-isnull(det.PreQty1,0) end as Qty1 ,Case when isnull(det.isSch,0)=0 then isnull(det.Qty2,0) else isnull(det.Qty2,0)-isnull(det.PreQty2,0) end as Qty2 ,Case when isnull(det.isSch,0)=0 then isnull(det.Qty3,0) else isnull(det.Qty3,0)-isnull(det.PreQty3,0) end as Qty3 ,Case when isnull(det.isSch,0)=1 and det.DoType='IN' then isnull(det.LastSchQty1,0) else 0 end as LastSchQty1 ,Case when isnull(det.isSch,0)=1 and det.DoType='IN' then isnull(det.LastSchQty2,0) else 0 end as LastSchQty2 ,Case when isnull(det.isSch,0)=1 and det.DoType='IN' then isnull(det.LastSchQty3,0) else 0 end as LastSchQty3 ,det.IsSch,det.LastSchDate,ref.ArCode,ref.Description from wh_dodet2 det inner join wh_do mast on mast.DoNo=det.DoNo and mast.DoType=det.Dotype inner join ref_product ref on ref.Code=det.Product where mast.StatusCode!='CNL' and len(isnull(det.DoNo,''))>0 ) as tab where (Qty1+Qty2+Qty3>0 or LastSchQty1+LastSchQty2+LastSchQty3>0) order by PartyId,DoDate,DoNo"; //one customer only have one invoice DataTable tab = ConnectSql.GetTab(sql); string lastPartyId = ""; int lastInvId = 0; string lastInvNo = ""; for (int i = 0; i < tab.Rows.Count; i++) { string sku = SafeValue.SafeString(tab.Rows[i]["Sku"]); string lotNo = SafeValue.SafeString(tab.Rows[i]["LotNo"]); string contractNo = SafeValue.SafeString(tab.Rows[i]["ContractNo"]); DateTime doDate = SafeValue.SafeDate(tab.Rows[i]["DoDate"], DateTime.Today); string partyId = SafeValue.SafeString(tab.Rows[i]["PartyId"]); int qty1 = SafeValue.SafeInt(tab.Rows[i]["Qty1"], 0); int qty2 = SafeValue.SafeInt(tab.Rows[i]["Qty2"], 0); int qty3 = SafeValue.SafeInt(tab.Rows[i]["Qty3"], 0); bool isSch = SafeValue.SafeBool(tab.Rows[i]["IsSch"], false); DateTime lastSchDate = SafeValue.SafeDate(tab.Rows[i]["LastSchDate"], DateTime.Today); int LastSchQty1 = SafeValue.SafeInt(tab.Rows[i]["LastSchQty1"], 0); int LastSchQty2 = SafeValue.SafeInt(tab.Rows[i]["LastSchQty2"], 0); int LastSchQty3 = SafeValue.SafeInt(tab.Rows[i]["LastSchQty3"], 0); string doType = SafeValue.SafeString(tab.Rows[i]["DoType"]).ToUpper(); string arCode = SafeValue.SafeString(tab.Rows[i]["ArCode"]); string des = SafeValue.SafeString(tab.Rows[i]["Description"]); //DateTime peroidDate = SafeValue.SafeDate(tab.Rows[i]["PeroidDate"], DateTime.Today); //string refNo = SafeValue.SafeString(tab.Rows[i]["DoNo"]); //int detId = SafeValue.SafeInt(tab.Rows[i]["detId"], 0); //int preQty = SafeValue.SafeInt(tab.Rows[i]["PreQty"], 0); //int lastSchQty = SafeValue.SafeInt(tab.Rows[i]["LastSchQty"], 0); //string IsSch = SafeValue.SafeString(tab.Rows[i]["IsSch"]); decimal price1 = 0; decimal price2 = 0; decimal price3 = 0; int dailyNo = 0; bool isFixed = false; bool isYearly = false; bool isMonthly = false; bool isWeekly = false; bool isDaily = false; DateTime dt = DateTime.Today; DataTable tab1 = new DataTable(); if (doType == "IN") { tab1 = GetContractByNo(contractNo, sku); } else//out get contractno, by sku,lotno>>dotype=in, doNo>>PO no>> get ContractNo { string conNo = string.Format(@"select Quotation from wh_do mast inner join Wh_DoDet2 det on det.DoNo=mast.DoNo and det.DoType=mast.DoType where det.DoType='in' and det.Product='{0}' and det.LotNo='{1}' and len(det.DoNo)>0", sku, lotNo); tab1 = GetContractByNo(SafeValue.SafeString(C2.Manager.ORManager.ExecuteScalar(conNo)), sku); } int n = 0; int n_sch = 0; for (int j = 0; j < tab1.Rows.Count; j++) { isFixed = SafeValue.SafeBool(tab1.Rows[j]["IsFixed"], true); isYearly = SafeValue.SafeBool(tab1.Rows[j]["IsYearly"], true); isMonthly = SafeValue.SafeBool(tab1.Rows[j]["IsMonthly"], true); isWeekly = SafeValue.SafeBool(tab1.Rows[j]["IsWeekly"], true); isDaily = SafeValue.SafeBool(tab1.Rows[j]["IsDaily"], true); #region get sch and price if (isYearly) { TimeSpan span = dt - doDate; if (dt.ToString("MM-dd") == "01-01") { n = SafeValue.SafeInt(dt.Year - doDate.Year, 0); if (isSch) { n_sch = SafeValue.SafeInt(dt.Year - lastSchDate.Year, 0); } price1 = SafeValue.SafeDecimal(tab1.Rows[j]["Price1"]); price2 = SafeValue.SafeDecimal(tab1.Rows[j]["Price2"]); price3 = SafeValue.SafeDecimal(tab1.Rows[j]["Price3"]); } else { continue; } } else if (isMonthly) { if (dt.ToString("dd") == "01") { price1 = SafeValue.SafeDecimal(tab1.Rows[j]["Price1"]); price2 = SafeValue.SafeDecimal(tab1.Rows[j]["Price2"]); price3 = SafeValue.SafeDecimal(tab1.Rows[j]["Price3"]); int year = dt.Year; n = (dt.Year - doDate.Year) * 12 + dt.Month - doDate.Month; if (isSch) { n_sch = (dt.Year - lastSchDate.Year) * 12 + dt.Month - lastSchDate.Month; } } else { continue; } } else if (isWeekly) { if (dt.DayOfWeek == DayOfWeek.Monday) { price1 = SafeValue.SafeDecimal(tab1.Rows[j]["Price1"]); price2 = SafeValue.SafeDecimal(tab1.Rows[j]["Price2"]); price3 = SafeValue.SafeDecimal(tab1.Rows[j]["Price3"]); TimeSpan day = GetMondayByDate(dt) - GetMondayByDate(doDate); n = SafeValue.SafeInt(day.TotalDays / 7, 0); if (isSch) { day = GetMondayByDate(dt) - GetMondayByDate(lastSchDate); n_sch = SafeValue.SafeInt(day.TotalDays / 7, 0); } } else { continue; } } else if (isDaily) { dailyNo = SafeValue.SafeInt(tab1.Rows[j]["DailyNo"], 1); if (dailyNo == 0) { dailyNo = 1; } TimeSpan day = dt.Date - doDate.Date; if (day.Days % dailyNo == 0) { price1 = SafeValue.SafeDecimal(tab1.Rows[j]["Price1"]); price2 = SafeValue.SafeDecimal(tab1.Rows[j]["Price2"]); price3 = SafeValue.SafeDecimal(tab1.Rows[j]["Price3"]); n = SafeValue.SafeInt(day.TotalDays / dailyNo, 0); if (isSch) { day = dt.Date - lastSchDate.Date; n_sch = SafeValue.SafeInt(day.TotalDays / dailyNo, 0); } } else { continue; } } #endregion XAArInvoice iv = null; string mastType = "WH"; if (lastInvId == 0 || lastPartyId != partyId) //is the frist invoice or is next party then generate new invoice { if (lastInvId > 0) //update last invoice ,set linelocamat, and mast.docamt/locamt/balanceamt { UpdateMaster(lastInvId); } #region generate invoice iv = new XAArInvoice(); string counterType = "AR-IV"; iv.DocType = "IV"; iv.DocDate = dt; lastInvNo = C2Setup.GetNextNo(iv.DocType, counterType, iv.DocDate); iv.DocNo = lastInvNo; iv.PartyTo = partyId; iv.CurrencyId = System.Configuration.ConfigurationManager.AppSettings["Currency"]; iv.ExRate = 1; iv.AcCode = EzshipHelper.GetAccApCode(iv.PartyTo, iv.CurrencyId); iv.AcSource = "DB"; iv.Description = ""; iv.Term = "CASH"; string[] currentPeriod = EzshipHelper.GetAccPeriod(iv.DocDate); iv.AcYear = SafeValue.SafeInt(currentPeriod[1], iv.DocDate.Year); iv.AcPeriod = SafeValue.SafeInt(currentPeriod[0], iv.DocDate.Month); iv.MastRefNo = ""; iv.JobRefNo = ""; iv.MastType = mastType; iv.DocAmt = 0; iv.LocAmt = 0; iv.BalanceAmt = 0; iv.CancelDate = new DateTime(1900, 1, 1); iv.CancelInd = "N"; iv.DocDueDate = dt; iv.ExportInd = "N"; iv.SpecialNote = ""; iv.UserId = EzshipHelper.GetUserName(); iv.EntryDate = DateTime.Now; C2.Manager.ORManager.StartTracking(iv, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(iv); C2Setup.SetNextNo(iv.DocType, counterType, lastInvNo, iv.DocDate); lastInvId = iv.SequenceId; #endregion } if (doType == "OUT") // form modify the qty { qty1 = -qty1; qty2 = -qty2; qty3 = -qty3; LastSchQty1 = 0; LastSchQty2 = 0; LastSchQty3 = 0; } lastPartyId = partyId; #region create det if (isFixed)// only do one time { int cnt = SafeValue.SafeInt(ConnectSql.ExecuteScalar(string.Format("select count(*) from XAArInvoiceDet where DocId='{0}' and ChgDes1 like 'SKU {1}%,'", lastInvId, sku)), 0); if (cnt == 0)//sku balQty>0 { int count = SafeValue.SafeInt(C2.Manager.ORManager.ExecuteScalar(string.Format("select sum(case when DoType='in' then Qty1 else -qty1 end) as cnt from wh_dodet2 where Product='{0}'", sku)), 0); InsertInv_det(lastInvId, lastInvNo, mastType, 1, price1 + price2 + price3, sku, arCode, des, lotNo); } } else { if (qty1 * n + LastSchQty1 * n_sch != 0) { InsertInv_det(lastInvId, lastInvNo, mastType, qty1 * n + LastSchQty1 * n_sch, price1, sku, arCode, des, lotNo); } if (qty2 * n + LastSchQty2 * n_sch != 0) { InsertInv_det(lastInvId, lastInvNo, mastType, qty2 * n + LastSchQty2 * n_sch, price2, sku, arCode, des, lotNo); } if (qty3 * n + LastSchQty3 * n_sch != 0) { InsertInv_det(lastInvId, lastInvNo, mastType, qty3 * n + LastSchQty3 * n_sch, price3, sku, arCode, des, lotNo); } } #endregion UpdateDoDet(sku, lotNo, doType); } } }
protected void ASPxGridView1_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e) { string doNo = SafeValue.SafeString(Request.QueryString["Sn"].ToString()); string whId = SafeValue.SafeString(Request.QueryString["WhId"].ToString()); string partyId = SafeValue.SafeString(Request.QueryString["partyId"].ToString()); string s = e.Parameters; if (s == "Save") { #region Create SO string sql = string.Format(@"select Count(*) from Wh_TransDet where DoNo='{0}' and DoType='BS' and ISNULL(LotNo,'')!=''", doNo); int cnt = SafeValue.SafeInt(ConnectSql.ExecuteScalar(sql), 0); if (cnt > 0) { bool action = false; for (int i = 0; i < list.Count; i++) { int totalQty = list[i].pickQty; int qty = list[i].qty; if (totalQty < qty) { action = false; e.Result = "Fail! Pls enter again"; return; } else { action = true; } } if (action) { string pId = ""; Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(WhTrans), "Id='" + pId + "'"); WhTrans whTrans = C2.Manager.ORManager.GetObject(query) as WhTrans; whTrans = new WhTrans(); string poNo = C2Setup.GetNextNo("", "SalesOrders", DateTime.Now); whTrans.DoNo = poNo; whTrans.DoType = "SO"; whTrans.PartyId = partyId; whTrans.PartyName = SafeValue.SafeString(partyId); whTrans.CreateBy = EzshipHelper.GetUserName(); whTrans.CreateDateTime = DateTime.Now; whTrans.DoDate = DateTime.Now; whTrans.ExpectedDate = DateTime.Today.AddDays(14); whTrans.Currency = "SGD"; whTrans.DoStatus = "Draft"; whTrans.ExRate = SafeValue.SafeDecimal(1.000000); whTrans.WareHouseId = whId; Manager.ORManager.StartTracking(whTrans, Wilson.ORMapper.InitialState.Inserted); Manager.ORManager.PersistChanges(whTrans); C2Setup.SetNextNo("", "SalesOrders", poNo, DateTime.Now); for (int i = 0; i < list.Count; i++) { string sku = list[i].sku; string lotNo = list[i].lotNo; int qty = list[i].qty; decimal price = list[i].price; string location = list[i].loc; sql = @"Insert Into Wh_TransDet(DoNo,ProductCode,DoType,Qty1,Price,LotNo,Uom1,Uom2,Uom3,Uom4,[QtyPackWhole],[QtyWholeLoose],[QtyLooseBase],[CreateBy],[CreateDateTime],[UpdateBy],[UpdateDateTime],Att1,Att2,Att3,Att4,Att5,Att6,Des1,Packing,LocationCode)"; sql += string.Format(@"select '{0}'as DoNo, '{1}' as Sku,'SO','{2}' as Qty1,'{3}','{5}',p.UomPacking,p.UomWhole,p.UomLoose,p.UomBase,p.QtyPackingWhole,p.QtyWholeLoose,p.QtyLooseBase,'{4}' as CreateBy,getdate() as CreateDateTime, '{4}' as UpdateBy,getdate() as UpdateDateTime ,P.att4,P.att5,P.att6,P.att7,P.att8,P.att9,p.Description,p.Att1,'{6}' from (select '{1}' as Sku) as tab left join ref_product p on tab.Sku=p.Code", poNo, sku, qty, price, EzshipHelper.GetUserName(), lotNo, location); ConnectSql.ExecuteSql(sql); } e.Result = "Success! " + "Sales Order No is" + whTrans.DoNo; } } else { e.Result = "Fail"; } #endregion } }
protected void grid_CustomDataCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomDataCallbackEventArgs e) { if (Request.QueryString["po"] != null && Request.QueryString["no"] != null && Request.QueryString["typ"] != null) { int start = 0; // int end = 10000; // int qty = 0; int id = SafeValue.SafeInt(Request.QueryString["id"], 0); for (int a = start; a < end; a++) { ASPxSpinEdit spin_det_Qty1 = this.grid.FindRowTemplateControl(a, "spin_det_Qty1") as ASPxSpinEdit; ASPxSpinEdit spin_det_Qty2 = this.grid.FindRowTemplateControl(a, "spin_det_Qty2") as ASPxSpinEdit; string sql = ""; ASPxTextBox txt_docId = this.grid.FindRowTemplateControl(a, "txt_docId") as ASPxTextBox; ASPxCheckBox isPay = this.grid.FindRowTemplateControl(a, "ack_IsPay") as ASPxCheckBox; if (isPay != null && isPay.Checked) { int packQty = SafeValue.SafeInt(spin_det_Qty1.Text, 0); int unitQty = SafeValue.SafeInt(spin_det_Qty2.Text, 0); string invNo = Request.QueryString["no"].ToString(); string typ = Request.QueryString["typ"].ToString().ToUpper(); int invId = SafeValue.SafeInt(Request.QueryString["id"], 0); string invId_old = e.Parameters; string arApInd_sch = this.cmb_PoSo.Text.ToUpper(); int sequenceId = 0; if (typ == "POR") { #region PO Det sql = string.Format("select BalQty from wh_PODet where Id={0}", SafeValue.SafeInt(txt_docId.Text, 0)); int balQty = SafeValue.SafeInt(C2.Manager.ORManager.ExecuteScalar(sql), 0); qty = SafeValue.SafeInt(packQty * unitQty, 0); if (balQty > qty || balQty == qty) { for (int m = 0; m < list.Count; m++) { try { sequenceId = list[m].docId; sql = string.Format("select * from wh_PODet where Id={0}", sequenceId); WhPOReceiptDet det = null; DataTable tab = ConnectSql.GetTab(sql); for (int i = 0; i < tab.Rows.Count; i++) { string product = tab.Rows[i]["Product"].ToString(); det = new WhPOReceiptDet(); decimal price = SafeValue.SafeDecimal(tab.Rows[i]["Price"], 0); string unit = tab.Rows[i]["Unit"].ToString().ToUpper(); string currency = tab.Rows[i]["Currency"].ToString(); decimal exRate = SafeValue.SafeDecimal(tab.Rows[i]["ExRate"], 0); decimal gst = SafeValue.SafeDecimal(tab.Rows[i]["Gst"], 0); string gstType = tab.Rows[i]["GstType"].ToString(); det.Product = product; det.Currency = currency; det.ExRate = exRate; det.ReceiptNo = invNo; det.Price = price; det.Qty = qty; det.PoNo = tab.Rows[i]["PoNo"].ToString(); det.Gst = gst; det.GstType = gstType; decimal amt = SafeValue.ChinaRound(qty * price, 2); decimal gstAmt = SafeValue.ChinaRound(amt * gst, 2); decimal docAmt = amt + gstAmt; decimal locAmt = SafeValue.ChinaRound(docAmt * exRate, 2); det.GstAmt = gstAmt; det.DocAmt = docAmt; det.LocAmt = locAmt; det.CreateBy = EzshipHelper.GetUserName(); det.CreateDateTime = DateTime.Now; C2.Manager.ORManager.StartTracking(det, Wilson.ORMapper.InitialState.Inserted); C2.Manager.ORManager.PersistChanges(det); } UpdatePoMaster(invId, sequenceId, det.Qty); } catch (Exception ex) { } } } else { e.Result = "Error, Pls try again"; } #endregion } } } } else { e.Result = "Error, Pls refresh your Det"; } }
protected void grid_CustomDataCallback(object sender, ASPxGridViewCustomDataCallbackEventArgs e) { string par = e.Parameters; string[] ar = par.Split('_'); if (par == "OK") { #region Create Inv if (Request.QueryString["no"] != null) { try { bool action = true; string res = ""; string no = SafeValue.SafeString(Request.QueryString["no"]); string type = SafeValue.SafeString(Request.QueryString["type"]); if (action) { #region Create Inv string docId = ""; if (list.Count > 0) { string jobNo = SafeValue.SafeString(Request.QueryString["no"]); string client = SafeValue.SafeString(Request.QueryString["client"]); string contType = SafeValue.SafeString(Request.QueryString["contType"]); string user = HttpContext.Current.User.Identity.Name; string acCode = EzshipHelper.GetAccArCode("", "SGD"); DateTime dtime = txt_DocDt.Date; string invN = C2Setup.GetNextNo("", "AR-IV", dtime); string termId = EzshipHelper.GetTerm(client); string term = EzshipHelper.GetTermCode(termId); string currency = cmb_CurrencyId.Text; decimal exrate = SafeValue.SafeDecimal(spin_ExRate.Value); string sql_att = string.Format(@"select ClientContact from ctm_job where JobNo='{0}'", jobNo); string contact = SafeValue.SafeString(ConnectSql.ExecuteScalar(sql_att)); string sql = string.Format(@"insert into XAArInvoice (DocType,DocDate,PartyTo,DocNo,AcYear,AcPeriod,Term,DocDueDate,Description, CurrencyId,MastType,ExRate,ExportInd,CancelDate,CancelInd,UserId,EntryDate,Eta,AcCode,AcSource,MastRefNo,Contact) values('IV','{5:yyyy-MM-dd}','{4}','{0}','{6}','{7}','{8}','{5:yyyy-MM-dd}','', '{9}','STORAGE',{10},'N','19000101','N','{1}',getdate(),'17530101','{2}','DB','{3}','{11}') select @@IDENTITY", invN, user, acCode, jobNo, client, dtime, dtime.Year, dtime.Month, term, currency, exrate, contact); docId = ConnectSql_mb.ExecuteScalar(sql); C2Setup.SetNextNo("", "AR-IV", invN, dtime); string code = ""; for (int i = 0; i < list.Count; i++) { int id = list[i].id; string chgCode = list[i].chgCode; string chgcodeDes = list[i].chgCodedes; if (IsCostCreated(id)) { C2.ComMethod.CreateInv(invN, id, docId, i, "", currency, exrate); } else { if (list.Count - i > 1) { code += chgcodeDes + " / "; } else { code += chgcodeDes; } } } C2.XAArInvoice.update_invoice_mast(SafeValue.SafeInt(docId, 0)); if (code.Length == 0) { e.Result = invN; } else { e.Result = "Action Error!" + code + " already exist !"; } } else { e.Result = "Action Error!Please keyin select cost "; } #endregion string userId = HttpContext.Current.User.Identity.Name; C2.CtmJobEventLog elog = new C2.CtmJobEventLog(); elog.Platform_isWeb(); elog.Controller = userId; elog.ActionLevel_isINVOICE(SafeValue.SafeInt(docId, 0)); elog.setActionLevel(SafeValue.SafeInt(docId, 0), CtmJobEventLogRemark.Level.Invoice, 3); elog.log(); } else { e.Result = res; } } catch { } } #endregion } if (par == "Save") { #region Save All if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { int id = list[i].id; string contNo = list[i].contNo; string contType = list[i].contType; decimal price = list[i].price; decimal qty = list[i].qty; string unit = list[i].unit; string code = list[i].chgCode; string des = list[i].chgCodedes; int lineIndex = list[i].lineIndex; string remark = list[i].remark; string groupBy = list[i].groupBy; decimal locAmt = SafeValue.ChinaRound(qty * SafeValue.SafeDecimal(price, 0), 2); string sql = string.Format(@"update job_cost set ContNo='{0}',ContType='{1}',Price={2},Qty={3},LocAmt={4},Unit='{6}',ChgCode='{7}',ChgCodeDes='{8}',LineIndex={9},Remark='{10}',GroupBy='{11}' where Id={5}", contNo, contType, price, qty, locAmt, id, unit, code, des, lineIndex, remark, groupBy); ConnectSql.ExecuteSql(sql); } e.Result = "Save Success"; } else { e.Result = "Action Error!Please keyin select cost "; } #endregion } if (ar.Length >= 2) { if (ar[0].Equals("SaveInvline")) { int rowIndex = SafeValue.SafeInt(ar[1], -1); e.Result = Save_Inline(rowIndex, e); } } }