Пример #1
0
    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;
        }
    }
    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);

            MasterDataBLL mdBLL = new MasterDataBLL();
            int formID = int.Parse(Request["ObjectId"]);
            this.ViewState["ObjectId"] = formID;
            FormDS.FormSalePaymentRow rowFormPayment = this.FormSaleBLL.GetFormSalePaymentByID(int.Parse(this.ViewState["ObjectId"].ToString()));

            FormDS.FormRow rowForm = this.FormSaleBLL.GetFormByID(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();

            this.ApplyFormNoCtl.Text = this.FormSaleBLL.GetFormByID(rowFormPayment.FormSaleApplyID)[0].FormNo;
            FormDS.FormSaleApplyRow rowFormApply = this.FormSaleBLL.GetFormSaleApplyByID(rowFormPayment.FormSaleApplyID)[0];
            this.PeriodCtl.Text = rowFormApply.FPeriod.ToString("yyyy-MM");

            MasterData.CustomerRow customer = mdBLL.GetCustomerById(rowFormApply.CustomerID)[0];
            this.CustomerNameCtl.Text = customer.CustomerName;
            this.CustomerChannelCtl.Text = mdBLL.GetCustomerChannelById(customer.CustomerChannelID)[0].CustomerChannelName;
            this.KATypeCtl.Text = customer.IsKaTypeNull() ? "" : customer.KaType;
            this.CustomerRegionCtl.Text = mdBLL.GetCustomerRegionById(customer.CustomerRegionID).CustomerRegionName;
            this.CityCtl.Text = customer.City;
            this.BrandCtl.Text = mdBLL.GetBrandById(rowFormApply.BrandID)[0].BrandName;
            MasterData.ExpenseSubCategoryRow rowExpenseSubCategory = mdBLL.GetExpenseSubCategoryById(rowFormApply.ExpenseSubCategoryID);
            this.ExpenseCategoryCtl.Text = mdBLL.GetExpenseCategoryById(rowExpenseSubCategory.ExpenseCategoryID).ExpenseCategoryName;
            this.ExpenseSubCategoryCtl.Text = rowExpenseSubCategory.ExpenseSubCategoryName;
            this.CurrencyCtl.Text = mdBLL.GetCurrencyByID(rowFormApply.CurrencyID).CurrencyShortName;
            this.ExchangeRateCtl.Text = rowFormApply.ExchangeRate.ToString();
            this.ShopNameCtl.Text = rowFormApply.IsShopNameNull() ? "" : rowFormApply.ShopName;
            this.ShopCountCtl.Text = rowFormApply.IsShopCountNull() ? "" : rowFormApply.ShopCount.ToString();
            this.ProjectNameCtl.Text = rowFormApply.IsProjectNameNull() ? "" : rowFormApply.ProjectName;
            this.CostCenterCtl.Text = CommonUtility.GetMAACostCenterFullName(rowForm.CostCenterID);
            if (!rowFormApply.IsActivityBeginDateNull()) {
                this.ActivityBeginCtl.Text = rowFormApply.ActivityBeginDate.ToString("yyyy-MM-dd");
            }
            if (!rowFormApply.IsActivityEndDateNull()) {
                this.ActivityEndCtl.Text = rowFormApply.ActivityEndDate.ToString("yyyy-MM-dd");
            }
            this.ProjectDescCtl.Text = rowFormApply.IsProjectDescNull() ? "" : rowFormApply.ProjectDesc;
            if (!rowFormApply.IsApplyFileNameNull())
                this.UCFileUpload.AttachmentFileName = rowFormApply.ApplyFileName;
            if (!rowFormApply.IsApplyRealFileNameNull())
                this.UCFileUpload.RealAttachmentFileName = rowFormApply.ApplyRealFileName;

            if (!rowFormPayment.IsRemarkNull()) {
                this.RemarkCtl.Text = rowFormPayment.Remark;
            }
            if (!rowFormPayment.IsAttachedFileNameNull()) {
                this.UCPaymentFile.AttachmentFileName = rowFormPayment.AttachedFileName;
            }
            if (!rowFormPayment.IsRealAttachedFileNameNull()) {
                this.UCPaymentFile.RealAttachmentFileName = rowFormPayment.RealAttachedFileName;
            }
            this.InvoiceStatusCtl.Text = new InvoiceStatusTableAdapter().GetDataByID(rowFormPayment.InvoiceStatusID)[0].Name;
            if (!rowFormPayment.IsVendorIDNull()) {
                MasterData.VendorRow vendor = mdBLL.GetVendorByID(rowFormPayment.VendorID);
                this.VendorCtl.Text = vendor.VendorName + "-" + vendor.VendorCode;
            }

            this.txtVatType.Text = mdBLL.GetVatTypeById(rowFormPayment.VatTypeID)[0].VatTypeName;
            //PO
            if (!rowFormPayment.IsFormPOIDNull()) {
                FormDS.FormRow rowFormPO = this.FormSaleBLL.GetFormByID(rowFormPayment.FormPOID)[0];
                this.hlPO.Text = rowFormPO.FormNo;
                this.hlPO.NavigateUrl = CommonUtility.GetPOPostBackUrl(rowFormPO.FormID);
            } else {
                this.hlPO.Text = "无";
            }
            //历史单据
            if (rowForm.IsRejectedFormIDNull()) {
                lblRejectFormNo.Text = "无";
            } else {
                FormDS.FormRow rejectedForm = this.FormSaleBLL.GetFormByID(rowForm.RejectedFormID)[0];
                this.lblRejectFormNo.Text = rejectedForm.FormNo;
                this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormSale/NoActivityAdvancedPaymentApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')";
            }

            //明细
            this.odsInvoice.SelectParameters["FormID"].DefaultValue = rowFormPayment.FormSalePaymentID.ToString();
            this.odsPaymentDetails.SelectParameters["FormSalePaymentID"].DefaultValue = rowFormPayment.FormSalePaymentID.ToString();

            //审批页面处理&按钮处理
            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;
                }
            }

            //判断财务摘要的显示问题
            if (!rowForm.IsFinanceRemarkNull()) {
                this.FinanceRemarkCtl.Text = rowForm.FinanceRemark;
            }
            int opViewId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.FinanceRemark, SystemEnums.OperateEnum.View);
            int opManageId = BusinessUtility.GetBusinessOperateId(SystemEnums.BusinessUseCase.FinanceRemark, SystemEnums.OperateEnum.Manage);
            AuthorizationDS.PositionRow ViewerPosition = (AuthorizationDS.PositionRow)this.Session["Position"];
            PositionRightBLL positionRightBLL = new PositionRightBLL();
            bool HasViewRight = positionRightBLL.CheckPositionRight(ViewerPosition.PositionId, opViewId);
            bool HasManageRight = positionRightBLL.CheckPositionRight(ViewerPosition.PositionId, opManageId);
            //如果没有权限则隐藏
            if (!HasViewRight && !HasManageRight) {
                this.FinanceRemarkTitleDIV.Visible = false;
                this.FinanceRemarkDIV.Visible = false;
                this.SaveBtn.Visible = false;
            }
            //如果没有填写的权限或者已经填写了,则隐藏保存按钮
            if (HasViewRight && (!HasManageRight || !rowForm.IsFinanceRemarkNull())) {
                this.FinanceRemarkCtl.ReadOnly = true;
                this.SaveBtn.Visible = false;
            }
            //如果不是审批中或者审批完成不能修改
            if (rowForm.StatusID != 1 && rowForm.StatusID != 2) {
                this.FinanceRemarkCtl.ReadOnly = true;
                this.SaveBtn.Visible = false;
            }

        }
        this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"];
        this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString();
        this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"];
    }
Пример #3
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;
        }
Пример #4
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;
        }
Пример #5
0
        /// <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;
        }
Пример #6
0
        /// <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;
        }
Пример #7
0
    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"];
    }