/// <summary>
        /// 月次債務計算処理
        /// GetsujiSaimuKeisanSyoriより更新時に使用
        /// </summary>
        /// <param name="de"></param>
        /// <returns></returns>
        public bool D_MonthlyDebt_Exec(D_MonthlyDebt_Entity de)
        {
            string sp = "PRC_GetsujiSaimuKeisanSyori";

            Dictionary <string, ValuePair> dic = new Dictionary <string, ValuePair>
            {
                { "@FiscalYYYYMM", new ValuePair {
                      value1 = SqlDbType.Int, value2 = de.YYYYMM
                  } },
                { "@StoreCD", new ValuePair {
                      value1 = SqlDbType.VarChar, value2 = de.StoreCD
                  } },
                { "@Mode", new ValuePair {
                      value1 = SqlDbType.TinyInt, value2 = de.Mode.ToString()
                  } },
                { "@Operator", new ValuePair {
                      value1 = SqlDbType.VarChar, value2 = de.Operator
                  } },
                { "@PC", new ValuePair {
                      value1 = SqlDbType.VarChar, value2 = de.PC
                  } },
            };

            UseTransaction = true;
            return(InsertUpdateDeleteData(dic, sp));
        }
Example #2
0
 public void ExecUpdate(D_MonthlyDebt_Entity de)
 {
     try {
         sbl.GetsujiSaimuKeisanSyori(de);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
     }
 }
Example #3
0
 private D_MonthlyDebt_Entity GetMonthlyDebt_Data()
 {
     mde = new D_MonthlyDebt_Entity()
     {
         ChangeDate = txtTargetYear.Text + "/01",
         YYYYMM     = txtTargetYear.Text.Replace("/", ""),
         StoreCD    = cboStoreAuthorizations.SelectedValue.ToString(),
         PayeeCD    = scVendor.Code
     };
     return(mde);
 }
        public DataTable D_MonthlyDebt_CSV_Report(D_MonthlyDebt_Entity mde, int chk)
        {
            Dictionary <string, ValuePair> dic = new Dictionary <string, ValuePair>()
            {
                { "@ChangeDate", new ValuePair {
                      value1 = SqlDbType.VarChar, value2 = mde.ChangeDate
                  } },
                { "@YYYYMM", new ValuePair {
                      value1 = SqlDbType.VarChar, value2 = mde.YYYYMM
                  } },
                { "@StoreCD", new ValuePair {
                      value1 = SqlDbType.VarChar, value2 = mde.StoreCD
                  } },
                { "@PayeeCD", new ValuePair {
                      value1 = SqlDbType.VarChar, value2 = mde.PayeeCD
                  } },
                { "@chk", new ValuePair {
                      value1 = SqlDbType.VarChar, value2 = chk.ToString()
                  } }
            };

            return(SelectData(dic, "D_MonthlyDebt_CSV_Report"));
        }
        /// <summary>
        /// 月次債務計算処理
        /// </summary>
        /// <param name="de"></param>
        /// <returns></returns>
        public bool GetsujiSaimuKeisanSyori(D_MonthlyDebt_Entity de)
        {
            D_MonthlyDebt_DL dl = new D_MonthlyDebt_DL();

            return(dl.D_MonthlyDebt_Exec(de));
        }
