Exemplo n.º 1
0
        private void btnOkay_Click(object sender, EventArgs e)
        {
            txtInvoice.Text.Trim();
            if (txtInvoice.Text.Length == 0)
            {
                return;
            }
            string      invoicenumber = txtInvoice.Text;
            Transaction trans         = DataHandler.GetTransactionByInvoice(invoicenumber);

            if (trans == null)
            {
                FncFilter.Alert("Invalid Invoice Number.");
            }
            else
            {
                if (IsReprint)
                {
                    HardwareHelper.Print(trans, true, false);
                    this.Close();
                }
                else
                {
                    DataHandler.VoidTransaction(trans);
                    HardwareHelper.Print(trans, false, true);
                    this.Close();
                }
            }
        }
Exemplo n.º 2
0
        private bool CheckFields()
        {
            decimal amt = FncFilter.GetDecimalValue(tbPrice.Text);

            if (amt == 0)
            {
                FncFilter.Alert(globalvariables.warning_invalid_amount);
                tbPrice.Focus();
                tbPrice.SelectAll();
                return(false);
            }

            tbProductName.Text.Trim();
            if (tbProductName.Text == "")
            {
                FncFilter.Alert(globalvariables.warning_invalid_product);
                tbProductName.Focus();
                tbProductName.SelectAll();
                return(false);
            }

            tbStockNo.Text.Trim();
            if (tbStockNo.Text == "")
            {
                FncFilter.Alert(globalvariables.warning_invalid_stockno);
                tbStockNo.Focus();
                tbStockNo.SelectAll();
                return(false);
            }

            return(true);
        }
Exemplo n.º 3
0
 private void SaveTransaction(decimal amt, decimal tnd)
 {
     if (tnd < amt)
     {
         return;
     }
     try
     {
         transaction.TenderAmount = tnd;
         if (!DataHandler.SaveTransaction(transaction))
         {
             FncFilter.Alert(globalvariables.saving_failed);
             return;
         }
         else
         {
             HardwareHelper.Print(transaction, false, false);
             FncFilter.Alert(globalvariables.saving_success);
             transComplete = true;
             this.Close();
         }
     }
     catch
     {
         FncFilter.Alert(globalvariables.saving_failed);
         return;
     }
 }
Exemplo n.º 4
0
 private void btnXRead_Click(object sender, EventArgs e)
 {
     if (GenerateReport.XRead(DateTime.Now))
     {
         FncFilter.Alert("X-Read Generation Success");
     }
 }
Exemplo n.º 5
0
        private void AddProduct()
        {
            if (globalvariables.LockedPOS)
            {
                FncFilter.Alert("POS is Locked, Z-Read already generated");
                return;
            }

            if (dgvProduct.SelectedRows.Count <= 0)
            {
                return;
            }

            Product product = products[dgvProduct.SelectedRows[0].Index];

            try
            {
                bool alreadyExists = transaction.productlist.Any(x => x.ID == product.ID);
                if (alreadyExists)
                {
                    int index = transaction.productlist.FindIndex(a => a.ID == product.ID);
                    transaction.productlist[index].Qty = transaction.productlist[index].Qty + 1;
                }
                else
                {
                    product.Qty = 1;
                    transaction.productlist.Add(product);
                }
                dgvTransactionProduct.RowCount = transaction.productlist.Count;
                dgvTransactionProduct.Refresh();
                RefreshTransactionDetails();
            }
            catch { }
        }
Exemplo n.º 6
0
        private void btnAddProduct_Click(object sender, EventArgs e)
        {
            if (!CheckFields())
            {
                return;
            }

            if (!forUpdate)
            {
                decimal price   = FncFilter.GetDecimalValue(tbPrice.Text);
                string  name    = tbProductName.Text;
                string  stockno = tbStockNo.Text;

                Product newproduct = new Product()
                {
                    Name    = name,
                    StockNo = stockno,
                    Price   = price
                };
                if (!DataHandler.SaveProduct(newproduct))
                {
                    FncFilter.Alert(globalvariables.saving_failed);
                    return;
                }
                else
                {
                    FncFilter.Alert(globalvariables.saving_success);
                    newProduct = true;
                    this.Close();
                }
            }
            else
            {
                decimal price   = FncFilter.GetDecimalValue(tbPrice.Text);
                string  name    = tbProductName.Text;
                string  stockno = tbStockNo.Text;

                product.Name    = name;
                product.Price   = price;
                product.StockNo = stockno;
                product.Show    = cbProductStatus.Checked ? 1 : 0;

                if (!DataHandler.UpdateProduct(product))
                {
                    FncFilter.Alert(globalvariables.saving_failed);
                    return;
                }
                else
                {
                    FncFilter.Alert(globalvariables.saving_success);
                    newProduct = true;
                    this.Close();
                }
            }
        }
Exemplo n.º 7
0
        private void btnVoid_Click(object sender, EventArgs e)
        {
            if (globalvariables.LockedPOS)
            {
                FncFilter.Alert("POS is Locked, Z-Read already generated");
                return;
            }
            ReprintVoidForm reprintVoidForm = new ReprintVoidForm();

            reprintVoidForm.IsReprint = false;
            reprintVoidForm.ShowDialog();
        }
Exemplo n.º 8
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (DataHandler.SaveAdjustments(adjustments))
     {
         FncFilter.Alert(globalvariables.saving_success);
         this.Close();
     }
     else
     {
         FncFilter.Alert(globalvariables.saving_failed);
         return;
     }
 }
Exemplo n.º 9
0
 private void bwRecompute_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     pbLoad.Visible = false;
     FncFilter.Alert("Recompute Complete!");
 }