コード例 #1
0
        /// <summary>
        /// 月次仕入計算処理
        /// GetsujiShiireKeisanSyoriより更新時に使用
        /// </summary>
        /// <param name="de"></param>
        /// <returns></returns>
        public bool D_MonthlyPurchase_Exec(D_MonthlyPurchase_Entity de)
        {
            string sp = "PRC_GetsujiShiireKeisanSyori";

            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));
        }
コード例 #2
0
 public SiiresakiZaikoYoteiHyou()
 {
     InitializeComponent();
     szybl = new SiiresakiZaikoYoteiHyou_BL();
     dmpe  = new D_MonthlyPurchase_Entity();
     dt    = new DataTable();
 }
コード例 #3
0
 private D_MonthlyPurchase_Entity GetData()
 {
     dmpe = new D_MonthlyPurchase_Entity()
     {
         StoreCD = cboStore.SelectedValue.ToString(),
         YYYYMMS = txtTargetDateFrom.Text.Replace("/", ""),
         YYYYMME = txtTargetDateTo.Text.Replace("/", "")
     };
     return(dmpe);
 }
コード例 #4
0
 public void ExecUpdate(D_MonthlyPurchase_Entity de)
 {
     try {
         sbl.GetsujiShiireKeisanSyori(de);
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine(ex.Message);
     }
 }
