U
    âøiÞ   ã                   @   s   d dl mZ dd„ ZdS )é    )Úget_connectionbdproductivoc               
   C   sš   d} z‚z@tƒ }|stdƒ‚| ¡ }| | ¡ | ¡ }dd„ |D ƒW W ¢BS  tk
r‚ } ztd|› ƒ g  W Y ¢W ¢S d}~X Y nX W 5 |r”|  ¡  X dS )z,Obtiene los Breakers desde la base de datos.u  
    SELECT 
        isnull (DES_Reporte_financiero_OV.Company, '')as Company,
        isnull (DES_Reporte_financiero_OV.OV, '')as OV,
        isnull (DES_Reporte_financiero_OV.FechaOV, '')as FechaOV,
        isnull (DES_Reporte_financiero_OV.OrderCode, '')as OrderCode,
        isnull (DES_Reporte_financiero_OV.DivisiÃ³n, '')as DivisiÃ³n,
        isnull (DES_Reporte_financiero_OV.ClasificaciÃ³n, '')as ClasificaciÃ³n,
        isnull (DES_Reporte_financiero_OV.Departamento, '')as Departamento,
        isnull (DES_Reporte_financiero_OV.DepartamentClass, '')as DepartamentClass,
        isnull (DES_Reporte_financiero_OV.Vendedor, '')as Vendedor,
        isnull (DES_Reporte_financiero_OV.CustNum, '')as CustNum,
        isnull (DES_Reporte_financiero_OV.CustID, '')as CustID,
        isnull (DES_Reporte_financiero_OV.Cliente, '')as Cliente,
        isnull (DES_Reporte_financiero_OV.TotalLines, '')as TotalLines,
        isnull (DES_Reporte_financiero_OV.EstatusOV, '')as EstatusOV,
        isnull (DES_Reporte_financiero_OV. Importe , '')as  Importe ,
        isnull (DES_Reporte_financiero_OV. Descuento , '')as  Descuento ,
        isnull (DES_Reporte_financiero_OV. [Misc.] , '')as  [Misc.] ,
        isnull (DES_Reporte_financiero_OV. Subtotal , '')as  Subtotal ,
        isnull (DES_Reporte_financiero_OV. Impuesto , '')as  Impuesto ,
        isnull (DES_Reporte_financiero_OV. Redondeo , '')as  Redondeo ,
        isnull (DES_Reporte_financiero_OV. [Total de la Orden] , '')as  [Total de la Orden] ,
        isnull (DES_Reporte_financiero_OV.Moneda, '')as Moneda,
        isnull (DES_Reporte_financiero_OV. Cambio , '')as  Cambio ,
        isnull (DES_Reporte_financiero_OV. ImporteMXN , '')as  ImporteMXN ,
        isnull (DES_Reporte_financiero_OV. DescuentoMXN , '')as  DescuentoMXN ,
        isnull (DES_Reporte_financiero_OV. [Misc.MXN] , '')as  [Misc.MXN] ,
        isnull (DES_Reporte_financiero_OV. SubtotalMXN , '')as  SubtotalMXN ,
        isnull (DES_Reporte_financiero_OV. ImpuestoMXN , '')as  ImpuestoMXN ,
        isnull (DES_Reporte_financiero_OV. RedondeoMXN , '')as  RedondeoMXN ,
        isnull (DES_Reporte_financiero_OV. [Total de la Orden MXN] , '')as  [Total de la Orden MXN] ,
        isnull (DES_Reporte_financiero_OV.[Terminos OV], '')as [Terminos OV],
        isnull (DES_Reporte_financiero_OV.[Dias de pago OV], '')as [Dias de pago OV],
        isnull (DES_Reporte_financiero_OV.[Comentario de OV], '')as [Comentario de OV],
        isnull (DES_Reporte_financiero_OV.TipoDeVenta, '')as TipoDeVenta,
        isnull (DES_Reporte_financiero_OV. Facturado , '')as  Facturado ,
        isnull (DES_Reporte_financiero_OV. FacturadoIVA , '')as  FacturadoIVA ,
        isnull (DES_Reporte_financiero_OV. FacturadoMXN , '')as  FacturadoMXN ,
        isnull (DES_Reporte_financiero_OV. FacturadoIVAMXN , '')as  FacturadoIVAMXN ,
        isnull (DES_Reporte_financiero_OV.ListaDeFacturas, '')as ListaDeFacturas,
        isnull (DES_Reporte_financiero_OV.FechaUltimaFactura, '')as FechaUltimaFactura,
        isnull (DES_Reporte_financiero_OV. [Facturacion Manual] , '')as  [Facturacion Manual] ,
        isnull (DES_Reporte_financiero_OV.[Comentario de correccion], '')as [Comentario de correccion],
        isnull (DES_Reporte_financiero_OV. [Por Facturar] , '')as  [Por Facturar] ,
        isnull (DES_Reporte_financiero_OV.[%], '')as [%],
        isnull (DES_Reporte_financiero_OV. RevisiÃ³n , '')as  RevisiÃ³n ,
        isnull (DES_Reporte_financiero_OV.AllProjectID, '')as AllProjectID,
        isnull (DES_Reporte_financiero_OV.Columna1, '')as Columna1,
        isnull (DES_Reporte_financiero_OV.JobNumsInProject, '')as JobNumsInProject,
        isnull (DES_Reporte_financiero_OV. Material , '')as  Material ,
        isnull (DES_Reporte_financiero_OV. Labor , '')as  Labor ,
        isnull (DES_Reporte_financiero_OV. Burden , '')as  Burden ,
        isnull (DES_Reporte_financiero_OV. Subcontract , '')as  Subcontract ,
        isnull (DES_Reporte_financiero_OV. MtlBur , '')as  MtlBur ,
        isnull (DES_Reporte_financiero_OV. TotalCostPrj , '')as  TotalCostPrj ,
        isnull (DES_Reporte_financiero_OV.JobNumsDirectOV, '')as JobNumsDirectOV,
        isnull (DES_Reporte_financiero_OV. MaterialDir , '')as  MaterialDir ,
        isnull (DES_Reporte_financiero_OV. LaborDir , '')as  LaborDir ,
        isnull (DES_Reporte_financiero_OV. BurdenDir , '')as  BurdenDir ,
        isnull (DES_Reporte_financiero_OV. SubcontractDir , '')as  SubcontractDir ,
        isnull (DES_Reporte_financiero_OV. MtlBurDir , '')as  MtlBurDir ,
        isnull (DES_Reporte_financiero_OV. TotalCostDir , '')as  TotalCostDir ,
        isnull (DES_Reporte_financiero_OV.TotalCost, '')as TotalCost,
        isnull (DES_Reporte_financiero_OV.Utilidad, '')as Utilidad,
        isnull (DES_Reporte_financiero_OV.[%2], '')as [%2]

    FROM
        DES_Reporte_financiero_OV
    u4   No se pudo establecer conexiÃ³n con la base de datosc              C   S   s”  g | ]Š}|d  |d |d |d |d |d |d |d |d |d	 |d
 |d |d |d |d |d |d |d |d |d |d |d |d |d |d |d |d |d |d |d |d |d |d  |d! |d" |d# |d$ |d% |d& |d' |d( |d) |d* |d+ |d, |d- |d. |d/ |d0 |d1 |d2 |d3 |d4 |d5 |d6 |d7 |d8 |d9 |d: |d; |d< |d= |d> |d? d@œ@‘qS )Ar   é   é   é   é   é   é   é   é   é	   é
   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é   é    é!   é"   é#   é$   é%   é&   é'   é(   é)   é*   é+   é,   é-   é.   é/   é0   é1   é2   é3   é4   é5   é6   é7   é8   é9   é:   é;   é<   é=   é>   é?   )@ÚCompanyZOVZFechaOVZ	OrderCodeu	   DivisiÃ³nu   ClasificaciÃ³nÚDepartamentoÚDepartamentClassÚVendedorÚCustNumÚCustIDÚClienteÚ
