コード例 #1
0
ファイル: Recipes.cs プロジェクト: ysodiqakanni/TheThrustGuru
 private void Recipes_Load(object sender, EventArgs e)
 {
     //get recipes from db
     displayRecipe();
     totalPriceTextBox.Text = FormatPrice.format(totalPrice);
     receiptNoTextBox.Text  = GenerateIDs.invoiceId();
 }
コード例 #2
0
        private async void processData(bool isEdit)
        {
            errorProvider1.Clear();
            string name     = nametextBox.Text;
            string phone    = phoneMaskedTextBox.Text;
            string repId    = repIdTextBox.Text;
            string address  = addresstextBox.Text;
            string other    = othertextBox.Text;
            string username = usernameTextBox.Text;
            string password = passwordTextBox.Text;

            if (isEdit)
            {
                salesRepModel.name     = name;
                salesRepModel.phone    = phone;
                salesRepModel.address  = address;
                salesRepModel.other    = other;
                salesRepModel.username = username;
                salesRepModel.password = password;
                salesRepModel.repId    = repId;

                if (!MessagePrompt.displayPrompt("Edit", "edit this salesRep"))
                {
                    return;
                }

                MessageBox.Show(await DatabaseOperations.editSalesRep(salesRepModel) ? "Data updated successfully" : "Data updating failed");
            }
            else
            {
                SalesRepDataModel salesRep = new SalesRepDataModel
                {
                    name     = name,
                    phone    = phone,
                    repId    = repId,
                    address  = address,
                    other    = other,
                    username = username,
                    password = password
                };

                if (!MessagePrompt.displayPrompt("Create New", "create new salesRep"))
                {
                    return;
                }

                DatabaseOperations.addSalesRep(salesRep);

                MessageBox.Show("Sales Rep created successfully");

                nametextBox.Clear();
                phoneMaskedTextBox.Clear();
                addresstextBox.Clear();
                othertextBox.Clear();
                usernameTextBox.Clear();

                repIdTextBox.Text    = GenerateIDs.salesRepId();
                passwordTextBox.Text = GenerateIDs.password();
            }
        }
コード例 #3
0
        public AddSalesRepForm()
        {
            InitializeComponent();

            repIdTextBox.Text    = GenerateIDs.salesRepId();
            passwordTextBox.Text = GenerateIDs.password();
        }
コード例 #4
0
 private void voucherCodeCheckBox_CheckedChanged(object sender, EventArgs e)
 {
     if (voucherCodeCheckBox.Checked)
     {
         _voucherCode                    = GenerateIDs.voucherCode();
         voucherCodeTextBox.Text         = _voucherCode;
         regenerateVoucherbutton.Enabled = true;
     }
     else
     {
         regenerateVoucherbutton.Enabled = false;
         voucherCodeTextBox.Text         = "";
         _voucherCode = "";
     }
 }
コード例 #5
0
        private void PointOfSaleForm_Load(object sender, EventArgs e)
        {
            this.dateLabel.Text = DateTime.Now.ToLongDateString();
            waterMarkOnTextBoxLeave(searchNametextBox, searchByName);

            if (!SelectSellercomboBox.Items.Contains(selectSalesRep))
            {
                SelectSellercomboBox.Items.Add(selectSalesRep);
            }
            SelectSellercomboBox.Text = selectSalesRep;

            if (!searchCategorycomboBox.Items.Contains(searchByCategory))
            {
                searchCategorycomboBox.Items.Add(searchByCategory);
            }
            searchCategorycomboBox.Text = searchByCategory;

            if (!salesTypeComboBox.Items.Contains(selectSalesType))
            {
                salesTypeComboBox.Items.Add(selectSalesType);
            }
            salesTypeComboBox.Text = selectSalesType;


            if (!serviceChargeComboBox.Items.Contains(selectServiceCharge))
            {
                serviceChargeComboBox.Items.Add(selectServiceCharge);
            }
            serviceChargeComboBox.Text = selectServiceCharge;


            loadSellers();
            loadServiceCharge();
            loadCategories();
            loadSalesType();
            loadCustomers();
            InvoicetextBox.Text = GenerateIDs.invoiceId();
        }
コード例 #6
0
 public AddPurchasesForm()
 {
     InitializeComponent();
     init();
     this.orderRefTextBox.Text = GenerateIDs.purchaseOrderId();
 }
