Example #1
0
 public Invoice(DataGridViewRow dgrv, Warehouse wh)
 {
     InitializeComponent();
     this.Dgvr = dgrv;
     this.wh = wh;
 }
Example #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);
        }