コード例 #5
0
        private void F11()
        {
            if (ErrorCheck())
            {
                dmpe = new D_MonthlyPurchase_Entity();
                dmpe = GetData();
                DataTable dt = szybl.RPC_SiiresakiZaikoYoteiHyou(dmpe);
                if (dt.Rows.Count > 0)
                {
                    DataTable dtExport = dt;
                    dtExport = ChangeDataColumnName(dtExport);
                    string folderPath = "C:\\SES\\";
                    if (!Directory.Exists(folderPath))
                    {
                        Directory.CreateDirectory(folderPath);
                    }
                    SaveFileDialog savedialog = new SaveFileDialog();
                    savedialog.Filter           = "Excel Files|*.xlsx;";
                    savedialog.Title            = "Save";
                    savedialog.FileName         = "仕入先在庫予定表";
                    savedialog.InitialDirectory = folderPath;

                    savedialog.RestoreDirectory = true;
                    if (savedialog.ShowDialog() == DialogResult.OK)
                    {
                        if (Path.GetExtension(savedialog.FileName).Contains(".xlsx"))
                        {
                            Microsoft.Office.Interop.Excel._Application excel     = new Microsoft.Office.Interop.Excel.Application();
                            Microsoft.Office.Interop.Excel._Workbook    workbook  = excel.Workbooks.Add(Type.Missing);
                            Microsoft.Office.Interop.Excel._Worksheet   worksheet = null;

                            worksheet      = workbook.ActiveSheet;
                            worksheet.Name = "worksheet";
                            using (XLWorkbook wb = new XLWorkbook())
                            {
                                wb.Worksheets.Add(dtExport, "worksheet");
                                wb.Worksheet("worksheet").Row(1).InsertRowsAbove(1);
                                wb.Worksheet("worksheet").Row(1).InsertRowsAbove(1);
                                wb.Worksheet("worksheet").Cell(1, 1).Value = "年月:";

                                wb.Worksheet("worksheet").Cell(2, 1).Value = "店舗:";
                                wb.Worksheet("worksheet").Cell(1, 2).Value = txtTargetDateFrom.Text;
                                wb.Worksheet("worksheet").Cell(1, 3).Value = "~";
                                wb.Worksheet("worksheet").Cell(1, 4).Value = txtTargetDateTo.Text;
                                wb.Worksheet("worksheet").Cell(2, 2).Value = cboStore.SelectedValue.ToString();
                                wb.Worksheet("worksheet").Cell(2, 3).Value = cboStore.Text.ToString();
                                wb.SaveAs(savedialog.FileName);
                                szybl.ShowMessage("I203", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
                            }
                            Process.Start(Path.GetDirectoryName(savedialog.FileName));
                        }
                    }
                }
            }
        }
コード例 #6
0
        public DataTable RPC_SiiresakiZaikoYoteiHyou(D_MonthlyPurchase_Entity dmpe)
        {
            string sp = "RPC_SiiresakiZaikoYoteiHyou";
            Dictionary <string, ValuePair> dic = new Dictionary <string, ValuePair>
            {
                { "@StoreCD", new ValuePair {
                      value1 = SqlDbType.VarChar, value2 = dmpe.StoreCD
                  } },
                { "@TargetSDate", new ValuePair {
                      value1 = SqlDbType.Int, value2 = dmpe.YYYYMMS
                  } },
                { "@TargetEDate", new ValuePair {
                      value1 = SqlDbType.Int, value2 = dmpe.YYYYMME
                  } }
            };

            return(SelectData(dic, sp));
        }
コード例 #7
0
        /// <summary>
        /// 月次仕入計算処理
        /// </summary>
        /// <param name="de"></param>
        /// <returns></returns>
        public bool GetsujiShiireKeisanSyori(D_MonthlyPurchase_Entity de)
        {
            D_MonthlyPurchase_DL dl = new D_MonthlyPurchase_DL();

            return(dl.D_MonthlyPurchase_Exec(de));
        }
コード例 #8
0
        protected override void PrintSec()
        {
            if (PrintMode != EPrintMode.DIRECT)
            {
                return;
            }
            if (ErrorCheck())
            {
                dmpe = new D_MonthlyPurchase_Entity();
                dmpe = GetData();
                DataTable dt = szybl.RPC_SiiresakiZaikoYoteiHyou(dmpe);
                if (dt.Rows.Count > 0)
                {
                    // CheckBeforeExport();
                    try
                    {
                        SiiresakiZaikoYoteiHyou_Report szy_Report = new SiiresakiZaikoYoteiHyou_Report();
                        DialogResult DResult;
                        switch (PrintMode)
                        {
                        case EPrintMode.DIRECT:
                            DResult = bbl.ShowMessage("Q201");
                            if (DResult == DialogResult.Cancel)
                            {
                                return;
                            }
                            szy_Report.SetDataSource(dt);
                            szy_Report.Refresh();
                            szy_Report.SetParameterValue("lblDateFrom", txtTargetDateFrom.Text);
                            szy_Report.SetParameterValue("lblDateTo", txtTargetDateTo.Text);
                            szy_Report.SetParameterValue("lblStore", cboStore.SelectedValue.ToString() + "   " + cboStore.AccessibilityObject.Name);
                            szy_Report.SetParameterValue("lblToday", dt.Rows[0]["Today"].ToString());
                            try
                            {
                            }
                            catch (Exception ex)
                            {
                                var msg = ex.Message;
                            }
                            if (DResult == DialogResult.Yes)
                            {
                                var vr = new Viewer();
                                vr.CrystalReportViewer1.ShowPrintButton = true;
                                vr.CrystalReportViewer1.ReportSource    = szy_Report;
                                vr.ShowDialog();
                            }
                            else
                            {
                                CrystalDecisions.Shared.PageMargins margin = szy_Report.PrintOptions.PageMargins;
                                margin.leftMargin   = DefaultMargin.Left;
                                margin.topMargin    = DefaultMargin.Top;
                                margin.bottomMargin = DefaultMargin.Bottom;
                                margin.rightMargin  = DefaultMargin.Right;
                                szy_Report.PrintOptions.ApplyPageMargins(margin);
                                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();
                                    szy_Report.PrintOptions.PrinterName = "\\\\dataserver\\Canon LBP2900";
                                    System.Drawing.Printing.PageSettings pSettings = new System.Drawing.Printing.PageSettings(printerSettings);

                                    szy_Report.PrintOptions.DissociatePageSizeAndPrinterPaperSize = true;

                                    szy_Report.PrintOptions.PrinterDuplex = PrinterDuplex.Simplex;

                                    szy_Report.PrintToPrinter(printerSettings, pSettings, false, PrintLayout);
                                }
                                catch (Exception ex)
                                {
                                }
                            }
                            break;
                        }
                        InsertLog(Get_L_Log_Entity());
                    }
                    finally
                    {
                        txtTargetDateTo.Focus();
                    }
                }
                else
                {
                    szybl.ShowMessage("E128");
                    txtTargetDateTo.Focus();
                }
            }
        }
コード例 #9
0
        static void Main(string[] args)
        {
            Console.Title = "GetsujiShiireSyuukeiSyori";

            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&	ClosePosition5=0なら
                    if (gsbl.Z_Set(me.FiscalYYYYMM) <= gsbl.Z_Set(InFiscalYYYYMM))
                    {
                        if (gsbl.Z_Set(me.FiscalYYYYMM) == gsbl.Z_Set(InFiscalYYYYMM))
                        {
                            if (me.ClosePosition5.Equals("0"))
                            {
                                execFlg = true;
                            }
                        }
                        else
                        {
                            execFlg = true;
                        }
                        InFiscalYYYYMM = me.FiscalYYYYMM;
                    }
                }

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

                    api.ExecUpdate(de);
                }
            }
        }
コード例 #10
0
 public DataTable RPC_SiiresakiZaikoYoteiHyou(D_MonthlyPurchase_Entity dmpe)
 {
     return(dmpdl.RPC_SiiresakiZaikoYoteiHyou(dmpe));
 }