コード例 #1
0
        public List <EntityStockInventory> GetStockInventoryList(string random, string strWhereSql, string strOrderBySql)
        {
            List <EntityStockInventory> entityList = new List <EntityStockInventory>();

            #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 != "")
                {
                    EntityStockInventory entity = new EntityStockInventory();
                    entity.MESSAGE = _message;
                    entityList.Add(entity);
                    return(entityList);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetStockInventoryList(認証処理)", ex);
                EntityStockInventory entity = new EntityStockInventory();
                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.GetStockInventoryListReportSQL(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

                        EntityStockInventory entity = new EntityStockInventory();
                        entity.commodity_id              = ExCast.zCStr(dt.DefaultView[i]["COMMODITY_ID"]);
                        entity.commodity_name            = ExCast.zCStr(dt.DefaultView[i]["COMMODITY_NAME"]);
                        entity.account_inventory_number  = ExCast.zCDbl(dt.DefaultView[i]["INVENTORY_NUMBER"]);
                        entity.practice_inventory_number = ExCast.zCDbl(dt.DefaultView[i]["INVENTORY_NUMBER"]);
                        entity.diff_number = 0;

                        entity.exec_flg = false;

                        entity.lock_flg = 0;

                        entityList.Add(entity);

                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetStockInventoryList", ex);
                entityList.Clear();
                EntityStockInventory entity = new EntityStockInventory();
                entity.MESSAGE = CLASS_NM + ".GetStockInventoryList : 予期せぬエラーが発生しました。" + 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.StockInventory.StockInventoryInp,
                                       DataPgEvidence.geOperationType.Select,
                                       "Where:" + strWhereSql + ",Orderby:" + strOrderBySql);

            return(entityList);
        }
コード例 #2
0
        public EntityReport ReportOut(string random, string rptKbn, string pgId, string parameters)
        {
            EntityReport        entity;
            EntityReportSetting entitySetting;

            #region 認証処理

            string companyId           = "";
            string groupId             = "";
            string userId              = "";
            string ipAdress            = "";
            string sessionString       = "";
            int    reportSizeUser      = 0;
            int    idFigureCommodity   = 0;
            int    idFigureCustomer    = 0;
            int    idFigurePurchase    = 0;
            int    idFigureSlipNo      = 0;
            int    rpTotalAuthorityKbn = 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]);
                reportSizeUser      = ExCast.zCInt(HttpContext.Current.Session[ExSession.REPORT_SAVE_SIZE_USER]);
                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]);
                rpTotalAuthorityKbn = ExCast.zCInt(HttpContext.Current.Session[ExSession.REPORT_TOTAL_AUTHORITY_KBN]);

                string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]));
                if (_message != "")
                {
                    entity         = new EntityReport();
                    entity.MESSAGE = _message;
                    return(entity);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".ReportOut(認証処理)", ex);
                entity         = new EntityReport();
                entity.MESSAGE = CLASS_NM + ".ReportOut : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();
                return(entity);
            }

            #endregion

            ExMySQLData db = ExSession.GetSessionDb(ExCast.zCInt(userId), sessionString);

            try
            {
                #region Get Report Setting

                entitySetting = GetReportSetting(random, pgId);

                if (entitySetting == null)
                {
                    entitySetting               = new EntityReportSetting();
                    entitySetting.user_id       = ExCast.zCInt(userId);
                    entitySetting.pg_id         = pgId;
                    entitySetting.group_id_from = ExCast.zCInt(groupId).ToString();
                    entitySetting.group_id_to   = ExCast.zCInt(groupId).ToString();
                }
                else if (entitySetting != null)
                {
                    if (!string.IsNullOrEmpty(entitySetting.MESSAGE))
                    {
                        entitySetting               = new EntityReportSetting();
                        entitySetting.user_id       = ExCast.zCInt(userId);
                        entitySetting.pg_id         = pgId;
                        entitySetting.group_id_from = ExCast.zCInt(groupId).ToString();
                        entitySetting.group_id_to   = ExCast.zCInt(groupId).ToString();
                    }
                    else
                    {
                        if (ExCast.zCInt(entitySetting.group_id_from) == 0 && ExCast.zCInt(entitySetting.group_id_to) == 0)
                        {
                            entitySetting.group_id_from = ExCast.zCInt(groupId).ToString();
                            entitySetting.group_id_to   = ExCast.zCInt(groupId).ToString();
                        }
                    }
                }

                if (rpTotalAuthorityKbn < 2)
                {
                    entitySetting.group_id_from = ExCast.zCInt(groupId).ToString();
                    entitySetting.group_id_to   = ExCast.zCInt(groupId).ToString();
                }

                #endregion

                entity = new EntityReport();

                DataReport.geReportKbn kbn    = (DataReport.geReportKbn)ExCast.zCInt(rptKbn);
                ExReportManeger        rptMgr = new ExReportManeger();
                rptMgr.idFigureCommodity = idFigureCommodity;
                rptMgr.idFigureCustomer  = idFigureCustomer;
                rptMgr.idFigurePurchase  = idFigurePurchase;
                rptMgr.idFigureSlipNo    = idFigureSlipNo;
                rptMgr.entitySetting     = entitySetting;
                rptMgr.rptKbn            = kbn;

                #region Report FilePath Setting

                bool _ret = rptMgr.GetReportFilePath(pgId, companyId, userId);
                if (_ret == false)
                {
                    entity.MESSAGE = CommonUtl.gstrErrMsg;
                    return(entity);
                }
                entity.downLoadFilePath = rptMgr.reportFilePath;
                entity.downLoadFileName = rptMgr.reportFileName;
                entity.downLoadFileSize = rptMgr.reportFileSize.ToString();
                entity.downLoadUrl      = CommonUtl.gstrMainUrl + rptMgr.reportDir;

                #endregion

                DataSet ds = db.GetDataSet(rptMgr.ReportSQL(pgId, companyId, groupId, parameters), rptMgr.GetPGIDXsd(pgId));

                #region Export xsd

                System.IO.StreamWriter xmlSW = null;
                try
                {
                    xmlSW = new System.IO.StreamWriter(CommonUtl.gstrReportTemp + rptMgr.GetPGIDXsd(pgId) + ".xsd");
                    ds.WriteXmlSchema(xmlSW);
                    xmlSW.Close();
                }
                catch (Exception ex)
                {
                    CommonUtl.ExLogger.Error(CLASS_NM + ".WriteXmlSchema", ex);
                }
                finally
                {
                    if (xmlSW != null)
                    {
                        xmlSW.Dispose();
                        xmlSW = null;
                    }
                }

                #endregion

                if (ds.Tables[0].Rows.Count == 0)
                {
                    entity.MESSAGE = "データが存在しません。";
                    entity.ret     = false;
                    return(entity);
                }

                string _fileType     = "";
                string _DownloadType = "";
                switch (kbn)
                {
                case DataReport.geReportKbn.OutPut:
                    _fileType     = "PDF";
                    _DownloadType = "出力";

                    if (rptMgr.ReportToPdf(ds, pgId) == true)
                    {
                        entity.ret = true;
                    }
                    else
                    {
                        entity.MESSAGE = CommonUtl.gstrErrMsg;
                        entity.ret     = false;
                    }
                    break;

                case DataReport.geReportKbn.Download:
                    _fileType     = "PDF";
                    _DownloadType = "ダウンロード";

                    if (rptMgr.ReportToPdf(ds, pgId) == true)
                    {
                        entity.ret = true;
                    }
                    else
                    {
                        entity.MESSAGE = CommonUtl.gstrErrMsg;
                        entity.ret     = false;
                    }
                    break;

                case DataReport.geReportKbn.Csv:
                    _fileType     = "CSV";
                    _DownloadType = "ダウンロード";

                    if (rptMgr.DataTableToCsv(ds.Tables[0]) == true)
                    {
                        entity.ret = true;
                    }
                    else
                    {
                        entity.MESSAGE = CommonUtl.gstrErrMsg;
                        entity.ret     = false;
                    }
                    break;

                default:
                    break;
                }

                //entity.downLoadFilePath = @"d:\HostingSpaces\Users\EW20121725\Sales.system-innovation.net\wwwroot\temp\顧客マスタ一覧.csv";
                //System.IO.FileInfo fi = new System.IO.FileInfo(entity.downLoadFilePath);
                //entity.downLoadFileSize = fi.Length.ToString();
                if (reportSizeUser < ExCast.zCDbl(entity.downLoadFileSize) / 1000000)
                {
                    entity.MESSAGE = _fileType + "ファイルのサイズが" + reportSizeUser.ToString() + "Mバイトを超える為、" + _DownloadType + "できません。";
                    return(entity);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".ReportOut", ex);
                entity         = new EntityReport();
                entity.MESSAGE = CLASS_NM + ".ReportOut : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString();
                return(entity);
            }

            return(entity);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        public List <EntitySalesCreditBalance> GetSalesCreditBalanaceList(string random, string strWhereSql, string strOrderBySql)
        {
            List <EntitySalesCreditBalance> entityList = new List <EntitySalesCreditBalance>();

            #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 != "")
                {
                    EntitySalesCreditBalance entity = new EntitySalesCreditBalance();
                    entity.MESSAGE = _message;
                    entityList.Add(entity);
                    return(entityList);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetSalesCreditBalanaceList(認証処理)", ex);
                EntitySalesCreditBalance entity = new EntitySalesCreditBalance();
                entity.MESSAGE = "認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();;
                entityList.Add(entity);
                return(entityList);
            }
            #endregion

            StringBuilder sb;
            DataTable     dt;
            ExMySQLData   db;
            long          rec_no = 0;

            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.GetSalesCreditBalanaceListReportSQL(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

                        rec_no += 1;

                        EntitySalesCreditBalance entity = new EntitySalesCreditBalance();
                        entity.rec_no     = rec_no;
                        entity.ym         = ExCast.zCStr(dt.DefaultView[i]["YM"]);
                        entity.invoice_id = ExCast.zCStr(dt.DefaultView[i]["INVOICE_ID"]);
                        entity.invoice_nm = ExCast.zCStr(dt.DefaultView[i]["INVOICE_NAME"]);
                        entity.before_sales_credit_balacne     = ExCast.zCDbl(dt.DefaultView[i]["BEFORE_SALES_CREDIT_BALANCE"]);
                        entity.before_sales_credit_balacne_upd = ExCast.zCDbl(dt.DefaultView[i]["BEFORE_SALES_CREDIT_BALANCE"]);
                        entity.this_receipt_price      = ExCast.zCDbl(dt.DefaultView[i]["THIS_RECEIPT_PRICE"]);
                        entity.this_receipt_percent    = ExCast.zCDbl(dt.DefaultView[i]["THIS_RECEIPT_PERCENT"]);
                        entity.this_sales_credit_price = ExCast.zCDbl(dt.DefaultView[i]["THIS_SALES_PRICE"]);
                        entity.this_tax = ExCast.zCDbl(dt.DefaultView[i]["THIS_SALES_TAX"]);
                        entity.this_sales_credit_balance = ExCast.zCDbl(dt.DefaultView[i]["THIS_SALES_CREDIT_BALANCE"]);

                        entity.exec_flg = false;

                        entity.lock_flg = 0;

                        entityList.Add(entity);

                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetSalesCreditBalanaceList", ex);
                entityList.Clear();
                EntitySalesCreditBalance entity = new EntitySalesCreditBalance();
                entity.MESSAGE = CLASS_NM + ".GetSalesCreditBalanaceList : 予期せぬエラーが発生しました。" + 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);
        }