public string GetApplyRemark(object FormMarketingApplyDetailID)
 {
     if (FormMarketingApplyDetailID.ToString() != string.Empty) {
         int id = Convert.ToInt32(FormMarketingApplyDetailID);
         FormDS.FormMarketingApplyDetailRow row = new FormMarketingBLL().GetFormMarketingApplyDetailByID(id);
         if (row.IsRemarkNull()) {
             return null;
         } else {
             return row.Remark;
         }
     } else {
         return null;
     }
 }
예제 #2
0
 public static bool CheckPeriod(int FormID)
 {
     FormDS.FormRow rowForm = new FormSaleBLL().GetFormByID(FormID)[0];
     DateTime Period = DateTime.Now;
     switch (rowForm.FormTypeID) {
         case (int)SystemEnums.FormType.FormMarketingApply:
             Period = new FormMarketingBLL().GetFormMarketingApplyByID(rowForm.FormID)[0].FPeriod;
             break;
         case (int)SystemEnums.FormType.RDApply:
             Period = new FormRDBLL().GetFormRDApplyByID(rowForm.FormID)[0].FPeriod;
             break;
         case (int)SystemEnums.FormType.SaleApply:
             Period = new FormSaleBLL().GetFormSaleApplyByID(rowForm.FormID)[0].FPeriod;
             break;
     }
     MasterData.PeriodSaleDataTable tbPeriodSale = new MasterDataBLL().GetPeriodSale();
     foreach (var rowPeriodSale in tbPeriodSale) {
         if (rowPeriodSale.PeriodSale == Period) {
             return false;
         }
     }
     return true;
 }
예제 #3
0
 protected void gvApplyList_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "scrap") {
         int FormID = Int32.Parse(e.CommandArgument.ToString());
         FormDS.FormRow row = new FormTEBLL().GetFormByID(FormID)[0];
         if (row.StatusID != 2) {
             PageUtility.ShowModelDlg(this, "ֻ�������������״̬�ĵ��ݣ�");
             return;
         }
         string PaymentFormNo = new FormMarketingBLL().GetPaymentFormNoByMarketingApplyID(row.FormID);
         if (PaymentFormNo != "") {
             PageUtility.ShowModelDlg(this.Page, "���뵥�Ѿ��������������������Ϊ��" + PaymentFormNo);
             return;
         }
         new APFlowBLL().ScrapForm(FormID);
         gvApplyList.DataBind();
     }
 }
예제 #4
0
파일: Program.cs 프로젝트: hijoy/CPL_ERS
        /// <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;
        }
예제 #5
0
파일: Program.cs 프로젝트: hijoy/CPL_ERS
        /// <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;
        }
예제 #6
0
파일: Program.cs 프로젝트: hijoy/CPL_ERS
        /// <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;
        }
예제 #7
0
파일: Program.cs 프로젝트: hijoy/CPL_ERS
 private void UpdateFormbyID(int FormID, bool IsCreateVoucher)
 {
     FormMarketingBLL formmarkbll = new FormMarketingBLL();
     FormDS.FormDataTable l_dtform = formmarkbll.GetFormByID(FormID);
     if (l_dtform.Rows.Count > 0) {
         FormDS.FormRow l_drform = l_dtform[0];
         l_drform.CreateVoucherDate = DateTime.Now;
         l_drform.IsExportLock = true;
         l_drform.IsCreateVoucher = IsCreateVoucher;
         formmarkbll.TAForm.Update(l_drform);
     }
 }
예제 #8
0
파일: Program.cs 프로젝트: hijoy/CPL_ERS
        private void ExportData()
        {
            string FileName = ConfigurationManager.AppSettings["ExportService.FileName"];
            string ExportHour = ConfigurationManager.AppSettings["ExportService.hour"];
            string BakPath = ConfigurationManager.AppSettings["ExportService.BakPath"];

            ExportDate = DateTime.Now;

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

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

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

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

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

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

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

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

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

            }
        }
예제 #9
0
 public void UpdateFormbyID(int FormID, Boolean IsExportLock, string FormNo, DateTime? CreateVoucherDate, DateTime? SubmitDate, Boolean? IsCreateVoucher)
 {
     FormMarketingBLL formmarkbll = new FormMarketingBLL();
     FormDS.FormDataTable l_dtform = formmarkbll.GetFormByID(FormID);
     if (l_dtform.Rows.Count > 0) {
         FormDS.FormRow l_drform = l_dtform[0];
         l_drform.IsExportLock = IsExportLock;
         formmarkbll.TAForm.Update(l_drform);
     }
 }