Ejemplo n.º 1
0
    protected void btnUnLock_Click(object sender, EventArgs e)
    {
        FormPurchaseBLL formbll = new FormPurchaseBLL();

        for (int i = 0; i < gvApplyList.Rows.Count; i++)
        {
            int formId =Convert.ToInt32(gvApplyList.DataKeys[i].Value);
            CheckBox cbIsUnLock = (CheckBox)gvApplyList.Rows[i].FindControl("cbIsUnLock");
            if (cbIsUnLock.Checked)
            {
                PurchaseDS.FormDataTable l_dtform = formbll.GetFormByID(formId);
                if (l_dtform.Rows.Count > 0)
                {
                    l_dtform[0].IsExportLock = false;
                    formbll.TAForm.Update(l_dtform);
                }
            }
        }
        this.gvApplyList.DataBind();
    }
Ejemplo n.º 2
0
    protected void CreateBtn_Click(object sender, EventArgs e)
    {
        string strFormID = string.Empty;
        string strFormNo = string.Empty;
        bool isSameCustID = true;
        bool isSameBrandID = true;
        bool isSameYear = true;
        bool isSameSubCategoryID = true;
        bool isSameCurrencyID = true;
        bool isSameCostCenter = true;
        int custID = 0;
        int brandID = 0;
        int year = 0;
        int subCategoryID = 0;
        int currencyID = 0;
        int pageType = 0;
        decimal NeedCreatePOAmount = Convert.ToDecimal(ConfigurationManager.AppSettings["NeedCreatePOAmount"]);
        int costCenterID = 0;
        String NeedPOFormNo = string.Empty;

        MasterDataBLL masterBLL = new MasterDataBLL();
        FormPurchaseBLL purchaseBLL = new FormPurchaseBLL();
        string intFormID = string.Empty;
        foreach (GridViewRow row in this.gvApplyList.Rows) {
            CheckBox CheckCtl = (CheckBox)row.FindControl("CheckCtl");
            if (CheckCtl.Checked) {
                QueryDS.FormSaleApplyViewRow formApply = new FormQueryBLL().GetFormSaleApplyViewByID((int)this.gvApplyList.DataKeys[row.RowIndex].Value);
                FormDS.FormRow form = new FormSaleBLL().GetFormByID((int)this.gvApplyList.DataKeys[row.RowIndex].Value)[0];
                intFormID = formApply.FormID.ToString();
                pageType = formApply.PageType;
                if (custID == 0) {
                    custID = formApply.CustomerID;
                } else {
                    if (custID != formApply.CustomerID) {
                        isSameCustID = false;
                        break;
                    }
                }
                if (brandID == 0) {
                    brandID = formApply.BrandID;
                } else {
                    if (brandID != formApply.BrandID) {
                        isSameBrandID = false;
                        break;
                    }
                }
                if (year == 0) {
                    year = formApply.FPeriod.AddMonths(5).Year;
                } else {
                    if (year != formApply.FPeriod.AddMonths(5).Year) {
                        isSameYear = false;
                        break;
                    }
                }
                if (subCategoryID == 0) {
                    subCategoryID = formApply.ExpenseSubCategoryID;
                } else {
                    if (subCategoryID != formApply.ExpenseSubCategoryID) {
                        isSameSubCategoryID = false;
                        break;
                    }
                }
                if (currencyID == 0) {
                    currencyID = formApply.CurrencyID;
                } else {
                    if (currencyID != formApply.CurrencyID) {
                        isSameCurrencyID = false;
                        break;
                    }
                }
                if (strFormID == string.Empty) {
                    strFormID = this.gvApplyList.DataKeys[row.RowIndex].Value.ToString();
                } else {
                    strFormID = strFormID + "," + this.gvApplyList.DataKeys[row.RowIndex].Value.ToString();
                }
                if (strFormNo == string.Empty) {
                    strFormNo = "P" + form.FormNo + "P";
                } else {
                    strFormNo = strFormNo + "P" + form.FormNo + "P";
                }
                if (costCenterID == 0) {
                    costCenterID = formApply.CostCenterID;
                } else {
                    if (costCenterID != formApply.CostCenterID) {
                        isSameCostCenter = false;
                        break;
                    }
                }

                //�жϽ�����X����Ҫ�½�PO
                MasterData.ExpenseCategoryRow ecr = masterBLL.GetExpenseCategoryById(masterBLL.GetExpenseSubCategoryById(formApply.ExpenseSubCategoryID).ExpenseCategoryID);
                if (formApply.AmountRMB > NeedCreatePOAmount && ecr.NeedPO) {
                    if (purchaseBLL.QueryPOCountByParentFormID(formApply.FormID) <= 0) {
                        NeedPOFormNo += formApply.FormNo + ",";
                    }
                }
            }
        }

        if (strFormID == string.Empty) {
            PageUtility.ShowModelDlg(this, "��ѡ�����뵥!");
            return;
        }

        if (!isSameCustID) {
            PageUtility.ShowModelDlg(this, "��ѡ����ͬ�ͻ������뵥!");
            return;
        }
        if (!isSameBrandID) {
            PageUtility.ShowModelDlg(this, "��ѡ����ͬBrand�����뵥!");
            return;
        }
        if (!isSameYear) {
            PageUtility.ShowModelDlg(this, "��ѡ��ͬһ������뵥!");
            return;
        }
        if (!isSameSubCategoryID) {
            PageUtility.ShowModelDlg(this, "��ѡ��ͬһ����С������뵥!");
            return;
        }
        if (!isSameCurrencyID) {
            PageUtility.ShowModelDlg(this, "��ѡ��ͬһ���ֵ����뵥!");
            return;
        }
        if (!isSameCostCenter) {
            PageUtility.ShowModelDlg(this, "��ѡ��ͬһ�ɱ����ĵ����뵥!");
            return;
        }
        if (NeedPOFormNo != string.Empty) {
            PageUtility.ShowModelDlg(this, string.Format("���뵥{0}������{1}����Ҫ����PO��", NeedPOFormNo, NeedCreatePOAmount));
            return;
        }

        string url = string.Empty;

        if (pageType == (int)SystemEnums.PageType.ActivityApply) {
            if (this.ViewState["SearchCondition"] != null) {
                url = "~/FormSale/ActivitySettlementApply.aspx?FormApplyIds=" + strFormID +
                     "&CustomerID=" + custID.ToString() + "&BrandID=" + brandID.ToString() + "&ExpenseSubCategoryID=" + subCategoryID + "&CurrencyID=" + currencyID+"&CostCenterID="+costCenterID + "&FormApplyNos=" + strFormNo + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectList.aspx?" + this.ViewState["SearchCondition"].ToString());
            } else {
                url = "~/FormSale/ActivitySettlementApply.aspx?FormApplyIds=" + strFormID +
                     "&CustomerID=" + custID.ToString() + "&BrandID=" + brandID.ToString() + "&ExpenseSubCategoryID=" + subCategoryID + "&CurrencyID=" + currencyID + "&CostCenterID=" + costCenterID + "&FormApplyNos=" + strFormNo + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectList.aspx");
            }
        } else {
            if (this.ViewState["SearchCondition"] != null) {
                url = "~/FormSale/NoActivitySettlementApply.aspx?FormApplyIds=" + strFormID +
                     "&CustomerID=" + custID.ToString() + "&BrandID=" + brandID.ToString() + "&ExpenseSubCategoryID=" + subCategoryID + "&CurrencyID=" + currencyID + "&CostCenterID=" + costCenterID + "&FormApplyNos=" + strFormNo + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectList.aspx?" + this.ViewState["SearchCondition"].ToString());
            } else {
                url = "~/FormSale/NoActivitySettlementApply.aspx?FormApplyIds=" + strFormID +
                     "&CustomerID=" + custID.ToString() + "&BrandID=" + brandID.ToString() + "&ExpenseSubCategoryID=" + subCategoryID + "&CurrencyID=" + currencyID + "&CostCenterID=" + costCenterID + "&FormApplyNos=" + strFormNo + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectList.aspx");
            }
        }
        Response.Redirect(url);
    }
Ejemplo n.º 3
0
 public static string GetPOPostBackUrl(int FormID)
 {
     PurchaseDS.FormPORow rowPO = new FormPurchaseBLL().GetFormPOByID(FormID);
     string returnStr = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormPurchase/{0}?ShowDialog=1&ObjectId=" + FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
     switch (rowPO.POType) {
         case (int)SystemEnums.POType.Marketing:
         case (int)SystemEnums.POType.RD:
         case (int)SystemEnums.POType.Sale:
             returnStr = string.Format(returnStr, "POSpecialApproval.aspx");
             break;
         case (int)SystemEnums.POType.Purchase:
             returnStr = string.Format(returnStr, "POApproval.aspx");
             break;
     }
     return returnStr;
 }
Ejemplo n.º 4
0
        /// <summary>
        ///  销售
        /// </summary>
        /// <param name="FormID"></param>
        /// <returns></returns>
        private bool ExportSaleDataByFormID(int FormID, int logId)
        {
            ExportDataDS.ExportDataDataTable l_dtExportData = new ExportDataDS.ExportDataDataTable();
            FormDS.FormSalePaymentRow l_drFormSalePayment = new FormDS.FormSalePaymentDataTable().NewFormSalePaymentRow();
            FormMarketingBLL formmarkbll = new FormMarketingBLL();
            FormTEBLL formtebll = new FormTEBLL();
            FormSaleBLL formsalebll = new FormSaleBLL();
            MasterDataBLL masterdatabll = new MasterDataBLL();
            FormPurchaseBLL formPurchaseBLL = new FormPurchaseBLL();
            int Count = 0;
            FormDS.FormDataTable l_dtform = formmarkbll.GetFormByID(FormID);
            FormDS.FormRow l_drform = l_dtform.NewFormRow();
            try {
                if (l_dtform.Rows.Count > 0) {
                    l_drform = l_dtform[0];
                    if (l_drform.IsFinanceRemarkNull()) {
                        logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:财务摘要为空,导出失败!");
                        return false;
                    }
                    l_drFormSalePayment = formsalebll.GetFormSalePaymentByID(l_drform.FormID);
                    //if (l_drFormSalePayment.PaymentTypeID == (int)SystemEnums.PaymentType.FreeGoods)
                    //{
                    //    logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:货补的数据不导出!");
                    //    return false;
                    //}
                    //if (l_drFormSalePayment.PaymentTypeID == (int)SystemEnums.PaymentType.Transfer)
                    //{
                    //    logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:帐扣的数据不导入!");
                    //    return false;
                    //}
                    //if (l_drFormSalePayment.PaymentTypeID == (int)SystemEnums.PaymentType.PiaoKou)
                    //{
                    //    logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:票扣的数据不导入!");
                    //    return false;
                    //}
                    //if (l_drFormSalePayment.PaymentTypeID == 5)
                    //{
                    //    logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:调整因子的数据不导入!");
                    //    return false;
                    //}
                    FormDS.FormSalePaymentDetailDataTable l_dtFormSalePaymentDetail = formsalebll.GetFormSalePaymentDetailByPaymentID(FormID);
                    for (int i = 0; i < l_dtFormSalePaymentDetail.Rows.Count; i++) {
                        if (l_dtFormSalePaymentDetail[i].AmountRMB == Decimal.Zero) {
                            Count++;
                            continue;
                        }
                        //PurchaseDS.FormInvoiceDataTable l_dtFormInvoice = formPurchaseBLL.GetFormInvoiceByFormID(FormID);
                        ExportDataDS.ExportDataRow l_drExportData = l_dtExportData.NewExportDataRow();
                        l_drExportData.FormID = FormID;
                        l_drExportData.CompanyCode = l_drExportData.CompanyCode = masterdatabll.GetCompanyById(masterdatabll.GetVendorTypeById(masterdatabll.GetVendorByID(l_drFormSalePayment.VendorID).VendorTypeID).CompanyID).CompanyCode;
                        l_drExportData.VendorCode = masterdatabll.GetVendorByID(l_drFormSalePayment.VendorID).VendorCode;
                        if (l_drExportData.IsVendorCodeNull() || string.IsNullOrEmpty(l_drExportData.VendorCode)) {
                            logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:Vendor Code为空,无法导出!");
                            return false;
                        }
                        //发票号码改为单据编号,单据编号变为10位
                        l_drExportData.Invoice = l_drform.FormNo;
                        l_drExportData.Invoicedate = l_drform.SubmitDate.ToString("yyyyMMdd");

                        //if (l_dtFormInvoice.Rows.Count > 1)
                        //    l_drExportData.Reference = l_dtFormInvoice[1].InvoiceNo;
                        //if (l_dtFormInvoice.Rows.Count > 0) {
                        //    l_drExportData.Invoice = l_dtFormInvoice[0].InvoiceNo;
                        //    l_drExportData.Invoicedate = l_dtFormInvoice[0].InvoiceDate.ToString("yyyyMMdd");
                        //} else {
                        //    l_drExportData.Invoice = l_drform.FormNo;
                        //    l_drExportData.Invoicedate = l_drform.SubmitDate.ToString("yyyyMMdd");
                        //}

                        l_drExportData.TotalMoney = l_drFormSalePayment.AmountBeforeTax;
                        //l_drExportData.Currency = masterdatabll.GetCurrencyByID(formsalebll.GetFormSaleApplyByID(l_dtFormSalePaymentDetail[i].FormSaleApplyID)[0].CurrencyID).CurrencyShortName;
                        //l_drExportData.ExchangeRate = formsalebll.GetFormSaleApplyByID(l_dtFormSalePaymentDetail[i].FormSaleApplyID)[0].ExchangeRate;
                        l_drExportData.ManageExpenseItem = masterdatabll.GetExpenseItemById(l_dtFormSalePaymentDetail[i].ExpenseItemID).ExpenseItemName;
                        //profit center取AccrualCode,如果没有报错
                        if (masterdatabll.GetCostCenterById(l_drform.CostCenterID).IsAccrualCodeNull()) {
                            logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:Profit Center Accrual Code为空,无法导出!");
                            return false;
                        } else {
                            l_drExportData.CostCenter = masterdatabll.GetCostCenterById(l_drform.CostCenterID).AccrualCode;
                        }

                        if (l_dtFormSalePaymentDetail[i].ApplyPeriod.AddMonths(5).Year == l_drform.SubmitDate.AddMonths(5).Year)
                            l_drExportData.AccountCode = masterdatabll.GetExpenseItemById(l_dtFormSalePaymentDetail[i].ExpenseItemID).AccrualAccountingCode;
                        else
                            l_drExportData.AccountCode = masterdatabll.GetExpenseItemById(l_dtFormSalePaymentDetail[i].ExpenseItemID).LastAccountingCode;

                        l_drExportData.DetailMoney = l_dtFormSalePaymentDetail[i].AmountBeforeTax;
                        //PO No 变为取报销单的PO的No
                        if (l_drFormSalePayment.IsFormPOIDNull()) {
                            //PurchaseDS.FormPODataTable formPO = formPurchaseBLL.GetFormPOByParentFormID(l_dtFormSalePaymentDetail[i].FormSaleApplyID);
                            //if (formPO.Rows.Count > 0) {
                            //    l_drExportData.PONumber = formPO[0].BPCSPONo;
                            //    PurchaseDS.FormPODetailDataTable formPODetail = formPurchaseBLL.GetPODetailByFormPOID(formPO[0].FormPOID);
                            //    l_drExportData.POLineNumber = formPODetail.Rows.Count.ToString();
                            //} else {
                            l_drExportData.PONumber = 0;
                            l_drExportData.POLineNumber = "0";
                            //}
                        } else {
                            //若已选PO,取所选PO信息
                            PurchaseDS.FormPORow formPO = formPurchaseBLL.GetFormPOByID(l_drFormSalePayment.FormPOID);
                            PurchaseDS.FormPODetailDataTable formPODetail = formPurchaseBLL.GetPODetailByFormPOID(l_drFormSalePayment.FormPOID);
                            l_drExportData.PONumber = formPO.BPCSPONo;
                            l_drExportData.POLineNumber = formPODetail.Count.ToString();
                        }

                        l_drExportData.FormNo = l_drform.FormNo;
                        l_drExportData.FinanceRemark = l_drform.FinanceRemark;
                        l_drExportData.TaxRateCode = masterdatabll.GetVatTypeById(l_drFormSalePayment.VatTypeID)[0].VatTypeName;
                        l_drExportData.TaxAmt = l_dtFormSalePaymentDetail[i].TaxAmount;
                        l_dtExportData.AddExportDataRow(l_drExportData);
                        Count++;
                    }
                    if (l_dtExportData.Rows.Count == 0) {
                        logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:无明细数据,无法导出!");
                        return false;
                    }
                    if (l_dtFormSalePaymentDetail.Rows.Count == Count)
                        ExportByFormView(l_dtExportData);
                    else {
                        logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:明细数据数量不一致,无法导出!");
                        return false;
                    }
                }
            } catch (Exception e) {

                logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:" + e.Message);
                return false;
            }
            return true;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// PV
        /// </summary>
        /// <param name="FormID"></param>
        /// <returns></returns>
        private bool ExportPVDataByFormID(int FormID, int logId)
        {
            ExportDataDS.ExportDataDataTable l_dtExportData = new ExportDataDS.ExportDataDataTable();
            PurchaseDS.FormPVDetailDataTable l_dtFormPVDetail = new PurchaseDS.FormPVDetailDataTable();
            PurchaseDS.FormPVRow l_drFormPV = new PurchaseDS.FormPVDataTable().NewFormPVRow();
            FormMarketingBLL formmarkbll = new FormMarketingBLL();
            FormPurchaseBLL formPurchaseBLL = new FormPurchaseBLL();
            MasterDataBLL masterdatabll = new MasterDataBLL();
            FormDS.FormDataTable l_dtform = formmarkbll.GetFormByID(FormID);
            FormDS.FormRow l_drform = l_dtform.NewFormRow();
            try {
                if (l_dtform.Rows.Count > 0) {
                    l_drform = l_dtform[0];
                    if (l_drform.IsFinanceRemarkNull()) {
                        logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:财务摘要为空,导出失败!");
                        return false;
                    }
                    l_drFormPV = formPurchaseBLL.GetFormPVByID(FormID);
                    //PurchaseDS.FormInvoiceDataTable l_dtFormInvoice = formPurchaseBLL.GetFormInvoiceByFormID(FormID);
                    ExportDataDS.ExportDataRow l_drExportData = l_dtExportData.NewExportDataRow();
                    l_drExportData.FormID = FormID;
                    l_drExportData.CompanyCode = masterdatabll.GetCompanyById(masterdatabll.GetVendorTypeById(masterdatabll.GetVendorByID(l_drFormPV.VendorID).VendorTypeID).CompanyID).CompanyCode;
                    //验证公司是否和成本中心对应的一致
                    string CCCompanyCode = masterdatabll.GetCompanyById(masterdatabll.GetCostCenterById(l_drform.CostCenterID).CompanyID).CompanyCode;
                    if (l_drExportData.CompanyCode != CCCompanyCode) {
                        logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:Company Code不一致,无法导出!");
                        return false;
                    }
                    l_drExportData.VendorCode = masterdatabll.GetVendorByID(l_drFormPV.VendorID).VendorCode;
                    if (l_drExportData.IsVendorCodeNull() || string.IsNullOrEmpty(l_drExportData.VendorCode)) {
                        logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:Vendor Code为空,无法导出!");
                        return false;
                    }
                    //发票号码改为单据编号,单据编号变为10位
                    l_drExportData.Invoice = l_drform.FormNo;
                    //l_drExportData.Invoicedate = l_drform.SubmitDate.ToString("yyyyMMdd");
                    l_drExportData.Invoicedate = getInvoiceDate(l_drform.FormID, l_drform.SubmitDate);

                    //if (l_dtFormInvoice.Rows.Count > 1)
                    //    l_drExportData.Reference = l_dtFormInvoice[1].InvoiceNo;
                    //if (l_dtFormInvoice.Rows.Count > 0) {
                    //    l_drExportData.Invoice = l_dtFormInvoice[0].InvoiceNo;
                    //    l_drExportData.Invoicedate = l_dtFormInvoice[0].InvoiceDate.ToString("yyyyMMdd");
                    //} else {
                    //    l_drExportData.Invoice = l_drform.FormNo;
                    //    l_drExportData.Invoicedate = l_drform.SubmitDate.ToString("yyyyMMdd");
                    //}
                    l_drExportData.TotalMoney = l_drFormPV.AMTBeforeTax;
                    //l_drExportData.Currency = masterdatabll.GetCurrencyByID(l_drFormPV.CurrencyID).CurrencyShortName;
                    //l_drExportData.ExchangeRate = l_drFormPV.ExchangeRate;
                    l_drExportData.ManageExpenseItem = masterdatabll.GetItemCategoryById(l_drFormPV.FinalItemCategoryID).AccountingName;
                    l_drExportData.CostCenter = masterdatabll.GetCostCenterById(l_drform.CostCenterID).CostCenterCode;
                    l_drExportData.AccountCode = masterdatabll.GetItemCategoryById(l_drFormPV.FinalItemCategoryID).AccountingCode;
                    l_drExportData.DetailMoney = l_drFormPV.AMTBeforeTax;
                    if (!l_drFormPV.IsFormPOIDNull()) {
                        PurchaseDS.FormPORow formPO = formPurchaseBLL.GetFormPOByID(l_drFormPV.FormPOID);
                        l_drExportData.PONumber = formPO.BPCSPONo;
                        PurchaseDS.FormPODetailDataTable formPODetail = formPurchaseBLL.GetPODetailByFormPOID(l_drFormPV.FormPOID);
                        l_drExportData.POLineNumber = formPODetail.Rows.Count.ToString();
                    } else {
                        l_drExportData.PONumber = 0;
                        l_drExportData.POLineNumber = "0";
                    }
                    l_drExportData.FinanceRemark = l_drform.FinanceRemark;
                    l_drExportData.FormNo = l_drform.FormNo;
                    l_drExportData.TaxAmt = l_drFormPV.AMTTax;
                    l_drExportData.TaxRateCode = masterdatabll.GetVatTypeById(l_drFormPV.VatRateID)[0].VatTypeName;
                    l_dtExportData.AddExportDataRow(l_drExportData);
                    if (l_dtExportData.Rows.Count == 0) {
                        logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:无明细数据,无法导出!");
                        return false;
                    }
                    ExportByFormView(l_dtExportData);
                }
            } catch (Exception e) {
                logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:" + e.Message);
                return false;
            }
            return true;
        }
Ejemplo n.º 6
0
        private bool ExportPO(int formid, int logId)
        {
            string BakPath = ConfigurationManager.AppSettings["ExportService.BakPath"];
            AuthorizationBLL authorizationbll = new AuthorizationBLL();
            MasterDataBLL masterdatabll = new MasterDataBLL();
            FormQueryBLL formQueryBLL = new FormQueryBLL();
            FormPurchaseBLL formPurchaseBLL = new FormPurchaseBLL();
            OUTreeBLL outreebll = new OUTreeBLL();
            PurchaseDS.FormDataTable l_dtform = new PurchaseDS.FormDataTable();
            PurchaseDS.FormRow form = l_dtform.NewFormRow();
            try {
                PurchaseDS.FormPORow formPO = formPurchaseBLL.GetFormPOByID(formid);

                PurchaseDS.FormPODetailDataTable formPODetail = formPurchaseBLL.GetPODetailByFormPOID(formPO.FormPOID);
                form = formPurchaseBLL.GetFormByID(formPO.FormPOID)[0];
                string POFileName = ConfigurationManager.AppSettings["ExportService.POFileName"];
                string POLineFileName = ConfigurationManager.AppSettings["ExportService.POLineFileName"];
                string spit = "\t";
                string CompanyCode = masterdatabll.GetCompanyById(masterdatabll.GetVendorTypeById(masterdatabll.GetVendorByID(formPO.VendorID).VendorTypeID).CompanyID).CompanyCode;
                string VendorCode = masterdatabll.GetVendorByID(formPO.VendorID).VendorCode;
                string POcontent = (
                   "PH" + spit +
                    "" + spit +
                   formPO.BPCSPONo + spit +
                    "0" + spit +
                    "" + spit +
                    "0" + spit +
                     CompanyCode + spit +
                    "" + spit +
                     CompanyCode + spit +
                    VendorCode + spit +
                    "0" + spit +
                    "4" + spit +
                    "" + spit +
                    masterdatabll.GetCompanyById(formPO.CompanyID).CompanyName + spit +
                    authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit +
                    bSubstring(formPO.DeliveryAddress, 30) + spit +
                    SpitAddress(formPO.DeliveryAddress, 60) + spit +
                    SpitAddress(formPO.DeliveryAddress, 90) + spit +
                    "" + spit +
                    "" + spit +
                    "" + spit +
                    form.SubmitDate.ToString("yyyyMMdd") + spit +
                    "0" + spit +
                    "0" + spit +
                    "0" + spit +
                    formPODetail[0].DeliveryDate.ToString("yyyyMMdd") + spit +
                    "0" + spit +
                    "0" + spit +
                    bSubstring(formPO.Remark, 30) + spit +
                    masterdatabll.GetPaymentTermById(masterdatabll.GetVendorByID(formPO.VendorID).PaymentTermID)[0].PaymentTermName + spit +
                    "1" + spit +
                    "" + spit +
                    outreebll.GetOrganizationUnitById(form.OrganizationUnitID).OrganizationUnitCode + spit +
                    masterdatabll.GetShippingTermById(formPO.ShippingTermID).ShippingTermCode + spit +
                    "" + spit +
                    masterdatabll.GetCurrencyByID(formPO.CurrencyID).CurrencyShortName + spit +
                    formPO.ExchangeRate + spit +
                    formPO.ExchangeRate + spit +
                    formPODetail.Rows.Count + spit +
                    formPO.ExchangeRate + spit +
                    authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit +
                    "" + spit +
                     authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit +
                   form.ApprovedDate.ToString("yyyyMMdd") + spit +
                    "" + spit +
                    "0" + spit +
                    "" + spit +
                    "0" + spit +
                    "" + spit +
                    "" + spit +
                    "" + spit +
                    "" + spit +
                    "").Replace("\r", "").Replace("\n", "");
                int order = 0;
                string[] PODetailcontent = new string[formPODetail.Rows.Count];
                foreach (PurchaseDS.FormPODetailRow l_drformPODetail in formPODetail) {
                    order++;
                    PODetailcontent[order - 1] = (
                        "PO" + spit +
                         formPO.BPCSPONo + spit +
                         order + spit +
                         l_drformPODetail.ItemCode.ToUpper() + spit +
                         VendorCode + spit +
                         l_drformPODetail.Quantity + spit +
                         l_drformPODetail.Quantity + spit +
                         l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                         "" + spit +
                         "0" + spit +
                         l_drformPODetail.AmountRMB.ToString() + spit +
                         "0" + spit +
                         "0" + spit +
                         "EA" + spit +
                         "0" + spit +
                         "" + spit +
                         "0" + spit +
                         "0" + spit +
                         "" + spit +
                         "" + spit +
                         "" + spit +
                         DateTime.Now.ToString("yyyyMMdd") + spit +
                         masterdatabll.GetPaymentTermById(masterdatabll.GetVendorByID(formPO.VendorID).PaymentTermID)[0].PaymentTermName + spit +
                         "" + spit +
                         "0" + spit +
                         "1" + spit +
                         "1" + spit +
                         "" + spit +
                         CompanyCode + spit +
                         "0" + spit +
                         "0" + spit +
                         "0" + spit +
                         "0" + spit +
                         l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                         "" + spit +
                         "0" + spit +
                         "0" + spit +
                         "" + spit +
                         masterdatabll.GetCurrencyByID(formPO.CurrencyID).CurrencyShortName + spit +
                         formPO.ExchangeRate + spit +
                         formPO.ExchangeRate + spit +
                         "0" + spit +
                         l_drformPODetail.AmountRMB.ToString() + spit +
                         "0" + spit +
                         "1" + spit +
                         "" + spit +
                          "0" + spit +
                         "0" + spit +
                         "0" + spit +
                        "" + spit +
                        "" + spit +
                        "" + spit +
                        "01" + spit +
                        "4" + spit +
                       masterdatabll.GetCompanyById(formPO.CompanyID).CompanyName + spit +//Ship To Company
                       authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit +
                        bSubstring(formPO.DeliveryAddress, 30) + spit +
                    SpitAddress(formPO.DeliveryAddress, 60) + spit +
                    SpitAddress(formPO.DeliveryAddress, 90) + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "0" + spit +
                       "0" + spit +
                       l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                       "0" + spit +
                       l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                       l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit +
                       "" + spit +
                       outreebll.GetOrganizationUnitById(form.OrganizationUnitID).OrganizationUnitCode + spit +
                       "" + spit +
                       "" + spit +
                       masterdatabll.GetCostCenterById(form.CostCenterID).CostCenterCode + spit +
                       l_drformPODetail.ItemCode.ToUpper() + spit +
                       l_drformPODetail.ItemDescription + spit +
                       "1" + spit +
                       "0" + spit +
                       "0" + spit +
                       "3" + spit +
                       "0" + spit +
                       "0" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       "" + spit +
                       l_drformPODetail.Quantity).Replace("\r", "").Replace("\n", ""); ;
                }

                File.AppendAllLines(path + POLineFileName, PODetailcontent, Encoding.Default);
                File.AppendAllLines(BakPath + DateTime.Now.ToString("yyyyMMddhhmmss") + POLineFileName, PODetailcontent, Encoding.Default);

                File.AppendAllText(path + POFileName, POcontent + "\r\n", Encoding.Default);
                File.AppendAllText(BakPath + DateTime.Now.ToString("yyyyMMddhhmmss") + POFileName, POcontent, Encoding.Default);

            } catch (Exception e) {
                logbll.InsertExportLogDetail(logId, "单据编号:" + form.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(form.UserID)[0].StuffName + ",错误信息:" + e.Message);
                return false;
            }
            return true;
        }
Ejemplo n.º 7
0
 private string getInvoiceDate(int FormID, DateTime SubmitDate)
 {
     FormPurchaseBLL formPurchaseBLL = new FormPurchaseBLL();
     //get PV Object
     PurchaseDS.FormPVRow l_drFormPV = formPurchaseBLL.GetFormPVByID(FormID);
     //如有发票,取最近发票日期
     if (l_drFormPV.InvoiceStatusID == 1) {
         //有发票
         //get Invoice ObjectList
         PurchaseDS.FormInvoiceDataTable l_dtFormInvoice = formPurchaseBLL.GetFormInvoiceByFormID(FormID);
         //获取付款申请单上最晚发票的日期,默认第一条发票信息,如大于一条,循环遍历最近发票日期
         DateTime invoiceTime = l_dtFormInvoice[0].InvoiceDate;
         //遍历发票日期
         for (int i = 0; i < l_dtFormInvoice.Rows.Count; i++) {
             for (int j = i + 1; j < l_dtFormInvoice.Rows.Count; j++) {
                 //发票日期比较
                 if (DateTime.Compare(l_dtFormInvoice[i].InvoiceDate, l_dtFormInvoice[j].InvoiceDate) > 0) {
                     //取到的最近日期和默认值或前一次最近日期比较
                     if (DateTime.Compare(l_dtFormInvoice[i].InvoiceDate, invoiceTime) > 0) {
                         //设置日期
                         invoiceTime = l_dtFormInvoice[i].InvoiceDate;
                     }
                 } else {
                     //取到的最近日期和默认值或前一次最近日期比较
                     if (DateTime.Compare(l_dtFormInvoice[j].InvoiceDate, invoiceTime) > 0) {
                         //设置日期
                         invoiceTime = l_dtFormInvoice[j].InvoiceDate;
                     }
                 }
             }
         }
         //发票日期
         TimeSpan invoiceDate = new TimeSpan(invoiceTime.Ticks);
         //提交日期
         TimeSpan _submitDate = new TimeSpan(SubmitDate.Ticks);
         //日期获取间隔天数
         int intervalDays = invoiceDate.Subtract(_submitDate).Duration().Days;
         if (intervalDays < 14) {
             //如未到14天,则为提交日期
             return invoiceTime.ToString("yyyyMMdd");
         } else {
             //如该付款申请单上最晚发票日期大于提交日期14天
             return SubmitDate.ToString("yyyyMMdd");
         }
     }
     return SubmitDate.ToString("yyyyMMdd");
 }
Ejemplo n.º 8
0
        private void ExportData()
        {
            string FileName = ConfigurationManager.AppSettings["ExportService.FileName"];
            string ExportHour = ConfigurationManager.AppSettings["ExportService.hour"];
            string BakPath = ConfigurationManager.AppSettings["ExportService.BakPath"];

            ExportDate = DateTime.Now;

            path = ConfigurationManager.AppSettings["ExportService.Path"].ToString();
            bool Export = true;
            if (Export) {
                FormRDBLL formrdbll = new FormRDBLL();
                FormPurchaseBLL formPurchaseBLL = new FormPurchaseBLL();
                FormQueryBLL formquerybll = new FormQueryBLL();
                FormMarketingBLL formmarkbll = new FormMarketingBLL();
                FormSaleBLL formsalebll = new FormSaleBLL();
                QueryDS.FormViewDataTable l_dtformview = formquerybll.GetPagedFormView(" Form.StatusID=2 and (Form.IsExportLock='false' or Form.IsExportLock is null) AND Form.FormTypeID=4 ", 0, Int32.MaxValue, "Form.SubmitDate");
                //个人
                int logId = logbll.InsertExportLog(1, FileName, 0, 0, 0, 0);
                int SuccessCount = 0;
                int FailCount = 0;
                int TotalCount = l_dtformview.Rows.Count;
                foreach (QueryDS.FormViewRow l_drformview in l_dtformview) {
                    if (ExportPersonalReimburseDataByFormID(l_drformview.FormID, logId)) {
                        UpdateFormbyID(l_drformview.FormID, true);
                        SuccessCount++;
                    } else {
                        UpdateFormbyID(l_drformview.FormID, false);
                        FailCount++;
                    }
                }
                logbll.UpdateExportLog(logId, TotalCount, SuccessCount, FailCount);

                //差旅费
                logId = logbll.InsertExportLog(2, FileName, 0, 0, 0, 0);
                SuccessCount = 0;
                FailCount = 0;
                l_dtformview = formquerybll.GetPagedFormView("Form.StatusID=2 and (Form.IsExportLock='false' or Form.IsExportLock is null) AND Form.FormTypeID =1 ", 0, Int32.MaxValue, "SubmitDate");
                TotalCount = l_dtformview.Rows.Count;
                foreach (QueryDS.FormViewRow l_drformview in l_dtformview) {
                    if (ExportTravelReimburseDataByFormID(l_drformview.FormID, logId)) {
                        UpdateFormbyID(l_drformview.FormID, true);
                        SuccessCount++;
                    } else {
                        UpdateFormbyID(l_drformview.FormID, false);
                        FailCount++;
                    }
                }
                logbll.UpdateExportLog(logId, TotalCount, SuccessCount, FailCount);

                //pv
                logId = logbll.InsertExportLog(3, FileName, 0, 0, 0, 0);
                SuccessCount = 0;
                FailCount = 0;
                l_dtformview = formquerybll.GetPagedFormView("Form.StatusID=2 and (Form.IsExportLock='false' or Form.IsExportLock is null) AND Form.FormTypeID =24 ", 0, Int32.MaxValue, "SubmitDate");
                TotalCount = l_dtformview.Rows.Count;
                foreach (QueryDS.FormViewRow l_drformview in l_dtformview) {
                    if (ExportPVDataByFormID(l_drformview.FormID, logId)) {
                        UpdateFormbyID(l_drformview.FormID, true);
                        SuccessCount++;
                    } else {
                        UpdateFormbyID(l_drformview.FormID, false);
                        FailCount++;
                    }
                }
                logbll.UpdateExportLog(logId, TotalCount, SuccessCount, FailCount);

                //sale
                logId = logbll.InsertExportLog(4, FileName, 0, 0, 0, 0);
                SuccessCount = 0;
                FailCount = 0;
                l_dtformview = formquerybll.GetPagedFormView("Form.StatusID=2 and (Form.IsExportLock='false' or Form.IsExportLock is null)  AND Form.FormTypeID in (13,14) and Form.FormID  in (select FormSalePaymentID from FormSalePayment where PaymentTypeID = 1)", 0, Int32.MaxValue, "SubmitDate");
                TotalCount = l_dtformview.Rows.Count;
                foreach (QueryDS.FormViewRow l_drformview in l_dtformview) {
                    if (ExportSaleDataByFormID(l_drformview.FormID, logId)) {
                        UpdateFormbyID(l_drformview.FormID, true);
                        SuccessCount++;
                    } else {
                        UpdateFormbyID(l_drformview.FormID, false);
                        FailCount++;
                    }
                }
                logbll.UpdateExportLog(logId, TotalCount, SuccessCount, FailCount);

                //market
                logId = logbll.InsertExportLog(5, FileName, 0, 0, 0, 0);
                SuccessCount = 0;
                FailCount = 0;
                l_dtformview = formquerybll.GetPagedFormView(" (Form.IsExportLock='false' or Form.IsExportLock is null)  AND Form.StatusID=2 AND Form.FormTypeID=42 AND  Form.FormID  in (select FormMarketingPaymentID from FormMarketingPayment where PaymentTypeID = 1)", 0, Int32.MaxValue, "SubmitDate");
                TotalCount = l_dtformview.Rows.Count;
                foreach (QueryDS.FormViewRow l_drformview in l_dtformview) {
                    if (ExportMarketingDataByFormID(l_drformview.FormID, logId)) {
                        UpdateFormbyID(l_drformview.FormID, true);
                        SuccessCount++;
                    } else {
                        UpdateFormbyID(l_drformview.FormID, false);
                        FailCount++;
                    }
                }
                logbll.UpdateExportLog(logId, TotalCount, SuccessCount, FailCount);

                //RD
                logId = logbll.InsertExportLog(6, FileName, 0, 0, 0, 0);
                SuccessCount = 0;
                FailCount = 0;
                l_dtformview = formquerybll.GetPagedFormView(" Form.StatusID=2 and (Form.IsExportLock='false' or Form.IsExportLock is null)  AND Form.FormTypeID=32 AND Form.FormID in (select FormRDPaymentID from FormRDPayment where PaymentTypeID = 1)", 0, Int32.MaxValue, "SubmitDate");
                TotalCount = l_dtformview.Rows.Count;
                foreach (QueryDS.FormViewRow l_drformview in l_dtformview) {
                    if (ExportRDDataByFormID(l_drformview.FormID, logId)) {
                        UpdateFormbyID(l_drformview.FormID, true);
                        SuccessCount++;
                    } else {
                        UpdateFormbyID(l_drformview.FormID, false);
                        FailCount++;
                    }
                }
                logbll.UpdateExportLog(logId, TotalCount, SuccessCount, FailCount);
                if (File.Exists(path + FileName)) {
                    File.Copy(path + FileName, BakPath + FileName.Split('.')[0] + DateTime.Now.ToString("yyyyMMdd") + "." + FileName.Split('.')[1], true);
                } else {
                    File.AppendAllText(path + FileName, "", Encoding.Default);
                }

                //Vendor
                FileName = ConfigurationManager.AppSettings["ExportService.VendorAVMFileName"];
                logId = logbll.InsertExportLog(8, FileName, 0, 0, 0, 0);
                SuccessCount = 0;
                FailCount = 0;
                MasterData.VendorDataTable tbVendor = new MasterDataBLL().GetVendorToExport();
                TotalCount = tbVendor.Rows.Count;
                foreach (MasterData.VendorRow vendor in tbVendor) {
                    if (ExportVendorAVM(vendor, logId)) {
                        SuccessCount++;
                    } else {
                        FailCount++;
                    }
                }
                logbll.UpdateExportLog(logId, TotalCount, SuccessCount, FailCount);
                if (File.Exists(path + FileName))
                    File.Copy(path + FileName, BakPath + FileName.Split('.')[0] + DateTime.Now.ToString("yyyyMMdd") + "." + FileName.Split('.')[1], true);
                else
                    File.AppendAllText(path + FileName, "", Encoding.Default);
                //Vendor
                FileName = ConfigurationManager.AppSettings["ExportService.VendorAVMXFileName"];
                logId = logbll.InsertExportLog(8, FileName, 0, 0, 0, 0);
                SuccessCount = 0;
                FailCount = 0;
                tbVendor = new MasterDataBLL().GetAllVendor();
                TotalCount = tbVendor.Rows.Count;
                foreach (MasterData.VendorRow vendor in tbVendor) {
                    if (ExportVendorAVMX(vendor, logId)) {
                        SuccessCount++;
                    } else {
                        FailCount++;
                    }
                }
                logbll.UpdateExportLog(logId, TotalCount, SuccessCount, FailCount);
                if (File.Exists(path + FileName))
                    File.Copy(path + FileName, BakPath + FileName.Split('.')[0] + DateTime.Now.ToString("yyyyMMdd") + "." + FileName.Split('.')[1], true);

                //PO
                string POFileName = ConfigurationManager.AppSettings["ExportService.POFileName"];
                string POLineFileName = ConfigurationManager.AppSettings["ExportService.POLineFileName"];
                logId = logbll.InsertExportLog(9, POFileName + " And " + POLineFileName, 0, 0, 0, 0);
                SuccessCount = 0;
                FailCount = 0;
                l_dtformview = formquerybll.GetPagedFormView(" Form.StatusID=2 and (Form.IsExportLock='false' or Form.IsExportLock is null)  AND Form.FormTypeID=23", 0, Int32.MaxValue, "SubmitDate");
                TotalCount = l_dtformview.Rows.Count;
                foreach (QueryDS.FormViewRow l_drformview in l_dtformview) {
                    PurchaseDS.FormPORow formPO = formPurchaseBLL.GetFormPOByID(l_drformview.FormID);
                    if (ExportPO(l_drformview.FormID, logId)) {
                        UpdateFormbyID(l_drformview.FormID, true);
                        SuccessCount++;
                    } else {
                        UpdateFormbyID(l_drformview.FormID, false);
                        FailCount++;
                    }
                }
                logbll.UpdateExportLog(logId, TotalCount, SuccessCount, FailCount);
                if (File.Exists(path + POFileName))
                    File.Copy(path + POFileName, BakPath + POFileName.Split('.')[0] + DateTime.Now.ToString("yyyyMMdd") + "." + POFileName.Split('.')[1], true);
                else
                    File.AppendAllText(path + POFileName, "", Encoding.Default);

                if (File.Exists(path + POLineFileName))
                    File.Copy(path + POLineFileName, BakPath + POLineFileName.Split('.')[0] + DateTime.Now.ToString("yyyyMMdd") + "." + POLineFileName.Split('.')[1], true);
                else
                    File.AppendAllText(path + POLineFileName, "", Encoding.Default);

            }
        }
Ejemplo n.º 9
0
 protected void gvApplyList_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "scrap") {
         int FormID = Int32.Parse(e.CommandArgument.ToString());
         FormDS.FormRow row = new FormTEBLL().GetFormByID(FormID)[0];
         if (row.StatusID != 2) {
             PageUtility.ShowModelDlg(this, "ֻ�������������״̬�ĵ��ݣ�");
             return;
         }
         string PVNo = new FormPurchaseBLL().GetPVNoByPOID(FormID);
         if (PVNo != "") {
             PageUtility.ShowModelDlg(this.Page, "���뵥�Ѿ�������PV��PV���Ϊ��" + PVNo);
             return;
         }
         new APFlowBLL().ScrapForm(FormID);
         gvApplyList.DataBind();
     }
 }
Ejemplo n.º 10
0
    private bool FillDetail(SystemEnums.FormStatus StatusID)
    {
        bool isValid = true;
        this.ViewState["AmountRMBTotal"] = 0;
        //先填充产品明细
        foreach (GridViewRow row in this.gvPaymentDetails.Rows) {
            if (row.RowType == DataControlRowType.DataRow) {
                FormDS.FormMarketingPaymentDetailRow detailRow = this.InnerDS.FormMarketingPaymentDetail[row.RowIndex];

                TextBox txtAmountBeforeTax = (TextBox)row.FindControl("txtAmountBeforeTax");
                if (string.IsNullOrEmpty(txtAmountBeforeTax.Text.Trim())) {
                    detailRow.AmountBeforeTax = 0;
                } else {
                    decimal AmountBeforeTax = decimal.Round(decimal.Parse(txtAmountBeforeTax.Text.Trim()), 2);
                    detailRow.AmountBeforeTax = AmountBeforeTax;
                    //if (AmountBeforeTax < 0) {
                    //    PageUtility.ShowModelDlg(this.Page, "本次预付金额不能录入负数");
                    //    isValid = false;
                    //    break;
                    //}
                }

                decimal TaxAmount = 0;
                decimal.TryParse(((TextBox)row.FindControl("txtTaxAmount")).Text, out TaxAmount);
                if (StatusID == SystemEnums.FormStatus.Awaiting && detailRow.AmountBeforeTax > 0) {
                    //是否有税率
                    if (new MasterDataBLL().GetVatTypeById(int.Parse(this.VATTypeDDL.SelectedValue))[0].HasTax) {
                        if (TaxAmount <= 0) {
                            PageUtility.ShowModelDlg(this, "税率类型不为VAT0,必须填写税金!");
                            return false;
                        }
                    } else {
                        if (TaxAmount > 0) {
                            PageUtility.ShowModelDlg(this, "税率类型为VAT0,不能填写税金!");
                            return false;
                        }
                    }
                }

                TextBox txtTaxAmount = (TextBox)row.FindControl("txtTaxAmount");
                TaxAmount = decimal.Round(TaxAmount, 2);
                if (string.IsNullOrEmpty(txtTaxAmount.Text.Trim())) {
                    detailRow.TaxAmount = 0;
                } else {
                    TaxAmount = decimal.Parse(txtTaxAmount.Text.Trim());
                    detailRow.TaxAmount = TaxAmount;
                    //if (TaxAmount < 0) {
                    //    PageUtility.ShowModelDlg(this.Page, "本次预付金额不能录入负数");
                    //    isValid = false;
                    //    break;
                    //}
                }
                decimal AmountRMB = detailRow.AmountBeforeTax + detailRow.TaxAmount;
                AmountRMB = decimal.Round(AmountRMB, 2);

                //提交时再取一遍,防止漏洞
                detailRow.PaiedAmount = this.FormMarketingBLL.GetPaidAmountByFormMarketingDetailID(detailRow.FormMarketingApplyDetailID);
                detailRow.RemainAmount = detailRow.ApplyAmountRMB - detailRow.PaiedAmount;
                if (AmountRMB > detailRow.RemainAmount) {
                    PageUtility.ShowModelDlg(this.Page, "报销金额不能大于可用金额");
                    isValid = false;
                    break;
                }

                detailRow.AmountRMB = AmountRMB;

                //PO是否选择过
                UserControls_POSearchControl UCPO = (UserControls_POSearchControl)row.FindControl("UCPO");
                if (detailRow.ApplyAmountRMB > 5000 && UCPO.FormID == string.Empty && AmountRMB > 0) {
                    PageUtility.ShowModelDlg(this.Page, "申请金额大于5000元的需要指定PO");
                    isValid = false;
                    break;
                }
                if (UCPO.FormID != string.Empty) {
                    PurchaseDS.FormPORow po = new FormPurchaseBLL().GetFormPOByID(int.Parse(UCPO.FormID));
                    detailRow.POFormID = int.Parse(UCPO.FormID);
                    detailRow.POFormNo = UCPO.FormNo;
                    detailRow.POBPCSNo = po.BPCSPONo;
                }
                this.ViewState["AmountRMBTotal"] = decimal.Parse(this.ViewState["AmountRMBTotal"].ToString()) + AmountRMB;
            }
        }
        if (isValid && StatusID == SystemEnums.FormStatus.Awaiting && decimal.Parse(this.ViewState["AmountRMBTotal"].ToString()) <= 0) {
            PageUtility.ShowModelDlg(this.Page, "报销金额必须大于零!");
            isValid = false;
        }
        return isValid;
    }