private void FillModel(PBM_OrderPayInfo m) { ID = m.ID; PayMode = m.PayMode; Amount = m.Amount; Remark = m.Remark; ApproveFlag = m.ApproveFlag; #region 获取字典表名称 try { if (m.PayMode > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_AC_PayMode")[m.PayMode.ToString()]; if (dic != null) { PayModeName = dic.Name; } } } catch (System.Exception err) { LogWriter.WriteLog("MCSFramework.WSI.PBM_OrderPayInfo", err); } #endregion }
public OrderDetail(PBM_OrderDetail m) { DetailID = m.ID; Product = m.Product; Price = m.Price; DiscountRate = m.DiscountRate; BookQuantity = m.BookQuantity; ConfirmQuantity = m.ConfirmQuantity; DeliveredQuantity = m.DeliveredQuantity; Remark = m.Remark; PDT_Product p = new PDT_ProductBLL(Product).Model; if (p == null) { return; } ProductName = p.ShortName; if (p.ConvertFactor == 0) { p.ConvertFactor = 1; } ConvertFactor = p.ConvertFactor; if (p.Category > 0) { CategoryName = PDT_CategoryBLL.GetFullCategoryName(p.Category); } #region 获取字典表名称 try { if (m.SalesMode > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_SalseMode")[m.SalesMode.ToString()]; if (dic != null) { SalesModeName = dic.Name; } } if (p.TrafficPackaging > 0) { PackingName_T = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.TrafficPackaging.ToString()].ToString(); } if (p.Packaging > 0) { PackingName_P = DictionaryBLL.GetDicCollections("PDT_Packaging")[p.Packaging.ToString()].ToString(); } } catch (System.Exception err) { LogWriter.WriteLog("MCSFramework.WSI.OrderDetail", err); } #endregion }
private void FillModel(CM_Vehicle m) { if (m == null) { return; } ID = m.ID; VehicleNo = m.VehicleNo; RelateStaff = m.RelateStaff; RelateWareHouse = m.RelateWareHouse; if (RelateStaff != 0) { Org_Staff s = new Org_StaffBLL(RelateStaff).Model; if (s != null) { RelateStaffName = s.RealName; } } if (RelateWareHouse != 0) { CM_WareHouse w = new CM_WareHouseBLL(RelateWareHouse).Model; if (w != null) { RelateWareHouseName = w.Name; } } #region 获取字典表名称 try { if (m.VehicleClassify > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("CM_VehicleClassify")[m.VehicleClassify.ToString()]; if (dic != null) { VehicleClassifyName = dic.Name; } } } catch (System.Exception err) { LogWriter.WriteLog("MCSFramework.WSI.Vehicle", err); } #endregion }
private void FillModel(PDT_Product m, int TDP) { ID = m.ID; FullName = m.FullName; ShortName = m.ShortName; Code = m.Code; BarCode = m.BarCode; BoxBarCode = m.BoxBarCode; ConvertFactor = m.ConvertFactor; Spec = m.Spec; Remark = m.Remark; Grade = m.Grade; Category = m.Category; FactoryCode = m.FactoryCode; FactoryName = m.FactoryName; #region 获取商品的TDP扩展管理信息 if (TDP != 0) { IList <PDT_ProductExtInfo> exts = PDT_ProductExtInfoBLL.GetModelList("Supplier=" + TDP.ToString() + " AND Product=" + m.ID.ToString()); if (exts.Count > 0) { TDPCode = exts[0].Code; if (exts[0].Category != 0) { Category = exts[0].Category; } BuyPrice = exts[0].BuyPrice; SalesPrice = exts[0].SalesPrice; } } #endregion #region 获取品牌、系列、类别名称 if (m.Brand > 0) { PDT_Brand brand = new PDT_BrandBLL(m.Brand).Model; if (brand != null) { BrandName = brand.Name; } } if (m.Classify > 0) { PDT_Classify classify = new PDT_ClassifyBLL(m.Classify).Model; if (classify != null) { ClassifyName = classify.Name; } } if (Category > 0) { CategoryName = PDT_CategoryBLL.GetFullCategoryName(Category); } #endregion #region 获取字典表名称 try { if (m.Grade > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PDT_Grade")[m.Grade.ToString()]; if (dic != null) { GradeName = dic.Name; } } if (m.TrafficPackaging > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PDT_Packaging")[m.TrafficPackaging.ToString()]; if (dic != null) { TrafficPackagingName = dic.Name; } } if (m.Packaging > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PDT_Packaging")[m.Packaging.ToString()]; if (dic != null) { PackagingName = dic.Name; } } } catch (System.Exception err) { LogWriter.WriteLog("MCSFramework.WSI.Product", err); } #endregion #region 获取首要图片 string condition = " RelateType=11 AND RelateID=" + m.ID.ToString() + " AND MCS_SYS.dbo.UF_Spilt(ExtPropertys,'|',1)='Y'"; IList <ATMT_Attachment> lists = ATMT_AttachmentBLL.GetModelList(condition); if (lists.Count > 0 && ATMT_AttachmentBLL.IsImage(lists[0].ExtName)) { ImageGUID = lists[0].GUID; } #endregion #region 获取附件明细 Atts = new List <Attachment>(); IList <ATMT_Attachment> atts = ATMT_AttachmentBLL.GetAttachmentList(11, m.ID, new DateTime(1900, 1, 1), new DateTime(2100, 1, 1)); foreach (ATMT_Attachment item in atts.OrderBy(p => p.Name)) { Atts.Add(new Attachment(item)); } #endregion }
private void FillModel(AC_CashFlowList m) { if (m == null) { return; } ID = m.ID; TradeClient = m.TradeClient; PayDate = m.PayDate; AgentStaff = m.AgentStaff; PayMode = m.PayMode; PayClassify = m.PayClassify; Amount = m.Amount; RelateDeliveryId = m.RelateDeliveryId; ConfirmState = m.ConfirmState; RelateOrderId = m.RelateOrderId; WorkList = m.WorkList; Remark = m.Remark; if (m.TradeClient > 0) { CM_Client c = new CM_ClientBLL(m.TradeClient).Model; if (c != null) { TradeClientName = c.FullName; } } if (m.AgentStaff > 0) { Org_Staff s = new Org_StaffBLL(m.AgentStaff).Model; if (s != null) { AgentStaffName = s.RealName; } } if (m.RelateDeliveryId > 0) { PBM_Delivery d = new PBM_DeliveryBLL(m.RelateDeliveryId).Model; RelateDeliveryCode = d.SheetCode == "" ? d.ID.ToString() : d.SheetCode; } if (m.RelateDeliveryId > 0) { PBM_Delivery d = new PBM_DeliveryBLL(m.RelateDeliveryId).Model; RelateDeliveryCode = d.SheetCode == "" ? d.ID.ToString() : d.SheetCode; } if (m.PayMode > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_AC_PayMode")[m.PayMode.ToString()]; if (dic != null) { PayModeName = dic.Name; } } if (m.PayClassify > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_AC_PayClassify")[m.PayClassify.ToString()]; if (dic != null) { PayClassifyName = dic.Name; } } if (m.ConfirmState > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_AC_BillConfirmState")[m.ConfirmState.ToString()]; if (dic != null) { ConfirmStateName = dic.Name; } } }
protected void gv_List_RowDataBound(object sender, GridViewRowEventArgs e) { if (ViewState["Details"] == null) { return; } ListTable <PBM_DeliveryDetail> Details = (ListTable <PBM_DeliveryDetail>)ViewState["Details"]; if (e.Row.RowType == DataControlRowType.DataRow) { int id = (int)((GridView)sender).DataKeys[e.Row.RowIndex]["ID"]; PBM_DeliveryDetail d = Details[id.ToString()]; if (d == null) { return; } PDT_Product product = new PDT_ProductBLL(d.Product, true).Model; if (product == null) { return; } Dictionary <string, Dictionary_Data> dic = DictionaryBLL.GetDicCollections("PDT_Packaging"); string _T = dic[product.TrafficPackaging.ToString()].Name; string _P = dic[product.Packaging.ToString()].Name; Label lbProduct = (Label)e.Row.FindControl("lbProduct"); if (lbProduct != null) { lbProduct.Text = product.FullName; } #region 显示产品价格包装信息 Label lb_Price = (Label)e.Row.FindControl("lb_Price"); if (lb_Price != null) { lb_Price.Text = (d.Price * product.ConvertFactor).ToString("0.##") + "元/" + _T;// +"(" + product.ConvertFactor.ToString() + _P + ")"; } #endregion #region 显示产品数量信息 Label lb_Quantity = (Label)e.Row.FindControl("lb_Quantity"); if (lb_Quantity != null) { if (d.SignInQuantity / product.ConvertFactor > 0) { lb_Quantity.Text = (d.SignInQuantity / product.ConvertFactor).ToString() + _T; } if (d.SignInQuantity % product.ConvertFactor > 0) { lb_Quantity.Text += "" + (d.SignInQuantity % product.ConvertFactor).ToString() + _P; } } #endregion #region 追加订货模式 if (d.SalesMode > 1) { Dictionary_Data dic_data = DictionaryBLL.GetDicCollections("PBM_SalseMode")[d.SalesMode.ToString()]; if (dic_data != null) { lbProduct.Text += "(" + dic_data.Name + ")"; } } #endregion Label lb_Fee = (Label)e.Row.FindControl("lb_Fee"); if (lb_Fee != null) { lb_Fee.Text = (Math.Round(d.Price * d.ConvertFactor, 2) * d.SignInQuantity / d.ConvertFactor).ToString("0.##"); } Label lbDiscountRate = (Label)e.Row.FindControl("lbDiscountRate"); if (lbDiscountRate != null) { lbDiscountRate.Text = d.DiscountRate.ToString("0.##%"); } } }
private void BindGrid() { int month = int.Parse(ddl_Month.SelectedValue); int organizecity = int.Parse(tr_OrganizeCity.SelectValue); int level = int.Parse(ddl_Level.SelectedValue); int feetype = int.Parse(ddl_FeeType.SelectedValue); int state = int.Parse(ddl_State.SelectedValue); if (MCSTabControl1.SelectedIndex == 0) { #region 显示汇总单数据源 Dictionary_Data dicFeeType = null; if (feetype > 0) { dicFeeType = DictionaryBLL.GetDicCollections("FNA_FeeType")[feetype.ToString()]; } #region 额外条件 string condition = ""; //费用代垫客户 if (select_Client.SelectValue != "") { condition += " AND FNA_FeeWriteOff.InsteadPayClient=" + select_Client.SelectValue; } //费用代垫员工 if (Select_InsteadPayStaff.SelectValue != "") { condition += " AND MCS_SYS.dbo.UF_Spilt2('MCS_FNA.dbo.FNA_FeeWriteOff',FNA_FeeWriteOff.ExtPropertys,'InsteadPayStaff')=" + Select_InsteadPayStaff.SelectValue; } //核销申请人 if (Select_InsertStaff.SelectValue != "") { condition += " AND FNA_FeeWriteOff.InsertStaff=" + Select_InsertStaff.SelectValue; } #endregion DataTable dtSummary = FNA_FeeWriteOffBLL.GetSummaryTotal(month, organizecity, level, feetype, state, int.Parse(Session["UserID"].ToString()), condition); if (dtSummary.Rows.Count == 0) { gv_List.DataBind(); return; } #region 矩阵化数据表,扩展表数据列 dtSummary.Columns.Add(new DataColumn("ID", Type.GetType("System.Int32"))); if (level < 10) { foreach (DataRow row in dtSummary.Rows) { row["ID"] = row["OrganizeCity"]; } dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "ID", "管理片区名称" }, new string[] { "FeeTypeName", "AccountTitleName" }, "WriteOffCost", true, true); } else { if (level == 10) { //按经销商查看 #region 将经销商的所属管理片区赋至管理片区列 Dictionary <int, string> dicFullOrganizeCityName = new Dictionary <int, string>(); foreach (DataRow row in dtSummary.Rows) { row["ID"] = row["经销商ID"] == DBNull.Value ? 0 : row["经销商ID"]; row["经销商名称"] = row["经销商名称"] == DBNull.Value ? "无" : row["经销商名称"]; if ((int)row["ID"] > 0) { CM_Client c = new CM_ClientBLL((int)row["ID"]).Model; if (c != null) { if (!dicFullOrganizeCityName.ContainsKey(c.OrganizeCity)) { dicFullOrganizeCityName.Add(c.OrganizeCity, TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OrganizeCity", c.OrganizeCity)); } row["管理片区名称"] = dicFullOrganizeCityName[c.OrganizeCity]; } } } #endregion dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "ID", "管理片区名称", "经销商名称" }, new string[] { "FeeTypeName", "AccountTitleName" }, "WriteOffCost", true, true); } else if (level == 20) { //按门店查看 #region 将门店的所属管理片区赋至管理片区列 Dictionary <int, string> dicFullOrganizeCityName = new Dictionary <int, string>(); foreach (DataRow row in dtSummary.Rows) { row["ID"] = row["客户ID"] == DBNull.Value ? 0 : row["客户ID"]; row["客户名称"] = row["客户名称"] == DBNull.Value ? "无" : row["客户名称"]; if ((int)row["ID"] > 0) { CM_Client c = new CM_ClientBLL((int)row["ID"]).Model; if (c != null) { if (!dicFullOrganizeCityName.ContainsKey(c.OrganizeCity)) { dicFullOrganizeCityName.Add(c.OrganizeCity, TreeTableBLL.GetFullPathName("MCS_SYS.dbo.Addr_OrganizeCity", c.OrganizeCity)); } row["管理片区名称"] = dicFullOrganizeCityName[c.OrganizeCity]; } } } #endregion dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "ID", "管理片区名称", "客户名称" }, new string[] { "FeeTypeName", "AccountTitleName" }, "WriteOffCost", true, true); } } dtSummary = MatrixTable.ColumnSummaryTotal(dtSummary, new int[] { 1 }, new string[] { "WriteOffCost" }); #endregion #region 暂不计算分析数据 //dtSummary.Columns["合计"].ColumnName = "费用合计"; //dtSummary.Columns.Add("预计销量", Type.GetType("System.Decimal")); //if (dicFeeType != null && dicFeeType.Description == "BudgetControl" && level < 10) //{ // dtSummary.Columns.Add("预算总额", Type.GetType("System.Decimal")); // dtSummary.Columns.Add("其中扩增额", Type.GetType("System.Decimal")); // dtSummary.Columns.Add("预算余额", Type.GetType("System.Decimal")); //} //if (dicFeeType != null && dicFeeType.Description == "FeeRateControl") // dtSummary.Columns.Add("上月余额", Type.GetType("System.Decimal")); //dtSummary.Columns.Add("费点", Type.GetType("System.String")); //decimal sumTotalVolume = 0, sumTotalBudget = 0, sumExtBudget = 0, sumPreMonthBudgetBalance = 0, sumUsableAmount = 0; //foreach (DataRow row in dtSummary.Rows) //{ // int id = 0; // if (int.TryParse(row[0].ToString(), out id) && id > 0) // { // bool includechild = true; // if (level < 10 && new Addr_OrganizeCityBLL(id).Model.Level < level) includechild = false; // #region 计算费点 // if (level < 10) // row["预计销量"] = SVM_SalesForcastBLL.GetTotalVolume(month, id, includechild); // else if (level == 10 || level == 20) // row["预计销量"] = SVM_SalesForcastBLL.GetTotalVolumeByClient(month, id); // sumTotalVolume += (decimal)row["预计销量"]; // if (dicFeeType != null && dicFeeType.Description == "BudgetControl" && level < 10) // { // row["预算总额"] = (FNA_BudgetBLL.GetSumBudgetAmount(month, id, feetype, includechild) + FNA_BudgetBLL.GetSumBudgetAmount(month, id, 0, includechild)); // sumTotalBudget += (decimal)row["预算总额"]; // row["其中扩增额"] = (FNA_BudgetExtraApplyBLL.GetExtraAmount(month, id, feetype, includechild) + FNA_BudgetExtraApplyBLL.GetExtraAmount(month, id, 0, includechild)); // sumExtBudget += (decimal)row["其中扩增额"]; // row["预算余额"] = (FNA_BudgetBLL.GetUsableAmount(month, id, feetype, includechild) + FNA_BudgetBLL.GetUsableAmount(month, id, 0, includechild)); // sumUsableAmount += (decimal)row["预算余额"]; // } // if (dicFeeType != null && dicFeeType.Description == "FeeRateControl" && level < 10) // { // row["上月余额"] = FNA_BudgetBLL.GetUsableAmount(month - 1, id, feetype, includechild); // sumPreMonthBudgetBalance += (decimal)row["上月余额"]; // if ((decimal)row["预计销量"] != 0) // row["费点"] = (((decimal)row["费用合计"] - (decimal)row["上月余额"]) / (decimal)row["预计销量"]).ToString("0.00%"); // } // else if ((decimal)row["预计销量"] != 0) // row["费点"] = ((decimal)row["费用合计"] / (decimal)row["预计销量"]).ToString("0.00%"); // #endregion // } // #region 求合计行 // if (id == 0) // { // row["预计销量"] = sumTotalVolume.ToString("0.00"); // #region 预算总额及余额 // if (dicFeeType != null && dicFeeType.Description == "BudgetControl" && level < 10) // { // row["预算总额"] = sumTotalBudget.ToString("0.00"); // row["其中扩增额"] = sumExtBudget.ToString("0.00"); // row["预算余额"] = sumUsableAmount.ToString("0.00"); // } // #endregion // #region 费点 // if (sumTotalVolume != 0) // { // if (dicFeeType != null && dicFeeType.Description == "FeeRateControl" && level < 10) // { // row["上月余额"] = sumPreMonthBudgetBalance; // row["费点"] = (((decimal)row["费用合计"] - sumPreMonthBudgetBalance) / sumTotalVolume).ToString("0.##%"); // } // else // row["费点"] = ((decimal)row["费用合计"] / sumTotalVolume).ToString("0.##%"); // } // #endregion // } // #endregion //} #endregion #endregion gv_List.DataSource = dtSummary; gv_List.DataBind(); if (dtSummary.Columns.Count >= 24) { gv_List.Width = new Unit(dtSummary.Columns.Count * 55); } else { gv_List.Width = new Unit(100, UnitType.Percentage); } MatrixTable.GridViewMatric(gv_List); if (level == 20) { //按终端门店显示时,将上下行相同管理片区合并 MatrixTable.GridViewMergSampeValueRow(gv_List, 0); MatrixTable.GridViewMergSampeValueRow(gv_List, 1); } #region 是否可以批量审批 if (state != 1 || level >= 10) { gv_List.Columns[0].ItemStyle.Width = new Unit(1); foreach (GridViewRow row in gv_List.Rows) { row.FindControl("bt_Approved").Visible = false; row.FindControl("bt_UnApproved").Visible = false; } } else { gv_List.Columns[0].ItemStyle.Width = new Unit(68); } #endregion } else { string condition = "1=1"; #region 组织明细记录的查询条件 //管理片区及所有下属管理片区 if (tr_OrganizeCity.SelectValue != "1") { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += tr_OrganizeCity.SelectValue; condition += " AND FNA_FeeWriteOff.OrganizeCity IN (" + orgcitys + ")"; } //会计月条件 condition += " AND FNA_FeeWriteOff.AccountMonth = " + ddl_Month.SelectedValue; int accounttile = 0; int.TryParse(tr_AccountTitle.SelectValue, out accounttile); decimal _cost = 0; decimal.TryParse(tbx_WriteOffCost.Text, out _cost); //费用类型 if (ddl_FeeType.SelectedValue != "0" && !(accounttile > 1)) { IList <AC_AccountTitleInFeeType> titles = AC_AccountTitleInFeeTypeBLL.GetModelList("FeeType=" + ddl_FeeType.SelectedValue); string ids = ""; foreach (AC_AccountTitleInFeeType item in titles) { ids += item.AccountTitle + ","; } if (ids.EndsWith(",")) { ids = ids.Substring(0, ids.Length - 1); } condition += " AND FNA_FeeWriteOff.ID IN (SELECT WriteOffID FROM MCS_FNA.dbo.FNA_FeeWriteOffDetail WHERE AccountTitle IN(" + ids + ") AND FNA_FeeWriteOffDetail.WriteOffID=FNA_FeeWriteOff.ID)"; } //费用科目 if (accounttile > 1) { DataTable dt = TreeTableBLL.GetAllChildByNodes("MCS_PUB.dbo.AC_AccountTitle", "ID", "SuperID", accounttile.ToString()); string ids = ""; foreach (DataRow dr in dt.Rows) { ids += dr["ID"].ToString() + ","; } ids += accounttile.ToString(); if (_cost == 0) { condition += " AND FNA_FeeWriteOff.ID IN (SELECT WriteOffID FROM MCS_FNA.dbo.FNA_FeeWriteOffDetail WHERE AccountTitle IN(" + ids + ") AND FNA_FeeWriteOffDetail.WriteOffID=FNA_FeeWriteOff.ID)"; } else { condition += " AND FNA_FeeWriteOff.ID IN (SELECT WriteOffID FROM MCS_FNA.dbo.FNA_FeeWriteOffDetail WHERE AccountTitle IN(" + ids + ") AND (WriteOffCost+AdjustCost)" + ddl_WriteOffCostOP.SelectedValue + " " + _cost.ToString() + " AND FNA_FeeWriteOffDetail.WriteOffID=FNA_FeeWriteOff.ID)"; } } else if (_cost != 0) { //核销金额判断 condition += " AND FNA_FeeWriteOff.ID IN (SELECT WriteOffID FROM MCS_FNA.dbo.FNA_FeeWriteOffDetail WHERE (WriteOffCost+AdjustCost)" + ddl_WriteOffCostOP.SelectedValue + " " + _cost.ToString() + " AND FNA_FeeWriteOffDetail.WriteOffID=FNA_FeeWriteOff.ID)"; } //审批状态 if (ddl_State.SelectedValue == "0") { condition += " AND FNA_FeeWriteOff.State IN (2,3) "; } else if (ddl_State.SelectedValue == "1") { condition += @" AND FNA_FeeWriteOff.State = 2 AND FNA_FeeWriteOff.ApproveTask IN (SELECT EWF_Task_Job.Task FROM MCS_EWF.dbo.EWF_Task_JobDecision INNER JOIN MCS_EWF.dbo.EWF_Task_Job ON EWF_Task_JobDecision.Job = EWF_Task_Job.ID WHERE EWF_Task_JobDecision.RecipientStaff=" + Session["UserID"].ToString() + @" AND EWF_Task_JobDecision.DecisionResult=1 and EWF_Task_Job.Status=3)"; } else if (ddl_State.SelectedValue == "2") { condition += " AND FNA_FeeWriteOff.State = 3 "; } else if (ddl_State.SelectedValue == "3") { AC_AccountMonth m = new AC_AccountMonthBLL(month).Model; condition += @" AND FNA_FeeWriteOff.State IN (2,3) AND FNA_FeeWriteOff.ApproveTask IN (SELECT EWF_Task_Job.Task FROM MCS_EWF.dbo.EWF_Task_JobDecision INNER JOIN MCS_EWF.dbo.EWF_Task_Job ON EWF_Task_JobDecision.Job = EWF_Task_Job.ID WHERE EWF_Task_JobDecision.RecipientStaff=" + Session["UserID"].ToString() + @" AND EWF_Task_JobDecision.DecisionResult IN(2,5,6) AND EWF_Task_JobDecision.DecisionTime BETWEEN DATEADD(month,-1,'" + m.BeginDate.ToString("yyyy-MM-dd") + @"') AND DATEADD(month,3,'" + m.BeginDate.ToString("yyyy-MM-dd") + @"'))"; } //费用代垫客户 if (select_Client.SelectValue != "") { condition += " AND FNA_FeeWriteOff.InsteadPayClient=" + select_Client.SelectValue; } //费用代垫员工 if (Select_InsteadPayStaff.SelectValue != "") { condition += " AND MCS_SYS.dbo.UF_Spilt2('MCS_FNA.dbo.FNA_FeeWriteOff',FNA_FeeWriteOff.ExtPropertys,'InsteadPayStaff')=" + Select_InsteadPayStaff.SelectValue; } //核销申请人 if (Select_InsertStaff.SelectValue != "") { condition += " AND FNA_FeeWriteOff.InsertStaff=" + Select_InsertStaff.SelectValue; } #endregion gv_ListDetail.ConditionString = condition; gv_ListDetail.BindGrid(); } }
public VisitWorkItem(VST_WorkItem m) { WorkItemID = m.ID; if (m.Process != 0) { Process = new VisitProcess(m.Process); ProcessCode = Process.Code; } WorkTime = m.WorkTime; InsertTime = m.InsertTime; Remark = m.Remark; ExtParams = new Hashtable(); switch (Process.Code) { #region 进店详细属性 case "JD": { VST_WorkItem_JD jd = VST_WorkItem_JDBLL.GetDetailByJobID(m.ID); //进出店类型 ExtParams.Add("JobType", jd.JobType); //1:进店 2:离店 //进出店方式 ExtParams.Add("JudgeMode", jd.JudgeMode); //1:查询 2:扫码 3:NFC //经度 ExtParams.Add("Longitude", jd.Longitude); //纬度 ExtParams.Add("Latitude", jd.Latitude); try { //进出店类型字典名 if (jd.JobType > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("VST_VisitJDType")[jd.JobType.ToString()]; if (dic != null) { ExtParams.Add("JobTypeName", dic.Name); } } //进出店方式字典名 if (jd.JudgeMode > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("VST_VisitJudgeMode")[jd.JudgeMode.ToString()]; if (dic != null) { ExtParams.Add("JudgeModeName", dic.Name); } } } catch { } } break; #endregion } }
private void FillModel(int WorkListID) { VST_WorkListBLL bll = new VST_WorkListBLL(WorkListID); if (bll.Model == null) { return; } ID = bll.Model.ID; RelateStaff = bll.Model.RelateStaff; Route = bll.Model.Route; Client = bll.Model.Client; VisitTemplate = bll.Model.Template; WorkingClassify = bll.Model.WorkingClassify; IsComplete = bll.Model.IsComplete.ToUpper() == "Y"; BeginTime = bll.Model.BeginTime; EndTime = bll.Model.EndTime; PlanID = bll.Model.PlanID; Remark = bll.Model.Remark; InsertTime = bll.Model.InsertTime; //详细工作项目 Items = new List <VisitWorkItem>(bll.Items.Count); foreach (VST_WorkItem item in bll.Items) { Items.Add(new VisitWorkItem(item)); } #region ID转名称 try { if (RelateStaff != 0) { Org_Staff s = new Org_StaffBLL(RelateStaff).Model; if (s != null) { RelateStaffName = s.RealName; } } if (Route != 0) { VST_Route r = new VST_RouteBLL(Route).Model; if (r != null) { RouteName = r.Name; } } if (Client != 0) { CM_Client c = new CM_ClientBLL(Client).Model; if (c != null) { ClientName = c.FullName; } } if (VisitTemplate != 0) { VST_VisitTemplate t = new VST_VisitTemplateBLL(VisitTemplate).Model; if (t != null) { VisitTemplateName = t.Name; } } if (WorkingClassify != 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("VST_WorkingClassify")[WorkingClassify.ToString()]; if (dic != null) { WorkingClassifyName = dic.Name; } } } catch { } #endregion }
private void BindGrid(bool IsExport, bool LoadFromCache) { Guid reportid = new Guid(ViewState["Report"].ToString()); Rpt_ReportBLL report = new Rpt_ReportBLL(reportid); lb_ReportTitle.Text = report.Model.Title; Dictionary <string, object> param; if (!pl_Param.GetParamsValue(out param)) { MessageBox.Show(this, "请正确设定必填参数!"); return; } if (report.LoadData(param, LoadFromCache)) { if (!IsExport) { #region 绑定图表 Chart1.Series.Clear(); Chart1.ChartAreas.Clear(); DataTable dt_chart = report.GetReportData(); if (report.GetCharts().Count == 0) { Chart1.Visible = false; } else { Chart1.Legends.Clear(); Chart1.Series.Clear(); Chart1.ChartAreas.Clear(); int chartindex = 0; foreach (Rpt_ReportCharts chart in report.GetCharts()) { chartindex++; ChartArea chartarea = new ChartArea("ChartArea" + chartindex.ToString()); Chart1.ChartAreas.Add(chartarea); chartarea.AxisX.MajorGrid.LineDashStyle = ChartDashStyle.Dot; chartarea.AxisX.MajorGrid.Interval = 1; chartarea.AxisY.MajorGrid.LineDashStyle = ChartDashStyle.Dot; chartarea.AxisX.MajorGrid.LineColor = Color.LightGray; chartarea.AxisY.MajorGrid.LineColor = Color.LightGray; chartarea.AxisX.LabelStyle.Angle = 0; chartarea.AxisX.LabelAutoFitStyle = LabelAutoFitStyles.IncreaseFont; chartarea.AxisX.IsLabelAutoFit = true; //chartarea.AxisX.LabelStyle.ForeColor = System.Drawing.Color.Blue; chartarea.AxisX.LabelAutoFitMaxFontSize = 8; chartarea.AxisX.LabelAutoFitMinFontSize = 5; chartarea.AxisY.LabelAutoFitMaxFontSize = 8; chartarea.AxisY.LabelAutoFitMinFontSize = 5; //3D显示 if (chart["Enable3D"] == "Y") { chartarea.Area3DStyle.Enable3D = true; } #region 第二轴坐标 if (chart["AxisX2Enabled"] == "Y") { chartarea.AxisX2.Enabled = AxisEnabled.True; chartarea.AxisX2.LabelAutoFitStyle = LabelAutoFitStyles.IncreaseFont; chartarea.AxisX2.LabelAutoFitMaxFontSize = 8; chartarea.AxisX2.LabelAutoFitMinFontSize = 5; } if (chart["AxisY2Enabled"] == "Y") { chartarea.AxisY2.Enabled = AxisEnabled.True; chartarea.AxisY2.LabelAutoFitStyle = LabelAutoFitStyles.IncreaseFont; chartarea.AxisY2.LabelAutoFitMaxFontSize = 8; chartarea.AxisY2.LabelAutoFitMinFontSize = 5; } #endregion #region 处理图表系列 IList <string> list_series = new List <string>(); string[] series_array = chart.SeriesColumns.Split(new char[] { ',', '|' }, StringSplitOptions.RemoveEmptyEntries); if (report.Model.ReportType == 1) { //普通列表 for (int i = 0; i < series_array.Length; i++) { if (dt_chart.Columns.Contains(series_array[i])) { list_series.Add(series_array[i]); } } } if (report.Model.ReportType == 2) { //矩阵表 IList <Rpt_ReportRowGroups> rowgroups = report.GetRowGroups(); IList <Rpt_ReportValueGroups> valuegroups = report.GetValueGroups(); for (int i = 0; i < series_array.Length; i++) { foreach (DataColumn column in dt_chart.Columns) { if (rowgroups.FirstOrDefault(p => p.DisplayName == column.ColumnName) != null) { continue; } if (valuegroups.Count == 1) { list_series.Add(column.ColumnName); } else { if (column.ColumnName.EndsWith(series_array[i])) { list_series.Add(column.ColumnName); } } } chartarea.AxisY.Title += series_array[i] + " "; chartarea.AxisY.TitleFont = new Font("宋体", 9); chartarea.AxisY.TitleForeColor = Color.Blue; } } Legend legend = new Legend("Legend" + chartindex.ToString()); legend.Docking = Docking.Bottom; legend.Alignment = StringAlignment.Center; legend.Title = chartarea.AxisY.Title; Chart1.Legends.Add(legend); foreach (string seriesname in list_series) { Series series = new Series(seriesname); string charttypedesc = DictionaryBLL.GetDicCollections("RPT_ReportChartType")[chart.ChartType.ToString()].Description; series.ChartType = (SeriesChartType)Enum.Parse(typeof(SeriesChartType), charttypedesc, true); series.ChartArea = chartarea.Name; series.Legend = legend.Name; series.YValueMembers = seriesname; series.XValueMember = chart.AxisColumns; series.ToolTip = seriesname; if (series.ChartType == SeriesChartType.Spline || series.ChartType == SeriesChartType.Line) { series.BorderWidth = 3; chartarea.AxisX.IsMarginVisible = false; } if (chart["IsValueShownAsLabel"] == "Y") { series.IsValueShownAsLabel = true; //显示值标签 } if (DictionaryBLL.GetDicCollections("PRT_ChartDrawingStyle").ContainsKey(chart["DrawingStyle"])) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PRT_ChartDrawingStyle")[chart["DrawingStyle"]]; series.CustomProperties = "DrawingStyle=" + dic.Description; } Chart1.Series.Add(series); } #endregion #region 设置横向轴分组式Label IList <Rpt_ReportRowGroups> RowGroups = report.GetRowGroups(); for (int rowgroupindex = 0; rowgroupindex < RowGroups.Count; rowgroupindex++) { int startposition = 0; for (int i = 0; i < dt_chart.Rows.Count; i++) { if (i == dt_chart.Rows.Count - 1 || dt_chart.Rows[i][RowGroups[rowgroupindex].DisplayName].ToString() != dt_chart.Rows[i + 1][RowGroups[rowgroupindex].DisplayName].ToString()) { chartarea.AxisX.CustomLabels.Add(startposition + 0.5, i + 1.4, dt_chart.Rows[i][RowGroups[rowgroupindex].DisplayName].ToString(), RowGroups.Count - rowgroupindex - 1, LabelMarkStyle.LineSideMark); startposition = i + 1; } } } #endregion } Chart1.Height = new Unit(500 * Chart1.ChartAreas.Count); Chart1.DataSource = dt_chart; Chart1.DataBind(); } #endregion } #region 绑定GridView DataTable dt_gridview = report.GetReportDataWithSummary(); if (report.Model.ReportType == 1) { GridView1.AllowPaging = !IsExport; GridView1.PageSize = 50; GridView1.DataSource = dt_gridview; GridView1.DataBind(); } else if (report.Model.ReportType == 2) { GridView1.AllowPaging = !IsExport; GridView1.PageSize = 100; GridView1.DataSource = dt_gridview; GridView1.DataBind(); GridViewMatric(GridView1); } lb_PageInfo.Visible = false; bt_PrePage.Visible = false; bt_NextPage.Visible = false; if (GridView1.AllowPaging) { lb_PageInfo.Text = string.Format("每页<b><font color=red>{0}</font></b>条/共<b><font color=red>{1}</font></b>条 第<b><font color=red>{2}</font></b>页/共<b><font color=red>{3}</font></b>页", GridView1.PageSize > dt_gridview.Rows.Count ? dt_gridview.Rows.Count : GridView1.PageSize, dt_gridview.Rows.Count, GridView1.PageIndex + 1, GridView1.PageCount); lb_PageInfo.Visible = true; if (GridView1.PageIndex > 0) { bt_PrePage.Visible = true; } if (GridView1.PageIndex < GridView1.PageCount - 1) { bt_NextPage.Visible = true; } } if (dt_gridview.Columns.Count >= 22) { GridView1.Width = new Unit(dt_gridview.Columns.Count * 65); } else { GridView1.Width = new Unit(100, UnitType.Percentage); } if (!IsExport) { int rowindex = 0; foreach (Rpt_ReportRowGroups rowgroup in report.GetRowGroups()) { if (dt_gridview.Columns.Contains(rowgroup.DisplayName)) { GridViewMergSampeValueRow(GridView1, rowindex); rowindex++; } } } #endregion if (report.DataCacheTime <= DateTime.Now.AddMinutes(-1)) { bt_ClearDataCache.Visible = true; lb_DataSetCacheTime.Visible = true; lb_DataSetCacheTime.Text = " 数据源来自历史快照,获取时间:" + report.DataCacheTime.ToString("yyyy-MM-dd HH:mm"); } else { bt_ClearDataCache.Visible = false; lb_DataSetCacheTime.Visible = false; } } else { MessageBox.Show(this, "未能检索到数据!"); } }
private void FillModel(int OrderID) { PBM_OrderBLL bll = new PBM_OrderBLL(OrderID); if (bll.Model == null) { ID = -1; return; } PBM_Order m = bll.Model; ID = m.ID; SheetCode = m.SheetCode; Supplier = m.Supplier; Client = m.Client; SalesMan = m.SalesMan; Classify = m.Classify; StandardPrice = m.StandardPrice; State = m.State; DiscountAmount = m.DiscountAmount; WipeAmount = m.WipeAmount; ActAmount = m.ActAmount; ArriveTime = m.ArriveTime; SubmitTime = m.SubmitTime; ConfirmTime = m.ConfirmTime; InsertTime = m.InsertTime; Remark = m.Remark; WorkList = m.WorkList; ApproveFlag = m.ApproveFlag; int.TryParse(m["OrderSource"], out OrderSource); //订货单明细 Items = new List <OrderDetail>(); foreach (PBM_OrderDetail item in bll.Items) { Items.Add(new OrderDetail(item)); } //预收款信息列表 PayInfos = new List <OrderPayInfo>(); foreach (PBM_OrderPayInfo item in bll.GetPayInfoList()) { PayInfos.Add(new OrderPayInfo(item)); } #region 获取各字段ID对应的名称 if (Supplier > 0) { CM_Client c = new CM_ClientBLL(Supplier).Model; if (c != null) { SupplierName = c.FullName; } } if (Client > 0) { CM_Client c = new CM_ClientBLL(Client).Model; if (c != null) { ClientName = c.FullName; } } if (SalesMan > 0) { Org_Staff s = new Org_StaffBLL(SalesMan).Model; if (s != null) { SalesManName = s.RealName; } } if (StandardPrice > 0) { PDT_StandardPrice s = new PDT_StandardPriceBLL(StandardPrice).Model; if (s != null) { StandardPriceName = s.Name; } } #endregion #region 获取字典表名称 try { if (m.Classify > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_OrderClassify")[m.Classify.ToString()]; if (dic != null) { ClassifyName = dic.Name; } } if (m.State > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_OrderState")[m.State.ToString()]; if (dic != null) { StateName = dic.Name; } } if (OrderSource > 0) { Dictionary_Data dic = DictionaryBLL.GetDicCollections("PBM_OrderSource")[OrderSource.ToString()]; if (dic != null) { OrderSourceName = dic.Name; } } } catch (System.Exception err) { LogWriter.WriteLog("MCSFramework.WSI.Order", err); } #endregion }
private void BindGrid() { int month = int.Parse(ddl_Month.SelectedValue); int organizecity = int.Parse(tr_OrganizeCity.SelectValue); int level = int.Parse(ddl_Level.SelectedValue); int feetype = int.Parse(ddl_FeeType.SelectedValue); int state = int.Parse(ddl_State.SelectedValue); int flag = int.Parse(ddl_Flag.SelectedValue); if (MCSTabControl1.SelectedIndex == 0) { #region 显示汇总单数据源 Dictionary_Data dicFeeType = null; if (feetype > 0) { dicFeeType = DictionaryBLL.GetDicCollections("FNA_FeeType")[feetype.ToString()]; } DataTable dtSummary_Sub; DataTable dtSummary = FNA_FeeApplyBLL.GetSummaryTotal(month, organizecity, level, feetype, state, flag, int.Parse(Session["UserID"].ToString())); if (dtSummary.Rows.Count == 0) { gv_List.DataBind(); return; } else { dtSummary_Sub = FNA_FeeApplyBLL.GetSummaryTotal_Sub(month, organizecity, level, feetype, state, flag, int.Parse(Session["UserID"].ToString())); } #region 矩阵化数据表,扩展表数据列 dtSummary.Columns.Add(new DataColumn("ID", Type.GetType("System.Int32"))); if (level < 10) { foreach (DataRow row in dtSummary.Rows) { row["ID"] = row["OrganizeCity"]; } dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "ID", "管理片区名称" }, new string[] { "FeeTypeName", "AccountTitleName" }, "ApplyCost", true, true); } else { if (level == 10) { //按经销商查看 #region 将经销商的ID赋至表ID列 foreach (DataRow row in dtSummary.Rows) { row["ID"] = row["经销商ID"] == DBNull.Value ? 0 : row["经销商ID"]; row["经销商名称"] = row["经销商名称"] == DBNull.Value ? "无" : row["经销商名称"]; } #endregion dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "ID", "管理片区名称", "经销商名称" }, new string[] { "FeeTypeName", "AccountTitleName" }, "ApplyCost", true, true); } else if (level == 20) { //按门店查看 #region 将门店的ID赋至表ID列 foreach (DataRow row in dtSummary.Rows) { row["ID"] = row["客户ID"] == DBNull.Value ? 0 : row["客户ID"]; row["客户名称"] = row["客户名称"] == DBNull.Value ? "无" : row["客户名称"]; } #endregion dtSummary = MatrixTable.Matrix(dtSummary, new string[] { "ID", "管理片区名称", "客户名称" }, new string[] { "FeeTypeName", "AccountTitleName" }, "ApplyCost", true, true); } } dtSummary = MatrixTable.ColumnSummaryTotal(dtSummary, new int[] { 1 }, new string[] { "sales" }); dtSummary.Columns["合计"].ColumnName = "费用合计"; dtSummary.Columns.Add("本月费用合计", Type.GetType("System.Decimal")); dtSummary.Columns.Add("预计销量", Type.GetType("System.Decimal")); dtSummary.Columns.Add("上月销量", Type.GetType("System.Decimal")); dtSummary.Columns.Add("平均销量", Type.GetType("System.Decimal")); dtSummary.Columns.Add("预计费点", Type.GetType("System.String")); if (dicFeeType != null && dicFeeType.Description == "BudgetControl" && level < 10) { dtSummary.Columns.Add("预算总额", Type.GetType("System.Decimal")); dtSummary.Columns.Add("其中扩增额", Type.GetType("System.Decimal")); dtSummary.Columns.Add("预算余额", Type.GetType("System.Decimal")); dtSummary.Columns.Add("终结费用", Type.GetType("System.Decimal")); } if (dicFeeType != null && dicFeeType.Description == "FeeRateControl") { dtSummary.Columns.Add("上月余额", Type.GetType("System.Decimal")); } #endregion decimal sumTotalVolume = 0, sumAvgVolume = 0, sumSalesForcast = 0, sumHappenApplyCost = 0; decimal sumTotalBudget = 0, sumExtBudget = 0, sumPreMonthBudgetBalance = 0, sumUsableAmount = 0, sumCancelCost = 0; int premonth = month - 1; if (premonth >= AC_AccountMonthBLL.GetCurrentMonth()) { premonth = AC_AccountMonthBLL.GetCurrentMonth() - 1; } foreach (DataRow row in dtSummary.Rows) { int id = 0; if (int.TryParse(row["ID"].ToString(), out id) && id > 0) { string filter = "ID=" + id; bool includechild = false; if (level < 10 && new Addr_OrganizeCityBLL(id).Model.Level >= level) { includechild = true; } #region 计算销量数据 decimal happenApplyCost = 0, forcast = 0, preSales = 0, aVGSales = 0, feeRate = 0; DataRow[] drows = dtSummary_Sub.Select(filter); if (drows.Length > 0) { decimal.TryParse(drows[0]["HappenApplyCost"].ToString(), out happenApplyCost); decimal.TryParse(drows[0]["Forcast"].ToString(), out forcast); decimal.TryParse(drows[0]["PreSales"].ToString(), out preSales); decimal.TryParse(drows[0]["AVGSales"].ToString(), out aVGSales); decimal.TryParse(drows[0]["FeeRate"].ToString(), out feeRate); } row["本月费用合计"] = happenApplyCost.ToString("0.##"); row["上月销量"] = preSales.ToString("0.##"); row["平均销量"] = aVGSales.ToString("0.##"); row["预计销量"] = forcast.ToString("0.##"); row["预计费点"] = feeRate.ToString("0.##%"); sumHappenApplyCost += (decimal)row["本月费用合计"]; sumTotalVolume += (decimal)row["上月销量"]; sumAvgVolume += (decimal)row["平均销量"]; sumSalesForcast += (decimal)row["预计销量"]; #endregion #region 预算总额及余额 if (dicFeeType != null && dicFeeType.Description == "BudgetControl" && level < 10) { row["预算总额"] = (FNA_BudgetBLL.GetSumBudgetAmount(month, id, feetype, includechild) + FNA_BudgetBLL.GetSumBudgetAmount(month, id, 0, includechild)); sumTotalBudget += (decimal)row["预算总额"]; row["其中扩增额"] = (FNA_BudgetExtraApplyBLL.GetExtraAmount(month, id, feetype, includechild) + FNA_BudgetExtraApplyBLL.GetExtraAmount(month, id, 0, includechild)); sumExtBudget += (decimal)row["其中扩增额"]; row["预算余额"] = (FNA_BudgetBLL.GetUsableAmount(month, id, feetype, includechild) + FNA_BudgetBLL.GetUsableAmount(month, id, 0, includechild)); sumUsableAmount += (decimal)row["预算余额"]; row["终结费用"] = (FNA_FeeApplyBLL.GetCancelCost(month, id, feetype, includechild) + FNA_FeeApplyBLL.GetCancelCost(month, id, 0, includechild)); sumCancelCost += (decimal)row["终结费用"]; } #endregion //#region 计算预计费点 //if (dicFeeType != null && dicFeeType.Description == "FeeRateControl" && level < 10) //{ // row["上月余额"] = FNA_BudgetBLL.GetUsableAmount(month - 1, id, feetype, includechild); // sumPreMonthBudgetBalance += (decimal)row["上月余额"]; // if ((decimal)row["预计销量"] != 0) // row["预计费点"] = (((decimal)row["费用合计"] - (decimal)row["上月余额"]) / (decimal)row["预计销量"]).ToString("0.00%"); //} //else if ((decimal)row["预计销量"] != 0) // row["预计费点"] = ((decimal)row["费用合计"] / (decimal)row["预计销量"]).ToString("0.00%"); //#endregion } #region 求合计行 if (id == 0) { row["本月费用合计"] = sumHappenApplyCost.ToString("0.##"); row["上月销量"] = sumTotalVolume.ToString("0.##"); row["平均销量"] = sumAvgVolume.ToString("0.##"); row["预计销量"] = sumSalesForcast.ToString("0.##"); #region 预算总额及余额 if (dicFeeType != null && dicFeeType.Description == "BudgetControl" && level < 10) { row["预算总额"] = sumTotalBudget.ToString("0.##"); row["其中扩增额"] = sumExtBudget.ToString("0.##"); row["预算余额"] = sumUsableAmount.ToString("0.##"); row["终结费用"] = sumCancelCost.ToString("0.##"); } #endregion #region 预计费点 if (sumSalesForcast != 0) { if (dicFeeType != null && dicFeeType.Description == "FeeRateControl" && level < 10) { row["上月余额"] = sumPreMonthBudgetBalance; row["预计费点"] = (((decimal)row["费用合计"] - sumPreMonthBudgetBalance) / sumSalesForcast).ToString("0.##%"); } else { row["预计费点"] = ((decimal)row["费用合计"] / sumSalesForcast).ToString("0.##%"); } } #endregion } #endregion } gv_List.DataSource = dtSummary; gv_List.DataBind(); if (dtSummary.Columns.Count >= 24) { gv_List.Width = new Unit(dtSummary.Columns.Count * 55); } else { gv_List.Width = new Unit(100, UnitType.Percentage); } MatrixTable.GridViewMatric(gv_List); if (level == 20) { //按终端门店显示时,将上下行相同管理片区合并 MatrixTable.GridViewMergSampeValueRow(gv_List, 0); MatrixTable.GridViewMergSampeValueRow(gv_List, 1); } #region 是否可以批量审批 if (state != 1 || level >= 10) { gv_List.Columns[0].ItemStyle.Width = new Unit(1); foreach (GridViewRow row in gv_List.Rows) { row.FindControl("bt_Approved").Visible = false; row.FindControl("bt_UnApproved").Visible = false; } } else { gv_List.Columns[0].ItemStyle.Width = new Unit(68); } #endregion #endregion } else { string condition = "1=1"; #region 组织明细记录的查询条件 //管理片区及所有下属管理片区 if (tr_OrganizeCity.SelectValue == "0") { #region 绑定用户可管辖的管理片区 Org_StaffBLL staff = new Org_StaffBLL((int)Session["UserID"]); tr_OrganizeCity.DataSource = staff.GetStaffOrganizeCity(); if (tr_OrganizeCity.DataSource.Select("ID = 1").Length > 0) { tr_OrganizeCity.RootValue = "0"; tr_OrganizeCity.SelectValue = "1"; } else { tr_OrganizeCity.RootValue = new Addr_OrganizeCityBLL(staff.Model.OrganizeCity).Model.SuperID.ToString(); tr_OrganizeCity.SelectValue = staff.Model.OrganizeCity.ToString(); } if ((int)ViewState["OrganizeCity"] > 0) { tr_OrganizeCity.SelectValue = ViewState["OrganizeCity"].ToString(); } #endregion } if (tr_OrganizeCity.SelectValue != "1") { Addr_OrganizeCityBLL orgcity = new Addr_OrganizeCityBLL(int.Parse(tr_OrganizeCity.SelectValue)); string orgcitys = orgcity.GetAllChildNodeIDs(); if (orgcitys != "") { orgcitys += ","; } orgcitys += tr_OrganizeCity.SelectValue; condition += " AND FNA_FeeApply.OrganizeCity IN (" + orgcitys + ")"; } //会计月条件 condition += " AND FNA_FeeApply.AccountMonth = " + ddl_Month.SelectedValue; //费用类型 if (ddl_FeeType.SelectedValue != "0") { condition += " AND FNA_FeeApply.FeeType = " + ddl_FeeType.SelectedValue; } int accounttile = 0; int.TryParse(tr_AccountTitle.SelectValue, out accounttile); decimal _cost = 0; decimal.TryParse(tbx_ApplyCost.Text, out _cost); //费用科目 if (accounttile > 1) { DataTable dt = TreeTableBLL.GetAllChildByNodes("MCS_PUB.dbo.AC_AccountTitle", "ID", "SuperID", accounttile.ToString()); string ids = ""; foreach (DataRow dr in dt.Rows) { ids += dr["ID"].ToString() + ","; } ids += accounttile.ToString(); if (_cost == 0) { condition += " AND FNA_FeeApply.ID IN (SELECT ApplyID FROM MCS_FNA.dbo.FNA_FeeApplyDetail WHERE AccountTitle IN(" + ids + ") AND FNA_FeeApplyDetail.ApplyID=FNA_FeeApply.ID)"; } else { condition += " AND FNA_FeeApply.ID IN (SELECT ApplyID FROM MCS_FNA.dbo.FNA_FeeApplyDetail WHERE AccountTitle IN(" + ids + ") AND (ApplyCost+AdjustCost)" + ddl_ApplyCostOP.SelectedValue + " " + _cost.ToString() + " AND FNA_FeeApplyDetail.ApplyID=FNA_FeeApply.ID)"; } } else if (_cost != 0)//金额判断 { condition += " AND FNA_FeeApply.ID IN (SELECT ApplyID FROM MCS_FNA.dbo.FNA_FeeApplyDetail WHERE (ApplyCost+AdjustCost)" + ddl_ApplyCostOP.SelectedValue + " " + _cost.ToString() + " AND FNA_FeeApplyDetail.ApplyID=FNA_FeeApply.ID)"; } //审批状态 if (ddl_State.SelectedValue == "0") { condition += " AND FNA_FeeApply.State IN (2,3) "; } else if (ddl_State.SelectedValue == "1") { condition += @" AND FNA_FeeApply.State = 2 AND FNA_FeeApply.ApproveTask IN (SELECT EWF_Task_Job.Task FROM MCS_EWF.dbo.EWF_Task_JobDecision INNER JOIN MCS_EWF.dbo.EWF_Task_Job ON EWF_Task_JobDecision.Job = EWF_Task_Job.ID WHERE EWF_Task_JobDecision.RecipientStaff=" + Session["UserID"].ToString() + @" AND EWF_Task_JobDecision.DecisionResult=1 and EWF_Task_Job.Status=3)"; } else if (ddl_State.SelectedValue == "2") { condition += " AND FNA_FeeApply.State = 3 "; } else if (ddl_State.SelectedValue == "3") { AC_AccountMonth m = new AC_AccountMonthBLL(month).Model; condition += @" AND FNA_FeeApply.State IN (2,3) AND FNA_FeeApply.ApproveTask IN (SELECT EWF_Task_Job.Task FROM MCS_EWF.dbo.EWF_Task_JobDecision INNER JOIN MCS_EWF.dbo.EWF_Task_Job ON EWF_Task_JobDecision.Job = EWF_Task_Job.ID WHERE EWF_Task_JobDecision.RecipientStaff=" + Session["UserID"].ToString() + @" AND EWF_Task_JobDecision.DecisionResult IN(2,5,6) AND EWF_Task_JobDecision.DecisionTime BETWEEN DATEADD(month,-1,'" + m.BeginDate.ToString("yyyy-MM-dd") + @"') AND DATEADD(month,3,'" + m.BeginDate.ToString("yyyy-MM-dd") + @"'))"; } #endregion gv_ListDetail.ConditionString = condition; gv_ListDetail.BindGrid(); btn_Approve.Visible = state == 1; btn_UnApprove.Visible = state == 1; gv_ListDetail.Columns[gv_ListDetail.Columns.Count - 1].Visible = state == 1; } }
private const int HDMSource = 20; //营养教育来源 protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { #region 获取参数 ViewState["OfferBalanceID"] = Request.QueryString["OfferBalanceID"] != null?int.Parse(Request.QueryString["OfferBalanceID"].ToString()) : 0; ViewState["BeginTime"] = Request.QueryString["BeginTime"] != null ? Request.QueryString["BeginTime"].ToString() : ""; ViewState["EndTime"] = Request.QueryString["EndTime"] != null ? Request.QueryString["EndTime"].ToString() : ""; ViewState["Staff"] = Request.QueryString["Staff"] != null?int.Parse(Request.QueryString["Staff"].ToString()) : 0; ViewState["Client"] = string.IsNullOrEmpty(Request.QueryString["Client"]) == true ? 0 : int.Parse(Request.QueryString["Client"].ToString()); ViewState["OfferMan"] = string.IsNullOrEmpty(Request.QueryString["OfferMan"]) == true ? 0 : int.Parse(Request.QueryString["OfferMan"].ToString()); ViewState["OfferMode"] = Request.QueryString["OfferMode"] != null?int.Parse(Request.QueryString["OfferMode"].ToString()) : 0; ViewState["Source"] = Request.QueryString["Source"] != null?int.Parse(Request.QueryString["Source"].ToString()) : 0; ViewState["Product"] = Request.QueryString["Product"] != null?int.Parse(Request.QueryString["Product"]) : 0; ViewState["OfferModeName"] = ""; ViewState["IsSummaryRow"] = Request.QueryString["IsSummaryRow"] != null ? Request.QueryString["IsSummaryRow"] : "N"; #region 医务派发方式 if (Request.QueryString["OfferModeName"] != null && (int)ViewState["OfferMode"] == 0) { ViewState["OfferModeName"] = Request.QueryString["OfferModeName"].ToString(); string name = ViewState["OfferModeName"].ToString(); Dictionary <string, Dictionary_Data> dic_offermode = DictionaryBLL.GetDicCollections("CSO_OfferMode"); Dictionary_Data dic_data = dic_offermode.Values.FirstOrDefault(p => p.Name == name); if (dic_data != null) { ViewState["OfferMode"] = int.Parse(dic_data.Code); } } #endregion #region 医生结算标准 ViewState["DoctorStandard"] = 0; if (Request.QueryString["DoctorStandard"] != null) { string name = Request.QueryString["DoctorStandard"]; Dictionary <string, Dictionary_Data> dic_standard = DictionaryBLL.GetDicCollections("CSO_DocStandard"); Dictionary_Data dic_data = dic_standard.Values.FirstOrDefault(p => p.Name == name); if (dic_data != null) { ViewState["DoctorStandard"] = int.Parse(dic_data.Code); } } #endregion ViewState["ConfirmFlag"] = Request.QueryString["ConfirmFlag"] != null?int.Parse(Request.QueryString["ConfirmFlag"].ToString()) : 0; ViewState["DataFlag"] = Request.QueryString["DataFlag"] != null?int.Parse(Request.QueryString["DataFlag"].ToString()) : 0; ViewState["OrganizeCity"] = Request.QueryString["OrganizeCity"] != null?int.Parse(Request.QueryString["OrganizeCity"].ToString()) : 0; ViewState["PageIndex"] = 0; #endregion BindGrid(); } }