예제 #1
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (this.dgv_lst.SelectedRows.Count <= 0) return;
            if (this.dgv_lst.SelectedRows[0].Cells["单据编号"].Value == null) return;
            string djh = this.dgv_lst.SelectedRows[0].Cells["单据编号"].Value.ToString().Trim();
            if (djh == "") return;

            FormCopySettleInvoiceAdd fa = new FormCopySettleInvoiceAdd();
            fa.OpaMethod = this.OpaMethod;
            fa.type = "edit";
            fa.Rid = djh;
            fa.ShowDialog();
        }
예제 #2
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (this.dgv_lst.SelectedRows.Count <= 0)
            {
                return;
            }
            if (this.dgv_lst.SelectedRows[0].Cells["单据编号"].Value == null)
            {
                return;
            }
            string djh = this.dgv_lst.SelectedRows[0].Cells["单据编号"].Value.ToString().Trim();

            if (djh == "")
            {
                return;
            }

            FormCopySettleInvoiceAdd fa = new FormCopySettleInvoiceAdd();

            fa.OpaMethod = this.OpaMethod;
            fa.type      = "edit";
            fa.Rid       = djh;
            fa.ShowDialog();
        }
예제 #3
0
        private void button9_Click(object sender, EventArgs e)
        {
            if (this.dgv_prepay.SelectedRows.Count <= 0) return;
            if (this.dgv_prepay.SelectedRows[0].Cells["sysid"].Value == null) return;
            string sysid_ = this.dgv_prepay.SelectedRows[0].Cells["sysid"].Value.ToString().Trim();
            string settlesysid_ = this.dgv_prepay.SelectedRows[0].Cells["settlesysid"].Value.ToString().Trim();
            if (sysid_ == "") return;
            if (settlesysid_ != "") return;   //该记录是抵扣产生的

            string sids = "";   //结算表中的sysid,有多个
            string custname = "";
            double tot = 0;
            if (this.dgv_prepay.SelectedRows[0].Cells["预收金额"].Value.ToString().Trim() != "")
                tot = Convert.ToDouble(this.dgv_prepay.SelectedRows[0].Cells["预收金额"].Value.ToString().Trim());

            string sjsid = "";

            if (this.JSLX == "") return;
            if (this.JSLX == "单机")
            {
                sjsid = this.BarSysId;
            }
            else
            {
                sjsid = this.Bdid;
            }
            custname = Get_CustName(sjsid);

            ////
            if (Is_KaiPiao_PrePay(sjsid,sysid_))
            {
                MessageBox.Show("已经开过票!");
                return;
            }
            ////

            sids = sysid_ + ";";

            FormCopySettleInvoiceAdd fcs = new FormCopySettleInvoiceAdd();
            fcs.FormCopySettleInvoiceChange_ += new FormCopySettleInvoiceAdd.FormCopySettleInvoiceChange(ppa_PrePayAddChange_);

            fcs.sids = sids;
            fcs.type = "add";
            fcs.lx = "预收开票";
            fcs.totmoney = tot;
            fcs.custName = custname;
            fcs.ShowDialog();
        }
예제 #4
0
        private void button8_Click(object sender, EventArgs e)
        {
            string sql_ = "";
            string sids = "";   //结算表中的sysid,有多个
            string custname = "";
            double tot = 0;
            string swhere = "";

            string Fday = "", Tday = "",sjsid="";
            if (this.JSLX == "") return;
            if (this.JSLX == "单机")
            {
                sjsid = this.BarSysId;
            }
            else
            {
               sjsid = this.Bdid;
            }
                custname = Get_CustName(sjsid);
                Fday = this.JsFrom.ToString("yyyy-MM-dd");
                Tday = this.JsTo.ToString("yyyy-MM-dd");

            ////
                //已经开票的,不允许再开票
                if (Is_KaiPiao_JieSuan(sjsid, Fday,Tday))
                {
                    MessageBox.Show("已经开过票!");
                    return;
                }
                //
                //
            ////
                tot = this.totmoney;
                sql_ = "select sysid from T_MacSettle where BargOrBd_id='" + sjsid + "'"
                    + " and Czfrom='" + Fday + "' and czto='" + Tday + "'";
                DataTable dt = (new SqlDBConnect()).Get_Dt(sql_);
                string stmp="";
                for (int m = 0; m < dt.Rows.Count; m++)
                {
                    stmp=dt.Rows[m]["sysid"].ToString().Trim();
                    if (swhere == "")
                    {
                        swhere = " (SettleSysid=" + stmp+")";
                    }
                    else
                        swhere = swhere + " or (SettleSysid=" + stmp + ")";
                    sids = stmp + ";" + sids;
                }

            //需要扣除已经抵扣的金额
            double thistot = 0;
            sql_ = "select sum(Paid) from T_MacSettlePrePay "
                    + " where BargOrBd_Id='" + sjsid + "'"
                    + " and (" + swhere + ")";
            stmp = (new DBUtil()).Get_Single_val(sql_).Trim();
            if (stmp != "")
                thistot = Convert.ToDouble(stmp);
            //
            FormCopySettleInvoiceAdd fcs = new FormCopySettleInvoiceAdd();
            fcs.sids = sids;
            fcs.type = "add";
            fcs.lx = "结算开票";
            fcs.totmoney = tot - thistot;
            fcs.custName = custname;
            fcs.ShowDialog();
        }
예제 #5
0
        private void button7_Click(object sender, EventArgs e)
        {
            string sql_ = "";
            string sids = "";   //结算表中的sysid,有多个
            string custname = "";
            double tot = 0;
            //选多次结算开票
                if (this.dgv_barg.SelectedRows.Count <= 0) return;

                string BarOrBid = "", Fday = "", Tday = "";
                for (int i = 0; i < this.dgv_barg.SelectedRows.Count; i++)
                {
                    //获取客户名
                    BarOrBid = this.dgv_barg.SelectedRows[i].Cells[0].Value.ToString().Trim();
                    custname = Get_CustName(BarOrBid);
                    //获取序列号
                    Fday = this.dgv_barg.SelectedRows[i].Cells[1].Value.ToString().Trim();
                    Tday = this.dgv_barg.SelectedRows[i].Cells[2].Value.ToString().Trim();
                    Fday = Convert.ToDateTime(Fday).ToString("yyyy-MM-dd");
                    Tday = Convert.ToDateTime(Tday).ToString("yyyy-MM-dd");
                    if (this.dgv_barg.SelectedRows[i].Cells[3].Value.ToString().Trim() != "")
                        tot = tot + Convert.ToDouble(this.dgv_barg.SelectedRows[i].Cells[3].Value.ToString().Trim());

                    sql_ = "select sysid from T_MacSettle where BargOrBd_id='" + BarOrBid + "'"
                        + " and Czfrom='" + Fday + "' and czto='" + Tday + "'";
                    DataTable dt = (new SqlDBConnect()).Get_Dt(sql_);
                    for (int m = 0; m < dt.Rows.Count; m++)
                    {
                        sids = dt.Rows[m]["sysid"].ToString().Trim() + ";" + sids;
                    }
                }
                FormCopySettleInvoiceAdd fcs = new FormCopySettleInvoiceAdd();
                fcs.sids = sids;
                fcs.type = "add";
                fcs.lx = "结算开票";
                fcs.totmoney = tot;
                fcs.custName = custname;

                if (fcs.ShowDialog() == DialogResult.OK)
                {
                    show_all_unKaiPiao();
                }
        }