/// <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; })); }
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); }
/// <summary> /// Extrae la informacion de la lectura X y Z /// </summary> /// <param name="printLecturaRequest"></param> public PrintLecturaResponse[] getLecturaDatos(PrintLecturaRequest printLecturaRequest) { List <PrintLecturaResponse> printLecturaResponseList = new List <PrintLecturaResponse>(); var parameters = new Dictionary <string, object>(); parameters.Add("@FolioCorte", printLecturaRequest.FolioCorte); parameters.Add("@TipoLectura", printLecturaRequest.TipoLectura); foreach (var c in data.GetDataReader("dbo.sp_vanti_DatosTicketLecturas", parameters)) { PrintLecturaResponse printLecturaResponse = new PrintLecturaResponse(); printLecturaResponse.Texto = c.GetValue(1).ToString(); printLecturaResponse.Formato = c.GetValue(0).ToString(); printLecturaResponseList.Add(printLecturaResponse); } return(printLecturaResponseList.ToArray()); }
/// <summary> /// Imprime los tickets de lectura X y Z /// </summary> public OperationResponse PrintNow(PrintLecturaRequest printLecturaRequest) { OperationResponse operationResponse = new OperationResponse(); try { this.printLecturaRequest = printLecturaRequest; if (printDocument.PrinterSettings.IsValid) { printDocument.Print(); operationResponse.CodeNumber = "100"; operationResponse.CodeNumber = "Impresion correcta"; } } catch (Exception exception) { TryCatchBusinessExecutor tryCatch = new TryCatchBusinessExecutor(); tryCatch.AddErrorLog <OperationResponse>(exception.Message, exception.StackTrace, "Negocio", exception.ToString(), "Error de impresiĆ³n"); operationResponse.CodeNumber = "300"; operationResponse.CodeNumber = exception.Message; } return(operationResponse); }