Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Dictionary <string, string> replaceKeywordDic = new Dictionary <string, string>();
            Dictionary <string, bool>   areacutKeywordDic = new Dictionary <string, bool>();

            replaceKeywordDic.Add("MONTH", "11");
            replaceKeywordDic.Add("YEAR", "2017");
            replaceKeywordDic.Add("DAY", "16");

            areacutKeywordDic.Add("USE_X86", true);
            areacutKeywordDic.Add("USE_SPARC", false);

            EditWord editWord = new EditWord();

            editWord.DocFile = @"C:\Users\yuuya\Desktop\新しいフォルダー (2)\見積もり.doc";
            String pdfPath = @"C:\Users\yuuya\Desktop\見積書.pdf";

            editWord.TmpFile = @"C:\Users\yuuya\Desktop\tmpl.doc";//テンプレファイル
            editWord.Edit(replaceKeywordDic, areacutKeywordDic);

            editWord.pdf(editWord.DocFile, pdfPath);


            MessageBox.Show("見積書が作成されました", "確認", MessageBoxButtons.OK);
        }
Esempio n. 2
0
        private void pdfCreate(DataTable dt2, String customername)
        {
            Dictionary <string, string> replaceKeywordDic = new Dictionary <string, string>();
            Dictionary <string, bool>   areacutKeywordDic = new Dictionary <string, bool>();
            int cnt = 0;

            replaceKeywordDic.Add("companyName", customername);
            replaceKeywordDic.Add("date", Datetime.Text + "請求分");

            for (int l = 1; l <= dt2.Rows.Count; l++)
            {
                replaceKeywordDic.Add("carName" + l, dt2.Rows[l - 1][0].ToString());
                replaceKeywordDic.Add("ss_price" + l, String.Format("{0:#,0}", Convert.ToInt32(dt2.Rows[l - 1][1])) + "円");
                replaceKeywordDic.Add("fee" + l, String.Format("{0:#,0}", Convert.ToInt32(dt2.Rows[l - 1][2])) + "円");
                replaceKeywordDic.Add("ec" + l, String.Format("{0:#,0}", Convert.ToInt32(dt2.Rows[l - 1][3])) + "円");
                replaceKeywordDic.Add("subtotal" + l, String.Format("{0:#,0}", Convert.ToInt32(dt2.Rows[l - 1][4])) + "円");
                if (dt2.Rows[l - 1][5].ToString().Equals("0"))
                {
                    replaceKeywordDic.Add("clearprice" + l, "支払済金額:0円");
                }
                else
                {
                    replaceKeywordDic.Add("clearprice" + l, "(支払済金額:" + String.Format("{0:#,0}", Convert.ToInt32(dt2.Rows[l - 1][5])) + "円)");
                }

                cnt = l;
            }
            for (int j = cnt + 1; j < 12; j++)
            {
                replaceKeywordDic.Add("carName" + j, "");
                replaceKeywordDic.Add("ss_price" + j, " ");
                replaceKeywordDic.Add("fee" + j, " ");
                replaceKeywordDic.Add("ec" + j, " ");
                replaceKeywordDic.Add("subtotal" + j, " ");
                replaceKeywordDic.Add("clearprice" + j, " ");
            }
            replaceKeywordDic.Add("total", String.Format("{0:#,0}", num) + "円");

            EditWord editWord = new EditWord();

            editWord.DocFile = Path.path + "\\word\\請求書\\" + Datetime.Text + customername + ".doc";
            String pdfPath = Path.path + "\\pdf\\請求書\\" + Datetime.Text + customername + ".pdf";

            editWord.TmpFile = Path.path + "\\tmp\\請求書.doc";//テンプレファイル
            editWord.Edit(replaceKeywordDic, areacutKeywordDic);
            editWord.pdf(editWord.DocFile, pdfPath);
        }