コード例 #7
0
        private async void processData(bool isEdit)
        {
            string   supplierName = getSupplier().name;
            string   status       = statusComboBox.Text;
            DateTime dateCreated  = dateCreatedDateTimePicker.Value;
            DateTime deliveryDate = expectedDateofDeliveryDateTimePicker.Value;
            string   order        = orderRefTextBox.Text;
            string   clientId     = getClient().id;
            string   supplierId   = getSupplier().id;
            string   staffName    = clientComboBox.Text;

            if (isEdit)
            {
                if (!MessagePrompt.displayPrompt("Edit", "edit this purchase order"))
                {
                    return;
                }

                purchases.productsList       = purchasedStocks;
                purchases.supplierName       = supplierName;
                purchases.supplierId         = supplierId;
                purchases.status             = status;
                purchases.dateCreated        = dateCreated;
                purchases.deliveryDate       = deliveryDate;
                purchases.orderNo            = order;
                purchases.staffName          = staffName;
                purchases.staffId            = clientId;
                purchases.grandTotalPrice    = grandTotalPrice;
                purchases.grandTotalQuantity = grandTotalQuantity;


                MessageBox.Show(await DatabaseOperations.editpurchases(this.purchases) ? "Data updated successfully" :
                                "Data updating failed");

                if (MessagePrompt.printPrompt("purchase order"))
                {
                    print(purchases);
                }
            }
            else
            {
                if (!MessagePrompt.displayPrompt("Create New", "Create new purchase order"))
                {
                    return;
                }

                var purchaseOrder = new PurchaseOrderDataModel();

                purchaseOrder.supplierName       = supplierName;
                purchaseOrder.staffName          = staffName;
                purchaseOrder.status             = status;
                purchaseOrder.dateCreated        = dateCreated;
                purchaseOrder.deliveryDate       = deliveryDate;
                purchaseOrder.orderNo            = order;
                purchaseOrder.staffId            = clientId;
                purchaseOrder.supplierId         = supplierId;
                purchaseOrder.grandTotalPrice    = grandTotalPrice;
                purchaseOrder.grandTotalQuantity = grandTotalQuantity;
                purchaseOrder.productsList       = purchasedStocks;

                DatabaseOperations.addPurchases(purchaseOrder);

                MessageBox.Show("Purchase saved successfull");

                if (MessagePrompt.printPrompt("purchase order"))
                {
                    print(purchaseOrder);
                }

                this.orderRefTextBox.Text = GenerateIDs.purchaseOrderId();
                this.dataGridView1.Rows.Clear();
                grandTotalPrice                = 0;
                grandTotalQuantity             = 0;
                totalPriceTextBox.Text         = FormatPrice.format(getTotalPrice(quantityToSupplytextBox.Text));
                grandTotalQuantitytextBox.Text = getTotalQuantity(quantityToSupplytextBox.Text);
                grandTotalPricetextBox.Text    = FormatPrice.format(getTotalPrice(quantityToSupplytextBox.Text));
            }
        }
コード例 #8
0
        private async void processData()
        {
            var     sales    = new List <SalesDataModel>();
            var     saleRep  = salesRepData.ElementAt(SelectSellercomboBox.SelectedIndex);
            var     saleType = salesTypeData.ElementAt(salesTypeComboBox.SelectedIndex);
            decimal amtPaid  = decimal.Parse(amoutPaidTextBox.Text);

            if (string.IsNullOrEmpty(customerComboBox.Text))
            {
                if (MessageBox.Show("No valid customer selected. Do you wish to continue?", "Warning", MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return;
                }
            }


            int    index  = customerComboBox.SelectedIndex;
            string custId = "";

            if (index != -1)
            {
                custId = customers.ElementAt(index).id;
            }

            if (!MessagePrompt.displayPrompt("Process Payment", "process payment of the selected stocks"))
            {
                return;
            }

            foreach (var data in selectedStocks)
            {
                sales.Add(new SalesDataModel
                {
                    stockId       = data.id,
                    lastCostPrice = data.lastCostPrice,
                    soldPrice     = data.unitPrice,
                    date          = DateTime.Now
                });
            }

            var receipt = new ReceiptDataModel
            {
                invoiceNo     = InvoicetextBox.Text,
                totalPrice    = totalPrice,
                discount      = discount,
                amountPayable = amountPayable,
                serviceCharge = _serviceCharge,
                date          = DateTime.Now,
                soldItems     = sales,
                salesRep      = saleRep.name,
                repId         = saleRep.repId,
                salesRepId    = saleRep.id,
                salesType     = saleType.title,
                salesTypeId   = saleType.id,
                customerId    = custId,
                totalAmtPaid  = amtPaid
            };

            await DatabaseOperations.addReceipt(receipt);

            Ticket ticket = new Ticket
            {
                receiptDate   = DateTime.Now,
                receiptNo     = InvoicetextBox.Text,
                stocks        = selectedStocks,
                amountPayable = amountPayable,
                serviceCharge = _serviceCharge,
                discount      = discount,
                totalQuantity = selectedStocks.Count,
                totalPrice    = totalPrice
            };

            try
            {
                await ticket.print();
            }
            catch (Exception e)
            {
                MessageBox.Show("Receipt could not be printed. Please try again", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            clear();
            InvoicetextBox.Text = GenerateIDs.invoiceId();
        }
コード例 #9
0
 private void regenerateVoucherbutton_Click(object sender, EventArgs e)
 {
     _voucherCode            = GenerateIDs.voucherCode();
     voucherCodeTextBox.Text = _voucherCode;
 }
コード例 #10
0
 private void IssueStockForm_Load(object sender, EventArgs e)
 {
     transferIdTextBox.Text = GenerateIDs.transferId();
     loadStoreFromDB();
     loadAvailableStocks();
 }
コード例 #11
0
 private void AddReceivedGoods_Load(object sender, EventArgs e)
 {
     grnIdTextBox.Text = GenerateIDs.receivedNoteId();
 }
コード例 #12
0
        private async void processData(bool isEdit)
        {
            var goodsreceived = new List <ReceivedNotesDataModel.GoodsReceived>();

            for (int i = 0; i < selectedStocks.Count(); i++)
            {
                goodsreceived.Add(new ReceivedNotesDataModel.GoodsReceived
                {
                    stockId  = selectedStocks.ElementAt(i).id,
                    quantity = selectedQuantity.ElementAt(i)
                });
            }


            if (isEdit)
            {
                if (!MessagePrompt.displayPrompt("Edit", "edit this note"))
                {
                    return;
                }
                receivedNotes.goodsReceived = goodsreceived;
                bool success = await DatabaseOperations.editReceivedNotes(receivedNotes);

                MessageBox.Show(success ? "Data deleted successfully" : "Data deletion failed");
            }
            else
            {
                if (!MessagePrompt.displayPrompt("Add New", "add new Received Notes"))
                {
                    return;
                }

                await DatabaseOperations.addReceivedNotes(new ReceivedNotesDataModel
                {
                    purchaseId    = purchaseOrder != null ? purchaseOrder.id : "",
                    grnId         = grnIdTextBox.Text,
                    orderId       = "PO-" + orderIdTextBox.Text,
                    amount        = purchaseOrder != null ? purchaseOrder.grandTotalPrice : 0,
                    dateReceived  = DateTime.Now,
                    goodsReceived = goodsreceived
                });

                MessageBox.Show("Data created successfully");

                addAllButton.Enabled = false;
                saveButton.Enabled   = false;
                selectedQuantity.Clear();
                selectedStocks.Clear();
                stocksOnPurchaseOrder.Clear();
                quantityOnPurchaseOrder.Clear();
                dataGridView1.Rows.Clear();
                dataGridView2.Rows.Clear();
                supplierNameTextBox.Clear();
                statusTextBox.Clear();
                dateCreatedTextBox.Clear();
                deliveryDateTextBox.Clear();
                grandTotalPriceTextBox.Clear();
                grandTotalQuantityTextBox.Clear();
                orderIdTextBox.Clear();
                orderIdTextBox.Focus();
                grnIdTextBox.Text = GenerateIDs.receivedNoteId();
            }
        }
コード例 #13
0
 public AddClient()
 {
     InitializeComponent();
     passwordTextBox.Text = GenerateIDs.password();
     loadCombos();
 }
コード例 #14
0
        private async void processData(bool isEdit)
        {
            errorProvider1.Clear();
            string name          = nametextBox.Text;
            string phone         = phoneMaskedTextBox.Text;
            string address       = addresstextBox.Text;
            string other         = othertextBox.Text;
            string username      = usernameTextBox.Text;
            string password      = passwordTextBox.Text;
            string role          = rolesComboBox.Text;
            string storelocation = storeLocationComboBox.Text;

            if (isEdit)
            {
                clientModel.name          = name;
                clientModel.phone         = phone;
                clientModel.address       = address;
                clientModel.other         = other;
                clientModel.username      = username;
                clientModel.password      = password;
                clientModel.role          = role;
                clientModel.storeLocation = storelocation;

                if (!MessagePrompt.displayPrompt("Edit", "edit this client"))
                {
                    return;
                }

                MessageBox.Show(await DatabaseOperations.editClient(clientModel) ? "Client edited successfully" : "client editing failed");
            }
            else
            {
                if (!MessagePrompt.displayPrompt("Create New", "create new client"))
                {
                    return;
                }

                ClientDataModel clientModel = new ClientDataModel();
                clientModel.name          = name;
                clientModel.phone         = phone;
                clientModel.address       = address;
                clientModel.other         = other;
                clientModel.username      = username;
                clientModel.password      = password;
                clientModel.role          = role;
                clientModel.storeLocation = storelocation;

                bool success = await DatabaseOperations.addClient(clientModel);

                if (success)
                {
                    MessageBox.Show("Client created successfully");
                    nametextBox.Clear();
                    phoneMaskedTextBox.Clear();
                    addresstextBox.Clear();
                    othertextBox.Clear();
                    usernameTextBox.Clear();


                    passwordTextBox.Text = GenerateIDs.password();
                }
                else
                {
                    MessageBox.Show("Client creation failed.");
                }
            }
        }