protected void ExecuteConfirmBtn_Click(object sender, EventArgs e) { try { this.SalesApplyBLL.FormDataSet = this.InnerDS; if (this.PeriodDDL.SelectedValue == "0") { PageUtility.ShowModelDlg(this.Page, "请选择预提费用期间"); return; } if (FillDetail()) { if (decimal.Parse(this.ViewState["AccruedFeeTotal"].ToString()) <= 0) { PageUtility.ShowModelDlg(this.Page, "实际发生费用不能为零"); return; } DateTime Period = new MasterDataBLL().GetAccruedPeriodByID(int.Parse(this.PeriodDDL.SelectedValue)).AccruedPeriod; AuthorizationDS.StuffUserRow currentStuff = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; this.SalesApplyBLL.ExecuteConfirm(this.cwfAppCheck.FormID, Period, currentStuff.StuffUserId); 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 Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); try { //获取URL传递参数 string strMode = this.Request.QueryString["mode"] == null ? "" : this.Request.QueryString["mode"].ToString(); string strID = this.Request.QueryString["id"] == null ? "" : this.Request.QueryString["id"].ToString(); //设置控件状态 setControlStatus(strMode); // 获取页面数据信息 if (!strMode.Equals("") && !strMode.Equals("add") && !strID.Equals("")) { MasterDataBLL bll = new MasterDataBLL(); ERS.BulletinDataTable dt = bll.GetBulletinById(Convert.ToInt32(strID)); if (dt != null && dt.Count > 0) { ERS.BulletinRow dr = dt[0]; txtTitle.Text = dr.BulletinTitle.ToString(); lblCreator.Text = dr.Creator.ToString(); lblCreateTime.Text = dr.CreateTime.ToString(); txtContent.Text = dr.BulletinContent.ToString(); } } } catch (Exception ex) { PageUtility.DealWithException(this, ex); } }
protected void OnMaterialNameTextChanged(object sender, EventArgs e) { UserControls_MaterialControl newUCMaterial = (UserControls_MaterialControl)this.fvMaterialDetails.FindControl("newUCMaterial"); TextBox newUOMCtl = (TextBox)this.fvMaterialDetails.FindControl("newUOMCtl"); TextBox newDescCtl = (TextBox)this.fvMaterialDetails.FindControl("newDescCtl"); TextBox newMaterialPriceCtl = (TextBox)this.fvMaterialDetails.FindControl("newMaterialPriceCtl"); TextBox newQuantityCtl = (TextBox)this.fvMaterialDetails.FindControl("newQuantityCtl"); TextBox newTotalCtl = (TextBox)this.fvMaterialDetails.FindControl("newTotalCtl"); if (newUCMaterial.MaterialID == string.Empty) { newUOMCtl.Text = ""; newDescCtl.Text = ""; newMaterialPriceCtl.Text = ""; } else { ERS.MaterialRow material = new MasterDataBLL().GetMaterialById(int.Parse(newUCMaterial.MaterialID)); newUOMCtl.Text = material.UOM; newDescCtl.Text = material.Description; newMaterialPriceCtl.Text = material.MaterialPrice.ToString(); if (newQuantityCtl.Text.Trim() != string.Empty) { newTotalCtl.Text = ((decimal)(decimal.Parse(newQuantityCtl.Text) * material.MaterialPrice)).ToString("N"); } } }
protected void NewSKUDDL_OnSelectedIndexChanged(object sender, EventArgs e) { DropDownList NewSKUDDL = (DropDownList)this.fvSKUDetails.FindControl("NewSKUDDL"); TextBox newPackageQuantityCtl = (TextBox)this.fvSKUDetails.FindControl("newPackageQuantityCtl"); TextBox newUnitPriceCtl = (TextBox)this.fvSKUDetails.FindControl("newUnitPriceCtl"); TextBox newQuantityCtl = (TextBox)this.fvSKUDetails.FindControl("newQuantityCtl"); TextBox newTotalCtl = (TextBox)this.fvSKUDetails.FindControl("newTotalCtl"); if (NewSKUDDL.SelectedValue == "0") { newPackageQuantityCtl.Text = ""; newUnitPriceCtl.Text = ""; newTotalCtl.Text = ""; } else { ERS.SKURow SKU = new MasterDataBLL().GetSKUById(int.Parse(NewSKUDDL.SelectedValue)); newPackageQuantityCtl.Text = SKU.PackageQuantity.ToString(); newUnitPriceCtl.Text = new MasterDataBLL().GetSKUPriceByCustomerID(SKU.SKUID, int.Parse(this.ViewState["CustomerID"].ToString())).ToString(); if (newQuantityCtl.Text != string.Empty) { newTotalCtl.Text = (decimal.Parse(newUnitPriceCtl.Text) * decimal.Parse(newQuantityCtl.Text)).ToString(); } } }
//查询各项费用项可用次数 public void InitCustomerTimesLimit() { ExpenseItemRemainTimes = new Dictionary <int, object[]>(); int CustomerID = int.Parse(this.ViewState["CustomerID"].ToString()); int SubCategoryID = int.Parse(this.ViewState["ExpenseSubCategoryID"].ToString()); DateTime Period = DateTime.Parse(this.ViewState["EndPeriod"].ToString()); ERS.ExpenseItemDataTable ExpenseTable = new MasterDataBLL().GetExpenseItemBySubCateId(SubCategoryID); object[] tempArray; object[] tempArray1 = new object[2]; foreach (ERS.ExpenseItemRow item in ExpenseTable.Rows) { if (item.IsInContract) { tempArray = this.SalesApplyBLL.GetCustomerTimesLimitByParameter(CustomerID, item.ExpenseItemID, Period.Year); if ((bool)tempArray[0]) { tempArray1[0] = (bool)tempArray[0]; tempArray1[1] = int.Parse(tempArray[2].ToString()); ExpenseItemRemainTimes.Add(item.ExpenseItemID, tempArray1); } else { tempArray1[0] = false; tempArray1[1] = int.Parse(tempArray[2].ToString()); ExpenseItemRemainTimes.Add(item.ExpenseItemID, tempArray1); } } } this.ViewState["ExpenseItemRemainTimes"] = ExpenseItemRemainTimes; }
protected void odsSKUDetails_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { DropDownList NewSKUDDL = (DropDownList)this.fvSKUDetails.FindControl("NewSKUDDL"); if (NewSKUDDL.SelectedValue == "0") { PageUtility.ShowModelDlg(this.Page, "请选择产品"); e.Cancel = true; return; } TextBox newQuantityCtl = (TextBox)this.fvSKUDetails.FindControl("newQuantityCtl"); TextBox newPackageQuantityCtl = (TextBox)this.fvSKUDetails.FindControl("newPackageQuantityCtl"); TextBox newUnitPriceCtl = (TextBox)this.fvSKUDetails.FindControl("newUnitPriceCtl"); ERS.SKURow SKU = new MasterDataBLL().GetSKUById(int.Parse(NewSKUDDL.SelectedValue)); if (NewSKUDDL.SelectedValue != "0") { newPackageQuantityCtl.Text = SKU.PackageQuantity.ToString(); newUnitPriceCtl.Text = new MasterDataBLL().GetSKUPriceByCustomerID(SKU.SKUID, int.Parse(this.ViewState["CustomerID"].ToString())).ToString(); } e.InputParameters["UnitPrice"] = decimal.Parse(newUnitPriceCtl.Text); if (this.ViewState["ObjectId"] != null) { e.InputParameters["FormReimburseID"] = int.Parse(this.ViewState["ObjectId"].ToString()); } }
protected bool IsBusinessProxy(int ProxyUserID, DateTime SubmitDate) { AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; ERS.ProxyReimburseDataTable tbProxy = new MasterDataBLL().GetProxyReimburseByParameter(ProxyUserID, stuffUser.StuffUserId, SubmitDate); if (tbProxy != null && tbProxy.Count > 0) { return(true); } return(false); }
public string GetProductNameByID(object skuID) { if (skuID.ToString() != string.Empty) { int id = Convert.ToInt32(skuID); ERS.SKURow sku = new MasterDataBLL().GetSKUById(id); return(sku.SKUNo + '-' + sku.SKUName + "-" + sku.Spec); } else { return(null); } }
public string GetExpenseItemNameByID(object expenseItemID) { if (expenseItemID.ToString() != string.Empty) { int id = Convert.ToInt32(expenseItemID); ERS.ExpenseItemRow row = new MasterDataBLL().GetExpenseItemByID(id); return(row.AccountingCode + "--" + row.ExpenseItemName); } else { return(null); } }
public void AddFormReimburseSKUDetail(int?FormReimburseID, int SKUID, decimal UnitPrice, decimal Quantity, string Remark) { FormDS.FormReimburseSKUDetailRow rowDetail = this.FormDataSet.FormReimburseSKUDetail.NewFormReimburseSKUDetailRow(); rowDetail.FormReimburseID = FormReimburseID.GetValueOrDefault(); rowDetail.SKUID = SKUID; ERS.SKURow sku = new MasterDataBLL().GetSKUById(SKUID); rowDetail.PackageQuantity = sku.PackageQuantity; rowDetail.UnitPrice = UnitPrice; rowDetail.Quantity = Quantity; rowDetail.Amount = UnitPrice * Quantity; rowDetail.Remark = Remark; // 填加行并进行更新处理 this.FormDataSet.FormReimburseSKUDetail.AddFormReimburseSKUDetailRow(rowDetail); }
public void UpdateFormReimburseSKUDetail(int FormReimburseSKUDetailID, int SKUID, decimal UnitPrice, decimal Quantity, string Remark) { FormDS.FormReimburseSKUDetailRow rowDetail = this.FormDataSet.FormReimburseSKUDetail.FindByFormReimburseSKUDetailID(FormReimburseSKUDetailID); if (rowDetail == null) { return; } rowDetail.SKUID = SKUID; ERS.SKURow sku = new MasterDataBLL().GetSKUById(SKUID); rowDetail.PackageQuantity = sku.PackageQuantity; rowDetail.UnitPrice = UnitPrice; rowDetail.Quantity = Quantity; rowDetail.Amount = UnitPrice * Quantity; rowDetail.Remark = Remark; }
public void AddFormReimburseDelivery(int FormReimburseSKUDetailID, string DeliveryNo, decimal DeliveryQuantity, DateTime DeliveryDate, string Remark) { FormDS.FormReimburseDeliveryDataTable table = new FormDS.FormReimburseDeliveryDataTable(); FormDS.FormReimburseDeliveryRow rowDetail = table.NewFormReimburseDeliveryRow(); rowDetail.FormReimburseSKUDetailID = FormReimburseSKUDetailID; rowDetail.DeliveryNo = DeliveryNo; rowDetail.DeliveryQuantity = DeliveryQuantity; rowDetail.DeliveryDate = DeliveryDate; FormDS.FormReimburseSKUDetailRow skuDetailRow = this.TAFormReimburseSKUDetail.GetDataByID(rowDetail.FormReimburseSKUDetailID)[0]; ERS.SKURow sku = new MasterDataBLL().GetSKUById(skuDetailRow.SKUID); rowDetail.DeliveryAmount = skuDetailRow.UnitPrice * DeliveryQuantity; rowDetail.DeliveryCost = sku.CostPrice * DeliveryQuantity; rowDetail.Remark = Remark; table.AddFormReimburseDeliveryRow(rowDetail); this.TAFormReimburseDelivery.Update(table); }
public void AddFormMaterialDetail(int?FormMaterialID, int MaterialID, decimal Quantity, string Remark) { FormDS.FormMaterialDetailRow rowDetail = this.FormDataSet.FormMaterialDetail.NewFormMaterialDetailRow(); rowDetail.FormMaterialID = FormMaterialID.GetValueOrDefault(); ERS.MaterialRow material = new MasterDataBLL().GetMaterialById(MaterialID); rowDetail.MaterialID = MaterialID; rowDetail.MaterialName = material.MaterialName; rowDetail.UOM = material.UOM; rowDetail.Description = material.Description; rowDetail.MaterialPrice = material.MaterialPrice; rowDetail.Quantity = Quantity; rowDetail.Amount = rowDetail.MaterialPrice * Quantity; rowDetail.Remark = Remark; // 填加行并进行更新处理 this.FormDataSet.FormMaterialDetail.AddFormMaterialDetailRow(rowDetail); }
protected void OpenForm(int formID) { FormTableAdapter taForm = new FormTableAdapter(); taForm.FillByID(this.InnerDS.Form, formID); FormDS.FormRow rowForm = this.InnerDS.Form[0]; FormApplyTableAdapter taFormApply = new FormApplyTableAdapter(); taFormApply.FillByID(this.InnerDS.FormApply, formID); FormDS.FormApplyRow rowFormApply = this.InnerDS.FormApply[0]; //赋值 this.ViewState["BeginPeriod"] = rowFormApply.BeginPeriod.ToShortDateString(); this.ViewState["EndPeriod"] = rowFormApply.EndPeriod.ToShortDateString(); this.BeginPeriodCtl.Text = rowFormApply.BeginPeriod.ToString("yyyy-MM"); this.EndPeriodCtl.Text = rowFormApply.EndPeriod.ToString("yyyy-MM"); this.ViewState["ExpenseSubCategoryID"] = rowFormApply.ExpenseSubCategoryID.ToString(); this.ExpenseSubCategoryCtl.Text = new MasterDataBLL().GetExpenseSubCateNameById(rowFormApply.ExpenseSubCategoryID); this.ViewState["CustomerID"] = rowFormApply.CustomerID.ToString(); ERS.CustomerRow customer = new MasterDataBLL().GetCustomerById(rowFormApply.CustomerID); this.CustomerNameCtl.Text = customer.CustomerName; //this.CustomerTypeCtl.Text = new MasterDataBLL().GetCustomerTypeById(customer.CustomerTypeID).CustomerTypeName; this.odsShop.SelectParameters["CustomerID"].DefaultValue = customer.CustomerID.ToString(); this.ShopDDL.SelectedValue = rowFormApply.ShopID.ToString(); this.PaymentTypeDDL.SelectedValue = rowFormApply.PaymentTypeID.ToString(); if (!rowFormApply.IsContractNoNull()) { this.ContractNoCtl.Text = rowFormApply.ContractNo; } if (!rowFormApply.IsRemarkNull()) { this.RemarkCtl.Text = rowFormApply.Remark; } if (!rowFormApply.IsAttachedFileNameNull()) { this.UCFileUpload.AttachmentFileName = rowFormApply.AttachedFileName; } if (!rowFormApply.IsRealAttachedFileNameNull()) { this.UCFileUpload.RealAttachmentFileName = rowFormApply.RealAttachedFileName; } if (!rowFormApply.IsFormApplyNameNull()) { this.txtFormApplyName.Text = rowFormApply.FormApplyName.ToString(); } }
public void UpdateFormReimburseDelivery(int FormReimburseDeliveryID, string DeliveryNo, decimal DeliveryQuantity, DateTime DeliveryDate, string Remark) { FormDS.FormReimburseDeliveryRow rowDetail = this.TAFormReimburseDelivery.GetDataByID(FormReimburseDeliveryID)[0]; if (rowDetail == null) { return; } rowDetail.DeliveryNo = DeliveryNo; rowDetail.DeliveryQuantity = DeliveryQuantity; rowDetail.DeliveryDate = DeliveryDate; FormDS.FormReimburseSKUDetailRow skuDetailRow = this.TAFormReimburseSKUDetail.GetDataByID(rowDetail.FormReimburseSKUDetailID)[0]; ERS.SKURow sku = new MasterDataBLL().GetSKUById(skuDetailRow.SKUID); rowDetail.DeliveryAmount = skuDetailRow.UnitPrice * DeliveryQuantity; rowDetail.DeliveryCost = sku.CostPrice * DeliveryQuantity; rowDetail.Remark = Remark; this.TAFormReimburseDelivery.Update(rowDetail); }
public void UpdateFormMaterialDetail(int FormMaterialDetailID, int MaterialID, decimal Quantity, string Remark) { FormDS.FormMaterialDetailDataTable table = this.FormDataSet.FormMaterialDetail; FormDS.FormMaterialDetailRow rowDetail = table.FindByFormMaterialDetailID(FormMaterialDetailID); if (rowDetail == null) { return; } ERS.MaterialRow material = new MasterDataBLL().GetMaterialById(MaterialID); rowDetail.MaterialID = MaterialID; rowDetail.MaterialName = material.MaterialName; rowDetail.UOM = material.UOM; rowDetail.Description = material.Description; rowDetail.MaterialPrice = material.MaterialPrice; rowDetail.Quantity = Quantity; rowDetail.Amount = rowDetail.MaterialPrice * Quantity; rowDetail.Remark = Remark; }
protected void Page_Load(object sender, EventArgs e) { this.Page.Title = "ϵͳ¹«¸æ"; MasterDataBLL bll = new MasterDataBLL(); ERS.BulletinRow bulletin = bll.GetBulletinById(int.Parse(Request["ObjectId"]))[0]; this.BulletinTitleLabel.Text = bulletin.BulletinTitle; this.BulletinContentCtl.Text = bulletin.BulletinContent; this.CreateTimeLabel.Text = bulletin.CreateTime.ToString("yyyy-MM-dd"); if (!bulletin.IsAttachFileNameNull()) { this.ViewUCFileUpload.AttachmentFileName = bulletin.AttachFileName; } if (!bulletin.IsRealAttachFileNameNull()) { this.ViewUCFileUpload.RealAttachmentFileName = bulletin.RealAttachFileName; } }
protected void SubCategoryDDL_SelectedIndexChanged(object sender, EventArgs e) { if (this.SubCategoryDDL.SelectedValue != "0") { ERS.ExpenseSubCategoryRow subCategory = new MasterDataBLL().GetExpenseSubCategoryById(int.Parse(this.SubCategoryDDL.SelectedValue)); if (subCategory.PageType == (int)SystemEnums.PageType.PromotionApply) { this.PromotionPriceTypeTD.Visible = true; } else { this.PromotionPriceTypeTD.Visible = false; } } else { this.PromotionPriceTypeTD.Visible = false; } }
private void SetComments() { if (this.ddlReject.SelectedValue != string.Empty) { int RejectReasonId = int.Parse(this.ddlReject.SelectedValue); MasterDataBLL bll = new MasterDataBLL(); ERS.RejectReasonDataTable rejectReasonDT = bll.GetRejectReasonById(RejectReasonId); if (rejectReasonDT != null && rejectReasonDT.Rows.Count > 0) { ERS.RejectReasonRow rejectReasonDr = rejectReasonDT[0]; txtComments.Text = rejectReasonDr.RejectReasonContent; } else { txtComments.Text = string.Empty; } } }
protected void SaveFormTravelReimburse(SystemEnums.FormStatus StatusID) { this.PersonalReimburseBLL.FormDataSet = this.InnerDS; int?RejectedFormID = null; if (this.ViewState["RejectedObjectID"] != null) { RejectedFormID = (int)this.ViewState["RejectedObjectID"]; } int UserID = (int)this.ViewState["StuffUserID"]; int?ProxyStuffUserId = null; if (Session["ProxyStuffUserId"] != null) { ProxyStuffUserId = int.Parse(Session["ProxyStuffUserId"].ToString()); } int OrganizationUnitID = (int)this.ViewState["DepartmentID"]; int PositionID = (int)this.ViewState["PositionID"]; DateTime Period = new MasterDataBLL().GetReimbursePeriodById(int.Parse(this.PeriodDDL.SelectedValue)).ReimbursePeriod; string Remark = this.RemarkCtl.Text; string AttachedFileName = this.UCFileUpload.AttachmentFileName; string RealAttachedFileName = this.UCFileUpload.RealAttachmentFileName; try { if (this.ViewState["ObjectId"] == null || RejectedFormID != null) { this.PersonalReimburseBLL.AddFormTravelReimburse(RejectedFormID, UserID, ProxyStuffUserId, null, OrganizationUnitID, PositionID, SystemEnums.FormType.PersonalReimburseApply, StatusID, Period, Remark, AttachedFileName, RealAttachedFileName, (int)this.ViewState["FormTravelApplyID"]); } else { int FormID = (int)this.ViewState["ObjectId"]; this.PersonalReimburseBLL.UpdateFormTravelReimburse(FormID, StatusID, SystemEnums.FormType.PersonalReimburseApply, Period, Remark, AttachedFileName, RealAttachedFileName); } this.Page.Response.Redirect("~/Home.aspx"); } catch (Exception ex) { PageUtility.DealWithException(this.Page, ex); } }
protected void gvExpense_RowDataBound(object sender, GridViewRowEventArgs e) { // 对数据列进行赋值 if (e.Row.RowType == DataControlRowType.DataRow) { ERS.ExpenseItemRow itemRow = null; if ((e.Row.RowState & DataControlRowState.Edit) != DataControlRowState.Edit) { DataRowView drvDetail = (DataRowView)e.Row.DataItem; FormDS.FormApplyExpenseDetailRow row = (FormDS.FormApplyExpenseDetailRow)drvDetail.Row; manualApplyFeeTotal = decimal.Round((manualApplyFeeTotal + row.Amount), 2); this.ViewState["ManualApplyFeeTotal"] = manualApplyFeeTotal; itemRow = new MasterDataBLL().GetExpenseItemByID(row.ExpenseItemID); if (itemRow.IsInContract) { inContractAmount = decimal.Round((inContractAmount + row.Amount), 2); } } } this.ViewState["InContractAmount"] = inContractAmount; }
protected void gvApplyDetails_RowDataBound(object sender, GridViewRowEventArgs e) { // 对数据列进行赋值 if (e.Row.RowType == DataControlRowType.DataRow) { ERS.ExpenseItemRow itemRow = null; if ((e.Row.RowState & DataControlRowState.Edit) != DataControlRowState.Edit) { DataRowView drvDetail = (DataRowView)e.Row.DataItem; FormDS.FormApplyDetailViewRow row = (FormDS.FormApplyDetailViewRow)drvDetail.Row; manualApplyFeeTotal = decimal.Round((manualApplyFeeTotal + row.Amount), 2); itemRow = new MasterDataBLL().GetExpenseItemByID(row.ExpenseItemID); if (itemRow.IsInContract) { inContractAmount = decimal.Round((inContractAmount + row.Amount), 2); } } } this.ViewState["ManualApplyFeeTotal"] = manualApplyFeeTotal; this.ViewState["InContractAmount"] = inContractAmount; if (e.Row.RowType == DataControlRowType.Footer) { Label sumlbl = new Label(); sumlbl.Text = "合计:"; e.Row.Cells[1].Controls.Add(sumlbl); e.Row.Cells[1].CssClass = "RedTextAlignCenter"; e.Row.Cells[1].HorizontalAlign = HorizontalAlign.Center; e.Row.Cells[1].Width = new Unit("250px"); Label totallbl = new Label(); totallbl.Text = manualApplyFeeTotal.ToString("N"); e.Row.Cells[2].Controls.Add(totallbl); e.Row.Cells[2].CssClass = "RedTextAlignCenter"; e.Row.Cells[2].HorizontalAlign = HorizontalAlign.Right; e.Row.Cells[2].Width = new Unit("100px"); } }
protected void odsMaterialDetails_Inserting(object sender, ObjectDataSourceMethodEventArgs e) { UserControls_MaterialControl newUCMaterial = (UserControls_MaterialControl)this.fvMaterialDetails.FindControl("newUCMaterial"); if (newUCMaterial.MaterialID == string.Empty) { PageUtility.ShowModelDlg(this.Page, "请选择广宣物资"); e.Cancel = true; return; } TextBox newQuantityCtl = (TextBox)this.fvMaterialDetails.FindControl("newQuantityCtl"); ERS.MaterialRow material = new MasterDataBLL().GetMaterialById(int.Parse(newUCMaterial.MaterialID)); if (decimal.Parse(newQuantityCtl.Text) < material.MinimumNumber) { PageUtility.ShowModelDlg(this.Page, "申请数量不能小于最小领用数量(" + material.MinimumNumber.ToString() + ")"); e.Cancel = true; return; } if (this.ViewState["ObjectId"] != null) { e.InputParameters["FormMaterialID"] = int.Parse(this.ViewState["ObjectId"].ToString()); } }
public void SaveDataToDB(string FullPath, string FileName, string excelFileExtension) { SqlTransaction transaction = null; try { DataTable dt = null; dt = this.GetDataSet(FullPath, excelFileExtension).Tables[0]; if (dt.Rows.Count <= 1) { PageUtility.ShowModelDlg(this.Page, "文件中没有任何记录,请重新选择"); return; } ShopTableAdapter TAShop = new ShopTableAdapter(); ImportLogTableAdapter TAImportLog = new ImportLogTableAdapter(); ImportLogDetailTableAdapter TAImportLogDetail = new ImportLogDetailTableAdapter(); MasterDataBLL mdBLL = new MasterDataBLL(); transaction = TableAdapterHelper.BeginTransaction(TAShop); TableAdapterHelper.SetTransaction(TAImportLog, transaction); TableAdapterHelper.SetTransaction(TAImportLogDetail, transaction); //存储log信息 ImportDS.ImportLogDataTable logTable = new ImportDS.ImportLogDataTable(); ImportDS.ImportLogRow logRow = logTable.NewImportLogRow(); int stuffUserID = ((AuthorizationDS.StuffUserRow)Session["StuffUser"]).StuffUserId; string fullname = this.fileUpLoad.PostedFile.FileName.ToString(); string tmpFile = fullname.Remove(0, fullname.LastIndexOf("\\") + 1); logRow.FileName = tmpFile; logRow.ImportDate = DateTime.Now; logRow.ImportUserID = stuffUserID; logRow.ImportType = 4; logRow.TotalCount = dt.Rows.Count - 1; logRow.SuccessCount = dt.Rows.Count - 1; logRow.FailCount = 0; logTable.AddImportLogRow(logRow); TAImportLog.Update(logTable); //处理每条明细 ERS.ShopDataTable tbShop = new ERS.ShopDataTable(); ImportDS.ImportLogDetailDataTable ImportLogDetailTable = new ImportDS.ImportLogDetailDataTable(); int row_count = dt.Rows.Count; string errorInfor = string.Empty; // int expenseTypeID = int.Parse(ExpenseTypeDDL.SelectedValue); //开始处理每条明细 for (int i = 1; i <= row_count - 1; i++) { if (CheckData(dt.Rows[i]) != null) { errorInfor = "第" + (i + 1) + "行有错:" + CheckData(dt.Rows[i]); ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } else { DataRow row = dt.Rows[i]; string ShopName = row[0].ToString().Trim(); string ShopNo = row[1].ToString().Trim(); string CustomerName = row[2].ToString().Trim(); string ShopLevelName = row[3].ToString().Trim(); string Address = row[4].ToString().Trim(); string Contacter = row[5].ToString().Trim(); string Telephone = row[6].ToString().Trim(); string Email = row[7].ToString().Trim(); ERS.CustomerDataTable tbCustomer = mdBLL.GetCustomerByCustomerName(CustomerName); if (tbCustomer == null || tbCustomer.Count == 0) { errorInfor = "第" + (i + 1) + "行有错:找不到客户《" + CustomerName + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } ERS.ShopLevelDataTable tbShopLevel = mdBLL.GetShopLevelByShopLevelName(ShopLevelName); if (tbShopLevel == null || tbShopLevel.Count == 0) { errorInfor = "第" + (i + 1) + "行有错:找不到门店等级《" + ShopLevelName + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } int iCount = (int)new ShopTableAdapter().SearchNameByIns(ShopName, tbCustomer[0].CustomerID, tbShopLevel[0].ShopLevelID); if (iCount > 0) { errorInfor = string.Format("第" + (i + 1) + "行有错:同一客户,同一门店等级({0})下门店名称({1})不能重复!", tbShopLevel[0].ShopLevelName, ShopName); ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } ERS.ShopRow rowShop = tbShop.NewShopRow(); //string ShopName = row[0].ToString().Trim(); //string ShopNo = row[1].ToString().Trim(); //string CustomerNo = row[2].ToString().Trim(); //string CustomerName = row[3].ToString().Trim(); //string ShopLevelName = row[4].ToString().Trim(); //string Address = row[5].ToString().Trim(); //string Contacter = row[6].ToString().Trim(); //string Telephone = row[7].ToString().Trim(); //string Email = row[8].ToString().Trim(); rowShop.ShopName = ShopName; rowShop.ShopNo = ShopNo; rowShop.CustomerID = tbCustomer[0].CustomerID; rowShop.ShopLevelID = tbShopLevel[0].ShopLevelID; rowShop.Address = Address; rowShop.Contacter = Contacter; rowShop.Tel = Telephone; rowShop.Email = Email; rowShop.IsActive = true; tbShop.AddShopRow(rowShop); TAShop.Update(rowShop); } } TAImportLog.Update(logRow); TAImportLogDetail.Update(ImportLogDetailTable); transaction.Commit(); string returnString = "成功导入" + logRow.SuccessCount.ToString() + "条信息"; PageUtility.ShowModelDlg(this.Page, returnString); } catch (Exception ex) { if (transaction != null) { transaction.Rollback(); } PageUtility.ShowModelDlg(this.Page, "Save Fail!" + ex.ToString()); } finally { if (transaction != null) { transaction.Dispose(); } } }
public string GetExpenseItemNameByID(object Id) { //return new MasterDataBLL().GetExpenseItemByID((int)Id).ExpenseItemName; ERS.ExpenseItemRow row = new MasterDataBLL().GetExpenseItemByID((int)Id); return(row.AccountingCode + "--" + row.ExpenseItemName); }
public void SaveDataToDB(string FullPath, string FileName, string excelFileExtension) { SqlTransaction transaction = null; try { DataTable dt = null; dt = this.GetDataSet(FullPath, excelFileExtension).Tables[0]; if (dt.Rows.Count <= 1) { PageUtility.ShowModelDlg(this.Page, "文件中没有任何记录,请重新选择"); return; } BudgetSalesFeeTableAdapter TABudgetSalesFee = new BudgetSalesFeeTableAdapter(); ImportLogTableAdapter TAImportLog = new ImportLogTableAdapter(); ImportLogDetailTableAdapter TAImportLogDetail = new ImportLogDetailTableAdapter(); transaction = TableAdapterHelper.BeginTransaction(TABudgetSalesFee); TableAdapterHelper.SetTransaction(TAImportLog, transaction); TableAdapterHelper.SetTransaction(TAImportLogDetail, transaction); //存储log信息 ImportDS.ImportLogDataTable logTable = new ImportDS.ImportLogDataTable(); ImportDS.ImportLogRow logRow = logTable.NewImportLogRow(); int stuffUserID = ((AuthorizationDS.StuffUserRow)Session["StuffUser"]).StuffUserId; string fullname = this.fileUpLoad.PostedFile.FileName.ToString(); string tmpFile = fullname.Remove(0, fullname.LastIndexOf("\\") + 1); logRow.FileName = tmpFile; logRow.ImportDate = DateTime.Now; logRow.ImportUserID = stuffUserID; logRow.ImportType = 2; logRow.TotalCount = dt.Rows.Count - 1; logRow.SuccessCount = dt.Rows.Count - 1; logRow.FailCount = 0; logTable.AddImportLogRow(logRow); TAImportLog.Update(logTable); //处理每条明细 BudgetDS.BudgetSalesFeeDataTable BudgetSalesTable = new BudgetDS.BudgetSalesFeeDataTable(); ImportDS.ImportLogDetailDataTable ImportLogDetailTable = new ImportDS.ImportLogDetailDataTable(); int row_count = dt.Rows.Count; string errorInfor = string.Empty; // int expenseTypeID = int.Parse(ExpenseTypeDDL.SelectedValue); //开始处理每条明细 for (int i = 1; i <= row_count - 1; i++) { if (CheckData(dt.Rows[i]) != null) { errorInfor = "第" + (i + 1) + "行有错:" + CheckData(dt.Rows[i]); ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } else { DataRow row = dt.Rows[i]; string CustomerName = row[0].ToString().Trim(); string CustomerNo = row[1].ToString().Trim(); string Period_Year = row[2].ToString().Trim(); string Period_Month = row[3].ToString().Trim(); string AccountingCode = row[4].ToString().Trim(); string ExpenseManageType = row[5].ToString().Trim(); string OriginalBudget = row[6].ToString().Trim(); string NormalBudget = row[7].ToString().Trim(); string AdjustBudget = row[8].ToString().Trim(); string TransferBudget = row[9].ToString().Trim(); string Remark = row[11].ToString().Trim(); ERS.CustomerDataTable customerTable = new MasterDataBLL().GetCustomerPaged(0, 20, string.Format("CustomerNo='{0}'", CustomerNo), null); if (customerTable == null || customerTable.Count == 0) { errorInfor = "第" + (i + 1) + "行有错:系统中找不到此客户《" + CustomerNo + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } else if (customerTable.Count > 1) { errorInfor = "第" + (i + 1) + "行有错:系统中找到多个此编号的客户《" + CustomerNo + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } else { ERS.ExpenseItemDataTable expenseItemTable = new MasterDataBLL().GetExpenseItemPaged(0, 20, null, string.Format("AccountingCode='{0}'", AccountingCode)); if (expenseItemTable == null || expenseItemTable.Count == 0) { errorInfor = "第" + (i + 1) + "行有错:系统中找不到此费用类别《" + AccountingCode + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } else if (expenseItemTable.Count > 1) { errorInfor = "第" + (i + 1) + "行有错:系统中找到多个此费用类别《" + AccountingCode + "》"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } else { string temp = Period_Year + "-" + Period_Month + "-01"; string filter = string.Format("CustomerID = {0} and ExpenseItemID= {1} and Period = '{2}'", customerTable[0].CustomerID, expenseItemTable[0].ExpenseItemID, DateTime.Parse(Period_Year + "-" + Period_Month + "-01")); if (new BudgetBLL().GetPagedBudgetSalesFee(filter, 0, 20, null).Count > 0) { errorInfor = "第" + (i + 1) + "行有错:系统中已经存在本年月的预算信息,请在系统中直接更新"; ImportDS.ImportLogDetailRow ImportDetailRow = ImportLogDetailTable.NewImportLogDetailRow(); ImportDetailRow.LogID = logRow.LogID; ImportDetailRow.Line = i + 1; ImportDetailRow.Error = errorInfor; ImportLogDetailTable.AddImportLogDetailRow(ImportDetailRow); logRow.FailCount = logRow.FailCount + 1; logRow.SuccessCount = logRow.SuccessCount - 1; TAImportLog.Update(logRow); continue; } else { BudgetDS.BudgetSalesFeeRow BudgetSalesRow = BudgetSalesTable.NewBudgetSalesFeeRow(); BudgetSalesRow.CustomerID = customerTable[0].CustomerID; BudgetSalesRow.Period = DateTime.Parse(Period_Year + "-" + Period_Month + "-01"); BudgetSalesRow.ExpenseItemID = expenseItemTable[0].ExpenseItemID; BudgetSalesRow.OriginalBudget = decimal.Parse(OriginalBudget); BudgetSalesRow.NormalBudget = decimal.Parse(NormalBudget); BudgetSalesRow.AdjustBudget = decimal.Parse(AdjustBudget); BudgetSalesRow.TransferBudget = decimal.Parse(TransferBudget); BudgetSalesRow.TotalBudget = decimal.Round(BudgetSalesRow.NormalBudget + BudgetSalesRow.AdjustBudget, 2); BudgetSalesRow.ModifyReason = Remark; BudgetSalesTable.AddBudgetSalesFeeRow(BudgetSalesRow); } } } } } TAImportLog.Update(logRow); TAImportLogDetail.Update(ImportLogDetailTable); TABudgetSalesFee.Update(BudgetSalesTable); transaction.Commit(); string returnString = "成功导入" + logRow.SuccessCount.ToString() + "条信息"; PageUtility.ShowModelDlg(this.Page, returnString); } catch (Exception ex) { if (transaction != null) { transaction.Rollback(); } PageUtility.ShowModelDlg(this.Page, "Save Fail!" + ex.ToString()); } finally { if (transaction != null) { transaction.Dispose(); } } }
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; FormDS.FormRow rowForm = this.SalesApplyBLL.GetFormByID(formID)[0]; FormDS.FormApplyRow rowFormApply = this.SalesApplyBLL.GetFormApplyByID(formID)[0]; if (rowForm.IsProcIDNull()) { ViewState["ProcID"] = ""; } else { ViewState["ProcID"] = rowForm.ProcID; } ViewState["OrganizationUnitID"] = rowForm.OrganizationUnitID; this.FormNoCtl.Text = rowForm.FormNo; this.ApplyDateCtl.Text = rowForm.SubmitDate.ToShortDateString(); 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(); this.BeginPeriodCtl.Text = rowFormApply.BeginPeriod.ToString("yyyy-MM"); this.EndPeriodCtl.Text = rowFormApply.EndPeriod.ToString("yyyy-MM"); MasterDataBLL masterBll = new MasterDataBLL(); this.ExpenseSubCategoryCtl.Text = masterBll.GetExpenseSubCateNameById(rowFormApply.ExpenseSubCategoryID); ERS.CustomerRow customer = masterBll.GetCustomerById(rowFormApply.CustomerID); this.CustomerNameCtl.Text = customer.CustomerName; //this.CustomerTypeCtl.Text = masterBll.GetCustomerTypeById(customer.CustomerTypeID).CustomerTypeName; this.ShopNameCtl.Text = masterBll.GetShopByID(rowFormApply.ShopID).ShopName; this.PaymentTypeCtl.Text = masterBll.GetPaymentTypeById(rowFormApply.PaymentTypeID).PaymentTypeName; if (!rowFormApply.IsContractNoNull()) { this.ContractNoCtl.Text = rowFormApply.ContractNo; } this.AmountCtl.Text = rowFormApply.Amount.ToString("N"); if (!rowFormApply.IsRemarkNull()) { this.RemarkCtl.Text = rowFormApply.Remark; } if (!rowFormApply.IsAttachedFileNameNull()) { this.UCFileUpload.AttachmentFileName = rowFormApply.AttachedFileName; } if (!rowFormApply.IsRealAttachedFileNameNull()) { this.UCFileUpload.RealAttachmentFileName = rowFormApply.RealAttachedFileName; } if (!rowFormApply.IsPromotionBeginDateNull()) { this.PromotionBeginCtl.Text = rowFormApply.PromotionBeginDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsPromotionEndDateNull()) { this.PromotionEndCtl.Text = rowFormApply.PromotionEndDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsDeliveryBeginDateNull()) { this.DeliveryBeginCtl.Text = rowFormApply.DeliveryBeginDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsDeliveryEndDateNull()) { this.DeliveryEndCtl.Text = rowFormApply.DeliveryEndDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsFormApplyNameNull()) { this.txtFormApplyName.Text = rowFormApply.FormApplyName; } this.PromotionScopeCtl.Text = masterBll.GetPromotionScopeById(rowFormApply.PromotionScopeID).PromotionScopeName; this.PromotionTypeCtl.Text = masterBll.GetPromotionTypeById(rowFormApply.PromotionTypeID).PromotionTypeName; if (!rowFormApply.IsPromotionDescNull()) { this.PromotionDescCtl.Text = rowFormApply.PromotionDesc; } this.ShelfTypeCtl.Text = masterBll.GetShelfTypeById(rowFormApply.ShelfTypeID).ShelfTypeName; if (!rowFormApply.IsFirstVolumeNull()) { this.FirstVolumeCtl.Text = rowFormApply.FirstVolume.ToString(); } if (!rowFormApply.IsSecondVolumeNull()) { this.SecondVolumeCtl.Text = rowFormApply.SecondVolume.ToString(); } if (!rowFormApply.IsThirdVolumeNull()) { this.ThirdVolumeCtl.Text = rowFormApply.ThirdVolume.ToString(); } if (!rowFormApply.IsAverageVolumeNull()) { this.AverageVolumeCtl.Text = rowFormApply.AverageVolume.ToString(); } if (!rowFormApply.IsReimburseRequirementsNull()) { int ReimburseRequirement = rowFormApply.ReimburseRequirements; if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.Picture) == (int)SystemEnums.ReimburseRequirements.Picture) { chkListReimburseRequirements.Items[0].Selected = true; } if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.Agreement) == (int)SystemEnums.ReimburseRequirements.Agreement) { chkListReimburseRequirements.Items[1].Selected = true; } if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.DeliveryOrder) == (int)SystemEnums.ReimburseRequirements.DeliveryOrder) { chkListReimburseRequirements.Items[2].Selected = true; } if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.Contract) == (int)SystemEnums.ReimburseRequirements.Contract) { chkListReimburseRequirements.Items[3].Selected = true; } if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.DM) == (int)SystemEnums.ReimburseRequirements.DM) { chkListReimburseRequirements.Items[4].Selected = true; } if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.Other) == (int)SystemEnums.ReimburseRequirements.Other) { chkListReimburseRequirements.Items[5].Selected = true; } } //历史单据 if (rowForm.IsRejectedFormIDNull()) { lblRejectFormNo.Text = "无"; } else { FormDS.FormRow rejectedForm = new SalesApplyBLL().GetFormByID(rowForm.RejectedFormID)[0]; this.lblRejectFormNo.Text = rejectedForm.FormNo; this.lblRejectFormNo.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/SalesForm/SalesGeneralApproval.aspx?ShowDialog=1&ObjectId=" + rejectedForm.FormID + "','', 'dialogWidth:1000px;dialogHeight:750px;resizable:yes;')"; } //查看预算信息按钮 this.btnViewBudget.NavigateUrl = "javascript:window.showModalDialog('" + System.Configuration.ConfigurationManager.AppSettings["WebSiteUrl"] + "/ReportManage/SalesBudgetByPosition.aspx?ShowDialog=1','', 'dialogWidth:918px;dialogHeight:660px;resizable:yes;')"; //预算信息 this.CustomerBudgetCtl.Text = rowFormApply.CustomerBudget.ToString("N"); this.CustomerBudgetRemainCtl.Text = rowFormApply.CustomerBudgetRemain.ToString("N"); this.OUBudgetCtl.Text = rowFormApply.OUBudget.ToString("N"); this.OUApprovedAmountCtl.Text = rowFormApply.OUAppovedAmount.ToString("N"); this.OUApprovingAmountCtl.Text = rowFormApply.OUApprovingAmount.ToString("N"); this.OUCompletedAmountCtl.Text = rowFormApply.OUCompletedAmount.ToString("N"); this.OUReimbursedAmountCtl.Text = rowFormApply.OUReimbursedAmount.ToString("N"); this.OUBudgetRemainCtl.Text = rowFormApply.OUBudgetRemain.ToString("N"); this.OUBudgetRateCtl.Text = ((decimal)(rowFormApply.OUBudgetRate * 100)).ToString("N") + "%"; this.odsSKU.SelectParameters["FormApplyID"].DefaultValue = rowFormApply.FormApplyID.ToString(); //审批页面处理&按钮处理 AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; this.ViewState["StuffUserID"] = stuffUser.StuffUserId; if (rowForm.InTurnUserIds.Contains("P" + stuffUser.StuffUserId + "P")) { this.SubmitBtn.Visible = true; this.cwfAppCheck.IsView = false; this.ViewState["IsView"] = false; } else { this.SubmitBtn.Visible = false; this.cwfAppCheck.IsView = true; this.ViewState["IsView"] = true; } if (rowForm.StatusID == (int)SystemEnums.FormStatus.Rejected && stuffUser.StuffUserId == rowForm.UserID) { this.EditBtn.Visible = true; this.ScrapBtn.Visible = true; } else { this.EditBtn.Visible = false; this.ScrapBtn.Visible = false; } //是否显示复制按钮 if (rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted && stuffUser.StuffUserId == rowForm.UserID) { this.UCBeginPeriod.Visible = true; this.UCEndPeriod.Visible = true; this.lblSignal.Visible = true; this.CopyBtn.Visible = true; } else { this.UCBeginPeriod.Visible = false; this.UCEndPeriod.Visible = false; this.lblSignal.Visible = false; this.CopyBtn.Visible = false; } //是否显示打印信息 if (((stuffUser.StuffUserId == rowForm.UserID || base.IsBusinessProxy(rowForm.UserID, rowForm.SubmitDate) && (rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted) || rowForm.StatusID == (int)SystemEnums.FormStatus.Scrap && rowFormApply.IsAutoSplit))) { this.PrintBtn.Visible = true; } else { this.PrintBtn.Visible = false; } if (rowForm.StatusID == (int)SystemEnums.FormStatus.ApproveCompleted || (rowForm.StatusID == (int)SystemEnums.FormStatus.Scrap && rowFormApply.IsAutoSplit)) { this.PrintInfor.Visible = true; int printCount = rowFormApply.IsPrintCountNull() ? 0 : rowFormApply.PrintCount; this.PrintInfor.Text = "该方案已经被打印" + printCount + "次"; } else { this.PrintInfor.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.PrintInfor.Visible = false; this.PrintBtn.Visible = false; } } //如果是申请人则隐藏预算信息 if (stuffUser.StuffUserId == rowForm.UserID) { this.OUBudgetCtl.Text = ""; this.OUApprovedAmountCtl.Text = ""; this.OUApprovingAmountCtl.Text = ""; this.OUCompletedAmountCtl.Text = ""; this.OUReimbursedAmountCtl.Text = ""; this.OUBudgetRemainCtl.Text = ""; this.OUBudgetRateCtl.Text = ""; this.btnViewBudget.Visible = false; } //分摊比例 new FormApplySplitRateTableAdapter().FillByApplyID(InnerDS.FormApplySplitRate, formID); if (InnerDS.FormApplySplitRate != null && InnerDS.FormApplySplitRate.Count > 0) { this.divSplitRate.Visible = true; this.gvSplitRate.Visible = true; this.gvSplitRate.DataSource = InnerDS.FormApplySplitRate; this.gvSplitRate.DataBind(); } } this.cwfAppCheck.FormID = (int)this.ViewState["ObjectId"]; this.cwfAppCheck.ProcID = this.ViewState["ProcID"].ToString(); this.cwfAppCheck.IsView = (bool)this.ViewState["IsView"]; }
protected void Page_Load(object sender, EventArgs e) { base.Page_Load(sender, e); if (!this.IsPostBack) { PageUtility.SetContentTitle(this.Page, "方案申请"); this.Page.Title = "方案申请"; // 用户信息,职位信息 AuthorizationDS.StuffUserRow stuffUser = (AuthorizationDS.StuffUserRow)Session["StuffUser"]; AuthorizationDS.PositionRow rowUserPosition = (AuthorizationDS.PositionRow)Session["Position"]; this.ViewState["StuffUserID"] = stuffUser.StuffUserId; this.ViewState["PositionID"] = rowUserPosition.PositionId; this.ViewState["FlowTemplate"] = new AuthorizationBLL().GetFlowTemplate((int)SystemEnums.BusinessUseCase.FormApply, stuffUser.StuffUserId); this.StuffNameCtl.Text = stuffUser.StuffName; this.PositionNameCtl.Text = rowUserPosition.PositionName; this.DepartmentNameCtl.Text = new OUTreeBLL().GetOrganizationUnitById(rowUserPosition.OrganizationUnitId).OrganizationUnitName; this.ViewState["DepartmentID"] = rowUserPosition.OrganizationUnitId; this.AttendDateCtl.Text = stuffUser.AttendDate.ToShortDateString(); 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; } OpenForm(int.Parse(this.ViewState["ObjectId"].ToString())); } else { this.DeleteBtn.Visible = false; if (Request["CustomerID"] != null) { this.ViewState["CustomerID"] = Request["CustomerID"]; } else { this.Session["ErrorInfor"] = "未找到客户,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["BeginPeriod"] != null && Request["EndPeriod"] != null) { this.ViewState["BeginPeriod"] = Request["BeginPeriod"]; this.ViewState["EndPeriod"] = Request["EndPeriod"]; } else { this.Session["ErrorInfor"] = "没有费用期间,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["ExpenseSubCategoryID"] != null) { this.ViewState["ExpenseSubCategoryID"] = Request["ExpenseSubCategoryID"]; } else { this.Session["ErrorInfor"] = "未找到费用小类,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } if (Request["PromotionPriceType"] != null) { this.ViewState["PromotionPriceType"] = Request["PromotionPriceType"]; } else { this.Session["ErrorInfor"] = "未找到产品促销类型,请联系管理员"; Response.Redirect("~/ErrorPage/SystemErrorPage.aspx"); } this.BeginPeriodCtl.Text = DateTime.Parse(this.ViewState["BeginPeriod"].ToString()).ToString("yyyy-MM"); this.EndPeriodCtl.Text = DateTime.Parse(this.ViewState["EndPeriod"].ToString()).ToString("yyyy-MM"); this.ExpenseSubCategoryCtl.Text = new MasterDataBLL().GetExpenseSubCateNameById(int.Parse(this.ViewState["ExpenseSubCategoryID"].ToString())); ERS.CustomerRow customer = new MasterDataBLL().GetCustomerById(int.Parse(this.ViewState["CustomerID"].ToString())); this.CustomerNameCtl.Text = customer.CustomerName; //this.CustomerTypeCtl.Text = new MasterDataBLL().GetCustomerTypeById(customer.CustomerTypeID).CustomerTypeName; this.odsShop.SelectParameters["CustomerID"].DefaultValue = customer.CustomerID.ToString(); CommonUtility.InitSplitRate(InnerDS.FormApplySplitRate, DateTime.Parse(this.ViewState["BeginPeriod"].ToString()), DateTime.Parse(this.ViewState["EndPeriod"].ToString())); } //判断费用期间是否正确 MasterDataBLL bll = new MasterDataBLL(); if (!bll.IsValidApplyYear(DateTime.Parse(this.ViewState["BeginPeriod"].ToString()).AddMonths(-3).Year)) { this.SubmitBtn.Visible = false; PageUtility.ShowModelDlg(this, "不允许申请本财年项目,请联系财务部!"); return; } //处理促销供货价和买送哪个可以填写 if (this.ViewState["PromotionPriceType"].ToString() == ((int)SystemEnums.PromotionPriceType.Promotion).ToString()) { this.IsPromotionReadOnly = false; this.IsGiveReadOnly = true; } else { this.IsPromotionReadOnly = true; this.IsGiveReadOnly = false; } this.ExpenseSubCategoryID.Value = this.ViewState["ExpenseSubCategoryID"].ToString(); if (InnerDS.FormApplySplitRate != null && InnerDS.FormApplySplitRate.Count > 0) { this.divSplitRate.Visible = true; this.gvSplitRate.Visible = true; this.gvSplitRate.DataSource = InnerDS.FormApplySplitRate; this.gvSplitRate.DataBind(); } //预算信息 decimal[] calculateAssistant = new decimal[14]; calculateAssistant = new BudgetBLL().GetSalesBudgetByParameter(int.Parse(this.ViewState["CustomerID"].ToString()), DateTime.Parse(this.ViewState["BeginPeriod"].ToString()), int.Parse(this.ViewState["ExpenseSubCategoryID"].ToString())); this.CustomerBudgetCtl.Text = calculateAssistant[0].ToString("N"); this.CustomerBudgetRemainCtl.Text = calculateAssistant[5].ToString("N"); this.OUBudgetCtl.Text = calculateAssistant[7].ToString("N"); this.OUApprovedAmountCtl.Text = calculateAssistant[8].ToString("N"); this.OUApprovingAmountCtl.Text = calculateAssistant[9].ToString("N"); this.OUCompletedAmountCtl.Text = calculateAssistant[10].ToString("N"); this.OUReimbursedAmountCtl.Text = calculateAssistant[11].ToString("N"); this.OUBudgetRemainCtl.Text = calculateAssistant[12].ToString("N"); this.OUBudgetRateCtl.Text = ((decimal)(calculateAssistant[13] * 100)).ToString("N") + "%"; InitCustomerTimesLimit(); if (Session["ProxyStuffUserId"] != null) { this.SubmitBtn.Visible = false; } } else { this.ExpenseItemRemainTimes = (Dictionary <int, object[]>) this.ViewState["ExpenseItemRemainTimes"]; } //隐藏预算信息 this.OUBudgetCtl.Text = ""; this.OUApprovedAmountCtl.Text = ""; this.OUApprovingAmountCtl.Text = ""; this.OUCompletedAmountCtl.Text = ""; this.OUReimbursedAmountCtl.Text = ""; this.OUBudgetRemainCtl.Text = ""; this.OUBudgetRateCtl.Text = ""; if (setEditRowIndex) { this.SKUListView.EditIndex = this.SKUListView.DataKeys.Count - 1; setEditRowIndex = false; } }
protected void OpenForm(int formID) { FormTableAdapter taForm = new FormTableAdapter(); taForm.FillByID(this.InnerDS.Form, formID); FormDS.FormRow rowForm = this.InnerDS.Form[0]; FormApplyTableAdapter taFormApply = new FormApplyTableAdapter(); taFormApply.FillByID(this.InnerDS.FormApply, formID); FormDS.FormApplyRow rowFormApply = this.InnerDS.FormApply[0]; //赋值 this.ViewState["BeginPeriod"] = rowFormApply.BeginPeriod.ToShortDateString(); this.ViewState["EndPeriod"] = rowFormApply.EndPeriod.ToShortDateString(); this.BeginPeriodCtl.Text = rowFormApply.BeginPeriod.ToString("yyyy-MM"); this.EndPeriodCtl.Text = rowFormApply.EndPeriod.ToString("yyyy-MM"); this.ViewState["ExpenseSubCategoryID"] = rowFormApply.ExpenseSubCategoryID.ToString(); this.ExpenseSubCategoryCtl.Text = new MasterDataBLL().GetExpenseSubCateNameById(rowFormApply.ExpenseSubCategoryID); this.ViewState["CustomerID"] = rowFormApply.CustomerID.ToString(); ERS.CustomerRow customer = new MasterDataBLL().GetCustomerById(rowFormApply.CustomerID); this.CustomerNameCtl.Text = customer.CustomerName; //this.CustomerTypeCtl.Text = new MasterDataBLL().GetCustomerTypeById(customer.CustomerTypeID).CustomerTypeName; this.odsShop.SelectParameters["CustomerID"].DefaultValue = customer.CustomerID.ToString(); this.ViewState["PromotionPriceType"] = rowFormApply.PromotionPriceType.ToString(); this.ShopDDL.SelectedValue = rowFormApply.ShopID.ToString(); this.PaymentTypeDDL.SelectedValue = rowFormApply.PaymentTypeID.ToString(); if (!rowFormApply.IsContractNoNull()) { this.ContractNoCtl.Text = rowFormApply.ContractNo; } if (!rowFormApply.IsRemarkNull()) { this.RemarkCtl.Text = rowFormApply.Remark; } if (!rowFormApply.IsAttachedFileNameNull()) { this.UCFileUpload.AttachmentFileName = rowFormApply.AttachedFileName; } if (!rowFormApply.IsRealAttachedFileNameNull()) { this.UCFileUpload.RealAttachmentFileName = rowFormApply.RealAttachedFileName; } if (!rowFormApply.IsPromotionBeginDateNull()) { this.UCPromotionBegin.SelectedDate = rowFormApply.PromotionBeginDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsPromotionEndDateNull()) { this.UCPromotionEnd.SelectedDate = rowFormApply.PromotionEndDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsDeliveryBeginDateNull()) { this.UCDeliveryBegin.SelectedDate = rowFormApply.DeliveryBeginDate.ToString("yyyy-MM-dd"); } if (!rowFormApply.IsDeliveryEndDateNull()) { this.UCDeliveryEnd.SelectedDate = rowFormApply.DeliveryEndDate.ToString("yyyy-MM-dd"); } this.PromotionScopeDDL.SelectedValue = rowFormApply.PromotionScopeID.ToString(); this.PromotionTypeDDL.SelectedValue = rowFormApply.PromotionTypeID.ToString(); if (!rowFormApply.IsPromotionDescNull()) { this.PromotionDescCtl.Text = rowFormApply.PromotionDesc; } this.ShelfTypeDDL.SelectedValue = rowFormApply.ShelfTypeID.ToString(); if (!rowFormApply.IsFirstVolumeNull()) { this.FirstVolumeCtl.Text = rowFormApply.FirstVolume.ToString(); } if (!rowFormApply.IsSecondVolumeNull()) { this.SecondVolumeCtl.Text = rowFormApply.SecondVolume.ToString(); } if (!rowFormApply.IsThirdVolumeNull()) { this.ThirdVolumeCtl.Text = rowFormApply.ThirdVolume.ToString(); } if (!rowFormApply.IsFormApplyNameNull()) { this.txtFormApplyName.Text = rowFormApply.FormApplyName; } if (!rowFormApply.IsReimburseRequirementsNull()) { int ReimburseRequirement = rowFormApply.ReimburseRequirements; if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.Picture) == (int)SystemEnums.ReimburseRequirements.Picture) { chkListReimburseRequirements.Items[0].Selected = true; } if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.Agreement) == (int)SystemEnums.ReimburseRequirements.Agreement) { chkListReimburseRequirements.Items[1].Selected = true; } if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.DeliveryOrder) == (int)SystemEnums.ReimburseRequirements.DeliveryOrder) { chkListReimburseRequirements.Items[2].Selected = true; } if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.Contract) == (int)SystemEnums.ReimburseRequirements.Contract) { chkListReimburseRequirements.Items[3].Selected = true; } if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.DM) == (int)SystemEnums.ReimburseRequirements.DM) { chkListReimburseRequirements.Items[4].Selected = true; } if ((ReimburseRequirement & (int)SystemEnums.ReimburseRequirements.Other) == (int)SystemEnums.ReimburseRequirements.Other) { chkListReimburseRequirements.Items[5].Selected = true; } } this.ViewState["PromotionPriceType"] = rowFormApply.PromotionPriceType.ToString(); // 打开明细表 FormApplySKUDetailTableAdapter taSKU = new FormApplySKUDetailTableAdapter(); taSKU.FillByFormApplyID(this.InnerDS.FormApplySKUDetail, formID); FormApplyExpenseDetailTableAdapter taExpense = new FormApplyExpenseDetailTableAdapter(); taExpense.FillByFormApplyID(this.InnerDS.FormApplyExpenseDetail, formID); new FormApplySplitRateTableAdapter().FillByApplyID(InnerDS.FormApplySplitRate, formID); }
public string GetExpenseItemNameById(object Id) { //return new MasterDataBLL().ExpenseItemAdapter.GetDataById((int)Id)[0].ExpenseItemName; ERS.ExpenseItemRow row = new MasterDataBLL().ExpenseItemAdapter.GetDataById((int)Id)[0]; return(row.AccountingCode + "--" + row.AccountingName); }