BrightSide Workbench Full Report + Source Code
org.turro.financials.entity.Document Class Reference
Inheritance diagram for org.turro.financials.entity.Document:
Collaboration diagram for org.turro.financials.entity.Document:

Public Member Functions

Set< DocumentRelationgetAncestors ()
 
void setAncestors (Set< DocumentRelation > ancestors)
 
Contract getContract ()
 
void setContract (Contract contract)
 
Currency getCurrency ()
 
void setCurrency (Currency currency)
 
Set< DocumentRelationgetDescendants ()
 
Set< DocumentRelationgetUpdatedDescendants ()
 
void setDescendants (Set< DocumentRelation > descendants)
 
Date getDocumentDate ()
 
void setDocumentDate (Date documentDate)
 
DocumentDefinition getDocumentDefinition ()
 
void setDocumentDefinition (DocumentDefinition documentDefinition)
 
Set< DocumentLinegetDocumentLines ()
 
void setDocumentLines (Set< DocumentLine > documentLines)
 
String getDocumentNumber ()
 
void setDocumentNumber (String documentNumber)
 
boolean isDraft ()
 
void setDraft (boolean draft)
 
RegisterView getForcedView ()
 
void setForcedView (RegisterView forcedView)
 
long getId ()
 
void setId (long id)
 
boolean isNoAncestors ()
 
void setNoAncestors (boolean noAncestors)
 
boolean isNoDescendants ()
 
void setNoDescendants (boolean noDescendants)
 
String getNotes ()
 
void setNotes (String notes)
 
double getQuote ()
 
void setQuote (double quote)
 
Date getReceiptDate ()
 
void setReceiptDate (Date receiptDate)
 
Set< RegistergetRegisters ()
 
void setRegisters (Set< Register > registers)
 
String getRelatedPath ()
 
void setRelatedPath (String relatedPath)
 
Object entityId ()
 
boolean isEmpty ()
 
void prepareSave ()
 
Collection< Collection > collections ()
 
IElephantEntity getRelated ()
 
boolean isValid ()
 
boolean isBlank ()
 
String getConcept ()
 
String getCleanFullNotes ()
 
String getFullNotes ()
 
void clearEmpties ()
 
void assignTableOrder (Collection< DocumentLine > lines)
 
DocumentAmounts getAmounts ()
 
DocumentAmountsByBook getAmountsByBook (BookDefinition bookDefinition)
 
double getSubTotal ()
 
double getTotalAmount ()
 
ContractPreference getDefaultContractPreference ()
 
void appendLines (Document relDoc, String header, DocumentWorkflow workflow)
 
void appendAmounts (Document relDoc, String header, DocumentWorkflow workflow)
 
void flowFrom (Document doc, String header, DocumentWorkflow workflow)
 
void backFrom (Document doc, String header, DocumentWorkflow workflow)
 
void copyFrom (Document doc, boolean shallowCopy)
 
Collection< ContractFlowgetContractFlows ()
 
Collection< DocumentWorkflowgetWorkflows ()
 
Collection< DocumentWorkflowgetWorkflows (boolean forward, boolean missing)
 
Collection< ContactgetActualHqContacts ()
 
String getDocDescription ()
 
String getDocumentString ()
 
Collection< ContractgetStores ()
 
Contract getDefaultStore ()
 
int getMaxLineOrder ()
 
String getUsualPath ()
 
LineType getDefaultLineType ()
 
Collection< LineTypegetLineTypes ()
 
Object doAction (Date now, String data)
 
long getBookNumber ()
 
boolean isConciliateRegister ()
 
void setConciliateRegister (boolean conciliateRegister)
 
boolean isRegularizeVAT ()
 
void setRegularizeVAT (boolean regularizeVAT)
 
boolean isRegularizeIRPF ()
 
void setRegularizeIRPF (boolean regularizeIRPF)
 
MappingSet getSerializerMappings ()
 
- Public Member Functions inherited from org.turro.jpa.entity.IDaoEntity
default boolean isNew ()
 
default void prepareDelete ()
 
default void removeEmpties ()
 

Public Attributes

transient boolean conciliateRegister
 
transient boolean regularizeVAT
 
transient boolean regularizeIRPF
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 56 of file Document.java.

Member Function Documentation

◆ appendAmounts()

void org.turro.financials.entity.Document.appendAmounts ( Document  relDoc,
String  header,
DocumentWorkflow  workflow 
)

Definition at line 493 of file Document.java.