Esempio n. 3
0
        private void deliveryCreateBt_Click(object sender, EventArgs e)
        {
            Quote q     = new Quote();
            int   total = 0;
            Dictionary <string, string> replaceKeywordDic = new Dictionary <string, string>();
            Dictionary <string, bool>   areacutKeywordDic = new Dictionary <string, bool>();

            replaceKeywordDic.Add("companyName", q.customerNameSelect(TbCustomerName.Text));
            int lastI = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                replaceKeywordDic.Add("carName" + i, carList.Rows[i].Cells[0].Value.ToString());
                replaceKeywordDic.Add("ss_price" + i, String.Format("{0:#,0}", Convert.ToInt32(carList.Rows[i].Cells[1].Value)) + "円");
                replaceKeywordDic.Add("fee" + i, String.Format("{0:#,0}", Convert.ToInt32(carList.Rows[i].Cells[2].Value)) + "円");
                replaceKeywordDic.Add("ec" + i, String.Format("{0:#,0}", Convert.ToInt32(carList.Rows[i].Cells[3].Value)) + "円");
                replaceKeywordDic.Add("subtotal" + i, String.Format("{0:#,0}", Convert.ToInt32(carList.Rows[i].Cells[4].Value)) + "円");
                total += Convert.ToInt32(carList.Rows[i].Cells[4].Value);
                lastI  = i + 1;
            }
            for (; lastI < 11; lastI++)
            {
                replaceKeywordDic.Add("carName" + lastI, "");
                replaceKeywordDic.Add("ss_price" + lastI, "");
                replaceKeywordDic.Add("fee" + lastI, "");
                replaceKeywordDic.Add("ec" + lastI, "");
                replaceKeywordDic.Add("subtotal" + lastI, "");
            }
            replaceKeywordDic.Add("total", String.Format("{0:#,0}", total) + "円");
            areacutKeywordDic.Add("USE_X86", true);
            areacutKeywordDic.Add("USE_SPARC", false);
            EditWord editWord = new EditWord();
            String   time     = DateTime.Now.ToString("yyyy-MM-dd-HH-mm-ss");

            Console.WriteLine(time);
            editWord.DocFile = Path.path + "\\word\\納品書\\" + time + "納品書.doc";
            String pdfPath = Path.path + "\\pdf\\納品書\\" + time + "納品書.pdf";

            editWord.TmpFile = Path.path + "\\tmp\\納品書.doc";//テンプレファイル
            editWord.Edit(replaceKeywordDic, areacutKeywordDic);

            editWord.pdf(editWord.DocFile, pdfPath);
            MessageBox.Show("納品書が作成されました", "確認", MessageBoxButtons.OK);
            dk.buyFlagUpdate(TbCustomerCode.Text);
            carListSet(TbCustomerCode.Text);
        }
Esempio n. 4
0
        private void pdfCreate(DataRow row, int id)
        {
            Dictionary <string, string> replaceKeywordDic = new Dictionary <string, string>();
            Dictionary <string, bool>   areacutKeywordDic = new Dictionary <string, bool>();

            lk.updatePurchaseIdRceOrderDetail(row["rce_order_id"].ToString(), Convert.ToInt32(row["rce_order_detail_id"].ToString()), id);
            replaceKeywordDic.Add("modelYear", row["model_year"].ToString());
            replaceKeywordDic.Add("carName", row["car_name"].ToString());
            replaceKeywordDic.Add("grade", row["grade"].ToString());
            replaceKeywordDic.Add("model", row["model"].ToString());
            replaceKeywordDic.Add("quatePrice", String.Format("{0:#,0}", System.Math.Abs(Convert.ToInt32(row["quote_price"]))) + "円");
            areacutKeywordDic.Add("USE_X86", true);
            areacutKeywordDic.Add("USE_SPARC", false);
            EditWord editWord = new EditWord();

            editWord.DocFile = Path.path + "\\word\\出品票\\出品ID" + id + "明細ID" + Convert.ToInt32(row["rce_order_detail_id"].ToString()) + "出品票.doc";
            String pdfPath = Path.path + "\\pdf\\出品票\\出品ID" + id + "明細ID" + Convert.ToInt32(row["rce_order_detail_id"].ToString()) + "出品票.pdf";

            editWord.TmpFile = Path.path + "\\tmp\\出品票.doc";//テンプレファイル
            editWord.Edit(replaceKeywordDic, areacutKeywordDic);
            editWord.pdf(editWord.DocFile, pdfPath);
        }
