Beispiel #1
0
        private void dataGridView2_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView2.Columns[e.ColumnIndex].Name == "Delete")
            {
                DialogResult myResult;
                myResult = MessageBox.Show("Are you really delete the item?", "Delete Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                if (myResult == DialogResult.OK)
                {
                    _entities = new KBBQEntities();

                    var cellId = Convert.ToInt32(dataGridView2.CurrentRow.Cells[0].Value);
                    updateClass = new clsUpdate();
                    updateClass.updateBillAndSettlement(cellId.ToString(), "CANCELLED", "", 0);

                    _entities = new KBBQEntities();

                    var data = _entities.DailySales.Where(x => x.KOT == cellId.ToString()).ToList();

                    foreach (var item in data)
                    {
                        _entities.DailySales.Remove(item);
                        _entities.SaveChanges();
                    }

                    bindGridViewForPageLoad();
                }
            }
        }
Beispiel #2
0
        private void textBox1_Leave(object sender, EventArgs e)
        {
            try
            {
                if (txtCode.Text != string.Empty)
                {
                    _entities = new KBBQEntities();
                    var coupCode = _entities.billAndSettlements.ToList();

                    foreach (var item in coupCode)
                    {
                        if (item.couponCode != null)
                        {
                            var avail = item.couponCode.Trim().ToString();
                            if (avail == txtCode.Text.Trim().ToString())
                            {
                                MessageBox.Show("Coupon Code already existed.", "Error - King Bar beque Restaurant Coupon Code", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                txtCode.Focus();
                                return;
                            }
                            else
                            {
                            }
                        }
                    }
                }
            }
            catch (Exception x)
            {
            }
        }
Beispiel #3
0
        void dataGridBind()
        {
            try
            {
                _entities = new KBBQEntities();

                var data = _entities.billAndSettlements.Where(x => x.mode == "PAID").ToList();

                List <billAndSettlementVM> modelList = new List <billAndSettlementVM>();
                int row = 1;
                foreach (var item in data)
                {
                    billAndSettlementVM model = new billAndSettlementVM();
                    model.rowNo = row;
                    model.kot   = _entities.detailsSettlements.Where(x => x.KOT == item.kot).FirstOrDefault().receiptno;

                    model.orderDecrip = item.orderDecrip;
                    model.ordDate     = item.ordDate.ToString("dd-MMM-yyyy");
                    model.tax1_Amt    = item.tax1_Amt;
                    model.tax2_Amt    = item.tax2_Amt;
                    row++;
                    modelList.Add(model);
                }
                dataGridView2.DataSource = modelList;
            }
            catch (Exception x)
            {
            }
        }
Beispiel #4
0
        private void dataGridbind()
        {
            try
            {
                _entities = new KBBQEntities();

                List <ProductTypeVM> modelList = new List <ProductTypeVM>();

                var data = _entities.tblProTypes.OrderBy(x => x.proSubCate).ToList();


                int rowNo = 1;
                foreach (var item in data)
                {
                    ProductTypeVM model = new ProductTypeVM();
                    model.prodTypeName = item.prodTypeName;
                    model.proSubCate   = item.proSubCate;
                    model.proTypeID    = item.proTypeID;

                    model.rowNo = rowNo;

                    modelList.Add(model);
                    rowNo++;
                }
                lblTotalRecord.Text      = modelList.Count.ToString();
                dataGridView1.DataSource = modelList;
            }
            catch (Exception x)
            {
            }
        }
Beispiel #5
0
        private void dgPurchaseOrderDetails_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dgPurchaseOrderDetails.CurrentRow.Index != -1 && dgPurchaseOrderDetails.CurrentRow.Cells[1].Value != null)
                {
                    var lID = Convert.ToInt32(dgPurchaseOrderDetails.CurrentRow.Cells[0].Value);

                    _entities = new KBBQEntities();
                    var seeData = _entities.tblPurchaseOrders.Where(x => x.id == lID).FirstOrDefault();

                    if (seeData != null)
                    {
                        var pName = _entities.purchaseProducts.Where(x => x.id == seeData.productId).FirstOrDefault().pName;

                        txtitemName.Text = pName.Trim().ToString();
                        txtQty.Text      = seeData.qty.ToString();
                        txtWeight.Text   = seeData.weight.ToString();

                        comboUnit.Text = seeData.unit;

                        passedId       = seeData.id;
                        btnCreate.Text = "Update";
                    }
                    else
                    {
                    }
                }
            }
            catch (Exception x)
            {
                MessageBox.Show("Something went wrong. Contact your system administrator");
            }
        }
Beispiel #6
0
        private void dgvExpenses_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dgvExpenses.CurrentRow.Index != -1 && dgvExpenses.CurrentRow.Cells[1].Value != null)
                {
                    var lID = Convert.ToInt32(dgvExpenses.CurrentRow.Cells[0].Value);

                    _entities = new KBBQEntities();
                    var seeData = _entities.tblExpenses.Where(x => x.id == lID).FirstOrDefault();

                    if (seeData != null)
                    {
                        txtExpName.Text = seeData.expName.Trim().ToString();
                        txtExpBy.Text   = seeData.expBy.Trim().ToString();
                        txtAmt.Text     = seeData.amount.ToString();

                        dtpExpDate.Text = seeData.expDate.ToString();

                        passedId       = seeData.id;
                        btnCreate.Text = "Update";
                    }
                    else
                    {
                    }
                }
            }
            catch (Exception x)
            {
                MessageBox.Show("Something went wrong. Contact your system administrator");
            }
        }
Beispiel #7
0
        private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dataGridView1.CurrentRow.Index != -1 && dataGridView1.CurrentRow.Cells[1].Value != null)
                {
                    var lID = Convert.ToInt32(dataGridView1.CurrentRow.Cells[0].Value);

                    _entities = new KBBQEntities();
                    var seeData = _entities.tblProTypes.Where(x => x.proTypeID == lID).FirstOrDefault();

                    if (seeData != null)
                    {
                        txtCategory.Text        = seeData.proSubCate.Trim().ToString();
                        cboProductTypeName.Text = seeData.prodTypeName.Trim().ToString();

                        passedId     = seeData.proTypeID;
                        btnSave.Text = "Update";
                    }
                    else
                    {
                    }
                }
            }
            catch (Exception x)
            {
                MessageBox.Show("Something went wrong. Contact your system administrator");
            }
        }
Beispiel #8
0
        private void frmViewOrderInfo_Load(object sender, EventArgs e)
        {
            try
            {
                // viewClass.viewOrderInfo(dataGridView1);

                //dateFrom.Format = DateTimePickerFormat.Custom;
                //dateFrom.CustomFormat = "dd-MM-yyyy";


                //dateTo.Format = DateTimePickerFormat.Custom;
                //dateTo.CustomFormat = "dd-MM-yyyy";
                dataGridView1.AutoGenerateColumns = false;

                _entities = new KBBQEntities();

                List <OrderInfoVM> modelList = new List <OrderInfoVM>();

                var data = _entities.tblOrderInfoes.OrderBy(x => x.id).ToList();

                if (data != null)
                {
                    foreach (var item in data)
                    {
                        OrderInfoVM model = new OrderInfoVM();

                        model.KOT        = item.KOT;
                        model.orderType  = item.orderType;
                        model.tableNo    = item.tableNo;
                        model.ordDate    = item.ordDate;
                        model.ordTime    = item.ordTime;
                        model.guests     = item.fname + " " + item.lname;
                        model.adultNo    = item.adultNo;
                        model.childrenNo = item.childrenNo;

                        model.mode = _entities.billAndSettlements.Where(x => x.kot == item.KOT).FirstOrDefault().mode;

                        var empName = _entities.tblEmployees.Where(x => x.empID == item.empID).FirstOrDefault();

                        if (empName != null)
                        {
                            model.empName = empName.fname;
                        }

                        modelList.Add(model);
                    }

                    dataGridView1.DataSource = modelList;

                    foreach (DataGridViewColumn item in dataGridView1.Columns)
                    {
                        dataGridView1.Sort(dataGridView1.Columns[item.Name], System.ComponentModel.ListSortDirection.Ascending);
                    }
                }
            }
            catch (Exception x)
            {
            }
        }
Beispiel #9
0
        private void txtitemName_KeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                if (txtitemName.Text != string.Empty)
                {
                    dgPurchaseOrderDetails.AutoGenerateColumns = false;
                    int rowNo = 1;
                    _entities = new KBBQEntities();

                    List <PurchaseOrderVM> modelList = new List <PurchaseOrderVM>();

                    var pId = _entities.purchaseProducts.Where(x => x.pName.Contains(txtitemName.Text.ToString())).FirstOrDefault();
                    if (pId != null)
                    {
                        var categoryData = _entities.tblPurchaseOrders.Where(x => x.productId == pId.id).ToList();

                        foreach (var item in categoryData)
                        {
                            PurchaseOrderVM model = new PurchaseOrderVM();
                            model.rowNo = rowNo;
                            model.id    = item.id;

                            var productName = _entities.purchaseProducts.Where(x => x.id == item.productId).FirstOrDefault().pName;

                            model.pName  = productName;
                            model.qty    = item.qty;
                            model.weight = item.weight + " " + item.unit;
                            model.date   = item.date.ToString();
                            model.cdate  = Convert.ToDateTime(item.cdate).ToString("dd-MM-yyyy  hh:mm tt");

                            if (item.udate == null)
                            {
                                model.udate = "--";
                            }
                            else
                            {
                                model.udate = Convert.ToDateTime(item.udate).ToString("dd-MM-yyyy  hh:mm tt");
                            }


                            modelList.Add(model);

                            rowNo++;
                        }
                    }
                    dgPurchaseOrderDetails.DataSource = modelList;

                    lblTotalRows.Text = modelList.Count.ToString();
                }
            }
            catch (Exception x)
            {
                MessageBox.Show(x.ToString());
            }
        }
Beispiel #10
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                //DateTime fromdate = DateTime.ParseExact(dateFrom.Text, "dd-MM-yyyy", null);
                //DateTime todate = DateTime.ParseExact(dateTo.Text, "dd-MM-yyyy", null);

                viewClass.viewOrderInfoByDates(dataGridView1, Convert.ToDateTime(dateFrom.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(dateTo.Text).ToString("yyyy-MM-dd"));

                dataGridView1.AutoGenerateColumns = false;

                _entities = new KBBQEntities();

                List <OrderInfoVM> modelList = new List <OrderInfoVM>();

                DateTime fromDate = Convert.ToDateTime(dateFrom.Text);
                DateTime toDate   = Convert.ToDateTime(dateTo.Text);

                var data = _entities.tblOrderInfoes.Where(x => x.ordDate >= fromDate && x.ordDate <= toDate).OrderBy(x => x.KOT).ToList();

                if (data != null)
                {
                    foreach (var item in data)
                    {
                        OrderInfoVM model = new OrderInfoVM();

                        model.KOT        = item.KOT;
                        model.orderType  = item.orderType;
                        model.tableNo    = item.tableNo;
                        model.ordDate    = item.ordDate;
                        model.ordTime    = item.ordTime;
                        model.guests     = item.fname + " " + item.lname;
                        model.adultNo    = item.adultNo;
                        model.childrenNo = item.childrenNo;
                        model.mode       = _entities.billAndSettlements.Where(x => x.kot == item.KOT).FirstOrDefault().mode;

                        var empName = _entities.tblEmployees.Where(x => x.empID == item.empID).FirstOrDefault();

                        if (empName != null)
                        {
                            model.empName = empName.fname;
                        }

                        modelList.Add(model);
                    }

                    dataGridView1.DataSource = modelList;
                }
            }

            catch (Exception x)
            {
                MessageBox.Show(x.ToString());
            }
        }
Beispiel #11
0
        private void txtSearch_KeyUp(object sender, KeyEventArgs e)
        {
            try
            {
                int rowNo = 1;
                dgPurchaseDetails.AutoGenerateColumns = false;
                totalAmts = 0;

                if (txtSearch.Text == string.Empty)
                {
                    dataGridBind();
                    return;
                }

                _entities = new KBBQEntities();
                List <PurchaseMasterVM> modelList = new List <PurchaseMasterVM>();

                var data = _entities.tbl_PurchaseMaster.Where(x => x.refNo.Contains(txtSearch.Text.Trim()) || x.partyName.Contains(txtSearch.Text.Trim())).OrderByDescending(x => x.pId);

                foreach (var item in data)
                {
                    PurchaseMasterVM model = new PurchaseMasterVM();
                    model.rowNo       = rowNo;
                    model.pId         = item.pId;
                    model.refNo       = item.refNo;
                    model.partyName   = item.partyName;
                    model.remarks     = item.remarks;
                    model.date        = Convert.ToDateTime(item.date).ToString("dd-MM-yyyy");
                    model.totalWeight = item.totalWeight;
                    model.totalAmt    = Convert.ToDecimal(amtFormat.comma(item.totalAmt));
                    model.createdDate = Convert.ToDateTime(item.createdDate).ToString("dd-MM-yyyy  hh:mm tt");
                    if (item.updateDate == null)
                    {
                        model.updateDate = "--";
                    }
                    else
                    {
                        model.updateDate = Convert.ToDateTime(item.updateDate).ToString("dd-MM-yyyy  hh:mm tt");
                    }

                    totalAmts += item.totalAmt;
                    modelList.Add(model);

                    rowNo++;
                }

                dgPurchaseDetails.DataSource = modelList;
                lblTotalRows.Text            = modelList.Count.ToString();
                lblTotalAmt.Text             = amtFormat.comma(totalAmts);
            }
            catch (Exception x)
            {
            }
        }
