protected void btnExport_Click(object sender, EventArgs e) { if (!checkSearchConditionValid()) { return; } else { string queryExpession = getSearchCondition(); int stuffID = ((AuthorizationDS.StuffUserRow)Session["StuffUser"]).StuffUserId; int positionID = ((AuthorizationDS.PositionRow)Session["Position"]).PositionId; int limit = int.Parse(System.Configuration.ConfigurationManager.AppSettings["ExportCountLimit"]); FormQueryBLL bll = new FormQueryBLL(); int count = bll.QueryFormBugetAllocationViewCountByRight(queryExpession, stuffID, positionID); if (count > limit) { PageUtility.ShowModelDlg(this.Page, "导出记录数不得超过" + limit + "条,请缩小查询条件"); return; } try { Session.Timeout = 30; string fileID = Guid.NewGuid().ToString(); string outFile = Server.MapPath(@"~/" + saveFilePath) + @"\" + fileID + ".xls"; System.Diagnostics.Debug.WriteLine("outFile := " + outFile); this.ExportDataGrid.DataSource = new FormBugetAllocationViewForExportByRightTableAdapter().GetData(queryExpession, stuffID, positionID); this.ExportDataGrid.DataBind(); string fileName = "FormBugetAllocation" + DateTime.Now.ToString("yyyyMMddHHmmss"); ToExcel(this.ExportDataGrid, fileName); Session.Timeout = 3; } catch (Exception ex) { PageUtility.DealWithException(this, ex); } } }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (!IsPostBack) { QueryDS.FormViewRow rowForm = new FormQueryBLL().GetFormViewByID(FormID); if (rowForm == null || rowForm.StatusID == (int)SystemEnums.FormStatus.Scrap || rowForm.StatusID == (int)SystemEnums.FormStatus.Rejected) { this.btnPrint.Visible = false; return; } this.btnPrint.Visible = true; if (!string.IsNullOrEmpty(Text)) { this.btnPrint.Text = Text; } else { this.btnPrint.Text = Resources.Common.Form_Print; } string Param = "'height=600,width=800,toolbar=no,menubar=no,scrollbars=Yes, resizable=no,location=no, status=no,location=no'"; this.btnPrint.OnClientClick = "window.open('" + CommonUtility.GetReportPostBackUrl(FormID, rowForm.PageType) + "','PrintReport'," + Param + ");return false;"; } }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!IsPostBack) { PageUtility.SetContentTitle(this, "��ر�����"); int stuffuserID = ((AuthorizationDS.StuffUserRow)Session["StuffUser"]).StuffUserId; AuthorizationDS.PositionRow position = (AuthorizationDS.PositionRow)this.Session["Position"]; this.odsPaymentList.SelectParameters["UserID"].DefaultValue = stuffuserID.ToString(); this.odsPaymentList.SelectParameters["PositionID"].DefaultValue = ((AuthorizationDS.PositionRow)Session["Position"]).PositionId.ToString(); if (Request["FormSaleApplyID"] != null) {//����Ǵ����뵥���� this.SettlementTR.Visible = false; int SaleApplyID = int.Parse(Request["FormSaleApplyID"].ToString()); this.ViewState["FormSaleApplyID"] = Request["FormSaleApplyID"]; QueryDS.FormSaleApplyViewRow applyRow = new FormQueryBLL().GetFormSaleApplyViewByID(SaleApplyID); this.txtApplyFormNo.Text = applyRow.FormNo; this.txtApplyCustomer.Text = applyRow.CustomerName; this.txtApplyCategory.Text = applyRow.ExpenseSubCategoryName; this.txtApplyProjectName.Text = applyRow.IsProjectNameNull() ? "" : applyRow.ProjectName; this.txtApplyAmount.Text = applyRow.AmountRMB.ToString("N"); string filterStr = "Form.StatusId >=" + ((int)SystemEnums.FormStatus.Awaiting).ToString(); filterStr += " And charindex('P" + applyRow.FormNo + "P',IsNull(FormSaleSettlement.FormApplyNos,'P'+ApplyForm.FormNo+'P'))>0"; this.odsPaymentList.SelectParameters["queryExpression"].DefaultValue = filterStr; } else {//����Ǵӽ������ this.ApplyTR.Visible = false; int SettlementID = int.Parse(Request["FormSaleSettlementID"].ToString()); this.ViewState["FormSaleSettlementID"] = Request["FormSaleSettlementID"]; QueryDS.FormSaleSettlementViewRow settlementRow = new FormQueryBLL().GetFormSaleSettlementViewByID(SettlementID); this.txtSettleFormNo.Text = settlementRow.FormNo; this.txtSettleCustomer.Text = settlementRow.CustomerName; this.txtSettleCategory.Text = settlementRow.ExpenseSubCategoryName; this.txtSettleBrand.Text = settlementRow.BrandName; this.txtSettleAmount.Text = settlementRow.AmountRMB.ToString("N"); string filterStr = "Form.StatusId >=" + ((int)SystemEnums.FormStatus.Awaiting).ToString() + " And FormSaleSettlement.FormSaleSettlementID= " + SettlementID; this.odsPaymentList.SelectParameters["queryExpression"].DefaultValue = filterStr; } } }
protected void CreateBtn_Click(object sender, EventArgs e) { string strFormID = string.Empty; string strFormNo = string.Empty; bool isSameCustID = true; bool isSameBrandID = true; bool isSameYear = true; bool isSameSubCategoryID = true; bool isSameCurrencyID = true; bool isSameCostCenter = true; int custID = 0; int brandID = 0; int year = 0; int subCategoryID = 0; int currencyID = 0; int pageType = 0; decimal NeedCreatePOAmount = Convert.ToDecimal(ConfigurationManager.AppSettings["NeedCreatePOAmount"]); int costCenterID = 0; String NeedPOFormNo = string.Empty; MasterDataBLL masterBLL = new MasterDataBLL(); FormPurchaseBLL purchaseBLL = new FormPurchaseBLL(); string intFormID = string.Empty; foreach (GridViewRow row in this.gvApplyList.Rows) { CheckBox CheckCtl = (CheckBox)row.FindControl("CheckCtl"); if (CheckCtl.Checked) { QueryDS.FormSaleApplyViewRow formApply = new FormQueryBLL().GetFormSaleApplyViewByID((int)this.gvApplyList.DataKeys[row.RowIndex].Value); FormDS.FormRow form = new FormSaleBLL().GetFormByID((int)this.gvApplyList.DataKeys[row.RowIndex].Value)[0]; intFormID = formApply.FormID.ToString(); pageType = formApply.PageType; if (custID == 0) { custID = formApply.CustomerID; } else { if (custID != formApply.CustomerID) { isSameCustID = false; break; } } if (brandID == 0) { brandID = formApply.BrandID; } else { if (brandID != formApply.BrandID) { isSameBrandID = false; break; } } if (year == 0) { year = formApply.FPeriod.AddMonths(5).Year; } else { if (year != formApply.FPeriod.AddMonths(5).Year) { isSameYear = false; break; } } if (subCategoryID == 0) { subCategoryID = formApply.ExpenseSubCategoryID; } else { if (subCategoryID != formApply.ExpenseSubCategoryID) { isSameSubCategoryID = false; break; } } if (currencyID == 0) { currencyID = formApply.CurrencyID; } else { if (currencyID != formApply.CurrencyID) { isSameCurrencyID = false; break; } } if (strFormID == string.Empty) { strFormID = this.gvApplyList.DataKeys[row.RowIndex].Value.ToString(); } else { strFormID = strFormID + "," + this.gvApplyList.DataKeys[row.RowIndex].Value.ToString(); } if (strFormNo == string.Empty) { strFormNo = "P" + form.FormNo + "P"; } else { strFormNo = strFormNo + "P" + form.FormNo + "P"; } if (costCenterID == 0) { costCenterID = formApply.CostCenterID; } else { if (costCenterID != formApply.CostCenterID) { isSameCostCenter = false; break; } } //�жϽ�����X����Ҫ�½�PO MasterData.ExpenseCategoryRow ecr = masterBLL.GetExpenseCategoryById(masterBLL.GetExpenseSubCategoryById(formApply.ExpenseSubCategoryID).ExpenseCategoryID); if (formApply.AmountRMB > NeedCreatePOAmount && ecr.NeedPO) { if (purchaseBLL.QueryPOCountByParentFormID(formApply.FormID) <= 0) { NeedPOFormNo += formApply.FormNo + ","; } } } } if (strFormID == string.Empty) { PageUtility.ShowModelDlg(this, "��ѡ�����뵥!"); return; } if (!isSameCustID) { PageUtility.ShowModelDlg(this, "��ѡ����ͬ�ͻ������뵥!"); return; } if (!isSameBrandID) { PageUtility.ShowModelDlg(this, "��ѡ����ͬBrand�����뵥!"); return; } if (!isSameYear) { PageUtility.ShowModelDlg(this, "��ѡ��ͬһ������뵥!"); return; } if (!isSameSubCategoryID) { PageUtility.ShowModelDlg(this, "��ѡ��ͬһ����С������뵥!"); return; } if (!isSameCurrencyID) { PageUtility.ShowModelDlg(this, "��ѡ��ͬһ���ֵ����뵥!"); return; } if (!isSameCostCenter) { PageUtility.ShowModelDlg(this, "��ѡ��ͬһ�ɱ����ĵ����뵥!"); return; } if (NeedPOFormNo != string.Empty) { PageUtility.ShowModelDlg(this, string.Format("���뵥{0}������{1}����Ҫ����PO��", NeedPOFormNo, NeedCreatePOAmount)); return; } string url = string.Empty; if (pageType == (int)SystemEnums.PageType.ActivityApply) { if (this.ViewState["SearchCondition"] != null) { url = "~/FormSale/ActivitySettlementApply.aspx?FormApplyIds=" + strFormID + "&CustomerID=" + custID.ToString() + "&BrandID=" + brandID.ToString() + "&ExpenseSubCategoryID=" + subCategoryID + "&CurrencyID=" + currencyID+"&CostCenterID="+costCenterID + "&FormApplyNos=" + strFormNo + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectList.aspx?" + this.ViewState["SearchCondition"].ToString()); } else { url = "~/FormSale/ActivitySettlementApply.aspx?FormApplyIds=" + strFormID + "&CustomerID=" + custID.ToString() + "&BrandID=" + brandID.ToString() + "&ExpenseSubCategoryID=" + subCategoryID + "&CurrencyID=" + currencyID + "&CostCenterID=" + costCenterID + "&FormApplyNos=" + strFormNo + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectList.aspx"); } } else { if (this.ViewState["SearchCondition"] != null) { url = "~/FormSale/NoActivitySettlementApply.aspx?FormApplyIds=" + strFormID + "&CustomerID=" + custID.ToString() + "&BrandID=" + brandID.ToString() + "&ExpenseSubCategoryID=" + subCategoryID + "&CurrencyID=" + currencyID + "&CostCenterID=" + costCenterID + "&FormApplyNos=" + strFormNo + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectList.aspx?" + this.ViewState["SearchCondition"].ToString()); } else { url = "~/FormSale/NoActivitySettlementApply.aspx?FormApplyIds=" + strFormID + "&CustomerID=" + custID.ToString() + "&BrandID=" + brandID.ToString() + "&ExpenseSubCategoryID=" + subCategoryID + "&CurrencyID=" + currencyID + "&CostCenterID=" + costCenterID + "&FormApplyNos=" + strFormNo + "&Source=" + HttpUtility.UrlEncode("~/FormSale/SaleApplySelectList.aspx"); } } Response.Redirect(url); }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { String title = GetLocalResourceObject("titleLabel.Text").ToString(); PageUtility.SetContentTitle(this.Page, title); this.Page.Title = title; this.dplPeriod.DataBind(); this.dplCurrency.DataBind(); // 用户信息,职位信息 AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; AuthorizationDS.PositionRow UserPosition = (AuthorizationDS.PositionRow)Session["Position"]; this.ViewState["StuffUserID"] = stuffUser.StuffUserId; this.ViewState["PositionID"] = UserPosition.PositionId; if (new StuffUserBLL().GetCostCenterIDByPositionID(UserPosition.PositionId) == 0) { this.Session["ErrorInfor"] = "未找到成本中心,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } this.StuffNameCtl.Text = stuffUser.StuffName; this.PositionNameCtl.Text = UserPosition.PositionName; this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(UserPosition.OrganizationUnitId).OrganizationUnitName; this.ViewState["DepartmentID"] = UserPosition.OrganizationUnitId; this.AttendDateCtl.Text = stuffUser.AttendDate.ToShortDateString(); this.StuffNoCtl.Text = stuffUser.IsStuffNoNull() ? "" : stuffUser.StuffNo; if (this.Request["RejectObjectID"] != null) { this.ViewState["RejectedObjectID"] = int.Parse(this.Request["RejectObjectID"].ToString()); } if (Request["ObjectId"] != null) { this.ViewState["ObjectId"] = int.Parse(Request["ObjectId"]); if (this.Request["RejectObjectID"] == null) { this.DeleteBtn.Visible = true; } else { this.DeleteBtn.Visible = false; } OpenReimburseForm(int.Parse(this.ViewState["ObjectId"].ToString())); } else { if (Request["FormInvitationApplyID"] != null) { this.ViewState["FormInvitationApplyID"] = int.Parse(Request["FormInvitationApplyID"]); OpenApplyForm(int.Parse(this.ViewState["FormInvitationApplyID"].ToString())); } this.DeleteBtn.Visible = false; } //申请单编号 if (this.ViewState["FormInvitationApplyID"] != null) { QueryDS.FormViewRow rowApplyForm = new FormQueryBLL().GetFormViewByID(int.Parse(this.ViewState["FormInvitationApplyID"].ToString())); this.ApplyFormNoCtl.Text = rowApplyForm.FormNo; this.ApplyFormNoCtl.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormTE/FormInvitationApproval.aspx?ShowDialog=1&ObjectId=" + rowApplyForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; } } }
protected void OpenReimburseForm(int formID) { QueryDS.FormViewRow rowForm = new FormQueryBLL().GetFormViewByID(formID); FormDS.FormInvitationReimburseRow applyRow = this.FormTEBLL.GetFormInvitationReimburseRowByID(formID); if (!applyRow.IsPeriodNull()) { this.dplPeriod.Items.FindByText(applyRow.Period.ToString("yyyy-MM")).Selected = true; } this.txtCustomerName.Text = applyRow.CustomerName; this.RemarkCtl.Text = applyRow.Remark; this.txtAttenderNames.Text = applyRow.AttenderNames; this.txtBusinessRelation.Text = applyRow.BusinessRelation; this.txtBusinessPurpose.Text = applyRow.Purpose; this.txtInvitationType.Text = applyRow.InvitationType; this.txtExchageRate.Text = applyRow.ExchangeRate.ToString(); this.dplCurrency.SelectedValue = applyRow.CurrencyID.ToString(); this.txtAmount.Text = applyRow.Amount.ToString(); this.txtAmountRMB.Text = applyRow.AmountRMB.ToString("N"); this.txtPlace.Text = applyRow.Place; if (!applyRow.IsOccuredDateNull()) { this.UCOccuredDate.SelectedDate = applyRow.OccuredDate.ToShortDateString(); } this.txtAttenderCount.Text = applyRow.AttenderCount.ToString(); if ((!applyRow.IsFormInvitationApplyIDNull())) { this.ViewState["FormInvitationApplyID"] = applyRow.FormInvitationApplyID; } }
protected void OpenApplyForm(int formID) { QueryDS.FormViewRow rowForm = new FormQueryBLL().GetFormViewByID(formID); FormDS.FormInvitationApplyRow applyRow = this.FormTEBLL.GetByID(formID); this.txtCustomerName.Text = applyRow.CustomerName; this.RemarkCtl.Text = applyRow.Remark; this.txtAttenderNames.Text = applyRow.AttenderNames; this.txtBusinessRelation.Text = applyRow.BusinessRelation; this.txtBusinessPurpose.Text = applyRow.Purpose; this.txtInvitationType.Text = applyRow.InvitationType; this.txtExchageRate.Text = applyRow.ExchangeRate.ToString(); this.dplCurrency.SelectedValue = applyRow.CurrencyID.ToString(); this.txtAmount.Text = applyRow.Amount.ToString(); this.txtAmountRMB.Text = applyRow.AmountRMB.ToString("N"); this.txtPlace.Text = applyRow.Place; if (!applyRow.IsOccuredDateNull()) { this.UCOccuredDate.SelectedDate = applyRow.OccuredDate.ToShortDateString(); } this.txtAttenderCount.Text = applyRow.AttenderCount.ToString(); }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { PageUtility.SetContentTitle(this.Page, "出差审批"); this.Page.Title = "出差审批"; int formID = int.Parse(Request["ObjectID"]); this.ViewState["ObjectId"] = formID; QueryDS.FormViewRow rowForm = new FormQueryBLL().GetFormViewByID(formID); FormDS.FormTravelApplyRow applyRow = this.PersonalReimburseBLL.GetFormTravelApplyByID(formID); if (rowForm.IsProcIDNull()) { ViewState["ProcID"] = ""; } else { ViewState["ProcID"] = rowForm.ProcID; } ViewState["OrganizationUnitID"] = rowForm.OrganizationUnitID; txtFormNo.Text = rowForm.FormNo; AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID); this.StuffNameCtl.Text = applicant.StuffName; 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.AttendDateCtl.Text = applicant.AttendDate.ToShortDateString(); if (!applyRow.IsTransportFeeNull()) { this.txtTransportFee.Text = applyRow.TransportFee.ToString("N"); } if (!applyRow.IsHotelFeeNull()) { this.txtHotelFee.Text = applyRow.HotelFee.ToString("N"); } if (!applyRow.IsMealFeeNull()) { this.txtMealFee.Text = applyRow.MealFee.ToString("N"); } if (!applyRow.IsOtherFeeNull()) { this.txtOtherFee.Text = applyRow.OtherFee.ToString("N"); } if (!applyRow.IsTotalFeeNull()) { this.txtTotal.Text = applyRow.TotalFee.ToString("N"); } this.RemarkCtl.Text = applyRow.Remark; if (!applyRow.IsAttachedFileNameNull() && !applyRow.IsRealAttachedFileNameNull()) { this.UCFileUpload.AttachmentFileName = applyRow.RealAttachedFileName; this.UCFileUpload.RealAttachmentFileName = applyRow.RealAttachedFileName; } // 打开明细表 FormTravelApplyDetailTableAdapter taDetail = new FormTravelApplyDetailTableAdapter(); taDetail.FillByApplyID(this.InnerDS.FormTravelApplyDetail, formID); //历史单据 if (rowForm.IsRejectedFormIDNull()) { lblRejectFormNo.Text = "无"; } else { FormDS.FormRow rejectedForm = this.PersonalReimburseBLL.GetFormByID(rowForm.RejectedFormID)[0]; this.lblRejectFormNo.Text = rejectedForm.FormNo; this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/OtherForm/TravelApproval.aspx?ShowDialog=1&ObjectID=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; } //审批页面处理&按钮处理 AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; this.ViewState["StuffUserID"] = stuffUser.StuffUserId; if (Session["ProxyStuffUserId"] == null && 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; } } } this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"]; this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString(); this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"]; }
protected void gvApplyList_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "scrap") { int FormID = Int32.Parse(e.CommandArgument.ToString()); QueryDS.FormSaleApplyViewRow row = new FormQueryBLL().GetFormSaleApplyViewByID(FormID); string SettledFormNo = new FormSaleBLL().GetSettledFormNoBySaleApplyID(row.FormID); if (SettledFormNo != "") { PageUtility.ShowModelDlg(this.Page, "���뵥�Ѿ��������������Ϊ��" + SettledFormNo); return; } string PaymentFormNo = new FormSaleBLL().GetPaymentFormNoBySaleApplyID(row.FormID); if (PaymentFormNo != "") { PageUtility.ShowModelDlg(this.Page, "���뵥�Ѿ����������������Ϊ��" + PaymentFormNo); return; } new APFlowBLL().ScrapForm(FormID); gvApplyList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { String title = GetLocalResourceObject("titleLabel.Text").ToString(); PageUtility.SetContentTitle(this.Page, title); this.Page.Title = title; int formID = int.Parse(Request["ObjectId"]); this.ViewState["ObjectId"] = formID; QueryDS.FormViewRow rowForm = new FormQueryBLL().GetFormViewByID(formID); FormDS.FormInvitationApplyRow applyRow = this.FormTEBLL.GetByID(formID); if (rowForm.IsProcIDNull()) { ViewState["ProcID"] = ""; } else { ViewState["ProcID"] = rowForm.ProcID; } txtFormNo.Text = rowForm.FormNo; AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID); this.StuffNameCtl.Text = applicant.StuffName; 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; } if (!applicant.IsStuffNoNull()) { this.txtStuffID.Text = applicant.StuffNo; } this.AttendDateCtl.Text = applicant.AttendDate.ToShortDateString(); this.txtPeriod.Text = applyRow.Period.ToString("yyyy-MM"); this.txtCustomerName.Text = applyRow.CustomerName; this.RemarkCtl.Text = applyRow.Remark; this.txtAttenderNames.Text = applyRow.AttenderNames; this.txtBusinessRelation.Text = applyRow.BusinessRelation; this.txtBusinessPurpose.Text = applyRow.Purpose; this.txtInvitationType.Text = applyRow.InvitationType; this.txtExchageRate.Text = applyRow.ExchangeRate.ToString(); this.txtCurrency.Text = new MasterDataBLL().GetCurrencyByID(applyRow.CurrencyID).CurrencyFullName; this.txtAmount.Text = applyRow.Amount.ToString(); this.txtExchageRate.Text = applyRow.ExchangeRate.ToString(); this.txtAmountRMB.Text = applyRow.AmountRMB.ToString("N"); this.txtPlace.Text = applyRow.Place; this.txtOccuredDate.Text = applyRow.OccuredDate.ToShortDateString(); this.txtAttenderCount.Text = applyRow.AttenderCount.ToString(); //历史单据 if (rowForm.IsRejectedFormIDNull()) { lblRejectFormNo.Text = "无"; } else { FormDS.FormRow rejectedForm = this.FormTEBLL.GetFormByID(rowForm.RejectedFormID)[0]; this.lblRejectFormNo.Text = rejectedForm.FormNo; this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/FormTE/FormInvitationApproval.aspx?ShowDialog=1&ObjectID=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; } //审批页面处理&按钮处理 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; } } } this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"]; this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString(); this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"]; }
//审批方法 public void ApproveForm(int formID, int stuffUserId, string stuffName, bool pass, string comment, string ProxyStuffName,bool CheckPeriod = false) { string email = string.Empty; SqlTransaction transaction = null; try { string l_strtitle = ""; StringBuilder l_strbody = new StringBuilder(); FormTableAdapter TAMainForm = new FormTableAdapter(); transaction = TableAdapterHelper.BeginTransaction(TAMainForm); FormDS.FormRow formRow = TAMainForm.GetDataByID(formID)[0]; string returnValue = AP.approve(pass, comment, stuffUserId.ToString(), stuffName, formRow.ProcID, ProxyStuffName, formRow.OrganizationUnitID, ref email,CheckPeriod); // UtilityBLL ubll = new UtilityBLL(); string[] approveinfo = AP.GetProcessApproveUser(formRow.ProcID); if (AP.GetProcessIsEnd(formRow.ProcID)) { formRow.LastApprover = stuffUserId; formRow.Comment = comment; formRow.ApprovedDate = Convert.ToDateTime(approveinfo[0]); } formRow.ApproverIds = approveinfo[3]; if (returnValue == null) { formRow.InTurnUserIds = "P"; formRow.InTurnPositionIds = "P"; formRow.ApprovedDate = DateTime.Now; if (pass) { //如果审批通过且返回值为空则该流程结束 formRow.StatusID = (int)SystemEnums.FormStatus.ApproveCompleted; } else { //如果不通过则为驳回 formRow.StatusID = (int)SystemEnums.FormStatus.Rejected; } } else { string[] InTurn = returnValue.Split('&');//不同流程角色下的人员和职位 string ids = ""; string pids = ""; for (int a = 0; a < InTurn.Length; a++) { ids += InTurn[a].Split('$')[0].ToString();///人员 pids += InTurn[a].Split('$')[1].ToString();//职位 } formRow.InTurnUserIds = ids;//下一步的人员 formRow.InTurnPositionIds = pids;//下一步的人员职位 } TAMainForm.Update(formRow); transaction.Commit(); #region 发送邮件 try { QueryDS.FormViewRow l_drformView = new FormQueryBLL().GetFormViewByID(formID); if (pass) { if (!string.IsNullOrEmpty(returnValue)) { l_strtitle = "有一份" + l_drformView.FormTypeName + "单据,编号为:" + l_drformView.FormNo + ",等待您的审批!"; l_strbody.Append("您好,<br>"); l_strbody.Append(" 有一份" + l_drformView.StuffName + "提交的" + l_drformView.FormTypeName + "单据,编号:" + l_drformView.FormNo + ",等待您的审批!"); l_strbody.Append("<br>此邮件请勿回复!"); mailBody = string.Format(mailBody, l_strbody.ToString()); sendMail(email, "", l_strtitle, mailBody); //AP.sendMail(emailTo, "", l_strtitle, mailBody); } else { l_strtitle = "您的" + l_drformView.FormTypeName + "单据,编号为:" + l_drformView.FormNo + ",已审批完成!"; l_strbody.Append("您好,<br>"); l_strbody.Append(" 您于" + l_drformView.SubmitDate.ToString("yyyy-MM-dd") + "提交的" + l_drformView.FormTypeName + "单据,编号:" + l_drformView.FormNo + ",已经审批通过!"); l_strbody.Append("<br>此邮件请勿回复!"); mailBody = string.Format(mailBody, l_strbody.ToString()); sendMail(AuthorizationBLL.GetStuffUserById(formRow.UserID).EMail, "", l_strtitle, mailBody); //AP.sendMail(emailTo, "", l_strtitle, mailBody); } } else { l_strtitle = "您的" + l_drformView.FormTypeName + "单据,编号为:" + l_drformView.FormNo + ",被驳回!"; l_strbody.Append("您好,<br>"); l_strbody.Append(" 您于" + l_drformView.SubmitDate.ToString("yyyy-MM-dd") + "提交的" + l_drformView.FormTypeName + "单据,编号:" + l_drformView.FormNo + ",被" + stuffName + "驳回!"); l_strbody.Append("<br>此邮件请勿回复!"); mailBody = string.Format(mailBody, l_strbody.ToString()); sendMail(AuthorizationBLL.GetStuffUserById(formRow.UserID).EMail, "", l_strtitle, mailBody); //AP.sendMail(emailTo, "", l_strtitle, mailBody); } } catch (Exception e1) { } #endregion } catch (Exception ex) { if (transaction != null) { transaction.Rollback(); } throw ex; } finally { if (transaction != null) { transaction.Dispose(); } } }
public APResult ApproveForm(APParameter app, int formID, int stuffUserId, string stuffName, bool pass, string comment, string ProxyStuffName, string proctID) { APResult result = new APResult(); string email = string.Empty; try { string l_strtitle = ""; StringBuilder l_strbody = new StringBuilder(); FormTableAdapter TAMainForm = new FormTableAdapter(); //FormDS.FormRow formRow = TAMainForm.GetDataByID(formID)[0]; string returnValue = AP.approve(pass, comment, stuffUserId.ToString(), stuffName, proctID, ProxyStuffName, app.OrganizationUnitID, ref email,false); // UtilityBLL ubll = new UtilityBLL(); string[] approveinfo = AP.GetProcessApproveUser(proctID); if (returnValue != null) { string[] InTurn = returnValue.Split('&');//不同流程角色下的人员和职位 string ids = ""; string pids = ""; for (int a = 0; a < InTurn.Length; a++) { ids += InTurn[a].Split('$')[0].ToString();///人员 pids += InTurn[a].Split('$')[1].ToString();//职位 } result.InTurnUserIds = ids;//下一步的人员 result.InTurnPositionIds = pids;//下一步的人员职位 } #region 发送邮件 try { QueryDS.FormViewRow l_drformView = new FormQueryBLL().GetFormViewByID(formID); if (pass) { if (!string.IsNullOrEmpty(returnValue)) { l_strtitle = "有一份" + l_drformView.FormTypeName + "单据,编号为:" + l_drformView.FormNo + ",等待您的审批!"; l_strbody.Append("您好,<br>"); l_strbody.Append(" 有一份" + l_drformView.StuffName + "提交的" + l_drformView.FormTypeName + "单据,编号:" + l_drformView.FormNo + ",等待您的审批!"); l_strbody.Append("<br>此邮件请勿回复!"); mailBody = string.Format(mailBody, l_strbody.ToString()); sendMail(email, "", l_strtitle, mailBody); //AP.sendMail(emailTo, "", l_strtitle, mailBody); } else { l_strtitle = "您的" + l_drformView.FormTypeName + "单据,编号为:" + l_drformView.FormNo + ",已审批完成!"; l_strbody.Append("您好,<br>"); l_strbody.Append(" 您于" + l_drformView.SubmitDate.ToString("yyyy-MM-dd") + "提交的" + l_drformView.FormTypeName + "单据,编号:" + l_drformView.FormNo + ",已经审批通过!"); l_strbody.Append("<br>此邮件请勿回复!"); mailBody = string.Format(mailBody, l_strbody.ToString()); sendMail(AuthorizationBLL.GetStuffUserById(app.UserID).EMail, "", l_strtitle, mailBody); //AP.sendMail(emailTo, "", l_strtitle, mailBody); } } else { l_strtitle = "您的" + l_drformView.FormTypeName + "单据,编号为:" + l_drformView.FormNo + ",被驳回!"; l_strbody.Append("您好,<br>"); l_strbody.Append(" 您于" + l_drformView.SubmitDate.ToString("yyyy-MM-dd") + "提交的" + l_drformView.FormTypeName + "单据,编号:" + l_drformView.FormNo + ",被" + stuffName + "驳回!"); l_strbody.Append("<br>此邮件请勿回复!"); mailBody = string.Format(mailBody, l_strbody.ToString()); sendMail(AuthorizationBLL.GetStuffUserById(app.UserID).EMail, "", l_strtitle, mailBody); //AP.sendMail(emailTo, "", l_strtitle, mailBody); } } catch { } #endregion return result; } catch (Exception ex) { throw ex; } }
protected void OpenForm(int formID) { QueryDS.FormViewRow rowForm = new FormQueryBLL().GetFormViewByID(formID); FormDS.FormInvitationApplyRow applyRow = this.FormInvitationBLL.GetByID(formID); AuthorizationDS.StuffUserRow applicant = new AuthorizationBLL().GetStuffUserById(rowForm.UserID); this.StuffNameCtl.Text = applicant.StuffName; 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; } if (!applyRow.IsPeriodNull()) { this.dplPeriod.Items.FindByText(applyRow.Period.ToString("yyyy-MM")).Selected = true; } this.AttendDateCtl.Text = applicant.AttendDate.ToShortDateString(); this.txtCustomerName.Text = applyRow.CustomerName; this.RemarkCtl.Text = applyRow.Remark; this.txtAttenderNames.Text = applyRow.AttenderNames; this.txtBusinessRelation.Text = applyRow.BusinessRelation; this.txtBusinessPurpose.Text = applyRow.Purpose; this.txtInvitationType.Text = applyRow.InvitationType; this.txtExchageRate.Text = applyRow.ExchangeRate.ToString(); this.dplCurrency.SelectedValue = applyRow.CurrencyID.ToString(); this.txtAmount.Text = applyRow.Amount.ToString(); this.txtAmountRMB.Text = applyRow.AmountRMB.ToString("N"); this.txtPlace.Text = applyRow.Place; if (!applyRow.IsOccuredDateNull()) { this.UCOccuredDate.SelectedDate = applyRow.OccuredDate.ToShortDateString(); } this.txtAttenderCount.Text = applyRow.AttenderCount.ToString(); }
/// <summary> /// /// </summary> /// <returns></returns> /// <remarks></remarks> protected DataSet GetCheckWorkFlowData() { DataSet ds = new DataSet(); DataTable dt; //�������ݱ� dt = new DataTable(); dt.Columns.Add(new DataColumn("RegionCaption", typeof(string))); dt.Columns.Add(new DataColumn("Approver", typeof(string))); dt.Columns.Add(new DataColumn("FlowStatus", typeof(string))); dt.Columns.Add(new DataColumn("AuditDate", typeof(string))); dt.Columns.Add(new DataColumn("Comment", typeof(string))); dt.Columns.Add(new DataColumn("IsView", typeof(int))); dt.Columns.Add(new DataColumn("IsPending", typeof(int))); dt.Columns.Add(new DataColumn("OnError", typeof(int))); dt.Columns.Add(new DataColumn("RejectReason", typeof(string))); dt.Columns.Add(new DataColumn("IsOutTime", typeof(int)));//�Ƿ�ʱ //HU APHelper AP = CommonUtility.GetAPHelper(Session); lib.APWorkFlow.NodeStatusDataTable APTable = AP.getApprovalStatus(this.ProcID); if (APTable == null) { return ds; } AuthorizationBLL authorizationBLL = new AuthorizationBLL(); QueryDS.FormViewRow formRow = new FormQueryBLL().GetFormViewByID(this.FormID); AuthorizationDS.StuffUserRow stuffuserDr = authorizationBLL.GetStuffUserById(formRow.UserID); //�����ڵ㣬�ȴ�������ڵ� DataRow dr; dr = dt.NewRow(); dr["RegionCaption"] = strDraft; dr["Approver"] = stuffuserDr.StuffName; dr["AuditDate"] = formRow.SubmitDate.ToString("yyyy-MM-dd HH:mm"); dr["FlowStatus"] = submittedStatus; dr["Comment"] = string.Empty; dr["IsView"] = 0; dr["IsPending"] = 0; dr["OnError"] = 0; dr["IsOutTime"] = 0; dt.Rows.Add(dr); //�ٴ��������ڵ� foreach (lib.APWorkFlow.NodeStatusRow drwfh in APTable.Rows) { switch (DBNullConverter.ToStr(drwfh.STATUS)) { //case (int)SystemEnums.FlowNodeStatus.Wait: // generaAddPendingRowToDt(ref dt, drwfh, strApproving); // break; case APHelper.FlowNodeStatus.ONERROR: if (this.IsView) { generaAddErrorPendingRowToDt(ref dt, drwfh, strError); } else { generaAddErrorInTurnRowToDt(ref dt, drwfh, strError, errorStatus); } break; case APHelper.FlowNodeStatus.ASSIGNED: if (this.IsView) { generaAddPendingRowToDt(ref dt, drwfh, strApproving); } else { generaAddInTurnRowToDt(ref dt, drwfh, strApproving, approvedStatus); } //if (this.ViewState["CurrentApproveIndex"] == null) { // CurrentApproveIndex = int.Parse(drwfh["ApprovalIndex"].ToString()); // this.ViewState["CurrentApproveIndex"] = CurrentApproveIndex; //} else { // CurrentApproveIndex = int.Parse(this.ViewState["CurrentApproveIndex"].ToString()); //} break; case APHelper.FlowNodeStatus.APPROVED: generaAddRowToDt(ref dt, drwfh, strApproved, approvedStatus); break; case APHelper.FlowNodeStatus.CANCELLED: generaAddRowToDt(ref dt, drwfh, strReturnModify, rejectedStatus); break; default: break; } } for (int n = 0; n < dt.Rows.Count; n++) { DataRow dr1 = dt.Rows[n]; DataRow dr2 = dt.Rows[n + 1];//��һ���ڵ� if (string.IsNullOrEmpty(dr2["AuditDate"].ToString())) { dr2["AuditDate"] = DateTime.Now.ToString(); } TimeSpan ts = Convert.ToDateTime(dr2["AuditDate"]) - Convert.ToDateTime(dr1["AuditDate"]); if (ts.Days >= 2) { dr2["IsOutTime"] = 1; } else { dr2["IsOutTime"] = 0; } if (n + 1 == dt.Rows.Count - 1) { break; } } ds.Tables.Add(dt); return ds; }
private bool ExportPO(int formid, int logId) { string BakPath = ConfigurationManager.AppSettings["ExportService.BakPath"]; AuthorizationBLL authorizationbll = new AuthorizationBLL(); MasterDataBLL masterdatabll = new MasterDataBLL(); FormQueryBLL formQueryBLL = new FormQueryBLL(); FormPurchaseBLL formPurchaseBLL = new FormPurchaseBLL(); OUTreeBLL outreebll = new OUTreeBLL(); PurchaseDS.FormDataTable l_dtform = new PurchaseDS.FormDataTable(); PurchaseDS.FormRow form = l_dtform.NewFormRow(); try { PurchaseDS.FormPORow formPO = formPurchaseBLL.GetFormPOByID(formid); PurchaseDS.FormPODetailDataTable formPODetail = formPurchaseBLL.GetPODetailByFormPOID(formPO.FormPOID); form = formPurchaseBLL.GetFormByID(formPO.FormPOID)[0]; string POFileName = ConfigurationManager.AppSettings["ExportService.POFileName"]; string POLineFileName = ConfigurationManager.AppSettings["ExportService.POLineFileName"]; string spit = "\t"; string CompanyCode = masterdatabll.GetCompanyById(masterdatabll.GetVendorTypeById(masterdatabll.GetVendorByID(formPO.VendorID).VendorTypeID).CompanyID).CompanyCode; string VendorCode = masterdatabll.GetVendorByID(formPO.VendorID).VendorCode; string POcontent = ( "PH" + spit + "" + spit + formPO.BPCSPONo + spit + "0" + spit + "" + spit + "0" + spit + CompanyCode + spit + "" + spit + CompanyCode + spit + VendorCode + spit + "0" + spit + "4" + spit + "" + spit + masterdatabll.GetCompanyById(formPO.CompanyID).CompanyName + spit + authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit + bSubstring(formPO.DeliveryAddress, 30) + spit + SpitAddress(formPO.DeliveryAddress, 60) + spit + SpitAddress(formPO.DeliveryAddress, 90) + spit + "" + spit + "" + spit + "" + spit + form.SubmitDate.ToString("yyyyMMdd") + spit + "0" + spit + "0" + spit + "0" + spit + formPODetail[0].DeliveryDate.ToString("yyyyMMdd") + spit + "0" + spit + "0" + spit + bSubstring(formPO.Remark, 30) + spit + masterdatabll.GetPaymentTermById(masterdatabll.GetVendorByID(formPO.VendorID).PaymentTermID)[0].PaymentTermName + spit + "1" + spit + "" + spit + outreebll.GetOrganizationUnitById(form.OrganizationUnitID).OrganizationUnitCode + spit + masterdatabll.GetShippingTermById(formPO.ShippingTermID).ShippingTermCode + spit + "" + spit + masterdatabll.GetCurrencyByID(formPO.CurrencyID).CurrencyShortName + spit + formPO.ExchangeRate + spit + formPO.ExchangeRate + spit + formPODetail.Rows.Count + spit + formPO.ExchangeRate + spit + authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit + "" + spit + authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit + form.ApprovedDate.ToString("yyyyMMdd") + spit + "" + spit + "0" + spit + "" + spit + "0" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "").Replace("\r", "").Replace("\n", ""); int order = 0; string[] PODetailcontent = new string[formPODetail.Rows.Count]; foreach (PurchaseDS.FormPODetailRow l_drformPODetail in formPODetail) { order++; PODetailcontent[order - 1] = ( "PO" + spit + formPO.BPCSPONo + spit + order + spit + l_drformPODetail.ItemCode.ToUpper() + spit + VendorCode + spit + l_drformPODetail.Quantity + spit + l_drformPODetail.Quantity + spit + l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit + "" + spit + "0" + spit + l_drformPODetail.AmountRMB.ToString() + spit + "0" + spit + "0" + spit + "EA" + spit + "0" + spit + "" + spit + "0" + spit + "0" + spit + "" + spit + "" + spit + "" + spit + DateTime.Now.ToString("yyyyMMdd") + spit + masterdatabll.GetPaymentTermById(masterdatabll.GetVendorByID(formPO.VendorID).PaymentTermID)[0].PaymentTermName + spit + "" + spit + "0" + spit + "1" + spit + "1" + spit + "" + spit + CompanyCode + spit + "0" + spit + "0" + spit + "0" + spit + "0" + spit + l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit + "" + spit + "0" + spit + "0" + spit + "" + spit + masterdatabll.GetCurrencyByID(formPO.CurrencyID).CurrencyShortName + spit + formPO.ExchangeRate + spit + formPO.ExchangeRate + spit + "0" + spit + l_drformPODetail.AmountRMB.ToString() + spit + "0" + spit + "1" + spit + "" + spit + "0" + spit + "0" + spit + "0" + spit + "" + spit + "" + spit + "" + spit + "01" + spit + "4" + spit + masterdatabll.GetCompanyById(formPO.CompanyID).CompanyName + spit +//Ship To Company authorizationbll.GetStuffUserById(form.UserID).UserName.ToUpper() + spit + bSubstring(formPO.DeliveryAddress, 30) + spit + SpitAddress(formPO.DeliveryAddress, 60) + spit + SpitAddress(formPO.DeliveryAddress, 90) + spit + "" + spit + "" + spit + "" + spit + "0" + spit + "0" + spit + l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit + "0" + spit + l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit + l_drformPODetail.DeliveryDate.ToString("yyyyMMdd") + spit + "" + spit + outreebll.GetOrganizationUnitById(form.OrganizationUnitID).OrganizationUnitCode + spit + "" + spit + "" + spit + masterdatabll.GetCostCenterById(form.CostCenterID).CostCenterCode + spit + l_drformPODetail.ItemCode.ToUpper() + spit + l_drformPODetail.ItemDescription + spit + "1" + spit + "0" + spit + "0" + spit + "3" + spit + "0" + spit + "0" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + "" + spit + l_drformPODetail.Quantity).Replace("\r", "").Replace("\n", ""); ; } File.AppendAllLines(path + POLineFileName, PODetailcontent, Encoding.Default); File.AppendAllLines(BakPath + DateTime.Now.ToString("yyyyMMddhhmmss") + POLineFileName, PODetailcontent, Encoding.Default); File.AppendAllText(path + POFileName, POcontent + "\r\n", Encoding.Default); File.AppendAllText(BakPath + DateTime.Now.ToString("yyyyMMddhhmmss") + POFileName, POcontent, Encoding.Default); } catch (Exception e) { logbll.InsertExportLogDetail(logId, "单据编号:" + form.FormNo + ",提交人:" + new StuffUserBLL().GetStuffUserById(form.UserID)[0].StuffName + ",错误信息:" + e.Message); return false; } return true; }
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); } }