jingh
2021-04-10 79b759bfa5640cc6a02f5bc9bb20604c6e471fca
开票和撤销
2个文件已修改
238 ■■■■ 已修改文件
WarM/存货核算/Kf_SellOutBillQuery_Sec.cs 135 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WarM/存货核算/Kf_SellOutBillQuery_Sec.designer.cs 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WarM/´æ»õºËËã/Kf_SellOutBillQuery_Sec.cs
@@ -1260,5 +1260,140 @@
            }
        }
        //开票
        private void fp_Click(object sender, EventArgs e)
        {
            Sub_EditInnerBillNo();
            Sub_FastQuery();
        }
        //开发票
        private void Sub_EditInnerBillNo()
        {
            // æƒé™
            if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, DBUtility.ClsPub.CurUserName))
            {
                return;
            }
            //
            Int64 lngBillKey = 0;
            if (grdMain.CurrentRow == null)
                return;
            lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
            if (lngBillKey == 0)
            {
                MessageBox.Show("选择的单据有错误!");
                return;
            }
            string sBillNo = txtHInnerBillNo.Text;
            //反审核  å†™å…¥æ ¸é”€æ—¥å¿—,更新出库单核销状态,删除核销子表主表
            if (MessageBox.Show("确定要开票当前单据?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                if (SetInnerBillNo(lngBillKey, sBillNo) == true)
                {
                    MessageBox.Show("开票成功!", "提示");
                    return;
                }
                else
                {
                    MessageBox.Show("开票失败!原因:" + DBUtility.ClsPub.sExeReturnInfo, "提示");
                    return;
                }
            }
        }
        private bool SetInnerBillNo(Int64 sInterID, string sBillNo)
        {
            ClsCN oCn = new ClsCN();
            try
            {
                oCn.BeginTran();
                //写入核销日志表 ï¼Œæ›´æ–°å‡ºåº“单核销状态,删除核销子表主表
                //oCn.RunProc("insert into  Kf_CheckInfoBillLog " +
                //    "(HCheckDate,HBDate,HEDate,HCusID,HQty,HMoney,HType,HBillType,HFPInterID,HFPBillNo) " +
                //    " VALUES " +
                //    "(getdate(),getdate(),getdate(),0," + sumQty.ToString() + "," + sumMoney.ToString() + ",'反核销','销售出库'," + sInterID.ToString() + ",'" + sBillNo + "')");
                oCn.RunProc("exec h_p_KF_CheckInfoBill_InnerBill  " + sInterID + ",'" + sBillNo + "'");
                oCn.Commit();
                //
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                return false;
            }
        }
        //撤销开票
        private void qx_Click(object sender, EventArgs e)
        {
            Sub_EditBackInnerBillNo();
            Sub_FastQuery();
        }
        //撤销开发票
        private void Sub_EditBackInnerBillNo()
        {
            // æƒé™
            if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true, DBUtility.ClsPub.CurUserName))
            {
                return;
            }
            //
            Int64 lngBillKey = 0;
            if (grdMain.CurrentRow == null)
                return;
            lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
            if (lngBillKey == 0)
            {
                MessageBox.Show("选择的单据有错误!");
                return;
            }
            string sBillNo = "";
            //反审核  å†™å…¥æ ¸é”€æ—¥å¿—,更新出库单核销状态,删除核销子表主表
            if (MessageBox.Show("确定要撤销开票当前单据?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {
                if (SetBackInnerBillNo(lngBillKey, sBillNo) == true)
                {
                    MessageBox.Show("撤销开票成功!", "提示");
                    return;
                }
                else
                {
                    MessageBox.Show("撤销开票失败!原因:" + DBUtility.ClsPub.sExeReturnInfo, "提示");
                    return;
                }
            }
        }
        private bool SetBackInnerBillNo(Int64 sInterID, string sBillNo)
        {
            ClsCN oCn = new ClsCN();
            try
            {
                oCn.BeginTran();
                //写入核销日志表 ï¼Œæ›´æ–°å‡ºåº“单核销状态,删除核销子表主表
                //oCn.RunProc("insert into  Kf_CheckInfoBillLog " +
                //    "(HCheckDate,HBDate,HEDate,HCusID,HQty,HMoney,HType,HBillType,HFPInterID,HFPBillNo) " +
                //    " VALUES " +
                //    "(getdate(),getdate(),getdate(),0," + sumQty.ToString() + "," + sumMoney.ToString() + ",'反核销','销售出库'," + sInterID.ToString() + ",'" + sBillNo + "')");
                oCn.RunProc("exec h_p_KF_CheckInfoBill_InnerBillBack  " + sInterID + ",'" + sBillNo + "'");
                oCn.Commit();
                //
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                return false;
            }
        }
    }
}
WarM/´æ»õºËËã/Kf_SellOutBillQuery_Sec.designer.cs
@@ -44,6 +44,9 @@
            this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
            this.cx = new System.Windows.Forms.ToolStripButton();
            this.sx = new System.Windows.Forms.ToolStripButton();
            this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
            this.fp = new System.Windows.Forms.ToolStripButton();
            this.qx = new System.Windows.Forms.ToolStripButton();
            this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
            this.qsh = new System.Windows.Forms.ToolStripButton();
            this.toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
