Exemple #1
0
 public bool IsSubmitValid()
 {
     if (this.VATRateDDL.SelectedValue != "0") {
         MasterData.VatTypeRow VATRate = new MasterDataBLL().GetVatTypeById(int.Parse(this.VATRateDDL.SelectedValue))[0];
         if (VATRate.HasTax && (this.AMTTaxCtl.Text == string.Empty || this.AMTTaxCtl.Text == "0")) {
             PageUtility.ShowModelDlg(this.Page, "请录入税金!", "please key in tax amount");
             return false;
         }
     } else {
         PageUtility.ShowModelDlg(this.Page, "请选择税率类型!", "please select VAT Rate");
         return false;
     }
     if (this.AmountCtl.Text == string.Empty) {
         PageUtility.ShowModelDlg(this.Page, "请录入本次支付金额!", "please key in payment amount");
         return false;
     }
     if (this.UCExpectPaymentDateCtl.SelectedDate == "") {
         PageUtility.ShowModelDlg(this.Page, "请录入期望支付日期!", "please key in expect payment date ");
         return false;
     }
     //判断是否录入了发票
     MasterData.InvoiceStatusRow row = new InvoiceStatusTableAdapter().GetDataByID(int.Parse(this.InvoiceStatusDDL.SelectedValue))[0];
     if (row.NeedInvoice) {
         if (this.gvInvoice.Rows.Count == 0) {
             PageUtility.ShowModelDlg(this.Page, "请录入发票信息!", "please key in invoice info");
             return false;
         } else {
             decimal AmountRMB = decimal.Round(decimal.Parse(this.ViewState["ExchangeRate"].ToString()) * decimal.Parse(this.AmountCtl.Text), 2);
             if (decimal.Parse(this.ViewState["InvoiceFeeTotal"].ToString()) < AmountRMB) {
                 PageUtility.ShowModelDlg(this.Page, "发票金额不得小于支付金额!", "the amount of invoice should not be less than the payment");
                 return false;
             }
         }
     }
     if (string.IsNullOrEmpty(RemarkCtl.Text)) {
         PageUtility.ShowModelDlg(this.Page, "请录入备注!", "please key in remark ");
         return false;
     }
     return true;
 }
Exemple #2
0
    protected void SaveRDPayment(SystemEnums.FormStatus StatusID)
    {
        this.FormRDBLL.FormDataSet = this.InnerDS;
        if (FillDetail(StatusID)) {
            int? RejectedFormID = null;
            if (this.ViewState["RejectedObjectID"] != null) {
                RejectedFormID = (int)this.ViewState["RejectedObjectID"];
            }

            int UserID = (int)this.ViewState["StuffUserID"];
            int? ProxyStuffUserId = null;
            if (Session["ProxyStuffUserId"] != null) {
                ProxyStuffUserId = int.Parse(Session["ProxyStuffUserId"].ToString());
            }
            int OrganizationUnitID = (int)this.ViewState["DepartmentID"];
            int PositionID = (int)this.ViewState["PositionID"];

            int FormRDApplyID = int.Parse(this.ViewState["FormRDApplyID"].ToString());
            FormDS.FormRow formRow = FormRDBLL.GetFormByID(FormRDApplyID)[0];
            if (formRow.StatusID != 2) {
                PageUtility.ShowModelDlg(this, "不能提交,对应的方案申请单不是审批完成状态!");
                return;
            }

            int InvoiceStatusID = int.Parse(this.InvoiceStatusDDL.SelectedValue);
            int PaymentTypeID = int.Parse(this.PaymentTypeDDL.SelectedValue);
            string Remark = this.RemarkCtl.Text;
            int? VATTypeID = null;
            if (this.VATTypeDDL.SelectedValue != "0") {
                VATTypeID = int.Parse(this.VATTypeDDL.SelectedValue);
            }

            //判断是否录入了发票
            if (StatusID == SystemEnums.FormStatus.Awaiting) {//提交时检查,保存草稿不检查
                MasterData.InvoiceStatusRow row = new InvoiceStatusTableAdapter().GetDataByID(int.Parse(this.InvoiceStatusDDL.SelectedValue))[0];
                if (row.NeedInvoice) {
                    if (this.gvInvoice.Rows.Count == 0) {
                        PageUtility.ShowModelDlg(this.Page, "请录入发票信息!", "please key in invoice info");
                        return;
                    } else {
                        decimal AmountRMB = decimal.Parse(this.ViewState["AmountRMBTotal"].ToString());
                        if (decimal.Parse(this.ViewState["InvoiceFeeTotal"].ToString()) < AmountRMB) {
                            PageUtility.ShowModelDlg(this.Page, "发票金额不得小于支付金额!", "the amount of invoice should not be less than the payment");
                            return;
                        }
                    }
                }
            }

            //PO
            int FormPOID = 0;
            int.TryParse(this.UCPO.FormID, out FormPOID);
            if (StatusID == SystemEnums.FormStatus.Awaiting && (bool)this.ViewState["NeedPO"] == true && decimal.Parse(this.ViewState["AmountRMBTotal"].ToString()) > 5000 && FormPOID <= 0) {
                PageUtility.ShowModelDlg(this, "请选择PO");
                return;
            }

            try {
                if (this.ViewState["ObjectId"] == null || RejectedFormID != null) {
                    this.FormRDBLL.AddRDPayment(RejectedFormID, UserID, ProxyStuffUserId, null, OrganizationUnitID, PositionID, SystemEnums.FormType.RDPayment, StatusID,
                            SystemEnums.PageType.RDPayment, FormRDApplyID, InvoiceStatusID, PaymentTypeID, this.UCFliePayment.AttachmentFileName, this.UCFliePayment.RealAttachmentFileName, Remark, int.Parse(this.ViewState["CostCenterID"].ToString()), VATTypeID, FormPOID);
                } else {
                    int FormID = (int)this.ViewState["ObjectId"];
                    this.FormRDBLL.UpdateRDPayment(FormID, SystemEnums.FormType.RDPayment, StatusID, InvoiceStatusID, PaymentTypeID, this.UCFliePayment.AttachmentFileName, this.UCFliePayment.RealAttachmentFileName, Remark, VATTypeID, FormPOID);
                }
                this.Page.Response.Redirect("~/Home.aspx");
            } catch (Exception ex) {
                PageUtility.DealWithException(this.Page, ex);
            }
        }
    }
    protected void SaveSalePayment(SystemEnums.FormStatus StatusID)
    {
        this.FormSaleBLL.FormDataSet = this.InnerDS;
        if (FillDetail(StatusID)) {
            int? RejectedFormID = null;
            if (this.ViewState["RejectedObjectID"] != null) {
                RejectedFormID = (int)this.ViewState["RejectedObjectID"];
            }

            int UserID = (int)this.ViewState["StuffUserID"];
            int? ProxyStuffUserId = null;
            if (Session["ProxyStuffUserId"] != null) {
                ProxyStuffUserId = int.Parse(Session["ProxyStuffUserId"].ToString());
            }
            int OrganizationUnitID = (int)this.ViewState["DepartmentID"];
            int PositionID = (int)this.ViewState["PositionID"];
            int FormSaleApplyID = int.Parse(this.ViewState["FormSaleApplyID"].ToString());
            int InvoiceStatusID = int.Parse(this.InvoiceStatusDDL.SelectedValue);
            int PaymentTypeID = (int)SystemEnums.PaymentType.Cash;
            string Remark = this.RemarkCtl.Text;
            string AttachedFileName = this.UCPaymentFile.AttachmentFileName;
            string RealAttachedFileName = this.UCPaymentFile.RealAttachmentFileName;
            int? VendorID = null;
            if (this.UCVendor.VendorID != string.Empty) {
                VendorID = int.Parse(this.UCVendor.VendorID);
            }
            int? VATTypeID = null;
            if (this.VATTypeDDL.SelectedValue != "0") {
                VATTypeID = int.Parse(this.VATTypeDDL.SelectedValue);
            }

            if (StatusID == SystemEnums.FormStatus.Awaiting) {//提交时检查,保存草稿不检查
                //vendor
                if (this.UCVendor.VendorID == string.Empty && PaymentTypeID != (int)SystemEnums.PaymentType.Transfer) {
                    PageUtility.ShowModelDlg(this.Page, "请选择供应商!", "please select vendor");
                    return;
                }
                //判断是否录入了发票
                MasterData.InvoiceStatusRow row = new InvoiceStatusTableAdapter().GetDataByID(int.Parse(this.InvoiceStatusDDL.SelectedValue))[0];
                if (row.NeedInvoice) {
                    if (this.gvInvoice.Rows.Count == 0) {
                        PageUtility.ShowModelDlg(this.Page, "请录入发票信息!", "please key in invoice info");
                        return;
                    } else {
                        decimal AmountRMB = decimal.Parse(this.ViewState["AmountRMBTotal"].ToString());
                        if (decimal.Parse(this.ViewState["InvoiceFeeTotal"].ToString()) < AmountRMB) {
                            PageUtility.ShowModelDlg(this.Page, "发票金额不得小于支付金额!", "the amount of invoice should not be less than the payment");
                            return;
                        }
                    }
                }
                //再检查一遍有没有结案过
                string SettledFormNo = this.FormSaleBLL.GetSettledFormNoByApplyFormIds(FormSaleApplyID.ToString());
                if (SettledFormNo != "") {
                    PageUtility.ShowModelDlg(this.Page, "申请单已经被结案过,结案单编号为:" + SettledFormNo);
                    return;
                }
                //检查申请单是否有作废
                if (this.FormSaleBLL.GetFormByID(FormSaleApplyID)[0].StatusID != (int)SystemEnums.FormStatus.ApproveCompleted) {
                    PageUtility.ShowModelDlg(this.Page, "申请单已经作废,不能提交,请删除!");
                    return;
                }
            }

            //PO
            int FormPOID = 0;
            int.TryParse(this.UCPO.FormID, out FormPOID);
            if (StatusID == SystemEnums.FormStatus.Awaiting && (bool)this.ViewState["NeedPO"] == true && decimal.Parse(this.ViewState["AmountRMBTotal"].ToString()) > 5000 && FormPOID <= 0) {
                PageUtility.ShowModelDlg(this, "请选择PO");
                return;
            }

            try {
                if (this.ViewState["ObjectId"] == null || RejectedFormID != null) {
                    this.FormSaleBLL.AddAdvancedPayment(RejectedFormID, UserID, ProxyStuffUserId, null, OrganizationUnitID, PositionID, SystemEnums.FormType.SaleAdvancedPayment, StatusID,
                            SystemEnums.PageType.NoActivityAdvancedPayment, FormSaleApplyID, InvoiceStatusID, PaymentTypeID, Remark, AttachedFileName, RealAttachedFileName, int.Parse(this.ViewState["CostCenterID"].ToString()), VendorID, FormPOID, VATTypeID);
                } else {
                    int FormID = (int)this.ViewState["ObjectId"];
                    this.FormSaleBLL.UpdateAdvancedPayment(FormID, SystemEnums.FormType.SaleAdvancedPayment, StatusID, InvoiceStatusID, PaymentTypeID, Remark, AttachedFileName, RealAttachedFileName, VendorID, FormPOID, VATTypeID);
                }
                this.Page.Response.Redirect("~/Home.aspx");
            } catch (Exception ex) {
                PageUtility.DealWithException(this.Page, ex);
            }
        }
    }
