Created
April 30, 2010 20:20
-
-
Save batok/385701 to your computer and use it in GitHub Desktop.
Parte que emite reporte mensual a Hacienda de CFDs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ano = wx.GetTextFromUser(u"Indique año","Reporte") | |
mes = wx.GetTextFromUser(u"Indique mes","Reporte") | |
foo, ultimo_dia = calendar.monthrange(int(ano),int(mes)) | |
REPORTE = "{2}{0:02d}{1}.txt".format(int(mes),ano,rfc) | |
with open(REPORTE,"w") as f: | |
for factura in model.session.query(model.Factura).filter( model.Factura.fecha.between(datetime(int(ano),int(mes),1), datetime(int(ano),int(mes),ultimo_dia,23,59,59))).all(): | |
subtotal = "{0:12.2f}".format(factura.subtotal).strip() | |
iva = "{0:12.2f}".format(factura.iva).strip() | |
f.write("|{0}||{1}|{2:4d}{3}|{4}|{5}|{6}|1|I||||\n".format(factura.mi_cliente.rfc, factura.folio, factura.ano_aprobacion, factura.aprobacion,factura.fecha_reporte, subtotal, iva )) | |
os.system("open {0}".format(REPORTE)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment