コード例 #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 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();
        }
コード例 #3
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();
        }