493  {
494  int count = getMaxLineOrder() + 1;
495  LineType lt = workflow == null ? null : workflow.getLineType();
496  if(lt == null) {
497  for(RelatedLineType rlt : getDocumentDefinition().getRelatedLineTypes()) {
498  if(rlt.getLineType().getStockCoefficient() == 0) {
499  lt = rlt.getLineType();
500  break;
501  }
502  }
503  }
504  if(lt == null) {
505  lt = getDefaultLineType();
506  }
507  Contract defaultStore = getDefaultStore();
508  if(getDocumentDefinition().hasColumn(DocumentColumn.DCOL_TAX)) {
509  for(AmountTaxable l : relDoc.getAmounts().getTaxables()) {
510  DocumentLine dl = new DocumentLine();
511  dl.setDocument(this);
512  if(header != null) {
513  dl.setConcept(header + " [" + l.getTax() + "]");
514  }
515  dl.setPrice(l.getAmount());
516  dl.setTax(l.getTax());
517  dl.setEquivalenceSurcharge(l.getReq());
518  dl.setLineType(lt);
519  dl.setContractPreference(getDefaultContractPreference());
520  dl.setStore(defaultStore);
521  dl.setLineOrder(count++);
522  documentLines.add(dl);
523  }
524  } else {
525  DocumentLine dl = new DocumentLine();
526  dl.setDocument(this);
527  if(header != null) {
528  dl.setConcept(header);
529  }
530  dl.setPrice(relDoc.getTotalAmount());
531  dl.setLineType(lt);
532  dl.setContractPreference(getDefaultContractPreference());
533  dl.setStore(defaultStore);
534  dl.setLineOrder(count++);
535  documentLines.add(dl);
536  }
537  }
ContractPreference getDefaultContractPreference()
Definition: Document.java:429
DocumentDefinition getDocumentDefinition()
Definition: Document.java:167
Here is the call graph for this function:

◆ appendLines()

void org.turro.financials.entity.Document.appendLines ( Document  relDoc,
String  header,
DocumentWorkflow  workflow 
)

Definition at line 440 of file Document.java.

440  {
441  int count = getMaxLineOrder() + 1;
442  if(header != null) {
443  Contract defaultStore = getDefaultStore();
444  DocumentLine dl = new DocumentLine();
445  dl.setDocument(this);
446  dl.setConcept(header);
447  dl.setStore(defaultStore);
448  dl.setLineOrder(count++);
449  documentLines.add(dl);
450  }
451  for(DocumentLine l : relDoc.getDocumentLines()) {
452  DocumentLine dl = new DocumentLine();
453  dl.setDocument(this);
454  dl.setProduct(l.getProduct());
455  dl.setProductByContractor(l.getProductByContractor());
456  dl.setConcept(l.getConcept());
457  dl.setQuantity(l.getQuantity());
458  dl.setPrice(l.getPrice());
459  dl.setDiscountPerCent(l.getDiscountPerCent());
460  dl.setDiscountMoney(l.getDiscountMoney());
461  dl.setTax(l.getTax());
462  dl.setEquivalenceSurcharge(l.getEquivalenceSurcharge());
463  dl.setRetention(l.getRetention());
464  dl.setStore(l.getStore());
465  dl.setLineOrder(count++);
466  if(l.getLineType() != null) {
467  double sc = l.getLineType().getStockCoefficient();
468  dl.setLineType(workflow == null ? null : workflow.getLineType());
469  if(dl.getLineType() == null) {
470  for(RelatedLineType rlt : getDocumentDefinition().getRelatedLineTypes()) {
471  if((sc == 0 && rlt.getLineType().getStockCoefficient() != 0) ||
472  (sc != 0 && rlt.getLineType().getStockCoefficient() == 0)) {
473  dl.setLineType(rlt.getLineType());
474  break;
475  }
476  }
477  }
478  if(dl.getLineType() == null) {
479  dl.setLineType(getDefaultLineType());
480  }
481  } else {
482  dl.setLineType(null);
483  }
484  if(workflow == null) {
485  dl.setContractPreference(getDefaultContractPreference());
486  } else {
487  dl.setContractPreference(l.getContractPreference());
488  }
489  documentLines.add(dl);
490  }
491  }
Here is the call graph for this function:

◆ assignTableOrder()

void org.turro.financials.entity.Document.assignTableOrder ( Collection< DocumentLine lines)

Definition at line 380 of file Document.java.

380  {
381  Iterator<DocumentLine> it = lines.iterator();
382  int c = 0;
383  while(it.hasNext()) {
384  it.next().setLineOrder(c++);
385  }
386  }

◆ backFrom()

void org.turro.financials.entity.Document.backFrom ( Document  doc,
String  header,
DocumentWorkflow  workflow 
)

Definition at line 560 of file Document.java.

560  {
561  Date now = new Date();
562  setContract(doc.getContract());
563  setCurrency(doc.getCurrency());
564  setDocumentDate(now);
565  setDocumentNumber(null);
566  setReceiptDate(now);
567  setDocumentDefinition(workflow.getAncestor());
568  setDraft(doc.isDraft());
569  setNotes(doc.getNotes());
570  if(workflow.getAncestor().hasDetail() && workflow.getDescendant().hasDetail()) {
571  appendLines(doc, header, null);
572  } else {
573  appendAmounts(doc, header, null);
574  }
575  DocumentRelation dr = new DocumentRelation();
576  dr.setAncestor(this);
577  dr.setDescendant(doc);
578  getDescendants().add(dr);
579  }
void setDocumentNumber(String documentNumber)
Definition: Document.java:192
void setDocumentDate(Date documentDate)
Definition: Document.java:163
Set< DocumentRelation > getDescendants()
Definition: Document.java:139
void setContract(Contract contract)
Definition: Document.java:123
void appendLines(Document relDoc, String header, DocumentWorkflow workflow)
Definition: Document.java:440
void setCurrency(Currency currency)
Definition: Document.java:135
void setDocumentDefinition(DocumentDefinition documentDefinition)
Definition: Document.java:175
void setReceiptDate(Date receiptDate)
Definition: Document.java:256
void appendAmounts(Document relDoc, String header, DocumentWorkflow workflow)
Definition: Document.java:493
Here is the call graph for this function:

◆ clearEmpties()

void org.turro.financials.entity.Document.clearEmpties ( )

Definition at line 371 of file Document.java.

371  {
372  Iterator<DocumentLine> itl = getDocumentLines().iterator();
373  while(itl.hasNext()) {
374  if(itl.next().isEmpty()) {
375  itl.remove();
376  }
377  }
378  }
Set< DocumentLine > getDocumentLines()
Definition: Document.java:180
Here is the caller graph for this function:

◆ collections()

Collection<Collection> org.turro.financials.entity.Document.collections ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 322 of file Document.java.

322  {
323  return List.of(getRegisters());
324  }

◆ copyFrom()

void org.turro.financials.entity.Document.copyFrom ( Document  doc,
boolean  shallowCopy 
)

Definition at line 581 of file Document.java.

581  {
582  if(!shallowCopy) {
583  setContract(doc.getContract());
584  }
585  setCurrency(doc.getCurrency());
586  setDocumentDate(doc.getDocumentDate());
587  setDocumentNumber(doc.getDocumentNumber() + "*");
588  setReceiptDate(doc.getReceiptDate());
589  setDocumentDefinition(doc.getDocumentDefinition());
590  setDraft(true);
591  setNotes(doc.getNotes());
592  setForcedView(doc.getForcedView());
593  Contract defaultStore = (!shallowCopy) ? null : getDefaultStore();
594  for(DocumentLine dl : doc.getDocumentLines()) {
595  DocumentLine nl = new DocumentLine();
596  nl.setConcept(dl.getConcept());
597  nl.setDiscountMoney(dl.getDiscountMoney());
598  nl.setDiscountPerCent(dl.getDiscountPerCent());
599  nl.setDocument(this);
600  nl.setLineOrder(dl.getLineOrder());
601  nl.setLineType(dl.getLineType());
602  nl.setContractPreference(dl.getContractPreference());
603  nl.setPrice(dl.getPrice());
604  nl.setProduct(dl.getProduct());
605  nl.setProductByContractor(dl.getProductByContractor());
606  nl.setQuantity(dl.getQuantity());
607  nl.setStore(shallowCopy ? defaultStore : dl.getStore());
608  nl.setTax(dl.getTax());
609  nl.setEquivalenceSurcharge(dl.getEquivalenceSurcharge());
610  nl.setRetention(dl.getRetention());
611  documentLines.add(nl);
612  }
613  }
void setForcedView(RegisterView forcedView)
Definition: Document.java:208
Here is the call graph for this function:
Here is the caller graph for this function:

◆ doAction()

Object org.turro.financials.entity.Document.doAction ( Date  now,
String  data 
)

Implements org.turro.plugin.scheduler.ScheduledAction.

Definition at line 764 of file Document.java.

764  {
765  if(data.contains("action:clone")) {
766  Document nd = new Document();
767  nd.copyFrom(this, false);
768  nd.setDocumentDate(now);
769  nd.setReceiptDate(now);
770  if(nd.getDocumentDefinition().isAutoNumbered()) {
771  nd.setDocumentNumber(null);
772  }
773  nd.setDraft(data.contains("clone:draft"));
774  nd.prepareSave();
775  return new FinancialsPU().saveObject(nd);
776  }
777  return null;
778  }
Here is the call graph for this function:

◆ entityId()

Object org.turro.financials.entity.Document.entityId ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 279 of file Document.java.

279  {
280  return id;
281  }

◆ flowFrom()

void org.turro.financials.entity.Document.flowFrom ( Document  doc,
String  header,
DocumentWorkflow  workflow 
)

Definition at line 539 of file Document.java.

539  {
540  Date now = new Date();
541  setContract(doc.getContract());
542  setCurrency(doc.getCurrency());
543  setDocumentDate(now);
544  setDocumentNumber(null);
545  setReceiptDate(now);
546  setDocumentDefinition(workflow.getDescendant());
547  setDraft(doc.isDraft());
548  setNotes(doc.getNotes());
549  if(workflow.getAncestor().hasDetail() && workflow.getDescendant().hasDetail()) {
550  appendLines(doc, header, workflow);
551  } else {
552  appendAmounts(doc, header, workflow);
553  }
554  DocumentRelation dr = new DocumentRelation();
555  dr.setAncestor(doc);
556  dr.setDescendant(this);
557  getAncestors().add(dr);
558  }
Set< DocumentRelation > getAncestors()
Definition: Document.java:107
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getActualHqContacts()

