Exemple #1
0
 private void GetBeginningInventory()
 {
     try
     {
         Image image_outlet = new Image();
         image_outlet = (Image)gvOutlets.SelectedRow.FindControl("imgOutlet");
         long customerNumber           = long.Parse(image_outlet.AlternateText);
         StoreOutStandingInventory SOI = SOIManager.IsHasSOIRecord(customerNumber);
         if (SOI.RecordNumber != 0)
         {
             txtBeginningInventoryValue.Text     = SOI.BeginningInventoryValue.ToString("###,###.00");
             txtBeginningInventoryVolume.Text    = SOI.BeginningInventoryVolume.ToString();
             txtBeginningInventoryTotalCost.Text = SOI.BeginningInventoryTotalCost.ToString("###,###.00");
             txtBeginningInventoryAvgCost.Text   = SOI.BeginningInventoryAverageCost.ToString("###,###.00");
         }
         else
         {
             txtBeginningInventoryValue.Text     = txtActualAccountValue.Text;
             txtBeginningInventoryAvgCost.Text   = txtActualAccountAvgCost.Text;
             txtBeginningInventoryVolume.Text    = txtActualAccountVolume.Text;
             txtBeginningInventoryTotalCost.Text = txtActualAccountTotalCost.Text;
         }
     }
     catch (Exception)
     {
         txtBeginningInventoryValue.Text     = "0.00";
         txtBeginningInventoryAvgCost.Text   = "0.00";
         txtBeginningInventoryVolume.Text    = "0";
         txtBeginningInventoryTotalCost.Text = "0.00";
     }
 }
        public StoreOutStandingInventory IsHasRecordOnSOI(long CustNo, DateTime PeriodDate)
        {
            StoreOutStandingInventory SOI = new StoreOutStandingInventory();

            try
            {
                SOI = GetBeginningOnSOI(CustNo, PeriodDate);
            }
            catch (Exception)
            {
                SOI = new StoreOutStandingInventory();
                //  ..throw;
            }
            return(SOI);
        }
Exemple #3
0
        protected void btnSaveSOI_Click(object sender, EventArgs e)
        {
            Image image_outlet = new Image();

            image_outlet = (Image)gvOutlets.SelectedRow.FindControl("imgOutlet");
            StoreOutStandingInventory SOI_TO_SAVE = new StoreOutStandingInventory();

            if (string.IsNullOrEmpty(txtActualAccountTotalCost.Text))
            {
                txtActualAccountTotalCost.Text = "0.00";
            }
            if (string.IsNullOrEmpty(txtActualAccountAvgCost.Text))
            {
                txtActualAccountAvgCost.Text = "0.00";
            }
            if (string.IsNullOrEmpty(txtActualAccountValue.Text))
            {
                txtActualAccountValue.Text = "0.00";
            }
            if (string.IsNullOrEmpty(txtActualAccountVolume.Text))
            {
                txtActualAccountVolume.Text = "0";
            }
            SOI_TO_SAVE.ActualCostTotalCost         = decimal.Parse(txtActualAccountTotalCost.Text);
            SOI_TO_SAVE.ActualCountAverageCost      = decimal.Parse(txtActualAccountAvgCost.Text);
            SOI_TO_SAVE.ActualCountValue            = decimal.Parse(txtActualAccountValue.Text);
            SOI_TO_SAVE.ActualCountVolume           = decimal.Parse(txtActualAccountVolume.Text);
            SOI_TO_SAVE.AdjustmentCreditAverageCost = decimal.Parse(txtCreditAvgCost.Text.Remove(0, 1).Replace(")", ""));
            SOI_TO_SAVE.AdjustmentCreditTotalCost   = decimal.Parse(txtCreditTotalCost.Text.Remove(0, 1).Replace(")", ""));
            SOI_TO_SAVE.AdjustmentCreditValue       = decimal.Parse(txtCreditValue.Text.Remove(0, 1).Replace(")", ""));
            SOI_TO_SAVE.AdjustmentCreditVolume      = decimal.Parse(txtCreditVolume.Text.Remove(0, 1).Replace(")", ""));
            SOI_TO_SAVE.AdjustmentDebitAverageCost  = decimal.Parse(txtDebitAvgCost.Text);
            SOI_TO_SAVE.AdjustmentDebitTotalCost    = decimal.Parse(txtDebitTotalCost.Text);
            SOI_TO_SAVE.AdjustmentDebitValue        = decimal.Parse(txtDebitValue.Text);
            SOI_TO_SAVE.AdjustmentDebitVolume       = decimal.Parse(txtDebitVolume.Text);
            if (long.Parse(hfAdjustmentRecordNumber.Value) > 0)
            {
                SOI_TO_SAVE.AdjustmentRecordNumber = long.Parse(hfAdjustmentRecordNumber.Value);
            }
            else
            {
                SOI_TO_SAVE.AdjustmentRecordNumber = 0;
            }
            SOI_TO_SAVE.BeginningInventoryAverageCost = decimal.Parse(txtBeginningInventoryAvgCost.Text);
            SOI_TO_SAVE.BeginningInventoryTotalCost   = decimal.Parse(txtBeginningInventoryTotalCost.Text);
            SOI_TO_SAVE.BeginningInventoryValue       = decimal.Parse(txtBeginningInventoryValue.Text);
            SOI_TO_SAVE.BeginningInventoryVolume      = decimal.Parse(txtBeginningInventoryVolume.Text);
            SOI_TO_SAVE.CustomerName        = txtOutletName.Text;
            SOI_TO_SAVE.CustomerNumber      = int.Parse(image_outlet.AlternateText);
            SOI_TO_SAVE.Brand               = gvOutlets.SelectedRow.Cells[4].Text;
            SOI_TO_SAVE.DateRecorded        = DateTime.Now;
            SOI_TO_SAVE.DeliveryAverageCost = decimal.Parse(txtDeliveryAvgCost.Text);
            SOI_TO_SAVE.DeliveryTotalCost   = decimal.Parse(txtdeliveryTotalCost.Text);
            SOI_TO_SAVE.DeliveryValue       = decimal.Parse(txtDeliveryValue.Text);
            SOI_TO_SAVE.DeliveryVolume      = decimal.Parse(txtDeliveryVolume.Text);

            if (txtDiscrepancyTotalCost.Text.StartsWith("(") == false)
            {
                SOI_TO_SAVE.DiscrepancyTotalCost = decimal.Parse(txtDiscrepancyTotalCost.Text);
            }
            else
            {
                SOI_TO_SAVE.DiscrepancyTotalCost = decimal.Parse(txtDiscrepancyTotalCost.Text.Remove(0, 1).Replace(")", ""));
            }

            if (txtDiscrepancyValue.Text.StartsWith("(") == false)
            {
                SOI_TO_SAVE.DiscrepancyValue = decimal.Parse(txtDiscrepancyValue.Text);
            }
            else
            {
                SOI_TO_SAVE.DiscrepancyValue = decimal.Parse(txtDiscrepancyValue.Text.Remove(0, 1).Replace(")", ""));
            }

            if (txtDiscrepancyVolume.Text.StartsWith("(") == false)
            {
                SOI_TO_SAVE.DiscrepancyVolume = decimal.Parse(txtDiscrepancyVolume.Text);
            }
            else
            {
                SOI_TO_SAVE.DiscrepancyVolume = decimal.Parse(txtDiscrepancyVolume.Text.Remove(0, 1).Replace(")", ""));
            }

            SOI_TO_SAVE.EndingInventoryAverageCost = decimal.Parse(txtEndingInvventoryAvgCost.Text);
            SOI_TO_SAVE.EndingInventoryTotalCost   = decimal.Parse(txtEndingInvventoryTotalCost.Text);
            SOI_TO_SAVE.EndingInventoryValue       = decimal.Parse(txtEndingInvventoryValue.Text);
            SOI_TO_SAVE.EndingInventoryVolume      = decimal.Parse(txtEndingInvventoryVolume.Text);
            SOI_TO_SAVE.GrossSalesAverageCost      = decimal.Parse(txtGrossSalesAvgCost.Text.Remove(0, 1).Replace(")", ""));
            SOI_TO_SAVE.GrossSalesTotalCost        = decimal.Parse(txtGrossSalesTotalCost.Text.Remove(0, 1).Replace(")", ""));
            SOI_TO_SAVE.GrossSalesValue            = decimal.Parse(txtGrossSalesValue.Text.Remove(0, 1).Replace(")", ""));
            SOI_TO_SAVE.GrossSalesVolume           = decimal.Parse(txtGrossSalesVolume.Text.Remove(0, 1).Replace(")", ""));
            SOI_TO_SAVE.PeriodFrom         = DateTime.Parse(txtPeriodFrom.Text);
            SOI_TO_SAVE.PeriodTo           = DateTime.Parse(txtPeriodTo.Text);
            SOI_TO_SAVE.ReturnsAverageCost = decimal.Parse(txtPullOutAvgCost.Text.Remove(0, 1).Replace(")", ""));
            SOI_TO_SAVE.ReturnsTotalCost   = decimal.Parse(txtPullOutTotalCost.Text.Remove(0, 1).Replace(")", ""));
            SOI_TO_SAVE.ReturnsValue       = decimal.Parse(txtPullOutValue.Text.Remove(0, 1).Replace(")", ""));
            SOI_TO_SAVE.ReturnsVolume      = decimal.Parse(txtPullOutVolume.Text.Remove(0, 1).Replace(")", ""));
            SOI_TO_SAVE.TransactionDate    = DateTime.Parse(txtTransactionDate.Text);

            try
            {
                SOIManager.Save(SOI_TO_SAVE);
                #region log
                SOIManager.SaveTransactionLog(Permission.PERMITTED_USER, TransactionType.INSERT);
                #endregion
            }
            catch (Exception)
            {
                // throw;
            }
        }
Exemple #4
0
        private void GetBeginningInventorySummary()
        {
            DataTable p_count_result = new DataTable();

            try
            {
                List <SOI_BeginningInventory> SOI_BI;
                Image image_outlet = new Image();
                image_outlet = (Image)gvOutlets.SelectedRow.FindControl("imgOutlet");
                long customerNumber           = long.Parse(image_outlet.AlternateText);
                StoreOutStandingInventory SOI = SOIManager.IsHasSOIRecord(long.Parse(image_outlet.AlternateText));
                if (SOI != null)
                {
                    txtBeginningInventoryValue.Text     = SOI.ActualCountValue.ToString("###,###.00");
                    txtBeginningInventoryVolume.Text    = SOI.ActualCountVolume.ToString();
                    txtBeginningInventoryTotalCost.Text = SOI.ActualCostTotalCost.ToString("###,###.00");
                    txtBeginningInventoryAvgCost.Text   = SOI.ActualCountAverageCost.ToString("###,###.00");
                    SOI_BI = new List <SOI_BeginningInventory>();

                    SOI_BeginningInventory SOIBI = new SOI_BeginningInventory
                    {
                        Volume      = decimal.Parse(txtBeginningInventoryVolume.Text),
                        Value       = decimal.Parse(txtBeginningInventoryValue.Text),
                        AverageCost = decimal.Parse(txtBeginningInventoryAvgCost.Text),
                        TotalCost   = decimal.Parse(txtActualAccountTotalCost.Text)
                    };
                    SOI_BI.Add(SOIBI);
                    gvSOIBI.DataSource = SOI_BI;
                    gvSOIBI.DataBind();
                    lblBIFrom.Text = "Beginning Inventory from Previous SOI";
                }
                else
                {
                    List <SOI_BeginningInventory> SOI_PCOUNT = new List <SOI_BeginningInventory>();
                    DateTime dtPeriodFrom = new DateTime(DateTime.Parse(txtPeriodTo.Text).Year,
                                                         DateTime.Parse(txtPeriodFrom.Text).Month, 1);
                    DateTime dtPeriodToTemp = DateTime.Parse(txtPeriodFrom.Text);
                    DateTime dtPeriodTo     = new DateTime(dtPeriodToTemp.Year, dtPeriodToTemp.Month,
                                                           DateTime.DaysInMonth(dtPeriodToTemp.Year, dtPeriodToTemp.Month));

                    if (dtPeriodToTemp.Month == 12 && dtPeriodToTemp.Day == 31) // ENDING YEAR
                    {
                        dtPeriodFrom = new DateTime(dtPeriodToTemp.Year + 1, 1, 1);
                        dtPeriodTo   = new DateTime(dtPeriodToTemp.Year + 1, 1, DateTime.DaysInMonth(dtPeriodToTemp.Year, 1));
                    }

                    //DataTable physical_count = SOIManager.GetDataTableStoreOutStandingInventoryPhysiclCountSummary1(
                    //                     long.Parse(image_outlet.AlternateText), dtPeriodFrom, dtPeriodTo); year to year pick up change
                    DataTable physical_count = new DataTable();
                    if ((DateTime.Parse(txtPeriodTo.Text).Month - DateTime.Parse(txtPeriodFrom.Text).Month) == 11)
                    {
                        dtPeriodFrom   = new DateTime(DateTime.Parse(txtPeriodFrom.Text).Year - 1, 12, 31);
                        physical_count = SOIManager.GetDataTableStoreOutStandingInventoryPhysiclCountSummary1(
                            customerNumber, dtPeriodFrom, dtPeriodTo);
                    }
                    else
                    {
                        physical_count = SOIManager.GetDataTableStoreOutStandingInventoryPhysiclCountSummary1(
                            customerNumber, dtPeriodFrom, dtPeriodTo);
                    }


                    if (physical_count.Rows.Count > 0)
                    {
                        p_count_result = physical_count;
                    }
                    else
                    {
                        dtPeriodFrom   = new DateTime(dtPeriodFrom.Year - 1, 12, 1);
                        p_count_result = SOIManager.GetDataTableStoreOutStandingInventoryPhysiclCountSummary1(
                            customerNumber, dtPeriodFrom, dtPeriodTo);
                    }
                    foreach (DataRow row in p_count_result.Rows)
                    {
                        SOI_BeginningInventory PCOUNT = new SOI_BeginningInventory();
                        PCOUNT.Volume      = decimal.Parse(row[1].ToString());
                        PCOUNT.Value       = decimal.Parse(row[0].ToString());
                        PCOUNT.TotalCost   = decimal.Parse(row[2].ToString());
                        PCOUNT.AverageCost = (decimal.Parse(row[2].ToString()) / decimal.Parse(row[1].ToString()));
                        SOI_PCOUNT.Add(PCOUNT);
                    }
                    SOI_BeginningInventory BI = SOI_PCOUNT[0];
                    if (SOI_PCOUNT.Count > 1)
                    {
                        SOI_BeginningInventory EI = SOI_PCOUNT[1];
                        hfPCountAveCost.Value   = EI.AverageCost.ToString("###,###.00");
                        hfPcountTotalCost.Value = EI.TotalCost.ToString("###,###.00");
                        hfPCountValue.Value     = EI.Value.ToString("###,###.00");
                        hfPCountVolume.Value    = EI.Volume.ToString();
                    }

                    txtBeginningInventoryValue.Text  = BI.Value.ToString("###,###.00");
                    txtBeginningInventoryVolume.Text = BI.Volume.ToString();

                    txtBeginningInventoryTotalCost.Text = BI.TotalCost.ToString("###,###.00");
                    txtBeginningInventoryAvgCost.Text   = BI.AverageCost.ToString("###,###.00");


                    DataTable pcount_breakdown = SOIManager.GetDataTableStoreOutStandingInventoryPhysicalCountBreakdown(
                        long.Parse(image_outlet.AlternateText), DateTime.Parse(txtPeriodFrom.Text));
                    gvSOIBI.DataSource = pcount_breakdown;
                    gvSOIBI.DataBind();
                    lblBIFrom.Text = "Beginning Inventory from Bridge Table";
                }
            }
            catch (Exception)
            {
                txtBeginningInventoryValue.Text          = "0.00";
                txtBeginningInventoryVolume.Text         = "0";
                this.txtBeginningInventoryTotalCost.Text = "0.00";
                txtBeginningInventoryAvgCost.Text        = "0.00";
            }
        }
        public void GetSoiDetails(StoreOutStandingInventory SOI)
        {
            txtActualAccountAvgCost.Text   = SOI.ActualCountAverageCost.ToString("###,###.00");
            txtActualAccountTotalCost.Text = SOI.ActualCostTotalCost.ToString("###,###.00");
            txtActualAccountValue.Text     = SOI.ActualCountValue.ToString("###,###.00");
            if (SOI.ActualCountVolume != 0)
            {
                txtActualAccountVolume.Text = SOI.ActualCountVolume.ToString("###,###");
            }
            else
            {
                txtActualAccountVolume.Text = "(0)";
            }

            txtBeginningInventoryAvgCost.Text   = SOI.BeginningInventoryAverageCost.ToString("###,###.00");
            txtBeginningInventoryTotalCost.Text = SOI.BeginningInventoryTotalCost.ToString("###,###.00");
            txtBeginningInventoryValue.Text     = SOI.BeginningInventoryValue.ToString("###,###.00");
            if (SOI.BeginningInventoryVolume != 0)
            {
                txtBeginningInventoryVolume.Text = SOI.BeginningInventoryVolume.ToString("###,###");
            }
            else
            {
                txtBeginningInventoryVolume.Text = "(0)";
            }
            txtCreditAvgCost.Text   = SOI.AdjustmentCreditAverageCost.ToString("(###,###.00)");
            txtCreditTotalCost.Text = SOI.AdjustmentCreditTotalCost.ToString("(###,###.00)");
            txtCreditValue.Text     = SOI.AdjustmentCreditValue.ToString("(###,###.00)");
            if (SOI.AdjustmentCreditVolume != 0)
            {
                txtCreditVolume.Text = SOI.AdjustmentCreditVolume.ToString("(###,###)");
            }
            else
            {
                txtCreditVolume.Text = "(0)";
            }

            txtDebitAvgCost.Text   = SOI.AdjustmentDebitAverageCost.ToString("###,###.00");
            txtDebitTotalCost.Text = SOI.AdjustmentDebitTotalCost.ToString("###,###.00");
            txtDebitValue.Text     = SOI.AdjustmentDebitValue.ToString("###,###.00");
            if (SOI.AdjustmentDebitVolume != 0)
            {
                txtDebitVolume.Text = SOI.AdjustmentDebitVolume.ToString("###,###");
            }
            else
            {
                txtDebitVolume.Text = "0";
            }

            txtDeliveryAvgCost.Text   = SOI.DeliveryAverageCost.ToString("###,###.00");
            txtdeliveryTotalCost.Text = SOI.DeliveryTotalCost.ToString("###,###.00");
            txtDeliveryValue.Text     = SOI.DeliveryValue.ToString("###,###.00");
            if (SOI.DeliveryVolume != 0)
            {
                txtDeliveryVolume.Text = SOI.DeliveryVolume.ToString("###,###");
            }
            else
            {
                txtDeliveryVolume.Text = "(0)";
            }

            if (SOI.DiscrepancyTotalCost <= 0)
            {
                txtDiscrepancyTotalCost.Text = (-1 * SOI.DiscrepancyTotalCost).ToString("(###,###.00)");
            }
            else
            {
                txtDiscrepancyTotalCost.Text = (SOI.DiscrepancyTotalCost).ToString("###,###.00");
            }
            if (SOI.DiscrepancyVolume <= 0)
            {
                txtDiscrepancyVolume.Text = (-1 * SOI.DiscrepancyVolume).ToString("(###,###)");
            }
            else
            {
                txtDiscrepancyVolume.Text = (SOI.DiscrepancyVolume).ToString("(###,###)");
            }

            if (SOI.DiscrepancyValue <= 0)
            {
                txtDiscrepancyValue.Text = (-1 * SOI.DiscrepancyValue).ToString("(###,###.00)");
            }
            else
            {
                txtDiscrepancyValue.Text = (SOI.DiscrepancyValue).ToString("###,###.00");
            }

            txtEndingInvventoryAvgCost.Text   = SOI.EndingInventoryAverageCost.ToString("###,###.00");
            txtEndingInvventoryTotalCost.Text = SOI.EndingInventoryTotalCost.ToString("###,###.00");
            txtEndingInvventoryValue.Text     = SOI.EndingInventoryValue.ToString("###,###.00");
            if (SOI.EndingInventoryVolume != 0)
            {
                txtEndingInvventoryVolume.Text = SOI.EndingInventoryVolume.ToString("###,###");
            }
            else
            {
                txtEndingInvventoryVolume.Text = "(0)";
            }

            txtGrossSalesAvgCost.Text   = SOI.GrossSalesAverageCost.ToString("(###,###.00)");
            txtGrossSalesTotalCost.Text = SOI.GrossSalesTotalCost.ToString("(###,###.00)");
            txtGrossSalesValue.Text     = SOI.GrossSalesValue.ToString("(###,###.00)");
            if (SOI.GrossSalesVolume != 0)
            {
                txtGrossSalesVolume.Text = SOI.GrossSalesVolume.ToString("(###,###)");
            }
            else
            {
                txtGrossSalesVolume.Text = "(0)";
            }
            txtOutletName.Text       = SOI.CustomerName;
            txtPeriodFrom.Text       = SOI.PeriodFrom.ToString("MMMM dd, yyyy");
            txtPeriodTo.Text         = SOI.PeriodTo.ToString("MMMM dd, yyyy");
            txtPullOutAvgCost.Text   = SOI.ReturnsAverageCost.ToString("(###,###.00)");
            txtPullOutTotalCost.Text = SOI.ReturnsTotalCost.ToString("(###,###.00)");
            txtPullOutValue.Text     = SOI.ReturnsValue.ToString("(###,###.00)");
            if (SOI.ReturnsVolume != 0)
            {
                txtPullOutVolume.Text = SOI.ReturnsVolume.ToString("(###,###)");
            }
            else
            {
                txtPullOutVolume.Text = "(0)";
            }

            txtTransactionDate.Text      = SOI.TransactionDate.ToString("MMMM dd, yyyy");
            lblCustomerNameToDelete.Text = "SOI FOR: " + SOI.CustomerName;
            lblDateFromToToDelete.Text   = "PERIOD FROM: " + SOI.PeriodFrom.ToString("MMMM dd, yyyy") + " TO " + SOI.PeriodTo.ToString("MMMM dd, yyyy");
        }
