Пример #1
0
        public void Imprimir(int iReciboId, BO.DAL.dsDatos.DatosPagoDataTable oDatosPago, bool pbImpreso = false)
        {
            //bool bError = false;
            PrinterResponses response;

            // dsFacturaBindingSource.DataSource = CargarDataSet();
            BO.DAL.dsFactura.FACTURASDataTable dtFatura = new BO.DAL.dsFactura.FACTURASDataTable();
            // DataTable dt = new DataTable();
            dtFatura = CargarDataSetFiscal(iReciboId);
            //dt.TableName = "FACTURAS";
            BO.Models.Terminal oTerm = new BO.Models.Terminal();
            oTerm = unitOfWork.TerminalRepository.GetByID(Parametros.ParametrosSucursal.TermFiscalId);
            if (oTerm != null)
            {
                Printer oPrinter = new Printer(oTerm);
                oPrinter.SetInvoiceData(dtFatura, oDatosPago, !pbImpreso, 1);
                response = oPrinter.Print();
                if (response == PrinterResponses.Success)
                {
                    var oRecibos = unitOfWork.RecibosRepository.GetByID(iReciboId);
                    oRecibos.IMPRESO = true;
                    unitOfWork.RecibosRepository.Update(oRecibos);
                    unitOfWork.Save();
                }
                else
                {
                    MessageBox.Show(Printer.GetPrinterReturnMessage(response), "Aviso", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }

            //dsFacturas.Tables.Add(dt);
        }
        void MoverDatos(BO.Models.Terminal MyComp)
        {
            //else if(ctr.Tag == MyComp.COM_DESCRIPCION)
            foreach (Control ctr in tabPage2.Controls)
            {
                if (ctr.Tag == null)
                {
                    continue;
                }


                switch (ctr.Tag.ToString())
                {
                case "TERM_ID":
                    ctr.Text = MyComp.TERM_ID.ToString();
                    break;

                case "TERM_DESC":
                    ctr.Text = MyComp.TERM_DESC.ToString();
                    break;

                case "SERIAL":
                    ctr.Text = MyComp.SERIAL.ToString();
                    break;

                case "PUERTO":
                    ctr.Text = MyComp.PUERTO.ToString();
                    break;
                }
            }
        }
Пример #3
0
        public void ImprimirNoVenta(int iReciboId, BO.DAL.dsDatos.DatosPagoDataTable oDatosPago, bool pbImpreso = false)
        {
            bool bError = false;

            // dsFacturaBindingSource.DataSource = CargarDataSet();
            BO.DAL.dsFactura.FACTURASDataTable dtFatura = new BO.DAL.dsFactura.FACTURASDataTable();
            // DataTable dt = new DataTable();
            dtFatura = CargarDataSetFiscal(iReciboId);
            //dt.TableName = "FACTURAS";
            BO.Models.Terminal oTerm = new BO.Models.Terminal();
            oTerm = unitOfWork.TerminalRepository.GetByID(Parametros.ParametrosSucursal.TermFiscalId);
            Printer oPrinter = new Printer(oTerm);

            oPrinter.SetInvoiceData(dtFatura, oDatosPago, !pbImpreso, 1);
            oPrinter.PrintNoFiscalReceipt();

            /* if (bError == false)
             * {
             *   var oRecibos = unitOfWork.RecibosRepository.GetByID(iReciboId);
             *   oRecibos.IMPRESO = true;
             *   unitOfWork.RecibosRepository.Update(oRecibos);
             *   unitOfWork.Save();
             * }
             * else
             * {
             *   MessageBox.Show("Ha ocurrido un error en la Impresión del recibo, favor revisar la conexión ", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
             * }
             */
            //dsFacturas.Tables.Add(dt);
        }
Пример #4
0
        void BuscaTerminalFiscal()
        {
            string sSerial = clsUtils.Utils.ObtenerSerialTerminal();

            BO.Models.Terminal oTerminal = new BO.Models.Terminal();
            var oRetorno = unitOfWork.TerminalRepository.Get(xy => xy.SERIAL == sSerial && xy.SUC_ID == Parametros.Parametros.SucursalActual).FirstOrDefault();

            if (oRetorno != null)
            {
                Parametros.ParametrosSucursal.PuertoFiscal = oRetorno.PUERTO;
                Parametros.ParametrosSucursal.TermFiscalId = oRetorno.TERM_ID;
            }
            else
            {
                Parametros.ParametrosSucursal.PuertoFiscal = "NA";
                Parametros.ParametrosSucursal.TermFiscalId = -1;
            }
        }
Пример #5
0
        public void Imprimir(int iReciboId)
        {
            //dsFacturaBindingSource.DataSource = CargarDataSet();
            DataSet   dsFacturas = new DataSet();
            DataTable dt         = new DataTable();

            dt           = CargarDataSet(iReciboId);
            dt.TableName = "FACTURAS";
            BO.Models.Terminal oTerm = new BO.Models.Terminal();
            //oTerm  =unitOfWork.TerminalRepository.GetByID(Parametros.ParametrosSucursal.TermFiscalId);
            //Printer oPrinter = new Printer(oTerm);
            //oPrinter.SetInvoiceData()
            dsFacturas.Tables.Add(dt);
            LocalReport report = new LocalReport();

            report.ReportPath = @".\Reportes\rFactura.rdlc";
            report.DataSources.Add(new ReportDataSource("DataSet1", dt));
            report.SetParameters(new ReportParameter("Fecha", Convert.ToDateTime(dt.Rows[0]["REC_FECHA"]).ToShortDateString()));
            report.SetParameters(new ReportParameter("Hora", Convert.ToDateTime(dt.Rows[0]["REC_FECHA"]).ToShortTimeString()));
            report.SetParameters(new ReportParameter("Sucursal", dt.Rows[0]["SUCURSAL"].ToString()));
            report.SetParameters(new ReportParameter("Factura", dt.Rows[0]["REC_TIPO"].ToString() + "-" + dt.Rows[0]["REC_ID"].ToString()));
            report.SetParameters(new ReportParameter("Encabezado1", Parametros.ParametrosSucursal.EncabezadoFactura1));
            report.SetParameters(new ReportParameter("Encabezado2", Parametros.ParametrosSucursal.EncabezadoFactura2));
            report.SetParameters(new ReportParameter("Encabezado3", Parametros.ParametrosSucursal.EncabezadoFactura3));

            /*
             * report.DataSources.Add(
             * new ReportDataSource("Sales", LoadSalesData()));
             * -----
             */
            frmReportViewer x = new frmReportViewer(report);

            x.ShowDialog();
            //Export(report);
            //Print();
        }
        bool SalvarDatos()
        {
            int  iId      = -1;
            bool bRetorno = false;

            //CompaniasRecord oCom = new CompaniasRecord();


            BO.Models.Terminal oCom;


            if (usrbntMant1.bAdiciona == false)
            {
                iId  = Convert.ToInt32(this.textTERM_ID.Text);
                oCom = unitOfWork.TerminalRepository.GetByID(iId);
            }
            else
            {
                oCom = new BO.Models.Terminal();
            }


            oCom.TERM_DESC = this.txtTermDesc.Text.ToString();
            oCom.SERIAL    = this.TextSerial.Text.ToString();

            oCom.PUERTO = this.txtPuerto.Text.ToString();

            oCom.SUC_ID = _iSucId;


            try
            {
                if (usrbntMant1.bAdiciona == false)
                {
                    unitOfWork.TerminalRepository.Update(oCom);
                }
                else
                {
                    unitOfWork.TerminalRepository.Insert(oCom);
                }

                unitOfWork.Save();
                bRetorno           = true;
                usrbntMant1.bExito = true;
            }
            catch (System.Data.Entity.Validation.DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    string s = "";

                    /*
                     * Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                     *  eve.Entry.Entity.GetType().Name, eve.Entry.State);
                     */


                    foreach (var ve in eve.ValidationErrors)
                    {
                        s += ve.ErrorMessage + "\n";

                        /*Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                         *  ve.PropertyName, ve.ErrorMessage);*/
                    }
                    MessageBox.Show("Existen los siguientes errores:" + s, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                //throw;
            }
            catch (DataException ex)
            {
                throw ex;
            }


            return(bRetorno);
        }
Пример #7
0
 public frmManejadorImpresora()
 {
     InitializeComponent();
     oTerm    = unitOfWork.TerminalRepository.GetByID(Parametros.ParametrosSucursal.TermFiscalId);
     oPrinter = new Printer(oTerm);
 }