Пример #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="modelType">1:交班 2:日结</param>
 /// <param name="recordId"></param>
 public FormSalesReport(int modelType, object recordId)
 {
     InitializeComponent();
     this.lbWeather.Visible              = false;
     this.cmbWeather.Visible             = false;
     this.dgvSalesReport.BackgroundColor = SystemColors.ButtonFace;
     m_ModelType = modelType;
     if (modelType == 1)
     {
         btnSalesReport.Text      = "交班";
         btnSalesReport.Enabled   = false;
         btnSalesReport.BackColor = ConstantValuePool.DisabledColor;
         this.Text = "交班报表";
         Guid handoverRecordId = recordId == null ? Guid.Empty : (Guid)recordId;
         bizReport = BusinessReportService.GetInstance().GetReportDataByHandoverRecordId(handoverRecordId);
     }
     else if (modelType == 2)
     {
         btnSalesReport.Text      = "日结";
         btnSalesReport.Enabled   = false;
         btnSalesReport.BackColor = ConstantValuePool.DisabledColor;
         this.Text = "日结报表";
         string dailyStatementNo = recordId.ToString();
         bizReport = BusinessReportService.GetInstance().GetReportDataByDailyStatement(dailyStatementNo);
     }
 }
Пример #2
0
        /// <summary>
        /// 获取日结营业额统计
        /// </summary>
        public static byte[] GetReportDataByDailyStatement(byte[] itemBuffer)
        {
            byte[] objRet           = null;
            string dailyStatementNo = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, ParamFieldLength.DAILY_STATEMENT_NO).Trim('\0');

            BusinessReport bizReport = BusinessReportService.GetInstance().GetReportDataByDailyStatement(dailyStatementNo);

            if (bizReport == null)
            {
                //数据获取失败
                objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            }
            else
            {
                string json     = JsonConvert.SerializeObject(bizReport);
                byte[] jsonByte = Encoding.UTF8.GetBytes(json);

                int transCount = BasicTypeLength.INT32 + BasicTypeLength.INT32 + jsonByte.Length;
                objRet = new byte[transCount];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
                Array.Copy(jsonByte, 0, objRet, 2 * BasicTypeLength.INT32, jsonByte.Length);
            }
            return(objRet);
        }
Пример #3
0
        /// <summary>
        /// 获取营业额统计
        /// </summary>
        public static byte[] GetReportDataByHandoverRecordID(byte[] itemBuffer)
        {
            byte[] objRet           = null;
            string handoverRecordId = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, ParamFieldLength.HANDOVER_RECORD_ID).Trim('\0');

            BusinessReport bizReport = null;

            if (!string.IsNullOrEmpty(handoverRecordId))
            {
                bizReport = BusinessReportService.GetInstance().GetReportDataByHandoverRecordId(new Guid(handoverRecordId));
            }
            if (bizReport == null)
            {
                //数据获取失败
                objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            }
            else
            {
                string json     = JsonConvert.SerializeObject(bizReport);
                byte[] jsonByte = Encoding.UTF8.GetBytes(json);

                int transCount = BasicTypeLength.INT32 + BasicTypeLength.INT32 + jsonByte.Length;
                objRet = new byte[transCount];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
                Array.Copy(jsonByte, 0, objRet, 2 * BasicTypeLength.INT32, jsonByte.Length);
            }
            return(objRet);
        }
Пример #4
0
        public static byte[] GetItemPriceListByGroup(byte[] itemBuffer)
        {
            byte[] objRet    = null;
            string beginDate = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, ParamFieldLength.BEGINDATE).Trim('\0');
            string endDate   = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.BEGINDATE, ParamFieldLength.ENDDATE).Trim('\0');

            IList <GroupPrice> groupPriceList = BusinessReportService.GetInstance().GetItemPriceListByGroup(DateTime.Parse(beginDate), DateTime.Parse(endDate));

            if (groupPriceList == null)
            {
                //数据获取失败
                objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            }
            else
            {
                string json     = JsonConvert.SerializeObject(groupPriceList);
                byte[] jsonByte = Encoding.UTF8.GetBytes(json);

                int transCount = BasicTypeLength.INT32 + BasicTypeLength.INT32 + jsonByte.Length;
                objRet = new byte[transCount];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
                Array.Copy(jsonByte, 0, objRet, 2 * BasicTypeLength.INT32, jsonByte.Length);
            }
            return(objRet);
        }
Пример #5
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            _dicItemPriceByGroup.Clear();
            dataGirdViewExt1.Rows.Clear();
            string             beginDate      = dateTimePicker1.Value.ToString("yyyy-MM-dd 00:00:00");
            string             endDate        = dateTimePicker2.Value.ToString("yyyy-MM-dd 23:59:59");
            IList <GroupPrice> groupPriceList = BusinessReportService.GetInstance().GetItemPriceListByGroup(beginDate, endDate);

            if (groupPriceList != null && groupPriceList.Count > 0)
            {
                decimal totalQty    = 0M;
                decimal totalAmount = 0M;
                foreach (GroupPrice item in groupPriceList)
                {
                    totalQty    += item.ItemsTotalQty;
                    totalAmount += item.ItemsTotalPrice;
                    if (_dicItemPriceByGroup.ContainsKey(item.GroupName))
                    {
                        _dicItemPriceByGroup[item.GroupName].Add(item);
                    }
                    else
                    {
                        List <GroupPrice> temp = new List <GroupPrice>();
                        temp.Add(item);
                        _dicItemPriceByGroup.Add(item.GroupName, temp);
                    }
                }
                foreach (KeyValuePair <string, List <GroupPrice> > item in _dicItemPriceByGroup)
                {
                    int index = dataGirdViewExt1.Rows.Add();
                    dataGirdViewExt1.Rows[index].Cells["colGroupName"].Value = "[" + item.Key + "]";
                    foreach (GroupPrice groupPrice in item.Value)
                    {
                        index = dataGirdViewExt1.Rows.Add();
                        dataGirdViewExt1.Rows[index].Cells["colItemsName"].Value       = groupPrice.ItemsName;
                        dataGirdViewExt1.Rows[index].Cells["colItemsTotalQty"].Value   = groupPrice.ItemsTotalQty;
                        dataGirdViewExt1.Rows[index].Cells["colItemsTotalPrice"].Value = groupPrice.ItemsTotalPrice;
                    }
                }
                txtTotalQty.Text    = totalQty.ToString("f1");
                txtTotalAmount.Text = totalAmount.ToString("f2");
            }
        }
Пример #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="modelType">1:交班 2:日结</param>
 public FormSalesReport(int modelType)
 {
     InitializeComponent();
     this.dgvSalesReport.BackgroundColor = SystemColors.ButtonFace;
     m_ModelType = modelType;
     if (modelType == 1)
     {
         this.lbWeather.Visible  = false;
         this.cmbWeather.Visible = false;
         btnSalesReport.Text     = "交班";
         this.Text = "交班报表";
         bizReport = BusinessReportService.GetInstance().GetReportDataByHandover(ConstantValuePool.BizSettingConfig.DeviceNo);
     }
     else if (modelType == 2)
     {
         this.cmbWeather.SelectedIndex = 0;
         btnSalesReport.Text           = "日结";
         this.Text = "日结报表";
         bizReport = BusinessReportService.GetInstance().GetReportDataByDailyStatement(string.Empty);
     }
 }