public static int Insert(TotalOutcomesModel totalOutcomes)
 {
     return(DBManager.InsertTotalOutcomes(totalOutcomes));
 }
Esempio n. 2
0
 private void btnSelect_Click(object sender, EventArgs e)
 {
     if (dataGridViewTotalRoom.DataSource == null)
     {
         if (chkbBarTable.Checked == false)
         {
             outcomes      = OutcomesModel.SelectAll();
             totalOutcomes = TotalOutcomesModel.SelectAll();
             SelectRoomName();
             var before = new DateTime(dtpReportTotalBefore.Value.Year, dtpReportTotalBefore.Value.Month, dtpReportTotalBefore.Value.Day, 0, 0, 0);
             var after  = new DateTime(dtpReportTotalAfter.Value.Year, dtpReportTotalAfter.Value.Month, dtpReportTotalAfter.Value.Day, 23, 59, 0);
             dt.Columns.Add(new DataColumn("Отчёты"));
             if (RoomName != null)
             {
                 //TotalOutcomes
                 foreach (var t in totalOutcomes)
                 {
                     if (RoomName == t.RoomId && ((before <= Convert.ToDateTime(t.DateStart) && Convert.ToDateTime(t.DateStart) <= after) && ((before <= Convert.ToDateTime(t.DateFinish)) && Convert.ToDateTime(t.DateFinish) <= after)))
                     {
                         dt.Rows.Add(t.DateStart);
                         //Outcomes
                         foreach (var o in outcomes)
                         {
                             if (t.RoomId == o.RoomId && (Convert.ToDateTime(t.DateStart) <= Convert.ToDateTime(o.DateOrder) && Convert.ToDateTime(o.DateOrder) <= Convert.ToDateTime(t.DateFinish)))
                             {
                                 dt.Rows.Add(o.NameGoods + ":" + o.AmountGoods + " - " + o.AmountGoods * o.PriceGoods);
                             }
                         }
                         dt.Rows.Add(t.DateFinish);
                         dt.Rows.Add("Сумма:" + t.TotalSum);
                         dt.Rows.Add();
                     }
                 }
                 dataGridViewTotalRoom.DataSource = dt;
                 for (int i = 0; i < dataGridViewTotalRoom.Columns.Count; i++)
                 {
                     dataGridViewTotalRoom.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
                 }
             }
         }
         else if (chkbBarTable.Checked == true)
         {
             outcomes      = OutcomesModel.SelectAll();
             totalOutcomes = TotalOutcomesModel.SelectAll();
             RoomName      = BarTable;
             var before = new DateTime(dtpReportTotalBefore.Value.Year, dtpReportTotalBefore.Value.Month, dtpReportTotalBefore.Value.Day, 0, 0, 0);
             var after  = new DateTime(dtpReportTotalAfter.Value.Year, dtpReportTotalAfter.Value.Month, dtpReportTotalAfter.Value.Day, 23, 59, 0);
             dt.Columns.Add(new DataColumn("Отчёты"));
             //TotalOutcomes
             foreach (var t in totalOutcomes)
             {
                 if (RoomName == t.RoomId && ((before <= Convert.ToDateTime(t.DateStart) && Convert.ToDateTime(t.DateStart) <= after) && ((before <= Convert.ToDateTime(t.DateFinish)) && Convert.ToDateTime(t.DateFinish) <= after)))
                 {
                     dt.Rows.Add(t.DateStart);
                     //Outcomes
                     foreach (var o in outcomes)
                     {
                         if (t.RoomId == o.RoomId && (Convert.ToDateTime(t.DateStart) <= Convert.ToDateTime(o.DateOrder) && Convert.ToDateTime(o.DateOrder) <= Convert.ToDateTime(t.DateFinish)))
                         {
                             dt.Rows.Add(o.NameGoods + ":" + o.AmountGoods + " - " + o.AmountGoods * o.PriceGoods);
                         }
                     }
                     dt.Rows.Add(t.DateFinish);
                     dt.Rows.Add("Сумма:" + t.TotalSum);
                     dt.Rows.Add();
                 }
             }
             dataGridViewTotalRoom.DataSource = dt;
             for (int i = 0; i < dataGridViewTotalRoom.Columns.Count; i++)
             {
                 dataGridViewTotalRoom.Columns[i].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
             }
         }
     }
     else
     {
         MessageBox.Show("Очистить данные!!!");
     }
 }
Esempio n. 3
0
 private void ShowTotalOutcomes()
 {
     totalOutcomes = TotalOutcomesModel.SelectAll();
     dataGridViewTotalSum.DataSource = totalOutcomes;
 }