Beispiel #1
0
        protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string strMsg = string.Empty;

            if (e.CommandName == "cmdEdit")
            {
                Response.Redirect("SaleBill.aspx?SbillIdno=" + e.CommandArgument, true);
            }
            else if (e.CommandName == "cmddelete")
            {
                objSaleBillDAL = new SaleBillDAL();
                long intValue = objSaleBillDAL.Delete(Convert.ToInt32(e.CommandArgument));
                objSaleBillDAL = null;
                if (intValue > 0)
                {
                    this.BindGrid();
                    strMsg = "Record deleted successfully.";
                    ddlDateRange.Focus();
                }
                else
                {
                    if (intValue == -1)
                    {
                        strMsg = "Record can not be deleted. It is in use!";
                    }
                    else
                    {
                        strMsg = "Record not deleted.";
                    }
                }
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true);
            }
        }
Beispiel #2
0
 private void toolBtnSave_Click(object sender, EventArgs e)
 {
     try
     {
         if (MessageManager.ShowMsgBox("INP-272307") == DialogResult.OK)
         {
             List <SaleBill> afterbill = new List <SaleBill> {
                 this.mergedBill
             };
             string str = new SaleBillDAL().SaveToRealTable(this.listBill, afterbill, this.mergedBill.BH);
             if (str == "0")
             {
                 MessageManager.ShowMsgBox("INP-272308");
                 base.Close();
             }
             else if (str.StartsWith("从预览表转正存库Fail:   System.Data.SQLite.SQLiteException (0x80004005): constraint failed\r\nUNIQUE constraint failed: XSDJ_MX.XSDJBH, XSDJ_MX.XH\r\n"))
             {
                 MessageManager.ShowMsgBox("合并后的单据号和原始单据号有重复,请删除原始单据,重新进行合并!\r\n单据合并未能完成,确定后将退出此界面");
                 base.Close();
             }
             else
             {
                 MessageBoxHelper.Show(str);
             }
         }
     }
     catch (Exception exception)
     {
         HandleException.HandleError(exception);
     }
 }
Beispiel #3
0
        public void Countall()
        {
            objSaleBillDAL = new SaleBillDAL();
            Int64 count = objSaleBillDAL.Count();

            objSaleBillDAL = null;
            if (count > 0)
            {
                lblTotalRecord.Text = "T. Record (s):" + count;
            }
            else
            {
                lblTotalRecord.Text = "T. Record (s): 0 ";
            }
        }
Beispiel #4
0
        private void BindGrid()
        {
            objSaleBillDAL = new SaleBillDAL();
            DateTime?datefromValue = null;
            DateTime?dateToValue   = null;
            Int64    yearIDNO      = string.IsNullOrEmpty(Convert.ToString(ddlDateRange.SelectedValue)) ? 0 : Convert.ToInt64(ddlDateRange.SelectedValue);
            Int64    BillNo        = string.IsNullOrEmpty(Convert.ToString(txtBillNo.Text)) ? 0 : Convert.ToInt64(txtBillNo.Text);
            Int64    BillType      = string.IsNullOrEmpty(Convert.ToString(ddlBillType.SelectedValue)) ? 0 : Convert.ToInt64(ddlBillType.SelectedValue);
            Int64    CityFrom      = string.IsNullOrEmpty(Convert.ToString(ddlFromCity.SelectedValue)) ? 0 : Convert.ToInt64(ddlFromCity.SelectedValue);
            Int64    Party         = string.IsNullOrEmpty(Convert.ToString(ddlPartyName.SelectedValue)) ? 0 : Convert.ToInt64(ddlPartyName.SelectedValue);

            if (string.IsNullOrEmpty(Convert.ToString(txtBillDateFrom.Text)) == false)
            {
                datefromValue = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtBillDateFrom.Text));
            }
            if (string.IsNullOrEmpty(Convert.ToString(txtBillDateTo.Text)) == false)
            {
                dateToValue = Convert.ToDateTime(ApplicationFunction.mmddyyyy(txtBillDateTo.Text));
            }
            var lstGridData = objSaleBillDAL.SelectForSearch(yearIDNO, datefromValue, dateToValue, txtprefNo.Text, BillNo, CityFrom, BillType, Party);

            objSaleBillDAL = null;
            if (lstGridData != null && lstGridData.Count > 0)
            {
                grdMain.DataSource = lstGridData;
                grdMain.DataBind();
                lblTotalRecord.Text = "T. Record (s): " + lstGridData.Count;
                imgBtnExcel.Visible = true;
                int startRowOnPage = (grdMain.PageIndex * grdMain.PageSize) + 1;
                int lastRowOnPage  = startRowOnPage + grdMain.Rows.Count - 1;
                lblcontant.Text    = "Showing " + startRowOnPage.ToString() + " - " + lastRowOnPage.ToString() + " of " + lstGridData.Count.ToString();
                lblcontant.Visible = true;
                divpaging.Visible  = true;
            }
            else
            {
                grdMain.DataSource = null;
                grdMain.DataBind();
                lblTotalRecord.Text = "T. Record (s): 0 ";
                imgBtnExcel.Visible = false;
                lblcontant.Visible  = false;
                divpaging.Visible   = false;
            }
        }
