正在查看: Tarjeta Transporte v3.0.29 应用的 g41.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Tarjeta Transporte v3.0.29 应用的 g41.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.sgcr;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Log;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.Document;
import com.itextpdf.text.Font;
import com.itextpdf.text.Image;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Rectangle;
import com.itextpdf.text.pdf.Barcode128;
import com.itextpdf.text.pdf.ColumnText;
import com.itextpdf.text.pdf.PdfName;
import com.itextpdf.text.pdf.PdfObject;
import com.itextpdf.text.pdf.PdfString;
import com.itextpdf.text.pdf.PdfWriter;
import com.seglan.lat3bit.common.msg.domain.InvoiceItem;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public abstract class g41 {
public static final Font f8772for;
public static final Font f8773if;
static {
Font.FontFamily fontFamily = Font.FontFamily.HELVETICA;
BaseColor baseColor = BaseColor.BLACK;
f8773if = new Font(fontFamily, 15.0f, 0, baseColor);
f8772for = new Font(fontFamily, 8.0f, 0, baseColor);
}
public static Paragraph m8618case(String str, String str2) {
Paragraph paragraph = new Paragraph(str2, f8772for);
paragraph.setAccessibleAttribute(new PdfName(str), new PdfString(str2));
return paragraph;
}
public static void m8619else(Context context, ne neVar, oe oeVar) {
String str;
String str2;
float f;
float f2;
float f3;
int i;
StringBuilder sb;
String str3;
String str4;
String str5;
Paragraph paragraph;
boolean z;
String str6;
Calendar calendar;
SimpleDateFormat simpleDateFormat;
StringBuilder sb2;
String titleName = neVar.m13084else().getTitleName();
String profileName = neVar.m13084else().getProfileName();
if (oeVar.mo13659case() != null) {
str = oeVar.mo13659case().getInvoiceNumber();
f = Float.parseFloat(oeVar.mo13659case().getTotal());
str2 = oeVar.mo13659case().getControlCode();
f2 = Float.parseFloat(oeVar.mo13659case().getTaxBase()) / 100.0f;
i = Integer.parseInt(oeVar.mo13659case().getVatPercentage());
f3 = Float.parseFloat(oeVar.mo13659case().getTotal()) / 100.0f;
} else {
str = PdfObject.NOTHING;
str2 = str;
f = 0.0f;
f2 = 0.0f;
f3 = 0.0f;
i = 0;
}
DecimalFormat decimalFormat = new DecimalFormat("####0.00");
SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("dd.MM.yyyy HH:mm");
if (f == ColumnText.GLOBAL_SPACE_CHAR_RATIO) {
sb = new StringBuilder();
sb.append(simpleDateFormat2.format(Calendar.getInstance().getTime()));
str3 = " Ticket .pdf";
} else {
sb = new StringBuilder();
sb.append(simpleDateFormat2.format(Calendar.getInstance().getTime()));
str3 = " Factura .pdf";
}
sb.append(str3);
FileOutputStream fileOutputStream = new FileOutputStream(new File(context.getExternalFilesDir(PdfObject.NOTHING), sb.toString()));
Document document = new Document(new Rectangle(240.0f, 540.0f), 20.0f, 20.0f, 20.0f, 20.0f);
PdfWriter pdfWriter = PdfWriter.getInstance(document, fileOutputStream);
document.open();
document.add(m8620for("Titular", "Consorcio Regional de Transportes de Madrid"));
document.add(m8620for("Dirección", "Avenida de Asturias, 4, 28029 Madrid"));
document.add(m8620for("CIF", "Q7850003J"));
document.add(m8621if("****************************************************************"));
document.add(m8621if(f != ColumnText.GLOBAL_SPACE_CHAR_RATIO ? "FACTURA SIMPLIFICADA" : "JUSTIFICANTE RECARGA"));
document.add(m8621if("****************************************************************"));
document.add(m8622new("Consorcio Regional de Transportes de Madrid"));
document.add(m8622new(new SimpleDateFormat("dd/MM/yyyy HH:mm").format(Calendar.getInstance().getTime())));
if (f != ColumnText.GLOBAL_SPACE_CHAR_RATIO) {
document.add(m8622new("Número factura:\n" + str));
str4 = "Código control: " + str2;
} else {
document.add(m8622new("Número factura: N/A"));
str4 = "Código control: N/A";
}
document.add(m8622new(str4));
document.add(m8622new("Carga"));
document.add(m8622new("Título: " + titleName));
document.add(m8622new("Perfil: " + profileName));
if (oeVar.mo13661if().getGroupName() != null && !oeVar.mo13661if().getGroupName().equals("Normal")) {
document.add(m8622new("Colectivo: " + oeVar.mo13661if().getGroupShortName()));
}
String str7 = " ";
if (f != ColumnText.GLOBAL_SPACE_CHAR_RATIO) {
for (InvoiceItem invoiceItem : oeVar.mo13659case().getItems()) {
int parseInt = f != ColumnText.GLOBAL_SPACE_CHAR_RATIO ? Integer.parseInt(invoiceItem.getFare()) : 0;
StringBuilder sb3 = new StringBuilder();
sb3.append("Importe: ");
String str8 = str7;
sb3.append(decimalFormat.format(parseInt / 100.0f));
sb3.append(" € x ");
sb3.append(Integer.parseInt(invoiceItem.getUnits()));
document.add(m8622new(sb3.toString()));
if (invoiceItem.getName().toLowerCase().contains("supl")) {
try {
calendar = Calendar.getInstance();
calendar.add(6, 1);
simpleDateFormat = new SimpleDateFormat("dd-MM-yyyy");
sb2 = new StringBuilder();
str6 = str8;
} catch (Exception e) {
e = e;
str6 = str8;
}
try {
sb2.append(str6);
sb2.append(simpleDateFormat.format(calendar.getTime()));
sb2.append(".");
document.add(m8622new(context.getResources().getString(2131951800) + sb2.toString()));
} catch (Exception e2) {
e = e2;
Log.d("ERR", e.getMessage());
str7 = str6;
}
} else {
str6 = str8;
}
str7 = str6;
}
}
String str9 = str7;
document.add(m8621if("---------------------------------------------------------------------------"));
document.add(m8622new("Base: " + decimalFormat.format(f2) + " €, Tipo IVA: " + i + " %, IVA: " + decimalFormat.format((f2 * i) / 100.0f) + " €"));
document.add(m8621if("---------------------------------------------------------------------------"));
StringBuilder sb4 = new StringBuilder();
sb4.append("Total ");
sb4.append(decimalFormat.format((double) f3));
sb4.append(" Euros");
document.add(new Paragraph(sb4.toString(), f8773if));
document.add(new Paragraph(str9));
if (oeVar.mo13661if().getCardNumber() != null) {
document.add(m8622new("No. TTP: " + oeVar.mo13661if().getCardNumber()));
}
document.add(m8622new("No. TSC: " + oeVar.mo13661if().getDesfireSerial()));
if (f != ColumnText.GLOBAL_SPACE_CHAR_RATIO) {
document.add(m8622new("Modo de pago: Tarjeta"));
document.add(m8622new("Operación: " + neVar.m13080case()));
str5 = "Tarjeta: " + neVar.f12087else.m13652if();
} else {
document.add(m8622new("Modo de pago: N/A"));
document.add(m8622new("Operación: N/A"));
str5 = "Tarjeta: N/A";
}
document.add(m8622new(str5));
document.add(m8622new("Tipo transacción: Venta"));
if (f != ColumnText.GLOBAL_SPACE_CHAR_RATIO) {
document.add(m8622new(PdfObject.NOTHING));
document.add(m8622new(PdfObject.NOTHING));
Barcode128 barcode128 = new Barcode128();
barcode128.setCode(oeVar.mo13659case().getInvoiceNumberBC());
Image createImageWithBarcode = barcode128.createImageWithBarcode(pdfWriter.getDirectContent(), null, null);
createImageWithBarcode.setAlignment(1);
document.add(new Paragraph(PdfObject.NOTHING));
document.add(new Paragraph(PdfObject.NOTHING));
paragraph = createImageWithBarcode;
} else {
paragraph = m8622new("Consulte condiciones de uso en www.crtm.es amparado por la cobertura S.O.V.");
}
document.add(paragraph);
document.add(new Paragraph(str9));
List<String> emptyList = Collections.emptyList();
if (f > ColumnText.GLOBAL_SPACE_CHAR_RATIO) {
if (oeVar.mo13659case() != null && oeVar.mo13659case().getMessages() != null) {
emptyList = oeVar.mo13659case().getMessages();
}
} else if (oeVar.mo13662new() != null && oeVar.mo13662new().getMessages() != null) {
emptyList = oeVar.mo13662new().getMessages();
}
if (!"01".equals(oeVar.mo13660else().getCode()) || emptyList.isEmpty()) {
z = false;
} else {
Iterator<String> it = emptyList.iterator();
z = false;
while (it.hasNext()) {
String trim = it.next().trim();
if ("IMG_FOOTER_001".equals(trim)) {
Log.d("ReciboPrinter", "IMG_FOOTER_001 encontrada");
z = true;
} else {
document.add(m8622new(trim));
}
}
}
if (z) {
try {
Bitmap decodeResource = BitmapFactory.decodeResource(context.getResources(), 2131165380);
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
decodeResource.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream);
Image image = Image.getInstance(byteArrayOutputStream.toByteArray());
image.setAlignment(1);
image.scaleToFit(120.0f, 60.0f);
document.add(image);
document.add(new Paragraph(str9));
} catch (Exception e3) {
Log.e("ReciboPrinter", "Error al insertar icono en el PDF: " + e3.getMessage());
}
}
document.close();
}
public static Paragraph m8620for(String str, String str2) {
Paragraph m8618case = m8618case(str, str2);
m8618case.setAlignment(1);
return m8618case;
}
public static Paragraph m8621if(String str) {
Paragraph m8623try = m8623try(str);
m8623try.setAlignment(1);
return m8623try;
}
public static Paragraph m8622new(String str) {
return m8623try(str);
}
public static Paragraph m8623try(String str) {
return new Paragraph(str, f8772for);
}
}