Ejemplo n.º 1
0
 public static void BindCompanyComboOnlyActive(ref ComboBox cbo, bool ALL)
 {
     bool UseNames = ConfigurationReader.ReadKeyBoolean(ConfigurationKeys.UseCompanyNames);
     Company item = new Company();
     DataTable dt = new DataTable();
     string valueMember = "CompanyId";
     string displayMember = "CompanyCode";
     if (UseNames)
         displayMember = "CompanyName";
     dt = item.SelectAllActiveCompanies();
     BindCombo(ref cbo, dt, displayMember, valueMember, ALL);
     if (cbo.Items.Count > 0)
         cbo.SelectedIndex = 0;
 }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
        private void GetData()
        {
            DataTable dt = null;
            dgvData.DataSource = dt;
            DateTime? startDate = dtpStartDate.Value;
            DateTime? endDate = dtpEndDate.Value;
            if (chkAllDates.Checked)
            {
                startDate = null;
                endDate = null;
            }
            string strId = string.IsNullOrEmpty(cbSelect.ValueMember) ? string.Empty : Convert.ToString(((DataRowView)(cbSelect.SelectedItem)).Row[cbSelect.ValueMember]);//Convert.ToString(cbSelect.SelectedValue);
            long Id = 0;
            if (long.TryParse(strId, out Id) && Id >= 0)
            {
                if (IsCutomerReport)
                {

                    FetchCustomerTransaction(dt, startDate, endDate, strId);
                }
                else
                {
                    Company comp = new Company();
                    dt = comp.SelectCompanyTransactions(Common.FormateDateForDB(startDate), Common.FormateDateForDB(endDate), strId);
                    dgvData.DataSource = dt;

                    dgvData.Columns["TransactionId"].Visible = false;
                    dgvData.Columns["TransactionDate"].HeaderText = "Date";
                    dgvData.Columns["TransactionDate"].DefaultCellStyle.Format = "dd-MM-yyyy HH:mm";
                    dgvData.Columns["Name"].HeaderText = "Supplier";

                    Common.FormatCurrencyColumn(dgvData, "Debit,Credit,Amount,Balance");
                }

                FormatGrid();
            }
            if (dt != null)
            {
                dgvData.DataSource = dt;
            }
        }
Ejemplo n.º 4
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);
     }
 }
Ejemplo n.º 5
0
        private void cbCompany_SelectedIndexChanged(object sender, EventArgs e)
        {
            lblCompanyName.Visible = true;
            Company comp = new Company();
            DataTable dt = null;

            string companyId = string.IsNullOrEmpty(cbCompany.ValueMember) ? string.Empty : Convert.ToString(((DataRowView)(cbCompany.SelectedItem)).Row[cbCompany.ValueMember]);
            if (!string.IsNullOrEmpty(companyId))
            {
                dt = comp.SelectCompanyById(companyId);
                lblCompanyName.Text = dt.Rows[0]["CompanyName"].ToString();
            }
        }