use of eu.ggnet.dwoss.customer.opi.UiCustomer in project dwoss by gg-net.
the class SageExporterEngine method generateGSRowDataOld.
/**
* Will be removed
*
* @param monitor
* @param defaultLedger
* @param disableCustomerLedgers
* @return
* @deprecated use {@link SageExporterEngine#generateGSRowData(eu.ggnet.saft.api.progress.IMonitor)
*/
@Deprecated
public RowData generateGSRowDataOld(IMonitor monitor, int defaultLedger, boolean disableCustomerLedgers) {
SubMonitor m = SubMonitor.convert(monitor);
RowData rowData = new RowData();
for (Document doc : customerInvoices.keySet()) {
Row r = new Row();
m.worked(1, "processing Invioce " + doc.getIdentifier());
UiCustomer customer = customerInvoices.get(doc);
r.setBeleg("AR/K" + doc.getDossier().getCustomerId() + doc.getDossier().getIdentifier().replace("_", "") + "/" + doc.getIdentifier().substring(0, 4));
r.setBuerfDatum(doc.getActual());
r.setDatum(doc.getActual());
r.setFaDatum(doc.getActual());
r.setReDatum(doc.getActual());
String buchungsText = customer.getCompany();
if (buchungsText == null || buchungsText.trim().equals("")) {
buchungsText = customer.getLastName();
}
if (buchungsText == null || buchungsText.trim().equals("")) {
buchungsText = "Kundenummer=" + customer.getId();
}
buchungsText = buchungsText.replaceAll("-", "_");
buchungsText += " - " + doc.getIdentifier();
r.setBuchtext(buchungsText);
r.setWawiBeleg("K" + customer.getId() + "/" + doc.getIdentifier());
r.setStCode("01");
r.setKonto(defaultLedger);
if (!disableCustomerLedgers && customer.getLedger() > 0)
r.setKonto(customer.getLedger());
Map<Integer, Row> bookingRates = new HashMap<>();
for (Position position : doc.getPositions().values()) {
if (!position.getBookingAccount().isPresent())
continue;
Row row;
if (!bookingRates.containsKey(position.getBookingAccount().get().getValue())) {
bookingRates.put(position.getBookingAccount().get().getValue(), new Row(r));
row = bookingRates.get(position.getBookingAccount().get().getValue());
row.setNettoSumme(row.getNettoSumme() + (position.getAmount() * position.getPrice()));
row.setBruttoSumme(row.getBruttoSumme() + (position.getAmount() * position.toAfterTaxPrice()));
row.setBetrag((position.getAmount() * position.getPrice()), (position.getAmount() * position.toAfterTaxPrice()));
row.setStProz(position.getTax() * 100);
row.setStNumeric(position.getTax() * 100);
if (doc.getType() == DocumentType.CREDIT_MEMO) {
row.setKonto(position.getBookingAccount().get().getValue());
row.setGKonto(defaultLedger);
} else {
row.setGKonto(position.getBookingAccount().get().getValue());
}
rowData.add(row);
} else {
row = bookingRates.get(position.getBookingAccount().get().getValue());
if (row.getStNumeric() != (position.getTax() * 100))
throw new RuntimeException("Document enthält Positionen mit unterschiedlicher UmSt. Rechnung: " + doc.getIdentifier() + ", aktuelle UmSt.: " + row.getStProz() + ", abweichung in Position: " + position.getName() + " mit UmSt. von " + (position.getTax() * 100));
row.setNettoSumme(row.getNettoSumme() + (position.getAmount() * position.getPrice()));
row.setBruttoSumme(row.getBruttoSumme() + (position.getAmount() * position.toAfterTaxPrice()));
row.setBetrag(row.getNettoSumme(), row.getBruttoSumme());
}
}
}
return rowData;
}
use of eu.ggnet.dwoss.customer.opi.UiCustomer in project dwoss by gg-net.
the class SageExporterEngine method generateGSRowData.
public RowData generateGSRowData(IMonitor monitor) {
SubMonitor m = SubMonitor.convert(monitor);
RowData rowData = new RowData();
for (Document doc : customerInvoices.keySet()) {
Row r = new Row();
m.worked(1, "processing Invioce " + doc.getIdentifier());
UiCustomer customer = customerInvoices.get(doc);
r.setBeleg(config.beleg(doc, customer));
r.setBuerfDatum(doc.getActual());
r.setDatum(doc.getActual());
r.setFaDatum(doc.getActual());
r.setReDatum(doc.getActual());
r.setBuchtext(config.buchText(doc, customer));
r.setWawiBeleg(config.wawiBeleg(doc, customer));
r.setStCode(config.stCode(doc));
r.setKonto(config.getDefaultDebitorLedger());
if (!config.isCustomerLedgersDisabled() && customer.getLedger() > 0)
r.setKonto(customer.getLedger());
Map<Integer, Row> bookingRates = new HashMap<>();
for (Position position : doc.getPositions().values()) {
if (!position.getBookingAccount().isPresent()) {
L.warn("Export contains Position without BookingAccount. Kid={},Dossier={},Pos={}", customer.getId(), doc.getDossier().getIdentifier(), position);
continue;
}
Row row;
if (!bookingRates.containsKey(position.getBookingAccount().get().getValue())) {
bookingRates.put(position.getBookingAccount().get().getValue(), new Row(r));
row = bookingRates.get(position.getBookingAccount().get().getValue());
row.setNettoSumme(row.getNettoSumme() + (position.getAmount() * position.getPrice()));
row.setBruttoSumme(row.getBruttoSumme() + (position.getAmount() * position.toAfterTaxPrice()));
row.setBetrag((position.getAmount() * position.getPrice()), (position.getAmount() * position.toAfterTaxPrice()));
row.setStProz(position.getTax() * 100);
row.setStNumeric(position.getTax() * 100);
if (doc.getType() == DocumentType.CREDIT_MEMO) {
row.setKonto(position.getBookingAccount().get().getValue());
row.setGKonto(config.getDefaultDebitorLedger());
} else {
row.setGKonto(position.getBookingAccount().get().getValue());
}
rowData.add(row);
} else {
row = bookingRates.get(position.getBookingAccount().get().getValue());
if (row.getStNumeric() != (position.getTax() * 100))
throw new RuntimeException("Document enthält Positionen mit unterschiedlicher UmSt. Rechnung: " + doc.getIdentifier() + ", aktuelle UmSt.: " + row.getStProz() + ", abweichung in Position: " + position.getName() + " mit UmSt. von " + (position.getTax() * 100));
row.setNettoSumme(row.getNettoSumme() + (position.getAmount() * position.getPrice()));
row.setBruttoSumme(row.getBruttoSumme() + (position.getAmount() * position.toAfterTaxPrice()));
row.setBetrag(row.getNettoSumme(), row.getBruttoSumme());
}
}
}
return rowData;
}
use of eu.ggnet.dwoss.customer.opi.UiCustomer in project dwoss by gg-net.
the class CreateCustomerTryout method main.
public static void main(String[] args) {
Dl.remote().add(Mandators.class, mock(Mandators.class));
Dl.local().add(Guardian.class, new AbstractGuardian() {
{
setAllUsersnames(Arrays.asList("hans", "claus", "peter"));
}
@Override
public void login(String user, char[] pass) throws AuthenticationException {
}
});
Dl.remote().add(OldCustomerAgent.class, new OldCustomerAgent() {
@Override
public OldCustomer findById(long id) {
OldCustomer customer = new OldCustomer("Die Firma", "Herr", "Max", "Mustermann", "Keine Bemerkungen die ganz lang sein muss um zu testen ob die tabelle richtig funzt, was erst bei richtig richtig langem text auffällt und olli sicher nervt xD", "Helle Strasse 22", "12345", "Musterhausen", "LIStraße", "LIPLZ", "LIOrt");
customer.setKundenID(1);
customer.setTelefonnummer("0190 666666");
customer.setHandynummer("0123456789");
customer.setPaymentMethod(PaymentMethod.ADVANCE_PAYMENT);
customer.setPaymentCondition(PaymentCondition.DEALER);
customer.setShippingCondition(ShippingCondition.DEALER_ONE);
customer.setAllowedSalesChannels(EnumSet.of(SalesChannel.CUSTOMER, SalesChannel.RETAILER));
customer.addFlag(CustomerFlag.CONFIRMS_DOSSIER);
customer.setHaendler(true);
return customer;
}
@Override
public OldCustomer store(OldCustomer old) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
});
Dl.remote().add(CustomerService.class, new CustomerService() {
@Override
public List<UiCustomer> asUiCustomers(String company, String firstName, String lastName, String email, boolean appendWildcard) {
L.info("call of asUiCustomers(company={},firstName={},lastName={},email={},wildCard={}", company, firstName, lastName, email, appendWildcard);
return new ArrayList<>();
}
// <editor-fold defaultstate="collapsed" desc="Unused Methods">
@Override
public CustomerMetaData asCustomerMetaData(long customerId) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public UiCustomer asUiCustomer(long customerId) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<UiCustomer> asUiCustomers(String search) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String asHtmlHighDetailed(long id) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String findComment(long id) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public void updateCustomerFlags(long customerId, Set<CustomerFlag> flags) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<CustomerMetaData> allAsCustomerMetaData() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public List<Long> allSystemCustomerIds() {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
@Override
public String asNewHtmlHighDetailed(long id) {
// To change body of generated methods, choose Tools | Templates.
throw new UnsupportedOperationException("Not supported yet.");
}
});
CustomerCreateWithSearchView view = new CustomerCreateWithSearchView();
CustomerCreateWithSearchController controller = new CustomerCreateWithSearchController();
controller.setView(view);
view.setController(controller);
OkCancelDialog<CustomerCreateWithSearchView> dialog = new OkCancelDialog<>("Kundenmanagement", view);
dialog.setVisible(true);
System.out.println(view.getCustomer());
System.exit(0);
}
use of eu.ggnet.dwoss.customer.opi.UiCustomer in project dwoss by gg-net.
the class UniversalSearcherOperation method searchCustomers.
/**
* Returns a List of short descriptions of Customers in Html.
* Ensure to add the html start/end tags manually
* <p/>
* @param search a search string.
* @return a List of short descriptions of Customers in Html.
*/
// misc and redTape.
@Override
public List<Tuple2<Long, String>> searchCustomers(String search) {
List<UiCustomer> customers = customerService.asUiCustomers(search);
List<Tuple2<Long, String>> result = new ArrayList<>(customers.size());
for (UiCustomer customer : customers) {
result.add(new Tuple2((long) customer.getId(), customer.getSimpleHtml()));
}
return result;
}
use of eu.ggnet.dwoss.customer.opi.UiCustomer in project dwoss by gg-net.
the class DebitorsReporterOperation method toXls.
/**
* Creates the Report
*
* @param monitor
* @return a ByteArray represeting the content of an xls file.
*/
@Override
public FileJacket toXls(Date start, Date end) {
SubMonitor m = monitorFactory.newSubMonitor("DebitorenReport", 25);
m.message("loading Dossiers");
DocumentEao documentEao = new DocumentEao(redTapeEm);
List<Document> documents = new ArrayList<>();
documents.addAll(documentEao.findDocumentsBetweenDates(start, end, DocumentType.INVOICE));
m.worked(10, "preparing Data");
List<Object[]> rows = new ArrayList<>();
for (Document document : documents) {
UiCustomer c = customerService.asUiCustomer(document.getDossier().getCustomerId());
rows.add(new Object[] { c.getId(), document.getDossier().getIdentifier(), c.getCompany(), c.toNameLine(), document.getDossier().getCrucialDirective().getName(), document.getDossier().getComment(), document.getActual(), document.getIdentifier(), document.getPrice(), document.toAfterTaxPrice(), document.getDossier().getPaymentMethod().getNote() });
}
m.worked(10, "building Report");
STable table = new STable();
table.setTableFormat(new CFormat(BLACK, WHITE, new CBorder(BLACK)));
table.setHeadlineFormat(new CFormat(BOLD_ITALIC, WHITE, BLUE, CENTER, new CBorder(BLACK)));
table.add(new STableColumn("Kid", 8, new CFormat(RIGHT))).add(new STableColumn("AiD", 10, new CFormat(RIGHT))).add(new STableColumn("Firma", 20));
table.add(new STableColumn("Nachname", 20)).add(new STableColumn("Letzer Status", 20));
table.add(new STableColumn("Bemerkung", 10)).add(new STableColumn("Datum", 10, new CFormat(RIGHT, SHORT_DATE)));
table.add(new STableColumn("RE_Nr", 10, new CFormat(RIGHT))).add(new STableColumn("Netto", 15, new CFormat(RIGHT, CURRENCY_EURO))).add(new STableColumn("Brutto", 10, new CFormat(RIGHT, CURRENCY_EURO)));
table.add(new STableColumn("ZahlungsModalität", 10, new CFormat(RIGHT)));
table.setModel(new STableModelList(rows));
CCalcDocument cdoc = new TempCalcDocument("Debitoren_");
cdoc.add(new CSheet("DebitorenReport", table));
File file = LucidCalc.createWriter(LucidCalc.Backend.XLS).write(cdoc);
FileJacket result = new FileJacket("Debitoren", ".xls", file);
m.finish();
return result;
}
Aggregations