@@ -74,9 +77,8 @@
            this.label3 = new System.Windows.Forms.Label();
            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
            this.grdSub = new System.Windows.Forms.DataGridView();
            this.fp = new System.Windows.Forms.ToolStripButton();
            this.qx = new System.Windows.Forms.ToolStripButton();
            this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
            this.label6 = new System.Windows.Forms.Label();
            this.txtHInnerBillNo = new System.Windows.Forms.TextBox();
            this.pPic.SuspendLayout();
            this.panel1.SuspendLayout();
            this.Tool.SuspendLayout();
@@ -95,13 +97,15 @@
            this.pPic.BackColor = System.Drawing.Color.White;
            this.pPic.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pPic.BackgroundImage")));
            this.pPic.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
            this.pPic.Controls.Add(this.label6);
            this.pPic.Controls.Add(this.txtHInnerBillNo);
            this.pPic.Controls.Add(this.panel1);
            this.pPic.Controls.Add(this.lblCaption);
            this.pPic.Dock = System.Windows.Forms.DockStyle.Top;
            this.pPic.Location = new System.Drawing.Point(0, 62);
            this.pPic.Margin = new System.Windows.Forms.Padding(4);
            this.pPic.Name = "pPic";
            this.pPic.Size = new System.Drawing.Size(1535, 46);
            this.pPic.Size = new System.Drawing.Size(1535, 61);
            this.pPic.TabIndex = 15;
            // 
            // panel1
@@ -112,7 +116,7 @@
            this.panel1.Location = new System.Drawing.Point(1250, 0);
            this.panel1.Margin = new System.Windows.Forms.Padding(4);
            this.panel1.Name = "panel1";
            this.panel1.Size = new System.Drawing.Size(285, 46);
            this.panel1.Size = new System.Drawing.Size(285, 61);
            this.panel1.TabIndex = 7;
            // 
            // lbljl
@@ -282,6 +286,39 @@
            this.sx.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
            this.sx.Click += new System.EventHandler(this.sx_Click);
            // 
            // toolStripSeparator5
            //
            this.toolStripSeparator5.Name = "toolStripSeparator5";
            this.toolStripSeparator5.Size = new System.Drawing.Size(6, 62);
            //
            // fp
            //
            this.fp.AutoSize = false;
            this.fp.Image = ((System.Drawing.Image)(resources.GetObject("fp.Image")));
            this.fp.ImageAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.fp.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
            this.fp.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.fp.Name = "fp";
            this.fp.Size = new System.Drawing.Size(36, 47);
            this.fp.Text = "开票";
            this.fp.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.fp.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
            this.fp.Click += new System.EventHandler(this.fp_Click);
            //
            // qx
            //
            this.qx.AutoSize = false;
            this.qx.Image = ((System.Drawing.Image)(resources.GetObject("qx.Image")));
            this.qx.ImageAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.qx.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
            this.qx.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.qx.Name = "qx";
            this.qx.Size = new System.Drawing.Size(36, 47);
            this.qx.Text = "撤票";
            this.qx.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.qx.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
            this.qx.Click += new System.EventHandler(this.qx_Click);
            //
            // toolStripSeparator1
            // 
            this.toolStripSeparator1.Name = "toolStripSeparator1";
@@ -401,7 +438,7 @@
            this.grdMain.ReadOnly = true;
            this.grdMain.RowHeadersWidth = 51;
            this.grdMain.RowTemplate.Height = 23;
            this.grdMain.Size = new System.Drawing.Size(1535, 425);
            this.grdMain.Size = new System.Drawing.Size(1535, 416);
            this.grdMain.TabIndex = 19;
            this.grdMain.CellMouseUp += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.grdMain_CellMouseUp);
            this.grdMain.ColumnWidthChanged += new System.Windows.Forms.DataGridViewColumnEventHandler(this.grdMain_ColumnWidthChanged);
