Exemplo n.º 1
0
        private void ShowPrintForm()
        {
            string title = string.Empty;
            string head1Title = string.Empty;

            string hLx = string.Empty;
            if (op == 1)
            {
                hLx = this.comboBox1.SelectedValue.ToString().Substring(0, 2);
            }
            else
            {
                hLx = HLX.Substring(0, 2);
            }

            if (hLx == "02")
            {
                title = "产品出库单";
                head1Title = "成本费用";
            }
            else if (hLx == "03")
            {
                title = "产品入库单";
                head1Title = "其他费用";
            }
            else
            {
                title = "材料入库单";
                head1Title = "其他费用";
            }
            string gg = string.Empty;
            string Customer = string.Empty;
            string Hcode = string.Empty;
            string InvCode = string.Empty;
            string IDate = string.Empty;
            string ITitle = string.Empty;
            string Head1Title = string.Empty;
            decimal Total = 0;
            if (op == 1)
            {
                gg = guid;
                Customer = this.textBox1.Text;
                Hcode = this.comboBox1.SelectedValue.ToString();
                InvCode = this.invoiceCodeTB.Text;
                IDate = this.dateTimePicker1.Value.ToShortDateString();

                if (hLx == "02")
                {

                    Total = decimal.Parse(this.totalTB.Text);
                }
                else
                {
                    decimal etc = 0;
                    foreach (DataGridViewRow r in this.dataGridView2.Rows)
                    {
                        if (r.Cells["EtcCost"].Value == null || r.Cells["EtcCost"].Value.ToString() == string.Empty)
                        {
                            continue;
                        }
                        etc += decimal.Parse(r.Cells["EtcCost"].Value.ToString());
                    }
                    Total = decimal.Parse(this.totalTB.Text) + etc;
                }

            }
            else
            {

                gg = this.dgrv.Cells["InvID"].Value.ToString();
                Customer = this.dgrv.Cells["客户名"].Value.ToString();
                Hcode = this.dgrv.Cells["合同号"].Value.ToString();
                InvCode = this.dgrv.Cells["发票号"].Value.ToString();
                IDate = this.dgrv.Cells["单据日期"].Value.ToString();

                if (hLx == "02")
                {

                    Total = decimal.Parse(dgrv.Cells["库存金额"].Value.ToString());
                }
                else
                {
                    Total = decimal.Parse(dgrv.Cells["库存金额"].Value.ToString()) + decimal.Parse(dgrv.Cells["其他费用"].Value.ToString());
                }

            }

            WhPrint wp = new WhPrint(gg, Customer, Hcode, InvCode, IDate, title, head1Title, Total);
            wp.ShowDialog();
        }