Example #6
0
        protected override void PrintSec()
        {
            if (PrintMode != EPrintMode.DIRECT)
            {
                return;
            }

            if (ErrorCheck())
            {
                // レコード定義を行う
                mde = GetMonthlyDebt_Data();
                if (chkBalancePrint.Checked == true)
                {
                    chk = 1;
                }
                else
                {
                    chk = 0;
                }
                dtExport = saimukanriBL.D_MonthlyDebt_CSV_Report(mde, chk);
                if (dtExport.Rows.Count > 0)
                {
                    CheckBeforeExport();
                    try
                    {
                        SaimuKanriKyou_Report smkh_Report = new SaimuKanriKyou_Report();
                        DialogResult          DResult;
                        switch (PrintMode)
                        {
                        case EPrintMode.DIRECT:
                            DResult = bbl.ShowMessage("Q201");
                            if (DResult == DialogResult.Cancel)
                            {
                                return;
                            }
                            // 印字データをセット
                            smkh_Report.SetDataSource(dtExport);
                            smkh_Report.Refresh();
                            smkh_Report.SetParameterValue("lblYearMonth", txtTargetYear.Text);
                            smkh_Report.SetParameterValue("lblStore", dtExport.Rows[0]["StoreCD"].ToString() + "  " + dtExport.Rows[0]["StoreName"].ToString());
                            smkh_Report.SetParameterValue("lblToday", dtExport.Rows[0]["Today"].ToString() + "  " + dtExport.Rows[0]["Now"].ToString());
                            crv = vr.CrystalReportViewer1;
                            crv.ReportSource = smkh_Report;
                            vr.ShowDialog();

                            try
                            {
                                //  crv = vr.CrystalReportViewer1;
                            }
                            catch (Exception ex)
                            {
                                var msg = ex.Message;
                            }
                            //out log before print
                            if (DResult == DialogResult.Yes)
                            {
                                //印刷処理プレビュー
                                vr.CrystalReportViewer1.ShowPrintButton = true;
                                vr.CrystalReportViewer1.ReportSource    = smkh_Report;

                                vr.ShowDialog();
                            }
                            else
                            {
                                //int marginLeft = 360;
                                CrystalDecisions.Shared.PageMargins margin = smkh_Report.PrintOptions.PageMargins;
                                margin.leftMargin   = DefaultMargin.Left;          // mmの指定をtwip単位に変換する
                                margin.topMargin    = DefaultMargin.Top;
                                margin.bottomMargin = DefaultMargin.Bottom;        //mmToTwip(marginLeft);
                                margin.rightMargin  = DefaultMargin.Right;
                                smkh_Report.PrintOptions.ApplyPageMargins(margin); /// Error Now
                                // プリンタに印刷
                                System.Drawing.Printing.PageSettings ps;
                                try
                                {
                                    System.Drawing.Printing.PrintDocument pDoc = new System.Drawing.Printing.PrintDocument();

                                    CrystalDecisions.Shared.PrintLayoutSettings PrintLayout = new CrystalDecisions.Shared.PrintLayoutSettings();

                                    System.Drawing.Printing.PrinterSettings printerSettings = new System.Drawing.Printing.PrinterSettings();



                                    smkh_Report.PrintOptions.PrinterName = "\\\\dataserver\\Canon LBP2900";
                                    System.Drawing.Printing.PageSettings pSettings = new System.Drawing.Printing.PageSettings(printerSettings);

                                    smkh_Report.PrintOptions.DissociatePageSizeAndPrinterPaperSize = true;

                                    smkh_Report.PrintOptions.PrinterDuplex = PrinterDuplex.Simplex;

                                    smkh_Report.PrintToPrinter(printerSettings, pSettings, false, PrintLayout);
                                    // Print the report. Set the startPageN and endPageN
                                    // parameters to 0 to print all pages.
                                    //Report.PrintToPrinter(1, false, 0, 0);
                                }
                                catch (Exception ex)
                                {
                                }
                            }
                            break;
                        }
                        //プログラム実行履歴
                        InsertLog(Get_L_Log_Entity());
                    }
                    finally
                    {
                        //画面はそのまま
                        txtTargetYear.Focus();
                    }
                }
                else
                {
                    saimukanriBL.ShowMessage("E128");
                }
            }
        }
Example #7
0
        private void F11()
        {
            if (ErrorCheck())
            {
                mde = GetMonthlyDebt_Data();
                if (chkBalancePrint.Checked == true)
                {
                    chk = 1;
                }
                else
                {
                    chk = 0;
                }
                dtExport = saimukanriBL.D_MonthlyDebt_CSV_Report(mde, chk);
                CheckBeforeExport();

                if (dtExport.Rows.Count > 0)
                {
                    DataTable dtCsv = new DataTable();
                    dtCsv = CreateDatatable();
                    for (int i = 0; dtExport.Rows.Count > i; i++)
                    {
                        dtCsv.Rows.Add();
                        dtCsv.Rows[i]["年月"]     = txtTargetYear.Text;
                        dtCsv.Rows[i]["店舗CD"]   = dtExport.Rows[i]["StoreCD"].ToString();
                        dtCsv.Rows[i]["店舗名"]    = dtExport.Rows[i]["StoreName"].ToString();
                        dtCsv.Rows[i]["支払先CD"]  = dtExport.Rows[i]["PayeeCD"].ToString();
                        dtCsv.Rows[i]["支払先名"]   = dtExport.Rows[i]["VendorName"].ToString();
                        dtCsv.Rows[i]["前月債務残額"] = dtExport.Rows[i]["LastBalanceGaku"].ToString();
                        dtCsv.Rows[i]["仕入額"]    = dtExport.Rows[i]["HontaiGaku"].ToString();
                        dtCsv.Rows[i]["消費税額"]   = dtExport.Rows[i]["TaxGaku"].ToString();
                        dtCsv.Rows[i]["当月支払額"]  = dtExport.Rows[i]["PayGaku"].ToString();
                        dtCsv.Rows[i]["うち相殺額"]  = dtExport.Rows[i]["OffsetGaku"].ToString();
                        dtCsv.Rows[i]["当月債務額"]  = dtExport.Rows[i]["BalanceGaku"].ToString();
                    }
                    try
                    {
                        DialogResult DResult;
                        DResult = bbl.ShowMessage("Q201");
                        if (DResult == DialogResult.Yes)
                        {
                            ////LoacalDirectory
                            string folderPath = "C:\\CSV\\";
                            if (!Directory.Exists(folderPath))
                            {
                                Directory.CreateDirectory(folderPath);
                            }
                            SaveFileDialog savedialog = new SaveFileDialog();
                            savedialog.Filter           = "CSV|*.csv";
                            savedialog.Title            = "Save";
                            savedialog.FileName         = "債務管理表";
                            savedialog.InitialDirectory = folderPath;
                            savedialog.RestoreDirectory = true;
                            if (savedialog.ShowDialog() == DialogResult.OK)
                            {
                                if (Path.GetExtension(savedialog.FileName).Contains("csv"))
                                {
                                    CsvWriter csvwriter = new CsvWriter();
                                    csvwriter.WriteCsv(dtCsv, savedialog.FileName, Encoding.GetEncoding(932));
                                }
                                Process.Start(Path.GetDirectoryName(savedialog.FileName));
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
            }
        }
        static void Main(string[] args)
        {
            Console.Title = "GetsujiSaimuKeisanSyori";

            if (loginbl.ReadConfig() == true)
            {
                //コマンドライン引数を配列で取得する
                string[] cmds = System.Environment.GetCommandLineArgs();

                if (cmds.Length - 1 >= (int)FrmMainForm.ECmdLine.PcID + 1)
                {
                    InOperatorCD   = cmds[(int)FrmMainForm.ECmdLine.OperatorCD];
                    InStoreCD      = cmds[(int)FrmMainForm.ECmdLine.PcID + 1];
                    InProcessMode  = cmds[(int)FrmMainForm.ECmdLine.PcID + 2];
                    InFiscalYYYYMM = cmds[(int)FrmMainForm.ECmdLine.PcID + 3].Replace("/", "");
                }

                gsbl = new GetsujiShimeShori_BL();

                //処理モードを覚える
                M_Control_Entity mce = new M_Control_Entity();
                mce.MainKey = "1";
                Mode        = gsbl.GetMode(mce);

                bool execFlg = false;

                M_StoreClose_Entity me = new M_StoreClose_Entity();
                if (Mode.Equals(1))
                {
                    //Mode		=	1	の場合			(=ALL店舗)
                }
                else if (Mode.Equals(2))
                {
                    //Mode		=	2	の場合			(=店舗ごとに計算)
                    me.StoreCD = InStoreCD;
                }
                bool ret = gsbl.M_StoreClose_SelectAll(me);
                if (ret)
                {
                    //FiscalYYYYMM<Parameter受取	FiscalYYYYMM
                    //またはFiscalYYYYMM=Parameter受取	FiscalYYYYMM&	ClosePosition2=0&	ClosePosition4=0なら
                    if (gsbl.Z_Set(me.FiscalYYYYMM) <= gsbl.Z_Set(InFiscalYYYYMM))
                    {
                        if (gsbl.Z_Set(me.FiscalYYYYMM) == gsbl.Z_Set(InFiscalYYYYMM))
                        {
                            if (me.ClosePosition2.Equals("0") && me.ClosePosition4.Equals("0"))
                            {
                                execFlg = true;
                            }
                        }
                        else
                        {
                            execFlg = true;
                        }
                        InFiscalYYYYMM = me.FiscalYYYYMM;
                    }
                }

                if (execFlg)
                {
                    //【データ更新】
                    D_MonthlyDebt_Entity de = new D_MonthlyDebt_Entity
                    {
                        PC       = Login_BL.GetHostName(),
                        Operator = InOperatorCD,
                        YYYYMM   = InFiscalYYYYMM,
                        StoreCD  = InStoreCD,
                        Mode     = Mode
                    };

                    api.ExecUpdate(de);
                }
            }
        }
 public DataTable D_MonthlyDebt_CSV_Report(D_MonthlyDebt_Entity dme, int chk)
 {
     return(dmdl.D_MonthlyDebt_CSV_Report(dme, chk));
 }