Exemple #4
0
    public bool IsSubmitValid()
    {
        if (this.VATRateDDL.SelectedValue != "0") {
            MasterData.VatTypeRow VATRate = new MasterDataBLL().GetVatTypeById(int.Parse(this.VATRateDDL.SelectedValue))[0];
            if (VATRate.HasTax && (this.AMTTaxCtl.Text == string.Empty || this.AMTTaxCtl.Text == "0")) {
                PageUtility.ShowModelDlg(this.Page, "请录入税金!", "please key in tax amount");
                return false;
            }
            if (!VATRate.HasTax && this.AMTTaxCtl.Text != string.Empty && this.AMTTaxCtl.Text != "0") {
                PageUtility.ShowModelDlg(this.Page, "您选择的税率类型没有税金!", "there is no tax regarding the VAT rate you selected");
                return false;
            }
        } else {
            PageUtility.ShowModelDlg(this.Page, "请选择税率类型!", "please select VAT Rate");
            return false;
        }
        if (this.UCExpectPaymentDateCtl.SelectedDate == "") {
            PageUtility.ShowModelDlg(this.Page, "请录入期望支付日期!", "please key in expect payment date ");
            return false;
        }

        if (this.gvDetails.Rows.Count == 0) {
            PageUtility.ShowModelDlg(this.Page, "必须录入费用明细信息","please key in detail info");
            return false;
        }
        //判断是否录入了发票
        MasterData.InvoiceStatusRow row = new InvoiceStatusTableAdapter().GetDataByID(int.Parse(this.InvoiceStatusDDL.SelectedValue))[0];
        if (row.NeedInvoice) {
            if (this.gvInvoice.Rows.Count == 0) {
                PageUtility.ShowModelDlg(this.Page, "请录入发票信息!", "please key in invoice info");
                return false;
            } else {
                if (decimal.Parse(this.ViewState["InvoiceFeeTotal"].ToString()) < decimal.Parse(this.ViewState["TotalApplyAmount"].ToString())) {
                    PageUtility.ShowModelDlg(this.Page, "发票金额不得小于支付金额!", "the amount of invoice should not be less than the payment");
                    return false;
                }
            }
        }
        if (this.PaymentTermCtl.Text == string.Empty) {
            PageUtility.ShowModelDlg(this.Page, "请录入账期!", "please key in payment terms");
            return false;
        }
        if (string.IsNullOrEmpty(this.RemarkCtl.Text)) {
            PageUtility.ShowModelDlg(this.Page, "请录入备注!", "please key in remark");
            return false;
        }
        return true;
    }