Exemple #6
0
        private void Acc_StockCardQrt()
        {
            SqlConnection  conn = new SqlConnection(ConfigurationManager.ConnectionStrings["IRMSConnectionString"].ConnectionString);
            ReportDocument rpt;

            string rptDocCachedKey = null;

            rptDocCachedKey = "rptStockCardQrt";
            if (Cache[rptDocCachedKey] != null)
            {
                rpt = (StockCardRptQuarterly)Cache[rptDocCachedKey];
            }
            else
            {
                rpt = new StockCardRptQuarterly();
                Cache.Insert(rptDocCachedKey, rpt);
            }

            long     CustNo   = long.Parse(Request.QueryString["custno"]);
            DateTime PrevDate = DateTime.Parse(Request.QueryString["datefrom"]).AddDays(-1);

            DateTime DateFrom = DateTime.Parse(Request.QueryString["datefrom"]);
            DateTime DateTo   = DateTime.Parse(Request.QueryString["dateto"]);

            long    Balqty     = 0;
            decimal Balamt     = 0;
            decimal Balcost    = 0;
            long    Balqty1    = 0;
            decimal Balamt1    = 0;
            decimal Balcost1   = 0;
            long    Debitqty   = 0;
            decimal Debitamt   = 0;
            decimal Debitcost  = 0;
            long    Creditqty  = 0;
            decimal Creditamt  = 0;
            decimal Creditcost = 0;
            bool    Firstrec   = true;

            conn.Open();

            SqlCommand cmd = new SqlCommand();

            cmd.Connection     = conn;
            cmd.CommandTimeout = 300;
            cmd.CommandText    = "delete from RptStockCardQrt where username='******'";
            cmd.ExecuteNonQuery();

            StockCardReportManager    SCRManager   = new StockCardReportManager();
            StoreOutStandingInventory SOIBeginning = SCRManager.IsHasRecordOnSOI(CustNo, PrevDate);

            if (SOIBeginning != null)
            {
                cmd.CommandTimeout = 300;
                cmd.CommandText    = "GenRptStockCard_Beg_SOI_Qrt '" + DateFrom + "', '" + DateTo + "', '" + PrevDate + "', " + CustNo + ", '" + Session["USER_NAME"] + "'";
                cmd.ExecuteNonQuery();
            }
            else
            {
                cmd.CommandTimeout = 300;
                cmd.CommandText    = "GenRptStockCard_Beg_Pcount_Qrt '" + DateFrom + "', '" + DateTo + "', " + CustNo + ", '" + Session["USER_NAME"] + "'";
                cmd.ExecuteNonQuery();
            }
            //cmd.Connection = conn;
            cmd.CommandTimeout = 3000;
            cmd.CommandText    = "genrptstockcardqrt '" + Request.QueryString["datefrom"] + "','" + Request.QueryString["dateto"] + "'," + Request.QueryString["custno"] + ", '" + Session["USER_NAME"] + "'";
            cmd.ExecuteNonQuery();

            DataTable ResultSet = new DataTable();

            cmd.CommandText = "genrptstockcardqrtsales '" + Request.QueryString["datefrom"] + "','" + Request.QueryString["dateto"] + "'," + Request.QueryString["custno"] + ", '" + Session["USER_NAME"] + "'";
            cmd.ExecuteNonQuery();

            cmd.CommandText = "select * from RptStockCardQrt where custno = " + Request.QueryString["custno"] + " and datefrom= '" + Request.QueryString["datefrom"] + "' and dateto='" + Request.QueryString["dateto"] + "'";
            using (SqlDataAdapter adapter = new SqlDataAdapter())
            {
                adapter.SelectCommand = cmd;
                adapter.Fill(ResultSet);
            }

            foreach (DataRow row in ResultSet.Rows)
            {
                if (Firstrec == true)
                {
                    Balqty  = Convert.ToInt64(row[14]);
                    Balamt  = ConvertDataToDecimal(row[15]);
                    Balcost = ConvertDataToDecimal(row[16]);

                    Firstrec = false;
                }
                else
                {
                    Debitqty   = Convert.ToInt64(row[8]);
                    Debitamt   = ConvertDataToDecimal(row[9]);
                    Debitcost  = ConvertDataToDecimal(row[10]);
                    Creditqty  = Convert.ToInt64(row[11]);
                    Creditamt  = ConvertDataToDecimal(row[12]);
                    Creditcost = ConvertDataToDecimal(row[13]);


                    Balqty1  = Balqty + Debitqty + Creditqty;
                    Balamt1  = Balamt + Debitamt + Creditamt;
                    Balcost1 = Balcost + Debitcost + Creditcost;

                    Balqty  = Balqty1;
                    Balamt  = Balamt1;
                    Balcost = Balcost1;

                    cmd.CommandText = "update RptStockCardQrt set balance_qty = " + Balqty + ", balance_amt = " + Balamt + ", balance_cost= " + Balcost + " where id = " + (long)row[0] + " and custno = " + (int)row[4] + " and username = '******' and datefrom = '" + DateFrom + "' and dateto = '" + DateTo + "'";
                    cmd.ExecuteNonQuery();
                }
            }

            DataBaseLogIn(rpt);

            ParameterField  prmDatefrom = new ParameterField();
            ParameterField  prmDateTo   = new ParameterField();
            ParameterField  prmCustno   = new ParameterField();
            ParameterFields prmList     = new ParameterFields();

            prmDatefrom.ParameterFieldName = "datefrom";
            prmDateTo.ParameterFieldName   = "dateto";
            prmCustno.ParameterFieldName   = "custno";

            ParameterDiscreteValue prmDateFromValue = new ParameterDiscreteValue();
            ParameterDiscreteValue prmDateToValue   = new ParameterDiscreteValue();
            ParameterDiscreteValue prmCustnoValue   = new ParameterDiscreteValue();

            prmDateFromValue.Value = Request.QueryString["datefrom"];
            prmDateToValue.Value   = Request.QueryString["dateto"];
            prmCustnoValue.Value   = Request.QueryString["custno"];

            prmDatefrom.CurrentValues.Add(prmDateFromValue);
            prmDateTo.CurrentValues.Add(prmDateToValue);
            prmCustno.CurrentValues.Add(prmCustnoValue);

            prmList.Add(prmDatefrom);
            prmList.Add(prmDateTo);
            prmList.Add(prmCustno);

            crvDailyReport.ParameterFieldInfo = prmList;
            crvDailyReport.ReportSource       = rpt;
        }
