/** * <p>Make description for warehouse entry.</p> * @param pEntity movement * @param pSource source of item * @return description **/ public final String makeDescription(final IMakingWarehouseEntry pEntity, final ADrawItemEntry pSource) { String strWho = getSrvI18n().getMsg(pEntity.getClass().getSimpleName() + "short") + " #" + getSrvOrm().getIdDatabase() + "-" //only local + pEntity.getItsId(); if (pEntity.getOwnerId() == null) { strWho += ", " + getDateFormatter().format(pEntity .getDocumentDate()); } else { strWho += " " + getSrvI18n().getMsg("in") + " " + getSrvI18n() .getMsg(getSrvTypeCode().getTypeCodeMap().get(pEntity.getOwnerType()) .getSimpleName() + "short") + " #" + getSrvOrm().getIdDatabase() + "-" + pEntity.getOwnerId() + ", " + getDateFormatter().format(pEntity.getDocumentDate()); } String strFrom = " " + getSrvI18n().getMsg("from") + " " + getSrvI18n() .getMsg(getSrvTypeCode().getTypeCodeMap().get(pSource.getSourceType()) .getSimpleName() + "short") + " #" + getSrvOrm().getIdDatabase() + "-" + pSource.getSourceId(); return getSrvI18n().getMsg("made_at") + " " + getDateFormatter().format( new Date()) + " " + getSrvI18n().getMsg("by") + " " + strWho + strFrom; }
/** * <p>Query loader.</p> * @param pFileName File Name * @return String * @throws Exception - an exception **/ public final String lazyGetQuery(final String pFileName) throws Exception { if (this.queries.get(pFileName) == null) { String flName = "/" + "accounting" + "/" + "trade" + "/" + pFileName + ".sql"; this.queries.put(pFileName, loadString(flName)); } return this.queries.get(pFileName); }
DateFormat dateFormat = DateFormat.getDateTimeInstance( DateFormat.MEDIUM, DateFormat.SHORT, new Locale(langDef)); String strWho = getSrvI18n().getMsg(pEntity.getClass().getSimpleName() + "short", langDef) + " #" + getSrvOrm().getIdDatabase() + "-"//only local + pEntity.getItsId(); if (pEntity.getOwnerId() == null) { strWho += ", " + dateFormat.format(pEntity.getDocumentDate()); } else { strWho += " " + getSrvI18n().getMsg("in", langDef) + " " + getSrvI18n() .getMsg(getSrvTypeCode().getTypeCodeMap().get(pEntity.getOwnerType()) .getSimpleName() + "short", langDef) + " #" + getSrvOrm().getIdDatabase() + "-" + pEntity.getOwnerId() + ", " + dateFormat.format(pEntity.getDocumentDate()); String strFrom = " " + getSrvI18n().getMsg("from", langDef) + " " + getSrvI18n().getMsg(getSrvTypeCode().getTypeCodeMap() .get(pSource.getSourceType()).getSimpleName() + "short", langDef) + " #" + getSrvOrm().getIdDatabase() + "-" + pSource.getSourceId(); return getSrvI18n().getMsg("made_at", langDef) + " " + dateFormat.format( new Date()) + " " + getSrvI18n().getMsg("by", langDef) + " " + strWho + strFrom;
final Long pDrawingOwnerId) throws Exception { if (!pEntity.getIdDatabaseBirth() .equals(getSrvOrm().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_make_di_entry_for_foreign_src"); String queryMain = lazyGetQuery(srvAccSettings.lazyGetAccSettings(). getCogsMethod().getFileName()); StringBuffer sb = new StringBuffer(); int i = 0; for (ADrawItemSourcesLine drawItemSourceLine : getDrawItemSources()) { if (drawItemSourceLine.getIsUsed()) { String query = lazyGetQuery(drawItemSourceLine.getFileName()); query = query.replace(":IDDATABASEBIRTH", String.valueOf(getSrvOrm() .getIdDatabase())); query = query.replace(":INVITEM", pEntity.getInvItem() IRecordSet<RS> recordSet = null; try { recordSet = getSrvDatabase().retrieveRecords(queryMain); if (recordSet.moveToFirst()) { do { Long sourceId = getSrvDatabase().getSrvRecordRetriever() .getLong(recordSet.getRecordSet(), "SOURCEID"); Integer sourceType = getSrvDatabase().getSrvRecordRetriever() .getInteger(recordSet.getRecordSet(), "SOURCETYPE"); Long sourceOwnerId = getSrvDatabase().getSrvRecordRetriever() .getLong(recordSet.getRecordSet(), "SOURCEOWNERID"); Integer sourceOwnerType = getSrvDatabase().getSrvRecordRetriever()
final Long pDrawingOwnerId) throws Exception { if (!pEntity.getIdDatabaseBirth() .equals(getSrvOrm().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_make_di_entry_for_foreign_src"); String tblNm = getDrawItemEntryClass().getSimpleName().toUpperCase(); List<T> diel = getSrvOrm().retrieveListWithConditions(pAddParam, getDrawItemEntryClass(), " where DRAWINGTYPE=" + pEntity.constTypeCode() + " and " + tblNm + ".IDDATABASEBIRTH=" + getSrvOrm().getIdDatabase() + " and DRAWINGID=" + pEntity.getReversedId()); BigDecimal quantityToLeaveRst = pEntity.getItsQuantity(); T die = createDrawItemEntry(pAddParam); die.setItsDate(pDateAccount); die.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); die.setSourceType(dies.getSourceType()); die.setSourceId(dies.getSourceId()); die.setDescription(makeDescription(pAddParam, pEntity, dies) + " " + getSrvI18n().getMsg("reversed_entry_n", langDef) + getSrvOrm().getIdDatabase() + "-" + dies.getItsId()); getSrvOrm().insertEntity(pAddParam, die); die.setIsNew(false); @SuppressWarnings("unchecked") dies.setReversedId(die.getItsId()); dies.setDescription(dies.getDescription() + " " + getSrvI18n().getMsg("reversing_entry_n", langDef)
final BigDecimal pQuantityToDraw) throws Exception { if (!pEntity.getIdDatabaseBirth() .equals(getSrvOrm().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_make_di_entry_for_foreign_src"); T die = createDrawItemEntry(pAddParam); die.setItsDate(pEntity.getDocumentDate()); die.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); die.setSourceType(pSource.constTypeCode()); die.setSourceId(pSource.getItsId()); die.setUnitOfMeasure(pEntity.getUnitOfMeasure()); die.setItsTotal(pSource.getItsCost(). multiply(die.getItsQuantity()).setScale(getSrvAccSettings() .lazyGetAccSettings(pAddParam).getCostPrecision(), getSrvAccSettings() .lazyGetAccSettings(pAddParam).getRoundingMode())); die.setDescription(makeDescription(pAddParam, pEntity, die)); this.srvOrm.insertEntity(pAddParam, die); die.setIsNew(false);
docId = pEntity.getIdBirth(); String tblNm = getDrawItemEntryClass().getSimpleName().toUpperCase(); if (pEntity instanceof IDrawItemSource) { where = " where SOURCETYPE=" + pEntity.constTypeCode() result = getSrvOrm().retrieveListWithConditions(pAddParam, getDrawItemEntryClass(), where); where = null; result = getSrvOrm().retrieveListWithConditions(pAddParam, getDrawItemEntryClass(), where); } else { result.addAll(getSrvOrm().retrieveListWithConditions(pAddParam, getDrawItemEntryClass(), where)); result = getSrvOrm().retrieveListWithConditions(pAddParam, getDrawItemEntryClass(), where); } else { result.addAll(getSrvOrm().retrieveListWithConditions(pAddParam, getDrawItemEntryClass(), where));
final Long pDrawingOwnerId) throws Exception { if (!pEntity.getIdDatabaseBirth() .equals(getSrvOrm().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_make_di_entry_for_foreign_src"); String queryMain = lazyGetQuery(srvAccSettings .lazyGetAccSettings(pAddParam).getCogsMethod().getFileName()); StringBuffer sb = new StringBuffer(); int i = 0; for (ADrawItemSourcesLine drawItemSourceLine : getDrawItemSources(pAddParam)) { if (drawItemSourceLine.getIsUsed()) { String query = lazyGetQuery(drawItemSourceLine.getFileName()); query = query.replace(":IDDATABASEBIRTH", String.valueOf(getSrvOrm() .getIdDatabase())); query = query.replace(":INVITEM", pEntity.getInvItem() IRecordSet<RS> recordSet = null; try { recordSet = getSrvDatabase().retrieveRecords(queryMain); if (recordSet.moveToFirst()) { do { BigDecimal theRest = BigDecimal .valueOf(recordSet.getDouble("THEREST")); T source = createDrawItemEntry(pAddParam); source.setSourceId(sourceId); source.setSourceType(sourceType);
final Long pDrawingOwnerId) throws Exception { if (!pEntity.getIdDatabaseBirth() .equals(getSrvOrm().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_make_di_entry_for_foreign_src"); String tblNm = getDrawItemEntryClass().getSimpleName().toUpperCase(); List<T> diel = getSrvOrm().retrieveListWithConditions( getDrawItemEntryClass(), " where DRAWINGTYPE=" + pEntity.constTypeCode() + " and " + tblNm + ".IDDATABASEBIRTH=" + getSrvOrm().getIdDatabase() + " and DRAWINGID=" + pEntity.getReversedId()); BigDecimal quantityToLeaveRst = pEntity.getItsQuantity(); T die = createDrawItemEntry(); die.setItsDate(pDateAccount); die.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); die.setSourceType(dies.getSourceType()); die.setSourceId(dies.getSourceId()); die.setDescription(makeDescription(pEntity, dies) + " " + getSrvI18n().getMsg("reversed_entry_n") + getSrvOrm().getIdDatabase() + "-" + dies.getItsId()); getSrvOrm().insertEntity(die); IDrawItemSource drawed = (IDrawItemSource) srvOrm .retrieveEntityById(srvTypeCode.getTypeCodeMap() dies.setReversedId(die.getItsId()); dies.setDescription(dies.getDescription() + " " + getSrvI18n().getMsg("reversing_entry_n")
final BigDecimal pQuantityToDraw) throws Exception { if (!pEntity.getIdDatabaseBirth() .equals(getSrvOrm().getIdDatabase())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "can_not_make_di_entry_for_foreign_src"); T die = createDrawItemEntry(); die.setItsDate(pEntity.getDocumentDate()); die.setIdDatabaseBirth(getSrvOrm().getIdDatabase()); die.setSourceType(pSource.constTypeCode()); die.setSourceId(pSource.getItsId()); die.setUnitOfMeasure(pEntity.getUnitOfMeasure()); die.setItsTotal(pSource.getItsCost(). multiply(die.getItsQuantity()).setScale(getSrvAccSettings() .lazyGetAccSettings().getCostPrecision(), getSrvAccSettings() .lazyGetAccSettings().getRoundingMode())); die.setDescription(makeDescription(pEntity, die)); this.srvOrm.insertEntity(die); pSource.setTheRest(pSource.getTheRest().subtract(pQuantityToDraw));
docId = pEntity.getIdBirth(); String tblNm = getDrawItemEntryClass().getSimpleName().toUpperCase(); if (pEntity instanceof IDrawItemSource) { where = " where SOURCETYPE=" + pEntity.constTypeCode() result = getSrvOrm().retrieveListWithConditions( getDrawItemEntryClass(), where); where = null; result = getSrvOrm().retrieveListWithConditions( getDrawItemEntryClass(), where); } else { result.addAll(getSrvOrm().retrieveListWithConditions( getDrawItemEntryClass(), where)); result = getSrvOrm().retrieveListWithConditions( getDrawItemEntryClass(), where); } else { result.addAll(getSrvOrm().retrieveListWithConditions( getDrawItemEntryClass(), where));
/** * <p>Query loader.</p> * @param pFileName File Name * @return String * @throws Exception - an exception **/ public final String lazyGetQuery(final String pFileName) throws Exception { if (this.queries.get(pFileName) == null) { String flName = "/" + "accounting" + "/" + "trade" + "/" + pFileName + ".sql"; this.queries.put(pFileName, loadString(flName)); } return this.queries.get(pFileName); }