Example #1
0
        private void LoadData()
        {
            InventoryPurchaseBLL aInventoryPurchaseBll=new InventoryPurchaseBLL();
            List<InventoryPurchase> aInventoryPurchases = new List<InventoryPurchase>();
            aInventoryPurchases = aInventoryPurchaseBll.GetInventoryPurchaseById(itemId);
            aInventoryPurchases = aInventoryPurchases.OrderByDescending(a => a.Date).ToList();

            DateTime fromdate = DateTime.Now.Date;
            DateTime todate = DateTime.Now.Date;
            todate = todate.AddDays(1);
            fromdate = fromdate.Date;
            todate = todate.Date;
            todate = todate.AddSeconds(-1);
            List<InventoryStockReport> aInventoryStockReports = new List<InventoryStockReport>();
            InventoryStockReportBLL aBll = new InventoryStockReportBLL();
            aInventoryStockReports = aBll.GetInventoryStockReportBetweenDate(fromdate, todate);

            InventoryStockReport aInventoryStockReport = aInventoryStockReports.SingleOrDefault(a => a.ItemId == itemId);

            List<InventoryPurchase> tempInventoryPurchases = new List<InventoryPurchase>();
            double sum = 0;

            foreach (InventoryPurchase inventoryPurchase in aInventoryPurchases)
            {

                sum += inventoryPurchase.Quantity;
                if(sum >= aInventoryStockReport.BalanceQty)
                {
                    double qty = sum - aInventoryStockReport.BalanceQty;
                    inventoryPurchase.Quantity -= qty;
                    tempInventoryPurchases.Add(inventoryPurchase);
                    break;
                }
                else tempInventoryPurchases.Add(inventoryPurchase);
            }

            var item = tempInventoryPurchases.Select(a => new { ItemName = a.Item.ItemName, Qty = a.Quantity, ExpireDate = a.ExpireDate, PurchaseDate = a.Date }).ToList();
            itemShowDataGridView.DataSource = item;
        }
Example #2
0
 private void showButton_Click(object sender, EventArgs e)
 {
     DateTime fromdate = fromdateTimePicker.Value;
     DateTime todate = todateTimePicker.Value;
     todate = todate.AddDays(1);
     fromdate = fromdate.Date;
     todate = todate.Date;
     todate = todate.AddSeconds(-1);
     List<InventoryStockReport> aInventoryStockReports=new List<InventoryStockReport>();
     InventoryStockReportBLL aBll=new InventoryStockReportBLL();
     aInventoryStockReports = aBll.GetInventoryStockReportBetweenDate(fromdate, todate);
     ShowReport(aInventoryStockReports);
 }
Example #3
0
 private void printStockReportbutton_Click(object sender, EventArgs e)
 {
     InventoryStockReportBLL aBll = new InventoryStockReportBLL();
     List<InventoryStockReport> aReports = new List<InventoryStockReport>();
     aReports = (List<InventoryStockReport>)inventorystockDataGridView.DataSource;
     if (aReports == null)
     {
         MessageBox.Show("No data Available Into GridView");
         return;
     }
     int printlenght = aReports.Count;
     PrintDocument doc = new TextDocument(aBll.PrintKitchenStockReport(aReports), printlenght);
     printReportLogoType = 1;
     doc.PrintPage += this.Doc_PrintPage;
     doc.DefaultPageSettings.Landscape = true;
     PrintDialog dlgSettings = new PrintDialog();
     dlgSettings.Document = doc;
     dlgSettings.UseEXDialog = true;
     if (dlgSettings.ShowDialog() == DialogResult.OK)
     {
         doc.Print();
     }
 }