Esempio n. 5
0
        private void pdfCreate(DataTable dt, int id)
        {
            Dictionary <string, string> replaceKeywordDic = new Dictionary <string, string>();
            Dictionary <string, bool>   areacutKeywordDic = new Dictionary <string, bool>();

            replaceKeywordDic.Add("auctionName", dt.Rows[0]["auction"].ToString());
            replaceKeywordDic.Add("purchaseOrderId", id.ToString());
            replaceKeywordDic.Add("date", dt.Rows[0]["auction_date"].ToString().Substring(0, 10));
            int lastI = 0;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                pk.updatePurchaseIdRceOrderDetail(dt.Rows[i]["rce_order_id"].ToString(), Convert.ToInt32(dt.Rows[i]["rce_order_detail_id"].ToString()), id);
                replaceKeywordDic.Add("auctionNo" + i, dt.Rows[i]["auction_no"].ToString());
                replaceKeywordDic.Add("carName" + i, dt.Rows[i]["car_name"].ToString());
                replaceKeywordDic.Add("model_year" + i, dt.Rows[i]["model_year"].ToString());
                replaceKeywordDic.Add("quote_price" + i, String.Format("{0:#,0}", Convert.ToInt32(dt.Rows[i]["quote_price"])) + "円");
                lastI = i + 1;
            }
            for (; lastI < 27; lastI++)
            {
                replaceKeywordDic.Add("auctionNo" + lastI, "");
                replaceKeywordDic.Add("carName" + lastI, "");
                replaceKeywordDic.Add("model_year" + lastI, "");
                replaceKeywordDic.Add("quote_price" + lastI, "");
            }
            areacutKeywordDic.Add("USE_X86", true);
            areacutKeywordDic.Add("USE_SPARC", false);
            EditWord editWord = new EditWord();

            editWord.DocFile = Path.path + "\\word\\発注票\\" + dt.Rows[0]["auction"].ToString() + id + "発注書.doc";
            String pdfPath = Path.path + "\\pdf\\発注票\\" + dt.Rows[0]["auction"].ToString() + id + "発注書.pdf";

            editWord.TmpFile = Path.path + "\\tmp\\発注書.doc";//テンプレファイル
            editWord.Edit(replaceKeywordDic, areacutKeywordDic);

            editWord.pdf(editWord.DocFile, pdfPath);
        }
Esempio n. 6
0
        private void BtSubmit_Click(object sender, EventArgs e)
        {
            Application.DoEvents();
            int cnt = 0;
            int sum = 0;
            Dictionary <string, string> replaceKeywordDic = new Dictionary <string, string>();
            Dictionary <string, bool>   areacutKeywordDic = new Dictionary <string, bool>();

            DateTime dtToday     = DateTime.Today;
            String   formal_name = quote.customerNameSelect(TbCusName.Text);


            replaceKeywordDic.Add("date", dtToday.ToString("yyyy/MM/dd"));
            replaceKeywordDic.Add("customername", formal_name);
            replaceKeywordDic.Add("id", TbMemo.Text);

            for (int i = 1; i <= dt2.Rows.Count; i++)
            {
                replaceKeywordDic.Add("carname" + i, dt2.Rows[i - 1][3].ToString());
                replaceKeywordDic.Add("year" + i, dt2.Rows[i - 1][2].ToString());
                replaceKeywordDic.Add("model" + i, dt2.Rows[i - 1][4].ToString());
                replaceKeywordDic.Add("grade" + i, dt2.Rows[i - 1][5].ToString());
                replaceKeywordDic.Add("price" + i, String.Format("{0:#,0}", Convert.ToInt32(dt2.Rows[i - 1][6])) + "円");


                cnt = i;
                sum = sum + Convert.ToInt32(dt2.Rows[i - 1][6]);
            }
            replaceKeywordDic.Add("sum", String.Format("{0:#,0}", sum) + "円");

            for (int i = cnt + 1; i <= 18; i++)
            {
                replaceKeywordDic.Add("carname" + i, " ");
                replaceKeywordDic.Add("year" + i, " ");
                replaceKeywordDic.Add("model" + i, " ");
                replaceKeywordDic.Add("grade" + i, " ");
                replaceKeywordDic.Add("price" + i, " ");
            }



            EditWord editWord = new EditWord();

            editWord.DocFile = Path.path + "\\word\\見積書\\見積書" + TbMemo.Text + TbCusName.Text + ".doc";
            String pdfPath = Path.path + "\\pdf\\見積書\\見積書" + TbMemo.Text + TbCusName.Text + ".pdf";

            editWord.TmpFile = Path.path + "\\tmp\\見積書.doc";//テンプレファイル
            editWord.Edit(replaceKeywordDic, areacutKeywordDic);

            editWord.pdf(editWord.DocFile, pdfPath);


            quote.quoteInsert(TbMemo.Text);

            DialogResult Res;

            Res = MessageBox.Show("処理が完了しました", "確認", MessageBoxButtons.OK);
            if (Res == DialogResult.OK)
            {
                this.Close();
            }
        }
Esempio n. 7
0
        private void btCreate_Click(object sender, EventArgs e)
        {
            try
            {
                List <string[]> rceDetail = new List <string[]>();
                string          id        = DvItem.Rows[0].Cells[1].Value.ToString();
                id = id.Substring(0, 3);
                Received         received  = new Received();
                DataTable        dt        = new DataTable();
                DataTable        companydt = new DataTable();
                MySqlDataAdapter da        = received.limitPrice(id);
                MySqlDataAdapter company   = received.componyName((DvItem.Rows[0].Cells[1]).Value.ToString());
                company.Fill(companydt);
                String companyName = companydt.Rows[0][0].ToString();
                da.Fill(dt);
                string lbprice = LbPrice.Text.ToString();
                Regex  re      = new Regex(@"[^\-*0-9]");
                string price   = re.Replace(lbprice, "");
                Console.WriteLine(price);
                Console.WriteLine(int.Parse(price));
                Console.WriteLine(int.Parse(dt.Rows[0][0].ToString()));

                if (int.Parse(price) < int.Parse(dt.Rows[0][0].ToString()))
                {
                    Dictionary <string, string> replaceKeywordDic = new Dictionary <string, string>();
                    Dictionary <string, bool>   areacutKeywordDic = new Dictionary <string, bool>();

                    DateTime now   = DateTime.Now;
                    int      month = now.Month;
                    int      day   = now.Day;
                    int      year  = now.Year;
                    replaceKeywordDic.Add("total", String.Format("{0:#,0}", int.Parse(price)) + "円");
                    replaceKeywordDic.Add("COMPANY_NAME", companyName);
                    replaceKeywordDic.Add("MONTH", month.ToString());
                    replaceKeywordDic.Add("YEAR", year.ToString());
                    replaceKeywordDic.Add("DAY", day.ToString());
                    replaceKeywordDic.Add("ODERID", (DvItem.Rows[0].Cells[1]).Value.ToString());
                    int j = 0;
                    for (int i = 0; j < 10; j++)
                    {
                        for (; i < DvItem.Rows.Count; i++)
                        {
                            if (DvItem.Rows[i].Cells[0].Value == null)
                            {
                                continue;
                            }
                            if ((bool)DvItem.Rows[i].Cells[0].Value)
                            {
                                string[] rce  = new string[7];
                                string   work = DvItem.Rows[i].Cells[8].Value.ToString();
                                if (DvItem.Rows[i].Cells["trade_flg"].Value.ToString() == "U")
                                {
                                    work = "-" + work;
                                }
                                rce[0] = DvItem.Rows[i].Cells[2].Value.ToString();
                                rce[1] = DvItem.Rows[i].Cells[3].Value.ToString();
                                rce[2] = DvItem.Rows[i].Cells[4].Value.ToString();
                                rce[3] = DvItem.Rows[i].Cells[5].Value.ToString();
                                rce[4] = DvItem.Rows[i].Cells[6].Value.ToString();
                                rce[5] = DvItem.Rows[i].Cells[7].Value.ToString();
                                rce[6] = work;
                                rceDetail.Add(rce);
                                replaceKeywordDic.Add("CAR" + j, DvItem.Rows[i].Cells[4].Value.ToString());
                                replaceKeywordDic.Add("year" + j, DvItem.Rows[i].Cells[3].Value.ToString());
                                replaceKeywordDic.Add("medel" + j, DvItem.Rows[i].Cells[5].Value.ToString());
                                replaceKeywordDic.Add("grade" + j, DvItem.Rows[i].Cells[6].Value.ToString());
                                replaceKeywordDic.Add("price" + j, String.Format("{0:#,0}", System.Math.Abs(Convert.ToInt32(DvItem.Rows[i].Cells[8].Value.ToString()))) + "円");
                                j++;
                            }
                        }
                        replaceKeywordDic.Add("CAR" + j, "");
                        replaceKeywordDic.Add("year" + j, "");
                        replaceKeywordDic.Add("medel" + j, "");
                        replaceKeywordDic.Add("grade" + j, "");
                        replaceKeywordDic.Add("price" + j, "");
                    }

                    areacutKeywordDic.Add("USE_X86", true);
                    areacutKeywordDic.Add("USE_SPARC", false);

                    EditWord editWord = new EditWord();
                    editWord.DocFile = Path.path + "\\word\\受注書\\" + (DvItem.Rows[0].Cells[1]).Value.ToString() + "oder.doc";
                    String pdfPath = Path.path + "\\pdf\\受注書\\" + (DvItem.Rows[0].Cells[1]).Value.ToString() + "oder.pdf";
                    editWord.TmpFile = Path.path + "\\tmp\\oder.doc";    //テンプレファイル
                    editWord.Edit(replaceKeywordDic, areacutKeywordDic);

                    editWord.pdf(editWord.DocFile, pdfPath);


                    received.rceInsert((DvItem.Rows[0].Cells[1]).Value.ToString(), pdfPath, rceDetail);
                    MessageBox.Show("受注書が作成されました", "確認", MessageBoxButtons.OK);
                    DataTable tb = new DataTable();
                    DvItem.DataSource = tb;
                    DvItem.Columns.Clear();
                    LbPrice.Text = "合計0円";
                }
                else
                {
                    MessageBox.Show("売掛金が不足しています。", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }