private void Initialize(bool isPurchase)
        {
            InitializeComponent();
            IsPurchase = isPurchase;
            item = new Item();
            company = new Company();
            customer = new Customer();
            if (flag == 3)
            {
                report = Report.BuyerLedger;
                SetReports();
                cbReport.SelectedIndex = 3;
            }
            else if (flag == 2)
            {
                report = Report.ProductSaleReport;
                SetReports();
                cbReport.SelectedIndex = 2;

            }
            else if (flag == 1)
            {
                report = Report.ProductPurchaseReport;
                SetReports();
                cbReport.SelectedIndex = 1;
            }
            else if (flag == 0)
            {
                report = Report.CustomerSalesReport;
                SetReports();
                cbReport.SelectedIndex = 0;
            }
        }
Example #2
0
 public static void BindCustomerComboOnlyActive(ref ComboBox cbo, bool ALL)
 {
     bool UseNames = ConfigurationReader.ReadKeyBoolean(ConfigurationKeys.UseCustomerNames);
     Customer obj = new Customer();
     DataTable dt = new DataTable();
     string valueMember = "CustomerId";
     //string displayMember = "SupplierCode";
     string displayMember = "CustomerCode";
     if (UseNames)
         //displayMember = "SupplierName";
       displayMember = "CustomerName";
     dt = obj.SelectAllActiveCustomer();
     BindCombo(ref cbo, dt, displayMember, valueMember, ALL);
     if (cbo.Items.Count > 0)
         cbo.SelectedIndex = 0;
 }
Example #3
0
 void Initialize(bool isCustomer)
 {
     IsCustomer = isCustomer;
     customer = new Customer();
     company = new Company();
     //cbCustomersSuppliers.Items.Clear();
     cbCustomersSuppliers.DataSource = null;
     if (IsCustomer)
     {
         Common.BindCustomerComboOnlyActive(ref cbCustomersSuppliers, false);
     }
     else
     {
         Common.BindCompanyComboOnlyActive(ref cbCustomersSuppliers, false);
     }
 }
 private void FetchCustomerTransaction(DataTable dt, DateTime? startDate, DateTime? endDate, string strId)
 {
     Customer customer = new Customer();
     dt = customer.SelectCustomerTransactions(Common.FormateDateForDB(startDate), Common.FormateDateForDB(endDate), strId);
     dgvData.DataSource = dt;
     Common.FormatCurrencyColumn(dgvData, "Debit,Credit,Balance");
     //return dt;
 }
Example #5
0
 void PopulateCustomer()
 {
     //try
     //{
     string value = string.IsNullOrEmpty(cbCustomer.ValueMember) ? string.Empty : cbCustomer.SelectedItem == null ? string.Empty : Convert.ToString(((DataRowView)(cbCustomer.SelectedItem)).Row[cbCustomer.ValueMember]);//Convert.ToString(cbCustomer.SelectedValue);
     string text = Convert.ToString(cbCustomer.Text);
     if (value != text)
     {
         int customerId = 0;
         int.TryParse(string.IsNullOrEmpty(cbCustomer.ValueMember) ? string.Empty : cbCustomer.SelectedItem == null ? string.Empty : Convert.ToString(((DataRowView)(cbCustomer.SelectedItem)).Row[cbCustomer.ValueMember]), out customerId);
         if (customerId == 0)
             customerId = 1;
         Customer customer = new Customer();
         DataTable dt = customer.SelectCustomerById(customerId.ToString());
         if (dt != null)
         {
             lblCustomerName.Text = Convert.ToString(dt.Rows[0]["CustomerName"]);
             lblAddress.Text = Convert.ToString(dt.Rows[0]["Address"]);
             lblCustomerBalance.Text = Convert.ToDouble(dt.Rows[0]["CustomerBalance"]).ToString("#0.00");
         }
     }
     //}
     //catch (Exception ex)
     //{
     //    ExceptionLog.LogException(Modules.POS, "PopulateCustomer", ex);
     //}
 }
Example #6
0
        private void chkCash_CheckedChanged(object sender, EventArgs e)
        {
            if (Common.IsCashAddressRequired)
            {
                cbCustomer.Visible = !chkCash.Checked;
                lblNameCaption.Visible = !chkCash.Checked;
                lblCustomerName.Visible = !chkCash.Checked;
                lblAddress.Visible = !chkCash.Checked;
                lblAddressHeading.Visible = !chkCash.Checked;

                lblCashAddress.Visible = chkCash.Checked;
                txtCashAddress.Visible = chkCash.Checked;
                txtCashName.Visible = chkCash.Checked;
                txtCashName.Text = string.Empty;
                txtCashAddress.Text = string.Empty;
                lblCustomerBalance.Visible = !chkCash.Checked;
                if (chkCash.Checked)
                {
                    Customer customer = new Customer();
                    DataTable dtCustomer = customer.SelectCustomerByCode("CASH");
                    txtCashName.Focus();
                    if (dtCustomer != null && dtCustomer.Rows.Count > 0)
                    {
                        txtCashName.Text = Convert.ToString(dtCustomer.Rows[0]["CustomerName"]);
                        txtCashAddress.Text = Convert.ToString(dtCustomer.Rows[0]["Address"]);
                    }

                }

            }
        }
Example #7
0
        private void btnDone_Click(object sender, EventArgs e)
        {
            try
            {
                string Id = string.Empty;
                if (chkCash.Checked)
                {
                    Customer customer = new Customer();
                    DataTable dtCustomer = customer.SelectCustomerByCode("CASH");

                    if (dtCustomer != null && dtCustomer.Rows.Count > 0)
                    {
                        Id = Convert.ToString(dtCustomer.Rows[0]["CustomerId"]);
                        string balance = Convert.ToString(dtCustomer.Rows[0]["CustomerBalance"]);
                        customer.InsertUpdateCustomer(Id, "CASH", txtCashName.Text, string.Empty, txtCashAddress.Text, balance, "1", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty);
                    }
                    else
                    {
                        Id = "0";
                        if (customer.InsertUpdateCustomer(Id, "CASH", txtCashName.Text, string.Empty, txtCashAddress.Text, "0.00", "1", string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty))
                        {
                            dtCustomer = customer.SelectCustomerByCode("CASH");
                            Id = Convert.ToString(dtCustomer.Rows[0]["CustomerId"]);
                        }
                    }
                }
                else if (cbCustomer.Text.ToLower() == "cash")
                {
                    MessageBox.Show("To make a cash sale, CASH checkbox must be checked.");
                    chkCash.Checked = true;
                    return;
                }
                Save(Id);
            }
            catch (Exception ex)
            {
                ExceptionLog.LogException(Modules.POS, "Save", ex, "POS Exception");
            }
        }