Ejemplo n.º 1
0
        /// <summary>
        /// Lectura Z
        /// </summary>
        /// <returns>Respuesta de la operación</returns>
        public ResponseBussiness <OperationResponse> LecturaZ(LecturaCaja lecturaCaja)
        {
            return(tryCatch.SafeExecutor(() =>
            {
                OperationResponse resultado = new OperationResponse();
                LecturaZGuardarResponse lecturaZGuardarResponse = new LecturaZGuardarResponse();
                LecturaTotalDetalleFormaPago lecturaTotalDetalleFormaPagoCA = null;
                using (TransactionScope scope = new TransactionScope())
                {
                    int secuencia = 1;
                    // Se ejecuta la lectura X
                    LecturaX lecturaX = repository.ObtenerFoliosLecturaX(token.CodeStore, token.CodeBox, token.CodeEmployee, 0);
                    foreach (var lecturaTotalDetalleFormaPago in lecturaCaja.LecturasTotales)
                    {
                        resultado = repository.LecturaX(token.CodeStore, token.CodeBox, token.CodeEmployee, lecturaTotalDetalleFormaPago.InformacionAsociadaFormasPago.CodigoFormaPago, secuencia, lecturaTotalDetalleFormaPago.ImporteFisico, lecturaTotalDetalleFormaPago.ImporteTeorico, lecturaTotalDetalleFormaPago.ImporteFisico, lecturaX);
                        if (lecturaTotalDetalleFormaPago.InformacionAsociadaFormasPago.CodigoFormaPago == "CA")
                        {
                            lecturaTotalDetalleFormaPagoCA = lecturaTotalDetalleFormaPago;
                        }
                        secuencia = secuencia + 1;
                    }
                    // Se ejecutar la lectura Z
                    if (lecturaTotalDetalleFormaPagoCA != null)
                    {
                        lecturaZGuardarResponse = repository.LecturaZ(token.CodeStore, token.CodeBox, token.CodeEmployee,
                                                                      lecturaX.FolioCorteParcial, lecturaTotalDetalleFormaPagoCA.ImporteFisico,
                                                                      lecturaTotalDetalleFormaPagoCA.ImporteTeorico, lecturaTotalDetalleFormaPagoCA.ImporteFisico, 0);
                        resultado.CodeNumber = lecturaZGuardarResponse.CodeNumber;
                        resultado.CodeDescription = lecturaZGuardarResponse.CodeDescription;
                        // Se persisten las denominaciones
                        foreach (var item in lecturaTotalDetalleFormaPagoCA.InformacionAsociadaDenominaciones)
                        {
                            repository.PersistirDenominacionesRetiro(lecturaX.FolioCorteParcial, item.CodigoFormaPago, item.TextoDenominacion, item.Cantidad);
                        }
                    }
                    scope.Complete();
                }

                // Imprimir Ticket
                PrintTickectLecturaBusiness printTickectLectura = new PrintTickectLecturaBusiness(token);
                PrintLecturaRequest printLecturaRequest = new PrintLecturaRequest();
                printLecturaRequest.FolioCorte = lecturaZGuardarResponse.FolioCorte;
                printLecturaRequest.TipoLectura = "z";
                printTickectLectura.PrintNow(printLecturaRequest);

                PrintTicketEgresosBusiness printTicketEgresos = new PrintTicketEgresosBusiness(token);
                PrintTicketEgresosRequest printTicketEgresosRequest = new PrintTicketEgresosRequest();
                printTicketEgresosRequest.FolioCorteZ = lecturaZGuardarResponse.FolioCorte;
                printTicketEgresos.PrintNow(printTicketEgresosRequest);

                return resultado;
            }));
        }
Ejemplo n.º 2
0
        public ResponseBussiness <OperationResponse> PrintCorte(string folio, string tipo)
        {
            new SecurityBusiness().ValidarPermisos("imprimirTicket", "E");
            TokenDto token = new TokenService().Get();
            PrintTickectLecturaBusiness printTickectLectura = new PrintTickectLecturaBusiness(token);
            PrintLecturaRequest         printLecturaRequest = new PrintLecturaRequest();

            printLecturaRequest.FolioCorte  = folio;
            printLecturaRequest.TipoLectura = tipo;
            OperationResponse operation = printTickectLectura.PrintNow(printLecturaRequest);

            return(operation);
        }