예제 #1
0
        private Facturas LlenaClase()
        {
            Facturas facturas = new Facturas();

            facturas.FacturaId = Convert.ToInt32(IdnumericUpDown.Value);
            facturas.ClienteId = Convert.ToInt32(ClientecomboBox.SelectedValue);
            facturas.Fecha     = FechadateTimePicker.Value;
            facturas.Subtotal  = Convert.ToDecimal(SubtotaltextBox.Text);
            facturas.ITBIS     = Convert.ToDecimal(ITBIStextBox.Text);
            facturas.Total     = Convert.ToDecimal(TotaltextBox.Text);


            foreach (DataGridViewRow item in DetalledataGridView.Rows)
            {
                facturas.AgregarDetalle
                    (ToInt(item.Cells["id"].Value),
                    facturas.FacturaId,
                    ToInt(item.Cells["ProductoId"].Value),
                    ToInt(item.Cells["cantidad"].Value),
                    Convert.ToDecimal(item.Cells["precio"].Value),
                    Convert.ToInt32(item.Cells["Importe"].Value)
                    );
            }
            return(facturas);
        }
예제 #2
0
        private Facturas LlenaClase()
        {
            Facturas Factura = new Facturas();

            Factura.FacturaId = Convert.ToInt32(IdnumericUpDown.Value);
            Factura.ClienteId = Convert.ToInt32(ClientecomboBox.SelectedValue);
            Factura.Fecha     = FechadateTimePicker.Value;
            Factura.SubTotal  = Convert.ToDecimal(SubtotaltextBox.Text);
            Factura.ITBIS     = Convert.ToDecimal(ITBIStextBox.Text);
            Factura.Total     = Convert.ToDecimal(TotaltextBox.Text);
            Factura.Recibido  = Convert.ToDecimal(RecibidotextBox.Text);
            Factura.Devuelta  = Convert.ToDecimal(RecibidotextBox.Text) - Convert.ToDecimal(TotaltextBox.Text);


            foreach (DataGridViewRow item in DetalledataGridView.Rows)
            {
                Factura.AgregarDetalle
                    (ToInt(item.Cells["id"].Value),
                    Factura.FacturaId,
                    ToInt(item.Cells["usuarioId"].Value),
                    ToInt(item.Cells["ropaId"].Value),
                    ToInt(item.Cells["cantidad"].Value),
                    ToInt(item.Cells["precio"].Value),
                    ToInt(item.Cells["importe"].Value),
                    Convert.ToString(item.Cells["ropa"].Value),
                    ToInt(item.Cells["clienteId"].Value)



                    );
            }
            return(Factura);
        }
예제 #3
0
        public Facturas LlenarClase()
        {
            Facturas facturas = new Facturas();

            facturas.FacturaId = Convert.ToInt32(FactIdNumericUpDown.Value);
            facturas.ClienteId = Convert.ToInt32(ClienteComboBox.SelectedValue);
            facturas.Fecha     = FechaDateTimePicker.Value;
            facturas.Total     = Convert.ToInt32(TotaltextBox.Text);

            foreach (DataGridViewRow item in FDetalleDataGridView.Rows)
            {
                facturas.AgregarDetalle(ToInt(item.Cells["FactDetalleId"].Value),
                                        facturas.FacturaId, ToInt(item.Cells["ClienteId"].Value),
                                        ToInt(item.Cells["PeliculaId"].Value),
                                        Convert.ToString(item.Cells["Pelicula"].Value),
                                        ToInt(item.Cells["Cantidad"].Value),
                                        ToInt(item.Cells["Precio"].Value),
                                        ToInt(item.Cells["Importe"].Value));
            }
            return(facturas);
        }
예제 #4
0
        protected void LinkButton_Click(object sender, EventArgs e)
        {
            if (IsValid)
            {
                /*if (FacturaGridView.Rows.Count != 0)
                 * {
                 *  factura.Detalles = (List<FacturasDetalles>)ViewState["FDetalle"];
                 *
                 * }
                 *
                 * var facturas = FacturaRepositorio.Buscar(Utils.ToInt(FacturaIdTextBox.Text));
                 *
                 * if(facturas == null)
                 * {
                 *   if(factura.Detalles.Exists(x=> x.ProductoId.Equals(Utils.ToInt(ProductoDropDownList.SelectedValue))))
                 *   {
                 *       var producto = factura.Detalles.Where(x => x.ProductoId.Equals(Utils.ToInt(ProductoDropDownList.SelectedValue)));
                 *
                 *   }
                 *
                 *   if (((FacturasDetalles)ViewState["Detalle"]).Id != 0)
                 *   {
                 *       factura.Detalles.Add(new FacturasDetalles(((FacturasDetalles)ViewState["Detalle"]).Id, Utils.ToInt(FacturaIdTextBox.Text), Utils.ToInt(ProductoDropDownList.SelectedValue), ProductoDropDownList.Text, Utils.ToInt(CantidadTextBox.Text), Utils.ToDecimal(PrecioTextBox.Text), Utils.ToDecimal(ImporteTextBox.Text)));
                 *   }
                 *   else
                 *       factura.Detalles.Add(new FacturasDetalles(0, Utils.ToInt(FacturaIdTextBox.Text), Utils.ToInt(ProductoDropDownList.SelectedValue), ProductoDropDownList.SelectedItem.ToString(), Utils.ToInt(CantidadTextBox.Text), Utils.ToDecimal(PrecioTextBox.Text), Utils.ToDecimal(ImporteTextBox.Text)));
                 *   ViewState["Detalle"] = new FacturasDetalles();
                 * }
                 * else
                 * {
                 *   factura.Detalles.Add(new FacturasDetalles(0, Utils.ToInt(FacturaIdTextBox.Text), Utils.ToInt(ProductoDropDownList.SelectedValue), ProductoDropDownList.SelectedItem.ToString(), Utils.ToInt(CantidadTextBox.Text), Utils.ToDecimal(PrecioTextBox.Text), Utils.ToDecimal(ImporteTextBox.Text)));
                 *   ViewState["Detalle"] = factura.Detalles;
                 * }
                 * //SubTotal();
                 * FacturaGridView.DataSource = ViewState["Detalle"];
                 * FacturaGridView.DataBind();*/


                var facturaAnt = FacturaRepositorio.Buscar(Utils.ToInt(FacturaIdTextBox.Text));

                if (facturaAnt == null)
                {
                    Utils.MostrarMensaje(this, "Agregado", "Exito!!", "info");
                    factura = (Facturas)ViewState["Factura"];
                    factura.AgregarDetalle(0, Utils.ToInt(FacturaIdTextBox.Text), Utils.ToInt(ProductoDropDownList.SelectedValue), ProductoDropDownList.SelectedItem.ToString(), Utils.ToInt(CantidadTextBox.Text), Utils.ToDecimal(PrecioTextBox.Text), Utils.ToDecimal(ImporteTextBox.Text));
                }
                else
                {
                    Utils.MostrarMensaje(this, "Agregado", "Exito!!", "info");
                    facturaAnt = (Facturas)ViewState["Modificar"];
                    facturaAnt.Detalles.Add(new FacturasDetalles(0, Utils.ToInt(FacturaIdTextBox.Text), Utils.ToInt(ProductoDropDownList.SelectedValue), ProductoDropDownList.SelectedItem.ToString(), Utils.ToInt(CantidadTextBox.Text), Utils.ToDecimal(PrecioTextBox.Text), Utils.ToDecimal(ImporteTextBox.Text)));
                    //factura.AgregarDetalle(0, Utils.ToInt(FacturaIdTextBox.Text), Utils.ToInt(ProductoDropDownList.SelectedValue), ProductoDropDownList.SelectedItem.ToString(), Utils.ToInt(CantidadTextBox.Text), Utils.ToDecimal(PrecioTextBox.Text), Utils.ToDecimal(ImporteTextBox.Text));
                }
                ViewState["Factura"] = factura;
                this.BindGrid();
                SubTotal();

                //aqui

                /*Utils.MostrarMensaje(this, "Agregado", "Exito!!", "info");
                 *   factura = (Facturas)ViewState["Factura"];
                 *   factura.AgregarDetalle(0, Utils.ToInt(FacturaIdTextBox.Text), Utils.ToInt(ProductoDropDownList.SelectedValue), ProductoDropDownList.SelectedItem.ToString(), Utils.ToInt(CantidadTextBox.Text), Utils.ToDecimal(PrecioTextBox.Text), Utils.ToDecimal(ImporteTextBox.Text));
                 *
                 *   ViewState["Factura"] = factura;
                 *   this.BindGrid();
                 *   SubTotal();*/
                //aqui nitido



                /*detalles.Add(new FacturasDetalles(
                 *  id: 0,
                 *  facturaId: Utils.ToInt(FacturaIdTextBox.Text),
                 *  productoId: Utils.ToInt(ProductoDropDownList.SelectedValue),
                 *  descripcion: ProductoDropDownList.Text,
                 *  cantidad: Utils.ToInt(CantidadTextBox.Text),
                 *  precio: Utils.ToDecimal(PrecioTextBox.Text),
                 *  importe: Utils.ToDecimal(ImporteTextBox.Text)
                 *  ));*/

                //SubTotal();
            }
        }