private void ListQtyDetails() { try { pnlList.Visible = true; grdList.Visible = true; grdList.Rows.Clear(); ReportPOvsInvoiceQtyDB sdb = new ReportPOvsInvoiceQtyDB(); List <reportpovsinvoiceqty> qtylist = ReportPOvsInvoiceQtyDB.QtyList(); List <TotalStock> tStock = StockDB.TotalStock(Main.MainStore); foreach (reportpovsinvoiceqty poqty in qtylist) { if (poqty.BalanceQty > 0) { try { grdList.Rows.Add(); grdList.Rows[grdList.RowCount - 1].Cells["StockItemID"].Value = poqty.StockItemID; grdList.Rows[grdList.RowCount - 1].Cells["StockItemName"].Value = poqty.StockItemName; grdList.Rows[grdList.RowCount - 1].Cells["POQty"].Value = poqty.POQty; grdList.Rows[grdList.RowCount - 1].Cells["BilledQty"].Value = poqty.BilledQty; grdList.Rows[grdList.RowCount - 1].Cells["BalanceQty"].Value = poqty.BalanceQty; try { TotalStock tstk = tStock.Single(s => s.StockItemID == poqty.StockItemID); if (tstk != null) { grdList.Rows[grdList.RowCount - 1].Cells["PresentStock"].Value = tstk.Stock; } if (poqty.BalanceQty <= tstk.Stock) { grdList.Rows[grdList.RowCount - 1].Cells["PresentStock"].Style.BackColor = Color.Yellow; } } catch (Exception ex) { grdList.Rows[grdList.RowCount - 1].Cells["PresentStock"].Value = 0; } } catch (Exception ex) { } } } if (grdList.RowCount > 0) { txtSearch.Visible = true; lblSearch.Visible = true; btnExportToExcel.Visible = true; } } catch (Exception ex) { MessageBox.Show("Error in Stock listing"); } }
private void ListQtyDetails() { try { pnlList.Visible = true; grdList.Visible = true; grdList.Rows.Clear(); ReportPOvsInvoiceQtyDB sdb = new ReportPOvsInvoiceQtyDB(); List <reportpendingsupplyqty> qtylist = ReportPendingSupplyDB.QtyList(); List <TotalStock> tStock = StockDB.TotalStock(Main.MainStore); List <reportpendingsupplyqty> PendingSupList = ReportPendingSupplyDB.getPendingSupplyList(); foreach (reportpendingsupplyqty poqty in qtylist) { if (poqty.BalanceQty > 0) { try { grdList.Rows.Add(); grdList.Rows[grdList.RowCount - 1].Cells["StockItemID"].Value = poqty.StockItemID; grdList.Rows[grdList.RowCount - 1].Cells["StockItemName"].Value = poqty.StockItemName; grdList.Rows[grdList.RowCount - 1].Cells["POQty"].Value = poqty.POQty; grdList.Rows[grdList.RowCount - 1].Cells["BilledQty"].Value = poqty.BilledQty; grdList.Rows[grdList.RowCount - 1].Cells["BalanceQty"].Value = poqty.BalanceQty; List <reportpendingsupplyqty> pList = PendingSupList.Where(x => x.StockItemID == poqty.StockItemID).ToList(); double total = pList.Sum(item => item.BalanceQty); if (total != 0) { grdList.Rows[grdList.RowCount - 1].Cells["PendingPOQty"].Value = total; //For Pending Supply } else { grdList.Rows[grdList.RowCount - 1].Cells["PendingPOQty"].Value = Convert.ToDouble(0); } try { TotalStock tstk = tStock.Single(s => s.StockItemID == poqty.StockItemID); if (tstk != null) { grdList.Rows[grdList.RowCount - 1].Cells["PresentStock"].Value = tstk.Stock; } if (poqty.BalanceQty <= tstk.Stock) { grdList.Rows[grdList.RowCount - 1].Cells["PresentStock"].Style.BackColor = Color.Yellow; } } catch (Exception ex) { grdList.Rows[grdList.RowCount - 1].Cells["PresentStock"].Value = Convert.ToDouble(0); } double qtytobeproceured = 0.0; try { qtytobeproceured = Convert.ToDouble(grdList.Rows[grdList.RowCount - 1].Cells["BalanceQty"].Value) - (Convert.ToDouble(grdList.Rows[grdList.RowCount - 1].Cells["PresentStock"].Value) + Convert.ToDouble(grdList.Rows[grdList.RowCount - 1].Cells["PendingPOQty"].Value)); } catch (Exception ex) { qtytobeproceured = 0.0; } if (qtytobeproceured > 0) { grdList.Rows[grdList.RowCount - 1].Cells["QtyToBeProcured"].Value = qtytobeproceured; } } catch (Exception ex) { } } } if (grdList.RowCount > 0) { txtSearch.Visible = true; lblSearch.Visible = true; btnExportToExcel.Visible = true; } } catch (Exception ex) { MessageBox.Show("Error in Stock listing"); } }