Esempio n. 1
0
 private void cmbVehiculo_TextChanged(object sender, EventArgs e)
 {
     try {
         txtPrecio.Text = VehiculoABM.precio_vehiculo(Convert.ToInt32(cmbVehiculo.SelectedValue.ToString()));
     } catch {
     }
 }
Esempio n. 2
0
        private void btn_anuluar_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("¿Seguro quieres ANULAR la venta N°" +
                                                        tbListaVentas.CurrentRow.Cells["Numero de Venta"].Value.ToString() + "?", "Anular", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                //do something
                try {
                    Venta Oventa = new Venta();
                    Oventa.Vta_Id = Convert.ToInt32(tbListaVentas.CurrentRow.Cells["Numero de Venta"].Value.ToString());
                    VentasABM.set_estado_venta(int.Parse(tbListaVentas.CurrentRow.Cells["Numero de Venta"].Value.ToString()), "ANULADA");
                    Vehiculo oVehiculo = new Vehiculo();
                    oVehiculo.Veh_ID     = Convert.ToInt32(tbListaVentas.CurrentRow.Cells["veh_ID"].Value.ToString());
                    oVehiculo.Veh_Estado = true;
                    VehiculoABM.venderVehiculo(oVehiculo);
                    MessageBox.Show("Venta Anulada!");
                    cargar();
                }
                catch (Exception a) {
                    MessageBox.Show("" + a);
                    MessageBox.Show("No se pudo Anular!");
                }
            }
            else if (dialogResult == DialogResult.No)
            {
                //do something else
            }
        }
Esempio n. 3
0
 private void Cargar()
 {
     dgvVehiculos.DataSource          = VehiculoABM.list_Vehiculos();
     dgvVehiculos.Columns[0].Visible  = false;
     dgvVehiculos.Columns[12].Visible = false;
     dgvVehiculos.Columns[13].Visible = false;
     dgvVehiculos.Columns[14].Visible = false;
     dgvVehiculos.Columns[15].Visible = false;
 }
Esempio n. 4
0
 private void btnVehiculos_Click(object sender, EventArgs e)
 {
     if (rbtnLinea.Checked)
     {
         dgvVehiculos.DataSource = VehiculoABM.list_Vehiculos_lm(1, txtBuscar.Text);
     }
     else
     {
         if (rbtnMarca.Checked)
         {
             dgvVehiculos.DataSource = VehiculoABM.list_Vehiculos_lm(0, txtBuscar.Text);
         }
     }
 }
Esempio n. 5
0
 private void eliminar(Vehiculo oVehiculo)
 {
     try
     {
         VehiculoABM.eliminarVehiculo(oVehiculo);
         MessageBox.Show("Vehiculo Eliminado!");
         Cargar();
     }
     catch (Exception a)
     {
         MessageBox.Show("" + a);
         MessageBox.Show("Vehiculo no Eliminado!");
     }
 }
Esempio n. 6
0
        private void agregar()
        {
            try
            {
                Vehiculo oVehiculo = new Vehiculo();

                oVehiculo.Veh_Matricula = txtMatricula.Text;
                oVehiculo.Lin_Id        = (int)cmbLinea.SelectedValue;
                oVehiculo.Veh_Modelo    = Convert.ToInt32(txtModelo.Text);
                oVehiculo.Veh_Color     = txtColor.Text;
                oVehiculo.Veh_Puerta    = Convert.ToInt32(txtPuertas.Text);
                if (chbGPS.Checked == true)
                {
                    oVehiculo.Veh_GPS = true;
                }
                else
                {
                    oVehiculo.Veh_GPS = false;
                }
                oVehiculo.Tip_ID     = int.Parse(cmb_tipo.SelectedValue.ToString());
                oVehiculo.Cls_ID     = int.Parse(cmb_clase.SelectedValue.ToString());
                oVehiculo.Veh_Precio = Convert.ToDecimal(txtPrecio.Text);
                oVehiculo.Veh_Estado = true;


                if (VehiculoABM.vehiculo_existente(oVehiculo.Veh_Matricula) == 0)
                {
                    VehiculoABM.insertVehiculo(oVehiculo);
                    MessageBox.Show("Vehiculo Registrado!");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Matricula Existente");
                }
            }
            catch (Exception a)
            {
                MessageBox.Show("" + a);
                MessageBox.Show("Vehiculo no Registrado!");
            }
        }
Esempio n. 7
0
 private void agregar()
 {
     try {
         Venta oVenta = new Venta();
         oVenta.Cli_Id          = (int)cmbCliente.SelectedValue;
         oVenta.Veh_Id          = (int)cmbVehiculo.SelectedValue;
         oVenta.Usr_Id          = (int)cmbVendedor.SelectedValue;
         oVenta.Vta_Fecha       = dtmFecha.Value;
         oVenta.Pag_Id          = cmbPago.SelectedValue.ToString();
         oVenta.Vta_PrecioFinal = Convert.ToDecimal(txtPrecio.Text);
         oVenta.Vta_Estado      = "PENDIENTE";
         VentasABM.insertVenta(oVenta);
         MessageBox.Show("Venta Registrada!");
         Vehiculo oVehiculo = new Vehiculo();
         oVehiculo.Veh_ID     = oVenta.Veh_Id;
         oVehiculo.Veh_Estado = false;
         VehiculoABM.venderVehiculo(oVehiculo);
         load_combo_vehiculos();
     } catch (Exception a) {
         MessageBox.Show("" + a);
         MessageBox.Show("Venta no Registrada!");
     }
 }
Esempio n. 8
0
 private void btnBuscar_Click(object sender, EventArgs e)
 {
     dgvVehiculos.DataSource = VehiculoABM.list_Vehiculos_lm(0, txtBuscar.Text);
 }
Esempio n. 9
0
        private void ExportarFacturaPDF(Document documento)
        {
            DataTable dtv = new DataTable();

            dtv = VehiculoABM.buscarID(int.Parse(tbListaVentas.CurrentRow.Cells["veh_ID"].Value.ToString()));
            string gps = "";

            if (dtv.Rows[0][9].ToString() == "False")
            {
                gps = "No";
            }
            else
            {
                gps = "Si";
            }

            DataTable dtc = new DataTable();

            dtc = ClienteABM.BuscarCliNyPD(tbListaVentas.CurrentRow.Cells["Cliente"].Value.ToString());

            DataTable dtu = new DataTable();

            dtu = UsuarioABM.buscarIDUsuario(int.Parse(tbListaVentas.CurrentRow.Cells["usu_ID"].Value.ToString()));

            BaseFont bf    = BaseFont.CreateFont(BaseFont.TIMES_ROMAN, BaseFont.CP1250, BaseFont.EMBEDDED);
            Font     arial = FontFactory.GetFont("Arial", 14, BaseColor.BLACK);

            iTextSharp.text.Font text = new iTextSharp.text.Font(bf, 10, iTextSharp.text.Font.NORMAL);

            iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance("logo-Agencia.png");

            //png.ScaleToFit(80f,50f);
            png.ScaleAbsoluteWidth(100f);
            png.ScaleAbsoluteHeight(80f);

            //-----------------TITULO---------------------------
            Paragraph encabezado = new Paragraph("Factura\n\n", arial);

            encabezado.Alignment = Element.ALIGN_CENTER;

            //---------------Espacio----------------------------
            Paragraph texto = new Paragraph("\n");

            //--------------Informacion Venta-------------------
            PdfPTable info = new PdfPTable(2);

            float[] cwinfo = { 6, 14 };
            info.DefaultCell.Padding             = 3;
            info.WidthPercentage                 = 100;
            info.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            info.DefaultCell.BorderWidth         = 0;
            info.SetWidths(cwinfo);
            //info.AddCell(new Phrase(" N° De Factura: " + nventa.ToString() + "\n " +
            //    "Fecha de Factura: " + DateTime.Now + "\n ", text));
            PdfPCell cellpng = new PdfPCell(png);

            cellpng.HorizontalAlignment = Element.ALIGN_CENTER;
            cellpng.BorderWidth         = 0;
            info.AddCell(cellpng);

            PdfPCell cellinfo = new PdfPCell(new Phrase(" N° De Factura: " + tbListaVentas.CurrentRow.Cells["Numero de Venta"].Value.ToString() + "\n " +
                                                        "Fecha de Factura: " + DateTime.Now + "\n\n " +
                                                        "--------------------------------------------------- \n\n" +
                                                        " Empresa: " + "Company Car" + "\n " +
                                                        "Vendedor: " + dtu.Rows[0][4].ToString()
                                                        , text));

            info.AddCell(cellinfo);

            //-------------Datos Cliente------------------
            PdfPTable tablaCliente = new PdfPTable(1);

            tablaCliente.DefaultCell.Padding             = 3;
            tablaCliente.WidthPercentage                 = 100;
            tablaCliente.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            tablaCliente.DefaultCell.BorderWidth         = 1;

            PdfPCell cellcli = new PdfPCell(new Phrase("Cliente", text));

            cellcli.BackgroundColor     = new iTextSharp.text.BaseColor(192, 192, 192);
            cellcli.HorizontalAlignment = Element.ALIGN_CENTER;
            tablaCliente.AddCell(cellcli);

            tablaCliente.AddCell(new Phrase("Nombre: " + dtc.Rows[0][1].ToString() + "\n" +
                                            "Apellido: " + dtc.Rows[0][2].ToString() + "\n" +
                                            "DNI: " + dtc.Rows[0][0].ToString() + "\n" +
                                            "Direccion: " + dtc.Rows[0][3].ToString() + "\n" +
                                            "Telefono: " + dtc.Rows[0][4].ToString(), text));
            //------------Datos Veh------------------
            PdfPTable tablaVeh = new PdfPTable(1);

            tablaVeh.DefaultCell.Padding             = 3;
            tablaVeh.WidthPercentage                 = 100;
            tablaVeh.DefaultCell.HorizontalAlignment = Element.ALIGN_LEFT;
            tablaVeh.DefaultCell.BorderWidth         = 1;

            PdfPCell cellveh = new PdfPCell(new Phrase("Vehiculo", text));

            cellveh.BackgroundColor     = new iTextSharp.text.BaseColor(192, 192, 192);
            cellveh.HorizontalAlignment = Element.ALIGN_CENTER;
            tablaVeh.AddCell(cellveh);

            tablaVeh.AddCell(new Phrase("Matricula: " + dtv.Rows[0][1].ToString() + "             " +
                                        "Modelo: " + dtv.Rows[0][2].ToString() + "\n" +
                                        "Marca: " + dtv.Rows[0][3].ToString() + "                       " +
                                        "Linea: " + dtv.Rows[0][4].ToString() + "\n" +
                                        "Puertas: " + dtv.Rows[0][8].ToString() + "        " +
                                        "Color: " + dtv.Rows[0][7].ToString() + "        " +
                                        "Gps: " + gps, text));
            //-------------Importe----------------
            float[]   columwidth = { 16, 4 };
            PdfPTable tablaImp   = new PdfPTable(2);

            tablaImp.DefaultCell.Padding             = 3;
            tablaImp.WidthPercentage                 = 100;
            tablaImp.DefaultCell.HorizontalAlignment = Element.ALIGN_RIGHT;
            tablaImp.DefaultCell.BorderWidth         = 1;
            tablaImp.SetWidths(columwidth);

            PdfPCell cellimp = new PdfPCell(new Phrase("Importe: ", text));

            cellimp.BackgroundColor     = new iTextSharp.text.BaseColor(133, 185, 241);
            cellimp.HorizontalAlignment = Element.ALIGN_RIGHT;
            tablaImp.AddCell(cellimp);
            tablaImp.AddCell(new Phrase("$" + tbListaVentas.CurrentRow.Cells["Precio Final"].Value.ToString(), text));

            documento.Add(encabezado);
            documento.Add(info);
            documento.Add(texto);
            documento.Add(tablaCliente);
            documento.Add(texto);
            documento.Add(tablaVeh);
            documento.Add(tablaImp);
        }
Esempio n. 10
0
 private void load_combo_vehiculos()
 {
     cmbVehiculo.DisplayMember = "veh_datos";
     cmbVehiculo.ValueMember   = "veh_id";
     cmbVehiculo.DataSource    = VehiculoABM.list_Vehiculos_disponible();
 }
Esempio n. 11
0
 private void load_combo_clase()
 {
     cmb_clase.DisplayMember = "cla_Descripcion";
     cmb_clase.ValueMember   = "cla_ID";
     cmb_clase.DataSource    = VehiculoABM.list_clase();
 }
Esempio n. 12
0
 private void load_combo_tipo()
 {
     cmb_tipo.DisplayMember = "tip_Tipo";
     cmb_tipo.ValueMember   = "tip_ID";
     cmb_tipo.DataSource    = VehiculoABM.list_tipo();
 }