TotalLinesZ	EstatusOVÚImporteZ	DescuentoZMiscZSubtotalZImpuestoZRedondeoZTotal_de_la_OrdenZMonedaZCambioÚ
ImporteMXNZDescuentoMXNZMiscMXNZSubtotalMXNZImpuestoMXNZRedondeoMXNZTotal_de_la_Orden_MXNZTerminos_OVZDias_de_pago_OVZComentario_de_OVZTipoDeVentaÚ	FacturadoÚFacturadoIVAÚFacturadoMXNÚFacturadoIVAMXNÚListaDeFacturasZFechaUltimaFacturaZFacturacion_ManualZComentario_de_correccionZPor_FacturarZ
porcentageu	   RevisiÃ³nZAllProjectIDZColumna1ZJobNumsInProjectÚMaterialZLaborZBurdenZSubcontractZMtlBurZTotalCostPrjZJobNumsDirectOVZMaterialDirZLaborDirZ	BurdenDirZSubcontractDirZ	MtlBurDirZTotalCostDirZ	TotalCostZUtilidadZporcentage2© )Ú.0ÚrowrR   rR   ú‚C:\Users\victor.barrera\Documents\proyectos\elepV3\Elep\src\Consultas_SQL\SupYCtrol\GerenteSyC\GSYCDES_Reporte_financiero_OVSQL.pyÚ
<listcomp>W   s„   BÀÀz get_Consulta.<locals>.<listcomp>z.[Error inesperado] Error obteniendo breakers: N)Úcloser   ÚConnectionErrorÚcursorÚexecuteÚfetchallÚ	ExceptionÚprint)ÚqueryÚconnrY   ÚresultsÚerR   rR   rU   Úget_Consulta   s     F
B¾C"rb   N)ÚConsultas_SQL.conexionr   rb   rR   rR   rR   rU   Ú<module>   s   