◆ getContractorProduct()
static ProductByContractor org.turro.financials.product.ProductFactory.getContractorProduct |
( |
long |
contractorId, |
|
|
String |
contractorCode |
|
) |
| |
|
static |
Definition at line 82 of file ProductFactory.java.
83 if(contractorId < 1 || Strings.isBlank(contractorCode))
return null;
84 WhereClause wc =
new WhereClause();
85 wc.addClause(
"select pbc from ProductByContractor pbc");
86 wc.addClause(
"where pbc.contract.id = :id");
87 wc.addNamedValue(
"id", contractorId);
88 wc.addClause(
"and pbc.contractorCode = :code");
89 wc.addNamedValue(
"code", contractorCode);
90 List l =
new FinancialsPU().getResultList(wc, 1);
91 if(l !=
null && !l.isEmpty()) {
92 return (ProductByContractor) l.get(0);
◆ getProduct() [1/5]
static IProduct org.turro.financials.product.ProductFactory.getProduct |
( |
IProductKey |
productKey | ) |
|
|
static |
Definition at line 61 of file ProductFactory.java.
62 return getProduct(productKey.getProductId(), productKey.getProviderId(),
63 productKey.getProviderProductId(), productKey.getProductDescription());
static IProduct getProduct(long id)
◆ getProduct() [2/5]
static IProduct org.turro.financials.product.ProductFactory.getProduct |
( |
long |
contractorId, |
|
|
String |
contractorCode |
|
) |
| |
|
static |
Definition at line 51 of file ProductFactory.java.
52 IProduct product =
null;
55 product = pbc.getProduct();
56 product.setProductByContractor(pbc);
static ProductByContractor getContractorProduct(long contractorId, String contractorCode)
◆ getProduct() [3/5]
static IProduct org.turro.financials.product.ProductFactory.getProduct |
( |
long |
id | ) |
|
|
static |
Definition at line 37 of file ProductFactory.java.
38 if(
id < 1)
return null;
39 return new FinancialsPU().find(Product.class, (Long)
id);
◆ getProduct() [4/5]
static IProduct org.turro.financials.product.ProductFactory.getProduct |
( |
long |
productId, |
|
|
long |
providerId, |
|
|
long |
providerProductId, |
|
|
String |
description |
|
) |
| |
|
static |
Definition at line 66 of file ProductFactory.java.
67 if(providerProductId > 0) {
68 ProductByContractor pbc =
new FinancialsPU().find(ProductByContractor.class, providerProductId);
70 return pbc.getProduct();
76 if(!Strings.isBlank(description)) {
static IProduct getProductFromText(long contractorId, String text)
◆ getProduct() [5/5]
static IProduct org.turro.financials.product.ProductFactory.getProduct |
( |
String |
id | ) |
|
|
static |
Definition at line 42 of file ProductFactory.java.
43 if(Strings.isBlank(
id))
return null;
44 return (IProduct)
new FinancialsPU().getSingleResultOrNull(
45 "select prod from Product prod " +
46 "where prod.productCode = ?",
◆ getProductFromText()
static IProduct org.turro.financials.product.ProductFactory.getProductFromText |
( |
long |
contractorId, |
|
|
String |
text |
|
) |
| |
|
static |
Definition at line 149 of file ProductFactory.java.
150 String parts[] = text.split(Chars.forward().regexp().spaced().toString());
151 if(parts.length == 2) {
152 if(parts[0].startsWith(
"##")) {
153 return getProduct(contractorId, parts[0].substring(2));
154 }
else if(parts[0].startsWith(
"#")) {
155 IProduct prod =
getProduct(parts[0].substring(1));
159 }
else if(!Strings.isBlank(text)) {
162 if(text.matches(
"\\##.*")) {
163 prod =
getProduct(contractorId, text.substring(2));
165 }
else if(text.matches(
"\\#.*")) {
179 return new ProductUncoded(text);
static void setContractorProduct(IProduct product, long contractorId)
◆ getProducts()
static List<IProduct> org.turro.financials.product.ProductFactory.getProducts |
( |
long |
contractorId, |
|
|
String |
input |
|
) |
| |
|
static |
Definition at line 111 of file ProductFactory.java.
112 List<IProduct> list =
new ArrayList<>();
115 if(input.matches(
"\\##.*")) {
116 product =
getProduct(contractorId, input.substring(2));
117 if(product !=
null) list.add(product);
119 }
else if(input.matches(
"\\#.*")) {
121 if(product !=
null) list.add(product);
126 if(product !=
null) list.add(product);
128 if(product !=
null) list.add(product);
132 list.addAll(Product.getProducts(input,
true));
136 list.addAll(ProductUncoded.getProducts(input,
true));
139 if(list.size() < 10) {
140 list.addAll(Product.getProducts(input,
false));
143 if(list.size() < 10) {
144 list.addAll(ProductUncoded.getProducts(input,
false));
◆ setContractorProduct()
static void org.turro.financials.product.ProductFactory.setContractorProduct |
( |
IProduct |
product, |
|
|
long |
contractorId |
|
) |
| |
|
static |
Definition at line 97 of file ProductFactory.java.
98 if(contractorId < 1 || product ==
null)
return;
99 WhereClause wc =
new WhereClause();
100 wc.addClause(
"select pbc from ProductByContractor pbc");
101 wc.addClause(
"where pbc.contract.id = :id");
102 wc.addNamedValue(
"id", contractorId);
103 wc.addClause(
"and pbc.product.productCode = :code");
104 wc.addNamedValue(
"code", product.getProductCodeStr());
105 List l =
new FinancialsPU().getResultList(wc, 1);
106 if(l !=
null && !l.isEmpty()) {
107 product.setProductByContractor((ProductByContractor) l.get(0));
◆ setPriceTax()
static void org.turro.financials.product.ProductFactory.setPriceTax |
( |
DocumentLine |
dl, |
|
|
IProduct |
prod |
|
) |
| |
|
static |
Definition at line 184 of file ProductFactory.java.
185 if(dl.getPrice() == 0.0 && dl.getTax() == 0.0) {
186 LineType lt = dl.getLineType();
188 if(lt.getStockCoefficient() == -1) {
189 dl.setPrice(prod.getProductPrice());
190 dl.setTax(prod.getProductPriceTax());
191 }
else if(lt.getStockCoefficient() == 1) {
192 dl.setPrice(prod.getProductCost());
193 dl.setTax(prod.getProductCostTax());
The documentation for this class was generated from the following file: