public string GetCompanyCode(object ID) { MasterDataBLL msdBLL = new MasterDataBLL(); MasterData.VendorTypeRow vType = msdBLL.GetVendorTypeById((int)ID); MasterData.CompanyRow company = msdBLL.GetCompanyById(vType.CompanyID); return company.CompanyCode; }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); String title = this.GetLocalResourceObject("titleLabel.Text").ToString(); this.Page.Title = title; int VendorID = int.Parse(Request["VendorID"]); this.ViewState["VendorID"] = VendorID; MasterData.VendorRow vendorRow = new MasterDataBLL().GetVendorByID(VendorID); txtVendorName.Text = vendorRow.VendorName; txtVendorAddress.Text = vendorRow.VendorAddress; txtCity.Text = vendorRow.City; txtPostal.Text = vendorRow.Postal; txtContactName.Text = vendorRow.ContactName; MasterDataBLL masterDataBLL = new MasterDataBLL(); MasterData.VendorTypeRow VendorTypeRow = masterDataBLL.GetVendorTypeById(vendorRow.VendorTypeID); txtVendorType.Text = VendorTypeRow.VendorTypeName; txtCurrency.Text = masterDataBLL.GetCurrencyByID(VendorTypeRow.CurrencyID).CurrencyFullName; txtCompany.Text = masterDataBLL.GetCompanyById(VendorTypeRow.CompanyID).CompanyName; txtCompanyCode.Text = masterDataBLL.GetCompanyById(VendorTypeRow.CompanyID).CompanyCode; this.txtPhoneNumber.Text = vendorRow.PhoneNumber; this.txtOneTimeVendor.Text = vendorRow.OneTimeVendor ? "Y" : "N"; this.txtHoldVendor.Text = vendorRow.HoldVendor ? "Y" : "N"; if (!vendorRow.IsPurchaseingPostalCodeNull()) { this.txtPurchaseingPostalCode.Text = vendorRow.PurchaseingPostalCode; } if (!vendorRow.IsAlphaSearchKeyNull()) { this.txtAlphaSearchKey.Text = vendorRow.AlphaSearchKey; } if (!vendorRow.IsPurchasingCityNull()) { this.txtPurchasingCity.Text = vendorRow.PurchasingCity; } if (!vendorRow.IsPurchasingContactNull()) { this.txtPurchasingContact.Text = vendorRow.PurchasingContact; } if (!vendorRow.IsPurchasingAddressNull()) { this.txtPurchasingAddress.Text = vendorRow.PurchasingAddress; } if (!vendorRow.IsPurchasePhoneNumberNull()) { this.txtPurchasePhoneNumber.Text = vendorRow.PurchasePhoneNumber; } this.txtBankCode.Text = vendorRow.BankCode; this.txtMethodPayment.Text = masterDataBLL.GetMethodPaymentById(vendorRow.MethodPaymentID)[0].MethodPaymentName; this.txtPaymentTerm.Text = masterDataBLL.GetPaymentTermById(vendorRow.PaymentTermID)[0].PaymentTermName; this.txtTransType.Text = masterDataBLL.GetTransTypeById(vendorRow.TransTypeID)[0].TransTypeName; txtVATRate.Text = masterDataBLL.GetVatTypeById(vendorRow.VATTypeID)[0].VatTypeName; txtBankName.Text = vendorRow.BankName.ToString(); if (!vendorRow.IsAccountNoNull()) { txtAccountNo.Text = vendorRow.AccountNo; } if (!vendorRow.IsBankNoNull()) { this.txtBankNo.Text = vendorRow.BankNo; } if (!vendorRow.IsACTypeIDNull()) { this.txtACType.Text = masterDataBLL.GetACTypeById(vendorRow.ACTypeID)[0].ACTypeName; } if (!vendorRow.IsRemarkNull()) { this.txtRemark.Text = vendorRow.Remark; } }
/// <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; }
/// <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; }
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; }
/// <summary> /// 个人费用报销 /// </summary> /// <param name="FormID"></param> /// <returns></returns> private bool ExportPersonalReimburseDataByFormID(int FormID, int logId) { ExportDataDS.ExportDataDataTable l_dtExportData = new ExportDataDS.ExportDataDataTable(); FormDS.FormPersonalReimburseDetailDataTable l_dtPersonalReimburseDetail = new FormDS.FormPersonalReimburseDetailDataTable(); FormMarketingBLL formmarkbll = new FormMarketingBLL(); FormTEBLL formtebll = new FormTEBLL(); StuffUserBLL stuffuserdll = new StuffUserBLL(); 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_dtPersonalReimburseDetail = formtebll.GetFormPersonalReimburseDetailByFormPersonalReimburseID(l_drform.FormID); int i = 0; FormDS.FormPersonalReimburseDataTable l_dtPersonalReimburse = formtebll.GetFormPersonalReimburseByID(l_drform.FormID); foreach (FormDS.FormPersonalReimburseDetailRow l_drtemp in l_dtPersonalReimburseDetail) { ExportDataDS.ExportDataRow l_drExportData = l_dtExportData.NewExportDataRow(); l_drExportData.FormID = FormID; l_drExportData.VendorCode = stuffuserdll.GetStuffUserById(l_drform.UserID)[0].VendorCode; l_drExportData.CompanyCode = masterdatabll.GetCompanyById(masterdatabll.GetCostCenterById(l_drform.CostCenterID).CompanyID).CompanyCode; 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; } //如果Vendor Code的公司和成本中心的公司不一致,则报错 MasterData.VendorDataTable tbVendor = new BusinessObjects.MasterDataTableAdapters.VendorTableAdapter().GetDataByVendorCode(l_drExportData.VendorCode); if (tbVendor.Rows.Count > 0) { string vendorCompanyCode = masterdatabll.GetCompanyById(tbVendor[0].CompanyID).CompanyCode; if (l_drExportData.CompanyCode != vendorCompanyCode) { logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:Company Code不符,请检查!"); return false; } } l_drExportData.Reference = ""; l_drExportData.Invoice = l_drform.FormNo; l_drExportData.Invoicedate = l_drform.SubmitDate.ToString("yyyyMMdd"); l_drExportData.TotalMoney = l_dtPersonalReimburse[0].Amount; //l_drExportData.Currency = masterdatabll.GetCurrencyByID(l_drtemp.CurrencyID).CurrencyShortName; //l_drExportData.ExchangeRate = l_drtemp.ExchangeRate; l_drExportData.ManageExpenseItem = masterdatabll.GetManageExpenseItemById(l_drtemp.ManageExpenseItemID).ManageExpenseItemName; l_drExportData.CostCenter = masterdatabll.GetCostCenterById(l_drform.CostCenterID).CostCenterCode; l_drExportData.AccountCode = masterdatabll.GetAccountingCodeByExpenseItemAndCostCenter(l_drtemp.ManageExpenseItemID, l_drform.CostCenterID); l_drExportData.DetailMoney = l_drtemp.RMB; l_drExportData.PONumber = 0; l_drExportData.POLineNumber = "0"; l_drExportData.FinanceRemark = l_drform.FinanceRemark; l_drExportData.FormNo = l_drform.FormNo; l_drExportData.TaxRateCode = masterdatabll.GetVatTypeById(1)[0].VatTypeName; l_drExportData.TaxAmt = 0; l_dtExportData.AddExportDataRow(l_drExportData); i++; } if (l_dtExportData.Rows.Count == 0) { logbll.InsertExportLogDetail(logId, "单据编号:" + l_drform.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(l_drform.UserID)[0].StuffName + ",错误信息:无明细数据,无法导出!"); return false; } if (l_dtExportData.Rows.Count == l_dtPersonalReimburseDetail.Rows.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; }
/// <summary> /// Vendor导出 /// </summary> /// <param name="FormID"></param> /// <returns></returns> private bool ExportVendorAVM(MasterData.VendorRow vendor, int logId) { string BakPath = ConfigurationManager.AppSettings["ExportService.BakPath"]; FormVendorBLL formvendorbll = new FormVendorBLL(); MasterDataBLL masterdatabll = new MasterDataBLL(); try { string FileName = ConfigurationManager.AppSettings["ExportService.VendorAVMFileName"]; string spit = "\t"; MasterData.PaymentTermRow paymentTerm = null; MasterData.VendorTypeRow vendorType = null; MasterData.CompanyRow company = null; MasterData.CurrencyRow currency = null; MasterData.MethodPaymentRow paymentType = null; MasterData.VatTypeRow VatType = null; MasterData.BankCodeRow bankCode = null; MasterData.TransTypeRow transType = null; MasterData.ACTypeRow acType = null; paymentTerm = masterdatabll.GetPaymentTermById(vendor.PaymentTermID)[0]; vendorType = masterdatabll.GetVendorTypeById(vendor.VendorTypeID); company = masterdatabll.GetCompanyById(vendor.CompanyID); currency = masterdatabll.GetCurrencyByID(vendorType.CurrencyID); paymentType = masterdatabll.GetMethodPaymentById(vendor.MethodPaymentID)[0]; VatType = masterdatabll.GetVatTypeById(vendor.VATTypeID)[0]; bankCode = masterdatabll.GetBankCodeById(vendor.BankCodeID)[0]; transType = masterdatabll.GetTransTypeById(vendor.TransTypeID)[0]; acType = masterdatabll.GetACTypeById(vendor.ACTypeID)[0]; string ActionName = ""; string content = ""; switch (vendor.ActionType) { case 0: ActionName = "D"; #region 删除 content = "" + spit + ActionName + spit + "" + spit + "VZ" + spit + bSubstring(vendor.VendorCode, 5) + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + 0 + spit + 0 + spit + 0 + spit + "" + spit + "" + spit + "" + spit + "" + spit + 0 + spit + "" + spit + "" + spit + "" + spit + 0 + spit + "" + spit + 0 + spit + 0 + spit + 0 + spit + 0 + spit + 0 + spit + 0 + spit + "" + spit + "" + spit + 0 + spit + "" + spit + "" + spit + 0 + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + 0 + spit + 0 + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + 0 + spit + 0 + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + "\r\n"; #endregion break; case 1: ActionName = "A"; #region 新增 content = "" + spit + ActionName + spit + (vendor.IsActive ? "A" : "D") + spit + (vendor.IsActive ? "VM" : "VZ") + spit + bSubstring(vendor.VendorCode, 5) + spit + bSubstring(vendor.VendorName, 28) + spit + bSubstring(vendor.VendorAddress, 28) + spit + SpitVendorAddress(vendor.VendorAddress) + spit + bSubstring(vendor.City, 17) + spit + "" + spit + bSubstring(vendor.Postal, 9) + spit + bSubstring(paymentTerm.PaymentTermName, 2) + spit + bSubstring(vendorType.VendorTypeName, 4) + spit + bSubstring(vendor.VendorCode, 5) + spit + 0 + spit + 0 + spit + "" + spit + "N" + spit + "" + spit + bSubstring(vendor.PhoneNumber, 15) + spit + bSubstring(company.CompanyCode, 2) + spit + bSubstring(currency.CurrencyShortName, 3) + spit + bSubstring(paymentType.MethodPaymentName, 1) + spit + (vendor.OneTimeVendor ? "Y" : "N") + spit + 0 + spit + (vendor.HoldVendor ? "Y" : "N") + spit + 0 + spit + 0 + spit + 0 + spit + 0 + spit + 0 + spit + 0 + spit + "N" + spit + bSubstring(vendor.AlphaSearchKey, 10) + spit + 0 + spit + bSubstring(vendor.ContactName, 30) + spit + "" + spit + 0 + spit + bSubstring(vendor.PurchasingAddress, 28) + spit + SpitVendorAddress(vendor.PurchasingAddress) + spit + bSubstring(vendor.PurchasingCity, 28) + spit + "" + spit + bSubstring(vendor.PurchaseingPostalCode, 9) + spit + bSubstring(vendor.PurchasingContact, 30) + spit + "" + spit + 0 + spit + 0 + spit + "N" + spit + bSubstring(vendor.PurchasePhoneNumber, 15) + spit + "" + spit + "" + spit + bSubstring(VatType.VatTypeName, 5) + spit + "" + spit + "" + spit + 0 + spit + 0 + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + 0 + "\r\n"; #endregion break; case 2: ActionName = "U"; #region 修改 QueryDS.FormVendorViewDataTable l_dtformvendor = formvendorbll.GetApproveFormVendorByVendorID(vendor.VendorID); if (l_dtformvendor.Rows.Count > 1) { QueryDS.FormVendorViewRow l_drformvendor = l_dtformvendor[1]; content = "" + spit + ActionName + spit + "" + spit + (vendor.IsActive ? "VM" : "VZ") + spit + bSubstring(vendor.VendorCode, 5) + spit + (bSubstring(vendor.VendorName, 28) == bSubstring(l_drformvendor.VendorName, 28) ? "" : bSubstring(vendor.VendorName, 28)) + spit + (bSubstring(vendor.VendorAddress, 28) == bSubstring(l_drformvendor.VendorAddress, 28) ? "" : vendor.VendorAddress) + spit + (SpitVendorAddress(vendor.VendorAddress) == SpitVendorAddress(l_drformvendor.VendorAddress) ? "" : SpitVendorAddress(vendor.VendorAddress)) + spit + (bSubstring(vendor.City, 17) == bSubstring(l_drformvendor.City, 17) ? "" : bSubstring(vendor.City, 17)) + spit + "" + spit + (bSubstring(vendor.Postal, 9) == bSubstring(l_drformvendor.Postal, 9) ? "" : bSubstring(vendor.Postal, 9)) + spit + bSubstring(l_drformvendor.MethodPaymentID == vendor.MethodPaymentID ? "" : paymentTerm.PaymentTermName, 2) + spit + bSubstring(vendor.VendorTypeID == l_drformvendor.VendorTypeID ? "" : vendorType.VendorTypeName, 4) + spit + 0 + spit + 0 + spit + 0 + spit + "" + spit + "" + spit + "" + spit + (bSubstring(vendor.PhoneNumber, 15) == bSubstring(l_drformvendor.PhoneNumber, 15) ? "" : bSubstring(vendor.PhoneNumber, 15)) + spit + (bSubstring(company.CompanyCode, 2) == bSubstring(l_drformvendor.CompanyCode, 2) ? "0" : bSubstring(company.CompanyCode, 2)) + spit + (bSubstring(currency.CurrencyShortName, 3) == bSubstring(l_drformvendor.CurrencyShortName, 3) ? "" : bSubstring(currency.CurrencyShortName, 3)) + spit + bSubstring(l_drformvendor.MethodPaymentID == vendor.MethodPaymentID ? "" : paymentType.MethodPaymentName, 1) + spit + (vendor.OneTimeVendor == l_drformvendor.OneTimeVendor ? "" : (vendor.OneTimeVendor ? "Y" : "N")) + spit + 0 + spit + (vendor.HoldVendor == l_drformvendor.HoldVendor ? "" : (vendor.HoldVendor ? "Y" : "N")) + spit + 0 + spit + 0 + spit + 0 + spit + 0 + spit + 0 + spit + 0 + spit + "" + spit + (bSubstring(vendor.AlphaSearchKey, 10) == bSubstring(l_drformvendor.AlphaSearchKey, 10) ? "" : bSubstring(vendor.AlphaSearchKey, 10)) + spit + 0 + spit + (bSubstring(vendor.ContactName, 30) == bSubstring(l_drformvendor.ContactName, 30) ? "" : bSubstring(vendor.ContactName, 30)) + spit + "" + spit + 0 + spit + (bSubstring(vendor.PurchasingAddress, 28) == bSubstring(l_drformvendor.PurchasingAddress, 28) ? "" : bSubstring(vendor.PurchasingAddress, 28)) + spit + (SpitVendorAddress(vendor.PurchasingAddress) == SpitVendorAddress(l_drformvendor.PurchasingAddress) ? "" : SpitVendorAddress(vendor.PurchasingAddress)) + spit + (bSubstring(vendor.PurchasingCity, 28) == bSubstring(l_drformvendor.PurchasingCity, 28) ? "" : bSubstring(vendor.PurchasingCity, 28)) + spit + "" + spit + (bSubstring(vendor.PurchaseingPostalCode, 9) == bSubstring(l_drformvendor.PurchaseingPostalCode, 9) ? "" : bSubstring(vendor.PurchaseingPostalCode, 9)) + spit + (bSubstring(vendor.PurchasingContact, 30) == bSubstring(l_drformvendor.PurchasingContact, 30) ? "" : bSubstring(vendor.PurchasingContact, 30)) + spit + "" + spit + 0 + spit + 0 + spit + "" + spit + (bSubstring(vendor.PurchasePhoneNumber, 15) == bSubstring(l_drformvendor.PurchasePhoneNumber, 15) ? "" : bSubstring(vendor.PurchasePhoneNumber, 15)) + spit + "" + spit + "" + spit + bSubstring(l_drformvendor.VATTypeID == vendor.VATTypeID ? "" : VatType.VatTypeName, 5) + spit + "" + spit + "" + spit + 0 + spit + 0 + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + "\r\n"; } else { logbll.InsertExportLogDetail(logId, "未找到Vendor历史数据!"); } #endregion break; case 3: ActionName = "R"; #region 重新激活 content = "" + spit + ActionName + spit + "" + spit + "VM" + spit + bSubstring(vendor.VendorCode, 5) + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + 0 + spit + 0 + spit + 0 + spit + "" + spit + "" + spit + "" + spit + "" + spit + 0 + spit + "" + spit + "" + spit + "" + spit + 0 + spit + "" + spit + 0 + spit + 0 + spit + 0 + spit + 0 + spit + 0 + spit + 0 + spit + "" + spit + "" + spit + 0 + spit + "" + spit + "" + spit + 0 + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + 0 + spit + 0 + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + 0 + spit + 0 + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + "\r\n"; #endregion break; } content = content.Replace("\r", "").Replace("\n", "") + "\r\n"; File.AppendAllText(path + FileName, content, Encoding.Default); File.AppendAllText(BakPath + DateTime.Now.ToString("yyyyMMddhhmmss") + FileName, content, Encoding.Default); UpdateVendorbyID(vendor.VendorID); } catch (Exception e) { logbll.InsertExportLogDetail(logId, "VendorCode:" + vendor.VendorCode + ",VendorName:" + vendor.VendorName + "" + ",错误信息:" + e.Message); return false; } return true; }
public string GetVendorNameByID(object VendorID) { if (VendorID.ToString() != string.Empty) { MasterDataBLL mdBLL = new MasterDataBLL(); int id = Convert.ToInt32(VendorID); MasterData.VendorRow rowVendor = mdBLL.GetVendorByID(id); MasterData.CompanyRow rowCompany = mdBLL.GetCompanyById(rowVendor.CompanyID); return rowCompany.CompanyCode + "-" + rowVendor.VendorName; } else { return null; } }
protected void txtVendorTypeName_TextChanged(object sender, EventArgs e) { MasterDataBLL ma = new MasterDataBLL(); if (this.VendorTypeControl.VendorTypeID != string.Empty) { txtCurrency.Text = ma.GetCurrencyByID(ma.GetVendorTypeById(int.Parse(VendorTypeControl.VendorTypeID)).CurrencyID).CurrencyFullName; txtCompany.Text = ma.GetCompanyById(ma.GetVendorTypeById(int.Parse(VendorTypeControl.VendorTypeID)).CompanyID).CompanyName; txtCompanyCode.Text = ma.GetCompanyById(ma.GetVendorTypeById(int.Parse(VendorTypeControl.VendorTypeID)).CompanyID).CompanyCode; } else { txtCurrency.Text = ""; txtCompany.Text = ""; txtCompanyCode.Text = ""; } }
protected void OpenForm(int formID) { PurchaseDS.FormVendorRow FormVendorTR = FormVendorBLL.GetFormVendorByID(formID)[0]; if (!FormVendorTR.IsVendorNameNull()) { txtVendorName.Text = FormVendorTR.VendorName; } if (!FormVendorTR.IsVendorAddressNull()) { txtVendorAddress.Text = FormVendorTR.VendorAddress; } if (!FormVendorTR.IsCityNull()) { txtCity.Text = FormVendorTR.City; } if (!FormVendorTR.IsPostalNull()) { txtPostal.Text = FormVendorTR.Postal; } if (!FormVendorTR.IsContactNameNull()) { txtContactName.Text = FormVendorTR.ContactName; } if (!FormVendorTR.IsVendorTypeIDNull()) { this.VendorTypeControl.VendorTypeID = FormVendorTR.VendorTypeID.ToString(); MasterDataBLL ma = new MasterDataBLL(); MasterData.VendorTypeRow VendorTypeRow = ma.GetVendorTypeById(FormVendorTR.VendorTypeID); VendorTypeControl.VendorTypeName = VendorTypeRow.VendorTypeName; txtCurrency.Text = ma.GetCurrencyByID(VendorTypeRow.CurrencyID).CurrencyFullName; txtCompany.Text = ma.GetCompanyById(VendorTypeRow.CompanyID).CompanyName; txtCompanyCode.Text = ma.GetCompanyById(VendorTypeRow.CompanyID).CompanyCode; } if (!FormVendorTR.IsPhoneNumberNull()) { this.txtPhoneNumber.Text = FormVendorTR.PhoneNumber; } if (!FormVendorTR.IsOneTimeVendorNull()) { this.ddlOneTimeVendor.SelectedValue = Convert.ToInt32(FormVendorTR.OneTimeVendor).ToString(); } if (!FormVendorTR.IsHoldVendorNull()) { this.ddlHoldVendor.SelectedValue = Convert.ToInt32(FormVendorTR.HoldVendor).ToString(); } if (!FormVendorTR.IsPurchaseingPostalCodeNull()) { this.txtPurchaseingPostalCode.Text = FormVendorTR.PurchaseingPostalCode; } if (!FormVendorTR.IsAlphaSearchKeyNull()) { this.txtAlphaSearchKey.Text = FormVendorTR.AlphaSearchKey; } if (!FormVendorTR.IsPurchasingCityNull()) { this.txtPurchasingCity.Text = FormVendorTR.PurchasingCity; } if (!FormVendorTR.IsPurchasingContactNull()) { this.txtPurchasingContact.Text = FormVendorTR.PurchasingContact; } if (!FormVendorTR.IsPurchasingAddressNull()) { this.txtPurchasingAddress.Text = FormVendorTR.PurchasingAddress; } if (!FormVendorTR.IsPurchasePhoneNumberNull()) { this.txtPurchasePhoneNumber.Text = FormVendorTR.PurchasePhoneNumber; } if (!FormVendorTR.IsBankCodeIDNull()) { this.ddlBankCode.DataBind(); this.ddlBankCode.SelectedValue = FormVendorTR.BankCodeID.ToString(); } if (!FormVendorTR.IsPaymentTermIDNull()) { this.ddlPaymentTerm.SelectedValue = FormVendorTR.PaymentTermID.ToString(); } if (!FormVendorTR.IsTransTypeIDNull()) { this.ddlTransType.SelectedValue = FormVendorTR.TransTypeID.ToString(); } if (!FormVendorTR.IsVATTypeIDNull()) { ddlVatRate.SelectedValue = FormVendorTR.VATTypeID.ToString(); } if (!FormVendorTR.IsBankNameNull()) { txtBankName.Text = FormVendorTR.BankName.ToString(); } if (!FormVendorTR.IsAccountNoNull()) { txtAccountNo.Text = FormVendorTR.AccountNo; } if (!FormVendorTR.IsBankNoNull()) { txtBankNo.Text = FormVendorTR.BankNo; } if (!FormVendorTR.IsACTypeIDNull()) { ddlACType.SelectedValue = FormVendorTR.ACTypeID.ToString(); } if (!FormVendorTR.IsModifyReasonNull()) { this.txtModifyReason.Text = FormVendorTR.ModifyReason; } if (!FormVendorTR.IsVendorIDNull()) { this.trModifyReason.Visible = true; } if (!FormVendorTR.IsAttachmentFileNameNull()) { this.UCFileUpload.AttachmentFileName = FormVendorTR.AttachmentFileName; this.UCFileUpload.RealAttachmentFileName = FormVendorTR.RealAttachmentFileName; } if (!FormVendorTR.IsRemarkNull()) { this.txtRemark.Text = FormVendorTR.Remark; } if (int.Parse(this.ViewState["ActionType"].ToString()) == (int)SystemEnums.VendorActionType.Delete) { DisableWhenDelete(); } }
public void FillFormByVendorID(int VendorID) { MasterData.VendorRow vendorRow = new MasterDataBLL().GetVendorByID(VendorID); txtVendorName.Text = vendorRow.VendorName; txtVendorAddress.Text = vendorRow.VendorAddress; txtCity.Text = vendorRow.City; txtPostal.Text = vendorRow.Postal; txtContactName.Text = vendorRow.ContactName; this.VendorTypeControl.VendorTypeID = vendorRow.VendorTypeID.ToString(); MasterDataBLL ma = new MasterDataBLL(); MasterData.VendorTypeRow VendorTypeRow = ma.GetVendorTypeById(vendorRow.VendorTypeID); VendorTypeControl.VendorTypeName = VendorTypeRow.VendorTypeName; txtCurrency.Text = ma.GetCurrencyByID(VendorTypeRow.CurrencyID).CurrencyFullName; txtCompany.Text = ma.GetCompanyById(VendorTypeRow.CompanyID).CompanyName; txtCompanyCode.Text = ma.GetCompanyById(VendorTypeRow.CompanyID).CompanyCode; if (!vendorRow.IsPhoneNumberNull()) { this.txtPhoneNumber.Text = vendorRow.PhoneNumber; } if (!vendorRow.IsOneTimeVendorNull()) { this.ddlOneTimeVendor.SelectedValue = Convert.ToInt32(vendorRow.OneTimeVendor).ToString(); } if (!vendorRow.IsHoldVendorNull()) { this.ddlHoldVendor.SelectedValue = Convert.ToInt32(vendorRow.HoldVendor).ToString(); } if (!vendorRow.IsPurchaseingPostalCodeNull()) { this.txtPurchaseingPostalCode.Text = vendorRow.PurchaseingPostalCode; } if (!vendorRow.IsAlphaSearchKeyNull()) { this.txtAlphaSearchKey.Text = vendorRow.AlphaSearchKey; } if (!vendorRow.IsPurchasingCityNull()) { this.txtPurchasingCity.Text = vendorRow.PurchasingCity; } if (!vendorRow.IsPurchasingContactNull()) { this.txtPurchasingContact.Text = vendorRow.PurchasingContact; } if (!vendorRow.IsPurchasingAddressNull()) { this.txtPurchasingAddress.Text = vendorRow.PurchasingAddress; } if (!vendorRow.IsPurchasePhoneNumberNull()) { this.txtPurchasePhoneNumber.Text = vendorRow.PurchasePhoneNumber; } this.ddlPaymentTerm.SelectedValue = vendorRow.PaymentTermID.ToString(); if (!vendorRow.IsTransTypeIDNull()) { this.ddlTransType.SelectedValue = vendorRow.TransTypeID.ToString(); } this.ddlBankCode.DataBind(); if (!vendorRow.IsBankCodeIDNull()) { this.ddlBankCode.SelectedValue = vendorRow.BankCodeID.ToString(); } ddlVatRate.SelectedValue = vendorRow.VATTypeID.ToString(); txtBankName.Text = vendorRow.BankName.ToString(); txtAccountNo.Text = vendorRow.AccountNo; if (!vendorRow.IsRemarkNull()) { this.txtRemark.Text = vendorRow.Remark; } if (!vendorRow.IsBankNoNull()) { this.txtBankNo.Text = vendorRow.BankNo; } ddlACType.SelectedValue = vendorRow.ACTypeID.ToString(); if (int.Parse(this.ViewState["ActionType"].ToString()) == (int)SystemEnums.VendorActionType.Add) { this.trModifyReason.Visible = true; } if (int.Parse(this.ViewState["ActionType"].ToString()) == (int)SystemEnums.VendorActionType.Delete || int.Parse(this.ViewState["ActionType"].ToString()) == (int)SystemEnums.VendorActionType.Reactive) { DisableWhenDelete(); } }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { String title = this.GetLocalResourceObject("titleLabel.Text").ToString(); PageUtility.SetContentTitle(this.Page, title); int formID = int.Parse(Request["ObjectId"]); this.ViewState["ObjectId"] = formID; PurchaseDS.FormRow rowForm = this.FormVendorBLL.GetFormByID(formID)[0]; PurchaseDS.FormVendorRow rowForVendor = this.FormVendorBLL.GetFormVendorByID(formID)[0]; if (rowForm.IsProcIDNull()) { ViewState["ProcID"] = ""; } else { ViewState["ProcID"] = rowForm.ProcID; } this.FormNoCtl.Text = rowForm.FormNo; AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID); this.StuffNameCtl.Text = CommonUtility.GetStaffFullName(applicant); this.PositionNameCtl.Text = new OUTreeBLL().GetPositionById(rowForm.PositionID).PositionName; if (new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID) != null) { this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowForm.OrganizationUnitID).OrganizationUnitName; } this.StuffNoCtl.Text = applicant.IsStuffNoNull() ? "" : applicant.StuffNo; this.AttendDateCtl.Text = applicant.AttendDate.ToShortDateString(); //历史单据 if (rowForm.IsRejectedFormIDNull()) { lblRejectFormNo.Text = "无"; } else { PurchaseDS.FormRow rejectedForm = this.FormVendorBLL.GetFormByID(rowForm.RejectedFormID)[0]; this.lblRejectFormNo.Text = rejectedForm.FormNo; this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormPurchase/FormVendorApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; } PurchaseDS.FormVendorRow FormVendorTR = FormVendorBLL.GetFormVendorByID(formID)[0]; if (!FormVendorTR.IsVendorNameNull()) { txtVendorName.Text = FormVendorTR.VendorName; } if (!FormVendorTR.IsVendorAddressNull()) { txtVendorAddress.Text = FormVendorTR.VendorAddress; } if (!FormVendorTR.IsCityNull()) { txtCity.Text = FormVendorTR.City; } if (!FormVendorTR.IsPostalNull()) { txtPostal.Text = FormVendorTR.Postal; } if (!FormVendorTR.IsContactNameNull()) { txtContactName.Text = FormVendorTR.ContactName; } MasterDataBLL masterDataBLL = new MasterDataBLL(); if (!FormVendorTR.IsVendorTypeIDNull()) { this.VendorTypeControl.VendorTypeID = FormVendorTR.VendorTypeID.ToString(); MasterData.VendorTypeRow VendorTypeRow = masterDataBLL.GetVendorTypeById(FormVendorTR.VendorTypeID); txtCurrency.Text = masterDataBLL.GetCurrencyByID(VendorTypeRow.CurrencyID).CurrencyFullName; txtCompany.Text = masterDataBLL.GetCompanyById(VendorTypeRow.CompanyID).CompanyName; txtCompanyCode.Text = masterDataBLL.GetCompanyById(VendorTypeRow.CompanyID).CompanyCode; } if (!FormVendorTR.IsPhoneNumberNull()) { this.txtPhoneNumber.Text = FormVendorTR.PhoneNumber; } if (!FormVendorTR.IsOneTimeVendorNull()) { this.txtOneTimeVendor.Text = FormVendorTR.OneTimeVendor ? "Y" : "N"; } if (!FormVendorTR.IsHoldVendorNull()) { this.txtHoldVendor.Text = FormVendorTR.HoldVendor ? "Y" : "N"; } if (!FormVendorTR.IsPurchaseingPostalCodeNull()) { this.txtPurchaseingPostalCode.Text = FormVendorTR.PurchaseingPostalCode; } if (!FormVendorTR.IsAlphaSearchKeyNull()) { this.txtAlphaSearchKey.Text = FormVendorTR.AlphaSearchKey; } if (!FormVendorTR.IsPurchasingCityNull()) { this.txtPurchasingCity.Text = FormVendorTR.PurchasingCity; } if (!FormVendorTR.IsPurchasingContactNull()) { this.txtPurchasingContact.Text = FormVendorTR.PurchasingContact; } if (!FormVendorTR.IsPurchasingAddressNull()) { this.txtPurchasingAddress.Text = FormVendorTR.PurchasingAddress; } if (!FormVendorTR.IsPurchasePhoneNumberNull()) { this.txtPurchasePhoneNumber.Text = FormVendorTR.PurchasePhoneNumber; } if (!FormVendorTR.IsBankCodeNull()) { this.txtBankCode.Text = FormVendorTR.BankCode; } if (!FormVendorTR.IsMethodPaymentIDNull()) { this.txtMethodPayment.Text = masterDataBLL.GetMethodPaymentById(FormVendorTR.MethodPaymentID)[0].MethodPaymentName; } if (!FormVendorTR.IsPaymentTermIDNull()) { this.txtPaymentTerm.Text = masterDataBLL.GetPaymentTermById(FormVendorTR.PaymentTermID)[0].PaymentTermName; } if (!FormVendorTR.IsTransTypeIDNull()) { this.txtTransType.Text = masterDataBLL.GetTransTypeById(FormVendorTR.TransTypeID)[0].TransTypeName; } if (!FormVendorTR.IsVATTypeIDNull()) { txtVATRate.Text = masterDataBLL.GetVatTypeById(FormVendorTR.VATTypeID)[0].VatTypeName; } if (!FormVendorTR.IsBankNameNull()) { txtBankName.Text = FormVendorTR.BankName.ToString(); } if (!FormVendorTR.IsAccountNoNull()) { txtAccountNo.Text = FormVendorTR.AccountNo; } if (!FormVendorTR.IsBankNoNull()) { this.txtBankNo.Text = FormVendorTR.BankNo; } if (!FormVendorTR.IsACTypeIDNull()) { this.txtACType.Text = masterDataBLL.GetACTypeById(FormVendorTR.ACTypeID)[0].ACTypeName; } if (!FormVendorTR.IsAttachmentFileNameNull()) { this.UCFileUpload.AttachmentFileName = FormVendorTR.AttachmentFileName; this.UCFileUpload.RealAttachmentFileName = FormVendorTR.RealAttachmentFileName; } if (!FormVendorTR.IsModifyReasonNull()) { this.txtModifyReason.Text = FormVendorTR.ModifyReason; } if (!FormVendorTR.IsRemarkNull()) { this.txtRemark.Text = FormVendorTR.Remark; } //通过判断FormVendor有没有VendorID,判断是新增还是修改Vendor if (!FormVendorTR.IsVendorIDNull()) { this.ViewState["VendorID"] = FormVendorTR.VendorID; } if (FormVendorTR.ActionType != (int)SystemEnums.VendorActionType.Add) { this.trModifyReason.Visible = true; } //是新增还是修改 this.ViewState["ActionType"] = FormVendorTR.ActionType; this.txtActionType.Text = CommonUtility.GetVendorActionTypeName(FormVendorTR.ActionType); //Vendor if (!FormVendorTR.IsVendorIDNull()) { hlVendor.Text = new MasterDataBLL().GetVendorByID(FormVendorTR.VendorID).VendorCode; hlVendor.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/Dialog/VendorDetail.aspx?ShowDialog=1&VendorID=" + FormVendorTR.VendorID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; } else { hlVendor.Text = "无"; } //审批页面处理&按钮处理 AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; this.ViewState["StuffUserID"] = stuffUser.StuffUserId; if (rowForm.InTurnUserIds.Contains("P" + stuffUser.StuffUserId + "P")) { this.SubmitBtn.Visible = true; this.cwfAppCheck.IsView = false; this.ViewState["IsView"] = false; } else { this.SubmitBtn.Visible = false; this.cwfAppCheck.IsView = true; this.ViewState["IsView"] = true; } if (rowForm.StatusID == (int)SystemEnums.FormStatus.Rejected && stuffUser.StuffUserId == rowForm.UserID) { this.EditBtn.Visible = true; this.ScrapBtn.Visible = true; } else { this.EditBtn.Visible = false; this.ScrapBtn.Visible = false; } //如果是弹出,取消按钮不可见 if (this.Request["ShowDialog"] != null) { if (this.Request["ShowDialog"].ToString() == "1") { this.upButton.Visible = false; this.Master.FindControl("divMenu").Visible = false; this.Master.FindControl("tbCurrentPage").Visible = false; } } //是否有修改VendorType的权限 int opManageId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.VendorTypeModify, SystemEnums.OperateEnum.Manage); AuthorizationDS.PositionRow position = (AuthorizationDS.PositionRow)this.Session["Position"]; PositionRightBLL positionRightBLL = new PositionRightBLL(); if (rowForm.StatusID == (int)SystemEnums.FormStatus.Awaiting && positionRightBLL.CheckPositionRight(position.PositionId, opManageId)) { this.VendorTypeControl.IsVisible = "inline"; this.btnSave.Visible = true; } else { this.VendorTypeControl.IsVisible = "none"; this.btnSave.Visible = false; } } this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"]; this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString(); this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"]; }