Exemplo n.º 2
0
        private void Reg()
        {
            OnButtonClick add = (s, e) =>
            {
                Warehouse wh = new Warehouse(1, null, this.dataGridView1.SelectedRows[0].Cells["类型编号"].Value.ToString());
                wh.MdiParent = this.MdiParent;
                wh.Show();
            };
            OnButtonClick upd = (s, e) =>
            {
                if (this.dataGridView1.SelectedRows == null || this.dataGridView1.SelectedRows.Count <= 0)
                {
                    return;
                }
                Warehouse wh = new Warehouse(3, this.dataGridView1.SelectedRows[0], this.dataGridView1.SelectedRows[0].Cells["类型编号"].Value.ToString());
                wh.MdiParent = this.MdiParent;
                wh.Show();
            };
            OnButtonClick del = (s, e) =>
            {
                if (this.dataGridView1.SelectedRows == null || this.dataGridView1.SelectedRows.Count <= 0)
                {
                    return;
                }
                Warehouse wh = new Warehouse(2, this.dataGridView1.SelectedRows[0], this.dataGridView1.SelectedRows[0].Cells["类型编号"].Value.ToString());
                wh.MdiParent = this.MdiParent;
                wh.Show();
            };
            OnButtonClick filter = (s, e) =>
            {
                Warehouse wh = new Warehouse(1, null, this.dataGridView1.SelectedRows[0].Cells["类型编号"].Value.ToString());
                wh.MdiParent = this.MdiParent;
                wh.Show();
            };

            OnButtonClick btn_print = (s, e) =>
            {

                string title = string.Empty;
                string head1Title = string.Empty;

                if (this.dataGridView1.SelectedRows[0].Cells["类型编号"].Value.ToString().Substring(0, 2) == "02")
                {
                    title = "产品出库单";
                    head1Title = "成本费用";
                }
                else if (this.dataGridView1.SelectedRows[0].Cells["类型编号"].Value.ToString().Substring(0, 2) == "03")
                {
                    title = "产品入库单";
                    head1Title = "其他费用";
                }
                else
                {
                    title = "材料入库单";
                    head1Title = "其他费用";
                }
                //客户名	合同号	合同类型	结算金额	签订日期	主要商品	库存金额	单据日期	业务员	备注	发票号	类型编号
                decimal total = 0;
                if (this.dataGridView1.SelectedRows[0].Cells["类型编号"].Value.ToString().Substring(0, 2) == "02")
                {

                    total += decimal.Parse(this.dataGridView1.SelectedRows[0].Cells["库存金额"].Value.ToString());
                }
                else
                {
                    total += decimal.Parse(this.dataGridView1.SelectedRows[0].Cells["库存金额"].Value.ToString()) + decimal.Parse(this.dataGridView1.SelectedRows[0].Cells["其他费用"].Value.ToString());
                }

                WhPrint wp = new WhPrint(this.dataGridView1.SelectedRows[0].Cells["InvID"].Value.ToString(),
                    this.dataGridView1.SelectedRows[0].Cells["客户名"].Value.ToString(),
                   this.dataGridView1.SelectedRows[0].Cells["合同号"].Value.ToString(),
                    this.dataGridView1.SelectedRows[0].Cells["发票号"].Value.ToString(),
                    this.dataGridView1.SelectedRows[0].Cells["单据日期"].Value.ToString(), title, head1Title,
                     total);
                wp.ShowDialog();

            };
            bts = new ToolStripItem[]{
                    new Factory_ToolBtn(" 计算器 "," 计算器 ",ClassCustom.getImage("jsq.png"),(this.MdiParent as MForm1).jsq,null,true).TBtnProduce(),
                    new Factory_ToolBtn("关闭窗口","关闭窗口",ClassCustom.getImage("gb.png"),(this.MdiParent as MForm1).CloseAll,null,true).TBtnProduce(),
                    new Factory_ToolBtn("窗口层叠","窗口层叠",ClassCustom.getImage("cd.png"),(this.MdiParent as MForm1).cd,null,true).TBtnProduce(),
                    new Factory_ToolBtn("垂直平铺","垂直平铺",ClassCustom.getImage("cz.png"),(this.MdiParent as MForm1).cz,null,true).TBtnProduce(),
                    new Factory_ToolBtn("水平平铺","水平平铺",ClassCustom.getImage("spp.png"),(this.MdiParent as MForm1).sp,null,true).TBtnProduce(),
                    new ToolStripSeparator(),
                    new Factory_ToolBtn("添加单据","添加单据",ClassCustom.getImage("add.png"),add,null,true).TBtnProduce(),
                    new Factory_ToolBtn("删除单据", "删除单据",ClassCustom.getImage("del.png"), del,null,true).TBtnProduce(),
                    new Factory_ToolBtn("修改单据","修改单据",ClassCustom.getImage("upd.png"),upd,null,true).TBtnProduce(),
                    new Factory_ToolBtn("  过滤  ", "  过滤  ",ClassCustom.getImage("sel.png"), filter,null,true).TBtnProduce(),
                    new Factory_ToolBtn("刷新", "刷新",ClassCustom.getImage("sx.png"), this.Form_Load,null,true).TBtnProduce(),
                    new ToolStripSeparator(),
                                                            //new ToolStripSeparator(),
                    new Factory_ToolBtn("打印", "打印",ClassCustom.getImage("print.png"), btn_print,null,true).TBtnProduce(),
                    //new Factory_ToolBtn("  保存  ", "  保存  ",ClassCustom.getImage("sav.png"), this.btn_sav,null,true).TBtnProduce(),
                    new Factory_ToolBtn("  退出  ", "  退出  ",ClassCustom.getImage("tc.png"),this.btn_close,null,true).TBtnProduce(),
                    };
            this.Activated += new EventHandler(FormActivated);
            this.Deactivate += new EventHandler(FormDeactivate);
            this.FormClosing += new FormClosingEventHandler(Form_Closing);
        }