protected void SubmitBtn_Click(object sender, EventArgs e)
    {
        try {
            if (this.cwfAppCheck.CheckInputData()) {
                AuthorizationDS.StuffUserRow currentStuff = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
                string ProxyStuffName = null;
                if (Session["ProxyStuffUserId"] != null) {
                    ProxyStuffName = new StuffUserBLL().GetStuffUserById(int.Parse(Session["ProxyStuffUserId"].ToString()))[0].StuffName;
                }
                new APFlowBLL().ApproveForm(this.cwfAppCheck.FormID, currentStuff.StuffUserId, currentStuff.StuffName,
                            this.cwfAppCheck.GetApproveOrReject(), this.cwfAppCheck.GetComments(), ProxyStuffName);

                if (this.Request["Source"] != null) {
                    this.Response.Redirect(this.Request["Source"].ToString());
                } else {
                    this.Response.Redirect("~/Home.aspx");
                }
            }
        } catch (Exception exception) {
            this.cwfAppCheck.ReloadCtrl();
            PageUtility.DealWithException(this, exception);
        }
    }
Exemple #2
0
        //启动流程
        public APResult CreateProcess(APParameter app)
        {
            APResult result = new APResult();
            string email = string.Empty;
            string l_strtitle = "";
            StuffUserBLL stuffuserbll = new StuffUserBLL();
            StringBuilder l_strbody = new StringBuilder();
            OUTreeBLL outreebll = new OUTreeBLL();
            string Deptment = outreebll.GetFlowParameter(app.OrganizationUnitID);
            Dictionary<string, object> Dictionary = app.Dic;
            Dictionary["Department"] = Deptment;
            AuthorizationDS.PositionRow position = outreebll.GetPositionById(app.PositionID);
            if (position.IsFlowLevelNull()) {
                Dictionary["FlowLevel"] = "";
            } else {
                Dictionary["FlowLevel"] = position.FlowLevel;
            }
            string ProcID = AP.createProcess(app.FormNo + ":" + DateTime.Now.ToString(), new AuthorizationBLL().GetFlowTemplateNameByFormTypeAndUserID(app.FormTypeID, app.UserID), Dictionary);
            result.ProcID = ProcID;

            string[] InTurn = AP.startProcess(ProcID, app.OrganizationUnitID, ref email).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.ApprovedDate = DateTime.Now;
            result.InTurnUserIds = ids;//下一步的人员
            result.InTurnPositionIds = pids;//下一步的人员职位
            result.StatusID = (int)SystemEnums.FormStatus.Awaiting;
            //自动审批下一个节点是自己的
            if (!(ids.IndexOf("27") >= 0)) {
                if (ids.IndexOf(app.UserID.ToString()) > 0) {
                    APResult approveresult = ApproveForm(app, app.FormID, app.UserID, stuffuserbll.GetStuffUserById(app.UserID)[0].StuffName, true, "", "", ProcID);
                    result.InTurnUserIds = approveresult.InTurnUserIds;
                    result.InTurnPositionIds = approveresult.InTurnPositionIds;
                }
            }

            try {
                if (!string.IsNullOrEmpty(email)) {
                    //QueryDS.FormViewRow l_drformView = new FormQueryBLL().GetFormViewByID(app.FormID);
                    l_strtitle = "有一份单据编号为:" + app.FormNo + ",等待您的审批!";
                    l_strbody.Append("您好,<br>");
                    l_strbody.Append("&nbsp;&nbsp;您有一份" + new StuffUserBLL().GetStuffUserById(app.UserID)[0].StuffName + "提交的单据,编号为:" + app.FormNo + ",等待您的审批!");

                    l_strbody.Append("<br>此邮件请勿回复!");
                    mailBody = string.Format(mailBody, l_strbody.ToString());
                    sendMail(email, "", l_strtitle, mailBody);
                    //AP.sendMail(emailTo, "", l_strtitle, mailBody);
                }
            } catch {
            }
            return result;
        }
