inserta cuenta
This commit is contained in:
@@ -448,6 +448,7 @@ namespace compabetov2
|
||||
private void ImprimirContenido(PrintPageEventArgs e)
|
||||
{
|
||||
|
||||
string responsable = responsablecb.SelectedItem.ToString();
|
||||
// Contenido que deseas imprimir
|
||||
string contenido = " Mini Súper\n" +
|
||||
" Compa BETO\n" +
|
||||
@@ -455,7 +456,9 @@ namespace compabetov2
|
||||
" Lomas de la Laguna\n" +
|
||||
" 311 169 2829\n" +
|
||||
$" Fecha: {DateTime.Now.ToString("dd/MM/yyyy")}\n" +
|
||||
$" Hora: {DateTime.Now.ToString("hh:mm:ss")}\n\n" +
|
||||
$" Hora: {DateTime.Now.ToString("hh:mm:ss")}\n" +
|
||||
$" Atendió:\n " +
|
||||
$" {responsable}\n" +
|
||||
"Producto | Precio | Cantidad\n" +
|
||||
"------------------------------------\n";
|
||||
|
||||
@@ -583,5 +586,65 @@ namespace compabetov2
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void btnFiar_Click(object sender, EventArgs e)
|
||||
{
|
||||
List<DetalleCuentaModel> detallesCuenta = listaProductosCuenta();
|
||||
|
||||
if (detallesCuenta.Count > 0)
|
||||
{
|
||||
Cuenta ventaModel = new Cuenta(total);
|
||||
|
||||
if (service.crearCuenta(ventaModel, detallesCuenta))
|
||||
{
|
||||
MessageBox.Show("Fiado");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("No hay ningun producto agregado");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<DetalleCuentaModel> listaProductosCuenta()
|
||||
{
|
||||
List<DetalleCuentaModel> detallesCuentas = new List<DetalleCuentaModel>();
|
||||
int contador_saltar_2_vueltas = 1;
|
||||
foreach (var item in flowLayoutPanel2.Controls)
|
||||
{
|
||||
if (contador_saltar_2_vueltas <= 3)
|
||||
{
|
||||
contador_saltar_2_vueltas++;
|
||||
continue;
|
||||
}
|
||||
TableLayoutPanel panelProducto = item as TableLayoutPanel;
|
||||
TableLayoutPanel panelInfo = panelProducto.Controls[1] as TableLayoutPanel;
|
||||
PictureBox pic = panelProducto.Controls[0] as PictureBox;
|
||||
Label idLabel = null;
|
||||
foreach (Control control in pic.Controls)
|
||||
{
|
||||
if (control is Label)
|
||||
{
|
||||
idLabel = (Label)control;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int idProducto = int.Parse(idLabel.Text);
|
||||
Producto producto = new Producto(idProducto);
|
||||
|
||||
Label Lbcantidad = panelInfo.Controls[2] as Label;
|
||||
string textcantidad = Lbcantidad.Text;
|
||||
string[] cantidadCadenas = textcantidad.Split(' ');
|
||||
int cantidad = int.Parse(cantidadCadenas[1]);
|
||||
|
||||
DetalleCuentaModel detalleCuenta = new DetalleCuentaModel(producto, cantidad);
|
||||
|
||||
|
||||
detallesCuentas.Add(detalleCuenta);
|
||||
}
|
||||
|
||||
return detallesCuentas;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user