Exemple #7
0
        private void PreviewSOI(long RecordNumber)
        {
            StoreOutStandingInventory SOI = SOIManager.GetStoreOutStandingInventoryByRecordNumber(RecordNumber);

            lblDateNow.Text = "TRANSACTION DATE: " + DateTime.UtcNow.ToString("dddd, MMMM dd, yyyy");
            //
            lblCustomer.Text       = SOI.CustomerName;
            lblDatePeriodFrom.Text = "PERIOD FROM: " + SOI.PeriodFrom.ToString("MMMM dd, yyyy");
            lblDatePerioTo.Text    = "TO: " + SOI.PeriodTo.ToString("MMMM dd, yyyy");
            //BI
            if (SOI.BeginningInventoryVolume != 0)
            {
                lblBIVolume.Text = SOI.BeginningInventoryVolume.ToString("###,###");
            }
            else
            {
                lblBIVolume.Text = "(0)";
            }
            lblBIValue.Text       = SOI.BeginningInventoryValue.ToString("###,###.00");
            lblBITotalCost.Text   = SOI.BeginningInventoryTotalCost.ToString("###,###.00");
            lblBIAverageCost.Text = SOI.BeginningInventoryAverageCost.ToString("###,###.00");
            //Delivery
            lblDeliveryAvgCost.Text   = SOI.DeliveryAverageCost.ToString("###,###.00");
            lblDeliveryTotalCost.Text = SOI.DeliveryTotalCost.ToString("###,###.00");
            lblDeliveryValue.Text     = SOI.DeliveryValue.ToString("###,###.00");
            if (SOI.DeliveryVolume != 0)
            {
                lblDeliveryVolume.Text = SOI.DeliveryVolume.ToString("###,###");
            }
            else
            {
                lblDeliveryVolume.Text = "(0)";
            }
            //PullOut
            lblPullOutAvgCost.Text   = SOI.ReturnsAverageCost.ToString("(###,###.00)");
            lblPullOutTotalCost.Text = SOI.ReturnsTotalCost.ToString("(###,###.00)");
            lblPullOutValue.Text     = SOI.ReturnsValue.ToString("(###,###.00)");
            if (SOI.ReturnsVolume != 0)
            {
                lblPullOutVolume.Text = SOI.ReturnsVolume.ToString("(###,###)");
            }
            else
            {
                lblPullOutVolume.Text = "(0)";
            }

            //grossSdales
            lblGrossSalesAvgCost.Text   = SOI.GrossSalesAverageCost.ToString("(###,###.00)");
            lblGrossSalesTotalCost.Text = SOI.GrossSalesTotalCost.ToString("(###,###.00)");
            lblGrossSalesValue.Text     = SOI.GrossSalesValue.ToString("(###,###.00)");
            if (SOI.GrossSalesVolume != 0)
            {
                lblGrossSalesVolume.Text = SOI.GrossSalesVolume.ToString("(###,###)");
            }
            else
            {
                lblGrossSalesVolume.Text = "(0)";
            }
            //adjustment
            lblDebitAvgCost.Text   = SOI.AdjustmentDebitAverageCost.ToString("###,###.00");
            lblDebitTotalCost.Text = SOI.AdjustmentDebitTotalCost.ToString("###,###.00");
            lblDebitValue.Text     = SOI.AdjustmentDebitValue.ToString("###,###.00");
            if (SOI.AdjustmentDebitVolume != 0)
            {
                lblDebitVolume.Text = SOI.AdjustmentDebitVolume.ToString("###,###");
            }
            else
            {
                lblDebitVolume.Text = "0";
            }

            lblCreditAvgCost.Text   = SOI.AdjustmentCreditAverageCost.ToString("(###,###.00)");
            lblCreditTotalCost.Text = SOI.AdjustmentCreditTotalCost.ToString("(###,###.00)");
            lblCreditValue.Text     = SOI.AdjustmentCreditValue.ToString("(###,###.00)");
            if (SOI.AdjustmentCreditVolume != 0)
            {
                lblCreditVolume.Text = SOI.AdjustmentCreditVolume.ToString("(###,###)");
            }
            else
            {
                lblCreditVolume.Text = "(0)";
            }
            //Ending Inventory
            lblEIAvgCost.Text   = SOI.EndingInventoryAverageCost.ToString("###,###.00");
            lblEITotalCost.Text = SOI.EndingInventoryTotalCost.ToString("###,###.00");
            lblEIValue.Text     = SOI.EndingInventoryValue.ToString("###,###.00");
            if (SOI.EndingInventoryVolume != 0)
            {
                lblEIVolume.Text = SOI.EndingInventoryVolume.ToString("###,###");
            }
            else
            {
                lblEIVolume.Text = "(0)";
            }
            //PCount
            lblAPCAvgCost.Text   = SOI.ActualCountAverageCost.ToString("###,###.00");
            lblAPCTotalCost.Text = SOI.ActualCostTotalCost.ToString("###,###.00");
            lblAPCValue.Text     = SOI.ActualCountValue.ToString("###,###.00");
            if (SOI.ActualCountVolume != 0)
            {
                lblAPCVolume.Text = SOI.ActualCountVolume.ToString("###,###");
            }
            else
            {
                lblAPCVolume.Text = "(0)";
            }
            if (SOI.DiscrepancyVolume > 0)
            {
                lblDiscrepancyVolume.Text = SOI.DiscrepancyVolume.ToString("###,###");
            }
            else
            {
                lblDiscrepancyVolume.Text = (-1 * SOI.DiscrepancyVolume).ToString("(###,###)");
            }

            if (SOI.DiscrepancyValue > 0)
            {
                lblDiscrepancyValue.Text = SOI.DiscrepancyValue.ToString("###,###.00");
            }
            else
            {
                lblDiscrepancyValue.Text = (-1 * SOI.DiscrepancyValue).ToString("(###,###.00)");
            }

            if (SOI.DiscrepancyTotalCost > 0)
            {
                lblDiscrepancyTotalCost.Text = (SOI.DiscrepancyTotalCost).ToString("###,###.00");
            }
            else
            {
                lblDiscrepancyTotalCost.Text = (-1 * SOI.DiscrepancyTotalCost).ToString("(###,###.00)");
            }
        }