Beispiel #5
0
        protected void grdMain_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                LinkButton lnkbtnDelete = (LinkButton)e.Row.FindControl("lnkbtnDelete");
                Int64      intSbillIdno = Convert.ToInt64(DataBinder.Eval(e.Row.DataItem, "SbillHeadIdno"));

                if (intSbillIdno > 0)
                {
                    objSaleBillDAL = new SaleBillDAL();
                    var SbillExist = objSaleBillDAL.CheckClaimExists(Convert.ToInt64(intSbillIdno));
                    objSaleBillDAL = null;
                    if (SbillExist != null && SbillExist > 0)
                    {
                        lnkbtnDelete.Visible = false;
                    }
                    else
                    {
                        lnkbtnDelete.Visible = true;
                    }
                }
            }
        }
        private void toolStripBtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.aisinoDataGrid1.get_SelectedRows().Count == 0)
                {
                    MessageManager.ShowMsgBox("INP-272502");
                }
                else if (this.aisinoDataGrid3.get_Rows().Count == 0)
                {
                    MessageManager.ShowMsgBox("INP-272506");
                }
                else if (MessageManager.ShowMsgBox("INP-272503") != DialogResult.Cancel)
                {
                    int    num2;
                    string str = "";
                    double num = 0.0;
                    for (num2 = 0; num2 < this.bill.ListGoods.Count; num2++)
                    {
                        int    num7;
                        Goods  goods = this.bill.ListGoods[num2];
                        double round = 0.0;
                        double num4  = 0.0;
                        if (goods.DJHXZ == 4)
                        {
                            continue;
                        }
                        if (this.bill.HYSY && (goods.SLV == 0.05))
                        {
                            round = SaleBillCtrl.GetRound((double)(((goods.JE / 0.95) * 0.05) - goods.SE), 2);
                            if (Math.Abs(round) > 0.06)
                            {
                                num7 = num2 + 1;
                                str  = "第" + num7.ToString() + "行,含税金额乘以税率减税额的绝对值大于0.06,不能进行折扣汇总";
                            }
                            else
                            {
                                if ((goods.DJ == 0.0) || (goods.SL == 0.0))
                                {
                                    goto Label_0544;
                                }
                                num4 = Math.Abs(SaleBillCtrl.GetRound((double)(((goods.DJ * goods.SL) - goods.JE) - goods.SE), 2));
                                if (goods.HSJBZ)
                                {
                                    if (num4 > 0.01)
                                    {
                                        num7 = num2 + 1;
                                        str  = "第" + num7.ToString() + "行,单价乘以数量不等于含税金额,不能进行折扣汇总";
                                        break;
                                    }
                                    goto Label_0544;
                                }
                                num7 = num2 + 1;
                                str  = "第" + num7.ToString() + "行,单价乘以数量不等于含税金额,不能进行折扣汇总";
                            }
                            break;
                        }
                        if (this.bill.JZ_50_15 && (goods.SLV == 0.015))
                        {
                            round = SaleBillCtrl.GetRound((double)(((goods.JE / 1.035) * 0.015) - goods.SE), 2);
                            if (Math.Abs(round) > 0.06)
                            {
                                num7 = num2 + 1;
                                str  = "第" + num7.ToString() + "行,金额与税率税额计算后误差的绝对值大于0.06,不能进行折扣汇总";
                                break;
                            }
                            if ((goods.DJ != 0.0) && (goods.SL != 0.0))
                            {
                                if (goods.HSJBZ)
                                {
                                    if (Math.Abs(SaleBillCtrl.GetRound((double)(((goods.DJ * goods.SL) - goods.JE) - goods.SE), 2)) > 0.01)
                                    {
                                        num7 = num2 + 1;
                                        str  = "第" + num7.ToString() + "行,单价乘以数量不等于含税金额,不能进行折扣汇总";
                                        break;
                                    }
                                }
                                else if (Math.Abs(SaleBillCtrl.GetRound((double)((goods.DJ * goods.SL) - goods.JE), 2)) > 0.01)
                                {
                                    num7 = num2 + 1;
                                    str  = "第" + num7.ToString() + "行,单价乘以数量不等于金额,不能进行折扣汇总";
                                    break;
                                }
                            }
                        }
                        else
                        {
                            round = SaleBillCtrl.GetRound((double)((goods.JE * goods.SLV) - goods.SE), 2);
                            if (Math.Abs(round) > 0.06)
                            {
                                num7 = num2 + 1;
                                str  = "第" + num7.ToString() + "行,金额乘以税率减税额的绝对值大于0.06,不能进行折扣汇总";
                                break;
                            }
                            if ((goods.DJ != 0.0) && (goods.SL != 0.0))
                            {
                                if (goods.HSJBZ)
                                {
                                    if (Math.Abs(SaleBillCtrl.GetRound((double)(((goods.DJ * goods.SL) - goods.JE) - goods.SE), 2)) > 0.01)
                                    {
                                        num7 = num2 + 1;
                                        str  = "第" + num7.ToString() + "行,单价乘以数量不等于含税金额,不能进行折扣汇总";
                                        break;
                                    }
                                }
                                else if (Math.Abs(SaleBillCtrl.GetRound((double)((goods.DJ * goods.SL) - goods.JE), 2)) > 0.01)
                                {
                                    str = "第" + ((num2 + 1)).ToString() + "行,单价乘以数量不等于金额,不能进行折扣汇总";
                                    break;
                                }
                            }
                        }
Label_0544:
                        num += round;
                    }
                    if (str.Length > 0)
                    {
                        MessageManager.ShowMsgBox(str);
                    }
                    else
                    {
                        if (Math.Abs(SaleBillCtrl.GetRound(num, 2)) > 1.27)
                        {
                            str = "单据税额误差累计值大于1.27,不能进行折扣汇总";
                        }
                        if (str.Length > 0)
                        {
                            MessageManager.ShowMsgBox(str);
                        }
                        else
                        {
                            string str2 = new SaleBillDAL().SaveCollectDiscountToRealTable(this.bill);
                            if (str2 == "0")
                            {
                                string dJMonth = this.comboBoxYF.SelectedItem.ToString();
                                string dJType  = this.comboBoxDJZL.SelectedValue.ToString();
                                string keyWord = this.GetKeyWord();
                                int    key     = this.GetKey();
                                this.aisinoDataGrid1.set_DataSource(this.hzBLL.QueryXSDJ(dJMonth, dJType, keyWord, this.hzBLL.Pagesize, this.hzBLL.CurrentPage, key));
                                this.SelectedBH = "NoExist";
                                this.aisinoDataGrid2.set_DataSource(this.hzBLL.QueryXSDJMX("NoExist", this.hzBLL.Pagesize, 1));
                                this.aisinoDataGrid3.set_DataSource(this.hzBLL.QueryXSDJMX("NoExist", this.hzBLL.Pagesize, 1));
                                int count = this.aisinoDataGrid2.get_Rows().Count;
                                for (num2 = 0; num2 < count; num2++)
                                {
                                    string str6 = this.aisinoDataGrid2.get_Rows()[num2].Cells["SLV"].Value.ToString();
                                    string str7 = this.aisinoDataGrid2.get_Rows()[num2].Cells["XH"].Value.ToString();
                                    if (((str6 != null) && (str6 != "")) && (str6 != "中外合作油气田"))
                                    {
                                        string str8 = this.billBL.ShowSLV(this.bill, str7, str6);
                                        if (str8 != "")
                                        {
                                            this.aisinoDataGrid2.get_Rows()[num2].Cells["SLV"].Value = str8;
                                        }
                                    }
                                }
                                MessageManager.ShowMsgBox("INP-272504");
                            }
                            else if (str2 == "NoBH")
                            {
                                MessageManager.ShowMsgBox("INP-272505");
                            }
                            else
                            {
                                MessageBoxHelper.Show(str2);
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                HandleException.HandleError(exception);
            }
        }