Пример #1
0
        private void cargarDatosTabla()
        {
            List <DetalleLibroCompras> lista = DetalleLibroComprasBLL.GetDetalleLibroComprasByIdLibro(idLibro);

            foreach (DetalleLibroCompras compra in lista)
            {
                Object[] row = { compra.pkRegistro, compra.intNro, compra.dateFechaFactura, compra.txtNitProeveedor, compra.txtNombreRazon, compra.txtNroFactura, compra.txtNroDUI, compra.txtNroAutorizacion, compra.decImporteTotal, compra.decImporteNOSujeto, compra.decSubTotal, compra.decDescuentos, compra.decImporteBaseCF, compra.decCreditoFiscal, compra.txtCodigoControl, compra.txtTipoCompra };
                gdDetalleLibroCompras.Rows.Add(row);
            }
            gdDetalleLibroCompras.Refresh();
        }
Пример #2
0
        private void frmReporteLibroCompra_Load(object sender, EventArgs e)
        {
            ;
            // TODO: This line of code loads data into the 'detalleLibroComprasDS.DetalleLibroCompras' table. You can move, or remove it, as needed.
            libro = LibroComprasBLL.GetLibroComprasById(idLibro);
            List <DetalleLibroCompras> detalles = DetalleLibroComprasBLL.GetDetalleLibroComprasByIdLibro(libro.pkLibro);
            ReportDataSource           dt       = new ReportDataSource("LC", detalles);
            ReportParameter            pYear    = new ReportParameter("Year", libro.txtAño);
            ReportParameter            pMonth   = new ReportParameter("Month", libro.txtMes);

            this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { pYear });
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter[] { pMonth });
            this.reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.LocalReport.DataSources.Add(dt);
            this.reportViewer1.RefreshReport();
        }
Пример #3
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (idLibro != 0)
     {
         foreach (DataGridViewRow fila in gdDetalleLibroCompras.Rows)
         {
             double total         = Convert.ToDouble(fila.Cells["txtImporteTotal"].Value);
             double noSujeto      = Convert.ToDouble(fila.Cells["txtImporteNOSujeto"].Value);
             double subtotal      = Convert.ToDouble(fila.Cells["txtSubTotal"].Value);
             double descuentos    = Convert.ToDouble(fila.Cells["txtDescuentos"].Value);
             double baseCF        = Convert.ToDouble(fila.Cells["txtImporteBaseCF"].Value);
             double creditoFiscal = Convert.ToDouble(fila.Cells["txtCreditoFiscal"].Value);
             if (fila.Cells["txtIdRegistro"].Value.ToString() != "-1")
             {
                 DetalleLibroComprasBLL.UpdateDetalle(Convert.ToInt32(fila.Cells["txtIdRegistro"].Value), Convert.ToInt32(fila.Cells["txtNro"].Value), Convert.ToDateTime(fila.Cells["dateFechaFactura"].Value), fila.Cells["txtNitProveedor"].Value.ToString(), fila.Cells["txtNombreRazon"].Value.ToString(), fila.Cells["txtNroFactura"].Value.ToString(), fila.Cells["txtNroDUI"].Value.ToString(), fila.Cells["txtNroAutorizacion"].Value.ToString(), Convert.ToDecimal(total), Convert.ToDecimal(noSujeto), Convert.ToDecimal(subtotal), Convert.ToDecimal(descuentos), Convert.ToDecimal(baseCF), Convert.ToDecimal(creditoFiscal), fila.Cells["txtCodigoControl"].Value.ToString(),
                                                      fila.Cells["txtTipoCompra"].Value.ToString(), idLibro, user);
             }
             else
             {
                 DetalleLibroComprasBLL.InsertDatosDetalleLibroCompras(Convert.ToInt32(fila.Cells["txtNro"].Value), Convert.ToDateTime(fila.Cells["dateFechaFactura"].Value), fila.Cells["txtNitProveedor"].Value.ToString(), fila.Cells["txtNombreRazon"].Value.ToString(), fila.Cells["txtNroFactura"].Value.ToString(), fila.Cells["txtNroDUI"].Value.ToString(), fila.Cells["txtNroAutorizacion"].Value.ToString(), Convert.ToDecimal(total), Convert.ToDecimal(noSujeto), Convert.ToDecimal(subtotal), Convert.ToDecimal(descuentos), Convert.ToDecimal(baseCF), Convert.ToDecimal(creditoFiscal), fila.Cells["txtCodigoControl"].Value.ToString(),
                                                                       fila.Cells["txtTipoCompra"].Value.ToString(), idLibro, user);
             }
         }
     }
     else
     {
         idLibro = LibroComprasBLL.InsertDatosLibroCompras(txtMonth.Text, txtYear.Text);
         foreach (DataGridViewRow fila in gdDetalleLibroCompras.Rows)
         {
             double total         = Convert.ToDouble(fila.Cells["txtImporteTotal"].Value);
             double noSujeto      = Convert.ToDouble(fila.Cells["txtImporteNOSujeto"].Value);
             double subtotal      = Convert.ToDouble(fila.Cells["txtSubTotal"].Value);
             double descuentos    = Convert.ToDouble(fila.Cells["txtDescuentos"].Value);
             double baseCF        = Convert.ToDouble(fila.Cells["txtImporteBaseCF"].Value);
             double creditoFiscal = Convert.ToDouble(fila.Cells["txtCreditoFiscal"].Value);
             DetalleLibroComprasBLL.InsertDatosDetalleLibroCompras(Convert.ToInt32(fila.Cells["txtNro"].Value), Convert.ToDateTime(fila.Cells["dateFechaFactura"].Value), fila.Cells["txtNitProveedor"].Value.ToString(), fila.Cells["txtNombreRazon"].Value.ToString(), fila.Cells["txtNroFactura"].Value.ToString(), fila.Cells["txtNroDUI"].Value.ToString(), fila.Cells["txtNroAutorizacion"].Value.ToString(), Convert.ToDecimal(total), Convert.ToDecimal(noSujeto), Convert.ToDecimal(subtotal), Convert.ToDecimal(descuentos), Convert.ToDecimal(baseCF), Convert.ToDecimal(creditoFiscal), fila.Cells["txtCodigoControl"].Value.ToString(),
                                                                   fila.Cells["txtTipoCompra"].Value.ToString(), idLibro, user);
         }
         MessageBox.Show("Se agregó correctamente el Libro de Compras");
     }
 }
Пример #4
0
 private void gdLibrosCompras_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == btnEditar.Index)
     {
         frmInsertarLibroCompras frm = new frmInsertarLibroCompras(Convert.ToInt32(gdLibrosCompras.Rows[e.RowIndex].Cells[0].Value), 1);
         frm.MdiParent   = this.MdiParent;
         frm.WindowState = FormWindowState.Maximized;
         frm.Show();
         this.Dispose();
     }
     if (e.ColumnIndex == btnExportar.Index)
     {
         FolderBrowserDialog sf = new FolderBrowserDialog();
         // Feed the dummy name to the save dialog
         DialogResult result = sf.ShowDialog();
         if (result == DialogResult.OK)
         {
             string savePath = sf.SelectedPath + "\\" + gdLibrosCompras.Rows[e.RowIndex].Cells[1].Value.ToString() + gdLibrosCompras.Rows[e.RowIndex].Cells[2].Value.ToString() + "LC.txt";
             using (StreamWriter writer = new StreamWriter(savePath, false))
             {
                 List <DetalleLibroCompras> detalles = DetalleLibroComprasBLL.GetDetalleLibroComprasByIdLibro(Convert.ToInt32(gdLibrosCompras.Rows[e.RowIndex].Cells[0].Value.ToString()));
                 foreach (DetalleLibroCompras detalle in detalles)
                 {
                     writer.WriteLine(detalle.intEspecificacion + "|" + detalle.intNro + "|" + detalle.dateFechaFactura.ToShortDateString() + "|" + detalle.txtNitProeveedor + "|" + detalle.txtNombreRazon + "|" + detalle.txtNroFactura + "|" +
                                      detalle.txtNroDUI + "|" + detalle.txtNroAutorizacion + "|" + detalle.decImporteTotal.ToString().Replace(',', '.') + "|" + detalle.decImporteNOSujeto.ToString().Replace(',', '.') + "|" + detalle.decSubTotal.ToString().Replace(',', '.') + "|" + detalle.decDescuentos.ToString().Replace(',', '.') + "|" +
                                      detalle.decImporteBaseCF.ToString().Replace(',', '.') + "|" + detalle.decCreditoFiscal.ToString().Replace(',', '.') + "|" + detalle.txtCodigoControl + "|" + detalle.txtTipoCompra + "\n");
                 }
             }
             MessageBox.Show("El archivo se guardó en la ruta " + savePath);
         }
     }
     if (e.ColumnIndex == btnImprimir.Index)
     {
         frmReporteLibroCompra frm = new frmReporteLibroCompra();
         frm.IdLibro     = Convert.ToInt32(gdLibrosCompras.Rows[e.RowIndex].Cells[0].Value);
         frm.MdiParent   = this.MdiParent;
         frm.WindowState = FormWindowState.Maximized;
         frm.Show();
         this.Dispose();
     }
 }