Beispiel #12
0
        private void itemAutocomplete()
        {
            _entities = new KBBQEntities();

            var ledgerNameAutoComplete = _entities.purchaseProducts.OrderBy(x => x.pName);

            txtitemName.AutoCompleteCustomSource.Clear();
            foreach (var item in ledgerNameAutoComplete)
            {
                txtitemName.AutoCompleteCustomSource.Add(item.pName.ToString());
            }
        }
Beispiel #13
0
        private void partyAutocomplete()
        {
            _entities = new KBBQEntities();

            var ledgerNameAutoComplete = _entities.tbl_PurchaseMaster.OrderBy(x => x.partyName);

            txtPartyName.AutoCompleteCustomSource.Clear();
            foreach (var item in ledgerNameAutoComplete)
            {
                txtPartyName.AutoCompleteCustomSource.Add(item.partyName.ToString());
            }
        }
Beispiel #14
0
        private void billNumberAutoComplete()
        {
            _entities = new KBBQEntities();

            var billNoAutoComplete = _entities.tbl_PurchaseMaster.OrderBy(x => x.pId);

            txtSearch.AutoCompleteCustomSource.Clear();
            foreach (var item in billNoAutoComplete)
            {
                txtSearch.AutoCompleteCustomSource.Add(item.refNo.ToString());
            }
        }
Beispiel #15
0
        //REMOVE DULPICATE
        public void _CheckProductExist()
        {
            try
            {
                if (btnSave.Text == "Save")
                {
                    SqlConnection con = new SqlConnection(insertClass.dbPath);

                    string     sql = "select proSubCate from tblProType  where proSubCate = @proSubCate";
                    SqlCommand cmd = new SqlCommand(sql, con);
                    con.Open();
                    DataSet        ds    = new DataSet();
                    SqlDataAdapter adapt = new SqlDataAdapter(cmd);
                    cmd.Parameters.AddWithValue("@proSubCate", txtCategory.Text.Trim());

                    adapt.Fill(ds);
                    con.Close();
                    int count = ds.Tables[0].Rows.Count;

                    //If count is equal to 1
                    //meaning user already exist
                    if (count == 1)
                    {
                        MessageBox.Show("Menu Subgroup Already Exist", "Help - King Bar Beque", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                    else
                    {
                        //PERFORM INSERT
                        insertClass.insertToProType(cboProductTypeName, txtCategory.Text);
                        _setInitialState();
                    }
                }
                else
                {
                    _entities = new KBBQEntities();
                    var data = _entities.tblProTypes.Where(x => x.proTypeID == passedId).FirstOrDefault();

                    if (data != null)
                    {
                        data.prodTypeName = cboProductTypeName.Text.ToString();
                        data.proSubCate   = txtCategory.Text.Trim();

                        _entities.SaveChanges();
                    }
                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message, "Throwing Exception - Fronty", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
Beispiel #16
0
        private void getTableNo()
        {
            _entities = new KBBQEntities();

            var data = _entities.billAndSettlements.Where(x => x.mode == "UNPAID").OrderBy(x => x.kot).ToList();
            List <OrderInfoVM> modelList = new List <OrderInfoVM>();

            if (data != null)
            {
                foreach (var item in data)
                {
                    var dataTableNo = _entities.tblOrderInfoes.Where(x => x.KOT == item.kot).FirstOrDefault();

                    if (dataTableNo != null)
                    {
                        var datas = _entities.tblOrderInfoes.ToList();

                        foreach (var itemss in modelList)
                        {
                            if (itemss.tableNo == dataTableNo.tableNo)
                            {
                                count = 1;
                            }
                        }

                        if (count == 1)
                        {
                            count = 0;
                        }
                        else
                        {
                            OrderInfoVM model = new OrderInfoVM();
                            model.KOT     = dataTableNo.KOT;
                            model.tableNo = dataTableNo.tableNo;

                            modelList.Add(model);

                            tabl  = model.tableNo;
                            count = 0;

                            //cmbTableNo.Items.Add(tabl);
                        }
                    }
                }

                cmbTableNo.ValueMember   = "KOT";
                cmbTableNo.DisplayMember = "tableNo";
                cmbTableNo.DataSource    = modelList.OrderBy(x => x.tableNo).ToList();
            }
        }
Beispiel #17
0
        private void cmbTableNo_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                btnMergePay.Visible = true;

                _entities = new KBBQEntities();

                //var data = _entities.tblOrderInfoes.Where(x => x.tableNo == cmbTableNo.SelectedText.ToString()).ToList();
                //foreach (var item in data)
                //{
                //   selectClass.selectBillAndSettlementTableNo(dataGridView1, cmbTableNo.SelectedValue.ToString());
                //}
                dataGridView2.Refresh();

                recNoToPass = new List <billAndSettlementVM>();
                string tablCMBSelected = cmbTableNo.Text.ToString();

                List <billAndSettlementVM> modelList = new List <billAndSettlementVM>();

                var data = _entities.tblOrderInfoes.Where(x => x.tableNo == tablCMBSelected).ToList();

                foreach (var item in data)
                {
                    var dataSettlement = _entities.billAndSettlements.Where(x => x.kot == item.KOT && x.mode == "UNPAID").FirstOrDefault();
                    if (dataSettlement != null)
                    {
                        billAndSettlementVM model = new billAndSettlementVM();

                        model.kot         = dataSettlement.kot;
                        model.orderDecrip = dataSettlement.orderDecrip;
                        model.guestName   = dataSettlement.fname + " " + dataSettlement.lname;
                        model.ordDate     = Convert.ToDateTime(item.ordDate).ToString("dd-MMM-yyyy");

                        model.ordTime  = dataSettlement.ordTime;
                        model.totalDue = dataSettlement.totalDue;
                        model.mobile   = dataSettlement.mobile;
                        modelList.Add(model);

                        recNoToPass.Add(model);
                    }
                }

                dataGridView2.DataSource = modelList;
                dataGridView2.ClearSelection();
            }
            catch (Exception x)
            {
            }
        }
Beispiel #18
0
        private void dataGridBind()
        {
            try
            {
                dgPurchaseOrderDetails.AutoGenerateColumns = false;
                int rowNo = 1;
                _entities = new KBBQEntities();

                List <PurchaseOrderVM> modelList = new List <PurchaseOrderVM>();

                var categoryData = _entities.tblPurchaseOrders.Where(x => x.date == dateTimePicker1.Value.Date).ToList();

                foreach (var item in categoryData)
                {
                    PurchaseOrderVM model = new PurchaseOrderVM();
                    model.rowNo = rowNo;
                    model.id    = item.id;

                    var productName = _entities.purchaseProducts.Where(x => x.id == item.productId).FirstOrDefault().pName;

                    model.pName  = productName;
                    model.qty    = item.qty;
                    model.weight = item.weight + " " + item.unit;
                    model.date   = item.date.ToString();
                    model.cdate  = Convert.ToDateTime(item.cdate).ToString("dd-MM-yyyy  hh:mm tt");

                    if (item.udate == null)
                    {
                        model.udate = "--";
                    }
                    else
                    {
                        model.udate = Convert.ToDateTime(item.udate).ToString("dd-MM-yyyy  hh:mm tt");
                    }


                    modelList.Add(model);

                    rowNo++;
                }

                dgPurchaseOrderDetails.DataSource = modelList;

                lblTotalRows.Text = modelList.Count.ToString();
            }
            catch (Exception x)
            {
                MessageBox.Show(x.ToString());
            }
        }
Beispiel #19
0
        private void dgPurchaseDetails_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dgPurchaseDetails.Columns[e.ColumnIndex].Name == "Delete")
                {
                    DialogResult myResult;
                    myResult = MessageBox.Show("Are you really delete the item?", "Delete Confirmation", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
                    if (myResult == DialogResult.OK)
                    {
                        _entities = new KBBQEntities();

                        var cellId = Convert.ToInt32(dgPurchaseDetails.CurrentRow.Cells[0].Value);


                        var selectedData1 = _entities.tbl_PurchaseDetails.Where(x => x.purchaseID == cellId).FirstOrDefault();
                        var selectedData2 = _entities.tbl_PurchaseMaster.Where(x => x.pId == cellId).FirstOrDefault();

                        if (selectedData1 != null)
                        {
                            _entities.tbl_PurchaseDetails.Remove(selectedData1);
                        }
                        else
                        {
                            MessageBox.Show("Something went wrong. Record cannot be deleted.");
                        }
                        if (selectedData2 != null)
                        {
                            _entities.tbl_PurchaseMaster.Remove(selectedData2);
                        }
                        else
                        {
                            MessageBox.Show("Something went wrong. Record cannot be deleted.");
                        }

                        _entities.SaveChanges();
                        MessageBox.Show("Record deleted ");
                        dataGridBind();
                    }
                    else
                    {
                        //No delete
                    }
                }
            }
            catch (Exception x)
            {
                MessageBox.Show("Record Cannot be deleted. Reference of this record is present in other entries");
            }
        }
Beispiel #20
0
        private void dataGridBind()
        {
            try
            {
                int rowNo = 1;
                totalAmts = 0;
                dgPurchaseDetails.AutoGenerateColumns = false;

                _entities = new KBBQEntities();

                List <PurchaseMasterVM> modelList = new List <PurchaseMasterVM>();

                var data = _entities.tbl_PurchaseMaster.OrderByDescending(x => x.pId);

                foreach (var item in data)
                {
                    PurchaseMasterVM model = new PurchaseMasterVM();
                    model.rowNo       = rowNo;
                    model.pId         = item.pId;
                    model.refNo       = item.refNo;
                    model.partyName   = item.partyName;
                    model.remarks     = item.remarks;
                    model.date        = Convert.ToDateTime(item.date).ToString("dd-MM-yyyy");
                    model.totalWeight = item.totalWeight;
                    model.totalAmt    = Convert.ToDecimal(amtFormat.comma(item.totalAmt));

                    model.createdDate = Convert.ToDateTime(item.createdDate).ToString("dd-MM-yyyy  hh:mm tt");

                    if (item.updateDate == null)
                    {
                        model.updateDate = "--";
                    }
                    else
                    {
                        model.updateDate = Convert.ToDateTime(item.updateDate).ToString("dd-MM-yyyy  hh:mm tt");
                    }

                    modelList.Add(model);
                    totalAmts += item.totalAmt;
                    rowNo++;
                }
                lblTotalAmt.Text             = amtFormat.comma(totalAmts);
                dgPurchaseDetails.DataSource = modelList;
                lblTotalRows.Text            = modelList.Count.ToString();
            }
            catch (Exception x)
            {
                MessageBox.Show("Something went wrong. Contact your system administrator");
            }
        }
Beispiel #21
0
        private void showAvailableData()
        {
            clear();


            btnSubmit.Text = "Update";
            _entities      = new KBBQEntities();

            var data = _entities.purchaseProducts.Where(x => x.id == passedId).FirstOrDefault();

            txtProductName.Text = data.pName.Trim().ToString();
            txtQuantity.Text    = data.qty.ToString();
            txtWeight.Text      = data.weight.ToString();
        }
Beispiel #22
0
        private void showAvailableData()
        {
            clear();
            clearDetails();

            btnCreate.Text = "Update";
            _entities      = new KBBQEntities();

            var data = _entities.tbl_PurchaseMaster.Where(x => x.pId == passedPid).FirstOrDefault();

            txtRefNo.Text     = data.refNo;
            dateToday.Text    = data.date.ToString();
            txtRemark.Text    = data.remarks.ToString();
            txtPartyName.Text = data.partyName.Trim().ToString();

            txtTotalAmt.Text    = amtFormat.comma(data.totalAmt).ToString();
            txtTotalWeight.Text = data.totalWeight.ToString();

            ttlWeight = Convert.ToDecimal(txtTotalWeight.Text) * 1000;
            ttlRate   = Convert.ToDecimal(txtTotalAmt.Text);


            txtAmtInWords.Text = "";
            ConvertNoToWord convertToWord = new ConvertNoToWord();

            //int totalRate = Convert.ToInt32(txtTotalRate.Text);
            txtAmtInWords.Text = convertToWord.ConvertNumbertoWords(Convert.ToInt32(data.totalAmt)).ToLower();

            _entities = new KBBQEntities();

            var purchaseDetailsData = _entities.tbl_PurchaseDetails.Where(x => x.purchaseID == passedPid).ToList();

            id = 1;
            foreach (var item in purchaseDetailsData)
            {
                var pName = _entities.purchaseProducts.Where(x => x.id == item.productID).FirstOrDefault().pName;

                dgPurchaseItem.Rows.Add(
                    id.ToString(),
                    pName,
                    item.qty,
                    item.weight,
                    item.unit,
                    item.rate);

                id = id + 1;
            }
        }
Beispiel #23
0
        private void addPurchaseOrder()
        {
            try
            {
                int rowNo = 1;
                _entities = new KBBQEntities();

                List <PurchaseOrderVM> modelList = new List <PurchaseOrderVM>();

                var categoryData = _entities.tblPurchaseOrders.Where(x => x.date == datePassed).ToList();

                foreach (var item in categoryData)
                {
                    PurchaseOrderVM model = new PurchaseOrderVM();
                    model.rowNo = rowNo;
                    model.id    = item.id;

                    var productName = _entities.purchaseProducts.Where(x => x.id == item.productId).FirstOrDefault().pName;

                    model.pName  = productName;
                    model.qty    = item.qty;
                    model.weight = item.weight + " " + item.unit;

                    model.cdate = Convert.ToDateTime(item.cdate).ToString("dd-MM-yyyy  hh:mm tt");

                    if (item.udate == null)
                    {
                        model.udate = "--";
                    }
                    else
                    {
                        model.udate = Convert.ToDateTime(item.udate).ToString("dd-MM-yyyy  hh:mm tt");
                    }

                    modelList.Add(model);

                    rowNo++;
                }
                ReportDataSource datasource = new ReportDataSource("DataSet1", modelList);

                this.reportViewer1.LocalReport.DataSources.Clear();
                this.reportViewer1.LocalReport.DataSources.Add(datasource);
            }
            catch (Exception x)
            {
                MessageBox.Show(x.ToString());
            }
        }
Beispiel #24
0
        private void orderInfo_Load(object sender, EventArgs e)
        {
            try
            {
                txtFirst.Focus();
                _entities = new KBBQEntities();

                var getempName = _entities.tblEmployees.OrderBy(x => x.fname).ToList();
                cmbWaiter.ValueMember   = "id";
                cmbWaiter.DisplayMember = "fname";
                cmbWaiter.DataSource    = getempName;
            }
            catch (Exception x)
            {
            }
        }
        private void dataGridBind()
        {
            try
            {
                _entities = new KBBQEntities();

                int rowNo = 1;

                dgItemDetails.AutoGenerateColumns = false;

                List <PurchaseProductVM> modelList = new List <PurchaseProductVM>();

                var data = _entities.purchaseProducts.OrderBy(x => x.pName);

                foreach (var item in data)
                {
                    PurchaseProductVM model = new PurchaseProductVM();
                    model.rowNo  = rowNo;
                    model.id     = Convert.ToInt32(item.id);
                    model.pName  = item.pName;
                    model.date   = Convert.ToDateTime(item.date).ToString("dd-MM-yyyy");
                    model.weight = item.weight + " " + item.unit;
                    model.qty    = item.qty;
                    model.cdate  = Convert.ToDateTime(item.cdate).ToString("dd-MM-yyyy  hh:mm tt");

                    if (item.udate == null)
                    {
                        model.udate = "--";
                    }
                    else
                    {
                        model.udate = Convert.ToDateTime(item.udate).ToString("dd-MM-yyyy  hh:mm tt");
                    }

                    modelList.Add(model);

                    rowNo++;
                }

                dgItemDetails.DataSource = modelList;
                lblTotalRows.Text        = modelList.Count.ToString();
            }
            catch (Exception x)
            {
                MessageBox.Show("Something went wrong. Contact your system administrator");
            }
        }
Beispiel #26
0
        private void frmVTaxSales_Load(object sender, EventArgs e)
        {
            dataGridView2.AutoGenerateColumns = false;
            clsView viewClass = new clsView();

            //viewClass.viewTaxSales(dataGridView1);

            _entities = new KBBQEntities();

            var cgstPer = _entities.tblTaxes.FirstOrDefault().tax_1;
            var sgstPer = _entities.tblTaxes.FirstOrDefault().tax_2;

            //   dataGridView2.Columns[4].HeaderText = "CGST( " + cgstPer.ToString().Substring(0, 4) + " %)";
            // dataGridView2.Columns[5].HeaderText = "( " + sgstPer.ToString().Substring(0, 4) + " %)";

            dataGridBind();
        }
Beispiel #27
0
        private void button2_Click(object sender, EventArgs e)
        {
            _entities = new KBBQEntities();

            orderInfo infoOrder = new orderInfo();

            infoOrder.txtWaiterName.Text = this.statGetUser.Text;
            infoOrder.txtTableNo.Text    = "0";
            infoOrder.hiddFashCash       = 1;
            //infoOrder.txtAdultNo.Text = "1";
            //infoOrder.txtChild.Text = "0";
            infoOrder.txtReceiptType.Text = "Fast Cash";
            infoOrder.orderType           = button2.Text;

            var empIDD = selectClass.getEmployeeByID(statGetUser.Text.ToString());

            infoOrder.cmbWaiter.SelectedText = this.statGetUser.Text;
            infoOrder.ShowDialog();
        }
        private void showData()
        {
            try
            {
                int rowNo = 1;
                _entities = new KBBQEntities();

                List <advBookingVM> modelList = new List <advBookingVM>();

                var advanceBookingData = _entities.tblAdvBookings.Where(x => x.id == passedId).ToList();

                foreach (var item in advanceBookingData)
                {
                    advBookingVM model = new advBookingVM();

                    model.id             = item.id;
                    model.rowNo          = rowNo;
                    model.adults         = item.adults;
                    model.child          = item.child;
                    model.custName       = item.custName;
                    model.mob            = item.mob;
                    model.advancePayment = item.advancePayment;
                    model.eventDate      = Convert.ToDateTime(item.eventDate).ToString("dd-MMM-yyyy");
                    model.totalPayment   = item.totalPayment;
                    model.status         = item.status;
                    model.udate          = item.udate;
                    model.cdate          = Convert.ToDateTime(item.cdate).ToString("dd-MMM-yyyy");
                    model.recptNo        = item.recptNo;
                    model.id             = item.id;

                    modelList.Add(model);
                }

                ReportDataSource datasource = new ReportDataSource("DataSet1", modelList);

                this.reportViewer1.LocalReport.DataSources.Clear();
                this.reportViewer1.LocalReport.DataSources.Add(datasource);
            }

            catch (Exception x)
            {
            }
        }
Beispiel #29
0
        void addPurchaseDetailsData()
        {
            foreach (DataGridViewRow dr in dgPurchaseItem.Rows)
            {
                if (Convert.ToString(dr.Cells[0].Value) != string.Empty)
                {
                    _entities = new KBBQEntities();

                    tbl_PurchaseDetails purchaseDetails = new tbl_PurchaseDetails();

                    purchaseDetails.purchaseID = _entities.tbl_PurchaseMaster.Where(x => x.refNo == txtRefNo.Text).FirstOrDefault().pId;
                    var gridItemCode = dr.Cells[1].Value.ToString();
                    purchaseDetails.productID   = _entities.purchaseProducts.Where(x => x.pName == gridItemCode).FirstOrDefault().id;
                    purchaseDetails.qty         = Convert.ToDecimal(dr.Cells[2].Value.ToString());
                    purchaseDetails.weight      = Convert.ToDecimal(dr.Cells[3].Value.ToString());
                    purchaseDetails.unit        = dr.Cells[4].Value.ToString();
                    purchaseDetails.rate        = Convert.ToDecimal(dr.Cells[5].Value.ToString());
                    purchaseDetails.createdDate = DateTime.Now;

                    _entities.tbl_PurchaseDetails.Add(purchaseDetails);
                    _entities.SaveChanges();

                    //Update Qty in stock

                    var itemQty = _entities.purchaseProducts.Where(x => x.id == purchaseDetails.productID).FirstOrDefault();

                    if (itemQty != null)
                    {
                        itemQty.qty   = itemQty.qty + purchaseDetails.qty;
                        itemQty.udate = DateTime.Now;
                    }
                    else
                    {
                        itemQty.qty   = purchaseDetails.qty;
                        itemQty.udate = DateTime.Now;
                    }


                    _entities.SaveChanges();
                }
            }
        }
Beispiel #30
0
        private void dgAdvBookingDetails_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dgAdvBookingDetails.CurrentRow.Index != -1 && dgAdvBookingDetails.CurrentRow.Cells[1].Value != null)
                {
                    var lID = Convert.ToInt32(dgAdvBookingDetails.CurrentRow.Cells[0].Value);

                    _entities = new KBBQEntities();
                    var seeData = _entities.tblAdvBookings.Where(x => x.id == lID).FirstOrDefault();

                    if (seeData != null)
                    {
                        if (seeData.status == "UNPAID")
                        {
                            txtCustName.Text    = seeData.custName.Trim().ToString();
                            txtMob.Text         = seeData.mob.ToString();
                            txtAdults.Text      = seeData.adults.ToString();
                            txtChild.Text       = seeData.child.ToString();
                            txtAdvPayment.Text  = seeData.advancePayment.ToString();
                            dtpBookingDate.Text = seeData.eventDate.ToString();



                            passedId       = seeData.id;
                            btnCreate.Text = "Update";
                        }
                        else
                        {
                            MessageBox.Show("Cannot able to update as payment is settled", "Error - King Bar beque Restaurant", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                    }
                }
            }
            catch (Exception x)
            {
                MessageBox.Show("Something went wrong. Contact your system administrator");
            }
        }