Exemplo n.º 1
0
        //Load Data Step3 - Get Data Invoice Details ; Developer: Dennis Vélez ; Date: 07-08-18
        private void LoadDataStep3()
        {
            List <EntitiesClass.InvoiceDet> InvDet = new List <EntitiesClass.InvoiceDet> ();

            InvoiceClss.LoadEditInvoiceDetail(ref InvDet, InvNo);

            var qry = from i in InvDet
                      select new
            {
                Wh = i.WhID,
                i.WhName,
                Prod = i.ProdNo,
                Name = i.ProdName,
                i.Units,
                Sales     = Math.Round(i.TotalSales, 2),
                UwOff     = i.UnitsWithOffers,
                SaleswOff = i.SalesWithOffers,
                Discount  = Math.Round(i.Discount, 2),
                SalesTax  = Math.Round(i.SalesTax, 2),
                Gross     = Math.Round(i.Gross)
            };


            dtgridDetails.AutoGenerateColumns = true;
            dtgridDetails.ItemsSource         = qry;
            dtgridDetails.Items.Refresh();
        }
Exemplo n.º 2
0
        private void btmCreate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Payed_    = Convert.ToDecimal(txtToPay.Text);
                TransDate = Convert.ToDateTime(txtInvDate.Text);
                OrdNo     = this.txtOrdNo.Text;
            }
            catch (Exception)
            {
                MessageBox.Show("Error: Error with Payed Quantity or Invoice Date! ", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                goto ExitIntruction;
            }


            //Update Payments By Customer
            if (!InvoiceClss.UpdatePaymentHistory(InvNo, Payed_, TransDate, false, OrdNo))
            {
                goto ExitIntruction;
            }


            //Clear Data
            Clear();
            ExitIntruction :;
        }
Exemplo n.º 3
0
 private void btmCreate_Click(object sender, RoutedEventArgs e)
 {
     if (struc.IsWithInvoiceDetails)
     {
         InvoiceClss.SalesReportInvoiceDetails(struc.Year, struc.FirstMonth, struc.LastMonth, struc.CustNo);
     }
     else
     {
         InvoiceClss.SalesReport(struc.Year, struc.FirstMonth, struc.LastMonth, struc.CustNo);
     }
 }
Exemplo n.º 4
0
 private void cmbCustNo_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         struc.CustNo         = Convert.ToInt32(cmbCustNo.SelectedValue.ToString());
         cmbInvNo.ItemsSource = null;
         struc.InvNo          = 0;
         InvoiceClss.LoadInvoiceCombobox(ref cmbInvNo, struc.Year, struc.Month, false, struc.CustNo);
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 5
0
 private void cmbFP_Last_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         cmbCustNo.ItemsSource = null;
         struc.LastMonth       = Convert.ToInt32(cmbFP_Last.SelectedValue.ToString());
         struc.CustNo          = 0;
         InvoiceClss.LoadCustomersComboBox(ref cmbCustNo, struc.Year, struc.FirstMonth, struc.LastMonth);
     }
     catch (Exception)
     {
     }
 }
Exemplo n.º 6
0
 //Load Corporation Code; Developer: Dennis
 private void LoadCorporation()
 {
     txtInvno.IsEnabled = false; txtInvno.Visibility = Visibility.Visible;
     txtPrice.IsEnabled = false;
     this.InvNo         = InvoiceClss.GetInvoiceId();
     txtInvno.Text      = InvNo.ToString("00000");
     Classes.InvoiceClss.LoadCorpCmb(ref cmbCorp);
     txtPayed.Text           = "0"; this.txtInvDate.Text = DateTime.Now.ToString();
     txtGrossSales.Text      = string.Format("{0:C}", "0");
     txtSalesTax.Text        = string.Format("{0:C}", "0");
     txtPayed.Text           = string.Format("{0:C}", "0");
     txtPendingPayment.Text  = string.Format("{0:C}", "0");
     cmbCustomer.ItemsSource = null;
     txtOrdNo.Text           = null;
 }
Exemplo n.º 7
0
        private void btmCreate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Payed_    = Convert.ToDecimal(txtPayed.Text);
                TransDate = Convert.ToDateTime(txtInvDate.Text);
                OrdNo     = this.txtOrdNo.Text;
            }
            catch (Exception)
            {
                MessageBox.Show("Error: Error with Payed Quantity or Invoice Date! ", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                goto ExitIntruction;
            }


            //Review Units by Products are available (Not was edited by other user)
            var qry = from i in InvDet
                      select new { i.ProdNo, i.WhID, i.TotalUnits };

            if (qry.Count() == 0)
            {
                MessageBox.Show("Error: Not Invoice Details!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                goto ExitIntruction;
            }

            foreach (var item in qry)
            {
                decimal SecondUnits = 0;
                InvoiceClss.GetProdPriceAndAvlQty(ref SecondUnits, item.ProdNo, item.WhID);
                if (SecondUnits < item.TotalUnits)
                {
                    MessageBox.Show("Error: Total Units for the Product: " + item.ProdNo.ToString() + " and the Warehouse:  " + item.WhID.ToString() + " was reduced to: " + SecondUnits.ToString() + "units by other user! ", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    goto ExitIntruction;
                }
            }
            qry = null;

            //Create Invoice
            long SecondInv = InvoiceClss.GetInvoiceId();

            InvNo = SecondInv;

            if (CorpoId == 0 || InvNo == 0 || CstNo == 0)
            {
                MessageBox.Show("Error:CorpId or InvNo or CstNo is/are equal to 0: Please, try again.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                goto ExitIntruction;
            }

            //Create Invoice Details
            if (InvoiceClss.CreateInvoice(InvDet, CorpoId, InvNo, Payed_, TransDate, OrdNo, CstNo))
            {
                if (InvoiceClss.CreateInvoiceDet(InvDet, InvNo))
                {
                    //Update Payments By Customer
                    if (!InvoiceClss.UpdatePaymentHistory(InvNo, Payed_, TransDate, true, OrdNo))
                    {
                        goto ExitIntruction;
                    }

                    //Update Product Inventory
                    InvoiceClss.UpdateProductInventory(InvDet, InvNo);
                }
                else
                {
                    //Create InvoiceDet Failed
                    goto ExitIntruction;
                }
            }
            else
            {
                //Create Invoice Failed
                goto ExitIntruction;
            }


            //Clear Data
            Clear();
            ExitIntruction :;
        }