예제 #1
0
        /// <summary>
        /// 导出全部
        /// </summary>
        public override void ExportAllAction(UltraGrid paramGrid, string paramGridName = "")
        {
            paramGridName = tabControlFull.Tabs[SysConst.EN_LIST].Selected ? "组织与客户资金往来统计汇总" : "组织与客户资金往来统计明细";
            OrgAndCustomerAmountTransReportQCModel tempConditionDS = new OrgAndCustomerAmountTransReportQCModel()
            {
                //SqlId
                SqlId = tabControlFull.Tabs[SysConst.EN_LIST].Selected ? SQLID.RPT_OrgAndCustomerAmountTransReport_SQL01 : SQLID.RPT_OrgAndCustomerAmountTransReport_SQL02,
                //客户ID
                CustomerID = this.mcbWhere_Client_Name.SelectedValue,
                PageIndex  = 1,
                PageSize   = null
            };

            //组织ID
            if (string.IsNullOrEmpty(mcbWhere_Sales_Org.SelectedValue))
            {
                var tmpOrgList = _orgList.Select(p => p.Org_ID).ToList();

                if (tmpOrgList.Count > 0)
                {
                    ConditionDS.OrgIdList = string.Join(SysConst.Semicolon_DBC, tmpOrgList);
                }
            }
            else
            {
                ConditionDS.OrgIdList = mcbWhere_Sales_Org.SelectedValue;
            }
            if (this.dtWhere_Sales_TimeStart.Value != null)
            {
                //销售时间-开始
                tempConditionDS.StartTime = this.dtWhere_Sales_TimeStart.DateTime;
            }
            if (this.dtWhere_Sales_TimeEnd.Value != null)
            {
                //销售时间-终了
                tempConditionDS.EndTime = this.dtWhere_Sales_TimeEnd.DateTime;
            }

            if (tabControlFull.Tabs[SysConst.EN_LIST].Selected)
            {
                List <OrgAndCustomerAmountTransTotalReportUIModel> resultAllList = new List <OrgAndCustomerAmountTransTotalReportUIModel>();
                _bll.QueryForList(SQLID.RPT_OrgAndCustomerAmountTransReport_SQL01, tempConditionDS, resultAllList);

                decimal totalAccountPayableAmountOfCurPage = 0;
                decimal totalPaidAmountOfCurPage           = 0;
                decimal totalAccountPayableAmountOfAllPage = 0;
                decimal totalPaidAmountOfAllPage           = 0;

                if (resultAllList.Count > 0)
                {
                    OrgAndCustomerAmountTransTotalReportUIModel subObject = resultAllList[0];
                    totalAccountPayableAmountOfAllPage = (subObject.TotalAccountReceivableAmount ?? 0);
                    totalPaidAmountOfAllPage           = (subObject.TotalReceivedAmount ?? 0);
                }

                foreach (var loopSotckInTotalItem in resultAllList)
                {
                    totalAccountPayableAmountOfCurPage += (loopSotckInTotalItem.ARB_AccountReceivableAmount ?? 0);
                    totalPaidAmountOfCurPage           += (loopSotckInTotalItem.ARB_ReceivedAmount ?? 0);
                }
                OrgAndCustomerAmountTransTotalReportUIModel curPageTotal = new OrgAndCustomerAmountTransTotalReportUIModel
                {
                    CustomerName = _sumCurPageDesc,
                    ARB_AccountReceivableAmount = Math.Round(totalAccountPayableAmountOfCurPage, 2),
                    ARB_ReceivedAmount          = Math.Round(totalPaidAmountOfCurPage, 2)
                };
                resultAllList.Add(curPageTotal);

                OrgAndCustomerAmountTransTotalReportUIModel allPageTotal = new OrgAndCustomerAmountTransTotalReportUIModel
                {
                    CustomerName = _sumAllPageDesc,
                    ARB_AccountReceivableAmount = Math.Round(totalAccountPayableAmountOfAllPage, 2),
                    ARB_ReceivedAmount          = Math.Round(totalPaidAmountOfAllPage, 2)
                };
                resultAllList.Add(allPageTotal);

                UltraGrid allGrid = OrgAndCustomerAmountTransReportGrid;
                allGrid.DataSource = resultAllList;
                allGrid.DataBind();

                base.ExportAllAction(allGrid, paramGridName);

                OrgAndCustomerAmountTransReportGrid.DataSource = _orgAndCustomerAmountTransTotalReportDS;
                OrgAndCustomerAmountTransReportGrid.DataBind();
            }
            else
            {
                List <OrgAndCustomerAmountTransDetailReportUIModel> resultAllList = new List <OrgAndCustomerAmountTransDetailReportUIModel>();
                _bll.QueryForList(SQLID.RPT_OrgAndCustomerAmountTransReport_SQL02, tempConditionDS, resultAllList);

                decimal totalAutoPartsQtyOfCurPage    = 0;
                decimal totalAutoPartsAmountOfCurPage = 0;
                decimal totalAutoPartsQtyOfAllPage    = 0;
                decimal totalAutoPartsAmountOfAllPage = 0;

                if (resultAllList.Count > 0)
                {
                    OrgAndCustomerAmountTransDetailReportUIModel subObject = resultAllList[0];
                    TotalRecordCountOfDetail      = (subObject.RecordCount ?? 0);
                    totalAutoPartsQtyOfAllPage    = (subObject.TotalAutoPartsQty ?? 0);
                    totalAutoPartsAmountOfAllPage = (subObject.TotalAutoPartsAmount ?? 0);
                }
                else
                {
                    TotalRecordCountOfDetail = 0;
                }

                foreach (var loopSotckInDetailItem in resultAllList)
                {
                    totalAutoPartsQtyOfCurPage    += (loopSotckInDetailItem.AutoPartsQty ?? 0);
                    totalAutoPartsAmountOfCurPage += (loopSotckInDetailItem.AutoPartsAmount ?? 0);
                }
                OrgAndCustomerAmountTransDetailReportUIModel curPageTotal = new OrgAndCustomerAmountTransDetailReportUIModel
                {
                    APA_Specification = _sumCurPageDesc,
                    AutoPartsQty      = Math.Round(totalAutoPartsQtyOfCurPage, 0),
                    AutoPartsAmount   = Math.Round(totalAutoPartsAmountOfCurPage, 2)
                };
                resultAllList.Add(curPageTotal);

                OrgAndCustomerAmountTransDetailReportUIModel allPageTotal = new OrgAndCustomerAmountTransDetailReportUIModel
                {
                    APA_Specification = _sumAllPageDesc,
                    AutoPartsQty      = Math.Round(totalAutoPartsQtyOfAllPage, 0),
                    AutoPartsAmount   = Math.Round(totalAutoPartsAmountOfAllPage, 2)
                };
                resultAllList.Add(allPageTotal);

                UltraGrid allGrid = OrgAndCustomerAmountTransDetailGrid;
                allGrid.DataSource = resultAllList;
                allGrid.DataBind();

                base.ExportAllAction(allGrid, paramGridName);

                OrgAndCustomerAmountTransDetailGrid.DataSource = _orgAndCustomerAmountTransDetailReportDS;
                OrgAndCustomerAmountTransDetailGrid.DataBind();
            }
        }
