Ejemplo n.º 1
0
 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");
     }
 }
Ejemplo n.º 2
0
        private DataGridView fillgrddetail(string stockitemid)
        {
            DataGridView grdDetail = new DataGridView();

            try
            {
                grdDetail.RowHeadersVisible = false;
                ////DataGridViewLinkColumn dgvlc = new DataGridViewLinkColumn();
                ////dgvlc.SortMode = DataGridViewColumnSortMode.Automatic;
                ////grdDetail.Columns.Add(dgvlc);



                DataGridViewTextBoxColumn dgvtx3 = new DataGridViewTextBoxColumn();
                dgvtx3.Name = "ReferenceNo";
                grdDetail.Columns.Add(dgvtx3);

                DataGridViewTextBoxColumn dgvtx4 = new DataGridViewTextBoxColumn();
                dgvtx4.Name = "CustomerPONo";
                grdDetail.Columns.Add(dgvtx4);

                DataGridViewTextBoxColumn dgvtx5 = new DataGridViewTextBoxColumn();
                dgvtx5.Name = "CustomerPODate";
                grdDetail.Columns.Add(dgvtx5);

                DataGridViewTextBoxColumn dgvtx6 = new DataGridViewTextBoxColumn();
                dgvtx6.Width = 200;
                dgvtx6.Name  = "CustomerName";
                grdDetail.Columns.Add(dgvtx6);

                DataGridViewTextBoxColumn dgvtx7 = new DataGridViewTextBoxColumn();
                dgvtx7.Name = "POQty";
                grdDetail.Columns.Add(dgvtx7);

                DataGridViewTextBoxColumn dgvtx8 = new DataGridViewTextBoxColumn();
                dgvtx8.Name = "BilledQty";
                grdDetail.Columns.Add(dgvtx8);

                DataGridViewTextBoxColumn dgvtx9 = new DataGridViewTextBoxColumn();
                dgvtx9.Name = "BalanceQty";
                grdDetail.Columns.Add(dgvtx9);

                DataGridViewTextBoxColumn dgvtx0 = new DataGridViewTextBoxColumn();
                dgvtx0.Name = "DocumentID";
                grdDetail.Columns.Add(dgvtx0);

                DataGridViewTextBoxColumn dgvtx1 = new DataGridViewTextBoxColumn();
                dgvtx1.Name = "TrackingNo";
                grdDetail.Columns.Add(dgvtx1);

                DataGridViewTextBoxColumn dgvtx2 = new DataGridViewTextBoxColumn();
                dgvtx2.Name  = "TrackingDate";
                dgvtx2.Width = 100;
                grdDetail.Columns.Add(dgvtx2);
                ////////StockReconcolitationDB sdb = new StockReconcolitationDB();
                List <reportpovsinvoiceqty> qtyList = ReportPOvsInvoiceQtyDB.GetQtyDetail(stockitemid);
                int i = 0;
                foreach (reportpovsinvoiceqty qty in qtyList)
                {
                    if (qty.POQty - qty.BilledQty > 0)
                    {
                        grdDetail.Rows.Add();
                        grdDetail.Rows[i].Cells["DocumentID"].Value     = qty.DocumentID;
                        grdDetail.Rows[i].Cells["TrackingNo"].Value     = qty.TrackingNo;
                        grdDetail.Rows[i].Cells["TrackingDate"].Value   = qty.TrackingDate.Date.ToString("dd-MM-yyyy");
                        grdDetail.Rows[i].Cells["ReferenceNo"].Value    = qty.ReferenceNo;
                        grdDetail.Rows[i].Cells["CustomerPoNo"].Value   = qty.CustomerPoNo;
                        grdDetail.Rows[i].Cells["CustomerPODate"].Value = qty.CustomerPODate.Date.ToString("dd-MM-yyyy");
                        grdDetail.Rows[i].Cells["POQty"].Value          = qty.POQty;
                        grdDetail.Rows[i].Cells["BilledQty"].Value      = qty.BilledQty;
                        grdDetail.Rows[i].Cells["CustomerName"].Value   = qty.CustomerName;
                        i++;
                    }
                }

                //btnExit.Visible = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in Quantity listing");
            }
            return(grdDetail);
        }
Ejemplo n.º 3
0
        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");
            }
        }