Collection<Contact> org.turro.financials.entity.Document.getActualHqContacts ( )

Definition at line 646 of file Document.java.

646  {
647  ContactList l = new ContactList();
648  for(DocumentLine line : getDocumentLines()) {
649  if(!line.isEmpty()) {
650  Contract ctc = line.getStore();
651  if(ctc != null && ctc.getDepartment() != null && ctc.getDepartment().getHeadquarters() != null) {
652  l.add((Contact) ctc.getDepartment().getHeadquarters().getIContact().getContact());
653  }
654  }
655  }
656  return l;
657  }
Here is the call graph for this function:

◆ getAmounts()

DocumentAmounts org.turro.financials.entity.Document.getAmounts ( )

Definition at line 388 of file Document.java.

388  {
389  return new DocumentAmounts(this);
390  }
Here is the caller graph for this function:

◆ getAmountsByBook()

DocumentAmountsByBook org.turro.financials.entity.Document.getAmountsByBook ( BookDefinition  bookDefinition)

Definition at line 392 of file Document.java.

392  {
393  return new DocumentAmountsByBook(this, bookDefinition);
394  }

◆ getAncestors()

Set<DocumentRelation> org.turro.financials.entity.Document.getAncestors ( )

Definition at line 107 of file Document.java.

107  {
108  Dao dao = new FinancialsPU();
109  if(id > 0 && dao.isNotLoaded(ancestors)) {
110  ancestors = dao.lazyLoader(Document.class, this, "ancestors").ancestors;
111  }
112  return ancestors;
113  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBookNumber()

long org.turro.financials.entity.Document.getBookNumber ( )

Definition at line 782 of file Document.java.

782  {
783  if(!getRegisters().isEmpty()) {
784  Register register = getRegisters().iterator().next();
785  if(!register.getBookRegisters().isEmpty()) {
786  return register.getBookRegisters().iterator().next().getBookOrder();
787  }
788  }
789  return 0L;
790  }
Here is the call graph for this function:

◆ getCleanFullNotes()

String org.turro.financials.entity.Document.getCleanFullNotes ( )

Definition at line 354 of file Document.java.

354  {
355  return HtmlContent.noTags(MailUtils.cleanLinks(getFullNotes()));
356  }
Here is the call graph for this function:

◆ getConcept()

String org.turro.financials.entity.Document.getConcept ( )

Definition at line 346 of file Document.java.

346  {
347  PhraseBuilder pb = new PhraseBuilder();
348  for(DocumentLine dl : documentLines) {
349  pb.addWord(dl.getConcept());
350  }
351  return pb.toString();
352  }

◆ getContract()

Contract org.turro.financials.entity.Document.getContract ( )

Definition at line 119 of file Document.java.

119  {
120  return contract;
121  }
Here is the caller graph for this function:

◆ getContractFlows()

Collection<ContractFlow> org.turro.financials.entity.Document.getContractFlows ( )

Definition at line 615 of file Document.java.

615  {
616  return contract == null ? null : contract.getFlowFor(this);
617  }
Collection< ContractFlow > getFlowFor(Document document)
Definition: Contract.java:427
Here is the caller graph for this function:

◆ getCurrency()

Currency org.turro.financials.entity.Document.getCurrency ( )

Definition at line 128 of file Document.java.

128  {
129  if(currency == null && contract != null) {
130  currency = contract.getCurrency();
131  }
132  return currency;
133  }
Here is the caller graph for this function:

◆ getDefaultContractPreference()

ContractPreference org.turro.financials.entity.Document.getDefaultContractPreference ( )

Definition at line 429 of file Document.java.

429  {
430  if(getContract() != null) {
431  if(getContract().getContractPreferences().isEmpty()) {
433  } else {
434  return getContract().getContractPreferences().iterator().next();
435  }
436  }
437  return null;
438  }
ContractDefinition getContractDefinition()
Definition: Contract.java:125
Set< ContractPreference > getContractPreferences()
Definition: Contract.java:145
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDefaultLineType()

LineType org.turro.financials.entity.Document.getDefaultLineType ( )

Definition at line 717 of file Document.java.

717  {
718  LineType lt = null;
719  if(getDocumentDefinition() != null) {
720  for(RelatedLineType rlt : getDocumentDefinition().getRelatedLineTypes()) {
721  if(rlt.isDefaultLineType()) {
722  for(LineType l : getLineTypes()) {
723  if(rlt.getLineType().getId() == l.getId()) {
724  return l;
725  }
726  if(lt == null) lt = l;
727  }
728  }
729  }
730  }
731  return lt;
732  }
Collection< LineType > getLineTypes()
Definition: Document.java:734
Here is the caller graph for this function:

◆ getDefaultStore()

Contract org.turro.financials.entity.Document.getDefaultStore ( )

Definition at line 689 of file Document.java.

689  {
690  Collection<Contract> stores = getStores();
691  if(!stores.isEmpty()) {
692  return stores.iterator().next();
693  }
694  return null;
695  }
Collection< Contract > getStores()
Definition: Document.java:676

◆ getDescendants()

Set<DocumentRelation> org.turro.financials.entity.Document.getDescendants ( )

Definition at line 139 of file Document.java.

139  {
140  Dao dao = new FinancialsPU();
141  if(id > 0 && dao.isNotLoaded(descendants)) {
142  descendants = dao.lazyLoader(Document.class, this, "descendants").descendants;
143  }
144  return descendants;
145  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDocDescription()

String org.turro.financials.entity.Document.getDocDescription ( )

Definition at line 659 of file Document.java.

659  {
660  return getDocumentDefinition().getName() + ": " +
661  (getForcedView() == null ? "" : "(" + getForcedView().getName() + ") ") +
662  getDocumentNumber() + " " +
663  SimpleDateFormat.getDateInstance().format(documentDate);
664  }
Here is the caller graph for this function:

◆ getDocumentDate()

Date org.turro.financials.entity.Document.getDocumentDate ( )

Definition at line 159 of file Document.java.

159  {
160  return documentDate;
161  }
Here is the caller graph for this function:

◆ getDocumentDefinition()

DocumentDefinition org.turro.financials.entity.Document.getDocumentDefinition ( )

Definition at line 167 of file Document.java.

167  {
168  Dao dao = new FinancialsPU();
169  if(id > 0 && dao.isNotLoaded(documentDefinition)) {
170  setDocumentDefinition(dao.lazyLoader(Document.class, this, "documentDefinition").documentDefinition);
171  }
172  return documentDefinition;
173  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDocumentLines()

Set<DocumentLine> org.turro.financials.entity.Document.getDocumentLines ( )

Definition at line 180 of file Document.java.

180  {
181  return documentLines;
182  }
Here is the caller graph for this function:

◆ getDocumentNumber()

String org.turro.financials.entity.Document.getDocumentNumber ( )

Definition at line 188 of file Document.java.

188  {
189  return documentNumber;
190  }
Here is the caller graph for this function:

◆ getDocumentString()

String org.turro.financials.entity.Document.getDocumentString ( )

Definition at line 666 of file Document.java.

666  {
667  return getDocumentDefinition().getName() + " " + documentNumber + " " +
668  SimpleDateFormat.getDateInstance().format(documentDate);
669  }
Here is the caller graph for this function:

◆ getForcedView()

RegisterView org.turro.financials.entity.Document.getForcedView ( )

Definition at line 204 of file Document.java.

204  {
205  return forcedView;
206  }
Here is the caller graph for this function:

◆ getFullNotes()

String org.turro.financials.entity.Document.getFullNotes ( )

Definition at line 358 of file Document.java.

358  {
359  PhraseBuilder pb = new PhraseBuilder();
360  pb.addWord(notes);
361 // pb.addPendingSeparator(Chars.nl().repeat(2).toString());
362 // pb.addWord(getContract().getNotes());
363  pb.addPendingSeparator(Chars.nl().repeat(2).toString());
364  ContractDefinitionNotes cdNotes = getContract().getContractDefinition().getNotes();
365  if(cdNotes != null) {
366  pb.addWord(cdNotes.getNotes());
367  }
368  return pb.toString();
369  }
Here is the call graph for this function:

◆ getId()

long org.turro.financials.entity.Document.getId ( )

Definition at line 212 of file Document.java.

212  {
213  return id;
214  }
Here is the caller graph for this function:

◆ getLineTypes()

Collection<LineType> org.turro.financials.entity.Document.getLineTypes ( )

Definition at line 734 of file Document.java.

734  {
735  LineTypeSet result = new LineTypeSet();
736  if(getDocumentDefinition() != null && contract != null) {
737  LineTypeSet lts = new RelatedToLineTypeAdapter(getDocumentDefinition().getRelatedLineTypes());
738  for(LineType lt : lts) {
739  if(lt.getName().contains("%n")) {
740  if(contract.getContractPreferences().isEmpty()) {
741  LineType ltt = lt.clone();
742  ltt.setContractPreference(getDefaultContractPreference());
743  result.add(ltt);
744  } else {
745  for(ContractPreference cp : contract.getContractPreferences()) {
746  LineType ltt = lt.clone();
747  ltt.setContractPreference(cp);
748  result.add(ltt);
749  }
750  }
751  } else {
752  LineType ltt = lt.clone();
753  ltt.setContractPreference(getDefaultContractPreference());
754  result.add(ltt);
755  }
756  }
757  }
758  return result;
759  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMaxLineOrder()

int org.turro.financials.entity.Document.getMaxLineOrder ( )

Definition at line 697 of file Document.java.

697  {
698  int result = 0;
699  for(DocumentLine dl : getDocumentLines()) {
700  if(dl.getLineOrder() > result) {
701  result = dl.getLineOrder();
702  }
703  }
704  return result;
705  }
Here is the caller graph for this function:

◆ getNotes()

String org.turro.financials.entity.Document.getNotes ( )

Definition at line 236 of file Document.java.

236  {
237  return notes;
238  }
Here is the caller graph for this function:

◆ getQuote()

double org.turro.financials.entity.Document.getQuote ( )

Definition at line 244 of file Document.java.

244  {
245  return quote;
246  }

◆ getReceiptDate()

Date org.turro.financials.entity.Document.getReceiptDate ( )

Definition at line 252 of file Document.java.

252  {
253  return receiptDate;
254  }
Here is the caller graph for this function:

◆ getRegisters()

Set<Register> org.turro.financials.entity.Document.getRegisters ( )

Definition at line 260 of file Document.java.

260  {
261  return registers;
262  }
Here is the caller graph for this function:

◆ getRelated()

IElephantEntity org.turro.financials.entity.Document.getRelated ( )

Definition at line 328 of file Document.java.

328  {
329  return Entities.getController(relatedPath);
330  }
Here is the call graph for this function:

◆ getRelatedPath()

String org.turro.financials.entity.Document.getRelatedPath ( )

Definition at line 268 of file Document.java.

268  {
269  return relatedPath;
270  }

◆ getSerializerMappings()

MappingSet org.turro.financials.entity.Document.getSerializerMappings ( )

Definition at line 829 of file Document.java.

829  {
830  MappingSet set = new MappingSet();
831  set.addMapping(Document.class, 1,
832  new String[] { "id", "documentNumber", "documentDate" },
833  new String[] { "documentDefinition", "notes", "receiptDate", "draft", "documentLines",
834  "currency", "contract", "forcedView", "relatedPath", "ancestors", "descendants", "registers",
835  "conciliateRegister", "regularizeVAT", "regularizeIRPF", "noAncestors", "noDescendants" });
836  set.addMapping(DocumentDefinition.class, 2,
837  new String[] { "id", "name" },
838  null);
839  set.addMapping(Contract.class, 2,
840  new String[] { "id", "name" },
841  null);
842  set.addMapping(RegisterView.class, 2,
843  new String[] { "id", "name" },
844  null);
845  set.addMapping(DocumentRelation.class, 2,
846  null,
847  new String[] { "ancestor", "descendant" });
848  set.addMapping(Document.class, 3,
849  new String[] { "id" },
850  null);
851  set.addMapping(DocumentLine.class, 2,
852  new String[] { "quantity", "price", "tax", "retention", "discountPerCent", "discountMoney" },
853  new String[] { "concept", "product", "productByContractor", "store",
854  "lineType", "contractPreference"});
855  set.addMapping(Product.class, 3,
856  new String[] { "id", "productCode" },
857  new String[] { "description" });
858  set.addMapping(ProductByContractor.class, 3,
859  new String[] { "contractorCode" },
860  new String[] { "contract" });
861  set.addMapping(Contract.class, 4,
862  new String[] { "id", "name" },
863  null);
864  set.addMapping(Contract.class, 3,
865  new String[] { "id", "name" },
866  null);
867  set.addMapping(LineType.class, 3,
868  new String[] { "name" },
869  null);
870  set.addMapping(ContractPreference.class, 3,
871  new String[] { "name" },
872  null);
873 // set.addMapping(Register.class, 2,
874 // new String[] { "idRegister", "registerDate" },
875 // new String[] { "view", "registerEntries" });
876 // set.addMapping(RegisterView.class, 3,
877 // new String[] { "id", "name" },
878 // null);
879 // set.addMapping(RegisterEntry.class, 3,
880 // new String[] { "debit", "credit", "approved", "conciliated" },
881 // new String[] { "account" } );
882 // set.addMapping(Account.class, 4,
883 // new String[] { "id", "description" },
884 // null);
885  return set;
886  }

◆ getStores()

Collection<Contract> org.turro.financials.entity.Document.getStores ( )

Definition at line 676 of file Document.java.

676  {
677  if(_stores == null) {
678  _stores = new DocumentDefinitionWrapper(getDocumentDefinition())
679  .getRelatedStores(getContract());
680  if(_stores.isEmpty()) {
681  _stores = new DocumentDefinitionWrapper(getDocumentDefinition())
682  .getRelatedStores();
683  }
684  ContractWrapper.clearInactives(_stores);
685  }
686  return _stores;
687  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getSubTotal()

double org.turro.financials.entity.Document.getSubTotal ( )

Definition at line 421 of file Document.java.

◆ getTotalAmount()

double org.turro.financials.entity.Document.getTotalAmount ( )

Definition at line 425 of file Document.java.

Here is the caller graph for this function:

◆ getUpdatedDescendants()

Set<DocumentRelation> org.turro.financials.entity.Document.getUpdatedDescendants ( )

Definition at line 147 of file Document.java.

147  {
148  Dao dao = new FinancialsPU();
149  if(id > 0) {
150  descendants = dao.lazyLoader(Document.class, this, "descendants").descendants;
151  }
152  return descendants;
153  }

◆ getUsualPath()

String org.turro.financials.entity.Document.getUsualPath ( )

Definition at line 708 of file Document.java.

708  {
709  if(contract != null && getDocumentDefinition() != null) {
710  return contract.getUsualPath(getDocumentDefinition());
711  }
712  return "";
713  }
String getUsualPath(DocumentDefinition documentDefinition)
Definition: Contract.java:488
Here is the caller graph for this function:

◆ getWorkflows() [1/2]

Collection<DocumentWorkflow> org.turro.financials.entity.Document.getWorkflows ( )

Definition at line 619 of file Document.java.

619  {
620  return getWorkflows(true, true);
621  }
Collection< DocumentWorkflow > getWorkflows()
Definition: Document.java:619

◆ getWorkflows() [2/2]

Collection<DocumentWorkflow> org.turro.financials.entity.Document.getWorkflows ( boolean  forward,
boolean  missing 
)

Definition at line 623 of file Document.java.

623  {
624  if(forward && (!missing || getDescendants().isEmpty())) {
625  return new FinancialsPU().getResultList(
626  "select dw from DocumentWorkflow as dw " +
627  "where dw.ancestor = ? " +
628  "and dw.contractDefinition = ?",
629  new Object[] {
631  contract.getContractDefinition()
632  });
633  } else if(!forward && (!missing || getAncestors().isEmpty())) {
634  return new FinancialsPU().getResultList(
635  "select dw from DocumentWorkflow as dw " +
636  "where dw.descendant = ? " +
637  "and dw.contractDefinition = ?",
638  new Object[] {
640  contract.getContractDefinition()
641  });
642  }
643  return Collections.EMPTY_LIST;
644  }

◆ isBlank()

boolean org.turro.financials.entity.Document.isBlank ( )

Definition at line 336 of file Document.java.

336  {
337  Iterator<DocumentLine> itl = getDocumentLines().iterator();
338  while(itl.hasNext()) {
339  if(!itl.next().isEmpty()) {
340  return false;
341  }
342  }
343  return true;
344  }

◆ isConciliateRegister()

boolean org.turro.financials.entity.Document.isConciliateRegister ( )

Definition at line 797 of file Document.java.

797  {
798  return conciliateRegister;
799  }
transient boolean conciliateRegister
Definition: Document.java:795

◆ isDraft()

boolean org.turro.financials.entity.Document.isDraft ( )

Definition at line 196 of file Document.java.

196  {
197  return draft;
198  }
Here is the caller graph for this function:

◆ isEmpty()

boolean org.turro.financials.entity.Document.isEmpty ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 284 of file Document.java.

284  {
285  return documentLines.isEmpty() ||
286  isBlank() ||
287  !isValid() ||
288  documentDate == null ||
289  receiptDate == null;
290  }
Here is the caller graph for this function:

◆ isNoAncestors()

boolean org.turro.financials.entity.Document.isNoAncestors ( )

Definition at line 220 of file Document.java.

220  {
221  return noAncestors;
222  }

◆ isNoDescendants()

boolean org.turro.financials.entity.Document.isNoDescendants ( )

Definition at line 228 of file Document.java.

228  {
229  return noDescendants;
230  }

◆ isRegularizeIRPF()

boolean org.turro.financials.entity.Document.isRegularizeIRPF ( )

Definition at line 819 of file Document.java.

819  {
820  return regularizeIRPF;
821  }

◆ isRegularizeVAT()

boolean org.turro.financials.entity.Document.isRegularizeVAT ( )

Definition at line 808 of file Document.java.

808  {
809  return regularizeVAT;
810  }

◆ isValid()

boolean org.turro.financials.entity.Document.isValid ( )

Definition at line 332 of file Document.java.

332  {
333  return !(contract == null || getDocumentDefinition() == null);
334  }
Here is the caller graph for this function:

◆ prepareSave()

void org.turro.financials.entity.Document.prepareSave ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 293 of file Document.java.

293  {
294  IDaoEntity.super.prepareSave();
295  if(Strings.isBlank(documentNumber)) {
296  // Ensure not null value
297  if(draft) {
298  documentNumber = "";
299  } else {
300  if(forcedView == null) {
301  documentNumber = IdUtils.getMaxLongIdFromString(
302  new FinancialsPU(), "Document", "documentNumber",
303  new String[] {
304  "year(receiptDate) = " + new CheckDate(receiptDate).getYear(),
305  "documentDefinition_identifier = " + getDocumentDefinition().getId(),
306  "forcedView_identifier is null"
307  }) + "";
308  } else {
309  documentNumber = IdUtils.getMaxLongIdFromString(
310  new FinancialsPU(), "Document", "documentNumber",
311  new String[] {
312  "year(receiptDate) = " + new CheckDate(receiptDate).getYear(),
313  "documentDefinition_identifier = " + getDocumentDefinition().getId(),
314  "forcedView_identifier = " + forcedView.getId()
315  }) + "";
316  }
317  }
318  }
319  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setAncestors()

void org.turro.financials.entity.Document.setAncestors ( Set< DocumentRelation ancestors)

Definition at line 115 of file Document.java.

115  {
116  this.ancestors = ancestors;
117  }

◆ setConciliateRegister()

void org.turro.financials.entity.Document.setConciliateRegister ( boolean  conciliateRegister)

Definition at line 801 of file Document.java.

801  {
803  }

◆ setContract()

void org.turro.financials.entity.Document.setContract ( Contract  contract)

Definition at line 123 of file Document.java.

123  {
124  this.contract = contract;
125  _stores = null;
126  }
Here is the caller graph for this function:

◆ setCurrency()

void org.turro.financials.entity.Document.setCurrency ( Currency  currency)

Definition at line 135 of file Document.java.

135  {
136  this.currency = currency;
137  }
Here is the caller graph for this function:

◆ setDescendants()

void org.turro.financials.entity.Document.setDescendants ( Set< DocumentRelation descendants)

Definition at line 155 of file Document.java.

155  {
156  this.descendants = descendants;
157  }

◆ setDocumentDate()

void org.turro.financials.entity.Document.setDocumentDate ( Date  documentDate)

Definition at line 163 of file Document.java.

163  {
164  this.documentDate = documentDate;
165  }
Here is the caller graph for this function:

◆ setDocumentDefinition()

void org.turro.financials.entity.Document.setDocumentDefinition ( DocumentDefinition  documentDefinition)

Definition at line 175 of file Document.java.

175  {
176  this.documentDefinition = documentDefinition;
177  _stores = null;
178  }
Here is the caller graph for this function:

◆ setDocumentLines()

void org.turro.financials.entity.Document.setDocumentLines ( Set< DocumentLine documentLines)

Definition at line 184 of file Document.java.

184  {
185  this.documentLines = documentLines;
186  }

◆ setDocumentNumber()

void org.turro.financials.entity.Document.setDocumentNumber ( String  documentNumber)

Definition at line 192 of file Document.java.

192  {
193  this.documentNumber = documentNumber;
194  }
Here is the caller graph for this function:

◆ setDraft()

void org.turro.financials.entity.Document.setDraft ( boolean  draft)

Definition at line 200 of file Document.java.

200  {
201  this.draft = draft;
202  }
Here is the caller graph for this function:

◆ setForcedView()

void org.turro.financials.entity.Document.setForcedView ( RegisterView  forcedView)

Definition at line 208 of file Document.java.

208  {
209  this.forcedView = forcedView;
210  }

◆ setId()

void org.turro.financials.entity.Document.setId ( long  id)

Definition at line 216 of file Document.java.

216  {
217  this.id = id;
218  }

◆ setNoAncestors()

void org.turro.financials.entity.Document.setNoAncestors ( boolean  noAncestors)

Definition at line 224 of file Document.java.

224  {
225  this.noAncestors = noAncestors;
226  }

◆ setNoDescendants()

void org.turro.financials.entity.Document.setNoDescendants ( boolean  noDescendants)

Definition at line 232 of file Document.java.

232  {
233  this.noDescendants = noDescendants;
234  }

◆ setNotes()

void org.turro.financials.entity.Document.setNotes ( String  notes)

Definition at line 240 of file Document.java.

240  {
241  this.notes = notes;
242  }
Here is the caller graph for this function:

◆ setQuote()

void org.turro.financials.entity.Document.setQuote ( double  quote)

Definition at line 248 of file Document.java.

248  {
249  this.quote = quote;
250  }

◆ setReceiptDate()

void org.turro.financials.entity.Document.setReceiptDate ( Date  receiptDate)

Definition at line 256 of file Document.java.

256  {
257  this.receiptDate = receiptDate;
258  }
Here is the caller graph for this function:

◆ setRegisters()

void org.turro.financials.entity.Document.setRegisters ( Set< Register registers)

Definition at line 264 of file Document.java.

264  {
265  this.registers = registers;
266  }

◆ setRegularizeIRPF()

void org.turro.financials.entity.Document.setRegularizeIRPF ( boolean  regularizeIRPF)

Definition at line 823 of file Document.java.

823  {
825  }

◆ setRegularizeVAT()

void org.turro.financials.entity.Document.setRegularizeVAT ( boolean  regularizeVAT)

Definition at line 812 of file Document.java.

812  {
814  }

◆ setRelatedPath()

void org.turro.financials.entity.Document.setRelatedPath ( String  relatedPath)

Definition at line 272 of file Document.java.

272  {
273  this.relatedPath = relatedPath;
274  }

Member Data Documentation

◆ conciliateRegister

transient boolean org.turro.financials.entity.Document.conciliateRegister

Definition at line 795 of file Document.java.

◆ regularizeIRPF

transient boolean org.turro.financials.entity.Document.regularizeIRPF

Definition at line 817 of file Document.java.

◆ regularizeVAT

transient boolean org.turro.financials.entity.Document.regularizeVAT

Definition at line 806 of file Document.java.


The documentation for this class was generated from the following file: