private void dgUpdate_CellEditEnded(object sender, DataGridCellEditEndedEventArgs e) { EntityInvoiceBalance entity = (EntityInvoiceBalance)e.Row.DataContext; // 明細計算 switch (e.Column.DisplayIndex) { case 4: double price = entity._before_invoice_price_upd; for (int i = 0; i <= this.entityList.Count - 1; i++) { if (entity._invoice_id == this.entityList[i]._invoice_id) { if (this.dgUpdate.SelectedIndex != i) { this.entityList[i]._before_invoice_price_upd += price; } this.entityList[i]._transfer_price = this.entityList[i]._before_invoice_price_upd - this.entityList[i]._receipt_price; this.entityList[i]._invoice_price = this.entityList[i]._transfer_price + this.entityList[i]._no_tax_sales_price + this.entityList[i]._tax; } } entity._before_invoice_price_upd = price; break; } }
public List <EntityInvoiceBalance> GetInvoiceBalanceList(string random, string strWhereSql, string strOrderBySql) { List <EntityInvoiceBalance> entityList = new List <EntityInvoiceBalance>(); #region 認証処理 string companyId = ""; string groupId = ""; string userId = ""; string ipAdress = ""; string sessionString = ""; int idFigureCommodity = 0; int idFigureCustomer = 0; int idFigurePurchase = 0; int idFigureSlipNo = 0; try { companyId = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]); groupId = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]); userId = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]); ipAdress = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]); sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]); idFigureCommodity = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_GOODS]); idFigureCustomer = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_CUSTOMER]); idFigurePurchase = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_PURCHASE]); idFigureSlipNo = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_SLIP_NO]); string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID])); if (_message != "") { EntityInvoiceBalance entity = new EntityInvoiceBalance(); entity.MESSAGE = _message; entityList.Add(entity); return(entityList); } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetInvoiceBalanceList(認証処理)", ex); EntityInvoiceBalance entity = new EntityInvoiceBalance(); entity.MESSAGE = "認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();; entityList.Add(entity); return(entityList); } #endregion StringBuilder sb; DataTable dt; ExMySQLData db; try { db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]), ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR])); sb = new StringBuilder(); ExReportManeger rptMgr = new ExReportManeger(); rptMgr.idFigureCommodity = idFigureCommodity; rptMgr.idFigureCustomer = idFigureCustomer; rptMgr.idFigurePurchase = idFigurePurchase; rptMgr.idFigureSlipNo = idFigureSlipNo; sb.Append(rptMgr.GetInvoiceBalanceListReportSQL(companyId, groupId, strWhereSql, strOrderBySql)); dt = db.GetDataTable(sb.ToString()); if (dt.DefaultView.Count > 0) { for (int i = 0; i <= dt.DefaultView.Count - 1; i++) { #region Set Entity EntityInvoiceBalance entity = new EntityInvoiceBalance(); entity.no = ExCast.zCStr(dt.DefaultView[i]["NO"]); entity.invoice_id = ExCast.zCStr(dt.DefaultView[i]["INVOICE_ID"]); entity.invoice_nm = ExCast.zCStr(dt.DefaultView[i]["INVOICE_NM"]); entity.invoice_yyyymmdd = ExCast.zDateNullToDefault(dt.DefaultView[i]["INVOICE_YYYYMMDD"]); entity.summing_up_group_id = ExCast.zCStr(dt.DefaultView[i]["SUMMING_UP_GROUP_ID"]); entity.summing_up_group_nm = ExCast.zCStr(dt.DefaultView[i]["SUMMING_UP_GROUP_NM"]); entity.person_id = ExCast.zCInt(dt.DefaultView[i]["INPUT_PERSON"]); entity.person_nm = ExCast.zCStr(dt.DefaultView[i]["INPUT_PERSON_NM"]); entity.collect_plan_day = ExCast.zDateNullToDefault(dt.DefaultView[i]["COLLECT_PLAN_DAY"]); entity.collect_day = ExCast.zCInt(dt.DefaultView[i]["COLLECT_DAY"]); entity.before_invoice_yyyymmdd = ExCast.zDateNullToDefault(dt.DefaultView[i]["BEFORE_INVOICE_YYYYMMDD"]); entity.before_invoice_price = ExCast.zCDbl(dt.DefaultView[i]["BEFORE_INVOICE_PRICE"]); entity.before_invoice_price_upd = ExCast.zCDbl(dt.DefaultView[i]["BEFORE_INVOICE_PRICE"]); entity.receipt_price = ExCast.zCDbl(dt.DefaultView[i]["RECEIPT_PRICE"]); entity.transfer_price = ExCast.zCDbl(dt.DefaultView[i]["TRANSFER_PRICE"]); entity.sales_price = ExCast.zCDbl(dt.DefaultView[i]["SALES_PRICE"]); entity.no_tax_sales_price = ExCast.zCDbl(dt.DefaultView[i]["NO_TAX_SALES_PRICE"]); entity.tax = ExCast.zCDbl(dt.DefaultView[i]["TAX"]); entity.invoice_price = ExCast.zCDbl(dt.DefaultView[i]["INVOICE_PRICE"]); entity.invoice_kbn = ExCast.zCInt(dt.DefaultView[i]["INVOICE_KBN"]); entity.invoice_kbn_nm = ExCast.zCStr(dt.DefaultView[i]["INVOICE_KBN_NM"]); entity.memo = ExCast.zCStr(dt.DefaultView[i]["MEMO"]); entity.invoice_exists_flg = 0; entity.exec_flg = false; entity.lock_flg = 0; entityList.Add(entity); #endregion } } } catch (Exception ex) { CommonUtl.ExLogger.Error(CLASS_NM + ".GetInvoiceBalanceList", ex); entityList.Clear(); EntityInvoiceBalance entity = new EntityInvoiceBalance(); entity.MESSAGE = CLASS_NM + ".GetInvoiceBalanceList : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString(); entityList.Add(entity); } finally { db = null; } svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]), companyId, userId, ipAdress, sessionString, DataPgEvidence.PGName.Order.OrderList, DataPgEvidence.geOperationType.Select, "Where:" + strWhereSql + ",Orderby:" + strOrderBySql); return(entityList); }