Пример #1
0
        private void RptBind()
        {
            string sql = " Status >= 2 ";

            if (!string.IsNullOrEmpty(_beginTime))
            {
                sql += " AND FactBackTime >= '" + _beginTime + "' ";
                txtBeginTime.Text = _beginTime;
            }
            else
            {
                sql += " AND FactBackTime >= '" + DateTime.Now.AddMonths(-1) + "' ";
                txtBeginTime.Text = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd");
            }
            if (!string.IsNullOrEmpty(_endTime))
            {
                sql            += " AND FactBackTime <= '" + _endTime + "' ";
                txtEndTime.Text = _endTime;
            }
            else
            {
                sql            += " AND FactBackTime <= '" + DateTime.Now + "' ";
                txtEndTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
            }
            string ids = string.Empty;

            BLL.TransportOrder bll  = new BLL.TransportOrder();
            DataSet            tods = bll.GetTotalList(sql);

            if (tods != null && tods.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in tods.Tables[0].Rows)
                {
                    ids += dr["Id"].ToString() + ",";
                    totalFactRepayment += Utils.StrToDecimal(dr["FactRepayment"].ToString(), 0.00M);
                    totalCarriage      += Utils.StrToDecimal(dr["FactCarriage"].ToString(), 0.00M);
                    totalAdvance       += Utils.StrToDecimal(dr["Advance"].ToString(), 0.00M);
                }
                if (ids.EndsWith(","))
                {
                    ids = ids.TrimEnd(',');
                }
            }
            if (!string.IsNullOrEmpty(ids))
            {
                BLL.Order itemBll = new BLL.Order();
                DataSet   itemds  = itemBll.GetList(" TransportOrderId IN (" + ids + ") ");
                if (itemds != null && itemds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in itemds.Tables[0].Rows)
                    {
                        totalIncome += Utils.StrToDecimal(dr["Freight"].ToString(), 0.00M);
                    }
                }

                BLL.Consumption cBll = new BLL.Consumption();
                DataSet         cds  = cBll.GetSumList(" TransportOrderId IN (" + ids + ") ");
                if (cds != null && cds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in cds.Tables[0].Rows)
                    {
                        totalCostItem += Utils.StrToDecimal(dr["TotalMoney"].ToString(), 0.00M);
                        costItem      += "<tr><td width=\"20%\" style=\"text-align:right\">" + dr["Name"].ToString() + "&nbsp;:&nbsp;&nbsp;</td>";
                        costItem      += "<td>¥" + string.Format("{0:N2}", dr["TotalMoney"]) + "</td></tr>";
                    }
                }
            }

            totalGain = totalIncome + totalFactRepayment - totalCarriage - totalAdvance - totalCostItem;
        }
Пример #2
0
        private void RptBind()
        {
            string sql = " Status >= 2 ";
            if (!string.IsNullOrEmpty(_beginTime))
            {
                sql += " AND FactBackTime >= '" + _beginTime + "' ";
                txtBeginTime.Text = _beginTime;
            }
            else
            {
                sql += " AND FactBackTime >= '" + DateTime.Now.AddMonths(-1) + "' ";
                txtBeginTime.Text = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd");
            }
            if (!string.IsNullOrEmpty(_endTime))
            {
                sql += " AND FactBackTime <= '" + _endTime + "' ";
                txtEndTime.Text = _endTime;
            }
            else
            {
                sql += " AND FactBackTime <= '" + DateTime.Now + "' ";
                txtEndTime.Text = DateTime.Now.ToString("yyyy-MM-dd");
            }
            string ids = string.Empty;
            BLL.TransportOrder bll = new BLL.TransportOrder();
            DataSet tods = bll.GetTotalList(sql);
            if (tods != null && tods.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in tods.Tables[0].Rows)
                {
                    ids += dr["Id"].ToString() + ",";
                    totalFactRepayment += Utils.StrToDecimal(dr["FactRepayment"].ToString(), 0.00M);
                    totalCarriage += Utils.StrToDecimal(dr["FactCarriage"].ToString(), 0.00M);
                    totalAdvance += Utils.StrToDecimal(dr["Advance"].ToString(), 0.00M);
                }
                if (ids.EndsWith(","))
                {
                    ids = ids.TrimEnd(',');
                }
            }
            if (!string.IsNullOrEmpty(ids))
            {
                BLL.Order itemBll = new BLL.Order();
                DataSet itemds = itemBll.GetList(" TransportOrderId IN (" + ids + ") ");
                if (itemds != null && itemds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in itemds.Tables[0].Rows)
                    {
                        totalIncome += Utils.StrToDecimal(dr["Freight"].ToString(), 0.00M);
                    }
                }

                BLL.Consumption cBll = new BLL.Consumption();
                DataSet cds = cBll.GetSumList(" TransportOrderId IN (" + ids + ") ");
                if (cds != null && cds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow dr in cds.Tables[0].Rows)
                    {
                        totalCostItem += Utils.StrToDecimal(dr["TotalMoney"].ToString(), 0.00M);
                        costItem += "<tr><td width=\"20%\" style=\"text-align:right\">"+dr["Name"].ToString()+"&nbsp;:&nbsp;&nbsp;</td>";
                        costItem += "<td>¥" + string.Format("{0:N2}", dr["TotalMoney"]) + "</td></tr>";
                    }
                }
            }

            totalGain = totalIncome + totalFactRepayment - totalCarriage - totalAdvance - totalCostItem;
        }