private void buttonCancelSale_Click(object sender, EventArgs e) { int id; if (txtNumericSale.Text != "") { var result = MessageBox.Show("¿Desea anular Venta?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { id = Convert.ToInt32(txtNumericSale.Text); WorkSales.updateStateSale(id); grdSales.DataSource = WorkSales.getAllSalesSP(); txtNumericSale.Text = ""; } } else { if (grdSales.SelectedRows.Count > 0) { var result = MessageBox.Show("¿Desea anular Venta?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { id = Convert.ToInt32(grdSales.CurrentRow.Cells["Id de la Venta"].Value.ToString()); WorkSales.updateStateSale(id); grdSales.DataSource = WorkSales.getAllSalesSP(); } } else { MessageBox.Show("Seleccione una fila!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void btnSearchFilter_Click(object sender, EventArgs e) { if (comboBoxListSearch.SelectedItem.ToString() == "Fecha") { grdSales.DataSource = WorkSales.getSaleByDate(dateTimePickerFirst.Value, dateTimePickerLast.Value); showSalesDateInfo(dateTimePickerFirst.Value, dateTimePickerLast.Value); } if (comboBoxListSearch.SelectedItem.ToString() == "Marca") { grdSales.DataSource = WorkSales.getSaleByBrand(cmbBrand.SelectedItem.ToString()); showSalesBrandInfo(cmbBrand.SelectedItem.ToString()); } if (comboBoxListSearch.SelectedItem.ToString() == "Vendedor") { grdSales.DataSource = WorkSales.getSaleByUser(cmbVendedor.SelectedItem.ToString()); showSalesUserInfo(cmbVendedor.SelectedItem.ToString()); } if (comboBoxListSearch.SelectedItem.ToString() == "Cliente") { grdSales.DataSource = WorkSales.getSaleByCustomer(cmbClientes.SelectedItem.ToString()); showSalesCustomerInfo(cmbClientes.SelectedItem.ToString()); } }
private void buttonFilterState_Click(object sender, EventArgs e) { labelCountAnuladas.Visible = false; labelCountAcitves.Visible = false; labelImportTotalAcitve.Visible = false; labelImportTotalAnuladas.Visible = false; labelCountSales.Visible = true; labelImportTotal.Visible = true; if (cmbStateFilter.SelectedItem.ToString() == "Activa") { grdSales.DataSource = WorkSales.getAllSalesState("ACTIVA"); labelCountSales.Text = "Cantidad de Ventas: " + WorkSales.getAllSalesStateQuantity("ACTIVA"); labelImportTotal.Text = "Importe Total: $" + WorkSales.getSalesStateImportTotal("ACTIVA"); } if (cmbStateFilter.SelectedItem.ToString() == "Anulado") { grdSales.DataSource = WorkSales.getAllSalesState("ANULADA"); labelCountSales.Text = "Cantidad de Ventas: " + WorkSales.getAllSalesStateQuantity("ANULADA"); labelImportTotal.Text = "Importe Total: $" + WorkSales.getSalesStateImportTotal("ANULADA"); } }
public void showSalesUserInfo(string userName) { hideSalesInfo(); labelCountSales.Visible = true; labelCountSales.Text = "Cantidad de Ventas: " + WorkSales.getCountSaleByUser(userName); labelImportTotal.Visible = true; labelImportTotal.Text = "Total Importe: " + WorkSales.getImportTotalSaleByUser(userName); }
public void showSalesCustomerInfo(string customer) { hideSalesInfo(); labelCountSales.Visible = true; labelCountSales.Text = "Cantidad de Compras del Cliente: " + WorkSales.getCountSaleByCustomer(customer); labelImportTotal.Visible = true; labelImportTotal.Text = "Total Importe: $" + WorkSales.getImportTotalSaleByCustomer(customer); }
public void showSalesBrandInfo(string brand) { hideSalesInfo(); labelCountSales.Visible = true; labelCountSales.Text = "Cantidad de Ventas: " + WorkSales.getCountSaleByBrand(brand); labelImportTotal.Visible = true; labelImportTotal.Text = "Total Importe: $" + WorkSales.getImportTotalSaleByBrand(brand); }
public void showSalesDateInfo(DateTime dtpFirstDate, DateTime dtpLastDate) { hideSalesInfo(); labelCountSales.Visible = true; labelCountSales.Text = "Cantidad de Ventas: " + WorkSales.getCountSaleByDate(dtpFirstDate, dtpLastDate); labelImportTotal.Visible = true; labelImportTotal.Text = "Total Importe: $" + WorkSales.getImportTotalSaleByDate(dtpFirstDate, dtpLastDate); }
private void btnSeeAllSales_Click(object sender, EventArgs e) { grdSales.DataSource = WorkSales.getAllSalesSP(); comboBoxListSearch.Text = "Buscar por"; btnSearch.Enabled = false; //setAllItemsStatus(); disableControlls(); showSalesInfo(); }
public void loadPayMethods() { comboBoxPaymentMethod.DisplayMember = "Descripcion"; comboBoxPaymentMethod.ValueMember = "Id"; comboBoxPaymentMethod.DataSource = WorkSales.getAllWaysToPays(); /*var items = new[] { * new { Text = "Efectivo", Value = "Efectivo" }, * new { Text = "Tarjeta", Value = "Tarjeta" }, * new { Text = "Cheque", Value = "Cheque" } * }; * * comboBoxPaymentMethod.DataSource = items;*/ }
public void showSalesInfo() { labelCountSales.Visible = true; labelCountSales.Text = "Ventas Realizadas: " + WorkSales.getAllSalesQuantity(); labelCountAnuladas.Visible = true; labelCountAnuladas.Text = "Ventas Anuladas: " + WorkSales.getAllSalesStateQuantity("ANULADA"); labelCountAcitves.Visible = true; labelCountAcitves.Text = "Ventas Activas: " + WorkSales.getAllSalesStateQuantity("ACTIVA"); labelImportTotal.Visible = true; labelImportTotal.Text = "Importe Total: $" + WorkSales.getSalesImportTotal(); labelImportTotalAnuladas.Visible = true; labelImportTotalAnuladas.Text = "Importe Total Ventas Anulada: $" + WorkSales.getSalesStateImportTotal("ANULADA"); labelImportTotalAcitve.Visible = true; labelImportTotalAcitve.Text = "Importe Total Ventas Activas: $" + WorkSales.getSalesStateImportTotal("ACTIVA"); }
private void ListSalesForm_Load(object sender, EventArgs e) { DataRowCollection dataUser = WorkSales.getUsersByRol().Rows; foreach (DataRow row in dataUser) { cmbVendedor.Items.Add(row["usu_apellido_nombre"].ToString()); } grdSales.DataSource = WorkSales.getAllSalesSP(); SetDataTimePicker(); comboBoxListSearch.Text = "Buscar por"; setCmbCustomer(); showSalesInfo(); disableControlls(); }
private void btnInsertSale_Click(object sender, EventArgs e) { Sale sale = new Sale(); var result = MessageBox.Show("¿Desea registrar la venta?", "Confirmación", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { sale.Date = dateTimePickerDate.Value; //sale.PaymentMethod = (string)comboBoxPaymentMethod.SelectedValue; sale.idPaymentMethod = Convert.ToInt32(comboBoxPaymentMethod.SelectedValue); sale.FinalPrice = Convert.ToDecimal(textBoxPriceTotal.Text); sale.CustomerID = Convert.ToInt32(comboBoxCustomer.SelectedValue); sale.VehicleID = Convert.ToInt32(comboBoxVehicle.SelectedValue); sale.UserId = currentUser.Id; sale.State = "ACTIVA"; WorkSales.insertarVenta(sale); WorkVehicle.updateVehicleState(sale.VehicleID); MessageBox.Show("Se registro correctamente la venta", "Informacion", MessageBoxButtons.OK, MessageBoxIcon.Information); clear(); this.Hide(); } }
public void loadVehicles() { comboBoxVehicle.DisplayMember = "Matricula"; comboBoxVehicle.ValueMember = "Id"; comboBoxVehicle.DataSource = WorkSales.getAllVehicles(); }
public void loadCustomers() { comboBoxCustomer.DisplayMember = "Dni"; comboBoxCustomer.ValueMember = "Id"; comboBoxCustomer.DataSource = WorkSales.getAllCustomers(); }