コード例 #1
0
ファイル: AddProduct.cs プロジェクト: chamodPriyamal/CPOS
 private void txtCash_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)Keys.Enter)
     {
         txtCost.Text = CostCodeController.CostToCode(decimal.Parse(txtCash.Text + "0") / 16);
     }
 }
コード例 #2
0
        private void load_batches()
        {
            try
            {
                int id = int.Parse(DGV.SelectedRows[0].Cells[0].Value.ToString());
                var p  = controller.GetProduct(id);
                List <POKO_ProductBatch> batchList = new List <POKO_ProductBatch>();

                foreach (var batch in p.Batches)
                {
                    POKO_ProductBatch pokobatch = new POKO_ProductBatch();
                    pokobatch.Id       = batch.Id;
                    pokobatch.Cash     = batch.Cash;
                    pokobatch.Credit   = batch.Credit;
                    pokobatch.Markup   = batch.Markup;
                    pokobatch.Cost     = batch.Cost;
                    pokobatch.Stock    = batch.Stock;
                    pokobatch.CostCode = CostCodeController.CostToCode(batch.Cost);
                    pokobatch.Pid      = batch.Product.Id;
                    pokobatch.PName    = batch.Product.Name;
                    batchList.Add(pokobatch);
                }
                DGV2.DataSource = batchList;
            }
            catch (Exception e)
            {
            }
        }
コード例 #3
0
ファイル: AddProduct.cs プロジェクト: chamodPriyamal/CPOS
        private void txtCost_Leave(object sender, EventArgs e)
        {
            decimal price = CostCodeController.CodeToCost(txtCost.Text);

            txtCash.Text   = (price + price / 100 * 60).ToString();
            txtMarkup.Text = (price + price / 100 * 60).ToString();
            txtCredit.Text = (price + price / 100 * 60).ToString();
        }
コード例 #4
0
ファイル: EditBatch.cs プロジェクト: chamodPriyamal/CPOS
 private void btnNew_Click(object sender, EventArgs e)
 {
     batch.Cost   = CostCodeController.CodeToCost(txtCost.Text);
     batch.Cash   = decimal.Parse(txtCash.Text);
     batch.Credit = decimal.Parse(txtCredit.Text);
     batch.Markup = decimal.Parse(txtMarkup.Text);
     batch.Stock  = decimal.Parse(txtStock.Text);
     controller.UpdateProduct();
     this.Close();
 }
コード例 #5
0
ファイル: EditBatch.cs プロジェクト: chamodPriyamal/CPOS
 private void EditBatch_Load(object sender, EventArgs e)
 {
     ThemeHelper.ChangeFormBackgroundColor(this);
     batch          = controller.GetBatchById(batchid);
     txtCost.Text   = CostCodeController.CostToCode(batch.Cost);
     txtCash.Text   = batch.Cash.ToString();
     txtCredit.Text = batch.Credit.ToString();
     txtMarkup.Text = batch.Markup.ToString();
     txtStock.Text  = batch.Stock.ToString();
 }
コード例 #6
0
ファイル: AddProduct.cs プロジェクト: chamodPriyamal/CPOS
        private void btnNew_Click(object sender, EventArgs e)
        {
            try
            {
                if (PermissionController.CheckPermission(PermissionType.PRODUCT_ADD))
                {
                    if (MessageHelper.AlertRegisterConfirmation() == DialogResult.Yes)
                    {
                        Product product = new Product();
                        product.Name         = txtName.Text;
                        product.Description  = txtDescription.Text;
                        product.Category     = (Category)cmbCategory.SelectedItem;
                        product.BarcodeData  = txtBarcode.Text;
                        product.ReOrderLevel = decimal.Parse(txtReOrder.Text);


                        ProductBatch batch = new ProductBatch();
                        batch.Cost   = CostCodeController.CodeToCost(txtCost.Text);
                        batch.Cash   = decimal.Parse(txtCash.Text);
                        batch.Credit = decimal.Parse(txtCredit.Text);
                        batch.Markup = decimal.Parse(txtMarkup.Text);
                        batch.Stock  = decimal.Parse(txtStock.Text);

                        if (product.BarcodeData == "")
                        {
                            context.Products.Add(product);
                            context.SaveChanges();
                            product.BarcodeData  = product.Id.ToString();
                            product.BarcodeImage = BarcodeController.GetBarcodeBytes(product.BarcodeData.ToString());
                            context.SaveChanges();
                            batch.Product = product;
                            context.ProductBatches.Add(batch);
                            context.SaveChanges();
                            MessageHelper.AlertRegisterSuccess();
                        }
                        else
                        {
                            context.Products.Add(product);
                            context.SaveChanges();
                            batch.Product = product;
                            context.ProductBatches.Add(batch);
                            context.SaveChanges();
                            MessageHelper.AlertRegisterSuccess();
                        }

                        if (MessageBox.Show("Do you want to print Labels", "Labels", MessageBoxButtons.YesNo) ==
                            DialogResult.Yes)
                        {
                            if (MessageBox.Show("Do you want to Double the Labels", "Labels", MessageBoxButtons.YesNo) ==
                                DialogResult.Yes)
                            {
                                BarcodeController.print_barcode(product.Id, int.Parse((batch.Stock * 2).ToString()));
                                // BarcodeController.print_barcode_preview(product.Id);
                            }
                            else
                            {
                                BarcodeController.print_barcode(product.Id, int.Parse(batch.Stock.ToString()));
                                //BarcodeController.print_barcode_preview(product.Id);
                            }
                        }

                        Helper.ClearForm.ClearAllTextFields(this);
                        txtDescription.Text = "-";
                        txtReOrder.Text     = "0";
                        txtName.Focus();
                    }
                }
                else
                {
                    throw new Exception("Access Denied! (PRODUCT_ADD)");
                }
            }
            catch (Exception ex)
            {
                MessageHelper.AlertError(ex.Message);
            }
        }
コード例 #7
0
        private void txtQty_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Enter)
            {
                try
                {
                    if (txtQty.Text != "" && txtQty.Text != @"0" && decimal.Parse(txtQty.Text) <= saleDetail.ProductBatch.Stock)
                    {
                        saleDetail.Qty   = decimal.Parse(txtQty.Text);
                        saleDetail.Total = saleDetail.ProductBatch.Cash * saleDetail.Qty;

                        DGV.Rows.Add(saleDetail.Product.Id, saleDetail.Product.Name, saleDetail.Product.BarcodeData, saleDetail.ProductBatch.Stock, CostCodeController.CostToCode(saleDetail.ProductBatch.Cost),
                                     saleDetail.ProductBatch.Cash, saleDetail.Qty, saleDetail.Total);

                        SaleDetails.Add(saleDetail);
                    }
                    txtBarcodeData.Text     = "";
                    txtBarcodeData.ReadOnly = false;
                    txtBarcodeData.Focus();
                    txtQty.Clear();
                }
                catch (Exception exception)
                {
                }
            }
        }