Exemple #3
0
 public string GetStuffNameByID(object stuffUserID)
 {
     int id = Convert.ToInt32(stuffUserID);
     StuffUserBLL bll = new StuffUserBLL();
     if (bll.GetStuffUserById(id).Count != 0) {
         return bll.GetStuffUserById(id)[0].StuffName;
     } else {
         return string.Empty;
     }
 }
    protected void SubmitBtn_Click(object sender, EventArgs e)
    {
        try {
            if (this.cwfAppCheck.CheckInputData()) {
                AuthorizationDS.StuffUserRow currentStuff = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
                string ProxyStuffName = null;
                if (Session["ProxyStuffUserId"] != null) {
                    ProxyStuffName = new StuffUserBLL().GetStuffUserById(int.Parse(Session["ProxyStuffUserId"].ToString()))[0].StuffName;
                }
                new APFlowBLL().ApproveForm(CommonUtility.GetAPHelper(Session), this.cwfAppCheck.FormID, currentStuff.StuffUserId, currentStuff.StuffName,
                            this.cwfAppCheck.GetApproveOrReject(), this.cwfAppCheck.GetComments(), ProxyStuffName, int.Parse(ViewState["OrganizationUnitID"].ToString()));

                //����ǿ�Խ�Ļ���������뵥
                FormDS.FormApplyRow formApply = this.SalesApplyBLL.GetFormApplyByID(this.cwfAppCheck.FormID)[0];
                FormDS.FormRow formRow = this.SalesApplyBLL.GetFormByID(this.cwfAppCheck.FormID)[0];
                //������ɺ󣬾�Ӧ����ִ��ȷ�ϵIJ��裬Ҫ����pagetype
                if (formRow.StatusID == 2) {
                    formRow.PageType = (int)SystemEnums.PageType.GeneralApplyExecute;
                    new FormTableAdapter().Update(formRow);
                    if (formApply.EndPeriod > formApply.BeginPeriod) {
                        new APFlowBLL().GenerateApplyForm(this.cwfAppCheck.FormID);
                    }
                }

                if (this.Request["Source"] != null) {
                    this.Response.Redirect(this.Request["Source"].ToString());
                } else {
                    this.Response.Redirect("~/Home.aspx");
                }
            }
        } catch (Exception exception) {
            this.cwfAppCheck.ReloadCtrl();
            PageUtility.DealWithException(this, exception);
        }
    }
Exemple #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;
        }
 protected void SubmitBtn_Click(object sender, EventArgs e)
 {
     try {
         if (this.cwfAppCheck.CheckInputData()) {
             AuthorizationDS.StuffUserRow currentStuff = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
             string ProxyStuffName = null;
             if (Session["ProxyStuffUserId"] != null) {
                 ProxyStuffName = new StuffUserBLL().GetStuffUserById(int.Parse(Session["ProxyStuffUserId"].ToString()))[0].StuffName;
             }
             new APFlowBLL().ApproveForm(this.cwfAppCheck.FormID, currentStuff.StuffUserId, currentStuff.StuffName,
                         this.cwfAppCheck.GetApproveOrReject(), this.cwfAppCheck.GetComments(), ProxyStuffName, CommonUtility.CheckPeriod(cwfAppCheck.FormID));
             FormDS.FormRow formRow = FormSaleBLL.GetFormByID(cwfAppCheck.FormID)[0];
             if (formRow.StatusID == 2) {
                 FormSaleBLL.GenerateSettlement(formRow.FormID);
             }
             if (this.Request["Source"] != null) {
                 this.Response.Redirect(this.Request["Source"].ToString());
             } else {
                 this.Response.Redirect("~/Home.aspx");
             }
         }
     } catch (ApplicationException ex) {
         PageUtility.DealWithException(this, ex);
     } catch (Exception exception) {
         this.cwfAppCheck.ReloadCtrl();
         PageUtility.DealWithException(this, exception);
     }
 }
    protected bool IsAddDetailValid()
    {
        TextBox UserNameTextBox = (TextBox)this.StuffUserFormView.FindControl("UserNameTextBox");
        if (UserNameTextBox.Text.Trim() != string.Empty) {
            StuffUserBLL bll = new StuffUserBLL();
            if ((int)bll.StuffUserAdapter.QueryForInsDistinct(UserNameTextBox.Text.Trim()) > 0) {
                PageUtility.ShowModelDlg(this, "��½�ʺ��ظ������޸ģ�");
                return false;
            }
        }

        TextBox StuffIdTextBox = (TextBox)this.StuffUserFormView.FindControl("StuffIdTextBox");

        if (StuffIdTextBox.Text.Trim() != string.Empty) {
            StuffUserBLL bll = new StuffUserBLL();
            if ((int)bll.StuffUserAdapter.QueryForInsDistinctStuffID(StuffIdTextBox.Text.Trim()) > 0) {
                PageUtility.ShowModelDlg(this, "Ա�������ظ������޸ģ�");
                return false;
            }
        }

        TextBox pwCtl = (TextBox)this.StuffUserFormView.FindControl("UserPasswordTextBox");
        if (pwCtl.Text.Trim().Length < 6) {
            PageUtility.ShowModelDlg(this, "���볤�Ȳ���С��6");
            return false;
        }

        UserControls_UCDateInput UCNewAttendDate = (UserControls_UCDateInput)this.StuffUserFormView.FindControl("UCNewAttendDate");
        if (UCNewAttendDate.SelectedDate == string.Empty) {
            PageUtility.ShowModelDlg(this, "����¼����ְ����");
            return false;
        }

        return true;
    }
    protected void SubmitBtn_Click(object sender, EventArgs e)
    {
        //�����Ʊ�۵Ļ��Զ����ɱ�����

        //int formApplyID = int.Parse(this.ViewState["ObjectId"].ToString());
        //FormDS.FormApplyRow formApply = this.SalesApplyBLL.GetFormApplyByID(formApplyID)[0];
        //if (formApply.PaymentTypeID == (int)SystemEnums.PaymentType.PiaoKou) {
        //    new APFlowBLL().GenerateRebateReimburse(formApplyID);
        //}
        try {
            if (this.cwfAppCheck.CheckInputData()) {
                AuthorizationDS.StuffUserRow currentStuff = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
                string ProxyStuffName = null;
                if (Session["ProxyStuffUserId"] != null) {
                    ProxyStuffName = new StuffUserBLL().GetStuffUserById(int.Parse(Session["ProxyStuffUserId"].ToString()))[0].StuffName;
                }
                new APFlowBLL().ApproveForm(CommonUtility.GetAPHelper(Session), this.cwfAppCheck.FormID, currentStuff.StuffUserId, currentStuff.StuffName,
                            this.cwfAppCheck.GetApproveOrReject(), this.cwfAppCheck.GetComments(), ProxyStuffName, int.Parse(ViewState["OrganizationUnitID"].ToString()));

                //�����Ʊ�۵Ļ��Զ����ɱ��������������뵥������£�//�����������ɣ����ڷ����Զ���Ϊִ�����

                FormDS.FormApplyRow formApply = this.SalesApplyBLL.GetFormApplyByID(this.cwfAppCheck.FormID)[0];
                if (this.SalesApplyBLL.GetFormByID(this.cwfAppCheck.FormID)[0].StatusID == 2) {
                    this.SalesApplyBLL.ExecuteConfirmForRebate(this.cwfAppCheck.FormID);
                    if(formApply.PaymentTypeID == (int)SystemEnums.PaymentType.PiaoKou){
                        new APFlowBLL().GenerateRebateReimburse(this.cwfAppCheck.FormID);
                    }
                }

                if (this.Request["Source"] != null) {
                    this.Response.Redirect(this.Request["Source"].ToString());
                } else {
                    this.Response.Redirect("~/Home.aspx");
                }
            }
        } catch (Exception exception) {
            this.cwfAppCheck.ReloadCtrl();
            PageUtility.DealWithException(this, exception);
        }
    }
 protected void SubmitBtn_Click(object sender, EventArgs e)
 {
     try {
         if (this.cwfAppCheck.CheckInputData()) {
             AuthorizationDS.StuffUserRow currentStuff = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
             string ProxyStuffName = null;
             if (Session["ProxyStuffUserId"] != null) {
                 ProxyStuffName = new StuffUserBLL().GetStuffUserById(int.Parse(Session["ProxyStuffUserId"].ToString()))[0].StuffName;
             }
             new APFlowBLL().ApproveForm(CommonUtility.GetAPHelper(Session), this.cwfAppCheck.FormID, currentStuff.StuffUserId, currentStuff.StuffName,
                         this.cwfAppCheck.GetApproveOrReject(), this.cwfAppCheck.GetComments(), ProxyStuffName, int.Parse(ViewState["OrganizationUnitID"].ToString()));
             //�����Ʊ�۵Ļ�������ܾ��Ļ�Ҫunlock PKRecord��¼
             FormDS.FormReimburseRow row = this.SalesReimburseBLL.GetFormReimburseByID(this.cwfAppCheck.FormID)[0];
             if (!this.cwfAppCheck.GetApproveOrReject() && row.PaymentTypeID == (int)SystemEnums.PaymentType.PiaoKou) {
                 new PKRecordTableAdapter().UnLockPKRecord(row.FormReimburseID);
             }
             if (this.Request["Source"] != null) {
                 this.Response.Redirect(this.Request["Source"].ToString());
             } else {
                 this.Response.Redirect("~/Home.aspx");
             }
         }
     } catch (Exception exception) {
         this.cwfAppCheck.ReloadCtrl();
         PageUtility.DealWithException(this, exception);
     }
 }
    //提交时要判断是不是审批通过,若通过则更新vendor表
    protected void SubmitBtn_Click(object sender, EventArgs e)
    {
        //审批完成时将vendor信息插入vendor表(待修改)
        try {
            if (this.cwfAppCheck.CheckInputData()) {
                AuthorizationDS.StuffUserRow currentStuff = (AuthorizationDS.StuffUserRow)Session["StuffUser"];
                string ProxyStuffName = null;
                if (Session["ProxyStuffUserId"] != null) {
                    ProxyStuffName = new StuffUserBLL().GetStuffUserById(int.Parse(Session["ProxyStuffUserId"].ToString()))[0].StuffName;
                }
                new APFlowBLL().ApproveForm(this.cwfAppCheck.FormID, currentStuff.StuffUserId, currentStuff.StuffName,
                            this.cwfAppCheck.GetApproveOrReject(), this.cwfAppCheck.GetComments(), ProxyStuffName);

                PurchaseDS.FormRow formRow = this.FormVendorBLL.GetFormByID(this.cwfAppCheck.FormID)[0];
                if (formRow.StatusID == 2) {
                    if (this.ViewState["ActionType"] != null) {
                        if (int.Parse(this.ViewState["ActionType"].ToString()) != 1) {
                            MasterDataBLL.UpdateVendor((int)this.ViewState["ObjectId"]);
                        } else {
                            new MasterDataBLL().InsertVendor((int)this.ViewState["ObjectId"]);
                        }
                    }
                }
                if (this.Request["Source"] != null) {
                    this.Response.Redirect(this.Request["Source"].ToString());
                } else {
                    this.Response.Redirect("~/Home.aspx");
                }
            }
        } catch (Exception exception) {
            this.cwfAppCheck.ReloadCtrl();
            PageUtility.DealWithException(this, exception);
        }
    }