@@ -453,7 +490,7 @@
            this.groupBox1.Controls.Add(this.txtHBillNo);
            this.groupBox1.Controls.Add(this.label3);
            this.groupBox1.Dock = System.Windows.Forms.DockStyle.Top;
            this.groupBox1.Location = new System.Drawing.Point(0, 108);
            this.groupBox1.Location = new System.Drawing.Point(0, 123);
            this.groupBox1.Margin = new System.Windows.Forms.Padding(4);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Padding = new System.Windows.Forms.Padding(4);
@@ -577,7 +614,7 @@
            // splitContainer1
            // 
            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.splitContainer1.Location = new System.Drawing.Point(0, 159);
            this.splitContainer1.Location = new System.Drawing.Point(0, 174);
            this.splitContainer1.Margin = new System.Windows.Forms.Padding(4);
            this.splitContainer1.Name = "splitContainer1";
            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
@@ -589,8 +626,8 @@
            // splitContainer1.Panel2
            // 
            this.splitContainer1.Panel2.Controls.Add(this.grdSub);
            this.splitContainer1.Size = new System.Drawing.Size(1535, 755);
            this.splitContainer1.SplitterDistance = 425;
            this.splitContainer1.Size = new System.Drawing.Size(1535, 740);
            this.splitContainer1.SplitterDistance = 416;
            this.splitContainer1.SplitterWidth = 5;
            this.splitContainer1.TabIndex = 51;
            // 
@@ -607,42 +644,30 @@
            this.grdSub.ReadOnly = true;
            this.grdSub.RowHeadersWidth = 51;
            this.grdSub.RowTemplate.Height = 23;
            this.grdSub.Size = new System.Drawing.Size(1535, 325);
            this.grdSub.Size = new System.Drawing.Size(1535, 319);
            this.grdSub.TabIndex = 20;
            this.grdSub.CellMouseUp += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.grdSub_CellMouseUp);
            this.grdSub.EditingControlShowing += new System.Windows.Forms.DataGridViewEditingControlShowingEventHandler(this.grdSub_EditingControlShowing);
            this.grdSub.KeyDown += new System.Windows.Forms.KeyEventHandler(this.grdSub_KeyDown);
            // 
            // fp
            // label6
            // 
            this.fp.AutoSize = false;
            this.fp.Image = ((System.Drawing.Image)(resources.GetObject("fp.Image")));
            this.fp.ImageAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.fp.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
            this.fp.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.fp.Name = "fp";
            this.fp.Size = new System.Drawing.Size(36, 47);
            this.fp.Text = "开票";
            this.fp.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.fp.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
            this.label6.AutoSize = true;
            this.label6.BackColor = System.Drawing.Color.Transparent;
            this.label6.Location = new System.Drawing.Point(405, 19);
            this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(82, 15);
            this.label6.TabIndex = 8;
            this.label6.Text = "发票号码:";
            // 
            // qx
            // txtHInnerBillNo
            // 
            this.qx.AutoSize = false;
            this.qx.Image = ((System.Drawing.Image)(resources.GetObject("qx.Image")));
            this.qx.ImageAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.qx.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
            this.qx.ImageTransparentColor = System.Drawing.Color.Magenta;
            this.qx.Name = "qx";
            this.qx.Size = new System.Drawing.Size(36, 47);
            this.qx.Text = "撤票";
            this.qx.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
            this.qx.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
            //
            // toolStripSeparator5
            //
            this.toolStripSeparator5.Name = "toolStripSeparator5";
            this.toolStripSeparator5.Size = new System.Drawing.Size(6, 62);
            this.txtHInnerBillNo.Location = new System.Drawing.Point(492, 13);
            this.txtHInnerBillNo.Margin = new System.Windows.Forms.Padding(4);
            this.txtHInnerBillNo.Name = "txtHInnerBillNo";
            this.txtHInnerBillNo.Size = new System.Drawing.Size(215, 25);
            this.txtHInnerBillNo.TabIndex = 9;
            // 
            // Kf_SellOutBillQuery_Sec
            // 
@@ -731,5 +756,7 @@
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator5;
        private System.Windows.Forms.ToolStripButton fp;
        private System.Windows.Forms.ToolStripButton qx;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.TextBox txtHInnerBillNo;
    }
}