예제 #2
0
        /// <summary>
        /// 查询组织与客户资金往来统计明细
        /// </summary>
        /// <param name="paramTotalReport">汇总行</param>
        private void QueryOrgAndCustomerAmountTransDetailReport(OrgAndCustomerAmountTransTotalReportUIModel paramTotalReport = null)
        {
            try
            {
                OrgAndCustomerAmountTransReportQCModel argsModel = ConditionDS;
                argsModel.PageSize  = PageSizeOfDetail;
                argsModel.PageIndex = PageIndexOfDetail;
                argsModel.SqlId     = SQLID.RPT_OrgAndCustomerAmountTransReport_SQL02;
                if (paramTotalReport != null)
                {
                    argsModel.OrgIdList    = paramTotalReport.OrgID;
                    argsModel.CustomerID   = paramTotalReport.CustomerID;
                    argsModel.BusinessType = paramTotalReport.BusinessType;
                }
                else
                {
                    argsModel.BusinessType = null;
                }

                _orgAndCustomerAmountTransDetailReportDS = new List <OrgAndCustomerAmountTransDetailReportUIModel>();
                _bll.QueryForList(argsModel.SqlId, argsModel, _orgAndCustomerAmountTransDetailReportDS);

                decimal totalAutoPartsQtyOfCurPage    = 0;
                decimal totalAutoPartsAmountOfCurPage = 0;
                decimal totalAutoPartsQtyOfAllPage    = 0;
                decimal totalAutoPartsAmountOfAllPage = 0;

                if (_orgAndCustomerAmountTransDetailReportDS.Count > 0)
                {
                    OrgAndCustomerAmountTransDetailReportUIModel subObject = _orgAndCustomerAmountTransDetailReportDS[0];
                    TotalRecordCountOfDetail      = (subObject.RecordCount ?? 0);
                    totalAutoPartsQtyOfAllPage    = (subObject.TotalAutoPartsQty ?? 0);
                    totalAutoPartsAmountOfAllPage = (subObject.TotalAutoPartsAmount ?? 0);
                }
                else
                {
                    TotalRecordCountOfDetail = 0;
                }

                foreach (var loopDetail in _orgAndCustomerAmountTransDetailReportDS)
                {
                    totalAutoPartsQtyOfCurPage    += (loopDetail.AutoPartsQty ?? 0);
                    totalAutoPartsAmountOfCurPage += (loopDetail.AutoPartsAmount ?? 0);
                }
                OrgAndCustomerAmountTransDetailReportUIModel curPageTotal = new OrgAndCustomerAmountTransDetailReportUIModel
                {
                    APA_Specification = _sumCurPageDesc,
                    AutoPartsQty      = Math.Round(totalAutoPartsQtyOfCurPage, 0),
                    AutoPartsAmount   = Math.Round(totalAutoPartsAmountOfCurPage, 2)
                };
                _orgAndCustomerAmountTransDetailReportDS.Add(curPageTotal);

                OrgAndCustomerAmountTransDetailReportUIModel allPageTotal = new OrgAndCustomerAmountTransDetailReportUIModel
                {
                    APA_Specification = _sumAllPageDesc,
                    AutoPartsQty      = Math.Round(totalAutoPartsQtyOfAllPage, 0),
                    AutoPartsAmount   = Math.Round(totalAutoPartsAmountOfAllPage, 2)
                };
                _orgAndCustomerAmountTransDetailReportDS.Add(allPageTotal);

                //重新计算[总页数],设置最新[总记录条数]
                SetTotalPageCountAndTotalRecordCountOfDetail(TotalRecordCountOfDetail);
                //设置翻页按钮状态
                SetPageButtonStatusOfDetail();

                OrgAndCustomerAmountTransDetailGrid.DataSource = _orgAndCustomerAmountTransDetailReportDS;
                OrgAndCustomerAmountTransDetailGrid.DataBind();
                OrgAndCustomerAmountTransDetailGrid.DisplayLayout.Bands[0].PerformAutoResizeColumns(true, PerformAutoSizeType.VisibleRows);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }