diff --git a/.gitignore b/.gitignore index 45f81bdd..e1ed922b 100644 --- a/.gitignore +++ b/.gitignore @@ -66,4 +66,6 @@ www/admin/_V4/** www/csv/** www/admin/_sounds/** www/mp3/** -faceai/logs/** \ No newline at end of file +faceai/logs/** +local-jsp-docker/runtime/ +/db/ \ No newline at end of file diff --git a/LOCAL_DEV_JSP_DOCKER_ANALYSIS.md b/LOCAL_DEV_JSP_DOCKER_ANALYSIS.md new file mode 100644 index 00000000..40c95fe4 --- /dev/null +++ b/LOCAL_DEV_JSP_DOCKER_ANALYSIS.md @@ -0,0 +1,402 @@ +# Local JSP Docker Analysis + +## Goal + +Turn the public `www` site plus the legacy `rus` admin menu/runtime into a Docker-based local development environment with: + +- full JSP and servlet execution +- enough filesystem layout to satisfy docbase-based file lookups +- a mocked MySQL-compatible database that lets the app boot and the admin menu render +- a workflow that supports editing JSPs and restarting quickly during local development + +This document is an implementation analysis, not a finished deployment recipe. + +## What The Live System Actually Looks Like + +Read-only checks on `83.149.164.4` show the production site is not running from a packaged WAR. It is running from an exploded Tomcat webapp: + +- OS: FreeBSD 14.2 +- Java: OpenJDK 11.0.25 +- Tomcat: 9.0.102 +- `catalina.home` and `catalina.base`: `/usr/local/apache-tomcat-9.0` +- Tomcat `server.xml` contains a dedicated host for `www.regalamiunsorriso.it` +- The live context for `/` points at `/home/sites/regalamiunsorriso/www/` +- Tomcat AJP is enabled on port `8009` + +Important nuance: + +- `/home/sites/regalamiunsorriso/www/WEB-INF` is a real directory +- `/home/sites/regalamiunsorriso/rus/WEB-INF` is also a real directory +- the live `www/WEB-INF/lib` is much larger than `rus/WEB-INF/lib` +- the live `rus/WEB-INF/classes` contains the DB property files +- the live `www/WEB-INF/classes` appears minimal +- Tomcat `server.xml` maps the live public host only to `/home/sites/regalamiunsorriso/www/` +- no live Tomcat `Context` for `/home/sites/regalamiunsorriso/rus/` was visible in `server.xml` + +That means the runtime is split across two legacy trees, but the currently mapped live webapp is `www`. For local Docker work, assuming `www` alone is sufficient would still be unsafe, because the older `rus` tree remains the clearest source of legacy admin code, schema SQL, and bootstrap logic. + +## What The Repo Shows + +### `www` + +The `www` tree is the public web root and already includes: + +- JSP pages +- `WEB-INF/web.xml` +- taglibs such as `acxent.tld`, `pg.tld`, `news.tld`, `cc.tld` +- a large `WEB-INF/lib` with modernized `it.acxent.*` jars +- an `admin/menu` tree with JSP admin UI + +Evidence of the rename/migration is strong in `www`: + +- JSPs import `it.acxent.*` +- `www/WEB-INF/web.xml` maps servlets under `it.acxent.*` +- `www/WEB-INF/lib` contains `acxent-core`, `acxent-common`, `acxent-face`, and related jars + +The current `www/WEB-INF/web.xml` shows: + +- servlet/filter mappings for JSP and rewritten `.html` URLs +- admin menu servlet mappings under `/admin/menu/*` +- startup servlets that update DB structures on boot +- DB config pointing to MySQL-compatible settings +- direct dependence on application parameters and filesystem-backed assets + +### `rus` + +The `rus` tree contains the older admin/runtime stack and still matters for local development: + +- `rus/WEB-INF/web.xml` is another full Java webapp descriptor +- `rus/admin/menu` contains the older admin dashboard JSPs +- `rus/WEB-INF/lib/*_src` contains source code for key servlet, DB, and parameter logic +- `rus/admin/_alterTable/pg2rus.sql` contains a large schema for the application domain, including `GARA`, `TIPO_GARA`, `PUNTO_FOTO`, `ACCESS`, `USER_ACCESS`, and `LOG_FOTO` +- `rus/WEB-INF/classes/dbcomuni.properties` sets `USE_PARM_HT=true` + +Evidence that `rus` is the older lineage is equally strong: + +- `rus/admin/menu` JSPs import `com.ablia.*` +- `rus/WEB-INF/web.xml` maps servlets under `com.ablia.*` +- `rus/WEB-INF/lib` contains `ablia.jar`, `abliaDbCom.jar`, and multiple `*_src` trees +- `rus/WEB-INF/lib/decomp.bat` suggests this tree has already been treated as a reverse-engineering or recovery surface rather than a clean source distribution + +This is also where the clearest bootstrap logic lives. `Parm.java` seeds defaults for some records such as: + +- `SINGLE_SIGN_ON=false` +- `LOGO_MENU=Titolo Applicazione` +- `PATH_TMP=_tmp/` +- `MAIL_MSG_PATH_MAILER=mailMessage/` +- `REWRITE_URL_FILE_PATH=/admin/_alterTable/` + +That helps, but it does not remove the need for a real schema or baseline user/access data. + +## Migration Interpretation + +The evidence supports this interpretation of the `ablia` to `acxent` transition: + +- the active public runtime has moved to the `acxent` namespace and libraries under `www` +- the `rus` tree is still valuable, but it is a legacy `ablia` runtime/reference tree rather than the clean current implementation +- the live host mapping reinforces that shift, because Tomcat serves `www` and does not visibly publish `rus` as its own live host context + +That means the safest handling is: + +- keep the current `rus` tree as a legacy backup/reference +- do not treat the existing `rus` tree as the current canonical codebase +- if you want a fresh, updated `rus`-equivalent admin/runtime tree, obtain it separately and preserve it as a new artifact rather than overwriting this legacy one +- if the fresh artifact is delivered only as jars or compiled classes, decompiling those classes into a browsable source mirror is reasonable for local analysis and maintenance + +What the current evidence does not prove: + +- that such a fresh downloadable `rus` tree is already present in this repo +- that the live server still executes `rus` directly for public requests + +So the evidence supports the preservation and decompilation strategy, but not a claim that this repository already contains the fresh replacement. + +### The Admin Boundary + +There are effectively two admin surfaces in the repo: + +- `www/admin/menu`, using the newer `it.acxent.*` stack +- `rus/admin/menu`, using the older `com.ablia.*` stack + +The `www` admin menu already contains compatibility links such as `/admin/pg_RUS/Gara`, which is a strong sign that the public app has been carrying forward legacy admin functionality instead of replacing it cleanly. + +For Docker, that means there are two viable targets: + +1. boot only the `www` webapp and bring over enough `rus` data/assets to satisfy the legacy admin links +2. boot both `www` and `rus` as separate Tomcat contexts and keep the boundary explicit + +The second option is safer for analysis and migration because it matches the repository reality better. + +## What “Full JSP Support” Actually Requires + +To satisfy the request, a local container must support more than static JSP rendering. + +It needs: + +- Tomcat 9 with JSP compilation enabled +- Java 11 first, because that is what production is currently running +- exploded webapp deployment so JSP edits are visible without rebuilding a WAR each time +- both taglib trees and both `WEB-INF/lib` trees available at runtime +- a writable temp/work area for Tomcat compiled JSPs +- a writable app docbase for uploads, generated files, CSV imports, image lookups, and mail templates +- a MySQL-compatible database reachable by the app at startup + +It also needs to tolerate the app's legacy assumptions: + +- path concatenation against `DOCBASE` +- direct filesystem existence checks inside taglibs and servlets +- startup DB mutation via `InitUpdateDbSvlt` +- servlet code that chooses JSP pages dynamically based on `ACCESS`, request params, and file existence + +## Data Strategy + +The application does not just query a few content tables. It uses the database as runtime configuration. + +For this codebase, the most practical local-development strategy is not to handcraft mock rows first. It is to start from a dump of the real production-shaped database and trim or sanitize later if needed. + +This is now directly supported by the local workspace state. The following dumps already exist under `db/`: + +- `dump-pg-202604211927.sql` +- `dump-pg_log-202604211930.sql` +- `dump-mysql-202604211926.sql` +- `dump-performance_schema-202604211926.sql` +- `dump-sys-202604211930.sql` + +For local development, `dump-pg-202604211927.sql` should be treated as the primary seed source. + +At minimum, local boot for useful development will require: + +- `PARM` +- `USERS` +- `USER_PROFILE` +- `ACCESS` +- `USER_ACCESS` +- `TABLE_DESC` +- photo/event tables such as `GARA`, `TIPO_GARA`, `PUNTO_FOTO`, and likely additional related tables referenced by the servlets + +The admin menu depends on both authentication and metadata-driven routing. A DB with only schema and no seed data will not be enough. + +There are some useful seed hints already in the repo: + +- old user/profile bootstrap SQL under `www/admin/_alterTable/_old` +- schema SQL under `rus/admin/_alterTable/pg2rus.sql` +- parameter defaults embedded in `rus/WEB-INF/lib/ablia_src/com/ablia/common/Parm.java` + +What is missing from the repo is not raw data, but a curated minimal subset and a documented import procedure for local use. + +If you use the real dump as the starting point, the first local milestone becomes: + +- import the real `pg` dump locally +- override the environment-sensitive values after import, especially `PARM.DOCBASE` and any mailer or file-path settings +- document one admin login and one public sample flow that are known to work against the imported snapshot + +This is materially easier and more faithful than trying to synthesize a coherent mock dataset from schema alone. + +## Recommended Docker Shape + +### Recommendation + +Build a multi-service local stack with one shared source volume and one MySQL service. + +Suggested services: + +- `tomcat-www`: Tomcat 9 serving `www` as the ROOT webapp +- `tomcat-rus`: Tomcat 9 serving `rus` at `/rus` or `/admin-rus` +- `mysql`: MySQL 8 or MariaDB 10.11 used only for local development + +Optional but useful: + +- `nginx`: reverse proxy that exposes one friendly local hostname and routes `/` to `tomcat-www` and `/rus` to `tomcat-rus` + +Why this is the best first step: + +- it preserves both legacy runtimes instead of prematurely merging them +- it allows JSP edits against exploded directories +- it gives you a clean place to prove which admin flows still belong to `rus` +- it minimizes risky assumptions about the live cross-tree wiring + +### Alternative + +Run only one Tomcat container with `www` as ROOT and manually overlay selected `rus` assets into it. + +This is possible, but I would not start there because: + +- it bakes in guesses about a split runtime that is already unclear +- it makes failures look like classpath bugs even when the problem is missing legacy assets +- it is harder to reason about during early local bring-up + +## Filesystem Layout Needed Inside Docker + +A working local setup should not rely only on the web roots. It should create an application docbase volume as well. + +Suggested mounted paths: + +- `/workspace/www` -> repo `www` +- `/workspace/rus` -> repo `rus` +- `/data/docbase` -> local writable application docbase +- `/data/docbase/_tmp` -> temp uploads and generated files +- `/data/docbase/admin/csv` -> CSV import/export location used by admin code +- `/usr/local/tomcat/work` -> writable JSP compilation cache + +Then seed `PARM.DOCBASE` in local DB to `/data/docbase/`. + +Without that, a large amount of JSP and servlet code will fail on file existence checks even if the JSP compiler itself works. + +## DB Strategy + +### Practical Target + +Use MySQL-compatible SQL, not H2. + +Reasons: + +- production points to MySQL-compatible configuration +- legacy SQL and update scripts are written for that family +- dynamic SQL and driver assumptions are unlikely to be portable to H2 without patches + +### Preferred Seed Plan + +The local DB should be assembled in layers, but the first layer should now be the real dump rather than repo SQL alone: + +1. import `db/dump-pg-202604211927.sql` into the local MySQL-compatible container +2. apply local-only overrides for environment-sensitive `PARM` values +3. import optional auxiliary dumps only if the chosen local workflows need them +4. document one known-good login and one known-good public sample flow +5. only then consider trimming or anonymizing for a lighter-weight developer dataset + +This shifts the main implementation work item from “invent a stable dataset” to “stabilize a production-shaped snapshot for local use.” + +### Required Local Overrides After Import + +Even with the real dump, local development still needs a few post-import adjustments. + +At minimum, review or override: + +- `DOCBASE=/data/docbase/` +- `PATH_TMP=_tmp/` +- `MAIL_MSG_PATH_MAILER` if local mail-template resolution should stay inside the repo/docbase +- any path-oriented `PARM` values that point at production-only filesystem locations +- any credentials or integration flags that should not target live services from a developer machine + +The important change is that users, profiles, access metadata, and most domain rows should come from the real dump first, not from a hand-built minimal seed. + +## What Will Probably Break First + +These are the highest-probability local bring-up failures. + +### 1. Incomplete DB Seed + +Most likely symptom: + +- menu renders partially or login works but navigation fails +- JSPs throw nulls around `Parm`, `Access`, or user profile resolution + +### 2. Missing Filesystem Assets Under `DOCBASE` + +Most likely symptom: + +- image checks fail +- CSV import/export paths fail +- mail template lookups fail +- servlet code throws `FileNotFoundException` or silently renders degraded UI + +### 3. Mixed Legacy Classpaths + +Most likely symptom: + +- one context starts while the other fails on missing classes, conflicting libs, or older APIs + +Running two Tomcat contexts is the easiest way to isolate this. + +### 4. Rewrite And Context Path Assumptions + +Most likely symptom: + +- `.html` routes or menu links resolve incorrectly when not hosted exactly like production + +This is manageable, but local routing should be explicit. + +## Estimated Work Breakdown + +### Phase 1: Container Bring-Up + +Expected effort: low to medium. + +Deliverables: + +- Docker Compose file +- Tomcat Dockerfile or runtime image selection +- exploded mounting of `www` and `rus` +- MySQL service +- baseline local environment variables and startup scripts + +### Phase 2: Local DB Import And Stabilization + +Expected effort: medium to high. + +Deliverables: + +- repeatable import of `db/dump-pg-202604211927.sql` +- local override script for environment-sensitive `PARM` rows +- one documented admin test login +- one documented public sample race/photo flow + +This is the real critical path. + +### Phase 3: Runtime Stabilization + +Expected effort: medium. + +Deliverables: + +- working `DOCBASE` directory layout +- local rewrite compatibility +- sample assets so photo/event pages can render without production storage +- a short smoke-test checklist + +## The Smallest Sensible First Implementation + +If the goal is a usable development environment quickly, the best first slice is: + +1. one Tomcat 9 container for `www` +2. one MySQL container +3. import the real `pg` dump and apply a small set of local `PARM` overrides +4. expose the `www/admin/menu` dashboard first +5. add a second `rus` context only when a missing admin flow proves it is still needed + +If the goal is completeness and fewer hidden assumptions, start with both contexts immediately. + +Given the current repo and the server findings, I would still design the Docker setup so a second `rus` context can be added without reworking the stack. + +## Recommendation Summary + +This is feasible, but the hard part is not Docker. + +The hard part is stabilizing a production-shaped local runtime contract across: + +- two legacy web trees +- a metadata-driven admin UI +- filesystem-backed application behavior +- a DB that acts as both content store and runtime config store + +### What It Would Take + +- Tomcat 9 on Java 11 +- exploded deployment of `www`, and probably `rus` as well +- a writable local docbase mounted outside the web roots +- a MySQL-compatible local database +- import of the real `pg` dump plus a deliberate set of local overrides for environment-sensitive rows +- a short compatibility pass on rewrite behavior and admin links + +### Overall Assessment + +Containerizing the JSP runtime is straightforward. + +Making it genuinely useful for local development is still a moderate migration task, but the existence of the real local DB dump changes the shape of the work. The cleanest path is to import the real `pg` snapshot, override the environment-sensitive parts, treat `www` as the active `acxent` runtime, and retain `rus` as a legacy `ablia` reference tree unless and until a fresh updated replacement is obtained and decompiled. + +## Suggested Next Deliverables + +If this analysis is accepted, the next implementation docs should be: + +1. a concrete `docker-compose.yml` design +2. a `local-db-import-plan.md` covering dump import plus local `PARM` overrides +3. a `local-smoke-test.md` covering login, admin dashboard, one public event page, and one file-backed operation \ No newline at end of file diff --git a/analyze_dump.py b/analyze_dump.py new file mode 100644 index 00000000..ff667f5d --- /dev/null +++ b/analyze_dump.py @@ -0,0 +1,64 @@ +import sys +import re +import os + +filepath = r"db/dump-pg-202604211927.sql" +filesize = os.path.getsize(filepath) + +# Pattern for MySQL-style INSERT INTO `table` +pattern = re.compile(rb"^INSERT INTO `([^`]+)`", re.IGNORECASE) + +stats = {} + +with open(filepath, "rb") as f: + for line in f: + line_len = len(line) + match = pattern.search(line) + if match: + table_name = match.group(1).decode("utf-8", errors="ignore") + if table_name not in stats: + stats[table_name] = {"bytes": 0, "count": 0} + stats[table_name]["bytes"] += line_len + stats[table_name]["count"] += 1 + +results = [] +for table, data in stats.items(): + results.append({ + "table": table, + "payload_mb": round(data["bytes"] / (1024 * 1024), 2), + "payload_pct": round((data["bytes"] / filesize) * 100, 2), + "insert_statements": data["count"], + "bytes": data["bytes"] + }) + +results.sort(key=lambda x: x["bytes"], reverse=True) + +top_20 = results[:20] +top_20_names = {r["table"] for r in top_20} + +special_names = {"log_foto", "clifor", "users", "news_users", "coda_messaggi", "clifor_log", "banner_stats", "access_log"} +special_substrings = ["log", "queue", "messaggi", "session", "temp", "stats", "foto"] + +def is_special(name): + if name in special_names: return True + name_lower = name.lower() + for sub in special_substrings: + if sub in name_lower: return True + return False + +# Collect all that match special criteria +special_rows = [r for r in results if is_special(r["table"])] +special_names_found = {r["table"] for r in special_rows} + +# Combine top 20 and special rows +output_rows_set = {r["table"]: r for r in top_20} +for r in special_rows: + output_rows_set[r["table"]] = r + +output_rows = list(output_rows_set.values()) +output_rows.sort(key=lambda x: x["bytes"], reverse=True) + +print(f"{'table':<30} | {'payload_mb':>10} | {'payload_pct':>11} | {'insert_statements':>17}") +print("-" * 75) +for r in output_rows: + print(f"{r['table']:<30} | {r['payload_mb']:>10.2f} | {r['payload_pct']:>10.2f}% | {r['insert_statements']:>17}") diff --git a/decompiled-libs/www/acxent-bank-1.0.1/META-INF/MANIFEST.MF b/decompiled-libs/www/acxent-bank-1.0.1/META-INF/MANIFEST.MF new file mode 100644 index 00000000..e6558cdf --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/META-INF/MANIFEST.MF @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +Archiver-Version: Plexus Archiver +Created-By: Apache Maven 3.8.7 +Built-By: jenkins +Build-Jdk: 17.0.16 + diff --git a/decompiled-libs/www/acxent-bank-1.0.1/META-INF/maven/it.acxent/acxent-bank/pom.properties b/decompiled-libs/www/acxent-bank-1.0.1/META-INF/maven/it.acxent/acxent-bank/pom.properties new file mode 100644 index 00000000..25ccf4bc --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/META-INF/maven/it.acxent/acxent-bank/pom.properties @@ -0,0 +1,3 @@ +artifactId=acxent-bank +groupId=it.acxent +version=1.0.1 diff --git a/decompiled-libs/www/acxent-bank-1.0.1/META-INF/maven/it.acxent/acxent-bank/pom.xml b/decompiled-libs/www/acxent-bank-1.0.1/META-INF/maven/it.acxent/acxent-bank/pom.xml new file mode 100644 index 00000000..cc905cf1 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/META-INF/maven/it.acxent/acxent-bank/pom.xml @@ -0,0 +1,86 @@ + + 4.0.0 + it.acxent + acxent-bank + 1.0.1 + Acxent Banche + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + 11 + 11 + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.7.0 + + + org.apache.maven.plugins + maven-toolchains-plugin + 3.1.0 + + + + toolchain + + + + + + + 11 + + + + + + + + + github-repo + GitHub acolzi Apache Maven Packages + https://maven.pkg.github.com/acolzi/repo + + + + + github-repo + GitHub Repository + https://maven.pkg.github.com/acolzi/repo + + + + + com.stripe + stripe-java + 22.29.0 + + + com.paypal.sdk + checkout-sdk + 2.0.0 + + + it.acxent + acxent-core + 1.0.1 + + + + \ No newline at end of file diff --git a/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/AuthorizeOrder.java b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/AuthorizeOrder.java new file mode 100644 index 00000000..51ca7777 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/AuthorizeOrder.java @@ -0,0 +1,48 @@ +package com.paypal.AuthorizeIntentExamples; + +import com.paypal.PayPalClient; +import com.paypal.http.HttpRequest; +import com.paypal.http.HttpResponse; +import com.paypal.http.serializer.Json; +import com.paypal.orders.Authorization; +import com.paypal.orders.LinkDescription; +import com.paypal.orders.Order; +import com.paypal.orders.OrderRequest; +import com.paypal.orders.OrdersAuthorizeRequest; +import com.paypal.orders.PurchaseUnit; +import java.io.IOException; +import java.util.Objects; +import org.json.JSONObject; + +public class AuthorizeOrder extends PayPalClient { + private OrderRequest buildRequestBody() { + return new OrderRequest(); + } + + public HttpResponse authorizeOrder(String orderId, boolean debug) throws IOException { + OrdersAuthorizeRequest request = new OrdersAuthorizeRequest(orderId); + request.requestBody(buildRequestBody()); + HttpResponse response = client().execute((HttpRequest)request); + if (debug) { + System.out.println("Authorization Ids:"); + ((Order)response.result()).purchaseUnits().forEach(purchaseUnit -> { + Objects.requireNonNull(System.out); + purchaseUnit.payments().authorizations().stream().map(authorization -> authorization.id()).forEach(System.out::println); + }); + System.out.println("Link Descriptions: "); + for (LinkDescription link : (Iterable)((Order)response.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href()); + System.out.println("Full response body:"); + System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4)); + } + return response; + } + + public static void main(String[] args) { + try { + new AuthorizeOrder().authorizeOrder("<>", true); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/CaptureOrder.java b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/CaptureOrder.java new file mode 100644 index 00000000..96b70168 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/CaptureOrder.java @@ -0,0 +1,43 @@ +package com.paypal.AuthorizeIntentExamples; + +import com.paypal.PayPalClient; +import com.paypal.http.HttpRequest; +import com.paypal.http.HttpResponse; +import com.paypal.http.serializer.Json; +import com.paypal.orders.OrderRequest; +import com.paypal.payments.AuthorizationsCaptureRequest; +import com.paypal.payments.Capture; +import com.paypal.payments.LinkDescription; +import java.io.IOException; +import org.json.JSONObject; + +public class CaptureOrder extends PayPalClient { + public OrderRequest buildRequestBody() { + return new OrderRequest(); + } + + public HttpResponse captureOrder(String authId, boolean debug) throws IOException { + AuthorizationsCaptureRequest request = new AuthorizationsCaptureRequest(authId); + request.requestBody(buildRequestBody()); + HttpResponse response = client().execute((HttpRequest)request); + if (debug) { + System.out.println("Status Code: " + response.statusCode()); + System.out.println("Status: " + ((Capture)response.result()).status()); + System.out.println("Capture ID: " + ((Capture)response.result()).id()); + System.out.println("Links: "); + for (LinkDescription link : (Iterable)((Capture)response.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method()); + System.out.println("Full response body:"); + System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4)); + } + return response; + } + + public static void main(String[] args) { + try { + new CaptureOrder().captureOrder("<>", true); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/CreateOrder.java b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/CreateOrder.java new file mode 100644 index 00000000..df7fabbd --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/CreateOrder.java @@ -0,0 +1,132 @@ +package com.paypal.AuthorizeIntentExamples; + +import com.paypal.PayPalClient; +import com.paypal.http.HttpRequest; +import com.paypal.http.HttpResponse; +import com.paypal.http.exceptions.HttpException; +import com.paypal.http.serializer.Json; +import com.paypal.orders.AddressPortable; +import com.paypal.orders.AmountBreakdown; +import com.paypal.orders.AmountWithBreakdown; +import com.paypal.orders.ApplicationContext; +import com.paypal.orders.Item; +import com.paypal.orders.LinkDescription; +import com.paypal.orders.Money; +import com.paypal.orders.Name; +import com.paypal.orders.Order; +import com.paypal.orders.OrderRequest; +import com.paypal.orders.OrdersCreateRequest; +import com.paypal.orders.PurchaseUnitRequest; +import com.paypal.orders.ShippingDetail; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.json.JSONObject; + +public class CreateOrder extends PayPalClient { + private OrderRequest buildCompleteRequestBody() { + OrderRequest orderRequest = new OrderRequest(); + orderRequest.checkoutPaymentIntent("AUTHORIZE"); + ApplicationContext applicationContext = new ApplicationContext().brandName("EXAMPLE INC").landingPage("BILLING") + .cancelUrl("https://www.example.com").returnUrl("https://www.example.com").userAction("CONTINUE") + .shippingPreference("SET_PROVIDED_ADDRESS"); + orderRequest.applicationContext(applicationContext); + List purchaseUnitRequests = new ArrayList<>(); + PurchaseUnitRequest purchaseUnitRequest = new PurchaseUnitRequest().referenceId("PUHF") + .description("Sporting Goods").customId("CUST-HighFashions").softDescriptor("HighFashions") + .amountWithBreakdown(new AmountWithBreakdown().currencyCode("USD").value("220.00") + .amountBreakdown(new AmountBreakdown().itemTotal(new Money().currencyCode("USD").value("180.00")) + .shipping(new Money().currencyCode("USD").value("20.00")) + .handling(new Money().currencyCode("USD").value("10.00")) + .taxTotal(new Money().currencyCode("USD").value("20.00")) + .shippingDiscount(new Money().currencyCode("USD").value("10.00")))) + .items(new ArrayList<>() { + { + add(new Item().name("T-shirt").description("Green XL").sku("sku01") + .unitAmount(new Money().currencyCode("USD").value("90.00")) + .tax(new Money().currencyCode("USD").value("10.00")).quantity("1") + .category("PHYSICAL_GOODS")); + add(new Item().name("Shoes").description("Running, Size 10.5").sku("sku02") + .unitAmount(new Money().currencyCode("USD").value("45.00")) + .tax(new Money().currencyCode("USD").value("5.00")).quantity("2") + .category("PHYSICAL_GOODS")); + } + }).shippingDetail(new ShippingDetail().name(new Name().fullName("John Doe")) + .addressPortable(new AddressPortable().addressLine1("123 Townsend St").addressLine2("Floor 6") + .adminArea2("San Francisco").adminArea1("CA").postalCode("94107").countryCode("US"))); + purchaseUnitRequests.add(purchaseUnitRequest); + orderRequest.purchaseUnits(purchaseUnitRequests); + return orderRequest; + } + + private OrderRequest buildMinimumRequestBody() { + OrderRequest orderRequest = new OrderRequest(); + orderRequest.checkoutPaymentIntent("AUTHORIZE"); + ApplicationContext applicationContext = new ApplicationContext() + .cancelUrl("https://www.example.com").returnUrl("https://www.example.com"); + orderRequest.applicationContext(applicationContext); + List purchaseUnitRequests = new ArrayList<>(); + PurchaseUnitRequest purchaseUnitRequest = new PurchaseUnitRequest() + .amountWithBreakdown(new AmountWithBreakdown().currencyCode("USD").value("220.00")); + purchaseUnitRequests.add(purchaseUnitRequest); + orderRequest.purchaseUnits(purchaseUnitRequests); + return orderRequest; + } + + public HttpResponse createOrder(boolean debug) throws IOException { + OrdersCreateRequest request = new OrdersCreateRequest(); + request.header("prefer", "return=representation"); + request.requestBody(buildCompleteRequestBody()); + HttpResponse response = client().execute((HttpRequest)request); + if (debug && + response.statusCode() == 201) { + System.out.println("Order with Complete Payload: "); + System.out.println("Status Code: " + response.statusCode()); + System.out.println("Status: " + ((Order)response.result()).status()); + System.out.println("Order ID: " + ((Order)response.result()).id()); + System.out.println("Intent: " + ((Order)response.result()).checkoutPaymentIntent()); + System.out.println("Links: "); + for (LinkDescription link : (Iterable)((Order)response.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method()); + System.out.println("Total Amount: " + ((Order)response.result()).purchaseUnits().get(0).amountWithBreakdown().currencyCode() + " " + ((Order) + response.result()).purchaseUnits().get(0).amountWithBreakdown().value()); + System.out.println("Full response body:"); + System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4)); + } + return response; + } + + public HttpResponse createOrderWithMinimumPayload(boolean debug) throws IOException { + OrdersCreateRequest request = new OrdersCreateRequest(); + request.header("prefer", "return=representation"); + request.requestBody(buildMinimumRequestBody()); + HttpResponse response = client().execute((HttpRequest)request); + if (debug && + response.statusCode() == 201) { + System.out.println("Order with Minimum Payload: "); + System.out.println("Status Code: " + response.statusCode()); + System.out.println("Status: " + ((Order)response.result()).status()); + System.out.println("Order ID: " + ((Order)response.result()).id()); + System.out.println("Intent: " + ((Order)response.result()).checkoutPaymentIntent()); + System.out.println("Links: "); + for (LinkDescription link : (Iterable)((Order)response.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method()); + System.out.println("Total Amount: " + ((Order)response.result()).purchaseUnits().get(0).amountWithBreakdown().currencyCode() + " " + ((Order) + response.result()).purchaseUnits().get(0).amountWithBreakdown().value()); + System.out.println("Full response body:"); + System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4)); + } + return response; + } + + public static void main(String[] args) { + try { + new CreateOrder().createOrder(true); + new CreateOrder().createOrderWithMinimumPayload(true); + } catch (HttpException e) { + System.out.println(e.getLocalizedMessage()); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/RefundOrder.java b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/RefundOrder.java new file mode 100644 index 00000000..ded6168e --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/RefundOrder.java @@ -0,0 +1,50 @@ +package com.paypal.AuthorizeIntentExamples; + +import com.paypal.PayPalClient; +import com.paypal.http.HttpRequest; +import com.paypal.http.HttpResponse; +import com.paypal.http.serializer.Json; +import com.paypal.payments.CapturesRefundRequest; +import com.paypal.payments.LinkDescription; +import com.paypal.payments.Money; +import com.paypal.payments.Refund; +import com.paypal.payments.RefundRequest; +import java.io.IOException; +import org.json.JSONObject; + +public class RefundOrder extends PayPalClient { + public RefundRequest buildRequestBody() { + RefundRequest refundRequest = new RefundRequest(); + Money money = new Money(); + money.currencyCode("USD"); + money.value("20.00"); + refundRequest.amount(money); + return refundRequest; + } + + public HttpResponse refundOrder(String captureId, boolean debug) throws IOException { + CapturesRefundRequest request = new CapturesRefundRequest(captureId); + request.prefer("return=representation"); + request.requestBody(buildRequestBody()); + HttpResponse response = client().execute((HttpRequest)request); + if (debug) { + System.out.println("Status Code: " + response.statusCode()); + System.out.println("Status: " + ((Refund)response.result()).status()); + System.out.println("Refund Id: " + ((Refund)response.result()).id()); + System.out.println("Links: "); + for (LinkDescription link : (Iterable)((Refund)response.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method()); + System.out.println("Full response body:"); + System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4)); + } + return response; + } + + public static void main(String[] args) { + try { + new RefundOrder().refundOrder("<>", true); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/RunAll.java b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/RunAll.java new file mode 100644 index 00000000..044ac957 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/AuthorizeIntentExamples/RunAll.java @@ -0,0 +1,59 @@ +package com.paypal.AuthorizeIntentExamples; + +import com.paypal.http.HttpResponse; +import com.paypal.orders.LinkDescription; +import com.paypal.orders.Order; +import com.paypal.payments.Capture; +import com.paypal.payments.Refund; + +public class RunAll { + public static void main(String[] args) { + try { + HttpResponse orderResponse = new CreateOrder().createOrder(false); + String orderId = ""; + System.out.println("Creating Order..."); + if (orderResponse.statusCode() == 201) { + orderId = ((Order)orderResponse.result()).id(); + System.out.println("Order ID: " + orderId); + System.out.println("Links:"); + for (LinkDescription link : (Iterable)((Order)orderResponse.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href()); + } + System.out.println("Created Successfully\n"); + System.out.println("Copy approve link and paste it in browser. Login with buyer account and follow the instructions.\nOnce approved hit enter..."); + System.in.read(); + System.out.println("Authorizing Order..."); + orderResponse = new AuthorizeOrder().authorizeOrder(orderId, false); + String authId = ""; + if (orderResponse.statusCode() == 201) { + System.out.println("Authorized Successfully\n"); + authId = ((Order)orderResponse.result()).purchaseUnits().get(0).payments().authorizations().get(0).id(); + } + System.out.println("Capturing Order..."); + HttpResponse captureOrderResponse = new CaptureOrder().captureOrder(authId, false); + if (orderResponse.statusCode() == 201) { + System.out.println("Captured Successfully"); + System.out.println("Status Code: " + captureOrderResponse.statusCode()); + System.out.println("Status: " + ((Capture)captureOrderResponse.result()).status()); + System.out.println("Capture ID: " + ((Capture)captureOrderResponse.result()).id()); + System.out.println("Links: "); + for (com.paypal.payments.LinkDescription link : (Iterable)((Capture)captureOrderResponse.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method()); + } + System.out.println(); + System.out.println("Refunding Order..."); + HttpResponse refundHttpResponse = new RefundOrder().refundOrder(((Capture)captureOrderResponse.result()).id(), false); + if (refundHttpResponse.statusCode() == 201) { + System.out.println("Refunded Successfully"); + System.out.println("Status Code: " + refundHttpResponse.statusCode()); + System.out.println("Status: " + ((Refund)refundHttpResponse.result()).status()); + System.out.println("Order ID: " + ((Refund)refundHttpResponse.result()).id()); + System.out.println("Links: "); + for (com.paypal.payments.LinkDescription link : (Iterable)((Refund)refundHttpResponse.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/CaptureIntentExamples/CaptureOrder.java b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/CaptureIntentExamples/CaptureOrder.java new file mode 100644 index 00000000..994dfad2 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/CaptureIntentExamples/CaptureOrder.java @@ -0,0 +1,55 @@ +package com.paypal.CaptureIntentExamples; + +import com.paypal.PayPalClient; +import com.paypal.http.HttpRequest; +import com.paypal.http.HttpResponse; +import com.paypal.http.serializer.Json; +import com.paypal.orders.Capture; +import com.paypal.orders.LinkDescription; +import com.paypal.orders.Order; +import com.paypal.orders.OrderRequest; +import com.paypal.orders.OrdersCaptureRequest; +import com.paypal.orders.Payer; +import com.paypal.orders.PurchaseUnit; +import java.io.IOException; +import org.json.JSONObject; + +public class CaptureOrder extends PayPalClient { + public OrderRequest buildRequestBody() { + return new OrderRequest(); + } + + public HttpResponse captureOrder(String orderId, boolean debug) throws IOException { + OrdersCaptureRequest request = new OrdersCaptureRequest(orderId); + request.requestBody(buildRequestBody()); + HttpResponse response = client().execute((HttpRequest)request); + if (debug) { + System.out.println("Status Code: " + response.statusCode()); + System.out.println("Status: " + ((Order)response.result()).status()); + System.out.println("Order ID: " + ((Order)response.result()).id()); + System.out.println("Links: "); + for (LinkDescription link : (Iterable)((Order)response.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href()); + System.out.println("Capture ids:"); + for (PurchaseUnit purchaseUnit : (Iterable)((Order)response.result()).purchaseUnits()) { + for (Capture capture : (Iterable)purchaseUnit.payments().captures()) + System.out.println("\t" + capture.id()); + } + System.out.println("Buyer: "); + Payer buyer = ((Order)response.result()).payer(); + System.out.println("\tEmail Address: " + buyer.email()); + System.out.println("\tName: " + buyer.name().givenName() + " " + buyer.name().surname()); + System.out.println("Full response body:"); + System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4)); + } + return response; + } + + public static void main(String[] args) { + try { + new CaptureOrder().captureOrder("<>", true); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/CaptureIntentExamples/CreateOrder.java b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/CaptureIntentExamples/CreateOrder.java new file mode 100644 index 00000000..a72c08cd --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/CaptureIntentExamples/CreateOrder.java @@ -0,0 +1,93 @@ +package com.paypal.CaptureIntentExamples; + +import com.paypal.PayPalClient; +import com.paypal.http.HttpRequest; +import com.paypal.http.HttpResponse; +import com.paypal.http.exceptions.HttpException; +import com.paypal.http.serializer.Json; +import com.paypal.orders.AddressPortable; +import com.paypal.orders.AmountBreakdown; +import com.paypal.orders.AmountWithBreakdown; +import com.paypal.orders.ApplicationContext; +import com.paypal.orders.Item; +import com.paypal.orders.LinkDescription; +import com.paypal.orders.Money; +import com.paypal.orders.Name; +import com.paypal.orders.Order; +import com.paypal.orders.OrderRequest; +import com.paypal.orders.OrdersCreateRequest; +import com.paypal.orders.PurchaseUnitRequest; +import com.paypal.orders.ShippingDetail; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.json.JSONObject; + +public class CreateOrder extends PayPalClient { + private OrderRequest buildRequestBody() { + OrderRequest orderRequest = new OrderRequest(); + orderRequest.checkoutPaymentIntent("CAPTURE"); + ApplicationContext applicationContext = new ApplicationContext().brandName("EXAMPLE INC").landingPage("BILLING") + .cancelUrl("https://www.example.com").returnUrl("https://www.example.com").userAction("CONTINUE") + .shippingPreference("SET_PROVIDED_ADDRESS"); + orderRequest.applicationContext(applicationContext); + List purchaseUnitRequests = new ArrayList<>(); + PurchaseUnitRequest purchaseUnitRequest = new PurchaseUnitRequest().referenceId("PUHF") + .description("Sporting Goods").customId("CUST-HighFashions").softDescriptor("HighFashions") + .amountWithBreakdown(new AmountWithBreakdown().currencyCode("USD").value("220.00") + .amountBreakdown(new AmountBreakdown().itemTotal(new Money().currencyCode("USD").value("180.00")) + .shipping(new Money().currencyCode("USD").value("20.00")) + .handling(new Money().currencyCode("USD").value("10.00")) + .taxTotal(new Money().currencyCode("USD").value("20.00")) + .shippingDiscount(new Money().currencyCode("USD").value("10.00")))) + .items(new ArrayList<>() { + { + add(new Item().name("T-shirt").description("Green XL").sku("sku01") + .unitAmount(new Money().currencyCode("USD").value("90.00")) + .tax(new Money().currencyCode("USD").value("10.00")).quantity("1") + .category("PHYSICAL_GOODS")); + add(new Item().name("Shoes").description("Running, Size 10.5").sku("sku02") + .unitAmount(new Money().currencyCode("USD").value("45.00")) + .tax(new Money().currencyCode("USD").value("5.00")).quantity("2") + .category("PHYSICAL_GOODS")); + } + }).shippingDetail(new ShippingDetail().name(new Name().fullName("John Doe")) + .addressPortable(new AddressPortable().addressLine1("123 Townsend St").addressLine2("Floor 6") + .adminArea2("San Francisco").adminArea1("CA").postalCode("94107").countryCode("US"))); + purchaseUnitRequests.add(purchaseUnitRequest); + orderRequest.purchaseUnits(purchaseUnitRequests); + return orderRequest; + } + + public HttpResponse createOrder(boolean debug) throws IOException { + OrdersCreateRequest request = new OrdersCreateRequest(); + request.header("prefer", "return=representation"); + request.requestBody(buildRequestBody()); + HttpResponse response = client().execute((HttpRequest)request); + if (debug && + response.statusCode() == 201) { + System.out.println("Status Code: " + response.statusCode()); + System.out.println("Status: " + ((Order)response.result()).status()); + System.out.println("Order ID: " + ((Order)response.result()).id()); + System.out.println("Intent: " + ((Order)response.result()).checkoutPaymentIntent()); + System.out.println("Links: "); + for (LinkDescription link : (Iterable)((Order)response.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method()); + System.out.println("Total Amount: " + ((Order)response.result()).purchaseUnits().get(0).amountWithBreakdown().currencyCode() + " " + ((Order) + response.result()).purchaseUnits().get(0).amountWithBreakdown().value()); + System.out.println("Full response body:"); + System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4)); + } + return response; + } + + public static void main(String[] args) { + try { + new CreateOrder().createOrder(true); + } catch (HttpException e) { + System.out.println(e.getLocalizedMessage()); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/CaptureIntentExamples/RunAll.java b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/CaptureIntentExamples/RunAll.java new file mode 100644 index 00000000..d94cfe00 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/CaptureIntentExamples/RunAll.java @@ -0,0 +1,60 @@ +package com.paypal.CaptureIntentExamples; + +import com.paypal.AuthorizeIntentExamples.RefundOrder; +import com.paypal.http.HttpResponse; +import com.paypal.orders.Capture; +import com.paypal.orders.LinkDescription; +import com.paypal.orders.Order; +import com.paypal.orders.PurchaseUnit; +import com.paypal.payments.Refund; + +public class RunAll { + public static void main(String[] args) { + try { + HttpResponse orderResponse = new CreateOrder().createOrder(false); + String orderId = ""; + System.out.println("Creating Order..."); + if (orderResponse.statusCode() == 201) { + orderId = ((Order)orderResponse.result()).id(); + System.out.println("Links:"); + for (LinkDescription link : (Iterable)((Order)orderResponse.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href()); + } + System.out.println("Created Successfully\n"); + System.out.println("Copy approve link and paste it in browser. Login with buyer account and follow the instructions.\nOnce approved hit enter..."); + System.in.read(); + System.out.println("Capturing Order..."); + orderResponse = new CaptureOrder().captureOrder(orderId, false); + String captureId = ""; + if (orderResponse.statusCode() == 201) { + System.out.println("Captured Successfully"); + System.out.println("Status Code: " + orderResponse.statusCode()); + System.out.println("Status: " + ((Order)orderResponse.result()).status()); + System.out.println("Order ID: " + ((Order)orderResponse.result()).id()); + System.out.println("Links:"); + for (LinkDescription link : (Iterable)((Order)orderResponse.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href()); + System.out.println("Capture ids:"); + for (PurchaseUnit purchaseUnit : (Iterable)((Order)orderResponse.result()).purchaseUnits()) { + for (Capture capture : (Iterable)purchaseUnit.payments().captures()) { + System.out.println("\t" + capture.id()); + captureId = capture.id(); + } + } + } + System.out.println("Refunding Order..."); + HttpResponse refundResponse = new RefundOrder().refundOrder(captureId, false); + if (refundResponse.statusCode() == 201) { + System.out.println("Refunded Successfully"); + System.out.println("Status Code: " + refundResponse.statusCode()); + System.out.println("Status: " + ((Refund)refundResponse.result()).status()); + System.out.println("Refund ID: " + ((Refund)refundResponse.result()).id()); + System.out.println("Links:"); + for (com.paypal.payments.LinkDescription link : (Iterable)((Refund)refundResponse.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/ErrorSample.java b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/ErrorSample.java new file mode 100644 index 00000000..b49101d6 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/ErrorSample.java @@ -0,0 +1,59 @@ +package com.paypal; + +import com.paypal.http.HttpRequest; +import com.paypal.http.HttpResponse; +import com.paypal.http.exceptions.HttpException; +import com.paypal.orders.AmountWithBreakdown; +import com.paypal.orders.OrderRequest; +import com.paypal.orders.OrdersCreateRequest; +import com.paypal.orders.PurchaseUnitRequest; +import java.io.IOException; +import java.util.ArrayList; +import org.json.JSONObject; + +public class ErrorSample extends PayPalClient { + public void createError1() { + OrdersCreateRequest request = new OrdersCreateRequest(); + request.requestBody(new OrderRequest()); + System.out.println("Request Body: {}\n"); + System.out.println("Response:"); + try { + HttpResponse httpResponse = this.client.execute((HttpRequest)request); + } catch (IOException e) { + HttpException h = (HttpException)e; + JSONObject message = new JSONObject(h.getMessage()); + System.out.println(prettyPrint(message, "")); + System.out.println(); + } + } + + public void createError2() { + OrdersCreateRequest request = new OrdersCreateRequest(); + request.requestBody(new OrderRequest() + .checkoutPaymentIntent("INVALID") + .purchaseUnits(new ArrayList<>() { + { + add(new PurchaseUnitRequest().amountWithBreakdown(new AmountWithBreakdown().currencyCode("USD").value("100.00"))); + } + })); + System.out.println("Request Body:"); + System.out.println("{\n\"intent\": \"INVALID\",\n\"purchase_units\": [\n{\n\"amount\": {\n\"currency_code\": \"USD\",\n\"value\": \"100.00\"\n}\n}\n]\n}\n"); + System.out.println("Response:"); + try { + HttpResponse httpResponse = this.client.execute((HttpRequest)request); + } catch (IOException e) { + HttpException h = (HttpException)e; + JSONObject message = new JSONObject(h.getMessage()); + System.out.println(prettyPrint(message, "")); + System.out.println(); + } + } + + public static void main(String[] args) { + ErrorSample errorSample = new ErrorSample(); + System.out.println("Calling createError1 (Body has no required parameters (intent, purchase_units))"); + errorSample.createError1(); + System.out.println("Calling createError2 (Body has invalid parameter value for intent)"); + errorSample.createError2(); + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/GetOrder.java b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/GetOrder.java new file mode 100644 index 00000000..3e86eb4a --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/GetOrder.java @@ -0,0 +1,24 @@ +package com.paypal; + +import com.paypal.AuthorizeIntentExamples.CreateOrder; +import com.paypal.http.HttpRequest; +import com.paypal.http.HttpResponse; +import com.paypal.http.serializer.Json; +import com.paypal.orders.Order; +import com.paypal.orders.OrdersGetRequest; +import java.io.IOException; +import org.json.JSONObject; + +public class GetOrder extends PayPalClient { + public void getOrder(String orderId) throws IOException { + OrdersGetRequest request = new OrdersGetRequest(orderId); + HttpResponse response = client().execute((HttpRequest)request); + System.out.println("Full response body:"); + System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4)); + } + + public static void main(String[] args) throws IOException { + HttpResponse response = new CreateOrder().createOrder(false); + new GetOrder().getOrder(((Order)response.result()).id()); + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/PatchOrder.java b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/PatchOrder.java new file mode 100644 index 00000000..56f13e78 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/PatchOrder.java @@ -0,0 +1,55 @@ +package com.paypal; + +import com.paypal.AuthorizeIntentExamples.CreateOrder; +import com.paypal.http.HttpRequest; +import com.paypal.http.HttpResponse; +import com.paypal.http.serializer.Json; +import com.paypal.orders.AmountBreakdown; +import com.paypal.orders.AmountWithBreakdown; +import com.paypal.orders.LinkDescription; +import com.paypal.orders.Money; +import com.paypal.orders.Order; +import com.paypal.orders.OrdersGetRequest; +import com.paypal.orders.OrdersPatchRequest; +import com.paypal.orders.Patch; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import org.json.JSONObject; + +public class PatchOrder extends PayPalClient { + private List buildRequestBody() throws IOException { + List patches = new ArrayList<>(); + patches.add(new Patch().op("replace").path("/intent").value("CAPTURE")); + patches.add(new Patch().op("replace").path("/purchase_units/@reference_id=='PUHF'/amount") + .value(new AmountWithBreakdown().currencyCode("USD").value("200.00") + .amountBreakdown(new AmountBreakdown().itemTotal(new Money().currencyCode("USD").value("180.00")) + .taxTotal(new Money().currencyCode("USD").value("20.00"))))); + return patches; + } + + public void patchOrder(String orderId) throws IOException { + OrdersPatchRequest request = new OrdersPatchRequest(orderId); + request.requestBody(buildRequestBody()); + client().execute((HttpRequest)request); + OrdersGetRequest getRequest = new OrdersGetRequest(orderId); + HttpResponse response = this.client.execute((HttpRequest)getRequest); + System.out.println("After Patch:"); + System.out.println("Order ID: " + ((Order)response.result()).id()); + System.out.println("Intent: " + ((Order)response.result()).checkoutPaymentIntent()); + System.out.println("Links: "); + for (LinkDescription link : (Iterable)((Order)response.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method()); + System.out.println("Gross Amount: " + ((Order)response.result()).purchaseUnits().get(0).amountWithBreakdown().currencyCode() + " " + ((Order) + response.result()).purchaseUnits().get(0).amountWithBreakdown().value()); + System.out.println("Full response body:"); + System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4)); + } + + public static void main(String[] args) throws IOException { + System.out.println("Before PATCH:"); + HttpResponse response = new CreateOrder().createOrder(true); + System.out.println("\nAfter PATCH (Changed Intent and Amount):"); + new PatchOrder().patchOrder(((Order)response.result()).id()); + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/PayPalClient.java b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/PayPalClient.java new file mode 100644 index 00000000..a56389cd --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/com/paypal/PayPalClient.java @@ -0,0 +1,44 @@ +package com.paypal; + +import com.paypal.core.PayPalEnvironment; +import com.paypal.core.PayPalHttpClient; +import java.util.Iterator; +import org.apache.commons.lang3.StringUtils; +import org.json.JSONObject; + +public class PayPalClient { + private PayPalEnvironment environment = new PayPalEnvironment.Sandbox( + (System.getProperty("PAYPAL_CLIENT_ID") != null) ? System.getProperty("PAYPAL_CLIENT_ID") : + "<>", + (System.getProperty("PAYPAL_CLIENT_SECRET") != null) ? System.getProperty("PAYPAL_CLIENT_SECRET") : + "<>"); + + PayPalHttpClient client = new PayPalHttpClient(this.environment); + + public PayPalHttpClient client() { + return this.client; + } + + public String prettyPrint(JSONObject jo, String pre) { + Iterator keys = jo.keys(); + StringBuilder pretty = new StringBuilder(); + while (keys.hasNext()) { + String key = (String)keys.next(); + pretty.append(String.format("%s%s: ", pre, StringUtils.capitalize(key))); + if (jo.get(key) instanceof JSONObject) { + pretty.append(prettyPrint(jo.getJSONObject(key), pre + "\t")); + continue; + } + if (jo.get(key) instanceof org.json.JSONArray) { + int sno = 1; + for (Object jsonObject : (Iterable)jo.getJSONArray(key)) { + pretty.append(String.format("\n%s\t%d:\n", pre, sno++)); + pretty.append(prettyPrint((JSONObject)jsonObject, pre + "\t\t")); + } + continue; + } + pretty.append(String.format("%s\n", jo.getString(key))); + } + return pretty.toString(); + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/_BankAdapter.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/_BankAdapter.java new file mode 100644 index 00000000..615c7aab --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/_BankAdapter.java @@ -0,0 +1,25 @@ +package it.acxent.bank; + +import it.acxent.common.Parm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.Debug; + +public abstract class _BankAdapter extends Debug { + private ApplParmFull ap; + + public static final String DEFAULT_OK_KO_PAGE = "payRes.jsp"; + + public ApplParmFull getApFull() { + return this.ap; + } + + public void setAp(ApplParmFull ap) { + this.ap = ap; + } + + public Parm getParm(String theKey) { + if (getApFull() != null) + return getApFull().getParm(theKey); + return new Parm(); + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/consel/ConselReq.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/consel/ConselReq.java new file mode 100644 index 00000000..de7c0598 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/consel/ConselReq.java @@ -0,0 +1,323 @@ +package it.acxent.bank.consel; + +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; + +public class ConselReq { + public static final String P_COD_TIPO_PRODOTTO_CONSEL = "COD_TIPO_PRODOTTO_CONSEL"; + + private String tipoesec; + + private String tabfin; + + private String cognome; + + private String nome; + + private String indirizzo; + + private String tel_num; + + private String pref_num; + + private String data_nascita; + + private String testomail; + + private ApplParmFull ap; + + private String ordine; + + private String descri1; + + private String parz1; + + private String h_merce; + + private String h_prod; + + private String convenz; + + private String impdafin; + + public static final String CONSEL_TAB_FIN_90 = "WIP"; + + private double anticipo; + + private String impspe; + + private String codfisc; + + public static final String P_CONSEL_IMPORTO_MINIMO = "CONSEL_IMPORTO_MINIMO"; + + public static final String P_CONSEL_TEST = "CONSEL_TEST"; + + public static final String P_CONSEL_OK_PAGE = "CONSEL_OK_PAGE"; + + public static final String CONSEL_TAB_FIN_TASSO_0 = "MPF"; + + public static final String CONSEL_TAB_FIN_30 = "WIN"; + + public static final String CONSEL_REQUEST_SERVER = "https://reserved.e-consel.it/DOL/faces/frmECProntoTuo.jsp"; + + public static final String P_COD_TIPO_MERCE_CONSEL = "COD_TIPO_MERCE_CONSEL"; + + public static final String P_COD_CONVENZIONE_CONSEL = "COD_CONVENZIONE_CONSEL"; + + public static final String P_CONSEL_ERROR_PAGE = "CONSEL_ERROR_PAGE"; + + public static final String P_CONSEL_RATA0 = "CONSEL_RATA0"; + + public ConselReq(ApplParmFull l_ap) { + setAp(l_ap); + } + + public ConselReq() {} + + public String getTipoesec() { + return "T"; + } + + public void setTipoesec(String tipoesec) { + this.tipoesec = tipoesec; + } + + public String getTabfin() { + return (this.tabfin == null) ? "" : this.tabfin.trim(); + } + + public void setTabfin(String tabfin) { + this.tabfin = tabfin; + } + + public String getCognome() { + return (this.cognome == null) ? "" : this.cognome.trim(); + } + + public void setCognome(String cognome) { + this.cognome = cognome; + } + + public String getNome() { + return (this.nome == null) ? "" : this.nome.trim(); + } + + public void setNome(String nome) { + this.nome = nome; + } + + public String getIndirizzo() { + return (this.indirizzo == null) ? "" : this.indirizzo.trim(); + } + + public void setIndirizzo(String indirizzo) { + this.indirizzo = indirizzo; + } + + public String getTel_num() { + return (this.tel_num == null) ? "" : this.tel_num.trim(); + } + + public void setTel_num(String tel_num) { + this.tel_num = tel_num; + } + + public String getPref_num() { + return (this.pref_num == null) ? "" : this.pref_num.trim(); + } + + public void setPref_num(String pref_num) { + this.pref_num = pref_num; + } + + public String getData_nascita() { + return (this.data_nascita == null) ? "" : this.data_nascita.trim(); + } + + public void setData_nascita(String data_nascita) { + this.data_nascita = data_nascita; + } + + public String getTestomail() { + return (this.testomail == null) ? "" : this.testomail.trim(); + } + + public void setTestomail(String testomail) { + this.testomail = testomail; + } + + public String getCodfisc() { + return (this.codfisc == null) ? "" : this.codfisc.trim(); + } + + public void setCodfisc(String codfisc) { + this.codfisc = codfisc; + } + + public String getOrdine() { + return (this.ordine == null) ? "" : this.ordine.trim(); + } + + public void setOrdine(String ordine) { + this.ordine = ordine; + } + + public String getDescri1() { + return (this.descri1 == null) ? "" : this.descri1.trim(); + } + + public void setDescri1(String descri1) { + this.descri1 = descri1; + } + + public String getParz1() { + return (this.parz1 == null) ? "" : this.parz1; + } + + public void setParz1(String parz1) { + this.parz1 = parz1; + } + + public String getH_merce() { + if (this.h_merce == null) + this.h_merce = getApFull().getParm("COD_TIPO_MERCE_CONSEL").getTesto(); + return this.h_merce; + } + + public void setH_merce(String h_merce) { + this.h_merce = h_merce; + } + + public String getH_prod() { + if (this.h_prod == null) + this.h_prod = getApFull().getParm("COD_TIPO_PRODOTTO_CONSEL").getTesto(); + return this.h_prod; + } + + public void setH_prod(String h_prod) { + this.h_prod = h_prod; + } + + public String getConvenz() { + if (this.convenz == null) + this.convenz = getApFull().getParm("COD_CONVENZIONE_CONSEL").getTesto().trim(); + return this.convenz; + } + + public void setConvenz(String convenz) { + this.convenz = convenz; + } + + public String getImpdafin() { + return (this.impdafin == null) ? "" : this.impdafin; + } + + public void setImpdafin(String impdafin) { + this.impdafin = impdafin; + } + + public double getAnticipo() { + return this.anticipo; + } + + public void setAnticipo(double anticipo) { + this.anticipo = anticipo; + } + + public static void initApplicationParms(ApplParmFull ap) { + if (ap != null) { + DBAdapter.logDebug(true, "CONSEL chechout initParms: start"); + String l_tipoParm = ""; + Parm bean = new Parm(ap); + l_tipoParm = "CONSEL"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("COD_CONVENZIONE_CONSEL"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("COD_CONVENZIONE_CONSEL"); + bean.setDescrizione("COD_CONVENZIONE_CONSEL"); + bean.setFlgTipo(0L); + bean.setNota("CODICE CONVENZIONE CONSEL"); + bean.save(); + bean.findByCodice("COD_TIPO_MERCE_CONSEL"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("COD_TIPO_MERCE_CONSEL"); + bean.setDescrizione("COD_TIPO_MERCE_CONSEL"); + bean.setFlgTipo(0L); + bean.setNota("CODICE INDICATIVO MERCE FINANZIATA "); + bean.save(); + bean.findByCodice("COD_TIPO_PRODOTTO_CONSEL"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("COD_TIPO_PRODOTTO_CONSEL"); + bean.setDescrizione("COD_TIPO_PRODOTTO_CONSEL"); + bean.setFlgTipo(0L); + bean.setNota("CODICE INDICATIVO PRODOTTO FINANZIATO"); + bean.save(); + bean.findByCodice("CONSEL_ERROR_PAGE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CONSEL_ERROR_PAGE"); + bean.setDescrizione("CONSEL_ERROR_PAGE"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("conselRes.jsp"); + bean.setNota("CONSEL_ERROR_PAGE"); + bean.save(); + bean.findByCodice("CONSEL_OK_PAGE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CONSEL_OK_PAGE"); + bean.setDescrizione("CONSEL_OK_PAGE"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("conselRes.jsp"); + bean.setNota("CONSEL_OK_PAGE"); + bean.save(); + bean.findByCodice("CONSEL_TEST"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CONSEL_TEST"); + bean.setDescrizione("CONSEL_TEST"); + bean.setFlgTipo(1L); + bean.setNota("0-->NO 1-->SI"); + bean.save(); + bean.findByCodice("CONSEL_IMPORTO_MINIMO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CONSEL_IMPORTO_MINIMO"); + bean.setDescrizione("CONSEL_IMPORTO_MINIMO"); + bean.setFlgTipo(1L); + bean.setNota("CONSEL_IMPORTO_MINIMO"); + bean.save(); + bean.findByCodice("CONSEL_RATA0"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CONSEL_RATA0"); + bean.setDescrizione("CONSEL_RATA0"); + bean.setFlgTipo(1L); + bean.setNota(" ATTIVA ANCHE RATA 0 SOPRA L'IMPORTO DEFINITO DA CONSEL_IMPORTO_MINIMO
0: RATA 0 NON ATTIVA
1: RATA 0 ATTIVA"); + bean.save(); + DBAdapter.logDebug(true, "CONSEL chechout initParms: stop"); + } + } + + public String getImpspe() { + return (this.impspe == null) ? "" : this.impspe; + } + + public void setImpspe(String impspe) { + this.impspe = impspe; + } + + public ApplParmFull getApFull() { + return this.ap; + } + + public void setAp(ApplParmFull ap) { + this.ap = ap; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/consel/ConselResp.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/consel/ConselResp.java new file mode 100644 index 00000000..7373c4a3 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/consel/ConselResp.java @@ -0,0 +1,67 @@ +package it.acxent.bank.consel; + +import it.acxent.db.ApplParmFull; + +public class ConselResp { + private String pratica; + + private ApplParmFull ap; + + private String ordine; + + private String praticabis; + + private String stato; + + public static final String CONSEL_VALUTAZIONE = "WW"; + + public static final String CONSEL_KO = "KO"; + + public static final String CONSEL_OK = "OK"; + + public ConselResp(ApplParmFull l_ap) { + setAp(l_ap); + } + + public ConselResp() {} + + public String getOrdine() { + return (this.ordine == null) ? "" : this.ordine.trim(); + } + + public void setOrdine(String ordine) { + this.ordine = ordine; + } + + public ApplParmFull getApFull() { + return this.ap; + } + + public void setAp(ApplParmFull ap) { + this.ap = ap; + } + + public String getPratica() { + return (this.pratica == null) ? "" : this.pratica.trim(); + } + + public void setPratica(String pratica) { + this.pratica = pratica; + } + + public String getPraticabis() { + return (this.praticabis == null) ? "" : this.praticabis.trim(); + } + + public void setPraticabis(String praticabis) { + this.praticabis = praticabis; + } + + public String getStato() { + return (this.stato == null) ? "" : this.stato.trim(); + } + + public void setStato(String stato) { + this.stato = stato; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/consel/ConselTabfin.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/consel/ConselTabfin.java new file mode 100644 index 00000000..d5211965 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/consel/ConselTabfin.java @@ -0,0 +1,184 @@ +package it.acxent.bank.consel; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ConselTabfin extends DBAdapter implements Serializable { + public static final double MIN_FIN = 168.0D; + + public static final double MAX_FIN = 7500.0D; + + private long id_conselTabfin; + + private String flgTipo; + + private double valoreBene; + + private long durata; + + private double importoRata; + + private double tan; + + private double taeg; + + private double interessi; + + private double speseGestSingolaRata; + + private double speseGestTotaleRata; + + private double impostaBollo; + + private double importoTotaleDovuto; + + public ConselTabfin(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ConselTabfin() {} + + public void setId_conselTabfin(long newId_conselTabfin) { + this.id_conselTabfin = newId_conselTabfin; + } + + public void setFlgTipo(String newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public void setValoreBene(double newValoreBene) { + this.valoreBene = newValoreBene; + } + + public void setDurata(long newDurata) { + this.durata = newDurata; + } + + public void setImportoRata(double newImportoRata) { + this.importoRata = newImportoRata; + } + + public void setTan(double newTan) { + this.tan = newTan; + } + + public void setTaeg(double newTaeg) { + this.taeg = newTaeg; + } + + public void setInteressi(double newInteressi) { + this.interessi = newInteressi; + } + + public void setSpeseGestSingolaRata(double newSpeseGestSingolaRata) { + this.speseGestSingolaRata = newSpeseGestSingolaRata; + } + + public void setSpeseGestTotaleRata(double newSpeseGestTotaleRata) { + this.speseGestTotaleRata = newSpeseGestTotaleRata; + } + + public void setImpostaBollo(double newImpostaBollo) { + this.impostaBollo = newImpostaBollo; + } + + public void setImportoTotaleDovuto(double newImportoTotaleDovuto) { + this.importoTotaleDovuto = newImportoTotaleDovuto; + } + + public long getId_conselTabfin() { + return this.id_conselTabfin; + } + + public String getFlgTipo() { + return (this.flgTipo == null) ? "" : this.flgTipo.trim(); + } + + public double getValoreBene() { + return this.valoreBene; + } + + public long getDurata() { + return this.durata; + } + + public double getImportoRata() { + return this.importoRata; + } + + public double getTan() { + return this.tan; + } + + public double getTaeg() { + return this.taeg; + } + + public double getInteressi() { + return this.interessi; + } + + public double getSpeseGestSingolaRata() { + return this.speseGestSingolaRata; + } + + public double getSpeseGestTotaleRata() { + return this.speseGestTotaleRata; + } + + public double getImpostaBollo() { + return this.impostaBollo; + } + + public double getImportoTotaleDovuto() { + return this.importoTotaleDovuto; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ConselTabfinCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CONSEL_TABFIN AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (CR.getValoreBene() > 0.0D) + wc.addWc("A.valoreBene=" + CR.getValoreBene()); + if (!CR.getFlgTipo().isEmpty()) + wc.addWc("A.flgTipo='" + CR.getFlgTipo() + "'"); + if (CR.getDurata() > 0L) + wc.addWc("A.durata=" + CR.getDurata()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByTipoValoreDurata(String l_flgTipo, double l_valore, long l_durata) { + String s_Sql_Find = "select A.* from CONSEL_TABFIN AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.valoreBene=" + Math.round(l_valore)); + wc.addWc("A.flgTipo='" + l_flgTipo + "'"); + wc.addWc("A.durata=" + l_durata); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/consel/ConselTabfinCR.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/consel/ConselTabfinCR.java new file mode 100644 index 00000000..7afba3d7 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/consel/ConselTabfinCR.java @@ -0,0 +1,132 @@ +package it.acxent.bank.consel; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ConselTabfinCR extends CRAdapter { + private long id_conselTabfin; + + private String flgTipo; + + private double valoreBene; + + private long durata; + + private double importoRata; + + private double tan; + + private double taeg; + + private double interessi; + + private double speseGestSingolaRata; + + private double speseGestTotaleRata; + + private double impostaBollo; + + private double importoTotaleDovuto; + + public ConselTabfinCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ConselTabfinCR() {} + + public void setId_conselTabfin(long newId_conselTabfin) { + this.id_conselTabfin = newId_conselTabfin; + } + + public void setFlgTipo(String newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public void setValoreBene(double newValoreBene) { + this.valoreBene = newValoreBene; + } + + public void setDurata(long newDurata) { + this.durata = newDurata; + } + + public void setImportoRata(double newImportoRata) { + this.importoRata = newImportoRata; + } + + public void setTan(double newTan) { + this.tan = newTan; + } + + public void setTaeg(double newTaeg) { + this.taeg = newTaeg; + } + + public void setInteressi(double newInteressi) { + this.interessi = newInteressi; + } + + public void setSpeseGestSingolaRata(double newSpeseGestSingolaRata) { + this.speseGestSingolaRata = newSpeseGestSingolaRata; + } + + public void setSpeseGestTotaleRata(double newSpeseGestTotaleRata) { + this.speseGestTotaleRata = newSpeseGestTotaleRata; + } + + public void setImpostaBollo(double newImpostaBollo) { + this.impostaBollo = newImpostaBollo; + } + + public void setImportoTotaleDovuto(double newImportoTotaleDovuto) { + this.importoTotaleDovuto = newImportoTotaleDovuto; + } + + public long getId_conselTabfin() { + return this.id_conselTabfin; + } + + public String getFlgTipo() { + return (this.flgTipo == null) ? "" : this.flgTipo.trim(); + } + + public double getValoreBene() { + return this.valoreBene; + } + + public long getDurata() { + return this.durata; + } + + public double getImportoRata() { + return this.importoRata; + } + + public double getTan() { + return this.tan; + } + + public double getTaeg() { + return this.taeg; + } + + public double getInteressi() { + return this.interessi; + } + + public double getSpeseGestSingolaRata() { + return this.speseGestSingolaRata; + } + + public double getSpeseGestTotaleRata() { + return this.speseGestTotaleRata; + } + + public double getImpostaBollo() { + return this.impostaBollo; + } + + public double getImportoTotaleDovuto() { + return this.importoTotaleDovuto; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/infogroup/ShopnetReq.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/infogroup/ShopnetReq.java new file mode 100644 index 00000000..9ebf8b6d --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/infogroup/ShopnetReq.java @@ -0,0 +1,251 @@ +package it.acxent.bank.infogroup; + +import it.acxent.bank._BankAdapter; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import java.text.NumberFormat; +import java.util.Locale; + +public class ShopnetReq extends _BankAdapter { + public static final String LANG_CODE_IT = "0"; + + public static final String LANG_CODE_EN = "1"; + + public static final String LANG_CODE_ES = "2"; + + public static final String LANG_CODE_DE = "3"; + + public static final String DIV_CODE_EURO = "1"; + + private static NumberFormat nf2; + + private String f; + + private String l; + + private String m; + + private String o; + + private String i; + + private String d; + + private String p; + + private String c; + + private String u; + + private String n; + + private String e; + + private String action; + + public static final String P_PAYMENT_ERROR_PAGE = "PAY_KO"; + + public static final String P_PAYMENT_OK_PAGE = "PAY_OK"; + + public static final long CC_DINERS = 2L; + + public static final long CC_MASTERCARD = 1L; + + public static final long CC_AMEX = 3L; + + public static final long CC_VISA = 0L; + + public static final String P_SHOPNET_PID = "SHOPNET_PID"; + + public static final String P_SHOPNET_ID = "SHOPNET_ID"; + + public static final String DEFAULT_SHOPNET_ACTION = "https://ecommerce.infogroup.it/shopnetplus/do"; + + public ShopnetReq() {} + + public ShopnetReq(String lang) { + setlang(lang); + } + + private void setlang(String l_lang) { + if (l_lang.toLowerCase().equals("it")) { + setL("0"); + } else if (l_lang.toLowerCase().equals("en")) { + setL("1"); + } else if (l_lang.toLowerCase().equals("es\t")) { + setL("2"); + } else { + setL("0"); + } + } + + public String getF() { + return (this.f == null) ? "" : this.f.trim(); + } + + public void setF(String f) { + this.f = f; + } + + public String getL() { + return (this.l == null) ? "" : this.l.trim(); + } + + public void setL(String l) { + this.l = l; + } + + public String getM() { + return (this.m == null) ? "" : this.m.trim(); + } + + public void setM(String m) { + this.m = m; + } + + public String getO() { + return (this.o == null) ? "" : this.o.trim(); + } + + public void setO(String o) { + this.o = o; + } + + public String getI() { + return (this.i == null) ? "" : this.i.trim(); + } + + public void setI(String i) { + this.i = i; + } + + public String getD() { + return (this.d == null) ? "" : this.d.trim(); + } + + public void setD(String d) { + this.d = d; + } + + public String getP() { + return (this.p == null) ? "" : this.p.trim(); + } + + public void setP(String p) { + this.p = p; + } + + public String getC() { + return (this.c == null) ? "" : this.c.trim(); + } + + public void setC(String c) { + this.c = c; + } + + public String getU() { + return (this.u == null) ? "" : this.u.trim(); + } + + public void setU(String u) { + this.u = u; + } + + public String getN() { + return (this.n == null) ? "" : this.n.trim(); + } + + public void setN(String n) { + this.n = n; + } + + public String getE() { + return (this.e == null) ? "" : this.e.trim(); + } + + public void setE(String e) { + this.e = e; + } + + public String getAction() { + return (this.action == null) ? "https://ecommerce.infogroup.it/shopnetplus/do" : this.action.trim(); + } + + public void setAction(String action) { + this.action = action; + } + + public void setImporto(double l_importo) {} + + public NumberFormat getNf2() { + if (nf2 == null) { + nf2 = NumberFormat.getInstance(Locale.ITALIAN); + nf2.setMaximumFractionDigits(2); + nf2.setMinimumFractionDigits(2); + } + return nf2; + } + + public static void initApplicationParms(ApplParmFull ap) { + if (ap != null) { + DBAdapter.logDebug(true, "shopnet chechout initParms: start"); + String l_tipoParm = "SHOPNET"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + Parm bean = new Parm(ap); + l_tipoParm = "SHOPNET"; + bean.findByCodice("PAY_KO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAY_KO"); + bean.setDescrizione("PAY_KO"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payRes.jsp"); + bean.setNota("PAY_KO"); + bean.save(); + bean.findByCodice("PAY_OK"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAY_OK"); + bean.setDescrizione("PAY_OK"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payRes.jsp"); + bean.setNota("PAY_OK"); + bean.save(); + bean.findByCodice("SHOPNET_ID"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SHOPNET_ID"); + bean.setDescrizione("SHOPNET_ID"); + bean.setFlgTipo(0L); + bean.setNota("SHOPNET_ID"); + bean.save(); + bean.findByCodice("SHOPNET_PID"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SHOPNET_PID"); + bean.setDescrizione("SHOPNET_PID"); + bean.setFlgTipo(0L); + bean.setNota("SHOPNET_PID"); + bean.save(); + DBAdapter.logDebug(true, "shopnet chechout initParms: stop"); + } + } + + public static final String getCC(long l_cc) { + switch ((int)l_cc) { + case 3: + return "American Express"; + case 2: + return "Diners"; + case 1: + return "Mastercard"; + case 0: + return "Visa"; + } + return "??"; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/infogroup/ShopnetResp.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/infogroup/ShopnetResp.java new file mode 100644 index 00000000..84590580 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/infogroup/ShopnetResp.java @@ -0,0 +1,79 @@ +package it.acxent.bank.infogroup; + +import it.acxent.bank._BankAdapter; + +public class ShopnetResp extends _BankAdapter { + private long m; + + private long o; + + private long l; + + private String a; + + private long s; + + private long id_ordine; + + public static final long STATO_TRANS_NON_RICH = 1L; + + public static final long STATO_TRANS_GESTITA = 2L; + + public void fillResponse(String bean) {} + + public long getId_ordine() { + return this.id_ordine; + } + + public String getA() { + return (this.a == null) ? "" : this.a.trim(); + } + + public void setA(String a) { + this.a = a; + } + + public long getM() { + return this.m; + } + + public void setM(long m) { + this.m = m; + } + + public long getO() { + return this.o; + } + + public void setO(long o) { + this.o = o; + } + + public long getL() { + return this.l; + } + + public void setL(long l) { + this.l = l; + } + + public long getS() { + return this.s; + } + + public void setS(long s) { + this.s = s; + } + + public long getStato() { + return getS(); + } + + public String getCodiceAutorizzazione() { + return getA(); + } + + public void setId_ordine(long id_ordine) { + this.id_ordine = id_ordine; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/keyclient/KeyClientReq.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/keyclient/KeyClientReq.java new file mode 100644 index 00000000..45aafe9d --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/keyclient/KeyClientReq.java @@ -0,0 +1,346 @@ +package it.acxent.bank.keyclient; + +import it.acxent.bank._BankAdapter; +import it.acxent.common.Parm; +import it.acxent.db.ApplParmFull; +import it.acxent.reg.EcDc; +import java.net.URLEncoder; + +public class KeyClientReq extends _BankAdapter { + public static final String LANG_CODE_IT = "ITA"; + + public static final String LANG_CODE_EN = "ENG"; + + public static final String LANG_CODE_ES = "SPA"; + + public static final String LANG_CODE_FR = "FRA"; + + public static final String LANG_CODE_DE = "GER"; + + public static final String LANG_CODE_ITA_ENG = "ITA-ENG"; + + public static final String LANG_CODE_JPN = "JPN"; + + public static final String DIV_CODE_LIRA = "18"; + + public static final String DIV_CODE_EURO = "242"; + + public static final String DIV_CODE_STERLINE = "2"; + + public static final String DIV_CODE_YEN = "71"; + + public static final String DIV_CODE_DOLLARL_HK = "103"; + + public static final String DIV_CODE_REAL = "234"; + + private String divisa; + + private String codTrans; + + private String mail; + + private String importo; + + private String languageId; + + private String alias; + + private String key; + + private String url; + + private String url_back; + + public static final String P_KC_KEY = "KC_KEY"; + + public static final String P_URL_RESPONSE = "KC_URL_RESPONSE"; + + public static final String P_KC_ALIAS = "KC_ALIAS"; + + public static final String P_PAYMENT_OK_PAGE = "KC_PAY_OK"; + + public static final String P_PAYMENT_ERROR_PAGE = "KC_PAY_KO"; + + public static final String P_URL_RESPONSE_NULL = "KC_URL_RESPONSE_NULL"; + + public static final String TEST_ALIAS = "payment_testm_urlmac"; + + public static final String REQ_URL = "https://ecommerce.cim-italia.it/ecomm/DispatcherServlet"; + + public static final String DIV_CODE_DOLLARI = "1"; + + public String getCodTrans() { + return (this.codTrans == null) ? "" : this.codTrans; + } + + public void setCodTrans(String myamount) { + this.codTrans = myamount; + } + + public String getImporto() { + return (this.importo == null) ? "" : this.importo; + } + + public void setImporto(String mybuyeremail) { + this.importo = mybuyeremail; + } + + public String getMail() { + return (this.mail == null) ? "" : this.mail; + } + + public void setMail(String mybuyername) { + this.mail = mybuyername; + } + + public String getDivisa() { + return (this.divisa == null) ? "" : this.divisa; + } + + public void setDivisa(String mycurrency) { + this.divisa = mycurrency; + } + + public String getAlias() { + return (this.alias == null) ? "" : this.alias; + } + + public void setAlias(String mycustominfo) { + this.alias = mycustominfo; + } + + private String getMylanguageCode() { + if (getLanguageId().toLowerCase().equals("it")) + return "ITA"; + if (getLanguageId().toLowerCase().equals("en")) + return "ENG"; + if (getLanguageId().toLowerCase().equals("es\t")) + return "SPA"; + if (getLanguageId().toLowerCase().equals("fr")) + return "FRA"; + if (getLanguageId().toLowerCase().equals("de")) + return "GER"; + return ""; + } + + public String getMacEsempio() { + String temp = "codTrans=" + getCodTrans() + "divisa=" + getDivisa() + "importo=1esempiodicalcolomac"; + String res = ""; + try { + res = URLEncoder.encode(EcDc.encode64String(EcDc.cryptMD5Plain(temp)), "UTF-8"); + } catch (Exception e) { + e.printStackTrace(); + } + return res; + } + + public String getMac() { + String temp = "codTrans=" + getCodTrans() + "divisa=" + getDivisa() + "importo=" + + getImportoUrl() + getKey(); + String res = ""; + try { + res = URLEncoder.encode(EcDc.encode64String(EcDc.cryptMD5Plain(temp)), "UTF-8"); + } catch (Exception e) { + e.printStackTrace(); + } + return res; + } + + public String getLanguageId() { + return (this.languageId == null) ? "" : this.languageId; + } + + public void setLanguageId(String lang) { + this.languageId = lang; + } + + public String getFullRequestUrl() { + StringBuffer theUrl = new StringBuffer("https://ecommerce.cim-italia.it/ecomm/DispatcherServlet"); + theUrl.append("alias="); + theUrl.append(getAlias()); + theUrl.append("&importo="); + theUrl.append(getImporto()); + theUrl.append("&divisa="); + theUrl.append(getDivisa()); + theUrl.append("&codTrans="); + theUrl.append(getCodTrans()); + theUrl.append("&mail="); + theUrl.append(getMail()); + theUrl.append("&mac="); + try { + theUrl.append(URLEncoder.encode(getMac(), "UTF-8")); + } catch (Exception e) { + e.printStackTrace(); + } + theUrl.append("&languageId="); + theUrl.append(getLanguageId()); + theUrl.append("&url="); + theUrl.append(getUrl()); + if (!getUrl_back().isEmpty()) { + theUrl.append("&url_back="); + theUrl.append(getUrl_back()); + } + return theUrl.toString(); + } + + public String getRequestUrl() { + StringBuffer theUrl = new StringBuffer("https://ecommerce.cim-italia.it/ecomm/DispatcherServlet"); + theUrl.append("?alias="); + theUrl.append(getAlias()); + theUrl.append("&importo="); + theUrl.append(getImportoUrl()); + theUrl.append("&divisa="); + theUrl.append(getDivisa()); + theUrl.append("&codTrans="); + theUrl.append(getCodTrans()); + theUrl.append("&mail="); + theUrl.append(getMail()); + theUrl.append("&mac="); + try { + theUrl.append(URLEncoder.encode(getMac(), "UTF-8")); + } catch (Exception e) { + e.printStackTrace(); + } + theUrl.append("&languageId="); + theUrl.append(getLanguageId()); + theUrl.append("&url="); + theUrl.append(getUrl()); + if (!getUrl_back().isEmpty()) { + theUrl.append("&url_back="); + theUrl.append(getUrl_back()); + } + return theUrl.toString(); + } + + public String getKey() { + return this.key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getImportoUrl() { + if (this.importo == null) + return "0000"; + String temp = this.importo; + if (temp.indexOf('.') < 0) { + temp = temp + "00"; + } else if (temp.length() - temp.indexOf('.') < 3) { + temp = temp + "0"; + } + return temp.replace(".", ""); + } + + public String getUrl() { + return (this.url == null) ? "" : this.url.trim(); + } + + public void setUrl(String url) { + this.url = url; + } + + public String getUrl_back() { + return (this.url_back == null) ? "" : this.url_back.trim(); + } + + public void setUrl_back(String url_back) { + this.url_back = url_back; + } + + public String getTestRequestUrl() { + StringBuffer theUrl = new StringBuffer("https://ecommerce.cim-italia.it/ecomm/DispatcherServlet"); + theUrl.append("?alias="); + theUrl.append("payment_testm_urlmac"); + theUrl.append("&importo=1"); + theUrl.append("&divisa="); + theUrl.append(getDivisa()); + theUrl.append("&codTrans="); + theUrl.append(getCodTrans()); + theUrl.append("&mail="); + theUrl.append(getMail()); + theUrl.append("&mac="); + try { + theUrl.append(URLEncoder.encode(getMacEsempio(), "UTF-8")); + } catch (Exception e) { + e.printStackTrace(); + } + theUrl.append("&languageId="); + theUrl.append(getLanguageId()); + theUrl.append("&url="); + theUrl.append(getUrl()); + if (!getUrl_back().isEmpty()) { + theUrl.append("&url_back="); + theUrl.append(getUrl_back()); + } + return theUrl.toString(); + } + + public static void initApplicationParms(ApplParmFull ap) { + if (ap != null) { + String l_tipoParm = "PAYPAL"; + Parm bean = new Parm(ap); + l_tipoParm = "KEY CLIENT"; + bean.findByCodice("KC_PAY_KO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("KC_PAY_KO"); + bean.setDescrizione("KC_PAY_KO"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payRes.jsp"); + bean.setNota("KC_PAY_KO"); + bean.save(); + bean.findByCodice("KC_PAY_OK"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("KC_PAY_OK"); + bean.setDescrizione("KC_PAY_OK"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payRes.jsp"); + bean.setNota("KC_PAY_OK"); + bean.save(); + bean.findByCodice("KC_KEY"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("KC_KEY"); + bean.setDescrizione("KC_KEY"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("esempiodicalcolomac"); + bean.setNota("KC_KEY. mac di esempio: esempiodicalcolomac"); + bean.save(); + bean.findByCodice("KC_ALIAS"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("KC_ALIAS"); + bean.setDescrizione("KC_ALIAS"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payment_testm_urlmac"); + bean.setNota("KC_KEY. ALIAS DI TEST: payment_testm_urlmac"); + bean.save(); + bean.findByCodice("KC_URL_RESPONSE_NULL"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("KC_URL_RESPONSE_NULL"); + bean.setDescrizione("KC_URL_RESPONSE_NULL"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("http://localhost/td/RicevutaKC.abl"); + bean.setNota("KC_PAY_OK"); + bean.save(); + bean.findByCodice("KC_URL_RESPONSE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("KC_URL_RESPONSE"); + bean.setDescrizione("KC_URL_RESPONSE"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("http://localhost/td/RicevutaKC.abl"); + bean.setNota("KC_URL_RESPONSE"); + bean.save(); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/keyclient/KeyClientResp.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/keyclient/KeyClientResp.java new file mode 100644 index 00000000..5a398d5d --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/keyclient/KeyClientResp.java @@ -0,0 +1,149 @@ +package it.acxent.bank.keyclient; + +import it.acxent.bank._BankAdapter; + +public class KeyClientResp extends _BankAdapter { + private long id_ordine; + + private String importo; + + private String data; + + private String divisa; + + private String session_id; + + private String codTrans; + + private String orario; + + private String esito; + + private String codAut; + + private String BRAND; + + private String nome; + + private String cognome; + + private String email; + + private String mac; + + public static final String ESITO_OK = "OK"; + + public static final String ESITO_KO = "KO"; + + public long getId_ordine() { + return this.id_ordine; + } + + public void setId_ordine(long id_ordine) { + this.id_ordine = id_ordine; + } + + public String getImporto() { + return this.importo; + } + + public void setImporto(String importo) { + this.importo = importo; + } + + public String getData() { + return this.data; + } + + public void setData(String data) { + this.data = data; + } + + public String getDivisa() { + return this.divisa; + } + + public void setDivisa(String divisa) { + this.divisa = divisa; + } + + public String getSession_id() { + return this.session_id; + } + + public void setSession_id(String session_id) { + this.session_id = session_id; + } + + public String getCodTrans() { + return this.codTrans; + } + + public void setCodTrans(String codTrans) { + this.codTrans = codTrans; + } + + public String getOrario() { + return this.orario; + } + + public void setOrario(String orario) { + this.orario = orario; + } + + public String getEsito() { + return this.esito; + } + + public void setEsito(String esito) { + this.esito = esito; + } + + public String getCodAut() { + return this.codAut; + } + + public void setCodAut(String codAut) { + this.codAut = codAut; + } + + public String getBRAND() { + return this.BRAND; + } + + public void setBRAND(String brand) { + this.BRAND = brand; + } + + public String getNome() { + return this.nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public String getCognome() { + return this.cognome; + } + + public void setCognome(String cognome) { + this.cognome = cognome; + } + + public String getEmail() { + return this.email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getMac() { + return this.mac; + } + + public void setMac(String mac) { + this.mac = mac; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/paypal/PayPalReq.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/paypal/PayPalReq.java new file mode 100644 index 00000000..88bb4354 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/paypal/PayPalReq.java @@ -0,0 +1,292 @@ +package it.acxent.bank.paypal; + +import it.acxent.bank._BankAdapter; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import java.net.URLEncoder; + +public class PayPalReq extends _BankAdapter { + private static final long serialVersionUID = -3355707562295063479L; + + public static final String MTH_SET_EXPRESS_CHECKOUT = "SetExpressCheckout"; + + private double amt; + + private long id_ordine; + + private String cancelURL; + + private String returnUrl; + + private String TOKEN; + + private String PAYERID; + + private String SHIPTOCITY; + + private String SHIPTOCOUNTRYCODE; + + private String SHIPTONAME; + + private String SHIPTOSTATE; + + private String SHIPTOSTREET; + + private String SHIPTOZIP; + + private String DESC; + + public static final String P_API_PASSWORD = "PAYPAL_API_PWD"; + + public static final String P_API_SIGNATURE = "PAYPAL_API_SIGNATURE"; + + public static final String P_API_USE_CERTIFICATE = "PAYPAL_USE_CERTIFICATE"; + + public static final String P_API_USERNAME = "PAYPAL_API_USERNAME"; + + public static final String P_CANCEL_URL = "PAYPAL_CANCELURL"; + + public static final String P_CURRENCY = "PAYPAL_CURRENCY"; + + public static final String P_PAGE_STYLE = "PAYPAL_PAGE_STYLE"; + + public static final String P_PAYMENT_DETAIL_PAGE = "PAYPAL_DETAIL"; + + public static final String P_PAYMENT_ERROR_PAGE = "PAY_PAL_KO"; + + public static final String P_PAYMENT_OK_PAGE = "PAYPAL_OK"; + + public static final String P_RETURN_URL = "PAYPAL_RETURNURL"; + + public static final String MTH_GET_EXPRESS_CHECKOUT_DETAIL = "GetExpressCheckoutDetails"; + + public static final String MTH_DO_EXPRESS_CHECKOUT_PAYMENT = "DoExpressCheckoutPayment"; + + public static final String CMD_ADDROVERRIDE = "ADDROVVERRIDE=1"; + + public static final String CMD_PAGESTILE = "PAGESTYLE"; + + public static final String CMD_PAYACT_AUTH = "PAYMENTACTION=Authorization"; + + public double getAmt() { + return this.amt; + } + + public void setAmt(double amt) { + this.amt = amt; + } + + public String getCancelURL() { + return (this.cancelURL == null) ? "" : this.cancelURL; + } + + public void setCancelURL(String cancelURL) { + this.cancelURL = cancelURL; + } + + public String getReturnUrl() { + return (this.returnUrl == null) ? "" : this.returnUrl; + } + + public void setReturnUrl(String returnUrl) { + this.returnUrl = returnUrl; + } + + public String getTOKEN() { + return (this.TOKEN == null) ? "" : this.TOKEN; + } + + public void setTOKEN(String token) { + this.TOKEN = token; + } + + public String getPAYERID() { + return this.PAYERID; + } + + public void setPAYERID(String payerid) { + this.PAYERID = payerid; + } + + public String getSHIPTOCITY() { + return (this.SHIPTOCITY == null) ? "" : this.SHIPTOCITY; + } + + public String getSHIPTOCOUNTRYCODE() { + return (this.SHIPTOCOUNTRYCODE == null) ? "" : this.SHIPTOCOUNTRYCODE; + } + + public String getSHIPTONAME() { + return (this.SHIPTONAME == null) ? "" : this.SHIPTONAME; + } + + public String getSHIPTOSTATE() { + return (this.SHIPTOSTATE == null) ? "" : this.SHIPTOSTATE; + } + + public String getSHIPTOSTREET() { + return (this.SHIPTOSTREET == null) ? "" : this.SHIPTOSTREET; + } + + public String getSHIPTOZIP() { + return (this.SHIPTOZIP == null) ? "" : this.SHIPTOZIP; + } + + public long getId_ordine() { + return this.id_ordine; + } + + public void setId_ordine(long id_ordine) { + this.id_ordine = id_ordine; + } + + public String getShippingAddressString() { + return "SHIPTONAME=" + URLEncoder.encode(getSHIPTONAME()) + "&DESC=" + URLEncoder.encode(getDESC()) + "&SHIPTOSTREET=" + + URLEncoder.encode(getSHIPTOSTREET()) + "&SHIPTOCITY=" + URLEncoder.encode(getSHIPTOCITY()) + "&SHIPTOSTATE=" + + URLEncoder.encode(getSHIPTOSTATE()) + "&SHIPTOCOUNTRYCODE=" + URLEncoder.encode(getSHIPTOCOUNTRYCODE()) + "&SHIPTOZIP=" + + URLEncoder.encode(getSHIPTOZIP()) + "&ADDROVERRIDE=1"; + } + + public void setSHIPTOCITY(String shiptocity) { + this.SHIPTOCITY = shiptocity; + } + + public void setSHIPTOCOUNTRYCODE(String shiptocountrycode) { + this.SHIPTOCOUNTRYCODE = shiptocountrycode; + } + + public void setSHIPTONAME(String shiptoname) { + this.SHIPTONAME = shiptoname; + } + + public void setSHIPTOSTATE(String shiptostate) { + this.SHIPTOSTATE = shiptostate; + } + + public void setSHIPTOSTREET(String shiptostreet) { + this.SHIPTOSTREET = shiptostreet; + } + + public void setSHIPTOZIP(String shiptozip) { + this.SHIPTOZIP = shiptozip; + } + + public static void initApplicationParms(ApplParmFull ap) { + boolean debug = true; + if (ap != null) { + DBAdapter.logDebug(debug, "Paypal initParms: start"); + String l_tipoParm = "PAYPAL"; + Parm bean = new Parm(ap); + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + l_tipoParm = "PAYPAL"; + bean.findByCodice("PAYPAL_API_PWD"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_API_PWD"); + bean.setDescrizione("PAYPAL_API_PWD"); + bean.setFlgTipo(0L); + bean.setNota("PAYPAL_API_PWD"); + bean.save(); + bean.findByCodice("PAYPAL_API_SIGNATURE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_API_SIGNATURE"); + bean.setDescrizione("PAYPAL_API_SIGNATURE"); + bean.setFlgTipo(0L); + bean.setNota("PAYPAL_API_SIGNATURE"); + bean.save(); + bean.findByCodice("PAYPAL_USE_CERTIFICATE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_USE_CERTIFICATE"); + bean.setDescrizione("PAYPAL_USE_CERTIFICATE"); + bean.setFlgTipo(0L); + bean.setNota("PAYPAL_USE_CERTIFICATE"); + bean.save(); + bean.findByCodice("PAYPAL_API_USERNAME"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_API_USERNAME"); + bean.setDescrizione("PAYPAL_API_USERNAME"); + bean.setFlgTipo(0L); + bean.setNota("PAYPAL_API_USERNAME"); + bean.save(); + bean.findByCodice("PAYPAL_CANCELURL"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_CANCELURL"); + bean.setDescrizione("PAYPAL_CANCELURL"); + bean.setFlgTipo(0L); + bean.setNota("PAYPAL_CANCELURL"); + bean.save(); + bean.findByCodice("PAYPAL_CURRENCY"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_CURRENCY"); + bean.setDescrizione("PAYPAL_CURRENCY"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("EUR"); + bean.setNota("PAYPAL_CURRENCY"); + bean.save(); + bean.findByCodice("PAYPAL_PAGE_STYLE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_PAGE_STYLE"); + bean.setDescrizione("PAYPAL_PAGE_STYLE"); + bean.setFlgTipo(0L); + bean.setNota("PAYPAL_PAGE_STYLE"); + bean.save(); + bean.findByCodice("PAYPAL_DETAIL"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_DETAIL"); + bean.setDescrizione("PAYPAL_DETAIL"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payPalRes.jsp"); + bean.setNota("PAYPAL_DETAIL"); + bean.save(); + bean.findByCodice("PAY_PAL_KO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAY_PAL_KO"); + bean.setDescrizione("PAY_PAL_KO"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payPalRes.jsp"); + bean.setNota("PAY_PAL_KO"); + bean.save(); + bean.findByCodice("PAYPAL_OK"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_OK"); + bean.setDescrizione("PAYPAL_OK"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payPalRes.jsp"); + bean.setNota("PAYPAL_OK"); + bean.save(); + bean.findByCodice("PAYPAL_RETURNURL"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_RETURNURL"); + bean.setDescrizione("PAYPAL_RETURNURL"); + bean.setFlgTipo(0L); + bean.setNota("PAYPAL_RETURNURL"); + bean.save(); + DBAdapter.logDebug(debug, "Paypal initParms: stop"); + StatusMsg.deleteMsgByTag(ap, "INIT"); + } + } + + public String getDESC() { + return (this.DESC == null) ? "" : this.DESC.trim(); + } + + public void setDESC(String dESC) { + this.DESC = dESC; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/paypal/PayPalResp.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/paypal/PayPalResp.java new file mode 100644 index 00000000..a6c2f88e --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/paypal/PayPalResp.java @@ -0,0 +1,363 @@ +package it.acxent.bank.paypal; + +import it.acxent.bank._BankAdapter; +import java.io.BufferedReader; +import java.net.URLDecoder; + +public class PayPalResp extends _BankAdapter { + public static final String SESS_TOKEN = "_SESS_TOKEN"; + + private String ACK; + + private String TIMESTAMP; + + private String VERSION; + + private String L_ERRORCODE0; + + private String L_SHORTMESSAGE0; + + private String L_SEVERITYCODE0; + + private String L_LONGMESSAGE0; + + private String CORRELATIONID; + + private String BUILD; + + private String AMT; + + private String EMAIL; + + private String PAYERID; + + private String PAYERSTATUS; + + private String FIRSTNAME; + + private String LASTNAME; + + private String SHIPTOSTREET; + + private String COUNTRYCODE; + + private String SHIPTOCITY; + + private String SHIPTOSTATE; + + private String SHIPTOCOUNTRYCODE; + + private String SHIPTOZIP; + + private String ADDRESSID; + + private String ADDRESSSTATUS; + + private String SHIPTONAME; + + private String TRANSACTIONID; + + private String TOKEN; + + private long id_ordine; + + private boolean paymentDone = false; + + private boolean detailBuyer = false; + + public static final String SESS_ID_ORDER = "_SESS_ID_ORDER"; + + public String getACK() { + return (this.ACK == null) ? "" : this.ACK; + } + + public void setACK(String ack) { + this.ACK = ack; + } + + public String getBUILD() { + return (this.BUILD == null) ? "" : this.BUILD; + } + + public void setBUILD(String build) { + this.BUILD = build; + } + + public String getCORRELATIONID() { + return (this.CORRELATIONID == null) ? "" : + this.CORRELATIONID; + } + + public void setCORRELATIONID(String correlationid) { + this.CORRELATIONID = correlationid; + } + + public String getTIMESTAMP() { + return (this.TIMESTAMP == null) ? "" : this.TIMESTAMP; + } + + public void setTIMESTAMP(String timestamp) { + this.TIMESTAMP = timestamp; + } + + public String getVERSION() { + return (this.VERSION == null) ? "" : this.VERSION; + } + + public void setVERSION(String version) { + this.VERSION = version; + } + + public String getL_ERRORCODE0() { + return (this.L_ERRORCODE0 == null) ? "" : this.L_ERRORCODE0; + } + + public void setL_ERRORCODE0(String l_errorcode0) { + this.L_ERRORCODE0 = l_errorcode0; + } + + public String getL_LONGMESSAGE0() { + return (this.L_LONGMESSAGE0 == null) ? "" : + this.L_LONGMESSAGE0; + } + + public void setL_LONGMESSAGE0(String l_longmessage0) { + this.L_LONGMESSAGE0 = l_longmessage0; + } + + public String getL_SEVERITYCODE0() { + return (this.L_SEVERITYCODE0 == null) ? "" : + this.L_SEVERITYCODE0; + } + + public void setL_SEVERITYCODE0(String l_severitycode0) { + this.L_SEVERITYCODE0 = l_severitycode0; + } + + public String getL_SHORTMESSAGE0() { + return (this.L_SHORTMESSAGE0 == null) ? "" : + this.L_SHORTMESSAGE0; + } + + public void setL_SHORTMESSAGE0(String l_shortmessage0) { + this.L_SHORTMESSAGE0 = l_shortmessage0; + } + + public String getTOKEN() { + return (this.TOKEN == null) ? "" : this.TOKEN; + } + + public void setTOKEN(String token) { + this.TOKEN = token; + } + + public String getADDRESSID() { + return this.ADDRESSID; + } + + public void setADDRESSID(String addressid) { + this.ADDRESSID = addressid; + } + + public String getADDRESSSTATUS() { + return this.ADDRESSSTATUS; + } + + public void setADDRESSSTATUS(String addressstatus) { + this.ADDRESSSTATUS = addressstatus; + } + + public String getCOUNTRYCODE() { + return this.COUNTRYCODE; + } + + public boolean isResponseOk() { + return getACK().equals("Success"); + } + + public void setCOUNTRYCODE(String countrycode) { + this.COUNTRYCODE = countrycode; + } + + public String getEMAIL() { + return this.EMAIL; + } + + public void setEMAIL(String email) { + this.EMAIL = email; + } + + public String getFIRSTNAME() { + return this.FIRSTNAME; + } + + public void fillResponse(BufferedReader reader) { + try { + String response = URLDecoder.decode(reader.readLine()); + setACK("Success"); + setL_LONGMESSAGE0(response); + setAMT(getAttribute(response, "AMT")); + setACK(getAttribute(response, "ACK")); + setTOKEN(getAttribute(response, "TOKEN")); + setADDRESSID(getAttribute(response, "ADDRESSID")); + setADDRESSSTATUS(getAttribute(response, "ADDRESSSTATUS")); + setBUILD(getAttribute(response, "BUILD")); + setCORRELATIONID(getAttribute(response, "CORRELATIONID")); + setCOUNTRYCODE(getAttribute(response, "COUNTRYCODE")); + setEMAIL(getAttribute(response, "EMAIL")); + setFIRSTNAME(getAttribute(response, "FIRSTNAME")); + setL_ERRORCODE0(getAttribute(response, "L_ERRORCODE0")); + setL_LONGMESSAGE0(getAttribute(response, "L_LONGMESSAGE0")); + setL_SEVERITYCODE0(getAttribute(response, "L_SEVERITCODE0")); + setLASTNAME(getAttribute(response, "LASTNAME")); + setPAYERID(getAttribute(response, "PAYERID")); + setPAYERSTATUS(getAttribute(response, "PAYERSTATUS")); + setSHIPTOCITY(getAttribute(response, "SHIPTOCITY")); + setSHIPTOCOUNTRYCODE(getAttribute(response, "SHIPTOCOUNTRYCODE")); + setSHIPTONAME(getAttribute(response, "SHIPTONAME")); + setSHIPTOSTREET(getAttribute(response, "SHIPTOSTREET")); + setSHIPTOSTATE(getAttribute(response, "SHIPTOSTATE")); + setSHIPTOZIP(getAttribute(response, "SHIPTOZIP")); + setTIMESTAMP(getAttribute(response, "TIMESTAMP")); + setVERSION(getAttribute(response, "VERSION")); + setTRANSACTIONID(getAttribute(response, "TRANSACTIONID")); + } catch (Exception e) { + setACK("Error"); + setL_LONGMESSAGE0(e.getMessage()); + e.printStackTrace(); + } + } + + private String getAttribute(String response, String key) { + try { + if (response.indexOf(key) >= 0) { + int idxStart = response.indexOf(key) + key.length() + 1; + int idxStop = response.substring(idxStart).indexOf("&") + idxStart; + if (idxStop < idxStart) + idxStop = response.length(); + return response.substring(idxStart, idxStop); + } + return ""; + } catch (Exception e) { + System.out.println(key); + return ""; + } + } + + public void setFIRSTNAME(String firstname) { + this.FIRSTNAME = firstname; + } + + public String getLASTNAME() { + return this.LASTNAME; + } + + public void setLASTNAME(String lastname) { + this.LASTNAME = lastname; + } + + public String getPAYERID() { + return this.PAYERID; + } + + public void setPAYERID(String payerid) { + this.PAYERID = payerid; + } + + public String getPAYERSTATUS() { + return this.PAYERSTATUS; + } + + public void setPAYERSTATUS(String payerstatus) { + this.PAYERSTATUS = payerstatus; + } + + public String getSHIPTOCITY() { + return (this.SHIPTOCITY == null) ? "" : this.SHIPTOCITY; + } + + public void setSHIPTOCITY(String shiptocity) { + this.SHIPTOCITY = shiptocity; + } + + public String getSHIPTOCOUNTRYCODE() { + return (this.SHIPTOCOUNTRYCODE == null) ? "" : + this.SHIPTOCOUNTRYCODE; + } + + public void setSHIPTOCOUNTRYCODE(String shiptocountrycode) { + this.SHIPTOCOUNTRYCODE = shiptocountrycode; + } + + public String getSHIPTONAME() { + return (this.SHIPTONAME == null) ? "" : this.SHIPTONAME; + } + + public void setSHIPTONAME(String shiptoname) { + this.SHIPTONAME = shiptoname; + } + + public String getSHIPTOSTATE() { + return (this.SHIPTOSTATE == null) ? "" : this.SHIPTOSTATE; + } + + public void setSHIPTOSTATE(String shiptostate) { + this.SHIPTOSTATE = shiptostate; + } + + public String getSHIPTOSTREET() { + return (this.SHIPTOSTREET == null) ? "" : this.SHIPTOSTREET; + } + + public void setSHIPTOSTREET(String shiptostreet) { + this.SHIPTOSTREET = shiptostreet; + } + + public String getSHIPTOZIP() { + return (this.SHIPTOZIP == null) ? "" : this.SHIPTOZIP; + } + + public void setSHIPTOZIP(String shiptozip) { + this.SHIPTOZIP = shiptozip; + } + + public String getAMT() { + return this.AMT; + } + + public void setAMT(String amt) { + this.AMT = amt; + } + + public long getId_ordine() { + return this.id_ordine; + } + + public void setId_ordine(long id_ordine) { + this.id_ordine = id_ordine; + } + + public boolean isDetailBuyer() { + return this.detailBuyer; + } + + public void setDetailBuyer(boolean detailBuyer) { + this.detailBuyer = detailBuyer; + } + + public boolean isPaymentDone() { + return this.paymentDone; + } + + public void setPaymentDone(boolean paymentDone) { + this.paymentDone = paymentDone; + } + + public String getTRANSACTIONID() { + return this.TRANSACTIONID; + } + + public void setTRANSACTIONID(String transactionid) { + this.TRANSACTIONID = transactionid; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/paypalcheckout/PayPalOrder.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/paypalcheckout/PayPalOrder.java new file mode 100644 index 00000000..acb1ab91 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/paypalcheckout/PayPalOrder.java @@ -0,0 +1,139 @@ +package it.acxent.bank.paypalcheckout; + +import com.paypal.core.PayPalEnvironment; +import com.paypal.core.PayPalHttpClient; +import com.paypal.http.HttpRequest; +import com.paypal.http.HttpResponse; +import com.paypal.http.exceptions.HttpException; +import com.paypal.http.serializer.Json; +import com.paypal.orders.AmountWithBreakdown; +import com.paypal.orders.ApplicationContext; +import com.paypal.orders.LinkDescription; +import com.paypal.orders.Order; +import com.paypal.orders.OrderRequest; +import com.paypal.orders.OrdersCreateRequest; +import com.paypal.orders.OrdersGetRequest; +import com.paypal.orders.PurchaseUnitRequest; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import org.apache.commons.lang3.StringUtils; +import org.json.JSONObject; + +public class PayPalOrder { + private PayPalHttpClient client; + + private PayPalReq payPalReq; + + private boolean useSandbox = true; + + public PayPalOrder(PayPalReq payPalReq) { + setPayPalReq(payPalReq); + this.useSandbox = getPayPalReq().isUseSandbox(); + } + + private OrderRequest buildMinimumRequestBody() { + OrderRequest orderRequest = new OrderRequest(); + orderRequest.checkoutPaymentIntent("CAPTURE"); + ApplicationContext applicationContext = new ApplicationContext().cancelUrl(getPayPalReq().getCancelURL()) + .returnUrl(getPayPalReq().getReturnUrl()); + orderRequest.applicationContext(applicationContext); + List purchaseUnitRequests = new ArrayList<>(); + PurchaseUnitRequest purchaseUnitRequest = new PurchaseUnitRequest() + .amountWithBreakdown(new AmountWithBreakdown() + .currencyCode(getPayPalReq().getCurrency()).value(String.valueOf(getPayPalReq().getAmt()))) + .description(getPayPalReq().getDESC()); + purchaseUnitRequests.add(purchaseUnitRequest); + orderRequest.purchaseUnits(purchaseUnitRequests); + return orderRequest; + } + + public HttpResponse createOrder(boolean debug) throws IOException { + OrdersCreateRequest request = new OrdersCreateRequest(); + request.header("prefer", "return=representation"); + request.requestBody(buildMinimumRequestBody()); + HttpResponse response = getClient().execute((HttpRequest)request); + if (debug && + response.statusCode() == 201) { + System.out.println("Order with Minimum Payload: "); + System.out.println("Status Code: " + response.statusCode()); + System.out.println("Status: " + ((Order)response.result()).status()); + System.out.println("Order ID: " + ((Order)response.result()).id()); + System.out.println("Intent: " + ((Order)response.result()).checkoutPaymentIntent()); + System.out.println("Links: "); + for (LinkDescription link : (Iterable)((Order)response.result()).links()) + System.out.println("\t" + link.rel() + ": " + link.href() + "\tCall Type: " + link.method()); + System.out.println("Total Amount: " + ((Order)response.result()).purchaseUnits().get(0).amountWithBreakdown().currencyCode() + " " + ((Order) + response.result()).purchaseUnits().get(0).amountWithBreakdown().value()); + System.out.println("Full response body:"); + System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4)); + } + return response; + } + + public static void main(String[] args) { + try { + PayPalReq ppr = new PayPalReq(); + new PayPalOrder(ppr).createOrder(true); + } catch (HttpException e) { + System.out.println(e.getLocalizedMessage()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public PayPalReq getPayPalReq() { + return this.payPalReq; + } + + public void setPayPalReq(PayPalReq payPalReq) { + this.payPalReq = payPalReq; + } + + public PayPalHttpClient getClient() { + if (this.client == null) { + System.out.println("clientid: " + getPayPalReq().getPaypalClientId()); + System.out.println("clientSc: " + getPayPalReq().getPaypalClientSecret()); + if (this.useSandbox) { + PayPalEnvironment.Sandbox sandbox = new PayPalEnvironment.Sandbox(getPayPalReq().getPaypalClientId(), + getPayPalReq().getPaypalClientSecret()); + this.client = new PayPalHttpClient((PayPalEnvironment)sandbox); + } else { + PayPalEnvironment.Live live = new PayPalEnvironment.Live(getPayPalReq().getPaypalClientId(), + getPayPalReq().getPaypalClientSecret()); + this.client = new PayPalHttpClient((PayPalEnvironment)live); + } + } + return this.client; + } + + public String prettyPrint(JSONObject jo, String pre) { + Iterator keys = jo.keys(); + StringBuilder pretty = new StringBuilder(); + while (keys.hasNext()) { + String key = (String)keys.next(); + pretty.append(String.format("%s%s: ", pre, StringUtils.capitalize(key))); + if (jo.get(key) instanceof JSONObject) { + pretty.append(prettyPrint(jo.getJSONObject(key), pre + "\t")); + continue; + } + if (jo.get(key) instanceof org.json.JSONArray) { + int sno = 1; + for (Object jsonObject : (Iterable)jo.getJSONArray(key)) { + pretty.append(String.format("\n%s\t%d:\n", pre, sno++)); + pretty.append(prettyPrint((JSONObject)jsonObject, pre + "\t\t")); + } + continue; + } + pretty.append(String.format("%s\n", jo.getString(key))); + } + return pretty.toString(); + } + + public HttpResponse getOrder(String orderId) throws IOException { + OrdersGetRequest request = new OrdersGetRequest(orderId); + HttpResponse response = getClient().execute((HttpRequest)request); + return response; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/paypalcheckout/PayPalReq.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/paypalcheckout/PayPalReq.java new file mode 100644 index 00000000..a5d8cc0f --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/paypalcheckout/PayPalReq.java @@ -0,0 +1,291 @@ +package it.acxent.bank.paypalcheckout; + +import it.acxent.bank._BankAdapter; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import java.net.URLEncoder; + +public class PayPalReq extends _BankAdapter { + private String paypalClientId; + + private String paypalClientSecret; + + private boolean useSandbox = false; + + private double amt; + + private long id_ordine; + + private String cancelURL; + + private String returnUrl; + + private String paypalOrderId; + + private String TOKEN; + + private String PAYERID; + + private String SHIPTOCITY; + + private String SHIPTOCOUNTRYCODE; + + private String SHIPTONAME; + + private String SHIPTOSTATE; + + private String SHIPTOSTREET; + + private String SHIPTOZIP; + + private String DESC; + + private String currency; + + public static final String P_CHECKOUT_APPLICATION_CLIENT_ID = "PAYPAL_CHECKOUT_APPLICATION_CLIENT_ID"; + + public static final String P_CHECKOUT_APPLICATION_CLIENT_SECRET = "PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET"; + + public static final String P_CHECKOUT_USE_SANDBOX = "P_PAYPAL_CHECKOUT_USE_SANDBOX"; + + public static final String P_CANCEL_URL = "PAYPAL_CANCELURL"; + + public static final String P_CURRENCY = "PAYPAL_CURRENCY"; + + public static final String P_PAYMENT_OK_PAGE = "PAYPAL_OK"; + + public static final String P_RETURN_URL = "PAYPAL_RETURNURL"; + + public double getAmt() { + return this.amt; + } + + public void setAmt(double amt) { + this.amt = amt; + } + + public String getCancelURL() { + return (this.cancelURL == null) ? "" : this.cancelURL; + } + + public void setCancelURL(String cancelURL) { + this.cancelURL = cancelURL; + } + + public String getReturnUrl() { + return (this.returnUrl == null) ? "" : this.returnUrl; + } + + public void setReturnUrl(String returnUrl) { + this.returnUrl = returnUrl; + } + + public String getTOKEN() { + return (this.TOKEN == null) ? "" : this.TOKEN; + } + + public void setTOKEN(String token) { + this.TOKEN = token; + } + + public String getPAYERID() { + return this.PAYERID; + } + + public void setPAYERID(String payerid) { + this.PAYERID = payerid; + } + + public String getSHIPTOCITY() { + return (this.SHIPTOCITY == null) ? "" : this.SHIPTOCITY; + } + + public String getSHIPTOCOUNTRYCODE() { + return (this.SHIPTOCOUNTRYCODE == null) ? "" : this.SHIPTOCOUNTRYCODE; + } + + public String getSHIPTONAME() { + return (this.SHIPTONAME == null) ? "" : this.SHIPTONAME; + } + + public String getSHIPTOSTATE() { + return (this.SHIPTOSTATE == null) ? "" : this.SHIPTOSTATE; + } + + public String getSHIPTOSTREET() { + return (this.SHIPTOSTREET == null) ? "" : this.SHIPTOSTREET; + } + + public String getSHIPTOZIP() { + return (this.SHIPTOZIP == null) ? "" : this.SHIPTOZIP; + } + + public long getId_ordine() { + return this.id_ordine; + } + + public void setId_ordine(long id_ordine) { + this.id_ordine = id_ordine; + } + + public String getShippingAddressString() { + return "SHIPTONAME=" + URLEncoder.encode(getSHIPTONAME()) + "&DESC=" + URLEncoder.encode(getDESC()) + "&SHIPTOSTREET=" + + URLEncoder.encode(getSHIPTOSTREET()) + "&SHIPTOCITY=" + URLEncoder.encode(getSHIPTOCITY()) + "&SHIPTOSTATE=" + + URLEncoder.encode(getSHIPTOSTATE()) + "&SHIPTOCOUNTRYCODE=" + URLEncoder.encode(getSHIPTOCOUNTRYCODE()) + "&SHIPTOZIP=" + + URLEncoder.encode(getSHIPTOZIP()) + "&ADDROVERRIDE=1"; + } + + public void setSHIPTOCITY(String shiptocity) { + this.SHIPTOCITY = shiptocity; + } + + public void setSHIPTOCOUNTRYCODE(String shiptocountrycode) { + this.SHIPTOCOUNTRYCODE = shiptocountrycode; + } + + public void setSHIPTONAME(String shiptoname) { + this.SHIPTONAME = shiptoname; + } + + public void setSHIPTOSTATE(String shiptostate) { + this.SHIPTOSTATE = shiptostate; + } + + public void setSHIPTOSTREET(String shiptostreet) { + this.SHIPTOSTREET = shiptostreet; + } + + public void setSHIPTOZIP(String shiptozip) { + this.SHIPTOZIP = shiptozip; + } + + public static void initApplicationParms(ApplParmFull ap) { + boolean debug = false; + if (ap != null) { + DBAdapter.logDebug(debug, "payPal chechout initParms: start"); + String l_tipoParm = "PAYPAL"; + Parm bean = new Parm(ap); + l_tipoParm = "PAYPAL_CHECKOUT"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("PAYPAL_CANCELURL"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_CANCELURL"); + bean.setDescrizione("PAYPAL_CANCELURL"); + bean.setFlgTipo(0L); + bean.setNota("PAYPAL_CANCELURL"); + bean.save(); + bean.findByCodice("PAYPAL_CURRENCY"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_CURRENCY"); + bean.setDescrizione("PAYPAL_CURRENCY"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("EUR"); + bean.setNota("PAYPAL_CURRENCY"); + bean.save(); + bean.findByCodice("PAYPAL_OK"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_OK"); + bean.setDescrizione("PAYPAL_OK"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payPalRes.jsp"); + bean.setNota("PAYPAL_OK"); + bean.save(); + bean.findByCodice("PAYPAL_RETURNURL"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_RETURNURL"); + bean.setDescrizione("PAYPAL_RETURNURL"); + bean.setFlgTipo(0L); + bean.setNota("PAYPAL_RETURNURL"); + bean.save(); + bean.findByCodice("PAYPAL_CHECKOUT_APPLICATION_CLIENT_ID"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_CHECKOUT_APPLICATION_CLIENT_ID"); + bean.setDescrizione("PAYPAL_CHECKOUT_APPLICATION_CLIENT_ID"); + bean.setFlgTipo(0L); + bean.setNota("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET"); + bean.save(); + bean.findByCodice("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET"); + bean.setDescrizione("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET"); + bean.setFlgTipo(0L); + bean.setNota("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET"); + bean.save(); + bean.findByCodice("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET"); + bean.setDescrizione("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET"); + bean.setFlgTipo(0L); + bean.setNota("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET"); + bean.save(); + bean.findByCodice("P_PAYPAL_CHECKOUT_USE_SANDBOX"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("P_PAYPAL_CHECKOUT_USE_SANDBOX"); + bean.setDescrizione("P_PAYPAL_CHECKOUT_USE_SANDBOX"); + bean.setFlgTipo(5L); + bean.setNota("P_PAYPAL_CHECKOUT_USE_SANDBOX"); + bean.save(); + DBAdapter.logDebug(debug, "payPal chechout initParms: stop"); + } + } + + public String getDESC() { + return (this.DESC == null) ? "" : this.DESC.trim(); + } + + public void setDESC(String dESC) { + this.DESC = dESC; + } + + public String getCurrency() { + return (this.currency == null) ? "EUR" : this.currency.trim(); + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + public String getPaypalClientId() { + return this.paypalClientId; + } + + public void setPaypalClientId(String paypalClientId) { + this.paypalClientId = paypalClientId; + } + + public String getPaypalClientSecret() { + return this.paypalClientSecret; + } + + public void setPaypalClientSecret(String paypalClientSecret) { + this.paypalClientSecret = paypalClientSecret; + } + + public boolean isUseSandbox() { + return this.useSandbox; + } + + public void setUseSandbox(boolean useSandbox) { + this.useSandbox = useSandbox; + } + + public String getPaypalOrderId() { + return (this.paypalOrderId == null) ? "" : this.paypalOrderId.trim(); + } + + public void setPaypalOrderId(String paypalOrderId) { + this.paypalOrderId = paypalOrderId; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/poste/PeReq.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/poste/PeReq.java new file mode 100644 index 00000000..769c0d2f --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/poste/PeReq.java @@ -0,0 +1,303 @@ +package it.acxent.bank.poste; + +import it.acxent.bank._BankAdapter; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; + +public class PeReq extends _BankAdapter { + public static final String LANG_CODE_USA = "USA"; + + public static final String LANG_CODE_ITA = "ITA"; + + public static final String DIV_CODE_EURO = "978"; + + private String currency; + + private String trackId; + + private String mail; + + private String resourcePath; + + private String language; + + private String alias; + + private String responseURL; + + private String errorURL; + + private String userName; + + private String amt; + + private String action; + + private String flgTipoPagamentoPe; + + private String merchantId; + + private String shopId; + + public static final String P_USE_IGFS = "PE_USE_IGFS"; + + public static final String P_NO_CERTIFICATO = "PE_NO_CERTIFICATO"; + + public static final String P_RESOURCE_PATH = "PE_RESOURCE_PATH"; + + public static final String P_URL_POST_RESPONSE = "PE_URL_POST_RESPONSE"; + + public static final String ALIAS_POSTEPAY = "03"; + + public static final String ALIAS_BPOPL = "01"; + + public static final String ALIAS_CC = "02"; + + public static final String ALIAS_BPIOL = "04"; + + public static final String ALIAS_POSTEPAY_IMPRESA = "06"; + + public static final String P_MERCHANT_ID = "PE_MERCHANT_ID"; + + public static final String DEFAULT_OK_KO_PAGE = "payResPe.jsp"; + + public static final String P_URL_REDIRECT_RESULT = "PE_URL_REDIRECT_RESULT"; + + public static final String P_PAYMENT_OK_PAGE = "PE_PAY_OK"; + + public static final String P_PAYMENT_ERROR_PAGE = "PE_PAY_KO"; + + public static final String P_URL_POST_RESPONSE_ERROR = "URL_POST_RESPONSE_ERROR"; + + public static final String TEST_ALIAS = "payment_testm_urlmac"; + + public static final String REQ_URL = "https://ecommerce.cim-italia.it/ecomm/DispatcherServlet"; + + public String getTrackId() { + return (this.trackId == null) ? "" : this.trackId; + } + + public void setTrackId(String myamount) { + this.trackId = myamount; + } + + public String getAmt() { + return (this.amt == null) ? "" : this.amt; + } + + public void setAmt(String mybuyeremail) { + this.amt = mybuyeremail; + } + + public String getMail() { + return (this.mail == null) ? "" : this.mail; + } + + public void setMail(String mybuyername) { + this.mail = mybuyername; + } + + public String getCurrency() { + return (this.currency == null) ? "" : this.currency; + } + + public void setCurrency(String mycurrency) { + this.currency = mycurrency; + } + + public String getAlias() { + return getMerchantId() + getMerchantId(); + } + + public void setAlias(String mycustominfo) { + this.alias = mycustominfo; + } + + public String getLanguage() { + return (this.language == null) ? "" : this.language; + } + + public void setLanguage(String lang) { + this.language = lang; + } + + public String getImportoUrl() { + return (this.amt == null) ? "" : this.amt; + } + + public String getResponseURL() { + return (this.responseURL == null) ? "" : this.responseURL.trim(); + } + + public void setResponseURL(String url) { + this.responseURL = url; + } + + public String getErrorURL() { + return (this.errorURL == null) ? "" : this.errorURL.trim(); + } + + public void setErrorURL(String url_back) { + this.errorURL = url_back; + } + + public static void initApplicationParms(ApplParmFull ap) { + if (ap != null) { + Parm bean = new Parm(ap); + String l_tipoParm = "POST ECOMMERCE"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("PE_MERCHANT_ID"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PE_MERCHANT_ID"); + bean.setDescrizione("PE_MERCHANT_ID"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("PE_MERCHANT_ID"); + bean.setNota("PE_MERCHANT_ID"); + bean.save(); + bean.findByCodice("PE_PAY_KO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PE_PAY_KO"); + bean.setDescrizione("PE_PAY_KO"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payResPe.jsp"); + bean.setNota("PE_PAY_KO"); + bean.save(); + bean.findByCodice("PE_PAY_OK"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PE_PAY_OK"); + bean.setDescrizione("PE_PAY_OK"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payResPe.jsp"); + bean.setNota("PE_PAY_OK"); + bean.save(); + bean.findByCodice("PE_NO_CERTIFICATO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PE_NO_CERTIFICATO"); + bean.setDescrizione("PE_NO_CERTIFICATO"); + bean.setFlgTipo(1L); + bean.setNota("PE_NO_CERTIFICATOSOLO PER IGFS: 0--> CON CERTIFICATO, PRODUZIONE
1 --> SENZA CERTIFICATO, SOLO TEST"); + bean.save(); + bean.findByCodice("PE_USE_IGFS"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PE_USE_IGFS"); + bean.setDescrizione("PE_USE_IGFS"); + bean.setFlgTipo(1L); + bean.setNota("PE_USE_IGFS: 0--> vecchia versione con resource.cgn
1 --> nuova versione con file properties"); + bean.save(); + bean.findByCodice("PE_RESOURCE_PATH"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PE_RESOURCE_PATH"); + bean.setDescrizione("PE_RESOURCE_PATH"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("/home/xxx/xxx/"); + bean.setNota("PE_RESOURCE_PATH: per la versione vecchia con / finale. Path assoluto dove trovare resource.cgn
per la versione nuova il percorso completo del .properties compreso il nome del file."); + bean.save(); + bean.findByCodice("PE_URL_POST_RESPONSE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PE_URL_POST_RESPONSE"); + bean.setDescrizione("PE_URL_POST_RESPONSE"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("http://test.f3.com/tf/GetResponsePe.abl"); + bean.setNota("PE_URL_POST_RESPONSE: URL HTTP RICHIAMATA TRAMITE POST. DEVE ESSERE VISIBILE SU INTERNET (NO LOCALHOST)"); + bean.save(); + bean.findByCodice("URL_POST_RESPONSE_ERROR"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("URL_POST_RESPONSE_ERROR"); + bean.setDescrizione("URL_POST_RESPONSE_ERROR"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("http://test.f3.com/tf/RicevutaPE.abl"); + bean.setNota("URL_POST_RESPONSE_ERROR: URL HTTP RICHIAMATA TRAMITE REDIRECT. DEVE ESSERE VISIBILE SU INTERNET (NO LOCALHOST)"); + bean.save(); + bean.findByCodice("PE_URL_REDIRECT_RESULT"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PE_URL_REDIRECT_RESULT"); + bean.setDescrizione("PE_URL_REDIRECT_RESULT"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("http://localhost/tf/RicevutaPE.abl"); + bean.setNota("PE_URL_REDIRECT_RESULT: URL HTTP RICHIAMATA TRAMITE REDIRECT. PUO' ESSERE LOCALHOST IN FASE DI SVILUPPO"); + bean.save(); + StatusMsg.deleteMsgByTag(ap, "INIT"); + } + } + + public String getResourcePath() { + return (this.resourcePath == null) ? "" : this.resourcePath; + } + + public void setResourcePath(String resourcePath) { + this.resourcePath = resourcePath; + } + + public String getUserName() { + return (this.userName == null) ? "" : this.userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getAction() { + return "4"; + } + + public void setAction(String action) { + this.action = action; + } + + public String getTipoPagamentoPE(String tipoPagamento) { + if (tipoPagamento.equals("04")) + return "conto bpiol"; + if (tipoPagamento.equals("01")) + return "conto bpiol"; + if (tipoPagamento.equals("04")) + return "conto bpol"; + if (tipoPagamento.equals("02")) + return "carta di credito"; + if (tipoPagamento.equals("03")) + return "carta postepay"; + if (tipoPagamento.equals("06")) + return "carta postepay Impresa"; + return "??"; + } + + public String getFlgTipoPagamentoPe() { + return (this.flgTipoPagamentoPe == null) ? "" : this.flgTipoPagamentoPe.trim(); + } + + public void setFlgTipoPagamentoPe(String flgTipoPagamentoPe) { + this.flgTipoPagamentoPe = flgTipoPagamentoPe; + } + + public String getMerchantId() { + return (this.merchantId == null) ? "" : this.merchantId.trim(); + } + + public void setMerchantId(String merchantId) { + this.merchantId = merchantId; + } + + public String getShopId() { + return (this.shopId == null) ? "" : this.shopId.trim(); + } + + public void setShopId(String shopId) { + this.shopId = shopId; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/poste/PeResp.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/poste/PeResp.java new file mode 100644 index 00000000..d768c645 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/poste/PeResp.java @@ -0,0 +1,118 @@ +package it.acxent.bank.poste; + +import it.acxent.bank._BankAdapter; + +public class PeResp extends _BankAdapter { + private long id_ordine; + + private String errorText; + + private String postdate; + + private String paymentid; + + private String trackid; + + private String result; + + private String tranid; + + private String errorCode; + + private String error; + + private String auth; + + private String errorService; + + public static final String ESITO_OK = "APPROVED"; + + public long getId_ordine() { + return this.id_ordine; + } + + public void setId_ordine(long id_ordine) { + this.id_ordine = id_ordine; + } + + public String getErrorText() { + return (this.errorText == null) ? "" : this.errorText.trim(); + } + + public void setErrorText(String importo) { + this.errorText = importo; + } + + public String getPostdate() { + return (this.postdate == null) ? "" : this.postdate.trim(); + } + + public void setPostdate(String data) { + this.postdate = data; + } + + public String getPaymentid() { + return (this.paymentid == null) ? "" : this.paymentid.trim(); + } + + public void setPaymentid(String divisa) { + this.paymentid = divisa; + } + + public String getTrackid() { + return (this.trackid == null) ? "" : this.trackid.trim(); + } + + public void setTrackid(String codTrans) { + this.trackid = codTrans; + } + + public String getResult() { + return (this.result == null) ? "" : this.result.trim(); + } + + public void setResult(String esito) { + this.result = esito; + } + + public String getTranid() { + return (this.tranid == null) ? "" : this.tranid.trim(); + } + + public void setTranid(String codAut) { + this.tranid = codAut; + } + + public String getErrorCode() { + return (this.errorCode == null) ? "" : this.errorCode.trim(); + } + + public void setErrorCode(String nome) { + this.errorCode = nome; + } + + public String getError() { + return (this.error == null) ? "" : this.error.trim(); + } + + public void setError(String cognome) { + this.error = cognome; + } + + public String getAuth() { + return (this.auth == null) ? "" : this.auth.trim(); + } + + public void setAuth(String email) { + this.auth = email; + } + + public String getErrorService() { + return (this.errorService == null) ? "" : + this.errorService.trim(); + } + + public void setErrorService(String errorService) { + this.errorService = errorService; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/poste2019/PosteReq.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/poste2019/PosteReq.java new file mode 100644 index 00000000..5c2325d7 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/poste2019/PosteReq.java @@ -0,0 +1,363 @@ +package it.acxent.bank.poste2019; + +import it.acxent.bank._BankAdapter; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.reg.EcDc; + +public class PosteReq extends _BankAdapter { + private String VALUTA; + + private String NUMORD; + + private String IMPORTO; + + private String LINGUA; + + private String EMAILESERC; + + private String EMAIL; + + private String USERID; + + public static final String TCONTAB_DIFFERITA = "D"; + + public static final String TCONTAB_IMMEDIATA = "I"; + + public static final String LANG_CODE_IT = "ITA"; + + public static final String LANG_CODE_EN = "EN"; + + public static final String P_POSTE19_MAC_KEY_START = "POSTE19_MAC_KEY_START"; + + public static final String P_POSTE19_URL_BACK = "POSTE19_URL_BACK"; + + public static final String P_POSTE19_URL_DONE = "POSTE19_URL_DONE"; + + public static final String P_POSTE19_URL_MS = "POSTE19_URL_MS"; + + public static final String P_POSTE19_EMAILESERC = "POSTE19_EMAILESERC"; + + public static final String P_POSTE19_MAC_KEY_ESITO = "POSTE19_MAC_KEY_ESITO"; + + public static final String P_POSTE19_IDNEGOZIO = "POSTE19_IDNEGOZIO"; + + public static final String P_POSTE19_TCONTAB = "POSTE19_TCONTAB"; + + public static final String P_POSTE19_OPTIONS = "POSTE19_OPTIONS"; + + public static final String URL_POSTE19_TEST = "https://acquistionlinetest.poste.it/poste/pagamenti/main?PAGE=MASTER"; + + public static final String URL_POSTE19_PROD = "https://acquistionline.poste.it/poste/pagamenti/main?PAGE=MASTER"; + + public static final String DEFAULT_URL_BACK_AND_DONE = "http://localhost/tf15/RicevutaPoste.abl"; + + public static final String DEFAULT_URL_MS = "http://localhost/tf15/RicevutaPoste.abl"; + + public static final String TEST_MAC = "CHENESOADESSO"; + + public static final String OPTIONS_G_REDIRIZIONE_IMMEDIATA = "G"; + + public static final String OPTIONS_L_ORDINE_DUPLICATO_CODE_07_URLMS = "L"; + + public static final String OPTIONS_N_NEGATA_SU_RULDONE = "N"; + + public static final String OPTIONS_P_SEND_RESPONSE_CODE_AUT = "P"; + + public PosteReq() {} + + public PosteReq(ApplParmFull apFull) { + setAp(apFull); + } + + public String getNUMORD() { + return (this.NUMORD == null) ? "" : this.NUMORD.trim(); + } + + public void setNUMORD(String myamount) { + this.NUMORD = myamount; + } + + public String getIMPORTO() { + return (this.IMPORTO == null) ? "" : this.IMPORTO; + } + + public void setIMPORTO(String mybuyeremail) { + this.IMPORTO = mybuyeremail; + } + + public String getEMAILESERC() { + return (this.EMAILESERC == null) ? "" : this.EMAILESERC; + } + + public void setEMAILESERC(String mybuyername) { + this.EMAILESERC = mybuyername; + } + + public String getVALUTA() { + return (this.VALUTA == null) ? "" : this.VALUTA; + } + + public void setVALUTA(String mycurrency) { + this.VALUTA = mycurrency; + } + + public String getAlias() { + return getParm("POSTE19_MAC_KEY_ESITO").getTesto(); + } + + public String getMac() { + return getMacPagamento(); + } + + public String getMacPagamento() { + StringBuffer theUrl = new StringBuffer(); + theUrl.append("&URLMS="); + theUrl.append(getURLMS()); + theUrl.append("&URLDONE="); + theUrl.append(getURLDONE()); + theUrl.append("&NUMORD="); + theUrl.append(getNUMORD()); + theUrl.append("&IDNEGOZIO="); + theUrl.append(getIDNEGOZIO()); + theUrl.append("&IMPORTO="); + theUrl.append(getIMPORTO()); + theUrl.append("&VALUTA="); + theUrl.append(getVALUTA()); + theUrl.append("&TCONTAB="); + theUrl.append(getTCONTAB()); + theUrl.append("&TAUTOR=I"); + if (!getOPTIONS().isEmpty()) { + theUrl.append("&OPTIONS="); + theUrl.append(getOPTIONS()); + } + theUrl.append("&USERID="); + theUrl.append(getUSERID()); + String res = ""; + res = EcDc.encodeHMAC_256(getMAC_KEY_START(), theUrl.toString()); + System.out.println("stringa mac: " + res); + return res; + } + + public String getLINGUA() { + return (this.LINGUA == null) ? "" : this.LINGUA; + } + + public void setLINGUA(String lang) { + this.LINGUA = lang; + } + + public String getRequestUrl() { + return getRequestUrl(false); + } + + public String getImportoUrl() { + if (this.IMPORTO == null) + return "0000"; + String temp = this.IMPORTO; + if (temp.indexOf('.') < 0) { + temp = temp + "00"; + } else if (temp.length() - temp.indexOf('.') < 3) { + temp = temp + "0"; + } + return temp.replace(".", ""); + } + + public String getTestRequestUrl() { + return getRequestUrl(true); + } + + public static void initApplicationParms(ApplParmFull ap) { + if (ap != null) { + DBAdapter.logDebug(true, "postepay 2019 chechout initParms: start"); + String l_tipoParm = "POSTEPAY 2019"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + Parm bean = new Parm(ap); + bean.findByCodice("POSTE19_URL_BACK"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("POSTE19_URL_BACK"); + bean.setDescrizione("POSTE19_URL_BACK"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("http://localhost/tf15/RicevutaPoste.abl"); + bean.setNota("La URL verso la quale mandare l’utente in caso di annullamento del processo di pagamento e ritorno alla modifica del carrello"); + bean.save(); + bean.findByCodice("POSTE19_URL_DONE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("POSTE19_URL_DONE"); + bean.setDescrizione("POSTE19_URL_DONE"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("http://localhost/tf15/RicevutaPoste.abl"); + bean.setNota("POSTE19_URL_MS"); + bean.save(); + bean.findByCodice("POSTE19_URL_MS"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("POSTE19_URL_MS"); + bean.setDescrizione("POSTE19_URL_MS"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("http://localhost/tf15/RicevutaPoste.abl"); + bean.setNota("La URL che il sistema deve utilizzare per notificare direttamente al negozio l’esito della transazione compiuta "); + bean.save(); + bean.findByCodice("POSTE19_MAC_KEY_START"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("POSTE19_MAC_KEY_START"); + bean.setDescrizione("POSTE19_MAC_KEY_START"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("CHENESOADESSO"); + bean.setNota("E' la chiave per il calcolo del MAC nei messaggi di avvio pagamento"); + bean.save(); + bean.findByCodice("POSTE19_MAC_KEY_ESITO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("POSTE19_MAC_KEY_ESITO"); + bean.setDescrizione("POSTE19_MAC_KEY_ESITO"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")); + if (bean.getNota().isEmpty()) + bean.setNota("E' la chiave per la verifica del MAC nei messaggi di esito emessi da Poste e per l’usodelle API."); + bean.save(); + bean.findByCodice("POSTE19_EMAILESERC"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("POSTE19_EMAILESERC"); + bean.setDescrizione("POSTE19_EMAILESERC"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")); + if (bean.getNota().isEmpty()) + bean.setNota("MAIL ESERCENTE AL QUALE INVIARE L'ESITO DELLA TRANSAZIONE. SE VUOTA VIENE UTILIZZATA QUELLA DELL'ANAGRAFICA DEL NEGOZIO"); + bean.save(); + bean.findByCodice("POSTE19_IDNEGOZIO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("POSTE19_IDNEGOZIO"); + bean.setDescrizione("POSTE19_IDNEGOZIO"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")); + if (bean.getNota().isEmpty()) + bean.setNota("Identificativo del negozio del merchant assegnato da Poste, Merchant ID (MID)."); + bean.save(); + bean.findByCodice("POSTE19_TCONTAB"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("POSTE19_TCONTAB"); + bean.setDescrizione("POSTE19_TCONTAB"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("I"); + if (bean.getNota().isEmpty()) + bean.setNota("Tipo di contabilizzazione da utilizzare in questo ordine. Obbligatorio.
D --> Differita
I --> Immediata"); + bean.save(); + bean.findByCodice("POSTE19_OPTIONS"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("POSTE19_OPTIONS"); + bean.setDescrizione("POSTE19_OPTIONS"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")); + if (bean.getNota().isEmpty()) + bean.setNota("Opzioni aggiuntive per il pagamento in corso.
G – In caso di autorizzazione concessa il sistema invece di mostrare l’esito della transazione al consumatore effettua la redirezione immediata presso URLDONE in modo che il negozio virtuale possa mostrare un proprio “scontrino” personalizzato. In caso di autorizzazione negata all’utente viene riproposta la schermata di inserimento carta.
L – Nel caso di ordine duplicato il sistema invia una URLMS con codice di esito 07.
N – In caso di autorizzazione negata il sistema, invece di mostrare l’esito della transazione alconsumatore, effettua la redirezione immediata verso URLDONE.
P – Viene restituito, in URLMS E URDONE, il campo RESPONSE_CODE_AUT che rappresenta il codice di risposta ritornato dal backend autorizzativo.
"); + bean.save(); + DBAdapter.logDebug(true, "postepay 2019 chechout initParms: stop"); + } + } + + private String getIDNEGOZIO() { + return getParm("POSTE19_IDNEGOZIO").getTesto(); + } + + public String getURLBACK() { + return getParm("POSTE19_URL_BACK").getTesto(); + } + + public String getURLDONE() { + return getParm("POSTE19_URL_DONE").getTesto(); + } + + public String getURLMS() { + return getParm("POSTE19_URL_MS").getTesto(); + } + + public String getTCONTAB() { + return getParm("POSTE19_TCONTAB").getTesto(); + } + + public String getTAUTOR() { + return "I"; + } + + public String getOPTIONS() { + return getParm("POSTE19_OPTIONS").getTesto(); + } + + public String getEMAIL() { + return this.EMAIL; + } + + public void setEMAIL(String eMAIL) { + this.EMAIL = eMAIL; + } + + public String getUSERID() { + return this.USERID; + } + + public void setUSERID(String uSERID) { + this.USERID = uSERID; + } + + private String getMAC_KEY_START() { + return getParm("POSTE19_MAC_KEY_START").getTesto(); + } + + private String getRequestUrl(boolean test) { + StringBuilder theUrl = new StringBuilder(); + if (test) { + theUrl.append("https://acquistionlinetest.poste.it/poste/pagamenti/main?PAGE=MASTER"); + } else { + theUrl.append("https://acquistionline.poste.it/poste/pagamenti/main?PAGE=MASTER"); + } + theUrl.append("&IMPORTO="); + theUrl.append(getIMPORTO()); + theUrl.append("&VALUTA="); + theUrl.append(getVALUTA()); + theUrl.append("&NUMORD="); + theUrl.append(getNUMORD()); + theUrl.append("&IDNEGOZIO="); + theUrl.append(getIDNEGOZIO()); + theUrl.append("&URLBACK="); + theUrl.append(getURLBACK()); + theUrl.append("&URLDONE="); + theUrl.append(getURLDONE()); + theUrl.append("&URLMS="); + theUrl.append(getURLMS()); + theUrl.append("&TCONTAB="); + theUrl.append(getTCONTAB()); + theUrl.append("&TAUTOR=I"); + theUrl.append("&MAC="); + theUrl.append(getMacPagamento()); + theUrl.append("&LINGUA="); + theUrl.append(getLINGUA()); + if (!getEMAILESERC().isEmpty()) { + theUrl.append("&EMAILESERC="); + theUrl.append(getEMAILESERC()); + } + if (!getOPTIONS().isEmpty()) { + theUrl.append("&OPTIONS="); + theUrl.append(getOPTIONS()); + } + theUrl.append("&EMAIL="); + theUrl.append(getEMAIL()); + theUrl.append("&USERID="); + theUrl.append(getUSERID()); + return theUrl.toString(); + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/poste2019/PosteRes.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/poste2019/PosteRes.java new file mode 100644 index 00000000..8cb1ebb8 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/poste2019/PosteRes.java @@ -0,0 +1,258 @@ +package it.acxent.bank.poste2019; + +import it.acxent.bank._BankAdapter; +import it.acxent.db.ApplParmFull; +import it.acxent.reg.EcDc; + +public class PosteRes extends _BankAdapter { + public static final String ESITO_OK = "00"; + + public static final String ESITO_KO_01 = "01"; + + public static final String ESITO_KO_02 = "02"; + + public static final String ESITO_KO_03 = "03"; + + public static final String ESITO_KO_04 = "04"; + + public static final String ESITO_KO_05 = "05"; + + public static final String ESITO_KO_06 = "06"; + + public static final String ESITO_KO_07 = "07"; + + public static final String ESITO_KO_60 = "60"; + + public static final String ESITO_KO_66 = "66"; + + private String IMPORTO; + + private String NUMORD; + + private String VALUTA; + + private String ESITO; + + private String AUT; + + private String IDTRANS; + + private String IDNEGOZIO; + + private String MAC; + + private String TCONTAB; + + private String TAUTOR; + + private String BPW_TIPO_TRANSAZIONE; + + private String RESPONSE_CODE_AUT; + + private String ALIASSTR; + + private String EMAILTIT; + + private String CFTIT; + + public PosteRes() {} + + public static final String getEsito(String l_esito) { + if (l_esito.equals("01")) + return "Negata dal sistema"; + if (l_esito.equals("02")) + return "Negata per problemi sull'anagrafica negozio"; + if (l_esito.equals("03")) + return "Negata per problemi di comunicazione con i circuiti autorizzativi"; + if (l_esito.equals("04")) + return "Negata dall'emittente della carta"; + if (l_esito.equals("05")) + return "Negata per numero carta errato"; + if (l_esito.equals("06")) + return "Errore imprevisto durante l’elaborazione della richiesta"; + if (l_esito.equals("07")) + return "Ordine duplicato"; + if (l_esito.equals("60")) + return "Negata dai controlli antifrode di Poste"; + if (l_esito.equals("66")) + return "Negata per mancata autenticazione dell’utente nelle procedure di verifica (ACS)."; + if (l_esito.equals("00")) + return "Successo"; + return "??"; + } + + public PosteRes(ApplParmFull apFull) { + setAp(apFull); + } + + public boolean isMacRitornoOk() { + String macCalcolato = getMacEsito(); + if (getMAC().equals(macCalcolato)) + return true; + return false; + } + + public String getKey() { + return getParm("XPAY_MAC_KEY").getTesto(); + } + + public String getIMPORTO() { + return this.IMPORTO; + } + + public void setIMPORTO(String iMPORTO) { + this.IMPORTO = iMPORTO; + } + + public String getNUMORD() { + return this.NUMORD; + } + + public void setNUMORD(String nUMORD) { + this.NUMORD = nUMORD; + } + + public String getVALUTA() { + return this.VALUTA; + } + + public void setVALUTA(String vALUTA) { + this.VALUTA = vALUTA; + } + + public String getESITO() { + return this.ESITO; + } + + public void setESITO(String eSITO) { + this.ESITO = eSITO; + } + + public String getAUT() { + return this.AUT; + } + + public void setAUT(String aUT) { + this.AUT = aUT; + } + + public String getIDTRANS() { + return this.IDTRANS; + } + + public void setIDTRANS(String iDTRANS) { + this.IDTRANS = iDTRANS; + } + + public String getIDNEGOZIO() { + return this.IDNEGOZIO; + } + + public void setIDNEGOZIO(String iDNEGOZIO) { + this.IDNEGOZIO = iDNEGOZIO; + } + + public String getMAC() { + return this.MAC; + } + + public void setMAC(String mAC) { + this.MAC = mAC; + } + + private String getMAC_KEY_ESITO() { + return getParm("POSTE19_MAC_KEY_ESITO").getTesto(); + } + + public String getMacEsito() { + StringBuffer theUrl = new StringBuffer(); + theUrl.append("&NUMORD="); + theUrl.append(getNUMORD()); + theUrl.append("&IDNEGOZIO="); + theUrl.append(getIDNEGOZIO()); + theUrl.append("&AUT="); + theUrl.append(getAUT()); + theUrl.append("&IMPORTO="); + theUrl.append(getIMPORTO()); + theUrl.append("&VALUTA="); + theUrl.append(getVALUTA()); + theUrl.append("&IDTRANS="); + theUrl.append(getIDTRANS()); + theUrl.append("&TCONTAB="); + theUrl.append(getTCONTAB()); + theUrl.append("&TAUTOR="); + theUrl.append(getTAUTOR()); + theUrl.append("&ESITO="); + theUrl.append(getESITO()); + theUrl.append("&BPW_TIPO_TRANSAZIONE="); + theUrl.append(getBPW_TIPO_TRANSAZIONE()); + if (getOPTIONS().equals("P")) { + theUrl.append("&RESPONSE_CODE_AUT="); + theUrl.append(getRESPONSE_CODE_AUT()); + } + String res = ""; + res = EcDc.encodeHMAC_256(getMAC_KEY_ESITO(), theUrl.toString()); + System.out.println("stringa mac esito: " + res); + return res; + } + + public String getTCONTAB() { + return this.TCONTAB; + } + + public void setTCONTAB(String tCONTAB) { + this.TCONTAB = tCONTAB; + } + + public String getTAUTOR() { + return this.TAUTOR; + } + + public void setTAUTOR(String tAUTOR) { + this.TAUTOR = tAUTOR; + } + + public String getBPW_TIPO_TRANSAZIONE() { + return this.BPW_TIPO_TRANSAZIONE; + } + + public void setBPW_TIPO_TRANSAZIONE(String bPW_TIPO_TRANSAZIONE) { + this.BPW_TIPO_TRANSAZIONE = bPW_TIPO_TRANSAZIONE; + } + + public String getRESPONSE_CODE_AUT() { + return this.RESPONSE_CODE_AUT; + } + + public void setRESPONSE_CODE_AUT(String rESPONSE_CODE_AUT) { + this.RESPONSE_CODE_AUT = rESPONSE_CODE_AUT; + } + + public String getALIASSTR() { + return this.ALIASSTR; + } + + public void setALIASSTR(String aLIASSTR) { + this.ALIASSTR = aLIASSTR; + } + + public String getEMAILTIT() { + return this.EMAILTIT; + } + + public void setEMAILTIT(String eMAILTIT) { + this.EMAILTIT = eMAILTIT; + } + + public String getCFTIT() { + return this.CFTIT; + } + + public void setCFTIT(String cFTIT) { + this.CFTIT = cFTIT; + } + + public String getOPTIONS() { + return getParm("POSTE19_OPTIONS").getTesto(); + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sella/GestPayCrypt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sella/GestPayCrypt.java new file mode 100644 index 00000000..7d7a2e5d --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sella/GestPayCrypt.java @@ -0,0 +1,721 @@ +package it.acxent.bank.sella; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.net.UnknownServiceException; + +public class GestPayCrypt { + private String ShopLogin = ""; + + private String Currency = ""; + + private String Amount = ""; + + private String ShopTransactionID = ""; + + private String BuyerName = ""; + + private String BuyerEmail = ""; + + private String Language = ""; + + private String CustomInfo = ""; + + private String AuthorizationCode = ""; + + private String ErrorCode = ""; + + private String ErrorDescription = ""; + + private String BankTransactionID = ""; + + private String AlertCode = ""; + + private String AlertDescription = ""; + + private String EncryptedString = ""; + + private String ToBeEncript = ""; + + private String Decripted = ""; + + private String TransactionResult = ""; + + private String ProtocolAuthServer = ""; + + private String DomainName = ""; + + private String separator = ""; + + private String errDescription = ""; + + private String errNumber = ""; + + private String Version = ""; + + private String Min = ""; + + private String CVV = ""; + + private String country = ""; + + private String vbvrisp = ""; + + private String vbv = ""; + + private String trans; + + public GestPayCrypt() { + this.ShopLogin = ""; + this.Currency = ""; + this.Amount = ""; + this.ShopTransactionID = ""; + this.BuyerName = ""; + this.BuyerEmail = ""; + this.Language = ""; + this.CustomInfo = ""; + this.AuthorizationCode = ""; + this.ErrorCode = ""; + this.ErrorDescription = ""; + this.BankTransactionID = ""; + this.AlertCode = ""; + this.AlertDescription = ""; + this.EncryptedString = ""; + this.ToBeEncript = ""; + this.Decripted = ""; + this.ProtocolAuthServer = "http://"; + this.DomainName = ""; + this.separator = "*P1*"; + this.errDescription = ""; + this.errNumber = "0"; + this.Version = "3.0"; + this.Min = ""; + this.CVV = ""; + this.country = ""; + this.vbvrisp = ""; + this.vbv = ""; + this.trans = ""; + } + + public void setShopLogin(String xstr) { + this.ShopLogin = xstr; + } + + public void setCurrency(String xstr) { + this.Currency = xstr; + } + + public void setAmount(String xstr) { + this.Amount = xstr; + } + + public void setShopTransactionID(String xstr) { + this.ShopTransactionID = URLEncoder.encode(xstr.trim()); + } + + public void setMIN(String xstr) { + this.Min = xstr; + } + + public void setCVV(String xstr) { + this.CVV = xstr; + } + + public void setBuyerName(String xstr) { + this.BuyerName = URLEncoder.encode(xstr.trim()); + } + + public void setBuyerEmail(String xstr) { + this.BuyerEmail = xstr.trim(); + } + + public void setLanguage(String xstr) { + this.Language = xstr.trim(); + } + + public void setCustomInfo(String xstr) { + this.CustomInfo = URLEncoder.encode(xstr.trim()); + } + + public void setEncryptedString(String xstr) { + this.EncryptedString = xstr; + } + + public void setProtocolServer(String xstr) { + this.ProtocolAuthServer = xstr; + } + + public void setDomainName(String xstr) { + this.DomainName = xstr; + } + + public String getShopLogin() { + return this.ShopLogin; + } + + public String getCurrency() { + return this.Currency; + } + + public String getAmount() { + return this.Amount; + } + + public String getCountry() { + return this.country; + } + + public String getVBV() { + return this.vbv; + } + + public String getVBVrisp() { + return this.vbvrisp; + } + + public String getShopTransactionID() { + String app = ""; + try { + app = URLDecode(this.ShopTransactionID); + } catch (Exception e) {} + return app; + } + + public String getBuyerName() { + String appBuyername = ""; + try { + appBuyername = URLDecode(this.BuyerName); + } catch (Exception ex) { + appBuyername = "errore"; + } + return appBuyername; + } + + public String getBuyerEmail() { + return this.BuyerEmail; + } + + public String getCustomInfo() { + String appCustom = ""; + try { + appCustom = URLDecode(this.CustomInfo); + } catch (Exception e) {} + return appCustom; + } + + public String getAuthorizationCode() { + return this.AuthorizationCode; + } + + public String getErrorCode() { + return this.ErrorCode; + } + + public String getErrorDescription() { + return this.ErrorDescription; + } + + public String getBankTransactionID() { + return this.BankTransactionID; + } + + public String getTransactionResult() { + return this.TransactionResult; + } + + public String getAlertCode() { + return this.AlertCode; + } + + public String getAlertDescription() { + return this.AlertDescription; + } + + public String getEncryptedString() { + return this.EncryptedString; + } + + public String getProtocolServer() { + return this.ProtocolAuthServer; + } + + public String getDomainName() { + return this.DomainName; + } + + public boolean Encrypt() { + String sErr = ""; + this.ErrorCode = "0"; + this.ErrorDescription = ""; + try { + if (this.ShopLogin.length() <= 0) { + this.ErrorCode = "546"; + this.ErrorDescription = "IDshop not valid"; + return false; + } + if (controlValues(this.ProtocolAuthServer)) + this.ProtocolAuthServer = "http://"; + this.trans = this.ShopLogin.substring(0, 6); + this.trans = this.trans.toLowerCase(); + if (controlValues(this.DomainName)) + if (this.trans.equals("gespay")) { + this.DomainName = "testecomm.sella.it/CryptHTTP"; + } else { + this.DomainName = "ecomms2s.sella.it/CryptHTTP"; + } + if (this.Currency.length() <= 0) { + this.ErrorCode = "552"; + this.ErrorDescription = "Currency not valid"; + return false; + } + if (this.Amount.length() <= 0) { + this.ErrorCode = "553"; + this.ErrorDescription = "Amount not valid"; + return false; + } + if (this.ShopTransactionID.length() <= 0) { + this.ErrorCode = "551"; + this.ErrorDescription = "Shop Transaction ID not valid"; + return false; + } + this.ToBeEncript = ""; + if (this.CVV.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CVV=" + this.separator; + if (this.Min.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_MIN=" + this.separator; + if (this.Currency.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_UICCODE=" + this.separator; + if (this.Amount.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_AMOUNT=" + this.separator; + if (this.ShopTransactionID.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_SHOPTRANSACTIONID=" + this.separator; + if (this.BuyerName.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CHNAME=" + this.separator; + if (this.BuyerEmail.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CHEMAIL=" + this.separator; + if (this.Language.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_IDLANGUAGE=" + this.separator; + if (this.CustomInfo.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + this.separator; + String urlString = this.ProtocolAuthServer + this.ProtocolAuthServer + "/Encrypt.asp?a=" + this.DomainName + "&b=" + this.ShopLogin + "&c=" + + this.ToBeEncript.substring(4, this.ToBeEncript.length()); + URL url = new URL(urlString); + URLConnection connection = url.openConnection(); + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + int nStart = 0; + int nEnd = 0; + String line = ""; + while (line != null) { + line = in.readLine(); + if (line != null) { + nStart = line.indexOf("#cryptstring#"); + nEnd = line.lastIndexOf("#/cryptstring#"); + if (((nStart != -1) ? true : false) & ((nEnd > nStart + 14) ? true : false)) + this.EncryptedString = line.substring(nStart + 13, nEnd); + nStart = line.indexOf("#error#"); + nEnd = line.lastIndexOf("#/error#"); + if (((nStart != -1) ? true : false) & ((nEnd > nStart + 8) ? true : false)) { + sErr = line.substring(nStart + 7, nEnd); + int intsep = sErr.indexOf("-"); + this.ErrorCode = sErr.substring(0, intsep); + this.ErrorDescription = sErr.substring(intsep + 1, sErr.length()); + return false; + } + } + } + in.close(); + return true; + } catch (MalformedURLException ex) { + this.ErrorCode = "9999"; + this.ErrorDescription = "Bad URL"; + return false; + } catch (UnknownServiceException ex) { + this.ErrorCode = "9999"; + this.ErrorDescription = "ServiceException occurred."; + return false; + } catch (IOException ex) { + this.ErrorCode = "9999"; + this.ErrorDescription = "Bad URL Request"; + return false; + } + } + + public boolean Decrypt() { + this.ErrorCode = "0"; + this.ErrorDescription = ""; + String strdaelim = ""; + if (this.ShopLogin.length() <= 0) { + this.ErrorCode = "546"; + this.ErrorDescription = "IDshop not valid"; + return false; + } + if (controlValues(this.ProtocolAuthServer)) + this.ProtocolAuthServer = "http://"; + this.trans = this.ShopLogin.substring(0, 6); + this.trans = this.trans.toLowerCase(); + if (controlValues(this.DomainName)) + if (this.trans.equals("gespay")) { + this.DomainName = "testecomm.sella.it/CryptHTTP"; + } else { + this.DomainName = "ecomms2s.sella.it/CryptHTTP"; + } + if (this.EncryptedString.length() <= 0) { + this.ErrorCode = "1009"; + this.ErrorDescription = "String to Decrypt not valid"; + return false; + } + try { + String urlString = this.ProtocolAuthServer + this.ProtocolAuthServer + "/Decrypt.asp?a=" + this.DomainName + "&b=" + this.ShopLogin + "&c=" + this.EncryptedString; + URL url = new URL(urlString); + URLConnection connection = url.openConnection(); + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + int nStart = 0; + int nEnd = 0; + String line = ""; + while (line != null) { + line = in.readLine(); + if (line != null) { + nStart = line.indexOf("#decryptstring#"); + nEnd = line.lastIndexOf("#/decryptstring#"); + if (((nStart != -1) ? true : false) & ((nEnd > nStart + 16) ? true : false)) + this.Decripted = line.substring(nStart + 15, nEnd); + nStart = line.indexOf("#error#"); + nEnd = line.lastIndexOf("#/error#"); + if (((nStart != -1) ? true : false) & ((nEnd > nStart + 8) ? true : false)) { + String sErr = line.substring(nStart + 7, nEnd); + int intsep = sErr.indexOf("-"); + this.ErrorCode = sErr.substring(0, intsep); + this.ErrorDescription = sErr.substring(intsep + 1, sErr.length()); + return false; + } + } + } + in.close(); + if (this.Decripted.trim() == "") { + this.ErrorCode = "9999"; + this.ErrorDescription = "Void String"; + return false; + } + if (!Parsing(this.Decripted)) + return false; + return true; + } catch (MalformedURLException ex) { + this.ErrorCode = "9999"; + this.ErrorDescription = "Bad URL"; + return false; + } catch (UnknownServiceException ex) { + this.ErrorCode = "9999"; + this.ErrorDescription = "Service Exception occurred."; + return false; + } catch (IOException ex) { + this.ErrorCode = "9999"; + this.ErrorDescription = "Bad URL Request"; + return false; + } + } + + private boolean Parsing(String StringToBeParsed) { + int nStart = 0; + int nEnd = 0; + this.ErrorCode = ""; + this.ErrorDescription = ""; + try { + nStart = StringToBeParsed.indexOf("PAY1_UICCODE"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.Currency = StringToBeParsed.substring(nStart + 13, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.Currency = StringToBeParsed.substring(nStart + 13, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_AMOUNT"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.Amount = StringToBeParsed.substring(nStart + 12, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.Amount = StringToBeParsed.substring(nStart + 12, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_SHOPTRANSACTIONID"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.ShopTransactionID = StringToBeParsed.substring(nStart + 23, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.ShopTransactionID = StringToBeParsed.substring(nStart + 23, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_CHNAME"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.BuyerName = StringToBeParsed.substring(nStart + 12, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.BuyerName = StringToBeParsed.substring(nStart + 12, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_CHEMAIL"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.BuyerEmail = StringToBeParsed.substring(nStart + 13, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.BuyerEmail = StringToBeParsed.substring(nStart + 13, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_AUTHORIZATIONCODE"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.AuthorizationCode = StringToBeParsed.substring(nStart + 23, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.AuthorizationCode = StringToBeParsed.substring(nStart + 23, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_ERRORCODE"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.ErrorCode = StringToBeParsed.substring(nStart + 15, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.ErrorCode = StringToBeParsed.substring(nStart + 15, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_ERRORDESCRIPTION"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.ErrorDescription = StringToBeParsed.substring(nStart + 22, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.ErrorDescription = StringToBeParsed.substring(nStart + 22, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_BANKTRANSACTIONID"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.BankTransactionID = StringToBeParsed.substring(nStart + 23, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.BankTransactionID = StringToBeParsed.substring(nStart + 23, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_ALERTCODE"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.AlertCode = StringToBeParsed.substring(nStart + 15, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.AlertCode = StringToBeParsed.substring(nStart + 15, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_ALERTDESCRIPTION"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.AlertDescription = StringToBeParsed.substring(nStart + 22, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.AlertDescription = StringToBeParsed.substring(nStart + 22, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_COUNTRY"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.country = StringToBeParsed.substring(nStart + 13, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.country = StringToBeParsed.substring(nStart + 13, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_VBVRISP"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.vbvrisp = StringToBeParsed.substring(nStart + 13, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.vbvrisp = StringToBeParsed.substring(nStart + 13, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_VBV"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.vbv = StringToBeParsed.substring(nStart + 9, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.vbv = StringToBeParsed.substring(nStart + 9, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_IDLANGUAGE"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.Language = StringToBeParsed.substring(nStart + 16, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.Language = StringToBeParsed.substring(nStart + 16, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_TRANSACTIONRESULT"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.TransactionResult = StringToBeParsed.substring(nStart + 23, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.TransactionResult = StringToBeParsed.substring(nStart + 23, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + this.CustomInfo = StringToBeParsed.trim(); + } catch (Exception e) { + this.ErrorCode = "9999"; + this.ErrorDescription = "Error parsing String"; + return false; + } + return true; + } + + public String URLDecode(String str) throws Exception { + if (str == null) + return null; + char[] res = new char[str.length()]; + int didx = 0; + for (int sidx = 0; sidx < str.length(); sidx++) { + char ch = str.charAt(sidx); + if (ch == '+') { + res[didx++] = ' '; + } else if (ch == '%') { + try { + res[didx++] = + (char)Integer.parseInt(str.substring(sidx + 1, sidx + 3), 16); + sidx += 2; + } catch (NumberFormatException e) { + didx--; + res[didx++] = ch; + } + } else { + res[didx++] = ch; + } + } + return String.valueOf(res, 0, didx); + } + + protected boolean controlValues(String str) { + return (str == null || str.length() == 0); + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sella/GestPayCrypt20.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sella/GestPayCrypt20.java new file mode 100644 index 00000000..e43752bc --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sella/GestPayCrypt20.java @@ -0,0 +1,676 @@ +package it.acxent.bank.sella; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.net.MalformedURLException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.net.UnknownServiceException; + +public class GestPayCrypt20 { + private String ShopLogin; + + private String Currency; + + private String Amount; + + private String ShopTransactionID; + + private String BuyerName; + + private String BuyerEmail; + + private String Language; + + private String CustomInfo; + + private String AuthorizationCode; + + private String ErrorCode; + + private String ErrorDescription; + + private String BankTransactionID; + + private String AlertCode; + + private String AlertDescription; + + private String EncryptedString; + + private String ToBeEncript; + + private String Decripted; + + private String TransactionResult; + + private String ProtocolAuthServer = ""; + + private String DomainName = ""; + + private String separator; + + private String errDescription; + + private String errNumber; + + private String Version = "2.0"; + + private String Min = ""; + + private String CVV = ""; + + private String country = ""; + + private String vbvrisp = ""; + + private String vbv = ""; + + public GestPayCrypt20() { + this.ShopLogin = ""; + this.Currency = ""; + this.Amount = ""; + this.ShopTransactionID = ""; + this.BuyerName = ""; + this.BuyerEmail = ""; + this.Language = ""; + this.CustomInfo = ""; + this.AuthorizationCode = ""; + this.ErrorCode = ""; + this.ErrorDescription = ""; + this.BankTransactionID = ""; + this.AlertCode = ""; + this.AlertDescription = ""; + this.EncryptedString = ""; + this.ToBeEncript = ""; + this.Decripted = ""; + this.ProtocolAuthServer = "http://"; + this.DomainName = "ecomm.sella.it/CryptHTTP"; + this.separator = "*P1*"; + this.errDescription = ""; + this.errNumber = "0"; + this.Min = ""; + this.CVV = ""; + this.country = ""; + this.vbvrisp = ""; + this.vbv = ""; + } + + public void SetShopLogin(String xstr) { + this.ShopLogin = xstr; + } + + public void SetCurrency(String xstr) { + this.Currency = xstr; + } + + public void SetAmount(String xstr) { + this.Amount = xstr; + } + + public void SetShopTransactionID(String xstr) { + this.ShopTransactionID = URLEncoder.encode(xstr.trim()); + } + + public void SetMIN(String xstr) { + this.Min = xstr; + } + + public void SetCVV(String xstr) { + this.CVV = xstr; + } + + public void SetBuyerName(String xstr) { + this.BuyerName = URLEncoder.encode(xstr.trim()); + } + + public void SetBuyerEmail(String xstr) { + this.BuyerEmail = xstr.trim(); + } + + public void SetLanguage(String xstr) { + this.Language = xstr.trim(); + } + + public void SetCustomInfo(String xstr) { + this.CustomInfo = URLEncoder.encode(xstr.trim()); + } + + public void SetEncryptedString(String xstr) { + this.EncryptedString = xstr; + } + + public String GetShopLogin() { + return this.ShopLogin; + } + + public String GetCurrency() { + return this.Currency; + } + + public String GetAmount() { + return this.Amount; + } + + public String GetCountry() { + return this.country; + } + + public String GetVBV() { + return this.vbv; + } + + public String GetVBVrisp() { + return this.vbvrisp; + } + + public String GetShopTransactionID() { + String app = ""; + try { + app = URLDecode(this.ShopTransactionID); + } catch (Exception e) {} + return app; + } + + public String GetBuyerName() { + String appBuyername = ""; + try { + appBuyername = URLDecode(this.BuyerName); + } catch (Exception ex) { + appBuyername = "errore"; + } + return appBuyername; + } + + public String GetBuyerEmail() { + return this.BuyerEmail; + } + + public String GetCustomInfo() { + String appCustom = ""; + try { + appCustom = URLDecode(this.CustomInfo); + } catch (Exception e) {} + return appCustom; + } + + public String GetAuthorizationCode() { + return this.AuthorizationCode; + } + + public String GetErrorCode() { + return this.ErrorCode; + } + + public String GetErrorDescription() { + return this.ErrorDescription; + } + + public String GetBankTransactionID() { + return this.BankTransactionID; + } + + public String GetTransactionResult() { + return this.TransactionResult; + } + + public String GetAlertCode() { + return this.AlertCode; + } + + public String GetAlertDescription() { + return this.AlertDescription; + } + + public String GetEncryptedString() { + return this.EncryptedString; + } + + public boolean Encrypt() { + String sErr = ""; + this.ErrorCode = "0"; + this.ErrorDescription = ""; + try { + if (this.ShopLogin.length() <= 0) { + this.ErrorCode = "546"; + this.ErrorDescription = "IDshop not valid"; + return false; + } + if (this.Currency.length() <= 0) { + this.ErrorCode = "552"; + this.ErrorDescription = "Currency not valid"; + return false; + } + if (this.Amount.length() <= 0) { + this.ErrorCode = "553"; + this.ErrorDescription = "Amount not valid"; + return false; + } + if (this.ShopTransactionID.length() <= 0) { + this.ErrorCode = "551"; + this.ErrorDescription = "Shop Transaction ID not valid"; + return false; + } + this.ToBeEncript = ""; + if (this.CVV.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CVV=" + this.separator; + if (this.Min.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_MIN=" + this.separator; + if (this.Currency.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_UICCODE=" + this.separator; + if (this.Amount.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_AMOUNT=" + this.separator; + if (this.ShopTransactionID.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_SHOPTRANSACTIONID=" + this.separator; + if (this.BuyerName.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CHNAME=" + this.separator; + if (this.BuyerEmail.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_CHEMAIL=" + this.separator; + if (this.Language.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + "PAY1_IDLANGUAGE=" + this.separator; + if (this.CustomInfo.length() > 0) + this.ToBeEncript = this.ToBeEncript + this.ToBeEncript + this.separator; + String urlString = this.ProtocolAuthServer + this.ProtocolAuthServer + "/Encrypt.asp?a=" + this.DomainName + "&b=" + this.ShopLogin + "&c=" + this.ToBeEncript.substring(4, this.ToBeEncript.length()); + URL url = new URL(urlString); + URLConnection connection = url.openConnection(); + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + int nStart = 0; + int nEnd = 0; + String line = ""; + while (line != null) { + line = in.readLine(); + if (line != null) { + nStart = line.indexOf("#cryptstring#"); + nEnd = line.lastIndexOf("#/cryptstring#"); + if (((nStart != -1) ? true : false) & ((nEnd > nStart + 14) ? true : false)) + this.EncryptedString = line.substring(nStart + 13, nEnd); + nStart = line.indexOf("#error#"); + nEnd = line.lastIndexOf("#/error#"); + if (((nStart != -1) ? true : false) & ((nEnd > nStart + 8) ? true : false)) { + sErr = line.substring(nStart + 7, nEnd); + int intsep = sErr.indexOf("-"); + this.ErrorCode = sErr.substring(0, intsep); + this.ErrorDescription = sErr.substring(intsep + 1, sErr.length()); + return false; + } + } + } + in.close(); + return true; + } catch (MalformedURLException ex) { + this.ErrorCode = "9999"; + this.ErrorDescription = "Bad URL"; + return false; + } catch (UnknownServiceException ex) { + this.ErrorCode = "9999"; + this.ErrorDescription = "ServiceException occurred."; + return false; + } catch (IOException ex) { + this.ErrorCode = "9999"; + this.ErrorDescription = "Bad URL Request"; + return false; + } + } + + public boolean Decrypt() { + this.ErrorCode = "0"; + this.ErrorDescription = ""; + String strdaelim = ""; + if (this.ShopLogin.length() <= 0) { + this.ErrorCode = "546"; + this.ErrorDescription = "IDshop not valid"; + return false; + } + if (this.EncryptedString.length() <= 0) { + this.ErrorCode = "1009"; + this.ErrorDescription = "String to Decrypt not valid"; + return false; + } + try { + String urlString = this.ProtocolAuthServer + this.ProtocolAuthServer + "/Decrypt.asp?a=" + this.DomainName + "&b=" + this.ShopLogin + "&c=" + this.EncryptedString; + URL url = new URL(urlString); + URLConnection connection = url.openConnection(); + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + int nStart = 0; + int nEnd = 0; + String line = ""; + while (line != null) { + line = in.readLine(); + if (line != null) { + nStart = line.indexOf("#decryptstring#"); + nEnd = line.lastIndexOf("#/decryptstring#"); + if (((nStart != -1) ? true : false) & ((nEnd > nStart + 16) ? true : false)) + this.Decripted = line.substring(nStart + 15, nEnd); + nStart = line.indexOf("#error#"); + nEnd = line.lastIndexOf("#/error#"); + if (((nStart != -1) ? true : false) & ((nEnd > nStart + 8) ? true : false)) { + String sErr = line.substring(nStart + 7, nEnd); + int intsep = sErr.indexOf("-"); + this.ErrorCode = sErr.substring(0, intsep); + this.ErrorDescription = sErr.substring(intsep + 1, sErr.length()); + return false; + } + } + } + in.close(); + if (this.Decripted.trim() == "") { + this.ErrorCode = "9999"; + this.ErrorDescription = "Void String"; + return false; + } + if (!Parsing(this.Decripted)) + return false; + return true; + } catch (MalformedURLException ex) { + this.ErrorCode = "9999"; + this.ErrorDescription = "Bad URL"; + return false; + } catch (UnknownServiceException ex) { + this.ErrorCode = "9999"; + this.ErrorDescription = "Service Exception occurred."; + return false; + } catch (IOException ex) { + this.ErrorCode = "9999"; + this.ErrorDescription = "Bad URL Request"; + return false; + } + } + + private boolean Parsing(String StringToBeParsed) { + int nStart = 0; + int nEnd = 0; + this.ErrorCode = ""; + this.ErrorDescription = ""; + try { + nStart = StringToBeParsed.indexOf("PAY1_UICCODE"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.Currency = StringToBeParsed.substring(nStart + 13, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.Currency = StringToBeParsed.substring(nStart + 13, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_AMOUNT"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.Amount = StringToBeParsed.substring(nStart + 12, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.Amount = StringToBeParsed.substring(nStart + 12, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_SHOPTRANSACTIONID"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.ShopTransactionID = StringToBeParsed.substring(nStart + 23, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.ShopTransactionID = StringToBeParsed.substring(nStart + 23, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_CHNAME"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.BuyerName = StringToBeParsed.substring(nStart + 12, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.BuyerName = StringToBeParsed.substring(nStart + 12, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_CHEMAIL"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.BuyerEmail = StringToBeParsed.substring(nStart + 13, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.BuyerEmail = StringToBeParsed.substring(nStart + 13, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_AUTHORIZATIONCODE"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.AuthorizationCode = StringToBeParsed.substring(nStart + 23, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.AuthorizationCode = StringToBeParsed.substring(nStart + 23, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_ERRORCODE"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.ErrorCode = StringToBeParsed.substring(nStart + 15, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.ErrorCode = StringToBeParsed.substring(nStart + 15, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_ERRORDESCRIPTION"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.ErrorDescription = StringToBeParsed.substring(nStart + 22, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.ErrorDescription = StringToBeParsed.substring(nStart + 22, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_BANKTRANSACTIONID"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.BankTransactionID = StringToBeParsed.substring(nStart + 23, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.BankTransactionID = StringToBeParsed.substring(nStart + 23, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_ALERTCODE"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.AlertCode = StringToBeParsed.substring(nStart + 15, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.AlertCode = StringToBeParsed.substring(nStart + 15, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_ALERTDESCRIPTION"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.AlertDescription = StringToBeParsed.substring(nStart + 22, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.AlertDescription = StringToBeParsed.substring(nStart + 22, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_COUNTRY"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.country = StringToBeParsed.substring(nStart + 13, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.country = StringToBeParsed.substring(nStart + 13, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_VBVRISP"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.vbvrisp = StringToBeParsed.substring(nStart + 13, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.vbvrisp = StringToBeParsed.substring(nStart + 13, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_VBV"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.vbv = StringToBeParsed.substring(nStart + 9, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.vbv = StringToBeParsed.substring(nStart + 9, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_IDLANGUAGE"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.Language = StringToBeParsed.substring(nStart + 16, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.Language = StringToBeParsed.substring(nStart + 16, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + nStart = StringToBeParsed.indexOf("PAY1_TRANSACTIONRESULT"); + if (nStart != -1) { + nEnd = StringToBeParsed.indexOf(this.separator, nStart); + if (nEnd == -1) { + nEnd = StringToBeParsed.length(); + this.TransactionResult = StringToBeParsed.substring(nStart + 23, nEnd); + if (nStart >= 4) { + StringToBeParsed = StringToBeParsed.substring(0, nStart - 4); + } else { + StringToBeParsed = StringToBeParsed.substring(0, nStart); + } + } else { + this.TransactionResult = StringToBeParsed.substring(nStart + 23, nEnd); + StringToBeParsed = StringToBeParsed.substring(0, nStart) + StringToBeParsed.substring(0, nStart); + } + } + this.CustomInfo = StringToBeParsed.trim(); + } catch (Exception e) { + this.ErrorCode = "9999"; + this.ErrorDescription = "Error parsing String"; + return false; + } + return true; + } + + public String URLDecode(String str) throws Exception { + if (str == null) + return null; + char[] res = new char[str.length()]; + int didx = 0; + for (int sidx = 0; sidx < str.length(); sidx++) { + char ch = str.charAt(sidx); + if (ch == '+') { + res[didx++] = ' '; + } else if (ch == '%') { + try { + res[didx++] = + (char)Integer.parseInt(str.substring(sidx + 1, sidx + 3), 16); + sidx += 2; + } catch (NumberFormatException e) { + didx--; + res[didx++] = ch; + } + } else { + res[didx++] = ch; + } + } + return String.valueOf(res, 0, didx); + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sella/SellaReq.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sella/SellaReq.java new file mode 100644 index 00000000..8de980fa --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sella/SellaReq.java @@ -0,0 +1,195 @@ +package it.acxent.bank.sella; + +import it.acxent.bank._BankAdapter; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; + +public class SellaReq extends _BankAdapter { + public static final String LANG_CODE_IT = "1"; + + public static final String LANG_CODE_EN = "2"; + + public static final String LANG_CODE_ES = "3"; + + public static final String LANG_CODE_FR = "4"; + + public static final String LANG_CODE_DE = "5"; + + public static final String DIV_CODE_LIRA = "18"; + + public static final String DIV_CODE_EURO = "242"; + + public static final String P_COD_ESER_SELLA = "COD_ESER_SELLA"; + + public static final String P_SELLA_FULL = "SELLA_FULL"; + + public static final String DIV_CODE_STERLINE = "2"; + + public static final String DIV_CODE_YEN = "71"; + + public static final String DIV_CODE_DOLLARL_HK = "103"; + + public static final String DIV_CODE_REAL = "234"; + + private String myshoplogin; + + private String mycurrency; + + private String myamount; + + private String myshoptransactionID; + + private String mybuyername; + + private String mybuyeremail; + + private String mylanguage; + + private String lang; + + private String mycustominfo; + + public static final String P_PAYMENT_OK_PAGE = "SELLA_OK"; + + public static final String P_PAYMENT_ERROR_PAGE = "SELLA_KO"; + + public static final String DIV_CODE_DOLLARI = "1"; + + public String getMyamount() { + return (this.myamount == null) ? "" : this.myamount; + } + + public void setMyamount(String myamount) { + this.myamount = myamount; + } + + public String getMybuyeremail() { + return (this.mybuyeremail == null) ? "" : this.mybuyeremail; + } + + public void setMybuyeremail(String mybuyeremail) { + this.mybuyeremail = mybuyeremail; + } + + public String getMybuyername() { + return (this.mybuyername == null) ? "" : this.mybuyername; + } + + public void setMybuyername(String mybuyername) { + this.mybuyername = mybuyername; + } + + public String getMycurrency() { + return (this.mycurrency == null) ? "" : this.mycurrency; + } + + public void setMycurrency(String mycurrency) { + this.mycurrency = mycurrency; + } + + public String getMycustominfo() { + return (this.mycustominfo == null) ? "" : this.mycustominfo; + } + + public void setMycustominfo(String mycustominfo) { + this.mycustominfo = mycustominfo; + } + + public String getMylanguage() { + if (this.mylanguage == null || this.mylanguage.isEmpty()) + this.mylanguage = getMylanguageCode(); + return this.mylanguage; + } + + private String getMylanguageCode() { + if (getLang().toLowerCase().equals("it")) + return "1"; + if (getLang().toLowerCase().equals("en")) + return "2"; + if (getLang().toLowerCase().equals("es")) + return "3"; + if (getLang().toLowerCase().equals("fr")) + return "4"; + if (getLang().toLowerCase().equals("de")) + return "5"; + return "2"; + } + + public String getMyshoplogin() { + return (this.myshoplogin == null) ? "" : this.myshoplogin; + } + + public void setMyshoplogin(String myshoplogin) { + this.myshoplogin = myshoplogin; + } + + public String getMyshoptransactionID() { + return (this.myshoptransactionID == null) ? "" : this.myshoptransactionID; + } + + public void setMyshoptransactionID(String myshoptransactionID) { + this.myshoptransactionID = myshoptransactionID; + } + + public void setMylanguage(String mylanguage) { + this.mylanguage = mylanguage; + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang; + } + + public void setLang(String lang) { + this.lang = lang; + } + + public static void initApplicationParms(ApplParmFull ap) { + boolean debug = false; + if (ap != null) { + DBAdapter.logDebug(debug, "SELLA chechout initParms: start"); + String l_tipoParm = "SELLA"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + Parm bean = new Parm(ap); + bean.findByCodice("COD_ESER_SELLA"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("COD_ESER_SELLA"); + bean.setDescrizione("COD_ESER_SELLA"); + bean.setFlgTipo(0L); + bean.setNota("CODICE ESERCENTE BANCA SELLA"); + bean.save(); + bean.findByCodice("SELLA_FULL"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SELLA_FULL"); + bean.setDescrizione("SELLA_FULL"); + bean.setFlgTipo(5L); + bean.setNota("SPECIFICA SE IL CONTRATTO CON SELLA E' DI TIPO FULL"); + bean.save(); + bean.findByCodice("SELLA_KO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SELLA_KO"); + bean.setDescrizione("SELLA_KO"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payRes.jsp"); + bean.setNota("SELLA_KO"); + bean.save(); + bean.findByCodice("SELLA_OK"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SELLA_OK"); + bean.setDescrizione("SELLA_OK"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payRes.jsp"); + bean.setNota("SELLA_OK"); + bean.save(); + DBAdapter.logDebug(debug, "SELLA chechout initParms: stop"); + StatusMsg.deleteMsgByTag(ap, "INIT"); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sella/SellaResp.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sella/SellaResp.java new file mode 100644 index 00000000..d3f0536b --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sella/SellaResp.java @@ -0,0 +1,185 @@ +package it.acxent.bank.sella; + +import it.acxent.bank._BankAdapter; + +public class SellaResp extends _BankAdapter { + private String myshoplogin; + + private int mycurrency; + + private float myamount; + + private String myshoptrxID; + + private String mybuyername; + + private String mybuyeremail; + + private String mytrxresult; + + private String myauthcode; + + private String myerrorcode; + + private String myerrordescription; + + private String myerrorbanktrxid; + + private long id_ordine; + + private String myalertcode; + + private String myalertdescription; + + private String mycustominfo; + + public SellaResp() {} + + public SellaResp(GestPayCrypt bean) { + fillResponse(bean); + } + + public String getMyalertcode() { + return (this.myalertcode == null) ? "" : this.myalertcode; + } + + public void fillResponse(GestPayCrypt bean) { + setMyshoplogin(bean.getShopLogin().trim()); + if (!bean.getCurrency().isEmpty()) + setMycurrency(Integer.parseInt(bean.getCurrency())); + if (!bean.getAmount().isEmpty()) + setMyamount(Float.parseFloat(bean.getAmount())); + setMyshoptrxID(bean.getShopTransactionID().trim()); + setMybuyername(bean.getBuyerName().trim()); + setMybuyeremail(bean.getBuyerEmail().trim()); + setMytrxresult(bean.getTransactionResult().trim()); + setMyauthcode(bean.getAuthorizationCode()); + setMyerrorcode(bean.getErrorCode()); + setMyerrordescription(bean.getErrorDescription().trim()); + setMyerrorbanktrxid(bean.getBankTransactionID().trim()); + setMyalertcode(bean.getAlertCode().trim()); + setMyalertdescription(bean.getAlertDescription().trim()); + setMycustominfo(bean.getCustomInfo().trim()); + if (!bean.getShopTransactionID().isEmpty()) + setId_ordine(Long.parseLong(bean.getShopTransactionID())); + } + + public void setMyalertcode(String myalertcode) { + this.myalertcode = myalertcode; + } + + public String getMyalertdescription() { + return (this.myalertdescription == null) ? "" : + this.myalertdescription; + } + + public void setMyalertdescription(String myalertdescription) { + this.myalertdescription = myalertdescription; + } + + public float getMyamount() { + return this.myamount; + } + + public void setMyamount(float myamount) { + this.myamount = myamount; + } + + public String getMyauthcode() { + return (this.myauthcode == null) ? "" : this.myauthcode; + } + + public void setMyauthcode(String myauthcode) { + this.myauthcode = myauthcode; + } + + public String getMybuyeremail() { + return (this.mybuyeremail == null) ? "" : this.mybuyeremail; + } + + public void setMybuyeremail(String mybuyeremail) { + this.mybuyeremail = mybuyeremail; + } + + public String getMybuyername() { + return (this.mybuyername == null) ? "" : this.mybuyername; + } + + public void setMybuyername(String mybuyername) { + this.mybuyername = mybuyername; + } + + public int getMycurrency() { + return this.mycurrency; + } + + public void setMycurrency(int mycurrency) { + this.mycurrency = mycurrency; + } + + public String getMycustominfo() { + return (this.mycustominfo == null) ? "" : this.mycustominfo; + } + + public void setMycustominfo(String mycustominfo) { + this.mycustominfo = mycustominfo; + } + + public String getMyerrorbanktrxid() { + return (this.myerrorbanktrxid == null) ? "" : + this.myerrorbanktrxid; + } + + public void setMyerrorbanktrxid(String myerrorbanktrxid) { + this.myerrorbanktrxid = myerrorbanktrxid; + } + + public String getMyerrorcode() { + return (this.myerrorcode == null) ? "" : this.myerrorcode; + } + + public void setMyerrorcode(String myerrorcode) { + this.myerrorcode = myerrorcode; + } + + public String getMyerrordescription() { + return (this.myerrordescription == null) ? "" : + this.myerrordescription; + } + + public void setMyerrordescription(String myerrordescription) { + this.myerrordescription = myerrordescription; + } + + public String getMyshoplogin() { + return (this.myshoplogin == null) ? "" : this.myshoplogin; + } + + public void setMyshoplogin(String myshoplogin) { + this.myshoplogin = myshoplogin; + } + + public String getMyshoptrxID() { + return (this.myshoptrxID == null) ? "" : this.myshoptrxID; + } + + public void setMyshoptrxID(String myshoptrxID) { + this.myshoptrxID = myshoptrxID; + } + + public String getMytrxresult() { + return (this.mytrxresult == null) ? "" : this.mytrxresult; + } + + public void setMytrxresult(String mytrxresult) { + this.mytrxresult = mytrxresult; + } + + public long getId_ordine() { + return this.id_ordine; + } + + public void setId_ordine(long id_ordine) { + this.id_ordine = id_ordine; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/ConselTabfin.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/ConselTabfin.java new file mode 100644 index 00000000..50024aa9 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/ConselTabfin.java @@ -0,0 +1,184 @@ +package it.acxent.bank.sellaPCredit; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ConselTabfin extends DBAdapter implements Serializable { + public static final double MIN_FIN = 168.0D; + + public static final double MAX_FIN = 7500.0D; + + private long id_conselTabfin; + + private String flgTipo; + + private double valoreBene; + + private long durata; + + private double importoRata; + + private double tan; + + private double taeg; + + private double interessi; + + private double speseGestSingolaRata; + + private double speseGestTotaleRata; + + private double impostaBollo; + + private double importoTotaleDovuto; + + public ConselTabfin(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ConselTabfin() {} + + public void setId_conselTabfin(long newId_conselTabfin) { + this.id_conselTabfin = newId_conselTabfin; + } + + public void setFlgTipo(String newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public void setValoreBene(double newValoreBene) { + this.valoreBene = newValoreBene; + } + + public void setDurata(long newDurata) { + this.durata = newDurata; + } + + public void setImportoRata(double newImportoRata) { + this.importoRata = newImportoRata; + } + + public void setTan(double newTan) { + this.tan = newTan; + } + + public void setTaeg(double newTaeg) { + this.taeg = newTaeg; + } + + public void setInteressi(double newInteressi) { + this.interessi = newInteressi; + } + + public void setSpeseGestSingolaRata(double newSpeseGestSingolaRata) { + this.speseGestSingolaRata = newSpeseGestSingolaRata; + } + + public void setSpeseGestTotaleRata(double newSpeseGestTotaleRata) { + this.speseGestTotaleRata = newSpeseGestTotaleRata; + } + + public void setImpostaBollo(double newImpostaBollo) { + this.impostaBollo = newImpostaBollo; + } + + public void setImportoTotaleDovuto(double newImportoTotaleDovuto) { + this.importoTotaleDovuto = newImportoTotaleDovuto; + } + + public long getId_conselTabfin() { + return this.id_conselTabfin; + } + + public String getFlgTipo() { + return (this.flgTipo == null) ? "" : this.flgTipo.trim(); + } + + public double getValoreBene() { + return this.valoreBene; + } + + public long getDurata() { + return this.durata; + } + + public double getImportoRata() { + return this.importoRata; + } + + public double getTan() { + return this.tan; + } + + public double getTaeg() { + return this.taeg; + } + + public double getInteressi() { + return this.interessi; + } + + public double getSpeseGestSingolaRata() { + return this.speseGestSingolaRata; + } + + public double getSpeseGestTotaleRata() { + return this.speseGestTotaleRata; + } + + public double getImpostaBollo() { + return this.impostaBollo; + } + + public double getImportoTotaleDovuto() { + return this.importoTotaleDovuto; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ConselTabfinCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CONSEL_TABFIN AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (CR.getValoreBene() > 0.0D) + wc.addWc("A.valoreBene=" + CR.getValoreBene()); + if (!CR.getFlgTipo().isEmpty()) + wc.addWc("A.flgTipo='" + CR.getFlgTipo() + "'"); + if (CR.getDurata() > 0L) + wc.addWc("A.durata=" + CR.getDurata()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByTipoValoreDurata(String l_flgTipo, double l_valore, long l_durata) { + String s_Sql_Find = "select A.* from CONSEL_TABFIN AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.valoreBene=" + Math.round(l_valore)); + wc.addWc("A.flgTipo='" + l_flgTipo + "'"); + wc.addWc("A.durata=" + l_durata); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/ConselTabfinCR.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/ConselTabfinCR.java new file mode 100644 index 00000000..05956806 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/ConselTabfinCR.java @@ -0,0 +1,132 @@ +package it.acxent.bank.sellaPCredit; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ConselTabfinCR extends CRAdapter { + private long id_conselTabfin; + + private String flgTipo; + + private double valoreBene; + + private long durata; + + private double importoRata; + + private double tan; + + private double taeg; + + private double interessi; + + private double speseGestSingolaRata; + + private double speseGestTotaleRata; + + private double impostaBollo; + + private double importoTotaleDovuto; + + public ConselTabfinCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ConselTabfinCR() {} + + public void setId_conselTabfin(long newId_conselTabfin) { + this.id_conselTabfin = newId_conselTabfin; + } + + public void setFlgTipo(String newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public void setValoreBene(double newValoreBene) { + this.valoreBene = newValoreBene; + } + + public void setDurata(long newDurata) { + this.durata = newDurata; + } + + public void setImportoRata(double newImportoRata) { + this.importoRata = newImportoRata; + } + + public void setTan(double newTan) { + this.tan = newTan; + } + + public void setTaeg(double newTaeg) { + this.taeg = newTaeg; + } + + public void setInteressi(double newInteressi) { + this.interessi = newInteressi; + } + + public void setSpeseGestSingolaRata(double newSpeseGestSingolaRata) { + this.speseGestSingolaRata = newSpeseGestSingolaRata; + } + + public void setSpeseGestTotaleRata(double newSpeseGestTotaleRata) { + this.speseGestTotaleRata = newSpeseGestTotaleRata; + } + + public void setImpostaBollo(double newImpostaBollo) { + this.impostaBollo = newImpostaBollo; + } + + public void setImportoTotaleDovuto(double newImportoTotaleDovuto) { + this.importoTotaleDovuto = newImportoTotaleDovuto; + } + + public long getId_conselTabfin() { + return this.id_conselTabfin; + } + + public String getFlgTipo() { + return (this.flgTipo == null) ? "" : this.flgTipo.trim(); + } + + public double getValoreBene() { + return this.valoreBene; + } + + public long getDurata() { + return this.durata; + } + + public double getImportoRata() { + return this.importoRata; + } + + public double getTan() { + return this.tan; + } + + public double getTaeg() { + return this.taeg; + } + + public double getInteressi() { + return this.interessi; + } + + public double getSpeseGestSingolaRata() { + return this.speseGestSingolaRata; + } + + public double getSpeseGestTotaleRata() { + return this.speseGestTotaleRata; + } + + public double getImpostaBollo() { + return this.impostaBollo; + } + + public double getImportoTotaleDovuto() { + return this.importoTotaleDovuto; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/SellaPCreditReq.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/SellaPCreditReq.java new file mode 100644 index 00000000..10e4b215 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/SellaPCreditReq.java @@ -0,0 +1,369 @@ +package it.acxent.bank.sellaPCredit; + +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; + +public class SellaPCreditReq { + public static final String P_COD_TIPO_PRODOTTO_SELLA_P_CREDIT = "COD_TIPO_PRODOTTO_SELLA_P_CREDIT"; + + private String tipoesec; + + private String tabellaFinanziaria; + + private String cognome; + + private String nome; + + private String indirizzo; + + private String cellulare; + + private String pref_num; + + private String data_nascita; + + private String indirizzo_mail; + + private ApplParmFull ap; + + private String ordine; + + private String descrizioneBene; + + private String anticipoS; + + private String codiceMerce; + + private String codiceProdotto; + + private String codiceConvenzionato; + + private String importoDaFinanziare; + + public static final String SELLA_P_CREDIT_TAB_FIN_90 = "WIP"; + + private double anticipo; + + private String impspe; + + private String codiceFiscale; + + private String numeroTelefono; + + private String commissioni; + + public static final String P_SELLA_P_CREDIT_IMPORTO_MINIMO = "SELLA_P_CREDIT_IMPORTO_MINIMO"; + + public static final String P_SELLA_P_CREDIT_TEST = "SELLA_P_CREDIT_TEST"; + + public static final String P_SELLA_P_CREDIT_OK_PAGE = "SELLA_P_CREDIT_OK_PAGE"; + + public static final String SELLA_P_CREDIT_TAB_FIN_TASSO_0 = "MPF"; + + public static final String SELLA_P_CREDIT_TAB_FIN_30 = "WIN"; + + public static final String REQUEST_SERVER = "https://secure.sellapersonalcredit.it/econsel/public/entry/pf"; + + public static final String REQUEST_SERVER_TEST = "https://sandbox.sellapersonalcredit.it/econsel/public/entry/pf"; + + public static final String P_COD_TIPO_MERCE_SELLA_P_CREDIT = "COD_TIPO_MERCE_SELLA_P_CREDIT"; + + public static final String P_COD_CONVENZIONE_SELLA_P_CREDIT = "COD_CONVENZIONE_SELLA_P_CREDIT"; + + public static final String P_SELLA_P_CREDIT_ERROR_PAGE = "SELLA_P_CREDIT_ERROR_PAGE"; + + public static final String P_SELLA_P_CREDIT_RATA0 = "SELLA_P_CREDIT_RATA0"; + + public SellaPCreditReq(ApplParmFull l_ap) { + setAp(l_ap); + } + + public SellaPCreditReq() {} + + public String getTipoesec() { + return "T"; + } + + public void setTipoesec(String tipoesec) { + this.tipoesec = tipoesec; + } + + public String getTabellaFinanziaria() { + if (isTest()) + return "WIN"; + return (this.tabellaFinanziaria == null) ? "" : this.tabellaFinanziaria.trim(); + } + + public void setTabellaFinanziaria(String tabfin) { + this.tabellaFinanziaria = tabfin; + } + + public String getCognome() { + return (this.cognome == null) ? "" : this.cognome.trim(); + } + + public void setCognome(String cognome) { + this.cognome = cognome; + } + + public String getNome() { + return (this.nome == null) ? "" : this.nome.trim(); + } + + public void setNome(String nome) { + this.nome = nome; + } + + public String getIndirizzo() { + return (this.indirizzo == null) ? "" : this.indirizzo.trim(); + } + + public void setIndirizzo(String indirizzo) { + this.indirizzo = indirizzo; + } + + public String getNumeroTelefono() { + return (this.numeroTelefono == null) ? "" : this.numeroTelefono.trim(); + } + + public void setNumeroTelefono(String tel_num) { + this.numeroTelefono = tel_num; + } + + public String getPref_num() { + return (this.pref_num == null) ? "" : this.pref_num.trim(); + } + + public void setPref_num(String pref_num) { + this.pref_num = pref_num; + } + + public String getData_nascita() { + return (this.data_nascita == null) ? "" : this.data_nascita.trim(); + } + + public void setData_nascita(String data_nascita) { + this.data_nascita = data_nascita; + } + + public String getIndirizzo_mail() { + return (this.indirizzo_mail == null) ? "" : this.indirizzo_mail.trim(); + } + + public void setIndirizzo_mail(String testomail) { + this.indirizzo_mail = testomail; + } + + public String getCodiceFiscale() { + return (this.codiceFiscale == null) ? "" : this.codiceFiscale.trim(); + } + + public void setCodiceFiscale(String codfisc) { + this.codiceFiscale = codfisc; + } + + public String getOrdine() { + return (this.ordine == null) ? "" : this.ordine.trim(); + } + + public void setOrdine(String ordine) { + this.ordine = ordine; + } + + public String getDescrizioneBene() { + return (this.descrizioneBene == null) ? "" : this.descrizioneBene.trim(); + } + + public void setDescrizioneBene(String descri1) { + this.descrizioneBene = descri1; + } + + public String getAnticipoS() { + return (this.anticipoS == null) ? "" : this.anticipoS; + } + + public void setAnticipoS(String parz1) { + this.anticipoS = parz1; + } + + public String getCodiceMerce() { + if (isTest()) + return "HT"; + if (this.codiceMerce == null) + this.codiceMerce = getApFull().getParm("COD_TIPO_MERCE_SELLA_P_CREDIT").getTesto(); + return this.codiceMerce; + } + + public boolean isTest() { + return getApFull().getParm("SELLA_P_CREDIT_TEST").isTrue(); + } + + public void setCodiceMerce(String h_merce) { + this.codiceMerce = h_merce; + } + + public String getCodiceProdotto() { + if (isTest()) + return "50"; + if (this.codiceProdotto == null) + this.codiceProdotto = getApFull().getParm("COD_TIPO_PRODOTTO_SELLA_P_CREDIT").getTesto(); + return this.codiceProdotto; + } + + public void setCodiceProdotto(String h_prod) { + this.codiceProdotto = h_prod; + } + + public String getCodiceConvenzionato() { + if (isTest()) + return "0049613"; + if (this.codiceConvenzionato == null) + this.codiceConvenzionato = getApFull().getParm("COD_CONVENZIONE_SELLA_P_CREDIT").getTesto().trim(); + return this.codiceConvenzionato; + } + + public void setCodiceConvenzionato(String convenz) { + this.codiceConvenzionato = convenz; + } + + public String getImportoDaFinanziare() { + return (this.importoDaFinanziare == null) ? "" : this.importoDaFinanziare; + } + + public void setImportoDaFinanziare(String impdafin) { + this.importoDaFinanziare = impdafin; + } + + public double getAnticipo() { + return this.anticipo; + } + + public String getRequestServer() { + if (isTest()) + return "https://sandbox.sellapersonalcredit.it/econsel/public/entry/pf"; + return "https://secure.sellapersonalcredit.it/econsel/public/entry/pf"; + } + + public void setAnticipo(double anticipo) { + this.anticipo = anticipo; + } + + public static void initApplicationParms(ApplParmFull ap) { + if (ap != null) { + DBAdapter.logDebug(true, "SELLA_P_CREDIT chechout initParms: start"); + String l_tipoParm = ""; + Parm bean = new Parm(ap); + l_tipoParm = "SELLA_P_CREDIT"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("COD_CONVENZIONE_SELLA_P_CREDIT"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("COD_CONVENZIONE_SELLA_P_CREDIT"); + bean.setDescrizione("COD_CONVENZIONE_SELLA_P_CREDIT"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("0026321"); + bean.setNota("CODICE CONVENZIONE SELLA_P_CREDIT"); + bean.save(); + bean.findByCodice("COD_TIPO_MERCE_SELLA_P_CREDIT"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("COD_TIPO_MERCE_SELLA_P_CREDIT"); + bean.setDescrizione("COD_TIPO_MERCE_SELLA_P_CREDIT"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("HT"); + bean.setNota("CODICE INDICATIVO MERCE FINANZIATA "); + bean.save(); + bean.findByCodice("COD_TIPO_PRODOTTO_SELLA_P_CREDIT"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("COD_TIPO_PRODOTTO_SELLA_P_CREDIT"); + bean.setDescrizione("COD_TIPO_PRODOTTO_SELLA_P_CREDIT"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("50"); + bean.setNota("CODICE INDICATIVO PRODOTTO FINANZIATO"); + bean.save(); + bean.findByCodice("SELLA_P_CREDIT_ERROR_PAGE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SELLA_P_CREDIT_ERROR_PAGE"); + bean.setDescrizione("SELLA_P_CREDIT_ERROR_PAGE"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("sellaPCreditRes.jsp"); + bean.setNota("SELLA_P_CREDIT_ERROR_PAGE"); + bean.save(); + bean.findByCodice("SELLA_P_CREDIT_OK_PAGE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SELLA_P_CREDIT_OK_PAGE"); + bean.setDescrizione("SELLA_P_CREDIT_OK_PAGE"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("sellaPCreditRes.jsp"); + bean.setNota("SELLA_P_CREDIT_OK_PAGE"); + bean.save(); + bean.findByCodice("SELLA_P_CREDIT_TEST"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SELLA_P_CREDIT_TEST"); + bean.setDescrizione("SELLA_P_CREDIT_TEST"); + bean.setFlgTipo(5L); + bean.setNota("0-->NO 1-->SI"); + bean.save(); + bean.findByCodice("SELLA_P_CREDIT_IMPORTO_MINIMO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SELLA_P_CREDIT_IMPORTO_MINIMO"); + bean.setDescrizione("SELLA_P_CREDIT_IMPORTO_MINIMO"); + bean.setFlgTipo(1L); + bean.setNota("SELLA_P_CREDIT_IMPORTO_MINIMO"); + bean.save(); + bean.findByCodice("SELLA_P_CREDIT_RATA0"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SELLA_P_CREDIT_RATA0"); + bean.setDescrizione("SELLA_P_CREDIT_RATA0"); + bean.setFlgTipo(5L); + bean.setNota(" ATTIVA ANCHE RATA 0 SOPRA L'IMPORTO DEFINITO DA SELLA_P_CREDIT_IMPORTO_MINIMO
0: RATA 0 NON ATTIVA
1: RATA 0 ATTIVA"); + bean.save(); + DBAdapter.logDebug(true, "SELLA_P_CREDIT chechout initParms: stop"); + } + } + + public String getImpspe() { + return (this.impspe == null) ? "" : this.impspe; + } + + public void setImpspe(String impspe) { + this.impspe = impspe; + } + + public ApplParmFull getApFull() { + return this.ap; + } + + public void setAp(ApplParmFull ap) { + this.ap = ap; + } + + public String getCellulare() { + return (this.cellulare == null) ? "" : this.cellulare.trim(); + } + + public void setCellulare(String cellulare) { + this.cellulare = cellulare; + } + + public String getCommissioni() { + return (this.commissioni == null) ? "" : this.commissioni.trim(); + } + + public void setCommissioni(String commissioni) { + this.commissioni = commissioni; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/SellaPCreditResp.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/SellaPCreditResp.java new file mode 100644 index 00000000..114df62c --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/SellaPCreditResp.java @@ -0,0 +1,67 @@ +package it.acxent.bank.sellaPCredit; + +import it.acxent.db.ApplParmFull; + +public class SellaPCreditResp { + private String pratica; + + private ApplParmFull ap; + + private String ordine; + + private String praticabis; + + private String stato; + + public static final String SELLA_P_CREDIT_VALUTAZIONE = "WW"; + + public static final String SELLA_P_CREDIT_KO = "KO"; + + public static final String SELLA_P_CREDIT_OK = "OK"; + + public SellaPCreditResp(ApplParmFull l_ap) { + setAp(l_ap); + } + + public SellaPCreditResp() {} + + public String getOrdine() { + return (this.ordine == null) ? "" : this.ordine.trim(); + } + + public void setOrdine(String ordine) { + this.ordine = ordine; + } + + public ApplParmFull getApFull() { + return this.ap; + } + + public void setAp(ApplParmFull ap) { + this.ap = ap; + } + + public String getPratica() { + return (this.pratica == null) ? "" : this.pratica.trim(); + } + + public void setPratica(String pratica) { + this.pratica = pratica; + } + + public String getPraticabis() { + return (this.praticabis == null) ? "" : this.praticabis.trim(); + } + + public void setPraticabis(String praticabis) { + this.praticabis = praticabis; + } + + public String getStato() { + return (this.stato == null) ? "" : this.stato.trim(); + } + + public void setStato(String stato) { + this.stato = stato; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/package-info.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/package-info.java new file mode 100644 index 00000000..a93b34fa --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/sellaPCredit/package-info.java @@ -0,0 +1 @@ +package it.acxent.bank.sellaPCredit; diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/consel/ConselReqSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/consel/ConselReqSvlt.java new file mode 100644 index 00000000..744e1abd --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/consel/ConselReqSvlt.java @@ -0,0 +1,118 @@ +package it.acxent.bank.servlet.consel; + +import it.acxent.bank.consel.ConselReq; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletOutputStream; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class ConselReqSvlt extends ConselSvlt { + protected void sendRequest(HttpServletRequest req, HttpServletResponse res) { + try { + String conselSite = "https://reserved.e-consel.it/DOL/faces/frmECProntoTuo.jsp"; + ConselReq conselReq = new ConselReq(getApFull()); + fillObject(req, conselReq); + caricaConselRequest(req, conselReq); + if (getParm("CONSEL_TEST").getNumeroLong() == 1L) + caricaDemoRequest(req, conselReq); + req.setAttribute("conselReq", conselReq); + RequestDispatcher rd = getServletContext() + .getRequestDispatcher("/conselReq.jsp"); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + try { + sendRequest(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected abstract void caricaConselRequest(HttpServletRequest paramHttpServletRequest, ConselReq paramConselReq); + + private void caricaDemoRequest(HttpServletRequest req, ConselReq conselReq) { + conselReq.setCodfisc("CLMCST80A01D969I"); + conselReq.setCognome("COLOMBO"); + conselReq.setNome("CRISTOFORO"); + conselReq.setData_nascita("01/01/1980"); + } + + protected void sendRequestOld(HttpServletRequest req, HttpServletResponse res) { + try { + String conselSite = "https://reserved.e-consel.it/DOL/faces/frmECProntoTuo.jsp"; + ConselReq conselReq = new ConselReq(getApFull()); + fillObject(req, conselReq); + caricaConselRequest(req, conselReq); + if (getParm("TEST").getNumeroLong() == 1L) + caricaDemoRequest(req, conselReq); + StringBuffer data = new StringBuffer(URLEncoder.encode("tiposec", "UTF-8") + "=" + URLEncoder.encode("tiposec", "UTF-8")); + data.append("&" + URLEncoder.encode("tabfin", "UTF-8") + "=" + + URLEncoder.encode(conselReq.getTabfin(), "UTF-8")); + data.append("&" + URLEncoder.encode("convenz", "UTF-8") + "=" + + URLEncoder.encode(conselReq.getConvenz(), "UTF-8")); + data.append("&" + URLEncoder.encode("h_merce", "UTF-8") + "=" + + URLEncoder.encode(conselReq.getH_merce(), "UTF-8")); + data.append("&" + URLEncoder.encode("h_prod", "UTF-8") + "=" + + URLEncoder.encode(conselReq.getH_prod(), "UTF-8")); + data.append("&" + URLEncoder.encode("cognome", "UTF-8") + "=" + + URLEncoder.encode(conselReq.getCognome(), "UTF-8")); + data.append("&" + URLEncoder.encode("nome", "UTF-8") + "=" + + URLEncoder.encode(conselReq.getNome(), "UTF-8")); + data.append("&" + URLEncoder.encode("ordine", "UTF-8") + "=" + + URLEncoder.encode(conselReq.getOrdine(), "UTF-8")); + data.append("&" + URLEncoder.encode("anticipo", "UTF-8") + "=" + + conselReq.getAnticipo()); + data.append("&" + URLEncoder.encode("descr1", "UTF-8") + "=" + + URLEncoder.encode(conselReq.getDescri1(), "UTF-8")); + data.append("&" + URLEncoder.encode("parz1", "UTF-8") + "=" + + conselReq.getParz1()); + data.append("&" + URLEncoder.encode("tel_num", "UTF-8") + "=" + + URLEncoder.encode(conselReq.getTel_num(), "UTF-8")); + data.append("&" + URLEncoder.encode("pref_num", "UTF-8") + "=" + + URLEncoder.encode(conselReq.getPref_num(), "UTF-8")); + data.append("&" + URLEncoder.encode("impspe", "UTF-8") + "=" + + conselReq.getImpspe()); + data.append("&" + URLEncoder.encode("impdafin", "UTF-8") + "=" + + conselReq.getImpdafin()); + data.append("&" + URLEncoder.encode("data_nascita", "UTF-8") + "=" + + URLEncoder.encode(conselReq.getData_nascita(), "UTF-8")); + data.append("&" + URLEncoder.encode("indirizzo", "UTF-8") + "=" + + URLEncoder.encode(conselReq.getIndirizzo(), "UTF-8")); + data.append("&" + URLEncoder.encode("testomail", "UTF-8") + "=" + + URLEncoder.encode(conselReq.getTestomail(), "UTF-8")); + data.append("&" + URLEncoder.encode("codifisc", "UTF-8") + "=" + + URLEncoder.encode(conselReq.getCodfisc(), "UTF-8")); + URL url = new URL(conselSite); + URLConnection conn = url.openConnection(); + conn.setDoOutput(true); + OutputStreamWriter wr = new OutputStreamWriter( + conn.getOutputStream()); + wr.write(data.toString()); + wr.flush(); + BufferedReader rd = new BufferedReader(new InputStreamReader( + conn.getInputStream())); + ServletOutputStream sos = res.getOutputStream(); + String line; + while ((line = rd.readLine()) != null) + sos.write(line.getBytes(), 0, line.length()); + wr.close(); + sos.flush(); + sos.close(); + rd.close(); + } catch (Exception e) { + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/consel/ConselRespSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/consel/ConselRespSvlt.java new file mode 100644 index 00000000..78df2b45 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/consel/ConselRespSvlt.java @@ -0,0 +1,39 @@ +package it.acxent.bank.servlet.consel; + +import it.acxent.bank.consel.ConselResp; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class ConselRespSvlt extends ConselSvlt { + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + try { + manageResponse(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void manageResponse(HttpServletRequest req, HttpServletResponse res) { + try { + ConselResp conselResp = new ConselResp(getApFull()); + fillObject(req, conselResp); + if (conselResp.getStato().toLowerCase() + .equals("OK".toLowerCase()) || + + conselResp.getStato() + .toLowerCase() + .equals("WW".toLowerCase())) { + setJspPageRelative(getJspOkPage(req, res), req); + } else { + setJspPageRelative(getJspKoPage(req, res), req); + } + manageConselResponse(req, conselResp); + req.setAttribute("conselResp", conselResp); + callJsp(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected abstract void manageConselResponse(HttpServletRequest paramHttpServletRequest, ConselResp paramConselResp); +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/consel/ConselSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/consel/ConselSvlt.java new file mode 100644 index 00000000..a5b79dc9 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/consel/ConselSvlt.java @@ -0,0 +1,68 @@ +package it.acxent.bank.servlet.consel; + +import it.acxent.bank.consel.ConselTabfin; +import it.acxent.bank.consel.ConselTabfinCR; +import it.acxent.servlet.AcServlet; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ConselSvlt extends AcServlet { + protected static final String CONSEL_REQ_JSP = "/conselReq.jsp"; + + protected static final String BEAN_CONSEL_REQ = "conselReq"; + + protected static final String BEAN_CONSEL_RESP = "conselResp"; + + protected final void callJsp(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspOkPage(req, res), req); + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected String getCodiceConvenzione(HttpServletRequest req) { + return getParm("COD_CONVENZIONE_SELLA_P_CREDIT").getTesto(); + } + + protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("SELLA_P_CREDIT_ERROR_PAGE").getTesto(); + if (temp.isEmpty()) + return getJspKoPage(req, res); + return temp; + } + + protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("SELLA_P_CREDIT_OK_PAGE").getTesto(); + if (temp.isEmpty()) + return "conselRes.jsp"; + return temp; + } + + protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("SELLA_P_CREDIT_OK_PAGE").getTesto(); + if (temp.isEmpty()) + return "conselRes.jsp"; + return temp; + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + ConselTabfin ct = new ConselTabfin(getApFull()); + ConselTabfinCR CR = new ConselTabfinCR(); + fillObject(req, CR); + req.setAttribute("list", ct.findByCR(CR, 0, 0)); + req.setAttribute("CR", CR); + req.setAttribute("nf3", getNf3()); + setJspPageRelative("tabfin" + CR.getFlgTipo() + getAct(req) + ".jsp", req); + callJsp(req, res); + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/infogroup/GetShopnetResponseSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/infogroup/GetShopnetResponseSvlt.java new file mode 100644 index 00000000..17da90f5 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/infogroup/GetShopnetResponseSvlt.java @@ -0,0 +1,10 @@ +package it.acxent.bank.servlet.infogroup; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class GetShopnetResponseSvlt extends ShopNetSvlt { + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + getResponse(req, res); + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/infogroup/ShopNetSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/infogroup/ShopNetSvlt.java new file mode 100644 index 00000000..ca723ae6 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/infogroup/ShopNetSvlt.java @@ -0,0 +1,91 @@ +package it.acxent.bank.servlet.infogroup; + +import it.acxent.bank.infogroup.ShopnetResp; +import it.acxent.servlet.AcServlet; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class ShopNetSvlt extends AcServlet { + protected static final String BEAN_SHOPNETRES = "shopnetResp"; + + protected final void callJsp(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspOkPage(req, res), req); + try { + RequestDispatcher rd = getServletContext() + .getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected abstract void fillIdOrdineByShopnetRes(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, ShopnetResp paramShopnetResp); + + protected void getResponse(HttpServletRequest req, HttpServletResponse res) { + try { + ShopnetResp snRes = new ShopnetResp(); + fillObject(req, snRes); + fillIdOrdineByShopnetRes(req, res, snRes); + if (snRes.getStato() == 2L) { + setJspPageRelative(getJspOkPage(req, res), req); + recordOrder(req, res, snRes); + } else { + sendMessage(req, "Errore! Transazione annullata."); + payKoUpdateOrder(req, res, snRes); + setJspPageRelative(getJspKoPage(req, res), req); + } + req.setAttribute("shopnetResp", snRes); + preparePaymenResPage(req, res, snRes); + callJsp(req, res); + } catch (Exception e) { + setJspPageRelative(getJspErrorPage(req, res), req); + String temp = "ERRORE!!Shopnet! Risposta non valida: "; + sendMessage(req, temp); + handleDebug(temp, 2); + preparePaymenResPage(req, res, null); + callJsp(req, res); + } + } + + protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("PAY_OK").getTesto(); + if (temp.isEmpty()) + return getJspKoPage(req, res); + return temp; + } + + protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("PAY_OK").getTesto(); + if (temp.isEmpty()) + return "payRes.jsp"; + return temp; + } + + protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("PAY_OK").getTesto(); + if (temp.isEmpty()) + return "payRes.jsp"; + return temp; + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + try { + getResponse(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, ShopnetResp paramShopnetResp); + + protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, ShopnetResp snRes) {} + + protected abstract void payKoUpdateOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, ShopnetResp paramShopnetResp); +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/keyclient/GetKeyClientResponseSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/keyclient/GetKeyClientResponseSvlt.java new file mode 100644 index 00000000..b1e6c718 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/keyclient/GetKeyClientResponseSvlt.java @@ -0,0 +1,39 @@ +package it.acxent.bank.servlet.keyclient; + +import it.acxent.bank.keyclient.KeyClientResp; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class GetKeyClientResponseSvlt extends KeyClientSvlt { + protected abstract void preparePaymenResPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, KeyClientResp paramKeyClientResp); + + protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, KeyClientResp paramKeyClientResp); + + protected void getResponse(HttpServletRequest req, HttpServletResponse res) { + try { + KeyClientResp kcRes = new KeyClientResp(); + fillObject(req, kcRes); + kcRes.setBRAND(getRequestParameter(req, "$BRAND")); + if (kcRes.getEsito().equals("OK")) { + setJspPageRelative(getJspOkPage(req, res), req); + recordOrder(req, res, kcRes); + } else { + setJspPageRelative(getJspKoPage(req, res), req); + } + req.setAttribute("KCResp", kcRes); + preparePaymenResPage(req, res, kcRes); + callJsp(req, res); + } catch (Exception e) { + setJspPageRelative(getJspErrorPage(req, res), req); + String temp = "ERRORE!!Key Client! Risposta non valida: "; + sendMessage(req, temp); + handleDebug(temp, 2); + preparePaymenResPage(req, res, null); + callJsp(req, res); + } + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + getResponse(req, res); + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/keyclient/KeyClientSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/keyclient/KeyClientSvlt.java new file mode 100644 index 00000000..695338f5 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/keyclient/KeyClientSvlt.java @@ -0,0 +1,119 @@ +package it.acxent.bank.servlet.keyclient; + +import it.acxent.bank.infogroup.ShopnetResp; +import it.acxent.bank.keyclient.KeyClientReq; +import it.acxent.servlet.AcServlet; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class KeyClientSvlt extends AcServlet { + protected static final String BEAN_KC_RES = "KCResp"; + + protected static final String CMD_GET_RES = "res"; + + protected static final String CMD_SEND_REQ = "send"; + + protected final void callJsp(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspOkPage(req, res), req); + try { + RequestDispatcher rd = getServletContext() + .getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void getResponse(HttpServletRequest req, HttpServletResponse res) {} + + protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("KC_PAY_OK").getTesto(); + if (temp.isEmpty()) + return getJspKoPage(req, res); + return temp; + } + + protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("KC_PAY_OK").getTesto(); + if (temp.isEmpty()) + return "payRes.jsp"; + return temp; + } + + protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("KC_PAY_OK").getTesto(); + if (temp.isEmpty()) + return "payRes.jsp"; + return temp; + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + String cmd = getCmd(req).toLowerCase(); + try { + if (cmd.equals("send")) { + sendRequest(req, res); + } else if (cmd.equals("res")) { + getResponse(req, res); + } else { + sendRequest(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected void payKoUpdateOrder(HttpServletRequest req, HttpServletResponse res, ShopnetResp snRes) {} + + protected void sendRequest(HttpServletRequest req, HttpServletResponse res) { + try { + String theUrl; + KeyClientReq kcReq = new KeyClientReq(); + fillObject(req, kcReq); + kcReq.setKey(getParm("KC_KEY").getTesto()); + kcReq.setAlias(getParm("KC_ALIAS").getTesto()); + kcReq.setUrl(getParm("KC_URL_RESPONSE").getTesto()); + kcReq.setUrl_back(getParm("KC_URL_RESPONSE_NULL") + .getTesto()); + if (getParm("TEST").getNumeroLong() == 1L) { + theUrl = kcReq.getTestRequestUrl(); + } else { + theUrl = kcReq.getRequestUrl(); + System.out.println(theUrl); + System.out.println(kcReq.getTestRequestUrl()); + } + if (!theUrl.equals("")) { + res.sendRedirect(theUrl); + } else { + setJspPageRelative(getJspErrorPage(req, res), req); + String temp = "ERRORE!!KeyClient Svlt! Impossibile creare url di richiesta!"; + sendMessage(req, temp); + getResponse(req, res); + handleDebug(temp, 2); + callJsp(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected String getUrlResponse(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("KC_URL_RESPONSE").getTesto(); + if (temp.isEmpty()) + return "RicevutaKC.abl"; + return temp; + } + + protected String getUrlResponseNull(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("KC_URL_RESPONSE_NULL").getTesto(); + if (temp.isEmpty()) + return "RicevutaKC.abl"; + return temp; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/paypal/GetPayPalResponseSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/paypal/GetPayPalResponseSvlt.java new file mode 100644 index 00000000..4b5d4dd2 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/paypal/GetPayPalResponseSvlt.java @@ -0,0 +1,11 @@ +package it.acxent.bank.servlet.paypal; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@Deprecated +public class GetPayPalResponseSvlt extends PayPalSvlt { + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + getPayerDatails(req, res); + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/paypal/PayPalSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/paypal/PayPalSvlt.java new file mode 100644 index 00000000..615bc38f --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/paypal/PayPalSvlt.java @@ -0,0 +1,301 @@ +package it.acxent.bank.servlet.paypal; + +import it.acxent.bank.paypal.PayPalReq; +import it.acxent.bank.paypal.PayPalResp; +import it.acxent.servlet.AcServlet; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@Deprecated +public class PayPalSvlt extends AcServlet { + private static final long serialVersionUID = 5690538301539954108L; + + public static final String CMD_SET_EXPRESS_CEHCKOUT = "start"; + + public static final String CMD_DO_EXPRESS_CEHCKOUT = "dopayment"; + + protected static final String CMD_GET_RES = "res"; + + protected static final String BEAN_PAYPALRES = "payPalResp"; + + private String payPalHttpServer; + + private static final boolean debug = false; + + private static boolean debugRecordOrder = false; + + private String API_VERSION = "98"; + + protected final void callJsp(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspOkPage(req, res), req); + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void doSetExpressCheckout(HttpServletRequest req, HttpServletResponse res) { + try { + PayPalReq ppReq = new PayPalReq(); + fillObject(req, ppReq); + String sec = getRequiredParameterstring() + "&CURRENCYCODE=" + getRequiredParameterstring() + "&METHOD=SetExpressCheckout&AMT=" + getCurrency() + "&RETURNURL=" + + URLEncoder.encode(String.valueOf(ppReq.getAmt())) + "&CANCELURL=" + + URLEncoder.encode(getReturnURL(req, res)) + "&" + URLEncoder.encode(getCancelURL(req, res)); + String pageStyle = getPageStyle(); + if (!pageStyle.equals("")) + sec = sec + "&PAGESTYLE=" + sec; + String urlString = getPayPalHttpServer(req) + "?" + getPayPalHttpServer(req); + URL url = new URL(urlString); + URLConnection connection = url.openConnection(); + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + PayPalResp ppResponse = new PayPalResp(); + ppResponse.fillResponse(in); + ppResponse.setId_ordine(ppReq.getId_ordine()); + req.getSession().setAttribute("_SESS_ID_ORDER", new Long(ppReq.getId_ordine())); + if (ppResponse.isResponseOk()) { + String rediretUrl; + if (getParm("TEST").getNumeroLong() == 1L) { + rediretUrl = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" + ppResponse.getTOKEN(); + } else { + rediretUrl = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=" + ppResponse.getTOKEN(); + } + req.getSession().setAttribute("_SESS_TOKEN", ppResponse.getTOKEN()); + res.sendRedirect(rediretUrl); + } else { + req.setAttribute("payPalResp", ppResponse); + setJspPageRelative(getJspErrorPage(req, res), req); + String temp = "ERRORE!!PayPal Error! Code: " + ppResponse.getL_ERRORCODE0() + ": " + ppResponse.getL_SHORTMESSAGE0() + " " + + ppResponse.getL_LONGMESSAGE0(); + sendMessage(req, temp); + preparePaymenResPage(req, res, ppResponse); + handleDebug(temp, 2); + callJsp(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected void getPayerDatails(HttpServletRequest req, HttpServletResponse res) { + try { + String token = (String)req.getSession().getAttribute("_SESS_TOKEN"); + String sec = getRequiredParameterstring() + "&METHOD=GetExpressCheckoutDetails&TOKEN=" + getRequiredParameterstring(); + String urlString = getPayPalHttpServer(req) + "?" + getPayPalHttpServer(req); + URL url = new URL(urlString); + URLConnection connection = url.openConnection(); + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + PayPalResp ppResponse = new PayPalResp(); + ppResponse.fillResponse(in); + long l_id_ordine = (Long)req.getSession().getAttribute("_SESS_ID_ORDER"); + ppResponse.setId_ordine(l_id_ordine); + fillObject(req, ppResponse); + if (ppResponse.isResponseOk() && !ppResponse.getPAYERID().isEmpty()) { + ppResponse.setDetailBuyer(true); + setJspPageRelative(getJspPayerDetailsPage(req, res), req); + } else { + if (ppResponse.isResponseOk()) + sendMessage(req, "Transazione Abbandonata!"); + ppResponse.setDetailBuyer(false); + setJspPageRelative(getJspKoPage(req, res), req); + } + req.setAttribute("payPalResp", ppResponse); + preparePaymenResPage(req, res, ppResponse); + callJsp(req, res); + } catch (Exception e) { + setJspPageRelative(getJspErrorPage(req, res), req); + String temp = "ERRORE!!PayPal Error! getPayerDetail: "; + sendMessage(req, temp); + handleDebug(temp, 2); + preparePaymenResPage(req, res, null); + callJsp(req, res); + } + } + + protected void doExpresssCheckout(HttpServletRequest req, HttpServletResponse res) { + try { + PayPalResp ppResponse = new PayPalResp(); + if (!debugRecordOrder) { + PayPalReq ppReq = new PayPalReq(); + fillObject(req, ppReq); + long l_id_ordine = (Long)req.getSession().getAttribute("_SESS_ID_ORDER"); + String sec = getRequiredParameterstring() + "&CURRENCYCODE=" + getRequiredParameterstring() + "&METHOD=DoExpressCheckoutPayment&TOKEN=" + getCurrency() + "&AMT=" + + ppReq.getTOKEN() + "&PAYERID=" + ppReq.getAmt() + "&PAYMENTACTION=Sale"; + String urlString = getPayPalHttpServer(req) + "?" + getPayPalHttpServer(req); + URL url = new URL(urlString); + URLConnection connection = url.openConnection(); + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + ppResponse.fillResponse(in); + ppResponse.setId_ordine(l_id_ordine); + fillObject(req, ppResponse); + if (!ppResponse.isResponseOk()) { + ppResponse.setDetailBuyer(false); + setJspPageRelative(getJspKoPage(req, res), req); + } else { + ppResponse.setPaymentDone(true); + ppResponse.setDetailBuyer(true); + setJspPageRelative(getJspOkPage(req, res), req); + recordOrder(req, res, ppResponse); + } + } else { + fillObject(req, ppResponse); + ppResponse.setACK("Success"); + ppResponse.setAMT("40.00"); + ppResponse.setPaymentDone(true); + recordOrder(req, res, ppResponse); + } + req.setAttribute("payPalResp", ppResponse); + preparePaymenResPage(req, res, ppResponse); + callJsp(req, res); + } catch (Exception e) { + setJspPageRelative(getJspErrorPage(req, res), req); + String temp = "ERRORE!!PayPal Error! getPayerDetail: "; + sendMessage(req, temp); + handleDebug(temp, 2); + preparePaymenResPage(req, res, null); + callJsp(req, res); + } + } + + protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("PAYPAL_OK").getTesto(); + if (temp.isEmpty()) + return "payPalRes.jsp"; + return temp; + } + + protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("PAYPAL_OK").getTesto(); + if (temp.isEmpty()) + return "payPalRes.jsp"; + return temp; + } + + protected String getJspPayerDetailsPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("PAYPAL_DETAIL").getTesto(); + if (temp.isEmpty()) + return "payPalRes.jsp"; + return temp; + } + + protected String getReturnURL(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("PAYPAL_RETURNURL").getTesto(); + if (temp.isEmpty()) + return "http://localhost:8080/mrcocci/PayPalResp.abl"; + return temp; + } + + protected String getCancelURL(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("PAYPAL_CANCELURL").getTesto(); + if (temp.isEmpty()) + return "http://localhost:8080/mrcocci/PayPalResp.abl"; + return temp; + } + + protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("PAYPAL_OK").getTesto(); + if (temp.isEmpty()) + return "payPalRes.jsp"; + return temp; + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + try { + String cmd = getCmd(req).toLowerCase(); + if (cmd.equals("start")) { + doSetExpressCheckout(req, res); + } else if (cmd.equals("res")) { + getPayerDatails(req, res); + } else if (cmd.equals("dopayment")) { + doExpresssCheckout(req, res); + } else { + doSetExpressCheckout(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected boolean isApiCertificate(HttpServletRequest req) { + long temp = getParm("PAYPAL_USE_CERTIFICATE").getNumeroLong(); + if (temp == 1L) + return true; + return false; + } + + protected void recordOrder(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {} + + protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) {} + + private String getPayPalHttpServer(HttpServletRequest req) { + if (getParm("TEST").getNumeroLong() == 1L) { + System.out.println("PAYPAL TEST!!!! USING SANDBOX"); + if (isApiCertificate(req)) { + this.payPalHttpServer = "https://api.sandbox.paypal.com/nvp"; + } else { + this.payPalHttpServer = "https://api-aa-3t.sandbox.paypal.com/nvp"; + } + } else if (isApiCertificate(req)) { + this.payPalHttpServer = "https://api.paypal.com/nvp"; + } else { + this.payPalHttpServer = "https://api-3t.paypal.com/nvp"; + } + return this.payPalHttpServer; + } + + public void setPayPalHttpServer(String payPalHttpServer) { + this.payPalHttpServer = payPalHttpServer; + } + + private String getRequiredParameterstring() { + return "USER=" + getApiUsername() + "&PWD=" + getApiPassword() + "&SIGNATURE=" + getApiSignature() + "&VERSION=" + this.API_VERSION; + } + + protected String getApiPassword() { + String temp = getParm("PAYPAL_API_PWD").getTesto(); + if (temp.isEmpty()) + return "1196089261"; + return temp; + } + + protected String getApiSignature() { + String temp = getParm("PAYPAL_API_SIGNATURE").getTesto(); + if (temp.isEmpty()) + return "AGAgVmHK8-QsvPbEGnNP6SiFg7qvADQfsLa6GrW8G43-yqX46vNyyZzG"; + return temp; + } + + private String getPageStyle() { + String temp = getParm("PAYPAL_PAGE_STYLE").getTesto(); + if (temp.isEmpty()) + return ""; + return temp; + } + + protected String getApiUsername() { + String temp = getParm("PAYPAL_API_USERNAME").getTesto(); + if (temp.isEmpty()) + return "acolzi_1196089239_biz_api1.f3.com"; + return temp; + } + + protected String getCurrency() { + String temp = getParm("PAYPAL_CURRENCY").getTesto(); + if (temp.isEmpty()) + return "EUR"; + return temp; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/paypalcheckout/PaypalCheckoutSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/paypalcheckout/PaypalCheckoutSvlt.java new file mode 100644 index 00000000..64df38ad --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/paypalcheckout/PaypalCheckoutSvlt.java @@ -0,0 +1,182 @@ +package it.acxent.bank.servlet.paypalcheckout; + +import com.paypal.http.HttpResponse; +import com.paypal.http.serializer.Json; +import com.paypal.orders.Order; +import it.acxent.bank.paypalcheckout.PayPalOrder; +import it.acxent.bank.paypalcheckout.PayPalReq; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AcServlet; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.apache.commons.io.IOUtils; +import org.json.JSONArray; +import org.json.JSONObject; + +public class PaypalCheckoutSvlt extends AcServlet { + private static final long serialVersionUID = 5690568301539954108L; + + public static final String CMD_CREATE_ORDER = "createOrder"; + + public static final String CMD_GET_ORDER_DETAILS = "getOrderDetails"; + + protected static final String CMD_GET_RES = "res"; + + protected static final String BEAN_PAYPALRES = "payPalResp"; + + private static final boolean debug = false; + + protected final void callJsp(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspOkPage(req, res), req); + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + private void _createOrder(HttpServletRequest req, HttpServletResponse res) { + PayPalReq pReq = getPayPalReq(req, res); + pReq.setPaypalClientId(getApplicationClientId()); + pReq.setPaypalClientSecret(getApplicationClienteSecret()); + pReq.setUseSandbox(isUseSandbox(req)); + try { + HttpResponse respOrd = new PayPalOrder(pReq).createOrder(false); + String orderId = ((Order)respOrd.result()).id(); + String result = "{\"orderID\":\"" + orderId + "\"}"; + System.out.println(String.valueOf(DBAdapter.getNow()) + " _createOrder paypalcheckoutsvlt: " + String.valueOf(DBAdapter.getNow())); + pReq.setPaypalOrderId(orderId); + updatePaypalOrderId(req, pReq); + sendHtmlMsgResponse(req, res, result); + } catch (Exception e) { + e.printStackTrace(); + System.out.println(String.valueOf(DBAdapter.getNow()) + " _createOrder paypalcheckoutsvlt: exception; " + String.valueOf(DBAdapter.getNow())); + } + } + + private String getJspOkPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("PAYPAL_OK").getTesto(); + if (temp.isEmpty()) + return "payPalRes.jsp"; + return temp; + } + + private String getCancelURL(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("PAYPAL_CANCELURL").getTesto(); + if (temp.isEmpty()) + return "http://localhost/cc/PayPalCOResp.abl"; + return temp; + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + try { + String cmd = getCmd(req); + if (cmd.equals("createOrder")) { + _createOrder(req, res); + } else { + _getPayerDatails(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + private boolean isUseSandbox(HttpServletRequest req) { + return getParm("P_PAYPAL_CHECKOUT_USE_SANDBOX").isTrue(); + } + + protected void recordOrder(HttpServletRequest req, HttpServletResponse res, JSONObject jso) {} + + private String getApplicationClientId() { + String temp = getParm("PAYPAL_CHECKOUT_APPLICATION_CLIENT_ID").getTesto(); + if (temp.isEmpty()) + return "ASB7x1BxlkomVZ1BM0OesK2SuCLjRq9R4dyc5rtCVBzM7nHB0eunZyyxO4758BgXnZBV9JSCZ3bqpFw9"; + return temp; + } + + private String getApplicationClienteSecret() { + String temp = getParm("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET").getTesto(); + if (temp.isEmpty()) + return "EFiYhkh4tgv1d3Wnx2qUAG1_BtxddWoGhZTlV7EseRfP4uKFMRAub_5G9D9PIgTObVjB54SZd2UNyXlZ"; + return temp; + } + + private String getCurrency() { + String temp = getParm("PAYPAL_CURRENCY").getTesto(); + if (temp.isEmpty()) + return "EUR"; + return temp; + } + + private String getReturnURL(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("PAYPAL_RETURNURL").getTesto(); + if (temp.isEmpty()) + return "http://localhost/cc/PayPalCOResp.abl"; + return temp; + } + + private void _getPayerDatails(HttpServletRequest req, HttpServletResponse res) { + PayPalReq preq = new PayPalReq(); + fillObject(req, preq); + preq.setPaypalClientId(getApplicationClientId()); + preq.setPaypalClientSecret(getApplicationClienteSecret()); + preq.setUseSandbox(isUseSandbox(req)); + System.out.println("PAYPALCHECKOUT _getPayerDatails .... "); + try { + String orderIdJson = IOUtils.toString(req.getReader()); + JSONObject jso = new JSONObject(orderIdJson); + String orderId = jso.getString("orderID"); + HttpResponse respOrd = new PayPalOrder(preq).getOrder(orderId); + JSONObject jsonRespObj = new JSONObject(new Json().serialize(respOrd.result())); + String json = jsonRespObj.toString(4); + String status = jsonRespObj.getString("status"); + System.out.println("PAYPALCHECKOUT _getPayerDatails status: " + status); + if (status.equals("COMPLETED")) + recordOrder(req, res, jsonRespObj); + sendHtmlMsgResponse(req, res, json); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected PayPalReq getPayPalReq(HttpServletRequest req, HttpServletResponse res) { + return null; + } + + protected void updatePaypalOrderId(HttpServletRequest req, PayPalReq pReq) {} + + protected String extractTransactionId(JSONObject jo) { + String transactionId = ""; + if (jo == null) + return transactionId; + try { + if (!jo.has("purchase_units")) + return transactionId; + JSONArray purchaseUnits = jo.optJSONArray("purchase_units"); + if (purchaseUnits == null || purchaseUnits.isEmpty()) + return transactionId; + JSONObject firstPurchaseUnit = purchaseUnits.optJSONObject(0); + if (firstPurchaseUnit == null) + return transactionId; + JSONObject payments = firstPurchaseUnit.optJSONObject("payments"); + if (payments == null) + return transactionId; + JSONArray captures = payments.optJSONArray("captures"); + if (captures == null || captures.isEmpty()) + return transactionId; + JSONObject firstCapture = captures.optJSONObject(0); + if (firstCapture == null) + return transactionId; + transactionId = firstCapture.optString("id", ""); + } catch (Exception e) {} + return transactionId; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sella/GetSellaResponseSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sella/GetSellaResponseSvlt.java new file mode 100644 index 00000000..eb6f9df1 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sella/GetSellaResponseSvlt.java @@ -0,0 +1,47 @@ +package it.acxent.bank.servlet.sella; + +import it.acxent.bank.sella.GestPayCrypt; +import it.acxent.bank.sella.SellaResp; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class GetSellaResponseSvlt extends SellaSvlt { + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + getResponse(req, res); + } + + protected void getResponse(HttpServletRequest req, HttpServletResponse res) { + try { + GestPayCrypt objCrypt = new GestPayCrypt(); + String a = req.getParameter("a"); + String b = req.getParameter("b"); + a = a.trim(); + b = b.trim(); + GestPayCrypt objdeCrypt = new GestPayCrypt(); + objdeCrypt.setShopLogin(a); + objdeCrypt.setEncryptedString(b); + objdeCrypt.Decrypt(); + SellaResp sellaRes = new SellaResp(objdeCrypt); + if (sellaRes.getMyerrorcode().equals("0")) { + setJspPageRelative(getJspOkPage(req, res), req); + recordOrder(req, res, sellaRes); + } else { + setJspPageRelative(getJspKoPage(req, res), req); + } + req.setAttribute("sellaResp", sellaRes); + preparePaymenResPage(req, res, sellaRes); + callJsp(req, res); + } catch (Exception e) { + setJspPageRelative(getJspErrorPage(req, res), req); + String temp = "ERRORE!!GestPay Error! Risposta non valida: "; + sendMessage(req, temp); + handleDebug(temp, 2); + preparePaymenResPage(req, res, null); + callJsp(req, res); + } + } + + protected abstract void preparePaymenResPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, SellaResp paramSellaResp); + + protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, SellaResp paramSellaResp); +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sella/SellaSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sella/SellaSvlt.java new file mode 100644 index 00000000..b1fee78e --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sella/SellaSvlt.java @@ -0,0 +1,118 @@ +package it.acxent.bank.servlet.sella; + +import it.acxent.bank.sella.GestPayCrypt; +import it.acxent.bank.sella.SellaReq; +import it.acxent.servlet.AcServlet; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class SellaSvlt extends AcServlet { + protected static final String CMD_SEND_REQ = "send"; + + protected static final String CMD_GET_RES = "res"; + + protected static final String BEAN_SELLA_RES = "sellaResp"; + + protected final void callJsp(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspOkPage(req, res), req); + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void sendRequest(HttpServletRequest req, HttpServletResponse res) { + try { + GestPayCrypt objCrypt = new GestPayCrypt(); + SellaReq sellareq = new SellaReq(); + fillObject(req, sellareq); + objCrypt.setShopLogin(getCodiceEsercente(req)); + objCrypt.setCurrency(sellareq.getMycurrency()); + if (getParm("TEST").getNumeroLong() == 1L) { + objCrypt.setAmount("0.12"); + } else { + objCrypt.setAmount(sellareq.getMyamount()); + } + objCrypt.setShopTransactionID(sellareq.getMyshoptransactionID()); + if (getParm("SELLA_FULL").isTrue()) { + if (!sellareq.getMybuyername().isEmpty()) + objCrypt.setBuyerName(sellareq.getMybuyername()); + if (!sellareq.getMybuyeremail().isEmpty()) + objCrypt.setBuyerEmail(sellareq.getMybuyeremail()); + if (!sellareq.getMylanguage().isEmpty()) + objCrypt.setLanguage(sellareq.getMylanguage()); + if (!sellareq.getMycustominfo().isEmpty()) + objCrypt.setCustomInfo(sellareq.getMycustominfo()); + } + String tempX = "cod eserc.: " + objCrypt.getShopLogin() + " curr:" + objCrypt.getCurrency() + " amount:" + objCrypt.getAmount() + " shoptranid:" + + objCrypt.getShopTransactionID() + " buyername:" + objCrypt.getBuyerName() + " buyeremail:" + + objCrypt.getBuyerEmail() + " lang:" + sellareq.getMylanguage() + " custinfo:" + objCrypt.getCustomInfo(); + System.out.println("SELLA:SENDREQUEST ENCRYPT: " + tempX); + objCrypt.Encrypt(); + String b = ""; + String a = ""; + if (objCrypt.getErrorCode().equals("0")) { + String sellaSite; + b = objCrypt.getEncryptedString(); + a = objCrypt.getShopLogin(); + if (getParm("TEST").getNumeroLong() == 1L) { + sellaSite = "testecomm.sella.it"; + } else { + sellaSite = "ecomm.sella.it"; + } + String requestPage = "https://" + sellaSite + "/gestpay/pagam.asp?a=" + a + "&b=" + b; + res.sendRedirect(requestPage); + } else { + setJspPageRelative(getJspErrorPage(req, res), req); + String temp = "ERRORE!!GestPay Error! Code: " + objCrypt.getErrorCode() + ": " + objCrypt.getErrorDescription(); + sendMessage(req, temp); + handleDebug(temp, 2); + callJsp(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected String getCodiceEsercente(HttpServletRequest req) { + return getParm("COD_ESER_SELLA").getTesto(); + } + + protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("SELLA_OK").getTesto(); + if (temp.isEmpty()) + return getJspKoPage(req, res); + return temp; + } + + protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("SELLA_OK").getTesto(); + if (temp.isEmpty()) + return "payRes.jsp"; + return temp; + } + + protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("SELLA_OK").getTesto(); + if (temp.isEmpty()) + return "payRes.jsp"; + return temp; + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + try { + sendRequest(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sellaPCredit/SellaPCreditReqSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sellaPCredit/SellaPCreditReqSvlt.java new file mode 100644 index 00000000..b5356dc3 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sellaPCredit/SellaPCreditReqSvlt.java @@ -0,0 +1,45 @@ +package it.acxent.bank.servlet.sellaPCredit; + +import it.acxent.bank.sellaPCredit.SellaPCreditReq; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class SellaPCreditReqSvlt extends SellaPCreditlSvlt { + protected void sendRequest(HttpServletRequest req, HttpServletResponse res) { + try { + SellaPCreditReq conselReq = new SellaPCreditReq(getApFull()); + String conselSite = conselReq.getRequestServer(); + fillObject(req, conselReq); + if (!getRequestParameter(req, "tabfin").isEmpty()) + conselReq.setTabellaFinanziaria(getRequestParameter(req, "tabfin")); + caricaSellaPCreditRequest(req, conselReq); + if (getParm("SELLA_P_CREDIT_TEST").isTrue()) + caricaDemoRequest(req, conselReq); + req.setAttribute("sellaPCreditReq", conselReq); + RequestDispatcher rd = getServletContext().getRequestDispatcher("/sellaPCreditReq.jsp"); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + try { + sendRequest(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected abstract void caricaSellaPCreditRequest(HttpServletRequest paramHttpServletRequest, SellaPCreditReq paramSellaPCreditReq); + + private void caricaDemoRequest(HttpServletRequest req, SellaPCreditReq conselReq) { + conselReq.setCodiceFiscale("CLMCST80A01D969I"); + conselReq.setCognome("COLOMBO"); + conselReq.setNome("CRISTOFORO"); + conselReq.setData_nascita("01/01/1980"); + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sellaPCredit/SellaPCreditRespSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sellaPCredit/SellaPCreditRespSvlt.java new file mode 100644 index 00000000..741016f9 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sellaPCredit/SellaPCreditRespSvlt.java @@ -0,0 +1,39 @@ +package it.acxent.bank.servlet.sellaPCredit; + +import it.acxent.bank.sellaPCredit.SellaPCreditResp; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class SellaPCreditRespSvlt extends SellaPCreditlSvlt { + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + try { + manageResponse(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void manageResponse(HttpServletRequest req, HttpServletResponse res) { + try { + SellaPCreditResp conselResp = new SellaPCreditResp(getApFull()); + fillObject(req, conselResp); + if (conselResp.getStato().toLowerCase() + .equals("OK".toLowerCase()) || + + conselResp.getStato() + .toLowerCase() + .equals("WW".toLowerCase())) { + setJspPageRelative(getJspOkPage(req, res), req); + } else { + setJspPageRelative(getJspKoPage(req, res), req); + } + manageSellaPCreditResponse(req, conselResp); + req.setAttribute("sellaPCreditResp", conselResp); + callJsp(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected abstract void manageSellaPCreditResponse(HttpServletRequest paramHttpServletRequest, SellaPCreditResp paramSellaPCreditResp); +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sellaPCredit/SellaPCreditlSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sellaPCredit/SellaPCreditlSvlt.java new file mode 100644 index 00000000..e16066aa --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sellaPCredit/SellaPCreditlSvlt.java @@ -0,0 +1,68 @@ +package it.acxent.bank.servlet.sellaPCredit; + +import it.acxent.bank.sellaPCredit.ConselTabfin; +import it.acxent.bank.sellaPCredit.ConselTabfinCR; +import it.acxent.servlet.AcServlet; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class SellaPCreditlSvlt extends AcServlet { + protected static final String SELLA_P_CREDIT_REQ_JSP = "/sellaPCreditReq.jsp"; + + protected static final String BEAN_SELLA_P_CREDIT_REQ = "sellaPCreditReq"; + + protected static final String BEAN_SELLA_P_CREDIT_RESP = "sellaPCreditResp"; + + protected final void callJsp(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspOkPage(req, res), req); + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected String getCodiceConvenzione(HttpServletRequest req) { + return getParm("COD_CONVENZIONE_SELLA_P_CREDIT").getTesto(); + } + + protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("SELLA_P_CREDIT_ERROR_PAGE").getTesto(); + if (temp.isEmpty()) + return getJspKoPage(req, res); + return temp; + } + + protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("SELLA_P_CREDIT_OK_PAGE").getTesto(); + if (temp.isEmpty()) + return "conselRes.jsp"; + return temp; + } + + protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("SELLA_P_CREDIT_OK_PAGE").getTesto(); + if (temp.isEmpty()) + return "conselRes.jsp"; + return temp; + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + ConselTabfin ct = new ConselTabfin(getApFull()); + ConselTabfinCR CR = new ConselTabfinCR(); + fillObject(req, CR); + req.setAttribute("list", ct.findByCR(CR, 0, 0)); + req.setAttribute("CR", CR); + req.setAttribute("nf3", getNf3()); + setJspPageRelative("tabfin" + CR.getFlgTipo() + getAct(req) + ".jsp", req); + callJsp(req, res); + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sellaPCredit/package-info.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sellaPCredit/package-info.java new file mode 100644 index 00000000..a0eda482 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/sellaPCredit/package-info.java @@ -0,0 +1 @@ +package it.acxent.bank.servlet.sellaPCredit; diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/setefi/MonetaOnlineSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/setefi/MonetaOnlineSvlt.java new file mode 100644 index 00000000..1e53bc4e --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/setefi/MonetaOnlineSvlt.java @@ -0,0 +1,176 @@ +package it.acxent.bank.servlet.setefi; + +import it.acxent.bank.setefi.SetefiReq; +import it.acxent.bank.setefi.SetefiResp; +import it.acxent.db.ResParm; +import it.acxent.servlet.AcServlet; +import java.io.BufferedReader; +import java.io.DataOutputStream; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class MonetaOnlineSvlt extends AcServlet { + protected static final String CMD_GET_RES = "res"; + + protected static final String CMD_SEND_REQ = "send"; + + protected final void callJsp(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getResponsePage(req, res), req); + try { + RequestDispatcher rd = getServletContext() + .getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected String getResponsePage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("MONETAONLINE_RESPONSE_PAGE") + .getTesto(); + if (temp.isEmpty()) + return "http://www.miodominio.it/xxx_response-#-@.html"; + return temp; + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + String cmd = getCmd(req).toLowerCase(); + if (cmd.equals("send")) { + sendRequest(req, res); + } else if (getCmd(req).equals("risultato") || + getCmd(req).equals("result")) { + preparePaymentResultPage(req, res); + setJspPage(getResponseJsp(req, res), req); + callJsp(req, res); + } else { + getResponse(req, res); + } + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected void sendRequest(HttpServletRequest req, HttpServletResponse res) { + try { + boolean testMode = (getParm("TEST").getNumeroInt() == 1); + SetefiReq setefiReq = new SetefiReq(); + fillObject(req, setefiReq); + String theUrl = "https://test.monetaonline.it/monetaweb/hosted/init/http"; + if (testMode) { + theUrl = "https://test.monetaonline.it/monetaweb/hosted/init/http"; + setefiReq.setId(getParm("MONETAONLINE_ID").getTesto()); + setefiReq.setPassword(getParm("MONETAONLINE_PASSWORD") + .getTesto()); + } else { + setefiReq.setId("99999999"); + setefiReq.setPassword("99999999"); + } + setefiReq.setResponseurl(getResponseUrl(req, res)); + String rawData = setefiReq.getRawdata(); + if (!rawData.equals("")) { + String type = "application/x-www-form-urlencoded"; + String encodedData = rawData; + URL u = new URL("https://test.monetaonline.it/monetaweb/hosted/init/http"); + HttpURLConnection conn = (HttpURLConnection)u.openConnection(); + conn.setDoInput(true); + conn.setDoOutput(true); + conn.setUseCaches(false); + conn.setRequestMethod("POST"); + conn.setRequestProperty("Content-Type", type); + conn.setRequestProperty("Content-Length", + String.valueOf(encodedData.length())); + conn.connect(); + DataOutputStream os = new DataOutputStream( + conn.getOutputStream()); + os.writeBytes(encodedData); + os.flush(); + os.close(); + BufferedReader read = new BufferedReader(new InputStreamReader( + conn.getInputStream())); + String line = read.readLine(); + String html = ""; + while (line != null) { + html = html + html; + line = read.readLine(); + } + int idx2dot = html.indexOf(":"); + String paymentId = html.substring(0, html.indexOf(":")); + String url = html.substring(idx2dot + 1, html.length()); + String paymentUrl = url + "?paymentid=" + url; + System.out.println(paymentUrl); + ResParm rp = recordPaymentId(req, res, paymentId); + if (rp.getStatus()) { + res.sendRedirect(paymentUrl); + } else { + setJspPageRelative(getResponsePage(req, res), req); + sendMessage(req, rp.getErrMsg()); + getResponse(req, res); + callJsp(req, res); + } + } else { + setJspPageRelative(getResponsePage(req, res), req); + String temp = "ERRORE!!MonetaOnline Svlt! Impossibile creare url di richiesta!"; + sendMessage(req, temp); + getResponse(req, res); + handleDebug(temp, 2); + callJsp(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected String getResponseJsp(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("MONETAONLINE_RESPONSE_JSP").getTesto(); + if (temp.isEmpty()) + return "/payResMO.jsp"; + return temp; + } + + protected abstract ResParm recordPaymentId(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, String paramString); + + protected String getResponseUrl(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("MONETAONLINE_RESPONSE_URL").getTesto(); + if (temp.isEmpty()) + return "http://www.miodoninio.it/RicevutaMO.abl"; + return temp; + } + + protected abstract void preparePaymentResultPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse); + + protected abstract void checkPaymentId(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, SetefiResp paramSetefiResp); + + protected void getResponse(HttpServletRequest req, HttpServletResponse res) { + try { + req.setAttribute("responsecode", "000"); + req.setAttribute("result", "Accepted"); + req.setAttribute("trackid", "6"); + req.setAttribute("paymentid", "316061656072333389"); + req.setAttribute("tranid", "316061656072333389"); + SetefiResp setefiResp = new SetefiResp(); + fillObject(req, setefiResp); + checkPaymentId(req, res, setefiResp); + String theUrl = getResponsePage(req, res).replace("#", + setefiResp.getTrackid()); + theUrl = theUrl.replace("@", + String.valueOf(setefiResp.getPaymentid())); + System.out.println("redirect url :" + theUrl); + sendHtmlMsgResponse(req, res, "redirect=" + theUrl); + } catch (Exception e) { + setJspPageRelative(getResponsePage(req, res), req); + String temp = "ERRORE!!MONETAONLINE ! Risposta non valida: "; + sendMessage(req, temp); + handleDebug(temp, 2); + setJspPage(getResponsePage(req, res), req); + callJsp(req, res); + callJsp(req, res); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/stripe/_StripeResponseSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/stripe/_StripeResponseSvlt.java new file mode 100644 index 00000000..230242bd --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/stripe/_StripeResponseSvlt.java @@ -0,0 +1,49 @@ +package it.acxent.bank.servlet.stripe; + +import it.acxent.bank.stripe.StripeResp; +import it.acxent.db.ResParm; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class _StripeResponseSvlt extends _StripeSvlt { + private static final long serialVersionUID = 571692091994662023L; + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + getResponse(req, res); + } + + protected void getResponse(HttpServletRequest req, HttpServletResponse res) { + try { + StripeResp stripeRes = new StripeResp(); + fillObject(req, stripeRes); + if (stripeRes.getRedirect_status().equals("succeeded")) { + setJspPageRelative(getJspOkPage(req, res), req); + recordOrder(req, res, stripeRes); + } else { + setJspPageRelative(getJspKoPage(req, res), req); + } + req.setAttribute("stripeResp", stripeRes); + preparePaymenResPage(req, res, stripeRes); + callJsp(req, res); + } catch (Exception e) { + setJspPageRelative(getJspErrorPage(req, res), req); + String temp = "ERRORE!!Stripe Error! Risposta non valida: "; + sendMessage(req, temp); + handleDebug(temp, 2); + preparePaymenResPage(req, res, null); + callJsp(req, res); + } + } + + protected abstract void preparePaymenResPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, StripeResp paramStripeResp); + + protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, StripeResp paramStripeResp); + + protected long getAmount(HttpServletRequest req, long l_id) { + return 0L; + } + + protected ResParm saveClientSecret(HttpServletRequest req, long l_id, String l_clientSecret) { + return null; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/stripe/_StripeSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/stripe/_StripeSvlt.java new file mode 100644 index 00000000..4a040216 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/stripe/_StripeSvlt.java @@ -0,0 +1,101 @@ +package it.acxent.bank.servlet.stripe; + +import com.google.gson.Gson; +import com.stripe.Stripe; +import com.stripe.model.PaymentIntent; +import com.stripe.param.PaymentIntentCreateParams; +import it.acxent.bank.stripe.CreatePaymentResponse; +import it.acxent.db.ResParm; +import it.acxent.servlet.AcServlet; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.json.JSONObject; + +public abstract class _StripeSvlt extends AcServlet { + private static Gson gson = new Gson(); + + private static final long serialVersionUID = 7052017571211783636L; + + protected static final String BEAN_STRIPE_RESP = "stripeResp"; + + protected final void callJsp(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspOkPage(req, res), req); + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected String getStripeSecretApiKey(HttpServletRequest req) { + return getParm("STRIPE_PRIVATE_KEY").getTesto(); + } + + protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("SELLA_OK").getTesto(); + if (temp.isEmpty()) + return getJspKoPage(req, res); + return temp; + } + + protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("STRIPE_OK_PAGE").getTesto(); + if (temp.isEmpty()) + return "stripeRes.jsp"; + return temp; + } + + protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("SELLA_OK").getTesto(); + if (temp.isEmpty()) + return "stripeRes.jsp"; + return temp; + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + try { + _getPaymentIntent(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + public void _getPaymentIntent(HttpServletRequest req, HttpServletResponse res) { + try { + Stripe.apiKey = getStripeSecretApiKey(req); + String body = req.getReader().lines().reduce("", String::concat); + JSONObject jo = new JSONObject(body).getJSONObject("orderData"); + long l_id = jo.getLong("id"); + String l_descrizione = jo.getString("descOrdine"); + System.out.println("" + l_id + " " + l_id); + System.out.println("body: " + body); + Long amount = getAmount(req, l_id); + if (amount == 0L) { + sendHtmlMsgResponse(req, res, "Error: amount==0!!!"); + } else { + PaymentIntentCreateParams params = PaymentIntentCreateParams.builder().setAmount(amount).setCurrency("eur") + .setAutomaticPaymentMethods(PaymentIntentCreateParams.AutomaticPaymentMethods.builder().setEnabled(Boolean.valueOf(true)).build()) + .build(); + PaymentIntent paymentIntent = PaymentIntent.create(params); + CreatePaymentResponse paymentResponse = new CreatePaymentResponse(paymentIntent.getClientSecret()); + saveClientSecret(req, l_id, paymentIntent.getClientSecret()); + sendHtmlMsgResponse(req, res, gson.toJson(paymentResponse)); + } + } catch (Exception e) { + e.printStackTrace(); + sendHtmlMsgResponse(req, res, "Error: " + e.getMessage()); + } + } + + protected abstract ResParm saveClientSecret(HttpServletRequest paramHttpServletRequest, long paramLong, String paramString); + + protected abstract long getAmount(HttpServletRequest paramHttpServletRequest, long paramLong); +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/stripe/package-info.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/stripe/package-info.java new file mode 100644 index 00000000..65aae89d --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/stripe/package-info.java @@ -0,0 +1 @@ +package it.acxent.bank.servlet.stripe; diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/xpay/GetXpayResponseSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/xpay/GetXpayResponseSvlt.java new file mode 100644 index 00000000..0fc3825a --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/xpay/GetXpayResponseSvlt.java @@ -0,0 +1,55 @@ +package it.acxent.bank.servlet.xpay; + +import it.acxent.bank.xpay.XpayResp; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class GetXpayResponseSvlt extends XpaySvlt { + protected abstract void preparePaymenResPage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, XpayResp paramXpayResp); + + protected abstract void recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, XpayResp paramXpayResp); + + protected void getResponse(HttpServletRequest req, HttpServletResponse res) { + try { + XpayResp xpRes = new XpayResp(getApFull(req)); + fillObject(req, xpRes); + xpRes.setBRAND(getRequestParameter(req, "$BRAND")); + if (xpRes.isMacRitornoOk()) { + if (xpRes.getEsito() != null && xpRes.getEsito().equals("OK")) { + setJspPageRelative(getJspOkPage(req, res), req); + recordOrder(req, res, xpRes); + req.setAttribute("XPAYResp", xpRes); + preparePaymenResPage(req, res, xpRes); + } else { + preparePaymenResPage(req, res, xpRes); + resetId_documentoXpay(req, res, xpRes); + setJspPageRelative(getJspKoPage(req, res), req); + } + callJsp(req, res); + } else { + xpRes.setEsito("KO"); + preparePaymenResPage(req, res, xpRes); + resetId_documentoXpay(req, res, xpRes); + setJspPageRelative(getJspKoPage(req, res), req); + sendMessage(req, "ATTENZIONE!! Codice mac di controllo errato."); + req.setAttribute("XPAYResp", xpRes); + callJsp(req, res); + } + } catch (Exception e) { + setJspPageRelative(getJspErrorPage(req, res), req); + String temp = "ERRORE!!XPAY ! Risposta non valida: "; + sendMessage(req, temp); + handleDebug(temp, 2); + preparePaymenResPage(req, res, null); + callJsp(req, res); + } + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + getResponse(req, res); + } + + protected void prepareSendRequest(HttpServletRequest req, HttpServletResponse res) {} + + protected abstract void resetId_documentoXpay(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse, XpayResp paramXpayResp); +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/xpay/XpaySvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/xpay/XpaySvlt.java new file mode 100644 index 00000000..cc993d79 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/servlet/xpay/XpaySvlt.java @@ -0,0 +1,115 @@ +package it.acxent.bank.servlet.xpay; + +import it.acxent.bank.infogroup.ShopnetResp; +import it.acxent.bank.xpay.XpayReq; +import it.acxent.servlet.AcServlet; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class XpaySvlt extends AcServlet { + protected static final String BEAN_XPAY_RES = "XPAYResp"; + + protected static final String CMD_GET_RES = "res"; + + protected static final String CMD_SEND_REQ = "send"; + + protected final void callJsp(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspOkPage(req, res), req); + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void getResponse(HttpServletRequest req, HttpServletResponse res) {} + + protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("XPAY_PAY_OK").getTesto(); + if (temp.isEmpty()) + return getJspKoPage(req, res); + return temp; + } + + protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("XPAY_PAY_OK").getTesto(); + if (temp.isEmpty()) + return "payRes.jsp"; + return temp; + } + + protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("XPAY_PAY_OK").getTesto(); + if (temp.isEmpty()) + return "payRes.jsp"; + return temp; + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + String cmd = getCmd(req).toLowerCase(); + try { + if (cmd.equals("send")) { + sendRequest(req, res); + } else if (cmd.equals("res")) { + getResponse(req, res); + } else { + sendRequest(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected void payKoUpdateOrder(HttpServletRequest req, HttpServletResponse res, ShopnetResp snRes) {} + + protected void sendRequest(HttpServletRequest req, HttpServletResponse res) { + try { + String theUrl; + prepareSendRequest(req, res); + XpayReq xpayReq = new XpayReq(getApFull(req)); + fillObject(req, xpayReq); + if (getParm("TEST").isTrue()) { + theUrl = xpayReq.getTestRequestUrl(); + } else { + theUrl = xpayReq.getRequestUrl(); + } + System.out.println(theUrl); + if (!theUrl.equals("")) { + res.sendRedirect(theUrl); + } else { + setJspPageRelative(getJspErrorPage(req, res), req); + String temp = "ERRORE!!XPAY Svlt! Impossibile creare url di richiesta!"; + sendMessage(req, temp); + getResponse(req, res); + handleDebug(temp, 2); + callJsp(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected String getUrlResponse(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("XPAY_URL_RESPONSE").getTesto(); + if (temp.isEmpty()) + return "RicevutaKC.abl"; + return temp; + } + + protected String getUrlResponseNull(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("XPAY_URL_RESPONSE_NULL").getTesto(); + if (temp.isEmpty()) + return "RicevutaKC.abl"; + return temp; + } + + protected abstract void prepareSendRequest(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse); +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/setefi/SetefiReq.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/setefi/SetefiReq.java new file mode 100644 index 00000000..95f20bf5 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/setefi/SetefiReq.java @@ -0,0 +1,260 @@ +package it.acxent.bank.setefi; + +import it.acxent.bank._BankAdapter; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; + +public class SetefiReq extends _BankAdapter { + public static final String LANG_CODE_IT = "ITA"; + + public static final String LANG_CODE_EN = "USA"; + + public static final String LANG_CODE_ES = "SPA"; + + public static final String LANG_CODE_FR = "FRA"; + + public static final String LANG_CODE_DE = "DEU"; + + public static final String DIV_CODE_EURO = "978"; + + public static final String P_MONETAONLINE_ID = "MONETAONLINE_ID"; + + public static final String DEFAULT_RESPONSE_URL = "MONETAONLINE_ID"; + + public static final String DEFAULT_RESPONSE_PAGE = "payResMO.jsp"; + + public static final String DIV_CODE_DOLLARL_HK = "103"; + + public static final String TEST_URL = "https://test.monetaonline.it/monetaweb/hosted/init/http"; + + public static final String REQ_URL = "https://test.monetaonline.it/monetaweb/hosted/init/http"; + + private String id; + + private String trackid; + + private String titolareCarta; + + private String email; + + private String lang; + + private String responseurl; + + private double amt; + + private String password; + + private String descPagamento; + + private String divisa; + + public static final String BEAN_MO_RES = "MOResp"; + + public static final String P_MONETAONLINE_RESPONSE_JSP = "MONETAONLINE_RESPONSE_JSP"; + + public static final String TEST_PASSWORD = "99999999"; + + public static final String TEST_ID = "99999999"; + + public static final String P_MONETAONLINE_RESPONSE_URL = "MONETAONLINE_RESPONSE_URL"; + + public static final String P_MONETAONLINE_PASSWORD = "MONETAONLINE_PASSWORD"; + + public static final String P_MONETAONLINE_RESPONSE_PAGE = "MONETAONLINE_RESPONSE_PAGE"; + + public static final String DIV_CODE_DOLLARI = "1"; + + public double getAmt() { + return this.amt; + } + + public void setAmt(double myamount) { + this.amt = myamount; + } + + public String getEmail() { + return (this.email == null) ? "" : this.email; + } + + public void setEmail(String mybuyeremail) { + this.email = mybuyeremail; + } + + public String getTitolareCarta() { + return (this.titolareCarta == null) ? "" : this.titolareCarta; + } + + public void setTitolareCarta(String mybuyername) { + this.titolareCarta = mybuyername; + } + + public String getCurrencycode() { + if (getDivisa().toLowerCase().equals("eu")) + return "978"; + return "978"; + } + + public String getDescPagamento() { + return (this.descPagamento == null) ? "" : this.descPagamento; + } + + public void setDescPagamento(String mycustominfo) { + this.descPagamento = mycustominfo; + } + + private String getMylanguageCode() { + if (getLang().toLowerCase().equals("it")) + return "ITA"; + if (getLang().toLowerCase().equals("en")) + return "USA"; + if (getLang().toLowerCase().equals("es\t")) + return "SPA"; + if (getLang().toLowerCase().equals("fr")) + return "FRA"; + if (getLang().toLowerCase().equals("de")) + return "DEU"; + return ""; + } + + public String getTrackid() { + return (this.trackid == null) ? "" : this.trackid; + } + + public void setTrackid(String myshoptransactionID) { + this.trackid = myshoptransactionID; + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang; + } + + public void setLang(String lang) { + this.lang = lang; + } + + public static void initApplicationParms(ApplParmFull ap) { + boolean debug = true; + if (ap != null) { + DBAdapter.logDebug(debug, "Setefi initParms: start"); + String l_tipoParm = "MONETAONLINE"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + Parm bean = new Parm(ap); + bean.findByCodice("MONETAONLINE_ID"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MONETAONLINE_ID"); + bean.setDescrizione("MONETAONLINE_ID"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("99999999"); + bean.setNota("ID MONETAONLINE
CODICE DI PROVA: 99999999"); + bean.save(); + bean.findByCodice("MONETAONLINE_PASSWORD"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MONETAONLINE_PASSWORD"); + bean.setDescrizione("MONETAONLINE_PASSWORD"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("99999999"); + bean.setNota("PASSWORD MONETAONLINE
PASSWORD DI PROVA: 99999999"); + bean.save(); + bean.findByCodice("MONETAONLINE_RESPONSE_URL"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MONETAONLINE_RESPONSE_URL"); + bean.setDescrizione("MONETAONLINE_RESPONSE_URL"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("http://www.nomedominio.it/PayMO.abl"); + bean.setNota("QUALCOSA DEL TIPO http://www.nomedominio.it/PayMO.abl
E' l'url chiamata da setefi. Su moneta Online è sempre la stessa servlet!!"); + bean.save(); + bean.findByCodice("MONETAONLINE_RESPONSE_JSP"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MONETAONLINE_RESPONSE_JSP"); + bean.setDescrizione("MONETAONLINE_RESPONSE_JSP"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("/payResMO.jsp"); + bean.setNota("QUALCOSA DEL TIPO
/payResMO.jsp.
E' la pagina jsp dove visualizziamo il risultato."); + bean.save(); + bean.findByCodice("MONETAONLINE_RESPONSE_PAGE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MONETAONLINE_RESPONSE_PAGE"); + bean.setDescrizione("MONETAONLINE_RESPONSE_PAGE"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("http://www.nomedominio.it/transazione_result-#-@.html"); + bean.setNota("QUALCOSA DEL TIPO
http://www.nomedominio.it/xxx_result-#-@.html.
si userà una regola di rewrite rule dove # è il trackid mentre @ +è il paymentid
Esempio rewrite rule:
result,PayMO.abl,result,,@id_astaUtente@paymentid"); + bean.save(); + DBAdapter.logDebug(debug, "Setefi initParms: stop"); + } + } + + public String getId() { + return (this.id == null) ? "" : this.id.trim(); + } + + public void setId(String id) { + this.id = id; + } + + public String getPassword() { + return (this.password == null) ? "" : this.password.trim(); + } + + public void setPassword(String password) { + this.password = password; + } + + public String getResponseurl() { + return (this.responseurl == null) ? "" : this.responseurl.trim(); + } + + public void setResponseurl(String responseurl) { + this.responseurl = responseurl; + } + + public String getRawdata() { + StringBuffer theUrl = new StringBuffer(); + theUrl.append("id="); + theUrl.append(getId()); + theUrl.append("&password="); + theUrl.append(getPassword()); + theUrl.append("&action=4"); + theUrl.append("&amt="); + theUrl.append(getAmt()); + theUrl.append("¤cycode="); + theUrl.append(getCurrencycode()); + theUrl.append("&langid="); + theUrl.append(getMylanguageCode()); + theUrl.append("&responseurl="); + theUrl.append(getResponseurl()); + theUrl.append("&errorurl="); + theUrl.append(getResponseurl()); + theUrl.append("&trackid="); + theUrl.append(getTrackid()); + if (!getDescPagamento().trim().isEmpty()) { + theUrl.append("&udf1="); + theUrl.append(getDescPagamento()); + } + if (!getTitolareCarta().trim().isEmpty()) { + theUrl.append("&udf2="); + theUrl.append(getTitolareCarta() + ";" + getTitolareCarta()); + } + return theUrl.toString(); + } + + public String getDivisa() { + return (this.divisa == null) ? "" : this.divisa.trim(); + } + + public void setDivisa(String divisa) { + this.divisa = divisa; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/setefi/SetefiResp.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/setefi/SetefiResp.java new file mode 100644 index 00000000..2e32a4b2 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/setefi/SetefiResp.java @@ -0,0 +1,115 @@ +package it.acxent.bank.setefi; + +import it.acxent.bank._BankAdapter; + +public class SetefiResp extends _BankAdapter { + private String trackid; + + private String paymentid; + + private String udf3; + + private String udf1; + + private String result; + + private String auth; + + private long id_ordine; + + private String responsecode; + + private String tranid; + + private String udf4; + + private String udf2; + + public String getResponsecode() { + return (this.responsecode == null) ? "" : this.responsecode; + } + + public void setResponsecode(String myalertcode) { + this.responsecode = myalertcode; + } + + public String getTranid() { + return (this.tranid == null) ? "" : this.tranid; + } + + public void setTranid(String myalertdescription) { + this.tranid = myalertdescription; + } + + public String getAuth() { + return (this.auth == null) ? "" : this.auth; + } + + public void setAuth(String myauthcode) { + this.auth = myauthcode; + } + + public String getUdf2() { + return (this.udf2 == null) ? "" : this.udf2; + } + + public void setUdf2(String mybuyeremail) { + this.udf2 = mybuyeremail; + } + + public String getUdf3() { + return (this.udf3 == null) ? "" : this.udf3; + } + + public void setUdf3(String mybuyername) { + this.udf3 = mybuyername; + } + + public String getTrackid() { + return (this.trackid == null) ? "" : this.trackid; + } + + public void setTrackid(String myshoplogin) { + this.trackid = myshoplogin; + } + + public String getPaymentid() { + return this.paymentid; + } + + public void setPaymentid(String myshoptrxID) { + this.paymentid = myshoptrxID; + } + + public String getResult() { + return (this.result == null) ? "" : this.result; + } + + public void setResult(String mytrxresult) { + this.result = mytrxresult; + } + + public long getId_ordine() { + return this.id_ordine; + } + + public void setId_ordine(long id_ordine) { + this.id_ordine = id_ordine; + } + + public String getUdf1() { + return (this.udf1 == null) ? "" : this.udf1; + } + + public void setUdf1(String udf1) { + this.udf1 = udf1; + } + + public String getUdf4() { + return (this.udf4 == null) ? "" : this.udf4; + } + + public void setUdf4(String udf4) { + this.udf4 = udf4; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/stripe/CreatePayment.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/stripe/CreatePayment.java new file mode 100644 index 00000000..094442fa --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/stripe/CreatePayment.java @@ -0,0 +1,12 @@ +package it.acxent.bank.stripe; + +import com.google.gson.annotations.SerializedName; + +public class CreatePayment { + @SerializedName("items") + Object[] items; + + public Object[] getItems() { + return this.items; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/stripe/CreatePaymentResponse.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/stripe/CreatePaymentResponse.java new file mode 100644 index 00000000..fc5b6f96 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/stripe/CreatePaymentResponse.java @@ -0,0 +1,9 @@ +package it.acxent.bank.stripe; + +public class CreatePaymentResponse { + private String clientSecret; + + public CreatePaymentResponse(String clientSecret) { + this.clientSecret = clientSecret; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/stripe/StripeResp.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/stripe/StripeResp.java new file mode 100644 index 00000000..15a517a1 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/stripe/StripeResp.java @@ -0,0 +1,106 @@ +package it.acxent.bank.stripe; + +import it.acxent.bank._BankAdapter; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; + +public class StripeResp extends _BankAdapter { + public static final String STATUS_OK = "succeeded"; + + private static final long serialVersionUID = -1758842932626231725L; + + private String payment_intent_client_secret; + + private String redirect_status; + + public static final String P_STRIPE_PUBLIC_KEY = "STRIPE_PUBLIC_KEY"; + + public static final String P_STRIPE_PRIVATE_KEY = "STRIPE_PRIVATE_KEY"; + + public static final String P_STRIPE_OK_PAGE = "STRIPE_OK_PAGE"; + + public static final String P_STRIPE_ERROR_PAGE = "STRIPE_ERROR_PAGE"; + + public static final String P_STRIPE_RETURN_URL = "STRIPE_RETURN_URL"; + + public static final String DEFAULT_OK_KO_PAGE = "documento.jsp"; + + public String getPayment_intent_client_secret() { + return (this.payment_intent_client_secret == null) ? "" : this.payment_intent_client_secret; + } + + public void setPayment_intent_client_secret(String payment_intent_client_secret) { + this.payment_intent_client_secret = payment_intent_client_secret; + } + + public String getRedirect_status() { + return (this.redirect_status == null) ? "" : this.redirect_status; + } + + public void setRedirect_status(String redirect_status) { + this.redirect_status = redirect_status; + } + + public static void initApplicationParms(ApplParmFull ap) { + boolean debug = false; + if (ap != null) { + DBAdapter.logDebug(debug, "STRIPE initParms: start"); + String l_tipoParm = "STRIPE"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + Parm bean = new Parm(ap); + bean.findByCodice("STRIPE_PRIVATE_KEY"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("STRIPE_PRIVATE_KEY"); + bean.setDescrizione("STRIPE_PRIVATE_KEY"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("sk_test_51MHqBEFFhtsn3P5AuY6fj2eSYzDUabXnSINJXzvztxBsZUCg8KbZXrkhKBgYpJV4zxcxSFrrD228AgA5bHj6kTAT00cwVDtxCH"); + bean.setNota("SECRET KEY STRIPE"); + bean.save(); + bean.findByCodice("STRIPE_PUBLIC_KEY"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("STRIPE_PUBLIC_KEY"); + bean.setDescrizione("STRIPE_PUBLIC_KEY"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("pk_test_51MHqBEFFhtsn3P5AVGKxfuDIKk9Na3FNvcf5WfuMEvcWDt794JTsDfJilOs8r3JGmhknmfS97f77we0vqB8w99fB004zcxkFdk"); + bean.setNota("PUBLIC KEY STRIPE"); + bean.save(); + bean.findByCodice("STRIPE_RETURN_URL"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("STRIPE_RETURN_URL"); + bean.setDescrizione("STRIPE_RETURN_URL"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("http://localhost/cc/StripeResponse.abl"); + bean.setNota("URL DI RITORNO. DI SOLITO StripeResponse.abl"); + bean.save(); + bean.findByCodice("STRIPE_ERROR_PAGE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("STRIPE_ERROR_PAGE"); + bean.setDescrizione("STRIPE_ERROR_PAGE"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("documento.jsp"); + bean.setNota("STRIPE_OK_PAGE"); + bean.save(); + bean.findByCodice("STRIPE_OK_PAGE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("STRIPE_OK_PAGE"); + bean.setDescrizione("STRIPE_OK_PAGE"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("documento.jsp"); + bean.setNota("STRIPE_OK_PAGE"); + bean.save(); + DBAdapter.logDebug(debug, "STRIPE initParms: start"); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/stripe/package-info.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/stripe/package-info.java new file mode 100644 index 00000000..f85d42e1 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/stripe/package-info.java @@ -0,0 +1 @@ +package it.acxent.bank.stripe; diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/taglib/SellaObjTag.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/taglib/SellaObjTag.java new file mode 100644 index 00000000..504dd2c1 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/taglib/SellaObjTag.java @@ -0,0 +1,100 @@ +package it.acxent.bank.taglib; + +import it.acxent.common.Parm; +import it.acxent.taglib.AbstractDbTag; +import java.io.IOException; +import java.io.Writer; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; + +public class SellaObjTag extends AbstractDbTag { + private String value; + + private boolean condition = true; + + protected int currentNestedValue; + + private String codice; + + private Parm parm; + + protected static final String _WC = "_WC"; + + protected static final String _NESTVAL = "_WCNESTVAL"; + + public int doAfterBody() throws JspException { + try { + this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter()); + setNestedValue(); + return 0; + } catch (IOException ex) { + throw new JspTagException(ex.toString()); + } + } + + public int doStartTag() { + this.currentNestedValue = getNestedValue(); + this.pageContext.setAttribute("_WC" + this.currentNestedValue, new Boolean( + getWherecondition())); + if (getWherecondition()) + return 2; + return 0; + } + + protected int getNestedValue() { + if (this.pageContext.getAttribute("_WCNESTVAL") == null) { + this.pageContext.setAttribute("_WCNESTVAL", "1"); + return 1; + } + int nv = Integer.parseInt((String) + this.pageContext.getAttribute("_WCNESTVAL")); + nv++; + this.pageContext.setAttribute("_WCNESTVAL", String.valueOf(nv)); + return nv; + } + + public boolean getWherecondition() { + getParm().findByCodice(getCodice()); + if (this.parm.getDBState() == 1) { + if ((getParm().getValore().equals(getValue()) && getCondition()) || ( + !getParm().getValore().equals(getValue()) && !getCondition())) + return true; + return false; + } + return false; + } + + protected void setNestedValue() { + this.pageContext.setAttribute("_WCNESTVAL", String.valueOf(this.currentNestedValue)); + } + + public String getCodice() { + return this.codice; + } + + public Parm getParm() { + if (this.parm == null) + this.parm = new Parm(getApFull()); + return this.parm; + } + + public void setCodice(String code) { + this.codice = code; + } + + public String getValue() { + return (this.value == null) ? "" : this.value; + } + + public void setValue(String value) { + this.value = value; + } + + public boolean getCondition() { + return this.condition; + } + + public void setCondition(boolean condition) { + this.condition = condition; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/xpay/XpayReq.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/xpay/XpayReq.java new file mode 100644 index 00000000..32e363bf --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/xpay/XpayReq.java @@ -0,0 +1,340 @@ +package it.acxent.bank.xpay; + +import it.acxent.bank._BankAdapter; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.reg.EcDc; +import java.net.URLEncoder; + +public class XpayReq extends _BankAdapter { + public static final String LANG_CODE_IT = "ITA"; + + public static final String LANG_CODE_EN = "ENG"; + + public static final String LANG_CODE_ES = "SPA"; + + public static final String LANG_CODE_FR = "FRA"; + + public static final String LANG_CODE_DE = "GER"; + + public static final String LANG_CODE_ITA_ENG = "ITA-ENG"; + + public static final String LANG_CODE_JPN = "JPN"; + + public static final String DIV_CODE_LIRA = "18"; + + public static final String DIV_CODE_EURO = "242"; + + public static final String DIV_CODE_STERLINE = "2"; + + public static final String DIV_CODE_YEN = "71"; + + public static final String DIV_CODE_DOLLARL_HK = "103"; + + public static final String DIV_CODE_REAL = "234"; + + private String divisa; + + private String codTrans; + + private String mail; + + private String importo; + + private String languageId; + + public static final String TEST_ALIAS = "payment_3444153"; + + public static final String P_XPAY_MAC_KEY = "XPAY_MAC_KEY"; + + public static final String P_XPAY_URL_RESPONSE = "XPAY_URL_RESPONSE"; + + public static final String P_XPAY_ALIAS = "XPAY_ALIAS"; + + public static final String P_XPAY_PAYMENT_OK_PAGE = "XPAY_PAY_OK"; + + public static final String P_XPAY_PAYMENT_ERROR_PAGE = "XPAY_PAY_KO"; + + public static final String P_XPAY_URL_RESPONSE_NULL = "XPAY_URL_RESPONSE_NULL"; + + public static final String TEST_MAC = "TLGHTOWIZXQPTIZRALWKG"; + + public static final String REQ_URL = "https://ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet"; + + public static final String TEST_REQ_URL = "https://coll-ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet"; + + public static final String DIV_CODE_DOLLARI = "1"; + + public XpayReq() {} + + public XpayReq(ApplParmFull apFull) { + setAp(apFull); + } + + public String getCodTrans() { + return (this.codTrans == null) ? "" : this.codTrans; + } + + public void setCodTrans(String myamount) { + this.codTrans = myamount; + } + + public String getImporto() { + return (this.importo == null) ? "" : this.importo; + } + + public void setImporto(String mybuyeremail) { + this.importo = mybuyeremail; + } + + public String getMail() { + return (this.mail == null) ? "" : this.mail; + } + + public void setMail(String mybuyername) { + this.mail = mybuyername; + } + + public String getDivisa() { + return (this.divisa == null) ? "" : this.divisa; + } + + public void setDivisa(String mycurrency) { + this.divisa = mycurrency; + } + + public String getAlias() { + return getParm("XPAY_ALIAS").getTesto(); + } + + private String getMylanguageCode() { + if (getLanguageId().toLowerCase().equals("it")) + return "ITA"; + if (getLanguageId().toLowerCase().equals("en")) + return "ENG"; + if (getLanguageId().toLowerCase().equals("es\t")) + return "SPA"; + if (getLanguageId().toLowerCase().equals("fr")) + return "FRA"; + if (getLanguageId().toLowerCase().equals("de")) + return "GER"; + return ""; + } + + public String getMacEsempio() { + String temp = "codTrans=" + getCodTrans() + "divisa=" + getDivisa() + "importo=1" + getKey(); + System.out.println("stringa mac: " + temp); + String res = ""; + try { + res = EcDc.cryptSHA1Plain(temp); + System.out.println(res); + } catch (Exception e) { + e.printStackTrace(); + } + return res; + } + + public String getMac() { + String temp = "codTrans=" + getCodTrans() + "divisa=" + getDivisa() + "importo=" + getImportoUrl() + getKey(); + String res = ""; + try { + res = EcDc.cryptSHA1Plain(temp); + } catch (Exception e) { + e.printStackTrace(); + } + return res; + } + + public String getLanguageId() { + return (this.languageId == null) ? "" : this.languageId; + } + + public void setLanguageId(String lang) { + this.languageId = lang; + } + + public String getFullRequestUrl() { + StringBuffer theUrl = new StringBuffer("https://ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet"); + theUrl.append("alias="); + theUrl.append(getAlias()); + theUrl.append("&importo="); + theUrl.append(getImporto()); + theUrl.append("&divisa="); + theUrl.append(getDivisa()); + theUrl.append("&codTrans="); + theUrl.append(getCodTrans()); + theUrl.append("&mail="); + theUrl.append(getMail()); + theUrl.append("&mac="); + try { + theUrl.append(URLEncoder.encode(getMac(), "UTF-8")); + } catch (Exception e) { + e.printStackTrace(); + } + theUrl.append("&languageId="); + theUrl.append(getLanguageId()); + theUrl.append("&url="); + theUrl.append(getUrl()); + if (!getUrl_back().isEmpty()) { + theUrl.append("&url_back="); + theUrl.append(getUrl_back()); + } + return theUrl.toString(); + } + + public String getRequestUrl() { + StringBuffer theUrl = new StringBuffer("https://ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet"); + theUrl.append("?alias="); + theUrl.append(getAlias()); + theUrl.append("&importo="); + theUrl.append(getImportoUrl()); + theUrl.append("&divisa="); + theUrl.append(getDivisa()); + theUrl.append("&codTrans="); + theUrl.append(getCodTrans()); + theUrl.append("&mail="); + theUrl.append(getMail()); + theUrl.append("&mac="); + try { + theUrl.append(URLEncoder.encode(getMac(), "UTF-8")); + } catch (Exception e) { + e.printStackTrace(); + } + theUrl.append("&languageId="); + theUrl.append(getLanguageId()); + theUrl.append("&url="); + theUrl.append(getUrl()); + if (!getUrl_back().isEmpty()) { + theUrl.append("&url_back="); + theUrl.append(getUrl_back()); + } + return theUrl.toString(); + } + + public String getKey() { + return getParm("XPAY_MAC_KEY").getTesto(); + } + + public String getImportoUrl() { + if (this.importo == null) + return "0000"; + String temp = this.importo; + if (temp.indexOf('.') < 0) { + temp = temp + "00"; + } else if (temp.length() - temp.indexOf('.') < 3) { + temp = temp + "0"; + } + return temp.replace(".", ""); + } + + public String getUrl() { + return getParm("XPAY_URL_RESPONSE").getTesto(); + } + + public String getUrl_back() { + return getParm("XPAY_URL_RESPONSE_NULL").getTesto(); + } + + public String getTestRequestUrl() { + StringBuffer theUrl = new StringBuffer("https://coll-ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet"); + theUrl.append("?alias="); + theUrl.append("payment_3444153"); + theUrl.append("&importo=1"); + theUrl.append("&divisa="); + theUrl.append(getDivisa()); + theUrl.append("&codTrans="); + theUrl.append(getCodTrans()); + theUrl.append("&mail="); + theUrl.append(getMail()); + theUrl.append("&mac="); + try { + theUrl.append(URLEncoder.encode(getMacEsempio(), "UTF-8")); + } catch (Exception e) { + e.printStackTrace(); + } + theUrl.append("&languageId="); + theUrl.append(getLanguageId()); + theUrl.append("&url="); + theUrl.append(getUrl()); + if (!getUrl_back().isEmpty()) { + theUrl.append("&url_back="); + theUrl.append(getUrl_back()); + } + return theUrl.toString(); + } + + public static void initApplicationParms(ApplParmFull ap) { + boolean debug = false; + if (ap != null) { + DBAdapter.logDebug(debug, "Xpay initParms: start"); + String l_tipoParm = "XPAY"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + Parm bean = new Parm(ap); + bean.findByCodice("XPAY_PAY_KO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("XPAY_PAY_KO"); + bean.setDescrizione("XPAY_PAY_KO"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payRes.jsp"); + bean.setNota("XPAY_PAY_KO"); + bean.save(); + bean.findByCodice("XPAY_PAY_OK"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("XPAY_PAY_OK"); + bean.setDescrizione("XPAY_PAY_OK"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payRes.jsp"); + bean.setNota("XPAY_PAY_OK"); + bean.save(); + bean.findByCodice("XPAY_MAC_KEY"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("XPAY_MAC_KEY"); + bean.setDescrizione("XPAY_MAC_KEY"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("TLGHTOWIZXQPTIZRALWKG"); + if (bean.getNota().isEmpty()) + bean.setNota("XPAY_MAC_KEY. mac di esempio: TLGHTOWIZXQPTIZRALWKG"); + bean.save(); + bean.findByCodice("XPAY_ALIAS"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("XPAY_ALIAS"); + bean.setDescrizione("XPAY_ALIAS"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("payment_3444153"); + if (bean.getNota().isEmpty()) + bean.setNota("XPAY_MAC_KEY. ALIAS DI TEST: payment_3444153"); + bean.save(); + bean.findByCodice("XPAY_URL_RESPONSE_NULL"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("XPAY_URL_RESPONSE_NULL"); + bean.setDescrizione("XPAY_URL_RESPONSE_NULL"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("http://localhost/td/RicevutaXPAY.abl"); + bean.setNota("XPAY_PAY_OK"); + bean.save(); + bean.findByCodice("XPAY_URL_RESPONSE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("XPAY_URL_RESPONSE"); + bean.setDescrizione("XPAY_URL_RESPONSE"); + bean.setFlgTipo(0L); + if (bean.getTesto().equals("")) + bean.setTesto("http://localhost/td/RicevutaXPAY.abl"); + bean.setNota("XPAY_URL_RESPONSE"); + bean.save(); + DBAdapter.logDebug(debug, "Xpay initParms: false"); + } + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/xpay/XpayResp.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/xpay/XpayResp.java new file mode 100644 index 00000000..3e3300ee --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/bank/xpay/XpayResp.java @@ -0,0 +1,186 @@ +package it.acxent.bank.xpay; + +import it.acxent.bank._BankAdapter; +import it.acxent.db.ApplParmFull; +import it.acxent.reg.EcDc; + +public class XpayResp extends _BankAdapter { + private long id_ordine; + + private String importo; + + private String data; + + private String divisa; + + private String session_id; + + private String codTrans; + + private String orario; + + private String esito; + + private String codAut; + + private String BRAND; + + private String nome; + + private String cognome; + + private String email; + + private String mac; + + private String messaggio; + + public static final String ESITO_OK = "OK"; + + public static final String ESITO_KO = "KO"; + + public XpayResp() {} + + public XpayResp(ApplParmFull apFull) { + setAp(apFull); + } + + public long getId_ordine() { + return this.id_ordine; + } + + public void setId_ordine(long id_ordine) { + this.id_ordine = id_ordine; + } + + public String getImporto() { + return (this.importo == null) ? "" : this.importo; + } + + public void setImporto(String importo) { + this.importo = importo; + } + + public String getData() { + return (this.data == null) ? "" : this.data; + } + + public void setData(String data) { + this.data = data; + } + + public String getDivisa() { + return (this.divisa == null) ? "" : this.divisa; + } + + public void setDivisa(String divisa) { + this.divisa = divisa; + } + + public String getSession_id() { + return (this.session_id == null) ? "" : this.session_id; + } + + public void setSession_id(String session_id) { + this.session_id = session_id; + } + + public String getCodTrans() { + return (this.codTrans == null) ? "" : this.codTrans; + } + + public void setCodTrans(String codTrans) { + this.codTrans = codTrans; + } + + public String getOrario() { + return (this.orario == null) ? "" : this.orario; + } + + public void setOrario(String orario) { + this.orario = orario; + } + + public String getEsito() { + return (this.esito == null) ? "" : this.esito; + } + + public void setEsito(String esito) { + this.esito = esito; + } + + public String getCodAut() { + return (this.codAut == null) ? "" : this.codAut; + } + + public void setCodAut(String codAut) { + this.codAut = codAut; + } + + public String getBRAND() { + return (this.BRAND == null) ? "" : this.BRAND; + } + + public void setBRAND(String brand) { + this.BRAND = brand; + } + + public String getNome() { + return (this.nome == null) ? "" : this.nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public String getCognome() { + return (this.cognome == null) ? "" : this.cognome; + } + + public void setCognome(String cognome) { + this.cognome = cognome; + } + + public String getEmail() { + return (this.email == null) ? "" : this.email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getMac() { + return (this.mac == null) ? "" : this.mac; + } + + public void setMac(String mac) { + this.mac = mac; + } + + public String getMessaggio() { + return (this.messaggio == null) ? "" : this.messaggio.trim(); + } + + public void setMessaggio(String messaggio) { + this.messaggio = messaggio; + } + + public boolean isMacRitornoOk() { + String temp = "codTrans=" + getCodTrans() + "esito=" + getEsito() + "importo=" + getImporto() + "divisa=" + getDivisa() + "data=" + + getData() + "orario=" + getOrario() + "codAut=" + getCodAut() + getKey(); + String res = ""; + try { + res = EcDc.cryptSHA1Plain(temp); + if (res.equals(getMac())) + return true; + return false; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + public String getKey() { + return getParm("XPAY_MAC_KEY").getTesto(); + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/gtbill/GTBillReq.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/gtbill/GTBillReq.java new file mode 100644 index 00000000..776a5c53 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/gtbill/GTBillReq.java @@ -0,0 +1,134 @@ +package it.acxent.gtbill; + +import it.acxent.bank._BankAdapter; +import it.acxent.common.Parm; +import it.acxent.db.ApplParmFull; + +public class GTBillReq extends _BankAdapter { + public static final String P_GTBILL_MERCHANT_ID = "GTBILL_MERCHANT_ID"; + + public static final String P_GTBILL_SITE_ID = "GTBILL_SITE_ID"; + + public static final String P_GTBILL_RETURN_URL = "GTBILL_RETURN_URL"; + + public static final String DIV_CODE_EURO = "EUR"; + + public static final String DIV_CODE_DOLLARI = "USD"; + + public static final String DIV_CODE_STERLINE = "GBP"; + + public static final String DIV_CODE_CAN = "CAD"; + + public static final String DIV_CODE_REAL = "234"; + + private String mycurrencyid; + + private String myamounttotal; + + private String myamountshipping; + + private String myitemname; + + private String myitemquantity; + + private String myitemamount; + + private String myitemdesc; + + public static final String FORM_URL_POST = "https://sale.GTBill.com/quickpay.aspx"; + + public static final String PROG_LANG_URL_POST = "https://sale.GTBill.com/quickpay2.aspx"; + + public static final String PROG_LANG_URL_POST_REDIRECT = "https://sale.GTBill.com/quickpay.aspx?refid="; + + public static void initApplicationParms(ApplParmFull ap) { + if (ap != null) { + Parm bean = new Parm(ap); + String l_tipoParm = "GTBILL"; + bean.findByCodice("GTBILL_MERCHANT_ID"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("GTBILL_MERCHANT_ID"); + bean.setDescrizione("GTBILL_MERCHANT_ID"); + bean.setFlgTipo(0L); + bean.setNota("MERCHANT ID ASSEGNATO DALLA BANCA"); + bean.save(); + bean.findByCodice("GTBILL_SITE_ID"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("GTBILL_SITE_ID"); + bean.setDescrizione("GTBILL_SITE_ID"); + bean.setFlgTipo(0L); + bean.setNota("SITE ID ASSEGNATO DALLA BANCA"); + bean.save(); + bean.findByCodice("GTBILL_RETURN_URL"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("GTBILL_RETURN_URL"); + bean.setDescrizione("GTBILL_RETURN_URL"); + bean.setFlgTipo(0L); + bean.setNota("URL AL QUALE SI DEVE RITORNARE DOPO IL PAGAMENTO"); + bean.save(); + } + } + + public String getMyamounttotal() { + return (this.myamounttotal == null) ? "" : + this.myamounttotal.replace(".", ",").replace(",", "."); + } + + public void setMyamounttotal(String myamount) { + this.myamounttotal = myamount; + } + + public String getMycurrencyid() { + return (this.mycurrencyid == null) ? "" : this.mycurrencyid; + } + + public void setMycurrencyid(String mycurrency) { + this.mycurrencyid = mycurrency; + } + + public String getMyamountshipping() { + return (this.myamountshipping == null) ? "" : + this.myamountshipping; + } + + public void setMyamountshipping(String myamountshipping) { + this.myamountshipping = myamountshipping; + } + + public String getMyitemname() { + return (this.myitemname == null) ? "" : this.myitemname; + } + + public void setMyitemname(String myitemname) { + this.myitemname = myitemname; + } + + public String getMyitemquantity() { + return (this.myitemquantity == null) ? "" : + this.myitemquantity; + } + + public void setMyitemquantity(String myitemquantity) { + this.myitemquantity = myitemquantity; + } + + public String getMyitemamount() { + return (this.myitemamount == null) ? "" : + this.myitemamount.replace(".", ",").replace(",", "."); + } + + public void setMyitemamount(String myitemamount) { + this.myitemamount = myitemamount; + } + + public String getMyitemdesc() { + return (this.myitemdesc == null) ? "" : this.myitemdesc; + } + + public void setMyitemdesc(String myitemdesc) { + this.myitemdesc = myitemdesc; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/gtbill/GTBillRes.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/gtbill/GTBillRes.java new file mode 100644 index 00000000..2663f647 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/gtbill/GTBillRes.java @@ -0,0 +1,158 @@ +package it.acxent.gtbill; + +import it.acxent.bank._BankAdapter; + +public class GTBillRes extends _BankAdapter { + private String myshoplogin; + + private int mycurrency; + + private float myamount; + + private String myshoptrxID; + + private String mybuyername; + + private String mybuyeremail; + + private String mytrxresult; + + private String myauthcode; + + private String myerrorcode; + + private String myerrordescription; + + private String myerrorbanktrxid; + + private long id_ordine; + + private String myalertcode; + + private String myalertdescription; + + private String mycustominfo; + + public String getMyalertcode() { + return (this.myalertcode == null) ? "" : this.myalertcode; + } + + public void setMyalertcode(String myalertcode) { + this.myalertcode = myalertcode; + } + + public String getMyalertdescription() { + return (this.myalertdescription == null) ? "" : + this.myalertdescription; + } + + public void setMyalertdescription(String myalertdescription) { + this.myalertdescription = myalertdescription; + } + + public float getMyamount() { + return this.myamount; + } + + public void setMyamount(float myamount) { + this.myamount = myamount; + } + + public String getMyauthcode() { + return (this.myauthcode == null) ? "" : this.myauthcode; + } + + public void setMyauthcode(String myauthcode) { + this.myauthcode = myauthcode; + } + + public String getMybuyeremail() { + return (this.mybuyeremail == null) ? "" : this.mybuyeremail; + } + + public void setMybuyeremail(String mybuyeremail) { + this.mybuyeremail = mybuyeremail; + } + + public String getMybuyername() { + return (this.mybuyername == null) ? "" : this.mybuyername; + } + + public void setMybuyername(String mybuyername) { + this.mybuyername = mybuyername; + } + + public int getMycurrency() { + return this.mycurrency; + } + + public void setMycurrency(int mycurrency) { + this.mycurrency = mycurrency; + } + + public String getMycustominfo() { + return (this.mycustominfo == null) ? "" : this.mycustominfo; + } + + public void setMycustominfo(String mycustominfo) { + this.mycustominfo = mycustominfo; + } + + public String getMyerrorbanktrxid() { + return (this.myerrorbanktrxid == null) ? "" : + this.myerrorbanktrxid; + } + + public void setMyerrorbanktrxid(String myerrorbanktrxid) { + this.myerrorbanktrxid = myerrorbanktrxid; + } + + public String getMyerrorcode() { + return (this.myerrorcode == null) ? "" : this.myerrorcode; + } + + public void setMyerrorcode(String myerrorcode) { + this.myerrorcode = myerrorcode; + } + + public String getMyerrordescription() { + return (this.myerrordescription == null) ? "" : + this.myerrordescription; + } + + public void setMyerrordescription(String myerrordescription) { + this.myerrordescription = myerrordescription; + } + + public String getMyshoplogin() { + return (this.myshoplogin == null) ? "" : this.myshoplogin; + } + + public void setMyshoplogin(String myshoplogin) { + this.myshoplogin = myshoplogin; + } + + public String getMyshoptrxID() { + return (this.myshoptrxID == null) ? "" : this.myshoptrxID; + } + + public void setMyshoptrxID(String myshoptrxID) { + this.myshoptrxID = myshoptrxID; + } + + public String getMytrxresult() { + return (this.mytrxresult == null) ? "" : this.mytrxresult; + } + + public void setMytrxresult(String mytrxresult) { + this.mytrxresult = mytrxresult; + } + + public long getId_ordine() { + return this.id_ordine; + } + + public void setId_ordine(long id_ordine) { + this.id_ordine = id_ordine; + } +} diff --git a/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/gtbill/servlet/GTBillSvlt.java b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/gtbill/servlet/GTBillSvlt.java new file mode 100644 index 00000000..762e7fd1 --- /dev/null +++ b/decompiled-libs/www/acxent-bank-1.0.1/it/acxent/gtbill/servlet/GTBillSvlt.java @@ -0,0 +1,115 @@ +package it.acxent.gtbill.servlet; + +import it.acxent.gtbill.GTBillReq; +import it.acxent.servlet.AcServlet; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class GTBillSvlt extends AcServlet { + private static final long serialVersionUID = 6201212373211424420L; + + protected static final String CMD_SEND_REQ = "send"; + + protected static final String CMD_GET_RES = "res"; + + protected static final String BEAN_SELLA_RES = "sellaResp"; + + protected final void callJsp(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspOkPage(req, res), req); + try { + RequestDispatcher rd = getServletContext() + .getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void sendRequest(HttpServletRequest req, HttpServletResponse res) { + try { + GTBillReq gtbillreq = new GTBillReq(); + fillObject(req, gtbillreq); + String theUrl = "https://sale.GTBill.com/quickpay2.aspx"; + StringBuilder sb = new StringBuilder(); + sb.append("?MerchantID="); + sb.append(getApFull().getParm("GTBILL_MERCHANT_ID")); + sb.append("&SiteID="); + sb.append(getApFull().getParm("GTBILL_SITE_ID")); + sb.append("&AmountTotal="); + sb.append(gtbillreq.getMyamounttotal()); + sb.append("&CurrencyID="); + sb.append("EUR"); + sb.append("&AmountShipping="); + sb.append(gtbillreq.getMyamountshipping()); + sb.append("&ReturnURL="); + sb.append(getApFull().getParm("GTBILL_RETURN_URL")); + sb.append("&ItemAmount[0]="); + sb.append(gtbillreq.getMyitemamount()); + sb.append("&ItemDesc[0]="); + sb.append(gtbillreq.getMyitemdesc()); + sb.append("&ItemName[0]="); + sb.append(gtbillreq.getMyitemname()); + sb.append("&ItemQuantity[0]="); + sb.append(gtbillreq.getMyitemquantity()); + URL url = new URL(theUrl + theUrl); + System.out.println("startremotecmd: chiamata a " + theUrl + + sb.toString()); + HttpURLConnection connection = (HttpURLConnection) + url.openConnection(); + BufferedReader read = new BufferedReader(new InputStreamReader( + connection.getInputStream())); + String line = read.readLine(); + String html = ""; + while (line != null) { + html = html + html; + line = read.readLine(); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected String getCodiceEsercente(HttpServletRequest req) { + return getParm("COD_ESER_SELLA").getTesto(); + } + + protected String getJspErrorPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("SELLA_OK").getTesto(); + if (temp.isEmpty()) + return getJspKoPage(req, res); + return temp; + } + + protected String getJspOkPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("SELLA_OK").getTesto(); + if (temp.isEmpty()) + return "payRes.jsp"; + return temp; + } + + protected String getJspKoPage(HttpServletRequest req, HttpServletResponse res) { + String temp = getParm("SELLA_OK").getTesto(); + if (temp.isEmpty()) + return "payRes.jsp"; + return temp; + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + try { + sendRequest(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-checkvat-1.0.0/META-INF/MANIFEST.MF b/decompiled-libs/www/acxent-checkvat-1.0.0/META-INF/MANIFEST.MF new file mode 100644 index 00000000..e6558cdf --- /dev/null +++ b/decompiled-libs/www/acxent-checkvat-1.0.0/META-INF/MANIFEST.MF @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +Archiver-Version: Plexus Archiver +Created-By: Apache Maven 3.8.7 +Built-By: jenkins +Build-Jdk: 17.0.16 + diff --git a/decompiled-libs/www/acxent-checkvat-1.0.0/META-INF/maven/it.acxent/acxent-checkvat/pom.properties b/decompiled-libs/www/acxent-checkvat-1.0.0/META-INF/maven/it.acxent/acxent-checkvat/pom.properties new file mode 100644 index 00000000..5228021c --- /dev/null +++ b/decompiled-libs/www/acxent-checkvat-1.0.0/META-INF/maven/it.acxent/acxent-checkvat/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Mon Jul 07 23:51:17 CEST 2025 +artifactId=acxent-checkvat +groupId=it.acxent +version=1.0.0 diff --git a/decompiled-libs/www/acxent-checkvat-1.0.0/META-INF/maven/it.acxent/acxent-checkvat/pom.xml b/decompiled-libs/www/acxent-checkvat-1.0.0/META-INF/maven/it.acxent/acxent-checkvat/pom.xml new file mode 100644 index 00000000..7ac54894 --- /dev/null +++ b/decompiled-libs/www/acxent-checkvat-1.0.0/META-INF/maven/it.acxent/acxent-checkvat/pom.xml @@ -0,0 +1,65 @@ + + 4.0.0 + it.acxent + acxent-checkvat + 1.0.0 + + Check Vat Service + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + 11 + 11 + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.7.0 + + + org.apache.maven.plugins + maven-toolchains-plugin + 3.1.0 + + + + toolchain + + + + + + + 11 + + + + + + + + + org.apache.axis + axis + 1.4 + + + javax.xml.rpc + javax.xml.rpc-api + 1.1.2 + + + + + + github-repo + GitHub acolzi Apache Maven Packages + https://maven.pkg.github.com/acolzi/repo + + + \ No newline at end of file diff --git a/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatBindingStub.java b/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatBindingStub.java new file mode 100644 index 00000000..10fc5a3b --- /dev/null +++ b/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatBindingStub.java @@ -0,0 +1,381 @@ +package checkVat.services.vies.taxud.eu.europa.ec; + +import java.net.URL; +import java.rmi.RemoteException; +import java.util.Date; +import java.util.Enumeration; +import java.util.Map; +import java.util.Vector; +import javax.xml.namespace.QName; +import javax.xml.rpc.Service; +import javax.xml.rpc.holders.BooleanHolder; +import javax.xml.rpc.holders.StringHolder; +import org.apache.axis.AxisFault; +import org.apache.axis.NoEndPointException; +import org.apache.axis.client.Call; +import org.apache.axis.client.Stub; +import org.apache.axis.constants.Style; +import org.apache.axis.constants.Use; +import org.apache.axis.description.OperationDesc; +import org.apache.axis.description.ParameterDesc; +import org.apache.axis.encoding.DeserializerFactory; +import org.apache.axis.encoding.SerializerFactory; +import org.apache.axis.encoding.XMLType; +import org.apache.axis.encoding.ser.ArrayDeserializerFactory; +import org.apache.axis.encoding.ser.ArraySerializerFactory; +import org.apache.axis.encoding.ser.BaseDeserializerFactory; +import org.apache.axis.encoding.ser.BaseSerializerFactory; +import org.apache.axis.encoding.ser.BeanDeserializerFactory; +import org.apache.axis.encoding.ser.BeanSerializerFactory; +import org.apache.axis.encoding.ser.EnumDeserializerFactory; +import org.apache.axis.encoding.ser.EnumSerializerFactory; +import org.apache.axis.encoding.ser.SimpleDeserializerFactory; +import org.apache.axis.encoding.ser.SimpleListDeserializerFactory; +import org.apache.axis.encoding.ser.SimpleListSerializerFactory; +import org.apache.axis.encoding.ser.SimpleSerializerFactory; +import org.apache.axis.holders.DateHolder; +import org.apache.axis.soap.SOAPConstants; +import org.apache.axis.utils.JavaUtils; +import types.checkVat.services.vies.taxud.eu.europa.ec.MatchCode; +import types.checkVat.services.vies.taxud.eu.europa.ec.holders.MatchCodeHolder; + +public class CheckVatBindingStub extends Stub implements CheckVatPortType { + private Vector cachedSerClasses = new Vector(); + + private Vector cachedSerQNames = new Vector(); + + private Vector cachedSerFactories = new Vector(); + + private Vector cachedDeserFactories = new Vector(); + + static OperationDesc[] _operations = new OperationDesc[2]; + + static { + _initOperationDesc1(); + } + + private static void _initOperationDesc1() { + OperationDesc oper = new OperationDesc(); + oper.setName("checkVat"); + ParameterDesc param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "countryCode"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "vatNumber"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestDate"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "date"), Date.class, false, false); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "valid"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "boolean"), boolean.class, false, false); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "name"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false); + param.setOmittable(true); + param.setNillable(true); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "address"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false); + param.setOmittable(true); + param.setNillable(true); + oper.addParameter(param); + oper.setReturnType(XMLType.AXIS_VOID); + oper.setStyle(Style.WRAPPED); + oper.setUse(Use.LITERAL); + _operations[0] = oper; + oper = new OperationDesc(); + oper.setName("checkVatApprox"); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "countryCode"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "vatNumber"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderName"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false); + param.setOmittable(true); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCompanyType"), (byte)3, new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "companyTypeCode"), String.class, false, false); + param.setOmittable(true); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderStreet"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false); + param.setOmittable(true); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderPostcode"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false); + param.setOmittable(true); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCity"), (byte)3, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false); + param.setOmittable(true); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requesterCountryCode"), (byte)1, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false); + param.setOmittable(true); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requesterVatNumber"), (byte)1, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false); + param.setOmittable(true); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestDate"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "date"), Date.class, false, false); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "valid"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "boolean"), boolean.class, false, false); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderAddress"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false); + param.setOmittable(true); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderNameMatch"), (byte)2, new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "matchCode"), MatchCode.class, false, false); + param.setOmittable(true); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCompanyTypeMatch"), (byte)2, new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "matchCode"), MatchCode.class, false, false); + param.setOmittable(true); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderStreetMatch"), (byte)2, new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "matchCode"), MatchCode.class, false, false); + param.setOmittable(true); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderPostcodeMatch"), (byte)2, new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "matchCode"), MatchCode.class, false, false); + param.setOmittable(true); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCityMatch"), (byte)2, new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "matchCode"), MatchCode.class, false, false); + param.setOmittable(true); + oper.addParameter(param); + param = new ParameterDesc(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestIdentifier"), (byte)2, new QName("http://www.w3.org/2001/XMLSchema", "string"), String.class, false, false); + oper.addParameter(param); + oper.setReturnType(XMLType.AXIS_VOID); + oper.setStyle(Style.WRAPPED); + oper.setUse(Use.LITERAL); + _operations[1] = oper; + } + + public CheckVatBindingStub() throws AxisFault { + this(null); + } + + public CheckVatBindingStub(URL endpointURL, Service service) throws AxisFault { + this(service); + this.cachedEndpoint = endpointURL; + } + + public CheckVatBindingStub(Service service) throws AxisFault { + if (service == null) { + this.service = new org.apache.axis.client.Service(); + } else { + this.service = service; + } + ((org.apache.axis.client.Service)this.service).setTypeMappingVersion("1.2"); + Class beansf = BeanSerializerFactory.class; + Class beandf = BeanDeserializerFactory.class; + Class enumsf = EnumSerializerFactory.class; + Class enumdf = EnumDeserializerFactory.class; + Class arraysf = ArraySerializerFactory.class; + Class arraydf = ArrayDeserializerFactory.class; + Class simplesf = SimpleSerializerFactory.class; + Class simpledf = SimpleDeserializerFactory.class; + Class simplelistsf = SimpleListSerializerFactory.class; + Class simplelistdf = SimpleListDeserializerFactory.class; + QName qName = new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "companyTypeCode"); + this.cachedSerQNames.add(qName); + Class cls = String.class; + this.cachedSerClasses.add(cls); + this.cachedSerFactories.add(BaseSerializerFactory.createFactory(SimpleSerializerFactory.class, cls, qName)); + this.cachedDeserFactories.add(BaseDeserializerFactory.createFactory(SimpleDeserializerFactory.class, cls, qName)); + qName = new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "matchCode"); + this.cachedSerQNames.add(qName); + Class clazz = MatchCode.class; + this.cachedSerClasses.add(clazz); + this.cachedSerFactories.add(enumsf); + this.cachedDeserFactories.add(enumdf); + } + + protected Call createCall() throws RemoteException { + try { + Call _call = _createCall(); + if (this.maintainSessionSet) + _call.setMaintainSession(this.maintainSession); + if (this.cachedUsername != null) + _call.setUsername(this.cachedUsername); + if (this.cachedPassword != null) + _call.setPassword(this.cachedPassword); + if (this.cachedEndpoint != null) + _call.setTargetEndpointAddress(this.cachedEndpoint); + if (this.cachedTimeout != null) + _call.setTimeout(this.cachedTimeout); + if (this.cachedPortName != null) + _call.setPortName(this.cachedPortName); + Enumeration keys = this.cachedProperties.keys(); + while (keys.hasMoreElements()) { + String key = (String)keys.nextElement(); + _call.setProperty(key, this.cachedProperties.get(key)); + } + synchronized (this) { + if (firstCall()) { + _call.setEncodingStyle(null); + for (int i = 0; i < this.cachedSerFactories.size(); i++) { + Class cls = this.cachedSerClasses.get(i); + QName qName = this.cachedSerQNames.get(i); + Object x = this.cachedSerFactories.get(i); + if (x instanceof Class) { + Class sf = this.cachedSerFactories.get(i); + Class df = this.cachedDeserFactories.get(i); + _call.registerTypeMapping(cls, qName, sf, df, false); + } else if (x instanceof javax.xml.rpc.encoding.SerializerFactory) { + SerializerFactory sf = this.cachedSerFactories.get(i); + DeserializerFactory df = this.cachedDeserFactories.get(i); + _call.registerTypeMapping(cls, qName, sf, df, false); + } + } + } + } + return _call; + } catch (Throwable _t) { + throw new AxisFault("Failure trying to get the Call object", _t); + } + } + + public void checkVat(StringHolder countryCode, StringHolder vatNumber, DateHolder requestDate, BooleanHolder valid, StringHolder name, StringHolder address) throws RemoteException { + if (this.cachedEndpoint == null) + throw new NoEndPointException(); + Call _call = createCall(); + _call.setOperation(_operations[0]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setEncodingStyle(null); + _call.setProperty("sendXsiTypes", Boolean.FALSE); + _call.setProperty("sendMultiRefs", Boolean.FALSE); + _call.setSOAPVersion((SOAPConstants)SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "checkVat")); + setRequestHeaders(_call); + setAttachments(_call); + try { + Object _resp = _call.invoke(new Object[] { countryCode.value, vatNumber.value }); + if (_resp instanceof RemoteException) + throw (RemoteException)_resp; + extractAttachments(_call); + Map _output = _call.getOutputParams(); + try { + countryCode.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "countryCode")); + } catch (Exception _exception) { + countryCode.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "countryCode")), String.class); + } + try { + vatNumber.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "vatNumber")); + } catch (Exception _exception) { + vatNumber.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "vatNumber")), String.class); + } + try { + requestDate.value = (Date)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestDate")); + } catch (Exception _exception) { + requestDate.value = (Date)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestDate")), Date.class); + } + try { + valid.value = (Boolean)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "valid")); + } catch (Exception _exception) { + valid.value = (Boolean)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "valid")), boolean.class); + } + try { + name.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "name")); + } catch (Exception _exception) { + name.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "name")), String.class); + } + try { + address.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "address")); + } catch (Exception _exception) { + address.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "address")), String.class); + } + } catch (AxisFault axisFaultException) { + throw axisFaultException; + } + } + + public void checkVatApprox(StringHolder countryCode, StringHolder vatNumber, StringHolder traderName, StringHolder traderCompanyType, StringHolder traderStreet, StringHolder traderPostcode, StringHolder traderCity, String requesterCountryCode, String requesterVatNumber, DateHolder requestDate, BooleanHolder valid, StringHolder traderAddress, MatchCodeHolder traderNameMatch, MatchCodeHolder traderCompanyTypeMatch, MatchCodeHolder traderStreetMatch, MatchCodeHolder traderPostcodeMatch, MatchCodeHolder traderCityMatch, StringHolder requestIdentifier) throws RemoteException { + if (this.cachedEndpoint == null) + throw new NoEndPointException(); + Call _call = createCall(); + _call.setOperation(_operations[1]); + _call.setUseSOAPAction(true); + _call.setSOAPActionURI(""); + _call.setEncodingStyle(null); + _call.setProperty("sendXsiTypes", Boolean.FALSE); + _call.setProperty("sendMultiRefs", Boolean.FALSE); + _call.setSOAPVersion((SOAPConstants)SOAPConstants.SOAP11_CONSTANTS); + _call.setOperationName(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "checkVatApprox")); + setRequestHeaders(_call); + setAttachments(_call); + try { + Object _resp = _call.invoke(new Object[] { countryCode.value, vatNumber.value, traderName.value, traderCompanyType.value, traderStreet.value, traderPostcode.value, traderCity.value, requesterCountryCode, requesterVatNumber }); + if (_resp instanceof RemoteException) + throw (RemoteException)_resp; + extractAttachments(_call); + Map _output = _call.getOutputParams(); + try { + countryCode.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "countryCode")); + } catch (Exception _exception) { + countryCode.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "countryCode")), String.class); + } + try { + vatNumber.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "vatNumber")); + } catch (Exception _exception) { + vatNumber.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "vatNumber")), String.class); + } + try { + traderName.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderName")); + } catch (Exception _exception) { + traderName.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderName")), String.class); + } + try { + traderCompanyType.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCompanyType")); + } catch (Exception _exception) { + traderCompanyType.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCompanyType")), String.class); + } + try { + traderStreet.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderStreet")); + } catch (Exception _exception) { + traderStreet.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderStreet")), String.class); + } + try { + traderPostcode.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderPostcode")); + } catch (Exception _exception) { + traderPostcode.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderPostcode")), String.class); + } + try { + traderCity.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCity")); + } catch (Exception _exception) { + traderCity.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCity")), String.class); + } + try { + requestDate.value = (Date)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestDate")); + } catch (Exception _exception) { + requestDate.value = (Date)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestDate")), Date.class); + } + try { + valid.value = (Boolean)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "valid")); + } catch (Exception _exception) { + valid.value = (Boolean)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "valid")), boolean.class); + } + try { + traderAddress.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderAddress")); + } catch (Exception _exception) { + traderAddress.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderAddress")), String.class); + } + try { + traderNameMatch.value = (MatchCode)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderNameMatch")); + } catch (Exception _exception) { + traderNameMatch.value = (MatchCode)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderNameMatch")), MatchCode.class); + } + try { + traderCompanyTypeMatch.value = (MatchCode)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCompanyTypeMatch")); + } catch (Exception _exception) { + traderCompanyTypeMatch.value = (MatchCode)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCompanyTypeMatch")), MatchCode.class); + } + try { + traderStreetMatch.value = (MatchCode)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderStreetMatch")); + } catch (Exception _exception) { + traderStreetMatch.value = (MatchCode)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderStreetMatch")), MatchCode.class); + } + try { + traderPostcodeMatch.value = (MatchCode)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderPostcodeMatch")); + } catch (Exception _exception) { + traderPostcodeMatch.value = (MatchCode)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderPostcodeMatch")), MatchCode.class); + } + try { + traderCityMatch.value = (MatchCode)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCityMatch")); + } catch (Exception _exception) { + traderCityMatch.value = (MatchCode)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "traderCityMatch")), MatchCode.class); + } + try { + requestIdentifier.value = (String)_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestIdentifier")); + } catch (Exception _exception) { + requestIdentifier.value = (String)JavaUtils.convert(_output.get(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "requestIdentifier")), String.class); + } + } catch (AxisFault axisFaultException) { + throw axisFaultException; + } + } +} diff --git a/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatPortType.java b/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatPortType.java new file mode 100644 index 00000000..1853e2cb --- /dev/null +++ b/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatPortType.java @@ -0,0 +1,14 @@ +package checkVat.services.vies.taxud.eu.europa.ec; + +import java.rmi.Remote; +import java.rmi.RemoteException; +import javax.xml.rpc.holders.BooleanHolder; +import javax.xml.rpc.holders.StringHolder; +import org.apache.axis.holders.DateHolder; +import types.checkVat.services.vies.taxud.eu.europa.ec.holders.MatchCodeHolder; + +public interface CheckVatPortType extends Remote { + void checkVat(StringHolder paramStringHolder1, StringHolder paramStringHolder2, DateHolder paramDateHolder, BooleanHolder paramBooleanHolder, StringHolder paramStringHolder3, StringHolder paramStringHolder4) throws RemoteException; + + void checkVatApprox(StringHolder paramStringHolder1, StringHolder paramStringHolder2, StringHolder paramStringHolder3, StringHolder paramStringHolder4, StringHolder paramStringHolder5, StringHolder paramStringHolder6, StringHolder paramStringHolder7, String paramString1, String paramString2, DateHolder paramDateHolder, BooleanHolder paramBooleanHolder, StringHolder paramStringHolder8, MatchCodeHolder paramMatchCodeHolder1, MatchCodeHolder paramMatchCodeHolder2, MatchCodeHolder paramMatchCodeHolder3, MatchCodeHolder paramMatchCodeHolder4, MatchCodeHolder paramMatchCodeHolder5, StringHolder paramStringHolder9) throws RemoteException; +} diff --git a/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatPortTypeProxy.java b/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatPortTypeProxy.java new file mode 100644 index 00000000..4da2eb12 --- /dev/null +++ b/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatPortTypeProxy.java @@ -0,0 +1,64 @@ +package checkVat.services.vies.taxud.eu.europa.ec; + +import java.rmi.RemoteException; +import javax.xml.rpc.ServiceException; +import javax.xml.rpc.Stub; +import javax.xml.rpc.holders.BooleanHolder; +import javax.xml.rpc.holders.StringHolder; +import org.apache.axis.holders.DateHolder; +import types.checkVat.services.vies.taxud.eu.europa.ec.holders.MatchCodeHolder; + +public class CheckVatPortTypeProxy implements CheckVatPortType { + private String _endpoint = null; + + private CheckVatPortType checkVatPortType = null; + + public CheckVatPortTypeProxy() { + _initCheckVatPortTypeProxy(); + } + + public CheckVatPortTypeProxy(String endpoint) { + this._endpoint = endpoint; + _initCheckVatPortTypeProxy(); + } + + private void _initCheckVatPortTypeProxy() { + try { + this.checkVatPortType = new CheckVatServiceLocator().getcheckVatPort(); + if (this.checkVatPortType != null) + if (this._endpoint != null) { + ((Stub)this.checkVatPortType)._setProperty("javax.xml.rpc.service.endpoint.address", this._endpoint); + } else { + this._endpoint = (String)((Stub)this.checkVatPortType)._getProperty("javax.xml.rpc.service.endpoint.address"); + } + } catch (ServiceException e) {} + } + + public String getEndpoint() { + return this._endpoint; + } + + public void setEndpoint(String endpoint) { + this._endpoint = endpoint; + if (this.checkVatPortType != null) + ((Stub)this.checkVatPortType)._setProperty("javax.xml.rpc.service.endpoint.address", this._endpoint); + } + + public CheckVatPortType getCheckVatPortType() { + if (this.checkVatPortType == null) + _initCheckVatPortTypeProxy(); + return this.checkVatPortType; + } + + public void checkVat(StringHolder countryCode, StringHolder vatNumber, DateHolder requestDate, BooleanHolder valid, StringHolder name, StringHolder address) throws RemoteException { + if (this.checkVatPortType == null) + _initCheckVatPortTypeProxy(); + this.checkVatPortType.checkVat(countryCode, vatNumber, requestDate, valid, name, address); + } + + public void checkVatApprox(StringHolder countryCode, StringHolder vatNumber, StringHolder traderName, StringHolder traderCompanyType, StringHolder traderStreet, StringHolder traderPostcode, StringHolder traderCity, String requesterCountryCode, String requesterVatNumber, DateHolder requestDate, BooleanHolder valid, StringHolder traderAddress, MatchCodeHolder traderNameMatch, MatchCodeHolder traderCompanyTypeMatch, MatchCodeHolder traderStreetMatch, MatchCodeHolder traderPostcodeMatch, MatchCodeHolder traderCityMatch, StringHolder requestIdentifier) throws RemoteException { + if (this.checkVatPortType == null) + _initCheckVatPortTypeProxy(); + this.checkVatPortType.checkVatApprox(countryCode, vatNumber, traderName, traderCompanyType, traderStreet, traderPostcode, traderCity, requesterCountryCode, requesterVatNumber, requestDate, valid, traderAddress, traderNameMatch, traderCompanyTypeMatch, traderStreetMatch, traderPostcodeMatch, traderCityMatch, requestIdentifier); + } +} diff --git a/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatService.java b/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatService.java new file mode 100644 index 00000000..7c9f1143 --- /dev/null +++ b/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatService.java @@ -0,0 +1,13 @@ +package checkVat.services.vies.taxud.eu.europa.ec; + +import java.net.URL; +import javax.xml.rpc.Service; +import javax.xml.rpc.ServiceException; + +public interface CheckVatService extends Service { + String getcheckVatPortAddress(); + + CheckVatPortType getcheckVatPort() throws ServiceException; + + CheckVatPortType getcheckVatPort(URL paramURL) throws ServiceException; +} diff --git a/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatServiceLocator.java b/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatServiceLocator.java new file mode 100644 index 00000000..fe97f451 --- /dev/null +++ b/decompiled-libs/www/acxent-checkvat-1.0.0/checkVat/services/vies/taxud/eu/europa/ec/CheckVatServiceLocator.java @@ -0,0 +1,115 @@ +package checkVat.services.vies.taxud.eu.europa.ec; + +import java.net.MalformedURLException; +import java.net.URL; +import java.rmi.Remote; +import java.util.HashSet; +import java.util.Iterator; +import javax.xml.namespace.QName; +import javax.xml.rpc.ServiceException; +import org.apache.axis.AxisFault; +import org.apache.axis.EngineConfiguration; +import org.apache.axis.client.Service; +import org.apache.axis.client.Stub; + +public class CheckVatServiceLocator extends Service implements CheckVatService { + public CheckVatServiceLocator() {} + + public CheckVatServiceLocator(EngineConfiguration config) { + super(config); + } + + public CheckVatServiceLocator(String wsdlLoc, QName sName) throws ServiceException { + super(wsdlLoc, sName); + } + + private String checkVatPort_address = "http://ec.europa.eu/taxation_customs/vies/services/checkVatService"; + + public String getcheckVatPortAddress() { + return this.checkVatPort_address; + } + + private String checkVatPortWSDDServiceName = "checkVatPort"; + + public String getcheckVatPortWSDDServiceName() { + return this.checkVatPortWSDDServiceName; + } + + public void setcheckVatPortWSDDServiceName(String name) { + this.checkVatPortWSDDServiceName = name; + } + + public CheckVatPortType getcheckVatPort() throws ServiceException { + URL endpoint; + try { + endpoint = new URL(this.checkVatPort_address); + } catch (MalformedURLException e) { + throw new ServiceException(e); + } + return getcheckVatPort(endpoint); + } + + public CheckVatPortType getcheckVatPort(URL portAddress) throws ServiceException { + try { + CheckVatBindingStub _stub = new CheckVatBindingStub(portAddress, this); + _stub.setPortName(getcheckVatPortWSDDServiceName()); + return _stub; + } catch (AxisFault e) { + return null; + } + } + + public void setcheckVatPortEndpointAddress(String address) { + this.checkVatPort_address = address; + } + + public Remote getPort(Class serviceEndpointInterface) throws ServiceException { + try { + if (CheckVatPortType.class.isAssignableFrom(serviceEndpointInterface)) { + CheckVatBindingStub _stub = new CheckVatBindingStub(new URL(this.checkVatPort_address), this); + _stub.setPortName(getcheckVatPortWSDDServiceName()); + return _stub; + } + } catch (Throwable t) { + throw new ServiceException(t); + } + throw new ServiceException("There is no stub implementation for the interface: " + ((serviceEndpointInterface == null) ? "null" : serviceEndpointInterface.getName())); + } + + public Remote getPort(QName portName, Class serviceEndpointInterface) throws ServiceException { + if (portName == null) + return getPort(serviceEndpointInterface); + String inputPortName = portName.getLocalPart(); + if ("checkVatPort".equals(inputPortName)) + return getcheckVatPort(); + Remote _stub = getPort(serviceEndpointInterface); + ((Stub)_stub).setPortName(portName); + return _stub; + } + + public QName getServiceName() { + return new QName("urn:ec.europa.eu:taxud:vies:services:checkVat", "checkVatService"); + } + + private HashSet ports = null; + + public Iterator getPorts() { + if (this.ports == null) { + this.ports = new HashSet(); + this.ports.add(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat", "checkVatPort")); + } + return this.ports.iterator(); + } + + public void setEndpointAddress(String portName, String address) throws ServiceException { + if ("checkVatPort".equals(portName)) { + setcheckVatPortEndpointAddress(address); + } else { + throw new ServiceException(" Cannot set Endpoint Address for Unknown Port" + portName); + } + } + + public void setEndpointAddress(QName portName, String address) throws ServiceException { + setEndpointAddress(portName.getLocalPart(), address); + } +} diff --git a/decompiled-libs/www/acxent-checkvat-1.0.0/it/acxent/checkVatService/CheckVatClient.java b/decompiled-libs/www/acxent-checkvat-1.0.0/it/acxent/checkVatService/CheckVatClient.java new file mode 100644 index 00000000..95c68247 --- /dev/null +++ b/decompiled-libs/www/acxent-checkvat-1.0.0/it/acxent/checkVatService/CheckVatClient.java @@ -0,0 +1,88 @@ +package it.acxent.checkVatService; + +import checkVat.services.vies.taxud.eu.europa.ec.CheckVatPortTypeProxy; +import java.sql.Date; +import javax.xml.rpc.holders.BooleanHolder; +import javax.xml.rpc.holders.StringHolder; +import org.apache.axis.holders.DateHolder; + +public class CheckVatClient { + private String name; + + private String address; + + private String vatNumber; + + private String countryCode; + + private Date requestDate; + + private boolean valid; + + public CheckVatClient(String countryCode, String vatNumber) { + BooleanHolder validSH = new BooleanHolder(); + DateHolder requestDateSH = new DateHolder(); + StringHolder countryCodeSH = new StringHolder(countryCode); + StringHolder vatNumberSH = new StringHolder(vatNumber); + StringHolder nameSH = new StringHolder(); + StringHolder addressSH = new StringHolder(); + CheckVatPortTypeProxy service = new CheckVatPortTypeProxy(); + try { + service.checkVat(countryCodeSH, vatNumberSH, requestDateSH, validSH, nameSH, addressSH); + setAddress(addressSH.value); + setName(nameSH.value); + setValid(validSH.value); + setRequestDate(new Date(requestDateSH.value.getTime())); + setCountryCode(countryCode); + setVatNumber(vatNumber); + } catch (Exception e) {} + } + + public String getName() { + return (this.name == null) ? "" : this.name; + } + + public void setName(String name) { + this.name = name; + } + + public String getAddress() { + return (this.address == null) ? "" : this.address.trim(); + } + + public void setAddress(String address) { + this.address = address; + } + + public String getVatNumber() { + return (this.vatNumber == null) ? "" : this.vatNumber; + } + + public void setVatNumber(String vatNumber) { + this.vatNumber = vatNumber; + } + + public String getCountryCode() { + return (this.countryCode == null) ? "" : this.countryCode; + } + + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + + public Date getRequestDate() { + return this.requestDate; + } + + public void setRequestDate(Date requestDate) { + this.requestDate = requestDate; + } + + public boolean getValid() { + return this.valid; + } + + public void setValid(boolean valid) { + this.valid = valid; + } +} diff --git a/decompiled-libs/www/acxent-checkvat-1.0.0/types/checkVat/services/vies/taxud/eu/europa/ec/MatchCode.java b/decompiled-libs/www/acxent-checkvat-1.0.0/types/checkVat/services/vies/taxud/eu/europa/ec/MatchCode.java new file mode 100644 index 00000000..fd8c1a5a --- /dev/null +++ b/decompiled-libs/www/acxent-checkvat-1.0.0/types/checkVat/services/vies/taxud/eu/europa/ec/MatchCode.java @@ -0,0 +1,80 @@ +package types.checkVat.services.vies.taxud.eu.europa.ec; + +import java.io.ObjectStreamException; +import java.io.Serializable; +import java.util.HashMap; +import javax.xml.namespace.QName; +import org.apache.axis.description.TypeDesc; +import org.apache.axis.encoding.Deserializer; +import org.apache.axis.encoding.Serializer; +import org.apache.axis.encoding.ser.EnumDeserializer; +import org.apache.axis.encoding.ser.EnumSerializer; + +public class MatchCode implements Serializable { + private String _value_; + + private static HashMap _table_ = new HashMap(); + + public static final String _value1 = "1"; + + public static final String _value2 = "2"; + + protected MatchCode(String value) { + this._value_ = value; + _table_.put(this._value_, this); + } + + public static final MatchCode value1 = new MatchCode("1"); + + public static final MatchCode value2 = new MatchCode("2"); + + public String getValue() { + return this._value_; + } + + public static MatchCode fromValue(String value) throws IllegalArgumentException { + MatchCode enumeration = (MatchCode) + _table_.get(value); + if (enumeration == null) + throw new IllegalArgumentException(); + return enumeration; + } + + public static MatchCode fromString(String value) throws IllegalArgumentException { + return fromValue(value); + } + + public boolean equals(Object obj) { + return (obj == this); + } + + public int hashCode() { + return toString().hashCode(); + } + + public String toString() { + return this._value_; + } + + public Object readResolve() throws ObjectStreamException { + return fromValue(this._value_); + } + + public static Serializer getSerializer(String mechType, Class _javaType, QName _xmlType) { + return new EnumSerializer(_javaType, _xmlType); + } + + public static Deserializer getDeserializer(String mechType, Class _javaType, QName _xmlType) { + return new EnumDeserializer(_javaType, _xmlType); + } + + private static TypeDesc typeDesc = new TypeDesc(MatchCode.class); + + static { + typeDesc.setXmlType(new QName("urn:ec.europa.eu:taxud:vies:services:checkVat:types", "matchCode")); + } + + public static TypeDesc getTypeDesc() { + return typeDesc; + } +} diff --git a/decompiled-libs/www/acxent-checkvat-1.0.0/types/checkVat/services/vies/taxud/eu/europa/ec/holders/MatchCodeHolder.java b/decompiled-libs/www/acxent-checkvat-1.0.0/types/checkVat/services/vies/taxud/eu/europa/ec/holders/MatchCodeHolder.java new file mode 100644 index 00000000..67a412a0 --- /dev/null +++ b/decompiled-libs/www/acxent-checkvat-1.0.0/types/checkVat/services/vies/taxud/eu/europa/ec/holders/MatchCodeHolder.java @@ -0,0 +1,14 @@ +package types.checkVat.services.vies.taxud.eu.europa.ec.holders; + +import javax.xml.rpc.holders.Holder; +import types.checkVat.services.vies.taxud.eu.europa.ec.MatchCode; + +public final class MatchCodeHolder implements Holder { + public MatchCode value; + + public MatchCodeHolder() {} + + public MatchCodeHolder(MatchCode value) { + this.value = value; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/AggAbiCab.java b/decompiled-libs/www/acxent-common-1.0.1/AggAbiCab.java new file mode 100644 index 00000000..0efbd643 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/AggAbiCab.java @@ -0,0 +1,32 @@ +import it.acxent.anag.AbiCab; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.util.DbConsole; + +public class AggAbiCab extends DbConsole { + public static void main(String[] args) { + AggAbiCab bean = new AggAbiCab(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "ctexpress"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + ResParm rp = new AbiCab(apTarget).importAbiCab("/Users/acolzi/Downloads/banche.csv"); + System.out.println(rp.getMsg()); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/AggDocFiglio.java b/decompiled-libs/www/acxent-common-1.0.1/AggDocFiglio.java new file mode 100644 index 00000000..af3f66a3 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/AggDocFiglio.java @@ -0,0 +1,50 @@ +import it.acxent.contab.Documento; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; + +public class AggDocFiglio extends DbConsole { + public static void main(String[] args) { + AggDocFiglio bean = new AggDocFiglio(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "guidoreni"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + System.out.println("calcolo tot record...."); + Vectumerator vec = new Documento(apTarget).findAll(); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + int updRec = 0; + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + if (row.getId_documentoFiglio() != 0L) + updRec++; + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " " + i); + } + System.out.println("--- fine ---"); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/AggiornaMagMovimento.java b/decompiled-libs/www/acxent-common-1.0.1/AggiornaMagMovimento.java new file mode 100644 index 00000000..1de0d011 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/AggiornaMagMovimento.java @@ -0,0 +1,189 @@ +import it.acxent.anag.MagFisico; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.art.ArticoloVariante; +import it.acxent.contab.Movimento; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.RigaDocumentoP; +import it.acxent.contab.RigaDocumentoPCR; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Timestamp; +import java.util.Calendar; + +public class AggiornaMagMovimento extends DbConsole { + public static void main(String[] args) { + AggiornaMagMovimento bean = new AggiornaMagMovimento(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + int i = 0, j = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String db = "guidoreni"; + boolean step1 = true, step2 = true, step3 = true, step4 = true, step5 = true; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 60)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + long l_id_articolo = 0L; + ResParm rp = new ResParm(true); + int pagerow = 1000; + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("START: " + start.toString()); + if (step1) { + System.out.println("Delete All Movimento"); + Movimento mov = new Movimento(apTarget); + String sqlDeleteMov = "delete from MOVIMENTO "; + if (l_id_articolo > 0L) + sqlDeleteMov = sqlDeleteMov + " where id_articolo=" + sqlDeleteMov; + mov.delete(sqlDeleteMov); + i = 0; + System.out.println("Import All Movimento"); + RigaDocumento rd = new RigaDocumento(apTarget); + long tot = rd.findAllPerRiordinoMagazzinoTot(l_id_articolo); + System.out.println("tot record: " + tot); + while ((long)j < tot / (long)pagerow + 1L) { + j++; + Vectumerator vec = rd.findAllPerRiordinoMagazzino(l_id_articolo, j, pagerow); + while (vec.hasMoreElements()) { + rd = (RigaDocumento)vec.nextElement(); + rp = RigaDocumento.aggiornaMovimento(rd); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + System.out.print("Tot: " + tot + " - Pag: " + j + " - Pag. Lette: " + j * pagerow); + } + } + Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("start 2: " + stop.toString()); + if (step2) { + i = 0; + j = 0; + RigaDocumentoP rdp = new RigaDocumentoP(apTarget); + Vectumerator vec = rdp.findAll(); + long tot = (long)vec.getTotNumberOfRecords(); + System.out.println("Riga documento P: tot record: " + vec.getTotNumberOfRecords()); + while ((long)j < tot / (long)pagerow + 1L) { + j++; + vec = rdp.findByCR(new RigaDocumentoPCR(), j, pagerow); + while (vec.hasMoreElements()) { + RigaDocumentoP row = (RigaDocumentoP)vec.nextElement(); + if (row.getRigaDocumentoPrelevata().getDocumento().getTipoDocumento() + .getFlgTipologia() == 3L) { + Movimento mov = new Movimento(apTarget); + rp = mov.deleteP(row.getId_rigaDocumentoPrelevata()); + mov.setId_articolo(row.getRigaDocumentoPrelevata().getId_articolo()); + mov.setId_articoloVariante(row.getRigaDocumentoPrelevata().getId_articoloVariante()); + mov.setId_articoloTaglia(row.getRigaDocumentoPrelevata().getId_articoloTaglia()); + mov.setId_clifor(row.getRigaDocumentoPrelevata().getDocumento().getId_clifor()); + MagFisico mf = new MagFisico(apTarget); + mf.findMagazzinoOrdinato(); + mov.setId_magFisico(mf.getId_magFisico()); + mov.setId_rigaDocumento(row.getId_rigaDocumento()); + mov.setNr(-1.0D * row.getQuantitaPrelevata()); + rp = mov.save(); + } else { + System.out.println("!!! " + row.getRigaDocumentoPrelevata().getDocumento().getNumeroDocumentoCompleto()); + row.superDelete(); + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + } + } + stop = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("start 3: " + stop.toString()); + if (step3) { + i = 0; + j = 0; + Articolo art = new Articolo(apTarget); + ArticoloCR CR = new ArticoloCR(); + CR.setFlgQta(1L); + CR.setQtaDa(1L); + CR.setQtaA(99999999L); + Vectumerator vec = art.findByCR(CR, 0, 0); + long tot = (long)vec.getTotNumberOfRecords(); + Movimento mov = new Movimento(apTarget); + System.out.println("Articolio: tot record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + System.out.println(row.getNome()); + if (row.getFlgUsaVarianti() == 1L) { + ArticoloVariante av = new ArticoloVariante(apTarget); + Vectumerator vecAv = av.findById_articolo(row.getId_articolo(), 0, 0, -1L, -1L); + while (vecAv.hasMoreElements()) { + ArticoloVariante rowAV = (ArticoloVariante)vecAv.nextElement(); + Movimento.aggiornaDispo(apTarget, rowAV.getId_articolo(), rowAV.getId_articoloVariante(), 0L, 1L); + } + } else { + Movimento.aggiornaDispo(apTarget, row.getId_articolo(), 0L, 0L, 1L); + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + } + stop = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("start 4: " + stop.toString()); + if (step4) { + i = 0; + j = 0; + RigaDocumento rd = new RigaDocumento(apTarget); + Vectumerator vec = rd.findRigheDocumentoPrelevateDaStornare(); + long tot = (long)vec.getTotNumberOfRecords(); + Movimento mov = new Movimento(apTarget); + System.out.println("Righe documento ordine da stornare: tot record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + row.aggiornaMovimentoPareggioRigaPrelevata(); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + } + if (step5) { + i = 0; + j = 0; + RigaDocumento rd = new RigaDocumento(apTarget); + Vectumerator vec = rd.findRigheDocumentoPrelevateDaStornare(); + long tot = (long)vec.getTotNumberOfRecords(); + Movimento mov = new Movimento(apTarget); + System.out.println("Righe documento ordine da stornare: tot record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + row.aggiornaMovimentoPareggioRigaPrelevata(); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + } + stop = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("STOP: " + start.toString()); + System.out.println("DURATA: " + (double)(stop.getTime() - start.getTime()) / 60000.0D + " minuti"); + System.out.println("Fine"); + System.out.println(rp.getMsg()); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/AggiornaMagRigaDocumento.java b/decompiled-libs/www/acxent-common-1.0.1/AggiornaMagRigaDocumento.java new file mode 100644 index 00000000..ae727780 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/AggiornaMagRigaDocumento.java @@ -0,0 +1,69 @@ +import it.acxent.contab.Documento; +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Timestamp; +import java.util.Calendar; + +public class AggiornaMagRigaDocumento extends DbConsole { + public static void main(String[] args) { + AggiornaMagRigaDocumento bean = new AggiornaMagRigaDocumento(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + int i = 0, j = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String db = "ravinale"; + boolean step1 = true, step2 = true, step3 = true, step4 = true, step5 = true; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 60)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + long l_id_articolo = 0L; + ResParm rp = new ResParm(true); + int pagerow = 1000; + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("START: " + start.toString()); + if (step1) { + i = 0; + System.out.println("Import All Movimento"); + RigaDocumento rd = new RigaDocumento(apTarget); + Vectumerator vec = rd.findByDocumento(51L, -1L, "", 0, 0, 0); + Documento documento = new Documento(apTarget); + documento.findByPrimaryKey(51L); + System.out.println("tot record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + rd = (RigaDocumento)vec.nextElement(); + System.out.println(rd.getArticoloVariante().getCodiceVariante() + " " + rd.getArticoloVariante().getCodiceVariante() + " " + rd.getArticoloVariante().getQuantitaEffettivaAv()); + if (rd.getArticoloVariante().getQuantitaEffettivaAv() == 0.0D) { + rp = Documento.addRigaDocumento(documento, rd); + if (rd.getArticoloVariante().getQuantitaEffettivaAv() == 0.0D) + System.out.println("" + + rd.getArticoloVariante().getQuantitaEffettivaAv() + " " + rd.getArticoloVariante().getQuantitaEffettivaAv()); + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + } + Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis()); + stop = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("STOP: " + start.toString()); + System.out.println("DURATA: " + (double)(stop.getTime() - start.getTime()) / 60000.0D + " minuti"); + System.out.println("Fine"); + System.out.println(rp.getMsg()); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/AggiornaRDMOV.java b/decompiled-libs/www/acxent-common-1.0.1/AggiornaRDMOV.java new file mode 100644 index 00000000..48c2ae5d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/AggiornaRDMOV.java @@ -0,0 +1,77 @@ +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.RigaDocumentoCR; +import it.acxent.contab.RigaDocumentoP; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Timestamp; +import java.util.Calendar; + +public class AggiornaRDMOV extends DbConsole { + public static void main(String[] args) { + AggiornaRDMOV bean = new AggiornaRDMOV(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + int i = 0, j = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String db = "guidoreni14"; + boolean step1 = false, step2 = true, step3 = true, step4 = true, step5 = true; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 60)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + long l_id_articolo = 0L; + ResParm rp = new ResParm(true); + int pagerow = 1000; + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("START: " + start.toString()); + if (step1) { + System.out.println("CICLO RIGA DOCUMENTO"); + i = 0; + RigaDocumento rd = new RigaDocumento(apTarget); + RigaDocumentoCR CR = new RigaDocumentoCR(apTarget); + int nrighe = 100000; + int recordCancellati = 0; + int npag = 1; + Vectumerator vec; + while ((vec = rd.findByCR(CR, npag, nrighe)).hasMoreElements()) { + npag++; + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + rp = row.saveMagSuRIgaDocumento(); + if (!rp.getStatus()) + System.out.println(rp.getMsg()); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " PAG. " + i + " / " + npag); + } + } + } + Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("STOP: " + start.toString()); + System.out.println("DURATA: " + (double)(stop.getTime() - start.getTime()) / 60000.0D + " minuti"); + start = stop; + if (step2) { + RigaDocumentoP rdp = new RigaDocumentoP(apTarget); + rdp.aggiustaOrdiniSuRD(); + } + stop = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("STOP: " + start.toString()); + System.out.println("DURATA: " + (double)(stop.getTime() - start.getTime()) / 60000.0D + " minuti"); + System.out.println("Fine"); + System.out.println(rp.getMsg()); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/AggiustaArticoloUsato.java b/decompiled-libs/www/acxent-common-1.0.1/AggiustaArticoloUsato.java new file mode 100644 index 00000000..0607276f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/AggiustaArticoloUsato.java @@ -0,0 +1,108 @@ +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.art.ArticoloUsato; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Time; +import java.util.StringTokenizer; + +public class AggiustaArticoloUsato extends DbConsole { + public static void main(String[] args) { + AggiustaArticoloUsato bean = new AggiustaArticoloUsato(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "tf19"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Articolo bean = new Articolo(apTarget); + System.out.println("ciclo articoli"); + ArticoloCR CR = new ArticoloCR(); + CR.setFlgOrderBy(1L); + CR.setFlgUsato(99L); + CR.setFlgEscludiWeb(-1L); + long currentidAU = 0L; + Vectumerator vec = bean.findByCR(CR, 0, 0); + ArticoloUsato au = new ArticoloUsato(apTarget); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + boolean daInvertire = false; + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + Vectumerator vecAU = au.findByArticoloOrdineManuale(row.getId_articolo()); + currentidAU = 0L; + daInvertire = false; + while (vecAU.hasMoreElements()) { + ArticoloUsato rowAU = (ArticoloUsato)vecAU.nextElement(); + if (rowAU.getId_articoloUsato() > currentidAU) { + currentidAU = rowAU.getId_articoloUsato(); + continue; + } + System.out.println("DA INVERTIRE articolo: " + row.getId_articolo() + " " + row.getCodice()); + daInvertire = true; + break; + } + if (daInvertire) { + vecAU.moveFirst(); + while (vecAU.hasMoreElements()) { + ArticoloUsato rowAU2 = (ArticoloUsato)vecAU.nextElement(); + ArticoloUsato rowNew = new ArticoloUsato(apTarget); + rowNew.findByPrimaryKey(rowAU2.getId_articoloUsato()); + rowNew.setDBState(0); + rowNew.setId_articoloUsato(0L); + rowNew.save(); + rowAU2.delete(); + } + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " / " + i); + } + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/ArrotondaArticoli.java b/decompiled-libs/www/acxent-common-1.0.1/ArrotondaArticoli.java new file mode 100644 index 00000000..43e6a38d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/ArrotondaArticoli.java @@ -0,0 +1,80 @@ +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Time; +import java.util.StringTokenizer; + +public class ArrotondaArticoli extends DbConsole { + public static void main(String[] args) { + ArrotondaArticoli bean = new ArrotondaArticoli(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "guidoreni"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Articolo bean = new Articolo(apTarget); + ArticoloCR CR = new ArticoloCR(); + CR.setId_iva((long)bean.getParm("CODICE_IVA_STD_VEND").getNumeroInt()); + Vectumerator vec = bean.findByCR(CR, 0, 0); + System.out.println("ciclo articoli"); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + row.arrotondaPrezzoPubblicoConIva(); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt( + st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt( + st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/ArticoliPulisciImmagini.java b/decompiled-libs/www/acxent-common-1.0.1/ArticoliPulisciImmagini.java new file mode 100644 index 00000000..370c0964 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/ArticoliPulisciImmagini.java @@ -0,0 +1,78 @@ +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Time; +import java.util.StringTokenizer; + +public class ArticoliPulisciImmagini extends DbConsole { + public static void main(String[] args) { + ArticoliPulisciImmagini bean = new ArticoliPulisciImmagini(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "tf19xxxxxx"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Articolo bean = new Articolo(apTarget); + System.out.println("ciclo articoli"); + ArticoloCR CR = new ArticoloCR(); + CR.setFlgEscludiWeb(0L); + Vectumerator vec = bean.findByCR(CR, 0, 0); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + row.deleteImmaginiSporche(); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " / " + i); + } + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/ArticoliSistemaCodiciAlternativi.java b/decompiled-libs/www/acxent-common-1.0.1/ArticoliSistemaCodiciAlternativi.java new file mode 100644 index 00000000..1790c76e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/ArticoliSistemaCodiciAlternativi.java @@ -0,0 +1,85 @@ +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Time; +import java.util.StringTokenizer; + +public class ArticoliSistemaCodiciAlternativi extends DbConsole { + public static void main(String[] args) { + ArticoliSistemaCodiciAlternativi bean = new ArticoliSistemaCodiciAlternativi(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "cc"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Articolo bean = new Articolo(apTarget); + ArticoloCR CR = new ArticoloCR(); + Vectumerator vec = bean.findByCR(CR, 0, 0); + System.out.println("ciclo articoli sistema codici alternativi"); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + String codiciAltDB = row.getCodiciAlternativi(); + row.aggiornaCodiciAlternativi(true); + if (!codiciAltDB.equals(row.getCodiciAlternativi())) + System.out.println("\n" + row.getCodice() + " " + codiciAltDB + " --> " + row.getCodiciAlternativi()); + if (row.getCodiciAlternativi().isEmpty()) { + ResParm rp = row.delete(); + System.out.println("\n" + row.getCodice() + " cancellato: " + rp.getStatus()); + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + "/" + i); + } + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/ArticoliTipoAcc.java b/decompiled-libs/www/acxent-common-1.0.1/ArticoliTipoAcc.java new file mode 100644 index 00000000..338179f5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/ArticoliTipoAcc.java @@ -0,0 +1,91 @@ +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Time; +import java.util.StringTokenizer; + +public class ArticoliTipoAcc extends DbConsole { + public static void main(String[] args) { + ArticoliTipoAcc bean = new ArticoliTipoAcc(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "guidoreni"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + long l_id_tipoAcc = 196L; + long l_id_tipoAccOrig = 214L; + long l_id_tipoAccCompat = 229L; + temp = getCi().readLine("id_tipo accessorio root (" + l_id_tipoAcc + "):"); + if (!temp.isEmpty()) + l_id_tipoAcc = Long.valueOf(temp); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Articolo bean = new Articolo(apTarget); + System.out.println("ciclo articoli"); + ArticoloCR CR = new ArticoloCR(apTarget); + CR.setId_tipo(l_id_tipoAcc); + Vectumerator vec = bean.findByCR(CR, 0, 0); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (row.getTipo().getId_tipoPadre() == l_id_tipoAccCompat) { + row.setId_tipoAccessorio(2L); + } else { + row.setId_tipoAccessorio(5L); + } + row.save(); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt( + st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt( + st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/ArticoliUnisciEan.java b/decompiled-libs/www/acxent-common-1.0.1/ArticoliUnisciEan.java new file mode 100644 index 00000000..d89136a5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/ArticoliUnisciEan.java @@ -0,0 +1,64 @@ +import it.acxent.art.Articolo; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import java.sql.Time; +import java.util.StringTokenizer; + +public class ArticoliUnisciEan extends DbConsole { + public static void main(String[] args) { + ArticoliUnisciEan bean = new ArticoliUnisciEan(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "cc"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Articolo bean = new Articolo(apTarget); + System.out.println("ciclo articoli"); + bean.unisciArticoliByCodiceEan(); + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/CCArticoliEAN.java b/decompiled-libs/www/acxent-common-1.0.1/CCArticoliEAN.java new file mode 100644 index 00000000..a3726a3c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/CCArticoliEAN.java @@ -0,0 +1,142 @@ +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Time; +import java.util.StringTokenizer; + +public class CCArticoliEAN extends DbConsole { + public static void main(String[] args) { + CCArticoliEAN bean = new CCArticoliEAN(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "ccxx"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Articolo bean = new Articolo(apTarget); + System.out.println("ciclo articoli con ean duplicati... li cancello....."); + String idArticoli = "82982,82864,82860,82865,82984,82985,82988,82987,82989,82990,82991,82994,82995,82577,82997,82998,83000,83002,82571,83004,82573,83005,83006,82666,83007,82675,83008,83009,83010,83011,83012,83013,83014,83015,83016,83017,83020,82674,83022,83023,83025,83026,83027,83028,83029,83030,83032,83033,83034,83037,83038,83039,83040,83041,83042,83043,83045,82603,83046,83047,83048,82678,83049,83050,83051,83052,83053,82673,83054,83056,83057,83058,83059,83060,83061,83064,83065,83066,83068,83070,83071,83072,83073,83074,83088,83091,84673,83094,83095,83096,83097,83098,82602,83099,83100,83364,83101,82830,85396,82833,82836,82828,85400,83104,83105,83106,85395,85401,85391,85388,83112,83114,83115,84828,84829,84832,82641,83131,82834,83133"; + StringTokenizer st = new StringTokenizer(idArticoli, ","); + long noEs = 0L, escg = 0L; + StringBuilder s_noEs = new StringBuilder(); + StringBuilder s_escg = new StringBuilder(); + StringBuilder s_ebay = new StringBuilder(); + Articolo row = new Articolo(apTarget); + Articolo art = new Articolo(apTarget); + ArticoloCR CR = new ArticoloCR(apTarget); + while (st.hasMoreTokens()) { + long l_id_articolo = Long.parseLong(st.nextToken()); + row.findByPrimaryKey(l_id_articolo); + if (row.getId_articolo() > 0L) + if (row.getCodiciAlternativi().indexOf("ES_") >= 0) { + if (row.getCodiciAlternativi().indexOf("CG_") >= 0) { + System.out.println("da cancellare ma sie esprinet che cgross... controllare: flgvis:" + + row.getFlgEscludiWeb() + " " + row.getCodice()); + escg++; + s_escg.append(row.getId_articolo()); + s_escg.append(","); + if (!row.getCodiceEan().isEmpty()) { + CR.setCodiceEan(row.getCodiceEan()); + Vectumerator vect = art.findByCR(CR, 0, 0); + while (vect.hasMoreElements()) { + Articolo articolo = (Articolo)vect.nextElement(); + if (articolo.getFlgEscludiWeb() > 0L) + articolo.delete(); + } + } + } else if (row.isEbayPubblicato()) { + System.out.println("da cancellare ma su ebay......"); + s_ebay.append(row.getId_articolo()); + s_ebay.append(","); + } else { + System.out.println("Cancello: flgvis:" + row.getFlgEscludiWeb() + " " + row.getCodice()); + row.delete(); + } + } else { + noEs++; + s_noEs.append(row.getId_articolo()); + s_noEs.append(","); + if (!row.getCodiceEan().isEmpty()) { + CR.setCodiceEan(row.getCodiceEan()); + Vectumerator vect = art.findByCR(CR, 0, 0); + while (vect.hasMoreElements()) { + Articolo articolo = (Articolo)vect.nextElement(); + if (articolo.getFlgEscludiWeb() > 0L) { + articolo.delete(); + System.out.println("*"); + continue; + } + if (articolo.getCodiciAlternativi().indexOf("ES_") >= 0) { + if (row.isEbayPubblicato()) { + System.out.println("no es .. trovato es su ebay......"); + s_ebay.append(row.getId_articolo()); + s_ebay.append(","); + continue; + } + System.out.println("*X " + articolo.getCodice()); + ResParm rp = articolo.delete(); + if (!rp.getStatus()) + System.out.println("ERR " + rp.getMsg()); + } + } + } + } + row.save(); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + System.out.println("\n-----" + noEs + " no esprinet:\n" + s_noEs.toString()); + System.out.println("\n-----" + escg + " es+cg:\n" + s_escg.toString()); + System.out.println("\n-----ebay:\n" + s_ebay.toString()); + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/CancellaArticoliNonTrovati.java b/decompiled-libs/www/acxent-common-1.0.1/CancellaArticoliNonTrovati.java new file mode 100644 index 00000000..22cc5331 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/CancellaArticoliNonTrovati.java @@ -0,0 +1,68 @@ +import it.acxent.art.Articolo; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import java.sql.Time; +import java.util.StringTokenizer; + +public class CancellaArticoliNonTrovati extends DbConsole { + public static void main(String[] args) { + CancellaArticoliNonTrovati bean = new CancellaArticoliNonTrovati(); + long numArtNonTrovati = 30L; + if (args.length >= 1) + numArtNonTrovati = (long)Long.valueOf(args[0]).intValue(); + System.out.println(numArtNonTrovati); + bean.doImport(numArtNonTrovati); + System.exit(0); + } + + public void doImport(long numArtNonTrovati) { + String db = "cc"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Articolo bean = new Articolo(apTarget); + System.out.println("ciclo articoli"); + bean.cancellaArticoliVecchiCC(numArtNonTrovati); + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/ClearImgArt.java b/decompiled-libs/www/acxent-common-1.0.1/ClearImgArt.java new file mode 100644 index 00000000..a3d05391 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/ClearImgArt.java @@ -0,0 +1,54 @@ +import it.acxent.art.Articolo; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.util.DbConsole; +import java.sql.Time; +import java.util.StringTokenizer; + +public class ClearImgArt extends DbConsole { + public static void main(String[] args) { + ClearImgArt bean = new ClearImgArt(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "cc"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, null, "root", "root", 1, 10, 300)); + ApplParmFull apTarget8 = new ApplParmFull(new ApplParm(17, "//" + hostname + ":3308/" + db, null, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + Articolo bean = new Articolo(apTarget); + ResParm rp = Articolo.clearImg(bean); + System.out.println(rp.getMsg()); + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/CrontabDbcomune.java b/decompiled-libs/www/acxent-common-1.0.1/CrontabDbcomune.java new file mode 100644 index 00000000..52896670 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/CrontabDbcomune.java @@ -0,0 +1,31 @@ +import it.acxent.common.CrontabInterface; +import it.acxent.common.Parm; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; + +public class CrontabDbcomune implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab Giornaliera ACXENTDBCOMUNE (" + + DBAdapter.getNow().toString() + ")\n#################"); + long t0 = System.currentTimeMillis(); + Parm parm = new Parm(ap); + rp = parm.svuotaCartellaTmp(); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab Giornaliera ACXENTDBCOMUNE (" + DBAdapter.getNow().toString() + ")\n#################"); + long tn = System.currentTimeMillis(); + long duration = (tn - t0) / 60000L; + msg.append("Durata aggiornamento: " + duration + " minuti."); + rp.setMsg(msg.toString()); + return rp; + } + + public static void main(String[] args) { + ApplParm ap = new ApplParm(3, "//localhost/coavedb2", "root", "root"); + ResParm rp = new CrontabDbcomune().crontabJob(new ApplParmFull(ap)); + System.out.println(rp.getMsg()); + System.exit(0); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/DelArticoliEan14.java b/decompiled-libs/www/acxent-common-1.0.1/DelArticoliEan14.java new file mode 100644 index 00000000..19b276e3 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/DelArticoliEan14.java @@ -0,0 +1,78 @@ +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Time; +import java.util.StringTokenizer; + +public class DelArticoliEan14 extends DbConsole { + public static void main(String[] args) { + DelArticoliEan14 bean = new DelArticoliEan14(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "cc"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Articolo bean = new Articolo(apTarget); + System.out.println("ciclo articoli"); + ArticoloCR CR = new ArticoloCR(); + CR.setFlgEscludiWeb(0L); + Vectumerator vec = bean.findArticoliEan14(); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + row.delete(); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " / " + i); + } + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/ExportCliforCsv.java b/decompiled-libs/www/acxent-common-1.0.1/ExportCliforCsv.java new file mode 100644 index 00000000..c224bd31 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/ExportCliforCsv.java @@ -0,0 +1,68 @@ +import it.acxent.anag.Clifor; +import it.acxent.anag.CliforCR; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import java.sql.Time; +import java.util.StringTokenizer; + +public class ExportCliforCsv extends DbConsole { + public static void main(String[] args) { + ExportCliforCsv bean = new ExportCliforCsv(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "guidoreni14"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + Clifor clifor = new Clifor(apTarget); + CliforCR CR = new CliforCR(apTarget); + CR.setFlgTipo("C"); + System.out.println("creo csv cliente"); + clifor.creaFileCvs(CR); + System.out.println("Creato file " + CR.getFileName()); + System.out.println("creo csv fornitore"); + CR.setFlgTipo("F"); + clifor.creaFileCvs(CR); + System.out.println("Creato file " + CR.getFileName()); + System.out.println("fine"); + System.exit(0); + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/ImportArticoliXls.java b/decompiled-libs/www/acxent-common-1.0.1/ImportArticoliXls.java new file mode 100644 index 00000000..efd0376b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/ImportArticoliXls.java @@ -0,0 +1,104 @@ +import it.acxent.anag.Iva; +import it.acxent.anag.ListinoArticolo; +import it.acxent.art.Articolo; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.util.DbConsole; +import it.acxent.util.StringTokenizer; +import java.io.BufferedReader; +import java.io.FileReader; + +public class ImportArticoliXls extends DbConsole { + public static void main(String[] args) { + ImportArticoliXls bean = new ImportArticoliXls(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + int i = 0; + int se1 = 10; + int se2 = 100; + String currentLine = ""; + String hostname = "83.149.159.155"; + String db = "guidoreni14"; + String fileCsv = "/Users/acolzi/Documents/_f3/work/guidoreni/importArticoliXls/4464-DT.csv"; + boolean importArticoli = false; + String temp = ""; + temp = getCi().readLine("importArticoli(" + importArticoli + "):"); + if (!temp.isEmpty()) + importArticoli = temp.equals("y"); + ApplParmFull ap = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + ap.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + int numBanche = 0, numClienti = 0; + if (importArticoli) { + i = 0; + System.out.println("\nimportArticoli"); + Articolo articolo = new Articolo(ap); + BufferedReader reader = new BufferedReader(new FileReader(fileCsv)); + if (reader != null) { + int numbToken = 0; + int colcodice = 0, coldescrizione = 1, colid_tipo = 8, colprice = 6, colmarca = 9, coldescTecnica = 5; + StringBuffer currentArticolo = new StringBuffer(); + for (int j = 0; j < 1; j++) + reader.readLine(); + while ((currentLine = reader.readLine()) != null) { + StringTokenizer st = new StringTokenizer(currentLine, ";"); + String codice = st.getToken(colcodice); + String descrizione = st.getToken(coldescrizione); + String id_tipo = st.getToken(colid_tipo); + String price = st.getToken(colprice); + String marca = st.getToken(colmarca); + String descTecnica = st.getToken(coldescTecnica); + articolo = new Articolo(ap); + articolo.findArticoloByCodice(codice); + if (articolo.getDBState() == 0) { + articolo.setCodice(codice); + articolo.setNome(descrizione); + articolo.setId_tipo(Long.valueOf(id_tipo).longValue()); + articolo.setId_marca(Long.valueOf(marca).longValue()); + articolo.setId_tipoAccessorio(5L); + articolo.setId_iva(6L); + articolo.setDescTxtLang("descrizione", "it", descrizione); + articolo.setDescTxtLang("descrizioneTecnica", "it", descTecnica); + ResParm rp = articolo.superSave(); + if (rp.getStatus()) { + ListinoArticolo listinoArticoloBase = articolo.getListinoArticoloBase(); + listinoArticoloBase.setId_articolo(articolo.getId_articolo()); + listinoArticoloBase.setId_listino(articolo.getListinoBase().getId_listino()); + listinoArticoloBase.setPrezzoLA(Iva.scorporaIva(Double.parseDouble(price.replaceAll(",", ".")), 22.0D)); + rp = listinoArticoloBase.save(); + } else { + System.out.println(rp.getMsg()); + } + } else { + ResParm rp = new ResParm(true); + System.out.println(codice); + if (rp.getStatus()) { + ListinoArticolo listinoArticoloBase = articolo.getListinoArticoloBase(); + listinoArticoloBase.setId_articolo(articolo.getId_articolo()); + listinoArticoloBase.setId_listino(articolo.getListinoBase().getId_listino()); + listinoArticoloBase.setPrezzoLA(Iva.scorporaIva(Double.parseDouble(price.replaceAll(",", ".")), 22.0D)); + rp = listinoArticoloBase.save(); + } else { + System.out.println(rp.getMsg()); + } + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " / "); + } + } + System.out.println("fine ciclo \n\n\n\n\n\n\n\n\n\n\n" + msg.toString()); + } + } catch (Exception e) { + e.printStackTrace(); + System.out.println(currentLine); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/META-INF/MANIFEST.MF b/decompiled-libs/www/acxent-common-1.0.1/META-INF/MANIFEST.MF new file mode 100644 index 00000000..e886b975 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/META-INF/MANIFEST.MF @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +Archiver-Version: Plexus Archiver +Created-By: Apache Maven 3.8.7 +Built-By: jenkins +Build-Jdk: 17.0.17 + diff --git a/decompiled-libs/www/acxent-common-1.0.1/META-INF/maven/it.acxent/acxent-common/pom.properties b/decompiled-libs/www/acxent-common-1.0.1/META-INF/maven/it.acxent/acxent-common/pom.properties new file mode 100644 index 00000000..bed60151 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/META-INF/maven/it.acxent/acxent-common/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Tue Jul 08 00:00:32 CEST 2025 +artifactId=acxent-common +groupId=it.acxent +version=1.0.1 diff --git a/decompiled-libs/www/acxent-common-1.0.1/META-INF/maven/it.acxent/acxent-common/pom.xml b/decompiled-libs/www/acxent-common-1.0.1/META-INF/maven/it.acxent/acxent-common/pom.xml new file mode 100644 index 00000000..6ed2e845 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/META-INF/maven/it.acxent/acxent-common/pom.xml @@ -0,0 +1,140 @@ + + 4.0.0 + it.acxent + acxent-common + 1.0.1 + core 43 + Acxent Common DB + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + 11 + 11 + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.7.0 + + + org.apache.maven.plugins + maven-toolchains-plugin + 3.1.0 + + + + toolchain + + + + + + + 11 + + + + + + + + + github-repo + GitHub Repository + https://maven.pkg.github.com/acolzi/repo + + + + + + github-repo + GitHub acolzi Apache Maven Packages + https://maven.pkg.github.com/acolzi/repo + + + + + com.stripe + stripe-java + 22.29.0 + + + it.acxent + acxent-bank + 1.0.1 + + + + it.acxent + acxent-checkvat + 1.0.0 + + + com.google.api-client + google-api-client + 2.2.0 + + + org.apache.commons + commons-lang3 + 3.12.0 + + + net.ifok.image + image4j + 0.7.2 + + + + it.acxent + ebaysdk-calls + 0.0.2 + + + it.acxent + ebaysdk-core + 0.0.3 + + + + javax.xml.ws + jaxws-api + 2.3.1 + + + com.sun.xml.ws + jaxws-rt + 2.3.3 + + + + com.google.zxing + core + 3.5.2 + + + com.google.zxing + javase + 3.5.2 + + + + + it.acxent + acxent-skebby + 1.0 + + + it.acxent + acxent-core + 1.0.1 + + + + + \ No newline at end of file diff --git a/decompiled-libs/www/acxent-common-1.0.1/SalvaAmzFeatPrice.java b/decompiled-libs/www/acxent-common-1.0.1/SalvaAmzFeatPrice.java new file mode 100644 index 00000000..2d9e5cad --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/SalvaAmzFeatPrice.java @@ -0,0 +1,57 @@ +import it.acxent.art.AmzFeaturedPrice; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import java.sql.Time; +import java.util.StringTokenizer; + +public class SalvaAmzFeatPrice extends DbConsole { + public static void main(String[] args) { + SalvaAmzFeatPrice bean = new SalvaAmzFeatPrice(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "cc"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost:3308"; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + AmzFeaturedPrice afp = new AmzFeaturedPrice(apTarget); + afp.findByPrimaryKey(2L); + afp.save(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/SalvaArticoli.java b/decompiled-libs/www/acxent-common-1.0.1/SalvaArticoli.java new file mode 100644 index 00000000..c3a2fa2a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/SalvaArticoli.java @@ -0,0 +1,81 @@ +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Time; +import java.util.StringTokenizer; + +public class SalvaArticoli extends DbConsole { + public static void main(String[] args) { + SalvaArticoli bean = new SalvaArticoli(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "cc"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "10.0.0.5"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Articolo bean = new Articolo(apTarget); + System.out.println("ciclo articoli"); + ArticoloCR CR = new ArticoloCR(); + CR.setId_tipo(52L); + Vectumerator vec = bean.findByCR(CR, 0, 0); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (row.getFlgControlloCostoAggArt() == 0L) { + System.out.println(row.getCodice() + " " + row.getCodice()); + row.save(); + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " / " + i); + } + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/SalvaArticoliPerListino.java b/decompiled-libs/www/acxent-common-1.0.1/SalvaArticoliPerListino.java new file mode 100644 index 00000000..e5723f46 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/SalvaArticoliPerListino.java @@ -0,0 +1,88 @@ +import it.acxent.anag.Listino; +import it.acxent.anag.ListinoArticolo; +import it.acxent.art.Articolo; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Time; +import java.util.StringTokenizer; + +public class SalvaArticoliPerListino extends DbConsole { + public static void main(String[] args) { + SalvaArticoliPerListino bean = new SalvaArticoliPerListino(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "guidoreni"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "www.lanificiozanieri.eu"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Articolo bean = new Articolo(apTarget); + System.out.println("ciclo articoli"); + Vectumerator vec = bean.findAll(); + Listino lis = Listino.dammiListinoBase(apTarget); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + ListinoArticolo la = new ListinoArticolo(apTarget); + la.findByArticoloListino(row.getId_articolo(), lis.getId_listino()); + la.setId_articolo(row.getId_articolo()); + la.setId_listino(lis.getId_listino()); + la.setPrezzoOffertaLA(row.getImportListinoPrezzoOfferta()); + la.setDataScadenzaOffertaLA(row.getImportListinoDataScadenzaOfferta()); + la.setAbbuonoPrezzoPubblicoLA(row.getImportListinoAbbuonoPrezzoPubblico()); + la.setPercLA(row.getImportListinoPercSconto()); + la.setDataCambiamentoPrezzoLA(row.getImportListinoDataCambiamentoPrezzo()); + la.setAbbuonoPrezzoPubblicoLA(row.getImportAbbuonoPrezzoPubblico()); + la.save(); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/SalvaArticoliVariante.java b/decompiled-libs/www/acxent-common-1.0.1/SalvaArticoliVariante.java new file mode 100644 index 00000000..791d3a54 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/SalvaArticoliVariante.java @@ -0,0 +1,78 @@ +import it.acxent.art.ArticoloVariante; +import it.acxent.art.ArticoloVarianteCR; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Time; +import java.util.StringTokenizer; + +public class SalvaArticoliVariante extends DbConsole { + public static void main(String[] args) { + SalvaArticoliVariante bean = new SalvaArticoliVariante(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "ravinale"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + ArticoloVariante bean = new ArticoloVariante(apTarget); + System.out.println("ciclo articoli varianti"); + ArticoloVarianteCR CR = new ArticoloVarianteCR(); + CR.setFlgEscludiWeb(0L); + Vectumerator vec = bean.findByCR(CR, 0, 0); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + ArticoloVariante row = (ArticoloVariante)vec.nextElement(); + row.save(); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/SalvaDtess.java b/decompiled-libs/www/acxent-common-1.0.1/SalvaDtess.java new file mode 100644 index 00000000..27c4cd78 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/SalvaDtess.java @@ -0,0 +1,81 @@ +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoCR; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Time; +import java.util.StringTokenizer; + +public class SalvaDtess extends DbConsole { + public static void main(String[] args) { + SalvaDtess bean = new SalvaDtess(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "tex"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Documento bean = new Documento(apTarget); + System.out.println("ciclo Documento"); + DocumentoCR CR = new DocumentoCR(); + CR.setId_tipoDocumento(24L); + Vectumerator vec = bean.findByCR(CR, 0, 0); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + System.out.print(row.getStatoLavorazione() + " ---> "); + row.setFlgStatoLavorazione(0L); + row.save(); + System.out.println(row.getStatoLavorazione()); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/SalvaTessuti.java b/decompiled-libs/www/acxent-common-1.0.1/SalvaTessuti.java new file mode 100644 index 00000000..6aafd1a0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/SalvaTessuti.java @@ -0,0 +1,79 @@ +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.tex.anag.ArticoloTessuto; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Time; +import java.util.StringTokenizer; + +public class SalvaTessuti extends DbConsole { + public static void main(String[] args) { + SalvaTessuti bean = new SalvaTessuti(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "tf19"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + ArticoloTessuto bean = new ArticoloTessuto(apTarget); + System.out.println("ciclo tessuti"); + Vectumerator vec = bean.findAll(); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + ArticoloTessuto row = (ArticoloTessuto)vec.nextElement(); + if (row.getCodiceAT().length() < 4) { + row.setCodiceAT(DBAdapter.zeroLeft(row.getCodiceAT(), 4)); + row.superSave(); + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/SalvaTipi.java b/decompiled-libs/www/acxent-common-1.0.1/SalvaTipi.java new file mode 100644 index 00000000..11e8a07c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/SalvaTipi.java @@ -0,0 +1,80 @@ +import it.acxent.art.Tipo; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.net.URLEncoder; +import java.sql.Time; +import java.util.StringTokenizer; + +public class SalvaTipi extends DbConsole { + public static void main(String[] args) { + SalvaTipi bean = new SalvaTipi(); + System.out.println(URLEncoder.encode("e:/public")); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "guidoreni"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Tipo bean = new Tipo(apTarget); + bean.update("UPDATE ARTICOLO SET flgEscludiWebArt=-1"); + System.out.println("ciclo tipi "); + Vectumerator vec = bean.findAll(); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + Tipo row = (Tipo)vec.nextElement(); + row.save(); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + System.out.println("\n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt( + st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt( + st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/SaveDocumento.java b/decompiled-libs/www/acxent-common-1.0.1/SaveDocumento.java new file mode 100644 index 00000000..e999870a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/SaveDocumento.java @@ -0,0 +1,54 @@ +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoCR; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import it.acxent.util.Timer; +import it.acxent.util.Vectumerator; + +public class SaveDocumento extends DbConsole { + public static void main(String[] args) { + SaveDocumento bean = new SaveDocumento(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "ncc"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost:3308"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(17, "//" + hostname + "/" + db, db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + DocumentoCR CR = new DocumentoCR(); + Vectumerator vec = new Documento(apTarget).findByCR(CR, 0, 0); + System.out.println("TOT RECORD: " + vec.getTotNumberOfRecords()); + Timer timer = new Timer(); + timer.start(); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + row.superSave(); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " /" + i + " " + vec.getTotNumberOfRecords()); + } + timer.stop(); + System.out.println(timer.getDurata()); + System.out.println("\n\n ------------- Fine ---------------"); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/TestExport.java b/decompiled-libs/www/acxent-common-1.0.1/TestExport.java new file mode 100644 index 00000000..5e1d10e1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/TestExport.java @@ -0,0 +1,69 @@ +import it.acxent.common.DescTxtLang; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.util.DbConsole; +import java.sql.Time; +import java.util.StringTokenizer; + +public class TestExport extends DbConsole { + public static void main(String[] args) { + TestExport bean = new TestExport(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "guidoreni"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + String dbTarget = "gaias"; + System.out.println("Db: " + db); + ApplParmFull apSource = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apSource.setDebug(false); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + dbTarget, "root", "root", 1, 10, 300)); + apSource.setDebug(false); + try { + DescTxtLang bean = new DescTxtLang(apSource); + DescTxtLang beant = new DescTxtLang(apTarget); + ResParm rp = beant.xmlImport("/Users/acolzi/test.xml"); + System.out.println(rp.getMsg()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt( + st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt( + st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/TestMysql8.java b/decompiled-libs/www/acxent-common-1.0.1/TestMysql8.java new file mode 100644 index 00000000..b7f94151 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/TestMysql8.java @@ -0,0 +1,78 @@ +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoCR; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Time; +import java.util.StringTokenizer; + +public class TestMysql8 extends DbConsole { + public static void main(String[] args) { + TestMysql8 bean = new TestMysql8(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "cc"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget57 = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "cc", "root", "root", 1, 10, 300)); + ApplParmFull apTarget8 = new ApplParmFull(new ApplParm(17, "//" + hostname + ":3308/" + db, db, "root", "root", 1, 10, 300)); + apTarget57.setDebug(false); + apTarget8.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Documento bean = new Documento(apTarget57); + bean.findByPrimaryKey(2306L); + System.out.println(bean.getDescRecordHeader()); + System.out.println(bean.getDescRecordLine()); + System.out.println("" + bean.getId_documento() + " " + bean.getId_documento()); + ResParm rp = bean.save(); + System.out.println(rp.getMsg()); + Vectumerator vec = bean.findByCR(new DocumentoCR(), 1, 10); + System.out.println(bean.getDescRecordHeader()); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + System.out.println(row.getDescRecordLine()); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/TestReflection.java b/decompiled-libs/www/acxent-common-1.0.1/TestReflection.java new file mode 100644 index 00000000..5cbb9257 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/TestReflection.java @@ -0,0 +1,95 @@ +import it.acxent.cc.Attivita; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.util.DbConsole; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.sql.Date; +import java.sql.Time; + +public class TestReflection extends DbConsole { + public static void main(String[] args) { + new TestReflection().test(); + } + + private static boolean isNotEmpty(Object valueUpd, Class tipo) { + boolean ret = false; + if (valueUpd != null) { + String sclass = valueUpd.getClass().getName(); + if (sclass.indexOf("Long") > 0 || sclass.indexOf("Double") > 0 || sclass.indexOf("String") > 0 || sclass.indexOf("Date") > 0 || + sclass.indexOf("Time") > 0) + if (tipo.getName() == "long") { + if ((Long)valueUpd == 0L || (Long)valueUpd == -1L) { + ret = false; + } else { + ret = true; + } + } else if (tipo.getName() == "double") { + if ((Double)valueUpd == 0.0D) { + ret = false; + } else { + ret = true; + } + } else if (tipo.getName().indexOf("String") > 0) { + if (((String)valueUpd).equals("") || ((String)valueUpd).isEmpty()) { + ret = false; + } else { + ret = true; + } + } else if (tipo.getName().indexOf("Date") > 0) { + Date data = (Date)valueUpd; + if (data == null) { + ret = false; + } else { + ret = true; + } + } else if (tipo.getName().indexOf("Time") > 0) { + if ((Time)valueUpd == null) { + ret = false; + } else { + ret = true; + } + } + } + return ret; + } + + private static Object getFunctionName(String functionName, Class tipo, CRAdapter thiss) { + Object value = null; + try { + Method method = thiss.getClass().getMethod(functionName); + value = method.invoke(thiss); + } catch (SecurityException e) { + + } catch (NoSuchMethodException e) { + + } catch (IllegalArgumentException e) { + + } catch (IllegalAccessException e) { + + } catch (InvocationTargetException e) {} + return value; + } + + public void test() { + String db = "fotoeventi4"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "localhost:3308"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParm ap = new ApplParm(17, "//" + hostname + "/" + db, db, "root", "root", 1, 10, 300); + ApplParmFull apTarget = new ApplParmFull(ap); + apTarget.setDebug(false); + Attivita attivita = new Attivita(apTarget); + DBAdapter.checkSerializable(attivita); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/com/ablia/anag/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/com/ablia/anag/package-info.java new file mode 100644 index 00000000..96c8bd47 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/com/ablia/anag/package-info.java @@ -0,0 +1 @@ +package it.acxent.anag; \ No newline at end of file diff --git a/decompiled-libs/www/acxent-common-1.0.1/com/ablia/anag/versionLog.txt b/decompiled-libs/www/acxent-common-1.0.1/com/ablia/anag/versionLog.txt new file mode 100644 index 00000000..c2fca80c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/com/ablia/anag/versionLog.txt @@ -0,0 +1,249 @@ +AblDBCom_2_329_1_250523 +25-05-2022 OrderedRowids e AblServlet.setOrderedIdOnSession per gesione avanti indietro per qualsiasi ricerca (SpeseDetraiviliSvlt) +25-05-2023 8xmille + fix getAttach +16-05-2023 face + news visibili +25-03-2023 AMAZON... allineamento.. .manca publish +23-02-2023 aggiunto dati scontrino felettronica. Magazzino tessuti e filati ... +17-02-2023 fix articolo.findbycr codicialternativi senza spezzettare i token +22-01-2023 cc +18-11-2022 icecat, bulk update e bartolini +14-07-2022 social login google + blacklist mailer cc +17-06-2022 implementazione import runner.it framework cc +02-05-2022 nazione con importo minimo per carrello + articolo con sconto troppo alto +29-03-2022 Trovaprezzi trust program +17-03-2022 Trovaprezzi +15-03-2022 CartSvlt gestione listaTipoPagmaneto con personalizzazione per il cliente... CliforTipoPagamento... +28-02-2022 registro iva OSS +21-02-2022 report documenti e servizi (molli). salvato report righe documento che non so.... +18-02-2022 articolo... desc search adesso contiene anche le caratteristiche... +09-02-2022 Contrassegno ravinale e gestione costo contrassegno su tipo pagamento... +06-02-2022 Marca tagOfferta. Corretto auto offerte. aggiunto gestione promo su marca tramite tagOfferta +04-02-2022 Articolo.getLingCcInfo(CR) per mail info..... +29-01-2022 Salvataggio documento e riga documento con controllo emsta.Articolo gestito correttamente aggiornamento percentuale effettiva di ricarico +19-01-2022 CC crea sitemap tramite crontab +14-01-2022 getImportLinkFornitoreEan... +14-11-2021 CC gestione iva cee extracee corretta (da verificare con vivarelli) +8-07-2021 ean su variante, sconto offerta framework CC, iva regime margine, abilita articolo_fornitore su fornitore +13-06-2021 descPayment su cart... framweork cc +07-06-2021 gestione costo spedizione con percentile +17-03-2021 gestione kit framework cc + invio ip e timestamp su mail framework cc +12-02-2021 risitemato gestione lang... non ancora ottimale perché dipende ta classe jsp.Ab e da _V4/_inc_lang.jsp +18-01-2021 cc in linea e funzionante. Ultima cosa mail da documento e bcc su mail dal sito +27-06-2020 implemEntazione attivita cc +15-11-2018 catalogo articolo con scelta risoluzione +23-10-2018 aggiunto parametro per esplicitare campo codice in stampa della riga senza articolo in db (atelier). Nuovo campo codiceIdentificativoFE su clifor per fattura elettronica +13-10-2018 stampa catalogo articoli con filtro su quantità. corretto ricerca per quantità fino a variante. da fare fino a taglie +10-09-2018 CORRETTO CONTROLLO PROTOCOLLO DOCUMENTO +13-09-2018 corretto getFlgUdm su riga documento +31-07-2018 corretto taglib banner con rewriterule ad,Banner.abl,go,,@id e convertStringToLink su f3.jar +11-05-2018 aggiunto gestione blog e corretto baco per altri file (templatemsg nonfunzionava più) +13-12-2017 aggiunto ordinamento righe documenti in stampa e edit +08-11-2017 duplica articolo, aggiornamenti V4 +02-10-2017 catalogo prodotti + gestione taglie!!! +14-06-2017 aggiustato magazzino su articolo variante. reso quantitaW inutile.... da togliere??? +14-02-2017 corretto creazione scadenze. Messo vincoli se sono state generate distinte riba. MUI IMPORTANTE +22-11-2016 listino con 3 sconti + altro atelier +10-11-2016 corretto baco listino base +12-10-2016 banner con w e h stringhe +07-09-2016 nuovo listino. eseguire sql fino a 144, eseguire salvaarticoloperlistino, rinominare dir immagini varianti in _imgArt/_var/ +14-07-2016 aggiustamento findwebByarticolocr su articolo variante. Xpay +24-06-2016 riba + documento.sendmail corretto +13-06-2016 aggiustato per propagazione codice utente. Report movimenti compatto +10-05-2016 documentosvl aggiustato invio mail per CR.Corretto ordinamento fatture (per data riferimento solo per fatt. e nc del fornitore) +12-04-2016 nuova addrigadocumento. lista documento ordinata per datariferimento se fattura fornitore +05-04-2016 Nazione + zona + documento + imgusr +23-02-2016 bannerlisttag +28-01-2016 articolofornitore.findById_articoloFornitore +27-01-2016 corretto stampa slip. log separati +28-10-2015 tolto gestione pagerow su prenotazione perchè dava fastidio a cassa che su dettaglio non ha salto pagina +27-10-2015 calcolaQuantita su articolo variante +20-10-2015 numero righe documento su prenotazione corretto +20-10-2015 corretto nuvoletta con lista articoli variante Movimento.findSaldiArticoloVarianteTagliaByCR +13-10-2015 allineamento per guidoreni. Corretto lista documento pagamento su refresh documento +27-07-2015 report pdf pagamento corretto (numeri fornitori). Ordinamento documento pagamento dipendente da attivo/passivo +23-07-2015 super su documento +30-06-2015 banner tag css +24-06-2015 newssvlt _getTimeline +24-06-2015 corretto aggiornamento stato prenotazione (forse) +23-05-2015 corretto errore salvataggio documento nell'impostazione del pagamento +15-06-2015 corretto errore salvataggio riga documento nella creazione dei figli. Da verificare le qta prenotazioni in caso di scarico parziale +12-06-2015 controllo errori guidoreni +11-06-2015 stampe documento pagamento +05-06-2015 corretto documento pagamento +01-06-2015 riferimento su tipodocumento e creazione documentopdf solo se necessario +22-05-2015 AGGIUSTATO CONTROLLO EMSTA DOCUMENTI +18-05-2015 attivata gestione stampa provvisoria nel caso di blocco salvataggio documento dopo la stampa, modificata gestione pagamenti: inserito tipo di pagamento (acconto/saldo) +11-05-2015 corretto sms sender +05-05-2015 corretto aggiornamento flgDispo su cancellazione riga documento +28-04-2015 corretto preleva documento: rifatto cancella movimenti:cancella solo i movimenti relativi ai magazzini movimentati. ottimizzato metodo Documento.addRigaDocumentoDaPrelevare +24-04-2015 corretto aggiornamento stato prenotazione su modifica e cancella righe prenotazione +10-04-2015 corretto chiamate listaRigheOrdini e figli su DocumentoSvlt. Corretto aggiornamento dispo si cancellazione riga +08-04-2015 correzione flgEmettiFatturaDaScontrino e stampe fattura +23-03-2015 nuova versione stampa documenti +19-03-2015 corretto impegno + varie +12-03-2015 agg. vari. corretto quantitamagazzinohtml (salvataggio) +10-03-2015 correzione aggiornadispo per azzeramento quantitàhtml +05-03-2015 ShowTemplateMsgWww ripristinato per tuttofoto +03-03-2015 gestione scadenza pwd +23-02-2015 banca e swift +17-02-2015 correzione gestione divieto di salvataggio se stampata. Prima data disponibile documento da xx a emessa. corretto datastampa doc su stampe massive +09-02-2015 CaratteristicaArticolo.getVal(lang) +07-01-2015 articolo.creaFileCvs corretto imprecisione csv +06-01-2015 alcune modifiche per regime margine tf + inizio pagamenti per coave +16-12-2014 gestione prenotazioni fast +11-12-2014 scale image : aggiunto watermark con immagine +03-12-2014 ottimizzata ricerca articoli e stringa magazzino +28-11-2014 aggiunto flag su articoloVariante per l'aggiornamento di zanieri +27-11-2014 gestione invio mail news agli utenti abilitati tramite il flag flgNews e lista di visualizzazione invii utenti +26-11-2014 associazione users clifor + flgNews su users e associativa NEWS_USERS +25-11-2014 invio fattura tramite link offuscato +17-11-2014 allineamento con updateCart su f3.jar +14-11-2014 newsletter corretto baco, modificato campo indirizzo, email unique + abbuono su articolo solo per visualizzazione +13-11-2014 guidoreni gestione slip con contatore slip stampate su rigadocumento + data documento su movimento +07-11-2014 gestione mailNewsletter +29-10-2014 aggiunto orderby su news +09-10-2014 campo mail in coda messaggi +25-09-2014 aggiornamento templatemsg +31-07-2014 Aggiornamnento interfaccia CartItemInterface +24-07-2014 corretto ordine lista taglie per sito web +22-07-2014 modriga tolto autoadd +17-07-2014 testato magazzino e documento con magazzino in movimento e senza magazzino. Manca cassa e gestione magazzino taglie +03-07-2014 gestione parametro usa magazzino su articolo, articolvariante e riga documento +02-07-2014 corretto bug gestione tipologia fornitore (tolta tabella TIPOLOGIA_FORNITORE e gestita con CLIFOR_TIPO_CLIFOR) +24-06-2014 fix ricerca clifor x regione atelier +09-05-2014 magazzino nuovo: + aggiunto flgInterno su mag_fisico +aggiunto flgInternoPartenza e Arrivo su causale magazzino: verificare le nuovi causali magazzino +aggiunto tipologie articoli dove mettiamo le unità di misura. Aggiunta combo su articolo. + + +28-03-2014 news aggiornate +13-03-2014 agg. vari atelier + inizio magazzino 2 +24-02-2014 campi dinamici su cosa messaggi +17-02-2014 nuova gestione stati prenotazione + aggiornamento nuove pagine di amministrazione +10-12-2013 taglib vetrina findrandomarticolo aggiunto escliudiweb +03-12-2013 modificato flgDocumentoVerificato su clifor e aggiunte costanti +28-11-2013 nuova versione news +11-11-2013 nuova gestione listini. Da testare guidoreni. Nuova gestione news (lingue+ v3) +28-10-2013 logon utente www controllo partita iva. left join disponibilità su articolo.findser +16-10-2013 findFigli con select .. in(select..) molto lenta con mysql5.5. Ottimizzato isUnDocumentoFiglio. +15-10-2013 da prenotazione a cassa verificato + gestione acconto!!! +01-10-2013 aggiornamento articolo.findv con union per gestione tagle. Manca findSer con union!!! +30-09-2013 AGGIORNAMENTI VARI mail fabio. gestione taglie. +30-07-2013 AGGIORNAMENTI VARI... RIPARAZIONI + STRINGCASE. +27-07-2013 modificato Documento->applicaListinoByClifor per ricalcolare il prezzo offerta sull'amministrazione. +26-07-2013 nuova gestione legami righe fatture. +03-07-2013 logRecord + varie. +01-07-2013 corretto creaDocumentofiglio: qta su doc padre. +30-06-2013 corretto creaDocumentofiglio: metteva qta=0.. +28-06-2013 modifiche varie fabio su cassa nuova +18-06-2013 modifiche su nuova cassa + varie +13-06-2013 aggiunto filtro per operatore su lista documenti +13-06-2013 cambiato orientamento stampa report giornaliero in orizzontale +13-06-2013 aggiunte colonne ntel e operatore su report giornaliero e fatto raggruppamento per tipologia +13-06-2013 inserita notaBarcode su creazione documenti figli +13-06-2013 cambiato ordinamento lista articoli cassa +13-06-2013 stampa su scontrino aliquota iva non standard +10-06-2013 chiusura cassa + ifvetrina +07-06-2013 gestione cassa verificato +varie shopping www +04-06-2013 gestione cassa.... da verificare +28-05-2013 indici tipo + correzioni varie +25-05-2013 corretto creazione doc figli (gestione disponibilità nel caso di movimentazione magazzino). Lista prenotazioni default aperte +24-05-2013 gestione lingue su tipo pagamento. flgRitiroNegozio su documento e flgAblìilita negozio e corriere su tipo pagamento +14-05-2013 gestione lingue su articolo variante.. correzioni +13-05-2013 gestione lingue su caratteristiche e liste +09-05-2013 allineamento nuovo carrello f3.jar Abl_14_39_24_090513 +08-05-2013 tolto definitivamente nominativo da clifor +06-05-2013 CatalogoSvlt. Gestito caso in cui sul dettaglio voglio comunque vedere l'articolo (passo act=articolo) +28-04-2013 tipo con immagini. Desc in lingua su tipo e articolo +23-04-2013 tipo con descrizioni in lingua +15-04-2013 +27-03-2013 aggiornamenti wwwguidoreni tolto telefono da intestazione fattura +14-02-2013 aggiornamenti wwwguidoreni + tipo con ggArticoloEscludiweb +06-02-2013 flgNascondi su tipo documento + campi agg. su clifor +29-01-2013 aggiornamento www guidoreni. articoli non dispon. su web +24-01-2013 aggiornamento www guidoreni +07-12-2012 coda messaggi addimginterface +30-11-2012 crea doc figlio funziona solo da document che hanno scaricato a quelli che non hanno scaricato. Da gestire ordini web +15-11-2012 ecom.. aggiornamento ricerca prenotazioni +12-11-2012 ecom.. aggiornamento carrello e correzione listini su cassa +12-11-2012 ecom.. aggiornamento tipo accessori +16-10-2012 allineamento nuova versione f3.jar +28-09-2012 modifiche www e coave +24-07-2012 banner testuali +24-07-2012 correzioni guidoreni. stampa zebra. gestione ricerca compatibilità +29-06-2012 varie correzioni guidoreni +12-04-2012 clifor.getNominativoCompleto +05-04-2012 corretto ricerche su categorie e liste dovuto a _it +15-04-2012 corretto code messaggi. Corretto gestione immagini su articoli. Find articoli searchtxt anche su marca +22-02-2012 aggiunto deleteForce su documenti +13-02-2012 varie correzioni documenti per guidoreni +10-02-2012 CORRETTO CODA MESSAGGI(GESTIONE TIMESTAMP PRIMA DI UNO SHOW BEAN). MAIUSCOLE AUTOMATICHE SU CLIFOR +03-02-2012 aggiunto getTotale su RigaRegistroIva +13-01-2012 coda messaggi con numero immagini quasi libero.. +10-01-2012 data pagamento documento +29-12-2011 varie correzioni e aggiornamenti per guidoreni +02-12-2011 varie correzioni tra cui legame documento padre su riga documento +15-11-2011 corretto calcolo iva per valori in testata +02-11-2011 getStringValueCase asis per allegati +02-11-2011 tolto toUpperCase su Clifor.getCognome. Dipende giustamente da getStringValueCase +31-10-2011 corretto ottimizzazione ricerca coda messaggi per sql server +06-10-2011 Iva. aggiunto id_ivaDoc su documenti. Aggiornato fattura professionista +16-09-2011 Iva. rinominati parametri standard iva. distinziona c/acq e c/vendita +16-09-2011 ArticoloFornitore.getCostoIvato corretto arrotondamenti per 21% +08-09-2011 corretto tot record articoli, eliminazione disponibilita se =0 (caso scarico), gestione reverse charge+varie +03-08-2011 flgNoListino + corretto errori cash e prenotazioni +13-07-2011 aggiunti CodaMessaggi.findByEmailTemplateMsg +13-07-2011 corretto CodaMessaggi.sendMsg.\n +17-06-2011 aggiunto getVersionLog e getSoftwareVersionLog\n + +17-06-2011 controlo contatori con anno e prog iniziale + +03-06-2011 corretto intestazioni fatture (getId_clifor() >0) + +26-05-2011 imei riparazione cancellazione logica articoli altre +correzioni + +25-05-2011 spostato cracodamsg su clifor creazione coda da file di +email (su templatemsg) 1_34 corretto ricerca coda messaggi +ottimizzata per ms-sql + +24-05-2011 aggiustamento coda messaggi per ms-sql + +16-05-2011 corretto ricerca articolo (findtot) + +11-05-2011 report movimenti + messaggi movimenti su carta tim +(nascosto preche' fatto sui documenti), fix ricerca movimenti ricerca +movimenti per anno tolto rettangoli default stampa fattura3 + +07-05-2011 aggiunto creazione cvs in articolo.findbycr . sparito dopo +ottimizzazione + +04-05-2011 coda messaggi con openMailtag + +27-04-2010 ottimizzazione ricerca articoli e movimenti aggiustato +invio sms corretto carico massivo 1_26 corretto presso +nell'intestazione documenti + +20-04-2011 gestione allegati clienti, documenti, articolo, + tipi +allegati + +25-03-2011 alegato articolo in ordine alfabetico + +09-03-2011 corretto random banner + +07-03-2011 AGGIUNTO GESTIONE BANNER + +23-02-2011 ottimizzata ricerca documento.findtotrecord. sul mac non +funzionave ed effetivamente era una ciofeca + +23-02-2011 baco enorme sulla cassa. mi scorporava l'iva + +22-02-2011 aggiornamento tipo, logo documenti, carico articoli non in +magazzino considerando il valore su tipo, varie guidoreni + +28-01-2011 aggiornamento clifor decriciozne comune, cap comune ecc +ecc AGGIORNAMENTO DESTINAZIONI DIEVERSI COME SOPRA CODA MESSAGGI +OTTIMIZZAZIONE RICERCA + +10-01-2011 ultime modifiche prenotazioni guidoreni \ No newline at end of file diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AbiCab.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AbiCab.java new file mode 100644 index 00000000..6c7a84c9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AbiCab.java @@ -0,0 +1,233 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.BufferedReader; +import java.io.FileReader; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class AbiCab extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1460974609869L; + + private long id_abiCab; + + private String descrizione; + + private String agenzia; + + private String indirizzo; + + private String cap; + + private String abi; + + private String cab; + + private String bic; + + private String codiceAlt; + + private String localita; + + private String provincia; + + public AbiCab(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AbiCab() {} + + public void setId_abiCab(long newId_abiCab) { + this.id_abiCab = newId_abiCab; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setAgenzia(String newAgenzia) { + this.agenzia = newAgenzia; + } + + public void setIndirizzo(String newIndirizzo) { + this.indirizzo = newIndirizzo; + } + + public void setCap(String newCapZona) { + this.cap = newCapZona; + } + + public void setAbi(String newAbi) { + this.abi = newAbi; + } + + public void setCab(String newCab) { + this.cab = newCab; + } + + public void setBic(String newBic) { + this.bic = newBic; + } + + public void setCodiceAlt(String newCodiceAlt) { + this.codiceAlt = newCodiceAlt; + } + + public long getId_abiCab() { + return this.id_abiCab; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getAgenzia() { + return (this.agenzia == null) ? "" : this.agenzia.trim(); + } + + public String getIndirizzo() { + return (this.indirizzo == null) ? "" : this.indirizzo.trim(); + } + + public String getCap() { + return (this.cap == null) ? "" : this.cap.trim(); + } + + public String getAbi() { + return (this.abi == null) ? "" : this.abi.trim(); + } + + public String getCab() { + return (this.cab == null) ? "" : this.cab.trim(); + } + + public String getBic() { + return (this.bic == null) ? "" : this.bic.trim(); + } + + public String getCodiceAlt() { + return (this.codiceAlt == null) ? "" : this.codiceAlt.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(AbiCabCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ABI_CAB AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByAbiCab(String l_abi, String l_cab) { + String s_Sql_Find = "select A.* from ABI_CAB AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.abi='" + l_abi + "'"); + wc.addWc("A.cab='" + l_cab + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public ResParm importAbiCab(String fileName) { + ResParm rp = new ResParm(true); + int i = 0; + int se1 = 10; + int se2 = 100; + StringBuffer msg = new StringBuffer(); + try { + BufferedReader reader = new BufferedReader(new FileReader(fileName)); + if (reader != null) { + reader.readLine(); + String currentLine; + while ((currentLine = reader.readLine()) != null) { + StringTokenizer st = new StringTokenizer(currentLine, ";", '"'); + String abi = st.getToken(0); + String cab = st.getToken(1); + String istituto = st.getToken(2); + String sportello = st.getToken(3); + String indirizzo = st.getToken(4); + String localita = st.getToken(5); + String cap = st.getToken(6); + String prov = st.getToken(7); + AbiCab bean = new AbiCab(getApFull()); + bean.findByAbiCab(abi, cab); + bean.setAbi(abi); + bean.setCab(cab); + bean.setDescrizione(istituto); + bean.setAgenzia(sportello); + bean.setIndirizzo(indirizzo); + bean.setLocalita(localita); + bean.setCap(cap); + bean.setProvincia(prov); + rp = bean.save(); + if (!rp.getStatus()) + break; + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + if (rp.getStatus()) { + rp.setMsg("Inserite o aggiornate " + i + " records."); + } else { + rp.setMsg("ERRORE! " + rp.getMsg() + "\nRecord numero " + i); + } + } + } catch (Exception e) { + rp.setStatus(false); + rp.setMsg(e); + } + return rp; + } + + public String getLocalita() { + return (this.localita == null) ? "" : this.localita.trim(); + } + + public void setLocalita(String localita) { + this.localita = localita; + } + + public String getProvincia() { + return (this.provincia == null) ? "" : this.provincia.trim(); + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AbiCabCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AbiCabCR.java new file mode 100644 index 00000000..d78b6162 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AbiCabCR.java @@ -0,0 +1,102 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AbiCabCR extends CRAdapter { + private long id_abiCab; + + private String descrizione; + + private String agenzia; + + private String indirizzo; + + private String capZona; + + private String abi; + + private String cab; + + private String bic; + + private String codiceAlt; + + public AbiCabCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AbiCabCR() {} + + public void setId_abiCab(long newId_abiCab) { + this.id_abiCab = newId_abiCab; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setAgenzia(String newAgenzia) { + this.agenzia = newAgenzia; + } + + public void setIndirizzo(String newIndirizzo) { + this.indirizzo = newIndirizzo; + } + + public void setCapZona(String newCapZona) { + this.capZona = newCapZona; + } + + public void setAbi(String newAbi) { + this.abi = newAbi; + } + + public void setCab(String newCab) { + this.cab = newCab; + } + + public void setBic(String newBic) { + this.bic = newBic; + } + + public void setCodiceAlt(String newCodiceAlt) { + this.codiceAlt = newCodiceAlt; + } + + public long getId_abiCab() { + return this.id_abiCab; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getAgenzia() { + return (this.agenzia == null) ? "" : this.agenzia.trim(); + } + + public String getIndirizzo() { + return (this.indirizzo == null) ? "" : this.indirizzo.trim(); + } + + public String getCapZona() { + return (this.capZona == null) ? "" : this.capZona.trim(); + } + + public String getAbi() { + return (this.abi == null) ? "" : this.abi.trim(); + } + + public String getCab() { + return (this.cab == null) ? "" : this.cab.trim(); + } + + public String getBic() { + return (this.bic == null) ? "" : this.bic.trim(); + } + + public String getCodiceAlt() { + return (this.codiceAlt == null) ? "" : this.codiceAlt.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AllegatoClifor.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AllegatoClifor.java new file mode 100644 index 00000000..b2942ca5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AllegatoClifor.java @@ -0,0 +1,205 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class AllegatoClifor extends _AnagAdapter implements Serializable { + private static final long serialVersionUID = 8911811275285647807L; + + private long id_allegatoClifor; + + private long id_clifor; + + private long id_tipoAllegatoClifor; + + private String nomeFile; + + private Clifor clifor; + + private TipoAllegatoClifor tipoAllegatoClifor; + + private String descrizioneAllegato; + + private long flgDefault; + + public AllegatoClifor(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AllegatoClifor() {} + + public void setId_allegatoClifor(long newId_allegatoClifor) { + this.id_allegatoClifor = newId_allegatoClifor; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_tipoAllegatoClifor(long newId_tipoAllegatoClifor) { + this.id_tipoAllegatoClifor = newId_tipoAllegatoClifor; + setTipoAllegatoClifor(null); + } + + public void setNomeFile(String newNomeFile) { + this.nomeFile = newNomeFile; + } + + public long getId_allegatoClifor() { + return this.id_allegatoClifor; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_tipoAllegatoClifor() { + return this.id_tipoAllegatoClifor; + } + + public String getNomeFile() { + return (this.nomeFile == null) ? "" : this.nomeFile.trim(); + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setTipoAllegatoClifor(TipoAllegatoClifor newTipoAllegatoClifor) { + this.tipoAllegatoClifor = newTipoAllegatoClifor; + } + + public TipoAllegatoClifor getTipoAllegatoClifor() { + this.tipoAllegatoClifor = (TipoAllegatoClifor)getSecondaryObject(this.tipoAllegatoClifor, TipoAllegatoClifor.class, + getId_tipoAllegatoClifor()); + return this.tipoAllegatoClifor; + } + + protected void deleteCascade() { + new File(getPathAllegato() + getPathAllegato()).delete(); + } + + public Vectumerator findByCR(AllegatoCliforCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ALLEGATO_CLIFOR AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByCliforNomeFile(long l_id_clifor, String l_id_nomeFile) { + String s_Sql_Find = "select A.* from ALLEGATO_CLIFOR AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_clifor=" + l_id_clifor); + wc.addWc("A.nomeFile='" + l_id_nomeFile + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findByCliforTipo(long l_id_clifor, long l_id_tipoAllegatoClifor, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ALLEGATO_CLIFOR AS A"; + String s_Sql_Order = " order by A.nomeFile"; + WcString wc = new WcString(); + wc.addWc("A.id_clifor=" + l_id_clifor); + if (l_id_tipoAllegatoClifor > 0L) + wc.addWc("A.id_tipoAllegatoClifor=" + l_id_tipoAllegatoClifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getNomeFileSuDisco() { + return "" + getId_clifor() + "_" + getId_clifor(); + } + + public String getDescrizioneAllegato() { + return (this.descrizioneAllegato == null) ? "" : this.descrizioneAllegato; + } + + public void setDescrizioneAllegato(String descrizioneAllegato) { + this.descrizioneAllegato = descrizioneAllegato; + } + + protected int getStringValueCase(String l_colomnName) { + return 0; + } + + public long getFlgDefault() { + return this.flgDefault; + } + + public void setFlgDefault(long flgDefault) { + this.flgDefault = flgDefault; + } + + public void findByCliforDefault(long l_id_clifor) { + String s_Sql_Find = "select A.* from ALLEGATO_CLIFOR AS A"; + String s_Sql_Order = " order by A.nomeFile"; + WcString wc = new WcString(); + wc.addWc("A.id_clifor = " + l_id_clifor); + wc.addWc("A.flgDefault = 1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + if (getFlgDefault() == 1L) { + AllegatoClifor ac = new AllegatoClifor(getApFull()); + Vectumerator vec = new Vectumerator(); + vec = ac.findByCliforTipo(getId_clifor(), 0L, 0, 0); + while (vec.hasMoreElements()) { + ac = (AllegatoClifor)vec.nextElement(); + ac.setFlgDefault(0L); + ac.save(); + } + } + super.prepareSave(ps); + } + + public String getNomeFileCompletoSuDisco() { + return getPathAllegato() + getPathAllegato(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AllegatoCliforCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AllegatoCliforCR.java new file mode 100644 index 00000000..8f6dcb3a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AllegatoCliforCR.java @@ -0,0 +1,80 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AllegatoCliforCR extends CRAdapter { + private long id_allegatoClifor; + + private long id_clifor; + + private long id_tipoAllegatoClifor; + + private String nomeFile; + + private Clifor clifor; + + private TipoAllegatoClifor tipoAllegatoClifor; + + public AllegatoCliforCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AllegatoCliforCR() {} + + public void setId_allegatoClifor(long newId_allegatoClifor) { + this.id_allegatoClifor = newId_allegatoClifor; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_tipoAllegatoClifor(long newId_tipoAllegatoClifor) { + this.id_tipoAllegatoClifor = newId_tipoAllegatoClifor; + setTipoAllegatoClifor(null); + } + + public void setNomeFile(String newNomeFile) { + this.nomeFile = newNomeFile; + } + + public long getId_allegatoClifor() { + return this.id_allegatoClifor; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_tipoAllegatoClifor() { + return this.id_tipoAllegatoClifor; + } + + public String getNomeFile() { + return (this.nomeFile == null) ? "" : this.nomeFile.trim(); + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, + + getId_clifor()); + return this.clifor; + } + + public void setTipoAllegatoClifor(TipoAllegatoClifor newTipoAllegatoClifor) { + this.tipoAllegatoClifor = newTipoAllegatoClifor; + } + + public TipoAllegatoClifor getTipoAllegatoClifor() { + this.tipoAllegatoClifor = (TipoAllegatoClifor)getSecondaryObject(this.tipoAllegatoClifor, TipoAllegatoClifor.class, + + getId_tipoAllegatoClifor()); + return this.tipoAllegatoClifor; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Aspetto.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Aspetto.java new file mode 100644 index 00000000..51dc75ce --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Aspetto.java @@ -0,0 +1,64 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Aspetto extends _AnagAdapter implements Serializable { + private long id_aspetto; + + private String descrizione; + + public Aspetto(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Aspetto() {} + + public void setId_aspetto(long newId_aspetto) { + this.id_aspetto = newId_aspetto; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_aspetto() { + return this.id_aspetto; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(AspettoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ASPETTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AspettoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AspettoCR.java new file mode 100644 index 00000000..3d967e82 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/AspettoCR.java @@ -0,0 +1,32 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AspettoCR extends CRAdapter { + private long id_aspetto; + + private String descrizione; + + public AspettoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AspettoCR() {} + + public void setId_aspetto(long newId_aspetto) { + this.id_aspetto = newId_aspetto; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_aspetto() { + return this.id_aspetto; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Banca.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Banca.java new file mode 100644 index 00000000..0aeeb9f6 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Banca.java @@ -0,0 +1,460 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Banca extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1423651664351L; + + private long id_banca; + + private long id_comune; + + private String descrizione; + + private String iban; + + private String indirizzo; + + private String telefono; + + private String email; + + private String abi; + + private String capZona; + + private double importoRiba; + + private Comune comune; + + private String codiceAlt; + + private String agenzia; + + private String cab; + + private String bic; + + private String numeroConto; + + private long ordine; + + private long flgDefaultBonifico; + + private long flgVisualizzaPresentazione; + + public Banca(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Banca() {} + + public void setId_banca(long newId_banca) { + this.id_banca = newId_banca; + } + + public void setId_comune(long newId_comune) { + this.id_comune = newId_comune; + setComune(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setIban(String newIban) { + this.iban = newIban; + } + + public void setIndirizzo(String newIndirizzo) { + this.indirizzo = newIndirizzo; + } + + public void setTelefono(String newTelefono) { + this.telefono = newTelefono; + } + + public void setEmail(String newEmail) { + this.email = newEmail; + } + + public void setBic(String newBic) { + this.bic = newBic; + } + + public void setCapZona(String newCapZona) { + this.capZona = newCapZona; + } + + public long getId_banca() { + return this.id_banca; + } + + public long getId_comune() { + return this.id_comune; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getIban() { + return (this.iban == null) ? "" : this.iban.trim(); + } + + public String getIndirizzo() { + return (this.indirizzo == null) ? "" : this.indirizzo.trim(); + } + + public String getTelefono() { + return (this.telefono == null) ? "" : this.telefono.trim(); + } + + public String getEmail() { + return (this.email == null) ? "" : this.email.trim(); + } + + public String getBic() { + return (this.bic == null) ? "" : this.bic.trim(); + } + + public String getCapZona() { + return (this.capZona == null) ? "" : this.capZona.trim(); + } + + public void setComune(Comune newComune) { + this.comune = newComune; + } + + public Comune getComune() { + this.comune = (Comune)getSecondaryObject(this.comune, Comune.class, getId_comune()); + return this.comune; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(BancaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from BANCA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getCodiceAlt() { + return (this.codiceAlt == null) ? "" : this.codiceAlt.trim(); + } + + public void setCodiceAlt(String codieAlt) { + this.codiceAlt = codieAlt; + } + + public String getAgenzia() { + return (this.agenzia == null) ? "" : this.agenzia.trim(); + } + + public void setAgenzia(String agenzia) { + this.agenzia = agenzia; + } + + public String getAbi() { + if (this.abi == null && + getIban().length() >= 11) + this.abi = getIban().substring(6, 11); + return (this.abi == null) ? "" : this.abi.trim(); + } + + public void setAbi(String abi) { + this.abi = abi; + } + + public String getCab() { + if (this.cab == null && + getIban().length() >= 15) + this.cab = getIban().substring(11, 15); + return (this.cab == null) ? "" : this.cab.trim(); + } + + public void setCab(String cab) { + this.cab = cab; + } + + public String getNumeroConto() { + return (this.numeroConto == null) ? "" : this.numeroConto.trim(); + } + + public void setNumeroConto(String numeroConto) { + this.numeroConto = numeroConto; + } + + public void findByCodiceAlt(String codiceAlt) { + String s_Sql_Find = "select A.* from BANCA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codiceAlt='" + codiceAlt + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public String getConto() { + if (getIban().length() > 16) + return getIban().substring(16, getIban().length()); + return ""; + } + + public long getOrdine() { + return this.ordine; + } + + public void setOrdine(long ordine) { + this.ordine = ordine; + } + + public Vectumerator findByOrdine() { + String s_Sql_Find = "select A.* from BANCA AS A"; + String s_Sql_Order = " ORDER BY ordine"; + WcString wc = new WcString(); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm settaOrdineMeno() { + ResParm rp = new ResParm(true); + Banca banca = new Banca(getApFull()); + banca.findPrecedenteByOrdine(getOrdine()); + if (banca.getDBState() == 1) { + long l_ordine = banca.getOrdine(); + banca.setOrdine(getOrdine()); + rp = banca.save(); + setOrdine(l_ordine); + rp.append(save()); + } + return rp; + } + + public ResParm settaOrdinePiu() { + ResParm rp = new ResParm(true); + Banca banca = new Banca(getApFull()); + banca.findSuccessivoByOrdine(getOrdine()); + if (banca.getDBState() == 1) { + long l_ordine = banca.getOrdine(); + banca.setOrdine(getOrdine()); + rp = banca.save(); + setOrdine(l_ordine); + rp.append(save()); + } + return rp; + } + + public double getImportoRiba() { + return this.importoRiba; + } + + public void setImportoRiba(double importoRiba) { + this.importoRiba = importoRiba; + } + + public void findPrecedenteByOrdine(long l_ordine) { + String s_Sql_Find = "select A.* from BANCA AS A"; + String s_Sql_Order = " ORDER BY ordine desc"; + WcString wc = new WcString(); + wc.addWc("A.ordine<" + l_ordine); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public void findSuccessivoByOrdine(long l_ordine) { + String s_Sql_Find = "select A.* from BANCA AS A"; + String s_Sql_Order = " ORDER BY ordine asc"; + WcString wc = new WcString(); + wc.addWc("A.ordine>" + l_ordine); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public long getFlgDefaultBonifico() { + return this.flgDefaultBonifico; + } + + public void setFlgDefaultBonifico(long flgDefaultBonifico) { + this.flgDefaultBonifico = flgDefaultBonifico; + } + + public ResParm save() { + if (getFlgDefaultBonifico() == 1L); + return super.save(); + } + + public void findBancaDefault() { + String s_Sql_Find = "select A.* from BANCA AS A"; + String s_Sql_Order = " ORDER BY ordine"; + WcString wc = new WcString(); + wc.addWc("A.flgDefaultBonifico=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + protected ResParm resetDefaultBancaBonifico() { + String sql = "update BANCA set flgDefaultBonifico = null"; + return update(sql); + } + + public long getFlgVisualizzaPresentazione() { + return this.flgVisualizzaPresentazione; + } + + public void setFlgVisualizzaPresentazione(long flgVisualizzaPresentazione) { + this.flgVisualizzaPresentazione = flgVisualizzaPresentazione; + } + + public ResParm resetPresentazioneRibaAuto() { + String sql = "update BANCA set flgVisualizzaPresentazione = 0,ordine = 0"; + return update(sql); + } + + public Vectumerator findByOrdineVisibili() { + String s_Sql_Find = "select A.* from BANCA AS A"; + String s_Sql_Order = " ORDER BY ordine"; + WcString wc = new WcString(); + wc.addWc("A.flgVisualizzaPresentazione=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findNonVisibili() { + String s_Sql_Find = "select A.* from BANCA AS A"; + String s_Sql_Order = " ORDER BY A.descrizione"; + WcString wc = new WcString(); + wc.addWc("(A.flgVisualizzaPresentazione is null or A.flgVisualizzaPresentazione =0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm addBancaAPresentazioneRibaAuto() { + if (getId_banca() > 0L) { + setFlgVisualizzaPresentazione(1L); + setOrdine(getMaxOrdine() + 1L); + return save(); + } + return new ResParm(false, "ERRORE! Non puoi aggiungere una banca nulla alla presentazione riba!"); + } + + public ResParm rimuoviBancaAPresentazioneRibaAuto() { + if (getId_banca() > 0L) { + setFlgVisualizzaPresentazione(0L); + setOrdine(0L); + return save(); + } + return new ResParm(false, "ERRORE! Non puoi togliere una banca nulla alla presentazione riba!"); + } + + public long getMaxOrdine() { + String s_Sql_Find = "select max(A.ordine) as _max from BANCA AS A"; + String s_Sql_Order = " ORDER BY ordine asc"; + WcString wc = new WcString(); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (long)getMax(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return -1L; + } + } + + public String getDescrizioneScript() { + return DBAdapter.prepareScriptString(getDescrizione()); + } + + public String getBancheDefaultBonificoDesc() { + StringBuilder sb = new StringBuilder(); + String s_Sql_Find = "select A.* from BANCA AS A"; + String s_Sql_Order = " ORDER BY ordine"; + WcString wc = new WcString(); + wc.addWc("A.flgDefaultBonifico=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt); + while (vec.hasMoreElements()) { + Banca row = (Banca)vec.nextElement(); + sb.append(row.getDescrizione()); + sb.append(" "); + sb.append(row.getIban()); + if (vec.hasMoreElements()) + sb.append(" - "); + } + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + return sb.toString(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/BancaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/BancaCR.java new file mode 100644 index 00000000..3e6c2daf --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/BancaCR.java @@ -0,0 +1,116 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class BancaCR extends CRAdapter { + private long id_banca; + + private long id_comune; + + private String descrizione; + + private String iban; + + private String indirizzo; + + private String telefono; + + private String email; + + private String bic; + + private String capZona; + + private Comune comune; + + public BancaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public BancaCR() {} + + public void setId_banca(long newId_banca) { + this.id_banca = newId_banca; + } + + public void setId_comune(long newId_comune) { + this.id_comune = newId_comune; + setComune(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setIban(String newIban) { + this.iban = newIban; + } + + public void setIndirizzo(String newIndirizzo) { + this.indirizzo = newIndirizzo; + } + + public void setTelefono(String newTelefono) { + this.telefono = newTelefono; + } + + public void setEmail(String newEmail) { + this.email = newEmail; + } + + public void setBic(String newBic) { + this.bic = newBic; + } + + public void setCapZona(String newCapZona) { + this.capZona = newCapZona; + } + + public long getId_banca() { + return this.id_banca; + } + + public long getId_comune() { + return this.id_comune; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getIban() { + return (this.iban == null) ? "" : this.iban.trim(); + } + + public String getIndirizzo() { + return (this.indirizzo == null) ? "" : this.indirizzo.trim(); + } + + public String getTelefono() { + return (this.telefono == null) ? "" : this.telefono.trim(); + } + + public String getEmail() { + return (this.email == null) ? "" : this.email.trim(); + } + + public String getBic() { + return (this.bic == null) ? "" : this.bic.trim(); + } + + public String getCapZona() { + return (this.capZona == null) ? "" : this.capZona.trim(); + } + + public void setComune(Comune newComune) { + this.comune = newComune; + } + + public Comune getComune() { + this.comune = (Comune)getSecondaryObject(this.comune, Comune.class, + + getId_comune()); + return this.comune; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CausaleTrasporto.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CausaleTrasporto.java new file mode 100644 index 00000000..4dd26fc8 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CausaleTrasporto.java @@ -0,0 +1,66 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class CausaleTrasporto extends _AnagAdapter implements Serializable { + private long id_causaleTrasporto; + + private String descrizione; + + public CausaleTrasporto(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CausaleTrasporto() {} + + public void setId_causaleTrasporto(long newId_causaleMagazzino) { + this.id_causaleTrasporto = newId_causaleMagazzino; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_causaleTrasporto() { + return this.id_causaleTrasporto; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : + this.descrizione.trim(); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(CausaleTrasportoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CAUSALE_TRASPORTO AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CausaleTrasportoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CausaleTrasportoCR.java new file mode 100644 index 00000000..f5d2ec0e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CausaleTrasportoCR.java @@ -0,0 +1,32 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class CausaleTrasportoCR extends CRAdapter { + private long id_causaleTrasporto; + + private String descrizione; + + public CausaleTrasportoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CausaleTrasportoCR() {} + + public void setId_causaleTrasporto(long newId_causaleMagazzino) { + this.id_causaleTrasporto = newId_causaleMagazzino; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_causaleTrasporto() { + return this.id_causaleTrasporto; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Cliente.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Cliente.java new file mode 100644 index 00000000..49260497 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Cliente.java @@ -0,0 +1,40 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.util.Vectumerator; + +public class Cliente extends Clifor { + private static final long serialVersionUID = 486912705000890691L; + + private long id_cliente; + + public Cliente() {} + + public Cliente(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public String getTableBeanName() { + return "CLIFOR"; + } + + public String getFlgTipo() { + return "C"; + } + + public Vectumerator findByCR(ClienteCR CR, int pageNumber, int pageRows) { + return findByCR(CR, pageNumber, pageRows); + } + + public long getId_cliente() { + return getId_clifor(); + } + + public void setId_cliente(long id_cliente) { + setId_clifor(id_cliente); + } + + protected String sqlStringfindAll() { + return "select * from CLIFOR where id_clifor>1 and flgTipo='C' order by cognome, nome"; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ClienteCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ClienteCR.java new file mode 100644 index 00000000..ec6195cd --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ClienteCR.java @@ -0,0 +1,25 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; + +public class ClienteCR extends CliforCR { + private long id_cliente; + + public ClienteCR() {} + + public ClienteCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public String getFlgTipo() { + return "C"; + } + + public long getId_cliente() { + return getId_clifor(); + } + + public void setId_cliente(long id_cliente) { + setId_clifor(id_cliente); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Clifor.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Clifor.java new file mode 100644 index 00000000..f0264f20 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Clifor.java @@ -0,0 +1,2741 @@ +package it.acxent.anag; + +import com.lowagie.text.Cell; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.HeaderFooter; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Phrase; +import com.lowagie.text.Rectangle; +import com.lowagie.text.Table; +import com.lowagie.text.pdf.PdfWriter; +import it.acxent.anag.tr.PersonaCarico; +import it.acxent.brt.api.json.PudoAddress; +import it.acxent.cart.Cart; +import it.acxent.checkVatService.CheckVatClient; +import it.acxent.contab.Documento; +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.fattele.FEDatiAnagraficiInterface; +import it.acxent.fattele.FESedeInterface; +import it.acxent.newsletter.CodaMessaggi; +import it.acxent.newsletter.TemplateMsg; +import it.acxent.util.CodiceFiscale; +import it.acxent.util.FileMailingListManager; +import it.acxent.util.FileWr; +import it.acxent.util.PdfFontFactory; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.awt.Color; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.NumberFormat; +import java.util.Calendar; + +public class Clifor extends _AnagAdapter implements Serializable, CliforInterface, AddImgInterface, FEDatiAnagraficiInterface, FESedeInterface { + private static final long serialVersionUID = -3173766478494140671L; + + public static final long DOCUMENTO_NON_VERIFICATO = 0L; + + public static final long DOCUMENTO_NON_VALIDO = 10L; + + public static final long DOCUMENTO_IN_SCADENZA = 15L; + + public static final long DOCUMENTO_SCADUTO = 20L; + + public static final long DOCUMENTO_VERIFICATO = 30L; + + public static final long STATO_CIVILE_NESSUNO = 0L; + + public static final long STATO_CIVILE_CELIBE_NUBILE = 1L; + + public static final long STATO_CIVILE_CONIUGATO = 2L; + + public static final long STATO_CIVILE_SEPARATO = 3L; + + public static final long STATO_CIVILE_DIVORZIATO = 4L; + + public static final long STATO_CONFERMA_DATI_NON_VERIFICATO = 0L; + + public static final long STATO_CONFERMA_DATI_DA_VERIFICARE = 1L; + + public static final long STATO_CONFERMA_DATI_VERIFICATO = 9L; + + private long id_tipoPagamento; + + private String codiceAlt; + + private long flgValido; + + private String flgTipo; + + private long flgAzienda; + + private String cellulare; + + private String contatto; + + private String nome; + + private String indirizzo; + + private String numeroCivico; + + private long id_comune; + + private long id_comuneNascita; + + private String id_nazione; + + private Date dataNascita; + + public static final String TIPO_TUTTI = ""; + + public static final String TIPO_CLIENTE = "C"; + + public static final String TIPO_FORNITORE = "F"; + + public static final String TIPO_RUBRICA = "R"; + + private String codFisc; + + private String pIva; + + private String capZona; + + private String fax; + + private String telefono; + + private String nota; + + private String imgTmst; + + private long flgPrivComunicazione; + + private long flgPrivSensibili; + + private long flgPrivTrattamento; + + private long flgSesso; + + private String www; + + private Date dataRegistrazioneDI; + + private String dichiarazioneIntento; + + private long flgRC; + + private TipoPagamento tipoPagamento; + + private Comune comune; + + private Comune comuneNascita; + + private Nazione nazione; + + private String codFiscCalc; + + private String iban; + + private String eMail; + + private String descrizioneComune; + + private String bancaDesc; + + private long id_listino; + + private Listino listino; + + private long closeCommand; + + private DestinazioneDiversa currentDD; + + private Clifor cliforDup; + + private long id_cliforDup; + + private long flgMl = 1L; + + private String provinciaComune; + + private String capComune; + + private String cognome; + + private long flgSplitPayment; + + private String codiceCartaFidelity; + + private String descrizioneComuneNascita; + + private String telefonoAmm; + + private String cellulareAmm; + + private String eMailAmm; + + private String telefonoAltro; + + private String cellulareAltro; + + private String descrizioneAltroContatto; + + private String eMailAltro; + + private String numeroDocumento; + + private Date dataScadenzaDocumento; + + private double percProvvigione; + + private long id_clifor; + + private String notaPerCliente; + + private long flgDocumentoVerificato; + + private long flgNascondiWeb; + + private String zona; + + private String importPrefissoCodice; + + private String importLinkFornitore; + + private String importLinkFornitoreEan; + + private long id_bancaAzienda; + + private Banca bancaAzienda; + + private String abi; + + private String bic; + + private String cab; + + private double speseIncasso; + + private long flgUsaContrattoOre; + + private Clifor agente; + + private long id_respCommerciale; + + private Clifor respCommerciale; + + private double percAgente; + + private double percRespCommerciale; + + private String pec; + + private String descAggiuntiva; + + private String codiceIdentificativoFE; + + private long flgPA; + + private double costoOrarioAssistenza; + + private long id_agente; + + private long flgArt8; + + private long flgAbilitaAF; + + private long flgUsato; + + private String provinciaComuneNascita; + + private long flgTaxFree; + + private double valoreMinimoAbilitaAF; + + private long flgStatoCivile; + + private long id_ottoxmille; + + private Ottoxmille ottoxmille; + + private String cf5xmille; + + private String codice2xmille; + + private double costoSpedizioneAggiuntivo; + + private long id_usersResponsabile; + + private Users usersResponsabile; + + private long flgStatoConfermaDati; + + private long flgStatoConfermaDatiDb; + + private double prezzoCatenaAlMt; + + private long annoCorrente; + + private long id_usersAttivita; + + private Users usersAttivita; + + private long flgEscludi; + + private long flgBlacklist; + + private String notaBlacklist; + + public Clifor(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public double getPercentualeProvvigioneAgente() { + double perc = 0.0D; + if (getId_agente() > 0L) + if (getPercAgente() > 0.0D) { + perc = getPercAgente(); + } else { + CliforTipoClifor ctc = new CliforTipoClifor(getApFull()); + ctc.findByCliforTipologia(getId_agente(), 1L); + if (ctc.getDBState() == 1) + perc = ctc.getPercProvvigione(); + } + return perc; + } + + public double getPercentualeProvvigioneRespCommerciale() { + double perc = 0.0D; + if (getPercRespCommerciale() > 0.0D) { + perc = getPercRespCommerciale(); + } else if (getId_respCommerciale() > 0L) { + CliforTipoClifor ctc = new CliforTipoClifor(getApFull()); + ctc.findByCliforTipologia(getId_respCommerciale(), 3L); + if (ctc.getPercProvvigione() > 0.0D) + perc = ctc.getPercProvvigione(); + } else { + CliforTipoClifor ctc = new CliforTipoClifor(getApFull()); + ctc.findByCliforTipologia(getId_agente(), 1L); + if (ctc.getClifor().getPercRespCommerciale() > 0.0D) { + perc = ctc.getClifor().getPercRespCommerciale(); + } else { + long id_respCommerciale = ctc.getClifor().getId_respCommerciale(); + ctc = new CliforTipoClifor(getApFull()); + ctc.findByCliforTipologia(id_respCommerciale, 3L); + if (ctc.getDBState() == 1) + perc = ctc.getPercProvvigione(); + } + } + return perc; + } + + public Clifor() {} + + public void setId_clifor(long newId_cliFor) { + this.id_clifor = newId_cliFor; + } + + public void setId_tipoPagamento(long newId_tipoPagamento) { + this.id_tipoPagamento = newId_tipoPagamento; + setTipoPagamento(null); + } + + public void setCodiceAlt(String newCodiceAlt) { + this.codiceAlt = newCodiceAlt; + } + + public void setFlgValido(long newFlgValido) { + this.flgValido = newFlgValido; + } + + public void setFlgTipo(String newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public void setFlgEscludi(long newFlgEscludi) { + this.flgEscludi = newFlgEscludi; + } + + public void setCognome(String newCognome) { + this.cognome = newCognome; + } + + public void setContatto(String newContatto) { + this.contatto = newContatto; + } + + public void setNome(String newNome) { + this.nome = newNome; + } + + public void setIndirizzo(String newIndirizzo) { + this.indirizzo = newIndirizzo; + } + + public void setNumeroCivico(String newNumeroCivico) { + this.numeroCivico = newNumeroCivico; + } + + public void setId_comune(long newId_comune) { + this.id_comune = newId_comune; + setComune(null); + } + + public void setId_nazione(String newId_nazione) { + this.id_nazione = newId_nazione; + setNazione(null); + } + + public void setDataNascita(Date newDataNascita) { + this.dataNascita = newDataNascita; + } + + public void setCodFisc(String newCodFisc) { + this.codFisc = newCodFisc; + } + + public void setPIva(String newPIva) { + this.pIva = newPIva; + } + + public void setEMail(String newEMail) { + this.eMail = newEMail; + } + + public void setFax(String newFax) { + this.fax = newFax; + } + + public void setTelefono(String newTelefono) { + this.telefono = newTelefono; + } + + public void setNota(String newNota) { + this.nota = newNota; + } + + public void setImgTmst(String newImgTmst) { + this.imgTmst = newImgTmst; + } + + public void setFlgPrivComunicazione(long newFlgPrivComunicazione) { + this.flgPrivComunicazione = newFlgPrivComunicazione; + } + + public void setFlgPrivSensibili(long newFlgPrivSensibili) { + this.flgPrivSensibili = newFlgPrivSensibili; + } + + public void setFlgPrivTrattamento(long newFlgPrivTrattamento) { + this.flgPrivTrattamento = newFlgPrivTrattamento; + } + + public void setFlgSesso(long newFlgSesso) { + this.flgSesso = newFlgSesso; + } + + public void setWww(String newWww) { + this.www = newWww; + } + + public void setDataRegistrazioneDI(Date newDataRegistrazioneDI) { + this.dataRegistrazioneDI = newDataRegistrazioneDI; + } + + public void setDichiarazioneIntento(String newDichiarazioneIntento) { + this.dichiarazioneIntento = newDichiarazioneIntento; + } + + public void setFlgArt8(long newFlgArt8) { + this.flgArt8 = newFlgArt8; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_tipoPagamento() { + return this.id_tipoPagamento; + } + + public String getCodiceAlt() { + return (this.codiceAlt == null) ? "" : this.codiceAlt.trim(); + } + + public long getFlgValido() { + return this.flgValido; + } + + public String getFlgTipo() { + return (this.flgTipo == null) ? "" : this.flgTipo.trim(); + } + + public static final String getTipo(String l_flgTipo) { + if (l_flgTipo.equals("C")) + return "Cliente"; + if (l_flgTipo.equals("F")) + return "Fornitore"; + if (l_flgTipo.equals("R")) + return "Contatto"; + return "??"; + } + + public static final String getStatoCivile(long l_flgStatoCivile) { + if (l_flgStatoCivile == 1L) + return "Celibe/Nubile"; + if (l_flgStatoCivile == 2L) + return "Coniugato"; + if (l_flgStatoCivile == 4L) + return "Divorziato"; + if (l_flgStatoCivile == 3L) + return "Separato"; + return ""; + } + + public static final String getStatoConfermaDati(long l_flgStatoConfermaDati) { + if (l_flgStatoConfermaDati == 1L) + return "Da Verificare"; + if (l_flgStatoConfermaDati == 9L) + return "Verificato"; + if (l_flgStatoConfermaDati == 0L) + return "Non Verificato"; + return ""; + } + + public final String getStatoConfermaDati() { + return getStatoConfermaDati(getFlgStatoConfermaDati()); + } + + public String getStatoCivile() { + return getStatoCivile(getFlgStatoCivile()); + } + + public String getTipo() { + return getTipo(getFlgTipo()); + } + + public long getFlgAzienda() { + return this.flgAzienda; + } + + public String getDescrizioneCompleta() { + if (getId_clifor() != 0L) { + if (getParm("ANAG_DESC_COMPLETA_CON_TIPO").isTrue()) { + StringBuffer stringBuffer = new StringBuffer(getFlgTipo() + " - "); + if (!getCodiceAlt().isEmpty()) { + stringBuffer.append(getCodiceAlt()); + stringBuffer.append(" "); + } + stringBuffer.append(getNominativoCompleto()); + return stringBuffer.toString(); + } + StringBuffer temp = new StringBuffer(); + if (!getCodiceAlt().isEmpty()) { + temp.append(getCodiceAlt()); + temp.append(" "); + } + temp.append(getNominativoCompleto()); + return temp.toString(); + } + return ""; + } + + public String getCognomeNome() { + return (getCognome() + " " + getCognome()).trim(); + } + + public String getContatto() { + return (this.contatto == null) ? "" : this.contatto.trim(); + } + + public String getNome() { + return (this.nome == null) ? "" : this.nome.trim(); + } + + public String getIndirizzo() { + return (this.indirizzo == null) ? "" : this.indirizzo.trim(); + } + + public String getIndirizzoCompleto() { + return getIndirizzo() + " " + getIndirizzo() + " " + getNumeroCivico() + " " + (getCapZona().isEmpty() ? getCapComune() : getCapZona()) + " (" + + getDescrizioneComune() + ")"; + } + + public String getIndirizzoCompletoHtml() { + return getIndirizzoCompleto().replaceAll("\n", "
"); + } + + public String getNumeroCivico() { + return (this.numeroCivico == null) ? "" : this.numeroCivico.trim(); + } + + public long getId_comune() { + return this.id_comune; + } + + public String getId_nazione() { + return (this.id_nazione == null) ? "" : this.id_nazione.trim(); + } + + public Date getDataNascita() { + return this.dataNascita; + } + + public String getCodFisc() { + return (this.codFisc == null) ? "" : this.codFisc.trim().toUpperCase(); + } + + public String getPIva() { + return (this.pIva == null) ? "" : this.pIva.trim(); + } + + public String getEMail() { + return (this.eMail == null) ? "" : this.eMail.trim(); + } + + public String getFax() { + return (this.fax == null) ? "" : this.fax.trim(); + } + + public String getTelefono() { + return (this.telefono == null) ? "" : this.telefono.trim(); + } + + public String getNota() { + return (this.nota == null) ? "" : this.nota.trim(); + } + + public String getImgTmst() { + return (this.imgTmst == null) ? "" : this.imgTmst.trim(); + } + + public long getFlgPrivComunicazione() { + return this.flgPrivComunicazione; + } + + public long getFlgPrivSensibili() { + return this.flgPrivSensibili; + } + + public long getFlgPrivTrattamento() { + return this.flgPrivTrattamento; + } + + public long getFlgSesso() { + return this.flgSesso; + } + + public String getWww() { + return (this.www == null) ? "" : this.www.trim(); + } + + public Date getDataRegistrazioneDI() { + return this.dataRegistrazioneDI; + } + + public String getDichiarazioneIntento() { + return (this.dichiarazioneIntento == null) ? "" : this.dichiarazioneIntento.trim(); + } + + public long getFlgArt8() { + return this.flgArt8; + } + + public void setTipoPagamento(TipoPagamento newTipoPagamento) { + this.tipoPagamento = newTipoPagamento; + } + + public TipoPagamento getTipoPagamento() { + this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, getId_tipoPagamento()); + return this.tipoPagamento; + } + + public void setComune(Comune newComune) { + this.comune = newComune; + } + + public Comune getComune() { + this.comune = (Comune)getSecondaryObject(this.comune, Comune.class, getId_comune()); + return this.comune; + } + + public void setNazione(Nazione newNazione) { + this.nazione = newNazione; + } + + public Nazione getNazione() { + this.nazione = (Nazione)getSecondaryObject(this.nazione, Nazione.class, getId_nazione()); + return this.nazione; + } + + protected void deleteCascade() {} + + public void findByCF(String l_codFisc, String l_flgTipo) { + String s_Sql_Find = "select A.* from CLIFOR AS A"; + String s_Sql_Order = " order by A.cognome, A.nome\t"; + WcString wc = new WcString(); + wc.addWc("A.codFisc='" + l_codFisc + "'"); + wc.addWc("A.flgTipo='" + l_flgTipo + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByPIva(String l_pIva, String l_flgTipo) { + String s_Sql_Find = "select A.* from CLIFOR AS A"; + String s_Sql_Order = " order by A.cognome, A.nome\t"; + WcString wc = new WcString(); + wc.addWc("A.pIva='" + l_pIva + "'"); + wc.addWc("A.flgTipo='" + l_flgTipo + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByImportPrefissoCodice(String l_importPrefissoCodice) { + String s_Sql_Find = "select A.* from CLIFOR AS A"; + String s_Sql_Order = " order by A.cognome, A.nome\t"; + WcString wc = new WcString(); + wc.addWc("A.importPrefissoCodice ='" + l_importPrefissoCodice + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByEmail(String l_email) { + String s_Sql_Find = "select A.* from CLIFOR AS A"; + String s_Sql_Order = " order by A.cognome, A.nome\t"; + WcString wc = new WcString(); + wc.addWc("A.flgTipo='C'"); + wc.addWc("A.eMail='" + l_email + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getCodFiscCalc() { + if (this.codFiscCalc == null || this.codFiscCalc.isEmpty()) + if (getFlgSesso() < 0L || getCognome().isEmpty() || getNome().isEmpty() || getId_comuneNascita() == 0L) { + this.codFiscCalc = ""; + } else { + char sesso = getSesso().charAt(0); + CodiceFiscale cf = new CodiceFiscale(getCognome(), getNome(), getDataNascita(), "", sesso); + cf.setCodiceLuogoDiNascita(getComuneNascita().getCodice()); + this.codFiscCalc = cf.getCodicefiscale(); + } + return this.codFiscCalc; + } + + protected boolean isCodFiscDuplicated(String l_flgTipo) { + if (!getCodFisc().isEmpty() && !l_flgTipo.isEmpty()) { + String s_Sql_Find = "select * from CLIFOR AS A "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codFisc='" + getCodFisc() + "'"); + wc.addWc("A.id_clifor !=" + getId_clifor()); + wc.addWc("A.flgTipo ='" + l_flgTipo + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Clifor bean = (Clifor)getFirstRecord(stmt); + if (bean != null && bean.getDBState() == 1) + return true; + return false; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + return false; + } + + public boolean isCodFiscDuplicated() { + return isCodFiscDuplicated(getFlgTipo()); + } + + public boolean isPIvaDuplicated() { + return isPIvaDuplicated(getFlgTipo()); + } + + public boolean isPIvaCodfiscDuplicated() { + return isPIvaCodfiscDuplicated(getFlgTipo()); + } + + public boolean isCodFiscOk() { + if (getFlgAzienda() != 1L) + return (getCodFiscCalc().isEmpty() || getCodFiscCalc().equals(getCodFisc())); + return true; + } + + protected boolean isPIvaCodfiscDuplicated(String l_flgTipo) { + return (isPIvaDuplicated(l_flgTipo) || isCodFiscDuplicated(l_flgTipo)); + } + + protected boolean isPIvaDuplicated(String l_flgTipo) { + if (!getPIva().isEmpty() && !l_flgTipo.isEmpty()) { + String s_Sql_Find = "select * from CLIFOR AS A "; + String s_Sql_Order = ""; + String wc = ""; + wc = buildWc(wc, "A.pIva='" + getPIva() + "'"); + wc = buildWc(wc, "A.id_clifor !=" + getId_clifor()); + wc = buildWc(wc, "A.flgTipo ='" + l_flgTipo + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + Clifor bean = (Clifor)getFirstRecord(stmt); + if (bean != null && bean.getDBState() == 1) + return true; + return false; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + return false; + } + + public long getId_comuneNascita() { + return this.id_comuneNascita; + } + + public void setId_comuneNascita(long id_comuneNascita) { + this.id_comuneNascita = id_comuneNascita; + setComuneNascita(null); + } + + public Comune getComuneNascita() { + this.comuneNascita = (Comune)getSecondaryObject(this.comuneNascita, Comune.class, getId_comuneNascita()); + return this.comuneNascita; + } + + public void setComuneNascita(Comune comuneNascita) { + this.comuneNascita = comuneNascita; + } + + public String getSesso() { + return (getFlgSesso() == 0L) ? "M" : "F"; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + synchronized (this) { + if (getId_comune() > 0L) + setDescrizioneComune(getComune().getDescrizione()); + if (getId_comuneNascita() > 0L) + setDescrizioneComuneNascita(getComuneNascita().getDescrizione()); + super.prepareSave(ps); + } + } + + public Vectumerator findUsers(int pageNumber, int pageRows) { + return new Users(getApFull()).findByClifor(getId_clifor(), pageNumber, pageRows); + } + + public String getCognome() { + return (this.cognome == null) ? "" : this.cognome.trim(); + } + + public String getIban() { + return (this.iban == null) ? "" : this.iban.trim().toUpperCase(); + } + + public void setIban(String iban) { + this.iban = iban; + } + + public String getAbiIban() { + if (getIban().length() < 11) + return "??"; + return getIban().substring(5, 10); + } + + public String getCabIban() { + if (getIban().length() < 16) + return "??"; + return getIban().substring(10, 15); + } + + public String getConto() { + if (getIban().length() < 27) + return "??"; + return getIban().substring(15); + } + + public String getCapZona() { + return (this.capZona == null) ? "" : this.capZona.trim(); + } + + public void setCapZona(String capZona) { + this.capZona = capZona; + } + + protected int getStringValueCase(String l_columnName) { + if (l_columnName.startsWith("eMail")) + return 0; + return super.getStringValueCase(l_columnName); + } + + public Vectumerator getDestinazioniDiverse() { + return new DestinazioneDiversa(getApFull()).findByClifor(getId_clifor(), 0, 0); + } + + public ResParm addDestinazioneDiversa(DestinazioneDiversa row) { + DestinazioneDiversa bean = new DestinazioneDiversa(getApFull()); + bean.findByPrimaryKey(row.getId_destinazioneDiversa()); + if (bean.getDBState() == 1) + row.setDBState(bean.getDBState()); + row.setId_clifor(getId_clifor()); + ResParm rp = row.save(); + return rp; + } + + public ResParm delDestinazioneDiversa(DestinazioneDiversa row) { + DestinazioneDiversa bean = new DestinazioneDiversa(getApFull()); + bean.findByPrimaryKey(row.getId_destinazioneDiversa()); + return bean.delete(); + } + + public String getCellulare() { + return (this.cellulare == null) ? "" : this.cellulare.trim(); + } + + public void setCellulare(String cellulare) { + this.cellulare = cellulare; + } + + public String getBancaDesc() { + return (this.bancaDesc == null) ? "" : this.bancaDesc.trim(); + } + + public void setBancaDesc(String banca) { + this.bancaDesc = banca; + } + + public String getBancaCompleto() { + return getBancaDesc() + " " + getBancaDesc(); + } + + public long getId_listino() { + return this.id_listino; + } + + public void setId_listino(long id_listino) { + this.id_listino = id_listino; + setListino(null); + } + + public Listino getListino() { + this.listino = (Listino)getSecondaryObject(this.listino, Listino.class, getId_listino()); + return this.listino; + } + + public void setListino(Listino listino) { + this.listino = listino; + } + + public long getCloseCommand() { + return this.closeCommand; + } + + public void setCloseCommand(long closeCommand) { + this.closeCommand = closeCommand; + } + + public Clifor getCliforDup() { + this.cliforDup = (Clifor)getSecondaryObject(this.cliforDup, Clifor.class, getId_cliforDup()); + return this.cliforDup; + } + + public void setId_cliforDup(long id_cliforDup) { + this.id_cliforDup = id_cliforDup; + setCliforDup(null); + } + + public long getId_cliforDup() { + return this.id_cliforDup; + } + + public void setCliforDup(Clifor cliforDup) { + this.cliforDup = cliforDup; + } + + public Vectumerator getContratti() { + return new Contratto(getApFull()).findByClifor(getId_clifor(), 0, 0); + } + + public Vectumerator getDocumenti() { + return new Documento(getApFull()).findByClifor(getId_clifor(), 0, 0); + } + + public ResParm addContratto(Contratto row) { + Contratto bean = new Contratto(getApFull()); + bean.findByPrimaryKey(row.getId_contratto()); + if (bean.getDBState() == 1) + row.setDBState(bean.getDBState()); + ResParm rp = row.save(); + return rp; + } + + public ResParm delContratto(Contratto row) { + Contratto bean = new Contratto(getApFull()); + bean.findByPrimaryKey(row.getId_contratto()); + return bean.delete(); + } + + public synchronized ResParm creaMailingListCR(CliforCR CR) { + ResParm rp = new ResParm(true); + resetMailingListFileCR(); + CR.setFlgMl(1L); + Vectumerator vec = findByCR(CR, 0, 0); + long numEmail = 0L; + boolean res = true; + StringBuffer mail = new StringBuffer(); + while (vec.hasMoreElements()) { + Clifor row = (Clifor)vec.nextElement(); + res = row.addToMailingListFileCR(); + if (res) { + mail.append(row.getEMail()); + mail.append(", "); + numEmail++; + } + } + if (numEmail == 0L) { + rp.setStatus(false); + rp.setMsg("Errore!! Mailing list vuota. Verificare i criteri di ricerca."); + } else { + rp.setMsg("Mailing list creata correttamente. Inserite " + numEmail); + rp.setInfoMsg(" email. " + mail.toString()); + } + return rp; + } + + public void resetMailingListFileCR() { + File mlFile = new File(getDocBase() + getDocBase()); + boolean res = mlFile.delete(); + } + + public synchronized boolean addToMailingListFileCR() { + boolean mlRet = false; + if (!getEMail().isEmpty()) { + mlRet = FileMailingListManager.getInstance(getDocBase() + getDocBase()).addEmail(getEMail()); + if (!mlRet) + handleDebug(" Attenzione!! Mailing list non aggiornata. Contattare l'amministratore.", 2); + } + return mlRet; + } + + protected String getMailingListFileCR() { + return getParm("MAIL_LIST_FILE_CR").getTesto(); + } + + public String getMailingMailCR() { + return getParm("MAIL_LIST_MAIL_CR").getTesto(); + } + + public static final synchronized ResParm unisciClifor(Clifor theClifor) { + ResParm rp = new ResParm(true); + if (theClifor.getId_clifor() != 0L && theClifor.getId_cliforDup() != 0L && theClifor.getId_clifor() != theClifor.getId_cliforDup()) { + if (theClifor.getId_cliforDup() != 0L && theClifor.getId_cliforDup() != theClifor.getId_clifor()) + if (rp.getStatus()) { + String setSql = " set id_clifor=" + theClifor.getId_clifor() + " where id_clifor=" + theClifor.getId_cliforDup(); + rp = theClifor.update("UPDATE DOCUMENTO" + setSql); + rp = theClifor.update("UPDATE DOCUMENTO set id_cliforListino=" + theClifor.getId_clifor() + " where id_cliforListino=" + + theClifor.getId_cliforDup()); + rp.append(theClifor.update("UPDATE CLIFOR_USERS" + setSql)); + rp.append(theClifor.update("UPDATE ARTICOLO_FORNITORE" + setSql)); + rp.append(theClifor.update("UPDATE MAG_FISICO" + setSql)); + rp.append(theClifor.update("UPDATE DESTINAZIONE_DIVERSA" + setSql)); + rp.append(theClifor.update("UPDATE ALLEGATO_CLIFOR" + setSql)); + rp.append(theClifor.update("UPDATE CLIFOR_USERS" + setSql)); + rp.append(theClifor.update("UPDATE LISTINO_PERS" + setSql)); + rp.append(theClifor.update("UPDATE MAG_FISICO" + setSql)); + if (rp.getStatus()) + rp.append(theClifor.update("delete from CLIFOR WHERE id_clifor=" + theClifor.getId_cliforDup())); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! Impossibile eseguire unione di oggetti nulli!."); + } + return rp; + } + + public long getFlgMl() { + return this.flgMl; + } + + public void setFlgMl(long flgMl) { + this.flgMl = flgMl; + } + + public Vectumerator findByCR(CliforCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CLIFOR AS A"; + String s_Sql_Order = " order by A.cognome, A.nome\t"; + WcString wc = new WcString(); + if (CR.getId_tipoClifor() > 0L || CR.getFlgTipologiaClifor() > 0L) + s_Sql_Find = s_Sql_Find + " JOIN CLIFOR_TIPO_CLIFOR AS B ON A.id_clifor = B.id_clifor JOIN TIPO_CLIFOR AS C ON B.id_tipoClifor = C.id_tipoClifor left join CLIFOR_TIPO_CLIFOR AS D ON A.id_clifor=D.id_clifor"; + wc.addWc("A.id_clifor>1"); + if (!CR.getFlgTipo().isEmpty()) + wc.addWc("A.flgTipo='" + CR.getFlgTipo() + "'"); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringBuffer txt = new StringBuffer("("); + String temp = CR.getSearchTxt().trim().replace('*', '%'); + int comma = temp.indexOf(","); + if (comma > 0) { + StringTokenizer st = new StringTokenizer(temp, ","); + String token = st.nextToken().trim(); + txt.append("(A.cognome like '" + token + "%')"); + if (st.hasMoreTokens()) { + token = st.nextToken().trim(); + txt.append(" and "); + txt.append("(A.nome like '" + token + "%' )"); + } + txt.append(")"); + wc.addWc(txt.toString()); + } else { + StringTokenizer st = new StringTokenizer(temp, " "); + while (st.hasMoreTokens()) { + String token = prepareSqlString(st.nextToken()); + txt.append("(A.cognome like '%" + token + "%' or A.nome like '%" + token + "%' or A.descAggiuntiva like '%" + token + "%' or A.codFisc like '%" + token + "%' or A.pIva like '%" + token + "%' or A.codiceCartaFidelity like '%" + token + "%' or A.contatto like '%" + token + "%' or A.telefono like '%" + token + "%' or A.cellulare like '%" + token + "%' or A.codiceAlt like '%" + token + "%' or A.eMail like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + } + if (!CR.getSearchTxt2().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt2().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = prepareSqlString(st.nextToken()); + txt.append("(A.cognome like '%" + token + "%' or A.nome like '%" + token + "%' or A.descAggiuntiva like '%" + token + "%' or A.codiceCartaFidelity like '%" + token + "%' or A.eMail like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_cliforEscludi() != 0L) + wc.addWc("A.id_clifor !=" + CR.getId_cliforEscludi()); + if (CR.getFlgAzienda() == 0L) { + wc.addWc("(A.flgAzienda is null or A.flgAzienda=0)"); + } else if (CR.getFlgAzienda() > 0L) { + wc.addWc("A.flgAzienda =" + CR.getFlgAzienda()); + } + if (CR.getFlgNascondiWeb() == 0L) { + wc.addWc("(A.flgNascondiWeb = 0 OR A.flgNascondiWeb IS NULL)"); + } else if (CR.getFlgNascondiWeb() > 0L) { + wc.addWc(" A.flgNascondiWeb =" + CR.getFlgNascondiWeb()); + } + if (CR.getFlgMl() == 0L) { + wc.addWc("(A.flgMl is null or A.flgMl=0)"); + } else if (CR.getFlgMl() > 0L) { + wc.addWc("A.flgMl =" + CR.getFlgMl()); + } + if (CR.getFlgSplitPayment() == 0L) { + wc.addWc("(A.flgSplitPayment is null or A.flgSplitPayment=0)"); + } else if (CR.getFlgSplitPayment() > 0L) { + wc.addWc("A.flgSplitPayment =" + CR.getFlgSplitPayment()); + } + if (CR.getFlgPA() == 0L) { + wc.addWc("(A.flgPA is null or A.flgPA=0)"); + } else if (CR.getFlgPA() > 0L) { + wc.addWc("A.flgPA =" + CR.getFlgPA()); + } + if (CR.getFlgEscludi() == 0L) { + wc.addWc("(A.flgEscludi is null or A.flgEscludi=0)"); + } else if (CR.getFlgEscludi() > 0L) { + wc.addWc("A.flgEscludi =" + CR.getFlgEscludi()); + } + if (CR.getId_usersResponsabile() > 0L) + wc.addWc("A.id_usersResponsabile = " + CR.getId_usersResponsabile()); + if (CR.getId_usersAttivita() > 0L) + wc.addWc("A.id_usersAttivita = " + CR.getId_usersAttivita()); + if (CR.getId_agente() > 0L) + wc.addWc("A.id_agente = " + CR.getId_agente()); + if (CR.getId_respCommerciale() > 0L) + wc.addWc("A.id_respCommerciale = " + CR.getId_respCommerciale()); + if (CR.getId_tipoClifor() > 0L) + wc.addWc("(B.id_tipoClifor = " + CR.getId_tipoClifor() + " or D.id_tipoClifor=" + CR.getId_tipoClifor() + ")"); + if (CR.getFlgTipologiaClifor() == 101L) { + wc.addWc("(C.flgTipologia = 1 or C.flgTipologia = 3)"); + } else if (CR.getFlgTipologiaClifor() == 102L) { + wc.addWc("(C.flgTipologia = 1 or C.flgTipologia = 3 or C.flgTipologia = 2)"); + } else if (CR.getFlgTipologiaClifor() > 0L) { + wc.addWc("C.flgTipologia = " + CR.getFlgTipologiaClifor()); + } + if (!CR.getDescrizioneComune().isEmpty()) + wc.addWc(" A.descrizioneComune LIKE '%" + CR.getDescrizioneComune() + "%'"); + if (!CR.getProvinciaComune().isEmpty()) + wc.addWc(" A.provinciaComune LIKE '%" + CR.getProvinciaComune() + "%'"); + if (CR.getFlgStatoConfermaDati() == 0L) { + wc.addWc("(A.flgStatoConfermaDati = 0 OR A.flgStatoConfermaDati IS NULL)"); + } else if (CR.getFlgStatoConfermaDati() > 0L) { + wc.addWc(" A.flgStatoConfermaDati =" + CR.getFlgStatoConfermaDati()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void initFields() { + super.initFields(); + setCurrentDD(null); + setFlgStatoConfermaDatiDb(0L); + setAnnoCorrente((long)getCurrentYear()); + } + + public String getDescrizioneComune() { + if (this.id_comune != 0L) + return getComune().getDescrizione(); + return (this.descrizioneComune == null) ? "" : this.descrizioneComune.trim(); + } + + public void setDescrizioneComune(String descrizioneComune) { + this.descrizioneComune = descrizioneComune; + } + + public String getProvinciaComune() { + if (this.id_comune != 0L) + return getComune().getProvincia(); + if (this.provinciaComune == null) + return ""; + if (this.provinciaComune.length() > 2) + return this.provinciaComune.substring(0, 2); + return this.provinciaComune; + } + + public void setProvinciaComune(String provinciaComune) { + this.provinciaComune = provinciaComune; + } + + public String getCapComune() { + if (this.id_comune != 0L) + return getComune().getCap(); + return (this.capComune == null) ? "" : this.capComune.trim(); + } + + public void setCapComune(String capComune) { + this.capComune = capComune; + } + + public String getPathAllegato() { + return getDocBase() + getDocBase() + getParm("CLIFOR_ATTACH_PATH").getTesto(); + } + + public Vectumerator getAllegati(long l_id_tipoAllegatoClifor) { + return new AllegatoClifor(getApFull()).findByCliforTipo(getId_clifor(), l_id_tipoAllegatoClifor, 0, 0); + } + + public ResParm addAllegato(AllegatoClifor row) { + AllegatoClifor bean = new AllegatoClifor(getApFull()); + bean.findByCliforNomeFile(row.getId_clifor(), row.getNomeFile()); + if (bean.getDBState() == 1) + return new ResParm(false, "Nome File Duplicato"); + row.setDBState(0); + ResParm rp = row.save(); + return rp; + } + + public ResParm delAllegato(AllegatoClifor row) { + AllegatoClifor bean = new AllegatoClifor(getApFull()); + bean.findByPrimaryKey(row.getId_allegatoClifor()); + return bean.delete(); + } + + public synchronized void creaCodaMessaggi(CliforCR CR, long l_id_templateMsg) { + CR.setFlgMl(1L); + Vectumerator vec = findByCR(CR, 0, 0); + TemplateMsg ts = new TemplateMsg(getApFull()); + ts.findByPrimaryKey(l_id_templateMsg); + String campagna = ts.getDescrizione() + " " + ts.getDescrizione(); + while (vec.hasMoreElements()) { + Clifor row = (Clifor)vec.nextElement(); + if (ts.getFlgTipo() == 1L) { + if (!row.getEMail().trim().isEmpty()) { + CodaMessaggi cm = new CodaMessaggi(getApFull()); + cm.setFlgTipo(ts.getFlgTipo()); + cm.setCampagna(campagna); + cm.setMailTo(row.getEMail().trim()); + cm.setOggettoEmail(ts.getOggettoEmail()); + ts.setParmMsgString("intestazione", row.getCognomeNome()); + cm.setTestoMessaggio(ts.getTestoMessaggioWithParms()); + cm.save(); + } + continue; + } + if (!row.getCellulare().trim().isEmpty()) { + CodaMessaggi cm = new CodaMessaggi(getApFull()); + cm.setFlgTipo(ts.getFlgTipo()); + cm.setCampagna(campagna); + cm.setCellulare(row.getCellulare().trim()); + cm.setTestoMessaggio(ts.getTestoMessaggio()); + cm.save(); + } + } + } + + public long getFlgRC() { + return this.flgRC; + } + + public void setFlgRC(long flgRC) { + this.flgRC = flgRC; + } + + public String getNominativoCompleto() { + if (getId_clifor() != 0L) { + StringBuilder temp = new StringBuilder(); + if (!getCognome().isEmpty()) { + temp.append(" "); + temp.append(getCognome()); + } + if (!getDescAggiuntiva().isEmpty()) { + temp.append(" "); + temp.append(getDescAggiuntiva()); + } + if (!getNome().isEmpty()) { + temp.append(" "); + temp.append(getNome()); + } + return temp.toString().trim(); + } + return ""; + } + + public String getCodiceCartaFidelity() { + return (this.codiceCartaFidelity == null) ? "" : this.codiceCartaFidelity.trim(); + } + + public void setCodiceCartaFidelity(String codiceCartaFidelity) { + this.codiceCartaFidelity = codiceCartaFidelity; + } + + public ByteArrayOutputStream creaPdfEtichettaZebra(String l_printer) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + Chunk nome, indirizzo, citta; + String dim = getParm("LABEL_ANAG_SIZE").getTesto(); + long xx = Long.parseLong(dim.substring(0, dim.indexOf(','))); + long yy = Long.parseLong(dim.substring(dim.indexOf(',') + 1)); + int fontSize = getParm("LABEL_ANAG_FONT_SIZE").getNumeroInt(); + Rectangle label = new Rectangle(getPdfPointSize(yy), getPdfPointSize(xx)); + this.document = new Document(label.rotate(), 2.0F, 2.0F, 2.0F, 2.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + String sp = " "; + String spp = " "; + String sppp = " "; + Font pdfTagliando = new Font(2, (float)fontSize, 1); + Font pdfTagliandoP = new Font(2, (float)(fontSize - 1), 1); + Font pdfTagliandoPP = new Font(2, (float)(fontSize - 2), 1); + String temp = getCognomeNome(); + if (temp.length() > 23) { + nome = new Chunk(spp + spp + "\n", pdfTagliandoP); + } else { + nome = new Chunk(sp + sp + "\n", pdfTagliando); + } + temp = getIndirizzo() + " " + getIndirizzo(); + if (temp.length() > 30) { + indirizzo = new Chunk(sppp + sppp + "\n", pdfTagliandoPP); + } else if (temp.length() > 23) { + indirizzo = new Chunk(spp + spp + "\n", pdfTagliandoP); + } else { + indirizzo = new Chunk(sp + sp + "\n", pdfTagliando); + } + temp = getComune().getCap() + " - " + getComune().getCap() + " (" + getComune().getDescrizione() + ")"; + if (temp.length() > 23) { + citta = new Chunk(spp + spp, pdfTagliandoP); + } else { + citta = new Chunk(sp + sp, pdfTagliando); + } + Paragraph p = new Paragraph(nome); + p.add(indirizzo); + p.add(citta); + this.document.add((Element)p); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public String getKoMsg() { + StringBuffer msg = new StringBuffer(); + if (getDBState() == 1) { + if (getCodFisc().isEmpty()) + msg.append("Codice fiscale mancante, "); + if (getFlgAzienda() == 1L && getPIva().isEmpty()) + msg.append("Partita Iva Mancante, "); + if (!getCodiceCartaFidelity().isEmpty() && getId_listino() == 0L) + msg.append("Listino mancante per cliente fidelity, "); + if (getFlgUsato() == 1L && + getFlgAzienda() == 0L && ( + getDescrizioneComune().isEmpty() || getDataNascita() == null || getNumeroDocumento().isEmpty())) + msg.append("Cliente privato usato senza comune/data nascita/numero documento, "); + } + return msg.toString(); + } + + public String getKoMsgWww() { + StringBuffer msg = new StringBuffer(); + if (getDBState() == 1) { + if ((getId_nazione().toLowerCase().equals("i") || getId_nazione().toLowerCase().equals("it")) && getCodFisc().isEmpty()) + msg.append("Codice fiscale mancante, "); + if (getFlgAzienda() == 1L && getPIva().isEmpty()) + msg.append("Partita Iva Mancante, "); + if (getFlgAzienda() == 0L && + getNome().isEmpty()) + msg.append("Nome mancante, "); + if (!isIndirizzoOk()) + msg.append("Indirizzo mancante, "); + if (getFlgUsato() == 1L && + getFlgAzienda() == 0L && ( + getDescrizioneComune().isEmpty() || getDataNascita() == null || getNumeroDocumento().isEmpty())) + msg.append("Cliente privato usato senza comune/data nascita/numero documento, "); + } + return msg.toString(); + } + + public boolean isOk() { + if (getId_clifor() == 0L) + return false; + if (getKoMsg().length() == 0) + return true; + return false; + } + + public ResParm save() { + ResParm rp = new ResParm(true); + long l_flgStatoConfermaDatiDb = getFlgStatoConfermaDatiDb(); + if (getCodFisc().isEmpty()) + setCodFisc(getCodFiscCalc()); + if (rp.getStatus()) { + rp = super.save(); + if (rp.getStatus()) { + rp.append(aggiornaUsersAssociati()); + if (getFlgStatoConfermaDati() != l_flgStatoConfermaDatiDb) { + CliforLog clog = new CliforLog(getApFull()); + clog.setId_users(getLastUpdId_user()); + clog.setId_clifor(getId_clifor()); + clog.setDescrizione("aggiornamento da admin"); + rp.append(clog.save(l_flgStatoConfermaDatiDb)); + } + } + return rp; + } + return rp; + } + + public ResParm saveStatoVerifica(long l_flgStatoConfermaDati, String msg) { + long l_flgStatoConfermaDatiDb = getFlgStatoConfermaDatiDb(); + setFlgStatoConfermaDati(l_flgStatoConfermaDati); + ResParm rp = super.save(); + if (rp.getStatus()) { + CliforLog clog = new CliforLog(getApFull()); + clog.setId_users(getLastUpdId_user()); + clog.setId_clifor(getId_clifor()); + clog.setDescrizione(msg); + rp.append(clog.save(l_flgStatoConfermaDatiDb)); + } + return rp; + } + + public String getDescrizioneComuneNascita() { + if (this.id_comuneNascita != 0L) + return getComuneNascita().getDescrizione(); + return (this.descrizioneComuneNascita == null) ? "" : this.descrizioneComuneNascita.trim(); + } + + public void setDescrizioneComuneNascita(String descrizioneComuneNascita) { + this.descrizioneComuneNascita = descrizioneComuneNascita; + } + + public DestinazioneDiversa getCurrentDD() { + if (this.currentDD == null && getId_clifor() > 0L) { + this.currentDD = new DestinazioneDiversa(getApFull()); + this.currentDD.findDefaultByClifor(getId_clifor()); + } + return (this.currentDD == null) ? new DestinazioneDiversa(getApFull()) : this.currentDD; + } + + public void setCurrentDD(DestinazioneDiversa currentDD) { + this.currentDD = currentDD; + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + setCurrentDD(null); + setFlgStatoConfermaDatiDb(getFlgStatoConfermaDati()); + if (getAnnoCorrente() == 0L) + setAnnoCorrente((long)getCurrentYear()); + } + + public boolean hasCurrentDD() { + if (getCurrentDD() == null || getCurrentDD().getId_destinazioneDiversa() == 0L) + return false; + return true; + } + + public String getpIva() { + return (this.pIva == null) ? "" : this.pIva.trim(); + } + + public void setpIva(String pIva) { + this.pIva = pIva; + } + + public String getTelefonoAmm() { + return (this.telefonoAmm == null) ? "" : this.telefonoAmm.trim(); + } + + public void setTelefonoAmm(String telefonoAmm) { + this.telefonoAmm = telefonoAmm; + } + + public String getEMailAmm() { + return (this.eMailAmm == null) ? "" : this.eMailAmm.trim(); + } + + public void setEMailAmm(String eMailAmm) { + this.eMailAmm = eMailAmm; + } + + public String getTelefonoAltro() { + return (this.telefonoAltro == null) ? "" : this.telefonoAltro.trim(); + } + + public void setTelefonoAltro(String telefonoAltro) { + this.telefonoAltro = telefonoAltro; + } + + public String getEMailAltro() { + return (this.eMailAltro == null) ? "" : this.eMailAltro.trim(); + } + + public void setEMailAltro(String eMailAltro) { + this.eMailAltro = eMailAltro; + } + + public String getCellulareAmm() { + return (this.cellulareAmm == null) ? "" : this.cellulareAmm.trim(); + } + + public void setCellulareAmm(String cellulareAmm) { + this.cellulareAmm = cellulareAmm; + } + + public String getCellulareAltro() { + return (this.cellulareAltro == null) ? "" : this.cellulareAltro.trim(); + } + + public void setCellulareAltro(String cellulareAltro) { + this.cellulareAltro = cellulareAltro; + } + + public String getDescrizioneAltroContatto() { + return (this.descrizioneAltroContatto == null) ? "" : this.descrizioneAltroContatto.trim(); + } + + public void setDescrizioneAltroContatto(String descrizioneAltroContatto) { + this.descrizioneAltroContatto = descrizioneAltroContatto; + } + + public String getNumeroDocumento() { + return (this.numeroDocumento == null) ? "" : this.numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public Date getDataScadenzaDocumento() { + return this.dataScadenzaDocumento; + } + + public void setDataScadenzaDocumento(Date dataScadenzaDocumento) { + this.dataScadenzaDocumento = dataScadenzaDocumento; + } + + public double getPercProvvigione() { + return this.percProvvigione; + } + + public void setPercProvvigione(double percProvvigione) { + this.percProvvigione = percProvvigione; + } + + public long getFlgDocumentoVerificato() { + return this.flgDocumentoVerificato; + } + + public void setFlgDocumentoVerificato(long flgDocumentoVerificato) { + this.flgDocumentoVerificato = flgDocumentoVerificato; + } + + public String getNotaPerCliente() { + return (this.notaPerCliente == null) ? "" : this.notaPerCliente; + } + + public void setNotaPerCliente(String notaPerCliente) { + this.notaPerCliente = notaPerCliente; + } + + public String getStatoDocumento() { + String ret = ""; + if (getFlgDocumentoVerificato() == 0L) { + ret = "Documento non verificato"; + } else if (getFlgDocumentoVerificato() == 10L) { + ret = "Documento non valido"; + } else if (getFlgDocumentoVerificato() == 15L) { + ret = "Documento in scadenza"; + } else if (getFlgDocumentoVerificato() == 20L) { + ret = "Documento scaduto"; + } else if (getFlgDocumentoVerificato() == 30L) { + ret = "Documento verificato."; + } + return ret; + } + + public Vectumerator findDocumentiScaduti() { + String s_Sql_Find = "select A.* from CLIFOR AS A "; + String s_Sql_Order = " order by A.cognome, A.nome\t"; + WcString wc = new WcString(); + wc.addWc(" A.dataScadenzaDocumento < ? "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + int dataCount = 0; + dataCount++; + Calendar cal = Calendar.getInstance(); + Date data = new Date(cal.getTimeInMillis()); + stmt.setDate(dataCount, data); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findDocumentiInScadenza() { + String s_Sql_Find = "select A.* from CLIFOR AS A "; + String s_Sql_Order = " order by A.cognome, A.nome\t"; + WcString wc = new WcString(); + wc.addWc(" A.dataScadenzaDocumento >= ? "); + wc.addWc(" A.dataScadenzaDocumento <= ? "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + int dataCount = 0; + dataCount++; + Calendar cal = Calendar.getInstance(); + Date data = new Date(cal.getTimeInMillis()); + stmt.setDate(dataCount, data); + dataCount++; + cal.add(2, 1); + Date data1 = new Date(cal.getTimeInMillis()); + stmt.setDate(dataCount, data1); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm checkStatoDocumento() { + ResParm rp = new ResParm(true); + StringBuilder sb = new StringBuilder(); + Vectumerator vec = findDocumentiScaduti(); + while (vec.hasMoreElements()) { + Clifor cli = (Clifor)vec.nextElement(); + cli.setFlgDocumentoVerificato(20L); + sb.append("Il cliente " + cli.getNominativoCompleto() + " ha il documento scaduto. \n"); + cli.save(); + } + vec = findDocumentiInScadenza(); + while (vec.hasMoreElements()) { + Clifor cli = (Clifor)vec.nextElement(); + cli.setFlgDocumentoVerificato(15L); + sb.append("Il cliente " + cli.getNominativoCompleto() + " ha il documento in scadenza nel prossimo mese. \n"); + cli.save(); + } + rp.setMsg(sb.toString()); + return rp; + } + + public Vectumerator findByRegione(String l_id_regione) { + String s_Sql_Find = "select A.* from CLIFOR AS A, COMUNE AS B "; + String s_Sql_Order = " order by B.provincia,A.cognome, B.descrizione "; + WcString wc = new WcString(); + wc.addWc(" A.id_comune = B.id_comune "); + wc.addWc(" A.flgTipo ='C' "); + wc.addWc(" B.id_regione = '" + l_id_regione + "' "); + wc.addWc(" (A.flgNascondiWeb = 0 OR A.flgNascondiWeb IS NULL)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizioneCliente() { + if (getId_clifor() != 0L) + return getNominativoCompleto().trim(); + return ""; + } + + public String getDescrizione() { + return getDescrizioneCliente(); + } + + public boolean hasDatiCompleti() { + if (getIndirizzo().isEmpty()) + return false; + return true; + } + + public long getFlgNascondiWeb() { + return this.flgNascondiWeb; + } + + public void setFlgNascondiWeb(long flgVisibileWeb) { + this.flgNascondiWeb = flgVisibileWeb; + } + + public ResParm addTipologia(CliforTipoClifor row) { + return row.save(); + } + + public ResParm delTipologia(CliforTipoClifor row) { + CliforTipoClifor bean = new CliforTipoClifor(getApFull()); + bean.findByPrimaryKey(row.getId_cliforTipoClifor()); + return bean.delete(); + } + + public boolean isPivaComunitariaOk() { + if (!getPIva().isEmpty()) { + boolean pivaOk = true; + String l_nazione = "IT"; + String l_pIva = getPIva(); + if (!getId_nazione().isEmpty() && + !getNazione().getCodice().toLowerCase().equals("it")) + if (getPIva().length() > 11) { + l_nazione = getPIva().substring(0, 2).toUpperCase(); + l_pIva = getPIva().substring(2); + } else { + l_nazione = null; + } + if (l_nazione == null) { + pivaOk = false; + } else { + CheckVatClient cvc = new CheckVatClient(l_nazione, l_pIva); + if (!cvc.getValid()) + pivaOk = false; + } + return pivaOk; + } + return true; + } + + public String getZona() { + return (this.zona == null) ? "" : this.zona.trim(); + } + + public void setZona(String zona) { + this.zona = zona; + } + + public DestinazioneDiversa getDestinazioneDiversa(int index) { + if (getApFull() != null) { + Vectumerator vec = new DestinazioneDiversa(getApFull()).findByClifor(getId_clifor(), 0, 0); + if (vec.hasMoreElements()) + return (DestinazioneDiversa)vec.get(index); + return new DestinazioneDiversa(getApFull()); + } + return new DestinazioneDiversa(); + } + + public void creaFileCvs(CliforCR CR) { + try { + Vectumerator list = findByCR(CR, 0, 0); + CR.setFileName(getPathTmp() + "exportClifor_" + getPathTmp() + "_" + CR.getFlgTipo() + "_" + CR.getId_users() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "Criteri di ricerca: " + CR.getDescrizioneCR() + "\nID;AZIENDA-COGNOME;NOME;CONTATTO;EMAIL;PEC;TELEFONO;FAX;CELL;NOTA;TIPO PAG.;COD. FISC;P.IVA;INDIRIZZO;N. CIVICO;COMUNE;CAP;CAP ZONA;NAZIONE;Responsabile;Attivita';INDIRIZZO DD;NUM CIVICO DD;COMUNE DD;CAP DD;CAP ZONA DD;NAZIONE DD"; + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + Clifor row = (Clifor)list.nextElement(); + s1 = " " + row.getId_clifor() + SEP + row.getCognome() + SEP + row.getNome() + SEP + row.getContatto() + SEP + row.getEMail() + SEP + row.getPec() + SEP + row.getTelefono() + SEP + row.getFax() + SEP + row.getCellulare() + SEP + row.getNota() + SEP + row.getTipoPagamento().getDescrizione() + SEP + row.getCodFisc() + SEP + row.getpIva() + SEP + row.getIndirizzo() + SEP + row.getNumeroCivico() + SEP + row.getDescrizioneComune() + SEP + row.getCapComune() + SEP + row.getCapZona() + SEP + row.getNazione().getDescrizione_it() + SEP + row.getUsersResponsabile().getCognomeNome() + SEP + row.getUsersAttivita().getCognomeNome() + SEP; + DestinazioneDiversa dd = row.getDestinazioneDiversa(0); + s1 = s1 + s1 + dd.getIndirizzoDD() + SEP + dd.getNumeroCivicoDD() + SEP + dd.getDescrizioneComuneDD() + SEP + dd.getCapComuneDD() + SEP + dd.getCapZonaDD() + SEP; + s1 = s1.replace("€", "€"); + s1 = s1.replace("»", "-->"); + s1 = s1.replace("\n", ", "); + s1 = s1.replace("\r", ""); + outCvsFile.writeLine(s1); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + + public void creaFileCvsGC(CliforCR CR) { + try { + Vectumerator list = findByCR(CR, 0, 0); + CR.setFileName(getPathTmp() + "exportCliforGC_" + getPathTmp() + "_" + CR.getFlgTipo() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "AZIENDA;NOME;COGNOME;P. IVA;COD. FISC;TIPO PAG.;INDIRIZZO;COMUNE;CAP;PROV;NAZIONE;TELEFONO;FAX;EMAIL;DESCRIZIONE DD;INDIRIZZO DD;COMUNE DD;CAP DD; PROV DD;NAZIONE DD;TELEFONO DD;FAX DD;EMAIL DD"; + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + Clifor row = (Clifor)list.nextElement(); + s1 = " " + SEP + row.getNome() + SEP + row.getCognome() + SEP + row.getpIva() + SEP + row.getCodFisc() + SEP + row.getTipoPagamento().getDescrizione() + SEP + row.getIndirizzo() + " " + row.getNumeroCivico() + SEP + row.getDescrizioneComune() + SEP + row.getCapComune() + SEP + row.getProvinciaComune() + SEP + row.getNazione().getDescrizione_it() + SEP + row.getTelefono() + SEP + row.getFax() + SEP + row.getEMail() + SEP; + DestinazioneDiversa dd = row.getDestinazioneDiversa(0); + s1 = s1 + s1 + " " + dd.getDescrizioneDD() + dd.getPressoDD() + SEP + " " + dd.getIndirizzoDD() + dd.getNumeroCivicoDD() + SEP + dd.getDescrizioneComuneDD() + SEP + dd.getCapComuneDD() + SEP + dd.getProvinciaComuneDD() + SEP + SEP + dd.getTelefonoDD() + SEP + SEP; + s1 = s1.replace("€", "€"); + s1 = s1.replace("»", "-->"); + outCvsFile.writeLine(s1); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + + public void creaFileCvsGF(CliforCR CR) { + try { + Vectumerator list = findByCR(CR, 0, 0); + CR.setFileName(getPathTmp() + "exportCliforGF_" + getPathTmp() + "_" + CR.getFlgTipo() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "AZIENDA;COD. FISC;P. IVA;INDIRIZZO;TELEFONO;cell;FAX;EMAIL;COMUNE;CAP;PROV;NAZIONE;DESCRIZIONE DD;INDIRIZZO DD;COMUNE DD;CAP DD; PROV DD;NAZIONE DD;TELEFONO DD;FAX DD;EMAIL DD"; + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + Clifor row = (Clifor)list.nextElement(); + s1 = " " + row.getCognomeNome() + SEP + row.getCodFisc() + SEP + row.getpIva() + SEP + row.getIndirizzo() + " " + row.getNumeroCivico() + SEP + row.getTelefono() + SEP + row.getCellulare() + SEP + row.getFax() + SEP + row.getEMail() + SEP + row.getDescrizioneComune() + SEP + row.getCapComune() + SEP + row.getProvinciaComune() + SEP + row.getNazione().getDescrizione_it(); + DestinazioneDiversa dd = row.getDestinazioneDiversa(0); + s1 = s1 + s1 + " " + dd.getDescrizioneDD() + dd.getPressoDD() + SEP + " " + dd.getIndirizzoDD() + dd.getNumeroCivicoDD() + SEP + dd.getDescrizioneComuneDD() + SEP + dd.getCapComuneDD() + SEP + dd.getProvinciaComuneDD() + SEP + SEP + dd.getTelefonoDD() + SEP + SEP; + s1 = s1.replace("€", "€"); + s1 = s1.replace("»", "-->"); + outCvsFile.writeLine(s1); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + + public long getId_bancaAzienda() { + return this.id_bancaAzienda; + } + + public void setId_bancaAzienda(long id_bancaAzienda) { + this.id_bancaAzienda = id_bancaAzienda; + setBancaAzienda(null); + } + + public Banca getBancaAzienda() { + this.bancaAzienda = (Banca)getSecondaryObject(this.bancaAzienda, Banca.class, getId_bancaAzienda()); + return this.bancaAzienda; + } + + public void setBancaAzienda(Banca bancaAzienda) { + this.bancaAzienda = bancaAzienda; + } + + public String getAbi() { + return (this.abi == null) ? "" : this.abi.trim(); + } + + public String getBic() { + return (this.bic == null) ? "" : this.bic.trim(); + } + + public String getCab() { + return (this.cab == null) ? "" : this.cab.trim(); + } + + public void setAbi(String abi) { + this.abi = abi; + } + + public void setBic(String bic) { + this.bic = bic; + } + + public void setCab(String cab) { + this.cab = cab; + } + + public double getSpeseIncasso() { + return this.speseIncasso; + } + + public void setSpeseIncasso(double speseIncasso) { + this.speseIncasso = speseIncasso; + } + + public void findClienteByCodiceAlt(String l_codiceAlt) { + String s_Sql_Find = "select A.* from CLIFOR AS A"; + String s_Sql_Order = " order by A.cognome, A.nome\t"; + WcString wc = new WcString(); + wc.addWc("A.flgTipo='C'"); + wc.addWc("A.codiceAlt='" + l_codiceAlt + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findFornitoreByCodiceAlt(String l_codiceAlt) { + String s_Sql_Find = "select A.* from CLIFOR AS A"; + String s_Sql_Order = " order by A.cognome, A.nome\t"; + WcString wc = new WcString(); + wc.addWc("A.flgTipo='F'"); + wc.addWc("A.codiceAlt='" + l_codiceAlt + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public ByteArrayOutputStream creaPdfListaClifor(CliforCR CR) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + Cell cell = new Cell(); + int cellLeading = 10; + int corpoPadding = 2; + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + Calendar cal = Calendar.getInstance(); + SimpleDateFormat sdfh = new SimpleDateFormat("hh:mm"); + NumberFormat nf = NumberFormat.getInstance(); + nf.setMinimumFractionDigits(2); + nf.setMaximumFractionDigits(2); + Date dataVisita = null; + int col1 = 10, col2 = 9, col3 = 4, col4 = 4, col5 = 4, col6 = 4, col7 = 5; + try { + this.document = new Document(PageSize.A4.rotate(), 20.0F, 20.0F, 20.0F, 10.0F); + String nomeFile = CR.getFileName(); + if (nomeFile.isEmpty()) { + this.writer = PdfWriter.getInstance(this.document, ba); + } else { + PdfWriter.getInstance(this.document, new FileOutputStream(nomeFile)); + } + Font PDF_riga = PdfFontFactory.PDF_fPiccolo; + Phrase pHh = new Phrase(new Chunk("Lista clienti", PdfFontFactory.PDF_fGrandeB)); + HeaderFooter header = new HeaderFooter(pHh, false); + header.setAlignment(0); + header.setBorder(0); + this.document.setHeader(header); + Phrase pH = new Phrase("Data/ora stampa: " + sdf.format(getToday()) + " " + sdfh.format(Long.valueOf(cal.getTimeInMillis())) + " pag. "); + HeaderFooter footer = new HeaderFooter(pH, true); + footer.setAlignment(2); + footer.setBorder(0); + this.document.setFooter(footer); + this.document.open(); + Clifor bean = new Clifor(getApFull()); + Table corpo = null; + corpo = new Table(40); + corpo.setWidth(100.0F); + corpo.setPadding((float)corpoPadding); + corpo.setSpacing(0.0F); + corpo.setWidths(colWidthsRighe40); + corpo.setBorder(0); + corpo.endHeaders(); + cell = new Cell(); + cell.add(new Chunk("Nominativo", PdfFontFactory.PDF_fGrandeBianco)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col1); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Indirizzo", PdfFontFactory.PDF_fGrandeBianco)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col2); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Tel.", PdfFontFactory.PDF_fGrandeBianco)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col3); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Cell.", PdfFontFactory.PDF_fGrandeBianco)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col4); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Email", PdfFontFactory.PDF_fGrandeBianco)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col5); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Listino ass.", PdfFontFactory.PDF_fGrandeBianco)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col6); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Note", PdfFontFactory.PDF_fGrandeBianco)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col7); + cell.setRowspan(1); + corpo.addCell(cell); + corpo.endHeaders(); + Vectumerator vec = bean.findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Clifor row = (Clifor)vec.nextElement(); + cell = new Cell(); + cell.add(new Chunk(row.getDescrizioneCliente(), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col1); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(row.getIndirizzoCompleto(), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col2); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(row.getTelefono(), PdfFontFactory.PDF_fPiccolo)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col3); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(String.valueOf(row.getCellulare()), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col4); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(row.getEMail(), PDF_riga)); + if (!row.getPec().isEmpty()) + cell.add(new Chunk("\n" + row.getPec(), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col5); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(row.getListino().getDescrizione(), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col6); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(row.getNotaPerCliente(), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col7); + cell.setRowspan(1); + corpo.addCell(cell); + } + this.document.add((Element)corpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public long getId_agente() { + return this.id_agente; + } + + public void setId_agente(long id_agente) { + this.id_agente = id_agente; + } + + public Clifor getAgente() { + this.agente = (Clifor)getSecondaryObject(this.agente, Clifor.class, getId_agente()); + return this.agente; + } + + public void setAgente(Clifor agente) { + this.agente = agente; + } + + public long getId_respCommerciale() { + return this.id_respCommerciale; + } + + public void setId_respCommerciale(long id_respCommerciale) { + this.id_respCommerciale = id_respCommerciale; + } + + public Clifor getRespCommerciale() { + this.respCommerciale = (Clifor)getSecondaryObject(this.respCommerciale, Clifor.class, getId_respCommerciale()); + return this.respCommerciale; + } + + public void setRespCommerciale(Clifor respCommerciale) { + this.respCommerciale = respCommerciale; + } + + public double getPercAgente() { + return this.percAgente; + } + + public void setPercAgente(double percAgente) { + this.percAgente = percAgente; + } + + public double getPercRespCommerciale() { + return this.percRespCommerciale; + } + + public void setPercRespCommerciale(double percRespCommerciale) { + this.percRespCommerciale = percRespCommerciale; + } + + public Vectumerator findByAgente(long l_id_agente) { + String s_Sql_Find = "select A.* from CLIFOR AS A"; + String s_Sql_Order = " order by A.cognome, A.nome\t"; + WcString wc = new WcString(); + wc.addWc("A.id_agente=" + l_id_agente); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm superSave() { + return super.save(); + } + + public boolean isAgenteOResponsabileCommerciale() { + if (getDBState() == 0) + return false; + return new CliforTipoClifor(getApFull()).isAgenteORespondabileCommercialeByClifor(getId_clifor()); + } + + public boolean isAgente() { + if (getDBState() == 0) + return false; + return new CliforTipoClifor(getApFull()).isAgenteByClifor(getId_clifor()); + } + + public boolean isPrezzoWebEsente() { + if (getId_clifor() == 0L) + return false; + if (isIvaEsteroAziendaEsente()) { + DestinazioneDiversa dd = getCurrentDD(); + if (dd.getId_destinazioneDiversa() > 0L) { + if (dd.getNazioneDD().getFlgCee() == 0L) + return true; + if (getNazione().getCodice().equals("IT")) { + if (dd.getNazioneDD().getCodice().equals("IT")) + return false; + if (getFlgAzienda() == 1L && !getpIva().isEmpty()) + return true; + return false; + } + if (getNazione().getFlgCee() == 1L && getFlgAzienda() == 1L && !getpIva().isEmpty() && + !dd.getNazioneDD().getCodice().equals("IT")) + return true; + return false; + } + if (getNazione().getCodice().equals("IT") || ( + getNazione().getFlgCee() == 1L && getFlgAzienda() == 0L)) + return false; + return true; + } + return false; + } + + public boolean isPrezzoWebOss() { + if (isIvaCeeOneStopShop() && !getNazione().getCodice().toUpperCase().equals("IT") && + getNazione().getFlgCee() == 1L) + return true; + return false; + } + + public boolean isProgettista() { + if (getDBState() == 0) + return false; + return new CliforTipoClifor(getApFull()).isProgettistaByClifor(getId_clifor()); + } + + public boolean isResponsabileCommerciale() { + if (getDBState() == 0) + return false; + return new CliforTipoClifor(getApFull()).isRespondabileCommercialeByClifor(getId_clifor()); + } + + public String getDescrizioneAgenteResponsabileCommerciale() { + if (getDBState() == 0) + return ""; + StringBuilder sb = new StringBuilder(); + if (isAgente()) + sb.append("Agente "); + if (isResponsabileCommerciale()) + sb.append("Resp. Comm."); + return sb.toString().trim(); + } + + public String getPec() { + return (this.pec == null) ? "" : this.pec.trim(); + } + + public void setPec(String pec) { + this.pec = pec; + } + + public String getDescAggiuntiva() { + return (this.descAggiuntiva == null) ? "" : this.descAggiuntiva.trim(); + } + + public void setDescAggiuntiva(String descAggiuntiva) { + this.descAggiuntiva = descAggiuntiva; + } + + public String getCodiceIdentificativoFE() { + return (this.codiceIdentificativoFE == null) ? "" : this.codiceIdentificativoFE.trim().toUpperCase(); + } + + public void setCodiceIdentificativoFE(String codiceIdentificativoFE) { + this.codiceIdentificativoFE = codiceIdentificativoFE; + } + + public long getFlgPA() { + return this.flgPA; + } + + public void setFlgPA(long flgPA) { + this.flgPA = flgPA; + } + + public double getCostoOrarioAssistenza() { + return this.costoOrarioAssistenza; + } + + public void setCostoOrarioAssistenza(double costoOrarioAssistenza) { + this.costoOrarioAssistenza = costoOrarioAssistenza; + } + + public long getFlgUsaContrattoOre() { + return this.flgUsaContrattoOre; + } + + public void setFlgUsaContrattoOre(long flgUsaContrattoOre) { + this.flgUsaContrattoOre = flgUsaContrattoOre; + } + + public String getFEIndirizzo() { + return getIndirizzo(); + } + + public String getFENumeroCivico() { + return getNumeroCivico(); + } + + public String getFECAP() { + if (getCapZona().isEmpty()) + return getCapComune(); + return getCapZona(); + } + + public String getFEComune() { + return getDescrizioneComune(); + } + + public String getFEProvincia() { + return getProvinciaComune(); + } + + public String getFENazione() { + return getNazione().getCodice(); + } + + public String getFEPartitaIva() { + return getPIva(); + } + + public String getFECodiceFiscale() { + return getCodFisc(); + } + + public String getFEDenominazione() { + if (getFlgAzienda() == 1L) + return getCognome(); + return ""; + } + + public String getFECognome() { + return getCognome(); + } + + public String getFENome() { + return getNome(); + } + + public String getFETitolo() { + return null; + } + + public String getFECodEORI() { + return null; + } + + public String getFEPaese() { + return getNazione().getCodice(); + } + + public boolean isFEPaeseCEE() { + return (getNazione().getFlgCee() == 1L); + } + + public boolean isDatiFEOK() { + if (getNazione().getCodice().toUpperCase().equals("IT")) { + if (getCodiceIdentificativoFE().isEmpty() && getPec().isEmpty()) + return false; + return true; + } + return true; + } + + public long getFlgSplitPayment() { + return this.flgSplitPayment; + } + + public void setFlgSplitPayment(long flgSplitPayment) { + this.flgSplitPayment = flgSplitPayment; + } + + public boolean isDatiUsatoOk() { + if (getFlgUsato() == 1L) { + if (!getPIva().isEmpty()) + return true; + if (getDataNascita() == null || getDescrizioneComune().isEmpty() || getProvinciaComune().isEmpty() || + getNumeroDocumento().isEmpty()) + return false; + return true; + } + return true; + } + + public long getFlgUsato() { + return this.flgUsato; + } + + public void setFlgUsato(long flgUsato) { + this.flgUsato = flgUsato; + } + + public String getProvinciaComuneNascita() { + if (this.id_comuneNascita != 0L) + return getComuneNascita().getProvincia(); + if (this.provinciaComuneNascita == null) + return ""; + if (this.provinciaComuneNascita.length() > 2) + return this.provinciaComuneNascita.substring(0, 2); + return this.provinciaComuneNascita; + } + + public void setProvinciaComuneNascita(String provinciaComuneNascita) { + this.provinciaComuneNascita = provinciaComuneNascita; + } + + public String getDescrizioneCompletaA() { + if (getId_clifor() != 0L) { + if (getParm("ANAG_DESC_COMPLETA_CON_TIPO").isTrue()) { + StringBuffer stringBuffer = new StringBuffer(getFlgTipo() + " - "); + if (!getCodiceAlt().isEmpty()) { + stringBuffer.append(getCodiceAlt()); + stringBuffer.append(" "); + } + stringBuffer.append(getNominativoCompleto()); + return stringBuffer.toString(); + } + StringBuffer temp = new StringBuffer(); + if (getFlgAzienda() == 1L) + temp.append("(A)"); + if (!getCodiceAlt().isEmpty()) { + temp.append(getCodiceAlt()); + temp.append(" "); + } + temp.append(getNominativoCompleto()); + return temp.toString(); + } + return ""; + } + + public long getFlgTaxFree() { + return this.flgTaxFree; + } + + public void setFlgTaxFree(long flgTaxFree) { + this.flgTaxFree = flgTaxFree; + } + + public String getImportPrefissoCodice() { + return (this.importPrefissoCodice == null) ? "" : this.importPrefissoCodice.trim(); + } + + public void setImportPrefissoCodice(String importPrefissoCodice) { + this.importPrefissoCodice = importPrefissoCodice; + } + + public String getImportLinkFornitore() { + return (this.importLinkFornitore == null) ? "" : this.importLinkFornitore.trim(); + } + + public void setImportLinkFornitore(String importLinkFornitore) { + this.importLinkFornitore = importLinkFornitore; + } + + public Users getUserWww() { + Vectumerator vec = new Users(getApFull()).findByClifor(getId_clifor(), 1, 1); + if (vec.hasMoreElements()) + return (Users)vec.nextElement(); + return new Users(getApFull()); + } + + public boolean isSpeseSpedizioneWwwPreventivo() { + if (!getCurrentDD().getId_nazioneDD().isEmpty()) { + if (getCurrentDD().getNazioneDD().getFlgPreventivoWww() == 0L) + return false; + return true; + } + if (getNazione().getFlgPreventivoWww() == 0L) + return false; + return true; + } + + public boolean isIndirizzoOk() { + if (getIndirizzo().isEmpty() || getNumeroCivico().isEmpty() || (getCapComune().isEmpty() && getCapZona().isEmpty()) || + getDescrizioneComune().isEmpty() || getProvinciaComune().isEmpty() || getId_nazione().isEmpty()) + return false; + return true; + } + + public long getFlgAbilitaAF() { + return this.flgAbilitaAF; + } + + public double getValoreMinimoAbilitaAF() { + return this.valoreMinimoAbilitaAF; + } + + public void setFlgAbilitaAF(long flgAbilitaAF) { + this.flgAbilitaAF = flgAbilitaAF; + } + + public Vectumerator findFornitoriConImportPrefissoCodice() { + String s_Sql_Find = "select A.* from CLIFOR AS A"; + String s_Sql_Order = " order by A.cognome, A.nome\t"; + WcString wc = new WcString(); + wc.addWc("A.importPrefissoCodice is not null"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getImportLinkFornitoreEan() { + return (this.importLinkFornitoreEan == null) ? "" : this.importLinkFornitoreEan.trim(); + } + + public void setImportLinkFornitoreEan(String importLinkFornitoreEan) { + this.importLinkFornitoreEan = importLinkFornitoreEan; + } + + public void setValoreMinimoAbilitaAF(double valoreMinimoAbilitaAF) { + this.valoreMinimoAbilitaAF = valoreMinimoAbilitaAF; + } + + public boolean isOkWww() { + if (getId_clifor() == 0L) + return false; + if (getKoMsgWww().length() == 0) + return true; + return false; + } + + public long getFlgStatoCivile() { + return this.flgStatoCivile; + } + + public void setFlgStatoCivile(long flgStatoCivile) { + this.flgStatoCivile = flgStatoCivile; + } + + public Vectumerator findPersoneCarico(int pageNumber, int pageRows) { + return new PersonaCarico(getApFull()).findByCliente(getId_clifor(), pageNumber, pageRows); + } + + public long getId_ottoxmille() { + return this.id_ottoxmille; + } + + public void setId_ottoxmille(long id_ottoxmille) { + this.id_ottoxmille = id_ottoxmille; + setOttoxmille(null); + } + + public Ottoxmille getOttoxmille() { + this.ottoxmille = (Ottoxmille)getSecondaryObject(this.ottoxmille, Ottoxmille.class, getId_ottoxmille()); + return this.ottoxmille; + } + + public void setOttoxmille(Ottoxmille ottoxmille) { + this.ottoxmille = ottoxmille; + } + + public String getCf5xmille() { + return (this.cf5xmille == null) ? "" : this.cf5xmille.trim(); + } + + public void setCf5xmille(String cf5xmille) { + this.cf5xmille = cf5xmille; + } + + public String getCodice2xmille() { + return (this.codice2xmille == null) ? "" : this.codice2xmille; + } + + public void setCodice2xmille(String codice2xmille) { + this.codice2xmille = codice2xmille; + } + + public double getCostoSpedizioneAggiuntivo() { + return this.costoSpedizioneAggiuntivo; + } + + public double getCostoSpedizioneAggiuntivoConIva() { + return conIva(getCostoSpedizioneAggiuntivo(), getParm(Cart.P_DELIVERY_IVA_ALIQUOTA).getNumeroDouble()); + } + + public void setCostoSpedizioneAggiuntivo(double costoSpedizioneAggiuntivo) { + this.costoSpedizioneAggiuntivo = costoSpedizioneAggiuntivo; + } + + public long getId_usersAttivita() { + return this.id_usersAttivita; + } + + public void setId_usersAttivita(long id_usersAttivita) { + this.id_usersAttivita = id_usersAttivita; + setUsersAttivita(null); + } + + public Users getUsersAttivita() { + this.usersAttivita = (Users)getSecondaryObject((DBAdapter)this.usersAttivita, Users.class, getId_usersAttivita()); + return this.usersAttivita; + } + + public void setUsersAttivita(Users usersAttivita) { + this.usersAttivita = usersAttivita; + } + + public String getPathImg() { + return getPathAllegato(); + } + + public long getFlgStatoConfermaDati() { + return this.flgStatoConfermaDati; + } + + public void setFlgStatoConfermaDati(long flgStatoConfermaDati) { + this.flgStatoConfermaDati = flgStatoConfermaDati; + } + + public long getFlgStatoConfermaDatiDb() { + return this.flgStatoConfermaDatiDb; + } + + public void setFlgStatoConfermaDatiDb(long flgStatoConfermaDatiDb) { + this.flgStatoConfermaDatiDb = flgStatoConfermaDatiDb; + } + + public final String getStatoConfermaDatiIcon() { + if (getId_clifor() == 0L) + return ""; + if (getFlgStatoConfermaDati() == 1L) + return " "; + if (getFlgStatoConfermaDati() == 0L) + return " "; + if (getFlgStatoConfermaDati() == 9L) + return " "; + return ""; + } + + public long getAnnoCorrente() { + return this.annoCorrente; + } + + public void setAnnoCorrente(long annoCorrente) { + this.annoCorrente = annoCorrente; + } + + public double getPrezzoCatenaAlMt() { + return this.prezzoCatenaAlMt; + } + + public void setPrezzoCatenaAlMt(double prezzoCatenaAlMt) { + this.prezzoCatenaAlMt = prezzoCatenaAlMt; + } + + public long getId_usersResponsabile() { + return this.id_usersResponsabile; + } + + public void setUsersResponsabile(Users usersResponsabile) { + this.usersResponsabile = usersResponsabile; + } + + public Users getUsersResponsabile() { + this.usersResponsabile = (Users)getSecondaryObject((DBAdapter)this.usersResponsabile, Users.class, getId_usersResponsabile()); + return this.usersResponsabile; + } + + public void setId_usersResponsabile(long id_usersResponsabile) { + this.id_usersResponsabile = id_usersResponsabile; + setUsersResponsabile(null); + } + + public long getFlgEscludi() { + return this.flgEscludi; + } + + public void setFlgAzienda(long newFlgAzienda) { + this.flgAzienda = newFlgAzienda; + } + + public ResParm cambiaFlg(String l_flg) { + ResParm rp = new ResParm(true); + if (l_flg.equals("flgEscludi")) + setFlgEscludi((getFlgEscludi() == 1L) ? 0L : 1L); + rp = superSave(); + return rp; + } + + public PudoAddress getPudoAddress() { + String indirizzo = getIndirizzo() + ", " + getIndirizzo(); + String zipCode = getCapZona().isEmpty() ? getCapComune() : getCapZona(); + String city = getDescrizioneComune(); + if (!getCurrentDD().getIndirizzoDD().isEmpty()) { + indirizzo = getCurrentDD().getIndirizzoDD() + ", " + getCurrentDD().getIndirizzoDD(); + if (getCurrentDD().getCapZonaDD().isEmpty()) { + zipCode = getCurrentDD().getCapComuneDD(); + } else { + zipCode = getCurrentDD().getCapZonaDD(); + } + city = getCurrentDD().getDescrizioneComuneDD(); + } + PudoAddress pa = new PudoAddress(indirizzo, zipCode, city); + return pa; + } + + public long getFlgBlacklist() { + return this.flgBlacklist; + } + + public void setFlgBlacklist(long flgBlacklist) { + this.flgBlacklist = flgBlacklist; + } + + public String getNotaBlacklist() { + return (this.notaBlacklist == null) ? "" : this.notaBlacklist.trim(); + } + + public void setNotaBlacklist(String notaBlacklist) { + this.notaBlacklist = notaBlacklist; + } + + public boolean isTipologiaClifor(long l_id_tipologia) { + if (getDBState() == 0) + return false; + CliforTipoClifor ctc = new CliforTipoClifor(getApFull()); + return ctc.isTipologiaCliforByClifor(getId_clifor(), l_id_tipologia); + } + + public ResParm aggiornaUsersAssociati() { + ResParm rp = new ResParm(true); + try { + Vectumerator vec = new Users(getApFull()).findByClifor(getId_clifor(), 0, 0); + while (vec.hasMoreElements()) { + Users u = (Users)vec.nextElement(); + rp = u.save(); + if (!rp.getStatus()) + return rp; + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg("Eccezione in aggiornaUsersAssociati: " + e.getMessage()); + } + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforCR.java new file mode 100644 index 00000000..c2030ea3 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforCR.java @@ -0,0 +1,737 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import java.sql.Date; + +public class CliforCR extends CRAdapter { + private long id_clifor; + + private long id_tipoPagamento; + + private String codiceAlt; + + private long flgValido; + + private String flgTipo; + + private long flgAzienda = -1L; + + private String cognome; + + private String contatto; + + private String nome; + + private String testoMessaggio; + + private String numeroCivico; + + private long id_comune; + + private long id_nazione; + + private Date dataNascita; + + private String codFisc; + + private String pIva; + + private String eMail; + + private String fax; + + private String telefono; + + private String nota; + + private String imgTmst; + + private long flgPrivComunicazione; + + private long flgPrivSensibili; + + private long flgPrivTrattamento; + + private long flgSesso; + + private String indirizzoSped; + + private String numeroCivicoSped; + + private String presso; + + private long id_nazioneSped; + + private long id_comuneSped; + + private Date dataRegistrazioneDI; + + private String dichiarazioneIntento; + + private String flgCF; + + private long flgArt8; + + private long flgTipologiaClifor; + + private TipoPagamento tipoPagamento; + + private Comune comune; + + private Nazione nazione; + + private Nazione nazioneSped; + + private Comune comuneSped; + + private long id_cliforEscludi; + + private String indirizzo; + + private long flgMlCreata = 0L; + + private String mailingListEmail; + + private long flgMl = -1L; + + private String searchTxt2; + + private String numeroDocumento; + + private Date DataScadenzaDocumento; + + private double percProvvigione; + + private long flgNascondiWeb = -1L; + + private String fileName; + + private String descrizioneComune; + + private String provinciaComune; + + private Clifor agente; + + private long id_agente; + + private long id_respCommerciale; + + private Clifor respCommerciale; + + private long id_tipoClifor; + + private long flgPA = -1L; + + private long flgSplitPayment = -1L; + + private long flgTaxFree = -1L; + + private long id_usersResponsabile; + + private Users usersResponsabile; + + private long flgStatoConfermaDati = -1L; + + private long id_usersAttivita; + + private Users usersAttivita; + + private long flgEscludi = -1L; + + public CliforCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CliforCR() {} + + public void setId_clifor(long newId_cliFor) { + this.id_clifor = newId_cliFor; + } + + public void setId_tipoPagamento(long newId_tipoPagamento) { + this.id_tipoPagamento = newId_tipoPagamento; + setTipoPagamento(null); + } + + public void setCodiceAlt(String newCodiceAlt) { + this.codiceAlt = newCodiceAlt; + } + + public void setFlgValido(long newFlgValido) { + this.flgValido = newFlgValido; + } + + public void setFlgTipo(String newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public void setFlgAzienda(long newFlgAzienda) { + this.flgAzienda = newFlgAzienda; + } + + public void setCognome(String newCognome) { + this.cognome = newCognome; + } + + public void setContatto(String newContatto) { + this.contatto = newContatto; + } + + public void setNome(String newNome) { + this.nome = newNome; + } + + public void setIndirizzo(String newIndirizzo) { + this.indirizzo = newIndirizzo; + } + + public void setNumeroCivico(String newNumeroCivico) { + this.numeroCivico = newNumeroCivico; + } + + public void setId_comune(long newId_comune) { + this.id_comune = newId_comune; + setComune(null); + } + + public void setId_nazione(long newId_nazione) { + this.id_nazione = newId_nazione; + setNazione(null); + } + + public void setDataNascita(Date newDataNascita) { + this.dataNascita = newDataNascita; + } + + public void setCodFisc(String newCodFisc) { + this.codFisc = newCodFisc; + } + + public void setPIva(String newPIva) { + this.pIva = newPIva; + } + + public void setEMail(String newEMail) { + this.eMail = newEMail; + } + + public void setFax(String newFax) { + this.fax = newFax; + } + + public void setTelefono(String newTelefono) { + this.telefono = newTelefono; + } + + public void setNota(String newNota) { + this.nota = newNota; + } + + public void setImgTmst(String newImgTmst) { + this.imgTmst = newImgTmst; + } + + public void setFlgPrivComunicazione(long newFlgPrivComunicazione) { + this.flgPrivComunicazione = newFlgPrivComunicazione; + } + + public void setFlgPrivSensibili(long newFlgPrivSensibili) { + this.flgPrivSensibili = newFlgPrivSensibili; + } + + public void setFlgPrivTrattamento(long newFlgPrivTrattamento) { + this.flgPrivTrattamento = newFlgPrivTrattamento; + } + + public void setFlgSesso(long newFlgSesso) { + this.flgSesso = newFlgSesso; + } + + public void setIndirizzoSped(String newIndirizzoSped) { + this.indirizzoSped = newIndirizzoSped; + } + + public void setNumeroCivicoSped(String newNumeroCivicoSped) { + this.numeroCivicoSped = newNumeroCivicoSped; + } + + public void setPresso(String newPresso) { + this.presso = newPresso; + } + + public void setId_nazioneSped(long newId_nazioneSped) { + this.id_nazioneSped = newId_nazioneSped; + setNazione(null); + } + + public void setId_comuneSped(long newId_comuneSped) { + this.id_comuneSped = newId_comuneSped; + setComune(null); + } + + public void setDataRegistrazioneDI(Date newDataRegistrazioneDI) { + this.dataRegistrazioneDI = newDataRegistrazioneDI; + } + + public void setDichiarazioneIntento(String newDichiarazioneIntento) { + this.dichiarazioneIntento = newDichiarazioneIntento; + } + + public void setFlgArt8(long newFlgArt8) { + this.flgArt8 = newFlgArt8; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_tipoPagamento() { + return this.id_tipoPagamento; + } + + public String getCodiceAlt() { + return (this.codiceAlt == null) ? "" : this.codiceAlt.trim(); + } + + public long getFlgValido() { + return this.flgValido; + } + + public String getFlgTipo() { + return (this.flgTipo == null) ? "" : this.flgTipo.trim(); + } + + public String getTipo() { + return Clifor.getTipo(getFlgTipo()); + } + + public long getFlgAzienda() { + return this.flgAzienda; + } + + public String getCognome() { + return (this.cognome == null) ? "" : this.cognome.trim(); + } + + public String getContatto() { + return (this.contatto == null) ? "" : this.contatto.trim(); + } + + public String getNome() { + return (this.nome == null) ? "" : this.nome.trim(); + } + + public String getIndirizzo() { + return (this.indirizzo == null) ? "" : this.indirizzo.trim(); + } + + public String getNumeroCivico() { + return (this.numeroCivico == null) ? "" : this.numeroCivico.trim(); + } + + public long getId_comune() { + return this.id_comune; + } + + public long getId_nazione() { + return this.id_nazione; + } + + public Date getDataNascita() { + return this.dataNascita; + } + + public String getCodFisc() { + return (this.codFisc == null) ? "" : this.codFisc.trim(); + } + + public String getPIva() { + return (this.pIva == null) ? "" : this.pIva.trim(); + } + + public String getEMail() { + return (this.eMail == null) ? "" : this.eMail.trim(); + } + + public String getFax() { + return (this.fax == null) ? "" : this.fax.trim(); + } + + public String getTelefono() { + return (this.telefono == null) ? "" : this.telefono.trim(); + } + + public String getNota() { + return (this.nota == null) ? "" : this.nota.trim(); + } + + public String getImgTmst() { + return (this.imgTmst == null) ? "" : this.imgTmst.trim(); + } + + public long getFlgPrivComunicazione() { + return this.flgPrivComunicazione; + } + + public long getFlgPrivSensibili() { + return this.flgPrivSensibili; + } + + public long getFlgPrivTrattamento() { + return this.flgPrivTrattamento; + } + + public long getFlgSesso() { + return this.flgSesso; + } + + public String getIndirizzoSped() { + return (this.indirizzoSped == null) ? "" : this.indirizzoSped.trim(); + } + + public String getNumeroCivicoSped() { + return (this.numeroCivicoSped == null) ? "" : this.numeroCivicoSped.trim(); + } + + public String getPresso() { + return (this.presso == null) ? "" : this.presso.trim(); + } + + public long getId_nazioneSped() { + return this.id_nazioneSped; + } + + public long getId_comuneSped() { + return this.id_comuneSped; + } + + public Date getDataRegistrazioneDI() { + return this.dataRegistrazioneDI; + } + + public String getDichiarazioneIntento() { + return (this.dichiarazioneIntento == null) ? "" : this.dichiarazioneIntento.trim(); + } + + public long getFlgArt8() { + return this.flgArt8; + } + + public void setTipoPagamento(TipoPagamento newTipoPagamento) { + this.tipoPagamento = newTipoPagamento; + } + + public TipoPagamento getTipoPagamento() { + this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, getId_tipoPagamento()); + return this.tipoPagamento; + } + + public void setComune(Comune newComune) { + this.comune = newComune; + } + + public Comune getComune() { + this.comune = (Comune)getSecondaryObject(this.comune, Comune.class, getId_comune()); + return this.comune; + } + + public void setNazione(Nazione newNazione) { + this.nazione = newNazione; + } + + public Nazione getNazione() { + this.nazione = (Nazione)getSecondaryObject(this.nazione, Nazione.class, getId_nazione()); + return this.nazione; + } + + public void setNazioneSped(Nazione newNazione) { + this.nazioneSped = newNazione; + } + + public Nazione getNazioneSped() { + this.nazioneSped = (Nazione)getSecondaryObject(this.nazioneSped, Nazione.class, getId_nazioneSped()); + return this.nazioneSped; + } + + public void setComuneSped(Comune newComune) { + this.comuneSped = newComune; + } + + public Comune getComuneSped() { + this.comuneSped = (Comune)getSecondaryObject(this.comuneSped, Comune.class, getId_comuneSped()); + return this.comuneSped; + } + + public String getFlgCF() { + return (this.flgCF == null) ? AB_EMPTY_STRING : this.flgCF; + } + + public String getCF() { + if (getFlgCF().equals("C")) + return "Cliente"; + if (getFlgCF().equals("F")) + return "Fornitore"; + return AB_EMPTY_STRING; + } + + public void setFlgCF(String flgCF) { + this.flgCF = flgCF; + setFlgTipo(flgCF); + } + + public long getId_cliforEscludi() { + return this.id_cliforEscludi; + } + + public void setId_cliforEscludi(long id_cliforEscludi) { + this.id_cliforEscludi = id_cliforEscludi; + } + + public String getTestoMessaggio() { + return (this.testoMessaggio == null) ? AB_EMPTY_STRING : this.testoMessaggio.trim(); + } + + public void setTestoMessaggio(String testoMessaggio) { + this.testoMessaggio = testoMessaggio; + } + + public long getFlgMlCreata() { + return this.flgMlCreata; + } + + public void setFlgMlCreata(long flgMlCreata) { + this.flgMlCreata = flgMlCreata; + } + + public String getMailingListEmail() { + return this.mailingListEmail; + } + + public void setMailingListEmail(String mailingListEmail) { + this.mailingListEmail = mailingListEmail; + } + + public long getFlgMl() { + return this.flgMl; + } + + public void setFlgMl(long flgMl) { + this.flgMl = flgMl; + } + + public String getSearchTxt2() { + return (this.searchTxt2 == null) ? AB_EMPTY_STRING : this.searchTxt2; + } + + public void setSearchTxt2(String searchText2) { + this.searchTxt2 = searchText2; + } + + public String getNumeroDocumento() { + return this.numeroDocumento; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public Date getDataScadenzaDocumento() { + return this.DataScadenzaDocumento; + } + + public void setDataScadenzaDocumento(Date dataScadenzaDocumento) { + this.DataScadenzaDocumento = dataScadenzaDocumento; + } + + public double getPercProvvigione() { + return this.percProvvigione; + } + + public void setPercProvvigione(double percProvvigione) { + this.percProvvigione = percProvvigione; + } + + public long getFlgNascondiWeb() { + return this.flgNascondiWeb; + } + + public void setFlgNascondiWeb(long flgVisibileWeb) { + this.flgNascondiWeb = flgVisibileWeb; + } + + public long getFlgTipologiaClifor() { + return this.flgTipologiaClifor; + } + + public void setFlgTipologiaClifor(long flgTipologiaClifor) { + this.flgTipologiaClifor = flgTipologiaClifor; + } + + public String getFileName() { + return (this.fileName == null) ? AB_EMPTY_STRING : this.fileName.trim(); + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getpIva() { + return this.pIva; + } + + public void setpIva(String pIva) { + this.pIva = pIva; + } + + public String geteMail() { + return this.eMail; + } + + public void seteMail(String eMail) { + this.eMail = eMail; + } + + public String getDescrizioneComune() { + return (this.descrizioneComune == null) ? AB_EMPTY_STRING : this.descrizioneComune; + } + + public void setDescrizioneComune(String descrizioneComune) { + this.descrizioneComune = descrizioneComune; + } + + public String getProvinciaComune() { + return (this.provinciaComune == null) ? AB_EMPTY_STRING : this.provinciaComune; + } + + public void setProvinciaComune(String provinciaComune) { + this.provinciaComune = provinciaComune; + } + + public Clifor getAgente() { + this.agente = (Clifor)getSecondaryObject(this.agente, Clifor.class, getId_agente()); + return this.agente; + } + + public long getId_agente() { + return this.id_agente; + } + + public long getId_respCommerciale() { + return this.id_respCommerciale; + } + + public Clifor getRespCommerciale() { + this.respCommerciale = (Clifor)getSecondaryObject(this.respCommerciale, Clifor.class, getId_respCommerciale()); + return this.respCommerciale; + } + + public void setAgente(Clifor agente) { + this.agente = agente; + } + + public void setId_agente(long id_agente) { + this.id_agente = id_agente; + } + + public void setId_respCommerciale(long id_respCommerciale) { + this.id_respCommerciale = id_respCommerciale; + } + + public void setRespCommerciale(Clifor respCommerciale) { + this.respCommerciale = respCommerciale; + } + + public long getId_tipoClifor() { + return this.id_tipoClifor; + } + + public void setId_tipoClifor(long id_tipoClifor) { + this.id_tipoClifor = id_tipoClifor; + } + + public long getFlgPA() { + return this.flgPA; + } + + public void setFlgPA(long flgPA) { + this.flgPA = flgPA; + } + + public long getFlgSplitPayment() { + return this.flgSplitPayment; + } + + public void setFlgSplitPayment(long flgSplitPayment) { + this.flgSplitPayment = flgSplitPayment; + } + + public long getFlgTaxFree() { + return this.flgTaxFree; + } + + public void setFlgTaxFree(long flgTaxFree) { + this.flgTaxFree = flgTaxFree; + } + + public long getId_usersResponsabile() { + return this.id_usersResponsabile; + } + + public Users getUsersResponsabile() { + this.usersResponsabile = (Users)getSecondaryObject((DBAdapter)this.usersResponsabile, Users.class, getId_usersResponsabile()); + return this.usersResponsabile; + } + + public void setId_usersResponsabile(long id_usersResponsabile) { + this.id_usersResponsabile = id_usersResponsabile; + setUsersResponsabile(null); + } + + public void setUsersResponsabile(Users usersResponsabile) { + this.usersResponsabile = usersResponsabile; + } + + public long getFlgStatoConfermaDati() { + return this.flgStatoConfermaDati; + } + + public void setFlgStatoConfermaDati(long flgStatoConfermaDati) { + this.flgStatoConfermaDati = flgStatoConfermaDati; + } + + public static final String getStatoConfermaDati(long l_flgStatoConfermaDati) { + return Clifor.getStatoConfermaDati(l_flgStatoConfermaDati); + } + + public final String getStatoConfermaDati() { + return getStatoConfermaDati(getFlgStatoConfermaDati()); + } + + public long getId_usersAttivita() { + return this.id_usersAttivita; + } + + public Users getUsersAttivita() { + this.usersAttivita = (Users)getSecondaryObject((DBAdapter)this.usersAttivita, Users.class, getId_usersAttivita()); + return this.usersAttivita; + } + + public void setId_usersAttivita(long id_usersAttivita) { + this.id_usersAttivita = id_usersAttivita; + setUsersAttivita(null); + } + + public void setUsersAttivita(Users usersAttivita) { + this.usersAttivita = usersAttivita; + } + + public long getFlgEscludi() { + return this.flgEscludi; + } + + public void setFlgEscludi(long flgEscludi) { + this.flgEscludi = flgEscludi; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforInterface.java new file mode 100644 index 00000000..6a303a8f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforInterface.java @@ -0,0 +1,267 @@ +package it.acxent.anag; + +import it.acxent.db.ResParm; +import it.acxent.util.Vectumerator; +import java.sql.Date; + +public interface CliforInterface { + void setId_clifor(long paramLong); + + void setId_tipoPagamento(long paramLong); + + void setCodiceAlt(String paramString); + + void setFlgValido(long paramLong); + + void setFlgTipo(String paramString); + + void setFlgAzienda(long paramLong); + + void setCognome(String paramString); + + void setContatto(String paramString); + + void setNome(String paramString); + + void setIndirizzo(String paramString); + + void setNumeroCivico(String paramString); + + void setId_comune(long paramLong); + + void setId_nazione(String paramString); + + void setDataNascita(Date paramDate); + + void setCodFisc(String paramString); + + void setPIva(String paramString); + + void setEMail(String paramString); + + void setFax(String paramString); + + void setTelefono(String paramString); + + void setNota(String paramString); + + void setImgTmst(String paramString); + + void setFlgPrivComunicazione(long paramLong); + + void setFlgPrivSensibili(long paramLong); + + void setFlgPrivTrattamento(long paramLong); + + void setFlgSesso(long paramLong); + + void setWww(String paramString); + + void setDataRegistrazioneDI(Date paramDate); + + void setDichiarazioneIntento(String paramString); + + void setFlgArt8(long paramLong); + + long getId_clifor(); + + long getId_tipoPagamento(); + + String getCodiceAlt(); + + long getFlgValido(); + + String getFlgTipo(); + + String getTipo(); + + long getFlgAzienda(); + + String getDescrizioneCompleta(); + + String getCognomeNome(); + + String getContatto(); + + String getNome(); + + String getIndirizzo(); + + String getIndirizzoCompleto(); + + String getIndirizzoCompletoHtml(); + + String getNumeroCivico(); + + long getId_comune(); + + String getId_nazione(); + + Date getDataNascita(); + + String getCodFisc(); + + String getPIva(); + + String getEMail(); + + String getFax(); + + String getTelefono(); + + String getNota(); + + String getImgTmst(); + + long getFlgPrivComunicazione(); + + long getFlgPrivSensibili(); + + long getFlgPrivTrattamento(); + + long getFlgSesso(); + + String getWww(); + + Date getDataRegistrazioneDI(); + + String getDichiarazioneIntento(); + + long getFlgArt8(); + + void setTipoPagamento(TipoPagamento paramTipoPagamento); + + TipoPagamento getTipoPagamento(); + + void setComune(Comune paramComune); + + Comune getComune(); + + void setNazione(Nazione paramNazione); + + Nazione getNazione(); + + void findByCF(String paramString1, String paramString2); + + void findByPIva(String paramString1, String paramString2); + + String getCodFiscCalc(); + + boolean isCodFiscDuplicated(); + + boolean isPIvaDuplicated(); + + boolean isPIvaCodfiscDuplicated(); + + boolean isCodFiscOk(); + + long getId_comuneNascita(); + + void setId_comuneNascita(long paramLong); + + Comune getComuneNascita(); + + void setComuneNascita(Comune paramComune); + + String getSesso(); + + Vectumerator findUsers(int paramInt1, int paramInt2); + + String getCognome(); + + String getIban(); + + void setIban(String paramString); + + String getAbi(); + + String getCab(); + + String getConto(); + + String getCapZona(); + + void setCapZona(String paramString); + + Vectumerator getDestinazioniDiverse(); + + ResParm addDestinazioneDiversa(DestinazioneDiversa paramDestinazioneDiversa); + + ResParm delDestinazioneDiversa(DestinazioneDiversa paramDestinazioneDiversa); + + String getCellulare(); + + void setCellulare(String paramString); + + String getBancaDesc(); + + void setBancaDesc(String paramString); + + String getBancaCompleto(); + + long getId_listino(); + + void setId_listino(long paramLong); + + Listino getListino(); + + void setListino(Listino paramListino); + + long getCloseCommand(); + + void setCloseCommand(long paramLong); + + Clifor getCliforDup(); + + void setId_cliforDup(long paramLong); + + long getId_cliforDup(); + + void setCliforDup(Clifor paramClifor); + + Vectumerator getContratti(); + + ResParm addContratto(Contratto paramContratto); + + ResParm delContratto(Contratto paramContratto); + + ResParm creaMailingListCR(CliforCR paramCliforCR); + + void resetMailingListFileCR(); + + boolean addToMailingListFileCR(); + + String getMailingMailCR(); + + long getFlgMl(); + + void setFlgMl(long paramLong); + + Vectumerator findByCR(CliforCR paramCliforCR, int paramInt1, int paramInt2); + + String getDescrizioneComune(); + + void setDescrizioneComune(String paramString); + + String getProvinciaComune(); + + void setProvinciaComune(String paramString); + + String getCapComune(); + + void setCapComune(String paramString); + + String getPathAllegato(); + + Vectumerator getAllegati(long paramLong); + + ResParm addAllegato(AllegatoClifor paramAllegatoClifor); + + ResParm delAllegato(AllegatoClifor paramAllegatoClifor); + + void creaCodaMessaggi(CliforCR paramCliforCR, long paramLong); + + long getFlgRC(); + + void setFlgRC(long paramLong); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforLog.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforLog.java new file mode 100644 index 00000000..3ad02cc1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforLog.java @@ -0,0 +1,154 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class CliforLog extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1698338319657L; + + private long id_cliforLog; + + private long id_clifor; + + private long id_users; + + private Date dataCliforlog; + + private String descrizioneCliforlog; + + private Clifor clifor; + + private Users users; + + public CliforLog(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CliforLog() {} + + public void setId_cliforLog(long newId_cliforLog) { + this.id_cliforLog = newId_cliforLog; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_users(long newId_users) { + this.id_users = newId_users; + setUsers(null); + } + + public void setDataCliforlog(Date newDataCliforlog) { + this.dataCliforlog = newDataCliforlog; + } + + public void setDescrizioneCliforlog(String newDescrizioneCliforlog) { + this.descrizioneCliforlog = newDescrizioneCliforlog; + } + + public long getId_cliforLog() { + return this.id_cliforLog; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_users() { + return this.id_users; + } + + public Date getDataCliforlog() { + return this.dataCliforlog; + } + + public String getDescrizioneCliforlog() { + return (this.descrizioneCliforlog == null) ? "" : this.descrizioneCliforlog.trim(); + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setUsers(Users newUsers) { + this.users = newUsers; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users()); + return this.users; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(CliforLogCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CLIFOR_LOG AS A"; + String s_Sql_Order = " order by A.lastUpdTmst desc"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByClifor(long l_id_clifor, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CLIFOR_LOG AS A"; + String s_Sql_Order = " order by A.lastUpdTmst desc"; + WcString wc = new WcString(); + wc.addWc("A.id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm save() { + if (getDBState() == 0) + setDataCliforlog(getToday()); + return super.save(); + } + + public ResParm save(long l_flgStatoConfermaDatiDb) { + setDescrizioneCliforlog(Clifor.getStatoConfermaDati(l_flgStatoConfermaDatiDb) + "-->" + Clifor.getStatoConfermaDati(l_flgStatoConfermaDatiDb) + ": " + getClifor().getStatoConfermaDati()); + return save(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforLogCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforLogCR.java new file mode 100644 index 00000000..8fd7b646 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforLogCR.java @@ -0,0 +1,103 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import java.sql.Date; +import java.sql.Timestamp; + +public class CliforLogCR extends CRAdapter { + private long id_cliforLog; + + private long id_clifor; + + private long id_users; + + private Timestamp tsCliforlog; + + private Date dataCliforlog; + + private String descrizioneCliforlog; + + private Clifor clifor; + + private Users users; + + public CliforLogCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CliforLogCR() {} + + public void setId_cliforLog(long newId_cliforLog) { + this.id_cliforLog = newId_cliforLog; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_users(long newId_users) { + this.id_users = newId_users; + setUsers(null); + } + + public void setTsCliforlog(Timestamp newTsCliforlog) { + this.tsCliforlog = newTsCliforlog; + } + + public void setDataCliforlog(Date newDataCliforlog) { + this.dataCliforlog = newDataCliforlog; + } + + public void setDescrizioneCliforlog(String newDescrizioneCliforlog) { + this.descrizioneCliforlog = newDescrizioneCliforlog; + } + + public long getId_cliforLog() { + return this.id_cliforLog; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_users() { + return this.id_users; + } + + public Timestamp getTsCliforlog() { + return this.tsCliforlog; + } + + public Date getDataCliforlog() { + return this.dataCliforlog; + } + + public String getDescrizioneCliforlog() { + return (this.descrizioneCliforlog == null) ? "" : this.descrizioneCliforlog.trim(); + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, + + getId_clifor()); + return this.clifor; + } + + public void setUsers(Users newUsers) { + this.users = newUsers; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, + + getId_users()); + return this.users; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforTipoClifor.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforTipoClifor.java new file mode 100644 index 00000000..1780d2fd --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforTipoClifor.java @@ -0,0 +1,209 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class CliforTipoClifor extends _AnagAdapter implements Serializable { + private static final long serialVersionUID = -2647000200627619105L; + + private long id_cliforTipoClifor; + + private long id_clifor; + + private long id_tipoClifor; + + private Clifor clifor; + + private TipoClifor tipoClifor; + + private double percProvvigione; + + public CliforTipoClifor(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public boolean isTipologiaCliforByClifor(long l_id_clifor, long l_id_tipoClifor) { + String s_Sql_Find = "select A.* from CLIFOR_TIPO_CLIFOR AS A "; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.id_clifor=" + l_id_clifor); + if (l_id_tipoClifor != 0L) + wc.addWc("A.id_tipoClifor=" + l_id_tipoClifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt, 1, 1); + if (vec.getTotNumberOfRecords() > 0) + return true; + return false; + } catch (SQLException e) { + handleDebug(e); + return false; + } + } + + public CliforTipoClifor() {} + + public void setId_tipoClifor(long newId_tipoClifor) { + this.id_tipoClifor = newId_tipoClifor; + } + + public long getId_tipoClifor() { + return this.id_tipoClifor; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(CliforTipoCliforCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CLIFOR_TIPO_CLIFOR AS A INNER JOIN TIPO_CLIFOR AS B ON A.id_tipoClifor = B.id_tipoClifor "; + String s_Sql_Order = " "; + WcString wc = new WcString(); + if (CR.getId_clifor() != 0L) + wc.addWc("A.id_clifor=" + CR.getId_clifor()); + if (!CR.getFlgTipoClifor().isEmpty()) + wc.addWc("B.flgTipo='" + CR.getFlgTipoClifor() + "' "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_cliforTipoClifor() { + return this.id_cliforTipoClifor; + } + + public void setId_cliforTipoClifor(long id_cliforTipoClifor) { + this.id_cliforTipoClifor = id_cliforTipoClifor; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setClifor(Clifor clifor) { + this.clifor = clifor; + } + + public TipoClifor getTipoClifor() { + this.tipoClifor = (TipoClifor)getSecondaryObject(this.tipoClifor, TipoClifor.class, getId_tipoClifor()); + return this.tipoClifor; + } + + public void setTipoClifor(TipoClifor tipoClifor) { + this.tipoClifor = tipoClifor; + } + + public boolean isRespondabileCommercialeByClifor(long l_id_clifor) { + String s_Sql_Find = "select A.* from CLIFOR_TIPO_CLIFOR AS A, TIPO_CLIFOR AS B"; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.id_tipoClifor=B.id_tipoClifor"); + wc.addWc("A.id_clifor=" + l_id_clifor); + wc.addWc("( B.flgTipologia=3)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt, 1, 1); + if (vec.getTotNumberOfRecords() > 0) + return true; + return false; + } catch (SQLException e) { + return false; + } + } + + public double getPercProvvigione() { + return this.percProvvigione; + } + + public void setPercProvvigione(double percProvvigione) { + this.percProvvigione = percProvvigione; + } + + public void findByCliforTipologia(long l_id_clifor, long l_flgTipologiaClifor) { + String s_Sql_Find = "select A.* from CLIFOR_TIPO_CLIFOR AS A, TIPO_CLIFOR AS B"; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.id_tipoClifor=B.id_tipoClifor"); + wc.addWc("A.id_clifor=" + l_id_clifor); + if (l_flgTipologiaClifor == 0L) { + wc.addWc("(B.flgTipologia is null or B.flgTipologia=0)"); + } else if (l_flgTipologiaClifor > 0L) { + wc.addWc("B.flgTipologia=" + l_flgTipologiaClifor); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public boolean isAgenteByClifor(long l_id_clifor) { + String s_Sql_Find = "select A.* from CLIFOR_TIPO_CLIFOR AS A, TIPO_CLIFOR AS B"; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.id_tipoClifor=B.id_tipoClifor"); + wc.addWc("A.id_clifor=" + l_id_clifor); + wc.addWc("(B.flgTipologia=1)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt, 1, 1); + if (vec.getTotNumberOfRecords() > 0) + return true; + return false; + } catch (SQLException e) { + return false; + } + } + + public boolean isProgettistaByClifor(long l_id_clifor) { + String s_Sql_Find = "select A.* from CLIFOR_TIPO_CLIFOR AS A, TIPO_CLIFOR AS B"; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.id_tipoClifor=B.id_tipoClifor"); + wc.addWc("A.id_clifor=" + l_id_clifor); + wc.addWc("(B.flgTipologia=2)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt, 1, 1); + if (vec.getTotNumberOfRecords() > 0) + return true; + return false; + } catch (SQLException e) { + return false; + } + } + + public boolean isAgenteORespondabileCommercialeByClifor(long l_id_clifor) { + String s_Sql_Find = "select A.* from CLIFOR_TIPO_CLIFOR AS A, TIPO_CLIFOR AS B"; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.id_tipoClifor=B.id_tipoClifor"); + wc.addWc("A.id_clifor=" + l_id_clifor); + wc.addWc("(B.flgTipologia=1 or B.flgTipologia=3)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt, 1, 1); + if (vec.getTotNumberOfRecords() > 0) + return true; + return false; + } catch (SQLException e) { + return false; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforTipoCliforCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforTipoCliforCR.java new file mode 100644 index 00000000..49d951d5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforTipoCliforCR.java @@ -0,0 +1,77 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.io.Serializable; + +public class CliforTipoCliforCR extends CRAdapter implements Serializable { + private long id_cliforTipoClifor; + + private long id_clifor; + + private long id_tipoClifor; + + private Clifor clifor; + + private TipoClifor tipoClifor; + + private String flgTipoClifor; + + public CliforTipoCliforCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CliforTipoCliforCR() {} + + public void setId_tipoClifor(long newId_causaleMagazzino) { + this.id_tipoClifor = newId_causaleMagazzino; + } + + public long getId_tipoClifor() { + return this.id_tipoClifor; + } + + public long getId_cliforTipoClifor() { + return this.id_cliforTipoClifor; + } + + public void setId_cliforTipoClifor(long id_cliforTipoClifor) { + this.id_cliforTipoClifor = id_cliforTipoClifor; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, + getId_clifor()); + return this.clifor; + } + + public void setClifor(Clifor clifor) { + this.clifor = clifor; + } + + public TipoClifor getTipoClifor() { + this.tipoClifor = (TipoClifor)getSecondaryObject(this.tipoClifor, TipoClifor.class, + getId_tipoClifor()); + return this.tipoClifor; + } + + public void setTipoClifor(TipoClifor tipoClifor) { + this.tipoClifor = tipoClifor; + } + + public String getFlgTipoClifor() { + return this.flgTipoClifor; + } + + public void setFlgTipoClifor(String flgTipoClifor) { + this.flgTipoClifor = flgTipoClifor; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforTipoPagamento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforTipoPagamento.java new file mode 100644 index 00000000..1db6ca7e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforTipoPagamento.java @@ -0,0 +1,130 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class CliforTipoPagamento extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1647264568430L; + + private long id_cliforTipoPagamento; + + private long id_clifor; + + private long id_tipoPagamento; + + private Clifor clifor; + + private TipoPagamento tipoPagamento; + + public CliforTipoPagamento(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CliforTipoPagamento() {} + + public void setId_cliforTipoPagamento(long newId_cliforTipoPagamento) { + this.id_cliforTipoPagamento = newId_cliforTipoPagamento; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_tipoPagamento(long newId_tipoPagamento) { + this.id_tipoPagamento = newId_tipoPagamento; + setTipoPagamento(null); + } + + public long getId_cliforTipoPagamento() { + return this.id_cliforTipoPagamento; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_tipoPagamento() { + return this.id_tipoPagamento; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, + + getId_clifor()); + return this.clifor; + } + + public void setTipoPagamento(TipoPagamento newTipoPagamento) { + this.tipoPagamento = newTipoPagamento; + } + + public TipoPagamento getTipoPagamento() { + this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, + + getId_tipoPagamento()); + return this.tipoPagamento; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(CliforTipoPagamentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CLIFOR_TIPO_PAGAMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByClifor(long l_id_clifor) { + String s_Sql_Find = "select A.* from CLIFOR_TIPO_PAGAMENTO AS A inner join TIPO_PAGAMENTO AS B on A.id_tipoPagamento=B.id_tipoPagamento"; + String s_Sql_Order = " order by descrizione_it"; + WcString wc = new WcString(); + wc.addWc("A.id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm save() { + return super.save(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforTipoPagamentoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforTipoPagamentoCR.java new file mode 100644 index 00000000..42e3c72b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/CliforTipoPagamentoCR.java @@ -0,0 +1,70 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class CliforTipoPagamentoCR extends CRAdapter { + private long id_cliforTipoPagamento; + + private long id_clifor; + + private long id_tipoPagamento; + + private Clifor clifor; + + private TipoPagamento tipoPagamento; + + public CliforTipoPagamentoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CliforTipoPagamentoCR() {} + + public void setId_cliforTipoPagamento(long newId_cliforTipoPagamento) { + this.id_cliforTipoPagamento = newId_cliforTipoPagamento; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_tipoPagamento(long newId_tipoPagamento) { + this.id_tipoPagamento = newId_tipoPagamento; + setTipoPagamento(null); + } + + public long getId_cliforTipoPagamento() { + return this.id_cliforTipoPagamento; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_tipoPagamento() { + return this.id_tipoPagamento; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, + + getId_clifor()); + return this.clifor; + } + + public void setTipoPagamento(TipoPagamento newTipoPagamento) { + this.tipoPagamento = newTipoPagamento; + } + + public TipoPagamento getTipoPagamento() { + this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, + + getId_tipoPagamento()); + return this.tipoPagamento; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Comune.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Comune.java new file mode 100644 index 00000000..fe4634a1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Comune.java @@ -0,0 +1,267 @@ +package it.acxent.anag; + +import com.google.gson.Gson; +import it.acxent.anag.json.JsonComune; +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.Vector; + +public class Comune extends _AnagAdapter implements Serializable { + private static final long serialVersionUID = -8455737960994074428L; + + private long id_comune; + + private String id_regione; + + private String codice; + + private String descrizione; + + private String provincia; + + private String cap; + + private String codiceComune; + + private String codiceZona; + + private Regione regione; + + private long id_zona; + + private Zona zona; + + private String codiceTarga; + + public Comune(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Comune() {} + + public void setId_comune(long newId_comune) { + this.id_comune = newId_comune; + } + + public void setId_regione(String newId_regione) { + this.id_regione = newId_regione; + setRegione(null); + } + + public void setCodice(String newCodice) { + this.codice = newCodice; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setProvincia(String newProvincia) { + this.provincia = newProvincia; + } + + public void setCap(String newCap) { + this.cap = newCap; + } + + public void setCodiceComune(String newCodiceComune) { + this.codiceComune = newCodiceComune; + } + + public void setCodiceZona(String newCodiceZona) { + this.codiceZona = newCodiceZona; + } + + public long getId_comune() { + return this.id_comune; + } + + public String getId_regione() { + return (this.id_regione == null) ? "" : this.id_regione.trim(); + } + + public String getCodice() { + return (this.codice == null) ? "" : this.codice.trim(); + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getProvincia() { + return (this.provincia == null) ? "" : this.provincia.trim(); + } + + public String getCap() { + return (this.cap == null) ? "" : this.cap.trim(); + } + + public String getCodiceComune() { + return (this.codiceComune == null) ? "" : this.codiceComune.trim(); + } + + public String getCodiceZona() { + return (this.codiceZona == null) ? "" : this.codiceZona.trim(); + } + + public void setRegione(Regione newRegione) { + this.regione = newRegione; + } + + public Regione getRegione() { + this.regione = (Regione)getSecondaryObject(this.regione, Regione.class, getId_regione()); + return this.regione; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ComuneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from COMUNE AS A"; + String s_Sql_Order = " order by A.descrizione"; + if (CR.getFlgOrderBy() == 1L) + s_Sql_Order = " order by A.lastUpdTmst"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) + wc.addWc("(A.descrizione like '%" + prepareSqlString(CR.getSearchTxt()) + "%' or A.codice like '%" + + prepareSqlString(CR.getSearchTxt()) + "%')"); + if (!CR.getDescrizioneS().trim().isEmpty()) + wc.addWc("(A.descrizione like '%" + CR.getDescrizioneS() + "%' or A.codice like '%" + CR.getDescrizioneS() + "%')"); + if (!CR.getId_regioneS().isEmpty()) + wc.addWc("A.id_regione='" + CR.getId_regioneS() + "'"); + if (CR.getLastUpdTmst() != null) + wc.addWc("A.lastUpdTmst>?"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + if (CR.getLastUpdTmst() != null) + stmt.setTimestamp(1, CR.getLastUpdTmst()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizioneCompleta() { + return getCodice() + " " + getCodice(); + } + + public Vectumerator findByProv(String l_provincia) { + String s_Sql_Find = "select A.descrizione from COMUNE AS A"; + String s_Sql_Order = " order by A.provincia"; + WcString wc = new WcString(); + wc.addWc("A.provincia='" + l_provincia + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByProvCom(String l_provincia, String l_comuneDesc) { + String s_Sql_Find = "select A.* from COMUNE AS A"; + String s_Sql_Order = " order by A.provincia"; + WcString wc = new WcString(); + wc.addWc("A.provincia='" + l_provincia + "'"); + wc.addWc("A.descrizione='" + l_comuneDesc + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByCap(String l_cap) { + String s_Sql_Find = "select A.* from COMUNE AS A"; + String s_Sql_Order = " order by A.provincia"; + WcString wc = new WcString(); + wc.addWc("A.cap='" + l_cap + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByCodice(String l_codice) { + String s_Sql_Find = "select A.* from COMUNE AS A"; + String s_Sql_Order = " order by A.provincia"; + WcString wc = new WcString(); + wc.addWc("A.codice='" + l_codice + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findProvince() { + String s_Sql_Find = "select A.provincia from COMUNE AS A"; + String s_Sql_Order = " order by A.provincia"; + WcString wc = new WcString(); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_zona() { + return this.id_zona; + } + + public void setId_zona(long id_zona) { + this.id_zona = id_zona; + setZona(null); + } + + public Zona getZona() { + return this.zona; + } + + public void setZona(Zona zona) { + this.zona = zona; + } + + public String getJson(long l_tmst, int nPage) { + int pageRow = 40; + Comune bean = new Comune(getApFull()); + ComuneCR CR = new ComuneCR(getApFull()); + Vector vecJ = new Vector<>(); + if (l_tmst > 0L) + CR.setLastUpdTmst(new Timestamp(l_tmst)); + CR.setFlgOrderBy(1L); + Vectumerator vec = bean.findByCR(CR, nPage, pageRow); + while (vec.hasMoreElements()) { + Comune row = (Comune)vec.nextElement(); + JsonComune jrow = new JsonComune(); + jrow.setId_comune(row.getId_comune()); + jrow.setDescrizione(row.getDescrizione()); + jrow.setLastUpdTmst(row.getLastUpdTmst().getTime()); + vecJ.add(jrow); + } + Gson gson = new Gson(); + String res = gson.toJson(vecJ); + return res; + } + + public String getCodiceTarga() { + return (this.codiceTarga == null) ? "" : this.codiceTarga.trim(); + } + + public void setCodiceTarga(String codiceTarga) { + this.codiceTarga = codiceTarga; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ComuneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ComuneCR.java new file mode 100644 index 00000000..82a0cf45 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ComuneCR.java @@ -0,0 +1,127 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Timestamp; + +public class ComuneCR extends CRAdapter { + private long id_comune; + + private String id_regioneS; + + private String codice; + + private String descrizioneS; + + private String provincia; + + private String cap; + + private String codiceComune; + + private String codiceZona; + + private long lastUpdId_user; + + private Timestamp lastUpdTmst; + + private Regione regione; + + public ComuneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ComuneCR() {} + + public void setId_comune(long newId_comune) { + this.id_comune = newId_comune; + } + + public void setId_regioneS(String newId_regione) { + this.id_regioneS = newId_regione; + setRegione(null); + } + + public void setCodice(String newCodice) { + this.codice = newCodice; + } + + public void setDescrizioneS(String newDescrizione) { + this.descrizioneS = newDescrizione; + } + + public void setProvincia(String newProvincia) { + this.provincia = newProvincia; + } + + public void setCap(String newCap) { + this.cap = newCap; + } + + public void setCodiceComune(String newCodiceComune) { + this.codiceComune = newCodiceComune; + } + + public void setCodiceZona(String newCodiceZona) { + this.codiceZona = newCodiceZona; + } + + public void setLastUpdId_user(long newLastUpdId_user) { + this.lastUpdId_user = newLastUpdId_user; + } + + public void setLastUpdTmst(Timestamp newLastUpdTmst) { + this.lastUpdTmst = newLastUpdTmst; + } + + public long getId_comune() { + return this.id_comune; + } + + public String getId_regioneS() { + return (this.id_regioneS == null) ? "" : this.id_regioneS.trim(); + } + + public String getCodice() { + return (this.codice == null) ? "" : this.codice.trim(); + } + + public String getDescrizioneS() { + return (this.descrizioneS == null) ? "" : this.descrizioneS.trim(); + } + + public String getProvincia() { + return (this.provincia == null) ? "" : this.provincia.trim(); + } + + public String getCap() { + return (this.cap == null) ? "" : this.cap.trim(); + } + + public String getCodiceComune() { + return (this.codiceComune == null) ? "" : this.codiceComune.trim(); + } + + public String getCodiceZona() { + return (this.codiceZona == null) ? "" : this.codiceZona.trim(); + } + + public long getLastUpdId_user() { + return this.lastUpdId_user; + } + + public Timestamp getLastUpdTmst() { + return this.lastUpdTmst; + } + + public void setRegione(Regione newRegione) { + this.regione = newRegione; + } + + public Regione getRegione() { + this.regione = (Regione)getSecondaryObject(this.regione, Regione.class, + + getId_regioneS()); + return this.regione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Contatore.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Contatore.java new file mode 100644 index 00000000..720d3f12 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Contatore.java @@ -0,0 +1,136 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Contatore extends _AnagAdapter implements Serializable { + public static final int TIPO_ANNUALE = 1; + + private long id_contatore; + + private String descrizione; + + private long flgTipo; + + private long flgControllo; + + private long annoIniziale; + + private long progIniziale; + + public static final int TIPO_MAGAZZINO = 3; + + public static final int TIPO_CONTABILE = 2; + + public Contatore(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Contatore() {} + + public void setId_contatore(long newId_contatore) { + this.id_contatore = newId_contatore; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setFlgTipo(long newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public void setFlgControllo(long newFlgControllo) { + this.flgControllo = newFlgControllo; + } + + public long getId_contatore() { + return this.id_contatore; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : + this.descrizione.trim(); + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public long getFlgControllo() { + return this.flgControllo; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ContatoreCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CONTATORE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public static String getTipo(long l_flgTipo) { + switch ((int)l_flgTipo) { + case 1: + return "Annuale"; + case 2: + return "Contabile"; + case 3: + return "Magazzino"; + } + return "????"; + } + + public String getTipo() { + return getTipo(getFlgTipo()); + } + + public String getControllo() { + return (getFlgControllo() == 0L) ? "No" : "Si"; + } + + public long getAnnoIniziale() { + if (getFlgControllo() == 0L) + return 0L; + return this.annoIniziale; + } + + public void setAnnoIniziale(long annoIniziale) { + this.annoIniziale = annoIniziale; + } + + public long getProgIniziale() { + if (getFlgControllo() == 0L) + return 0L; + return this.progIniziale; + } + + public void setProgIniziale(long progIniziale) { + this.progIniziale = progIniziale; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ContatoreCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ContatoreCR.java new file mode 100644 index 00000000..cd2cad91 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ContatoreCR.java @@ -0,0 +1,73 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Timestamp; + +public class ContatoreCR extends CRAdapter { + private long id_contatore; + + private String descrizione; + + private long flgTipo; + + private long flgControllo; + + private Timestamp lastUpdTmst; + + private long lastUpdId_user; + + public ContatoreCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ContatoreCR() {} + + public void setId_contatore(long newId_contatore) { + this.id_contatore = newId_contatore; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setFlgTipo(long newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public void setFlgControllo(long newFlgControllo) { + this.flgControllo = newFlgControllo; + } + + public void setLastUpdTmst(Timestamp newLastUpdTmst) { + this.lastUpdTmst = newLastUpdTmst; + } + + public void setLastUpdId_user(long newLastUpdId_user) { + this.lastUpdId_user = newLastUpdId_user; + } + + public long getId_contatore() { + return this.id_contatore; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public long getFlgControllo() { + return this.flgControllo; + } + + public Timestamp getLastUpdTmst() { + return this.lastUpdTmst; + } + + public long getLastUpdId_user() { + return this.lastUpdId_user; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Contatto.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Contatto.java new file mode 100644 index 00000000..93e6af31 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Contatto.java @@ -0,0 +1,155 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Contatto extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1489591448348L; + + private long id_contatto; + + private String descrizioneC; + + private String nomeC; + + private String telefonoC; + + private String emailC; + + private long id_clifor; + + private Clifor clifor; + + private long flgContattoDefault; + + public Contatto(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Contatto() {} + + public void setId_contatto(long newId_contatto) { + this.id_contatto = newId_contatto; + } + + public void setDescrizioneC(String newDescrizione) { + this.descrizioneC = newDescrizione; + } + + public void setNomeC(String newNome) { + this.nomeC = newNome; + } + + public void setTelefonoC(String newTelefono) { + this.telefonoC = newTelefono; + } + + public void setEmailC(String newEmail) { + this.emailC = newEmail; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public long getId_contatto() { + return this.id_contatto; + } + + public String getDescrizioneC() { + return (this.descrizioneC == null) ? "" : this.descrizioneC.trim(); + } + + public String getNomeC() { + return (this.nomeC == null) ? "" : this.nomeC.trim(); + } + + public String getTelefonoC() { + return (this.telefonoC == null) ? "" : this.telefonoC.trim(); + } + + public String getEmailC() { + return (this.emailC == null) ? "" : this.emailC.trim(); + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ContattoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CONTATTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgContattoDefault() { + return this.flgContattoDefault; + } + + public void setFlgContattoDefault(long flgContattoDefault) { + this.flgContattoDefault = flgContattoDefault; + } + + public Vectumerator findByClifor(long l_id_clifor) { + String s_Sql_Find = "select A.* from CONTATTO AS A"; + String s_Sql_Order = " order by A.descrizioneC\t"; + WcString wc = new WcString(); + wc.addWc("A.id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm save() { + if (getFlgContattoDefault() == 1L) + update("update CONTATTO SET flgContattoDefault=0 where id_clifor=" + getId_clifor()); + return super.save(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ContattoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ContattoCR.java new file mode 100644 index 00000000..7a0b7bba --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ContattoCR.java @@ -0,0 +1,96 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ContattoCR extends CRAdapter { + private long id_contatto; + + private String descrizioneC; + + private String nomeC; + + private String telefonoC; + + private String emailC; + + private long id_clifor; + + private Clifor clifor; + + private long flgContattoDefault; + + public ContattoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ContattoCR() {} + + public void setId_contatto(long newId_contatto) { + this.id_contatto = newId_contatto; + } + + public void setDescrizioneC(String newDescrizione) { + this.descrizioneC = newDescrizione; + } + + public void setNomeC(String newNome) { + this.nomeC = newNome; + } + + public void setTelefonoC(String newTelefono) { + this.telefonoC = newTelefono; + } + + public void setEmailC(String newEmail) { + this.emailC = newEmail; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public long getId_contatto() { + return this.id_contatto; + } + + public String getDescrizioneC() { + return (this.descrizioneC == null) ? "" : this.descrizioneC.trim(); + } + + public String getNomeC() { + return (this.nomeC == null) ? "" : this.nomeC.trim(); + } + + public String getTelefonoC() { + return (this.telefonoC == null) ? "" : this.telefonoC.trim(); + } + + public String getEmailC() { + return (this.emailC == null) ? "" : this.emailC.trim(); + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, + + getId_clifor()); + return this.clifor; + } + + public long getFlgContattoDefault() { + return this.flgContattoDefault; + } + + public void setFlgContattoDefault(long flgContattoDefault) { + this.flgContattoDefault = flgContattoDefault; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Contratto.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Contratto.java new file mode 100644 index 00000000..8ba59817 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Contratto.java @@ -0,0 +1,274 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.mail.MailMessage; +import it.acxent.newsletter.CodaMessaggi; +import it.acxent.newsletter.TemplateMsg; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.Calendar; + +public class Contratto extends _AnagAdapter implements Serializable { + private long id_contratto; + + private long id_tipoContratto; + + private long id_clifor; + + private String telefoniAssociati; + + private Date dataInizioContratto; + + private Date dataInvioAvvisoSms; + + private long flgStato; + + private TipoContratto tipoContratto; + + private Clifor clifor; + + private String descrizione; + + private String logContratto; + + private String notaContratto; + + private Date dataScadenzaContratto; + + public static final long ST_ATTIVO = 1L; + + public static final long ST_NON_ATTIVO = 0L; + + public Contratto(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Contratto() {} + + public void setId_contratto(long newId_contratto) { + this.id_contratto = newId_contratto; + } + + public void setId_tipoContratto(long newId_tipoContratto) { + this.id_tipoContratto = newId_tipoContratto; + setTipoContratto(null); + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setDataInizioContratto(Date newDataInizioContratto) { + this.dataInizioContratto = newDataInizioContratto; + } + + public void setDataScadenzaContratto(Date newDataScadenzaContratto) { + this.dataScadenzaContratto = newDataScadenzaContratto; + } + + public void setFlgStato(long newFlgStato) { + this.flgStato = newFlgStato; + } + + public long getId_contratto() { + return this.id_contratto; + } + + public long getId_tipoContratto() { + return this.id_tipoContratto; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : + this.descrizione.trim(); + } + + public Date getDataInizioContratto() { + return this.dataInizioContratto; + } + + public Date getDataScadenzaContratto() { + return this.dataScadenzaContratto; + } + + public long getFlgStato() { + return this.flgStato; + } + + public void setTipoContratto(TipoContratto newTipoContratto) { + this.tipoContratto = newTipoContratto; + } + + public TipoContratto getTipoContratto() { + this.tipoContratto = (TipoContratto)getSecondaryObject(this.tipoContratto, TipoContratto.class, + getId_tipoContratto()); + return this.tipoContratto; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public ResParm creaCodaMessaggiSms(ContrattoCR CR) { + ResParm rp = new ResParm(); + Vectumerator vec = findByCR(CR, 0, 0); + int numMsg = 0; + while (vec.hasMoreElements()) { + TemplateMsg tm = new TemplateMsg(getApFull()); + tm.findByPrimaryKey(CR.getId_templateMsg()); + Contratto row = (Contratto)vec.nextElement(); + rp = row.creaCodaMessaggio(); + if (rp.getStatus()) + numMsg++; + } + rp.setMsg("Numero messaggi in coda: " + numMsg); + return rp; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ContrattoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CONTRATTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getTelefoniAssociati() { + return (this.telefoniAssociati == null) ? "" : + this.telefoniAssociati.trim(); + } + + public void setTelefoniAssociati(String telefoniAssociati) { + this.telefoniAssociati = telefoniAssociati; + } + + public Vectumerator findByClifor(long l_id_clifor, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CONTRATTO AS A"; + String s_Sql_Order = " order by A.flgStato desc, A.dataScadenzaContratto desc"; + WcString wc = new WcString(); + wc.addWc("A.id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public static final String getStato(long l_flgStato) { + if (l_flgStato == 1L) + return "Attivo"; + if (l_flgStato == 0L) + return "Non Attivo"; + return "??"; + } + + public String getStato() { + return getStato(getFlgStato()); + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, + getId_clifor()); + return this.clifor; + } + + public String getLogContratto() { + return (this.logContratto == null) ? "" : this.logContratto; + } + + public void setLogContratto(String logContratto) { + this.logContratto = logContratto; + } + + public String getNotaContratto() { + return (this.notaContratto == null) ? "" : this.notaContratto; + } + + public void setNotaContratto(String notaContratto) { + this.notaContratto = notaContratto; + } + + public ResParm save() { + if (getDataScadenzaContratto() == null) { + Calendar cal = Calendar.getInstance(); + cal.setTime(getDataInizioContratto()); + int durata = (int)getTipoContratto().getDurataMesi(); + if (getTipoContratto().getFlgPrepagato() == 1L) { + cal.add(6, durata * 30); + } else { + cal.add(2, durata); + cal.add(6, -1); + } + setDataScadenzaContratto(new Date(cal.getTimeInMillis())); + } + return super.save(); + } + + public Date getDataInvioAvvisoSms() { + return this.dataInvioAvvisoSms; + } + + public void setDataInvioAvvisoSms(Date dataInvioAvvisoSms) { + this.dataInvioAvvisoSms = dataInvioAvvisoSms; + } + + public ResParm creaCodaMessaggio() { + ResParm rp = new ResParm(); + if (getId_contratto() > 0L) { + MailMessage mm = new MailMessage(getApFull()); + mm.setTextMessage(getTipoContratto().getMessaggioSms()); + mm.setString("cliente", getClifor().getDescrizioneCompleta()); + mm.setString("contratto", getTipoContratto().getDescrizione()); + mm.setDate("dataScadenza", getDataScadenzaContratto()); + CodaMessaggi cm = new CodaMessaggi(getApFull()); + cm.setDataCreazione(getToday()); + cm.setCellulare(getTelefoniAssociati()); + cm.setTestoMessaggio(mm.getMessage()); + cm.setFlgTipo(2L); + cm.setFlgStatoInvio(0L); + rp = cm.save(); + setDataInvioAvvisoSms(getToday()); + rp.append(save()); + } + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ContrattoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ContrattoCR.java new file mode 100644 index 00000000..664836e7 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ContrattoCR.java @@ -0,0 +1,169 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; +import java.sql.Timestamp; + +public class ContrattoCR extends CRAdapter { + private long id_contratto; + + private long id_tipoContratto; + + private long id_clifor; + + private String descrizione; + + private Date dataInizioContratto; + + private Date dataScadenzaContratto; + + private long flgStato; + + private long lastUpdId_user; + + private Timestamp lastUpdTmst; + + private TipoContratto tipoContratto; + + private Clifor clifor; + + private Date dataScadenzaContrattoDa; + + private Date dataScadenzaContrattoA; + + private long id_templateMsg; + + public ContrattoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ContrattoCR() {} + + public void setId_contratto(long newId_contratto) { + this.id_contratto = newId_contratto; + } + + public void setId_tipoContratto(long newId_tipoContratto) { + this.id_tipoContratto = newId_tipoContratto; + setTipoContratto(null); + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setDataInizioContratto(Date newDataInizioContratto) { + this.dataInizioContratto = newDataInizioContratto; + } + + public void setDataScadenzaContratto(Date newDataScadenzaContratto) { + this.dataScadenzaContratto = newDataScadenzaContratto; + } + + public void setFlgStato(long newFlgStato) { + this.flgStato = newFlgStato; + } + + public void setLastUpdId_user(long newLastUpdId_user) { + this.lastUpdId_user = newLastUpdId_user; + } + + public void setLastUpdTmst(Timestamp newLastUpdTmst) { + this.lastUpdTmst = newLastUpdTmst; + } + + public long getId_contratto() { + return this.id_contratto; + } + + public long getId_tipoContratto() { + return this.id_tipoContratto; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : + this.descrizione.trim(); + } + + public Date getDataInizioContratto() { + return this.dataInizioContratto; + } + + public Date getDataScadenzaContratto() { + return this.dataScadenzaContratto; + } + + public long getFlgStato() { + return this.flgStato; + } + + public long getLastUpdId_user() { + return this.lastUpdId_user; + } + + public Timestamp getLastUpdTmst() { + return this.lastUpdTmst; + } + + public void setTipoContratto(TipoContratto newTipoContratto) { + this.tipoContratto = newTipoContratto; + } + + public TipoContratto getTipoContratto() { + this.tipoContratto = (TipoContratto)getSecondaryObject(this.tipoContratto, TipoContratto.class, + getId_tipoContratto()); + return this.tipoContratto; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, + getId_clifor()); + return this.clifor; + } + + public Date getDataScadenzaContrattoDa() { + return this.dataScadenzaContrattoDa; + } + + public void setDataScadenzaContrattoDa(Date dataScadenzaContrattoDa) { + this.dataScadenzaContrattoDa = dataScadenzaContrattoDa; + } + + public Date getDataScadenzaContrattoA() { + return this.dataScadenzaContrattoA; + } + + public void setDataScadenzaContrattoA(Date dataScadenzaContrattoA) { + this.dataScadenzaContrattoA = dataScadenzaContrattoA; + } + + public static final String getStato(long l_flgStato) { + return Contratto.getStato(l_flgStato); + } + + public String getStato() { + return Contratto.getStato(getFlgStato()); + } + + public long getId_templateMsg() { + return this.id_templateMsg; + } + + public void setId_templateMsg(long id_templateMsg) { + this.id_templateMsg = id_templateMsg; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/DestinazioneDiversa.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/DestinazioneDiversa.java new file mode 100644 index 00000000..6e0e1fc9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/DestinazioneDiversa.java @@ -0,0 +1,296 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class DestinazioneDiversa extends _AnagAdapter implements Serializable { + private static final long serialVersionUID = 2321576096013980457L; + + private long id_destinazioneDiversa; + + private long id_clifor; + + private long id_comuneDD; + + private String id_nazioneDD; + + private String descrizioneDD; + + private String pressoDD; + + private String indirizzoDD; + + private String numeroCivicoDD; + + private String capZonaDD; + + private String telefonoDD; + + private String faxDD; + + private String eMailDD; + + private Clifor clifor; + + private Comune comuneDD; + + private Nazione nazioneDD; + + private String capComuneDD; + + private String descrizioneComuneDD; + + private String provinciaComuneDD; + + private long flgDDDefault; + + public DestinazioneDiversa(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DestinazioneDiversa() {} + + public void setId_destinazioneDiversa(long newId_destinazioneDiversa) { + this.id_destinazioneDiversa = newId_destinazioneDiversa; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_comuneDD(long newId_comuneDD) { + this.id_comuneDD = newId_comuneDD; + setComuneDD(null); + } + + public void setId_nazioneDD(String newId_nazioneDD) { + this.id_nazioneDD = newId_nazioneDD; + setNazioneDD(null); + } + + public void setDescrizioneDD(String newDescrizione) { + this.descrizioneDD = newDescrizione; + } + + public void setPressoDD(String newPresso) { + this.pressoDD = newPresso; + } + + public void setIndirizzoDD(String newIndirizzoDD) { + this.indirizzoDD = newIndirizzoDD; + } + + public void setNumeroCivicoDD(String newNumeroCivicoDD) { + this.numeroCivicoDD = newNumeroCivicoDD; + } + + public void setCapZonaDD(String newCapZonaDD) { + this.capZonaDD = newCapZonaDD; + } + + public void setTelefonoDD(String newTelefonoDD) { + this.telefonoDD = newTelefonoDD; + } + + public void setFaxDD(String newFaxDD) { + this.faxDD = newFaxDD; + } + + public void setEMailDD(String newEMailDD) { + this.eMailDD = newEMailDD; + } + + public long getId_destinazioneDiversa() { + return this.id_destinazioneDiversa; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_comuneDD() { + return this.id_comuneDD; + } + + public String getId_nazioneDD() { + return (this.id_nazioneDD == null) ? "" : this.id_nazioneDD.trim(); + } + + public String getDescrizioneDD() { + return (this.descrizioneDD == null) ? "" : this.descrizioneDD.trim(); + } + + public String getPressoDD() { + return (this.pressoDD == null) ? "" : this.pressoDD.trim(); + } + + public String getIndirizzoDD() { + return (this.indirizzoDD == null) ? "" : this.indirizzoDD.trim(); + } + + public String getNumeroCivicoDD() { + return (this.numeroCivicoDD == null) ? "" : this.numeroCivicoDD.trim(); + } + + public String getCapZonaDD() { + return (this.capZonaDD == null) ? "" : this.capZonaDD.trim(); + } + + public String getTelefonoDD() { + return (this.telefonoDD == null) ? "" : this.telefonoDD.trim(); + } + + public String getFaxDD() { + return (this.faxDD == null) ? "" : this.faxDD.trim(); + } + + public String getEMailDD() { + return (this.eMailDD == null) ? "" : this.eMailDD.trim(); + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setComuneDD(Comune newComune) { + this.comuneDD = newComune; + } + + public Comune getComuneDD() { + this.comuneDD = (Comune)getSecondaryObject(this.comuneDD, Comune.class, getId_comuneDD()); + return this.comuneDD; + } + + public void setNazioneDD(Nazione newNazione) { + this.nazioneDD = newNazione; + } + + public Nazione getNazioneDD() { + this.nazioneDD = (Nazione)getSecondaryObject(this.nazioneDD, Nazione.class, getId_nazioneDD()); + return this.nazioneDD; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(DestinazioneDiversaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from DESTINAZIONE_DIVERSA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getIndirizzoCompleto() { + return getIndirizzoDD() + " n." + getIndirizzoDD() + " - " + getNumeroCivicoDD() + " " + (getCapZonaDD().isEmpty() ? getCapComuneDD() : getCapZonaDD()) + " (" + + getDescrizioneComuneDD() + ")"; + } + + public String getContatti() { + return (this.faxDD == null) ? "" : this.faxDD.trim(); + } + + public Vectumerator findByClifor(long l_id_clifor, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from DESTINAZIONE_DIVERSA AS A"; + String s_Sql_Order = " order by A.descrizioneDD"; + WcString wc = new WcString(); + wc.addWc("A.id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void seteMailDD(String eMailDD) { + this.eMailDD = eMailDD; + } + + public String getCapComuneDD() { + if (this.id_comuneDD != 0L) + return getComuneDD().getCap(); + return (this.capComuneDD == null) ? "" : this.capComuneDD.trim(); + } + + public void setCapComuneDD(String capComuneDD) { + this.capComuneDD = capComuneDD; + } + + public String getDescrizioneComuneDD() { + if (this.id_comuneDD != 0L) + return getComuneDD().getDescrizione(); + return (this.descrizioneComuneDD == null) ? "" : this.descrizioneComuneDD.trim(); + } + + public void setDescrizioneComuneDD(String descrizioneComuneDD) { + this.descrizioneComuneDD = descrizioneComuneDD; + } + + public String getProvinciaComuneDD() { + if (this.id_comuneDD != 0L) + return getComuneDD().getProvincia(); + return (this.provinciaComuneDD == null) ? "" : this.provinciaComuneDD.trim(); + } + + public void setProvinciaComuneDD(String provinciaComuneDD) { + this.provinciaComuneDD = provinciaComuneDD; + } + + public long getFlgDDDefault() { + return this.flgDDDefault; + } + + public void setFlgDDDefault(long flgDDDefault) { + this.flgDDDefault = flgDDDefault; + } + + public void findDefaultByClifor(long l_id_clifor) { + String s_Sql_Find = "select A.* from DESTINAZIONE_DIVERSA AS A"; + String s_Sql_Order = " order by A.descrizioneDD"; + WcString wc = new WcString(); + wc.addWc("A.id_clifor=" + l_id_clifor); + wc.addWc("A.flgDDDefault=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public ResParm save() { + if (getFlgDDDefault() == 1L) + update("update DESTINAZIONE_DIVERSA SET flgDDDefault=0 where id_clifor=" + getId_clifor()); + return super.save(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/DestinazioneDiversaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/DestinazioneDiversaCR.java new file mode 100644 index 00000000..e9084fea --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/DestinazioneDiversaCR.java @@ -0,0 +1,174 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class DestinazioneDiversaCR extends CRAdapter { + private long id_destinazioneDiversa; + + private long id_clifor; + + private long id_comuneDD; + + private String id_nazioneDD; + + private String descrizione; + + private String presso; + + private String indirizzoDD; + + private String numeroCivicoDD; + + private String capZonaDD; + + private String telefonoDD; + + private String faxDD; + + private String eMailDD; + + private Clifor clifor; + + private Comune comuneDD; + + private Nazione nazioneDD; + + public DestinazioneDiversaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DestinazioneDiversaCR() {} + + public void setId_destinazioneDiversa(long newId_destinazioneDiversa) { + this.id_destinazioneDiversa = newId_destinazioneDiversa; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_comuneDD(long newId_comuneDD) { + this.id_comuneDD = newId_comuneDD; + setComune(null); + } + + public void setId_nazioneDD(String newId_nazioneDD) { + this.id_nazioneDD = newId_nazioneDD; + setNazione(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setPresso(String newPresso) { + this.presso = newPresso; + } + + public void setIndirizzoDD(String newIndirizzoDD) { + this.indirizzoDD = newIndirizzoDD; + } + + public void setNumeroCivicoDD(String newNumeroCivicoDD) { + this.numeroCivicoDD = newNumeroCivicoDD; + } + + public void setCapZonaDD(String newCapZonaDD) { + this.capZonaDD = newCapZonaDD; + } + + public void setTelefonoDD(String newTelefonoDD) { + this.telefonoDD = newTelefonoDD; + } + + public void setFaxDD(String newFaxDD) { + this.faxDD = newFaxDD; + } + + public void setEMailDD(String newEMailDD) { + this.eMailDD = newEMailDD; + } + + public long getId_destinazioneDiversa() { + return this.id_destinazioneDiversa; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_comuneDD() { + return this.id_comuneDD; + } + + public String getId_nazioneDD() { + return (this.id_nazioneDD == null) ? "" : this.id_nazioneDD.trim(); + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getPresso() { + return (this.presso == null) ? "" : this.presso.trim(); + } + + public String getIndirizzoDD() { + return (this.indirizzoDD == null) ? "" : this.indirizzoDD.trim(); + } + + public String getNumeroCivicoDD() { + return (this.numeroCivicoDD == null) ? "" : this.numeroCivicoDD.trim(); + } + + public String getCapZonaDD() { + return (this.capZonaDD == null) ? "" : this.capZonaDD.trim(); + } + + public String getTelefonoDD() { + return (this.telefonoDD == null) ? "" : this.telefonoDD.trim(); + } + + public String getFaxDD() { + return (this.faxDD == null) ? "" : this.faxDD.trim(); + } + + public String getEMailDD() { + return (this.eMailDD == null) ? "" : this.eMailDD.trim(); + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, + + getId_clifor()); + return this.clifor; + } + + public void setComune(Comune newComune) { + this.comuneDD = newComune; + } + + public Comune getComune() { + this.comuneDD = (Comune)getSecondaryObject(this.comuneDD, Comune.class, + + getId_comuneDD()); + return this.comuneDD; + } + + public void setNazione(Nazione newNazione) { + this.nazioneDD = newNazione; + } + + public Nazione getNazione() { + this.nazioneDD = (Nazione)getSecondaryObject(this.nazioneDD, Nazione.class, + + getId_nazioneDD()); + return this.nazioneDD; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Esercizio.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Esercizio.java new file mode 100644 index 00000000..452a8967 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Esercizio.java @@ -0,0 +1,64 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Esercizio extends _AnagAdapter implements Serializable { + private long id_esercizio; + + private long flgStato; + + public Esercizio(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Esercizio() {} + + public void setId_esercizio(long newId_esercizio) { + this.id_esercizio = newId_esercizio; + } + + public void setFlgStato(long newFlgStato) { + this.flgStato = newFlgStato; + } + + public long getId_esercizio() { + return this.id_esercizio; + } + + public long getFlgStato() { + return this.flgStato; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(EsercizioCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ESERCIZIO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/EsercizioCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/EsercizioCR.java new file mode 100644 index 00000000..3940ade4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/EsercizioCR.java @@ -0,0 +1,32 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class EsercizioCR extends CRAdapter { + private long id_esercizio; + + private long flgStato; + + public EsercizioCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public EsercizioCR() {} + + public void setId_esercizio(long newId_esercizio) { + this.id_esercizio = newId_esercizio; + } + + public void setFlgStato(long newFlgStato) { + this.flgStato = newFlgStato; + } + + public long getId_esercizio() { + return this.id_esercizio; + } + + public long getFlgStato() { + return this.flgStato; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Festivita.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Festivita.java new file mode 100644 index 00000000..da9d6075 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Festivita.java @@ -0,0 +1,231 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.Calendar; + +public class Festivita extends _AnagAdapter implements Serializable { + private static final long serialVersionUID = -6806543963513972058L; + + private long id_festivita; + + private String descrizione; + + private long giorno; + + private long mese; + + private long anno; + + private Date dataEsclusione; + + private long flgTipo; + + private Date dataInizio; + + private Date dataFine; + + public static final long TIPO_CALCOLO_FRATELLI = 0L; + + public static final long TIPO_FESTIVITA_AMBULATORIO = 1L; + + public static final long TIPO_FESTIVITA_LAVORATIVI = 2L; + + public Festivita(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Festivita() {} + + public void setId_festivita(long newId_festivita) { + this.id_festivita = newId_festivita; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setGiorno(long newGiorno) { + this.giorno = newGiorno; + } + + public void setMese(long newMese) { + this.mese = newMese; + } + + public void setAnno(long newAnno) { + this.anno = newAnno; + } + + public void setFlgTipo(long newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public long getId_festivita() { + return this.id_festivita; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public long getGiorno() { + return this.giorno; + } + + public Date getDataAnno(int l_anno) { + Calendar cal = Calendar.getInstance(); + cal.set(5, (int)getGiorno()); + cal.set(2, (int)getMese() - 1); + if (l_anno > 0) + cal.set(1, l_anno); + return new Date(cal.getTimeInMillis()); + } + + public Date getDataAnno() { + return getDataAnno((int)getAnno()); + } + + public long getMese() { + return this.mese; + } + + public long getAnno() { + return this.anno; + } + + public long getFlgTipo() { + return this.flgTipo; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(FestivitaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from FESTIVITA AS A"; + String s_Sql_Order = " order by A.anno, A.mese, A.giorno"; + WcString wc = new WcString(); + if (CR.getDataDa() != null) + wc.addWc("(A.anno=0 or A.anno is null or A.anno>=" + CR.getAnnoDataDa() + ")"); + if (CR.getDataA() != null) + wc.addWc("(A.anno=0 or A.anno is null or A.anno<=" + CR.getAnnoDataA() + ")"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt, 0, 0); + Vectumerator result = new Vectumerator(); + while (vec.hasMoreElements()) { + Festivita row = (Festivita)vec.nextElement(); + if (CR.getMeseDataDa() == CR.getMeseDataA()) { + if (row.getMese() == (long)CR.getMeseDataDa() && row.getGiorno() >= (long)CR.getGiornoDataDa() && + row.getGiorno() <= (long)CR.getGiornoDataA()) + result.addElement(row); + continue; + } + if ((row.getMese() == (long)CR.getMeseDataDa() && row.getGiorno() >= (long)CR.getGiornoDataDa()) || ( + row.getMese() > (long)CR.getMeseDataDa() && row.getMese() < (long)CR.getMeseDataA()) || ( + row.getMese() == (long)CR.getMeseDataA() && row.getGiorno() <= (long)CR.getGiornoDataA())) + result.addElement(row); + } + return result; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByData(Date l_data, long flgTipo) { + String s_Sql_Find = "select A.* from FESTIVITA AS A"; + String s_Sql_Order = " order by A.anno, A.mese, A.giorno"; + WcString wc = new WcString(); + long l_giorno = 0L; + long l_mese = 0L; + long l_anno = 0L; + if (l_data != null) { + Calendar cal = Calendar.getInstance(); + cal.setTime(l_data); + l_giorno = (long)cal.get(5); + l_mese = (long)(cal.get(2) + 1); + l_anno = (long)cal.get(1); + } + if (flgTipo == 0L) { + wc.addWc("((A.anno=0 or A.anno is null) and A.giorno=" + l_giorno + " and A.mese=" + l_mese + ") or (A.anno=" + l_anno + " and A.giorno=" + l_giorno + " and A.mese=" + l_mese + ")"); + } else { + wc.addWc("((A.anno=0 or A.anno is null) and A.giorno=" + l_giorno + " and A.mese=" + l_mese + ") or (A.anno=" + l_anno + " and A.giorno=" + l_giorno + " and A.mese=" + l_mese + ") OR (A.dataInizio <= ? AND A.dataFine >= ?)"); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + int dataCount = 0; + if (flgTipo != 0L) { + dataCount++; + stmt.setDate(dataCount, l_data); + dataCount++; + stmt.setDate(dataCount, l_data); + } + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Date getDataEsclusione() { + return this.dataEsclusione; + } + + public void setDataEsclusione(Date dataEsclusione) { + this.dataEsclusione = dataEsclusione; + if (dataEsclusione != null) { + Calendar cal = Calendar.getInstance(); + cal.setTime(dataEsclusione); + setGiorno((long)cal.get(5)); + setMese((long)(cal.get(2) + 1)); + setAnno((long)cal.get(1)); + } + } + + public boolean isFestivo(Date l_data, long flgTipo) { + Calendar cal = Calendar.getInstance(); + cal.setTime(l_data); + if (cal.get(7) == 1) + return true; + if (flgTipo == 2L && + cal.get(7) == 7) + return true; + Festivita festivita = new Festivita(getApFull()); + festivita.findByData(l_data, flgTipo); + if (festivita.getDBState() == 1) + return true; + return false; + } + + public Date getDataInizio() { + return this.dataInizio; + } + + public void setDataInizio(Date dataDa) { + this.dataInizio = dataDa; + } + + public Date getDataFine() { + return this.dataFine; + } + + public void setDataFine(Date dataA) { + this.dataFine = dataA; + } + + public long getTotGiorniLavorativiFraDueDate(Date dataDa, Date dataA) { + long totGg = 0L; + Calendar cal = Calendar.getInstance(); + cal.setTime(dataDa); + while (getDateDiff(new Date(cal.getTimeInMillis()), dataA) >= 0L) { + if (!isFestivo(new Date(cal.getTimeInMillis()), 2L)) + totGg++; + cal.add(6, 1); + } + return totGg; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/FestivitaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/FestivitaCR.java new file mode 100644 index 00000000..04e28a9d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/FestivitaCR.java @@ -0,0 +1,173 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import java.sql.Date; +import java.util.Calendar; + +public class FestivitaCR extends CRAdapter { + private long id_festivita; + + private String descrizione; + + private long giorno; + + private long mese; + + private Date dataDa; + + private Date dataA; + + private long anno; + + private long flgTipo; + + private Date dataFine; + + private Date dataInizio; + + public FestivitaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public FestivitaCR() {} + + public void setId_festivita(long newId_festivita) { + this.id_festivita = newId_festivita; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setGiorno(long newGiorno) { + this.giorno = newGiorno; + } + + public void setMese(long newMese) { + this.mese = newMese; + } + + public void setAnno(long newAnno) { + this.anno = newAnno; + } + + public void setFlgTipo(long newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public long getId_festivita() { + return this.id_festivita; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public long getGiorno() { + return this.giorno; + } + + public long getMese() { + return this.mese; + } + + public long getAnno() { + return this.anno; + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public Date getDataA() { + if (this.dataA == null) { + Calendar cal = Calendar.getInstance(); + this.dataA = DBAdapter.getLastOfYear(cal.get(1)); + } + return this.dataA; + } + + public void setDataA(Date dataA) { + this.dataA = dataA; + } + + public Date getDataDa() { + return this.dataDa; + } + + public int getGiornoDataA() { + if (this.dataA != null) + return getCalendarDataA().get(5); + return 0; + } + + public int getMeseDataDa() { + if (this.dataDa != null) + return getCalendarDataDa().get(2) + 1; + return -1; + } + + public int getAnnoDataDa() { + if (this.dataDa != null) + return getCalendarDataDa().get(1); + return 0; + } + + public Calendar getCalendarDataDa() { + if (this.dataDa != null) { + Calendar cal = Calendar.getInstance(); + cal.setTime(getDataDa()); + return cal; + } + return null; + } + + public Calendar getCalendarDataA() { + if (this.dataA != null) { + Calendar cal = Calendar.getInstance(); + cal.setTime(getDataA()); + return cal; + } + return null; + } + + public void setDataDa(Date dataDa) { + this.dataDa = dataDa; + } + + public int getAnnoDataA() { + if (this.dataA != null) + return getCalendarDataA().get(1); + return 0; + } + + public int getGiornoDataDa() { + if (this.dataDa != null) + return getCalendarDataDa().get(5); + return 0; + } + + public int getMeseDataA() { + if (this.dataA != null) + return getCalendarDataA().get(2) + 1; + return -1; + } + + public Date getDataFine() { + return this.dataFine; + } + + public Date getDataInizio() { + return this.dataInizio; + } + + public void setDataFine(Date dataA) { + this.dataFine = dataA; + } + + public void setDataInizio(Date dataDa) { + this.dataInizio = dataDa; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Fornitore.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Fornitore.java new file mode 100644 index 00000000..8de9512e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Fornitore.java @@ -0,0 +1,59 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Fornitore extends Clifor { + private static final long serialVersionUID = -6753258942143203192L; + + private long id_fornitore; + + public Fornitore() {} + + public Fornitore(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public String getTableBeanName() { + return "CLIFOR"; + } + + public String getFlgTipo() { + return "F"; + } + + public Vectumerator findByCR(FornitoreCR CR, int pageNumber, int pageRows) { + return findByCR(CR, pageNumber, pageRows); + } + + public long getId_fornitore() { + return getId_clifor(); + } + + public void setId_fornitore(long id_cliente) { + setId_clifor(id_cliente); + } + + protected String sqlStringfindAll() { + return "select * from CLIFOR where id_clifor>1 and flgTipo='F' order by cognome, nome"; + } + + public Vectumerator findProgettisti() { + String s_Sql_Find = "select A.* from CLIFOR AS A"; + String s_Sql_Order = " order by A.cognome, A.nome\t"; + WcString wc = new WcString(); + s_Sql_Find = s_Sql_Find + " JOIN CLIFOR_TIPO_CLIFOR AS B ON A.id_clifor = B.id_clifor JOIN TIPO_CLIFOR AS C ON B.id_tipoClifor = C.id_tipoClifor "; + wc.addWc("A.flgTipo='F'"); + wc.addWc("C.flgTipologia = 2"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/FornitoreCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/FornitoreCR.java new file mode 100644 index 00000000..16ee1977 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/FornitoreCR.java @@ -0,0 +1,25 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; + +public class FornitoreCR extends CliforCR { + private long id_fornitore; + + public FornitoreCR() {} + + public FornitoreCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public String getFlgTipo() { + return "F"; + } + + public long getId_fornitore() { + return getId_clifor(); + } + + public void setId_fornitore(long id_cliente) { + setId_clifor(id_cliente); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Glossario.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Glossario.java new file mode 100644 index 00000000..3278dc55 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Glossario.java @@ -0,0 +1,128 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Glossario extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1695626744317L; + + private long id_glossario; + + private long id_tipoGlossario; + + private String descrizione; + + private TipoGlossario tipoGlossario; + + private String codice; + + public Glossario(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Glossario() {} + + public void setId_glossario(long newId_glossario) { + this.id_glossario = newId_glossario; + } + + public void setId_tipoGlossario(long newId_tipoGlossario) { + this.id_tipoGlossario = newId_tipoGlossario; + setTipoGlossario(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_glossario() { + return this.id_glossario; + } + + public long getId_tipoGlossario() { + return this.id_tipoGlossario; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public void setTipoGlossario(TipoGlossario newTipoGlossario) { + this.tipoGlossario = newTipoGlossario; + } + + public TipoGlossario getTipoGlossario() { + this.tipoGlossario = (TipoGlossario)getSecondaryObject(this.tipoGlossario, TipoGlossario.class, getId_tipoGlossario()); + return this.tipoGlossario; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(GlossarioCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from GLOSSARIO AS A"; + String s_Sql_Order = " order by A.descrizione"; + if (!CR.getCodiceTipoGlossario().isEmpty()) + s_Sql_Find = s_Sql_Find + " inner join TIPO_GLOSSARIO AS B ON A.id_tipoGlossario=B.id_tipoGlossario"; + WcString wc = new WcString(); + if (CR.getId_tipoGlossarioS() > 0L) + wc.addWc("A.id_tipoGlossario=" + CR.getId_tipoGlossarioS()); + if (!CR.getCodiceTipoGlossario().isEmpty()) + wc.addWc("B.codice='" + CR.getCodiceTipoGlossario() + "'"); + if (!CR.getDescrizione().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getDescrizione().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%' or A.codice ='" + token + "')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getCodice() { + return (this.codice == null) ? "" : this.codice.trim(); + } + + public void setCodice(String codice) { + this.codice = codice; + } + + public Vectumerator findByCodiceTipoGlossario(String l_codiceTipoGlossario) { + String s_Sql_Find = "select A.* from GLOSSARIO AS A"; + String s_Sql_Order = " order by A.descrizione"; + s_Sql_Find = s_Sql_Find + " inner join TIPO_GLOSSARIO AS B ON A.id_tipoGlossario=B.id_tipoGlossario"; + WcString wc = new WcString(); + if (!l_codiceTipoGlossario.isEmpty()) + wc.addWc("B.codice='" + l_codiceTipoGlossario + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/GlossarioCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/GlossarioCR.java new file mode 100644 index 00000000..e941ec9c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/GlossarioCR.java @@ -0,0 +1,68 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class GlossarioCR extends CRAdapter { + private static final long serialVersionUID = -5321498975655164852L; + + private long id_glossario; + + private long id_tipoGlossarioS; + + private String descrizione; + + private TipoGlossario tipoGlossario; + + private String codiceTipoGlossario; + + public GlossarioCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public GlossarioCR() {} + + public void setId_glossario(long newId_glossario) { + this.id_glossario = newId_glossario; + } + + public void setId_tipoGlossarioS(long newId_tipoGlossario) { + this.id_tipoGlossarioS = newId_tipoGlossario; + setTipoGlossario(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_glossario() { + return this.id_glossario; + } + + public long getId_tipoGlossarioS() { + return this.id_tipoGlossarioS; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public void setTipoGlossario(TipoGlossario newTipoGlossario) { + this.tipoGlossario = newTipoGlossario; + } + + public TipoGlossario getTipoGlossario() { + this.tipoGlossario = (TipoGlossario)getSecondaryObject(this.tipoGlossario, TipoGlossario.class, + + getId_tipoGlossarioS()); + return this.tipoGlossario; + } + + public String getCodiceTipoGlossario() { + return (this.codiceTipoGlossario == null) ? "" : this.codiceTipoGlossario.trim(); + } + + public void setCodiceTipoGlossario(String newCodice) { + this.codiceTipoGlossario = newCodice; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Iva.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Iva.java new file mode 100644 index 00000000..279bdae4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Iva.java @@ -0,0 +1,400 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapterException; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Iva extends _AnagAdapter implements Serializable, IvaInterface { + private static final long serialVersionUID = -2303180562953644516L; + + public static final String TI_IMPONIBILE = "I"; + + public static final String TI_N1_ESCLUSO_ART_15 = "X"; + + public static final String TI_N2_NON_SOGGETTE_NON_VALIDO_2021 = "S"; + + public static final String TI_N2_1_NON_SOGGETTE_ART_7 = "S1"; + + public static final String TI_N2_2_NON_SOGGETTE_ALTRE = "S2"; + + public static final String TI_N3_NON_IMPONIBILE_NON_VALIDO_2021 = "N"; + + public static final String TI_N3_1_NON_IMPONIBILE_ESPORTAZIONI = "N1"; + + public static final String TI_N3_2_NON_IMPONIBILE_CESS_COMUN = "N2"; + + public static final String TI_N3_3_NON_IMPONIBILE_CESS_S_MARINO = "N3"; + + public static final String TI_N3_4_NON_IMPONIBILE_OP_ASSIM_CESS_ESPORT = "N4"; + + public static final String TI_N3_5_NON_IMPONIBILE_CON_DICH_INTENTO = "N5"; + + public static final String TI_N3_6_NON_IMPONIBILE_ALTRE_OPER = "N6"; + + public static final String TI_N4_ESENTE = "E"; + + public static final String TI_N5_REGIME_MARGINE = "R"; + + public static final String TI_N6_INVERSIONE_CONTABILE_NON_VALIDO_2021 = "C"; + + public static final String TI_N6_1_INVERSIONE_CONTABILE_ROTTAMI = "C1"; + + public static final String TI_N6_2_INVERSIONE_CONTABILE_ORO_ARGENTO = "C2"; + + public static final String TI_N6_3_INVERSIONE_CONTABILE_SUBAPP_EDILE = "C3"; + + public static final String TI_N6_4_INVERSIONE_CONTABILE_CESS_FABBRICATI = "C4"; + + public static final String TI_N6_5_INVERSIONE_CONTABILE_CESS_TEL_CELLULARI = "C5"; + + public static final String TI_N6_6_INVERSIONE_CONTABILE_CESS_PROD_ELETTRONICI = "C6"; + + public static final String TI_N6_7_INVERSIONE_CONTABILE_PREST_EDILE = "C7"; + + public static final String TI_N6_8_INVERSIONE_CONTABILE_SETT_ENERGETICO = "C8"; + + public static final String TI_N6_9_INVERSIONE_CONTABILE_ALTRI_CASI = "C9"; + + public static final String TI_N7_ASSOLTA_ATRO_STATO_UE = "A"; + + private long aliquota; + + private long aliquotaIndetraibile; + + private String descrizione; + + private String flgTipo; + + private long id_ivaStdRM; + + private Iva ivaStdRM; + + private String notaEsenzione; + + private String codiceExport; + + private String descrizioneRigaStampa; + + private long flgOss; + + private long id_iva; + + public static final String P_CODICE_IVA_STD_VEND = "CODICE_IVA_STD_VEND"; + + public static final String P_CODICE_IVA_STD_ACQUISTO = "CODICE_IVA_STD_ACQ"; + + public static final String P_CODICE_IVA_ESENTE_SPESE_BOLLI = "CODICE_IVA_ESENTE"; + + public static final String P_CODICE_IVA_CEE_AZIENDA_ART41 = "CODICE_IVA_CEE_AZIENDA_ART41"; + + public static final String P_CODICE_IVA_ITA_CEE_AZIENDA_ART58 = "CODICE_IVA_ITA_CEE_AZIENDA_ART58"; + + public static final String P_CODICE_IVA_EXTRA_CEE_ART8_A = "CODICE_IVA_ART8_A"; + + public static final String P_CODICE_IVA_EXTRA_CEE_ESP_ABITUALE_ART8_C = "CODICE_IVA_EXTRA_CEE_ESP_ABITUALE_ART8_C"; + + public static final String P_CODICE_IVA_TRASP_EXTRA_CEE_RAV_ART9 = "CODICE_IVA_ART9"; + + public static final String P_CODICE_IVA_REVERSE_CHARGE = "CODICE_IVA_REVERSE_CHARGE"; + + public static final String P_CODICE_IVA_REGIME_MARGINE = "CODICE_IVA_REGIME_MARGINE"; + + public static final String P_IVA_CEE_ONE_STOP_SHOP = "IVA_CEE_ONE_STOP_SHOP"; + + public static final String P_IVA_ESTERO_AZIENDA_ESENTE = "IVA_ESTERO_AZIENDA_ESENTE"; + + public Iva() {} + + public Iva(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(IvaCR CR, int pageNumber, int pageRows) throws DBAdapterException, SQLException { + String s_Sql_Find = "select A.* from IVA AS A"; + String s_Sql_Order = " order by A.descrizione"; + String wc = ""; + if (!CR.getSearchTxt().isEmpty()) + wc = buildWc(wc, "A.descrizione like'" + CR.getSearchTxt() + "%' "); + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + return findRows(stmt, pageNumber, pageRows); + } + + public long getAliquota() { + return this.aliquota; + } + + public long getAliquotaIndetraibile() { + return this.aliquotaIndetraibile; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public String getFlgTipo() { + return (this.flgTipo == null || this.flgTipo.isEmpty()) ? "I" : this.flgTipo; + } + + public static final String getTipo(String l_flgTipo) { + if (l_flgTipo.equals("I")) + return "Imponibile"; + if (l_flgTipo.equals("X")) + return "Escluso ex art. 15 N1"; + if (l_flgTipo.equals("S")) + return "Non Soggette N2 NO 2021"; + if (l_flgTipo.equals("S1")) + return "Non Soggette N2.1 ART. 7 DPR 633/72"; + if (l_flgTipo.equals("S2")) + return "Non Soggette N2.2 ALTRE"; + if (l_flgTipo.equals("N")) + return "Non Imponibile N3 NO 2021"; + if (l_flgTipo.equals("N1")) + return "Non Imponibile N3.1 Esportazioni"; + if (l_flgTipo.equals("N2")) + return "Non Imponibile N3.2 Cessioni Intracomunitarie"; + if (l_flgTipo.equals("N3")) + return "Non Imponibile N3.3 Cessioni San Marino"; + if (l_flgTipo.equals("N4")) + return "Non Imponibile N3.4 Assim. Cess. Esportazioni"; + if (l_flgTipo.equals("N5")) + return "Non Imponibile N3.5 con dichiarazioni di Intento"; + if (l_flgTipo.equals("N6")) + return "Non Imponibile N3.6 oper. non concorrono al plafond"; + if (l_flgTipo.equals("E")) + return "Esente N4"; + if (l_flgTipo.equals("R")) + return "Regime del Margine N5"; + if (l_flgTipo.equals("C")) + return "Inversione Contabile N6 NO 2021"; + if (l_flgTipo.equals("C1")) + return "Inversione Contabile N6.1 Cess. Rottami"; + if (l_flgTipo.equals("C2")) + return "Inversione Contabile N6.2 Cess. Oro o Argento"; + if (l_flgTipo.equals("C3")) + return "Inversione Contabile N6.3 subapp. settore edile"; + if (l_flgTipo.equals("C4")) + return "Inversione Contabile N6.4 Cessione Fabbricati"; + if (l_flgTipo.equals("C5")) + return "Inversione Contabile N6.5 Cessione Tel. Cellulari"; + if (l_flgTipo.equals("C6")) + return "Inversione Contabile N6.6 Cessione Prod. Elettronici"; + if (l_flgTipo.equals("C7")) + return "Inversione Contabile N6.7 Prestaz. comparto edile e connessi"; + if (l_flgTipo.equals("C8")) + return "Inversione Contabile N6.8 Oper. Settore Energetico"; + if (l_flgTipo.equals("C9")) + return "Inversione Contabile N6.9 Altri Casi"; + if (l_flgTipo.equals("A")) + return "Assolta UE N7"; + return ""; + } + + public static final String getFENatura(String l_flgTipo) { + if (l_flgTipo.equals("I")) + return ""; + if (l_flgTipo.equals("X")) + return "N1"; + if (l_flgTipo.equals("S")) + return "N2"; + if (l_flgTipo.equals("S1")) + return "N2.1"; + if (l_flgTipo.equals("S2")) + return "N2.2"; + if (l_flgTipo.equals("N")) + return "N3"; + if (l_flgTipo.equals("N1")) + return "N3.1"; + if (l_flgTipo.equals("N2")) + return "N3.2"; + if (l_flgTipo.equals("N3")) + return "N3.3"; + if (l_flgTipo.equals("N4")) + return "N3.4"; + if (l_flgTipo.equals("N5")) + return "N3.5"; + if (l_flgTipo.equals("N6")) + return "N3.6"; + if (l_flgTipo.equals("E")) + return "N4"; + if (l_flgTipo.equals("R")) + return "N5"; + if (l_flgTipo.equals("C")) + return "N6"; + if (l_flgTipo.equals("C1")) + return "N6.1"; + if (l_flgTipo.equals("C2")) + return "N6.2"; + if (l_flgTipo.equals("C3")) + return "N6.3"; + if (l_flgTipo.equals("C4")) + return "N6.4"; + if (l_flgTipo.equals("C5")) + return "N6.5"; + if (l_flgTipo.equals("C6")) + return "N6.6"; + if (l_flgTipo.equals("C7")) + return "N6.7"; + if (l_flgTipo.equals("C8")) + return "N6.8"; + if (l_flgTipo.equals("C9")) + return "N6.9"; + if (l_flgTipo.equals("A")) + return "N7"; + return ""; + } + + public String getFENatura() { + return getFENatura(getFlgTipo()); + } + + public String getTipo() { + return getTipo(getFlgTipo()); + } + + public long getId_iva() { + return this.id_iva; + } + + public String getNotaEsenzione() { + return (this.notaEsenzione == null) ? "" : this.notaEsenzione; + } + + public void setAliquota(long newAliquota) { + this.aliquota = newAliquota; + } + + public void setAliquotaIndetraibile(long l) { + this.aliquotaIndetraibile = l; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setFlgTipo(String string) { + this.flgTipo = string; + } + + public void setId_iva(long newId_iva) { + this.id_iva = newId_iva; + } + + public void setNotaEsenzione(String l_notaEsenzione) { + this.notaEsenzione = l_notaEsenzione; + } + + public String getCodiceExport() { + return (this.codiceExport == null) ? "" : this.codiceExport; + } + + public void setCodiceExport(String codiceExport) { + this.codiceExport = codiceExport; + } + + public long getAliquotaFE() { + if (getFlgTipo().equals("R")) + return 0L; + return getAliquota(); + } + + public boolean isRegimeMargine() { + return getFlgTipo().equals("R"); + } + + public String getDescrizioneRigaStampa() { + return (this.descrizioneRigaStampa == null) ? "" : this.descrizioneRigaStampa.trim(); + } + + public void setDescrizioneRigaStampa(String descrizioneRigaStampa) { + this.descrizioneRigaStampa = descrizioneRigaStampa; + } + + public String getDescrizioneRigaStampaAuto() { + return getDescrizioneRigaStampa().isEmpty() ? getDescrizione() : getDescrizioneRigaStampa(); + } + + public long getFlgOss() { + return this.flgOss; + } + + public void setFlgOss(long flgOss) { + this.flgOss = flgOss; + } + + public Vectumerator findAllOss() { + String s_Sql_Find = "select A.* from IVA AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.flgOss=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_ivaStdRM() { + return this.id_ivaStdRM; + } + + public void setId_ivaStdRM(long id_ivaStdRM) { + this.id_ivaStdRM = id_ivaStdRM; + setIvaStdRM(null); + } + + public Iva getIvaStdRM() { + this.ivaStdRM = (Iva)getSecondaryObject(this.ivaStdRM, Iva.class, new Long(getId_ivaStdRM())); + return this.ivaStdRM; + } + + public void setIvaStdRM(Iva ivaStdRM) { + this.ivaStdRM = ivaStdRM; + } + + public ResParm save() { + if (getFlgTipo().equals("R")) { + if (getId_ivaStdRM() == 0L) + return new ResParm(false, "Errore! Indicare una aliquota iva per il calcolo dell'iva sul margine"); + } else { + setId_ivaStdRM(0L); + } + return super.save(); + } + + public Vectumerator findAllNoRM() { + String s_Sql_Find = "select A.* from IVA AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.flgTipo!='R'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findAllNonOss() { + String s_Sql_Find = "select A.* from IVA AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + wc.addWc("(A.flgOss=0 or A.flgOss is null)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/IvaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/IvaCR.java new file mode 100644 index 00000000..196ca22d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/IvaCR.java @@ -0,0 +1,12 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class IvaCR extends CRAdapter { + public IvaCR() {} + + public IvaCR(ApplParmFull newAp) { + super(newAp); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/IvaInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/IvaInterface.java new file mode 100644 index 00000000..16e68218 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/IvaInterface.java @@ -0,0 +1,41 @@ +package it.acxent.anag; + +public interface IvaInterface { + long getAliquota(); + + long getAliquotaIndetraibile(); + + String getDescrizione(); + + String getFlgTipo(); + + String getFENatura(); + + String getTipo(); + + long getId_iva(); + + String getNotaEsenzione(); + + void setAliquota(long paramLong); + + void setAliquotaIndetraibile(long paramLong); + + void setDescrizione(String paramString); + + void setFlgTipo(String paramString); + + void setId_iva(long paramLong); + + void setNotaEsenzione(String paramString); + + String getCodiceExport(); + + void setCodiceExport(String paramString); + + long getAliquotaFE(); + + boolean isRegimeMargine(); + + Iva getIvaStdRM(); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Lang.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Lang.java new file mode 100644 index 00000000..5909fc72 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Lang.java @@ -0,0 +1,39 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; + +public class Lang extends _AnagAdapter { + private String descrizione; + + public Lang() {} + + public Lang(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } + + public Vectumerator findLingue() { + Vectumerator vec = new Vectumerator(); + String lingue = getParm("TAGLIE_LINGUE").getTesto(); + StringTokenizer st = new StringTokenizer(lingue, ","); + while (st.hasMoreTokens()) { + Lang lg = new Lang(getApFull()); + lg.setDescrizione(st.nextToken()); + vec.add(lg); + } + return vec; + } + + protected boolean isDatabaseBean() { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Listino.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Listino.java new file mode 100644 index 00000000..18ff3226 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Listino.java @@ -0,0 +1,696 @@ +package it.acxent.anag; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloVariante; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Listino extends _AnagAdapter implements Serializable { + private static final long serialVersionUID = -8525948766452916580L; + + public static final int TIPO_LISTINO_PERC_SCONTO_VEND = 0; + + public static final int TIPO_LISTINO_RICARICO_ACQ = 1; + + public static final int TIPO_LISTINO_RICARICO_PREZZO_BASE = 2; + + public static final int TIPO_LISTINO_BASE = 99; + + public static final int PREZZO = 0; + + public static final int PERTCENTUALE = 1; + + private long id_listino; + + private long flgTipoL; + + private String descrizione; + + private double percL; + + private double percL1; + + private double percL2; + + private double percL3; + + public Listino(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Listino() {} + + public void setId_listino(long newId_listino) { + this.id_listino = newId_listino; + } + + public void setFlgTipoL(long newFlgTipo) { + this.flgTipoL = newFlgTipo; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setPercL(double newPercL) { + this.percL = newPercL; + } + + public long getId_listino() { + return this.id_listino; + } + + public long getFlgTipoL() { + return this.flgTipoL; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public double getPercL() { + return this.percL; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ListinoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from LISTINO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%' or A.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (!CR.getDescrizione().trim().isEmpty()) + wc.addWc("A.descrizione like'%" + CR.getDescrizione() + "%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getTipoL() { + return getTipoL(getFlgTipoL()); + } + + public String getDescrizioneCompleta() { + if (getId_listino() == 0L) + return ""; + return getDescrizione() + " " + getDescrizione() + " " + getTipoL(); + } + + public ResParm addListinoTipo(ListinoTipo row) { + ListinoTipo bean = new ListinoTipo(getApFull()); + bean.findByPrimaryKey(row.getId_listinoTipo()); + if (bean.getDBState() == 1) + row.setDBState(bean.getDBState()); + ResParm rp = row.save(); + return rp; + } + + public ResParm delListinoTipo(ListinoTipo row) { + ListinoTipo bean = new ListinoTipo(getApFull()); + bean.findByPrimaryKey(row.getId_listinoTipo()); + return bean.delete(); + } + + public Vectumerator getListinoTipo() { + return new ListinoTipo(getApFull()).findByListino(getId_listino(), 0, 0); + } + + public boolean hasListinoTipo() { + Vectumerator vec = new ListinoTipo(getApFull()).findByListino(getId_listino(), 1, 1); + if (vec.hasMoreElements()) + return true; + return false; + } + + public boolean hasListinoArticolo(Articolo bean) { + ListinoArticolo la = new ListinoArticolo(getApFull()); + la.findByArticoloListino(bean.getId_articolo(), getId_listino()); + if (la.getId_listinoArticolo() > 0L) + return true; + return false; + } + + public boolean hasListinoArticoloVariante(ArticoloVariante bean) { + ListinoArticolo la = new ListinoArticolo(getApFull()); + la.findByArticoloVarianteListino(bean.getId_articoloVariante(), getId_listino()); + if (la.getId_listinoArticolo() > 0L) + return true; + return false; + } + + public double getPercSconto(Articolo articolo) { + if (getId_listino() == 0L || getFlgTipoL() == 1L) + return 0.0D; + ListinoArticolo listinoArticolo = new ListinoArticolo(getApFull()); + listinoArticolo.findByArticoloListino(articolo.getId_articolo(), getId_listino()); + if (listinoArticolo.getId_listinoArticolo() > 0L) + return listinoArticolo.getPercEffettiva(); + double percSconto = getPercEffettiva(); + ListinoTipo listinoTipo = new ListinoTipo(getApFull()); + listinoTipo.findByListinoTipo(getId_listino(), articolo.getId_tipo()); + if (listinoTipo.getId_listinoTipo() > 0L) + percSconto = listinoTipo.getPercEffettiva(); + return percSconto; + } + + public double getPercSconto(ArticoloVariante articoloVariante) { + if (getId_listino() == 0L || getFlgTipoL() == 1L) + return 0.0D; + ListinoArticolo listinoArticolo = new ListinoArticolo(getApFull()); + listinoArticolo.findByArticoloListino(articoloVariante.getId_articolo(), getId_listino()); + if (listinoArticolo.getId_listinoArticolo() > 0L) + return listinoArticolo.getPercEffettiva(); + return getPercSconto(articoloVariante.getArticolo()); + } + + public PrezzoArticolo getPrezzoIva(Articolo articolo) { + return getPrezzo(articolo).conIva((double)articolo.getIva().getAliquota()); + } + + public PrezzoArticolo getPrezzoIva(Articolo articolo, Iva l_iva) { + return getPrezzo(articolo).conIva((double)l_iva.getAliquota()); + } + + public PrezzoArticolo getPrezzoBaseLA(Articolo articolo) { + PrezzoArticolo pa = new PrezzoArticolo(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + if (getId_listino() == 0L || articolo == null || articolo.getId_articolo() == 0L || getFlgTipoL() != 99L) + return pa; + ListinoArticolo listinoArticolo = new ListinoArticolo(getApFull()); + listinoArticolo.findByArticoloListino(articolo.getId_articolo(), getId_listino()); + if (listinoArticolo.getId_listinoArticolo() > 0L) + pa = listinoArticolo.getPrezzoArticoloLA(); + return pa; + } + + public PrezzoArticolo getPrezzoBaseIvaLA(Articolo articolo) { + return getPrezzoBaseLA(articolo).conIva((double)articolo.getIva().getAliquota()); + } + + public PrezzoArticolo getPrezzo(Articolo articolo) { + PrezzoArticolo pa = new PrezzoArticolo(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + if (getId_listino() == 0L || articolo == null || articolo.getId_articolo() == 0L) + return pa; + if (getFlgTipoL() == 99L) { + ListinoArticolo listinoArticolo1 = new ListinoArticolo(getApFull()); + listinoArticolo1.findByArticoloListino(articolo.getId_articolo(), getId_listino()); + if (listinoArticolo1.getId_listinoArticolo() > 0L) + pa = listinoArticolo1.getPrezzoFinaleLA(); + return pa; + } + PrezzoArticolo prezzoArticoloBase = dammiListinoBase(getApFull()).getPrezzo(articolo); + ListinoArticolo listinoArticolo = new ListinoArticolo(getApFull()); + listinoArticolo.findByArticoloListino(articolo.getId_articolo(), getId_listino()); + if (listinoArticolo.getId_listinoArticolo() > 0L) { + pa = listinoArticolo.getPrezzoFinaleLA(); + } else { + ListinoTipo listinoTipo = new ListinoTipo(getApFull()); + listinoTipo.findByListinoTipo(getId_listino(), articolo.getId_tipo()); + if (listinoTipo.getId_listinoTipo() > 0L) { + pa = listinoTipo.getPrezzoFinaleLT(articolo); + } else { + double prezzoBase = articolo.getPrezzoBase(); + double perc = getPercEffettiva(); + if (perc > 0.0D) { + if (getFlgTipoL() == 0L) { + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.subtract(perc); + pps.multiply(prezzoBase); + pps.divide(100.0F); + pps.setScale(2, 5); + pa = new PrezzoArticolo(prezzoBase, getPercL(), pps.getResult(), getPercL1(), getPercL2(), getPercL3(), 0.0D); + } else if (getFlgTipoL() == 1L) { + if (articolo.getCostoAcquistoUltimo() > 0.0D) { + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.add(perc); + pps.multiply(articolo.getCostoAcquistoUltimo()); + pps.divide(100.0F); + pps.setScale(2, 5); + pa = new PrezzoArticolo(0.0D, 0.0D, pps.getResult(), getPercL1(), getPercL2(), getPercL3(), 0.0D); + } + } else if (getFlgTipoL() == 2L) { + if (prezzoBase > 0.0D) { + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.add(perc); + pps.multiply(prezzoBase); + pps.divide(100.0F); + pps.setScale(2, 5); + pa = new PrezzoArticolo(0.0D, 0.0D, pps.getResult(), getPercL1(), getPercL2(), getPercL3(), 0.0D); + } + } + } else { + return dammiListinoBase(getApFull()).getPrezzo(articolo); + } + } + } + if (pa.getPrezzoFinale() > 0.0D) { + double prezzoBaseFinale = prezzoArticoloBase.getPrezzoFinale(); + if (getFlgTipoL() != 2L && prezzoBaseFinale < pa.getPrezzoFinale()) + return prezzoArticoloBase; + return pa; + } + return prezzoArticoloBase; + } + + public PrezzoArticolo getPrezzo(ArticoloVariante articoloVariante) { + PrezzoArticolo pa; + if (getId_listino() == 0L || articoloVariante == null || articoloVariante.getId_articoloVariante() == 0L) { + pa = new PrezzoArticolo(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + return pa; + } + ListinoArticolo listinoArticolo = new ListinoArticolo(getApFull()); + listinoArticolo.findByArticoloVarianteListino(articoloVariante.getId_articoloVariante(), getId_listino()); + if (listinoArticolo.getId_listinoArticolo() > 0L) { + pa = listinoArticolo.getPrezzoFinaleLA(); + } else { + pa = getPrezzo(articoloVariante.getArticolo()); + } + if (getFlgTipoL() != 99L) { + PrezzoArticolo prezzoArticoloBase = dammiListinoBase(getApFull()).getPrezzo(articoloVariante); + double prezzoBaseFinale = prezzoArticoloBase.getPrezzoFinale(); + if (prezzoBaseFinale < pa.getPrezzoFinale()) + return prezzoArticoloBase; + return pa; + } + return pa; + } + + public static final String getTipoL(long l_flgTipo) { + switch ((int)l_flgTipo) { + case 0: + return "Sconto su Vendita"; + case 1: + return "Ricarico su Acquisto"; + case 99: + return "Listino base"; + case 2: + return "Ricarico aggiuntivo su prezzo base"; + } + return "??"; + } + + public Vectumerator getListinoArticoloVariante(int pageNumber, int pageRows) { + return new ListinoArticolo(getApFull()).findArticoliVarianteByListino(getId_listino(), pageNumber, pageRows); + } + + public ResParm addListinoArticolo(ListinoArticolo row) { + ResParm rp = new ResParm(true); + ListinoArticolo bean = new ListinoArticolo(getApFull()); + bean.findByPrimaryKey(row.getId_listinoArticolo()); + if (bean.getDBState() == 1) { + bean.setPrezzoLA(row.getPrezzoLA()); + bean.setPercLA(row.getPercLA()); + bean.setPercLA1(row.getPercLA1()); + bean.setPercLA2(row.getPercLA2()); + bean.setPercLA3(row.getPercLA3()); + rp = bean.save(); + } else { + row.setDBState(0); + rp = row.save(); + } + return rp; + } + + public ResParm addListinoArticoloVariante(ListinoArticolo row) { + ResParm rp = new ResParm(true); + ListinoArticolo bean = new ListinoArticolo(getApFull()); + bean.findByPrimaryKey(row.getId_listinoArticolo()); + if (bean.getDBState() == 1) { + bean.setPrezzoLA(row.getPrezzoLA()); + bean.setPercLA(row.getPercLA()); + bean.setPercLA1(row.getPercLA1()); + bean.setPercLA2(row.getPercLA2()); + bean.setPercLA3(row.getPercLA3()); + bean.setDataScadenzaOffertaLA(row.getDataScadenzaOffertaLA()); + bean.setPrezzoOffertaLA(row.getPrezzoOffertaLA()); + rp = bean.save(); + } else { + row.setDBState(0); + rp = row.save(); + } + return rp; + } + + public ResParm delListinoArticolo(ListinoArticolo row) { + ListinoArticolo bean = new ListinoArticolo(getApFull()); + bean.findByPrimaryKey(row.getId_listinoArticolo()); + return bean.delete(); + } + + public Vectumerator getListinoArticolo(int pageNumber, int pageRows) { + return new ListinoArticolo(getApFull()).findArticoliByListino(getId_listino(), pageNumber, pageRows); + } + + public void findListinoBase() { + String s_Sql_Find = "select A.* from LISTINO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.flgTipoL = 99"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void creaListinoBase() { + setDescrizione("Listino Base"); + setFlgTipoL(99L); + save(); + } + + public double getPercLAByArticoloListino(long id_articolo, long id_listino) { + double percentuale = 0.0D; + ListinoArticolo la = new ListinoArticolo(getApFull()); + la.findByArticoloListino(id_articolo, id_listino); + if (getFlgTipoL() == 99L) { + if (la.isOffertaValida()) { + percentuale = 0.0D; + } else { + percentuale = la.getPercLA(); + } + } else { + double perc = 0.0D; + if (la.getPercLA() != 0.0D) { + perc = la.getPercLA(); + } else { + perc = getPercL(); + } + Listino lis = dammiListinoBase(getApFull()); + double prezzoBase = getPrezzoByArticoloListino(id_articolo, lis.getId_listino(), true); + DoubleOperator dp = new DoubleOperator(prezzoBase); + dp.multiply(perc); + dp.divide(100.0F); + dp.add(prezzoBase); + double prezzoLisCli = dp.getResult(); + double prezzoLisBase = lis.getPrezzoByArticoloListino(id_articolo, lis.getId_listino(), false); + if (prezzoLisCli > prezzoLisBase) { + percentuale = lis.getPercLAByArticoloListino(id_articolo, lis.getId_listino()); + } else { + percentuale = perc; + } + } + return percentuale; + } + + public double getPercLAByArticoloVarianteListino(long id_articoloVariante, long id_listino) { + double percentuale = 0.0D; + ListinoArticolo la = new ListinoArticolo(getApFull()); + la.findByArticoloVarianteListino(id_articoloVariante, id_listino); + if (getFlgTipoL() == 99L) { + if (la.isOffertaValida()) { + percentuale = 0.0D; + } else { + percentuale = la.getPercLA(); + } + } else { + double perc = 0.0D; + if (la.getPercLA() != 0.0D) { + perc = la.getPercLA(); + } else { + perc = getPercL(); + } + Listino lis = dammiListinoBase(getApFull()); + double prezzoBase = getPrezzoByArticoloVarianteListino(id_articoloVariante, lis.getId_listino(), true); + DoubleOperator dp = new DoubleOperator(prezzoBase); + dp.multiply(perc); + dp.divide(100.0F); + dp.add(prezzoBase); + double prezzoLisCli = dp.getResult(); + double prezzoLisBase = lis.getPrezzoByArticoloVarianteListino(id_articoloVariante, lis.getId_listino(), false); + if (prezzoLisCli > prezzoLisBase) { + percentuale = lis.getPercLAByArticoloVarianteListino(id_articoloVariante, lis.getId_listino()); + } else { + percentuale = perc; + } + } + return percentuale; + } + + public double getPrezzoByArticoloListino(long id_articolo, long id_listino, boolean rendiPrezzoBase) { + double prezzo = 0.0D; + ListinoArticolo la = new ListinoArticolo(getApFull()); + la.findByArticoloListino(id_articolo, id_listino); + if (rendiPrezzoBase) { + prezzo = la.getPrezzoLA(); + } else if (getFlgTipoL() == 99L) { + if (la.isOffertaValida()) { + DoubleOperator dp = new DoubleOperator(la.getPrezzoLA()); + dp.multiply(la.getPercLA()); + dp.divide(100.0F); + dp.add(la.getPrezzoLA()); + if (dp.getResult() > la.getPrezzoOffertaLA()) + prezzo = la.getPrezzoOffertaLA(); + } else { + prezzo = la.getPrezzoLA(); + } + } else { + double perc = 0.0D; + if (la.getPercLA() != 0.0D) { + perc = la.getPercLA(); + } else { + perc = getPercL(); + } + Listino lis = dammiListinoBase(getApFull()); + double prezzoBase = getPrezzoByArticoloListino(id_articolo, lis.getId_listino(), true); + DoubleOperator dp = new DoubleOperator(prezzoBase); + dp.multiply(perc); + dp.divide(100.0F); + dp.add(prezzoBase); + double prezzoLisCli = dp.getResult(); + double prezzoLisBase = lis.getPrezzoByArticoloListino(id_articolo, lis.getId_listino(), false); + if (prezzoLisCli > prezzoLisBase) { + if (lis.getPercLAByArticoloListino(id_articolo, id_listino) > 0.0D) { + prezzo = prezzoBase; + } else { + prezzo = prezzoLisBase; + } + } else { + prezzo = prezzoLisCli; + } + } + return prezzo; + } + + public double getPrezzoByArticoloVarianteListino(long id_articoloVariante, long id_listino, boolean rendiPrezzoBase) { + double prezzo = 0.0D; + ListinoArticolo la = new ListinoArticolo(getApFull()); + la.findByArticoloVarianteListino(id_articoloVariante, id_listino); + if (rendiPrezzoBase) { + prezzo = la.getPrezzoLA(); + } else if (getFlgTipoL() == 99L) { + if (la.isOffertaValida()) { + DoubleOperator dp = new DoubleOperator(la.getPrezzoLA()); + dp.multiply(la.getPercLA()); + dp.divide(100.0F); + dp.add(la.getPrezzoLA()); + if (dp.getResult() > la.getPrezzoOffertaLA()) + if (la.getPercLA() > 0.0D) { + prezzo = la.getPrezzoLA(); + } else { + prezzo = la.getPrezzoOffertaLA(); + } + } else { + prezzo = la.getPrezzoLA(); + } + } else { + double perc = 0.0D; + if (la.getPercLA() != 0.0D) { + perc = la.getPercLA(); + } else { + perc = getPercL(); + } + Listino lis = dammiListinoBase(getApFull()); + double prezzoBase = getPrezzoByArticoloVarianteListino(id_articoloVariante, lis.getId_listino(), true); + DoubleOperator dp = new DoubleOperator(prezzoBase); + dp.multiply(perc); + dp.divide(100.0F); + dp.add(prezzoBase); + double prezzoLisCli = dp.getResult(); + double prezzoLisBase = lis.getPrezzoByArticoloVarianteListino(id_articoloVariante, lis.getId_listino(), false); + if (prezzoLisCli > prezzoLisBase) { + if (lis.getPercLAByArticoloVarianteListino(id_articoloVariante, id_listino) > 0.0D) { + prezzo = prezzoBase; + } else { + prezzo = prezzoLisBase; + } + } else { + prezzo = prezzoBase; + } + } + return prezzo; + } + + public double getPrezzoOld(Articolo articolo) { + if (getId_listino() == 0L) + return articolo.getPrezzoPubblico(); + ListinoArticolo listinoArticolo = new ListinoArticolo(getApFull()); + listinoArticolo.findByArticoloListino(articolo.getId_articolo(), getId_listino()); + if (listinoArticolo.getId_listinoArticolo() > 0L) { + if (listinoArticolo.getPrezzoLA() > 0.0D) + return listinoArticolo.getPrezzoLA(); + if (getFlgTipoL() == 0L || listinoArticolo.getPercLA() == 0.0D) + return articolo.getPrezzoPubblico(); + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.add(listinoArticolo.getPercLA()); + pps.multiply(articolo.getCostoAcquistoUltimo()); + pps.divide(100.0F); + pps.setScale(2, 5); + return pps.getResult(); + } + if (getFlgTipoL() == 1L) { + double percRicarico = getPercL(); + ListinoTipo listinoTipo = new ListinoTipo(getApFull()); + listinoTipo.findByListinoTipo(getId_listino(), articolo.getId_tipo()); + if (listinoTipo.getId_listinoTipo() > 0L) + percRicarico = listinoTipo.getPercLT(); + if (percRicarico > 0.0D) { + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.add(percRicarico); + pps.multiply(articolo.getCostoAcquistoUltimo()); + pps.divide(100.0F); + pps.setScale(2, 5); + return pps.getResult(); + } + return articolo.getPrezzoPubblico(); + } + return articolo.getPrezzoPubblico(); + } + + public double getPrezzoOld(ArticoloVariante articoloVariante) { + if (getId_listino() == 0L) + return articoloVariante.getArticolo().getPrezzoPubblico(); + ListinoArticolo listinoArticolo = new ListinoArticolo(getApFull()); + listinoArticolo.findByArticoloVarianteListino(articoloVariante.getId_articoloVariante(), getId_listino()); + if (listinoArticolo.getId_listinoArticolo() > 0L) { + if (listinoArticolo.getPrezzoLA() > 0.0D) + return listinoArticolo.getPrezzoLA(); + if (getFlgTipoL() == 0L || listinoArticolo.getPercLA() == 0.0D) + return articoloVariante.getArticolo().getPrezzoPubblico(); + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.add(listinoArticolo.getPercLA()); + pps.multiply(articoloVariante.getArticolo().getCostoAcquistoUltimo()); + pps.divide(100.0F); + pps.setScale(2, 5); + return pps.getResult(); + } + return 0.0D; + } + + public PrezzoArticolo getPrezzoIva(ArticoloVariante articoloVariante) { + return getPrezzo(articoloVariante).conIva((double)articoloVariante.getArticolo().getIva().getAliquota()); + } + + public ListinoArticolo getListinoArticoloBase(Articolo articolo) { + if (getApFull() != null && articolo.getId_articolo() != 0L) { + ListinoArticolo listinoArticoloBase = new ListinoArticolo(getApFull()); + listinoArticoloBase.findByArticoloListino(articolo.getId_articolo(), dammiListinoBase(getApFull()).getId_listino()); + return listinoArticoloBase; + } + return null; + } + + public double getPercL1() { + return this.percL1; + } + + public double getPercL2() { + return this.percL2; + } + + public double getPercL3() { + return this.percL3; + } + + public void setPercL1(double percL1) { + this.percL1 = percL1; + } + + public void setPercL2(double percL2) { + this.percL2 = percL2; + } + + public void setPercL3(double percL3) { + this.percL3 = percL3; + } + + public String getDescrizionePercentuale() { + if (isPercentualiSconto3()) + return getNf2().format(getPercL1()) + " + " + getNf2().format(getPercL1()) + " + " + getNf2().format(getPercL2()) + " %"; + return getNf2().format(getPercL()) + " %"; + } + + public double getPercEffettiva() { + if (isPercentualiSconto3()) { + double perc = getPercL1(); + if (perc > 0.0D && + getPercL2() > 0.0D) { + perc = getSommaPercentuali(perc, getPercL2()); + if (getPercL3() > 0.0D) + perc = getSommaPercentuali(perc, getPercL3()); + } + return perc; + } + return getPercL(); + } + + public Vectumerator findNoListinoBase() { + String s_Sql_Find = "select A.* from LISTINO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.flgTipoL <> 99"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public static final Listino dammiListinoBase(ApplParmFull apFull) { + Listino bean = new Listino(apFull); + bean.findListinoBase(); + if (bean.getDBState() == 0) + bean.creaListinoBase(); + return bean; + } + + public static final double getSommaPercentuali(double perc1, double perc2) { + DoubleOperator dop = new DoubleOperator(100.0F); + dop.setScale(2, 5); + dop.subtract(perc1); + dop.multiply(perc2); + dop.divide(100.0F); + dop.add(perc1); + return dop.getResult(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoArticolo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoArticolo.java new file mode 100644 index 00000000..293bc9f7 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoArticolo.java @@ -0,0 +1,500 @@ +package it.acxent.anag; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloVariante; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.Vectumerator; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class ListinoArticolo extends _AnagAdapter { + private long id_listinoArticolo; + + private long id_listino; + + private long id_articolo; + + private long id_articoloVariante; + + private double prezzoLA; + + private Listino listino; + + private Articolo articolo; + + private ArticoloVariante articoloVariante; + + private double percLA; + + private double prezzoOffertaLA; + + private Date dataScadenzaOffertaLA; + + private double abbuonoPrezzoPubblicoLA; + + private Date dataCambiamentoPrezzoLA; + + private double prezzoLADb; + + private double prezzoConIvaLA; + + private double percLA1; + + private double percLA3; + + private double percLA2; + + private double percScontoOffertaLA; + + public ListinoArticolo(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ListinoArticolo() {} + + public long getId_listinoArticolo() { + return this.id_listinoArticolo; + } + + public void setId_listinoArticolo(long id_listinoArticolo) { + this.id_listinoArticolo = id_listinoArticolo; + } + + public long getId_listino() { + return this.id_listino; + } + + public void setId_listino(long id_listino) { + this.id_listino = id_listino; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + } + + public double getPrezzoLA() { + return Math.abs(this.prezzoLA); + } + + public double getPrezzoIvaLA() { + return DBAdapter.conIva(getPrezzoLA(), (double)getArticolo().getIva().getAliquota()); + } + + public PrezzoArticolo getPrezzoFinaleIvaLA() { + return getPrezzoFinaleLA().conIva((double)getArticolo().getIva().getAliquota()); + } + + public double getPrezzoIvaAbbuonoLA() { + DoubleOperator dp = new DoubleOperator(DBAdapter.conIva(getPrezzoLA(), (double)getArticolo().getIva().getAliquota())); + if (getListino().getFlgTipoL() == 99L) { + dp.subtract(getAbbuonoPrezzoPubblicoLA()); + dp.setScale(2, 5); + } + return dp.getResult(); + } + + public double getPrezzoScontatoLA() { + double perc = getPercEffettiva(); + if (perc != 0.0D) { + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.subtract(perc); + pps.multiply(getPrezzoLA()); + pps.divide(100.0F); + pps.setScale(2, 5); + return pps.getResult(); + } + return getPrezzoLA(); + } + + public PrezzoArticolo getPrezzoArticoloLA() { + return new PrezzoArticolo(getPrezzoLA(), 0.0D, getPrezzoLA(), 0.0D, 0.0D, 0.0D, 0.0D); + } + + public PrezzoArticolo getPrezzoArticoloIvaLA() { + return getPrezzoArticoloLA().conIva((double)getArticolo().getIva().getAliquota()); + } + + public PrezzoArticolo getPrezzoFinaleLA() { + if (getId_listino() > 0L) { + if (getListino().getFlgTipoL() == 99L) { + if (isOffertaValida()) { + PrezzoArticolo prezzoArticolo2 = new PrezzoArticolo(getPrezzoOffertaLA(), 0.0D, getPrezzoOffertaLA(), 0.0D, 0.0D, 0.0D, 0.0D); + prezzoArticolo2.setOfferta(true); + prezzoArticolo2.setDataScadenzaOfferta(getDataScadenzaOffertaLA()); + return prezzoArticolo2; + } + PrezzoArticolo prezzoArticolo1 = new PrezzoArticolo(getPrezzoLA(), getPercLA(), getPrezzoScontatoLA(), getPercLA1(), getPercLA2(), getPercLA3(), + getAbbuonoPrezzoPubblicoLA()); + return prezzoArticolo1; + } + if (isOffertaValida()) { + PrezzoArticolo prezzoArticolo1 = new PrezzoArticolo(getPrezzoOffertaLA(), 0.0D, getPrezzoOffertaLA(), 0.0D, 0.0D, 0.0D, 0.0D); + prezzoArticolo1.setOfferta(true); + prezzoArticolo1.setDataScadenzaOfferta(getDataScadenzaOffertaLA()); + return prezzoArticolo1; + } + double perc = getPercEffettiva(); + if (perc > 0.0D) { + if (getListino().getFlgTipoL() == 0L) { + double prezzobase = getArticolo().getPrezzoBase(); + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.subtract(perc); + pps.multiply(prezzobase); + pps.divide(100.0F); + pps.setScale(2, 5); + PrezzoArticolo prezzoArticolo2 = new PrezzoArticolo(prezzobase, getPercLA(), pps.getResult(), getPercLA1(), getPercLA2(), getPercLA3(), + getAbbuonoPrezzoPubblicoLA()); + return prezzoArticolo2; + } + if (getListino().getFlgTipoL() == 1L) { + if (this.articolo.getCostoAcquistoUltimo() > 0.0D) { + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.add(perc); + pps.multiply(getArticolo().getCostoAcquistoUltimo()); + pps.divide(100.0F); + pps.setScale(2, 5); + PrezzoArticolo prezzoArticolo3 = new PrezzoArticolo(0.0D, 0.0D, pps.getResult(), 0.0D, 0.0D, 0.0D, 0.0D); + return prezzoArticolo3; + } + PrezzoArticolo prezzoArticolo2 = new PrezzoArticolo(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + return prezzoArticolo2; + } + if (getListino().getFlgTipoL() == 2L) { + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.add(perc); + pps.multiply(getArticolo().getPrezzoBase()); + pps.divide(100.0F); + pps.setScale(2, 5); + PrezzoArticolo prezzoArticolo2 = new PrezzoArticolo(0.0D, 0.0D, pps.getResult(), 0.0D, 0.0D, 0.0D, 0.0D); + return prezzoArticolo2; + } + PrezzoArticolo prezzoArticolo1 = new PrezzoArticolo(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + return prezzoArticolo1; + } + PrezzoArticolo prezzoArticolo = new PrezzoArticolo(getPrezzoLA(), 0.0D, getPrezzoLA(), 0.0D, 0.0D, 0.0D, 0.0D); + return prezzoArticolo; + } + PrezzoArticolo pa = new PrezzoArticolo(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + return pa; + } + + public double getPercEffettiva() { + if (isPercentualiSconto3()) { + double perc = getPercLA1(); + if (perc > 0.0D && + getPercLA2() > 0.0D) { + perc = Listino.getSommaPercentuali(perc, getPercLA2()); + if (getPercLA3() > 0.0D) + perc = Listino.getSommaPercentuali(perc, getPercLA3()); + } + return perc; + } + return getPercLA(); + } + + public void setPrezzoLA(double prezzoLA) { + this.prezzoLA = prezzoLA; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante()); + return this.articoloVariante; + } + + public Listino getListino() { + this.listino = (Listino)getSecondaryObject(this.listino, Listino.class, getId_listino()); + return this.listino; + } + + public void findByArticoloListino(long id_articolo, long id_listino) { + String s_Sql_Find = "select A.* from LISTINO_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_listino=" + id_listino); + wc.addWc("A.id_articolo=" + id_articolo); + wc.addWc("(A.id_articoloVariante=0 OR A.id_articoloVariante IS NULL)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + if (getId_listinoArticolo() == 0L) { + setId_articolo(id_articolo); + setId_listino(id_listino); + } + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findPrezziByArticolo(long id_articolo) { + String s_Sql_Find = "select A.*, B.nome as b_nome from LISTINO_ARTICOLO AS A INNER JOIN ARTICOLO AS B ON A.id_articolo = B.id_articolo"; + String s_Sql_Order = " ORDER BY B.nome"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + id_articolo); + wc.addWc("(A.id_articoloVariante=0 OR A.id_articoloVariante IS NULL)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByArticoloVarianteListino(long id_articoloVariante, long id_listino) { + String s_Sql_Find = "select A.* from LISTINO_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_listino=" + id_listino); + wc.addWc("id_articoloVariante=" + id_articoloVariante); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findPrezziByArticoloVariante(long id_articoloVariante) { + String s_Sql_Find = "select A.* from LISTINO_ARTICOLO AS A INNER JOIN ARTICOLO_VARIANTE AS B ON A.id_articoloVariante = B.id_articoloVariante"; + String s_Sql_Order = " ORDER BY B.nomeV"; + WcString wc = new WcString(); + wc.addWc("A.id_articoloVariante=" + id_articoloVariante); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getPercLA() { + return this.percLA; + } + + public void setPercLA(double percLA) { + this.percLA = percLA; + } + + public Vectumerator findArticoliByListino(long id_listino, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from LISTINO_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_listino=" + id_listino); + wc.addWc("(A.id_articoloVariante=0 OR A.id_articoloVariante IS NULL)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findArticoliVarianteByListino(long id_listino, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from LISTINO_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_listino=" + id_listino); + wc.addWc("id_articoloVariante!=0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getPrezzoOffertaLA() { + return this.prezzoOffertaLA; + } + + public double getPrezzoOffertaIvaLA() { + return DBAdapter.conIva(getPrezzoOffertaLA(), (double)getArticolo().getIva().getAliquota()); + } + + public void setPrezzoOffertaLA(double prezzoOfferta) { + this.prezzoOffertaLA = prezzoOfferta; + } + + public Date getDataScadenzaOffertaLA() { + return this.dataScadenzaOffertaLA; + } + + public void setDataScadenzaOffertaLA(Date dataScadenzaOfferta) { + this.dataScadenzaOffertaLA = dataScadenzaOfferta; + } + + public boolean isOffertaValida() { + if (getDataScadenzaOffertaLA() == null || getDateDiff(getToday(), getDataScadenzaOffertaLA()) < 0L || getPrezzoOffertaLA() == 0.0D || + getPrezzoOffertaLA() >= getPrezzoLA()) + return false; + return true; + } + + public ResParm save() { + if (getId_listino() == 0L || getId_articolo() == 0L) + return new ResParm(false, "ERRORE! Impossibile salvare listino con riferimenti a listino o articolo nulli. id_listino=" + + getId_listino() + " id_articolo=" + getId_articolo()); + ResParm rp = super.save(); + if (rp.getStatus()) { + getArticolo().setDataScadenzaOfferta(getDataScadenzaOffertaLA()); + rp.append(getArticolo().superSave()); + } + return rp; + } + + public double getAbbuonoPrezzoPubblicoLA() { + return this.abbuonoPrezzoPubblicoLA; + } + + public double getAbbuonoPrezzoPubblicoLA(Clifor l_clifor) { + return this.abbuonoPrezzoPubblicoLA; + } + + public void setAbbuonoPrezzoPubblicoLA(double abbuonoPrezzoPubblico) { + this.abbuonoPrezzoPubblicoLA = abbuonoPrezzoPubblico; + } + + public Date getDataCambiamentoPrezzoLA() { + return this.dataCambiamentoPrezzoLA; + } + + public void setDataCambiamentoPrezzoLA(Date dataCambiamentoPrezzoLA) { + this.dataCambiamentoPrezzoLA = dataCambiamentoPrezzoLA; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + if (getPrezzoConIvaLA() != 0.0D) + setPrezzoLA(DBAdapter.scorporaIva(getPrezzoConIvaLA(), (double)getArticolo().getIva().getAliquota())); + if (getPrezzoLA() != getPrezzoLADb()) + setDataCambiamentoPrezzoLA(getToday()); + double costoNetto = getArticolo().getCostoNetto(); + if (getDateDiff(getToday(), getDataScadenzaOffertaLA()) >= 0L && getPercScontoOffertaLA() > 0.0D && costoNetto > 0.0D) { + double percRicaricoOfferta = getArticolo().getPercRicarico() - getPercScontoOffertaLA(); + if (percRicaricoOfferta < getParm("CC_RICARICO_MINIMO_OFFERTE").getNumero()) + percRicaricoOfferta = getParm("CC_RICARICO_MINIMO_OFFERTE").getNumero(); + DoubleOperator prNetto = new DoubleOperator(costoNetto); + prNetto.multiply(percRicaricoOfferta + 100.0D); + prNetto.divide(100.0F); + prNetto.setScale(2, 5); + double prPubblicoConIva = conIva(prNetto.getResult(), (double)getArticolo().getIva().getAliquota()); + if (prPubblicoConIva >= getParm("CC_ARROTONDA_PREZZO_A_EURO_SOPRA").getNumero()) { + prPubblicoConIva = arrotonda(prPubblicoConIva, 1.0D); + } else { + prPubblicoConIva = arrotonda(prPubblicoConIva, getParm("CC_ARROTONDA_DECIMALE_PER_PREZZI_BASSI").getNumero()); + } + setPrezzoOffertaLA(scorporaIva(prPubblicoConIva, (double)getArticolo().getIva().getAliquota())); + } + super.prepareSave(ps); + } + + protected void initFields() { + super.initFields(); + setPrezzoLADb(0.0D); + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + setPrezzoLADb(getPrezzoLA()); + } + + public double getPrezzoLADb() { + return this.prezzoLADb; + } + + public void setPrezzoLADb(double prezzLADb) { + this.prezzoLADb = prezzLADb; + } + + public double getPrezzoScontatoIvaLA() { + return DBAdapter.conIva(getPrezzoScontatoLA(), (double)getArticolo().getIva().getAliquota()); + } + + public double getPrezzoConIvaLA() { + return this.prezzoConIvaLA; + } + + public void setPrezzoConIvaLA(double prezzoConIvaLA) { + this.prezzoConIvaLA = prezzoConIvaLA; + } + + public boolean hasStessiValori(ListinoArticolo la) { + if (la.getPrezzoConIvaLA() != 0.0D && la.getPrezzoLA() == 0.0D) + la.setPrezzoLA(DBAdapter.scorporaIva(la.getPrezzoConIvaLA(), (double)getArticolo().getIva().getAliquota())); + if (getPrezzoConIvaLA() != 0.0D && getPrezzoLA() == 0.0D) + setPrezzoLA(DBAdapter.scorporaIva(getPrezzoConIvaLA(), (double)getArticolo().getIva().getAliquota())); + if (la.getPrezzoLA() != getPrezzoLA() || la.getPercLA() != getPercLA() || la.getPercLA1() != getPercLA1() || + la.getPercLA2() != getPercLA2() || la.getPercLA3() != getPercLA3() || la.getPrezzoOffertaLA() != getPrezzoOffertaLA() || + la.getDataScadenzaOffertaLA() != getDataScadenzaOffertaLA() || + la.getAbbuonoPrezzoPubblicoLA() != getAbbuonoPrezzoPubblicoLA()) + return false; + return true; + } + + public String getDescrizionePercentuale() { + if (isPercentualiSconto3()) + return getNf2().format(getPercLA1()) + " + " + getNf2().format(getPercLA1()) + " + " + getNf2().format(getPercLA2()) + " %"; + return getNf2().format(getPercLA()) + " %"; + } + + public double getPercLA1() { + return this.percLA1; + } + + public void setPercLA1(double percLA1) { + this.percLA1 = percLA1; + } + + public double getPercLA3() { + return this.percLA3; + } + + public void setPercLA3(double percLA3) { + this.percLA3 = percLA3; + } + + public double getPercLA2() { + return this.percLA2; + } + + public void setPercLA2(double percLA2) { + this.percLA2 = percLA2; + } + + public double getPercScontoOffertaLA() { + return this.percScontoOffertaLA; + } + + public void setPercScontoOffertaLA(double percScontoOffertaLA) { + this.percScontoOffertaLA = percScontoOffertaLA; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoArticoloCOPIA.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoArticoloCOPIA.java new file mode 100644 index 00000000..f187e273 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoArticoloCOPIA.java @@ -0,0 +1,446 @@ +package it.acxent.anag; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloVariante; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.Vectumerator; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; + +public class ListinoArticoloCOPIA extends _AnagAdapter { + private long id_listinoArticolo; + + private long id_listino; + + private long id_articolo; + + private long id_articoloVariante; + + private double prezzoLA; + + private Listino listino; + + private Articolo articolo; + + private ArticoloVariante articoloVariante; + + private double percLA; + + private double prezzoOffertaLA; + + private Date dataScadenzaOffertaLA; + + private double abbuonoPrezzoPubblicoLA; + + private Date dataCambiamentoPrezzoLA; + + private double prezzoLADb; + + private double prezzoConIvaLA; + + private double percLA1; + + private double percLA3; + + private double percLA2; + + public ListinoArticoloCOPIA(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ListinoArticoloCOPIA() {} + + public long getId_listinoArticolo() { + return this.id_listinoArticolo; + } + + public void setId_listinoArticolo(long id_listinoArticolo) { + this.id_listinoArticolo = id_listinoArticolo; + } + + public long getId_listino() { + return this.id_listino; + } + + public void setId_listino(long id_listino) { + this.id_listino = id_listino; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + } + + public double getPrezzoLA() { + if (getArticolo().getFlgNegativo() == 1L) + return -Math.abs(this.prezzoLA); + return Math.abs(this.prezzoLA); + } + + public double getPrezzoIvaLA() { + return DBAdapter.conIva(getPrezzoLA(), (double)getArticolo().getIva().getAliquota()); + } + + public PrezzoArticolo getPrezzoFinaleIvaLA() { + return getPrezzoFinaleLA().conIva((double)getArticolo().getIva().getAliquota()); + } + + public double getPrezzoIvaAbbuonoLA() { + DoubleOperator dp = new DoubleOperator(DBAdapter.conIva(getPrezzoLA(), (double)getArticolo().getIva().getAliquota())); + if (getListino().getFlgTipoL() == 99L) { + dp.subtract(getAbbuonoPrezzoPubblicoLA()); + dp.setScale(2, 5); + } + return dp.getResult(); + } + + public double getPrezzoScontatoLA() { + double perc = getPercEffettiva(); + if (perc != 0.0D) { + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.subtract(perc); + pps.multiply(getPrezzoLA()); + pps.divide(100.0F); + pps.setScale(2, 5); + return pps.getResult(); + } + return getPrezzoLA(); + } + + public PrezzoArticolo getPrezzoFinaleLA() { + if (getId_listino() > 0L) { + if (getListino().getFlgTipoL() == 99L) { + if (isOffertaValida()) { + PrezzoArticolo prezzoArticolo2 = new PrezzoArticolo(getPrezzoOffertaLA(), 0.0D, getPrezzoOffertaLA(), 0.0D, 0.0D, 0.0D, 0.0D); + prezzoArticolo2.setOfferta(true); + prezzoArticolo2.setDataScadenzaOfferta(getDataScadenzaOffertaLA()); + return prezzoArticolo2; + } + PrezzoArticolo prezzoArticolo1 = new PrezzoArticolo(getPrezzoLA(), getPercLA(), getPrezzoScontatoLA(), getPercLA1(), getPercLA2(), getPercLA3(), + getAbbuonoPrezzoPubblicoLA()); + return prezzoArticolo1; + } + if (isOffertaValida()) { + PrezzoArticolo prezzoArticolo1 = new PrezzoArticolo(getPrezzoOffertaLA(), 0.0D, getPrezzoOffertaLA(), 0.0D, 0.0D, 0.0D, 0.0D); + prezzoArticolo1.setOfferta(true); + prezzoArticolo1.setDataScadenzaOfferta(getDataScadenzaOffertaLA()); + return prezzoArticolo1; + } + double perc = getPercEffettiva(); + if (perc > 0.0D) { + if (getListino().getFlgTipoL() == 0L) { + double prezzobase = getArticolo().getPrezzoBase(); + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.subtract(perc); + pps.multiply(prezzobase); + pps.divide(100.0F); + pps.setScale(2, 5); + PrezzoArticolo prezzoArticolo2 = new PrezzoArticolo(prezzobase, getPercLA(), pps.getResult(), getPercLA1(), getPercLA2(), getPercLA3(), getAbbuonoPrezzoPubblicoLA()); + return prezzoArticolo2; + } + if (getListino().getFlgTipoL() == 0L) { + if (this.articolo.getCostoAcquistoUltimo() > 0.0D) { + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.add(perc); + pps.multiply(getArticolo().getCostoAcquistoUltimo()); + pps.divide(100.0F); + pps.setScale(2, 5); + PrezzoArticolo prezzoArticolo3 = new PrezzoArticolo(pps.getResult(), 0.0D, pps.getResult(), getPercLA1(), getPercLA2(), getPercLA3(), getAbbuonoPrezzoPubblicoLA()); + return prezzoArticolo3; + } + PrezzoArticolo prezzoArticolo2 = new PrezzoArticolo(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + return prezzoArticolo2; + } + PrezzoArticolo prezzoArticolo1 = new PrezzoArticolo(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + return prezzoArticolo1; + } + PrezzoArticolo prezzoArticolo = new PrezzoArticolo(getPrezzoLA(), 0.0D, getPrezzoLA(), 0.0D, 0.0D, 0.0D, 0.0D); + return prezzoArticolo; + } + PrezzoArticolo pa = new PrezzoArticolo(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + return pa; + } + + public double getPercEffettiva() { + if (isPercentualiSconto3()) { + double perc = getPercLA1(); + if (perc > 0.0D && + getPercLA2() > 0.0D) { + perc = Listino.getSommaPercentuali(perc, getPercLA2()); + if (getPercLA3() > 0.0D) + perc = Listino.getSommaPercentuali(perc, getPercLA3()); + } + return perc; + } + return getPercLA(); + } + + public void setPrezzoLA(double prezzoLA) { + this.prezzoLA = prezzoLA; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante()); + return this.articoloVariante; + } + + public Listino getListino() { + this.listino = (Listino)getSecondaryObject(this.listino, Listino.class, getId_listino()); + return this.listino; + } + + public void findByArticoloListino(long id_articolo, long id_listino) { + String s_Sql_Find = "select A.* from LISTINO_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_listino=" + id_listino); + wc.addWc("A.id_articolo=" + id_articolo); + wc.addWc("(A.id_articoloVariante=0 OR A.id_articoloVariante IS NULL)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findPrezziByArticolo(long id_articolo) { + String s_Sql_Find = "select A.* from LISTINO_ARTICOLO AS A INNER JOIN ARTICOLO AS B ON A.id_articolo = B.id_articolo"; + String s_Sql_Order = " ORDER BY B.nome"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + id_articolo); + wc.addWc("(A.id_articoloVariante=0 OR A.id_articoloVariante IS NULL)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByArticoloVarianteListino(long id_articoloVariante, long id_listino) { + String s_Sql_Find = "select A.* from LISTINO_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_listino=" + id_listino); + wc.addWc("id_articoloVariante=" + id_articoloVariante); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findPrezziByArticoloVariante(long id_articoloVariante) { + String s_Sql_Find = "select A.* from LISTINO_ARTICOLO AS A INNER JOIN ARTICOLO_VARIANTE AS B ON A.id_articoloVariante = B.id_articoloVariante"; + String s_Sql_Order = " ORDER BY B.nomeV"; + WcString wc = new WcString(); + wc.addWc("A.id_articoloVariante=" + id_articoloVariante); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getPercLA() { + return this.percLA; + } + + public void setPercLA(double percLA) { + this.percLA = percLA; + } + + public Vectumerator findArticoliByListino(long id_listino, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from LISTINO_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_listino=" + id_listino); + wc.addWc("(A.id_articoloVariante=0 OR A.id_articoloVariante IS NULL)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findArticoliVarianteByListino(long id_listino, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from LISTINO_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_listino=" + id_listino); + wc.addWc("id_articoloVariante!=0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getPrezzoOffertaLA() { + return this.prezzoOffertaLA; + } + + public double getPrezzoOffertaIvaLA() { + return DBAdapter.conIva(getPrezzoOffertaLA(), (double)getArticolo().getIva().getAliquota()); + } + + public void setPrezzoOffertaLA(double prezzoOfferta) { + this.prezzoOffertaLA = prezzoOfferta; + } + + public Date getDataScadenzaOffertaLA() { + return this.dataScadenzaOffertaLA; + } + + public void setDataScadenzaOffertaLA(Date dataScadenzaOfferta) { + this.dataScadenzaOffertaLA = dataScadenzaOfferta; + } + + public boolean isOffertaValida() { + if (getDateDiff(getToday(), getDataScadenzaOffertaLA()) < 0L || getPrezzoOffertaLA() == 0.0D) + return false; + return true; + } + + public ResParm save() { + if (getId_listino() == 0L || getId_articolo() == 0L) + return new ResParm(false, "ERRORE! Impossibile salvare listino con riferimenti a listino o articolo nulli. id_listino=" + + getId_listino() + " id_articolo=" + getId_articolo()); + return super.save(); + } + + public double getAbbuonoPrezzoPubblicoLA() { + return this.abbuonoPrezzoPubblicoLA; + } + + public double getAbbuonoPrezzoPubblicoLA(Clifor l_clifor) { + return this.abbuonoPrezzoPubblicoLA; + } + + public void setAbbuonoPrezzoPubblicoLA(double abbuonoPrezzoPubblico) { + this.abbuonoPrezzoPubblicoLA = abbuonoPrezzoPubblico; + } + + public Date getDataCambiamentoPrezzoLA() { + return this.dataCambiamentoPrezzoLA; + } + + public void setDataCambiamentoPrezzoLA(Date dataCambiamentoPrezzoLA) { + this.dataCambiamentoPrezzoLA = dataCambiamentoPrezzoLA; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + if (getPrezzoConIvaLA() != 0.0D) + setPrezzoLA(DBAdapter.scorporaIva(getPrezzoConIvaLA(), (double)getArticolo().getIva().getAliquota())); + if (getPrezzoLA() != getPrezzoLADb()) + setDataCambiamentoPrezzoLA(getToday()); + super.prepareSave(ps); + } + + protected void initFields() { + super.initFields(); + setPrezzoLADb(0.0D); + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + setPrezzoLADb(getPrezzoLA()); + } + + public double getPrezzoLADb() { + return this.prezzoLADb; + } + + public void setPrezzoLADb(double prezzLADb) { + this.prezzoLADb = prezzLADb; + } + + public double getPrezzoScontatoIvaLA() { + return DBAdapter.conIva(getPrezzoScontatoLA(), (double)getArticolo().getIva().getAliquota()); + } + + public double getPrezzoConIvaLA() { + return this.prezzoConIvaLA; + } + + public void setPrezzoConIvaLA(double prezzoConIvaLA) { + this.prezzoConIvaLA = prezzoConIvaLA; + } + + public boolean hasStessiValori(ListinoArticoloCOPIA la) { + if (la.getPrezzoConIvaLA() != 0.0D && la.getPrezzoLA() == 0.0D) + la.setPrezzoLA(DBAdapter.scorporaIva(la.getPrezzoConIvaLA(), (double)getArticolo().getIva().getAliquota())); + if (getPrezzoConIvaLA() != 0.0D && getPrezzoLA() == 0.0D) + setPrezzoLA(DBAdapter.scorporaIva(getPrezzoConIvaLA(), (double)getArticolo().getIva().getAliquota())); + if (la.getPrezzoLA() != getPrezzoLA() || la.getPercLA() != getPercLA() || la.getPercLA1() != getPercLA1() || + la.getPercLA2() != getPercLA2() || la.getPercLA3() != getPercLA3() || la.getPrezzoOffertaLA() != getPrezzoOffertaLA() || + la.getDataScadenzaOffertaLA() != getDataScadenzaOffertaLA() || + la.getAbbuonoPrezzoPubblicoLA() != getAbbuonoPrezzoPubblicoLA()) + return false; + return true; + } + + public String getDescrizionePercentuale() { + if (isPercentualiSconto3()) + return getNf2().format(getPercLA1()) + " + " + getNf2().format(getPercLA1()) + " + " + getNf2().format(getPercLA2()) + " %"; + return getNf2().format(getPercLA()) + " %"; + } + + public double getPercLA1() { + return this.percLA1; + } + + public void setPercLA1(double percLA1) { + this.percLA1 = percLA1; + } + + public double getPercLA3() { + return this.percLA3; + } + + public void setPercLA3(double percLA3) { + this.percLA3 = percLA3; + } + + public double getPercLA2() { + return this.percLA2; + } + + public void setPercLA2(double percLA2) { + this.percLA2 = percLA2; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoArticoloCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoArticoloCR.java new file mode 100644 index 00000000..57cfea94 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoArticoloCR.java @@ -0,0 +1,110 @@ +package it.acxent.anag; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloVariante; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class ListinoArticoloCR extends CRAdapter { + private long id_listinoArticolo; + + private long id_listino; + + private long id_articolo; + + private long id_articoloVariante; + + private double prezzoLA; + + private Listino listino; + + private Articolo articolo; + + private ArticoloVariante articoloVariante; + + private Date dataScadenzaOfferta; + + private double prezzoOfferta; + + public ListinoArticoloCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ListinoArticoloCR() {} + + public long getId_listinoArticolo() { + return this.id_listinoArticolo; + } + + public void setId_listinoArticolo(long id_listinoArticolo) { + this.id_listinoArticolo = id_listinoArticolo; + } + + public long getId_listino() { + return this.id_listino; + } + + public void setId_listino(long id_listino) { + this.id_listino = id_listino; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + } + + public double getPrezzoLA() { + return this.prezzoLA; + } + + public void setPrezzoLA(double prezzoLA) { + this.prezzoLA = prezzoLA; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + getId_articolo()); + return this.articolo; + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, + + getId_articoloVariante()); + return this.articoloVariante; + } + + public Listino getListino() { + this.listino = (Listino)getSecondaryObject(this.listino, Listino.class, + getId_listino()); + return this.listino; + } + + public Date getDataScadenzaOfferta() { + return this.dataScadenzaOfferta; + } + + public void setDataScadenzaOfferta(Date dataScadenzaOfferta) { + this.dataScadenzaOfferta = dataScadenzaOfferta; + } + + public double getPrezzoOfferta() { + return this.prezzoOfferta; + } + + public void setPrezzoOfferta(double prezzoOfferta) { + this.prezzoOfferta = prezzoOfferta; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoCR.java new file mode 100644 index 00000000..4437b99b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoCR.java @@ -0,0 +1,73 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Timestamp; + +public class ListinoCR extends CRAdapter { + private long id_listino; + + private long flgTipoL; + + private String descrizione; + + private double percL; + + private Timestamp lastUpdTmst; + + private long lastUpdId_user; + + public ListinoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ListinoCR() {} + + public void setId_listino(long newId_listino) { + this.id_listino = newId_listino; + } + + public void setFlgTipoL(long newFlgTipo) { + this.flgTipoL = newFlgTipo; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setPercL(double newPercL) { + this.percL = newPercL; + } + + public void setLastUpdTmst(Timestamp newLastUpdTmst) { + this.lastUpdTmst = newLastUpdTmst; + } + + public void setLastUpdId_user(long newLastUpdId_user) { + this.lastUpdId_user = newLastUpdId_user; + } + + public long getId_listino() { + return this.id_listino; + } + + public long getFlgTipoL() { + return this.flgTipoL; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public double getPercL() { + return this.percL; + } + + public Timestamp getLastUpdTmst() { + return this.lastUpdTmst; + } + + public long getLastUpdId_user() { + return this.lastUpdId_user; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoTipo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoTipo.java new file mode 100644 index 00000000..d7edb6b5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoTipo.java @@ -0,0 +1,315 @@ +package it.acxent.anag; + +import it.acxent.art.Articolo; +import it.acxent.art.Tipo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ListinoTipo extends _AnagAdapter implements Serializable { + private long id_listinoTipo; + + private long flgTipoLT; + + private double percLT; + + private long id_tipo; + + private long id_listino; + + private Tipo tipo; + + private Listino listino; + + private String indiciTipo; + + private double prezzoLT; + + private double percLT2; + + private double percLT3; + + private double percLT1; + + public ListinoTipo(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ListinoTipo() {} + + public void setId_listinoTipo(long newId_listinoTipo) { + this.id_listinoTipo = newId_listinoTipo; + } + + public void setFlgTipoLT(long newFlgTipoLT) { + this.flgTipoLT = newFlgTipoLT; + } + + public void setPercLT(double newPercLT) { + this.percLT = newPercLT; + } + + public void setId_tipo(long newId_tipo) { + this.id_tipo = newId_tipo; + setTipo(null); + } + + public void setId_listino(long newId_listino) { + this.id_listino = newId_listino; + setListino(null); + } + + public long getId_listinoTipo() { + return this.id_listinoTipo; + } + + public long getFlgTipoLT() { + return this.flgTipoLT; + } + + public double getPercLT() { + return this.percLT; + } + + public double getPercEffettiva() { + if (isPercentualiSconto3()) { + double perc = getPercLT1(); + if (perc > 0.0D && + getPercLT2() > 0.0D) { + perc = Listino.getSommaPercentuali(perc, getPercLT2()); + if (getPercLT3() > 0.0D) + perc = Listino.getSommaPercentuali(perc, getPercLT3()); + } + return perc; + } + return getPercLT(); + } + + public long getId_tipo() { + return this.id_tipo; + } + + public long getId_listino() { + return this.id_listino; + } + + public void setTipo(Tipo newTipo) { + this.tipo = newTipo; + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo()); + return this.tipo; + } + + public void setListino(Listino newListino) { + this.listino = newListino; + } + + public Listino getListino() { + this.listino = (Listino)getSecondaryObject(this.listino, Listino.class, getId_listino()); + return this.listino; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ListinoTipoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from LISTINO_TIPO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByListino(long l_id_listino, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from LISTINO_TIPO AS A "; + WcString wc = new WcString(); + wc.addWc("A.id_listino=" + l_id_listino); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getIndiciTipo() { + return (this.indiciTipo == null) ? "" : this.indiciTipo; + } + + public void setIndiciTipo(String indiciTipo) { + this.indiciTipo = indiciTipo; + } + + public ResParm save() { + setIndiciTipo(calcolaIndiciTipo()); + ResParm rp = super.save(); + return rp; + } + + protected String calcolaIndiciTipo() { + StringBuffer idx = new StringBuffer(":"); + idx.append(calcolaIndiciTipoR(getTipo())); + idx.append(":"); + return idx.toString(); + } + + private StringBuffer calcolaIndiciTipoR(Tipo l_tipo) { + StringBuffer idx = new StringBuffer(); + Vectumerator vec = l_tipo.findFigli(0, 0); + if (vec.hasMoreElements()) { + boolean first = true; + while (vec.hasMoreElements()) { + Tipo row = (Tipo)vec.nextElement(); + if (first) { + first = false; + } else { + idx.insert(0, ":"); + } + idx.insert(0, (CharSequence)calcolaIndiciTipoR(row)); + } + idx.insert(0, ":"); + idx.insert(0, l_tipo.getId_tipo()); + } else { + idx = new StringBuffer(String.valueOf(l_tipo.getId_tipo())); + } + return idx; + } + + public static final String getTipoListino(long l_flgTipo) { + return Listino.getTipoL(l_flgTipo); + } + + public void findByCliforTipo(long l_id_clifor, long l_id_tipo) { + String s_Sql_Find = "select A.* from LISTINO_PERS AS A , TIPO AS B"; + WcString wc = new WcString(); + wc.addWc("A.id_tipo=B.id_tipo"); + wc.addWc("A.id_clifor=" + l_id_clifor); + wc.addWc(" B.indici like'%:" + l_id_tipo + ":%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByListinoTipo(long l_id_listino, long l_id_tipo) { + String s_Sql_Find = "select A.* from LISTINO_TIPO AS A "; + WcString wc = new WcString(); + wc.addWc("A.id_listino=" + l_id_listino); + wc.addWc(" A.indiciTipo like'%:" + l_id_tipo + ":%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public double getPercLT1() { + return this.percLT1; + } + + public void setPercLT1(double percLT1) { + this.percLT1 = percLT1; + } + + public double getPercLT2() { + return this.percLT2; + } + + public void setPercLT2(double percLT2) { + this.percLT2 = percLT2; + } + + public double getPercLT3() { + return this.percLT3; + } + + public void setPercLT3(double percLT3) { + this.percLT3 = percLT3; + } + + public String getDescrizionePercentuale() { + if (isPercentualiSconto3()) + return getNf2().format(getPercLT1()) + " + " + getNf2().format(getPercLT1()) + " + " + getNf2().format(getPercLT2()) + " %"; + return getNf2().format(getPercLT()) + " %"; + } + + public double getPrezzoLT() { + return this.prezzoLT; + } + + public void setPrezzoLT(double prezzoLT) { + this.prezzoLT = prezzoLT; + } + + public PrezzoArticolo getPrezzoFinaleLT(Articolo articolo) { + if (getId_listinoTipo() > 0L) { + if (getListino().getFlgTipoL() == 99L) { + PrezzoArticolo prezzoArticolo1 = new PrezzoArticolo(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + return prezzoArticolo1; + } + double perc = getPercEffettiva(); + if (perc > 0.0D) { + if (getListino().getFlgTipoL() == 0L) { + double prezzobase = articolo.getPrezzoBase(); + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.subtract(perc); + pps.multiply(prezzobase); + pps.divide(100.0F); + pps.setScale(2, 5); + PrezzoArticolo prezzoArticolo2 = new PrezzoArticolo(prezzobase, getPercLT(), pps.getResult(), getPercLT1(), getPercLT2(), getPercLT3(), 0.0D); + return prezzoArticolo2; + } + if (getListino().getFlgTipoL() == 1L) { + if (articolo.getCostoAcquistoUltimo() > 0.0D) { + DoubleOperator pps = new DoubleOperator(100.0F); + pps.setScale(4, 5); + pps.add(perc); + pps.multiply(articolo.getCostoAcquistoUltimo()); + pps.divide(100.0F); + pps.setScale(2, 5); + PrezzoArticolo prezzoArticolo3 = new PrezzoArticolo(pps.getResult(), 0.0D, pps.getResult(), 0.0D, 0.0D, 0.0D, 0.0D); + return prezzoArticolo3; + } + PrezzoArticolo prezzoArticolo2 = new PrezzoArticolo(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + return prezzoArticolo2; + } + PrezzoArticolo prezzoArticolo1 = new PrezzoArticolo(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + return prezzoArticolo1; + } + PrezzoArticolo prezzoArticolo = new PrezzoArticolo(getPrezzoLT(), 0.0D, getPrezzoLT(), 0.0D, 0.0D, 0.0D, 0.0D); + return prezzoArticolo; + } + PrezzoArticolo pa = new PrezzoArticolo(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); + return pa; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoTipoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoTipoCR.java new file mode 100644 index 00000000..fc3c51ca --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ListinoTipoCR.java @@ -0,0 +1,91 @@ +package it.acxent.anag; + +import it.acxent.art.Tipo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ListinoTipoCR extends CRAdapter { + private long id_listinoTipo; + + private long flgTipoLT; + + private double percLT; + + private long id_tipo; + + private long id_listino; + + private Tipo tipo; + + private Listino listino; + + public ListinoTipoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ListinoTipoCR() {} + + public void setId_listinoTipo(long newId_listinoTipo) { + this.id_listinoTipo = newId_listinoTipo; + } + + public void setFlgTipoLT(long newFlgTipoLT) { + this.flgTipoLT = newFlgTipoLT; + } + + public void setPercLT(double newPercLT) { + this.percLT = newPercLT; + } + + public void setId_tipo(long newId_tipo) { + this.id_tipo = newId_tipo; + setTipo(null); + } + + public void setId_listino(long newId_listino) { + this.id_listino = newId_listino; + setListino(null); + } + + public long getId_listinoTipo() { + return this.id_listinoTipo; + } + + public long getFlgTipoLT() { + return this.flgTipoLT; + } + + public double getPercLT() { + return this.percLT; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public long getId_listino() { + return this.id_listino; + } + + public void setTipo(Tipo newTipo) { + this.tipo = newTipo; + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, + + getId_tipo()); + return this.tipo; + } + + public void setListino(Listino newListino) { + this.listino = newListino; + } + + public Listino getListino() { + this.listino = (Listino)getSecondaryObject(this.listino, Listino.class, + + getId_listino()); + return this.listino; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/MagFisico.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/MagFisico.java new file mode 100644 index 00000000..635d8af5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/MagFisico.java @@ -0,0 +1,299 @@ +package it.acxent.anag; + +import it.acxent.contab.CausaleMagazzino; +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class MagFisico extends _AnagAdapter implements Serializable { + private long id_magFisico; + + private String descrizione; + + private long id_clifor; + + private Clifor clifor; + + private long flgTipo; + + private long flgFineLavorazione; + + public static final long TIPO_MAGAZZINO_TUTTI = 0L; + + public static final long TIPO_MAGAZZINO_INTERNO = 1L; + + public static final long TIPO_MAGAZZINO_LAVORAZIONE = 2L; + + public static final long TIPO_MAGAZZINO_ORDINATO_A_FORNITORI = 3L; + + public static final long FINE_LAVORAZIONE_NO = 0L; + + public static final long FINE_LAVORAZIONE_SI = 1L; + + public MagFisico(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Vectumerator findByClifor(long l_id_clifor) { + String s_Sql_Find = "select A.* from MAG_FISICO AS A"; + String s_Sql_Order = " order by descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public MagFisico() {} + + public void setId_magFisico(long newId_magFisico) { + this.id_magFisico = newId_magFisico; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(MagFisicoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from MAG_FISICO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getTipo() { + return getTipo(getFlgTipo()); + } + + public void setFlgTipo(long flgInterno) { + this.flgTipo = flgInterno; + } + + public Vectumerator findByTipo(long l_flgTipo) { + String s_Sql_Find = "select A.* from MAG_FISICO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (l_flgTipo > 0L) + wc.addWc(" A.flgTipo = " + l_flgTipo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByCausalePartenza(CausaleMagazzino cm) { + String s_Sql_Find = "select A.* from MAG_FISICO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (cm.getId_magFisicoPartenza() > 0L) { + wc.addWc(" A.id_magFisico = " + cm.getId_magFisicoPartenza()); + } else if (cm.getFlgPartenzaInterno() == 1L && cm.getFlgPartenzaLavorazione() == 1L) { + wc.addWc("(A.flgTipo = 1 or A.flgTipo=2)"); + } else if (cm.getFlgPartenzaInterno() == 1L && cm.getFlgPartenzaLavorazione() == 0L) { + wc.addWc("A.flgTipo = 1"); + } else if (cm.getFlgPartenzaInterno() == 0L && cm.getFlgPartenzaLavorazione() == 1L) { + wc.addWc("A.flgTipo=2"); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByCausaleArrivo(CausaleMagazzino cm) { + String s_Sql_Find = "select A.* from MAG_FISICO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (cm.getId_magFisicoArrivo() > 0L) { + wc.addWc(" A.id_magFisico = " + cm.getId_magFisicoArrivo()); + } else if (cm.getFlgArrivoInterno() == 1L && cm.getFlgArrivoLavorazione() == 1L) { + wc.addWc("(A.flgTipo = 1 or A.flgTipo=2)"); + } else if (cm.getFlgArrivoInterno() == 1L && cm.getFlgArrivoLavorazione() == 0L) { + wc.addWc("A.flgTipo = 1"); + } else if (cm.getFlgArrivoInterno() == 0L && cm.getFlgArrivoLavorazione() == 1L) { + wc.addWc("A.flgTipo=2"); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public boolean isMagOrdinatoValorizzato() { + String s_Sql_Find = "select COUNT(*) as tot from MAG_FISICO AS A "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.flgTipo = 3"); + wc.addWc(" A.id_magFisico != " + getId_magFisico()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + long tot = getCount(stmt, "tot"); + if (tot > 0L) + return true; + return false; + } catch (SQLException e) { + handleDebug(e); + return false; + } + } + + public void findMagazzinoOrdinato() { + String s_Sql_Find = "select A.* from MAG_FISICO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.flgTipo = 3"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getDescrizioneCompleta() { + if (getDescrizione().isEmpty()) + return "Nessuno"; + return getDescrizione() + " " + getDescrizione(); + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public static final String getTipo(long l_flgTipo) { + switch ((int)l_flgTipo) { + case 1: + return "Interno"; + case 2: + return "Lavorazione"; + case 3: + return "Ordinato a Fornitori"; + } + return "??"; + } + + public long getFlgFineLavorazione() { + return this.flgFineLavorazione; + } + + public void setFlgFineLavorazione(long flgFineLavorazione) { + this.flgFineLavorazione = flgFineLavorazione; + } + + public static final String getFineLavorazione(long l_flgFineLavorazione) { + switch ((int)l_flgFineLavorazione) { + case 0: + return "No (solo prelievo)"; + case 1: + return "Si (scarico e prelievo)"; + } + return "??"; + } + + public String getFineLavorazione() { + return getFineLavorazione(getFlgFineLavorazione()); + } + + public String getHtmlTableHeaderInterni() { + Vectumerator vec = findByTipo(1L); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + MagFisico row = (MagFisico)vec.nextElement(); + sb.append(""); + sb.append(row.getDescrizione()); + sb.append(""); + } + return sb.toString(); + } + + public String getHtmlTableHeaderInterniVuoti() { + Vectumerator vec = findByTipo(1L); + StringBuilder sb = new StringBuilder(); + sb.append(" "); + sb.append(""); + return sb.toString(); + } + + public String getDescrizioneTipo() { + StringBuilder sb = new StringBuilder(getTipo()); + if (getFlgTipo() == 2L) { + sb.append(" "); + sb.append("-"); + sb.append(" "); + sb.append("Fine lav: "); + sb.append(getFineLavorazione()); + sb.append(" "); + sb.append("-"); + sb.append(" "); + sb.append(getClifor().getCognomeNome()); + } + return sb.toString().trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/MagFisicoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/MagFisicoCR.java new file mode 100644 index 00000000..a0114d02 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/MagFisicoCR.java @@ -0,0 +1,90 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class MagFisicoCR extends CRAdapter { + private long id_magFisico; + + private String descrizione; + + private long id_clifor; + + private Clifor clifor; + + private long flgTipo; + + private long flgFineLavorazione; + + public MagFisicoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public MagFisicoCR() {} + + public void setId_magFisico(long newId_magFisico) { + this.id_magFisico = newId_magFisico; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public String getTipo() { + return MagFisico.getTipo(getFlgTipo()); + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public void setFlgTipo(long flgTipo) { + this.flgTipo = flgTipo; + } + + public String getFineLavorazione() { + return MagFisico.getFineLavorazione(getFlgFineLavorazione()); + } + + public static final String getFineLavorazione(long l_flgFineLavorazione) { + return MagFisico.getFineLavorazione(l_flgFineLavorazione); + } + + public long getFlgFineLavorazione() { + return this.flgFineLavorazione; + } + + public void setFlgFineLavorazione(long flgFineLavorazione) { + this.flgFineLavorazione = flgFineLavorazione; + } + + public static final String getTipo(long l_flgTipo) { + return MagFisico.getTipo(l_flgTipo); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/MeseEscluso.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/MeseEscluso.java new file mode 100644 index 00000000..2314e0f4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/MeseEscluso.java @@ -0,0 +1,108 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class MeseEscluso extends _AnagAdapter implements Serializable { + private static final long serialVersionUID = 3164023737083124440L; + + private long id_meseEscluso; + + private long id_tipoPagamento; + + private long meseEscluso; + + private long giornoEscluso; + + private TipoPagamento tipoPagamento; + + public MeseEscluso(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public MeseEscluso() {} + + public void setId_meseEscluso(long newId_vettore) { + this.id_meseEscluso = newId_vettore; + } + + public long getId_meseEscluso() { + return this.id_meseEscluso; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(MeseEsclusoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from MESE_ESCLUSO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_tipoPagamento() > 0L) + wc.addWc(" A.id_tipoPagamento = " + CR.getId_tipoPagamento()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_tipoPagamento() { + return this.id_tipoPagamento; + } + + public void setId_tipoPagamento(long id_tipoPagamento) { + this.id_tipoPagamento = id_tipoPagamento; + setTipoPagamento(null); + } + + public long getMeseEscluso() { + return this.meseEscluso; + } + + public void setMeseEscluso(long meseEscluso) { + this.meseEscluso = meseEscluso; + } + + public long getGiornoEscluso() { + return this.giornoEscluso; + } + + public void setGiornoEscluso(long giornoEscluso) { + this.giornoEscluso = giornoEscluso; + } + + public TipoPagamento getTipoPagamento() { + this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, getId_tipoPagamento()); + return this.tipoPagamento; + } + + public void setTipoPagamento(TipoPagamento tipoPagamento) { + this.tipoPagamento = tipoPagamento; + } + + public String getDescrizioneMese() { + return getDescrizioneMese(getMeseEscluso()); + } + + public String getDescrizioneMese(long id_mese) { + return MONTH_DES[(int)id_mese - 1]; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/MeseEsclusoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/MeseEsclusoCR.java new file mode 100644 index 00000000..1926090c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/MeseEsclusoCR.java @@ -0,0 +1,63 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class MeseEsclusoCR extends CRAdapter { + private long id_meseEscluso; + + private long id_tipoPagamento; + + private long meseEscluso; + + private long giornoEscluso; + + private TipoPagamento tipoPagamento; + + public MeseEsclusoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public MeseEsclusoCR() {} + + public void setId_meseEscluso(long newId_vettore) { + this.id_meseEscluso = newId_vettore; + } + + public long getId_meseEscluso() { + return this.id_meseEscluso; + } + + public long getId_tipoPagamento() { + return this.id_tipoPagamento; + } + + public void setId_tipoPagamento(long id_tipoPagamento) { + this.id_tipoPagamento = id_tipoPagamento; + } + + public long getMeseEscluso() { + return this.meseEscluso; + } + + public void setMeseEscluso(long meseEscluso) { + this.meseEscluso = meseEscluso; + } + + public long getGiornoEscluso() { + return this.giornoEscluso; + } + + public void setGiornoEscluso(long giornoEscluso) { + this.giornoEscluso = giornoEscluso; + } + + public TipoPagamento getTipoPagamento() { + this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, getId_tipoPagamento()); + return this.tipoPagamento; + } + + public void setTipoPagamento(TipoPagamento tipoPagamento) { + this.tipoPagamento = tipoPagamento; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Nazione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Nazione.java new file mode 100644 index 00000000..cd089f0c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Nazione.java @@ -0,0 +1,402 @@ +package it.acxent.anag; + +import it.acxent.cart.Cart; +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.Locale; + +public class Nazione extends _AnagAdapter implements Serializable { + private static final String MESSAGGIO_IMPORTO_MINIMO = "messaggioImportoMinimo"; + + private static final long serialVersionUID = 1282454814109856597L; + + public static final String CODICE_IT = "IT"; + + private String id_nazione; + + private String lang; + + private String descrizione_en; + + private String descrizione_it; + + private String codiceIstat; + + private long flgCee; + + private double costoSpedizione; + + private long flgAttiva; + + private String codice; + + private String descrizioneInLingua; + + private long flgGoogleMerchant; + + private long flgPreventivoWww; + + private long id_iva; + + private Iva iva; + + private double importoMinimoWww; + + private String tag; + + private String prefissoTel; + + public Nazione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Nazione() {} + + public void setId_nazione(String newId_nazione) { + this.id_nazione = newId_nazione; + } + + public void setLang(String newId_lingua) { + this.lang = newId_lingua; + } + + public void setFlgCee(long newFlgCee) { + this.flgCee = newFlgCee; + } + + public String getId_nazione() { + return (this.id_nazione == null) ? "" : this.id_nazione.trim(); + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang.trim(); + } + + public String getDescrizioneCompleta() { + return getDescrizione_it().trim(); + } + + public long getFlgCee() { + return this.flgCee; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(NazioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from NAZIONE AS A"; + String s_Sql_Order = " order by descrizione_it"; + if (CR.getLang().equals("en")) { + s_Sql_Order = " order by descrizione_en"; + } else { + s_Sql_Order = " order by descrizione_it"; + } + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione_it like '%" + token + "%' or A.descrizione_en like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getFlgAttivaS() == 0L) { + wc.addWc("(A.flgAttiva is null or A.flgAttiva=0)"); + } else if (CR.getFlgAttivaS() == 1L) { + wc.addWc("A.flgAttiva = 1"); + } + if (CR.getFlgCeeS() == 0L) { + wc.addWc("(A.flgCee is null or A.flgCee=0)"); + } else if (CR.getFlgCeeS() == 1L) { + wc.addWc("A.flgCee = 1"); + } + if (CR.getFlgGoogleMerchantS() == 0L) { + wc.addWc("(A.flgGoogleMerchant is null or A.flgGoogleMerchant=0)"); + } else if (CR.getFlgGoogleMerchantS() == 1L) { + wc.addWc("A.flgGoogleMerchant = 1"); + } + if (CR.getFlgPreventivoWwwS() == 0L) { + wc.addWc("(A.flgPreventivoWww is null or A.flgPreventivoWww=0)"); + } else if (CR.getFlgPreventivoWwwS() == 1L) { + wc.addWc("A.flgPreventivoWww = 1"); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public static final String getCee(long l_flgCee) { + switch ((int)l_flgCee) { + case -1: + return " "; + case 0: + return "Extra Cee"; + case 1: + return "Cee"; + } + return "??"; + } + + public String getCee() { + return getCee(getFlgCee()); + } + + public String getAttiva() { + return (this.flgAttiva == 0L) ? "N" : "S"; + } + + public double getCostoSpedizione() { + return this.costoSpedizione; + } + + public void setCostoSpedizione(double costoSpedizione) { + this.costoSpedizione = costoSpedizione; + } + + public long getFlgAttiva() { + return this.flgAttiva; + } + + public void setFlgAttiva(long flgAttiva) { + this.flgAttiva = flgAttiva; + } + + public String getCodice() { + return (this.codice == null) ? getId_nazione() : this.codice.trim(); + } + + public void setCodice(String codice) { + this.codice = codice; + } + + public String getCodiceIstat() { + return (this.codiceIstat == null) ? "" : this.codiceIstat.trim(); + } + + public void setCodiceIstat(String codiceIstat) { + this.codiceIstat = codiceIstat; + } + + public String getDescrizione(String lang) { + if (lang.equals(Locale.ITALIAN.getLanguage())) + return getDescrizione_it(); + return getDescrizione_en(); + } + + public boolean useDescLangTables() { + return false; + } + + public void findByCodice(String l_codice) { + String s_Sql_Find = "select A.* from NAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice='" + l_codice + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findAllAttiveGoogle(String lang) { + String s_Sql_Find = "select A.* from NAZIONE AS A"; + String s_Sql_Order = ""; + if (lang.equals("en")) { + s_Sql_Order = " order by descrizione_en"; + } else { + s_Sql_Order = " order by descrizione_it"; + } + WcString wc = new WcString(); + wc.addWc("A.flgAttiva=1"); + wc.addWc("A.flgGoogleMerchant=1"); + wc.addWc("(A.flgPreventivoWww is null or A.flgPreventivoWww=0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findAll(String lang) { + String s_Sql_Find = "select A.* from NAZIONE AS A"; + String s_Sql_Order = ""; + if (lang.equals("en")) { + s_Sql_Order = " order by descrizione_en"; + } else { + s_Sql_Order = " order by descrizione_it"; + } + WcString wc = new WcString(); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizioneCompleta(String lang) { + if (getFlgPreventivoWww() == 0L) + return getDescrizione(lang); + return getDescrizione(lang) + " *"; + } + + protected String sqlStringfindAll() { + return "select * from NAZIONE order by descrizione_it"; + } + + public String getDescrizioneInLingua() { + return (this.descrizioneInLingua == null || this.descrizioneInLingua.isEmpty()) ? getDescrizione_it() : this.descrizioneInLingua.trim(); + } + + public void setDescrizioneInLingua(String descrizioneInLingua) { + this.descrizioneInLingua = descrizioneInLingua; + } + + public double getCostoSpedizioneConIva() { + return conIva(getCostoSpedizione(), getParm(Cart.P_DELIVERY_IVA_ALIQUOTA).getNumeroDouble()); + } + + public long getFlgGoogleMerchant() { + return this.flgGoogleMerchant; + } + + public void setFlgGoogleMerchant(long flgGoogleMerchant) { + this.flgGoogleMerchant = flgGoogleMerchant; + } + + public long getFlgPreventivoWww() { + return this.flgPreventivoWww; + } + + public void setFlgPreventivoWww(long flgPreventivoWww) { + this.flgPreventivoWww = flgPreventivoWww; + } + + public long getId_iva() { + return this.id_iva; + } + + public void setId_iva(long id_iva) { + this.id_iva = id_iva; + setIva(null); + } + + public Iva getIva() { + this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, new Long(getId_iva())); + return this.iva; + } + + public void setIva(Iva iva) { + this.iva = iva; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + System.out.println(getDescTxtLang("descrizione", Locale.ITALIAN.getLanguage()) + " - " + getDescTxtLang("descrizione", Locale.ITALIAN.getLanguage())); + super.prepareSave(ps); + if (getFlgCee() == 0L) + setId_iva(0L); + } + + public double getImportoMinimoWww() { + return this.importoMinimoWww; + } + + public void setImportoMinimoWww(double importoMinimoWww) { + this.importoMinimoWww = importoMinimoWww; + } + + public String getMessaggioImportoMinimo(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("messaggioImportoMinimo", l_lang); + } + + public boolean checkCart(Cart cart) { + if (getImportoMinimoWww() <= 0.0D) + return true; + if (cart.getTotCartVAT() < getImportoMinimoWww()) + return false; + return true; + } + + public String getTag() { + if (this.tag == null) + return ""; + this.tag = this.tag.trim(); + if (!this.tag.startsWith(",")) + this.tag = "," + this.tag; + if (!this.tag.endsWith(",")) + this.tag += ","; + if (this.tag.equals(",")) + return ""; + return this.tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public String getDescrizione_en() { + return (this.descrizione_en == null) ? "" : this.descrizione_en; + } + + public void setDescrizione_en(String descrizioneEn) { + this.descrizione_en = descrizioneEn; + } + + public String getDescrizione_it() { + return (this.descrizione_it == null) ? "" : this.descrizione_it.trim(); + } + + public void setDescrizione_it(String descrizioneIt) { + this.descrizione_it = descrizioneIt; + } + + public String getPrefissoTel() { + if (this.prefissoTel == null) + return ""; + if (!this.prefissoTel.trim().startsWith("+")) + return "+" + this.prefissoTel.trim(); + return this.prefissoTel.trim(); + } + + public void setPrefissoTel(String prefissoTel) { + this.prefissoTel = prefissoTel; + } + + public Vectumerator findAllAttive(String lang) { + String s_Sql_Find = "select A.* from NAZIONE AS A"; + String s_Sql_Order = ""; + if (lang.equals("en")) { + s_Sql_Order = " order by descrizione_en"; + } else { + s_Sql_Order = " order by descrizione_it"; + } + WcString wc = new WcString(); + wc.addWc("A.flgAttiva=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/NazioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/NazioneCR.java new file mode 100644 index 00000000..94e0fc71 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/NazioneCR.java @@ -0,0 +1,80 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class NazioneCR extends CRAdapter { + private long id_nazione; + + private long flgCeeS = -1L; + + private String id_lingua; + + private long flgAttivaS = -1L; + + private long flgGoogleMerchantS = -1L; + + private long flgPreventivoWwwS = -1L; + + public NazioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public NazioneCR() {} + + public void setId_nazione(long newId_nazione) { + this.id_nazione = newId_nazione; + } + + public void setFlgCeeS(long newFlgCee) { + this.flgCeeS = newFlgCee; + } + + public long getId_nazione() { + return this.id_nazione; + } + + public long getFlgCeeS() { + return this.flgCeeS; + } + + public String getId_lingua() { + return (this.id_lingua == null) ? AB_EMPTY_STRING : this.id_lingua.trim(); + } + + public void setId_lingua(String newId_lingua) { + this.id_lingua = newId_lingua; + } + + public long getFlgAttivaS() { + return this.flgAttivaS; + } + + public void setFlgAttivaS(long flgAttivaS) { + this.flgAttivaS = flgAttivaS; + } + + public static final String getCeeS(long l_flgCee) { + return Nazione.getCee(l_flgCee); + } + + public String getCeeS() { + return Nazione.getCee(getFlgCeeS()); + } + + public long getFlgGoogleMerchantS() { + return this.flgGoogleMerchantS; + } + + public void setFlgGoogleMerchantS(long flgGoogleMerchant) { + this.flgGoogleMerchantS = flgGoogleMerchant; + } + + public long getFlgPreventivoWwwS() { + return this.flgPreventivoWwwS; + } + + public void setFlgPreventivoWwwS(long flgPreventivoWwwS) { + this.flgPreventivoWwwS = flgPreventivoWwwS; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Ottoxmille.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Ottoxmille.java new file mode 100644 index 00000000..89a35245 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Ottoxmille.java @@ -0,0 +1,73 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Ottoxmille extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1684937946550L; + + private long id_ottoxmille; + + private String descrizione; + + public Ottoxmille(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Ottoxmille() {} + + public void setId_ottoxmille(long newId_ottoxmille) { + this.id_ottoxmille = newId_ottoxmille; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_ottoxmille() { + return this.id_ottoxmille; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(OttoxmilleCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from OTTOXMILLE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/OttoxmilleCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/OttoxmilleCR.java new file mode 100644 index 00000000..4a68162e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/OttoxmilleCR.java @@ -0,0 +1,32 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class OttoxmilleCR extends CRAdapter { + private long id_ottoxmille; + + private String descrizione; + + public OttoxmilleCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public OttoxmilleCR() {} + + public void setId_ottoxmille(long newId_ottoxmille) { + this.id_ottoxmille = newId_ottoxmille; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_ottoxmille() { + return this.id_ottoxmille; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Porto.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Porto.java new file mode 100644 index 00000000..d76da5f4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Porto.java @@ -0,0 +1,75 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Porto extends _AnagAdapter implements Serializable { + private long id_porto; + + private String descrizione; + + private String nota; + + public Porto(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Porto() {} + + public void setId_porto(long newId_porto) { + this.id_porto = newId_porto; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setNota(String newNota) { + this.nota = newNota; + } + + public long getId_porto() { + return this.id_porto; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getNota() { + return (this.nota == null) ? "" : this.nota.trim(); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(PortoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from PORTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/PortoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/PortoCR.java new file mode 100644 index 00000000..f831720b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/PortoCR.java @@ -0,0 +1,42 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class PortoCR extends CRAdapter { + private long id_porto; + + private String descrizione; + + private String nota; + + public PortoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public PortoCR() {} + + public void setId_porto(long newId_porto) { + this.id_porto = newId_porto; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setNota(String newNota) { + this.nota = newNota; + } + + public long getId_porto() { + return this.id_porto; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getNota() { + return (this.nota == null) ? "" : this.nota.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Postazione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Postazione.java new file mode 100644 index 00000000..ef77b8ec --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Postazione.java @@ -0,0 +1,84 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Postazione extends it.acxent.common.Postazione implements Serializable { + private static final long serialVersionUID = -8882732861262606524L; + + private long id_regCassa; + + private RegCassa regCassa; + + public Postazione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Postazione() {} + + public void setId_regCassa(long newId_regCassa) { + this.id_regCassa = newId_regCassa; + setRegCassa(null); + } + + public long getId_regCassa() { + return this.id_regCassa; + } + + public void setRegCassa(RegCassa newRegCassa) { + this.regCassa = newRegCassa; + } + + public RegCassa getRegCassa() { + this.regCassa = (RegCassa)getSecondaryObject(this.regCassa, RegCassa.class, + getId_regCassa()); + return this.regCassa; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(PostazioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from POSTAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByIp(String l_ip) { + String s_Sql_Find = "select A.* from POSTAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.ipAddress='" + l_ip + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/PostazioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/PostazioneCR.java new file mode 100644 index 00000000..7a75f2dc --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/PostazioneCR.java @@ -0,0 +1,34 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; + +public class PostazioneCR extends it.acxent.common.PostazioneCR { + private long id_regCassa; + + private RegCassa regCassa; + + public PostazioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public PostazioneCR() {} + + public void setId_regCassa(long newId_regCassa) { + this.id_regCassa = newId_regCassa; + setRegCassa(null); + } + + public long getId_regCassa() { + return this.id_regCassa; + } + + public void setRegCassa(RegCassa newRegCassa) { + this.regCassa = newRegCassa; + } + + public RegCassa getRegCassa() { + this.regCassa = (RegCassa)getSecondaryObject(this.regCassa, RegCassa.class, + getId_regCassa()); + return this.regCassa; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/PrezzoArticolo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/PrezzoArticolo.java new file mode 100644 index 00000000..8dd4fcd6 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/PrezzoArticolo.java @@ -0,0 +1,123 @@ +package it.acxent.anag; + +import it.acxent.db.DBAdapter; +import it.acxent.util.DoubleOperator; +import java.sql.Date; + +public class PrezzoArticolo { + private double prezzoBase; + + private double percSconto; + + private double prezzoFinale; + + private long id_clifor; + + private boolean isOfferta; + + private Date dataScadenzaOfferta; + + private double percSconto1; + + private double percSconto3; + + private double percSconto2; + + private double abbuono; + + public PrezzoArticolo() {} + + public PrezzoArticolo(double prezzoBase, double percSconto, double prezzoFinale, double percSconto1, double percSconto2, double percSconto3, double abbuono) { + this.prezzoBase = prezzoBase; + this.percSconto = percSconto; + this.percSconto1 = percSconto1; + this.percSconto2 = percSconto2; + this.percSconto3 = percSconto3; + this.prezzoFinale = prezzoFinale; + this.abbuono = abbuono; + } + + public double getPercSconto() { + return this.percSconto; + } + + public void setPercSconto(double percSconto) { + this.percSconto = percSconto; + } + + public double getPrezzoFinale() { + return this.prezzoFinale; + } + + public PrezzoArticolo conIva(double l_aliquota) { + DoubleOperator prezzoFinale = new DoubleOperator(DBAdapter.conIva(getPrezzoFinale(), l_aliquota)); + if (getAbbuono() != 0.0D) + prezzoFinale.subtract(getAbbuono()); + return new PrezzoArticolo(DBAdapter.conIva(getPrezzoBase(), l_aliquota), getPercSconto(), prezzoFinale.getResult(), + getPercSconto1(), getPercSconto2(), getPercSconto3(), getAbbuono()); + } + + public double getPrezzoBase() { + return this.prezzoBase; + } + + public void setPrezzoBase(double prezzoBase) { + this.prezzoBase = prezzoBase; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + } + + public boolean isOfferta() { + return this.isOfferta; + } + + public void setOfferta(boolean isOfferta) { + this.isOfferta = isOfferta; + } + + public Date getDataScadenzaOfferta() { + return this.dataScadenzaOfferta; + } + + public void setDataScadenzaOfferta(Date dataScadenzaOfferta) { + this.dataScadenzaOfferta = dataScadenzaOfferta; + } + + public double getPercSconto1() { + return this.percSconto1; + } + + public void setPercSconto1(double percSconto1) { + this.percSconto1 = percSconto1; + } + + public double getPercSconto3() { + return this.percSconto3; + } + + public void setPercSconto3(double percSconto3) { + this.percSconto3 = percSconto3; + } + + public double getPercSconto2() { + return this.percSconto2; + } + + public void setPercSconto2(double percSconto2) { + this.percSconto2 = percSconto2; + } + + public double getAbbuono() { + return this.abbuono; + } + + public void setAbbuono(double abbuono) { + this.abbuono = abbuono; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/RegCassa.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/RegCassa.java new file mode 100644 index 00000000..8c7ee8a0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/RegCassa.java @@ -0,0 +1,112 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class RegCassa extends _AnagAdapter implements Serializable { + private long flgTipoCassa; + + private String descrizione; + + private String ipCassa; + + private long porta; + + private long id_regCassa; + + public static final long TIPO_CASSA_SIEMENS = 0L; + + public static final long TIPO_CASSA_EPSON = 1L; + + public RegCassa(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RegCassa() {} + + public void setId_regCassa(long newId_regCassa) { + this.id_regCassa = newId_regCassa; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setIpCassa(String newIpCassa) { + this.ipCassa = newIpCassa; + } + + public void setPorta(long newPorta) { + this.porta = newPorta; + } + + public long getId_regCassa() { + return this.id_regCassa; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : + this.descrizione.trim(); + } + + public String getIpCassa() { + return (this.ipCassa == null) ? "" : this.ipCassa.trim(); + } + + public long getPorta() { + return this.porta; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(RegCassaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from REG_CASSA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgTipoCassa() { + return this.flgTipoCassa; + } + + public void setFlgTipoCassa(long flgTipoCassa) { + this.flgTipoCassa = flgTipoCassa; + } + + public static final String getTipoCassa(long l_flgTipoCassa) { + if (l_flgTipoCassa == 0L) + return "Siemens"; + if (l_flgTipoCassa == 1L) + return "Epson"; + return "??"; + } + + public String getTipoCassa() { + return getTipoCassa(getFlgTipoCassa()); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/RegCassaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/RegCassaCR.java new file mode 100644 index 00000000..4adab0bd --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/RegCassaCR.java @@ -0,0 +1,52 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class RegCassaCR extends CRAdapter { + private long id_regCassa; + + private String descrizione; + + private String ipCassa; + + private long porta; + + public RegCassaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RegCassaCR() {} + + public void setId_regCassa(long newId_regCassa) { + this.id_regCassa = newId_regCassa; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setIpCassa(String newIpCassa) { + this.ipCassa = newIpCassa; + } + + public void setPorta(long newPorta) { + this.porta = newPorta; + } + + public long getId_regCassa() { + return this.id_regCassa; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getIpCassa() { + return (this.ipCassa == null) ? "" : this.ipCassa.trim(); + } + + public long getPorta() { + return this.porta; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Regione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Regione.java new file mode 100644 index 00000000..01198532 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Regione.java @@ -0,0 +1,66 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Regione extends _AnagAdapter implements Serializable { + private static final long serialVersionUID = 8182997964401040060L; + + private String id_regione; + + private String descrizione; + + public Regione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Regione() {} + + public void setId_regione(String newId_regione) { + this.id_regione = newId_regione; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public String getId_regione() { + return (this.id_regione == null) ? "" : this.id_regione.trim(); + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(RegioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from REGIONE AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/RegioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/RegioneCR.java new file mode 100644 index 00000000..bcd6dfcb --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/RegioneCR.java @@ -0,0 +1,32 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class RegioneCR extends CRAdapter { + private String id_regione; + + private String descrizione; + + public RegioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RegioneCR() {} + + public void setId_regione(String newId_regione) { + this.id_regione = newId_regione; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public String getId_regione() { + return (this.id_regione == null) ? "" : this.id_regione.trim(); + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Rubrica.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Rubrica.java new file mode 100644 index 00000000..e89c30c3 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Rubrica.java @@ -0,0 +1,36 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.util.Vectumerator; + +public class Rubrica extends Clifor { + private static final long serialVersionUID = 1085261265605689583L; + + private long id_rubrica; + + public Rubrica() {} + + public Rubrica(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public String getTableBeanName() { + return "CLIFOR"; + } + + public String getFlgTipo() { + return "R"; + } + + public Vectumerator findByCR(RubricaCR CR, int pageNumber, int pageRows) { + return findByCR(CR, pageNumber, pageRows); + } + + public long getId_rubrica() { + return getId_clifor(); + } + + public void setId_rubrica(long id_rubrica) { + setId_clifor(id_rubrica); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/RubricaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/RubricaCR.java new file mode 100644 index 00000000..3898a807 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/RubricaCR.java @@ -0,0 +1,25 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; + +public class RubricaCR extends CliforCR { + private long id_cliente; + + public RubricaCR() {} + + public RubricaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public String getFlgTipo() { + return "R"; + } + + public long getId_cliente() { + return getId_clifor(); + } + + public void setId_cliente(long id_cliente) { + setId_clifor(id_cliente); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoAllegatoClifor.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoAllegatoClifor.java new file mode 100644 index 00000000..32240c08 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoAllegatoClifor.java @@ -0,0 +1,69 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoAllegatoClifor extends _AnagAdapter implements Serializable { + private long id_tipoAllegatoClifor; + + private String descrizione; + + public TipoAllegatoClifor(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoAllegatoClifor() {} + + public void setId_tipoAllegatoClifor(long newId_tipoAllegatoClifor) { + this.id_tipoAllegatoClifor = newId_tipoAllegatoClifor; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoAllegatoClifor() { + return this.id_tipoAllegatoClifor; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : + this.descrizione.trim(); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoAllegatoCliforCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_ALLEGATO_CLIFOR AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (CR.getId_tipoAllegatoCliforS() > 0L) + wc.addWc("A.id_tipoAllegatoClifor > " + CR.getId_tipoAllegatoCliforS()); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%' )"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoAllegatoCliforCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoAllegatoCliforCR.java new file mode 100644 index 00000000..f3fdb185 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoAllegatoCliforCR.java @@ -0,0 +1,32 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoAllegatoCliforCR extends CRAdapter { + private long id_tipoAllegatoCliforS; + + private String descrizione; + + public TipoAllegatoCliforCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoAllegatoCliforCR() {} + + public void setId_tipoAllegatoCliforS(long newId_tipoAllegatoClifor) { + this.id_tipoAllegatoCliforS = newId_tipoAllegatoClifor; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoAllegatoCliforS() { + return this.id_tipoAllegatoCliforS; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoClifor.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoClifor.java new file mode 100644 index 00000000..5f3b7480 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoClifor.java @@ -0,0 +1,175 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoClifor extends _AnagAdapter implements Serializable { + private static final long serialVersionUID = -8580769150946613128L; + + public static final long TIPOLOGIA_FOR_NESSUNO = 0L; + + public static final long TIPOLOGIA_FOR_AGENTE = 1L; + + public static final long TIPOLOGIA_FOR_PROGETTISTA = 2L; + + public static final long TIPOLOGIA_FOR_RESP_COMMERCIALE = 3L; + + public static final long TIPOLOGIA_FOR_RESP_PRODUZIONE = 4L; + + public static final long TIPOLOGIA_FOR_TEX_TESSITURA = 20L; + + public static final long TIPOLOGIA_FOR_TEX_TINTORIA = 21L; + + public static final long TIPOLOGIA_FOR_TEX_RIFINIZIONE = 22L; + + public static final long TIPOLOGIA_FOR_TEX_ACCOPPIATURA = 23L; + + public static final long TIPOLOGIA_FOR_AGENTE_E_RESP_COMM = 101L; + + public static final long TIPOLOGIA_FOR_AGENTE_RESP_COMM_PROG = 102L; + + private long id_tipoClifor; + + private String descrizione; + + private String flgTipo; + + private long flgTipologia; + + private long flgProvvCliente; + + private long flgProvvArticolo; + + public TipoClifor(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoClifor() {} + + public void setId_tipoClifor(long newId_causaleMagazzino) { + this.id_tipoClifor = newId_causaleMagazzino; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoClifor() { + return this.id_tipoClifor; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoCliforCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_CLIFOR AS A"; + String s_Sql_Order = " order by A.flgTipo,A.descrizione"; + WcString wc = new WcString(); + if (!CR.getFlgTipoS().isEmpty()) + wc.addWc(" A.flgTipo = '" + CR.getFlgTipoS() + "' "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getFlgTipo() { + return (this.flgTipo == null) ? "" : this.flgTipo; + } + + public void setFlgTipo(String flgTipo) { + this.flgTipo = flgTipo; + } + + public long getFlgTipologia() { + return this.flgTipologia; + } + + public static final String getTipologia(long l_flgTipologia) { + switch ((int)l_flgTipologia) { + case 1: + return "Agente"; + case 2: + return "Progettista"; + case 3: + return "Responsabile Commerciale"; + case 4: + return "Responsabile Produzione"; + case 22: + return "Rifinizione"; + case 20: + return "Tessitura"; + case 21: + return "Tintoria"; + case 23: + return "Accoppiatura"; + } + return ""; + } + + public String getTipologia() { + return getTipologia(getFlgTipologia()); + } + + public void setFlgTipologia(long flgAgente) { + this.flgTipologia = flgAgente; + } + + public String getDescrizioneTipologia(long l_id) { + if (getFlgTipo().equals("C")) + return "--"; + String ret = ""; + if (l_id == 0L) { + ret = "Nessuna"; + } else if (l_id == 1L) { + ret = "Agente"; + } else if (l_id == 2L) { + ret = "Progettista"; + } else if (l_id == 3L) { + ret = "Resp. Commerciale"; + } else if (l_id == 4L) { + ret = "Resp. Produzione"; + } + return ret; + } + + public Vectumerator findByTipo(String l_flgTipo) { + String s_Sql_Find = "select A.* from TIPO_CLIFOR AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + wc.addWc(" A.flgTipo = '" + l_flgTipo + "' "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgProvvCliente() { + return this.flgProvvCliente; + } + + public void setFlgProvvCliente(long flgProvvCliente) { + this.flgProvvCliente = flgProvvCliente; + } + + public long getFlgProvvArticolo() { + return this.flgProvvArticolo; + } + + public void setFlgProvvArticolo(long flgProvvArticolo) { + this.flgProvvArticolo = flgProvvArticolo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoCliforCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoCliforCR.java new file mode 100644 index 00000000..ee921275 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoCliforCR.java @@ -0,0 +1,54 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.io.Serializable; + +public class TipoCliforCR extends CRAdapter implements Serializable { + private long id_tipoClifor; + + private String descrizioneS; + + private String flgTipoS; + + private long flgTipologiaS; + + public TipoCliforCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoCliforCR() {} + + public void setId_tipoClifor(long newId_causaleMagazzino) { + this.id_tipoClifor = newId_causaleMagazzino; + } + + public void setDescrizioneS(String newDescrizione) { + this.descrizioneS = newDescrizione; + } + + public long getId_tipoClifor() { + return this.id_tipoClifor; + } + + public String getDescrizioneS() { + return (this.descrizioneS == null) ? "" : + this.descrizioneS.trim(); + } + + public String getFlgTipoS() { + return (this.flgTipoS == null) ? AB_EMPTY_STRING : this.flgTipoS; + } + + public long getFlgTipologiaS() { + return this.flgTipologiaS; + } + + public void setFlgTipoS(String flgTipo) { + this.flgTipoS = flgTipo; + } + + public void setFlgTipologiaS(long flgAgente) { + this.flgTipologiaS = flgAgente; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoContratto.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoContratto.java new file mode 100644 index 00000000..a9be5b5a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoContratto.java @@ -0,0 +1,132 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoContratto extends _AnagAdapter implements Serializable { + private long id_tipoContratto; + + private String messaggioSms; + + private Date dataFineValiditaContratto; + + private long durataMesi; + + private long flgPrepagato; + + private String descrizione; + + private long ggInvioMsg; + + public TipoContratto(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoContratto() {} + + public void setId_tipoContratto(long newId_tipoContratto) { + this.id_tipoContratto = newId_tipoContratto; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setDataFineValiditaContratto(Date newDataFineValiditaContratto) { + this.dataFineValiditaContratto = newDataFineValiditaContratto; + } + + public void setDurataMesi(long newMesiRinnovo) { + this.durataMesi = newMesiRinnovo; + } + + public long getId_tipoContratto() { + return this.id_tipoContratto; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : + this.descrizione.trim(); + } + + public Date getDataFineValiditaContratto() { + return this.dataFineValiditaContratto; + } + + public long getDurataMesi() { + return this.durataMesi; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoContrattoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_CONTRATTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public static String getPrepagato(long l_flgPrepagato) { + switch ((int)l_flgPrepagato) { + case 1: + return "Prepagato"; + case 2: + return "Contratto"; + } + return "??"; + } + + public void setFlgPrepagato(long flgPrepagato) { + this.flgPrepagato = flgPrepagato; + } + + public long getFlgPrepagato() { + return this.flgPrepagato; + } + + public String getPrepagato() { + return getPrepagato(getFlgPrepagato()); + } + + public String getMessaggioSms() { + return (this.messaggioSms == null) ? "" : this.messaggioSms.trim(); + } + + public void setMessaggioSms(String messaggioSms) { + this.messaggioSms = messaggioSms; + } + + public long getGgInvioMsg() { + return this.ggInvioMsg; + } + + public void setGgInvioMsg(long ggInvioMsg) { + this.ggInvioMsg = ggInvioMsg; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoContrattoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoContrattoCR.java new file mode 100644 index 00000000..ccdec3a0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoContrattoCR.java @@ -0,0 +1,74 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; +import java.sql.Timestamp; + +public class TipoContrattoCR extends CRAdapter { + private long id_tipoContratto; + + private String descrizione; + + private Date dataFineValiditaContratto; + + private long durataMesi; + + private long lastUpdId_user; + + private Timestamp lastUpdTmst; + + public TipoContrattoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoContrattoCR() {} + + public void setId_tipoContratto(long newId_tipoContratto) { + this.id_tipoContratto = newId_tipoContratto; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setDataFineValiditaContratto(Date newDataFineValiditaContratto) { + this.dataFineValiditaContratto = newDataFineValiditaContratto; + } + + public void setDurataMesi(long newMesiRinnovo) { + this.durataMesi = newMesiRinnovo; + } + + public void setLastUpdId_user(long newLastUpdId_user) { + this.lastUpdId_user = newLastUpdId_user; + } + + public void setLastUpdTmst(Timestamp newLastUpdTmst) { + this.lastUpdTmst = newLastUpdTmst; + } + + public long getId_tipoContratto() { + return this.id_tipoContratto; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public Date getDataFineValiditaContratto() { + return this.dataFineValiditaContratto; + } + + public long getDurataMesi() { + return this.durataMesi; + } + + public long getLastUpdId_user() { + return this.lastUpdId_user; + } + + public Timestamp getLastUpdTmst() { + return this.lastUpdTmst; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoGlossario.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoGlossario.java new file mode 100644 index 00000000..0c736941 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoGlossario.java @@ -0,0 +1,83 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoGlossario extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1695626744400L; + + private long id_tipoGlossario; + + private String codice; + + private String descrizione; + + public TipoGlossario(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoGlossario() {} + + public void setId_tipoGlossario(long newId_tipoGlossario) { + this.id_tipoGlossario = newId_tipoGlossario; + } + + public void setCodice(String newCodice) { + this.codice = newCodice; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoGlossario() { + return this.id_tipoGlossario; + } + + public String getCodice() { + return (this.codice == null) ? "" : this.codice.trim(); + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoGlossarioCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_GLOSSARIO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoGlossarioCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoGlossarioCR.java new file mode 100644 index 00000000..797ff9c8 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoGlossarioCR.java @@ -0,0 +1,44 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoGlossarioCR extends CRAdapter { + private static final long serialVersionUID = -4811961982357118183L; + + private long id_tipoGlossario; + + private String codice; + + private String descrizione; + + public TipoGlossarioCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoGlossarioCR() {} + + public void setId_tipoGlossario(long newId_tipoGlossario) { + this.id_tipoGlossario = newId_tipoGlossario; + } + + public void setCodice(String newCodice) { + this.codice = newCodice; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoGlossario() { + return this.id_tipoGlossario; + } + + public String getCodice() { + return (this.codice == null) ? "" : this.codice.trim(); + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoPagamento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoPagamento.java new file mode 100644 index 00000000..faf838f6 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoPagamento.java @@ -0,0 +1,855 @@ +package it.acxent.anag; + +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoScadenza; +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.Calendar; + +public class TipoPagamento extends _AnagAdapter implements Serializable, AddImgInterface { + private static final long serialVersionUID = 1807466847085865884L; + + public static final String PATH_IMG = "_img/_imgTipoPagamento/"; + + private long id_tipoPagamento; + + private long ordineWww; + + private long periodicita; + + private String codiceTenderCassa; + + private long flgTipoPagamento; + + private long flgAbilitatoCorriere; + + private long giornoFisso; + + private long primaRata; + + private long nRate; + + private String descrizione_it; + + private long flgWww; + + private long flgAbilitatoNegozio; + + private long flgAbilitatoStranieri; + + private long codiceCassaEpson; + + private long flgPrimaScadenza; + + private long flgTipoPagamentoEcommerce; + + private double tariffaAggiuntiva; + + private double percWwwSconto; + + private double percWwwCommissione; + + private double wwwCommissionePercDefault; + + private double wwwTariffaFissa; + + private double wwwValoreSoglia; + + private double wwwPercOltreSoglia; + + private String codicePagamentoExport; + + private long flgNoFermopoint; + + private static TipoPagamento tipoPagamentoAmazon; + + private static TipoPagamento tipoPagamentoEbay; + + private static TipoPagamento tipoPagamentoPaypal; + + private static TipoPagamento tipoPagamentoStripe; + + public static final long PRIMA_SCADENZA_FINE_MESE = 1L; + + public static final long PRIMA_SCADENZA_DATA_FATTURA = 2L; + + public static final long TP_RIBA = 1L; + + public static final long TP_BONIFICO = 2L; + + public static final long TP_RIM_DIRETTA = 3L; + + public static final long TP_DIFFERITO = 4L; + + public static final long TP_CC = 5L; + + public static final long WWW_NO_WWW = 0L; + + public static final long WWW_SOLO_WWW = 1L; + + public static final long WWW_ENTRAMBI_WWW = 2L; + + public static final long TP_WWW_NESSUNO = 0L; + + public static final long TP_WWW_PAYPAL = 1L; + + public static final long TP_WWW_SELLA = 2L; + + public static final long TP_WWW_STRIPE = 3L; + + public static final long TP_WWW_PAYPAL_PLUS_STRIPE = 4L; + + public static final long TP_WWW_EBAY = 99L; + + public static final long TP_WWW_AMAZON = 98L; + + public TipoPagamento(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoPagamento() {} + + public void setId_tipoPagamento(long newId_tipoPagamento) { + this.id_tipoPagamento = newId_tipoPagamento; + } + + public void setPeriodicita(long newPeriodicita) { + this.periodicita = newPeriodicita; + } + + @Deprecated + public void setDescrizione_it(String newDescrizione_it) { + this.descrizione_it = newDescrizione_it; + } + + public void setFlgTipoPagamento(long newFlgTipoPagamento) { + this.flgTipoPagamento = newFlgTipoPagamento; + } + + public void setFlgPrimaScadenza(long newFlgPrimaScadenza) { + this.flgPrimaScadenza = newFlgPrimaScadenza; + } + + public void setGiornoFisso(long newGiornoFisso) { + this.giornoFisso = newGiornoFisso; + } + + public void setPrimaRata(long newPrimaRata) { + this.primaRata = newPrimaRata; + } + + public void setNRate(long newNRate) { + this.nRate = newNRate; + } + + public long getId_tipoPagamento() { + return this.id_tipoPagamento; + } + + public long getPeriodicita() { + return this.periodicita; + } + + public String getDescrizioneTipo() { + String temp = getTipoPagamento() + " " + getTipoPagamento() + getPrimaScadenza(); + if (getNRate() > 1L) + temp = temp + " per " + temp + " rate ogni " + getNRate(); + if (getGiornoFisso() > 0L) + temp = temp + " al " + temp + " del mese"; + return temp; + } + + @Deprecated + public String getDescrizione_it() { + return getDescrizione("it"); + } + + public long getFlgTipoPagamento() { + return this.flgTipoPagamento; + } + + public String getPeriodicitaDesc() { + return getPeriodicitaDesc(getPeriodicita()); + } + + public static final String getPrimaScadenza(long l_flgPrimaScadenza) { + switch ((int)l_flgPrimaScadenza) { + case 2: + return "Data Fattura"; + case 1: + return "Fine Mese"; + } + return "??"; + } + + public String getPrimaScadenza() { + return getPrimaScadenza(getFlgPrimaScadenza()); + } + + public String getTipoPagamento() { + return getTipoPagamento(getFlgTipoPagamento()); + } + + public long getFlgPrimaScadenza() { + return this.flgPrimaScadenza; + } + + public long getGiornoFisso() { + return this.giornoFisso; + } + + public long getPrimaRata() { + return this.primaRata; + } + + public long getNRate() { + return (this.nRate == 0L) ? 1L : this.nRate; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoPagamentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_PAGAMENTO AS A"; + String s_Sql_Order = " order by A.descrizione_it "; + if (CR.getFlgOrderBy() == TipoPagamentoCR.ORDER_BY_ORDINEWWW) + s_Sql_Order = " order by A.ordineWww, A.descrizione_it "; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + s_Sql_Find = "select A.* , B.descrizione from TIPO_PAGAMENTO AS A left JOIN DESC_TXT_LANG AS B ON A.id_tipoPagamento = B.idTabella AND B.tabella = 'TIPO_PAGAMENTO' AND B.campo = 'descrizione' "; + s_Sql_Order = " order by B.descrizione "; + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(B.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getFlgTipoPagamento() > 0L) + wc.addWc("A.flgTipoPagamento=" + CR.getFlgTipoPagamento()); + if (CR.getFlgWww() == 0L) { + wc.addWc("(A.flgWww is null or A.flgWww=0)"); + } else if (CR.getFlgWww() > 0L) { + wc.addWc("A.flgWww=" + CR.getFlgWww()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getCodiceTenderCassa() { + return (this.codiceTenderCassa == null) ? "" : this.codiceTenderCassa.trim(); + } + + public void setCodiceTenderCassa(String codiceTenderCassa) { + this.codiceTenderCassa = codiceTenderCassa; + } + + public Vectumerator findCodiciTender() { + String s_Sql_Find = "select A.* from TIPO_PAGAMENTO AS A"; + String s_Sql_Order = " order by A.codiceTenderCassa"; + WcString wc = new WcString(); + wc.addWc("A.codiceTenderCassa is not null"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizione(int l_length) { + return subString(getDescrizione(), l_length); + } + + public static final String getPeriodicitaDesc(long l_periodicita) { + switch ((int)l_periodicita) { + case 0: + return "Nessuna"; + case 1: + return "30 gg"; + case 2: + return "60 gg"; + case 3: + return "90 gg"; + case 4: + return "120 gg"; + } + return "??"; + } + + public static final String getTipoPagamento(long l_flgTipoPagamento) { + switch ((int)l_flgTipoPagamento) { + case 2: + return "Bonifico"; + case 1: + return "Ric. Banc."; + case 3: + return "Rim. Diretta"; + case 4: + return "Differito"; + case 5: + return "Carta di Credito"; + } + return "??"; + } + + public long getFlgWww() { + return this.flgWww; + } + + public void setFlgWww(long flgWww) { + this.flgWww = flgWww; + } + + public void findPagamentoByTipoPagamentoEcommerce(long l_flgTipoPagamentoEcommerce) { + String s_Sql_Find = "select A.* from TIPO_PAGAMENTO AS A "; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.flgTipoPagamentoEcommerce=" + l_flgTipoPagamentoEcommerce); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findPagamentiWww(boolean l_isStraniero, boolean noFermoPont) { + String s_Sql_Find = "select distinct A.* from TIPO_PAGAMENTO AS A left JOIN DESC_TXT_LANG AS B ON A.id_tipoPagamento = B.idTabella AND B.tabella = 'TIPO_PAGAMENTO' AND B.campo = 'descrizione' "; + String s_Sql_Order = " order by B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.flgWww>=1"); + if (!l_isStraniero) { + wc.addWc("(A.flgAbilitatoStranieri is null or A.flgAbilitatoStranieri =0 or A.flgAbilitatoStranieri =1) "); + } else { + wc.addWc("(A.flgAbilitatoStranieri is null or A.flgAbilitatoStranieri =0 or A.flgAbilitatoStranieri =2) "); + } + if (noFermoPont) + wc.addWc("(A.flgNoFermopoint is null or A.flgNoFermopoint =0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findPagamentiWwwByClifor(long l_id_clifor) { + String s_Sql_Find = "select distinct A.* from TIPO_PAGAMENTO AS A inner join CLIFOR_TIPO_PAGAMENTO as C on C.id_tipoPagamento=A.id_tipoPagamento left JOIN DESC_TXT_LANG AS B ON A.id_tipoPagamento = B.idTabella AND B.tabella = 'TIPO_PAGAMENTO' AND B.campo = 'descrizione' "; + String s_Sql_Order = " order by B.descrizione"; + WcString wc = new WcString(); + wc.addWc("C.id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getWww() { + return getWww(getFlgWww()); + } + + public static final String getWww(long l_flgWww) { + switch ((int)l_flgWww) { + case 0: + return "No Www"; + case 1: + return "Solo Www"; + case 2: + return "Sempre"; + } + return "??"; + } + + public long getFlgAbilitatoCorriere() { + return this.flgAbilitatoCorriere; + } + + public void setFlgAbilitatoCorriere(long flgAbilitatoCorriere) { + this.flgAbilitatoCorriere = flgAbilitatoCorriere; + } + + public long getFlgAbilitatoNegozio() { + return this.flgAbilitatoNegozio; + } + + public void setFlgAbilitatoNegozio(long flgAbilitatoNegozio) { + this.flgAbilitatoNegozio = flgAbilitatoNegozio; + } + + public boolean useDescLangTables() { + return true; + } + + public String getDescrizione() { + return getDescrizione("it"); + } + + public String getDescrizione(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizione", lang); + } + + public String getMsgMailProcedi(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("msgMailProcedi", lang); + } + + public String getMsgMailAspetta(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("msgMailAspetta", lang); + } + + public long getCodiceCassaEpson() { + return this.codiceCassaEpson; + } + + public void setCodiceCassaEpson(long codiceCassaEpson) { + this.codiceCassaEpson = codiceCassaEpson; + } + + public Vectumerator getMesiEsclusi() { + MeseEsclusoCR CR = new MeseEsclusoCR(getApFull()); + MeseEscluso meseEscluso = new MeseEscluso(getApFull()); + CR.setId_tipoPagamento(getId_tipoPagamento()); + return meseEscluso.findByCR(CR, 0, 0); + } + + public int getMesiPrimaRata() { + DoubleOperator dp = new DoubleOperator((float)getPrimaRata()); + dp.divide(30.0F); + return (int)dp.getResult(); + } + + public Vectumerator getScadenzeDocumento(long id_documento) { + DocumentoScadenza dp = new DocumentoScadenza(getApFull()); + DoubleOperator dop = new DoubleOperator(); + DoubleOperator totaleRate = new DoubleOperator(); + Calendar cal = Calendar.getInstance(); + Calendar calBasePrimaRata = Calendar.getInstance(); + Vectumerator vec = new Vectumerator(); + Documento bean = new Documento(getApFull()); + bean.findByPrimaryKey(id_documento); + double totaleDaPagare = bean.getTotaleDocumento(); + if (bean.getClifor().getFlgSplitPayment() == 1L) + totaleDaPagare = bean.getImponibileTotale(); + if (bean.getTipoPagamento().getFlgTipoPagamento() == 1L || + bean.getTipoPagamento().getFlgTipoPagamento() == 2L || + bean.getTipoPagamento().getFlgTipoPagamento() == 3L) { + Vectumerator vecme = bean.getTipoPagamento().getMesiEsclusi(); + dop.add(totaleDaPagare); + dop.divide((float)bean.getTipoPagamento().getNRate()); + dop.setScale(2, 5); + cal.setTime(bean.getDataDocumento()); + if (bean.getTipoPagamento().getFlgPrimaScadenza() == 1L) { + cal.set(5, 1); + cal.add(2, 1); + cal.add(6, -1); + } + if (bean.getTipoPagamento().getMesiPrimaRata() > 0) { + cal.set(5, 1); + cal.add(2, bean.getTipoPagamento().getMesiPrimaRata() + 1); + cal.add(6, -1); + } + calBasePrimaRata.setTimeInMillis(cal.getTimeInMillis()); + if (bean.getTipoPagamento().getGiornoFisso() > 0L) { + cal.add(5, 1); + cal.set(5, (int)bean.getTipoPagamento().getGiornoFisso()); + } + long giorniEscluso = isMeseEscluso(vecme, cal); + if (giorniEscluso > -1L) { + cal.add(2, 1); + cal.set(5, (int)giorniEscluso); + } + dp = new DocumentoScadenza(getApFull()); + dp.setDataScadenza(new Date(cal.getTimeInMillis())); + dp.setImportoScadenza(dop.getResult()); + totaleRate.add(dop.getResult()); + dp.setId_documento(id_documento); + vec.add(dp); + for (int i = 0; (long)i < bean.getTipoPagamento().getNRate() - 1L; i++) { + cal.setTimeInMillis(calBasePrimaRata.getTimeInMillis()); + if (bean.getTipoPagamento().getFlgPrimaScadenza() == 1L) { + cal.set(5, 1); + cal.add(2, (int)bean.getTipoPagamento().getPeriodicita() + 1); + cal.add(6, -1); + } else { + cal.add(2, (int)bean.getTipoPagamento().getPeriodicita()); + } + calBasePrimaRata.setTimeInMillis(cal.getTimeInMillis()); + if (bean.getTipoPagamento().getGiornoFisso() > 0L) { + cal.add(5, 1); + cal.set(5, (int)bean.getTipoPagamento().getGiornoFisso()); + } + giorniEscluso = isMeseEscluso(vecme, cal); + if (giorniEscluso > -1L) { + cal.add(2, 1); + cal.set(5, (int)giorniEscluso); + } + dp = new DocumentoScadenza(getApFull()); + dp.setDataScadenza(new Date(cal.getTimeInMillis())); + if ((long)i == bean.getTipoPagamento().getNRate() - 2L) { + DoubleOperator rataFinale = new DoubleOperator(totaleDaPagare); + rataFinale.subtract(totaleRate.getResult()); + rataFinale.setScale(2, 5); + dp.setImportoScadenza(rataFinale.getResult()); + } else { + dp.setImportoScadenza(dop.getResult()); + totaleRate.add(dop.getResult()); + } + dp.setId_documento(id_documento); + vec.add(dp); + } + } else { + dp = new DocumentoScadenza(getApFull()); + dp.setDataScadenza(bean.getDataDocumento()); + dp.setImportoScadenza(totaleDaPagare); + dp.setId_documento(id_documento); + vec.add(dp); + } + return vec; + } + + private long isMeseEscluso(Vectumerator vec, Calendar cal) { + long ret = -1L; + vec.moveFirst(); + while (vec.hasMoreElements()) { + MeseEscluso m = (MeseEscluso)vec.nextElement(); + if ((long)(cal.get(2) + 1) == m.getMeseEscluso()) { + ret = m.getGiornoEscluso(); + break; + } + } + return ret; + } + + public Vectumerator getScadenzeDocumentoOld(long id_documento) { + DocumentoScadenza dp = new DocumentoScadenza(getApFull()); + DoubleOperator dop = new DoubleOperator(); + Calendar cal = Calendar.getInstance(); + Vectumerator vec = new Vectumerator(); + Documento bean = new Documento(getApFull()); + bean.findByPrimaryKey(id_documento); + if (bean.getTipoPagamento().getFlgTipoPagamento() == 1L) { + Vectumerator vecme = bean.getTipoPagamento().getMesiEsclusi(); + dop.add(bean.getTotaleDocumento()); + dop.divide((float)bean.getTipoPagamento().getNRate()); + cal.setTime(bean.getDataDocumento()); + if (bean.getTipoPagamento().getFlgPrimaScadenza() == 1L) { + cal.set(5, 1); + cal.add(2, 1); + cal.add(6, -1); + } + if (bean.getTipoPagamento().getMesiPrimaRata() > 0) + cal.add(2, bean.getTipoPagamento().getMesiPrimaRata()); + if (bean.getTipoPagamento().getGiornoFisso() > 0L) { + cal.add(5, 1); + cal.set(5, (int)bean.getTipoPagamento().getGiornoFisso()); + } + long giorniEscluso = isMeseEscluso(vecme, cal); + if (giorniEscluso > -1L) { + cal.add(2, 1); + cal.set(5, (int)giorniEscluso); + } + dp = new DocumentoScadenza(getApFull()); + dp.setDataScadenza(new Date(cal.getTimeInMillis())); + dp.setImportoScadenza(dop.getResult()); + dp.setId_documento(id_documento); + vec.add(dp); + for (int i = 0; (long)i < bean.getTipoPagamento().getNRate() - 1L; i++) { + cal.add(2, (int)bean.getTipoPagamento().getPeriodicita()); + if (bean.getTipoPagamento().getFlgPrimaScadenza() == 1L) { + cal.set(5, 1); + cal.add(2, 1); + cal.add(6, -1); + } + if (bean.getTipoPagamento().getGiornoFisso() > 0L) { + cal.add(5, 1); + cal.set(5, (int)bean.getTipoPagamento().getGiornoFisso()); + } + giorniEscluso = isMeseEscluso(vecme, cal); + if (giorniEscluso > -1L) { + cal.add(2, 1); + cal.set(5, (int)giorniEscluso); + } + dp = new DocumentoScadenza(getApFull()); + dp.setDataScadenza(new Date(cal.getTimeInMillis())); + dp.setImportoScadenza(dop.getResult()); + dp.setId_documento(id_documento); + vec.add(dp); + } + } else { + dp = new DocumentoScadenza(getApFull()); + dp.setDataScadenza(bean.getDataDocumento()); + dp.setImportoScadenza(bean.getTotaleDocumento()); + dp.setId_documento(id_documento); + vec.add(dp); + } + return vec; + } + + public ResParm save() { + if (getNRate() == 0L) + setNRate(1L); + if (getNRate() == 1L) + setPeriodicita(0L); + if (getNRate() > 1L && getPeriodicita() == 0L) + setPeriodicita(1L); + return super.save(); + } + + public static final String getFEModalitaPagamento(long l_flgTipoPagamento) { + switch ((int)l_flgTipoPagamento) { + case 2: + case 4: + return "MP05"; + case 1: + return "MP12"; + case 5: + return "MP08"; + case 3: + return "MP01"; + } + return ""; + } + + public String getFEModalitaPagamento() { + return getFEModalitaPagamento(getFlgTipoPagamento()); + } + + public long getFlgAbilitatoStranieri() { + return this.flgAbilitatoStranieri; + } + + public void setFlgAbilitatoStranieri(long flgAbilitatoStranieri) { + this.flgAbilitatoStranieri = flgAbilitatoStranieri; + } + + public long getFlgTipoPagamentoEcommerce() { + return this.flgTipoPagamentoEcommerce; + } + + public void setFlgTipoPagamentoEcommerce(long flgTipoPagamentoEcommerce) { + this.flgTipoPagamentoEcommerce = flgTipoPagamentoEcommerce; + } + + public String getTipoPagamentoEcommerce() { + return getTipoPagamentoEcommerce(getFlgTipoPagamentoEcommerce()); + } + + public static final String getTipoPagamentoEcommerce(long l_flgTipoPagamentoEcommerce) { + switch ((int)l_flgTipoPagamentoEcommerce) { + case 0: + return "Nessuno"; + case 1: + return "Paypal"; + case 4: + return "Paypal+Stripe"; + case 3: + return "Stripe"; + case 2: + return "Sella"; + case 99: + return "Ebay"; + case 98: + return "Amazon"; + } + return "??"; + } + + public ResParm cambiaFlg(String l_flg) { + ResParm rp = new ResParm(true); + if (getId_tipoPagamento() > 0L) { + if (l_flg.equals("flgWww")) { + setFlgWww((getFlgWww() == 1L) ? 2L : ((getFlgWww() == 2L) ? 0L : 1L)); + } else if (l_flg.equals("flgAbilitaNegozio")) { + setFlgAbilitatoNegozio((getFlgAbilitatoNegozio() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgAbilitatoCorriere")) { + setFlgAbilitatoCorriere((getFlgAbilitatoCorriere() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgNoFermopoint")) { + setFlgNoFermopoint((getFlgNoFermopoint() == 1L) ? 0L : 1L); + } + rp = save(); + } else { + rp.setStatus(false); + rp.setMsg("Tipo non trovato!"); + } + return rp; + } + + public String getPathImg() { + return "_img/_imgTipoPagamento/"; + } + + public String getDescrizioneWww(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("descrizioneWww", l_lang); + } + + public String getSloganBreve(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("sloganBreve", l_lang); + } + + public double getPercWwwSconto() { + return this.percWwwSconto; + } + + public void setPercWwwSconto(double percWwwSconto) { + this.percWwwSconto = percWwwSconto; + } + + public double getPercWwwCommissione() { + return this.percWwwCommissione; + } + + public void setPercWwwCommissione(double percWwwCommissione) { + this.percWwwCommissione = percWwwCommissione; + } + + public double getWwwCommissionePercDefault() { + return this.wwwCommissionePercDefault; + } + + public double getWwwTariffaFissa() { + return this.wwwTariffaFissa; + } + + public void setWwwCommissionePercDefault(double wwwCommissionePercDefault) { + this.wwwCommissionePercDefault = wwwCommissionePercDefault; + } + + public void setWwwTariffaFissa(double wwwTariffaFissa) { + this.wwwTariffaFissa = wwwTariffaFissa; + } + + public String getDescCommissioni() { + StringBuilder sb = new StringBuilder(); + if (getFlgTipoPagamentoEcommerce() > 0L) { + if (getWwwTariffaFissa() > 0.0D) + sb.append("Tar. fissa: " + getNf().format(getWwwTariffaFissa())); + if (getWwwCommissionePercDefault() > 0.0D) + sb.append(" % comm. def: " + getNf().format(getWwwCommissionePercDefault()) + "%"); + } + return sb.toString(); + } + + public static TipoPagamento getTipoPagamentoEbay(ApplParmFull apFull) { + if (tipoPagamentoEbay == null) { + tipoPagamentoEbay = new TipoPagamento(apFull); + tipoPagamentoEbay.findPagamentoByTipoPagamentoEcommerce(99L); + } + return tipoPagamentoEbay; + } + + public static TipoPagamento getTipoPagamentoStripe(ApplParmFull apFull) { + if (tipoPagamentoStripe == null) { + tipoPagamentoStripe = new TipoPagamento(apFull); + tipoPagamentoStripe.findPagamentoByTipoPagamentoEcommerce(3L); + } + return tipoPagamentoStripe; + } + + public static TipoPagamento getTipoPagamentoPaypal(ApplParmFull apFull) { + if (tipoPagamentoPaypal == null) { + tipoPagamentoPaypal = new TipoPagamento(apFull); + tipoPagamentoPaypal.findPagamentoByTipoPagamentoEcommerce(1L); + } + return tipoPagamentoPaypal; + } + + public static void setTipoPagamentoPaypal(TipoPagamento l_tipoPagamentoPaypal) { + tipoPagamentoPaypal = l_tipoPagamentoPaypal; + } + + public static void setTipoPagamentoEbay(TipoPagamento l_tipoPagamentoEbay) { + tipoPagamentoEbay = l_tipoPagamentoEbay; + } + + public double getTariffaAggiuntiva() { + return this.tariffaAggiuntiva; + } + + public void setTariffaAggiuntiva(double tariffaAggiuntiva) { + this.tariffaAggiuntiva = tariffaAggiuntiva; + } + + public long getOrdineWww() { + return this.ordineWww; + } + + public void setOrdineWww(long ordineWww) { + this.ordineWww = ordineWww; + } + + public static TipoPagamento getTipoPagamentoAmazon(ApplParmFull apFull) { + if (tipoPagamentoAmazon == null) { + tipoPagamentoAmazon = new TipoPagamento(apFull); + tipoPagamentoAmazon.findPagamentoByTipoPagamentoEcommerce(98L); + } + return tipoPagamentoAmazon; + } + + public static void setTipoPagamentoStripe(TipoPagamento tipoPagamentoStripe) { + TipoPagamento.tipoPagamentoStripe = tipoPagamentoStripe; + } + + public double getWwwValoreSoglia() { + return this.wwwValoreSoglia; + } + + public void setWwwValoreSoglia(double wwwValoreSoglia) { + this.wwwValoreSoglia = wwwValoreSoglia; + } + + public double getWwwPercOltreSoglia() { + return this.wwwPercOltreSoglia; + } + + public void setWwwPercOltreSoglia(double wwwPercOltreSoglia) { + this.wwwPercOltreSoglia = wwwPercOltreSoglia; + } + + public String getCodicePagamentoExport() { + return (this.codicePagamentoExport == null) ? "" : this.codicePagamentoExport.trim(); + } + + public void setCodicePagamentoExport(String codicePagamentoExport) { + this.codicePagamentoExport = codicePagamentoExport; + } + + public long getFlgNoFermopoint() { + return this.flgNoFermopoint; + } + + public void setFlgNoFermopoint(long flgNoFermopoint) { + this.flgNoFermopoint = flgNoFermopoint; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoPagamentoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoPagamentoCR.java new file mode 100644 index 00000000..d4e19a58 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/TipoPagamentoCR.java @@ -0,0 +1,136 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoPagamentoCR extends CRAdapter { + private long id_tipoPagamento; + + private long periodicita; + + private String descrizione_it; + + private String descrizione_en; + + private long flgTipoPagamento; + + private long flgPrimaScadenza; + + private long giornoFisso; + + private long primaRata; + + private long nRate; + + private long flgWww = -1L; + + private long flgNoFermopoint = -1L; + + public static long ORDER_BY_ORDINEWWW = 1L; + + public TipoPagamentoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoPagamentoCR() {} + + public void setId_tipoPagamento(long newId_tipoPagamento) { + this.id_tipoPagamento = newId_tipoPagamento; + } + + public void setPeriodicita(long newPeriodicita) { + this.periodicita = newPeriodicita; + } + + public void setDescrizione_it(String newDescrizione_it) { + this.descrizione_it = newDescrizione_it; + } + + public void setDescrizione_en(String newDescrizione_en) { + this.descrizione_en = newDescrizione_en; + } + + public void setFlgTipoPagamento(long newFlgTipoPagamento) { + this.flgTipoPagamento = newFlgTipoPagamento; + } + + public void setFlgPrimaScadenza(long newFlgPrimaScadenza) { + this.flgPrimaScadenza = newFlgPrimaScadenza; + } + + public void setGiornoFisso(long newGiornoFisso) { + this.giornoFisso = newGiornoFisso; + } + + public void setPrimaRata(long newPrimaRata) { + this.primaRata = newPrimaRata; + } + + public void setNRate(long newNRate) { + this.nRate = newNRate; + } + + public long getId_tipoPagamento() { + return this.id_tipoPagamento; + } + + public long getPeriodicita() { + return this.periodicita; + } + + public String getDescrizione_it() { + return (this.descrizione_it == null) ? "" : this.descrizione_it.trim(); + } + + public String getDescrizione_en() { + return (this.descrizione_en == null) ? "" : this.descrizione_en.trim(); + } + + public long getFlgTipoPagamento() { + return this.flgTipoPagamento; + } + + public long getFlgPrimaScadenza() { + return this.flgPrimaScadenza; + } + + public long getGiornoFisso() { + return this.giornoFisso; + } + + public long getPrimaRata() { + return this.primaRata; + } + + public long getNRate() { + return this.nRate; + } + + public String getWww() { + return TipoPagamento.getWww(getFlgWww()); + } + + public static final String getTipoPagamento(long l_flgTipoPagamento) { + return TipoPagamento.getTipoPagamento(l_flgTipoPagamento); + } + + public long getFlgWww() { + return this.flgWww; + } + + public void setFlgWww(long flgWww) { + this.flgWww = flgWww; + } + + public static final String getWww(long l_flgWww) { + return TipoPagamento.getWww(l_flgWww); + } + + public long getFlgNoFermopoint() { + return this.flgNoFermopoint; + } + + public void setFlgNoFermopoint(long flgNoFermopoint) { + this.flgNoFermopoint = flgNoFermopoint; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/UserClifor.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/UserClifor.java new file mode 100644 index 00000000..a1330967 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/UserClifor.java @@ -0,0 +1,120 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class UserClifor extends _AnagAdapter { + private static final long serialVersionUID = -8722609970886488948L; + + private long id_userClifor; + + private long id_users; + + private long id_clifor; + + private Users users; + + private Clifor clifor; + + public UserClifor() {} + + public UserClifor(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public long getId_userClifor() { + return this.id_userClifor; + } + + public void setId_userClifor(long id_userClifor) { + this.id_userClifor = id_userClifor; + } + + public long getId_users() { + return this.id_users; + } + + public void setId_users(long id_users) { + this.id_users = id_users; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + } + + public Vectumerator findByUser(long l_id_users) { + String s_Sql_Find = "select A.* from USER_CLIFOR AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_users = " + l_id_users); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByUserClifor(long l_id_users, long l_id_clifor) { + String s_Sql_Find = "select A.* from USER_CLIFOR AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_users = " + l_id_users); + wc.addWc(" A.id_clifor = " + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users()); + return this.users; + } + + public void setUsers(Users users) { + this.users = users; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setClifor(Clifor clifor) { + this.clifor = clifor; + } + + public ResParm save() { + UserClifor uc = new UserClifor(getApFull()); + uc.findByUserClifor(getId_users(), getId_clifor()); + if (uc.getDBState() == 0) + return super.save(); + return new ResParm(true); + } + + public Vectumerator findByCR(UserCliforCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from USER_CLIFOR AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/UserCliforCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/UserCliforCR.java new file mode 100644 index 00000000..5ba67945 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/UserCliforCR.java @@ -0,0 +1,65 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; + +public class UserCliforCR extends _AnagAdapter { + private long id_userClifor; + + private long id_users; + + private long id_clifor; + + private Users users; + + private Clifor clifor; + + public UserCliforCR() {} + + public UserCliforCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public long getId_userClifor() { + return this.id_userClifor; + } + + public void setId_userClifor(long id_userClifor) { + this.id_userClifor = id_userClifor; + } + + public long getId_users() { + return this.id_users; + } + + public void setId_users(long id_users) { + this.id_users = id_users; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users()); + return this.users; + } + + public void setUsers(Users users) { + this.users = users; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, + getId_clifor()); + return this.clifor; + } + + public void setClifor(Clifor clifor) { + this.clifor = clifor; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Users.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Users.java new file mode 100644 index 00000000..3d66f123 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Users.java @@ -0,0 +1,2552 @@ +package it.acxent.anag; + +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.Image; +import com.lowagie.text.PageSize; +import com.lowagie.text.Phrase; +import com.lowagie.text.Table; +import com.lowagie.text.pdf.Barcode128; +import com.lowagie.text.pdf.PdfContentByte; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfWriter; +import it.acxent.api.amz.AmzSellerApi; +import it.acxent.api.ebay.EbayAbliaApi; +import it.acxent.art.Wishlist; +import it.acxent.bank.consel.ConselReq; +import it.acxent.bank.infogroup.ShopnetReq; +import it.acxent.bank.paypal.PayPalReq; +import it.acxent.bank.poste2019.PosteReq; +import it.acxent.bank.sella.SellaReq; +import it.acxent.bank.sellaPCredit.SellaPCreditReq; +import it.acxent.bank.setefi.SetefiReq; +import it.acxent.bank.stripe.StripeResp; +import it.acxent.bank.xpay.XpayReq; +import it.acxent.brt.api.BrtApi; +import it.acxent.cart.Cart; +import it.acxent.cc.GoogleReview; +import it.acxent.common.Parm; +import it.acxent.common.PostazioneI; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.fattele._FeXmlAdapter; +import it.acxent.mail.MailMessage; +import it.acxent.mail.MailProperties; +import it.acxent.news.News; +import it.acxent.newsletter.CodaMessaggi; +import it.acxent.rd.RemoteDevice; +import it.acxent.util.FileWr; +import it.acxent.util.Vectumerator; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.IOException; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.Calendar; +import java.util.Date; + +public class Users extends it.acxent.common.Users implements Serializable { + private static final long serialVersionUID = -7378135042656835721L; + + private RegCassa regCassa; + + private long id_postazione; + + protected Postazione postazione; + + private Clifor clifor; + + private long id_clifor; + + private String id_nazione; + + private Nazione nazione; + + private String callingJsp; + + private long flgOperatore; + + private long flgNews; + + protected Document document; + + protected Table pdfcorpo; + + protected PdfPTable pdfPcorpo; + + protected PdfWriter writer; + + private long id_documento; + + private double tariffaProfessionista; + + private double percProfessionista; + + public static final Font PDF_fMedioB = new Font(2, 10.0F, 1); + + public Users() {} + + public Users(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public boolean isDeleteLogic() { + return false; + } + + protected boolean isUseSafeUpdate() { + return true; + } + + public Vectumerator findByClifor(long l_id_clifor, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from USERS AS A"; + String s_Sql_Order = " order by A.cognome, A.nome"; + WcString wc = new WcString(); + wc.addWc("A.id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findFirstByClifor(long l_id_clifor) { + String s_Sql_Find = "select A.* from USERS AS A"; + String s_Sql_Order = " order by A.cognome, A.nome"; + WcString wc = new WcString(); + wc.addWc("A.id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void initApplicationParms(ApplParmFull ap) { + boolean debug = false; + if (ap != null) { + String l_tipoParm = ""; + Parm bean = new Parm(ap); + DBAdapter.logDebug(debug, "anag.Users initParms: start"); + l_tipoParm = "PARM_SMS"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("SMS_URL"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SMS_URL"); + bean.setDescrizione("SMS_URL"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("http://gateway.skebby.it/api/send/smseasy/advanced/http.php"); + bean.setNota("URL DEL SERVIZIO DI SMS TRAMITE SKEBBY"); + bean.save(); + bean.findByCodice("SMS_USER"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SMS_USER"); + bean.setDescrizione("SMS_USER"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("ENKOUNTER"); + bean.setNota("NOME UTENTE PER INVIO SMS TRAMITE SKEBBY"); + bean.save(); + bean.findByCodice("SMS_PASS"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SMS_PASS"); + bean.setDescrizione("SMS_PASS"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("TOPlan100099"); + bean.setNota("PASSWORD PER INVIO SMS TRAMITE SKEBBY"); + bean.save(); + l_tipoParm = "PARM_FATTURA"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("PERC_CONT_INTEGRATIVO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PERC_CONT_INTEGRATIVO"); + bean.setDescrizione("PERC_CONT_INTEGRATIVO"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(2.0D); + bean.setNota("PERCENTUALE CONTRIBUTO INTEGRATIVO"); + bean.save(); + bean.findByCodice("PERC_RITENUTA_ACCONTO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PERC_RITENUTA_ACCONTO"); + bean.setDescrizione("PERC_RITENUTA_ACCONTO"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(20.0D); + bean.setNota("PERCENTUALE RITENUTA ACCONTO"); + bean.save(); + bean.findByCodice("TIPO_FATTURE_VENDITA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("TIPO_FATTURE_VENDITA"); + bean.setDescrizione("TIPO_FATTURE_VENDITA"); + bean.setFlgTipo(0L); + bean.setNota("CODICi TIPO DOCUMENTO FATTURA VENDITA SEPARATI DA , "); + bean.save(); + bean.findByCodice("TIPO_FATTURE_ACQUISTO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("TIPO_FATTURE_ACQUISTO"); + bean.setDescrizione("TIPO_FATTURE_ACQUISTO"); + bean.setFlgTipo(0L); + bean.setNota("CODICI TIPO DOCUMENTO FATTURA ACQUISTO SEPARATI DA , "); + bean.save(); + l_tipoParm = "APPS"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("ESERCIZIO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ESERCIZIO"); + bean.setDescrizione("ESERCIZIO"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) { + Calendar cal = Calendar.getInstance(); + bean.setNumero((double)cal.get(1)); + } + bean.setNota("ESERCIZIO CORRENTE"); + bean.save(); + bean.findByCodice("OTTIMIZZO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("OTTIMIZZO"); + bean.setDescrizione("OTTIMIZZO"); + bean.setFlgTipo(5L); + bean.setNota("1: ATTIVA OTTIMIZAZIONE FINDBYCR"); + bean.save(); + l_tipoParm = "VERSIONE"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("FATTURA_ELETTRONICA_ON"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FATTURA_ELETTRONICA_ON"); + bean.setDescrizione("FATTURA_ELETTRONICA_ON"); + bean.setFlgTipo(5L); + bean.setNota("Se true, viene abilitata la generazione delle fatture elettroniche"); + bean.save(); + bean.findByCodice("RIGA_DOC_CODICE_ARTICOLO_ESPLICITO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("RIGA_DOC_CODICE_ARTICOLO_ESPLICITO"); + bean.setDescrizione("RIGA_DOC_CODICE_ARTICOLO_ESPLICITO"); + bean.setFlgTipo(5L); + bean.setNota("Se true, sulla riga documento il codice articolo puo' essere inserito nel caso di righe non nel db"); + bean.save(); + bean.findByCodice("AGENTI_ON"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("AGENTI_ON"); + bean.setDescrizione("AGENTI_ON"); + bean.setFlgTipo(5L); + bean.setNota("Se true, viene resa visibile l'inserimento agenti nelle anagrafica"); + bean.save(); + bean.findByCodice("ATR_ON"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ATR_ON"); + bean.setDescrizione("ATR_ON"); + bean.setFlgTipo(5L); + bean.setNota("Se true, viene reso visibile l'inserimento dati time report su cliente"); + bean.save(); + bean.findByCodice("PREZZO_CON_IVA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PREZZO_CON_IVA"); + bean.setDescrizione("PREZZO_CON_IVA"); + bean.setFlgTipo(5L); + if (bean.getTesto().isEmpty()) + bean.setTesto("1"); + bean.setNota("Gestione prezzo articolo con o senza iva"); + bean.save(); + bean.findByCodice("SERIALI_UNIVOCI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SERIALI_UNIVOCI"); + bean.setDescrizione("SERIALI_UNIVOCI"); + bean.setFlgTipo(5L); + bean.setNota("SERIALI UNIVOCI. IMPEDISCE L'INSERIMENTO DI DUE SERIALI UGUALI ANCHE PER ARTICOLI DIVERSI"); + bean.save(); + bean.findByCodice("VARIANTI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("VARIANTI"); + bean.setDescrizione("VARIANTI"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("1"); + bean.setNumero((double)Integer.valueOf(bean.getTesto())); + bean.setNota("Gestione varianti articolo: 0=NO, 1=SI"); + bean.save(); + bean.findByCodice("TAGLIE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("TAGLIE"); + bean.setDescrizione("TAGLIE"); + bean.setFlgTipo(5L); + bean.setNota("Gestione taglie articolI"); + bean.save(); + bean.findByCodice("TESSUTI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("TESSUTI"); + bean.setDescrizione("TESSUTI"); + bean.setFlgTipo(5L); + bean.setNota("Gestione articoli tessuti"); + bean.save(); + bean.findByCodice("PROGETTISTA_ARTICOLO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PROGETTISTA_ARTICOLO"); + bean.setDescrizione("PROGETTISTA_ARTICOLO"); + bean.setFlgTipo(5L); + bean.setNota("Gestione progettisti articoli con perc. di provvigione"); + bean.save(); + bean.findByCodice("IMMOBILI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("IMMOBILI"); + bean.setDescrizione("IMMOBILI"); + bean.setFlgTipo(5L); + bean.setNota("Gestione immobili (es. Gaias)"); + bean.save(); + bean.findByCodice("ASTE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ASTE"); + bean.setDescrizione("ASTE"); + bean.setFlgTipo(5L); + bean.setNota("Gestione aste (es. Gaias)"); + bean.save(); + bean.findByCodice("TAGLIE_LINGUE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("TAGLIE_LINGUE"); + bean.setDescrizione("TAGLIE_LINGUE"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto(""); + bean.setNota("Gestione Lingue per le Taglie"); + bean.save(); + bean.findByCodice("ANAG_DESC_COMPLETA_CON_TIPO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ANAG_DESC_COMPLETA_CON_TIPO"); + bean.setDescrizione("ANAG_DESC_COMPLETA_CON_TIPO"); + bean.setFlgTipo(5L); + bean.setNota("Nella descrizione clifor mette o non mette il tipo C o F in descrizione completa"); + bean.save(); + bean.findByCodice("ARTICOLO_CLIENTE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ARTICOLO_CLIENTE"); + bean.setDescrizione("ARTICOLO_CLIENTE"); + bean.setFlgTipo(5L); + bean.setNota("Ablilita legamne Articolo/Cliente B2B"); + bean.save(); + l_tipoParm = "ARTICOLO"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("ART_SIMBOLI_LAVAGGIO_DEFAULT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ART_SIMBOLI_LAVAGGIO_DEFAULT"); + bean.setDescrizione("ART_SIMBOLI_LAVAGGIO_DEFAULT"); + bean.setFlgTipo(0L); + bean.setNota("SIMBOLI LAVAGGIO DEFAULT
LAVAGGIO,CANDEGGIO,ASCIUGATURA,STIRO,PULITURA A SECCO "); + bean.save(); + bean.findByCodice("SEO_VERSION"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SEO_VERSION"); + bean.setDescrizione("SEO_VERSION"); + bean.setFlgTipo(1L); + bean.setNota("0, versione CC standard, 1, versione Tuttofoto"); + bean.save(); + l_tipoParm = "PATH"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("PATH_IMG_TAB_TAG"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PATH_IMG_TAB_TAG"); + bean.setDescrizione("PATH_IMG_TAB_TAG"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_img/_imgTabellaTaglie/"); + bean.setNota("Path immagini taglie relativo a docbase che finisce con /"); + bean.save(); + bean.findByCodice("PATH_IMG_BANNER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PATH_IMG_BANNER"); + bean.setDescrizione("PATH_IMG_BANNER"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_img/_imgBanner/"); + bean.setNota("Path relativo a docbase che finisce con /"); + bean.save(); + bean.findByCodice("PATH_IMG_ART"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PATH_IMG_ART"); + bean.setDescrizione("PATH_IMG_ART"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_img/_imgArt/"); + bean.setNota("Path x immagini articoli relativo a docbase che finisce con /"); + bean.save(); + bean.findByCodice("PATH_IMG_TIPO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PATH_IMG_TIPO"); + bean.setDescrizione("PATH_IMG_TIPO"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_img/_imgTipo/"); + bean.setNota("Path x immagini tipo articolo relativo a docbase che finisce con /"); + bean.save(); + bean.findByCodice("ART_ATTACH_PATH"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ART_ATTACH_PATH"); + bean.setDescrizione("ART_ATTACH_PATH"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_attach/_art/"); + bean.setNota("Path x attach articoli relativo a docbase che finisce con /"); + bean.save(); + bean.findByCodice("CLIFOR_ATTACH_PATH"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CLIFOR_ATTACH_PATH"); + bean.setDescrizione("CLIFOR_ATTACH_PATH"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_attach/_clifor/"); + bean.setNota("Path x attach clienti fornitori relativo a docbase che finisce con /"); + bean.save(); + bean.findByCodice("DOC_ATTACH_PATH"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DOC_ATTACH_PATH"); + bean.setDescrizione("DOC_ATTACH_PATH"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_attach/_doc/"); + bean.setNota("Path x documenti relativo a docbase che finisce con /"); + bean.save(); + l_tipoParm = "IMPORT"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("ART_IMPORT_FILE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ART_IMPORT_FILE"); + bean.setDescrizione("ART_IMPORT_FILE"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("fileImport.csv"); + bean.setNota("File di import in genere csv. Verrà messo su PATH_TMP"); + bean.save(); + l_tipoParm = "MAIL_MSG"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("MSG_ORDINE_SPEDITO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MSG_ORDINE_SPEDITO"); + bean.setDescrizione("MSG_ORDINE_SPEDITO"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("Ordine spedito"); + bean.setNota("Messaggio che vogliamo aggiungere alla mail invio ordine nel caso di ordine spedito."); + bean.save(); + bean.findByCodice(Cart.P_CHECKOUTMSG); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(Cart.P_CHECKOUTMSG); + bean.setDescrizione(Cart.P_CHECKOUTMSG); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("mailMessage/checkOut.html"); + bean.setNota("Path relativo a docbase"); + bean.save(); + bean.findByCodice(Parm.P_USERMSG); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(Parm.P_USERMSG); + bean.setDescrizione(Parm.P_USERMSG); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("mailMessage/userMsg.html"); + bean.setNota("Path relativo a docbase"); + bean.save(); + bean.findByCodice(Parm.P_LOSTPWDMSG); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(Parm.P_LOSTPWDMSG); + bean.setDescrizione(Parm.P_LOSTPWDMSG); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("mailMessage/lostPwd.html"); + bean.setNota("Path relativo a docbase"); + bean.save(); + bean.findByCodice(Parm.P_MLISTMSG); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(Parm.P_MLISTMSG); + bean.setDescrizione(Parm.P_MLISTMSG); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("mailMessage/ml.txt"); + bean.setNota("Path relativo. Registrazione Mailing List"); + bean.save(); + bean.findByCodice(Parm.P_USERMSG); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(Parm.P_USERMSG); + bean.setDescrizione(Parm.P_USERMSG); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("mailMessage/userMsg.html"); + bean.setNota("Path relativo. Registrazione Utente"); + bean.save(); + bean.findByCodice(Parm.P_RESOMSG); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(Parm.P_RESOMSG); + bean.setDescrizione(Parm.P_RESOMSG); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("mailMessage/reso.html"); + bean.setNota("Path relativo. Reso merce"); + bean.save(); + bean.findByCodice("MAIL_ADMIN_SCAD_CI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIL_ADMIN_SCAD_CI"); + bean.setDescrizione("MAIL_ADMIN_SCAD_CI"); + bean.setFlgTipo(0L); + bean.setNota("MAIL INVIATA DAL SISTEMA CON LA LISTA DEI CLIENTI CHE HANNO DOCUMENTI SCADUTI O IN SCADENZA."); + bean.save(); + l_tipoParm = "CASSA SCONTRINI"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("DESC_SCONTRINO_FULL"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DESC_SCONTRINO_FULL"); + bean.setDescrizione("DESC_SCONTRINO_FULL"); + bean.setFlgTipo(5L); + if (bean.getNumero() > 1.0D) + bean.setNumero(1.0D); + bean.setNota("STAMPA SU SCONTRINO DELLA DESCRIZIONE ARTICOLO COMPLETA"); + bean.save(); + bean.findByCodice("CASSA_STAMPA_DISPLAY"); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CASSA_STAMPA_DISPLAY"); + bean.setDescrizione("CASSA_STAMPA_DISPLAY"); + bean.setFlgTipo(0L); + bean.setNota("STRINGA DA STAMPARE SUL DISPLAY DELLA CASSA QUANDO NON E' IN USO. PRIMA RIGA MAX CAR. 20."); + bean.save(); + bean.findByCodice("CASSA_STAMPA_DISPLAY_TIMEOUT"); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CASSA_STAMPA_DISPLAY_TIMEOUT"); + bean.setDescrizione("CASSA_STAMPA_DISPLAY_TIMEOUT"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(5.0D); + bean.setNota("TIMEOUT IN SECONDI PER IL DISPLAY DELLA CASSA DOPO LE STAMPE SCONTRINI FISCALI E NON"); + bean.save(); + bean.findByCodice("CASSA_STAMPA_DISPLAY1"); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CASSA_STAMPA_DISPLAY1"); + bean.setDescrizione("CASSA_STAMPA_DISPLAY1"); + bean.setFlgTipo(0L); + bean.setNota("STRINGA DA STAMPARE SUL DISPLAY DELLA CASSA QUANDO NON E' IN USO. SECONDA RIGA MAX CAR. 20."); + bean.save(); + bean.findByCodice("CASSA_STAMPA_PROMO"); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CASSA_STAMPA_PROMO"); + bean.setDescrizione("CASSA_STAMPA_PROMO"); + bean.setFlgTipo(0L); + bean.setNota("STRINGA DA STAMPARE IN FONDO ALLO SCONTRINO CON UN TESTO LIBERO."); + bean.save(); + bean.findByCodice("DESC_SCONTRINO_FULL"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DESC_SCONTRINO_FULL"); + bean.setDescrizione("DESC_SCONTRINO_FULL"); + bean.setFlgTipo(5L); + if (bean.getNumero() > 1.0D) + bean.setNumero(1.0D); + bean.setNota("STAMPA SU SCONTRINO DELLA DESCRIZIONE ARTICOLO COMPLETA"); + bean.save(); + l_tipoParm = "IVA"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("CODICE_IVA_STD_VEND"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODICE_IVA_STD_VEND"); + bean.setDescrizione("CODICE_IVA_STD_VEND"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(1.0D); + bean.setNota("CODICE IVA STANDARD VENDITE ITALIA"); + bean.save(); + bean.findByCodice("CODICE_IVA_STD_ACQ"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODICE_IVA_STD_ACQ"); + bean.setDescrizione("CODICE_IVA_STD_ACQ"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(1.0D); + bean.setNota("CODICE IVA STANDARD ACQUISTI"); + bean.save(); + bean.findByCodice("CODICE_IVA_ESENTE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODICE_IVA_ESENTE"); + bean.setDescrizione("CODICE_IVA_ESENTE"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(1.0D); + bean.setNota("CODICE IVA ESENTE PER SPESE E BOLLI"); + bean.save(); + bean.findByCodice("CODICE_IVA_REGIME_MARGINE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODICE_IVA_REGIME_MARGINE"); + bean.setDescrizione("CODICE_IVA_REGIME_MARGINE"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(11.0D); + bean.setNota("CODICE IVA ESENTE PER REGIME DEL MARGINE"); + bean.save(); + bean.findByCodice("CODICE_IVA_REVERSE_CHARGE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODICE_IVA_REVERSE_CHARGE"); + bean.setDescrizione("CODICE_IVA_REVERSE_CHARGE"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(99.0D); + bean.setNota("CODICE IVA ESENTE REVERSE CHARGE"); + bean.save(); + bean.findByCodice("CODICE_IVA_ART8"); + if ((long)bean.getDBState() == 1L) { + bean.setCodice("CODICE_IVA_ART8_A"); + bean.setDescrizione("CODICE_IVA_ART8_A"); + bean.save(); + } + bean.findByCodice("CODICE_IVA_ART8_A"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODICE_IVA_ART8_A"); + bean.setDescrizione("CODICE_IVA_ART8_A"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(1.0D); + bean.setNota("CODICE IVA ESENTE ART. 8 LETTERA A PER ARTICOLI IN VENDITA EXTRA CEE SIA AZIENDA CHE PRIVATO"); + bean.save(); + bean.findByCodice("CODICE_IVA_EXTRA_CEE_ESP_ABITUALE_ART8_C"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODICE_IVA_EXTRA_CEE_ESP_ABITUALE_ART8_C"); + bean.setDescrizione("CODICE_IVA_EXTRA_CEE_ESP_ABITUALE_ART8_C"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(1.0D); + bean.setNota("CODICE IVA ESENTE ART. 8 LETTERA C PER VENDITE EXTRA CEE SIA AZIENDA CHE PRIVATO PER ESPORTATORI ABITUALI"); + bean.save(); + bean.findByCodice("CODICE_IVA_CEE_AZIENDA_ART41"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODICE_IVA_CEE_AZIENDA_ART41"); + bean.setDescrizione("CODICE_IVA_CEE_AZIENDA_ART41"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(1.0D); + bean.setNota("CODICE IVA ESENTE ART. 41 PER VENDITE CEE AZIENDA (CASO CORRETTO CON IVA_ESTERO_AZIENDA_ESENTE=TRUE)"); + bean.save(); + bean.findByCodice("CODICE_IVA_ITA_CEE_AZIENDA_ART58"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODICE_IVA_ITA_CEE_AZIENDA_ART58"); + bean.setDescrizione("CODICE_IVA_ITA_CEE_AZIENDA_ART58"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(1.0D); + bean.setNota("CODICE IVA non imponibile ex art. 58 comma 1, DL 331/1993. PER VENDITE DA ITA A CEE AZIENDA"); + bean.save(); + bean.findByCodice("CODICE_IVA_ART9"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODICE_IVA_ART9"); + bean.setDescrizione("CODICE_IVA_ART9"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(1.0D); + bean.setNota("CODICE IVA ESENTE ART. 9 PER SPESE TRASPORTO EXTRA UE (RAVINALE?)"); + bean.save(); + bean.findByCodice("IVA_ESTERO_AZIENDA_ESENTE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("IVA_ESTERO_AZIENDA_ESENTE"); + bean.setDescrizione("IVA_ESTERO_AZIENDA_ESENTE"); + bean.setFlgTipo(5L); + bean.setNota("TRUE O FALSE: SE FALSE, VIENE COMUNQUE APPLICATA L'IVA ITALIANA PER EXTRACEE ANCHE ALLE AZIENDE, ANCHE SE NON SAREBBE CORRETTO!!!
ALTRIMENTI PER LE AZIENDE VIENE ESPOSTO IL PREZZO SENZA IVA (ART 41 CEE ART 8/A EXTRA CEE - GESTIONE CORRETTA)"); + bean.save(); + bean.findByCodice("IVA_CEE_ONE_STOP_SHOP"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("IVA_CEE_ONE_STOP_SHOP"); + bean.setDescrizione("IVA_CEE_ONE_STOP_SHOP"); + bean.setFlgTipo(5L); + bean.setNota("TRUE O FALSE: MI INDICA COME COMPORTARSI NEL CASO DI VENDITE CEE A UTENTI FINALI. IN CASO ONE STOP SHOP= TRUE VANNO DEFINITE I CODICI IVA PER OGNI NAZIONE E ASSOCIATE ALLA NAZIONE, SIA IVA ORDINARIA CHE EVENTUALMENTE IVA REGIME DEL MARGINE
ALTRIMENTI VIENE SEMPRE APPLICATA L'IVA ITALIANA (SOLO PER GLI UTENTI FINALI CASO 10.000 EUR MASSIMO DI VENDITE IN EUROPA L'ANNO A UTENTI FINALI)"); + bean.save(); + l_tipoParm = "DOCUMENTI"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("DOC_ARTICOLI_CON_CODICE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DOC_ARTICOLI_CON_CODICE"); + bean.setDescrizione("DOC_ARTICOLI_CON_CODICE"); + bean.setFlgTipo(5L); + bean.setNota("SE IMPOSTATO LA DESCRIZIONE ARTICOLO COMPRENDE ANCHE IL CODICE (RAVINALE) PRIMA DEL NOME"); + bean.save(); + bean.findByCodice("DOC_ARTICOLI_CON_TIPO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DOC_ARTICOLI_CON_TIPO"); + bean.setDescrizione("DOC_ARTICOLI_CON_TIPO"); + bean.setFlgTipo(5L); + bean.setNota("SE IMPOSTATO LA DESCRIZIONE ARTICOLO COMPRENDE ANCHE IL TIPO (RAVINALE) DOPO IL NOME"); + bean.save(); + bean.findByCodice("ORDINI_WWW_USA_PROG_WWW"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ORDINI_WWW_USA_PROG_WWW"); + bean.setDescrizione("ORDINI_WWW_USA_PROG_WWW"); + bean.setFlgTipo(5L); + bean.setNota("SE IMPOSTATO USO PROGRESSIVO WWW GENERALE. UTILIZZATO ANCHE SU STAMPA DEL RIFERIMENTO INTERNO (TF)"); + bean.save(); + bean.findByCodice("DATA_FATTURA_PRIMA_DISPONIBILE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DATA_FATTURA_PRIMA_DISPONIBILE"); + bean.setDescrizione("DATA_FATTURA_PRIMA_DISPONIBILE"); + bean.setFlgTipo(1L); + bean.setNota("SE IMPOSTATO AD 1, AL SALVATAGGIO DELLE FATTURE EMESSE VIENE IMPOSTATA LA PRIMA DATA DISPONIBILE, ALTRIMENTI VIENE IMPOSTATA LA DATA DI OGGI."); + bean.save(); + bean.findByCodice("BLOCCO_FATTURE_EMSTA"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("BLOCCO_FATTURE_EMSTA"); + bean.setDescrizione("BLOCCO_FATTURE_EMSTA"); + bean.setFlgTipo(1L); + bean.setNota("IMPOSTA SE LE FATTURE EMESSE (1) O STAMPATE (2) DEVONO ESSERE BLOCCATE (NO SALVATAGGIO ED ELIMINAZIONE) OPPURE NO (0)"); + bean.save(); + bean.findByCodice("DOC_FIRMA_INVIO_FATTURA"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DOC_FIRMA_INVIO_FATTURA"); + bean.setDescrizione("DOC_FIRMA_INVIO_FATTURA"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("In allegato Vi inviamo il ns. documento del quale e' fatto obbligo da parte del destinatario la stampa e la conservazione del cartaceo nel rispetto dei termini di legge (Ris. Min. 30/07/1990, n. 450217, Circ. Min. 23/02/1994 n. 13/e, Ris. Min. 28/05/1997, n. 132/e)."); + bean.setNota("TESTO DA INVIARE PER EMAIL UNITAMENTE ALL'INVIO DI UNA FATTURA"); + bean.save(); + bean.findByCodice("DOC_BANCA_APPOGGIO_DESC"); + bean.delete(); + bean.findByCodice("DOC_BANCA_APPOGGIO_IBAN"); + bean.delete(); + bean.findByCodice("DOC_BCC"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DOC_BCC"); + bean.setDescrizione("DOC_BCC"); + bean.setFlgTipo(0L); + bean.setNota("BCC PER L'INVIO DEI DOCUMENTI. IN GENERE amministrazione@xxx.xxx"); + bean.save(); + bean.findByCodice("RIP_NOTA_SCHEDA_RIPARAZIONE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("RIP_NOTA_SCHEDA_RIPARAZIONE"); + bean.setDescrizione("RIP_NOTA_SCHEDA_RIPARAZIONE"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("Note clientela scheda riparazione"); + bean.setNota("RIP_NOTA_SCHEDA_RIPARAZIONE"); + bean.save(); + bean.findByCodice("RIP_NOTA_ACCETTAZIONE_PREVENTIVO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("RIP_NOTA_ACCETTAZIONE_PREVENTIVO"); + bean.setDescrizione("RIP_NOTA_ACCETTAZIONE_PREVENTIVO"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("Note clientela per accettazione o non accettazione preventivo"); + bean.setNota("RIP_NOTA_ACCETTAZIONE_PREVENTIVO"); + bean.save(); + bean.findByCodice("ID_DOC_ORDINE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ID_DOC_ORDINE"); + bean.setDescrizione("ID_DOC_ORDINE"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(8.0D); + bean.setNota("Id tipo documento Ordine per la generazione automatica ordini"); + bean.save(); + bean.findByCodice("ID_DOC_ORDINE_TAGLIO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ID_DOC_ORDINE_TAGLIO"); + bean.setDescrizione("ID_DOC_ORDINE_TAGLIO"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(26.0D); + bean.setNota("Id tipo documento Ordine Taglio per nuovo ordine direttamente da articolo"); + bean.save(); + bean.findByCodice("ID_DOC_ORDINE_WWW"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ID_DOC_ORDINE_WWW"); + bean.setDescrizione("ID_DOC_ORDINE_WWW"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(-1.0D); + bean.setNota("Id tipo documento Ordine commercio elettronico"); + bean.save(); + bean.findByCodice("ID_DOC_PRENOTAZIONE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ID_DOC_PRENOTAZIONE"); + bean.setDescrizione("ID_DOC_PRENOTAZIONE"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(0.0D); + bean.save(); + bean.findByCodice("ID_DOC_RICEVUTA"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ID_DOC_RICEVUTA"); + bean.setDescrizione("ID_DOC_RICEVUTA"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(9.0D); + bean.setNota("Id tipo documento Ricevuta per la gestione delle ricevute"); + bean.save(); + bean.findByCodice("ID_DOC_CASSA"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ID_DOC_CASSA"); + bean.setDescrizione("ID_DOC_CASSA"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(1.0D); + bean.setNota("Id tipo documento cassa"); + bean.save(); + bean.findByCodice("ID_DOC_RIPARAZIONE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ID_DOC_RIPARAZIONE"); + bean.setDescrizione("ID_DOC_RIPARAZIONE"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(16.0D); + bean.setNota("Id tipo documento riparazione"); + bean.save(); + bean.findByCodice("HEAD_SLIP"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("HEAD_SLIP"); + bean.setDescrizione("HEAD_SLIP"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto(""); + bean.setNota("Intestazione stampe slip"); + bean.save(); + bean.findByCodice("MAIL_INVIO_DOC"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIL_INVIO_DOC"); + bean.setDescrizione("MAIL_INVIO_DOC"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("mail@dominio.com"); + bean.setNota("INDIRIZZO EMAIL DIDEFAULT PER INVIO DOCUMENTI"); + bean.save(); + bean.findByCodice("HEAD_DOC1"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("HEAD_DOC1"); + bean.setDescrizione("HEAD_DOC1"); + bean.setFlgTipo(0L); + bean.setNota("HEADER DOCUMENTI 1"); + bean.save(); + bean.findByCodice("HEAD_DOC2"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("HEAD_DOC2"); + bean.setDescrizione("HEAD_DOC2"); + bean.setFlgTipo(0L); + bean.setNota("HEADER DOCUMENTI 2"); + bean.save(); + bean.findByCodice("FOOT_DOC1"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FOOT_DOC1"); + bean.setDescrizione("FOOT_DOC1"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("Footer documenti 1"); + bean.setNota("FOOTER DOCUMENTI 1"); + bean.save(); + bean.findByCodice("FOOT_DOC2"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FOOT_DOC2"); + bean.setDescrizione("FOOT_DOC2"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("Footer documenti 2"); + bean.setNota("FOOTER DOCUMENTI 2"); + bean.save(); + bean.findByCodice("DOC_LEADROW"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DOC_LEADROW"); + bean.setDescrizione("DOC_LEADROW"); + bean.setFlgTipo(1L); + bean.setNota("NUMERO RIGHE DI TESTA NEI DOCUMENTI. DEFAULT 12 SE NON IMPOSTATO"); + bean.save(); + bean.findByCodice("DOC_FONT_ROW_SIZE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DOC_FONT_ROW_SIZE"); + bean.setDescrizione("DOC_FONT_ROW_SIZE"); + bean.setFlgTipo(1L); + if (bean.getNumeroInt() == 0) + bean.setNumero(12.0D); + bean.setNota("PUNTI DIMENSIONE CARATTERI RIGHE DI DEFAULT SE NON IMPOSTATO SU TIPO DOCUMENTO"); + bean.save(); + bean.findByCodice("DOC_FONT_ROW_SIZE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DOC_FONT_ROW_SIZE"); + bean.setDescrizione("DOC_FONT_ROW_SIZE"); + bean.setFlgTipo(1L); + if (bean.getNumeroInt() == 0) + bean.setNumero(12.0D); + bean.setNota("PUNTI DIMENSIONE CARATTERI RIGHE"); + bean.save(); + bean.findByCodice("DOC_POSIZIONE_NOTA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DOC_POSIZIONE_NOTA"); + bean.setDescrizione("DOC_POSIZIONE_NOTA"); + bean.setFlgTipo(1L); + if (bean.getNumeroInt() == 0) + bean.setNumero(1.0D); + bean.setNota("POSIZIONE NOTA: 0--> PRIMA DELLE RIGHE, 1--> DOPO LE RIGHE"); + bean.save(); + bean.findByCodice("MSG_AVVISO_PREN_EMAIL"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MSG_AVVISO_PREN_EMAIL"); + bean.setDescrizione("MSG_AVVISO_PREN_EMAIL"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("Gentile <%=cliente%>\n la prenotazione <%=ndocumento%> è disponibile presso il ns. negozio\n____firma___"); + bean.setNota("MESSAGGIO VIA EMAIL PER AVVISO PRENOTAZIONI"); + bean.save(); + bean.findByCodice("MSG_AVVISO_PREN_SMS"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MSG_AVVISO_PREN_SMS"); + bean.setDescrizione("MSG_AVVISO_PREN_SMS"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("Gentile <%=cliente%>\n la prenotazione <%=ndocumento%> e' disponibile presso il ns. negozio\n____firma___"); + bean.setNota("MESSAGGIO VIA SMS PER AVVISO PRENOTAZIONI"); + bean.save(); + bean.findByCodice("MSG_AVVISO_RIP_EMAIL"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MSG_AVVISO_RIP_EMAIL"); + bean.setDescrizione("MSG_AVVISO_RIP_EMAIL"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("Gentile <%=cliente%>\n l'oggetto relativo alla scheda riparazione n. <%=ndocumento%> è disponibile presso il ns. negozio\n____firma___"); + bean.setNota("MESSAGGIO VIA EMAIL PER AVVISO RIPARAZIONI"); + bean.save(); + bean.findByCodice("MSG_AVVISO_RIP_SMS"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MSG_AVVISO_RIP_SMS"); + bean.setDescrizione("MSG_AVVISO_RIP_SMS"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("Gentile <%=cliente%>\n l'oggetto relativo alla scheda riparazione n. <%=ndocumento%> e' disponibile presso il ns. negozio\n____firma___"); + bean.setNota("MESSAGGIO VIA SMS PER AVVISO RIPARAZIONI"); + bean.save(); + bean.findByCodice("MSG_EMAIL_FROM"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MSG_EMAIL_FROM"); + bean.setDescrizione("MSG_EMAIL_FROM"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("XXX@XXX.COM"); + bean.setNota("CASELLA EMAIL FROM MESSAGGIO AVVISO VIA EMAIL"); + bean.save(); + bean.findByCodice("DESTINAZIONE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DESTINAZIONE"); + bean.setDescrizione("DESTINAZIONE"); + bean.setFlgTipo(1L); + bean.setNumero(1.0D); + bean.setNota("SE LA DESTINAZIONE E' LA STESSA DEL CLIENTE
1. STAMPA DESTINAZIONE IDEM
0. NON STAMPA NIENTE"); + bean.save(); + bean.findByCodice("STAMPA_NOME_DOCUMENTO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("STAMPA_NOME_DOCUMENTO"); + bean.setDescrizione("STAMPA_NOME_DOCUMENTO"); + bean.setFlgTipo(0L); + bean.setNota("NOME IDENTIFICATIVO DOCUMENTO PER LE STAMPE PDF. IL NOME E' DEL TIPO
[TIPODOC]-[PROG]-[PROGAGG]-[ANNODOC]-[NOMEDOC].PDF"); + bean.save(); + bean.findByCodice("STAMPA_BORDI_COLONNE_DOCUMENTO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("STAMPA_BORDI_COLONNE_DOCUMENTO"); + bean.setDescrizione("STAMPA_BORDI_COLONNE_DOCUMENTO"); + bean.setFlgTipo(1L); + bean.setNumero(0.0D); + bean.setNota("STAMPA AUTOMATICAMENTE I BORDI DEL CORPO SE SETTATO A 1 NEL METODO inserisciDescRigaDocumentoNew DI DOCUMENTO"); + bean.save(); + bean.findByCodice("STAMPA_INDENTAZIONE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("STAMPA_INDENTAZIONE"); + bean.setDescrizione("STAMPA_INDENTAZIONE"); + bean.setFlgTipo(1L); + bean.setNumero(1.0D); + bean.setNota("STAMPA AUTOMATICAMENTE UN'INDENTAZIONE SULLE RIGHE SUCCESSIVE ALLA PRIMA SE SETTATO A 1 NEL METODO inserisciDescRigaDocumentoNew DI DOCUMENTO"); + bean.save(); + l_tipoParm = "SMS"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("SMS_PDU"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SMS_PDU"); + bean.setDescrizione("SMS_PDU"); + bean.setFlgTipo(5L); + bean.setNota("INDICA SE IL MESSAGGIO DEVE ESSERE INVIATO IN FORMATO PDU"); + bean.save(); + bean.findByCodice("SMS_SERVER"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SMS_SERVER"); + bean.setDescrizione("SMS_SERVER"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("localhost"); + bean.setNota("INDIRIZZO IP SMS GATEWAY SERVER. INDIRIZZO IP O NOME HOST"); + bean.save(); + bean.findByCodice("SMS_PORT"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SMS_PORT"); + bean.setDescrizione("SMS_PORT"); + bean.setFlgTipo(1L); + if (bean.getNumeroInt() == 0) + bean.setNumero(441.0D); + bean.setNota("PORTA SMS GATEWAY SERVER. DEFAULT 443"); + bean.save(); + l_tipoParm = "MAILING LIST"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("MAIL_LIST_ON"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIL_LIST_ON"); + bean.setDescrizione("MAIL_LIST_ON"); + bean.setFlgTipo(5L); + bean.setNota("false: MAILING LIST OFF
true: MAILING LIST ON (NECESSITA DI CONFIGURAZIONI LATO SERVER)"); + bean.save(); + bean.findByCodice("MAIL_LIST_FILE_CR"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIL_LIST_FILE_CR"); + bean.setDescrizione("MAIL_LIST_FILE_CR"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_tmp/list.txt"); + bean.setNota("PATH RELATIVO A DOCBASE DEL FILE list MAILING LIST. UTILIZZATA PER ANAGRAFICA CLIENTI"); + bean.save(); + bean.findByCodice("MAIL_LIST_MAIL_CR"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIL_LIST_MAIL_CR"); + bean.setDescrizione("MAIL_LIST_MAIL_CR"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("newsletter@dominio.it"); + bean.setNota("INDIRIZZO MAIL PER INVIO MAILING LIST ANAGRAFICHE."); + bean.save(); + l_tipoParm = "LABEL"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("LABEL_ANAG_SIZE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_ANAG_SIZE"); + bean.setDescrizione("LABEL_ANAG_SIZE"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("57,32"); + bean.setNota("DIMENSIONE ETICHETTA STAMPA SU ZEBRA ANAGRAFICHE IN mm. xx,yy"); + bean.save(); + bean.findByCodice("LABEL_ANAG_FONT_SIZE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_ANAG_FONT_SIZE"); + bean.setDescrizione("LABEL_ANAG_FONT_SIZE"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(10.0D); + bean.setNota("DIMENSIONE FONT ETICHETTA PER ANAGRAFICHE."); + bean.save(); + bean.findByCodice("LABEL_ANAG_A4_COL_ROW"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_ANAG_A4_COL_ROW"); + bean.setDescrizione("LABEL_ANAG_A4_COL_ROW"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("4,10"); + bean.setNota("DIMENSIONE ETICHETTA STAMPA SU A4 ANAGRAFICA IN NUMERO COLONNE,RIGHE col,row"); + bean.save(); + bean.findByCodice("LABEL_ANAG_A4_MARGINE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_ANAG_A4_MARGINE"); + bean.setDescrizione("LABEL_ANAG_A4_MARGINE"); + bean.setFlgTipo(1L); + bean.setNota("DIMENSIONE MARGINE PER STAMPA ETICHETTE ANAGRAFICHE SU A4 ARTICOLI (DI SOLITO 2)"); + bean.save(); + bean.findByCodice("LABEL_ART_SIZE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_ART_SIZE"); + bean.setDescrizione("LABEL_ART_SIZE"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("57,32"); + bean.setNota("DIMENSIONE ETICHETTA STAMPA SU ZEBRA ARTICOLI IN mm. xx,yy"); + bean.save(); + bean.findByCodice("LABEL_ART_FONT_SIZE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_ART_FONT_SIZE"); + bean.setDescrizione("LABEL_ART_FONT_SIZE"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(6.0D); + bean.setNota("DIMENSIONE FONT ETICHETTA PER ARTICOLI."); + bean.save(); + bean.findByCodice("LABEL_ART_A4_ZEBRA"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_ART_A4_ZEBRA"); + bean.setDescrizione("LABEL_ART_A4_ZEBRA"); + bean.setFlgTipo(5L); + bean.setNota("0 O FALSE: STAMPA ETICHETTE IN A4
1 O TRUE: STAMPA ETICHETTE SU ZEBRA (O SIMILI)"); + bean.save(); + bean.findByCodice("LABEL_ART_A4_COL_ROW"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_ART_A4_COL_ROW"); + bean.setDescrizione("LABEL_ART_A4_COL_ROW"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("4,10"); + bean.setNota("DIMENSIONE ETICHETTA STAMPA SU A4 ARTICOLI IN NUMERO COLONNE,RIGHE col,row"); + bean.save(); + bean.findByCodice("LABEL_ART_A4_MARGINE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_ART_A4_MARGINE"); + bean.setDescrizione("LABEL_ART_A4_MARGINE"); + bean.setFlgTipo(1L); + bean.setNota("DIMENSIONE MARGINE PER STAMPA ETICHETTE A4 ARTICOLI (DI SOLITO 2)"); + bean.save(); + bean.findByCodice("LABEL_ART_ACC_FONT_SIZE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_ART_ACC_FONT_SIZE"); + bean.setDescrizione("LABEL_ART_ACC_FONT_SIZE"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(5.0D); + bean.setNota("DIMENSIONE FONT ETICHETTA PER LABEL ACCESSORI ARTICOLI."); + bean.save(); + bean.findByCodice("LABEL_PK_LIST_SIZE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_PK_LIST_SIZE"); + bean.setDescrizione("LABEL_PK_LIST_SIZE"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("159,104"); + bean.setNota("DIMENSIONE ETICHETTA PAKING LIST STAMPA SU ZEBRA ARTICOLI IN mm. xx,yy"); + bean.save(); + bean.findByCodice("LABEL_PK_LIST_FONT_SIZE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_PK_LIST_FONT_SIZE"); + bean.setDescrizione("LABEL_PK_LIST_FONT_SIZE"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(6.0D); + bean.setNota("DIMENSIONE FONT ETICHETTA PER LABEL PACKING LIST ARTICOLI."); + bean.save(); + bean.findByCodice("LABEL_PK_LIST_A4_ZEBRA"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_PK_LIST_A4_ZEBRA"); + bean.setDescrizione("LABEL_PK_LIST_A4_ZEBRA"); + bean.setFlgTipo(5L); + bean.setNota("0 O FALSE: STAMPA ETICHETTE PACKING LIST IN A4
1 O TRUE: STAMPA ETICHETTE SU ZEBRA (O SIMILI)"); + bean.save(); + bean.findByCodice("LABEL_PK_LIST_A4_COL_ROW"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_PK_LIST_A4_COL_ROW"); + bean.setDescrizione("LABEL_PK_LIST_A4_COL_ROW"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("2,2"); + bean.setNota("DIMENSIONE ETICHETTA PAKING LIST STAMPA SU A4 ARTICOLI IN NUMERO COLONNE,RIGHE col,row"); + bean.save(); + bean.findByCodice("LABEL_PK_LIST_A4_MARGINE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LABEL_PK_LIST_A4_MARGINE"); + bean.setDescrizione("LABEL_PK_LIST_A4_MARGINE"); + bean.setFlgTipo(1L); + bean.setNota("DIMENSIONE MARGINE PER STAMPA ETICHETTE PACKING LIST SU A4 ARTICOLI (DI SOLITO 2)"); + bean.save(); + l_tipoParm = "ADMIN"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("DBNAME2"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DBNAME2"); + bean.setDescrizione("DBNAME2"); + bean.setFlgTipo(0L); + bean.setNumero(0.0D); + bean.setNota("PERCORSO DB NUMERO SUPPLEMENTARE (ES. PER IMPORTAZIONI)"); + bean.save(); + bean.findByCodice("DBDRIVER2"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DBDRIVER2"); + bean.setDescrizione("DBDRIVER2"); + bean.setFlgTipo(1L); + bean.setNota("DRIVER DB NUMERO SUPPLEMENTARE (ES. PER IMPORTAZIONI)"); + bean.save(); + bean.findByCodice("USER2"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("USER2"); + bean.setDescrizione("USER2"); + bean.setFlgTipo(0L); + bean.setNota("UTENTE DB NUMERO SUPPLEMENTARE (ES. PER IMPORTAZIONI)"); + bean.save(); + bean.findByCodice("PASSWORD2"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PASSWORD2"); + bean.setDescrizione("PASSWORD2"); + bean.setFlgTipo(0L); + bean.setNota("PASSWORD DB NUMERO SUPPLEMENTARE (ES. PER IMPORTAZIONI)"); + bean.save(); + bean.findByCodice("SCONTO_3_PERCENTUALI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SCONTO_3_PERCENTUALI"); + bean.setDescrizione("SCONTO_3_PERCENTUALI"); + bean.setFlgTipo(5L); + bean.setNota("SE TRUE UTILIZZIAMO LE 3 PERCENTUALI DI SCONTO"); + bean.save(); + l_tipoParm = "MAGAZZINO"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("USA_MAGAZZINO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("USA_MAGAZZINO"); + bean.setDescrizione("USA MAGAZZINO SU ARTICOLI"); + bean.setFlgTipo(5L); + bean.setTesto(""); + bean.setNota("FLAG USA MAGAZZINO. SERVE PER PRENDERE LA QUANTITA' TRAMITE I MOVIMENTI SU RIGA DOCUMENTO (0 false, DEFAULT)
SE 1 TRUE LE QUANTITA' LE PRENDO DIRETTAMENTE DAI VALORI IMPOSTATI SU ARTICOLO O ARTICOLO VARIANTE OPPURE DIRETTAMENTE DALLE TABELLA ARTICOLO O ARTICOLO_VARIANTE (ES. ZANIERI). NON C'E' IN QUESTO CASO UNA GESTIONE VERA E PROPRIA DEL MAGAZZINO. UTILIZZATO NEL CASO IN CUI LE QUANTITà VENGANO AGGIORNATE TRAMITE CRONTAB DA UN PROGRAMMA ESTERNO"); + bean.save(); + bean.findByCodice("USA_QUANTITA_INTERE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("USA_QUANTITA_INTERE"); + bean.setDescrizione("USA QUANTITA' INTERE, SUPRATTUTTO IN STAMPA DOCUMENTI"); + bean.setFlgTipo(5L); + bean.setTesto(""); + bean.setNota("SE VERO, SULLE STAMPE CONSIDERO QUANTITA' INTERE"); + bean.save(); + bean.findByCodice("STORNO_ORDINE_A_FORNITORE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("STORNO_ORDINE_A_FORNITORE"); + bean.setDescrizione("STORNO_ORDINE_A_FORNITORE"); + bean.setFlgTipo(1L); + bean.setTesto(""); + bean.setNota("CAUSALE I MAGAZZINO DI STORNO PER LA CHIUSURA DI RIGHE ORDINE A FORNITORE PRIMA DELLO SCARICO DI TUTTA LA QUANTITA' ORDINATA."); + bean.save(); + l_tipoParm = "SEISOFT"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("SEISOFT_CONTO_RM_IVA_ESENTE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SEISOFT_CONTO_RM_IVA_ESENTE"); + bean.setDescrizione("SEISOFT_CONTO_RM_IVA_ESENTE"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("rm36"); + bean.setNota("SEISOFT_CONTO_RM_IVA_ESENTE"); + bean.save(); + bean.findByCodice("SEISOFT_CONTO_NOL_AZ"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SEISOFT_CONTO_NOL_AZ"); + bean.setDescrizione("SEISOFT_CONTO_NOL_AZ"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("2020"); + bean.setNota("SEISOFT_CONTO_NOL_AZ"); + bean.save(); + bean.findByCodice("SEISOFT_CONTO_RM_IVA_VEND"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SEISOFT_CONTO_RM_IVA_VEND"); + bean.setDescrizione("SEISOFT_CONTO_RM_IVA_VEND"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("rm22"); + bean.setNota("SEISOFT_CONTO_RM_IVA_VEND"); + bean.save(); + bean.findByCodice("SEISOFT_CONTO_NOL_PRIV"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SEISOFT_CONTO_NOL_PRIV"); + bean.setDescrizione("SEISOFT_CONTO_NOL_PRIV"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("2021"); + bean.setNota("SEISOFT_CONTO_NOL_PRIV"); + bean.save(); + bean.findByCodice("SEISOFT_CONTO_SPESE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SEISOFT_CONTO_SPESE"); + bean.setDescrizione("SEISOFT_CONTO_SPESE"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("0099"); + bean.setNota("SEISOFT_CONTO_SPESE"); + bean.save(); + bean.findByCodice("SEISOFT_CONTO_VEND_AZ"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SEISOFT_CONTO_VEND_AZ"); + bean.setDescrizione("SEISOFT_CONTO_VEND_AZ"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("0001"); + bean.setNota("SEISOFT_CONTO_VEND_AZ"); + bean.save(); + bean.findByCodice("SEISOFT_CONTO_VEND_PRIV"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SEISOFT_CONTO_VEND_PRIV"); + bean.setDescrizione("SEISOFT_CONTO_VEND_PRIV"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("0002"); + bean.setNota("SEISOFT_CONTO_VEND_PRIV"); + bean.save(); + bean.findByCodice("SEISOFT_CONTO_VEND_PRIV_USATO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SEISOFT_CONTO_VEND_PRIV_USATO"); + bean.setDescrizione("SEISOFT_CONTO_VEND_PRIV_USATO"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("2030"); + bean.setNota("SEISOFT_CONTO_VEND_PRIV_USATO"); + bean.save(); + bean.findByCodice("SEISOFT_CONTO_VEND_AZ_USATO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SEISOFT_CONTO_VEND_AZ_USATO"); + bean.setDescrizione("SEISOFT_CONTO_VEND_AZ_USATO"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("2030"); + bean.setNota("SEISOFT_CONTO_VEND_AZ_USATO"); + bean.save(); + l_tipoParm = "WWW"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("WEB_SEND_ORDER_MAIL_CODE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("WEB_SEND_ORDER_MAIL_CODE"); + bean.setDescrizione("WEB_SEND_ORDER_MAIL_CODE"); + bean.setFlgTipo(1L); + bean.setNota("MODELLI INVIO ORDINE WWW AD HOC
0 --> STANDARD
1--> RAVINALE
2--> TUTTOFOTO
99--> FRAMEWORK CC"); + bean.save(); + bean.findByCodice("QTA_MINIMA_VISIBILE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("QTA_MINIMA_VISIBILE"); + bean.setDescrizione("QTA_MINIMA_VISIBILE"); + bean.setFlgTipo(1L); + bean.setNota("QUANTITA' MINIMA PER LA VISUALIZZAZIONE DELL'ARTICOLO SU WEB"); + bean.save(); + bean.findByCodice("ORDINI_WEB_ORE_ANNULLAMENTO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ORDINI_WEB_ORE_ANNULLAMENTO"); + bean.setDescrizione("ORDINI_WEB_ORE_ANNULLAMENTO"); + bean.setFlgTipo(1L); + bean.setNota("ORE DOPO LE QUALI L'ORDINE WEB NON FINALIZZATO VIENE CANCELLATO
0--> IGNORA"); + bean.save(); + bean.findByCodice("USE_SEARCH_LAST_2_OCCURRENCE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("USE_SEARCH_LAST_2_OCCURRENCE"); + bean.setDescrizione("USE_SEARCH_LAST_2_OCCURRENCE"); + bean.setFlgTipo(5L); + bean.setNota("SE USE_FULL_TEXT E' DISATTIVATO, EFFETTUA LA RICERCA SMART PER OCCORRENZE, FALSE SOLO LE OCCORRENZE + ALTE, TRUE LE 2 OCCORRENZE + ALTE"); + bean.save(); + l_tipoParm = "RIBA AZIENDA"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("AZIENDA_CODICE_SIA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("AZIENDA_CODICE_SIA"); + bean.setDescrizione("AZIENDA_CODICE_SIA"); + bean.setFlgTipo(0L); + bean.setNota("CODICE DELL'AZIENDA ATTRIBUITO DALLA SIA."); + bean.save(); + bean.findByCodice("AZIENDA_PIVA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("AZIENDA_PIVA"); + bean.setDescrizione("AZIENDA_PIVA"); + bean.setFlgTipo(0L); + bean.setNota("PARTITA IVA DELL'AZIENDA."); + bean.save(); + l_tipoParm = "RIBA"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("PATH_FILE_RIBA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PATH_FILE_RIBA"); + bean.setDescrizione("PATH_FILE_RIBA"); + bean.setFlgTipo(0L); + bean.setTesto("_tmp/riba/"); + bean.setNota("PATH DI DESTINAZIONE DEI FILE RIBA."); + bean.save(); + l_tipoParm = "MENU SIDEBAR"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("MNU_DOC_STD"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_DOC_STD"); + bean.setDescrizione("MNU_DOC_STD"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR DOCUMENTI E ANAGRAFICHE"); + bean.save(); + bean.findByCodice("MNU_COAVE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_COAVE"); + bean.setDescrizione("MNU_COAVE"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR AUTONOLEGGIO "); + bean.save(); + bean.findByCodice("MNU_CONTRATTI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_CONTRATTI"); + bean.setDescrizione("MNU_CONTRATTI"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR CONTRATTI"); + bean.save(); + bean.findByCodice("MNU_WWW"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_WWW"); + bean.setDescrizione("MNU_WWW"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR WWW"); + bean.save(); + bean.findByCodice("MNU_BANNER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_BANNER"); + bean.setDescrizione("MNU_BANNER"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR BANNER"); + bean.save(); + bean.findByCodice("MNU_CONFIG_ADMIN"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_CONFIG_ADMIN"); + bean.setDescrizione("MNU_CONFIG_ADMIN"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR CONFIGURAZIONE ADMIN"); + bean.save(); + bean.findByCodice("MNU_CONFIG_ANAG"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_CONFIG_ANAG"); + bean.setDescrizione("MNU_CONFIG_ANAG"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR CONFIGURAZIONE ANAGRAFICHE"); + bean.save(); + bean.findByCodice("MNU_CONFIG_ART"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_CONFIG_ART"); + bean.setDescrizione("MNU_CONFIG_ART"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR CONFIGURAZINE ARTICOLI"); + bean.save(); + bean.findByCodice("MNU_CONFIG_CONTAB"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_CONFIG_CONTAB"); + bean.setDescrizione("MNU_CONFIG_CONTAB"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR CONFIGURAZIONE CONTABILITA'"); + bean.save(); + bean.findByCodice("MNU_FILATI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_FILATI"); + bean.setDescrizione("MNU_FILATI"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR FILATI"); + bean.save(); + bean.findByCodice("MNU_LAVORAZIONI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_LAVORAZIONI"); + bean.setDescrizione("MNU_LAVORAZIONI"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR LAVORAZIONI"); + bean.save(); + bean.findByCodice("MNU_NEWS"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_NEWS"); + bean.setDescrizione("MNU_NEWS"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR NEWS"); + bean.save(); + bean.findByCodice("MNU_NEWSLETTER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_NEWSLETTER"); + bean.setDescrizione("MNU_NEWSLETTER"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR NEWSLETTER"); + bean.save(); + bean.findByCodice("MNU_TESSUTI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_TESSUTI"); + bean.setDescrizione("MNU_TESSUTI"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR TESSUTI"); + bean.save(); + bean.findByCodice("MNU_TESSITURA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_TESSITURA"); + bean.setDescrizione("MNU_TESSITURA"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR TESSITURA"); + bean.save(); + bean.findByCodice("MNU_CONFEZIONE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_CONFEZIONE"); + bean.setDescrizione("MNU_CONFEZIONE"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR CONFEZIONI"); + bean.save(); + bean.findByCodice("MNU_CC"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_CC"); + bean.setDescrizione("MNU_CC"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR ECOMMERCE"); + bean.save(); + bean.findByCodice("MNU_FACE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_FACE"); + bean.setDescrizione("MNU_FACE"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR FACE"); + bean.save(); + bean.findByCodice("MNU_FR"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_FR"); + bean.setDescrizione("MNU_FR"); + bean.setFlgTipo(5L); + bean.setNota("MENU SIDEBAR FACE RECOGNITION"); + bean.save(); + l_tipoParm = "MENU MAIN"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("MNU_M_DOC_STD"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_DOC_STD"); + bean.setDescrizione("MNU_M_DOC_STD"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN STANDARD DOCUMENTI E ANAGRAFICHE"); + bean.save(); + bean.findByCodice("MNU_M_COAVE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_COAVE"); + bean.setDescrizione("MNU_M_COAVE"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN COAVE. NON ATTIVARE MENU DOC STD"); + bean.save(); + bean.findByCodice("MNU_M_CASSA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_CASSA"); + bean.setDescrizione("MNU_M_CASSA"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN CASSA"); + bean.save(); + bean.findByCodice("MNU_M_EBAY"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_EBAY"); + bean.setDescrizione("MNU_M_EBAY"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN EBAY"); + bean.save(); + bean.findByCodice("MNU_M_PRENOTAZIONI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_PRENOTAZIONI"); + bean.setDescrizione("MNU_M_PRENOTAZIONI"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN PRENOTAZIONI"); + bean.save(); + bean.findByCodice("MNU_M_RIPARAZIONI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_RIPARAZIONI"); + bean.setDescrizione("MNU_M_RIPARAZIONI"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN RIPARAZIONI"); + bean.save(); + bean.findByCodice("MNU_M_ORDINI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_ORDINI"); + bean.setDescrizione("MNU_M_ORDINI"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN ORDINI"); + bean.save(); + bean.findByCodice("MNU_M_FILATI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_FILATI"); + bean.setDescrizione("MNU_M_FILATI"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN FILATI"); + bean.save(); + bean.findByCodice("MNU_M_TESSUTI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_TESSUTI"); + bean.setDescrizione("MNU_M_TESSUTI"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN TESSUTI"); + bean.save(); + bean.findByCodice("MNU_M_TESSITURA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_TESSITURA"); + bean.setDescrizione("MNU_M_TESSITURA"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN TESSITURA"); + bean.save(); + bean.findByCodice("MNU_M_TESSITURA_PRODUZIONE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_TESSITURA_PRODUZIONE"); + bean.setDescrizione("MNU_M_TESSITURA_PRODUZIONE"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN TESSITURA AVANZAMENTO PRODUZIONE"); + bean.save(); + bean.findByCodice("MNU_M_ARTICOLI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_ARTICOLI"); + bean.setDescrizione("MNU_M_ARTICOLI"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN GEST ARTICOLI"); + bean.save(); + bean.findByCodice("MNU_M_CC"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_CC"); + bean.setDescrizione("MNU_M_CC"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN ECOMMERCE"); + bean.save(); + bean.findByCodice("MNU_CC_GODMODE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_CC_GODMODE"); + bean.setDescrizione("MNU_CC_GODMODE"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN ECOMMERCE GODMODE PER ALTRI SITI ECOMMERCE VISIBILE SOLO DA UTENTE 1"); + bean.save(); + bean.findByCodice("MNU_M_CONFEZIONE"); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_CONFEZIONE"); + bean.setDescrizione("MNU_M_CONFEZIONE"); + bean.setFlgTipo(5L); + bean.setNota("MENU CONFEZIONI"); + bean.save(); + bean.findByCodice("MNU_M_FACE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_FACE"); + bean.setDescrizione("MNU_M_FACE"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN FACE"); + bean.save(); + bean.findByCodice("MNU_M_FR"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_M_FR"); + bean.setDescrizione("MNU_M_FR"); + bean.setFlgTipo(5L); + bean.setNota("MENU MAIN FACE RECOGNITION"); + bean.save(); + l_tipoParm = "MENU GESTIONE"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("MNU_GEST_ARTICOLI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_GEST_ARTICOLI"); + bean.setDescrizione("MNU_GEST_ARTICOLI"); + bean.setFlgTipo(5L); + bean.setNota("MENU GEST ARTICOLI"); + bean.save(); + bean.findByCodice("MNU_GEST_CONTATTI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_GEST_CONTATTI"); + bean.setDescrizione("MNU_GEST_CONTATTI"); + bean.setFlgTipo(5L); + bean.setNota("MENU GEST CONTATTI"); + bean.save(); + bean.findByCodice("MNU_GEST_PAGAMENTI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_GEST_PAGAMENTI"); + bean.setDescrizione("MNU_GEST_PAGAMENTI"); + bean.setFlgTipo(5L); + bean.setNota("MENU GEST PAGAMENTI"); + bean.save(); + bean.findByCodice("MNU_GEST_RIBA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_GEST_RIBA"); + bean.setDescrizione("MNU_GEST_RIBA"); + bean.setFlgTipo(5L); + bean.setNota("MENU GEST RIBA"); + bean.save(); + bean.findByCodice("MNU_GEST_SCADENZE"); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_GEST_SCADENZE"); + bean.setDescrizione("MNU_GEST_SCADENZE"); + bean.setFlgTipo(5L); + bean.setNota("MENU GEST SCADENZE"); + bean.save(); + l_tipoParm = "COSTI DEFAULT"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("PERC_RICARICO_DEFAULT"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PERC_RICARICO_DEFAULT"); + bean.setDescrizione("PERC_RICARICO_DEFAULT"); + bean.setFlgTipo(1L); + bean.setNota("PERCENTUALE DI RICARICO DI DEFAULT PER ARTICOLI"); + bean.save(); + bean.findByCodice("COSTO_SPESE_FISSE_DEFAULT"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("COSTO_SPESE_FISSE_DEFAULT"); + bean.setDescrizione("COSTO_SPESE_FISSE_DEFAULT"); + bean.setFlgTipo(1L); + bean.setNota("COSTO DEFAULT PER SPESE FISSE PER CAPO"); + bean.save(); + bean.findByCodice("COSTO_STIRO_DEFAULT"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("COSTO_STIRO_DEFAULT"); + bean.setDescrizione("COSTO_STIRO_DEFAULT"); + bean.setFlgTipo(1L); + bean.setNota("COSTO DEFAULT PER STIRO CONFEZIONI PER CAPO"); + bean.save(); + l_tipoParm = "DEFAULT VARI"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("CODICE_TIPO_TESSUTO_STD"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODICE_TIPO_TESSUTO_STD"); + bean.setDescrizione("CODICE_TIPO_TESSUTO_STD"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(2.0D); + bean.setNota("CODICE ID TIPO STANDARD TESSUTO SE NON SPECIFICATO"); + bean.save(); + l_tipoParm = "CC"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("CC_LIMITA_AMM"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CC_LIMITA_AMM"); + bean.setDescrizione("CC_LIMITA_AMM"); + bean.setFlgTipo(5L); + bean.setNota("LIMITA LA PARTE AMMINISTRATIVA PER CC"); + bean.save(); + bean.findByCodice("CC_CHECK_AVAIL"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CC_CHECK_AVAIL"); + bean.setDescrizione("CC_CHECK_AVAIL"); + bean.setFlgTipo(5L); + bean.setNota("SE VERO, PERMETTE DI ACQUISTARE SOLO SE L'ARTICOLO E' DISPONIBILE "); + bean.save(); + bean.findByCodice("CC_QTA_LOW"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CC_QTA_LOW"); + bean.setDescrizione("CC_QTA_LOW"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(5.0D); + bean.setNota("QUANTITA' > 0 SOTTO LA QUALE VIENE INDICATA SCORTA BASSA. DI SOLITO 5"); + bean.save(); + bean.findByCodice("CC_SOSPENDI_DOPO_N_GG_NO_IMPORT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CC_SOSPENDI_DOPO_N_GG_NO_IMPORT"); + bean.setDescrizione("CC_SOSPENDI_DOPO_N_GG_NO_IMPORT"); + bean.setFlgTipo(1L); + bean.setNota("NUMERO DI GIORNI CHE L'ARTICOLO NON E' STATO TROVATO DURANTE L'IMPORT DOPO I QUALI VIENE SOSPESO AUTOMATICAMENTE
SE 0 --> NON SOSPENDE MAI"); + bean.save(); + bean.findByCodice("CC_COSTO_SPED_FULL"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CC_COSTO_SPED_FULL"); + bean.setDescrizione("CC_COSTO_SPED_FULL"); + bean.setFlgTipo(5L); + bean.setNota("ATTIVA O DISATTIVA IL COSTO SPEDIZIONE PER ARTICOLO NAZIONE + CALCOLO PERCENTILE SUL CARRELLO"); + bean.save(); + bean.findByCodice("CC_ARROTONDA_PREZZO_A_EURO_SOPRA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CC_ARROTONDA_PREZZO_A_EURO_SOPRA"); + bean.setDescrizione("CC_ARROTONDA_PREZZO_A_EURO_SOPRA"); + bean.setFlgTipo(1L); + bean.setNota("PER L'AGGIORNAMENTO IN BASE AL NUOVO COSTO DI ACQUISTO. SE IL PREZZO FINALE CON IVA E' SUPERIORE A QUESTO VALORE --> AGGIORNO ALL'EURO SUPERIORE ALTRIMENTI AGGIORNO AL DECIMALE DEFINITO DA P_CC_ARROTONDA_DECIMALE_PER_PREZZI_BASSI SUPERIORE."); + bean.save(); + bean.findByCodice("CC_ARROTONDA_DECIMALE_PER_PREZZI_BASSI"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CC_ARROTONDA_DECIMALE_PER_PREZZI_BASSI"); + bean.setDescrizione("CC_ARROTONDA_DECIMALE_PER_PREZZI_BASSI"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(0.5D); + bean.setNota("PER L'AGGIORNAMENTO IN BASE AL NUOVO COSTO DI ACQUISTO. ARROTONDAMENTO DECIMALE PER PREZZI INFERIORE A P_CC_ARROTONDA_PREZZO_A_EURO_SOPRA
DI SOLITO ALMENO 0,5 MA POTREBBE ESSERE QUALSIASI VALORE DA 0,1 A 0,9. SE 1 ARROTONDA ALL'EURO SUPERIORE"); + bean.save(); + bean.findByCodice("CC_RICARICO_MINIMO_OFFERTE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CC_RICARICO_MINIMO_OFFERTE"); + bean.setDescrizione("CC_RICARICO_MINIMO_OFFERTE"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(5.0D); + bean.setNota("SE INSERISCO UNA PERCENTUALE DI SCONTO COME PREZZO OFFERTA, QUESTO NON DEVE ESSERE MAI INFERIORE A QUESTO VALORE!
METTO PER DEFAULT 5%"); + bean.save(); + bean.findByCodice("CC_LINK_WEB_CON_MARCA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CC_LINK_WEB_CON_MARCA"); + bean.setDescrizione("CC_LINK_WEB_CON_MARCA"); + bean.setFlgTipo(5L); + bean.setNota("inserisce come primo elemento la marca nel link per il web (getCCLinkDettaglio(...)"); + bean.save(); + bean.findByCodice("CC_N_ORDINI_WWW_AL_GIORNO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CC_N_ORDINI_WWW_AL_GIORNO"); + bean.setDescrizione("CC_N_ORDINI_WWW_AL_GIORNO"); + bean.setFlgTipo(1L); + bean.setNota("NUMERO DI ORDINI WWW AL GIORNO PER CALCOLO NON SEQUENZIALE DEI NUMERI ORDINE WWW. PER SIMULARE + ORDINI AL GIORNO"); + bean.save(); + l_tipoParm = "GOOGLE_REVIEW"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice(GoogleReview.P_GOOGLE_REVIEW_DATE); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(GoogleReview.P_GOOGLE_REVIEW_DATE); + bean.setDescrizione(GoogleReview.P_GOOGLE_REVIEW_DATE); + bean.setFlgTipo(2L); + bean.setNota("DATA ULTIMO ACCESSO A GOOGLE REVIEW"); + bean.save(); + bean.findByCodice(GoogleReview.P_GOOGLE_REVIEW_RATING); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(GoogleReview.P_GOOGLE_REVIEW_RATING); + bean.setDescrizione(GoogleReview.P_GOOGLE_REVIEW_RATING); + bean.setFlgTipo(1L); + bean.setNota("RATING ALLA DATA GOOGLE_REVIEW_DATE"); + bean.save(); + bean.findByCodice(GoogleReview.P_GOOGLE_REVIEW_USER_RATING_TOTALS); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(GoogleReview.P_GOOGLE_REVIEW_USER_RATING_TOTALS); + bean.setDescrizione(GoogleReview.P_GOOGLE_REVIEW_USER_RATING_TOTALS); + bean.setFlgTipo(1L); + bean.setNota("GOOGLE_REVIEW_USER_RATING_TOTALS ALLA DATA GOOGLE_REVIEW_DATE"); + bean.save(); + l_tipoParm = "GOOGLE"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("GOOGLE_FTP_USER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("GOOGLE_FTP_USER"); + bean.setDescrizione("GOOGLE_FTP_USER"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("mc-ftp-245429498"); + bean.setNota("USER FTP O SFTP PER GOOGLE MERCHANT"); + bean.save(); + bean.findByCodice("GOOGLE_FTP_PASSWORD"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("GOOGLE_FTP_PASSWORD"); + bean.setDescrizione("GOOGLE_FTP_PASSWORD"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("nJfuNd3EnxLJtHzQa"); + bean.setNota("PASSWORD FTP O SFTP PER GOOGLE MERCHANT"); + bean.save(); + bean.findByCodice("GOOGLE_USE_SFTP"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("GOOGLE_USE_SFTP"); + bean.setDescrizione("GOOGLE_USE_SFTP"); + bean.setFlgTipo(5L); + bean.setNota("SE TRUE UTILIZZA PROTOCOLLO SFTP"); + bean.save(); + bean.findByCodice("GOOGLE_PREZZO_PUBBLICO_MINIMO_X_EXPORT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("GOOGLE_PREZZO_PUBBLICO_MINIMO_X_EXPORT"); + bean.setDescrizione("GOOGLE_PREZZO_PUBBLICO_MINIMO_X_EXPORT"); + bean.setFlgTipo(1L); + bean.setNota("PER L'EXPORT SU MERCHANT, EVITIAMO DI ESPORTARE OGGETTI CHE COSTANO MENO DI QUESTO VALORE. SE ZERO OVVIAMENTE VIENE IGNORATO"); + bean.save(); + bean.findByCodice("GOOGLE_QTA_MINIMA_X_EXPORT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("GOOGLE_QTA_MINIMA_X_EXPORT"); + bean.setDescrizione("GOOGLE_QTA_MINIMA_X_EXPORT"); + bean.setFlgTipo(1L); + bean.setNota("PER L'EXPORT SU MERCHANT, EVITIAMO DI ESPORTARE OGGETTI CHE NON CI SONO O COMUNQUE SOTTO UNA CERTA QUANTITA..."); + bean.save(); + bean.findByCodice("GOOGLE_SIGNIN_CLIENT_ID"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("GOOGLE_SIGNIN_CLIENT_ID"); + bean.setDescrizione("GOOGLE_SIGNIN_CLIENT_ID"); + bean.setFlgTipo(0L); + bean.setNota("SIGNIN CLIENT ID PER ACCESSO TRAMITE GOOGLE. DEVE ESSERE TRUE P_GOOGLE_SIGNIN_ENABLE"); + bean.save(); + bean.findByCodice("GOOGLE_SIGNIN_ENABLE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("GOOGLE_SIGNIN_ENABLE"); + bean.setDescrizione("GOOGLE_SIGNIN_ENABLE"); + bean.setFlgTipo(5L); + bean.setNota("SE TRUE è ATTIVATO L'ACCESSO TRAMITE GOOGLE SUL SITO WEN (GOOGLE_SIGNIN_CLIENT_ID DEVE ESSERE VALIDO)"); + bean.save(); + l_tipoParm = "FACEBOOK"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("FACEBOOK_SIGNIN_CLIENT_ID"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FACEBOOK_SIGNIN_CLIENT_ID"); + bean.setDescrizione("FACEBOOK_SIGNIN_CLIENT_ID"); + bean.setFlgTipo(0L); + bean.setNota("SIGNIN CLIENT ID PER ACCESSO TRAMITE FACEBOOK. DEVE ESSERE TRUE FACEBOOK_SIGNIN_ENABLE"); + bean.save(); + bean.findByCodice("FACEBOOK_SIGNIN_SECRET_KEY"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FACEBOOK_SIGNIN_SECRET_KEY"); + bean.setDescrizione("FACEBOOK_SIGNIN_SECRET_KEY"); + bean.setFlgTipo(0L); + bean.setNota("SIGNIN SECRET ID PER ACCESSO TRAMITE FACEBOOK. DEVE ESSERE TRUE FACEBOOK_SIGNIN_ENABLE"); + bean.save(); + bean.findByCodice("FACEBOOK_SIGNIN_ENABLE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FACEBOOK_SIGNIN_ENABLE"); + bean.setDescrizione("FACEBOOK_SIGNIN_ENABLE"); + bean.setFlgTipo(5L); + bean.setNota("SE TRUE è ATTIVATO L'ACCESSO TRAMITE FACEBOOK SUL SITO WEB (FACEBOOK_SIGNIN_CLIENT_ID E FACEBOOK_SIGNIN_SECRET_KEY DEVE ESSERE VALIDO)"); + bean.save(); + DBAdapter.logDebug(debug, "anag.Users initParms: stop"); + _FeXmlAdapter.initApplicationParms(ap); + RemoteDevice.initApplicationParms(ap); + BrtApi.initApplicationParms(ap); + CodaMessaggi.initApplicationParms(ap); + Cart.initCartParms(ap); + News.initApplicationParms(ap); + XpayReq.initApplicationParms(ap); + SetefiReq.initApplicationParms(ap); + PayPalReq.initApplicationParms(ap); + PayPalReq.initApplicationParms(ap); + StripeResp.initApplicationParms(ap); + SellaReq.initApplicationParms(ap); + ConselReq.initApplicationParms(ap); + SellaPCreditReq.initApplicationParms(ap); + PosteReq.initApplicationParms(ap); + ShopnetReq.initApplicationParms(ap); + EbayAbliaApi.initApplicationParms(ap); + AmzSellerApi.initApplicationParms(ap); + BrtApi.initApplicationParms(ap); + StatusMsg.deleteMsgByTag(ap, "INIT"); + } + } + + public RegCassa getRegCassa() { + if (this.regCassa == null) { + Postazione postazione = new Postazione(getApFull()); + postazione.findByPrimaryKey(getId_postazione()); + setRegCassa(postazione.getRegCassa()); + } + return (this.regCassa == null) ? new RegCassa(getApFull()) : this.regCassa; + } + + public void setPostazione(Postazione postazione) { + setPostazione(postazione); + } + + protected void initFields() { + super.initFields(); + } + + public void setRegCassa(RegCassa regCassa) { + this.regCassa = regCassa; + } + + public PostazioneI getPostazione() { + this.postazione = (Postazione)getSecondaryObject((DBAdapter)this.postazione, Postazione.class, getId_postazione()); + return (PostazioneI)this.postazione; + } + + public void setId_postazione(long id_postazione) { + this.id_postazione = id_postazione; + setPostazione(null); + } + + public long getId_postazione() { + return this.id_postazione; + } + + public Vectumerator findByCR(UsersCR CR, int pageNumber, int pageRows) { + return findByCR(CR, pageNumber, pageRows); + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setClifor(Clifor clifor) { + this.clifor = clifor; + } + + public String getId_nazione() { + return (this.id_nazione == null) ? "" : this.id_nazione; + } + + public Nazione getNazione() { + this.nazione = (Nazione)getSecondaryObject(this.nazione, Nazione.class, getId_nazione()); + return this.nazione; + } + + public void setId_nazione(String id_nazione) { + this.id_nazione = id_nazione; + setNazione(null); + } + + public void setNazione(Nazione nazione) { + this.nazione = nazione; + } + + public String getCallingJsp() { + return (this.callingJsp == null) ? "" : this.callingJsp; + } + + public void setCallingJsp(String callingJsp) { + this.callingJsp = callingJsp; + } + + public ResParm sendLostPasswordMailMessage(String lostEmail, String lang) { + ResParm rp = new ResParm(true); + try { + String subject = getMailSubject(); + Users bean = new Users(getApFull()); + UsersCR CR = new UsersCR(); + CR.setEMail(lostEmail); + bean.findUsersByEmail(lostEmail); + if (bean.getDBState() == 1) { + MailMessage mf = new MailMessage(getApFull(), getLostPwdMailMessage(lang)); + mf.setQuestionMark(false); + mf.setString("login", bean.getLogin()); + if (bean.isSocialAccount()) { + mf.setString("pwd", bean.getSocialIdType() + " social account"); + mf.setString("extra", + translate("Puoi accedere tramite il tuo account", lang) + " " + translate("Puoi accedere tramite il tuo account", lang) + ".
" + bean.getSocialIdType() + " " + + translate("Se non puoi più accedere al tuo account", lang) + ", " + bean.getSocialIdType()); + } else { + mf.setString("pwd", bean.getPwd()); + } + mf.setString("nominativo", bean.getNominativo()); + mf.setString("nome", bean.getNome()); + mf.setString("cognome", bean.getCognome()); + rp = mf.sendMailMessageSystem(bean.getEMail(), subject + " - Richiesta Password ", true); + if (rp.getStatus()) + rp.setMsg("La tua password e' stata inviata correttamente all'indirizzo " + bean.getEMail()); + } else { + rp.setStatus(false); + rp.setMsg("Email non in archivio"); + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e.toString() + "\n" + e.toString()); + } + return rp; + } + + public ResParm sendUserDataMailMessage(String lang) { + ResParm rp = new ResParm(true); + try { + if (getDBState() == 1) { + String userMailMessage = getUserMailMessage(lang); + MailMessage mf = new MailMessage(getApFull(), userMailMessage); + mf.setQuestionMark(false); + if (!getControlCode().isEmpty()) + mf.setString("controlCode", getControlCode() + "&e=" + getControlCode()); + mf.setLong("id_users", getId_users()); + mf.setString("data", getDataFormat().format(new Date())); + mf.setString("login", getLogin()); + mf.setString("pwd", getPwd()); + mf.setString("nome", getNome()); + mf.setString("cognome", getCognome()); + mf.setString("piva", getClifor().getPIva()); + mf.setString("codfisc", getClifor().getCodFisc()); + mf.setString("indirizzo", getClifor().getIndirizzo()); + mf.setString("numero", getClifor().getNumeroCivico()); + if (getClifor().getCapZona().isEmpty()) { + mf.setString("cap", getClifor().getCapComune()); + } else { + mf.setString("cap", getClifor().getCapZona()); + } + mf.setString("citta", getClifor().getDescrizioneComune()); + mf.setString("provincia", getClifor().getProvinciaComune()); + mf.setString("nazione", getClifor().getNazione().getDescrizione(lang)); + mf.setString("telefono", getClifor().getCellulare() + " " + getClifor().getCellulare()); + mf.setString("fax", getClifor().getFax()); + mf.setString("email", getClifor().getEMail()); + mf.setString("codSDI", getClifor().getCodiceIdentificativoFE()); + mf.setString("pec", getClifor().getPec()); + if (getClifor().getCurrentDD().getId_destinazioneDiversa() > 0L) { + if (getClifor().getCurrentDD().getPressoDD().isEmpty()) { + mf.setString("indirizzoSped", getClifor().getCurrentDD().getIndirizzoDD()); + } else { + mf.setString("indirizzoSped", " c/o " + + getClifor().getCurrentDD().getPressoDD() + "
" + getClifor().getCurrentDD().getIndirizzoDD()); + } + mf.setString("numeroSped", getClifor().getCurrentDD().getNumeroCivicoDD()); + if (getClifor().getCurrentDD().getCapZonaDD().isEmpty()) { + mf.setString("capSped", getClifor().getCurrentDD().getCapComuneDD()); + } else { + mf.setString("capSped", getClifor().getCurrentDD().getCapZonaDD()); + } + mf.setString("cittaSped", getClifor().getCurrentDD().getDescrizioneComuneDD()); + mf.setString("provinciaSped", getClifor().getCurrentDD().getProvinciaComuneDD()); + mf.setString("nazioneSped", getClifor().getCurrentDD().getNazioneDD().getDescrizione(lang)); + } else { + mf.setString("indirizzoSped", getClifor().getIndirizzo()); + mf.setString("numeroSped", getClifor().getNumeroCivico()); + if (getClifor().getCapZona().isEmpty()) { + mf.setString("capSped", getClifor().getCapComune()); + } else { + mf.setString("capSped", getClifor().getCapZona()); + } + mf.setString("cittaSped", getClifor().getDescrizioneComune()); + mf.setString("provinciaSped", getClifor().getProvinciaComune()); + mf.setString("nazioneSped", getClifor().getNazione().getDescrizione(lang)); + } + MailProperties mp = new MailProperties(); + mp.setProperty("TO", getEMail()); + String mailBcc = getMailTo(); + if (!getMailToSfx("USERS").isEmpty()) + mailBcc = mailBcc + "," + mailBcc; + mp.setProperty("BCC", mailBcc); + mp.setProperty("SUBJECT", mf.getMailSubject() + " Conferma registrazione account utente "); + mp.setProperty("MSG", mf.getMessage()); + rp = mf.sendMailMessage(mp, false); + } else { + rp.setStatus(false); + rp.setMsg("Email non in archivio"); + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e.getMessage()); + } + return rp; + } + + public long getFlgOperatore() { + return this.flgOperatore; + } + + public void setFlgOperatore(long flgOperatore) { + this.flgOperatore = flgOperatore; + } + + public Vectumerator findUsersByFlgOperatore() { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + String s_Sql_order = " order by A.cognome, A.nome"; + String wc = " where dataFineVld is null"; + wc = buildWc(wc, "A.id_users <>1"); + wc = buildWc(wc, "A.flgValido='S'"); + wc = buildWc(wc, "A.flgOperatore=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findUsersWithWishlist() { + String s_Sql_Find = "select A.* from USERS as A inner join WISHLIST as B on A.id_users=B.id_users where B.flgAbilitaAvviso=1"; + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ByteArrayOutputStream creaLabelUtenteA4Pdf() { + long pHMarg = 2L; + long l_indent = 4L; + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + this.document = new Document(PageSize.A4, 0.0F, 0.0F, 0.0F, 0.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + long labelNumber = 0L; + int nCol = 4; + int nRow = 10; + float[] widths = { 1.0F, 1.0F, 1.0F, 1.0F }; + this.pdfPcorpo = new PdfPTable(widths); + this.pdfPcorpo.setWidthPercentage(100.0F); + findByPrimaryKey(getId_users()); + labelNumber = (long)addLabelUnUtenteA4Pdf("", nRow, 1L, getDescrizione()); + if (labelNumber == 0L) { + Phrase ph = new Phrase("Attenzione! Non ci sono etichette da stampare!"); + PdfPCell cell = new PdfPCell(ph); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setIndent((float)l_indent); + cell.setBorder(0); + cell.setColspan(nCol); + this.pdfPcorpo.addCell(cell); + } else { + long numberBlankCell = (long)nCol - labelNumber % (long)nCol; + PdfPCell cell = new PdfPCell(); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setIndent((float)l_indent); + cell.setBorder(0); + if (numberBlankCell != (long)nCol) + for (int i = 0; (long)i < numberBlankCell; i++) + this.pdfPcorpo.addCell(cell); + } + this.document.add((Element)this.pdfPcorpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public int addLabelUnUtenteA4Pdf(String titolo, int nRow, long numberOflabel, String l_descrizione) { + long pHMarg = 2L; + long l_indent = 4L; + int totNumbOflabel = 0; + try { + int altezzaCod = 80; + int larghezzaCod = 360; + PdfContentByte cb = this.writer.getDirectContent(); + Barcode128 codeBar = new Barcode128(); + codeBar.setCodeType(9); + totNumbOflabel++; + PdfPCell cell = new PdfPCell(); + cell.setBorder(0); + codeBar.setCode(String.valueOf(getId_users())); + codeBar.setAltText(l_descrizione); + Image imgBarcode = codeBar.createImageWithBarcode(cb, null, null); + imgBarcode.scaleToFit((float)larghezzaCod, (float)altezzaCod); + cell.addElement(new Chunk(imgBarcode, 10.0F, (float)(-altezzaCod + 10))); + cell.setVerticalAlignment(4); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setIndent((float)l_indent); + this.pdfPcorpo.addCell(cell); + } catch (Exception e) { + e.printStackTrace(); + } + return totNumbOflabel; + } + + public long getFlgNews() { + return this.flgNews; + } + + public void setFlgNews(long flgNews) { + this.flgNews = flgNews; + } + + public Vectumerator findUsersAbilitatiNewsByNews(long l_id_news, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from USERS AS A "; + String s_Sql_order = " order by A.cognome, A.nome"; + String wc = " where dataFineVld is null"; + wc = buildWc(wc, "A.id_users <> 1"); + wc = buildWc(wc, "A.flgValido='S'"); + wc = buildWc(wc, "A.flgNews=1"); + wc = buildWc(wc, "A.id_users NOT IN (SELECT id_users FROM NEWS_USERS AS B where B.id_news = " + l_id_news + ")"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_documento() { + return this.id_documento; + } + + public void setId_documento(long id_documento) { + this.id_documento = id_documento; + } + + public Vectumerator findUsersByLogin() { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + String s_Sql_order = " order by A.cognome, A.nome"; + String wc = " where dataFineVld is null"; + wc = buildWc(wc, "A.id_users <>1"); + wc = buildWc(wc, "A.flgValido='S'"); + wc = buildWc(wc, "A.flgOperatore=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void creaFileEmailCvsByCR(UsersCR CR) { + try { + Vectumerator list = new Users(getApFull()).findByCR(CR, 0, 0); + CR.setFileName(getPathTmp() + "/" + getPathTmp() + "_" + DBAdapter.getTimestamp().getTime() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + outCvsFile.writeLine(CR.getDescrizioneCR()); + while (list.hasMoreElements()) { + Users row = (Users)list.nextElement(); + if (!row.getEMail().isEmpty()) + outCvsFile.writeLine(row.getEMail()); + } + outCvsFile.closeFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public boolean isProfileNoReg() { + if (getId_userProfile() == getIdUserProfileNoReg()) + return true; + return false; + } + + public boolean isProfiloWww() { + if (getId_userProfile() == getIdUserProfileWww()) + return true; + return false; + } + + public boolean isOkForCheckout() { + if (getEMail().isEmpty() || getClifor().getEMail().isEmpty() || !getClifor().isIndirizzoOk() || getClifor().getCodFisc().isEmpty() || ( + getClifor().getCellulare().isEmpty() && getClifor().getTelefono().isEmpty())) + return false; + return true; + } + + public boolean isProfilML() { + if (getId_userProfile() == getIdUserProfileMailingList()) + return true; + return false; + } + + public ResParm addArticoloToWishlist(Wishlist item, String l_lang) { + if (getId_users() == 0L) + return new ResParm(false, translate("Errore! Utente non trovato", l_lang)); + ResParm rp = new ResParm(); + Wishlist wl = new Wishlist(getApFull()); + wl.findByUserItem(getId_users(), item); + if (wl.getId_wishlist() > 0L) { + rp.setMsg(translate("L'articolo risulta già nella tua wishlist!", l_lang)); + } else { + wl.setId_articolo(item.getId_articolo()); + wl.setId_articoloVariante(item.getId_articoloVariante()); + wl.setId_articoloTaglia(item.getId_articoloTaglia()); + wl.setId_users(getId_users()); + wl.setDataWL(getToday()); + wl.setOraWL(getNow()); + wl.setDispoLevelWL(item.getDispoLevel()); + if (item.getId_articoloTaglia() > 0L) { + wl.setPrezzoWL(item.getArticoloTaglia().getPrice(getId_users())); + } else if (item.getId_articoloVariante() > 0L) { + wl.setPrezzoWL(item.getArticoloVariante().getPrice(getId_users())); + } else { + wl.setPrezzoWL(item.getArticolo().getPrice(getId_users())); + } + wl.setFlgAbilitaAvviso(1L); + rp = wl.save(); + if (rp.getStatus()) { + rp.setMsg(translate("L'articolo e' stato inserito nella tua wishlist!", l_lang)); + rp.setStatus(true); + } else { + rp.setMsg(translate("Errore! Impossibile inserire o inserito nella tua wishlist!", l_lang)); + rp.setStatus(true); + } + } + return rp; + } + + public Vectumerator findUsersByFlgMailingList() { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + String s_Sql_order = " order by A.cognome, A.nome"; + String wc = " where dataFineVld is null"; + wc = buildWc(wc, "A.id_users <>1"); + wc = buildWc(wc, "A.flgValido='S'"); + wc = buildWc(wc, "A.flgMl=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public boolean hasListinoPersonalizzato() { + if (getId_clifor() == 0L || getClifor().getId_listino() == 0L) + return false; + return true; + } + + public double getTariffaProfessionista() { + return this.tariffaProfessionista; + } + + public double getPercProfessionista() { + return this.percProfessionista; + } + + public void setTariffaProfessionista(double costoOrario) { + this.tariffaProfessionista = costoOrario; + } + + public void setPercProfessionista(double percServizi) { + this.percProfessionista = percServizi; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/UsersCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/UsersCR.java new file mode 100644 index 00000000..12e8fd2d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/UsersCR.java @@ -0,0 +1,29 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; + +public class UsersCR extends it.acxent.common.UsersCR { + private long flgOperatore; + + public UsersCR() {} + + public UsersCR(it.acxent.common.Users theUser) { + super(theUser); + } + + public UsersCR(ApplParmFull newAp) { + super(newAp); + } + + public UsersCR(ApplParmFull newAp, it.acxent.common.Users theUser) { + super(newAp, theUser); + } + + public long getFlgOperatore() { + return this.flgOperatore; + } + + public void setFlgOperatore(long flgOperatore) { + this.flgOperatore = flgOperatore; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Vettore.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Vettore.java new file mode 100644 index 00000000..719562a5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Vettore.java @@ -0,0 +1,215 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.fattele.FEDatiAnagraficiInterface; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Vettore extends _AnagAdapter implements Serializable, FEDatiAnagraficiInterface { + private long id_vettore; + + private long id_comune; + + private String descrizione; + + private String indirizzo; + + private String nominativo; + + private String numeroCivico; + + private String pIva; + + private String codFiscale; + + private String iscrizioneAlbo; + + private Comune comune; + + private String linkTracking; + + private String id_nazione; + + private Nazione nazione; + + public Vettore(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Vettore() {} + + public void setId_vettore(long newId_vettore) { + this.id_vettore = newId_vettore; + } + + public void setId_comune(long newId_comune) { + this.id_comune = newId_comune; + setComune(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setIndirizzo(String newIndirizzo) { + this.indirizzo = newIndirizzo; + } + + public void setNominativo(String newNominativo) { + this.nominativo = newNominativo; + } + + public void setNumeroCivico(String newNumeroCivico) { + this.numeroCivico = newNumeroCivico; + } + + public long getId_vettore() { + return this.id_vettore; + } + + public long getId_comune() { + return this.id_comune; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getIndirizzo() { + return (this.indirizzo == null) ? "" : this.indirizzo.trim(); + } + + public String getNominativo() { + return (this.nominativo == null) ? "" : this.nominativo.trim(); + } + + public String getNumeroCivico() { + return (this.numeroCivico == null) ? "" : this.numeroCivico.trim(); + } + + public void setComune(Comune newComune) { + this.comune = newComune; + } + + public Comune getComune() { + this.comune = (Comune)getSecondaryObject(this.comune, Comune.class, getId_comune()); + return this.comune; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(VettoreCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from VETTORE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void setLinkTracking(String newLinkTraking) { + this.linkTracking = newLinkTraking; + } + + public String getLinkTracking() { + return (this.linkTracking == null) ? "" : this.linkTracking; + } + + public String getPIva() { + return (this.pIva == null) ? "" : this.pIva.trim(); + } + + public void setPIva(String pIva) { + this.pIva = pIva; + } + + public String getCodFiscale() { + return (this.codFiscale == null) ? "" : this.codFiscale.trim(); + } + + public void setCodFiscale(String codFiscale) { + this.codFiscale = codFiscale; + } + + public String getIscrizioneAlbo() { + return (this.iscrizioneAlbo == null) ? "" : this.iscrizioneAlbo.trim(); + } + + public void setIscrizioneAlbo(String iscrizioneAlbo) { + this.iscrizioneAlbo = iscrizioneAlbo; + } + + public String getFEPartitaIva() { + return getPIva(); + } + + public String getFECodiceFiscale() { + return getCodFiscale(); + } + + public String getFEDenominazione() { + return getNominativo(); + } + + public String getFECognome() { + return null; + } + + public String getFENome() { + return null; + } + + public String getFETitolo() { + return null; + } + + public String getFECodEORI() { + return null; + } + + public String getFEPaese() { + return getId_nazione(); + } + + public String getId_nazione() { + return (this.id_nazione == null) ? "" : this.id_nazione.trim(); + } + + public Nazione getNazione() { + this.nazione = (Nazione)getSecondaryObject(this.nazione, Nazione.class, getId_nazione()); + return this.nazione; + } + + public void setId_nazione(String newId_nazione) { + this.id_nazione = newId_nazione; + setNazione(null); + } + + public void setNazione(Nazione newNazione) { + this.nazione = newNazione; + } + + public boolean isFEPaeseCEE() { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/VettoreCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/VettoreCR.java new file mode 100644 index 00000000..1e193b58 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/VettoreCR.java @@ -0,0 +1,86 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class VettoreCR extends CRAdapter { + private long id_vettore; + + private long id_comune; + + private String descrizione; + + private String indirizzo; + + private String nominativo; + + private String numeroCivico; + + private Comune comune; + + public VettoreCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public VettoreCR() {} + + public void setId_vettore(long newId_vettore) { + this.id_vettore = newId_vettore; + } + + public void setId_comune(long newId_comune) { + this.id_comune = newId_comune; + setComune(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setIndirizzo(String newIndirizzo) { + this.indirizzo = newIndirizzo; + } + + public void setNominativo(String newNominativo) { + this.nominativo = newNominativo; + } + + public void setNumeroCivico(String newNumeroCivico) { + this.numeroCivico = newNumeroCivico; + } + + public long getId_vettore() { + return this.id_vettore; + } + + public long getId_comune() { + return this.id_comune; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getIndirizzo() { + return (this.indirizzo == null) ? "" : this.indirizzo.trim(); + } + + public String getNominativo() { + return (this.nominativo == null) ? "" : this.nominativo.trim(); + } + + public String getNumeroCivico() { + return (this.numeroCivico == null) ? "" : this.numeroCivico.trim(); + } + + public void setComune(Comune newComune) { + this.comune = newComune; + } + + public Comune getComune() { + this.comune = (Comune)getSecondaryObject(this.comune, Comune.class, + + getId_comune()); + return this.comune; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Zona.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Zona.java new file mode 100644 index 00000000..3f9b21e8 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/Zona.java @@ -0,0 +1,73 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Zona extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1459504014751L; + + private long id_zona; + + private String descrizione; + + public Zona(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Zona() {} + + public void setId_zona(long newId_zona) { + this.id_zona = newId_zona; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_zona() { + return this.id_zona; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ZonaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ZONA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ZonaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ZonaCR.java new file mode 100644 index 00000000..e31afd8d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/ZonaCR.java @@ -0,0 +1,32 @@ +package it.acxent.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ZonaCR extends CRAdapter { + private long id_zona; + + private String descrizione; + + public ZonaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ZonaCR() {} + + public void setId_zona(long newId_zona) { + this.id_zona = newId_zona; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_zona() { + return this.id_zona; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/_AnagAdapter.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/_AnagAdapter.java new file mode 100644 index 00000000..719b2dc8 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/_AnagAdapter.java @@ -0,0 +1,1107 @@ +package it.acxent.anag; + +import com.lowagie.text.Cell; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.Image; +import com.lowagie.text.Table; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfWriter; +import it.acxent.cart.Cart; +import it.acxent.common.Parm; +import it.acxent.common.SimboliLavaggio; +import it.acxent.common.TtFont; +import it.acxent.contab.TipoDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.PdfFontFactory; +import it.acxent.util.StringTokenizer; +import java.awt.Color; +import java.io.File; +import java.util.Calendar; + +public class _AnagAdapter extends DBAdapter { + public static String KEY_ENCODE_DIZ = "Xg3Z5sFQ"; + + public static final long SF_BOZZA = 0L; + + public static final long SF_EMESSA = 1L; + + public static final long SF_REG_IVA = 2L; + + public static final String P_CC_LIMITA_AMM = "CC_LIMITA_AMM"; + + public static final String P_CC_CHECK_AVAIL = "CC_CHECK_AVAIL"; + + public static final String P_CC_QTA_LOW = "CC_QTA_LOW"; + + public static final String P_CC_SOSPENDI_DOPO_N_GG_NO_IMPORT = "CC_SOSPENDI_DOPO_N_GG_NO_IMPORT"; + + public static final String P_CC_ARROTONDA_PREZZO_A_EURO_SOPRA = "CC_ARROTONDA_PREZZO_A_EURO_SOPRA"; + + public static final String P_CC_ARROTONDA_DECIMALE_PER_PREZZI_BASSI = "CC_ARROTONDA_DECIMALE_PER_PREZZI_BASSI"; + + public static final String P_CC_RICARICO_MINIMO_OFFERTE = "CC_RICARICO_MINIMO_OFFERTE"; + + public static final String P_CC_LINK_WEB_CON_MARCA = "CC_LINK_WEB_CON_MARCA"; + + public static final String P_CC_N_ORDINI_WWW_AL_GIORNO = "CC_N_ORDINI_WWW_AL_GIORNO"; + + public static final String P_GOOGLE_USE_SFTP = "GOOGLE_USE_SFTP"; + + public static final String P_GOOGLE_FTP_USER = "GOOGLE_FTP_USER"; + + public static final String P_GOOGLE_FTP_PASSWORD = "GOOGLE_FTP_PASSWORD"; + + public static final String P_GOOGLE_PREZZO_PUBBLICO_MINIMO_X_EXPORT = "GOOGLE_PREZZO_PUBBLICO_MINIMO_X_EXPORT"; + + public static final String P_GOOGLE_QTA_MINIMA_X_EXPORT = "GOOGLE_QTA_MINIMA_X_EXPORT"; + + public static final String C_GOOGLE_FTP_SERVER = "uploads.google.com"; + + public static final String C_GOOGLE_SFTP_SERVER = "partnerupload.google.com"; + + public static final String C_GOOGLE_SFTP_KNOWN_HOSTS = "[partnerupload.google.com]:19321 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUvACPnrXEiscmd7NoP7diO1w3uP9uGJ55/SDL5eviKZhy/WLTLMGRcJDWj3GPRVdAy2xVVOU4IxUIK8nxdZP5O0s5bJVzT2XRP4IXYKUrPn7AkQlnifP7M0InAMnK7S1KHvwBgWBaGfb0OBeI46a+iKBduCMD9xER6ymTVbcgNzt1o52vNGTUiQp28Q5jUBs3yvQ8Ag7d4U0qEioV95ef4AbjDwO8jV09hQGjBIsTZoMo2Tmo+FVKah2YO0+QFKe1pk5zL2nXlgF7hUxN65lIeS3PhRZzVF80Qe5vXjjuKfiJVkBdSxLoq84uXx6XCjvWci2JbTUbsavoaDO3VBy5"; + + public static final int C_GOOGLE_SFTP_PORT = 19321; + + public static final String P_GOOGLE_SIGNIN_ENABLE = "GOOGLE_SIGNIN_ENABLE"; + + public static final String P_GOOGLE_SIGNIN_CLIENT_ID = "GOOGLE_SIGNIN_CLIENT_ID"; + + public static final String P_FACEBOOK_SIGNIN_ENABLE = "FACEBOOK_SIGNIN_ENABLE"; + + public static final String P_FACEBOOK_SIGNIN_CLIENT_ID = "FACEBOOK_SIGNIN_CLIENT_ID"; + + public static final String P_FACEBOOK_SIGNIN_SECRET_KEY = "FACEBOOK_SIGNIN_SECRET_KEY"; + + public static final String P_SEISOFT_CONTO_RM_IVA_ESENTE = "SEISOFT_CONTO_RM_IVA_ESENTE"; + + public static final String P_SEISOFT_CONTO_NOL_AZ = "SEISOFT_CONTO_NOL_AZ"; + + public static final String P_SEISOFT_CONTO_RM_IVA_VEND = "SEISOFT_CONTO_RM_IVA_VEND"; + + public static final String P_SEISOFT_CONTO_NOL_PRIV = "SEISOFT_CONTO_NOL_PRIV"; + + public static final String P_SEISOFT_CONTO_SPESE = "SEISOFT_CONTO_SPESE"; + + public static final String P_SEISOFT_CONTO_VEND_AZ = "SEISOFT_CONTO_VEND_AZ"; + + public static final String P_SEISOFT_CONTO_VEND_PRIV = "SEISOFT_CONTO_VEND_PRIV"; + + public static final String P_SEISOFT_CONTO_VEND_PRIV_USATO = "SEISOFT_CONTO_VEND_PRIV_USATO"; + + public static final String P_SEISOFT_CONTO_VEND_AZ_USATO = "SEISOFT_CONTO_VEND_AZ_USATO"; + + public static final String P_ORDINI_WEB_ORE_ANNULLAMENTO = "ORDINI_WEB_ORE_ANNULLAMENTO"; + + public static final String P_QTA_MINIMA_VISIBILE = "QTA_MINIMA_VISIBILE"; + + public static final String P_WEB_SEND_ORDER_MAIL_CODE = "WEB_SEND_ORDER_MAIL_CODE"; + + public static final String P_VARIANTI = "VARIANTI"; + + public static final String P_MSG_AVVISO_RIP_SMS = "MSG_AVVISO_RIP_SMS"; + + public static final String P_MAIL_INVIO_DOC = "MAIL_INVIO_DOC"; + + public static final String P_ART_SIMBOLI_LAVAGGIO_DEFAULT = "ART_SIMBOLI_LAVAGGIO_DEFAULT"; + + public static final String P_PATH_IMG_TIPO = "PATH_IMG_TIPO"; + + public static final String P_PATH_IMG_TAB_TAG = "PATH_IMG_TAB_TAG"; + + public static final String P_SERIALI_UNIVOCI = "SERIALI_UNIVOCI"; + + public static final String P_USE_SEARCH_LAST_2_OCCURRENCE = "USE_SEARCH_LAST_2_OCCURRENCE"; + + public static final String P_CASSA_STAMPA_DISPLAY1 = "CASSA_STAMPA_DISPLAY1"; + + public static final String P_CASSA_STAMPA_PROMO = "CASSA_STAMPA_PROMO"; + + public static final String P_CASSA_STAMPA_DISPLAY = "CASSA_STAMPA_DISPLAY"; + + public static final String P_AZIENDA_CODICE_SIA = "AZIENDA_CODICE_SIA"; + + public static final String P_AZIENDA_PIVA = "AZIENDA_PIVA"; + + public static final String P_PATH_FILE_RIBA = "PATH_FILE_RIBA"; + + public static final String P_CODICE_TIPO_TESSUTO_STD = "CODICE_TIPO_TESSUTO_STD"; + + public static final String P_ANAG_DESC_COMPLETA_CON_TIPO = "ANAG_DESC_COMPLETA_CON_TIPO"; + + public static final String P_ARTICOLO_CLIENTE = "ARTICOLO_CLIENTE"; + + public static final String P_B2B = "B2B"; + + protected static final float[] colWidthsRighe20 = new float[] { + 5.0F, 5.0F, 5.0F, 5.0F, 5.0F, 5.0F, 5.0F, 5.0F, 5.0F, 5.0F, + 5.0F, 5.0F, 5.0F, 5.0F, 5.0F, 5.0F, 5.0F, 5.0F, 5.0F, 5.0F }; + + protected static final float[] colWidthsRighe40 = new float[] { + 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, + 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, + 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, + 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F, 2.5F }; + + public static final Font PDF_fGrandissimo = PdfFontFactory.PDF_fGrandissimo; + + public static final Font PDF_fGrandissimoB = PdfFontFactory.PDF_fGrandissimoB; + + public static final Font PDF_fGrandissimoBianco = PdfFontFactory.PDF_fGrandissimoBianco; + + public static final Font PDF_fGrandissimoBlu = PdfFontFactory.PDF_fGrandissimoBlu; + + public static final Font PDF_fGrandissimoRouge = PdfFontFactory.PDF_fGrandissimoRouge; + + public static final Font PDF_fGrande = PdfFontFactory.PDF_fGrande; + + public static final Font PDF_fGrandeB = PdfFontFactory.PDF_fGrandeB; + + public static final Font PDF_fGrandeBianco = PdfFontFactory.PDF_fGrandeBianco; + + public static final Font PDF_fGrandeBlu = PdfFontFactory.PDF_fGrandeBlu; + + public static final Font PDF_fGrandeRouge = PdfFontFactory.PDF_fGrandeRouge; + + public static final Font PDF_fIntestazione = PdfFontFactory.PDF_fIntestazione; + + public static final Font PDF_fMedio = PdfFontFactory.PDF_fMedio; + + public static final Font PDF_fMedioB = PdfFontFactory.PDF_fMedioB; + + public static final Font PDF_fMedioBianco = PdfFontFactory.PDF_fMedioBianco; + + public static final Font PDF_fMedioBlu = PdfFontFactory.PDF_fMedioBlu; + + public static final Font PDF_fMedioRosso = PdfFontFactory.PDF_fMedioRosso; + + public static final Font PDF_fMedioRouge = PdfFontFactory.PDF_fMedioRouge; + + public static final Font PDF_fPiccolissimo = PdfFontFactory.PDF_fPiccolissimo; + + public static final Font PDF_fPiccolissimo6 = PdfFontFactory.PDF_fPiccolissimo6; + + public static final Font PDF_fPiccolissimoB = PdfFontFactory.PDF_fPiccolissimoB; + + public static final Font PDF_fPiccolo = PdfFontFactory.PDF_fPiccolo; + + public static final Font PDF_fPiccoloB = PdfFontFactory.PDF_fPiccoloB; + + public static final Font PDF_fPiccoloBianco = PdfFontFactory.PDF_fPiccoloBianco; + + public static final Font PDF_fPiccoloBlu = PdfFontFactory.PDF_fPiccoloBlu; + + public static final Font PDF_fPiccoloRosso = PdfFontFactory.PDF_fPiccoloRosso; + + public static final Font PDF_H_Grandissimo = PdfFontFactory.PDF_H_Grandissimo; + + public static final Font PDF_H_GrandissimoB = PdfFontFactory.PDF_H_GrandissimoB; + + public static final Font PDF_H_GrandissimoBianco = PdfFontFactory.PDF_H_GrandissimoBianco; + + public static final Font PDF_H_GrandissimoBlu = PdfFontFactory.PDF_H_GrandissimoBlu; + + public static final Font PDF_H_GrandissimoRouge = PdfFontFactory.PDF_H_GrandissimoRouge; + + public static final Font PDF_H_Grande = PdfFontFactory.PDF_H_Grande; + + public static final Font PDF_H_GrandeB = PdfFontFactory.PDF_H_GrandeB; + + public static final Font PDF_H_GrandeBianco = PdfFontFactory.PDF_H_GrandeBianco; + + public static final Font PDF_H_GrandeBlu = PdfFontFactory.PDF_H_GrandeBlu; + + public static final Font PDF_H_GrandeRouge = PdfFontFactory.PDF_H_GrandeRouge; + + public static final Font PDF_H_Intestazione = PdfFontFactory.PDF_H_Intestazione; + + public static final Font PDF_H_Medio = PdfFontFactory.PDF_H_Medio; + + public static final Font PDF_H_MedioB = PdfFontFactory.PDF_H_MedioB; + + public static final Font PDF_H_MedioBianco = PdfFontFactory.PDF_H_MedioBianco; + + public static final Font PDF_H_MedioBlu = PdfFontFactory.PDF_H_MedioBlu; + + public static final Font PDF_H_MedioRosso = PdfFontFactory.PDF_H_MedioRosso; + + public static final Font PDF_H_MedioRouge = PdfFontFactory.PDF_H_MedioRouge; + + public static final Font PDF_H_Piccolissimo = PdfFontFactory.PDF_H_Piccolissimo; + + public static final Font PDF_H_Piccolissimo6 = PdfFontFactory.PDF_H_Piccolissimo6; + + public static final Font PDF_A_PiccolissimoB = PdfFontFactory.PDF_A_PiccolissimoB; + + public static final Font PDF_A_Piccolo = PdfFontFactory.PDF_A_Piccolo; + + public static final Font PDF_A_PiccoloB = PdfFontFactory.PDF_A_PiccoloB; + + public static final Font PDF_A_PiccoloBianco = PdfFontFactory.PDF_A_PiccoloBianco; + + public static final Font PDF_A_PiccoloBlu = PdfFontFactory.PDF_A_PiccoloBlu; + + public static final Font PDF_A_PiccoloRosso = PdfFontFactory.PDF_A_PiccoloRosso; + + protected PdfPTable pdfPcorpo; + + protected Document document; + + protected PdfWriter writer; + + protected Table pdfcorpo; + + public static final String P_ORDINI_WWW_USA_PROG_WWW = "ORDINI_WWW_USA_PROG_WWW"; + + public static final String P_ID_DOC_CASSA = "ID_DOC_CASSA"; + + public static final String P_LABEL_ANAG_A4_MARGINE = "LABEL_ANAG_A4_MARGINE"; + + public static final String P_LABEL_ANAG_A4_COL_ROW = "LABEL_ANAG_A4_COL_ROW"; + + public static final String P_LABEL_ART_A4_MARGINE = "LABEL_ART_A4_MARGINE"; + + public static final String P_LABEL_ART_A4_COL_ROW = "LABEL_ART_A4_COL_ROW"; + + public static final String P_LABEL_PK_LIST_A4_ZEBRA = "LABEL_PK_LIST_A4_ZEBRA"; + + public static final String P_LABEL_PK_LIST_A4_COL_ROW = "LABEL_PK_LIST_A4_COL_ROW"; + + public static final String P_LABEL_PK_LIST_A4_MARGINE = "LABEL_PK_LIST_A4_MARGINE"; + + public static final String P_LABEL_ART_FONT_SIZE = "LABEL_ART_FONT_SIZE"; + + public static final String P_LABEL_ART_SIZE = "LABEL_ART_SIZE"; + + public static final String P_SCONTO_3_PERCENTUALI = "SCONTO_3_PERCENTUALI"; + + public static final String P_STAMPA_BORDI_COLONNE_DOCUMENTO = "STAMPA_BORDI_COLONNE_DOCUMENTO"; + + public static final String P_DATA_FATTURA_PRIMA_DISPONIBILE = "DATA_FATTURA_PRIMA_DISPONIBILE"; + + public static final String P_DOC_POSIZIONE_NOTA = "DOC_POSIZIONE_NOTA"; + + public static final String P_BLOCCO_FATTURE_EMSTA = "BLOCCO_FATTURE_EMSTA"; + + public static final String P_DOC_BANCA_APPOGGIO_IBAN = "DOC_BANCA_APPOGGIO_IBAN"; + + public static final String P_DOC_BANCA_APPOGGIO_DESC = "DOC_BANCA_APPOGGIO_DESC"; + + public static final String P_USA_MAGAZZINO_SU_ARTICOLI = "USA_MAGAZZINO"; + + public static final String P_USA_QUANTITA_INTERE = "USA_QUANTITA_INTERE"; + + public static final String P_STORNO_ORDINE_A_FORNITORE = "STORNO_ORDINE_A_FORNITORE"; + + public static final Font PDF_fMedioGrigio = PdfFontFactory.PDF_fMedioGrigio; + + public static final String P_TAGLIE = "TAGLIE"; + + public static final String P_PROGETTISTA_ARTICOLO = "PROGETTISTA_ARTICOLO"; + + public static final String P_CASSA_STAMPA_DISPLAY_TIMEOUT = "CASSA_STAMPA_DISPLAY_TIMEOUT"; + + public static final String P_DOC_BCC = "DOC_BCC"; + + public static final String P_OTTIMIZZO = "OTTIMIZZO"; + + public static final String P_PATH_IMG_ART = "PATH_IMG_ART"; + + public static final String P_MSG_ORDINE_SPEDITO = "MSG_ORDINE_SPEDITO"; + + public static final String P_ID_DOC_ORDINE = "ID_DOC_ORDINE"; + + public static final String P_ID_DOC_ORDINE_TAGLIO = "ID_DOC_ORDINE_TAGLIO"; + + public static final String P_LABEL_ART_ACC_FONT_SIZE = "LABEL_ART_ACC_FONT_SIZE"; + + public static final String P_LABEL_ART_A4_ZEBRA = "LABEL_ART_A4_ZEBRA"; + + public static final String P_LABEL_PK_LIST_FONT_SIZE = "LABEL_PK_LIST_FONT_SIZE"; + + public static final String P_LABEL_ANAG_SIZE = "LABEL_ANAG_SIZE"; + + public static final String P_LABEL_PK_LIST_SIZE = "LABEL_PK_LIST_SIZE"; + + public static final String P_LABEL_ANAG_FONT_SIZE = "LABEL_ANAG_FONT_SIZE"; + + public static final String P_ART_ATTACH_PATH = "ART_ATTACH_PATH"; + + public static final String P_TMPL_MSG_ATTACH_PATH = "TMPL_MSG_ATTACH_PATH"; + + public static final String P_MAIL_ADMIN_SCAD_CI = "MAIL_ADMIN_SCAD_CI"; + + public static final String P_ID_DOC_ORDINE_WWW = "ID_DOC_ORDINE_WWW"; + + public static final String P_ID_DOC_FT_NOLEGGIO = "ID_DOC_FT_NOLEGGIO"; + + public static final String P_MAILING_LIST_ON = "MAIL_LIST_ON"; + + public static final String P_CLIFOR_ATTACH_PATH = "CLIFOR_ATTACH_PATH"; + + public static final String P_DOC_ATTACH_PATH = "DOC_ATTACH_PATH"; + + public static final String P_PATH_IMG_BANNER = "PATH_IMG_BANNER"; + + public static final String P_MAILING_LIST_MAIL_CR = "MAIL_LIST_MAIL_CR"; + + public static final String P_MAILING_LIST_FILE_CR = "MAIL_LIST_FILE_CR"; + + public static final String P_MSG_AVVISO_PREN_EMAIL = "MSG_AVVISO_PREN_EMAIL"; + + public static final String P_MSG_AVVISO_PREN_SMS = "MSG_AVVISO_PREN_SMS"; + + public static final String P_RIP_NOTA_SCHEDA_RIPARAZIONE = "RIP_NOTA_SCHEDA_RIPARAZIONE"; + + public static final String P_RIP_NOTA_ACCETTAZIONE_PREVENTIVO = "RIP_NOTA_ACCETTAZIONE_PREVENTIVO"; + + public static final String P_DOC_ARTICOLI_CON_CODICE = "DOC_ARTICOLI_CON_CODICE"; + + public static final String P_DOC_ARTICOLI_CON_TIPO = "DOC_ARTICOLI_CON_TIPO"; + + public static final String P_ID_DOC_RIPARAZIONE = "ID_DOC_RIPARAZIONE"; + + public static final String P_MSG_AVVISO_RIP_EMAIL = "MSG_AVVISO_RIP_EMAIL"; + + public static final String P_HEAD_SLIP = "HEAD_SLIP"; + + public static final String P_ID_DOC_PRENOTAZIONE = "ID_DOC_PRENOTAZIONE"; + + public static final String P_ID_DOC_RICEVUTA = "ID_DOC_RICEVUTA"; + + public static final String P_COSTO_STIRO_DEFAULT = "COSTO_STIRO_DEFAULT"; + + public static final String P_COSTO_SPESE_FISSE_DEFAULT = "COSTO_SPESE_FISSE_DEFAULT"; + + public static final String P_PERC_RICARICO_DEFAULT = "PERC_RICARICO_DEFAULT"; + + public static final String P_SMS_SERVER = "SMS_SERVER"; + + public static final String P_CODA_MESSAGGI_PATH_IMG_MSG = "CODA_MESSAGGI_PATH_IMG_MSG"; + + public static final String P_CODA_MESSAGGI_EMAIL_DELAY = "CODA_MESSAGGI_EMAIL_DELAY"; + + public static final String P_CODA_MESSAGGI_IMG_URL_BASE = "CODA_MESSAGGI_IMG_URL_BASE"; + + public static final String P_CODA_MESSAGGI_SMS_DELAY = "CODA_MESSAGGI_SMS_DELAY"; + + public static final String P_CODA_MESSAGGI_USE_EMBEDDED_IMG = "CODA_MESSAGGI_USE_EMBEDDED_IMG"; + + public static final String CODA_MESSAGGI_PATH_IMG_MSG = "_img/_imgMsg"; + + public static final String P_CODA_MESSAGGI_USE_OPEN_TAG = "CODA_MESSAGGI_USE_OPEN_TAG"; + + public static final String P_CODA_MESSAGGI_ATTACH_PATH = "CODA_MESSAGGI_ATTACH_PATH"; + + public static final String P_CODA_MESSAGGI_MAIL_FROM = "CODA_MESSAGGI_MAIL_FROM"; + + public static final String P_DOC_FONT_ROW_SIZE = "DOC_FONT_ROW_SIZE"; + + public static final String P_PERC_RIT_ACCONTO = "PERC_RITENUTA_ACCONTO"; + + public static final String P_PERC_CONT_INTEGRATIVO = "PERC_CONT_INTEGRATIVO"; + + public static final String P_SMS_PORT = "SMS_PORT"; + + public static final String P_SMS_PDU = "SMS_PDU"; + + public static final String P_IMPORT_FILE = "ART_IMPORT_FILE"; + + public static final String P_MSG_EMAIL_FROM = "MSG_EMAIL_FROM"; + + public static final String P_PREZZO_CON_IVA = "PREZZO_CON_IVA"; + + public static final Font PDF_fPiccolissimo4B = PdfFontFactory.PDF_fPiccolissimo4B; + + public static final Font PDF_fPiccolissimo5 = PdfFontFactory.PDF_fPiccolissimo5; + + public static final Font PDF_fPiccolissimo6B = PdfFontFactory.PDF_fPiccolissimo6B; + + public static final Font PDF_fPiccolissimo4 = PdfFontFactory.PDF_fPiccolissimo4; + + public static final Font PDF_fPiccolissimo5B = PdfFontFactory.PDF_fPiccolissimo5B; + + public static final String P_DESC_SCONTRINO_FULL = "DESC_SCONTRINO_FULL"; + + public static final String P_TAGLIE_LINGUE = "TAGLIE_LINGUE"; + + public static final String P_DOC_LEADROW = "DOC_LEADROW"; + + public static final String P_DOC_FIRMA_INVIO_FATTURA = "DOC_FIRMA_INVIO_FATTURA"; + + public static final String P_HEAD_DOC = "HEAD_DOC"; + + public static final String P_TIPO_PAG_SCONTRINO_CON_FATTURA = "TIPO_PAG_SC_CON_FT"; + + public static final String P_FOOT_DOC = "FOOT_DOC"; + + public static final String P_ESERCIZIO = "ESERCIZIO"; + + public static final String P_DBNAME2 = "DBNAME2"; + + public static final String P_DBDRIVER2 = "DBDRIVER2"; + + public static final String P_USER2 = "USER2"; + + public static final String P_PASSWORD2 = "PASSWORD2"; + + public static final String P_TESSUTI = "TESSUTI"; + + public static final String P_IMMOBILI = "IMMOBILI"; + + public static final String P_ASTE = "ASTE"; + + public static final String P_DESTINAZIONE = "DESTINAZIONE"; + + public static final String P_STAMPA_NOME_DOCUMENTO = "STAMPA_NOME_DOCUMENTO"; + + public static final String P_STAMPA_INDENTAZIONE = "STAMPA_INDENTAZIONE"; + + public static final String P_SMS_URL = "SMS_URL"; + + public static final String P_SMS_USER = "SMS_USER"; + + public static final String P_SMS_PASS = "SMS_PASS"; + + public static final String P_TIPO_FATTURE_VENDITA = "TIPO_FATTURE_VENDITA"; + + public static final String P_TIPO_FATTURE_ACQUISTO = "TIPO_FATTURE_ACQUISTO"; + + public static final String P_RIGA_DOC_CODICE_ARTICOLO_ESPLICITO = "RIGA_DOC_CODICE_ARTICOLO_ESPLICITO"; + + public static final String P_AGENTI_ON = "AGENTI_ON"; + + public static final String P_ATR_ON = "ATR_ON"; + + public static final String P_FATTURA_ELETTRONICA_ON = "FATTURA_ELETTRONICA_ON"; + + public static final String P_SEO_VERSION = "SEO_VERSION"; + + public static final String P_MNU_DOC_STD = "MNU_DOC_STD"; + + public static final String P_MNU_COAVE = "MNU_COAVE"; + + public static final String P_MNU_TESSITURA = "MNU_TESSITURA"; + + public static final String P_MNU_NEWSLETTER = "MNU_NEWSLETTER"; + + public static final String P_MNU_NEWS = "MNU_NEWS"; + + public static final String P_MNU_FILATI = "MNU_FILATI"; + + public static final String P_MNU_CONFEZIONE = "MNU_CONFEZIONE"; + + public static final String P_MNU_LAVORAZIONI = "MNU_LAVORAZIONI"; + + public static final String P_MNU_TESSUTI = "MNU_TESSUTI"; + + public static final String P_MNU_BANNER = "MNU_BANNER"; + + public static final String P_MNU_CONTRATTI = "MNU_CONTRATTI"; + + public static final String P_MNU_WWW = "MNU_WWW"; + + public static final String P_MNU_CONFIG_ANAG = "MNU_CONFIG_ANAG"; + + public static final String P_MNU_CONFIG_ART = "MNU_CONFIG_ART"; + + public static final String P_MNU_CONFIG_CONTAB = "MNU_CONFIG_CONTAB"; + + public static final String P_MNU_CONFIG_ADMIN = "MNU_CONFIG_ADMIN"; + + public static final String P_MNU_GEST_ARTICOLI = "MNU_GEST_ARTICOLI"; + + public static final String P_MNU_GEST_CONTATTI = "MNU_GEST_CONTATTI"; + + public static final String P_MNU_GEST_SCADENZE = "MNU_GEST_SCADENZE"; + + public static final String P_MNU_GEST_PAGAMENTI = "MNU_GEST_PAGAMENTI"; + + public static final String P_MNU_GEST_RIBA = "MNU_GEST_RIBA"; + + public static final String P_MNU_CC = "MNU_CC"; + + public static final String P_MNU_FACE = "MNU_FACE"; + + public static final String P_MNU_FR = "MNU_FR"; + + public static final String P_MNU_M_DOC_STD = "MNU_M_DOC_STD"; + + public static final String P_MNU_M_COAVE = "MNU_M_COAVE"; + + public static final String P_MNU_M_CASSA = "MNU_M_CASSA"; + + public static final String P_MNU_M_PRENOTAZIONI = "MNU_M_PRENOTAZIONI"; + + public static final String P_MNU_M_EBAY = "MNU_M_EBAY"; + + public static final String P_MNU_M_RIPARAZIONI = "MNU_M_RIPARAZIONI"; + + public static final String P_MNU_M_ORDINI = "MNU_M_ORDINI"; + + public static final String P_MNU_M_FILATI = "MNU_M_FILATI"; + + public static final String P_MNU_M_CONFEZIONE = "MNU_M_CONFEZIONE"; + + public static final String P_MNU_M_TESSUTI = "MNU_M_TESSUTI"; + + public static final String P_MNU_M_TESSITURA = "MNU_M_TESSITURA"; + + public static final String P_MNU_M_TESSITURA_PRODUZIONE = "MNU_M_TESSITURA_PRODUZIONE"; + + public static final String P_MNU_M_ARTICOLI = "MNU_M_ARTICOLI"; + + public static final String P_MNU_M_CC = "MNU_M_CC"; + + public static final String P_MNU_M_CC_GODMODE = "MNU_CC_GODMODE"; + + public static final String P_MNU_M_FACE = "MNU_M_FACE"; + + public static final String P_MNU_M_FR = "MNU_M_FR"; + + private static Iva ivaArt8A; + + private static Iva ivaArt8C; + + private static Iva ivaArt41; + + private static Iva ivaArt58; + + private static Iva ivaStdVendita; + + private static Iva ivaEsenteBolli; + + private static Iva ivaReverseCharge; + + private static Iva ivaRegimeMargine; + + public _AnagAdapter() {} + + public _AnagAdapter(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public long getCodiceIvaEsenteBolli() { + return getParm("CODICE_IVA_ESENTE").getNumeroLong(); + } + + public long getCodiceIvaCeeAziendaArt41() { + return getParm("CODICE_IVA_CEE_AZIENDA_ART41").getNumeroLong(); + } + + protected long getCurrentEsercizio() { + Calendar cal = Calendar.getInstance(); + return (long)cal.get(1); + } + + protected String getAdminMail() { + String temp = getParm("BCC").getTesto(); + return temp; + } + + protected boolean useNullFor0() { + return false; + } + + protected String getCheckOutMailMessage(String lang) { + String temp = getParm(Cart.P_CHECKOUTMSG).getTesto(); + if (lang != null && !lang.isEmpty()) { + int dot = temp.lastIndexOf("."); + if (dot > 0) + temp = temp.substring(0, dot) + "_" + temp.substring(0, dot) + lang.toLowerCase(); + } + return temp; + } + + protected String getAllarmeOrdineEbayMessage() { + return "/mailMessage/allarmeEbay.html"; + } + + protected String getResoMailMessage(String lang) { + String temp = getParm(Parm.P_RESOMSG).getTesto(); + if (lang != null && !lang.isEmpty()) { + int dot = temp.lastIndexOf("."); + if (dot > 0) + temp = temp.substring(0, dot) + "_" + temp.substring(0, dot) + lang.toLowerCase(); + } + return temp; + } + + protected void prepareNewPdfPcorpoDocument() { + try { + this.pdfPcorpo = new PdfPTable(40); + this.pdfPcorpo.setWidthPercentage(100.0F); + this.pdfPcorpo.setWidths(colWidthsRighe40); + } catch (Exception e) { + handleDebug(e, 2); + } + } + + public PdfPTable getPdfPcorpo() { + return this.pdfPcorpo; + } + + public void setPdfPcorpo(PdfPTable corpo) { + this.pdfPcorpo = corpo; + } + + public Document getDocument() { + return this.document; + } + + public void setDocument(Document document) { + this.document = document; + } + + public PdfWriter getWriter() { + return this.writer; + } + + public void setWriter(PdfWriter writer) { + this.writer = writer; + } + + protected void prepareNewPdfCorpoDocument() { + this.pdfcorpo = getNewPdfCorpoDocument(); + } + + protected Table getNewPdfCorpoDocument() { + Table l_pdfcorpo = null; + try { + l_pdfcorpo = new Table(40); + l_pdfcorpo.setWidth(100.0F); + l_pdfcorpo.setBorder(0); + l_pdfcorpo.setBorderWidth(0.0F); + l_pdfcorpo.setBorderColor(new Color(255, 255, 255)); + l_pdfcorpo.setPadding(2.0F); + l_pdfcorpo.setSpacing(0.0F); + l_pdfcorpo.setWidths(colWidthsRighe40); + } catch (Exception e) { + handleDebug(e, 2); + } + return l_pdfcorpo; + } + + public Table getPdfcorpo() { + return this.pdfcorpo; + } + + public void setPdfcorpo(Table pdfcorpo) { + this.pdfcorpo = pdfcorpo; + } + + public TipoPagamento getTipoPagamentoScontrinoConFattura() { + TipoPagamento tp = new TipoPagamento(getApFull()); + tp.findByPrimaryKey(getParm("TIPO_PAG_SC_CON_FT").getNumeroLong()); + return tp; + } + + protected int getDocFontRowSize() { + return getParm("DOC_FONT_ROW_SIZE").getNumeroInt(); + } + + protected int getDocFontRowSize(TipoDocumento tipoDocumento) { + if (tipoDocumento.getDocFontSizeRow() > 0L) + return (int)tipoDocumento.getDocFontSizeRow(); + return getParm("DOC_FONT_ROW_SIZE").getNumeroInt(); + } + + protected int getDocLeadRow() { + return getParm("DOC_LEADROW").getNumeroInt(); + } + + protected long getDocPosizioneNota() { + return getParm("DOC_POSIZIONE_NOTA").getNumeroLong(); + } + + public boolean usaPrezzoConIva() { + return getParm("PREZZO_CON_IVA").isTrue(); + } + + protected int getImgLogoWidth() { + return (int)getDocLogoWidth(); + } + + public String getMailSubject() { + if (getApFull() == null) + return ""; + return getApFull().getResource("SUBJECT"); + } + + protected SimboliLavaggio getSimboliLavaggioDefault() { + String temp = getParm("ART_SIMBOLI_LAVAGGIO_DEFAULT").getTesto(); + if (temp.isEmpty()) + return null; + try { + SimboliLavaggio simboliLavaggio = new SimboliLavaggio(); + StringTokenizer st = new StringTokenizer(temp, ","); + if (st.hasMoreTokens()) { + temp = st.nextToken().trim(); + simboliLavaggio.setLavaggio(Long.valueOf(temp).longValue()); + } + if (st.hasMoreTokens()) { + temp = st.nextToken().trim(); + simboliLavaggio.setCandeggio(Long.valueOf(temp).longValue()); + } + if (st.hasMoreTokens()) { + temp = st.nextToken().trim(); + simboliLavaggio.setAsciugatura(Long.valueOf(temp).longValue()); + } + if (st.hasMoreTokens()) { + temp = st.nextToken().trim(); + simboliLavaggio.setStiratura(Long.valueOf(temp).longValue()); + } + if (st.hasMoreTokens()) { + temp = st.nextToken().trim(); + simboliLavaggio.setPulituraSecco(Long.valueOf(temp).longValue()); + } + return simboliLavaggio; + } catch (Exception e) { + return null; + } + } + + protected String getMessaggioAvvisoRiparazioneEmail() { + return getParm("MSG_AVVISO_RIP_EMAIL").getTesto(); + } + + public String getMessaggioDocumentiEmailFrom() { + return getParm("MSG_EMAIL_FROM").getTesto(); + } + + protected String getMessaggioAvvisoPrenotazioneSms() { + return getParm("MSG_AVVISO_PREN_SMS").getTesto(); + } + + protected String getMessaggioAvvisoRiparazioneSms() { + return getParm("MSG_AVVISO_RIP_SMS").getTesto(); + } + + protected String getSmsServer() { + return getParm("SMS_SERVER").getTesto(); + } + + protected int getSmsPort() { + return getParm("SMS_PORT").getNumeroInt(); + } + + protected float getRectDocumentoH(String L_TIPO) { + return getRectDocumento(L_TIPO, 3); + } + + private float getRectDocumento(String L_TIPO, int theVaule) { + StringTokenizer temp = new StringTokenizer(getParm(L_TIPO).getTesto(), ","); + if (temp.countToken() != 4) + return 0.0F; + try { + return Float.parseFloat(temp.getToken(theVaule)); + } catch (Exception e) { + handleDebug(e, 2); + return 0.0F; + } + } + + protected float getRectDocumentoY(String L_TIPO) { + return getRectDocumento(L_TIPO, 1); + } + + protected float getRectDocumentoW(String L_TIPO) { + return getRectDocumento(L_TIPO, 2); + } + + protected float getRectDocumentoX(String L_TIPO) { + return getRectDocumento(L_TIPO, 0); + } + + protected boolean isSmsPdu() { + return (getParm("SMS_PDU").getNumeroInt() == 1); + } + + public Font getFont(String baseFont, int size, int type, Color theColor) { + return TtFont.getInstance(getApFull()).getFont(baseFont, size, type, theColor); + } + + protected int getStringValueCase(String l_colomnName) { + return super.getStringValueCase(l_colomnName); + } + + protected long getId_docCassa() { + return getParm("ID_DOC_CASSA").getNumeroLong(); + } + + protected long getId_docOrdine() { + return getParm("ID_DOC_ORDINE").getNumeroLong(); + } + + public long getId_docOrdineTaglio() { + return getParm("ID_DOC_ORDINE_TAGLIO").getNumeroLong(); + } + + protected long getId_docPrenotazione() { + return getParm("ID_DOC_PRENOTAZIONE").getNumeroLong(); + } + + protected long getId_docRiparazione() { + return getParm("ID_DOC_RIPARAZIONE").getNumeroLong(); + } + + public long getCodiceIvaArt8_A() { + return getParm("CODICE_IVA_ART8_A").getNumeroLong(); + } + + public long getCodiceIvaArt8_C() { + return getParm("CODICE_IVA_EXTRA_CEE_ESP_ABITUALE_ART8_C").getNumeroLong(); + } + + public long getCodiceIvaItaCeeAziendaArt58() { + return getParm("CODICE_IVA_ITA_CEE_AZIENDA_ART58").getNumeroLong(); + } + + public boolean isIvaEsteroAziendaEsente() { + return getParm("IVA_ESTERO_AZIENDA_ESENTE").isTrue(); + } + + public boolean isIvaCeeOneStopShop() { + return getParm("IVA_CEE_ONE_STOP_SHOP").isTrue(); + } + + public long getCodiceIvaVendStd() { + return getParm("CODICE_IVA_STD_VEND").getNumeroLong(); + } + + public long getCodiceIvaAcquistoStd() { + return getParm("CODICE_IVA_STD_ACQ").getNumeroLong(); + } + + public long getCodiceIvaRegimeMargine() { + return getParm("CODICE_IVA_REGIME_MARGINE").getNumeroLong(); + } + + public long getCodiceTipoTessutoStandard() { + return getParm("CODICE_TIPO_TESSUTO_STD").getNumeroLong(); + } + + public long getCodiceIvaReverseCharge() { + return getParm("CODICE_IVA_REVERSE_CHARGE").getNumeroLong(); + } + + public String getPathAllegato() { + return getDocBase() + getDocBase() + getParm("CLIFOR_ATTACH_PATH").getTesto(); + } + + public long getId_docOrdineWWW() { + return getParm("ID_DOC_ORDINE_WWW").getNumeroLong(); + } + + public long getId_docFtNoleggio() { + return getParm("ID_DOC_FT_NOLEGGIO").getNumeroLong(); + } + + public boolean isPercentualiSconto3() { + return getParm("SCONTO_3_PERCENTUALI").isTrue(); + } + + protected Document creaIntestazioneReportPdfPTable(String titolo, String sottoTitolo) { + int cellLeading = 12; + int pdfCorpoPadding = 2; + try { + PdfPCell rigaVuota = new PdfPCell(); + rigaVuota.setVerticalAlignment(4); + rigaVuota.setHorizontalAlignment(0); + rigaVuota.setBorder(0); + rigaVuota.setColspan(40); + this.pdfPcorpo = new PdfPTable(40); + this.pdfPcorpo.setWidthPercentage(100.0F); + this.pdfPcorpo.setWidths(colWidthsRighe40); + if (new File(getDocBase() + getDocBase()).exists()) { + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + imgLogo.scaleToFit(100.0F, 100.0F); + imgLogo.setAlignment(5); + PdfPCell cell = new PdfPCell(); + cell.addElement(new Chunk(imgLogo, -10.0F, -15.0F)); + cell.setBorder(0); + cell.setColspan(8); + this.pdfPcorpo.addCell(cell); + } else { + PdfPCell cell = new PdfPCell(); + cell.setBorder(0); + cell.setColspan(8); + this.pdfPcorpo.addCell(cell); + } + PdfPCell pdfPCell1 = new PdfPCell(); + pdfPCell1.addElement(new Chunk("Report: " + titolo, PdfFontFactory.PDF_fGrandeB)); + pdfPCell1.addElement(new Chunk(sottoTitolo, PdfFontFactory.PDF_fMedio)); + pdfPCell1.setBorder(0); + pdfPCell1.setVerticalAlignment(4); + pdfPCell1.setColspan(27); + this.pdfPcorpo.addCell(pdfPCell1); + pdfPCell1 = new PdfPCell(); + pdfPCell1.addElement(new Chunk(getDataFormat().format(getToday()), PdfFontFactory.PDF_fGrandeB)); + pdfPCell1.setBorder(0); + pdfPCell1.setVerticalAlignment(6); + pdfPCell1.setColspan(5); + this.pdfPcorpo.addCell(pdfPCell1); + this.pdfPcorpo.addCell(rigaVuota); + this.pdfPcorpo.setHeaderRows(2); + } catch (Exception e) { + handleDebug(e); + } + return this.document; + } + + protected Document creaIntestazioneReport(String titolo, String sottoTitolo) { + int cellLeading = 12; + int pdfCorpoPadding = 2; + try { + Cell rigaVuota = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimo)); + rigaVuota.setVerticalAlignment(4); + rigaVuota.setHorizontalAlignment(0); + rigaVuota.setLeading((float)cellLeading); + rigaVuota.setBorder(0); + rigaVuota.setColspan(40); + rigaVuota.setRowspan(1); + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + imgLogo.scaleToFit(50.0F, 100.0F); + imgLogo.setAlignment(5); + this.pdfcorpo = new Table(40); + this.pdfcorpo.setWidth(100.0F); + this.pdfcorpo.setPadding((float)pdfCorpoPadding); + this.pdfcorpo.setSpacing(0.0F); + this.pdfcorpo.setWidths(colWidthsRighe40); + this.pdfcorpo.setBorder(0); + Cell cell = new Cell(); + cell.add(new Chunk(imgLogo, 10.0F, 0.0F)); + cell.setLeading(12.0F); + cell.setBorder(0); + cell.setColspan(6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Report: " + titolo, PdfFontFactory.PDF_fGrandeB)); + cell.add(new Chunk("\n\n" + sottoTitolo, PdfFontFactory.PDF_fMedio)); + cell.setLeading(12.0F); + cell.setBorder(0); + cell.setVerticalAlignment(4); + cell.setColspan(28); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getDataFormat().format(getToday()), PdfFontFactory.PDF_fGrandeB)); + cell.setLeading(12.0F); + cell.setBorder(0); + cell.setVerticalAlignment(6); + cell.setColspan(6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.pdfcorpo.addCell(rigaVuota); + this.document.add((Element)this.pdfcorpo); + this.pdfcorpo = new Table(40); + this.pdfcorpo.setWidth(100.0F); + this.pdfcorpo.setPadding((float)pdfCorpoPadding); + this.pdfcorpo.setSpacing(0.0F); + this.pdfcorpo.setWidths(colWidthsRighe40); + this.pdfcorpo.setBorder(0); + } catch (Exception e) { + handleDebug(e); + } + return this.document; + } + + public boolean isFatturaElettronicaOn() { + return getParm("FATTURA_ELETTRONICA_ON").isTrue(); + } + + public boolean isCostoSpedizioneFull() { + return getParm("CC_COSTO_SPED_FULL").isTrue(); + } + + protected String getMessaggioAvvisoPrenotazioneEmail() { + return getParm("MSG_AVVISO_PREN_EMAIL").getTesto(); + } + + public double getRatealeImportoMinimo() { + return getParm("SELLA_P_CREDIT_IMPORTO_MINIMO").getNumeroDouble(); + } + + public boolean isRata0Attiva() { + return (getParm("CONSEL_RATA0").getNumeroLong() == 1L); + } + + public boolean isQuantitaMagazzinoIntere() { + return getParm("USA_QUANTITA_INTERE").isTrue(); + } + + public Iva getIvaArt8A() { + if (ivaArt8A == null) { + ivaArt8A = new Iva(getApFull()); + ivaArt8A.findByPrimaryKey(getCodiceIvaArt8_A()); + } + return ivaArt8A; + } + + public Iva getIvaRegimeMargine() { + if (ivaRegimeMargine == null) { + ivaRegimeMargine = new Iva(getApFull()); + ivaRegimeMargine.findByPrimaryKey(getCodiceIvaRegimeMargine()); + } + return ivaRegimeMargine; + } + + public Iva getIvaArt8C() { + if (ivaArt8C == null) { + ivaArt8C = new Iva(getApFull()); + ivaArt8C.findByPrimaryKey(getCodiceIvaArt8_C()); + } + return ivaArt8C; + } + + public Iva getIvaArt41() { + if (ivaArt41 == null) { + ivaArt41 = new Iva(getApFull()); + ivaArt41.findByPrimaryKey(getCodiceIvaCeeAziendaArt41()); + } + return ivaArt41; + } + + public Iva getIvaArt58() { + if (ivaArt58 == null) { + ivaArt58 = new Iva(getApFull()); + ivaArt58.findByPrimaryKey(getCodiceIvaItaCeeAziendaArt58()); + } + return ivaArt58; + } + + public Iva getIvaStdVendita() { + if (ivaStdVendita == null) { + ivaStdVendita = new Iva(getApFull()); + ivaStdVendita.findByPrimaryKey(getCodiceIvaVendStd()); + } + return ivaStdVendita; + } + + public Iva getIvaEsenteBolli() { + if (ivaEsenteBolli == null) { + ivaEsenteBolli = new Iva(getApFull()); + ivaEsenteBolli.findByPrimaryKey(getCodiceIvaEsenteBolli()); + } + return ivaEsenteBolli; + } + + public Iva getIvaReverseCharge() { + if (ivaReverseCharge == null) { + ivaReverseCharge = new Iva(getApFull()); + ivaReverseCharge.findByPrimaryKey(getCodiceIvaReverseCharge()); + } + return ivaReverseCharge; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/json/JsonComune.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/json/JsonComune.java new file mode 100644 index 00000000..8856adf7 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/json/JsonComune.java @@ -0,0 +1,33 @@ +package it.acxent.anag.json; + +public class JsonComune { + private long id_comune; + + private String descrizione; + + private long lastUpdTmst; + + public long getId_comune() { + return this.id_comune; + } + + public void setId_comune(long id_tipologiaProdotto) { + this.id_comune = id_tipologiaProdotto; + } + + public String getDescrizione() { + return this.descrizione; + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } + + public long getLastUpdTmst() { + return this.lastUpdTmst; + } + + public void setLastUpdTmst(long lastUpdTmst) { + this.lastUpdTmst = lastUpdTmst; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/AspettoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/AspettoSvlt.java new file mode 100644 index 00000000..5e127338 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/AspettoSvlt.java @@ -0,0 +1,34 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Aspetto; +import it.acxent.anag.AspettoCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Aspetto.abl"}) +public class AspettoSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = 1998564139944230796L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Aspetto(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new AspettoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/BancaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/BancaSvlt.java new file mode 100644 index 00000000..e3a0f433 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/BancaSvlt.java @@ -0,0 +1,34 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Banca; +import it.acxent.anag.BancaCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Banca.abl"}) +public class BancaSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = -3467685376411981559L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Banca(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new BancaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/CausaleTrasportoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/CausaleTrasportoSvlt.java new file mode 100644 index 00000000..8a0e78c9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/CausaleTrasportoSvlt.java @@ -0,0 +1,34 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.CausaleTrasporto; +import it.acxent.anag.CausaleTrasportoCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/CausaleTrasporto.abl"}) +public class CausaleTrasportoSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = 7302443863816366700L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new CausaleTrasporto(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new CausaleTrasportoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ClienteSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ClienteSvlt.java new file mode 100644 index 00000000..7e741a7f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ClienteSvlt.java @@ -0,0 +1,39 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Cliente; +import it.acxent.anag.ClienteCR; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.TipoPagamentoCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.util.ReturnItem; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anag/Cliente.abl"}) +public class ClienteSvlt extends CliforSvlt { + private static final long serialVersionUID = 6362096338674911071L; + + protected DBAdapter getBean(HttpServletRequest req) { + return new Cliente(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ClienteCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("bean", getBean(req)); + req.setAttribute("listaTipoPagamento", new TipoPagamento(getApFull(req)).findByCR(new TipoPagamentoCR(), 0, 0)); + req.setAttribute("RI", new ReturnItem(req.getParameter("RI"))); + } + + protected String getBeanPageName(HttpServletRequest req) { + return super.getBeanPageName(req); + } + + protected final String getBeanName(HttpServletRequest req) { + return "clifor"; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/CliforSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/CliforSvlt.java new file mode 100644 index 00000000..e1bc26de --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/CliforSvlt.java @@ -0,0 +1,659 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.AllegatoClifor; +import it.acxent.anag.Banca; +import it.acxent.anag.ClienteCR; +import it.acxent.anag.Clifor; +import it.acxent.anag.CliforCR; +import it.acxent.anag.CliforTipoClifor; +import it.acxent.anag.CliforTipoCliforCR; +import it.acxent.anag.CliforTipoPagamento; +import it.acxent.anag.Contatto; +import it.acxent.anag.Contratto; +import it.acxent.anag.DestinazioneDiversa; +import it.acxent.anag.Listino; +import it.acxent.anag.MagFisico; +import it.acxent.anag.Ottoxmille; +import it.acxent.anag.TipoAllegatoClifor; +import it.acxent.anag.TipoClifor; +import it.acxent.anag.TipoCliforCR; +import it.acxent.anag.TipoContratto; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.TipoPagamentoCR; +import it.acxent.anag.Users; +import it.acxent.art.ArticoloCliente; +import it.acxent.contab.DocumentoPagamento; +import it.acxent.contab.DocumentoPagamentoCR; +import it.acxent.contab.IncassoPagamento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.newsletter.CodaMessaggi; +import it.acxent.newsletter.TemplateMsg; +import it.acxent.util.AbMessages; +import it.acxent.util.ReturnItem; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class CliforSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = -6475496069319020839L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Clifor bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_clifor"); + bean = new Clifor(apFull); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + req.setAttribute("id_clifor", String.valueOf(bean.getId_clifor())); + if (rp.getStatus() == true) { + if (getAct(req).equals("addDD")) { + DestinazioneDiversa row = new DestinazioneDiversa(apFull); + fillObject(req, row); + rp = bean.addDestinazioneDiversa(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delDD")) { + DestinazioneDiversa row = new DestinazioneDiversa(apFull); + long l_id_destinazioneDiversa = getRequestLongParameter(req, "id_destinazioneDiversa"); + if (l_id_destinazioneDiversa != 0L) { + fillObject(req, row); + bean.delDestinazioneDiversa(row); + sendMessage(req, "Cancellazione Destinazione Diversa Effettuata"); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("modDD")) { + DestinazioneDiversa row = new DestinazioneDiversa(apFull); + long l_id_destinazioneDiversa = getRequestLongParameter(req, "id_destinazioneDiversa"); + if (l_id_destinazioneDiversa != 0L) { + row.findByPrimaryKey(l_id_destinazioneDiversa); + req.setAttribute("destinazioneDiversa", row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("addContratto")) { + Contratto row = new Contratto(apFull); + fillObject(req, row); + rp = bean.addContratto(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delContratto")) { + Contratto row = new Contratto(apFull); + long l_id_row = getRequestLongParameter(req, "id_contratto"); + if (l_id_row != 0L) { + fillObject(req, row); + bean.delContratto(row); + sendMessage(req, "Cancellazione Contratto Effettuata"); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("modContratto")) { + Contratto row = new Contratto(apFull); + long l_id_row = getRequestLongParameter(req, "id_contratto"); + if (l_id_row != 0L) { + row.findByPrimaryKey(l_id_row); + req.setAttribute("beanC", row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("addAllegato")) { + AllegatoClifor row = new AllegatoClifor(apFull); + fillObject(req, row); + rp = bean.addAllegato(row); + rp.append(creaFileAllegato(bean, req, res)); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delAllegato")) { + AllegatoClifor row = new AllegatoClifor(apFull); + fillObject(req, row); + rp = bean.delAllegato(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Allegato Cancellato"); + showBean(req, res); + } else if (getAct(req).equals("delUser")) { + Users row = new Users(apFull); + long l_id_users = getRequestLongParameter(req, "id_users"); + if (l_id_users != 0L) { + row.findByPrimaryKey(l_id_users); + if (row.getId_clifor() == bean.getId_clifor()) { + row.setId_clifor(0L); + row.save(); + sendMessage(req, + AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Utente non più legato al record."); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL") + ": Utente non legato al record cliente/Fornitore!"); + } + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL") + ": codice Utente nullo!"); + } + showBean(req, res); + } + } else { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Clifor bean = (Clifor)beanA; + req.setAttribute("listaBancaAzienda", new Banca(apFull).findAll()); + req.setAttribute("listaUserClifor", bean.findUsers(0, 0)); + req.setAttribute("listaDD", bean.getDestinazioniDiverse()); + req.setAttribute("listaListini", new Listino(apFull).findNoListinoBase()); + req.setAttribute("listaTipoContratto", new TipoContratto(apFull).findAll()); + req.setAttribute("listaContratti", bean.getContratti()); + req.setAttribute("listaDocumenti", bean.getDocumenti()); + req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull).findByCR(new TipoPagamentoCR(), 0, 0)); + req.setAttribute("RI", new ReturnItem(req.getParameter("RI"))); + req.setAttribute("listaAllegati", bean.getAllegati(0L)); + req.setAttribute("listaTipiAllegatoClifor", new TipoAllegatoClifor(apFull).findAll()); + req.setAttribute("listaTipiAllegatoClifor", new TipoAllegatoClifor(apFull).findAll()); + TipoCliforCR CRT = new TipoCliforCR(); + CRT.setFlgTipoS(bean.getFlgTipo()); + req.setAttribute("listaTipoClifor", new TipoClifor(apFull).findByCR(CRT, 0, 0)); + CliforTipoCliforCR CRCTC = new CliforTipoCliforCR(apFull); + CRCTC.setId_clifor(bean.getId_clifor()); + CRCTC.setFlgTipoClifor(bean.getFlgTipo()); + req.setAttribute("listaTipologie", new CliforTipoClifor(apFull).findByCR(CRCTC, 0, 0)); + DocumentoPagamentoCR CRdp = new DocumentoPagamentoCR(); + if (getRequestLongParameter(req, "flgTipoSaldoMd") > 0L) + CRdp.setFlgTipoSaldo(getRequestLongParameter(req, "flgTipoSaldo")); + CRdp.setId_clifor(bean.getId_clifor()); + req.setAttribute("CRDP", CRdp); + req.setAttribute("listaPagamenti", new DocumentoPagamento(apFull).findSaldiByCR(CRdp, 0, 0)); + req.setAttribute("listaClientiAssociati", new Clifor(apFull).findByAgente(bean.getId_clifor())); + req.setAttribute("listaContatti", new Contatto(apFull).findByClifor(bean.getId_clifor())); + if (bean.getFlgTipo() == "C") + req.setAttribute("listaCliforTipoPagamento", new CliforTipoPagamento(apFull).findByClifor(bean.getId_clifor())); + if (bean.getFlgTipo() == "F") + req.setAttribute("listaMagFisico", new MagFisico(apFull).findByClifor(bean.getId_clifor())); + if (getParm("ARTICOLO_CLIENTE").isTrue()) + req.setAttribute("listaArticoliCliente", new ArticoloCliente(apFull).findByClifor(bean.getId_clifor())); + } + + protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CliforCR CR = (CliforCR)CRA; + req.setAttribute("listaTemplateMsg", new TemplateMsg(apFull).findAll()); + req.setAttribute("listaTipiClifor", new TipoClifor(apFull).findByTipo(CR.getFlgTipo())); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Clifor(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new CliforCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull).findByCR(new TipoPagamentoCR(), 0, 0)); + req.setAttribute("RI", new ReturnItem(req.getParameter("RI"))); + req.setAttribute("listaTipoContratto", new TipoContratto(apFull).findAll()); + req.setAttribute("listaTipiClifor", new TipoClifor(apFull).findAll()); + req.setAttribute("listaOttoxmille", new Ottoxmille(apFull).findAll()); + } + + protected String getBeanPageName(HttpServletRequest req) { + return super.getBeanPageName(req); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + if (getCmd(req).equals("join")) { + long l_id_anagrafica = getRequestLongParameter(req, "id_anagrafica"); + Clifor bean = new Clifor(apFull); + bean.findByPrimaryKey(l_id_anagrafica); + fillObject(req, bean); + bean.save(); + ResParm rp = Clifor.unisciClifor(bean); + if (rp.getStatus()) { + sendMessage(req, "Unione Record eseguita correttamente."); + req.getSession().removeAttribute(getATTR_CRBEAN(req)); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } else if (getCmd(req).equals("creaCodaSms")) { + ClienteCR CR = new ClienteCR(); + fillObject(req, CR); + Clifor bean = new Clifor(apFull); + Vectumerator vec = bean.findByCR(CR, 0, 0); + String l_msg = getRequestParameter(req, "testoMessaggio").trim(); + int i = 0; + int j = 0; + ResParm rp = new ResParm(true); + if (l_msg.isEmpty()) { + rp.setStatus(false); + rp.setMsg("ERRORE! Testo del messaggio vuoto!"); + } else { + while (vec.hasMoreElements()) { + Clifor row = (Clifor)vec.nextElement(); + CodaMessaggi cm = new CodaMessaggi(apFull); + if (!row.getCellulare().isEmpty()) { + cm.setCellulare(row.getCellulare()); + cm.setFlgTipo(2L); + cm.setDataCreazione(DBAdapter.getToday()); + cm.setTestoMessaggio(l_msg); + cm.save(); + i++; + continue; + } + j++; + } + } + if (rp.getStatus()) { + sendMessage(req, "Creazione coda messaggi eseguita correttamente. Creati " + i + " messaggi sms. " + j + " Clienti senza cellulare impostato."); + req.getSession().removeAttribute(getATTR_CRBEAN(req)); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } else if (getCmd(req).equals("creaCodaMsg")) { + creaCodaMessaggi(req, res); + } else if (!getCmd(req).equals("rendiFlag")) { + super.otherCommands(req, res); + } + } + + public void _creaMList(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CliforCR CR = new CliforCR(apFull); + fillObject(req, CR); + Clifor bean = new Clifor(apFull); + ResParm rp = bean.creaMailingListCR(CR); + if (rp.getStatus()) { + String fileML = getMailingListFileCR(); + StringBuilder sb = new StringBuilder(); + sb.append(rp.getMsg()); + sb.append("
"); + sb.append("File Mailing list: " + fileML + "
"); + sendHtmlMsgResponse(req, res, sb.toString()); + } else { + sendHtmlMsgResponse(req, res, "Errore creazione mailing list!!"); + } + } + + protected void creaCodaMessaggi(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Clifor bean = new Clifor(apFull); + CliforCR CR = new CliforCR(apFull); + fillObject(req, CR); + long l_id_templateMsg = getRequestLongParameter(req, "id_templateMsg"); + bean.creaCodaMessaggi(CR, l_id_templateMsg); + sendMessage(req, "Coda messaggi creata..."); + search(req, res); + } + + protected ResParm creaFileAllegato(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + synchronized (this) { + ResParm rp = new ResParm(true, ""); + Clifor bean = (Clifor)beanA; + String targetDir = bean.getPathAllegato(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + "/" + targetDir + "_"; + Vectumerator completeFileNames = (Vectumerator)req.getAttribute("completeAttachName"); + Vectumerator fileNames = (Vectumerator)req.getAttribute("attachName"); + if (completeFileNames.hasMoreElements()) { + String sourceFile = (String)completeFileNames.nextElement(); + String fileName = (String)fileNames.elementAt(0); + targetFile = targetFile + targetFile; + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + } + return rp; + } + } + + protected boolean isLoadImageServlet() { + return true; + } + + protected void print(HttpServletRequest req, HttpServletResponse res) { + try { + if (getAct(req).equals("lblInd")) { + long l_id = 0L; + Clifor bean = null; + l_id = getRequestLongParameter(req, "id_clifor"); + bean = new Clifor(getApFull(req)); + bean.findByPrimaryKey(l_id); + sendPdf(res, bean.creaPdfEtichettaZebra(""), "Etichetta " + bean.getCognomeNome() + ".pdf"); + } else { + search(req, res); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void _checkPiva(HttpServletRequest req, HttpServletResponse res) { + try { + Clifor bean = new Clifor(getApFull(req)); + bean.findByPrimaryKey(getRequestLongParameter(req, "id_clifor")); + bean.setPIva(getRequestParameter(req, "pIva")); + StringBuilder sb = new StringBuilder(); + if (!bean.isPivaComunitariaOk()) + sb.append("Partita Iva Comunitaria NON VERIFICATA! "); + if (bean.isPIvaDuplicated()) + sb.append("Partita Iva duplicata!"); + if (sb.length() == 0) { + req.setAttribute("res", "OK"); + } else { + sb.insert(0, "ATTENZIONE! "); + req.setAttribute("msg", sb.toString()); + } + sendCmdJspFetchPageResponse(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + public void _modDocumento(HttpServletRequest req, HttpServletResponse res) { + IncassoPagamento ip = new IncassoPagamento(getApFull(req)); + fillObject(req, ip); + req.setAttribute("listaIncassi", ip.findByDocumento(ip.getId_documento(), 0, 0)); + req.setAttribute("beanIP", ip); + showBean(req, res); + } + + public void _modIncasso(HttpServletRequest req, HttpServletResponse res) { + long id_incassoPagamento = getRequestLongParameter(req, "id_incassoPagamento"); + IncassoPagamento ip = new IncassoPagamento(getApFull(req)); + ip.findByPrimaryKey(id_incassoPagamento); + req.setAttribute("listaIncassi", ip.findByDocumento(ip.getId_documento(), 0, 0)); + req.setAttribute("beanIP", ip); + showBean(req, res); + } + + public void _addIncasso(HttpServletRequest req, HttpServletResponse res) { + long id_incassoPagamento = getRequestLongParameter(req, "id_incassoPagamento"); + IncassoPagamento ip = new IncassoPagamento(getApFull(req)); + ip.findByPrimaryKey(id_incassoPagamento); + fillObject(req, ip); + ResParm rp = ip.save(); + req.setAttribute("listaIncassi", ip.findByDocumento(ip.getId_documento(), 0, 0)); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _delIncasso(HttpServletRequest req, HttpServletResponse res) { + long id_incassoPagamento = getRequestLongParameter(req, "id_incassoPagamento"); + IncassoPagamento ip = new IncassoPagamento(getApFull(req)); + ip.findByPrimaryKey(id_incassoPagamento); + ResParm rp = ip.delete(); + req.setAttribute("listaIncassi", ip.findByDocumento(ip.getId_documento(), 0, 0)); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _printLista(HttpServletRequest req, HttpServletResponse res) { + try { + CliforCR CR = new CliforCR(getApFull()); + Clifor bean = new Clifor(getApFull()); + fillObject(req, CR); + sendPdf(res, bean.creaPdfListaClifor(CR), "Lista_Clifor.pdf"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void _delAllegato(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Clifor bean = new Clifor(apFull); + long l_id_clifor = getRequestLongParameter(req, "id_clifor"); + bean.findByPrimaryKey(l_id_clifor); + AllegatoClifor row = new AllegatoClifor(apFull); + fillObject(req, row); + bean.delAllegato(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Allegato Cancellato"); + showBean(req, res); + } + + public void _delContatto(HttpServletRequest req, HttpServletResponse res) { + long id_contatto = getRequestLongParameter(req, "id_contatto"); + Contatto contatto = new Contatto(getApFull(req)); + contatto.findByPrimaryKey(id_contatto); + ResParm rp = contatto.delete(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _modifyContatto(HttpServletRequest req, HttpServletResponse res) { + long id_contatto = getRequestLongParameter(req, "id_contatto"); + Contatto contatto = new Contatto(getApFull(req)); + contatto.findByPrimaryKey(id_contatto); + req.setAttribute("beanContatto", contatto); + ResParm rp = contatto.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _addContatto(HttpServletRequest req, HttpServletResponse res) { + long id_contatto = getRequestLongParameter(req, "id_contatto"); + Contatto contatto = new Contatto(getApFull(req)); + contatto.findByPrimaryKey(id_contatto); + fillObject(req, contatto); + ResParm rp = contatto.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _pivaCee(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Clifor bean = new Clifor(apFull); + long l_id_clifor = getRequestLongParameter(req, "id_clifor"); + bean.findByPrimaryKey(l_id_clifor); + if (bean.getId_clifor() > 0L) { + String piva = "1" + DBAdapter.zeroLeft(bean.getId_clifor(), 10); + req.setAttribute("codFisc", piva); + } else { + sendMessage(req, "Errore! Utente non ancora salvato"); + } + req.setAttribute("act", "refresh"); + showBean(req, res); + } + + public void _printPdf(HttpServletRequest req, HttpServletResponse res) { + try { + CliforCR CR = new CliforCR(getApFull()); + Clifor bean = new Clifor(getApFull()); + fillObject(req, CR); + sendPdf(res, bean.creaPdfListaClifor(CR), "Lista_Clifor.pdf"); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void _addAllegato(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Clifor bean = new Clifor(apFull); + long l_id_clifor = getRequestLongParameter(req, "id_clifor"); + bean.findByPrimaryKey(l_id_clifor); + String fileName = getRequestParameter(req, "fileNameOnServer_1"); + if (!fileName.isEmpty()) { + String targetDir = bean.getPathAllegato(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + "/" + targetDir + "_" + bean.getId_clifor(); + String sourceFile = getPathTmpFull() + getPathTmpFull(); + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + AllegatoClifor row = new AllegatoClifor(apFull); + fillObject(req, row); + row.setNomeFile(fileName); + ResParm rp = bean.addAllegato(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else { + HashMap uploadedImages = (HashMap)req.getAttribute("_UFN"); + String currentFullFileName = "", currentFileName = ""; + if (!uploadedImages.isEmpty()) { + Iterator> iterator = uploadedImages.entrySet().iterator(); + if (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + currentFullFileName = entry.getValue(); + currentFileName = entry.getKey(); + } + } + fileName = currentFileName; + String targetDir = bean.getPathAllegato(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + "/" + targetDir + "_" + bean.getId_clifor(); + String sourceFile = currentFullFileName; + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + AllegatoClifor row = new AllegatoClifor(apFull); + fillObject(req, row); + row.setNomeFile(fileName); + ResParm rp = bean.addAllegato(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } + + public void _pivaExtraCee(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Clifor bean = new Clifor(apFull); + long l_id_clifor = getRequestLongParameter(req, "id_clifor"); + bean.findByPrimaryKey(l_id_clifor); + if (bean.getId_clifor() > 0L) { + String piva = "EX1" + DBAdapter.zeroLeft(bean.getId_clifor(), 8); + req.setAttribute("codFisc", piva); + } else { + sendMessage(req, "Errore! Utente non ancora salvato"); + } + req.setAttribute("act", "refresh"); + showBean(req, res); + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Clifor bean = (Clifor)beanA; + if (getRequestLongParameter(req, "id_tipoCliforE") > 0L) { + CliforTipoClifor ctc = new CliforTipoClifor(apFull); + ctc.setId_clifor(bean.getId_clifor()); + ctc.setId_tipoClifor(getRequestLongParameter(req, "id_tipoCliforE")); + bean.addTipologia(ctc); + } + return super.afterSave(beanA, req, res); + } + + public void _addArticoloCliente(HttpServletRequest req, HttpServletResponse res) { + long l_id = getRequestLongParameter(req, "id_articoloCliente"); + ArticoloCliente bean = new ArticoloCliente(getApFull(req)); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + ResParm rp = bean.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _delArticoloCliente(HttpServletRequest req, HttpServletResponse res) { + long l_id = getRequestLongParameter(req, "id_articoloCliente"); + ArticoloCliente bean = new ArticoloCliente(getApFull(req)); + bean.findByPrimaryKey(l_id); + ResParm rp = bean.delete(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _addTipoPagamento(HttpServletRequest req, HttpServletResponse res) { + long id_cliforTipoPagamento = getRequestLongParameter(req, "id_cliforTipoPagamento"); + CliforTipoPagamento ctp = new CliforTipoPagamento(getApFull(req)); + ctp.findByPrimaryKey(id_cliforTipoPagamento); + fillObject(req, ctp); + ctp.setId_tipoPagamento(getRequestLongParameter(req, "id_tipoPagamentoCli")); + ResParm rp = ctp.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _delTipoPagamento(HttpServletRequest req, HttpServletResponse res) { + long id_cliforTipoPagamento = getRequestLongParameter(req, "id_cliforTipoPagamento"); + CliforTipoPagamento ctp = new CliforTipoPagamento(getApFull(req)); + ctp.findByPrimaryKey(id_cliforTipoPagamento); + ResParm rp = ctp.delete(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _addTipologia(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long id_ = getRequestLongParameter(req, "id_tipoCliforAdd"); + CliforTipoClifor row = new CliforTipoClifor(apFull); + fillObject(req, row); + row.setId_tipoClifor(id_); + ResParm rp = row.getClifor().addTipologia(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _delTipologia(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long id_ = getRequestLongParameter(req, "id_tipoCliforAdd"); + CliforTipoClifor row = new CliforTipoClifor(apFull); + fillObject(req, row); + row.setId_tipoClifor(id_); + ResParm rp = row.getClifor().delTipologia(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _cambiaFlg(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Clifor bean = new Clifor(apFull); + long l_id = getRequestLongParameter(req, "id_cliforF"); + String l_flg = getRequestParameter(req, "flg"); + bean.findByPrimaryKey(l_id); + ResParm rp = bean.cambiaFlg(l_flg); + if (rp.getStatus()) { + sendMessage(req, "Aggiornamento Effettuato"); + } else { + sendMessage(req, "Errore! " + rp.getMsg()); + } + req.setAttribute("id_articolo", "0"); + search(req, res); + } + + public void _creaReportCsv(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CliforCR CR = new CliforCR(apFull); + fillObject(req, CR); + Clifor bean = new Clifor(apFull); + bean.creaFileCvs(CR); + sendHtmlMsgResponse(req, res, "File export in formato cvs (Excel)"); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ComuneSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ComuneSvlt.java new file mode 100644 index 00000000..2fc82be3 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ComuneSvlt.java @@ -0,0 +1,37 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Comune; +import it.acxent.anag.ComuneCR; +import it.acxent.anag.Regione; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Comune.abl"}) +public class ComuneSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = 2669230498808295583L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaRegione", new Regione(getApFull(req)).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Comune(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ComuneCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ContatoreSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ContatoreSvlt.java new file mode 100644 index 00000000..75ab26fc --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ContatoreSvlt.java @@ -0,0 +1,34 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Contatore; +import it.acxent.anag.ContatoreCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Contatore.abl"}) +public class ContatoreSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = -3235127453420156540L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Contatore(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ContatoreCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ContrattoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ContrattoSvlt.java new file mode 100644 index 00000000..af4524b8 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ContrattoSvlt.java @@ -0,0 +1,96 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Contratto; +import it.acxent.anag.ContrattoCR; +import it.acxent.anag.TipoContratto; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.newsletter.TemplateMsg; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anag/Contratto.abl"}) +public class ContrattoSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = -1708108941973176059L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaTipoContratto", new TipoContratto(getApFull(req)) + .findAll()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipoContratto", new TipoContratto(apFull) + .findAll()); + req.setAttribute("listaTemplateMsg", new TemplateMsg(apFull) + .findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Contratto(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ContrattoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipoContratto", new TipoContratto(apFull) + .findAll()); + Contratto bean = new Contratto(apFull); + bean.setId_clifor(getRequestLongParameter(req, "id_clifor")); + req.setAttribute("bean", bean); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + if (getCmd(req).equals("crea1CodaSmsD") || + getCmd(req).equals("crea1CodaSmsCR")) { + long l_id = getRequestLongParameter(req, "id_contratto"); + Contratto bean = new Contratto(apFull); + bean.findByPrimaryKey(l_id); + ResParm rp = new ResParm(true); + if (getCmd(req).equals("crea1CodaSmsD")) { + ContrattoCR CR = new ContrattoCR(apFull); + fillObject(req, CR); + bean.save(); + } + if (bean.getDBState() == 1) { + rp = bean.creaCodaMessaggio(); + } else { + rp.setStatus(false); + rp.setMsg("Errore!. Impossibile salvare contratto"); + } + if (rp.getStatus()) { + sendMessage(req, "Creazione coda messaggio avvenuto con successo"); + } else { + sendMessage(req, rp.getMsg()); + } + if (getCmd(req).equals("crea1CodaSmsD")) { + showBean(req, res); + } else { + search(req, res); + } + } else if (getCmd(req).equals("creaCodaSms")) { + Contratto bean = new Contratto(apFull); + ContrattoCR CR = new ContrattoCR(apFull); + fillObject(req, CR); + ResParm rp = new ResParm(true); + rp = bean.creaCodaMessaggiSms(CR); + if (rp.getStatus()) { + sendMessage(req, "Creazione coda messaggi ok. " + + rp.getStatus()); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } + super.otherCommands(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/EsercizioSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/EsercizioSvlt.java new file mode 100644 index 00000000..1cfae4b5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/EsercizioSvlt.java @@ -0,0 +1,34 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Esercizio; +import it.acxent.anag.EsercizioCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Esercizio.abl"}) +public class EsercizioSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = 6202443100334163908L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Esercizio(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new EsercizioCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/FestivitaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/FestivitaSvlt.java new file mode 100644 index 00000000..82a77dc7 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/FestivitaSvlt.java @@ -0,0 +1,31 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Festivita; +import it.acxent.anag.FestivitaCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Festivita.abl"}) +public class FestivitaSvlt extends AblServletSvlt { + private static final long serialVersionUID = -6080652564320276641L; + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Festivita(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new FestivitaCR(getApFull(req)); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/FornitoreSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/FornitoreSvlt.java new file mode 100644 index 00000000..418aefcc --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/FornitoreSvlt.java @@ -0,0 +1,46 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Fornitore; +import it.acxent.anag.FornitoreCR; +import it.acxent.anag.TipoClifor; +import it.acxent.anag.TipoCliforCR; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.TipoPagamentoCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.util.ReturnItem; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anag/Fornitore.abl"}) +public class FornitoreSvlt extends CliforSvlt { + private static final long serialVersionUID = -8815931044823891081L; + + protected DBAdapter getBean(HttpServletRequest req) { + return new Fornitore(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new FornitoreCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("bean", getBean(req)); + req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull).findByCR(new TipoPagamentoCR(), 0, 0)); + req.setAttribute("RI", new ReturnItem(req.getParameter("RI"))); + TipoCliforCR CRT = new TipoCliforCR(); + CRT.setFlgTipoS("F"); + req.setAttribute("listaTipiClifor", new TipoClifor(apFull).findByCR(CRT, 0, 0)); + } + + protected String getBeanPageName(HttpServletRequest req) { + return super.getBeanPageName(req); + } + + protected final String getBeanName(HttpServletRequest req) { + return "clifor"; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/GetCliforAttachSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/GetCliforAttachSvlt.java new file mode 100644 index 00000000..51d38682 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/GetCliforAttachSvlt.java @@ -0,0 +1,36 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.AllegatoClifor; +import it.acxent.db.ApplParmFull; +import it.acxent.servlet.GetFileSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/_attach/_clifor/*"}) +public class GetCliforAttachSvlt extends GetFileSvlt { + private static final long serialVersionUID = -3594087947380598080L; + + protected String getFileName(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + boolean checkGrant = true; + long l_id_user = getLoginUserId(req); + if (l_id_user == 0L) { + checkGrant = false; + } else { + checkGrant = true; + } + if (checkGrant) { + AllegatoClifor bean = new AllegatoClifor(getApFull(req)); + bean.findByPrimaryKey(getRequestLongParameter(req, "id")); + boolean isWeb = (getRequestLongParameter(req, "w") == 1L); + String fileName = bean.getNomeFileCompletoSuDisco(); + return fileName; + } + return null; + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/GlossarioSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/GlossarioSvlt.java new file mode 100644 index 00000000..60b987d4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/GlossarioSvlt.java @@ -0,0 +1,40 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Glossario; +import it.acxent.anag.GlossarioCR; +import it.acxent.anag.TipoGlossario; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Glossario.abl"}) +public class GlossarioSvlt extends AblServletSvlt { + private static final long serialVersionUID = -6401647334745567418L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipoGlossario", new TipoGlossario(apFull).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Glossario(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new GlossarioCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/InitUpdateDbSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/InitUpdateDbSvlt.java new file mode 100644 index 00000000..7547b8a4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/InitUpdateDbSvlt.java @@ -0,0 +1,21 @@ +package it.acxent.anag.servlet; + +public class InitUpdateDbSvlt extends it.acxent.servlet.InitUpdateDbSvlt { + private static final long serialVersionUID = 2009630112308732636L; + + protected String getProjectVersionTag() { + return "acxent-common"; + } + + protected long getDatabaseVersionNumber() { + return 342L; + } + + protected String getSubVersionNumber() { + return "20251204-att"; + } + + protected boolean shouldInitCore() { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/IvaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/IvaSvlt.java new file mode 100644 index 00000000..210a2aac --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/IvaSvlt.java @@ -0,0 +1,38 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Iva; +import it.acxent.anag.IvaCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Iva.abl"}) +public class IvaSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = 8212895088866865976L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaIva", new Iva(apFull).findAllNoRM()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Iva(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new IvaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ListinoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ListinoSvlt.java new file mode 100644 index 00000000..75de0a0b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/ListinoSvlt.java @@ -0,0 +1,180 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Listino; +import it.acxent.anag.ListinoArticolo; +import it.acxent.anag.ListinoCR; +import it.acxent.anag.ListinoTipo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.AbMessages; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Listino.abl"}) +public class ListinoSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = 8779982045898426417L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Listino bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_listino"); + bean = new Listino(apFull); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + req.setAttribute("bean", bean); + req.setAttribute("id_listino", String.valueOf(bean.getId_listino())); + if (rp.getStatus() == true) { + if (getAct(req).equals("addLT")) { + ListinoTipo row = new ListinoTipo(apFull); + fillObject(req, row); + rp = bean.addListinoTipo(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delLT")) { + ListinoTipo row = new ListinoTipo(apFull); + long l_id_listinoTipo = getRequestLongParameter(req, "id_listinoTipo"); + if (l_id_listinoTipo != 0L) { + fillObject(req, row); + bean.delListinoTipo(row); + sendMessage(req, "Cancellazione Listino Tipo Effettuata"); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("modLT")) { + ListinoTipo row = new ListinoTipo(apFull); + long l_id_listinoTipo = getRequestLongParameter(req, "id_listinoTipo"); + if (l_id_listinoTipo != 0L) { + row.findByPrimaryKey(l_id_listinoTipo); + req.setAttribute("listinoTipo", row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("addListinoArticolo")) { + ListinoArticolo row = new ListinoArticolo(apFull); + ListinoArticolo beanRow = new ListinoArticolo(apFull); + fillObject(req, row); + beanRow.findByArticoloListino(row.getId_articolo(), row.getId_listino()); + if (beanRow.getDBState() == 1) { + beanRow.setPrezzoLA(row.getPrezzoLA()); + beanRow.setPercLA(row.getPercLA()); + beanRow.setPercLA1(row.getPercLA1()); + beanRow.setPercLA2(row.getPercLA2()); + beanRow.setPercLA3(row.getPercLA3()); + beanRow.setDataScadenzaOffertaLA(row.getDataScadenzaOffertaLA()); + beanRow.setPrezzoOffertaLA(row.getPrezzoOffertaLA()); + rp = beanRow.save(); + } else { + row.setDBState(0); + rp = row.save(); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delListinoArticolo")) { + ListinoArticolo row = new ListinoArticolo(apFull); + if (getRequestLongParameter(req, "id_listinoArticolo") != 0L) { + row.findByPrimaryKey(getRequestLongParameter(req, "id_listinoArticolo")); + row.delete(); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("modListinoArticolo")) { + ListinoArticolo row = new ListinoArticolo(apFull); + long l_id_listinoArticolo = getRequestLongParameter(req, "id_listinoArticolo"); + if (l_id_listinoArticolo != 0L) { + row.findByPrimaryKey(l_id_listinoArticolo); + req.setAttribute("listinoArticolo", row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("addListinoArticoloVariante")) { + long id_articolo = getRequestLongParameter(req, "id_articoloV"); + long id_articoloVariante = getRequestLongParameter(req, "id_articoloVarianteV"); + double prezzoLA = getRequestDoubleParameter(req, "prezzoLAV"); + double percLA = getRequestDoubleParameter(req, "percLAV"); + double percLA1 = getRequestDoubleParameter(req, "percLAV1"); + double percLA2 = getRequestDoubleParameter(req, "percLAV2"); + double percLA3 = getRequestDoubleParameter(req, "percLAV3"); + ListinoArticolo beanRow = new ListinoArticolo(apFull); + beanRow.findByArticoloVarianteListino(id_articoloVariante, l_id); + beanRow.setId_listino(l_id); + beanRow.setId_articolo(id_articolo); + beanRow.setId_articoloVariante(id_articoloVariante); + beanRow.setPrezzoLA(prezzoLA); + beanRow.setPercLA(percLA); + beanRow.setPercLA1(percLA1); + beanRow.setPercLA2(percLA2); + beanRow.setPercLA3(percLA3); + beanRow.setDataScadenzaOffertaLA(getRequestDateParameter(req, "dataScadenzaOffertaLAV")); + beanRow.setPrezzoOffertaLA(getRequestDoubleParameter(req, "prezzoOffertaLAV")); + rp = bean.addListinoArticoloVariante(beanRow); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delListinoArticoloVariante")) { + ListinoArticolo row = new ListinoArticolo(apFull); + if (getRequestLongParameter(req, "id_listinoArticolo") != 0L) { + row.findByPrimaryKey(getRequestLongParameter(req, "id_listinoArticolo")); + row.delete(); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("modListinoArticoloVariante")) { + ListinoArticolo row = new ListinoArticolo(apFull); + long l_id_listinoArticolo = getRequestLongParameter(req, "id_listinoArticolo"); + if (l_id_listinoArticolo != 0L) { + row.findByPrimaryKey(l_id_listinoArticolo); + req.setAttribute("listinoArticoloV", row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } + } else { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Listino bean = (Listino)beanA; + req.setAttribute("listaLT", bean.getListinoTipo()); + req.setAttribute("listaLA", bean.getListinoArticolo(getPageNumber(req), getPageRow(req))); + req.setAttribute("listaLAV", bean.getListinoArticoloVariante(getPageNumber(req), getPageRow(req))); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Listino(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ListinoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected int getPageRow(HttpServletRequest req) { + return 99999999; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/MagFisicoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/MagFisicoSvlt.java new file mode 100644 index 00000000..83f03a49 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/MagFisicoSvlt.java @@ -0,0 +1,50 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.MagFisico; +import it.acxent.anag.MagFisicoCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/MagFisico.abl"}) +public class MagFisicoSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = -573715388802369981L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new MagFisico(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new MagFisicoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } + + protected ResParm beforeSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ResParm rp = new ResParm(true); + MagFisico mf = new MagFisico(getApFull(req)); + fillObject(req, mf); + if (mf.getFlgTipo() == 3L) { + if (mf.isMagOrdinatoValorizzato()) { + rp.setMsg("ERRORE! Può essere selezionato solo un magazzino ordinato!"); + rp.setStatus(false); + return rp; + } + return super.beforeSave(beanA, req, res); + } + return super.beforeSave(beanA, req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/Menu4Svlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/Menu4Svlt.java new file mode 100644 index 00000000..c91725d9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/Menu4Svlt.java @@ -0,0 +1,64 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Postazione; +import it.acxent.common.Users; +import it.acxent.servlet.Logon4Svlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/menu/Menu4.abl"}) +public class Menu4Svlt extends Logon4Svlt { + private static final long serialVersionUID = -2542692347954883196L; + + protected boolean checkLoginProfile(HttpServletRequest req) { + try { + if (getLoginUser(req) == null) { + forceJspPage(getLoginPage(null, null), req); + return true; + } + if (getLoginUser(req).getFlgValido().equals("N")) { + forceJspPage(getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return false; + } + if (getLoginUser(req).getId_userProfile() > 0L) { + forceJspPage(getLoginPage(null, null), req); + return true; + } + forceJspPage(getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return true; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + + protected Users getUser(HttpServletRequest req) { + return new it.acxent.anag.Users(getApFull(req)); + } + + protected long checkLoginName(HttpServletRequest req, HttpServletResponse res) { + long result = super.checkLoginName(req, res); + if (result == 5L) { + String ip = req.getRemoteHost(); + Postazione pos = new Postazione(getApFull(req)); + pos.findByIp(ip); + it.acxent.anag.Users bean = (it.acxent.anag.Users)getLoginUser(req); + System.out.println("LOGIN EFFETTUATO: user:" + bean.getLogin() + " ip:" + ip); + if (pos.getDBState() == 1) { + bean.setId_postazione(pos.getId_postazione()); + req.getSession().setAttribute("utenteLogon", bean); + } + return result; + } + return result; + } + + protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) { + return getJspPage(req).isEmpty() ? "/admin/menu/_inc-menu.jsp" : getJspPage(req); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/MenuSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/MenuSvlt.java new file mode 100644 index 00000000..9419e0be --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/MenuSvlt.java @@ -0,0 +1,62 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Postazione; +import it.acxent.common.Users; +import it.acxent.servlet.LogonSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/menu/Menu.abl"}) +public class MenuSvlt extends LogonSvlt { + protected boolean checkLoginProfile(HttpServletRequest req) { + try { + if (getLoginUser(req) == null) { + forceJspPage(getLoginPage(null, null), req); + return true; + } + if (getLoginUser(req).getFlgValido().equals("N")) { + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return false; + } + if (getLoginUser(req).getId_userProfile() > 0L) { + forceJspPage(super.getLoginPage(null, null), req); + return true; + } + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return true; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + + protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) { + return super.getLoginPage(req, res); + } + + protected Users getUser(HttpServletRequest req) { + return new it.acxent.anag.Users(getApFull(req)); + } + + protected long checkLoginName(HttpServletRequest req, HttpServletResponse res) { + long result = super.checkLoginName(req, res); + if (result == 5L) { + String ip = req.getRemoteHost(); + Postazione pos = new Postazione(getApFull(req)); + pos.findByIp(ip); + it.acxent.anag.Users bean = (it.acxent.anag.Users)getLoginUser(req); + System.out.println("LOGIN EFFETTUATO: user:" + bean.getLogin() + " ip:" + ip); + if (pos.getDBState() == 1) { + bean.setId_postazione(pos.getId_postazione()); + req.getSession().setAttribute("utenteLogon", bean); + } + return result; + } + return result; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/NazioneSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/NazioneSvlt.java new file mode 100644 index 00000000..8b1caa15 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/NazioneSvlt.java @@ -0,0 +1,39 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Iva; +import it.acxent.anag.Nazione; +import it.acxent.anag.NazioneCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Nazione.abl"}) +public class NazioneSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = 370847610628258765L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaIva", new Iva(apFull).findAllOss()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Nazione(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new NazioneCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/OttoxmilleSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/OttoxmilleSvlt.java new file mode 100644 index 00000000..b5e40b69 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/OttoxmilleSvlt.java @@ -0,0 +1,31 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Ottoxmille; +import it.acxent.anag.OttoxmilleCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Ottoxmille.abl"}) +public class OttoxmilleSvlt extends AblServletSvlt { + private static final long serialVersionUID = -6080652564320276641L; + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Ottoxmille(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new OttoxmilleCR(getApFull(req)); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/PortoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/PortoSvlt.java new file mode 100644 index 00000000..38a4bfe6 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/PortoSvlt.java @@ -0,0 +1,34 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Porto; +import it.acxent.anag.PortoCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Porto.abl"}) +public class PortoSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = 6934923184756402334L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Porto(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new PortoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/PostazioneSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/PostazioneSvlt.java new file mode 100644 index 00000000..b934946d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/PostazioneSvlt.java @@ -0,0 +1,42 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Postazione; +import it.acxent.anag.PostazioneCR; +import it.acxent.anag.RegCassa; +import it.acxent.common.TipoPostazione; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Postazione.abl"}) +public class PostazioneSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = 6981087081168945592L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaRegCassa", new RegCassa(getApFull(req)).findAll()); + req.setAttribute("listaTipoPostazione", new TipoPostazione(getApFull(req)).findAll()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaRegCassa", new RegCassa(getApFull(req)).findAll()); + req.setAttribute("listaTipoPostazione", new TipoPostazione(getApFull(req)).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Postazione(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new PostazioneCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/RegCassaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/RegCassaSvlt.java new file mode 100644 index 00000000..886284d5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/RegCassaSvlt.java @@ -0,0 +1,34 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.RegCassa; +import it.acxent.anag.RegCassaCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/RegCassa.abl"}) +public class RegCassaSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = -7439868045390925263L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new RegCassa(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new RegCassaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/RegioneSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/RegioneSvlt.java new file mode 100644 index 00000000..cef68296 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/RegioneSvlt.java @@ -0,0 +1,34 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Regione; +import it.acxent.anag.RegioneCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Regione.abl"}) +public class RegioneSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = 1666821072326696239L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Regione(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new RegioneCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/RubricaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/RubricaSvlt.java new file mode 100644 index 00000000..f82c69f9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/RubricaSvlt.java @@ -0,0 +1,37 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Rubrica; +import it.acxent.anag.RubricaCR; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.TipoPagamentoCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.util.ReturnItem; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anag/Rubrica.abl"}) +public class RubricaSvlt extends CliforSvlt { + private static final long serialVersionUID = 8804339707966839406L; + + protected DBAdapter getBean(HttpServletRequest req) { + return new Rubrica(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new RubricaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("bean", getBean(req)); + req.setAttribute("listaTipoPagamento", new TipoPagamento(getApFull(req)) + .findByCR(new TipoPagamentoCR(), 0, 0)); + req.setAttribute("RI", new ReturnItem( + req.getParameter("RI"))); + } + + protected String getBeanPageName(HttpServletRequest req) { + return "rubrica"; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoAllegatoCliforSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoAllegatoCliforSvlt.java new file mode 100644 index 00000000..2d7ca87d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoAllegatoCliforSvlt.java @@ -0,0 +1,60 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.TipoAllegatoClifor; +import it.acxent.anag.TipoAllegatoCliforCR; +import it.acxent.contab.TipoAllegatoDocumento; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.AbMessages; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/TipoAllegatoClifor.abl"}) +public class TipoAllegatoCliforSvlt extends AblServletSvlt { + private static final long serialVersionUID = 5422961426191935478L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + TipoAllegatoDocumento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_tipoDocumento"); + bean = new TipoAllegatoDocumento(getApFull(req)); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + l_id = bean.getId_tipoAllegatoDocumento(); + req.setAttribute("id_tipoAllegatoDocumento", String.valueOf(l_id)); + req.setAttribute("bean", bean); + if (rp.getStatus() != true) { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, + AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoAllegatoClifor(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoAllegatoCliforCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoCliforSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoCliforSvlt.java new file mode 100644 index 00000000..d6332e31 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoCliforSvlt.java @@ -0,0 +1,35 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.TipoClifor; +import it.acxent.anag.TipoCliforCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/TipoClifor.abl"}) +public class TipoCliforSvlt extends AblServletSvlt { + private static final long serialVersionUID = -6401647334745567418L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoClifor(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoCliforCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoContrattoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoContrattoSvlt.java new file mode 100644 index 00000000..8e381727 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoContrattoSvlt.java @@ -0,0 +1,34 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.TipoContratto; +import it.acxent.anag.TipoContrattoCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/TipoContratto.abl"}) +public class TipoContrattoSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = 589377432507424207L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoContratto(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoContrattoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoGlossarioSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoGlossarioSvlt.java new file mode 100644 index 00000000..b55dc265 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoGlossarioSvlt.java @@ -0,0 +1,35 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.TipoGlossario; +import it.acxent.anag.TipoGlossarioCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/TipoGlossario.abl"}) +public class TipoGlossarioSvlt extends AblServletSvlt { + private static final long serialVersionUID = -6401647334745567418L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoGlossario(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoGlossarioCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoPagamentoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoPagamentoSvlt.java new file mode 100644 index 00000000..27b388c4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoPagamentoSvlt.java @@ -0,0 +1,81 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.MeseEscluso; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.TipoPagamentoCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AddImgSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/TipoPagamento.abl"}) +public class TipoPagamentoSvlt extends _AnagAdapterSvlt implements AddImgSvlt { + private static final long serialVersionUID = -759824067431772574L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + TipoPagamento bean = (TipoPagamento)beanA; + req.setAttribute("listaMesiEsclusi", bean.getMesiEsclusi()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoPagamento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoPagamentoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + super.search(req, res); + } + + public void _addMeseEscluso(HttpServletRequest req, HttpServletResponse res) { + MeseEscluso escluso = new MeseEscluso(getApFull(req)); + fillObject(req, escluso); + ResParm rp = escluso.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _delMeseEscluso(HttpServletRequest req, HttpServletResponse res) { + long id_meseEscluso = getRequestLongParameter(req, "id_meseEscluso"); + MeseEscluso escluso = new MeseEscluso(getApFull(req)); + escluso.findByPrimaryKey(id_meseEscluso); + ResParm rp = escluso.delete(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _cambiaFlg(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + TipoPagamento bean = new TipoPagamento(apFull); + long l_id_tipo = getRequestLongParameter(req, "id_tipoPagamento"); + String l_flg = getRequestParameter(req, "flg"); + bean.findByPrimaryKey(l_id_tipo); + ResParm rp = bean.cambiaFlg(l_flg); + if (rp.getStatus()) { + sendMessage(req, "Aggiornamento Effettuato"); + } else { + sendMessage(req, "Errore! " + rp.getMsg()); + } + search(req, res); + } + + protected boolean isLoadImageServlet() { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoPersonaCaricoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoPersonaCaricoSvlt.java new file mode 100644 index 00000000..d611ab5c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/TipoPersonaCaricoSvlt.java @@ -0,0 +1,30 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.tr.TipoPersonaCarico; +import it.acxent.anag.tr.TipoPersonaCaricoCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class TipoPersonaCaricoSvlt extends _AnagAdapterSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoPersonaCarico(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoPersonaCaricoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/UpdateSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/UpdateSvlt.java new file mode 100644 index 00000000..7d87334a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/UpdateSvlt.java @@ -0,0 +1,81 @@ +package it.acxent.anag.servlet; + +import com.jcraft.jsch.Channel; +import com.jcraft.jsch.ChannelSftp; +import com.jcraft.jsch.JSch; +import com.jcraft.jsch.Session; +import it.acxent.anag.Users; +import it.acxent.anag.UsersCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import java.util.Vector; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anag/Update.abl"}) +public class UpdateSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = -2542695827954883196L; + + public void _updateApp(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(); + JSch jsch = new JSch(); + String user = "fe-upd"; + String pass = "pippolone1000"; + String server = "dev.f3.net"; + String depPath = "/usr/local/jenkins/workspace/cli-fotoeventi/dependencies"; + String targetPath = "/usr/local/jenkins/workspace/cli-fotoeventi/target"; + int port = 9417; + Session session = null; + ChannelSftp sftpChannel = null; + try { + session = jsch.getSession(user, server, port); + session.setConfig("StrictHostKeyChecking", "no"); + session.setPassword(pass); + session.connect(); + Channel channel = session.openChannel("sftp"); + channel.connect(); + sftpChannel = (ChannelSftp)channel; + sftpChannel.cd("/usr/local/jenkins/workspace/cli-fotoeventi/dependencies"); + Vector listDep = sftpChannel.ls(depPath); + sftpChannel.exit(); + rp.setStatus(true); + } catch (Exception ex) { + System.out.println("getFileViaSFtp: " + ex.getMessage()); + rp.setException(ex); + rp.setMsg(ex.getMessage()); + rp.setStatus(false); + } finally { + try { + if (session.isConnected()) + sftpChannel.exit(); + } catch (Exception ex) { + System.out.println("getFileViaSFtp: " + ex.getMessage()); + rp.setException(ex); + rp.setMsg(ex.getMessage()); + rp.setStatus(false); + } + } + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Users(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + UsersCR CR = new UsersCR(); + CR.setPolicy(getLoginUser(req).getUserProfile().getPolicy()); + return (CRAdapter)CR; + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {} + + protected String getBeanPageName(HttpServletRequest req) { + return "update"; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/UsersSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/UsersSvlt.java new file mode 100644 index 00000000..b328462c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/UsersSvlt.java @@ -0,0 +1,143 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.UserClifor; +import it.acxent.anag.Users; +import it.acxent.anag.UsersCR; +import it.acxent.common.AccessGroup; +import it.acxent.common.UserAccess; +import it.acxent.common.UserAccessGroup; +import it.acxent.common.UserProfile; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.newsletter.TemplateMsg; +import it.acxent.util.AbMessages; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class UsersSvlt extends it.acxent.servlet.UsersSvlt { + private static final long serialVersionUID = 4988354513819461878L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Users bean = (Users)beanA; + req.setAttribute("listaUserClifor", new UserClifor(getApFull(req)).findByUser(bean.getId_users())); + super.fillComboAfterDetail((DBAdapter)bean, req, res); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + super.fillComboAfterSearch(CR, req, res); + req.setAttribute("listaTemplateMsg", new TemplateMsg(getApFull(req)).findAll(1L)); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Users(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + UsersCR CR = new UsersCR(); + CR.setPolicy(getLoginUser(req).getUserProfile().getPolicy()); + return (CRAdapter)CR; + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + if (getLoginUser(req).getId_userProfile() == 1L) { + req.setAttribute("listaProfiliUtente", new UserProfile(getApFull(req)).findAll()); + } else { + req.setAttribute("listaProfiliUtente", new UserProfile(getApFull(req)).findUserProfiles()); + } + req.setAttribute("listaAccessGroup", new AccessGroup(getApFull(req)).findAll()); + req.setAttribute("listaUserClifor", new UserClifor(getApFull(req)).findByCR(null, 0, 0)); + } + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id = 0L; + ResParm rp = new ResParm(true, ""); + l_id = getRequestLongParameter(req, "id_users"); + Users bean = new Users(apFull); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + if (rp.getStatus()) { + req.setAttribute("id_users", String.valueOf(bean.getId_users())); + if (getAct(req).equals("addAccess")) { + UserAccess up = new UserAccess(apFull); + fillObject(req, up); + rp = bean.addAccess(up); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delAccess")) { + UserAccess up = new UserAccess(apFull); + fillObject(req, up); + rp = bean.delAccess(up); + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Permesso Cancellato"); + showBean(req, res); + } else if (getAct(req).equals("addAccessGroup")) { + UserAccessGroup row = new UserAccessGroup(apFull); + fillObject(req, row); + rp = bean.addAccessGroup(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delAccessGroup")) { + UserAccessGroup row = new UserAccessGroup(apFull); + fillObject(req, row); + rp = bean.delAccessGroup(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Permessi Cancellati"); + showBean(req, res); + } else if (getAct(req).equals("delLog")) { + rp = bean.delAllLogs(); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK") + ": Log Cancellati"); + showBean(req, res); + } + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL " + rp.getMsg())); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected void print(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + if (getAct(req).equals("lblUser")) { + long l_id = 0L; + Users bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + bean = new Users(apFull); + bean.findByPrimaryKey(l_id); + } else if (getAct(req).equals("lblBc")) { + long l_id = 0L; + Users bean = null; + l_id = getRequestLongParameter(req, "id_users"); + bean = new Users(apFull); + bean.findByPrimaryKey(l_id); + sendPdf(res, bean.creaLabelUtenteA4Pdf(), "Label " + bean.getCognomeNome() + ".pdf"); + } else { + super.print(req, res); + } + } + + public void _addUserCliente(HttpServletRequest req, HttpServletResponse res) { + long l_id_clifor = getRequestLongParameter(req, "id_cliforU"); + long l_id_users = getRequestLongParameter(req, "id_users"); + UserClifor uc = new UserClifor(getApFull(req)); + uc.setId_clifor(l_id_clifor); + uc.setId_users(l_id_users); + ResParm rp = uc.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _delUserCliente(HttpServletRequest req, HttpServletResponse res) { + long l_id_userClifor = getRequestLongParameter(req, "id_userClifor"); + UserClifor uc = new UserClifor(getApFull(req)); + uc.findByPrimaryKey(l_id_userClifor); + ResParm rp = uc.delete(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/VettoreSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/VettoreSvlt.java new file mode 100644 index 00000000..e7d215a7 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/VettoreSvlt.java @@ -0,0 +1,34 @@ +package it.acxent.anag.servlet; + +import it.acxent.anag.Vettore; +import it.acxent.anag.VettoreCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/anagConfig/Vettore.abl"}) +public class VettoreSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = -1859476956877711417L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Vettore(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new VettoreCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/_AnagAdapterSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/_AnagAdapterSvlt.java new file mode 100644 index 00000000..863b300d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/servlet/_AnagAdapterSvlt.java @@ -0,0 +1,55 @@ +package it.acxent.anag.servlet; + +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class _AnagAdapterSvlt extends AblServletSvlt { + protected boolean checkLoginProfile(HttpServletRequest req) { + try { + if (getLoginUser(req) == null) { + forceJspPage(getLoginPage(null, null), req); + return true; + } + if (getLoginUser(req).getFlgValido().equals("N")) { + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return false; + } + if (getLoginUser(req).getId_userProfile() > 0L) + return true; + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return true; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + + protected String getAct3(HttpServletRequest req) { + return getRequestParameter(req, "act3"); + } + + protected String getCmd3(HttpServletRequest req) { + return getRequestParameter(req, "cmd3"); + } + + protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) { + return super.getLoginPage(req, res); + } + + protected boolean useAlwaysSendRedirect() { + return true; + } + + protected String getPathImgArticoli() { + return getDocBase() + "/" + getDocBase(); + } + + protected String getMailingListFileCR() { + return getParm("MAIL_LIST_FILE_CR").getTesto(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/PersonaCarico.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/PersonaCarico.java new file mode 100644 index 00000000..c8aead13 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/PersonaCarico.java @@ -0,0 +1,181 @@ +package it.acxent.anag.tr; + +import it.acxent.anag.Clifor; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class PersonaCarico extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1680269653578L; + + private long id_personaCarico; + + private long id_clifor; + + private long id_tipoPersonaCarico; + + private String cognomePC; + + private String nomePC; + + private String codFiscPC; + + private double percCarico; + + private String notaPC; + + private Clifor clifor; + + private TipoPersonaCarico tipoPersonaCarico; + + public PersonaCarico(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public PersonaCarico() {} + + public void setId_personaCarico(long newId_personaCarico) { + this.id_personaCarico = newId_personaCarico; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_tipoPersonaCarico(long newId_tipoPersonaCarico) { + this.id_tipoPersonaCarico = newId_tipoPersonaCarico; + setTipoPersonaCarico(null); + } + + public void setCognomePC(String newCognomePC) { + this.cognomePC = newCognomePC; + } + + public void setNomePC(String newNomePC) { + this.nomePC = newNomePC; + } + + public void setCodFiscPC(String newCodFisc) { + this.codFiscPC = newCodFisc; + } + + public void setPercCarico(double newPercCarico) { + this.percCarico = newPercCarico; + } + + public long getId_personaCarico() { + return this.id_personaCarico; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_tipoPersonaCarico() { + return this.id_tipoPersonaCarico; + } + + public String getCognomePC() { + return (this.cognomePC == null) ? "" : this.cognomePC.trim(); + } + + public String getNomePC() { + return (this.nomePC == null) ? "" : this.nomePC.trim(); + } + + public String getCodFiscPC() { + return (this.codFiscPC == null) ? "" : this.codFiscPC.trim(); + } + + public double getPercCarico() { + return this.percCarico; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setTipoPersonaCarico(TipoPersonaCarico newTipoPersonaCarico) { + this.tipoPersonaCarico = newTipoPersonaCarico; + } + + public TipoPersonaCarico getTipoPersonaCarico() { + this.tipoPersonaCarico = (TipoPersonaCarico)getSecondaryObject(this.tipoPersonaCarico, TipoPersonaCarico.class, getId_tipoPersonaCarico()); + return this.tipoPersonaCarico; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(PersonaCaricoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from PERSONA_CARICO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByCliente(long l_id_clifor, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from PERSONA_CARICO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getCognomeNomePC() { + return getCognomePC() + " " + getCognomePC(); + } + + public String getDescrizione() { + return getCognomeNomePC() + " " + getCognomeNomePC(); + } + + public String getNotaPC() { + return (this.notaPC == null) ? "" : this.notaPC.trim(); + } + + public void setNotaPC(String notaPC) { + this.notaPC = notaPC; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/PersonaCaricoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/PersonaCaricoCR.java new file mode 100644 index 00000000..9380c931 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/PersonaCaricoCR.java @@ -0,0 +1,113 @@ +package it.acxent.anag.tr; + +import it.acxent.anag.Clifor; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class PersonaCaricoCR extends CRAdapter { + private static final long serialVersionUID = -5540037425456661778L; + + private long id_personaCarico; + + private long id_clifor; + + private long id_tipoPersonaCarico; + + private String cognomePC; + + private String nomePC; + + private String codFiscPC; + + private double percCarico; + + private Clifor clifor; + + private TipoPersonaCarico tipoPersonaCarico; + + public PersonaCaricoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public PersonaCaricoCR() {} + + public void setId_personaCarico(long newId_personaCarico) { + this.id_personaCarico = newId_personaCarico; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_tipoPersonaCarico(long newId_tipoPersonaCarico) { + this.id_tipoPersonaCarico = newId_tipoPersonaCarico; + setTipoPersonaCarico(null); + } + + public void setCognomePC(String newCognomePC) { + this.cognomePC = newCognomePC; + } + + public void setNomePC(String newNomePC) { + this.nomePC = newNomePC; + } + + public void setCodFiscPC(String newCodFisc) { + this.codFiscPC = newCodFisc; + } + + public void setPercCarico(double newPercCarico) { + this.percCarico = newPercCarico; + } + + public long getId_personaCarico() { + return this.id_personaCarico; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_tipoPersonaCarico() { + return this.id_tipoPersonaCarico; + } + + public String getCognomePC() { + return (this.cognomePC == null) ? "" : this.cognomePC.trim(); + } + + public String getNomePC() { + return (this.nomePC == null) ? "" : this.nomePC.trim(); + } + + public String getCodFiscPC() { + return (this.codFiscPC == null) ? "" : this.codFiscPC.trim(); + } + + public double getPercCarico() { + return this.percCarico; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, + + getId_clifor()); + return this.clifor; + } + + public void setTipoPersonaCarico(TipoPersonaCarico newTipoPersonaCarico) { + this.tipoPersonaCarico = newTipoPersonaCarico; + } + + public TipoPersonaCarico getTipoPersonaCarico() { + this.tipoPersonaCarico = (TipoPersonaCarico)getSecondaryObject(this.tipoPersonaCarico, TipoPersonaCarico.class, + + getId_tipoPersonaCarico()); + return this.tipoPersonaCarico; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/TipoPersonaCarico.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/TipoPersonaCarico.java new file mode 100644 index 00000000..9a2e0298 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/TipoPersonaCarico.java @@ -0,0 +1,73 @@ +package it.acxent.anag.tr; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoPersonaCarico extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1680269653603L; + + private long id_tipoPersonaCarico; + + private String descrizione; + + public TipoPersonaCarico(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoPersonaCarico() {} + + public void setId_tipoPersonaCarico(long newId_tipoPersonaCarico) { + this.id_tipoPersonaCarico = newId_tipoPersonaCarico; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoPersonaCarico() { + return this.id_tipoPersonaCarico; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoPersonaCaricoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_PERSONA_CARICO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/TipoPersonaCaricoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/TipoPersonaCaricoCR.java new file mode 100644 index 00000000..74d7015a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/TipoPersonaCaricoCR.java @@ -0,0 +1,32 @@ +package it.acxent.anag.tr; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoPersonaCaricoCR extends CRAdapter { + private long id_tipoPersonaCarico; + + private String descrizione; + + public TipoPersonaCaricoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoPersonaCaricoCR() {} + + public void setId_tipoPersonaCarico(long newId_tipoPersonaCarico) { + this.id_tipoPersonaCarico = newId_tipoPersonaCarico; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoPersonaCarico() { + return this.id_tipoPersonaCarico; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/package-info.java new file mode 100644 index 00000000..8fc66d31 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/anag/tr/package-info.java @@ -0,0 +1 @@ +package it.acxent.anag.tr; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/AWSV4Auth.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/AWSV4Auth.java new file mode 100644 index 00000000..8125c7ac --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/AWSV4Auth.java @@ -0,0 +1,305 @@ +package it.acxent.api.amz; + +import java.math.BigInteger; +import java.net.URLEncoder; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; +import java.util.TimeZone; +import java.util.TreeMap; +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; + +public class AWSV4Auth { + private String accessKeyID; + + private String secretAccessKey; + + private String regionName; + + private String serviceName; + + private String httpMethodName; + + private String canonicalURI; + + private TreeMap queryParametes; + + private TreeMap awsHeaders; + + private String payload; + + private AWSV4Auth() {} + + public static void main(String[] args) { + String url = "xxxxx-yyyyy-r6nvlhpscgdwms5.ap-northeast-1.es.amazonaws.com/inventory/simple/123"; + TreeMap awsHeaders = new TreeMap<>(); + awsHeaders.put("host", "xxxxx-yyyyy-r6nvlhpscgdwms5.ap-northeast-1.es.amazonaws.com"); + AWSV4Auth aWSV4Auth = new Builder("exampleKey", "exampleSecret").regionName("xx-yy-zzz").serviceName("es") + + + .httpMethodName("GET") + .canonicalURI("/inventory/simple/123") + .queryParametes(null) + .awsHeaders(awsHeaders) + .payload(null) + .debug() + .build(); + Map header = aWSV4Auth.getHeaders(); + for (Map.Entry entrySet : header.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + System.out.println(key + ":" + key); + } + } + + public static class Builder { + private String accessKeyID; + + private String secretAccessKey; + + private String regionName; + + private String serviceName; + + private String httpMethodName; + + private String canonicalURI; + + private TreeMap queryParametes; + + private TreeMap awsHeaders; + + private String payload; + + private boolean debug = false; + + public Builder(String accessKeyID, String secretAccessKey) { + this.accessKeyID = accessKeyID; + this.secretAccessKey = secretAccessKey; + } + + public Builder regionName(String regionName) { + this.regionName = regionName; + return this; + } + + public Builder serviceName(String serviceName) { + this.serviceName = serviceName; + return this; + } + + public Builder httpMethodName(String httpMethodName) { + this.httpMethodName = httpMethodName; + return this; + } + + public Builder canonicalURI(String canonicalURI) { + this.canonicalURI = canonicalURI; + return this; + } + + public Builder queryParametes(TreeMap queryParametes) { + this.queryParametes = queryParametes; + return this; + } + + public Builder awsHeaders(TreeMap awsHeaders) { + this.awsHeaders = awsHeaders; + return this; + } + + public Builder payload(String payload) { + this.payload = payload; + return this; + } + + public Builder debug() { + this.debug = true; + return this; + } + + public AWSV4Auth build() { + return new AWSV4Auth(this); + } + } + + private boolean debug = false; + + private final String HMACAlgorithm = "AWS4-HMAC-SHA256"; + + private final String aws4Request = "aws4_request"; + + private String strSignedHeader; + + private String xAmzDate; + + private String currentDate; + + private AWSV4Auth(Builder builder) { + this.accessKeyID = builder.accessKeyID; + this.secretAccessKey = builder.secretAccessKey; + this.regionName = builder.regionName; + this.serviceName = builder.serviceName; + this.httpMethodName = builder.httpMethodName; + this.canonicalURI = builder.canonicalURI; + this.queryParametes = builder.queryParametes; + this.awsHeaders = builder.awsHeaders; + this.payload = builder.payload; + this.debug = builder.debug; + this.xAmzDate = getTimeStamp(); + this.currentDate = getDate(); + } + + private String prepareCanonicalRequest() { + StringBuilder canonicalURL = new StringBuilder(""); + canonicalURL.append(this.httpMethodName).append("\n"); + this.canonicalURI = (this.canonicalURI == null || this.canonicalURI.trim().isEmpty()) ? "/" : this.canonicalURI; + canonicalURL.append(this.canonicalURI).append("\n"); + StringBuilder queryString = new StringBuilder(""); + if (this.queryParametes != null && !this.queryParametes.isEmpty()) { + for (Map.Entry entrySet : this.queryParametes.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + queryString.append(key).append("=").append(encodeParameter(value)).append("&"); + } + queryString.deleteCharAt(queryString.lastIndexOf("&")); + queryString.append("\n"); + } else { + queryString.append("\n"); + } + canonicalURL.append((CharSequence)queryString); + StringBuilder signedHeaders = new StringBuilder(""); + if (this.awsHeaders != null && !this.awsHeaders.isEmpty()) { + for (Map.Entry entrySet : this.awsHeaders.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + signedHeaders.append(key).append(";"); + canonicalURL.append(key).append(":").append(value).append("\n"); + } + canonicalURL.append("\n"); + } else { + canonicalURL.append("\n"); + } + this.strSignedHeader = signedHeaders.substring(0, signedHeaders.length() - 1); + canonicalURL.append(this.strSignedHeader).append("\n"); + this.payload = (this.payload == null) ? "" : this.payload; + canonicalURL.append(generateHex(this.payload)); + if (this.debug) + System.out.println("##Canonical Request:\n" + canonicalURL.toString()); + return canonicalURL.toString(); + } + + private String prepareStringToSign(String canonicalURL) { + String stringToSign = ""; + stringToSign = "AWS4-HMAC-SHA256\n"; + stringToSign = stringToSign + stringToSign + "\n"; + stringToSign = stringToSign + stringToSign + "/" + this.currentDate + "/" + this.regionName + "/aws4_request\n"; + stringToSign = stringToSign + stringToSign; + if (this.debug) + System.out.println("##String to sign:\n" + stringToSign); + return stringToSign; + } + + private String calculateSignature(String stringToSign) { + try { + byte[] signatureKey = getSignatureKey(this.secretAccessKey, this.currentDate, this.regionName, this.serviceName); + byte[] signature = HmacSHA256(signatureKey, stringToSign); + String strHexSignature = bytesToHex(signature); + return strHexSignature; + } catch (Exception ex) { + ex.printStackTrace(); + return null; + } + } + + public Map getHeaders() { + this.awsHeaders.put("x-amz-date", this.xAmzDate); + String canonicalURL = prepareCanonicalRequest(); + String stringToSign = prepareStringToSign(canonicalURL); + String signature = calculateSignature(stringToSign); + if (signature != null) { + Map header = new HashMap<>(0); + header.put("Authorization", buildAuthorizationString(signature)); + if (this.debug) { + System.out.println("##Signature:\n" + signature); + System.out.println("##Header:"); + for (Map.Entry entrySet : header.entrySet()) + System.out.println((String)entrySet.getKey() + " = " + (String)entrySet.getKey()); + System.out.println("================================"); + } + return header; + } + if (this.debug) + System.out.println("##Signature:\n" + signature); + return null; + } + + private String buildAuthorizationString(String strSignature) { + return "AWS4-HMAC-SHA256 Credential=" + this.accessKeyID + "/" + getDate() + "/" + this.regionName + "/" + this.serviceName + "/aws4_request,SignedHeaders=" + this.strSignedHeader + ",Signature=" + strSignature; + } + + public static String generateHex(String data) { + try { + MessageDigest messageDigest = MessageDigest.getInstance("SHA-256"); + messageDigest.update(data.getBytes("UTF-8")); + byte[] digest = messageDigest.digest(); + return String.format("%064x", new BigInteger(1, digest)); + } catch (NoSuchAlgorithmException|java.io.UnsupportedEncodingException e) { + e.printStackTrace(); + return null; + } + } + + private byte[] HmacSHA256(byte[] key, String data) throws Exception { + String algorithm = "HmacSHA256"; + Mac mac = Mac.getInstance(algorithm); + mac.init(new SecretKeySpec(key, algorithm)); + return mac.doFinal(data.getBytes("UTF8")); + } + + private byte[] getSignatureKey(String key, String date, String regionName, String serviceName) throws Exception { + byte[] kSecret = ("AWS4" + key).getBytes("UTF8"); + byte[] kDate = HmacSHA256(kSecret, date); + byte[] kRegion = HmacSHA256(kDate, regionName); + byte[] kService = HmacSHA256(kRegion, serviceName); + byte[] kSigning = HmacSHA256(kService, "aws4_request"); + return kSigning; + } + + protected static final char[] hexArray = "0123456789ABCDEF".toCharArray(); + + private String bytesToHex(byte[] bytes) { + char[] hexChars = new char[bytes.length * 2]; + for (int j = 0; j < bytes.length; j++) { + int v = bytes[j] & 0xFF; + hexChars[j * 2] = hexArray[v >>> 4]; + hexChars[j * 2 + 1] = hexArray[v & 0xF]; + } + return new String(hexChars).toLowerCase(); + } + + private String getTimeStamp() { + DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss'Z'"); + dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + return dateFormat.format(new Date()); + } + + private String getDate() { + DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd"); + dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); + return dateFormat.format(new Date()); + } + + private String encodeParameter(String param) { + try { + return URLEncoder.encode(param, "UTF-8"); + } catch (Exception e) { + return URLEncoder.encode(param); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/AmzResult.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/AmzResult.java new file mode 100644 index 00000000..68f13794 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/AmzResult.java @@ -0,0 +1,41 @@ +package it.acxent.api.amz; + +public class AmzResult { + private String msg; + + public AmzResult(String msg, boolean status, Object result) { + this.msg = msg; + this.ok = status; + this.result = result; + } + + private boolean ok = true; + + private Object result; + + public AmzResult() {} + + public String getMsg() { + return this.msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public boolean isOk() { + return this.ok; + } + + public void setOk(boolean status) { + this.ok = status; + } + + public Object getResult() { + return this.result; + } + + public void setResult(Object result) { + this.result = result; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/AmzSellerApi.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/AmzSellerApi.java new file mode 100644 index 00000000..679ee454 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/AmzSellerApi.java @@ -0,0 +1,1724 @@ +package it.acxent.api.amz; + +import it.acxent.art.AmzFeaturedPrice; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.cc.Attivita; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.DoubleOperator; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.TreeMap; +import org.apache.http.Consts; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import org.json.JSONArray; +import org.json.JSONObject; + +public class AmzSellerApi { + private Attivita attivita; + + public AmzSellerApi(String lwaClientId, String lwaClientSecret, String lwaAuthToken) { + this.attivita = this.attivita; + this.lwaClientId = lwaClientId; + this.lwaClientSecret = lwaClientSecret; + this.lwaAuthToken = lwaAuthToken; + } + + private boolean debug = false; + + private ApplParmFull apFull = null; + + private String lwaClientId; + + private String lwaClientSecret; + + private String lwaAuthToken; + + private String lwaAccessToken; + + private String lwaRefreshToken; + + private Timestamp lwaAccessTokenExpireTS = null; + + private String iamRoleARN; + + private String iamAccessKey; + + private String iamSecretKey; + + private String stsAccessKeyId; + + private String stsSecretAccessKey; + + private String stsSessionToken; + + private Timestamp stsSessionTokenTS = null; + + private HashMap hmMarketplaces; + + public static final String P_AMZ_LWA_CLIENT_ID = "AMZ_LWA_CLIENT_ID"; + + public static final String P_AMZ_LWA_CLIENT_SECRET = "AMZ_LWA_CLIENT_SECRET"; + + public static final String P_AMZ_LWA_AUTH_TOKEN = "AMZ_LWA_AUTH_TOKEN"; + + public static final String P_AMZ_IAM_ROLE_ARN = "AMZ_IAM_ROLE_ARN"; + + public static final String P_AMZ_IAM_ACCESS_KEY = "AMZ_IAM_ACCESS_KEY"; + + public static final String P_AMZ_IAM_SECRET_KEY = "AMZ_IAM_SECRET_KEY"; + + public static final String P_AMZ_LWA_REFRESH_TOKEN = "AMZ_LWA_REFRESH_TOKEN"; + + public static final String P_AMZ_LWA_REFRESH_TOKEN_TS = "AMZ_LWA_REFRESH_TOKEN_TS"; + + public static final String P_AMZ_STS_ACCESS_KEY_ID = "AMZ_STS_ACCESS_KEY_ID"; + + public static final String P_AMZ_STS_SECRET_ACCESS_KEY = "AMZ_STS_SECRET_ACCESS_KEY"; + + public static final String P_AMZ_STS_ACCESS_TOKEN = "AMZ_STS_ACCESS_TOKEN"; + + public static final String P_AMZ_STS_ACCESS_TOKEN_TS = "AMZ_STS_ACCESS_TOKEN_TS"; + + private static final String URI_CMD_LWA_ACCESS_TOKEN = "https://api.amazon.com/auth/o2/token"; + + private static final String URI_CMD_STS_TEMPORARY_TOKEN = "https://sts.amazonaws.com"; + + private static final String URI_CMD_MARKETPLACES_HOST = "https://sellingpartnerapi-eu.amazon.com"; + + private static final String URI_CMD_MARKETPLACES_ID_ENDPOINT = "/sellers/v1/marketplaceParticipations"; + + private static final String URI_CMD_LISTINGS_HOST = "https://sellingpartnerapi-eu.amazon.com"; + + private static final String URI_CMD_LISTINGS_ENDPOINT = "/listings/2021-08-01/items/:sellerId/:sku"; + + private static final String URI_CMD_PRODUCT_TYPE_DEFINITION_HOST = "https://sellingpartnerapi-eu.amazon.com"; + + private static final String URI_CMD_PRODUCT_TYPE_DEFINITION_ENDPOINT = "/definitions/2020-09-01/productTypes/:productType"; + + private static final String URI_CMD_GET_CATALOG_ITEMS_HOST = "https://sellingpartnerapi-eu.amazon.com"; + + private static final String URI_CMD_GET_CATALOG_ITEMS_ENDPOINT = "/catalog/2022-04-01/items"; + + private static final String URI_CMD_GET_PRICING_V0_ITEMS_HOST = "https://sellingpartnerapi-eu.amazon.com"; + + private static final String URI_CMD_GET_PRICING_V0_BATCH_ITEMS_HOST = "/batches/products/pricing/v0/itemOffers"; + + private static final String URI_CMD_GET_PRICING_V0_LOWEST_ASIN_ENDPOINT = "/products/pricing/v0/items/:Asin/offers"; + + private static final String URI_CMD_GET_PRICING_ITEMS_HOST = "https://sellingpartnerapi-eu.amazon.com"; + + private static final String URI_CMD_GET_PRICING_ITEMS_ENDPOINT = "/batches/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice"; + + public AmzSellerApi(Attivita attivita) { + this.apFull = attivita.getApFull(); + this.lwaClientId = attivita.getAmzLwaClientId(); + this.lwaClientSecret = attivita.getAmzLwaClientSecret(); + this.lwaAuthToken = attivita.getAmzLwaAuthToken(); + this.lwaAccessToken = attivita.getAmzLwaAccessToken(); + this.lwaAccessTokenExpireTS = attivita.getAmzLwaAccessTokenExpireTS(); + this.iamAccessKey = attivita.getAmzIamAccessKey(); + this.iamRoleARN = attivita.getAmzIamRoleARN(); + this.iamSecretKey = attivita.getAmzIamSecretKey(); + this.stsAccessKeyId = attivita.getAmzStsAccessKeyId(); + this.stsSecretAccessKey = attivita.getAmzStsSecretAccessKey(); + this.stsSessionToken = attivita.getAmzStsSessionToken(); + this.stsSessionTokenTS = attivita.getAmzStsSessionTokenTS(); + StringTokenizer st = new StringTokenizer(attivita.getAmzMarketplaces(), ","); + while (st.hasMoreTokens()) { + String currentLang = st.nextToken(); + String currentId = st.nextToken(); + getHmMarketplaces().put(currentLang, currentId); + } + } + + public AmzSellerApi() {} + + public static void initApplicationParms(ApplParmFull ap) { + if (ap != null) { + DBAdapter.logDebug(true, "AMAZON initParms: start"); + DBAdapter.logDebug(true, "AMAZON initParms: stop"); + } + } + + public static void main(String[] args) { + String hostname = "localhost:3308"; + String db = "cc"; + ApplParmFull ap = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, db, "root", "root", 1, 10, 300)); + AmzSellerApi bean = new AmzSellerApi(Attivita.getDefaultInstance(ap)); + Articolo articolo = new Articolo(ap); + articolo.findByCodiceEanSerie("8714574523347", null); + ArticoloCR CR = new ArticoloCR(); + CR.setId_articolo(articolo.getId_articolo()); + JSONObject item = bean.getJsonOfferByArticolo(articolo, "it"); + System.out.println("json amz item:\n" + item.toString(4)); + AmzResult res = bean.amzPutListingsItem(articolo, "it"); + System.out.println(res.getMsg() + "\n" + res.getMsg()); + } + + public ApplParmFull getApFull() { + return this.apFull; + } + + public void setApFull(ApplParmFull apFull) { + this.apFull = apFull; + } + + public Attivita getAttivita() { + if (this.attivita == null) + this.attivita = Attivita.getDefaultInstance(getApFull()); + return this.attivita; + } + + public AmzResult amzGetStsAwsCredential() { + AmzResult resAR = amzCheckLwaTokens(); + if (resAR.isOk()) + try { + if (this.debug) + System.out.println("AmzSellerApi --> amzGetStsAwsCredential"); + CloseableHttpClient client = HttpClients.createDefault(); + String host = "https://sts.amazonaws.com".replace("https://", ""); + String endPoint = "/"; + TreeMap queryParms = new TreeMap<>(); + queryParms.put("Version", "2011-06-15"); + queryParms.put("Action", "AssumeRole"); + queryParms.put("RoleSessionName", "_sName" + DBAdapter.getNow().getTime()); + queryParms.put("RoleArn", getIamRoleARN()); + HttpGet request = new HttpGet("https://sts.amazonaws.com" + endPoint + getInlineQueryParms(queryParms)); + TreeMap awsHeaders = new TreeMap<>(); + awsHeaders.put("host", host); + awsHeaders.put("x-amz-access-token", getLwaAccessToken()); + awsHeaders.put("host", host); + AWSV4Auth aWSV4Auth = new AWSV4Auth.Builder(getIamAccessKey(), getIamSecretKey()).regionName("us-east-1").serviceName("sts") + .httpMethodName("GET") + .canonicalURI(endPoint) + .queryParametes(queryParms) + .awsHeaders(awsHeaders) + .payload(null) + + .build(); + Map header = aWSV4Auth.getHeaders(); + for (Map.Entry entrySet : header.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + request.setHeader("Accept", "application/json"); + for (Map.Entry entrySet : awsHeaders.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resAR.setOk(false); + JSONObject jo = new JSONObject(content); + resAR.setMsg(jo.toString(2)); + resAR.setResult(jo); + } else { + JSONObject jo = new JSONObject(content); + JSONObject joCredential = jo.getJSONObject("AssumeRoleResponse").getJSONObject("AssumeRoleResult") + .getJSONObject("Credentials"); + setStsAccessKeyId(joCredential.getString("AccessKeyId")); + setStsSecretAccessKey(joCredential.getString("SecretAccessKey")); + setStsSessionToken(joCredential.getString("SessionToken")); + Calendar cal = Calendar.getInstance(); + cal.add(12, 59); + Timestamp ts = new Timestamp(cal.getTime().getTime()); + if (this.debug) + System.out.println("Token expires on " + ts.toString()); + setStsSessionTokenTS(ts); + getAttivita().setAmzStsAccessKeyId(getStsAccessKeyId()); + getAttivita().setAmzStsSecretAccessKey(getStsSecretAccessKey()); + getAttivita().setAmzStsSessionToken(getStsSessionToken()); + getAttivita().setAmzStsSessionTokenTS(getStsSessionTokenTS()); + getAttivita().save(); + if (this.debug) + System.out.println(jo.toString(4)); + resAR.setMsg("SessionToken found"); + resAR.setOk(true); + resAR.setResult(getStsSessionToken()); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resAR.setOk(false); + resAR.setMsg(e.getMessage()); + } + return resAR; + } + + private String getInlineQueryParms(TreeMap queryParms) { + if (queryParms.size() == 0) + return ""; + String delim = "?"; + StringBuilder sbParms = new StringBuilder(); + for (Map.Entry entry : queryParms.entrySet()) { + sbParms.append(delim); + sbParms.append(entry.getKey()); + sbParms.append("="); + sbParms.append(entry.getValue()); + delim = "&"; + } + return sbParms.toString(); + } + + public String getLwaClientId() { + return (this.lwaClientId == null) ? "" : this.lwaClientId.trim(); + } + + public void setLwaClientId(String googleApiKey) { + this.lwaClientId = googleApiKey; + } + + public String getLwaClientSecret() { + return this.lwaClientSecret; + } + + public void setLwaClientSecret(String lwaClientSecret) { + this.lwaClientSecret = lwaClientSecret; + } + + public String getLwaAuthToken() { + return this.lwaAuthToken; + } + + public void setLwaAuthToken(String lwaAuthToken) { + this.lwaAuthToken = lwaAuthToken; + } + + public String getLwaAccessToken() { + return (this.lwaAccessToken == null) ? "" : this.lwaAccessToken.trim(); + } + + public void setLwaAccessToken(String lwaAccessToken) { + this.lwaAccessToken = lwaAccessToken; + } + + public String getLwaRefreshToken() { + return this.lwaRefreshToken; + } + + public void setLwaRefreshToken(String lwaRefreshToken) { + this.lwaRefreshToken = lwaRefreshToken; + } + + public Timestamp getLwaAccessTokenExpireTS() { + return this.lwaAccessTokenExpireTS; + } + + public void setLwaAccessTokenExpireTS(Timestamp lwaAccessTokenExpireTS) { + this.lwaAccessTokenExpireTS = lwaAccessTokenExpireTS; + } + + public String getStsAccessKeyId() { + return this.stsAccessKeyId; + } + + public void setStsAccessKeyId(String stsAccessKeyId) { + this.stsAccessKeyId = stsAccessKeyId; + } + + public String getStsSecretAccessKey() { + return this.stsSecretAccessKey; + } + + public void setStsSecretAccessKey(String stsSecretAccessKey) { + this.stsSecretAccessKey = stsSecretAccessKey; + } + + public String getStsSessionToken() { + return (this.stsSessionToken == null) ? "" : this.stsSessionToken.trim(); + } + + public void setStsSessionToken(String stsSessionToken) { + this.stsSessionToken = stsSessionToken; + } + + public Timestamp getStsSessionTokenTS() { + return this.stsSessionTokenTS; + } + + public void setStsSessionTokenTS(Timestamp stsSessionTokenTS) { + this.stsSessionTokenTS = stsSessionTokenTS; + } + + public String getIamRoleARN() { + return this.iamRoleARN; + } + + public void setIamRoleARN(String iamRoleARN) { + this.iamRoleARN = iamRoleARN; + } + + public String getIamAccessKey() { + return this.iamAccessKey; + } + + public void setIamAccessKey(String iamAccessKey) { + this.iamAccessKey = iamAccessKey; + } + + public String getIamSecretKey() { + return this.iamSecretKey; + } + + public void setIamSecretKey(String iamSecretKey) { + this.iamSecretKey = iamSecretKey; + } + + public AmzResult amzPostLwaAccessToken() { + AmzResult resAR = new AmzResult(); + try { + if (this.debug) + System.out.println("AmzSellerApi --> amzGetLwaAccessToken"); + CloseableHttpClient client = HttpClients.createDefault(); + HttpPost request = new HttpPost("https://api.amazon.com/auth/o2/token"); + request.setHeader("Accept", "application/json"); + request.setHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); + request.setHeader("Content-Language", "it-IT"); + List form = new ArrayList<>(); + form.add(new BasicNameValuePair("client_id", getLwaClientId())); + form.add(new BasicNameValuePair("client_secret", getLwaClientSecret())); + form.add(new BasicNameValuePair("grant_type", "refresh_token")); + form.add(new BasicNameValuePair("refresh_token", getLwaAuthToken())); + UrlEncodedFormEntity entity = new UrlEncodedFormEntity(form, Consts.UTF_8); + request.setEntity((HttpEntity)entity); + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resAR.setOk(false); + JSONObject jo = new JSONObject(content); + resAR.setMsg(jo.toString(2)); + resAR.setResult(jo); + } else { + JSONObject jo = new JSONObject(content); + setLwaAccessToken(jo.getString("access_token")); + setLwaRefreshToken(jo.getString("refresh_token")); + long expiresSecs = jo.getLong("expires_in"); + long expiresMils = (expiresSecs - 60L) * 1000L; + Calendar cal = Calendar.getInstance(); + Timestamp ts = new Timestamp(cal.getTime().getTime() + expiresMils); + if (this.debug) + System.out.println("Token expires on " + ts.toString()); + setLwaAccessTokenExpireTS(ts); + getAttivita().setAmzLwaAccessToken(getLwaAccessToken()); + getAttivita().setAmzLwaRefreshToken(getLwaRefreshToken()); + getAttivita().setAmzLwaAccessTokenExpireTS(getLwaAccessTokenExpireTS()); + getAttivita().save(); + if (this.debug) + System.out.println(jo.toString(4)); + resAR.setMsg("access_token found"); + resAR.setOk(true); + resAR.setResult(getLwaAccessToken()); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resAR.setOk(false); + resAR.setMsg(e.getMessage()); + } + return resAR; + } + + public boolean isLwaAccessTokenExpired() { + if (getLwaAccessToken().isEmpty()) + return true; + if (getLwaAccessTokenExpireTS() == null) + return true; + if (DBAdapter.getTimeDiff(DBAdapter.getTimestamp(), getLwaAccessTokenExpireTS()) <= 0L) + return true; + return false; + } + + public boolean isStsSessionTokenExpired() { + if (isLwaAccessTokenExpired()) + return true; + if (getStsSessionToken().isEmpty()) + return true; + if (getStsSessionTokenTS() == null) + return true; + if (DBAdapter.getTimeDiff(DBAdapter.getTimestamp(), getStsSessionTokenTS()) <= 0L) + return true; + return false; + } + + public HashMap getHmMarketplaces() { + if (this.hmMarketplaces == null) + this.hmMarketplaces = new HashMap<>(); + return this.hmMarketplaces; + } + + private String getMarketplacesIds(String marketplaceLangs) { + StringBuilder sb = new StringBuilder(); + StringTokenizer st = new StringTokenizer(marketplaceLangs, ","); + String theComma = ""; + while (st.hasMoreTokens()) { + String currentLang = st.nextToken(); + if (getHmMarketplaces().containsKey(currentLang)) { + sb.append(theComma); + sb.append(getHmMarketplaces().get(currentLang)); + theComma = ","; + } + } + return sb.toString(); + } + + public void setHmMarketplaces(HashMap hmMarketplaces) { + this.hmMarketplaces = hmMarketplaces; + } + + public String getMatketplaceId(String countryCode) { + if (getHmMarketplaces().containsKey(countryCode)) + return getHmMarketplaces().get(countryCode); + return ""; + } + + public AmzResult amzGetCatalogItems(Articolo articolo, String marketplaceLangs) { + AmzResult resAR = amzCheckTokensApi(marketplaceLangs); + if (resAR.isOk()) + try { + if (this.debug) + System.out.println("AmzSellerApi --> amzGetCatalogItems"); + CloseableHttpClient client = HttpClients.createDefault(); + String host = "https://sellingpartnerapi-eu.amazon.com".replace("https://", ""); + String endPoint = "/catalog/2022-04-01/items"; + TreeMap queryParms = new TreeMap<>(); + queryParms.put("marketplaceIds", getMarketplacesIds(marketplaceLangs)); + queryParms.put("identifiers", articolo.getCodiceEan()); + queryParms.put("identifiersType", "EAN"); + queryParms.put("includedData", "productTypes,summaries"); + queryParms.put("locale", "it_IT"); + queryParms.put("sellerId", getAttivita().getAmzSellerid()); + HttpGet request = new HttpGet("https://sellingpartnerapi-eu.amazon.com" + endPoint + getInlineQueryParms(queryParms)); + TreeMap awsHeaders = new TreeMap<>(); + awsHeaders.put("host", host); + awsHeaders.put("x-amz-access-token", getLwaAccessToken()); + awsHeaders.put("x-amz-security-token", getStsSessionToken()); + awsHeaders.put("Content-Type".toLowerCase(), "application/json"); + AWSV4Auth aWSV4Auth = new AWSV4Auth.Builder(getStsAccessKeyId(), getStsSecretAccessKey()).regionName("eu-west-1") + .serviceName("execute-api").httpMethodName("GET").canonicalURI(endPoint).awsHeaders(awsHeaders) + .queryParametes(queryParms).payload(null) + + .build(); + if (this.debug) { + System.out.println("stsaccesskey: " + getStsAccessKeyId()); + System.out.println("stsSecretAccessKey: " + getStsSecretAccessKey()); + } + Map header = aWSV4Auth.getHeaders(); + for (Map.Entry entrySet : header.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + for (Map.Entry entrySet : awsHeaders.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resAR.setOk(false); + resAR.setMsg(content); + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent= " + content); + } else { + JSONObject jo = new JSONObject(content); + JSONArray jaItems = jo.getJSONArray("items"); + if (jo.getLong("numberOfResults") > 0L) { + boolean asinTrovato = false; + for (int i = 0; i < jaItems.length(); i++) { + JSONObject itemI = jaItems.getJSONObject(i); + JSONObject summariesI = itemI.getJSONArray("summaries").getJSONObject(0); + String asinI = itemI.getString("asin"); + String productTypeI = itemI.getJSONArray("productTypes").getJSONObject(0).getString("productType"); + if (summariesI.has("modelNumber")) { + String modelNumberI = summariesI.getString("modelNumber"); + if (articolo.getCodiceProduttore().toLowerCase().equals(modelNumberI.toLowerCase()) || + articolo.getDescrizioneSearch().toLowerCase().contains(modelNumberI.toLowerCase())) { + String l_descAmz = asinI + " " + asinI + " " + modelNumberI + " " + summariesI.getString("brand"); + if (articolo.getAsinAmz().isEmpty() || articolo.getProductTypeAmz().isEmpty() || + !articolo.getDescAmz().equals(l_descAmz)) { + if (articolo.getAsinAmz().isEmpty()) + articolo.setAsinAmz(asinI); + if (articolo.getProductTypeAmz().isEmpty()) + articolo.setProductTypeAmz(productTypeI); + articolo.setDescAmz(l_descAmz); + articolo.setFlgAmzWarn(0L); + articolo.superSave(); + } + asinTrovato = true; + break; + } + } + } + if (asinTrovato) { + resAR.setMsg("Item found: " + articolo.getDescAmz()); + resAR.setOk(true); + resAR.setResult(jo); + } else { + resAR.setMsg("Item found but item MPN not found. Get first and warn!"); + resAR.setOk(false); + resAR.setResult(jo); + JSONObject item0 = jaItems.getJSONObject(0); + String productType0 = item0.getJSONArray("productTypes").getJSONObject(0).getString("productType"); + String asin = item0.getString("asin"); + JSONObject summaries0 = item0.getJSONArray("summaries").getJSONObject(0); + String modelNumber0 = ""; + if (summaries0.has("modelNumber")) + modelNumber0 = summaries0.getString("modelNumber"); + String l_descAmz = "(!) " + asin + " " + modelNumber0 + " " + summaries0.getString("brand") + " " + + summaries0.getString("itemName"); + articolo.setFlgAmzWarn(1L); + if (articolo.getAsinAmz().isEmpty()) + articolo.setAsinAmz(asin); + if (articolo.getProductTypeAmz().isEmpty()) + articolo.setProductTypeAmz(productType0); + articolo.setFlgAmazon(2L); + articolo.setDescAmz(l_descAmz); + articolo.superSave(); + } + } else { + if (!articolo.getAsinAmz().isEmpty()) { + articolo.setAsinAmz(""); + articolo.setProductTypeAmz(""); + articolo.setDescAmz(articolo.getCodiceEanNoZero() + " NON TROVATO"); + articolo.superSave(); + } + resAR.setMsg("NO item in catalog for ean " + articolo.getCodiceEanNoZero()); + resAR.setOk(false); + resAR.setResult(jo); + } + if (this.debug) + System.out.println(jo.toString(4)); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resAR.setOk(false); + resAR.setMsg(e.getMessage()); + } + return resAR; + } + + private AmzResult amzCheckTokensApi(String marketplaceLangs) { + AmzResult resAR = new AmzResult(); + if (isStsSessionTokenExpired()) { + System.out.println("AmzSellerApi --> amzCheckTokensApi "); + resAR = amzGetStsAwsCredential(); + } + if (resAR.isOk()) { + boolean merchantIdsOk = true; + StringTokenizer st = new StringTokenizer(marketplaceLangs, ","); + while (st.hasMoreTokens()) { + String currentLang = st.nextToken(); + if (!getHmMarketplaces().containsKey(currentLang)) { + merchantIdsOk = false; + break; + } + } + if (!merchantIdsOk) { + resAR = amzGetMarketplaces(); + st = new StringTokenizer(marketplaceLangs, ","); + merchantIdsOk = true; + while (st.hasMoreTokens()) { + String currentLang = st.nextToken(); + if (!getHmMarketplaces().containsKey(currentLang)) { + merchantIdsOk = false; + break; + } + } + if (!merchantIdsOk) { + resAR.setOk(false); + resAR.setMsg("ERRORE! Non sono stati trovati tutti i merchantIds: " + marketplaceLangs + " trovati: " + + getAttivita().getAmzMarketplaces()); + } + } + } + return resAR; + } + + private AmzResult amzCheckLwaTokens() { + AmzResult resAR = new AmzResult(); + if (isLwaAccessTokenExpired()) { + System.out.println("AmzSellerApi --> amzCheckLwaTokens"); + resAR = amzPostLwaAccessToken(); + } + return resAR; + } + + public AmzResult amzGetMarketplaces() { + AmzResult resAR = new AmzResult(); + if (isStsSessionTokenExpired()) { + System.out.println("AmzSellerApi --> amzGetMarketplaces --> isStsSessionTokenExpired"); + resAR = amzGetStsAwsCredential(); + } + if (resAR.isOk()) + try { + if (this.debug) + System.out.println("AmzSellerApi --> amzGetMarketplaces"); + CloseableHttpClient client = HttpClients.createDefault(); + String host = "https://sellingpartnerapi-eu.amazon.com".replace("https://", ""); + String endPoint = "/sellers/v1/marketplaceParticipations"; + TreeMap queryParms = new TreeMap<>(); + HttpGet request = new HttpGet("https://sellingpartnerapi-eu.amazon.com" + endPoint); + TreeMap awsHeaders = new TreeMap<>(); + awsHeaders.put("host", host); + awsHeaders.put("x-amz-access-token", getLwaAccessToken()); + awsHeaders.put("x-amz-security-token", getStsSessionToken()); + AWSV4Auth aWSV4Auth = new AWSV4Auth.Builder(getStsAccessKeyId(), getStsSecretAccessKey()).regionName("eu-west-1") + .serviceName("execute-api").httpMethodName("GET").canonicalURI(endPoint).awsHeaders(awsHeaders).payload(null) + + .build(); + if (this.debug) { + System.out.println("stsaccesskey: " + getStsAccessKeyId()); + System.out.println("stsSecretAccessKey: " + getStsSecretAccessKey()); + } + Map header = aWSV4Auth.getHeaders(); + for (Map.Entry entrySet : header.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + for (Map.Entry entrySet : awsHeaders.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resAR.setOk(false); + JSONObject jo = new JSONObject(content); + resAR.setMsg(jo.toString(2)); + resAR.setResult(jo); + } else { + if (getHmMarketplaces().size() > 0) + this.hmMarketplaces = new HashMap<>(); + StringBuilder sbMPlace = new StringBuilder(); + JSONObject jo = new JSONObject(content); + JSONArray joPayload = jo.getJSONArray("payload"); + for (int i = 0; i < joPayload.length(); i++) { + JSONObject joMPlace = joPayload.getJSONObject(i).getJSONObject("marketplace"); + getHmMarketplaces().put(joMPlace.getString("countryCode").toLowerCase(), joMPlace.getString("id")); + sbMPlace.append(joMPlace.getString("countryCode").toLowerCase()); + sbMPlace.append(","); + sbMPlace.append(joMPlace.getString("id")); + if (i + 1 < joPayload.length()) + sbMPlace.append(","); + } + getAttivita().setAmzMarketplaces(sbMPlace.toString()); + getAttivita().save(); + if (this.debug) + System.out.println(jo.toString(4)); + resAR.setMsg("Marketplaces found"); + resAR.setOk(true); + resAR.setResult(getAttivita().getAmzMarketplaces()); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resAR.setOk(false); + resAR.setMsg(e.getMessage()); + } + return resAR; + } + + public AmzResult amzGetDefinitionProductType(Articolo articolo, String marketplaceLangs) { + AmzResult resAR = amzCheckTokensApi(marketplaceLangs); + if (resAR.isOk()) { + if (articolo.getProductTypeAmz().isEmpty()) + resAR = amzGetListingsItem(articolo, marketplaceLangs); + if (articolo.getProductTypeAmz().isEmpty()) { + resAR.setOk(false); + resAR.setMsg("ERRORE! Non riesco a trovare il product type per " + articolo.getCodiceEan() + " " + articolo.getNome()); + } + } + if (resAR.isOk()) + try { + if (this.debug) + System.out.println("AmzSellerApi --> amzGetDefinitionProductType"); + CloseableHttpClient client = HttpClients.createDefault(); + String host = "https://sellingpartnerapi-eu.amazon.com".replace("https://", ""); + String endPoint = "/definitions/2020-09-01/productTypes/:productType".replace(":productType", articolo.getProductTypeAmz()); + TreeMap queryParms = new TreeMap<>(); + queryParms.put("marketplaceIds", getMarketplacesIds(marketplaceLangs)); + queryParms.put("productTypeVersion", "LATEST"); + queryParms.put("requirements", "LISTING_OFFER_ONLY"); + queryParms.put("requirementsEnforced", "ENFORCED"); + queryParms.put("locale", "it_IT"); + HttpGet request = new HttpGet("https://sellingpartnerapi-eu.amazon.com" + endPoint + getInlineQueryParms(queryParms)); + TreeMap awsHeaders = new TreeMap<>(); + awsHeaders.put("host", host); + awsHeaders.put("x-amz-access-token", getLwaAccessToken()); + awsHeaders.put("x-amz-security-token", getStsSessionToken()); + awsHeaders.put("Content-Type".toLowerCase(), "application/json"); + AWSV4Auth aWSV4Auth = new AWSV4Auth.Builder(getStsAccessKeyId(), getStsSecretAccessKey()).regionName("eu-west-1") + .serviceName("execute-api").httpMethodName("GET").canonicalURI(endPoint).awsHeaders(awsHeaders) + .queryParametes(queryParms).payload(null) + + .build(); + if (this.debug) { + System.out.println("stsaccesskey: " + getStsAccessKeyId()); + System.out.println("stsSecretAccessKey: " + getStsSecretAccessKey()); + } + Map header = aWSV4Auth.getHeaders(); + for (Map.Entry entrySet : header.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + for (Map.Entry entrySet : awsHeaders.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resAR.setOk(false); + resAR.setMsg(content); + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent= " + content); + } else { + JSONObject jo = new JSONObject(content); + if (this.debug) + System.out.println(jo.toString(4)); + resAR.setMsg("Product Type JSON Schema found"); + resAR.setOk(true); + resAR.setResult(jo); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resAR.setOk(false); + resAR.setMsg(e.getMessage()); + } + return resAR; + } + + private JSONObject getJsonFeaturedOfferExpectedPriceRequestByArticoloCR(ArticoloCR CR, String marketplaceLangs) { + String URI_FOEP = "/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice"; + String GET_METHOD = "GET"; + JSONObject jo = new JSONObject(); + JSONArray jaRequest = new JSONArray(); + Articolo bean = new Articolo(getApFull()); + Vectumerator vec = bean.findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + StringTokenizer st = new StringTokenizer(marketplaceLangs, ","); + while (st.hasMoreTokens()) { + String currentLang = st.nextToken(); + JSONObject joRequest = new JSONObject(); + joRequest.put("marketplaceId", getHmMarketplaces().get(currentLang)); + joRequest.put("sku", row.getCodiceEanNoZero()); + joRequest.put("method", "GET"); + joRequest.put("uri", "/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice"); + jaRequest.put(joRequest); + } + } + jo.put("requests", jaRequest); + return jo; + } + + public AmzResult amzGetListingsItem(Articolo articolo, String marketplaceLangs) { + AmzResult resAR = amzCheckTokensApi(marketplaceLangs); + if (resAR.isOk()) + try { + if (this.debug) + System.out.println("AmzSellerApi --> amzGetListingsItem"); + CloseableHttpClient client = HttpClients.createDefault(); + String host = "https://sellingpartnerapi-eu.amazon.com".replace("https://", ""); + String endPoint = "/listings/2021-08-01/items/:sellerId/:sku".replace(":sellerId", getAttivita().getAmzSellerid()).replace(":sku", + articolo.getCodiceEanNoZero()); + TreeMap queryParms = new TreeMap<>(); + queryParms.put("marketplaceIds", getMarketplacesIds(marketplaceLangs)); + queryParms.put("issueLocale", "it_IT"); + queryParms.put("includedData", "summaries,offers,attributes,issues,fulfillmentAvailability"); + HttpGet request = new HttpGet("https://sellingpartnerapi-eu.amazon.com" + endPoint + getInlineQueryParms(queryParms)); + TreeMap awsHeaders = new TreeMap<>(); + awsHeaders.put("host", host); + awsHeaders.put("x-amz-access-token", getLwaAccessToken()); + awsHeaders.put("x-amz-security-token", getStsSessionToken()); + awsHeaders.put("Content-Type".toLowerCase(), "application/json"); + AWSV4Auth aWSV4Auth = new AWSV4Auth.Builder(getStsAccessKeyId(), getStsSecretAccessKey()).regionName("eu-west-1") + .serviceName("execute-api").httpMethodName("GET").canonicalURI(endPoint).awsHeaders(awsHeaders) + .queryParametes(queryParms).payload(null) + + .build(); + if (this.debug) { + System.out.println("stsaccesskey: " + getStsAccessKeyId()); + System.out.println("stsSecretAccessKey: " + getStsSecretAccessKey()); + } + Map header = aWSV4Auth.getHeaders(); + for (Map.Entry entrySet : header.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + for (Map.Entry entrySet : awsHeaders.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resAR.setOk(false); + resAR.setMsg(content); + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent= " + content); + } else { + JSONObject jo = new JSONObject(content); + JSONObject joSummaries0 = jo.getJSONArray("summaries").getJSONObject(0); + if (!articolo.getProductTypeAmz().equals(joSummaries0.getString("productType")) || + !articolo.getAsinAmz().equals(joSummaries0.getString("asin"))) { + articolo.setProductTypeAmz(joSummaries0.getString("productType")); + articolo.setAsinAmz(joSummaries0.getString("asin")); + articolo.superSave(); + } + if (this.debug) + System.out.println(jo.toString(4)); + resAR.setMsg("Listing found"); + resAR.setOk(true); + resAR.setResult(jo); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resAR.setOk(false); + resAR.setMsg(e.getMessage()); + } + return resAR; + } + + public AmzResult amzPutListingsItem(Articolo articolo, String marketplaceLangs) { + AmzResult resAR = amzCheckTokensApi(marketplaceLangs); + if (resAR.isOk()) { + if (articolo.getAsinAmz().isEmpty() || articolo.getProductTypeAmz().isEmpty()) + resAR = amzGetCatalogItems(articolo, marketplaceLangs); + if (articolo.getAsinAmz().isEmpty() || articolo.getProductTypeAmz().isEmpty()) { + resAR.setOk(false); + resAR.setMsg("ERRORE! Non riesco a trovare il codice asin o product type nel catalogo " + articolo.getCodiceEan() + " " + + articolo.getNome()); + } + } + if (resAR.isOk()) + try { + if (this.debug) + System.out.println("AmzSellerApi --> amzPutListingsItem"); + CloseableHttpClient client = HttpClients.createDefault(); + String host = "https://sellingpartnerapi-eu.amazon.com".replace("https://", ""); + String endPoint = "/listings/2021-08-01/items/:sellerId/:sku".replace(":sellerId", getAttivita().getAmzSellerid()).replace(":sku", + articolo.getCodiceEanNoZero()); + TreeMap queryParms = new TreeMap<>(); + queryParms.put("marketplaceIds", getMarketplacesIds(marketplaceLangs)); + queryParms.put("issueLocale", "it_IT"); + HttpPut request = new HttpPut("https://sellingpartnerapi-eu.amazon.com" + endPoint + getInlineQueryParms(queryParms)); + JSONObject item = getJsonOfferByArticolo(articolo, marketplaceLangs); + String body = item.toString(); + StringEntity stringEntity = new StringEntity(body, "UTF-8"); + request.setEntity((HttpEntity)stringEntity); + TreeMap awsHeaders = new TreeMap<>(); + awsHeaders.put("host", host); + awsHeaders.put("x-amz-access-token", getLwaAccessToken()); + awsHeaders.put("x-amz-security-token", getStsSessionToken()); + awsHeaders.put("x-amz-content-sha256", AWSV4Auth.generateHex(body)); + awsHeaders.put("Content-Type".toLowerCase(), "application/json"); + awsHeaders.put("Accept".toLowerCase(), "application/json"); + AWSV4Auth aWSV4Auth = new AWSV4Auth.Builder(getStsAccessKeyId(), getStsSecretAccessKey()).regionName("eu-west-1") + .serviceName("execute-api").httpMethodName("PUT").canonicalURI(endPoint).awsHeaders(awsHeaders) + .queryParametes(queryParms).payload(body) + + .build(); + if (this.debug) { + System.out.println("stsaccesskey: " + getStsAccessKeyId()); + System.out.println("stsSecretAccessKey: " + getStsSecretAccessKey()); + } + Map header = aWSV4Auth.getHeaders(); + for (Map.Entry entrySet : header.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + for (Map.Entry entrySet : awsHeaders.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resAR.setOk(false); + resAR.setMsg(content); + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent= " + content); + System.out.println("."); + } else { + JSONObject jo = new JSONObject(content); + if (jo.get("status").equals("ACCEPTED")) { + articolo.setQtaSuAmz(articolo.getQtaAmzDaInviare()); + articolo.setPrezzoSuAmzIva(articolo.getPrezzoArticoloAmazonIvaExport("it", 1L)); + articolo.setFlgAmzWarn(0L); + articolo.superSave(); + resAR.setMsg("Articolo ean " + articolo.getCodiceEan() + " asin " + articolo.getAsinAmz() + " inserito/aggiornato"); + resAR.setOk(true); + resAR.setResult(jo); + } else { + resAR.setMsg("Articolo ean " + articolo.getCodiceEan() + " asin " + articolo.getAsinAmz() + " NON AGGIORNATO: " + + jo.getJSONArray("issues").toString(2)); + resAR.setOk(false); + resAR.setResult(jo); + articolo.setFlgAmzWarn(1L); + articolo.superSave(); + System.out.println(jo.toString(4)); + } + if (this.debug) + System.out.println(jo.toString(4)); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resAR.setOk(false); + resAR.setMsg(e.getMessage()); + } + return resAR; + } + + public AmzResult amzDelListingsItem(Articolo articolo, String marketplaceLangs) { + AmzResult resAR = amzCheckTokensApi(marketplaceLangs); + if (resAR.isOk()) + try { + if (this.debug) + System.out.println("AmzSellerApi --> amzDelListingsItem"); + CloseableHttpClient client = HttpClients.createDefault(); + String host = "https://sellingpartnerapi-eu.amazon.com".replace("https://", ""); + String endPoint = "/listings/2021-08-01/items/:sellerId/:sku".replace(":sellerId", getAttivita().getAmzSellerid()).replace(":sku", + articolo.getCodiceEanNoZero()); + TreeMap queryParms = new TreeMap<>(); + queryParms.put("marketplaceIds", getMarketplacesIds(marketplaceLangs)); + queryParms.put("issueLocale", "it_IT"); + HttpDelete request = new HttpDelete("https://sellingpartnerapi-eu.amazon.com" + endPoint + getInlineQueryParms(queryParms)); + TreeMap awsHeaders = new TreeMap<>(); + awsHeaders.put("host", host); + awsHeaders.put("x-amz-access-token", getLwaAccessToken()); + awsHeaders.put("x-amz-security-token", getStsSessionToken()); + awsHeaders.put("Accept".toLowerCase(), "application/json"); + AWSV4Auth aWSV4Auth = new AWSV4Auth.Builder(getStsAccessKeyId(), getStsSecretAccessKey()).regionName("eu-west-1") + .serviceName("execute-api").httpMethodName("DELETE").canonicalURI(endPoint).awsHeaders(awsHeaders) + .queryParametes(queryParms).payload(null) + + .build(); + if (this.debug) { + System.out.println("stsaccesskey: " + getStsAccessKeyId()); + System.out.println("stsSecretAccessKey: " + getStsSecretAccessKey()); + } + Map header = aWSV4Auth.getHeaders(); + for (Map.Entry entrySet : header.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + for (Map.Entry entrySet : awsHeaders.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resAR.setOk(false); + resAR.setMsg(content); + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent= " + content); + } else { + JSONObject jo = new JSONObject(content); + if (jo.get("status").equals("ACCEPTED")) { + articolo.setFlgAmazon(0L); + articolo.superSave(); + resAR.setMsg("Articolo ean " + articolo.getCodiceEan() + " asin " + articolo.getAsinAmz() + " cancellato"); + resAR.setOk(true); + resAR.setResult(jo); + } else { + resAR.setMsg("Articolo ean " + articolo.getCodiceEan() + " asin " + articolo.getAsinAmz() + " NON CANCELLATO: " + + jo.getJSONArray("issues").toString(2)); + resAR.setOk(false); + resAR.setResult(jo); + articolo.setFlgAmzWarn(1L); + articolo.superSave(); + System.out.println(jo.toString(4)); + } + if (this.debug) + System.out.println(jo.toString(4)); + resAR.setMsg("Listing found"); + resAR.setOk(true); + resAR.setResult(jo); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resAR.setOk(false); + resAR.setMsg(e.getMessage()); + } + return resAR; + } + + public AmzResult amzPostItemsOffersBatch(ArticoloCR CR, String marketplaceLang) { + int pageRow = 20; + StringBuilder res = new StringBuilder(); + boolean result = true; + Articolo bean = new Articolo(getApFull()); + Vectumerator vec = bean.findByCR(CR, 1, pageRow); + long totPages = (long)vec.getTotNumberOfPages(); + CR.setPageRow(pageRow); + String TAG_THREAD_MSG = CR.getTAG_THREAD_MSG(); + if (TAG_THREAD_MSG.isEmpty()) + TAG_THREAD_MSG = "AMZ POST ITEMS OFFERS BATCH"; + for (int pageNumber = 1; (long)pageNumber <= totPages; pageNumber++) { + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "amzPostItemsOffersBatch pagina " + pageNumber + " su " + totPages + "..."); + CR.setPageNumber(pageNumber); + AmzResult amzResult = amzPostItemsOffersBatchNotPaged(CR, marketplaceLang); + res.append(amzResult.getMsg()); + result &= amzResult.isOk(); + } + AmzResult resAR = new AmzResult(res.toString(), result, null); + StatusMsg.deleteMsgByTag(getApFull(), TAG_THREAD_MSG); + return resAR; + } + + private AmzResult amzPostItemsOffersBatchNotPaged(ArticoloCR CR, String marketplaceLang) { + AmzResult resAR = amzCheckTokensApi(marketplaceLang); + if (resAR.isOk()) + try { + if (this.debug) + System.out.println("AmzSellerApi --> amzgetItemsOffersBatch"); + CloseableHttpClient client = HttpClients.createDefault(); + String host = "https://sellingpartnerapi-eu.amazon.com".replace("https://", ""); + String endPoint = "/batches/products/pricing/v0/itemOffers"; + TreeMap queryParms = new TreeMap<>(); + queryParms.put("MarketplaceId", getMarketplacesIds(marketplaceLang)); + queryParms.put("ItemCondition", "New"); + HttpPost request = new HttpPost("https://sellingpartnerapi-eu.amazon.com" + endPoint + getInlineQueryParms(queryParms)); + TreeMap awsHeaders = new TreeMap<>(); + awsHeaders.put("host", host); + awsHeaders.put("x-amz-access-token", getLwaAccessToken()); + awsHeaders.put("x-amz-security-token", getStsSessionToken()); + awsHeaders.put("Content-Type".toLowerCase(), "application/json"); + JSONObject items = getJsonItemsOffersBatchRequestByArticoloCR(CR, marketplaceLang); + String body = items.toString(4); + StringEntity stringEntity = new StringEntity(items.toString(4), "UTF-8"); + request.setEntity((HttpEntity)stringEntity); + AWSV4Auth aWSV4Auth = new AWSV4Auth.Builder(getStsAccessKeyId(), getStsSecretAccessKey()).regionName("eu-west-1") + .serviceName("execute-api").httpMethodName("POST").canonicalURI(endPoint).awsHeaders(awsHeaders) + .queryParametes(queryParms).payload(body) + + .build(); + if (this.debug) { + System.out.println("stsaccesskey: " + getStsAccessKeyId()); + System.out.println("stsSecretAccessKey: " + getStsSecretAccessKey()); + } + Map header = aWSV4Auth.getHeaders(); + for (Map.Entry entrySet : header.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + for (Map.Entry entrySet : awsHeaders.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resAR.setOk(false); + resAR.setMsg(content); + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent= " + content); + } else { + JSONObject jo = new JSONObject(content); + System.out.println(jo.toString(4)); + ResParm rp = updatePricingOffers(jo); + if (this.debug) + System.out.println(jo.toString(4)); + resAR.setMsg("ItemsOffersBatch found"); + resAR.setOk(true); + resAR.setResult(rp.getMsg()); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resAR.setOk(false); + resAR.setMsg(e.getMessage()); + } + return resAR; + } + + public AmzResult amzPostPricing(ArticoloCR CR, String marketplaceLangs) { + AmzResult resAR = amzCheckTokensApi(marketplaceLangs); + if (resAR.isOk()) + try { + if (this.debug) + System.out.println("AmzSellerApi --> amzPostPricing"); + CloseableHttpClient client = HttpClients.createDefault(); + String host = "https://sellingpartnerapi-eu.amazon.com".replace("https://", ""); + String endPoint = "/batches/products/pricing/2022-05-01/offer/featuredOfferExpectedPrice"; + TreeMap queryParms = new TreeMap<>(); + HttpPost request = new HttpPost("https://sellingpartnerapi-eu.amazon.com" + endPoint + getInlineQueryParms(queryParms)); + TreeMap awsHeaders = new TreeMap<>(); + awsHeaders.put("host", host); + awsHeaders.put("x-amz-access-token", getLwaAccessToken()); + awsHeaders.put("x-amz-security-token", getStsSessionToken()); + awsHeaders.put("Content-Type".toLowerCase(), "application/json"); + JSONObject items = getJsonFeaturedOfferExpectedPriceRequestByArticoloCR(CR, marketplaceLangs); + String body = items.toString(4); + StringEntity stringEntity = new StringEntity(items.toString(4), "UTF-8"); + request.setEntity((HttpEntity)stringEntity); + AWSV4Auth aWSV4Auth = new AWSV4Auth.Builder(getStsAccessKeyId(), getStsSecretAccessKey()).regionName("eu-west-1") + .serviceName("execute-api").httpMethodName("POST").canonicalURI(endPoint).awsHeaders(awsHeaders) + .queryParametes(null).payload(body) + + .build(); + if (this.debug) { + System.out.println("stsaccesskey: " + getStsAccessKeyId()); + System.out.println("stsSecretAccessKey: " + getStsSecretAccessKey()); + } + Map header = aWSV4Auth.getHeaders(); + for (Map.Entry entrySet : header.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + for (Map.Entry entrySet : awsHeaders.entrySet()) { + String key = entrySet.getKey(); + String value = entrySet.getValue(); + if (this.debug) + System.out.println(key + ":" + key); + request.setHeader(key, value); + } + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resAR.setOk(false); + resAR.setMsg(content); + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent= " + content); + } else { + JSONObject jo = new JSONObject(content); + ResParm rp = updateFeaturedOEPrice(jo); + if (this.debug) + System.out.println(jo.toString(4)); + resAR.setMsg("FEOPrice found"); + resAR.setOk(true); + resAR.setResult(rp.getMsg()); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resAR.setOk(false); + resAR.setMsg(e.getMessage()); + } + return resAR; + } + + private ResParm updatePricingOffers(JSONObject jo) { + ResParm rp = new ResParm(true); + try { + long recordUpdate = 0L, recordError = 0L; + StringBuilder sb = new StringBuilder(); + Articolo bean = new Articolo(getApFull()); + JSONArray jaResponses = jo.getJSONArray("responses"); + for (int i = 0; i < jaResponses.length(); i++) { + JSONObject joResponse = jaResponses.getJSONObject(i); + JSONObject joStatus = joResponse.getJSONObject("status"); + if (joStatus.getInt("statusCode") == 200) { + JSONObject joPayload = joResponse.getJSONObject("body").getJSONObject("payload"); + String currentLang = (String)getKeyByValue((Map)getHmMarketplaces(), joPayload.getString("marketplaceId")); + String currentAsin = joPayload.getString("ASIN"); + bean.findByAsinAmz(currentAsin); + if (bean.getId_articolo() > 0L) { + DoubleOperator featuredOfferExpectedPrice = new DoubleOperator(); + DoubleOperator competingFeaturedOffer = new DoubleOperator(); + DoubleOperator currentFeaturedOffer = new DoubleOperator(); + featuredOfferExpectedPrice.setScale(2, 5); + competingFeaturedOffer.setScale(2, 5); + currentFeaturedOffer.setScale(2, 5); + if (joPayload.has("Summary")) { + if (joPayload.getJSONObject("Summary").has("LowestPrices")) { + JSONObject joLowestPrices0 = joPayload.getJSONObject("Summary").getJSONArray("LowestPrices") + .getJSONObject(0); + featuredOfferExpectedPrice.add(joLowestPrices0.getJSONObject("ListingPrice").getDouble("Amount")); + featuredOfferExpectedPrice.add(joLowestPrices0.getJSONObject("Shipping").getDouble("Amount")); + } + if (joPayload.getJSONObject("Summary").has("BuyBoxPrices")) { + JSONObject joBuyBoxPrices0 = joPayload.getJSONObject("Summary").getJSONArray("BuyBoxPrices") + .getJSONObject(0); + competingFeaturedOffer.add(joBuyBoxPrices0.getJSONObject("ListingPrice").getDouble("Amount")); + competingFeaturedOffer.add(joBuyBoxPrices0.getJSONObject("Shipping").getDouble("Amount")); + } + AmzFeaturedPrice afp = new AmzFeaturedPrice(getApFull()); + afp.findByArticoloLang(bean, currentLang); + afp.setId_articolo(bean.getId_articolo()); + afp.setCompetingFOPriceAmz(competingFeaturedOffer.getResult()); + afp.setCurrentFOPriceAmz(currentFeaturedOffer.getResult()); + afp.setFeaturedOEPriceAmz(featuredOfferExpectedPrice.getResult()); + afp.setLang(currentLang); + afp.setDataPriceAmz(DBAdapter.getToday()); + rp = afp.save(); + if (rp.getStatus()) { + recordUpdate++; + } else { + recordError++; + sb.append("err! "); + sb.append(rp.getMsg()); + sb.append("\n"); + } + } else { + sb.append("err! "); + sb.append(currentAsin); + sb.append(" Summary non trovato!\n"); + } + } else { + sb.append("err! "); + sb.append(currentAsin); + sb.append(" non trovato!\n"); + } + } else { + sb.append("err! "); + sb.append(joStatus.getString("reasonPhrase")); + sb.append("\n"); + } + } + rp.setMsg("u:" + recordUpdate + " e:" + recordError + " " + sb.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + return rp; + } + + public static T getKeyByValue(Map map, E value) { + for (Map.Entry entry : map.entrySet()) { + if (Objects.equals(value, entry.getValue())) + return entry.getKey(); + } + return null; + } + + private JSONObject getJsonOfferByArticolo(Articolo bean, String marketplaceLangs) { + return getJsonOfferByArticoloSicura(bean, marketplaceLangs); + } + + private JSONObject getJsonListingOffersBatchRequestByArticoloCR(ArticoloCR CR, String marketplaceLangs) { + String URI_PRICING = "/products/pricing/v0/listings/:Sku/offers"; + String GET_METHOD = "GET"; + String ITEM_CONDITION = "New"; + String CUSTOMER_TYPE = "Consumer"; + JSONObject jo = new JSONObject(); + JSONArray jaRequest = new JSONArray(); + Articolo bean = new Articolo(getApFull()); + Vectumerator vec = bean.findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (!row.getCodiceEanNoZero().isEmpty()) { + StringTokenizer st = new StringTokenizer(marketplaceLangs, ","); + while (st.hasMoreTokens()) { + String currentLang = st.nextToken(); + JSONObject joRequest = new JSONObject(); + joRequest.put("marketplaceId", getHmMarketplaces().get(currentLang)); + joRequest.put("method", "GET"); + joRequest.put("uri", "/products/pricing/v0/listings/:Sku/offers".replace(":Sku", row.getCodiceEanNoZero())); + joRequest.put("ItemCondition", "New"); + joRequest.put("CustomerType", "Consumer"); + jaRequest.put(joRequest); + } + } + } + jo.put("requests", jaRequest); + return jo; + } + + private JSONObject getJsonItemsOffersBatchRequestByArticoloCR(ArticoloCR CR, String marketplaceLangs) { + String URI_PRICING = "/products/pricing/v0/items/:Asin/offers"; + String GET_METHOD = "GET"; + String ITEM_CONDITION = "New"; + String CUSTOMER_TYPE = "Consumer"; + JSONObject jo = new JSONObject(); + JSONArray jaRequest = new JSONArray(); + Articolo bean = new Articolo(getApFull()); + Vectumerator vec = bean.findByCR(CR, CR.getPageNumber(), CR.getPageRow()); + ResParm rp = new ResParm(true); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (!row.getAsinAmz().isEmpty()) { + StringTokenizer st = new StringTokenizer(marketplaceLangs, ","); + while (st.hasMoreTokens()) { + String currentLang = st.nextToken(); + JSONObject joRequest = new JSONObject(); + joRequest.put("MarketplaceId", getHmMarketplaces().get(currentLang)); + joRequest.put("method", "GET"); + joRequest.put("uri", "/products/pricing/v0/items/:Asin/offers".replace(":Asin", row.getAsinAmz())); + joRequest.put("ItemCondition", "New"); + joRequest.put("CustomerType", "Consumer"); + jaRequest.put(joRequest); + } + } + } + jo.put("requests", jaRequest); + return jo; + } + + private ResParm updateFeaturedOEPrice(JSONObject jo) { + ResParm rp = new ResParm(true); + try { + long recordUpdate = 0L, recordError = 0L; + StringBuilder sb = new StringBuilder(); + Articolo bean = new Articolo(getApFull()); + JSONArray jaResponses = jo.getJSONArray("responses"); + for (int i = 0; i < jaResponses.length(); i++) { + JSONObject joResponse = jaResponses.getJSONObject(i); + JSONObject joStatus = joResponse.getJSONObject("status"); + if (joStatus.getInt("statusCode") == 200) { + JSONObject joRequest = joResponse.getJSONObject("request"); + String currentLang = (String)getKeyByValue((Map)getHmMarketplaces(), joRequest.getString("marketplaceId")); + String currentSku = joRequest.getString("sku"); + bean.findByCodiceEanSerie(currentSku, null); + if (bean.getId_articolo() > 0L) { + DoubleOperator featuredOfferExpectedPrice = new DoubleOperator(); + DoubleOperator competingFeaturedOffer = new DoubleOperator(); + DoubleOperator currentFeaturedOffer = new DoubleOperator(); + featuredOfferExpectedPrice.setScale(2, 5); + competingFeaturedOffer.setScale(2, 5); + currentFeaturedOffer.setScale(2, 5); + JSONObject joBody = joResponse.getJSONObject("body"); + if (joBody.has("featuredOfferExpectedPriceResults")) { + JSONObject joFeaturedOfferExpectedPriceResult = joBody.getJSONArray("featuredOfferExpectedPriceResults") + .getJSONObject(0); + if (joFeaturedOfferExpectedPriceResult.has("featuredOfferExpectedPrice")) { + String resultStatus = joFeaturedOfferExpectedPriceResult.getString("resultStatus"); + if (resultStatus.equals("VALID_FOEP") || resultStatus.equals("NO_COMPETING_OFFER")) + featuredOfferExpectedPrice.add( + joFeaturedOfferExpectedPriceResult.getJSONObject("featuredOfferExpectedPrice").getJSONObject("listingPrice").getDouble("amount")); + } + if (joFeaturedOfferExpectedPriceResult.has("competingFeaturedOffer")) { + competingFeaturedOffer.add(joFeaturedOfferExpectedPriceResult.getJSONObject("competingFeaturedOffer") + .getJSONObject("price").getJSONObject("listingPrice").getDouble("amount")); + competingFeaturedOffer.add(joFeaturedOfferExpectedPriceResult.getJSONObject("competingFeaturedOffer") + .getJSONObject("price").getJSONObject("shippingPrice").getDouble("amount")); + } + if (joFeaturedOfferExpectedPriceResult.has("currentFeaturedOffer")) { + currentFeaturedOffer.add(joFeaturedOfferExpectedPriceResult.getJSONObject("currentFeaturedOffer") + .getJSONObject("price").getJSONObject("listingPrice").getDouble("amount")); + currentFeaturedOffer.add(joFeaturedOfferExpectedPriceResult.getJSONObject("currentFeaturedOffer") + .getJSONObject("price").getJSONObject("shippingPrice").getDouble("amount")); + } + AmzFeaturedPrice afp = new AmzFeaturedPrice(getApFull()); + afp.findByArticoloLang(bean, currentLang); + afp.setId_articolo(bean.getId_articolo()); + afp.setCompetingFOPriceAmz(competingFeaturedOffer.getResult()); + afp.setCurrentFOPriceAmz(currentFeaturedOffer.getResult()); + afp.setFeaturedOEPriceAmz(featuredOfferExpectedPrice.getResult()); + afp.setLang(currentLang); + afp.setDataPriceAmz(DBAdapter.getToday()); + rp = afp.save(); + if (rp.getStatus()) { + recordUpdate++; + } else { + recordError++; + sb.append("err! "); + sb.append(rp.getMsg()); + sb.append("\n"); + } + } else { + sb.append("err! "); + sb.append(currentSku); + sb.append(" featuredOfferExpectedPriceResults non trovato!\n"); + } + } else { + sb.append("err! "); + sb.append(currentSku); + sb.append(" non trovato!\n"); + } + } else { + sb.append("err! "); + sb.append(joStatus.getString("reasonPhrase")); + sb.append("\n"); + } + } + rp.setMsg("u:" + recordUpdate + " e:" + recordError + " " + sb.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + return rp; + } + + private JSONObject getJsonOfferByArticoloMod(Articolo bean, String marketplaceLangs) { + JSONObject jo = new JSONObject(); + String lang = "it"; + jo.put("sku", bean.getCodiceEanNoZero()); + JSONArray jaOffers = new JSONArray(); + JSONArray jaPurchasable_offer = new JSONArray(); + JSONArray jaFulfillment_availability = new JSONArray(); + JSONArray jaCondition_type = new JSONArray(); + JSONArray jaCountry_of_origin = new JSONArray(); + JSONArray jaMerchant_shipping_group = new JSONArray(); + JSONArray jaMerchant_suggested_asin = new JSONArray(); + StringTokenizer st = new StringTokenizer(marketplaceLangs, ","); + while (st.hasMoreTokens()) { + String currentLang = st.nextToken(); + String marketplaceID = getHmMarketplaces().get(currentLang); + JSONObject joFulfillment_availability = new JSONObject(); + joFulfillment_availability.put("marketplaceid", marketplaceID); + joFulfillment_availability.put("quantity", bean.getQtaAmzDaInviare()); + joFulfillment_availability.put("fulfillment_channel_code", "DEFAULT"); + joFulfillment_availability.put("lead_time_to_ship_max_days", 3); + jaFulfillment_availability.put(joFulfillment_availability); + JSONObject joCondition_type = new JSONObject(); + joCondition_type.put("marketplaceid", marketplaceID); + joCondition_type.put("value", "new_new"); + jaCondition_type.put(joCondition_type); + JSONObject joCountry_of_origin = new JSONObject(); + joCountry_of_origin.put("marketplaceid", marketplaceID); + joCountry_of_origin.put("value", "IT"); + jaCountry_of_origin.put(joCountry_of_origin); + JSONObject joMerchant_shipping_group = new JSONObject(); + joMerchant_shipping_group.put("marketplaceid", marketplaceID); + if (bean.getFlgPriceTypeAmz() == 0L) { + joMerchant_shipping_group.put("value", "legacy-template-id"); + } else { + joMerchant_shipping_group.put("value", getAttivita().getAmzMerchantShippingGroupFree()); + } + jaMerchant_shipping_group.put(joMerchant_shipping_group); + JSONObject joMerchant_suggested_asin = new JSONObject(); + joMerchant_suggested_asin.put("marketplaceid", marketplaceID); + joMerchant_suggested_asin.put("value", bean.getAsinAmz()); + jaMerchant_suggested_asin.put(joMerchant_suggested_asin); + JSONObject joPurchasable_offerB2C = new JSONObject(); + joPurchasable_offerB2C.put("marketplaceid", marketplaceID); + joPurchasable_offerB2C.put("currency", "EUR"); + joPurchasable_offerB2C.put("offerType", "B2C"); + JSONObject joPurchasable_offerB2B = new JSONObject(); + joPurchasable_offerB2B.put("marketplaceid", marketplaceID); + joPurchasable_offerB2B.put("currency", "EUR"); + joPurchasable_offerB2B.put("offerType", "B2B"); + JSONArray jaOur_price = new JSONArray(); + JSONObject joOur_price = new JSONObject(); + JSONArray jaSchedule = new JSONArray(); + JSONObject joSchedule = new JSONObject(); + joSchedule.put("value_with_tax", bean.getPrezzoArticoloAmazonIvaExport(currentLang, 1L)); + jaSchedule.put(joSchedule); + joOur_price.put("schedule", jaSchedule); + jaOur_price.put(joOur_price); + joPurchasable_offerB2C.put("our_price", jaOur_price); + joPurchasable_offerB2B.put("our_price", jaOur_price); + jaPurchasable_offer.put(joPurchasable_offerB2C); + jaPurchasable_offer.put(joPurchasable_offerB2B); + } + jo.put("productType", bean.getProductTypeAmz()); + jo.put("requirements", "LISTING_OFFER_ONLY"); + JSONObject joAttributes = new JSONObject(); + joAttributes.put("purchasable_offer", jaPurchasable_offer); + joAttributes.put("fulfillment_availability", jaFulfillment_availability); + joAttributes.put("condition_type", jaCondition_type); + joAttributes.put("country_of_origin", jaCountry_of_origin); + joAttributes.put("merchant_shipping_group", jaMerchant_shipping_group); + joAttributes.put("merchant_suggested_asin", jaMerchant_suggested_asin); + jo.put("attributes", joAttributes); + return jo; + } + + private JSONObject getJsonOfferByArticoloSicura(Articolo bean, String marketplaceLangs) { + JSONObject jo = new JSONObject(); + String lang = "it"; + jo.put("sku", bean.getCodiceEanNoZero()); + JSONArray jaOffers = new JSONArray(); + JSONArray jaPurchasable_offer = new JSONArray(); + JSONArray jaFulfillment_availability = new JSONArray(); + JSONArray jaCondition_type = new JSONArray(); + JSONArray jaCountry_of_origin = new JSONArray(); + JSONArray jaMerchant_shipping_group = new JSONArray(); + JSONArray jaMerchant_suggested_asin = new JSONArray(); + StringTokenizer st = new StringTokenizer(marketplaceLangs, ","); + while (st.hasMoreTokens()) { + String currentLang = st.nextToken(); + String marketplaceID = getHmMarketplaces().get(currentLang); + JSONObject joOfferB2C = new JSONObject(); + joOfferB2C.put("marketplaceid", marketplaceID); + joOfferB2C.put("offerType", "B2C"); + JSONObject joPriceB2C = new JSONObject(); + joPriceB2C.put("amount", bean.getPrezzoArticoloAmazonIvaExport(currentLang, 1L)); + joPriceB2C.put("currency", "EUR"); + joPriceB2C.put("currencyCode", "EUR"); + joOfferB2C.put("price", joPriceB2C); + jaOffers.put(joOfferB2C); + JSONObject joOfferB2B = new JSONObject(); + joOfferB2B.put("marketplaceid", marketplaceID); + joOfferB2B.put("offerType", "B2B"); + JSONObject joPriceB2B = new JSONObject(); + joPriceB2B.put("amount", bean.getPrezzoArticoloAmazonIvaExport(currentLang, 1L)); + joPriceB2B.put("currency", "EUR"); + joPriceB2B.put("currencyCode", "EUR"); + joOfferB2B.put("price", joPriceB2B); + jaOffers.put(joOfferB2B); + JSONObject joFulfillment_availability = new JSONObject(); + joFulfillment_availability.put("marketplaceid", marketplaceID); + joFulfillment_availability.put("quantity", bean.getQtaAmzDaInviare()); + joFulfillment_availability.put("fulfillment_channel_code", "DEFAULT"); + joFulfillment_availability.put("lead_time_to_ship_max_days", 3); + jaFulfillment_availability.put(joFulfillment_availability); + JSONObject joCondition_type = new JSONObject(); + joCondition_type.put("marketplaceid", marketplaceID); + joCondition_type.put("value", "new_new"); + jaCondition_type.put(joCondition_type); + JSONObject joCountry_of_origin = new JSONObject(); + joCountry_of_origin.put("marketplaceid", marketplaceID); + joCountry_of_origin.put("value", "IT"); + jaCountry_of_origin.put(joCountry_of_origin); + JSONObject joMerchant_shipping_group = new JSONObject(); + joMerchant_shipping_group.put("marketplaceid", marketplaceID); + if (bean.getFlgPriceTypeAmz() == 0L) { + joMerchant_shipping_group.put("value", "legacy-template-id"); + } else { + joMerchant_shipping_group.put("value", getAttivita().getAmzMerchantShippingGroupFree()); + } + jaMerchant_shipping_group.put(joMerchant_shipping_group); + JSONObject joMerchant_suggested_asin = new JSONObject(); + joMerchant_suggested_asin.put("marketplaceid", marketplaceID); + joMerchant_suggested_asin.put("value", bean.getAsinAmz()); + jaMerchant_suggested_asin.put(joMerchant_suggested_asin); + JSONObject joPurchasable_offer = new JSONObject(); + joPurchasable_offer.put("marketplaceid", marketplaceID); + joPurchasable_offer.put("currency", "EUR"); + JSONArray jaOur_price = new JSONArray(); + JSONObject joOur_price = new JSONObject(); + JSONArray jaSchedule = new JSONArray(); + JSONObject joSchedule = new JSONObject(); + joSchedule.put("value_with_tax", bean.getPrezzoArticoloAmazonIvaExport(currentLang, 1L)); + jaSchedule.put(joSchedule); + joOur_price.put("schedule", jaSchedule); + jaOur_price.put(joOur_price); + joPurchasable_offer.put("our_price", jaOur_price); + jaPurchasable_offer.put(joPurchasable_offer); + } + jo.put("productType", bean.getProductTypeAmz()); + jo.put("requirements", "LISTING_OFFER_ONLY"); + JSONObject joAttributes = new JSONObject(); + joAttributes.put("purchasable_offer", jaPurchasable_offer); + joAttributes.put("fulfillment_availability", jaFulfillment_availability); + joAttributes.put("condition_type", jaCondition_type); + joAttributes.put("country_of_origin", jaCountry_of_origin); + joAttributes.put("merchant_shipping_group", jaMerchant_shipping_group); + joAttributes.put("merchant_suggested_asin", jaMerchant_suggested_asin); + jo.put("attributes", joAttributes); + return jo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/json/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/json/package-info.java new file mode 100644 index 00000000..82624d3d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/json/package-info.java @@ -0,0 +1 @@ +package it.acxent.api.amz.json; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/servlet/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/servlet/package-info.java new file mode 100644 index 00000000..1adcc6d5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/amz/servlet/package-info.java @@ -0,0 +1 @@ +package it.acxent.api.amz.servlet; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayAbliaApi.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayAbliaApi.java new file mode 100644 index 00000000..22e5709d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayAbliaApi.java @@ -0,0 +1,2027 @@ +package it.acxent.api.ebay; + +import com.ebay.sdk.ApiAccount; +import com.ebay.sdk.ApiContext; +import com.ebay.sdk.ApiCredential; +import com.ebay.sdk.TimeFilter; +import com.ebay.sdk.call.AddItemCall; +import com.ebay.sdk.call.FetchTokenCall; +import com.ebay.sdk.call.GetItemCall; +import com.ebay.sdk.call.GetMyeBaySellingCall; +import com.ebay.sdk.call.GetOrdersCall; +import com.ebay.sdk.call.GetSellerListCall; +import com.ebay.sdk.call.GetSessionIDCall; +import com.ebay.sdk.call.GetSuggestedCategoriesCall; +import com.ebay.sdk.call.GetUserCall; +import com.ebay.sdk.call.VerifyAddItemCall; +import com.ebay.soap.eBLBaseComponents.AmountType; +import com.ebay.soap.eBLBaseComponents.BrandMPNType; +import com.ebay.soap.eBLBaseComponents.BuyerPaymentMethodCodeType; +import com.ebay.soap.eBLBaseComponents.CategoryType; +import com.ebay.soap.eBLBaseComponents.CountryCodeType; +import com.ebay.soap.eBLBaseComponents.CurrencyCodeType; +import com.ebay.soap.eBLBaseComponents.DetailLevelCodeType; +import com.ebay.soap.eBLBaseComponents.FeesType; +import com.ebay.soap.eBLBaseComponents.GalleryTypeCodeType; +import com.ebay.soap.eBLBaseComponents.ItemListCustomizationType; +import com.ebay.soap.eBLBaseComponents.ItemType; +import com.ebay.soap.eBLBaseComponents.ListingDurationCodeType; +import com.ebay.soap.eBLBaseComponents.ListingTypeCodeType; +import com.ebay.soap.eBLBaseComponents.OrderType; +import com.ebay.soap.eBLBaseComponents.PaginatedItemArrayType; +import com.ebay.soap.eBLBaseComponents.PaginationType; +import com.ebay.soap.eBLBaseComponents.PictureDetailsType; +import com.ebay.soap.eBLBaseComponents.ProductListingDetailsType; +import com.ebay.soap.eBLBaseComponents.ReturnPolicyType; +import com.ebay.soap.eBLBaseComponents.ReturnsAcceptedCodeType; +import com.ebay.soap.eBLBaseComponents.ReturnsWithinOptionsCodeType; +import com.ebay.soap.eBLBaseComponents.SKUArrayType; +import com.ebay.soap.eBLBaseComponents.SellerPaymentProfileType; +import com.ebay.soap.eBLBaseComponents.SellerProfilesType; +import com.ebay.soap.eBLBaseComponents.SellerReturnProfileType; +import com.ebay.soap.eBLBaseComponents.SellerShippingProfileType; +import com.ebay.soap.eBLBaseComponents.ShippingCostPaidByOptionsCodeType; +import com.ebay.soap.eBLBaseComponents.SiteCodeType; +import com.ebay.soap.eBLBaseComponents.SuggestedCategoryType; +import com.ebay.soap.eBLBaseComponents.TaxIdentifierType; +import com.ebay.soap.eBLBaseComponents.TradingRoleCodeType; +import it.acxent.api.ebay.json.EbayOrder; +import it.acxent.art.Articolo; +import it.acxent.art.CaratteristicaArticolo; +import it.acxent.cc.Attivita; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.net.URLEncoder; +import java.sql.Date; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Base64; +import java.util.Calendar; +import java.util.Vector; +import org.apache.commons.codec.binary.StringUtils; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.json.JSONArray; +import org.json.JSONObject; + +public class EbayAbliaApi { + private Attivita attivita; + + private boolean debug = false; + + private ApplParmFull apFull = null; + + private String token; + + private String applicationId; + + private String ruName; + + private String certificateId; + + private Date expirationDate; + + private String tokenUsername; + + private boolean useSandbox = false; + + public static final String EBAY_SESSION_ID = "_EBAY_SESSION_ID"; + + public static final String API_SANDBOX = "https://api.sandbox.ebay.com/wsapi"; + + public static final String API_PRODUCTION = "https://api.ebay.com/wsapi"; + + public static final String P_EBAY_USE_SANDBOX = "EBAY_USE_SANDBOX"; + + public static final String P_EBAY_CERTIFICATE_ID_PRODUCTION = "EBAY_CERTIFICATE_ID_PRODUCTION"; + + public static final String P_EBAY_APPLICATION_ID_PRODUCTION = "EBAY_APPLICATION_ID_PRODUCTION"; + + public static final String P_EBAY_DEVELOPER_ID_PRODUCTION = "EBAY_DEVELOPER_ID_PRODUCTION"; + + public static final String P_EBAY_RU_NAME_PRODUCTION = "EBAY_RU_NAME_PRODUCTION"; + + public static final String P_EBAY_SIGN_IN_AUTH_N_AUTH_PRODUCTION_LINK = "EBAY_SIGN_IN_AUTH_N_AUTH_PRODUCTION_LINK"; + + public static final String P_EBAY_SIGN_IN_OAUTH_PRODUCTION_LINK = "EBAY_SIGN_IN_OAUTH_PRODUCTION_LINK"; + + public static final String P_EBAY_USER_TOKEN_PRODUCTION = "EBAY_USER_TOKEN_PRODUCTION"; + + public static final String P_EBAY_EXPIRE_DATE_TOKEN_PRODUCTION = "EBAY_EXPIRE_DATE_TOKEN_PRODUCTION"; + + public static final String P_EBAY_USER_TOKEN_NAME_PRODUCTION = "EBAY_USER_TOKEN_NAME_PRODUCTION"; + + public static final String P_EBAY_CERTIFICATE_ID_SANDBOX = "EBAY_CERTIFICATE_ID_SANDBOX"; + + public static final String P_EBAY_APPLICATION_ID_SANDBOX = "EBAY_APPLICATION_ID_SANDBOX"; + + public static final String P_EBAY_DEVELOPER_ID_SANDBOX = "EBAY_DEVELOPER_ID_SANDBOX"; + + public static final String P_EBAY_RU_NAME_SANDBOX = "EBAY_RU_NAME_SANDBOX"; + + public static final String P_EBAY_USER_TOKEN_SANDBOX = "EBAY_USER_TOKEN_SANDBOX"; + + private ApiContext apiContext; + + private String developerId; + + private static final String URI_CMD_GET_DEFAULT_CATEGORY = "https://api.ebay.com/commerce/taxonomy/v1_beta/get_default_category_tree_id?marketplace_id=EBAY_IT"; + + private static final String URI_CMD_GET_ORDERS = "https://api.ebay.com/sell/fulfillment/v1/order?limit=150&offset=0"; + + private static final String URI_CMD_GET_ORDER = "https://api.ebay.com/sell/fulfillment/v1/order/{orderId}?"; + + private static final String URI_CMD_GET_CATEGORY_SUGGESTION = "https://api.ebay.com/commerce/taxonomy/v1/category_tree/{category_tree_id}/get_category_suggestions?q="; + + private static final String URI_CMD_GET_FULLFILMENT_POLICY = "https://api.ebay.com/sell/account/v1/fulfillment_policy?marketplace_id=EBAY_IT"; + + private static final String URI_CMD_GET_PAYMENT_POLICY = "https://api.ebay.com/sell/account/v1/payment_policy?marketplace_id=EBAY_IT"; + + private static final String URI_CMD_GET_RETURN_POLICY = "https://api.ebay.com/sell/account/v1/return_policy?marketplace_id=EBAY_IT"; + + private static final String URI_CMD_CREATE_DELETE_INVENTORY_LOCATION = "https://api.ebay.com/sell/inventory/v1/location/{merchantLocationKey}"; + + private static final String URI_CMD_GET_INVENTORY_ITEM = "https://api.ebay.com/sell/inventory/v1/inventory_item/{sku}"; + + private static final String URI_CMD_GET_INVENTORY_ITEMS = "https://api.ebay.com/sell/inventory/v1/inventory_item?limit={limit}&offset={offset}"; + + private static final String URI_CMD_CREATE_OR_REPLACE_INVENTORY_ITEM = "https://api.ebay.com/sell/inventory/v1/inventory_item/{sku}"; + + private static final String URI_CMD_DELETE_INVENTORY_ITEM = "https://api.ebay.com/sell/inventory/v1/inventory_item/{sku}"; + + private static final String URI_CMD_CREATE_OFFER = "https://api.ebay.com/sell/inventory/v1/offer"; + + private static final String URI_CMD_GET_OFFER = "https://api.ebay.com/sell/inventory/v1/offer/{offerId}"; + + private static final String URI_CMD_PUBLISH_OFFER = "https://api.ebay.com/sell/inventory/v1/offer/{offerId}/publish/"; + + private static final String URI_CMD_UPDATE_DELETE_GET_OFFER = "https://api.ebay.com/sell/inventory/v1/offer/{offerId}"; + + private static final String URI_CMD_GET_USER_CONSENT = "https://auth.ebay.com/oauth2/authorize"; + + private static final String URI_CMD_GET_OR_REFRESH_USER_ACCESS_TOKEN = "https://api.ebay.com/identity/v1/oauth2/token"; + + private static final String EBAY_ALL_SCOPES = "https://api.ebay.com/oauth/api_scope https://api.ebay.com/oauth/api_scope/sell.marketing.readonly https://api.ebay.com/oauth/api_scope/sell.marketing https://api.ebay.com/oauth/api_scope/sell.inventory.readonly https://api.ebay.com/oauth/api_scope/sell.inventory https://api.ebay.com/oauth/api_scope/sell.account.readonly https://api.ebay.com/oauth/api_scope/sell.account https://api.ebay.com/oauth/api_scope/sell.fulfillment.readonly https://api.ebay.com/oauth/api_scope/sell.fulfillment https://api.ebay.com/oauth/api_scope/sell.analytics.readonly https://api.ebay.com/oauth/api_scope/sell.finances https://api.ebay.com/oauth/api_scope/sell.payment.dispute https://api.ebay.com/oauth/api_scope/commerce.identity.readonly"; + + public static final String CONDITION_NEW = "NEW"; + + public static final String CONDITION_LIKE_NEW = "LIKE_NEW"; + + public static final String CONDITION_NEW_OTHER = "NEW_OTHER"; + + public static final String CONDITION_NEW_WITH_DEFECTS = "NEW_WITH_DEFECTS"; + + public static final String CONDITION_CERTIFIED_REFURBISHED = "CERTIFIED_REFURBISHED"; + + public static final String CONDITION_SELLER_REFURBISHED = "SELLER_REFURBISHED"; + + public static final String CONDITION_USED_EXCELLENT = "USED_EXCELLENT"; + + public static final String CONDITION_USED_VERY_GOOD = "USED_VERY_GOOD"; + + public static final String CONDITION_USED_GOOD = "USED_GOOD"; + + public static final String CONDITION_USED_ACCEPTABLE = "USED_ACCEPTABLE"; + + public static final String CONDITION_FOR_PARTS_OR_NOT_WORKING = "FOR_PARTS_OR_NOT_WORKING"; + + public EbayAbliaApi(String applicationId, String developerId, String certificateId, String ruName, String token) { + this.applicationId = applicationId; + this.developerId = developerId; + this.certificateId = certificateId; + this.token = token; + this.ruName = ruName; + } + + public EbayAbliaApi(ApplParmFull apFull) { + this.apFull = apFull; + this.applicationId = apFull.getParm("EBAY_APPLICATION_ID_PRODUCTION").getTesto(); + this.developerId = apFull.getParm("EBAY_DEVELOPER_ID_PRODUCTION").getTesto(); + this.certificateId = apFull.getParm("EBAY_CERTIFICATE_ID_PRODUCTION").getTesto(); + this.ruName = apFull.getParm("EBAY_RU_NAME_PRODUCTION").getTesto(); + this.token = apFull.getParm("EBAY_USER_TOKEN_PRODUCTION").getTesto(); + this.expirationDate = apFull.getParm("EBAY_EXPIRE_DATE_TOKEN_PRODUCTION").getDataParm(); + this.tokenUsername = apFull.getParm("EBAY_USER_TOKEN_NAME_PRODUCTION").getTesto(); + } + + public EbayAbliaApi() {} + + public String getStatus() { + if (getApFull() == null) + return "Errore! Dati DB nullo"; + StringBuilder sb = new StringBuilder("Token AuthNAuth\n"); + if (getToken().isEmpty()) { + sb.append("Token AuthNAuth non presente. Procedere alla richiesta del token."); + } else { + sb.append("Token AuthNAuth presente per il cliente "); + sb.append(getTokenUsername()); + long days = getDaysToExpire(); + if (days > 0L) { + sb.append("\nScadenza Token tra " + days + " giorni"); + } else { + sb.append("\nATTENZIONE. Token scaduto da " + -days + " giorni"); + } + } + sb.append("\n\nToken oAuth2\n"); + if (getAttivita().getEbayOAuthUserToken().isEmpty()) { + sb.append("User Token oAuth2 non presente. Procedere alla richiesta del token oAuth."); + } else { + sb.append("User Token oAuth2 presente"); + if (getAttivita().getEbayOAuthUserTokenExpire() != null) + sb.append("\nScadenza oAuth2 Token:" + String.valueOf(getAttivita().getEbayOAuthUserTokenExpire())); + if (getAttivita().getEbayOAuthRefreshTokenExpire() != null) + sb.append("\nScadenza Refresh Token:" + String.valueOf(getAttivita().getEbayOAuthRefreshTokenExpire())); + } + return sb.toString(); + } + + public String getStatusHtml() { + return DBAdapter.convertStringToHtml(getStatus()); + } + + public boolean isTokenExpired() { + if (getDaysToExpire() <= 0L) + return true; + return false; + } + + public boolean isTokenValid() { + if (getToken().isEmpty()) + return false; + return !isTokenExpired(); + } + + public long getDaysToExpire() { + if (getApFull() == null) + return -1L; + long daysTOExpire = DBAdapter.getDateDiff(DBAdapter.getToday(), getExpirationDate()); + return daysTOExpire; + } + + public long getUserTokenHourToExpire() { + if (getApFull() == null) + return -1L; + long daysTOExpire = DBAdapter.getDateDiff(DBAdapter.getToday(), getExpirationDate()); + return daysTOExpire; + } + + private ApiContext getApiContext() throws IOException { + if (this.apiContext == null) { + this.apiContext = new ApiContext(); + this.apiContext.setSite(SiteCodeType.ITALY); + ApiCredential cred = this.apiContext.getApiCredential(); + if (this.useSandbox) { + this.apiContext.setApiServerUrl("https://api.sandbox.ebay.com/wsapi"); + } else { + this.apiContext.setApiServerUrl("https://api.ebay.com/wsapi"); + } + ApiAccount account = cred.getApiAccount(); + account.setApplication(getApplicationId()); + account.setCertificate(getCertificateId()); + account.setDeveloper(getDeveloperId()); + if (!getToken().isEmpty()) + cred.seteBayToken(getToken()); + } + return this.apiContext; + } + + public String getToken() { + return (this.token == null) ? "" : this.token.trim(); + } + + public void setToken(String token) { + this.token = token; + } + + public static void initApplicationParms(ApplParmFull ap) { + if (ap != null) { + DBAdapter.logDebug(true, "ebay chechout initParms: start"); + String l_tipoParm = "EBAY"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + Parm bean = new Parm(ap); + bean.findByCodice("EBAY_SIGN_IN_AUTH_N_AUTH_PRODUCTION_LINK"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_SIGN_IN_AUTH_N_AUTH_PRODUCTION_LINK"); + bean.setDescrizione("EBAY_SIGN_IN_AUTH_N_AUTH_PRODUCTION_LINK"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("\nhttps://signin.ebay.com/ws/eBayISAPI.dll?SignIn&runame=Ablia_S.r.l.-AbliaSrl-tuttof-dxiwgx&SessID="); + bean.setNota("LINK PER RICHIEDERE IL TOKEN AUTH N AUTH VIA APPLICATION. VIENE POI FATTO IL REDIRECT INDIETRO CON IL TOKEN O IL RISULTATO NEGATIVO"); + bean.save(); + bean.findByCodice("EBAY_SIGN_IN_OAUTH_PRODUCTION_LINK"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_SIGN_IN_OAUTH_PRODUCTION_LINK"); + bean.setDescrizione("EBAY_SIGN_IN_OAUTH_PRODUCTION_LINK"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("\nhttps://auth.ebay.com/oauth2/authorize?client_id=AbliaSrl-tuttofot-PRD-c14016a09-701a1eb1&response_type=code&redirect_uri=Ablia_S.r.l.-AbliaSrl-tuttof-dxiwgx&scope=https://api.ebay.com/oauth/api_scope https://api.ebay.com/oauth/api_scope/sell.marketing.readonly https://api.ebay.com/oauth/api_scope/sell.marketing https://api.ebay.com/oauth/api_scope/sell.inventory.readonly https://api.ebay.com/oauth/api_scope/sell.inventory https://api.ebay.com/oauth/api_scope/sell.account.readonly https://api.ebay.com/oauth/api_scope/sell.account https://api.ebay.com/oauth/api_scope/sell.fulfillment.readonly https://api.ebay.com/oauth/api_scope/sell.fulfillment https://api.ebay.com/oauth/api_scope/sell.analytics.readonly https://api.ebay.com/oauth/api_scope/sell.finances https://api.ebay.com/oauth/api_scope/sell.payment.dispute https://api.ebay.com/oauth/api_scope/commerce.identity.readonly"); + bean.setNota("LINK PER RICHIEDERE IL TOKEN OAUTH2 VIA APPLICATION. VIENE POI FATTO IL REDIRECT INDIETRO CON IL TOKEN O IL RISULTATO NEGATIVO"); + bean.save(); + bean.findByCodice("EBAY_USER_TOKEN_PRODUCTION"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_USER_TOKEN_PRODUCTION"); + bean.setDescrizione("EBAY_USER_TOKEN_PRODUCTION"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("AgAAAA**AQAAAA**aAAAAA**vVQ0Xg**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6ABkYKnAZmCoQidj6x9nY+seQ**CmADAA**AAMAAA**ftrYwOnBwCWOl+k8pJKmriUUg/rWwZH/+E8fLpt/3YSoQhAL846AqCs9wXZv1rPU1jFiM26igTkKZvQTu1WbXuP5mm06fAuE2o1hL1NaQpvhgq4PIMTOo8GsxcNdF1x+jSuPe1mz1WYbtCoJV/y1CzUlsWmMjoVBeyiOfv+xLFKRHsfVWDO/wCbRclWznWrIoune9WYXIObvgT+49kQNqpFS+cXrQky3a+risHb79P525EZ8guGy1CvqpW4rd7PzgpxQImSVUgyBeYlpmKVpEDSBybPnvhJ72qor3U/zEWbmUBL2f/duRsKbvNkq4EiGfRcmPEHGOeEWtSbP1smMHxYRfpC5ZhvOU5dnuAioAej4zmntL0JaVqSZNa5WtF4jy7ZY0aX5DCHKlxCUp7daEC28VaoDFssnhfoL4CHYZ/nkyUWWUl6NosViy/bVf8gHq0zKOzSi7lW4FLd9SQnUNz/xslI3U90s5Cv5OthuCVQAFrNWi/AMUjKhNKoNq1Kvokq82D3mLkY35Kf6rsTRBWaznaGv+nsJB2L2HRPwgtwwgemBlZCSwJBWV2LfCKru6FYhy2M5HtdEDV8b5LcyWebTROrSohwBsFMpmt5f9ifHrG9gSBE85a+l2b5jo1cR4igiNnZY8vsFqih5Vr8Egs3baKGcY4Rjj03ifaDtuLa0aG3Rg3lVw76xKkOvbTEH+P2vR0RTixSVL/MltKiVTktVhimZth9zA5ixJXzIo5hylOrl6Bkt6bAaiYu+i6nM"); + bean.setNota("USER TOKEN DI PRODUZIONE GENERATO FACENDO L'ACCESSO CON L'UTENZA CHE SI VUOLE INTERROGARE. TOKEN DIVERSI SERVONO PER ACCEDERE A ACCOUNT EBAY DIVERSI
TRAMITE Get a User Token Here + Auth'n'Auth
E' NECESSARIO AVERE I DATI DELL'ACCOUNT A CUI VOGLIAMO ACCEDERE PER POTER FARE LE CHIAMATE!!!!ATTENZIONE!!! I TOKEN HANNO UNA SCADENZA DI 18 MESI CIRCA"); + bean.save(); + bean.findByCodice("EBAY_EXPIRE_DATE_TOKEN_PRODUCTION"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_EXPIRE_DATE_TOKEN_PRODUCTION"); + bean.setDescrizione("EBAY_EXPIRE_DATE_TOKEN_PRODUCTION"); + bean.setFlgTipo(2L); + if (bean.getDataParm() == null) { + Calendar cal = Calendar.getInstance(); + cal.set(1, 2021); + cal.set(2, 6); + cal.set(5, 24); + bean.setDataParm(new Date(cal.getTimeInMillis())); + } + bean.setNota("DATA VALIDITA' PRODUCTION TOKEN DELL'ACCOUNT A CUI FA RIFERIMENTO IL TOKEN GENERATO. VIENE INDICATO QUANDO VIENE GENERATO IL TOKEN"); + bean.save(); + bean.findByCodice("EBAY_USER_TOKEN_NAME_PRODUCTION"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_USER_TOKEN_NAME_PRODUCTION"); + bean.setDescrizione("EBAY_USER_TOKEN_NAME_PRODUCTION"); + bean.setFlgTipo(0L); + bean.setNota("USERNAME DELL'UTENTE EBAY CUI FA RIFERIMENTO IL TOKEN E LA SUA SCADENZA"); + bean.save(); + bean.findByCodice("EBAY_USER_TOKEN_SANDBOX"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_USER_TOKEN_SANDBOX"); + bean.setDescrizione("EBAY_USER_TOKEN_SANDBOX"); + bean.setFlgTipo(0L); + bean.setNota("USER TOKEN DI PROVA SANDBOX DI UN UTENTE SANDBOX DI CUI VOGLIAMO TESTARE LE CHIAMATE
TRAMITE Get a User Token Here + Auth'n'Auth
ATTENZIONE!!! I TOKEN HANNO UNA SCADENZA DI 18 MESI CIRCA"); + bean.save(); + bean.findByCodice("EBAY_APPLICATION_ID_PRODUCTION"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_APPLICATION_ID_PRODUCTION"); + bean.setDescrizione("EBAY_APPLICATION_ID_PRODUCTION"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("AbliaSrl-tuttofot-PRD-c14016a09-701a1eb1"); + bean.setNota("APPLICATION ID DI PRODUZIONE DELL'ACCOUNTE DEVELOPER"); + bean.save(); + bean.findByCodice("EBAY_DEVELOPER_ID_PRODUCTION"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_DEVELOPER_ID_PRODUCTION"); + bean.setDescrizione("EBAY_DEVELOPER_ID_PRODUCTION"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("e729c207-9749-4d9d-b882-046d88f14454"); + bean.setNota("DEVELOPER ID DI PRODUZIONE DELL'ACCOUNTE DEVELOPER"); + bean.save(); + bean.findByCodice("EBAY_CERTIFICATE_ID_PRODUCTION"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_CERTIFICATE_ID_PRODUCTION"); + bean.setDescrizione("EBAY_CERTIFICATE_ID_PRODUCTION"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("PRD-14016a09b37a-1fa6-43a5-8201-dfa9"); + bean.setNota("CERTIFICATE ID DI PRODUZIONE DELL'ACCOUNTE DEVELOPER"); + bean.save(); + bean.findByCodice("EBAY_APPLICATION_ID_SANDBOX"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_APPLICATION_ID_SANDBOX"); + bean.setDescrizione("EBAY_APPLICATION_ID_SANDBOX"); + bean.setFlgTipo(0L); + bean.setNota("APPLICATION ID SANDBOX DELL'ACCOUNTE DEVELOPER"); + bean.save(); + bean.findByCodice("EBAY_DEVELOPER_ID_SANDBOX"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_DEVELOPER_ID_SANDBOX"); + bean.setDescrizione("EBAY_DEVELOPER_ID_SANDBOX"); + bean.setFlgTipo(0L); + bean.setNota("DEVELOPER ID DI SANDBOX DELL'ACCOUNTE DEVELOPER"); + bean.save(); + bean.findByCodice("EBAY_CERTIFICATE_ID_SANDBOX"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_CERTIFICATE_ID_SANDBOX"); + bean.setDescrizione("EBAY_CERTIFICATE_ID_SANDBOX"); + bean.setFlgTipo(0L); + bean.setNota("CERTIFICATE ID DI SANDBOX DELL'ACCOUNTE DEVELOPER"); + bean.save(); + bean.findByCodice("EBAY_USE_SANDBOX"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_USE_SANDBOX"); + bean.setDescrizione("EBAY_USE_SANDBOX"); + bean.setFlgTipo(5L); + bean.setNota("USA PARAMETRI DI SANDBOX O PRODUZIONE"); + bean.save(); + bean.findByCodice("EBAY_RU_NAME_PRODUCTION"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_RU_NAME_PRODUCTION"); + bean.setDescrizione("EBAY_RU_NAME_PRODUCTION"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("Ablia_S.r.l.-AbliaSrl-tuttof-dxiwgx"); + bean.setNota("RuName (eBay Redirect URL name) interfaccia di login in cui si definisce le url di ritorno per prendere il token. Ha bisogno del sessionid"); + bean.save(); + bean.findByCodice("EBAY_RU_NAME_SANDBOX"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("EBAY_RU_NAME_SANDBOX"); + bean.setDescrizione("EBAY_RU_NAME_SANDBOX"); + bean.setFlgTipo(0L); + bean.setNota("RuName (eBay Redirect URL name) SANDBOX interfaccia di login in cui si definisce le url di ritorno per prendere il token. Ha bisogno del sessionid"); + bean.save(); + bean.findByCodice("EBAY_USER_TOKEN_OAUTH2_PRODUCTION"); + bean.delete(); + bean.findByCodice("EBAY_USER_TOKEN_OAUTH2_SANDBOX"); + bean.delete(); + DBAdapter.logDebug(true, "ebay chechout initParms: stop"); + } + } + + public static void main(String[] args) { + String tokenProductionTF = "AgAAAA**AQAAAA**aAAAAA**vVQ0Xg**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6ABkYKnAZmCoQidj6x9nY+seQ**CmADAA**AAMAAA**ftrYwOnBwCWOl+k8pJKmriUUg/rWwZH/+E8fLpt/3YSoQhAL846AqCs9wXZv1rPU1jFiM26igTkKZvQTu1WbXuP5mm06fAuE2o1hL1NaQpvhgq4PIMTOo8GsxcNdF1x+jSuPe1mz1WYbtCoJV/y1CzUlsWmMjoVBeyiOfv+xLFKRHsfVWDO/wCbRclWznWrIoune9WYXIObvgT+49kQNqpFS+cXrQky3a+risHb79P525EZ8guGy1CvqpW4rd7PzgpxQImSVUgyBeYlpmKVpEDSBybPnvhJ72qor3U/zEWbmUBL2f/duRsKbvNkq4EiGfRcmPEHGOeEWtSbP1smMHxYRfpC5ZhvOU5dnuAioAej4zmntL0JaVqSZNa5WtF4jy7ZY0aX5DCHKlxCUp7daEC28VaoDFssnhfoL4CHYZ/nkyUWWUl6NosViy/bVf8gHq0zKOzSi7lW4FLd9SQnUNz/xslI3U90s5Cv5OthuCVQAFrNWi/AMUjKhNKoNq1Kvokq82D3mLkY35Kf6rsTRBWaznaGv+nsJB2L2HRPwgtwwgemBlZCSwJBWV2LfCKru6FYhy2M5HtdEDV8b5LcyWebTROrSohwBsFMpmt5f9ifHrG9gSBE85a+l2b5jo1cR4igiNnZY8vsFqih5Vr8Egs3baKGcY4Rjj03ifaDtuLa0aG3Rg3lVw76xKkOvbTEH+P2vR0RTixSVL/MltKiVTktVhimZth9zA5ixJXzIo5hylOrl6Bkt6bAaiYu+i6nM"; + String tokenProductionCC = "AgAAAA**AQAAAA**aAAAAA**PTFrXw**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6ABkYKnAZmCoQidj6x9nY+seQ**CmADAA**AAMAAA**ftrYwOnBwCWOl+k8pJKmriUUg/rWwZH/+E8fLpt/3YSoQhAL846AqCs9wXZv1rPU1jFiM26igTkKZvQTu1WbXuP5mm06fAuE2o1hL1NaQpvhgq4PIMTOo8GsxcNdF1x+jSuPe1mz1WYbtCoJV/y1CzUlsWmMjoVBeyiOfv+xLFKRHsfVWDO/wCbRclWznWrIoune9WYXIObvgT+49kQNqpFS+cXrQky3a+risHb79P525EZ8guGy1CvqpW4rd7PzgpxQImSVUgyBeYlpmKVpEDSBybPnvhJ72qor3U/zEWbmUBL2f/duRsKbvNkq4EiGfRcmPEHGOeEWtSbP1smMHxYRfpC5ZhvOU5dnuAioAej4zmntL0JaVqSZNa5WtF4jy7ZY0aX5DCHKlxCUp7daEC28VaoDFssnhfoL4CHYZ/nkyUWWUl6NosViy/bVf8gHq0zKOzSi7lW4FLd9SQnUNz/xslI3U90s5Cv5OthuCVQAFrNWi/AMUjKhNKoNq1Kvokq82D3mLkY35Kf6rsTRBWaznaGv+nsJB2L2HRPwgtwwgemBlZCSwJBWV2LfCKru6FYhy2M5HtdEDV8b5LcyWebTROrSohwBsFMpmt5f9ifHrG9gSBE85a+l2b5jo1cR4igiNnZY8vsFqih5Vr8Egs3baKGcY4Rjj03ifaDtuLa0aG3Rg3lVw76xKkOvbTEH+P2vR0RTixSVL/MltKiVTktVhimZth9zA5ixJXzIo5hylOrl6Bkt6bAaiYu+i6nM\n"; + String tokenOath2CC = "v^1.1#i^1#f^0#I^3#p^3#r^0#t^H4sIAAAAAAAAAOVYbWwURRju9QsJLfCDFCxijgNiAu7d7N7ex27ag6O9SgNtj15bKwHK3O5cmbK3u+zMtb0GSVNJQ4xUiQYJUQI/EBslERViSEzEiH+IRrGYANFEMUHLDxMhYqIJzl6/q3y0R8wl3p/LvPN+Pc+878zsgN7iuav7N/TfKXXMyT/WC3rzHQ5+HphbXLRmfkF+eVEemKTgONa7srewr+DnCgKTmik3ImIaOkHO7qSmEzkjrHSlLF02IMFE1mESEZkqcixct0kW3EA2LYMaiqG5nLXVla6gwAuqXwxKfi9QeUlgUn3MZ5NR6RLiPoBEKQGleDAgeiU2T0gK1eqEQp2yeSAAjgec4G0SBJn3yT6/2+fzbXE5W5BFsKEzFTdwhTLpyhlba1Ku908VEoIsypy4QrXhmlhDuLY6Ut9U4ZnkKzTKQ4xCmiJTR1WGipwtUEuh+4chGW05llIURIjLExqJMNWpHB5LZhbpZ6hGisCLgEdAlPwBv6g8EiprDCsJ6f3zsCVY5RIZVRnpFNP0gxhlbMQ7kEJHR/XMRW210/7bnIIaTmBkVboi68PPNccijS5nLBq1jE6sItVGyvt44JckAERXCMY1DImljcYYcTTK8LQgVYauYpsv4qw36HrEEkbTaQGTaGFKDXqDFU5QO5lxPbEJgDH6RGmLvZ4jC5iiO3V7SVGSceDMDB9M/lg1TKz/o6oHnveDgD/uk/wwIAX5+L/Xg93rM6uJkL0s4WjUY+eC4jDNJaG1C1FTgwriFEZvKoksrMpeX0LwBhOIU/1SgmNNnuDiPtXP8QmEAELxuCIF/yelQamF4ymKxstj+kQGX6VLM9qxXofoTkN1TVfJ7DSjxdBNKl07KTVlj6erq8vd5XUbVrtHAID3tNZtiik7URK6xnXxg5U5nCkLBTErgmWaNlk23azqWHC93RWyua6tHivVKSmFpkvvgS2mGCaKGhpW0rmFzWupUWjRdAxpGhNkBZLYIHMLnm1PmANo2r2O3XbLuhUj6TEg26KYGLdlsnZOKN5byUMYSe6Rhmfe3RaCqqFr6dkYz8AG652saQwrPZuA48YzsIGKYqR0Optwo6YzsEiktATWNHtfmE3ASeYzSVOHWppihcwqJNbtiiMzMDFhOgNQxcS0++WhLJmMnSUKcrP9PXOvGE82qy61kIottvu3pSycW80ats+stpjbcmtuLjOIWRpHU5QaCU7txl3t3Q+H3O71e6APm2Ztjh0v05AalIs2VnOKfZ/1QyBxAcBDHsX5rFa9GnXmGm4UECRFAAFOCogSJ6qSysWDQYEDol8NBhO8KPrErDBjSHMLMbuUekWJ92aJy94xZAwTMjV2Ib0pnWuHbmOkpjES29DW1LAxUp/dtQkpFrr/IrJeP/SfI9zV6W1ujASlNbFqGGlMNGxoiW+UaqtgdTJlChujSldLpCda02Ptbq+rzIoAe7tKJlOUXedRrvWvIPC8lF0l17XjXAPFPmeA6BWkIABCVtiqNMyO7dzrzg0GoUh9WGjTBJO+4f7x5e6Z+moWysv8+D7HGdDnOJ3vcAAPWMWvAMuLC5oLC0rKCabsbgMTboLbdUhTFnLvQmkTYiu/2GE2w+FVk97pjm0DS8Zf6uYW8PMmPduBJyZmivgFi0sFwAPBy+rT5/NvASsmZgv5ssJFznBr85LeG1cHXrPm3t2PF97YUb4AlI4rORxFeYV9jrySk1aQPNZzYZ1Jtq14ZbDp+EdDp4+UlfQs/vYgPXr6G+P9tLtsX9V7AbJ0YPeZ3cUtpW8NL0lW/Ppl2apWxZtX82T/d8vmHf94WP+scsfR1sNvNL/9+ImnTha9qi37/ZnB3nOrTxVfDNy8RF56XRtYfKvv6kXv2d7Qm59oh+a8O/DCFbNx7YeHby18/vxy8fsvmot/irYOzb993p9/5Men62Pl4QLz/KWjlyv+cvj7r1/uGNqxdOWmH/68e/3igcN/bN96oS7+Tske3HSno1X+4GD7uUW/Db3ccaVocPPnB9c+23l164n95Nq62C9GhRzat/fmavHTNS9WpfMGT+35evuBtXtv89duDxfUfaWeHVm+vwEIbnSVQRUAAA=="; + String appTOkenCC = "v^1.1#i^1#p^1#f^0#r^0#I^3#t^H4sIAAAAAAAAAOVYfWwTZRhf124EYQOZgQUNlBsQw9L2vbt+3UlryrqPMqBlLRPwY3nv7r3t2PXuvHvLWhLIWHQaICIBDEpCMEQliCaYIJpgojGAQkSiENR/CIkaIPEjGgX9w3jXltFNsiFrcIn9p7nnfd7n/T2/3/O873sH+qsnLxpsG7xeY5tUub8f9FfabOQUMLm6qrHWXjm7qgKUONj298/vdwzYryw2YFrW2A5kaKpiIGc2LSsGmzeGiIyusCo0JINVYBoZLObZZGT5MpZyA1bTVazyqkw4Y9EQEYQ0xQmiTxC8HB2kg6ZVuRkzpYYI0utDJBXkKS5AogAgzXHDyKCYYmCo4BBBAQq4SOCi6BQJWK+XpQNu4PetJZydSDckVTFd3IAI5+Gy+bl6CdbRoULDQDo2gxDhWKQlGY/Eos0rUos9JbHCRR6SGOKMMfypSRWQsxPKGTT6Mkbem01meB4ZBuEJF1YYHpSN3ARzF/DzVHsZfzDIUDREPg4EeKYsVLaoehri0XFYFklwiXlXFilYwrmxGDXZ4NYhHhefVpghYlGn9bcyA2VJlJAeIpqXRNZEEgkiHOFkCSZ12YUzGKuiil2JjqiLJ72A9EPAuMzCgSTiyOJChWhFmkes1KQqgmSRZjhXqHgJMlGjkdzQJdyYTnElrkdEbCEq9aOGOKTWWqIWVMzgHsXSFaVNIpz5x7EVGJqNsS5xGYyGIowcyFMUIqCmSQIxcjBfi8XyyRohogdjjfV4+vr63H20W9W7PRQApGf18mVJvgelIWH6Wr1e8JfGnuCS8qnwyJxpSCzOaSaWrFmrJgClmwhTFEky3iLvw2GFR1r/YSjJ2TO8I8rVIbwPegUaMaQoQEoQ/OXokHCxSD0WDsTBnCsN9V6ENRnyyMWbdZZJI10SWNonUnRQRC7Bz4guLyOKLs4n+F2kiBBAiON4Jvh/apQ7LfUk4nWEy1LrZavz3vX0qo7mINOYjMLmDjHe1sm1M7EmGE1nNKo9wfd1Nm9ItGzQn+5eHrrTbrh98ryqoYQqS3yuDAxYvV5GFmhdSEAd55JIlk3DuBI1rEQnlsjWfMMMADXJbTW2m1fTHhWaO7pl6sojHlfOEU2LpdMZDDkZxcqzm/9HO/lt05PMu86EysnUryCkJBQuKe68mm5jPe/WkaFmdPN+5o5bZ3ZK7UWKuQNiXZVlpHeS4xb6Xutr9foYfPzLw+Luci/fTWUi1TYvS2YJdU20zO6JohKcYKcx6Qe018sEA4Fx5dWU1zSVm2jnUJtqYCSMlpqj9S6v1Z7hL/nhivyPHLAdBQO2I5U2G/CABWQDmFdtX+WwT51tSBi5JSi6DalbMd9ddeTuRTkNSnpltU1bBa8tKPmssP9JUD/0YWGynZxS8pUBPHRrpIqcNquGAiSgaBJ4vXRgLWi4NeogZzoe+PW5SH1Ddt+fPx86Huk64zjHHlg6G9QMOdlsVRWOAVsFfzg39Upl+27PIWrH5ldqBenDZetCp7a+/8LjF8gljzlPHvll9xuttS/OOvb7Dzf2vqM+f/VU9srCc3sWtxzf3n6p9u2T6ys6T2/Z+OiuLwavp24c5ra9mpViS+3PeLs+W9l0/pNs055Z58U/DtWf+Pho/Gtf8/xHvrdHp+10/HV9DZrR4vgysiUmzeR+fPlB9NTBSZve/e6DNTNeuqC0TXdOl3qf3fDTvn1bF51YfRn5Ls57OD738MEzZzdeIk47t0eOnW2pPbUZ5TKtr9XUNbTveP2to9/u2EQ2ftRTf99CIXx+zubGz7s/XfneN8y1uvCkufenfqueU9e2k937JrNucBs6cLnlq4t1u/qmXn2iIN/fKcx3YPARAAA="; + String tokenOath2TX = "v^1.1#i^1#I^3#p^3#r^0#f^0#t^H4sIAAAAAAAAAOVYa2wUVRTubrdFHq1/CD6KsiwUDTC7986+ZifuJgtd0lraLp22KNGQOzN32pHZmXHmTssSA5UACZogBBIDwVg1ChgCPpEoP5DE+KAaIwZMfPAwUYuaYH9okJA4M32w1NjaLjGbuNlkc889r+/cc849e0Fv5fTF2+q3/VHlmebt6wW9Xo8HzgTTKyuWVJd7764oAwUMnr7ehb2+zeU/PWCinKKzrdjUNdXE/vU5RTVZl5gMWIbKasiUTVZFOWyyRGC5dNNKlg4CVjc0ogmaEvA31CUDYhwmMCNEGZqXYlIsalPVEZ1tWjJAR5HAQBFEGEGAkEb2vmlauEE1CVKJvQ9oQEH7G2uDYTYSY6N0kKajawL+DmyYsqbaLEEQSLnusq6sUeDr+K4i08QGsZUEUg3pFVxLuqEu09z2QKhAV2o4DhxBxDJvXi3XROzvQIqFxzdjutwsZwkCNs1AKDVk4WalbHrEmSm474YaIobHfFykoQQlGsZvSShXaEYOkfH9cCiySEkuK4tVIpP8RBG1o8E/hgUyvGq2VTTU+Z2fVRZSZEnGRjKQWZZ+uJ3LtAb8XDZraN2yiEUXKYgxEIBEPBxIEYsQTXJTLjdsZ0jZcJTHGFquqaLsxMz0N2tkGbadxmNDEy4Ijc3UorYYaYk4DhXyRUdCCJk1zpkOHaJFulTnWHHOjoPfXU58ACMZcSMHbllOSGEGMoBPgCgPGRj7e044tT75vEg5R5POZkOOL5hHeSqHjHWY6AoSMCXY4bVy2JBFNhyV6DAjYUqMJSQqkpAkio+KMQpKGAOMeV5IMP+j9CDEkHmL4NEUGbvhYkwGFK1TVpsw6dLEwFgWt+MMJ8R6MxnoIkRnQ6Genp5gTzioGZ0hGgAYeqhpJSd04ZzdUkd45YmZKdlNDQHbUqbMkrxue7PezjzbuNoZSDnxbqgbSdebXEqNpf4DNk7QdJzVFFnIlxa2sCFmkUHyHFYUm1AUSNMBWVrwuohT60Q3bSVIl4NO2QbtsghpyG5TDmmt67XfMTQRU8i0gxQcKnpbe9DASNRUJT8V4UnIyGq3XTSakZ+KwVHhScggQdAslUzF3LDoJCQkS5FkRXH6wlQMFohPxk0VKXkiC+aUTMqqk3HmJER0lHcBirKpO/XyryRtmn2fCDho93h3vhh1tqgqNbAoG3b3X2sZcmkVa5pXZLSWCxpBJUi5C85QqKHbjMrzRs9jvDUudKfWJ4Kf1vWGErtfxkDVCJVtraMEGAEwhkCCigOIIOZhUcdeh7tLDTeO0wmBBnEqEY8kqIiYECmeYWgKRGIiw0gwEolGisIsI1JaiGEM0Ew0BiAobprAgoFLDNq67nB7a4ZJLOHqUKZVaqnv4BsTDctRXc7S6cas0NOR2ZBdscF4vLMpWRR4p1+yMnJqXWKJtg6rbflSGztaMytaM1z92raWxkxzUWidO6EUZ+JsmuNWt7QWNxU7vTiXswjiFVxqzYmmIUwU136aOuVSA2X/WQORMJ1gAKCLwrZcke2h5D+qPN+TeyYBsl4zCRb/LboxhII/qX97ngjd/DyYKnM/cLPnbbDZ87rX4wEhUAsXgPmV5e2+8ll3mzKxhzckBU25U0XEMnBwHc7rSDa8lR69HV2uLXiQ7HsU3Dn6JDm9HM4seJ8Ec2/sVMDb76ii7RsExmA4EovSa8CCG7s+OMc3u/pi+rh3zXGUPOit3f3ggVN7Z/zWCapGmTyeijLfZk/ZvHOLt8+vaq5Fv5x/7o39u2q2xbc3buCTW4wPz25SOk7s7Z/97hOcVFPWv/0Z7+AnWwzp0oka30kuu8F37NN9V94ZfGpH9cBnF/ffd8r7/aG3jmy9fPvRa3uX9u0ZeH6rHDkaszoXLf36wsZ5hyuEmh9rru1bNijtW3blm2NM9OqO2le++pAcX3Thxe4vZp6/t+rA+y9VJNDi0K+7z1lt/R94us5M+3ZB7uyzT1/4aPXns169NLjS98XAbZs+ftN4pHHro+u/fXnbyT9nHF76xA/9pw+ljlTuHDj9c2CXf879g+98Mu/gwi9z1e9drv+9/oWN11cJbNX1xXfN5e65evb7l6vfPX3mu4H2/RePhir1PTtfGzq+vwBUwRysKhYAAA=="; + String tokenOath2TF = "v^1.1#i^1#r^0#I^3#p^3#f^0#t^H4sIAAAAAAAAAOVYaWwUVRzv9kAJggEVCPFYBjECzu6bY48Z2TVLd4EV2i7dthwe5O3Mm/bZ2Zlx5k3bxSMFATUqxGAMRoGqhBhBFBIUQ0KIMRGwGkSiifGTfiGKgXiEQ6LOTA+WEgvtErOJux827//+1+9/vbcPdI8ZO3v9wvVnx/tuqOzpBt2VPh8zDowdUzNnQlXltJoKUMTg6+m+u7t6TdXJuRbMq4bYiCxD1yzk78qrmiV6xBhlm5qoQwtbogbzyBKJJGYTdYtFNgBEw9SJLukq5U8nY5QkRdlQlFdyIZQTWIZ3qNqAziY9RnFSOBxlI1CR5KjCRgRn37JslNYsAjUSo1jAApoBNMs1AUEMMWIoHAA8t4LytyDTwrrmsAQAFffcFT1Zs8jX4V2FloVM4iih4unE/GxDIp1M1TfNDRbpivfHIUsgsa3LV7W6jPwtULXR8GYsj1vM2pKELIsKxvssXK5UTAw4Mwr3vVCHJferKBHIAy6S465LKOfrZh6S4f1wKVimFY9VRBrBpHC1iDrRyD2GJNK/qndUpJN+92eJDVWsYGTGqNS8xPLmbKqR8mczGVPvwDKSXaQMCEcZAIQIR8WJTYiueCWX77fTp6w/ykMM1eqajN2YWf56ncxDjtNoaGj4otA4TA1ag5lQiOtQER/DDISQja5wc9qXRJu0aW5aUd6Jg99bXj0BAxVxqQauV03wAHJCJAQAwzOKIEWvrAm310deF3E3NYlMJuj6gnKwQOeh2Y6IoUIJ0ZITXjuPTCyLXEhhuaiCaDksKDQvKAqdC8lhmlEQAgjlcpIQ/R+VByEmztkEDZbI0A0PY4xS9Vas1SHSpsvUUBZv4vQXRJcVo9oIMcRgsLOzM9DJBXSzNcg6+Q4uq1ucldpQHlKDvPjqzDT2SkNCjpSFRVIwHG+6nMpzjGutVNyNdzo5UK6XuRQfSv0XbFlJN1BGV7FUKC9snClnoEkKWaSqDqEkkJYLsrzgtRG314lhOUqggQNu2wactgjq0BlTLmml57XfNXQ1pqDlBCnQ1/SO9oCJoKxramE0wiOQwVqH0zS6WRiNwUHhEchASdJtjYzGXL/oCCQUW1WwqrpzYTQGi8RH4qYG1QLBkjUqk1hzK84agYgBCx5AGVuG2y/XJOnQnPNEQgFnxnv3i0FnS+pSE8nYdKb/StvE5dWsiZyK4cpswAyoAdpbZE2V7jvNaLkLd7Z2DY/c6/Xh0ScMI11mx8sQpDqhM41JWmJ4wIQhEOgIYCCDckxJWU+ijnLDjSKsILEgQgsRXqB5WZDpXDTK0oAPy9GowvB8iC8JM4akvBAzYcDxfDjClIYriyQTlRm09g6uuTEVFeZkkzDVqDQsbMktEtK1MJm3DXZRRupsSa3KzF9lPt5aFysJvDsuRQwVt9dForcjralQbreOxtT8xlR24cqmhkWp+pLQukdCOV6JM4lsdmlDY2mXYncW5/M2gTkVldtwYlmGEUpr07pWXG6gAMtynBDmeOefYknYalXs3En+q86rXr3p2kEu1C2C5GtFN4RQ9B/1iteJ4OWvg/EK78Os8e0Da3x7Kn0+EAQzmRlg+piq5uqqm6ZZmDh3N6gELNyqQWKbKNCOCgbEZuUYn9EMf5pZ9B7Z8wiYOvgiObaKGVf0PAluv7RTw9w8ZTwLGMByQAgxofAKMOPSbjUzufrWXr1Z6Kk79Wbh8KSHaqZMn7XWXpIA4weZfL6aiuo1vooVp59+Uf2rBl388WBv54FfW6s6duLVD2yitjdtqXrku6fembBz98ZZ20jHjrZjkQe7BK1lwfnNa4OpzGent7RJ7PEjPx3d7Tv6/ritTySm3nFu8p5D20Oz16d+3PXMxs5J3783qXbB6dyJZ42LB5t/uf/Uyf3iublvPbf5pfHzDjZU5462r9M/eN730cbeE6/snTjnW9+2z3csP/xo5rflXEx4Ib7lXevMjeuWMPf9sW/cr9N//mJv+o+HJ0ydvSu5IfLqUmVZx+S35xzfP6P3h5c/vOvkId+ZrX/ee+TRCnCw943VT/79+leF8wsuTLzwze/rJm2cduy2Lz/+5LWxG2ZVVJ6t+PrTjgOnwdlbFm8uVDXdc2dDX/r+AVaPZtUpFgAA"; + String tokenSandboxTF = "AgAAAA**AQAAAA**aAAAAA**lopgWw**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6AEloqgCJCLpg+dj6x9nY+seQ**CmADAA**AAMAAA**EXdobuByZfo3jlPyaaoMjmIzLPynG/su/LcK/ez5bscXTnZrsisIO3r4SfIwHpnGKil7PA5mXe2WQcfzAUA8MGh08lMoYMyaSRVN9jLuJSKxYBWYRdxyvJG+OKC/m4L7Zkorn/7g2KSrZO/pOxl8cJUD9ya3mNu1k3g0OnO5a4/x9iRmdUtcMRDJXKbeACTuoJF5bZdUZCj2SuH/FWhu4EJSh1WVRab+Mbqt1RYJqLUMLL0cGJNAt4hyI4h5w5lsU2Cu/8aoPmEqaZg0UkUBp6RgYa7+/VTI5vlbSuBJdJcZetyhQMcYb7geFYXxOgj3H144rpNjAIv43TK9tioPtUB8WSMz90f8GAdA1gVtg5eJIBVm4MK73VFajnxeaSD97SZUv6LCH6HAvB7coBIZFJWTiMzkpoGu8l+l3xBnjypZKKSAk12bxBXRHHmy1DcZ3/F/aZe/oRAo29VUS88FVzjgtYybjHw6fott2BQBDKz0d1AH5xLPmFBc7vaoGO0seU0GU/a8EIlGS19JOfslAdQOBpOsXuV6E6ldfmWPstJevyv2gP0rEM2kZohKdZGkIXzYg1T2DJAPxoVKEMNko8eqbjuvQrRnRSKbo/9C2TrANIBkoaV04hsQIKfb1HdaYigN2LIeQOF8SQh1y2dg2eNM9J8Y4KGsh7iNLWSicNxEG5ykESblJ6NgTMjh8TEVBpnH7ES+JaXsNdqAmNU+gR1sAtY2MXET4ACEV6eA2EvOyJKl4sG6NoN40kMJNt2o"; + String applicationId = "AbliaSrl-tuttofot-PRD-c14016a09-701a1eb1"; + String certificateId = "PRD-14016a09b37a-1fa6-43a5-8201-dfa9"; + String developerId = "e729c207-9749-4d9d-b882-046d88f14454"; + String ruName = "Ablia_S.r.l.-AbliaSrl-tuttof-dxiwgx"; + String hostname = "localhost"; + String db = "cc"; + ApplParmFull ap = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + EbayAbliaApi bean = new EbayAbliaApi(ap); + EbayResult ebayRes = bean.ebayGetFulfillmentPolicy(); + System.out.println(ebayRes.getMsg() + "\n" + ebayRes.getMsg()); + ebayRes = bean.ebayGetReturnPolicy(); + System.out.println(ebayRes.getMsg() + "\n" + ebayRes.getMsg()); + ebayRes = bean.ebayGetPaymentPolicy(); + System.out.println(ebayRes.getMsg() + "\n" + ebayRes.getMsg()); + } + + public String getApplicationId() { + return (this.applicationId == null) ? "" : this.applicationId.trim(); + } + + public void setApplicationId(String applicationId) { + this.applicationId = applicationId; + } + + public String getDeveloperId() { + return (this.developerId == null) ? "" : this.developerId.trim(); + } + + public void setDeveloperId(String developerId) { + this.developerId = developerId; + } + + public String getCertificateId() { + return (this.certificateId == null) ? "" : this.certificateId; + } + + public void setCertificateId(String certificateId) { + this.certificateId = certificateId; + } + + public boolean isUseSandbox() { + return this.useSandbox; + } + + public void setUseSandbox(boolean useSandbox) { + this.useSandbox = useSandbox; + } + + public EbayResult ebayGetFulfillmentPolicy() { + EbayResult res = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayGetFulfillmentPolicy"); + CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build(); + HttpGet request = new HttpGet("https://api.ebay.com/sell/account/v1/fulfillment_policy?marketplace_id=EBAY_IT"); + request.setHeader("Authorization", getTokenOath4GetRequest()); + request.setHeader("Accept-Encoding", "application/gzip"); + HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request); + String content = EntityUtils.toString(resp.getEntity()); + int statusCode = resp.getStatusLine().getStatusCode(); + String defaultPolicyId = ""; + if (statusCode == 200) { + JSONObject jo = new JSONObject(content); + JSONArray joArr = jo.getJSONArray("fulfillmentPolicies"); + for (int i = 0; i < joArr.length(); i++) { + JSONObject row = joArr.getJSONObject(i); + JSONArray categoryTypes = row.getJSONArray("categoryTypes"); + if (categoryTypes.length() > 0) { + JSONObject categoryType = categoryTypes.getJSONObject(0); + if (categoryType.getBoolean("default")) { + defaultPolicyId = row.getString("fulfillmentPolicyId"); + break; + } + } + } + if (!defaultPolicyId.isEmpty()) { + res.setOk(true); + res.setResult(defaultPolicyId); + res.setMsg("Trovata fulfillmentPolicyId di default: " + defaultPolicyId); + } else { + res.setMsg("Impossibile trovare fulfillmentPolicyId di default.\nCollegati al tuo account ebay:\nimpostazioni account --> \nPreferenze account: impostazioni --> \nGestore delle regole di vendita --> \nCrea regola Spedizione"); + res.setOk(false); + } + } else { + res.setMsg(content); + res.setOk(false); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + res.setMsg(e.getMessage()); + res.setOk(false); + } + return res; + } + + public EbayResult XXXaddEbayItem(Articolo bean) { + EbayResult res = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> addEbayItem "); + ApiContext apiContext = getApiContext(); + VerifyAddItemCall callVI = new VerifyAddItemCall(apiContext); + callVI.setEnableCompression(true); + callVI.setItem(getEbayItemByArticolo(bean)); + FeesType feesTYpe = callVI.verifyAddItem(); + if (this.debug) + System.out.println(callVI.getErrorHandling().value()); + AddItemCall addItemCall = new AddItemCall(apiContext); + } catch (Exception e) { + e.printStackTrace(); + res.setOk(false); + res.setMsg(e.getMessage()); + } + return res; + } + + private ItemType getEbayItemByArticolo(Articolo bean) { + String lang = "it"; + ItemType item = new ItemType(); + item.setTitle(bean.getNome()); + item.setSKU(bean.getCodice()); + item.setDescription(bean.getDescrizioneMarketplace(lang)); + item.setCurrency(CurrencyCodeType.EUR); + item.setCountry(CountryCodeType.IT); + item.setPostalCode("59100"); + item.setLocation("Prato"); + item.setQuantity(Integer.valueOf((int)bean.getQuantita())); + item.setQuantityAvailable(Integer.valueOf((int)bean.getQuantita())); + if (bean.getFlgUsato() == 0L) { + item.setConditionDisplayName("Nuovo"); + item.setConditionID(Integer.valueOf(1000)); + } else { + item.setConditionDisplayName("Usato"); + item.setConditionID(Integer.valueOf(0)); + } + ProductListingDetailsType pldt = new ProductListingDetailsType(); + pldt.setEAN(bean.getCodiceEan()); + BrandMPNType mpn = new BrandMPNType(); + mpn.setBrand(bean.getMarca().getDescrizione()); + mpn.setMPN(bean.getCodiceProduttore()); + pldt.setBrandMPN(mpn); + item.setProductListingDetails(pldt); + item.setDispatchTimeMax(Integer.valueOf(2)); + item.setListingType(ListingTypeCodeType.FIXED_PRICE_ITEM); + item.setListingDuration(ListingDurationCodeType.DAYS_30.value()); + ReturnPolicyType rpt = new ReturnPolicyType(); + rpt.setDescription("Si accettano restituzione di prodotti in perfetto stato, nella confezione originale entro il termine di 14 gg come previsto dalla legge."); + rpt.setReturnsAccepted("Restituzione accettata"); + rpt.setReturnsAcceptedOption(ReturnsAcceptedCodeType.RETURNS_ACCEPTED.value()); + rpt.setReturnsWithin("14 giorni"); + rpt.setReturnsWithinOption(ReturnsWithinOptionsCodeType.DAYS_14.value()); + rpt.setShippingCostPaidBy("Acquirente"); + rpt.setShippingCostPaidByOption(ShippingCostPaidByOptionsCodeType.BUYER.value()); + item.setReturnPolicy(rpt); + SellerProfilesType sellerProfile = new SellerProfilesType(); + SellerShippingProfileType sellerShippingProfile = new SellerShippingProfileType(); + sellerShippingProfile.setShippingProfileID(Long.valueOf(4949L)); + sellerProfile.setSellerShippingProfile(sellerShippingProfile); + SellerReturnProfileType sellerReturnProfile = new SellerReturnProfileType(); + sellerReturnProfile.setReturnProfileID(Long.valueOf(4947L)); + sellerProfile.setSellerReturnProfile(sellerReturnProfile); + SellerPaymentProfileType sellerPaymentProfile = new SellerPaymentProfileType(); + sellerPaymentProfile.setPaymentProfileID(Long.valueOf(4945L)); + sellerProfile.setSellerPaymentProfile(sellerPaymentProfile); + item.setSellerProfiles(sellerProfile); + BuyerPaymentMethodCodeType[] paymentA = new BuyerPaymentMethodCodeType[1]; + paymentA[0] = BuyerPaymentMethodCodeType.PAY_PAL; + item.setPaymentMethods(paymentA); + item.setPayPalEmailAddress("acolzi@f3.com"); + if (!bean.getTipo().getEbayCategoryId().isEmpty()) { + CategoryType ct = new CategoryType(); + ct.setCategoryID(bean.getTipo().getEbayCategoryId()); + ct.setCategoryName(bean.getTipo().getEbayCategoryDesc()); + item.setPrimaryCategory(ct); + } else { + CategoryType ct = new CategoryType(); + ct.setCategoryID("80053"); + ct.setCategoryName("Monitor"); + item.setPrimaryCategory(ct); + } + AmountType at = new AmountType(); + if (bean.getListinoEbay().getId_listino() > 0L) { + at.setValue(bean.getListinoEbay().getPrezzoIva(bean).getPrezzoFinale()); + } else { + at.setValue(bean.getPrezzoBaseIva()); + } + at.setCurrencyID(CurrencyCodeType.EUR); + item.setStartPrice(at); + PictureDetailsType pdt = new PictureDetailsType(); + pdt.setGalleryType(GalleryTypeCodeType.GALLERY); + ArrayList urlAL = new ArrayList<>(); + for (int i = 1; i < 20; i++) { + if (bean.isImgExist(i)) { + String url = bean.getWwwAddressParm() + bean.getWwwAddressParm() + bean.getPathImg(); + urlAL.add(url); + } + } + if (urlAL.size() > 0) { + String[] arr = urlAL.toArray(new String[urlAL.size()]); + pdt.setPictureURL(arr); + } else { + String[] fake = { "https://i2.ebayimg.com/abc/M28/dummy.jpg" }; + pdt.setPictureURL(fake); + } + item.setPictureDetails(pdt); + return item; + } + + public EbayAuthNAuthToken fetchTokenSdk(String l_sessionId) { + EbayAuthNAuthToken res = new EbayAuthNAuthToken(); + try { + FetchTokenCall ftc = new FetchTokenCall(getApiContext()); + ftc.setSessionID(l_sessionId); + res.setToken(ftc.fetchToken()); + res.setExpirationDate(new Date(ftc.getHardExpirationTime().getTimeInMillis())); + } catch (Exception e) { + e.printStackTrace(); + } + return res; + } + + public EbayResult ebayCreateInventoryLocation(String merchantLocationKey) { + EbayResult resER = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayCreateInventoryLocation"); + CloseableHttpClient client = HttpClients.createDefault(); + HttpPost request = new HttpPost("https://api.ebay.com/sell/inventory/v1/location/{merchantLocationKey}".replace("{merchantLocationKey}", merchantLocationKey)); + request.setHeader("Authorization", getTokenOath4GetRequest()); + request.setHeader("Accept", "application/json"); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Content-Language", "it-IT"); + JSONObject item = getJsonInventoryLocation(merchantLocationKey); + if (this.debug) + System.out.println("json ebay v 1:\n" + item.toString(4)); + StringEntity stringEntity = new StringEntity(item.toString(4), "UTF-8"); + request.setEntity((HttpEntity)stringEntity); + int statusCode = 200; + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (statusCode < 300) { + resER.setOk(true); + resER.setMsg("Inventory location con chiave " + merchantLocationKey + " creato correttamente"); + if (this.debug) + System.out.println("Inventory location con chiave " + merchantLocationKey + " creato correttamente"); + } else { + resER.setOk(false); + System.out.println("Errore Inventory location con chiave " + merchantLocationKey + ". status code: " + statusCode); + resER.setMsg("Errore Inventory location con chiave " + merchantLocationKey + ". status code: " + statusCode); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + private JSONObject getJsonItemByArticolo(Articolo bean) { + JSONObject jo = new JSONObject(); + String lang = "it"; + JSONObject availability = new JSONObject(); + JSONObject shipToLocationAvailability = new JSONObject(); + shipToLocationAvailability.put("quantity", bean.getQtaEbayDaInviare()); + availability.put("shipToLocationAvailability", shipToLocationAvailability); + jo.put("availability", availability); + if (bean.getFlgUsato() > 0L) { + jo.put("condition", bean.getStatoUsato().getEbayCondition()); + jo.put("conditionDescription", bean.getStatoUsato().getDescrizione(lang)); + } else { + jo.put("condition", "NEW"); + } + JSONObject product = new JSONObject(); + product.put("title", bean.getNomeMarketplace(lang)); + product.put("description", bean.getDescrizioneMarketplace(lang).replace(" ", " ")); + product.put("brand", bean.getMarca().getDescrizione()); + if (!bean.getCodiceProduttore().isEmpty()) + product.put("mpn", bean.getCodiceProduttore()); + if (!bean.getCodiceEan().isEmpty()) { + String[] eans = { bean.getCodiceEan() }; + product.put("ean", eans); + } + JSONObject aspects = new JSONObject(); + String[] Brand = { bean.getMarca().getDescrizione() }; + aspects.put("Marca", Brand); + Vectumerator vecCa = bean.getCaratteristicheArticolo(); + while (vecCa.hasMoreElements()) { + CaratteristicaArticolo rowCa = (CaratteristicaArticolo)vecCa.nextElement(); + String[] val = { rowCa.getVal() }; + aspects.put(rowCa.getCaratteristica().getDescrizione(), val); + } + product.put("aspects", aspects); + ArrayList urlAL = new ArrayList<>(); + for (int i = 1; i < 20; i++) { + if (bean.isImgExist(i)) { + String url = bean.getWwwAddressParm() + bean.getWwwAddressParm() + bean.getPathImg(); + urlAL.add(url); + } + } + if (urlAL.size() > 0) { + String[] arr = urlAL.toArray(new String[urlAL.size()]); + product.put("imageUrls", arr); + } else { + String[] fake = { "https://i2.ebayimg.com/abc/M28/dummy.jpg" }; + product.put("imageUrls", fake); + } + jo.put("product", product); + return jo; + } + + public JSONObject bulkUpdatePriceQuantityRest(String l_query) { + JSONObject res = null; + return res; + } + + public String getCategoryTreeId() { + String res = ""; + try { + CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build(); + HttpGet request = new HttpGet("https://api.ebay.com/commerce/taxonomy/v1_beta/get_default_category_tree_id?marketplace_id=EBAY_IT"); + request.setHeader("Authorization", getTokenOath4GetRequest()); + HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request); + String content = EntityUtils.toString(resp.getEntity()); + int statusCode = resp.getStatusLine().getStatusCode(); + JSONObject jRes = new JSONObject(content); + return jRes.getString("categoryTreeId"); + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + return res; + } + } + + public EbayOrder getEbayOrderRest(String orderId) { + EbayOrder res = new EbayOrder(); + try { + CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build(); + HttpGet request = new HttpGet("https://api.ebay.com/sell/fulfillment/v1/order/{orderId}?".replace("{orderId}", orderId)); + request.setHeader("Authorization", getTokenOath4GetRequest()); + HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request); + String content = EntityUtils.toString(resp.getEntity()); + int statusCode = resp.getStatusLine().getStatusCode(); + JSONObject jOrder = new JSONObject(content); + String buyerId = jOrder.getJSONObject("buyer").getString("username"); + String amount = jOrder.getJSONObject("pricingSummary").getJSONObject("total").getString("value"); + try { + String buyerTaxId = jOrder.getJSONObject("buyer").getJSONObject("taxIdentifier").getString("taxpayerId"); + String taxIdType = jOrder.getJSONObject("buyer").getJSONObject("taxIdentifier").getString("taxIdentifierType"); + res.setBuyerTaxId(buyerTaxId); + res.setTaxIdType(taxIdType); + } catch (Exception e) {} + res.setBuyerId(buyerId); + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + } + return res; + } + + public Vectumerator getEbayOrdersRest() { + Vectumerator vec = new Vectumerator(); + try { + CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build(); + HttpGet request = new HttpGet("https://api.ebay.com/sell/fulfillment/v1/order?limit=150&offset=0"); + request.setHeader("Authorization", getTokenOath4GetRequest()); + HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request); + String content = EntityUtils.toString(resp.getEntity()); + int statusCode = resp.getStatusLine().getStatusCode(); + if (this.debug) + System.out.println("Status Code: " + statusCode); + if (this.debug) + System.out.println("\ncontent = " + content); + JSONObject jo = new JSONObject(content); + JSONArray jOrders = jo.getJSONArray("orders"); + for (int i = 0; i < jOrders.length(); i++) { + JSONObject jOrder = jOrders.getJSONObject(i); + String orderId = jOrder.getString("orderId"); + EbayOrder row = getEbayOrderRest(orderId); + if (this.debug) + System.out.println(orderId + " " + orderId + " " + row.getBuyerId() + " " + row.getAmount() + " " + row.getTaxIdType()); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + } + return vec; + } + + public EbayResult getSdkEbayOrders() { + EbayResult resER = new EbayResult(); + try { + Vector res = new Vector<>(); + if (this.debug) + System.out.println("===== [1] Account Information ===="); + ApiContext apiContext = getApiContext(); + GetOrdersCall call = new GetOrdersCall(apiContext); + DetailLevelCodeType[] detailLevels = { DetailLevelCodeType.RETURN_ALL }; + call.setDetailLevel(detailLevels); + call.setOrderRole(TradingRoleCodeType.SELLER); + call.setNumberOfDays(Integer.valueOf(30)); + if (this.debug) + System.out.println("getOrders"); + OrderType[] orders = call.getOrders(); + for (OrderType order : orders) { + EbayOrder row = new EbayOrder(); + row.setBuyerId(order.getBuyerUserID()); + row.setOrderId(order.getOrderID()); + row.setAmount(order.getAmountPaid().getValue()); + TaxIdentifierType[] tit = order.getBuyerTaxIdentifier(); + if (tit.length == 1) { + TaxIdentifierType ti = tit[0]; + row.setBuyerTaxId(ti.getID()); + row.setTaxIdType(ti.getType().toString()); + } + if (this.debug) { + System.out.println(" buyers id: " + row.getBuyerId()); + System.out.println(" order id: " + row.getOrderId()); + System.out.println(" amount: " + row.getAmount()); + System.out.println(" Type: " + row.getTaxIdType()); + try { + System.out.println(" ID: " + row.getBuyerTaxId()); + } catch (Exception e) { + e.printStackTrace(); + } + } + if (tit.length > 1) { + if (this.debug) + System.out.println(); + for (int i = 1; i < tit.length; i++) { + TaxIdentifierType ti = tit[i]; + if (this.debug) { + System.out.println("" + i + " Type: " + i); + try { + System.out.println(" ID: " + row.getBuyerTaxId()); + } catch (Exception e) { + e.printStackTrace(); + } + System.out.println(); + } + } + } + res.add(row); + GetUserCall user = new GetUserCall(apiContext); + user.setUserID(order.getBuyerUserID()); + if (this.debug) + System.out.println("--------------------"); + } + resER.setResult(res); + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + protected String getTokenOath4GetRequest() { + return "bearer " + getOAuthToken(); + } + + protected String getBase64OauthCredential() { + return "Basic " + Base64.getEncoder().encodeToString((getApFull().getParm("EBAY_APPLICATION_ID_PRODUCTION").getTesto() + ":" + getApFull().getParm("EBAY_APPLICATION_ID_PRODUCTION").getTesto()) + .getBytes()); + } + + public String getSdkEbaySessionId() { + String res = ""; + try { + GetSessionIDCall gsi = new GetSessionIDCall(getApiContext()); + gsi.setRuName(getRuName()); + if (this.debug) + System.out.println("AbliaEbayApi --> getEbaySessionId"); + res = gsi.getSessionID(); + } catch (Exception e) { + e.printStackTrace(); + } + return res; + } + + public String getRuName() { + return (this.ruName == null) ? "" : this.ruName.trim(); + } + + public void setRuName(String ruName) { + this.ruName = ruName; + } + + public Date getExpirationDate() { + return this.expirationDate; + } + + public void setExpirationDate(Date exprationDate) { + this.expirationDate = exprationDate; + } + + public ApplParmFull getApFull() { + return this.apFull; + } + + public void setApFull(ApplParmFull apFull) { + this.apFull = apFull; + } + + public String getTokenUsername() { + return (this.tokenUsername == null) ? "" : this.tokenUsername.trim(); + } + + public void setTokenUsername(String tokenUsername) { + this.tokenUsername = tokenUsername; + } + + public EbayResult getEbayInventoryItemRest(String l_sku) { + EbayResult resER = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> getEbayInventoryItemRest"); + CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build(); + HttpGet request = new HttpGet("https://api.ebay.com/sell/inventory/v1/inventory_item/{sku}".replace("{sku}", l_sku)); + request.setHeader("Authorization", getTokenOath4GetRequest()); + HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request); + String content = EntityUtils.toString(resp.getEntity()); + int statusCode = resp.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + JSONObject jo = new JSONObject(content); + resER.setResult(jo); + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public EbayResult getEbayInventoryItems(int pageNumber, int pageRow) { + EbayResult resER = new EbayResult(); + try { + Vector res = new Vector<>(); + if (this.debug) + System.out.println("AbliaEbayApi --> getEbayInventoryItems " + pageNumber + " " + pageRow); + ApiContext apiContext = getApiContext(); + GetMyeBaySellingCall call = new GetMyeBaySellingCall(apiContext); + DetailLevelCodeType[] detailLevels = { DetailLevelCodeType.RETURN_ALL }; + call.setDetailLevel(detailLevels); + ItemListCustomizationType ilct = new ItemListCustomizationType(); + ilct.setInclude(Boolean.valueOf(true)); + PaginationType pt = new PaginationType(); + pt.setPageNumber(Integer.valueOf(pageNumber)); + pt.setEntriesPerPage(Integer.valueOf(pageRow)); + ilct.setPagination(pt); + call.setActiveList(ilct); + call.getMyeBaySelling(); + PaginatedItemArrayType activeItems = call.getReturnedActiveList(); + if (activeItems != null) { + ItemType[] items = activeItems.getItemArray().getItem(); + if (items.length > 0) { + resER.setOk(true); + resER.setResult(items); + } else { + resER.setOk(false); + resER.setMsg("Nessun articolo attivo trovato!!"); + } + } else { + resER.setOk(false); + resER.setMsg("Nessun articolo attivo trovato!!"); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public EbayResult getSdkEbayCategorySuggestion(String l_keyword) { + EbayResult res = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> getEbayInventoryItemBySku"); + ApiContext apiContext = getApiContext(); + GetSuggestedCategoriesCall call = new GetSuggestedCategoriesCall(apiContext); + call.setQuery(l_keyword); + SuggestedCategoryType[] sct = call.getSuggestedCategories(); + if (sct.length > 0) { + JSONObject jo = new JSONObject(); + jo.put("categoryId", sct[0].getCategory().getCategoryID()); + jo.put("categoryName", sct[0].getCategory().getCategoryName()); + res.setResult(jo); + } else { + res.setOk(false); + res.setMsg("Attenzione! nessun risultato per " + l_keyword); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + res.setOk(false); + res.setMsg(e.getMessage()); + } + return res; + } + + public EbayResult getSdkEbayItemIdBySku2(String l_sku) { + EbayResult resER = new EbayResult(); + try { + Vector res = new Vector<>(); + if (this.debug) + System.out.println("AbliaEbayApi --> getEbayInventoryItemBySku2"); + ApiContext apiContext = getApiContext(); + GetItemCall call = new GetItemCall(apiContext); + DetailLevelCodeType[] detailLevels = { DetailLevelCodeType.RETURN_ALL }; + call.setDetailLevel(detailLevels); + call.setSKU(l_sku); + ItemType item = call.getItem(); + if (this.debug) + System.out.println(item.getDescription()); + resER.setResult(res); + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public EbayResult getSdkEbayItemIdBySku(String l_sku) { + EbayResult res = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> getEbayInventoryItemBySku"); + ApiContext apiContext = getApiContext(); + GetSellerListCall call = new GetSellerListCall(apiContext); + DetailLevelCodeType[] detailLevels = { DetailLevelCodeType.RETURN_ALL }; + call.setDetailLevel(detailLevels); + PaginationType pt = new PaginationType(); + pt.setPageNumber(Integer.valueOf(1)); + pt.setEntriesPerPage(Integer.valueOf(2)); + call.setPagination(pt); + Calendar calFrom = Calendar.getInstance(); + Calendar calTo = Calendar.getInstance(); + calFrom.add(6, -100); + calTo.add(6, 1); + TimeFilter tf = new TimeFilter(calFrom, calTo); + call.setStartTimeFilter(tf); + call.setEndTimeFilter(tf); + call.setUserID(getTokenUsername()); + SKUArrayType sku = new SKUArrayType(); + String[] skuA = { l_sku }; + sku.setSKU(skuA); + call.setSKUArray(sku); + ItemType[] items = call.getSellerList(); + if (items.length > 0) { + res.setResult(items[0].getItemID()); + } else { + res.setOk(false); + res.setMsg("Attenzione! " + l_sku + " non trovato"); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + res.setOk(false); + res.setMsg(e.getMessage()); + } + return res; + } + + public EbayResult getSdkEbayInventoryItemByItemId(String l_itemid) { + EbayResult res = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> getEbayInventoryItemByItemId"); + ApiContext apiContext = getApiContext(); + GetItemCall call = new GetItemCall(apiContext); + DetailLevelCodeType[] detailLevels = { DetailLevelCodeType.RETURN_ALL }; + call.setDetailLevel(detailLevels); + call.setItemID(l_itemid); + ItemType item = call.getItem(); + if (this.debug) + System.out.println(item.getTitle()); + res.setResult(item); + } catch (Exception e) { + e.printStackTrace(); + res.setOk(false); + res.setMsg(e.getMessage()); + } + return res; + } + + public JSONObject getEbayPaymentIdRest(String l_query) { + JSONObject res = null; + try { + if (this.debug) + System.out.println("AbliaEbayApi --> getEbayPaymentIdRest"); + CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build(); + String categoryId = "101"; + HttpGet request = new HttpGet("https://api.ebay.com/commerce/taxonomy/v1/category_tree/{category_tree_id}/get_category_suggestions?q=" + .replace("{category_tree_id}", categoryId) + "https://api.ebay.com/commerce/taxonomy/v1/category_tree/{category_tree_id}/get_category_suggestions?q=".replace("{category_tree_id}", categoryId)); + request.setHeader("Authorization", getTokenOath4GetRequest()); + request.setHeader("Accept-Encoding", "application/gzip"); + HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request); + String content = EntityUtils.toString(resp.getEntity()); + int statusCode = resp.getStatusLine().getStatusCode(); + JSONObject jo = new JSONObject(content); + JSONArray jCat = jo.getJSONArray("categorySuggestions"); + if (jCat.length() > 1) + res = jCat.getJSONObject(0).getJSONObject("category"); + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + } + return res; + } + + public EbayResult getEbayInventoryItemsRest(int l_limit_1_100, int l_page_number) { + EbayResult resER = new EbayResult(); + try { + String l_limit, l_page; + if (this.debug) + System.out.println("AbliaEbayApi --> getEbayInventoryItemsRest"); + CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build(); + if (l_limit_1_100 < 1 || l_limit_1_100 > 100) { + l_limit = "10"; + } else { + l_limit = String.valueOf(l_limit_1_100); + } + if (l_page_number < 1) { + l_page = "1"; + } else { + l_page = String.valueOf(l_page_number); + } + HttpGet request = new HttpGet("https://api.ebay.com/sell/inventory/v1/inventory_item?limit={limit}&offset={offset}".replace("{limit}", l_limit).replace("{offset}", l_page)); + request.setHeader("Authorization", getTokenOath4GetRequest()); + HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request); + String content = EntityUtils.toString(resp.getEntity()); + int statusCode = resp.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + JSONObject jo = new JSONObject(content); + resER.setOk(true); + resER.setResult(jo); + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public EbayResult XXXaddEbayItemX(Articolo bean) { + EbayResult res = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> addEbayItem "); + ApiContext apiContext = getApiContext(); + AddItemCall callVI = new AddItemCall(apiContext); + callVI.setEnableCompression(true); + callVI.setItem(getEbayItemByArticolo(bean)); + FeesType feesTYpe = callVI.addItem(); + if (this.debug) + System.out.println(callVI.getErrorHandling().value()); + AddItemCall addItemCall1 = new AddItemCall(apiContext); + } catch (Exception e) { + e.printStackTrace(); + res.setOk(false); + res.setMsg(e.getMessage()); + } + return res; + } + + public EbayResult getEbayInventoryItemsSellerListCall() { + EbayResult resER = new EbayResult(); + try { + Vector res = new Vector<>(); + if (this.debug) + System.out.println("AbliaEbayApi --> getEbayInventoryItems"); + ApiContext apiContext = getApiContext(); + GetSellerListCall call = new GetSellerListCall(apiContext); + DetailLevelCodeType[] detailLevels = { DetailLevelCodeType.RETURN_ALL }; + call.setDetailLevel(detailLevels); + PaginationType pt = new PaginationType(); + pt.setPageNumber(Integer.valueOf(1)); + pt.setEntriesPerPage(Integer.valueOf(10)); + call.setPagination(pt); + Calendar calFrom = Calendar.getInstance(); + Calendar calTo = Calendar.getInstance(); + calFrom.add(6, -100); + calTo.add(6, 1); + TimeFilter tf = new TimeFilter(calFrom, calTo); + call.setStartTimeFilter(tf); + call.setEndTimeFilter(tf); + call.setUserID(getTokenUsername()); + ItemType[] items = call.getSellerList(); + if (this.debug) + for (ItemType item : items) + System.out.println(item.getItemID() + " " + item.getItemID() + " " + item.getSKU()); + resER.setResult(res); + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public EbayResult ebayPublishOffer(Articolo bean) { + EbayResult resER = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayPublishOffer"); + CloseableHttpClient client = HttpClients.createDefault(); + HttpPost request = new HttpPost("https://api.ebay.com/sell/inventory/v1/offer/{offerId}/publish/".replace("{offerId}", bean.getEbayOfferId())); + request.setHeader("Authorization", getTokenOath4GetRequest()); + request.setHeader("Accept", "application/json"); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Content-Language", "it-IT"); + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + JSONObject jo = new JSONObject(content); + if (statusCode == 400) { + resER.setOk(false); + resER.setMsg(jo.toString(2)); + resER.setResult(jo); + } else { + resER.setOk(true); + resER.setResult(jo); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + private JSONObject getJsonOfferByArticolo(Articolo bean, boolean createOffer) { + JSONObject jo = new JSONObject(); + String lang = "it"; + if (createOffer) { + jo.put("sku", bean.getCodice()); + jo.put("marketplaceId", "EBAY_IT"); + jo.put("format", "FIXED_PRICE"); + } + jo.put("availableQuantity", bean.getQtaEbayDaInviare()); + jo.put("categoryId", bean.getTipo().getEbayCategoryId()); + jo.put("listingDescription", bean.getDescrizioneMarketplace(lang).replace(" ", " ")); + jo.put("merchantLocationKey", Attivita.getDefaultInstance(getApFull()).getEbayMerchantLocationKey()); + JSONObject listingPolicies = new JSONObject(); + listingPolicies.put("fulfillmentPolicyId", Attivita.getDefaultInstance(getApFull()).getEbayFulfillmentPolicyId()); + listingPolicies.put("paymentPolicyId", Attivita.getDefaultInstance(getApFull()).getEbayPaymentPolicyId()); + listingPolicies.put("returnPolicyId", Attivita.getDefaultInstance(getApFull()).getEbayReturnPolicyId()); + jo.put("listingPolicies", listingPolicies); + JSONObject pricingSummary = new JSONObject(); + JSONObject price = new JSONObject(); + price.put("currency", "EUR"); + price.put("value", bean.getPrezzoArticoloEbayIva().getPrezzoFinale()); + pricingSummary.put("price", price); + jo.put("pricingSummary", pricingSummary); + JSONObject tax = new JSONObject(); + tax.put("vatPercentage", bean.getIva().getAliquota()); + jo.put("tax", tax); + return jo; + } + + public EbayResult ebayGetUserConsent(Articolo bean) { + EbayResult resER = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayCreateOffer"); + CloseableHttpClient client = HttpClients.createDefault(); + StringBuilder guc = new StringBuilder("https://auth.ebay.com/oauth2/authorize"); + HttpGet request = new HttpGet("https://auth.ebay.com/oauth2/authorize"); + request.setHeader("Authorization", getBase64OauthCredential()); + request.setHeader("Content-Type", "application/x-www-form-urlencoded"); + JSONObject item = getJsonOfferByArticolo(bean, true); + if (this.debug) + System.out.println("json ebay offer item v 1:\n" + item.toString(4)); + StringEntity stringEntity = new StringEntity(item.toString(4), "UTF-8"); + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resER.setOk(false); + JSONObject jo = new JSONObject(content); + resER.setMsg(jo.toString(2)); + resER.setResult(jo); + } else { + JSONObject jo = new JSONObject(content); + String offerId = jo.getString("offerId"); + if (offerId.isEmpty()) { + resER.setOk(false); + resER.setMsg(jo.toString(4)); + resER.setResult(jo); + } else { + bean.setEbayOfferId(offerId); + bean.superSave(); + resER.setOk(true); + resER.setResult(jo); + } + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public EbayResult ebayDeleteOffer(Articolo bean) { + EbayResult resER = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayDeleteOffer"); + CloseableHttpClient client = HttpClients.createDefault(); + HttpDelete request = new HttpDelete("https://api.ebay.com/sell/inventory/v1/offer/{offerId}".replace("{offerId}", bean.getEbayOfferId())); + request.setHeader("Authorization", getTokenOath4GetRequest()); + request.setHeader("Accept", "application/json"); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Content-Language", "it-IT"); + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) + System.out.println("Status Code: " + statusCode); + if (statusCode >= 400) { + resER.setOk(false); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + JSONObject jo = new JSONObject(content); + resER.setMsg(jo.toString(2)); + resER.setResult(jo); + } else { + resER.setOk(true); + bean.setEbayOfferId(null); + bean.superSave(); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public EbayResult ebayDeleteInventoryItem(Articolo bean) { + EbayResult resER = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayDeleteInventoryItem"); + CloseableHttpClient client = HttpClients.createDefault(); + HttpDelete request = new HttpDelete("https://api.ebay.com/sell/inventory/v1/inventory_item/{sku}".replace("{sku}", bean.getCodice())); + request.setHeader("Authorization", getTokenOath4GetRequest()); + request.setHeader("Accept", "application/json"); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Content-Language", "it-IT"); + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) + System.out.println("Status Code: " + statusCode); + if (statusCode >= 400) { + resER.setOk(false); + resER.setMsg("ebayDeleteInventoryItem: errore cancellazione articolo ebay. Status: " + statusCode); + } else { + resER.setOk(true); + resER.setMsg("ebayDeleteInventoryItem: cancellazione articolo ebay effettuata."); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public EbayResult ebayUpdateOffer(Articolo bean) { + EbayResult resER = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayUpdateOffer"); + CloseableHttpClient client = HttpClients.createDefault(); + HttpPut request = new HttpPut("https://api.ebay.com/sell/inventory/v1/offer/{offerId}".replace("{offerId}", bean.getEbayOfferId())); + request.setHeader("Authorization", getTokenOath4GetRequest()); + request.setHeader("Accept", "application/json"); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Content-Language", "it-IT"); + JSONObject item = getJsonOfferByArticolo(bean, false); + int versione = getApFull().getParm("VEBAY").getNumeroInt(); + if (this.debug) + System.out.println("ebayUpdateOffer versione VEBAY " + versione); + versione = 1; + if (versione == 0) { + String rawString = item.toString(4); + byte[] bytes = StringUtils.getBytesUtf8(rawString); + String utf8EncodedString = StringUtils.newStringUtf8(bytes); + if (this.debug) + System.out.println("json ebay item v0 UTF8:\n" + utf8EncodedString); + StringEntity stringEntity = new StringEntity(utf8EncodedString); + request.setEntity((HttpEntity)stringEntity); + } else if (versione == 1) { + if (this.debug) + System.out.println("json ebay item v 1:\n" + item.toString(4)); + StringEntity stringEntity = new StringEntity(item.toString(4), "UTF-8"); + request.setEntity((HttpEntity)stringEntity); + } else if (versione == 2) { + if (this.debug) + System.out.println("json ebay item v 2:\n" + String.valueOf(item.toString(4).getBytes("UTF-8"))); + ByteArrayEntity byteArrayEntity = new ByteArrayEntity(item.toString(4).getBytes("UTF-8")); + request.setEntity((HttpEntity)byteArrayEntity); + } + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resER.setOk(false); + JSONObject jo = new JSONObject(content); + resER.setMsg(jo.toString(2)); + resER.setResult(jo); + } else { + JSONObject jo = new JSONObject(content); + bean.setPrezzoSuEbayIva(bean.getPrezzoArticoloEbayIva().getPrezzoFinale()); + bean.setQtaSuEbay(bean.getQtaEbayDaInviare()); + bean.superSave(); + resER.setOk(true); + resER.setResult(jo); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public EbayResult ebayGetOffer(Articolo bean) { + EbayResult resER = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayCreateOffer"); + CloseableHttpClient client = HttpClients.createDefault(); + HttpGet request = new HttpGet("https://api.ebay.com/sell/inventory/v1/offer/{offerId}".replace("{offerId}", bean.getEbayOfferId())); + request.setHeader("Authorization", getTokenOath4GetRequest()); + request.setHeader("Accept", "application/json"); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Content-Language", "it-IT"); + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resER.setOk(false); + JSONObject jo = new JSONObject(content); + resER.setMsg(jo.toString(2)); + resER.setResult(jo); + } else { + JSONObject jo = new JSONObject(content); + String offerId = jo.getString("offerId"); + if (offerId.isEmpty()) { + resER.setOk(false); + resER.setMsg(jo.toString(4)); + resER.setResult(jo); + } else { + JSONObject listing = jo.getJSONObject("listing"); + bean.setEbayItemId(listing.getString("listingId")); + bean.superSave(); + resER.setOk(true); + resER.setResult(jo); + } + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public Attivita getAttivita() { + if (this.attivita == null) + this.attivita = Attivita.getDefaultInstance(getApFull()); + return this.attivita; + } + + public String getUriRuName() { + return getApFull().getParm("EBAY_RU_NAME_PRODUCTION").getTesto(); + } + + public EbayResult ebayRefreshUserAccesToken() { + EbayResult resER = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayRefreshUserAccesToken"); + CloseableHttpClient client = HttpClients.createDefault(); + if (this.debug) + System.out.println("aa: " + URLEncoder.encode("https://api.ebay.com/oauth/api_scope https://api.ebay.com/oauth/api_scope/sell.marketing.readonly https://api.ebay.com/oauth/api_scope/sell.marketing https://api.ebay.com/oauth/api_scope/sell.inventory.readonly https://api.ebay.com/oauth/api_scope/sell.inventory https://api.ebay.com/oauth/api_scope/sell.account.readonly https://api.ebay.com/oauth/api_scope/sell.account https://api.ebay.com/oauth/api_scope/sell.fulfillment.readonly https://api.ebay.com/oauth/api_scope/sell.fulfillment https://api.ebay.com/oauth/api_scope/sell.analytics.readonly https://api.ebay.com/oauth/api_scope/sell.finances https://api.ebay.com/oauth/api_scope/sell.payment.dispute https://api.ebay.com/oauth/api_scope/commerce.identity.readonly", "UTF-8")); + HttpPost request = new HttpPost("https://api.ebay.com/identity/v1/oauth2/token"); + request.setHeader("Authorization", getBase64OauthCredential()); + request.setHeader("Content-Type", "application/x-www-form-urlencoded"); + String requestBody = "grant_type=refresh_token&refresh_token=" + getAttivita().getEbayOAuthRefreshToken() + "&scope=" + + URLEncoder.encode("https://api.ebay.com/oauth/api_scope https://api.ebay.com/oauth/api_scope/sell.marketing.readonly https://api.ebay.com/oauth/api_scope/sell.marketing https://api.ebay.com/oauth/api_scope/sell.inventory.readonly https://api.ebay.com/oauth/api_scope/sell.inventory https://api.ebay.com/oauth/api_scope/sell.account.readonly https://api.ebay.com/oauth/api_scope/sell.account https://api.ebay.com/oauth/api_scope/sell.fulfillment.readonly https://api.ebay.com/oauth/api_scope/sell.fulfillment https://api.ebay.com/oauth/api_scope/sell.analytics.readonly https://api.ebay.com/oauth/api_scope/sell.finances https://api.ebay.com/oauth/api_scope/sell.payment.dispute https://api.ebay.com/oauth/api_scope/commerce.identity.readonly", "UTF-8"); + StringEntity stringEntity = new StringEntity(requestBody, "UTF-8"); + request.setEntity((HttpEntity)stringEntity); + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode == 200) { + JSONObject jo = new JSONObject(content); + getAttivita().setEbayOAuthUserToken(jo.getString("access_token")); + Calendar cal = Calendar.getInstance(); + cal.add(13, jo.getInt("expires_in")); + getAttivita().setEbayOAuthUserTokenExpire(new Timestamp(cal.getTimeInMillis())); + ResParm rp = getAttivita().save(); + resER.setOk(rp.getStatus()); + resER.setMsg(rp.getMsg()); + resER.setResult(jo); + } else { + resER.setOk(false); + JSONObject jo = new JSONObject(content); + resER.setMsg(jo.toString(2)); + resER.setResult(jo); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public EbayResult ebayGetUserAccesToken(String authorizationCode) { + EbayResult resER = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayGetUserAccesToken"); + CloseableHttpClient client = HttpClients.createDefault(); + HttpPost request = new HttpPost("https://api.ebay.com/identity/v1/oauth2/token"); + request.setHeader("Authorization", getBase64OauthCredential()); + request.setHeader("Content-Type", "application/x-www-form-urlencoded"); + String requestBody = "grant_type=authorization_code&code=" + authorizationCode + "&redirect_uri=" + getUriRuName(); + StringEntity stringEntity = new StringEntity(requestBody, "UTF-8"); + request.setEntity((HttpEntity)stringEntity); + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode == 200) { + JSONObject jo = new JSONObject(content); + getAttivita().setEbayOAuthUserToken(jo.getString("access_token")); + Calendar cal = Calendar.getInstance(); + cal.add(13, jo.getInt("expires_in")); + getAttivita().setEbayOAuthUserTokenExpire(new Timestamp(cal.getTimeInMillis())); + getAttivita().setEbayOAuthRefreshToken(jo.getString("refresh_token")); + cal = Calendar.getInstance(); + cal.add(13, jo.getInt("refresh_token_expires_in")); + getAttivita().setEbayOAuthRefreshTokenExpire(new Timestamp(cal.getTimeInMillis())); + ResParm rp = getAttivita().save(); + resER.setOk(rp.getStatus()); + resER.setMsg(rp.getMsg()); + resER.setResult(jo); + } else { + resER.setOk(false); + JSONObject jo = new JSONObject(content); + resER.setMsg(jo.toString(2)); + resER.setResult(jo); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public String getOAuthToken() { + if (getAttivita().isEbayOAuthUserTokenExpired()) { + if (getAttivita().isEbayOAuthRefreshTokenExpired()) + return ""; + EbayResult eRes = ebayRefreshUserAccesToken(); + if (eRes.isOk() && !getAttivita().isEbayOAuthUserTokenExpired()) + return getAttivita().getEbayOAuthUserToken(); + getAttivita().setEbayOAuthRefreshToken(null); + getAttivita().setEbayOAuthRefreshTokenExpire(null); + getAttivita().superSave(); + return ""; + } + return getAttivita().getEbayOAuthUserToken(); + } + + public boolean isOAuthTokenValid() { + return !getOAuthToken().isEmpty(); + } + + public EbayResult ebayGetCategorySuggestion(String l_query) { + EbayResult res = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> getEbayCategorySuggestionRest"); + CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build(); + String categoryId = "101"; + HttpGet request = new HttpGet("https://api.ebay.com/commerce/taxonomy/v1/category_tree/{category_tree_id}/get_category_suggestions?q=" + .replace("{category_tree_id}", categoryId) + "https://api.ebay.com/commerce/taxonomy/v1/category_tree/{category_tree_id}/get_category_suggestions?q=".replace("{category_tree_id}", categoryId)); + request.setHeader("Authorization", getTokenOath4GetRequest()); + request.setHeader("Accept-Encoding", "application/gzip"); + HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request); + String content = EntityUtils.toString(resp.getEntity()); + int statusCode = resp.getStatusLine().getStatusCode(); + if (statusCode == 200) { + JSONObject jo = new JSONObject(content); + JSONArray jCat = jo.getJSONArray("categorySuggestions"); + if (jCat.length() > 1) { + res.setOk(true); + res.setResult(jCat.getJSONObject(0).getJSONObject("category")); + } else { + res.setOk(false); + } + } else { + res.setMsg(content); + res.setOk(false); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + res.setMsg(e.getMessage()); + res.setOk(false); + } + return res; + } + + public EbayResult ebayCreateOrReplaceInventoryItem(Articolo bean) { + EbayResult resER = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayCreateOrReplaceInventoryItem"); + CloseableHttpClient client = HttpClients.createDefault(); + HttpPut request = new HttpPut("https://api.ebay.com/sell/inventory/v1/inventory_item/{sku}".replace("{sku}", bean.getCodice())); + request.setHeader("Authorization", getTokenOath4GetRequest()); + request.setHeader("Accept", "application/json"); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Content-Language", "it-IT"); + JSONObject item = getJsonItemByArticolo(bean); + int versione = getApFull().getParm("VEBAY").getNumeroInt(); + if (this.debug) + System.out.println("Createebay versione VEBAY " + versione); + versione = 1; + if (versione == 0) { + String rawString = item.toString(4); + byte[] bytes = StringUtils.getBytesUtf8(rawString); + String utf8EncodedString = StringUtils.newStringUtf8(bytes); + if (this.debug) + System.out.println("json ebay item v0 UTF8:\n" + utf8EncodedString); + StringEntity stringEntity = new StringEntity(utf8EncodedString); + request.setEntity((HttpEntity)stringEntity); + } else if (versione == 1) { + if (this.debug) + System.out.println("json ebay item v 1:\n" + item.toString(4)); + StringEntity stringEntity = new StringEntity(item.toString(4), "UTF-8"); + request.setEntity((HttpEntity)stringEntity); + } else if (versione == 2) { + if (this.debug) + System.out.println("json ebay item v 2:\n" + String.valueOf(item.toString(4).getBytes("UTF-8"))); + ByteArrayEntity byteArrayEntity = new ByteArrayEntity(item.toString(4).getBytes("UTF-8")); + request.setEntity((HttpEntity)byteArrayEntity); + } + int statusCode = 200; + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (statusCode == 200) { + resER.setOk(true); + resER.setMsg("Oggetto ebay aggiornato correttamente"); + if (this.debug) + System.out.println("Oggetto ebay aggiornato correttamente"); + } else if (statusCode == 201) { + resER.setOk(true); + resER.setMsg("Oggetto ebay creato correttamente"); + if (this.debug) + System.out.println("Oggetto ebay creato correttamente"); + } else if (statusCode == 204) { + resER.setOk(true); + resER.setMsg("Oggetto ebay non modificato"); + if (this.debug) + System.out.println("Oggetto ebay non modificato"); + } else { + resER.setOk(false); + System.out.println("Oggetto ebay NON CREATO/AGGIORNATO: status code: " + statusCode); + resER.setMsg("Oggetto ebay NON CREATO/AGGIORNATO: status code: " + statusCode); + } + if (resER.isOk()) { + bean.setPrezzoSuEbayIva(bean.getPrezzoArticoloEbayIva().getPrezzoFinale()); + bean.setQtaSuEbay(bean.getQtaEbayDaInviare()); + bean.superSave(); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + private JSONObject getJsonInventoryLocation(String merchantLocationKey) { + JSONObject jo = new JSONObject(); + jo.put("name", merchantLocationKey + "-location"); + jo.put("merchantLocationKey", merchantLocationKey); + jo.put("merchantLocationStatus", "ENABLED"); + String[] locationTypesARR = { "WAREHOUSE" }; + jo.put("locationTypes", locationTypesARR); + JSONObject location = new JSONObject(); + JSONObject address = new JSONObject(); + address.put("addressLine1", getAttivita().getIndirizzoAttivita() + ", " + getAttivita().getIndirizzoAttivita()); + address.put("city", getAttivita().getDescrizioneComuneAttivita()); + address.put("stateOrProvince", getAttivita().getDescrizioneProvinciaAttivita()); + address.put("postalCode", getAttivita().getCapComuneAttivita()); + address.put("country", "IT"); + location.put("address", address); + jo.put("location", location); + return jo; + } + + public EbayResult ebayGetReturnPolicy() { + EbayResult res = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayGetPaymentPolicy"); + CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build(); + HttpGet request = new HttpGet("https://api.ebay.com/sell/account/v1/return_policy?marketplace_id=EBAY_IT"); + request.setHeader("Authorization", getTokenOath4GetRequest()); + request.setHeader("Accept-Encoding", "application/gzip"); + HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request); + String content = EntityUtils.toString(resp.getEntity()); + int statusCode = resp.getStatusLine().getStatusCode(); + String defaultPolycyId = ""; + if (statusCode == 200) { + JSONObject jo = new JSONObject(content); + JSONArray joArr = jo.getJSONArray("returnPolicies"); + for (int i = 0; i < joArr.length(); i++) { + JSONObject row = joArr.getJSONObject(i); + JSONArray categoryTypes = row.getJSONArray("categoryTypes"); + if (categoryTypes.length() > 0) { + JSONObject categoryType = categoryTypes.getJSONObject(0); + if (categoryType.getBoolean("default")) { + defaultPolycyId = row.getString("returnPolicyId"); + break; + } + } + } + if (!defaultPolycyId.isEmpty()) { + res.setOk(true); + res.setResult(defaultPolycyId); + res.setMsg("Trovata returnPolicyId di default: " + defaultPolycyId); + } else { + res.setMsg("Impossibile trovare returnPolicyId di default.\nCollegati al tuo account ebay:\nimpostazioni account --> \nPreferenze account: impostazioni --> \nGestore delle regole di vendita --> \nCrea regola Restituzione"); + res.setOk(false); + } + } else { + res.setMsg(content); + res.setOk(false); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + res.setMsg(e.getMessage()); + res.setOk(false); + } + return res; + } + + public EbayResult ebayGetPaymentPolicy() { + EbayResult res = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayGetPaymentPolicy"); + CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build(); + HttpGet request = new HttpGet("https://api.ebay.com/sell/account/v1/payment_policy?marketplace_id=EBAY_IT"); + request.setHeader("Authorization", getTokenOath4GetRequest()); + request.setHeader("Accept-Encoding", "application/gzip"); + HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request); + String content = EntityUtils.toString(resp.getEntity()); + int statusCode = resp.getStatusLine().getStatusCode(); + String defaultPolycyId = ""; + if (statusCode == 200) { + JSONObject jo = new JSONObject(content); + JSONArray joArr = jo.getJSONArray("paymentPolicies"); + for (int i = 0; i < joArr.length(); i++) { + JSONObject row = joArr.getJSONObject(i); + JSONArray categoryTypes = row.getJSONArray("categoryTypes"); + if (categoryTypes.length() > 0) { + JSONObject categoryType = categoryTypes.getJSONObject(0); + if (categoryType.getBoolean("default")) { + defaultPolycyId = row.getString("paymentPolicyId"); + break; + } + } + } + if (!defaultPolycyId.isEmpty()) { + res.setOk(true); + res.setResult(defaultPolycyId); + res.setMsg("Trovata paymentPolicyId di default: " + defaultPolycyId); + } else { + res.setMsg("Impossibile trovare paymentPolicyId di default.\nCollegati al tuo account ebay:\nimpostazioni account --> \nPreferenze account: impostazioni --> \nGestore delle regole di vendita --> \nCrea regola Pagamento"); + res.setOk(false); + } + } else { + res.setMsg(content); + res.setOk(false); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + res.setMsg(e.getMessage()); + res.setOk(false); + } + return res; + } + + public EbayResult ebayGetOfferPrice(Articolo bean) { + EbayResult resER = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayGetOfferPrice"); + CloseableHttpClient client = HttpClients.createDefault(); + HttpGet request = new HttpGet("https://api.ebay.com/sell/inventory/v1/offer/{offerId}".replace("{offerId}", bean.getEbayOfferId())); + request.setHeader("Authorization", getTokenOath4GetRequest()); + request.setHeader("Accept", "application/json"); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Content-Language", "it-IT"); + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resER.setOk(false); + JSONObject jo = new JSONObject(content); + resER.setMsg(jo.toString(2)); + resER.setResult(jo); + } else { + JSONObject jo = new JSONObject(content); + try { + JSONObject price = jo.getJSONObject("pricingSummary").getJSONObject("price"); + bean.setPrezzoSuEbayIva(price.getDouble("value")); + bean.superSave(); + resER.setOk(true); + resER.setResult(jo); + } catch (Exception e) { + resER.setOk(false); + resER.setMsg(jo.toString(4)); + resER.setResult(jo); + } + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public EbayResult ebayCreateOffer(Articolo bean) { + EbayResult resER = new EbayResult(); + try { + if (this.debug) + System.out.println("AbliaEbayApi --> ebayCreateOffer"); + CloseableHttpClient client = HttpClients.createDefault(); + HttpPost request = new HttpPost("https://api.ebay.com/sell/inventory/v1/offer"); + request.setHeader("Authorization", getTokenOath4GetRequest()); + request.setHeader("Accept", "application/json"); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Content-Language", "it-IT"); + JSONObject item = getJsonOfferByArticolo(bean, true); + if (this.debug) + System.out.println("json ebay offer item v 1:\n" + item.toString(4)); + StringEntity stringEntity = new StringEntity(item.toString(4), "UTF-8"); + request.setEntity((HttpEntity)stringEntity); + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resER.setOk(false); + JSONObject jo = new JSONObject(content); + resER.setMsg(jo.toString(2)); + resER.setResult(jo); + } else { + JSONObject jo = new JSONObject(content); + String offerId = jo.getString("offerId"); + if (offerId.isEmpty()) { + resER.setOk(false); + resER.setMsg(jo.toString(4)); + resER.setResult(jo); + } else { + bean.setEbayOfferId(offerId); + bean.setPrezzoSuEbayIva(bean.getPrezzoArticoloEbayIva().getPrezzoFinale()); + bean.setQtaSuEbay(bean.getQtaEbayDaInviare()); + bean.superSave(); + resER.setOk(true); + resER.setResult(jo); + } + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayAuthNAuthToken.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayAuthNAuthToken.java new file mode 100644 index 00000000..4898c919 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayAuthNAuthToken.java @@ -0,0 +1,25 @@ +package it.acxent.api.ebay; + +import java.sql.Date; + +public class EbayAuthNAuthToken { + private String token; + + private Date expirationDate; + + public String getToken() { + return this.token; + } + + public void setToken(String token) { + this.token = token; + } + + public Date getExpirationDate() { + return this.expirationDate; + } + + public void setExpirationDate(Date expirationDate) { + this.expirationDate = expirationDate; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayOrder.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayOrder.java new file mode 100644 index 00000000..b404ec5f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayOrder.java @@ -0,0 +1,63 @@ +package it.acxent.api.ebay; + +public class EbayOrder { + private String buyerId; + + private String orderId; + + private String buyerTaxId; + + private String taxIdType; + + private double amount; + + public EbayOrder(String buyerId, String orderId, String buyerTaxId, String taxIdType, double amount) { + this.buyerId = buyerId; + this.orderId = orderId; + this.buyerTaxId = buyerTaxId; + this.taxIdType = taxIdType; + this.amount = amount; + } + + public EbayOrder() {} + + public String getBuyerId() { + return (this.buyerId == null) ? "" : this.buyerId.trim(); + } + + public void setBuyerId(String buyerId) { + this.buyerId = buyerId; + } + + public String getOrderId() { + return (this.orderId == null) ? "" : this.orderId.trim(); + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getBuyerTaxId() { + return (this.buyerTaxId == null) ? "" : this.buyerTaxId.trim(); + } + + public void setBuyerTaxId(String buyerTaxId) { + this.buyerTaxId = buyerTaxId; + } + + public String getTaxIdType() { + return (this.taxIdType == null) ? "" : this.taxIdType.trim(); + } + + public void setTaxIdType(String taxIdType) { + this.taxIdType = taxIdType; + } + + public double getAmount() { + return this.amount; + } + + public void setAmount(double amount) { + this.amount = amount; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayResult.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayResult.java new file mode 100644 index 00000000..f7f252c1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayResult.java @@ -0,0 +1,41 @@ +package it.acxent.api.ebay; + +public class EbayResult { + private String msg; + + public EbayResult(String msg, boolean status, Object result) { + this.msg = msg; + this.ok = status; + this.result = result; + } + + private boolean ok = true; + + private Object result; + + public EbayResult() {} + + public String getMsg() { + return this.msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public boolean isOk() { + return this.ok; + } + + public void setOk(boolean status) { + this.ok = status; + } + + public Object getResult() { + return this.result; + } + + public void setResult(Object result) { + this.result = result; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayTrading.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayTrading.java new file mode 100644 index 00000000..c7e2255b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/EbayTrading.java @@ -0,0 +1,68 @@ +package it.acxent.api.ebay; + +import com.ebay.sdk.ApiContext; +import com.ebay.sdk.ApiCredential; +import com.ebay.sdk.call.GetOrdersCall; +import com.ebay.soap.eBLBaseComponents.DetailLevelCodeType; +import com.ebay.soap.eBLBaseComponents.OrderType; +import com.ebay.soap.eBLBaseComponents.TaxIdentifierType; +import com.ebay.soap.eBLBaseComponents.TradingRoleCodeType; +import com.ebay.soap.eBLBaseComponents.TransactionType; +import java.io.IOException; + +public class EbayTrading { + public String getPivaCf(String token, String ordine) { + String ret = ""; + try { + System.out.print("\n"); + System.out.print("+++++++++++++++++++++++++++++++++++++++\n"); + System.out.print("+ Welcome to eBay SDK for Java Sample +\n"); + System.out.print("+ - ConsoleAddItem +\n"); + System.out.print("+++++++++++++++++++++++++++++++++++++++\n"); + System.out.print("\n"); + System.out.println("===== [1] Account Information ===="); + ApiContext apiContext = getApiContext(); + GetOrdersCall call = new GetOrdersCall(apiContext); + DetailLevelCodeType[] detailLevels = { DetailLevelCodeType.RETURN_ALL }; + call.setDetailLevel(detailLevels); + call.setOrderRole(TradingRoleCodeType.SELLER); + call.setNumberOfDays(Integer.valueOf(30)); + System.out.println("getOrders"); + OrderType[] orders = call.getOrders(); + for (OrderType order : orders) { + System.out.println(order.getBuyerUserID()); + TaxIdentifierType[] tit = order.getBuyerTaxIdentifier(); + for (int i = 0; i < tit.length; i++) { + TaxIdentifierType ti = tit[i]; + System.out.println("TaxIdentifierType"); + System.out.println("ID: " + ti.getID()); + System.out.println("Type: " + String.valueOf(ti.getType())); + System.out.println(" "); + } + TransactionType[] tp = order.getTransactionArray().getTransaction(); + for (int j = 0; j < tp.length; j++) { + TransactionType tp1 = tp[j]; + System.out.println("TransactionType"); + System.out.println("Email: " + tp1.getBuyer().getEmail()); + System.out.println("Codice Fiscale: " + tp1.getCodiceFiscale()); + System.out.println("Partita Iva: " + tp1.getBuyer().getVATID()); + System.out.println(" "); + } + System.out.println("--------------------"); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + } + return ret; + } + + private static ApiContext getApiContext() throws IOException { + String token = "AgAAAA**AQAAAA**aAAAAA**8X0lWA**nY+sHZ2PrBmdj6wVnY+sEZ2PrA2dj6AEloqgCJCLpg+dj6x9nY+seQ**s38DAA**AAMAAA**lknSsx7ror8sUli5r9aVZwFIVw/c6wznYbOjChsXzBnST1dqjWSFxdAHO3NNNlOA58OCDwWYQoyzmREXuXnPFhhxxwqn0re7ri7CzR3oHlSX9ZR1mv/CTIThDycFkD9rK9CCqzYZgpiW7SLwgQt5hPSOYuIejdVA+NL4GWl+zy413Tinu9eS5WF5XeIODQnFAuQHAKcLa7NqKg7BtohzN7l4UNxw7+Ibm7acX5MLsvqquTYNBLQuYhSsNJV2jhM8LuIotg11vMPvJx5dx6oG0f4X2KvlmEP1mF8LlgqcocYJPvc5sg+aMCRG6WKGpeXepbvsh0SWwyGQUL9Xqpwmqrk8RZU3SjgZPHlYDMHJVeJ5c+5g8gcjSk1seJzcWiH48ZGDr6ShgS95zt6wuFZ+ZqRo28I07dNWGGvdY+DAS6Orx0zmhAywjrFFnf8gcqLMIVLzsepHkJqBAno+rK/cGhaxyTAurnTpZUNeT5sv4U/S0AhgO9npRqcYENU7mmdJrTknz3BIeZJzJSWAVgIS1PlyeLAMiXGj8wJaEuX8y4PYfXAO8eOINxGd6Z4h7Ta/Iq7jhIltRR4xryUH/j1c8XpR5RIxFvcwOhE+z10JFaVr4x4pUto5SfnLh+Ig3GClEM7kRaeCSgeoe8/yhc7zLlj1AX0oViae2wbwYDJZvv77hkXeiNUCllHbsnt5Y4dI5y18z1h/a4K+gqZH+7bTLNuVUkKD4dfeoPiaqyZHlfqfmo0nVACO+S9AtghL8+NC"; + ApiContext apiContext = new ApiContext(); + ApiCredential cred = apiContext.getApiCredential(); + cred.seteBayToken(token); + apiContext.setApiServerUrl("https://api.ebay.com/wsapi"); + return apiContext; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/json/EbayOrder.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/json/EbayOrder.java new file mode 100644 index 00000000..ca58de0c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/json/EbayOrder.java @@ -0,0 +1,63 @@ +package it.acxent.api.ebay.json; + +public class EbayOrder { + private String buyerId; + + private String orderId; + + private String buyerTaxId; + + private String taxIdType; + + private double amount; + + public EbayOrder(String buyerId, String orderId, String buyerTaxId, String taxIdType, double amount) { + this.buyerId = buyerId; + this.orderId = orderId; + this.buyerTaxId = buyerTaxId; + this.taxIdType = taxIdType; + this.amount = amount; + } + + public EbayOrder() {} + + public String getBuyerId() { + return (this.buyerId == null) ? "" : this.buyerId.trim(); + } + + public void setBuyerId(String buyerId) { + this.buyerId = buyerId; + } + + public String getOrderId() { + return (this.orderId == null) ? "" : this.orderId.trim(); + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public String getBuyerTaxId() { + return (this.buyerTaxId == null) ? "" : this.buyerTaxId.trim(); + } + + public void setBuyerTaxId(String buyerTaxId) { + this.buyerTaxId = buyerTaxId; + } + + public String getTaxIdType() { + return (this.taxIdType == null) ? "" : this.taxIdType.trim(); + } + + public void setTaxIdType(String taxIdType) { + this.taxIdType = taxIdType; + } + + public double getAmount() { + return this.amount; + } + + public void setAmount(double amount) { + this.amount = amount; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/json/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/json/package-info.java new file mode 100644 index 00000000..0304075e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/json/package-info.java @@ -0,0 +1 @@ +package it.acxent.api.ebay.json; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/EbayAccessKoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/EbayAccessKoSvlt.java new file mode 100644 index 00000000..db5f717c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/EbayAccessKoSvlt.java @@ -0,0 +1,74 @@ +package it.acxent.api.ebay.servlet; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.servlet.SavedHttpRequest; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class EbayAccessKoSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return null; + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return null; + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("status", "ko"); + sendMessage(req, "Attenzione! Non è stata data l'autorizzazione all'accesso ebay. impossibile recuperare il token!"); + SavedHttpRequest shr = (SavedHttpRequest)req.getSession().getAttribute("_shr"); + shr = new SavedHttpRequest(); + shr.setCompleteRequestedURI(req.getContextPath() + "/admin/ebay/EbayAccess.abl"); + shr.setServletPath("/admin/ebay/EbayAccess.abl"); + shr.setAllParametersNAttributes(req); + if (useAlwaysSendRedirect()) + shr.setUseSendRedirect(true); + req.getSession().setAttribute("_shr", shr); + try { + res.sendRedirect(req.getContextPath() + "/admin/menu/index.jsp"); + } catch (Exception e2) { + e2.printStackTrace(); + } + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + search(req, res); + } + + protected void searchOLD(HttpServletRequest req, HttpServletResponse res) { + String error = getRequestParameter(req, "error"); + sendMessage(req, error); + setJspPageRelative("ebayRes.jsp", req); + req.setAttribute("status", "ko"); + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e2) { + e2.printStackTrace(); + } + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/EbayAccessOkSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/EbayAccessOkSvlt.java new file mode 100644 index 00000000..29ddf538 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/EbayAccessOkSvlt.java @@ -0,0 +1,114 @@ +package it.acxent.api.ebay.servlet; + +import it.acxent.api.ebay.EbayAbliaApi; +import it.acxent.api.ebay.EbayAuthNAuthToken; +import it.acxent.api.ebay.EbayResult; +import it.acxent.common.Parm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.servlet.SavedHttpRequest; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class EbayAccessOkSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return null; + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return null; + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String code = getRequestParameter(req, "code"); + String expiresIn = getRequestParameter(req, "expires_in"); + if (code.isEmpty()) { + autNAuthFetchToken(req, res); + } else { + oAuth2FetchToken(req, res); + } + SavedHttpRequest shr = (SavedHttpRequest)req.getSession().getAttribute("_shr"); + shr = new SavedHttpRequest(); + shr.setCompleteRequestedURI(req.getContextPath() + "/admin/ebay/EbayAccess.abl"); + shr.setServletPath("/admin/ebay/EbayAccess.abl"); + shr.setAllParametersNAttributes(req); + if (useAlwaysSendRedirect()) + shr.setUseSendRedirect(true); + req.getSession().setAttribute("_shr", shr); + try { + res.sendRedirect(req.getContextPath() + "/admin/menu/index.jsp"); + } catch (Exception e2) { + e2.printStackTrace(); + } + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + search(req, res); + } + + public void autNAuthFetchToken(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String username = getRequestParameter(req, "username"); + EbayAbliaApi eaa = new EbayAbliaApi(apFull); + String sessionId = (String)req.getSession().getAttribute("_EBAY_SESSION_ID"); + System.out.println("Ebay access OK: session id precedente...: " + sessionId); + EbayAuthNAuthToken fetchToken = eaa.fetchTokenSdk(sessionId); + if (fetchToken.getToken().isEmpty()) { + System.out.println("Ebay access ERRORE: token: " + fetchToken.getToken()); + req.setAttribute("status", "ko"); + sendMessage(req, "Errore! impossibile recuperare il token!"); + } else { + System.out.println("Ebay access OK: token: " + fetchToken.getToken()); + System.out.println("Ebay access OK: exp date: " + String.valueOf(fetchToken.getExpirationDate())); + Parm parm = getParm("EBAY_USER_TOKEN_PRODUCTION"); + parm.setTesto(fetchToken.getToken()); + parm.save(); + parm = getParm("EBAY_USER_TOKEN_NAME_PRODUCTION"); + parm.setTesto(username); + parm.save(); + parm = getParm("EBAY_EXPIRE_DATE_TOKEN_PRODUCTION"); + parm.setDataParm(fetchToken.getExpirationDate()); + parm.save(); + getApFull().resetCurrentApParms(); + req.setAttribute("status", "ok"); + sendMessage(req, "Rinnovato il token authNAuth per " + username + " correttamente,"); + } + } + + public void oAuth2FetchToken(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String code = getRequestParameter(req, "code"); + String expiresIn = getRequestParameter(req, "expires_in"); + System.out.println("Ebay oAuth2 access OK: code: " + code + "\nexpire: " + expiresIn); + EbayAbliaApi bean = new EbayAbliaApi(apFull); + EbayResult eRes = bean.ebayGetUserAccesToken(code); + if (!eRes.isOk()) { + System.out.println("Ebay user access token: " + eRes.getMsg()); + req.setAttribute("status", "ko"); + sendMessage(req, "Errore! impossibile recuperare il token! " + DBAdapter.convertStringToHtml(eRes.getMsg())); + } else { + System.out.println("Ebay access OK:\n" + DBAdapter.convertStringToHtml(bean.getStatus())); + req.setAttribute("status", "ok"); + sendMessage(req, "Rinnovato il token oAuth2 "); + } + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/EbayAccessSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/EbayAccessSvlt.java new file mode 100644 index 00000000..65207955 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/EbayAccessSvlt.java @@ -0,0 +1,80 @@ +package it.acxent.api.ebay.servlet; + +import it.acxent.api.ebay.EbayAbliaApi; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class EbayAccessSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return null; + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return null; + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + EbayAbliaApi eaa = new EbayAbliaApi(apFull); + req.setAttribute("eaa", eaa); + setJspPageRelative("ebay.jsp", req); + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e2) { + e2.printStackTrace(); + } + } + + public void _callEbayLogin(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + EbayAbliaApi eaa = new EbayAbliaApi(apFull); + req.setAttribute("eaa", eaa); + String sessionId = eaa.getSdkEbaySessionId(); + System.out.println("sessionid: " + sessionId); + if (sessionId.isEmpty()) { + sendMessage(req, "Errore! Impossibile trovare il sessionid..."); + sendHtmlMsgResponse(req, res, "Errore! Impossibile trovare il sessionid..."); + } else { + req.getSession().setAttribute("_EBAY_SESSION_ID", sessionId); + String requestPage = getParm("EBAY_SIGN_IN_AUTH_N_AUTH_PRODUCTION_LINK").getTesto() + getParm("EBAY_SIGN_IN_AUTH_N_AUTH_PRODUCTION_LINK").getTesto(); + try { + res.sendRedirect(requestPage); + } catch (Exception e) { + handleDebug(e); + } + } + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + search(req, res); + } + + public void _callEbayLoginO(HttpServletRequest req, HttpServletResponse res) { + String requestPage = getParm("EBAY_SIGN_IN_OAUTH_PRODUCTION_LINK").getTesto(); + try { + res.sendRedirect(requestPage); + } catch (Exception e) { + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/EbayOrdersSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/EbayOrdersSvlt.java new file mode 100644 index 00000000..5316680e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/EbayOrdersSvlt.java @@ -0,0 +1,75 @@ +package it.acxent.api.ebay.servlet; + +import it.acxent.api.ebay.EbayAbliaApi; +import it.acxent.api.ebay.EbayOrder; +import it.acxent.api.ebay.EbayResult; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.Vectumerator; +import java.util.Vector; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class EbayOrdersSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return null; + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return null; + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + EbayAbliaApi eaa = new EbayAbliaApi(apFull); + req.setAttribute("eaa", eaa); + if (getParm("EBAY_USE_SANDBOX").isTrue()) + eaa.setUseSandbox(true); + EbayResult result = eaa.getSdkEbayOrders(); + if (result.isOk()) { + Vector resV = (Vector)result.getResult(); + if (resV != null) + req.setAttribute("list", new Vectumerator(resV.elements())); + sendMessage(req, "Lettura ordini avvenuta correttamente"); + } else { + sendMessage(req, "Impossibile leggere gli ordini ebay! " + result.getMsg()); + } + forceJspPage("/admin/ebay/ebayOrderCR.jsp", req); + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + StringBuilder msg = new StringBuilder(); + if (e.getCause() != null) { + msg.append("Causa:\n"); + msg.append(e.getCause().getMessage()); + msg.append("\n"); + } + msg.append(e.getMessage()); + handleDebug(e, 2); + forceMessage(req, getJspPage(req)); + req.setAttribute("errorMsg", msg.toString()); + RequestDispatcher rd = getServletContext().getRequestDispatcher("/admin/config/error.jsp"); + try { + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception exception) {} + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/package-info.java new file mode 100644 index 00000000..e0eb2d8b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/ebay/servlet/package-info.java @@ -0,0 +1 @@ +package it.acxent.api.ebay.servlet; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/wa/WhatsappApi.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/wa/WhatsappApi.java new file mode 100644 index 00000000..afe1767e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/wa/WhatsappApi.java @@ -0,0 +1,127 @@ +package it.acxent.api.wa; + +import it.acxent.api.ApiClientResult; +import it.acxent.api._AblApiClient; +import it.acxent.cc.Attivita; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import org.apache.http.HttpEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.json.JSONObject; + +public class WhatsappApi extends _AblApiClient { + public static final String ENDPOINT_PRODUCTION = "https://graph.facebook.com/"; + + public static final String ENDPOINT_SANDBOX = "https://graph.facebook.com/"; + + public static final String API_VERSION = "v17.0/"; + + private String phoneNumberId; + + private Attivita attivita; + + private boolean debug = false; + + private static final String URI_MESSAGES = "/messages"; + + public WhatsappApi(ApplParmFull apFull, String token, String phoneNumberId) { + super(apFull); + setToken(token); + setPhoneNumberId(phoneNumberId); + setUseSandbox(false); + } + + public WhatsappApi() {} + + public static void main(String[] args) { + String hostname = "localhost"; + String db = "misericordia"; + ApplParmFull ap = new ApplParmFull(new ApplParm(17, "//" + hostname + ":3308/" + db, db, "root", "root", 1, 10, 300)); + String token = "EAA2Yp61AWZB8BOxl8nthvvLO0okR9BJXA1NNkHox9BbZCMjE0LHGXybachAz78mGCz0RvoSqox3AF7hquq71kt6JL30ETSLdFUZBmcIKxSPT9jwoGHBL6x8X7rCpGdIqVc5FFjXpaUXZALKpf8IrUIvqHgRwyH9eZC6IhmI5U0LPraLJwZA43D6ZCcUer2ZAZAZAzAIQfWNRwmIn0tBNmoElvcr5aadiwR"; + String phoneNumberId = "119770104557287"; + WhatsappApi api = new WhatsappApi(ap, token, phoneNumberId); + ApiClientResult res = api._postSendTextMsg("ciao testina di vitello"); + System.out.println(res.getMsg()); + } + + public Attivita getAttivita() { + if (this.attivita == null) + this.attivita = Attivita.getDefaultInstance(getApFull()); + return this.attivita; + } + + public String getEndpointProduction() { + return "https://graph.facebook.com/"; + } + + public String getEndpointSandbox() { + return "https://graph.facebook.com/"; + } + + public ApiClientResult _postSendTextMsg(String l_msg) { + ApiClientResult resER = new ApiClientResult(); + try { + if (this.debug) + System.out.println("WhatsappApi --> _postSendTextMsg"); + CloseableHttpClient client = HttpClients.createDefault(); + HttpPost request = new HttpPost(getEndpoint() + "v17.0//messages"); + request.setHeader("Authorization", getTokenBearer()); + request.setHeader("Accept", "application/json"); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Content-Language", "it-IT"); + JSONObject joDottori = null; + StringEntity stringEntity = new StringEntity(joDottori.toString(4), "UTF-8"); + request.setEntity((HttpEntity)stringEntity); + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resER.setOk(false); + JSONObject jo = new JSONObject(content); + resER.setMsg(jo.toString(2)); + resER.setResult(jo); + } else { + JSONObject jo = new JSONObject(content); + if (this.debug) + System.out.println(jo.toString(4)); + if (jo.has("success")) { + if (jo.getBoolean("success") == true) { + resER.setMsg(jo.getString("msg")); + resER.setOk(true); + resER.setResult(Long.valueOf(jo.getLong("id_rigaBolla"))); + } else { + resER.setMsg(jo.getString("msg")); + resER.setOk(false); + } + } else { + resER.setMsg("Errore! Risposta non corretta!"); + resER.setOk(false); + } + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public String getPhoneNumberId() { + return this.phoneNumberId; + } + + public void setPhoneNumberId(String phoneNumberId) { + this.phoneNumberId = phoneNumberId; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/wa/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/wa/package-info.java new file mode 100644 index 00000000..cdc697e0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/api/wa/package-info.java @@ -0,0 +1 @@ +package it.acxent.api.wa; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Accessorio.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Accessorio.java new file mode 100644 index 00000000..a25d4d8e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Accessorio.java @@ -0,0 +1,297 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Accessorio extends _ArtAdapter implements Serializable { + private static final long serialVersionUID = 805633752521639067L; + + private long id_accessorio; + + private long id_articoloAssociato; + + private Articolo articoloAssociato; + + private TipoAccessorio tipoAccessorioAssociato; + + private ArticoloVariante articoloVariante; + + private long id_articolo; + + private long id_articoloVariante; + + private long id_articoloVarianteAssociato; + + private Articolo articolo; + + private ArticoloVariante articoloVarianteAssociato; + + private long flgEstendiVariante; + + public Accessorio(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Accessorio() {} + + public void setId_accessorio(long newId_accessorio) { + this.id_accessorio = newId_accessorio; + setTipoAccessorioAssociato(null); + } + + public void setId_articoloAssociato(long newId_articolo) { + this.id_articoloAssociato = newId_articolo; + setArticoloAssociato(null); + } + + public long getId_articoloAssociato() { + return this.id_articoloAssociato; + } + + public void setArticoloAssociato(Articolo newArticolo) { + this.articoloAssociato = newArticolo; + } + + public Articolo getArticoloAssociato() { + this.articoloAssociato = (Articolo)getSecondaryObject(this.articoloAssociato, Articolo.class, + getId_articoloAssociato()); + return this.articoloAssociato; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(AccessorioCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ACCESSORIO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_accessorio() { + return this.id_accessorio; + } + + public TipoAccessorio getTipoAccessorioAssociato(long l_id) { + if (this.tipoAccessorioAssociato == null && getId_accessorio() != 0L) + this + .tipoAccessorioAssociato = getArticoloAssociato(l_id).getTipoAccessorio(); + return (this.tipoAccessorioAssociato == null) ? new TipoAccessorio(getApFull()) : + this.tipoAccessorioAssociato; + } + + public void setTipoAccessorioAssociato(TipoAccessorio newTipoAccessorio) { + this.tipoAccessorioAssociato = newTipoAccessorio; + } + + public Vectumerator findById_articolo(long l_id_articolo, long l_id_tipoAccessorio, long l_id_tipoAcc, long l_flgEscludiWeb, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* , B.nome from ACCESSORIO AS A, ARTICOLO AS B, TIPO_ACCESSORIO AS T"; + String s_Sql_Order = " order by B.nome"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=B.id_articolo"); + wc.addWc("((A.id_articolo=" + l_id_articolo + " and (T.flgDirezione=0 or T.flgDirezione is null or T.flgDirezione=1 )) or (id_articoloAssociato=" + l_id_articolo + " and (T.flgDirezione=0 or T.flgDirezione is null )))"); + if (l_id_tipoAccessorio > 0L) + wc.addWc("B.id_tipoAccessorio=" + l_id_tipoAccessorio); + if (l_id_tipoAcc > 0L) { + s_Sql_Find = s_Sql_Find + ", TIPO AS C"; + wc.addWc("B.id_tipo=C.id_tipo"); + wc.addWc("(B.id_tipo=" + l_id_tipoAcc + " or C.indici like'%:" + l_id_tipoAcc + ":%')"); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + Vectumerator vec = findRows(stmt, pageNumber, pageRows); + if (l_flgEscludiWeb >= 0L) { + Vectumerator res = new Vectumerator(); + while (vec.hasMoreElements()) { + Accessorio row = (Accessorio)vec.nextElement(); + System.out.println(row.getArticoloAssociato(l_id_articolo) + .getNome()); + if (row.getArticoloAssociato(l_id_articolo) + .getFlgEscludiWeb() == l_flgEscludiWeb) + res.add(row); + } + return res; + } + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findById_articoloVariante(long l_id_articoloVariante, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ACCESSORIO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("(id_articoloVariante=" + l_id_articoloVariante + " or id_articoloVarianteAssociato=" + l_id_articoloVariante + ")"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findById_articoloVarianteDisponibile(long l_id_articoloVariante, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ACCESSORIO AS A, DISPONIBILITA AS C"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articoloVarianteAssociato=C.id_articoloVarianteD"); + wc.addWc("A.id_articoloVariante=" + l_id_articoloVariante); + wc.addWc("C.quantitaD>0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDirezione(long l_id) { + if (getDBState() == 0) + return TipoAccessorio.getDirezione(99L); + if (getTipoAccessorioAssociato(l_id).getFlgDirezione() == 0L) + return getTipoAccessorioAssociato(l_id).getDirezione(); + if (l_id == getId_articolo() || l_id == + getId_articoloVariante()) + return getTipoAccessorioAssociato(l_id).getDirezione(); + if (l_id == getId_articoloAssociato() || l_id == + getId_articoloVarianteAssociato()) + return + TipoAccessorio.getDirezione( + -getTipoAccessorioAssociato(l_id).getFlgDirezione()); + return "???"; + } + + public void setArticolo(Articolo articolo) { + this.articolo = articolo; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + setArticolo(null); + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, + + getId_articoloVariante()); + return this.articoloVariante; + } + + public void setArticoloVariante(ArticoloVariante articoloVariante) { + this.articoloVariante = articoloVariante; + } + + public ArticoloVariante getArticoloVarianteAssociato() { + this.articoloVarianteAssociato = (ArticoloVariante)getSecondaryObject(this.articoloVarianteAssociato, ArticoloVariante.class, + + getId_articoloVarianteAssociato()); + return this.articoloVarianteAssociato; + } + + public void setArticoloVarianteAssociato(ArticoloVariante articoloVarianteAssociato) { + this.articoloVarianteAssociato = articoloVarianteAssociato; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + setArticoloVariante(null); + } + + public long getId_articoloVarianteAssociato() { + return this.id_articoloVarianteAssociato; + } + + public void setId_articoloVarianteAssociato(long id_articoloVarianteAssociato) { + this.id_articoloVarianteAssociato = id_articoloVarianteAssociato; + setArticoloVarianteAssociato(null); + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + getId_articolo()); + return this.articolo; + } + + public long getId_articoloAssociato(long l_id) { + if (l_id == getId_articoloAssociato()) + return getId_articolo(); + if (l_id == getId_articolo()) + return getId_articoloAssociato(); + return 0L; + } + + public void findById_articoloId_associato(long l_id_articolo, long l_id_articoloAssociato) { + String s_Sql_Find = "select A.* from ACCESSORIO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("((id_articolo=" + l_id_articolo + " and id_articoloAssociato=" + l_id_articoloAssociato + ") or(id_articolo=" + l_id_articoloAssociato + " and id_articoloAssociato=" + l_id_articolo + "))"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Articolo getArticoloAssociato(long l_id) { + if (l_id == getId_articoloAssociato()) + return getArticolo(); + if (l_id == getId_articolo()) + return getArticoloAssociato(); + return new Articolo(getApFull()); + } + + public Vectumerator findById_articoloAssociati(long l_id_articolo, boolean flgDisponibile, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ACCESSORIO AS A, TIPO_ACCESSORIO AS B"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("((A.id_articolo=" + l_id_articolo + " and (B.flgDirezione=0 or B.flgDirezione is null or B.flgDirezione=1 )) or (id_articoloAssociato=" + l_id_articolo + " and (B.flgDirezione=0 or B.flgDirezione is null )))"); + if (flgDisponibile) { + s_Sql_Find = s_Sql_Find + ", ARTICOLO AS C"; + wc.addWc("A.id_articolo=C.id_articolo or A.id_articoloAssocioato=C.id_articolo"); + wc.addWc("C.nColliArt>0"); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgEstendiVariante() { + return this.flgEstendiVariante; + } + + public void setFlgEstendiVariante(long flgEstendiVariante) { + this.flgEstendiVariante = flgEstendiVariante; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AccessorioCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AccessorioCR.java new file mode 100644 index 00000000..5df8d12c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AccessorioCR.java @@ -0,0 +1,56 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AccessorioCR extends CRAdapter { + private long id_accessorio; + + private long id_articolo; + + private long flgTipo; + + private Articolo articolo; + + public AccessorioCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AccessorioCR() {} + + public void setId_accessorio(long newId_accessorio) { + this.id_accessorio = newId_accessorio; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setFlgTipo(long newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public long getId_accessorio() { + return this.id_accessorio; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + + getId_articolo()); + return this.articolo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AllegatoArticolo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AllegatoArticolo.java new file mode 100644 index 00000000..4fd03bc9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AllegatoArticolo.java @@ -0,0 +1,168 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class AllegatoArticolo extends _ArtAdapter implements Serializable { + private long id_allegatoArticolo; + + private String nomeFile; + + private long id_articolo; + + private Articolo articolo; + + private long id_tipoAllegatoArticolo; + + private TipoAllegatoArticolo tipoAllegatoArticolo; + + private String descrizioneAllegato; + + public AllegatoArticolo(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AllegatoArticolo() {} + + public void setId_allegatoArticolo(long newId_allegato) { + this.id_allegatoArticolo = newId_allegato; + } + + public void setNomeFile(String newNomeFile) { + this.nomeFile = newNomeFile; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public long getId_allegatoArticolo() { + return this.id_allegatoArticolo; + } + + public String getNomeFile() { + return (this.nomeFile == null) ? "" : this.nomeFile; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + protected void deleteCascade() { + new File(getNomeFileCompleto()).delete(); + } + + public Vectumerator findByCR(AllegatoArticoloCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ALLEGATO_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByArticoloTipo(long l_id_articolo, long l_id_tipoAllegatoDocumento, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ALLEGATO_ARTICOLO AS A"; + String s_Sql_Order = " order by A.nomeFile"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + if (l_id_tipoAllegatoDocumento > 0L) + wc.addWc("A.id_tipoAllegatoDocumento=" + l_id_tipoAllegatoDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByArticoloNomeFile(long l_id_articolo, String l_id_nomeFile) { + String s_Sql_Find = "select A.* from ALLEGATO_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + wc.addWc("A.nomeFile='" + l_id_nomeFile + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getNomeFileCompleto() { + return getNomeFileCompleto(getArticolo().getPathAllegato()); + } + + public String getNomeFileCompleto(String l_path) { + return l_path + l_path + "_" + getId_articolo(); + } + + public long getId_tipoAllegatoArticolo() { + return this.id_tipoAllegatoArticolo; + } + + public TipoAllegatoArticolo getTipoAllegatoArticolo() { + this.tipoAllegatoArticolo = (TipoAllegatoArticolo)getSecondaryObject(this.tipoAllegatoArticolo, TipoAllegatoArticolo.class, + getId_tipoAllegatoArticolo()); + return this.tipoAllegatoArticolo; + } + + public void setId_tipoAllegatoArticolo(long newId_tipoAllegatoArticolo) { + this.id_tipoAllegatoArticolo = newId_tipoAllegatoArticolo; + setTipoAllegatoArticolo(null); + } + + public void setTipoAllegatoArticolo(TipoAllegatoArticolo newTipoAllegatoArticolo) { + this.tipoAllegatoArticolo = newTipoAllegatoArticolo; + } + + public String getNomeFileSuDisco() { + return "" + getId_articolo() + "_" + getId_articolo(); + } + + public String getDescrizioneAllegato() { + return (this.descrizioneAllegato == null) ? "" : this.descrizioneAllegato; + } + + public void setDescrizioneAllegato(String descrizioneAllegato) { + this.descrizioneAllegato = descrizioneAllegato; + } + + protected int getStringValueCase(String l_colomnName) { + return 0; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AllegatoArticoloCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AllegatoArticoloCR.java new file mode 100644 index 00000000..84d18eb5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AllegatoArticoloCR.java @@ -0,0 +1,80 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AllegatoArticoloCR extends CRAdapter { + private long id_allegato; + + private String nomeFile; + + private long id_articolo; + + private Articolo articolo; + + private long id_tipoAllegatoArticolo; + + private TipoAllegatoArticolo tipoAllegatoArticolo; + + public AllegatoArticoloCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AllegatoArticoloCR() {} + + public void setId_allegato(long newId_allegato) { + this.id_allegato = newId_allegato; + } + + public void setNomeFile(String newNomeFile) { + this.nomeFile = newNomeFile; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public long getId_allegato() { + return this.id_allegato; + } + + public String getNomeFile() { + return (this.nomeFile == null) ? "" : this.nomeFile; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + + getId_articolo()); + return this.articolo; + } + + public long getId_tipoAllegatoArticolo() { + return this.id_tipoAllegatoArticolo; + } + + public TipoAllegatoArticolo getTipoAllegatoArticolo() { + this.tipoAllegatoArticolo = (TipoAllegatoArticolo)getSecondaryObject(this.tipoAllegatoArticolo, TipoAllegatoArticolo.class, + + getId_tipoAllegatoArticolo()); + return this.tipoAllegatoArticolo; + } + + public void setId_tipoAllegatoArticolo(long newId_tipoAllegatoArticolo) { + this.id_tipoAllegatoArticolo = newId_tipoAllegatoArticolo; + setTipoAllegatoArticolo(null); + } + + public void setTipoAllegatoArticolo(TipoAllegatoArticolo newTipoAllegatoArticolo) { + this.tipoAllegatoArticolo = newTipoAllegatoArticolo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AmzFeaturedPrice.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AmzFeaturedPrice.java new file mode 100644 index 00000000..ba65178d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AmzFeaturedPrice.java @@ -0,0 +1,228 @@ +package it.acxent.art; + +import it.acxent.anag.Nazione; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class AmzFeaturedPrice extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1681244662207L; + + private long id_amzFeaturedPrice; + + private long id_articolo; + + private String lang; + + private double featuredOEPriceAmz; + + private double competingFOPriceAmz; + + private double currentFOPriceAmz; + + private double currentPriceAmz; + + private Date dataPriceAmz; + + private long flgPrezzoCompetitivoAmz; + + private long flgPrezzoCompetitivo; + + private Articolo articolo; + + public AmzFeaturedPrice(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AmzFeaturedPrice() {} + + public void setId_amzFeaturedPrice(long newId_amzFeaturedPrice) { + this.id_amzFeaturedPrice = newId_amzFeaturedPrice; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setLang(String newLang) { + this.lang = newLang; + } + + public void setFeaturedOEPriceAmz(double newFeaturedOEPriceAmz) { + this.featuredOEPriceAmz = newFeaturedOEPriceAmz; + } + + public void setCompetingFOPriceAmz(double newCompetingFOPriceAmz) { + this.competingFOPriceAmz = newCompetingFOPriceAmz; + } + + public void setCurrentFOPriceAmz(double newCurrentFOPriceAmz) { + this.currentFOPriceAmz = newCurrentFOPriceAmz; + } + + public void setCurrentPriceAmz(double newCurrentPriceAmz) { + this.currentPriceAmz = newCurrentPriceAmz; + } + + public long getId_amzFeaturedPrice() { + return this.id_amzFeaturedPrice; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang.trim(); + } + + public double getFeaturedOEPriceAmz() { + return this.featuredOEPriceAmz; + } + + public double getCompetingFOPriceAmz() { + return this.competingFOPriceAmz; + } + + public double getCurrentFOPriceAmz() { + return this.currentFOPriceAmz; + } + + public double getCurrentPriceAmz() { + return this.currentPriceAmz; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(AmzFeaturedPriceCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from AMZ_FEATURED_PRICE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByArticoloLang(Articolo articolo, String lang) { + String s_Sql_Find = "select A.* from AMZ_FEATURED_PRICE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + articolo.getId_articolo()); + wc.addWc("A.lang='" + lang + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public boolean isMyPriceBetter(double thePrice) { + Double betterPrice = Double.MAX_VALUE; + if (getFeaturedOEPriceAmz() > 0.0D) + betterPrice = getFeaturedOEPriceAmz(); + if (getCompetingFOPriceAmz() > 0.0D) + betterPrice = Math.min(betterPrice.doubleValue(), getCompetingFOPriceAmz()); + if (getCurrentFOPriceAmz() > 0.0D) + betterPrice = Math.min(betterPrice.doubleValue(), getCurrentFOPriceAmz()); + if (betterPrice == Double.MAX_VALUE) + return false; + if (thePrice <= betterPrice) + return true; + return false; + } + + public boolean isMyPriceBetter() { + return isMyPriceBetter(getCurrentPriceAmz()); + } + + public boolean isCompetitivo() { + return (getFlgPrezzoCompetitivo() == 1L); + } + + public boolean isCompetitivoAmz() { + return (getFlgPrezzoCompetitivoAmz() == 1L); + } + + public Date getDataPriceAmz() { + return this.dataPriceAmz; + } + + public void setDataPriceAmz(Date dataPriceAmz) { + this.dataPriceAmz = dataPriceAmz; + } + + public long getFlgPrezzoCompetitivoAmz() { + return this.flgPrezzoCompetitivoAmz; + } + + public void setFlgPrezzoCompetitivoAmz(long flgPrezzoCompetitivoAmz) { + this.flgPrezzoCompetitivoAmz = flgPrezzoCompetitivoAmz; + } + + public long getFlgPrezzoCompetitivo() { + return this.flgPrezzoCompetitivo; + } + + public void setFlgPrezzoCompetitivo(long flgPrezzoCompetitivo) { + this.flgPrezzoCompetitivo = flgPrezzoCompetitivo; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + setCurrentPriceAmz(getArticolo().getPrezzoArticoloAmazonSpedIva(getLang(), true, 1L)); + setFlgPrezzoCompetitivoAmz(isMyPriceBetter(getCurrentPriceAmz()) ? 1L : 0L); + DoubleOperator prezzoPubblico = new DoubleOperator(getArticolo().getPrezzoPubblicoIva()); + prezzoPubblico.setScale(2, 5); + Nazione nazione = new Nazione(getApFull()); + String l_lang = getCurrentLang(); + if (l_lang.isEmpty()) + l_lang = "it"; + nazione.findByCodice(l_lang); + prezzoPubblico.add(getArticolo().getDeliveryCost(nazione.getId_nazione())); + System.out.println("AMZFP Articolo:" + getArticolo().getCodiceEan() + " " + getCurrentPriceAmz() + " " + + getArticolo().getPrezzoArticoloAmazonSpedIva(getLang(), true, 1L) + " \n" + prezzoPubblico.getResult()); + System.out.println("AMZFP comp cpmpamz:" + isCompetitivoAmz() + " " + isCompetitivoAmz()); + setFlgPrezzoCompetitivo(isMyPriceBetter(prezzoPubblico.getResult()) ? 1L : 0L); + super.prepareSave(ps); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AmzFeaturedPriceCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AmzFeaturedPriceCR.java new file mode 100644 index 00000000..e09d40e5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/AmzFeaturedPriceCR.java @@ -0,0 +1,96 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AmzFeaturedPriceCR extends CRAdapter { + private long id_amzFeaturedPrice; + + private long id_articolo; + + private String lang; + + private double featuredOEPriceAmz; + + private double competingFOPriceAmz; + + private double currentFOPriceAmz; + + private double currentPriceAmz; + + private Articolo articolo; + + public AmzFeaturedPriceCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AmzFeaturedPriceCR() {} + + public void setId_amzFeaturedPrice(long newId_amzFeaturedPrice) { + this.id_amzFeaturedPrice = newId_amzFeaturedPrice; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setLang(String newLang) { + this.lang = newLang; + } + + public void setFeaturedOEPriceAmz(double newFeaturedOEPriceAmz) { + this.featuredOEPriceAmz = newFeaturedOEPriceAmz; + } + + public void setCompetingFOPriceAmz(double newCompetingFOPriceAmz) { + this.competingFOPriceAmz = newCompetingFOPriceAmz; + } + + public void setCurrentFOPriceAmz(double newCurrentFOPriceAmz) { + this.currentFOPriceAmz = newCurrentFOPriceAmz; + } + + public void setCurrentPriceAmz(double newCurrentPriceAmz) { + this.currentPriceAmz = newCurrentPriceAmz; + } + + public long getId_amzFeaturedPrice() { + return this.id_amzFeaturedPrice; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang.trim(); + } + + public double getFeaturedOEPriceAmz() { + return this.featuredOEPriceAmz; + } + + public double getCompetingFOPriceAmz() { + return this.competingFOPriceAmz; + } + + public double getCurrentFOPriceAmz() { + return this.currentFOPriceAmz; + } + + public double getCurrentPriceAmz() { + return this.currentPriceAmz; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + + getId_articolo()); + return this.articolo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Articolo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Articolo.java new file mode 100644 index 00000000..bbf8c73b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Articolo.java @@ -0,0 +1,14961 @@ +package it.acxent.art; + +import com.ebay.soap.eBLBaseComponents.ItemType; +import com.lowagie.text.Cell; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.HeaderFooter; +import com.lowagie.text.Image; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Phrase; +import com.lowagie.text.Rectangle; +import com.lowagie.text.Table; +import com.lowagie.text.pdf.Barcode128; +import com.lowagie.text.pdf.PdfContentByte; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfWriter; +import it.acxent.anag.Clifor; +import it.acxent.anag.DestinazioneDiversa; +import it.acxent.anag.Iva; +import it.acxent.anag.Listino; +import it.acxent.anag.ListinoArticolo; +import it.acxent.anag.MagFisico; +import it.acxent.anag.Nazione; +import it.acxent.anag.PrezzoArticolo; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.Users; +import it.acxent.api.amz.AmzResult; +import it.acxent.api.amz.AmzSellerApi; +import it.acxent.api.ebay.EbayAbliaApi; +import it.acxent.api.ebay.EbayResult; +import it.acxent.bank.consel.ConselTabfin; +import it.acxent.cart.Cart; +import it.acxent.cart.CartItemId; +import it.acxent.cart.CartItemIterface; +import it.acxent.cc.Attivita; +import it.acxent.common.DescTxtLang; +import it.acxent.common.SimboliLavaggio; +import it.acxent.common.StatusMsg; +import it.acxent.contab.Documento; +import it.acxent.contab.Movimento; +import it.acxent.contab.MovimentoCR; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.RigaDocumentoCR; +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.gtm.GoogleDataLayerBuilder; +import it.acxent.icecat.Icecat; +import it.acxent.mail.MailMessage; +import it.acxent.mail.MailProperties; +import it.acxent.tex.anag.ArticoloArticoloTessuto; +import it.acxent.util.DoubleOperator; +import it.acxent.util.FileWr; +import it.acxent.util.PdfFontFactory; +import it.acxent.util.ScaleImage; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Timer; +import it.acxent.util.Vectumerator; +import it.acxent.www.Sitemap; +import it.acxent.www.SitemapCR; +import java.awt.Color; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.FilenameFilter; +import java.io.Serializable; +import java.net.URI; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.util.Calendar; +import java.util.Deque; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.Locale; +import java.util.Map; +import java.util.Vector; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import jxl.NumberCell; +import jxl.NumberFormulaCell; +import jxl.Sheet; +import jxl.Workbook; +import jxl.format.CellFormat; +import jxl.format.Colour; +import jxl.write.Label; +import jxl.write.Number; +import jxl.write.WritableCell; +import jxl.write.WritableCellFormat; +import jxl.write.WritableFont; +import jxl.write.WritableSheet; +import jxl.write.WritableWorkbook; +import org.apache.commons.lang3.StringUtils; +import org.apache.http.HttpEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.json.JSONArray; +import org.json.JSONObject; + +public class Articolo extends _ArtAdapter implements Serializable, CartItemIterface, AddImgInterface, ArticoloInterface { + private static final long serialVersionUID = -4264913259848621568L; + + public static final String SEO_TEMPLATE_PLACEHOLDER_TAG = "#"; + + public static final long SEO_MAX_META_DESCRIPTION_LENGTH = 150L; + + public static final long SEO_MAX_LINK_LENGTH = 80L; + + public static final long SEO_MAX_TAG_H2_LENGTH = 70L; + + public static final long SEO_MAX_TAG_H1_LENGTH = 70L; + + public static final long SEO_MAX_SEO_TITLE_LENGTH = 60L; + + public static final long SEO_MAX_SEO_TITLE_WORDS = 12L; + + private static final String CC_REWRITE_COMMAND_INFO = "info"; + + private static final String CC_REWRITE_COMMAND_DETAIL_SIZE_KIT_DTK = "dtk"; + + private static final String CC_REWRITE_COMMAND_DETAIL_SIZE_DT = "dt"; + + private static final String CC_REWRITE_COMMAND_DETAIL_KIT_SIZE_KIT_BOH_DKTK = "dktk"; + + private static final String CC_REWRITE_COMMAND_ADDITEMROW = "addItemRow"; + + private static final String CC_REWRITE_COMMAND_DETAIL_D = "d"; + + private static final String ARTICOLO_IN_OFFERTA = "articolo in offerta"; + + private static final String ARTICOLO_IN_OFFERTA_CAPITAL_A = "Articolo in offerta"; + + private static final String LINK_TROVAPREZZI_RICERCA = "https://www.trovaprezzi.it/categoria.aspx?id=-1&libera=#"; + + private static final String LINK_GOOGLE_RICERCA = "https://www.google.com/search?q=#"; + + private static final String LINK_AMAZON_RICERCA_EAN = "https://www.amazon.it/s?k=#"; + + private static final String LINK_AMAZON_RICERCA_ASIN = "https://www.amazon.it/dp/#"; + + private static final String LINK_EBAY_ITEM_IT = "https://www.ebay.it/itm/"; + + public static final int RPT_COMPATTO = 0; + + public static final int RPT_ARTICOLO_VARIANTI = 1; + + public static final int RPT_ARTICOLO_VARIANTI_SERIALI = 2; + + public static final int RPT_PDF_LISTINO_NEGOZIO = 10; + + public static final int RPT_PDF_USATO = 11; + + public static final long TIPO_SCHEDA_ARTICOLO_WWW_MANUALE = 0L; + + public static final long TIPO_SCHEDA_ARTICOLO_WWW_ICECAT = 1L; + + public static final long TIPO_SCHEDA_ARTICOLO_WWW_RUNNER = 2L; + + public static final long TIPO_SCHEDA_ARTICOLO_WWW_BESTIT = 3L; + + public static final String SERIALE_NULL = null; + + public static final long FLG_PRICE_TYPE_AMZ_PREZZO_SENZA_SPED = 0L; + + public static final long FLG_PRICE_TYPE_AMZ_PREZZO_CON_SPED_PERCENTILE = 1L; + + public static final long FLG_PRICE_TYPE_AMZ_PREZZO_CON_SPED_NO_PERCENTILE = 2L; + + public static final long FLG_AMAZON_SCARTATO = 2L; + + private static final long GOOGLE_NO_0 = 0L; + + private static final long GOOGLE_FREE_LISTING_1 = 1L; + + private static final long GOOGLE_FULL_LISTING_2 = 2L; + + private static final long GOOGLE_SEARCH_ALL_3 = 3L; + + private static final int LUNGHEZZA_CODICE_10 = 10; + + public static final String NAZIONE_ID_NAZIONE_ITALIA_I = "I"; + + private static final String SU_PREVENTIVO = "Su preventivo"; + + private static final String SPECIFICHE = "specifiche"; + + public static final String DESCRIZIONE_BREVE = "descrizioneBreve"; + + private static final double EBAY_TARIFFA_FISSA_0_35 = 0.5D; + + private static final double AMAZON_TARIFFA_FISSA_0_3 = 0.3D; + + private static final double PAYPAL_TARIFFA_FISSA_0_35 = 0.35D; + + private static final String NOME_MARKETPLACE = "nomeMarketplace"; + + private static final String NOME_L = "nomeL"; + + private static final String DESCRIZIONE_TECNICA = "descrizioneTecnica"; + + private static final String DESCRIZIONE_MARKETPLACE = "descrizioneMarketplace"; + + public static final String DESCRIZIONE_COMMERCIALE = "descrizioneCommerciale"; + + public static final String SEO_TITLE = "seoTitle"; + + public static final String META_DESCRIPTION = "metaDescription"; + + private static final String XML_TAB = " "; + + private static final String XML_TAB_x_2 = " "; + + public static final int STATO_A_RICHIESTA = 1; + + public static final int STATO_FINE_SERIE = 2; + + public static final int STATO_OK = 0; + + public static final long FLG_ESCLUDI_WEB_ART_VISIBILE = 0L; + + public static final long FLG_ESCLUDI_WEB_ART_NON_VISIBILE = 1L; + + public static final long FLG_ESCLUDI_WEB_ART_SOSPESO = 2L; + + public static final long FLG_ESCLUDI_WEB_ART_DA_TIPO = -1L; + + public static final long FLGMOD_IMP_ARTICOLO_TROVATO_NON_MODIFICATO = 3L; + + public static final long FLGMOD_IMP_ARTICOLO_MODIFICATO = 2L; + + public static final long FLGMOD_IMP_ARTICOLO_NON_TROVATO = 0L; + + public static final long FLGMOD_IMP_ARTICOLO_NUOVO = 1L; + + public static final long FLGMOD_IMP_ARTICOLO_TROVATO_NON_DISPONIBILE = 4L; + + public static final long FLGMOD_IMP_ARTICOLO_CONTROLLATO = 9L; + + public static final int STATO_IMPORT_VECCHIO = 0; + + public static final int STATO_IMPORT_NUOVO = 1; + + public static final int STATO_IMPORT_NUOVO_TROVATO_ULTIMO_IMPORT = 2; + + public static final long STOCK_OFFERTE_OFFERTE = 1L; + + public static final long STOCK_OFFERTE_STOCK = 2L; + + public static final long STOCK_OFFERTE_USATO = 3L; + + public static final long STOCK_OFFERTE_NOVITA = 4L; + + public static final long STOCK_OFFERTE_OFFERTE_ATTIVE = 99L; + + public static final int ARTICOLO_DISPONIBILE = 0; + + public static final int ARTICOLO_IN_ORDINE = 1; + + public static final int ARTICOLO_NON_DISPONIBILE = 2; + + public static final long FLG_USATO_NO = 0L; + + public static final long FLG_USATO_SI_DITTA = 2L; + + public static final long FLG_USATO_SI_PRIVATO = 1L; + + public static final long FLG_USATO_IGNORA = -1L; + + public static final long FLG_USATO_SI_TUTTI = 99L; + + public static final long NOLEGGIO_NO = 0L; + + public static final long NOLEGGIO_SOLO_NOLEGGIO = 1L; + + public static final long NOLEGGIO_VENDITA_E_NOLEGGIO = 2L; + + public static final long NOLEGGIO_SEARCH_VENDITA = 10L; + + public static final long NOLEGGIO_SEARCH_NOLEGGIO = 20L; + + public static final String TF_VISIBILE_WEB_NON_VISIBILE = "N"; + + public static final String TF_VISIBILE_WEB_SOSPESO = "P"; + + public static final String TF_VISIBILE_WEB_VISIBILE = "S"; + + class ThreadAllineaEbay extends Thread { + private ApplParmFull apFull; + + private ArticoloCR CR; + + private final String TAG_THREAD_MSG = "ALLINEA EBAY "; + + public ThreadAllineaEbay(ApplParmFull apFull, ArticoloCR CR) { + this.apFull = apFull; + this.CR = CR; + if (!Articolo.this.isLocalhost() && + !Articolo.isThreadAllineaArticoloEbay()) { + Articolo.threadAllineaArticoloEbay = true; + start(); + } + } + + public void run() { + boolean debug = false; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "ALLINEA EBAY ", "...inizio ..."); + StringBuilder err = new StringBuilder(); + ResParm rp = new ResParm(true); + Articolo articolo = new Articolo(this.apFull); + boolean isLocale = articolo.isLocalhost(); + this.CR.setFlgEbayPubblicato(1L); + Vectumerator vec = articolo.findByCR(this.CR, 0, 0); + Vectumerator vecRes = new Vectumerator(); + int i = 0, daAggiornare = 0, changed = 0; + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + i++; + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "ALLINEA EBAY ", "articolo " + i + " su " + + vec.getTotNumberOfRecords() + ": " + changed + " aggiornati su " + daAggiornare); + if (!row.isEbayPrezzoQtaAllineati()) { + if (debug) + System.out.println("AllineEbay: articolo codice " + row.getCodice() + " " + row.getNome()); + daAggiornare++; + StringBuilder beanNote = new StringBuilder(Articolo.this.getNf().format(row.getPrezzoSuEbayIva())); + beanNote.append(" q."); + beanNote.append(String.valueOf(row.getQtaSuEbay())); + if (!isLocale) { + rp = row.ebayPublishUpdate(); + if (rp.getStatus()) { + changed++; + beanNote.append("\nupdated"); + } else { + rp = row.ebayDeleteInventoryItem(); + if (rp.getStatus()) + rp = row.ebayPublishFull(); + if (rp.getStatus()) { + changed++; + beanNote.append("\nrepublish"); + } else { + beanNote.append("\nErr.: "); + beanNote.append(rp.getMsg()); + err.append(row.getCodice() + " " + row.getCodice() + ": " + row.getNome()); + } + } + } + row.setBeanNotes(beanNote.toString()); + vecRes.add(row); + } + } + timer.stop(); + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "ALLINEA EBAY ", "Aggiornamento concluso. DURATA: " + + timer.getDurataHourMin() + "\n" + err.toString()); + System.out.println("###### THREAD ALLINEA EBAY CONCLUSO #####"); + System.out.println("Aggiornamento concluso. DURATA: " + timer.getDurataHourMin()); + System.out.println("Tot record: " + vec.getTotNumberOfRecords() + ": " + changed + " aggiornati su " + daAggiornare); + System.out.println(err.toString()); + System.out.println("############################################"); + StringBuilder msg = new StringBuilder("DURATA: " + timer.getDurataHourMin()); + msg.append("\n"); + msg.append("Tot record: "); + msg.append(vec.getTotNumberOfRecords()); + msg.append(": "); + msg.append(changed); + msg.append(" aggiornati su "); + msg.append(daAggiornare); + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "ALLINEA EBAY ", "Aggiornamento concluso. Invio email risultato in corso..... "); + Articolo.this.sendEbayUpdateResultByEmail(this.apFull, vecRes, msg.toString()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(Articolo.this.getApFull(), "ALLINEA EBAY "); + Articolo.threadAllineaArticoloEbay = false; + System.out.println(rp.getMsg()); + } + } + + class ThreadCancellazioneMassiva extends Thread { + private ApplParmFull apFull; + + private ArticoloCR CR; + + private final String TAG_THREAD_MSG = "CANCELLAZIONE ARTICOLI "; + + public ThreadCancellazioneMassiva(ApplParmFull apFull, ArticoloCR CR) { + this.apFull = apFull; + this.CR = CR; + if (!Articolo.isThreadCancellazione()) { + Articolo.threadCancellazione = true; + start(); + } + } + + public void run() { + boolean debug = false; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "CANCELLAZIONE ARTICOLI ", "...inizio ..."); + StringBuilder err = new StringBuilder(); + ResParm rp = new ResParm(true); + Articolo articolo = new Articolo(this.apFull); + boolean isLocale = articolo.isLocalhost(); + Vectumerator vec = articolo.findByCR(this.CR, 0, 0); + int i = 0, NONCancellati = 0, cancellati = 0, rimossiDaEbay = 0, visibiliNonCancellati = 0; + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + rp.setStatus(true); + i++; + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "CANCELLAZIONE ARTICOLI ", "articolo " + i + " su " + + vec.getTotNumberOfRecords() + "- Cancellati: " + cancellati + " - rimossi da ebay:" + rimossiDaEbay + " - Non cancellati: " + NONCancellati + " - Visibili NON Cancellati: " + visibiliNonCancellati); + if (debug) + System.out.println("Cancellazione massiva: articolo codice " + row.getCodice() + " " + row.getNome()); + if (row.getFlgEscludiWeb() == 0L) { + visibiliNonCancellati++; + continue; + } + if (row.isEbayPubblicato()) { + if (!isLocale) + rp = row.ebayDeleteInventoryItem(); + if (rp.getStatus()) + rimossiDaEbay++; + } + if (rp.getStatus()) + rp = row.delete(); + if (rp.getStatus()) { + cancellati++; + continue; + } + NONCancellati++; + } + timer.stop(); + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "CANCELLAZIONE ARTICOLI ", "Aggiornamento concluso. DURATA: " + + timer.getDurataHourMin() + "\n" + err.toString()); + System.out.println("###### THREAD CANCELLAZIONE MASSIVA CONCLUSO #####"); + System.out.println("Aggiornamento concluso. DURATA: " + timer.getDurataHourMin()); + System.out.println("Tot record: " + vec.getTotNumberOfRecords() + "- cancellati: " + cancellati + " NON cancellati: " + NONCancellati + " visibili NON Cancellati: " + visibiliNonCancellati); + System.out.println(err.toString()); + System.out.println("############################################"); + StringBuilder msg = new StringBuilder("DURATA: " + timer.getDurataHourMin()); + msg.append("\n"); + msg.append("Tot record: "); + msg.append(vec.getTotNumberOfRecords()); + msg.append(" - cancellati: "); + msg.append(cancellati); + msg.append(" - rimossi da ebay: "); + msg.append(rimossiDaEbay); + msg.append(" - non cancellati: "); + msg.append(NONCancellati); + msg.append(" - Visibili non cancellati: "); + msg.append(visibiliNonCancellati); + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "CANCELLAZIONE ARTICOLI ", "Cancellazione conclusa. " + msg.toString()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(Articolo.this.getApFull(), "CANCELLAZIONE ARTICOLI "); + Articolo.threadCancellazione = false; + System.out.println(rp.getMsg()); + } + } + + class ThreadIcecatAuto extends Thread { + private ApplParmFull apFull; + + private ArticoloCR CR; + + private final String TAG_THREAD_MSG = "ICECAT AUTO "; + + public ThreadIcecatAuto(ApplParmFull apFull, ArticoloCR CR) { + this.apFull = apFull; + this.CR = CR; + if (!Articolo.isThreadIcecatAuto()) { + Articolo.threadIcecatAuto = true; + start(); + } + } + + public void run() { + boolean debug = false; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "ICECAT AUTO ", "...inizio ..."); + StringBuilder err = new StringBuilder(); + StringBuilder sb = new StringBuilder(); + ResParm rp = new ResParm(true); + Articolo articolo = new Articolo(this.apFull); + sb.append(""); + } + return sb.toString(); + } + + public static final String getMovimentoHtmlDesc(TipologiaArticolo tipologiaArticolo, double q, double nr, double kg, double mt, double quantitaInArrivo, double quantitaImpegnata, double quantitaEffettiva, boolean usaMagazzino, boolean usaMagazzinoSuArticoli, NumberFormat nf) { + StringBuilder sb = new StringBuilder(); + if (!usaMagazzino) { + sb.append("No magazzino"); + } else if (!usaMagazzinoSuArticoli) { + sb.append(" "); + if (tipologiaArticolo.getFlgNr() == 1L && + tipologiaArticolo.getFlgUdm() == 1L && nr < 0.0D) { + sb.append("n "); + sb.append(nf.format(nr)); + } + if (tipologiaArticolo.getFlgMt() == 1L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("mt "); + sb.append(nf.format(mt)); + } + if (tipologiaArticolo.getFlgKg() == 1L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("kg "); + sb.append(nf.format(kg)); + } + sb.append(""); + sb.append(" + "); + sb.append(" "); + sb.append(nf.format(quantitaInArrivo)); + sb.append(""); + sb.append(" - "); + sb.append(" "); + sb.append(nf.format(quantitaImpegnata)); + sb.append(""); + sb.append(" = "); + sb.append(tipologiaArticolo.getUdm()); + sb.append(" "); + sb.append(nf.format(quantitaEffettiva)); + sb.append(""); + } else { + DoubleOperator dp = new DoubleOperator(q); + dp.subtract(quantitaImpegnata); + sb.append(tipologiaArticolo.getUdm()); + sb.append(" "); + if (q < 0.0D) { + sb.append(" "); + sb.append(nf.format(q)); + sb.append(""); + } else { + sb.append(nf.format(q)); + } + sb.append(" - "); + sb.append(" "); + sb.append(nf.format(quantitaImpegnata)); + sb.append(""); + sb.append(" = "); + sb.append(" "); + sb.append(nf.format(dp.getResult())); + sb.append(""); + } + return sb.toString(); + } + + public String getCodiciMagazzino() { + return (this.codiciMagazzino == null) ? "" : this.codiciMagazzino.trim(); + } + + public void setCodiciMagazzino(String codiciMagazzino) { + this.codiciMagazzino = codiciMagazzino; + } + + public boolean isTessutoPrincipale(long l_id_articoloTessuto, long l_id_articoloTessutoColore) { + ArticoloArticoloTessuto aat = new ArticoloArticoloTessuto(getApFull()); + aat.findByArticoloVarianteArticoloTessutoColore(getId_articoloVariante(), l_id_articoloTessuto, l_id_articoloTessutoColore); + if (aat.getFlgPrincipale() == 1L) + return true; + return false; + } + + public Vectumerator findWebByArticoloVarianteCR(ArticoloCR CR, int pageNumber, int pageRows) { + String occurrenceFind, orderBy, s_Sql_Order; + if (getParm("B2B").isTrue() && CR.getId_clifor() == 0L) + return AB_EMPTY_VECTUMERATOR; + String occurrence = findWebByArticoloCRCreateSmartSearchOccurrence(CR.getSearchTxtWeb().toLowerCase(), "B.descrizioneSearchAv"); + if (!occurrence.isEmpty()) { + occurrenceFind = occurrence + ", "; + } else { + occurrenceFind = ""; + } + StringBuffer s_Sql_Find = new StringBuffer("select " + occurrenceFind + " A.* from ARTICOLO AS A left join ARTICOLO_VARIANTE AS B ON A.id_articolo=B.id_articolo left JOIN TIPO AS C2 ON A.id_tipo2=C2.id_tipo inner join TIPO AS C on C.id_tipo=A.id_tipo"); + if (occurrence.isEmpty()) { + orderBy = " order by "; + } else { + orderBy = " order by occorrenze desc,"; + } + if (CR.getFlgOrderBy() == 6L) { + s_Sql_Order = orderBy + "B.createTmst desc, A.ordine desc, C.ordine, A.id_articolo"; + } else { + s_Sql_Order = orderBy + " A.ordine desc, C.ordine, A.id_articolo"; + } + WcString wc = new WcString(); + findWebByArticoloVarianteCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizioneCaratteristiche() { + if (getId_articolo() == 0L) + return ""; + if (this.descrizioneCaratteristiche == null) { + StringBuilder sb = new StringBuilder(); + Vectumerator vec = getCaratteristicheArticolo(); + while (vec.hasMoreElements()) { + CaratteristicaArticolo row = (CaratteristicaArticolo)vec.nextElement(); + sb.append(row.getCaratteristica().getDescrizione()); + sb.append(" - "); + sb.append(row.getVal()); + if (vec.hasMoreElements()) + sb.append("\n"); + } + this.descrizioneCaratteristiche = sb.toString(); + } + return (this.descrizioneCaratteristiche == null) ? "" : this.descrizioneCaratteristiche.trim(); + } + + public void setDescrizioneCaratteristiche(String descrizioneCaratteristiche) { + this.descrizioneCaratteristiche = descrizioneCaratteristiche; + } + + public String getNotaArticolo() { + return (this.notaArticolo == null) ? "" : this.notaArticolo.trim(); + } + + public String getNoteTessutiBase(String lang) { + if (getId_articolo() == 0L) + return ""; + StringBuilder sb = new StringBuilder(); + Vectumerator vec = findArticoliTessuto(); + while (vec.hasMoreElements()) { + ArticoloArticoloTessuto row = (ArticoloArticoloTessuto)vec.nextElement(); + if (!row.getArticoloTessuto().getNotaTessuto().isEmpty()) { + sb.append(row.getArticoloTessuto().getDescrizioneCompleta(lang)); + sb.append(": "); + sb.append(row.getArticoloTessuto().getNotaTessuto()); + if (vec.hasMoreElements()) + sb.append("\n"); + } + } + return sb.toString(); + } + + public String getNoteTessutiBaseHtml(String lang) { + return DBAdapter.convertStringToHtml(getNoteTessutiBase(lang), true); + } + + public void setNotaArticolo(String notaArticolo) { + this.notaArticolo = notaArticolo; + } + + public long getMmConsumoByArticoloTessuto(long l_id_articoloTessuto) { + if (getId_articolo() == 0L) + return 0L; + ArticoloArticoloTessuto aat = new ArticoloArticoloTessuto(getApFull()); + aat.findByArticoloArticoloTessutoBase(getId_articolo(), l_id_articoloTessuto); + return aat.getMmATT(); + } + + public String getCodiceEan() { + return (this.codiceEan == null) ? "" : this.codiceEan.trim(); + } + + public String getCodiceEanNoZero() { + return StringUtils.stripStart(getCodiceEan(), "0"); + } + + public Date getDataUltimoCosto() { + return this.dataUltimoCosto; + } + + public String getDescrizioneGoogle() { + return (this.descrizioneGoogle == null) ? "" : this.descrizioneGoogle.trim(); + } + + public long getFlgEbay() { + return this.flgEbay; + } + + public long getFlgGoogle() { + return this.flgGoogle; + } + + public long getFlgNoleggio() { + return this.flgNoleggio; + } + + public long getFlgUsato() { + return this.flgUsato; + } + + public String getNMatricola() { + return (this.nMatricola == null) ? "" : this.nMatricola; + } + + public double getPercRicarico() { + if (this.percRicarico == 0.0D) + return getParm("PERC_RICARICO_DEFAULT").getNumero(); + return this.percRicarico; + } + + public double getPrezzoIvatoBarrato() { + return this.prezzoIvatoBarrato; + } + + public double getPrezzoIvatoBarrato(Users user) { + if (user.getId_clifor() == 0L) + return this.prezzoIvatoBarrato; + if (user.getClifor().isPrezzoWebEsente()) + return scorporaIva(this.prezzoIvatoBarrato, (double)getIva().getAliquota()); + return this.prezzoIvatoBarrato; + } + + public double getPercScontoRispettoAlPrezzoBarrato() { + if (getPrezzoIvatoBarrato() == 0.0D) + return 0.0D; + DoubleOperator dop = new DoubleOperator(getPriceWVat()); + dop.setScale(2, 5); + dop.divide(getPrezzoIvatoBarrato()); + dop.multiply(100); + dop.subtract(100); + return dop.getResult(); + } + + public double getPrezzoNettoBarrato() { + return this.prezzoNettoBarrato; + } + + public boolean isArticoloNoleggio() { + if (getFlgNoleggio() == 1L || getFlgNoleggio() == 2L) + return true; + return false; + } + + public boolean isEbayGiacenza0() { + if (getId_articolo() == 0L) + return false; + if (getFlgEbay() > 0L && getQuantita() <= 0.0D) + return true; + return false; + } + + public boolean isSuperGaranzia() { + if (getFlgSuperGaranzia() == 0L) + return false; + if (getFlgNoleggio() > 0L) + return false; + if (getFlgStockOfferte() == 3L || getFlgStockOfferte() == 2L) + return false; + return true; + } + + public void setCodiceEan(String codiceEan) { + this.codiceEan = codiceEan; + } + + public void setDataUltimoCosto(Date dataUltimoCosto) { + this.dataUltimoCosto = dataUltimoCosto; + } + + public void setDescrizioneGoogle(String descrizioneGoogle) { + this.descrizioneGoogle = descrizioneGoogle; + } + + public void setFlgEbay(long flgEbay) { + this.flgEbay = flgEbay; + } + + public void setFlgGoogle(long flgGoogle) { + this.flgGoogle = flgGoogle; + } + + public void setFlgNoleggio(long flgNoleggio) { + this.flgNoleggio = flgNoleggio; + } + + public void setFlgUsato(long flgUsato) { + this.flgUsato = flgUsato; + } + + public void setNMatricola(String matricola) { + this.nMatricola = matricola; + } + + public void setPercRicarico(double percRicarico) { + this.percRicarico = percRicarico; + } + + public void setPrezzoIvatoBarrato(double prezzoIvatoBarrato) { + this.prezzoIvatoBarrato = prezzoIvatoBarrato; + } + + public void setPrezzoNettoBarrato(double prezzoNettoBarrato) { + this.prezzoNettoBarrato = prezzoNettoBarrato; + } + + public void setPrezzoNoleggio(double prezzoNoleggio) { + this.prezzoNoleggio = prezzoNoleggio; + } + + public double getPrezzoNoleggio() { + return this.prezzoNoleggio; + } + + public long getFlgSuperGaranzia() { + return this.flgSuperGaranzia; + } + + public void setFlgSuperGaranzia(long flgSuperGaranzia) { + this.flgSuperGaranzia = flgSuperGaranzia; + } + + public double getCostoNuovo() { + return this.costoNuovo; + } + + public void setCostoNuovo(double costoNuovo) { + this.costoNuovo = costoNuovo; + } + + public long getFlgStatoImport() { + return this.flgStatoImport; + } + + public void setFlgStatoImport(long flgStatoImport) { + this.flgStatoImport = flgStatoImport; + } + + public double getPrezzoNoleggioIva() { + long l_id_ivaV = getCodiceIvaVendStd(); + Iva iva = new Iva(getApFull()); + iva.findByPrimaryKey(l_id_ivaV); + DoubleOperator temp = new DoubleOperator((float)iva.getAliquota()); + temp.setScale(2, 5); + temp.divide(100.0F); + temp.add(1); + DoubleOperator temp2 = new DoubleOperator(getPrezzoNoleggio()); + temp2.setScale(2, 5); + temp2.multiply(temp); + return temp2.getResult(); + } + + public double getCostoTessutoCalc() { + if (getId_articolo() == 0L) + return 0.0D; + Vectumerator vec = findArticoliTessuto(); + DoubleOperator tot = new DoubleOperator(); + tot.setScale(4, 5); + while (vec.hasMoreElements()) { + ArticoloArticoloTessuto row = (ArticoloArticoloTessuto)vec.nextElement(); + DoubleOperator temp = new DoubleOperator(row.getArticoloTessuto().getUltimoPrezzoAcquisto()); + temp.setScale(4, 5); + temp.multiply(row.getMmATT()); + temp.divide(1000.0F); + tot.add(temp); + } + return tot.getResult(); + } + + public double getCostoNettoDb() { + return this.costoNettoDb; + } + + public void setCostoNetto(double newCostoNetto) { + this.costoNetto = newCostoNetto; + } + + public void setCostoNettoDb(double costoNettoDb) { + this.costoNettoDb = costoNettoDb; + } + + public static final String getStockOfferte(long l_flgStockOfferte) { + if (l_flgStockOfferte == 2L) + return "Stock"; + if (l_flgStockOfferte == 1L) + return "Offerta"; + if (l_flgStockOfferte == 3L) + return "Usato"; + if (l_flgStockOfferte == 4L) + return "Novita'"; + if (l_flgStockOfferte == 99L) + return "Offerte Attive"; + if (l_flgStockOfferte == 0L) + return ""; + return "??"; + } + + public double getCostoManodopera() { + return this.costoManodopera; + } + + public void setCostoManodopera(double costoManodopera) { + this.costoManodopera = costoManodopera; + } + + public double getCostoStiro() { + if (this.costoStiro == 0.0D) + return getParm("COSTO_STIRO_DEFAULT").getNumero(); + return this.costoStiro; + } + + public void setCostoStiro(double costoStiro) { + this.costoStiro = costoStiro; + } + + public double getCostoSpeseFisse() { + if (this.costoSpeseFisse == 0.0D) + return getParm("COSTO_SPESE_FISSE_DEFAULT").getNumero(); + return this.costoSpeseFisse; + } + + public void setCostoSpeseFisse(double costoSpeseFisse) { + this.costoSpeseFisse = costoSpeseFisse; + } + + public double getCostoAccessori() { + return this.costoAccessori; + } + + public void setCostoAccessori(double costoAccessori) { + this.costoAccessori = costoAccessori; + } + + public double getCostoNetto() { + return this.costoNetto; + } + + public void setTotCostoConfezione(double totCostoConfezione) { + this.totCostoConfezione = totCostoConfezione; + } + + public double getTotCostoConfezione() { + if (this.totCostoConfezione == -1.0D) { + DoubleOperator dop = new DoubleOperator(); + dop.setScale(4, 5); + dop.add(getCostoAccessori()); + dop.add(getCostoStiro()); + dop.add(getCostoSpeseFisse()); + dop.add(getCostoManodopera()); + dop.add(getCostoTessutoCalc()); + this.totCostoConfezione = dop.getResult(); + } + return this.totCostoConfezione; + } + + public String getKit() { + return getKit(getFlgKit()); + } + + public long getFlgKit() { + return this.flgKit; + } + + public void setFlgKit(long flgKit) { + this.flgKit = flgKit; + } + + public static final String getKit(long l_flgKit) { + return Tipo.getKit(l_flgKit); + } + + public long getFlgKitArt() { + return this.flgKitArt; + } + + public void setFlgKitArt(long flgKitArt) { + this.flgKitArt = flgKitArt; + } + + public String getKitArt() { + return getKit(getFlgKit()); + } + + public boolean isInVendita() { + if (getFlgWebNoVendita() == 0L) + return true; + return false; + } + + public boolean isArticoloAcquistabile() { + if (getFlgWebNoVendita() != 0L) + return false; + if (getFlgEscludiWeb() != 0L) + return false; + if (!getTipo().isArticoloAcquistabile()) + return false; + if ((getDispoLevel() > 0 || !isCheckAvail()) && getPrezzoPubblico() > 0.0D) + return true; + return false; + } + + public double getPrezzoPubblicoArticoloVarianteMaxByCR(ArticoloCR CR) { + StringBuffer s_Sql_Find = new StringBuffer("select max(prezzoPubblico) as _max from ARTICOLO AS A left join ARTICOLO_VARIANTE AS B ON A.id_articolo=B.id_articolo inner JOIN TIPO AS C2 ON A.id_tipo2=C2.id_tipo inner join TIPO AS C on C.id_tipo=A.id_tipo "); + if (!CR.getSearchTxtWeb().isEmpty() && !CR.getSearchTxtWeb().equals("*")) + s_Sql_Find = new StringBuffer("select max(prezzoPubblico) as _max from ARTICOLO as A left join ARTICOLO_VARIANTE AS B ON A.id_articolo=B.id_articolo inner join DESC_TXT_LANG AS X ON A.id_articolo=X.idTabella LEFT JOIN TIPO AS C2 ON A.id_tipo2=C2.id_tipo inner join TIPO AS C on C.id_tipo=A.id_tipo"); + try { + WcString wc = new WcString(); + ArticoloCR CR2 = CR.getClone(); + CR2.setPrezzoA(0.0D); + CR2.setPrezzoDa(0.0D); + CR2.setFlgNoleggio(10L); + findWebByArticoloVarianteCRCreateWC(CR2, s_Sql_Find, wc); + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + return getMax(stmt); + } catch (SQLException|CloneNotSupportedException e) { + handleDebug(e); + return 0.0D; + } + } + + public double getPrezzoPubblicoIvaArticoloVarianteMaxByCR(ArticoloCR CR) { + return conIva(getPrezzoPubblicoArticoloVarianteMaxByCR(CR), (double)getId_iva()); + } + + public double getPrezzoPubblicoIvaArticoloVarianteMinByCR(ArticoloCR CR) { + return conIva(getPrezzoPubblicoArticoloVarianteMinByCR(CR), (double)getId_iva()); + } + + public double getPrezzoPubblicoArticoloMaxByCR(ArticoloCR CR) { + String occurrenceFind; + StringBuilder sb = new StringBuilder(); + boolean debug = false; + Timer timer = new Timer(); + if (debug) { + timer.start(); + sb.append(">>>>>>>>>>>>>>>>>>>>>>\nPREZZO MAX findWebByArticoloCR: "); + java.util.Date d = new java.util.Date(System.currentTimeMillis()); + sb.append(getApFull().getReqUrl()); + sb.append("\n"); + sb.append(d.toString()); + sb.append(" ip: "); + sb.append(getApFull().getReqIpAddress()); + } + String occurrence = findWebByArticoloCRCreateSmartSearchOccurrence(CR.getSearchTxtWeb().toLowerCase(), "A.descrizioneSearch"); + if (!occurrence.isEmpty()) { + occurrenceFind = occurrence + ", "; + } else { + occurrenceFind = ""; + } + StringBuffer s_Sql_Find = new StringBuffer("select " + occurrenceFind + " max(prezzoPubblicoIvaOrd) as _max from ARTICOLO AS A inner join TIPO AS C on C.id_tipo=A.id_tipo "); + try { + WcString wc = new WcString(); + ArticoloCR CR2 = CR.getClone(); + CR2.setPrezzoA(0.0D); + CR2.setPrezzoDa(0.0D); + CR2.setFlgNoleggio(10L); + findWebByArticoloCRCreateWC(CR2, s_Sql_Find, wc); + if (debug) { + sb.append("\n"); + sb.append(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + } + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + double res = getMax(stmt); + if (debug) { + timer.stop(); + sb.append("\nDurata query: ms "); + sb.append(timer.getDurataMilliSec()); + sb.append("\n"); + sb.append("\n<<<<<<<<<<<<"); + System.out.println(sb.toString()); + } + return res; + } catch (SQLException|CloneNotSupportedException e) { + handleDebug(e); + return 0.0D; + } + } + + public double getPrezzoPubblicoArticoloVarianteMinByCR(ArticoloCR CR) { + StringBuffer s_Sql_Find = new StringBuffer("select min(prezzoPubblico) as _max from ARTICOLO AS A left join ARTICOLO_VARIANTE AS B ON A.id_articolo=B.id_articolo inner JOIN TIPO AS C2 ON A.id_tipo2=C2.id_tipo inner join TIPO AS C on C.id_tipo=A.id_tipo "); + if (!CR.getSearchTxtWeb().isEmpty() && !CR.getSearchTxtWeb().equals("*")) + s_Sql_Find = new StringBuffer("select min(prezzoPubblico) as _max from ARTICOLO as A left join ARTICOLO_VARIANTE AS B ON A.id_articolo=B.id_articolo inner join DESC_TXT_LANG AS X ON A.id_articolo=X.idTabella LEFT JOIN TIPO AS C2 ON A.id_tipo2=C2.id_tipo inner join TIPO AS C on C.id_tipo=A.id_tipo"); + try { + WcString wc = new WcString(); + ArticoloCR CR2 = CR.getClone(); + CR2.setPrezzoA(0.0D); + CR2.setPrezzoDa(0.0D); + CR2.setFlgNoleggio(10L); + findWebByArticoloVarianteCRCreateWC(CR2, s_Sql_Find, wc); + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + return getMax(stmt); + } catch (SQLException|CloneNotSupportedException e) { + handleDebug(e); + return 0.0D; + } + } + + public double getPrezzoPubblicoIvaArticoloMaxByCR(ArticoloCR CR) { + return conIva(getPrezzoPubblicoArticoloMaxByCR(CR), (double)getId_iva()); + } + + public double getPrezzoPubblicoIvaArticoloMinByCR(ArticoloCR CR) { + return conIva(getPrezzoPubblicoArticoloMinByCR(CR), (double)getId_iva()); + } + + protected void findWebByArticoloVarianteCRCreateWC(ArticoloCR CR, StringBuffer s_Sql_Find, WcString wc) { + boolean smartSearch = false; + if (!CR.getSearchTxtWeb().isEmpty() && !CR.getSearchTxtWeb().equals("*")) + if (!CR.getSearchTxtWeb().startsWith("#")) { + String temp = findByCRCreateSmartSearchWC(CR.getSearchTxtWeb().toLowerCase(), "B.descrizioneSearchAv"); + if (!temp.isEmpty()) + wc.addWc(temp); + smartSearch = true; + } + if (CR.getFlgEscludiWeb() == 0L) + wc.addWc("(A.flgEscludiWeb=0)"); + if (CR.getFlgNascondi() == 0L) { + wc.addWc("(A.flgNascondi=0 or A.flgNascondi is null)"); + wc.addWc("(B.flgNascondi=0 or B.flgNascondi is null)"); + wc.addWc("(C.flgNascondi=0 or C.flgNascondi is null)"); + } else if (CR.getFlgNascondi() > 0L) { + wc.addWc("A.flgNascondi=" + CR.getFlgNascondi()); + wc.addWc("B.flgNascondi=" + CR.getFlgNascondi()); + wc.addWc("C.flgNascondi=" + CR.getFlgNascondi()); + } + if (!CR.getFlgDisponibilita().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getFlgDisponibilita(), ","); + StringBuilder cli = new StringBuilder("("); + while (st.hasMoreTokens()) { + long token = Long.parseLong(st.nextToken()); + if (token == 1L) { + wc.addWc("A.flgNoleggio>0"); + continue; + } + if (token == 1L) + wc.addWc("A.quantita>0"); + } + } + if (CR.getFlgNoleggio() == 10L) + wc.addWc("A.flgNoleggio!=1"); + if (!CR.getCarId_listaS().isEmpty()) { + boolean needOr = false; + StringTokenizer st = new StringTokenizer(CR.getCarId_listaS(), ","); + StringBuilder cli = new StringBuilder("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + if (!token.isEmpty() && !token.equals("0")) { + if (token.startsWith("c")) { + if (st.hasMoreTokens()) { + cli.append(") and ( "); + needOr = false; + } + continue; + } + if (needOr) + cli.append(" or "); + cli.append("A.caratteristicheListeId like '%," + token + ",%'"); + needOr = true; + } + } + cli.append(")"); + if (cli.length() > 2) + wc.addWc(cli.toString()); + } + if (!smartSearch) { + if (CR.getId_tipoSel() != 0L) + wc.addWc("(A.id_tipo=" + CR.getId_tipoSel() + " or C.indici like'%:" + CR.getId_tipoSel() + ":%'or A.id_tipo2=" + + CR.getId_tipoSel() + " or C2.indici like'%:" + CR.getId_tipoSel() + ":%')"); + if (CR.getPrezzoDa() > 0.0D) + wc.addWc("A.prezzoPubblicoIva>=" + CR.getPrezzoDa()); + if (CR.getPrezzoA() > 0.0D) + wc.addWc("A.prezzoPubblicoIva<=" + CR.getPrezzoA()); + } + if (getParm("B2B").isTrue() && + CR.getId_clifor() > 0L) + s_Sql_Find.append(" inner join ARTICOLO_CLIENTE AS AC ON (B.id_articolo=AC.id_articolo or B.id_articoloVariante=AC.id_articoloVariante or A.id_tipo=AC.id_tipo)"); + String occurrence = findWebByArticoloCRCreateSmartSearchOccurrence(CR.getSearchTxtWeb().toLowerCase(), "B.descrizioneSearchAv"); + if (!occurrence.isEmpty()) + if (getParm("USE_SEARCH_LAST_2_OCCURRENCE").isTrue()) { + wc.addHavingWc(" occorrenze >= (select max" + occurrence.replace(")) as occorrenze", ")-1) as occorrenze") + " from ARTICOLO_VARIANTE AS B )"); + } else { + wc.addHavingWc(" occorrenze = (select max" + occurrence + " from ARTICOLO_VARIANTE AS B )"); + } + } + + public static final String getKitArt(long l_flgKit) { + return Tipo.getKit(l_flgKit); + } + + public long getFlgRateale0() { + return this.flgRateale0; + } + + public void setFlgRateale0(long flgRateale0) { + this.flgRateale0 = flgRateale0; + } + + public boolean isArticoloConfezioneOk() { + if (getId_articolo() == 0L) + return true; + if (getTipo().getTipologiaArticolo().getFlgAFT() != 3L) + return true; + Vectumerator vecAAT = findArticoliTessuto(); + if (vecAAT.getTotNumberOfRecords() == 0) + return false; + return true; + } + + public boolean isArticoloInWishList(long l_id_users) { + if (l_id_users == 0L || getId_articolo() == 0L) + return false; + Wishlist item = new Wishlist(getApFull()); + item.setId_articolo(getId_articolo()); + Wishlist wl = new Wishlist(getApFull()); + wl.findByUserItem(l_id_users, item); + if (wl.getId_wishlist() > 0L) + return true; + return false; + } + + public boolean isReadyForWeb(String lang) { + boolean debug = false; + if (getId_articolo() == 0L) + return false; + if (getPrezzoPubblico() <= 0.0D) { + DBAdapter.printDebug(debug, "Articolo.isReadyForWeb false per prezzoPubblico <=0"); + return false; + } + if (getDescTxtLang("descrizioneBreve", lang).isEmpty() && getNome(lang).isEmpty()) { + DBAdapter.printDebug(debug, "Articolo.isReadyForWeb false per descrizioneBreve vuota"); + return false; + } + if (getDescrizioneCommerciale(lang).isEmpty()) { + DBAdapter.printDebug(debug, "Articolo.isReadyForWeb false per descrizioneCommerciale vuota"); + return false; + } + if (!isImgExist(1)) { + DBAdapter.printDebug(debug, "Articolo.isReadyForWeb false per nessuna foto"); + return false; + } + return true; + } + + public long getMaxLenNomeMarketplace() { + long maxlen = 80L; + if (getFlgSubito() == 1L || getFlgEbay() == 1L) + if (getFlgSubito() == 1L) + maxlen = 50L; + return maxlen; + } + + public long getMaxLenDescMarketplace() { + long maxlen = 3990L; + if (getFlgSubito() == 1L || getFlgEbay() == 1L) + if (getFlgSubito() == 1L) + maxlen = 1990L; + return maxlen; + } + + public boolean isEbayLinkOk() { + if (isEbayPubblicato() && !getEbayItemId().isEmpty()) + return true; + return false; + } + + public boolean isCheckAvail() { + return getParm("CC_CHECK_AVAIL").isTrue(); + } + + public long getPrezzoVenditaComeStreetPrice() { + if (getStreetPrice() == 0.0D) + return -2L; + if (getPrezzoBase() < getStreetPrice()) + return -1L; + if (getPrezzoBase() > getStreetPrice()) + return 1L; + return 0L; + } + + public static final String getUsato(long l_flgUsato) { + if (l_flgUsato == 0L) + return "No"; + if (l_flgUsato == 2L) + return "Si Ditta"; + if (l_flgUsato == 1L) + return "Si Privato"; + if (l_flgUsato == 99L) + return "Si Tutti"; + if (l_flgUsato == -1L) + return "-"; + return "??"; + } + + public String getUsato() { + return getUsato(getFlgUsato()); + } + + public String getDescrizioneSearch() { + return (this.descrizioneSearch == null) ? "" : this.descrizioneSearch.trim(); + } + + public void setDescrizioneSearch(String descrizioneSearch) { + this.descrizioneSearch = descrizioneSearch; + } + + public ResParm addProgettista(ArticoloProgettista row) { + ResParm rp = new ResParm(true); + ArticoloProgettista bean = new ArticoloProgettista(getApFull()); + bean.findByProgettistaArticolo(row.getId_progettista(), row.getId_articolo()); + if (bean.getDBState() == 1) { + bean.setPercProvvigione(row.getPercProvvigione()); + bean.setNota(row.getNota()); + rp = bean.save(); + } else { + row.setDBState(0); + rp = row.save(); + } + return rp; + } + + public String getScaffale() { + return (this.scaffale == null) ? "" : this.scaffale.trim(); + } + + public void setScaffale(String scaffale) { + this.scaffale = scaffale; + } + + public long getFlgContoVendita() { + return this.flgContoVendita; + } + + public void setFlgContoVendita(long flgContoVendita) { + this.flgContoVendita = flgContoVendita; + } + + public ByteArrayOutputStream creaTulps(boolean definitivo) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + int cellLeading = 10; + NumberFormat nf = getNf(); + try { + this.document = new Document(PageSize.A5.rotate(), 10.0F, 10.0F, 70.0F, 10.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + Table pdfcorpo = new Table(40); + pdfcorpo.setWidth(100.0F); + pdfcorpo.setBorder(0); + pdfcorpo.setBorderWidth(0.0F); + pdfcorpo.setBorderColor(new Color(255, 255, 255)); + pdfcorpo.setPadding(2.0F); + pdfcorpo.setSpacing(0.0F); + pdfcorpo.setWidths(colWidthsRighe40); + Vectumerator vec = findArticolixStampTulps(); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + System.out.println(row.getDescrizione()); + creaUnTulps(row, pdfcorpo, definitivo); + this.document.add((Element)pdfcorpo); + if (vec.hasMoreElements()) { + this.document.newPage(); + pdfcorpo = new Table(40); + pdfcorpo.setWidth(100.0F); + pdfcorpo.setBorder(0); + pdfcorpo.setBorderWidth(0.0F); + pdfcorpo.setBorderColor(new Color(255, 255, 255)); + pdfcorpo.setPadding(2.0F); + pdfcorpo.setSpacing(0.0F); + pdfcorpo.setWidths(colWidthsRighe40); + } + } + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public ByteArrayOutputStream creaTulpsArticolo(boolean definitivo) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + if (getFlgUsato() > 0L) { + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + int cellLeading = 10; + NumberFormat nf = getNf(); + try { + this.document = new Document(PageSize.A5.rotate(), 10.0F, 10.0F, 70.0F, 10.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + Table pdfcorpo = new Table(40); + pdfcorpo.setWidth(100.0F); + pdfcorpo.setBorder(0); + pdfcorpo.setBorderWidth(0.0F); + pdfcorpo.setBorderColor(new Color(255, 255, 255)); + pdfcorpo.setPadding(2.0F); + pdfcorpo.setSpacing(0.0F); + pdfcorpo.setWidths(colWidthsRighe40); + creaUnTulps(this, pdfcorpo, definitivo); + this.document.add((Element)pdfcorpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + } + return ba; + } + + private void creaUnTulps(Articolo row, Table pdfcorpo, boolean definitivo) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + int cellLeading = 10; + NumberFormat nf = getNf(); + try { + Cell cellVuota = new Cell(new Chunk(" ", PDF_fPiccolo)); + cellVuota.setVerticalAlignment(4); + cellVuota.setHorizontalAlignment(1); + cellVuota.setLeading((float)cellLeading); + cellVuota.setBorder(0); + cellVuota.setColspan(40); + pdfcorpo.addCell(cellVuota); + Font PDF_fIntestazione = new Font(2, 10.0F, 1); + String temp = row.getCodice() + " - " + row.getCodice() + " " + row.getMarca().getDescrizione(); + if (!row.getNMatricola().isEmpty()) + temp = temp + " Mat. N. " + temp; + Cell cell = new Cell(new Chunk("ARTICOLO: " + temp, PDF_fIntestazione)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setColspan(40); + pdfcorpo.addCell(cell); + Date dataUltimoMovimento = new ArticoloUsato(getApFull()).getDataUltimoMovimento(row.getId_articolo()); + dataUltimoMovimento = getToday(); + if (dataUltimoMovimento != null) { + cell = new Cell(new Chunk("Data Stampa: " + getDataFormat().format(dataUltimoMovimento), PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + pdfcorpo.addCell(cell); + } + pdfcorpo.addCell(cellVuota); + int col1 = 4, col2 = 20, col3 = 4, col4 = 4, col5 = 4, col6 = 4; + cell = new Cell(new Chunk("Movimento", PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col1); + pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Venditore/Compratore", PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col2); + pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Documento", PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col3); + pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Data", PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col4); + pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Importo/\nImponibile", PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col5); + pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Iva", PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col6); + pdfcorpo.addCell(cell); + ArticoloUsato au = new ArticoloUsato(getApFull()); + Vectumerator vec = au.findByArticolo(row.getId_articolo(), 0, 0); + while (vec.hasMoreElements()) { + au = (ArticoloUsato)vec.nextElement(); + if (au.getFlgTipoDocumento() == 1L) { + cell = new Cell(new Chunk("ACQUISTO", PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col1); + pdfcorpo.addCell(cell); + temp = au.getIntestazione() + " Cod. Fisc. " + au.getIntestazione(); + try { + if (au.getFornitore().getPIva().isEmpty()) { + temp = temp + " Nato il " + temp + " a " + getDataFormat().format(au.getFornitore().getDataNascita()) + " (" + au.getFornitore().getDescrizioneComuneNascita() + "). Doc. Id.: " + au.getFornitore().getProvinciaComuneNascita(); + } else { + temp = temp + " - Partita Iva: " + temp; + } + temp = temp + " - " + temp; + } catch (Exception e) {} + cell = new Cell(new Chunk(temp, PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col2); + pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(au.getNumeroDocumento(), PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col3); + pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(df.format(au.getDataDocumento()), PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col4); + pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(au.getArticolo().getCostoNetto()), PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col5); + pdfcorpo.addCell(cell); + if (au.getArticolo().getIva().getFlgTipo() == "R") { + temp = "RM"; + } else { + temp = nf.format(au.getArticolo().getCostoNettoIva()); + } + cell = new Cell(new Chunk(temp, PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col6); + pdfcorpo.addCell(cell); + } else { + if (au.getFlgTipoDocumento() == 2L) { + cell = new Cell(new Chunk("VENDITA", PDF_fPiccoloB)); + } else if (au.getFlgTipoDocumento() == 3L) { + cell = new Cell(new Chunk("RESO", PDF_fPiccoloB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col1); + pdfcorpo.addCell(cell); + temp = au.getIntestazione() + " Cod. Fisc. " + au.getIntestazione(); + if (au.getCliente().getFlgAzienda() == 1L) + temp = temp + " " + temp; + cell = new Cell(new Chunk(temp, PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col2); + pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(au.getRigaDocumento().getDocumento().getNumeroDocumento(), PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col3); + pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(df.format(au.getRigaDocumento().getDocumento().getDataDocumento()), PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col4); + pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(au.getImporto()), PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col5); + pdfcorpo.addCell(cell); + if (au.getArticolo().getIva().getFlgTipo() == "R") { + temp = "RM"; + } else { + temp = nf.format(au.getRigaDocumento().getTotIvaRiga4()); + } + cell = new Cell(new Chunk(temp, PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col5); + pdfcorpo.addCell(cell); + } + if (definitivo && au.getTmstStampa() == null) { + au.setTmstStampa(getTimestamp().toString()); + au.save(); + } + } + cell = new Cell(new Chunk("-------------------------------------------------------------------------------------------------------------------------------------------------------------------------", PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + pdfcorpo.addCell(cell); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public Vectumerator findArticolixStampTulps() { + String s_Sql_Find = "select A.* from ARTICOLO as A inner join ARTICOLO_USATO AS B ON A.id_articolo=B.id_articolo"; + String s_Sql_order = " order by B.dataDocumento, A.nome"; + WcString wc = new WcString(); + wc.addWc("A.flgUsato>0"); + wc.addWc("(B.tmstStampa is null or B.tmstStampa='')"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public boolean isArticoloUsatoAcquistato() { + ArticoloUsato au = new ArticoloUsato(getApFull()); + return au.isArticoloAcquistato(getId_articolo()); + } + + public boolean isArticoloUsatoReso() { + ArticoloUsato au = new ArticoloUsato(getApFull()); + return au.isArticoloReso(getId_articolo()); + } + + public boolean isArticoloUsatoVenduto() { + ArticoloUsato au = new ArticoloUsato(getApFull()); + return au.isArticoloVenduto(getId_articolo()); + } + + public void aggiornaPrezzoNettoConCostoNuovo() { + if (getCostoNuovo() > 0.0D) { + double l_ricarico = getPercRicarico(); + if (l_ricarico <= 0.0D); + setCostoPrecedente(getCostoNetto()); + setImponibilePrecedente(getPrezzoBase()); + setCostoNetto(getCostoNuovo()); + DoubleOperator prNetto = new DoubleOperator(getCostoNetto()); + prNetto.multiply(l_ricarico + 100.0D); + prNetto.divide(100.0F); + prNetto.setScale(2, 5); + double prPubblicoConIva = conIva(prNetto.getResult(), (double)getIva().getAliquota()); + if (prPubblicoConIva >= getParm("CC_ARROTONDA_PREZZO_A_EURO_SOPRA").getNumero()) { + prPubblicoConIva = arrotonda(prPubblicoConIva, 1.0D); + } else { + prPubblicoConIva = arrotonda(prPubblicoConIva, getParm("CC_ARROTONDA_DECIMALE_PER_PREZZI_BASSI").getNumero()); + } + double prNettoFinale = scorporaIva(prPubblicoConIva, (double)getIva().getAliquota()); + ListinoArticolo listinoArticoloBase = getListinoArticoloBase(); + listinoArticoloBase.setPrezzoLA(prNettoFinale); + ResParm rp = listinoArticoloBase.save(); + setCostoNuovo(0.0D); + setDataUltimoCosto(getToday()); + setPrezzoArticolo(null); + super.save(); + } + } + + public String getIdTipoSearch() { + return (this.idTipoSearch == null) ? "" : this.idTipoSearch.trim(); + } + + public void setIdTipoSearch(String idTipoSearch) { + this.idTipoSearch = idTipoSearch; + } + + public long getTipoOrdineSearch() { + return this.tipoOrdineSearch; + } + + public void setTipoOrdineSearch(long tipoOrdineSearch) { + this.tipoOrdineSearch = tipoOrdineSearch; + } + + public String getTipoDescrizioneSearch() { + return (this.tipoDescrizioneSearch == null) ? "" : this.tipoDescrizioneSearch.trim(); + } + + public void setTipoDescrizioneSearch(String tipoDescrizioneSearch) { + this.tipoDescrizioneSearch = tipoDescrizioneSearch; + } + + public Vectumerator findWebByArticoloCR(ArticoloCR CR, int pageNumber, int pageRows) { + String occurrenceFind, orderBy; + if (CR.getSearchTxtWeb().length() > 3 && CR.getSearchTxtWeb().trim().startsWith("*")) + return AB_EMPTY_VECTUMERATOR; + StringBuilder sb = new StringBuilder(); + boolean debug = false; + Timer timer = new Timer(); + if (debug) { + timer.start(); + sb.append(">>>>>>>>>>>>>>>>>>>>>>\nFINDWEBARTICOLO: "); + java.util.Date d = new java.util.Date(System.currentTimeMillis()); + sb.append(getApFull().getReqUrl()); + sb.append("\n"); + sb.append(d.toString()); + sb.append(" ip: "); + sb.append(getApFull().getReqIpAddress()); + } + if (CR.getSearchTxtWeb().indexOf("%20") >= 0) + CR.setSearchTxtWeb(CR.getSearchTxtWeb().replaceAll("%20", " ")); + String occurrence = findWebByArticoloCRCreateSmartSearchOccurrence(CR.getSearchTxtWeb().toLowerCase(), "A.descrizioneSearch"); + if (!occurrence.isEmpty()) { + occurrenceFind = occurrence + ", "; + } else { + occurrenceFind = ""; + } + StringBuffer s_Sql_Find = new StringBuffer("select " + occurrenceFind + " A.* from ARTICOLO AS A inner join TIPO AS C on C.id_tipo=A.id_tipo "); + if (occurrence.isEmpty()) { + orderBy = " order by "; + } else { + orderBy = " order by occorrenze desc,"; + } + String s_Sql_Order = orderBy; + if (CR.getFlgOrderBy() == 0L) { + s_Sql_Order = orderBy + "A.nome " + orderBy; + } else if (CR.getFlgOrderBy() == 11L) { + s_Sql_Order = orderBy + "A.id_articolo " + orderBy; + } else if (CR.getFlgOrderBy() == 1L) { + s_Sql_Order = orderBy + "M.descrizione " + orderBy + ", A.codice, A.nome " + CR.getFlgOrderType(); + } else if (CR.getFlgOrderBy() == 2L) { + s_Sql_Order = orderBy + "A.tipoOrdineSearch, A.tipoDescrizioneSearch , A.nome "; + } else if (CR.getFlgOrderBy() == 3L) { + s_Sql_Order = orderBy + "A.tipoOrdineSearch, A.tipoDescrizioneSearch desc , A.nome desc"; + } else if (CR.getFlgOrderBy() == 4L) { + s_Sql_Order = orderBy + "A.prezzoPubblicoIvaOrd ,A.tipoOrdineSearch, A.tipoDescrizioneSearch , A.nome"; + } else if (CR.getFlgOrderBy() == 5L) { + s_Sql_Order = orderBy + " A.prezzoPubblicoIvaOrd desc ,A.tipoOrdineSearch, A.tipoDescrizioneSearch ,A.nome"; + } else if (CR.getFlgOrderBy() == 7L) { + s_Sql_Order = orderBy + "A.quantita desc, C.descrizioneR , A.nome "; + } + if (s_Sql_Order.equals(orderBy)) + s_Sql_Order = orderBy + "A.nome " + orderBy; + WcString wc = new WcString(); + findWebByArticoloCRCreateWC(CR, s_Sql_Find, wc); + try { + if (debug) { + sb.append("\n"); + sb.append(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + } + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + Vectumerator vec = findRows(stmt, pageNumber, pageRows); + if (debug) { + timer.stop(); + sb.append("\nDurata query: ms "); + sb.append(timer.getDurataMilliSec()); + sb.append("\n"); + sb.append("\n<<<<<<<<<<<<"); + System.out.println(sb.toString()); + } + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void findWebByArticoloCRCreateWC(ArticoloCR CR, StringBuffer s_Sql_Find, WcString wc) { + if (CR.getTag().indexOf("NOLEGGIO") >= 0) { + if (CR.getFlgDisponibilita().isEmpty()) { + CR.setFlgDisponibilita("1"); + } else if (CR.getFlgDisponibilita().indexOf("1") < 0) { + CR.setFlgDisponibilita("1,2"); + } + if (CR.getFiltri_id().isEmpty() && !CR.getFlgDisponibilita().isEmpty()) + CR.setFiltri_id("D," + CR.getFlgDisponibilita()); + } else { + if (CR.getTag().indexOf("USATO") >= 0) + if (CR.getFlgCondizioni().isEmpty()) { + CR.setFlgCondizioni("3"); + } else if (CR.getFlgCondizioni().indexOf("3") < 0) { + CR.setFlgCondizioni(CR.getFlgCondizioni() + ",3"); + } + if (CR.getTag().indexOf("STOCK") >= 0) + if (CR.getFlgCondizioni().isEmpty()) { + CR.setFlgCondizioni("2"); + } else if (CR.getFlgCondizioni().indexOf("2") < 0) { + CR.setFlgCondizioni(CR.getFlgCondizioni() + ",2"); + } + if (CR.getFiltri_id().isEmpty() && !CR.getFlgCondizioni().isEmpty()) + CR.setFiltri_id("C," + CR.getFlgCondizioni()); + } + if (CR.getFlgOrderBy() == 1L) + s_Sql_Find.append(" inner join MARCA as M on A.id_marca=M.id_marca"); + if (!CR.getTagArticolo().isEmpty()) { + wc.addWc("A.tagArticolo like '%," + CR.getTagArticolo() + ",%'"); + } else if (!CR.getSearchTxtWeb().isEmpty() && !CR.getSearchTxtWeb().equals("*")) { + if (!CR.getSearchTxtWeb().startsWith("#")) { + String temp = findByCRCreateSmartSearchWC(CR.getSearchTxtWeb().toLowerCase(), "A.descrizioneSearch"); + if (!temp.isEmpty()) + wc.addWc(temp); + } + } + if (CR.getFlgEscludiWeb() == 0L) + wc.addWc("(A.flgEscludiWeb=0)"); + if (CR.getFlgDisponibile() > 0L) + wc.addWc("A.quantita>0"); + if (CR.getFlgNascondi() == 0L) { + wc.addWc("(A.flgNascondi=0 or A.flgNascondi is null)"); + wc.addWc("(C.flgNascondi=0 or C.flgNascondi is null)"); + } else if (CR.getFlgNascondi() > 0L) { + wc.addWc("A.flgNascondi=" + CR.getFlgNascondi()); + wc.addWc("C.flgNascondi=" + CR.getFlgNascondi()); + } + if (!CR.getFlgDisponibilita().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getFlgDisponibilita(), ","); + while (st.hasMoreTokens()) { + long token = Long.parseLong(st.nextToken()); + if (token == 1L) { + wc.addWc("A.flgNoleggio>0"); + continue; + } + if (token == 2L) + wc.addWc("A.quantita>0"); + } + } + if (!CR.getFlgCondizioni().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getFlgCondizioni(), ","); + StringBuilder sbFlgStockOfferte = new StringBuilder("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + sbFlgStockOfferte.append("A.flgStockOfferte=" + token); + if (st.hasMoreTokens()) + sbFlgStockOfferte.append(" or "); + } + sbFlgStockOfferte.append(")"); + wc.addWc(sbFlgStockOfferte.toString()); + } + if (CR.getId_articoloEscluso() > 0L) + wc.addWc("A.id_articolo!=" + CR.getId_articoloEscluso()); + if (CR.getFlgNoleggio() == 10L) + wc.addWc("A.flgNoleggio!=1"); + if (!CR.getId_marche().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getId_marche(), ","); + StringBuilder wcmarche = new StringBuilder("("); + while (st.hasMoreTokens()) { + long token = Long.parseLong(st.nextToken()); + wcmarche.append("A.id_marca= " + token); + if (st.hasMoreTokens()) + wcmarche.append(" or "); + } + wcmarche.append(")"); + wc.addWc(wcmarche.toString()); + } + if (!CR.getCarId_listaS().isEmpty()) { + boolean needOr = false; + StringTokenizer st = new StringTokenizer(CR.getCarId_listaS(), ","); + StringBuilder cli = new StringBuilder("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + if (!token.isEmpty() && !token.equals("0")) { + if (token.startsWith("c")) { + if (st.hasMoreTokens()) { + cli.append(") and ( "); + needOr = false; + } + continue; + } + if (needOr) + cli.append(" or "); + cli.append("A.caratteristicheListeId like '%," + token + ",%'"); + needOr = true; + } + } + cli.append(")"); + if (cli.length() > 2) + wc.addWc(cli.toString()); + } + if (CR.getId_tipoSel() != 0L) + wc.addWc("A.idTipoSearch like'%:" + CR.getId_tipoSel() + ":%'"); + if (CR.getPrezzoDa() > 0.0D) + wc.addWc("A.prezzoPubblicoIvaOrd>=" + CR.getPrezzoDa()); + if (CR.getPrezzoA() > 0.0D) + wc.addWc("A.prezzoPubblicoIvaOrd<=" + CR.getPrezzoA()); + if (!CR.getLastItems().isEmpty()) { + boolean firstElement = true; + StringTokenizer st = new StringTokenizer(CR.getLastItems(), ","); + StringBuilder sb = new StringBuilder("("); + while (st.hasMoreTokens()) { + String item = st.nextToken().trim(); + if (!item.isEmpty()) { + if (firstElement) { + firstElement = false; + } else { + sb.append(" or "); + } + sb.append("A.id_articolo=" + item); + } + } + if (!firstElement) { + sb.append(")"); + wc.addWc(sb.toString()); + } else { + wc.addWc("A.id_articolo=-1"); + } + } + String occurrence = findWebByArticoloCRCreateSmartSearchOccurrence(CR.getSearchTxtWeb().toLowerCase(), "A.descrizioneSearch"); + if (!occurrence.isEmpty()) + if (getParm("USE_SEARCH_LAST_2_OCCURRENCE").isTrue()) { + wc.addHavingWc(" occorrenze >= (select max" + occurrence.replace(")) as occorrenze", ")-1) as occorrenze") + " from ARTICOLO AS A )"); + } else { + wc.addHavingWc(" occorrenze = (select max" + occurrence + " from ARTICOLO AS A )"); + } + } + + public double getPrezzoPubblicoArticoloMinByCR(ArticoloCR CR) { + String occurrenceFind; + StringBuilder sb = new StringBuilder(); + boolean debug = false; + Timer timer = new Timer(); + if (debug) { + timer.start(); + sb.append(">>>>>>>>>>>>>>>>>>>>>>\nPREZZO MIN findWebByArticoloCR: "); + java.util.Date d = new java.util.Date(System.currentTimeMillis()); + sb.append(getApFull().getReqUrl()); + sb.append("\n"); + sb.append(d.toString()); + sb.append(" ip: "); + sb.append(getApFull().getReqIpAddress()); + } + String occurrence = findWebByArticoloCRCreateSmartSearchOccurrence(CR.getSearchTxtWeb().toLowerCase(), "A.descrizioneSearch"); + if (!occurrence.isEmpty()) { + occurrenceFind = occurrence + ", "; + } else { + occurrenceFind = ""; + } + StringBuffer s_Sql_Find = new StringBuffer("select " + occurrenceFind + " min(prezzoPubblicoIvaOrd) as _max from ARTICOLO AS A inner join TIPO AS C on C.id_tipo=A.id_tipo "); + try { + WcString wc = new WcString(); + ArticoloCR CR2 = CR.getClone(); + CR2.setPrezzoA(0.0D); + CR2.setPrezzoDa(0.0D); + CR2.setFlgNoleggio(10L); + findWebByArticoloCRCreateWC(CR2, s_Sql_Find, wc); + if (debug) { + sb.append("\n"); + sb.append(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + } + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + double res = getMax(stmt); + if (debug) { + timer.stop(); + sb.append("\nDurata query: ms "); + sb.append(timer.getDurataMilliSec()); + sb.append("\n"); + sb.append("\n<<<<<<<<<<<<"); + System.out.println(sb.toString()); + } + return res; + } catch (SQLException|CloneNotSupportedException e) { + handleDebug(e); + return 0.0D; + } + } + + public synchronized ResParm aggiornaUltimoCosto(double l_costoNuovo, Date l_dataCarico) { + ResParm rp = new ResParm(true); + if ((getDataUltimoCosto() == null || getDateDiff(getDataUltimoCosto(), l_dataCarico) >= 0L) && l_costoNuovo != getCostoNetto()) { + setDataUltimoCosto(l_dataCarico); + setCostoNetto(l_costoNuovo); + setCostoNuovo(0.0D); + rp = super.save(); + } + return rp; + } + + public void setSimboliLavaggio(SimboliLavaggio simboliLavaggio) { + this.simboliLavaggio = simboliLavaggio; + } + + public double getCostoAcquisto(Clifor l_clifor) { + double costoAcquistoCLifor = getCostoAcquistoUltimo(l_clifor); + if (costoAcquistoCLifor != 0.0D) + return costoAcquistoCLifor; + if (getCostoNetto() != 0.0D) + return getCostoNetto(); + return getCostoAcquistoUltimo(); + } + + public double getCostoAcquistoConIva() { + if (getCostoNetto() != 0.0D) + return getCostoNettoIva(); + return getCostoAcquistoUltimoConIva(); + } + + public double getImportoRata(String tabfin, long l_durata) { + if (getPrezzoPubblicoIva() > 0.0D) { + ConselTabfin ctf = new ConselTabfin(getApFull()); + ctf.findByTipoValoreDurata(tabfin, (double)getPrezzoPubblicoIvaL(), l_durata); + return ctf.getImportoRata(); + } + return -1.0D; + } + + public long getPrezzoPubblicoIvaL() { + return Math.round(getPrezzoPubblicoIva()); + } + + public double getRicaricoEffettivoDaCostoNetto() { + return getRicaricoCalc(getCostoNetto()); + } + + public ResParm creaFileInventarioCsv(ArticoloCR CR) { + int numRecord = 0; + ResParm rp = new ResParm(true); + try { + int i = 0; + int se1 = 10; + int se2 = 100; + String fileCsv = "inventario.csv"; + String filename = getDocBase() + getDocBase() + getParm("PATH_TMP").getTesto(); + new File(filename).delete(); + FileWr outFile = new FileWr(filename, "UTF-8", false); + Vectumerator vec = findByCR(CR, 0, 0); + System.out.println("creaFileInventario. n. record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + i++; + Articolo rowbean = (Articolo)vec.nextElement(); + String s1 = rowbean.getRecordInventario(); + outFile.writeLine(s1); + if (se1 <= 0 || i % se1 == 0); + if (se2 <= 0 || i % se2 == 0); + } + outFile.closeFile(); + rp.setStatus(true); + rp.setMsg("Generazione file inventario avvenuta con successo.
Numero Record: " + numRecord); + CR.setFileName(fileCsv); + } catch (Exception e) { + handleDebug(e); + rp.setException(e); + rp.setStatus(false); + } + return rp; + } + + public ResParm creaFileReportVenditeCsv(ArticoloCR CR) { + int numRecord = 0; + ResParm rp = new ResParm(true); + if (CR.getDataDocumentoDa() == null && CR.getDataDocumentoA() == null) + return new ResParm(false, "Errore! Immettere almeno una data documento nei criteri"); + try { + String fileCsv = "reportVendite" + CR.getId_users() + "_" + getNow().getTime() + ".csv"; + CR.setFileName(fileCsv); + String filename = getDocBase() + getDocBase() + getParm("PATH_TMP").getTesto(); + new File(filename).delete(); + FileWr outFile = new FileWr(filename, "UTF-8", false); + String intestazione = "data Inserimento;id_articolo;codice articolo;codici fornitori;descrizione;famiglia;sotto famiglia;marca;costo netto;qta caricata;qta venduta;num. vendite;giacenza;;scaffale;eBay;stockOfferte;google;pr. vend. netto;pr. pubblico;link"; + Vectumerator vec = new RigaDocumento(getApFull()).findReportVenditeByArticoloCR(CR); + String s1 = intestazione; + outFile.writeLine(s1); + Articolo currentArticolo = null; + double qtaVenduta = 0.0D; + long numVendite = 0L; + while (vec.hasMoreElements()) { + RigaDocumento rowbean = (RigaDocumento)vec.nextElement(); + if (currentArticolo == null) + currentArticolo = rowbean.getArticolo(); + if (currentArticolo.getId_articolo() != rowbean.getId_articolo()) { + qtaVenduta = rowbean.getMSQtaCaricataScaricataByArticolo(currentArticolo.getId_articolo(), -1L, + CR.getDataDocumentoDa(), CR.getDataDocumentoA()); + double qtaCaricata = rowbean.getMSQtaCaricataScaricataByArticolo(currentArticolo.getId_articolo(), 1L, + CR.getDataDocumentoDa(), CR.getDataDocumentoA()); + s1 = currentArticolo.getRecordReportVendite(qtaCaricata, qtaVenduta, numVendite); + outFile.writeLine(s1); + numVendite = 0L; + currentArticolo = rowbean.getArticolo(); + } + numVendite++; + if (!vec.hasMoreElements()) { + qtaVenduta = rowbean.getMSQtaCaricataScaricataByArticolo(currentArticolo.getId_articolo(), -1L, + CR.getDataDocumentoDa(), CR.getDataDocumentoA()); + double qtaCaricata = rowbean.getMSQtaCaricataScaricataByArticolo(currentArticolo.getId_articolo(), 1L, + CR.getDataDocumentoDa(), CR.getDataDocumentoA()); + s1 = currentArticolo.getRecordReportVendite(qtaCaricata, qtaVenduta, numVendite); + outFile.writeLine(s1); + } + } + Articolo articolo = new Articolo(getApFull()); + vec = articolo.findArticoliNonVenduti(CR, true, 0, 0); + RigaDocumento rd = new RigaDocumento(getApFull()); + if (vec.hasMoreElements()) { + outFile.writeLine("\n\n\nARTICOLI NON VENDUTI CON GIACENZA >0\n\n" + intestazione); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + qtaVenduta = rd.getMSQtaCaricataScaricataByArticolo(row.getId_articolo(), -1L); + double qtaCaricata = rd.getMSQtaCaricataScaricataByArticolo(row.getId_articolo(), 1L); + s1 = row.getRecordReportVendite(qtaCaricata, qtaVenduta, 0L); + outFile.writeLine(s1); + } + } + vec = articolo.findArticoliNonVenduti(CR, false, 0, 0); + if (vec.hasMoreElements()) { + outFile.writeLine("\n\n\nARTICOLI NON VENDUTI SENZA GIACENZA \n\n" + intestazione); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + qtaVenduta = rd.getMSQtaCaricataScaricataByArticolo(row.getId_articolo(), -1L); + double qtaCaricata = rd.getMSQtaCaricataScaricataByArticolo(row.getId_articolo(), 1L); + s1 = row.getRecordReportVendite(qtaCaricata, qtaVenduta, 0L); + outFile.writeLine(s1); + } + } + outFile.closeFile(); + rp.setStatus(true); + rp.setMsg("Generazione file report vendite avvenuta con successo.
Numero Record: " + numRecord); + } catch (Exception e) { + handleDebug(e); + rp.setException(e); + rp.setStatus(false); + } + return rp; + } + + private String getRecordInventario() { + StringBuffer temp = new StringBuffer(); + String sep = ";"; + temp.append(getId_articolo()); + temp.append(sep); + temp.append(getCodice()); + temp.append(sep); + temp.append(getNome().replaceAll("€", "€").replace(";", " ")); + temp.append(sep); + temp.append(getTipo().getDescrizione()); + temp.append(sep); + temp.append(getTipo2().getDescrizione()); + temp.append(sep); + temp.append(getMarca().getDescrizione()); + temp.append(sep); + temp.append(getNf().format(getQuantita())); + temp.append(sep); + temp.append(getNf().format(getCostoNetto())); + temp.append(sep); + temp.append(getNf().format(getPrezzoPubblico())); + if (getFlgUsato() > 0L) { + temp.append(sep); + temp.append(getNf().format(getCostoNetto())); + temp.append(sep); + temp.append(getNf().format(getPrezzoPubblico())); + } + return temp.toString(); + } + + private String getRecordReportVendite(double qtaCaricata, double qtaVenduta, long numVendite) { + StringBuffer temp = new StringBuffer(); + String sep = ";"; + temp.append(getDataFormat().format(getCreateTmst())); + temp.append(sep); + temp.append("\"" + getId_articolo() + "\""); + temp.append(sep); + temp.append(getCodice()); + temp.append(sep); + temp.append(getCodiciAlternativi()); + temp.append(sep); + temp.append(getNome().replaceAll("€", "€").replace(";", " ")); + temp.append(sep); + temp.append(getTipo().getDescrizione()); + temp.append(sep); + temp.append(getTipo2().getDescrizione()); + temp.append(sep); + temp.append(getMarca().getDescrizione()); + temp.append(sep); + temp.append(getNf().format(getCostoNetto())); + temp.append(sep); + temp.append(getNf().format(qtaCaricata)); + temp.append(sep); + temp.append(getNf().format(qtaVenduta)); + temp.append(sep); + temp.append(getNf().format(numVendite)); + temp.append(sep); + temp.append(getNf().format(getQuantita())); + temp.append(sep); + temp.append(sep); + temp.append(getScaffale()); + temp.append(sep); + temp.append((getFlgEbay() == 1L) ? "s" : ""); + temp.append(sep); + temp.append(getStockOfferte()); + temp.append(sep); + temp.append((getFlgGoogle() == 1L) ? "s" : ""); + temp.append(sep); + temp.append(getNf().format(getPrice())); + temp.append(sep); + temp.append(getNf().format(getPriceWVat())); + temp.append(sep); + temp.append(getLinkPreview()); + return temp.toString(); + } + + private LinkedHashMap getRecordXmlGoogle(String lang) { + String str1, condition; + if (lang.isEmpty()) + lang = "it"; + NumberFormat nf2 = NumberFormat.getInstance(Locale.US); + nf2.setMaximumFractionDigits(2); + nf2.setMinimumFractionDigits(2); + LinkedHashMap map = new LinkedHashMap<>(); + String wwwSite = getWwwAddressParm(); + map.put("g:id", getCodice()); + if (!getDescTxtLangScript("nomeMarketplace", "it").isEmpty()) { + map.put("g:title", getDescTxtLangScript("nomeMarketplace", "it").replaceAll("€", "€").replace(";", " ")); + } else { + map.put("g:title", getNome()); + } + if (!getDescrizioneMarketplace(lang).isEmpty()) { + map.put("g:description", getDescrizioneMarketplace(lang)); + } else { + map.put("g:description", getDescrizioneBreve(lang)); + } + ArticoloCR CR = new ArticoloCR(); + CR.setLang(lang); + map.put("g:link", wwwSite + wwwSite); + map.put("g:image_link", wwwSite + "/_img/_imgArt/" + wwwSite); + if (new File(getDocBase() + "/_img/_imgArt/" + getDocBase()).exists()) + map.put("g:additional_image_link", wwwSite + "/_img/_imgArt/" + wwwSite); + switch (getDispoLevel()) { + case 0: + str1 = "out of stock"; + case 1: + str1 = "in stock"; + case 2: + str1 = "in stock"; + break; + } + String dispo = ""; + map.put("g:availability", dispo); + if (isOffertaValida()); + if (isPrezzoBarratoValido()); + if (isOffertaValida()) { + map.put("g:price", nf2.format(getPrezzoBaseIva()) + " EUR"); + map.put("g:sale_price", nf2.format(getPrezzoPubblicoIva()) + " EUR"); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); + } else if (isPrezzoBarratoValido()) { + map.put("g:price", nf2.format(getPrezzoIvatoBarrato()) + " EUR"); + map.put("g:sale_price", nf2.format(getPrezzoPubblicoIva()) + " EUR"); + } else { + map.put("g:price", nf2.format(getPrezzoPubblicoIva()) + " EUR"); + } + map.put("g:product_type", getTipo().getDescrizioneCompletaGreater(lang)); + map.put("g:brand", getMarca().getDescrizione()); + if (!getCodiceProduttore().isEmpty()) + map.put("g:mpn", getCodiceProduttore()); + if (!getCodiceEan().isEmpty()) + map.put("g:gtin", getCodiceEan()); + if (getCodiceEan().isEmpty()) + map.put("g:identifier_exists", "no"); + if (getFlgStockOfferte() == 3L) { + condition = "used"; + } else { + condition = "new"; + } + map.put("g:condition", condition); + StringBuilder sb = new StringBuilder(); + Nazione nazione = new Nazione(getApFull()); + Vectumerator vec = nazione.findAllAttive(lang); + while (vec.hasMoreElements()) { + Nazione row = (Nazione)vec.nextElement(); + sb.append(row.getCodice()); + sb.append(":::"); + sb.append(nf2.format(conIva(row.getCostoSpedizione(), (double)getIva().getAliquota()))); + sb.append(" EUR"); + if (vec.hasMoreElements()) + sb.append(" "); + } + map.put("g:shipping", sb.toString()); + return map; + } + + public Vectumerator findArticoliNonVenduti(ArticoloCR CR, boolean conGiacenza, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO as A inner join DOCUMENTO AS B on A.id_documento=B.id_documento inner join ARTICOLO AS C on A.id_articolo=C.id_articolo inner join TIPO_DOCUMENTO AS TD ON B.id_tipoDocumento=TD.id_tipoDocumento"; + String s_Sql_order = " order by CM.codice"; + if (CR.getFlgEscludiWeb() >= 0L || CR.getId_tipo() != 0L || CR.getFlgNascondi() >= 0L || !CR.getFlgReport().isEmpty()) + s_Sql_Find = s_Sql_Find + " inner join TIPO AS T ON T.id_tipo=C.id_tipo"; + WcString wc = new WcString(); + String s_Sql_FindM = "select CM.* from ARTICOLO as CM"; + if (CR.getFlgEscludiWeb() >= 0L || CR.getId_tipo() != 0L || CR.getFlgNascondi() >= 0L || !CR.getFlgReport().isEmpty()) + s_Sql_FindM = s_Sql_FindM + " inner join TIPO AS TM ON TM.id_tipo=CM.id_tipo"; + s_Sql_FindM = s_Sql_FindM + " left join ("; + String S_Sql_join = ") as R on CM.id_articolo=R.id_articolo "; + WcString wcM = new WcString(); + wcM.addWc("R.id_rigaDocumento is null"); + if (conGiacenza) { + wcM.addWc("CM.quantita>=1"); + } else { + wcM.addWc("(CM.quantita is null or CM.quantita<=0)"); + } + if (!CR.getCodice().isEmpty()) + wcM.addWc("CM.codice like'" + CR.getCodice() + "%'"); + if (CR.getId_iva() != 0L) + wcM.addWc("CM.id_iva=" + CR.getId_iva()); + if (CR.getId_clifor() != 0L) + wcM.addWc("CM.id_fornitore=" + CR.getId_clifor()); + if (CR.getFlgQta() == 1L) + if (CR.getQtaDa() == 0L) { + wcM.addWc("(CM.quantita<=" + CR.getQtaA() + ")"); + } else { + wcM.addWc("(CM.quantita>=" + CR.getQtaDa() + ")"); + wcM.addWc("(CM.quantita<=" + CR.getQtaA() + ")"); + } + if (CR.getFlgUsato() >= 0L) + wcM.addWc("CM.flgUsato=" + CR.getFlgUsato()); + if (!CR.getScaffale().isEmpty()) + if (CR.getScaffale().indexOf("*") > 0) { + String temp = CR.getScaffale().replace("*", "%"); + wcM.addWc("CM.scaffale like'" + temp + "'"); + } else { + wcM.addWc("CM.scaffale ='" + CR.getScaffale() + "'"); + } + if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) + if (CR.getSearchTxt().startsWith(",")) { + wcM.addWc("CM.codiciAlternativi like'%" + CR.getSearchTxt() + ",%'"); + } else { + wcM.addWc("(CM.codice like'%" + CR.getSearchTxt() + "%' or CM.descrizioneSearch like'%" + CR.getSearchTxt() + "%')"); + } + if (CR.getId_marca() != 0L) + wcM.addWc("CM.id_marca=" + CR.getId_marca()); + if (!CR.getDescrizione().isEmpty()) + wcM.addWc("CM.descrizione like'%" + CR.getDescrizione() + "%'"); + if (CR.getId_tipo() != 0L) + wcM.addWc("(TM.id_tipo=" + CR.getId_tipo() + " or TM.indici like'%:" + CR.getId_tipo() + ":%')"); + if (CR.getFlgEscludiWeb() == 0L) { + wcM.addWc("(CM.flgEscludiWeb=0 or CM.flgEscludiWeb is null)"); + } else if (CR.getFlgEscludiWeb() > 0L) { + wcM.addWc("CM.flgEscludiWeb=" + CR.getFlgEscludiWeb()); + } + if (CR.getFlgWebNoVendita() == 0L) { + wcM.addWc("(CM.flgWebNoVendita=0 or CM.flgWebNoVendita is null)"); + } else if (CR.getFlgWebNoVendita() > 0L) { + wcM.addWc("CM.flgWebNoVendita=" + CR.getFlgWebNoVendita()); + } + if (CR.getFlgStockOfferte() > 0L) + if (CR.getFlgStockOfferte() == 99L) { + wcM.addWc("(CM.flgStockOfferte=1 and (CM.dataScadenzaOfferta is null or CM.dataScadenzaOfferta>=?))"); + } else { + wcM.addWc("CM.flgStockOfferte=" + CR.getFlgStockOfferte()); + } + wc.addWc("TD.flgMovMagazzino =-1"); + wc.addWc("(B.flgStatoOrdineWww is null or B.flgStatoOrdineWww <> 99)"); + if (!CR.getCodice().isEmpty()) + wc.addWc("C.codice like'" + CR.getCodice() + "%'"); + if (CR.getId_iva() != 0L) + wc.addWc("C.id_iva=" + CR.getId_iva()); + if (CR.getId_clifor() != 0L) + wc.addWc("C.id_fornitore=" + CR.getId_clifor()); + if (CR.getFlgQta() == 1L) + if (CR.getQtaDa() == 0L) { + wc.addWc("(C.quantita<=" + CR.getQtaA() + ")"); + } else { + wc.addWc("(C.quantita>=" + CR.getQtaDa() + ")"); + wc.addWc("(C.quantita<=" + CR.getQtaA() + ")"); + } + if (CR.getFlgUsato() >= 0L) + wc.addWc("C.flgUsato=" + CR.getFlgUsato()); + if (!CR.getScaffale().isEmpty()) + if (CR.getScaffale().indexOf("*") > 0) { + String temp = CR.getScaffale().replace("*", "%"); + wc.addWc("C.scaffale like'" + temp + "'"); + } else { + wc.addWc("C.scaffale ='" + CR.getScaffale() + "'"); + } + if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) + if (CR.getSearchTxt().startsWith(",")) { + wc.addWc("C.codiciAlternativi like'%" + CR.getSearchTxt() + ",%'"); + } else { + wc.addWc("(C.codice like'%" + CR.getSearchTxt() + "%' or C.descrizioneSearch like'%" + CR.getSearchTxt() + "%')"); + } + if (CR.getId_marca() != 0L) + wc.addWc("C.id_marca=" + CR.getId_marca()); + if (!CR.getDescrizione().isEmpty()) + wc.addWc("C.descrizione like'%" + CR.getDescrizione() + "%'"); + if (CR.getId_tipo() != 0L) + wc.addWc("(T.id_tipo=" + CR.getId_tipo() + " or T.indici like'%:" + CR.getId_tipo() + ":%')"); + if (CR.getFlgEscludiWeb() == 0L) { + wc.addWc("(C.flgEscludiWeb=0 or C.flgEscludiWeb is null)"); + } else if (CR.getFlgEscludiWeb() > 0L) { + wc.addWc("C.flgEscludiWeb=" + CR.getFlgEscludiWeb()); + } + if (CR.getFlgWebNoVendita() == 0L) { + wc.addWc("(C.flgWebNoVendita=0 or C.flgWebNoVendita is null)"); + } else if (CR.getFlgWebNoVendita() > 0L) { + wc.addWc("C.flgWebNoVendita=" + CR.getFlgWebNoVendita()); + } + if (CR.getFlgStockOfferte() > 0L) + if (CR.getFlgStockOfferte() == 99L) { + wc.addWc("(C.flgStockOfferte=1 and (C.dataScadenzaOfferta is null or C.dataScadenzaOfferta>=?))"); + } else { + wc.addWc("C.flgStockOfferte=" + CR.getFlgStockOfferte()); + } + if (CR.getDataDocumentoDa() != null) + wc.addWc("B.dataDocumento>=?"); + if (CR.getDataDocumentoA() != null) + wc.addWc("B.dataDocumento<=? "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_FindM + s_Sql_FindM + s_Sql_Find + String.valueOf(wc) + S_Sql_join + String.valueOf(wcM)); + int dataCount = 1; + if (CR.getDataDocumentoDa() != null) { + stmt.setDate(dataCount, CR.getDataDocumentoDa()); + dataCount++; + } + if (CR.getDataDocumentoA() != null) { + stmt.setDate(dataCount, CR.getDataDocumentoA()); + dataCount++; + } + Vectumerator vec = findRows(stmt); + return vec; + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getQuantitaDB() { + return this.quantitaDB; + } + + public void setQuantitaDB(double quantitaDB) { + this.quantitaDB = quantitaDB; + } + + public long getFlgModImportazione() { + return this.flgModImportazione; + } + + public static final String getModImportazione(long l_flgModImportazione) { + switch ((int)l_flgModImportazione) { + case 9: + return "Controllato"; + case 2: + return "Modificato"; + case 0: + return "Non Trovato"; + case 1: + return "Nuovo"; + case 4: + return "Trovato NON Disponibile"; + case 3: + return "Trovato NON Modificato"; + } + return ""; + } + + public String getModImportazione() { + return getModImportazione(getFlgModImportazione()); + } + + public static final String getPriceTypeAmz(long l_flgPriceTypeAmz) { + switch ((int)l_flgPriceTypeAmz) { + case 1: + return "Prezzo+Sped. Percentile"; + case 2: + return "Prezzo+Sped.fissa"; + case 0: + return "Prezzo Senza Sped."; + } + return ""; + } + + public String getPriceTypeAmz() { + return getPriceTypeAmz(getFlgPriceTypeAmz()); + } + + public void setFlgModImportazione(long flgModImportazione) { + this.flgModImportazione = flgModImportazione; + } + + public static final String getEscludiWebArt(long l_flgEscludiWebArt) { + if (l_flgEscludiWebArt == -1L) + return "Da Tipo"; + if (l_flgEscludiWebArt == 1L) + return "Non Visibile"; + if (l_flgEscludiWebArt == 2L) + return "Sospeso"; + if (l_flgEscludiWebArt == 0L) + return "Visibile"; + return "??"; + } + + public static final String getGoogle(long l_flgGoogle) { + if (l_flgGoogle == 0L) + return "No"; + if (l_flgGoogle == 1L) + return "Free Listing"; + if (l_flgGoogle == 2L) + return "Full Listing (ads)"; + if (l_flgGoogle == 3L) + return "Search All (ads+free)"; + if (l_flgGoogle < 0L) + return ""; + return "??"; + } + + public final String getGoogle() { + return getGoogle(getFlgGoogle()); + } + + public static final String getEscludiWeb(long l_flgEscludiWebArt) { + return getEscludiWebArt(l_flgEscludiWebArt); + } + + public String getEscludiWebArt() { + return getEscludiWebArt(getFlgEscludiWebArt()); + } + + public void caricaImmaginaDaRemoto(String urlImage) { + caricaImmaginaDaRemoto(urlImage, 1L); + } + + public void caricaImmaginaDaRemoto(String urlImage, long imgNumber) { + if (getDBState() == 1) { + String filename = getDocBase() + getDocBase() + getPathImg(); + DBAdapter.getFileFromUrl(urlImage, filename); + } + } + + public long getFlgDisponibilitaWeb() { + return this.flgDisponibilitaWeb; + } + + public void setFlgDisponibilitaWeb(long flgDisponibilita) { + this.flgDisponibilitaWeb = flgDisponibilita; + } + + public static final String getDisponibilitaWeb(long l_flgDisponibilita) { + if (l_flgDisponibilita == 0L) + return "Disponibile"; + if (l_flgDisponibilita == 1L) + return "In Ordine"; + if (l_flgDisponibilita == 2L) + return "Non Disponibile"; + return "??"; + } + + public String getDisponibilitaWeb() { + return getDisponibilitaWeb(getFlgDisponibilitaWeb()); + } + + public String getCodicePrimoLiberoBySerie(String serie) { + long numDaSottrarre = Long.valueOf(serie) * 10000L; + String s_Sql_Find = " SELECT * FROM ( select codice as idorig, CONVERT(codice,UNSIGNED INTEGER)-" + numDaSottrarre + " as idn, (@row_number:=@row_number + 1) AS codice from ARTICOLO WHERE codice like '" + serie + "%' order by codice) AS B WHERE B.idn<>B.codice limit 1;"; + try { + update("SET @row_number = 0;"); + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find); + Vectumerator vec = findRows(stmt); + if (!vec.hasMoreElements()) + return serie + "0001"; + Articolo art = (Articolo)vec.nextElement(); + return serie + serie; + } catch (Exception e) { + handleDebug(e); + return ""; + } + } + + public String getEscludiWeb() { + return getEscludiWebArt(getFlgEscludiWeb()); + } + + public ResParm creaFileXmlGoogleOLD(ArticoloCR CR) { + int numRecord = 0; + ResParm rp = new ResParm(true); + try { + String googleFile = "google_" + System.currentTimeMillis() + ".xml"; + String filename = getDocBase() + getDocBase() + getParm("PATH_TMP").getTesto(); + new File(filename).delete(); + FileWr outFile = new FileWr(filename, "UTF-8", false); + CR.setFlgGoogle(1L); + Vectumerator vec = findByCR(CR, 0, 0); + String title = getParm("TITLE").getTesto(); + String site = getParm("P_WWW_ADDRESS").getTesto(); + outFile.writeLine(""); + outFile.writeLine(""); + outFile.writeLine(" " + title + ""); + outFile.writeLine(" "); + outFile.writeLine(" " + String.valueOf(getTimestamp()) + ""); + StringBuffer temp = new StringBuffer(); + String lt = "<", gt = ">", ltc = ""); + LinkedHashMap product = rowbean.getRecordXmlGoogle(CR.getLang()); + for (Map.Entry entry : product.entrySet()) { + temp = new StringBuffer(" "); + temp.append(lt); + temp.append(entry.getKey()); + temp.append(gt); + String value = entry.getValue(); + if (value.indexOf(">") >= 0) + value = value.replace(">", ">"); + if (value.indexOf("<") >= 0) + value = value.replace("<", "<"); + temp.append(value); + temp.append(ltc); + temp.append(entry.getKey()); + temp.append(gt); + outFile.writeLine(temp.toString()); + } + outFile.writeLine(" "); + } + outFile.writeLine(""); + outFile.closeFile(); + rp.setStatus(true); + rp.setReturnObj(googleFile); + rp.setMsg("Generazione file GOOGLE XML avvenuta con successo.
Numero Record: " + numRecord); + } catch (Exception e) { + handleDebug(e); + rp.setException(e); + rp.setStatus(false); + } + return rp; + } + + private String findByCRCreateSmartSearchWC(String searchTxt, String searchColumn) { + StringBuilder sb = new StringBuilder(); + String LIKE_START = " like '%"; + String LIKE_END = "%' "; + String P_OPEN = "("; + String P_CLOSE = ")"; + String OR = " OR "; + String AND = " AND "; + if (!searchTxt.isEmpty() && !searchTxt.equals("*")) { + StringTokenizer st = new StringTokenizer(searchTxt, " "); + StringBuffer txt = new StringBuffer("("); + String token2 = null; + Vector vt = findByCRCreateSmartSearchBuildTokenVector(searchTxt); + if (vt.size() == 0) + return ""; + sb.append("("); + if (vt.size() == 1) { + sb.append(searchColumn); + sb.append(" like '%"); + sb.append(vt.get(0)); + sb.append("%' "); + } else { + for (int i = 0; i < vt.size() - 1; i++) { + for (int j = i + 1; j < vt.size(); j++) { + sb.append("("); + sb.append(searchColumn); + sb.append(" like '%"); + sb.append(vt.get(i)); + sb.append("%' "); + sb.append(" AND "); + sb.append(searchColumn); + sb.append(" like '%"); + sb.append(vt.get(j)); + sb.append("%' "); + sb.append(")"); + if (i != vt.size() - 2 || j != vt.size() - 1) + sb.append(" OR "); + } + } + } + sb.append(")"); + } + return sb.toString(); + } + + public String findWebByArticoloCRCreateSmartSearchOccurrence(String searchTxt, String searchColumn) { + StringBuilder sb = new StringBuilder(); + if (!searchTxt.isEmpty() && !searchTxt.equals("*")) { + String CHAR_LEN = "LEAST(1,CHAR_LENGTH("; + String CHAR_LEN_REPLACE = ") - CHAR_LENGTH( REPLACE ("; + String P_OPEN = "("; + String P_CLOSE = ")"; + String COMMA = ","; + String APX = "'"; + StringTokenizer st = new StringTokenizer(searchTxt, " "); + StringBuffer txt = new StringBuffer("("); + String token2 = null; + Vector vt = findByCRCreateSmartSearchBuildTokenVector(searchTxt); + if (vt.size() > 0) { + sb.append("("); + for (int i = 0; i < vt.size(); i++) { + sb.append("LEAST(1,CHAR_LENGTH("); + sb.append(searchColumn); + sb.append(") - CHAR_LENGTH( REPLACE ("); + sb.append(searchColumn); + sb.append(","); + sb.append("'"); + sb.append(vt.get(i)); + sb.append("'"); + sb.append(","); + sb.append("'"); + String temp = String.format("%" + vt.get(i).length() - 1 + "s", "").replace(' ', 'x'); + sb.append(temp); + sb.append("'"); + sb.append(")"); + sb.append(")"); + sb.append(")"); + if (i < vt.size() - 1) + sb.append("+"); + } + sb.append(") as occorrenze "); + } + } + return sb.toString(); + } + + private Vector findByCRCreateSmartSearchBuildTokenVector(String searchTxt) { + if (!searchTxt.isEmpty() && !searchTxt.equals("*")) { + StringTokenizer st = new StringTokenizer(searchTxt, " "); + StringBuffer txt = new StringBuffer("("); + String token2 = null; + Vector vt = new Vector<>(); + while (st.hasMoreTokens()) { + String token = prepareInputMySqlString(st.nextToken(), true); + if (token.length() > 1) { + vt.add(token); + if (token.contains(",")) { + token2 = token.replace(",", "."); + } else if (token.contains(".")) { + token2 = token.replace(".", ","); + } else { + token2 = null; + } + if (token2 != null) + vt.add(token2); + } + } + return vt; + } + return null; + } + + public ResParm creaFileCsvFacebooke(ArticoloCR CR) { + int numRecord = 0; + ResParm rp = new ResParm(true); + try { + String filename = getDocBase() + getDocBase() + "facebook.csv"; + new File(filename).delete(); + FileWr outFile = new FileWr(filename, "UTF-8", false); + Vectumerator vec = findByCR(CR, 0, 0); + outFile.writeLine(""); + outFile.writeLine(" TuttoFoto.com Online Store"); + outFile.writeLine(" "); + outFile.writeLine(" " + String.valueOf(getTimestamp()) + ""); + StringBuffer temp = new StringBuffer(); + String lt = "<", gt = ">", ltc = ""); + LinkedHashMap product = rowbean.getRecordXmlGoogle(CR.getLang()); + for (Map.Entry entry : product.entrySet()) { + temp = new StringBuffer(" "); + temp.append(lt); + temp.append(entry.getKey()); + temp.append(gt); + String value = entry.getValue(); + if (value.indexOf(">") >= 0) + value = value.replace(">", ">"); + if (value.indexOf("<") >= 0) + value = value.replace("<", "<"); + temp.append(value); + temp.append(ltc); + temp.append(entry.getKey()); + temp.append(gt); + outFile.writeLine(temp.toString()); + } + outFile.writeLine(" "); + } + outFile.writeLine(""); + outFile.closeFile(); + rp.setStatus(true); + rp.setMsg("Generazione file GOOGLE XML avvenuta con successo.
Numero Record: " + numRecord); + } catch (Exception e) { + handleDebug(e); + rp.setException(e); + rp.setStatus(false); + } + return rp; + } + + public ByteArrayOutputStream creaListinoPdf(ArticoloCR CR) { + boolean debug = false; + String debugInfo = "Articolo.creaListinoPdf "; + NumberFormat nf3 = NumberFormat.getInstance(); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf0 = NumberFormat.getInstance(); + nf0.setMaximumFractionDigits(0); + nf0.setMinimumFractionDigits(0); + int col1 = 3, col2 = 5, col3 = 20, col4 = 4, col5 = 2, col6 = 6; + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + String titoloReport = ""; + try { + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 10.0F, 10.0F); + titoloReport = "Listino Prodotti"; + int cellLeading = 8; + SimpleDateFormat tf = new SimpleDateFormat("HH:mm:ss"); + Date today = getToday(); + titoloReport = titoloReport + ". Stampato il " + titoloReport + " " + getDataFormat().format(today); + this.writer = PdfWriter.getInstance(this.document, ba); + Phrase pH = new Phrase(titoloReport + " - Pag. n. "); + HeaderFooter header = new HeaderFooter(pH, true); + header.setAlignment(2); + header.setBorder(0); + this.document.setHeader(header); + this.document.open(); + creaIntestazioneReport(titoloReport, CR.getDescrizioneCR()); + Cell blankCell = new Cell(); + blankCell.addElement(new Chunk(" ", PdfFontFactory.PDF_A_PiccoloBianco)); + blankCell.setBorder(0); + blankCell.setColspan(40); + this.pdfcorpo.addCell(blankCell); + Cell cell = new Cell(); + cell.addElement(new Chunk("Codice", PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col1); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Marca", PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col2); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Descrizione", PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col3); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Scaffale", PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col4); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Giac.", PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col5); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Prezzo Pub. con iva", PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col6); + this.pdfcorpo.addCell(cell); + CR.setFlgOrderBy(2L); + Vectumerator vec = findByCR(CR, 0, 0); + long currentTipo = -1L; + while (vec.hasMoreElements()) { + Articolo rowArticolo = (Articolo)vec.nextElement(); + if (debug) + System.out.println(debugInfo + debugInfo + " - " + rowArticolo.getNome()); + cell = new Cell(); + cell.addElement(new Chunk(rowArticolo.getCodice(), PdfFontFactory.PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col1); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(rowArticolo.getMarca().getDescrizione(), PdfFontFactory.PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col2); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk( + rowArticolo.getTipo().getDescrizione() + " - " + rowArticolo.getTipo().getDescrizione(), PdfFontFactory.PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col3); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(rowArticolo.getScaffale(), PdfFontFactory.PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col4); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(nf0.format(rowArticolo.getQuantita()), PdfFontFactory.PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(col5); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + if (rowArticolo.getFlgNoleggio() == 1L) { + cell.addElement(new Chunk("Nol.: " + + getNf().format(rowArticolo.getPrezzoNoleggioIva()), PdfFontFactory.PDF_fPiccolo)); + } else if (rowArticolo.getFlgNoleggio() == 2L) { + cell.addElement(new Chunk("Nol.: " + + getNf().format(rowArticolo.getPrezzoNoleggioIva()), PdfFontFactory.PDF_fPiccolo)); + cell.addElement(new Chunk("\nVend.:" + + getNf().format(rowArticolo.getPrezzoBaseIva()), PdfFontFactory.PDF_fPiccolo)); + } else { + cell.addElement(new Chunk(getNf().format(rowArticolo.getPrezzoBaseIva()), PdfFontFactory.PDF_fPiccolo)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(col6); + this.pdfcorpo.addCell(cell); + } + this.document.add((Element)this.pdfcorpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public static final String aggiustaStringaNumero(String numero, boolean isLocale) { + if (isLocale) { + if (numero.indexOf(".") > 0) + numero = numero.replace(".", ""); + if (numero.indexOf(",") > 0) + numero = numero.replace(",", "."); + } else if (numero.indexOf(",") > 0) { + numero = numero.replace(",", ""); + } + return numero; + } + + public static final synchronized ResParm aggiornaListino(ApplParmFull apFull, String filename) { + String TAG_THREAD_MSG = "aggiorna LISTINO "; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(apFull, "aggiorna LISTINO ", "...inizio ..."); + ResParm rp = new ResParm(true); + String testata = "Cod.Art."; + long totRighe = 0L; + int se1 = 10; + int se2 = 100; + long articoliTrovati = 0L, articoliAggiornati = 0L, articoliNonTrovati = 0L; + boolean isLocale = apFull.getParm("DOCBASE").getTesto().contains("acolzi"); + System.out.println("aggiornaListino: islocale: " + isLocale); + try { + Workbook wb = null; + wb = Workbook.getWorkbook(new File(filename)); + Sheet sheet = wb.getSheet(0); + int numero_righe_vuote = 0; + int i = 1; + while (numero_righe_vuote < 10) { + jxl.Cell cellCodice = null; + try { + cellCodice = sheet.getCell(0, i); + } catch (Exception e) {} + if (cellCodice != null) { + jxl.Cell cellPrezzoAcquisto = sheet.getCell(4, i); + jxl.Cell cellPrezzoVendita = sheet.getCell(5, i); + String s = cellCodice.getContents(); + s = s.trim(); + if (s.endsWith(",00")) + s = s.substring(0, s.length() - 3); + if (!s.isEmpty()) { + numero_righe_vuote = 0; + Articolo articolo = new Articolo(apFull); + articolo.findByCodiceFornitoreSerie(s, ""); + if (articolo.getDBState() == 1) { + articoliTrovati++; + String pa = cellPrezzoAcquisto.getContents().trim(); + NumberFormulaCell cell = (NumberFormulaCell)cellPrezzoAcquisto; + double paValue = cell.getValue(); + pa = String.valueOf(paValue); + String paDB = String.valueOf(articolo.getCostoNetto()); + if (!pa.isEmpty() && !paDB.equals(pa)) { + articolo.setCostoNetto(paValue); + articolo.superSave(); + } + String pv = cellPrezzoVendita.getContents().trim(); + NumberCell cellPV = (NumberCell)cellPrezzoVendita; + double pvValue = cellPV.getValue(); + pv = String.valueOf(pvValue); + String pvDB = String.valueOf(articolo.getPrezzoBase()); + ListinoArticolo la = articolo.getListinoArticoloBase(); + if (!pv.isEmpty()) { + if (!pvDB.equals(pv)) + la.setPrezzoLA(pvValue); + if (!pvDB.equals(pv) || !paDB.equals(pa)) { + articoliAggiornati++; + la.save(); + } + } + } else { + articoliNonTrovati++; + } + } else { + numero_righe_vuote++; + } + StatusMsg.updateMsgByTag(apFull, "aggiorna LISTINO ", "Controllo Listino in corso: righe processate: " + i + " articoli aggiornati: " + articoliAggiornati + " TROVATI: " + articoliTrovati + " NON TROVATI: " + articoliNonTrovati); + i++; + if (i == 528) + System.out.println("pioooo"); + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + continue; + } + numero_righe_vuote++; + } + System.out.println("Fine"); + String str = "Articoli trovati: " + articoliTrovati + "
articoli NON trovati: " + articoliNonTrovati + "
articoli aggiornati: " + articoliAggiornati; + totRighe = (long)i; + rp.setMsg("Import listino xls eseguito con successo.
" + str); + } catch (Exception e) { + e.printStackTrace(); + } + timer.stop(); + StatusMsg.updateMsgByTag(apFull, "aggiorna LISTINO ", "Import listino xls eseguito con successo.Righe processate: " + totRighe + " durata: " + + timer.getDurataSec() + " sec."); + StatusMsg.deleteMsgByTag(apFull, "aggiorna LISTINO "); + String msg = "Articoli trovati: " + articoliTrovati + "
articoli NON trovati: " + articoliNonTrovati + "
articoli aggiornati: " + articoliAggiornati; + return rp; + } + + public static final synchronized ResParm confrontaListinoXls(ApplParmFull apFull, String filename) { + String TAG_THREAD_MSG = "CONFRONTA LISTINO "; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(apFull, "CONFRONTA LISTINO ", "...inizio ..."); + ResParm rp = new ResParm(true); + boolean debug = false; + String testata = "Cod.Art."; + long totRighe = 0L; + int i = 0; + int se1 = 10; + int se2 = 100; + String codiceFornitore = ""; + String articoloTrovato = ""; + boolean isLocale = apFull.getParm("DOCBASE").getTesto().contains("acolzi"); + System.out.println("confrontaListinoXls: islocale: " + isLocale); + try { + Workbook wb = null; + WritableWorkbook copy = null; + WritableFont arial12font = new WritableFont(WritableFont.ARIAL, 12); + arial12font.setColour(Colour.WHITE); + WritableFont arial12fontBlack = new WritableFont(WritableFont.ARIAL, 12); + WritableCellFormat arial12dgreen = new WritableCellFormat(arial12font); + WritableCellFormat arial12green = new WritableCellFormat(arial12fontBlack); + WritableCellFormat arial12orange = new WritableCellFormat(arial12font); + WritableCellFormat arial12red = new WritableCellFormat(arial12font); + WritableCellFormat arial12Normale = new WritableCellFormat(arial12fontBlack); + arial12dgreen.setBackground(Colour.DARK_GREEN); + arial12green.setBackground(Colour.LIGHT_GREEN); + arial12orange.setBackground(Colour.ORANGE); + arial12red.setBackground(Colour.DARK_RED); + wb = Workbook.getWorkbook(new File(filename)); + Articolo articolo = new Articolo(apFull); + copy = Workbook.createWorkbook(new File( + articolo.getDocBase() + articolo.getDocBase() + "controllo_listino_" + articolo.getParm("PATH_TMP").getTesto() + ".xls"), wb); + WritableSheet sheet = copy.getSheet(0); + int numero_righe_vuote = 0, numArticoliTrovati = 0, numArticoliNonTrovati = 0; + i = 1; + int colCodice = 0, colPrezzoAcquisto = 4, colPrezzoVendita = 5, colPrezzoAcquistoDB = 6, colRicaricoDb = 7; + int colPrezzoVenditaDb = 8, colVenditaNuova = 9, colVisibile = 10, colFamiglia = 11, colSottofamiglia = 12; + int colCodiceTF = 13; + while (numero_righe_vuote < 10) { + WritableCell cellCodice = sheet.getWritableCell(colCodice, i); + WritableCell cellPrezzoAcquisto = sheet.getWritableCell(colPrezzoAcquisto, i); + WritableCell cellPrezzoVendita = sheet.getWritableCell(colPrezzoVendita, i); + WritableCell cellPrezzoAcquistoDB = sheet.getWritableCell(colPrezzoAcquistoDB, i); + WritableCell cellRicaricoDB = sheet.getWritableCell(colRicaricoDb, i); + WritableCell cellPrezzoVenditaDB = sheet.getWritableCell(colPrezzoVenditaDb, i); + WritableCell cellVenditaNuova = sheet.getWritableCell(colVenditaNuova, i); + WritableCell cellVisibile = sheet.getWritableCell(colVisibile, i); + WritableCell cellFamiglia = sheet.getWritableCell(colFamiglia, i); + WritableCell cellSottofamiglia = sheet.getWritableCell(colSottofamiglia, i); + WritableCell cellCodiceTF = sheet.getWritableCell(colCodiceTF, i); + Label label = new Label(4, i, ""); + String s = cellCodice.getContents(); + s = s.trim(); + if (!s.isEmpty()) { + numero_righe_vuote = 0; + System.out.println("" + i + ": " + i); + articolo.findByCodiceFornitoreSerie(s, ""); + codiceFornitore = s; + articoloTrovato = ""; + if (articolo.getDBState() == 1) { + Number number; + numArticoliTrovati++; + articoloTrovato = articolo.getCodice() + " - " + articolo.getCodice(); + if (articolo.getFlgEscludiWeb() == 0L) { + label = new Label(colVisibile, i, "VISIBILE", (CellFormat)arial12dgreen); + sheet.addCell((WritableCell)label); + } else if (articolo.getFlgEscludiWeb() == 2L) { + label = new Label(colVisibile, i, "SOSPESO", (CellFormat)arial12orange); + sheet.addCell((WritableCell)label); + } else if (articolo.getFlgEscludiWeb() == 1L) { + label = new Label(colVisibile, i, "NON VISIBILE", (CellFormat)arial12orange); + sheet.addCell((WritableCell)label); + } + String pa = cellPrezzoAcquisto.getContents().trim(); + NumberFormulaCell cell = (NumberFormulaCell)cellPrezzoAcquisto; + double paValue = cell.getValue(); + pa = String.valueOf(paValue); + if (debug) + System.out.println("CONFRONTA LISTINO pa:" + pa + " pavalue: " + paValue); + String tt = cellPrezzoVendita.getContents().trim(); + String paDB = String.valueOf(articolo.getCostoNetto()); + if (paDB.equals(pa)) { + number = new Number(colPrezzoAcquistoDB, i, articolo.getCostoNetto(), (CellFormat)arial12dgreen); + } else { + number = new Number(colPrezzoAcquistoDB, i, articolo.getCostoNetto(), (CellFormat)arial12orange); + } + sheet.addCell((WritableCell)number); + String pv = cellPrezzoVendita.getContents().trim(); + if (debug) + System.out.println("CONFRONTA LISTINO pv:" + pv); + String pvDB = String.valueOf(articolo.getPrezzoBase()); + if (pvDB.equals(pv)) { + number = new Number(colPrezzoVenditaDb, i, articolo.getPrezzoBase(), (CellFormat)arial12dgreen); + } else { + number = new Number(colPrezzoVenditaDb, i, articolo.getPrezzoBase(), (CellFormat)arial12orange); + } + sheet.addCell((WritableCell)number); + label = new Label(colRicaricoDb, i, "" + articolo.getPercRicarico() + " (" + articolo.getPercRicarico() + ")", (CellFormat)arial12Normale); + sheet.addCell((WritableCell)label); + pa = aggiustaStringaNumero(pa, isLocale); + try { + if (debug) + System.out.println("CONFRONTA LISTINO ricaricoeffettivodacostonetto:" + + articolo.getRicaricoEffettivoDaCostoNetto() + " pavalue: " + paValue); + Double paD = paValue; + DoubleOperator dop = new DoubleOperator(articolo.getRicaricoEffettivoDaCostoNetto()); + dop.add(100); + dop.multiply(paD.doubleValue()); + dop.divide(100.0F); + dop.setScale(2, 5); + number = new Number(colVenditaNuova, i, dop.getResult(), (CellFormat)arial12Normale); + sheet.addCell((WritableCell)number); + } catch (Exception e) { + if (debug) { + System.out.println("CONFRONTA LISTINO eccezione:"); + e.printStackTrace(); + } + label = new Label(colVenditaNuova, i, "ERR. NUMERO " + pa, (CellFormat)arial12red); + sheet.addCell((WritableCell)label); + } + label = new Label(colFamiglia, i, articolo.getTipo().getTipoPadre().getDescrizione(), (CellFormat)arial12Normale); + sheet.addCell((WritableCell)label); + label = new Label(colSottofamiglia, i, articolo.getTipo().getDescrizione(), (CellFormat)arial12Normale); + sheet.addCell((WritableCell)label); + label = new Label(colCodiceTF, i, articolo.getCodice(), (CellFormat)arial12Normale); + sheet.addCell((WritableCell)label); + } else { + numArticoliNonTrovati++; + label = new Label(colVisibile, i, "NON TROVATO", (CellFormat)arial12red); + sheet.addCell((WritableCell)label); + } + } else { + numero_righe_vuote++; + } + StatusMsg.updateMsgByTag(apFull, "CONFRONTA LISTINO ", " righe processate: " + i + " trovati: " + numArticoliTrovati + " NON Trovati: " + numArticoliNonTrovati); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + System.out.println("Fine"); + totRighe = (long)i; + rp.setMsg("Import listino xls e confronto eseguito con successo: Clicca qui per aprire il file"); + copy.write(); + copy.close(); + } catch (Exception e) { + System.out.println("ERRORE!!! riga " + i + " cod. fornitore: " + codiceFornitore + " articolo: " + articoloTrovato); + rp.setStatus(false); + rp.setMsg(e); + } + timer.stop(); + StatusMsg.updateMsgByTag(apFull, "CONFRONTA LISTINO ", "Controllo listino xls eseguito con successo. Righe processate: " + totRighe + " durata: " + + timer.getDurataSec() + " sec."); + StatusMsg.deleteMsgByTag(apFull, "CONFRONTA LISTINO "); + System.out.println("DURATA: " + timer.getDurataSec() + " sec. Risultato CONFRONTO:\n" + rp.getMsg() + "\n\nCONTROLLO LISTINO concluso\n****************"); + return rp; + } + + public double getPrezzoPubblicoIvaOrd() { + if (getFlgNoleggio() == 1L) + return getPrezzoNoleggioIva(); + return getPrezzoPubblicoIva(); + } + + public void setPrezzoPubblicoIvaOrd(double prezzoPubblicoIvaOrd) { + this.prezzoPubblicoIvaOrd = prezzoPubblicoIvaOrd; + } + + private String getRecordCsvMultigestionale() { + StringBuffer temp = new StringBuffer(); + String sep = ";"; + String nome = getMarca().getDescrizione() + " " + getMarca().getDescrizione(); + if (!getDescTxtLangScript("nomeMarketplace", "it").isEmpty()) + nome = getDescTxtLangScript("nomeMarketplace", "it").replaceAll("€", "€").replace(";", " "); + String descrizioneSubito = getDescTxtLangScript("descrizioneMarketplace", "it"); + if (descrizioneSubito.isEmpty()) + descrizioneSubito = getDescTxtLangScript("descrizioneCommerciale", "it"); + if (descrizioneSubito.isEmpty()) + descrizioneSubito = nome; + descrizioneSubito = convertHtmlToString(descrizioneSubito); + descrizioneSubito = descrizioneSubito.replace("\n", "
"); + descrizioneSubito = descrizioneSubito.replace(";", " "); + temp.append(getCodice()); + temp.append(sep); + temp.append(nome); + temp.append(sep); + temp.append(descrizioneSubito); + temp.append(sep); + long prPubblicoConIva = Math.round(getPrezzoPubblicoIva()); + if ((double)prPubblicoConIva != getPrezzoPubblicoIva()) + System.out.println("getRecordCsvMultigestionale: prezzo arrotondato. " + getPrezzoPubblicoIva() + " --> " + prPubblicoConIva); + temp.append(prPubblicoConIva); + temp.append(".00"); + temp.append(sep); + temp.append(getNf0().format(getQuantita())); + temp.append(sep); + String imageName = getPathImg() + getPathImg(); + String imageFileName = getDocBase() + getDocBase(); + if (new File(imageFileName).exists()) { + temp.append(getWwwAddressParm() + getWwwAddressParm()); + } else { + temp.append(" "); + } + temp.append(sep); + boolean primaImmagine = true; + for (int i = 2; i < 20; i++) { + imageName = getPathImg() + getPathImg(); + imageFileName = getDocBase() + getDocBase(); + if (new File(imageFileName).exists()) { + if (primaImmagine) { + primaImmagine = false; + } else { + temp.append(","); + } + temp.append(getWwwAddressParm() + getWwwAddressParm()); + } + } + if (primaImmagine) + temp.append(" "); + temp.append(sep); + temp.append(getCodiceEan()); + temp.append(sep); + temp.append(""); + temp.append(sep); + temp.append(getMarca().getDescrizione()); + return temp.toString(); + } + + public ResParm creaFileCvsSubito_it(ArticoloCR CR) { + int numRecord = 0; + ResParm rp = new ResParm(true); + try { + String fileCsv = "exportSubito" + CR.getId_users() + "_" + getNow().getTime() + ".csv"; + CR.setFileName(fileCsv); + String filename = getDocBase() + getDocBase() + getParm("PATH_TMP").getTesto(); + new File(filename).delete(); + FileWr outFile = new FileWr(filename, "UTF-8", false); + String intestazione = "id;title;description;price;quantity;image_link;additional_image_link;gtin;sku_code;brand"; + CR.setFlgSubito(1L); + Vectumerator vec = findByCR(CR, 0, 0); + String s1 = intestazione; + outFile.writeLine(s1); + Articolo currentArticolo = null; + double qtaVenduta = 0.0D; + long numVendite = 0L; + while (vec.hasMoreElements()) { + Articolo rowbean = (Articolo)vec.nextElement(); + if (rowbean.getPrezzoPubblico() > 0.0D) { + s1 = rowbean.getRecordCsvMultigestionale(); + outFile.writeLine(s1); + } + } + outFile.closeFile(); + rp.setStatus(true); + rp.setMsg("Generazione file report vendite avvenuta con successo.
Numero Record: " + numRecord); + } catch (Exception e) { + handleDebug(e); + rp.setException(e); + rp.setStatus(false); + } + return rp; + } + + public long getFlgSubito() { + return this.flgSubito; + } + + public void setFlgSubito(long flgSubito) { + this.flgSubito = flgSubito; + } + + public ResParm cambiaFlg(String l_flg) { + ResParm rp = new ResParm(true); + if (getId_tipo() > 0L) { + if (l_flg.equals("flgNascondi")) { + setFlgNascondi((getFlgNascondi() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgEbay")) { + setFlgEbay((getFlgEbay() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgAmazon")) { + setFlgAmazon((getFlgAmazon() == 0L) ? 1L : ((getFlgAmazon() == 1L) ? 2L : 0L)); + } else if (l_flg.equals("flgSubito")) { + setFlgSubito((getFlgSubito() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgRateale0")) { + setFlgRateale0((getFlgRateale0() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgGoogle")) { + setFlgGoogle((getFlgGoogle() + 1L) % 3L); + } else if (l_flg.equals("flgTrovaprezzi")) { + setFlgTrovaprezzi((getFlgTrovaprezzi() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgIdealo")) { + setFlgIdealo((getFlgIdealo() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgEbay")) { + setFlgEbay((getFlgEbay() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgEscludiWebArt")) { + setFlgEscludiWebArt((getFlgEscludiWebArt() == 0L) ? 1L : ((getFlgEscludiWebArt() == 1L) ? 2L : 0L)); + } else if (l_flg.equals("flgModImportazione")) { + setFlgModImportazione(9L); + } + rp = save(); + } else { + rp.setStatus(false); + rp.setMsg("Tipo non trovato!"); + } + return rp; + } + + public String getTagArticolo() { + return (this.tagArticolo == null) ? "" : this.tagArticolo.trim(); + } + + public void setTagArticolo(String tag) { + this.tagArticolo = tag; + } + + public double getPercScontoRispettoAOfferta() { + if (!isOffertaValida() || getPrezzoBaseIva() == 0.0D) + return 0.0D; + DoubleOperator dop = new DoubleOperator(getPriceWVat()); + dop.setScale(2, 5); + dop.divide(getPrezzoBaseIva()); + dop.multiply(100); + dop.subtract(100); + return dop.getResult(); + } + + public String getCodicePromozioneA() { + return (this.codicePromozioneA == null) ? "" : this.codicePromozioneA.trim(); + } + + public void setCodicePromozioneA(String codicePromozioneA) { + this.codicePromozioneA = codicePromozioneA; + } + + public double getStreetPriceIva() { + return DBAdapter.conIva(this.streetPrice, (double)getIva().getAliquota()); + } + + public double getCostoPrecedente() { + return this.costoPrecedente; + } + + public double getCostoPrecedenteiva() { + return DBAdapter.conIva(getCostoPrecedente(), (double)getIva().getAliquota()); + } + + public void setCostoPrecedente(double costoPrecedente) { + this.costoPrecedente = costoPrecedente; + } + + public double getImponibilePrecedente() { + return this.imponibilePrecedente; + } + + public double getImponibilePrecedenteIva() { + return DBAdapter.conIva(getImponibilePrecedente(), (double)getIva().getAliquota()); + } + + public void setImponibilePrecedente(double imponibilePrecedente) { + this.imponibilePrecedente = imponibilePrecedente; + } + + public String getCodicePromozione() { + return getCodicePromozioneA(); + } + + public ByteArrayOutputStream creaRegistroDaVidimare(RegistroUsato ru) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + int pageNumber = 1; + long l_id = 0L; + ResParm rp = new ResParm(false, "Attenzione! Creazione file registro usato fallita miseramente!"); + ru.setResParm(rp); + try { + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + int cellLeading = 8; + float imgLogoWidth = 100.0F; + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + if (imgLogoWidth > 0.0F) + imgLogo.scaleToFit(imgLogoWidth, imgLogoWidth); + imgLogo.scaleToFit(imgLogoWidth, imgLogoWidth); + Cell cell1 = new Cell(); + cell1.add(new Chunk(imgLogo, 0.0F, 0.0F)); + String header = getParm("HEAD_DOC1").getTesto(); + cell1.add(new Chunk("\n" + header, PDF_fPiccolissimo)); + cell1.setLeading(10.0F); + cell1.setColspan(8); + cell1.setBorder(0); + Cell cell2 = new Cell(); + header = getParm("HEAD_DOC2").getTesto(); + cell2.add(new Chunk(header, PDF_fPiccolissimo)); + cell2.setLeading(10.0F); + cell2.setBorder(0); + cell2.setColspan(7); + Cell cellSpazio = new Cell(); + cellSpazio.add(new Chunk("", PDF_fPiccolissimo)); + cellSpazio.setLeading(10.0F); + cellSpazio.setBorder(0); + cellSpazio.setColspan(20); + for (int i = (int)ru.getPaginaInizio(); (long)i < ru.getPaginaFine(); i += 2) { + this.pdfcorpo = new Table(20); + this.pdfcorpo.setWidth(100.0F); + this.pdfcorpo.setPadding(2.0F); + this.pdfcorpo.setSpacing(0.0F); + this.pdfcorpo.setWidths(colWidthsRighe20); + this.pdfcorpo.setBorder(0); + this.pdfcorpo.addCell(cell1); + this.pdfcorpo.addCell(cell2); + Cell cell = new Cell(); + cell.add(new Chunk("" + i, PDF_fMedioB)); + cell.setLeading(10.0F); + cell.setBorder(0); + cell.setHorizontalAlignment(2); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + for (int j = 0; j < 65; j++) + this.pdfcorpo.addCell(cellSpazio); + this.pdfcorpo.addCell(cell1); + this.pdfcorpo.addCell(cell2); + cell = new Cell(); + cell.add(new Chunk("" + i + 1, PDF_fMedioB)); + cell.setLeading(10.0F); + cell.setBorder(0); + cell.setHorizontalAlignment(2); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + this.document.newPage(); + } + this.document.close(); + this.document = null; + String nomeFile = "regusato_" + Calendar.getInstance().getTimeInMillis() + ".pdf"; + createFileFromByteArray(ba, nomeFile); + System.out.println("Creato file registro usato " + nomeFile); + ru.setFileName(nomeFile); + ru.setResParm(new ResParm(true, "File registro usato da vidimare creato correttamente")); + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public boolean isPrezzoBarratoValido() { + if (getPrezzoIvatoBarrato() > 0.0D && getPrezzoIvatoBarrato() > getPrezzoPubblicoIva(null)) + return true; + return false; + } + + public boolean isPrezzoVenditaSalito() { + if (getImponibilePrecedente() > 0.0D && getImponibilePrecedente() < getPrezzoBase()) + return true; + return false; + } + + public boolean isPrezzoVenditaSceso() { + if (getImponibilePrecedente() > 0.0D && getImponibilePrecedente() > getPrezzoBase()) + return true; + return false; + } + + public boolean isCostoAcquistoSalito() { + if (getCostoPrecedente() > 0.0D && getCostoNuovo() > 0.0D && getCostoPrecedente() < getCostoNuovo()) + return true; + return false; + } + + public boolean isCostoAcquistoSceso() { + if (getCostoPrecedente() > 0.0D && getCostoNuovo() > 0.0D && getCostoPrecedente() > getCostoNuovo()) + return true; + return false; + } + + public String getCCLinkDettaglioCanonical(String lang) { + ArticoloCR CR = new ArticoloCR(); + CR.setLang(lang); + return getWwwAddressParm() + getWwwAddressParm(); + } + + public String getCCLinkDettaglio() { + ArticoloCR CR = new ArticoloCR(getApFull()); + if (getId_articoloTaglia() > 0L) { + CR.setId_articoloTaglia(getId_articoloTaglia()); + CR.setId_taglia(getArticoloTaglia().getId_taglia()); + if (getId_articoloVariante() > 0L) { + if (getId_articoloVarianteKit() > 0L) { + CR.setId_articoloVarianteKit(getId_articoloVarianteKit()); + return getCCLinkDettaglioTK(CR); + } + return getCCLinkDettaglioT(CR); + } + return getCCLinkDettaglioT(CR); + } + return getCCLinkDettaglioA(CR); + } + + public String getCCLinkDettaglioA(ArticoloCR CR) { + String lang = (CR == null || CR.getLang().isEmpty()) ? "it" : CR.getLang(); + StringBuilder sb = new StringBuilder(); + StringBuilder sbCmd = new StringBuilder(); + if (getId_articoloVariante() == 0L) { + sb.append(convertStringToLink(getDescrizioneNomeUrl()).toLowerCase()); + } else { + sb.append(convertStringToLink(getArticoloVariante().getDescrizioneNomeUrl()).toLowerCase()); + } + sb.append("-"); + if (!getTipo().getDescrizioneLink(lang).isEmpty()) { + sb.append(getTipo().getDescrizioneLink(lang).replace(" ", "-").toLowerCase()); + } else { + sb.append(getTipo().getDescrizioneCompletaMinus(lang).toLowerCase()); + } + sb = new StringBuilder(eliminaDoppioniInStringa(sb.toString().toLowerCase(), "-", 1, false)); + sbCmd.append("+"); + sbCmd.append("d"); + sbCmd.append("-"); + sbCmd.append(getId_articolo()); + sbCmd.append("-"); + sbCmd.append((getId_articoloVariante() == 0L) ? "" : getId_articoloVariante()); + sbCmd.append("-"); + if (CR != null) + sbCmd.append(CR.getSearchTxtWeb()); + sbCmd.append("-"); + sbCmd.append(lang); + sbCmd.append(".html"); + if (getParm("CC_LINK_WEB_CON_MARCA").isTrue()) + if (sb.toString().toLowerCase().indexOf(getMarca().getDescrizione().toLowerCase()) < 0) + sb.insert(0, getMarca().getDescrizione().toLowerCase() + "-"); + long realMaxlinkLength = 80L - (long)getWwwAddressParm().length(); + if ((long)(sb.length() + sbCmd.length()) > realMaxlinkLength) { + if (realMaxlinkLength - (long)sbCmd.length() + 1L > 0L) { + String pre = sb.substring(0, (int)(realMaxlinkLength - (long)sbCmd.length() + 1L)); + if (pre.lastIndexOf("-") > 0) + pre = pre.substring(0, pre.lastIndexOf("-")); + return pre.toLowerCase() + pre.toLowerCase(); + } + return sb.toString().toLowerCase() + sb.toString().toLowerCase(); + } + return sb.toString().toLowerCase() + sb.toString().toLowerCase(); + } + + public static final String getCCSeoMinimalTemplate(String template, long maxSize, long parmSize) { + if ((long)template.length() + parmSize - 1L <= maxSize) + return template; + StringTokenizer st = new StringTokenizer(template, "."); + LinkedHashSet tokenPreTag = new LinkedHashSet<>(); + LinkedHashSet tokenPostTag = new LinkedHashSet<>(); + String tokenTag = ""; + boolean tagFound = false; + while (st.hasMoreTokens()) { + String token = st.nextToken(); + if (token.indexOf("#") >= 0) { + tokenTag = token; + tagFound = true; + continue; + } + if (tagFound) { + tokenPostTag.add(token); + continue; + } + tokenPreTag.add(token); + } + StringBuilder sbResult = new StringBuilder(); + boolean maxSizeSuperata = false; + for (String token : tokenPreTag) { + if ((long)(token.length() + tokenTag.length() + 2) + parmSize <= maxSize) { + sbResult.append(token); + sbResult.append(". "); + continue; + } + maxSizeSuperata = true; + break; + } + if (!maxSizeSuperata) { + sbResult.append(tokenTag); + sbResult.append(". "); + for (String token : tokenPostTag) { + if ((long)(token.length() + sbResult.length() + 2) + parmSize <= maxSize) { + sbResult.append(token); + sbResult.append(". "); + continue; + } + maxSizeSuperata = true; + break; + } + } + return sbResult.toString().trim(); + } + + public String getCCLinkDettaglioFullMessaging(ArticoloCR CR) { + return (Attivita.getDefaultInstance(getApFull()).getWwwAddress() + Attivita.getDefaultInstance(getApFull()).getWwwAddress()).replace("+", "%2B"); + } + + public String getTFLinkDettaglio2(ArticoloCR CR) { + String lang = (CR == null || CR.getLang().isEmpty()) ? "it" : CR.getLang(); + StringBuilder sb = new StringBuilder(); + sb.append(convertStringToLink(getMarca().getDescrizione())); + sb.append("-"); + sb.append(convertStringToLink(getDescrizioneNomeUrl())); + sb.append("-"); + sb.append(getTipo().getDescrizioneCompletaPlus(lang)); + sb.append("-"); + if (CR == null) { + sb.append("articolo"); + } else { + sb.append(translate("articolo", lang)); + } + sb.append("-"); + sb.append(getId_articolo()); + sb.append("-"); + sb.append((getId_articoloVariante() == 0L) ? "" : getId_articoloVariante()); + sb.append("-"); + sb.append(lang); + sb.append(".html"); + return sb.toString(); + } + + public String getCCLinkDettaglioT(ArticoloCR CR) { + StringBuilder sb = new StringBuilder(); + sb.append(convertStringToLink(getDescrizioneNomeUrl())); + sb.append("-"); + sb.append(getTipo().getDescrizioneCompletaMinus(CR.getLang())); + sb.append("+"); + sb.append("dt"); + sb.append("-"); + sb.append(getId_articolo()); + sb.append("-"); + sb.append((getId_articoloVariante() == 0L) ? "" : getId_articoloVariante()); + sb.append("-"); + sb.append((CR.getId_taglia() == 0L) ? "" : CR.getId_taglia()); + sb.append("-"); + sb.append(CR.getSearchTxtWeb()); + sb.append("-"); + sb.append(CR.getLang()); + sb.append(".html"); + return sb.toString().toLowerCase(); + } + + public String getCCLinkDettaglioTK(ArticoloCR CR) { + StringBuilder sb = new StringBuilder(); + sb.append(convertStringToLink(getDescrizioneNomeUrl())); + sb.append("-"); + sb.append(getTipo().getDescrizioneCompletaMinus(CR.getLang())); + sb.append("+"); + sb.append("dtk"); + sb.append("-"); + sb.append(getId_articolo()); + sb.append("-"); + sb.append((getId_articoloVariante() == 0L) ? "" : getId_articoloVariante()); + sb.append("-"); + sb.append((CR.getId_taglia() == 0L) ? "" : CR.getId_taglia()); + sb.append("-"); + sb.append((getId_articoloVarianteKit() == 0L) ? "" : getId_articoloVarianteKit()); + sb.append("-"); + sb.append(CR.getSearchTxtWeb()); + sb.append("-"); + sb.append(CR.getLang()); + sb.append(".html"); + return sb.toString().toLowerCase(); + } + + public String getCCLinkDettaglioKitTK_XXXXX(ArticoloCR CR) { + StringBuilder sb = new StringBuilder(); + sb.append(convertStringToLink(getDescrizioneNomeUrl())); + sb.append("-"); + sb.append(getTipo().getDescrizioneCompletaPlus(CR.getLang())); + sb.append("+"); + sb.append("dktk"); + sb.append("-"); + sb.append(getId_articolo()); + sb.append("-"); + sb.append((getId_articoloVariante() == 0L) ? "" : getId_articoloVariante()); + sb.append("-"); + sb.append((CR.getId_taglia() == 0L) ? "" : CR.getId_taglia()); + sb.append("-"); + sb.append((getId_articoloVarianteKit() == 0L) ? "" : getId_articoloVarianteKit()); + sb.append("-"); + sb.append(CR.getSearchTxtWeb()); + sb.append("-"); + sb.append(CR.getLang()); + sb.append(".html"); + return sb.toString(); + } + + public String getCCLinkEbay() { + if (getEbayOfferId().isEmpty() || getEbayItemId().isEmpty()) + return ""; + return "https://www.ebay.it/itm/" + getEbayItemId(); + } + + public String getCCLinkAddItemRow(ArticoloCR CR) { + StringBuilder sb = new StringBuilder(); + sb.append("+"); + sb.append("addItemRow"); + sb.append("-"); + sb.append(getId_articolo()); + sb.append("-"); + sb.append("1"); + sb.append("-"); + sb.append(CR.getFlgTipoVisualizzazione()); + sb.append("-"); + sb.append(CR.getId_tipoSel()); + sb.append("-"); + sb.append(CR.getFiltri_id()); + sb.append("-"); + sb.append(CR.getSearchTxtWeb()); + sb.append("-"); + sb.append(CR.getFlgOrderBy()); + sb.append("-"); + sb.append(CR.getPageNumber()); + sb.append("-"); + sb.append(CR.getPageRow()); + sb.append(".html"); + return sb.toString(); + } + + public ResParm creaFileXmlIdealo(ArticoloCR CR) { + ResParm rp = creaFileXmlGoogle(CR, false, true); + String temp = (String)rp.getReturnObj(); + String fileXml = getDocBase() + getDocBase() + this.apFull.getParm("PATH_TMP").getTesto(); + String idealoFile = "_idealo/idealo-f3.xml"; + String idealoPermanentFileName = getDocBase() + getDocBase(); + try { + DBAdapter.copyFile(fileXml, idealoPermanentFileName); + rp.setMsg(rp.getMsg() + "
Copia su file IDEALO XML tmp " + rp.getMsg() + " avvenuta con successo."); + rp.setReturnObj(idealoFile); + } catch (Exception e) { + rp.setStatus(false); + rp.setException(e); + } + return rp; + } + + public ResParm creaFileTxtMicrosoft(ArticoloCR CR) { + ResParm rp = new ResParm(true); + String TAG_THREAD_MSG = "MICROSOFT MERCHANT CREAZIONE FILE "; + try { + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "creazione file txt...."); + boolean soloLink = false; + int numRecord = 0; + String tagIdealo = ""; + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + String msFile = "ms_" + System.currentTimeMillis() + ".xml"; + String filename = getDocBase() + getDocBase() + getParm("PATH_TMP").getTesto(); + String msPermanentFileName = getDocBase() + "_feed/" + getDocBase(); + File xmlFile = new File(filename); + String theDir = xmlFile.getAbsolutePath().substring(0, xmlFile.getAbsolutePath().lastIndexOf(File.separator) + 1); + File theDirFile = new File(theDir); + if (!theDirFile.exists()) + theDirFile.mkdirs(); + new File(filename).delete(); + File theDirFileMs = new File(getDocBase() + "_feed/"); + if (!theDirFileMs.exists()) + theDirFileMs.mkdirs(); + org.w3c.dom.Element e = null; + CR.setFlgGoogle(1L); + CR.setFlgReadyForWeb(1L); + CR.setFlgEscludiWeb(0L); + if (CR.getPrezzoDa() == 0.0D) + CR.setPrezzoDa(attivita.getPGooglePrezzoPubblicoMinimoXExport()); + if (CR.getQtaDa() == 0L && + attivita.getPGoogleQtaMinimaXExport() > 0L) { + CR.setQtaDa(attivita.getPGoogleQtaMinimaXExport()); + CR.setFlgQta(1L); + } + Vectumerator vec = findByCR(CR, 0, 0); + String title = getParm("TITLE").getTesto(); + String site = getParm("P_WWW_ADDRESS").getTesto(); + String lang = CR.getLang(); + if (lang.isEmpty()) { + lang = "it"; + CR.setLang(lang); + } + NumberFormat nf2 = NumberFormat.getInstance(Locale.US); + nf2.setMaximumFractionDigits(2); + nf2.setMinimumFractionDigits(2); + String wwwSite = getWwwAddressParm(); + FileWr fw = new FileWr(msPermanentFileName); + String SEP = "/t"; + String intestazione = "id/ttitle/tbrand/tlink/tprice/tdescription/timage_link/tmpn\tgtin/tavailability/tcondition/tproduct_type/tproduct_category/tbingads_grouping\tbingads_label/tcustom_label_0/tcustom_label_1/tcustom_label_2/tcustom_label_3/tcustom_label_4/tbingads_redirect/tsale_price/tsale_price_effective_date"; + fw.writeLine(intestazione); + int currentRecord = 0; + while (vec.hasMoreElements()) { + currentRecord++; + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "creazione file txt...." + currentRecord + " su " + + vec.getTotNumberOfRecords()); + Articolo rowbean = (Articolo)vec.nextElement(); + if (rowbean.getFlgUsaVarianti() == 0L) { + numRecord++; + fw.writeLine(rowbean.getRecordMicrosoftMerchant(lang, CR)); + boolean bool = false; + continue; + } + ArticoloVarianteCR CRAv = new ArticoloVarianteCR(); + CRAv.setId_articolo(rowbean.getId_articolo()); + CRAv.setFlgQta(CR.getFlgQta()); + CRAv.setQtaDa(CR.getQtaDa()); + CRAv.setQtaA(CR.getQtaA()); + Vectumerator vecAV = new ArticoloVariante(getApFull()).findByCR(CRAv, 0, 0); + while (vecAV.hasMoreElements()) { + ArticoloVariante rowAV = (ArticoloVariante)vecAV.nextElement(); + numRecord++; + } + } + fw.closeFile(); + rp.setStatus(true); + rp.setReturnObj(msFile); + rp.setMsg("Generazione file MICROSOFT TXT " + msPermanentFileName + " avvenuta con successo.
Numero Record: " + numRecord); + } catch (Exception e) { + handleDebug(e); + rp.setException(e); + rp.setStatus(false); + } + StatusMsg.deleteMsgByTag(getApFull(), TAG_THREAD_MSG); + return rp; + } + + public String getCCDataLayerDetail() { + return GoogleDataLayerBuilder.getDettaglioProdotto("eec.detail", this); + } + + public String getDispoLevelSchema() { + switch (getDispoLevel()) { + case 0: + return "https://schema.org/OutOfStock"; + case 1: + return "https://schema.org/LimitedAvailability"; + case 2: + return "https://schema.org/InStock"; + } + return ""; + } + + public long getFlgGoogleDB() { + return this.flgGoogleDB; + } + + public void setFlgGoogleDB(long flgGoogleDB) { + this.flgGoogleDB = flgGoogleDB; + } + + public ArticoloVariante getArticoloVarianteKit() { + this.articoloVarianteKit = (ArticoloVariante)getSecondaryObject(this.articoloVarianteKit, ArticoloVariante.class, + getId_articoloVarianteKit()); + return this.articoloVarianteKit; + } + + public long getId_articoloVarianteKit() { + return this.id_articoloVarianteKit; + } + + public void setArticoloVarianteKit(ArticoloVariante articoloVarianteKit) { + this.articoloVarianteKit = articoloVarianteKit; + } + + public void setId_articoloVarianteKit(long id_articoloVarianteKit) { + this.id_articoloVarianteKit = id_articoloVarianteKit; + setArticoloVarianteKit(null); + } + + public long getId_articoloTaglia() { + return this.id_articoloTaglia; + } + + public long getCountImportNonTrovato() { + return this.countImportNonTrovato; + } + + public void setCountImportNonTrovato(long countImportNonTrovato) { + this.countImportNonTrovato = countImportNonTrovato; + } + + public Date getDataUltimoImport() { + return this.dataUltimoImport; + } + + public void setDataUltimoImport(Date dataUltimoImport) { + this.dataUltimoImport = dataUltimoImport; + } + + public String getCodiciAlternativiLink() { + StringBuilder sb = new StringBuilder(); + sb.append(""); + sb.append(getCodice()); + sb.append(" "); + Clifor fornitore = new Clifor(this.apFull); + Vectumerator vecFor = fornitore.findFornitoriConImportPrefissoCodice(); + HashMap hmCodici = new HashMap<>(); + while (vecFor.hasMoreElements()) { + Clifor row = (Clifor)vecFor.nextElement(); + hmCodici.put(row.getImportPrefissoCodice(), row); + } + StringTokenizer st = new StringTokenizer(getCodiciAlternativi(), ","); + try { + while (st.hasMoreTokens()) { + String token = st.nextToken(); + int idx_ = token.indexOf("_"); + if (idx_ > 0) { + String prefix = token.substring(0, idx_); + String codiceFornitore = token.substring(idx_ + 1); + if (hmCodici.get(prefix) != null) { + fornitore = hmCodici.get(prefix); + if (!fornitore.getImportLinkFornitore().isEmpty()) { + hmCodici.remove(codiceFornitore); + sb.append(""); + sb.append(token); + sb.append(" "); + if (st.hasMoreTokens()) + sb.append(","); + } + } + } + } + String codice = getCodiceEan(); + if (codice.isEmpty()) + codice = getCodiceProduttore(); + if (!codice.isEmpty()) + for (Map.Entry me : hmCodici.entrySet()) { + fornitore = me.getValue(); + if (!fornitore.getImportLinkFornitoreEan().isEmpty()) { + sb.append(""); + sb.append(me.getKey()); + sb.append("_*"); + sb.append(codice); + sb.append(" "); + } + } + return sb.toString().trim(); + } catch (Exception e) { + return getCodiciAlternativi(); + } + } + + public String getCCMetaDescriptionCalc(String lang) { + String modello = getTipo().getMetaDescTemplateLeafWeb(lang); + StringBuilder sb = new StringBuilder(); + if (!modello.isEmpty()) { + String tagDesc = getCCNome(lang).replace("(", "").replace(")", "").replace("\"", """); + String offerta = ""; + long parmSize = (long)tagDesc.length(); + if (isOffertaValida()) { + offerta = translate("Articolo in offerta", lang); + parmSize = parmSize + (long)offerta.length() + 2L; + } + modello = getCCSeoMinimalTemplate(modello, 150L, parmSize); + sb = new StringBuilder(modello.replace("#", tagDesc)); + if (isOffertaValida()) { + sb.append(". "); + sb.append(translate("Articolo in offerta", lang)); + } + return sb.toString(); + } + sb.append(getCCNome(lang)); + if ((long)(sb.length() + 1 + getTipo().getDescrizione(lang).length()) <= 150L) { + sb.append(" "); + sb.append(getTipo().getDescrizione(lang)); + } + if (!getCodiceProduttore().isEmpty() && + (long)(sb.length() + 1 + getCodiceProduttore().length()) <= 150L) { + sb.append(" "); + sb.append(getCodiceProduttore()); + } + if (!getCodiceEan().isEmpty() && + (long)(sb.length() + 1 + getCodiceEan().length()) <= 150L) { + sb.append(" "); + sb.append(getCodiceEan()); + } + StringBuilder sbCAR = new StringBuilder(); + Vectumerator vec = getCaratteristicheArticolo(); + while (vec.hasMoreElements()) { + CaratteristicaArticolo row = (CaratteristicaArticolo)vec.nextElement(); + if (sb.toString().toLowerCase().indexOf(row.getVal(lang).toLowerCase()) < 0) { + sbCAR.append(row.getVal(lang)); + if (vec.hasMoreElements()) + sbCAR.append(", "); + } + } + if (sbCAR.length() > 0 && + (long)(sb.length() + 1 + sbCAR.length()) <= 150L) { + sb.append(" "); + sb.append(sbCAR.toString()); + } + if (isOffertaValida()) { + sb.append(" "); + sb.append(translate("articolo in offerta", lang)); + } + String result = sb.toString().replace("(", "").replace(")", "").replace("\"", """); + return eliminaDoppioniInStringa(result); + } + + public String getCCSeoTitle(String lang) { + if (!getSeoTitle(lang).isEmpty()) + return getSeoTitle(lang); + return getCCSeoTitleCalc(lang); + } + + public String getCCSeoTitleCalc(String lang) { + String descTipo; + StringBuilder sb = new StringBuilder(); + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + sb.append(getCCNome(lang)); + if (!getTipo().getDescrizioneSeo(lang).isEmpty()) { + descTipo = getTipo().getDescrizioneSeo(lang); + } else { + descTipo = getTipo().getDescrizioneCompletaSpaces(lang); + } + int sbLen = sb.length() + descTipo.length(); + if ((long)sbLen < 60L) { + sb.append(" "); + sb.append(descTipo); + if ((long)(sb.length() + attivita.getNomeAttivitaSeo().length()) < 60L) { + sb.append(" | "); + sb.append(Attivita.getDefaultInstance(getApFull()).getNomeAttivitaSeo()); + } + } else if ((long)sb.length() > 60L) { + if (!getCodiceProduttore().isEmpty()) { + String title = sb.toString().substring(0, sb.toString().lastIndexOf(" ")).trim(); + if ((long)title.length() <= 60L) + return title; + } + sb = new StringBuilder(); + if (!getCodiceProduttore().isEmpty()) { + sb.append(getMarca().getDescrizione()); + sb.append(" "); + sb.append(getCodiceProduttore()); + } else { + sb.append(getCCNome(lang)); + } + sbLen = sb.length() + descTipo.length(); + if ((long)sbLen < 60L) { + sb.append(" "); + sb.append(descTipo); + if ((long)(sb.length() + attivita.getNomeAttivitaSeo().length()) < 60L) { + sb.append(" | "); + sb.append(Attivita.getDefaultInstance(getApFull()).getNomeAttivitaSeo()); + } + } + } else { + return sb.toString(); + } + return + + eliminaDoppioniInStringa(sb.toString()); + } + + public String getCCKeyword(String lang) { + StringBuilder sb = new StringBuilder(); + if (!getCodiceProduttore().isEmpty()) { + sb.append(getCodiceProduttore()); + sb.append(", "); + } + sb.append(getDescrizioneCompleta(lang).replace(", ", ".").replace(" ", ", ")); + sb.append(", "); + sb.append(getTipo().getDescrizioneCompletaKeyword(lang)); + if (!getCodiceEan().isEmpty()) { + sb.append(", "); + sb.append(getCodiceEan()); + } + String result = sb.toString().replace(" ,", ", ").replace(",,", ", ").replace("/", " "); + return convertStringToHtml(eliminaDoppioniInStringa(result, 1, true)); + } + + public Vectumerator findByCRMagazzino(ArticoloCR CR, int pageNumber, int pageRows) { + boolean flgOttimizzo = false; + if (pageNumber == 0 && pageRows == 0) + flgOttimizzo = false; + StringBuffer s_Sql_Find = new StringBuffer("SELECT A.* , SUM(M.kg) as kg, SUM(M.mt) as mt, SUM(M.nr) as nr FROM MOVIMENTO AS M INNER JOIN ARTICOLO AS A ON A.id_articolo=M.id_articolo "); + String s_Sql_GrouBy = " group by M.id_articolo"; + WcString s_sql_havinng = new WcString(); + String s_Sql_Order = " order by A.nome"; + if (!CR.getFlgReport().isEmpty()) { + s_Sql_Order = " order by C.descrizioneCompleta,C.descrizione, A.nome"; + } else if (CR.getFlgOrderBy() == 0L) { + s_Sql_Order = " order by A.nome " + CR.getFlgOrderType(); + } else if (CR.getFlgOrderBy() == 1L) { + s_Sql_Order = " order by M.descrizione " + CR.getFlgOrderType() + ", A.codice, A.nome " + CR.getFlgOrderType(); + } else if (CR.getFlgOrderBy() == 2L) { + s_Sql_Order = " order by C.descrizione , A.nome "; + } else if (CR.getFlgOrderBy() == 3L) { + s_Sql_Order = " order by C.descrizione desc , A.nome desc"; + } else if (CR.getFlgOrderBy() == 4L) { + s_Sql_Order = " order by A.prezzoPubblico , C.descrizione , A.nome"; + } else if (CR.getFlgOrderBy() == 5L) { + s_Sql_Order = " order by A.prezzoPubblico desc , C.descrizione ,A.nome"; + } + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + if (CR.getDataMovimento() != null) { + s_Sql_Find.append(" inner join RIGA_DOCUMENTO AS RD ON M.id_rigaDocumento=RD.id_rigaDocumento inner join DOCUMENTO as DOC on RD.id_documento=DOC.id_documento"); + wc.addWc("DOC.dataDocumento<=?"); + } + if (CR.getFlgQta() == 1L) + if (CR.getQtaDa() == 0L) { + s_sql_havinng.addHavingWc("nr<=" + CR.getQtaA()); + } else { + s_sql_havinng.addHavingWc("nr<=" + CR.getQtaA()); + s_sql_havinng.addHavingWc("nr>=" + CR.getQtaDa()); + } + try { + PreparedStatement stmt; + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_GrouBy + s_sql_havinng.toString()); + } else { + if (pageNumber == 0) + pageNumber = 1; + int start = (pageNumber - 1) * pageRows; + int stop = start + pageRows; + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_GrouBy + s_sql_havinng.toString() + " limit " + s_Sql_Order + "," + start); + } + findByCRCreateStmtDate(CR, stmt); + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + Vectumerator vectumerator = findRows(stmt, pageNumber, pageRows); + if (!CR.getFlgReport().isEmpty()); + return vectumerator; + } + Vectumerator vec = findRows(stmt, 1, pageRows); + vec.setPageNumber(pageNumber); + vec.setTotNumberOfRecords(findByCRTotRecord(CR)); + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getSitemapPriority() { + return this.sitemapPriority; + } + + public String getSitemapPriorityReal() { + if (getSitemapPriority() > 100L || getSitemapPriority() == 50L || getSitemapPriority() < 0L) + return ""; + double sp = (double)getSitemapPriority() / 100.0D; + return String.valueOf(sp); + } + + public void setSitemapPriority(long sitemapPriority) { + this.sitemapPriority = sitemapPriority; + } + + public ResParm aggiornaPrezziEDispoByFornitori(double lastStreetprice, boolean isNuovo) { + ResParm rp = new ResParm(false); + boolean debug = false; + if (getId_articolo() > 0L) { + if (debug) + System.out.println("######## aggiornaPrezziEDispoByFornitori: " + getEscludiWeb() + " " + getId_articolo() + " " + + getCodice() + " qt: " + getQuantita() + " acq.:" + getCostoAcquisto() + " ---->"); + ArticoloFornitore af = new ArticoloFornitore(getApFull()); + af.findPiuConvenienteByArticolo(getId_articolo()); + if (af.getId_articolo() > 0L && af.getFornitore().getFlgAbilitaAF() == 1L && + af.getCostoTotale() > af.getFornitore().getValoreMinimoAbilitaAF()) { + if (af.getDispTotR() > 0L) { + setQuantita((double)af.getDispTotR()); + if (getId_fornitoreCostoNuovo() != af.getId_fornitore() || getCostoNetto() != af.getCostoTotale()) { + setCostoNuovo(af.getCostoTotale()); + setId_fornitoreCostoNuovo(af.getId_fornitore()); + if (af.isPromoAttiva()) { + setDataScadenzaOffertaFornitore(af.getDataFinePromo()); + } else { + setDataScadenzaOffertaFornitore(null); + } + aggiornaPrezzoNettoConCostoNuovo(); + if (!isNuovo) + setFlgModImportazione(2L); + } else { + setCostoNuovo(0.0D); + if (!isNuovo) + setFlgModImportazione(3L); + if (af.isPromoAttiva()) { + setDataScadenzaOffertaFornitore(af.getDataFinePromo()); + } else { + setDataScadenzaOffertaFornitore(null); + } + } + Double streetprice = Math.max(af.getStreetPrice(), lastStreetprice); + if (streetprice > 0.0D) + setStreetPrice(streetprice.doubleValue()); + streetprice = getStreetPrice(); + if (streetprice <= 0.0D || getPrezzoArticolo(null).getPrezzoBase() > streetprice); + } else { + System.out.println("aggiornaPrezziEDispoByFornitori ATTENZIONE!!!! NON DOVREI ESSERE QUI!!!!"); + setQuantita(0.0D); + setFlgModImportazione(2L); + } + } else { + if (getQuantita() != 0.0D) { + setFlgModImportazione(2L); + setQuantita(0.0D); + } else { + setFlgModImportazione(3L); + } + if (debug) + System.out.println(" aggiornaPrezziEDispoByFornitori NON HO NESSUN RECORD ARTICOLO FORNITORE..."); + } + if (getQuantita() == 0.0D) { + if (getFlgEscludiWebArt() == 0L); + } else if (getFlgEscludiWebArt() == 2L && getId_tipo() > 0L) { + setFlgEscludiWebArt(0L); + } + rp = superSave(); + if (debug) + System.out.println("--------> aggiornaPrezziEDispoByFornitori: " + getEscludiWeb() + " " + getId_articolo() + " " + + getCodice() + " qt: " + getQuantita() + " acq.:" + getCostoAcquisto() + "\n###########"); + } + return rp; + } + + public static synchronized ResParm aggiornaDispoEPrezzoArticoloFornitore(Articolo bean, long qta, long l_flgEsculdiWeb, boolean aggiornaEbay) { + if (bean.getId_articolo() == 0L) + return new ResParm(true); + ResParm rp = new ResParm(true); + if (bean.getId_fornitoreCostoNuovo() > 0L && qta != 0L) { + ArticoloFornitore af = new ArticoloFornitore(bean.getApFull()); + af.findByFornitoreArticolo(bean.getId_fornitoreCostoNuovo(), bean.getId_articolo(), 1L); + if (af.getDBState() == 1) { + af.setDispSede(af.getDispSede() + qta); + rp = af.save(); + } + } + if (rp.getStatus()) { + rp = bean.aggiornaPrezziEDispoByFornitori(bean.getStreetPrice(), false); + if (rp.getStatus() && l_flgEsculdiWeb >= 0L) { + bean.setFlgEscludiWebArt(l_flgEsculdiWeb); + rp = bean.superSave(); + } + } + return rp; + } + + public ResParm aggiornaDispoEPrezziNonTrovatiByFornitori() { + ResParm rp = new ResParm(false); + boolean debug = false; + if (getId_articolo() > 0L) { + if (debug) + System.out.println("######## aggiornaDispoByFornitori: " + getEscludiWeb() + " " + getId_articolo() + " " + getCodice() + " qt: " + + getQuantita() + " acq.:" + getCostoAcquisto() + " ---->"); + ArticoloFornitore af = new ArticoloFornitore(getApFull()); + af.findPiuConvenienteByArticolo(getId_articolo()); + if (af.getId_articolo() > 0L) { + if (af.getDispTotR() > 0L) { + setQuantita((double)af.getDispTotR()); + if (getCostoNetto() != af.getCostoTotale()) { + setCostoNuovo(af.getCostoTotale()); + setId_fornitoreCostoNuovo(af.getId_fornitore()); + aggiornaPrezzoNettoConCostoNuovo(); + } else { + setCostoNuovo(0.0D); + } + Double streetprice = af.getStreetPrice(); + if (streetprice > 0.0D) + setStreetPrice(streetprice.doubleValue()); + streetprice = getStreetPrice(); + if (streetprice > 0.0D && getPrezzoArticolo(null).getPrezzoBase() > streetprice) { + ListinoArticolo listinoArticoloBase = getListinoArticoloBase(); + listinoArticoloBase.setPrezzoLA(streetprice.doubleValue()); + rp = listinoArticoloBase.save(); + } + } else { + System.out.println("aggiornaDispoByFornitori ATTENZIONE!!!! NON DOVREI ESSERE QUI!!!!"); + setQuantita(0.0D); + setFlgModImportazione(2L); + } + } else { + setQuantita(0.0D); + if (debug) + System.out.println(" aggiornaDispoByFornitori NON HO NESSUN RECORD ARTICOLO FORNITORE..."); + } + rp = superSave(); + if (debug) + System.out.println("--------> aggiornaDispoByFornitori: " + getEscludiWeb() + " " + getId_articolo() + " " + getCodice() + " qt: " + + getQuantita() + " acq.:" + getCostoAcquisto() + "\n###########"); + } + return rp; + } + + public String getKeywords() { + return (this.keywords == null) ? "" : this.keywords.trim(); + } + + public void setKeywords(String keywords) { + this.keywords = keywords; + } + + public String getReadyForWeb() { + return (this.readyForWeb == null) ? "" : this.readyForWeb.trim(); + } + + public void setReadyForWeb(String readyForWeb) { + this.readyForWeb = readyForWeb; + } + + public long getFlgB2b() { + return this.flgB2b; + } + + public void setFlgB2b(long flgB2b) { + this.flgB2b = flgB2b; + } + + public long getFlgB2bArt() { + return this.flgB2bArt; + } + + public void setFlgB2bArt(long flgB2bArt) { + this.flgB2bArt = flgB2bArt; + } + + public Vectumerator findWebByArticoloVarianteCROld(ArticoloCR CR, int pageNumber, int pageRows) { + StringBuffer s_Sql_Find = new StringBuffer("select A.* from ARTICOLO AS A left join ARTICOLO_VARIANTE AS B ON A.id_articolo=B.id_articolo left JOIN TIPO AS C2 ON A.id_tipo2=C2.id_tipo inner join TIPO AS C on C.id_tipo=A.id_tipo"); + if (!CR.getSearchTxtWeb().isEmpty() && !CR.getSearchTxtWeb().equals("*")) + s_Sql_Find = new StringBuffer("select A.* from ARTICOLO as A left join ARTICOLO_VARIANTE AS B ON A.id_articolo=B.id_articolo inner join DESC_TXT_LANG AS X ON A.id_articolo=X.idTabella LEFT JOIN TIPO AS C2 ON A.id_tipo2=C2.id_tipo inner join TIPO AS C on C.id_tipo=A.id_tipo"); + String s_Sql_Order = " order by A.ordine desc, C.ordine, A.id_articolo"; + s_Sql_Order = " order by A.ordine desc,C.ordine,A.nome, A.id_articolo"; + WcString wc = new WcString(); + findWebByArticoloVarianteCRCreateWCOld(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void findWebByArticoloVarianteCRCreateWCOld(ArticoloCR CR, StringBuffer s_Sql_Find, WcString wc) { + if (!CR.getSearchTxtWeb().isEmpty() && !CR.getSearchTxtWeb().equals("*")) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxtWeb().toLowerCase(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.nome like '%" + token + "%' or X.descrizione254 like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + if (txt.length() > 2) + wc.addWc(txt.toString()); + } + if (CR.getFlgEscludiWeb() == 0L) + wc.addWc("(A.flgEscludiWeb=0)"); + if (CR.getFlgNascondi() == 0L) { + wc.addWc("(A.flgNascondi=0 or A.flgNascondi is null)"); + wc.addWc("(B.flgNascondi=0 or B.flgNascondi is null)"); + wc.addWc("(C.flgNascondi=0 or C.flgNascondi is null)"); + } else if (CR.getFlgNascondi() > 0L) { + wc.addWc("A.flgNascondi=" + CR.getFlgNascondi()); + wc.addWc("B.flgNascondi=" + CR.getFlgNascondi()); + wc.addWc("C.flgNascondi=" + CR.getFlgNascondi()); + } + if (!CR.getFlgDisponibilita().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getFlgDisponibilita(), ","); + StringBuilder cli = new StringBuilder("("); + while (st.hasMoreTokens()) { + long token = Long.parseLong(st.nextToken()); + if (token == 1L) { + wc.addWc("A.flgNoleggio>0"); + continue; + } + if (token == 1L) + wc.addWc("A.quantita>0"); + } + } + if (CR.getFlgNoleggio() == 10L) + wc.addWc("A.flgNoleggio!=1"); + if (!CR.getCarId_listaS().isEmpty()) { + boolean needOr = false; + StringTokenizer st = new StringTokenizer(CR.getCarId_listaS(), ","); + StringBuilder cli = new StringBuilder("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + if (!token.isEmpty() && !token.equals("0")) { + if (token.startsWith("c")) { + if (st.hasMoreTokens()) { + cli.append(") and ( "); + needOr = false; + } + continue; + } + if (needOr) + cli.append(" or "); + cli.append("A.caratteristicheListeId like '%," + token + ",%'"); + needOr = true; + } + } + cli.append(")"); + if (cli.length() > 2) + wc.addWc(cli.toString()); + } + if (CR.getId_tipoSel() != 0L) + wc.addWc("(A.id_tipo=" + CR.getId_tipoSel() + " or C.indici like'%:" + CR.getId_tipoSel() + ":%'or A.id_tipo2=" + + CR.getId_tipoSel() + " or C2.indici like'%:" + CR.getId_tipoSel() + ":%')"); + if (CR.getPrezzoDa() > 0.0D) + wc.addWc("A.prezzoPubblicoIva>=" + CR.getPrezzoDa()); + if (CR.getPrezzoA() > 0.0D) + wc.addWc("A.prezzoPubblicoIva<=" + CR.getPrezzoA()); + } + + public String getEbayItemId() { + return (this.ebayItemId == null) ? "" : this.ebayItemId.trim(); + } + + public void setEbayItemId(String ebayItemId) { + this.ebayItemId = ebayItemId; + } + + public boolean isEbayAttivita() { + return Attivita.getDefaultInstance(getApFull()).isEbay(); + } + + public boolean isAmazonAttivita() { + return Attivita.getDefaultInstance(getApFull()).isAmz(); + } + + public String getEbayOfferId() { + return (this.ebayOfferId == null) ? "" : this.ebayOfferId.trim(); + } + + public void setEbayOfferId(String ebayOfferId) { + this.ebayOfferId = ebayOfferId; + } + + public ResParm cancellaArticoliVecchiCC(long countImportNonTrovatoDa) { + ResParm rp = new ResParm(); + int i = 0; + int se1 = 10; + int se2 = 100; + long artCancellati = 0L, artNonCancellati = 0L; + if (countImportNonTrovatoDa == 0L) + countImportNonTrovatoDa = 30L; + ArticoloCR CR = new ArticoloCR(); + CR.setFlgModImportazione(0L); + CR.setCountImportNonTrovatoDa(countImportNonTrovatoDa); + Vectumerator vec = findByCR(CR, 0, 0); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (row.getFlgEscludiWeb() > 0L) { + row.delete(); + artCancellati++; + } else { + artNonCancellati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " cancellati: " + i + " NON cancellati: " + artCancellati); + } + System.out.println("fine ciclo \nArt. cancellati: " + artCancellati + " NON cancellati: " + artNonCancellati); + rp.setStatus(true); + rp.setMsg("Art. cancellati: " + artCancellati + " NON cancellati: " + artNonCancellati); + return rp; + } + + public ResParm ebayPublishFull() { + ResParm rp = new ResParm(); + if (getId_articolo() == 0L) { + rp.setStatus(false); + rp.setMsg("Errore! Articolo nullo o non valido!"); + } else { + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + if (attivita.isEbayPubblicabile()) { + EbayAbliaApi ebay = new EbayAbliaApi(getApFull()); + if (ebay.isOAuthTokenValid()) { + EbayResult res = new EbayResult(); + res.setOk(true); + if (getEbayOfferId().isEmpty()) { + res = ebay.ebayCreateOrReplaceInventoryItem(this); + if (res.isOk()) + res = ebay.ebayCreateOffer(this); + if (res.isOk()) + res = ebay.ebayPublishOffer(this); + if (res.isOk()) { + rp.setStatus(true); + rp.setMsg("Articolo pubblicato correttamente: id offerta " + getEbayOfferId()); + } else { + rp.setStatus(false); + rp.setMsg("Errore! " + res.getMsg()); + } + } else { + res = ebay.ebayCreateOrReplaceInventoryItem(this); + if (res.isOk()) + res = ebay.ebayUpdateOffer(this); + if (res.isOk()) { + rp.setStatus(true); + rp.setMsg("Articolo aggiornato correttamente: id offerta " + getEbayOfferId()); + } else { + rp.setStatus(false); + rp.setMsg("Errore! " + res.getMsg()); + } + } + if (res.isOk() && + getEbayItemId().isEmpty()) { + System.out.println("ebaypublishfull: get offer.."); + res = ebay.ebayGetOffer(this); + if (res.isOk()) { + rp.setStatus(true); + rp.setMsg(rp.getMsg() + " itemid:" + rp.getMsg()); + System.out.println("ebaypublishfull: get offer.. itemid:" + getEbayItemId()); + } else { + rp.setStatus(false); + rp.setMsg(rp.getMsg() + " - Errore item id: " + rp.getMsg()); + } + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! User token non valido! Richiedere nuovo token oAuth!"); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! Mancano i profiles id su attivita!"); + } + } + return rp; + } + + public ResParm amzCatalogItem() { + ResParm rp = new ResParm(); + if (getId_articolo() == 0L) { + rp.setStatus(false); + rp.setMsg("Errore! Articolo nullo o non valido!"); + } else { + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + AmzSellerApi asa = new AmzSellerApi(attivita); + AmzResult aRes = asa.amzGetCatalogItems(this, "it"); + if (aRes.isOk()) { + rp.setStatus(true); + rp.setMsg(aRes.getMsg()); + } else { + rp.setStatus(false); + rp.setMsg("Errore! Oggetto con ean " + getCodiceEanNoZero() + " non trovato! " + aRes.getMsg()); + } + } + return rp; + } + + public ResParm amzPostPricing(ArticoloCR CR, String currentLang) { + ResParm rp = new ResParm(); + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + AmzSellerApi asa = new AmzSellerApi(attivita); + AmzResult aRes = asa.amzPostPricing(CR, currentLang); + if (aRes.isOk()) { + rp.setStatus(true); + rp.setMsg(aRes.getMsg()); + } else { + rp.setStatus(false); + rp.setMsg("Errore! " + aRes.getMsg()); + } + return rp; + } + + public ResParm amzUpdateOffer() { + ResParm rp = new ResParm(); + if (getId_articolo() == 0L) { + rp.setStatus(false); + rp.setMsg("Errore! Articolo nullo o non valido!"); + } else { + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + AmzSellerApi asa = new AmzSellerApi(attivita); + AmzResult aRes = asa.amzPutListingsItem(this, "it"); + if (aRes.isOk()) { + rp.setStatus(true); + rp.setMsg(aRes.getMsg()); + } else { + rp.setStatus(false); + rp.setMsg("Errore! " + aRes.getMsg()); + } + } + return rp; + } + + public ResParm amzUpdateOfferAuto() { + ResParm rp = new ResParm(); + if (getId_articolo() == 0L) { + rp.setStatus(false); + rp.setMsg("Errore! Articolo nullo o non valido!"); + } else { + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + AmzSellerApi asa = new AmzSellerApi(attivita); + AmzResult aRes = asa.amzPutListingsItem(this, "it"); + if (aRes.isOk()) { + rp.setStatus(true); + rp.setMsg(aRes.getMsg()); + if (getFlgAmazon() != 1L) { + setFlgAmazon(1L); + superSave(); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! Oggetto con ean " + getCodiceEanNoZero() + " non trovato!"); + if (getFlgAmazon() != 2L) { + setFlgAmazon(2L); + superSave(); + } + } + } + return rp; + } + + public ResParm amzDeleteItem() { + ResParm rp = new ResParm(); + if (getId_articolo() == 0L) { + rp.setStatus(false); + rp.setMsg("Errore! Articolo nullo o non valido!"); + } else { + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + AmzSellerApi asa = new AmzSellerApi(attivita); + AmzResult aRes = asa.amzDelListingsItem(this, "it"); + if (aRes.isOk()) { + rp.setStatus(true); + rp.setMsg(aRes.getMsg()); + if (getFlgAmazon() == 1L) { + setFlgAmazon(0L); + superSave(); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! Oggetto con ean " + getCodiceEanNoZero() + " non trovato!"); + if (getFlgAmazon() != 2L) { + setFlgAmazon(2L); + superSave(); + } + } + } + return rp; + } + + public ResParm ebayPublishUpdate() { + ResParm rp = new ResParm(); + if (getId_articolo() == 0L) { + rp.setStatus(false); + rp.setMsg("Errore! Articolo nullo o non valido!"); + } else { + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + if (attivita.isEbayPubblicabile()) { + EbayAbliaApi ebay = new EbayAbliaApi(getApFull()); + if (ebay.isOAuthTokenValid()) { + EbayResult res = new EbayResult(); + res.setOk(true); + if (getEbayOfferId().isEmpty()) { + rp.setStatus(false); + rp.setMsg("Errore! Offerid vuoto. !!"); + } else { + if (getQtaSuEbay() != getQtaEbayDaInviare()) + res = ebay.ebayCreateOrReplaceInventoryItem(this); + if (res.isOk()) + res = ebay.ebayUpdateOffer(this); + if (res.isOk()) { + rp.setStatus(true); + rp.setMsg("Articolo aggiornato correttamente: id offerta " + getEbayOfferId()); + } else { + rp.setStatus(false); + rp.setMsg("Errore! " + res.getMsg()); + } + if (res.isOk() && + getEbayItemId().isEmpty()) { + res = ebay.ebayGetOffer(this); + if (res.isOk()) { + rp.setStatus(true); + rp.setMsg(rp.getMsg() + " itemid:" + rp.getMsg()); + } else { + rp.setStatus(false); + rp.setMsg(rp.getMsg() + " - Errore item id: " + rp.getMsg()); + } + } + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! User token non valido! Richiedere nuovo token oAuth!"); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! Mancano i profiles id su attivita!"); + } + } + return rp; + } + + public ResParm ebayCreateUpdateItem() { + ResParm rp = new ResParm(); + if (getId_articolo() == 0L) { + rp.setStatus(false); + rp.setMsg("Errore! Articolo nullo o non valido!"); + } else { + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + if (attivita.isEbayPubblicabile()) { + EbayAbliaApi ebay = new EbayAbliaApi(getApFull()); + if (ebay.isOAuthTokenValid()) { + EbayResult res = new EbayResult(); + res.setOk(true); + res = ebay.ebayCreateOrReplaceInventoryItem(this); + if (res.isOk()) { + rp.setStatus(true); + rp.setMsg("Articolo inserito o aggiornato correttamente"); + } else { + rp.setStatus(false); + rp.setMsg("Errore! " + res.getMsg()); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! User token non valido! Richiedere nuovo token oAuth!"); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! Mancano i profiles id su attivita!"); + } + } + return rp; + } + + public Vectumerator findNCheckEbayArticoliInVendita() { + Vectumerator res = new Vectumerator(); + String TAG_THREAD_MSG = "CHECK GIACENZA EBAY "; + StatusMsg.updateMsgByTag(getApFull(), "CHECK GIACENZA EBAY ", "...inizio ..."); + EbayAbliaApi ebayApi = new EbayAbliaApi(getApFull()); + int pageRow = 100; + int pageNumber = 1; + int totEbayArt = 0; + EbayResult er = new EbayResult(); + Articolo bean = new Articolo(getApFull()); + HashSet hsItemid = new HashSet<>(); + do { + er = ebayApi.getEbayInventoryItems(pageNumber, pageRow); + if (!er.isOk()) + continue; + for (ItemType item : (ItemType[])er.getResult()) { + totEbayArt++; + StatusMsg.updateMsgByTag(getApFull(), "CHECK GIACENZA EBAY ", "" + totEbayArt + " - " + totEbayArt + " " + + item.getItemID() + " " + item.getSKU()); + if (hsItemid.contains(item.getItemID())) { + er.setOk(false); + break; + } + hsItemid.add(item.getItemID()); + bean = new Articolo(getApFull()); + bean.findByCodice(item.getSKU()); + if (bean.getId_articolo() > 0L) { + if (bean.getQuantita() <= 0.0D) { + bean.setNome(item.getItemID() + " " + item.getItemID()); + res.add(bean); + } + } else { + bean.setCodice(item.getSKU()); + bean.setNome(item.getItemID() + " " + item.getItemID() + " SU EBAY MA NON SUL DB."); + res.add(bean); + } + } + pageNumber++; + } while (er.isOk()); + StatusMsg.deleteMsgByTag(getApFull(), "CHECK GIACENZA EBAY "); + return res; + } + + public long getId_listinoEbay() { + if (this.id_listinoEbay == 0L && getApFull() != null) + this.id_listinoEbay = getTipo().getId_listinoEbay(); + return this.id_listinoEbay; + } + + public Listino getListinoEbay() { + this.listinoEbay = (Listino)getSecondaryObject(this.listinoEbay, Listino.class, getId_listinoEbay()); + return this.listinoEbay; + } + + public void setId_listinoEbay(long id_listinoEbay) { + this.id_listinoEbay = id_listinoEbay; + setListinoEbay(null); + } + + public void setListinoEbay(Listino listinoEbay) { + this.listinoEbay = listinoEbay; + } + + public double getPrezzoSuEbayIva() { + return this.prezzoSuEbayIva; + } + + public void setPrezzoSuEbayIva(double prezzoSuEbayIva) { + this.prezzoSuEbayIva = prezzoSuEbayIva; + } + + public String getTFLinkDettaglioPre14_12_2020(ArticoloCR CR) { + String lang = (CR == null || CR.getLang().isEmpty()) ? "it" : CR.getLang(); + StringBuilder sb = new StringBuilder(); + sb.append(convertStringToLink(getMarca().getDescrizione()).replace('+', '-')); + sb.append("-"); + sb.append(getTipo().getDescrizione(lang)); + sb.append("-"); + sb.append(convertStringToLink(getDescrizioneNomeUrl()).replace('+', '-')); + sb.append("+"); + if (CR == null) { + sb.append("articolo"); + } else { + sb.append(translate("articolo", lang)); + } + sb.append("-"); + sb.append(getId_articolo()); + sb.append("-"); + sb.append((getId_articoloVariante() == 0L) ? "" : getId_articoloVariante()); + sb.append("-"); + sb.append(lang); + sb.append(".html"); + return sb.toString(); + } + + public long getQtaEbay() { + return this.qtaEbay; + } + + public long getQtaEbayDaInviare() { + if (getQtaEbay() == 0L) + return (long)getAvail(); + return (long)Math.min((double)getQtaEbay(), getAvail()); + } + + public long getQtaAmzDaInviare() { + if (getQtaAmz() == 0L) + return (long)getQuantitaEffettiva(); + return (long)Math.min((double)getQtaAmz(), getQuantitaEffettiva()); + } + + public boolean isEbayPrezzoQtaAllineati() { + if (getPrezzoArticoloEbayIva().getPrezzoFinale() != getPrezzoSuEbayIva() || getQtaSuEbay() != getQtaEbayDaInviare()) + return false; + return true; + } + + public boolean isAmzPrezzoQtaAllineati() { + if (getPrezzoArticoloAmazonIva().getPrezzoFinale() != getPrezzoSuAmzIva() || getQtaSuAmz() != getQtaEbayDaInviare()) + return false; + return true; + } + + public boolean isAmazonPrezzoQtaAllineati() { + if (getPrezzoArticoloAmazonIvaExport("it", 1L) != getPrezzoSuAmzIva() || getQtaSuAmz() != getQtaAmzDaInviare()) + return false; + return true; + } + + public static final void addImpression(Articolo bean) { + bean.setImpression(bean.getImpression() + 1L); + bean.setTmstLastImpression(DBAdapter.getTimestamp()); + bean.superSave(); + } + + public void setQtaEbay(long qtaEbay) { + this.qtaEbay = qtaEbay; + } + + public long getQtaSuEbay() { + return this.qtaSuEbay; + } + + public void setQtaSuEbay(long qtaSuEbay) { + this.qtaSuEbay = qtaSuEbay; + } + + public long getImpression() { + return this.impression; + } + + public void setImpression(long impression) { + this.impression = impression; + } + + public Timestamp getTmstLastImpression() { + return this.tmstLastImpression; + } + + public void setTmstLastImpression(Timestamp tmstLastImpression) { + this.tmstLastImpression = tmstLastImpression; + } + + public final ResParm startThreadAllineaEbay(ApplParmFull apFull, ArticoloCR CR) { + if (!isThreadAllineaArticoloEbay()) { + new ThreadAllineaEbay(apFull, CR); + return new ResParm(true, "Thread allinea ebay avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public final ResParm startThreadAllineaAmz(ApplParmFull apFull, ArticoloCR CR) { + return startThreadAllineaAmz2(apFull, CR); + } + + public final ResParm startThreadAllineaAmz2(ApplParmFull apFull, ArticoloCR CR) { + if (!isThreadAllineaArticoloAmz()) { + new ThreadAllineaAmz(this, apFull, CR); + return new ResParm(true, "Thread allinea amz avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public final ResParm startThreadCreaSitemaps(ApplParmFull apFull, ArticoloCR CR) { + if (!isThreadCreateSitemaps()) { + threadCreaSitemaps = true; + ThreadCreaSitemaps t = new ThreadCreaSitemaps(apFull, CR); + t.start(); + ResParm rp = new ResParm(true, "Thread crea sitemaps avviato"); + rp.setExtraInfo("thread", t); + return rp; + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public final ResParm startThreadPostItemOfferAmz(ApplParmFull apFull, ArticoloCR CR) { + if (!isThreadPostItemOfferAmz()) { + new ThreadAmzPostItemsOffersBatch(this, apFull, CR); + return new ResParm(true, "Thread post item offer batch avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public static boolean isThreadAllineaArticoloEbay() { + return threadAllineaArticoloEbay; + } + + public static boolean isThreadAllineaArticoloAmz() { + return threadAllineaArticoloAmz; + } + + public static boolean isThreadCreateSitemaps() { + return threadCreaSitemaps; + } + + public static boolean isThreadCancellazione() { + return threadCancellazione; + } + + public static boolean isThreadIcecatAuto() { + return threadIcecatAuto; + } + + public String getCartItemDescriptionCC(String lang) { + String space = " "; + StringBuilder sb = new StringBuilder(); + if (getId_articoloVariante() > 0L) { + sb.append(getArticoloVariante().getCartItemDescription(lang)); + } else { + sb.append(getCCNome(lang)); + } + if (getId_articoloVarianteKit() > 0L) { + sb.append(" "); + sb.append("+"); + sb.append(" "); + sb.append(getArticoloVarianteKit().getCCNome(lang)); + } + if (getId_articoloTaglia() > 0L) { + sb.append(" "); + sb.append(getArticoloTaglia().getTaglia().getCodice()); + } + return sb.toString(); + } + + public final ResParm sendAmzUpdateResultByEmail(ApplParmFull apFull, String title, Vectumerator vec, String msg) { + ResParm rp = new ResParm(); + String TDAP = "
"; + String fileName = apFull.getParm("DOCBASE").getTesto() + "admin/art/_mailMessage/amzUpdate.html"; + MailMessage mm = new MailMessage(apFull, fileName); + NumberFormat nf = apFull.getNf(); + Articolo articolo = new Articolo(apFull); + ArticoloCR CR = new ArticoloCR(); + StringBuilder sb = new StringBuilder(); + mm.setDate("data", DBAdapter.getToday()); + mm.setString("risultato", msg); + String oggettoMessaggio = title + " " + title + " " + String.valueOf(DBAdapter.getToday()); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + String notes = row.getBeanNotes(); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + if (row.getFlgAmzWarn() == 1L) { + sb.append(""); + sb.append(""); + sb.append("\n"); + } + sb.append("
"); + sb.append(""); + sb.append(""); + sb.append(""); + StringTokenizer st = new StringTokenizer(articolo.getDescrizionePerMail(true), "|"); + while (st.hasMoreTokens()) { + sb.append(""); + } + sb.append(""); + this.CR.setFlgIcecatAuto(1L); + this.CR.setFlgReadyForWeb(0L); + this.CR.setLangReadyForWeb("it"); + String l_icecatLang = Articolo.this.getParm("LANG_AVAILABLE").getTesto(); + boolean caricaImmagini = true; + String previewSizeAllImages = "66"; + String previewSizeImage1 = "50,200,350"; + Vectumerator vec = articolo.findByCR(this.CR, 0, 0); + int i = 0, icecatOK = 0, icecatKO = 0, totRecordIcecat = 0; + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + boolean isIcecatOk = false; + if (debug) + System.out.println("ICECAT AUTO articolo" + row.getMarca().getDescrizione() + " " + row.getNome() + "..."); + if (row.getTipo().getFlgIcecatNoAuto() == 0L) { + totRecordIcecat++; + rp.setStatus(true); + i++; + String temp = "Aggiornamento " + i + " su " + vec.getTotNumberOfRecords() + " " + row.getMarca().getDescrizione() + " " + + row.getCodice() + " " + row.getNome(); + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "ICECAT AUTO ", temp); + if (!l_icecatLang.isEmpty()) { + st = new StringTokenizer(l_icecatLang, ","); + while (st.hasMoreTokens()) { + String lang = st.nextToken(); + caricaImmagini = true; + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "ICECAT AUTO ", temp + " chiamata icecat " + temp + " ....."); + if (debug) + System.out.println("ICECAT AUTO chiamo icecat " + lang + "..."); + rp = row.caricaIcecat(lang, caricaImmagini, 1); + if (rp.getStatus()) { + if (row.isReadyForWeb(lang)) + isIcecatOk = true; + if (!previewSizeAllImages.isEmpty()) { + if (debug) + System.out.println("ICECAT AUTO creo preview...."); + row.creaPreviewH(previewSizeAllImages, 8, "ICECAT AUTO ", temp); + } + if (!previewSizeImage1.isEmpty()) { + if (debug) + System.out.println("ICECAT AUTO creo preview 1...."); + row.creaPreviewH(previewSizeImage1, 1, "ICECAT AUTO ", temp); + } + caricaImmagini = false; + if (debug) + System.out.println("ICECAT AUTO chiamo icecat " + lang + ". ok: " + icecatOK + " ko: " + icecatKO); + continue; + } + isIcecatOk = false; + } + } + if (isIcecatOk) { + icecatOK++; + sb.append(""); + st = new StringTokenizer(row.getDescrizionePerMail(false), "|"); + while (st.hasMoreTokens()) { + sb.append(""); + } + sb.append(""); + row.save(); + continue; + } + icecatKO++; + } + } + sb.append("
"); + String token = st.nextToken(); + sb.append(token); + sb.append("
"); + String token = st.nextToken(); + sb.append(token); + sb.append("
"); + timer.stop(); + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "ICECAT AUTO ", "Aggiornamento concluso. DURATA: " + + timer.getDurataHourMin() + "\n" + err.toString()); + System.out.println("###### ICECAT AUTO CONCLUSO #####"); + System.out.println("Aggiornamento concluso. DURATA: " + timer.getDurataHourMin()); + System.out.println("Tot record: " + vec.getTotNumberOfRecords() + "- icecat OK: " + icecatOK + " icecat KO: " + icecatKO); + System.out.println(err.toString()); + System.out.println("############################################"); + StringBuilder msg = new StringBuilder("DURATA: " + timer.getDurataHourMin()); + msg.append("\n"); + msg.append("Tot record: "); + msg.append(vec.getTotNumberOfRecords()); + msg.append(" - record icecat: "); + msg.append(totRecordIcecat); + msg.append(" - icecat OK: "); + msg.append(icecatOK); + msg.append(" - icecat KO: "); + msg.append(icecatKO); + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "ICECAT AUTO ", "Concluso. " + msg.toString()); + boolean sendEmail = true; + if (sendEmail) { + MailProperties mp = new MailProperties(); + String eMail = Articolo.this.getApFull().getParm("TO").getTesto(); + mp.put("TO", eMail); + mp.put("ISHTML", "true"); + mp.setProperty("FROM", Articolo.this.getApFull().getParm("FROM").getTesto()); + mp.put("SUBJECT", "ICECAT AUTO - ok: " + icecatOK + " su " + totRecordIcecat); + mp.setProperty("BCC", ""); + mp.setProperty("CC", ""); + mp.put("MSG", "ICECAT AUTO concluso. \n" + msg.toString() + "
" + sb.toString()); + try { + Articolo.this.sendMailMessage(mp); + } catch (Exception e) { + e.printStackTrace(); + } + } + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(Articolo.this.getApFull(), "ICECAT AUTO "); + Articolo.threadIcecatAuto = false; + System.out.println(rp.getMsg()); + } + } + + class ThreadCreaSitemaps extends Thread { + private ApplParmFull apFull; + + private ArticoloCR ACR; + + private final String TAG_THREAD_MSG = "CREA SITEMAPS "; + + public ThreadCreaSitemaps(ApplParmFull apFull, ArticoloCR ACR) { + this.apFull = apFull; + this.ACR = ACR; + } + + public void run() { + boolean debug = false; + ResParm rp = new ResParm(true); + try { + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "CREA SITEMAPS ", "...inizio ..."); + StringBuffer msg = new StringBuffer("Inizio Thread crea sitemap...\n"); + Articolo art = new Articolo(this.apFull); + this.ACR.setFlgReadyForWeb(1L); + this.ACR.setFlgEscludiWeb(0L); + this.ACR.setLangReadyForWeb("it"); + SitemapCR CR = new SitemapCR(this.apFull); + CR.setACR(this.ACR); + String lang = art.getParm("LANG_AVAILABLE").getTesto(); + StringTokenizer st = new StringTokenizer(lang, ","); + String filenamePre = "sitemap"; + String filenameXml = ".xml"; + while (st.hasMoreTokens()) { + String currentLang = st.nextToken(); + CR.setSitemapFilename("sitemap"); + msg.append("creazione sitemap in lingua " + currentLang + " file " + CR.getSitemapFilename() + ".xml\n"); + CR.setLangSitemap(currentLang); + Sitemap sitemap = new Sitemap(this.apFull); + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "CREA SITEMAPS ", "Sitemap lingua " + currentLang + " file unico in corso...."); + CR.setFlgSitemapType(9L); + rp = sitemap.creaFileXmlSitemap(CR); + StatusMsg.updateMsgByTag(Articolo.this.getApFull(), "CREA SITEMAPS ", "Sitemap lingua " + currentLang + " file separati in corso...."); + CR.setFlgSitemapType(10L); + rp = sitemap.creaFileXmlSitemap(CR); + msg.append(rp.getMsg()); + msg.append("\n"); + } + msg.append("\nfine SITEMAP. Lap time:" + timer.getDurataHourMin()); + StatusMsg.deleteMsgByTag(Articolo.this.getApFull(), "CREA SITEMAPS "); + } catch (Exception e) { + rp.setStatus(false); + rp.setMsg("Errore in ThreadCreaSitemaps: " + e.getMessage()); + e.printStackTrace(); + } finally { + Articolo.threadCreaSitemaps = false; + } + DBAdapter.printDebug(debug, rp.getMsg()); + } + } + + class ThreadUpdOfferAmz extends Thread { + private ApplParmFull apFull; + + private ArticoloCR CR; + + private final String TAG_THREAD_MSG = "UPDATE OFFER AUTO AMAZON "; + + private long flgPriceTypeAmz; + + public ThreadUpdOfferAmz(Articolo this$0, ApplParmFull apFull, ArticoloCR CR, long flgPriceTypeAmz) {} + + public void run() { + boolean debug = false; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.this$0.getApFull(), "UPDATE OFFER AUTO AMAZON ", "...inizio ..."); + StringBuilder err = new StringBuilder(); + ResParm rp = new ResParm(true); + Articolo articolo = new Articolo(this.apFull); + boolean isLocale = articolo.isLocalhost(); + Vectumerator vec = articolo.findByCR(this.CR, 0, 0); + Vectumerator vecRes = new Vectumerator(); + int i = 0, daAggiornare = 0, changed = 0; + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + i++; + StatusMsg.updateMsgByTag(this.this$0.getApFull(), "UPDATE OFFER AUTO AMAZON ", "articolo " + i + " su " + + vec.getTotNumberOfRecords() + ": " + changed + " aggiornati su " + daAggiornare); + if (this.flgPriceTypeAmz >= 0L && row.getFlgPriceTypeAmz() != this.flgPriceTypeAmz) { + row.setFlgPriceTypeAmz(this.flgPriceTypeAmz); + row.superSave(); + } + if (!row.isAmazonPrezzoQtaAllineati()) { + if (debug) + System.out.println("UpdateOffer thread: articolo codice " + row.getCodice() + " " + row.getNome()); + daAggiornare++; + StringBuilder beanNote = new StringBuilder(this.this$0.getNf().format(row.getPrezzoSuAmzIva())); + beanNote.append("->"); + beanNote.append(this.this$0.getNf().format(row.getPrezzoArticoloAmazonIvaExport("it", 1L))); + beanNote.append("
"); + beanNote.append("q "); + beanNote.append(this.this$0.getNf0().format(row.getQtaSuAmz())); + beanNote.append("->"); + beanNote.append(this.this$0.getNf0().format(row.getQtaAmzDaInviare())); + if (!isLocale) { + rp = row.amzUpdateOfferAuto(); + if (rp.getStatus()) { + changed++; + beanNote.append("\nupdated"); + } else { + beanNote.append("\nErr.: "); + beanNote.append(rp.getMsg()); + err.append(row.getCodice() + " " + row.getCodice() + ": " + row.getNome()); + } + } else { + beanNote.append("\nLocale! "); + } + row.setBeanNotes(beanNote.toString()); + vecRes.add(row); + } + } + timer.stop(); + StatusMsg.updateMsgByTag(this.this$0.getApFull(), "UPDATE OFFER AUTO AMAZON ", "Aggiornamento concluso. DURATA: " + + timer.getDurataHourMin() + "\n" + err.toString()); + System.out.println("###### THREAD ALLINEA AMZ CONCLUSO #####"); + System.out.println("Aggiornamento concluso. DURATA: " + timer.getDurataHourMin()); + System.out.println("Tot record: " + vec.getTotNumberOfRecords() + ": " + changed + " aggiornati su " + daAggiornare); + System.out.println(err.toString()); + System.out.println("############################################"); + StringBuilder msg = new StringBuilder("DURATA: " + timer.getDurataHourMin()); + msg.append("\n"); + msg.append("Tot record: "); + msg.append(vec.getTotNumberOfRecords()); + msg.append(": "); + msg.append(changed); + msg.append(" aggiornati su "); + msg.append(daAggiornare); + StatusMsg.updateMsgByTag(this.this$0.getApFull(), "UPDATE OFFER AUTO AMAZON ", "Aggiornamento concluso. Invio email risultato in corso..... "); + this.this$0.sendAmzUpdateResultByEmail(this.apFull, "Amz Offer Auto", vecRes, msg.toString()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.this$0.getApFull(), "UPDATE OFFER AUTO AMAZON "); + Articolo.threadUpdateOfferAmz = false; + System.out.println(rp.getMsg()); + } + } + + class ThreadAmzPostItemsOffersBatch extends Thread { + private ApplParmFull apFull; + + private ArticoloCR CR; + + private final String TAG_THREAD_MSG = "PostItemsOffersBatch AMAZON "; + + public ThreadAmzPostItemsOffersBatch(Articolo this$0, ApplParmFull apFull, ArticoloCR CR) {} + + public void run() { + boolean debug = false; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.this$0.getApFull(), "PostItemsOffersBatch AMAZON ", "...inizio ..."); + StringBuilder err = new StringBuilder(); + ResParm rp = new ResParm(true); + Attivita attivita = Attivita.getDefaultInstance(this.this$0.getApFull()); + this.CR.setTAG_THREAD_MSG("PostItemsOffersBatch AMAZON "); + this.CR.setFlgAsinAmzNull(1L); + Vectumerator vec = this.this$0.findByCR(this.CR, 0, 0); + int i = 1; + int totRecords = vec.getTotNumberOfRecords(); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + rp = row.amzCatalogItem(); + if (!rp.getStatus()) { + StatusMsg.updateMsgByTag(this.this$0.getApFull(), "PostItemsOffersBatch AMAZON ", "catalog asin " + i + " su " + totRecords + " " + + row.getCodiceEanNoZero() + " " + row.getNome() + " " + rp.getErrMsg()); + } else { + StatusMsg.updateMsgByTag(this.this$0.getApFull(), "PostItemsOffersBatch AMAZON ", "catalog asin " + i + " su " + totRecords + " " + + row.getCodiceEanNoZero() + " " + row.getNome() + " " + rp.getMsg()); + } + i++; + } + this.CR.setFlgAsinAmzNull(0L); + vec = this.this$0.findByCR(this.CR, 1, 1); + if (vec.getTotNumberOfRecords() > 0) { + AmzSellerApi asa = new AmzSellerApi(attivita); + AmzResult aRes = asa.amzPostItemsOffersBatch(this.CR, "it"); + if (aRes.isOk()) { + rp.setStatus(true); + rp.setMsg(aRes.getMsg()); + } else { + rp.setStatus(false); + rp.setMsg("Errore! " + aRes.getMsg()); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! non ci sono articoli con asin impostati!"); + } + timer.stop(); + StatusMsg.updateMsgByTag(this.this$0.getApFull(), "PostItemsOffersBatch AMAZON ", "Aggiornamento concluso. DURATA: " + + timer.getDurataHourMin() + "\n" + err.toString()); + System.out.println("###### PostItemsOffersBatch AMAZON #####"); + System.out.println("Aggiornamento concluso. DURATA: " + timer.getDurataHourMin()); + System.out.println(err.toString()); + System.out.println("############################################"); + StringBuilder msg = new StringBuilder("DURATA: " + timer.getDurataHourMin()); + StatusMsg.updateMsgByTag(this.this$0.getApFull(), "PostItemsOffersBatch AMAZON ", "Aggiornamento concluso...... "); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.this$0.getApFull(), "PostItemsOffersBatch AMAZON "); + Articolo.threadPostItemOfferAmz = false; + System.out.println(rp.getMsg()); + } + } + + class ThreadAllineaAmz extends Thread { + private ApplParmFull apFull; + + private ArticoloCR CR; + + private final String TAG_THREAD_MSG = "ALLINEA AMAZON "; + + public ThreadAllineaAmz(Articolo this$0, ApplParmFull apFull, ArticoloCR CR) {} + + public void run() { + boolean debug = false; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.this$0.getApFull(), "ALLINEA AMAZON ", "...inizio ..."); + StringBuilder err = new StringBuilder(); + ResParm rp = new ResParm(true); + Articolo articolo = new Articolo(this.apFull); + boolean isLocale = articolo.isLocalhost(); + this.CR.setFlgAmazon(1L); + Vectumerator vec = articolo.findByCR(this.CR, 0, 0); + Vectumerator vecRes = new Vectumerator(); + int i = 0, daAggiornare = 0, changed = 0; + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + i++; + StatusMsg.updateMsgByTag(this.this$0.getApFull(), "ALLINEA AMAZON ", "articolo " + i + " su " + + vec.getTotNumberOfRecords() + ": " + changed + " aggiornati su " + daAggiornare); + if (!row.isAmazonPrezzoQtaAllineati()) { + if (debug) + System.out.println("AllineAmz: articolo codice " + row.getCodice() + " " + row.getNome()); + daAggiornare++; + StringBuilder beanNote = new StringBuilder(this.this$0.getNf().format(row.getPrezzoSuAmzIva())); + beanNote.append("->"); + beanNote.append(this.this$0.getNf().format(row.getPrezzoArticoloAmazonIvaExport("it", 1L))); + beanNote.append("
"); + beanNote.append("q "); + beanNote.append(this.this$0.getNf0().format(row.getQtaSuAmz())); + beanNote.append("->"); + beanNote.append(this.this$0.getNf0().format(row.getQtaAmzDaInviare())); + if (!isLocale) { + rp = row.amzUpdateOffer(); + if (rp.getStatus()) { + changed++; + beanNote.append("\nupdated"); + } else { + beanNote.append("\nErr.: "); + beanNote.append(rp.getMsg()); + err.append(row.getCodice() + " " + row.getCodice() + ": " + row.getNome()); + } + } else { + beanNote.append("\nLocale! "); + } + row.setBeanNotes(beanNote.toString()); + vecRes.add(row); + } + } + timer.stop(); + StatusMsg.updateMsgByTag(this.this$0.getApFull(), "ALLINEA AMAZON ", "Aggiornamento concluso. DURATA: " + + timer.getDurataHourMin() + "\n" + err.toString()); + System.out.println("###### THREAD ALLINEA AMZ CONCLUSO #####"); + System.out.println("Aggiornamento concluso. DURATA: " + timer.getDurataHourMin()); + System.out.println("Tot record: " + vec.getTotNumberOfRecords() + ": " + changed + " aggiornati su " + daAggiornare); + System.out.println(err.toString()); + System.out.println("############################################"); + StringBuilder msg = new StringBuilder("DURATA: " + timer.getDurataHourMin()); + msg.append("\n"); + msg.append("Tot record: "); + msg.append(vec.getTotNumberOfRecords()); + msg.append(": "); + msg.append(changed); + msg.append(" aggiornati su "); + msg.append(daAggiornare); + StatusMsg.updateMsgByTag(this.this$0.getApFull(), "ALLINEA AMAZON ", "Aggiornamento concluso. Invio email risultato in corso..... "); + this.this$0.sendAmzUpdateResultByEmail(this.apFull, "Amz Allinea", vecRes, msg.toString()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.this$0.getApFull(), "ALLINEA AMAZON "); + Articolo.threadAllineaArticoloAmz = false; + System.out.println(rp.getMsg()); + } + } + + public static volatile boolean threadCreaSitemaps = false; + + public static volatile boolean threadAllineaArticoloEbay = false; + + public static volatile boolean threadAllineaArticoloAmz = false; + + public static volatile boolean threadUpdateOfferAmz = false; + + public static volatile boolean threadPostItemOfferAmz = false; + + public static volatile boolean threadCancellazione = false; + + public static volatile boolean threadIcecatAuto = false; + + public static final int DISPO_LEVEL_IN_ARRIVO = 0; + + public static final int DISPO_LEVEL_SCARSA = 1; + + public static final int DISPO_LEVEL_ALTA = 2; + + private long flgRC; + + private long lavaggio; + + private long candeggio; + + private long stiratura; + + private long pulituraSecco; + + private long asciugatura; + + private long massaLineare; + + private long altezzaMinima; + + private SimboliLavaggio simboliLavaggio; + + private long id_articoloTaglia; + + private long flgNoListinoArt; + + private long countImportNonTrovato; + + private Date dataUltimoImport; + + private long flgTipoMagazzino; + + private double quantitaW; + + private long flgArticoloComponente; + + private ListinoArticolo listinoArticoloBase; + + private boolean quantitaDataCalcolate = false; + + private double quantitaEffettiva; + + private String nome; + + private long flgDispo; + + private long id_tipo2; + + private Tipo tipo2; + + private String caratteristicheListeId; + + private String googleFeedFileName; + + private String readyForWeb; + + private String notaArticolo; + + private String codiceEan; + + private Date dataUltimoCosto; + + private String descrizioneGoogle; + + private long flgEbay = 0L; + + private long flgGoogle; + + private long flgSubito; + + private long flgNoleggio; + + private long flgUsato; + + private String nMatricola; + + private double percRicarico; + + private double percRicaricoEffettivo; + + private double prezzoIvatoBarrato; + + private double prezzoNoleggio; + + private long flgSuperGaranzia; + + private double prezzoNettoBarrato; + + private double costoRivalutazione; + + private long flgStatoImport; + + private double costoNetto; + + private double costoNettoDb; + + private double costoManodopera; + + private double costoStiro; + + private double costoSpeseFisse; + + private double costoAccessori; + + private double totCostoConfezione = -1.0D; + + private long flgKit; + + private long flgKitArt; + + private long flgRateale0; + + private long flgB2b; + + private long flgB2bArt; + + private long id_statoUsato; + + private StatoUsato statoUsato; + + private String ebayItemId; + + private Listino listinoBase; + + private PrezzoArticolo prezzoArticolo; + + private PrezzoArticolo prezzoArticoloIva; + + private long flgPreventivoWwwArt; + + private long percCostoSpedizione; + + private String categoriaImport; + + private ArticoloVariante articoloVarianteBase; + + private Hashtable caratteristicheHT; + + private String seriale; + + private String codiceProduttore; + + private String codiciAlternativi; + + private Date dataFineVld; + + private Date dataScadenzaOfferta; + + private Date dataScadenzaOffertaFornitore; + + private String descrizioneCommerciale_it; + + private String altreCompatibilita; + + private String codiciMagazzino; + + private long flgWebNoVendita; + + private long flgAggiornaDati; + + private long flgFuoriListino; + + private long flgNascondi; + + private boolean flgNextPrev = false; + + private long flgStato; + + private long flgStockOfferte; + + private long flgUdm; + + private long id_articolo; + + private long id_fornitoreCostoNuovo; + + private Clifor fornitoreCostoNuovo; + + private long id_confezionistaDefault; + + private long id_articoloNext; + + private long id_articoloPrev; + + private long id_articoloVarianteBaseNext; + + private long id_articoloVarianteBasePrev; + + private long id_iva; + + private long id_marca; + + private long id_tipo; + + private long id_tipoTaglia; + + private Iva iva; + + private Marca marca; + + private long mesigar; + + private long ordine; + + private String pathAllegatoOld; + + private double percSconto; + + private double pesoKg; + + private long prenotatiArt; + + private double abbuonoPrezzoPubblico; + + private double prezzoVendor; + + private double qtaRiordino; + + private double ricaricoBase; + + private double streetPrice; + + private Tipo tipo; + + private ArticoloTaglia articoloTaglia; + + private TipoTaglia tipoTaglia; + + private long volumeCm3; + + private double volumeM3; + + private long id_tabellaTaglia; + + private TabellaTaglia tabellaTaglia; + + private long id_articoloVariante; + + private long flgSerialiMassivi = 0L; + + private String codice; + + private long flgUsaVarianti; + + private ArticoloVariante articoloVariante; + + private long flgStampaEtichette; + + private double prezzoPubblicoIvaOrd; + + private Date dataCambiamentoPrezzo; + + private double prezzoRivNuovo; + + private long flgUsaVariantiArt; + + private double ricaricoBaseNew; + + private long flgNoListino = 0L; + + private String compatibilita; + + private double quantita; + + private long flgStampaAccessori; + + private double costoRivalutazioneConIva; + + private long flgNegativo = 0L; + + private double quantitaData; + + private boolean quantitaCalcolate; + + private double quantitaInArrivo; + + private double quantitaImpegnata; + + private double qtaRiordinoNuovo; + + private String caratteristiche; + + private long sitemapPriority = 80L; + + private long id_caratteristica; + + private long flgEscludiWeb = 0L; + + private long flgAggGiacenza = 0L; + + private double costoNuovo; + + private long id_tipoAccessorio; + + private TipoAccessorio tipoAccessorio; + + private long flgEscludiWebArt; + + private long id_vetrina; + + private Vetrina vetrina; + + private double prezzoOfferta; + + private String quantitaMagazzinoMovimentoHtml; + + private String idTipoSearch; + + private String scaffale; + + private long flgContoVendita; + + private Date dataAggiornamento; + + private String descrizioneSearch; + + private long tipoOrdineSearch; + + private String tipoDescrizioneSearch; + + private double quantitaDB; + + private long flgModImportazione; + + private long flgDisponibilitaWeb; + + private String tagArticolo; + + private String codicePromozioneA; + + private double costoPrecedente; + + private double imponibilePrecedente; + + private String descrizioneCaratteristiche; + + private long flgGoogleDB; + + private long flgRichiediQuotazione; + + private ArticoloVariante articoloVarianteKit; + + private long id_articoloVarianteKit; + + private String keywords; + + private String ebayOfferId; + + private long qtaEbay = 2L; + + private long qtaMaxAcquistoWww; + + private long id_listinoEbay; + + private Listino listinoEbay; + + private double prezzoSuEbayIva; + + private long qtaSuEbay; + + private double prezzoSuAmzIva; + + private long qtaSuAmz; + + private String productTypeAmz; + + private long id_listinoAmazon; + + private Listino listinoAmazon; + + private long qtaAmz; + + private long flgAmazon; + + private long flgAmzWarn; + + private String asinAmz; + + private long flgPriceTypeAmz; + + private String descAmz; + + private long impression; + + private Timestamp tmstLastImpression; + + private long id_articoloTagliaKit; + + private double tariffaAmazon; + + private long flgControlloCostoAggArt; + + private long flgTipoSchedaArticoloWww; + + private String nomeSeo; + + private String erroriSeo; + + private Date dataChiamataIcecat; + + private long hashCodeCurrent; + + private long hashCodeIndexNow; + + private Clifor confezionistaDefault; + + public Articolo(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public long getFlgRichiediQuotazione() { + return this.flgRichiediQuotazione; + } + + public void setFlgRichiediQuotazione(long flgRichiediQuotazione) { + this.flgRichiediQuotazione = flgRichiediQuotazione; + } + + public ResParm addAccessorio(Accessorio row) { + Accessorio bean = new Accessorio(getApFull()); + if (row.getId_accessorio() != 0L) { + bean.findByPrimaryKey(row.getId_accessorio()); + } else { + bean.findById_articoloId_associato(row.getId_articolo(), row.getId_articoloAssociato()); + } + if (bean.getDBState() == 1) { + row.setDBState(bean.getDBState()); + row.setId_accessorio(bean.getId_accessorio()); + } + ResParm rp = row.save(); + if (rp.getStatus()) { + if (row.getId_articolo() > 0L) + rp.append(row.getArticolo().aggiornaCompatibilita()); + if (row.getId_articoloAssociato() > 0L) + rp.append(row.getArticoloAssociato().aggiornaCompatibilita()); + } + return rp; + } + + public ResParm addKit(Kit row) { + Kit bean = new Kit(getApFull()); + if (row.getId_kit() != 0L) { + bean.findByPrimaryKey(row.getId_kit()); + } else { + bean.findById_articoloPrimarioId_articoloSecondario(row.getId_articolo(), row.getId_articoloSecondario()); + } + if (bean.getDBState() == 1) { + row.setDBState(bean.getDBState()); + row.setId_kit(bean.getId_kit()); + } + ResParm rp = row.save(); + return rp; + } + + public ResParm addAllegato(AllegatoArticolo row) { + AllegatoArticolo bean = new AllegatoArticolo(getApFull()); + bean.findByArticoloNomeFile(row.getId_articolo(), row.getNomeFile()); + if (bean.getDBState() == 1) + return new ResParm(false, "Nome File Duplicato"); + row.setDBState(0); + ResParm rp = row.save(); + return rp; + } + + public ResParm addCaratteristica(CaratteristicaArticolo ab) { + CaratteristicaArticolo bean = new CaratteristicaArticolo(getApFull()); + CaratteristicaArticoloKey caK = new CaratteristicaArticoloKey(ab.getId_articolo(), ab.getId_caratteristica()); + bean.findByPrimaryKey(caK); + if (bean != null) { + ab.setDBState(bean.getDBState()); + } else { + ab.setDBState(0); + } + ResParm rp = ab.save(); + if (rp.getStatus()) + rp.append(aggiornaCaratteristiche()); + return rp; + } + + private void addCaratteristicaInit(Caratteristica ca) { + CaratteristicaArticolo bean = new CaratteristicaArticolo(getApFull()); + CaratteristicaArticoloKey caK = new CaratteristicaArticoloKey(getId_articolo(), ca.getId_caratteristica()); + bean.findByPrimaryKey(caK); + if (bean.getDBState() == 0) { + bean.setId_articolo(getId_articolo()); + bean.setId_caratteristica(ca.getId_caratteristica()); + bean.save(); + } + } + + private void addCaratteristicaFull(CaratteristicaArticolo ca) { + CaratteristicaArticolo bean = new CaratteristicaArticolo(getApFull()); + CaratteristicaArticoloKey caK = new CaratteristicaArticoloKey(getId_articolo(), ca.getId_caratteristica()); + bean.findByPrimaryKey(caK); + if (bean.getDBState() == 0) { + bean.setId_articolo(getId_articolo()); + bean.setId_caratteristica(ca.getId_caratteristica()); + bean.setValD(ca.getValD()); + bean.setValDouble(ca.getValDouble()); + bean.setValI(ca.getValI()); + bean.setValS(ca.getValS()); + bean.setValSN(ca.getValSN()); + bean.setId_lista(ca.getId_lista()); + bean.save(); + } + } + + public ResParm addFornitore(ArticoloFornitore ab) { + ResParm rp = new ResParm(true); + ArticoloFornitore bean = new ArticoloFornitore(getApFull()); + bean.findByPrimaryKey(ab.getId_articoloFornitore()); + if (bean != null) { + ab.setDBState(bean.getDBState()); + } else { + ab.setDBState(0); + } + if (ab.getFlgAbituale() == 1L) + rp = ab.deleteFlgAbitualeArticolo(ab.getId_articolo()); + rp.append(ab.save()); + return rp; + } + + public void aggiornaRicarichi(ArticoloCR CR) {} + + private void calcolaIdNextPrev(ArticoloCR CR) { + long l_id_articolo = 0L; + CR.setFlgOrderType("asc"); + CR.setCurrentCodice(getCodice()); + CR.setFlgOrderBy(0L); + Vectumerator vec = findByCR(CR, 1, 5); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (row.getId_articolo() != getId_articolo()) { + l_id_articolo = row.getId_articolo(); + break; + } + } + setId_articoloNext(l_id_articolo); + l_id_articolo = 0L; + CR.setFlgOrderType("desc"); + vec = findByCR(CR, 1, 5); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (row.getId_articolo() != getId_articolo()) { + l_id_articolo = row.getId_articolo(); + break; + } + } + setId_articoloPrev(l_id_articolo); + setFlgNextPrev(true); + } + + private void calcolaIdVarianteNextPrev(ArticoloCR CR) { + long l_id_articoloVarianteBase = 0L; + CR.setFlgOrderType("asc"); + CR.setCurrentCodice(getCodice()); + CR.setFlgOrderBy(0L); + CR.setFlgNascondi(0L); + Vectumerator vec = findByCR(CR, 1, 5); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (row.getId_articolo() != getId_articolo()) { + l_id_articoloVarianteBase = row.getArticoloVarianteBase().getId_articoloVariante(); + break; + } + } + setId_articoloVarianteBaseNext(l_id_articoloVarianteBase); + l_id_articoloVarianteBase = 0L; + CR.setFlgOrderType("desc"); + vec = findByCR(CR, 1, 5); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (row.getId_articolo() != getId_articolo()) { + l_id_articoloVarianteBase = row.getArticoloVarianteBase().getId_articoloVariante(); + break; + } + } + setId_articoloVarianteBasePrev(l_id_articoloVarianteBase); + setFlgNextPrev(true); + } + + private long calcolaOrdine() { + try { + String s_sqlFind = "select max(ordine) as _max from ARTICOLO WHERE id_articolo!=" + getId_articolo(); + PreparedStatement ps = getConn().prepareStatement(s_sqlFind); + long res = (long)getMax(ps, true) + 1L; + long decine = res / 10L; + return (decine + 1L) * 10L; + } catch (Exception e) { + handleDebug(e); + return 0L; + } + } + + public void caricaCaratteristiche() { + Vectumerator vec = new Caratteristica(getApFull()).findCaratteristicheByTipo(getId_tipo(), 0, 0); + while (vec.hasMoreElements()) + addCaratteristicaInit((Caratteristica)vec.nextElement()); + } + + public void caricaCaratteristicheDaArticoloSource(long l_id_articoloSource) { + Articolo articoloSource = new Articolo(getApFull()); + articoloSource.findByPrimaryKey(l_id_articoloSource); + Vectumerator vec = articoloSource.getCaratteristicheArticolo(); + while (vec.hasMoreElements()) { + CaratteristicaArticolo ca = (CaratteristicaArticolo)vec.nextElement(); + addCaratteristicaFull(ca); + } + } + + public ResParm delAccessorio(Accessorio row) { + Accessorio bean = new Accessorio(getApFull()); + bean.findByPrimaryKey(row.getId_accessorio()); + Accessorio bean2 = new Accessorio(getApFull()); + bean2.findByPrimaryKey(bean.getId_accessorio()); + ResParm rp = bean.delete(); + if (rp.getStatus()) { + if (bean2.getId_articolo() > 0L) + rp.append(bean2.getArticolo().aggiornaCompatibilita()); + if (bean2.getId_articoloAssociato() > 0L) + rp.append(bean2.getArticoloAssociato().aggiornaCompatibilita()); + } + return rp; + } + + public ResParm delKit(Kit row) { + Kit bean = new Kit(getApFull()); + bean.findByPrimaryKey(row.getId_kit()); + Accessorio bean2 = new Accessorio(getApFull()); + bean2.findByPrimaryKey(bean.getId_kit()); + ResParm rp = bean.delete(); + return rp; + } + + public ResParm delAllegato(AllegatoArticolo row) { + AllegatoArticolo bean = new AllegatoArticolo(getApFull()); + bean.findByPrimaryKey(row.getId_allegatoArticolo()); + return bean.delete(); + } + + public ResParm delArticoloVariante(ArticoloVariante ab) { + ArticoloVariante bean = new ArticoloVariante(getApFull()); + bean.findByPrimaryKey(ab.getId_articoloVariante()); + return bean.delete(); + } + + public ResParm delCaratteristica(CaratteristicaArticolo ca) { + CaratteristicaArticolo bean = new CaratteristicaArticolo(getApFull()); + CaratteristicaArticoloKey caK = new CaratteristicaArticoloKey(ca.getId_articolo(), ca.getId_caratteristica()); + bean.findByPrimaryKey(caK); + ResParm rp = bean.delete(); + if (rp.getStatus()) + rp.append(aggiornaCaratteristiche()); + return rp; + } + + protected void deleteCascade() { + String targetDir = getDocBase() + getDocBase(); + deleteImmagini(); + deleteImmaginiRiduzioni(null); + ResParm rp = delete("delete from LISTINO_ARTICOLO where id_articolo=" + getId_articolo()); + rp = delete("delete from ARTICOLO_VARIANTE where id_articolo=" + getId_articolo()); + rp = delete("delete from ARTICOLO_FORNITORE where id_articolo=" + getId_articolo()); + rp = delete("delete from WISHLIST where id_articolo=" + getId_articolo()); + rp = delete("delete from CARATTERISTICA_ARTICOLO where id_articolo=" + getId_articolo()); + Vectumerator vecAa = getAllegati(0L); + while (vecAa.hasMoreElements()) { + AllegatoArticolo rowAa = (AllegatoArticolo)vecAa.nextElement(); + rowAa.delete(); + } + } + + public void deleteImmagini() { + File dir = new File(getDocBase() + getDocBase()); + FilenameFilter imgFilter = new FilenameFilter() { + public boolean accept(File dir, String name) { + if (name.indexOf("" + Articolo.this.getId() + "_") == 0 && name.toLowerCase().endsWith("jpg")) + return true; + return false; + } + }; + File[] files = dir.listFiles(imgFilter); + for (File currentImg : files) + currentImg.delete(); + } + + public void deleteImmaginiSporche() { + File dir = new File(getDocBase() + getDocBase()); + System.out.println("deleteImmaginiSporche: " + String.valueOf(dir)); + FilenameFilter imgFilter = new FilenameFilter() { + public boolean accept(File dir, String name) { + if (name.indexOf("" + Articolo.this.getId_articolo() + "_") == 0 && name.toLowerCase().endsWith("jpg")) { + if (Articolo.this.getImgTmst().isEmpty()) { + if (name.indexOf("__") < 0) + return true; + return false; + } + if (name.indexOf(Articolo.this.getImgTmst()) < 0) + return true; + return false; + } + return false; + } + }; + File[] files = dir.listFiles(imgFilter); + for (File currentImg : files) { + System.out.println("deleteImmaginiSporche: " + String.valueOf(currentImg)); + currentImg.delete(); + } + } + + public ResParm delFornitore(ArticoloFornitore ca) { + ArticoloFornitore bean = new ArticoloFornitore(getApFull()); + bean.findByPrimaryKey(ca.getId_articoloFornitore()); + return bean.delete(); + } + + public void findArticoloByCodice(String l_codice) { + String s_Sql_Find = "select A.* from ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice='" + prepareInputMySqlString(l_codice, false) + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findArticoloByCodiceFornitore(long l_id_fornitore, String l_cf) { + String s_Sql_Find = "select A.* from ARTICOLO AS A, ARTICOLO_FORNITORE AS B"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articolo= B.id_articolo"); + wc.addWc("B.id_fornitore=" + l_id_fornitore); + wc.addWc("B.codiceFornitore='" + l_cf + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator getAccessori() { + return getAccessori(0L, 0L, -1L); + } + + public Vectumerator getAccessoriDisponibili() { + return new Accessorio(getApFull()).findById_articoloAssociati(getId_articolo(), true, 0, 0); + } + + public Vectumerator getAllegati(long l_id_tipoAllegatoDocumento) { + return new AllegatoArticolo(getApFull()).findByArticoloTipo(getId_articolo(), l_id_tipoAllegatoDocumento, 0, 0); + } + + public ArticoloVariante getArticoloVarianteBase() { + if (this.articoloVarianteBase == null && getId_articolo() != 0L) { + ArticoloVarianteCR CRAv = new ArticoloVarianteCR(); + CRAv.setId_articolo(getId_articolo()); + CRAv.setFlgEscludiWeb(0L); + Vectumerator vec = new ArticoloVariante(getApFull()).findByCR(CRAv, 0, 0); + if (vec.hasMoreElements()) { + int nRec = vec.getTotNumberOfRecords(); + int nVar = (int)(Math.random() * (double)nRec); + this.articoloVarianteBase = (ArticoloVariante)vec.get(nVar); + } + } + if (this.articoloVarianteBase == null) { + logDebug(true, "getArticoloVarianteBase--> articolo: " + getId_articolo() + " " + getNome() + " senza varianti!!"); + return new ArticoloVariante(getApFull()); + } + return this.articoloVarianteBase; + } + + public ArticoloVariante getArticoloVarianteBasePrimoVisibile() { + if (this.articoloVarianteBase == null && getId_articolo() != 0L) { + this.articoloVarianteBase = new ArticoloVariante(getApFull()); + this.articoloVarianteBase.findPrimoVisibileByArticolo(getId_articolo()); + } + if (this.articoloVarianteBase == null) { + logDebug(true, "getArticoloVarianteBase--> articolo: " + getId_articolo() + " " + getNome() + " senza varianti!!"); + return new ArticoloVariante(getApFull()); + } + return this.articoloVarianteBase; + } + + public Vectumerator findArticoliComponenti() { + ArticoloCR CR = new ArticoloCR(); + CR.setFlgArticoloComponente(1L); + return findByCR(CR, 0, 0); + } + + public static synchronized Articolo duplica(Articolo beanSrc) { + if (beanSrc.getId_articolo() > 0L) { + Articolo beanDup = new Articolo(beanSrc.getApFull()); + beanDup.findByPrimaryKey(beanSrc.getId_articolo()); + beanDup.setId_articolo(0L); + beanDup.setDBState(0); + beanDup.setNome(beanDup.getNome() + " -copia-"); + beanDup.setCodice(beanDup.getCodice() + " -copia-"); + ResParm rp = beanDup.save(); + if (rp.getStatus()) { + Vectumerator vecVa = beanSrc.findArticoliVarianti(-1L, -1L); + while (vecVa.hasMoreElements() && rp.getStatus()) { + ArticoloVariante row = (ArticoloVariante)vecVa.nextElement(); + row.setId_articoloVariante(0L); + row.setId_articolo(beanDup.getId_articolo()); + row.setDBState(0); + rp = row.save(); + } + String targetDir = beanSrc.getDocBase() + beanSrc.getDocBase(); + for (int i = 0; i < 20; i++) { + if (new File(targetDir + targetDir).exists()) + try { + DBAdapter.copyFile(targetDir + targetDir, targetDir + targetDir); + } catch (Exception e) { + e.printStackTrace(); + } + } + DescTxtLang dtl = new DescTxtLang(beanSrc.getApFull()); + Vectumerator vecdtl = dtl.findAllTxtByIdLangTable(beanSrc.getId_articolo(), "", "ARTICOLO"); + while (vecdtl.hasMoreElements()) { + DescTxtLang rowDtl = (DescTxtLang)vecdtl.nextElement(); + rowDtl.setIdTabella(beanDup.getId_articolo()); + rowDtl.setDBState(0); + rowDtl.save(); + } + Vectumerator vecAa = beanSrc.getAllegati(0L); + while (vecAa.hasMoreElements()) { + AllegatoArticolo rowAa = (AllegatoArticolo)vecAa.nextElement(); + String fullFileName = rowAa.getNomeFileCompleto(); + rowAa.setId_allegatoArticolo(0L); + rowAa.setDBState(0); + rowAa.setId_articolo(beanDup.getId_articolo()); + rp = rowAa.save(); + if (rp.getStatus()) + if (new File(fullFileName).exists()) + try { + DBAdapter.copyFile(fullFileName, rowAa.getNomeFileCompleto()); + } catch (Exception e) { + e.printStackTrace(); + } + } + return beanDup; + } + return null; + } + return null; + } + + public boolean isUsaSeriale() { + return (getTipo().getFlgTipoMagazzino() == 2L); + } + + public CaratteristicaArticolo getCaratteristicaArticolo(long l_id_caratteristica) { + Long l_key = new Long(l_id_caratteristica); + if (getCaratteristicheHT().containsKey(l_key)) + return (CaratteristicaArticolo)getCaratteristicheHT().get(l_key); + if (getApFull() != null) { + CaratteristicaArticolo ca = new CaratteristicaArticolo(getApFull()); + ca.findById_articoloId_caratteristica(getId_articolo(), l_id_caratteristica); + getCaratteristicheHT().put(l_key, ca); + return ca; + } + return new CaratteristicaArticolo(); + } + + public CaratteristicaArticolo getCaratteristicaArticoloOld(long l_id_caratteristica) { + CaratteristicaArticolo ca = new CaratteristicaArticolo(getApFull()); + ca.findById_articoloId_caratteristica(getId_articolo(), l_id_caratteristica); + return ca; + } + + public Vectumerator getCaratteristicheArticolo() { + return new CaratteristicaArticolo(getApFull()).findById_articolo(getId_articolo(), 0, 0); + } + + public String getCartItemDescription(String lang) { + return getNome() + " " + getNome(); + } + + public String getCartItemDescription2(String lang) { + if (getDescrizioneCommerciale(lang).isEmpty()) + return getDescrizioneTecnica(lang); + return getDescrizioneCommerciale(lang); + } + + public String getCartItemDescription3(String lang) { + return getNome(); + } + + public String getCartItemImage() { + if (getId_articoloVariante() > 0L) + return (getId_articoloVarianteKit() > 0L) ? ("_var/" + + + getPathIdStepDir() + getArticoloVariante().getImgFileName(getId_articoloVarianteKit() * 10L + 1L)) : ("_var/" + + + getPathIdStepDir() + getArticoloVariante().getImgFileName(1)); + return getPathIdStepDir() + getPathIdStepDir(); + } + + public long getCartItemUdm() { + return getFlgUdm(); + } + + public String getCodice() { + return (this.codice == null) ? "" : this.codice; + } + + public String getCodiceProduttore() { + return (this.codiceProduttore == null) ? "" : this.codiceProduttore; + } + + public double getCost() { + return getCostoNetto(); + } + + public double getCostoMinimo() { + double cm = 0.0D; + Vectumerator vec = getFornitori(); + while (vec.hasMoreElements()) { + ArticoloFornitore af = (ArticoloFornitore)vec.nextElement(); + if (cm == 0.0D) { + cm = af.getCostoTotale(); + continue; + } + cm = Math.min(af.getCostoTotale(), cm); + } + return cm; + } + + public String getDatoStrutturato(String lang) { + String dispo, condition; + if (getId_articolo() == 0L) + return ""; + ArticoloCR CR = new ArticoloCR(); + CR.setLang(lang); + StringBuilder sb = new StringBuilder(""); + return sb.toString(); + } + + public String getItemConditionSchema() { + if (getFlgStockOfferte() == 3L) + return "https://schema.org/UsedCondition"; + return "https://schema.org/NewCondition"; + } + + public Date getDataAggiornamento() { + return this.dataAggiornamento; + } + + public Date getDataFineVld() { + return this.dataFineVld; + } + + public Date getDataScadenzaOfferta() { + return getListinoArticoloBase().getDataScadenzaOffertaLA(); + } + + public Date getDataScadenzaOffertaWeb() { + if (getListinoArticoloBase().isOffertaValida()) + return getListinoArticoloBase().getDataScadenzaOffertaLA(); + if (getId_fornitoreCostoNuovo() > 0L && getDataScadenzaOffertaFornitore() != null && + DBAdapter.getDateDiff(getToday(), getDataScadenzaOffertaFornitore()) >= 0L) + return getDataScadenzaOffertaFornitore(); + return null; + } + + public Date getImportListinoDataScadenzaOfferta() { + return this.dataScadenzaOfferta; + } + + public String getDescFlgOfferta() { + if (isOfferta()) { + if (getDataScadenzaOfferta() == null) + return "Si"; + return "Si " + -getDateDiff(getDataScadenzaOfferta(), null); + } + if (this.flgStockOfferte == 1L) + return "Scad."; + return "No"; + } + + public String getDescrizione(String lang) { + String temp = super.getDescrizione(lang); + if (temp.isEmpty()) + temp = getNome(lang); + if (getParm("DOC_ARTICOLI_CON_CODICE").isTrue()) + temp = getCodice() + " " + getCodice(); + return temp; + } + + public String getDescrizione(String lang, int stringCaseType) { + String str = new String(); + str = convertStringCase(getDescrizione(lang), stringCaseType); + return str; + } + + public String getDescrizioneCommerciale(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizioneCommerciale", lang); + } + + public String getDescrizioneMarketplace(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizioneMarketplace", lang); + } + + public String getDescrizioneMarketplaceWeb(String lang) { + String temp = getDescrizioneMarketplace(lang); + if (temp.isEmpty()) + return getDescrizioneMarketplace("it"); + return temp; + } + + public String getSpecifiche(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("specifiche", lang); + } + + public String getDescrizioneBreveWeb(String lang) { + String temp = getDescrizioneBreve(lang); + if (temp.isEmpty()) + return getDescrizioneBreve("it"); + return temp; + } + + public String getDescrizioneCommercialeWeb(String lang) { + String temp = getDescrizioneCommerciale(lang); + if (temp.isEmpty()) + return getDescrizioneCommerciale("it"); + return temp; + } + + public String getSpecificheWeb(String lang) { + String temp = getSpecifiche(lang); + if (temp.isEmpty()) + return getSpecifiche("it"); + return temp; + } + + public String getSpecificheScript(String lang) { + return DBAdapter.prepareScriptString(getSpecifiche(lang)); + } + + public String getNomeMarketplace(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("nomeMarketplace", lang); + } + + public String getNomeMarketplaceWeb(String lang) { + String temp = getNomeMarketplace(lang); + if (temp.isEmpty()) + return getNomeMarketplace("it"); + return temp; + } + + public String getDescrizioneBreve(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizioneBreve", lang); + } + + public String getDescrizioneBreveScript(String lang) { + return DBAdapter.prepareScriptString(getDescrizioneBreve(lang)); + } + + public String getDescrizioneCompletaSenzaCodice(String lang) { + String l_nome = getNome(); + if (lang != null) + l_nome = getNome(lang); + StringBuilder sb = new StringBuilder(); + if (getId_articoloVariante() == 0L) { + if (getId_articoloTaglia() > 0L) { + sb.append((getMarca().getDescrizione() + " " + getMarca().getDescrizione()).trim() + " [" + (getMarca().getDescrizione() + " " + getMarca().getDescrizione()).trim() + "]"); + } else { + sb.append((getMarca().getDescrizione() + " " + getMarca().getDescrizione()).trim()); + } + } else if (getId_articoloTaglia() > 0L) { + sb.append(getArticoloVariante().getDescrizioneCompletaSenzaCodice(lang) + " [" + getArticoloVariante().getDescrizioneCompletaSenzaCodice(lang) + "]"); + } else { + sb.append(getArticoloVariante().getDescrizioneCompletaSenzaCodice(lang)); + } + return sb.toString(); + } + + public String getDescrizioneTecnica(String lang) { + if (lang.isEmpty()) + lang = "it"; + return convertStringToHtml(getDescTxtLang("descrizioneTecnica", lang)); + } + + public double getDiscount() { + return getPercSconto(); + } + + public Vectumerator getDisponibilitaMovimento() { + RigaDocumentoCR CR = new RigaDocumentoCR(); + CR.setId_articolo(getId_articolo()); + CR.setFlgInMagazzino(3L); + return new RigaDocumento(getApFull()).findMagSaldiArticoloByCR(CR, 0, 0); + } + + public Vectumerator getDisponibilitaMovimentoM() { + MovimentoCR CR = new MovimentoCR(); + CR.setId_articolo(getId_articolo()); + CR.setFlgInMagazzino(3L); + return new Movimento(getApFull()).findSaldiArticoloByCR(CR, 0, 0); + } + + public long getFlgAggiornaDati() { + return this.flgAggiornaDati; + } + + public long getFlgFuoriListino() { + return this.flgFuoriListino; + } + + public long getFlgNascondi() { + return this.flgNascondi; + } + + public long getFlgStato() { + return this.flgStato; + } + + public long getFlgStockOfferte() { + return this.flgStockOfferte; + } + + public long getFlgUdm() { + return this.flgUdm; + } + + public Vectumerator getFornitori() { + return new ArticoloFornitore(getApFull()).findById_articolo(getId_articolo(), 0, 0); + } + + public Vectumerator getProgettistiArticolo() { + return new ArticoloProgettista(getApFull()).findByArticolo(getId_articolo()); + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_articoloNext(ArticoloCR CR) { + if (!isFlgNextPrev()) + calcolaIdNextPrev(CR); + return this.id_articoloNext; + } + + public long getId_articoloPrev(ArticoloCR CR) { + if (!isFlgNextPrev()) + calcolaIdNextPrev(CR); + return this.id_articoloPrev; + } + + public long getId_articoloVarianteBaseNext(ArticoloCR CR) { + if (!isFlgNextPrev()) + calcolaIdVarianteNextPrev(CR); + return this.id_articoloVarianteBaseNext; + } + + public long getId_articoloVarianteBasePrev(ArticoloCR CR) { + if (!isFlgNextPrev()) + calcolaIdVarianteNextPrev(CR); + return this.id_articoloVarianteBasePrev; + } + + public long getId_iva() { + return this.id_iva; + } + + public long getId_marca() { + return this.id_marca; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public long getId_tipoTaglia() { + return this.id_tipoTaglia; + } + + public String getImgFileName(long imgNumber) { + return getImgFileName((int)imgNumber); + } + + public String getImgFileName(int imgNumber, String l_Tmst) { + return "" + getId_articolo() + "_" + getId_articolo() + "_" + l_Tmst + ".jpg"; + } + + public Object getItemId() { + if (getId_articoloTaglia() > 0L && getId_articoloTagliaKit() > 0L) + return new Long(getId_articoloTaglia()); + return new Long(getId_articolo()); + } + + public Iva getIva() { + this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, new Long(getId_iva())); + return this.iva; + } + + public double getIvaAliquota(long l_id_users) { + return (double)getIvaByUser(l_id_users).getAliquota(); + } + + public double getIvaAliquota(Clifor l_clifor) { + return (double)getIvaByClifor(l_clifor).getAliquota(); + } + + public long getId_iva(Clifor l_clifor) { + return getIvaByClifor(l_clifor).getId_iva(); + } + + public final Iva getIvaByUser(long l_id_users) { + if (l_id_users == 0L) + return getIva(); + Users user = new Users(getApFull()); + user.findByPrimaryKey(l_id_users); + return getIvaByClifor(user.getClifor()); + } + + public final Iva getIvaByClifor(Clifor clifor) { + if (clifor == null || clifor.getId_clifor() == 0L) + return getIva(); + if (clifor.getFlgRC() == 1L) { + if (getFlgRC() == 1L || getTipo().getFlgRC() == 1L) + return getIvaReverseCharge(); + } else if (clifor.getFlgArt8() == 1L) { + return getIvaArt8C(); + } + DestinazioneDiversa dd = clifor.getCurrentDD(); + if (clifor.isPrezzoWebEsente()) { + if (dd.getId_destinazioneDiversa() > 0L) { + if (clifor.getNazione().getCodice().equals("IT") && clifor.getFlgAzienda() == 1L && + dd.getNazioneDD().getFlgCee() == 1L) + return getIvaArt58(); + if (clifor.getNazione().getFlgCee() == 1L && !clifor.getNazione().getCodice().equals("IT") && + clifor.getFlgAzienda() == 1L && dd.getNazioneDD().getFlgCee() == 1L) + return getIvaArt41(); + return getIvaArt8A(); + } + if (clifor.getNazione().getFlgCee() == 1L) + return getIvaArt41(); + return getIvaArt8A(); + } + if (clifor.isIvaCeeOneStopShop()) { + boolean oss = false; + if (clifor.getFlgAzienda() == 0L && clifor.getNazione().getFlgCee() == 1L && + !clifor.getNazione().getCodice().equals("IT")) + if (dd.getId_destinazioneDiversa() > 0L) { + if (dd.getNazioneDD().getFlgCee() == 1L && !dd.getNazioneDD().getCodice().equals("IT")) { + oss = true; + } else { + oss = false; + } + } else { + oss = true; + } + if (oss) { + Nazione nazioneOss; + if (dd.getId_destinazioneDiversa() > 0L) { + nazioneOss = dd.getNazioneDD(); + } else { + nazioneOss = clifor.getNazione(); + } + if (nazioneOss.getId_iva() != 0L) + return nazioneOss.getIva(); + handleDebug("ERRORE! Articolo.getIvaByClifor Aliquota iva OSS per " + nazioneOss.getDescrizione() + " non impostata!!!!", 1); + return getIva(); + } + return getIva(); + } + return getIva(); + } + + public long getIvaItemId(long l_id_users) { + return getIvaByUser(l_id_users).getId_iva(); + } + + public String getLinkPreview() { + if (getApFull() != null) { + String temp = getParm("SERVERNAME").getTesto(); + return temp + "Catalogo.abl?cmd=md&id_articolo=" + temp + "&id_tipoMenu=" + getId_articolo() + "&id_tipoSel=" + getId_tipo(); + } + return ""; + } + + public String getLinkAmazon() { + StringBuilder sb = new StringBuilder(); + if (!getAsinAmz().isEmpty()) { + if (sb.length() > 0) + sb.append(", "); + sb.append(""); + sb.append("AZ_" + getAsinAmz()); + sb.append(""); + } else if (!getCodiceEan().isEmpty()) { + if (sb.length() > 0) + sb.append(", "); + sb.append(""); + sb.append("AZ_" + getCodiceEanNoZero()); + sb.append(""); + } + return sb.toString(); + } + + public Marca getMarca() { + this.marca = (Marca)getSecondaryObject(this.marca, Marca.class, new Long(getId_marca())); + return this.marca; + } + + public long getMesigar() { + return this.mesigar; + } + + public String getNascondi() { + return getNascondi(getFlgNascondi()); + } + + public String getNome() { + return (this.nome == null) ? "" : this.nome.trim(); + } + + public String getCCNome(String lang) { + StringBuilder sb = new StringBuilder(); + sb.append(getMarca().getDescrizione()); + sb.append(" "); + if (!getDescrizioneBreve(lang).isEmpty() && getDescrizioneBreve(lang).length() < getNome(lang).length()) { + sb.append(getDescrizioneBreve(lang).replace("/", "/ ")); + } else { + sb.append(getNome(lang).replace("/", "/ ")); + } + if (getId_articoloVariante() > 0L) { + sb.append(" "); + sb.append(getArticoloVariante().getNomeV(lang)); + } + if (!getCodiceProduttore().isEmpty()) { + sb.append(" "); + sb.append(getCodiceProduttore()); + } + return eliminaDoppioniInStringa(sb.toString()); + } + + public String getCCNomeUrl(String lang) { + return convertStringToLink(getNome(lang)); + } + + public long getOrdine() { + return this.ordine; + } + + public String getPathAllegato() { + return getDocBase() + getDocBase(); + } + + public String getPathAllegatoOld() { + return (this.pathAllegatoOld == null) ? "" : this.pathAllegatoOld; + } + + public String getPathTmp() { + return getDocBase() + getDocBase(); + } + + public double getPercSconto() { + return getListinoArticoloBase().getPercEffettiva(); + } + + public double getImportListinoPercSconto() { + return this.percSconto; + } + + public double getPesoKg() { + return this.pesoKg; + } + + public long getPrenotatiArt() { + return this.prenotatiArt; + } + + public double getCostoAcquistoUltimoConIva(Clifor l_clifor) { + if (getId_articolo() != 0L && l_clifor.getId_clifor() != 0L) { + Vectumerator vec = new ArticoloFornitore(getApFull()).findById_articoloFornitore(getId_articolo(), l_clifor.getId_clifor(), 1, 1); + if (vec.hasMoreElements()) { + ArticoloFornitore af = (ArticoloFornitore)vec.nextElement(); + return af.getCostoTotaleIvato(); + } + return getCostoAcquistoUltimoConIva(); + } + return getCostoAcquistoUltimoConIva(); + } + + public double getCostoAcquisto() { + if (getCostoNetto() != 0.0D) + return getCostoNetto(); + return getCostoAcquistoUltimo(); + } + + public double getPrezzoPubblico() { + return getPrezzoPubblico(null); + } + + public double getCostoNettoIva() { + return DBAdapter.conIva(getCostoNetto(), (double)getIva().getAliquota()); + } + + public double getPrezzoVendor() { + return this.prezzoVendor; + } + + public double getPrice() { + return getPrezzoPubblico(null); + } + + public double getPriceWVat() { + return getPrezzoPubblicoIva(null); + } + + public double getQuantitaData(Date data) { + if (!isQuantitaDataCalcolate()) { + this.quantitaData = getQuantita(data); + setQuantitaDataCalcolate(true); + } + return this.quantitaData; + } + + public Articolo getRandomArticolo() { + String s_Sql_Find = "select A.* from ARTICOLO AS A"; + String wc = ""; + wc = buildWc(wc, "A.flgOfferta =1"); + wc = buildWc(wc, "(A.dataScadenzaOfferta>? or A.dataScadenzaOfferta is null )"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + Calendar cal = Calendar.getInstance(); + Date today = new Date(cal.getTimeInMillis()); + stmt.setDate(1, today); + Vectumerator vec = findRows(stmt, 0, 0); + if (!vec.hasMoreElements()) + vec = findAll(); + int totRecords = vec.getTotNumberOfRecords(); + if (totRecords > 0) { + int idx = (int)(Math.random() * (double)totRecords); + return (Articolo)vec.elementAt(idx); + } + return new Articolo(getApFull()); + } catch (Exception e) { + handleDebug(e); + return new Articolo(getApFull()); + } + } + + public double getRicaricoBase() { + return this.ricaricoBase; + } + + public double getRicaricoPAMax() { + return getRicaricoCalc(getCostoAcquistoUltimo()); + } + + public double getRicaricoPAMin() { + return getRicaricoCalc(getCostoAcquistoUltimo()); + } + + public String getStato() { + return getStato(getFlgStato()); + } + + public String getStockOfferte() { + return getStockOfferte(getFlgStockOfferte()); + } + + public double getStreetPrice() { + return this.streetPrice; + } + + public Vectumerator getTaglie() { + return new Taglia(getApFull()).findById_articolo(getId_articolo(), 0, 0); + } + + public double getPrezzoVenditaConfezioneCalcolatoSuCosto() { + if (getId_articolo() == 0L || getPercRicarico() <= 0.0D || getTotCostoConfezione() <= 0.0D) + return 0.0D; + DoubleOperator dop = new DoubleOperator(getPercRicarico()); + dop.setScale(4, 5); + dop.add(100); + dop.multiply(getTotCostoConfezione()); + dop.divide(100.0F); + return dop.getResult(); + } + + public double getPrezzoVenditaCalcolatoSuCostoNetto() { + if (getId_articolo() == 0L || getPercRicarico() <= 0.0D || getCostoNetto() <= 0.0D) + return 0.0D; + DoubleOperator dop = new DoubleOperator(getPercRicarico()); + dop.setScale(4, 5); + dop.add(100); + dop.multiply(getCostoNetto()); + dop.divide(100.0F); + return dop.getResult(); + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo()); + return this.tipo; + } + + public TipoTaglia getTipoTaglia() { + this.tipoTaglia = (TipoTaglia)getSecondaryObject(this.tipoTaglia, TipoTaglia.class, getId_tipoTaglia()); + return this.tipoTaglia; + } + + public String getUdm() { + return getUdm(getFlgUdm()); + } + + public String getUdmQuantita() { + return getUdm() + " " + getUdm(); + } + + public long getVolumeCm3() { + return this.volumeCm3; + } + + public boolean hasAllegati() { + return getAllegati(0L).hasMoreElements(); + } + + public ResParm impostaVisibilita(ArticoloCR CR) { + String s_Sql_Find = "UPDATE ARTICOLO as A SET flgNascondi=" + CR.getFlgNascondiNew(); + WcString wc = new WcString(); + if (CR.getId_articolo() != 0L) + wc.addWc("A.id_articolo=" + CR.getId_articolo()); + if (CR.getId_tipo() != 0L) + wc.addWc("A.id_tipo=" + CR.getId_tipo()); + if (CR.getId_marca() != 0L) + wc.addWc("A.id_marca=" + CR.getId_marca()); + if (CR.getFlgNascondi() >= 0L) + if (CR.getFlgNascondi() == 0L) { + wc.addWc("(A.flgNascondi=0 or A.flgNascondi is null)"); + } else { + wc.addWc("A.flgNascondi=" + CR.getFlgNascondi()); + } + return update(s_Sql_Find + s_Sql_Find); + } + + protected void initFields() { + super.initFields(); + setFlgNextPrev(false); + setId_articoloVarianteBaseNext(0L); + setId_articoloVarianteBasePrev(0L); + setId_articoloVariante(0L); + setFlgStampaEtichette(-1L); + setFlgStampaAccessori(-1L); + setFlgEscludiWebArt(-1L); + setFlgUsaVariantiArt(-1L); + setFlgStampaAccessori(-1L); + setQuantitaCalcolate(false); + setQuantitaEffettiva(0.0D); + setQuantitaImpegnata(0.0D); + setQuantitaInArrivo(0.0D); + setCaratteristicheHT(null); + setQuantitaW(0.0D); + setListinoArticoloBase(null); + setPrezzoArticolo(null); + setPrezzoArticoloIva(null); + setQuantitaData(0.0D); + setQuantitaDB(0.0D); + setDescrizioneCaratteristiche(null); + setTotCostoConfezione(-1.0D); + setListinoArticoloBase(null); + setSitemapPriority(80L); + setQtaEbay(2L); + } + + public boolean isFlgNextPrev() { + return this.flgNextPrev; + } + + public boolean isImgExist(int imgNumber) { + String targetDir = getDocBase() + getDocBase(); + return isFileExist(targetDir + targetDir); + } + + public boolean isOfferta() { + if (getFlgStockOfferte() != 1L) + return false; + if (getDataScadenzaOfferta() == null) + return true; + if (getDateDiff(getDataScadenzaOfferta(), getToday()) > 0L) + return false; + return true; + } + + public boolean isRM() { + return false; + } + + public boolean isSale() { + return !(getPercSconto() == 0.0D); + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + if (getVolumeM3() > 0.0D) + setVolumeCm3(0L); + String temp = getCodiciAlternativi(); + if (!temp.isEmpty()) { + if (!temp.startsWith(",")) + temp = "," + temp; + if (!temp.endsWith(",")) + temp = temp + ","; + } + setCodiciAlternativi(temp.replace(", ", ",")); + temp = getCategoriaImport(); + if (!temp.isEmpty()) { + if (!temp.startsWith(",")) + temp = "," + temp; + if (!temp.endsWith(",")) + temp = temp + ","; + } + setCategoriaImport(temp.replace(", ", ",")); + if (getCategoriaImport().length() > 1000) + setCategoriaImport(getCategoriaImport().substring(0, 999)); + temp = getTagArticolo(); + if (!temp.isEmpty()) { + if (!temp.startsWith(",")) + temp = "," + temp; + if (!temp.endsWith(",")) + temp = temp + ","; + } + setTagArticolo(temp.replace(", ", ",")); + if (getFlgNoListinoArt() == -1L) { + setFlgNoListino(getTipo().getFlgNoListinoEffettivo()); + } else { + setFlgNoListino(getFlgNoListinoArt()); + } + if (getFlgUsaVariantiArt() == -1L) { + setFlgUsaVarianti(getTipo().getFlgUsaVarianti()); + } else { + setFlgUsaVarianti(getFlgUsaVariantiArt()); + } + if (getFlgKitArt() == -1L) { + setFlgKit(getTipo().getFlgKit()); + } else { + setFlgKit(getFlgKitArt()); + } + if (getFlgEscludiWebArt() == -1L) { + setFlgEscludiWeb(getTipo().getFlgEscludiWeb()); + } else { + setFlgEscludiWeb(getFlgEscludiWebArt()); + } + setFlgTipoMagazzino(getTipo().getFlgTipoMagazzino()); + if (!usaMagazzino()) + setFlgDispo(1L); + if (getFlgArticoloComponente() == 1L) { + setFlgUsaVarianti(0L); + setFlgUsaVariantiArt(0L); + } + if (getFlgGoogleDB() == 1L && getFlgGoogle() == 0L) + setGoogleFeedFileName(null); + if (getFlgUsato() == 0L) + if (getId_statoUsato() > 3L) + setId_statoUsato(1L); + super.prepareSave(ps); + } + + public void setArticoloVarianteBase(ArticoloVariante articoloVarianteBase) { + this.articoloVarianteBase = articoloVarianteBase; + } + + public void setCodice(String codice) { + this.codice = codice; + } + + public void setCodiceProduttore(String codiceProduttore) { + this.codiceProduttore = codiceProduttore; + } + + public void setDataAggiornamento(Date dataAggiornamento) { + this.dataAggiornamento = dataAggiornamento; + } + + public void setDataFineVld(Date newDataFineVld) { + this.dataFineVld = newDataFineVld; + } + + public String getDescrizioneFornitori() { + if (getId_articolo() == 0L) + return ""; + StringBuilder sb = new StringBuilder(); + Vectumerator vec = new ArticoloFornitore(getApFull()).findById_articolo(getId_articolo(), 0, 0); + while (vec.hasMoreElements()) { + ArticoloFornitore af = (ArticoloFornitore)vec.nextElement(); + if (sb.length() > 0) + sb.append(";"); + sb.append(af.getFornitore().getCognomeNome()); + } + return sb.toString(); + } + + public void setDataScadenzaOfferta(Date dataScadenzaOfferta) { + this.dataScadenzaOfferta = dataScadenzaOfferta; + } + + public void setDescrizioneCommerciale_it(String descrizioneCommerciale_it) { + this.descrizioneCommerciale_it = descrizioneCommerciale_it; + } + + public void setFlgAggiornaDati(long flgAggiornaDati) { + this.flgAggiornaDati = flgAggiornaDati; + } + + public void setFlgFuoriListino(long flgFuoriListino) { + this.flgFuoriListino = flgFuoriListino; + } + + public void setFlgNascondi(long l) { + this.flgNascondi = l; + } + + public void setFlgNextPrev(boolean flgNextPrev) { + this.flgNextPrev = flgNextPrev; + } + + public void setFlgStato(long flgStato) { + this.flgStato = flgStato; + } + + public void setFlgStockOfferte(long newFlgStockOfferte) { + this.flgStockOfferte = newFlgStockOfferte; + } + + public void setFlgUdm(long flgUdm) { + this.flgUdm = flgUdm; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + } + + public void setId_articoloNext(long id_articoloNext) { + this.id_articoloNext = id_articoloNext; + } + + public void setId_articoloPrev(long id_articoloPrev) { + this.id_articoloPrev = id_articoloPrev; + } + + public void setId_articoloVarianteBaseNext(long id_articoloNext) { + this.id_articoloVarianteBaseNext = id_articoloNext; + } + + public void setId_articoloVarianteBasePrev(long id_articoloPrev) { + this.id_articoloVarianteBasePrev = id_articoloPrev; + } + + public void setId_iva(long newId_iva) { + this.id_iva = newId_iva; + setIva(null); + } + + public void setId_marca(long newId_marca) { + this.id_marca = newId_marca; + setMarca(null); + } + + public void setId_tipo(long id_tipo) { + this.id_tipo = id_tipo; + setTipo(null); + } + + public void setId_tipoTaglia(long newId_tipoTaglia) { + this.id_tipoTaglia = newId_tipoTaglia; + setTipoTaglia(null); + } + + public void setIva(Iva newIva) { + this.iva = newIva; + } + + public void setMarca(Marca newMarca) { + this.marca = newMarca; + } + + public void setMesigar(long mesigar) { + this.mesigar = mesigar; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public void setOrdine(long ordine) { + this.ordine = ordine; + } + + public void setPercSconto(double percSconto) { + this.percSconto = percSconto; + } + + public void setPesoKg(double pesoKg) { + this.pesoKg = pesoKg; + } + + public void setPrenotatiArt(long newGiacenza) { + this.prenotatiArt = newGiacenza; + } + + public void setPrezzoVendor(double prezzoVendor) { + this.prezzoVendor = prezzoVendor; + } + + public void setQuantita(double l_quantita) { + this.quantita = l_quantita; + } + + public void setRicaricoBase(double l) { + this.ricaricoBase = l; + } + + public void setStreetPrice(double streetPrice) { + this.streetPrice = streetPrice; + } + + public void setTipo(Tipo tipo) { + this.tipo = tipo; + } + + public void setTipoTaglia(TipoTaglia newTipoTaglia) { + this.tipoTaglia = newTipoTaglia; + } + + public void setVolumeCm3(long volumeCm3) { + this.volumeCm3 = volumeCm3; + } + + protected boolean useNullFor0() { + return false; + } + + public Vectumerator findById_tabellaTaglia(long l_id, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_TABELLA_TAGLIA AS A, ARTICOLO AS B"; + String s_Sql_Order = " order by B.nome"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=B.id_articolo"); + wc.addWc("A.id_tabellaTaglia=" + l_id); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByCodice(String l_codice) { + String s_Sql_Find = "select A.* from ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice='" + prepareInputMySqlString(l_codice, false) + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByEbayItemId(String l_ebayItemId) { + String s_Sql_Find = "select A.* from ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.ebayItemId='" + l_ebayItemId + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByCodiceFornitoreSerie(String l_codiceFornitore, String serie) { + String s_Sql_Find = "select A.* from ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.codiciAlternativi LIKE '%," + l_codiceFornitore + ",%'"); + if (!serie.isEmpty()) + wc.addWc(" A.codice LIKE '" + serie + "%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByAsinAmz(String l_asinAmz) { + String s_Sql_Find = "select A.* from ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.asinAmz like '%" + l_asinAmz + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByCodiceEanSerie(String l_codiceEan, String serie) { + String s_Sql_Find = "select A.* from ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.codiceEan like '%" + l_codiceEan + "'"); + if (serie != null && !serie.isEmpty()) + wc.addWc(" A.codice LIKE '" + serie + "%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public long getId_tabellaTaglia() { + return this.id_tabellaTaglia; + } + + public TabellaTaglia getTabellaTaglia() { + this.tabellaTaglia = (TabellaTaglia)getSecondaryObject(this.tabellaTaglia, TabellaTaglia.class, getId_tabellaTaglia()); + return this.tabellaTaglia; + } + + public void setId_tabellaTaglia(long newId_tabellaTaglia) { + this.id_tabellaTaglia = newId_tabellaTaglia; + setTabellaTaglia(null); + } + + public void setTabellaTaglia(TabellaTaglia newTabellaTaglia) { + this.tabellaTaglia = newTabellaTaglia; + } + + public Vectumerator findRandomArticoli(long l_id_vetrina, int numRecord, boolean disponibili) { + String s_Sql_Find = "select A.* from ARTICOLO AS A"; + s_Sql_Find = "SELECT A.*,B.id_articoloVariante as id_articoloVariante, B.flgNascondi AS flgNascondi_variante, C.flgNascondi AS flgNascondi_tipo, B.id_vetrina as v2 FROM TIPO AS C INNER JOIN (ARTICOLO AS A LEFT JOIN ARTICOLO_VARIANTE AS B ON A.id_articolo = B.id_articolo) ON C.id_tipo = A.id_tipo"; + WcString wc = new WcString(); + wc.addWc("(A.flgEscludiWeb=0 or A.flgEscludiWeb is null)"); + wc.addWc("(A.flgNascondi=0 or A.flgNascondi is null)"); + wc.addWc("(B.flgNascondi=0 or B.flgNascondi is null)"); + wc.addWc("(C.flgNascondi=0 or C.flgNascondi is null)"); + if (disponibili) + wc.addWc("A.quantita>0"); + if (l_id_vetrina > 0L) + wc.addWc("(A.id_vetrina=" + l_id_vetrina + " or B.id_vetrina=" + l_id_vetrina + ")"); + long qta = getParm("QTA_MINIMA_VISIBILE").getNumeroLong(); + if (qta > 0L) + wc.addWc("B.quantitaAV > " + qta); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + Vectumerator vec = findRows(stmt, 0, 0); + if (!vec.hasMoreElements()) + return AB_EMPTY_VECTUMERATOR; + int totRecords = vec.getTotNumberOfRecords(); + if (totRecords <= numRecord) { + Vectumerator vectumerator = new Vectumerator(); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (row.getId_articoloVariante() == 0L) { + vectumerator.add(row); + continue; + } + ArticoloVariante av = new ArticoloVariante(getApFull()); + av.findByPrimaryKey(row.getId_articoloVariante()); + vectumerator.add(av); + } + return vectumerator; + } + Vectumerator vec2 = new Vectumerator(); + Hashtable idxH = new Hashtable(); + for (int i = 0; i < numRecord; i++) { + int idx; + do { + idx = (int)(Math.random() * (double)totRecords); + } while (idxH.containsKey(new Integer(idx))); + idxH.put(new Integer(idx), ""); + Articolo row = (Articolo)vec.get(idx); + if (row.getId_articoloVariante() == 0L) { + vec2.add(row); + } else { + ArticoloVariante av = new ArticoloVariante(getApFull()); + av.findByPrimaryKey(row.getId_articoloVariante()); + vec2.add(av); + } + } + return vec2; + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + setArticoloVariante(null); + } + + public ResParm aggiornaQuantita(long l_flgUdm, double l_qta) { + setFlgUdm(l_flgUdm); + setQuantita(l_qta); + handleQuantitaDebugBeforeSave("aggiornaQuantita"); + return super.save(); + } + + public ResParm azzeraQuantita() { + return azzeraQuantita(getFlgModImportazione()); + } + + public ResParm azzeraQuantita(long l_flgModImportazione) { + ResParm rp; + if (getParm("USA_MAGAZZINO").isTrue()) { + if (getId_articolo() > 0L) { + String s_sql_sqring; + if (getId_fornitoreCostoNuovo() == 0L) { + s_sql_sqring = "UPDATE ARTICOLO_FORNITORE SET dispSede=0, dispCash=0 where id_articolo=" + getId_articolo(); + } else { + s_sql_sqring = "UPDATE ARTICOLO_FORNITORE SET dispSede=0, dispCash=0 where id_articolo=" + getId_articolo() + " and id_clifor=" + getId_fornitoreCostoNuovo(); + } + rp = update(s_sql_sqring); + if (rp.getStatus()) + if (getId_fornitoreCostoNuovo() > 0L) { + rp = aggiornaPrezziEDispoByFornitori(0.0D, false); + } else { + setQuantita(0.0D); + handleQuantitaDebugBeforeSave("aggiornaQuantita"); + rp = super.save(); + } + } else { + rp = new ResParm(false, "Articolo non selezionato"); + } + } else { + rp = new ResParm(false, "Attenzione! Gestione magazzino tramite movimenti!"); + } + return rp; + } + + public long getFlgAggGiacenza() { + return this.flgAggGiacenza; + } + + public void setFlgAggGiacenza(long flgAggGiacenza) { + this.flgAggGiacenza = flgAggGiacenza; + } + + public String getCodiciAlternativi() { + return (this.codiciAlternativi == null) ? "" : this.codiciAlternativi.trim(); + } + + public void setCodiciAlternativi(String codiciAlternativi) { + this.codiciAlternativi = codiciAlternativi; + } + + public String getDescrizione() { + if (getId_articoloVariante() == 0L) + return getDescrizione("it"); + return getArticoloVariante().getDescrizione("it"); + } + + public double getAvail() { + if (getQtaMaxAcquistoWww() < 0L) + return 0.0D; + if (getQtaMaxAcquistoWww() == 0L) + return getQuantitaEffettiva(); + return Math.min(getQuantitaEffettiva(), (double)getQtaMaxAcquistoWww()); + } + + public ByteArrayOutputStream creaLabelArticoloA4Pdf(ArticoloCR CR) { + long pHMarg = getParm("LABEL_ART_A4_MARGINE").getNumeroLong(); + long l_indent = 4L; + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + this.document = new Document(PageSize.A4, 0.0F, 0.0F, 0.0F, 0.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + long labelNumber = 0L; + String dim = getParm("LABEL_ART_A4_COL_ROW").getTesto(); + int nCol = Integer.parseInt(dim.substring(0, dim.indexOf(','))); + int nRow = Integer.parseInt(dim.substring(dim.indexOf(',') + 1)); + float[] widths = { 0.25F, 0.25F, 0.25F, 0.25F }; + this.pdfPcorpo = new PdfPTable(widths); + this.pdfPcorpo.setWidthPercentage(100.0F); + if (CR.getBlankLabels() > 0L) { + PdfPCell cell = new PdfPCell(); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setIndent((float)l_indent); + cell.setBorder(0); + for (int i = 0; (long)i < CR.getBlankLabels(); i++) { + labelNumber++; + this.pdfPcorpo.addCell(cell); + } + } + if (CR.getId_articolo() != 0L) { + findByPrimaryKey(CR.getId_articolo()); + labelNumber = (long)addLabelUnArticoloA4Pdf("", nRow, CR.getNumLabels(), null, CR.getId_articoloVariante()); + } else { + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Articolo rowBean = (Articolo)vec.nextElement(); + labelNumber += + (long)rowBean.addLabelUnArticoloA4Pdf("", nRow, CR.getNumLabels(), null, CR.getId_articoloVariante()); + } + } + if (labelNumber == 0L) { + Phrase ph = new Phrase("Attenzione! Non ci sono etichette da stampare!"); + PdfPCell cell = new PdfPCell(ph); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setIndent((float)l_indent); + cell.setBorder(0); + cell.setColspan(nCol); + this.pdfPcorpo.addCell(cell); + } else { + long numberBlankCell = (long)nCol - labelNumber % (long)nCol; + PdfPCell cell = new PdfPCell(); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setIndent((float)l_indent); + cell.setBorder(0); + if (numberBlankCell != (long)nCol) + for (int i = 0; (long)i < numberBlankCell; i++) + this.pdfPcorpo.addCell(cell); + } + this.document.add((Element)this.pdfPcorpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public ResParm save() { + updateHashCodeCurrent(); + ResParm rp = super.save(); + if (rp.getStatus()) { + setDescrizioneSearch(getBuildedDescSearch()); + updateErroriSeo(); + String temp = getTipo().getIndici() + getTipo().getIndici(); + if (temp.length() > 254) { + setIdTipoSearch(temp.substring(0, 254)); + } else { + setIdTipoSearch(temp); + } + setTipoOrdineSearch(getTipo().getOrdine()); + setTipoDescrizioneSearch(getTipo().getDescrizione()); + if (getCodice().isEmpty()) + setCodice(zeroLeft(getId_articolo(), 10)); + setDescTxtLang("descrizione", "it", getNome()); + if (!getSimboliLavaggio().hasAlmenoUnSimbolo()) { + SimboliLavaggio sl = getSimboliLavaggioDefault(); + if (sl != null) { + setLavaggio((long)sl.getLavaggio().getCodiceSimbolo()); + setCandeggio((long)sl.getCandeggio().getCodiceSimbolo()); + setStiratura((long)sl.getStiratura().getCodiceSimbolo()); + setPulituraSecco((long)sl.getPulituraSecco().getCodiceSimbolo()); + setAsciugatura((long)sl.getAsciugatura().getCodiceSimbolo()); + } + } + if (getId_fornitoreCostoNuovo() == 0L) + setDataScadenzaOffertaFornitore(null); + if (getTipo().getFlgControlloCostiAggFor() == 0L) { + setFlgControlloCostoAggArt(1L); + } else { + ArticoloFornitore af = new ArticoloFornitore(getApFull()); + setFlgControlloCostoAggArt(af.checkControlloAggiuntivoByArticolo(getId_articolo()) ? 1L : 0L); + } + return super.save(); + } + return rp; + } + + private String getBuildedDescSearch() { + StringBuilder sb = new StringBuilder(); + if (!getKeywords().isEmpty()) + sb.append(getKeywords()); + StringBuilder l_readyForweb = new StringBuilder(); + String lingue = getParm("LANG_AVAILABLE").getTesto(); + if (lingue.isEmpty()) + lingue = "it"; + StringTokenizer st = new StringTokenizer(lingue, ","); + while (st.hasMoreTokens()) { + String l_currentLang = st.nextToken().trim(); + if (isReadyForWeb(l_currentLang)) { + l_readyForweb.append(","); + l_readyForweb.append(l_currentLang); + } + sb.append(getTipo().getDescrizioneCompletaSpaces(l_currentLang)); + sb.append(" "); + sb.append(getNome(l_currentLang)); + sb.append(" "); + sb.append(getDescrizioneBreve(l_currentLang)); + sb.append(" "); + } + l_readyForweb.append(","); + setReadyForWeb(l_readyForweb.toString()); + sb.append(" "); + sb.append(getMarca().getDescrizione()); + sb.append(" "); + sb.append(getNome()); + sb.append(" "); + if (!getCodiceEan().isEmpty()) { + sb.append(getCodiceEan()); + sb.append(" "); + } + if (!getCodiceProduttore().isEmpty()) { + sb.append(getCodiceProduttore()); + sb.append(" "); + } + Vectumerator vecCa = getCaratteristicheArticolo(); + while (vecCa.hasMoreElements()) { + CaratteristicaArticolo rowCa = (CaratteristicaArticolo)vecCa.nextElement(); + sb.append(rowCa.getVal()); + sb.append(" "); + } + String descSearch = eliminaDoppioniInStringa( + sb.toString().toLowerCase().replace('/', ' ').replace('\\', ' ').replace("(", "").replace(")", ""), 2, true); + if (descSearch.length() > 1000) + return descSearch.substring(0, 990); + return descSearch; + } + + public void updateErroriSeo() { + StringBuilder sb = new StringBuilder(); + String br = "
"; + if (getParm("SEO_VERSION").getNumeroLong() == 0L) { + if ((long)getCCSeoTitle("it").length() > 60L) { + sb.append("Titolo pagina troppo lungo(>60): " + getCCSeoTitle("it").length()); + sb.append("
"); + } + if ((long)getCCTagH1("it").length() > 70L) { + sb.append("Tag H1 troppo lungo(>70): " + getCCTagH1("it").length()); + sb.append("
"); + } + if ((long)getCCTagH2Web("it").length() > 70L) { + sb.append("Tag H2 troppo lungo(>70): " + getCCTagH2Web("it").length()); + sb.append("
"); + } + String link = getCCLinkDettaglio(new ArticoloCR()); + if ((long)link.length() > 80L) { + sb.append("Link Url troppo lungo (>80): " + link.length()); + sb.append("
"); + } + if ((long)getCCMetaDescriptionWeb("it").length() > 150L) { + sb.append("Meta Description troppo lunga(>150): " + + getCCMetaDescriptionWeb("it").length()); + sb.append("
"); + } + } else if (getParm("SEO_VERSION").getNumeroLong() == 1L) { + if ((long)getTFSeoTitle("it").length() > 60L) { + sb.append("Titolo pagina troppo lungo(>60): " + getTFSeoTitle("it").length()); + sb.append("
"); + } + if ((long)getCCTagH1("it").length() > 70L) { + sb.append("Tag H1 troppo lungo(>70): " + getCCTagH1("it").length()); + sb.append("
"); + } + if ((long)getCCTagH2Web("it").length() > 70L) { + sb.append("Tag H2 troppo lungo(>70): " + getCCTagH2Web("it").length()); + sb.append("
"); + } + String link = getCCLinkDettaglio(new ArticoloCR()); + if ((long)link.length() > 80L) { + sb.append("Link Url troppo lungo (>80): " + link.length()); + sb.append("
"); + } + if ((long)getTFMetaDescriptionWeb("it").length() > 150L) { + sb.append("Meta Description troppo lunga(>150): " + + getTFMetaDescriptionWeb("it").length()); + sb.append("
"); + } + } + setErroriSeo(sb.toString()); + } + + public ResParm aggiornaCodice(String l_codice) { + setCodice(l_codice); + return super.save(); + } + + public String getSeriale() { + return (this.seriale == null) ? "" : this.seriale.trim(); + } + + public void setSeriale(String seriale) { + this.seriale = seriale; + } + + public long getFlgUsaVarianti() { + return this.flgUsaVarianti; + } + + public void setFlgUsaVarianti(long flgUsaVarianti) { + this.flgUsaVarianti = flgUsaVarianti; + } + + public Vectumerator findArticoliTessuto() { + ArticoloArticoloTessuto atf = new ArticoloArticoloTessuto(getApFull()); + return atf.findByArticolo(getId_articolo()); + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante()); + return this.articoloVariante; + } + + public void setArticoloVariante(ArticoloVariante newArticoloVariante) { + this.articoloVariante = newArticoloVariante; + } + + public Vectumerator findByCRAvx(ArticoloCR CR, int pageNumber, int pageRows) { + if (CR.getFlgTipoRicerca() == 1L) + return findByCRSerMovimento(CR, pageNumber, pageRows); + String s_Sql_Find1 = "select C.id_articoloTaglia, B.id_articoloVariante as id_articoloVariante, A.* from ARTICOLO AS A JOIN ARTICOLO_VARIANTE AS B ON A.id_articolo=B.id_articolo LEFT JOIN ARTICOLO_TAGLIA AS C ON A.id_articolo=C.id_articolo AND B.id_articoloVariante=C.id_articoloVariante"; + String s_Sql_Find2 = "select C.id_articoloTaglia, 0 as id_articoloVariante, A.* from ARTICOLO AS A LEFT JOIN ARTICOLO_TAGLIA AS C ON A.id_articolo=C.id_articolo and (C.id_articoloVariante is null or C.id_articoloVariante=0) "; + String s_Sql_Order = " order by A.nome, A.descrizione_it"; + WcString wc = new WcString(); + StringBuffer wcArt = new StringBuffer("("); + StringBuffer wcArtVar = new StringBuffer("("); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + while (st.hasMoreTokens()) { + String token = star + star; + wcArt.append("(A.codice like '" + token + "%' or A.nome like '" + token + "%' or A.codiciAlternativi like '%," + token + ",%')"); + wcArtVar.append("(A.codice like '" + token + "%' or A.nome like '" + token + "%' or B.codiceVariante like '" + token + "%' or B.codiciAlternativiV like '%," + token + ",%' or B.nomeV like '" + token + "%')"); + if (st.hasMoreTokens()) { + wcArt.append(" and "); + wcArtVar.append(" and "); + star = "%"; + } + } + wcArt.append(")"); + wcArtVar.append(")"); + } + if (wcArt.length() > 2) { + wc.addWc("(" + wcArt.toString() + " and (A.flgUsaVarianti=0 or A.flgUsaVarianti is null) and A.flgNascondi>-1 and A.dataFineVld is null) OR (" + + + wcArtVar.toString() + " and B.id_articoloVariante Is Not Null AND A.flgUsaVarianti=1 and A.flgNascondi>-1 and A.dataFineVld is null)"); + } else { + wc.addWc("A.flgUsaVarianti=0 OR (B.id_articoloVariante Is Not Null AND A.flgUsaVarianti=1 and A.flgNascondi>-1 and A.dataFineVld is null)"); + } + String wcSql1 = wc.toString(); + wc.addWc("A.flgUsaVarianti=0"); + String wcSql2 = wc.toString(); + try { + PreparedStatement stmt = getConn() + .prepareStatement(s_Sql_Find1 + s_Sql_Find1 + wcSql1 + " union " + s_Sql_Order + s_Sql_Find2 + wcSql2); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + setQuantitaDB(this.quantita); + setCostoNettoDb(getCostoNetto()); + setFlgGoogleDB(getFlgGoogle()); + try { + if (isColumnInResultSet(rst, "id_articoloVariante")) + setId_articoloVariante(rst.getLong("id_articoloVariante")); + if (isColumnInResultSet(rst, "id_articoloTaglia")) + setId_articoloTaglia(rst.getLong("id_articoloTaglia")); + if (isColumnInResultSet(rst, "seriale")) + setSeriale(rst.getString("seriale")); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public long getFlgStampaEtichette() { + return this.flgStampaEtichette; + } + + public void setFlgStampaEtichette(long flgStampaEtichette) { + this.flgStampaEtichette = flgStampaEtichette; + } + + public String getStampaEtichette() { + if (this.flgStampaEtichette == 0L) + return "No"; + if (this.flgStampaEtichette == 1L) + return "Si"; + if (this.flgStampaEtichette == -1L) + return getTipo().getStampaEtichette(); + return "??"; + } + + public long getFlgStampaEtichetteT() { + if (getFlgStampaEtichette() == -1L) + return getTipo().getFlgStampaEtichette(); + return getFlgStampaEtichette(); + } + + public ResParm copyAccessoriDaArticolo(long l_id_articolo) { + ResParm rp = new ResParm(); + Articolo bean = new Articolo(getApFull()); + bean.findByPrimaryKey(l_id_articolo); + if (bean.getDBState() == 1) { + Vectumerator vec = bean.getAccessori(); + while (vec.hasMoreElements()) { + Accessorio row = (Accessorio)vec.nextElement(); + row.setDBState(0); + row.setId_accessorio(0L); + if (row.getId_articolo() == bean.getId_articolo()) { + row.setId_articolo(getId_articolo()); + } else { + row.setId_articoloAssociato(getId_articolo()); + } + rp = addAccessorio(row); + if (!rp.getStatus()) + return rp; + } + rp.setStatus(true); + rp.setMsg("Copia Accessori da " + bean.getDescrizioneCompleta() + " avvenuta con successo."); + } else { + rp.setStatus(false); + rp.setMsg("Errore! Articolo sorgente inesistente. "); + } + return rp; + } + + public ByteArrayOutputStream creaLabelArticoloAccA4Pdf(ArticoloCR CR) { + long pHMarg = getParm("LABEL_ART_A4_MARGINE").getNumeroLong(); + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + this.document = new Document(PageSize.A4, 0.0F, 0.0F, 0.0F, 0.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + long labelNumber = 0L; + String dim = getParm("LABEL_ART_A4_COL_ROW").getTesto(); + int nCol = Integer.parseInt(dim.substring(0, dim.indexOf(','))); + int nRow = Integer.parseInt(dim.substring(dim.indexOf(',') + 1)); + float[] widths = { 0.25F, 0.25F, 0.25F, 0.25F }; + this.pdfPcorpo = new PdfPTable(widths); + this.pdfPcorpo.setWidthPercentage(100.0F); + if (CR.getBlankLabels() > 0L) { + PdfPCell cell = new PdfPCell(); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorder(0); + for (int i = 0; (long)i < CR.getBlankLabels(); i++) { + labelNumber++; + this.pdfPcorpo.addCell(cell); + } + } + if (CR.getId_articolo() != 0L) { + findByPrimaryKey(CR.getId_articolo()); + labelNumber = (long)addLabelUnArticoloAccA4Pdf(nRow, CR.getNumLabels(), labelNumber, null); + } else { + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Articolo rowBean = (Articolo)vec.nextElement(); + labelNumber += (long)rowBean.addLabelUnArticoloAccA4Pdf(nRow, CR.getNumLabels(), labelNumber, null); + } + } + if (labelNumber == 0L) { + Phrase ph = new Phrase("Attenzione! Non ci sono etichette da stampare!"); + PdfPCell cell = new PdfPCell(ph); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorder(0); + cell.setColspan(nCol); + this.pdfPcorpo.addCell(cell); + } else { + long numberBlankCell = (long)nCol - labelNumber % (long)nCol; + PdfPCell cell = new PdfPCell(); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorder(0); + if (numberBlankCell != (long)nCol) + for (int i = 0; (long)i < numberBlankCell; i++) + this.pdfPcorpo.addCell(cell); + } + this.document.add((Element)this.pdfPcorpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public int addLabelUnArticoloAccA4Pdf(int nRow, long numberOflabel, long labelNumber, String l_descrizione) { + float pHMarg = 0.0F; + long paddingTop = 0L; + if (getFlgStampaAccessoriT() == 1L) { + int numbOflabelArt = 0; + try { + Vectumerator vec = getAccessori(); + if (vec.hasMoreElements() || !getAltreCompatibilita().isEmpty()) { + if (l_descrizione == null || l_descrizione.isEmpty()) + l_descrizione = getDescrizioneCompleta(); + PdfPCell cell = new PdfPCell(); + cell.setBorder(0); + cell.setPaddingLeft(8.0F); + cell.setPaddingRight(8.0F); + cell.setPaddingBottom(5.0F); + cell.addElement(new Chunk(l_descrizione + ": ", PdfFontFactory.PDF_fPiccolissimo5B)); + String l_descrizioneAccessorio = getAltreCompatibilita() + " "; + while (vec.hasMoreElements()) { + Accessorio row = (Accessorio)vec.nextElement(); + l_descrizioneAccessorio = l_descrizioneAccessorio + l_descrizioneAccessorio; + if (vec.hasMoreElements()) + l_descrizioneAccessorio = l_descrizioneAccessorio + " - "; + } + cell.addElement(new Chunk(l_descrizioneAccessorio.trim(), PdfFontFactory.PDF_fPiccolissimo5)); + cell.setVerticalAlignment(4); + cell.setFixedHeight((PageSize.A4.getHeight() - pHMarg) / (float)nRow); + for (int i = 0; (long)i < numberOflabel; i++) { + paddingTop = 2L * labelNumber / 4L % (long)nRow; + cell.setPaddingTop((float)paddingTop); + numbOflabelArt++; + labelNumber++; + this.pdfPcorpo.addCell(cell); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return numbOflabelArt; + } + return 0; + } + + public boolean hasAccessori() { + if (!getAltreCompatibilita().isEmpty()) + return true; + return getAccessori().hasMoreElements(); + } + + public boolean hasComponentiArticoli() { + return getArticoliComponenti().hasMoreElements(); + } + + public boolean isPrezzoChangedToday() { + if (getDBState() == 1) { + if (getDataCambiamentoPrezzo() == null) + return false; + if (getDateDiff(getDataCambiamentoPrezzo(), getToday()) == 0L) + return true; + return false; + } + return false; + } + + public boolean isCostoChangedToday() { + if (getDBState() == 1) { + if (getDataUltimoCosto() == null) + return false; + if (getDateDiff(getDataUltimoCosto(), getToday()) == 0L) + return true; + return false; + } + return false; + } + + public Date getDataCambiamentoPrezzo() { + return getListinoArticoloBase().getDataCambiamentoPrezzoLA(); + } + + public void setDataCambiamentoPrezzo(Date dataCambiamentoPrezzo) { + this.dataCambiamentoPrezzo = dataCambiamentoPrezzo; + } + + public void aggiornaPrezzoPubblicoERivalutazione(double nuovoPrezzoPubblico, double nuovoPrezzoRiv) { + setDataCambiamentoPrezzo(getToday()); + ListinoArticolo listinoArticoloBase = getListinoArticoloBase(); + listinoArticoloBase.setPrezzoLA(DBAdapter.scorporaIva(nuovoPrezzoPubblico, (double)getIva().getAliquota())); + listinoArticoloBase.save(); + if (getCostoAcquistoORivalutato() != nuovoPrezzoRiv) { + Rivalutazione riv = new Rivalutazione(getApFull()); + riv.setId_articolo(getId_articolo()); + riv.setDataRivalutazione(getToday()); + riv.setImponibileRivalutazione(nuovoPrezzoRiv); + addRivalutazione(riv); + setCostoRivalutazione(nuovoPrezzoRiv); + } + super.save(); + } + + public void aggiornaPrezzoPubblico(double nuovoPrezzoPubblico, double nuovoCostoNetto) { + setCostoPrecedente(getCostoNetto()); + setImponibilePrecedente(getPrezzoBase()); + setCostoNetto(nuovoCostoNetto); + setDataUltimoCosto(getToday()); + setDataCambiamentoPrezzo(getToday()); + ListinoArticolo listinoArticoloBase = getListinoArticoloBase(); + listinoArticoloBase.setPrezzoLA(DBAdapter.scorporaIva(nuovoPrezzoPubblico, (double)getIva().getAliquota())); + listinoArticoloBase.save(); + super.save(); + } + + public void aggiornaPrezzoPubblicoImponibile(double nuovoPrezzoPubblicoImponibile) { + setImponibilePrecedente(getPrezzoBase()); + setDataCambiamentoPrezzo(getToday()); + ListinoArticolo listinoArticoloBase = getListinoArticoloBase(); + listinoArticoloBase.setPrezzoLA(nuovoPrezzoPubblicoImponibile); + listinoArticoloBase.save(); + super.save(); + } + + public long getFlgUsaVariantiArt() { + return this.flgUsaVariantiArt; + } + + public void setFlgUsaVariantiArt(long flgUsaVariantiArt) { + this.flgUsaVariantiArt = flgUsaVariantiArt; + } + + public double getCostoAcquistoUltimoConIva() { + if (getId_articolo() != 0L) { + Vectumerator vec = new ArticoloFornitore(getApFull()).findById_articoloFornitore(getId_articolo(), 0L, 1, 1); + if (vec.hasMoreElements()) { + ArticoloFornitore af = (ArticoloFornitore)vec.nextElement(); + return af.getCostoTotaleIvato(); + } + return 0.0D; + } + return 0.0D; + } + + public String getAltreCompatibilita() { + if (this.altreCompatibilita != null && this.altreCompatibilita.equals("


")) + this.altreCompatibilita = ""; + return (this.altreCompatibilita == null) ? "" : this.altreCompatibilita.trim(); + } + + public void setAltreCompatibilita(String altreCompatibilita) { + this.altreCompatibilita = altreCompatibilita; + } + + public double getCostoAcquistoUltimo() { + if (getId_articolo() != 0L) { + Vectumerator vec = new ArticoloFornitore(getApFull()).findById_articoloFornitore(getId_articolo(), 0L, 1, 1); + if (vec.hasMoreElements()) { + ArticoloFornitore af = (ArticoloFornitore)vec.nextElement(); + return af.getCostoTotale(); + } + return 0.0D; + } + return 0.0D; + } + + public double getCostoAcquistoUltimo(Clifor l_clifor) { + if (getId_articolo() != 0L && l_clifor.getId_clifor() != 0L) { + ArticoloFornitore af = new ArticoloFornitore(getApFull()); + af.findByFornitoreArticolo(l_clifor.getId_clifor(), getId_articolo(), 1L); + if (af.getDBState() == 1) + return af.getCostoTotale(); + return 0.0D; + } + return 0.0D; + } + + public double getRicaricoPAUltimo() { + return getRicaricoCalc(getCostoAcquistoUltimo()); + } + + public double getRicaricoEffettivoDaCostoConfezione() { + return getRicaricoCalc(getTotCostoConfezione()); + } + + private double getRicaricoCalc(double l_costo) { + if (l_costo != 0.0D) { + DoubleOperator temp = new DoubleOperator(getPrezzoPubblico()); + temp.setScale(4, 1); + temp.divide(l_costo); + temp.subtract(1); + temp.multiply(100); + temp.setScale(4, 1); + return temp.getResult(); + } + return 0.0D; + } + + public double getRicaricoBaseNew() { + return this.ricaricoBaseNew; + } + + public void setRicaricoBaseNew(double ricaricoBaseNew) { + this.ricaricoBaseNew = ricaricoBaseNew; + } + + public ResParm aggiornaRicaricoSeZero() { + ResParm rp = new ResParm(true); + if (getRicaricoBase() == 0.0D) { + setRicaricoBase(getRicaricoPAUltimo()); + rp = super.save(); + } + return rp; + } + + public long getFlgSerialiMassivi() { + return this.flgSerialiMassivi; + } + + public void setFlgSerialiMassivi(long flgSerialiMassivi) { + this.flgSerialiMassivi = flgSerialiMassivi; + } + + public String getCaratteristiche() { + return (this.caratteristiche == null) ? "" : this.caratteristiche.trim(); + } + + public void setCaratteristiche(String compatibilita) { + this.caratteristiche = compatibilita; + } + + public ResParm aggiornaCompatibilita() { + Vectumerator vec = getAccessori(); + StringBuffer l_compatibilita = new StringBuffer(); + while (vec.hasMoreElements()) { + Accessorio row = (Accessorio)vec.nextElement(); + l_compatibilita.append(row.getArticoloAssociato(getId_articolo()).getNome()); + if (vec.hasMoreElements()) + l_compatibilita.append(","); + } + if (l_compatibilita.length() == 0) { + setCompatibilita(""); + } else if (l_compatibilita.length() > 254) { + setCompatibilita(l_compatibilita.toString().substring(0, 254)); + } else { + setCompatibilita(l_compatibilita.toString()); + } + return super.save(); + } + + public String getDescrizioneCompatibilita() { + if (getCompatibilita().isEmpty()) + return getAltreCompatibilita(); + return getCompatibilita() + "," + getCompatibilita(); + } + + public void creaFileCvs(ArticoloCR CR) { + try { + Vectumerator list = findByCR(CR, 0, 0); + CR.setFileName(getPathTmp() + "exportArticoli_" + getPathTmp() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "Criteri di ricerca: " + CR.getDescrizioneCR() + "\nCodice;Descrizione;Tipo;Costo acq. imp;Costo acq. ivato;Prezzo Vendita con iva;Ric.;Scorta Minima;Quantita'"; + if (CR.getFlgTipoReport() >= 1L) + s1 = s1 + ";Q.ta' variante"; + if (CR.getFlgTipoReport() == 2L) + s1 = s1 + ";Q.ta' seriale"; + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + Articolo row = (Articolo)list.nextElement(); + s1 = " \"" + row.getCodice() + "\"" + SEP + row.getDescrizioneCompleta() + SEP + row.getTipo().getDescrizioneCompleta() + SEP + getNf().format(row.getCostoAcquistoORivalutato()) + SEP + getNf().format(row.getCostoAcquistoORivalutatoConIva()) + SEP + getNf().format(row.getPrezzoPubblicoIva()) + SEP + getNf().format(row.getRicaricoBase()) + SEP + (row.isArticoloDaRiordinare() ? getNf().format(row.getQtaRiordino()) : "") + SEP + getNf().format(row.getQuantitaData(CR.getDataMovimento())); + s1 = s1.replace("€", "€"); + s1 = s1.replace("»", "-->"); + outCvsFile.writeLine(s1); + if (CR.getFlgTipoReport() >= 1L) { + if (row.getFlgUsaVarianti() == 1L) { + Vectumerator listaAv = row.findArticoliVarianti(-1L, -1L); + while (listaAv.hasMoreElements()) { + ArticoloVariante rowAv = (ArticoloVariante)listaAv.nextElement(); + if (rowAv.getQuantitaAv(CR.getDataMovimento()) != 0.0D) { + s1 = ";;;;;;variante;" + rowAv.getNomeV() + SEP + SEP + getNf().format(rowAv.getQuantitaAv(CR.getDataMovimento())); + outCvsFile.writeLine(s1); + } + if (CR.getFlgTipoReport() == 2L) { + Vectumerator listaD = rowAv.getDisponibilitaMovimentoM(); + while (listaD.hasMoreElements()) { + Movimento rowD = (Movimento)listaD.nextElement(); + if (rowD.getQuantita() != 0.0D) { + s1 = ";;;;;;S/N;n. " + rowD.getSeriale() + SEP + SEP + SEP + getNf().format(rowD.getQuantita()); + outCvsFile.writeLine(s1); + } + } + } + } + continue; + } + if (CR.getFlgTipoReport() == 2L && row.isUsaSeriale()) { + Vectumerator listaD = row.getDisponibilitaMovimentoM(); + while (listaD.hasMoreElements()) { + Movimento rowD = (Movimento)listaD.nextElement(); + s1 = ";;;;;;S/N;n. " + rowD.getSeriale() + SEP + SEP + SEP + getNf().format(rowD.getQuantita()); + outCvsFile.writeLine(s1); + } + } + } + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + + public double getQtaRiordino() { + return this.qtaRiordino; + } + + public void setQtaRiordino(double qtaRiordino) { + this.qtaRiordino = qtaRiordino; + } + + public boolean isArticoloDaRiordinare() { + if (getQuantitaEffettiva() < getQtaRiordino()) + return true; + return false; + } + + public long getFlgStampaAccessori() { + return this.flgStampaAccessori; + } + + public void setFlgStampaAccessori(long flgStampaAccessori) { + this.flgStampaAccessori = flgStampaAccessori; + } + + public long getFlgStampaAccessoriT() { + if (getFlgStampaAccessori() == -1L) + return getTipo().getFlgStampaAccessori(); + return getFlgStampaAccessori(); + } + + public double getPrezzoPubblicoIva(Clifor l_clifor) { + return getPrezzoArticoloIva(l_clifor).getPrezzoFinale(); + } + + public double getCostoRivalutazione() { + return this.costoRivalutazione; + } + + public void setCostoRivalutazione(double costoRivalutazione) { + this.costoRivalutazione = costoRivalutazione; + } + + public double getCostoRivalutazioneConIva() { + return this.costoRivalutazioneConIva; + } + + public void setCostoRivalutazioneConIva(double costoRivalutazioneConIva) { + this.costoRivalutazioneConIva = costoRivalutazioneConIva; + } + + public double getRicaricoCostoRivalutazione() { + return getRicaricoCalc(getCostoRivalutazione()); + } + + public double getCostoRivalutazioneIva() { + return DBAdapter.conIva(getCostoRivalutazione(), (double)getIva().getAliquota()); + } + + public long getFlgNegativo() { + return this.flgNegativo; + } + + public void setFlgNegativo(long flgNegativo) { + this.flgNegativo = flgNegativo; + } + + public ResParm addRivalutazione(Rivalutazione row) { + Rivalutazione bean = new Rivalutazione(getApFull()); + bean.findByPrimaryKey(row.getId_rivalutazione()); + if (bean.getId_rivalutazione() != 0L) { + row.setDBState(bean.getDBState()); + } else { + row.setDBState(0); + } + ResParm rp = row.save(); + return rp; + } + + public ResParm delRivalutazione(Rivalutazione row) { + Rivalutazione bean = new Rivalutazione(getApFull()); + bean.findByPrimaryKey(row.getId_rivalutazione()); + return bean.delete(); + } + + public Vectumerator getRivalutazioni() { + return new Rivalutazione(getApFull()).findById_articolo(getId_articolo(), 0, 0); + } + + public ResParm aggiornaCostoRivalutazione(double l_costoRivalutazione) { + setCostoRivalutazione(l_costoRivalutazione); + return super.save(); + } + + public double getCostoAcquistoORivalutatoConIva() { + if (getCostoRivalutazioneIva() != 0.0D) + return getCostoRivalutazioneIva(); + return getCostoAcquistoConIva(); + } + + public double getRicaricoPAUltimoORivalutatoConIva() { + if (getRicaricoCostoRivalutazione() != 0.0D) + return getRicaricoCostoRivalutazione(); + return getRicaricoPAUltimo(); + } + + public double getCostoAcquistoORivalutato() { + if (getCostoRivalutazione() != 0.0D) + return getCostoRivalutazione(); + return getCostoAcquisto(); + } + + public double getPrezzoRivNuovo() { + return this.prezzoRivNuovo; + } + + public void setPrezzoRivNuovo(double prezzoRivNuovo) { + this.prezzoRivNuovo = prezzoRivNuovo; + } + + public double getQuantitaEffettiva() { + if (getParm("USA_MAGAZZINO").isFalse()) { + if (!isQuantitaCalcolate()) + calcolaQuantita(); + return this.quantitaEffettiva; + } + return getQuantita(); + } + + public double getQuantitaInArrivo() { + if (!isQuantitaCalcolate()) + calcolaQuantita(); + return this.quantitaInArrivo; + } + + public void setQuantitaEffettiva(double quantitaEffettiva) { + this.quantitaEffettiva = quantitaEffettiva; + } + + private synchronized void calcolaQuantita() { + if (getParm("USA_MAGAZZINO").isTrue()) { + setQuantitaW(getQuantita()); + return; + } + if ((!isQuantitaCalcolate() ? true : false) & ((this.id_articolo != 0L) ? true : false)) { + long l_flgDispo; + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagDisponibilita(getId_articolo(), getId_articoloVariante(), getId_articoloTaglia(), null, 1L, 0L, null); + double q = rd.getQuantita(); + double nr = rd.getNr(); + double kg = rd.getKg(); + double mt = rd.getMt(); + setQuantitaW(q); + setQuantita(q); + setQuantitaImpegnata(new RigaDocumento(getApFull()).getQuantitaImpegnataByArticolo(getId_articolo())); + double q1 = new RigaDocumento(getApFull()).getQuantitaInArrivoByArticolo(getId_articolo()); + setQuantitaInArrivo(q1); + if (usaMagazzino()) { + DoubleOperator dop = new DoubleOperator(q); + dop.add(this.quantitaInArrivo); + dop.subtract(this.quantitaImpegnata); + setQuantitaEffettiva(dop.getResult()); + } + this.quantitaMagazzinoMovimentoHtml = getMovimentoHtmlDesc(getTipologiaArticolo(), q, nr, kg, mt, this.quantitaInArrivo, this.quantitaImpegnata, this.quantitaEffettiva, + usaMagazzino(), getParm("USA_MAGAZZINO").isTrue(), + getNf()); + if (!usaMagazzino()) { + l_flgDispo = 1L; + } else { + l_flgDispo = (this.quantitaW > 0.0D) ? 1L : 0L; + } + String SEP = ","; + MagFisico mf = new MagFisico(getApFull()); + Vectumerator vec = mf.findByTipo(0L); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + MagFisico row = (MagFisico)vec.nextElement(); + rd.findMagDisponibilitaPuntuale(getId_articolo(), getId_articoloVariante(), 0L, null, row.getId_magFisico(), 0L, 0L); + if (rd.getQuantita() > 0.0D) { + sb.append(row.getId_magFisico()); + sb.append(","); + } + } + if (sb.length() > 0) + sb.insert(0, ","); + String temp = "update ARTICOLO set quantitaMagazzinoMovimentoHtml='" + this.quantitaMagazzinoMovimentoHtml + "', quantitaW=" + this.quantitaW + ", quantita=" + this.quantitaW + ", quantitaEffettiva=" + this.quantitaEffettiva + ", quantitaImpegnata=" + this.quantitaImpegnata + ", quantitaCalcolate=true, flgDispo=" + l_flgDispo + ", codiciMagazzino='" + + + sb.toString() + "' where id_articolo=" + + getId_articolo(); + update(temp); + setQuantitaCalcolate(true); + } + } + + public boolean isQuantitaCalcolate() { + return this.quantitaCalcolate; + } + + public void setQuantitaCalcolate(boolean quantitaCalcolate) { + this.quantitaCalcolate = quantitaCalcolate; + } + + public double getQuantitaImpegnata() { + if (!isQuantitaCalcolate()) + calcolaQuantita(); + return this.quantitaImpegnata; + } + + public void setQuantitaImpegnata(double quantitaImpeggnata) { + this.quantitaImpegnata = quantitaImpeggnata; + } + + public void setQuantitaInArrivo(double quantitaInArrivo) { + this.quantitaInArrivo = quantitaInArrivo; + } + + public static final synchronized ResParm creaOrdine(Articolo l_articolo, long l_id_articoloVariante, long l_id_clifor, double l_qta) { + ResParm rp = new ResParm(true); + String msg = ""; + ApplParmFull ap = l_articolo.getApFull(); + if (l_qta <= 0.0D) { + rp.setStatus(false); + rp.setMsg("Errore! Quantità da riordinare <=0. Riordino non necessario."); + return rp; + } + Documento ordine = new Documento(ap); + ordine.findOrdineBozza(l_id_clifor); + if (ordine.getDBState() == 0) { + msg = " Creato nuovo ordine n. "; + ordine.setId_clifor(l_id_clifor); + ordine.setDataDocumento(getToday()); + ordine.setId_tipoDocumento(8L); + ordine.setId_magFisicoPartenza(ordine.getTipoDocumento().getCausaleMagazzino().getId_magFisicoPartenza()); + ordine.setId_magFisicoArrivo(ordine.getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo()); + rp = ordine.save(); + } else { + msg = " Aggiornato ordine n. "; + } + if (!rp.getStatus()) { + rp.setStatus(false); + rp.setMsg("Errore! Impossibile salvare ordine."); + return rp; + } + RigaDocumento row = new RigaDocumento(ap); + row.setId_articolo(l_articolo.getId_articolo()); + if (l_id_articoloVariante != 0L) { + row.setId_articoloVariante(l_id_articoloVariante); + row.setDescrizioneRiga(row.getArticoloVariante().getDescrizioneCompleta()); + } else { + row.setDescrizioneRiga(row.getArticolo().getDescrizioneCompleta()); + } + row.setQuantita(l_qta); + row.setQuantitaUdm(l_qta); + rp.append(Documento.addRigaDocumento(ordine, row)); + if (rp.getStatus()) { + rp.append(l_articolo.aggiornaQtaRiordino(l_articolo.getQtaRiordino())); + rp.setMsg(msg + msg); + } + rp.setReturnObj(ordine); + return rp; + } + + public double getPrice(long l_id_users) { + if (l_id_users == 0L) + return getPrice(); + Users user = new Users(getApFull()); + user.findByPrimaryKey(l_id_users); + if (user.getId_clifor() >= 0L) + return getPrezzoPubblico(user.getClifor()); + return getPrice(); + } + + public double getQtaRiordinoNuovo() { + return this.qtaRiordinoNuovo; + } + + public void setQtaRiordinoNuovo(double qtaRiordinoNuovo) { + this.qtaRiordinoNuovo = qtaRiordinoNuovo; + } + + public ResParm aggiornaQtaRiordino(double l_qtaRiordino) { + ResParm rp = new ResParm(true); + if (getId_articolo() != 0L) { + setQtaRiordino(l_qtaRiordino); + rp = super.save(); + } + return rp; + } + + public double getQtaDaRiordinare() { + DoubleOperator qrow = new DoubleOperator(getQtaRiordino()); + qrow.subtract(getQuantitaEffettiva()); + if (qrow.getResult() <= 0.0D) + return 0.0D; + return qrow.getResult(); + } + + private Hashtable getCaratteristicheHT() { + if (this.caratteristicheHT == null) + this.caratteristicheHT = new Hashtable(); + return this.caratteristicheHT; + } + + public void setCaratteristicheHT(Hashtable caratteristicaHT) { + this.caratteristicheHT = caratteristicaHT; + } + + public ResParm aggiornaCaratteristiche() { + Vectumerator vec = getCaratteristicheArticolo(); + StringBuilder l_caratteristiche = new StringBuilder(); + StringBuilder l_caratteristicheID = new StringBuilder(); + while (vec.hasMoreElements()) { + CaratteristicaArticolo row = (CaratteristicaArticolo)vec.nextElement(); + l_caratteristiche.append(row.getVal()); + if (row.getId_lista() > 0L) + l_caratteristicheID.append(row.getId_lista()); + if (vec.hasMoreElements()) { + l_caratteristiche.append(","); + if (row.getId_lista() > 0L) + l_caratteristicheID.append(","); + } + } + if (l_caratteristiche.length() == 0) { + setCaratteristiche(""); + } else { + setCaratteristiche(l_caratteristiche.toString()); + } + if (l_caratteristicheID.length() == 0) { + setCaratteristicheListeId(""); + } else { + setCaratteristicheListeId("," + l_caratteristicheID.toString() + ","); + } + return super.save(); + } + + public String getCompatibilita() { + return (this.compatibilita == null) ? "" : this.compatibilita.trim(); + } + + public void setCompatibilita(String compatibilita) { + this.compatibilita = compatibilita; + } + + public long getId_caratteristica() { + return this.id_caratteristica; + } + + public void setId_caratteristica(long id_caratteristica) { + this.id_caratteristica = id_caratteristica; + } + + public double getPrezzoPubblicoIva() { + return getPrezzoPubblicoIva(null); + } + + public double getCostoAcquistoConIva(Clifor l_clifor) { + double costoAcquistoCLifor = getCostoAcquistoUltimoConIva(l_clifor); + if (costoAcquistoCLifor != 0.0D) + return costoAcquistoCLifor; + if (getCostoNetto() != 0.0D) + return getCostoNettoIva(); + return getCostoAcquistoUltimoConIva(); + } + + protected void findByCRCreateStmtDate(ArticoloCR CR, PreparedStatement stmt) { + try { + int dataCount = 1; + if (CR.getFlgStockOfferte() == 99L) { + stmt.setDate(dataCount, DBAdapter.getToday()); + dataCount++; + } + if (CR.getFlgOfferta() >= 0L) { + stmt.setDate(dataCount, DBAdapter.getToday()); + dataCount++; + if (CR.getFlgOfferta() == 1L || CR.getFlgOfferta() == 0L) { + stmt.setDate(dataCount, DBAdapter.getToday()); + dataCount++; + } + if (CR.getFlgOfferta() == 3L) { + stmt.setDate(dataCount, DBAdapter.getToday()); + dataCount++; + stmt.setDate(dataCount, DBAdapter.getToday()); + dataCount++; + stmt.setDate(dataCount, DBAdapter.getToday()); + dataCount++; + } + } + if (CR.getDataDocumentoUsatoA() != null) { + stmt.setDate(dataCount, CR.getDataDocumentoUsatoA()); + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoUsatoA()); + dataCount++; + } + if (CR.getDataDocumentoDa() != null) { + stmt.setDate(dataCount, CR.getDataDocumentoDa()); + dataCount++; + } + if (CR.getDataDocumentoA() != null) { + stmt.setDate(dataCount, CR.getDataDocumentoA()); + dataCount++; + } + if (CR.getDataCreazioneDa() != null) { + stmt.setDate(dataCount, CR.getDataCreazioneDa()); + dataCount++; + } + if (CR.getDataCreazioneA() != null) { + stmt.setDate(dataCount, CR.getDataCreazioneA()); + dataCount++; + } + if (CR.getDataUpdateDa() != null) { + stmt.setDate(dataCount, CR.getDataUpdateDa()); + dataCount++; + } + if (CR.getFlgAmzFeaturedPriceData() == 1L) { + stmt.setDate(dataCount, getToday()); + dataCount++; + } + } catch (SQLException e) { + handleDebug(e); + } + } + + protected int findByCRTotRecord(ArticoloCR CR) { + StringBuffer s_Sql_Find = new StringBuffer("select count( A.id_articolo) as tot from ARTICOLO AS A "); + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + findByCRCreateStmtDate(CR, stmt); + return (int)getTots(stmt); + } catch (Exception e) { + handleDebug(e); + return 0; + } + } + + public boolean isDeleteLogic() { + return false; + } + + public long getFlgRC() { + return this.flgRC; + } + + public void setFlgRC(long flgRC) { + this.flgRC = flgRC; + } + + public long getFlgNoListino() { + return this.flgNoListino; + } + + public void setFlgNoListino(long flgNoListino) { + this.flgNoListino = flgNoListino; + } + + public double getPrezzoPubblico(Clifor l_clifor) { + return getPrezzoArticolo(l_clifor).getPrezzoFinale(); + } + + public ByteArrayOutputStream creaLabelArticoloAccZebraPdf(ArticoloCR CR) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + String dim = getParm("LABEL_ART_SIZE").getTesto(); + long xx = Long.parseLong(dim.substring(0, dim.indexOf(','))); + long yy = Long.parseLong(dim.substring(dim.indexOf(',') + 1)); + Rectangle label = new Rectangle(getPdfPointSize(yy), getPdfPointSize(xx)); + this.document = new Document(label.rotate(), 2.0F, 2.0F, 2.0F, 2.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + int labelNumber = 0; + if (CR.getId_articolo() != 0L) { + findByPrimaryKey(CR.getId_articolo()); + labelNumber = addLabelUnArticoloAccZebraPdf(CR.getNumLabels(), (long)labelNumber, null); + } else { + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Articolo rowBean = (Articolo)vec.nextElement(); + labelNumber += rowBean.addLabelUnArticoloAccZebraPdf(CR.getNumLabels(), (long)labelNumber, null); + } + } + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public int addLabelUnArticoloAccZebraPdf(long numberOflabel, long labelNumber, String l_descrizione) { + if (getFlgStampaAccessoriT() == 1L) { + int fontSize = getParm("LABEL_ART_ACC_FONT_SIZE").getNumeroInt(); + Font pdfTagliando = new Font(2, (float)fontSize, 1); + int numbOflabelArt = 0; + try { + float[] widths = { 1.0F }; + this.pdfPcorpo = new PdfPTable(widths); + this.pdfPcorpo.setWidthPercentage(100.0F); + Vectumerator vec = getAccessori(); + if (vec.hasMoreElements() || !getAltreCompatibilita().isEmpty()) { + if (l_descrizione == null || l_descrizione.isEmpty()) + l_descrizione = getDescrizioneCompleta(); + PdfPCell cell = new PdfPCell(); + cell.setBorder(0); + cell.setVerticalAlignment(4); + cell.addElement(new Chunk(l_descrizione + ": ", pdfTagliando)); + String l_descrizioneAccessorio = getAltreCompatibilita() + " "; + while (vec.hasMoreElements()) { + Accessorio row = (Accessorio)vec.nextElement(); + l_descrizioneAccessorio = l_descrizioneAccessorio + l_descrizioneAccessorio; + if (vec.hasMoreElements()) + l_descrizioneAccessorio = l_descrizioneAccessorio + " - "; + } + cell.addElement(new Chunk(l_descrizioneAccessorio.trim(), pdfTagliando)); + this.pdfPcorpo.addCell(cell); + for (int i = 0; (long)i < numberOflabel; i++) { + numbOflabelArt++; + labelNumber++; + this.document.add((Element)this.pdfPcorpo); + if ((long)i < numberOflabel) + this.document.newPage(); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return numbOflabelArt; + } + return 0; + } + + public int addLabelUnArticoloPackingListA4Pdf(String titolo, int nRow, long numberOflabel, String l_descrizione) { + long pHMarg = 2L; + long l_indent = 4L; + if (getFlgStampaEtichetteT() == 1L) { + int totNumbOflabel = 0; + try { + int altezzaCod = 50; + int larghezzaCod = 120; + PdfContentByte cb = this.writer.getDirectContent(); + Barcode128 codeBar = new Barcode128(); + codeBar.setCodeType(9); + if (getFlgUsaVarianti() == 0L || (getFlgUsaVarianti() == -1L && getTipo().getFlgUsaVarianti() == 0L)) { + if (l_descrizione == null || l_descrizione.isEmpty()) + l_descrizione = getDescrizioneCompleta().replace("€", "€"); + for (int i = 0; (long)i < numberOflabel; i++) { + totNumbOflabel++; + PdfPCell cell = new PdfPCell(); + cell.setBorder(0); + codeBar.setCode(getCodice()); + Image imgBarcode = codeBar.createImageWithBarcode(cb, null, null); + imgBarcode.scaleToFit((float)larghezzaCod, (float)altezzaCod); + cell.addElement(new Chunk(imgBarcode, 20.0F, (float)(-altezzaCod + 10))); + cell.addElement(new Chunk("\n\n\n\n " + l_descrizione, PdfFontFactory.PDF_fPiccolissimo6)); + cell.setVerticalAlignment(4); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setIndent((float)l_indent); + this.pdfPcorpo.addCell(cell); + } + } else { + Vectumerator varianti = findArticoliVarianti(-1L, -1L); + while (varianti.hasMoreElements()) { + ArticoloVariante rowAv = (ArticoloVariante)varianti.nextElement(); + l_descrizione = rowAv.getDescrizioneCompleta(); + for (int i = 0; (long)i < numberOflabel; i++) { + totNumbOflabel++; + PdfPCell cell = new PdfPCell(); + cell.setBorder(0); + codeBar.setCode(rowAv.getCodiceVariante()); + Image imgBarcode = codeBar.createImageWithBarcode(cb, null, null); + imgBarcode.scaleToFit((float)larghezzaCod, (float)altezzaCod); + cell.addElement(new Chunk(imgBarcode, 20.0F, (float)(-altezzaCod + 10))); + cell.addElement(new Chunk("\n\n\n\n " + l_descrizione, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setIndent((float)l_indent); + this.pdfPcorpo.addCell(cell); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return totNumbOflabel; + } + return 0; + } + + public ByteArrayOutputStream creaLabelArticoloZebraPdf(ArticoloCR CR) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + String dim = getParm("LABEL_ART_SIZE").getTesto(); + long xx = Long.parseLong(dim.substring(0, dim.indexOf(','))); + long yy = Long.parseLong(dim.substring(dim.indexOf(',') + 1)); + Rectangle label = new Rectangle(getPdfPointSize(yy), getPdfPointSize(xx)); + this.document = new Document(label.rotate(), 2.0F, 2.0F, 2.0F, 2.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + int labelNumber = 0; + if (CR.getId_articolo() != 0L) { + findByPrimaryKey(CR.getId_articolo()); + labelNumber = addLabelUnArticoloZebraPdf(CR.getNumLabels(), null); + } else { + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Articolo rowBean = (Articolo)vec.nextElement(); + labelNumber += rowBean.addLabelUnArticoloZebraPdf(CR.getNumLabels(), null); + } + } + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public int addLabelUnArticoloZebraPdf(long numberOflabel, String l_descrizione) { + if (getFlgStampaEtichetteT() == 1L) { + int totNumbOflabel = 0; + int fontSize = getParm("LABEL_ART_FONT_SIZE").getNumeroInt(); + Font pdfTagliando = new Font(2, (float)fontSize, 1); + try { + float[] widths = { 1.0F }; + int altezzaCod = 50; + int larghezzaCod = 120; + PdfContentByte cb = this.writer.getDirectContent(); + Barcode128 codeBar = new Barcode128(); + codeBar.setCodeType(9); + if (getFlgUsaVarianti() == 0L || (getFlgUsaVarianti() == -1L && getTipo().getFlgUsaVarianti() == 0L)) { + if (l_descrizione == null || l_descrizione.isEmpty()) + l_descrizione = getDescrizioneCompleta().replace("€", "€"); + PdfPCell cell = new PdfPCell(); + cell.setBorder(0); + codeBar.setCode(getCodice()); + Image imgBarcode = codeBar.createImageWithBarcode(cb, null, null); + imgBarcode.scaleToFit((float)larghezzaCod, (float)altezzaCod); + cell.addElement(new Chunk(imgBarcode, 10.0F, (float)(-altezzaCod + 10))); + cell.addElement(new Chunk("\n\n\n\n\n\n " + l_descrizione, pdfTagliando)); + cell.setVerticalAlignment(4); + this.pdfPcorpo = new PdfPTable(widths); + this.pdfPcorpo.setWidthPercentage(100.0F); + this.pdfPcorpo.addCell(cell); + for (int i = 0; (long)i < numberOflabel; i++) { + totNumbOflabel++; + this.document.add((Element)this.pdfPcorpo); + this.document.newPage(); + } + } else { + Vectumerator varianti = findArticoliVarianti(-1L, -1L); + while (varianti.hasMoreElements()) { + ArticoloVariante rowAv = (ArticoloVariante)varianti.nextElement(); + l_descrizione = rowAv.getDescrizioneCompleta(); + PdfPCell cell = new PdfPCell(); + cell.setBorder(0); + codeBar.setCode(rowAv.getCodiceVariante()); + Image imgBarcode = codeBar.createImageWithBarcode(cb, null, null); + imgBarcode.scaleToFit((float)larghezzaCod, (float)altezzaCod); + cell.addElement(new Chunk(imgBarcode, 20.0F, (float)(-altezzaCod + 10))); + cell.addElement(new Chunk("\n\n\n\n " + l_descrizione, pdfTagliando)); + cell.setVerticalAlignment(4); + this.pdfPcorpo = new PdfPTable(widths); + this.pdfPcorpo.setWidthPercentage(100.0F); + this.pdfPcorpo.addCell(cell); + for (int i = 0; (long)i < numberOflabel; i++) { + totNumbOflabel++; + this.document.add((Element)this.pdfPcorpo); + this.document.newPage(); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return totNumbOflabel; + } + return 0; + } + + public long getFlgEscludiWeb() { + return this.flgEscludiWeb; + } + + public void setFlgEscludiWeb(long flgEscludiWeb) { + this.flgEscludiWeb = flgEscludiWeb; + } + + public boolean isWeb() { + if (getTipo().isWeb()) { + if (getFlgEscludiWeb() == 0L) + return true; + return false; + } + return false; + } + + public String getDescrizioneUrl() { + String temp = convertStringToLink(getDescrizione()); + return temp; + } + + protected int getStringValueCase(String l_colomnName) { + return super.getStringValueCase(l_colomnName); + } + + public String getCartItemDescriptionUrl() { + return getDescrizioneUrl(); + } + + public Vectumerator getAccessori(long l_id_tipoAccessorio, long l_id_tipoAcc, long l_flgEscludiWeb) { + return new Accessorio(getApFull()).findById_articolo(getId_articolo(), l_id_tipoAccessorio, l_id_tipoAcc, l_flgEscludiWeb, 0, 0); + } + + public Vectumerator getKitAssociati() { + return new Kit(getApFull()).findByArticoloPrimario(getId_articolo(), 0, 0); + } + + public Vectumerator getKitVariantiAssociati() { + return new ArticoloVariante(getApFull()).findByArticoloKit(getId_articolo()); + } + + public Vectumerator getArticoliComponenti() { + return new ArticoloArticoloComponente(getApFull()).findByArticolo(getId_articolo()); + } + + public long getId_tipoAccessorio() { + return this.id_tipoAccessorio; + } + + public TipoAccessorio getTipoAccessorio() { + this.tipoAccessorio = (TipoAccessorio)getSecondaryObject(this.tipoAccessorio, TipoAccessorio.class, getId_tipoAccessorio()); + return this.tipoAccessorio; + } + + public void setId_tipoAccessorio(long newId_tipoAccessorio) { + this.id_tipoAccessorio = newId_tipoAccessorio; + setTipoAccessorio(null); + } + + public void setTipoAccessorio(TipoAccessorio newTipoAccessorio) { + this.tipoAccessorio = newTipoAccessorio; + } + + public long getId_tipoPadre() { + return 0L; + } + + public String getDescrizioneVetrina() { + return getDescrizioneVetrina("it"); + } + + public String getDescrizioneVetrina(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizioneVetrina", lang); + } + + public long getId() { + return getId_articolo(); + } + + public int getDispoLevel() { + double qt = getAvail(); + double dispoLevelScarsa = getParm("CC_QTA_LOW").getNumero(); + if (qt <= 0.0D) + return 0; + if (qt > 0.0D && qt < dispoLevelScarsa) + return 1; + if (qt >= dispoLevelScarsa) + return 2; + return 0; + } + + public static final String getDispoLevelDesc(int l_dispoLevel) { + switch (l_dispoLevel) { + case 0: + return "NON DISPONIBILE"; + case 1: + return "Disponibilità Bassa "; + case 2: + return "Disponibile"; + } + return ""; + } + + public String getDispoLevelDesc() { + return getDispoLevelDesc(getDispoLevel()); + } + + public boolean isFlgVetrina() { + if (getId_articolo() > 0L) { + if (getTipo().getFlgUsaVarianti() == 0L) + return (getId_vetrina() > 0L); + return new ArticoloVariante(getApFull()).isFlgVetrinaByArticolo(getId_articolo()); + } + return false; + } + + public ResParm impostaFlgEscludiWebByggTipo() { + ResParm rp = new ResParm(true); + return rp; + } + + public boolean useDescLangTables() { + return true; + } + + public boolean usaMagazzino() { + if (getTipo().getFlgTipoMagazzino() == 9L || getTipo().getFlgTipoMagazzino() == 0L) + return false; + return true; + } + + public ResParm updateModimportazione(long l_flgModImportazione, String l_codiceSerie) { + return update("UPDATE ARTICOLO SET flgModImportazione = " + l_flgModImportazione + " WHERE codice LIKE '" + l_codiceSerie + "%'"); + } + + public ResParm updateModimportazioneByFornitore(long l_flgModImportazione, long l_id_fornitore) { + if (l_flgModImportazione == 0L) + return update("UPDATE ARTICOLO AS A inner join ARTICOLO_FORNITORE as B on A.id_articolo=B.id_articolo SET A.flgModImportazione =" + l_flgModImportazione + ", countImportNonTrovato=countImportNonTrovato+1 WHERE B.id_clifor =" + l_id_fornitore); + return update("UPDATE ARTICOLO AS A inner join ARTICOLO_FORNITORE as B on A.id_articolo=B.id_articolo SET A.flgModImportazione =" + l_flgModImportazione + " WHERE B.id_clifor =" + l_id_fornitore); + } + + public String getDescrizioneCommercialeScript(String lang) { + return DBAdapter.prepareScriptString(getDescrizioneCommerciale(lang), true, false); + } + + public String getDescrizioneTecnicaScript(String lang) { + return DBAdapter.prepareScriptString(getDescrizioneTecnica(lang), true, false); + } + + public String getDescrizioneVetrinaScript(String lang) { + return DBAdapter.prepareScriptString(getDescrizioneVetrina(lang), true, false); + } + + public long getFlgEscludiWebArt() { + return this.flgEscludiWebArt; + } + + public void setFlgEscludiWebArt(long flgEscludiWebArt) { + this.flgEscludiWebArt = flgEscludiWebArt; + } + + public String getCartItemTag() { + return ""; + } + + protected void findByCRCreateWC(ArticoloCR CR, StringBuffer s_Sql_Find, WcString wc) { + if (CR.getFlgShowDeleteLogic() == 0L) { + wc.addWc("A.dataFineVld is null"); + } else { + wc.addWc("A.dataFineVld is not null"); + } + if ((!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) || !CR.getCodice().isEmpty() || CR.getId_vetrina() > 0L || + CR.getFlgNascondi() == 0L || !CR.getNomeV().isEmpty() || !CR.getCodiceSerieV().isEmpty() || CR.getFlgQta() == 1L || ( + !CR.getSearchTxtWeb().isEmpty() && !CR.getSearchTxtWeb().equals("*")) || ( + CR.getFlgNascondi() >= 0L && CR.getFlgUsaDisponibilita() == 1L)) + s_Sql_Find.append("LEFT JOIN ARTICOLO_VARIANTE AS B ON A.id_articolo=B.id_articolo"); + if (CR.getDataDocumentoDa() != null || CR.getDataDocumentoA() != null || CR.getId_clifor() > 0L) { + s_Sql_Find.append(" inner join RIGA_DOCUMENTO AS RDOC ON RDOC.id_articolo=A.id_articolo"); + s_Sql_Find.append(" inner join DOCUMENTO AS DOC ON DOC.id_documento=RDOC.id_documento"); + } + if (CR.getId_fornitore() > 0L) + s_Sql_Find.append(" inner join ARTICOLO_FORNITORE AS AF ON AF.id_articolo=A.id_articolo"); + if (CR.getId_fornitoreUsato() > 0L) + s_Sql_Find.append(" inner join ARTICOLO_USATO AS AU ON AU.id_articolo=A.id_articolo"); + if (CR.getFlgAmzFeaturedPriceData() >= 0L || CR.getFlgPrezzoCompetitivo() >= 0L) + s_Sql_Find.append(" left join AMZ_FEATURED_PRICE AS AFP ON AFP.id_articolo=A.id_articolo"); + if (!CR.getSearchTxtWeb().isEmpty() || CR.getFlgIcecatAuto() >= 0L || CR.getFlgOrderBy() == 1L || ( + !CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*"))) + s_Sql_Find.append(" left join MARCA AS M on A.id_marca=M.id_marca"); + if (CR.getFlgOrderBy() >= 2L || CR.getFlgEscludiWeb() >= 0L || CR.getId_tipo() != 0L || + CR.getFlgNascondi() >= 0L || CR.getId_tipoSel() != 0L || !CR.getFlgReport().isEmpty()) + s_Sql_Find.append(" inner join TIPO AS C ON C.id_tipo=A.id_tipo"); + if (CR.getDataDocumentoUsatoA() != null) + s_Sql_Find.append(" inner join ( select X.* from ARTICOLO_USATO AS X where X.id_articoloUsato = (SELECT MAX(X2.id_articoloUsato ) FROM ARTICOLO_USATO AS X2 WHERE X2.`id_articolo` = X.id_articolo and X2.dataDocumento <=? )) as CX on A.id_articolo=CX.id_articolo"); + if (!CR.getSearchTxtWeb().isEmpty() && !CR.getSearchTxtWeb().equals("*")) { + String star = ""; + String temp = CR.getSearchTxtWeb().toLowerCase(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("(A.descrizioneSearch like '%" + token + "%' or A.codice like '%" + token + "%' or B.descrizioneSearchAv like '%" + token + "%' or A.codicePromozioneA like '%" + token + "%' or A.asinAmz like '%%' or B.codicePromozioneAV like '%" + token + "%' or A.ebayItemId like '%," + token + "%' or A.codiciAlternativi like '%," + token + ",%' or A.tagArticolo like '%," + token + ",%' or B.ebayItemIdAv like '%," + token + "%' or M.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_articolo() > 0L) + wc.addWc("A.id_articolo=" + CR.getId_articolo()); + if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) { + String star = ""; + String temp = CR.getSearchTxt(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("(A.descrizioneSearch like '%" + token + "%' or A.codice like '%" + token + "%' or B.descrizioneSearchAv like '%" + token + "%' or A.codiceEan like '%" + token + "%' or A.codicePromozioneA like '%" + token + "%' or B.codicePromozioneAV like '%" + token + "%' or A.ebayItemId like '%," + token + "%' or A.codiciAlternativi like '%," + temp + ",%' or A.tagArticolo like '%," + token + ",%' or B.ebayItemIdAv like '%," + token + "%' or M.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (!CR.getCategoriaImport().isEmpty()) { + String star = ""; + String temp = CR.getCategoriaImport().toLowerCase(); + temp = prepareInputMySqlString(temp, true); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer(); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("A.categoriaImport like '%" + token + "%'"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + wc.addWc(txt.toString()); + } + if (!CR.getCompatibilita().trim().isEmpty()) { + String star = "%"; + String temp = CR.getCompatibilita().trim(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("(A.altreCompatibilita like '" + token + "%' or A.compatibilita like '" + token + "%' )"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getFlgControlloCostoAggArt() == 0L) { + wc.addWc("(A.flgControlloCostoAggArt = 0 OR A.flgControlloCostoAggArt IS NULL)"); + } else if (CR.getFlgControlloCostoAggArt() > 0L) { + wc.addWc("A.flgControlloCostoAggArt = " + CR.getFlgControlloCostoAggArt()); + } + if (CR.getFlgPriceTypeAmz() == 0L) { + wc.addWc("(A.flgPriceTypeAmz = 0 OR A.flgPriceTypeAmz IS NULL)"); + } else if (CR.getFlgPriceTypeAmz() > 0L) { + wc.addWc("A.flgPriceTypeAmz = " + CR.getFlgPriceTypeAmz()); + } + if (CR.getFlgAsinAmzNull() == 0L) { + wc.addWc("A.asinAmz is not null"); + wc.addWc("A.asinAmz !=''"); + } else if (CR.getFlgAsinAmzNull() > 0L) { + wc.addWc("(A.asinAmz is null or A.asinAmz='')"); + } + if (CR.getFlgPrezzoCompetitivo() == 0L) { + wc.addWc("AFP.flgPrezzoCompetitivoAmz=1"); + } else if (CR.getFlgPrezzoCompetitivo() == 1L) { + wc.addWc("AFP.flgPrezzoCompetitivo=1"); + } else if (CR.getFlgPrezzoCompetitivo() == 2L) { + wc.addWc("AFP.id_amzFeaturedPrice is not null"); + wc.addWc("(AFP.flgPrezzoCompetitivo is null or AFP.flgPrezzoCompetitivo=0) "); + wc.addWc("(AFP.flgPrezzoCompetitivoAmz is null or AFP.flgPrezzoCompetitivoAmz=0) "); + } else if (CR.getFlgPrezzoCompetitivo() == 3L) { + wc.addWc("AFP.id_amzFeaturedPrice is null"); + } + if (CR.getFlgModImportazione() == 0L) { + wc.addWc("(A.flgModImportazione = 0 OR A.flgModImportazione IS NULL)"); + } else if (CR.getFlgModImportazione() > 0L) { + wc.addWc("A.flgModImportazione = " + CR.getFlgModImportazione()); + } + if (CR.getFlgTipoSchedaArticoloWww() == 0L) { + wc.addWc("(A.flgTipoSchedaArticoloWww = 0 OR A.flgTipoSchedaArticoloWww IS NULL)"); + } else if (CR.getFlgTipoSchedaArticoloWww() > 0L) { + wc.addWc("A.flgTipoSchedaArticoloWww = " + CR.getFlgTipoSchedaArticoloWww()); + } + if (!CR.getNMatricola().isEmpty()) + wc.addWc("A.nMatricola like '%" + CR.getNMatricola() + "%'"); + if (CR.getCountImportNonTrovatoDa() > 0L) + wc.addWc("A.countImportNonTrovato>=" + CR.getCountImportNonTrovatoDa()); + if (CR.getCountGgNoImportDa() > 0L) + wc.addWc("DATEDIFF(CURDATE(), dataUltimoImport)>=" + CR.getCountGgNoImportDa()); + if (CR.getCountGgNoImportA() > 0L) + wc.addWc("DATEDIFF(CURDATE(), dataUltimoImport)<=" + CR.getCountGgNoImportA()); + if (CR.getCountImportNonTrovatoA() > 0L) + wc.addWc("A.countImportNonTrovato<=" + CR.getCountImportNonTrovatoA()); + if (CR.getCountImpressionDa() > 0L) + wc.addWc("A.impression>=" + CR.getCountImpressionDa()); + if (CR.getCountImpressionA() > 0L) + wc.addWc("A.impression<=" + CR.getCountImpressionA()); + if (!CR.getGoogleFeedFileName().isEmpty()) + wc.addWc("(A.googleFeedFileName is null or A.googleFeedFileName='' or A.googleFeedFileName like '%" + CR.getGoogleFeedFileName() + "%')"); + if (CR.getFlgOrderBy() == 8L || CR.getFlgOrderBy() == 9L) + wc.addWc("A.tmstLastImpression is not null"); + if (!CR.getCodiceEan().isEmpty()) + wc.addWc("A.codiceEan like '%" + CR.getCodiceEan() + "%'"); + if (!CR.getScaffale().isEmpty()) + if (CR.getScaffale().indexOf("*") >= 0) { + String temp = CR.getScaffale().replace("*", "%"); + wc.addWc("A.scaffale like'" + temp + "'"); + } else { + wc.addWc("A.scaffale ='" + CR.getScaffale() + "'"); + } + if (CR.getId_clifor() > 0L) + wc.addWc("DOC.id_clifor=" + CR.getId_clifor()); + if (CR.getId_fornitore() > 0L) + wc.addWc("AF.id_clifor=" + CR.getId_fornitore()); + if (CR.getId_fornitoreCostoNuovo() > 0L) + wc.addWc("A.id_fornitoreCostoNuovo=" + CR.getId_fornitoreCostoNuovo()); + if (CR.getId_fornitoreUsato() > 0L) + wc.addWc("AU.id_fornitore=" + CR.getId_fornitoreUsato()); + if (CR.getPrezzoDa() > 0.0D) + wc.addWc("A.prezzoPubblicoIvaOrd>=" + CR.getPrezzoDa()); + if (CR.getPrezzoA() > 0.0D) + wc.addWc("A.prezzoPubblicoIvaOrd<=" + CR.getPrezzoA()); + if (CR.getFlgPercRicaricoEffettivoLike() == 1L) { + wc.addWc("A.percRicaricoEffettivo >=" + CR.getPercRicaricoEffettivo()); + } else if (CR.getFlgPercRicaricoEffettivoLike() == 2L) { + wc.addWc("A.percRicaricoEffettivo <=" + CR.getPercRicaricoEffettivo()); + } else if (CR.getFlgPercRicaricoEffettivoLike() == 3L) { + wc.addWc("A.percRicaricoEffettivo =" + CR.getPercRicaricoEffettivo()); + } + if (!CR.getLangReadyForWeb().isEmpty()) + if (CR.getFlgReadyForWeb() == 1L) { + wc.addWc("A.readyForWeb like '%," + CR.getLangReadyForWeb() + ",%'"); + } else if (CR.getFlgReadyForWeb() == 2L) { + wc.addWc("A.readyForWeb like '%," + CR.getLangReadyForWeb() + ",%'"); + wc.addWc("A.erroriSeo is not null and LENGTH(A.erroriSeo) > 1"); + } else if (CR.getFlgReadyForWeb() == 0L) { + wc.addWc("(A.readyForWeb is null or A.readyForWeb not like '%," + CR.getLangReadyForWeb() + ",%')"); + } + if (CR.getFlgIcecatAuto() == 0L) { + wc.addWc("(M.flgIcecatAuto =0 or M.flgIcecatAuto is null)"); + } else if (CR.getFlgIcecatAuto() > 0L) { + wc.addWc("M.flgIcecatAuto=" + CR.getFlgIcecatAuto()); + } + if (CR.getDataMovimento() == null && CR.getDataDocumentoUsatoA() == null) + if (CR.getFlgQta() == 1L) + if (CR.getQtaDa() == 0L) { + wc.addWc("(A.quantita<=" + CR.getQtaA() + " or B.quantitaAv<=" + CR.getQtaA() + ")"); + } else { + wc.addWc("(A.quantita>=" + CR.getQtaDa() + " or B.quantitaAv>=" + CR.getQtaDa() + ")"); + wc.addWc("(A.quantita<=" + CR.getQtaA() + " or B.quantitaAv<=" + CR.getQtaA() + ")"); + } + if (!CR.getCurrentCodice().isEmpty()) + if (CR.getFlgOrderType().toLowerCase().equals("desc")) { + wc.addWc("A.codice <'" + CR.getCurrentCodice() + "'"); + } else { + wc.addWc("A.codice >'" + CR.getCurrentCodice() + "'"); + } + if (CR.getFlgDisponibile() == 1L) + wc.addWc("A.quantita>=1"); + if (!CR.getCodice().isEmpty()) { + String temp = prepareInputMySqlString(CR.getCodice(), true); + if (temp.length() < 10) { + String temp10 = zeroLeft(temp, 10); + wc.addWc("(A.codice like'" + temp + "%'or A.codice ='" + temp10 + "' or B.codiceVariante like '" + temp + "%' or B.codiceVariante='" + temp10 + "')"); + } else { + wc.addWc("(A.codice like'" + temp + "%' or B.codiceVariante like '" + temp + "%')"); + } + } + if (CR.getId_statoUsato() != 0L) + wc.addWc("A.id_statoUsato=" + CR.getId_statoUsato()); + if (CR.getId_marca() != 0L) + wc.addWc("A.id_marca=" + CR.getId_marca()); + if (!CR.getId_marche().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getId_marche(), ","); + StringBuilder wcmarche = new StringBuilder("("); + while (st.hasMoreTokens()) { + long token = Long.parseLong(st.nextToken()); + wcmarche.append("A.id_marca= " + token); + if (st.hasMoreTokens()) + wcmarche.append(" or "); + } + wcmarche.append(")"); + wc.addWc(wcmarche.toString()); + } + if (CR.getId_tipoAccessorio() > 0L) + wc.addWc("A.id_tipoAccessorio=" + CR.getId_tipoAccessorio()); + if (CR.getId_magFisico() > 0L) + wc.addWc("A.codiciMagazzino like'%," + CR.getId_magFisico() + ",%'"); + if (CR.getId_vetrina() > 0L) + wc.addWc("(A.id_vetrina=" + CR.getId_vetrina() + " or B.id_vetrina=" + CR.getId_vetrina() + ")"); + if (CR.getFlgNoleggio() == 20L) { + wc.addWc("A.flgNoleggio>=1"); + } else if (CR.getFlgNoleggio() > 0L) { + wc.addWc("A.flgNoleggio=" + CR.getFlgNoleggio()); + } + if (CR.getFlgRiordino() == 1L) + wc.addWc("((A.quantitaEffettiva = null and A.qtaRiordino>0)or A.quantitaEffettiva 0L) { + wc.addWc("A.flgKit=" + CR.getFlgKit()); + } + if (CR.getFlgEscludiWeb() == 0L) { + wc.addWc("(A.flgEscludiWeb=0 or A.flgEscludiWeb is null)"); + } else if (CR.getFlgEscludiWeb() > 0L) { + wc.addWc("A.flgEscludiWeb=" + CR.getFlgEscludiWeb()); + } + if (CR.getFlgWebNoVendita() == 0L) { + wc.addWc("(A.flgWebNoVendita=0 or A.flgWebNoVendita is null)"); + } else if (CR.getFlgWebNoVendita() > 0L) { + wc.addWc("A.flgWebNoVendita=" + CR.getFlgWebNoVendita()); + } + if (CR.getFlgArticoloComponente() == 0L) { + wc.addWc("(A.flgArticoloComponente=0 or A.flgArticoloComponente is null)"); + } else if (CR.getFlgArticoloComponente() > 0L) { + wc.addWc("A.flgArticoloComponente=" + CR.getFlgArticoloComponente()); + } + if (CR.getFlgNascondi() == 0L) { + wc.addWc("(A.flgNascondi=0 or A.flgNascondi is null)"); + wc.addWc("(B.flgNascondi=0 or B.flgNascondi is null)"); + wc.addWc("(C.flgNascondi=0 or C.flgNascondi is null)"); + if (CR.getFlgUsaDisponibilita() == 1L) + wc.addWc("(B.flgNascondi=0 or B.flgNascondi is null)"); + } else if (CR.getFlgNascondi() > 0L) { + wc.addWc("A.flgNascondi=" + CR.getFlgNascondi()); + wc.addWc("C.flgNascondi=" + CR.getFlgNascondi()); + if (CR.getFlgUsaDisponibilita() == 1L) + wc.addWc("B.flgNascondi=" + CR.getFlgNascondi()); + } + if (CR.getId_tipoSel() != 0L) + wc.addWc("(A.id_tipo=" + CR.getId_tipoSel() + " or C.indici like'%:" + CR.getId_tipoSel() + ":%')"); + if (CR.getFlgRateale0() == 0L) { + wc.addWc("(A.flgRateale0 is null or A.flgRateale0=0)"); + } else if (CR.getFlgRateale0() > 0L) { + wc.addWc("A.flgRateale0= " + CR.getFlgRateale0()); + } + if (CR.getFlgGoogle() == 0L) { + wc.addWc("(A.flgGoogle is null or A.flgGoogle=0)"); + } else if (CR.getFlgGoogle() == 1L || CR.getFlgGoogle() == 2L) { + wc.addWc("A.flgGoogle= " + CR.getFlgGoogle()); + } else if (CR.getFlgGoogle() == 3L) { + wc.addWc("(A.flgGoogle=1 or A.flgGoogle=2)"); + } + if (CR.getFlgTrovaprezzi() == 0L) { + wc.addWc("(A.flgTrovaprezzi is null or A.flgTrovaprezzi=0)"); + } else if (CR.getFlgTrovaprezzi() > 0L) { + wc.addWc("A.flgTrovaprezzi= " + CR.getFlgTrovaprezzi()); + } + if (CR.getFlgIdealo() == 0L) { + wc.addWc("(A.flgIdealo is null or A.flgIdealo=0)"); + } else if (CR.getFlgIdealo() > 0L) { + wc.addWc("A.flgIdealo= " + CR.getFlgIdealo()); + } + if (CR.getFlgSubito() == 0L) { + wc.addWc("(A.flgSubito is null or A.flgSubito=0)"); + } else if (CR.getFlgSubito() > 0L) { + wc.addWc("A.flgSubito= " + CR.getFlgSubito()); + } + if (CR.getFlgEbay() == 0L) { + wc.addWc("(A.flgEbay is null or A.flgEbay=0)"); + } else if (CR.getFlgEbay() > 0L) { + wc.addWc("A.flgEbay= " + CR.getFlgEbay()); + } + if (CR.getFlgAmazon() == 0L) { + wc.addWc("(A.flgAmazon is null or A.flgAmazon=0)"); + } else if (CR.getFlgAmazon() > 0L) { + wc.addWc("A.flgAmazon= " + CR.getFlgAmazon()); + } + if (CR.getFlgAmzWarn() == 0L) { + wc.addWc("(A.flgAmzWarn is null or A.flgAmzWarn=0)"); + } else if (CR.getFlgAmzWarn() > 0L) { + wc.addWc("A.flgAmzWarn= " + CR.getFlgAmzWarn()); + } + if (CR.getFlgEbayPubblicato() == 0L) { + wc.addWc("(A.ebayOfferId is null or A.ebayOfferId='')"); + } else if (CR.getFlgEbayPubblicato() > 0L) { + wc.addWc("LENGTH(A.ebayOfferId)>0"); + if (CR.getFlgEbayPubblicato() == 9L) + wc.addWc("((qtaEbay=0 && qtaSuEbay!=quantita) or (qtaEbay>0 && qtaSuEbay!=LEAST(quantita,qtaEbay)))"); + } + if (CR.getFlgInEsaurimento() == 0L) { + wc.addWc("(A.flgInEsaurimento is null or A.flgInEsaurimento=0)"); + } else if (CR.getFlgInEsaurimento() > 0L) { + wc.addWc("A.flgInEsaurimento= " + CR.getFlgInEsaurimento()); + } + if (CR.getFlgContoVendita() == 0L) { + wc.addWc("(A.flgContoVendita is null or A.flgContoVendita=0)"); + } else if (CR.getFlgContoVendita() > 0L) { + wc.addWc("A.flgContoVendita= " + CR.getFlgContoVendita()); + } + if (CR.getFlgUsato() >= 0L) + if (CR.getFlgUsato() == 0L) { + wc.addWc("(A.flgUsato= 0 or A.flgUsato is null)"); + } else if (CR.getFlgUsato() == 99L) { + wc.addWc("A.flgUsato>=1"); + } else { + wc.addWc("A.flgUsato=" + CR.getFlgUsato()); + } + if (CR.getCarId_lista() != 0L) { + Lista lista = new Lista(getApFull()); + lista.findByPrimaryKey(CR.getCarId_lista()); + wc.addWc("A.caratteristiche like '%," + lista.getValore() + ",%'"); + } + if (CR.getCarId_lista1() != 0L) { + Lista lista = new Lista(getApFull()); + lista.findByPrimaryKey(CR.getCarId_lista1()); + wc.addWc("A.caratteristiche like '%," + lista.getValore() + ",%'"); + } + if (CR.getId_lista1() > 0L) { + s_Sql_Find.append(" , CARATTERISTICA_ARTICOLO AS CA1"); + wc.addWc("A.id_articolo=CA1.id_articolo"); + } + if (CR.getId_lista2() > 0L) { + s_Sql_Find.append(" , CARATTERISTICA_ARTICOLO AS CA2"); + wc.addWc("A.id_articolo=CA2.id_articolo"); + } + if (CR.getId_lista3() > 0L) { + s_Sql_Find.append(" , CARATTERISTICA_ARTICOLO AS CA3"); + wc.addWc("A.id_articolo=CA3.id_articolo"); + } + if (CR.getId_lista4() > 0L) { + s_Sql_Find.append(" , CARATTERISTICA_ARTICOLO AS CA4"); + wc.addWc("A.id_articolo=CA4.id_articolo"); + } + if (CR.getValSN1() == 1L) { + s_Sql_Find.append(" , CARATTERISTICA_ARTICOLO AS CAV1"); + wc.addWc("A.id_articolo=CAV1.id_articolo"); + } + if (CR.getValSN2() == 1L) { + s_Sql_Find.append(" , CARATTERISTICA_ARTICOLO AS CAV2"); + wc.addWc("A.id_articolo=CAV2.id_articolo"); + } + if (CR.getValSN3() == 1L) { + s_Sql_Find.append(" , CARATTERISTICA_ARTICOLO AS CAV3"); + wc.addWc("A.id_articolo=CAV3.id_articolo"); + } + if (CR.getId_lista1() != 0L) + wc.addWc("CA1.id_lista=" + CR.getId_lista1()); + if (CR.getId_lista2() != 0L) + wc.addWc("CA2.id_lista=" + CR.getId_lista2()); + if (CR.getId_lista3() != 0L) + wc.addWc("CA3.id_lista=" + CR.getId_lista3()); + if (CR.getId_lista4() != 0L) + wc.addWc("CA4.id_lista=" + CR.getId_lista4()); + if (CR.getValSN1() == 1L) { + wc.addWc("CAV1.valSN=1"); + wc.addWc("CAV1.id_caratteristica=" + CR.getId_caratteristicaValSN1()); + } + if (CR.getId_iva() != 0L) + wc.addWc("A.id_iva=" + CR.getId_iva()); + if (!CR.getNomeV().isEmpty()) + wc.addWc("B.nomeV='" + CR.getNomeV() + "'"); + if (!CR.getCodiceSerieV().isEmpty()) + wc.addWc("B.codiceSerieV='" + CR.getCodiceSerieV() + "'"); + if (!CR.getDescrizioneArticolo().isEmpty()) + wc.addWc("A.nome LIKE '%" + CR.getDescrizioneArticolo() + "%'"); + if (!CR.getNome().isEmpty()) + wc.addWc("A.nome LIKE '%" + CR.getNome() + "%'"); + if (CR.getDataDocumentoUsatoA() != null) + wc.addWc("(CX.flgTipoDocumento=1 or CX.flgTipoDocumento=3 ) "); + if (CR.getFlgOrderBy() == 10L) + wc.addWc("(A.hashCodeCurrent is null or A.hashCodeCurrent<>A.hashCodeIndexNow) "); + if (CR.getFlgStockOfferte() > 0L) + if (CR.getFlgStockOfferte() == 99L) { + wc.addWc("(A.flgStockOfferte=1 and (A.dataScadenzaOfferta is null or A.dataScadenzaOfferta>=?))"); + } else { + wc.addWc("A.flgStockOfferte=" + CR.getFlgStockOfferte()); + } + if (CR.getFlgOfferta() == 1L) { + wc.addWc("(A.dataScadenzaOfferta>=? or A.dataScadenzaOffertaFornitore>=?)"); + } else if (CR.getFlgOfferta() == 0L) { + wc.addWc("(A.dataScadenzaOfferta=?)"); + } else if (CR.getFlgOfferta() == 11L) { + wc.addWc("(A.dataScadenzaOfferta>=? )"); + } else if (CR.getFlgOfferta() == 22L) { + wc.addWc("(A.dataScadenzaOffertaFornitore is not null and A.dataScadenzaOffertaFornitore=?"); + if (CR.getDataDocumentoA() != null) + wc.addWc("DOC.dataDocumento<=? "); + if (CR.getDataCreazioneDa() != null) + wc.addWc("A.createTmst>=?"); + if (CR.getDataCreazioneA() != null) + wc.addWc("A.createTmst<=?"); + if (CR.getDataUpdateDa() != null) + wc.addWc("A.lastUpdTmst>=? "); + if (CR.getFlgAmzFeaturedPriceData() == 1L) + wc.addWc("(AFP.dataPriceAmz is null or AFP.dataPriceAmz "); + sb.append(getNf().format(getQuantita())); + sb.append(""); + } else { + sb.append(getNf().format(getQuantita())); + } + sb.append(" + "); + sb.append(" "); + sb.append(getNf().format(getQuantitaInArrivo())); + sb.append(""); + sb.append(" - "); + sb.append(" "); + sb.append(getNf().format(getQuantitaImpegnata())); + sb.append(""); + sb.append(" = "); + sb.append(" "); + sb.append(getNf().format(getQuantitaEffettiva())); + sb.append(""); + return sb.toString(); + } + + public double getImportListinoPrezzoOfferta() { + return this.prezzoOfferta; + } + + public void setPrezzoOfferta(double prezzoOfferta) { + this.prezzoOfferta = prezzoOfferta; + } + + public long getTipoArticoloVetrina() { + return 0L; + } + + public String getCaratteristicheListeId() { + return (this.caratteristicheListeId == null) ? "" : this.caratteristicheListeId.trim(); + } + + public void setCaratteristicheListeId(String caratteristicheListeId) { + this.caratteristicheListeId = caratteristicheListeId; + } + + public void setLavaggio(long newLavaggio) { + this.lavaggio = newLavaggio; + setSimboliLavaggio(null); + } + + public void setCandeggio(long newCandeggio) { + this.candeggio = newCandeggio; + setSimboliLavaggio(null); + } + + public void setStiratura(long newStiratura) { + this.stiratura = newStiratura; + setSimboliLavaggio(null); + } + + public void setPulituraSecco(long newPulituraSecco) { + this.pulituraSecco = newPulituraSecco; + setSimboliLavaggio(null); + } + + public void setAsciugatura(long newAsciugatura) { + this.asciugatura = newAsciugatura; + setSimboliLavaggio(null); + } + + public void setMassaLineare(long newMassaLineare) { + this.massaLineare = newMassaLineare; + } + + public void setAltezzaMinima(long newAltezzaMinima) { + this.altezzaMinima = newAltezzaMinima; + } + + public long getLavaggio() { + return this.lavaggio; + } + + public long getCandeggio() { + return this.candeggio; + } + + public long getStiratura() { + return this.stiratura; + } + + public long getPulituraSecco() { + return this.pulituraSecco; + } + + public long getAsciugatura() { + return this.asciugatura; + } + + public long getMassaLineare() { + return this.massaLineare; + } + + public long getAltezzaMinima() { + return this.altezzaMinima; + } + + public SimboliLavaggio getSimboliLavaggio() { + if (this.simboliLavaggio == null) { + this.simboliLavaggio = new SimboliLavaggio(); + this.simboliLavaggio.setAsciugatura(getAsciugatura()); + this.simboliLavaggio.setCandeggio(getCandeggio()); + this.simboliLavaggio.setLavaggio(getLavaggio()); + this.simboliLavaggio.setPulituraSecco(getPulituraSecco()); + this.simboliLavaggio.setStiratura(getStiratura()); + } + return (this.simboliLavaggio == null) ? new SimboliLavaggio() : this.simboliLavaggio; + } + + public ResParm addArticoloComponente(ArticoloComponente row) { + ResParm rp = new ResParm(true); + ArticoloComponente bean = new ArticoloComponente(getApFull()); + bean.findByArticoloComponente(row.getId_articolo(), row.getId_componente()); + if (bean.getDBState() == 1) { + bean.setPerc(row.getPerc()); + rp = bean.save(); + } else { + row.setDBState(0); + rp = row.save(); + } + return rp; + } + + public ResParm delArticoloComponente(ArticoloComponente row) { + ArticoloComponente bean = new ArticoloComponente(getApFull()); + bean.findByPrimaryKey(row.getId_articoloComponente()); + return bean.delete(); + } + + public double getPercTotaleComponenti() { + String s_Sql_Find = "select SUM(A.perc) AS _sum from ARTICOLO_COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_articolo = " + getId_articolo()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public ResParm addListinoArticolo(ListinoArticolo row) { + ResParm rp = new ResParm(true); + ListinoArticolo bean = new ListinoArticolo(getApFull()); + bean.findByArticoloListino(row.getId_articolo(), row.getId_listino()); + if (bean.getDBState() == 1) { + bean.setPrezzoLA(row.getPrezzoLA()); + bean.setPercLA(row.getPercLA()); + bean.setPercLA1(row.getPercLA1()); + bean.setPercLA2(row.getPercLA2()); + bean.setPercLA3(row.getPercLA3()); + rp = bean.save(); + } else { + row.setDBState(0); + rp = row.save(); + } + return rp; + } + + public ResParm delListinoArticolo(ListinoArticolo row) { + ListinoArticolo bean = new ListinoArticolo(getApFull()); + bean.findByPrimaryKey(row.getId_listinoArticolo()); + return bean.delete(); + } + + public void setId_articoloTaglia(long id_articoloTaglia) { + this.id_articoloTaglia = id_articoloTaglia; + setArticoloTaglia(null); + } + + public Vectumerator findByCRAv(ArticoloCR CR, int pageNumber, int pageRows) { + if (CR.getFlgTipoRicerca() == 1L) + return findByCRSerMagazzino(CR, pageNumber, pageRows); + String s_Sql_Find1 = "select C.id_articoloTaglia, B.id_articoloVariante as id_articoloVariante, A.* from ARTICOLO AS A JOIN ARTICOLO_VARIANTE AS B ON A.id_articolo=B.id_articolo LEFT JOIN ARTICOLO_TAGLIA AS C ON A.id_articolo=C.id_articolo AND B.id_articoloVariante=C.id_articoloVariante"; + String s_Sql_Find2 = "select C.id_articoloTaglia, 0 as id_articoloVariante, A.* from ARTICOLO AS A LEFT JOIN ARTICOLO_TAGLIA AS C ON A.id_articolo=C.id_articolo and (C.id_articoloVariante is null or C.id_articoloVariante=0) "; + String s_Sql_Order = " order by A.nome"; + WcString wc = new WcString(); + StringBuffer wcArt = new StringBuffer(""); + StringBuffer wcArtVar = new StringBuffer(""); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + while (st.hasMoreTokens()) { + String token = star + star; + wcArt.append("(A.codice like '%" + token + "%' or A.descrizioneSearch like '%" + token + "%' or A.codiciAlternativi like '%," + token + "%')"); + wcArtVar.append("(A.codice like '%" + token + "%' or A.nome like '%" + token + "%' or B.codiceVariante like '%" + token + "%' or B.codiciAlternativiV like '%," + token + ",%' or B.nomeV like '%" + token + "%')"); + if (st.hasMoreTokens()) { + wcArt.append(" and "); + wcArtVar.append(" and "); + star = "%"; + } + } + } + if (wcArtVar.length() > 0) { + wcArtVar.append(" and "); + wcArt.append(" and "); + } + wcArtVar.insert(0, " where "); + wcArtVar.append(" B.id_articoloVariante Is Not Null AND A.flgUsaVarianti=1 and (A.flgNascondi=0 or A.flgNascondi is null) and (A.flgArticoloComponente is null or A.flgArticoloComponente=0) and A.dataFineVld is null"); + wcArt.insert(0, " where "); + wcArt.append(" (A.flgUsaVarianti=0 or A.flgUsaVarianti is null) and (A.flgArticoloComponente is null or A.flgArticoloComponente=0) and (A.flgNascondi=0 or A.flgNascondi is null) and A.dataFineVld is null"); + if (CR.getFlgEscludiWeb() == 0L) { + wcArt.append(" and (A.flgEscludiWeb=0 or A.flgEscludiWeb is null)"); + } else if (CR.getFlgEscludiWeb() > 0L) { + wcArt.append(" and A.flgEscludiWeb=" + CR.getFlgEscludiWeb()); + } + try { + PreparedStatement stmt = getConn().prepareStatement("(" + s_Sql_Find1 + wcArtVar.toString() + s_Sql_Order + ") union (" + s_Sql_Find2 + + wcArt.toString() + s_Sql_Order + ")"); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void arrotondaPrezzoPubblicoConIva() { + if (getDBState() == 1 && + getId_iva() == 6L) + System.out.println("SE ARRIVA QUI SIAMO NEI GUAI"); + } + + public long getFlgNoListinoArt() { + return this.flgNoListinoArt; + } + + public void setFlgNoListinoArt(long flgNoListinoArt) { + this.flgNoListinoArt = flgNoListinoArt; + } + + private double getPercScontoListino(Clifor l_clifor) { + if (getFlgNoListino() == 1L) + return 0.0D; + Listino listino = l_clifor.getListino(); + if (listino.getId_listino() > 0L) + return listino.getPercSconto(this); + return 0.0D; + } + + public long getId_fornitoreAbituale() { + ArticoloFornitore af = new ArticoloFornitore(getApFull()); + af.findByArticoloFornitoreAbituale(getId_articolo()); + return af.getId_clifor(); + } + + public Clifor getFornitoreAbituale() { + ArticoloFornitore af = new ArticoloFornitore(getApFull()); + af.findByArticoloFornitoreAbituale(getId_articolo()); + return af.getFornitore(); + } + + public double getQtaDaRiordinare(long l_id_rigaDocumento) { + if (l_id_rigaDocumento > 0L) { + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findByPrimaryKey(l_id_rigaDocumento); + double[] res = rd.getQtaOrdinataPrelevataByRigaPrenotazione(); + double qtOrd = res[0]; + DoubleOperator dop = new DoubleOperator(rd.getQuantita()); + dop.subtract(qtOrd); + return Math.max(0.0D, dop.getResult()); + } + return getQtaDaRiordinare(); + } + + public String getQuantitaMagazzinoMovimentoHtml() { + if (getParm("USA_MAGAZZINO").isTrue()) + return getNf().format(getQuantita()); + if (!isQuantitaCalcolate() && this.id_articolo != 0L) + calcolaQuantita(); + return (this.quantitaMagazzinoMovimentoHtml == null) ? "" : this.quantitaMagazzinoMovimentoHtml; + } + + public TipologiaArticolo getTipologiaArticolo() { + return getTipo().getTipologiaArticolo(); + } + + public ResParm superSave() { + return super.save(); + } + + public long getFlgTipoMagazzino() { + return this.flgTipoMagazzino; + } + + public void setFlgTipoMagazzino(long flgTipoMagazzino) { + this.flgTipoMagazzino = flgTipoMagazzino; + } + + public double getQuantitaW() { + if (!isQuantitaCalcolate() && this.id_articolo != 0L) + calcolaQuantita(); + return this.quantitaW; + } + + public void setQuantitaW(double quantitaW) { + this.quantitaW = quantitaW; + } + + public long getFlgDispo() { + return this.flgDispo; + } + + public void setFlgDispo(long flgDispo) { + this.flgDispo = flgDispo; + } + + public Vectumerator findByCRSerMagazzino(ArticoloCR CR, int pageNumber, int pageRows) { + handleDebug("findbycrsermagazzino chiamata!!", 1); + try { + Vectumerator vec = new Vectumerator(); + String sql = "SELECT M.id_articolo as id_artmov, A.id_articolo,A.codice,A.codiceEan, 0 as id_articoloTaglia, M.id_articoloVariante,M.id_clifor, M.seriale, SUM(segnoMov*kg) as kg, SUM(segnoMov*mt) as mt, SUM(segnoMov*nr) as nr, A.nome,A.id_marca,A.id_tipo,A.percSconto,A.id_iva,A.prezzoOfferta,A.prezzoPubblico,A.flgSerialiMassivi FROM RIGA_DOCUMENTO AS M INNER JOIN ARTICOLO AS A ON A.id_articolo=M.id_articolo "; + String s_Sql_GrouBy = " group by M.id_articolo, M.id_clifor, M.seriale "; + String s_Sql_Having = " HAVING ( nr>0 and A.id_articolo>0 and M.seriale is not null ) "; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + token = prepareInputMySqlString(token, false); + token = token.replace("*", "%"); + txt.append("(A.codice like '%" + token + "%' or A.nome like '%" + token + "%' or M.seriale = '" + token + "%' or A.codiceEan like '%" + token + "%' or A.codiciAlternativi like '%," + token + ",%' )"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (isDeleteLogic()) + if (CR.getFlgShowDeleteLogic() == 0L) { + wc.addWc("A.dataFineVld is null"); + } else { + wc.addWc("A.dataFineVld is not null"); + } + if (CR.getId_clifor() != 0L && CR.getId_magFisico() > 0L && CR.getMagFisico().getFlgTipo() != 1L) { + wc.addWc("(M.id_clifor=" + CR.getId_clifor() + ")"); + } else { + wc.addWc("(M.id_clifor=0 or M.id_clifor is null )"); + } + wc.addWc(" M.id_magFisico=" + CR.getId_magFisico()); + String s_Sql_Find1 = "select 0 as id_artmov, A.id_articolo,A.codice,A.codiceEan, C.id_articoloTaglia, B.id_articoloVariante,0 as id_clifor,null as seriale,0 as kg, 0 as mt, 0 as nr, A.nome,A.id_marca,A.id_tipo,A.percSconto,A.id_iva,A.prezzoOfferta,A.prezzoPubblico,A.flgSerialiMassivi from ARTICOLO AS A inner join TIPO as T on A.id_tipo=T.id_tipo left JOIN ARTICOLO_VARIANTE AS B ON A.id_articolo = B.id_articolo LEFT JOIN ARTICOLO_TAGLIA as C on A.id_articolo=C.id_articolo and B.id_articoloVariante=C.id_articoloVariante"; + String s_Sql_Order = " "; + WcString wc1 = new WcString(); + wc1.addWc("T.flgTipoMagazzino!=2"); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + token = prepareInputMySqlString(token, false); + token = token.replace("*", "%"); + txt.append("(A.codice like '%" + token + "%' or A.nome like '%" + token + "%' or C.codiceAT = '" + token + "' or A.codiceEan like '%" + token + "%'or A.codiciAlternativi like '%," + token + ",%' or B.codiceVariante like '%" + token + "%' or B.nomeV like '%" + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc1.addWc(txt.toString()); + } + if (isDeleteLogic()) + if (CR.getFlgShowDeleteLogic() == 0L) { + wc1.addWc("A.dataFineVld is null"); + } else { + wc1.addWc("A.dataFineVld is not null"); + } + PreparedStatement stmt = getConn().prepareStatement("(" + sql + wc.toString() + s_Sql_GrouBy + s_Sql_Having + ") union (" + s_Sql_Find1 + + wc1.toString() + s_Sql_Order + ")"); + return findRows(stmt, pageNumber, 50); + } catch (SQLException e) { + handleDebug(e); + e.printStackTrace(); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getImportAbbuonoPrezzoPubblico() { + return this.abbuonoPrezzoPubblico; + } + + public double getAbbuonoPrezzoPubblico() { + return getListinoArticoloBase().getAbbuonoPrezzoPubblicoLA(); + } + + public double getImportListinoAbbuonoPrezzoPubblico() { + return this.abbuonoPrezzoPubblico; + } + + public void setAbbuonoPrezzoPubblico(double abbuonoPrezzoPubblico) { + this.abbuonoPrezzoPubblico = abbuonoPrezzoPubblico; + } + + public ResParm ebayDeleteInventoryItem() { + boolean debug = false; + ResParm rp = new ResParm(); + if (getId_articolo() == 0L) { + rp.setStatus(false); + rp.setMsg("Errore! Articolo nullo o non valido!"); + } else { + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + if (attivita.isEbayPubblicabile()) { + EbayAbliaApi ebay = new EbayAbliaApi(getApFull()); + if (ebay.isOAuthTokenValid()) { + EbayResult res = new EbayResult(); + res.setOk(true); + if (!getEbayOfferId().isEmpty()) { + if (debug) + System.out.println("Articolo.ebayDeleteInventoryItem ebayDeleteOffer..."); + res = ebay.ebayDeleteOffer(this); + if (debug) + System.out.println("Articolo.ebayDeleteInventoryItem ebayDeleteOffer..." + res.getMsg()); + } + if (res.isOk()) { + if (debug) + System.out.println("Articolo.ebayDeleteInventoryItem ebayDeleteInventoryItem..."); + res = ebay.ebayDeleteInventoryItem(this); + if (debug) + System.out.println("Articolo.ebayDeleteInventoryItem ebayDeleteInventoryItem..." + res.getMsg()); + } + if (res.isOk()) { + rp.setStatus(true); + rp.setMsg("Articolo inserito o aggiornato correttamente"); + } else { + rp.setStatus(false); + rp.setMsg("Errore! " + res.getMsg()); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! User token non valido! Richiedere nuovo token oAuth!"); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! Mancano i profiles id su attivita!"); + } + } + return rp; + } + + public ResParm ebayRemoveOffer() { + ResParm rp = new ResParm(); + if (getId_articolo() == 0L) { + rp.setStatus(false); + rp.setMsg("Errore! Articolo nullo o non valido!"); + } else { + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + EbayAbliaApi ebay = new EbayAbliaApi(getApFull()); + if (ebay.isOAuthTokenValid()) { + EbayResult res = new EbayResult(); + res.setOk(true); + if (getEbayOfferId().isEmpty()) { + rp.setStatus(false); + rp.setMsg("Errore! articolo senza id offerta"); + } else { + res = ebay.ebayDeleteOffer(this); + } + if (res.isOk()) { + rp.setStatus(true); + rp.setMsg("Offerta " + getEbayOfferId() + " rimossa correttamente!"); + setEbayOfferId(null); + superSave(); + } else { + rp.setStatus(false); + rp.setMsg("Errore! " + res.getMsg()); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! User token non valido! Richiedere nuovo token oAuth!"); + } + } + return rp; + } + + public void setQuantitaMagazzinoMovimentoHtml(String quantitaMagazzinoMovimentoHtml) { + this.quantitaMagazzinoMovimentoHtml = quantitaMagazzinoMovimentoHtml; + } + + public String getImgFileName(int imgNumber, int scaledWidth) { + String targetDir = getDocBase() + getDocBase(); + String newImageName = "" + scaledWidth + "/" + scaledWidth; + String srcFileName = targetDir + targetDir; + String targetFileName = targetDir + targetDir; + ResParm rp = ScaleImage.scaleImageToFile(srcFileName, targetFileName, getPathTmpFull(), scaledWidth, 75); + if (rp.getStatus()) + return newImageName; + return getImgFileName(imgNumber, getImgTmst()); + } + + public Vectumerator findByCRSerMovimentoTUTTIICAMPI(ArticoloCR CR, int pageNumber, int pageRows) { + try { + Vectumerator vec = new Vectumerator(); + String sql = "SELECT M.id_articolo as id_artmov, A.id_articolo, 0 as id_articoloTaglia, M.id_articoloVariante,M.id_clifor, M.seriale, SUM(kg) as kg, SUM(mt) as mt, SUM(nr) as nr, A.* FROM MOVIMENTO AS M INNER JOIN ARTICOLO AS A ON A.id_articolo=M.id_articolo "; + String s_Sql_GrouBy = " group by M.id_articolo, M.id_clifor, M.seriale "; + String s_Sql_Having = " HAVING ( nr>0 and A.id_articolo>0 and M.seriale is not null) "; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + token = prepareInputMySqlString(token, false); + token = token.replace("*", "%"); + txt.append("(A.codice like '%" + token + "%' or A.nome like '%" + token + "%' or M.seriale = '" + token + "'or A.codiciAlternativi like '%," + token + ",%' )"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (isDeleteLogic()) + if (CR.getFlgShowDeleteLogic() == 0L) { + wc.addWc("A.dataFineVld is null"); + } else { + wc.addWc("A.dataFineVld is not null"); + } + if (CR.getId_clifor() != 0L && CR.getMagFisico().getFlgTipo() != 1L) { + wc.addWc("(M.id_clifor=" + CR.getId_clifor() + ")"); + } else { + wc.addWc("(M.id_clifor=0 or M.id_clifor is null )"); + } + wc.addWc(" M.id_magFisico=" + CR.getId_magFisico()); + String s_Sql_Find1 = "select 0 as id_artmov, A.id_articolo, C.id_articoloTaglia, B.id_articoloVariante,0 as id_clifor,null as seriale,0 as kg, 0 as mt, 0 as nr, A.* from ARTICOLO AS A inner join TIPO as T on A.id_tipo=T.id_tipo left JOIN ARTICOLO_VARIANTE AS B ON A.id_articolo = B.id_articolo LEFT JOIN ARTICOLO_TAGLIA as C on A.id_articolo=C.id_articolo and B.id_articoloVariante=C.id_articoloVariante"; + String s_Sql_Order = " "; + WcString wc1 = new WcString(); + wc1.addWc("T.flgTipoMagazzino!=2"); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + token = prepareInputMySqlString(token, false); + token = token.replace("*", "%"); + txt.append("(A.codice like '%" + token + "%' or A.nome like '%" + token + "%' or C.codiceAT = '" + token + "'or A.codiciAlternativi like '%," + token + ",%' or B.nomeV like '%" + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc1.addWc(txt.toString()); + } + if (isDeleteLogic()) + if (CR.getFlgShowDeleteLogic() == 0L) { + wc1.addWc("A.dataFineVld is null"); + } else { + wc1.addWc("A.dataFineVld is not null"); + } + wc1.addWc(" (A.flgDispo > 0 OR B.flgDispo > 0 OR C.flgDispo > 0) "); + PreparedStatement stmt = getConn().prepareStatement("(" + sql + wc.toString() + s_Sql_GrouBy + s_Sql_Having + ") union (" + s_Sql_Find1 + + wc1.toString() + s_Sql_Order + ")"); + return findRows(stmt, pageNumber, 50); + } catch (SQLException e) { + handleDebug(e); + e.printStackTrace(); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void resetCalcoloQuantita() { + if (getId_articolo() > 0L) { + update("update ARTICOLO set quantitaCalcolate=false where id_articolo=" + getId_articolo()); + setQuantitaCalcolate(false); + } + } + + public ResParm resetFornitore(long l_id_fornitore) { + ResParm rp = new ResParm(true); + return rp; + } + + public long getFlgWebNoVendita() { + return this.flgWebNoVendita; + } + + public void setFlgWebNoVendita(long flgWebNoVendita) { + this.flgWebNoVendita = flgWebNoVendita; + } + + public double getPriceWVat(long l_id_users) { + if (l_id_users == 0L) + return getPriceWVat(); + Users user = new Users(getApFull()); + user.findByPrimaryKey(l_id_users); + if (user.getId_clifor() >= 0L) + return getPrezzoPubblicoIva(user.getClifor()); + return getPriceWVat(); + } + + public double getPriceWVat(Users l_user) { + return getPriceWVat(l_user.getId_users()); + } + + public Listino getListinoBase() { + if (this.listinoBase == null && getApFull() != null) + this.listinoBase = Listino.dammiListinoBase(getApFull()); + return this.listinoBase; + } + + public void setListinoBase(Listino listinoBase) { + this.listinoBase = listinoBase; + } + + public void setListinoArticoloBase(ListinoArticolo listinoArticoloBase) { + this.listinoArticoloBase = listinoArticoloBase; + } + + public Date getImportListinoDataCambiamentoPrezzo() { + return this.dataCambiamentoPrezzo; + } + + public double getPrezzoBase() { + return getListinoArticoloBase().getPrezzoLA(); + } + + public double getPrezzoBaseIva() { + return DBAdapter.conIva(getListinoArticoloBase().getPrezzoLA(), (double)getIva().getAliquota()); + } + + public double getPrezzoBaseIva(Users user) { + if (user.getId_clifor() == 0L) + return DBAdapter.conIva(getListinoArticoloBase().getPrezzoLA(), (double)getIva().getAliquota()); + if (user.getClifor().isPrezzoWebEsente()) + return DBAdapter.conIva(getListinoArticoloBase().getPrezzoLA(), getIvaAliquota(user.getClifor())); + return DBAdapter.conIva(getListinoArticoloBase().getPrezzoLA(), (double)getIva().getAliquota()); + } + + public boolean isOffertaValida() { + if (getListinoArticoloBase().isOffertaValida()) + return true; + return isOffertaFornitoreValida(); + } + + public boolean isOffertaFornitoreValida() { + if (getListinoArticoloBase().isOffertaValida()) + return false; + if (getId_fornitoreCostoNuovo() > 0L && getDataScadenzaOffertaFornitore() != null && + DBAdapter.getDateDiff(getToday(), getDataScadenzaOffertaFornitore()) >= 0L) + return true; + return false; + } + + public String getDescrizioneOffertaAdmin() { + if (isOffertaFornitoreValida()) + return "Offerta FORNITORE " + getFornitoreCostoNuovo().getCognomeNome() + " valida fino al " + + getDataFormat().format(getDataScadenzaOffertaFornitore()); + if (isOffertaValida()) + return "Offerta valida fino al " + getDataFormat().format(getDataScadenzaOfferta()) + " (" + getNf().format(getPrezzoBaseIva()) + ")"; + return ""; + } + + public double getPrezzoOfferta() { + return getListinoArticoloBase().getPrezzoOffertaLA(); + } + + public double getPercScontoOfferta() { + return getListinoArticoloBase().getPercScontoOffertaLA(); + } + + public double getPrezzoOffertaIva() { + return DBAdapter.conIva(getListinoArticoloBase().getPrezzoOffertaLA(), (double)getIva().getAliquota()); + } + + public ListinoArticolo getListinoArticoloBase() { + if ((this.listinoArticoloBase == null || this.listinoArticoloBase.getId_listinoArticolo() == 0L) && getApFull() != null && + getId_articolo() != 0L) { + this.listinoArticoloBase = new ListinoArticolo(getApFull()); + this.listinoArticoloBase.findByArticoloListino(getId_articolo(), getListinoBase().getId_listino()); + } + return (this.listinoArticoloBase == null) ? new ListinoArticolo(getApFull()) : this.listinoArticoloBase; + } + + public PrezzoArticolo getPrezzoArticolo(Clifor clifor) { + if (this.prezzoArticolo != null && clifor != null && this.prezzoArticolo.getId_clifor() != clifor.getId_clifor()) { + this.prezzoArticolo = null; + this.prezzoArticoloIva = null; + } + if (this.prezzoArticolo == null && getId_articolo() > 0L && getId_articoloVariante() > 0L) { + if (clifor != null && clifor.getListino().getId_listino() > 0L) { + this.prezzoArticolo = clifor.getListino().getPrezzo(getArticoloVariante()); + this.prezzoArticolo.setId_clifor(clifor.getId_clifor()); + } else { + this.prezzoArticolo = getListinoBase().getPrezzo(getArticoloVariante()); + } + } else if (this.prezzoArticolo == null && getId_articolo() > 0L) { + if (clifor != null && clifor.getListino().getId_listino() > 0L) { + this.prezzoArticolo = clifor.getListino().getPrezzo(this); + this.prezzoArticolo.setId_clifor(clifor.getId_clifor()); + } else { + this.prezzoArticolo = getListinoBase().getPrezzo(this); + } + } + return (this.prezzoArticolo == null) ? new PrezzoArticolo() : this.prezzoArticolo; + } + + public double getPrezzoMinimoPaypal() { + double tariffaFissa = 0.35D; + double percPaypal = 0.034D; + if (getTipo().getEbayFissa() > 0.0D) + tariffaFissa = getTipo().getEbayFissa(); + if (getTipo().getEbayCommissione() > 0.0D) + percPaypal = getTipo().getEbayCommissione() / 100.0D; + DoubleOperator dop = new DoubleOperator(getCostoNetto()); + dop.setScale(4, 5); + dop.add(tariffaFissa); + DoubleOperator perc = new DoubleOperator(1.0F); + perc.subtract(percPaypal); + dop.divide(perc); + return dop.getResult(); + } + + public double getPrezzoMinimoPaypalIva() { + return conIva(getPrezzoMinimoPaypal(), (double)getIva().getAliquota()); + } + + public double getPrezzoMinimoPaypalEbay() { + double tariffaFissa = 0.35D; + double percPaypal = 0.034D; + double percEbay = 0.043D; + DoubleOperator dop = new DoubleOperator(getCostoNetto()); + dop.add(tariffaFissa); + DoubleOperator perc = new DoubleOperator(1.0F); + perc.subtract(percPaypal); + perc.subtract(percEbay); + dop.divide(perc); + return dop.getResult(); + } + + public double getPrezzoMinimoAmazonIva() { + return conIva(getPrezzoMinimoAmazon(), (double)getIva().getAliquota()); + } + + public PrezzoArticolo getPrezzoArticoloEbay() { + if (getId_listinoEbay() == 0L) + return getListinoBase().getPrezzoBaseLA(this); + return getListinoEbay().getPrezzo(this); + } + + public PrezzoArticolo getPrezzoArticoloEbayIva() { + if (getId_listinoEbay() == 0L) + return getListinoBase().getPrezzoBaseIvaLA(this); + return getListinoEbay().getPrezzoIva(this); + } + + public void setPrezzoArticolo(PrezzoArticolo prezzoArticoloBase) { + this.prezzoArticolo = prezzoArticoloBase; + this.prezzoArticoloIva = null; + } + + public PrezzoArticolo getPrezzoArticoloIvaOrig(Clifor clifor) { + if (this.prezzoArticoloIva != null && clifor != null && this.prezzoArticoloIva.getId_clifor() != clifor.getId_clifor()) { + this.prezzoArticolo = null; + this.prezzoArticoloIva = null; + } + if (this.prezzoArticoloIva == null && getId_articolo() > 0L) + if (clifor != null && clifor.getListino().getId_listino() > 0L) { + this.prezzoArticoloIva = clifor.getListino().getPrezzoIva(this); + this.prezzoArticoloIva.setId_clifor(clifor.getId_clifor()); + } else { + this.prezzoArticoloIva = getListinoBase().getPrezzoIva(this); + } + return (this.prezzoArticoloIva == null) ? new PrezzoArticolo() : this.prezzoArticoloIva; + } + + public void setPrezzoArticoloIva(PrezzoArticolo prezzoArticoloBaseIva) { + this.prezzoArticoloIva = prezzoArticoloBaseIva; + } + + public double getQuantita(Date data) { + if (!usaMagazzino()) + return 0.0D; + if (getParm("USA_MAGAZZINO").isFalse()) { + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagDisponibilita(getId_articolo(), 0L, 0L, null, 1L, 0L, data); + return rd.getQuantita(); + } + return this.quantita; + } + + public double getQuantitaM(Date data) { + if (!usaMagazzino()) + return 0.0D; + if (getParm("USA_MAGAZZINO").isFalse()) { + Movimento mov = new Movimento(getApFull()); + mov.findDisponibilita(getId_articolo(), 0L, 0L, null, 1L, 0L, data); + return mov.getQuantita(); + } + return this.quantita; + } + + public Vectumerator findUltimiModificatiRandom(long numArt, long numFetch) { + StringBuilder s_Sql_Find = new StringBuilder("select A.* from ARTICOLO AS A inner join TIPO AS C ON C.id_tipo=A.id_tipo "); + String s_Sql_Order = " order by A.lastUpdTmst desc,A.ordine desc, A.nome limit " + numFetch; + WcString wc = new WcString(); + wc.addWc("A.flgNascondi=0"); + wc.addWc("C.flgNascondi=0"); + wc.addWc("A.flgEscludiWeb=0"); + wc.addWc("A.quantita>0"); + try { + PreparedStatement stmt = getConn().prepareStatement("select R.* FROM (" + String.valueOf(s_Sql_Find) + + wc.toString() + s_Sql_Order + ") as R ORDER BY rand() limit " + numArt); + Vectumerator vec = findRows(stmt); + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getQuantita() { + return getQuantita(null); + } + + public boolean isQuantitaDataCalcolate() { + return this.quantitaDataCalcolate; + } + + public void setQuantitaDataCalcolate(boolean quantitaDataCalcolate) { + this.quantitaDataCalcolate = quantitaDataCalcolate; + } + + public void setQuantitaData(double quantitaData) { + this.quantitaData = quantitaData; + } + + public long getFlgArticoloComponente() { + return this.flgArticoloComponente; + } + + public void setFlgArticoloComponente(long flgComponente) { + this.flgArticoloComponente = flgComponente; + } + + public Vectumerator findArticoliVarianti(long flgDisponibili, long flgNascondi) { + return new ArticoloVariante(getApFull()).findById_articolo(getId_articolo(), 0, 0, flgDisponibili, flgNascondi); + } + + public String getImgFileName(int imgNumber) { + return getImgFileName(imgNumber, getImgTmst()); + } + + public String getDescrizioneNomeUrl() { + if (!getNomeSeo().isEmpty()) + return getNomeSeo().trim(); + String temp = DBAdapter.eliminaDoppioniTokenInStringa(getMarca().getDescrizione() + " " + getMarca().getDescrizione(), " "); + return temp.trim(); + } + + public String getDescrizioneNomeCodiceUrl() { + String temp = convertStringToLink((getNome() + " " + getNome()).trim()); + return temp; + } + + public Vectumerator findByCRSerMovimentoOLDCONTABELLAMOVIMENTO(ArticoloCR CR, int pageNumber, int pageRows) { + try { + Vectumerator vec = new Vectumerator(); + String sql = "SELECT M.id_articolo as id_artmov, A.id_articolo, 0 as id_articoloTaglia, M.id_articoloVariante,M.id_clifor, M.seriale, SUM(kg) as kg, SUM(mt) as mt, SUM(nr) as nr, A.nome,A.id_marca,A.id_tipo,A.percSconto,A.id_iva,A.prezzoOfferta,A.prezzoPubblico,A.flgSerialiMassivi FROM MOVIMENTO AS M INNER JOIN ARTICOLO AS A ON A.id_articolo=M.id_articolo "; + String s_Sql_GrouBy = " group by M.id_articolo, M.id_clifor, M.seriale "; + String s_Sql_Having = " HAVING ( nr>0 and A.id_articolo>0 and M.seriale is not null) "; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + token = prepareInputMySqlString(token, false); + token = token.replace("*", "%"); + txt.append("(A.codice like '%" + token + "%' or A.nome like '%" + token + "%' or M.seriale = '" + token + "'or A.codiciAlternativi like '%," + token + ",%' )"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (isDeleteLogic()) + if (CR.getFlgShowDeleteLogic() == 0L) { + wc.addWc("A.dataFineVld is null"); + } else { + wc.addWc("A.dataFineVld is not null"); + } + if (CR.getId_clifor() != 0L && CR.getMagFisico().getFlgTipo() != 1L) { + wc.addWc("(M.id_clifor=" + CR.getId_clifor() + ")"); + } else { + wc.addWc("(M.id_clifor=0 or M.id_clifor is null )"); + } + wc.addWc(" M.id_magFisico=" + CR.getId_magFisico()); + String s_Sql_Find1 = "select 0 as id_artmov, A.id_articolo, C.id_articoloTaglia, B.id_articoloVariante,0 as id_clifor,null as seriale,0 as kg, 0 as mt, 0 as nr, A.nome,A.id_marca,A.id_tipo,A.percSconto,A.id_iva,A.prezzoOfferta,A.prezzoPubblico,A.flgSerialiMassivi from ARTICOLO AS A inner join TIPO as T on A.id_tipo=T.id_tipo left JOIN ARTICOLO_VARIANTE AS B ON A.id_articolo = B.id_articolo LEFT JOIN ARTICOLO_TAGLIA as C on A.id_articolo=C.id_articolo and B.id_articoloVariante=C.id_articoloVariante"; + String s_Sql_Order = " "; + WcString wc1 = new WcString(); + wc1.addWc("T.flgTipoMagazzino!=2"); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + token = prepareInputMySqlString(token, false); + token = token.replace("*", "%"); + txt.append("(A.codice like '%" + token + "%' or A.nome like '%" + token + "%' or C.codiceAT = '" + token + "'or A.codiciAlternativi like '%," + token + ",%' or B.nomeV like '%" + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc1.addWc(txt.toString()); + } + if (isDeleteLogic()) + if (CR.getFlgShowDeleteLogic() == 0L) { + wc1.addWc("A.dataFineVld is null"); + } else { + wc1.addWc("A.dataFineVld is not null"); + } + wc1.addWc(" (A.flgDispo > 0 OR B.flgDispo > 0 OR C.flgDispo > 0) "); + PreparedStatement stmt = getConn().prepareStatement("(" + sql + wc.toString() + s_Sql_GrouBy + s_Sql_Having + ") union (" + s_Sql_Find1 + + wc1.toString() + s_Sql_Order + ")"); + return findRows(stmt, pageNumber, 50); + } catch (SQLException e) { + handleDebug(e); + e.printStackTrace(); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByCR(ArticoloCR CR, int pageNumber, int pageRows) { + String s_Sql_Order; + if (CR.getFlgTipoRicerca() == 1L) + return findByCRSerMagazzino(CR, pageNumber, pageRows); + if (CR.getFlgTipoRicerca() == 2L) + return findByCRAv(CR, pageNumber, pageRows); + if (CR.getFlgTipoRicerca() == 10L) + return findWebByArticoloCR(CR, pageNumber, pageRows); + if (CR.getFlgTipoRicerca() == 11L) + return findWebByArticoloVarianteCR(CR, pageNumber, pageRows); + if (CR.getDataMovimento() != null) + return findByCRMovimento(CR, pageNumber, pageRows); + boolean flgOttimizzo = true; + if (pageNumber == 0 && pageRows == 0) + flgOttimizzo = false; + StringBuffer s_Sql_Find = new StringBuffer("select A.* from ARTICOLO AS A "); + if (CR.getFlgOrderBy() == 99L) { + s_Sql_Order = " order by rand()"; + } else { + String orderBy = " order by "; + if (CR.getFlgOrdinaWww() == 1L) + orderBy = orderBy + "A.ordine desc, "; + s_Sql_Order = orderBy + "A.nome"; + if (!CR.getFlgReport().isEmpty()) { + s_Sql_Order = orderBy + "C.descrizioneCompleta,C.descrizione, A.nome"; + } else if (CR.getFlgOrderBy() == 0L) { + s_Sql_Order = orderBy + "A.nome " + orderBy; + } else if (CR.getFlgOrderBy() == 1L) { + s_Sql_Order = orderBy + "M.descrizione " + orderBy + ", A.codice, A.nome " + CR.getFlgOrderType(); + } else if (CR.getFlgOrderBy() == 2L) { + s_Sql_Order = orderBy + "C.descrizioneR , A.nome "; + } else if (CR.getFlgOrderBy() == 3L) { + s_Sql_Order = orderBy + "C.descrizioneR desc , A.nome desc"; + } else if (CR.getFlgOrderBy() == 4L) { + s_Sql_Order = orderBy + "A.prezzoPubblico , C.descrizione , A.nome"; + } else if (CR.getFlgOrderBy() == 5L) { + s_Sql_Order = orderBy + " A.prezzoPubblico desc , C.descrizione ,A.nome"; + } else if (CR.getFlgOrderBy() == 7L) { + s_Sql_Order = orderBy + "A.quantita desc, C.descrizioneR , A.nome "; + } else if (CR.getFlgOrderBy() == 8L) { + s_Sql_Order = orderBy + " A.tmstLastImpression desc, A.impression desc, A.nome asc "; + } else if (CR.getFlgOrderBy() == 9L) { + s_Sql_Order = orderBy + " A.impression desc, A.nome asc "; + } else if (CR.getFlgOrderBy() == 10L) { + s_Sql_Order = orderBy + " A.quantita desc "; + } + } + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt; + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + } else { + if (pageNumber == 0) + pageNumber = 1; + int start = (pageNumber - 1) * pageRows; + int stop = start + pageRows; + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + " limit " + s_Sql_Order + "," + start); + } + findByCRCreateStmtDate(CR, stmt); + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + Vectumerator vectumerator = findRows(stmt, pageNumber, pageRows); + if (!CR.getFlgReport().isEmpty()); + return vectumerator; + } + Vectumerator vec = findRows(stmt, 1, pageRows); + vec.setPageNumber(pageNumber); + vec.setTotNumberOfRecords(findByCRTotRecord(CR)); + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByCRSerMovimento(ArticoloCR CR, int pageNumber, int pageRows) { + try { + Vectumerator vec = new Vectumerator(); + String sql = "SELECT M.id_articolo as id_artmov, A.id_articolo, 0 as id_articoloTaglia, M.id_articoloVariante,M.id_clifor, M.seriale, SUM(kg) as kg, SUM(mt) as mt, SUM(nr) as nr, A.nome,A.id_marca,A.id_tipo,A.percSconto,A.id_iva,A.prezzoOfferta,A.prezzoPubblico,A.flgSerialiMassivi FROM MOVIMENTO AS M INNER JOIN ARTICOLO AS A ON A.id_articolo=M.id_articolo "; + String s_Sql_GrouBy = " group by M.id_articolo, M.id_clifor, M.seriale "; + String s_Sql_Having = " HAVING ( nr>0 and A.id_articolo>0 and M.seriale is not null) "; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + token = prepareInputMySqlString(token, false); + token = token.replace("*", "%"); + txt.append("(A.codice like '%" + token + "%' or A.nome like '%" + token + "%' or M.seriale = '" + token + "'or A.codiciAlternativi like '%," + token + ",%' )"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (isDeleteLogic()) + if (CR.getFlgShowDeleteLogic() == 0L) { + wc.addWc("A.dataFineVld is null"); + } else { + wc.addWc("A.dataFineVld is not null"); + } + if (CR.getId_clifor() != 0L && CR.getMagFisico().getFlgTipo() != 1L) { + wc.addWc("(M.id_clifor=" + CR.getId_clifor() + ")"); + } else { + wc.addWc("(M.id_clifor=0 or M.id_clifor is null )"); + } + wc.addWc(" M.id_magFisico=" + CR.getId_magFisico()); + String s_Sql_Find1 = "select 0 as id_artmov, A.id_articolo, C.id_articoloTaglia, B.id_articoloVariante,0 as id_clifor,null as seriale,0 as kg, 0 as mt, 0 as nr, A.nome,A.id_marca,A.id_tipo,A.percSconto,A.id_iva,A.prezzoOfferta,A.prezzoPubblico,A.flgSerialiMassivi from ARTICOLO AS A inner join TIPO as T on A.id_tipo=T.id_tipo left JOIN ARTICOLO_VARIANTE AS B ON A.id_articolo = B.id_articolo LEFT JOIN ARTICOLO_TAGLIA as C on A.id_articolo=C.id_articolo and B.id_articoloVariante=C.id_articoloVariante"; + String s_Sql_Order = " "; + WcString wc1 = new WcString(); + wc1.addWc("T.flgTipoMagazzino!=2"); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + token = prepareInputMySqlString(token, false); + token = token.replace("*", "%"); + txt.append("(A.codice like '%" + token + "%' or A.nome like '%" + token + "%' or C.codiceAT = '" + token + "'or A.codiciAlternativi like '%," + token + ",%' or B.nomeV like '%" + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc1.addWc(txt.toString()); + } + if (isDeleteLogic()) + if (CR.getFlgShowDeleteLogic() == 0L) { + wc1.addWc("A.dataFineVld is null"); + } else { + wc1.addWc("A.dataFineVld is not null"); + } + wc1.addWc(" (A.flgDispo > 0 OR B.flgDispo > 0 OR C.flgDispo > 0) "); + PreparedStatement stmt = getConn().prepareStatement("(" + sql + wc.toString() + s_Sql_GrouBy + s_Sql_Having + ") union (" + s_Sql_Find1 + + wc1.toString() + s_Sql_Order + ")"); + return findRows(stmt, pageNumber, 50); + } catch (SQLException e) { + handleDebug(e); + e.printStackTrace(); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByCRMovimento(ArticoloCR CR, int pageNumber, int pageRows) { + boolean flgOttimizzo = false; + if (pageNumber == 0 && pageRows == 0) + flgOttimizzo = false; + StringBuffer s_Sql_Find = new StringBuffer("SELECT A.* , SUM(M.kg) as kg, SUM(M.mt) as mt, SUM(M.nr) as nr FROM MOVIMENTO AS M INNER JOIN ARTICOLO AS A ON A.id_articolo=M.id_articolo "); + String s_Sql_GrouBy = " group by M.id_articolo"; + WcString s_sql_havinng = new WcString(); + String s_Sql_Order = " order by A.nome"; + if (!CR.getFlgReport().isEmpty()) { + s_Sql_Order = " order by C.descrizioneCompleta,C.descrizione, A.nome"; + } else if (CR.getFlgOrderBy() == 0L) { + s_Sql_Order = " order by A.nome " + CR.getFlgOrderType(); + } else if (CR.getFlgOrderBy() == 1L) { + s_Sql_Order = " order by M.descrizione " + CR.getFlgOrderType() + ", A.codice, A.nome " + CR.getFlgOrderType(); + } else if (CR.getFlgOrderBy() == 2L) { + s_Sql_Order = " order by C.descrizione , A.nome "; + } else if (CR.getFlgOrderBy() == 3L) { + s_Sql_Order = " order by C.descrizione desc , A.nome desc"; + } else if (CR.getFlgOrderBy() == 4L) { + s_Sql_Order = " order by A.prezzoPubblico , C.descrizione , A.nome"; + } else if (CR.getFlgOrderBy() == 5L) { + s_Sql_Order = " order by A.prezzoPubblico desc , C.descrizione ,A.nome"; + } + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + if (CR.getDataMovimento() != null) { + s_Sql_Find.append(" inner join RIGA_DOCUMENTO AS RD ON M.id_rigaDocumento=RD.id_rigaDocumento inner join DOCUMENTO as DOC on RD.id_documento=DOC.id_documento"); + wc.addWc("DOC.dataDocumento<=?"); + } + if (CR.getFlgQta() == 1L) + if (CR.getQtaDa() == 0L) { + s_sql_havinng.addHavingWc("nr<=" + CR.getQtaA()); + } else { + s_sql_havinng.addHavingWc("nr<=" + CR.getQtaA()); + s_sql_havinng.addHavingWc("nr>=" + CR.getQtaDa()); + } + try { + PreparedStatement stmt; + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_GrouBy + s_sql_havinng.toString()); + } else { + if (pageNumber == 0) + pageNumber = 1; + int start = (pageNumber - 1) * pageRows; + int stop = start + pageRows; + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_GrouBy + s_sql_havinng.toString() + " limit " + s_Sql_Order + "," + start); + } + findByCRCreateStmtDate(CR, stmt); + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + Vectumerator vectumerator = findRows(stmt, pageNumber, pageRows); + if (!CR.getFlgReport().isEmpty()); + return vectumerator; + } + Vectumerator vec = findRows(stmt, 1, pageRows); + vec.setPageNumber(pageNumber); + vec.setTotNumberOfRecords(findByCRTotRecord(CR)); + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getPrezzoBaseIvaConAbbuono() { + return getListinoArticoloBase().getPrezzoIvaAbbuonoLA(); + } + + public int addLabelUnArticoloA4Pdf(String titolo, int nRow, long numberOflabel, String l_descrizione, long l_id_articoloVariante) { + long pHMarg = 2L; + long l_indent = 4L; + long totLen = 40L; + String l_descrizioneTipo = ""; + float labelHeight = (PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow; + if (getFlgStampaEtichetteT() == 1L) { + int totNumbOflabel = 0; + try { + int altezzaCod = 50; + int larghezzaCod = 120; + PdfContentByte cb = this.writer.getDirectContent(); + Barcode128 codeBar = new Barcode128(); + codeBar.setCodeType(9); + if (getFlgUsaVarianti() == 0L || (getFlgUsaVarianti() == -1L && getTipo().getFlgUsaVarianti() == 0L)) { + if (l_descrizione == null || l_descrizione.isEmpty()) + l_descrizione = getDescrizioneCompleta().replace("€", "€"); + l_descrizioneTipo = getTipo().getDescrizioneCompletaLabel().toLowerCase(); + for (int i = 0; (long)i < numberOflabel; i++) { + totNumbOflabel++; + PdfPCell cell = new PdfPCell(); + cell.setBorder(0); + codeBar.setCode(getCodice()); + Image imgBarcode = codeBar.createImageWithBarcode(cb, null, null); + imgBarcode.scaleToFit((float)larghezzaCod, (float)altezzaCod); + cell.addElement(new Chunk(imgBarcode, 10.0F, (float)(-altezzaCod + 15))); + if ((long)l_descrizione.length() < totLen) { + cell.addElement(new Chunk("\n\n\n" + spaceLeft("", (int)(totLen - (long)l_descrizione.length())) + l_descrizione, PdfFontFactory.PDF_fPiccolissimo)); + } else { + cell.addElement(new Chunk("\n\n\n" + l_descrizione, PdfFontFactory.PDF_fPiccolissimo)); + } + if ((long)l_descrizioneTipo.length() < totLen) { + cell.addElement(new Chunk(spaceLeft("", (int)(totLen - (long)l_descrizioneTipo.length())) + spaceLeft("", (int)(totLen - (long)l_descrizioneTipo.length())), PdfFontFactory.PDF_fPiccolissimo)); + } else { + cell.addElement(new Chunk(l_descrizioneTipo, PdfFontFactory.PDF_fPiccolissimo)); + } + cell.setVerticalAlignment(4); + cell.setFixedHeight(labelHeight); + cell.setIndent((float)l_indent); + this.pdfPcorpo.addCell(cell); + } + } else { + Vectumerator varianti = findArticoliVarianti(-1L, -1L); + while (varianti.hasMoreElements()) { + ArticoloVariante rowAv = (ArticoloVariante)varianti.nextElement(); + if (l_id_articoloVariante == 0L || rowAv.getId_articoloVariante() == l_id_articoloVariante) { + l_descrizione = rowAv.getDescrizioneCompletaSenzaCodice(); + l_descrizioneTipo = rowAv.getArticolo().getTipo().getDescrizioneCompletaLabel().toLowerCase(); + for (int i = 0; (long)i < numberOflabel; i++) { + totNumbOflabel++; + PdfPCell cell = new PdfPCell(); + cell.setVerticalAlignment(4); + cell.setFixedHeight(labelHeight); + cell.setBorder(0); + codeBar.setCode(rowAv.getCodiceVariante()); + Image imgBarcode = codeBar.createImageWithBarcode(cb, null, null); + imgBarcode.scaleToFit((float)larghezzaCod, (float)altezzaCod); + cell.addElement(new Chunk(imgBarcode, 10.0F, (float)(-altezzaCod + 15))); + if ((long)l_descrizione.length() < totLen) { + cell.addElement(new Chunk("\n\n\n" + + spaceLeft("", (int)(totLen - (long)l_descrizione.length())) + l_descrizione, PdfFontFactory.PDF_fPiccolissimo)); + } else { + cell.addElement(new Chunk("\n\n\n" + l_descrizione, PdfFontFactory.PDF_fPiccolissimo)); + } + if ((long)l_descrizioneTipo.length() < totLen) { + cell.addElement(new Chunk( + spaceLeft("", (int)(totLen - (long)l_descrizioneTipo.length())) + spaceLeft("", (int)(totLen - (long)l_descrizioneTipo.length())), PdfFontFactory.PDF_fPiccolissimo)); + } else { + cell.addElement(new Chunk(l_descrizioneTipo, PdfFontFactory.PDF_fPiccolissimo)); + } + cell.setIndent((float)l_indent); + this.pdfPcorpo.addCell(cell); + } + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return totNumbOflabel; + } + return 0; + } + + public String getDescrizioneCompleta(String lang) { + if (lang == null || lang.isEmpty()) + lang = "it"; + StringBuilder sb = new StringBuilder(); + if (getParm("DOC_ARTICOLI_CON_CODICE").isTrue()) { + if (getId_articoloVariante() == 0L) { + sb.append(getCodice() + " " + getCodice()); + } else { + sb.append(getArticoloVariante().getCodiceVariante() + " " + getArticoloVariante().getCodiceVariante()); + } + } else { + sb.append(getDescrizioneCompletaSenzaCodice(lang)); + } + if (getParm("DOC_ARTICOLI_CON_TIPO").isTrue() && getTipo() != null) { + sb.append(" "); + sb.append(getTipo().getDescrizione()); + } + return sb.toString(); + } + + public long getId_tipo2() { + return this.id_tipo2; + } + + public void setId_tipo2(long id_tipo2) { + this.id_tipo2 = id_tipo2; + setTipo2(null); + } + + public Tipo getTipo2() { + this.tipo2 = (Tipo)getSecondaryObject(this.tipo2, Tipo.class, getId_tipo2()); + return this.tipo2; + } + + public void setTipo2(Tipo tipo2) { + this.tipo2 = tipo2; + } + + public ByteArrayOutputStream creaCatalogoPdf(ArticoloCR CR) { + boolean debug = false; + String debugInfo = "Articolo.creaCatalogoPdf "; + NumberFormat nf3 = NumberFormat.getInstance(); + float[] colWidthsRighe4 = { 25.0F, 25.0F, 25.0F, 25.0F }; + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf0 = NumberFormat.getInstance(); + nf0.setMaximumFractionDigits(0); + nf0.setMinimumFractionDigits(0); + boolean noImg = false; + int scaledImgWidth = (int)CR.getRisoluzioneImmaginiCatalogo(); + int scaledImgFit = 82; + int imagePosY = -66; + String crImgDesc = "\n\n\n\n"; + int colspanDesc = 15, colspanImmagini = 25; + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + String titoloReport = ""; + try { + String imgTmpPdfTargetDir = getDocBase() + getDocBase() + "_pdf/"; + if (!new File(imgTmpPdfTargetDir).exists()) + new File(imgTmpPdfTargetDir).mkdirs(); + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 10.0F, 10.0F); + titoloReport = "Catalogo Prodotti"; + SimpleDateFormat tf = new SimpleDateFormat("HH:mm:ss"); + Date today = getToday(); + titoloReport = titoloReport + ". Stampato il " + titoloReport + " " + getDataFormat().format(today); + this.writer = PdfWriter.getInstance(this.document, ba); + Phrase pH = new Phrase(titoloReport + " - Pag. n. "); + HeaderFooter header = new HeaderFooter(pH, true); + header.setAlignment(2); + header.setBorder(0); + this.document.setHeader(header); + this.document.open(); + creaIntestazioneReportPdfPTable(titoloReport, CR.getDescrizioneCR()); + int colDescArticolo = 30, colDescArticoloConVarianti = 40; + CR.setFlgOrderBy(2L); + Vectumerator vec = findByCR(CR, 0, 0); + long currentTipo = -1L; + while (vec.hasMoreElements()) { + String imgFileNameScaledPdf; + Articolo rowArticolo = (Articolo)vec.nextElement(); + if (debug) + System.out.println(debugInfo + debugInfo + " " + rowArticolo.getNome()); + if (currentTipo != rowArticolo.getId_tipo()) { + PdfPCell pdfPCell = new PdfPCell(); + pdfPCell.addElement(new Chunk(rowArticolo.getTipo().getDescrizioneRPdf(), PdfFontFactory.PDF_fGrandeB)); + pdfPCell.setVerticalAlignment(4); + pdfPCell.setHorizontalAlignment(0); + pdfPCell.setBackgroundColor(Color.lightGray); + pdfPCell.setBorderColor(Color.GRAY); + pdfPCell.setColspan(colDescArticoloConVarianti); + this.pdfPcorpo.addCell(pdfPCell); + currentTipo = rowArticolo.getId_tipo(); + } + if (rowArticolo.getFlgUsaVarianti() == 1L) { + PdfPCell pdfPCell = new PdfPCell(); + Paragraph paragraph = new Paragraph(); + paragraph.add(new Chunk(rowArticolo.getNome(), PdfFontFactory.PDF_fGrandeB)); + paragraph.add(new Chunk(" - ", PdfFontFactory.PDF_fGrandeB)); + paragraph.add(new Chunk(rowArticolo.getCodice(), PdfFontFactory.PDF_fGrandeB)); + paragraph.add(new Chunk("\n" + rowArticolo.getDescrizione(), PdfFontFactory.PDF_fMedio)); + pdfPCell.addElement((Element)paragraph); + pdfPCell.setVerticalAlignment(4); + pdfPCell.setHorizontalAlignment(0); + pdfPCell.setBorderColor(Color.GRAY); + pdfPCell.setColspan(colspanDesc); + this.pdfPcorpo.addCell(pdfPCell); + pdfPCell = new PdfPCell(); + ArticoloVarianteCR CRAV = new ArticoloVarianteCR(getApFull()); + CRAV.setId_articolo(rowArticolo.getId_articolo()); + CRAV.setFlgDisponibile(CR.getFlgDisponibile()); + CRAV.setFlgEscludiWeb(CR.getFlgEscludiWeb()); + CRAV.setFlgNascondi(CR.getFlgNascondi()); + Vectumerator vecV = rowArticolo.findArticoliVarianti(-1L, 0L); + PdfPTable pdfPTable = new PdfPTable(4); + pdfPTable.setWidthPercentage(100.0F); + pdfPTable.setWidths(colWidthsRighe4); + int i = 0; + while (vecV.hasMoreElements()) { + ArticoloVariante rowAV = (ArticoloVariante)vecV.nextElement(); + if (debug) + System.out.println(debugInfo + debugInfo + " " + + rowAV.getNomeV() + " " + rowAV.getCodiceVariante()); + if (CR.getFlgQta() == 0L || (CR.getFlgQta() > 0L && rowAV.getQuantitaAv() >= (double)CR.getQtaDa() && + rowAV.getQuantitaAv() <= (double)CR.getQtaA())) { + String str1 = rowAV.getImgFileName(6); + String str2 = getDocBase() + getDocBase() + "_var/" + getPathImg(); + try { + String str; + if (!new File(str2).exists()) { + str1 = rowAV.getImgFileName(1); + str2 = getDocBase() + getDocBase() + "_var/" + getPathImg(); + if (!new File(str2).exists()) { + str1 = "images/no-img.jpg"; + str2 = getDocBase() + getDocBase(); + noImg = true; + } else { + noImg = false; + } + } + if (noImg) { + str = imgTmpPdfTargetDir + imgTmpPdfTargetDir; + } else if (scaledImgWidth == 0) { + str = str2; + } else { + str = imgTmpPdfTargetDir + imgTmpPdfTargetDir; + if (!new File(str).exists()) + ScaleImage.scaleImageToFile(str2, str, getPathTmpFull(), scaledImgWidth, 72); + } + if (!new File(str).exists()) { + System.out.println(debugInfo + " ATTENZIONE! Non sono riuscito a gestire l'immagine " + debugInfo + " " + rowAV.getNomeV() + " " + + rowAV.getCodiceVariante() + " oppure " + rowAV.getImgFileName(6)); + str1 = "images/no-img.jpg"; + str = getDocBase() + getDocBase(); + } + Image imgVariante = Image.getInstance(str); + imgVariante.scaleToFit((float)scaledImgFit, 100.0F); + imgVariante.setAlignment(5); + PdfPCell pdfPCell1 = new PdfPCell(); + pdfPCell1.addElement(new Chunk(imgVariante, 2.0F, (float)imagePosY)); + pdfPCell1.addElement(new Chunk(crImgDesc + crImgDesc + " " + rowAV.getNomeV(), PdfFontFactory.PDF_fMedio)); + pdfPCell1.setVerticalAlignment(4); + pdfPCell1.setHorizontalAlignment(0); + pdfPCell1.setBackgroundColor(Color.white); + pdfPCell1.setBorderColor(Color.white); + pdfPCell1.setColspan(1); + i++; + pdfPTable.addCell(pdfPCell1); + } catch (Exception e) { + e.printStackTrace(); + str1 = "images/no-img.jpg"; + String str = getDocBase() + getDocBase(); + Image imgVariante = Image.getInstance(str); + imgVariante.scaleToFit((float)scaledImgFit, 100.0F); + imgVariante.setAlignment(5); + PdfPCell pdfPCell1 = new PdfPCell(); + pdfPCell1.addElement(new Chunk(imgVariante, 2.0F, (float)imagePosY)); + pdfPCell1.addElement(new Chunk(crImgDesc + crImgDesc + " " + rowAV.getNomeV(), PdfFontFactory.PDF_fMedio)); + pdfPCell1.setVerticalAlignment(4); + pdfPCell1.setHorizontalAlignment(0); + pdfPCell1.setBackgroundColor(Color.white); + pdfPCell1.setBorderColor(Color.white); + pdfPCell1.setColspan(1); + i++; + } + } + } + if (i % 4 > 0) { + PdfPCell pdfPCell1 = new PdfPCell(); + pdfPCell1.setBorderColor(Color.white); + for (int j = 0; j < 4 - i % 4; j++) + pdfPTable.addCell(pdfPCell1); + } + pdfPCell.addElement((Element)pdfPTable); + pdfPCell.setVerticalAlignment(4); + pdfPCell.setHorizontalAlignment(0); + pdfPCell.setBorderColor(Color.GRAY); + pdfPCell.setColspan(colspanImmagini); + this.pdfPcorpo.addCell(pdfPCell); + continue; + } + PdfPCell cell = new PdfPCell(); + Paragraph p = new Paragraph(); + p.add(new Chunk(rowArticolo.getNome(), PdfFontFactory.PDF_fGrandeB)); + p.add(new Chunk(" - ", PdfFontFactory.PDF_fGrandeB)); + p.add(new Chunk(rowArticolo.getCodice(), PdfFontFactory.PDF_fGrandeB)); + p.add(new Chunk("\n" + rowArticolo.getDescrizione(), PdfFontFactory.PDF_fMedio)); + p.add(new Chunk("\nPrezzo: € ", PdfFontFactory.PDF_fMedio)); + p.add(new Chunk(getNf().format(rowArticolo.getPrezzoPubblico()), PdfFontFactory.PDF_fMedio)); + cell.addElement((Element)p); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBorderColor(Color.GRAY); + cell.setColspan(colspanDesc); + this.pdfPcorpo.addCell(cell); + cell = new PdfPCell(); + PdfPTable corpoImmagini = new PdfPTable(4); + corpoImmagini.setWidthPercentage(100.0F); + corpoImmagini.setWidths(colWidthsRighe4); + int numCell = 0; + String imageName = rowArticolo.getImgFileName(6); + String imageFileName = getDocBase() + getDocBase() + getPathImg(); + if (!new File(imageFileName).exists()) { + imageName = rowArticolo.getImgFileName(1); + imageFileName = getDocBase() + getDocBase() + getPathImg(); + if (!new File(imageFileName).exists()) { + imageName = "images/no-img.jpg"; + imageFileName = getDocBase() + getDocBase(); + noImg = true; + } else { + noImg = false; + } + } + if (noImg) { + imgFileNameScaledPdf = imgTmpPdfTargetDir + imgTmpPdfTargetDir; + } else if (scaledImgWidth == 0) { + imgFileNameScaledPdf = imageFileName; + } else { + imgFileNameScaledPdf = imgTmpPdfTargetDir + imgTmpPdfTargetDir; + if (!new File(imgFileNameScaledPdf).exists()) + ScaleImage.scaleImageToFile(imageFileName, imgFileNameScaledPdf, getPathTmpFull(), scaledImgWidth, 72); + } + Image imgArticolo = Image.getInstance(imgFileNameScaledPdf); + imgArticolo.scaleToFit((float)scaledImgFit, 100.0F); + imgArticolo.setAlignment(5); + PdfPCell cellImg = new PdfPCell(); + cellImg.addElement(new Chunk(imgArticolo, 2.0F, (float)imagePosY)); + cellImg.addElement(new Chunk(crImgDesc + crImgDesc + " " + + rowArticolo.getNome(), PdfFontFactory.PDF_fMedio)); + cellImg.setVerticalAlignment(4); + cellImg.setHorizontalAlignment(0); + cellImg.setBackgroundColor(Color.white); + cellImg.setBorderColor(Color.white); + cellImg.setColspan(1); + numCell++; + corpoImmagini.addCell(cellImg); + if (numCell % 4 > 0) { + cellImg = new PdfPCell(); + cellImg.setBorderColor(Color.white); + for (int i = 0; i < 4 - numCell % 4; i++) + corpoImmagini.addCell(cellImg); + } + cell.addElement((Element)corpoImmagini); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBorderColor(Color.gray); + cell.setColspan(colspanImmagini); + this.pdfPcorpo.addCell(cell); + } + this.document.add((Element)this.pdfPcorpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public double getQuantitaAjst() { + if (getId_articoloTaglia() > 0L) + return getArticoloTaglia().getQuantitaAt(); + if (getId_articoloVariante() > 0L) + return getArticoloVariante().getQuantitaAv(); + return getQuantita(); + } + + public String getQuantitaMagazzinoMovimentoHtmlAjst() { + if (getId_articoloTaglia() > 0L) + return getArticoloTaglia().getQuantitaMagazzinoMovimentoHtml(); + if (getId_articoloVariante() > 0L) + return getArticoloVariante().getQuantitaMagazzinoMovimentoHtml(); + return getQuantitaMagazzinoMovimentoHtml(); + } + + public double getVolumeM3() { + return this.volumeM3; + } + + public void setVolumeM3(double volumeM3) { + this.volumeM3 = volumeM3; + } + + public ResParm addArticoloUsato(ArticoloUsato row) { + ResParm rp = new ResParm(true); + ArticoloUsato bean = new ArticoloUsato(getApFull()); + bean.setId_articolo(getId_articolo()); + bean.setFlgTipoDocumento(1L); + bean.setId_fornitore(row.getId_fornitore()); + bean.setDataDocumento(row.getDataDocumento()); + bean.setNumeroDocumento(row.getNumeroDocumento()); + rp = bean.save(); + if (rp.getStatus()) { + bean.getArticolo().setQuantita(1.0D); + handleQuantitaDebugBeforeSave("addArticoloUsato"); + rp = bean.getArticolo().superSave(); + } + return rp; + } + + public ResParm retrieveEbayItemId() { + ResParm rp = new ResParm(true); + if (getId_articolo() == 0L) { + rp.setStatus(false); + rp.setMsg("Articolo nullo"); + } else { + EbayAbliaApi eaa = new EbayAbliaApi(this.apFull); + if (eaa.isTokenValid()) { + EbayResult res = eaa.getSdkEbayItemIdBySku(getCodice()); + if (res.isOk()) { + setEbayItemId((String)res.getResult()); + rp = superSave(); + } else { + rp.setStatus(false); + rp.setMsg("Errore! " + res.getMsg()); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! Token ebay non valido o scaduto!"); + } + } + return rp; + } + + public void handleQuantitaDebugBeforeSave(String methodName) { + boolean debug = false; + if (getParm("USA_MAGAZZINO").isTrue() && + debug) + if (getQuantitaDB() != this.quantita) { + StringBuilder sb = new StringBuilder(); + sb.append(">>>>>>>>>>>>>>>>>>>>>>\n"); + sb.append("it.acxent.art.Articolo DEBUG QUANTITA'"); + sb.append("."); + sb.append(methodName); + sb.append("\nQuantita db: "); + sb.append(getQuantitaDB()); + sb.append("\nQuantita :"); + sb.append(getQuantita()); + sb.append("\n"); + sb.append(this.apFull.getReqUrl()); + sb.append("\n"); + java.util.Date d = new java.util.Date(System.currentTimeMillis()); + sb.append(d.toString()); + sb.append("\nip: "); + sb.append(this.apFull.getReqIpAddress()); + sb.append("\n"); + sb.append("\n<<<<<<<<<<<<"); + System.out.println(sb.toString()); + } + } + + public ResParm delProgettista(ArticoloProgettista row) { + ArticoloProgettista bean = new ArticoloProgettista(getApFull()); + bean.findByPrimaryKey(row.getId_articoloProgettista()); + return bean.delete(); + } + + public ResParm delArticoloUsato(ArticoloUsato row) { + ArticoloUsato bean = new ArticoloUsato(getApFull()); + bean.findByPrimaryKey(row.getId_articoloUsato()); + return bean.delete(); + } + + public String getNome(String lang) { + if (lang == null || lang.isEmpty()) + lang = "it"; + String temp = getDescTxtLang("nomeL", lang); + if (temp.isEmpty()) + return getNome(); + return temp; + } + + public String getDescrizioneCompleta() { + if (getParm("DOC_ARTICOLI_CON_CODICE").isTrue()) { + if (getId_articoloVariante() == 0L) + return getCodice() + " " + getCodice(); + return getArticoloVariante().getCodiceVariante() + " " + getArticoloVariante().getCodiceVariante(); + } + return getDescrizioneCompletaSenzaCodice(); + } + + public String getDescrizioneCompletaSenzaCodice() { + return getDescrizioneCompletaSenzaCodice(null); + } + + public String getHtmlTableDispoMagInterni() { + MagFisico mf = new MagFisico(getApFull()); + RigaDocumento rd = new RigaDocumento(getApFull()); + Vectumerator vec = mf.findByTipo(1L); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + MagFisico row = (MagFisico)vec.nextElement(); + sb.append("
"); + rd.findMagDisponibilitaPuntuale(getId_articolo(), 0L, 0L, null, row.getId_magFisico(), 0L, 0L); + sb.append(getNf().format(rd.getQuantita())); + sb.append(""; + String TDAP_WARN = ""; + String TDAP_bold = ""; + String TDAP_CENTER = ""; + String TDCH = "
"); + sb.append(row.getCodice()); + sb.append("
"); + sb.append(row.getCodice()); + sb.append(""); + sb.append("
"); + if (row.getFlgAmazon() == 1L) { + sb.append("V"); + } else { + sb.append(" "); + } + sb.append("
" + row.getLinkAmazon()); + sb.append("
"); + if (row.getFlgGoogle() == 1L) { + sb.append("V"); + if (!row.getGoogleFeedFileName().isEmpty()) { + sb.append(" "); + sb.append(row.getGoogleFeedFileName()); + } + } else { + sb.append(" "); + } + sb.append(""); + sb.append(row.getCodiciAlternativiLink()); + sb.append(" "); + sb.append(row.getCodiceEan()); + sb.append(""); + sb.append(row.getTipo().getDescrizioneCompleta() + " - " + row.getTipo().getDescrizioneCompleta()); + sb.append("
-----------------------
"); + sb.append(row.getDescAmz()); + sb.append("
"); + sb.append(nf.format(row.getPrezzoPubblicoIva())); + sb.append(""); + sb.append(row.getAmzPrezziDescInline()); + sb.append(""); + sb.append(nf.format(row.getStreetPriceIva())); + sb.append(""); + sb.append(nf.format(row.getRicaricoEffettivoDaCostoNetto())); + sb.append(""); + sb.append(nf.format(row.getQuantita())); + sb.append(""); + sb.append(nf.format(row.getQtaSuAmz())); + sb.append(""); + sb.append(row.getEscludiWeb()); + sb.append(""); + } else { + sb.append(""); + } + sb.append(notes); + sb.append("
"); + mm.setString("listaArticoli", sb.toString()); + String from = apFull.getParm("FROM").getTesto(); + MailProperties mp = new MailProperties(); + mp.setProperty("FROM", from); + mp.setProperty("TO", from); + mp.setProperty("SUBJECT", oggettoMessaggio); + System.out.println("sendArticoliCambiatiByEmail: from: " + from + " to " + from + " oggetto: " + oggettoMessaggio); + rp = mm.sendMailMessage(mp, true); + return rp; + } + + public final ResParm sendEbayUpdateResultByEmail(ApplParmFull apFull, Vectumerator vec, String msg) { + ResParm rp = new ResParm(); + String TDAP = ""; + String TDAP_bold = ""; + String TDAP_CENTER = ""; + String TDCH = ""; + String fileName = apFull.getParm("DOCBASE").getTesto() + "admin/art/_mailMessage/ebayUpdate.html"; + MailMessage mm = new MailMessage(apFull, fileName); + NumberFormat nf = apFull.getNf(); + Articolo articolo = new Articolo(apFull); + ArticoloCR CR = new ArticoloCR(); + StringBuilder sb = new StringBuilder(); + mm.setDate("data", DBAdapter.getToday()); + mm.setString("risultato", msg); + String oggettoMessaggio = "Ebay Update " + String.valueOf(DBAdapter.getToday()) + " " + String.valueOf(DBAdapter.getNow()); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + String notes = row.getBeanNotes() + "
" + row.getBeanNotes() + " q." + nf.format(row.getPrezzoArticoloEbayIva().getPrezzoFinale()) + "(" + + nf.format(row.getQtaSuEbay()) + ")"; + sb.append(""); + sb.append(""); + sb.append(row.getCodice()); + sb.append("
"); + sb.append(row.getCodice()); + sb.append(""); + sb.append(""); + sb.append(""); + if (row.getFlgSubito() == 1L) { + sb.append("V"); + } else { + sb.append(" "); + } + sb.append(""); + sb.append(""); + if (row.getFlgEbay() == 1L) { + sb.append("V"); + } else { + sb.append(" "); + } + if (!row.getEbayOfferId().isEmpty()) + sb.append("
" + row.getEbayOfferId()); + sb.append(""); + sb.append(""); + if (row.getFlgGoogle() == 1L) { + sb.append("V"); + if (!row.getGoogleFeedFileName().isEmpty()) { + sb.append(" "); + sb.append(row.getGoogleFeedFileName()); + } + } else { + sb.append(" "); + } + sb.append(""); + sb.append(""); + sb.append(row.getCodiciAlternativiLink()); + sb.append(" "); + sb.append(row.getCodiceEan()); + sb.append(""); + sb.append(""); + sb.append(row.getTipo().getDescrizioneCompleta() + " - " + row.getTipo().getDescrizioneCompleta()); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getPrezzoPubblicoIva())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getPrezzoArticoloEbayIva().getPrezzoFinale())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getStreetPriceIva())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getRicaricoEffettivoDaCostoNetto())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getQuantita())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getQtaSuEbay())); + sb.append(""); + sb.append(""); + sb.append(row.getEscludiWeb()); + sb.append(""); + sb.append(""); + sb.append(notes); + sb.append(""); + sb.append(""); + sb.append("\n"); + } + sb.append(""); + mm.setString("listaArticoli", sb.toString()); + String from = apFull.getParm("FROM").getTesto(); + MailProperties mp = new MailProperties(); + mp.setProperty("FROM", from); + mp.setProperty("TO", from); + mp.setProperty("SUBJECT", oggettoMessaggio); + System.out.println("sendArticoliCambiatiByEmail: from: " + from + " to " + from + " oggetto: " + oggettoMessaggio); + rp = mm.sendMailMessage(mp, true); + return rp; + } + + public static final ResParm updateArticoloNonTrovati(ApplParmFull apFull, String TAG_THREAD_MSG, long l_id_fornitore, HashSet hsMarche, HashSet hsTipi) { + boolean debug = false; + ResParm rp = new ResParm(); + StringBuilder err = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + int numRecordDaAggiornare = 0, numRecordAggiornati = 0; + StringBuilder codiciAggiornati = new StringBuilder("updateArticoloNonTrovati - Codici Aggiornati (debug)\n"); + StatusMsg.updateMsgByTag(apFull, TAG_THREAD_MSG, ": Aggiornamento articoli non trovati ......"); + if (l_id_fornitore == 0L || hsTipi.size() == 0) { + rp.setStatus(true); + rp.setMsg("Attenzione. Mancano dati di fornitore o tipi"); + } else { + long SOSPENDI_DOPO_N_VOLTE = apFull.getParm("CC_SOSPENDI_DOPO_N_GG_NO_IMPORT").getNumeroLong(); + ArticoloCR CR = new ArticoloCR(apFull); + Articolo bean = new Articolo(apFull); + CR.setFlgModImportazione(0L); + CR.setId_fornitore(l_id_fornitore); + StringBuilder sbMarche = new StringBuilder(), sbTipi = new StringBuilder(); + if (hsMarche.size() > 0) { + for (Long temp : hsMarche) { + sbMarche.append(String.valueOf(temp)); + sbMarche.append(","); + } + CR.setId_marche(sbMarche.substring(0, sbMarche.length() - 1)); + } + Vectumerator vec = bean.findByCR(CR, 0, 0); + if (vec.getTotNumberOfRecords() > 0) { + rp.setStatus(true); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (hsTipi.contains(Long.valueOf(row.getId_tipo()))) { + numRecordDaAggiornare++; + ArticoloFornitore af = new ArticoloFornitore(apFull); + af.findByFornitoreArticolo(l_id_fornitore, row.getId_articolo(), -1L); + if (af.getId_articoloFornitore() > 0L) { + if (af.getDispoTot() > 0L) { + af.setDispCash(0L); + af.setDispSede(0L); + rp = af.save(); + } + if (rp.getStatus()) { + rp = aggiornaDispoEPrezzoArticoloFornitore(row, 0L, 0L, false); + if (!rp.getStatus()) { + err.append(row.getCodice()); + err.append(" "); + err.append(row.getNome()); + err.append("; "); + err.append(rp.getMsg()); + err.append("\n"); + } else { + numRecordAggiornati++; + codiciAggiornati.append(row.getCodice()); + codiciAggiornati.append("\n"); + } + } else { + err.append(row.getCodice()); + err.append(" "); + err.append(row.getNome()); + err.append("; "); + err.append(rp.getMsg()); + err.append("\n"); + } + } + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + "/" + i); + StatusMsg.updateMsgByTag(apFull, TAG_THREAD_MSG, ": Aggiornamento articoli non trovati: " + i + "/" + + vec.getTotNumberOfRecords() + " - da aggiornare/aggiornati: " + numRecordDaAggiornare + "/" + numRecordAggiornati); + } + } + } + rp.setMsg(" da aggiornare/aggiornati: " + numRecordDaAggiornare + "/" + numRecordAggiornati); + if (err.length() > 0) { + rp.setStatus(false); + rp.appendMsg("\n" + err.toString()); + } else { + rp.setStatus(true); + } + if (debug) { + rp.appendMsg("\n"); + rp.appendMsg(codiciAggiornati.toString()); + } else { + rp.appendMsg("\n Per motivi di performance il dettaglio codici aggiornati è disabilitato in questa modalità."); + } + return rp; + } + + public long getQtaMaxAcquistoWww() { + return this.qtaMaxAcquistoWww; + } + + public void setQtaMaxAcquistoWww(long qtaMaxAcquistoWww) { + this.qtaMaxAcquistoWww = qtaMaxAcquistoWww; + } + + public double getPrezzoMinimoEbay() { + double tariffaFissa = 0.5D; + double percEbay = 0.065D; + if (getTipo().getEbayCommissione() > 0.0D) + percEbay = getTipo().getEbayCommissione() / 100.0D; + DoubleOperator dop = new DoubleOperator(getCostoNetto()); + dop.setScale(4, 5); + dop.add(tariffaFissa); + DoubleOperator perc = new DoubleOperator(1.0F); + perc.subtract(percEbay); + dop.divide(perc); + return dop.getResult(); + } + + public double getTariffaEbay() { + DoubleOperator dop = new DoubleOperator(getPrezzoArticoloEbayIva().getPrezzoFinale()); + dop.setScale(4, 5); + dop.add(10); + dop.multiply(getTipo().getEbayCommissione()); + dop.divide(100.0F); + TipoPagamento tpEbay = TipoPagamento.getTipoPagamentoEbay(getApFull()); + dop.add(tpEbay.getWwwTariffaFissa()); + dop.setScale(2, 5); + return dop.getResult(); + } + + public double getTariffaPaypal() { + double percPaypal = 3.4D; + DoubleOperator dop = new DoubleOperator(getPrezzoPubblico(null)); + dop.setScale(4, 5); + dop.add(getDeliveryCost("I")); + dop.multiply(percPaypal); + dop.divide(100.0F); + dop.add(0.35D); + dop.setScale(2, 5); + return dop.getResult(); + } + + public double getPrezzoMinimoPaypalEbayIva() { + return conIva(getPrezzoMinimoPaypalEbay(), (double)getIva().getAliquota()); + } + + public void findByCodiceProduttore(String l_codiceProduttore) { + findByCodiceProduttoreMarca(l_codiceProduttore, 0L); + } + + public long getId_articoloTagliaKit() { + return this.id_articoloTagliaKit; + } + + public void setId_articoloTagliaKit(long id_articoloTagliaKit) { + this.id_articoloTagliaKit = id_articoloTagliaKit; + } + + public void findByCartitemId(CartItemId cii) { + initFields(); + if (cii.getId_articoloTaglia() > 0L) { + ArticoloTaglia at = new ArticoloTaglia(this.apFull); + at.findByPrimaryKey(cii.getId_articoloTaglia()); + findByPrimaryKey(at.getId_articolo()); + setId_articoloVariante(at.getId_articoloVariante()); + setId_articoloTaglia(at.getId_articoloTaglia()); + if (cii.getId_articoloTagliaKit() > 0L) { + at = new ArticoloTaglia(this.apFull); + at.findByPrimaryKey(cii.getId_articoloTagliaKit()); + setId_articoloVarianteKit(at.getId_articoloVariante()); + setId_articoloTagliaKit(at.getId_articoloTaglia()); + } + } else if (cii.getId_articoloVariante() > 0L) { + ArticoloVariante av = new ArticoloVariante(this.apFull); + av.findByPrimaryKey(cii.getId_articoloVariante()); + findByPrimaryKey(av.getId_articolo()); + setId_articoloVariante(av.getId_articoloVariante()); + } else { + findByPrimaryKey(cii.getId_articolo()); + } + } + + public String getCCLinkDettaglio(ArticoloCR CR) { + if (CR != null) { + if (CR.getId_articoloTaglia() > 0L || CR.getId_taglia() > 0L) { + if (CR.getId_articoloVariante() > 0L) { + if (CR.getId_articoloVarianteKit() > 0L) + return getCCLinkDettaglioTK(CR); + return getCCLinkDettaglioT(CR); + } + return getCCLinkDettaglioT(CR); + } + return getCCLinkDettaglioA(CR); + } + return getCCLinkDettaglio(); + } + + public long getCartItemType() { + if (getId_articoloTaglia() > 0L) { + if (getId_articoloVariante() > 0L) { + if (getId_articoloVarianteKit() > 0L) + return 5L; + return 3L; + } + if (getId_articoloTagliaKit() > 0L) + return 4L; + return 2L; + } + if (getId_articoloVariante() > 0L) + return 1L; + return 0L; + } + + public long getId_fornitoreCostoNuovo() { + return this.id_fornitoreCostoNuovo; + } + + public void setId_fornitoreCostoNuovo(long id_fornitoreCostoNuovo) { + this.id_fornitoreCostoNuovo = id_fornitoreCostoNuovo; + setFornitoreCostoNuovo(null); + } + + public Clifor getFornitoreCostoNuovo() { + this.fornitoreCostoNuovo = (Clifor)getSecondaryObject(this.fornitoreCostoNuovo, Clifor.class, getId_fornitoreCostoNuovo()); + return this.fornitoreCostoNuovo; + } + + public void setFornitoreCostoNuovo(Clifor fornitoreCostoNuovo) { + this.fornitoreCostoNuovo = fornitoreCostoNuovo; + } + + public ResParm caricaIcecat() { + return caricaIcecat(getCurrentLang(), true, 0); + } + + public ResParm caricaIcecat(String l_lang, boolean sovrascriviImmagini, int ggChiamataIcecat) { + ResParm rp = new ResParm(true); + if (getId_articolo() == 0L || (getCodiceEan().isEmpty() && getId_marca() == 0L && getCodiceProduttore().isEmpty())) { + rp.setStatus(false); + rp.setMsg("Errore! Codice Ean/marca/mpn non presente o articolo non salvato"); + } else if (ggChiamataIcecat > 0 && getDataChiamataIcecat() != null && + getDateDiff(getDataChiamataIcecat(), getToday()) < (long)ggChiamataIcecat) { + rp.setStatus(true); + rp.setMsg("Chiamata Icecat gia' effettuata il " + getDataFormat().format(getDataChiamataIcecat())); + } else { + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + if (attivita.isIcecat()) { + Icecat ic = new Icecat(attivita.getIcecatUsername(), l_lang); + if (!getCodiceEan().isEmpty()) { + rp = ic.fetchGtin(getCodiceEan()); + } else { + rp.setStatus(false); + } + if (!rp.getStatus()) + if (getId_marca() > 0L && !getCodiceProduttore().isEmpty()) { + rp = ic.fetchProductCode(getMarca().getDescrizione(), getCodiceProduttore()); + } else { + rp.setStatus(false); + rp.setMsg("Errore! mancano ean/marca/codiceproduttore!"); + return rp; + } + if (!rp.getStatus()) { + rp.setStatus(false); + JSONObject res = null; + try { + res = new JSONObject(rp.getMsg()); + } catch (Exception e) {} + if (res != null) { + if (res.has("Message")) { + rp.setMsg("Errore! " + res.getString("Message")); + } else if (res.has("message")) { + rp.setMsg("Errore! " + res.getString("message")); + } + } else { + rp.setMsg("Errore! " + rp.getMsg()); + } + } else { + StringBuilder sb = new StringBuilder(); + boolean salvaArticolo = false; + LinkedHashSet gallery = ic.getDSImageGallery(); + if (gallery.size() > 0) + if (sovrascriviImmagini && gallery.size() > 0) { + String targetDir = getDocBase() + getDocBase(); + File targetDirFile = new File(targetDir); + if (targetDirFile.exists()) { + deleteImmagini(); + deleteImmaginiRiduzioni(null); + } else { + targetDirFile.mkdirs(); + } + setImgTmst(getTimeNameForFileUpload()); + superSave(); + int currentImg = 1; + for (String urlImg : gallery) { + caricaImmaginaDaRemoto(urlImg, (long)currentImg); + sb.append("immagine"); + sb.append(currentImg); + sb.append(", "); + currentImg++; + } + } + if (!getDescrizioneBreve(l_lang).isEmpty()); + setDescTxtLang("descrizioneBreve", l_lang, ic.getDSTitleLong()); + sb.append("DescrizioneBreve, "); + salvaArticolo = true; + long maxlen = getMaxLenNomeMarketplace(); + long maxlenDesc = getMaxLenDescMarketplace(); + if (getNomeMarketplace(l_lang).isEmpty()) { + if ((long)ic.getDSTitleLong().length() <= maxlen) { + setDescTxtLang("nomeMarketplace", l_lang, ic.getDSTitleLong()); + } else if ((long)ic.getDSSummaryDescriptionShort().length() <= maxlen) { + setDescTxtLang("nomeMarketplace", l_lang, ic.getDSSummaryDescriptionShort()); + } else { + setDescTxtLang("nomeMarketplace", l_lang, getNome()); + } + sb.append("nomeMarketplace, "); + salvaArticolo = true; + } + String l_descrizioneLunga = ic.getDSSummaryDescriptionLong(); + String l_specifiche = ic.getDSFeaturesTable(translate("N.B.: Questa scheda è da ritenersi puramente informativa e non contiene alcun tipo di garanzia né implicita né esplicita.", l_lang)); + String l_reasonBuy = ic.getDSReasonToBuyTable(translate("Punti di Forza", l_lang)); + if (!getDescrizioneCommerciale(l_lang).isEmpty()); + setDescTxtLang("descrizioneCommerciale", l_lang, l_descrizioneLunga + l_descrizioneLunga); + sb.append("descrizioneCommerciale, "); + salvaArticolo = true; + if (getSpecifiche(l_lang).isEmpty() && !l_specifiche.isEmpty()) { + setDescTxtLang("specifiche", l_lang, l_specifiche); + sb.append("specifiche, "); + salvaArticolo = true; + } + if (getDescrizioneMarketplace(l_lang).isEmpty()) { + String temp = l_descrizioneLunga; + if (!l_reasonBuy.isEmpty()) { + temp = temp + temp; + } else { + temp = temp + temp; + } + if ((long)temp.length() <= maxlenDesc) { + setDescTxtLang("descrizioneMarketplace", l_lang, temp); + } else { + setDescTxtLang("descrizioneMarketplace", l_lang, l_descrizioneLunga); + } + sb.append("descrizioneMarketplace, "); + salvaArticolo = true; + } + if (salvaArticolo) { + setFlgTipoSchedaArticoloWww(1L); + setDataChiamataIcecat(getToday()); + rp = save(); + } + if (rp.getStatus()) { + StringBuilder sbCarNontrovate = new StringBuilder(); + HashMap hmCar = ic.getDSFeaturesHasMap(); + if (hmCar.size() > 0) { + CaratteristicaArticolo ca = new CaratteristicaArticolo(getApFull()); + Vectumerator vecCT = new CTipo(this.apFull).findCaratteristicheByTipo(getId_tipo(), false, 0, 0); + while (vecCT.hasMoreElements()) { + CTipo cTipo = (CTipo)vecCT.nextElement(); + ca.findById_articoloId_caratteristica(getId_articolo(), cTipo.getId_caratteristica()); + if (ca.getDBState() == 0) { + if (cTipo.getCaratteristica().getIcecatDescs().toLowerCase().equals("mpn")) { + if (!getCodiceProduttore().isEmpty()) { + ca.setId_articolo(getId_articolo()); + ca.setId_caratteristica(cTipo.getId_caratteristica()); + ca.setValS(getCodiceProduttore()); + ca.save(); + } + continue; + } + if (cTipo.getCaratteristica().getIcecatDescs().toLowerCase().equals("marca")) { + if (!getCodiceProduttore().isEmpty()) { + ca.setId_articolo(getId_articolo()); + ca.setId_caratteristica(cTipo.getId_caratteristica()); + ca.setValS(getMarca().getDescrizione()); + ca.save(); + } + continue; + } + if (cTipo.getCaratteristica().getFlgTipoVal() == 6L) { + Vectumerator vecLista = new Lista(getApFull()) + .findLista(cTipo.getId_caratteristica(), 0, 0); + while (vecLista.hasMoreElements()) { + Lista lista = (Lista)vecLista.nextElement(); + boolean carTrovata = false; + StringTokenizer stringTokenizer = new StringTokenizer(lista.getIcecatValues(), ","); + while (stringTokenizer.hasMoreTokens()) { + String icecatValue = stringTokenizer.nextToken(); + if (hmCar.containsValue(icecatValue)) { + ca.setId_articolo(getId_articolo()); + ca.setId_caratteristica(cTipo.getId_caratteristica()); + ca.setId_lista(lista.getId_lista()); + ca.save(); + carTrovata = true; + break; + } + } + if (carTrovata) + break; + if (!lista.getIcecatValues().isEmpty()) + for (Map.Entry me : hmCar.entrySet()) { + stringTokenizer = new StringTokenizer(lista.getIcecatValues(), ","); + while (stringTokenizer.hasMoreTokens()) { + String icecatValue = stringTokenizer.nextToken(); + if (me.getValue().contains(icecatValue)) { + ca.setId_articolo(getId_articolo()); + ca.setId_caratteristica(cTipo.getId_caratteristica()); + ca.setId_lista(lista.getId_lista()); + ca.save(); + carTrovata = true; + break; + } + } + if (carTrovata) + break; + } + } + sbCarNontrovate.append(cTipo.getCaratteristica().getDescrizione_it()); + sbCarNontrovate.append(", "); + continue; + } + StringTokenizer st = new StringTokenizer(cTipo.getCaratteristica().getIcecatDescs(), ","); + boolean trovato = false; + while (st.hasMoreTokens()) { + String token = st.nextToken(); + if (hmCar.containsKey(token)) { + ca.setId_articolo(getId_articolo()); + ca.setId_caratteristica(cTipo.getId_caratteristica()); + if (cTipo.getCaratteristica().getFlgTipoVal() == 3L) { + ca.setValS(hmCar.get(token)); + } else if (cTipo.getCaratteristica() + .getFlgTipoVal() == 2L) { + ca.setValDouble(Double.parseDouble(hmCar.get(token))); + } else if (cTipo.getCaratteristica() + .getFlgTipoVal() == 1L) { + ca.setValI(Long.parseLong(hmCar.get(token))); + } else if (cTipo.getCaratteristica() + .getFlgTipoVal() == 4L) { + ca.setValSN(hmCar.get(token).toLowerCase().equals("si") ? 1L : 0L); + } else if (cTipo.getCaratteristica() + .getFlgTipoVal() == 5L) { + sbCarNontrovate.append(cTipo.getCaratteristica().getDescrizione_it()); + sbCarNontrovate.append(", "); + } + ca.save(); + trovato = true; + } + } + if (!trovato) { + sbCarNontrovate.append(cTipo.getCaratteristica().getDescrizione_it()); + sbCarNontrovate.append(", "); + } + } + } + sb.append("caratteristiche, "); + } + if (sbCarNontrovate.length() > 0) { + rp.setMsg("Attenzione! " + sb.toString() + " - Car. NON trovate: " + sbCarNontrovate.toString()); + } else { + rp.setMsg(sb.toString()); + } + } + } + } + } + return rp; + } + + public long getId_statoUsato() { + return this.id_statoUsato; + } + + public void setId_statoUsato(long id_statoUsato) { + this.id_statoUsato = id_statoUsato; + setStatoUsato(null); + } + + public StatoUsato getStatoUsato() { + this.statoUsato = (StatoUsato)getSecondaryObject(this.statoUsato, StatoUsato.class, new Long(getId_statoUsato())); + return this.statoUsato; + } + + public void setStatoUsato(StatoUsato statoUsato) { + this.statoUsato = statoUsato; + } + + public boolean isNuovo() { + return getStatoUsato().isNuovo(); + } + + public boolean isUsato() { + return getStatoUsato().isUsato(); + } + + public void deleteImmaginiRiduzioni(String cartelleRiduzioni) { + if (cartelleRiduzioni == null || cartelleRiduzioni.isEmpty()) + cartelleRiduzioni = "50,66,100,200,350"; + StringTokenizer st = new StringTokenizer(cartelleRiduzioni, ","); + while (st.hasMoreTokens()) { + String size = st.nextToken(); + File dir = new File(getDocBase() + getDocBase() + getPathImg() + "/"); + FilenameFilter imgFilter = new FilenameFilter() { + public boolean accept(File dir, String name) { + if ((name.indexOf("+" + Articolo.this.getId_articolo() + "_") >= 0 || name.indexOf("" + Articolo.this.getId_articolo() + "_") == 0) && + name.toLowerCase().endsWith("jpg")) + return true; + return false; + } + }; + File[] files = dir.listFiles(imgFilter); + if (files != null) + for (File currentImg : files) + currentImg.delete(); + } + } + + public long getFlgPreventivoWwwArt() { + return this.flgPreventivoWwwArt; + } + + public void setFlgPreventivoWwwArt(long flgPreventivoWwwArt) { + this.flgPreventivoWwwArt = flgPreventivoWwwArt; + } + + public long getPercCostoSpedizione() { + if (this.percCostoSpedizione <= 0L) + if (getTipo().getPercCostoSpedizioneDefault() > 0L) { + this.percCostoSpedizione = getTipo().getPercCostoSpedizioneDefault(); + } else if (getTipo().getPercCostoSpedizioneDefault() < 0L) { + setFlgPreventivoWwwArt(1L); + } else { + this.percCostoSpedizione = 0L; + } + return this.percCostoSpedizione; + } + + public void setPercCostoSpedizione(long percCostoSpedizione) { + this.percCostoSpedizione = percCostoSpedizione; + } + + public boolean isCostoSpedizionePreventivoArticoloNazione(String l_id_nazione) { + if (l_id_nazione.isEmpty()) + l_id_nazione = "I"; + ArticoloNazione an = new ArticoloNazione(getApFull()); + an.findByArticoloNazione(getId_articolo(), l_id_nazione); + if (an.getId_articoloNazione() > 0L) { + if (an.getFlgPreventivoWwwAN() == 1L) + return true; + return false; + } + if (getFlgPreventivoWwwArt() == 1L) + return true; + Nazione nazione = new Nazione(getApFull()); + nazione.findByPrimaryKey(l_id_nazione); + if (nazione.getId_nazione().isEmpty()) + return false; + if (nazione.getFlgPreventivoWww() == 1L) + return false; + return (nazione.getFlgPreventivoWww() == 1L); + } + + public long getPercentileSpedizione() { + return getPercCostoSpedizione(); + } + + public double getDeliveryCost(String l_id_nazione) { + if (l_id_nazione.isEmpty()) + l_id_nazione = "I"; + Nazione nazione = new Nazione(getApFull()); + nazione.findByPrimaryKey(l_id_nazione); + if (nazione.getId_nazione().isEmpty()) + return 0.0D; + return getDeliveryCostPercentile(nazione); + } + + public String getDeliveryCostDesc(String l_id_nazione, String lang) { + if (l_id_nazione.isEmpty()) + l_id_nazione = "I"; + if (getFlgPreventivoWwwArt() == 1L) + return translate("Su preventivo", lang); + Nazione nazione = new Nazione(getApFull()); + nazione.findByPrimaryKey(l_id_nazione); + if (nazione.getId_nazione().isEmpty()) + return translate("Su preventivo", lang); + if (nazione.getFlgPreventivoWww() == 1L) + return translate("Su preventivo", lang); + double l_costoSped = getDeliveryCostPercentileIVA(nazione); + double l_costoSpedNetto = getDeliveryCostPercentile(nazione); + String res = "€ " + getNf().format(l_costoSped) + " (" + getNf().format(l_costoSpedNetto) + " " + + translate("+ iva", lang) + ")"; + return res; + } + + private double getDeliveryCostPercentileIVA(Nazione nazione) { + return conIva(getDeliveryCostPercentile(nazione), getParm(Cart.P_DELIVERY_IVA_ALIQUOTA).getNumeroDouble()); + } + + private double getDeliveryCostPercentile(Nazione nazione) { + if (getFlgPreventivoWwwArt() == 1L) + return 0.0D; + double l_costoSped = nazione.getCostoSpedizione(); + if (getFornitoreCostoNuovo().getCostoSpedizioneAggiuntivo() > 0.0D) { + DoubleOperator dop = new DoubleOperator(l_costoSped); + dop.add(getFornitoreCostoNuovo().getCostoSpedizioneAggiuntivo()); + dop.setScale(2, 5); + l_costoSped = dop.getResult(); + } + if (getPercentileSpedizione() > 100L) { + DoubleOperator dop = new DoubleOperator(l_costoSped); + dop.multiply(getPercentileSpedizione()); + dop.divide(100.0F); + dop.setScale(2, 5); + l_costoSped = dop.getResult(); + } + return l_costoSped; + } + + public boolean isScontoTroppoAlto() { + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + if (attivita.getCheckCartPercScontoMax() <= 0.0D) + return false; + if (Math.abs(getPercScontoRispettoAlPrezzoBarrato()) > attivita.getCheckCartPercScontoMax()) + return true; + return false; + } + + public final ResParm startThreadCancellazioneMassiva(ApplParmFull apFull, ArticoloCR CR) { + if (!isThreadCancellazione()) { + new ThreadCancellazioneMassiva(apFull, CR); + return new ResParm(true, "Thread cancellazione massiva avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public ByteArrayOutputStream creaReportPdf(int flgTipo, ArticoloCR CR) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + String titoloReport = ""; + try { + switch (flgTipo) { + case 10: + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 10.0F, 10.0F); + break; + default: + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 10.0F, 10.0F); + break; + } + switch (flgTipo) { + case 10: + titoloReport = "Listino Articoli"; + break; + case 11: + titoloReport = "Report Articoli Usato"; + break; + default: + titoloReport = "Report ???"; + break; + } + SimpleDateFormat tf = new SimpleDateFormat("HH:mm:ss"); + Date today = getToday(); + titoloReport = titoloReport + ". Stampato il " + titoloReport + " " + getDataFormat().format(today); + this.writer = PdfWriter.getInstance(this.document, ba); + Phrase pH = new Phrase(titoloReport + " - Pag. n. "); + HeaderFooter header = new HeaderFooter(pH, true); + header.setAlignment(2); + header.setBorder(0); + this.document.setHeader(header); + this.document.open(); + switch (flgTipo) { + case 10: + creaUnReportListinoNegozio(this, CR); + break; + case 11: + creaUnReportUsato(this, CR); + break; + } + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + private Document creaUnReportListinoNegozio(Articolo bean, ArticoloCR CR) { + NumberFormat nf3 = NumberFormat.getInstance(); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf0 = NumberFormat.getInstance(); + nf0.setMaximumFractionDigits(0); + nf0.setMinimumFractionDigits(0); + int col1 = 4, col2 = 8, col3 = 18, col4 = 4, col5 = 6; + int cellLeading = 12; + try { + Cell rigaVuota = new Cell(new Chunk(" ", PDF_fPiccolissimo)); + rigaVuota.setVerticalAlignment(4); + rigaVuota.setHorizontalAlignment(0); + rigaVuota.setLeading((float)cellLeading); + rigaVuota.setBorder(0); + rigaVuota.setColspan(40); + rigaVuota.setRowspan(1); + creaIntestazioneReport(CR.getTipoReport(), ""); + Cell cell = new Cell(new Chunk("Codice", PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Marca", PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Descrizione", PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Giacenza", PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Prezzo con iva", PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.pdfcorpo.endHeaders(); + CR.setFlgOrderBy(1L); + Vectumerator vec = bean.findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + cell = new Cell(new Chunk(String.valueOf(row.getId_articolo()), PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(row.getMarca().getDescrizione(), PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(row.getDescrizione(), PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf0().format(row.getQuantita()), PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + if (row.getFlgNoleggio() >= 1L) { + cell = new Cell(new Chunk(getNf().format(row.getPrezzoNoleggioIva()), PDF_fMedio)); + } else { + cell = new Cell(new Chunk(getNf().format(row.getPrezzoPubblico()), PDF_fMedio)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + this.document.add((Element)this.pdfcorpo); + } catch (Exception e) { + handleDebug(e); + } + return this.document; + } + + private Document creaUnReportUsato(Articolo bean, ArticoloCR CR) { + NumberFormat nf3 = NumberFormat.getInstance(); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf0 = NumberFormat.getInstance(); + nf0.setMaximumFractionDigits(0); + nf0.setMinimumFractionDigits(0); + int col1 = 4, col2 = 5, col3 = 13, col4 = 12, col5 = 2, col6 = 4; + int cellLeading = 12; + try { + Cell rigaVuota = new Cell(new Chunk(" ", PDF_fPiccolissimo)); + rigaVuota.setVerticalAlignment(4); + rigaVuota.setHorizontalAlignment(0); + rigaVuota.setLeading((float)cellLeading); + rigaVuota.setBorder(0); + rigaVuota.setColspan(40); + rigaVuota.setRowspan(1); + creaIntestazioneReport(CR.getTipoReport(), ""); + Cell cell = new Cell(new Chunk("ELENCO ARTICOLI A DATA ", PDF_fGrandeB)); + if (CR.getDataDocumentoUsatoA() == null) { + cell.add(new Chunk("di oggi " + getDataFormat().format(getToday()), PDF_fGrandeB)); + } else { + cell.add(new Chunk(getDataFormat().format(CR.getDataDocumentoUsatoA()), PDF_fGrandeB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.WHITE); + cell.setColspan(40); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Codice", PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Marca", PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Descrizione", PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Fornitore", PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("#", PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Costo Acquisto", PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.pdfcorpo.endHeaders(); + CR.setFlgOrderBy(1L); + CR.setFlgUsato(99L); + CR.setFlgQta(1L); + CR.setQtaDa(1L); + CR.setFlgEscludiWeb(-1L); + DoubleOperator totAcquisto = new DoubleOperator(); + long totArticoli = 0L, totaleArticoliPresenti = 0L; + Vectumerator vec = bean.findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + totAcquisto.add(row.getCostoNetto()); + totArticoli++; + totaleArticoliPresenti = (long)((double)totaleArticoliPresenti + row.getQuantita()); + cell = new Cell(new Chunk(String.valueOf(row.getCodice()), PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(row.getMarca().getDescrizione(), PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(row.getDescrizione() + " (" + row.getDescrizione() + ")", PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(row.getFornitoreUsato().getDescrizioneCompleta(), PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf0().format(row.getQuantita()), PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(row.getCostoNetto()), PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("TOTALI", PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col1 + col2 + col3 + col4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf0().format(totArticoli), PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totAcquisto.getResult()), PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Attualmente in magazzino: ", PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col1 + col2 + col3 + col4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf0().format(totaleArticoliPresenti), PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + } catch (Exception e) { + handleDebug(e); + } + return this.document; + } + + public Clifor getFornitoreUsato() { + return new ArticoloUsato(getApFull()).getFornitoreByArticolo(getId_articolo()); + } + + public PrezzoArticolo getPrezzoArticoloIva(Clifor clifor) { + if (this.prezzoArticoloIva != null && clifor != null && this.prezzoArticoloIva.getId_clifor() != clifor.getId_clifor()) { + this.prezzoArticolo = null; + this.prezzoArticoloIva = null; + } + if (this.prezzoArticoloIva == null && getId_articolo() > 0L) + if (clifor != null) { + if (clifor.isPrezzoWebEsente()) { + this.prezzoArticoloIva = getPrezzoArticolo(clifor); + } else { + Iva ivaDaApplicare = getIvaByClifor(clifor); + if (clifor.getListino().getId_listino() > 0L) { + this.prezzoArticoloIva = clifor.getListino().getPrezzoIva(this, ivaDaApplicare); + this.prezzoArticoloIva.setId_clifor(clifor.getId_clifor()); + } else { + this.prezzoArticoloIva = getListinoBase().getPrezzoIva(this, ivaDaApplicare); + } + } + } else { + this.prezzoArticoloIva = getListinoBase().getPrezzoIva(this); + } + return (this.prezzoArticoloIva == null) ? new PrezzoArticolo() : this.prezzoArticoloIva; + } + + public boolean isPrezzoWebEsente(Users user) { + if (user == null || user.getId_users() == 0L) + return false; + if (user.getId_clifor() >= 0L) + return user.getClifor().isPrezzoWebEsente(); + return false; + } + + public static String getTipoReport(long l_flgTipoReport) { + if (l_flgTipoReport == 10L) + return "Listino Negozio"; + if (l_flgTipoReport == 11L) + return "USATO"; + if (l_flgTipoReport == 1L) + return "Articolo+Varianti"; + if (l_flgTipoReport == 2L) + return "Articolo+Varianti+Seriali"; + if (l_flgTipoReport == 0L) + return "Comnpatto"; + return "??"; + } + + public String getCategoriaImport() { + return (this.categoriaImport == null) ? "" : this.categoriaImport.trim(); + } + + public void setCategoriaImport(String categoriaImport) { + this.categoriaImport = categoriaImport; + } + + public String getCCLinkAdmin() { + StringBuilder sb = new StringBuilder(); + sb.append(getParm("P_WWW_ADDRESS").getTesto()); + sb.append("Redir.abl?_svlt=/admin/art/Articolo.abl&_parms=@cmd:search@codice:"); + sb.append(getCodice()); + return sb.toString(); + } + + public String getTFLinkDettaglio(ArticoloCR CR) { + String lang = (CR == null || CR.getLang().isEmpty()) ? "it" : CR.getLang(); + StringBuilder sb = new StringBuilder(); + sb.append(convertStringToLink(getMarca().getDescrizione()).replace('+', '-')); + sb.append("-"); + sb.append(getDescrizioneNomeCodiceUrl().replace('+', '-').replace(',', '-')); + sb.append("+"); + if (CR == null) { + sb.append("d"); + } else { + sb.append(translate("d", lang)); + } + sb.append("-"); + sb.append(getId_articolo()); + sb.append("-"); + sb.append((getId_articoloVariante() == 0L) ? "" : getId_articoloVariante()); + sb.append("-"); + sb.append(lang); + String res = convertStringToLink(sb.toString().toLowerCase()) + ".html"; + return res; + } + + public String getTFLinkDettaglioCanonical() { + return getWwwAddressParm() + getWwwAddressParm(); + } + + public boolean isReadyForMarketplace(String lang) { + if (isReadyForWeb(lang)) { + if (getFlgSubito() == 1L || getFlgEbay() == 1L) { + long maxlen = getMaxLenNomeMarketplace(); + long maxlenDesc = getMaxLenDescMarketplace(); + String temp = getDescTxtLang("nomeMarketplace", lang); + if (temp.isEmpty() || (long)temp.length() > maxlen) + return false; + temp = getDescTxtLang("descrizioneMarketplace", lang); + if (temp.isEmpty() || (long)temp.length() > maxlenDesc) + return false; + } + return true; + } + return false; + } + + public Date getDataScadenzaOffertaFornitore() { + return this.dataScadenzaOffertaFornitore; + } + + public void setDataScadenzaOffertaFornitore(Date dataScadenzaOffertaFornitore) { + this.dataScadenzaOffertaFornitore = dataScadenzaOffertaFornitore; + } + + public boolean isEbayPubblicato() { + if (getEbayOfferId().isEmpty()) + return false; + return true; + } + + public boolean isAmazonPubblicato() { + return false; + } + + public double getPercRicaricoEffettivo() { + return getRicaricoEffettivoDaCostoNetto(); + } + + public double getPerRicaricoEffettivoEbay() { + if (getCostoNetto() > 0.0D) { + DoubleOperator dop = new DoubleOperator(getPrezzoArticoloEbay().getPrezzoFinale()); + dop.setScale(4, 5); + dop.divide(getCostoNetto()); + dop.subtract(1); + dop.multiply(100); + return dop.getResult(); + } + return 0.0D; + } + + public void setPercRicaricoEffettivo(double percRicaricoEffettivo) { + this.percRicaricoEffettivo = percRicaricoEffettivo; + } + + public static String getEventTypeString(int eventType) { + switch (eventType) { + case 1: + return "START_ELEMENT"; + case 2: + return "END_ELEMENT"; + case 3: + return "PROCESSING_INSTRUCTION"; + case 4: + return "CHARACTERS"; + case 5: + return "COMMENT"; + case 7: + return "START_DOCUMENT"; + case 8: + return "END_DOCUMENT"; + case 9: + return "ENTITY_REFERENCE"; + case 10: + return "ATTRIBUTE"; + case 11: + return "DTD"; + case 12: + return "CDATA"; + case 6: + return "SPACE"; + } + return "UNKNOWN_EVENT_TYPE , " + eventType; + } + + public static final String getNascondi(long l_flgNascondi) { + if (l_flgNascondi == 0L) + return "No"; + if (l_flgNascondi == 1L) + return "Si"; + return "??"; + } + + public static final String getStato(long l_flgStato) { + if (l_flgStato == 0L) + return "Ok"; + if (l_flgStato == 1L) + return "A Richista"; + if (l_flgStato == 2L) + return "Fine Serie"; + return "??"; + } + + public static final String getNoleggio(long l_noleggio) { + if (l_noleggio == 0L) + return "No"; + if (l_noleggio == 1L) + return "Solo Noleggio"; + if (l_noleggio == 2L) + return "Vendita e Noleggio"; + return "??"; + } + + public static String getUdm(long l_flgUdm) { + return TipologiaArticolo.getUdm(l_flgUdm); + } + + public long getId_confezionistaDefault() { + return this.id_confezionistaDefault; + } + + public void setId_confezionistaDefault(long id_confezionistaDefault) { + this.id_confezionistaDefault = id_confezionistaDefault; + setConfezionistaDefault(null); + } + + private long flgTrovaprezzi = 0L; + + private long flgIdealo = -1L; + + private long id_magFisico; + + private MagFisico magFisico; + + public Clifor getConfezionistaDefault() { + this.confezionistaDefault = (Clifor)getSecondaryObject(this.confezionistaDefault, Clifor.class, getId_confezionistaDefault()); + return this.confezionistaDefault; + } + + public void setConfezionistaDefault(Clifor confezionistaDefault) { + this.confezionistaDefault = confezionistaDefault; + } + + public String getGoogleFeedFileName() { + return (this.googleFeedFileName == null) ? "" : this.googleFeedFileName.trim(); + } + + public void setGoogleFeedFileName(String googleFeedFileName) { + this.googleFeedFileName = googleFeedFileName; + } + + public long getFlgAmazon() { + return this.flgAmazon; + } + + public void setFlgAmazon(long flgAmazon) { + this.flgAmazon = flgAmazon; + } + + public double getTariffaAmazon() { + DoubleOperator dop = new DoubleOperator(getPrezzoArticoloAmazonIva().getPrezzoFinale()); + dop.setScale(4, 5); + dop.multiply(getTipo().getAmazonCommissione()); + dop.divide(100.0F); + TipoPagamento tpAmz = TipoPagamento.getTipoPagamentoAmazon(getApFull()); + dop.add(tpAmz.getWwwTariffaFissa()); + dop.setScale(2, 5); + return dop.getResult(); + } + + public void setTariffaAmazon(double tariffaAmazon) { + this.tariffaAmazon = tariffaAmazon; + } + + public long getId_listinoAmazon() { + if (this.id_listinoAmazon == 0L && getApFull() != null) + this.id_listinoAmazon = getTipo().getId_listinoAmazon(); + return this.id_listinoAmazon; + } + + public void setId_listinoAmazon(long id_listinoAmazon) { + this.id_listinoAmazon = id_listinoAmazon; + setListinoAmazon(null); + } + + public Listino getListinoAmazon() { + this.listinoAmazon = (Listino)getSecondaryObject(this.listinoAmazon, Listino.class, getId_listinoAmazon()); + return this.listinoAmazon; + } + + public void setListinoAmazon(Listino listinoAmazon) { + this.listinoAmazon = listinoAmazon; + } + + public long getQtaAmz() { + return this.qtaAmz; + } + + public void setQtaAmz(long qtaAmazon) { + this.qtaAmz = qtaAmazon; + } + + public PrezzoArticolo getPrezzoArticoloAmazon() { + if (getId_listinoAmazon() == 0L) + return getListinoBase().getPrezzoBaseLA(this); + return getListinoAmazon().getPrezzo(this); + } + + public PrezzoArticolo getPrezzoArticoloAmazonIva() { + if (getId_listinoAmazon() == 0L) + return getListinoBase().getPrezzoBaseIvaLA(this); + return getListinoAmazon().getPrezzoIva(this); + } + + public double getPrezzoArticoloAmazonIvaExport(String currentLang, long qty) { + if (getFlgPriceTypeAmz() == 0L) + return getPrezzoArticoloAmazonIva().getPrezzoFinale(); + if (getFlgPriceTypeAmz() == 1L) + return getPrezzoArticoloAmazonSpedIva(currentLang, true, qty); + return getPrezzoArticoloAmazonSpedIva(currentLang, false, qty); + } + + public double getPercScontoPrezzoAmzQty(String currentLang, boolean conPercentile, long qtyDa) { + DoubleOperator dop = new DoubleOperator(-getPrezzoArticoloAmazonSpedIva(currentLang, conPercentile, qtyDa)); + dop.setScale(4, 5); + dop.divide(getPrezzoArticoloAmazonSpedIva(currentLang, conPercentile, 1L)); + dop.add(1); + dop.multiply(100); + dop.setScale(2, 5); + return dop.getResult(); + } + + public String getAmzPrezziDesc() { + StringBuilder sb = new StringBuilder(); + sb.append("+"); + sb.append(getNf().format(getListinoAmazon().getPercL())); + sb.append("% "); + sb.append("
"); + if (getFlgPriceTypeAmz() == 0L) + sb.append(""); + sb.append(getNf().format(getPrezzoArticoloAmazonIva().getPrezzoFinale())); + if (getFlgPriceTypeAmz() == 0L) + sb.append(""); + sb.append("
"); + if (getPercentileSpedizione() > 100L) { + if (getFlgPriceTypeAmz() == 1L) + sb.append(""); + sb.append("sp1 "); + sb.append(getNf().format(getPrezzoArticoloAmazonSpedIva("it", true, 1L))); + sb.append(" "); + sb.append("sp2 "); + sb.append(getNf().format(getPrezzoArticoloAmazonSpedIva("it", true, 2L))); + sb.append(" "); + sb.append("-"); + sb.append(getNf().format(getPercScontoPrezzoAmzQty("it", true, 2L))); + sb.append("% "); + if (getFlgPriceTypeAmz() == 1L) + sb.append(""); + sb.append("
"); + if (getFlgPriceTypeAmz() == 2L) + sb.append(""); + sb.append("s1 "); + sb.append(getNf().format(getPrezzoArticoloAmazonSpedIva("it", false, 1L))); + sb.append(" "); + sb.append("s2 "); + sb.append(getNf().format(getPrezzoArticoloAmazonSpedIva("it", false, 2L))); + sb.append(" "); + sb.append("-"); + sb.append(getNf().format(getPercScontoPrezzoAmzQty("it", false, 2L))); + sb.append("% "); + if (getFlgPriceTypeAmz() == 2L) + sb.append(""); + } else { + if (getFlgPriceTypeAmz() != 0L) + sb.append(""); + sb.append("s1 "); + sb.append(getNf().format(getPrezzoArticoloAmazonSpedIva("it", false, 1L))); + sb.append(" "); + sb.append("s2 "); + sb.append(getNf().format(getPrezzoArticoloAmazonSpedIva("it", false, 2L))); + sb.append(" "); + sb.append("-"); + sb.append(getNf().format(getPercScontoPrezzoAmzQty("it", false, 2L))); + sb.append("% "); + if (getFlgPriceTypeAmz() != 0L) + sb.append(""); + } + return sb.toString(); + } + + public String getAmzPrezziDescInline() { + return getAmzPrezziDesc().replace("
", " "); + } + + public double getPrezzoArticoloAmazonSpedIva(String l_nazioneCodice, boolean conPercentile, long qty) { + double l_costoSpedIva; + if (qty == 0L) + return getPrezzoArticoloAmazonIva().getPrezzoFinale(); + if (l_nazioneCodice.isEmpty()) + l_nazioneCodice = "it"; + Nazione nazione = new Nazione(getApFull()); + nazione.findByCodice(l_nazioneCodice); + if (conPercentile) { + l_costoSpedIva = getDeliveryCostPercentileIVA(nazione); + } else { + l_costoSpedIva = nazione.getCostoSpedizioneConIva(); + if (getFornitoreCostoNuovo().getCostoSpedizioneAggiuntivo() > 0.0D) { + DoubleOperator doubleOperator = new DoubleOperator(l_costoSpedIva); + doubleOperator.add(getFornitoreCostoNuovo().getCostoSpedizioneAggiuntivoConIva()); + doubleOperator.setScale(2, 5); + l_costoSpedIva = doubleOperator.getResult(); + } + } + DoubleOperator dop = new DoubleOperator(l_costoSpedIva); + dop.setScale(2, 5); + dop.divide((float)qty); + dop.add(getPrezzoArticoloAmazonIva().getPrezzoFinale()); + return dop.getResult(); + } + + public double getPrezzoMinimoAmazon() { + double tariffaFissa = 0.3D; + double percAmazon = 0.0721D; + double percExtra = 0.0D; + if (getTipo().getAmazonCommissione() > 0.0D) + percAmazon = getTipo().getAmazonCommissione() / 100.0D; + if (getTipo().getAmazonCommissioneOltreSoglia() > 0.0D) + percExtra = getTipo().getAmazonCommissioneOltreSoglia() / 100.0D; + if (getTipo().getAmazonFissa() > 0.0D) + tariffaFissa = getTipo().getAmazonFissa(); + if (getTipo().getAmazonSoglia() == 0.0D) { + DoubleOperator dop = new DoubleOperator(getCostoNetto()); + dop.setScale(4, 5); + dop.add(tariffaFissa); + DoubleOperator perc = new DoubleOperator(1.0F); + perc.subtract(percAmazon); + dop.divide(perc); + return dop.getResult(); + } + if (getCostoNetto() <= getTipo().getAmazonSoglia() && percExtra > 0.0D) { + DoubleOperator dop = new DoubleOperator(getCostoNetto()); + dop.setScale(4, 5); + dop.add(tariffaFissa); + DoubleOperator perc = new DoubleOperator(1.0F); + perc.subtract(percAmazon); + dop.divide(perc); + return dop.getResult(); + } + DoubleOperator numer = new DoubleOperator(getCostoNetto()); + numer.setScale(4, 5); + numer.add(tariffaFissa); + DoubleOperator numer2 = new DoubleOperator(getTipo().getAmazonSoglia()); + numer2.setScale(4, 5); + DoubleOperator perc12 = new DoubleOperator(percAmazon); + perc12.setScale(4, 5); + perc12.subtract(percExtra); + numer2.multiply(perc12); + numer.add(numer2); + DoubleOperator denom = new DoubleOperator(1.0F); + denom.subtract(percExtra); + numer.divide(denom); + return numer.getResult(); + } + + public double getPrezzoMinimoEbayIva() { + return conIva(getPrezzoMinimoEbay(), (double)getIva().getAliquota()); + } + + public Vectumerator findArticoliEan14() { + String s_Sql_Find = "select A.* from ARTICOLO as A "; + String s_Sql_order = " "; + WcString wc = new WcString(); + wc.addWc("char_length(A.codiceean)>=14"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findDoppioniEan() { + String s_Sql_Find = "Select A.* from ARTICOLO as A where codiceEan in(SELECT codiceEan FROM ARTICOLO GROUP BY codiceEan HAVING count(codiceEan) > 1 and codiceEan is not null)"; + String s_sql_orderby = " order by codiceEan , readyForWeb desc, quantita desc, costoNetto"; + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm unisciDoppioniEan() { + ResParm rp = new ResParm(); + int countDoppioni = 0; + String TAG_THREAD_MSG = "UNIONE DOPPIONI EAN "; + StringBuilder sbErr = new StringBuilder(); + LinkedHashSet hsArticoli = new LinkedHashSet<>(); + String currenteEan = ""; + Vectumerator vec = findDoppioniEan(); + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "...inizio ..."); + long totDoppioni = (long)(vec.getTotNumberOfRecords() / 2); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (currenteEan.isEmpty()) + currenteEan = row.getCodiceEan(); + if (currenteEan.equals(row.getCodiceEan())) { + hsArticoli.add(row); + continue; + } + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "current ean; " + currenteEan + " " + countDoppioni + " su " + totDoppioni); + Articolo articolo1 = null; + for (Articolo ele : hsArticoli) { + if (articolo1 == null) { + articolo1 = ele; + continue; + } + rp = unisciArticoli(articolo1, ele); + if (!rp.getStatus()) { + sbErr.append(currenteEan + ": " + currenteEan); + sbErr.append("\n"); + } + } + countDoppioni++; + currenteEan = row.getCodiceEan(); + hsArticoli = new LinkedHashSet<>(); + hsArticoli.add(row); + } + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "current ean; " + currenteEan + " " + countDoppioni + " su " + totDoppioni); + countDoppioni++; + Articolo master = null; + for (Articolo ele : hsArticoli) { + if (master == null) { + master = ele; + continue; + } + rp = unisciArticoli(master, ele); + if (!rp.getStatus()) { + sbErr.append(currenteEan + ": " + currenteEan); + sbErr.append("\n"); + } + } + if (sbErr.length() > 0) { + rp.setStatus(false); + rp.setMsg("Record processati:" + countDoppioni + " " + sbErr.toString()); + } else { + rp.setStatus(true); + rp.setMsg("Record processati:" + countDoppioni); + } + StatusMsg.deleteMsgByTag(getApFull(), TAG_THREAD_MSG); + return rp; + } + + public ResParm unisciArticoli(Articolo master, Articolo slave) { + ResParm rp = new ResParm(); + ArticoloFornitore af = new ArticoloFornitore(getApFull()); + Vectumerator vecAf = af.findById_articolo(slave.getId_articolo(), 0, 0); + while (vecAf.hasMoreElements()) { + ArticoloFornitore rowAf = (ArticoloFornitore)vecAf.nextElement(); + af.findByFornitoreArticolo(rowAf.getId_clifor(), master.getId_articolo(), -1L); + if (af.getId_articoloFornitore() > 0L) { + rp = rowAf.delete(); + continue; + } + rowAf.setId_articolo(master.getId_articolo()); + rp = rowAf.save(); + } + if (rp.getStatus()) + rp = af.aggiornaCodiciAlternativiByArticolo(master, true); + if (rp.getStatus()) + rp = aggiornaPrezziEDispoByFornitori(0.0D, false); + rp = master.update("update RIGA_DOCUMENTO SET id_articolo=" + + master.getId_articolo() + " where id_articolo=" + slave.getId_articolo()); + if (rp.getStatus()) + rp = slave.delete(); + return rp; + } + + public long getFlgControlloCostoAggArt() { + return this.flgControlloCostoAggArt; + } + + public void setFlgControlloCostoAggArt(long flgControlloCostoAggArt) { + this.flgControlloCostoAggArt = flgControlloCostoAggArt; + } + + public String getCodiciAlternativiLinkAll() { + assert false : "Decompilation failed at line #22024 -> offsets [0]"; + assert false : "Decompilation failed at line #22026 -> offsets [8]"; + assert false : "Decompilation failed at line #22028 -> offsets [16]"; + assert false : "Decompilation failed at line #22033 -> offsets [25]"; + assert false : "Decompilation failed at line #22035 -> offsets [35]"; + assert false : "Decompilation failed at line #22036 -> offsets [42]"; + assert false : "Decompilation failed at line #22037 -> offsets [49]"; + assert false : "Decompilation failed at line #22039 -> offsets [57]"; + assert false : "Decompilation failed at line #22040 -> offsets [65, 85]"; + assert false : "Decompilation failed at line #22041 -> offsets [73]"; + assert false : "Decompilation failed at line #22042 -> offsets [92]"; + assert false : "Decompilation failed at line #22043 -> offsets [100]"; + assert false : "Decompilation failed at line #22044 -> offsets [114]"; + assert false : "Decompilation failed at line #22047 -> offsets [122]"; + assert false : "Decompilation failed at line #22048 -> offsets [129]"; + assert false : "Decompilation failed at line #22050 -> offsets [137]"; + assert false : "Decompilation failed at line #22052 -> offsets [146]"; + assert false : "Decompilation failed at line #22053 -> offsets [153]"; + assert false : "Decompilation failed at line #22055 -> offsets [161]"; + assert false : "Decompilation failed at line #22056 -> offsets [169, 189]"; + assert false : "Decompilation failed at line #22057 -> offsets [177]"; + assert false : "Decompilation failed at line #22058 -> offsets [196]"; + assert false : "Decompilation failed at line #22059 -> offsets [204]"; + assert false : "Decompilation failed at line #22060 -> offsets [218]"; + assert false : "Decompilation failed at line #22062 -> offsets [226]"; + assert false : "Decompilation failed at line #22063 -> offsets [234]"; + assert false : "Decompilation failed at line #22067 -> offsets [235]"; + } + + public void resetImpression() { + if (getApFull() != null) { + update("update ARTICOLO SET impression=0"); + update("update ARTICOLO SET tmstLastImpression=null"); + } + } + + public String getCCLinkInfo(ArticoloCR CR) { + String lang = (CR == null || CR.getLang().isEmpty()) ? "it" : CR.getLang(); + StringBuilder sb = new StringBuilder(); + StringBuilder sbCmd = new StringBuilder(); + if (getId_articoloVariante() == 0L) { + sb.append(convertStringToLink(getDescrizioneNomeUrl()).toLowerCase()); + } else { + sb.append(convertStringToLink(getArticoloVariante().getDescrizioneNomeUrl()).toLowerCase()); + } + sb.append("-"); + if (!getTipo().getDescrizioneLink(lang).isEmpty()) { + sb.append(getTipo().getDescrizioneLink(lang).replace(" ", "-").toLowerCase()); + } else { + sb.append(getTipo().getDescrizioneCompletaMinus(lang).toLowerCase()); + } + sb = new StringBuilder(eliminaDoppioniInStringa(sb.toString().toLowerCase(), "-", 1, false)); + sbCmd.append("+"); + sbCmd.append("info"); + sbCmd.append("-"); + sbCmd.append(getId_articolo()); + sbCmd.append("-"); + sbCmd.append((getId_articoloVariante() == 0L) ? "" : getId_articoloVariante()); + sbCmd.append("-"); + if (CR != null) + sbCmd.append(CR.getSearchTxtWeb()); + sbCmd.append("-"); + sbCmd.append(lang); + sbCmd.append(".html"); + if (getParm("CC_LINK_WEB_CON_MARCA").isTrue()) + if (sb.toString().toLowerCase().indexOf(getMarca().getDescrizione().toLowerCase()) < 0) + sb.insert(0, getMarca().getDescrizione().toLowerCase() + "-"); + long realMaxlinkLength = 80L - (long)getWwwAddressParm().length(); + if ((long)(sb.length() + sbCmd.length()) > realMaxlinkLength) { + String pre = sb.substring(0, (int)(realMaxlinkLength - (long)sbCmd.length() + 1L)); + if (pre.lastIndexOf("-") > 0) + pre = pre.substring(0, pre.lastIndexOf("-")); + return pre.toLowerCase() + pre.toLowerCase(); + } + return sb.toString().toLowerCase() + sb.toString().toLowerCase(); + } + + public ResParm creaFileXmlTrovaprezzi(ArticoloCR CR) { + int numRecord = 0; + ResParm rp = new ResParm(true); + String trovaprezziFile = "trovaprezzi_" + System.currentTimeMillis() + ".xml"; + String filename = getDocBase() + getDocBase() + getParm("PATH_TMP").getTesto(); + String trovaprezziPermanentFileName = getDocBase() + "_trovaprezzi/" + getDocBase(); + File xmlFile = new File(filename); + String theDir = xmlFile.getAbsolutePath().substring(0, xmlFile.getAbsolutePath().lastIndexOf(File.separator) + 1); + File theDirFile = new File(theDir); + if (!theDirFile.exists()) + theDirFile.mkdirs(); + new File(filename).delete(); + File theDirFileGoogle = new File(getDocBase() + "_trovaprezzi/"); + if (!theDirFileGoogle.exists()) + theDirFileGoogle.mkdirs(); + org.w3c.dom.Element e = null; + CR.setFlgTrovaprezzi(1L); + CR.setFlgEscludiWeb(0L); + CR.setFlgWebNoVendita(0L); + Vectumerator vec = findByCR(CR, 0, 0); + System.out.println("creaFileXmlTrovaprezzi: tot record:" + vec.getTotNumberOfRecords()); + String title = getParm("TITLE").getTesto(); + String site = getParm("P_WWW_ADDRESS").getTesto(); + String lang = CR.getLang(); + if (lang.isEmpty()) { + lang = "it"; + CR.setLang(lang); + } + NumberFormat nf2 = NumberFormat.getInstance(Locale.US); + nf2.setMaximumFractionDigits(2); + nf2.setMinimumFractionDigits(2); + String wwwSite = getWwwAddressParm(); + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + try { + DocumentBuilder db = dbf.newDocumentBuilder(); + org.w3c.dom.Document dom = db.newDocument(); + org.w3c.dom.Element rootElement = dom.createElement("Products"); + rootElement.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); + while (vec.hasMoreElements()) { + Articolo rowbean = (Articolo)vec.nextElement(); + if (rowbean.getFlgUsaVarianti() == 0L) { + String temp; + numRecord++; + org.w3c.dom.Element entryEl = dom.createElement("Offer"); + e = dom.createElement("Code"); + e.setTextContent(rowbean.getCodice()); + entryEl.appendChild(e); + e = dom.createElement("Name"); + if (!rowbean.getDescTxtLangScript("nomeMarketplace", lang).isEmpty()) { + temp = rowbean.getDescTxtLangScript("nomeMarketplace", lang).replaceAll("€", "€").replace(";", " "); + } else { + temp = rowbean.getCCNome(lang); + } + e.setTextContent(convertTo1stCap(temp)); + entryEl.appendChild(e); + e = dom.createElement("Description"); + if (!rowbean.getDescrizioneMarketplace(lang).isEmpty()) { + e.setTextContent(rowbean.getDescrizioneMarketplace(lang)); + } else if (!rowbean.getDescrizioneBreve(lang).isEmpty()) { + e.setTextContent(rowbean.getDescrizioneBreve(lang)); + } else { + e.setTextContent(rowbean.getNome(lang)); + } + entryEl.appendChild(e); + e = dom.createElement("Link"); + e.setTextContent(wwwSite + wwwSite); + entryEl.appendChild(e); + e = dom.createElement("Image"); + e.setTextContent(wwwSite + wwwSite + getPathImg()); + entryEl.appendChild(e); + for (int i = 2; i <= 10; i++) { + if (new File(getDocBase() + getDocBase() + rowbean.getPathImg()).exists()) { + e = dom.createElement("Image" + i); + e.setTextContent(wwwSite + wwwSite + rowbean.getPathImg()); + entryEl.appendChild(e); + } + } + e = dom.createElement("Stock"); + if (rowbean.getAvail() > 0.0D) { + if (rowbean.getAvail() == 1.0D) { + e.setTextContent(String.valueOf(2)); + } else { + e.setTextContent(String.valueOf((long)rowbean.getAvail())); + } + } else { + e.setTextContent("in arrivo"); + } + entryEl.appendChild(e); + boolean gestioneOfferteAttive = true; + if (gestioneOfferteAttive) { + if (rowbean.isPrezzoBarratoValido()) { + e = dom.createElement("OriginalPrice"); + e.setTextContent(String.valueOf(rowbean.getPrezzoIvatoBarrato())); + entryEl.appendChild(e); + e = dom.createElement("Price"); + e.setTextContent(String.valueOf(rowbean.getPrezzoPubblicoIva())); + entryEl.appendChild(e); + } else if (rowbean.getListinoArticoloBase().isOffertaValida()) { + e = dom.createElement("OriginalPrice"); + e.setTextContent(String.valueOf(rowbean.getPrezzoBaseIva())); + entryEl.appendChild(e); + e = dom.createElement("Price"); + e.setTextContent(String.valueOf(rowbean.getPrezzoPubblicoIva())); + entryEl.appendChild(e); + } else { + e = dom.createElement("Price"); + e.setTextContent(String.valueOf(rowbean.getPrezzoPubblicoIva())); + entryEl.appendChild(e); + } + } else { + if (rowbean.isPrezzoBarratoValido()) { + e = dom.createElement("OriginalPrice"); + e.setTextContent(String.valueOf(rowbean.getPrezzoIvatoBarrato())); + entryEl.appendChild(e); + } + e = dom.createElement("Price"); + e.setTextContent(String.valueOf(rowbean.getPrezzoPubblicoIva())); + entryEl.appendChild(e); + } + if (rowbean.getTipo().getTrovaprezziCategoria().isEmpty()) { + e = dom.createElement("Categories"); + e.setTextContent(rowbean.getTipo().getDescrizioneCompletaKeyword("it")); + entryEl.appendChild(e); + } else { + e = dom.createElement("Categories"); + e.setTextContent(rowbean.getTipo().getTrovaprezziCategoria()); + entryEl.appendChild(e); + } + e = dom.createElement("Brand"); + e.setTextContent(rowbean.getMarca().getDescrizione()); + entryEl.appendChild(e); + if (!rowbean.getCodiceEan().isEmpty()) { + e = dom.createElement("EanCode"); + e.setTextContent(rowbean.getCodiceEan()); + entryEl.appendChild(e); + } + Nazione nazione = new Nazione(getApFull()); + nazione.findByPrimaryKey("I"); + e = dom.createElement("ShippingCost"); + if (rowbean.getPercentileSpedizione() <= 100L) { + e.setTextContent(String.valueOf(conIva(nazione.getCostoSpedizione(), (double)rowbean.getIva().getAliquota()))); + } else { + DoubleOperator dop = new DoubleOperator(nazione.getCostoSpedizione()); + dop.multiply(rowbean.getPercentileSpedizione()); + dop.divide(100.0F); + dop.setScale(2, 5); + e.setTextContent(String.valueOf(conIva(dop.getResult(), (double)rowbean.getIva().getAliquota()))); + } + entryEl.appendChild(e); + if (!rowbean.getCodiceProduttore().isEmpty()) { + e = dom.createElement("PartNumber"); + e.setTextContent(rowbean.getCodiceProduttore()); + entryEl.appendChild(e); + } + rootElement.appendChild(entryEl); + continue; + } + ArticoloVarianteCR CRAv = new ArticoloVarianteCR(); + CRAv.setId_articolo(rowbean.getId_articolo()); + CRAv.setFlgQta(CR.getFlgQta()); + CRAv.setQtaDa(CR.getQtaDa()); + CRAv.setQtaA(CR.getQtaA()); + Vectumerator vecAV = new ArticoloVariante(getApFull()).findByCR(CRAv, 0, 0); + while (vecAV.hasMoreElements()) { + ArticoloVariante rowAV = (ArticoloVariante)vecAV.nextElement(); + numRecord++; + org.w3c.dom.Element entryEl = dom.createElement("Offer"); + e = dom.createElement("Code"); + e.setTextContent(rowAV.getCodiceVariante()); + entryEl.appendChild(e); + e = dom.createElement("Name"); + if (!rowAV.getDescTxtLangScript("nomeMarketplaceV", lang).isEmpty()) { + e.setTextContent( + rowAV.getDescTxtLangScript("nomeMarketplaceV", lang).replaceAll("€", "€").replace(";", " ")); + } else { + e.setTextContent(rowAV.getCCNome(lang)); + } + entryEl.appendChild(e); + e = dom.createElement("Description"); + if (!rowAV.getDescrizioneMarketplaceV(lang).isEmpty()) { + e.setTextContent(rowAV.getDescrizioneMarketplaceV(lang)); + } else if (!rowAV.getDescrizioneV(lang).isEmpty()) { + e.setTextContent(rowAV.getDescrizioneV(lang)); + } else { + e.setTextContent(rowAV.getCCNome(lang)); + } + entryEl.appendChild(e); + e = dom.createElement("Link"); + e.setTextContent(wwwSite + wwwSite); + entryEl.appendChild(e); + e = dom.createElement("Image"); + e.setTextContent(wwwSite + "/_img/_imgArt/_var/" + wwwSite); + entryEl.appendChild(e); + for (int i = 2; i <= 10; i++) { + if (new File(getDocBase() + "/_img/_imgArt/_var/" + getDocBase()).exists()) { + e = dom.createElement("Image" + i); + e.setTextContent(wwwSite + "/_img/_imgArt/_var/" + wwwSite); + entryEl.appendChild(e); + } + } + e = dom.createElement("Stock"); + if (rowAV.getAvail() > 0.0D) { + e.setTextContent(String.valueOf((long)rowAV.getAvail())); + } else { + e.setTextContent("in arrivo"); + } + entryEl.appendChild(e); + boolean gestioneOfferteAttive = false; + if (gestioneOfferteAttive) { + if (rowAV.isPrezzoBarratoValido()) { + e = dom.createElement("OriginalPrice"); + e.setTextContent(String.valueOf(rowAV.getPrezzoIvatoBarrato())); + entryEl.appendChild(e); + e = dom.createElement("Price"); + e.setTextContent(String.valueOf(rowAV.getPrezzoPubblicoIva())); + entryEl.appendChild(e); + } else if (rowbean.getListinoArticoloBase().isOffertaValida()) { + e = dom.createElement("OriginalPrice"); + e.setTextContent(String.valueOf(rowAV.getPrezzoBaseIva())); + entryEl.appendChild(e); + e = dom.createElement("Price"); + e.setTextContent(String.valueOf(rowAV.getPrezzoPubblicoIva())); + entryEl.appendChild(e); + } else { + e = dom.createElement("Price"); + e.setTextContent(String.valueOf(rowAV.getPrezzoPubblicoIva())); + entryEl.appendChild(e); + } + } else { + if (rowAV.isPrezzoBarratoValido()) { + e = dom.createElement("OriginalPrice"); + e.setTextContent(String.valueOf(rowAV.getPrezzoIvatoBarrato())); + entryEl.appendChild(e); + } + e = dom.createElement("Price"); + e.setTextContent(String.valueOf(rowAV.getPrezzoPubblicoIva())); + entryEl.appendChild(e); + } + if (rowAV.getTipo().getTrovaprezziCategoria().isEmpty()) { + e = dom.createElement("Categories"); + e.setTextContent(rowAV.getTipo().getDescrizioneCompletaKeyword("it")); + entryEl.appendChild(e); + } else { + e = dom.createElement("Categories"); + e.setTextContent(rowAV.getTipo().getTrovaprezziCategoria()); + entryEl.appendChild(e); + } + e = dom.createElement("Brand"); + e.setTextContent(rowAV.getMarca().getDescrizione()); + entryEl.appendChild(e); + if (!rowbean.getCodiceEan().isEmpty()) { + e = dom.createElement("EanCode"); + e.setTextContent(rowAV.getCodiceEanAv()); + entryEl.appendChild(e); + } + Nazione nazione = new Nazione(getApFull()); + nazione.findByPrimaryKey("I"); + e = dom.createElement("ShippingCost"); + if (rowAV.getPercentileSpedizione() <= 100L) { + e.setTextContent(String.valueOf(conIva(nazione.getCostoSpedizione(), (double)rowbean.getIva().getAliquota()))); + } else { + DoubleOperator dop = new DoubleOperator(nazione.getCostoSpedizione()); + dop.multiply(rowAV.getPercentileSpedizione()); + dop.divide(100.0F); + dop.setScale(2, 5); + e.setTextContent(String.valueOf(conIva(dop.getResult(), (double)rowbean.getIva().getAliquota()))); + } + entryEl.appendChild(e); + } + } + dom.appendChild(rootElement); + Transformer tr = TransformerFactory.newInstance().newTransformer(); + tr.setOutputProperty("indent", "yes"); + tr.setOutputProperty("method", "xml"); + tr.setOutputProperty("encoding", "UTF-8"); + tr.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + tr.transform(new DOMSource(dom), new StreamResult(new FileOutputStream(filename))); + new File(trovaprezziPermanentFileName).delete(); + tr.transform(new DOMSource(dom), new StreamResult(new FileOutputStream(trovaprezziPermanentFileName))); + rp.setStatus(true); + rp.setReturnObj(trovaprezziFile); + rp.setMsg("Generazione file TROVAPREZZI XML " + trovaprezziPermanentFileName + " avvenuta con successo.
Numero Record: " + numRecord); + } catch (ParserConfigurationException|javax.xml.transform.TransformerFactoryConfigurationError|java.io.FileNotFoundException|javax.xml.transform.TransformerException pce) { + rp.setStatus(false); + rp.setMsg("BuildXml: Error trying to instantiate DocumentBuilder " + String.valueOf(pce)); + System.out.println(rp.getMsg()); + } catch (Exception e2) { + rp.setStatus(false); + rp.setMsg("BuildXml: Error trying to instantiate DocumentBuilder " + String.valueOf(e2)); + System.out.println(rp.getMsg()); + } + return rp; + } + + public long getFlgTrovaprezzi() { + return this.flgTrovaprezzi; + } + + public void setFlgTrovaprezzi(long flgTrovaprezzi) { + this.flgTrovaprezzi = flgTrovaprezzi; + } + + public boolean isCostoSpedizionePreventivo(String l_id_nazione) { + if (l_id_nazione.isEmpty()) + l_id_nazione = "I"; + if (getFlgPreventivoWwwArt() == 1L) + return true; + Nazione nazione = new Nazione(getApFull()); + nazione.findByPrimaryKey(l_id_nazione); + if (nazione.getId_nazione().isEmpty()) + return false; + if (nazione.getFlgPreventivoWww() == 1L) + return false; + return (nazione.getFlgPreventivoWww() == 1L); + } + + public long getFlgIdealo() { + return this.flgIdealo; + } + + public void setFlgIdealo(long flgIdealo) { + this.flgIdealo = flgIdealo; + } + + public long getFlgTipoSchedaArticoloWww() { + return this.flgTipoSchedaArticoloWww; + } + + public static final String getTipoSchedaArticoloWww(long l_getFlgTipoSchedaArticoloWww) { + switch ((int)l_getFlgTipoSchedaArticoloWww) { + case -1: + return ""; + case 0: + return "Manuale"; + case 1: + return "ICECAT"; + case 2: + return "Runner"; + case 3: + return "Bestit"; + } + return "??"; + } + + public String getTipoSchedaArticoloWww() { + return getTipoSchedaArticoloWww(getFlgTipoSchedaArticoloWww()); + } + + public void setFlgTipoSchedaArticoloWww(long flgTipoSchedaArticoloWww) { + this.flgTipoSchedaArticoloWww = flgTipoSchedaArticoloWww; + } + + public ResParm unisciArticoliByCodiceEan() { + ResParm rp = new ResParm(); + Vectumerator vec = findCodiciEanDuplicati(); + if (vec == null || vec.getTotNumberOfRecords() == 0) { + rp.appendMsg(" nessun record trovato..."); + } else { + Articolo art1 = null; + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (!row.getCodiceEan().isEmpty()) + unisciArticoliByCodiceEan(row.getCodiceEan()); + } + } + return rp; + } + + public ResParm unisciArticoliByCodiceEan(String l_codiceEan) { + ResParm rp = new ResParm(); + ArticoloCR CR = new ArticoloCR(); + CR.setCodiceEan(l_codiceEan); + Vectumerator vec = findByCR(CR, 0, 0); + if (vec == null || vec.getTotNumberOfRecords() == 0) { + rp.appendMsg(" nessun record trovato....... "); + } else { + ArticoloFornitore af = new ArticoloFornitore(getApFull()); + Articolo art1 = null; + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + System.out.println(row.getCodiceEan()); + if (!row.getCodiceEan().isEmpty()) + if (art1 == null) { + art1 = row; + } else if (row.getFlgEscludiWebArt() == 0L && art1.getFlgEscludiWebArt() != 0L) { + art1 = row; + } else if (row.getReadyForWeb().indexOf("it") >= 0 && art1.getReadyForWeb().indexOf("it") < 0) { + art1 = row; + } + System.out.println("art1: " + art1.getCodice()); + } + vec.moveFirst(); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (row.getId_articolo() != art1.getId_articolo()) + rp = art1.unisciArticolo(row, false, false); + } + rp = af.aggiornaCodiciAlternativiByArticolo(art1, true); + } + return rp; + } + + public ResParm unisciArticolo(Articolo artDaUnire, boolean aggiornaCodiciAlternativi, boolean aggiornaPrezzi) { + ResParm rp = new ResParm(); + if (getId_articolo() > 0L) + if (artDaUnire.getId_articolo() == getId_articolo()) { + rp.setStatus(false); + rp.setMsg("Articolo da unire e articolo principale sono lo stesso!!!"); + } else { + rp = update("UPDATE ARTICOLO_FORNITORE SET id_articolo=" + getId_articolo() + " where id_articolo=" + + artDaUnire.getId_articolo()); + if (!rp.getStatus()) + update("delete from ARTICOLO_FORNITORE WHERE id_articolo=" + artDaUnire.getId_articolo()); + rp.append(update("UPDATE RIGA_DOCUMENTO SET id_articolo=" + + getId_articolo() + " where id_articolo=" + artDaUnire.getId_articolo())); + rp.append(artDaUnire.delete()); + if (aggiornaCodiciAlternativi) + rp.append(aggiornaCodiciAlternativi(true)); + if (aggiornaPrezzi); + } + return rp; + } + + public ResParm aggiornaCodiciAlternativi(boolean salva) { + if (getId_articolo() > 0L) { + ArticoloFornitore af = new ArticoloFornitore(getApFull()); + return af.aggiornaCodiciAlternativiByArticolo(this, salva); + } + return new ResParm(false, "Articolo non valido"); + } + + public Vectumerator findCodiciEanDuplicati() { + String s_Sql_Find = "select A.* from articolo AS A "; + String s_sql_having = " group by A.codiceEan having count(*) >1"; + String s_Sql_Order = " order by codiceEan"; + Vectumerator vec = null; + WcString wc = new WcString(); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_sql_having); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByCodiceProduttoreMarca(String l_codiceProduttore, long l_id_marca) { + String s_Sql_Find = "select A.* from ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codiceProduttore='" + prepareInputMySqlString(l_codiceProduttore, false) + "'"); + if (l_id_marca > 0L) + wc.addWc("A.id_marca=" + l_id_marca); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getSeoTitle(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("seoTitle", lang); + } + + public String getMetaDescription(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("metaDescription", lang); + } + + public String getNomeSeo() { + return (this.nomeSeo == null) ? "" : this.nomeSeo.trim(); + } + + public void setNomeSeo(String nomeSeo) { + this.nomeSeo = nomeSeo; + } + + public String getErroriSeo() { + return (this.erroriSeo == null) ? "" : this.erroriSeo.trim(); + } + + boolean isSeoOk() { + return getErroriSeo().isEmpty(); + } + + public void setErroriSeo(String erroriSeo) { + this.erroriSeo = erroriSeo; + } + + public String getCCTagH1Web(String lang) { + if (getCCTagH1(lang).isEmpty()) + return convertStringToHtml(getCCTagH1Calc(lang)); + return convertStringToHtml(getCCTagH1(lang)); + } + + public String getCCTagH2Calc(String lang) { + String result = getDescrizioneBreveWeb(lang); + if (result.isEmpty()) + result = DBAdapter.eliminaDoppioniTokenInStringa(getTipo().getDescrizioneCompletaSpaces(lang), " "); + return eliminaDoppioniTokenInStringa(result.replace("/", "/ "), " "); + } + + public String getCCTagH1(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("tagH1", lang); + } + + public String getCCTagH2(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("tagH2", lang); + } + + public String getCCMetaDescriptionWeb(String lang) { + if (!getMetaDescription(lang).isEmpty()) + return convertStringToHtml(getMetaDescription(lang)); + return convertStringToHtml(getCCMetaDescriptionCalc(lang)); + } + + public String getCCTagH1Calc(String lang) { + if ((long)getCCNome(lang).length() <= 70L) + return getCCNome(lang); + return getCCNome(lang); + } + + public String getCCTagH2Web(String lang) { + if (getCCTagH2(lang).isEmpty()) + return convertStringToHtml(getCCTagH2Calc(lang)); + return convertStringToHtml(getCCTagH2(lang)); + } + + public String getTFMetaDescriptionCalc(String lang) { + StringBuilder sb = new StringBuilder(); + String modello = getTipo().getMetaDescTemplateLeafWeb(lang); + if (!modello.isEmpty()) { + sb.append(getMarca().getDescrizione()); + sb.append(" "); + if (getDescrizioneBreveWeb(lang).isEmpty()) { + sb.append(getDescrizioneCompleta(lang)); + } else { + sb.append(getDescrizioneBreveWeb(lang)); + } + sb.append(" "); + if (!getCodiceProduttore().isEmpty()) { + sb.append(" "); + sb.append(getCodiceProduttore()); + } + if (isOffertaValida()) { + StringBuilder sb2 = new StringBuilder( + modello.replace("#", eliminaDoppioniInStringa(sb.toString()))); + sb2.append(". "); + sb2.append(translate("Articolo in offerta", lang)); + return sb2.toString(); + } + return modello.replace("#", eliminaDoppioniInStringa(sb.toString())); + } + sb.append(getDescrizioneCompleta("it")); + sb.append(" "); + sb.append(getTipo().getDescrizioneCompleta(lang)); + if (isOffertaValida()) { + sb.append(" "); + sb.append(translate("articolo in offerta", lang)); + } + String result = sb.toString().replace("(", "").replace(")", "").replace("\"", """); + return eliminaDoppioniInStringa(result); + } + + public String getTFMetaDescriptionWeb(String lang) { + if (!getMetaDescription(lang).isEmpty()) + return getMetaDescription(lang); + return getTFMetaDescriptionCalc(lang); + } + + public String getTFSeoTitle(String lang) { + if (!getSeoTitle(lang).isEmpty()) + return getSeoTitle(lang); + return getTFSeoTitleCalc(lang); + } + + public String getTFSeoTitleCalc(String lang) { + return getCCSeoTitleCalc(lang); + } + + public final ResParm startThreadIcecatAuto(ApplParmFull apFull, ArticoloCR CR) { + if (!isThreadCancellazione()) { + new ThreadIcecatAuto(apFull, CR); + return new ResParm(true, "Thread Icecat auto avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public void creaPreviewH(String sizes, int fotoFinale, String TAG_THREAD_MSG, String statusMsg) { + if (!sizes.isEmpty()) { + String targetDir = getDocBase() + getDocBase(); + StringTokenizer st = new StringTokenizer(sizes, ","); + while (st.hasMoreTokens()) { + int size = Integer.parseInt(st.nextToken()); + for (int j = 1; j <= fotoFinale; j++) { + String currentImageName = targetDir + targetDir; + if (new File(currentImageName).exists()) { + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, statusMsg + " crea preview foto " + statusMsg + " size " + j + " ....."); + ScaleImage si = new ScaleImage(currentImageName, "" + size + "H/" + size + "+", 0L, 0, size, false, false); + si.scaleIt(); + } + } + } + } + } + + public String getDescrizionePerMail(boolean intestazione) { + if (intestazione) + return "Tipo|Codice|Nome|Pr. Pubblico|Qta.|Vis.|Fornitore"; + StringBuilder sb = new StringBuilder(); + sb.append(getTipo().getDescrizioneCompletaSpaces("it")); + sb.append("
"); + sb.append(getCategoriaImport()); + sb.append("|"); + sb.append(""); + sb.append(getCodice()); + sb.append(""); + sb.append("|"); + sb.append(""); + sb.append(getNome()); + sb.append(""); + sb.append("|"); + sb.append("Eu "); + sb.append(getNf().format(getPrezzoPubblico())); + sb.append(" ("); + sb.append(getNf().format(getRicaricoEffettivoDaCostoNetto())); + sb.append(" %)"); + sb.append("|"); + sb.append(getQuantita()); + sb.append("|"); + sb.append(getEscludiWeb()); + sb.append("|"); + sb.append(getFornitoreCostoNuovo().getCognome()); + return sb.toString(); + } + + public String getCCLinkDettaglioCanonicalDefault() { + ArticoloCR CR = new ArticoloCR(); + CR.setLang("it"); + return getWwwAddressParm() + getWwwAddressParm(); + } + + public String getCCSeoTitleCalc2(String lang) { + StringBuilder sb = new StringBuilder(); + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + if (!getTipo().getDescrizioneSeo(lang).isEmpty()) { + sb.append(getTipo().getDescrizioneSeo(lang)); + } else { + sb.append(getTipo().getDescrizioneCompletaSpaces(lang)); + } + int sbLen = sb.length() + getCCNome(lang).length(); + if ((long)sbLen < 60L) { + sb.append(" "); + sb.append(getCCNome(lang)); + if ((long)(sb.length() + attivita.getNomeAttivitaSeo().length()) < 60L) { + sb.append(" | "); + sb.append(Attivita.getDefaultInstance(getApFull()).getNomeAttivitaSeo()); + } + } else { + sb.append(" "); + if (!getCodiceProduttore().isEmpty()) { + sb.append(getMarca().getDescrizione()); + sb.append(" "); + sb.append(getCodiceProduttore()); + } else { + sb.append(getCCNome(lang)); + } + if ((long)(sb.length() + attivita.getNomeAttivitaSeo().length()) < 60L) { + sb.append(" | "); + sb.append(Attivita.getDefaultInstance(getApFull()).getNomeAttivitaSeo()); + } + } + return eliminaDoppioniInStringa(sb.toString()); + } + + public String getTFNome(String lang) { + StringBuilder sb = new StringBuilder(); + sb.append(getMarca().getDescrizione()); + sb.append(" "); + if (!getDescrizioneBreve(lang).isEmpty() && getDescrizioneBreve(lang).length() < getNome(lang).length()) { + sb.append(getDescrizioneBreve(lang).replace("/", "/ ")); + } else { + sb.append(getNome(lang).replace("/", "/ ")); + } + return eliminaDoppioniInStringa(sb.toString()); + } + + public String getTFTagH1Web(String lang) { + if (getCCTagH1(lang).isEmpty()) + return convertStringToHtml(getTFTagH1Calc(lang)); + return convertStringToHtml(getCCTagH1(lang)); + } + + public String getTFTagH1Calc(String lang) { + if ((long)getTFNome(lang).length() <= 70L) + return getTFNome(lang); + return getTFNome(lang); + } + + public Date getDataChiamataIcecat() { + return this.dataChiamataIcecat; + } + + public void setDataChiamataIcecat(Date dataChiamataIcecat) { + this.dataChiamataIcecat = dataChiamataIcecat; + } + + public long getHashCodeCurrent() { + return this.hashCodeCurrent; + } + + public void setHashCodeCurrent(long hashCodeCurrent) { + this.hashCodeCurrent = hashCodeCurrent; + } + + public long getHashCodeIndexNow() { + return this.hashCodeIndexNow; + } + + public void setHashCodeIndexNow(long hasCodeIndexNow) { + this.hashCodeIndexNow = hasCodeIndexNow; + } + + public ResParm sendIndexNowUrl() { + ResParm rp = new ResParm(true); + if (getId_articolo() == 0L) { + rp.setStatus(false); + rp.setMsg("Errore! Articolo nullo"); + return rp; + } + if (getFlgEscludiWeb() == 1L || !isReadyForWeb("it")) { + rp.setStatus(false); + rp.setMsg("Errore! Articolo escluso, non pronto oppure non acquistabile."); + return rp; + } + ArticoloCR CR = new ArticoloCR(); + CR.setId_articolo(getId_articolo()); + callIndexNow(CR); + return rp; + } + + public ResParm callIndexNow(ArticoloCR CR) { + boolean debug = false; + CR.setTAG_THREAD_MSG("CALL INDEX NOW"); + StatusMsg.updateMsgByTag(getApFull(), CR.getTAG_THREAD_MSG(), "...inizio ..."); + ResParm rp = new ResParm(); + try { + DBAdapter.printDebug(debug, "callIndexNow --> "); + JSONObject jsonUrls = getIndexNowJson(CR); + if (jsonUrls != null) { + DBAdapter.printDebug(debug, jsonUrls.toString(4)); + CloseableHttpClient client = HttpClients.createDefault(); + HttpPost request = new HttpPost("https://www.bing.com/IndexNow"); + request.setHeader("Content-Type", "application/json; charset=utf-8"); + StringEntity stringEntity = new StringEntity(jsonUrls.toString(4), "UTF-8"); + request.setEntity((HttpEntity)stringEntity); + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + DBAdapter.printDebug(debug, "Status Code: " + statusCode); + DBAdapter.printDebug(debug, "content = " + content); + if (statusCode == 400) { + rp.setStatus(false); + rp.setMsg("Errore!! Bad request Invalid format!"); + } else if (statusCode == 403) { + rp.setStatus(false); + rp.setMsg("Errore!! Forbidden key not valid !"); + } else if (statusCode == 422) { + rp.setStatus(false); + rp.setMsg("Errore!! Unprocessable Entity URLs don’t belong to the host or the key is not matching the schema in the protocol!"); + } else if (statusCode == 429) { + rp.setStatus(false); + rp.setMsg("Errore!! Too Many Requests!"); + } else if (statusCode == 202) { + rp.setStatus(true); + rp.setMsg("Attenzione!! Accepted, IndexNow Key Validation pending!"); + } else if (statusCode == 200) { + rp.setStatus(true); + rp.setMsg("Accepted, URL submitted!"); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE NON GESTITO: status code:" + statusCode); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore!! nessun url da inviare!"); + } + StatusMsg.deleteMsgByTag(getApFull(), CR.getTAG_THREAD_MSG()); + } catch (Exception e) { + DBAdapter.printDebug(true, e.getMessage()); + e.printStackTrace(); + rp.setStatus(false); + rp.setMsg(e.getMessage()); + } + return rp; + } + + private JSONObject getIndexNowJson(ArticoloCR CR) { + boolean debug = false; + DBAdapter.printDebug(debug, "getIndexNowJson"); + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + JSONObject jo = new JSONObject(); + String host = attivita.getWwwAddress(); + host = host.substring(host.indexOf("//") + 2, host.lastIndexOf("/")); + jo.put("host", host); + jo.put("key", attivita.getIndexNowApiKey()); + jo.put("keyLocation", attivita.getIndexNowKeyLocation()); + JSONArray urls = new JSONArray(); + String l_icecatLang = getParm("LANG_AVAILABLE").getTesto(); + if (l_icecatLang.isEmpty()) + l_icecatLang = "it"; + StringTokenizer st = new StringTokenizer(l_icecatLang, ","); + HashSet hsLangs = new HashSet<>(); + while (st.hasMoreTokens()) { + String lang = st.nextToken(); + hsLangs.add(lang); + } + long numMaxUrls = 100L; + if (attivita.getIndexNowDay() == null || getDateDiff(attivita.getIndexNowDay(), getToday()) != 0L) { + numMaxUrls = attivita.getIndexNowUrlQuota() / (long)hsLangs.size(); + } else { + numMaxUrls = (attivita.getIndexNowUrlQuota() - attivita.getIndexNowDayCount()) / (long)hsLangs.size(); + } + DBAdapter.printDebug(debug, "getIndexNowJson: HLANGSIZE:" + hsLangs.size() + " numMaxUrls=" + numMaxUrls); + if (numMaxUrls <= 0L) + return null; + Vectumerator vec = findByCR(CR, 1, (int)numMaxUrls); + int i = 0; + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + if (row.getFlgEscludiWeb() == 0L && row.isReadyForWeb("it")) { + for (String lang : hsLangs) { + urls.put(row.getCCLinkDettaglioCanonical(lang)); + i++; + } + row.updateHashCodeCurrent(); + row.setHashCodeIndexNow(row.getHashCodeCurrent()); + row.superSave(); + StatusMsg.updateMsgByTag(getApFull(), CR.getTAG_THREAD_MSG(), "aggiunto " + i + " url"); + DBAdapter.printDebug(debug, "getIndexNowJson: aggiunto " + i + " url"); + } + } + DBAdapter.printDebug(debug, "getIndexNowJson: tot inviati=" + i); + if (i == 0) + return null; + jo.put("urlList", urls); + if (attivita.getIndexNowDay() == null || getDateDiff(attivita.getIndexNowDay(), getToday()) != 0L) { + attivita.setIndexNowDayCount((long)i); + } else { + attivita.setIndexNowDayCount(attivita.getIndexNowDayCount() + (long)i); + } + attivita.setIndexNowDay(getToday()); + attivita.superSave(); + return jo; + } + + private void updateHashCodeCurrent() { + StringBuilder sb = new StringBuilder(); + sb.append(getNome()); + sb.append("|"); + sb.append(getDescrizioneBreve("it")); + sb.append("|"); + sb.append(getDescrizioneCommerciale("it")); + sb.append("|"); + sb.append(getSpecifiche("it")); + sb.append("|"); + sb.append(getPrezzoBaseIva()); + setHashCodeCurrent((long)sb.toString().hashCode()); + } + + public ResParm creaFileXmlGoogle(ArticoloCR CR, boolean updateFeed, boolean isIdealo) { + String TAG_THREAD_MSG = "GOOGLE MERCHANT CREAZIONE FILE "; + boolean exportGtin = false; + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "creazione file xml...."); + boolean soloLink = false; + int numRecord = 0; + ResParm rp = new ResParm(true); + String tagIdealo = ""; + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + if (isIdealo) { + updateFeed = false; + tagIdealo = "," + attivita.getIdealoTag() + ","; + } + String googleFile = "google_" + System.currentTimeMillis() + ".xml"; + String filename = getDocBase() + getDocBase() + getParm("PATH_TMP").getTesto(); + String googlePermanentFileName = getDocBase() + "_feed/" + getDocBase(); + File xmlFile = new File(filename); + String theDir = xmlFile.getAbsolutePath().substring(0, xmlFile.getAbsolutePath().lastIndexOf(File.separator) + 1); + File theDirFile = new File(theDir); + if (!theDirFile.exists()) + theDirFile.mkdirs(); + new File(filename).delete(); + File theDirFileGoogle = new File(getDocBase() + "_feed/"); + if (!theDirFileGoogle.exists()) + theDirFileGoogle.mkdirs(); + org.w3c.dom.Element e = null; + if (isIdealo) { + CR.setFlgIdealo(1L); + } else { + CR.setFlgGoogle(3L); + } + CR.setFlgReadyForWeb(1L); + CR.setFlgEscludiWeb(0L); + if (CR.getPrezzoDa() == 0.0D) + CR.setPrezzoDa(attivita.getPGooglePrezzoPubblicoMinimoXExport()); + if (CR.getQtaDa() == 0L && + attivita.getPGoogleQtaMinimaXExport() > 0L) { + CR.setQtaDa(attivita.getPGoogleQtaMinimaXExport()); + CR.setFlgQta(1L); + } + Vectumerator vec = findByCR(CR, 0, 0); + String title = getParm("TITLE").getTesto(); + String site = getParm("P_WWW_ADDRESS").getTesto(); + String lang = CR.getLang(); + if (lang.isEmpty()) { + lang = "it"; + CR.setLang(lang); + } + NumberFormat nf2 = NumberFormat.getInstance(Locale.US); + nf2.setMaximumFractionDigits(2); + nf2.setMinimumFractionDigits(2); + String wwwSite = getWwwAddressParm(); + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + try { + DocumentBuilder db = dbf.newDocumentBuilder(); + org.w3c.dom.Document dom = db.newDocument(); + org.w3c.dom.Element rootElement = dom.createElement("feed"); + rootElement.setAttribute("xmlns", "http://www.w3.org/2005/Atom"); + rootElement.setAttribute("xmlns:g", "http://base.google.com/ns/1.0"); + org.w3c.dom.Element titleEl = dom.createElement("title"); + titleEl.setTextContent(title); + rootElement.appendChild(titleEl); + org.w3c.dom.Element linkEl = dom.createElement("link"); + linkEl.setAttribute("rel", "self"); + linkEl.setAttribute("href", site); + rootElement.appendChild(linkEl); + org.w3c.dom.Element updatedEl = dom.createElement("updated"); + updatedEl.setTextContent(getTimestamp().toString()); + rootElement.appendChild(updatedEl); + int currentRecord = 0; + while (vec.hasMoreElements()) { + currentRecord++; + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "creazione file xml...." + currentRecord + " su " + + vec.getTotNumberOfRecords()); + Articolo rowbean = (Articolo)vec.nextElement(); + if (rowbean.getFlgUsaVarianti() == 0L) { + String temp, dispo, condition; + numRecord++; + org.w3c.dom.Element entryEl = dom.createElement("entry"); + e = dom.createElement("g:id"); + e.setTextContent(rowbean.getCodice()); + entryEl.appendChild(e); + e = dom.createElement("g:title"); + if (!rowbean.getDescTxtLangScript("nomeMarketplace", lang).isEmpty()) { + temp = rowbean.getDescTxtLangScript("nomeMarketplace", lang).replaceAll("€", "€").replace(";", " "); + } else { + temp = rowbean.getCCNome(lang); + } + e.setTextContent(convertTo1stCap(temp)); + entryEl.appendChild(e); + if (rowbean.getFlgGoogle() == 1L) { + e = dom.createElement("g:excluded_destination"); + e.setTextContent("Shopping_ads"); + entryEl.appendChild(e); + } + e = dom.createElement("g:description"); + if (!rowbean.getDescrizioneMarketplace(lang).isEmpty()) { + e.setTextContent(rowbean.getDescrizioneMarketplace(lang)); + } else if (!rowbean.getDescrizioneBreve(lang).isEmpty()) { + e.setTextContent(rowbean.getDescrizioneBreve(lang)); + } else { + e.setTextContent(rowbean.getNome(lang)); + } + entryEl.appendChild(e); + if (soloLink) { + e = dom.createElement("g:link"); + e.setTextContent(wwwSite + wwwSite); + entryEl.appendChild(e); + } else { + e = dom.createElement("g:link"); + e.setTextContent(wwwSite + wwwSite + "?utm_source=google_shopping&utm_medium=organic"); + entryEl.appendChild(e); + e = dom.createElement("g:ads_redirect"); + e.setTextContent(wwwSite + wwwSite); + entryEl.appendChild(e); + } + e = dom.createElement("g:image_link"); + e.setTextContent(wwwSite + wwwSite + rowbean.getPathImg()); + entryEl.appendChild(e); + for (int i = 2; i <= 10; i++) { + if (new File(getDocBase() + getDocBase() + getPathImg()).exists()) { + e = dom.createElement("g:additional_image_link"); + e.setTextContent(wwwSite + wwwSite + rowbean.getPathImg()); + entryEl.appendChild(e); + } + } + e = dom.createElement("g:availability"); + switch (rowbean.getDispoLevel()) { + case 0: + dispo = "out of stock"; + break; + case 1: + dispo = "in stock"; + break; + case 2: + dispo = "in stock"; + break; + default: + dispo = ""; + break; + } + e.setTextContent(dispo); + entryEl.appendChild(e); + boolean gestioneOfferteAttive = false; + if (gestioneOfferteAttive) { + if (rowbean.isOffertaValida()) { + e = dom.createElement("g:price"); + e.setTextContent(nf2.format(rowbean.getPrezzoBaseIva()) + " EUR"); + entryEl.appendChild(e); + e = dom.createElement("g:sale_price"); + e.setTextContent(nf2.format(rowbean.getPrezzoPubblicoIva()) + " EUR"); + entryEl.appendChild(e); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); + } else if (rowbean.isPrezzoBarratoValido()) { + e = dom.createElement("g:price"); + e.setTextContent(nf2.format(rowbean.getPrezzoIvatoBarrato()) + " EUR"); + entryEl.appendChild(e); + e = dom.createElement("g:sale_price"); + e.setTextContent(nf2.format(rowbean.getPrezzoPubblicoIva()) + " EUR"); + entryEl.appendChild(e); + } else { + e = dom.createElement("g:price"); + e.setTextContent(nf2.format(rowbean.getPrezzoPubblicoIva()) + " EUR"); + entryEl.appendChild(e); + } + } else { + e = dom.createElement("g:price"); + e.setTextContent(nf2.format(rowbean.getPrezzoPubblicoIva()) + " EUR"); + entryEl.appendChild(e); + } + if (rowbean.getTipo().getId_googleCategory() != 0L) { + e = dom.createElement("g:google_product_category"); + e.setTextContent(String.valueOf(rowbean.getTipo().getGoogleCategory().getCodice())); + entryEl.appendChild(e); + } + e = dom.createElement("g:product_type"); + e.setTextContent(rowbean.getTipo().getDescrizioneCompletaGreater(lang)); + entryEl.appendChild(e); + e = dom.createElement("g:brand"); + e.setTextContent(rowbean.getMarca().getDescrizione()); + entryEl.appendChild(e); + if (!rowbean.getCodiceProduttore().isEmpty()) { + e = dom.createElement("g:mpn"); + e.setTextContent(rowbean.getCodiceProduttore()); + entryEl.appendChild(e); + } + if (!rowbean.getCodiceEan().isEmpty() && exportGtin) { + e = dom.createElement("g:gtin"); + e.setTextContent(rowbean.getCodiceEan()); + entryEl.appendChild(e); + } else { + e = dom.createElement("g:identifier_exists"); + e.setTextContent("no"); + entryEl.appendChild(e); + } + if (rowbean.getStatoUsato().isNuovo()) { + condition = "new"; + } else { + condition = "used"; + } + e = dom.createElement("g:condition"); + e.setTextContent(condition); + entryEl.appendChild(e); + if (!rowbean.getTagArticolo().isEmpty()) { + StringTokenizer st = new StringTokenizer(rowbean.getTagArticolo(), ","); + int j = 0; + while (st.hasMoreTokens() && j <= 4) { + String token = st.nextToken().trim().toLowerCase(); + if (!token.isEmpty()) { + e = dom.createElement("g:custom_label_" + j); + e.setTextContent(token); + entryEl.appendChild(e); + j++; + } + } + } + Nazione nazione = new Nazione(getApFull()); + Vectumerator vecNaz = nazione.findAllAttiveGoogle(lang); + while (vecNaz.hasMoreElements()) { + Nazione rowNaz = (Nazione)vecNaz.nextElement(); + if ((isIdealo && rowNaz.getTag().toLowerCase().indexOf(tagIdealo) >= 0) || !isIdealo) { + org.w3c.dom.Element shippingEl = dom.createElement("g:shipping"); + e = dom.createElement("g:country"); + e.setTextContent(rowNaz.getCodice()); + shippingEl.appendChild(e); + e = dom.createElement("g:price"); + if (rowbean.getPercentileSpedizione() <= 100L) { + e.setTextContent(nf2.format(conIva(rowNaz.getCostoSpedizione(), (double)rowbean.getIva().getAliquota())) + " EUR"); + } else { + DoubleOperator dop = new DoubleOperator(rowNaz.getCostoSpedizione()); + dop.multiply(rowbean.getPercentileSpedizione()); + dop.divide(100.0F); + dop.setScale(2, 5); + e.setTextContent(nf2.format(conIva(dop.getResult(), (double)rowbean.getIva().getAliquota())) + " EUR"); + } + shippingEl.appendChild(e); + entryEl.appendChild(shippingEl); + } + } + rootElement.appendChild(entryEl); + } else { + ArticoloVarianteCR CRAv = new ArticoloVarianteCR(); + CRAv.setId_articolo(rowbean.getId_articolo()); + CRAv.setFlgQta(CR.getFlgQta()); + CRAv.setQtaDa(CR.getQtaDa()); + CRAv.setQtaA(CR.getQtaA()); + Vectumerator vecAV = new ArticoloVariante(getApFull()).findByCR(CRAv, 0, 0); + while (vecAV.hasMoreElements()) { + String dispo, condition; + ArticoloVariante rowAV = (ArticoloVariante)vecAV.nextElement(); + numRecord++; + org.w3c.dom.Element entryEl = dom.createElement("entry"); + e = dom.createElement("g:id"); + e.setTextContent(rowAV.getCodiceVariante()); + entryEl.appendChild(e); + e = dom.createElement("g:title"); + if (!rowAV.getDescTxtLangScript("nomeMarketplaceV", lang).isEmpty()) { + e.setTextContent( + rowAV.getDescTxtLangScript("nomeMarketplaceV", lang).replaceAll("€", "€").replace(";", " ")); + } else { + e.setTextContent(rowAV.getCCNome(lang)); + } + entryEl.appendChild(e); + if (rowAV.getArticolo().getFlgGoogle() == 1L) { + e = dom.createElement("g:excluded_destination"); + e.setTextContent("Shopping_ads"); + entryEl.appendChild(e); + } + e = dom.createElement("g:description"); + if (!rowAV.getDescrizioneMarketplaceV(lang).isEmpty()) { + e.setTextContent(rowAV.getDescrizioneMarketplaceV(lang)); + } else if (!rowAV.getDescrizioneV(lang).isEmpty()) { + e.setTextContent(rowAV.getDescrizioneV(lang)); + } else { + e.setTextContent(rowAV.getCCNome(lang)); + } + entryEl.appendChild(e); + if (soloLink) { + e = dom.createElement("g:link"); + e.setTextContent(wwwSite + wwwSite); + entryEl.appendChild(e); + } else { + e = dom.createElement("g:link"); + e.setTextContent(wwwSite + wwwSite + "?utm_source=google_shopping&utm_medium=organic"); + entryEl.appendChild(e); + e = dom.createElement("g:ads_redirect"); + e.setTextContent(wwwSite + wwwSite); + entryEl.appendChild(e); + } + e = dom.createElement("g:image_link"); + e.setTextContent(wwwSite + wwwSite + rowAV.getPathImg()); + entryEl.appendChild(e); + for (int i = 2; i <= 10; i++) { + if (new File(getDocBase() + getDocBase() + rowAV.getPathImg()).exists()) { + e = dom.createElement("g:additional_image_link"); + e.setTextContent(wwwSite + wwwSite + rowAV.getPathImg()); + entryEl.appendChild(e); + } + } + e = dom.createElement("g:availability"); + switch (rowAV.getDispoLevel()) { + case 0: + dispo = "out of stock"; + break; + case 1: + dispo = "in stock"; + break; + case 2: + dispo = "in stock"; + break; + default: + dispo = ""; + break; + } + e.setTextContent(dispo); + entryEl.appendChild(e); + boolean gestioneOfferteAttive = false; + if (gestioneOfferteAttive) { + if (rowAV.isOffertaValida()) { + e = dom.createElement("g:price"); + e.setTextContent(nf2.format(rowAV.getPrezzoBaseIva()) + " EUR"); + entryEl.appendChild(e); + e = dom.createElement("g:sale_price"); + e.setTextContent(nf2.format(rowAV.getPrezzoPubblicoIva()) + " EUR"); + entryEl.appendChild(e); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); + } else if (rowAV.isPrezzoBarratoValido()) { + e = dom.createElement("g:price"); + e.setTextContent(nf2.format(rowAV.getPrezzoIvatoBarrato()) + " EUR"); + entryEl.appendChild(e); + e = dom.createElement("g:sale_price"); + e.setTextContent(nf2.format(rowAV.getPrezzoPubblicoIva()) + " EUR"); + entryEl.appendChild(e); + } else { + e = dom.createElement("g:price"); + e.setTextContent(nf2.format(rowAV.getPrezzoPubblicoIva()) + " EUR"); + entryEl.appendChild(e); + } + } else { + e = dom.createElement("g:price"); + e.setTextContent(nf2.format(rowAV.getPrezzoPubblicoIva()) + " EUR"); + entryEl.appendChild(e); + } + if (rowAV.getTipo().getId_googleCategory() != 0L) { + e = dom.createElement("g:google_product_category"); + e.setTextContent(String.valueOf(rowAV.getTipo().getGoogleCategory().getCodice())); + entryEl.appendChild(e); + } + e = dom.createElement("g:product_type"); + e.setTextContent(rowAV.getTipo().getDescrizioneCompletaGreater(lang)); + entryEl.appendChild(e); + e = dom.createElement("g:brand"); + e.setTextContent(rowAV.getMarca().getDescrizione()); + entryEl.appendChild(e); + if (!rowAV.getCodiceEanAv().isEmpty() && exportGtin) { + e = dom.createElement("g:gtin"); + e.setTextContent(rowAV.getCodiceEanAv()); + entryEl.appendChild(e); + } else { + e = dom.createElement("g:identifier_exists"); + e.setTextContent("no"); + entryEl.appendChild(e); + } + if (rowbean.getFlgStockOfferte() == 3L) { + condition = "used"; + } else { + condition = "new"; + } + e = dom.createElement("g:condition"); + e.setTextContent(condition); + entryEl.appendChild(e); + if (!rowbean.getTagArticolo().isEmpty()) { + StringTokenizer st = new StringTokenizer(rowbean.getTagArticolo(), ","); + int j = 0; + while (st.hasMoreTokens() && j <= 4) { + String token = st.nextToken().trim().toLowerCase(); + if (!token.isEmpty()) { + e = dom.createElement("g:custom_label_​" + j); + e.setTextContent(token); + entryEl.appendChild(e); + j++; + } + } + } + Nazione nazione = new Nazione(getApFull()); + Vectumerator vecNaz = nazione.findAllAttiveGoogle(lang); + while (vecNaz.hasMoreElements()) { + org.w3c.dom.Element shippingEl = dom.createElement("g:shipping"); + Nazione rowNaz = (Nazione)vecNaz.nextElement(); + e = dom.createElement("g:country"); + e.setTextContent(rowNaz.getCodice()); + shippingEl.appendChild(e); + e = dom.createElement("g:price"); + if (rowbean.getPercentileSpedizione() <= 100L) { + e.setTextContent(nf2.format(conIva(rowNaz.getCostoSpedizione(), (double)rowbean.getIva().getAliquota())) + " EUR"); + } else { + DoubleOperator dop = new DoubleOperator(rowNaz.getCostoSpedizione()); + dop.multiply(rowbean.getPercentileSpedizione()); + dop.divide(100.0F); + dop.setScale(2, 5); + e.setTextContent(nf2.format(conIva(dop.getResult(), (double)rowbean.getIva().getAliquota())) + " EUR"); + } + shippingEl.appendChild(e); + entryEl.appendChild(shippingEl); + } + rootElement.appendChild(entryEl); + } + } + if (updateFeed && !CR.getFileNameGoogle().isEmpty()) { + rowbean.setGoogleFeedFileName(CR.getFileNameGoogle()); + rowbean.superSave(); + } + } + dom.appendChild(rootElement); + Transformer tr = TransformerFactory.newInstance().newTransformer(); + tr.setOutputProperty("indent", "yes"); + tr.setOutputProperty("method", "xml"); + tr.setOutputProperty("encoding", "UTF-8"); + tr.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + tr.transform(new DOMSource(dom), new StreamResult(new FileOutputStream(filename))); + new File(googlePermanentFileName).delete(); + if (!isIdealo && !CR.getFileNameGoogle().isEmpty()) + tr.transform(new DOMSource(dom), new StreamResult(new FileOutputStream(googlePermanentFileName))); + rp.setStatus(true); + rp.setReturnObj(googleFile); + if (isIdealo) { + rp.setMsg("Generazione file IDEALO XML tmp " + filename + " avvenuta con successo.
Numero Record: " + numRecord); + } else { + rp.setMsg("Generazione file GOOGLE XML " + googlePermanentFileName + " avvenuta con successo.
Numero Record: " + numRecord); + } + } catch (ParserConfigurationException|javax.xml.transform.TransformerFactoryConfigurationError|java.io.FileNotFoundException|javax.xml.transform.TransformerException pce) { + rp.setStatus(false); + rp.setMsg("BuildXml: Error trying to instantiate DocumentBuilder " + String.valueOf(pce)); + System.out.println(rp.getMsg()); + } catch (Exception e2) { + rp.setStatus(false); + rp.setMsg("BuildXml: Error trying to instantiate DocumentBuilder " + String.valueOf(e2)); + System.out.println(rp.getMsg()); + } + StatusMsg.deleteMsgByTag(getApFull(), TAG_THREAD_MSG); + return rp; + } + + private String getRecordMicrosoftMerchant(String lang, ArticoloCR CR) { + String temp2, dispo; + StringBuilder temp = new StringBuilder(); + String sep = "/t"; + temp.append(getCodice()); + temp.append(sep); + if (!getDescTxtLangScript("nomeMarketplace", lang).isEmpty()) { + temp2 = getDescTxtLangScript("nomeMarketplace", lang).replaceAll("€", "€").replace(";", " "); + } else { + temp2 = getCCNome(lang); + } + temp.append(convertTo1stCap(temp2)); + temp.append(sep); + temp.append(""); + temp.append(sep); + temp.append(getWwwAddressParm() + getWwwAddressParm()); + temp.append(sep); + temp.append(""); + temp.append(sep); + if (!getDescrizioneMarketplace(lang).isEmpty()) { + temp2 = getDescrizioneMarketplace(lang); + } else if (!getDescrizioneBreve(lang).isEmpty()) { + temp2 = getDescrizioneBreve(lang); + } else { + temp2 = getNome(lang); + } + temp.append(temp2); + temp.append(sep); + temp.append(getWwwAddressParm() + getWwwAddressParm() + getPathImg()); + temp.append(sep); + temp.append(""); + temp.append(sep); + temp.append(""); + temp.append(sep); + switch (getDispoLevel()) { + case 0: + dispo = "out of stock"; + break; + case 1: + dispo = "in stock"; + break; + case 2: + dispo = "in stock"; + break; + default: + dispo = ""; + break; + } + temp.append(dispo); + temp.append(sep); + temp.append(""); + temp.append(sep); + temp.append(""); + temp.append(sep); + temp.append(""); + temp.append(sep); + temp.append(""); + temp.append(sep); + temp.append(""); + temp.append(sep); + temp.append(""); + temp.append(sep); + temp.append(""); + temp.append(sep); + temp.append(""); + temp.append(sep); + temp.append(""); + temp.append(sep); + temp.append(""); + temp.append(sep); + temp.append(""); + temp.append(sep); + temp.append(getPrezzoPubblicoIva()); + temp.append(sep); + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); + temp.append(df.format(getDataCambiamentoPrezzo())); + temp.append(sep); + return temp.toString(); + } + + public static ResParm clearImg(Articolo bean) { + boolean debug = false; + ResParm rp = new ResParm(true); + StringBuilder sb = new StringBuilder(); + int totFile = 0, nonCancellati = 0, cancellati = 0, totSpostati = 0; + ArticoloVariante av = new ArticoloVariante(bean.getApFull()); + String pathImgArt = bean.getParm("PATH_IMG_ART").getTesto(); + sb.append("----------------- clearImg -----------------"); + sb.append("\n"); + boolean isVariante = false; + File directory = new File(bean.getDocBase() + bean.getDocBase()); + System.out.println("clearImg: start cleaning: " + directory.getName()); + if (directory.isDirectory()) { + URI base = directory.toURI(); + Deque queue = new LinkedList<>(); + queue.push(directory); + try { + while (!queue.isEmpty()) { + directory = queue.pop(); + if (directory.getAbsolutePath().indexOf(av.getPathImg()) >= 0) { + isVariante = true; + } else { + isVariante = false; + } + for (File kid : directory.listFiles()) { + String name = base.relativize(kid.toURI()).getPath(); + if (kid.isDirectory()) { + queue.push(kid); + } else { + totFile++; + if (debug) + System.out.print("" + totFile + " " + totFile + " " + cancellati + " - clearImg: checking file " + nonCancellati + ( + isVariante ? "variante " : "")); + sb.append("" + totFile + " " + totFile + " " + cancellati + " - checking file " + nonCancellati + ( + isVariante ? "variante " : "")); + String fileName = kid.getName(); + String[] tokens = kid.getName().split("_"); + if (tokens.length >= 3) { + long currentid; + String currentTs = tokens[1]; + String tempId = tokens[0]; + if (tempId.lastIndexOf("+") >= 0) { + currentid = Long.valueOf(tokens[0].substring(tempId.lastIndexOf("+") + 1)); + } else { + currentid = Long.valueOf(tokens[0]); + } + if (!isVariante) { + bean.findByPrimaryKey(currentid); + if (bean.getId_articolo() == 0L || !bean.getImgTmst().equals(currentTs)) { + if (debug) + System.out.print(" DA CANCELLARE!!!"); + sb.append(" CANCELLATO!!"); + new File(kid.getCanonicalPath()).delete(); + cancellati++; + } else { + nonCancellati++; + if (kid.getCanonicalPath().indexOf(bean.getPathImg()) < 0) { + totSpostati++; + String newImage = kid.getCanonicalPath().replace(pathImgArt, bean.getPathImg()); + System.out.println("" + totFile + " " + totFile + " sposto " + totSpostati + " su\n" + + kid.getCanonicalPath()); + sb.append("\n"); + sb.append(" ---> sposto " + kid.getCanonicalPath() + " su\n" + newImage); + File targetDir = new File(newImage.substring(0, newImage.lastIndexOf(File.separator))); + if (!targetDir.exists()) + targetDir.mkdirs(); + new File(kid.getCanonicalPath()).renameTo(new File(newImage)); + } + } + } + } else { + sb.append("************** FILE NON GESTIBILE " + (isVariante ? "variante " : "") + kid.getCanonicalPath()); + } + if (debug) + System.out.println(); + sb.append("\n"); + } + } + } + } catch (Exception e) { + rp.setStatus(false); + sb.append("Errore!!! "); + sb.append("\n"); + sb.append(e.getMessage()); + sb.append("\n"); + rp.setException(e); + e.printStackTrace(); + } + } + sb.append("\n"); + sb.append("TOTALI CANCELLATI: " + cancellati); + sb.append("\n"); + sb.append("TOTALI NON CANCELLATI: " + nonCancellati); + sb.append("\n"); + sb.append("TOTALI SPOSTATI: " + totSpostati); + rp.setMsg(sb.toString()); + return rp; + } + + public String getPathIdStepDir() { + if (getPathIdStep() <= 0L) + return ""; + if (getId_articolo() == 0L) + System.out.println("pio"); + return "_" + getPathIdStep() * (getId_articolo() / getPathIdStep() + 1L) + "/"; + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico()); + return this.magFisico; + } + + public void setId_magFisico(long id_magFisico) { + this.id_magFisico = id_magFisico; + setMagFisico(null); + } + + public void setMagFisico(MagFisico magFisico) { + this.magFisico = magFisico; + } + + public void creaFileCvsAmazonPrezzoQuantita(ArticoloCR CR) { + try { + Vectumerator list = findByCR(CR, 0, 0); + CR.setFileName( + getPathTmp() + "exportArticoliAmazonPrezzoQuantita_" + getPathTmp() + "_" + getTimeNameForFileUpload() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + NumberFormat nf = NumberFormat.getNumberInstance(Locale.ITALIAN); + DecimalFormat df = (DecimalFormat)nf; + df.applyPattern("###.##"); + String SEP = "\t"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "sku\tprice\tminimum-seller-allowed-price\tmaximum-seller-allowed-price\tquantity\tfulfillment-channel\thandling-time\tminimum_order_quantity_minimum"; + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + Articolo row = (Articolo)list.nextElement(); + s1 = row.getCodiceEanNoZero() + row.getCodiceEanNoZero() + SEP + df.format(row.getPrezzoArticoloAmazonIvaExport("it", 1L)) + SEP + SEP + SEP + (long)row.getQuantita() + SEP + "3"; + outCvsFile.writeLine(s1); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + + public void creaFileCvsAmazon(ArticoloCR CR) { + try { + Vectumerator list = findByCR(CR, 0, 0); + CR.setFileName(getPathTmp() + "exportArticoliAmazon_" + getPathTmp() + "_" + getTimeNameForFileUpload() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = "|"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "Codice" + SEP + "EAN" + SEP + "Titolo" + SEP + "PrezzoPubblico" + SEP + "Dispo"; + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + Articolo row = (Articolo)list.nextElement(); + s1 = row.getCodice() + row.getCodice() + SEP + row.getCodiceEan() + SEP + row.getCCTagH1Web(CR.getLang()) + SEP + row.getPrezzoArticoloAmazonIva().getPrezzoFinale() + SEP + getNf0().format(row.getQuantita()) + SEP + row.getMarca().getDescrizione() + SEP; + outCvsFile.writeLine(s1); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + + public double getPrezzoSuAmzIva() { + return this.prezzoSuAmzIva; + } + + public void setPrezzoSuAmzIva(double prezzoSuAmzIva) { + this.prezzoSuAmzIva = prezzoSuAmzIva; + } + + public long getQtaSuAmz() { + return this.qtaSuAmz; + } + + public void setQtaSuAmz(long qtaSuAmz) { + this.qtaSuAmz = qtaSuAmz; + } + + public String getProductTypeAmz() { + return (this.productTypeAmz == null) ? "" : this.productTypeAmz.trim(); + } + + public void setProductTypeAmz(String productTypeAmz) { + this.productTypeAmz = productTypeAmz; + } + + public String getAsinAmz() { + return (this.asinAmz == null) ? "" : this.asinAmz.trim(); + } + + public void setAsinAmz(String asinAmz) { + this.asinAmz = asinAmz; + } + + public long getFlgPriceTypeAmz() { + return this.flgPriceTypeAmz; + } + + public void setFlgPriceTypeAmz(long flgPriceTypeAmz) { + this.flgPriceTypeAmz = flgPriceTypeAmz; + } + + public String getDescAmz() { + return (this.descAmz == null) ? "" : this.descAmz.trim(); + } + + public void setDescAmz(String descAmz) { + this.descAmz = descAmz; + } + + public long getFlgAmzWarn() { + return this.flgAmzWarn; + } + + public void setFlgAmzWarn(long flgAmzWarn) { + this.flgAmzWarn = flgAmzWarn; + } + + public final ResParm startThreadUpdateOfferAmz(ApplParmFull apFull, ArticoloCR CR, long flgPriceTypeAmz) { + if (!isThreadUpdateOfferAmz()) { + new ThreadUpdOfferAmz(this, apFull, CR, flgPriceTypeAmz); + return new ResParm(true, "Thread update offer amz avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public String getAmzPrezziFoepDesc(String currentLang) { + StringBuilder sb = new StringBuilder(); + AmzFeaturedPrice afp = new AmzFeaturedPrice(getApFull()); + afp.findByArticoloLang(this, currentLang); + if (afp.getId_amzFeaturedPrice() > 0L) { + sb.append("
"); + sb.append("Foep:"); + sb.append(getNf().format(afp.getFeaturedOEPriceAmz())); + sb.append("
"); + sb.append("Cofop:"); + sb.append(getNf().format(afp.getCompetingFOPriceAmz())); + sb.append("
"); + sb.append("Cufop:"); + sb.append(getNf().format(afp.getCurrentFOPriceAmz())); + sb.append("
"); + DoubleOperator l_prezzoPubblico = new DoubleOperator(getPrezzoPubblicoIva()); + l_prezzoPubblico.setScale(2, 5); + l_prezzoPubblico.add(getDeliveryCost(currentLang)); + if (afp.isMyPriceBetter(l_prezzoPubblico.getResult())) { + sb.append("   "); + } else { + sb.append("   "); + } + if (afp.isMyPriceBetter(getPrezzoArticoloAmazonSpedIva("it", true, 1L))) { + sb.append(""); + } else { + sb.append(""); + } + } + return sb.toString(); + } + + public String getAmzPrezziFoepDesc() { + return getAmzPrezziFoepDesc(getCurrentLang()); + } + + public String getAmzPrezziFoepDescInline(String currentLang) { + return getAmzPrezziFoepDesc(currentLang).replace("
", " "); + } + + public String getAmzPrezziFoepDescInline() { + return getAmzPrezziFoepDesc(getCurrentLang()).replace("
", " "); + } + + public ResParm amzPostItemsOffersBatch(ArticoloCR CR, String currentLang) { + ResParm rp = new ResParm(); + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + CR.setFlgAsinAmzNull(1L); + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + rp = row.amzCatalogItem(); + if (!rp.getStatus()) + System.out.println("amzPostItemsOffersBatch amzCatalogItem: " + rp.getErrMsg()); + } + CR.setFlgAsinAmzNull(0L); + vec = findByCR(CR, 1, 1); + if (vec.getTotNumberOfRecords() > 0) { + AmzSellerApi asa = new AmzSellerApi(attivita); + AmzResult aRes = asa.amzPostItemsOffersBatch(CR, currentLang); + if (aRes.isOk()) { + rp.setStatus(true); + rp.setMsg(aRes.getMsg()); + } else { + rp.setStatus(false); + rp.setMsg("Errore! " + aRes.getMsg()); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! non ci sono articoli con asin impostati!"); + } + return rp; + } + + public String getPathImg() { + return getParm("PATH_IMG_ART").getTesto() + getParm("PATH_IMG_ART").getTesto(); + } + + public static boolean isThreadUpdateOfferAmz() { + return threadUpdateOfferAmz; + } + + public static boolean isThreadPostItemOfferAmz() { + return threadPostItemOfferAmz; + } + + public Articolo() {} +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloArticoloComponente.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloArticoloComponente.java new file mode 100644 index 00000000..bdb2465a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloArticoloComponente.java @@ -0,0 +1,121 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ArticoloArticoloComponente extends _ArtAdapter implements Serializable { + private long id_articoloArticoloComponente; + + private long id_articoloComponente; + + private Articolo articolo; + + private Articolo articoloComponente; + + private long id_articolo; + + public ArticoloArticoloComponente(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloArticoloComponente() {} + + public long getId_articoloArticoloComponente() { + return this.id_articoloArticoloComponente; + } + + public void setId_articoloArticoloComponente(long id_articoloComponente) { + this.id_articoloArticoloComponente = id_articoloComponente; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public Vectumerator findByArticolo(long id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_ARTICOLO_COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_articolo = " + id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByArticoloArticoloComponente(long id_articolo, long id_articoloComponente) { + String s_Sql_Find = "select A.* from ARTICOLO_ARTICOLO_COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_articolo = " + id_articolo); + wc.addWc("id_articoloComponente = " + id_articoloComponente); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public double getPercTotale(long id_articolo) { + String s_Sql_Find = "select SUM(A.perc) AS _sum from ARTICOLO_COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_articolo = " + id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public long getId_articoloComponente() { + return this.id_articoloComponente; + } + + public void setId_articoloComponente(long id_articoloComponente) { + this.id_articoloComponente = id_articoloComponente; + setArticoloComponente(null); + } + + public Articolo getArticoloComponente() { + this.articoloComponente = (Articolo)getSecondaryObject(this.articoloComponente, Articolo.class, getId_articoloComponente()); + return this.articoloComponente; + } + + public void setArticoloComponente(Articolo articoloComponente) { + this.articoloComponente = articoloComponente; + } + + public Vectumerator findByArticoloComponente(long l_id_articoloComponente) { + String s_Sql_Find = "select A.* from ARTICOLO_ARTICOLO_COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_articoloComponente = " + l_id_articoloComponente); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloArticoloComponenteCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloArticoloComponenteCR.java new file mode 100644 index 00000000..da3913bd --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloArticoloComponenteCR.java @@ -0,0 +1,40 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloArticoloComponenteCR extends CRAdapter { + private long id_articoloComponente; + + private long id_articolo; + + private Articolo articolo; + + public ArticoloArticoloComponenteCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloArticoloComponenteCR() {} + + public long getId_articoloComponente() { + return this.id_articoloComponente; + } + + public void setId_articoloComponente(long id_articoloComponente) { + this.id_articoloComponente = id_articoloComponente; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + getId_articolo()); + return this.articolo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloCR.java new file mode 100644 index 00000000..ef7967e3 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloCR.java @@ -0,0 +1,2428 @@ +package it.acxent.art; + +import it.acxent.anag.Clifor; +import it.acxent.anag.Iva; +import it.acxent.anag.MagFisico; +import it.acxent.cc.Attivita; +import it.acxent.common.SimboliLavaggio; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.StringTokenizer; +import java.io.Serializable; +import java.net.URLEncoder; +import java.sql.Date; +import java.util.Locale; +import org.apache.commons.lang3.StringUtils; + +public class ArticoloCR extends CRAdapter implements Cloneable, Serializable { + private static final long serialVersionUID = 1750771112188353534L; + + private static final String PAGINA = "pagina"; + + public static final long ORDER_NOME = 0L; + + public static final long ORDER_MARCA = 1L; + + public static final long ORDER_TIPO_NOME_ASC = 2L; + + public static final long ORDER_TIPO_NOME_DESC = 3L; + + public static final long ORDER_TIPO_PREZZO_ASC = 4L; + + public static final long ORDER_TIPO_PREZZO_DESC = 5L; + + public static final long ORDER_CREAZIONE_ASC = 6L; + + public static final long ORDER_DISPO_TIPO_NOME = 7L; + + public static final long ORDER_IMPRESSION_TIME_DESC = 8L; + + public static final long ORDER_IMPRESSION_NUM_DESC = 9L; + + public static final long ORDER_INDEX_NOW = 10L; + + public static final long ORDER_ID = 11L; + + public static final long ORDER_RAND = 99L; + + public static final long TIPO_RICERCA_USA_MAG = 1L; + + public static final long TIPO_RICERCA_VAR = 2L; + + public static final long TIPO_RICERCA_WEB_ART = 10L; + + public static final long TIPO_RICERCA_WEB_ART_VAR = 11L; + + public static final long READY_FOR_WEB_ALL = -1L; + + public static final long READY_FOR_WEB_SI = 1L; + + public static final long READY_FOR_WEB_SI_SEO_KO = 2L; + + public static final long READY_FOR_WEB_NO = 0L; + + public static final long FLG_OFFERTA_NON_VALIDA = 0L; + + public static final long FLG_OFFERTA_VALIDA = 1L; + + public static final long FLG_OFFERTA_SENZA_NESSUNA = 3L; + + public static final long FLG_OFFERTA_SENZA_INTERNA = 4L; + + public static final long FLG_OFFERTA_INTERNA_VALIDA = 11L; + + public static final long FLG_OFFERTA_FORNITORE_VALIDA = 12L; + + public static final long FLG_OFFERTA_INTERNA_NON_VALIDA = 21L; + + public static final long FLG_OFFERTA_FORNITORE_NON_VALIDA = 22L; + + public static final long FLG_PREZZO_COMPETITIVO_AMZ_0 = 0L; + + public static final long FLG_PREZZO_COMPETITIVO_SITO_1 = 1L; + + public static final long FLG_PREZZO_COMPETITIVO_NESSUNO_2 = 2L; + + public static final long FLG_PREZZO_COMPETITIVO_NON_RILEVATO_3 = 3L; + + private long flgDisponibile; + + private long flgOrdinaWww; + + private long flgNascondi = -1L; + + private String flgClienteFornitore; + + private long risoluzioneImmaginiCatalogo; + + private long flgNascondiNew; + + private long flgPriceTypeAmz = -1L; + + private long flgAmzWarn = -1L; + + private long flgAmzFeaturedPriceData = -1L; + + private long flgPrezzoCompetitivo = -1L; + + private long flgAsinAmzNull = -1L; + + private long flgUsaDisponibilita = 0L; + + private String flgOrderType; + + private long id_magFisico; + + private long id_articolo; + + private Articolo articolo; + + private long id_marca; + + private long id_iva; + + private String fileName; + + private String descrizioneTecnica; + + private double prezzoPubblico; + + private String searchTxtWeb; + + private long flgStockOfferte; + + private Date dataFineVld; + + private Marca marca; + + private Iva iva; + + private long id_tipo; + + private long id_tipoMenu; + + private Tipo tipo; + + private Tipo tipoSel; + + private Tipo tipoMenu; + + private long id_disponibilita; + + private String nome; + + private String currentCodice; + + private String codice; + + private long flgOrdinaArticolo = 0L; + + private Date dataScadenzaOfferta; + + private Colore colore; + + private long flgQta; + + private Clifor clifor; + + private long numLabels; + + private long blankLabels; + + private long flgTipoReport = 0L; + + private long id_colore; + + private double percRicaricoEffettivo; + + private long qtaA = 9999L; + + private String compatibilita; + + private long flgTipoRicerca = 0L; + + private long id_clifor; + + private String sitemapFilename; + + private long flgRiordino = -1L; + + private long id_users; + + private long id_caratteristica; + + private String carValS; + + private long id_tipoSel; + + private String carId_listaS; + + private long carValLD; + + private Date carValDate; + + private long carId_lista1; + + private long flgStato = -1L; + + private long flgShowCostoAcquisto; + + private long flgEscludiWeb = -1L; + + private long id_tipoAccessorio; + + private long id_tipoAcc; + + private long id_vetrina = -1L; + + private long id_lista; + + private long id_lista1; + + private long id_lista2; + + private long id_lista3; + + private long id_lista4; + + private long id_caratteristicaValSN1; + + private long id_caratteristicaValSN2; + + private long id_caratteristicaValSN3; + + private long valSN1; + + private long valSN2; + + private long valSN3; + + private long giacenza; + + private Date dataCreazioneDa; + + private Date dataUpdateDa; + + private long flgControlloCostoAggArt = -1L; + + private long flgTipoSchedaArticoloWww = -1L; + + private long lavaggio; + + private long candeggio; + + private long stiratura; + + private long pulituraSecco; + + private long asciugatura; + + private double prezzo; + + private long massaLineare; + + private long altezzaMinima; + + private SimboliLavaggio simboliLavaggio; + + private String composizione; + + private String codiceSerieV; + + private String nomeV; + + private String descrizioneArticolo; + + private MagFisico magFisico; + + public static final String getNoleggio(long l_flgNoleggio) { + return Articolo.getNoleggio(l_flgNoleggio); + } + + public static final String getGoogle(long l_flgGoogle) { + return Articolo.getGoogle(l_flgGoogle); + } + + public final String getGoogle() { + return Articolo.getGoogle(getFlgGoogle()); + } + + public static final void setCCCRFromtFiltriId(ArticoloCR CR) { + if (!CR.getFiltri_id().isEmpty()) { + String filtri = "m,pd,pa,c,d,"; + StringTokenizer st = new StringTokenizer(CR.getFiltri_id(), ","); + String currentFiltro = ""; + StringBuilder currentValues = new StringBuilder(); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + if (filtri.contains(token + ",")) { + updateCCCRFiltri(CR, currentFiltro, currentValues.toString()); + currentFiltro = token; + currentValues = new StringBuilder(); + continue; + } + currentValues.append(token); + currentValues.append(","); + } + updateCCCRFiltri(CR, currentFiltro, currentValues.toString()); + } + } + + public static final String getTipoSchedaArticoloWww(long l_flgTipoSchedaArticoloWww) { + return Articolo.getTipoSchedaArticoloWww(l_flgTipoSchedaArticoloWww); + } + + public String getTipoSchedaArticoloWww() { + return Articolo.getTipoSchedaArticoloWww(getFlgTipoSchedaArticoloWww()); + } + + protected static final void updateCCCRFiltri(ArticoloCR CR, String currentFiltro, String currentValues) { + if (currentValues.endsWith(",")) + currentValues = currentValues.substring(0, currentValues.length() - 1); + if (!currentFiltro.isEmpty() && !currentValues.isEmpty()) + if (currentFiltro.toLowerCase().equals("m")) { + CR.setId_marche(currentValues); + } else if (currentFiltro.toLowerCase().equals("pd")) { + CR.setPrezzoDa((double)Long.parseLong(currentValues)); + } else if (currentFiltro.toLowerCase().equals("pa")) { + CR.setPrezzoA((double)Long.parseLong(currentValues)); + } else if (currentFiltro.toLowerCase().equals("c")) { + CR.setFlgCondizioni(currentValues); + } else if (currentFiltro.toLowerCase().equals("d")) { + CR.setFlgDisponibilita(currentValues); + } + } + + public static final void setCCFiltriIdFromCR(ArticoloCR CR) { + StringBuilder sb = new StringBuilder(); + if (!CR.getId_marche().isEmpty()) { + sb.append("M,"); + StringTokenizer st = new StringTokenizer(CR.getId_marche(), ","); + while (st.hasMoreTokens()) { + sb.append(st.nextToken()); + if (st.hasMoreTokens()) + sb.append(", "); + } + } + CR.setFiltri_id(sb.toString()); + } + + public ArticoloCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloCR() {} + + public static final String getPercRicaricoEffettivoLike(long l_flgPercRicaricoEffettivoLike) { + if (l_flgPercRicaricoEffettivoLike == 0L) + return " "; + if (l_flgPercRicaricoEffettivoLike == 1L) + return ">="; + if (l_flgPercRicaricoEffettivoLike == 2L) + return "<="; + if (l_flgPercRicaricoEffettivoLike == 3L) + return "=="; + return " "; + } + + public static final String getModImportazione(long l_flgModIMportazione) { + return Articolo.getModImportazione(l_flgModIMportazione); + } + + public String getModImportazione() { + return Articolo.getModImportazione(getFlgModImportazione()); + } + + public String getEscludiWeb() { + return getEscludiWeb(getFlgEscludiWeb()); + } + + public static final String getOrderBy(long l_flgOrderBy) { + if (l_flgOrderBy == 6L) + return "Creazione"; + if (l_flgOrderBy == 7L) + return "Dispo-tipo-nome"; + if (l_flgOrderBy == 8L) + return "Imp. Time desc"; + if (l_flgOrderBy == 9L) + return "Imp. Num. desc"; + if (l_flgOrderBy == 10L) + return "Index Now (hashcode)"; + if (l_flgOrderBy == 1L) + return "Marca"; + if (l_flgOrderBy == 0L) + return "Nome"; + if (l_flgOrderBy == 2L) + return "Tipo-nome "; + if (l_flgOrderBy == 3L) + return "Tipo-nome desc"; + if (l_flgOrderBy == 4L) + return "Tip-Prezzo"; + if (l_flgOrderBy == 5L) + return "Tipo-Prezzo desc"; + if (l_flgOrderBy == -1L) + return ""; + return "??" + l_flgOrderBy; + } + + public String getDisponibilitaWeb() { + return Articolo.getDisponibilitaWeb(getFlgDisponibilitaWeb()); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setId_marca(long newId_marca) { + this.id_marca = newId_marca; + setMarca(null); + } + + public void setId_iva(long newId_iva) { + this.id_iva = newId_iva; + setIva(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setDescrizioneTecnica(String newDescrizioneTecnica) { + this.descrizioneTecnica = newDescrizioneTecnica; + } + + public void setPrezzoPubblico(double newPrezzoPubblico) { + this.prezzoPubblico = newPrezzoPubblico; + } + + public void setGiacenza(long newGiacenza) { + this.giacenza = newGiacenza; + } + + public void setFlgStockOfferte(long newFlgStockOfferte) { + this.flgStockOfferte = newFlgStockOfferte; + } + + public void setDataFineVld(Date newDataFineVld) { + this.dataFineVld = newDataFineVld; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_marca() { + return this.id_marca; + } + + public long getId_iva() { + return this.id_iva; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public String getDescrizioneTecnica() { + return (this.descrizioneTecnica == null) ? "" : this.descrizioneTecnica; + } + + public double getPrezzoPubblico() { + return this.prezzoPubblico; + } + + public long getGiacenza() { + return this.giacenza; + } + + public long getFlgStockOfferte() { + return this.flgStockOfferte; + } + + public Date getDataFineVld() { + return this.dataFineVld; + } + + public void setMarca(Marca newMarca) { + this.marca = newMarca; + } + + public Marca getMarca() { + return (Marca)getSecondaryObject(this.marca, Marca.class, new Long(getId_marca())); + } + + public void setIva(Iva newIva) { + this.iva = newIva; + } + + public Iva getIva() { + return (Iva)getSecondaryObject(this.iva, Iva.class, new Long(getId_iva())); + } + + public long getFlgNascondi() { + return this.flgNascondi; + } + + public void setFlgNascondi(long l) { + this.flgNascondi = l; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo()); + return this.tipo; + } + + public void setId_tipo(long id_tipo) { + this.id_tipo = id_tipo; + setTipo(null); + } + + public void setTipo(Tipo tipo) { + this.tipo = tipo; + } + + public long getFlgNascondiNew() { + return this.flgNascondiNew; + } + + public void setFlgNascondiNew(long flgNascondiNew) { + this.flgNascondiNew = flgNascondiNew; + } + + public long getId_tipoSel() { + return this.id_tipoSel; + } + + public void setId_tipoSel(long id_tipoSel) { + this.id_tipoSel = id_tipoSel; + setTipoSel(null); + } + + public long getId_tipoMenu() { + return this.id_tipoMenu; + } + + public void setId_tipoMenu(long id_tipoMenu) { + this.id_tipoMenu = id_tipoMenu; + setTipoMenu(null); + } + + public Tipo getTipoSel() { + this.tipoSel = (Tipo)getSecondaryObject(this.tipoSel, Tipo.class, getId_tipoSel()); + return this.tipoSel; + } + + public void setTipoSel(Tipo tipoSel) { + this.tipoSel = tipoSel; + } + + public Tipo getTipoMenu() { + this.tipoMenu = (Tipo)getSecondaryObject(this.tipoMenu, Tipo.class, getId_tipoMenu()); + return this.tipoMenu; + } + + public void setTipoMenu(Tipo tipoMenu) { + this.tipoMenu = tipoMenu; + } + + public long getId_disponibilita() { + return this.id_disponibilita; + } + + public void setId_disponibilita(long id_disponibilita) { + this.id_disponibilita = id_disponibilita; + } + + public String getFlgOrderType() { + return (this.flgOrderType == null) ? AB_EMPTY_STRING : this.flgOrderType; + } + + public void setFlgOrderType(String flgOrderType) { + this.flgOrderType = flgOrderType; + } + + public String getCurrentCodice() { + return (this.currentCodice == null) ? AB_EMPTY_STRING : this.currentCodice; + } + + public void setCurrentCodice(String l_currentCodice) { + this.currentCodice = l_currentCodice; + } + + public String getNome() { + return (this.nome == null) ? AB_EMPTY_STRING : this.nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public String getCodice() { + return (this.codice == null) ? AB_EMPTY_STRING : this.codice.trim(); + } + + public void setCodice(String codice) { + this.codice = codice; + } + + public long getFlgDisponibile() { + return this.flgDisponibile; + } + + public String getFlgDisponibileLinkCode() { + return (getFlgDisponibile() == 1L) ? "d" : AB_EMPTY_STRING; + } + + public void setFlgDisponibile(long flgDisponibile) { + this.flgDisponibile = flgDisponibile; + } + + public long getFlgOrdinaArticolo() { + return this.flgOrdinaArticolo; + } + + public void setFlgOrdinaArticolo(long flgOrdinaArticolo) { + this.flgOrdinaArticolo = flgOrdinaArticolo; + } + + public Date getDataScadenzaOfferta() { + return this.dataScadenzaOfferta; + } + + public void setDataScadenzaOfferta(Date dataScadenzaOfferta) { + this.dataScadenzaOfferta = dataScadenzaOfferta; + } + + public long getFlgUsaDisponibilita() { + return this.flgUsaDisponibilita; + } + + public void setFlgUsaDisponibilita(long flgUsaDisponibilita) { + this.flgUsaDisponibilita = flgUsaDisponibilita; + } + + public Colore getColore() { + this.colore = (Colore)getSecondaryObject(this.colore, Colore.class, getId_colore()); + return this.colore; + } + + public long getId_colore() { + return this.id_colore; + } + + public void setColore(Colore newColore) { + this.colore = newColore; + } + + public void setId_colore(long newId_colore) { + this.id_colore = newId_colore; + setColore(null); + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + setClifor(null); + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setClifor(Clifor clifor) { + this.clifor = clifor; + } + + public long getNumLabels() { + return this.numLabels; + } + + public void setNumLabels(long numLabels) { + this.numLabels = numLabels; + } + + public long getBlankLabels() { + return this.blankLabels; + } + + public void setBlankLabels(long blankLabels) { + this.blankLabels = blankLabels; + } + + public long getFlgTipoRicerca() { + return this.flgTipoRicerca; + } + + public void setFlgTipoRicerca(long flgUsaMag) { + this.flgTipoRicerca = flgUsaMag; + } + + public long getFlgQta() { + return this.flgQta; + } + + public void setFlgQta(long flgQta) { + this.flgQta = flgQta; + } + + public long getQtaDa() { + return this.qtaDa; + } + + public void setQtaDa(long qtaDa) { + this.qtaDa = qtaDa; + } + + public long getQtaA() { + return this.qtaA; + } + + public void setQtaA(long qtaA) { + this.qtaA = qtaA; + } + + public String getFlgClienteFornitore() { + return (this.flgClienteFornitore == null) ? AB_EMPTY_STRING : this.flgClienteFornitore.trim(); + } + + public void setFlgClienteFornitore(String flgClienteFornitore) { + this.flgClienteFornitore = flgClienteFornitore; + } + + public String getCompatibilita() { + return (this.compatibilita == null) ? AB_EMPTY_STRING : this.compatibilita.trim(); + } + + public void setCompatibilita(String compatibilita) { + this.compatibilita = compatibilita; + } + + public long getFlgTipoReport() { + return this.flgTipoReport; + } + + public void setFlgTipoReport(long flgTipoReport) { + this.flgTipoReport = flgTipoReport; + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public void setId_magFisico(long id_magFisico) { + this.id_magFisico = id_magFisico; + } + + public String getFiltroCR() { + String temp = "" + getId_lista1() + "-" + getId_lista1() + "-" + getId_lista2() + "-" + getId_lista3() + "-" + getId_lista4() + "-" + + getId_caratteristicaValSN1() + "-" + getValSN1() + "-" + getId_caratteristicaValSN2() + "-" + getValSN2() + "-" + + getId_caratteristicaValSN3(); + if (temp.equals("0-0-0-0-0-0-0-0-0-0")) + return AB_EMPTY_STRING; + return temp; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public long getFlgRiordino() { + return this.flgRiordino; + } + + public void setFlgRiordino(long flgRiordino) { + this.flgRiordino = flgRiordino; + } + + public long getId_users() { + return this.id_users; + } + + public void setId_users(long id_users) { + this.id_users = id_users; + } + + public long getId_caratteristica() { + return this.id_caratteristica; + } + + public void setId_caratteristica(long id_caratteristica) { + this.id_caratteristica = id_caratteristica; + } + + public String getCarValS() { + return this.carValS; + } + + public void setCarValS(String carValS) { + this.carValS = carValS; + } + + public long getCarValLD() { + return this.carValLD; + } + + public void setCarValLD(long carValLD) { + this.carValLD = carValLD; + } + + public Date getCarValDate() { + return this.carValDate; + } + + public void setCarValDate(Date carValDate) { + this.carValDate = carValDate; + } + + public long getCarId_lista() { + return this.carId_lista; + } + + public void setCarId_lista(long carId_lista) { + this.carId_lista = carId_lista; + } + + public long getCarId_lista1() { + return this.carId_lista1; + } + + public void setCarId_lista1(long carId_lista1) { + this.carId_lista1 = carId_lista1; + } + + public long getFlgStato() { + return this.flgStato; + } + + public void setFlgStato(long flgStato) { + this.flgStato = flgStato; + } + + public long getFlgShowCostoAcquisto() { + return this.flgShowCostoAcquisto; + } + + public void setFlgShowCostoAcquisto(long flgShowCostoAcquisto) { + this.flgShowCostoAcquisto = flgShowCostoAcquisto; + } + + public long getFlgEscludiWeb() { + return this.flgEscludiWeb; + } + + public void setFlgEscludiWeb(long flgEscludiWeb) { + this.flgEscludiWeb = flgEscludiWeb; + } + + public long getId_tipoAccessorio() { + return this.id_tipoAccessorio; + } + + public void setId_tipoAccessorio(long id_tipoAccessorio) { + this.id_tipoAccessorio = id_tipoAccessorio; + } + + public long getId_tipoAcc() { + return this.id_tipoAcc; + } + + public void setId_tipoAcc(long id_tipoAcc) { + this.id_tipoAcc = id_tipoAcc; + } + + public long getId_vetrina() { + return this.id_vetrina; + } + + public void setId_vetrina(long flgVetrina) { + this.id_vetrina = flgVetrina; + setVetrina(null); + } + + public long getId_lista() { + return this.id_lista; + } + + public void setId_lista(long id_lista) { + this.id_lista = id_lista; + } + + public long getId_lista1() { + return this.id_lista1; + } + + public void setId_lista1(long id_lista1) { + this.id_lista1 = id_lista1; + } + + public long getId_lista2() { + return this.id_lista2; + } + + public void setId_lista2(long id_lista2) { + this.id_lista2 = id_lista2; + } + + public long getId_lista3() { + return this.id_lista3; + } + + public void setId_lista3(long id_lista3) { + this.id_lista3 = id_lista3; + } + + public long getId_lista4() { + return this.id_lista4; + } + + public void setId_lista4(long id_lista4) { + this.id_lista4 = id_lista4; + } + + public long getValSN1() { + return this.valSN1; + } + + public void setValSN1(long valSN1) { + this.valSN1 = valSN1; + } + + public long getValSN2() { + return this.valSN2; + } + + public void setValSN2(long valSN2) { + this.valSN2 = valSN2; + } + + public long getValSN3() { + return this.valSN3; + } + + public void setValSN3(long valSN3) { + this.valSN3 = valSN3; + } + + public long getId_caratteristicaValSN1() { + return this.id_caratteristicaValSN1; + } + + public void setId_caratteristicaValSN1(long id_caratteristicaValSN1) { + this.id_caratteristicaValSN1 = id_caratteristicaValSN1; + } + + public long getId_caratteristicaValSN2() { + return this.id_caratteristicaValSN2; + } + + public void setId_caratteristicaValSN2(long id_caratteristicaValSN2) { + this.id_caratteristicaValSN2 = id_caratteristicaValSN2; + } + + public long getId_caratteristicaValSN3() { + return this.id_caratteristicaValSN3; + } + + public void setId_caratteristicaValSN3(long id_caratteristicaValSN3) { + this.id_caratteristicaValSN3 = id_caratteristicaValSN3; + } + + public String getFileName() { + return (this.fileName == null) ? AB_EMPTY_STRING : this.fileName.trim(); + } + + public String getSearchTxtWeb() { + return (this.searchTxtWeb == null) ? AB_EMPTY_STRING : this.searchTxtWeb.trim(); + } + + public void setSearchTxtWeb(String searchTxtWeb) { + this.searchTxtWeb = searchTxtWeb; + } + + private long flgWebNoVendita = -1L; + + private Date dataMovimento; + + private TipoAccessorio tipoAccessorio; + + private Vetrina vetrina; + + private long flgEbayPubblicato = -1L; + + private long id_articoloVariante; + + private long carId_lista; + + private long flgTipoVisualizzazione = 0L; + + private long flgNoleggio; + + private String filtri_id; + + private String id_marche; + + private String flgCondizioni; + + private String flgDisponibilita; + + private double prezzoDa; + + private double prezzoA; + + private long flgKit = -1L; + + private double prezzoMax; + + private double prezzoMin; + + private String tag; + + private long flgUsato = -1L; + + private long flgContoVendita = -1L; + + private long flgEbay = -1L; + + private long flgGoogle = -1L; + + private String codiceEan; + + private String nMatricola; + + private String scaffale; + + private long flgInEsaurimento = -1L; + + private long flgRateale0 = -1L; + + private Date dataDocumentoA; + + private Date dataDocumentoDa; + + private long flgDisponibilitaWeb = -1L; + + private long flgModImportazione = -1L; + + private long flgSubito = -1L; + + private String tagArticolo; + + private String codicePromozioneA; + + private long id_fornitore; + + private Clifor fornitore; + + private long id_fornitoreUsato; + + private Clifor fornitoreUsato; + + private long flgPercRicaricoEffettivoLike = -1L; + + public double getPercRicaricoEffettivo() { + return this.percRicaricoEffettivo; + } + + public void setPercRicaricoEffettivo(double percRicaricoEffettivo) { + this.percRicaricoEffettivo = percRicaricoEffettivo; + } + + public long getFlgPercRicaricoEffettivoLike() { + return this.flgPercRicaricoEffettivoLike; + } + + public void setFlgPercRicaricoEffettivoLike(long flgPercRicaricoEffettivo) { + this.flgPercRicaricoEffettivoLike = flgPercRicaricoEffettivo; + } + + private long qtaDa = 1L; + + private String fileNameMs; + + private String googleFeedFileName; + + private ArticoloVariante articoloVarianteKit; + + private long id_articoloVarianteKit; + + private ArticoloTaglia articoloTaglia; + + private long id_articoloTaglia; + + private ArticoloVariante articoloVariante; + + private long id_taglia; + + private Taglia taglia; + + private String descrizione; + + private long flgReadyForWeb = -1L; + + private String langReadyForWeb = Locale.ITALY.getCountry(); + + private String lastItems; + + private long countImpressionA; + + private long countImportNonTrovatoA; + + private long flgArticoloComponente = -1L; + + private long id_articoloEscluso; + + private long id_statoUsato; + + private StatoUsato statoUsato; + + private Date dataCreazioneA; + + private Clifor fornitoreCostoNuovo; + + private long id_fornitoreCostoNuovo; + + private Date dataDocumentoUsatoA; + + private long flgOfferta = -1L; + + private String categoriaImport; + + private long flgAmazon = -1L; + + private long flgTrovaprezzi = -1L; + + private String fileNameTrovaprezzi; + + private String fileNameIdealo; + + private long flgIdealo = -1L; + + private long countImportNonTrovatoDa; + + private long countImpressionDa; + + private long flgSitemapType = 0L; + + private long flgIcecatAuto = -1L; + + private long countGgNoImportDa; + + private String countGgNoImportDaA; + + private long countGgNoImportA; + + private String fileNameGoogle; + + public void setLavaggio(long newLavaggio) { + this.lavaggio = newLavaggio; + } + + public void setCandeggio(long newCandeggio) { + this.candeggio = newCandeggio; + } + + public void setStiratura(long newStiratura) { + this.stiratura = newStiratura; + } + + public void setPulituraSecco(long newPulituraSecco) { + this.pulituraSecco = newPulituraSecco; + } + + public void setAsciugatura(long newAsciugatura) { + this.asciugatura = newAsciugatura; + } + + public void setMassaLineare(long newMassaLineare) { + this.massaLineare = newMassaLineare; + } + + public void setAltezzaMinima(long newAltezzaMinima) { + this.altezzaMinima = newAltezzaMinima; + } + + public long getLavaggio() { + return this.lavaggio; + } + + public long getCandeggio() { + return this.candeggio; + } + + public long getStiratura() { + return this.stiratura; + } + + public long getPulituraSecco() { + return this.pulituraSecco; + } + + public long getAsciugatura() { + return this.asciugatura; + } + + public long getMassaLineare() { + return this.massaLineare; + } + + public long getAltezzaMinima() { + return this.altezzaMinima; + } + + public String getCodiceSerieV() { + return (this.codiceSerieV == null) ? AB_EMPTY_STRING : this.codiceSerieV; + } + + public void setCodiceSerieV(String codiceSerieV) { + this.codiceSerieV = codiceSerieV; + } + + public String getNomeV() { + return (this.nomeV == null) ? AB_EMPTY_STRING : this.nomeV; + } + + public void setNomeV(String nomeV) { + this.nomeV = nomeV; + } + + public String getDescrizioneArticolo() { + return (this.descrizioneArticolo == null) ? AB_EMPTY_STRING : this.descrizioneArticolo; + } + + public void setDescrizioneArticolo(String descrizioneArticolo) { + this.descrizioneArticolo = descrizioneArticolo; + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, new Long(getId_magFisico())); + return this.magFisico; + } + + public void setMagFisico(MagFisico magFisico) { + this.magFisico = magFisico; + } + + public long getFlgWebNoVendita() { + return this.flgWebNoVendita; + } + + public void setFlgWebNoVendita(long flgWebNoVendita) { + this.flgWebNoVendita = flgWebNoVendita; + } + + public Date getDataMovimento() { + return this.dataMovimento; + } + + public void setDataMovimento(Date dataMovimento) { + this.dataMovimento = dataMovimento; + } + + public String getDescrizioneCR() { + StringBuilder temp = new StringBuilder(); + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + if (getId_magFisico() != 0L) + temp.append("Magazzino: " + getMagFisico().getDescrizione() + " - "); + if (!getCodice().isEmpty()) + temp.append("Codice: " + getCodice() + " - "); + if (!getSearchTxt().isEmpty() && !getSearchTxt().equals("*")) + temp.append("Nome Prodotto: " + getSearchTxt() + " - "); + if (!getCompatibilita().isEmpty()) + temp.append("Compatibilita': " + getCompatibilita() + " - "); + if (getFlgQta() > 0L) + temp.append("Quantità da " + getQtaDa() + " a " + getQtaA() + " - "); + if (getDataMovimento() != null) + temp.append("Fino a data movimento': " + df.format(getDataMovimento()) + " - "); + if (!getScaffale().isEmpty()) + temp.append("Scaffale: " + getScaffale() + " "); + if (getId_tipo() != 0L) + temp.append("Tipo: " + getTipo().getDescrizioneRPdf() + " - "); + if (getId_marca() != 0L) + temp.append("Marca: " + getMarca().getDescrizione() + " - "); + if (getFlgRiordino() == 1L) + temp.append("Articoli da riordinare - "); + if (getId_tipoAccessorio() != 0L) + temp.append("Tipo Accessorio: " + getTipoAccessorio().getDescrizione() + " - "); + if (getId_vetrina() != 0L) + temp.append("Vetrina: " + getVetrina().getDescrizione() + " - "); + if (getFlgStockOfferte() > 0L) + temp.append("Stock/Offerte: " + getStockOfferte(getFlgStockOfferte()) + " - "); + if (getFlgNascondi() > 0L) + temp.append("Nascondi: " + getFlgNascondi() + " - "); + return temp.toString(); + } + + public TipoAccessorio getTipoAccessorio() { + this.tipoAccessorio = (TipoAccessorio)getSecondaryObject(this.tipoAccessorio, TipoAccessorio.class, getId_tipoAccessorio()); + return this.tipoAccessorio; + } + + public Vetrina getVetrina() { + this.vetrina = (Vetrina)getSecondaryObject(this.vetrina, Vetrina.class, getId_vetrina()); + return this.vetrina; + } + + public void setTipoAccessorio(TipoAccessorio tipoAccessorio) { + this.tipoAccessorio = tipoAccessorio; + setTipoAccessorio(null); + } + + public void setVetrina(Vetrina vetrina) { + this.vetrina = vetrina; + } + + public long getFlgArticoloComponente() { + return this.flgArticoloComponente; + } + + public void setFlgArticoloComponente(long flgArticoloComponente) { + this.flgArticoloComponente = flgArticoloComponente; + } + + public long getFlgOrdinaWww() { + return this.flgOrdinaWww; + } + + public ArticoloCR getClone() throws CloneNotSupportedException { + return (ArticoloCR)clone(); + } + + public void setFlgOrdinaWww(long flgOrdinaWww) { + this.flgOrdinaWww = flgOrdinaWww; + } + + public long getRisoluzioneImmaginiCatalogo() { + return this.risoluzioneImmaginiCatalogo; + } + + public void setRisoluzioneImmaginiCatalogo(long risoluzioneImmaginiCatalogo) { + this.risoluzioneImmaginiCatalogo = risoluzioneImmaginiCatalogo; + } + + public String getCarId_listaS() { + return (this.carId_listaS == null) ? AB_EMPTY_STRING : this.carId_listaS.trim(); + } + + public void setCarId_listaS(String carId_listaS) { + this.carId_listaS = carId_listaS; + } + + public boolean isGoogleTranslatorEnable() { + return getParm("USE_GOOGLE_TRANSLATOR").isTrue(); + } + + public long getFlgTipoVisualizzazione() { + return this.flgTipoVisualizzazione; + } + + public void setFlgTipoVisualizzazione(long flgTipoVisualizzazione) { + this.flgTipoVisualizzazione = flgTipoVisualizzazione; + } + + public long getFlgNoleggio() { + return this.flgNoleggio; + } + + public void setFlgNoleggio(long flgNoleggio) { + this.flgNoleggio = flgNoleggio; + } + + public static final String getStockOfferte(long l_flgStockOfferte) { + return Articolo.getStockOfferte(l_flgStockOfferte); + } + + public String getFiltri_id() { + return (this.filtri_id == null) ? AB_EMPTY_STRING : this.filtri_id.trim(); + } + + public void setFiltri_id(String filtri_id) { + this.filtri_id = filtri_id; + } + + public String getId_marche() { + return (this.id_marche == null) ? AB_EMPTY_STRING : this.id_marche.trim(); + } + + public void setId_marche(String id_marche) { + this.id_marche = id_marche; + } + + public String getFlgDisponibilita() { + return (this.flgDisponibilita == null) ? AB_EMPTY_STRING : this.flgDisponibilita.trim(); + } + + public void setFlgDisponibilita(String flgDisponibilita) { + this.flgDisponibilita = flgDisponibilita; + } + + public String getFlgCondizioni() { + return (this.flgCondizioni == null) ? AB_EMPTY_STRING : this.flgCondizioni.trim(); + } + + public void setFlgCondizioni(String flgCondizioni) { + this.flgCondizioni = flgCondizioni; + } + + public String getPrezzoDaS() { + if (getPrezzoDa() == 0.0D) + return AB_EMPTY_STRING; + return String.valueOf((long)getPrezzoDa()); + } + + public void setPrezzoDa(double prezzoDa) { + this.prezzoDa = prezzoDa; + } + + public double getPrezzoA() { + return this.prezzoA; + } + + public void setPrezzoA(double prezzoA) { + this.prezzoA = prezzoA; + } + + public String getPrezzoAS() { + if (getPrezzoA() == 0.0D) + return AB_EMPTY_STRING; + return String.valueOf((long)getPrezzoA()); + } + + public double getPrezzoDa() { + return this.prezzoDa; + } + + public long getFlgKit() { + return this.flgKit; + } + + public void setFlgKit(long flgKit) { + this.flgKit = flgKit; + } + + public double getPrezzoMax() { + return this.prezzoMax; + } + + public void setPrezzoMax(double prezzoMax) { + this.prezzoMax = prezzoMax; + } + + public double getPrezzoMin() { + return this.prezzoMin; + } + + public void setPrezzoMin(double prezzoMin) { + this.prezzoMin = prezzoMin; + } + + public long getPrezzoMaxL() { + return (long)getPrezzoMax() + 1L; + } + + public long getPrezzoMinL() { + return (long)getPrezzoMin(); + } + + public String getTag() { + return (this.tag == null) ? AB_EMPTY_STRING : this.tag.trim(); + } + + public void setTag(String tag) { + this.tag = tag; + } + + public long getFlgUsato() { + return this.flgUsato; + } + + public void setFlgUsato(long flgUsato) { + this.flgUsato = flgUsato; + } + + public static final String getUsato(long l_flgUsato) { + return Articolo.getUsato(l_flgUsato); + } + + public static final String getReadyForWeb(long l_flgReadyForWeb) { + if (l_flgReadyForWeb == -1L) + return " "; + if (l_flgReadyForWeb == 1L) + return "Si"; + if (l_flgReadyForWeb == 2L) + return "Si SEO Ko"; + if (l_flgReadyForWeb == 0L) + return "NO"; + return "??"; + } + + public String getReadyForWeb() { + return getReadyForWeb(getFlgReadyForWeb()); + } + + public String getUsato() { + return getUsato(getFlgUsato()); + } + + public long getFlgContoVendita() { + return this.flgContoVendita; + } + + public void setFlgContoVendita(long flgContoVendita) { + this.flgContoVendita = flgContoVendita; + } + + public long getFlgEbay() { + return this.flgEbay; + } + + public void setFlgEbay(long flgEbay) { + this.flgEbay = flgEbay; + } + + public long getFlgGoogle() { + return this.flgGoogle; + } + + public void setFlgGoogle(long flgGoogle) { + this.flgGoogle = flgGoogle; + } + + public String getNMatricola() { + return (this.nMatricola == null) ? AB_EMPTY_STRING : this.nMatricola; + } + + public void setNMatricola(String matricola) { + this.nMatricola = matricola; + } + + public String getCodiceEan() { + return (this.codiceEan == null) ? AB_EMPTY_STRING : this.codiceEan.trim(); + } + + public void setCodiceEan(String codiceEan) { + this.codiceEan = codiceEan; + } + + public long getFlgRateale0() { + return this.flgRateale0; + } + + public void setFlgRateale0(long flgRateale0) { + this.flgRateale0 = flgRateale0; + } + + public String getScaffale() { + return (this.scaffale == null) ? AB_EMPTY_STRING : this.scaffale.trim(); + } + + public void setScaffale(String scaffale) { + this.scaffale = scaffale; + } + + public long getFlgInEsaurimento() { + return this.flgInEsaurimento; + } + + public void setFlgInEsaurimento(long flgInEsaurimento) { + this.flgInEsaurimento = flgInEsaurimento; + } + + public String getSearchTxtQuery() { + if (getSearchTxtWeb().isEmpty()) + return AB_EMPTY_STRING; + try { + return "?q=" + URLEncoder.encode(getSearchTxtWeb(), "UTF-8"); + } catch (Exception e) { + return "?q=" + DBAdapter.convertStringToHtml(getSearchTxtWeb()); + } + } + + public Date getDataDocumentoA() { + return this.dataDocumentoA; + } + + public void setDataDocumentoA(Date dataDocumentoA) { + this.dataDocumentoA = dataDocumentoA; + } + + public Date getDataDocumentoDa() { + return this.dataDocumentoDa; + } + + public void setDataDocumentoDa(Date dataDocumentoDa) { + this.dataDocumentoDa = dataDocumentoDa; + } + + public long getFlgDisponibilitaWeb() { + return this.flgDisponibilitaWeb; + } + + public void setFlgDisponibilitaWeb(long flgDisponibilitaWeb) { + this.flgDisponibilitaWeb = flgDisponibilitaWeb; + } + + public long getFlgModImportazione() { + return this.flgModImportazione; + } + + public void setFlgModImportazione(long flgModImportazione) { + this.flgModImportazione = flgModImportazione; + } + + public long getFlgSubito() { + return this.flgSubito; + } + + public void setFlgSubito(long flgSubito) { + this.flgSubito = flgSubito; + } + + public String getTagArticolo() { + return (this.tagArticolo == null) ? AB_EMPTY_STRING : this.tagArticolo.trim(); + } + + public void setTagArticolo(String tagArticolo) { + this.tagArticolo = tagArticolo; + } + + public String getCodicePromozioneA() { + return (this.codicePromozioneA == null) ? AB_EMPTY_STRING : this.codicePromozioneA.trim(); + } + + public void setCodicePromozioneA(String codicePromozioneA) { + this.codicePromozioneA = codicePromozioneA; + } + + public long getId_fornitore() { + return this.id_fornitore; + } + + public void setId_fornitore(long id_fornitore) { + this.id_fornitore = id_fornitore; + setFornitore(null); + } + + public Clifor getFornitore() { + this.fornitore = (Clifor)getSecondaryObject(this.fornitore, Clifor.class, getId_fornitore()); + return this.fornitore; + } + + public void setFornitore(Clifor fornitore) { + this.fornitore = fornitore; + } + + public static final String getEscludiWeb(long l_flgEscludiWebArt) { + if (l_flgEscludiWebArt == -1L) + return "--"; + if (l_flgEscludiWebArt == 1L) + return "Non Visibile"; + if (l_flgEscludiWebArt == 2L) + return "Sospeso"; + if (l_flgEscludiWebArt == 0L) + return "Visibile"; + return "??"; + } + + public static final String getPrezzoCompetitivo(long l_flgPrezzoCompetitivo) { + if (l_flgPrezzoCompetitivo == 0L) + return "Amazon"; + if (l_flgPrezzoCompetitivo == 1L) + return "Sito"; + if (l_flgPrezzoCompetitivo == 2L) + return "Nessuno"; + if (l_flgPrezzoCompetitivo == 3L) + return "Non Rilevato"; + return ""; + } + + public final String getPrezzoCompetitivo() { + return getPrezzoCompetitivo(getFlgPrezzoCompetitivo()); + } + + public static final String getAmzFeaturedPriceData(long l_flgAmzFeaturedPriceData) { + if (l_flgAmzFeaturedPriceData == 0L) + return "Tutti"; + if (l_flgAmzFeaturedPriceData == 1L) + return "data < oggi"; + return ""; + } + + public final String getAmzFeaturedPriceData() { + return getAmzFeaturedPriceData(getFlgAmzFeaturedPriceData()); + } + + public static final String getPriceTypeAmz(long l_flgPriceTypeAmz) { + return Articolo.getPriceTypeAmz(l_flgPriceTypeAmz); + } + + public final String getPriceTypeAmz() { + return Articolo.getPriceTypeAmz(getFlgPriceTypeAmz()); + } + + public static final String getOfferta(long l_flgOfferta) { + if (l_flgOfferta == 12L) + return "Off. Fornitore Attiva"; + if (l_flgOfferta == 11L) + return "Off. Interna Attiva"; + if (l_flgOfferta == 3L) + return "Off. Scaduta o senza offerta"; + if (l_flgOfferta == 4L) + return "Off. Interna Scaduta/Senza o solo Off. Forn."; + if (l_flgOfferta == 0L) + return "Off. Scaduta"; + if (l_flgOfferta == 21L) + return "Off. Interna Scaduta"; + if (l_flgOfferta == 22L) + return "Off. Fornitore Scaduta"; + if (l_flgOfferta == 1L) + return "Off. Attiva"; + if (l_flgOfferta < 0L) + return AB_EMPTY_STRING; + return "??"; + } + + public String getOfferta() { + return getOfferta(getFlgOfferta()); + } + + public String getFileNameGoogle() { + return (this.fileNameGoogle == null) ? AB_EMPTY_STRING : this.fileNameGoogle.trim(); + } + + public void setFileNameGoogle(String fileNameGoogle) { + this.fileNameGoogle = fileNameGoogle; + } + + public String getGoogleFeedFileName() { + return (this.googleFeedFileName == null) ? AB_EMPTY_STRING : this.googleFeedFileName.trim(); + } + + public void setGoogleFeedFileName(String googleFeedFileName) { + this.googleFeedFileName = googleFeedFileName; + } + + public String getCCPageTitle(String lang, int page) { + StringBuilder title = new StringBuilder(); + if (getId_tipo() != 0L) { + if (!getTipo().getDescrizioneSeo(lang).isEmpty()) { + title.append(getTipo().getDescrizioneSeo(lang)); + } else { + title.append(getTipo().getDescrizioneCompleta(lang)); + } + title.append(" "); + if (getId_marca() > 0L) { + title.append(getMarca().getDescrizione()); + title.append(" "); + } + } else if (getId_marca() > 0L) { + title.append(getMarca().getCCSeoTitle(lang)); + title.append(" "); + } + if (!getId_marche().isEmpty()) { + StringTokenizer st = new StringTokenizer(getId_marche(), ","); + Marca marca = new Marca(getApFull()); + if (getId_tipo() == 0L && st.countToken() == 1) { + long token = Long.parseLong(st.nextToken()); + marca.findByPrimaryKey(token); + title.append(marca.getCCSeoTitle(lang)); + title.append(" "); + } else { + while (st.hasMoreTokens()) { + long token = Long.parseLong(st.nextToken()); + marca.findByPrimaryKey(token); + if (marca.getId_marca() > 0L) { + title.append(marca.getDescrizione()); + title.append(" "); + } + } + } + } + if (!getSearchTxtWeb().isEmpty()) { + title.append(getSearchTxtWeb()); + title.append(" "); + } + if (getFlgNoleggio() > 0L) { + title.insert(0, "Noleggio - "); + } else if (getFlgStockOfferte() == 1L) { + title.insert(0, "Offerte - "); + } else if (getFlgStockOfferte() == 4L) { + title.insert(0, "Novità - "); + } else if (getFlgStockOfferte() == 3L) { + title.insert(0, "Usato - "); + } else if (getFlgStockOfferte() == 2L) { + title.insert(0, "Stock - "); + } + title.append(" | "); + title.append(Attivita.getDefaultInstance(getApFull()).getNomeAttivitaSeo()); + if (page > 1) { + title.append(" | "); + title.append(getMarca().translate("pagina", lang)); + title.append(" "); + title.append(page); + } + return title.toString(); + } + + public String getCCPageDescription(String lang, int page) { + String result; + StringBuilder sbMarche = new StringBuilder(); + if (!getId_marche().isEmpty()) { + StringTokenizer st = new StringTokenizer(getId_marche(), ","); + Marca marca = new Marca(getApFull()); + if (getId_tipo() == 0L && st.countToken() == 1) { + long token = Long.parseLong(st.nextToken()); + marca.findByPrimaryKey(token); + sbMarche.append(" "); + sbMarche.append(marca.getCCMetaDescriptionWeb(lang)); + } else { + while (st.hasMoreTokens()) { + long token = Long.parseLong(st.nextToken()); + marca.findByPrimaryKey(token); + if (marca.getId_marca() > 0L) { + sbMarche.append(" "); + sbMarche.append(marca.getDescrizione()); + } + } + } + } + if (getId_marca() != 0L) { + sbMarche.append(" "); + sbMarche.append(getMarca().getDescrizione()); + } + StringBuilder sbPage = new StringBuilder(); + if (page > 1) { + sbPage.append(" "); + sbPage.append(getMarca().translate("pagina", lang)); + sbPage.append(" "); + sbPage.append(page); + } + StringBuilder sbRicerca = new StringBuilder(); + if (!getSearchTxtWeb().isEmpty() || getId_marca() != 0L || !getId_marche().isEmpty()) { + sbRicerca.append(" "); + sbRicerca.append(getSearchTxtWeb()); + } + StringBuilder sbDisponibile = new StringBuilder(); + if (getFlgDisponibile() == 1L) { + sbDisponibile.append(" "); + sbDisponibile.append(getTipoSel().translate("disponibili", lang)); + } + if (getId_tipo() == 0L) { + result = AB_EMPTY_STRING; + } else if (!getTipo().getMetaDesc(lang).isEmpty()) { + result = getTipo().getMetaDesc(lang); + } else { + result = getTipo().getDescrizioneCompletaHypen(lang); + } + if (result.indexOf("#") >= 0) { + long parmSize = (long)(getTipo().getDescrizione().length() + sbMarche.length() + sbRicerca.length() + sbPage.length() + sbDisponibile.length()); + result = Articolo.getCCSeoMinimalTemplate(result, 150L, parmSize); + StringBuilder stringBuilder = new StringBuilder( + result.replace("#", getTipo().getDescrizione() + getTipo().getDescrizione())); + if (sbRicerca.length() > 0) + stringBuilder.append(sbRicerca.toString()); + if (sbDisponibile.length() > 0) + stringBuilder.append(sbDisponibile.toString()); + if (sbPage.length() > 0) + stringBuilder.append(sbPage.toString()); + return stringBuilder.toString(); + } + StringBuilder sbResult = new StringBuilder(result); + if (sbMarche.length() > 0) { + sbResult.append(sbMarche.toString()); + sbResult.append(" "); + } + if (sbRicerca.length() > 0) { + if (sbResult.length() == 0) + sbResult.append(getArticolo().translate("ricerca per", lang)); + sbResult.append(sbRicerca.toString()); + } + if (sbDisponibile.length() > 0) + sbResult.append(sbDisponibile.toString()); + if (sbPage.length() > 0) + sbResult.append(sbPage.toString()); + return DBAdapter.eliminaDoppioniInStringa(sbResult.toString()); + } + + public String getCCPageKeyword(String lang) { + StringBuilder desc = new StringBuilder(); + if (!getTipo().getKeyword(lang).isEmpty()) { + desc.append(getTipo().getKeyword(lang)); + } else { + desc.append(getTipo().getDescrizioneCompletaKeyword(lang)); + } + if (getId_marca() > 0L) { + desc.append(", "); + desc.append(getMarca().getDescrizione()); + } + if (!getId_marche().isEmpty()) { + StringTokenizer st = new StringTokenizer(getId_marche(), ","); + Marca marca = new Marca(getApFull()); + while (st.hasMoreTokens()) { + long token = Long.parseLong(st.nextToken()); + marca.findByPrimaryKey(token); + if (marca.getId_marca() > 0L) { + desc.append(", "); + desc.append(marca.getDescrizione()); + } + } + } + return desc.toString(); + } + + public ArticoloVariante getArticoloVarianteKit() { + this.articoloVarianteKit = (ArticoloVariante)getSecondaryObject(this.articoloVarianteKit, ArticoloVariante.class, + getId_articoloVarianteKit()); + return this.articoloVarianteKit; + } + + public long getId_articoloVarianteKit() { + return this.id_articoloVarianteKit; + } + + public void setArticoloVarianteKit(ArticoloVariante articoloVarianteKit) { + this.articoloVarianteKit = articoloVarianteKit; + } + + public void setId_articoloVarianteKit(long id_articoloVarianteKit) { + this.id_articoloVarianteKit = id_articoloVarianteKit; + setArticoloVarianteKit(null); + } + + public ArticoloTaglia getArticoloTaglia() { + this.articoloTaglia = (ArticoloTaglia)getSecondaryObject(this.articoloTaglia, ArticoloTaglia.class, getId_articoloTaglia()); + return this.articoloTaglia; + } + + public long getId_articoloTaglia() { + return this.id_articoloTaglia; + } + + public void setArticoloTaglia(ArticoloTaglia articoloTaglia) { + this.articoloTaglia = articoloTaglia; + } + + public void setId_articoloTaglia(long id_articoloTaglia) { + this.id_articoloTaglia = id_articoloTaglia; + setArticoloTaglia(null); + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante()); + return this.articoloVariante; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setArticoloVariante(ArticoloVariante newArticoloVariante) { + this.articoloVariante = newArticoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + setArticoloVariante(null); + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public void setArticolo(Articolo articolo) { + this.articolo = articolo; + } + + public long getId_taglia() { + return this.id_taglia; + } + + public Taglia getTaglia() { + this.taglia = (Taglia)getSecondaryObject(this.taglia, Taglia.class, getId_taglia()); + return this.taglia; + } + + public void setId_taglia(long id_taglia) { + this.id_taglia = id_taglia; + } + + public void setTaglia(Taglia taglia) { + this.taglia = taglia; + } + + public String getSitemapFilename() { + return (this.sitemapFilename == null || this.sitemapFilename.isEmpty()) ? "sitemapArticoli" : this.sitemapFilename.trim(); + } + + public void setSitemapFilename(String sitemapFilename) { + this.sitemapFilename = sitemapFilename; + } + + public Date getDataCreazioneDa() { + return this.dataCreazioneDa; + } + + public void setDataCreazioneDa(Date dataCreazioneDa) { + this.dataCreazioneDa = dataCreazioneDa; + } + + public Date getDataUpdateDa() { + return this.dataUpdateDa; + } + + public void setDataUpdateDa(Date dataUpdateDa) { + this.dataUpdateDa = dataUpdateDa; + } + + public long getFlgReadyForWeb() { + return this.flgReadyForWeb; + } + + public void setFlgReadyForWeb(long flgReadyForWeb) { + this.flgReadyForWeb = flgReadyForWeb; + } + + public String getLangReadyForWeb() { + return (this.langReadyForWeb == null) ? Locale.ITALY.getCountry() : this.langReadyForWeb.trim(); + } + + public void setLangReadyForWeb(String langReadyForWeb) { + this.langReadyForWeb = langReadyForWeb; + } + + public String getLastItems() { + return (this.lastItems == null) ? AB_EMPTY_STRING : this.lastItems.trim(); + } + + public void setLastItems(String lastItems) { + this.lastItems = lastItems; + } + + public long getCountImportNonTrovatoDa() { + return this.countImportNonTrovatoDa; + } + + public void setCountImportNonTrovatoDa(long countImportNonTrovatoDa) { + this.countImportNonTrovatoDa = countImportNonTrovatoDa; + } + + public long getCountImportNonTrovatoA() { + return this.countImportNonTrovatoA; + } + + public void setCountImportNonTrovatoA(long countImportNonTrovatoA) { + this.countImportNonTrovatoA = countImportNonTrovatoA; + } + + public long getFlgEbayPubblicato() { + return this.flgEbayPubblicato; + } + + public void setFlgEbayPubblicato(long flgEbayPubblicato) { + this.flgEbayPubblicato = flgEbayPubblicato; + } + + public long getId_articoloEscluso() { + return this.id_articoloEscluso; + } + + public void setId_articoloEscluso(long id_articoloEscluso) { + this.id_articoloEscluso = id_articoloEscluso; + } + + public long getId_fornitoreUsato() { + return this.id_fornitoreUsato; + } + + public void setId_fornitoreUsato(long id_fornitoreUsato) { + this.id_fornitoreUsato = id_fornitoreUsato; + setFornitoreUsato(null); + } + + public Clifor getFornitoreUsato() { + this.fornitoreUsato = (Clifor)getSecondaryObject(this.fornitoreUsato, Clifor.class, getId_fornitoreUsato()); + return this.fornitoreUsato; + } + + public void setFornitoreUsato(Clifor fornitoreUsato) { + this.fornitoreUsato = fornitoreUsato; + } + + public String getWwwAddressParm() { + return getParm("P_WWW_ADDRESS").getTesto(); + } + + public long getId_statoUsato() { + return this.id_statoUsato; + } + + public StatoUsato getStatoUsato() { + this.statoUsato = (StatoUsato)getSecondaryObject(this.statoUsato, StatoUsato.class, new Long(getId_statoUsato())); + return this.statoUsato; + } + + public void setId_statoUsato(long id_statoUsato) { + this.id_statoUsato = id_statoUsato; + setStatoUsato(null); + } + + public void setStatoUsato(StatoUsato statoUsato) { + this.statoUsato = statoUsato; + } + + public Date getDataCreazioneA() { + return this.dataCreazioneA; + } + + public void setDataCreazioneA(Date dataCreazioneA) { + this.dataCreazioneA = dataCreazioneA; + } + + public Clifor getFornitoreCostoNuovo() { + this.fornitoreCostoNuovo = (Clifor)getSecondaryObject(this.fornitoreCostoNuovo, Clifor.class, getId_fornitoreCostoNuovo()); + return this.fornitoreCostoNuovo; + } + + public long getId_fornitoreCostoNuovo() { + return this.id_fornitoreCostoNuovo; + } + + public void setFornitoreCostoNuovo(Clifor fornitoreCostoNuovo) { + this.fornitoreCostoNuovo = fornitoreCostoNuovo; + } + + public void setId_fornitoreCostoNuovo(long id_fornitoreCostoNuovo) { + this.id_fornitoreCostoNuovo = id_fornitoreCostoNuovo; + setFornitoreCostoNuovo(null); + } + + public String getTipoReport() { + return Articolo.getTipoReport(getFlgTipoReport()); + } + + public Date getDataDocumentoUsatoA() { + return this.dataDocumentoUsatoA; + } + + public void setDataDocumentoUsatoA(Date dataDocumentoUsatoA) { + this.dataDocumentoUsatoA = dataDocumentoUsatoA; + } + + public static String getTipoReport(long l_flgTipoReport) { + return Articolo.getTipoReport(l_flgTipoReport); + } + + public long getFlgOfferta() { + return this.flgOfferta; + } + + public void setFlgOfferta(long flgOfferta) { + this.flgOfferta = flgOfferta; + } + + public String getCategoriaImport() { + return (this.categoriaImport == null) ? AB_EMPTY_STRING : this.categoriaImport.trim(); + } + + public void setCategoriaImport(String categoriaImport) { + this.categoriaImport = categoriaImport; + } + + public long getFlgAmazon() { + return this.flgAmazon; + } + + public void setFlgAmazon(long flgAmazon) { + this.flgAmazon = flgAmazon; + } + + public static final String getDisponibilitaWeb(long l_flgDisponibilita) { + return Articolo.getDisponibilitaWeb(l_flgDisponibilita); + } + + public final String getOrderBy() { + return getOrderBy(getFlgOrderBy()); + } + + public long getFlgControlloCostoAggArt() { + return this.flgControlloCostoAggArt; + } + + public void setFlgControlloCostoAggArt(long flgControlloCostoAggArt) { + this.flgControlloCostoAggArt = flgControlloCostoAggArt; + } + + public long getFlgTrovaprezzi() { + return this.flgTrovaprezzi; + } + + public void setFlgTrovaprezzi(long flgTrovaprezzi) { + this.flgTrovaprezzi = flgTrovaprezzi; + } + + public String getFileNameTrovaprezzi() { + return (this.fileNameTrovaprezzi == null || this.fileNameTrovaprezzi.isEmpty()) ? "trovaprezzi-f3.xml" : this.fileNameTrovaprezzi.trim(); + } + + public void setFileNameTrovaprezzi(String fileNameTrovaprezzi) { + this.fileNameTrovaprezzi = fileNameTrovaprezzi; + } + + public String getFileNameIdealo() { + return (this.fileNameIdealo == null || this.fileNameIdealo.isEmpty()) ? "idealo-f3.xml" : this.fileNameIdealo.trim(); + } + + public void setFileNameIdealo(String fileNameIdealo) { + this.fileNameIdealo = fileNameIdealo; + } + + public long getFlgIdealo() { + return this.flgIdealo; + } + + public void setFlgIdealo(long flgIdealo) { + this.flgIdealo = flgIdealo; + } + + public long getFlgTipoSchedaArticoloWww() { + return this.flgTipoSchedaArticoloWww; + } + + public void setFlgTipoSchedaArticoloWww(long flgTipoSchedaArticoloWww) { + this.flgTipoSchedaArticoloWww = flgTipoSchedaArticoloWww; + } + + public long getCountImpressionA() { + return this.countImpressionA; + } + + public void setCountImpressionA(long countImpressionA) { + this.countImpressionA = countImpressionA; + } + + public long getCountImpressionDa() { + return this.countImpressionDa; + } + + public void setCountImpressionDa(long countImpressionDa) { + this.countImpressionDa = countImpressionDa; + } + + public long getFlgSitemapType() { + return this.flgSitemapType; + } + + public void setFlgSitemapType(long flgSitemapType) { + this.flgSitemapType = flgSitemapType; + } + + public long getFlgIcecatAuto() { + return this.flgIcecatAuto; + } + + public void setFlgIcecatAuto(long flgIcecatAuto) { + this.flgIcecatAuto = flgIcecatAuto; + } + + public String getCCTagH1Web(String lang) { + StringBuilder temp = new StringBuilder(); + if (!getSearchTxtWeb().isEmpty()) { + temp.append(" "); + temp.append(getTipoSel().translate("cerca per", lang)); + temp.append(" "); + temp.append(getSearchTxtWeb()); + } + if (getId_tipoSel() > 0L) { + temp.append(" "); + temp.append(getTipoSel().getTagH1Web(lang)); + } + if (!getId_marche().isEmpty()) { + StringTokenizer st = new StringTokenizer(getId_marche(), ","); + Marca marca = new Marca(getApFull()); + if (getId_tipoSel() == 0L && st.countToken() == 1) { + long token = Long.parseLong(st.nextToken()); + marca.findByPrimaryKey(token); + temp.append(" "); + temp.append(marca.getCCTagH1(lang)); + } else { + while (st.hasMoreTokens()) { + long token = Long.parseLong(st.nextToken()); + marca.findByPrimaryKey(token); + if (marca.getId_marca() > 0L) { + temp.append(" "); + temp.append(marca.getDescrizione()); + } + } + } + } + if (getFlgDisponibile() == 1L) { + temp.append(" "); + temp.append(getTipoSel().translate("disponibili", lang)); + } + return temp.toString(); + } + + public String getCCTagH2Web(String lang) { + StringBuilder temp = new StringBuilder(); + if (getId_tipoSel() > 0L) { + temp.append(" "); + temp.append(getTipoSel().getTagH2(lang)); + } else if (!getId_marche().isEmpty()) { + StringTokenizer st = new StringTokenizer(getId_marche(), ","); + Marca marca = new Marca(getApFull()); + if (getId_tipoSel() == 0L && st.countToken() == 1) { + long token = Long.parseLong(st.nextToken()); + marca.findByPrimaryKey(token); + temp.append(" "); + temp.append(marca.getCCTagH2(lang)); + } + } + return temp.toString(); + } + + public String getCountGgNoImportDaA() { + return (this.countGgNoImportDaA == null) ? "0,0" : this.countGgNoImportDaA.trim(); + } + + public void setCountGgNoImportDaA(String l_countGgNoImportDaA) { + if (l_countGgNoImportDaA == null) { + this.countGgNoImportDaA = "0,0"; + setCountGgNoImportDa(0L); + setCountGgNoImportA(0L); + } else { + StringTokenizer st = new StringTokenizer(l_countGgNoImportDaA, ","); + if (st.hasMoreTokens()) { + String l_da = st.nextToken(); + if (StringUtils.isNumeric(l_da)) { + setCountGgNoImportDa(Long.parseLong(l_da)); + } else { + setCountGgNoImportDa(0L); + } + } + if (st.hasMoreTokens()) { + String l_a = st.nextToken(); + if (StringUtils.isNumeric(l_a)) { + setCountGgNoImportA(Long.parseLong(l_a)); + } else { + setCountGgNoImportA(0L); + } + } + this.countGgNoImportDaA = "" + getCountGgNoImportDa() + "," + getCountGgNoImportDa(); + } + } + + public long getCountGgNoImportDa() { + return this.countGgNoImportDa; + } + + public void setCountGgNoImportDa(long countGgNoImportDa) { + this.countGgNoImportDa = countGgNoImportDa; + } + + public long getCountGgNoImportA() { + return this.countGgNoImportA; + } + + public void setCountGgNoImportA(long countGgNoImportA) { + this.countGgNoImportA = countGgNoImportA; + } + + public String getFileNameMs() { + return (this.fileNameMs == null) ? AB_EMPTY_STRING : this.fileNameMs.trim(); + } + + public void setFileNameMs(String fileNameMs) { + this.fileNameMs = fileNameMs; + } + + public long getFlgPriceTypeAmz() { + return this.flgPriceTypeAmz; + } + + public void setFlgPriceTypeAmz(long flgPriceTypeAmz) { + this.flgPriceTypeAmz = flgPriceTypeAmz; + } + + public long getFlgAmzWarn() { + return this.flgAmzWarn; + } + + public void setFlgAmzWarn(long flgAmzWarn) { + this.flgAmzWarn = flgAmzWarn; + } + + public long getFlgAmzFeaturedPriceData() { + return this.flgAmzFeaturedPriceData; + } + + public void setFlgAmzFeaturedPriceData(long flgAmzFeaturedPrice) { + this.flgAmzFeaturedPriceData = flgAmzFeaturedPrice; + } + + public long getFlgPrezzoCompetitivo() { + return this.flgPrezzoCompetitivo; + } + + public void setFlgPrezzoCompetitivo(long flgPrezzoCompetitivo) { + this.flgPrezzoCompetitivo = flgPrezzoCompetitivo; + } + + public long getFlgAsinAmzNull() { + return this.flgAsinAmzNull; + } + + public void setFlgAsinAmzNull(long flgAsinAmzNull) { + this.flgAsinAmzNull = flgAsinAmzNull; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloCliente.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloCliente.java new file mode 100644 index 00000000..cbeabc26 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloCliente.java @@ -0,0 +1,213 @@ +package it.acxent.art; + +import it.acxent.anag.Clifor; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ArticoloCliente extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1607681273276L; + + private long id_articoloCliente; + + private long id_clifor; + + private long id_articolo; + + private long id_articoloVariante; + + private long id_tipo; + + private String indiciTipo; + + private Clifor clifor; + + private Articolo articolo; + + private ArticoloVariante articoloVariante; + + private Tipo tipo; + + public ArticoloCliente(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloCliente() {} + + public void setId_articoloCliente(long newId_articoloCliente) { + this.id_articoloCliente = newId_articoloCliente; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setId_articoloVariante(long newId_articoloVariante) { + this.id_articoloVariante = newId_articoloVariante; + setArticoloVariante(null); + } + + public void setId_tipo(long newId_tipo) { + this.id_tipo = newId_tipo; + setTipo(null); + } + + public long getId_articoloCliente() { + return this.id_articoloCliente; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public void setArticoloVariante(ArticoloVariante newArticoloVariante) { + this.articoloVariante = newArticoloVariante; + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante()); + return this.articoloVariante; + } + + public void setTipo(Tipo newTipo) { + this.tipo = newTipo; + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo()); + return this.tipo; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloClienteCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_CLIENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizioneCompleta() { + if (getId_tipo() > 0L) + return "Tipo: " + getTipo().getDescrizioneCompletaSpaces("it"); + if (getId_articolo() > 0L) + return "Articolo: " + getArticolo().getDescrizioneCompleta(); + if (getId_articoloVariante() > 0L) + return "Variante: " + getArticoloVariante().getDescrizioneCompleta(); + return "Errore!!"; + } + + public Vectumerator findByClifor(long l_id_clifor) { + String s_Sql_Find = "select A.* from ARTICOLO_CLIENTE AS A LEFT JOIN TIPO AS T ON A.id_tipo=T.id_tipo left join ARTICOLO as AR on A.id_articolo=AR.id_articolo left join ARTICOLO_VARIANTE as AV on A.id_articoloVariante=AV.id_articoloVariante"; + String s_Sql_Order = " order by T.descrizione, AR.nome, AV.nomeV\t"; + WcString wc = new WcString(); + wc.addWc("A.id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm save() { + ResParm rp = super.save(); + if (rp.getStatus()) + if (getId_tipo() > 0L && !getTipo().isFoglia()) { + Vectumerator vec = getTipo().findFigli(0, 0); + while (vec.hasMoreElements()) { + Tipo row = (Tipo)vec.nextElement(); + ArticoloCliente ac = new ArticoloCliente(getApFull()); + ac.setId_clifor(getId_clifor()); + ac.setId_tipo(row.getId_tipo()); + ac.save(); + } + } + return rp; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + if (getId_tipo() > 0L) { + setId_articolo(0L); + setId_articoloVariante(0L); + setIndiciTipo(getTipo().getIndici()); + } else if (getId_articolo() > 0L) { + setId_articoloVariante(0L); + } + super.prepareSave(ps); + } + + public String getIndiciTipo() { + return (this.indiciTipo == null) ? "" : this.indiciTipo; + } + + public void setIndiciTipo(String indiciTipo) { + this.indiciTipo = indiciTipo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloClienteCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloClienteCR.java new file mode 100644 index 00000000..1193d37f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloClienteCR.java @@ -0,0 +1,119 @@ +package it.acxent.art; + +import it.acxent.anag.Clifor; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloClienteCR extends CRAdapter { + private long id_articoloCliente; + + private long id_clifor; + + private long id_articolo; + + private long id_articoloVariante; + + private long id_tipo; + + private Clifor clifor; + + private Articolo articolo; + + private ArticoloVariante articoloVariante; + + private Tipo tipo; + + public ArticoloClienteCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloClienteCR() {} + + public void setId_articoloCliente(long newId_articoloCliente) { + this.id_articoloCliente = newId_articoloCliente; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setId_articoloVariante(long newId_articoloVariante) { + this.id_articoloVariante = newId_articoloVariante; + setArticoloVariante(null); + } + + public void setId_tipo(long newId_tipo) { + this.id_tipo = newId_tipo; + setTipo(null); + } + + public long getId_articoloCliente() { + return this.id_articoloCliente; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, + + getId_clifor()); + return this.clifor; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + + getId_articolo()); + return this.articolo; + } + + public void setArticoloVariante(ArticoloVariante newArticoloVariante) { + this.articoloVariante = newArticoloVariante; + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, + + getId_articoloVariante()); + return this.articoloVariante; + } + + public void setTipo(Tipo newTipo) { + this.tipo = newTipo; + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, + + getId_tipo()); + return this.tipo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloComponente.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloComponente.java new file mode 100644 index 00000000..5f5bf348 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloComponente.java @@ -0,0 +1,117 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ArticoloComponente extends _ArtAdapter implements Serializable { + private long id_articoloComponente; + + private long id_componente; + + private long id_articolo; + + private double perc; + + private Articolo articolo; + + private Componente componente; + + public ArticoloComponente(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloComponente() {} + + public long getId_articoloComponente() { + return this.id_articoloComponente; + } + + public void setId_articoloComponente(long id_articoloComponente) { + this.id_articoloComponente = id_articoloComponente; + } + + public long getId_componente() { + return this.id_componente; + } + + public void setId_componente(long id_componente) { + this.id_componente = id_componente; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + } + + public double getPerc() { + return this.perc; + } + + public void setPerc(double perc) { + this.perc = perc; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + getId_articolo()); + return this.articolo; + } + + public Componente getComponente() { + this.componente = (Componente)getSecondaryObject(this.componente, Componente.class, + getId_componente()); + return this.componente; + } + + public Vectumerator findByArticolo(long id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_articolo = " + id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByArticoloComponente(long id_articolo, long id_componente) { + String s_Sql_Find = "select A.* from ARTICOLO_COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_articolo = " + id_articolo); + wc.addWc("id_componente = " + id_componente); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public double getPercTotale(long id_articolo) { + String s_Sql_Find = "select SUM(A.perc) AS _sum from ARTICOLO_COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_articolo = " + id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloComponenteCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloComponenteCR.java new file mode 100644 index 00000000..05a611d0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloComponenteCR.java @@ -0,0 +1,68 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloComponenteCR extends CRAdapter { + private long id_articoloComponente; + + private long id_componente; + + private long id_articolo; + + private double perc; + + private Articolo articolo; + + private Componente componente; + + public ArticoloComponenteCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloComponenteCR() {} + + public long getId_articoloComponente() { + return this.id_articoloComponente; + } + + public void setId_articoloComponente(long id_articoloComponente) { + this.id_articoloComponente = id_articoloComponente; + } + + public long getId_componente() { + return this.id_componente; + } + + public void setId_componente(long id_componente) { + this.id_componente = id_componente; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + } + + public double getPerc() { + return this.perc; + } + + public void setPerc(double perc) { + this.perc = perc; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + getId_articolo()); + return this.articolo; + } + + public Componente getComponente() { + this.componente = (Componente)getSecondaryObject(this.componente, Componente.class, + getId_componente()); + return this.componente; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloFornitore.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloFornitore.java new file mode 100644 index 00000000..2ee13450 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloFornitore.java @@ -0,0 +1,641 @@ +package it.acxent.art; + +import it.acxent.anag.Fornitore; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.tex.anag.ArticoloTessuto; +import it.acxent.tex.anag.ArticoloTessutoColore; +import it.acxent.util.DoubleOperator; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; + +public class ArticoloFornitore extends _ArtAdapter implements Serializable { + private static final long serialVersionUID = -3626607279516810249L; + + private long id_clifor; + + private String codiceFornitore; + + private long id_articolo; + + private double costo; + + private double costoAggiuntivo; + + private Articolo articolo; + + private Fornitore fornitore; + + private Date dataUltimoPrezzo; + + private double costoVecchio; + + private double costoSconto; + + private long costoScontoQta; + + private long dispCash; + + private long dispSede; + + private long flgPromo; + + private long id_articoloTessuto; + + private long id_articoloVariante; + + private long id_articoloTessutoColore; + + private ArticoloTessuto articoloTessuto; + + private ArticoloTessutoColore articoloTessutoColore; + + private ArticoloVariante articoloVariante; + + private long id_articoloFornitore; + + private long flgAbituale; + + private double streetPrice; + + private long dispTotR; + + private long flgFuoriListino; + + private Date dataInizioPromo; + + private Date dataFinePromo; + + private long flgControlloCostoAggAF; + + private long flgEscludi; + + public ArticoloFornitore(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloFornitore() {} + + public void setId_clifor(long newId_fornitore) { + this.id_clifor = newId_fornitore; + setFornitore(null); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setCosto(double newCosto) { + this.costo = newCosto; + } + + public void setDataUltimoPrezzo(Date newDataUltimoPrezzo) { + this.dataUltimoPrezzo = newDataUltimoPrezzo; + } + + public void setCostoVecchio(double newCostoVecchio) { + this.costoVecchio = newCostoVecchio; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_fornitore() { + return this.id_clifor; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public double getCosto() { + return this.costo; + } + + public double getCostoTotale() { + if (getCostoAggiuntivo() == 0.0D) + return this.costo; + DoubleOperator dop = new DoubleOperator(getCosto()); + dop.add(getCostoAggiuntivo()); + return dop.getResult(); + } + + public Date getDataUltimoPrezzo() { + return this.dataUltimoPrezzo; + } + + public double getCostoVecchio() { + return this.costoVecchio; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloFornitoreCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from articolo_fornitore AS A"; + String s_Sql_Order = ""; + String wc = ""; + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getCodiceFornitore() { + return (this.codiceFornitore == null) ? "" : this.codiceFornitore; + } + + public void setCodiceFornitore(String string) { + this.codiceFornitore = string; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public void setArticolo(Articolo articolo) { + this.articolo = articolo; + } + + public Fornitore getFornitore() { + this.fornitore = (Fornitore)getSecondaryObject(this.fornitore, Fornitore.class, getId_clifor()); + return this.fornitore; + } + + public void setFornitore(Fornitore fornitore) { + this.fornitore = fornitore; + } + + public Vectumerator findById_articolo(long l_id_articolo, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_FORNITORE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgFuoriListino() { + return this.flgFuoriListino; + } + + public void setFlgFuoriListino(long flgFuoriListino) { + this.flgFuoriListino = flgFuoriListino; + } + + private void updateArticoloFornitoreFuoriListino(long l_id_fornitore, Timestamp ts) { + String sql_String = "update ARTICOLO_FORNITORE set flgFuoriListino=1 "; + String wc = ""; + wc = buildWc(wc, "id_fornitore=" + l_id_fornitore); + wc = buildWc(wc, "lastUpdTmst=?"); + try { + PreparedStatement ps = getConn().prepareStatement(sql_String + sql_String); + ps.setTimestamp(1, ts); + update(ps); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void aggiornaCostiNuovi(ArticoloCR CR) {} + + public double getCostoSconto() { + return this.costoSconto; + } + + public void setCostoSconto(double costoSconto) { + this.costoSconto = costoSconto; + } + + public long getCostoScontoQta() { + return this.costoScontoQta; + } + + public void setCostoScontoQta(long costoScontoQta) { + this.costoScontoQta = costoScontoQta; + } + + public long getDispCash() { + return this.dispCash; + } + + public void setDispCash(long dispCash) { + this.dispCash = dispCash; + } + + public long getDispSede() { + return this.dispSede; + } + + public void setDispSede(long dispSede) { + this.dispSede = dispSede; + } + + public double getRicarico() { + if (getCostoTotale() != 0.0D) { + DoubleOperator temp = new DoubleOperator(getArticolo().getPrezzoPubblico()); + temp.setScale(4, 1); + temp.divide(getCostoTotale()); + temp.subtract(1); + temp.multiply(100); + temp.setScale(4, 1); + return temp.getResult(); + } + return 0.0D; + } + + public double getCostoIvato() { + DoubleOperator temp = new DoubleOperator((float)getArticolo().getIva().getAliquota()); + temp.setScale(4, 5); + temp.divide(100.0F); + temp.add(1); + temp.multiply(getCosto()); + temp.setScale(2, 5); + return temp.getResult(); + } + + public double getCostoTotaleIvato() { + DoubleOperator temp = new DoubleOperator((float)getArticolo().getIva().getAliquota()); + temp.setScale(4, 5); + temp.divide(100.0F); + temp.add(1); + temp.multiply(getCostoTotale()); + temp.setScale(2, 5); + return temp.getResult(); + } + + public Vectumerator findById_articoloFornitore(long l_id_articolo, long l_id_fornitore, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_FORNITORE AS A"; + String s_Sql_Order = " order by A.lastUpdTmst desc"; + WcString wc = new WcString(); + wc.addWc("id_articolo=" + l_id_articolo); + if (l_id_fornitore != 0L) + wc.addWc("id_clifor=" + l_id_fornitore); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgAbituale() { + return this.flgAbituale; + } + + public void setFlgAbituale(long flgAbituale) { + this.flgAbituale = flgAbituale; + } + + public ResParm deleteFlgAbitualeArticolo(long l_id_articolo) { + return update("UPDATE ARTICOLO_FORNITORE SET flgAbituale = 0 WHERE id_articolo = " + l_id_articolo); + } + + public ResParm deleteFlgAbitualeArticoloTessuto(long l_id_articoloTessuto) { + return update("UPDATE ARTICOLO_FORNITORE SET flgAbituale = 0 WHERE id_articoloTessuto = " + l_id_articoloTessuto); + } + + public void findByArticoloFornitoreAbituale(long l_id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_FORNITORE AS A"; + String s_Sql_Order = " order by A.lastUpdTmst desc"; + WcString wc = new WcString(); + wc.addWc("id_articolo=" + l_id_articolo); + wc.addWc("flgAbituale=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public void setId_articoloTessuto(long id_articoloTessuto) { + this.id_articoloTessuto = id_articoloTessuto; + setArticoloTessuto(null); + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + setArticoloVariante(null); + } + + public long getId_articoloTessutoColore() { + return this.id_articoloTessutoColore; + } + + public void setId_articoloTessutoColore(long id_articoloTessutoColore) { + this.id_articoloTessutoColore = id_articoloTessutoColore; + setArticoloTessutoColore(null); + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, getId_articoloTessuto()); + return this.articoloTessuto; + } + + public void setArticoloTessuto(ArticoloTessuto articoloTessuto) { + this.articoloTessuto = articoloTessuto; + } + + public ArticoloTessutoColore getArticoloTessutoColore() { + this.articoloTessutoColore = (ArticoloTessutoColore)getSecondaryObject(this.articoloTessutoColore, ArticoloTessutoColore.class, + getId_articoloTessutoColore()); + return this.articoloTessutoColore; + } + + public void setArticoloTessutoColore(ArticoloTessutoColore articoloTessutoColore) { + this.articoloTessutoColore = articoloTessutoColore; + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante()); + return this.articoloVariante; + } + + public void setArticoloVariante(ArticoloVariante articoloVariante) { + this.articoloVariante = articoloVariante; + } + + public long getId_articoloFornitore() { + return this.id_articoloFornitore; + } + + public void setId_articoloFornitore(long id_articoloFornitore) { + this.id_articoloFornitore = id_articoloFornitore; + } + + public void findByCodiceFornitore(long l_id_clifor, String l_codiceFornitore) { + String s_Sql_Find = "select A.* from ARTICOLO_FORNITORE AS A"; + String s_Sql_Order = " order by A.lastUpdTmst desc"; + WcString wc = new WcString(); + wc.addWc("codiceFornitore='" + l_codiceFornitore.trim() + "'"); + wc.addWc("id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByArticoloTessutoFornitore(long l_id_clifor, long l_id_articoloTessuto) { + String s_Sql_Find = "select A.* from ARTICOLO_FORNITORE AS A"; + String s_Sql_Order = " order by A.lastUpdTmst desc"; + WcString wc = new WcString(); + wc.addWc("id_articoloTessuto=" + l_id_articoloTessuto); + wc.addWc("id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findById_articoloTessuto(long l_id_articoloTessuto, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_FORNITORE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_articoloTessuto=" + l_id_articoloTessuto); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByArticoloTessutoFornitoreAbituale(long l_id_articoloTessuto) { + String s_Sql_Find = "select A.* from ARTICOLO_FORNITORE AS A"; + String s_Sql_Order = " order by A.lastUpdTmst desc"; + WcString wc = new WcString(); + wc.addWc("id_articoloTessuto=" + l_id_articoloTessuto); + wc.addWc("flgAbituale=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public long getFlgPromo() { + return this.flgPromo; + } + + public void setFlgPromo(long flgPromo) { + this.flgPromo = flgPromo; + } + + public double getDispoFornitoriByArticolo(long l_id_articolo) { + String s_Sql_Find = "select SUM(A.dispSede+A.dispCash) AS _sum from ARTICOLO_FORNITORE AS A"; + String s_Sql_Order = " order by A.lastUpdTmst desc"; + WcString wc = new WcString(); + wc.addWc("id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public void findPiuConvenienteByArticolo(long l_id_articolo) { + String s_Sql_Find2 = "select * from ARTICOLO_FORNITORE AS A"; + String s_Sql_Order = " order by A.lastUpdTmst desc"; + WcString wc2 = new WcString(); + wc2.addWc("(dispSede+dispCash)>0"); + wc2.addWc("(flgEscludi is null or flgEscludi=0)"); + wc2.addWc("id_articolo=" + l_id_articolo); + wc2.addWc("costo>0"); + wc2.addWc("dataUltimoPrezzo>=?"); + String s_Sql_Find1 = "select id_clifor, id_articolo,costo, costoAggiuntivo, (costo+costoAggiuntivo) as costoTot, (dispSede+dispCash) as dispTotR , dataInizioPromo, dataFinePromo from(" + s_Sql_Find2 + + wc2.toString() + ") as A group by costoTot, id_articolo order by costoTot "; + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find1); + stmt.setDate(1, DBAdapter.getToday(-7)); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public double getStreetPrice() { + return this.streetPrice; + } + + public void setStreetPrice(double streetPrice) { + this.streetPrice = streetPrice; + } + + public long getDispTotR() { + return this.dispTotR; + } + + public long getDispoTot() { + return getDispCash() + getDispSede(); + } + + public void setDispTotR(long dispTotR) { + this.dispTotR = dispTotR; + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + try { + if (isColumnInResultSet(rst, "dispTotR")) + setDispTotR(rst.getLong("dispTotR")); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected void initFields() { + super.initFields(); + setDispTotR(0L); + } + + public double getCostoAggiuntivo() { + return this.costoAggiuntivo; + } + + public void setCostoAggiuntivo(double costoAggiuntivo) { + this.costoAggiuntivo = costoAggiuntivo; + } + + public void findByFornitoreArticolo(long l_id_clifor, long l_id_articolo, long l_flgAbilitaAF) { + String s_Sql_Find = "select A.* from ARTICOLO_FORNITORE AS A"; + if (l_flgAbilitaAF >= 0L) + s_Sql_Find = s_Sql_Find + " inner join CLIFOR AS B on A.id_clifor=B.id_clifor"; + String s_Sql_Order = " order by A.lastUpdTmst desc"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + wc.addWc("A.id_clifor=" + l_id_clifor); + if (l_flgAbilitaAF == 0L) { + wc.addWc("(B.flgAbilitaAF is null or B.flgAbilitaAF =0)"); + } else if (l_flgAbilitaAF > 0L) { + wc.addWc("B.flgAbilitaAF=" + l_flgAbilitaAF); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Date getDataInizioPromo() { + return this.dataInizioPromo; + } + + public void setDataInizioPromo(Date dataInizioPromo) { + this.dataInizioPromo = dataInizioPromo; + } + + public Date getDataFinePromo() { + return this.dataFinePromo; + } + + public void setDataFinePromo(Date dataFinePromo) { + this.dataFinePromo = dataFinePromo; + } + + public boolean isPromoAttiva() { + if (getId_articolo() == 0L) + return false; + if (getDataInizioPromo() == null && getDataFinePromo() == null) + return false; + if (getDataFinePromo() == null) + return false; + if (DBAdapter.getDateDiff(getDataInizioPromo(), getToday()) >= 0L && + DBAdapter.getDateDiff(getToday(), getDataFinePromo()) >= 0L) + return true; + return false; + } + + public long getFlgControlloCostoAggAF() { + return this.flgControlloCostoAggAF; + } + + public void setFlgControlloCostoAggAF(long flgControlloCostoAggAF) { + this.flgControlloCostoAggAF = flgControlloCostoAggAF; + } + + public ResParm save() { + if (getCostoAggiuntivo() > 0.0D) + setFlgControlloCostoAggAF(1L); + return super.save(); + } + + public boolean checkControlloAggiuntivoByArticolo(long l_id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_FORNITORE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_articolo=" + l_id_articolo); + wc.addWc("(A.flgControlloCostoAggAF is null or A.flgControlloCostoAggAF=0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + if (getId_articoloFornitore() > 0L) + return false; + return true; + } catch (SQLException e) { + handleDebug(e); + return false; + } + } + + public ResParm aggiornaCodiciAlternativiByArticolo(Articolo l_articolo, boolean salva) { + Vectumerator vec = findById_articolo(l_articolo.getId_articolo(), 0, 0); + StringBuilder sb = new StringBuilder(); + if (vec.hasMoreElements()) + sb.append(","); + while (vec.hasMoreElements()) { + ArticoloFornitore row = (ArticoloFornitore)vec.nextElement(); + sb.append(row.getFornitore().getImportPrefissoCodice()); + sb.append("_"); + sb.append(row.getCodiceFornitore()); + sb.append(","); + } + l_articolo.setCodiciAlternativi(sb.toString()); + if (salva) + return l_articolo.superSave(); + return new ResParm(true); + } + + public long getFlgEscludi() { + return this.flgEscludi; + } + + public void setFlgEscludi(long flgEscludi) { + this.flgEscludi = flgEscludi; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloFornitoreCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloFornitoreCR.java new file mode 100644 index 00000000..04846ac4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloFornitoreCR.java @@ -0,0 +1,123 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class ArticoloFornitoreCR extends CRAdapter { + private long id_fornitore; + + private long id_articolo; + + private double costo; + + private Date dataUltimoPrezzo; + + private double costoNuovo; + + private long flgAbituale; + + private long id_articoloFornitore; + + private long id_articoloTessuto; + + private long id_articoloTessutoColore; + + private long id_articoloVariante; + + private long flgControlloCostoAggAF = -1L; + + public ArticoloFornitoreCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloFornitoreCR() {} + + public void setId_fornitore(long newId_fornitore) { + this.id_fornitore = newId_fornitore; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + } + + public void setCosto(double newCosto) { + this.costo = newCosto; + } + + public void setDataUltimoPrezzo(Date newDataUltimoPrezzo) { + this.dataUltimoPrezzo = newDataUltimoPrezzo; + } + + public void setCostoNuovo(double newCostoNuovo) { + this.costoNuovo = newCostoNuovo; + } + + public long getId_fornitore() { + return this.id_fornitore; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public double getCosto() { + return this.costo; + } + + public Date getDataUltimoPrezzo() { + return this.dataUltimoPrezzo; + } + + public double getCostoNuovo() { + return this.costoNuovo; + } + + public long getFlgAbituale() { + return this.flgAbituale; + } + + public void setFlgAbituale(long flgAbituale) { + this.flgAbituale = flgAbituale; + } + + public long getId_articoloFornitore() { + return this.id_articoloFornitore; + } + + public void setId_articoloFornitore(long id_articoloFornitore) { + this.id_articoloFornitore = id_articoloFornitore; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public void setId_articoloTessuto(long id_articoloTessuto) { + this.id_articoloTessuto = id_articoloTessuto; + } + + public long getId_articoloTessutoColore() { + return this.id_articoloTessutoColore; + } + + public void setId_articoloTessutoColore(long id_articoloTessutoColore) { + this.id_articoloTessutoColore = id_articoloTessutoColore; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + } + + public long getFlgControlloCostoAggAF() { + return this.flgControlloCostoAggAF; + } + + public void setFlgControlloCostoAggAF(long flgControlloCostoAggAF) { + this.flgControlloCostoAggAF = flgControlloCostoAggAF; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloInterface.java new file mode 100644 index 00000000..a828dd7f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloInterface.java @@ -0,0 +1,132 @@ +package it.acxent.art; + +import it.acxent.anag.Clifor; +import it.acxent.anag.PrezzoArticolo; +import it.acxent.anag.Users; +import java.sql.Date; + +public interface ArticoloInterface { + public static final long TIPO_ARTICOLO = 0L; + + public static final long TIPO_ARTICOLO_VARIANTE = 1L; + + double getAbbuonoPrezzoPubblico(); + + Date getDataCambiamentoPrezzo(); + + Date getDataScadenzaOffertaWeb(); + + String getDescrizione(); + + String getDescrizione(String paramString); + + String getNome(String paramString); + + String getDescrizioneUrl(); + + String getDescrizioneVetrina(); + + String getDescrizioneVetrina(String paramString); + + long getId(); + + long getId_articolo(); + + long getId_articoloVariante(); + + long getId_tipo(); + + Tipo getTipo(); + + Marca getMarca(); + + long getId_tipoPadre(); + + String getImgFileName(int paramInt); + + double getPercSconto(); + + double getPrezzoBase(); + + double getPrezzoBaseIva(); + + double getPrezzoBaseIva(Users paramUsers); + + double getPrezzoBaseIvaConAbbuono(); + + double getPrezzoOfferta(); + + double getPercScontoOfferta(); + + double getPrezzoIvatoBarrato(); + + long getFlgNoleggio(); + + double getPrezzoNoleggioIva(); + + double getPrezzoOffertaIva(); + + double getPercScontoRispettoAlPrezzoBarrato(); + + double getPercScontoRispettoAOfferta(); + + double getPrezzoPubblico(); + + double getPrezzoPubblico(Clifor paramClifor); + + double getPrezzoPubblicoIva(); + + double getPrezzoPubblicoIva(Clifor paramClifor); + + PrezzoArticolo getPrezzoArticolo(Clifor paramClifor); + + PrezzoArticolo getPrezzoArticoloIva(Clifor paramClifor); + + long getTipoArticoloVetrina(); + + boolean isOffertaValida(); + + String getDescrizioneNomeUrl(); + + String getCodicePromozione(); + + boolean isPrezzoBarratoValido(); + + String getCCLinkDettaglio(ArticoloCR paramArticoloCR); + + String getCCLinkDettaglio(); + + String getCCLinkDettaglioA(ArticoloCR paramArticoloCR); + + String getCCMetaDescriptionWeb(String paramString); + + String getCCTagH1(String paramString); + + String getCCTagH2Web(String paramString); + + String getCCKeyword(String paramString); + + String getCCLinkDettaglioTK(ArticoloCR paramArticoloCR); + + String getCCLinkDettaglioT(ArticoloCR paramArticoloCR); + + String getCCLinkInfo(ArticoloCR paramArticoloCR); + + String getCCTagH1Web(String paramString); + + String getDatoStrutturato(String paramString); + + String getCCNome(String paramString); + + StatoUsato getStatoUsato(); + + boolean isNuovo(); + + boolean isUsato(); + + int getDispoLevel(); + + String getDispoLevelDesc(); + + String getPathIdStepDir(); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloInterface2.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloInterface2.java new file mode 100644 index 00000000..d5c5793f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloInterface2.java @@ -0,0 +1,70 @@ +package it.acxent.art; + +import it.acxent.anag.Clifor; +import java.sql.Date; + +public interface ArticoloInterface2 { + public static final long TIPO_ARTICOLO = 0L; + + public static final long TIPO_ARTICOLO_VARIANTE = 1L; + + double getAbbuonoPrezzoPubblico(); + + Date getDataCambiamentoPrezzo(); + + Date getDataScadenzaOfferta(); + + String getDescrizione(); + + String getDescrizione(String paramString); + + String getDescrizioneUrl(); + + String getDescrizioneVetrina(); + + String getDescrizioneVetrina(String paramString); + + long getId(); + + long getId_articolo(); + + long getId_articoloVariante(); + + long getId_tipo(); + + long getId_tipoPadre(); + + String getImgFileName(int paramInt); + + double getPercSconto(); + + double getPercSconto(Clifor paramClifor); + + double getPrezzoOfferta(); + + double getPrezzoOffertaIva(); + + double getPrezzoPubblico(); + + double getPrezzoPubblicoFinale(Clifor paramClifor); + + double getPrezzoPubblicoIva(); + + double getPrezzoPubblicoFinaleIva(Clifor paramClifor); + + double getPrezzoPubblicoIvaAbbuono(); + + double getPrezzoPubblicoIvaAbbuono(Clifor paramClifor); + + double getPrezzoPubblicoScontato(); + + double getPrezzoPubblicoScontato(Clifor paramClifor); + + double getPrezzoPubblicoScontatoIva(); + + double getPrezzoPubblicoScontatoIva(Clifor paramClifor); + + long getTipoArticoloVetrina(); + + boolean isOffertaValida(); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloNazione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloNazione.java new file mode 100644 index 00000000..ad5e9f34 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloNazione.java @@ -0,0 +1,163 @@ +package it.acxent.art; + +import it.acxent.anag.Nazione; +import it.acxent.cart.Cart; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ArticoloNazione extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1622308001596L; + + private long id_articoloNazione; + + private String id_nazione; + + private long id_articolo; + + private long flgPreventivoWwwAN; + + private double costoSpedizioneAN; + + private Nazione nazione; + + private Articolo articolo; + + public ArticoloNazione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloNazione() {} + + public void setId_articoloNazione(long newId_articoloNazione) { + this.id_articoloNazione = newId_articoloNazione; + } + + public void setId_nazione(String newId_nazione) { + this.id_nazione = newId_nazione; + setNazione(null); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setFlgPreventivoWwwAN(long newFlgPreventivoWwwAN) { + this.flgPreventivoWwwAN = newFlgPreventivoWwwAN; + } + + public void setCostoSpedizioneAN(double newCostoSpedizioneAN) { + this.costoSpedizioneAN = newCostoSpedizioneAN; + } + + public long getId_articoloNazione() { + return this.id_articoloNazione; + } + + public String getId_nazione() { + return (this.id_nazione == null) ? "" : this.id_nazione.trim(); + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getFlgPreventivoWwwAN() { + return this.flgPreventivoWwwAN; + } + + public double getCostoSpedizioneAN() { + return this.costoSpedizioneAN; + } + + public void setNazione(Nazione newNazione) { + this.nazione = newNazione; + } + + public Nazione getNazione() { + this.nazione = (Nazione)getSecondaryObject(this.nazione, Nazione.class, getId_nazione()); + return this.nazione; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloNazioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_NAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByArticolo(long l_id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_NAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getCostoSpedizioneANConIva() { + return conIva(getCostoSpedizioneAN(), getParm(Cart.P_DELIVERY_IVA_ALIQUOTA).getNumeroDouble()); + } + + public void findByArticoloNazione(long l_id_articolo, String l_id_nazione) { + String s_Sql_Find = "select A.* from ARTICOLO_NAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + wc.addWc("A.id_nazione='" + l_id_nazione + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloNazioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloNazioneCR.java new file mode 100644 index 00000000..42e8760f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloNazioneCR.java @@ -0,0 +1,91 @@ +package it.acxent.art; + +import it.acxent.anag.Nazione; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloNazioneCR extends CRAdapter { + private long id_articoloNazione; + + private String id_nazione; + + private long id_articolo; + + private long flgPreventivoWwwAN; + + private double costoSpedizioneAN; + + private Nazione nazione; + + private Articolo articolo; + + public ArticoloNazioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloNazioneCR() {} + + public void setId_articoloNazione(long newId_articoloNazione) { + this.id_articoloNazione = newId_articoloNazione; + } + + public void setId_nazione(String newId_nazione) { + this.id_nazione = newId_nazione; + setNazione(null); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setFlgPreventivoWwwAN(long newFlgPreventivoWwwAN) { + this.flgPreventivoWwwAN = newFlgPreventivoWwwAN; + } + + public void setCostoSpedizioneAN(double newCostoSpedizioneAN) { + this.costoSpedizioneAN = newCostoSpedizioneAN; + } + + public long getId_articoloNazione() { + return this.id_articoloNazione; + } + + public String getId_nazione() { + return (this.id_nazione == null) ? "" : this.id_nazione.trim(); + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getFlgPreventivoWwwAN() { + return this.flgPreventivoWwwAN; + } + + public double getCostoSpedizioneAN() { + return this.costoSpedizioneAN; + } + + public void setNazione(Nazione newNazione) { + this.nazione = newNazione; + } + + public Nazione getNazione() { + this.nazione = (Nazione)getSecondaryObject(this.nazione, Nazione.class, + + getId_nazione()); + return this.nazione; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + + getId_articolo()); + return this.articolo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloProgettista.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloProgettista.java new file mode 100644 index 00000000..a05bbf05 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloProgettista.java @@ -0,0 +1,152 @@ +package it.acxent.art; + +import it.acxent.anag.Clifor; +import it.acxent.anag._AnagAdapter; +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ArticoloProgettista extends _AnagAdapter implements Serializable { + private static final long serialVersionUID = 463336863212137063L; + + private long id_articoloProgettista; + + private double percProvvigione; + + private long id_progettista; + + private long id_articolo; + + private String nota; + + private Clifor progettista; + + private Articolo articolo; + + public ArticoloProgettista(ApplParmFull newApplParm) { + super(newApplParm); + } + + public ArticoloProgettista() {} + + public long getId_articoloProgettista() { + return this.id_articoloProgettista; + } + + public void setId_articoloProgettista(long id_cliforArticolo) { + this.id_articoloProgettista = id_cliforArticolo; + } + + public double getPercProvvigione() { + return this.percProvvigione; + } + + public void setPercProvvigione(double percArticolo) { + this.percProvvigione = percArticolo; + } + + public long getId_progettista() { + return this.id_progettista; + } + + public void setId_progettista(long id_clifor) { + this.id_progettista = id_clifor; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + } + + public Clifor getProgettista() { + this.progettista = new Clifor(getApFull()); + this.progettista.findByPrimaryKey(getId_progettista()); + return this.progettista; + } + + public void setProgettista(Clifor clifor) { + this.progettista = clifor; + } + + public Articolo getArticolo() { + this.articolo = new Articolo(getApFull()); + this.articolo.findByPrimaryKey(getId_articolo()); + return this.articolo; + } + + public void setArticolo(Articolo articolo) { + this.articolo = articolo; + } + + public Vectumerator findByCR(ArticoloProgettistaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_PROGETTISTA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%' or A.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_articolo() != 0L) + wc.addWc(" A.id_articolo = " + CR.getId_articolo()); + if (CR.getId_progettista() != 0L) + wc.addWc(" A.id_clifor = " + CR.getId_progettista()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByProgettistaArticolo(long id_clifor, long id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_PROGETTISTA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_articolo = " + id_articolo); + wc.addWc(" A.id_progettista= " + id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findByArticolo(long id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_PROGETTISTA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_articolo = " + id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getNota() { + return (this.nota == null) ? "" : this.nota.trim(); + } + + public void setNota(String nota) { + this.nota = nota; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloProgettistaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloProgettistaCR.java new file mode 100644 index 00000000..063117d3 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloProgettistaCR.java @@ -0,0 +1,78 @@ +package it.acxent.art; + +import it.acxent.anag.Clifor; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.io.Serializable; + +public class ArticoloProgettistaCR extends CRAdapter implements Serializable { + private long id_articoloProgettista; + + private double percProvvigione; + + private long id_progettista; + + private long id_articolo; + + private Clifor progettista; + + private Articolo articolo; + + public ArticoloProgettistaCR(ApplParmFull newApplParm) { + super(newApplParm); + } + + public ArticoloProgettistaCR() {} + + public long getId_articoloProgettista() { + return this.id_articoloProgettista; + } + + public void setId_articoloProgettista(long id_cliforArticolo) { + this.id_articoloProgettista = id_cliforArticolo; + } + + public double getPercProvvigione() { + return this.percProvvigione; + } + + public void setPercProvvigione(double percArticolo) { + this.percProvvigione = percArticolo; + } + + public long getId_progettista() { + return this.id_progettista; + } + + public void setId_progettista(long id_clifor) { + this.id_progettista = id_clifor; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + } + + public Clifor getProgettista() { + this.progettista = new Clifor(getApFull()); + this.progettista.findByPrimaryKey(getId_progettista()); + return this.progettista; + } + + public void setProgettista(Clifor clifor) { + this.progettista = clifor; + } + + public Articolo getArticolo() { + this.articolo = new Articolo(getApFull()); + this.articolo.findByPrimaryKey(getId_articolo()); + return this.articolo; + } + + public void setArticolo(Articolo articolo) { + this.articolo = articolo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloTabellaTaglia.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloTabellaTaglia.java new file mode 100644 index 00000000..73af38fb --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloTabellaTaglia.java @@ -0,0 +1,102 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ArticoloTabellaTaglia extends _ArtAdapter implements Serializable { + private long id_articoloTabellaTaglia; + + private long id_tabellaTaglia; + + private long id_articolo; + + private TabellaTaglia tabellaTaglia; + + private Articolo articolo; + + public ArticoloTabellaTaglia(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloTabellaTaglia() {} + + public void setId_articoloTabellaTaglia(long newId_articoloTabellaTaglia) { + this.id_articoloTabellaTaglia = newId_articoloTabellaTaglia; + } + + public void setId_tabellaTaglia(long newId_tabellaTaglia) { + this.id_tabellaTaglia = newId_tabellaTaglia; + setTabellaTaglia(null); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public long getId_articoloTabellaTaglia() { + return this.id_articoloTabellaTaglia; + } + + public long getId_tabellaTaglia() { + return this.id_tabellaTaglia; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setTabellaTaglia(TabellaTaglia newTabellaTaglia) { + this.tabellaTaglia = newTabellaTaglia; + } + + public TabellaTaglia getTabellaTaglia() { + this.tabellaTaglia = (TabellaTaglia)getSecondaryObject(this.tabellaTaglia, TabellaTaglia.class, + + getId_tabellaTaglia()); + return this.tabellaTaglia; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + + getId_articolo()); + return this.articolo; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloTabellaTagliaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_TABELLA_TAGLIA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloTabellaTagliaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloTabellaTagliaCR.java new file mode 100644 index 00000000..28144d3b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloTabellaTagliaCR.java @@ -0,0 +1,70 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloTabellaTagliaCR extends CRAdapter { + private long id_articoloTabellaTaglia; + + private long id_tabellaTaglia; + + private long id_articolo; + + private TabellaTaglia tabellaTaglia; + + private Articolo articolo; + + public ArticoloTabellaTagliaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloTabellaTagliaCR() {} + + public void setId_articoloTabellaTaglia(long newId_articoloTabellaTaglia) { + this.id_articoloTabellaTaglia = newId_articoloTabellaTaglia; + } + + public void setId_tabellaTaglia(long newId_tabellaTaglia) { + this.id_tabellaTaglia = newId_tabellaTaglia; + setTabellaTaglia(null); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public long getId_articoloTabellaTaglia() { + return this.id_articoloTabellaTaglia; + } + + public long getId_tabellaTaglia() { + return this.id_tabellaTaglia; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setTabellaTaglia(TabellaTaglia newTabellaTaglia) { + this.tabellaTaglia = newTabellaTaglia; + } + + public TabellaTaglia getTabellaTaglia() { + this.tabellaTaglia = (TabellaTaglia)getSecondaryObject(this.tabellaTaglia, TabellaTaglia.class, + + getId_tabellaTaglia()); + return this.tabellaTaglia; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + + getId_articolo()); + return this.articolo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloTaglia.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloTaglia.java new file mode 100644 index 00000000..6d5e12a9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloTaglia.java @@ -0,0 +1,532 @@ +package it.acxent.art; + +import it.acxent.cart.CartItemId; +import it.acxent.cart.CartItemIterface; +import it.acxent.contab.Movimento; +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.Vectumerator; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ArticoloTaglia extends _ArtAdapter implements CartItemIterface { + private long id_articoloTaglia; + + private long id_articolo; + + private long id_articoloVariante; + + private long id_taglia; + + private String codiceAT; + + private Taglia taglia; + + private Articolo articolo; + + private ArticoloVariante articoloVariante; + + private long flgDispo; + + private long flgUdmAv; + + private double qtaAttribuitaT; + + private double qtaInProduzioneT; + + private double quantitaAt; + + private double quantitaAtW; + + private boolean quantitaCalcolateAt; + + private double quantitaEffettivaAt; + + private double quantitaImpegnataAt; + + private double quantitaInArrivoAt; + + private String quantitaMagazzinoMovimentoHtml; + + private String codiciMagazzino; + + public ArticoloTaglia() {} + + public ArticoloTaglia(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public long getId_articoloTaglia() { + return this.id_articoloTaglia; + } + + public void setId_articoloTaglia(long id_articolotaglia) { + this.id_articoloTaglia = id_articolotaglia; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + } + + public long getId_taglia() { + return this.id_taglia; + } + + public void setId_taglia(long id_taglia) { + this.id_taglia = id_taglia; + } + + public String getCodiceAT() { + return (this.codiceAT == null) ? "" : this.codiceAT; + } + + public void setCodiceAT(String codiceAT) { + this.codiceAT = codiceAT; + } + + public void findByArticoloTaglia(long l_id_articolo, long l_id_articoloVariante, long l_id_taglia) { + String s_Sql_Find = "select A.* from ARTICOLO_TAGLIA AS A "; + WcString wc = new WcString(); + wc.addWc("id_articolo=" + l_id_articolo); + if (l_id_articoloVariante == 0L) { + wc.addWc("(id_articoloVariante=0 OR id_articoloVariante IS NULL)"); + } else { + wc.addWc("id_articoloVariante=" + l_id_articoloVariante); + } + wc.addWc("id_taglia=" + l_id_taglia); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByCartitemId(CartItemId cii) { + getArticolo().findByCartitemId(cii); + } + + public Vectumerator findByArticoloVariante(long l_id_articoloVariante) { + return findByArticoloVariante(l_id_articoloVariante, 0, 0); + } + + public Vectumerator findByArticoloVariante(long l_id_articoloVariante, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_TAGLIA AS A, TAGLIA AS B "; + String s_Sql_Order = " order by B.ordine "; + WcString wc = new WcString(); + wc.addWc("A.id_taglia=B.id_taglia"); + wc.addWc("A.id_articoloVariante=" + l_id_articoloVariante); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Taglia getTaglia() { + this.taglia = (Taglia)getSecondaryObject(this.taglia, Taglia.class, getId_taglia()); + return this.taglia; + } + + public void setTaglia(Taglia taglia) { + this.taglia = taglia; + } + + public Vectumerator findByArticolo(long l_id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_TAGLIA AS A, TAGLIA AS B "; + String s_Sql_Order = " order by B.ordine "; + WcString wc = new WcString(); + wc.addWc("A.id_taglia=B.id_taglia"); + wc.addWc("A.id_articolo=" + l_id_articolo); + wc.addWc("(A.id_articoloVariante=0 or A.id_articoloVariante is null)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getQuantitaT() { + if (!getArticolo().usaMagazzino()) + return 0.0D; + if (getParm("USA_MAGAZZINO").getNumeroLong() == 0L) { + Movimento mov = new Movimento(getApFull()); + mov.findDisponibilita(getId_articolo(), getId_articoloVariante(), getId_articoloTaglia(), null, 1L, 0L, null); + return mov.getQuantita(); + } + return -99.0D; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Object getItemId() { + return new Long(getId_articoloTaglia()); + } + + public double getPrice() { + return getArticolo().getPrice(); + } + + public double getPriceWVat() { + return getArticolo().getPriceWVat(); + } + + public boolean isSale() { + return getArticolo().isSale(); + } + + public boolean isRM() { + return getArticolo().isRM(); + } + + public double getDiscount() { + return getArticolo().getDiscount(); + } + + public double getCost() { + return getArticolo().getCost(); + } + + public String getCartItemDescriptionUrl() { + if (getId_articoloVariante() != 0L) + return getArticoloVariante().getCartItemDescriptionUrl(); + return getArticolo().getCartItemDescriptionUrl(); + } + + public String getCartItemDescription2(String lang) { + return getTaglia().getDescrizione(lang); + } + + public String getCartItemDescription3(String lang) { + if (getId_articoloVariante() != 0L) + return getArticoloVariante().getCartItemDescription3(lang); + return getArticolo().getCartItemDescription3(lang); + } + + public long getCartItemUdm() { + if (getId_articoloVariante() != 0L) + return getArticoloVariante().getCartItemUdm(); + return getArticolo().getCartItemUdm(); + } + + public double getAvail() { + return getQuantitaAtByMagFisico(1L); + } + + public double getIvaAliquota(long l_id_users) { + return getArticolo().getIvaAliquota(l_id_users); + } + + public long getIvaItemId(long l_id_users) { + return getArticolo().getIvaItemId(l_id_users); + } + + public String getCartItemImage() { + if (getId_articoloVariante() != 0L) + return getArticoloVariante().getCartItemImage(); + return getArticolo().getCartItemImage(); + } + + public String getCartItemDescription(String lang) { + if (getId_articoloVariante() != 0L) + return getArticoloVariante().getCartItemDescription(lang) + " " + getArticoloVariante().getCartItemDescription(lang) + " " + translate("taglia", lang); + return getArticolo().getNome() + " " + getArticolo().getNome() + " " + translate("taglia", lang); + } + + public double getPrice(long l_id_users) { + return getArticolo().getPrice(l_id_users); + } + + public String getCartItemTag() { + if (getId_articoloVariante() != 0L) + return getArticoloVariante().getCartItemTag(); + return getArticolo().getCartItemTag(); + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante()); + return this.articoloVariante; + } + + public void setArticoloVariante(ArticoloVariante articoloVariante) { + this.articoloVariante = articoloVariante; + } + + public Vectumerator findArticoloTagliaDisponibile(long l_id_articolo, long l_id_articoloVariante) { + String s_Sql_Find = "select A.* from ARTICOLO_TAGLIA AS A "; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + if (l_id_articoloVariante == 0L) { + wc.addWc("(A.id_articoloVariante=0 OR A.id_articoloVariante IS NULL)"); + } else { + wc.addWc("A.id_articoloVariante=" + l_id_articoloVariante); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getCodicePromozione() { + if (getId_articoloVariante() > 0L) + return getArticoloVariante().getCodicePromozione(); + if (getId_articolo() > 0L) + return getArticolo().getCodicePromozioneA(); + return ""; + } + + public String getDescrizioneCompleta(String lang) { + if (getId_articoloVariante() != 0L) + return getArticoloVariante().getDescrizione(lang) + " [" + getArticoloVariante().getDescrizione(lang) + "] "; + return getArticolo().getDescrizione(lang) + " [" + getArticolo().getDescrizione(lang) + "] "; + } + + public long getFlgDispo() { + return this.flgDispo; + } + + public void setFlgDispo(long flgDispo) { + this.flgDispo = flgDispo; + } + + public double getPriceWVat(long l_id_users) { + return getArticolo().getPriceWVat(l_id_users); + } + + public long getFlgUdmAv() { + return this.flgUdmAv; + } + + public void setFlgUdmAv(long flgUdmAv) { + this.flgUdmAv = flgUdmAv; + } + + public double getQtaAttribuitaT() { + return this.qtaAttribuitaT; + } + + public void setQtaAttribuitaT(double qtaAttribuitaT) { + this.qtaAttribuitaT = qtaAttribuitaT; + } + + public double getQtaInProduzioneT() { + return this.qtaInProduzioneT; + } + + public void setQtaInProduzioneT(double qtaInProduzioneT) { + this.qtaInProduzioneT = qtaInProduzioneT; + } + + public double getQuantitaAt() { + return getQuantitaAt(null); + } + + public double getQuantitaAt(Date dataA) { + if (getParm("USA_MAGAZZINO").isFalse()) { + RigaDocumento mov = new RigaDocumento(getApFull()); + mov.findMagDisponibilita(getId_articolo(), getId_articoloVariante(), getId_articoloTaglia(), null, 1L, 0L, dataA); + return mov.getQuantita(); + } + return this.quantitaAt; + } + + public double getQuantitaAtByMagFisico(long l_id_magFisico) { + if (getParm("USA_MAGAZZINO").isFalse()) { + RigaDocumento mov = new RigaDocumento(getApFull()); + mov.findMagFisicoDisponibilita(getId_articolo(), getId_articoloVariante(), getId_articoloTaglia(), null, l_id_magFisico, 0L, null); + return mov.getQuantita(); + } + return this.quantitaAt; + } + + public void setQuantitaAt(double quantitaAt) { + this.quantitaAt = quantitaAt; + } + + public double getQuantitaAtW() { + return this.quantitaAtW; + } + + public void setQuantitaAtW(double quantitaAtW) { + this.quantitaAtW = quantitaAtW; + } + + public boolean isQuantitaCalcolateAt() { + return this.quantitaCalcolateAt; + } + + public void setQuantitaCalcolateAt(boolean quantitaCalcolateAt) { + this.quantitaCalcolateAt = quantitaCalcolateAt; + } + + public double getQuantitaEffettivaAt() { + if (!isQuantitaCalcolateAt()) + calcolaQuantita(); + return this.quantitaEffettivaAt; + } + + public void setQuantitaEffettivaAt(double quantitaEffettivaAt) { + this.quantitaEffettivaAt = quantitaEffettivaAt; + } + + public double getQuantitaImpegnataAt() { + if (!isQuantitaCalcolateAt()) + calcolaQuantita(); + return this.quantitaImpegnataAt; + } + + public void setQuantitaImpegnataAt(double quantitaImpegnataAt) { + this.quantitaImpegnataAt = quantitaImpegnataAt; + } + + public double getQuantitaInArrivoAt() { + return this.quantitaInArrivoAt; + } + + public void setQuantitaInArrivoAt(double quantitaInArrivoAt) { + this.quantitaInArrivoAt = quantitaInArrivoAt; + } + + public String getQuantitaMagazzinoMovimentoHtml() { + if (getParm("USA_MAGAZZINO").isTrue()) + return getNf().format(getQuantitaAt()); + if (!isQuantitaCalcolateAt() && this.id_articoloTaglia != 0L) + calcolaQuantita(); + return (this.quantitaMagazzinoMovimentoHtml == null) ? "" : this.quantitaMagazzinoMovimentoHtml; + } + + public void setQuantitaMagazzinoMovimentoHtml(String quantitaMagazzinoMovimentoHtml) { + this.quantitaMagazzinoMovimentoHtml = quantitaMagazzinoMovimentoHtml; + } + + private synchronized void calcolaQuantita() { + if ((!isQuantitaCalcolateAt() ? true : false) & ((getId_articoloTaglia() != 0L) ? true : false)) { + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagDisponibilita(getId_articolo(), getId_articoloVariante(), getId_articoloTaglia(), null, 1L, 0L, null); + double q = rd.getQuantita(); + double nr = rd.getNr(); + double kg = rd.getKg(); + double mt = rd.getMt(); + setQuantitaAtW(q); + setQuantitaAt(rd.getQuantita()); + setQuantitaImpegnataAt(new RigaDocumento(getApFull()).getQuantitaImpegnataByArticoloTaglia(getId_articoloTaglia())); + double q1 = new RigaDocumento(getApFull()).getQuantitaInArrivoByArticoloTaglia(this); + setQuantitaInArrivoAt(q1); + if (!getArticolo().usaMagazzino()) { + setQuantitaEffettivaAt(0.0D); + } else { + DoubleOperator dop = new DoubleOperator(rd.getQuantita()); + dop.add(this.quantitaInArrivoAt); + dop.subtract(this.quantitaImpegnataAt); + setQuantitaEffettivaAt(dop.getResult()); + } + this.quantitaMagazzinoMovimentoHtml = Articolo.getMovimentoHtmlDesc(getArticolo().getTipologiaArticolo(), q, nr, kg, mt, this.quantitaInArrivoAt, this.quantitaImpegnataAt, this.quantitaEffettivaAt, + getArticolo().usaMagazzino(), + getParm("USA_MAGAZZINO").isTrue(), getNf()); + } + String temp = "update ARTICOLO_TAGLIA set quantitaMagazzinoMovimentoHtml='" + this.quantitaMagazzinoMovimentoHtml + "', quantitaInArrivoAt=" + this.quantitaInArrivoAt + ", quantitaImpegnataAt=" + this.quantitaImpegnataAt + ", quantitaAt=" + this.quantitaAt + ", quantitaEffettivaAt=" + this.quantitaEffettivaAt + ",quantitaCalcolateAt=true where id_articoloTaglia=" + + + + getId_articoloTaglia(); + update(temp); + setQuantitaCalcolateAt(true); + } + + public void resetCalcoloQuantita() { + if (getId_articoloTaglia() > 0L) { + update("update ARTICOLO_TAGLIA set quantitaCalcolateAt=false where id_articoloTaglia=" + getId_articoloTaglia()); + setQuantitaCalcolateAt(false); + } + } + + public String getCodiciMagazzino() { + return (this.codiciMagazzino == null) ? "" : this.codiciMagazzino.trim(); + } + + public void setCodiciMagazzino(String codiciMagazzino) { + this.codiciMagazzino = codiciMagazzino; + } + + public String getDescrizioneCompleta() { + if (getId_articoloVariante() != 0L) + return getArticoloVariante().getDescrizione() + " [" + getArticoloVariante().getDescrizione() + "] "; + return getArticolo().getDescrizione() + " [" + getArticolo().getDescrizione() + "] "; + } + + public int getDispoLevel() { + double qt = getQuantitaEffettivaAt(); + double dispoLevelScarsa = getParm("CC_QTA_LOW").getNumero(); + if (qt <= 0.0D) + return 0; + if (qt > 0.0D && qt < dispoLevelScarsa) + return 1; + if (qt >= dispoLevelScarsa) + return 2; + return 0; + } + + public String getCCLinkDettaglioTK(ArticoloCR CR) { + getArticolo().setId_articoloVariante(getId_articoloVariante()); + long l_id_taglia = CR.getId_taglia(); + CR.setId_taglia(getId_taglia()); + getArticolo().setId_articoloVarianteKit(CR.getId_articoloVarianteKit()); + String temp = getArticolo().getCCLinkDettaglioTK(CR); + CR.setId_taglia(l_id_taglia); + return temp; + } + + public String getCartItemDescriptionCC(String lang) { + return getCCNome(lang); + } + + public String getCCNome(String lang) { + if (getId_articoloVariante() != 0L) + return getArticoloVariante().getCCNome(lang) + " " + getArticoloVariante().getCCNome(lang) + " " + translate("taglia", lang); + return getArticolo().getCCNome(lang) + " " + getArticolo().getCCNome(lang) + " " + translate("taglia", lang); + } + + public boolean isCostoSpedizionePreventivo(String l_id_nazione) { + return getArticolo().isCostoSpedizionePreventivo(l_id_nazione); + } + + public double getDeliveryCost(String l_id_nazione) { + return getArticolo().getDeliveryCost(l_id_nazione); + } + + public long getPercentileSpedizione() { + return getArticolo().getPercentileSpedizione(); + } + + public boolean isScontoTroppoAlto() { + return getArticolo().isScontoTroppoAlto(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloUsato.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloUsato.java new file mode 100644 index 00000000..49f0ec89 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloUsato.java @@ -0,0 +1,413 @@ +package it.acxent.art; + +import it.acxent.anag.Clifor; +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ArticoloUsato extends _ArtAdapter implements Serializable { + private static final long serialVersionUID = 7574534452131775388L; + + private long id_articoloUsato; + + private long id_articolo; + + private Articolo articolo; + + private Date dataDocumento; + + private String numeroDocumento; + + private long flgTipoDocumento; + + private double importo; + + private long id_fornitore; + + private Clifor fornitore; + + private long id_cliente; + + private Clifor cliente; + + private long id_rigaDocumento; + + private RigaDocumento rigaDocumento; + + private String descrizioneRigaDocumento; + + private String tmstStampa; + + private long codiceAlt; + + public static final long USATO_TIPO_DOCUMENTO_ACQUISTO = 1L; + + public static final long USATO_TIPO_DOCUMENTO_VENDITA = 2L; + + public static final long USATO_TIPO_DOCUMENTO_RESO = 3L; + + public ArticoloUsato(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloUsato() {} + + protected void deleteCascade() {} + + public static final String getTipoDocumento(long l_flgTipoDocumento) { + switch ((int)l_flgTipoDocumento) { + case 1: + return "ACQUISTO"; + case 2: + return "VENDITA"; + case 3: + return "RESO"; + } + return ""; + } + + public final String getTipoDocumento() { + return getTipoDocumento(getFlgTipoDocumento()); + } + + public Vectumerator findByCR(ArticoloUsatoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_USATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByArticolo(long l_id_articolo, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_USATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByArticoloOrdineManuale(long l_id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_USATO AS A"; + String s_Sql_Order = " order by A.dataDocumento asc,A.flgTipoDocumento asc"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Clifor getFornitoreByArticolo(long l_id_articolo) { + if (l_id_articolo == 0L) + return new Clifor(getApFull()); + String s_Sql_Find = "select A.* from ARTICOLO_USATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + wc.addWc("A.flgTipoDocumento=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + return getFornitore(); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return new Clifor(getApFull()); + } + } + + public boolean isArticoloAcquistato(long l_id_articolo) { + String s_Sql_Find = "select COUNT(*) as _count from ARTICOLO_USATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + wc.addWc("A.flgTipoDocumento=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + long tot = getCount(stmt, "_count"); + if (tot != 0L) + return true; + return false; + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return false; + } + } + + public boolean isArticoloVenduto(long l_id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_USATO AS A"; + String s_Sql_Order = " ORDER BY A.id_articoloUsato DESC "; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + if (getFlgTipoDocumento() == 2L) + return true; + return false; + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return false; + } + } + + public boolean isArticoloReso(long l_id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_USATO AS A"; + String s_Sql_Order = " ORDER BY A.id_articoloUsato DESC "; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + if (getFlgTipoDocumento() == 3L) + return true; + return false; + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return false; + } + } + + public long getId_articoloUsato() { + return this.id_articoloUsato; + } + + public void setId_articoloUsato(long id_articoloUsato) { + this.id_articoloUsato = id_articoloUsato; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + setArticolo(null); + } + + public Date getDataDocumento() { + if (getId_rigaDocumento() == 0L) + return this.dataDocumento; + return getRigaDocumento().getDocumento().getDataDocumento(); + } + + public void setDataDocumento(Date dataDocumento) { + this.dataDocumento = dataDocumento; + } + + public String getIntestazione() { + if (getFlgTipoDocumento() == 1L) + return getFornitore().getCognomeNome().trim(); + if (getFlgTipoDocumento() == 2L) + return getCliente().getCognomeNome().trim(); + if (getFlgTipoDocumento() == 3L) + return getCliente().getCognomeNome().trim(); + return "??"; + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public long getFlgTipoDocumento() { + return this.flgTipoDocumento; + } + + public void setFlgTipoDocumento(long flgTipoDocumento) { + this.flgTipoDocumento = flgTipoDocumento; + } + + public double getImporto() { + return this.importo; + } + + public void setImporto(double importo) { + this.importo = importo; + } + + public long getId_fornitore() { + return this.id_fornitore; + } + + public Clifor getFornitore() { + this.fornitore = (Clifor)getSecondaryObject(this.fornitore, Clifor.class, getId_fornitore()); + return this.fornitore; + } + + public long getId_cliente() { + return this.id_cliente; + } + + public Clifor getCliente() { + this.cliente = (Clifor)getSecondaryObject(this.cliente, Clifor.class, getId_cliente()); + return this.cliente; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public void setId_rigaDocumento(long id_rigaDocumento) { + this.id_rigaDocumento = id_rigaDocumento; + } + + public RigaDocumento getRigaDocumento() { + this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, new Long(getId_rigaDocumento())); + return this.rigaDocumento; + } + + public void setRigaDocumento(RigaDocumento rigaDocumento) { + this.rigaDocumento = rigaDocumento; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public void setArticolo(Articolo articolo) { + this.articolo = articolo; + } + + public Vectumerator findByRigaDocumento(long l_id_rigaDocumento) { + String s_Sql_Find = "select A.* from ARTICOLO_USATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumento=" + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Date getDataUltimoMovimento(long l_id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_USATO AS A"; + String s_Sql_Order = " order by dataDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt, 1, 1); + if (vec.hasMoreElements()) { + ArticoloUsato row = (ArticoloUsato)vec.nextElement(); + return row.getDataDocumento(); + } + return null; + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return null; + } + } + + public String getTmstStampa() { + return this.tmstStampa; + } + + public void setTmstStampa(String tmstStampa) { + this.tmstStampa = tmstStampa; + } + + public ResParm save() { + if (getArticolo().getFlgUsato() == 0L) + return new ResParm(false, "ERRORE! non posso registrare un acquisto o vendita usato su articoli non usati!!!"); + return super.save(); + } + + public String getNumeroDocumento() { + if (getId_rigaDocumento() == 0L) + return (this.numeroDocumento == null) ? "" : this.numeroDocumento.trim(); + return getRigaDocumento().getDocumento().getNumeroDocumento(); + } + + public void setId_fornitore(long id_fornitore) { + this.id_fornitore = id_fornitore; + setFornitore(null); + } + + public void setFornitore(Clifor fornitore) { + this.fornitore = fornitore; + } + + public void setId_cliente(long id_cliente) { + this.id_cliente = id_cliente; + setCliente(null); + } + + public void setCliente(Clifor cliente) { + this.cliente = cliente; + } + + public String getDescrizioneRigaDocumento() { + return (this.descrizioneRigaDocumento == null) ? "" : this.descrizioneRigaDocumento.trim(); + } + + public void setDescrizioneRigaDocumento(String descrizioneRigaDocumento) { + this.descrizioneRigaDocumento = descrizioneRigaDocumento; + } + + public long getCodiceAlt() { + return this.codiceAlt; + } + + public void setCodiceAlt(long codiceAlt) { + this.codiceAlt = codiceAlt; + } + + public void findByCodiceAlt(long l_codiceAlt) { + String s_Sql_Find = "select A.* from ARTICOLO_USATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codiceAlt=" + l_codiceAlt); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloUsatoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloUsatoCR.java new file mode 100644 index 00000000..38bbe8f5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloUsatoCR.java @@ -0,0 +1,115 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class ArticoloUsatoCR extends CRAdapter { + private long id_articoloUsato; + + private Articolo articolo; + + private Date dataDocumento; + + private String numeroDocumento; + + private long flgTipoDocumento; + + private double importo; + + private long id_fornitore; + + private long id_rigaFattura; + + private long id_articolo; + + private long id_cliente; + + public ArticoloUsatoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloUsatoCR() {} + + public long getId_articoloUsato() { + return this.id_articoloUsato; + } + + public void setId_articoloUsato(long id_articoloUsato) { + this.id_articoloUsato = id_articoloUsato; + } + + public Date getDataDocumento() { + return this.dataDocumento; + } + + public void setDataDocumento(Date dataDocumento) { + this.dataDocumento = dataDocumento; + } + + public String getNumeroDocumento() { + return (this.numeroDocumento == null) ? AB_EMPTY_STRING : this.numeroDocumento.trim(); + } + + public void setNumeroDocumento(String numeroDocumento) { + this.numeroDocumento = numeroDocumento; + } + + public long getFlgTipoDocumento() { + return this.flgTipoDocumento; + } + + public void setFlgTipoDocumento(long flgTipoDocumento) { + this.flgTipoDocumento = flgTipoDocumento; + } + + public double getImporto() { + return this.importo; + } + + public void setImporto(double importo) { + this.importo = importo; + } + + public long getId_fornitore() { + return this.id_fornitore; + } + + public void setId_fornitore(long id_fornitore) { + this.id_fornitore = id_fornitore; + } + + public long getId_rigaFattura() { + return this.id_rigaFattura; + } + + public void setId_rigaFattura(long id_rigaFattura) { + this.id_rigaFattura = id_rigaFattura; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public void setArticolo(Articolo articolo) { + this.articolo = articolo; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + setArticolo(null); + } + + public long getId_cliente() { + return this.id_cliente; + } + + public void setId_cliente(long id_cliente) { + this.id_cliente = id_cliente; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloVariante.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloVariante.java new file mode 100644 index 00000000..53c32ecc --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloVariante.java @@ -0,0 +1,1907 @@ +package it.acxent.art; + +import it.acxent.anag.Clifor; +import it.acxent.anag.Listino; +import it.acxent.anag.ListinoArticolo; +import it.acxent.anag.MagFisico; +import it.acxent.anag.PrezzoArticolo; +import it.acxent.anag.Users; +import it.acxent.cart.CartItemId; +import it.acxent.cart.CartItemIterface; +import it.acxent.contab.Movimento; +import it.acxent.contab.MovimentoCR; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.RigaDocumentoCR; +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.gtm.GoogleDataLayerBuilder; +import it.acxent.tex.anag.ArticoloArticoloTessuto; +import it.acxent.tex.anag.ArticoloTessutoColore; +import it.acxent.util.DoubleOperator; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Timestamp; + +public class ArticoloVariante extends _ArtAdapter implements Serializable, CartItemIterface, AddImgInterface, ArticoloInterface { + protected static final String _PATH_VAR = "_var/"; + + private static final long serialVersionUID = -4258127388426340159L; + + private ListinoArticolo listinoArticoloVarianteBase; + + private Listino listinoBase; + + private long id_articolo; + + private String codiceVariante; + + private String nomeV; + + private String coloreVHex; + + private Articolo articolo; + + private String descrizioneV_it; + + private long flgWebNoVenditaAv; + + private long flgUdmAv; + + private double quantitaAv; + + private String descrizioneVetrinaV_it; + + private String codiciAlternativiV; + + private boolean quantitaCalcolateAv; + + private double quantitaEffettivaAv; + + private double quantitaImpegnataAv; + + private double quantitaInArrivoAv; + + private long id_vetrina; + + private Vetrina vetrina; + + private long flgInAggiornamento; + + private String quantitaMagazzinoMovimentoHtml; + + private String descrizioneSearchAv; + + private String keywordsAv; + + private String ebayItemIdAv; + + private long flgSubitoAv; + + private long flgGoogleAv; + + private long flgEbayAv; + + private String readyForWebAv; + + private long qtaSuEbayAv; + + private long impressionAv; + + private Timestamp tmstLastImpressionAv; + + private double qtaAttribuitaV; + + private double qtaInProduzioneV; + + private String codiceSerieV; + + private long flgStockV; + + private String descrizioneVarianteSerie; + + private long flgNonOrdinabile; + + private long flgDispo; + + private PrezzoArticolo prezzoArticoloVariante; + + private PrezzoArticolo prezzoArticoloVarianteIva; + + private String metaDesc; + + private String metaTag; + + private long flgNascondi; + + private long flgEscludiWebAv; + + private double quantitaAvW; + + private String codiciMagazzino; + + private Colore colore; + + private long id_colore; + + private String codicePromozioneAV; + + private long id_articoloVariante; + + private String ebayOfferIdAv; + + public String getColoreVHex() { + return (this.coloreVHex == null) ? "" : this.coloreVHex.trim(); + } + + public String getFontColoreVHex() { + return getFontColoreHex(getColoreVHex()); + } + + public void setColoreVHex(String coloreHex) { + this.coloreVHex = coloreHex; + } + + public ArticoloVariante(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloVariante() {} + + public void setId_articoloVariante(long newId_articoloVariante) { + this.id_articoloVariante = newId_articoloVariante; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public Vectumerator findByCR(ArticoloVarianteCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A, ARTICOLO AS B, TIPO AS C"; + String s_Sql_Order = " order by C.ordine, A.id_articolo"; + if (CR.getFlgOrdinaArticolo() > 0L) + s_Sql_Order = " order by C.ordine,B.ordine, A.id_articolo"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=B.id_articolo"); + wc.addWc("B.id_tipo=C.id_tipo"); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(B.nome like '%" + token + "%' or A.nomeV like '%" + token + "%' or A.codiceVariante like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (!CR.getSearchTxtWeb().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxtWeb(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(B.nome like '%" + token + "%' or A.nomeV like '%" + token + "%' or A.codiceVariante like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_articolo() > 0L) + wc.addWc("A.id_articolo=" + CR.getId_articolo()); + if (CR.getFlgEscludiWeb() == 0L) + wc.addWc("(B.flgEscludiWeb=0 or B.flgEscludiWeb is null)"); + if (CR.getFlgNascondi() == 0L) { + wc.addWc("(A.flgNascondi=0 or A.flgNascondi is null)"); + wc.addWc("(B.flgNascondi=0 or B.flgNascondi is null)"); + wc.addWc("(C.flgNascondi=0 or C.flgNascondi is null)"); + } else if (CR.getFlgNascondi() > 0L) { + wc.addWc("A.flgNascondi=" + CR.getFlgNascondi()); + wc.addWc("B.flgNascondi=" + CR.getFlgNascondi()); + wc.addWc("C.flgNascondi=" + CR.getFlgNascondi()); + } + if (!CR.getCodiceVariante().isEmpty()) + wc.addWc("A.codiceVariante='" + CR.getCodiceVariante() + "'"); + if (CR.getId_tipoSel() != 0L) + wc.addWc("(B.id_tipo=" + CR.getId_tipoSel() + " or C.indici like'%:" + CR.getId_tipoSel() + ":%')"); + if (CR.getFlgQta() == 1L) + if (CR.getQtaDa() == 0L) { + wc.addWc("A.quantitaAv<=" + CR.getQtaA()); + } else { + wc.addWc("A.quantitaAv>=" + CR.getQtaDa()); + wc.addWc("A.quantitaAv<=" + CR.getQtaA()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getImgFileName(int imgNumber) { + return getImgFileName(imgNumber, getImgTmst()); + } + + public String getImgFileName(int imgNumber, String oldTmst) { + return "" + getId_articoloVariante() + "_" + getId_articoloVariante() + "_" + getId_articolo() + "_" + oldTmst + ".jpg"; + } + + public Vectumerator findById_articolo(long l_id_articolo, int pageNumber, int pageRows, long flgDisponibile, long flgNascondi) { + String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A"; + String s_Sql_Order = " order by nomeV"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + if (flgDisponibile > 0L) + wc.addWc("A.flgDispo=1"); + if (flgNascondi == 0L) { + wc.addWc("(A.flgNascondi is null or A.flgNascondi =0)"); + } else if (flgNascondi > 0L) { + wc.addWc("A.flgNascondi=" + flgNascondi); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findById_articoloCodiceVariante(long l_id_articolo, String l_codiceVariante) { + String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_articolo=" + l_id_articolo); + wc.addWc("codiceVariante='" + prepareInputMySqlString(l_codiceVariante, false) + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getDescrizione() { + if (getTipo().getFlgUsaVarianteColori() == 1L) { + String str = getArticolo().getNome() + " " + getArticolo().getNome(); + return str.trim(); + } + String temp = getArticolo().getNome() + " " + getArticolo().getNome(); + return temp.trim(); + } + + public void clearScaledImg(String l_pathPrefix) { + if (getDBState() == 1) { + String targetDir = getDocBase() + getDocBase() + "var/" + getArticolo().getPathImg(); + String l_imgCode = "" + getId_articoloVariante() + "_" + getId_articoloVariante() + "_" + getId_articolo() + "_"; + File dir = new File(targetDir); + File[] imgs = dir.listFiles(); + File tehImage = null; + for (int i = 0; i < imgs.length; i++) { + tehImage = imgs[i]; + if (tehImage.getName().indexOf(l_imgCode) != -1) + tehImage.delete(); + } + } + } + + public Vectumerator getDisponibilitaMovimento() { + RigaDocumentoCR CR = new RigaDocumentoCR(); + CR.setId_articolo(getId_articolo()); + CR.setId_articoloVariante(getId_articoloVariante()); + CR.setFlgInMagazzino(3L); + return new RigaDocumento(getApFull()).findMagSaldiArticoloByCR(CR, 0, 0); + } + + public Vectumerator getDisponibilitaMovimentoM() { + MovimentoCR CR = new MovimentoCR(); + CR.setId_articolo(getId_articolo()); + CR.setId_articoloVariante(getId_articoloVariante()); + CR.setFlgInMagazzino(3L); + return new Movimento(getApFull()).findSaldiArticoloByCR(CR, 0, 0); + } + + protected void deleteCascade() { + String targetDir = getDocBase() + getDocBase(); + for (int i = 0; i < 5; i++) + new File(targetDir + targetDir).delete(); + } + + public String getCodiceVariante() { + return (this.codiceVariante == null) ? "" : this.codiceVariante; + } + + public void setCodiceVariante(String codiceVariante) { + this.codiceVariante = codiceVariante; + } + + public void setDescrizioneV_it(String descrizioneV_it) { + this.descrizioneV_it = descrizioneV_it; + } + + public String getNome(String lang) { + String temp = getArticolo().getNome(lang) + " " + getArticolo().getNome(lang); + return temp; + } + + public String getDescrizioneV(String lang) { + return getDescTxtLang("descrizioneV", lang); + } + + public String getDescrizioneVetrinaV(String lang) { + return getDescTxtLang("descrizioneVetrinaV", lang); + } + + public String getDescrizioneVetrinaV_it() { + return (this.descrizioneVetrinaV_it == null) ? "" : this.descrizioneVetrinaV_it; + } + + public void setDescrizioneVetrinaV_it(String descrizioneCommV_it) { + this.descrizioneVetrinaV_it = descrizioneCommV_it; + } + + public boolean isImgExist(int imgNumber) { + String targetDir = getDocBase() + getDocBase(); + return isFileExist(targetDir + targetDir); + } + + public long getFlgNascondi() { + return this.flgNascondi; + } + + public boolean isVisibileWww() { + if (getFlgNascondi() == 0L && getArticolo().getFlgNascondi() == 0L && getArticolo().getFlgEscludiWeb() == 0L && + getFlgEscludiWebAv() == 0L) + return true; + return false; + } + + public void setFlgNascondi(long flgNascondi) { + this.flgNascondi = flgNascondi; + } + + public String getNascondi() { + return Articolo.getNascondi(getFlgNascondi()); + } + + public String getLinkPreview() { + if (getApFull() != null) { + String temp = getParm("SERVERNAME").getTesto(); + return temp + "Catalogo.abl?cmd=md&id_articolo=&id_articoloVariante=" + temp + "&id_tipoMenu=" + getId_articoloVariante() + "&id_tipoSel=" + + getArticolo().getId_tipo(); + } + return ""; + } + + public ResParm addAccessorio(Accessorio row) { + ArticoloVariante bean = new ArticoloVariante(getApFull()); + if (row.getId_accessorio() != 0L) + bean.findByPrimaryKey(row.getId_accessorio()); + row.setDBState(bean.getDBState()); + ResParm rp = row.save(); + return rp; + } + + public ResParm delAccessorio(Accessorio row) { + Accessorio bean = new Accessorio(getApFull()); + bean.findByPrimaryKey(row.getId_accessorio()); + return bean.delete(); + } + + public Vectumerator getAccessori() { + return new Accessorio(getApFull()).findById_articoloVariante(getId_articoloVariante(), 0, 0); + } + + public Vectumerator getAccessoriDisponibili() { + return new Accessorio(getApFull()).findById_articoloVarianteDisponibile(getId_articoloVariante(), 0, 0); + } + + public boolean hasAccessori() { + return getAccessori().hasMoreElements(); + } + + public ResParm aggiornaQuantitaAv(long l_flgUdm, double l_qta) { + setFlgUdmAv(l_flgUdm); + setQuantitaAv(l_qta); + return save(); + } + + public long getFlgUdmAv() { + return this.flgUdmAv; + } + + public void setFlgUdmAv(long flgUdmAv) { + this.flgUdmAv = flgUdmAv; + } + + public double getQuantitaAv(Date dataA) { + if (getParm("USA_MAGAZZINO").isFalse()) { + RigaDocumento mov = new RigaDocumento(getApFull()); + mov.findMagDisponibilita(getId_articolo(), getId_articoloVariante(), 0L, null, 1L, 0L, dataA); + return mov.getQuantita(); + } + return this.quantitaAv; + } + + public double getQuantitaAvM(Date dataA) { + if (getParm("USA_MAGAZZINO").isFalse()) { + Movimento mov = new Movimento(getApFull()); + mov.findDisponibilita(getId_articolo(), getId_articoloVariante(), 0L, null, 1L, 0L, dataA); + return mov.getQuantita(); + } + return this.quantitaAv; + } + + public void setQuantitaAv(double quantitaAv) { + this.quantitaAv = quantitaAv; + } + + public String getUdmAv() { + return TipologiaArticolo.getUdm(getFlgUdmAv()); + } + + public String getNomeV() { + return (this.nomeV == null) ? "" : this.nomeV.trim(); + } + + public void setNomeV(String nomeV) { + this.nomeV = nomeV; + } + + public String getDescrizioneCompleta(String lang) { + if (lang == null || lang.isEmpty()) + lang = "it"; + StringBuilder sb = new StringBuilder(); + if (getParm("DOC_ARTICOLI_CON_CODICE").isTrue()) { + sb.append(getCodiceVariante() + " " + getCodiceVariante()); + } else { + sb.append(getDescrizioneCompletaSenzaCodice(lang)); + } + if (getParm("DOC_ARTICOLI_CON_TIPO").isTrue() && getTipo() != null) { + sb.append(" "); + sb.append(getTipo().getDescrizione(lang)); + } + return sb.toString(); + } + + public String getDescrizioneCompletaSenzaCodice(String lang) { + StringBuilder sb = new StringBuilder(); + if (getTipo().getFlgUsaVarianteColori() == 1L) { + String l_colore = getColore().getDescrizioneCompleta(); + if (lang != null) + l_colore = getColore().getDescrizione(lang); + sb.append(getArticolo().getDescrizioneCompletaSenzaCodice(lang) + " " + getArticolo().getDescrizioneCompletaSenzaCodice(lang)); + } else { + String l_nome = getNomeV(); + if (lang != null) + l_nome = getNomeV(lang); + sb.append(getArticolo().getDescrizioneCompletaSenzaCodice(lang) + " " + getArticolo().getDescrizioneCompletaSenzaCodice(lang)); + } + return sb.toString(); + } + + public String getCodiciAlternativiV() { + return (this.codiciAlternativiV == null) ? "" : this.codiciAlternativiV; + } + + public void setCodiciAlternativiV(String codiciAlternativiV) { + this.codiciAlternativiV = codiciAlternativiV; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + String temp = getCodiciAlternativiV(); + if (!temp.isEmpty()) { + if (!temp.startsWith(",")) + temp = "," + temp; + if (!temp.endsWith(",")) + temp = temp + ","; + } + setCodiciAlternativiV(temp); + temp = getReadyForWebAv(); + if (isReadyForWeb(getCurrentLang())) { + if (temp.indexOf(getCurrentLang()) < 0) + temp = temp + "," + temp; + } else if (temp.indexOf(getCurrentLang()) >= 0) { + temp = temp.replace("," + getCurrentLang(), ""); + } + if (!temp.isEmpty()) { + if (!temp.startsWith(",")) + temp = "," + temp; + if (!temp.endsWith(",")) + temp = temp + ","; + } + setReadyForWebAv(temp.replace(", ", ",")); + super.prepareSave(ps); + } + + public Object getItemId() { + return new Long(getId_articoloVariante()); + } + + public double getPrice() { + return getPrezzoPubblico(); + } + + public boolean isSale() { + return getArticolo().isSale(); + } + + public boolean isRM() { + return getArticolo().isRM(); + } + + public double getDiscount() { + return getArticolo().getPercSconto(); + } + + public double getCost() { + return getArticolo().getCostoMinimo(); + } + + public String getCartItemDescription(String lang) { + return getNome(lang).replace("/", "/ "); + } + + public String getCartItemDescription2(String lang) { + return getArticolo().getDescrizione(lang); + } + + public String getCartItemDescription3(String lang) { + return getCodiceVariante(); + } + + public long getCartItemUdm() { + return getArticolo().getFlgUdm(); + } + + public double getAvail() { + return getQuantitaAvByMagFisico(1L); + } + + public double getIvaAliquota(long l_id_users) { + return getArticolo().getIvaAliquota(l_id_users); + } + + public long getIvaItemId(long l_id_users) { + return getArticolo().getIvaItemId(l_id_users); + } + + public String getCartItemImage() { + if (new File(getDocBase() + getDocBase() + getPathImg()).exists()) + return getImgFileName(1); + return getArticolo().getImgFileName(1); + } + + public double getPrice(long l_id_users) { + if (l_id_users == 0L) + return getPrice(); + Users user = new Users(getApFull()); + user.findByPrimaryKey(l_id_users); + if (user.getId_clifor() >= 0L) + return getPrezzoPubblico(user.getClifor()); + return getPrice(); + } + + public String getCartItemDescriptionUrl() { + return getArticolo().getDescrizioneUrl(); + } + + public String getPathImg() { + return getArticolo().getPathImg() + "_var/"; + } + + public double getPrezzoPubblicoIva() { + return getPrezzoArticoloVarianteIva(null).getPrezzoFinale(); + } + + public double getPercSconto() { + return getListinoArticoloVarianteBase().getPercEffettiva(); + } + + public long getId_tipo() { + return 0L; + } + + public long getId_tipoPadre() { + return 0L; + } + + public String getDescrizioneVetrina() { + return getDescrizioneVetrinaV_it(); + } + + public String getDescrizioneVetrina(String lang) { + return getDescrizioneVetrinaV(lang); + } + + public long getId() { + return getId_articoloVariante(); + } + + public double getPrezzoPubblicoIva(Clifor l_clifor) { + return getPrezzoArticoloVarianteIva(l_clifor).getPrezzoFinale(); + } + + public String getDescrizioneUrl() { + return getDescrizioneNomeUrl(); + } + + public int getDispoLevel() { + double qt = getQuantitaEffettivaAv(); + double dispoLevelScarsa = getParm("CC_QTA_LOW").getNumero(); + if (qt <= 0.0D) + return 0; + if (qt > 0.0D && qt < dispoLevelScarsa) + return 1; + if (qt >= dispoLevelScarsa) + return 2; + return 0; + } + + private synchronized void calcolaQuantita() { + if ((!isQuantitaCalcolateAv() ? true : false) & ((this.id_articoloVariante != 0L) ? true : false)) { + long l_flgDispo; + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagDisponibilita(getId_articolo(), getId_articoloVariante(), 0L, null, 1L, 0L, null); + double q = rd.getQuantita(); + double nr = rd.getNr(); + double kg = rd.getKg(); + double mt = rd.getMt(); + setQuantitaAvW(q); + setQuantitaAv(q); + setQuantitaImpegnataAv(new RigaDocumento(getApFull()).getQuantitaImpegnataByArticoloVariante(getId_articoloVariante())); + double q1 = new RigaDocumento(getApFull()).getQuantitaInArrivoByArticoloVariante(this); + setQuantitaInArrivoAv(q1); + if (!getArticolo().usaMagazzino()) { + setQuantitaEffettivaAv(0.0D); + } else { + DoubleOperator dop = new DoubleOperator(getQuantitaAv()); + dop.add(this.quantitaInArrivoAv); + dop.subtract(this.quantitaImpegnataAv); + setQuantitaEffettivaAv(dop.getResult()); + } + this.quantitaMagazzinoMovimentoHtml = Articolo.getMovimentoHtmlDesc(getArticolo().getTipologiaArticolo(), q, nr, kg, mt, this.quantitaInArrivoAv, this.quantitaImpegnataAv, this.quantitaEffettivaAv, + getArticolo().usaMagazzino(), + getParm("USA_MAGAZZINO").isTrue(), getNf()); + if (!getArticolo().usaMagazzino()) { + l_flgDispo = 1L; + } else { + l_flgDispo = (q > 0.0D) ? 1L : 0L; + } + String SEP = ","; + MagFisico mf = new MagFisico(getApFull()); + rd = new RigaDocumento(getApFull()); + Vectumerator vec = mf.findByTipo(0L); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + MagFisico row = (MagFisico)vec.nextElement(); + rd.findMagDisponibilitaPuntuale(getId_articolo(), getId_articoloVariante(), 0L, null, row.getId_magFisico(), 0L, 0L); + if (rd.getQuantita() > 0.0D) { + sb.append(row.getId_magFisico()); + sb.append(","); + } + } + if (sb.length() > 0) + sb.insert(0, ","); + String temp = "update ARTICOLO_VARIANTE set quantitaMagazzinoMovimentoHtml='" + this.quantitaMagazzinoMovimentoHtml + "', quantitaInArrivoAv=" + this.quantitaInArrivoAv + ", quantitaImpegnataAv=" + this.quantitaImpegnataAv + ", quantitaAv=" + this.quantitaAv + ", quantitaEffettivaAv=" + this.quantitaEffettivaAv + ",quantitaCalcolateAv=true, flgDispo=" + l_flgDispo + ", codiciMagazzino='" + + + + sb.toString() + "' where id_articoloVariante=" + getId_articoloVariante(); + update(temp); + setQuantitaCalcolateAv(true); + } + } + + public double getQuantitaEffettivaAv() { + if (!isQuantitaCalcolateAv()) + calcolaQuantita(); + return this.quantitaEffettivaAv; + } + + public double getQuantitaImpegnataAv() { + if (!isQuantitaCalcolateAv()) + calcolaQuantita(); + return this.quantitaImpegnataAv; + } + + public double getQuantitaInArrivoAv() { + if (!isQuantitaCalcolateAv()) + calcolaQuantita(); + return this.quantitaInArrivoAv; + } + + public boolean isQuantitaCalcolateAv() { + return this.quantitaCalcolateAv; + } + + public void setQuantitaEffettivaAv(double quantitaEffettiva) { + this.quantitaEffettivaAv = quantitaEffettiva; + } + + public void setQuantitaImpegnataAv(double quantitaImpeggnata) { + this.quantitaImpegnataAv = quantitaImpeggnata; + } + + public void setQuantitaInArrivoAv(double quantitaInArrivo) { + this.quantitaInArrivoAv = quantitaInArrivo; + } + + public void setQuantitaCalcolateAv(boolean quantitaCalcolateAv) { + this.quantitaCalcolateAv = quantitaCalcolateAv; + } + + public String getDispoLevelDesc() { + return Articolo.getDispoLevelDesc(getDispoLevel()); + } + + public boolean isFlgVetrinaByArticolo(long l_id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_articolo=" + l_id_articolo); + wc.addWc("id_vetrina>0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + if (getDBState() == 1) + return true; + return false; + } catch (SQLException e) { + handleDebug(e); + return false; + } + } + + public String getDescrizioneVetrinaV_itScript() { + return DBAdapter.prepareScriptString(getDescrizioneVetrinaV_it(), true, false); + } + + public boolean useDescLangTables() { + return true; + } + + public String getCartItemTag() { + return "av_"; + } + + public String getDescrizioneVetrinaVScript(String lang) { + return DBAdapter.prepareScriptString(getDescrizioneVetrinaV(lang), true, false); + } + + public String getDescrizioneV_it() { + return this.descrizioneV_it; + } + + public Vetrina getVetrina() { + this.vetrina = (Vetrina)getSecondaryObject(this.vetrina, Vetrina.class, getId_vetrina()); + return this.vetrina; + } + + public void setId_vetrina(long id_vetrina) { + this.id_vetrina = id_vetrina; + setVetrina(null); + } + + public long getId_vetrina() { + return this.id_vetrina; + } + + public void setVetrina(Vetrina vetrina) { + this.vetrina = vetrina; + } + + public ResParm addArticoloTaglia(ArticoloTaglia row) { + ResParm rp = new ResParm(true); + ArticoloTaglia bean = new ArticoloTaglia(getApFull()); + bean.findByArticoloTaglia(row.getId_articolo(), row.getId_articoloVariante(), row.getId_taglia()); + if (bean.getDBState() == 1) { + bean.setCodiceAT(row.getCodiceAT()); + rp = bean.save(); + } else { + row.setDBState(0); + rp = row.save(); + } + return rp; + } + + public ResParm delTaglia(ArticoloTaglia row) { + ArticoloTaglia bean = new ArticoloTaglia(getApFull()); + bean.findByPrimaryKey(row.getId_articoloTaglia()); + return bean.delete(); + } + + @Deprecated + public String getQuantitaMagazzinoHtml() { + StringBuilder sb = new StringBuilder(); + if (getQuantitaAv() < 0.0D) { + sb.append(" "); + sb.append(getNf().format(getQuantitaAv())); + sb.append(""); + } else { + sb.append(getNf().format(getQuantitaAv())); + } + sb.append(" + "); + sb.append(" "); + sb.append(getNf().format(getQuantitaInArrivoAv())); + sb.append(""); + sb.append(" - "); + sb.append(" "); + sb.append(getNf().format(getQuantitaImpegnataAv())); + sb.append(""); + sb.append(" = "); + sb.append(" "); + sb.append(getNf().format(getQuantitaEffettivaAv())); + sb.append(""); + return sb.toString(); + } + + public double getQtaDaRiordinare() { + DoubleOperator qrow = new DoubleOperator(); + qrow.subtract(getQuantitaEffettivaAv()); + if (qrow.getResult() <= 0.0D) + return 0.0D; + return qrow.getResult(); + } + + public long getTipoArticoloVetrina() { + return 1L; + } + + private long qtaEbayAv = 0L; + + private String codiceEanAv; + + private long id_statoUsato; + + private StatoUsato statoUsato; + + private long id_magFisico; + + private MagFisico magFisico; + + public double getQtaAttribuitaV() { + return this.qtaAttribuitaV; + } + + public void setQtaAttribuitaV(double qtaAttribuitaV) { + this.qtaAttribuitaV = qtaAttribuitaV; + } + + public double getQtaInProduzioneV() { + return this.qtaInProduzioneV; + } + + public void setQtaInProduzioneV(double qtaInProduzioneV) { + this.qtaInProduzioneV = qtaInProduzioneV; + } + + public String getCodiceSerieV() { + return (this.codiceSerieV == null) ? "" : this.codiceSerieV; + } + + public void setCodiceSerieV(String codiceSerieV) { + this.codiceSerieV = codiceSerieV; + } + + public double getDisponibile() { + DoubleOperator dp = new DoubleOperator(getQuantitaAv()); + dp.add(getQtaInProduzioneV()); + dp.subtract(getQtaAttribuitaV()); + return dp.getResult(); + } + + public ResParm addListinoArticolo(ListinoArticolo row) { + ResParm rp = new ResParm(true); + ListinoArticolo bean = new ListinoArticolo(getApFull()); + bean.findByArticoloVarianteListino(row.getId_articoloVariante(), row.getId_listino()); + if (bean.getDBState() == 1) { + bean.setPrezzoLA(row.getPrezzoLA()); + bean.setPercLA(row.getPercLA()); + bean.setPercLA1(row.getPercLA1()); + bean.setPercLA2(row.getPercLA2()); + bean.setPercLA3(row.getPercLA3()); + rp = bean.save(); + } else { + row.setDBState(0); + rp = row.save(); + } + return rp; + } + + public ResParm delListinoArticolo(ListinoArticolo row) { + ListinoArticolo bean = new ListinoArticolo(getApFull()); + bean.findByPrimaryKey(row.getId_listinoArticolo()); + return bean.delete(); + } + + public Vectumerator findByArticoloTessuti(long l_id_articolo, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByArticoloColoreSerieStock(long l_id_articolo, long l_id_colore, long l_id_serie, long l_flgStock) { + String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + wc.addWc("A.nomeV=" + l_id_colore); + wc.addWc("A.flgStockV=" + l_flgStock); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByArticoloColore(long l_id_articolo, long l_id_colore) { + String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + wc.addWc("A.id_colore=" + l_id_colore); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public long getFlgStockV() { + return this.flgStockV; + } + + public void setFlgStockV(long flgStockV) { + this.flgStockV = flgStockV; + } + + public String getDescrizioneVarianteSerie() { + return getNomeV() + " " + getNomeV(); + } + + public void setDescrizioneVarianteSerie(String descrizioneVarianteSerie) { + this.descrizioneVarianteSerie = descrizioneVarianteSerie; + } + + public long getId_fornitoreAbituale() { + ArticoloFornitore af = new ArticoloFornitore(getApFull()); + af.findByArticoloFornitoreAbituale(getId_articolo()); + return af.getId_clifor(); + } + + public String getQuantitaMagazzinoMovimentoHtml() { + if (getParm("USA_MAGAZZINO").isTrue()) + return getNf().format(getQuantitaAv()); + if (!isQuantitaCalcolateAv() && this.id_articoloVariante != 0L) + calcolaQuantita(); + return (this.quantitaMagazzinoMovimentoHtml == null) ? "" : this.quantitaMagazzinoMovimentoHtml; + } + + public long getFlgNonOrdinabile() { + return this.flgNonOrdinabile; + } + + public void setFlgNonOrdinabile(long flgNonOrdinabile) { + this.flgNonOrdinabile = flgNonOrdinabile; + } + + public long getFlgDispo() { + return this.flgDispo; + } + + public void setFlgDispo(long flgDispo) { + this.flgDispo = flgDispo; + } + + public long getFlgInAggiornamento() { + return this.flgInAggiornamento; + } + + public void setFlgInAggiornamento(long flgInAggiornamento) { + this.flgInAggiornamento = flgInAggiornamento; + } + + public void setQuantitaMagazzinoMovimentoHtml(String quantitaMagazzinoMovimentoHtml) { + this.quantitaMagazzinoMovimentoHtml = quantitaMagazzinoMovimentoHtml; + } + + public ResParm save() { + if (getCodiceVariante().isEmpty()) + aggiornaCodiceVariante(String.valueOf(DBAdapter.getTimestamp().getTime())); + ResParm rp = super.save(); + if (rp.getStatus()) { + StringBuilder sb = new StringBuilder(); + String lingue = getParm("LANG_AVAILABLE").getTesto(); + if (lingue.isEmpty()) + lingue = "it"; + StringTokenizer st = new StringTokenizer(lingue, ","); + while (st.hasMoreTokens()) { + String currentLang = st.nextToken(); + sb.append(getTipo().getDescrizioneCompletaSpaces(currentLang)); + sb.append(" "); + sb.append(getNomeV(currentLang)); + sb.append(" "); + sb.append(getArticolo().getNome(currentLang)); + sb.append(" "); + } + sb.append(getMarca().getDescrizione()); + sb.append(" "); + sb.append(getNomeV()); + sb.append(" "); + sb.append(getCodiceVariante()); + sb.append(" "); + if (!getKeywordsAv().isEmpty()) + sb.append(getKeywordsAv()); + String descSearch = eliminaDoppioniInStringa(sb.toString().toLowerCase().replace('/', ' ').replace('\\', ' '), 2, true); + if (descSearch.length() > 1000) { + setDescrizioneSearchAv(descSearch.substring(0, 990)); + } else { + setDescrizioneSearchAv(descSearch); + } + ListinoArticolo listinoArticoloVarianteBase = new ListinoArticolo(getApFull()); + listinoArticoloVarianteBase.findByArticoloVarianteListino(getId_articoloVariante(), getListinoBase().getId_listino()); + if (listinoArticoloVarianteBase.getId_listinoArticolo() > 0L && + listinoArticoloVarianteBase.hasStessiValori(getArticolo().getListinoArticoloBase())) + listinoArticoloVarianteBase.delete(); + rp = super.save(); + } + return rp; + } + + public ResParm aggiornaCodiceVariante(String l_codice) { + setCodiceVariante(l_codice); + return super.save(); + } + + public void resetCalcoloQuantita() { + if (getId_articoloVariante() > 0L) { + update("update ARTICOLO_VARIANTE set quantitaCalcolateAv=false where id_articoloVariante=" + getId_articoloVariante()); + setQuantitaCalcolateAv(false); + } + } + + public Vectumerator findWebByArticoloCR(ArticoloCR CR, int pageNumber, int pageRows) { + StringBuffer s_Sql_Find = new StringBuffer("select A.* from ARTICOLO_VARIANTE AS A, ARTICOLO AS B LEFT JOIN TIPO AS C2 ON B.id_tipo2=C2.id_tipo, TIPO AS C "); + if (!CR.getSearchTxtWeb().isEmpty() && !CR.getSearchTxtWeb().equals("*")) + s_Sql_Find = new StringBuffer("select A.* from ARTICOLO_VARIANTE AS A inner join DESC_TXT_LANG AS X ON A.id_articoloVariante=X.idTabella, ARTICOLO AS B LEFT JOIN TIPO AS C2 ON B.id_tipo2=C2.id_tipo, TIPO AS C "); + String s_Sql_Order = " order by B.ordine desc, C.ordine, A.id_articolo"; + s_Sql_Order = " order by B.ordine desc,C.ordine,B.nome, A.nomeV, A.id_articolo"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=B.id_articolo"); + wc.addWc("B.id_tipo=C.id_tipo"); + if (CR.getId_lista1() > 0L) { + s_Sql_Find.append(" , CARATTERISTICA_ARTICOLO AS CA1"); + wc.addWc("B.id_articolo=CA1.id_articolo"); + } + if (!CR.getSearchTxtWeb().isEmpty() && !CR.getSearchTxtWeb().equals("*")) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxtWeb(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(B.nome like '%" + token + "%' or A.nomeV like '%" + token + "%' or X.descrizione254 like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getFlgEscludiWeb() == 0L) { + wc.addWc("(B.flgEscludiWeb=0 or B.flgEscludiWeb is null)"); + wc.addWc("(A.flgEscludiWebAv=0 or A.flgEscludiWebAv is null)"); + } + if (CR.getFlgNascondi() == 0L) { + wc.addWc("(A.flgNascondi=0 or A.flgNascondi is null)"); + wc.addWc("(B.flgNascondi=0 or B.flgNascondi is null)"); + wc.addWc("(C.flgNascondi=0 or C.flgNascondi is null)"); + } else if (CR.getFlgNascondi() > 0L) { + wc.addWc("A.flgNascondi=" + CR.getFlgNascondi()); + wc.addWc("B.flgNascondi=" + CR.getFlgNascondi()); + wc.addWc("C.flgNascondi=" + CR.getFlgNascondi()); + } + if (CR.getId_lista1() != 0L) + wc.addWc("CA1.id_lista=" + CR.getId_lista1()); + if (CR.getId_tipoSel() != 0L) + wc.addWc("(B.id_tipo=" + CR.getId_tipoSel() + " or C.indici like'%:" + CR.getId_tipoSel() + ":%'or B.id_tipo2=" + + CR.getId_tipoSel() + " or C2.indici like'%:" + CR.getId_tipoSel() + ":%')"); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Date getDataCambiamentoPrezzo() { + return getListinoArticoloVarianteBase().getDataCambiamentoPrezzoLA(); + } + + public Date getDataScadenzaOffertaWeb() { + return getListinoArticoloVarianteBase().getDataScadenzaOffertaLA(); + } + + public ListinoArticolo getListinoArticoloVarianteBase() { + if (this.listinoArticoloVarianteBase == null && getApFull() != null && getId_articoloVariante() != 0L) { + this.listinoArticoloVarianteBase = new ListinoArticolo(getApFull()); + this.listinoArticoloVarianteBase.findByArticoloVarianteListino(getId_articoloVariante(), getListinoBase().getId_listino()); + if (this.listinoArticoloVarianteBase.getId_listinoArticolo() == 0L) + this.listinoArticoloVarianteBase = getArticolo().getListinoArticoloBase(); + } + return (this.listinoArticoloVarianteBase == null) ? new ListinoArticolo(getApFull()) : this.listinoArticoloVarianteBase; + } + + public Listino getListinoBase() { + if (this.listinoBase == null && getApFull() != null) + this.listinoBase = Listino.dammiListinoBase(getApFull()); + return this.listinoBase; + } + + public double getAbbuonoPrezzoPubblico() { + return getListinoArticoloVarianteBase().getAbbuonoPrezzoPubblicoLA(); + } + + public double getPrezzoPubblico() { + return getPrezzoArticoloVariante(null).getPrezzoFinale(); + } + + public double getPrezzoPubblico(Clifor l_clifor) { + return getPrezzoArticoloVariante(l_clifor).getPrezzoFinale(); + } + + public double getPrezzoBase() { + return getListinoArticoloVarianteBase().getPrezzoLA(); + } + + public double getPrezzoBaseIva() { + return DBAdapter.conIva(getListinoArticoloVarianteBase().getPrezzoLA(), (double)getArticolo().getIva().getAliquota()); + } + + public double getPrezzoBaseIva(Users user) { + if (user.getId_clifor() == 0L) + return DBAdapter.conIva(getListinoArticoloVarianteBase().getPrezzoLA(), (double)getArticolo().getIva().getAliquota()); + if (user.getClifor().isPrezzoWebEsente()) + return DBAdapter.conIva(getListinoArticoloVarianteBase().getPrezzoLA(), getArticolo().getIvaAliquota(user.getClifor())); + return DBAdapter.conIva(getListinoArticoloVarianteBase().getPrezzoLA(), (double)getArticolo().getIva().getAliquota()); + } + + public double getPrezzoBaseIvaConAbbuono() { + return getListinoArticoloVarianteBase().getPrezzoIvaAbbuonoLA(); + } + + public double getPriceWVat() { + return getPrezzoPubblicoIva(null); + } + + public double getPriceWVat(long l_id_users) { + if (l_id_users == 0L) + return getPriceWVat(); + Users user = new Users(getApFull()); + user.findByPrimaryKey(l_id_users); + if (user.getId_clifor() >= 0L) + return getPrezzoPubblicoIva(user.getClifor()); + return getPriceWVat(); + } + + public double getPrezzoOfferta() { + return getListinoArticoloVarianteBase().getPrezzoOffertaLA(); + } + + public double getPercScontoOfferta() { + return getListinoArticoloVarianteBase().getPercScontoOffertaLA(); + } + + public double getPrezzoOffertaIva() { + return getListinoArticoloVarianteBase().getPrezzoOffertaIvaLA(); + } + + public boolean hasListinoArticoloVarianteBase() { + if (getId_articoloVariante() > 0L) { + ListinoArticolo listinoArticoloVarianteBase = new ListinoArticolo(getApFull()); + listinoArticoloVarianteBase.findByArticoloVarianteListino(getId_articoloVariante(), getListinoBase().getId_listino()); + if (listinoArticoloVarianteBase.getId_articolo() > 0L) + return true; + return false; + } + return false; + } + + protected void initFields() { + super.initFields(); + setPrezzoArticoloVariante(null); + setPrezzoArticoloVarianteIva(null); + } + + public void setPrezzoArticoloVariante(PrezzoArticolo prezzoArticoloVariante) { + this.prezzoArticoloVariante = prezzoArticoloVariante; + } + + public void setPrezzoArticoloVarianteIva(PrezzoArticolo prezzoArticoloVarianteIva) { + this.prezzoArticoloVarianteIva = prezzoArticoloVarianteIva; + } + + public PrezzoArticolo getPrezzoArticoloVariante(Clifor clifor) { + if (this.prezzoArticoloVariante != null && clifor != null && this.prezzoArticoloVariante.getId_clifor() != clifor.getId_clifor()) { + this.prezzoArticoloVariante = null; + this.prezzoArticoloVarianteIva = null; + } + if (this.prezzoArticoloVariante == null && getId_articolo() > 0L) + if (clifor != null && clifor.getListino().getId_listino() > 0L) { + this.prezzoArticoloVariante = clifor.getListino().getPrezzo(this); + this.prezzoArticoloVariante.setId_clifor(clifor.getId_clifor()); + } else { + this.prezzoArticoloVariante = getListinoBase().getPrezzo(this); + } + return (this.prezzoArticoloVariante == null) ? new PrezzoArticolo() : this.prezzoArticoloVariante; + } + + public PrezzoArticolo getPrezzoArticoloVarianteIva(Clifor clifor) { + if (this.prezzoArticoloVarianteIva != null && clifor != null && this.prezzoArticoloVarianteIva.getId_clifor() != clifor.getId_clifor()) { + this.prezzoArticoloVariante = null; + this.prezzoArticoloVarianteIva = null; + } + if (this.prezzoArticoloVarianteIva == null && getId_articolo() > 0L) + this.prezzoArticoloVarianteIva = getPrezzoArticoloVariante(clifor).conIva((double)getArticolo().getIva().getAliquota()); + return (this.prezzoArticoloVarianteIva == null) ? new PrezzoArticolo() : this.prezzoArticoloVarianteIva; + } + + public boolean isOffertaValida() { + return getListinoArticoloVarianteBase().isOffertaValida(); + } + + public boolean isPrezzoBarratoValido() { + if (isOffertaValida()) + return false; + if (getArticolo().getPrezzoIvatoBarrato() > 0.0D && getArticolo().getPrezzoIvatoBarrato() > getPrezzoPubblicoIva(null)) + return true; + return false; + } + + public PrezzoArticolo getPrezzoArticolo(Clifor l_clifor) { + return getPrezzoArticoloVariante(l_clifor); + } + + public PrezzoArticolo getPrezzoArticoloIva(Clifor l_clifor) { + return getPrezzoArticoloVarianteIva(l_clifor); + } + + public double getQuantitaAv() { + return getQuantitaAv(null); + } + + public String getMetaDesc() { + return (this.metaDesc == null) ? "" : this.metaDesc.trim(); + } + + public String getMetaTag() { + return (this.metaTag == null) ? "" : this.metaTag; + } + + public void setMetaDesc(String metaDesc) { + this.metaDesc = metaDesc; + } + + public void setMetaTag(String metaTag) { + this.metaTag = metaTag; + } + + public void findArticoloVarianteByCodiceVariante(String l_codiceVariante) { + String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codiceVARIANTE='" + prepareInputMySqlString(l_codiceVariante, false) + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getDescrizioneNomeUrl() { + return (getArticolo().getNome() + "-" + getArticolo().getNome()).trim(); + } + + public double getQuantitaAvByMagFisico(long l_id_magFisico) { + if (getParm("USA_MAGAZZINO").isFalse()) { + RigaDocumento mov = new RigaDocumento(getApFull()); + mov.findMagFisicoDisponibilita(getId_articolo(), getId_articoloVariante(), 0L, null, l_id_magFisico, 0L, null); + return mov.getQuantita(); + } + return this.quantitaAv; + } + + public long getFlgWebNoVenditaAv() { + return this.flgWebNoVenditaAv; + } + + public void setFlgWebNoVenditaAv(long flgWebNoVenditaAv) { + this.flgWebNoVenditaAv = flgWebNoVenditaAv; + } + + public long getFlgEscludiWebAv() { + return this.flgEscludiWebAv; + } + + public void setFlgEscludiWebAv(long flgEscludiWebAv) { + this.flgEscludiWebAv = flgEscludiWebAv; + } + + public long getFlgWebNoVendita() { + if (getArticolo().getFlgWebNoVendita() == 1L) + return 1L; + return getFlgWebNoVenditaAv(); + } + + public boolean isInVendita() { + if (getArticolo().getFlgWebNoVendita() == 0L && getFlgWebNoVenditaAv() == 0L) + return true; + return false; + } + + public boolean isArticoloAcquistabile() { + if (getFlgNascondi() == 0L && getFlgWebNoVenditaAv() == 0L && getArticolo().isArticoloAcquistabile()) + return true; + return false; + } + + public double getQuantitaAvW() { + if (!isQuantitaCalcolateAv() && this.id_articolo != 0L) + calcolaQuantita(); + return this.quantitaAvW; + } + + public void setQuantitaAvW(double quantitaAvW) { + this.quantitaAvW = quantitaAvW; + } + + public String getNomeV(String lang) { + if (lang == null || lang.isEmpty()) + lang = "it"; + String temp = getDescTxtLang("nomeVL", lang); + if (temp.isEmpty()) + return getNomeV(); + return temp; + } + + public String getDescrizione(String lang) { + if (getTipo().getFlgUsaVarianteColori() == 1L) { + String str = getArticolo().getDescrizione(lang) + " " + getArticolo().getDescrizione(lang); + return str.trim(); + } + String temp = getArticolo().getNome() + " " + getArticolo().getNome(); + return temp.trim(); + } + + public String getDescrizioneCompleta() { + return getDescrizioneCompleta(null); + } + + public String getDescrizioneCompletaSenzaCodice() { + return getDescrizioneCompletaSenzaCodice(null); + } + + public Tipo getTipo() { + return getArticolo().getTipo(); + } + + public String getHtmlTableDispoMagInterni() { + MagFisico mf = new MagFisico(getApFull()); + RigaDocumento rd = new RigaDocumento(getApFull()); + Vectumerator vec = mf.findByTipo(1L); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + MagFisico row = (MagFisico)vec.nextElement(); + sb.append(""); + rd.findMagDisponibilitaPuntuale(getId_articolo(), getId_articoloVariante(), 0L, null, row.getId_magFisico(), 0L, 0L); + sb.append(getNf().format(rd.getQuantita())); + sb.append(""); + } + return sb.toString(); + } + + public String getCodiciMagazzino() { + return (this.codiciMagazzino == null) ? "" : this.codiciMagazzino.trim(); + } + + public void setCodiciMagazzino(String codiciMagazzino) { + this.codiciMagazzino = codiciMagazzino; + } + + public Vectumerator findArticoliTessuto() { + ArticoloArticoloTessuto atf = new ArticoloArticoloTessuto(getApFull()); + return atf.findByArticoloVariante(getId_articoloVariante()); + } + + public Colore getColore() { + this.colore = (Colore)getSecondaryObject(this.colore, Colore.class, getId_colore()); + return this.colore; + } + + public long getId_colore() { + return this.id_colore; + } + + public void setColore(Colore newColore) { + this.colore = newColore; + } + + public void setId_colore(long newId_colore) { + this.id_colore = newId_colore; + setColore(null); + } + + public ResParm creaComposizioneDaArticoloBase() { + ResParm rp = new ResParm(true); + if (getTipo().getFlgUsaVarianteColori() == 1L) { + Vectumerator vecAat = findArticoliTessuto(); + if (vecAat.getTotNumberOfRecords() == 0) { + Vectumerator vecCB = getArticolo().findArticoliTessuto(); + while (vecCB.hasMoreElements()) { + ArticoloArticoloTessuto row = (ArticoloArticoloTessuto)vecCB.nextElement(); + ArticoloTessutoColore atc = new ArticoloTessutoColore(getApFull()); + if (row.getId_articoloTessutoColore() > 0L) { + atc = row.getArticoloTessutoColore(); + } else { + System.out.println("atc: at=" + row.getId_articoloTessuto() + " col=" + getId_colore()); + atc.findByArticoloTessutoColore(row.getId_articoloTessuto(), getId_colore()); + if (atc.getId_articoloTessutoColore() == 0L) { + atc.setId_articoloTessuto(row.getId_articoloTessuto()); + atc.setId_colore(getId_colore()); + rp = atc.save(); + } + } + if (rp.getStatus()) { + ArticoloArticoloTessuto avAt = new ArticoloArticoloTessuto(getApFull()); + avAt.setId_articoloVariante(getId_articoloVariante()); + avAt.setId_articolo(getId_articolo()); + avAt.setId_articoloTessuto(atc.getId_articoloTessuto()); + avAt.setId_articoloTessutoColore(atc.getId_articoloTessutoColore()); + avAt.setMmATT(row.getMmATT()); + avAt.setBordaturaMm(row.getBordaturaMm()); + avAt.setFlgPrincipale(row.getFlgPrincipale()); + rp = avAt.save(); + if (!rp.getStatus()) + break; + System.out.println(" creaComposizioneDaArticoloBase"); + continue; + } + break; + } + } + } + return rp; + } + + public boolean isTessutoPrincipale(long l_id_articoloTessuto, long l_id_articoloTessutoColore) { + ArticoloArticoloTessuto aat = new ArticoloArticoloTessuto(getApFull()); + aat.findByArticoloVarianteArticoloTessutoColore(getId_articoloVariante(), l_id_articoloTessuto, l_id_articoloTessutoColore); + if (aat.getFlgPrincipale() == 1L) + return true; + return false; + } + + public double getCostoTessutoCalc() { + return -1.0D; + } + + public Marca getMarca() { + return getArticolo().getMarca(); + } + + public double getPrezzoIvatoBarrato() { + return getArticolo().getPrezzoIvatoBarrato(); + } + + public long getFlgNoleggio() { + return getArticolo().getFlgNoleggio(); + } + + public double getPrezzoNoleggioIva() { + return getArticolo().getPrezzoNoleggioIva(); + } + + public double getPercScontoRispettoAlPrezzoBarrato() { + if (getPrezzoIvatoBarrato() == 0.0D) + return 0.0D; + DoubleOperator dop = new DoubleOperator(getPriceWVat()); + dop.setScale(2, 5); + dop.divide(getPrezzoIvatoBarrato()); + dop.multiply(100); + dop.subtract(100); + return dop.getResult(); + } + + public double getPercScontoRispettoAOfferta() { + if (getPrezzoIvatoBarrato() == 0.0D) + return 0.0D; + DoubleOperator dop = new DoubleOperator(getPriceWVat()); + dop.setScale(2, 5); + dop.divide(getPrezzoIvatoBarrato()); + dop.multiply(100); + dop.subtract(100); + return dop.getResult(); + } + + public String getCodicePromozioneAV() { + return (this.codicePromozioneAV == null) ? "" : this.codicePromozioneAV.trim(); + } + + public void setCodicePromozioneAV(String codicePromozioneAV) { + this.codicePromozioneAV = codicePromozioneAV; + } + + public String getCodicePromozione() { + if (getCodicePromozioneAV().isEmpty()) + return getArticolo().getCodicePromozioneA(); + return getCodicePromozioneAV(); + } + + public String getCCLinkDettaglio(ArticoloCR CR) { + getArticolo().setId_articoloVariante(getId_articoloVariante()); + return getArticolo().getCCLinkDettaglio(CR); + } + + public String getCCDataLayerDetail() { + return GoogleDataLayerBuilder.getDettaglioProdotto("eec.detail", this); + } + + public String getCCLinkDettaglioA(ArticoloCR CR) { + getArticolo().setId_articoloVariante(getId_articoloVariante()); + return getArticolo().getCCLinkDettaglioA(CR); + } + + public String getCCLinkDettaglioTK(ArticoloCR CR) { + getArticolo().setId_articoloVariante(getId_articoloVariante()); + getArticolo().setId_articoloTaglia(CR.getId_articoloTaglia()); + getArticolo().setId_articoloVarianteKit(CR.getId_articoloVarianteKit()); + return getArticolo().getCCLinkDettaglioTK(CR); + } + + public String getCCLinkDettaglioKitTK(ArticoloCR CR) { + CR.getArticolo().setId_articoloVariante(CR.getId_articoloVariante()); + CR.getArticolo().setId_articoloTaglia(CR.getId_articoloTaglia()); + CR.getArticolo().setId_articoloVarianteKit(getId_articoloVariante()); + return CR.getArticolo().getCCLinkDettaglioTK(CR); + } + + public String getCCLinkDettaglioT(ArticoloCR CR) { + getArticolo().setId_articoloVariante(getId_articoloVariante()); + getArticolo().setId_articoloTaglia(CR.getId_articoloTaglia()); + return getArticolo().getCCLinkDettaglioT(CR); + } + + public String getDatoStrutturato(String lang) { + return null; + } + + public Vectumerator findByArticoloKit(long l_id_articolo) { + String s_Sql_Find = "SELECT A.* from ARTICOLO_VARIANTE as A inner join KIT as B on B.id_articoloSecondario =A.id_articolo"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("B.id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getCCKeyword(String lang) { + getArticolo().setId_articoloVariante(getId_articoloVariante()); + return getArticolo().getCCKeyword(lang); + } + + public String getDescrizioneSearchAv() { + return (this.descrizioneSearchAv == null) ? "" : this.descrizioneSearchAv.trim(); + } + + public void setDescrizioneSearchAv(String descrizioneSearchAv) { + this.descrizioneSearchAv = descrizioneSearchAv; + } + + public String getKeywordsAv() { + return (this.keywordsAv == null) ? "" : this.keywordsAv.trim(); + } + + public void setKeywordsAv(String keywordAv) { + this.keywordsAv = keywordAv; + } + + public String getEbayItemIdAv() { + return (this.ebayItemIdAv == null) ? "" : this.ebayItemIdAv.trim(); + } + + public void setEbayItemIdAv(String ebayItemIdAv) { + this.ebayItemIdAv = ebayItemIdAv; + } + + public long getFlgSubitoAv() { + return this.flgSubitoAv; + } + + public void setFlgSubitoAv(long flgSubitoAv) { + this.flgSubitoAv = flgSubitoAv; + } + + public long getFlgGoogleAv() { + return this.flgGoogleAv; + } + + public void setFlgGoogleAv(long flgGoogleAv) { + this.flgGoogleAv = flgGoogleAv; + } + + public long getFlgEbayAv() { + return this.flgEbayAv; + } + + public void setFlgEbayAv(long flgEbayAv) { + this.flgEbayAv = flgEbayAv; + } + + public String getReadyForWebAv() { + return (this.readyForWebAv == null) ? "" : this.readyForWebAv.trim(); + } + + public void setReadyForWebAv(String readyForWebAv) { + this.readyForWebAv = readyForWebAv; + } + + public boolean isReadyForWeb(String lang) { + if (getId_articolo() == 0L) + return false; + if (getNomeV().isEmpty()) + return false; + if (getDescrizioneV(lang).isEmpty()) + return false; + if (!isImgExist(1)) + return false; + if (getFlgSubitoAv() == 1L || getFlgEbayAv() == 1L) { + String temp = getDescTxtLang("nomeMarketplaceV", lang); + if (temp.isEmpty() || temp.length() > 50) + return false; + temp = getDescTxtLang("descrizioneMarketplaceV", lang); + if (temp.isEmpty() || temp.length() > 1999) + return false; + } + return true; + } + + public String getEbayOfferIdAv() { + return (this.ebayOfferIdAv == null) ? "" : this.ebayOfferIdAv.trim(); + } + + public void setEbayOfferIdAv(String ebayOfferIdAv) { + this.ebayOfferIdAv = ebayOfferIdAv; + } + + public long getQtaEbayAv() { + return this.qtaEbayAv; + } + + public long getQtaEbayAvDaInviare() { + if (getQtaEbayAv() == 0L) + return (long)getQuantitaAv(); + return (long)Math.min((double)getQtaEbayAv(), getQuantitaAv()); + } + + public void setQtaEbayAv(long flgQtaEbay1Av) { + this.qtaEbayAv = flgQtaEbay1Av; + } + + public long getQtaSuEbayAv() { + return this.qtaSuEbayAv; + } + + public void setQtaSuEbayAv(long qtaSuEbayAv) { + this.qtaSuEbayAv = qtaSuEbayAv; + } + + public long getImpressionAv() { + return this.impressionAv; + } + + public void setImpressionAv(long impressionAv) { + this.impressionAv = impressionAv; + } + + public Timestamp getTmstLastImpressionAv() { + return this.tmstLastImpressionAv; + } + + public void setTmstLastImpressionAv(Timestamp tmstLastImpressionAv) { + this.tmstLastImpressionAv = tmstLastImpressionAv; + } + + public String getCartItemDescriptionCC(String lang) { + return getCCNome(lang); + } + + public String getCCNome(String lang) { + return getNome(lang).replace("/", "/ "); + } + + public void findByCartitemId(CartItemId cii) { + getArticolo().findByCartitemId(cii); + } + + public String getCCLinkDettaglio() { + getArticolo().setId_articoloVariante(getId_articoloVariante()); + return getArticolo().getCCLinkDettaglio(); + } + + public String getCCLinkDettaglioCanonical(String lang) { + ArticoloCR CR = new ArticoloCR(); + CR.setLang(lang); + return getWwwAddressParm() + getWwwAddressParm(); + } + + public String getCodiceEanAv() { + return (this.codiceEanAv == null) ? "" : this.codiceEanAv.trim(); + } + + public void setCodiceEanAv(String codiceEanAv) { + this.codiceEanAv = codiceEanAv; + } + + public String getDescrizioneMarketplaceV(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizioneMarketplaceV", lang); + } + + public long getId_statoUsato() { + return this.id_statoUsato; + } + + public StatoUsato getStatoUsato() { + this.statoUsato = (StatoUsato)getSecondaryObject(this.statoUsato, StatoUsato.class, new Long(getId_statoUsato())); + return this.statoUsato; + } + + public void setId_statoUsato(long id_statoUsato) { + this.id_statoUsato = id_statoUsato; + setStatoUsato(null); + } + + public void setStatoUsato(StatoUsato statoUsato) { + this.statoUsato = statoUsato; + } + + public boolean isNuovo() { + return false; + } + + public boolean isUsato() { + return false; + } + + public void findPrimoVisibileByArticolo(long l_id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_VARIANTE AS A, ARTICOLO AS B, TIPO AS C"; + String s_Sql_Order = " order by A.id_articolo"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=B.id_articolo"); + wc.addWc("B.id_tipo=C.id_tipo"); + wc.addWc("A.id_articolo=" + l_id_articolo); + wc.addWc("(B.flgEscludiWeb=0 or B.flgEscludiWeb is null)"); + wc.addWc("(A.flgNascondi=0 or A.flgNascondi is null)"); + wc.addWc("(B.flgNascondi=0 or B.flgNascondi is null)"); + wc.addWc("(C.flgNascondi=0 or C.flgNascondi is null)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public boolean isCostoSpedizionePreventivo(String l_id_nazione) { + return getArticolo().isCostoSpedizionePreventivo(l_id_nazione); + } + + public double getDeliveryCost(String l_id_nazione) { + return getArticolo().getDeliveryCost(l_id_nazione); + } + + public long getPercentileSpedizione() { + return getArticolo().getPercentileSpedizione(); + } + + public void resetImpression() { + if (getApFull() != null) { + update("update ARTICOLO_VARIANTE SET impressionAv=0"); + update("update ARTICOLO_VARIANTE SET tmstLastImpressionAv=null"); + getArticolo().resetImpression(); + } + } + + public String getCCLinkInfo(ArticoloCR CR) { + getArticolo().setId_articoloVariante(getId_articoloVariante()); + return getArticolo().getCCLinkInfo(CR); + } + + public boolean isScontoTroppoAlto() { + return getArticolo().isScontoTroppoAlto(); + } + + public String getCCMetaDescriptionWeb(String lang) { + getArticolo().setId_articoloVariante(getId_articoloVariante()); + return getArticolo().getCCMetaDescriptionWeb(lang); + } + + public String getCCTagH1(String lang) { + getArticolo().setId_articoloVariante(getId_articoloVariante()); + return getArticolo().getCCTagH1(lang); + } + + public String getCCTagH2Web(String lang) { + getArticolo().setId_articoloVariante(getId_articoloVariante()); + return getArticolo().getCCTagH2Web(lang); + } + + public String getCCTagH1Web(String lang) { + return null; + } + + public String getPathIdStepDir() { + return getArticolo().getPathIdStepDir(); + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico()); + return this.magFisico; + } + + public void setId_magFisico(long id_magFisico) { + this.id_magFisico = id_magFisico; + setMagFisico(null); + } + + public void setMagFisico(MagFisico magFisico) { + this.magFisico = magFisico; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloVarianteCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloVarianteCR.java new file mode 100644 index 00000000..7604873a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ArticoloVarianteCR.java @@ -0,0 +1,224 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloVarianteCR extends CRAdapter { + private long id_articoloVariante; + + private long id_articolo; + + private Articolo articolo; + + private String codiceVariante; + + private long flgDisponibile; + + private long id_tipoSel; + + private long flgNascondi = -1L; + + private long flgOrdinaArticolo = 0L; + + private long id_clifor; + + private double qtaAttribuitaV; + + private double qtaInProduzioneV; + + private String codiceSerieV; + + private long flgStockV; + + private String nomeV; + + private String descrizioneArticolo; + + private long flgInMagazzino; + + private String searchTxtWeb; + + public ArticoloVarianteCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloVarianteCR() {} + + public void setId_articoloVariante(long newId_articoloVariante) { + this.id_articoloVariante = newId_articoloVariante; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public String getCodiceVariante() { + return (this.codiceVariante == null) ? AB_EMPTY_STRING : this.codiceVariante; + } + + public void setCodiceVariante(String codiceVariante) { + this.codiceVariante = codiceVariante; + } + + public long getFlgDisponibile() { + return this.flgDisponibile; + } + + public void setFlgDisponibile(long flgDisponibile) { + this.flgDisponibile = flgDisponibile; + } + + public long getId_tipoSel() { + return this.id_tipoSel; + } + + public void setId_tipoSel(long id_tipoSel) { + this.id_tipoSel = id_tipoSel; + } + + public long getFlgNascondi() { + return this.flgNascondi; + } + + public void setFlgNascondi(long flgNascondi) { + this.flgNascondi = flgNascondi; + } + + public long getFlgOrdinaArticolo() { + return this.flgOrdinaArticolo; + } + + public void setFlgOrdinaArticolo(long flgOrdinaArticolo) { + this.flgOrdinaArticolo = flgOrdinaArticolo; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + } + + private long flgEscludiWeb = -1L; + + private long flgQta; + + private long qtaA = 9999L; + + private long qtaDa = 1L; + + public double getQtaAttribuitaV() { + return this.qtaAttribuitaV; + } + + public void setQtaAttribuitaV(double qtaAttribuitaV) { + this.qtaAttribuitaV = qtaAttribuitaV; + } + + public double getQtaInProduzioneV() { + return this.qtaInProduzioneV; + } + + public void setQtaInProduzioneV(double qtaInProduzioneV) { + this.qtaInProduzioneV = qtaInProduzioneV; + } + + public String getCodiceSerieV() { + return (this.codiceSerieV == null) ? AB_EMPTY_STRING : this.codiceSerieV; + } + + public void setCodiceSerieV(String codiceSerieV) { + this.codiceSerieV = codiceSerieV; + } + + public long getFlgStockV() { + return this.flgStockV; + } + + public void setFlgStockV(long flgStockV) { + this.flgStockV = flgStockV; + } + + public String getNomeV() { + return (this.nomeV == null) ? AB_EMPTY_STRING : this.nomeV; + } + + public void setNomeV(String nomeV) { + this.nomeV = nomeV; + } + + public String getDescrizioneArticolo() { + return (this.descrizioneArticolo == null) ? AB_EMPTY_STRING : this.descrizioneArticolo; + } + + public void setDescrizioneArticolo(String descrizioneArticolo) { + this.descrizioneArticolo = descrizioneArticolo; + } + + public long getFlgInMagazzino() { + return this.flgInMagazzino; + } + + public void setFlgInMagazzino(long flgInMagazzino) { + this.flgInMagazzino = flgInMagazzino; + } + + public String getSearchTxtWeb() { + return (this.searchTxtWeb == null) ? AB_EMPTY_STRING : this.searchTxtWeb.trim(); + } + + public void setSearchTxtWeb(String searchTxtWeb) { + this.searchTxtWeb = searchTxtWeb; + } + + public long getFlgEscludiWeb() { + return this.flgEscludiWeb; + } + + public void setFlgEscludiWeb(long flgEscludiWeb) { + this.flgEscludiWeb = flgEscludiWeb; + } + + public long getFlgQta() { + return this.flgQta; + } + + public void setFlgQta(long flgQta) { + this.flgQta = flgQta; + } + + public long getQtaA() { + return this.qtaA; + } + + public void setQtaA(long qtaA) { + this.qtaA = qtaA; + } + + public long getQtaDa() { + return this.qtaDa; + } + + public void setQtaDa(long qtaDa) { + this.qtaDa = qtaDa; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CTipo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CTipo.java new file mode 100644 index 00000000..2a9e5ce4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CTipo.java @@ -0,0 +1,114 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class CTipo extends _ArtAdapter implements Serializable { + private long id_tipo; + + private long id_caratteristica; + + private Tipo tipo; + + private Caratteristica caratteristica; + + public CTipo(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CTipo() {} + + public void setId_tipo(long newId_tipo) { + this.id_tipo = newId_tipo; + setTipo(null); + } + + public void setId_caratteristica(long newId_caratteristica) { + this.id_caratteristica = newId_caratteristica; + setCaratteristica(null); + } + + public long getId_tipo() { + return this.id_tipo; + } + + public long getId_caratteristica() { + return this.id_caratteristica; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(CTipoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from C_TIPO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (CR.getId_caratteristica() != 0L) + wc.addWc("A.id_caratteristica=" + CR.getId_caratteristica()); + if (CR.getId_tipo() != 0L) + wc.addWc("A.id_tipo=" + CR.getId_tipo()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findCaratteristicheByTipo(long l_id_tipo, boolean soloWeb, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from C_TIPO AS A, TIPO as B"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_tipo=B.id_tipo"); + if (l_id_tipo != 0L) { + StringBuffer tipoWc = new StringBuffer("("); + Tipo tipo = new Tipo(getApFull()); + tipo.findByPrimaryKey(l_id_tipo); + StringTokenizer st = new StringTokenizer("" + l_id_tipo + l_id_tipo, ":"); + while (st.hasMoreTokens()) { + String currentId = st.nextToken(); + if (tipoWc.length() > 1) + tipoWc.append(" or "); + tipoWc.append("A.id_tipo=" + currentId); + } + tipoWc.append(" )"); + wc.addWc(tipoWc.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findTipiByCaratteristica(long l_id_caratteristica, int pageNumber, int pageRows) { + CTipoCR CR = new CTipoCR(); + CR.setId_caratteristica(l_id_caratteristica); + return findByCR(CR, pageNumber, pageRows); + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo()); + return this.tipo; + } + + public void setTipo(Tipo tipo) { + this.tipo = tipo; + } + + public Caratteristica getCaratteristica() { + this.caratteristica = (Caratteristica)getSecondaryObject(this.caratteristica, Caratteristica.class, new Long(getId_caratteristica())); + return this.caratteristica; + } + + public void setCaratteristica(Caratteristica caratteristica) { + this.caratteristica = caratteristica; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CTipoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CTipoCR.java new file mode 100644 index 00000000..9f8ced06 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CTipoCR.java @@ -0,0 +1,32 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class CTipoCR extends CRAdapter { + private long id_tipo; + + private long id_caratteristica; + + public CTipoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CTipoCR() {} + + public void setId_tipo(long newId_tipo) { + this.id_tipo = newId_tipo; + } + + public void setId_caratteristica(long newId_caratteristica) { + this.id_caratteristica = newId_caratteristica; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public long getId_caratteristica() { + return this.id_caratteristica; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CTipoKey.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CTipoKey.java new file mode 100644 index 00000000..5db6fa3e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CTipoKey.java @@ -0,0 +1,32 @@ +package it.acxent.art; + +import java.io.Serializable; + +public class CTipoKey implements Serializable { + private static final long serialVersionUID = 4927534830271711826L; + + private long id_tipo; + + private long id_caratteristica; + + public CTipoKey(long newId_tipo, long newId_caratteristica) { + setId_tipo(newId_tipo); + setId_caratteristica(newId_caratteristica); + } + + public void setId_tipo(long newId_tipo) { + this.id_tipo = newId_tipo; + } + + public void setId_caratteristica(long newId_caratteristica) { + this.id_caratteristica = newId_caratteristica; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public long getId_caratteristica() { + return this.id_caratteristica; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Caratteristica.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Caratteristica.java new file mode 100644 index 00000000..4f737096 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Caratteristica.java @@ -0,0 +1,316 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.DbInterface; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Caratteristica extends _ArtAdapter implements Serializable { + private static final long serialVersionUID = -3717919132443402126L; + + private long id_caratteristica; + + private long flgCR; + + private String descrizione_it; + + private String icecatDescs; + + private long flgTipoVal; + + private long ordine; + + private long flgRicercaWeb; + + private String descrizioneAggiuntiva; + + public static final int TIPO_VAL_BOOLEANO = 4; + + public static final int TIPO_VAL_DATA = 5; + + public static final int TIPO_VAL_DOUBLE = 2; + + public static final int TIPO_VAL_INTERO = 1; + + public static final int TIPO_VAL_LISTA = 6; + + public static final int TIPO_VAL_STRINGA = 3; + + public ResParm addTipo(long l_id_tipo) { + CTipo bean = new CTipo(getApFull()); + bean.findByPrimaryKey(new CTipoKey(l_id_tipo, getId_caratteristica())); + bean.setId_tipo(l_id_tipo); + bean.setId_caratteristica(getId_caratteristica()); + return bean.save(); + } + + public ResParm delTipo(long l_id_tipo) { + CTipo bean = new CTipo(getApFull()); + bean.findByPrimaryKey(new CTipoKey(l_id_tipo, getId_caratteristica())); + return bean.delete(); + } + + public Caratteristica(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Caratteristica() {} + + public void setId_caratteristica(long newId_caratteristica) { + this.id_caratteristica = newId_caratteristica; + } + + public void setFlgTipoVal(long newFlgTipoVal) { + this.flgTipoVal = newFlgTipoVal; + } + + public long getId_caratteristica() { + return this.id_caratteristica; + } + + public String getTipoVal() { + return getTipoVal(getFlgTipoVal()); + } + + public long getFlgTipoVal() { + return this.flgTipoVal; + } + + protected void deleteCascade() { + Vectumerator vec = new Lista(getApFull()).findLista(getId_caratteristica(), 0, 0); + while (vec.hasMoreElements()) + ((DbInterface)vec.nextElement()).delete(); + } + + public Vectumerator findByCR(CaratteristicaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CARATTERISTICA AS A"; + String s_Sql_Order = " order by A.ordine, A.descrizione_it"; + WcString wc = new WcString(); + if (!CR.getDescrizione().isEmpty()) + wc.addWc("A.descrizione_it like'%" + CR.getDescrizione() + "%'"); + if (CR.getFlgTipoVal() > 0L) + wc.addWc("A.flgTipoVal=" + CR.getFlgTipoVal()); + if (CR.getId_tipo() != 0L) { + s_Sql_Find = s_Sql_Find + ", C_TIPO as B"; + wc.addWc("A.id_caratteristica=B.id_caratteristica"); + wc.addWc("B.id_tipo=" + CR.getId_tipo()); + } + if (CR.getFlgRicercaWeb() == 0L) { + wc.addWc("(A.flgRicercaWeb is null or A.flgRicercaWeb=0)"); + } else if (CR.getFlgRicercaWeb() > 0L) { + wc.addWc("A.flgRicercaWeb =" + CR.getFlgRicercaWeb()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByDescrizione(String l_Descrizione) { + String s_Sql_Find = "select A.* from CARATTERISTICA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.descrizione ='" + prepareSqlString(l_Descrizione) + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findCaratteristicheByTipo(long l_id_tipo, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CARATTERISTICA AS A, C_TIPO as B, TIPO as C"; + String s_Sql_Order = " order by A.ordine"; + WcString wc = new WcString(); + wc.addWc("A.id_caratteristica=B.id_caratteristica"); + wc.addWc("B.id_tipo=C.id_tipo"); + StringBuffer tipoWc = new StringBuffer("("); + Tipo tipo = new Tipo(getApFull()); + tipo.findByPrimaryKey(l_id_tipo); + StringTokenizer st = new StringTokenizer("" + l_id_tipo + l_id_tipo, ":"); + while (st.hasMoreTokens()) { + String currentId = st.nextToken(); + if (tipoWc.length() > 1) + tipoWc.append(" or "); + tipoWc.append("B.id_tipo=" + currentId); + } + tipoWc.append(" )"); + wc.addWc(tipoWc.toString()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findListe(int pageNumber, int pageRows) { + CaratteristicaCR CR = new CaratteristicaCR(); + CR.setFlgTipoVal(6L); + return findByCR(CR, pageNumber, pageRows); + } + + public long getFlgCR() { + return this.flgCR; + } + + public void setFlgCR(long flgCR) { + this.flgCR = flgCR; + } + + public long getOrdine() { + return this.ordine; + } + + public void setOrdine(long ordine) { + this.ordine = ordine; + } + + private long calcolaOrdine() { + try { + PreparedStatement ps = getConn() + .prepareStatement("select max(ordine) as _max from CARATTERISTICA WHERE id_caratteristica!=" + getId_caratteristica()); + long res = (long)getMax(ps, true) + 1L; + long decine = res / 10L; + return (decine + 1L) * 10L; + } catch (Exception e) { + handleDebug(e); + return 0L; + } + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + if (getOrdine() == 0L) + setOrdine(calcolaOrdine()); + super.prepareSave(ps); + } + + public String getDescrizioneAggiuntiva() { + return (this.descrizioneAggiuntiva == null) ? "" : this.descrizioneAggiuntiva; + } + + public void setDescrizioneAggiuntiva(String descrizione_en) { + this.descrizioneAggiuntiva = descrizione_en; + } + + public String getDescrizione_it() { + return getDescrizione("it"); + } + + public void setDescrizione_it(String descrizione) { + this.descrizione_it = descrizione; + } + + public String getDescrizione() { + return getDescrizione("it"); + } + + public static final String getTipoVal(long l_flgTipoVal) { + if (l_flgTipoVal == 1L) + return "Intero"; + if (l_flgTipoVal == 2L) + return "Double"; + if (l_flgTipoVal == 3L) + return "Stringa"; + if (l_flgTipoVal == 4L) + return "Booleano"; + if (l_flgTipoVal == 5L) + return "Data"; + if (l_flgTipoVal == 6L) + return "Lista"; + return "??"; + } + + public long getFlgRicercaWeb() { + return this.flgRicercaWeb; + } + + public void setFlgRicercaWeb(long flgRicercaWeb) { + this.flgRicercaWeb = flgRicercaWeb; + } + + public boolean useDescLangTables() { + return true; + } + + public String getDescrizione(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizione", lang); + } + + public String getDescrizioneAggiuntiva(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizioneAggiuntiva", lang); + } + + public String getDescrizioneTipoAssociati() { + if (getId_caratteristica() == 0L) + return ""; + StringBuilder sb = new StringBuilder(); + Vectumerator vec = new CTipo(getApFull()).findTipiByCaratteristica(getId_caratteristica(), 0, 0); + while (vec.hasMoreElements()) { + CTipo row = (CTipo)vec.nextElement(); + sb.append(row.getTipo().getDescrizioneCompleta()); + if (vec.hasMoreElements()) + sb.append("\n"); + } + return sb.toString(); + } + + public String getDescrizioneTipoAssociatiHtml() { + return DBAdapter.convertStringToHtml(getDescrizioneTipoAssociati(), true); + } + + public String getOptionListaHtml(String lang) { + if (getFlgTipoVal() == 6L) { + if (lang == null || lang.isEmpty()) + lang = "it"; + Vectumerator vec = new Lista(getApFull()).findLista(getId_caratteristica(), 0, 0); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + Lista option = (Lista)vec.nextElement(); + sb.append(""); + } + return sb.toString(); + } + return ""; + } + + public String getIcecatDescs() { + return (this.icecatDescs == null) ? "" : this.icecatDescs.trim(); + } + + public void setIcecatDescs(String icecatDescs) { + this.icecatDescs = icecatDescs; + } + + public void findByIcecatDesc(String l_icecatDesc) { + String s_Sql_Find = "select A.* from CARATTERISTICA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.icecatDescs ='" + prepareSqlString(l_icecatDesc) + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CaratteristicaArticolo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CaratteristicaArticolo.java new file mode 100644 index 00000000..73176a2a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CaratteristicaArticolo.java @@ -0,0 +1,201 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class CaratteristicaArticolo extends _ArtAdapter implements Serializable { + private Caratteristica caratteristica; + + private long id_caratteristica; + + private long id_lista; + + private Lista lista; + + private Date valD; + + private long valI; + + private double valDouble; + + private String valS; + + private long valSN; + + private long id_articolo; + + public CaratteristicaArticolo() {} + + public CaratteristicaArticolo(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(CaratteristicaArticoloCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from caratteristica_articolo AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findById_articolo(long l_id_articolo, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.*, B.ordine from CARATTERISTICA_ARTICOLO AS A, CARATTERISTICA AS B"; + String s_Sql_Order = " order by B.ordine"; + WcString wc = new WcString(); + wc.addWc("A.id_caratteristica=B.id_caratteristica"); + wc.addWc("id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findById_articoloId_caratteristica(long l_id_articolo, long l_id_caratteristica) { + String s_Sql_Find = "select A.* from CARATTERISTICA_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_articolo=" + l_id_articolo); + wc.addWc("id_caratteristica=" + l_id_caratteristica); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Caratteristica getCaratteristica() { + this.caratteristica = (Caratteristica)getSecondaryObject(this.caratteristica, Caratteristica.class, new Long(getId_caratteristica())); + return this.caratteristica; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_caratteristica() { + return this.id_caratteristica; + } + + public long getId_lista() { + return this.id_lista; + } + + public Lista getLista() { + this.lista = (Lista)getSecondaryObject(this.lista, Lista.class, new Long(getId_lista())); + return this.lista; + } + + public String getVal() { + if (getId_articolo() == 0L) + return ""; + if (getCaratteristica().getFlgTipoVal() == 3L) + return getValS(); + if (getCaratteristica().getFlgTipoVal() == 1L) + return getNf().format(getValI()); + if (getCaratteristica().getFlgTipoVal() == 2L) + return getNf().format(getValDouble()); + if (getCaratteristica().getFlgTipoVal() == 5L) + return getDataFormat().format(getValD()); + if (getCaratteristica().getFlgTipoVal() == 4L) + return (getValSN() == 0L) ? "No" : "Si"; + if (getCaratteristica().getFlgTipoVal() == 6L) + return getLista().getValore(); + return "??"; + } + + public Date getValD() { + return this.valD; + } + + public long getValI() { + return this.valI; + } + + public String getValS() { + return (this.valS == null) ? "" : this.valS; + } + + public long getValSN() { + return this.valSN; + } + + public void setCaratteristica(Caratteristica caratteristica) { + this.caratteristica = caratteristica; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + } + + public void setId_caratteristica(long newId_caratteristica) { + this.id_caratteristica = newId_caratteristica; + setCaratteristica(null); + } + + public void setId_lista(long newId_lista) { + this.id_lista = newId_lista; + setLista(null); + } + + public void setLista(Lista newLista) { + this.lista = newLista; + } + + public void setValD(Date newValD) { + this.valD = newValD; + } + + public void setValI(long newValI) { + this.valI = newValI; + } + + public void setValS(String newValS) { + this.valS = newValS; + } + + public void setValSN(long newValSN) { + this.valSN = newValSN; + } + + public double getValDouble() { + return this.valDouble; + } + + public void setValDouble(double d) { + this.valDouble = d; + } + + public String getVal(String lang) { + if (getId_articolo() == 0L) + return ""; + if (getCaratteristica().getFlgTipoVal() == 3L) + return getValS(); + if (getCaratteristica().getFlgTipoVal() == 1L) + return getNf().format(getValI()); + if (getCaratteristica().getFlgTipoVal() == 2L) + return getNf().format(getValDouble()); + if (getCaratteristica().getFlgTipoVal() == 5L) + return getDataFormat().format(getValD()); + if (getCaratteristica().getFlgTipoVal() == 4L) + return (getValSN() == 0L) ? "No" : "Si"; + if (getCaratteristica().getFlgTipoVal() == 6L) + return getLista().getValore(lang); + return "??"; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CaratteristicaArticoloCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CaratteristicaArticoloCR.java new file mode 100644 index 00000000..2794aa61 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CaratteristicaArticoloCR.java @@ -0,0 +1,95 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class CaratteristicaArticoloCR extends CRAdapter { + private long id_articolo; + + private long id_caratteristica; + + private long valI; + + private String valS; + + private long valSN; + + private Date valD; + + private long id_lista; + + private Lista lista; + + public CaratteristicaArticoloCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CaratteristicaArticoloCR() {} + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + } + + public void setId_caratteristica(long newId_caratteristica) { + this.id_caratteristica = newId_caratteristica; + } + + public void setValI(long newValI) { + this.valI = newValI; + } + + public void setValS(String newValS) { + this.valS = newValS; + } + + public void setValSN(long newValSN) { + this.valSN = newValSN; + } + + public void setValD(Date newValD) { + this.valD = newValD; + } + + public void setId_lista(long newId_lista) { + this.id_lista = newId_lista; + setLista(null); + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_caratteristica() { + return this.id_caratteristica; + } + + public long getValI() { + return this.valI; + } + + public String getValS() { + return (this.valS == null) ? "" : this.valS; + } + + public long getValSN() { + return this.valSN; + } + + public Date getValD() { + return this.valD; + } + + public long getId_lista() { + return this.id_lista; + } + + public void setLista(Lista newLista) { + this.lista = newLista; + } + + public Lista getLista() { + return (Lista)getSecondaryObject(this.lista, Lista.class, new Long( + getId_lista())); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CaratteristicaArticoloKey.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CaratteristicaArticoloKey.java new file mode 100644 index 00000000..34bb463d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CaratteristicaArticoloKey.java @@ -0,0 +1,32 @@ +package it.acxent.art; + +import java.io.Serializable; + +public class CaratteristicaArticoloKey implements Serializable { + private static final long serialVersionUID = -8061445306807842473L; + + private long id_articolo; + + private long id_caratteristica; + + public CaratteristicaArticoloKey(long newId_articolo, long newId_caratteristica) { + setId_articolo(newId_articolo); + setId_caratteristica(newId_caratteristica); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + } + + public void setId_caratteristica(long newId_caratteristica) { + this.id_caratteristica = newId_caratteristica; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_caratteristica() { + return this.id_caratteristica; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CaratteristicaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CaratteristicaCR.java new file mode 100644 index 00000000..5c6b7240 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/CaratteristicaCR.java @@ -0,0 +1,88 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class CaratteristicaCR extends CRAdapter { + private long id_caratteristica; + + private String descrizione; + + private long flgTipoVal; + + private long id_tipo; + + private Tipo tipo; + + private long flgCR; + + public static final String getTipoVal(long l_flgTipoVal) { + return Caratteristica.getTipoVal(l_flgTipoVal); + } + + private long flgRicercaWeb = -1L; + + public CaratteristicaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CaratteristicaCR() {} + + public void setId_caratteristica(long newId_caratteristica) { + this.id_caratteristica = newId_caratteristica; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setFlgTipoVal(long newFlgTipoVal) { + this.flgTipoVal = newFlgTipoVal; + } + + public long getId_caratteristica() { + return this.id_caratteristica; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public long getFlgTipoVal() { + return this.flgTipoVal; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo()); + return this.tipo; + } + + public void setId_tipo(long id_tipo) { + this.id_tipo = id_tipo; + setTipo(null); + } + + public void setTipo(Tipo tipo) { + this.tipo = tipo; + } + + public long getFlgCR() { + return this.flgCR; + } + + public void setFlgCR(long flgCR) { + this.flgCR = flgCR; + } + + public long getFlgRicercaWeb() { + return this.flgRicercaWeb; + } + + public void setFlgRicercaWeb(long flgRicercaWeb) { + this.flgRicercaWeb = flgRicercaWeb; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Colore.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Colore.java new file mode 100644 index 00000000..6f7b4b6f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Colore.java @@ -0,0 +1,174 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.Locale; + +public class Colore extends _ArtAdapter implements Serializable { + public static final String DESC_COLORE_ND = "N.D."; + + private long id_colore; + + private String descrizione; + + private String codiceColore; + + public Colore(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Colore() {} + + public void setId_colore(long newId_colore) { + this.id_colore = newId_colore; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_colore() { + return this.id_colore; + } + + public String getDescrizione() { + return getDescrizione("it"); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ColoreCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from COLORE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + String wcLang = ""; + if (!CR.getLang().isEmpty()) + wcLang = " and LL.lang='" + CR.getLang() + "'"; + if (!CR.getLang().isEmpty()) { + s_Sql_Find = s_Sql_Find + " LEFT join (SELECT LL.* FROM DESC_TXT_LANG AS LL where LL.tabella='COLORE' AND LL.campo='descrizione' " + s_Sql_Find + " ) AS L ON A.id_colore=L.idTabella"; + if (CR.getFlgOrderBy() == 1L) { + s_Sql_Order = " ORDER BY CAST(codiceColore as SIGNED INTEGER)"; + } else if (CR.getFlgOrderBy() == 0L) { + s_Sql_Order = " order by L.descrizione, A.descrizione"; + } + } + if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken().trim(); + txt.append("(A.codiceColore = '" + token + "' or L.descrizione254 like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + if (txt.length() > 2) + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findById_articolo(long l_id_articolo, String l_lang) { + String s_Sql_Find = "select A.* from COLORE AS A INNER JOIN ARTICOLO_VARIANTE AS B ON A.id_colore=B.id_colore "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!l_lang.isEmpty()) { + s_Sql_Find = s_Sql_Find + " LEFT join (SELECT LL.* FROM DESC_TXT_LANG AS LL where LL.tabella='COLORE' AND LL.campo='descrizione' and LL.lang='" + s_Sql_Find + "' ) AS L ON A.id_colore=L.idTabella"; + s_Sql_Order = " order by L.descrizione, A.descrizione"; + } + wc.addWc("B.id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByDescrizione(String l_descrizione) { + String s_Sql_Find = "select A.* from COLORE AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.descrizione ='" + l_descrizione + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 2); + } + } + + public boolean useDescLangTables() { + return true; + } + + public ResParm save() { + setDescrizione(getDescrizione(Locale.ITALIAN.getLanguage())); + if (getCodiceColore().isEmpty()) + setCodiceColore(calcolaProgCodice()); + return super.save(); + } + + private String calcolaProgCodice() { + try { + String s_sql = "select *, CONVERT(codiceColore,UNSIGNED INTEGER) as codice from COLORE as A"; + WcString wc = new WcString(); + wc.addWc("id_colore !=" + getId_colore()); + s_sql = " select B.codice as codiceColore from (" + s_sql + wc.toString() + ") as B order by codiceColore desc limit 1"; + PreparedStatement ps = getConn().prepareStatement(s_sql); + Vectumerator vec = findRows(ps); + if (!vec.hasMoreElements()) + return "1"; + Colore colore = (Colore)vec.nextElement(); + return String.valueOf(Long.valueOf(colore.getCodiceColore()) + 1L); + } catch (Exception e) { + return ""; + } + } + + public String getCodiceColore() { + return (this.codiceColore == null) ? "" : this.codiceColore.trim(); + } + + public void setCodiceColore(String codiceColore) { + this.codiceColore = codiceColore; + } + + public String getDescrizioneCompleta(String lang) { + StringBuilder sb = new StringBuilder(); + String temp = getDescrizionePS(lang); + if (getCodiceColore().isEmpty() && getCodiceColore().equals(temp)) { + sb.append(temp); + } else { + sb.append(getCodiceColore()); + sb.append(" "); + sb.append(temp); + } + return sb.toString(); + } + + public String getDescrizioneCompleta() { + StringBuilder sb = new StringBuilder(); + if (getCodiceColore().isEmpty() && getCodiceColore().equals(getDescrizione())) { + sb.append(getDescrizione()); + } else { + sb.append(getCodiceColore()); + sb.append(" "); + sb.append(getDescrizione()); + } + return sb.toString(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ColoreCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ColoreCR.java new file mode 100644 index 00000000..e9410fba --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ColoreCR.java @@ -0,0 +1,36 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ColoreCR extends CRAdapter { + public static final long ORDER_BY_DESCRIZIONE = 0L; + + public static final long ORDER_BY_CODICE = 1L; + + private long id_colore; + + private String descrizione; + + public ColoreCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ColoreCR() {} + + public void setId_colore(long newId_colore) { + this.id_colore = newId_colore; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_colore() { + return this.id_colore; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Componente.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Componente.java new file mode 100644 index 00000000..4d61ba96 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Componente.java @@ -0,0 +1,76 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Componente extends _ArtAdapter implements Serializable { + private static final long serialVersionUID = -4818220967606343494L; + + private long id_componente; + + private String sigla; + + public Componente(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Componente() {} + + public long getId_componente() { + return this.id_componente; + } + + public void setId_componente(long id_componente) { + this.id_componente = id_componente; + } + + public String getDescrizione() { + return getDescrizione(""); + } + + public String getSigla() { + return (this.sigla == null) ? "" : this.sigla; + } + + public void setSigla(String sigla) { + this.sigla = sigla; + } + + public boolean useDescLangTables() { + return true; + } + + public Vectumerator findByCR(ComponenteCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findBySigla(String l_sigla) { + String s_Sql_Find = "select A.* from COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.sigla='" + l_sigla + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getDescrizioneCompleta(String lang) { + return getSigla() + " " + getSigla(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ComponenteCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ComponenteCR.java new file mode 100644 index 00000000..03aaaa26 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ComponenteCR.java @@ -0,0 +1,32 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ComponenteCR extends CRAdapter { + private long id_componente; + + private String sigla; + + public ComponenteCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ComponenteCR() {} + + public long getId_componente() { + return this.id_componente; + } + + public void setId_componente(long id_componente) { + this.id_componente = id_componente; + } + + public String getSigla() { + return this.sigla; + } + + public void setSigla(String sigla) { + this.sigla = sigla; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/GoogleCategory.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/GoogleCategory.java new file mode 100644 index 00000000..3472d160 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/GoogleCategory.java @@ -0,0 +1,89 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class GoogleCategory extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1617360550628L; + + private long id_googleCategory; + + private long codice; + + private String descrizione; + + public GoogleCategory(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public GoogleCategory() {} + + public void setId_googleCategory(long newId_googleCategory) { + this.id_googleCategory = newId_googleCategory; + } + + public void setCodice(long newCodice) { + this.codice = newCodice; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_googleCategory() { + return this.id_googleCategory; + } + + public long getCodice() { + return this.codice; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(GoogleCategoryCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from GOOGLE_CATEGORY AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizioneCompleta() { + if (getId_googleCategory() == 0L) + return ""; + return "" + getCodice() + " - " + getCodice(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/GoogleCategoryCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/GoogleCategoryCR.java new file mode 100644 index 00000000..8c194f5c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/GoogleCategoryCR.java @@ -0,0 +1,42 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class GoogleCategoryCR extends CRAdapter { + private long id_googleCategory; + + private long codice; + + private String descrizione; + + public GoogleCategoryCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public GoogleCategoryCR() {} + + public void setId_googleCategory(long newId_googleCategory) { + this.id_googleCategory = newId_googleCategory; + } + + public void setCodice(long newCodice) { + this.codice = newCodice; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_googleCategory() { + return this.id_googleCategory; + } + + public long getCodice() { + return this.codice; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Kit.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Kit.java new file mode 100644 index 00000000..a3049791 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Kit.java @@ -0,0 +1,218 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Kit extends _ArtAdapter implements Serializable { + private static final long serialVersionUID = 805638952521639067L; + + private long id_kit; + + private long id_articoloSecondario; + + private Articolo articoloSecondario; + + private ArticoloVariante articoloVariante; + + private long id_articolo; + + private long id_articoloVariante; + + private long id_articoloVarianteSecondario; + + private Articolo articolo; + + private ArticoloVariante articoloVarianteSecondario; + + private long flgEstendiVarianteKit; + + public Kit(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Kit() {} + + public void setId_kit(long newId_kit) { + this.id_kit = newId_kit; + } + + public void setId_articoloSecondario(long newId_articolo) { + this.id_articoloSecondario = newId_articolo; + setArticoloSecondario(null); + } + + public long getId_articoloSecondario() { + return this.id_articoloSecondario; + } + + public void setArticoloSecondario(Articolo newArticolo) { + this.articoloSecondario = newArticolo; + } + + public Articolo getArticoloSecondario() { + this.articoloSecondario = (Articolo)getSecondaryObject(this.articoloSecondario, Articolo.class, getId_articoloSecondario()); + return this.articoloSecondario; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(KitCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from KIT AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_kit() { + return this.id_kit; + } + + public Vectumerator findByArticoloPrimario(long l_id_articoloPrimario, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* , B.nome from KIT AS A, ARTICOLO AS B"; + String s_Sql_Order = " order by B.nome"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=B.id_articolo"); + wc.addWc("A.id_articolo=" + l_id_articoloPrimario); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt, pageNumber, pageRows); + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findById_articoloVariante(long l_id_articoloVariante, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from KIT AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("(id_articoloVariante=" + l_id_articoloVariante + " or id_articoloVarianteSecondario=" + l_id_articoloVariante + ")"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findById_articoloVarianteDisponibile(long l_id_articoloVariante, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from KIT AS A, DISPONIBILITA AS C"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articoloVarianteSecondario=C.id_articoloVarianteD"); + wc.addWc("A.id_articoloVariante=" + l_id_articoloVariante); + wc.addWc("C.quantitaD>0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void setArticolo(Articolo articoloPrimario) { + this.articolo = articoloPrimario; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + setArticolo(null); + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, + getId_articoloVariante()); + return this.articoloVariante; + } + + public void setArticoloVariante(ArticoloVariante articoloVariantePrimario) { + this.articoloVariante = articoloVariantePrimario; + } + + public ArticoloVariante getArticoloVarianteSecondario() { + this.articoloVarianteSecondario = (ArticoloVariante)getSecondaryObject(this.articoloVarianteSecondario, ArticoloVariante.class, + getId_articoloVarianteSecondario()); + return this.articoloVarianteSecondario; + } + + public void setArticoloVarianteSecondario(ArticoloVariante articoloVarianteSecondario) { + this.articoloVarianteSecondario = articoloVarianteSecondario; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + setArticoloVariante(null); + } + + public long getId_articoloVarianteSecondario() { + return this.id_articoloVarianteSecondario; + } + + public void setId_articoloVarianteSecondario(long id_articoloVarianteSecondario) { + this.id_articoloVarianteSecondario = id_articoloVarianteSecondario; + setArticoloVarianteSecondario(null); + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public long getId_articoloAssociato(long l_id) { + if (l_id == getId_articoloSecondario()) + return getId_articolo(); + if (l_id == getId_articolo()) + return getId_articoloSecondario(); + return 0L; + } + + public void findById_articoloPrimarioId_articoloSecondario(long l_id_articoloPrimario, long l_id_articoloSecondario) { + String s_Sql_Find = "select A.* from KIT AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("((id_articolo=" + l_id_articoloPrimario + " and id_articoloSecondario=" + l_id_articoloSecondario + ") or(id_articolo=" + l_id_articoloSecondario + " and id_articoloSecondario=" + l_id_articoloPrimario + "))"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Articolo getArticoloAssociato(long l_id) { + if (l_id == getId_articoloSecondario()) + return getArticolo(); + if (l_id == getId_articolo()) + return getArticoloSecondario(); + return new Articolo(getApFull()); + } + + public long getFlgEstendiVarianteKit() { + return this.flgEstendiVarianteKit; + } + + public void setFlgEstendiVarianteKit(long flgEstendiVariante) { + this.flgEstendiVarianteKit = flgEstendiVariante; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/KitCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/KitCR.java new file mode 100644 index 00000000..b3c398ae --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/KitCR.java @@ -0,0 +1,12 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class KitCR extends CRAdapter { + public KitCR() {} + + public KitCR(ApplParmFull newAp) { + super(newAp); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Lista.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Lista.java new file mode 100644 index 00000000..1e19cecc --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Lista.java @@ -0,0 +1,191 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Lista extends _ArtAdapter implements Serializable { + private Caratteristica caratteristica; + + private long id_caratteristica; + + private long id_lista; + + private String valore; + + private String icecatValues; + + public Caratteristica getCaratteristica() { + this.caratteristica = (Caratteristica)getSecondaryObject(this.caratteristica, Caratteristica.class, new Long(getId_caratteristica())); + return this.caratteristica; + } + + public long getId_caratteristica() { + return this.id_caratteristica; + } + + public void setCaratteristica(Caratteristica caratteristica) { + this.caratteristica = caratteristica; + } + + public void setId_caratteristica(long newId_caratteristica) { + this.id_caratteristica = newId_caratteristica; + setCaratteristica(null); + } + + public Lista(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Lista() {} + + public void setId_lista(long newId_lista) { + this.id_lista = newId_lista; + } + + public void setValore(String newValore) { + this.valore = newValore; + } + + public long getId_lista() { + return this.id_lista; + } + + public String getValore() { + if (this.valore == null || this.valore.isEmpty()) + return getValore("it"); + return (this.valore == null) ? "" : this.valore; + } + + protected void deleteCascade() {} + + public Vectumerator findLista(long l_id_caratteristica, int pageNumber, int pageRows) { + ListaCR CR = new ListaCR(); + CR.setId_caratteristicaR(l_id_caratteristica); + return findByCR(CR, pageNumber, pageRows); + } + + public Vectumerator findByCR(ListaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.id_lista, A.id_caratteristica, C.descrizione AS valore, A.icecatValues from LISTA AS A inner join CARATTERISTICA as B on B.id_caratteristica=A.id_caratteristica INNER JOIN DESC_TXT_LANG AS C ON C.tabella = 'LISTA' AND C.lang = '" + CR.getLang() + "' INNER JOIN DESC_TXT_LANG AS D ON D.tabella = 'CARATTERISTICA' AND D.lang = '" + + CR.getLang() + "' "; + String s_Sql_Order = " order by D.descrizione, A.valore"; + WcString wc = new WcString(); + wc.addWc("A.id_caratteristica=B.id_caratteristica"); + wc.addWc("C.idTabella = A.id_lista"); + wc.addWc("D.idTabella = B.id_caratteristica"); + if (CR.getId_caratteristicaR() > 0L) + wc.addWc("A.id_caratteristica=" + CR.getId_caratteristicaR()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByCaratteristicaIcecatvalue(long l_id_caratteristica, String l_icecatValue) { + String s_Sql_Find = "select A.* from LISTA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_caratteristica=" + l_id_caratteristica); + wc.addWc("A.icecatValues ='" + l_icecatValue + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public boolean useDescLangTables() { + return true; + } + + public String getValore(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("valore", lang); + } + + public Vectumerator findByTipoCheNonFunziona(long l_id_tipo, String lang) { + String s_Sql_Find = "select A.id_lista, A.id_caratteristica, C.descrizione AS valore from LISTA AS A inner join CARATTERISTICA as B on B.id_caratteristica=A.id_caratteristica inner join C_TIPO AS CT ON CT.id_caratteristica=A.id_caratteristica inner join TIPO AS T ON T.id_tipo=CT.id_tipo INNER JOIN DESC_TXT_LANG AS C ON C.tabella = 'LISTA' AND C.lang = '" + lang + "' INNER JOIN DESC_TXT_LANG AS D ON D.tabella = 'CARATTERISTICA' AND D.lang = '" + lang + "' "; + String s_Sql_Order = " order by D.descrizione, A.valore"; + WcString wc = new WcString(); + wc.addWc("A.id_caratteristica=B.id_caratteristica"); + wc.addWc("C.idTabella = A.id_lista"); + wc.addWc("D.idTabella = B.id_caratteristica"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByTipo(long l_id_tipo, String lang) { + if (l_id_tipo == 0L) + return AB_EMPTY_VECTUMERATOR; + String s_Sql_FindC = "select A.id_caratteristica from C_TIPO AS A, TIPO as B"; + String s_Sql_OrderC = ""; + WcString wcC = new WcString(); + wcC.addWc("A.id_tipo=B.id_tipo"); + if (l_id_tipo != 0L) { + StringBuffer tipoWc = new StringBuffer("("); + Tipo tipo = new Tipo(getApFull()); + tipo.findByPrimaryKey(l_id_tipo); + StringTokenizer st = new StringTokenizer(tipo.getIndici(), ":"); + while (st.hasMoreTokens()) { + String currentId = st.nextToken(); + if (!currentId.isEmpty()) { + if (tipoWc.length() > 1) + tipoWc.append(" or "); + tipoWc.append("A.id_tipo=" + currentId); + } + } + tipoWc.append(")"); + if (tipoWc.length() > 2) + wcC.addWc(tipoWc.toString()); + } + String s_Sql_Find = "select A.id_lista, A.id_caratteristica, C.descrizione AS valore from LISTA AS A inner join CARATTERISTICA as B on B.id_caratteristica=A.id_caratteristica INNER JOIN DESC_TXT_LANG AS C ON C.tabella = 'LISTA' AND C.lang = '" + lang + "' INNER JOIN DESC_TXT_LANG AS D ON D.tabella = 'CARATTERISTICA' AND D.lang = '" + lang + "' "; + String s_Sql_Order = " order by D.descrizione, A.valore"; + WcString wc = new WcString(); + wc.addWc("A.id_caratteristica=B.id_caratteristica"); + wc.addWc("C.idTabella = A.id_lista"); + wc.addWc("D.idTabella = B.id_caratteristica"); + wc.addWc("A.id_caratteristica in (" + s_Sql_FindC + wcC.toString() + ")"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getIcecatValues() { + return (this.icecatValues == null) ? "" : this.icecatValues.trim(); + } + + public void setIcecatValues(String icecatValues) { + this.icecatValues = icecatValues; + } + + public void findByValore(String l_valore) { + String s_Sql_Find = "select A.* from LISTA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.valore ='" + l_valore + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ListaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ListaCR.java new file mode 100644 index 00000000..80957590 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ListaCR.java @@ -0,0 +1,42 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ListaCR extends CRAdapter { + private long id_caratteristicaR; + + private long id_lista; + + private String valore; + + public ListaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ListaCR() {} + + public void setId_lista(long newId_lista) { + this.id_lista = newId_lista; + } + + public void setValore(String newValore) { + this.valore = newValore; + } + + public long getId_lista() { + return this.id_lista; + } + + public String getValore() { + return (this.valore == null) ? "" : this.valore; + } + + public long getId_caratteristicaR() { + return this.id_caratteristicaR; + } + + public void setId_caratteristicaR(long l) { + this.id_caratteristicaR = l; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Marca.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Marca.java new file mode 100644 index 00000000..77f63a6e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Marca.java @@ -0,0 +1,692 @@ +package it.acxent.art; + +import it.acxent.common.StatusMsg; +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.ScaleImage; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Timer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; + +public class Marca extends _ArtAdapter implements Serializable, AddImgInterface { + private long id_marca; + + private String descrizioniImport; + + private String articoliTrattati; + + private String link; + + private String indiciTipo; + + private String tag; + + private String descrizione; + + private String tagOfferta; + + private long flgIcecatAuto; + + private long flgIncludiMainSitemap; + + private String nomeSeo; + + class ThreadIndicizzoMarche extends Thread { + private long id_marca; + + public ThreadIndicizzoMarche(long l_id_marca) { + this.id_marca = l_id_marca; + if (!Marca.isThreadAttivo()) { + Marca.threadindicizzoMarche = true; + start(); + } + } + + public void run() { + boolean debug = false; + String TAG_THREAD_MSG = "INDICIZZAZIONE MARCHE "; + Timer timer = new Timer(); + timer.start(); + ResParm rp = new ResParm(true); + Marca bean = new Marca(Marca.this.getApFull()); + if (this.id_marca > 0L) { + bean.findByPrimaryKey(this.id_marca); + rp = bean.aggiornaIndiciTipo("INDICIZZAZIONE MARCHE "); + } else { + rp = bean.aggiornaIndiciTipoAll("INDICIZZAZIONE MARCHE "); + if (rp.getStatus()) + rp = bean.aggiornaIndiciMarcheSuTipo("INDICIZZAZIONE MARCHE "); + } + rp.append(bean.aggiornaTagAll("INDICIZZAZIONE MARCHE ")); + timer.stop(); + StatusMsg.updateMsgByTag(Marca.this.getApFull(), "INDICIZZAZIONE MARCHE ", " FINE " + rp.getMsg() + " " + timer.getDurataHourMin()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(Marca.this.getApFull(), "INDICIZZAZIONE MARCHE "); + Marca.threadindicizzoMarche = false; + } + } + + public static boolean threadindicizzoMarche = false; + + public Marca(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Marca() {} + + public void setId_marca(long newId_marca) { + this.id_marca = newId_marca; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_marca() { + return this.id_marca; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.toUpperCase().trim(); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(MarcaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from MARCA AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + if (!CR.getDescrizioneS().isEmpty()) + wc.addWc("A.descrizione like'" + CR.getDescrizioneS() + "%'"); + if (!CR.getDescrizione().isEmpty()) + wc.addWc("A.descrizione like'" + CR.getDescrizione() + "%'"); + if (!CR.getTag().isEmpty()) + wc.addWc("A.tag like'" + CR.getTag() + "%'"); + if (!CR.getTagOfferta().isEmpty()) + wc.addWc("A.tagOfferta like'" + CR.getTagOfferta() + "%'"); + if (CR.getFlgIcecatAuto() == 0L) { + wc.addWc("(A.flgIcecatAuto =0 or A.flgIcecatAuto is null)"); + } else if (CR.getFlgIcecatAuto() > 0L) { + wc.addWc("A.flgIcecatAuto=" + CR.getFlgIcecatAuto()); + } + if (CR.getFlgIncludiMainSitemap() == 0L) { + wc.addWc("(A.flgIncludiMainSitemap =0 or A.flgIncludiMainSitemap is null)"); + } else if (CR.getFlgIncludiMainSitemap() > 0L) { + wc.addWc("A.flgIncludiMainSitemap=" + CR.getFlgIncludiMainSitemap()); + } + String l_letteraIniziale = CR.getLetteraIniziale(); + if (l_letteraIniziale.equals("AF")) { + wc.addWc("A.descrizione >= 'A%'"); + wc.addWc("A.descrizione <= 'G%'"); + } else if (l_letteraIniziale.equals("GM")) { + wc.addWc("A.descrizione >= 'G%'"); + wc.addWc("A.descrizione <= 'N%'"); + } else if (l_letteraIniziale.equals("NR")) { + wc.addWc("A.descrizione >= 'N%'"); + wc.addWc("A.descrizione <= 'S%'"); + } else if (l_letteraIniziale.equals("SZ")) { + wc.addWc("A.descrizione >= 'S%'"); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByDescrizione(String l_desc) { + String s_Sql_Find = "select A.* from MARCA AS A"; + String s_Sql_Order = ""; + String wc = ""; + wc = buildWc(wc, "A.descrizione like'" + l_desc + "%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findMarchePresentiByTipoTag(long l_id_tipo, String l_tag) { + String s_Sql_Find = "select distinct A.* from MARCA as A inner join ARTICOLO as B on A.id_marca=B.id_marca"; + String s_Sql_Order = " order by A.descrizione "; + WcString wc = new WcString(); + if (l_id_tipo > 0L) { + wc.addWc("A.indiciTipo like '%:" + l_id_tipo + ":%'"); + } else { + wc.addWc("A.indiciTipo is not null"); + } + if (l_tag != null && !l_tag.isEmpty()) + wc.addWc("A.tag like '%," + l_tag + ",%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getArticoliTrattati() { + return (this.articoliTrattati == null) ? "" : this.articoliTrattati.trim(); + } + + public void setArticoliTrattati(String articoliTrattati) { + this.articoliTrattati = articoliTrattati; + } + + public String getLink() { + return (this.link == null) ? "" : this.link.trim(); + } + + public void setLink(String link) { + this.link = link; + } + + public String getIndiciTipo() { + return (this.indiciTipo == null) ? "" : this.indiciTipo.trim(); + } + + public void setIndiciTipo(String indiciTipo) { + this.indiciTipo = indiciTipo; + } + + public ResParm aggiornaIndiciTipoAll(String TAG_THREAD_MSG) { + Vectumerator vec = findAll(); + ResParm rp = new ResParm(); + while (vec.hasMoreElements()) { + Marca row = (Marca)vec.nextElement(); + rp = row.aggiornaIndiciTipo(TAG_THREAD_MSG); + if (!rp.getStatus()) + break; + } + return rp; + } + + public ResParm aggiornaTagAll(String TAG_THREAD_MSG) { + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "Aggiorna Tag Marche...."); + String SEP = ","; + int num = 0, numTot = 0; + Vectumerator vec = findAll(); + numTot = vec.getTotNumberOfRecords(); + ResParm rp = new ResParm(); + Articolo art = new Articolo(getApFull()); + ArticoloCR CRArt = new ArticoloCR(); + CRArt.setFlgEscludiWeb(0L); + CRArt.setFlgNascondi(0L); + while (vec.hasMoreElements()) { + Marca row = (Marca)vec.nextElement(); + StringBuilder newTag = new StringBuilder(); + num++; + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "Aggiorna Tag Marche: " + num + "/" + numTot + " " + row.getDescrizione()); + CRArt.setId_marca(row.getId_marca()); + CRArt.setFlgNoleggio(0L); + CRArt.setFlgStockOfferte(1L); + Vectumerator vecArt = art.findByCR(CRArt, 1, 1); + if (vecArt.getTotNumberOfRecords() > 0) { + newTag.append(","); + newTag.append("OFFERTA"); + } + CRArt.setFlgStockOfferte(2L); + vecArt = art.findByCR(CRArt, 1, 1); + if (vecArt.getTotNumberOfRecords() > 0) { + newTag.append(","); + newTag.append("STOCK"); + } + CRArt.setFlgStockOfferte(3L); + vecArt = art.findByCR(CRArt, 1, 1); + if (vecArt.getTotNumberOfRecords() > 0) { + newTag.append(","); + newTag.append("USATO"); + } + CRArt.setFlgStockOfferte(4L); + vecArt = art.findByCR(CRArt, 1, 1); + if (vecArt.getTotNumberOfRecords() > 0) { + newTag.append(","); + newTag.append("NOVITA"); + } + CRArt.setFlgStockOfferte(0L); + CRArt.setFlgNoleggio(20L); + vecArt = art.findByCR(CRArt, 1, 1); + if (vecArt.getTotNumberOfRecords() > 0) { + newTag.append(","); + newTag.append("NOLEGGIO"); + } + row.setTag(newTag.toString()); + rp = row.save(); + if (!rp.getStatus()) + break; + } + return rp; + } + + public ResParm aggiornaIndiciTipo(String TAG_THREAD_MSG) { + ResParm rp = new ResParm(); + if (getId_marca() > 0L) { + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, getDescrizione()); + String DELIM = ":"; + Vectumerator vec = new Tipo(getApFull()).findTipiArticoliWebByMarca(getId_marca()); + HashSet hsIDT = new HashSet<>(); + while (vec.hasMoreElements()) { + Tipo row = (Tipo)vec.nextElement(); + StringTokenizer st = new StringTokenizer(row.getIndici(), ":"); + while (st.hasMoreTokens()) { + String currentId = st.nextToken(); + if (!currentId.isEmpty() && !hsIDT.contains(currentId)) + hsIDT.add(currentId); + } + } + vec = new Tipo(getApFull()).findTipiAggiuntiviArticoliWebByMarca(getId_marca()); + while (vec.hasMoreElements()) { + Tipo row = (Tipo)vec.nextElement(); + StringTokenizer st = new StringTokenizer(row.getIndici(), ":"); + while (st.hasMoreTokens()) { + String currentId = st.nextToken(); + if (!currentId.isEmpty() && !hsIDT.contains(currentId)) + hsIDT.add(currentId); + } + } + Iterator iteHsIDT = hsIDT.iterator(); + StringBuilder sb = new StringBuilder(); + if (iteHsIDT.hasNext()) + sb.append(":"); + while (iteHsIDT.hasNext()) { + sb.append(iteHsIDT.next()); + sb.append(":"); + } + setIndiciTipo(sb.toString()); + rp = save(); + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, getDescrizione() + " " + getDescrizione() + " " + getIndiciTipo()); + return rp; + } + return rp; + } + + public ResParm aggiornaIndiciMarcheSuTipo(String TAG_THREAD_MSG) { + ResParm rp = new ResParm(); + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "INIZIO INDICIZZAZIONE MARCHE SUI TIPI..."); + Vectumerator vec = findAll(); + HashMap hmTipo = new HashMap<>(); + StringBuilder sbErr = new StringBuilder(); + while (vec.hasMoreElements()) { + Marca row = (Marca)vec.nextElement(); + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "INDICIZZAZIONE MARCHE SUI TIPI..." + row.getDescrizione()); + if (!row.getIndiciTipo().isEmpty()) { + StringTokenizer st = new StringTokenizer(row.getIndiciTipo(), ":"); + while (st.hasMoreTokens()) { + String currentToken = st.nextToken(); + if (!currentToken.isEmpty()) { + long currentId_tipo = Long.parseLong(currentToken); + if (currentId_tipo > 0L) { + String id_marche; + if (hmTipo.containsKey(Long.valueOf(currentId_tipo))) { + id_marche = hmTipo.get(Long.valueOf(currentId_tipo)); + } else { + id_marche = ""; + } + if (!id_marche.contains(":" + row.getId_marca() + ":")) { + if (id_marche.isEmpty()) { + id_marche = ":" + id_marche + row.getId_marca() + ":"; + } else { + id_marche = id_marche + id_marche + ":"; + } + hmTipo.put(Long.valueOf(currentId_tipo), id_marche); + } + } + } + } + } + } + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "INDICIZZAZIONE MARCHE SUI TIPI... salvo marche su tipo"); + Tipo tipo = new Tipo(getApFull()); + for (Map.Entry entry : hmTipo.entrySet()) { + System.out.println("Key = " + String.valueOf(entry.getKey()) + ", Value = " + (String)entry.getValue()); + tipo.findByPrimaryKey(entry.getKey().longValue()); + if (tipo.getId_tipo() > 0L) { + tipo.setId_marche(entry.getValue()); + rp = tipo.save(); + } else { + rp.setStatus(false); + rp.setMsg("Errore! Tipo su marche non trovato tra i tipi. Indicizzare nuovamente le Marche"); + } + if (!rp.getStatus()) { + sbErr.append(rp.getMsg()); + sbErr.append("\n"); + } + } + if (sbErr.length() > 0) { + rp.setStatus(false); + rp.setMsg(sbErr.toString()); + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "INDICIZZAZIONE MARCHE SUI TIPI ERRORE!! " + rp.getMsg()); + } else { + rp.setMsg("Indici marche su Tipo creati correttamente."); + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "INDICIZZAZIONE MARCHE SUI TIPI. Indici marche su Tipo creati correttamente"); + } + return rp; + } + + public static boolean isThreadAttivo() { + return threadindicizzoMarche; + } + + public final ResParm startIndicizzoMarche(long l_id_marca) { + if (!isThreadAttivo()) { + new ThreadIndicizzoMarche(l_id_marca); + return new ResParm(true, "Thread Indicizzazione Marche Avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread Indicizzazione Marche gia' in esecuzione!!!"); + } + + public Vectumerator findWebByArticoloCR(ArticoloCR CR, int pageNumber, int pageRows) { + String occurrenceFind; + StringBuilder sb = new StringBuilder(); + boolean debug = false; + Timer timer = new Timer(); + if (debug) { + timer.start(); + sb.append(">>>>>>>>>>>>>>>>>>>>>>\nMARCA findWebByArticoloCR: "); + Date d = new Date(System.currentTimeMillis()); + sb.append(getApFull().getReqUrl()); + sb.append("\n"); + sb.append(d.toString()); + sb.append(" ip: "); + sb.append(getApFull().getReqIpAddress()); + } + Articolo articolo = new Articolo(getApFull()); + String occurrence = articolo.findWebByArticoloCRCreateSmartSearchOccurrence(CR.getSearchTxtWeb().toLowerCase(), "A.descrizioneSearch"); + if (!occurrence.isEmpty()) { + occurrenceFind = occurrence + ", "; + } else { + occurrenceFind = ""; + } + StringBuffer s_Sql_Find = new StringBuffer("select distinct " + occurrenceFind + " M.* from ARTICOLO AS A inner join TIPO AS C on C.id_tipo=A.id_tipo inner join MARCA as M on M.id_marca=A.id_marca"); + String s_sqlOrderBy = " order by M.descrizione"; + if (CR.getSearchTxtWeb().isEmpty() || !CR.getSearchTxtWeb().equals("*")); + WcString wc = new WcString(); + CR.setId_marche(""); + CR.setFlgOrderBy(0L); + articolo.findWebByArticoloCRCreateWC(CR, s_Sql_Find, wc); + try { + if (debug) { + sb.append("\n"); + sb.append(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + } + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + Vectumerator vec = findRows(stmt, pageNumber, pageRows); + if (debug) { + timer.stop(); + sb.append("\nDurata query: ms "); + sb.append(timer.getDurataMilliSec()); + sb.append("\n"); + sb.append("\n<<<<<<<<<<<<"); + System.out.println(sb.toString()); + } + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getTag() { + if (this.tag == null) + return ""; + if (!this.tag.isEmpty()) { + this.tag = this.tag.trim(); + if (!this.tag.startsWith(",")) + this.tag = "," + this.tag; + if (!this.tag.endsWith(",")) + this.tag += ","; + } + return this.tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public String getImgFileName(int imgNumber) { + return getImgFileName(imgNumber, getImgTmst()); + } + + public String getImgFileName(int imgNumber, int scaledWidth) { + String targetDir = getDocBase() + getDocBase(); + String newImageName = "" + scaledWidth + "/" + scaledWidth; + String srcFileName = targetDir + targetDir; + String targetFileName = targetDir + targetDir; + ResParm rp = ScaleImage.scaleImageToFile(srcFileName, targetFileName, getPathTmpFull(), scaledWidth, 75); + if (rp.getStatus()) + return newImageName; + return getImgFileName(imgNumber, getImgTmst()); + } + + public String getImgFileName(int imgNumber, String l_Tmst) { + return "" + getId_marca() + "_" + getId_marca() + "_" + l_Tmst + ".jpg"; + } + + public String getImgFileName(long imgNumber) { + return getImgFileName((int)imgNumber); + } + + public String getDescrizioniImport() { + return (this.descrizioniImport == null) ? "" : this.descrizioniImport.trim(); + } + + public void setDescrizioniImport(String descrizioniImport) { + this.descrizioniImport = descrizioniImport; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + String temp = getDescrizioniImport(); + if (!temp.isEmpty()) { + if (!temp.startsWith(",")) + temp = "," + temp; + if (!temp.endsWith(",")) + temp = temp + ","; + setDescrizioniImport(temp.replace(", ", ",")); + } else { + setDescrizioniImport("," + getDescrizione() + ","); + } + super.prepareSave(ps); + } + + public void findByDescrizioneImport(String l_desc) { + String s_Sql_Find = "select A.* from MARCA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.descrizioniImport LIKE '%," + prepareInputMySqlString(l_desc, false) + ",%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getCCLinkSearchOld(String lang) { + return "search+cerca---M," + getId_marca() + "--1-48-" + lang + ".html"; + } + + public String getCCLinkSearch(String lang) { + boolean usePageNumberTag = false; + boolean isCanonical = false; + StringBuilder sb = new StringBuilder(); + if (!getNomeSeo().isEmpty()) { + sb.append(convertStringToLink(getNomeSeo()).toLowerCase()); + } else { + sb.append(convertStringToLink(getDescrizione()).toLowerCase()); + } + sb.append("+"); + if (usePageNumberTag) { + sb.append("s"); + } else { + sb.append("l"); + } + sb.append("-"); + sb.append("-"); + sb.append("-"); + sb.append("m,"); + sb.append(getId_marca()); + sb.append("-"); + if (!usePageNumberTag) { + if (!isCanonical); + sb.append("-"); + } + sb.append("-"); + if (usePageNumberTag) { + sb.append("#"); + } else { + sb.append(1); + } + sb.append("-"); + sb.append(48); + sb.append("-"); + sb.append(lang); + sb.append(".html"); + if (usePageNumberTag); + return sb.toString().replaceAll("-0", "-").toLowerCase(); + } + + public Vectumerator findMarcheConTagOfferta() { + String s_Sql_Find = "select A.* from MARCA as A"; + String s_Sql_Order = " order by A.descrizione "; + WcString wc = new WcString(); + wc.addWc("A.tagOfferta is not null and A.tagOfferta <>''"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getTagOfferta() { + return (this.tagOfferta == null) ? "" : this.tagOfferta.trim(); + } + + public void setTagOfferta(String tagOfferta) { + this.tagOfferta = tagOfferta; + } + + public long getFlgIcecatAuto() { + return this.flgIcecatAuto; + } + + public void setFlgIcecatAuto(long flgIcecatAuto) { + this.flgIcecatAuto = flgIcecatAuto; + } + + public long getFlgIncludiMainSitemap() { + return this.flgIncludiMainSitemap; + } + + public void setFlgIncludiMainSitemap(long flgIncludiMainSitemap) { + this.flgIncludiMainSitemap = flgIncludiMainSitemap; + } + + public String getCCSeoTitle(String lang) { + if (!getSeoTitle(lang).isEmpty()) + return getSeoTitle(lang); + return getDescrizione(); + } + + public String getSeoTitle(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("seoTitle", lang); + } + + public String getCCMetaDescriptionWeb(String lang) { + if (!getMetaDescription(lang).isEmpty()) + return convertStringToHtml(getMetaDescription(lang)); + return getDescrizione(); + } + + public String getMetaDescription(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("metaDescription", lang); + } + + public String getCCTagH1(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("tagH1", lang); + } + + public String getCCTagH2(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("tagH2", lang); + } + + public String getCCTagH1Web(String lang) { + if (getCCTagH1(lang).isEmpty()) + return convertStringToHtml(getDescrizione()); + return convertStringToHtml(getCCTagH1(lang)); + } + + public String getCCTagH2Web(String lang) { + if (getCCTagH2(lang).isEmpty()) + return ""; + return convertStringToHtml(getCCTagH2(lang)); + } + + public String getNomeSeo() { + return (this.nomeSeo == null) ? "" : this.nomeSeo.trim(); + } + + public void setNomeSeo(String nomeSeo) { + this.nomeSeo = nomeSeo; + } + + public boolean useDescLangTables() { + return true; + } + + public String getPathImg() { + return "_img/_imgMarca/"; + } + + public Vectumerator findMarcheConLink(String l_letteraIniziale, int pageNumber, int pageRows) { + String s_Sql_Find = "select DISTINCT A.* from MARCA AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.link is not null"); + wc.addWc(" A.link<>''"); + if (l_letteraIniziale.equals("AF")) { + wc.addWc("A.descrizione >= 'A%'"); + wc.addWc("A.descrizione <= 'G%'"); + } else if (l_letteraIniziale.equals("GM")) { + wc.addWc("A.descrizione >= 'G%'"); + wc.addWc("A.descrizione <= 'N%'"); + } else if (l_letteraIniziale.equals("NR")) { + wc.addWc("A.descrizione >= 'N%'"); + wc.addWc("A.descrizione <= 'S%'"); + } else if (l_letteraIniziale.equals("SZ")) { + wc.addWc("A.descrizione >= 'S%'"); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/MarcaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/MarcaCR.java new file mode 100644 index 00000000..61fbd764 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/MarcaCR.java @@ -0,0 +1,92 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class MarcaCR extends CRAdapter { + private long id_marca; + + private String descrizioneS; + + private String tag; + + private String descrizione; + + private String tagOfferta; + + private long flgIcecatAuto = -1L; + + private long flgIncludiMainSitemap = -1L; + + private String letteraIniziale; + + public MarcaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public MarcaCR() {} + + public void setId_marca(long newId_marca) { + this.id_marca = newId_marca; + } + + public void setDescrizioneS(String newDescrizione) { + this.descrizioneS = newDescrizione; + } + + public long getId_marca() { + return this.id_marca; + } + + public String getDescrizioneS() { + return (this.descrizioneS == null) ? "" : this.descrizioneS; + } + + public String getTag() { + return (this.tag == null) ? AB_EMPTY_STRING : this.tag.trim(); + } + + public void setTag(String tag) { + this.tag = tag; + } + + public String getDescrizione() { + return (this.descrizione == null) ? AB_EMPTY_STRING : this.descrizione.trim(); + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } + + public String getTagOfferta() { + return (this.tagOfferta == null) ? AB_EMPTY_STRING : this.tagOfferta.trim(); + } + + public void setTagOfferta(String tagOfferta) { + this.tagOfferta = tagOfferta; + } + + public long getFlgIcecatAuto() { + return this.flgIcecatAuto; + } + + public void setFlgIcecatAuto(long flgIcecatAuto) { + this.flgIcecatAuto = flgIcecatAuto; + } + + public long getFlgIncludiMainSitemap() { + return this.flgIncludiMainSitemap; + } + + public void setFlgIncludiMainSitemap(long flgIncludiMainSitemap) { + this.flgIncludiMainSitemap = flgIncludiMainSitemap; + } + + public String getLetteraIniziale() { + return (this.letteraIniziale == null) ? AB_EMPTY_STRING : this.letteraIniziale.trim(); + } + + public void setLetteraIniziale(String letteraIniziale) { + this.letteraIniziale = letteraIniziale; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Modello.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Modello.java new file mode 100644 index 00000000..9cd9c2b7 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Modello.java @@ -0,0 +1,88 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Modello extends _ArtAdapter implements Serializable { + private long id_modello; + + private String descrizione; + + private long id_marca; + + private Marca marca; + + public Modello(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Modello() {} + + public void setId_modello(long newId_modello) { + this.id_modello = newId_modello; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setId_marca(long newId_marca) { + this.id_marca = newId_marca; + setMarca(null); + } + + public long getId_modello() { + return this.id_modello; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getId_marca() { + return this.id_marca; + } + + public void setMarca(Marca newMarca) { + this.marca = newMarca; + } + + public Marca getMarca() { + this.marca = (Marca)getSecondaryObject(this.marca, Marca.class, + + getId_marca()); + return this.marca; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ModelloCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from MODELLO AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ModelloCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ModelloCR.java new file mode 100644 index 00000000..3e5c3b5b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/ModelloCR.java @@ -0,0 +1,56 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ModelloCR extends CRAdapter { + private long id_modello; + + private String descrizione; + + private long id_marca; + + private Marca marca; + + public ModelloCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ModelloCR() {} + + public void setId_modello(long newId_modello) { + this.id_modello = newId_modello; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setId_marca(long newId_marca) { + this.id_marca = newId_marca; + setMarca(null); + } + + public long getId_modello() { + return this.id_modello; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getId_marca() { + return this.id_marca; + } + + public void setMarca(Marca newMarca) { + this.marca = newMarca; + } + + public Marca getMarca() { + this.marca = (Marca)getSecondaryObject(this.marca, Marca.class, + + getId_marca()); + return this.marca; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/QuotazioneArticolo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/QuotazioneArticolo.java new file mode 100644 index 00000000..6d61b7ac --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/QuotazioneArticolo.java @@ -0,0 +1,212 @@ +package it.acxent.art; + +import it.acxent.anag.Users; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Timestamp; + +public class QuotazioneArticolo extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1595583012215L; + + private long id_quotazioneArticolo; + + private long id_users; + + private long id_articolo; + + private long id_articoloVariante; + + private long id_articoloTaglia; + + private long flgAbilitaAvviso; + + private double prezzoQA; + + private Date dataQA; + + private Date dataFineQA; + + private Timestamp tmstUltimoAvviso; + + private Users users; + + private Articolo articolo; + + private ArticoloVariante articoloVariante; + + private ArticoloTaglia articoloTaglia; + + public QuotazioneArticolo(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public QuotazioneArticolo() {} + + public void setId_quotazioneArticolo(long newId_quotazioneArticolo) { + this.id_quotazioneArticolo = newId_quotazioneArticolo; + } + + public void setId_users(long newId_users) { + this.id_users = newId_users; + setUsers(null); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setId_articoloVariante(long newId_articoloVariante) { + this.id_articoloVariante = newId_articoloVariante; + setArticoloVariante(null); + } + + public void setId_articoloTaglia(long newId_articoloTaglia) { + this.id_articoloTaglia = newId_articoloTaglia; + setArticoloTaglia(null); + } + + public void setFlgAbilitaAvviso(long newFlgAbilitaAvviso) { + this.flgAbilitaAvviso = newFlgAbilitaAvviso; + } + + public void setPrezzoQA(double newPrezzoQA) { + this.prezzoQA = newPrezzoQA; + } + + public void setDataQA(Date newDataQA) { + this.dataQA = newDataQA; + } + + public void setDataFineQA(Date newDataFineQA) { + this.dataFineQA = newDataFineQA; + } + + public void setTmstUltimoAvviso(Timestamp newTmstUltimoAvviso) { + this.tmstUltimoAvviso = newTmstUltimoAvviso; + } + + public long getId_quotazioneArticolo() { + return this.id_quotazioneArticolo; + } + + public long getId_users() { + return this.id_users; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public long getId_articoloTaglia() { + return this.id_articoloTaglia; + } + + public long getFlgAbilitaAvviso() { + return this.flgAbilitaAvviso; + } + + public double getPrezzoQA() { + return this.prezzoQA; + } + + public Date getDataQA() { + return this.dataQA; + } + + public Date getDataFineQA() { + return this.dataFineQA; + } + + public Timestamp getTmstUltimoAvviso() { + return this.tmstUltimoAvviso; + } + + public void setUsers(Users newUsers) { + this.users = newUsers; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, + + getId_users()); + return this.users; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + + getId_articolo()); + return this.articolo; + } + + public void setArticoloVariante(ArticoloVariante newArticoloVariante) { + this.articoloVariante = newArticoloVariante; + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, + + getId_articoloVariante()); + return this.articoloVariante; + } + + public void setArticoloTaglia(ArticoloTaglia newArticoloTaglia) { + this.articoloTaglia = newArticoloTaglia; + } + + public ArticoloTaglia getArticoloTaglia() { + this.articoloTaglia = (ArticoloTaglia)getSecondaryObject(this.articoloTaglia, ArticoloTaglia.class, + + getId_articoloTaglia()); + return this.articoloTaglia; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(QuotazioneArticoloCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from QUOTAZIONE_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/QuotazioneArticoloCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/QuotazioneArticoloCR.java new file mode 100644 index 00000000..137febcd --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/QuotazioneArticoloCR.java @@ -0,0 +1,172 @@ +package it.acxent.art; + +import it.acxent.anag.Users; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import java.sql.Date; +import java.sql.Timestamp; + +public class QuotazioneArticoloCR extends CRAdapter { + private long id_quotazioneArticolo; + + private long id_users; + + private long id_articolo; + + private long id_articoloVariante; + + private long id_articoloTaglia; + + private long flgAbilitaAvviso; + + private double prezzoQA; + + private Date dataQA; + + private Date dataFineQA; + + private Timestamp tmstUltimoAvviso; + + private Users users; + + private Articolo articolo; + + private ArticoloVariante articoloVariante; + + private ArticoloTaglia articoloTaglia; + + public QuotazioneArticoloCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public QuotazioneArticoloCR() {} + + public void setId_quotazioneArticolo(long newId_quotazioneArticolo) { + this.id_quotazioneArticolo = newId_quotazioneArticolo; + } + + public void setId_users(long newId_users) { + this.id_users = newId_users; + setUsers(null); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setId_articoloVariante(long newId_articoloVariante) { + this.id_articoloVariante = newId_articoloVariante; + setArticoloVariante(null); + } + + public void setId_articoloTaglia(long newId_articoloTaglia) { + this.id_articoloTaglia = newId_articoloTaglia; + setArticoloTaglia(null); + } + + public void setFlgAbilitaAvviso(long newFlgAbilitaAvviso) { + this.flgAbilitaAvviso = newFlgAbilitaAvviso; + } + + public void setPrezzoQA(double newPrezzoQA) { + this.prezzoQA = newPrezzoQA; + } + + public void setDataQA(Date newDataQA) { + this.dataQA = newDataQA; + } + + public void setDataFineQA(Date newDataFineQA) { + this.dataFineQA = newDataFineQA; + } + + public void setTmstUltimoAvviso(Timestamp newTmstUltimoAvviso) { + this.tmstUltimoAvviso = newTmstUltimoAvviso; + } + + public long getId_quotazioneArticolo() { + return this.id_quotazioneArticolo; + } + + public long getId_users() { + return this.id_users; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public long getId_articoloTaglia() { + return this.id_articoloTaglia; + } + + public long getFlgAbilitaAvviso() { + return this.flgAbilitaAvviso; + } + + public double getPrezzoQA() { + return this.prezzoQA; + } + + public Date getDataQA() { + return this.dataQA; + } + + public Date getDataFineQA() { + return this.dataFineQA; + } + + public Timestamp getTmstUltimoAvviso() { + return this.tmstUltimoAvviso; + } + + public void setUsers(Users newUsers) { + this.users = newUsers; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, + + getId_users()); + return this.users; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + + getId_articolo()); + return this.articolo; + } + + public void setArticoloVariante(ArticoloVariante newArticoloVariante) { + this.articoloVariante = newArticoloVariante; + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, + + getId_articoloVariante()); + return this.articoloVariante; + } + + public void setArticoloTaglia(ArticoloTaglia newArticoloTaglia) { + this.articoloTaglia = newArticoloTaglia; + } + + public ArticoloTaglia getArticoloTaglia() { + this.articoloTaglia = (ArticoloTaglia)getSecondaryObject(this.articoloTaglia, ArticoloTaglia.class, + + getId_articoloTaglia()); + return this.articoloTaglia; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/RegistroUsato.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/RegistroUsato.java new file mode 100644 index 00000000..9bf92ef5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/RegistroUsato.java @@ -0,0 +1,45 @@ +package it.acxent.art; + +import it.acxent.db.ResParm; + +public class RegistroUsato { + private long paginaInizio; + + private long paginaFine; + + private String fileName; + + private ResParm resParm; + + public long getPaginaInizio() { + return this.paginaInizio; + } + + public void setPaginaInizio(long paginaInizio) { + this.paginaInizio = paginaInizio; + } + + public long getPaginaFine() { + return this.paginaFine; + } + + public void setPaginaFine(long paginaFine) { + this.paginaFine = paginaFine; + } + + public String getFileName() { + return (this.fileName == null) ? "" : this.fileName.trim(); + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public ResParm getResParm() { + return this.resParm; + } + + public void setResParm(ResParm resParm) { + this.resParm = resParm; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Reparto.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Reparto.java new file mode 100644 index 00000000..058b87d5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Reparto.java @@ -0,0 +1,109 @@ +package it.acxent.art; + +import it.acxent.anag.Iva; +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Reparto extends _ArtAdapter implements Serializable { + private long id_reparto; + + private String descrizione; + + private String sigla; + + private long id_iva; + + private Iva iva; + + private long siglaEpson; + + public Reparto(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Reparto() {} + + public void setId_reparto(long newId_reparto) { + this.id_reparto = newId_reparto; + } + + public void setDescrizione(String newDescrizione_it) { + this.descrizione = newDescrizione_it; + } + + public long getId_reparto() { + return this.id_reparto; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : + this.descrizione.trim(); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(RepartoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from REPARTO AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getSigla() { + return (this.sigla == null) ? "" : this.sigla.trim(); + } + + public void setSigla(String sigla) { + this.sigla = sigla; + } + + public Iva getIva() { + this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, new Long(getId_iva())); + return this.iva; + } + + public void setId_iva(long newId_iva) { + this.id_iva = newId_iva; + setIva(null); + } + + public long getId_iva() { + return this.id_iva; + } + + public void setIva(Iva iva) { + this.iva = iva; + } + + public long getSiglaEpson() { + return this.siglaEpson; + } + + public void setSiglaEpson(long siglaEpson) { + this.siglaEpson = siglaEpson; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/RepartoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/RepartoCR.java new file mode 100644 index 00000000..63506de3 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/RepartoCR.java @@ -0,0 +1,53 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Timestamp; + +public class RepartoCR extends CRAdapter { + private long id_reparto; + + private String descrizione; + + private long lastUpdId_user; + + private Timestamp lastUpdTmst; + + public RepartoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RepartoCR() {} + + public void setId_reparto(long newId_reparto) { + this.id_reparto = newId_reparto; + } + + public void setDescrizione(String newDescrizione_it) { + this.descrizione = newDescrizione_it; + } + + public void setLastUpdId_user(long newLastUpdId_user) { + this.lastUpdId_user = newLastUpdId_user; + } + + public void setLastUpdTmst(Timestamp newLastUpdTmst) { + this.lastUpdTmst = newLastUpdTmst; + } + + public long getId_reparto() { + return this.id_reparto; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getLastUpdId_user() { + return this.lastUpdId_user; + } + + public Timestamp getLastUpdTmst() { + return this.lastUpdTmst; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Rivalutazione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Rivalutazione.java new file mode 100644 index 00000000..ba2095c1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Rivalutazione.java @@ -0,0 +1,139 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Rivalutazione extends _ArtAdapter implements Serializable { + private long id_rivalutazione; + + private Date dataRivalutazione; + + private double imponibileRivalutazione; + + private long id_articolo; + + private Articolo articolo; + + public Rivalutazione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Rivalutazione() {} + + public void setId_rivalutazione(long newId_rivalutazione) { + this.id_rivalutazione = newId_rivalutazione; + } + + public void setDataRivalutazione(Date newDataRivalutazione) { + this.dataRivalutazione = newDataRivalutazione; + } + + public void setImponibileRivalutazione(double newImponibile) { + this.imponibileRivalutazione = newImponibile; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public long getId_rivalutazione() { + return this.id_rivalutazione; + } + + public Date getDataRivalutazione() { + return this.dataRivalutazione; + } + + public double getImponibileRivalutazione() { + return this.imponibileRivalutazione; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + getId_articolo()); + return this.articolo; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(RivalutazioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIVALUTAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findById_articolo(long l_id_articolo, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIVALUTAZIONE AS A"; + String s_Sql_Order = " order by A.dataRivalutazione desc"; + WcString wc = new WcString(); + wc.addWc("id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm save() { + ResParm rp = super.save(); + if (rp.getStatus()) + rp.append(getArticolo().aggiornaCostoRivalutazione( + getRivalutazioneUltimoById_articolo(getId_articolo()) + .getImponibileRivalutazione())); + return rp; + } + + public Rivalutazione getRivalutazioneUltimoById_articolo(long l_id_articolo) { + String s_Sql_Find = "select A.* from RIVALUTAZIONE AS A"; + String s_Sql_Order = " order by A.dataRivalutazione desc"; + WcString wc = new WcString(); + wc.addWc("id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return (Rivalutazione)getFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + return new Rivalutazione(getApFull()); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/RivalutazioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/RivalutazioneCR.java new file mode 100644 index 00000000..afa78756 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/RivalutazioneCR.java @@ -0,0 +1,67 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class RivalutazioneCR extends CRAdapter { + private long id_rivalutazione; + + private Date dataRivalutazione; + + private double imponibileRivalutazione; + + private long id_articolo; + + private Articolo articolo; + + public RivalutazioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RivalutazioneCR() {} + + public void setId_rivalutazione(long newId_rivalutazione) { + this.id_rivalutazione = newId_rivalutazione; + } + + public void setDataRivalutazione(Date newDataRivalutazione) { + this.dataRivalutazione = newDataRivalutazione; + } + + public void setImponibileRivalutazione(double newImponibile) { + this.imponibileRivalutazione = newImponibile; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public long getId_rivalutazione() { + return this.id_rivalutazione; + } + + public Date getDataRivalutazione() { + return this.dataRivalutazione; + } + + public double getImponibileRivalutazione() { + return this.imponibileRivalutazione; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + + getId_articolo()); + return this.articolo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/StatoUsato.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/StatoUsato.java new file mode 100644 index 00000000..e93b7681 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/StatoUsato.java @@ -0,0 +1,206 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class StatoUsato extends DBAdapter implements Serializable { + private static final String GARANZIA = "garanzia"; + + private static final String DESCRIZIONE_WWW = "descrizioneWww"; + + private static final long serialVersionUID = 1620541224365L; + + public static final long LIVELLO_USATO_NUOVO = 0L; + + public static final long LIVELLO_USATO_NUOVO_APERTO = 1L; + + public static final long LIVELLO_USATO_DEMO = 2L; + + public static final long LIVELLO_USATO_RICONDIZIONATO_VENDOR = 3L; + + public static final long LIVELLO_USATO_RICONDIZIONATO_OTTIMO = 4L; + + public static final long LIVELLO_USATO_RICONDIZIONATO_BUONO = 5L; + + public static final long LIVELLO_USATO_RICONDIZIONATO_TESTATO = 6L; + + private long flgLivello; + + private String sigla; + + private long id_statoUsato; + + public StatoUsato(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public StatoUsato() {} + + public static final String getLivello(long l_livello) { + switch ((int)l_livello) { + case 0: + return "Nuovo"; + case 1: + return "Nuovo Aperto"; + case 2: + return "Demo"; + case 3: + return "Ricondizionato dal vendor"; + case 4: + return "Ricondizionato Ottimo"; + case 5: + return "Ricondizionato Buono"; + case 6: + return "Ricondizionato Testato"; + } + return "??"; + } + + public static final String getEbayCondition(long l_livello) { + switch ((int)l_livello) { + case 0: + return "NEW"; + case 1: + return "NEW_OTHER"; + case 2: + return "SELLER_REFURBISHED"; + case 3: + return "CERTIFIED_REFURBISHED"; + case 4: + return "SELLER_REFURBISHED"; + case 5: + return "SELLER_REFURBISHED"; + case 6: + return "SELLER_REFURBISHED"; + } + return "??"; + } + + public String getLivello() { + return getLivello(getFlgLivello()); + } + + public String getEbayCondition() { + return getEbayCondition(getFlgLivello()); + } + + public void setId_statoUsato(long newId_statoUsato) { + this.id_statoUsato = newId_statoUsato; + } + + public void setSigla(String newSigla) { + this.sigla = newSigla; + } + + public long getId_statoUsato() { + return this.id_statoUsato; + } + + public String getSigla() { + return (this.sigla == null) ? "" : this.sigla.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(StatoUsatoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from STATO_USATO AS A"; + String s_Sql_Order = " order by A.sigla"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getGaranzia(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("garanzia", lang); + } + + public String getDescrizioneWww(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizioneWww", lang); + } + + public boolean useDescLangTables() { + return true; + } + + public String getDescrizioneCompleta() { + return getSigla() + " " + getSigla(); + } + + public void findBySigla(String l_sigla) { + String s_Sql_Find = "select A.* from STATO_USATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.sigla='" + l_sigla + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public long getFlgLivello() { + return this.flgLivello; + } + + public boolean isNuovo() { + return (getFlgLivello() == 0L); + } + + public boolean isUsato() { + return !isNuovo(); + } + + public void setFlgLivello(long flgNuovo) { + this.flgLivello = flgNuovo; + } + + public Vectumerator findSoloUsato() { + String s_Sql_Find = "select A.* from STATO_USATO AS A"; + String s_Sql_Order = " order by A.sigla"; + WcString wc = new WcString(); + wc.addWc("A.flgLivello>0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/StatoUsatoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/StatoUsatoCR.java new file mode 100644 index 00000000..39a1c99d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/StatoUsatoCR.java @@ -0,0 +1,32 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class StatoUsatoCR extends CRAdapter { + private long id_statoUsato; + + private String sigla; + + public StatoUsatoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public StatoUsatoCR() {} + + public void setId_statoUsato(long newId_statoUsato) { + this.id_statoUsato = newId_statoUsato; + } + + public void setSigla(String newSigla) { + this.sigla = newSigla; + } + + public long getId_statoUsato() { + return this.id_statoUsato; + } + + public String getSigla() { + return (this.sigla == null) ? "" : this.sigla.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TabellaTaglia.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TabellaTaglia.java new file mode 100644 index 00000000..bbd3764c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TabellaTaglia.java @@ -0,0 +1,419 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TabellaTaglia extends _ArtAdapter implements Serializable { + private long id_tabellaTaglia; + + private long id_tipoTaglia; + + private String descrizione_it; + + private String descrizioneImg_it; + + private String descrizioneImg_en; + + private String descrizione_en; + + private long flgAltezzaCavallo; + + private long flgColloCm; + + private long flgColloPoll; + + private long flgGiroCoscia; + + private long flgLarghezzaFondoCm; + + private long flgLunghezzaGamba; + + private long flgLunghezzaTotale; + + private long flgLunghezzaManica; + + private long flgVitaCmTeso; + + private long flgSpalleCm; + + private long flgVitaCmNoTeso; + + private long flgTagliaCollo; + + private long flgTagliaLettere; + + private long flgTagliaNum; + + private long flgToraceCm; + + private long flgVitaCm; + + private TipoTaglia tipoTaglia; + + private String imgTmst; + + public TabellaTaglia(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TabellaTaglia() {} + + public static final String getAltezzaCavallo() { + return "Altezza Cavallo"; + } + + public static final String getColloCm() { + return "Collo in cm"; + } + + public static final String getColloPoll() { + return "Collo in pollici"; + } + + public static final String getGiroCoscia() { + return "Giro Coscia"; + } + + public static final String getLarghezzaFondoCm() { + return "Larghezza Fondo in cm"; + } + + public static final String getLunghezzaGamba() { + return "Lunghezza Gamba"; + } + + public static final String getSpalleCm() { + return "Spalle in cm"; + } + + public static final String getTagliaCollo() { + return "Taglia collo"; + } + + public static final String getTagliaLettere() { + return "Taglia"; + } + + public static final String getTagliaNum() { + return "Taglia"; + } + + public static final String getToraceCm() { + return "Torace in cm"; + } + + public static final String getVitaCm() { + return "Via in cm"; + } + + public void setId_tabellaTaglia(long newId_tabellaTaglia) { + this.id_tabellaTaglia = newId_tabellaTaglia; + } + + public void setId_tipoTaglia(long newId_tipoTaglia) { + this.id_tipoTaglia = newId_tipoTaglia; + setTipoTaglia(null); + } + + public void setDescrizione_it(String newDescrizione) { + this.descrizione_it = newDescrizione; + } + + public void setFlgAltezzaCavallo(long newFlgAltezzaCavallo) { + this.flgAltezzaCavallo = newFlgAltezzaCavallo; + } + + public void setFlgColloCm(long newFlgColloCm) { + this.flgColloCm = newFlgColloCm; + } + + public void setFlgColloPoll(long newFlgColloPoll) { + this.flgColloPoll = newFlgColloPoll; + } + + public void setFlgGiroCoscia(long newFlgGiroCoscia) { + this.flgGiroCoscia = newFlgGiroCoscia; + } + + public void setFlgLarghezzaFondoCm(long newFlgLarghezzaFondoCm) { + this.flgLarghezzaFondoCm = newFlgLarghezzaFondoCm; + } + + public void setFlgLunghezzaGamba(long newFlgLunghezzaGamba) { + this.flgLunghezzaGamba = newFlgLunghezzaGamba; + } + + public void setFlgSpalleCm(long newFlgSpalleCm) { + this.flgSpalleCm = newFlgSpalleCm; + } + + public void setFlgTagliaCollo(long newFlgTagliaCollo) { + this.flgTagliaCollo = newFlgTagliaCollo; + } + + public void setFlgTagliaLettere(long newFlgTagliaLettere) { + this.flgTagliaLettere = newFlgTagliaLettere; + } + + public void setFlgTagliaNum(long newFlgTagliaNum) { + this.flgTagliaNum = newFlgTagliaNum; + } + + public void setFlgToraceCm(long newFlgToraceCm) { + this.flgToraceCm = newFlgToraceCm; + } + + public void setFlgVitaCm(long newFlgVitaCm) { + this.flgVitaCm = newFlgVitaCm; + } + + public long getId_tabellaTaglia() { + return this.id_tabellaTaglia; + } + + public long getId_tipoTaglia() { + return this.id_tipoTaglia; + } + + public String getDescrizione_it() { + return (this.descrizione_it == null) ? "" : + this.descrizione_it.trim(); + } + + public String getDescrizioneArticoli(String lang) { + if (getDBState() == 1) { + StringBuffer temp = new StringBuffer(); + Vectumerator vec = getArticoli(); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + temp.append(row.getDescrizione(lang)); + if (vec.hasMoreElements()) + temp.append(", "); + } + return temp.toString(); + } + return ""; + } + + public long getFlgAltezzaCavallo() { + return this.flgAltezzaCavallo; + } + + public long getFlgColloCm() { + return this.flgColloCm; + } + + public long getFlgColloPoll() { + return this.flgColloPoll; + } + + public long getFlgGiroCoscia() { + return this.flgGiroCoscia; + } + + public long getNumCol() { + long n = getFlgAltezzaCavallo() + getFlgColloCm() + getFlgColloPoll() + + getFlgGiroCoscia() + getFlgLarghezzaFondoCm() + + getFlgLunghezzaGamba() + getFlgLunghezzaTotale() + + getFlgSpalleCm() + getFlgSpalleCm() + getFlgTagliaCollo() + + getFlgTagliaLettere() + getFlgTagliaNum() + getFlgToraceCm() + + getFlgVitaCm() + getFlgLunghezzaManica() + getFlgVitaCmTeso() + getFlgVitaCmNoTeso(); + return n; + } + + public long getFlgLarghezzaFondoCm() { + return this.flgLarghezzaFondoCm; + } + + public long getFlgLunghezzaGamba() { + return this.flgLunghezzaGamba; + } + + public long getFlgSpalleCm() { + return this.flgSpalleCm; + } + + public long getFlgTagliaCollo() { + return this.flgTagliaCollo; + } + + public long getFlgTagliaLettere() { + return this.flgTagliaLettere; + } + + public long getFlgTagliaNum() { + return this.flgTagliaNum; + } + + public long getFlgToraceCm() { + return this.flgToraceCm; + } + + public long getFlgVitaCm() { + return this.flgVitaCm; + } + + public void setTipoTaglia(TipoTaglia newTipoTaglia) { + this.tipoTaglia = newTipoTaglia; + } + + public TipoTaglia getTipoTaglia() { + this.tipoTaglia = (TipoTaglia)getSecondaryObject(this.tipoTaglia, TipoTaglia.class, + getId_tipoTaglia()); + return this.tipoTaglia; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TabellaTagliaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TABELLA_TAGLIA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgLunghezzaTotale() { + return this.flgLunghezzaTotale; + } + + public void setFlgLunghezzaTotale(long flgLunghezzaTotale) { + this.flgLunghezzaTotale = flgLunghezzaTotale; + } + + public ResParm delTagliaMisure(TagliaMisure row) { + TagliaMisure bean = new TagliaMisure(getApFull()); + bean.findByPrimaryKey(row.getId_tagliaMisure()); + return bean.delete(); + } + + public Vectumerator getTagliaMisure() { + return new TagliaMisure(getApFull()).findById_tabellaTaglia( + getId_tabellaTaglia(), 0, 0); + } + + public Vectumerator getArticoli() { + return new Articolo(getApFull()).findById_tabellaTaglia( + getId_tabellaTaglia(), 0, 0); + } + + public ResParm addTagliaMisure(TagliaMisure row) { + TagliaMisure bean = new TagliaMisure(getApFull()); + if (row.getId_tagliaMisure() != 0L) + bean.findByPrimaryKey(row.getId_tagliaMisure()); + row.setDBState(bean.getDBState()); + ResParm rp = row.save(); + return rp; + } + + public String getDescrizione_en() { + return (this.descrizione_en == null) ? "" : this.descrizione_en.trim(); + } + + public void setDescrizione_en(String descrizione_en) { + this.descrizione_en = descrizione_en; + } + + public String getDescrizione(String lang) { + return getLangField("descrizione", lang); + } + + public String getDescrizioneImg(String lang) { + return getLangField("descrizioneImg", lang); + } + + public String getImgTmst() { + return (this.imgTmst == null) ? "" : this.imgTmst; + } + + public void setImgTmst(String imgTmst) { + this.imgTmst = imgTmst; + } + + public String getImgFileName(int imgNumber) { + return getImgFileName(imgNumber, getImgTmst()); + } + + public String getImgFileName(int imgNumber, String oldTmst) { + return "" + getId_tabellaTaglia() + "_" + getId_tabellaTaglia() + "_" + oldTmst + ".gif"; + } + + public String getPathImgTabellaTaglia() { + return getParm("PATH_IMG_TAB_TAG").getTesto(); + } + + public String getDescrizioneImg_it() { + return (this.descrizioneImg_it == null) ? "" : + this.descrizioneImg_it.trim(); + } + + public void setDescrizioneImg_it(String descrizioneImg_it) { + this.descrizioneImg_it = descrizioneImg_it; + } + + public String getDescrizioneImg_en() { + return (this.descrizioneImg_en == null) ? "" : + this.descrizioneImg_en.trim(); + } + + public void setDescrizioneImg_en(String descrizioneImg_en) { + this.descrizioneImg_en = descrizioneImg_en; + } + + public String getDescrizioneImg_enScript() { + return DBAdapter.prepareScriptString(getDescrizioneImg_en(), true, false); + } + + public String getDescrizioneImg_itScript() { + return DBAdapter.prepareScriptString(getDescrizioneImg_it(), true, false); + } + + public long getFlgLunghezzaManica() { + return this.flgLunghezzaManica; + } + + public void setFlgLunghezzaManica(long flgLunghezzaManica) { + this.flgLunghezzaManica = flgLunghezzaManica; + } + + public long getFlgVitaCmTeso() { + return this.flgVitaCmTeso; + } + + public void setFlgVitaCmTeso(long flgVitaCmTeso) { + this.flgVitaCmTeso = flgVitaCmTeso; + } + + public long getFlgVitaCmNoTeso() { + return this.flgVitaCmNoTeso; + } + + public void setFlgVitaCmNoTeso(long flgVitaCmNoTeso) { + this.flgVitaCmNoTeso = flgVitaCmNoTeso; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TabellaTagliaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TabellaTagliaCR.java new file mode 100644 index 00000000..7cf43a14 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TabellaTagliaCR.java @@ -0,0 +1,56 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TabellaTagliaCR extends CRAdapter { + private long id_tabellaTaglia; + + private long id_tipoTaglia; + + private String descrizione; + + private TipoTaglia tipoTaglia; + + public TabellaTagliaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TabellaTagliaCR() {} + + public void setId_tabellaTaglia(long newId_tabellaTaglia) { + this.id_tabellaTaglia = newId_tabellaTaglia; + } + + public void setId_tipoTaglia(long newId_tipoTaglia) { + this.id_tipoTaglia = newId_tipoTaglia; + setTipoTaglia(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tabellaTaglia() { + return this.id_tabellaTaglia; + } + + public long getId_tipoTaglia() { + return this.id_tipoTaglia; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public void setTipoTaglia(TipoTaglia newTipoTaglia) { + this.tipoTaglia = newTipoTaglia; + } + + public TipoTaglia getTipoTaglia() { + this.tipoTaglia = (TipoTaglia)getSecondaryObject(this.tipoTaglia, TipoTaglia.class, + + getId_tipoTaglia()); + return this.tipoTaglia; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Taglia.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Taglia.java new file mode 100644 index 00000000..708f110f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Taglia.java @@ -0,0 +1,256 @@ +package it.acxent.art; + +import it.acxent.common.DescTxtLang; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Taglia extends _ArtAdapter implements Serializable { + private long id_taglia; + + private long id_tipoTaglia; + + private String codice; + + private TipoTaglia tipoTaglia; + + private long ordine; + + public void setId_tipoTaglia(long newId_tipoTaglia) { + this.id_tipoTaglia = newId_tipoTaglia; + setTipoTaglia(null); + } + + public void setTipoTaglia(TipoTaglia newTipoTaglia) { + this.tipoTaglia = newTipoTaglia; + } + + public TipoTaglia getTipoTaglia() { + this.tipoTaglia = (TipoTaglia)getSecondaryObject(this.tipoTaglia, TipoTaglia.class, getId_tipoTaglia()); + return this.tipoTaglia; + } + + public void setCodice(String newCodice) { + this.codice = newCodice; + } + + public Taglia(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Taglia() {} + + public long getId_taglia() { + return this.id_taglia; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TagliaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TAGLIA AS A, TIPO_TAGLIA AS B"; + String s_Sql_Order = " order by B.descrizione, A.ordine"; + WcString wc = new WcString(); + wc.addWc("A.id_tipoTaglia=B.id_tipoTaglia"); + if (CR.getId_tipoTagliaS() != 0L) + wc.addWc("A.id_tipoTaglia=" + CR.getId_tipoTagliaS()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByTipoTaglia(long l_id_tipoTaglia) { + String s_Sql_Find = "select A.* from TAGLIA AS A"; + String s_Sql_Order = " order by A.ordine"; + WcString wc = new WcString(); + wc.addWc("A.id_tipoTaglia=" + l_id_tipoTaglia); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByTipoGammaCodice(long l_id_tipoTaglia, long l_id_gammaTaglia, String l_codice) { + String s_Sql_Find = "select A.* from TAGLIA AS A"; + String s_Sql_Order = " order by A.id_gammaTaglia, A.id_tipoTaglia, A.ordine, A.codice"; + WcString wc = new WcString(); + wc.addWc("A.id_tipoTaglia=" + l_id_tipoTaglia); + wc.addWc("A.id_gammaTaglia=" + l_id_gammaTaglia); + if (!l_codice.isEmpty()) + wc.addWc("A.codice='" + l_codice + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByTipoTagliaTaglia1(String l_tipoTaglia, String l_taglia) { + String s_Sql_Find = "select A.* from TAGLIA AS A, TIPO_TAGLIA AS B"; + String s_Sql_Order = " order by A.codice"; + WcString wc = new WcString(); + wc.addWc("A.id_tipoTaglia=B.id_tipoTaglia"); + wc.addWc("A.codice='" + l_taglia + "'"); + wc.addWc("B.codice='" + l_tipoTaglia + "'"); + wc.addWc("A.id_gammaTaglia=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getCodice() { + return (this.codice == null) ? "" : this.codice; + } + + public long getId_tipoTaglia() { + return this.id_tipoTaglia; + } + + public void setId_taglia(long id_taglia) { + this.id_taglia = id_taglia; + } + + public Vectumerator findById_articolo(long l_id_articolo, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TAGLIA AS A INNER JOIN ARTICOLO_TAGLIA AS B ON A.id_taglia=B.id_taglia "; + String s_Sql_Order = " ORDER BY A.ordine "; + WcString wc = new WcString(); + wc.addWc("B.id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getOrdine() { + return this.ordine; + } + + public void setOrdine(long ordine) { + this.ordine = ordine; + } + + private long calcolaOrdine() { + try { + String s_sqlFind = "select max(ordine) as _max from TAGLIA WHERE id_tipoTaglia=" + getId_tipoTaglia() + " and id_taglia!=" + + getId_taglia(); + PreparedStatement ps = getConn().prepareStatement(s_sqlFind); + long res = (long)getMax(ps, false) + 1L; + long decine = res / 10L; + return (decine + 1L) * 10L; + } catch (Exception e) { + handleDebug(e); + return 0L; + } + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + if (getOrdine() == 0L) + setOrdine(calcolaOrdine()); + super.prepareSave(ps); + } + + public String getDescrizioneByTagliaLingua(long l_id_taglia, String lang) { + DescTxtLang dtl = new DescTxtLang(getApFull()); + dtl.findByIdtabellaLangTabellaCampo(l_id_taglia, lang, "TAGLIA", "descrizione"); + return dtl.getDescrizione(); + } + + public boolean useDescLangTables() { + return true; + } + + public ResParm spostaSu() { + ResParm rp = new ResParm(); + if (getDBState() == 1) { + try { + long ordineBean = getOrdine(); + String s_sqlFind = "select A.* from TAGLIA as A WHERE id_tipoTaglia=" + getId_tipoTaglia() + " and A.ordine< " + ordineBean + " order by A.ordine desc"; + PreparedStatement ps = getConn().prepareStatement(s_sqlFind); + Vectumerator vec = findRows(ps); + if (vec.hasMoreElements()) { + Taglia tg = (Taglia)vec.nextElement(); + long ordineTG = tg.getOrdine(); + tg.setOrdine(-ordineBean); + rp = tg.save(); + if (rp.getStatus()) { + setOrdine(ordineTG); + rp = save(); + if (rp.getStatus()) { + tg.setOrdine(ordineBean); + rp = tg.save(); + } + } + } else { + rp.setStatus(true); + rp.setMsg("Raggiunto valore minimo!"); + } + } catch (Exception e) { + handleDebug(e); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore!. Oggetto tagliaMisure non salvato"); + } + return rp; + } + + public ResParm spostaGiu() { + ResParm rp = new ResParm(); + if (getDBState() == 1) { + try { + long ordineBean = getOrdine(); + String s_sqlFind = "select A.* from TAGLIA as A WHERE id_tipoTaglia=" + getId_tipoTaglia() + " and A.ordine>" + ordineBean + " order by A.ordine asc"; + PreparedStatement ps = getConn().prepareStatement(s_sqlFind); + Vectumerator vec = findRows(ps); + if (vec.hasMoreElements()) { + Taglia tg = (Taglia)vec.nextElement(); + long ordineTG = tg.getOrdine(); + tg.setOrdine(-ordineBean); + rp = tg.save(); + if (rp.getStatus()) { + setOrdine(ordineTG); + rp = save(); + if (rp.getStatus()) { + tg.setOrdine(ordineBean); + rp = tg.save(); + } + } + } else { + rp.setStatus(true); + rp.setMsg("Raggiunto valore massimo!"); + } + } catch (Exception e) { + handleDebug(e); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore!. Oggetto tagliaMisure non salvato"); + } + return rp; + } + + public Vectumerator findTaglieByTipoTaglia(long l_id_tipoTaglia) { + return findByTipoTaglia(l_id_tipoTaglia); + } + + public String getDescrizione() { + return getCodice(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TagliaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TagliaCR.java new file mode 100644 index 00000000..429bb446 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TagliaCR.java @@ -0,0 +1,52 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TagliaCR extends CRAdapter { + private String descrizione_it; + + private String descrizione_en; + + private long id_tipoTagliaS; + + private String id_taglia; + + public TagliaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TagliaCR() {} + + public void setId_taglia(String newId_taglia) { + this.id_taglia = newId_taglia; + } + + public void setDescrizione_it(String newDescrizione_it) { + this.descrizione_it = newDescrizione_it; + } + + public void setDescrizione_en(String newDescrizione_en) { + this.descrizione_en = newDescrizione_en; + } + + public String getId_taglia() { + return (this.id_taglia == null) ? "" : this.id_taglia; + } + + public String getDescrizione_it() { + return (this.descrizione_it == null) ? "" : this.descrizione_it; + } + + public String getDescrizione_en() { + return (this.descrizione_en == null) ? "" : this.descrizione_en; + } + + public long getId_tipoTagliaS() { + return this.id_tipoTagliaS; + } + + public void setId_tipoTagliaS(long id_tipoTagliaS) { + this.id_tipoTagliaS = id_tipoTagliaS; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TagliaMisure.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TagliaMisure.java new file mode 100644 index 00000000..332507f5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TagliaMisure.java @@ -0,0 +1,351 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TagliaMisure extends _ArtAdapter implements Serializable { + private long id_tagliaMisure; + + private long id_tabellaTaglia; + + private long ordine; + + private String tagliaLettere; + + private String tagliaNum; + + private String tagliaCollo; + + private String colloCm; + + private String vitaCmTeso; + + private String colloPoll; + + private String vitaCmNoTeso; + + private String lunghezzaManica; + + private String vitaCm; + + private String toraceCm; + + private String lunghezzaTotale; + + private String altezzaCavallo; + + private String giroCoscia; + + private String larghezzaFondoCm; + + private String lunghezzaGamba; + + private String spalleCm; + + private TabellaTaglia tabellaTaglia; + + public TagliaMisure(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TagliaMisure() {} + + public void setId_tagliaMisure(long newId_tagliaMisure) { + this.id_tagliaMisure = newId_tagliaMisure; + } + + public void setId_tabellaTaglia(long newId_tabellaTaglia) { + this.id_tabellaTaglia = newId_tabellaTaglia; + setTabellaTaglia(null); + } + + public void setOrdine(long newOrdine) { + this.ordine = newOrdine; + } + + public void setTagliaLettere(String newTagliaLettere) { + this.tagliaLettere = newTagliaLettere; + } + + public void setTagliaNum(String newTagliaNum) { + this.tagliaNum = newTagliaNum; + } + + public void setTagliaCollo(String newTagliaCollo) { + this.tagliaCollo = newTagliaCollo; + } + + public void setColloCm(String newColloCm) { + this.colloCm = newColloCm; + } + + public void setColloPoll(String newColloPoll) { + this.colloPoll = newColloPoll; + } + + public void setVitaCm(String newVitaCm) { + this.vitaCm = newVitaCm; + } + + public void setToraceCm(String newToraceCm) { + this.toraceCm = newToraceCm; + } + + public void setLunghezzaTotale(String newLunghezzatotale) { + this.lunghezzaTotale = newLunghezzatotale; + } + + public void setAltezzaCavallo(String newAltezzaCavallo) { + this.altezzaCavallo = newAltezzaCavallo; + } + + public void setGiroCoscia(String newGiroCoscia) { + this.giroCoscia = newGiroCoscia; + } + + public void setLarghezzaFondoCm(String newLarghezzaFondoCm) { + this.larghezzaFondoCm = newLarghezzaFondoCm; + } + + public void setLunghezzaGamba(String newLunghezzaGamba) { + this.lunghezzaGamba = newLunghezzaGamba; + } + + public void setSpalleCm(String newSpalleCm) { + this.spalleCm = newSpalleCm; + } + + public long getId_tagliaMisure() { + return this.id_tagliaMisure; + } + + public long getId_tabellaTaglia() { + return this.id_tabellaTaglia; + } + + public long getOrdine() { + return this.ordine; + } + + public String getTagliaLettere() { + return (this.tagliaLettere == null) ? "" : this.tagliaLettere.trim(); + } + + public String getTagliaNum() { + return (this.tagliaNum == null) ? "" : this.tagliaNum.trim(); + } + + public String getTagliaCollo() { + return (this.tagliaCollo == null) ? "" : this.tagliaCollo.trim(); + } + + public String getColloCm() { + return (this.colloCm == null) ? "" : this.colloCm.trim(); + } + + public String getColloPoll() { + return (this.colloPoll == null) ? "" : this.colloPoll.trim(); + } + + public String getVitaCm() { + return (this.vitaCm == null) ? "" : this.vitaCm.trim(); + } + + public String getToraceCm() { + return (this.toraceCm == null) ? "" : this.toraceCm.trim(); + } + + public String getLunghezzaTotale() { + return (this.lunghezzaTotale == null) ? "" : this.lunghezzaTotale.trim(); + } + + public String getAltezzaCavallo() { + return (this.altezzaCavallo == null) ? "" : this.altezzaCavallo.trim(); + } + + public String getGiroCoscia() { + return (this.giroCoscia == null) ? "" : this.giroCoscia.trim(); + } + + public String getLarghezzaFondoCm() { + return (this.larghezzaFondoCm == null) ? "" : this.larghezzaFondoCm.trim(); + } + + public String getLunghezzaGamba() { + return (this.lunghezzaGamba == null) ? "" : this.lunghezzaGamba.trim(); + } + + public String getSpalleCm() { + return (this.spalleCm == null) ? "" : this.spalleCm.trim(); + } + + public void setTabellaTaglia(TabellaTaglia newTabellaTaglia) { + this.tabellaTaglia = newTabellaTaglia; + } + + public TabellaTaglia getTabellaTaglia() { + this.tabellaTaglia = (TabellaTaglia)getSecondaryObject(this.tabellaTaglia, TabellaTaglia.class, getId_tabellaTaglia()); + return this.tabellaTaglia; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TagliaMisureCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TAGLIA_MISURE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findById_tabellaTaglia(long l_id, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TAGLIA_MISURE AS A"; + String s_Sql_Order = " order by A.ordine"; + WcString wc = new WcString(); + wc.addWc("A.id_tabellaTaglia=" + l_id); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + if (getOrdine() == 0L) + setOrdine(calcolaOrdine()); + super.prepareSave(ps); + } + + private long calcolaOrdine() { + try { + String s_sqlFind = "select max(ordine) as _max from TAGLIA_MISURE WHERE id_tabellaTaglia=" + getId_tabellaTaglia() + " and id_tagliaMisure!=" + + getId_tagliaMisure(); + PreparedStatement ps = getConn().prepareStatement(s_sqlFind); + long res = (long)getMax(ps, true) + 1L; + long decine = res / 10L; + return (decine + 1L) * 10L; + } catch (Exception e) { + handleDebug(e); + return 0L; + } + } + + public ResParm spostaSu() { + ResParm rp = new ResParm(); + if (getDBState() == 1) { + try { + long ordineBean = getOrdine(); + String s_sqlFind = "select A.* from TAGLIA_MISURE as A WHERE id_tabellaTaglia=" + getId_tabellaTaglia() + " and A.ordine<" + ordineBean + " order by A.ordine desc"; + PreparedStatement ps = getConn().prepareStatement(s_sqlFind); + Vectumerator vec = findRows(ps); + if (vec.hasMoreElements()) { + TagliaMisure tm = (TagliaMisure)vec.nextElement(); + long ordineTM = tm.getOrdine(); + tm.setOrdine(-ordineBean); + rp = tm.save(); + if (rp.getStatus()) { + setOrdine(ordineTM); + rp = save(); + if (rp.getStatus()) { + tm.setOrdine(ordineBean); + rp = tm.save(); + } + } + } else { + rp.setStatus(true); + rp.setMsg("Raggiunto valore minimo!"); + } + } catch (Exception e) { + handleDebug(e); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore!. Oggetto tagliaMisure non salvato"); + } + return rp; + } + + public ResParm spostaGiu() { + ResParm rp = new ResParm(); + if (getDBState() == 1) { + try { + long ordineBean = getOrdine(); + String s_sqlFind = "select A.* from TAGLIA_MISURE as A WHERE id_tabellaTaglia=" + getId_tabellaTaglia() + " and A.ordine>" + ordineBean + " order by A.ordine asc"; + PreparedStatement ps = getConn().prepareStatement(s_sqlFind); + Vectumerator vec = findRows(ps); + if (vec.hasMoreElements()) { + TagliaMisure tm = (TagliaMisure)vec.nextElement(); + long ordineTM = tm.getOrdine(); + tm.setOrdine(-ordineBean); + rp = tm.save(); + if (rp.getStatus()) { + setOrdine(ordineTM); + rp = save(); + if (rp.getStatus()) { + tm.setOrdine(ordineBean); + rp = tm.save(); + } + } + } else { + rp.setStatus(true); + rp.setMsg("Raggiunto valore massimo!"); + } + } catch (Exception e) { + handleDebug(e); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore!. Oggetto tagliaMisure non salvato"); + } + return rp; + } + + public String getVitaCmTeso() { + return (this.vitaCmTeso == null) ? "" : this.vitaCmTeso.trim(); + } + + public void setVitaCmTeso(String vitaCmTeso) { + this.vitaCmTeso = vitaCmTeso; + } + + public String getVitaCmNoTeso() { + return (this.vitaCmNoTeso == null) ? "" : this.vitaCmNoTeso.trim(); + } + + public void setVitaCmNoTeso(String vitaCmNoTeso) { + this.vitaCmNoTeso = vitaCmNoTeso; + } + + public String getLunghezzaManica() { + return (this.lunghezzaManica == null) ? "" : this.lunghezzaManica.trim(); + } + + public void setLunghezzaManica(String lunghezzaManica) { + this.lunghezzaManica = lunghezzaManica; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TagliaMisureCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TagliaMisureCR.java new file mode 100644 index 00000000..433a9031 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TagliaMisureCR.java @@ -0,0 +1,186 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TagliaMisureCR extends CRAdapter { + private long id_tagliaMisure; + + private long id_tabellaTaglia; + + private long ordine; + + private String tagliaLettere; + + private String tagliaNum; + + private String tagliaCollo; + + private String colloCm; + + private String colloPoll; + + private String vitaCm; + + private String toraceCm; + + private String lunghezzatotale; + + private String altezzaCavallo; + + private String giroCoscia; + + private String larghezzaFondoCm; + + private String lunghezzaGamba; + + private String spalleCm; + + private TabellaTaglia tabellaTaglia; + + public TagliaMisureCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TagliaMisureCR() {} + + public void setId_tagliaMisure(long newId_tagliaMisure) { + this.id_tagliaMisure = newId_tagliaMisure; + } + + public void setId_tabellaTaglia(long newId_tabellaTaglia) { + this.id_tabellaTaglia = newId_tabellaTaglia; + setTabellaTaglia(null); + } + + public void setOrdine(long newOrdine) { + this.ordine = newOrdine; + } + + public void setTagliaLettere(String newTagliaLettere) { + this.tagliaLettere = newTagliaLettere; + } + + public void setTagliaNum(String newTagliaNum) { + this.tagliaNum = newTagliaNum; + } + + public void setTagliaCollo(String newTagliaCollo) { + this.tagliaCollo = newTagliaCollo; + } + + public void setColloCm(String newColloCm) { + this.colloCm = newColloCm; + } + + public void setColloPoll(String newColloPoll) { + this.colloPoll = newColloPoll; + } + + public void setVitaCm(String newVitaCm) { + this.vitaCm = newVitaCm; + } + + public void setToraceCm(String newToraceCm) { + this.toraceCm = newToraceCm; + } + + public void setLunghezzatotale(String newLunghezzatotale) { + this.lunghezzatotale = newLunghezzatotale; + } + + public void setAltezzaCavallo(String newAltezzaCavallo) { + this.altezzaCavallo = newAltezzaCavallo; + } + + public void setGiroCoscia(String newGiroCoscia) { + this.giroCoscia = newGiroCoscia; + } + + public void setLarghezzaFondoCm(String newLarghezzaFondoCm) { + this.larghezzaFondoCm = newLarghezzaFondoCm; + } + + public void setLunghezzaGamba(String newLunghezzaGamba) { + this.lunghezzaGamba = newLunghezzaGamba; + } + + public void setSpalleCm(String newSpalleCm) { + this.spalleCm = newSpalleCm; + } + + public long getId_tagliaMisure() { + return this.id_tagliaMisure; + } + + public long getId_tabellaTaglia() { + return this.id_tabellaTaglia; + } + + public long getOrdine() { + return this.ordine; + } + + public String getTagliaLettere() { + return (this.tagliaLettere == null) ? "" : this.tagliaLettere.trim(); + } + + public String getTagliaNum() { + return (this.tagliaNum == null) ? "" : this.tagliaNum.trim(); + } + + public String getTagliaCollo() { + return (this.tagliaCollo == null) ? "" : this.tagliaCollo.trim(); + } + + public String getColloCm() { + return (this.colloCm == null) ? "" : this.colloCm.trim(); + } + + public String getColloPoll() { + return (this.colloPoll == null) ? "" : this.colloPoll.trim(); + } + + public String getVitaCm() { + return (this.vitaCm == null) ? "" : this.vitaCm.trim(); + } + + public String getToraceCm() { + return (this.toraceCm == null) ? "" : this.toraceCm.trim(); + } + + public String getLunghezzatotale() { + return (this.lunghezzatotale == null) ? "" : this.lunghezzatotale.trim(); + } + + public String getAltezzaCavallo() { + return (this.altezzaCavallo == null) ? "" : this.altezzaCavallo.trim(); + } + + public String getGiroCoscia() { + return (this.giroCoscia == null) ? "" : this.giroCoscia.trim(); + } + + public String getLarghezzaFondoCm() { + return (this.larghezzaFondoCm == null) ? "" : this.larghezzaFondoCm.trim(); + } + + public String getLunghezzaGamba() { + return (this.lunghezzaGamba == null) ? "" : this.lunghezzaGamba.trim(); + } + + public String getSpalleCm() { + return (this.spalleCm == null) ? "" : this.spalleCm.trim(); + } + + public void setTabellaTaglia(TabellaTaglia newTabellaTaglia) { + this.tabellaTaglia = newTabellaTaglia; + } + + public TabellaTaglia getTabellaTaglia() { + this.tabellaTaglia = (TabellaTaglia)getSecondaryObject(this.tabellaTaglia, TabellaTaglia.class, + + getId_tabellaTaglia()); + return this.tabellaTaglia; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Tipo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Tipo.java new file mode 100644 index 00000000..65cb7120 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Tipo.java @@ -0,0 +1,2265 @@ +package it.acxent.art; + +import it.acxent.anag.Listino; +import it.acxent.anag.ListinoTipo; +import it.acxent.api.ebay.EbayAbliaApi; +import it.acxent.api.ebay.EbayResult; +import it.acxent.common.StatusMsg; +import it.acxent.common.TipoInterface; +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Timer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.Collection; +import java.util.Date; +import java.util.Locale; +import org.json.JSONObject; + +public class Tipo extends _ArtAdapter implements Serializable, TipoInterface, AddImgInterface { + private static final String META_DESC = "metaDesc"; + + public static final String TAG_H1 = "tagH1"; + + public static final String TAG_H2 = "tagH2"; + + private static final String META_DESC_TEMPLATE_LEAF = "metaDescTemplateLeaf"; + + private static final String DESC_SEO = "descrizioneSeo"; + + private static final String DESK_LINK = "descrizioneLink"; + + private static final String KEYWORD = "keyword"; + + private static final double EBAY_COMMISSIONE_DEF_ELETTRONICA_6_5 = 6.5D; + + private static final double AMAZON_COMMISSIONE_DEF_ELETTRONICA_7_21 = 7.21D; + + private static final long serialVersionUID = -6902356910190366776L; + + private long id_tipo; + + private long flgStampaEtichette; + + private long flgTipoMagazzino; + + private String flgEvidenziato; + + private static final String INDICE_DELIM = ":"; + + public static final long TO_DO_TYPE = 1L; + + public static final long TIPO_MAG_NO_EREDITATO = -1L; + + public static final long KIT_NO = 0L; + + public static final long KIT_PRIMARIO = 1L; + + public static final long KIT_SECONDARIO = 2L; + + public static final long KIT_DA_TIPO = -1L; + + public static final long TIPO_MAG_ND = 0L; + + public static final long TIPO_MAG_STD = 1L; + + public static final long TIPO_MAG_UNIVOCO = 2L; + + public static final long TIPO_MAG_LOTTO = 3L; + + public static final long TIPO_MAG_NO_MAG = 9L; + + public static final long USA_TAGLIA_NO_EREDITATO = -1L; + + public static final long USA_TAGLIA_ND = 0L; + + public static final long USA_TAGLIA_NO = 1L; + + public static final long USA_TAGLIA_SI = 2L; + + private String ebayCategoryId; + + private long ricaricoBase; + + private long id_tipoPadre; + + private long livello; + + private double ebayFissa; + + private double ebayCommissione; + + private String indici; + + private Tipo tipoPadre; + + private long percCostoSpedizioneDefault; + + private double amazonFissa; + + private double amazonCommissione; + + private double amazonSoglia; + + private double amazonCommissioneOltreSoglia; + + private long flgControlloCostiAggFor; + + private String trovaprezziCategoria; + + private long flgMainPage; + + private long flgIcecatNoAuto; + + private String sitemapFileProdotti; + + private long sitemapPriority; + + private long id_reparto; + + private String id_marche; + + private long id_googleCategory; + + private GoogleCategory googleCategory; + + private Reparto reparto; + + private long flgUsaVarianti; + + private long flgCaratteristiche; + + private long flgStampaAccessori; + + private long flgPresente = 0L; + + private long flgPresenteStock = 0L; + + private long flgPresenteOfferte = 0L; + + private long flgPresenteUsato = 0L; + + private long flgRC; + + private long ggEscludiArticoloWeb = 0L; + + private long flgEscludiWeb = 0L; + + private double costoSpedizione; + + private long flgNoListino = 0L; + + private String descrizioneAggiuntiva; + + private long flgMagNegativo; + + private long flgUsaTaglia = 0L; + + private long id_tipoTaglia = 0L; + + private TipoTaglia tipoTaglia; + + private long id_tipologiaArticolo; + + private TipologiaArticolo tipologiaArticolo; + + private String descrizioneR; + + private long flgComponenti; + + private long flgAccessori; + + private long flgAltreCompatibilita; + + private long flgRivalutazioni; + + private long flgFornitori; + + private long flgAllegati; + + private long flgFoglia; + + private long flgStampaBarcode; + + private long flgUsaVarianteColori; + + private long flgNoCart = 0L; + + private long flgKit; + + private String tag; + + private long ordineGlobale; + + private String descrizione; + + private String ebayCategoryDesc; + + private long id_listinoAmazon; + + private long id_listinoEbay; + + private Listino listinoAmazon; + + private Listino listinoEbay; + + class ThreadCalcolaIndici extends Thread { + private boolean isRicalcolaTag = false; + + private boolean isRicalcolaIndiciArticoli = false; + + private boolean isCalcolaOrdineGlobale = false; + + public ThreadCalcolaIndici(boolean tag, boolean articoli) { + this.isRicalcolaTag = tag; + this.isRicalcolaIndiciArticoli = articoli; + if (!Tipo.isThreadAttivo()) { + Tipo.threadCalcolaIndici = true; + start(); + } + } + + public void run() { + String TAG_THREAD_MSG = "INDICI LEGATI A TIPO "; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(Tipo.this.getApFull(), "INDICI LEGATI A TIPO ", "...inizio ..."); + if (this.isRicalcolaTag) { + StatusMsg.updateMsgByTag(Tipo.this.getApFull(), "INDICI LEGATI A TIPO ", "Ricalcolo tag su tipo ...."); + int numTipo = 0, numTipoTot = 0; + String SEP = ","; + Tipo tipo1 = new Tipo(Tipo.this.getApFull()); + TipoCR CR = new TipoCR(); + Articolo art = new Articolo(Tipo.this.getApFull()); + ArticoloCR CRArt = new ArticoloCR(); + Vectumerator vec = tipo1.findByCR(CR, 0, 0); + numTipoTot = vec.getTotNumberOfRecords(); + try { + while (vec.hasMoreElements()) { + Tipo rowTipo = (Tipo)vec.nextElement(); + numTipo++; + StatusMsg.updateMsgByTag(Tipo.this.getApFull(), "INDICI LEGATI A TIPO ", "" + numTipo + "/" + numTipo + " " + numTipoTot); + StringBuilder newTag = new StringBuilder(); + CRArt.setId_tipo(rowTipo.getId_tipo()); + CRArt.setFlgEscludiWeb(0L); + CRArt.setFlgNoleggio(0L); + CRArt.setFlgStockOfferte(1L); + Vectumerator vecArt = art.findByCR(CRArt, 1, 1); + if (vecArt.getTotNumberOfRecords() > 0) { + newTag.append(","); + newTag.append("OFFERTA"); + } + CRArt.setFlgStockOfferte(2L); + vecArt = art.findByCR(CRArt, 1, 1); + if (vecArt.getTotNumberOfRecords() > 0) { + newTag.append(","); + newTag.append("STOCK"); + } + CRArt.setFlgStockOfferte(3L); + vecArt = art.findByCR(CRArt, 1, 1); + if (vecArt.getTotNumberOfRecords() > 0) { + newTag.append(","); + newTag.append("USATO"); + } + CRArt.setFlgStockOfferte(4L); + vecArt = art.findByCR(CRArt, 1, 1); + if (vecArt.getTotNumberOfRecords() > 0) { + newTag.append(","); + newTag.append("NOVITA"); + } + CRArt.setFlgStockOfferte(0L); + CRArt.setFlgNoleggio(20L); + vecArt = art.findByCR(CRArt, 1, 1); + if (vecArt.getTotNumberOfRecords() > 0) { + newTag.append(","); + newTag.append("NOLEGGIO"); + } + CRArt.setFlgStockOfferte(0L); + CRArt.setFlgNoleggio(0L); + vecArt = art.findByCR(CRArt, 1, 1); + if (vecArt.getTotNumberOfRecords() > 0) { + rowTipo.setFlgEscludiWeb(0L); + } else { + rowTipo.setFlgEscludiWeb(1L); + System.out.println("Calcola indici tipo: " + rowTipo.getDescrizioneCompleta() + " non visibile!!"); + } + rowTipo.setTag(newTag.toString()); + rowTipo.setDescrizioneR(rowTipo.getDescrizioneCompletaFull()); + rowTipo.superSave(); + } + } catch (Exception e) { + StatusMsg.updateMsgByTag(Tipo.this.getApFull(), "INDICI LEGATI A TIPO ", "ERRORE!: " + e.toString()); + try { + sleep(10000L); + } catch (Exception exception) {} + } + } + if (this.isRicalcolaIndiciArticoli) { + StatusMsg.updateMsgByTag(Tipo.this.getApFull(), "INDICI LEGATI A TIPO ", "Aggiornamento valori flg su articoli ...."); + int numAgg = 0; + int numTipo = 0, numTipoTot = 0, numArt = 0, numArtTot = 0; + Tipo tipo1 = new Tipo(Tipo.this.getApFull()); + TipoCR CR = new TipoCR(); + CR.setFlgSoloFoglie(1L); + Vectumerator vec = tipo1.findByCR(CR, 0, 0); + Articolo art = new Articolo(Tipo.this.getApFull()); + ArticoloCR CRArt = new ArticoloCR(); + numTipoTot = vec.getTotNumberOfRecords(); + try { + while (vec.hasMoreElements()) { + Tipo rowTipo = (Tipo)vec.nextElement(); + numTipo++; + CRArt.setId_tipo(rowTipo.getId_tipo()); + Vectumerator vecArts = art.findByCR(CRArt, 0, 0); + numArtTot = vecArts.getTotNumberOfRecords(); + numArt = 0; + while (vecArts.hasMoreElements()) { + Articolo row = (Articolo)vecArts.nextElement(); + numAgg++; + numArt++; + StatusMsg.updateMsgByTag(Tipo.this.getApFull(), "INDICI LEGATI A TIPO ", "" + numTipo + "/" + numTipo + " " + numTipoTot + " " + rowTipo.getDescrizione() + "/" + numArt + " - ˙Articolo: " + numArtTot + " - " + + row.getNome()); + row.save(); + } + } + ListinoTipo lt = new ListinoTipo(Tipo.this.getApFull()); + Vectumerator vecLt = lt.findAll(); + while (vec.hasMoreElements()) { + ListinoTipo row = (ListinoTipo)vecLt.nextElement(); + numAgg++; + StatusMsg.updateMsgByTag(Tipo.this.getApFull(), "INDICI LEGATI A TIPO ", "Listino: " + row.getDescrizione() + " - " + numAgg); + row.save(); + } + numAgg++; + StatusMsg.updateMsgByTag(Tipo.this.getApFull(), "INDICI LEGATI A TIPO ", "Dispo per no magazzino - " + numAgg); + Tipo.this.aggiornaDispoPerNoMagazzino(); + } catch (Exception e) { + StatusMsg.updateMsgByTag(Tipo.this.getApFull(), "INDICI LEGATI A TIPO ", "ERRORE!: " + e.toString()); + try { + sleep(10000L); + } catch (Exception exception) {} + } + } + if (!this.isCalcolaOrdineGlobale); + StatusMsg.updateMsgByTag(Tipo.this.getApFull(), "INDICI LEGATI A TIPO ", "Calcola Ordine Globale Tipo ...."); + Tipo tipo = new Tipo(Tipo.this.getApFull()); + tipo.calcolaOrdineGlobale(0L); + timer.stop(); + Tipo.threadCalcolaIndici = false; + StatusMsg.updateMsgByTag(Tipo.this.getApFull(), "INDICI LEGATI A TIPO ", "Calcola Indici concluso. DURATA: " + timer.getDurataHourMin()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(Tipo.this.getApFull(), "INDICI LEGATI A TIPO "); + } + } + + public Tipo(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Tipo() {} + + public void setId_tipo(long newId_tipo) { + this.id_tipo = newId_tipo; + } + + public void setFlgEvidenziato(String newFlg_evidenziato) { + this.flgEvidenziato = newFlg_evidenziato; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setRicaricoBase(long newRicaricoBase) { + this.ricaricoBase = newRicaricoBase; + } + + public void setId_tipoPadre(long newId_tipoPadre) { + this.id_tipoPadre = newId_tipoPadre; + setTipoPadre(null); + } + + public void setLivello(long newLivello) { + this.livello = newLivello; + } + + public void setIndici(String newIndici) { + this.indici = newIndici; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public String getFlgEvidenziato() { + return (this.flgEvidenziato == null) ? "" : this.flgEvidenziato; + } + + private StringBuffer calcolaIndiciR() { + StringBuffer idx = new StringBuffer(String.valueOf(getId_tipo())); + if (getId_tipoPadre() != 0L) { + idx.insert(0, ":"); + idx.insert(0, (CharSequence)getTipoPadre().calcolaIndiciR()); + } + return idx; + } + + public boolean indiciContains(long l_key) { + StringTokenizer st = new StringTokenizer(getIndici(), ":"); + String s_key = String.valueOf(l_key); + while (st.hasMoreTokens()) { + if (st.nextToken().equals(s_key)) + return true; + } + return false; + } + + public String getDescrizione() { + String tmp = getDescrizione("it"); + if (tmp.isEmpty()) + return (this.descrizione == null) ? "" : this.descrizione; + return tmp; + } + + public String getDescrizioneBreve(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizioneBreve", lang); + } + + public String getDescrizione4Script() { + return prepareScriptString(getDescrizione()); + } + + public long getRicaricoBase() { + return this.ricaricoBase; + } + + public long getId_tipoPadre() { + return this.id_tipoPadre; + } + + public long getLivello() { + return this.livello; + } + + public String getIndici() { + return (this.indici == null) ? "" : this.indici; + } + + public void setTipoPadre(Tipo newTipo) { + this.tipoPadre = newTipo; + } + + public Tipo getTipoPadre() { + this.tipoPadre = (Tipo)getSecondaryObject(this.tipoPadre, Tipo.class, getId_tipoPadre()); + return this.tipoPadre; + } + + protected void deleteCascade() { + Vectumerator figli = findFigli(new TipoCR(), 0, 0, false); + while (figli.hasMoreElements()) + ((Tipo)figli.nextElement()).delete(); + } + + public Vectumerator findByCR(TipoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO AS A INNER JOIN TIPOLOGIA_ARTICOLO AS B ON A.id_tipologiaArticolo=B.id_tipologiaArticolo left join TIPO AS P ON P.id_tipo=A.id_tipoPadre"; + String s_Sql_Order = " order by A.indici, A.ordine, A.descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().replace("*", "%").trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%' or A.descrizioneR like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_tipoPadre() != 0L) + wc.addWc("A.id_tipoPadre=" + CR.getId_tipoPadre()); + if (!CR.getDescrizione().isEmpty()) + wc.addWc("A.descrizione='" + CR.getDescrizione() + "'"); + if (CR.getFlgNascondi() == 0L) { + wc.addWc("(A.flgNascondi=0 or A.flgNascondi is null)"); + } else if (CR.getFlgNascondi() == 1L) { + wc.addWc("A.flgNascondi=1"); + } + if (CR.getFlgMainPage() == 0L) { + wc.addWc("(A.flgMainPage=0 or A.flgMainPage is null)"); + } else if (CR.getFlgMainPage() == 1L) { + wc.addWc("A.flgMainPage=1"); + } + if (CR.getFlgAFT() == 30L) { + wc.addWc("(B.flgAFT=0 or B.flgAFT is null or B.flgAFT=3)"); + } else if (CR.getFlgAFT() == 0L) { + wc.addWc("(B.flgAFT=0 or B.flgAFT is null)"); + } else if (CR.getFlgAFT() > 0L) { + wc.addWc("B.flgAFT=" + CR.getFlgAFT()); + } + if (CR.getFlgSoloFoglie() == 0L) { + wc.addWc("(A.flgFoglia=0 or A.flgFoglia is null)"); + } else if (CR.getFlgSoloFoglie() == 1L) { + wc.addWc("A.flgFoglia=1"); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findFigli(TipoCR CR, int pageNumber, int pageRows, boolean ordineAlfabetico) { + String s_Sql_Find = "select A.* from TIPO AS A"; + String s_Sql_Order = " order by A.livello, A.ordine, A.descrizione"; + String s_Sql_limit = ""; + if (ordineAlfabetico) + s_Sql_Order = " A.descrizione"; + WcString wc = new WcString(); + if (getId_tipo() == 0L) { + wc.addWc("(A.id_tipoPadre=0 or A.id_tipoPadre is null)"); + } else { + wc.addWc("A.id_tipoPadre=" + getId_tipo()); + } + if (CR.getFlgNascondi() == 0L) { + wc.addWc("(A.flgNascondi=0 or A.flgNascondi is null)"); + } else if (CR.getFlgNascondi() == 1L) { + wc.addWc("A.flgNascondi=1"); + } + if (CR.getFlgEscludiWeb() == 0L) { + wc.addWc("(A.flgEscludiWeb=0 or A.flgEscludiWeb is null)"); + } else if (CR.getFlgEscludiWeb() == 1L) { + wc.addWc("A.flgEscludiWeb=1"); + } + if (CR.getFlgMainPage() == 1L) + wc.addWc("A.flgMainPage=1"); + if (!CR.getTag().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getTag(), ","); + StringBuilder sbTag = new StringBuilder("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + sbTag.append("A.tag like'%,"); + sbTag.append(token); + sbTag.append(",%'"); + if (st.hasMoreTokens()) + sbTag.append(" or "); + } + sbTag.append(")"); + wc.addWc(sbTag.toString()); + } + if (!CR.getId_marche().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getId_marche(), ","); + StringBuilder sbMarche = new StringBuilder(); + while (st.hasMoreTokens()) { + String currentToken = st.nextToken(); + if (!currentToken.isEmpty()) { + if (sbMarche.length() > 0) + sbMarche.append(" or "); + sbMarche.append("id_marche like '%:" + currentToken + ":%'"); + } + } + if (sbMarche.length() > 0) + wc.addWc("(" + sbMarche.toString() + ")"); + } + if (CR.getId_reparto() != 0L) + wc.addWc("A.id_reparto=" + CR.getId_reparto()); + if (CR.getLimit() > 0L) + if (CR.getStart() > 0L) { + s_Sql_limit = " limit " + CR.getStart() + "," + CR.getLimit(); + } else { + s_Sql_limit = " limit " + CR.getLimit(); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Order); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findFigliAll(long l_id_tipo, boolean ordineAlfabetico) { + String s_Sql_Find = "select A.* from TIPO AS A"; + String s_Sql_Order = " order by A.livello, A.ordine, A.descrizione"; + String s_Sql_limit = ""; + if (ordineAlfabetico) + s_Sql_Order = " order by A.descrizione, A.livello, A.ordine "; + WcString wc = new WcString(); + if (getId_tipo() > 0L) + wc.addWc("(A.id_tipo=" + l_id_tipo + " or A.indici like'%:" + l_id_tipo + ":%')"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Order); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator xxxxfindFoglie(int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + wc.addWc("(A.id_tipoPadre=0 or A.id_tipoPadre is null)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findPadri() { + Vectumerator vec = new Vectumerator(); + Tipo currentPadre = getTipoPadre(); + while (currentPadre.getId_tipo() != 0L) { + vec.add(currentPadre); + currentPadre = currentPadre.getTipoPadre(); + } + vec.setOrderBackward(); + return vec; + } + + public ResParm addTipoFiglio(Tipo l_tipo) { + Tipo bean = new Tipo(getApFull()); + bean.findByPrimaryKey(l_tipo.getId_tipo()); + if (((bean.getId_tipo() == 0L) ? true : false) | (!indiciContains(bean.getId_tipo()) ? true : false)) { + bean.setId_tipoPadre(getId_tipo()); + bean.setFlgEvidenziato(l_tipo.getFlgEvidenziato()); + bean.setRicaricoBase(l_tipo.getRicaricoBase()); + bean.setLivello(l_tipo.getLivello()); + return bean.save(); + } + return new ResParm(false, "Impossibile aggiungere figlio: legame circolare! "); + } + + public ResParm delTipoFiglio(Tipo l_tipo) { + Tipo bean = new Tipo(getApFull()); + bean.findByPrimaryKey(l_tipo.getId_tipo()); + return bean.delete(); + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + super.prepareSave(ps); + } + + public void findByDescrizione(String l_desc) { + String s_Sql_Find = "select A.* from TIPO AS A"; + String s_Sql_Order = " order by A.ordine, A.descrizione_it"; + String wc = ""; + wc = buildWc(wc, "A.descrizione='" + l_desc + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByCodCdc(String l_codCdc) { + String s_Sql_Find = "select A.* from TIPO AS A"; + String s_Sql_Order = " order by A.ordine, A.descrizione_it"; + String wc = ""; + wc = buildWc(wc, "A.codCdc='" + l_codCdc + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByCodiceAlt(String l_codiceAlt) { + String s_Sql_Find = "select A.* from TIPO AS A"; + String s_Sql_Order = " order by A.ordine, A.descrizione_it"; + String wc = ""; + wc = buildWc(wc, "A.codiceAlt='" + l_codiceAlt + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public ResParm addNuovoSottoTipo(Tipo l_tipo) { + Tipo sf = new Tipo(getApFull()); + sf.setDescrizione(l_tipo.getDescrizione()); + sf.setId_tipoPadre(getId_tipo()); + ResParm rp = new ResParm(); + rp = sf.save(); + return rp; + } + + public long getFlgFoglia() { + return this.flgFoglia; + } + + public void setFlgFoglia(long flgFoglia) { + this.flgFoglia = flgFoglia; + } + + private long flgNascondi = 0L; + + private long ordine; + + private String codiceAlt; + + private Articolo articoloBase; + + public long getFlgNascondi() { + return this.flgNascondi; + } + + public String getNascondi() { + if (this.flgNascondi == 0L) + return "Vis."; + if (this.flgNascondi == 1L) + return "Nasc."; + return "??"; + } + + public void setFlgNascondi(long flgNascondi) { + this.flgNascondi = flgNascondi; + } + + public String getDescrizioneAggiuntiva() { + return (this.descrizioneAggiuntiva == null) ? "" : this.descrizioneAggiuntiva.trim(); + } + + public void setDescrizioneAggiuntiva(String descrizioneAgg) { + this.descrizioneAggiuntiva = descrizioneAgg; + } + + public long getOrdine() { + return this.ordine; + } + + public void setOrdine(long ordine) { + this.ordine = ordine; + } + + private long calcolaOrdine() { + try { + String s_sqlFind = "select max(ordine) as _max from TIPO WHERE id_tipo!=" + getId_tipo(); + if (getId_tipoPadre() != 0L) { + s_sqlFind = s_sqlFind + " and id_tipoPadre=" + s_sqlFind; + } else { + s_sqlFind = s_sqlFind + " and (id_tipoPadre=0 or id_tipoPadre is null)"; + } + PreparedStatement ps = getConn().prepareStatement(s_sqlFind); + long res = (long)getMax(ps, true) + 1L; + long decine = res / 10L; + return (decine + 1L) * 10L; + } catch (Exception e) { + handleDebug(e); + return 0L; + } + } + + protected boolean useNullFor0() { + return false; + } + + public Vectumerator findTipoMenu(long l_id_tipoSelezionato) { + Vectumerator result; + Tipo bean = new Tipo(getApFull()); + Vectumerator vec = bean.findFigli(0, 0); + if (l_id_tipoSelezionato != 0L) { + result = new Vectumerator(); + Tipo tipoSel = new Tipo(getApFull()); + tipoSel.findByPrimaryKey(l_id_tipoSelezionato); + if (tipoSel.isFoglia()) + l_id_tipoSelezionato = tipoSel.getTipoPadre().getId_tipo(); + while (vec.hasMoreElements()) { + Tipo row = (Tipo)vec.nextElement(); + result.add(row); + if (row.hasFiglio(l_id_tipoSelezionato)) + result.addAll((Collection)findTipoMenuFigli(row, l_id_tipoSelezionato)); + } + } else { + result = vec; + } + return result; + } + + private Vectumerator findTipoMenuFigli(Tipo tipoPadre, long l_id_tipoSelezionato) { + Vectumerator result; + try { + Vectumerator vec = tipoPadre.findFigli(0, 0); + result = new Vectumerator(); + while (vec.hasMoreElements()) { + Tipo row = (Tipo)vec.nextElement(); + result.add(row); + if (row.getId_tipoPadre() != l_id_tipoSelezionato) + result.addAll((Collection)findTipoMenuFigli(row, l_id_tipoSelezionato)); + } + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + return result; + } + + public boolean hasFiglio(long l_id_tipo) { + if (l_id_tipo == 0L) + return false; + String s_Sql_Find = "select A.* from TIPO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.indici like'%:" + l_id_tipo + ":%'"); + wc.addWc("A.indici like'%:" + getId_tipo() + ":%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Tipo bean = (Tipo)getFirstRecord(stmt); + if (bean != null) + return true; + return false; + } catch (SQLException e) { + handleDebug(e); + return false; + } + } + + public boolean isWeb() { + if (getFlgEscludiWeb() == 0L) + return true; + return false; + } + + public boolean isArticoloAcquistabile() { + if (getId_tipoPadre() == 0L) + return (getFlgEscludiWeb() == 0L && getFlgNascondi() == 0L); + if (getFlgEscludiWeb() != 0L || getFlgNascondi() != 0L) + return false; + return getTipoPadre().isArticoloAcquistabile(); + } + + public String getDescrizioneAlbero() { + StringBuffer temp = new StringBuffer(getDescrizione()); + try { + Tipo bean = (Tipo)clone(); + while (bean.getTipoPadre().getId_tipo() != 0L) { + bean = bean.getTipoPadre(); + temp.insert(0, bean.getDescrizione() + " » "); + } + } catch (Exception e) { + handleDebug(e); + } + return temp.toString(); + } + + public String getCodiceAlt() { + return (this.codiceAlt == null) ? "" : this.codiceAlt; + } + + public void setCodiceAlt(String codiceAlt) { + this.codiceAlt = codiceAlt; + } + + public long getFlgTipoMagazzino() { + return this.flgTipoMagazzino; + } + + public void setFlgTipoMagazzino(long flgTipoMagazzino) { + this.flgTipoMagazzino = flgTipoMagazzino; + } + + public static boolean threadCalcolaIndici = false; + + public long getId_reparto() { + return this.id_reparto; + } + + public void setId_reparto(long id_reparto) { + this.id_reparto = id_reparto; + setReparto(null); + } + + public Reparto getReparto() { + this.reparto = (Reparto)getSecondaryObject(this.reparto, Reparto.class, getId_reparto()); + return this.reparto; + } + + public void setReparto(Reparto reparto) { + this.reparto = reparto; + } + + public static final String getKit(long l_flgKit) { + switch ((int)l_flgKit) { + case 0: + return "No"; + case -1: + return "Da Tipo"; + case 1: + return "Primario"; + case 2: + return "Secondario"; + } + return "??"; + } + + public String getTipoMagazzino() { + return getTipoMagazzino(getFlgTipoMagazzino()); + } + + public String getDescrizioneCompletaFull() { + return getDescrizioneCompletaSep("it", " » "); + } + + public String getDescrizioneCompletaLabel() { + return getDescrizioneCompletaSep("it", "->"); + } + + public long getFlgUsaTagliaEreditato() { + if (getFlgUsaTaglia() == 0L && getLivello() > 0L) { + if (getTipoPadre().getFlgUsaTaglia() != 0L) + return getTipoPadre().getFlgUsaTaglia(); + return getTipoPadre().getFlgUsaTagliaEreditato(); + } + return -1L; + } + + public String getUsaTagliaEreditato() { + return getTipoMagazzino(getFlgUsaTagliaEreditato()); + } + + public String getTipoMagazzinoEffettivo() { + return getTipoMagazzino(getFlgTipoMagazzinoEffettivo()); + } + + public long getFlgTipoMagazzinoEffettivo() { + if (getFlgTipoMagazzino() == 0L && getId_tipoPadre() != 0L) + return getFlgTipoMagazzinoEreditato(); + return getFlgTipoMagazzino(); + } + + public long getFlgUsaVarianti() { + return this.flgUsaVarianti; + } + + public void setFlgUsaVarianti(long flgUsaVarianti) { + this.flgUsaVarianti = flgUsaVarianti; + } + + public String getWeb() { + if (this.flgEscludiWeb == 0L) + return "Si"; + if (this.flgEscludiWeb == 1L) + return "No"; + return "??"; + } + + public long getFlgStampaEtichette() { + return this.flgStampaEtichette; + } + + public void setFlgStampaEtichette(long flgStampaEtichette) { + this.flgStampaEtichette = flgStampaEtichette; + } + + public String getStampaEtichette() { + if (this.flgStampaEtichette == 0L) + return "No"; + if (this.flgStampaEtichette == 1L) + return "Si"; + return "??"; + } + + public long getNumeroFigli(long l_id_padre) { + Tipo tipoPadre = new Tipo(getApFull()); + tipoPadre.findByPrimaryKey(l_id_padre); + Vectumerator cf = tipoPadre.findFigli(0, 0); + return (long)cf.getTotNumberOfRecords(); + } + + public long getFlgStampaAccessori() { + return this.flgStampaAccessori; + } + + public void setFlgStampaAccessori(long flgStampaAccessori) { + this.flgStampaAccessori = flgStampaAccessori; + } + + public String getStampaAccessori() { + if (this.flgStampaAccessori == 0L) + return "No"; + if (this.flgStampaAccessori == 1L) + return "Si"; + return "??"; + } + + public String getDescrizioneHtml(String lang) { + return convertStringToHtml(getDescrizione(lang)); + } + + public long getFlgPresente() { + return this.flgPresente; + } + + public void setFlgPresente(long flgPresente) { + this.flgPresente = flgPresente; + } + + public long getFlgPresenteStock() { + return this.flgPresenteStock; + } + + public void setFlgPresenteStock(long flgPresenteStock) { + this.flgPresenteStock = flgPresenteStock; + } + + public long getFlgPresenteOfferte() { + return this.flgPresenteOfferte; + } + + public void setFlgPresenteOfferte(long flgPresenteOfferte) { + this.flgPresenteOfferte = flgPresenteOfferte; + } + + public long getFlgPresenteUsato() { + return this.flgPresenteUsato; + } + + public void setFlgPresenteUsato(long flgPresenteUsato) { + this.flgPresenteUsato = flgPresenteUsato; + } + + public Vectumerator findFigli(int pageNumber, int pageRows) { + TipoCR CR = new TipoCR(getApFull()); + return findFigli(CR, pageNumber, pageRows, false); + } + + protected void initFields() { + super.initFields(); + } + + public String getDescrizioneCompleta(String lang) { + return getDescrizioneCompletaSep(lang, " » "); + } + + public String getDescrizioneCompleta() { + String temp = getDescrizioneCompletaFull(); + if (temp.length() > 254) + return temp.substring(0, 254); + return temp; + } + + public long getFlgRC() { + return this.flgRC; + } + + public void setFlgRC(long flgRC) { + this.flgRC = flgRC; + } + + public long getFlgNoListino() { + return this.flgNoListino; + } + + public void setFlgNoListino(long flgNoListino) { + this.flgNoListino = flgNoListino; + } + + public long getFlgNoListinoEffettivo() { + if (getFlgNoListino() == 0L) { + if (getId_tipoPadre() != 0L) + return getTipoPadre().getFlgNoListinoEffettivo(); + return 0L; + } + return 1L; + } + + public long getFlgEscludiWeb() { + return this.flgEscludiWeb; + } + + public void setFlgEscludiWeb(long flgEscludiWeb) { + this.flgEscludiWeb = flgEscludiWeb; + } + + public String getUsaVarianti() { + if (this.flgUsaVarianti == 0L) + return "No"; + if (this.flgUsaVarianti == 1L) + return "Si"; + return "??"; + } + + public boolean isFoglia() { + if (getDBState() == 0) + return true; + Vectumerator vec = findFigli(1, 1); + if (vec.hasMoreElements()) + return false; + return true; + } + + public double getCostoSpedizione() { + return this.costoSpedizione; + } + + public void setCostoSpedizione(double costoSpedizione) { + this.costoSpedizione = costoSpedizione; + } + + public String getDescrizione(int stringCaseType) { + return convertStringCase(getDescrizione(), stringCaseType); + } + + public String getDescrizione(String lang, int stringCaseType) { + return convertStringCase(getDescrizione(lang), stringCaseType); + } + + public String getDescrizione(String lang, String defaultLang, int stringCaseType) { + return convertStringCase(getDescrizione(lang, defaultLang), stringCaseType); + } + + public Vectumerator findFigli(int pageNumber, int pageRows, boolean ordineAlfabetico) { + TipoCR CR = new TipoCR(getApFull()); + return findFigli(CR, pageNumber, pageRows, ordineAlfabetico); + } + + public void ordinaAlfabeticoFigli(Tipo beanPadre) { + if (beanPadre.getId_tipo() == 0L) + update("update TIPO set ordine=null"); + Vectumerator vec = beanPadre.findFigli(0, 0, false); + while (vec.hasMoreElements()) { + Tipo row = (Tipo)vec.nextElement(); + row.save(); + row.ordinaAlfabeticoFigli(row); + } + } + + public long getGgEscludiArticoloWeb() { + return this.ggEscludiArticoloWeb; + } + + public void setGgEscludiArticoloWeb(long ggEscludiArticoloWeb) { + this.ggEscludiArticoloWeb = ggEscludiArticoloWeb; + } + + public long getGgEscludiArticoloWebEffettivo() { + if (getGgEscludiArticoloWeb() == 0L && getId_tipoPadre() != 0L) + return getGgEscludiArticoloWebEreditato(); + return getGgEscludiArticoloWeb(); + } + + public long getGgEscludiArticoloWebEreditato() { + if (getGgEscludiArticoloWeb() == 0L && getLivello() > 0L) + return getTipoPadre().getGgEscludiArticoloWebEreditato(); + return getGgEscludiArticoloWeb(); + } + + public String getImgFileName(int imgNumber) { + return getImgFileName(imgNumber, getImgTmst()); + } + + public String getImgFileName(int imgNumber, String oldTmst) { + return "" + getId_tipo() + "_" + getId_tipo() + "_" + oldTmst + ".jpg"; + } + + public boolean useDescLangTables() { + return true; + } + + public String getDescrizioneAggiuntiva(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizioneAggiuntiva", lang); + } + + public String getDescrizione4Script(String lang) { + return prepareScriptString(getDescrizione(lang)); + } + + private void aggiornaDispoPerNoMagazzino() { + if ((getId_tipo() > 0L && getFlgTipoMagazzinoEffettivo() == 9L) || getFlgTipoMagazzinoEffettivo() == 0L) { + String sql = "UPDATE ARTICOLO SET flgDispo=1 where id_tipo=" + getId_tipo(); + update(sql); + } + } + + public ResParm superSave() { + return super.save(); + } + + public ResParm save() { + setFlgFoglia(isFoglia() ? 1L : 0L); + if (getFlgFoglia() == 0L) + setFlgEscludiWeb(0L); + if (getOrdine() == 0L) + setOrdine(calcolaOrdine()); + if (getId_tipoPadre() == 0L) { + setLivello(0L); + } else { + setLivello(getTipoPadre().getLivello() + 1L); + } + if (getFlgUsaVarianti() == 0L) { + setFlgUsaVarianteColori(0L); + } else if (getTipologiaArticolo().getFlgAFT() == 2L) { + setFlgUsaVarianteColori(1L); + } + if (getFlgUsaTagliaEffettivo() == 2L) { + if (getFlgTipoMagazzinoEffettivo() == 2L || getFlgTipoMagazzinoEffettivo() == 3L) + setFlgTipoMagazzino(1L); + } else if (getFlgTipoMagazzino() == 0L) { + setFlgTipoMagazzino(getFlgTipoMagazzinoEffettivo()); + } + setIndici(calcolaIndici()); + setDescrizioneR(getDescrizioneCompletaFull()); + boolean newRecord = (getId_tipo() == 0L); + String idxPadre = getTipoPadre().getIndici(); + String temp = ":" + getId_tipo() + ":"; + if (getId_tipo() == 0L || idxPadre.indexOf(temp) < 0 || (getId_tipo() != 0L && getId_tipo() != getId_tipoPadre())) { + ResParm resParm = super.save(); + if (resParm.getStatus() && newRecord) { + setIndici(calcolaIndici()); + resParm = super.save(); + if (getId_tipoPadre() > 0L && getTipoPadre().getFlgFoglia() == 1L) + resParm = getTipoPadre().save(); + } + if (resParm.getStatus()); + return resParm; + } + ResParm rp = new ResParm(false, "Impossibile salvare!. Legame circolare."); + return rp; + } + + public long getFlgStampaBarcode() { + return this.flgStampaBarcode; + } + + public void setFlgStampaBarcode(long flgStampaBarcode) { + this.flgStampaBarcode = flgStampaBarcode; + } + + public String getStampaBarcode() { + if (this.flgStampaBarcode == 0L) + return "No"; + if (this.flgStampaBarcode == 1L) + return "Si"; + return "??"; + } + + public long getFlgUsaTaglia() { + return this.flgUsaTaglia; + } + + public void setFlgUsaTaglia(long flgUsaTaglia) { + this.flgUsaTaglia = flgUsaTaglia; + } + + public long getId_tipoTaglia() { + return this.id_tipoTaglia; + } + + public void setId_tipoTaglia(long id_tipoTaglia) { + this.id_tipoTaglia = id_tipoTaglia; + } + + public TipoTaglia getTipoTaglia() { + this.tipoTaglia = (TipoTaglia)getSecondaryObject(this.tipoTaglia, TipoTaglia.class, getId_tipoTaglia()); + return this.tipoTaglia; + } + + public long getFlgUsaTagliaEffettivo() { + if (getFlgUsaTaglia() == 0L && getId_tipoPadre() != 0L) + return getFlgUsaTagliaEreditato(); + return getFlgUsaTaglia(); + } + + public long getFlgTipoMagazzinoEreditato() { + if (getFlgTipoMagazzino() == 0L && getLivello() > 0L) { + if (getTipoPadre().getFlgTipoMagazzino() != 0L) + return getTipoPadre().getFlgTipoMagazzino(); + return getTipoPadre().getFlgTipoMagazzinoEreditato(); + } + return -1L; + } + + public String getUsaTagliaEffettivo() { + return getUsaTaglia(getFlgUsaTagliaEffettivo()); + } + + public String getTipoMagazzinoEreditato() { + return getTipoMagazzino(getFlgTipoMagazzinoEreditato()); + } + + public static final String getUsaTaglia(long l_flgUsaTaglia) { + switch ((int)l_flgUsaTaglia) { + case -1: + return ""; + case 0: + return "N/D"; + case 2: + return "Si"; + case 1: + return "No"; + } + return "??"; + } + + public TipologiaArticolo getTipologiaArticolo() { + this.tipologiaArticolo = (TipologiaArticolo)getSecondaryObject(this.tipologiaArticolo, TipologiaArticolo.class, getId_tipologiaArticolo()); + return this.tipologiaArticolo; + } + + public long getId_tipologiaArticolo() { + return this.id_tipologiaArticolo; + } + + public void setId_tipologiaArticolo(long id_tipologiaArticolo) { + this.id_tipologiaArticolo = id_tipologiaArticolo; + setTipologiaArticolo(null); + } + + public void setTipologiaArticolo(TipologiaArticolo tipologiaArticolo) { + this.tipologiaArticolo = tipologiaArticolo; + } + + private String calcolaIndici() { + StringBuffer idx = new StringBuffer(":"); + idx.append(calcolaIndiciR()); + idx.append(":"); + return idx.toString(); + } + + public String getDescrizioneR() { + return (this.descrizioneR == null) ? "" : this.descrizioneR.trim(); + } + + public String getDescrizioneRPdf() { + return getDescrizioneR().replace("»", ">>"); + } + + public void setDescrizioneR(String descrizioneR) { + this.descrizioneR = descrizioneR; + } + + public long getFlgAFT() { + return getTipologiaArticolo().getFlgAFT(); + } + + public static final String getAFT(long l_flgAFT) { + return TipologiaArticolo.getAFT(l_flgAFT); + } + + public String getAFT() { + return getTipologiaArticolo().getAFT(); + } + + public void risalvaTutto() { + Vectumerator vec = findAll(); + while (vec.hasMoreElements()) { + Tipo row = (Tipo)vec.nextElement(); + row.save(); + } + } + + public ResParm delete() { + Tipo tipoPadre = null; + if (getId_tipoPadre() > 0L && getTipoPadre().getFlgFoglia() == 0L) + tipoPadre = getTipoPadre(); + ResParm rp = super.delete(); + if (rp.getStatus() && tipoPadre != null) + rp.append(tipoPadre.save()); + return rp; + } + + public String getDescrizioneCompletaKeyword(String lang) { + return getDescrizioneCompletaSep(lang, ", "); + } + + public String getDescrizioneCompletaSpaces(String lang) { + return getDescrizioneCompletaSep(lang, " "); + } + + public String getDescrizioneCompletaHypen(String lang) { + return getDescrizioneCompletaSep(lang, " - "); + } + + public String getDescrizioneCompletaSep(String lang, String sep) { + if (getId_tipoPadre() == 0L) + return getDescrizione(lang); + return getTipoPadre().getDescrizioneCompletaSep(lang, sep) + getTipoPadre().getDescrizioneCompletaSep(lang, sep) + sep; + } + + public String getDescrizioneCompletaPlus(String lang) { + if (getId_tipoPadre() == 0L) { + String str = convertStringToLink(getDescrizione(lang)); + return str; + } + String temp = convertStringToLink(getTipoPadre().getDescrizioneCompletaPlus(lang) + "+" + getTipoPadre().getDescrizioneCompletaPlus(lang)); + return temp; + } + + public String getDescrizioneCompletaMinus(String lang) { + if (getId_tipoPadre() == 0L) { + String str = convertStringToLink(getDescrizione(lang)); + return str; + } + String temp = convertStringToLink(getTipoPadre().getDescrizioneCompletaMinus(lang) + "-" + getTipoPadre().getDescrizioneCompletaMinus(lang)); + temp = DBAdapter.eliminaDoppioniTokenInStringa(temp, "-"); + return temp; + } + + public int countFigli() { + if (getDBState() == 0) + return 0; + Vectumerator vec = findFigli(1, 1); + return vec.getTotNumberOfRecords(); + } + + public String getDescrizione(String lang, String defaultLang) { + if (lang.isEmpty()) + lang = "it"; + String temp = getDescTxtLang("descrizione", lang); + if (temp.isEmpty()) + return getDescTxtLang("descrizione", defaultLang); + return temp; + } + + public boolean isUsaSeriali() { + if (getFlgTipoMagazzino() == 3L || getFlgTipoMagazzino() == 2L) + return true; + return false; + } + + public boolean isUsaMagazzino() { + if (getFlgTipoMagazzino() == 3L || getFlgTipoMagazzino() == 2L || getFlgTipoMagazzino() == 1L) + return true; + return false; + } + + public long getFlgCaratteristiche() { + return this.flgCaratteristiche; + } + + public void setFlgCaratteristiche(long flgCaratteristiche) { + this.flgCaratteristiche = flgCaratteristiche; + } + + public long getFlgComponenti() { + return this.flgComponenti; + } + + public void setFlgComponenti(long flgComponenti) { + this.flgComponenti = flgComponenti; + } + + public long getFlgAccessori() { + return this.flgAccessori; + } + + public void setFlgAccessori(long flgAccessori) { + this.flgAccessori = flgAccessori; + } + + public long getFlgAltreCompatibilita() { + return this.flgAltreCompatibilita; + } + + public void setFlgAltreCompatibilita(long flgAltreCompatibilita) { + this.flgAltreCompatibilita = flgAltreCompatibilita; + } + + public long getFlgRivalutazioni() { + return this.flgRivalutazioni; + } + + public void setFlgRivalutazioni(long flgRivalutazioni) { + this.flgRivalutazioni = flgRivalutazioni; + } + + public long getFlgFornitori() { + return this.flgFornitori; + } + + public void setFlgFornitori(long flgFornitori) { + this.flgFornitori = flgFornitori; + } + + public long getFlgAllegati() { + return this.flgAllegati; + } + + public void setFlgAllegati(long flgAllegati) { + this.flgAllegati = flgAllegati; + } + + public ResParm cambiaFlg(String l_flg) { + ResParm rp = new ResParm(true); + if (getId_tipo() > 0L) { + if (l_flg.equals("flgNascondi")) { + setFlgNascondi((getFlgNascondi() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgAllegati")) { + setFlgAllegati((getFlgAllegati() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgAltreCompatibilita")) { + setFlgAltreCompatibilita((getFlgAltreCompatibilita() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgCaratteristiche")) { + setFlgCaratteristiche((getFlgCaratteristiche() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgComponenti")) { + setFlgComponenti((getFlgComponenti() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgNoCart")) { + setFlgNoCart((getFlgNoCart() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgEscludiWeb")) { + setFlgEscludiWeb((getFlgEscludiWeb() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgFornitori")) { + setFlgFornitori((getFlgFornitori() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgRivalutazioni")) { + setFlgRivalutazioni((getFlgRivalutazioni() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgStampaAccessori")) { + setFlgStampaAccessori((getFlgStampaAccessori() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgStampaBarcode")) { + setFlgStampaBarcode((getFlgStampaBarcode() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgStampaEtichette")) { + setFlgStampaEtichette((getFlgStampaEtichette() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgAccessori")) { + setFlgAccessori((getFlgAccessori() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgMagNegativo")) { + setFlgMagNegativo((getFlgMagNegativo() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgUsaVarianteColori")) { + setFlgUsaVarianteColori((getFlgUsaVarianteColori() == 1L) ? 0L : 1L); + } else if (l_flg.equals("flgMainPage")) { + setFlgMainPage((getFlgMainPage() == 1L) ? 0L : 1L); + } + rp = save(); + } else { + rp.setStatus(false); + rp.setMsg("Tipo non trovato!"); + } + return rp; + } + + public long getFlgMagNegativo() { + return this.flgMagNegativo; + } + + public void setFlgMagNegativo(long flgMagNegativo) { + this.flgMagNegativo = flgMagNegativo; + } + + public long getFlgUsaVarianteColori() { + return this.flgUsaVarianteColori; + } + + public void setFlgUsaVarianteColori(long flgUsaVarianteColori) { + this.flgUsaVarianteColori = flgUsaVarianteColori; + } + + public String getDescrizione(String lang) { + if (lang == null || lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizione", lang); + } + + public String getDescrizioneBreve(String lang, int stringCaseType) { + return convertStringCase(getDescrizioneBreve(lang), stringCaseType); + } + + public String getDescrizioneBreveONormale(String lang) { + String temp = getDescrizioneBreve(lang); + if (temp.isEmpty()) + return getDescrizione(lang); + return temp; + } + + public String getDescrizioneBreveONormale(String lang, int stringCaseType) { + String temp = getDescrizioneBreve(lang, stringCaseType); + if (temp.isEmpty()) + return getDescrizione(lang, stringCaseType); + return temp; + } + + public String getDescrizioneBreve() { + String tmp = getDescrizioneBreve("it"); + return tmp; + } + + public long getFlgNoCart() { + return this.flgNoCart; + } + + public void setFlgNoCart(long flgNoCart) { + this.flgNoCart = flgNoCart; + } + + public Vectumerator findTipiArticoliWebByMarca(long l_id_marca) { + String s_Sql_Find = "SELECT A.* FROM TIPO AS A INNER JOIN ARTICOLO AS B ON A.id_tipo=B.id_tipo "; + String s_Sql_Order = " order by id_tipo;"; + WcString wc = new WcString(); + if (l_id_marca == 19L) + System.out.println("findTipiArticoliWebByMarca: " + l_id_marca); + wc.addWc("B.id_marca=" + l_id_marca); + wc.addWc("(B.flgEscludiWeb is null or B.flgEscludiWeb=0)"); + wc.addWc("(B.flgNascondi is null or B.flgNascondi=0)"); + wc.addWc("(A.flgNascondi is null or A.flgNascondi=0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findTipiAggiuntiviArticoliWebByMarca(long l_id_marca) { + String s_Sql_Find = "SELECT A.* FROM TIPO AS A INNER JOIN ARTICOLO AS B ON A.id_tipo=B.id_tipo2 "; + String s_Sql_Order = " order by id_tipo;"; + WcString wc = new WcString(); + if (l_id_marca == 19L) + System.out.println("findTipiArticoliWebByMarca: " + l_id_marca); + wc.addWc("B.id_marca=" + l_id_marca); + wc.addWc("(B.flgEscludiWeb is null or B.flgEscludiWeb=0)"); + wc.addWc("(B.flgNascondi is null or B.flgNascondi=0)"); + wc.addWc("(A.flgNascondi is null or A.flgNascondi=0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgKit() { + return this.flgKit; + } + + public void setFlgKit(long flgKit) { + this.flgKit = flgKit; + } + + public String getKit() { + return getKit(getFlgKit()); + } + + public static final String getTipoMagazzino(long l_flgTipoMagazzino) { + switch ((int)l_flgTipoMagazzino) { + case -1: + return ""; + case 0: + return "N/D"; + case 1: + return "Standard"; + case 2: + return "Univoco (IMEI)"; + case 3: + return "LOTTI"; + case 9: + return "No Magazz."; + } + return "??"; + } + + public String getTag() { + if (this.tag == null) + return ""; + this.tag = this.tag.trim(); + if (!this.tag.startsWith(",")) + this.tag = "," + this.tag; + if (!this.tag.endsWith(",")) + this.tag += ","; + return this.tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public static boolean isThreadAttivo() { + return threadCalcolaIndici; + } + + public final ResParm startThreadCalcolaIndici(boolean tag, boolean articoli) { + if (!isThreadAttivo()) { + new ThreadCalcolaIndici(tag, articoli); + return new ResParm(true, "ThreadCalcolaIndici avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public Vectumerator findWebByArticoloCR(ArticoloCR CR, int pageNumber, int pageRows) { + String occurrenceFind; + StringBuilder sb = new StringBuilder(); + boolean debug = false; + Timer timer = new Timer(); + if (debug) { + timer.start(); + sb.append(">>>>>>>>>>>>>>>>>>>>>>\nTIPO findWebByArticoloCR: "); + Date d = new Date(System.currentTimeMillis()); + sb.append(getApFull().getReqUrl()); + sb.append("\n"); + sb.append(d.toString()); + sb.append(" ip: "); + sb.append(getApFull().getReqIpAddress()); + } + Articolo articolo = new Articolo(getApFull()); + String occurrence = articolo.findWebByArticoloCRCreateSmartSearchOccurrence(CR.getSearchTxtWeb().toLowerCase(), "A.descrizioneSearch"); + if (!occurrence.isEmpty()) { + occurrenceFind = occurrence + ", "; + } else { + occurrenceFind = ""; + } + StringBuffer s_Sql_Find = new StringBuffer("select distinct " + occurrenceFind + " C.* from ARTICOLO AS A inner join TIPO AS C on C.id_tipo=A.id_tipo "); + String s_Sql_order = " order by C.ordineGlobale,C.descrizione"; + WcString wc = new WcString(); + articolo.findWebByArticoloCRCreateWC(CR, s_Sql_Find, wc); + wc.addWc("C.flgFoglia=1"); + try { + if (debug) { + sb.append("\n"); + sb.append(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + } + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + Vectumerator vec = findRows(stmt, pageNumber, pageRows); + if (debug) { + timer.stop(); + sb.append("\nDurata query: ms "); + sb.append(timer.getDurataMilliSec()); + sb.append("\n"); + sb.append("\n<<<<<<<<<<<<"); + System.out.println(sb.toString()); + } + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getOrdineGlobale() { + return this.ordineGlobale; + } + + public void setOrdineGlobale(long ordineGlobale) { + this.ordineGlobale = ordineGlobale; + } + + private long calcolaOrdineGlobale(long currentOrdine) { + Vectumerator vec = findFigli(0, 0); + while (vec.hasMoreElements()) { + Tipo row = (Tipo)vec.nextElement(); + row.setOrdineGlobale(currentOrdine); + row.superSave(); + currentOrdine++; + if (!row.isFoglia()) + currentOrdine = row.calcolaOrdineGlobale(currentOrdine); + } + return currentOrdine; + } + + public String getDescrizioneUrl() { + String temp = convertStringToLink(getDescrizione()); + return temp; + } + + public String getDescrizioneCompletaGreater(String lang) { + return getDescrizioneCompletaSep(lang, " > "); + } + + public String getCCLinkCerca(ArticoloCR CR) { + String PLUS = "+"; + String MINUS = "-"; + StringBuilder sb = new StringBuilder(); + sb.append(getDescrizioneCompletaPlus(CR.getLang())); + sb.append("+"); + sb.append("l"); + sb.append("-"); + sb.append(CR.getFlgTipoVisualizzazione()); + sb.append("-"); + sb.append(getId_tipo()); + sb.append("-"); + if (CR.getFiltri_id().isEmpty()) + ArticoloCR.setCCFiltriIdFromCR(CR); + sb.append(CR.getFiltri_id()); + sb.append("-"); + sb.append(CR.getSearchTxtWeb()); + sb.append("-"); + sb.append(CR.getFlgOrderBy()); + sb.append("-"); + sb.append(CR.getPageNumber()); + sb.append("-"); + sb.append(CR.getPageRow()); + sb.append("-"); + sb.append(CR.getLang()); + sb.append(".html"); + return sb.toString().replaceAll("-0", "-"); + } + + public String getCCLinkArticoli(ArticoloCR CR) { + return getCCLinkArticoli(CR, false, false, false); + } + + public String getCCLinkArticoliPagination(ArticoloCR CR) { + return getCCLinkArticoli(CR, true, false, false); + } + + public String getCCLinkArticoli(ArticoloCR CR, boolean usePageNumberTag, boolean isCanonical, boolean noFiltri) { + StringBuilder sb = new StringBuilder(); + StringBuilder sbCmd = new StringBuilder(); + String temp = getDescrizioneCompletaMinus(CR.getLang()); + if (temp.isEmpty()) { + sb.append("search"); + } else { + sb.append(temp); + } + sbCmd.append("+"); + if (usePageNumberTag) { + sbCmd.append("s"); + } else { + sbCmd.append("l"); + } + if (!noFiltri) + sbCmd.append(CR.getFlgDisponibileLinkCode()); + sbCmd.append("-"); + sbCmd.append(CR.getFlgTipoVisualizzazione()); + sbCmd.append("-"); + sbCmd.append(getId_tipo()); + sbCmd.append("-"); + if (!noFiltri) { + if (CR.getFiltri_id().isEmpty()) + ArticoloCR.setCCFiltriIdFromCR(CR); + sbCmd.append(CR.getFiltri_id()); + } + sbCmd.append("-"); + if (!usePageNumberTag) { + if (!isCanonical && + !noFiltri) + sbCmd.append(CR.getSearchTxtWeb()); + sbCmd.append("-"); + } + sbCmd.append(CR.getFlgOrderBy()); + sbCmd.append("-"); + if (usePageNumberTag) { + sbCmd.append("#"); + } else { + sbCmd.append((CR.getPageNumber() == 0) ? 1 : CR.getPageNumber()); + } + sbCmd.append("-"); + sbCmd.append((CR.getPageRow() == 0) ? 48 : CR.getPageRow()); + sbCmd.append("-"); + sbCmd.append(CR.getLang()); + sbCmd.append(".html"); + String searcTxtQ = ""; + if (usePageNumberTag && + !noFiltri) + searcTxtQ = CR.getSearchTxtQuery(); + long realMaxlinkLength = 80L - (long)getWwwAddressParm().length(); + if ((long)(sb.length() + sbCmd.length()) > realMaxlinkLength) { + if (realMaxlinkLength - (long)sbCmd.length() + 1L > 0L) { + String pre = sb.substring(0, (int)(realMaxlinkLength - (long)sbCmd.length() + 1L)); + if (pre.lastIndexOf("-") > 0) + pre = pre.substring(0, pre.lastIndexOf("-")); + return (pre.toString() + pre.toString() + sbCmd.toString()).replaceAll("-0", "-").toLowerCase(); + } + return (sb.toString() + sb.toString() + sbCmd.toString()).replaceAll("-0", "-").toLowerCase(); + } + return (sb.toString() + sb.toString() + sbCmd.toString()).replaceAll("-0", "-").toLowerCase(); + } + + public String getId_marche() { + return (this.id_marche == null) ? "" : this.id_marche.trim(); + } + + public void setId_marche(String id_marche) { + this.id_marche = id_marche; + } + + public String getCCLinkCercaOld(ArticoloCR CR) { + String PLUS = "+"; + String MINUS = "-"; + StringBuilder sb = new StringBuilder(); + sb.append(getDescrizioneCompletaPlus(CR.getLang())); + sb.append("+"); + sb.append(translate("cerca", CR.getLang())); + sb.append("-"); + sb.append(CR.getFlgTipoVisualizzazione()); + sb.append("-"); + sb.append(getId_tipo()); + sb.append("-"); + if (CR.getFiltri_id().isEmpty()) + ArticoloCR.setCCFiltriIdFromCR(CR); + sb.append(CR.getFiltri_id()); + sb.append("-"); + sb.append(CR.getFlgOrderBy()); + sb.append("-"); + sb.append(CR.getPageNumber()); + sb.append("-"); + sb.append(CR.getPageRow()); + sb.append("-"); + sb.append(CR.getLang()); + sb.append(".html"); + return sb.toString().replaceAll("-0", "-"); + } + + public String getEbayCategoryId() { + return (this.ebayCategoryId == null) ? "" : this.ebayCategoryId.trim(); + } + + public void setEbayCategoryId(String ebayCategoryId) { + this.ebayCategoryId = ebayCategoryId; + } + + public String getEbayCategoryDesc() { + return (this.ebayCategoryDesc == null) ? "" : this.ebayCategoryDesc.trim(); + } + + public void setEbayCategoryDesc(String ebayCategoryDesc) { + this.ebayCategoryDesc = ebayCategoryDesc; + } + + public ResParm setEbayCategorySuggestion(String l_query) { + ResParm rp = new ResParm(true); + if (getId_tipo() > 0L) { + if (l_query.isEmpty()) + l_query = getDescrizioneCompletaSpaces(Locale.ITALIAN.getCountry()); + EbayAbliaApi bean = new EbayAbliaApi(getApFull()); + try { + EbayResult res = bean.ebayGetCategorySuggestion(l_query); + if (res.isOk()) { + JSONObject jo = (JSONObject)res.getResult(); + setEbayCategoryId(jo.getString("categoryId")); + setEbayCategoryDesc(jo.getString("categoryName")); + return super.save(); + } + rp.setStatus(false); + rp.setMsg(res.getMsg()); + } catch (Exception e) { + rp.setStatus(false); + rp.setMsg(e); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! Tipo non selezionato!"); + } + return rp; + } + + public long getId_googleCategory() { + return this.id_googleCategory; + } + + public void setId_googleCategory(long id_googleCategory) { + this.id_googleCategory = id_googleCategory; + setGoogleCategory(null); + } + + public GoogleCategory getGoogleCategory() { + this.googleCategory = (GoogleCategory)getSecondaryObject(this.googleCategory, GoogleCategory.class, getId_googleCategory()); + return this.googleCategory; + } + + public void setGoogleCategory(GoogleCategory googleCategory) { + this.googleCategory = googleCategory; + } + + public double getEbayCommissione() { + return (this.ebayCommissione == 0.0D) ? 6.5D : this.ebayCommissione; + } + + public void setEbayCommissione(double ebayCommissione) { + this.ebayCommissione = ebayCommissione; + } + + public long getPercCostoSpedizioneDefault() { + return this.percCostoSpedizioneDefault; + } + + public void setPercCostoSpedizioneDefault(long percCostoSpedizioneDefault) { + this.percCostoSpedizioneDefault = percCostoSpedizioneDefault; + } + + public double getAmazonCommissione() { + return (this.amazonCommissione == 0.0D) ? 7.21D : this.amazonCommissione; + } + + public void setAmazonCommissione(double amazonCommissione) { + this.amazonCommissione = amazonCommissione; + } + + public double getAmazonSoglia() { + return this.amazonSoglia; + } + + public void setAmazonSoglia(double amazonSoglia) { + this.amazonSoglia = amazonSoglia; + } + + public double getAmazonCommissioneOltreSoglia() { + return this.amazonCommissioneOltreSoglia; + } + + public void setAmazonCommissioneOltreSoglia(double amazonCommissioneOltreSoglia) { + this.amazonCommissioneOltreSoglia = amazonCommissioneOltreSoglia; + } + + public long getFlgControlloCostiAggFor() { + return this.flgControlloCostiAggFor; + } + + public void setFlgControlloCostiAggFor(long flgControlloCostiAggFor) { + this.flgControlloCostiAggFor = flgControlloCostiAggFor; + } + + public String getTrovaprezziCategoria() { + return (this.trovaprezziCategoria == null) ? "" : this.trovaprezziCategoria.trim(); + } + + public void setTrovaprezziCategoria(String trovaprezziCategoria) { + this.trovaprezziCategoria = trovaprezziCategoria; + } + + public String getDescrizioneCompletaFull(String lang) { + return getDescrizioneCompletaSep(lang, " » "); + } + + public String getKeyword(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("keyword", lang); + } + + public String getMetaDescTemplateLeaf(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("metaDescTemplateLeaf", lang); + } + + public String getTagH2(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("tagH2", lang); + } + + public String getDescrizioneLink(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizioneLink", lang); + } + + public String getDescrizioneSeo(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizioneSeo", lang); + } + + public String getMetaDescTemplateLeafWeb(String lang) { + if (lang.isEmpty()) + lang = "it"; + String result = getMetaDescTemplateLeaf(lang); + if (result.isEmpty()) { + if (getId_tipoPadre() > 0L) + return getTipoPadre().getMetaDescTemplateLeafWeb(lang); + return ""; + } + return result; + } + + public String getKeywordWeb(String lang) { + if (lang.isEmpty()) + lang = "it"; + String result = getKeyword(lang); + if (result.isEmpty()) { + if (getId_tipoPadre() > 0L) + return getTipoPadre().getKeywordWeb(lang); + return ""; + } + return result; + } + + public long getFlgMainPage() { + return this.flgMainPage; + } + + public void setFlgMainPage(long flgMainPage) { + this.flgMainPage = flgMainPage; + } + + public Vectumerator findMainPage() { + String s_Sql_Find = "select A.* from TIPO AS A"; + String s_Sql_Order = " order by A.ordine, A.descrizione"; + WcString wc = new WcString(); + wc.addWc("(A.id_tipoPadre=0 or A.id_tipoPadre is null)"); + wc.addWc("(A.flgMainPage=0 or A.flgMainPage is null)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getCCLinkArticoliCanonical(ArticoloCR CR) { + return getWwwAddressParm() + getWwwAddressParm(); + } + + public String getTagH1Web(String lang) { + if (getTagH1(lang).isEmpty()) + return getDescrizione(lang, 1); + return convertStringCase(getDescTxtLang("tagH1", lang), 1); + } + + public String getMetaDesc(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("metaDesc", lang); + } + + public String getTagH1(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("tagH1", lang); + } + + public long getFlgIcecatNoAuto() { + return this.flgIcecatNoAuto; + } + + public void setFlgIcecatNoAuto(long flgIcecatNoAuto) { + this.flgIcecatNoAuto = flgIcecatNoAuto; + } + + public String getCCLinkArticoliNoFiltri(ArticoloCR CR) { + return getCCLinkArticoli(CR, false, false, true); + } + + public String getCCLinkArticoliCanonicalDefault(ArticoloCR CR) { + CR.setLang("it"); + return getWwwAddressParm() + getWwwAddressParm(); + } + + public String getCCLinkArticoliCanonical(ArticoloCR CR, String lang) { + CR.setLang(lang); + return getWwwAddressParm() + getWwwAddressParm(); + } + + public String getSitemapFileProdotti() { + return (this.sitemapFileProdotti == null) ? "" : this.sitemapFileProdotti.trim(); + } + + public void setSitemapFileProdotti(String sitemapFileProdotti) { + this.sitemapFileProdotti = sitemapFileProdotti; + } + + public long getSitemapPriority() { + return this.sitemapPriority; + } + + public void setSitemapPriority(long sitemapPriority) { + this.sitemapPriority = sitemapPriority; + } + + public String getSitemapPriorityReal() { + if (getSitemapPriority() > 100L || getSitemapPriority() == 50L || getSitemapPriority() < 0L) + return ""; + double sp = (double)getSitemapPriority() / 100.0D; + return String.valueOf(sp); + } + + public Vectumerator findTipoSitemap() { + String s_Sql_Find = "select A.* from TIPO AS A"; + String s_Sql_Order = " order by A.livello, A.ordine, A.descrizione"; + String s_Sql_limit = ""; + WcString wc = new WcString(); + wc.addWc("(A.sitemapFileProdotti is not null and A.sitemapFileProdotti <>'')"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Order); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Listino getListinoAmazon() { + this.listinoAmazon = (Listino)getSecondaryObject(this.listinoAmazon, Listino.class, getId_listinoAmazon()); + return this.listinoAmazon; + } + + public Listino getListinoEbay() { + this.listinoEbay = (Listino)getSecondaryObject(this.listinoEbay, Listino.class, getId_listinoEbay()); + return this.listinoEbay; + } + + public void setListinoAmazon(Listino listinoAmazon) { + this.listinoAmazon = listinoAmazon; + } + + public void setListinoEbay(Listino listinoEbay) { + this.listinoEbay = listinoEbay; + } + + public long getId_listinoAmazon() { + return this.id_listinoAmazon; + } + + public long getId_listinoEbay() { + return this.id_listinoEbay; + } + + public void setId_listinoAmazon(long id_listinoAmazon) { + this.id_listinoAmazon = id_listinoAmazon; + setListinoAmazon(null); + } + + public void setId_listinoEbay(long id_listinoEbay) { + this.id_listinoEbay = id_listinoEbay; + setListinoEbay(null); + } + + public double getEbayFissa() { + return this.ebayFissa; + } + + public void setEbayFissa(double ebayFissa) { + this.ebayFissa = ebayFissa; + } + + public double getAmazonFissa() { + return this.amazonFissa; + } + + public void setAmazonFissa(double amazonFissa) { + this.amazonFissa = amazonFissa; + } + + public String getPathImg() { + return getParm("PATH_IMG_TIPO").getTesto(); + } + + public Articolo getArticoloBase() { + if (this.articoloBase == null && getId_tipo() != 0L) { + ArticoloCR CRA = new ArticoloCR(); + CRA.setId_tipo(getId_tipo()); + CRA.setFlgEscludiWeb(0L); + CRA.setFlgOrderBy(99L); + Vectumerator vec = new Articolo(getApFull()).findByCR(CRA, 1, 1); + if (vec.hasMoreElements()) { + int nRec = vec.getTotNumberOfRecords(); + int nVar = (int)(Math.random() * (double)nRec); + this.articoloBase = (Articolo)vec.get(nVar); + } + } + if (this.articoloBase == null) { + logDebug(true, "getArticoloBase--> tipo: " + getId_tipo() + " " + getDescrizione() + " senza articoli!!"); + return new Articolo(getApFull()); + } + return this.articoloBase; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoAccessorio.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoAccessorio.java new file mode 100644 index 00000000..db89546c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoAccessorio.java @@ -0,0 +1,83 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoAccessorio extends _ArtAdapter implements Serializable { + private long flgDirezione; + + private long id_tipoAccessorio; + + public TipoAccessorio(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoAccessorio() {} + + public void setId_tipoAccessorio(long newId_tipoAccessorio) { + this.id_tipoAccessorio = newId_tipoAccessorio; + } + + public long getId_tipoAccessorio() { + return this.id_tipoAccessorio; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoAccessorioCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_ACCESSORIO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgDirezione() { + return this.flgDirezione; + } + + public void setFlgDirezione(long flgDirezione) { + this.flgDirezione = flgDirezione; + } + + public static final String getDirezione(long l_flgDirezione) { + if (l_flgDirezione == 0L) + return "1<-->2"; + if (l_flgDirezione == 1L) + return "1|-->2"; + if (l_flgDirezione == -1L) + return "1<--|2"; + return "??"; + } + + public final String getDirezione() { + return getDirezione(getFlgDirezione()); + } + + public boolean useDescLangTables() { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoAccessorioCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoAccessorioCR.java new file mode 100644 index 00000000..104475a2 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoAccessorioCR.java @@ -0,0 +1,42 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoAccessorioCR extends CRAdapter { + private long id_tipoAccessorio; + + private String descrizione_it; + + private String descrizione_en; + + public TipoAccessorioCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoAccessorioCR() {} + + public void setId_tipoAccessorio(long newId_tipoAccessorio) { + this.id_tipoAccessorio = newId_tipoAccessorio; + } + + public void setDescrizione_it(String newDescrizione_it) { + this.descrizione_it = newDescrizione_it; + } + + public void setDescrizione_en(String newDescrizione_en) { + this.descrizione_en = newDescrizione_en; + } + + public long getId_tipoAccessorio() { + return this.id_tipoAccessorio; + } + + public String getDescrizione_it() { + return (this.descrizione_it == null) ? "" : this.descrizione_it; + } + + public String getDescrizione_en() { + return (this.descrizione_en == null) ? "" : this.descrizione_en; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoAllegatoArticolo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoAllegatoArticolo.java new file mode 100644 index 00000000..7b3a0599 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoAllegatoArticolo.java @@ -0,0 +1,65 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoAllegatoArticolo extends _ArtAdapter implements Serializable { + private long id_tipoAllegatoArticolo; + + private String descrizione; + + public TipoAllegatoArticolo(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoAllegatoArticolo() {} + + public void setId_tipoAllegatoArticolo(long newId_tipoAllegatoArticolo) { + this.id_tipoAllegatoArticolo = newId_tipoAllegatoArticolo; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoAllegatoArticolo() { + return this.id_tipoAllegatoArticolo; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoAllegatoArticoloCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_ALLEGATO_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoAllegatoArticoloCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoAllegatoArticoloCR.java new file mode 100644 index 00000000..e7cd4721 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoAllegatoArticoloCR.java @@ -0,0 +1,32 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoAllegatoArticoloCR extends CRAdapter { + private long id_tipoAllegatoArticolo; + + private String descrizione; + + public TipoAllegatoArticoloCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoAllegatoArticoloCR() {} + + public void setId_tipoAllegatoArticolo(long newId_tipoAllegatoArticolo) { + this.id_tipoAllegatoArticolo = newId_tipoAllegatoArticolo; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoAllegatoArticolo() { + return this.id_tipoAllegatoArticolo; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoCR.java new file mode 100644 index 00000000..36cd45cb --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoCR.java @@ -0,0 +1,256 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoCR extends CRAdapter { + private long id_tipo; + + private String flg_evidenziato; + + private String descrizione; + + private long ricaricoBase; + + private long id_tipoPadre; + + private long livello; + + private String indici; + + private Tipo tipoPadre; + + private long flgNascondi = -1L; + + private String codCdc; + + private long id_reparto; + + private long flgPresente = -1L; + + private long flgPresenteOfferte = -1L; + + private long flgPresenteStock = -1L; + + private long flgPresenteUsato = -1L; + + private long flgEscludiWeb = -1L; + + private long flgAFT = -1L; + + private long flgSoloFoglie = -1L; + + private long limit = 0L; + + private long start; + + private String tag; + + private String id_marche; + + private long flgMainPage = -1L; + + public TipoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoCR() {} + + public void setId_tipo(long newId_tipo) { + this.id_tipo = newId_tipo; + } + + public void setFlg_evidenziato(String newFlg_evidenziato) { + this.flg_evidenziato = newFlg_evidenziato; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setRicaricoBase(long newRicaricoBase) { + this.ricaricoBase = newRicaricoBase; + } + + public void setId_tipoPadre(long newId_tipoPadre) { + this.id_tipoPadre = newId_tipoPadre; + setTipo(null); + } + + public void setLivello(long newLivello) { + this.livello = newLivello; + } + + public void setIndici(String newIndici) { + this.indici = newIndici; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public String getFlg_evidenziato() { + return (this.flg_evidenziato == null) ? "" : this.flg_evidenziato; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public long getRicaricoBase() { + return this.ricaricoBase; + } + + public long getId_tipoPadre() { + return this.id_tipoPadre; + } + + public long getLivello() { + return this.livello; + } + + public String getIndici() { + return (this.indici == null) ? "" : this.indici; + } + + public void setTipo(Tipo newTipo) { + this.tipoPadre = newTipo; + } + + public Tipo getTipo() { + this.tipoPadre = (Tipo)getSecondaryObject(this.tipoPadre, Tipo.class, getId_tipoPadre()); + return this.tipoPadre; + } + + public String getCodCdc() { + return (this.codCdc == null) ? AB_EMPTY_STRING : this.codCdc; + } + + public void setCodCdc(String codCdc) { + this.codCdc = codCdc; + } + + public long getFlgNascondi() { + return this.flgNascondi; + } + + public void setFlgNascondi(long flgNascondi) { + this.flgNascondi = flgNascondi; + } + + public long getId_reparto() { + return this.id_reparto; + } + + public void setId_reparto(long id_reparto) { + this.id_reparto = id_reparto; + } + + public long getFlgPresente() { + return this.flgPresente; + } + + public void setFlgPresente(long flgPresente) { + this.flgPresente = flgPresente; + } + + public long getFlgPresenteOfferte() { + return this.flgPresenteOfferte; + } + + public void setFlgPresenteOfferte(long flgPresenteOfferte) { + this.flgPresenteOfferte = flgPresenteOfferte; + } + + public long getFlgPresenteStock() { + return this.flgPresenteStock; + } + + public void setFlgPresenteStock(long flgPresenteStock) { + this.flgPresenteStock = flgPresenteStock; + } + + public long getFlgPresenteUsato() { + return this.flgPresenteUsato; + } + + public void setFlgPresenteUsato(long flgPresenteUsato) { + this.flgPresenteUsato = flgPresenteUsato; + } + + public long getFlgEscludiWeb() { + return this.flgEscludiWeb; + } + + public void setFlgEscludiWeb(long flgEscludiWeb) { + this.flgEscludiWeb = flgEscludiWeb; + } + + public String getAFT() { + return TipologiaArticolo.getAFT(getFlgAFT()); + } + + public static final String getAFT(long l_flgAFT) { + return TipologiaArticolo.getAFT(l_flgAFT); + } + + public long getFlgAFT() { + return this.flgAFT; + } + + public void setFlgAFT(long flgAFT) { + this.flgAFT = flgAFT; + } + + public long getFlgSoloFoglie() { + return this.flgSoloFoglie; + } + + public void setFlgSoloFoglie(long flgSoloFoglie) { + this.flgSoloFoglie = flgSoloFoglie; + } + + public long getLimit() { + return this.limit; + } + + public void setLimit(long limit) { + this.limit = limit; + } + + public long getStart() { + return this.start; + } + + public void setStart(long start) { + this.start = start; + } + + public String getTag() { + return (this.tag == null) ? AB_EMPTY_STRING : this.tag.trim(); + } + + public void setTag(String tag) { + this.tag = tag; + } + + public static final String getTipoMagazzino(long l_flgTipoMagazzino) { + return Tipo.getTipoMagazzino(l_flgTipoMagazzino); + } + + public String getId_marche() { + return (this.id_marche == null) ? AB_EMPTY_STRING : this.id_marche.trim(); + } + + public void setId_marche(String id_marche) { + this.id_marche = id_marche; + } + + public long getFlgMainPage() { + return this.flgMainPage; + } + + public void setFlgMainPage(long flgMainPage) { + this.flgMainPage = flgMainPage; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoTaglia.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoTaglia.java new file mode 100644 index 00000000..41cbc0f9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoTaglia.java @@ -0,0 +1,110 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.Locale; + +public class TipoTaglia extends _ArtAdapter implements Serializable { + private long id_tipoTaglia; + + private String descrizione; + + private String codice; + + public TipoTaglia(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoTaglia() {} + + public void setId_tipoTaglia(long newId_tipoTaglia) { + this.id_tipoTaglia = newId_tipoTaglia; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setCodice(String newCodice) { + this.codice = newCodice; + } + + public long getId_tipoTaglia() { + return this.id_tipoTaglia; + } + + public String getDescrizione() { + return getDescrizione(Locale.ITALIAN.getLanguage()); + } + + public String getCodice() { + return (this.codice == null) ? "" : this.codice; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoTagliaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_TAGLIA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByCodice(String l_codice) { + String s_Sql_Find = "select A.* from TIPO_TAGLIA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice='" + l_codice + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getDescrizioneCompleta() { + if (getCodice().equals(getDescrizione()) || getCodice().isEmpty()) + return getDescrizione(); + return getCodice() + " - " + getCodice(); + } + + public String getDescrizione(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizione", lang); + } + + public String getDescrizioneCompleta(String l_lang) { + if (getCodice().equals(getDescrizione(l_lang)) || getCodice().isEmpty()) + return getDescrizione(l_lang); + return getCodice() + " - " + getCodice(); + } + + public boolean useDescLangTables() { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoTagliaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoTagliaCR.java new file mode 100644 index 00000000..3a8cc7b3 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipoTagliaCR.java @@ -0,0 +1,42 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoTagliaCR extends CRAdapter { + private long id_tipoTaglia; + + private String descrizione; + + private String codice; + + public TipoTagliaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoTagliaCR() {} + + public void setId_tipoTaglia(long newId_tipoTaglia) { + this.id_tipoTaglia = newId_tipoTaglia; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setCodice(String newCodice) { + this.codice = newCodice; + } + + public long getId_tipoTaglia() { + return this.id_tipoTaglia; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public String getCodice() { + return (this.codice == null) ? "" : this.codice; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipologiaArticolo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipologiaArticolo.java new file mode 100644 index 00000000..0d2ba1d2 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipologiaArticolo.java @@ -0,0 +1,175 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipologiaArticolo extends _ArtAdapter implements Serializable { + private long id_tipologiaArticolo; + + private String descrizione; + + private long flgUdm; + + private long flgKg; + + private long flgMt; + + private long flgNr; + + private long flgAFT = 0L; + + public static final long AFT_NON_IMPOSTATO = -1L; + + public static final long AFT_ARTICOLO = 0L; + + public static final long AFT_FILATO = 1L; + + public static final long AFT_TESSUTO = 2L; + + public static final long AFT_CONFEZIONE = 3L; + + public static final long AFT_ANNODATURA = 21L; + + public static final long AFT_COLPI_DISPOSIZIONE = 20L; + + public static final long AFT_CATENA = 22L; + + public static final long AFT_CR_ARTICOLO_E_CONFEZIONE = 30L; + + public static final int UDM_NR = 1; + + public static final int UDM_KG = 2; + + public static final int UDM_MT = 3; + + public static final int UDM_LT = 4; + + public static final int UDM_MT2 = 5; + + public TipologiaArticolo(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipologiaArticolo() {} + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipologiaArticoloCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPOLOGIA_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_tipologiaArticolo() { + return this.id_tipologiaArticolo; + } + + public void setId_tipologiaArticolo(long id_tipologiaArticolo) { + this.id_tipologiaArticolo = id_tipologiaArticolo; + } + + public long getFlgUdm() { + return this.flgUdm; + } + + public void setFlgUdm(long flgUdm) { + this.flgUdm = flgUdm; + } + + public long getFlgKg() { + return this.flgKg; + } + + public void setFlgKg(long flgKg) { + this.flgKg = flgKg; + } + + public long getFlgMt() { + return this.flgMt; + } + + public void setFlgMt(long flgMt) { + this.flgMt = flgMt; + } + + public long getFlgNr() { + return this.flgNr; + } + + public void setFlgNr(long flgNr) { + this.flgNr = flgNr; + } + + public static String getUdm(long l_flgUdm) { + if (l_flgUdm == 1L) + return "nr."; + if (l_flgUdm == 2L) + return "kg."; + if (l_flgUdm == 3L) + return "mt."; + if (l_flgUdm == 5L) + return "mq."; + if (l_flgUdm == 4L) + return "l."; + return ""; + } + + public String getUdm() { + return getUdm(getFlgUdm()); + } + + public String getDescrizioneCompleta() { + return getDescrizione() + " (" + getDescrizione() + ")"; + } + + public String getAFT() { + if (getId_tipologiaArticolo() == 0L) + return ""; + return getAFT(getFlgAFT()); + } + + public static final String getAFT(long l_flgAFT) { + switch ((int)l_flgAFT) { + case 0: + return "Articolo"; + case 1: + return "Filato"; + case 2: + return "Tessuto"; + case 3: + return "Confezione"; + } + return "??"; + } + + public long getFlgAFT() { + return this.flgAFT; + } + + public void setFlgAFT(long flgAFT) { + this.flgAFT = flgAFT; + } + + public boolean useDescLangTables() { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipologiaArticoloCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipologiaArticoloCR.java new file mode 100644 index 00000000..e4971c2d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/TipologiaArticoloCR.java @@ -0,0 +1,81 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.io.Serializable; + +public class TipologiaArticoloCR extends CRAdapter implements Serializable { + private long id_tipologiaArticolo; + + private String descrizione; + + private long flgUdm; + + private long flgKg; + + private long flgMt; + + private long flgNr; + + public TipologiaArticoloCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipologiaArticoloCR() {} + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public long getId_tipologiaArticolo() { + return this.id_tipologiaArticolo; + } + + public void setId_tipologiaArticolo(long id_tipologiaArticolo) { + this.id_tipologiaArticolo = id_tipologiaArticolo; + } + + public long getFlgUdm() { + return this.flgUdm; + } + + public void setFlgUdm(long flgUdm) { + this.flgUdm = flgUdm; + } + + public long getFlgKg() { + return this.flgKg; + } + + public void setFlgKg(long flgKg) { + this.flgKg = flgKg; + } + + public long getFlgMt() { + return this.flgMt; + } + + public void setFlgMt(long flgMt) { + this.flgMt = flgMt; + } + + public long getFlgNr() { + return this.flgNr; + } + + public void setFlgNr(long flgNr) { + this.flgNr = flgNr; + } + + public String getUdm() { + return TipologiaArticolo.getUdm(getFlgUdm()); + } + + public static String getUdm(long l_flgUdm) { + return TipologiaArticolo.getUdm(l_flgUdm); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Vetrina.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Vetrina.java new file mode 100644 index 00000000..6b0580de --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Vetrina.java @@ -0,0 +1,77 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Vetrina extends DBAdapter implements Serializable { + private static final long serialVersionUID = 5892969804207775294L; + + private long id_vetrina; + + private String descrizione; + + public Vetrina(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Vetrina() {} + + public void setId_vetrina(long newId_vetrina) { + this.id_vetrina = newId_vetrina; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_vetrina() { + return this.id_vetrina; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(VetrinaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from VETRINA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public boolean useDescLangTables() { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/VetrinaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/VetrinaCR.java new file mode 100644 index 00000000..bfabf9f7 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/VetrinaCR.java @@ -0,0 +1,32 @@ +package it.acxent.art; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class VetrinaCR extends CRAdapter { + private long id_vetrina; + + private String descrizione; + + public VetrinaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public VetrinaCR() {} + + public void setId_vetrina(long newId_vetrina) { + this.id_vetrina = newId_vetrina; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_vetrina() { + return this.id_vetrina; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Wishlist.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Wishlist.java new file mode 100644 index 00000000..ea8cec68 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/Wishlist.java @@ -0,0 +1,325 @@ +package it.acxent.art; + +import it.acxent.anag.Users; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Time; +import java.sql.Timestamp; + +public class Wishlist extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1594898932312L; + + private long id_wishlist; + + private long id_users; + + private long id_articolo; + + private long id_articoloVariante; + + private long id_articoloTaglia; + + private long flgAbilitaAvviso; + + private double prezzoWL; + + private Date dataWL; + + private Time oraWL; + + private double prezzoUltimoAvviso; + + private long dispoLevelWL; + + private long dispoLevelUltimoAvviso; + + private Timestamp tmstUltimoAvviso; + + private Users users; + + private Articolo articolo; + + private ArticoloVariante articoloVariante; + + private ArticoloTaglia articoloTaglia; + + public Wishlist(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Wishlist() {} + + public void setId_wishlist(long newId_wishlist) { + this.id_wishlist = newId_wishlist; + } + + public void setId_users(long newId_users) { + this.id_users = newId_users; + setUsers(null); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setId_articoloVariante(long newId_articoloVariante) { + this.id_articoloVariante = newId_articoloVariante; + setArticoloVariante(null); + } + + public void setId_articoloTaglia(long newId_articoloTaglia) { + this.id_articoloTaglia = newId_articoloTaglia; + setArticoloTaglia(null); + } + + public void setFlgAbilitaAvviso(long newFlgAbilitaAvviso) { + this.flgAbilitaAvviso = newFlgAbilitaAvviso; + } + + public void setPrezzoWL(double newPrezzoWL) { + this.prezzoWL = newPrezzoWL; + } + + public void setDataWL(Date newDataWL) { + this.dataWL = newDataWL; + } + + public void setOraWL(Time newOraWL) { + this.oraWL = newOraWL; + } + + public void setPrezzoUltimoAvviso(double newPrezzoUltimoAvviso) { + this.prezzoUltimoAvviso = newPrezzoUltimoAvviso; + } + + public void setTmstUltimoAvviso(Timestamp newTmstUltimoAvviso) { + this.tmstUltimoAvviso = newTmstUltimoAvviso; + } + + public long getId_wishlist() { + return this.id_wishlist; + } + + public long getId_users() { + return this.id_users; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public long getId_articoloTaglia() { + return this.id_articoloTaglia; + } + + public long getFlgAbilitaAvviso() { + return this.flgAbilitaAvviso; + } + + public double getPrezzoWL() { + return this.prezzoWL; + } + + public Date getDataWL() { + return this.dataWL; + } + + public Time getOraWL() { + return this.oraWL; + } + + public double getPrezzoUltimoAvvisoIva() { + return conIva(getPrezzoUltimoAvviso(), (double)getArticolo().getIva().getAliquota()); + } + + public Timestamp getTmstUltimoAvviso() { + return this.tmstUltimoAvviso; + } + + public void setUsers(Users newUsers) { + this.users = newUsers; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users()); + return this.users; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public void setArticoloVariante(ArticoloVariante newArticoloVariante) { + this.articoloVariante = newArticoloVariante; + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante()); + return this.articoloVariante; + } + + public void setArticoloTaglia(ArticoloTaglia newArticoloTaglia) { + this.articoloTaglia = newArticoloTaglia; + } + + public ArticoloTaglia getArticoloTaglia() { + this.articoloTaglia = (ArticoloTaglia)getSecondaryObject(this.articoloTaglia, ArticoloTaglia.class, getId_articoloTaglia()); + return this.articoloTaglia; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(WishlistCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from WISHLIST AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByUserItem(long l_id_users, Wishlist item) { + String s_Sql_Find = "select A.* from WISHLIST AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_users=" + l_id_users); + wc.addWc("A.id_articolo=" + item.getId_articolo()); + if (item.getId_articoloVariante() == 0L) { + wc.addWc("(A.id_articoloVariante is null or A.id_articoloVariante=0)"); + } else { + wc.addWc("A.id_articoloVariante=" + item.getId_articoloVariante()); + } + if (item.getId_articoloTaglia() == 0L) { + wc.addWc("(A.id_articoloTaglia is null or A.id_articoloTaglia=0)"); + } else { + wc.addWc("A.id_articoloTaglia=" + item.getId_articoloTaglia()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public double getPrezzoWLIva() { + return conIva(getPrezzoWL(), (double)getArticolo().getIva().getAliquota()); + } + + public double getPrezzoUltimoAvviso() { + return (this.prezzoUltimoAvviso == 0.0D) ? getPrezzoWL() : this.prezzoUltimoAvviso; + } + + public long getDispoLevel() { + if (getId_articoloTaglia() > 0L) + return (long)getArticoloTaglia().getDispoLevel(); + if (getId_articoloVariante() > 0L) + return (long)getArticoloVariante().getDispoLevel(); + return (long)getArticolo().getDispoLevel(); + } + + public long getId_item() { + if (getId_articoloTaglia() > 0L) + return getId_articoloTaglia(); + if (getId_articoloVariante() > 0L) + return getId_articoloVariante(); + return getId_articolo(); + } + + public String getCCLinkDettaglio(ArticoloCR CR) { + return getArticolo().getCCLinkDettaglio(CR); + } + + public long getFlgPrezzoModificato() { + if (getId_wishlist() == 0L) + return 0L; + if (getPrezzoUltimoAvviso() < getArticolo().getPrezzoPubblico(getUsers().getClifor())) + return -1L; + if (getPrezzoUltimoAvviso() > getArticolo().getPrezzoPubblico(getUsers().getClifor())) + return 1L; + if (getPrezzoUltimoAvviso() == getArticolo().getPrezzoPubblico(getUsers().getClifor())) + return 0L; + return 0L; + } + + public boolean isDispoLevelModificata() { + if (getId_wishlist() == 0L) + return false; + if (getDispoLevelUltimoAvviso() != (long)getArticolo().getDispoLevel()) + return true; + return false; + } + + public Vectumerator findByUser(long l_id_users, boolean conAvviso) { + String s_Sql_Find = "select A.* from WISHLIST AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_users=" + l_id_users); + if (conAvviso) + wc.addWc("A.flgAbilitaAvviso=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getDispoLevelWL() { + return this.dispoLevelWL; + } + + public void setDispoLevelWL(long dispoLevelWL) { + this.dispoLevelWL = dispoLevelWL; + } + + public long getDispoLevelUltimoAvviso() { + return this.dispoLevelUltimoAvviso; + } + + public void setDispoLevelUltimoAvviso(long dispoLevelUltimoAvviso) { + this.dispoLevelUltimoAvviso = dispoLevelUltimoAvviso; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/WishlistCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/WishlistCR.java new file mode 100644 index 00000000..befd34a5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/WishlistCR.java @@ -0,0 +1,185 @@ +package it.acxent.art; + +import it.acxent.anag.Users; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import java.sql.Date; +import java.sql.Time; +import java.sql.Timestamp; + +public class WishlistCR extends CRAdapter { + private static final long serialVersionUID = 7453705089191781116L; + + private long id_wishlist; + + private long id_users; + + private long id_articolo; + + private long id_articoloVariante; + + private long id_articoloTaglia; + + private long flgAbilitaAvviso; + + private double prezzoWL; + + private Date dataWL; + + private Time oraWL; + + private double prezzoUltimoAvviso; + + private Timestamp tmstUltimoAvviso; + + private Users users; + + private Articolo articolo; + + private ArticoloVariante articoloVariante; + + private ArticoloTaglia articoloTaglia; + + public WishlistCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public WishlistCR() {} + + public void setId_wishlist(long newId_wishlist) { + this.id_wishlist = newId_wishlist; + } + + public void setId_users(long newId_users) { + this.id_users = newId_users; + setUsers(null); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setId_articoloVariante(long newId_articoloVariante) { + this.id_articoloVariante = newId_articoloVariante; + setArticoloVariante(null); + } + + public void setId_articoloTaglia(long newId_articoloTaglia) { + this.id_articoloTaglia = newId_articoloTaglia; + setArticoloTaglia(null); + } + + public void setFlgAbilitaAvviso(long newFlgAbilitaAvviso) { + this.flgAbilitaAvviso = newFlgAbilitaAvviso; + } + + public void setPrezzoWL(double newPrezzoWL) { + this.prezzoWL = newPrezzoWL; + } + + public void setDataWL(Date newDataWL) { + this.dataWL = newDataWL; + } + + public void setOraWL(Time newOraWL) { + this.oraWL = newOraWL; + } + + public void setPrezzoUltimoAvviso(double newPrezzoUltimoAvviso) { + this.prezzoUltimoAvviso = newPrezzoUltimoAvviso; + } + + public void setTmstUltimoAvviso(Timestamp newTmstUltimoAvviso) { + this.tmstUltimoAvviso = newTmstUltimoAvviso; + } + + public long getId_wishlist() { + return this.id_wishlist; + } + + public long getId_users() { + return this.id_users; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public long getId_articoloTaglia() { + return this.id_articoloTaglia; + } + + public long getFlgAbilitaAvviso() { + return this.flgAbilitaAvviso; + } + + public double getPrezzoWL() { + return this.prezzoWL; + } + + public Date getDataWL() { + return this.dataWL; + } + + public Time getOraWL() { + return this.oraWL; + } + + public double getPrezzoUltimoAvviso() { + return this.prezzoUltimoAvviso; + } + + public Timestamp getTmstUltimoAvviso() { + return this.tmstUltimoAvviso; + } + + public void setUsers(Users newUsers) { + this.users = newUsers; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, + + getId_users()); + return this.users; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + + getId_articolo()); + return this.articolo; + } + + public void setArticoloVariante(ArticoloVariante newArticoloVariante) { + this.articoloVariante = newArticoloVariante; + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, + + getId_articoloVariante()); + return this.articoloVariante; + } + + public void setArticoloTaglia(ArticoloTaglia newArticoloTaglia) { + this.articoloTaglia = newArticoloTaglia; + } + + public ArticoloTaglia getArticoloTaglia() { + this.articoloTaglia = (ArticoloTaglia)getSecondaryObject(this.articoloTaglia, ArticoloTaglia.class, + + getId_articoloTaglia()); + return this.articoloTaglia; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/_ArtAdapter.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/_ArtAdapter.java new file mode 100644 index 00000000..d2cc8729 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/_ArtAdapter.java @@ -0,0 +1,32 @@ +package it.acxent.art; + +import it.acxent.anag._AnagAdapter; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; + +public class _ArtAdapter extends _AnagAdapter { + public static final long SF_BOZZA = 0L; + + public static final long SF_EMESSA = 1L; + + public static final long SF_REG_IVA = 2L; + + protected static ApplParmFull ap2; + + public _ArtAdapter() {} + + public _ArtAdapter(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + protected void deleteCascade() {} + + protected ApplParmFull getAp2() { + if (ap2 == null) { + ApplParm apx = new ApplParm(getApFull().getParm("DBDRIVER2").getNumeroInt(), getApFull().getParm("DBNAME2").getTesto(), + getApFull().getParm("USER2").getTesto(), getApFull().getParm("PASSWORD2").getTesto()); + ap2 = new ApplParmFull(apx); + } + return ap2; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/json/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/json/package-info.java new file mode 100644 index 00000000..ba2eccad --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/json/package-info.java @@ -0,0 +1 @@ +package it.acxent.art.json; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ArticoloSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ArticoloSvlt.java new file mode 100644 index 00000000..e4c17669 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ArticoloSvlt.java @@ -0,0 +1,1971 @@ +package it.acxent.art.servlet; + +import it.acxent.anag.Fornitore; +import it.acxent.anag.Iva; +import it.acxent.anag.Listino; +import it.acxent.anag.ListinoArticolo; +import it.acxent.anag.MagFisico; +import it.acxent.art.Accessorio; +import it.acxent.art.AllegatoArticolo; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloArticoloComponente; +import it.acxent.art.ArticoloCR; +import it.acxent.art.ArticoloComponente; +import it.acxent.art.ArticoloFornitore; +import it.acxent.art.ArticoloNazione; +import it.acxent.art.ArticoloProgettista; +import it.acxent.art.ArticoloTaglia; +import it.acxent.art.ArticoloUsato; +import it.acxent.art.ArticoloVariante; +import it.acxent.art.CTipo; +import it.acxent.art.Caratteristica; +import it.acxent.art.CaratteristicaArticolo; +import it.acxent.art.CaratteristicaArticoloKey; +import it.acxent.art.Colore; +import it.acxent.art.Kit; +import it.acxent.art.Lista; +import it.acxent.art.Marca; +import it.acxent.art.RegistroUsato; +import it.acxent.art.Rivalutazione; +import it.acxent.art.StatoUsato; +import it.acxent.art.StatoUsatoCR; +import it.acxent.art.TabellaTaglia; +import it.acxent.art.Taglia; +import it.acxent.art.TipoAccessorio; +import it.acxent.art.TipoAllegatoArticolo; +import it.acxent.art.Vetrina; +import it.acxent.cc.ArticoloBulkUpdate; +import it.acxent.cc.Attivita; +import it.acxent.cc.CCImport; +import it.acxent.common.TableDesc; +import it.acxent.contab.Movimento; +import it.acxent.contab.MovimentoCR; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.RigaDocumentoCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AddImgSvlt; +import it.acxent.tex.anag.ArticoloArticoloTessuto; +import it.acxent.tex.anag.ArticoloTessutoColore; +import it.acxent.util.AbMessages; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import it.acxent.www.Sitemap; +import java.io.File; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.json.JSONObject; + +@WebServlet(urlPatterns = {"/admin/art/Articolo.abl"}) +public class ArticoloSvlt extends _MagSvlt implements AddImgSvlt { + private static final long serialVersionUID = 3690785872840549719L; + + protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = (Articolo)l_bean; + req.setAttribute("nf0", getApFull(req).getNf0()); + if (bean.getTipo().getFlgUsaVarianti() == 0L && bean.getTipo().getFlgUsaTaglia() == 2L) { + req.setAttribute("listaTagliePerTipo", new Taglia(apFull) + .findTaglieByTipoTaglia(bean.getTipo().getTipoTaglia().getId_tipoTaglia())); + req.setAttribute("listaTaglieArticolo", new ArticoloTaglia(apFull).findByArticolo(bean.getId_articolo())); + req.setAttribute("listaTabellaTaglie", new TabellaTaglia(apFull).findAll()); + if (bean.getId_tipoTaglia() > 0L) + req.setAttribute("listaMisure", bean.getTabellaTaglia().getTagliaMisure()); + } + req.setAttribute("listaMarche", new Marca(apFull).findAll()); + req.setAttribute("listaVetrine", new Vetrina(apFull).findAll()); + req.setAttribute("listaIva", new Iva(apFull).findAll()); + if (bean.getFlgUsato() > 0L) + req.setAttribute("listaArticoliUsato", new ArticoloUsato(apFull).findByArticolo(bean.getId_articolo(), 0, 0)); + if (bean.getId_tipo() != 0L) + req.setAttribute("listaCaratteristiche", new CTipo(apFull).findCaratteristicheByTipo(bean.getId_tipo(), false, 0, 0)); + req.setAttribute("listaCaratteristicheArticolo", bean.getCaratteristicheArticolo()); + req.setAttribute("listaFornitori", new Fornitore(apFull).findAll()); + req.setAttribute("listaArticoloFornitori", bean.getFornitori()); + req.setAttribute("listaProgettisti", new Fornitore(apFull).findProgettisti()); + req.setAttribute("listaArticoloProgettista", bean.getProgettistiArticolo()); + req.setAttribute("listaArticoliVariante", bean.findArticoliVarianti(-1L, -1L)); + RigaDocumentoCR CRD = new RigaDocumentoCR(); + CRD.setId_articolo(bean.getId_articolo()); + CRD.setFlgTipoMagazzino(1L); + RigaDocumento rd = new RigaDocumento(apFull); + Vectumerator vecRd = rd.findMagSaldiArticoloVarianteTagliaByCR(CRD, 0, 0); + req.setAttribute("listaArticoliVarianteMovimentoRD", vecRd); + if (bean.getTipo().getFlgAccessori() == 1L) { + req.setAttribute("listaTipiAccessorio", new TipoAccessorio(apFull).findAll()); + req.setAttribute("listaAccessori", bean.getAccessori()); + } + if (bean.getFlgKit() == 1L) + req.setAttribute("listaKit", bean.getKitAssociati()); + if (bean.getTipo().getFlgRivalutazioni() == 1L) + req.setAttribute("listaRivalutazioni", bean.getRivalutazioni()); + if (bean.getTipo().getFlgAllegati() == 1L) { + req.setAttribute("listaAllegati", bean.getAllegati(0L)); + req.setAttribute("listaTipiAllegatoArticolo", new TipoAllegatoArticolo(apFull).findAll()); + } + req.setAttribute("listaDisponibilita", bean.getDisponibilitaMovimentoM()); + req.setAttribute("listaDisponibilitaRD", bean.getDisponibilitaMovimento()); + req.setAttribute("listaListini", new Listino(apFull).findAll()); + req.setAttribute("listaListiniArticolo", new ListinoArticolo(apFull).findPrezziByArticolo(bean.getId_articolo())); + if (bean.getTipo().getFlgUsaVarianti() == 1L) + req.setAttribute("listaArticoloVarianti", new ArticoloVariante(apFull).findByArticoloTessuti(bean.getId_articolo(), 0, 0)); + if (bean.getTipo().getFlgComponenti() == 1L) { + req.setAttribute("listaArticoliComponenti", bean.findArticoliComponenti()); + if (bean.getFlgArticoloComponente() == 1L) { + req.setAttribute("listaArticoliByComponenti", new ArticoloArticoloComponente(apFull) + .findByArticoloComponente(bean.getId_articolo())); + } else { + req.setAttribute("listaComponentiArticolo", new ArticoloArticoloComponente(apFull).findByArticolo(bean.getId_articolo())); + } + } + req.setAttribute("mag_fisico", new MagFisico(apFull)); + if (bean.getTipo().getFlgAFT() == 3L) { + req.setAttribute("listaArticoliTessutoBase", bean.findArticoliTessuto()); + req.setAttribute("listaColoriBase", new Colore(apFull).findAll()); + } + req.setAttribute("listaListino", new Listino(apFull).findNoListinoBase()); + req.setAttribute("listaStatoUsato", new StatoUsato(apFull).findByCR(new StatoUsatoCR(), 0, 0)); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaMarche", new Marca(apFull).findAll()); + req.setAttribute("listaTipiAccessorio", new TipoAccessorio(apFull).findAll()); + req.setAttribute("listaVetrine", new Vetrina(apFull).findAll()); + req.setAttribute("listaTaglie", new Taglia(apFull).findAll()); + req.setAttribute("mag_fisico", new MagFisico(apFull)); + req.setAttribute("listaMagFisico", new MagFisico(getApFull(req)).findAll()); + Attivita attivita = Attivita.getDefaultInstance(getApFull(req)); + if (attivita.isGoogleMerchant()) + req.setAttribute("listaFileNameGoogle", attivita.findGoogleNomiFileFeed()); + req.setAttribute("listaStatoUsato", new StatoUsato(apFull).findByCR(new StatoUsatoCR(), 0, 0)); + req.setAttribute("listaListino", new Listino(apFull).findNoListinoBase()); + req.setAttribute("listaIva", new Iva(apFull).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Articolo(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + ArticoloCR CR = new ArticoloCR(getApFull(req)); + TableDesc td = new TableDesc(getApFull(req)); + td.findByTabellaColonna("ARTICOLO", "flgEscludiWeb"); + if (!td.getValoreDefaultCR().isEmpty()) + try { + CR.setFlgEscludiWeb(Long.valueOf(td.getValoreDefaultCR()).longValue()); + } catch (Exception e) {} + return CR; + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("nf0", apFull.getNf0()); + req.setAttribute("listaMarche", new Marca(apFull).findAll()); + req.setAttribute("listaIva", new Iva(apFull).findAll()); + req.setAttribute("listaVetrine", new Vetrina(apFull).findAll()); + Articolo bean = new Articolo(apFull); + bean.setId_iva(bean.getCodiceIvaVendStd()); + bean.setFlgUsaVariantiArt(-1L); + bean.setFlgStampaEtichette(-1L); + req.setAttribute("bean", bean); + } + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean = new Articolo(apFull); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + req.setAttribute("id_articolo", String.valueOf(bean.getId_articolo())); + if (rp.getStatus() == true) { + if (getAct(req).equals("addCaratteristica")) { + CaratteristicaArticolo ca = new CaratteristicaArticolo(apFull); + long l_id_caratteristica = getRequestLongParameter(req, "id_caratteristica"); + if (l_id_caratteristica != 0L) { + fillObject(req, ca); + rp = bean.addCaratteristica(ca); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("delCaratteristica")) { + CaratteristicaArticolo ca = new CaratteristicaArticolo(apFull); + long l_id_caratteristica = getRequestLongParameter(req, "id_caratteristica"); + if (l_id_caratteristica != 0L) { + fillObject(req, ca); + bean.delCaratteristica(ca); + sendMessage(req, "Cancellazione Effettuata"); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("modCaratteristica")) { + CaratteristicaArticolo ca = new CaratteristicaArticolo(apFull); + if (getRequestLongParameter(req, "id_caratteristica") != 0L) { + fillObject(req, ca); + CaratteristicaArticoloKey caK = new CaratteristicaArticoloKey(ca.getId_articolo(), ca.getId_caratteristica()); + ca.findByPrimaryKey(caK); + req.setAttribute("beanCA", ca); + if (ca.getCaratteristica().getFlgTipoVal() == 6L) + req.setAttribute("listaLista", new Lista(apFull).findLista(bean.getId_caratteristica(), 0, 0)); + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("addFornitore")) { + ArticoloFornitore ca = new ArticoloFornitore(apFull); + if (!getRequestParameter(req, "id_clifor").equals("")) { + fillObject(req, ca); + rp = bean.addFornitore(ca); + if (rp.getStatus()) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, rp.getMsg()); + } + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("delFornitore")) { + ArticoloFornitore ca = new ArticoloFornitore(apFull); + if (getRequestLongParameter(req, "id_articoloFornitore") != 0L) { + fillObject(req, ca); + bean.delFornitore(ca); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("modFornitore")) { + ArticoloFornitore ca = new ArticoloFornitore(apFull); + if (getRequestLongParameter(req, "id_articoloFornitore") != 0L) { + fillObject(req, ca); + ca.findByPrimaryKey(ca.getId_articoloFornitore()); + req.setAttribute("beanAF", ca); + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("addRivalutazione")) { + Rivalutazione row = new Rivalutazione(apFull); + fillObject(req, row); + rp = bean.addRivalutazione(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delRivalutazione")) { + Rivalutazione row = new Rivalutazione(apFull); + if (getRequestLongParameter(req, "id_rivalutazione") != 0L) { + fillObject(req, row); + bean.delRivalutazione(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("modRivalutazione")) { + Rivalutazione row = new Rivalutazione(apFull); + if (getRequestLongParameter(req, "id_rivalutazione") != 0L) { + fillObject(req, row); + row.findByPrimaryKey(row.getId_rivalutazione()); + req.setAttribute("beanRIV", row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("delVariante")) { + ArticoloVariante av = new ArticoloVariante(apFull); + long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante"); + if (l_id_articoloVariante != 0L) { + fillObject(req, av); + bean.delArticoloVariante(av); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + req.setAttribute("currentTab", "#VAR"); + showBean(req, res); + } else if (getAct(req).equals("addAcce")) { + Accessorio accessorio = new Accessorio(apFull); + if (!getRequestParameter(req, "id_articolo").equals("")) { + fillObject(req, accessorio); + rp = bean.addAccessorio(accessorio); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("delAcce")) { + Accessorio accessorio = new Accessorio(getApFull(req)); + if (getRequestLongParameter(req, "id_accessorio") != 0L) { + fillObject(req, accessorio); + bean.delAccessorio(accessorio); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("copyAcce")) { + Accessorio accessorio = new Accessorio(apFull); + if (!getRequestParameter(req, "id_articolo").equals("")) { + fillObject(req, accessorio); + rp = bean.copyAccessoriDaArticolo(accessorio.getId_articoloAssociato()); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("addAllegato")) { + AllegatoArticolo row = new AllegatoArticolo(apFull); + fillObject(req, row); + rp = bean.addAllegato(row); + rp.append(creaFileAllegato(bean, req, res)); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delAllegato")) { + AllegatoArticolo row = new AllegatoArticolo(apFull); + fillObject(req, row); + rp = bean.delAllegato(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Allegato Cancellato"); + showBean(req, res); + } else if (getAct(req).equals("addArticoloTaglia")) { + ArticoloTaglia row = new ArticoloTaglia(apFull); + fillObject(req, row); + rp = bean.addArticoloTaglia(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delArticoloTaglia")) { + ArticoloTaglia row = new ArticoloTaglia(apFull); + if (getRequestLongParameter(req, "id_articoloTaglia") != 0L) { + fillObject(req, row); + bean.delTaglia(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("addArticoloComponente")) { + ArticoloComponente row = new ArticoloComponente(apFull); + fillObject(req, row); + rp = bean.addArticoloComponente(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delArticoloComponente")) { + ArticoloComponente row = new ArticoloComponente(apFull); + if (getRequestLongParameter(req, "id_articoloComponente") != 0L) { + fillObject(req, row); + bean.delArticoloComponente(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("addListinoArticolo")) { + ListinoArticolo row = new ListinoArticolo(apFull); + fillObject(req, row); + rp = bean.addListinoArticolo(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delListinoArticolo")) { + ListinoArticolo row = new ListinoArticolo(apFull); + if (getRequestLongParameter(req, "id_listinoArticolo") != 0L) { + fillObject(req, row); + bean.delListinoArticolo(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("riordina")) { + _riordinaCR(req, res); + } + } else { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected String newDispathcerAfterShowBean(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Articolo bean = (Articolo)beanA; + if (getAct(req).equals("refresh") && getRequestLongParameter(req, "id_caratteristica") != 0L) { + CaratteristicaArticolo ca = new CaratteristicaArticolo(getApFull(req)); + fillObject(req, ca); + if (ca.getCaratteristica().getFlgTipoVal() == 6L) + req.setAttribute("listaLista", new Lista(getApFull(req)).findLista(bean.getId_caratteristica(), 0, 0)); + req.setAttribute("beanCA", ca); + } else if (getAct(req).equals("refreshCC")) { + bean.caricaCaratteristiche(); + } else if (getAct(req).equals("refreshCCTipo")) { + bean.caricaCaratteristiche(); + } + req.setAttribute("bean", bean); + return ""; + } + + protected boolean isLoadImageServlet() { + return true; + } + + protected void print(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + try { + if (getAct(req).equals("lblArt")) { + long l_id = 0L; + Articolo bean = null; + l_id = getRequestLongParameter(req, "id_articolo"); + bean = new Articolo(apFull); + ArticoloCR CR = new ArticoloCR(); + fillObject(req, CR); + CR.setId_articolo(l_id); + if (getParm("LABEL_ART_A4_ZEBRA").getNumeroInt() == 0) { + sendPdf(res, bean.creaLabelArticoloA4Pdf(CR), "LabelA4 " + DBAdapter.getDayTimeTimestamp()); + } else { + sendPdf(res, bean.creaLabelArticoloZebraPdf(CR), "LabelZebra " + DBAdapter.getDayTimeTimestamp()); + } + } else if (getAct(req).equals("lblArtAcc")) { + long l_id = 0L; + Articolo bean = null; + l_id = getRequestLongParameter(req, "id_articolo"); + bean = new Articolo(apFull); + ArticoloCR CR = new ArticoloCR(); + fillObject(req, CR); + CR.setId_articolo(l_id); + if (getParm("LABEL_ART_A4_ZEBRA").getNumeroInt() == 0) { + sendPdf(res, bean.creaLabelArticoloAccA4Pdf(CR), "LabelA4ZebraAcc " + DBAdapter.getDayTimeTimestamp()); + } else { + sendPdf(res, bean.creaLabelArticoloAccZebraPdf(CR), "LabelZebraAcc " + DBAdapter.getDayTimeTimestamp()); + } + } else { + search(req, res); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected String getBeanPageName(HttpServletRequest req) { + long flgTipoRicerca = getRequestLongParameter(req, "flgTipoRicerca"); + if (flgTipoRicerca == 1L) + return super.getBeanPageName(req) + "Ser"; + return super.getBeanPageName(req); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("ebayAggiornaItemIdXX")) { + ebayAggiornaItemIdXX(req, res); + } else { + search(req, res); + } + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + super.search(req, res); + } + + public void _riordinoS(HttpServletRequest req, HttpServletResponse res) { + forceJspPageRelative("articoloR.jsp", req); + req.setAttribute("id_rigaDocumento", getRequestParameter(req, "id_rigaDocumento")); + showBean(req, res); + } + + public void _riordinaCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id_fornitore = getRequestLongParameter(req, "id_cliforR"); + long l_id = getRequestLongParameter(req, "id_articoloR"); + long l_id_av = getRequestLongParameter(req, "id_articoloVarianteR"); + double l_qta = getRequestDoubleParameter(req, "qtaR"); + ResParm rp = new ResParm(true); + if (l_id_fornitore == 0L || l_id == 0L) { + rp.setMsg("Errore! Codice fornitore o articolo non valido"); + rp.setStatus(false); + } else { + bean.findByPrimaryKey(l_id); + rp = Articolo.creaOrdine(bean, l_id_av, l_id_fornitore, l_qta); + } + if (rp.getStatus()) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + AbMessages.getMessage(getLocale(req), "SAVE_OK")); + } else { + sendMessage(req, rp.getErrMsg()); + } + String theForm = getRequestParameter(req, "theForm"); + if (theForm.equals("ricerca")) { + search(req, res); + } else { + showBean(req, res); + } + } + + protected ResParm creaFileAllegato(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + synchronized (this) { + ResParm rp = new ResParm(true, ""); + Articolo bean = (Articolo)beanA; + String targetDir = bean.getPathAllegato(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + "/" + targetDir + "_"; + Vectumerator completeFileNames = (Vectumerator)req.getAttribute("completeAttachName"); + Vectumerator fileNames = (Vectumerator)req.getAttribute("attachName"); + if (completeFileNames.hasMoreElements()) { + String sourceFile = (String)completeFileNames.nextElement(); + String fileName = (String)fileNames.elementAt(0); + targetFile = targetFile + targetFile; + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + } + return rp; + } + } + + public void _riordinaAVCR(HttpServletRequest req, HttpServletResponse res) { + long l_id_fornitore = getRequestLongParameter(req, "id_cliforR"); + String l_id_articoloVarianteRV = getRequestParameter(req, "id_articoloVarianteRV"); + String l_qtaArticoloVarianteRV = getRequestParameter(req, "qtaArticoloVarianteRV"); + ResParm rp = new ResParm(true); + if (l_id_fornitore == 0L || l_id_articoloVarianteRV.isEmpty()) { + rp.setMsg("Errore! Codice fornitore o articoli variante non validi"); + rp.setStatus(false); + } else { + StringTokenizer st = new StringTokenizer(l_id_articoloVarianteRV, ";"); + StringTokenizer stQta = new StringTokenizer(l_qtaArticoloVarianteRV, ";"); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + long l_id_articoloVariante = Long.valueOf(token); + ArticoloVariante bean = new ArticoloVariante(getApFull(req)); + bean.findByPrimaryKey(l_id_articoloVariante); + double l_qta = Double.valueOf(stQta.nextToken().replace(',', '.')); + if (l_qta > 0.0D) + rp = Articolo.creaOrdine(bean.getArticolo(), l_id_articoloVariante, l_id_fornitore, l_qta); + } + } + if (rp.getStatus()) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + AbMessages.getMessage(getLocale(req), "SAVE_OK")); + } else { + sendMessage(req, rp.getErrMsg()); + } + String theForm = getRequestParameter(req, "theForm"); + if (theForm.equals("ricerca")) { + search(req, res); + } else { + showBean(req, res); + } + } + + public void _viewM(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + setJspPageRelative("articoloViewMovimento.jsp", req); + MovimentoCR CR = new MovimentoCR(); + CR.setId_articolo(l_id_articolo); + CR.setFlgTipoMagazzino(1L); + Movimento mov = new Movimento(getApFull(req)); + Vectumerator vec = mov.findSaldiArticoloVarianteTagliaByCR(CR, 0, 0); + req.setAttribute("listaArticoliVarianteMovimento", vec); + req.setAttribute("bean", bean); + callJsp(req, res); + } + + public void _viewMRD(HttpServletRequest req, HttpServletResponse res) { + Vectumerator vec; + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante"); + setJspPageRelative("articoloViewMovimentoRD.jsp", req); + RigaDocumentoCR CR = new RigaDocumentoCR(); + CR.setId_articolo(l_id_articolo); + CR.setId_articoloVariante(l_id_articoloVariante); + CR.setFlgTipoMagazzino(1L); + RigaDocumento mov = new RigaDocumento(apFull); + if (bean.getTipo().getFlgUsaTagliaEffettivo() == 2L) { + if (bean.getFlgUsaVarianti() == 1L) { + vec = mov.findMagSaldiArticoloVarianteTagliaByCR(CR, 0, 0); + } else { + vec = mov.findMagSaldiArticoloTagliaByCR(CR, 0, 0); + } + } else { + vec = mov.findMagSaldiArticoloVarianteByCR(CR, 0, 0); + } + req.setAttribute("listaArticoliVarianteMovimentoRD", vec); + req.setAttribute("bean", bean); + if (l_id_articoloVariante > 0L) { + ArticoloVariante av = new ArticoloVariante(apFull); + av.findByPrimaryKey(l_id_articoloVariante); + req.setAttribute("beanAV", av); + } + req.setAttribute("mag_fisico", new MagFisico(apFull)); + callJsp(req, res); + } + + public void _fetchQtaMagazzinoHtml(HttpServletRequest req, HttpServletResponse res) { + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + Articolo bean = new Articolo(getApFull(req)); + bean.findByPrimaryKey(l_id_articolo); + sendHtmlMsgResponse(req, res, bean.getQuantitaMagazzinoMovimentoHtml()); + } + + public void _creaReportCsv(HttpServletRequest req, HttpServletResponse res) { + ArticoloCR CR = (ArticoloCR)req.getSession().getAttribute(getATTR_CRBEAN(req)); + Articolo bean = new Articolo(getApFull(req)); + bean.creaFileCvs(CR); + sendHtmlMsgResponse(req, res, "File export in formato cvs (Excel)"); + } + + public void _creaFileCvsAmazon(HttpServletRequest req, HttpServletResponse res) { + ArticoloCR CR = (ArticoloCR)req.getSession().getAttribute(getATTR_CRBEAN(req)); + Articolo bean = new Articolo(getApFull(req)); + long l_flgTipoExportAmazon = getRequestLongParameter(req, "flgTipoExportAmazon"); + if (l_flgTipoExportAmazon == 0L) { + bean.creaFileCvsAmazon(CR); + } else { + bean.creaFileCvsAmazonPrezzoQuantita(CR); + } + sendHtmlMsgResponse(req, res, "File amazon in formato cvs (Excel)"); + } + + public void _aggPrezzoVenditaImponibileCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + fillObject(req, bean); + double l_prezzoPubblicoImponibileNuovo = getRequestDoubleParameter(req, "imponibileNuovo"); + bean.findByPrimaryKey(l_id); + bean.aggiornaPrezzoPubblicoImponibile(l_prezzoPubblicoImponibileNuovo); + search(req, res); + } + + public void _addTaglie(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + fillObject(req, bean); + Vectumerator vec = new Taglia(getApFull(req)).findTaglieByTipoTaglia(bean.getTipo().getTipoTaglia().getId_tipoTaglia()); + while (vec.hasMoreElements()) { + Taglia at = (Taglia)vec.nextElement(); + ArticoloTaglia row = new ArticoloTaglia(getApFull(req)); + row.setId_articolo(bean.getId_articolo()); + row.setId_taglia(at.getId_taglia()); + bean.addArticoloTaglia(row); + } + showBean(req, res); + } + + public void _aggScortaMinCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + fillObject(req, bean); + double qtaRiordinoNuovo = bean.getQtaRiordinoNuovo(); + bean.findByPrimaryKey(l_id); + bean.aggiornaQtaRiordino(qtaRiordinoNuovo); + search(req, res); + } + + public void _delArticoloComponente(HttpServletRequest req, HttpServletResponse res) { + long l_id_articoloArticoloComponente = getRequestLongParameter(req, "id_articoloArticoloComponente"); + ArticoloArticoloComponente aac = new ArticoloArticoloComponente(getApFull(req)); + aac.findByPrimaryKey(l_id_articoloArticoloComponente); + if (aac.getDBState() == 1) + aac.delete(); + showBean(req, res); + } + + protected void otherCommandsOLD(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articolo"); + if (getCmd(req).equals("aggPrezzoVenditaCR")) { + l_id = getRequestLongParameter(req, "id_articoloMod"); + fillObject(req, bean); + double l_prezzoPubblicoNuovo = getRequestDoubleParameter(req, "prezzoPubblicoNuovo"); + double l_prezzoRivNuovo = getRequestDoubleParameter(req, "prezzoRivNuovo"); + bean.findByPrimaryKey(l_id); + bean.aggiornaPrezzoPubblicoERivalutazione(l_prezzoPubblicoNuovo, l_prezzoRivNuovo); + search(req, res); + } else if (getCmd(req).equals("aggScortaMinCR")) { + l_id = getRequestLongParameter(req, "id_articoloMod"); + fillObject(req, bean); + double qtaRiordinoNuovo = bean.getQtaRiordinoNuovo(); + bean.findByPrimaryKey(l_id); + bean.aggiornaQtaRiordino(qtaRiordinoNuovo); + search(req, res); + } else if (!getCmd(req).equals("riordinoS")) { + if (!getCmd(req).equals("riordinaCR")) + if (!getCmd(req).equals("riordinaAVCR")) + if (getCmd(req).equals("cambiaNascondi")) { + long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante"); + long l_flgNascondi = getRequestLongParameter(req, "flgNascondi"); + ArticoloVariante av = new ArticoloVariante(getApFull(req)); + av.findByPrimaryKey(l_id_articoloVariante); + if (av.getDBState() == 1) { + av.setFlgNascondi(l_flgNascondi); + av.save(); + } + showBean(req, res); + } else if (getCmd(req).equals("cambiaNOrd")) { + long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante"); + long l_flgNonOrdinabile = getRequestLongParameter(req, "flgNonOrdinabile"); + ArticoloVariante av = new ArticoloVariante(getApFull(req)); + av.findByPrimaryKey(l_id_articoloVariante); + if (av.getDBState() == 1) { + av.setFlgNonOrdinabile(l_flgNonOrdinabile); + av.save(); + } + showBean(req, res); + } else { + search(req, res); + } + } + } + + public void _cambiaNOrd(HttpServletRequest req, HttpServletResponse res) { + long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante"); + long l_flgNonOrdinabile = getRequestLongParameter(req, "flgNonOrdinabile"); + ArticoloVariante av = new ArticoloVariante(getApFull(req)); + av.findByPrimaryKey(l_id_articoloVariante); + if (av.getDBState() == 1) { + av.setFlgNonOrdinabile(l_flgNonOrdinabile); + av.save(); + } + showBean(req, res); + } + + protected ResParm afterDelete(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + return super.afterDelete(beanA, req, res); + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = (Articolo)beanA; + ResParm rp = new ResParm(true); + if (bean.getId_articolo() > 0L) { + ListinoArticolo labWWW = new ListinoArticolo(apFull); + fillObject(req, labWWW); + ListinoArticolo listinoArticoloBase = bean.getListinoArticoloBase(); + listinoArticoloBase.setId_articolo(bean.getId_articolo()); + listinoArticoloBase.setId_articoloVariante(labWWW.getId_articoloVariante()); + listinoArticoloBase.setId_listino(bean.getListinoBase().getId_listino()); + listinoArticoloBase.setAbbuonoPrezzoPubblicoLA(labWWW.getAbbuonoPrezzoPubblicoLA()); + listinoArticoloBase.setAbbuonoPrezzoPubblicoLA(labWWW.getAbbuonoPrezzoPubblicoLA()); + listinoArticoloBase.setDataScadenzaOffertaLA(labWWW.getDataScadenzaOffertaLA()); + listinoArticoloBase.setPercLA(labWWW.getPercLA()); + listinoArticoloBase.setPercLA1(labWWW.getPercLA1()); + listinoArticoloBase.setPercLA2(labWWW.getPercLA2()); + listinoArticoloBase.setPercLA3(labWWW.getPercLA3()); + listinoArticoloBase.setPrezzoLA(labWWW.getPrezzoLA()); + listinoArticoloBase.setPrezzoOffertaLA(labWWW.getPrezzoOffertaLA()); + listinoArticoloBase.setPercScontoOffertaLA(labWWW.getPercScontoOffertaLA()); + listinoArticoloBase.setPrezzoConIvaLA(labWWW.getPrezzoConIvaLA()); + rp = listinoArticoloBase.save(); + if (!rp.getStatus()) + sendMessage(req, rp.getMsg()); + bean.setPrezzoArticolo(null); + bean.setFlgAggGiacenza(0L); + req.setAttribute("bean", bean); + } + return rp; + } + + public void _cambiaNascondi(HttpServletRequest req, HttpServletResponse res) { + long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante"); + long l_flgNascondi = getRequestLongParameter(req, "flgNascondi"); + ArticoloVariante av = new ArticoloVariante(getApFull(req)); + av.findByPrimaryKey(l_id_articoloVariante); + if (av.getDBState() == 1) { + av.setFlgNascondi(l_flgNascondi); + av.save(); + } + showBean(req, res); + } + + public void _caricaCarattTipo(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + if (bean.getDBState() == 1) { + bean.caricaCaratteristiche(); + rp = new ResParm(true, "caratteristiche caricate"); + } else { + rp = new ResParm(false, "Articolo non trovato"); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _addArticoloComponente(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ArticoloArticoloComponente aac = new ArticoloArticoloComponente(getApFull(req)); + fillObject(req, aac); + aac.findByArticoloArticoloComponente(aac.getId_articolo(), aac.getId_articoloComponente()); + if (aac.getDBState() == 0) { + fillObject(req, aac); + rp = aac.save(); + } else { + rp = new ResParm(false, "Componente gia' inserito"); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _caricaCarattArti(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + long l_id_articoloSource = getRequestLongParameter(req, "id_articoloSource"); + bean.findByPrimaryKey(l_id_articolo); + if (bean.getDBState() == 1) { + bean.caricaCaratteristicheDaArticoloSource(l_id_articoloSource); + rp = new ResParm(true, "caratteristiche caricate"); + } else { + rp = new ResParm(false, "Articolo non trovato"); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _stampaCatalogo(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + ArticoloCR CR = new ArticoloCR(apFull); + fillObject(req, CR); + sendPdf(res, bean.creaCatalogoPdf(CR), "Catalogo_" + DBAdapter.getDayTimeTimestamp()); + } + + public void _delAllegato(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + AllegatoArticolo row = new AllegatoArticolo(apFull); + fillObject(req, row); + bean.delAllegato(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Allegato Cancellato"); + showBean(req, res); + } + + public void _reportPdf(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + int l_flgTipo = (int)getRequestLongParameter(req, "flgTipoReport"); + ArticoloCR CR = new ArticoloCR(apFull); + fillObject(req, CR); + sendPdf(res, bean.creaReportPdf(l_flgTipo, CR), CR.getTipoReport() + CR.getTipoReport()); + } + + public void _duplicaArticolo(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id); + if (bean.getDBState() == 1) { + Articolo beanDup = Articolo.duplica(bean); + if (beanDup != null) { + req.setAttribute("bean", beanDup); + sendMessage(req, "Articolo duplicato"); + } else { + sendMessage(req, "Errore! Impossibile duplicare l'articolo!"); + } + showBean(req, res); + } else { + sendMessage(req, "Errore! articolo non trovato!"); + showBean(req, res); + } + } + + public void _addKit(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + Kit kit = new Kit(getApFull(req)); + if (!getRequestParameter(req, "id_articolo").equals("")) { + fillObject(req, kit); + ResParm rp = bean.addKit(kit); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } + + public void _delProgettista(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + ArticoloProgettista row = new ArticoloProgettista(getApFull()); + fillObject(req, row); + ResParm rp = bean.delProgettista(row); + if (rp.getStatus()) { + sendMessage(req, "Progettista cancellato correttamente"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + public void _modProgettista(HttpServletRequest req, HttpServletResponse res) { + ArticoloProgettista row = new ArticoloProgettista(getApFull()); + long l_id_articoloProgettista = getRequestLongParameter(req, "id_articoloProgettista"); + row.findByPrimaryKey(l_id_articoloProgettista); + req.setAttribute("beanAP", row); + sendMessage(req, "Modifica Progettista"); + showBean(req, res); + } + + public void _addTessutoConfezione(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + ArticoloArticoloTessuto bean2 = new ArticoloArticoloTessuto(apFull); + fillObject(req, bean2); + if (bean2.getId_articoloArticoloTessuto() > 0L) { + bean2.findByPrimaryKey(bean2.getId_articoloArticoloTessuto()); + } else { + long l_id_colore = getRequestLongParameter(req, "id_coloreBase"); + if (l_id_colore == 0L) { + if (bean2.getId_articoloArticoloTessuto() == 0L) + fillObject(req, bean2); + } else { + ArticoloTessutoColore atc = new ArticoloTessutoColore(apFull); + atc.findByArticoloTessutoColore(bean2.getId_articoloTessuto(), l_id_colore); + if (atc.getId_articoloTessutoColore() == 0L) { + atc.setId_articoloTessuto(bean2.getId_articoloTessuto()); + atc.setId_colore(l_id_colore); + rp = atc.save(); + } + if (atc.getId_articoloTessutoColore() > 0L) + if (bean2.getId_articoloArticoloTessuto() == 0L) { + fillObject(req, bean2); + bean2.setId_articoloTessutoColore(atc.getId_articoloTessutoColore()); + } + } + } + if (bean2.getId_articoloTessuto() > 0L && bean2.getId_articolo() > 0L) { + Articolo articolo = new Articolo(apFull); + articolo.findByPrimaryKey(bean2.getId_articolo()); + Vectumerator vecAAT = articolo.findArticoliTessuto(); + if (!vecAAT.hasMoreElements()) + bean2.setFlgPrincipale(1L); + rp = bean2.save(); + } else { + rp = new ResParm(false, "Errore! Tessuto o articolo non selezionato correttamente"); + } + req.setAttribute("currentFocus", "descrizioneGreggio"); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _delTessutoConfezione(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + ArticoloArticoloTessuto bean2 = new ArticoloArticoloTessuto(apFull); + fillObject(req, bean2); + if (bean2.getId_articoloArticoloTessuto() > 0L) { + bean2.findByPrimaryKey(bean2.getId_articoloArticoloTessuto()); + rp = bean2.delete(); + } else { + rp = new ResParm(false, "Errore! Impossibile cancellare tessuto associato a confezione "); + } + req.setAttribute("currentFocus", "descrizioneGreggio"); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _impostaTessutoPrincipale(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + ArticoloArticoloTessuto bean2 = new ArticoloArticoloTessuto(apFull); + fillObject(req, bean2); + if (bean2.getId_articoloArticoloTessuto() > 0L) { + bean2.findByPrimaryKey(bean2.getId_articoloArticoloTessuto()); + bean2.setFlgPrincipale(1L); + rp = bean2.save(); + } else { + rp = new ResParm(false, "Errore! Impossibile cancellare tessuto associato a confezione "); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _addProgettista(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + ArticoloProgettista row = new ArticoloProgettista(getApFull()); + fillObject(req, row); + ResParm rp = bean.addProgettista(row); + if (rp.getStatus()) { + sendMessage(req, "Progettista aggiunto correttamente"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + public void _delKit(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + Kit kit = new Kit(getApFull(req)); + if (getRequestLongParameter(req, "id_kit") != 0L) { + fillObject(req, kit); + bean.delKit(kit); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } + + public void _stampaTulps(HttpServletRequest req, HttpServletResponse res) { + if (getAct(req).equals("tulps")) { + Articolo bean = new Articolo(getApFull(req)); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + sendPdf(res, bean.creaTulpsArticolo(false), "Tulps_" + bean.getId_articolo() + "_" + DBAdapter.getDayTimeTimestamp()); + } else if (getAct(req).equals("tulpsDef")) { + Articolo bean = new Articolo(getApFull(req)); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + sendPdf(res, bean.creaTulpsArticolo(true), "TulpsDef_" + bean.getId_articolo() + "_" + DBAdapter.getDayTimeTimestamp()); + } else if (getAct(req).equals("tulpsCR")) { + Articolo bean = new Articolo(getApFull(req)); + sendPdf(res, bean.creaTulps(false), "TulpsCR_" + DBAdapter.getDayTimeTimestamp()); + } else if (getAct(req).equals("tulpsCRDef")) { + Articolo bean = new Articolo(getApFull(req)); + sendPdf(res, bean.creaTulps(true), "TulpsCRDef_" + DBAdapter.getDayTimeTimestamp()); + } + } + + public void _delAcquistoUsato(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + ArticoloUsato row = new ArticoloUsato(getApFull()); + fillObject(req, row); + ResParm rp = bean.delArticoloUsato(row); + if (rp.getStatus()) { + sendMessage(req, "Acquisto ustato cancellato correttamente"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + public void _listinoArticoloMostra(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + long l_id_listino = getRequestLongParameter(req, "id_listino"); + ListinoArticolo la = new ListinoArticolo(apFull); + la.findByArticoloListino(l_id_articolo, l_id_listino); + la.setId_listino(l_id_listino); + la.setId_articolo(l_id_articolo); + req.setAttribute("bean", la); + setJspPageRelative("listinoArticolo.jsp", req); + callJsp(req, res); + } + + public void _listinoArticoloCancella(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + long l_id_listino = getRequestLongParameter(req, "id_listino"); + ListinoArticolo beanRow = new ListinoArticolo(apFull); + beanRow.findByArticoloListino(l_id_articolo, l_id_listino); + ResParm rp = beanRow.delete(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _listinoSalvaPrezzo(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + long l_id_listino = getRequestLongParameter(req, "id_listino"); + ListinoArticolo beanRow = new ListinoArticolo(apFull); + beanRow.findByArticoloListino(l_id_articolo, l_id_listino); + beanRow.setId_listino(l_id_listino); + beanRow.setId_articolo(l_id_articolo); + beanRow.setPrezzoLA(getRequestDoubleParameter(req, "_prezzoLA")); + beanRow.setPercLA(getRequestDoubleParameter(req, "_percLA")); + beanRow.setPercLA1(getRequestDoubleParameter(req, "_percLA1")); + beanRow.setPercLA2(getRequestDoubleParameter(req, "_percLA2")); + beanRow.setPercLA3(getRequestDoubleParameter(req, "_percLA3")); + beanRow.setDataScadenzaOffertaLA(getRequestDateParameter(req, "_dataScadenzaOffertaLA")); + beanRow.setPrezzoOffertaLA(getRequestDoubleParameter(req, "_prezzoOffertaLA")); + ResParm rp = beanRow.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _aggCostoNettoCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + fillObject(req, bean); + double l_prezzoPubblicoNuovo = getRequestDoubleParameter(req, "prezzoPubblicoNuovo"); + double l_prezzoRivNuovo = getRequestDoubleParameter(req, "prezzoRivNuovo"); + fillObject(req, bean); + double costoNetto = bean.getCostoNetto(); + bean.findByPrimaryKey(l_id); + bean.setCostoNuovo(costoNetto); + bean.aggiornaPrezzoNettoConCostoNuovo(); + search(req, res); + } + + public void _cancellaPrezzoBarrato(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + fillObject(req, bean); + bean.findByPrimaryKey(l_id); + bean.setPrezzoIvatoBarrato(0.0D); + bean.superSave(); + search(req, res); + } + + protected ResParm beforeSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + return super.beforeSave(beanA, req, res); + } + + public void _inventario(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + ResParm rp = new Articolo(getApFull(req)).creaFileInventarioCsv(CR); + if (rp.getStatus()) { + StringBuilder sb = new StringBuilder(); + String temp = CR.getFileName(); + sb.append("File " + temp + "
"); + sendHtmlMsgResponse(req, res, sb.toString()); + } else { + sendHtmlMsgResponse(req, res, "ERRORE! " + rp.getMsg()); + } + } + + public void _reportVendite(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + ResParm rp = new Articolo(getApFull(req)).creaFileReportVenditeCsv(CR); + if (rp.getStatus()) { + StringBuilder sb = new StringBuilder(); + String temp = CR.getFileName(); + sb.append("File " + temp + "
"); + sendHtmlMsgResponse(req, res, sb.toString()); + } else { + sendHtmlMsgResponse(req, res, "ERRORE! " + rp.getMsg()); + } + } + + public void _aggiornaCNuovo(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + fillObject(req, bean); + bean.findByPrimaryKey(l_id); + bean.aggiornaPrezzoNettoConCostoNuovo(); + search(req, res); + } + + public void _stampaListinoCR(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(apFull); + fillObject(req, CR); + Articolo bean = new Articolo(apFull); + fillObject(req, CR); + sendPdf(res, bean.creaListinoPdf(CR), "Listino_" + DBAdapter.getDayTimeTimestamp()); + } + + public void _creaFileSubitoCsv(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + ResParm rp = new Articolo(getApFull(req)).creaFileCvsSubito_it(CR); + if (rp.getStatus()) { + StringBuilder sb = new StringBuilder(); + String temp = CR.getFileName(); + sb.append("File " + temp + "
"); + sendHtmlMsgResponse(req, res, sb.toString()); + } else { + sendHtmlMsgResponse(req, res, "ERRORE! " + rp.getMsg()); + } + } + + public void _creaFileGoogleXml(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + ResParm rp = new Articolo(getApFull(req)).creaFileXmlGoogle(CR, false, false); + if (rp.getStatus()) { + StringBuilder sb = new StringBuilder(); + String temp = (String)rp.getReturnObj(); + sb.append("File " + temp + "
"); + sendHtmlMsgResponse(req, res, sb.toString()); + } else { + sendHtmlMsgResponse(req, res, "ERRORE! " + rp.getMsg()); + } + } + + public void _creaFileIdealoXml(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + ResParm rp = new Articolo(getApFull(req)).creaFileXmlIdealo(CR); + if (rp.getStatus()) { + StringBuilder sb = new StringBuilder(); + String temp = (String)rp.getReturnObj(); + sb.append("File " + temp + "
"); + sendHtmlMsgResponse(req, res, sb.toString()); + } else { + sendHtmlMsgResponse(req, res, "ERRORE! " + rp.getMsg()); + } + } + + public void _creaFileSitemapXml(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(apFull); + fillObject(req, CR); + CR.setLang(CR.getLangReadyForWeb()); + ResParm rp = new Sitemap(getApFull(req)).creaFileXmlSitemap(CR); + if (rp.getStatus()) { + StringBuilder sb = new StringBuilder(); + String temp = (String)rp.getReturnObj(); + sb.append("File " + temp + "
"); + sendHtmlMsgResponse(req, res, sb.toString()); + } else { + sendHtmlMsgResponse(req, res, "ERRORE! " + rp.getMsg()); + } + } + + public void _creaFileFacebookXml(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + ResParm rp = new Articolo(getApFull(req)).creaFileCsvFacebooke(CR); + if (rp.getStatus()) { + StringBuilder sb = new StringBuilder(); + String temp = CR.getFileName(); + sb.append("File " + temp + "
"); + sendHtmlMsgResponse(req, res, sb.toString()); + } else { + sendHtmlMsgResponse(req, res, "ERRORE! " + rp.getMsg()); + } + } + + public void _caricaIcecat(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + long l_id = getRequestLongParameter(req, "id_articolo"); + String l_flg = getRequestParameter(req, "flg"); + bean.findByPrimaryKey(l_id); + bean.setCurrentLang(getCurrentLang(req)); + if (bean.getId_articolo() > 0L) { + ResParm rp = bean.caricaIcecat(); + if (rp.getStatus()) { + sendMessage(req, "Catalogo caricato correttamente: " + rp.getMsg()); + } else { + sendMessage(req, "Errore nel caricamento catalogo ICECAST: " + rp.getMsg()); + } + } else { + sendMessage(req, "Attenzione! Articolo non trovato!"); + } + showBean(req, res); + } + + public void _aggPercRicaricoCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + fillObject(req, bean); + double l_percRicarico = getRequestDoubleParameter(req, "percRicarico"); + bean.findByPrimaryKey(l_id); + bean.setPercRicarico(l_percRicarico); + bean.superSave(); + search(req, res); + } + + public void _aggPrezzoVenditaCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + fillObject(req, bean); + double l_prezzoPubblicoNuovo = getRequestDoubleParameter(req, "prezzoPubblicoNuovo"); + double l_nuovoCostoNetto = getRequestDoubleParameter(req, "costoNetto"); + bean.findByPrimaryKey(l_id); + bean.aggiornaPrezzoPubblico(l_prezzoPubblicoNuovo, l_nuovoCostoNetto); + search(req, res); + } + + public void _creaRegistroUsato(HttpServletRequest req, HttpServletResponse res) { + RegistroUsato ru = new RegistroUsato(); + fillObject(req, ru); + Articolo bean = new Articolo(getApFull(req)); + sendPdf(res, bean.creaRegistroDaVidimare(ru), "RegistroUsato-" + DBAdapter.getDayTimeTimestamp()); + } + + public void _impostaPrecedentePrezzoBarrato(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + fillObject(req, bean); + double l_prezzoPubblicoNuovo = getRequestDoubleParameter(req, "prezzoPubblicoNuovo"); + bean.findByPrimaryKey(l_id); + bean.setPrezzoIvatoBarrato(bean.getImponibilePrecedenteIva()); + bean.superSave(); + search(req, res); + } + + public void _ebayAggiornaItemId(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id); + ResParm rp = bean.save(); + if (rp.getStatus()) { + rp = bean.retrieveEbayItemId(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + showBean(req, res); + } + + public void ebayAggiornaItemIdXX(HttpServletRequest req, HttpServletResponse res) { + _ebayAggiornaItemId(req, res); + } + + public void _impostaSPPrezzoBarrato(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + fillObject(req, bean); + bean.findByPrimaryKey(l_id); + bean.setPrezzoIvatoBarrato(bean.getStreetPriceIva()); + bean.superSave(); + search(req, res); + } + + public void _cambiaVetrina(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + long l_id_vetrina = getRequestLongParameter(req, "id_vetrinaMod"); + bean.findByPrimaryKey(l_id); + bean.setId_vetrina(l_id_vetrina); + ResParm rp = bean.superSave(); + if (rp.getStatus()) { + sendMessage(req, "Aggiornamento Effettuato"); + } else { + sendMessage(req, "Errore! " + rp.getMsg()); + } + search(req, res); + } + + public void _aggCostoNettoDet(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + bean.setCostoNuovo(bean.getCostoNetto()); + bean.save(); + bean.aggiornaPrezzoNettoConCostoNuovo(); + showBean(req, res); + } + + public void _azzeraQuantita(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + bean.save(); + ResParm rp = bean.azzeraQuantita(); + if (rp.getStatus()) { + sendMessage(req, "Quantità azzerata"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + public void _cambiaStato(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + long l_flgEscludiWeb = getRequestLongParameter(req, "flgEscludiWebCS"); + long l_flgAzzeraQuantita = getRequestLongParameter(req, "flgAzzeraQuantita"); + bean.findByPrimaryKey(l_id); + if (bean.getId_articolo() > 0L) { + bean.setFlgEscludiWebArt(l_flgEscludiWeb); + if (l_flgAzzeraQuantita == 1L) { + rp = bean.azzeraQuantita(); + } else { + rp = bean.superSave(); + } + } else { + rp = new ResParm(false, "Errore! Articolo non selezionato!"); + } + if (rp.getStatus()) { + sendMessage(req, "Quantità azzerata"); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } + + public void _addAcquistoUsato(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + ArticoloUsato row = new ArticoloUsato(getApFull()); + fillObject(req, row); + ResParm rp = bean.addArticoloUsato(row); + if (rp.getStatus()) { + sendMessage(req, "Acquisto usato aggiunto correttamente"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + public void _aggPrezzoVenditaAStreetPriceCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + fillObject(req, bean); + double l_prezzoPubblicoNuovo = getRequestDoubleParameter(req, "prezzoPubblicoNuovo"); + bean.findByPrimaryKey(l_id); + bean.aggiornaPrezzoPubblicoImponibile(bean.getStreetPrice()); + search(req, res); + } + + public void _ebayUpdateItem(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + ResParm rp = bean.save(); + if (rp.getStatus()) { + rp = bean.ebayCreateUpdateItem(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + showBean(req, res); + } + + public void _ebayRemoveOffer(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id); + ResParm rp = bean.ebayRemoveOffer(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + showBean(req, res); + } + + public void _ebayPublish(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + ResParm rp = bean.save(); + if (rp.getStatus()) { + rp = bean.ebayPublishFull(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + showBean(req, res); + } + + public void _ebayPublishOnly(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + ResParm rp = bean.save(); + if (rp.getStatus()) { + rp = bean.ebayPublishFull(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + showBean(req, res); + } + + public void _ebayRemoveItem(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id); + ResParm rp = bean.ebayDeleteInventoryItem(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + showBean(req, res); + } + + public void _impostaPrezzoBarratoDet(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + bean.findByPrimaryKey(l_id); + bean.setPrezzoIvatoBarrato(bean.getStreetPriceIva()); + bean.superSave(); + showBean(req, res); + } + + public void _ebayUpdateItemCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + bean.findByPrimaryKey(l_id); + ResParm rp = bean.save(); + if (rp.getStatus()) { + rp = bean.ebayCreateUpdateItem(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + search(req, res); + } + + public void _ebayRemoveItemCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + bean.findByPrimaryKey(l_id); + ResParm rp = bean.ebayDeleteInventoryItem(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + search(req, res); + } + + public void _ebayRemoveOfferCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + bean.findByPrimaryKey(l_id); + ResParm rp = bean.ebayRemoveOffer(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + search(req, res); + } + + public void _ebayPublishCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloMod"); + bean.findByPrimaryKey(l_id); + ResParm rp = bean.ebayPublishFull(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + search(req, res); + } + + public void _fetchCaratteristica(HttpServletRequest req, HttpServletResponse res) { + long l_id = getRequestLongParameter(req, "id_caratteristica"); + Caratteristica bean = new Caratteristica(getApFull(req)); + bean.findByPrimaryKey(l_id); + JSONObject jo = new JSONObject(); + jo.put("flgTipoVal", String.valueOf(bean.getFlgTipoVal())); + if (bean.getFlgTipoVal() == 6L) + jo.put("select", bean.getOptionListaHtml(getLang(req))); + sendHtmlMsgResponse(req, res, jo.toString()); + } + + public void _sendGoogleViaFtp(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + CCImport bean = new CCImport(); + ResParm rp = bean.startGoogleFtp(apFull, CR); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _startAllineaEbay(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + Articolo bean = new Articolo(apFull); + ResParm rp = bean.startThreadAllineaEbay(apFull, CR); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _startAllineaAmz(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + Articolo bean = new Articolo(apFull); + ResParm rp = bean.startThreadAllineaAmz2(apFull, CR); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _startThreadPostItemOfferAmz(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + Articolo bean = new Articolo(apFull); + ResParm rp = bean.startThreadPostItemOfferAmz(apFull, CR); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _startCancellazioneMassiva(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + Articolo bean = new Articolo(apFull); + ResParm rp = bean.startThreadCancellazioneMassiva(apFull, CR); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _cambiaFlg(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + long l_id = getRequestLongParameter(req, "id_articolo"); + String l_flg = getRequestParameter(req, "flg"); + bean.findByPrimaryKey(l_id); + ResParm rp = bean.cambiaFlg(l_flg); + if (rp.getStatus()) { + sendMessage(req, "Aggiornamento Effettuato"); + } else { + sendMessage(req, "Errore! " + rp.getMsg()); + } + req.setAttribute("id_articolo", "0"); + search(req, res); + } + + public void _bulkUpdate(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloBulkUpdate abu = new ArticoloBulkUpdate(apFull); + ArticoloCR CR = new ArticoloCR(apFull); + fillObject(req, CR); + fillObject(req, abu); + ResParm rp = abu.starBulkUpdate(apFull, CR, false); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _addArticoloNazione(HttpServletRequest req, HttpServletResponse res) { + ArticoloNazione row = new ArticoloNazione(getApFull(req)); + fillObject(req, row); + row.findByArticoloNazione(row.getId_articolo(), row.getId_nazione()); + req.setAttribute("id_articoloNazione", Long.valueOf(row.getId_articoloNazione())); + fillObject(req, row); + ResParm rp = row.save(); + if (rp.getStatus()) + rp = new ResParm(true, "Modificata/Aggiunta Nazione Costo"); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _modArticoloNazione(HttpServletRequest req, HttpServletResponse res) { + long l_id_articoloNazione = getRequestLongParameter(req, "id_articoloNazione"); + ArticoloNazione row = new ArticoloNazione(getApFull(req)); + row.findByPrimaryKey(l_id_articoloNazione); + req.setAttribute("beanAN", row); + showBean(req, res); + } + + public void _delArticoloNazione(HttpServletRequest req, HttpServletResponse res) { + long l_id_articoloNazione = getRequestLongParameter(req, "id_articoloNazione"); + ArticoloNazione row = new ArticoloNazione(getApFull(req)); + row.findByPrimaryKey(l_id_articoloNazione); + if (row.getDBState() == 1) + row.delete(); + showBean(req, res); + } + + public void _addAllegato(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + String fileName = getRequestParameter(req, "fileNameOnServer_1"); + String targetDir = bean.getPathAllegato(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + "/" + targetDir + "_" + bean.getId_articolo(); + String sourceFile = getPathTmpFull() + getPathTmpFull(); + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + AllegatoArticolo row = new AllegatoArticolo(apFull); + fillObject(req, row); + row.setNomeFile(fileName); + ResParm rp = bean.addAllegato(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _resetImpression(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloVariante av = new ArticoloVariante(apFull); + av.resetImpression(); + sendMessage(req, "Impression resettate!!"); + search(req, res); + } + + public void _creaFileTrovaprezziXml(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + ResParm rp = new Articolo(getApFull(req)).creaFileXmlTrovaprezzi(CR); + if (rp.getStatus()) { + StringBuilder sb = new StringBuilder(); + String temp = (String)rp.getReturnObj(); + sb.append("File " + temp + "
"); + sendHtmlMsgResponse(req, res, sb.toString()); + } else { + sendHtmlMsgResponse(req, res, "ERRORE! " + rp.getMsg()); + } + } + + public void _unisciDoppioniEan(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + ResParm rp = bean.unisciDoppioniEan(); + if (rp.getStatus()) { + sendMessage(req, "Aggiornamento Effettuato: " + rp.getMsg()); + } else { + sendMessage(req, "Errore! " + rp.getMsg()); + } + search(req, res); + } + + public void _inviaIndexNow(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + long l_id = getRequestLongParameter(req, "id_articolo"); + String l_flg = getRequestParameter(req, "flg"); + bean.findByPrimaryKey(l_id); + if (bean.getId_articolo() > 0L) { + ResParm rp = bean.sendIndexNowUrl(); + if (rp.getStatus()) { + sendMessage(req, "Url inviati correttamente a Bing tramite IndexNow: " + rp.getMsg()); + } else { + sendMessage(req, "Errore IndexNow: " + rp.getMsg()); + } + } else { + sendMessage(req, "Attenzione! Articolo non trovato!"); + } + showBean(req, res); + } + + public void _inviaIndexNowCR(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + ArticoloCR CR = new ArticoloCR(); + fillObject(req, CR); + ResParm rp = bean.callIndexNow(CR); + if (rp.getStatus()) { + sendMessage(req, "Url inviati correttamente a Bing tramite IndexNow: " + rp.getMsg()); + } else { + sendMessage(req, "Errore IndexNow: " + rp.getMsg()); + } + search(req, res); + } + + public void _amzCatalogItem(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + ResParm rp = bean.save(); + if (rp.getStatus()) { + rp = bean.amzCatalogItem(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + showBean(req, res); + } + + public void _amzUpdateOffer(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + ResParm rp = bean.save(); + if (rp.getStatus()) { + rp = bean.amzUpdateOffer(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + showBean(req, res); + } + + public void _amzDeleteItem(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + ResParm rp = bean.save(); + if (rp.getStatus()) { + rp = bean.amzDeleteItem(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + showBean(req, res); + } + + public void _startUpdateOfferAmz(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + Articolo bean = new Articolo(apFull); + long l_flgPriceTypeAmz = getRequestLongParameter(req, "flgPriceTypeAmzCR"); + ResParm rp = bean.startThreadUpdateOfferAmz(apFull, CR, l_flgPriceTypeAmz); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _amzUpdateOfferAutoCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloCR"); + long l_flgPriceTypeAmz = getRequestLongParameter(req, "flgPriceTypeAmzCR"); + bean.findByPrimaryKey(l_id); + bean.setFlgPriceTypeAmz(l_flgPriceTypeAmz); + ResParm rp = bean.superSave(); + if (rp.getStatus()) { + rp = bean.amzUpdateOfferAuto(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + search(req, res); + } + + public void _amzCatalogItemCR1(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloCR"); + bean.findByPrimaryKey(l_id); + ResParm rp = bean.amzCatalogItem(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + search(req, res); + } + + public void _amzUpdateOfferAuto(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + ResParm rp = bean.save(); + if (rp.getStatus()) { + rp = bean.amzUpdateOfferAuto(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + showBean(req, res); + } + + public void _amzPostItemsOffersBatchCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + ArticoloCR CR = new ArticoloCR(); + fillObject(req, CR); + ResParm rp = new ResParm(true); + CR.setFlgAsinAmzNull(0L); + rp = bean.amzPostItemsOffersBatch(CR, "it"); + if (rp.getStatus()) { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + search(req, res); + } + + public void _amzPostPricingCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + ArticoloCR CR = new ArticoloCR(); + fillObject(req, CR); + ResParm rp = bean.amzPostPricing(CR, "it"); + if (rp.getStatus()) { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + search(req, res); + } + + public void _amzPostPricingCR1(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + ArticoloCR CR = new ArticoloCR(); + long l_id = getRequestLongParameter(req, "id_articoloCR"); + CR.setId_articolo(l_id); + ResParm rp = bean.amzPostPricing(CR, "it"); + if (rp.getStatus()) { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + search(req, res); + } + + public void _amzPostItemsOffersBatchCR1(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloCR"); + CR.setId_articolo(l_id); + ResParm rp = new ResParm(true); + if (CR.getArticolo().getAsinAmz().isEmpty()) + rp = CR.getArticolo().amzCatalogItem(); + if (rp.getStatus()) { + rp = bean.amzPostItemsOffersBatch(CR, "it"); + if (rp.getStatus()) { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + search(req, res); + } + + public void _amzPostItemsOffersBatch(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + ArticoloCR CR = new ArticoloCR(); + long l_id = getRequestLongParameter(req, "id_articolo"); + CR.setId_articolo(l_id); + ResParm rp = bean.amzPostItemsOffersBatch(CR, "it"); + if (rp.getStatus()) { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + showBean(req, res); + } + + public void _amzPostPricing(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + ArticoloCR CR = new ArticoloCR(); + long l_id = getRequestLongParameter(req, "id_articolo"); + CR.setId_articolo(l_id); + ResParm rp = bean.amzPostPricing(CR, "it"); + if (rp.getStatus()) { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + } else { + sendMessage(req, DBAdapter.convertStringToHtml(rp.getErrMsg())); + } + showBean(req, res); + } + + public void _amzDeleteItemCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloCR"); + bean.findByPrimaryKey(l_id); + ResParm rp = bean.amzDeleteItem(); + sendMessage(req, DBAdapter.convertStringToHtml(rp.getMsg())); + search(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ArticoloVarianteSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ArticoloVarianteSvlt.java new file mode 100644 index 00000000..f5fae237 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ArticoloVarianteSvlt.java @@ -0,0 +1,504 @@ +package it.acxent.art.servlet; + +import it.acxent.anag.Listino; +import it.acxent.anag.ListinoArticolo; +import it.acxent.art.Accessorio; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.art.ArticoloTaglia; +import it.acxent.art.ArticoloVariante; +import it.acxent.art.ArticoloVarianteCR; +import it.acxent.art.Colore; +import it.acxent.art.ColoreCR; +import it.acxent.art.TabellaTaglia; +import it.acxent.art.Taglia; +import it.acxent.art.TipoAccessorio; +import it.acxent.art.Vetrina; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.tex.anag.ArticoloArticoloTessuto; +import it.acxent.util.AbMessages; +import it.acxent.util.Vectumerator; +import java.io.File; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/art/ArticoloVariante.abl"}) +public class ArticoloVarianteSvlt extends _MagSvlt { + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloVariante bean = (ArticoloVariante)beanA; + if (bean.getTipo().isUsaMagazzino()) + req.setAttribute("listaDisponibilita", bean.getDisponibilitaMovimento()); + req.setAttribute("listaVetrine", new Vetrina(apFull).findAll()); + if (bean.getTipo().getFlgUsaTaglia() == 2L) { + req.setAttribute("listaTagliePerTipo", new Taglia(apFull) + .findTaglieByTipoTaglia(bean.getArticolo().getTipo().getTipoTaglia().getId_tipoTaglia())); + req.setAttribute("listaTaglieArticolo", new ArticoloTaglia(apFull).findByArticoloVariante(bean.getId_articoloVariante())); + req.setAttribute("listaTabellaTaglie", new TabellaTaglia(apFull).findAll()); + if (bean.getArticolo().getId_tipoTaglia() > 0L) + req.setAttribute("listaMisure", bean.getArticolo().getTabellaTaglia().getTagliaMisure()); + } + req.setAttribute("listaListini", new Listino(apFull).findAll()); + req.setAttribute("listaListiniArticolo", new ListinoArticolo(apFull).findPrezziByArticoloVariante(bean.getId_articoloVariante())); + if (bean.getTipo().getFlgAFT() == 3L) + req.setAttribute("listaArticoliTessuto", bean.findArticoliTessuto()); + if (bean.getTipo().getFlgUsaVarianteColori() == 1L) + req.setAttribute("listaColori", new Colore(apFull).findByCR(new ColoreCR(), 0, 0)); + if (bean.getArticolo().getFlgKit() == 1L) + req.setAttribute("listaVariantiKit", bean.getArticolo().getKitVariantiAssociati()); + req.setAttribute("listListino", new Listino(apFull).findNoListinoBase()); + } + + protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new ArticoloVariante(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ArticoloVarianteCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + Articolo bean2 = new Articolo(apFull); + bean2.findByPrimaryKey(l_id_articolo); + ResParm rp = new ResParm(true, ""); + fillObject(req, bean2); + rp = bean2.save(); + if (!rp.getStatus()) + sendMessage(req, rp.getMsg()); + ArticoloVariante bean = new ArticoloVariante(apFull); + bean.setId_articolo(bean2.getId_articolo()); + req.setAttribute("bean", bean); + req.setAttribute("listaTipiAccessorio", new TipoAccessorio(apFull).findAll()); + req.setAttribute("listaVetrine", new Vetrina(apFull).findAll()); + req.setAttribute("listaTagliePerTipo", new Taglia(apFull) + .findTaglieByTipoTaglia(bean.getArticolo().getTipo().getTipoTaglia().getId_tipoTaglia())); + req.setAttribute("listaListiniArticolo", new ListinoArticolo(apFull).findPrezziByArticoloVariante(bean.getId_articoloVariante())); + if (bean.getTipo().getFlgUsaVarianteColori() == 1L) + req.setAttribute("listaColori", new Colore(apFull).findByCR(new ColoreCR(), 0, 0)); + } + + protected void manageMultipartRequestxxx(HttpServletRequest req, HttpServletResponse res) { + long l_id = 0L; + ArticoloVariante bean = null; + bean = new ArticoloVariante(getApFull(req)); + String[] fileNameTypes = { "jpg" }; + String targetDir = getDocBase() + getDocBase(); + String fntImg1 = "varImg_" + getLoginUserId(req) + "_1"; + String fntImg2 = "varImg_" + getLoginUserId(req) + "_2"; + String fntImg3 = "varImg_" + getLoginUserId(req) + "_3"; + String fntImg4 = "varImg_" + getLoginUserId(req) + "_4"; + String fntImg5 = "varImg_" + getLoginUserId(req) + "_5"; + String fntImg6 = "varImg_" + getLoginUserId(req) + "_6"; + String[] fileNameTarget = { fntImg1, fntImg2, fntImg3, fntImg4, fntImg5, fntImg6 }; + String[] fileNameParameters = { "imgVar1", "imgVar2", "imgVar3", "imgVar4", "imgVar5", "imgVar6" }; + try { + if (getLoginUserGrant(req, new ArticoloVariante().getTableBeanName()) >= 3L) { + if (manageMultipartRequestParameters(req, 2000, fileNameParameters, fileNameTarget, fileNameTypes, targetDir)) { + processNoEncTypeRequest(req, res); + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "MR_FILE_ERROR")); + showBean(req, res); + } + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_RW")); + showBean(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloVariante bean = (ArticoloVariante)beanA; + ResParm rp = new ResParm(true); + if (bean.getId_articolo() > 0L) { + ListinoArticolo labWWW = new ListinoArticolo(apFull); + fillObject(req, labWWW); + labWWW.setId_articoloVariante(bean.getId_articoloVariante()); + ListinoArticolo listinoArticoloBaseArticolo = bean.getArticolo().getListinoArticoloBase(); + ListinoArticolo listinoArticoloVarianteBase = new ListinoArticolo(apFull); + listinoArticoloVarianteBase.findByArticoloVarianteListino(labWWW.getId_articoloVariante(), + bean.getListinoBase().getId_listino()); + if (labWWW.getPrezzoLA() != 0.0D && !labWWW.hasStessiValori(listinoArticoloBaseArticolo)) { + listinoArticoloVarianteBase.setId_listino(bean.getListinoBase().getId_listino()); + listinoArticoloVarianteBase.setId_articolo(labWWW.getId_articolo()); + listinoArticoloVarianteBase.setId_articoloVariante(labWWW.getId_articoloVariante()); + listinoArticoloVarianteBase.setAbbuonoPrezzoPubblicoLA(labWWW.getAbbuonoPrezzoPubblicoLA()); + listinoArticoloVarianteBase.setDataScadenzaOffertaLA(labWWW.getDataScadenzaOffertaLA()); + listinoArticoloVarianteBase.setPercLA(labWWW.getPercLA()); + listinoArticoloVarianteBase.setPercLA1(labWWW.getPercLA1()); + listinoArticoloVarianteBase.setPercLA2(labWWW.getPercLA2()); + listinoArticoloVarianteBase.setPercLA3(labWWW.getPercLA3()); + listinoArticoloVarianteBase.setPrezzoLA(labWWW.getPrezzoLA()); + listinoArticoloVarianteBase.setPrezzoOffertaLA(labWWW.getPrezzoOffertaLA()); + listinoArticoloVarianteBase.setPrezzoConIvaLA(labWWW.getPrezzoConIvaLA()); + rp = listinoArticoloVarianteBase.save(); + } else if (listinoArticoloVarianteBase.getId_listinoArticolo() > 0L) { + listinoArticoloVarianteBase.delete(); + } + } + return rp; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + String cmd = getCmd(req); + if (cmd.equals("clearScaled")) { + ArticoloVariante bean = new ArticoloVariante(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloVariante"); + bean.findByPrimaryKey(l_id); + bean.clearScaledImg("TH"); + bean.clearScaledImg("AV"); + bean.clearScaledImg("CART"); + sendMessage(req, "Scaled image TH AV e CART eliminate. Procedere con la nuova creazione."); + showBean(req, res); + } else if (cmd.equals("createScaled")) { + ArticoloVariante bean = new ArticoloVariante(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloVariante"); + bean.findByPrimaryKey(l_id); + req.setAttribute("bean", bean); + setJspPageRelative("articoloVarianteImg.jsp", req); + callJsp(req, res); + } else if (getCmd(req).equals("addTaglie")) { + ArticoloVariante bean = new ArticoloVariante(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_articoloVariante"); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + ResParm rp = bean.save(); + if (rp.getStatus()) { + Vectumerator vec = new Taglia(getApFull(req)) + .findTaglieByTipoTaglia(bean.getArticolo().getTipo().getTipoTaglia().getId_tipoTaglia()); + while (vec.hasMoreElements()) { + Taglia at = (Taglia)vec.nextElement(); + ArticoloTaglia row = new ArticoloTaglia(getApFull(req)); + row.setId_articolo(bean.getId_articolo()); + row.setId_articoloVariante(bean.getId_articoloVariante()); + row.setId_taglia(at.getId_taglia()); + bean.addArticoloTaglia(row); + } + req.setAttribute("bean", bean); + } else { + sendMessage(req, rp.getErrMsg()); + if (l_id == 0L) + req.setAttribute("bean", bean); + } + showBean(req, res); + } else { + showBean(req, res); + } + } + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloVariante bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_articoloVariante"); + bean = new ArticoloVariante(apFull); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + if (rp.getStatus()) { + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + req.setAttribute("id_articolo", String.valueOf(bean.getId_articolo())); + if (rp.getStatus() == true) { + if (getAct(req).equals("addAcce")) { + Accessorio accessorio = new Accessorio(apFull); + if (!getRequestParameter(req, "id_articolo").equals("")) { + fillObject(req, accessorio); + rp = bean.addAccessorio(accessorio); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("delAcce")) { + Accessorio accessorio = new Accessorio(apFull); + if (getRequestLongParameter(req, "id_accessorio") != 0L) { + fillObject(req, accessorio); + bean.delAccessorio(accessorio); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("addArticoloTaglia")) { + ArticoloTaglia row = new ArticoloTaglia(apFull); + fillObject(req, row); + rp = bean.addArticoloTaglia(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delArticoloTaglia")) { + ArticoloTaglia row = new ArticoloTaglia(apFull); + if (getRequestLongParameter(req, "id_articoloTaglia") != 0L) { + fillObject(req, row); + bean.delTaglia(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } + showBean(req, res); + } else if (getAct(req).equals("addListinoArticolo")) { + ListinoArticolo row = new ListinoArticolo(apFull); + fillObject(req, row); + rp = bean.addListinoArticolo(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delListinoArticolo")) { + ListinoArticolo row = new ListinoArticolo(apFull); + if (getRequestLongParameter(req, "id_listinoArticolo") != 0L) { + fillObject(req, row); + bean.delListinoArticolo(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } + } else { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } else { + sendMessage(req, rp.getErrMsg()); + showBean(req, res); + } + } + + protected boolean isLoadImageServlet() { + return true; + } + + protected ResParm afterSaveImmagini(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + synchronized (this) { + ResParm rp = new ResParm(true, ""); + ArticoloVariante bean = (ArticoloVariante)beanA; + String targetDir = getDocBase() + getDocBase(); + long l_id = bean.getId_articolo(); + Vectumerator fileNames = (Vectumerator)req.getAttribute("completeAttachName"); + String imgTmst = getTimeNameForFileUpload(); + boolean l_newImg = false; + if (fileNames != null) { + while (fileNames.hasMoreElements()) { + String currentFileName = (String)fileNames.nextElement(); + if (currentFileName.indexOf("/varImg") >= 0) { + l_newImg = true; + int idx = Integer.parseInt( + currentFileName.substring(currentFileName.lastIndexOf("_") + 1, currentFileName.lastIndexOf("."))); + if (isFileExist(currentFileName)) { + new File(targetDir + targetDir).delete(); + new File(currentFileName).renameTo(new File(targetDir + targetDir)); + } + } + } + if (l_newImg) + for (int j = 1; j <= 6; j++) { + String currentFileName = targetDir + targetDir; + if (isFileExist(currentFileName)) + new File(currentFileName).renameTo(new File(targetDir + targetDir)); + } + } + for (int i = 1; i <= 5; i++) { + if (getRequestLongParameter(req, "cmdCancellaImmagine" + i) == 1L) { + String fileName = targetDir + targetDir; + new File(fileName).delete(); + } + } + if (l_newImg) { + bean.setImgTmst(imgTmst); + rp = bean.save(); + req.setAttribute("bean", bean); + } + return rp; + } + } + + public void _allineaPrezziConArticolo(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloVariante bean = new ArticoloVariante(apFull); + long l_id_articolo = getRequestLongParameter(req, "id_articoloVariante"); + bean.findByPrimaryKey(l_id_articolo); + if (bean.getId_articolo() > 0L) { + ListinoArticolo listinoArticoloVarianteBase = new ListinoArticolo(apFull); + listinoArticoloVarianteBase.findByArticoloVarianteListino(bean.getId_articoloVariante(), bean.getListinoBase().getId_listino()); + if (listinoArticoloVarianteBase.getId_articolo() > 0L) + listinoArticoloVarianteBase.delete(); + bean.setCurrentTab(getRequestParameter(req, "currentTab")); + req.setAttribute("bean", bean); + showBean(req, res); + } else { + search(req, res); + } + } + + protected void actionsAfterDelete(HttpServletRequest req, HttpServletResponse res) { + try { + req.setAttribute("cmd", "md"); + req.setAttribute("act", ""); + req.setAttribute("currentTab", "#VAR"); + RequestDispatcher rd = getServletContext().getRequestDispatcher("/admin/art/Articolo.abl"); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + StringBuilder msg = new StringBuilder(); + if (e.getCause() != null) { + msg.append("Causa:\n"); + msg.append(e.getCause().getMessage()); + msg.append("\n"); + } + msg.append(e.getMessage()); + handleDebug(e, 2); + forceMessage(req, getJspPage(req)); + req.setAttribute("errorMsg", msg.toString()); + RequestDispatcher rd = getServletContext().getRequestDispatcher("/admin/config/error.jsp"); + try { + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception exception) {} + } + } + + protected void print(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + try { + if (getAct(req).equals("lblArt")) { + long l_id = 0L; + Articolo bean = null; + bean = new Articolo(apFull); + bean.findByPrimaryKey(new Long(l_id)); + ArticoloCR CR = new ArticoloCR(); + fillObject(req, CR); + CR.setId_articolo(l_id); + if (getParm("LABEL_ART_A4_ZEBRA").getNumeroInt() == 0) { + sendPdf(res, bean.creaLabelArticoloA4Pdf(CR), "LabelA4ZebraArt " + DBAdapter.getDayTimeTimestamp()); + } else { + sendPdf(res, bean.creaLabelArticoloZebraPdf(CR), "LabelZebraArt " + DBAdapter.getDayTimeTimestamp()); + } + } else if (getAct(req).equals("lblArtAcc")) { + long l_id = 0L; + Articolo bean = null; + l_id = getRequestLongParameter(req, "id_articolo"); + bean = new Articolo(apFull); + ArticoloCR CR = new ArticoloCR(); + fillObject(req, CR); + CR.setId_articolo(l_id); + if (getParm("LABEL_ART_A4_ZEBRA").getNumeroInt() == 0) { + sendPdf(res, bean.creaLabelArticoloAccA4Pdf(CR), "LabelA4ZebraAcc " + DBAdapter.getDayTimeTimestamp()); + } else { + sendPdf(res, bean.creaLabelArticoloAccZebraPdf(CR), "LabelA4ZebraAcc " + DBAdapter.getDayTimeTimestamp()); + } + } else { + search(req, res); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void _addTessutoConfezioneVariante(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + ArticoloArticoloTessuto bean2 = new ArticoloArticoloTessuto(apFull); + fillObject(req, bean2); + if (bean2.getId_articoloArticoloTessuto() > 0L) + bean2.findByPrimaryKey(bean2.getId_articoloArticoloTessuto()); + if (bean2.getId_articoloTessuto() > 0L && bean2.getId_articoloVariante() > 0L) { + rp = bean2.save(); + } else { + rp = new ResParm(false, "Errore! Tessuto o articolo non selezionato correttamente"); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _delTessutoConfezioneVariante(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + ArticoloArticoloTessuto bean2 = new ArticoloArticoloTessuto(apFull); + fillObject(req, bean2); + if (bean2.getId_articoloArticoloTessuto() > 0L) { + bean2.findByPrimaryKey(bean2.getId_articoloArticoloTessuto()); + rp = bean2.delete(); + } else { + rp = new ResParm(false, "Errore! Impossibile cancellare tessuto associato a confezione "); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _impostaTessutoPrincipale(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + ArticoloArticoloTessuto bean2 = new ArticoloArticoloTessuto(apFull); + fillObject(req, bean2); + if (bean2.getId_articoloArticoloTessuto() > 0L) { + bean2.findByPrimaryKey(bean2.getId_articoloArticoloTessuto()); + bean2.setFlgPrincipale(1L); + rp = bean2.save(); + } else { + rp = new ResParm(false, "Errore! Impossibile cancellare tessuto associato a confezione "); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _listinoArticoloVarianteCancella(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante"); + long l_id_listino = getRequestLongParameter(req, "id_listino"); + ListinoArticolo beanRow = new ListinoArticolo(apFull); + beanRow.findByArticoloVarianteListino(l_id_articoloVariante, l_id_listino); + ResParm rp = beanRow.delete(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _listinoArticoloVarianteMostra(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante"); + long l_id_listino = getRequestLongParameter(req, "id_listino"); + ListinoArticolo la = new ListinoArticolo(apFull); + la.findByArticoloVarianteListino(l_id_articoloVariante, l_id_listino); + la.setId_listino(l_id_listino); + la.setId_articoloVariante(l_id_articoloVariante); + req.setAttribute("bean", la); + setJspPageRelative("listinoArticolo.jsp", req); + callJsp(req, res); + } + + public void _listinoSalvaPrezzoAV(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante"); + long l_id_listino = getRequestLongParameter(req, "id_listino"); + ListinoArticolo beanRow = new ListinoArticolo(apFull); + beanRow.findByArticoloVarianteListino(l_id_articoloVariante, l_id_listino); + beanRow.setId_listino(l_id_listino); + beanRow.setId_articoloVariante(l_id_articoloVariante); + beanRow.setId_articolo(l_id_articolo); + beanRow.setPrezzoLA(getRequestDoubleParameter(req, "_prezzoLA")); + beanRow.setPercLA(getRequestDoubleParameter(req, "_percLA")); + beanRow.setPercLA1(getRequestDoubleParameter(req, "_percLA1")); + beanRow.setPercLA2(getRequestDoubleParameter(req, "_percLA2")); + beanRow.setPercLA3(getRequestDoubleParameter(req, "_percLA3")); + beanRow.setDataScadenzaOffertaLA(getRequestDateParameter(req, "_dataScadenzaOffertaLA")); + beanRow.setPrezzoOffertaLA(getRequestDoubleParameter(req, "_prezzoOffertaLA")); + ResParm rp = beanRow.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/CaratteristicaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/CaratteristicaSvlt.java new file mode 100644 index 00000000..24e51fd4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/CaratteristicaSvlt.java @@ -0,0 +1,91 @@ +package it.acxent.art.servlet; + +import it.acxent.art.CTipo; +import it.acxent.art.Caratteristica; +import it.acxent.art.CaratteristicaCR; +import it.acxent.art.Marca; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.AbMessages; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/Caratteristica.abl"}) +public class CaratteristicaSvlt extends _MagSvlt { + private static final long serialVersionUID = 3575908708336411061L; + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaMarche", new Marca(apFull).findAll()); + req.setAttribute("listaCTipi", new CTipo(apFull).findTipiByCaratteristica(((Caratteristica)bean).getId_caratteristica(), 0, 0)); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Caratteristica(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new CaratteristicaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaMarche", new Marca(getApFull(req)).findAll()); + } + + public void _addTipo(HttpServletRequest req, HttpServletResponse res) { + ResParm rp = new ResParm(true, ""); + long l_id_tipo = getRequestLongParameter(req, "id_tipo"); + long l_id = getRequestLongParameter(req, "id_caratteristica"); + Caratteristica bean = new Caratteristica(getApFull(req)); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + req.setAttribute("id_caratteristica", String.valueOf(bean.getId_caratteristica())); + if (l_id_tipo > 0L) { + rp = bean.addTipo(l_id_tipo); + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + long l_id = 0L; + Caratteristica bean = null; + ResParm rp = new ResParm(true, ""); + l_id = getRequestLongParameter(req, "id_caratteristica"); + bean = new Caratteristica(getApFull(req)); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + req.setAttribute("id_caratteristica", String.valueOf(bean.getId_caratteristica())); + if (rp.getStatus() == true) { + long l_id_tipo = getRequestLongParameter(req, "id_tipo"); + if (getAct(req).equals("addTipo")) { + if (l_id_tipo > 0L) { + rp = bean.addTipo(l_id_tipo); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } else if (getAct(req).equals("delTipo") && + l_id_tipo > 0L) { + bean.delTipo(l_id_tipo); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + showBean(req, res); + } + } else { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ColoreSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ColoreSvlt.java new file mode 100644 index 00000000..916f07d0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ColoreSvlt.java @@ -0,0 +1,35 @@ +package it.acxent.art.servlet; + +import it.acxent.art.Colore; +import it.acxent.art.ColoreCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/Colore.abl"}) +public class ColoreSvlt extends AblServletSvlt { + private static final long serialVersionUID = 4010591053283525511L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Colore(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ColoreCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ComponenteSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ComponenteSvlt.java new file mode 100644 index 00000000..23cb876a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ComponenteSvlt.java @@ -0,0 +1,31 @@ +package it.acxent.art.servlet; + +import it.acxent.art.Componente; +import it.acxent.art.ComponenteCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/Componente.abl"}) +public class ComponenteSvlt extends AblServletSvlt { + private static final long serialVersionUID = -470730883572373477L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Componente(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ComponenteCR(getApFull(req)); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/GetArticoloAttachNoLoginSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/GetArticoloAttachNoLoginSvlt.java new file mode 100644 index 00000000..37e0790f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/GetArticoloAttachNoLoginSvlt.java @@ -0,0 +1,27 @@ +package it.acxent.art.servlet; + +import it.acxent.art.AllegatoArticolo; +import it.acxent.servlet.GetFileSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/_a/_art/*"}) +public class GetArticoloAttachNoLoginSvlt extends GetFileSvlt { + private static final long serialVersionUID = -4630036169421100261L; + + protected String getFileName(HttpServletRequest req, HttpServletResponse res) { + boolean checkGrant = true; + if (checkGrant) { + AllegatoArticolo bean = new AllegatoArticolo(getApFull(req)); + bean.findByPrimaryKey(getRequestLongParameter(req, "id")); + String fileName = bean.getNomeFileCompleto(); + return fileName; + } + return null; + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/GetArticoloAttachSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/GetArticoloAttachSvlt.java new file mode 100644 index 00000000..14eaae4f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/GetArticoloAttachSvlt.java @@ -0,0 +1,29 @@ +package it.acxent.art.servlet; + +import it.acxent.art.AllegatoArticolo; +import it.acxent.servlet.GetFileSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/_attach/_art/*"}) +public class GetArticoloAttachSvlt extends GetFileSvlt { + private static final long serialVersionUID = -4630036169261100261L; + + protected String getFileName(HttpServletRequest req, HttpServletResponse res) { + boolean checkGrant = true; + long l_id_user = getLoginUserId(req); + if (l_id_user == 0L) { + checkGrant = false; + } else { + checkGrant = true; + } + if (checkGrant) { + AllegatoArticolo bean = new AllegatoArticolo(getApFull(req)); + bean.findByPrimaryKey(getRequestLongParameter(req, "id")); + String fileName = bean.getNomeFileCompleto(); + return fileName; + } + return null; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/GoogleCategorySvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/GoogleCategorySvlt.java new file mode 100644 index 00000000..66b2b366 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/GoogleCategorySvlt.java @@ -0,0 +1,40 @@ +package it.acxent.art.servlet; + +import it.acxent.art.GoogleCategory; +import it.acxent.art.GoogleCategoryCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.servlet.AddImgSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/GoogleCategory.abl"}) +public class GoogleCategorySvlt extends AblServletSvlt implements AddImgSvlt { + private static final long serialVersionUID = -2706537310912408276L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new GoogleCategory(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new GoogleCategoryCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + protected boolean isLoadImageServlet() { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ListaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ListaSvlt.java new file mode 100644 index 00000000..a90f0234 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ListaSvlt.java @@ -0,0 +1,39 @@ +package it.acxent.art.servlet; + +import it.acxent.art.Caratteristica; +import it.acxent.art.Lista; +import it.acxent.art.ListaCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/Lista.abl"}) +public class ListaSvlt extends AblServletSvlt { + private static final long serialVersionUID = 1567503569667512245L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaListe", new Caratteristica(getApFull(req)) + .findListe(0, 0)); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Lista(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ListaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/MarcaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/MarcaSvlt.java new file mode 100644 index 00000000..19f88464 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/MarcaSvlt.java @@ -0,0 +1,73 @@ +package it.acxent.art.servlet; + +import it.acxent.art.Marca; +import it.acxent.art.MarcaCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.servlet.AddImgSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/Marca.abl"}) +public class MarcaSvlt extends AblServletSvlt implements AddImgSvlt { + private static final long serialVersionUID = -7517744963553774947L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Marca(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new MarcaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + public void _aggiornaIndiciTipo(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Marca bean = new Marca(apFull); + long l_id = getRequestLongParameter(req, "id_marca"); + bean.findByPrimaryKey(l_id); + if (bean.getId_marca() > 0L) { + ResParm rp = bean.startIndicizzoMarche(l_id); + if (rp.getStatus()) { + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, "Errore! " + rp.getMsg()); + } + } else { + sendMessage(req, "Errore! Marca non selezionata!"); + } + showBean(req, res); + } + + public void _aggiornaIndiciTipoAll(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Marca bean = new Marca(apFull); + long l_id = getRequestLongParameter(req, "id_marca"); + ResParm rp = bean.startIndicizzoMarche(0L); + if (rp.getStatus()) { + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, "Errore! " + rp.getMsg()); + } + search(req, res); + } + + protected boolean isLoadImageServlet() { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ModelloSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ModelloSvlt.java new file mode 100644 index 00000000..da256fa0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/ModelloSvlt.java @@ -0,0 +1,38 @@ +package it.acxent.art.servlet; + +import it.acxent.art.Marca; +import it.acxent.art.Modello; +import it.acxent.art.ModelloCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/art/Modello.abl"}) +public class ModelloSvlt extends AblServletSvlt { + private static final long serialVersionUID = 8342909821755484567L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaMarche", new Marca(getApFull(req)).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Modello(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ModelloCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/RepartoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/RepartoSvlt.java new file mode 100644 index 00000000..b91ea0e1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/RepartoSvlt.java @@ -0,0 +1,38 @@ +package it.acxent.art.servlet; + +import it.acxent.anag.Iva; +import it.acxent.art.Reparto; +import it.acxent.art.RepartoCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/Reparto.abl"}) +public class RepartoSvlt extends AblServletSvlt { + private static final long serialVersionUID = -1725537244500872025L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaIva", new Iva(getApFull(req)).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Reparto(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new RepartoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/StatoUsatoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/StatoUsatoSvlt.java new file mode 100644 index 00000000..029fdf6d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/StatoUsatoSvlt.java @@ -0,0 +1,40 @@ +package it.acxent.art.servlet; + +import it.acxent.art.StatoUsato; +import it.acxent.art.StatoUsatoCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.servlet.AddImgSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/StatoUsato.abl"}) +public class StatoUsatoSvlt extends AblServletSvlt implements AddImgSvlt { + private static final long serialVersionUID = -4973691946479681907L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new StatoUsato(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new StatoUsatoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } + + protected boolean isLoadImageServlet() { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TabellaTagliaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TabellaTagliaSvlt.java new file mode 100644 index 00000000..6b585255 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TabellaTagliaSvlt.java @@ -0,0 +1,220 @@ +package it.acxent.art.servlet; + +import it.acxent.art.Articolo; +import it.acxent.art.TabellaTaglia; +import it.acxent.art.TabellaTagliaCR; +import it.acxent.art.TagliaMisure; +import it.acxent.art.TipoTaglia; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.AbMessages; +import it.acxent.util.Vectumerator; +import java.io.File; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/TabellaTaglia.abl"}) +public class TabellaTagliaSvlt extends AblServletSvlt { + private static final long serialVersionUID = 1455352933458498203L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + TabellaTaglia bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_tabellaTaglia"); + bean = new TabellaTaglia(apFull); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + req.setAttribute("id_tabellaTaglia", + String.valueOf(bean.getId_tabellaTaglia())); + if (rp.getStatus() == true) { + if (getAct(req).equals("addMisure")) { + TagliaMisure row = new TagliaMisure(apFull); + fillObject(req, row); + rp = bean.addTagliaMisure(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delMisure")) { + TagliaMisure row = new TagliaMisure(apFull); + long l_id_tagliaMisure = getRequestLongParameter(req, "id_tagliaMisure"); + if (l_id_tagliaMisure != 0L) { + fillObject(req, row); + bean.delTagliaMisure(row); + sendMessage(req, "Cancellazione Misura Effettuata"); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("modMisure")) { + TagliaMisure row = new TagliaMisure(apFull); + long l_id_tagliaMisure = getRequestLongParameter(req, "id_tagliaMisure"); + if (l_id_tagliaMisure != 0L) { + fillObject(req, row); + row.findByPrimaryKey(l_id_tagliaMisure); + req.setAttribute("misura", row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("addArticolo")) { + Articolo row = new Articolo(apFull); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + if (l_id_articolo != 0L) { + row.findByPrimaryKey(l_id_articolo); + row.setId_tabellaTaglia(l_id); + rp = row.save(); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("delArticolo")) { + Articolo row = new Articolo(apFull); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + if (l_id_articolo != 0L) { + row.findByPrimaryKey(l_id_articolo); + row.setId_tabellaTaglia(0L); + rp = row.save(); + sendMessage(req, "Cancellazione Effettuata"); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } + } else { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, + AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + TabellaTaglia bean = (TabellaTaglia)beanA; + req.setAttribute("listaTipoTaglia", bean.findAll()); + req.setAttribute("listaMisure", bean.getTagliaMisure()); + req.setAttribute("listaArticoli", bean.getArticoli()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaTipoTaglia", new TipoTaglia(getApFull(req)).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new TabellaTaglia(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TabellaTagliaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaTipoTaglia", new TipoTaglia(getApFull(req)).findAll()); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("tmSu")) { + long l_id_tagliaMisure = getRequestLongParameter(req, "id_tagliaMisure"); + TagliaMisure tm = new TagliaMisure(getApFull(req)); + tm.findByPrimaryKey(l_id_tagliaMisure); + ResParm rp = tm.spostaSu(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getCmd(req).equals("tmGiu")) { + long l_id_tagliaMisure = getRequestLongParameter(req, "id_tagliaMisure"); + TagliaMisure tm = new TagliaMisure(getApFull(req)); + tm.findByPrimaryKey(l_id_tagliaMisure); + ResParm rp = tm.spostaGiu(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } + + protected void manageMultipartRequest(HttpServletRequest req, HttpServletResponse res) { + long l_id = 0L; + TabellaTaglia bean = null; + bean = new TabellaTaglia(getApFull(req)); + String[] fileNameTypes = { "gif" }; + String targetDir = getDocBase() + getDocBase(); + String fntImg1 = "tmpImg_" + getLoginUserId(req) + "_1"; + String[] fileNameTarget = { fntImg1 }; + String[] fileNameParameters = { "img1" }; + try { + if (getLoginUserGrant(req, new TabellaTaglia().getTableBeanName()) >= 3L) { + if (manageMultipartRequestParameters(req, 2000, fileNameParameters, fileNameTarget, fileNameTypes, targetDir)) { + processNoEncTypeRequest(req, res); + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "MR_FILE_ERROR")); + showBean(req, res); + } + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_RW")); + showBean(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + synchronized (this) { + ResParm rp = new ResParm(true, ""); + TabellaTaglia bean = (TabellaTaglia)beanA; + String targetDir = getDocBase() + getDocBase(); + Vectumerator fileNames = (Vectumerator) + req.getAttribute("completeAttachName"); + String imgTmst = getTimeNameForFileUpload(); + boolean l_newImg = false; + while (fileNames.hasMoreElements()) { + String currentFileName = (String)fileNames.nextElement(); + if (currentFileName.indexOf("tmpImg_") >= 0) { + l_newImg = true; + int idx = Integer.parseInt(currentFileName.substring( + currentFileName.lastIndexOf("_") + 1, + currentFileName.lastIndexOf("."))); + if (isFileExist(currentFileName)) { + new File(targetDir + targetDir).delete(); + new File(currentFileName).renameTo(new File(targetDir + targetDir)); + } + } + } + if (l_newImg) + for (int j = 1; j <= 6; j++) { + String currentFileName = targetDir + targetDir; + if (isFileExist(currentFileName)) + new File(currentFileName).renameTo(new File(targetDir + targetDir)); + } + for (int i = 1; i <= 5; i++) { + if (getRequestLongParameter(req, "cmdCancellaImmagine" + i) == 1L) { + String fileName = targetDir + targetDir; + new File(fileName).delete(); + } + } + if (l_newImg) { + bean.setImgTmst(imgTmst); + rp = bean.save(); + req.setAttribute("bean", bean); + } + return rp; + } + } + + protected boolean isLoadImageServlet() { + return super.isLoadImageServlet(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TagliaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TagliaSvlt.java new file mode 100644 index 00000000..1998fe6c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TagliaSvlt.java @@ -0,0 +1,59 @@ +package it.acxent.art.servlet; + +import it.acxent.art.Taglia; +import it.acxent.art.TagliaCR; +import it.acxent.art.TipoTaglia; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/Taglia.abl"}) +public class TagliaSvlt extends AblServletSvlt { + private static final long serialVersionUID = 5185977689020806109L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaTipoTaglia", new TipoTaglia(getApFull(req)).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Taglia(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TagliaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + ResParm rp = new ResParm(true); + if (getCmd(req).equals("tmSu")) { + long l_id_taglia = getRequestLongParameter(req, "id_tagliaSposta"); + Taglia tg = new Taglia(getApFull(req)); + tg.findByPrimaryKey(l_id_taglia); + rp = tg.spostaSu(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getCmd(req).equals("tmGiu")) { + long l_id_taglia = getRequestLongParameter(req, "id_tagliaSposta"); + Taglia tg = new Taglia(getApFull(req)); + tg.findByPrimaryKey(l_id_taglia); + rp = tg.spostaGiu(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + super.otherCommands(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipoAccessorioSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipoAccessorioSvlt.java new file mode 100644 index 00000000..f188a296 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipoAccessorioSvlt.java @@ -0,0 +1,35 @@ +package it.acxent.art.servlet; + +import it.acxent.art.TipoAccessorio; +import it.acxent.art.TipoAccessorioCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/TipoAccessorio.abl"}) +public class TipoAccessorioSvlt extends AblServletSvlt { + private static final long serialVersionUID = 8396401020485091181L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoAccessorio(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoAccessorioCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipoAllegatoArticoloSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipoAllegatoArticoloSvlt.java new file mode 100644 index 00000000..0537369b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipoAllegatoArticoloSvlt.java @@ -0,0 +1,62 @@ +package it.acxent.art.servlet; + +import it.acxent.art.TipoAllegatoArticolo; +import it.acxent.art.TipoAllegatoArticoloCR; +import it.acxent.contab.TipoAllegatoDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.AbMessages; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/TipoAllegatoArticolo.abl"}) +public class TipoAllegatoArticoloSvlt extends AblServletSvlt { + private static final long serialVersionUID = -7753154721882190304L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + TipoAllegatoDocumento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_tipoDocumento"); + bean = new TipoAllegatoDocumento(apFull); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + l_id = bean.getId_tipoAllegatoDocumento(); + req.setAttribute("id_tipoAllegatoDocumento", String.valueOf(l_id)); + req.setAttribute("bean", bean); + if (rp.getStatus() != true) { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, + AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoAllegatoArticolo(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoAllegatoArticoloCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipoSvlt.java new file mode 100644 index 00000000..14fe850d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipoSvlt.java @@ -0,0 +1,318 @@ +package it.acxent.art.servlet; + +import com.google.gson.Gson; +import it.acxent.anag.Listino; +import it.acxent.art.Reparto; +import it.acxent.art.Tipo; +import it.acxent.art.TipoCR; +import it.acxent.art.TipoTaglia; +import it.acxent.art.TipologiaArticolo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.DBAdapterSaveResponse; +import it.acxent.db.ResParm; +import it.acxent.jsp.Ab; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.AbMessages; +import it.acxent.util.ReturnItem; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/art/Tipo.abl"}) +public class TipoSvlt extends AblServletSvlt { + private static final long serialVersionUID = 9212377303066459864L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaListino", new Listino(apFull).findNoListinoBase()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Tipo tipoPadre = null; + long l_id_lista = getRequestLongParameter(req, "id_tipoPadre"); + tipoPadre = new Tipo(apFull); + tipoPadre.findByPrimaryKey(l_id_lista); + req.setAttribute("tipoPadre", tipoPadre); + req.setAttribute("listaReparti", new Reparto(apFull).findAll()); + req.setAttribute("listaPadri", tipoPadre.findPadri()); + req.setAttribute("listaListini", new Listino(apFull).findAll()); + req.setAttribute("listaTipiTaglie", new TipoTaglia(apFull).findAll()); + req.setAttribute("listaTipologieArticoli", new TipologiaArticolo(apFull).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Tipo(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Tipo bean = (Tipo)getBean(req); + bean.setFlgFornitori(1L); + bean.setFlgAccessori(1L); + bean.setFlgTipoMagazzino(1L); + req.setAttribute("listaListino", new Listino(apFull).findNoListinoBase()); + req.setAttribute("bean", bean); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("ordinaAlfabetico")) { + Tipo bean = new Tipo(getApFull(req)); + bean.ordinaAlfabeticoFigli(bean); + search(req, res); + } else { + super.otherCommands(req, res); + } + } + + protected boolean isLoadImageServlet() { + return true; + } + + public void _ordinaAlfabetico(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Tipo bean = new Tipo(apFull); + bean.ordinaAlfabeticoFigli(bean); + search(req, res); + } + + public void _indici(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Tipo bean = new Tipo(getApFull(req)); + boolean tag = (getRequestLongParameter(req, "flgRicalcolaTag") == 1L); + boolean articoli = (getRequestLongParameter(req, "flgRicalcolaArticoli") == 1L); + ResParm rp = bean.startThreadCalcolaIndici(tag, articoli); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _cambiaFlg(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Tipo bean = new Tipo(apFull); + long l_id_tipo = getRequestLongParameter(req, "id_tipo"); + String l_flg = getRequestParameter(req, "flg"); + bean.findByPrimaryKey(l_id_tipo); + ResParm rp = bean.cambiaFlg(l_flg); + if (rp.getStatus()) { + sendMessage(req, "Aggiornamento Effettuato"); + } else { + sendMessage(req, "Errore! " + rp.getMsg()); + } + search(req, res); + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + try { + DBAdapter bean = getBean(req); + if (getLoginUserGrant(req, bean.getTableBeanName()) > 0L) { + ResParm rp = beforeSearch(req, res); + if (rp.getStatus()) { + CRAdapter CR = getBeanCR(req); + if (isSimpleServlet(req) || (!getAct(req).equals("del") && !getAct(req).startsWith("save") && + !getBackRequest(req).equals(getACT_BACK()))) + fillObject(req, CR); + if (getBackRequest(req).equals(getACT_BACK()) || getAct(req).equals("del")) { + CR = (CRAdapter)req.getSession().getAttribute(getATTR_CRBEAN(req)); + if (CR == null) + CR = getBeanCR(req); + req.setAttribute("_id", CR.get_id()); + if (!getAct(req).startsWith("del")) + fillObject(req, CR); + CR.setFlgReport(""); + if (getAct2(req).equals("back")) + CR.setPageNumber(1); + } + int l_pageRow = getPageRow(req); + if (getAct(req).equals("sw")) { + setJspPageRelative(getBeanPageName(req) + "F.jsp", req); + req.setAttribute("RI", new ReturnItem(req.getParameter("RI"))); + } + req.setAttribute(getCRAttribute(req), CR); + req.getSession().setAttribute(getATTR_CRBEAN(req), CR); + ApplParmFull apFull = getApFull(req); + long l_id_lista = getRequestLongParameter(req, "id_tipoPadre"); + Tipo tipo = new Tipo(apFull); + tipo.findByPrimaryKey(l_id_lista); + req.setAttribute("tipoPadre", tipo); + if (CR.getFlgReport().equals("")) { + req.setAttribute("list", tipo.findFigli(0, 0)); + } else { + TipoCR tCR = new TipoCR(apFull); + tCR.setFlgSoloFoglie(1L); + req.setAttribute("list", tipo.findByCR(tCR, 0, 0)); + } + if (isSimpleServlet(req) && getCmd(req).equals("asq")) { + bean = (DBAdapter)req.getAttribute(getBEANAttribute(req)); + if (bean == null) + bean = getBean(req); + bean.setCurrentLang(getRequestParameter(req, "currentLang")); + req.setAttribute("bean", bean); + } + sendMessage(req, AbMessages.getMessage(getLocale(req), "SEARCH_OK")); + fillComboAfterSearch(CR, req, res); + callJsp(req, res); + } else { + sendMessage(req, rp.getMsg()); + callJsp(req, res); + } + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_R")); + callJsp(req, res); + } + } catch (Exception e) { + handleDebug(e, 0); + } + } + + protected void sqlActions(HttpServletRequest req, HttpServletResponse res) { + Object l_id; + long l_id_tipo = getRequestLongParameter(req, "id_tipo"); + if (l_id_tipo == 0L) { + req.setAttribute("flgFornitori", "1"); + req.setAttribute("flgAccessori", "1"); + req.setAttribute("flgTipoMagazzino", "1"); + } + DBAdapter bean = getBean(req); + String pk = getPKBeanName(req); + if (isPkBeanLong(req)) { + l_id = getRequestLongParameter(req, pk); + } else { + l_id = getRequestParameter(req, pk); + } + try { + if (getLoginUserGrant(req, bean.getTableBeanName()) >= 2L) { + bean.findByPrimaryKey(l_id); + if (getAct(req).startsWith("save") || getAct(req).equals("ni")) { + fillObject(req, bean); + if (bean.getDBState() == 1 || getLoginUserGrant(req, bean.getTableBeanName()) >= 3L) { + ResParm rp = beforeSave(bean, req, res); + if (rp.getStatus()) + rp.append(bean.save()); + req.setAttribute("_id", bean.get_Id()); + if (rp.getStatus() == true) { + if (isLoadImageServlet()) + rp.append(afterImgFileSave(bean, req, res)); + rp.append(afterSave(bean, req, res)); + if (rp.getStatus() == true) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + AbMessages.getMessage(getLocale(req), "SAVE_OK")); + if (getAct(req).equals("ni")) { + newRecord(req, res); + return; + } + if (!isSimpleServlet(req) || getRequestLongParameter(req, "sw") == 1L || l_id_tipo == 0L) + req.setAttribute(getBEANAttribute(req), bean); + } + } else { + forceMessage(req, rp.getMsg()); + req.setAttribute(getBEANAttribute(req), bean); + } + if (isSimpleServlet(req) && getRequestLongParameter(req, "sw") != 1L && l_id_tipo > 0L) { + showBean(req, res); + } else if (getAct(req).equals("saveJson")) { + DBAdapterSaveResponse dbRes = new DBAdapterSaveResponse(bean.get_Id(), bean.getLastUpdTmstString(), + bean.getLastUpdInfo(), + Ab.formatBeanMsg((String)req.getAttribute("msg"), (String)req.getAttribute("grantMsg")), + rp.getStatus()); + Gson gson = new Gson(); + sendHtmlMsgResponse(req, res, gson.toJson(dbRes)); + } else { + showBean(req, res); + } + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_RW")); + showBean(req, res); + } + } else if (getAct(req).startsWith("del")) { + if (getLoginUserGrant(req, bean.getTableBeanName()) >= 4L) { + ResParm rp = beforeDelete(req, res); + if (rp.getStatus()) + rp.append(bean.delete()); + req.setAttribute("_id", "0"); + if (rp.getStatus() == true) { + req.setAttribute(bean.get_IdName(), Integer.valueOf(0)); + rp.append(afterDelete(bean, req, res)); + if (rp.getStatus() == true) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK") + AbMessages.getMessage(getLocale(req), "DELETE_OK")); + if (isSimpleServlet(req)) { + actionsAfterDelete(req, res); + } else { + actionsAfterDelete(req, res); + } + } + } else { + forceMessage(req, rp.getMsg()); + showBean(req, res); + } + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_RWD")); + showBean(req, res); + } + } + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_RM")); + if (getCallType(req).equals("_json")) { + if (!isUserLogged(req, res)) + appendMessage(req, " Sessione Scaduta!"); + DBAdapterSaveResponse dbRes = new DBAdapterSaveResponse(String.valueOf(l_id), "", bean.getLastUpdInfo(), + Ab.formatBeanMsg((String)req.getAttribute("msg"), (String)req.getAttribute("grantMsg")), false); + Gson gson = new Gson(); + sendHtmlMsgResponse(req, res, gson.toJson(dbRes)); + } else { + showBean(req, res); + } + } + } catch (Exception e) { + if (getAct(req).startsWith("save")) + handleDebug(AbMessages.getMessage(getLocale(req), "SAVE_FAIL"), 2); + handleDebug(AbMessages.getMessage(getLocale(req), "DELETE_FAIL"), 2); + handleDebug(e, 2); + sendMessage(req, "Errore! " + e.getMessage()); + fillObject(req, bean); + req.setAttribute("bean", bean); + sendMessage(req, "Errore! " + e.getMessage()); + if (isSimpleServlet(req)) { + search(req, res); + } else if (getAct(req).equals("saveJson")) { + DBAdapterSaveResponse dbRes = new DBAdapterSaveResponse(bean.get_Id(), bean.getLastUpdTmstString(), + bean.getLastUpdInfo(), + Ab.formatBeanMsg((String)req.getAttribute("msg"), (String)req.getAttribute("grantMsg")), false); + Gson gson = new Gson(); + sendHtmlMsgResponse(req, res, gson.toJson(dbRes)); + } else { + showBean(req, res); + } + } + } + + public void _ebaySuggestion(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Tipo bean = new Tipo(apFull); + long l_id_tipo = getRequestLongParameter(req, "id_tipo"); + String l_query = getRequestParameter(req, "query"); + bean.findByPrimaryKey(l_id_tipo); + if (bean.getId_tipo() > 0L) { + ResParm rp = bean.setEbayCategorySuggestion(l_query); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else { + sendMessage(req, "Errore! tipo non trovato"); + search(req, res); + } + } + + protected void newRecord(HttpServletRequest req, HttpServletResponse res) { + search(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipoTagliaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipoTagliaSvlt.java new file mode 100644 index 00000000..19daa03e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipoTagliaSvlt.java @@ -0,0 +1,35 @@ +package it.acxent.art.servlet; + +import it.acxent.art.TipoTaglia; +import it.acxent.art.TipoTagliaCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/TipoTaglia.abl"}) +public class TipoTagliaSvlt extends AblServletSvlt { + private static final long serialVersionUID = -3601058077555964188L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoTaglia(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoTagliaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipologiaArticoloSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipologiaArticoloSvlt.java new file mode 100644 index 00000000..daf9202e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/TipologiaArticoloSvlt.java @@ -0,0 +1,35 @@ +package it.acxent.art.servlet; + +import it.acxent.art.TipologiaArticolo; +import it.acxent.art.TipologiaArticoloCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/TipologiaArticolo.abl"}) +public class TipologiaArticoloSvlt extends AblServletSvlt { + private static final long serialVersionUID = -3736301481115084639L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipologiaArticolo(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipologiaArticoloCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/VetrinaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/VetrinaSvlt.java new file mode 100644 index 00000000..ca8ef57f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/VetrinaSvlt.java @@ -0,0 +1,35 @@ +package it.acxent.art.servlet; + +import it.acxent.art.Vetrina; +import it.acxent.art.VetrinaCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/artConfig/Vetrina.abl"}) +public class VetrinaSvlt extends AblServletSvlt { + private static final long serialVersionUID = 8266633024577450589L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Vetrina(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new VetrinaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/_MagSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/_MagSvlt.java new file mode 100644 index 00000000..a01246ed --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/servlet/_MagSvlt.java @@ -0,0 +1,66 @@ +package it.acxent.art.servlet; + +import it.acxent.common.Users; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class _MagSvlt extends AblServletSvlt { + protected static ApplParmFull ap2; + + protected boolean checkLoginProfile(HttpServletRequest req) { + try { + if (getLoginUser(req) == null) { + forceJspPage(getLoginPage(null, null), req); + return true; + } + if (getLoginUser(req).getFlgValido().equals("N")) { + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return false; + } + if (getLoginUser(req).getId_userProfile() > 0L) + return true; + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return true; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + + protected String getAct3(HttpServletRequest req) { + return getRequestParameter(req, "act3"); + } + + protected String getCmd3(HttpServletRequest req) { + return getRequestParameter(req, "cmd3"); + } + + protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) { + return super.getLoginPage(req, res); + } + + protected Users getUser(HttpServletRequest req) { + return new it.acxent.anag.Users(getApFull(req)); + } + + protected boolean useAlwaysSendRedirect() { + return true; + } + + protected ApplParmFull getAp2() { + if (ap2 == null) { + ApplParmFull apFull = getApFull(); + ApplParm apx = new ApplParm(apFull.getParm("DBDRIVER2").getNumeroInt(), apFull.getParm("DBNAME2").getTesto(), + apFull.getParm("USER2").getTesto(), apFull.getParm("PASSWORD2").getTesto()); + ap2 = new ApplParmFull(apx); + } + return ap2; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoliModTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoliModTag.java new file mode 100644 index 00000000..b6004f4b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoliModTag.java @@ -0,0 +1,120 @@ +package it.acxent.art.taglib; + +import it.acxent.art.Articolo; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.io.Writer; +import java.text.NumberFormat; +import javax.servlet.jsp.JspException; + +public class ArticoliModTag extends AbstractDbTag { + private static final long serialVersionUID = -8502905190135425672L; + + private String rowbeanname; + + private Vectumerator theList; + + private long numArt; + + private String lang; + + private long numArtFetch; + + public int doAfterBody() throws JspException { + try { + boolean flgOk = false; + Articolo obj = null; + while (this.theList.hasMoreElements()) { + if (!(obj = (Articolo)this.theList.nextElement()).getNome().equals("")) { + flgOk = true; + break; + } + } + if (flgOk) { + this.pageContext.setAttribute(getRowbeanname(), obj); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter()); + return 0; + } catch (IOException ioexception) { + throw new JspException(ioexception.getMessage()); + } catch (Exception exception) { + throw new JspException(exception.getMessage()); + } + } + + public void doInitBody() {} + + public int doStartTag() { + try { + if (getNumArtFetch() == 0L) + return 0; + Articolo bean = new Articolo(getApFull()); + this.theList = bean.findUltimiModificatiRandom(getNumArt(), getNumArtFetch()); + } catch (Exception e) { + this.theList = new Vectumerator(); + } + if (this.theList == null) + return 0; + this.pageContext.getRequest().setAttribute("listaArticoli", this.theList); + this.theList.moveFirst(); + boolean flgOk = false; + Articolo obj = null; + while (this.theList.hasMoreElements()) { + if (!(obj = (Articolo)this.theList.nextElement()).getNome().equals("")) { + flgOk = true; + break; + } + } + if (flgOk) { + this.pageContext.setAttribute(getRowbeanname(), obj); + this.pageContext.setAttribute("nfV", getNf()); + this.pageContext.setAttribute("nf0V", getNf()); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + return 0; + } + + public String getRowbeanname() { + return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname; + } + + public long getNumArt() { + return this.numArt; + } + + public void setRowbeanname(String s) { + this.rowbeanname = s; + } + + public void setNumArt(long newStock) { + this.numArt = newStock; + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang; + } + + public void setLang(String lang) { + this.lang = lang; + } + + public long getNumArtFetch() { + return this.numArtFetch; + } + + public void setNumArtFetch(long id_tipo) { + this.numArtFetch = id_tipo; + } + + public NumberFormat getNf() { + return getApFull().getNf2(); + } + + public NumberFormat getNf0() { + return getApFull().getNf0(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoliModTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoliModTagExtraInfo.java new file mode 100644 index 00000000..13f9d446 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoliModTagExtraInfo.java @@ -0,0 +1,13 @@ +package it.acxent.art.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class ArticoliModTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean"; + String rowBeanClass = "it.acxent.art.Articolo"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nfV", "java.text.NumberFormat", true, 0), new VariableInfo("nf0V", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoliSimiliTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoliSimiliTag.java new file mode 100644 index 00000000..f74f2d3d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoliSimiliTag.java @@ -0,0 +1,141 @@ +package it.acxent.art.taglib; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.io.Writer; +import java.text.NumberFormat; +import javax.servlet.jsp.JspException; + +public class ArticoliSimiliTag extends AbstractDbTag { + private static final long serialVersionUID = -4134319548604597445L; + + private long id_articolo; + + private long id_tipo; + + private String rowbeanname; + + private Vectumerator theList; + + private String lang; + + private long numArt; + + public int doAfterBody() throws JspException { + try { + boolean flgOk = false; + Articolo obj = null; + while (this.theList.hasMoreElements()) { + if (!(obj = (Articolo)this.theList.nextElement()).getNome().equals("")) { + flgOk = true; + break; + } + } + if (flgOk) { + this.pageContext.setAttribute(getRowbeanname(), obj); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter()); + return 0; + } catch (IOException ioexception) { + throw new JspException(ioexception.getMessage()); + } catch (Exception exception) { + throw new JspException(exception.getMessage()); + } + } + + public void doInitBody() {} + + public int doStartTag() { + try { + Articolo bean = new Articolo(getApFull()); + ArticoloCR CR = new ArticoloCR(getApFull()); + if (getId_tipo() != 0L) { + CR.setId_tipoSel(getId_tipo()); + CR.setFlgNascondi(0L); + CR.setFlgEscludiWeb(0L); + CR.setId_articoloEscluso(getId_articolo()); + CR.setFlgDisponibile(1L); + this.theList = bean.findWebByArticoloCR(CR, 1, (int)getNumArt()); + if (this.theList.getTotNumberOfRecords() == 0) { + CR.setFlgDisponibile(0L); + this.theList = bean.findWebByArticoloCR(CR, 1, (int)getNumArt()); + } + } + } catch (Exception e) { + this.theList = new Vectumerator(); + } + if (this.theList == null) + return 0; + this.pageContext.getRequest().setAttribute("listaArticoliSimili", this.theList); + this.theList.moveFirst(); + boolean flgOk = false; + Articolo obj = null; + while (this.theList.hasMoreElements()) { + if (!(obj = (Articolo)this.theList.nextElement()).getNome().equals("")) { + flgOk = true; + break; + } + } + if (flgOk) { + this.pageContext.setAttribute(getRowbeanname(), obj); + this.pageContext.setAttribute("nfV", getNf()); + this.pageContext.setAttribute("nf0V", getNf()); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + return 0; + } + + public String getRowbeanname() { + return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname; + } + + public void setRowbeanname(String s) { + this.rowbeanname = s; + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang; + } + + public void setLang(String lang) { + this.lang = lang; + } + + public NumberFormat getNf() { + return getApFull().getNf2(); + } + + public NumberFormat getNf0() { + return getApFull().getNf0(); + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public void setId_tipo(long id_tipo) { + this.id_tipo = id_tipo; + } + + public long getNumArt() { + return (this.numArt <= 0L) ? 50L : this.numArt; + } + + public void setNumArt(long numArt) { + this.numArt = numArt; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoliSimiliTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoliSimiliTagExtraInfo.java new file mode 100644 index 00000000..7e41e698 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoliSimiliTagExtraInfo.java @@ -0,0 +1,13 @@ +package it.acxent.art.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class ArticoliSimiliTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean"; + String rowBeanClass = "it.acxent.art.Articolo"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nfV", "java.text.NumberFormat", true, 0), new VariableInfo("nf0V", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoloTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoloTag.java new file mode 100644 index 00000000..aff40bed --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoloTag.java @@ -0,0 +1,122 @@ +package it.acxent.art.taglib; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.io.Writer; +import java.text.NumberFormat; +import javax.servlet.jsp.JspException; + +public class ArticoloTag extends AbstractDbTag { + private String rowbeanname; + + private Vectumerator theList; + + private long flgStockOfferte; + + private String lang; + + private long id_tipo; + + public int doAfterBody() throws JspException { + try { + boolean flgOk = false; + Articolo obj = null; + while (this.theList.hasMoreElements()) { + if (!(obj = (Articolo)this.theList.nextElement()).getNome().equals("")) { + flgOk = true; + break; + } + } + if (flgOk) { + this.pageContext.setAttribute(getRowbeanname(), obj); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter()); + return 0; + } catch (IOException ioexception) { + throw new JspException(ioexception.getMessage()); + } catch (Exception exception) { + throw new JspException(exception.getMessage()); + } + } + + public void doInitBody() {} + + public int doStartTag() { + try { + if (getId_tipo() == 0L) + return 0; + Articolo bean = new Articolo(getApFull()); + ArticoloCR CR = new ArticoloCR(getApFull()); + CR.setId_tipo(getId_tipo()); + CR.setFlgStockOfferte(getFlgStockOfferte()); + this.theList = bean.findByCR(CR, 0, 0); + } catch (Exception e) { + this.theList = new Vectumerator(); + } + if (this.theList == null) + return 0; + this.pageContext.getRequest().setAttribute("listaArticoli", this.theList); + this.theList.moveFirst(); + boolean flgOk = false; + Articolo obj = null; + while (this.theList.hasMoreElements()) { + if (!(obj = (Articolo)this.theList.nextElement()).getNome().equals("")) { + flgOk = true; + break; + } + } + if (flgOk) { + this.pageContext.setAttribute(getRowbeanname(), obj); + this.pageContext.setAttribute("nfV", getNf()); + this.pageContext.setAttribute("nf0V", getNf()); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + return 0; + } + + public String getRowbeanname() { + return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname; + } + + public long getFlgStockOfferte() { + return this.flgStockOfferte; + } + + public void setRowbeanname(String s) { + this.rowbeanname = s; + } + + public void setFlgStockOfferte(long newStock) { + this.flgStockOfferte = newStock; + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang; + } + + public void setLang(String lang) { + this.lang = lang; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public void setId_tipo(long id_tipo) { + this.id_tipo = id_tipo; + } + + public NumberFormat getNf() { + return getApFull().getNf2(); + } + + public NumberFormat getNf0() { + return getApFull().getNf0(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoloTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoloTagExtraInfo.java new file mode 100644 index 00000000..18021c3b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/ArticoloTagExtraInfo.java @@ -0,0 +1,13 @@ +package it.acxent.art.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class ArticoloTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean"; + String rowBeanClass = "it.acxent.art.Articolo"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nfV", "java.text.NumberFormat", true, 0), new VariableInfo("nf0V", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/CaricaMarcaTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/CaricaMarcaTag.java new file mode 100644 index 00000000..28194589 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/CaricaMarcaTag.java @@ -0,0 +1,21 @@ +package it.acxent.art.taglib; + +import it.acxent.art.Marca; +import it.acxent.taglib.AbstractFillListTag; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.jsp.JspException; + +public class CaricaMarcaTag extends AbstractFillListTag { + public int doStartTag() throws JspException { + try { + HttpServletRequest req = (HttpServletRequest) + this.pageContext.getRequest(); + req.setAttribute("listaMarche", new Marca(getApFull()).findAll()); + } catch (Exception e) { + e.printStackTrace(); + throw new JspException("Errore per lista " + + getNomelista() + ": " + e.getMessage()); + } + return 0; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/CaricaTipoPagamentoTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/CaricaTipoPagamentoTag.java new file mode 100644 index 00000000..9e61d41e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/CaricaTipoPagamentoTag.java @@ -0,0 +1,51 @@ +package it.acxent.art.taglib; + +import it.acxent.anag.TipoPagamento; +import it.acxent.taglib.AbstractFillListTag; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.jsp.JspException; + +public class CaricaTipoPagamentoTag extends AbstractFillListTag { + private static final long serialVersionUID = 8171072309786599456L; + + private long flgwww; + + private boolean flgstranieri; + + private boolean flgNoFermopoint = false; + + public int doStartTag() throws JspException { + try { + HttpServletRequest req = (HttpServletRequest)this.pageContext.getRequest(); + req.setAttribute("listaTipoPagamento", new TipoPagamento(getApFull()).findPagamentiWww(isFlgstranieri(), isFlgNoFermopoint())); + } catch (Exception e) { + e.printStackTrace(); + throw new JspException("Errore per lista " + getNomelista() + ": " + e.getMessage()); + } + return 0; + } + + public long getFlgwww() { + return this.flgwww; + } + + public void setFlgwww(long flgwww) { + this.flgwww = flgwww; + } + + public boolean isFlgstranieri() { + return this.flgstranieri; + } + + public void setFlgstranieri(boolean flgstranieri) { + this.flgstranieri = flgstranieri; + } + + public boolean isFlgNoFermopoint() { + return this.flgNoFermopoint; + } + + public void setFlgNoFermopoint(boolean flgNoFermopoint) { + this.flgNoFermopoint = flgNoFermopoint; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/IfVetrinaTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/IfVetrinaTag.java new file mode 100644 index 00000000..028e0f7f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/IfVetrinaTag.java @@ -0,0 +1,72 @@ +package it.acxent.art.taglib; + +import it.acxent.art.Articolo; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.io.Writer; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; + +public class IfVetrinaTag extends AbstractDbTag { + private static final long serialVersionUID = 6779970689032134703L; + + protected int currentNestedValue; + + private long vetrina; + + protected static final String _WC = "_WC"; + + protected static final String _NESTVAL = "_WCNESTVAL"; + + public int doAfterBody() throws JspException { + try { + this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter()); + setNestedValue(); + return 0; + } catch (IOException ex) { + throw new JspTagException(ex.toString()); + } + } + + public int doStartTag() { + this.currentNestedValue = getNestedValue(); + this.pageContext.setAttribute("_WC" + this.currentNestedValue, new Boolean( + getWherecondition())); + if (getWherecondition()) + return 2; + return 0; + } + + protected int getNestedValue() { + if (this.pageContext.getAttribute("_WCNESTVAL") == null) { + this.pageContext.setAttribute("_WCNESTVAL", "1"); + return 1; + } + int nv = Integer.parseInt((String) + this.pageContext.getAttribute("_WCNESTVAL")); + nv++; + this.pageContext.setAttribute("_WCNESTVAL", String.valueOf(nv)); + return nv; + } + + public boolean getWherecondition() { + Vectumerator theList = new Articolo(getApFull()).findRandomArticoli( + getVetrina(), 1, false); + if (theList == null || theList.getTotNumberOfRecords() == 0) + return false; + return true; + } + + protected void setNestedValue() { + this.pageContext.setAttribute("_WCNESTVAL", String.valueOf(this.currentNestedValue)); + } + + public long getVetrina() { + return this.vetrina; + } + + public void setVetrina(long vetrina) { + this.vetrina = vetrina; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/TipoListJQTreeTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/TipoListJQTreeTag.java new file mode 100644 index 00000000..d459e039 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/TipoListJQTreeTag.java @@ -0,0 +1,10 @@ +package it.acxent.art.taglib; + +import it.acxent.art.Tipo; +import it.acxent.db.DBAdapter; + +public class TipoListJQTreeTag extends it.acxent.taglib.TipoListJQTreeTag { + protected DBAdapter getTipoBean() { + return new Tipo(getApFull()); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/TipoListTreeTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/TipoListTreeTag.java new file mode 100644 index 00000000..8b6cad57 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/TipoListTreeTag.java @@ -0,0 +1,10 @@ +package it.acxent.art.taglib; + +import it.acxent.art.Tipo; +import it.acxent.db.DBAdapter; + +public class TipoListTreeTag extends it.acxent.taglib.TipoListTreeTag { + protected DBAdapter getTipoBean() { + return new Tipo(getApFull()); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/VetrinaTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/VetrinaTag.java new file mode 100644 index 00000000..067ba1e0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/VetrinaTag.java @@ -0,0 +1,86 @@ +package it.acxent.art.taglib; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloInterface; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.text.NumberFormat; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; + +public class VetrinaTag extends AbstractDbTag { + private static final long serialVersionUID = 1326761270282219980L; + + private String rowbeanname; + + private long vetrina; + + private int num; + + private Vectumerator theList; + + public int doAfterBody() throws JspException { + try { + if (this.theList.hasMoreElements()) { + ArticoloInterface row = (ArticoloInterface)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + String body = getBodyContent().getString(); + this.bodyContent.getEnclosingWriter().print(body); + return 0; + } catch (IOException ex) { + throw new JspTagException(ex.toString()); + } + } + + public int doStartTag() { + this.theList = new Articolo(getApFull()).findRandomArticoli(getVetrina(), getNum(), true); + if (this.theList == null) + return 0; + this.theList.moveFirst(); + if (this.theList.hasMoreElements()) { + ArticoloInterface row = (ArticoloInterface)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("nfV", getNf()); + this.pageContext.setAttribute("nf0V", getNf()); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + return 0; + } + + public String getRowbeanname() { + return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname; + } + + public void setRowbeanname(String s) { + this.rowbeanname = s; + } + + public long getVetrina() { + return this.vetrina; + } + + public void setVetrina(long vetrina) { + this.vetrina = vetrina; + } + + public int getNum() { + return (this.num == 0) ? 1 : this.num; + } + + public void setNum(int num) { + this.num = num; + } + + public NumberFormat getNf() { + return getApFull().getNf2(); + } + + public NumberFormat getNf0() { + return getApFull().getNf0(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/VetrinaTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/VetrinaTagExtraInfo.java new file mode 100644 index 00000000..1c316132 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/VetrinaTagExtraInfo.java @@ -0,0 +1,13 @@ +package it.acxent.art.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class VetrinaTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean"; + String rowBeanClass = "it.acxent.art.ArticoloInterface"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nfV", "java.text.NumberFormat", true, 0), new VariableInfo("nf0V", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/WhileTipoTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/WhileTipoTag.java new file mode 100644 index 00000000..501b3d70 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/WhileTipoTag.java @@ -0,0 +1,205 @@ +package it.acxent.art.taglib; + +import it.acxent.art.Tipo; +import it.acxent.art.TipoCR; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.io.Writer; +import javax.servlet.jsp.JspException; + +public class WhileTipoTag extends AbstractDbTag { + private static final long serialVersionUID = 424566058875546947L; + + private String rowbeanname; + + private Vectumerator theList; + + private String lang; + + private long id_tipoPadre; + + private long id_tipoPadreSelected; + + private long id_reparto; + + private String flgStockOfferte; + + private long flgWww; + + private long limit; + + private long start; + + private String tag; + + private String id_marche; + + private long flgMainPage; + + public int doAfterBody() throws JspException { + try { + boolean flgOk = false; + Tipo obj = null; + while (this.theList.hasMoreElements()) { + obj = (Tipo)this.theList.nextElement(); + if (!obj.getDescrizione(getLang()).equals("")) { + flgOk = true; + break; + } + } + if (flgOk) { + this.pageContext.setAttribute(getRowbeanname(), obj); + return 2; + } + this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter()); + return 0; + } catch (IOException ioexception) { + throw new JspException(ioexception.getMessage()); + } catch (Exception exception) { + throw new JspException(exception.getMessage()); + } + } + + public void doInitBody() {} + + public int doStartTag() { + try { + if (getId_tipoPadre() != 0L && getId_tipoPadre() != getId_tipoPadreSelected()) + return 0; + Tipo bean = new Tipo(getApFull()); + TipoCR CR = new TipoCR(); + if (getId_tipoPadre() != 0L) { + bean.findByPrimaryKey(getId_tipoPadre()); + } else { + CR.setId_marche(getId_marche()); + } + CR.setFlgNascondi(0L); + CR.setFlgEscludiWeb(0L); + CR.setId_reparto(getId_reparto()); + CR.setFlgEscludiWeb(getFlgWww()); + CR.setLimit(getLimit()); + CR.setStart(getStart()); + CR.setTag(getTag()); + if (getFlgMainPage() == 1L) + CR.setFlgMainPage(getFlgMainPage()); + this.theList = bean.findFigli(CR, 0, 0, false); + } catch (Exception e) { + e.printStackTrace(); + this.theList = new Vectumerator(); + } + if (this.theList == null) + return 0; + this.pageContext.getRequest().setAttribute("listaTipi", this.theList); + this.theList.moveFirst(); + boolean flgOk = false; + Tipo obj = null; + while (this.theList.hasMoreElements()) { + if (!(obj = (Tipo)this.theList.nextElement()).getDescrizione(getLang()).equals("")) { + flgOk = true; + break; + } + } + if (flgOk) { + this.pageContext.setAttribute(getRowbeanname(), obj); + return 2; + } + return 0; + } + + public String getRowbeanname() { + return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname; + } + + public void setRowbeanname(String s) { + this.rowbeanname = s; + } + + public long getId_tipoPadreSelected() { + return this.id_tipoPadreSelected; + } + + public void setId_tipoPadreSelected(long id_tipoPadreSelected) { + this.id_tipoPadreSelected = id_tipoPadreSelected; + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang; + } + + public void setLang(String lang) { + this.lang = lang; + } + + public long getId_tipoPadre() { + return this.id_tipoPadre; + } + + public void setId_tipoPadre(long id_tipoPadre) { + this.id_tipoPadre = id_tipoPadre; + } + + public long getId_reparto() { + return this.id_reparto; + } + + public void setId_reparto(long id_reparto) { + this.id_reparto = id_reparto; + } + + public String getFlgStockOfferte() { + return (this.flgStockOfferte == null) ? "" : this.flgStockOfferte; + } + + public void setFlgStockOfferte(String flgStato) { + this.flgStockOfferte = flgStato; + } + + public long getFlgWww() { + return this.flgWww; + } + + public void setFlgWww(long flgWww) { + this.flgWww = flgWww; + } + + public long getLimit() { + return this.limit; + } + + public void setLimit(long limit) { + this.limit = limit; + } + + public long getStart() { + return this.start; + } + + public void setStart(long start) { + this.start = start; + } + + public String getTag() { + return (this.tag == null) ? "" : this.tag.trim(); + } + + public void setTag(String tag) { + this.tag = tag; + } + + public String getId_marche() { + return (this.id_marche == null) ? "" : this.id_marche.trim(); + } + + public void setId_marche(String id_marche) { + this.id_marche = id_marche; + } + + public long getFlgMainPage() { + return this.flgMainPage; + } + + public void setFlgMainPage(long flgMainPage) { + this.flgMainPage = flgMainPage; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/WhileTipoTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/WhileTipoTagExtraInfo.java new file mode 100644 index 00000000..b66bcb9b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/art/taglib/WhileTipoTagExtraInfo.java @@ -0,0 +1,15 @@ +package it.acxent.art.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class WhileTipoTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? + tagdata.getAttributeString("rowbeanname") : + "rowBean"; + String rowBeanClass = "it.acxent.art.Tipo"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/Banner.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/Banner.java new file mode 100644 index 00000000..5bd9543e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/Banner.java @@ -0,0 +1,388 @@ +package it.acxent.banner; + +import it.acxent.anag.Clifor; +import it.acxent.anag._AnagAdapter; +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.util.Random; + +public class Banner extends _AnagAdapter implements AddImgInterface, Serializable { + private static final long serialVersionUID = 5881146247767448667L; + + private long id_banner; + + private long id_tipoBanner; + + private long flgAttivo; + + private String descrizioneClifor; + + private Date dataInizioCampagna; + + private Date dataFineCampagna; + + private long priorita; + + private TipoBanner tipoBanner; + + private Clifor clifor; + + private long flgTipo; + + private long impression; + + private long clickThrough; + + public Banner(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public static long TIPO_IMMAGINE = 0L; + + public static long TIPO_TESTO = 1L; + + private String link; + + private String descrizioneBanner; + + private String titolo; + + private long id_clifor; + + public Banner() { + initFields(); + } + + public void setId_banner(long newId_banner) { + this.id_banner = newId_banner; + } + + public void setId_tipoBanner(long newId_tipoBanner) { + this.id_tipoBanner = newId_tipoBanner; + setTipoBanner(null); + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setLink(String newLink) { + this.link = newLink; + } + + public void setDataInizioCampagna(Date newDataInizioCampagna) { + this.dataInizioCampagna = newDataInizioCampagna; + } + + public void setDataFineCampagna(Date newDataFineCampagna) { + this.dataFineCampagna = newDataFineCampagna; + } + + public void setPriorita(long newPeso) { + this.priorita = newPeso; + } + + public long getId_banner() { + return this.id_banner; + } + + public long getId_tipoBanner() { + return this.id_tipoBanner; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public String getLink() { + if (this.link == null) + return ""; + if (this.link.toLowerCase().startsWith("http://") || this.link.toLowerCase().startsWith("https://")) + return this.link.trim(); + return "http://" + this.link.trim(); + } + + public Date getDataInizioCampagna() { + return this.dataInizioCampagna; + } + + public Date getDataFineCampagna() { + return this.dataFineCampagna; + } + + public long getPriorita() { + return this.priorita; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public void setTipoBanner(TipoBanner newTipoBanner) { + this.tipoBanner = newTipoBanner; + } + + public TipoBanner getTipoBanner() { + if (this.tipoBanner == null && getId_tipoBanner() != 0L) + try { + this.tipoBanner = new TipoBanner(getApFull()); + this.tipoBanner.findByPrimaryKey(new Long(getId_tipoBanner())); + } catch (Exception e) {} + return (this.tipoBanner == null) ? new TipoBanner() : this.tipoBanner; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public long getFlgAttivo() { + return this.flgAttivo; + } + + public void setFlgAttivo(long flgAttivo) { + this.flgAttivo = flgAttivo; + } + + public long getImpression() { + return this.impression; + } + + public void setImpression(long impression) { + this.impression = impression; + } + + public long getClickThrough() { + return this.clickThrough; + } + + public void setClickThrough(long clickThrough) { + this.clickThrough = clickThrough; + } + + public void addBannerStats(String l_entryPoint, String l_ip, String l_flgI_CT) {} + + public String getTitolo() { + return (this.titolo == null) ? "" : this.titolo.trim(); + } + + public void setTitolo(String titolo) { + this.titolo = titolo; + } + + public String getDescrizioneBanner() { + return (this.descrizioneBanner == null) ? "" : this.descrizioneBanner.trim(); + } + + public void setDescrizioneBanner(String descrizioneBanner) { + this.descrizioneBanner = descrizioneBanner; + } + + public String getDescrizioneClifor() { + if (getId_clifor() != 0L) + return getClifor().getDescrizioneCompleta(); + return (this.descrizioneClifor == null) ? "" : this.descrizioneClifor.trim(); + } + + public void setDescrizioneClifor(String descrizioneClifor) { + this.descrizioneClifor = descrizioneClifor; + } + + public Vectumerator findByCR(BannerCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from BANNER AS A"; + String s_Sql_Order = " ORDER BY A.descrizioneClifor "; + WcString wc = new WcString(); + if (!CR.getDescrizioneClifor().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getDescrizioneClifor().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizioneClifor like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getFlgAttivo() == 0L) { + wc.addWc("(A.flgAttivo is null or A.flgAttivo=0 or A.dataFineVld is null)"); + } else if (CR.getFlgAttivo() > 0L) { + wc.addWc("A.flgAttivo = 1"); + wc.addWc("A.dataFineVld is not null"); + } + if (CR.getDataFineCampagnaDa() != null) + wc.addWc("A.dataFineCampagna >= ? "); + if (CR.getDataFineCampagnaA() != null) + wc.addWc("A.dataFineCampagna <= ? "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + int dataCount = 0; + if (CR.getDataFineCampagnaDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataFineCampagnaDa()); + } + if (CR.getDataFineCampagnaA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataFineCampagnaA()); + } + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e, 2); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getPathImgBanner() { + return getParm("PATH_IMG_BANNER").getTesto(); + } + + protected int getStringValueCase(String l_colomnName) { + return 0; + } + + public Banner getRandomBanner(long l_id_tipoBanner) { + String s_Sql_Find = "select A.* from BANNER AS A"; + String wc = ""; + String wcPrior = ""; + wc = buildWc(wc, "A.id_tipoBanner =" + l_id_tipoBanner); + wc = buildWc(wc, "A.dataFineVld is null"); + wc = buildWc(wc, "A.flgAttivo=1"); + wc = buildWc(wc, "A.dataInizioCampagna<=?"); + wc = buildWc(wc, "A.dataFineCampagna>=?"); + int prioritySeed = (int)(Math.random() * 10.0D); + wcPrior = " and A.priorita>" + prioritySeed; + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + stmt.setDate(1, getToday()); + stmt.setDate(2, getToday()); + Vectumerator vec = findRows(stmt, 0, 0); + while (vec.getTotNumberOfRecords() == 0 && prioritySeed-- > 0) { + wcPrior = " and A.priorita>" + prioritySeed; + stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + stmt.setDate(1, getToday()); + stmt.setDate(2, getToday()); + vec = findRows(stmt, 0, 0); + } + int totBanner = vec.getTotNumberOfRecords(); + if (totBanner > 0) { + int idx = (int)(Math.random() * (double)totBanner); + return (Banner)vec.elementAt(idx); + } + return null; + } catch (Exception e) { + return null; + } + } + + public void addClickThrough(String ipAddress, String entryPoint) { + try { + if (getDBState() == 1) + synchronized (this) { + setClickThrough(getClickThrough() + 1L); + ResParm resParm = save(); + } + } catch (Exception e) { + handleDebug(e); + } + } + + public void addImpression(String ipAddress, String entryPoint) { + try { + if (getDBState() == 1) + synchronized (this) { + setImpression(getImpression() + 1L); + ResParm resParm = save(); + } + } catch (Exception e) { + handleDebug(e); + } + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public void setFlgTipo(long flgTipo) { + this.flgTipo = flgTipo; + } + + public static String getTipo(long l_flgTipo) { + if (l_flgTipo == TIPO_IMMAGINE) + return "Immagine"; + return "Testo"; + } + + public String getTipo() { + return getTipo(getFlgTipo()); + } + + public Vectumerator findRandomBannerAttivi(long l_id_tipoBanner, long totBanner) { + String limit; + boolean debug = false; + String s_Sql_Find = "select A.* from BANNER AS A"; + String s_Sql_order = " order by rand()"; + WcString wc = new WcString(); + String wcPrior = ""; + if (totBanner == 0L) { + limit = ""; + } else { + limit = " limit " + totBanner; + } + wc.addWc("A.id_tipoBanner =" + l_id_tipoBanner); + wc.addWc("A.dataFineVld is null"); + wc.addWc("A.flgAttivo=1"); + wc.addWc("A.dataInizioCampagna<=?"); + wc.addWc("(A.dataFineCampagna is null or A.dataFineCampagna>=?)"); + Random r = new Random(); + int prioritySeed = Math.abs(r.nextInt()) % 11; + if (totBanner > 0L) + wcPrior = " and A.priorita>=" + prioritySeed; + try { + if (debug) + System.out.println(s_Sql_Find + s_Sql_Find + wc.toString() + wcPrior + s_Sql_order); + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + wcPrior + s_Sql_order); + stmt.setDate(1, getToday()); + stmt.setDate(2, getToday()); + Vectumerator vec = findRows(stmt, 0, 0); + if (totBanner > 0L) + while ((long)vec.getTotNumberOfRecords() < totBanner && prioritySeed-- >= 0) { + wcPrior = " and A.priorita>=" + prioritySeed; + if (debug) + System.out.println("" + prioritySeed + ": " + prioritySeed + s_Sql_Find + wc.toString() + wcPrior + s_Sql_order); + stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + wcPrior + s_Sql_order); + stmt.setDate(1, getToday()); + stmt.setDate(2, getToday()); + vec = findRows(stmt, 0, 0); + } + return vec; + } catch (Exception e) { + return null; + } + } + + public boolean useDescLangTables() { + return true; + } + + public String getLink(String lang) { + return getDescTxtLang("link", lang.isEmpty() ? "it" : lang); + } + + public String getPathImg() { + return getPathImgBanner(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/BannerCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/BannerCR.java new file mode 100644 index 00000000..c702c4e5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/BannerCR.java @@ -0,0 +1,190 @@ +package it.acxent.banner; + +import it.acxent.anag.Clifor; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class BannerCR extends CRAdapter { + private static final long serialVersionUID = 6525841841815655751L; + + private long id_banner; + + private long id_tipoBanner; + + private long id_clifor; + + private String link; + + private Date dataInizioCampagna; + + private Date dataFineCampagna; + + private long flgAttivo = -1L; + + private long impression; + + private long clickThrough; + + private Date dataFineVld; + + private long priorita; + + private TipoBanner tipoBanner; + + private Clifor clifor; + + private Date dataFineCampagnaDa; + + private Date dataFineCampagnaA; + + private String descrizioneClifor; + + private String descrizioneBanner; + + public BannerCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public BannerCR() {} + + public void setId_banner(long newId_banner) { + this.id_banner = newId_banner; + } + + public void setId_tipoBanner(long newId_tipoBanner) { + this.id_tipoBanner = newId_tipoBanner; + setTipoBanner(null); + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setLink(String newLink) { + this.link = newLink; + } + + public void setDataInizioCampagna(Date newDataInizioCampagna) { + this.dataInizioCampagna = newDataInizioCampagna; + } + + public void setDataFineCampagna(Date newDataFineCampagna) { + this.dataFineCampagna = newDataFineCampagna; + } + + public void setFlgAttivo(long newFlgAttivo) { + this.flgAttivo = newFlgAttivo; + } + + public void setImpression(long newImpression) { + this.impression = newImpression; + } + + public void setClickThrough(long newClickThrough) { + this.clickThrough = newClickThrough; + } + + public void setDataFineVld(Date newDataFineVld) { + this.dataFineVld = newDataFineVld; + } + + public void setPriorita(long newPriorita) { + this.priorita = newPriorita; + } + + public long getId_banner() { + return this.id_banner; + } + + public long getId_tipoBanner() { + return this.id_tipoBanner; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public String getLink() { + return (this.link == null) ? "" : this.link.trim(); + } + + public Date getDataInizioCampagna() { + return this.dataInizioCampagna; + } + + public Date getDataFineCampagna() { + return this.dataFineCampagna; + } + + public long getFlgAttivo() { + return this.flgAttivo; + } + + public long getImpression() { + return this.impression; + } + + public long getClickThrough() { + return this.clickThrough; + } + + public Date getDataFineVld() { + return this.dataFineVld; + } + + public long getPriorita() { + return this.priorita; + } + + public void setTipoBanner(TipoBanner newTipoBanner) { + this.tipoBanner = newTipoBanner; + } + + public TipoBanner getTipoBanner() { + this.tipoBanner = (TipoBanner)getSecondaryObject(this.tipoBanner, TipoBanner.class, getId_tipoBanner()); + return this.tipoBanner; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public Date getDataFineCampagnaDa() { + return this.dataFineCampagnaDa; + } + + public void setDataFineCampagnaDa(Date dataFineCampagnaDa) { + this.dataFineCampagnaDa = dataFineCampagnaDa; + } + + public Date getDataFineCampagnaA() { + return this.dataFineCampagnaA; + } + + public void setDataFineCampagnaA(Date dataFineCampagnaA) { + this.dataFineCampagnaA = dataFineCampagnaA; + } + + public String getDescrizioneClifor() { + return (this.descrizioneClifor == null) ? AB_EMPTY_STRING : this.descrizioneClifor.trim(); + } + + public void setDescrizioneClifor(String descrizioneClifor) { + this.descrizioneClifor = descrizioneClifor; + } + + public String getDescrizioneBanner() { + return (this.descrizioneBanner == null) ? AB_EMPTY_STRING : this.descrizioneBanner.trim(); + } + + public void setDescrizioneBanner(String descrizioneBanner) { + this.descrizioneBanner = descrizioneBanner; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/BannerStats.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/BannerStats.java new file mode 100644 index 00000000..2743a46b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/BannerStats.java @@ -0,0 +1,115 @@ +package it.acxent.banner; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import java.io.Serializable; +import java.sql.Timestamp; + +public class BannerStats extends DBAdapter implements Serializable { + private static final long serialVersionUID = 6419058127916391758L; + + private long id_bannerStats; + + private Timestamp dataTimestamp; + + private String entryPoint; + + private String nazione; + + private String ipAddress; + + private long flgI_CT; + + public static final long FLG_IMPRESSION = 0L; + + public static final long FLG_CLICK_THROUGH = 1L; + + private Banner banner; + + private long id_banner; + + public BannerStats(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public BannerStats() { + initFields(); + } + + public void setId_bannerStats(long newId_stats) { + this.id_bannerStats = newId_stats; + } + + public void setDataTimestamp(Timestamp newDataTimestamp) { + this.dataTimestamp = newDataTimestamp; + } + + public void setEntryPoint(String newEntryPoint) { + this.entryPoint = newEntryPoint; + } + + public void setNazione(String newNazione) { + this.nazione = newNazione; + } + + public void setIpAddress(String newIp) { + this.ipAddress = newIp; + } + + public void setId_banner(long newId_banner) { + this.id_banner = newId_banner; + setBanner(null); + } + + public long getId_bannerStats() { + return this.id_bannerStats; + } + + public Timestamp getDataTimestamp() { + return this.dataTimestamp; + } + + public String getEntryPoint() { + return (this.entryPoint == null) ? "" : + this.entryPoint; + } + + public String getNazione() { + return (this.nazione == null) ? "" : + this.nazione; + } + + public String getIpAddress() { + return (this.ipAddress == null) ? "" : + this.ipAddress; + } + + public long getId_banner() { + return this.id_banner; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public void setBanner(Banner newBanner) { + this.banner = newBanner; + } + + public Banner getBanner() { + this.banner = (Banner)getSecondaryObject(this.banner, Banner.class, + getId_banner()); + return this.banner; + } + + public long getFlgI_CT() { + return this.flgI_CT; + } + + public void setFlgI_CT(long flgICT) { + this.flgI_CT = flgICT; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/BannerStatsCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/BannerStatsCR.java new file mode 100644 index 00000000..7951df93 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/BannerStatsCR.java @@ -0,0 +1,89 @@ +package it.acxent.banner; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Timestamp; + +public class BannerStatsCR extends CRAdapter { + private static final long serialVersionUID = 4917678275987240356L; + + private long id_bannerStats; + + private long id_banner; + + private String entryPoint; + + private String ipAddress; + + private Timestamp dataTimestamp; + + private long flgI_CT; + + private Banner banner; + + public BannerStatsCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public BannerStatsCR() {} + + public void setId_bannerStats(long newId_bannerStats) { + this.id_bannerStats = newId_bannerStats; + } + + public void setId_banner(long newId_banner) { + this.id_banner = newId_banner; + setBanner(null); + } + + public void setEntryPoint(String newEntryPoint) { + this.entryPoint = newEntryPoint; + } + + public void setIpAddress(String newIpAddress) { + this.ipAddress = newIpAddress; + } + + public void setDataTimestamp(Timestamp newDataTimestamp) { + this.dataTimestamp = newDataTimestamp; + } + + public void setFlgI_CT(long newFlgI_CT) { + this.flgI_CT = newFlgI_CT; + } + + public long getId_bannerStats() { + return this.id_bannerStats; + } + + public long getId_banner() { + return this.id_banner; + } + + public String getEntryPoint() { + return (this.entryPoint == null) ? "" : this.entryPoint.trim(); + } + + public String getIpAddress() { + return (this.ipAddress == null) ? "" : this.ipAddress.trim(); + } + + public Timestamp getDataTimestamp() { + return this.dataTimestamp; + } + + public long getFlgI_CT() { + return this.flgI_CT; + } + + public void setBanner(Banner newBanner) { + this.banner = newBanner; + } + + public Banner getBanner() { + this.banner = (Banner)getSecondaryObject(this.banner, Banner.class, + + getId_banner()); + return this.banner; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/TipoBanner.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/TipoBanner.java new file mode 100644 index 00000000..c9a2efbf --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/TipoBanner.java @@ -0,0 +1,125 @@ +package it.acxent.banner; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.DoubleOperator; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoBanner extends DBAdapter implements Serializable { + private static final long serialVersionUID = -5428233945744683626L; + + private long id_tipoBanner; + + private String descrizione; + + private String larghezza; + + private static final long SCALED_WIDTH = 80L; + + private String altezza; + + public TipoBanner(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoBanner() { + initFields(); + } + + public void setId_tipoBanner(long newId_tipoBanner) { + this.id_tipoBanner = newId_tipoBanner; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setLarghezza(String newLarghezza) { + this.larghezza = newLarghezza; + } + + public void setAltezza(String newAltezza) { + this.altezza = newAltezza; + } + + public long getId_tipoBanner() { + return this.id_tipoBanner; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public String getLarghezza() { + return (this.larghezza == null) ? "" : this.larghezza.trim(); + } + + public String getAltezza() { + return (this.altezza == null) ? "" : this.altezza.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoBannerCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_BANNER AS A"; + String s_Sql_Order = " order by A.descrizione"; + String wc = ""; + if (!CR.getSearchTxt().isEmpty()) + wc = buildWc(wc, "A.descrizione like'" + CR.getSearchTxt() + "%' "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizioneCompleta() { + return getDescrizione() + " " + getDescrizione() + "x" + getLarghezza(); + } + + public String getLarghezzaScalata() { + return getLarghezzaScalataBase(); + } + + public String getAltezzaScalata() { + if (getId_tipoBanner() == 0L) + return ""; + try { + if (getLarghezza().indexOf("%") > 0) + return ""; + long l_larghezza = 80L, l_larghezzaScalataBase = 80L; + try { + l_larghezza = Long.parseLong(getLarghezza()); + l_larghezzaScalataBase = Long.parseLong(getLarghezzaScalataBase()); + } catch (Exception e) {} + DoubleOperator dop = new DoubleOperator(getAltezza()); + dop.multiply(l_larghezzaScalataBase); + dop.divide((float)l_larghezza); + return String.valueOf((long)dop.getResult()); + } catch (Exception e) { + return "Errore! " + getId_tipoBanner(); + } + } + + private String getLarghezzaScalataBase() { + if (getLarghezza().indexOf("%") > 0) + return getLarghezza(); + long l_larghezza = 80L; + try { + l_larghezza = Long.parseLong(getLarghezza()); + } catch (Exception e) {} + if (l_larghezza < 80L) + return getLarghezza(); + return String.valueOf(80L); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/TipoBannerCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/TipoBannerCR.java new file mode 100644 index 00000000..c7a0918b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/TipoBannerCR.java @@ -0,0 +1,54 @@ +package it.acxent.banner; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoBannerCR extends CRAdapter { + private static final long serialVersionUID = 3379239974016953608L; + + private long id_tipoBanner; + + private String descrizione; + + private long larghezza; + + private long altezza; + + public TipoBannerCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoBannerCR() {} + + public void setId_tipoBanner(long newId_tipoBanner) { + this.id_tipoBanner = newId_tipoBanner; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setLarghezza(long newLarghezza) { + this.larghezza = newLarghezza; + } + + public void setAltezza(long newAltezza) { + this.altezza = newAltezza; + } + + public long getId_tipoBanner() { + return this.id_tipoBanner; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getLarghezza() { + return this.larghezza; + } + + public long getAltezza() { + return this.altezza; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/admin/servlet/BannerSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/admin/servlet/BannerSvlt.java new file mode 100644 index 00000000..9afeb3ba --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/admin/servlet/BannerSvlt.java @@ -0,0 +1,88 @@ +package it.acxent.banner.admin.servlet; + +import it.acxent.banner.Banner; +import it.acxent.banner.BannerCR; +import it.acxent.banner.TipoBanner; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.AbMessages; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/banner/Banner.abl"}) +public class BannerSvlt extends AblServletSvlt { + private static final long serialVersionUID = 981925429903626015L; + + protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("nf0", getApFull(req).getNf0()); + req.setAttribute("listaTipoBanner", new TipoBanner(getApFull(req)).findAll()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("nf0", getApFull(req).getNf0()); + req.setAttribute("listaTipoBanner", new TipoBanner(getApFull(req)).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Banner(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new BannerCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("nf0", getApFull(req).getNf0()); + req.setAttribute("listaTipoBanner", new TipoBanner(getApFull(req)).findAll()); + } + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + Banner bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_Banner"); + bean = new Banner(getApFull(req)); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + req.setAttribute("id_Banner", String.valueOf(bean.getId_banner())); + if (rp.getStatus() != true) { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + synchronized (this) { + return super.afterSave(beanA, req, res); + } + } + + public String getPathImg(HttpServletRequest req) { + return ((Banner)getBean(req)).getPathImgBanner(); + } + + protected boolean isLoadImageServlet() { + return true; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + search(req, res); + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + super.search(req, res); + } + + protected String getAttachPath(HttpServletRequest req) { + return getPathImg(req); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/admin/servlet/TipoBannerSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/admin/servlet/TipoBannerSvlt.java new file mode 100644 index 00000000..c90114c2 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/admin/servlet/TipoBannerSvlt.java @@ -0,0 +1,37 @@ +package it.acxent.banner.admin.servlet; + +import it.acxent.banner.TipoBanner; +import it.acxent.banner.TipoBannerCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/bannerConfig/TipoBanner.abl"}) +public class TipoBannerSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("nf0", getApFull(req).getNf0()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("nf0", getApFull(req).getNf0()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoBanner(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoBannerCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/servlet/BannerSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/servlet/BannerSvlt.java new file mode 100644 index 00000000..e14df43d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/servlet/BannerSvlt.java @@ -0,0 +1,47 @@ +package it.acxent.banner.servlet; + +import it.acxent.banner.Banner; +import it.acxent.servlet.AcServlet; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/Banner.abl"}) +public class BannerSvlt extends AcServlet { + private static final long serialVersionUID = 6605089558224077770L; + + protected long getId(HttpServletRequest req) { + return getRequestLongParameter(req, "id"); + } + + protected void go(HttpServletRequest req, HttpServletResponse res) { + long l_id = getId(req); + Banner bean = null; + try { + bean = new Banner(getApFull(req)); + bean.findByPrimaryKey(l_id); + if (bean.getId_banner() > 0L) { + bean.addClickThrough(req.getRemoteAddr(), req.getServletPath()); + res.sendRedirect(bean.getLink()); + } else { + res.setStatus(301); + res.setHeader("Location", "index.html"); + res.setHeader("Connection", "close"); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + go(req, res); + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + go(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/taglib/BannerListTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/taglib/BannerListTag.java new file mode 100644 index 00000000..f8f458f8 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/taglib/BannerListTag.java @@ -0,0 +1,76 @@ +package it.acxent.banner.taglib; + +import it.acxent.banner.Banner; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; + +public class BannerListTag extends AbstractDbTag { + private static final long serialVersionUID = -7097463449105205677L; + + private String rowbeanname; + + private int num; + + private Vectumerator theList; + + private long bannertype; + + public int doAfterBody() throws JspException { + try { + if (this.theList.hasMoreElements()) { + Banner row = (Banner)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("idx", new Long((long)this.theList.getIndex())); + row.addImpression(getReq().getRemoteAddr(), getReq().getServletPath()); + return 2; + } + String body = getBodyContent().getString(); + this.bodyContent.getEnclosingWriter().print(body); + return 0; + } catch (IOException ex) { + throw new JspTagException(ex.toString()); + } + } + + public int doStartTag() { + this.theList = new Banner(getApFull()).findRandomBannerAttivi(getBannertype(), (long)getNum()); + if (this.theList == null) + return 0; + this.theList.moveFirst(); + if (this.theList.hasMoreElements()) { + Banner row = (Banner)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("idx", new Long((long)this.theList.getIndex())); + row.addImpression(getReq().getRemoteAddr(), getReq().getServletPath()); + return 2; + } + return 0; + } + + public String getRowbeanname() { + return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname; + } + + public void setRowbeanname(String s) { + this.rowbeanname = s; + } + + public int getNum() { + return this.num; + } + + public void setNum(int num) { + this.num = num; + } + + public long getBannertype() { + return this.bannertype; + } + + public void setBannertype(long newTipobanner) { + this.bannertype = newTipobanner; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/taglib/BannerListTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/taglib/BannerListTagExtraInfo.java new file mode 100644 index 00000000..f8ebca28 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/taglib/BannerListTagExtraInfo.java @@ -0,0 +1,13 @@ +package it.acxent.banner.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class BannerListTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean"; + String rowBeanClass = "it.acxent.banner.Banner"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("idx", "java.lang.Long", true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/taglib/BannerTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/taglib/BannerTag.java new file mode 100644 index 00000000..4173731b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/taglib/BannerTag.java @@ -0,0 +1,117 @@ +package it.acxent.banner.taglib; + +import it.acxent.banner.Banner; +import it.acxent.db.DBAdapter; +import it.acxent.taglib.AbstractDbTag; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; + +public class BannerTag extends AbstractDbTag { + private static final long serialVersionUID = -7476671878945063062L; + + private String alt; + + private long bannertype; + + private long id_banner; + + private boolean textbanner; + + private String imgclass; + + public int doAfterBody() throws JspException { + try { + Banner bean = new Banner(getApFull()); + if (getId_banner() == 0L) { + bean = bean.getRandomBanner(getBannertype()); + } else { + bean.findByPrimaryKey(getId_banner()); + } + if (bean == null || bean.getId_banner() == 0L) { + this.bodyContent.getEnclosingWriter().print("No banner found"); + } else if (bean.getFlgTipo() == Banner.TIPO_IMMAGINE) { + String theClass = getImgclass().isEmpty() ? "" : (" class=\"" + getImgclass() + "\""); + String beforeImage = "

0) + height = ""; + String afterImage = "\"" + width + height + " border=\"0\" title=\"" + bean.getTitolo() + "\" alt=\"" + bean.getTitolo() + "\"" + theClass + " >

"; + String absImg = bean.getPathImgBanner() + bean.getPathImgBanner(); + if (isImageExist(absImg)) { + bean.addImpression(getReq().getRemoteAddr(), getReq().getServletPath()); + String bodyString = beforeImage + beforeImage + absImg; + System.out.println(bodyString); + this.bodyContent.getEnclosingWriter().print(bodyString); + } else { + this.bodyContent.getEnclosingWriter().print(getAlt()); + } + } else { + this.bodyContent.getEnclosingWriter().print(bean.getDescrizioneBanner()); + } + return 0; + } catch (Exception ex) { + throw new JspTagException(ex.toString()); + } + } + + public int doStartTag() { + return 2; + } + + public String getAlt() { + return (this.alt == null) ? "" : this.alt; + } + + public long getBannertype() { + return this.bannertype; + } + + private boolean isFileExist(String fileName) { + return true; + } + + public boolean isImageExist(String imageName) { + try { + String fullImageName = getDocBase() + getDocBase(); + if (isFileExist(fullImageName)) + return true; + return false; + } catch (Exception e) { + return false; + } + } + + public void setAlt(String newAlt) { + this.alt = newAlt; + } + + public void setBannertype(long newTipobanner) { + this.bannertype = newTipobanner; + } + + public long getId_banner() { + return this.id_banner; + } + + public void setId_banner(long id_banner) { + this.id_banner = id_banner; + } + + public boolean isTextbanner() { + return this.textbanner; + } + + public void setTextbanner(boolean textBanner) { + this.textbanner = textBanner; + } + + public String getImgclass() { + return (this.imgclass == null) ? "" : this.imgclass.trim(); + } + + public void setImgclass(String imgclass) { + this.imgclass = imgclass; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/taglib/BannerTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/taglib/BannerTagExtraInfo.java new file mode 100644 index 00000000..ed9a626c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/banner/taglib/BannerTagExtraInfo.java @@ -0,0 +1,15 @@ +package it.acxent.banner.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class BannerTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? + tagdata.getAttributeString("rowbeanname") : + "banner"; + String rowBeanClass = "it.acxent.banner.Banner"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/BrtApi.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/BrtApi.java new file mode 100644 index 00000000..3d4cba8c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/BrtApi.java @@ -0,0 +1,256 @@ +package it.acxent.brt.api; + +import com.google.gson.Gson; +import it.acxent.brt.api.json.PUSPudoPoint; +import it.acxent.brt.api.json.PUSResponse; +import it.acxent.brt.api.json.PudoAddress; +import it.acxent.brt.api.json.PudoPoint; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.util.Vectumerator; +import java.util.Base64; +import java.util.List; +import java.util.concurrent.TimeUnit; +import okhttp3.ConnectionPool; +import okhttp3.HttpUrl; +import okhttp3.OkHttpClient; +import okhttp3.Request; +import okhttp3.Response; + +public class BrtApi { + public static final String API_BRT_ENDPOINT = "https://api.brt.it"; + + public static final String P_BRT_API_USER = "BRT_API_USER"; + + public static final String P_BRT_API_PWD = "BRT_API_PWD"; + + public static final String P_BRT_X_API_Auth = "BRT_X_API_Auth"; + + private static final String URI_CMD_PUDO_LIST_BY_ADDRESS = "/pudo/v1/open/pickup/get-pudo-by-address/"; + + private static final String URI_CMD_PUDO_DETAIL = "/pudo/v1/open/pickup/get-pudo-details/"; + + private static final String PARM_ADDRESS = "address"; + + private static final String PARM_CITY = "city"; + + private static final String PARM_COUNTRY_CODE = "countryCode"; + + private static final String PARM_ZIP_CODE = "zipCode"; + + private static final String PARM_PUDO_ID = "pudoId"; + + private static final String HEADER_X_API_AUTH = "X-API-Auth"; + + private static boolean debug = false; + + private ApplParmFull apFull = null; + + private String apiUser; + + private String apiPwd; + + public BrtApi(ApplParmFull apFull) { + this.apFull = apFull; + } + + public BrtApi(ApplParmFull apFull, String l_user, String l_pwd) { + this.apFull = apFull; + setApiUser(l_user); + setApiPwd(l_pwd); + } + + public BrtApi() {} + + public static void initApplicationParms(ApplParmFull ap) { + if (ap != null) { + DBAdapter.logDebug(true, "FACE initParms: start"); + String l_tipoParm = "BRT-API"; + Parm bean = new Parm(ap); + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("BRT_API_USER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("BRT_API_USER"); + bean.setDescrizione("BRT_API_USER"); + if (bean.getTesto().isEmpty()) + bean.setTesto("acolzi"); + bean.setNota("API USER ACCESSO A BRT - NON USATO PER ADESSO"); + bean.save(); + bean.findByCodice("BRT_API_PWD"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("BRT_API_PWD"); + bean.setDescrizione("BRT_API_PWD"); + if (bean.getTesto().isEmpty()) + bean.setTesto("pio"); + bean.setNota("API PWD ACCESSO A BRT - NON USATO PER ADESSO"); + bean.save(); + bean.findByCodice("BRT_X_API_Auth"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("BRT_X_API_Auth"); + bean.setDescrizione("BRT_X_API_Auth"); + if (bean.getTesto().isEmpty()) + bean.setTesto("34fcc468-ac08-4a70-8fc1-3da42938e0b3"); + bean.setNota("HEADER X-API-Auth PER API PUDO"); + bean.save(); + DBAdapter.logDebug(true, "FACE initParms: stop"); + StatusMsg.deleteMsgByTag(ap, "INIT"); + } + } + + public static void main(String[] args) { + String hostname = "localhost"; + String db = "tf19"; + ApplParmFull ap = new ApplParmFull(new ApplParm(17, "//" + hostname + "/" + db, db, "root", "root", 1, 10, 300)); + BrtApi brtapi = new BrtApi(ap); + Vectumerator vecPudo = new Vectumerator(); + PudoAddress pa = new PudoAddress("via tobbianese 23/g", "59100", "Prato"); + vecPudo = brtapi.findPudoPointByPudoAddress(pa); + while (vecPudo.hasMoreElements()) { + PudoPoint pp = (PudoPoint)vecPudo.nextElement(); + System.out.println(pp.getDescrizione()); + } + } + + protected String getBase64BasicCredential() { + String encoding = getApiBrtUser() + ":" + getApiBrtUser(); + return "Basic " + Base64.getEncoder().encodeToString(encoding.getBytes()); + } + + public ApplParmFull getApFull() { + return this.apFull; + } + + public void setApFull(ApplParmFull apFull) { + this.apFull = apFull; + } + + private String getApiEndpoint() { + return "https://api.brt.it"; + } + + private String getApiBrtPwd() { + if (this.apiPwd == null) + return this.apFull.getParm("BRT_API_PWD").getTesto(); + return this.apiPwd.trim(); + } + + private String getX_API_Auth() { + return this.apFull.getParm("BRT_X_API_Auth").getTesto(); + } + + public void setApiUser(String apiUser) { + this.apiUser = apiUser; + } + + public void setApiPwd(String apiPwd) { + this.apiPwd = apiPwd; + } + + public BrtApiResult _pudoByAddress(PudoAddress l_pudoAddress) { + boolean debug = true; + if (debug) + DBAdapter.printDebug(debug, "1 ------------ BrtApi NO COOKIE OKHTTP"); + BrtApiResult resER = new BrtApiResult(); + String l_indirizzoCompleto = l_pudoAddress.getAddress() + " " + l_pudoAddress.getAddress() + " " + l_pudoAddress.getCity(); + DBAdapter.printDebug(debug, "2 BrtApi --> pudoaddress: " + l_indirizzoCompleto); + try { + OkHttpClient client = new OkHttpClient.Builder().connectionPool(new ConnectionPool(0, 1L, TimeUnit.NANOSECONDS)) + .followSslRedirects(false).build(); + String baseUrl = getApiEndpoint() + "/pudo/v1/open/pickup/get-pudo-by-address/"; + DBAdapter.printDebug(debug, "3 URI: " + baseUrl); + DBAdapter.printDebug(debug, "3.1 getX_API_Auth: " + getX_API_Auth()); + HttpUrl url = HttpUrl.parse(baseUrl).newBuilder().addQueryParameter("address", l_pudoAddress.getAddress()) + .addQueryParameter("city", l_pudoAddress.getCity()) + .addQueryParameter("countryCode", l_pudoAddress.getCountryCode()) + .addQueryParameter("zipCode", l_pudoAddress.getZipCode()).build(); + Request request = new Request.Builder().url(url).get().addHeader("X-API-Auth", getX_API_Auth()).build(); + Response response = client.newCall(request).execute(); + String content = response.body().string(); + int statusCode = response.code(); + DBAdapter.printDebug(debug, "4Status Code: " + statusCode); + DBAdapter.printDebug(debug, "4content = " + content); + if (statusCode >= 400) { + resER.setOk(false); + resER.setMsg(content); + resER.setResult(content); + } else { + Gson gson = new Gson(); + PUSResponse pusResponse = (PUSResponse)gson.fromJson(content, PUSResponse.class); + resER.setMsg("Lista pudo trovata per: " + l_indirizzoCompleto); + resER.setOk(true); + resER.setResult(pusResponse); + resER.setPusResponse(pusResponse); + } + } catch (Exception e) { + DBAdapter.printDebug(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + public BrtApiResult _pudoDetail(String l_pudoId) { + boolean debug = false; + DBAdapter.printDebug(debug, "1 ------------ BrtApi NO COOKIE OKHTTP"); + BrtApiResult resER = new BrtApiResult(); + DBAdapter.printDebug(debug, "2 BrtApi --> pudoid: " + l_pudoId); + try { + OkHttpClient client = new OkHttpClient.Builder().connectionPool(new ConnectionPool(0, 1L, TimeUnit.NANOSECONDS)) + .followSslRedirects(false).build(); + String baseUrl = getApiEndpoint() + "/pudo/v1/open/pickup/get-pudo-details/"; + DBAdapter.printDebug(debug, " URI: " + baseUrl); + HttpUrl url = HttpUrl.parse(baseUrl).newBuilder().addQueryParameter("pudoId", l_pudoId).build(); + Request request = new Request.Builder().url(url).get().build(); + Response response = client.newCall(request).execute(); + String content = response.body().string(); + int statusCode = response.code(); + DBAdapter.printDebug(debug, "4Status Code: " + statusCode); + DBAdapter.printDebug(debug, "4content = " + content); + if (statusCode >= 400) { + resER.setOk(false); + resER.setMsg(content); + resER.setResult(content); + } else { + Gson gson = new Gson(); + PUSResponse pusResponse = (PUSResponse)gson.fromJson(content, PUSResponse.class); + resER.setMsg("Dettaglio pudo trovato per pudoid: " + l_pudoId); + resER.setOk(true); + resER.setResult(pusResponse); + resER.setPusResponse(pusResponse); + } + } catch (Exception e) { + DBAdapter.printDebug(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } + + private String getApiBrtUser() { + if (this.apiUser == null) + return this.apFull.getParm("BRT_API_USER").getTesto(); + return this.apiUser.trim(); + } + + public Vectumerator findPudoPointByPudoAddress(PudoAddress pa) { + Vectumerator vecPudo = new Vectumerator(); + BrtApiResult resBrt = _pudoByAddress(pa); + PUSResponse pusResponse = resBrt.getPusResponse(); + List listPudo = pusResponse.getPudo(); + for (PUSPudoPoint pudoPoint : listPudo) { + PUSPudoPoint ppp = new PUSPudoPoint(pudoPoint.getPudoId(), pudoPoint.getPointName(), pudoPoint.getStreet(), + pudoPoint.getStreetNumber(), pudoPoint.getZipCode(), pudoPoint.getTown()); + PudoPoint pp = new PudoPoint(ppp); + vecPudo.add(pp); + } + return vecPudo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/BrtApiResult.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/BrtApiResult.java new file mode 100644 index 00000000..c9d0f776 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/BrtApiResult.java @@ -0,0 +1,75 @@ +package it.acxent.brt.api; + +import com.google.gson.JsonObject; +import it.acxent.brt.api.json.PUSPudoPoint; +import it.acxent.brt.api.json.PUSResponse; +import org.json.JSONObject; + +public class BrtApiResult { + private String msg; + + public BrtApiResult(String msg, boolean status, Object result) { + this.msg = msg; + this.ok = status; + this.result = result; + } + + private boolean ok = true; + + private PUSResponse pusResponse; + + private PUSPudoPoint pusPudoPoint; + + private Object result; + + public BrtApiResult() {} + + public String getMsg() { + return (this.msg == null) ? "" : this.msg.trim(); + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public boolean isOk() { + return this.ok; + } + + public void setOk(boolean status) { + this.ok = status; + } + + public Object getResult() { + return this.result; + } + + public JsonObject getJsonObjectResult() { + return (JsonObject)getResult(); + } + + @Deprecated + public JSONObject getJSONObjectResult() { + return (JSONObject)getResult(); + } + + public void setResult(Object result) { + this.result = result; + } + + public PUSResponse getPusResponse() { + return this.pusResponse; + } + + public void setPusResponse(PUSResponse pusResponse) { + this.pusResponse = pusResponse; + } + + public PUSPudoPoint getPusPudoPoint() { + return this.pusPudoPoint; + } + + public void setPusPudoPoint(PUSPudoPoint pusPudoPoint) { + this.pusPudoPoint = pusPudoPoint; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PUSPointHoliday.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PUSPointHoliday.java new file mode 100644 index 00000000..b00b934b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PUSPointHoliday.java @@ -0,0 +1,23 @@ +package it.acxent.brt.api.json; + +public class PUSPointHoliday { + private String endDate; + + private String startDate; + + public String getEndDate() { + return this.endDate; + } + + public void setEndDate(String endDate) { + this.endDate = endDate; + } + + public String getStartDate() { + return this.startDate; + } + + public void setStartDate(String startDate) { + this.startDate = startDate; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PUSPointHour.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PUSPointHour.java new file mode 100644 index 00000000..b4a1a346 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PUSPointHour.java @@ -0,0 +1,43 @@ +package it.acxent.brt.api.json; + +public class PUSPointHour { + private String closeTime; + + private Integer dayOfWeek; + + private String dayTime; + + private String openTime; + + public String getCloseTime() { + return this.closeTime; + } + + public void setCloseTime(String closeTime) { + this.closeTime = closeTime; + } + + public Integer getDayOfWeek() { + return this.dayOfWeek; + } + + public void setDayOfWeek(Integer dayOfWeek) { + this.dayOfWeek = dayOfWeek; + } + + public String getDayTime() { + return this.dayTime; + } + + public void setDayTime(String dayTime) { + this.dayTime = dayTime; + } + + public String getOpenTime() { + return this.openTime; + } + + public void setOpenTime(String openTime) { + this.openTime = openTime; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PUSPudoPoint.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PUSPudoPoint.java new file mode 100644 index 00000000..bb2c97ed --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PUSPudoPoint.java @@ -0,0 +1,396 @@ +package it.acxent.brt.api.json; + +import java.util.List; + +public class PUSPudoPoint { + private Boolean available; + + private String building; + + private String carrierDepot; + + private String carrierInfo; + + private String carrierPudoId; + + private String complementaryInfo; + + private String complementaryServiceInfo; + + private String contactName; + + private String country; + + private String department; + + private Boolean disableAccess; + + private Double distanceFromPoint; + + private Boolean enabled; + + private String floor; + + private String fullAddress; + + private List holidays; + + private List hours; + + private String language; + + private String latitude; + + private String localizationHint; + + private String locationNumber; + + private String longitude; + + private Integer maxParcel; + + private Double maxWeight; + + private Boolean parking; + + private String pointName; + + private String pointName2; + + private String pudoId; + + private String service; + + private String state; + + private String street; + + private String street2; + + private String street3; + + private String streetNumber; + + private String subArea; + + private String town; + + private String type; + + private String zipCode; + + public PUSPudoPoint(String pudoId, String pointName, String street, String streetNumber, String town, String zipCode) { + this.pudoId = pudoId; + this.pointName = pointName; + this.street = street; + this.streetNumber = streetNumber; + this.town = town; + this.zipCode = zipCode; + } + + public PUSPudoPoint() {} + + public Boolean getAvailable() { + return this.available; + } + + public void setAvailable(Boolean available) { + this.available = available; + } + + public String getBuilding() { + return this.building; + } + + public void setBuilding(String building) { + this.building = building; + } + + public String getCarrierDepot() { + return this.carrierDepot; + } + + public void setCarrierDepot(String carrierDepot) { + this.carrierDepot = carrierDepot; + } + + public String getCarrierInfo() { + return this.carrierInfo; + } + + public void setCarrierInfo(String carrierInfo) { + this.carrierInfo = carrierInfo; + } + + public String getCarrierPudoId() { + return this.carrierPudoId; + } + + public void setCarrierPudoId(String carrierPudoId) { + this.carrierPudoId = carrierPudoId; + } + + public String getComplementaryInfo() { + return this.complementaryInfo; + } + + public void setComplementaryInfo(String complementaryInfo) { + this.complementaryInfo = complementaryInfo; + } + + public String getComplementaryServiceInfo() { + return this.complementaryServiceInfo; + } + + public void setComplementaryServiceInfo(String complementaryServiceInfo) { + this.complementaryServiceInfo = complementaryServiceInfo; + } + + public String getContactName() { + return this.contactName; + } + + public void setContactName(String contactName) { + this.contactName = contactName; + } + + public String getCountry() { + return this.country; + } + + public void setCountry(String country) { + this.country = country; + } + + public String getDepartment() { + return this.department; + } + + public void setDepartment(String department) { + this.department = department; + } + + public Boolean getDisableAccess() { + return this.disableAccess; + } + + public void setDisableAccess(Boolean disableAccess) { + this.disableAccess = disableAccess; + } + + public Double getDistanceFromPoint() { + return this.distanceFromPoint; + } + + public void setDistanceFromPoint(Double distanceFromPoint) { + this.distanceFromPoint = distanceFromPoint; + } + + public Boolean getEnabled() { + return this.enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public String getFloor() { + return this.floor; + } + + public void setFloor(String floor) { + this.floor = floor; + } + + public String getFullAddress() { + return this.fullAddress; + } + + public void setFullAddress(String fullAddress) { + this.fullAddress = fullAddress; + } + + public List getHolidays() { + return this.holidays; + } + + public void setHolidays(List holidays) { + this.holidays = holidays; + } + + public List getHours() { + return this.hours; + } + + public void setHours(List hours) { + this.hours = hours; + } + + public String getLanguage() { + return this.language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getLatitude() { + return this.latitude; + } + + public void setLatitude(String latitude) { + this.latitude = latitude; + } + + public String getLocalizationHint() { + return this.localizationHint; + } + + public void setLocalizationHint(String localizationHint) { + this.localizationHint = localizationHint; + } + + public String getLocationNumber() { + return this.locationNumber; + } + + public void setLocationNumber(String locationNumber) { + this.locationNumber = locationNumber; + } + + public String getLongitude() { + return this.longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + public Integer getMaxParcel() { + return this.maxParcel; + } + + public void setMaxParcel(Integer maxParcel) { + this.maxParcel = maxParcel; + } + + public Double getMaxWeight() { + return this.maxWeight; + } + + public void setMaxWeight(Double maxWeight) { + this.maxWeight = maxWeight; + } + + public Boolean getParking() { + return this.parking; + } + + public void setParking(Boolean parking) { + this.parking = parking; + } + + public String getPointName() { + return this.pointName; + } + + public void setPointName(String pointName) { + this.pointName = pointName; + } + + public String getPointName2() { + return this.pointName2; + } + + public void setPointName2(String pointName2) { + this.pointName2 = pointName2; + } + + public String getPudoId() { + return this.pudoId; + } + + public void setPudoId(String pudoId) { + this.pudoId = pudoId; + } + + public String getService() { + return this.service; + } + + public void setService(String service) { + this.service = service; + } + + public String getState() { + return this.state; + } + + public void setState(String state) { + this.state = state; + } + + public String getStreet() { + return this.street; + } + + public void setStreet(String street) { + this.street = street; + } + + public String getStreet2() { + return this.street2; + } + + public void setStreet2(String street2) { + this.street2 = street2; + } + + public String getStreet3() { + return this.street3; + } + + public void setStreet3(String street3) { + this.street3 = street3; + } + + public String getStreetNumber() { + return this.streetNumber; + } + + public void setStreetNumber(String streetNumber) { + this.streetNumber = streetNumber; + } + + public String getSubArea() { + return this.subArea; + } + + public void setSubArea(String subArea) { + this.subArea = subArea; + } + + public String getTown() { + return this.town; + } + + public void setTown(String town) { + this.town = town; + } + + public String getType() { + return this.type; + } + + public void setType(String type) { + this.type = type; + } + + public String getZipCode() { + return this.zipCode; + } + + public void setZipCode(String zipCode) { + this.zipCode = zipCode; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PUSResponse.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PUSResponse.java new file mode 100644 index 00000000..23dd05f1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PUSResponse.java @@ -0,0 +1,35 @@ +package it.acxent.brt.api.json; + +import java.util.List; + +public class PUSResponse { + private List pudo; + + private String requestId; + + private String timestamp; + + public List getPudo() { + return this.pudo; + } + + public void setPudo(List pudo) { + this.pudo = pudo; + } + + public String getRequestId() { + return this.requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public String getTimestamp() { + return this.timestamp; + } + + public void setTimestamp(String timestamp) { + this.timestamp = timestamp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PudoAddress.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PudoAddress.java new file mode 100644 index 00000000..b08cde98 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PudoAddress.java @@ -0,0 +1,53 @@ +package it.acxent.brt.api.json; + +public class PudoAddress { + private String pudoId; + + private String address; + + private String city; + + public PudoAddress(String address, String zipCode, String city) { + this.address = address; + this.zipCode = zipCode; + this.city = city; + } + + private String countryCode = "it"; + + private String zipCode; + + private String pointName; + + public PudoAddress() {} + + public String getAddress() { + return (this.address == null) ? "" : this.address.trim(); + } + + public void setAddress(String address) { + this.address = address; + } + + public String getCity() { + return (this.city == null) ? "" : this.city.trim(); + } + + public void setCity(String city) {} + + public String getCountryCode() { + return (this.countryCode == null) ? "" : this.countryCode.trim(); + } + + public void setCountryCode(String countryCode) { + this.countryCode = countryCode; + } + + public String getZipCode() { + return this.zipCode; + } + + public void setZipCode(String zipCode) { + this.zipCode = zipCode; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PudoPoint.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PudoPoint.java new file mode 100644 index 00000000..a8155f17 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/PudoPoint.java @@ -0,0 +1,176 @@ +package it.acxent.brt.api.json; + +import it.acxent.db.DBAdapterNoDb; +import java.util.List; + +public class PudoPoint extends DBAdapterNoDb { + private static final long serialVersionUID = 3483130980683823592L; + + private PUSPudoPoint pusPudoPoint; + + public PudoPoint(PUSPudoPoint pusPudoPoint) { + this.pusPudoPoint = pusPudoPoint; + } + + public PudoPoint() {} + + public String getDescrizione() { + return getPudoId() + " - " + getPudoId() + " " + getPointName() + " " + getStreet() + " " + getStreetNumber() + " " + getZipCode(); + } + + public PUSPudoPoint getPusPudoPoint() { + return this.pusPudoPoint; + } + + public Boolean getAvailable() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getAvailable() : null; + } + + public String getBuilding() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getBuilding() : null; + } + + public String getCarrierDepot() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getCarrierDepot() : null; + } + + public String getCarrierInfo() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getCarrierInfo() : null; + } + + public String getCarrierPudoId() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getCarrierPudoId() : null; + } + + public String getComplementaryInfo() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getComplementaryInfo() : null; + } + + public String getComplementaryServiceInfo() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getComplementaryServiceInfo() : null; + } + + public String getContactName() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getContactName() : null; + } + + public String getCountry() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getCountry() : null; + } + + public String getDepartment() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getDepartment() : null; + } + + public Boolean getDisableAccess() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getDisableAccess() : null; + } + + public Double getDistanceFromPoint() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getDistanceFromPoint() : null; + } + + public Boolean getEnabled() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getEnabled() : null; + } + + public String getFloor() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getFloor() : null; + } + + public String getFullAddress() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getFullAddress() : null; + } + + public List getHolidays() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getHolidays() : null; + } + + public List getHours() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getHours() : null; + } + + public String getLanguage() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getLanguage() : null; + } + + public String getLatitude() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getLatitude() : null; + } + + public String getLocalizationHint() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getLocalizationHint() : null; + } + + public String getLocationNumber() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getLocationNumber() : null; + } + + public String getLongitude() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getLongitude() : null; + } + + public Integer getMaxParcel() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getMaxParcel() : null; + } + + public Double getMaxWeight() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getMaxWeight() : null; + } + + public Boolean getParking() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getParking() : null; + } + + public String getPointName() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getPointName() : null; + } + + public String getPointName2() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getPointName2() : null; + } + + public String getPudoId() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getPudoId() : null; + } + + public String getService() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getService() : null; + } + + public String getState() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getState() : null; + } + + public String getStreet() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getStreet() : null; + } + + public String getStreet2() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getStreet2() : null; + } + + public String getStreet3() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getStreet3() : null; + } + + public String getStreetNumber() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getStreetNumber() : null; + } + + public String getSubArea() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getSubArea() : null; + } + + public String getTown() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getTown() : null; + } + + public String getType() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getType() : null; + } + + public String getZipCode() { + return (this.pusPudoPoint != null) ? this.pusPudoPoint.getZipCode() : null; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/package-info.java new file mode 100644 index 00000000..a19ffe5d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/json/package-info.java @@ -0,0 +1 @@ +package it.acxent.brt.api.json; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/package-info.java new file mode 100644 index 00000000..5010c06b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/brt/api/package-info.java @@ -0,0 +1 @@ +package it.acxent.brt.api; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/AcCartObject.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/AcCartObject.java new file mode 100644 index 00000000..dddd0a26 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/AcCartObject.java @@ -0,0 +1,99 @@ +package it.acxent.cart; + +public class AcCartObject { + private Class itemClass; + + private Object id; + + private double quantity; + + private boolean RM; + + private String codPromo; + + private String lang; + + public AcCartObject() {} + + public AcCartObject(Class theItemClass, Object theId, double theQuantity) { + setItemClass(theItemClass); + setId(theId); + setQuantity(theQuantity); + } + + public AcCartObject(Class theItemClass, long theId, double theQuantity, boolean rm) { + setItemClass(theItemClass); + setId(new Long(theId)); + setQuantity(theQuantity); + setRM(rm); + } + + public AcCartObject(Class theItemClass, long theId, double theQuantity) { + setItemClass(theItemClass); + setId(new Long(theId)); + setQuantity(theQuantity); + } + + public AcCartObject(Class theItemClass, Object theId, double theQuantity, boolean rm) { + setItemClass(theItemClass); + setId(theId); + setQuantity(theQuantity); + setRM(rm); + } + + public Object getId() { + return this.id; + } + + public Class getItemClass() { + return this.itemClass; + } + + public double getQuantity() { + return this.quantity; + } + + public void setId(Object newId) { + this.id = newId; + } + + public void setId(long newId) { + this.id = new Long(newId); + } + + public void setItemClass(Class newItemClass) { + this.itemClass = newItemClass; + } + + public void setQuantity(double newQuantity) { + this.quantity = newQuantity; + } + + public String getItemsKey() { + return String.valueOf(getId()) + " " + String.valueOf(getId()); + } + + public boolean isRM() { + return this.RM; + } + + public void setRM(boolean rM) { + this.RM = rM; + } + + public String getCodPromo() { + return (this.codPromo == null) ? "" : this.codPromo.trim(); + } + + public void setCodPromo(String codPromo) { + this.codPromo = codPromo; + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang.trim(); + } + + public void setLang(String lang) { + this.lang = lang; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/Cart.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/Cart.java new file mode 100644 index 00000000..c1d3a281 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/Cart.java @@ -0,0 +1,1051 @@ +package it.acxent.cart; + +import it.acxent.anag.Users; +import it.acxent.brt.api.json.PudoAddress; +import it.acxent.common.Parm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.DoubleOperator; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.text.NumberFormat; +import java.util.Calendar; +import java.util.Enumeration; +import java.util.Hashtable; + +public class Cart implements Serializable, Cloneable { + private static final long serialVersionUID = -9088974146772197119L; + + private static final String MSG_QTA_NON_DISP0 = "Quantita' richiesta non disponibile"; + + private Hashtable items = null; + + private long numberOfItems = 0L; + + private Date dataNoleggioStart; + + private Date dataNoleggioEnd; + + private long flgCartType; + + private String id_cart; + + private boolean usePriceWithVat = true; + + private long id_ivaDelivery; + + private double aliquotaIvaDelivery; + + private String descDiscountPerc; + + private long discountPerc; + + private String promotionCode; + + private boolean deliveryCostSetted = false; + + private ApplParmFull applParmFull; + + private double deliveryWarnCost; + + private double moreCost; + + private String note; + + private IvaGroup rri; + + private IvaGroup rriCompleto; + + private String giftAddress; + + private long flgGift; + + private long flgPayment; + + private String giftText; + + private long flgShipping; + + private String descShipping; + + private long flgStatus; + + private double deliveryCost; + + private String descMoreCost; + + private long id_users; + + private long flgPickup; + + private double discount; + + private String descDiscount; + + private String descPayment; + + private String codPromo; + + private double percDiscountPay; + + private double percCommissionPay; + + private String descDiscountPay; + + private String descCommissionPay; + + private boolean isDeliveryCostSetted = false; + + private boolean costoSpedizionePreventivo; + + private long flgDeliveryType; + + private String pudoDesc; + + private String pudoId; + + public static final long DELIVERY_TYPE_STD = 0L; + + public static final long DELIVERY_TYPE_NEGOZIO = 1L; + + public static final long DELIVERY_TYPE_PUDO = 2L; + + public static final String P_CC_COSTO_SPED_FULL = "CC_COSTO_SPED_FULL"; + + public static String P_CART_WITH_VAT = "CART_WITH_VAT"; + + public static String P_DELIVERY_WARN_COST = "DELIV_WARN_COST"; + + public static String P_ID_IVA_CEE = "ID_IVA_CEE"; + + public static String P_DELIVERY_IVA_ID = "DELIV_IVA_ID"; + + public static String P_CHECKOUTMSG = "CHECKOUT_MSG"; + + public static String P_DELIVERY_COST = "DELIV_COST"; + + public static String P_DELIVERY_COST_PUDO = "DELIV_COST_PUDO"; + + public static String P_USE_PRICE_WITH_VAT = "PRICE_W_VAT"; + + public static String P_DELIVERY_IVA_ALIQUOTA = "DELIV_IVA_ALIQUOTA"; + + public static String P_ID_IVA_EXTRACEE = "ID_IVA_EXTRACEE"; + + public static String P_MORE_COST = "MORE_COST"; + + public static String P_DELIVERY_FREE_ABOVE = "DELIVERY_FREE_ABOVE"; + + public static String P_PROCEDI_PAGAMENTO = "PROCEDI_PAGAMENTO"; + + public Cart() { + this.items = new Hashtable<>(); + this.id_users = 0L; + createCartId(); + } + + public Cart(ApplParmFull theApplParmFull) { + this.items = new Hashtable<>(); + this.id_users = 0L; + setApplParmFull(theApplParmFull); + createCartId(); + } + + @Deprecated + public ResParm add(AcCartObject l_aco) { + return add(l_aco, true); + } + + public void clear() { + this.items.clear(); + this.numberOfItems = 0L; + } + + private void createCartId() { + if (getId_cart().isEmpty()) { + Calendar cal = Calendar.getInstance(); + setId_cart(String.valueOf(cal.getTimeInMillis())); + } + } + + protected void finalize() throws Throwable { + this.items.clear(); + } + + public ApplParmFull getApplParmFull() { + return this.applParmFull; + } + + public double getDeliveryCost() { + return this.deliveryCost; + } + + public boolean areAllItemsAvailable() { + Enumeration enu = getItems(); + while (enu.hasMoreElements()) { + CartItem ci = enu.nextElement(); + if (!ci.isItemAvailable()) + return false; + } + return true; + } + + public Enumeration getItems() { + return new Vectumerator(this.items.elements()); + } + + public long getNumberOfItems() { + return this.numberOfItems; + } + + public double getQuantityOfItems() { + Enumeration enu = getItems(); + double quantityOfItems = 0.0D; + while (enu.hasMoreElements()) { + CartItem row = enu.nextElement(); + quantityOfItems += row.getQuantity(); + } + return quantityOfItems; + } + + public double xgetAvailItemQty(long theId, double l_dispo) { + Long itemPrimaryKey = new Long(theId); + if (this.items.containsKey(itemPrimaryKey)) { + CartItem cartItem = this.items.get(itemPrimaryKey); + DoubleOperator dispo = new DoubleOperator(l_dispo); + dispo.subtract(cartItem.getQuantity()); + return dispo.getResult(); + } + return l_dispo; + } + + public ResParm quantityDecrement(AcCartObject l_aco) { + ResParm rp = new ResParm(true); + if (this.items.containsKey(l_aco.getItemsKey())) { + CartItem cartItem = this.items.get(l_aco.getItemsKey()); + if (cartItem.getQuantity() - 1.0D == 0.0D) { + remove(l_aco); + } else { + cartItem.setQuantity(cartItem.getQuantity() - 1.0D); + } + } + setRri(null); + setRriCompleto(null); + return rp; + } + + public ResParm quantityIncrement(AcCartObject l_aco, boolean checkAvail) { + ResParm rp = new ResParm(true); + if (this.items.containsKey(l_aco.getItemsKey())) { + CartItem cartItem = this.items.get(l_aco.getItemsKey()); + if (checkAvail) { + double l_avail = cartItem.getAvailItemQty(); + if (cartItem.getQuantity() >= l_avail) { + rp.setStatus(false); + rp.setMsg(getApplParmFull().translate("Quantita' richiesta non disponibile", l_aco.getLang())); + } else { + cartItem.setQuantity(cartItem.getQuantity() + 1.0D); + } + } else { + cartItem.setQuantity(cartItem.getQuantity() + 1.0D); + } + } else { + CartItem newItem = new CartItem(l_aco, getApplParmFull(), 1.0D); + if (checkAvail) { + double l_avail = newItem.getAvailItemQty(); + if (newItem.getQuantity() > l_avail) { + rp.setStatus(false); + rp.setMsg(getApplParmFull().translate("Quantita' richiesta non disponibile", l_aco.getLang())); + } else { + this.items.put(l_aco.getItemsKey(), newItem); + this.numberOfItems++; + } + } else { + this.items.put(l_aco.getItemsKey(), newItem); + this.numberOfItems++; + } + } + setRri(null); + setRriCompleto(null); + return rp; + } + + public void remove(AcCartObject l_aco) { + if (this.items.containsKey(l_aco.getItemsKey())) { + this.items.remove(l_aco.getItemsKey()); + this.numberOfItems--; + setRri(null); + setRriCompleto(null); + } + } + + public void setApplParmFull(ApplParmFull newApplParmFull) { + this.applParmFull = newApplParmFull; + } + + public void setDeliveryCost(double newDeliveryCost) { + this.deliveryCost = newDeliveryCost; + } + + public double getTotPrice() { + DoubleOperator temp = new DoubleOperator(); + Enumeration enu = getItems(); + while (enu.hasMoreElements()) { + CartItem row = enu.nextElement(); + temp.setScale(4, 5); + temp.add(row.getTotPrice(getId_users())); + } + return temp.getResult(); + } + + public double getScontrinoTotPriceVAT() { + DoubleOperator temp = new DoubleOperator(); + Enumeration enu = getItems(); + while (enu.hasMoreElements()) { + CartItem row = enu.nextElement(); + temp.setScale(4, 5); + temp.add(row.getTotPriceWVat(getId_users())); + } + return temp.getResult(); + } + + public double getImportoIvaTotale() { + return getRriCompleto().getTotIva(); + } + + public double getImportoIva() { + return getRri().getTotIva(); + } + + public double getTotPriceNoSale() { + DoubleOperator temp = new DoubleOperator(); + Enumeration enu = getItems(); + while (enu.hasMoreElements()) { + CartItem row = enu.nextElement(); + if (!row.isSale()) { + temp.setScale(4, 5); + temp.add(row.getTotPrice(getId_users())); + } + } + return temp.getResult(); + } + + public double getScontrinoTotPriceNoSale() { + DoubleOperator temp = new DoubleOperator(); + Enumeration enu = getItems(); + while (enu.hasMoreElements()) { + CartItem row = enu.nextElement(); + if (!row.isSale()) { + temp.setScale(4, 5); + temp.add(row.getTotPriceWVat(getId_users())); + } + } + return temp.getResult(); + } + + public double getTotPriceWDiscount() { + if (getDiscountPercTot() == 0.0D) + return getTotPrice(); + DoubleOperator temp = new DoubleOperator(getTotPrice()); + temp.setScale(4, 5); + temp.subtract(getTotDiscount()); + return temp.getResult(); + } + + public double getScontrinoTotPriceWDiscount() { + if (getDiscountPercTot() == 0.0D) + return getScontrinoTotPriceVAT(); + DoubleOperator temp = new DoubleOperator(getScontrinoTotPriceVAT()); + temp.setScale(4, 5); + temp.subtract(getScontrinoTotDiscount()); + return temp.getResult(); + } + + public double getTotDiscount() { + if (getDiscountPercTot() == 0.0D) + return 0.0D; + DoubleOperator temp = new DoubleOperator(getTotPriceNoSale()); + temp.setScale(4, 5); + temp.multiply(getDiscountPercTot()); + temp.divide(100.0F); + return temp.getResult(); + } + + public double getScontrinoTotDiscount() { + if (getDiscountPercTot() == 0.0D) + return 0.0D; + DoubleOperator temp = new DoubleOperator(getScontrinoTotPriceNoSale()); + temp.setScale(4, 5); + temp.multiply(getDiscountPercTot()); + temp.divide(100.0F); + return temp.getResult(); + } + + public double getTotCart() { + DoubleOperator temp = new DoubleOperator(getTotPriceWDiscount()); + temp.setScale(4, 5); + temp.add(getDeliveryCost()); + temp.add(getDeliveryWarnCost()); + temp.add(getMoreCost()); + temp.subtract(getDiscount()); + return temp.getResult(); + } + + public double getTotCartVAT() { + DoubleOperator temp = new DoubleOperator(getTotCart()); + temp.setScale(4, 5); + temp.add(getImportoIvaTotale()); + return temp.getResult(); + } + + public double getTotPriceVAT() { + DoubleOperator temp = new DoubleOperator(getTotPrice()); + temp.setScale(4, 5); + temp.add(getImportoIva()); + return temp.getResult(); + } + + public String getId_cart() { + return (this.id_cart == null) ? "" : this.id_cart; + } + + public void setId_cart(String id_cart) { + this.id_cart = id_cart; + } + + public boolean isDeliveryCostSetted() { + return this.deliveryCostSetted; + } + + public void setDeliveryCostSetted(boolean deliveryCostSetted) { + this.deliveryCostSetted = deliveryCostSetted; + } + + public String getDescDiscountPerc() { + return (this.descDiscountPerc == null) ? "" : this.descDiscountPerc; + } + + public String getDescDiscountPercTot() { + StringBuilder sb = new StringBuilder(); + if (getDiscountPerc() > 0L) { + sb.append(getDescDiscountPerc()); + if (getPercDiscountPay() > 0.0D) + sb.append(" + "); + } + if (getPercDiscountPay() > 0.0D) + sb.append(getDescDiscountPay()); + return sb.toString().trim(); + } + + public double getCommissionPayValue() { + if (getPercCommissionPay() > 0.0D) { + DoubleOperator temp = new DoubleOperator(getTotPriceWDiscount()); + temp.setScale(4, 5); + temp.add(getDeliveryCost()); + temp.add(getDeliveryWarnCost()); + temp.subtract(getDiscount()); + temp.multiply(getPercCommissionPay()); + temp.divide(100.0F); + temp.setScale(2, 5); + return temp.getResult(); + } + return 0.0D; + } + + public void setDescDiscountPerc(String descDiscount) { + this.descDiscountPerc = descDiscount; + } + + public long getDiscountPerc() { + return this.discountPerc; + } + + public double getDiscountPercTot() { + DoubleOperator dop = new DoubleOperator((float)getDiscountPerc()); + dop.add(getPercDiscountPay()); + return dop.getResult(); + } + + public void setDiscountPerc(long discount) { + this.discountPerc = discount; + } + + public String getPromotionCode() { + return (this.promotionCode == null) ? "" : this.promotionCode; + } + + public void setPromotionCode(String promotionCode) { + this.promotionCode = promotionCode; + } + + public IvaGroup getRri() { + Enumeration vecRighe = getItems(); + this.rri = new IvaGroup(); + while (vecRighe.hasMoreElements()) { + CartItem row = vecRighe.nextElement(); + double imponibile = row.getTotPrice(getId_users()); + this.rri.addCartRowRM(imponibile, row.getIvaItemId(getId_users()), row.getIvaAliquota(getId_users()), row.isRM(), row.getCost()); + } + return this.rri; + } + + public boolean isUsePriceWithVat() { + return this.usePriceWithVat; + } + + public void setRriCompleto(IvaGroup rriCompleto) { + this.rriCompleto = rriCompleto; + } + + public void setRri(IvaGroup rri) { + this.rri = rri; + } + + public IvaGroup getRriCompleto() { + Enumeration vecRighe = getItems(); + this.rriCompleto = new IvaGroup(); + while (vecRighe.hasMoreElements()) { + CartItem row = vecRighe.nextElement(); + double imponibile = row.getTotPrice(getId_users()); + this.rriCompleto.addCartRowRM(imponibile, row.getIvaItemId(getId_users()), row.getIvaAliquota(getId_users()), row.isRM(), + row.getCost()); + } + this.rriCompleto.addCartRowRM(getDeliveryCost(), getId_ivaDelivery(), getAliquotaIvaDelivery(), false, 0.0D); + this.rriCompleto.addCartRowRM(getDeliveryWarnCost(), getId_ivaDelivery(), getAliquotaIvaDelivery(), false, 0.0D); + this.rriCompleto.addCartRowRM(getMoreCost(), getId_ivaDelivery(), getAliquotaIvaDelivery(), false, 0.0D); + return this.rriCompleto; + } + + public long getId_ivaDelivery() { + return (this.id_ivaDelivery == 0L) ? 1L : this.id_ivaDelivery; + } + + public void setId_ivaDelivery(long id_ivaDelivery) { + this.id_ivaDelivery = id_ivaDelivery; + } + + public double getAliquotaIvaDelivery() { + return this.aliquotaIvaDelivery; + } + + public void setAliquotaIvaDelivery(double aliquotaIvaDelivery) { + this.aliquotaIvaDelivery = aliquotaIvaDelivery; + } + + public double getMoreCost() { + return this.moreCost; + } + + public double getMoreCostWVat() { + return DBAdapter.conIva(this.moreCost, getAliquotaIvaDelivery()); + } + + public void setMoreCost(double moreCost) { + this.moreCost = moreCost; + } + + public long getFlgPayment() { + return this.flgPayment; + } + + public void setFlgPayment(long flgPayment) { + this.flgPayment = flgPayment; + } + + public String getDescMoreCost() { + return (this.descMoreCost == null) ? "" : this.descMoreCost.trim(); + } + + public void setDescMoreCost(String moreCostDescription) { + this.descMoreCost = moreCostDescription; + } + + public double getAvailItemQty(long theId, double l_dispo) { + Long itemPrimaryKey = new Long(theId); + if (this.items.containsKey(itemPrimaryKey)) { + CartItem cartItem = this.items.get(itemPrimaryKey); + DoubleOperator dispo = new DoubleOperator(l_dispo); + dispo.subtract(cartItem.getQuantity()); + return dispo.getResult(); + } + return l_dispo; + } + + public void setUsePriceWithVat(boolean usePriceWithVat) { + this.usePriceWithVat = usePriceWithVat; + } + + public String getGiftAddress() { + return (this.giftAddress == null) ? "" : this.giftAddress.trim(); + } + + public void setGiftAddress(String giftAddress) { + this.giftAddress = giftAddress; + } + + public long getFlgGift() { + return this.flgGift; + } + + public void setFlgGift(long flgGift) { + this.flgGift = flgGift; + } + + public String getGiftText() { + return (this.giftText == null) ? "" : this.giftText.trim(); + } + + public void setGiftText(String giftText) { + this.giftText = giftText; + } + + public static final void initCartParms(ApplParmFull ap) { + if (ap != null) { + Parm bean = new Parm(ap); + String l_tipoParm = "CART"; + bean.findByCodice(P_PROCEDI_PAGAMENTO); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(P_PROCEDI_PAGAMENTO); + bean.setDescrizione(P_PROCEDI_PAGAMENTO); + bean.setFlgTipo(5L); + bean.setNota("Quando registro l'ordine, imposta il procedi con il pagamento:0:no,1:si"); + bean.save(); + bean.findByCodice(P_USE_PRICE_WITH_VAT); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(P_USE_PRICE_WITH_VAT); + bean.setDescrizione(P_USE_PRICE_WITH_VAT); + bean.setFlgTipo(1L); + bean.setNota("Prezzi con iva:0:no,1:si"); + bean.save(); + bean.findByCodice(P_CHECKOUTMSG); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(P_CHECKOUTMSG); + bean.setDescrizione(P_CHECKOUTMSG); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("mailMessage/checkOut.html"); + bean.setNota("Path relativo a docbase"); + bean.save(); + bean.findByCodice(Parm.P_USERMSG); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(Parm.P_USERMSG); + bean.setDescrizione(Parm.P_USERMSG); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("mailMessage/userMsg.html"); + bean.setNota("Path relativo a docbase"); + bean.save(); + bean.findByCodice(Parm.P_LOSTPWDMSG); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(Parm.P_LOSTPWDMSG); + bean.setDescrizione(Parm.P_LOSTPWDMSG); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("/mailMessage/lostPwd.html"); + bean.setNota("Path relativo a docbase"); + bean.save(); + bean.findByCodice(Parm.P_MLISTMSG); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(Parm.P_MLISTMSG); + bean.setDescrizione(Parm.P_MLISTMSG); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("/relativo a docbasemailMessage/ml.txt"); + bean.setNota("Path relativo a docbase. Registrazione Mailing List"); + bean.save(); + bean.findByCodice(Parm.P_RESOMSG); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(Parm.P_RESOMSG); + bean.setDescrizione(Parm.P_RESOMSG); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("mailMessage/reso.html"); + bean.setNota("Path relativo a docbase. Reso merce"); + bean.save(); + bean.findByCodice(P_DELIVERY_COST); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(P_DELIVERY_COST); + bean.setDescrizione(P_DELIVERY_COST); + bean.setFlgTipo(1L); + bean.setNota("Costo spedizione standard."); + bean.save(); + bean.findByCodice(P_DELIVERY_COST_PUDO); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(P_DELIVERY_COST_PUDO); + bean.setDescrizione(P_DELIVERY_COST_PUDO); + bean.setFlgTipo(1L); + bean.setNota("Costo spedizione al punto di raccolta."); + bean.save(); + bean.findByCodice(P_CART_WITH_VAT); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(P_CART_WITH_VAT); + bean.setDescrizione(P_CART_WITH_VAT); + bean.setFlgTipo(5L); + bean.setNota("CARRELLO SENZA EVIDENZA DELL'IVA."); + bean.save(); + bean.findByCodice(P_DELIVERY_FREE_ABOVE); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(P_DELIVERY_FREE_ABOVE); + bean.setDescrizione(P_DELIVERY_FREE_ABOVE); + bean.setFlgTipo(1L); + if (bean.getId_parm() == 0L) + bean.setNumero(9000000.0D); + bean.setNota("TOT CARRELLO (COMPRESO IVA) OLTRE IL QUALE LA SPEDIZIONE DIVENTA GRATIS"); + bean.save(); + bean.findByCodice(P_DELIVERY_WARN_COST); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(P_DELIVERY_WARN_COST); + bean.setDescrizione(P_DELIVERY_WARN_COST); + bean.setFlgTipo(1L); + bean.setNota("Costo avviso spedizione standard."); + bean.save(); + bean.findByCodice(P_MORE_COST); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(P_MORE_COST); + bean.setDescrizione(P_MORE_COST); + bean.setFlgTipo(1L); + bean.setNota("Costo aggiuntivo tipo per contrassegno."); + bean.save(); + bean.findByCodice(P_DELIVERY_IVA_ALIQUOTA); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(P_DELIVERY_IVA_ALIQUOTA); + bean.setDescrizione(P_DELIVERY_IVA_ALIQUOTA); + bean.setFlgTipo(1L); + bean.setNota("Aliquota standard spese spedizione. DEVE COINCIDERE CON LA PERCENTUALE IVA DI DELIVERY_IVA_ID."); + bean.save(); + bean.findByCodice(P_DELIVERY_IVA_ID); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(P_DELIVERY_IVA_ID); + bean.setDescrizione(P_DELIVERY_IVA_ID); + bean.setFlgTipo(1L); + bean.setNota("ID iva aliquota spese di spedizione. VERIFICA DELIVERY_IVA_ALIQUOTA CHE LA PERCENTUALE COINCIDA."); + bean.save(); + bean.findByCodice(P_ID_IVA_CEE); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(P_ID_IVA_CEE); + bean.setDescrizione(P_ID_IVA_CEE); + bean.setFlgTipo(1L); + bean.setNota("ID iva aliquota articoli in caso di esenzione per paese CEE."); + bean.save(); + bean.findByCodice(P_ID_IVA_EXTRACEE); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice(P_ID_IVA_EXTRACEE); + bean.setDescrizione(P_ID_IVA_EXTRACEE); + bean.setFlgTipo(1L); + bean.setNota("ID iva aliquota articoli in caso di esenzione per paese EXTRA-CEE."); + bean.save(); + } + } + + public long getFlgShipping() { + return this.flgShipping; + } + + public void setFlgShipping(long flgShipping) { + this.flgShipping = flgShipping; + } + + public String getDescShipping() { + return (this.descShipping == null) ? "" : this.descShipping.trim(); + } + + public void setDescShipping(String descShipping) { + this.descShipping = descShipping; + } + + public long getFlgStatus() { + return this.flgStatus; + } + + public void setFlgStatus(long flgStatus) { + this.flgStatus = flgStatus; + } + + public double getDeliveryWarnCost() { + return this.deliveryWarnCost; + } + + public double getDeliveryWarnCostWVat() { + return DBAdapter.conIva(this.deliveryWarnCost, getAliquotaIvaDelivery()); + } + + public void setDeliveryWarnCost(double deliveryWarnCost) { + this.deliveryWarnCost = deliveryWarnCost; + } + + public String getNote() { + return (this.note == null) ? "" : this.note.trim(); + } + + public void setNote(String note) { + this.note = note; + } + + public long getId_users() { + return this.id_users; + } + + public void setId_users(long l_id_users) { + if (l_id_users != this.id_users) { + setRri(null); + setRriCompleto(null); + } + this.id_users = l_id_users; + } + + public boolean hasItemKey(String l_itemKey) { + if (l_itemKey == null || l_itemKey.isEmpty()) + return false; + if (this.items.containsKey(l_itemKey)) + return true; + return false; + } + + public long getFlgPickup() { + return this.flgPickup; + } + + public void setFlgPickup(long flgPickup) { + this.flgPickup = flgPickup; + } + + public ResParm add(AcCartObject l_aco, boolean checkAvail) { + ResParm rp = new ResParm(true); + if (this.items.containsKey(l_aco.getItemsKey())) { + CartItem cartItem = this.items.get(l_aco.getItemsKey()); + if (checkAvail) { + double l_avail = cartItem.getAvailItemQty(); + if (l_aco.getQuantity() > l_avail) { + rp.setStatus(false); + rp.setMsg(getApplParmFull().translate("Quantita' richiesta non disponibile", l_aco.getLang())); + cartItem.setQuantity(l_avail); + } else { + cartItem.setQuantity(l_aco.getQuantity()); + } + } else { + cartItem.setQuantity(l_aco.getQuantity()); + } + cartItem.setDbItem(null); + if (cartItem.getQuantity() == 0.0D) { + this.items.remove(l_aco.getItemsKey()); + } else { + this.items.put(l_aco.getItemsKey(), cartItem); + } + } else { + CartItem newItem = new CartItem(l_aco, getApplParmFull(), l_aco.getQuantity()); + if (checkAvail) { + double l_avail = newItem.getAvailItemQty(); + if (l_aco.getQuantity() > l_avail) { + rp.setStatus(false); + rp.setMsg(getApplParmFull().translate("Quantita' richiesta non disponibile", l_aco.getLang())); + } else { + newItem.setRM(l_aco.isRM()); + this.items.put(l_aco.getItemsKey(), newItem); + this.numberOfItems++; + } + } else { + newItem.setRM(l_aco.isRM()); + this.items.put(l_aco.getItemsKey(), newItem); + this.numberOfItems++; + } + } + setRri(null); + setRriCompleto(null); + return rp; + } + + public Date getDataNoleggioStart() { + return this.dataNoleggioStart; + } + + public void setDataNoleggioStart(Date dataHireStart) { + this.dataNoleggioStart = dataHireStart; + } + + public Date getDataNoleggioEnd() { + return this.dataNoleggioEnd; + } + + public void setDataNoleggioEnd(Date dataHireEnd) { + this.dataNoleggioEnd = dataHireEnd; + } + + public long getFlgCartType() { + return this.flgCartType; + } + + public void setFlgCartType(long flgCartType) { + this.flgCartType = flgCartType; + } + + public double getDiscount() { + return this.discount; + } + + public void setDiscount(double discount) { + this.discount = discount; + } + + public String getDescDiscount() { + return (this.descDiscount == null) ? "" : this.descDiscount; + } + + public void setDescDiscount(String descDiscount) { + this.descDiscount = descDiscount; + } + + public Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + public CartItem getItem(String itemKey) { + if (this.items.containsKey(itemKey)) + return this.items.get(itemKey); + return null; + } + + public double getDeliveryCostWVat() { + return DBAdapter.conIva(getDeliveryCost(), getAliquotaIvaDelivery()); + } + + public double getScontrinoTotCartVAT() { + DoubleOperator temp = new DoubleOperator(getScontrinoTotPriceWDiscount()); + temp.setScale(4, 5); + temp.add(getDeliveryCostWVat()); + temp.add(getDeliveryWarnCostWVat()); + temp.add(getMoreCostWVat()); + temp.subtract(getDiscount()); + return temp.getResult(); + } + + public NumberFormat getNf2() { + return getApplParmFull().getAp().getNf2(); + } + + public NumberFormat getNf() { + return getNf2(); + } + + public String getCodPromo() { + return (this.codPromo == null) ? "" : this.codPromo.trim(); + } + + public void setCodPromo(String codPromo) { + this.codPromo = codPromo; + } + + public double getPercDiscountPay() { + return this.percDiscountPay; + } + + public void setPercDiscountPay(double percDiscountPay) { + this.percDiscountPay = percDiscountPay; + } + + public double getPercCommissionPay() { + return this.percCommissionPay; + } + + public void setPercCommissionPay(double percCommissionPay) { + this.percCommissionPay = percCommissionPay; + } + + public String getDescDiscountPay() { + return (this.descDiscountPay == null) ? "" : this.descDiscountPay.trim(); + } + + public void setDescDiscountPay(String descDiscountPay) { + this.descDiscountPay = descDiscountPay; + } + + public String getDescCommissionPay() { + return (this.descCommissionPay == null) ? "" : this.descCommissionPay.trim(); + } + + public void setDescCommissionPay(String descCommissionPay) { + this.descCommissionPay = descCommissionPay; + } + + public void setCostoSpedizionePreventivo(boolean costoSpedizionePreventivo) { + this.costoSpedizionePreventivo = costoSpedizionePreventivo; + } + + public boolean isCostoSpedizionePreventivo() { + return this.costoSpedizionePreventivo; + } + + public String getDescPayment() { + return (this.descPayment == null) ? "" : this.descPayment.trim(); + } + + public void setDescPayment(String descPayment) { + this.descPayment = descPayment; + } + + public long getNumberTotOfItems() { + long numberTotOfItems = 0L; + if (this.items != null) + for (String key : this.items.keySet()) + numberTotOfItems += (long)this.items.get(key).getQuantity(); + return numberTotOfItems; + } + + public boolean hasItemConScontoTroppoAlto() { + Enumeration enu = getItems(); + while (enu.hasMoreElements()) { + CartItem ci = enu.nextElement(); + if (ci.isScontoTroppoAlto()) + return true; + } + return false; + } + + public long getFlgDeliveryType() { + return this.flgDeliveryType; + } + + public void setFlgDeliveryType(long flgDeliveryType) { + this.flgDeliveryType = flgDeliveryType; + } + + public String getPudoDesc() { + return (this.pudoDesc == null) ? "" : this.pudoDesc.trim(); + } + + public PudoAddress getPudoAddress() { + Users user = new Users(getApplParmFull()); + user.findByPrimaryKey(getId_users()); + return user.getClifor().getPudoAddress(); + } + + public void setPudoDesc(String pudoDesc) { + this.pudoDesc = pudoDesc; + } + + public String getPudoId() { + return this.pudoId; + } + + public void setPudoId(String pudoId) { + this.pudoId = pudoId; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/CartItem.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/CartItem.java new file mode 100644 index 00000000..cececb11 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/CartItem.java @@ -0,0 +1,288 @@ +package it.acxent.cart; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.util.DoubleOperator; +import java.io.Serializable; +import java.text.NumberFormat; +import java.util.Locale; + +public class CartItem implements CartItemIterface, Serializable { + public static final long TYPE_ARTICOLO = 0L; + + public static final long TYPE_ARTICOLO_VARIANTE = 1L; + + public static final long TYPE_ARTICOLO_TAGLIA = 2L; + + public static final long TYPE_ARTICOLO_VARIANTE_TAGLIA = 3L; + + public static final long TYPE_ARTICOLO_TAGLIA_KIT = 4L; + + public static final long TYPE_ARTICOLO_VARIANTE_TAGLIA_KIT = 5L; + + private AcCartObject cartObject; + + private NumberFormat nf2; + + private boolean RM; + + private String cartItemTag; + + private Object itemId; + + private double quantity; + + private Class itemClass; + + private ApplParmFull applParmFull; + + private DBAdapter dbItem; + + public CartItem() { + this.quantity = 1.0D; + } + + public CartItem(AcCartObject l_aco, ApplParmFull theApplParmFull, double newQuantity) { + setCartObject(l_aco); + setItemId(l_aco.getId()); + setQuantity(newQuantity); + setItemClass(l_aco.getItemClass()); + setApplParmFull(theApplParmFull); + try { + CartItemIterface bean = getItemClass().newInstance(); + this.cartItemTag = bean.getCartItemTag(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public ApplParmFull getApplParmFull() { + return this.applParmFull; + } + + public DBAdapter getDbItem() { + if (this.dbItem == null && this.itemId != null) + try { + if (getItemId() instanceof Long) { + DBAdapter bean = (DBAdapter)getItemClass().newInstance(); + bean.setApFull(getApplParmFull()); + bean.findByPrimaryKey(getItemId()); + if (bean.getDBState() == 1) + this.dbItem = bean; + } else { + CartItemId cii = (CartItemId)getItemId(); + DBAdapter bean = (DBAdapter)getItemClass().newInstance(); + bean.setApFull(getApplParmFull()); + ((CartItemIterface)bean).findByCartitemId(cii); + if (bean.getDBState() == 1) + this.dbItem = bean; + } + } catch (Exception e) { + e.printStackTrace(); + } + try { + return (this.dbItem == null) ? (DBAdapter)getItemClass().newInstance() : this.dbItem; + } catch (Exception e) { + e.printStackTrace(); + return this.dbItem; + } + } + + public Class getItemClass() { + return this.itemClass; + } + + public Object getItemId() { + return this.itemId; + } + + public double getQuantity() { + return this.quantity; + } + + public void setApplParmFull(ApplParmFull newApplParmFull) { + this.applParmFull = newApplParmFull; + } + + public void setDbItem(DBAdapter newDbItem) { + this.dbItem = newDbItem; + } + + public void setItemClass(Class newItemClass) { + this.itemClass = newItemClass; + } + + public void setItemId(Object newItemId) { + this.itemId = newItemId; + setDbItem(null); + } + + public void setQuantity(double newQuantity) { + this.quantity = newQuantity; + } + + public double getPriceWVat() { + return ((CartItemIterface)getDbItem()).getPriceWVat(); + } + + public double getPrice() { + return ((CartItemIterface)getDbItem()).getPrice(); + } + + public boolean isItemAvailable() { + if (getQuantity() <= getAvailItemQty()) + return true; + return false; + } + + public double getTotPrice() { + DoubleOperator temp = new DoubleOperator(getQuantity()); + temp.setScale(4, 5); + temp.multiply(getPrice()); + return temp.getResult(); + } + + public double getAvailItemQty() { + double l_dispo = 0.0D; + if (this.itemId != null) { + this.dbItem = null; + l_dispo = ((CartItemIterface)getDbItem()).getAvail(); + return l_dispo; + } + return l_dispo; + } + + public double getAvail() { + return ((CartItemIterface)getDbItem()).getAvail(); + } + + public String getCartItemDescriptionUrl() { + return ((CartItemIterface)getDbItem()).getCartItemDescriptionUrl(); + } + + public String getCartItemDescription3(String lang) { + return ((CartItemIterface)getDbItem()).getCartItemDescription3(lang); + } + + public String getCartItemDescription2(String lang) { + return ((CartItemIterface)getDbItem()).getCartItemDescription2(lang); + } + + public String getCartItemImage() { + return ((CartItemIterface)getDbItem()).getCartItemImage(); + } + + public double getCost() { + return ((CartItemIterface)getDbItem()).getCost(); + } + + public double getDiscount() { + return ((CartItemIterface)getDbItem()).getDiscount(); + } + + public boolean isSale() { + return ((CartItemIterface)getDbItem()).isSale(); + } + + public double getIvaAliquota(long l_id_users) { + return ((CartItemIterface)getDbItem()).getIvaAliquota(l_id_users); + } + + public Object getId_iva() { + return null; + } + + public boolean isRM() { + return this.RM; + } + + public long getIvaItemId(long l_id_users) { + return ((CartItemIterface)getDbItem()).getIvaItemId(l_id_users); + } + + public long getCartItemUdm() { + return ((CartItemIterface)getDbItem()).getCartItemUdm(); + } + + public double getPrice(long l_id_users) { + return ((CartItemIterface)getDbItem()).getPrice(l_id_users); + } + + public String getCartItemDescription(String lang) { + return ((CartItemIterface)getDbItem()).getCartItemDescription(lang); + } + + public double getTotPrice(long l_id_users) { + DoubleOperator temp = new DoubleOperator(getQuantity()); + temp.setScale(4, 5); + temp.multiply(getPrice(l_id_users)); + return temp.getResult(); + } + + public String getCartItemTag() { + return (this.cartItemTag == null) ? "" : this.cartItemTag.trim(); + } + + public void setRM(boolean rM) { + this.RM = rM; + } + + public NumberFormat getNf() { + if (this.nf2 == null) { + this.nf2 = NumberFormat.getInstance(Locale.ITALY); + this.nf2.setMaximumFractionDigits(2); + this.nf2.setMinimumFractionDigits(2); + } + return this.nf2; + } + + public double getTotPriceWVat() { + DoubleOperator temp = new DoubleOperator(getQuantity()); + temp.setScale(4, 5); + temp.multiply(getPriceWVat()); + return temp.getResult(); + } + + public double getTotPriceWVat(long l_id_users) { + DoubleOperator temp = new DoubleOperator(getQuantity()); + temp.setScale(4, 5); + temp.multiply(getPriceWVat(l_id_users)); + return temp.getResult(); + } + + public double getPriceWVat(long l_id_users) { + return ((CartItemIterface)getDbItem()).getPriceWVat(l_id_users); + } + + public AcCartObject getCartObject() { + return this.cartObject; + } + + public void setCartObject(AcCartObject cartObject) { + this.cartObject = cartObject; + } + + public String getCartItemDescriptionCC(String lang) { + return ((CartItemIterface)getDbItem()).getCartItemDescriptionCC(lang); + } + + public void findByCartitemId(CartItemId cii) { + ((CartItemIterface)getDbItem()).findByCartitemId(cii); + } + + public boolean isCostoSpedizionePreventivo(String l_id_nazione) { + return ((CartItemIterface)getDbItem()).isCostoSpedizionePreventivo(l_id_nazione); + } + + public double getDeliveryCost(String l_id_nazione) { + return ((CartItemIterface)getDbItem()).getDeliveryCost(l_id_nazione); + } + + public long getPercentileSpedizione() { + return ((CartItemIterface)getDbItem()).getPercentileSpedizione(); + } + + public boolean isScontoTroppoAlto() { + return ((CartItemIterface)getDbItem()).isScontoTroppoAlto(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/CartItemId.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/CartItemId.java new file mode 100644 index 00000000..f895a57c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/CartItemId.java @@ -0,0 +1,110 @@ +package it.acxent.cart; + +import it.acxent.util.StringTokenizer; + +public class CartItemId { + private long id_articolo = 0L; + + private long id_articoloVariante = 0L; + + private long id_articoloTaglia = 0L; + + private long id_articoloTagliaKit = 0L; + + private long id_articoloKit = 0L; + + private long id_articoloVarianteKit = 0L; + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + } + + public long getId_articoloTaglia() { + return this.id_articoloTaglia; + } + + public void setId_articoloTaglia(long id_articoloTaglia) { + this.id_articoloTaglia = id_articoloTaglia; + } + + public long getId_articoloKit() { + return this.id_articoloKit; + } + + public void setId_articoloKit(long id_articolo2) { + this.id_articoloKit = id_articolo2; + } + + public long getId_articoloVarianteKit() { + return this.id_articoloVarianteKit; + } + + public void setId_articoloVarianteKit(long id_articoloVariante2) { + this.id_articoloVarianteKit = id_articoloVariante2; + } + + public long getId_articoloTagliaKit() { + return this.id_articoloTagliaKit; + } + + public void setId_articoloTagliaKit(long id_articoloTaglia2) { + this.id_articoloTagliaKit = id_articoloTaglia2; + } + + public String toString() { + StringBuilder sb = new StringBuilder(); + String COMMA = ","; + if (getId_articoloTaglia() > 0L && getId_articoloTagliaKit() > 0L) { + sb.append("TK"); + sb.append(getId_articoloTaglia()); + sb.append(","); + sb.append(getId_articoloTagliaKit()); + } else if (getId_articoloVariante() > 0L) { + sb.append("V"); + sb.append(getId_articoloVariante()); + } else if (getId_articoloTaglia() > 0L) { + sb.append("T"); + sb.append(getId_articoloTaglia()); + } else { + sb.append(getId_articolo()); + } + return sb.toString(); + } + + public void caricaCartItemIdFromReqId(String l_id) { + initFields(); + if (!l_id.isEmpty()) + if (l_id.startsWith("TK")) { + StringTokenizer st = new StringTokenizer(l_id.substring(2), ","); + setId_articoloTaglia(Long.parseLong(st.getToken(0))); + setId_articoloTagliaKit(Long.parseLong(st.getToken(1))); + } else if (l_id.startsWith("V")) { + setId_articoloVariante(Long.parseLong(l_id.substring(1))); + } else if (l_id.startsWith("T")) { + setId_articoloTaglia(Long.parseLong(l_id.substring(1))); + } else { + setId_articolo(Long.parseLong(l_id)); + } + } + + private void initFields() { + setId_articolo(0L); + setId_articoloKit(0L); + setId_articoloTaglia(0L); + setId_articoloTagliaKit(0L); + setId_articoloVariante(0L); + setId_articoloVarianteKit(0L); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/CartItemIterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/CartItemIterface.java new file mode 100644 index 00000000..424745d3 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/CartItemIterface.java @@ -0,0 +1,53 @@ +package it.acxent.cart; + +public interface CartItemIterface { + Object getItemId(); + + double getPrice(); + + double getPriceWVat(); + + boolean isSale(); + + boolean isRM(); + + double getDiscount(); + + double getCost(); + + String getCartItemDescriptionUrl(); + + String getCartItemDescription2(String paramString); + + String getCartItemDescription3(String paramString); + + String getCartItemDescriptionCC(String paramString); + + long getCartItemUdm(); + + double getAvail(); + + double getIvaAliquota(long paramLong); + + long getIvaItemId(long paramLong); + + String getCartItemImage(); + + String getCartItemDescription(String paramString); + + String getCartItemTag(); + + double getPrice(long paramLong); + + double getPriceWVat(long paramLong); + + void findByCartitemId(CartItemId paramCartItemId); + + boolean isCostoSpedizionePreventivo(String paramString); + + double getDeliveryCost(String paramString); + + boolean isScontoTroppoAlto(); + + long getPercentileSpedizione(); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/CartStatus.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/CartStatus.java new file mode 100644 index 00000000..52743e45 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/CartStatus.java @@ -0,0 +1,29 @@ +package it.acxent.cart; + +public class CartStatus { + private long status = 0L; + + public static final long RES_ADD_ITEM_OK = 21L; + + public static final long RES_ADD_ITEM_KO = 22L; + + public static long ST_CHECK_OUT_ERROR = 9L; + + public static long ST_CHECK_OUT_OK = 1L; + + public static long ST_CHECK_OUT_OK_NO_MAIL = 2L; + + public static long ST_LOSTPWD_SEND_ERROR = 12L; + + public static long ST_OK = 0L; + + public static long ST_LOSTPWD_SEND_OK = 10L; + + public long getStatus() { + return this.status; + } + + public void setStatus(long status) { + this.status = status; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/IvaGroup.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/IvaGroup.java new file mode 100644 index 00000000..321a6e62 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/IvaGroup.java @@ -0,0 +1,105 @@ +package it.acxent.cart; + +import it.acxent.util.DoubleOperator; +import java.util.Enumeration; +import java.util.Hashtable; + +public class IvaGroup { + private Hashtable ri; + + private DoubleOperator totImponibileDO; + + private double importoRM; + + public void addCartRow(double imponibile, long l_iva, double l_aliquota, boolean isRM) { + Object theKey = new Long(l_iva); + if (!isRM) { + IvaGroupItem rii; + if (getRi().containsKey(theKey)) { + rii = (IvaGroupItem)getRi().get(theKey); + } else { + rii = new IvaGroupItem(l_iva, l_aliquota); + } + rii.addImporto(imponibile); + getTotImponibileDO().add(imponibile); + getRi().put(theKey, rii); + } else { + synchronized (this) { + DoubleOperator dop = new DoubleOperator(this.importoRM); + dop.add(imponibile); + this.importoRM = dop.getResult(); + } + } + } + + public Enumeration elements() { + return getRi().elements(); + } + + private Hashtable getRi() { + if (this.ri == null) + this.ri = new Hashtable(); + return this.ri; + } + + public double getImportoRM() { + return this.importoRM; + } + + public void setImportoRM(double importoRM) { + this.importoRM = importoRM; + } + + public void addCartRowRM(double imponibile, long l_iva, double l_aliquota, boolean isRM, double costo) { + Object theKey = new Long(l_iva); + if (!isRM) { + IvaGroupItem rii; + if (getRi().containsKey(theKey)) { + rii = (IvaGroupItem)getRi().get(theKey); + } else { + rii = new IvaGroupItem(l_iva, l_aliquota); + } + rii.addImporto(imponibile); + getTotImponibileDO().add(imponibile); + getRi().put(theKey, rii); + } else { + synchronized (this) { + IvaGroupItem rii; + DoubleOperator dop = new DoubleOperator(this.importoRM); + dop.add(imponibile); + this.importoRM = dop.getResult(); + double l_imponibile = 0.0D; + if (getRi().containsKey(theKey)) { + rii = (IvaGroupItem)getRi().get(theKey); + } else { + rii = new IvaGroupItem(l_iva, l_aliquota); + } + rii.addImporto(l_imponibile); + getTotImponibileDO().add(l_imponibile); + getRi().put(theKey, rii); + } + } + } + + private DoubleOperator getTotImponibileDO() { + if (this.totImponibileDO == null) + this.totImponibileDO = new DoubleOperator(); + return this.totImponibileDO; + } + + public double getTotImponibile() { + return getTotImponibileDO().getResult(); + } + + public double getTotIva() { + Enumeration enu = getRi().elements(); + DoubleOperator dIva = new DoubleOperator(); + dIva.setScale(4, 5); + while (enu.hasMoreElements()) { + IvaGroupItem row = enu.nextElement(); + dIva.add(row.getImportoIvaCalc()); + } + dIva.setScale(2, 5); + return dIva.getResult(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/IvaGroupItem.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/IvaGroupItem.java new file mode 100644 index 00000000..e2b7d5f2 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/IvaGroupItem.java @@ -0,0 +1,56 @@ +package it.acxent.cart; + +import it.acxent.util.DoubleOperator; + +public class IvaGroupItem { + private long iva; + + private double aliquota; + + private double imponibile; + + public IvaGroupItem(long l_iva, double l_aliquota) { + setIva(l_iva); + setAliquota(l_aliquota); + } + + public void addImporto(double l_imponibile) { + DoubleOperator dImponibile = new DoubleOperator(getImponibile()); + dImponibile.add(l_imponibile); + dImponibile.setScale(2, 5); + setImponibile(dImponibile.getResult()); + } + + public double getImponibile() { + return this.imponibile; + } + + public void setImponibile(double d) { + this.imponibile = d; + } + + public long getIva() { + return this.iva; + } + + public double getImportoIvaCalc() { + DoubleOperator temp = new DoubleOperator(getImponibile()); + temp.setScale(4, 5); + temp.multiply(getAliquota()); + temp.divide(100.0F); + temp.setScale(2, 5); + return temp.getResult(); + } + + public void setIva(long iva) { + this.iva = iva; + } + + public double getAliquota() { + return this.aliquota; + } + + public void setAliquota(double aliquota) { + this.aliquota = aliquota; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/servlet/AcCartSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/servlet/AcCartSvlt.java new file mode 100644 index 00000000..e1868255 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/servlet/AcCartSvlt.java @@ -0,0 +1,892 @@ +package it.acxent.cart.servlet; + +import it.acxent.cart.AcCartObject; +import it.acxent.cart.Cart; +import it.acxent.cart.CartStatus; +import it.acxent.common.Users; +import it.acxent.db.ResParm; +import it.acxent.servlet.LogonSvlt; +import it.acxent.servlet.SavedHttpRequest; +import it.acxent.util.AbMessages; +import java.util.StringTokenizer; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +public abstract class AcCartSvlt extends LogonSvlt { + protected static String ACT_ADD_ONE = "one"; + + protected static String ACT_CHECK_OUT = "checkOut"; + + protected static String ACT_LOGIN = "login"; + + public static String CAL_CR = "cr"; + + public static String CAL_MD = "md"; + + public static String CAL_CAT = "cat"; + + protected static String JSP_CART = "cart.jsp"; + + protected static String ATTR_THE_PAGE = "thePage"; + + protected static String JSP_CHECKOUT = "checkOut.jsp"; + + protected static String JSP_CHECKOUT_NO_REG = "checkOutNoReg.jsp"; + + protected static String JSP_HOME = "index.jsp"; + + public static String JSP_LOSTPASSWORD = "lostPwd.jsp"; + + protected static String JSP_ORDER = "order.jsp"; + + protected static String JSP_ORDER_NO_REG = "orderNoReg.jsp"; + + protected static String ACT_LOSTPWD = "lostPwd"; + + public static String ATTR_CART = "cart"; + + public static String ATTR_CART_STATUS = "cartStatus"; + + public static String CMD_ADD_ITEMS = "addItems"; + + protected static String DEFAULT_CATALOG_SVLT = "/Catalogo.abl"; + + protected static String CMD_CHECK_CART = "checkCart"; + + protected static String CMD_CHECKOUT = "checkOut"; + + protected static String CMD_LOGOUT = "logout"; + + protected static String CMD_DELETE_CART = "deleteCart"; + + public static String CMD_DELETE_ITEM = "deleteItem"; + + protected static String CMD_MODIFY_ITEM = "modifyItem"; + + protected static String CMD_MODIFY_ITEMS = "modifyItems"; + + protected static String CMD_UPDATE_CART = "updateCart"; + + public static String PROP_ORDER = "bean"; + + public static String CMD_LOSTPWD = "lostPwd"; + + public static String ATTR_LOSTPWDEMAIL = "lostPwdEmail"; + + public static String CMD_ADD_ITEM = "addItem"; + + protected static String CMD_LOGON = "logon"; + + protected static String ACT_CHECK_OUT_NO_LOGIN = "checkOutNL"; + + protected static String CMD_CHECKOUT_NO_REG = "checkOutNoReg"; + + protected void addItems(HttpServletRequest req, HttpServletResponse res) {} + + protected void callJsp(HttpServletRequest req, HttpServletResponse res) { + if (!getCal(req).isEmpty()) { + setJspPageRelative(getCal(req), req); + } else { + setJspPageRelative("cart.jsp", req); + } + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void checkCart(HttpServletRequest req, HttpServletResponse res) { + try { + Cart cart = getCart(req); + if (cart.getNumberOfItems() == 0L) { + String msg = "CheckCart: Il carrello è vuoto!"; + handleDebug(msg); + sendMessage(req, msg); + callJsp(req, res); + } else { + Users utente = getLoginUser(req); + if (utente != null && utente.getId_userProfile() == utente.getIdUserProfileNoReg()) { + req.getSession().removeAttribute("utenteLogon"); + req.getSession().removeAttribute("loginUser_id"); + } + afterCheckCart(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected void checkOut(HttpServletRequest req, HttpServletResponse res) { + CartStatus cartStatus = new CartStatus(); + try { + Cart cart = getCart(req); + if (getAct(req).equals(ATTR_CART)) { + if (cart.getNumberOfItems() == 0L) { + String msg = "CheckOut: Si è tentato di utilizzare un carrello vuoto!!!!"; + handleDebug(msg); + forceMessage(req, msg); + cartStatus.setStatus(CartStatus.ST_CHECK_OUT_ERROR); + req.setAttribute(ATTR_CART_STATUS, cartStatus); + setCart(req, cart); + afterCheckCart(req, res); + } else { + cartStatus.setStatus(CartStatus.ST_OK); + fillObject(req, cart); + req.setAttribute(ATTR_CART, cart); + req.setAttribute(ATTR_CART_STATUS, cartStatus); + afterCheckOut(req, res); + } + } else if (getAct(req).equals(ACT_LOGIN)) { + if (!getLogin(req).equals("")) + if (checkLoginName(req, res) >= 5L) { + if (!isFirstAccess(req)) { + cartStatus.setStatus(CartStatus.ST_OK); + } else { + SavedHttpRequest shr = (SavedHttpRequest)req.getSession().getAttribute("savedHttpRequest"); + if (shr == null) { + shr = new SavedHttpRequest(); + shr.setCompleteRequestedURI(req.getRequestURI()); + shr.setServletPath(req.getServletPath()); + shr.setAllParametersNAttributes(req); + req.getSession().setAttribute("savedHttpRequest", shr); + } + forceJspPageRelative(getCheckCCPage(), req); + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } + } else { + sendMessage(req, AbMessages.getMessage(getLang(req), "LOGIN_FAIL")); + } + req.setAttribute(ATTR_CART_STATUS, cartStatus); + getCart(req); + afterCheckOut(req, res); + } else if (getAct(req).equals(ACT_LOSTPWD)) { + ResParm rp = sendLostPasswordMessage(req, res); + if (!rp.getStatus()) + sendMessage(req, rp.getMsg()); + afterCheckOut(req, res); + } else if (getAct(req).equals(ACT_CHECK_OUT)) { + if (getLoginUser(req) != null) { + if (cart.getNumberOfItems() == 0L) { + handleDebug(AbMessages.getMessage(getLang(req), "CART_SUBMIT_EMPTY")); + sendMessage(req, AbMessages.getMessage(getLang(req), "CART_SUBMIT_EMPTY")); + cartStatus.setStatus(CartStatus.ST_CHECK_OUT_ERROR); + req.setAttribute(ATTR_CART_STATUS, cartStatus); + setCart(req, cart); + afterCheckOut(req, res); + } else if (checkAvailability(req) && !cart.areAllItemsAvailable()) { + String msg = "CheckOut: Attenzione! Alcuni articoli non sono più disponibili!!!"; + handleDebug(msg); + forceMessage(req, msg); + cartStatus.setStatus(CartStatus.ST_CHECK_OUT_ERROR); + req.setAttribute(ATTR_CART_STATUS, cartStatus); + setCart(req, cart); + afterCheckCart(req, res); + } else { + fillObject(req, cart); + setCart(req, cart); + ResParm rp = recordOrder(req, res); + if (rp.getStatus()) { + if (sendCheckOutMessage(req, res).getStatus()) { + cartStatus.setStatus(CartStatus.ST_CHECK_OUT_OK); + } else { + cartStatus.setStatus(CartStatus.ST_CHECK_OUT_OK_NO_MAIL); + sendMessage(req, rp.getMsg()); + } + req.setAttribute(ATTR_CART_STATUS, cartStatus); + removeCart(req); + afterOrderRecorded(req, res); + } else { + sendMessage(req, rp.getMsg()); + setJspPageRelative(getJspCheckOutPage(req), req); + callJsp(req, res); + } + } + } else { + sendMessage(req, AbMessages.getMessage(getLang(req), "CART_NEED_LOGIN")); + afterCheckOut(req, res); + } + } else if (getAct(req).equals(ACT_CHECK_OUT_NO_LOGIN)) { + if (cart.getNumberOfItems() == 0L) { + handleDebug(AbMessages.getMessage(getLang(req), "CART_SUBMIT_EMPTY")); + sendMessage(req, AbMessages.getMessage(getLang(req), "CART_SUBMIT_EMPTY")); + cartStatus.setStatus(CartStatus.ST_CHECK_OUT_ERROR); + req.setAttribute(ATTR_CART_STATUS, cartStatus); + setCart(req, cart); + afterCheckOut(req, res); + } else { + fillObject(req, cart); + setCart(req, cart); + ResParm rp = recordOrder(req, res); + if (rp.getStatus()) { + if (sendCheckOutMessage(req, res).getStatus()) { + cartStatus.setStatus(CartStatus.ST_CHECK_OUT_OK); + } else { + cartStatus.setStatus(CartStatus.ST_CHECK_OUT_OK_NO_MAIL); + sendMessage(req, rp.getMsg()); + } + req.setAttribute(ATTR_CART_STATUS, cartStatus); + removeCart(req); + afterOrderRecorded(req, res); + } else { + sendMessage(req, rp.getMsg()); + afterCheckOut(req, res); + } + } + } + } catch (Exception e) { + handleDebug(e); + sendMessage(req, e.getMessage()); + callJsp(req, res); + } + } + + protected void logOut(HttpServletRequest req, HttpServletResponse res) { + try { + req.getSession().removeAttribute("utenteLogon"); + req.getSession().removeAttribute("loginUser_id"); + setJspPageRelative(JSP_HOME, req); + _updateCart(req); + callJsp(req, res); + } catch (Exception e) { + handleDebug(e); + sendMessage(req, e.getMessage()); + callJsp(req, res); + } + } + + protected void lostPasword(HttpServletRequest req, HttpServletResponse res) { + try { + CartStatus cs = new CartStatus(); + ResParm rp = sendLostPasswordMessage(req, res); + if (!rp.getStatus()) { + forceMessage(req, rp.getMsg()); + cs.setStatus(CartStatus.ST_LOSTPWD_SEND_ERROR); + req.setAttribute(ATTR_CART_STATUS, cs); + } else { + forceMessage(req, rp.getMsg()); + cs.setStatus(CartStatus.ST_LOSTPWD_SEND_OK); + req.setAttribute(ATTR_CART_STATUS, cs); + } + req.setAttribute(ATTR_THE_PAGE, getRequestParameter(req, ATTR_THE_PAGE)); + setJspPageRelative(getJspLostPasswordPage(req), req); + callJsp(req, res); + } catch (Exception e) { + handleDebug(e); + sendMessage(req, e.getMessage()); + callJsp(req, res); + } + } + + protected void deleteCart(HttpServletRequest req, HttpServletResponse res) { + try { + removeCart(req); + afterDeleteCart(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void deleteItem(HttpServletRequest req, HttpServletResponse res) { + try { + AcCartObject aco = getCartObject(req); + Cart cart = getCart(req); + cart.remove(aco); + setCart(req, cart); + if (cart.getNumberOfItems() == 0L) { + String msg = "Il carrello è vuoto!"; + handleDebug(msg); + sendMessage(req, msg); + } + afterDeleteItem(req, res); + callJsp(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected String getAfterAddItemServlet(HttpServletRequest req) { + return DEFAULT_CATALOG_SVLT; + } + + protected Cart getCart(HttpServletRequest req) { + HttpSession session = req.getSession(true); + Cart cart = null; + if (session.getAttribute(ATTR_CART) != null) { + cart = (Cart)session.getAttribute(ATTR_CART); + cart.setApplParmFull(getApFull(req)); + updateDeliveryCost(cart, req); + } else { + cart = new Cart(getApFull(req)); + updateDeliveryCost(cart, req); + } + if (cart != null) + setCart(req, cart); + return cart; + } + + protected String getJspCartPage(HttpServletRequest req) { + return JSP_CART; + } + + protected String getJspCheckOutPage(HttpServletRequest req) { + return JSP_CHECKOUT; + } + + protected String getJspCheckOutNoRegPage(HttpServletRequest req) { + return JSP_CHECKOUT_NO_REG; + } + + protected String getJspHomePage(HttpServletRequest req) { + return JSP_HOME; + } + + protected String getJspLostPasswordPage(HttpServletRequest req) { + return JSP_LOSTPASSWORD; + } + + protected String getJspOrderPage(HttpServletRequest req) { + return JSP_ORDER; + } + + protected String getJspOrderPageNoReg(HttpServletRequest req) { + return JSP_ORDER_NO_REG; + } + + public abstract AcCartObject getCartObject(HttpServletRequest paramHttpServletRequest) throws Exception; + + protected String getCheckOutMailMessage() { + return getParm(Cart.P_CHECKOUTMSG).getTesto(); + } + + protected String getCheckOutMailMessage(String lang) { + String temp = getParm(Cart.P_CHECKOUTMSG).getTesto(); + if (lang != null && !lang.isEmpty()) { + int dot = temp.lastIndexOf("."); + if (dot > 0) + temp = temp.substring(0, dot) + "_" + temp.substring(0, dot) + lang.toLowerCase(); + } + return temp; + } + + protected String getLostPasswordMailMessage() { + return getParm(Cart.P_CHECKOUTMSG).getTesto(); + } + + protected boolean isUsePriceWithVat(HttpServletRequest req) { + return !(getParm(Cart.P_USE_PRICE_WITH_VAT).getNumeroInt() == 0); + } + + protected double getDeliveryCost(HttpServletRequest req, Cart cart) { + return getParm(Cart.P_DELIVERY_COST).getNumeroDouble(); + } + + protected boolean isCostoSpedizioneFull() { + return getParm("CC_COSTO_SPED_FULL").isTrue(); + } + + protected long getDeliveryIvaId(HttpServletRequest req) { + return getParm(Cart.P_DELIVERY_IVA_ID).getNumeroLong(); + } + + protected double getDeliveryIvaAliquota(HttpServletRequest req) { + return getParm(Cart.P_DELIVERY_IVA_ALIQUOTA).getNumeroDouble(); + } + + protected void modifyItem(HttpServletRequest req, HttpServletResponse res) { + try { + AcCartObject aco = getCartObject(req); + Cart cart = getCart(req); + if (aco.getId().equals("")); + ResParm rp = cart.add(aco, checkAvailability(req)); + if (!rp.getStatus()) + sendMessage(req, rp.getMsg()); + setCart(req, cart); + afterModifyItems(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void modifyItems(HttpServletRequest req, HttpServletResponse res) { + try { + AcCartObject aco = null; + String l_id = ""; + double l_quantita = 1.0D; + Cart cart = getCart(req); + String l_id_itemsVector = getRequestParameter(req, "id_itemsVector"); + l_id_itemsVector = l_id_itemsVector.replace('\'', ' '); + StringTokenizer st = new StringTokenizer(l_id_itemsVector, ","); + while (st.hasMoreTokens()) { + l_id = st.nextToken().trim(); + req.setAttribute("id", l_id); + aco = getCartObject(req); + if (req.getParameter("qt_" + l_id) != null && + !req.getParameter("qt_" + l_id).equals("")) + l_quantita = getRequestDoubleParameter(req, "qt_" + l_id); + aco.setQuantity(l_quantita); + ResParm rp = cart.add(aco, checkAvailability(req)); + if (!rp.getStatus()) + sendMessage(req, rp.getMsg()); + } + setCart(req, cart); + afterModifyItems(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + checkCart(req, res); + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + String cmd = getCmd(req); + forceJspPage("", req); + if (cmd.equals(CMD_ADD_ITEM)) { + addItem(req, res); + } else if (cmd.equals(CMD_ADD_ITEMS)) { + addItems(req, res); + } else if (cmd.equals(CMD_MODIFY_ITEM)) { + modifyItem(req, res); + } else if (cmd.equals(CMD_MODIFY_ITEMS)) { + modifyItems(req, res); + } else if (cmd.equals(CMD_DELETE_ITEM)) { + deleteItem(req, res); + } else if (cmd.equals(CMD_DELETE_CART)) { + deleteCart(req, res); + } else if (cmd.equals(CMD_CHECK_CART)) { + checkCart(req, res); + } else if (cmd.startsWith(CMD_CHECKOUT_NO_REG)) { + checkOutNoReg(req, res); + } else if (cmd.startsWith(CMD_CHECKOUT)) { + checkOut(req, res); + } else if (cmd.equals(CMD_LOGOUT)) { + logOut(req, res); + } else if (cmd.equals(CMD_LOGON)) { + logOn(req, res); + } else if (cmd.equals(CMD_LOSTPWD)) { + lostPasword(req, res); + } else if (cmd.equals(CMD_UPDATE_CART)) { + _updateCart(req); + } else { + ResParm rp = callCmdMethod(req, res); + if (!rp.getStatus()) { + if (!rp.getMsg().isEmpty()) + sendMessage(req, rp.getMsg()); + otherCommands(req, res); + } + } + } + + protected abstract ResParm recordOrder(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse); + + protected void removeCart(HttpServletRequest req) { + req.getSession(true).removeAttribute(ATTR_CART); + } + + protected abstract ResParm sendCheckOutMessage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse); + + protected abstract ResParm sendLostPasswordMessage(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse); + + protected void setCart(HttpServletRequest req, Cart cart) { + cart.setApplParmFull(getApFull(req)); + cart.setDeliveryCostSetted(false); + req.getSession(true).setAttribute(ATTR_CART, cart); + } + + protected void afterAddItem(HttpServletRequest req, HttpServletResponse res) { + try { + if (getCal(req).equals(CAL_CR)) { + req.setAttribute("cmd", "search"); + req.setAttribute("act", CAL_CR); + RequestDispatcher rd = getServletContext().getRequestDispatcher(getAfterAddItemServlet(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } else { + req.setAttribute("cmd", "md"); + req.setAttribute("act", CMD_ADD_ITEM); + RequestDispatcher rd = getServletContext().getRequestDispatcher(getAfterAddItemServlet(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected void afterCheckCart(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspCartPage(req), req); + try { + callJsp(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void afterCheckOut(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspCheckOutPage(req), req); + callJsp(req, res); + } + + protected void afterDeleteCart(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspHomePage(req), req); + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void afterDeleteItem(HttpServletRequest req, HttpServletResponse res) { + try { + checkCart(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void afterModifyItems(HttpServletRequest req, HttpServletResponse res) { + try { + checkCart(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void afterOrderRecorded(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspOrderPage(req), req); + callJsp(req, res); + } + + protected void afterOrderRecordedNoReg(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspOrderPageNoReg(req), req); + callJsp(req, res); + } + + protected boolean useControlCodeAccess() { + return false; + } + + protected boolean usePriceWithVat() { + return true; + } + + protected boolean useDeliveryCostOnUser() { + return true; + } + + protected boolean checkControlCode(HttpServletRequest req) { + try { + Users ute = (Users)req.getSession().getAttribute("utenteCC"); + if (ute == null) + return false; + ute.findByPrimaryKey(new Long(ute.getId_users())); + String controlCode = ""; + if (req.getParameter("controlCode") != null && + !req.getParameter("controlCode").equals("")) + controlCode = req.getParameter("controlCode"); + if (!ute.getControlCode().equals(controlCode)) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "CONTROL_CODE_FAIL")); + handleDebug(AbMessages.getMessage(getLocale(req), "CONTROL_CODE_FAIL"), 2); + setJspPageRelative(getCheckCCPage(), req); + return false; + } + sendMessage(req, AbMessages.getMessage(getLocale(req), "CONTROL_CODE_OK")); + handleDebug(AbMessages.getMessage(getLocale(req), "CONTROL_CODE_OK")); + ute.setControlCode(""); + ute.save(); + req.getSession().removeAttribute("utenteCC"); + req.getSession().setAttribute("utenteLogon", ute); + req.getSession().setAttribute("loginUser_id", new Long(ute.getId_users())); + return true; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + + protected String getCheckCCPage() { + if (!getWebappResource("controlCodePage").equals("")) + return getWebappResource("controlCodePage"); + return "controlCode.jsp"; + } + + protected boolean isFirstAccess(HttpServletRequest req) { + if (useControlCodeAccess()) + try { + Users ute = (Users)req.getSession().getAttribute("utenteLogon"); + ute.findByPrimaryKey(new Long(ute.getId_users())); + if (!ute.getControlCode().equals("")) { + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + req.getSession().setAttribute("utenteCC", ute); + return true; + } + return false; + } catch (Exception e) { + handleDebug(e); + return false; + } + return false; + } + + protected double getMoreCost(HttpServletRequest req) { + return getParm(Cart.P_MORE_COST).getNumeroDouble(); + } + + protected void addItem(HttpServletRequest req, HttpServletResponse res) { + try { + AcCartObject aco = getCartObject(req); + Cart cart = getCart(req); + CartStatus cartStatus = new CartStatus(); + String act = getAct(req); + if (act.equals(ACT_ADD_ONE)) { + ResParm rp = cart.quantityIncrement(aco, checkAvailability(req)); + if (!rp.getStatus()) { + sendMessage(req, rp.getMsg()); + cartStatus.setStatus(22L); + } else { + cartStatus.setStatus(21L); + } + } else { + ResParm rp = cart.add(aco, checkAvailability(req)); + if (!rp.getStatus()) { + sendMessage(req, rp.getMsg()); + cartStatus.setStatus(22L); + } else { + cartStatus.setStatus(21L); + } + } + req.setAttribute(ATTR_CART_STATUS, cartStatus); + updateDeliveryCost(cart, req); + setCart(req, cart); + afterAddItem(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected double getDeliveryWarnCost(HttpServletRequest req) { + return getParm(Cart.P_DELIVERY_WARN_COST).getNumeroDouble(); + } + + protected void logOn(HttpServletRequest req, HttpServletResponse res) { + try { + String jspPage = getCal(req); + if (jspPage.isEmpty()) + jspPage = getJspHomePage(req); + if (!getLogin(req).isEmpty()) + if (checkLoginName(req, res) >= 5L) { + _updateCart(req); + if (isFirstAccess(req)) { + SavedHttpRequest shr = (SavedHttpRequest)req.getSession().getAttribute("savedHttpRequest"); + if (shr == null) { + shr = new SavedHttpRequest(); + shr.setCompleteRequestedURI(req.getRequestURI()); + shr.setServletPath(req.getServletPath()); + shr.setAllParametersNAttributes(req); + req.getSession().setAttribute("savedHttpRequest", shr); + } + forceJspPageRelative(getCheckCCPage(), req); + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } else { + setJspPageRelative(jspPage, req); + callJsp(req, res); + } + } else { + _updateCart(req); + sendMessage(req, AbMessages.getMessage(getLang(req), "LOGIN_FAIL")); + setJspPageRelative(jspPage, req); + callJsp(req, res); + } + } catch (Exception e) { + handleDebug(e); + sendMessage(req, e.getMessage()); + setJspPageRelative(getCal(req), req); + callJsp(req, res); + } + } + + protected boolean checkAvailability(HttpServletRequest req) { + return true; + } + + public void _updateCart(HttpServletRequest req, HttpServletResponse res) { + HttpSession session = req.getSession(true); + session.setAttribute(ATTR_CART, getCart(req)); + setJspPage(getLoginPage(req, res), req); + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + try { + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + e.printStackTrace(); + } + } + + protected void checkOutNoReg(HttpServletRequest req, HttpServletResponse res) { + CartStatus cartStatus = new CartStatus(); + try { + Cart cart = getCart(req); + if (getAct(req).equals(ATTR_CART)) { + if (cart.getNumberOfItems() == 0L) { + String msg = "CheckOut: Si è tentato di utilizzare un carrello vuoto!!!!"; + handleDebug(msg); + forceMessage(req, msg); + cartStatus.setStatus(CartStatus.ST_CHECK_OUT_ERROR); + req.setAttribute(ATTR_CART_STATUS, cartStatus); + setCart(req, cart); + forceJspPageRelative(getJspCheckOutPage(req), req); + afterCheckCart(req, res); + } else { + cartStatus.setStatus(CartStatus.ST_OK); + fillObject(req, cart); + req.setAttribute(ATTR_CART, cart); + req.setAttribute(ATTR_CART_STATUS, cartStatus); + afterCheckOutNoReg(req, res); + } + } else if (getAct(req).equals(ACT_CHECK_OUT)) { + if (cart.getNumberOfItems() == 0L) { + handleDebug(AbMessages.getMessage(getLang(req), "CART_SUBMIT_EMPTY")); + sendMessage(req, AbMessages.getMessage(getLang(req), "CART_SUBMIT_EMPTY")); + cartStatus.setStatus(CartStatus.ST_CHECK_OUT_ERROR); + req.setAttribute(ATTR_CART_STATUS, cartStatus); + setCart(req, cart); + afterCheckOut(req, res); + } else { + fillObject(req, cart); + setCart(req, cart); + ResParm rp = recordOrderNoReg(req, res); + if (rp.getStatus()) { + if (sendCheckOutMessage(req, res).getStatus()) { + cartStatus.setStatus(CartStatus.ST_CHECK_OUT_OK); + } else { + cartStatus.setStatus(CartStatus.ST_CHECK_OUT_OK_NO_MAIL); + sendMessage(req, rp.getMsg()); + } + req.setAttribute(ATTR_CART_STATUS, cartStatus); + removeCart(req); + afterOrderRecorded(req, res); + } else { + sendMessage(req, rp.getMsg()); + forceJspPageRelative(getJspCheckOutNoRegPage(req), req); + afterCheckOutNoReg(req, res); + } + } + } + } catch (Exception e) { + handleDebug(e); + sendMessage(req, e.getMessage()); + callJsp(req, res); + } + } + + protected void afterCheckOutNoReg(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative(getJspCheckOutNoRegPage(req), req); + callJsp(req, res); + } + + protected abstract ResParm recordOrderNoReg(HttpServletRequest paramHttpServletRequest, HttpServletResponse paramHttpServletResponse); + + public void updateDeliveryCost(Cart cart, HttpServletRequest req) { + Users users = getLoginUser(req); + if (users == null || users.getId_users() == 0L) { + cart.setId_users(0L); + resetDeliveryIva(); + cart.setDeliveryCost(getDeliveryCost(req, cart)); + cart.setAliquotaIvaDelivery(getDeliveryIvaAliquota(req)); + cart.setId_ivaDelivery(getDeliveryIvaId(req)); + } else { + cart.setId_users(users.getId_users()); + resetDeliveryIva(); + if (useDeliveryCostOnUser()) { + if (getLoginUserId(req) != null && getLoginUserId(req) != 0L) { + cart.setDeliveryCost(getDeliveryCost(req, cart)); + cart.setId_ivaDelivery(getDeliveryIvaId(req)); + cart.setAliquotaIvaDelivery(getDeliveryIvaAliquota(req)); + cart.setDeliveryCostSetted(true); + cart.setUsePriceWithVat(isUsePriceWithVat(req)); + } + System.out.println("updateDeliveryCost2: " + cart.getDeliveryCost()); + } else { + cart.setDeliveryCost(getDeliveryCost(req, cart)); + cart.setId_ivaDelivery(getDeliveryIvaId(req)); + cart.setAliquotaIvaDelivery(getDeliveryIvaAliquota(req)); + cart.setDeliveryCostSetted(true); + cart.setUsePriceWithVat(isUsePriceWithVat(req)); + } + } + } + + protected Cart getCartOldConDeliveryCostDentro(HttpServletRequest req) { + HttpSession session = req.getSession(true); + Cart cart = null; + if (session.getAttribute(ATTR_CART) != null) { + cart = (Cart)session.getAttribute(ATTR_CART); + cart.setApplParmFull(getApFull(req)); + if (useDeliveryCostOnUser()) { + if (getLoginUserId(req) != null && getLoginUserId(req) != 0L) { + cart.setDeliveryCost(getDeliveryCost(req, cart)); + cart.setDeliveryCostSetted(true); + cart.setId_ivaDelivery(getDeliveryIvaId(req)); + cart.setAliquotaIvaDelivery(getDeliveryIvaAliquota(req)); + } + } else { + cart.setDeliveryCost(getDeliveryCost(req, cart)); + cart.setId_ivaDelivery(getDeliveryIvaId(req)); + cart.setAliquotaIvaDelivery(getDeliveryIvaAliquota(req)); + cart.setDeliveryCostSetted(true); + cart.setUsePriceWithVat(isUsePriceWithVat(req)); + } + } else { + cart = new Cart(getApFull(req)); + if (!cart.isDeliveryCostSetted() && getDeliveryCost(req, cart) > 0.0D) { + cart.setDeliveryCost(getDeliveryCost(req, cart)); + cart.setId_ivaDelivery(getDeliveryIvaId(req)); + cart.setAliquotaIvaDelivery(getDeliveryIvaAliquota(req)); + cart.setDeliveryCostSetted(true); + } + } + if (cart != null) { + Users users = getLoginUser(req); + if (users == null || users.getId_users() == 0L) { + cart.setId_users(0L); + cart.setDeliveryCost(0.0D); + cart.setMoreCost(0.0D); + cart.setDeliveryWarnCost(0.0D); + cart.setId_ivaDelivery(0L); + } else { + cart.setId_users(users.getId_users()); + } + setCart(req, cart); + } + return cart; + } + + public void _updateCart(HttpServletRequest req) { + HttpSession session = req.getSession(true); + session.setAttribute(ATTR_CART, getCart(req)); + } + + public void _updateCartAfterLogin(HttpServletRequest req, HttpServletResponse res) { + HttpSession session = req.getSession(true); + session.setAttribute(ATTR_CART, getCart(req)); + setJspPage(getLoginPage(req, res), req); + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + try { + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + e.printStackTrace(); + } + } + + protected void resetDeliveryIva() {} +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/servlet/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/servlet/package-info.java new file mode 100644 index 00000000..78231515 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cart/servlet/package-info.java @@ -0,0 +1 @@ +package it.acxent.cart.servlet; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/caship/BarcodeCash.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/caship/BarcodeCash.java new file mode 100644 index 00000000..f30c162f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/caship/BarcodeCash.java @@ -0,0 +1,159 @@ +package it.acxent.caship; + +public class BarcodeCash { + private long posizione; + + private long larghezza; + + private long altezza; + + private long posizioneTesto; + + private String fontTesto; + + private String tipoBarcode; + + private String code; + + private long allineamentoQRCode; + + private long dimensioneQRCode; + + private long livelloCorrezioneQRCode; + + public static String BARCODE_CODE39 = "CODE39"; + + public static String BARCODE_CODE128 = "CODE128"; + + public static String BARCODE_QRCODE1 = "QRCODE1"; + + public static String BARCODE_QRCODE2 = "QRCODE2"; + + public static long POSIZIONE_TESTO_DISABLED = 0L; + + public static long POSIZIONE_TESTO_SOPRA = 1L; + + public static long POSIZIONE_TESTO_SOTTO = 2L; + + public static long POSIZIONE_TESTO_SOPRA_SOTTO = 3L; + + public static String FONT_A = "A"; + + public static String FONT_B = "B"; + + public static String FONT_C = "C"; + + public static long QRCODE_ALLINEAMENTO_SINISTRA = 0L; + + public static long QRCODE_ALLINEAMENTO_CENTRO = 1L; + + public static long QRCODE_ALLINEAMENTO_DESTRA = 2L; + + public static long QRCODE_LIVELLO_CORREZIONE_BASSO = 0L; + + public static long QRCODE_LIVELLO_CORREZIONE_MEDIO_BASSO = 1L; + + public static long QRCODE_LIVELLO_CORREZIONE_MEDIO_ALTO = 2L; + + public static long QRCODE_LIVELLO_CORREZIONE_ALTO = 3L; + + public long getPosizione() { + return this.posizione; + } + + public void setPosizione(long posizione) { + if (posizione >= 0L && posizione <= 511L) { + this.posizione = posizione; + } else { + this.posizione = 10L; + } + } + + public long getLarghezza() { + return this.larghezza; + } + + public void setLarghezza(long larghezza) { + if (larghezza >= 1L && larghezza <= 8L) { + this.larghezza = larghezza; + } else { + this.larghezza = 1L; + } + } + + public long getAltezza() { + return this.altezza; + } + + public void setAltezza(long altezza) { + if (altezza >= 1L && altezza <= 255L) { + this.altezza = altezza; + } else { + this.altezza = 66L; + } + } + + public long getPosizioneTesto() { + return this.posizioneTesto; + } + + public void setPosizioneTesto(long posizioneTesto) { + this.posizioneTesto = posizioneTesto; + } + + public String getFontTesto() { + return this.fontTesto; + } + + public void setFontTesto(String fontTesto) { + this.fontTesto = fontTesto; + } + + public String getTipoBarcode() { + return this.tipoBarcode; + } + + public void setTipoBarcode(String tipoBarcode) { + this.tipoBarcode = tipoBarcode; + } + + public String getCode() { + return this.code.equals(null) ? "" : this.code; + } + + public void setCode(String code) { + if (getTipoBarcode() == BARCODE_CODE128) { + this.code = "{B" + code; + } else { + this.code = code; + } + } + + public long getAllineamentoQRCode() { + return this.allineamentoQRCode; + } + + public void setAllineamentoQRCode(long allineamentoQRCode) { + this.allineamentoQRCode = allineamentoQRCode; + } + + public long getDimensioneQRCode() { + return this.dimensioneQRCode; + } + + public void setDimensioneQRCode(long dimensioneQRCode) { + if (dimensioneQRCode >= 1L && dimensioneQRCode <= 16L) { + this.dimensioneQRCode = dimensioneQRCode; + } else { + this.dimensioneQRCode = 66L; + } + } + + public long getLivelloCorrezioneQRCode() { + return this.livelloCorrezioneQRCode; + } + + public void setLivelloCorrezioneQRCode(long livelloCorrezioneQRCode) { + this.livelloCorrezioneQRCode = livelloCorrezioneQRCode; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/caship/EpsonCash.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/caship/EpsonCash.java new file mode 100644 index 00000000..f1c2b44f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/caship/EpsonCash.java @@ -0,0 +1,68 @@ +package it.acxent.caship; + +import it.acxent.db.ResParm; +import java.util.Date; + +public class EpsonCash implements EpsonCashInterface { + public EpsonCash() {} + + public long getOperatore() { + return 0L; + } + + public void setOperatore(long operatore) {} + + public int getTipoScontrino() { + return 0; + } + + public void setTipoScontrino(int tipoScontrino) {} + + public void addMessageHeader(String descrizione) {} + + public void addMessageBody(String descrizione) {} + + public void addMessageFooter(String descrizione) {} + + public void addArticle(String descrizione, double quantita, double prezzo, boolean visualizzaDisplay, long reparto, String descrizioneAggiuntiva) {} + + public void addArticle(String descrizione, double quantita, double prezzo, boolean visualizzaDisplay, long reparto, String descrizioneAggiuntiva, BarcodeCash barcode) {} + + public void addArticle(String descrizione, double quantita, double prezzo, boolean visualizzaDisplay, long reparto, boolean stampaSubtotalDopoArticolo, String descrizioneAggiuntiva) {} + + public void addDiscoutUplift(String descrizione, double prezzo, boolean visualizzaDisplay, long reparto, long tipoRigo) {} + + public void addTotal(String descrizione, double totalePagato, long tipoPagamento) {} + + public void addBarcode(BarcodeCash bc) {} + + public ResParm reprintReceipt(long number, Date data) { + return null; + } + + public ResParm stampa() { + return null; + } + + public ResParm stampa(String line1, String line2, int timeout) { + return null; + } + + public String getSoapServicePage() { + return null; + } + + public void addRefund(String descrizione, double quantity, double prezzo, boolean visualizzaDisplay, long reparto, long tipoRigo) {} + + public void displayString(String line1, String line2) {} + + public void displayString(String articolo, double quantita, double prezzo) {} + + public void openDrawer() {} + + public void openDrawer(String line1, String line2, int timeout) {} + + public void displayTimeOutString(String line1, String line2, int timeout) {} + + public EpsonCash(long operatore, int tipoScontrino, String ipCassa) {} +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/caship/EpsonCashInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/caship/EpsonCashInterface.java new file mode 100644 index 00000000..424313bf --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/caship/EpsonCashInterface.java @@ -0,0 +1,102 @@ +package it.acxent.caship; + +import it.acxent.db.ResParm; +import java.util.Date; + +public interface EpsonCashInterface { + public static final long REC_MESSAGE_TYPE_1_MAX_LENGHT = 46L; + + public static final long REC_MESSAGE_TYPE_4_MAX_LENGHT = 38L; + + public static final long PRINT_NORMAL_MAX_LENGHT = 40L; + + public static final int SCONTRINO_FISCALE = 1; + + public static final int SCONTRINO_NON_FISCALE = 2; + + public static final int SCONTRINO_RISTAMPA_ULTIMO = 3; + + public static final int SCONTRINO_REPORT_GIORNALIERO = 4; + + public static final int SCONTRINO_REPORT_FINANZIARIO = 5; + + public static final int SCONTRINO_SOLO_DISPLAY = 6; + + public static final int SCONTRINO_APRI_CASSA = 7; + + public static final int SCONTRINO_RISTAMPA_MULTIPLA = 8; + + public static final long TYPE_MESSAGE_ITEM = 0L; + + public static final long TYPE_MESSAGE_HEADER = 1L; + + public static final long TYPE_MESSAGE_BODY = 4L; + + public static final long TYPE_MESSAGE_FOOTER = 3L; + + public static final long SCONTO_NOTHING = -1L; + + public static final long SCONTO_ULTIMO_RIGO = 0L; + + public static final long SCONTO_REPARTO = 3L; + + public static final long SCONTO_RESO = 4L; + + public static final long AUMENTO_ULTIMO_RIGO = 5L; + + public static final long AUMENTO_REPARTO = 8L; + + public static final long PAYMENT_CASH = 0L; + + public static final long PAYMENT_CHEQUE = 1L; + + public static final long PAYMENT_CREDIT = 2L; + + public static final long PAYMENT_TICKET = 3L; + + long getOperatore(); + + void setOperatore(long paramLong); + + int getTipoScontrino(); + + void setTipoScontrino(int paramInt); + + void addMessageHeader(String paramString); + + void addMessageBody(String paramString); + + void addMessageFooter(String paramString); + + void addArticle(String paramString1, double paramDouble1, double paramDouble2, boolean paramBoolean, long paramLong, String paramString2); + + void addArticle(String paramString1, double paramDouble1, double paramDouble2, boolean paramBoolean, long paramLong, String paramString2, BarcodeCash paramBarcodeCash); + + void addArticle(String paramString1, double paramDouble1, double paramDouble2, boolean paramBoolean1, long paramLong, boolean paramBoolean2, String paramString2); + + void addDiscoutUplift(String paramString, double paramDouble, boolean paramBoolean, long paramLong1, long paramLong2); + + void addTotal(String paramString, double paramDouble, long paramLong); + + void addBarcode(BarcodeCash paramBarcodeCash); + + ResParm reprintReceipt(long paramLong, Date paramDate); + + ResParm stampa(); + + ResParm stampa(String paramString1, String paramString2, int paramInt); + + String getSoapServicePage(); + + void addRefund(String paramString, double paramDouble1, double paramDouble2, boolean paramBoolean, long paramLong1, long paramLong2); + + void displayString(String paramString1, String paramString2); + + void displayString(String paramString, double paramDouble1, double paramDouble2); + + void openDrawer(); + + void openDrawer(String paramString1, String paramString2, int paramInt); + + void displayTimeOutString(String paramString1, String paramString2, int paramInt); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/caship/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/caship/package-info.java new file mode 100644 index 00000000..5bb6bdbb --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/caship/package-info.java @@ -0,0 +1 @@ +package it.acxent.caship; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/Abbonamento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/Abbonamento.java new file mode 100644 index 00000000..34e68feb --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/Abbonamento.java @@ -0,0 +1,117 @@ +package it.acxent.cc; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Abbonamento extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1587713684972L; + + private long id_abbonamento; + + private long id_attivita; + + private String dataInizio; + + private String dataFine; + + private double costoMensile; + + private Attivita attivita; + + public Abbonamento(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Abbonamento() {} + + public void setId_abbonamento(long newId_abbonamento) { + this.id_abbonamento = newId_abbonamento; + } + + public void setId_attivita(long newId_attivita) { + this.id_attivita = newId_attivita; + setAttivita(null); + } + + public void setDataInizio(String newDataInizio) { + this.dataInizio = newDataInizio; + } + + public void setDataFine(String newDataFine) { + this.dataFine = newDataFine; + } + + public void setCostoMensile(double newCostoMensile) { + this.costoMensile = newCostoMensile; + } + + public long getId_abbonamento() { + return this.id_abbonamento; + } + + public long getId_attivita() { + return this.id_attivita; + } + + public String getDataInizio() { + return (this.dataInizio == null) ? "" : this.dataInizio.trim(); + } + + public String getDataFine() { + return (this.dataFine == null) ? "" : this.dataFine.trim(); + } + + public double getCostoMensile() { + return this.costoMensile; + } + + public void setAttivita(Attivita newAttivita) { + this.attivita = newAttivita; + } + + public Attivita getAttivita() { + this.attivita = (Attivita)getSecondaryObject(this.attivita, Attivita.class, + + getId_attivita()); + return this.attivita; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(AbbonamentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ABBONAMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/AbbonamentoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/AbbonamentoCR.java new file mode 100644 index 00000000..18448e5f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/AbbonamentoCR.java @@ -0,0 +1,76 @@ +package it.acxent.cc; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AbbonamentoCR extends CRAdapter { + private long id_abbonamento; + + private long id_attivita; + + private String dataInizio; + + private String dataFine; + + private double costoMensile; + + private Attivita attivita; + + public AbbonamentoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AbbonamentoCR() {} + + public void setId_abbonamento(long newId_abbonamento) { + this.id_abbonamento = newId_abbonamento; + } + + public void setId_attivita(long newId_attivita) { + this.id_attivita = newId_attivita; + setAttivita(null); + } + + public void setDataInizio(String newDataInizio) { + this.dataInizio = newDataInizio; + } + + public void setDataFine(String newDataFine) { + this.dataFine = newDataFine; + } + + public void setCostoMensile(double newCostoMensile) { + this.costoMensile = newCostoMensile; + } + + public long getId_abbonamento() { + return this.id_abbonamento; + } + + public long getId_attivita() { + return this.id_attivita; + } + + public String getDataInizio() { + return (this.dataInizio == null) ? "" : this.dataInizio.trim(); + } + + public String getDataFine() { + return (this.dataFine == null) ? "" : this.dataFine.trim(); + } + + public double getCostoMensile() { + return this.costoMensile; + } + + public void setAttivita(Attivita newAttivita) { + this.attivita = newAttivita; + } + + public Attivita getAttivita() { + this.attivita = (Attivita)getSecondaryObject(this.attivita, Attivita.class, + + getId_attivita()); + return this.attivita; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/ArticoloAutoOfferte.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/ArticoloAutoOfferte.java new file mode 100644 index 00000000..d023e003 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/ArticoloAutoOfferte.java @@ -0,0 +1,281 @@ +package it.acxent.cc; + +import it.acxent.anag.ListinoArticolo; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.art.Marca; +import it.acxent.art.Vetrina; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Timer; +import it.acxent.util.Vectumerator; +import java.sql.Date; +import java.util.Calendar; +import java.util.HashMap; + +public class ArticoloAutoOfferte { + private static boolean threadAutoOfferte = false; + + private long nArticoliAO = 30L; + + private long nGiorniAO = 3L; + + private long id_vetrinaAO; + + private double prezzoDaAO; + + private long giacenzaMinimaAO = 10L; + + private double percScontoOffertaAO; + + private ApplParmFull apFull; + + class ThreadAutoOfferte extends Thread { + private ApplParmFull apFull; + + private boolean sendEmail; + + private final String TAG_THREAD_MSG = "AUTO OFFERTE "; + + public ThreadAutoOfferte(ApplParmFull apFull, boolean sendEmail) { + this.apFull = apFull; + this.sendEmail = sendEmail; + if (!ArticoloAutoOfferte.isThreadAttivo()) { + ArticoloAutoOfferte.threadAutoOfferte = true; + start(); + } + } + + public void run() { + boolean debug = false; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(ArticoloAutoOfferte.this.getApFull(), "AUTO OFFERTE ", "...inizio ..."); + ResParm rp = new ResParm(true); + int i = 1; + int se1 = 10; + int se2 = 100; + ArticoloCR CR = new ArticoloCR(); + Articolo bean = new Articolo(this.apFull); + Vetrina vetrina = new Vetrina(this.apFull); + vetrina.findByPrimaryKey(ArticoloAutoOfferte.this.getId_vetrinaAO()); + if (vetrina.getId_vetrina() == 0L) { + rp.setMsg("ERRORE! vetrina non definito.."); + rp.setStatus(false); + } else { + if (ArticoloAutoOfferte.this.getPercScontoOffertaAO() > 0.0D) { + String sqlUpdate = "update ARTICOLO as A set id_vetrina=null"; + String today = DBAdapter.getToday().toString(); + WcString updateCR = new WcString(); + updateCR.addWc("id_vetrina=" + ArticoloAutoOfferte.this.getId_vetrinaAO()); + updateCR.addWc("(A.dataScadenzaOfferta<'" + today + "' or A.dataScadenzaOffertaFornitore<'" + today + "' OR (A.dataScadenzaOfferta is null and A.dataScadenzaOffertaFornitore is null) )"); + bean.update(sqlUpdate + sqlUpdate); + CR.setFlgOfferta(4L); + CR.setFlgEscludiWeb(0L); + if (!debug) + CR.setFlgReadyForWeb(1L); + CR.setFlgOrderBy(99L); + CR.setPrezzoDa(ArticoloAutoOfferte.this.getPrezzoDaAO()); + if (ArticoloAutoOfferte.this.getGiacenzaMinimaAO() > 0L) { + CR.setQtaDa(ArticoloAutoOfferte.this.getGiacenzaMinimaAO()); + CR.setQtaA(999999L); + CR.setFlgQta(1L); + } + Calendar cal = Calendar.getInstance(); + cal.add(6, (int)ArticoloAutoOfferte.this.getNGiorniAO()); + Date dataScadenzaOfferta = new Date(cal.getTimeInMillis()); + Vectumerator vectumerator = bean.findByCR(CR, 1, (int)ArticoloAutoOfferte.this.getNArticoliAO()); + System.out.println("Tot Record: " + vectumerator.getTotNumberOfRecords()); + while (vectumerator.hasMoreElements()) { + Articolo row = (Articolo)vectumerator.nextElement(); + String temp = "Aggiornamento " + i + " su " + vectumerator.getTotNumberOfRecords() + " " + row.getCodice() + " " + row.getNome(); + StatusMsg.updateMsgByTag(ArticoloAutoOfferte.this.getApFull(), "AUTO OFFERTE ", temp); + DBAdapter.printDebug(debug, "AUTO OFFERTE " + temp); + row.setPrezzoIvatoBarrato(row.getStreetPriceIva()); + row.setId_vetrina(ArticoloAutoOfferte.this.getId_vetrinaAO()); + if (debug) + System.out.println("AUTO OFFERTE ora salvo..."); + row.save(); + if (debug) + System.out.println("AUTO OFFERTE salvataggio ok"); + if (DBAdapter.getDateDiff(DBAdapter.getToday(), dataScadenzaOfferta) < 0L) { + if (debug) + System.out.println("AUTO OFFERTE cancello offerta...."); + ListinoArticolo la = row.getListinoArticoloBase(); + la.setDataScadenzaOffertaLA(null); + la.setPercScontoOffertaLA(0.0D); + la.setPrezzoOffertaLA(0.0D); + la.save(); + } + if (dataScadenzaOfferta != null && DBAdapter.getDateDiff(DBAdapter.getToday(), dataScadenzaOfferta) >= 0L && + ArticoloAutoOfferte.this.getPercScontoOffertaAO() > 0.0D) { + if (debug) + System.out.println("AUTO OFFERTE inserisco offerta...."); + ListinoArticolo la = row.getListinoArticoloBase(); + la.setDataScadenzaOffertaLA(dataScadenzaOfferta); + la.setPercScontoOffertaLA(ArticoloAutoOfferte.this.getPercScontoOffertaAO()); + la.save(); + } + if (bean.isLocalhost()) + System.out.println("Auto Offerta:.... localhost"); + if (debug) + System.out.println("AUTO OFFERTE FINE CICLO.... RIPARTO... " + i + "\n"); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " / " + i); + } + } + String tagVetrina = vetrina.getDescrizione().toLowerCase(); + bean.update("update ARTICOLO as A set tagArticolo = replace(A.tagArticolo,'" + tagVetrina + ",','') "); + Marca marca = new Marca(this.apFull); + Vectumerator vecMarca = marca.findMarcheConTagOfferta(); + HashMap hmMarcaTag = new HashMap<>(); + while (vecMarca.hasMoreElements()) { + Marca row = (Marca)vecMarca.nextElement(); + bean.update("update ARTICOLO as A set tagArticolo = replace(A.tagArticolo,'" + row.getTagOfferta() + ",','') "); + hmMarcaTag.put(Long.valueOf(row.getId_marca()), row.getTagOfferta()); + } + CR = new ArticoloCR(); + CR.setFlgOfferta(1L); + CR.setFlgEscludiWeb(0L); + if (!debug) + CR.setFlgReadyForWeb(1L); + Vectumerator vec = bean.findByCR(CR, 0, 0); + if (debug) + System.out.println("AUTO OFFERTE CICLO TAG ...tot record " + vec.getTotNumberOfRecords() + "\n"); + i = 0; + while (vec.hasMoreElements()) { + boolean isTagAggiornato = false; + Articolo row = (Articolo)vec.nextElement(); + String temp = "Aggiornamento tag " + i + " su " + vec.getTotNumberOfRecords() + " " + row.getCodice() + " " + row.getNome(); + StatusMsg.updateMsgByTag(ArticoloAutoOfferte.this.getApFull(), "AUTO OFFERTE ", temp); + String l_tag = row.getTagArticolo(); + if (l_tag.indexOf(tagVetrina) < 0) { + if (!l_tag.endsWith(",")) + l_tag = l_tag + ","; + l_tag = l_tag + l_tag + ","; + row.setTagArticolo(l_tag); + isTagAggiornato = true; + } + if (hmMarcaTag.containsKey(Long.valueOf(row.getId_marca()))) { + l_tag = row.getTagArticolo(); + String tagMarca = hmMarcaTag.get(Long.valueOf(row.getId_marca())); + if (l_tag.indexOf(tagMarca) < 0) { + if (!l_tag.endsWith(",")) + l_tag = l_tag + ","; + l_tag = l_tag + l_tag + ","; + row.setTagArticolo(l_tag); + isTagAggiornato = true; + } + } + if (isTagAggiornato) + row.superSave(); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " / " + i); + } + if (debug) + System.out.println("AUTO OFFERTE FINE CICLO TAG " + i + "\n"); + } + timer.stop(); + rp.setMsg("AUTO OFFERTE concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + if (this.sendEmail); + StatusMsg.updateMsgByTag(ArticoloAutoOfferte.this.getApFull(), "AUTO OFFERTE ", rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(ArticoloAutoOfferte.this.getApFull(), "AUTO OFFERTE "); + ArticoloAutoOfferte.threadAutoOfferte = false; + System.out.println(rp.getMsg()); + } + + public boolean isSendEmail() { + return this.sendEmail; + } + + public void setSendEmail(boolean sendEmail) { + this.sendEmail = sendEmail; + } + } + + public ArticoloAutoOfferte(ApplParmFull apFull) { + this.apFull = apFull; + } + + public ArticoloAutoOfferte() {} + + public static boolean isThreadAttivo() { + return threadAutoOfferte; + } + + public long getNArticoliAO() { + return this.nArticoliAO; + } + + public void setNArticoliAO(long nArticoliAO) { + this.nArticoliAO = nArticoliAO; + } + + public long getNGiorniAO() { + return this.nGiorniAO; + } + + public void setNGiorniAO(long nGiorniAO) { + this.nGiorniAO = nGiorniAO; + } + + public long getId_vetrinaAO() { + return this.id_vetrinaAO; + } + + public void setId_vetrinaAO(long id_vetrinaAO) { + this.id_vetrinaAO = id_vetrinaAO; + } + + public double getPrezzoDaAO() { + return this.prezzoDaAO; + } + + public void setPrezzoDaAO(double prezzoDaAO) { + this.prezzoDaAO = prezzoDaAO; + } + + public long getGiacenzaMinimaAO() { + return this.giacenzaMinimaAO; + } + + public void setGiacenzaMinimaAO(long giacenzaMinimaAO) { + this.giacenzaMinimaAO = giacenzaMinimaAO; + } + + public double getPercScontoOffertaAO() { + return this.percScontoOffertaAO; + } + + public void setPercScontoOffertaAO(double percScontoOffertaAO) { + this.percScontoOffertaAO = percScontoOffertaAO; + } + + public ApplParmFull getApFull() { + return this.apFull; + } + + public void setApFull(ApplParmFull apFull) { + this.apFull = apFull; + } + + public final ResParm starAutoOfferte(ApplParmFull apFull, boolean sendEmail) { + if (!isThreadAttivo()) { + new ThreadAutoOfferte(apFull, sendEmail); + return new ResParm(true, "Thread AUTO OFFERTE avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread AUTO OFFERTE in esecuzione!!!"); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/ArticoloBulkUpdate.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/ArticoloBulkUpdate.java new file mode 100644 index 00000000..263065a8 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/ArticoloBulkUpdate.java @@ -0,0 +1,651 @@ +package it.acxent.cc; + +import it.acxent.anag.ListinoArticolo; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.art.Tipo; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.ScaleImage; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Timer; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.sql.Date; + +public class ArticoloBulkUpdate { + public final long FLG_TAG_SOSTITUISCI = 0L; + + public final long FLG_TAG_AGGIUNGI = 1L; + + public final long FLG_TAG_RIMUOVI = 2L; + + private final String TAG_THREAD_MSG = "BULK UPDATE "; + + private ApplParmFull apFull; + + private long id_tipoBA; + + private double ricaricoBA; + + private long qtaMaxAcquistoWwwBA; + + private long id_listinoEbayBA; + + private long qtaEbayBA; + + private long flgEbayBA; + + private long id_listinoAmazonBA; + + private long qtaAmazonBA; + + private long flgAmazonBA; + + private long flgGoogleBA = -1L; + + private String icecatLang; + + private long flgEscludiWebArtBA; + + private String previewSizes = "66,350"; + + private long flgPreventivoWwwArtBA = -1L; + + private long percCostoSpedizioneBA = -1L; + + private long percScontoOffertaBA = -1L; + + private Date dataScadenzaOffertaBA; + + private long flgCaricaAmazon; + + private String tagBA; + + private long flgRicaricaImmagini; + + private long id_vetrinaBA; + + private long flgTagActBA; + + private String previewSizes1 = "50,150,200"; + + private long id_statoUsatoBA; + + private long flgTrovaprezziBA; + + private long flgIdealoBA; + + private Tipo tipoBA; + + private double prezzoPubblicoDaBA; + + private double ricaricoOltreBA; + + private long flgCaricaEbay; + + private static boolean threadBulkUpdate = false; + + public static final String getGoogleBA(long l_flgGoogleBA) { + return Articolo.getGoogle(l_flgGoogleBA); + } + + public final String getGoogleBA() { + return Articolo.getGoogle(getFlgGoogleBA()); + } + + class ThreadBulkUpdate extends Thread { + private ApplParmFull apFull; + + private boolean sendEmail; + + private ArticoloCR CR; + + private WwwAutomator wwwAutomator; + + public ThreadBulkUpdate(ApplParmFull apFull, ArticoloCR CR, boolean sendEmail) { + this.apFull = apFull; + this.sendEmail = sendEmail; + this.CR = CR; + this.wwwAutomator = null; + if (!ArticoloBulkUpdate.isThreadAttivo()) { + ArticoloBulkUpdate.threadBulkUpdate = true; + start(); + } + } + + public ThreadBulkUpdate(ApplParmFull apFull, ArticoloCR CR, WwwAutomator wwwAutomator) { + this.apFull = apFull; + this.sendEmail = false; + this.CR = CR; + this.wwwAutomator = wwwAutomator; + if (!ArticoloBulkUpdate.isThreadAttivo()) { + ArticoloBulkUpdate.threadBulkUpdate = true; + start(); + } + } + + public void run() { + boolean debug = true; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(ArticoloBulkUpdate.this.getApFull(), "BULK UPDATE ", "...inizio ..."); + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + boolean sovrascriviImmagini = (ArticoloBulkUpdate.this.getFlgRicaricaImmagini() == 1L); + Articolo bean = new Articolo(this.apFull); + sb.append(""); + sb.append(""); + sb.append(""); + StringTokenizer st = new StringTokenizer(bean.getDescrizionePerMail(true), "|"); + while (st.hasMoreTokens()) { + sb.append(""); + } + sb.append(""); + Vectumerator vec = bean.findByCR(this.CR, 0, 0); + DBAdapter.printDebug(debug, "Tot Record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + String temp = "Aggiornamento " + i + " su " + vec.getTotNumberOfRecords() + " " + row.getCodice() + " " + row.getNome(); + StatusMsg.updateMsgByTag(ArticoloBulkUpdate.this.getApFull(), "BULK UPDATE ", temp); + DBAdapter.printDebug(debug, "BULK UPDATE " + temp); + if (ArticoloBulkUpdate.this.getId_tipoBA() > 0L) { + row.setId_tipo(ArticoloBulkUpdate.this.getId_tipoBA()); + row.superSave(); + DBAdapter.printDebug(debug, "BULK UPDATE tipo save ok"); + } + if (row.getMarca().getFlgIcecatAuto() == 1L && + !ArticoloBulkUpdate.this.getIcecatLang().isEmpty()) { + boolean caricaImmagini = sovrascriviImmagini; + st = new StringTokenizer(ArticoloBulkUpdate.this.getIcecatLang(), ","); + while (st.hasMoreTokens()) { + String lang = st.nextToken(); + StatusMsg.updateMsgByTag(ArticoloBulkUpdate.this.getApFull(), "BULK UPDATE ", temp + " chiamata icecat " + temp + " ....."); + DBAdapter.printDebug(debug, "BULK UPDATE chiamo icecat " + lang + "..."); + row.caricaIcecat(lang, caricaImmagini, 1); + caricaImmagini = false; + DBAdapter.printDebug(debug, "BULK UPDATE chiamo icecat " + lang + " ok"); + } + } + if (ArticoloBulkUpdate.this.getRicaricoBA() > 0.0D) { + if (ArticoloBulkUpdate.this.getPrezzoPubblicoDaBA() == 0.0D) { + row.setPercRicarico(ArticoloBulkUpdate.this.getRicaricoBA()); + } else if (row.getPrezzoPubblico() < ArticoloBulkUpdate.this.getPrezzoPubblicoDaBA()) { + row.setPercRicarico(ArticoloBulkUpdate.this.getRicaricoBA()); + } else if (ArticoloBulkUpdate.this.getRicaricoOltreBA() <= 0.0D) { + row.setPercRicarico(ArticoloBulkUpdate.this.getRicaricoBA()); + } else { + row.setPercRicarico(ArticoloBulkUpdate.this.getRicaricoOltreBA()); + } + row.setCostoNuovo(row.getCostoNetto()); + DBAdapter.printDebug(debug, "BULK UPDATE ricarico ok"); + } + row.setPrezzoIvatoBarrato(row.getStreetPriceIva()); + if (ArticoloBulkUpdate.this.getFlgEbayBA() >= 0L) + row.setFlgEbay(ArticoloBulkUpdate.this.getFlgEbayBA()); + if (ArticoloBulkUpdate.this.getId_listinoEbayBA() > 0L) + row.setId_listinoEbay(ArticoloBulkUpdate.this.getId_listinoEbayBA()); + if (ArticoloBulkUpdate.this.getQtaEbayBA() >= 0L) + row.setQtaEbay(ArticoloBulkUpdate.this.getQtaEbayBA()); + if (ArticoloBulkUpdate.this.getFlgAmazonBA() >= 0L) + row.setFlgAmazon(ArticoloBulkUpdate.this.getFlgAmazonBA()); + if (ArticoloBulkUpdate.this.getId_listinoAmazonBA() > 0L) + row.setId_listinoAmazon(ArticoloBulkUpdate.this.getId_listinoAmazonBA()); + if (ArticoloBulkUpdate.this.getQtaAmazonBA() >= 0L) + row.setQtaAmz(ArticoloBulkUpdate.this.getQtaAmazonBA()); + if (ArticoloBulkUpdate.this.getQtaMaxAcquistoWwwBA() >= 0L) + row.setQtaMaxAcquistoWww(ArticoloBulkUpdate.this.getQtaMaxAcquistoWwwBA()); + if (ArticoloBulkUpdate.this.getFlgGoogleBA() >= 0L) + row.setFlgGoogle(ArticoloBulkUpdate.this.getFlgGoogleBA()); + if (ArticoloBulkUpdate.this.getFlgTrovaprezziBA() >= 0L) + row.setFlgTrovaprezzi(ArticoloBulkUpdate.this.getFlgTrovaprezziBA()); + if (ArticoloBulkUpdate.this.getFlgIdealoBA() >= 0L) + row.setFlgIdealo(ArticoloBulkUpdate.this.getFlgIdealoBA()); + if (ArticoloBulkUpdate.this.getFlgEscludiWebArtBA() >= -1L) + row.setFlgEscludiWebArt(ArticoloBulkUpdate.this.getFlgEscludiWebArtBA()); + if (ArticoloBulkUpdate.this.getFlgPreventivoWwwArtBA() >= 0L) + row.setFlgPreventivoWwwArt(ArticoloBulkUpdate.this.getFlgPreventivoWwwArtBA()); + if (ArticoloBulkUpdate.this.getPercCostoSpedizioneBA() >= 0L) + row.setPercCostoSpedizione(ArticoloBulkUpdate.this.getPercCostoSpedizioneBA()); + if (ArticoloBulkUpdate.this.getId_vetrinaBA() == -1L) { + row.setId_vetrina(0L); + } else if (ArticoloBulkUpdate.this.getId_vetrinaBA() > 0L) { + row.setId_vetrina(ArticoloBulkUpdate.this.getId_vetrinaBA()); + } + if (ArticoloBulkUpdate.this.getId_statoUsatoBA() == -1L) { + row.setId_statoUsato(0L); + } else if (ArticoloBulkUpdate.this.getId_statoUsatoBA() > 0L) { + row.setId_statoUsato(ArticoloBulkUpdate.this.getId_statoUsatoBA()); + if (ArticoloBulkUpdate.this.getId_statoUsatoBA() == 1L) { + row.setFlgUsato(0L); + } else { + row.setFlgUsato(2L); + } + } + DBAdapter.printDebug(debug, "BULK UPDATE inizio tag.."); + if (ArticoloBulkUpdate.this.getFlgTagActBA() == 2L) { + row.setTagArticolo(""); + } else if (!ArticoloBulkUpdate.this.getTagBA().isEmpty()) { + if (ArticoloBulkUpdate.this.getFlgTagActBA() == 0L) { + l_tag = ""; + } else { + l_tag = row.getTagArticolo(); + } + if (!l_tag.endsWith(",")) + l_tag = l_tag + ","; + String l_tag = l_tag + l_tag + ","; + row.setTagArticolo(l_tag); + } + DBAdapter.printDebug(debug, "BULK UPDATE tag finito... ora salvo..."); + row.save(); + DBAdapter.printDebug(debug, "BULK UPDATE salvataggio ok"); + if (ArticoloBulkUpdate.this.getRicaricoBA() > 0.0D) { + DBAdapter.printDebug(debug, "BULK UPDATE aggiornamento prezzo con costo nuovo...."); + row.aggiornaPrezzoNettoConCostoNuovo(); + DBAdapter.printDebug(debug, "BULK UPDATE aggiornamento prezzo con costo nuovo OK"); + } + if (DBAdapter.getDateDiff(DBAdapter.getToday(), ArticoloBulkUpdate.this.getDataScadenzaOffertaBA()) < 0L) { + DBAdapter.printDebug(debug, "BULK UPDATE cancello offerta...."); + ListinoArticolo la = row.getListinoArticoloBase(); + la.setDataScadenzaOffertaLA(null); + la.setPercScontoOffertaLA(0.0D); + la.setPrezzoOffertaLA(0.0D); + la.save(); + } + if (ArticoloBulkUpdate.this.getDataScadenzaOffertaBA() != null && DBAdapter.getDateDiff(DBAdapter.getToday(), ArticoloBulkUpdate.this.getDataScadenzaOffertaBA()) >= 0L && + ArticoloBulkUpdate.this.getPercScontoOffertaBA() > 0L) { + DBAdapter.printDebug(debug, "BULK UPDATE inserisco offerta...."); + ListinoArticolo la = row.getListinoArticoloBase(); + la.setDataScadenzaOffertaLA(ArticoloBulkUpdate.this.getDataScadenzaOffertaBA()); + la.setPercScontoOffertaLA((double)ArticoloBulkUpdate.this.getPercScontoOffertaBA()); + la.save(); + } + if (!bean.isLocalhost()) { + if (ArticoloBulkUpdate.this.getFlgCaricaEbay() == 1L && row.getFlgEbay() == 1L) { + DBAdapter.printDebug(debug, "BULK UPDATE ebay publish full...."); + row.ebayPublishFull(); + } + if (ArticoloBulkUpdate.this.getFlgCaricaEbay() == 9L && row.getFlgEbay() == 1L && row.isEbayPubblicato()) { + DBAdapter.printDebug(debug, "BULK UPDATE ebay delete inventory item...."); + rp = row.ebayDeleteInventoryItem(); + } + if (ArticoloBulkUpdate.this.getFlgCaricaAmazon() == 1L && row.getFlgAmazon() == 1L) { + DBAdapter.printDebug(debug, "BULK UPDATE amazon publish full.... "); + bean.setFlgPriceTypeAmz(1L); + rp = bean.amzUpdateOfferAuto(); + } + if (ArticoloBulkUpdate.this.getFlgCaricaAmazon() == 9L && row.getFlgAmazon() == 1L) { + DBAdapter.printDebug(debug, "BULK UPDATE amazon delete inventory item...."); + rp = row.amzDeleteItem(); + } + } else { + DBAdapter.printDebug(true, "Bulk Update: ebay non aggiornabile se localhost"); + } + if (!ArticoloBulkUpdate.this.getPreviewSizes().isEmpty()) { + DBAdapter.printDebug(debug, "BULK UPDATE creo preview...."); + row.creaPreviewH(ArticoloBulkUpdate.this.getPreviewSizes(), 8, "BULK UPDATE ", temp); + } + if (!ArticoloBulkUpdate.this.getPreviewSizes1().isEmpty()) { + DBAdapter.printDebug(debug, "BULK UPDATE creo preview 1...."); + row.creaPreviewH(ArticoloBulkUpdate.this.getPreviewSizes1(), 1, "BULK UPDATE ", temp); + } + sb.append(""); + st = new StringTokenizer(row.getDescrizionePerMail(false), "|"); + while (st.hasMoreTokens()) { + sb.append(""); + } + sb.append(""); + DBAdapter.printDebug(debug, "BULK UPDATE FINE CICLO.... RIPARTO... " + i + "\n"); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " / " + i); + } + sb.append("
"); + String token = st.nextToken(); + sb.append(token); + sb.append("
"); + String token = st.nextToken(); + sb.append(token); + sb.append("
"); + timer.stop(); + rp.setMsg("BULK UPDATE concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + if (this.wwwAutomator != null) { + if (i == 0) { + this.wwwAutomator.setUltimaEsecuzione(DBAdapter.getTimestamp().toString() + "
BULK UPDATE concluso. DURATA: " + DBAdapter.getTimestamp().toString() + "
record processati: " + + timer.getDurataHourMin() + "
" + i); + } else { + this.wwwAutomator.setUltimaEsecuzione(DBAdapter.getTimestamp().toString() + "
BULK UPDATE concluso. DURATA: " + DBAdapter.getTimestamp().toString() + "
record processati: " + + timer.getDurataHourMin() + "
" + i); + } + this.wwwAutomator.save(); + } + if (this.sendEmail); + StatusMsg.updateMsgByTag(ArticoloBulkUpdate.this.getApFull(), "BULK UPDATE ", rp.getMsg()); + try { + if (this.wwwAutomator != null) { + sleep(1000L); + } else { + sleep(10000L); + } + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(ArticoloBulkUpdate.this.getApFull(), "BULK UPDATE "); + ArticoloBulkUpdate.threadBulkUpdate = false; + DBAdapter.printDebug(debug, rp.getMsg()); + } + } + + public ArticoloBulkUpdate(ApplParmFull apFull) { + this.apFull = apFull; + } + + public ArticoloBulkUpdate() {} + + public ApplParmFull getApFull() { + return this.apFull; + } + + public void setApFull(ApplParmFull apFull) { + this.apFull = apFull; + } + + public long getId_tipoBA() { + return this.id_tipoBA; + } + + public void setId_tipoBA(long id_tipoBA) { + this.id_tipoBA = id_tipoBA; + } + + public double getRicaricoBA() { + return this.ricaricoBA; + } + + public void setRicaricoBA(double ricaricoBA) { + this.ricaricoBA = ricaricoBA; + } + + public long getId_listinoEbayBA() { + return this.id_listinoEbayBA; + } + + public void setId_listinoEbayBA(long id_listinoEbayBA) { + this.id_listinoEbayBA = id_listinoEbayBA; + } + + public long getQtaMaxAcquistoWwwBA() { + return this.qtaMaxAcquistoWwwBA; + } + + public void setQtaMaxAcquistoWwwBA(long qtaMaxAcquistoWwwBA) { + this.qtaMaxAcquistoWwwBA = qtaMaxAcquistoWwwBA; + } + + public long getQtaEbayBA() { + return this.qtaEbayBA; + } + + public void setQtaEbayBA(long qtaEbayBA) { + this.qtaEbayBA = qtaEbayBA; + } + + public long getFlgEbayBA() { + return this.flgEbayBA; + } + + public void setFlgEbayBA(long flgEbayBA) { + this.flgEbayBA = flgEbayBA; + } + + public long getFlgGoogleBA() { + return this.flgGoogleBA; + } + + public void setFlgGoogleBA(long flgGoogleBA) { + this.flgGoogleBA = flgGoogleBA; + } + + public String getIcecatLang() { + return (this.icecatLang == null) ? "" : this.icecatLang.trim(); + } + + public void setIcecatLang(String icecatLang) { + this.icecatLang = icecatLang; + } + + public long getFlgEscludiWebArtBA() { + return this.flgEscludiWebArtBA; + } + + public void setFlgEscludiWebArtBA(long flgEscludiWebArtBA) { + this.flgEscludiWebArtBA = flgEscludiWebArtBA; + } + + public final ResParm starBulkUpdate(ApplParmFull apFull, ArticoloCR CR, boolean sendEmail) { + boolean test = false; + if (!isThreadAttivo()) { + new ThreadBulkUpdate(apFull, CR, sendEmail); + return new ResParm(true, "Thread BULK UPDATE avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public final ResParm starBulkUpdate(ApplParmFull apFull, ArticoloCR CR, WwwAutomator wwwAutomator) { + boolean test = false; + if (!isThreadAttivo()) { + new ThreadBulkUpdate(apFull, CR, wwwAutomator); + return new ResParm(true, "Thread BULK UPDATE AUTOMATOR avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public final ResParm starBulkUpdateAutomator(ApplParmFull apFull, ArticoloCR CR, WwwAutomator wwwAutomator) { + boolean test = false; + if (!isThreadAttivo()) { + new ThreadBulkUpdate(apFull, CR, false); + return new ResParm(true, "Thread BULK UPDATE avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public static boolean isThreadAttivo() { + return threadBulkUpdate; + } + + public long getFlgCaricaEbay() { + return this.flgCaricaEbay; + } + + public void setFlgCaricaEbay(long flgCaricaEbay) { + this.flgCaricaEbay = flgCaricaEbay; + } + + public String getPreviewSizes() { + return (this.previewSizes == null) ? "" : this.previewSizes.trim(); + } + + public void setPreviewSizes(String previewSizes) { + this.previewSizes = previewSizes; + } + + public String getPreviewSizes1() { + return (this.previewSizes1 == null) ? "" : this.previewSizes1.trim(); + } + + public void setPreviewSizes1(String previewSizes1) { + this.previewSizes1 = previewSizes1; + } + + protected void creaPreviewXX(Articolo row, String sizes, int fotoFinale, String statusMsg) { + if (!sizes.isEmpty()) { + String targetDir = row.getDocBase() + row.getDocBase(); + StringTokenizer st = new StringTokenizer(sizes, ","); + while (st.hasMoreTokens()) { + int size = Integer.parseInt(st.nextToken()); + for (int j = 1; j <= fotoFinale; j++) { + String currentImageName = targetDir + targetDir; + if (new File(currentImageName).exists()) { + StatusMsg.updateMsgByTag(getApFull(), "BULK UPDATE ", statusMsg + " crea preview foto " + statusMsg + " size " + j + " ....."); + ScaleImage si = new ScaleImage(currentImageName, "" + size + "/" + size + "+", 0L, size, 0, false, false); + si.scaleIt(); + } + } + } + } + } + + public long getFlgRicaricaImmagini() { + return this.flgRicaricaImmagini; + } + + public void setFlgRicaricaImmagini(long flgRicaricaImmagini) { + this.flgRicaricaImmagini = flgRicaricaImmagini; + } + + public long getFlgPreventivoWwwArtBA() { + return this.flgPreventivoWwwArtBA; + } + + public void setFlgPreventivoWwwArtBA(long flgPreventivoWwwArtBA) { + this.flgPreventivoWwwArtBA = flgPreventivoWwwArtBA; + } + + public long getPercCostoSpedizioneBA() { + return this.percCostoSpedizioneBA; + } + + public void setPercCostoSpedizioneBA(long percCostoSpedizioneBA) { + this.percCostoSpedizioneBA = percCostoSpedizioneBA; + } + + public long getPercScontoOffertaBA() { + return this.percScontoOffertaBA; + } + + public void setPercScontoOffertaBA(long percScontoOffertaBA) { + this.percScontoOffertaBA = percScontoOffertaBA; + } + + public Date getDataScadenzaOffertaBA() { + return this.dataScadenzaOffertaBA; + } + + public void setDataScadenzaOffertaBA(Date dataScadenzaOffertaBA) { + this.dataScadenzaOffertaBA = dataScadenzaOffertaBA; + } + + public long getId_vetrinaBA() { + return this.id_vetrinaBA; + } + + public void setId_vetrinaBA(long id_vetrinaBA) { + this.id_vetrinaBA = id_vetrinaBA; + } + + public String getTagBA() { + return (this.tagBA == null) ? "" : this.tagBA.trim(); + } + + public void setTagBA(String tagBA) { + this.tagBA = tagBA; + } + + public long getFlgTagActBA() { + return this.flgTagActBA; + } + + public void setFlgTagActBA(long flgTagModBA) { + this.flgTagActBA = flgTagModBA; + } + + public long getId_statoUsatoBA() { + return this.id_statoUsatoBA; + } + + public void setId_statoUsatoBA(long id_statoUsato) { + this.id_statoUsatoBA = id_statoUsato; + } + + public long getFlgTrovaprezziBA() { + return this.flgTrovaprezziBA; + } + + public void setFlgTrovaprezziBA(long flgTrovaprezziBA) { + this.flgTrovaprezziBA = flgTrovaprezziBA; + } + + public long getFlgIdealoBA() { + return this.flgIdealoBA; + } + + public void setFlgIdealoBA(long flgIdealoBA) { + this.flgIdealoBA = flgIdealoBA; + } + + public Tipo getTipoBA() { + if (this.tipoBA == null) { + this.tipoBA = new Tipo(getApFull()); + this.tipoBA.findByPrimaryKey(getId_tipoBA()); + } + return (this.tipoBA == null) ? new Tipo() : this.tipoBA; + } + + public void setTipoBA(Tipo tipoBA) { + this.tipoBA = tipoBA; + } + + public double getPrezzoPubblicoDaBA() { + return this.prezzoPubblicoDaBA; + } + + public void setPrezzoPubblicoDaBA(double prezzoPubblicoDa) { + this.prezzoPubblicoDaBA = prezzoPubblicoDa; + } + + public double getRicaricoOltreBA() { + return this.ricaricoOltreBA; + } + + public void setRicaricoOltreBA(double ricaricoOltre) { + this.ricaricoOltreBA = ricaricoOltre; + } + + public long getId_listinoAmazonBA() { + return this.id_listinoAmazonBA; + } + + public void setId_listinoAmazonBA(long id_listinoAmazonBA) { + this.id_listinoAmazonBA = id_listinoAmazonBA; + } + + public long getQtaAmazonBA() { + return this.qtaAmazonBA; + } + + public void setQtaAmazonBA(long qtaAmzBA) { + this.qtaAmazonBA = qtaAmzBA; + } + + public long getFlgAmazonBA() { + return this.flgAmazonBA; + } + + public void setFlgAmazonBA(long flgAmzBA) { + this.flgAmazonBA = flgAmzBA; + } + + public long getFlgCaricaAmazon() { + return this.flgCaricaAmazon; + } + + public void setFlgCaricaAmazon(long flgCaricaAmazon) { + this.flgCaricaAmazon = flgCaricaAmazon; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/Attivita.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/Attivita.java new file mode 100644 index 00000000..ec233ffa --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/Attivita.java @@ -0,0 +1,4555 @@ +package it.acxent.cc; + +import it.acxent.anag.Clifor; +import it.acxent.anag.Comune; +import it.acxent.anag.DestinazioneDiversa; +import it.acxent.anag.Iva; +import it.acxent.anag.Listino; +import it.acxent.anag.Users; +import it.acxent.anag.UsersCR; +import it.acxent.anag.Vettore; +import it.acxent.api.amz.AmzResult; +import it.acxent.api.amz.AmzSellerApi; +import it.acxent.api.ebay.EbayAbliaApi; +import it.acxent.api.ebay.EbayResult; +import it.acxent.art.Wishlist; +import it.acxent.cart.Cart; +import it.acxent.common.CrontabInterface; +import it.acxent.common.Lang; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoCR; +import it.acxent.contab.RigaDocumento; +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.StringAdapter; +import it.acxent.db.WcString; +import it.acxent.mail.MailMessage; +import it.acxent.mail.MailProperties; +import it.acxent.util.DoubleOperator; +import it.acxent.util.ScaleImage; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Timer; +import it.acxent.util.Vectumerator; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.Serializable; +import java.net.URLEncoder; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.text.NumberFormat; +import java.util.Calendar; +import javax.imageio.ImageIO; +import javax.servlet.http.HttpServletRequest; +import net.ifok.image.image4j.codec.ico.ICOEncoder; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.json.JSONArray; +import org.json.JSONObject; + +public class Attivita extends DBAdapter implements Serializable, AddImgInterface, CrontabInterface { + private static final String CHECK_CART_TEXT = "checkCartText"; + + private static final String COOKIE_POLICY_TEXT = "cookiePolicyText"; + + private static final long serialVersionUID = 1587713686660L; + + public static final String LANG_SE_NON_DISPONIBILE = "en"; + + public static final String SESS_ATTIVITA = "attivita"; + + public static final String SESS_VEC_LANG_ATTIVITA = "_listaLangAtt"; + + public static final String PATH_IMG = "_img/_imgAttivita/"; + + private static final String DESCRIZIONE_ATTIVITA = "descrizioneAttivita"; + + private static final String SLOGAN_TRASPORTO = "sloganTrasporto"; + + private static final String MAIN_TAG_KEYWORD = "mainTagKeyword"; + + private static final String MAIN_TAG_DESC = "mainTagDesc"; + + private static final String MAIN_TAG_TITLE = "mainTagTitle"; + + private static final String MAIN_TAG_H1 = "mainTagH1"; + + private static final String MAIN_TAG_H2 = "mainTagH2"; + + private static final String MAIN_TESTO_TITLE = "mainTestoTitle"; + + private static final String MAIN_TESTO_CENTRALE = "mainTestoCentrale"; + + private static final String DIRITTO_DI_RECESSO = "dirittoDiRecesso"; + + private static final String DETAIL_XS_TITLE = "detailXsTitle"; + + private static final String DETAIL_DX_TITLE = "detailDxTitle"; + + private static final String RETURN_CONDITIONS = "returnConditions"; + + private static final String TERM_CONDITIONS = "termConditions"; + + private static final String PRIVACY = "privacy"; + + private static final String CART_TEXT = "cartText"; + + private static final String CART_TITLE = "cartTitle"; + + private static final String MAIN_SX_TITLE = "mainSxTitle"; + + private static final String DETAIL_XS_TEXT = "detailXsText"; + + private static final String DETAIL_NON_VISIBILE = "detailNonVisibile"; + + private static final String DETAIL_NON_VISIBILE_NO_WEB = "detailNonVisibileNoWeb"; + + private static final String DETAIL_DX_TEXT = "detailDxText"; + + private static final String TRIP_ADVISOR_SCRIPT = "tripAdvisorScript"; + + private static final String FOOTER_TEXT = "footerText"; + + private static final String MAIN_SX_TEXT = "mainSxText"; + + private static final String MAIL_FOOTER = "mailFooter"; + + private static final String DELIVERY_CONSEGNA = "deliveryConsegna"; + + private static final String DESC_SPESE_SPEDIZIONI = "descSpeseSpedizioni"; + + private static final String HTML = ".html"; + + private static final String INDEX = "index-"; + + public static String NOTIFICHE_MSG = "mailMessage/notificheWishlist.html"; + + public static final long TIPO_NEWS_TUTTE = -1L; + + public static final long TIPO_NEWS_NESSUNA = 0L; + + public static final long TIPO_NEWS_LISTA = 1L; + + public static final long TIPO_NEWS_GRID = 2L; + + public static final long TIPO_NEWSLETTER_NO = 0L; + + public static final long TIPO_NEWSLETTER_INTERNA = 1L; + + public static final long TIPO_NEWSLETTER_MAILCHIMP = 2L; + + public static final long GOOGLE_MERCHANT_NO = 0L; + + public static final long GOOGLE_MERCHANT_FTP = 1L; + + public static final long GOOGLE_MERCHANT_SFTP = 2L; + + public static final long TROVAPREZZI_NO = 0L; + + public static final long TROVAPREZZI_SU_ORDINE = 1L; + + public static final long TROVAPREZZI_SU_ACQUISTO = 2L; + + private long id_attivita; + + private long id_tipoAttivita; + + private String nomeAttivita; + + private String nomeAttivitaSeo; + + private String indirizzoAttivita; + + private String numeroCivicoAttivita; + + private long id_comuneAttivita; + + private String descrizioneComuneAttivita; + + private String descrizioneProvinciaAttivita; + + private String capComuneAttivita; + + private long flgGusti; + + private Date dataIscrizione; + + private String codiceAttivita; + + private String imgTmst; + + private long flgDefault; + + private long flgMainSxCategorie; + + private long flgMainSxVetrinaBestseller; + + private long flgMainSxVetrinaOfferte; + + private long flgMainSxUltimiVisualizzati; + + private long flgMainBanner; + + private long flgMainVetrina; + + private long flgMainVetrinaCategorie; + + private long flgTopTelefono; + + private long flgTopLingue; + + private long flgTopMail; + + private long flgNewsletterType; + + private String topFontColorHex; + + private long flgHeadCategorie; + + private long flgHeadMarche; + + private long flgHeadNewsType; + + private String headColoreHex; + + private long flgDetailReviews; + + private long flgDetailRelatedProducts; + + private long flgDetailDxVetrinaBestseller; + + private long flgDetailDxVetrinaOfferte; + + private long flgCoupon; + + private long qtaDisponibilitaBassa; + + private String accountFacebook; + + private String accountTwitter; + + private String accountInstagram; + + private long flgSocialSide; + + private long flgFooterSocial; + + private TipoAttivita tipoAttivita; + + private Comune comuneAttivita; + + private String capZonaAttivita; + + private String telefonoAttivita; + + private String emailAttivita; + + private String topLingueAttivita; + + private String mailFrom; + + private String mailTitolarePrivacy; + + private String mailTitle; + + private long id_vettore; + + private Vettore vettore; + + private long flgCheckoutGuest; + + private String mailCoordinateBancarie; + + private String wwwAddress; + + private String topColoreHex; + + private String backgroundColorHex; + + private String backgroundColorFooterHex; + + private String backgroundColorNavHoverHex; + + private String backgroundCustomFeatureBox; + + private String headCategorieBorderColorHex; + + private String mainTextColorHex; + + private String mainSubtitleBottomBorderHex; + + private String leftMenuTextColorHex; + + private String leftMenuSubTextColorHex; + + private String subtitleHex; + + private String bodyBackgroundHex; + + private String footerTextH5Hex; + + private String footerTextliHex; + + private String footerTextliAHex; + + private String paypalClientId; + + private String paypalClientSecret; + + private String mailchimpSubscribeForm; + + private String tagManagerHead; + + private String tagManagerBody; + + private double costoContrassegno; + + private long flgDetailCompara; + + private long flgDetailWishlist; + + private long flgDetailShareAddThis; + + private long flgMainMiniBanner; + + private long mainUltimiNum; + + private long flgMainUltimi; + + private long flgMainUltimaNews; + + private static Attivita defaultInstance = null; + + private String indirizzoSede; + + private String numeroCivicoSede; + + private long id_comuneSede; + + private String descrizioneComuneSede; + + private String descrizioneProvinciaSede; + + private String capComuneSede; + + private Comune comuneSede; + + private double deliveryFreeAbove; + + private double deliveryCost; + + private String capZonaSede; + + private String telefonoSede; + + private String codFisc; + + private String pIva; + + private String pec; + + private String codiceIdentificativoFE; + + private String contatto; + + private long flgAcquistaSoloDisponibile; + + private long flgCartProcediPagamento; + + private String googleFtpUser; + + private String googleFtpPassword; + + private String googleNomiFileFeed; + + private long flgGoogleMerchant; + + private String pGoogleSigninClientId; + + private long flgGoogleSignin; + + private String pFacebookSigninClientId; + + private String pFacebookSigninSecretKey; + + private long flgFacebookSignin; + + private double pGooglePrezzoPubblicoMinimoXExport; + + private long pGoogleQtaMinimaXExport; + + private long flgTopChatWhatsapp; + + private long flgTopChatTelegram; + + private long flgFooterChatWhatsapp; + + private long flgFooterChatTelegram; + + private long flgSubito; + + private String cellulareAttivita; + + private String chatTelegramUsername; + + private long flgQuotazione; + + private String recaptchaV2Key; + + private long flgEbay; + + private long id_listinoEbay; + + private Listino listinoEbay; + + private String pHEAD_DOC1; + + private String pHEAD_DOC2; + + private String cciaa; + + private String faxAttivita; + + private String pFROM; + + private String pBCC; + + private String pDOC_BCC; + + private String pCC; + + private String pSUBJECT; + + private String ebayFulfillmentPolicyId; + + private String ebayPaymentPolicyId; + + private String ebayReturnPolicyId; + + private String ebayMerchantLocationKey; + + private String ebayOAuthRefreshToken; + + private Timestamp ebayOAuthRefreshTokenExpire; + + private String ebayOAuthUserToken; + + private Timestamp ebayOAuthUserTokenExpire; + + private long flgIcecat; + + private String icecatUsername; + + private String icecatPassword; + + private long percentileMaxPerPreventivo; + + private double pCCArrotondaPrezzoAEuroSopra; + + private double pCCRicaricoMinimoOfferte; + + private double pCCArrotondaDecimalePerPrezziBassi; + + private long flgIvaOneStopShop; + + private long flgIvaEsteroAziendeEsente; + + private String googleMerchantRecensioniScript; + + private String googleMerchantRecensioniScriptBadge; + + private long flgGoogleMerchantRecensioni; + + private long flgGoogleMerchantRecensioniBadge; + + public static boolean threadWL = false; + + private long flgAmz; + + private long id_listinoAmz; + + private Listino listinoAmz; + + private String amzLwaClientId; + + private String amzLwaClientSecret; + + private String amzLwaAuthToken; + + private String amzLwaAccessToken; + + private String amzLwaRefreshToken; + + private Timestamp amzLwaAccessTokenExpireTS = null; + + private String amzIamRoleARN; + + private String amzIamAccessKey; + + private String amzIamSecretKey; + + private String amzStsAccessKeyId; + + private String amzStsSecretAccessKey; + + private String amzStsSessionToken; + + private Timestamp amzStsSessionTokenTS = null; + + private String amzMarketplaces; + + private String amzSellerid; + + private String amzMerchantShippingGroupFree; + + private String googleApiKey; + + private String googleSiteId; + + private long flgTrovaprezzi; + + private String trovaprezziTrustedProgramScript; + + private String trovaprezziTrustedProgramScriptItem; + + private double checkCartPercScontoMax; + + private String cookiePolicyTheme; + + private long flgIdealo; + + private String idealoTag; + + private String paypalRateScriptHead; + + private String paypalRateScriptBodyDett; + + private String paypalRateScriptBodyCat; + + private long flgPaypalRate; + + private String indexNowApiKey; + + private long indexNowUrlQuota; + + private Date indexNowDay; + + private long indexNowDayCount; + + private String pStripePublicKey; + + private String pStripePrivateKey; + + private String pStripeReturnUrl; + + private double deliveryCostPudo; + + class ThreadNotificheWL extends Thread { + private String fileCsvlarge; + + private final String TAG_THREAD_MSG = "WISHLIST NOTIFICHE "; + + public ThreadNotificheWL() { + if (!Attivita.isThreadAttivo()) { + Attivita.threadWL = true; + start(); + } + } + + public void run() { + boolean debug = false; + boolean salvaArticoloNuovo = true; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(Attivita.this.getApFull(), "WISHLIST NOTIFICHE ", "...inizio ..."); + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("##############\nWISHLIST NOTIFICHE \nSTART: " + start.toString()); + ResParm rp = new ResParm(true); + rp = sendNotificheWishlist(); + if (rp.getStatus()); + timer.stop(); + rp.setMsg("Invio Notifiche concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + StatusMsg.updateMsgByTag(Attivita.this.getApFull(), "WISHLIST NOTIFICHE ", rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(Attivita.this.getApFull(), "WISHLIST NOTIFICHE "); + Attivita.threadWL = false; + System.out.println(rp.getMsg()); + } + + public ResParm sendNotificheWishlist() { + StatusMsg.updateMsgByTag(Attivita.this.getApFull(), "WISHLIST NOTIFICHE ", "Ricerca Utenti ....."); + ResParm rp = new ResParm(true); + StringBuilder msg = new StringBuilder(); + Wishlist wl = new Wishlist(Attivita.this.getApFull()); + try { + String subject = Attivita.this.getMailSubject(); + Users bean = new Users(Attivita.this.getApFull()); + Vectumerator vec = bean.findUsersWithWishlist(); + String urlBase = Attivita.this.getParm("P_WWW_ADDRESS").getTesto(); + NumberFormat nf = Attivita.this.getNf(); + int totUsers = 0; + if (vec.hasMoreElements()) { + MailProperties mp = new MailProperties(); + mp.setProperty("FROM", Attivita.this.getMailFrom()); + mp.setProperty("CC", Attivita.this.getMailFrom()); + while (vec.hasMoreElements()) { + Users currentUser = (Users)vec.nextElement(); + totUsers++; + StatusMsg.updateMsgByTag(Attivita.this.getApFull(), "WISHLIST NOTIFICHE ", "" + totUsers + " - " + totUsers + " ..."); + Vectumerator vecWl = wl.findByUser(currentUser.getId_users(), true); + String elencoArticoli = ""; + while (vecWl.hasMoreElements()) { + Wishlist currentWl = (Wishlist)vecWl.nextElement(); + if (currentWl.getFlgAbilitaAvviso() == 1L && ( + currentWl.getFlgPrezzoModificato() != 0L || currentWl.isDispoLevelModificata())) { + String imgSrc; + if (currentWl.getFlgPrezzoModificato() != 0L) + currentWl.setPrezzoUltimoAvviso(currentWl.getArticolo().getPrezzoPubblico(currentUser.getClifor())); + if (currentWl.isDispoLevelModificata()) + currentWl.setDispoLevelUltimoAvviso((long)currentWl.getArticolo().getDispoLevel()); + if (currentWl.getId_articolo() > 0L) { + imgSrc = ""; + } else { + imgSrc = ""; + } + elencoArticoli = elencoArticoli + " " + elencoArticoli + "" + currentWl.getArticolo().getCCLinkDettaglioCanonical(currentUser.getLang()) + " " + currentWl.getArticolo().getNome() + "€ " + Attivita.this.getDataFormat().format(currentWl.getDataWL()) + "€ " + nf.format(currentWl.getPrezzoWLIva()) + " " + currentWl.getDispoLevelUltimoAvviso() + "\n"; + currentWl.setTmstUltimoAvviso(DBAdapter.getTimestamp()); + currentWl.save(); + } + } + msg.append("Invio notifiche a " + currentUser.getCognomeNome()); + if (!elencoArticoli.isEmpty()) { + StatusMsg.updateMsgByTag(Attivita.this.getApFull(), "WISHLIST NOTIFICHE ", "" + totUsers + " - " + totUsers + " invio notifica ...."); + MailMessage mf = new MailMessage(Attivita.this.getApFull(), Attivita.this.getNotificheMailMessage(currentUser.getLang())); + mf.setQuestionMark(false); + mf.setString("nome", currentUser.getNome()); + mf.setString("cognome", currentUser.getCognome()); + mf.setDate("data", DBAdapter.getToday()); + mf.setString("elencoArticoli", elencoArticoli); + Attivita.this.sendMailStandardData(mf, currentUser.getLang(), null); + mp.setProperty("TO", bean.getEMail()); + mp.setProperty("SUBJECT", subject + " - " + subject + " " + + Attivita.this.translate("La Mia Wish List ", currentUser.getLang())); + mp.setProperty("ID_USERS", String.valueOf(currentUser.getId_users())); + msg.append("--> Trovati Articoli con prezzi cambiati\n"); + rp = mf.sendMailMessage(mp, true); + if (!rp.getStatus()) { + msg.append("Errore: " + rp.getMsg()); + msg.append("\n-------\n"); + } + continue; + } + StatusMsg.updateMsgByTag(Attivita.this.getApFull(), "WISHLIST NOTIFICHE ", "" + totUsers + " - " + totUsers + " nessun articolo trovato!"); + msg.append(" --> Nessun articolo trovato. Mail non inviata.\n"); + } + } + rp.setStatus(true); + rp.setMsg(msg.toString()); + } catch (Exception e) { + Attivita.this.handleDebug(e); + rp.setStatus(false); + rp.setMsg(e.toString() + "\n" + e.toString()); + } + return rp; + } + } + + public long getFlgQuotazione() { + return this.flgQuotazione; + } + + public void setFlgQuotazione(long flgQuotazione) { + this.flgQuotazione = flgQuotazione; + } + + public Attivita(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public static final Attivita getDefaultInstance(ApplParmFull ap) { + if (defaultInstance == null || defaultInstance.getId_attivita() == 0L || defaultInstance.getFlgDefault() == 0L) { + defaultInstance = new Attivita(ap); + defaultInstance.findDefault(); + } + return defaultInstance; + } + + public static final void resetDefaultInstance() { + defaultInstance = null; + } + + public static final String getGoogleMerchant(long l_flgGoogleUsaFtp) { + switch ((int)l_flgGoogleUsaFtp) { + case 1: + return "FTP"; + case 2: + return "SFTP"; + case 0: + return "NO"; + } + return ""; + } + + public static final String getTrovaprezzi(long l_flgTrovaprezzi) { + switch ((int)l_flgTrovaprezzi) { + case 0: + return "NO"; + case 1: + return "Tracking Su Ordine"; + case 2: + return "Tracking Su Acquisto"; + } + return ""; + } + + public static final String getIdealo(long l_flgIdealo) { + switch ((int)l_flgIdealo) { + case 0: + return "NO"; + case 1: + return "Si"; + } + return ""; + } + + public String getIdealo() { + return getIdealo(getFlgIdealo()); + } + + public double getDeliveryFreeAbove() { + return this.deliveryFreeAbove; + } + + public void setDeliveryFreeAbove(double deliveryFreeAbove) { + this.deliveryFreeAbove = deliveryFreeAbove; + } + + public String getGoogleMerchant() { + return getGoogleMerchant(getFlgGoogleMerchant()); + } + + public void setId_attivita(long newId_attivita) { + this.id_attivita = newId_attivita; + } + + public void setId_tipoAttivita(long newId_tipoAttivita) { + this.id_tipoAttivita = newId_tipoAttivita; + setTipoAttivita(null); + } + + public void setNomeAttivita(String newNomeAttivita) { + this.nomeAttivita = newNomeAttivita; + } + + public void setIndirizzoAttivita(String newIndirizzoAttivita) { + this.indirizzoAttivita = newIndirizzoAttivita; + } + + public void setNumeroCivicoAttivita(String newNumeroCivicoAttivita) { + this.numeroCivicoAttivita = newNumeroCivicoAttivita; + } + + public void setId_comuneAttivita(long newId_comune) { + this.id_comuneAttivita = newId_comune; + setComuneAttivita(null); + } + + public void setDescrizioneComuneAttivita(String newDescrizioneComuneAttivita) { + this.descrizioneComuneAttivita = newDescrizioneComuneAttivita; + } + + public void setDescrizioneProvinciaAttivita(String newDescrizioneProvinciaAttivita) { + this.descrizioneProvinciaAttivita = newDescrizioneProvinciaAttivita; + } + + public void setCapComuneAttivita(String newCapComuneAttivita) { + this.capComuneAttivita = newCapComuneAttivita; + } + + public void setFlgGusti(long newFlgGusti) { + this.flgGusti = newFlgGusti; + } + + public void setDataIscrizione(Date newDataIscrizione) { + this.dataIscrizione = newDataIscrizione; + } + + public void setCodiceAttivita(String newCodiceAttivita) { + this.codiceAttivita = newCodiceAttivita; + } + + public void setImgTmst(String newImgTmst) { + this.imgTmst = newImgTmst; + } + + public void setFlgMainSxCategorie(long newFglMainSxCategorie) { + this.flgMainSxCategorie = newFglMainSxCategorie; + } + + public void setFlgMainSxVetrinaBestseller(long newFlgMainSxVetrinaBestseller) { + this.flgMainSxVetrinaBestseller = newFlgMainSxVetrinaBestseller; + } + + public void setFlgMainSxVetrinaOfferte(long newFlgMainSxVetrinaOfferte) { + this.flgMainSxVetrinaOfferte = newFlgMainSxVetrinaOfferte; + } + + public void setFlgMainSxUltimiVisualizzati(long newFlgMainSxUltimiVisualizzati) { + this.flgMainSxUltimiVisualizzati = newFlgMainSxUltimiVisualizzati; + } + + public void setFlgMainBanner(long newFlgMainBanner) { + this.flgMainBanner = newFlgMainBanner; + } + + public void setFlgMainVetrina(long newFlgMainVetrina) { + this.flgMainVetrina = newFlgMainVetrina; + } + + public void setFlgMainVetrinaCategorie(long newFlgMainVetrinaCategorie) { + this.flgMainVetrinaCategorie = newFlgMainVetrinaCategorie; + } + + public void setFlgTopTelefono(long newFlgTopTelefono) { + this.flgTopTelefono = newFlgTopTelefono; + } + + public void setFlgTopLingue(long newFlgTopLingue) { + this.flgTopLingue = newFlgTopLingue; + } + + public void setFlgTopMail(long newFlgTopMail) { + this.flgTopMail = newFlgTopMail; + } + + public void setTopColoreHex(String newTopColoreHex) { + this.topColoreHex = newTopColoreHex; + } + + public void setFlgHeadCategorie(long newFlgHeadCategorie) { + this.flgHeadCategorie = newFlgHeadCategorie; + } + + public void setFlgHeadMarche(long newFlgHeadMarche) { + this.flgHeadMarche = newFlgHeadMarche; + } + + public void setFlgHeadNewsType(long newFlgHeadNewsType) { + this.flgHeadNewsType = newFlgHeadNewsType; + } + + public void setHeadColoreHex(String newHeadColoreHex) { + this.headColoreHex = newHeadColoreHex; + } + + public void setFlgDetailReviews(long newFlgDetailReviws) { + this.flgDetailReviews = newFlgDetailReviws; + } + + public void setFlgDetailRelatedProducts(long newFlgDetailRelatedProducts) { + this.flgDetailRelatedProducts = newFlgDetailRelatedProducts; + } + + public void setFlgDetailDxVetrinaBestseller(long newFlgDetailDxVetrinaBestseller) { + this.flgDetailDxVetrinaBestseller = newFlgDetailDxVetrinaBestseller; + } + + public void setFlgDetailDxVetrinaOfferte(long newFlgDetailDxVetrinaOfferte) { + this.flgDetailDxVetrinaOfferte = newFlgDetailDxVetrinaOfferte; + } + + public void setFlgCoupon(long newFlgCoupon) { + this.flgCoupon = newFlgCoupon; + } + + public void setFlgCheckoutGuest(long newFlgCheckoutGuest) { + this.flgCheckoutGuest = newFlgCheckoutGuest; + } + + public void setAccountFacebook(String newAccountFacebook) { + this.accountFacebook = newAccountFacebook; + } + + public void setAccountTwitter(String newAccountTwitter) { + this.accountTwitter = newAccountTwitter; + } + + public void setAccountInstagram(String newAccountInstagram) { + this.accountInstagram = newAccountInstagram; + } + + public void setFlgSocialSide(long newFlgSocialSide) { + this.flgSocialSide = newFlgSocialSide; + } + + public void setFlgFooterSocial(long newFlgFooterSocial) { + this.flgFooterSocial = newFlgFooterSocial; + } + + public long getId_attivita() { + return this.id_attivita; + } + + public long getId_tipoAttivita() { + return this.id_tipoAttivita; + } + + public String getNomeAttivita() { + return (this.nomeAttivita == null) ? "" : this.nomeAttivita.trim(); + } + + public String getMailFooter(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("mailFooter", l_lang); + } + + public String getIndirizzoAttivita() { + return (this.indirizzoAttivita == null) ? "" : this.indirizzoAttivita.trim(); + } + + public String getIndirizzoCompletoAttivita() { + StringBuilder sb = new StringBuilder(); + sb.append(getIndirizzoAttivita()); + sb.append(" "); + sb.append(getNumeroCivicoAttivita()); + sb.append(" "); + if (getCapZonaAttivita().isEmpty()) { + sb.append(getCapComuneAttivita()); + } else { + sb.append(getCapZonaAttivita()); + } + sb.append(" "); + sb.append(getDescrizioneComuneAttivita()); + sb.append(" ("); + sb.append(getDescrizioneProvinciaAttivita()); + sb.append(") "); + return sb.toString(); + } + + public String getIndirizzoCompletoSede() { + StringBuilder sb = new StringBuilder(); + sb.append(getIndirizzoSede()); + sb.append(" "); + sb.append(getNumeroCivicoSede()); + sb.append(" "); + if (getCapZonaSede().isEmpty()) { + sb.append(getCapComuneSede()); + } else { + sb.append(getCapZonaSede()); + } + sb.append(" "); + sb.append(getDescrizioneComuneSede()); + sb.append(" ("); + sb.append(getDescrizioneProvinciaSede()); + sb.append(") "); + return sb.toString(); + } + + public String getNumeroCivicoAttivita() { + return (this.numeroCivicoAttivita == null) ? "" : this.numeroCivicoAttivita.trim(); + } + + public long getId_comuneAttivita() { + return this.id_comuneAttivita; + } + + public String getDescrizioneComuneAttivita() { + return (this.descrizioneComuneAttivita == null) ? "" : this.descrizioneComuneAttivita.trim(); + } + + public String getDescrizioneProvinciaAttivita() { + return (this.descrizioneProvinciaAttivita == null) ? "" : this.descrizioneProvinciaAttivita.trim(); + } + + public String getCapComuneAttivita() { + return (this.capComuneAttivita == null) ? "" : this.capComuneAttivita.trim(); + } + + public long getFlgGusti() { + return this.flgGusti; + } + + public Date getDataIscrizione() { + return this.dataIscrizione; + } + + public String getCodiceAttivita() { + return (this.codiceAttivita == null) ? "" : this.codiceAttivita.trim(); + } + + public String getImgTmst() { + return (this.imgTmst == null) ? "" : this.imgTmst.trim(); + } + + public long getFlgMainSxCategorie() { + return this.flgMainSxCategorie; + } + + public long getFlgMainSxVetrinaBestseller() { + return this.flgMainSxVetrinaBestseller; + } + + public long getFlgMainSxVetrinaOfferte() { + return this.flgMainSxVetrinaOfferte; + } + + public long getFlgMainSxUltimiVisualizzati() { + return this.flgMainSxUltimiVisualizzati; + } + + public String getMainSxText(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("mainSxText", l_lang); + } + + public String getDeliveryConsegna(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("deliveryConsegna", l_lang); + } + + public boolean isDeliveryConsegna(String l_lang) { + if (getDeliveryConsegna(l_lang).isEmpty()) + return false; + return true; + } + + public String getFooterText(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("footerText", l_lang); + } + + public String getTripAdvisorScript(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("tripAdvisorScript", l_lang); + } + + public boolean isTripAdvisorScript(String l_lang) { + return !getTripAdvisorScript(l_lang).isEmpty(); + } + + public long getFlgMainBanner() { + return this.flgMainBanner; + } + + public long getFlgMainVetrina() { + return this.flgMainVetrina; + } + + public long getFlgMainVetrinaCategorie() { + return this.flgMainVetrinaCategorie; + } + + public long getFlgTopTelefono() { + return this.flgTopTelefono; + } + + public long getFlgTopLingue() { + return this.flgTopLingue; + } + + public long getFlgTopMail() { + return this.flgTopMail; + } + + public String getTopColoreHex() { + return (this.topColoreHex == null) ? "" : this.topColoreHex.trim(); + } + + public long getFlgHeadCategorie() { + return this.flgHeadCategorie; + } + + public long getFlgHeadMarche() { + return this.flgHeadMarche; + } + + public long getFlgHeadNewsType() { + return this.flgHeadNewsType; + } + + public String getHeadColoreHex() { + return (this.headColoreHex == null) ? "" : this.headColoreHex.trim(); + } + + public long getFlgDetailReviews() { + return this.flgDetailReviews; + } + + public long getFlgDetailRelatedProducts() { + return this.flgDetailRelatedProducts; + } + + public String getDetailDxText(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("detailDxText", l_lang); + } + + public String getDetailNonVisibileNoWeb(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("detailNonVisibileNoWeb", l_lang); + } + + public String getDetailNonVisibile(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("detailNonVisibile", l_lang); + } + + public String getDetailXsText(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("detailXsText", l_lang); + } + + public long getFlgDetailDxVetrinaBestseller() { + return this.flgDetailDxVetrinaBestseller; + } + + public long getFlgDetailDxVetrinaOfferte() { + return this.flgDetailDxVetrinaOfferte; + } + + public long getFlgCoupon() { + return this.flgCoupon; + } + + public long getFlgCheckoutGuest() { + return this.flgCheckoutGuest; + } + + public String getAccountFacebook() { + return (this.accountFacebook == null) ? "" : this.accountFacebook.trim(); + } + + public boolean isFacebook() { + return !getAccountFacebook().isEmpty(); + } + + public boolean isTwitter() { + return !getAccountTwitter().isEmpty(); + } + + public boolean isInstagram() { + return !getAccountInstagram().isEmpty(); + } + + public String getAccountTwitter() { + return (this.accountTwitter == null) ? "" : this.accountTwitter.trim(); + } + + public String getAccountInstagram() { + return (this.accountInstagram == null) ? "" : this.accountInstagram.trim(); + } + + public long getFlgSocialSide() { + return this.flgSocialSide; + } + + public long getFlgFooterSocial() { + return this.flgFooterSocial; + } + + public void setTipoAttivita(TipoAttivita newTipoAttivita) { + this.tipoAttivita = newTipoAttivita; + } + + public TipoAttivita getTipoAttivita() { + this.tipoAttivita = (TipoAttivita)getSecondaryObject(this.tipoAttivita, TipoAttivita.class, getId_tipoAttivita()); + return this.tipoAttivita; + } + + public void setComuneAttivita(Comune newComune) { + this.comuneAttivita = newComune; + } + + public Comune getComuneAttivita() { + this.comuneAttivita = (Comune)getSecondaryObject(this.comuneAttivita, Comune.class, getId_comuneAttivita()); + return this.comuneAttivita; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(AttivitaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ATTIVITA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public static final String getHeadNewsType(long l_flgHeadNewsType) { + switch ((int)l_flgHeadNewsType) { + case 2: + return "Grid"; + case 1: + return "Lista"; + case 0: + return "Nessuna"; + case -1: + return "Tutte"; + } + return "??"; + } + + public String getHeadNewsType() { + return getHeadNewsType(getFlgHeadNewsType()); + } + + public String getTopColorStyle() { + return ""; + } + + public String getCustomCssVars() { + String SEMICOLON = ";"; + StringBuilder sb = new StringBuilder(""); + return sb.toString(); + } + + public String getCapZonaAttivita() { + return (this.capZonaAttivita == null) ? "" : this.capZonaAttivita.trim(); + } + + public void setCapZonaAttivita(String capZonaAttivita) { + this.capZonaAttivita = capZonaAttivita; + } + + public long getFlgDefault() { + return this.flgDefault; + } + + public void setFlgDefault(long flgDefault) { + this.flgDefault = flgDefault; + } + + public void findDefault() { + String s_Sql_Find = "select A.* from ATTIVITA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.flgDefault=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public ResParm save() { + if (getFlgDefault() == 1L) + resetDefault(); + String titolarePrivacy = getNomeAttivita() + "
" + getNomeAttivita() + " " + getIndirizzoAttivita() + "
"; + if (getCapZonaAttivita().isEmpty()) { + titolarePrivacy = titolarePrivacy + titolarePrivacy; + } else { + titolarePrivacy = titolarePrivacy + titolarePrivacy; + } + titolarePrivacy = titolarePrivacy + " " + titolarePrivacy + " (" + getComuneAttivita().getDescrizione() + ")"; + setMailTitolarePrivacy(titolarePrivacy); + boolean refreshParm = false; + if (getPHEAD_DOC1().isEmpty()) { + String headDoc = getNomeAttivita() + "\n" + getNomeAttivita() + " n." + getIndirizzoAttivita() + "\n"; + if (getCapZonaAttivita().isEmpty()) { + headDoc = headDoc + headDoc + " "; + } else { + headDoc = headDoc + headDoc + " "; + } + headDoc = headDoc + headDoc + " (" + getDescrizioneComuneAttivita() + ")"; + setPHEAD_DOC1(headDoc); + } + if (getPHEAD_DOC2().isEmpty()) { + String headDoc = "\nP.Iva " + getPIva() + " CF " + getCodFisc() + "\nCCIAA: " + getCciaa() + "\nTel. " + getTelefonoAttivita() + " Fax: " + + getFaxAttivita(); + setPHEAD_DOC2(headDoc); + } + ResParm rp = saveSyncParm(refreshParm); + rp.append(super.save()); + return rp; + } + + private ResParm saveSyncParm(boolean refreshParm) { + ResParm rp = new ResParm(true); + if (!getParm("HEAD_DOC1").getTesto().equals(getPHEAD_DOC1())) { + Parm parm1 = getParm("HEAD_DOC1"); + parm1.setApFull(getApFull()); + parm1.setTesto(getPHEAD_DOC1()); + parm1.save(); + } + if (!getParm("HEAD_DOC2").getTesto().equals(getPHEAD_DOC2())) { + Parm parm1 = getParm("HEAD_DOC2"); + parm1.setApFull(getApFull()); + parm1.setTesto(getPHEAD_DOC2()); + parm1.save(); + } + if (!getParm("BCC").getTesto().equals(getPBCC())) { + Parm parm1 = getParm("BCC"); + parm1.setApFull(getApFull()); + parm1.setTesto(getPBCC()); + parm1.save(); + } + if (!getParm("CC").getTesto().equals(getPCC())) { + Parm parm1 = getParm("CC"); + parm1.setApFull(getApFull()); + parm1.setTesto(getPCC()); + parm1.save(); + } + if (!getParm("FROM").getTesto().equals(getPFROM())) { + Parm parm1 = getParm("FROM"); + parm1.setApFull(getApFull()); + parm1.setTesto(getPFROM()); + parm1.save(); + } + if (!getParm("SUBJECT").getTesto().equals(getPSUBJECT())) { + Parm parm1 = getParm("SUBJECT"); + parm1.setApFull(getApFull()); + parm1.setTesto(getPSUBJECT()); + parm1.save(); + } + if (!getParm("DOC_BCC").getTesto().equals(getPDOC_BCC())) { + Parm parm1 = getParm("DOC_BCC"); + parm1.setApFull(getApFull()); + parm1.setTesto(getPDOC_BCC()); + parm1.save(); + } + if (getParm("CC_ARROTONDA_PREZZO_A_EURO_SOPRA").getNumero() != getPCCArrotondaPrezzoAEuroSopra()) { + Parm parm1 = getParm("CC_ARROTONDA_PREZZO_A_EURO_SOPRA"); + parm1.setApFull(getApFull()); + parm1.setNumero(getPCCArrotondaPrezzoAEuroSopra()); + parm1.save(); + } + if (getParm("CC_RICARICO_MINIMO_OFFERTE").getNumero() != getPCCRicaricoMinimoOfferte()) { + Parm parm1 = getParm("CC_RICARICO_MINIMO_OFFERTE"); + parm1.setApFull(getApFull()); + parm1.setNumero(getPCCRicaricoMinimoOfferte()); + parm1.save(); + } + if (getParm("CC_ARROTONDA_DECIMALE_PER_PREZZI_BASSI").getNumero() != getPCCArrotondaDecimalePerPrezziBassi()) { + Parm parm1 = getParm("CC_ARROTONDA_DECIMALE_PER_PREZZI_BASSI"); + parm1.setApFull(getApFull()); + parm1.setNumero(getPCCArrotondaDecimalePerPrezziBassi()); + parm1.save(); + } + if (getParm("IVA_CEE_ONE_STOP_SHOP").getNumero() != (double)getFlgIvaOneStopShop()) { + Parm parm1 = getParm("IVA_CEE_ONE_STOP_SHOP"); + parm1.setApFull(getApFull()); + parm1.setNumero((double)getFlgIvaOneStopShop()); + parm1.save(); + } + if (getParm("IVA_ESTERO_AZIENDA_ESENTE").getNumero() != (double)getFlgIvaEsteroAziendeEsente()) { + Parm parm1 = getParm("IVA_ESTERO_AZIENDA_ESENTE"); + parm1.setApFull(getApFull()); + parm1.setNumero((double)getFlgIvaEsteroAziendeEsente()); + parm1.save(); + } + Parm parm = getParm("GOOGLE_USE_SFTP"); + parm.setApFull(getApFull()); + if (getFlgGoogleMerchant() == 2L) { + parm.setNumero(1.0D); + } else { + parm.setNumero(0.0D); + } + parm.save(); + refreshParm = true; + if (!getParm("GOOGLE_FTP_PASSWORD").getTesto().equals(getGoogleFtpPassword())) { + parm = getParm("GOOGLE_FTP_PASSWORD"); + parm.setApFull(getApFull()); + parm.setTesto(getGoogleFtpPassword()); + parm.save(); + refreshParm = true; + } + if (!getParm("GOOGLE_FTP_USER").getTesto().equals(getGoogleFtpUser())) { + parm = getParm("GOOGLE_FTP_USER"); + parm.setApFull(getApFull()); + parm.setTesto(getGoogleFtpUser()); + parm.save(); + refreshParm = true; + } + if (!getParm("GOOGLE_SIGNIN_CLIENT_ID").getTesto().equals(getPGoogleSigninClientId())) { + parm = getParm("GOOGLE_SIGNIN_CLIENT_ID"); + parm.setApFull(getApFull()); + parm.setTesto(getPGoogleSigninClientId()); + parm.save(); + refreshParm = true; + } + parm = getParm("GOOGLE_SIGNIN_ENABLE"); + if (getFlgGoogleSignin() == 1L) { + parm.setNumero(1.0D); + } else { + parm.setNumero(0.0D); + } + parm.setApFull(getApFull()); + parm.save(); + refreshParm = true; + if (!getParm("FACEBOOK_SIGNIN_CLIENT_ID").getTesto().equals(getPFacebookSigninClientId())) { + parm = getParm("FACEBOOK_SIGNIN_CLIENT_ID"); + parm.setApFull(getApFull()); + parm.setTesto(getPFacebookSigninClientId()); + parm.save(); + refreshParm = true; + } + if (!getParm("FACEBOOK_SIGNIN_SECRET_KEY").getTesto().equals(getPFacebookSigninSecretKey())) { + parm = getParm("FACEBOOK_SIGNIN_SECRET_KEY"); + parm.setApFull(getApFull()); + parm.setTesto(getPFacebookSigninSecretKey()); + parm.save(); + refreshParm = true; + } + parm = getParm("FACEBOOK_SIGNIN_ENABLE"); + parm.setApFull(getApFull()); + if (getFlgFacebookSignin() == 1L) { + parm.setNumero(1.0D); + } else { + parm.setNumero(0.0D); + } + parm.save(); + refreshParm = true; + if (getNomeAttivita().isEmpty()) + setNomeAttivita(getParm("LOGO_MENU").getTesto()); + if (!getParm("LOGO_MENU").getTesto().equals(getNomeAttivita())) { + parm = getParm("LOGO_MENU"); + parm.setApFull(getApFull()); + parm.setTesto(getNomeAttivita()); + parm.save(); + refreshParm = true; + } + if (!getParm("TITLE").getTesto().equals(getNomeAttivita())) { + parm = getParm("TITLE"); + parm.setApFull(getApFull()); + parm.setTesto(getNomeAttivita()); + parm.save(); + refreshParm = true; + } + if (getParm("SUBJECT").getTesto().isEmpty()) { + parm = getParm("SUBJECT"); + parm.setApFull(getApFull()); + parm.setTesto(getNomeAttivita()); + parm.save(); + refreshParm = true; + } + if (getParm("FROM").getTesto().isEmpty()) { + parm = getParm("FROM"); + parm.setApFull(getApFull()); + parm.setTesto(getEmailAttivita()); + parm.save(); + refreshParm = true; + } + String pathBaseImmagini = getDocBase() + getDocBase(); + File logoFile = new File(pathBaseImmagini + pathBaseImmagini); + if (logoFile.exists()) { + String currentLogoImg = getParm("LOGO_DOCS").getTesto(); + if (currentLogoImg.indexOf(getImgFileName(3)) < 0) { + parm = getParm("LOGO_DOCS"); + parm.setApFull(getApFull()); + parm.setTesto(getPathImg() + getPathImg()); + parm.save(); + refreshParm = true; + } + } + if (!getParm("PAYPAL_CHECKOUT_APPLICATION_CLIENT_ID").getTesto().equals(getPaypalClientId())) { + parm = getParm("PAYPAL_CHECKOUT_APPLICATION_CLIENT_ID"); + parm.setApFull(getApFull()); + parm.setTesto(getPaypalClientId()); + parm.save(); + refreshParm = true; + } + if (!getParm("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET").getTesto().equals(getPaypalClientSecret())) { + parm = getParm("PAYPAL_CHECKOUT_APPLICATION_CLIENT_SECRET"); + parm.setApFull(getApFull()); + parm.setTesto(getPaypalClientSecret()); + parm.save(); + refreshParm = true; + } + if (!getWwwAddress().isEmpty() && !getWwwAddress().equals(getWwwAddressParm())) { + parm = getParm("P_WWW_ADDRESS"); + parm.setApFull(getApFull()); + parm.setTesto(getWwwAddress()); + parm.save(); + parm = getParm("CODA_MESSAGGI_IMG_URL_BASE"); + parm.setTesto(getWwwAddress()); + parm.save(); + refreshParm = true; + } + if (getParm(Cart.P_PROCEDI_PAGAMENTO).getNumero() != (double)getFlgCartProcediPagamento()) { + parm = getParm(Cart.P_PROCEDI_PAGAMENTO); + parm.setApFull(getApFull()); + parm.setNumero((double)getFlgCartProcediPagamento()); + parm.save(); + refreshParm = true; + } + if (getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumero() != getDeliveryFreeAbove()) { + parm = getParm(Cart.P_DELIVERY_FREE_ABOVE); + parm.setApFull(getApFull()); + parm.setNumero(getDeliveryFreeAbove()); + parm.save(); + refreshParm = true; + } + if (getParm(Cart.P_DELIVERY_COST).getNumero() != getDeliveryCost()) { + parm = getParm(Cart.P_DELIVERY_COST); + parm.setApFull(getApFull()); + parm.setNumero(getDeliveryCost()); + parm.save(); + refreshParm = true; + } + if (getParm(Cart.P_DELIVERY_COST_PUDO).getNumero() != getDeliveryCostPudo()) { + parm = getParm(Cart.P_DELIVERY_COST_PUDO); + parm.setApFull(getApFull()); + parm.setNumero(getDeliveryCostPudo()); + parm.save(); + refreshParm = true; + } + if (getParm("CC_QTA_LOW").getNumero() != (double)getQtaDisponibilitaBassa()) { + parm = getParm("CC_QTA_LOW"); + parm.setApFull(getApFull()); + parm.setNumero((double)getQtaDisponibilitaBassa()); + parm.save(); + refreshParm = true; + } + if (getParm("CC_CHECK_AVAIL").getNumero() != (double)getFlgAcquistaSoloDisponibile()) { + parm = getParm("CC_CHECK_AVAIL"); + parm.setApFull(getApFull()); + parm.setNumero((double)getFlgAcquistaSoloDisponibile()); + parm.save(); + refreshParm = true; + } + if (getParm("GOOGLE_PREZZO_PUBBLICO_MINIMO_X_EXPORT").getNumero() != getPGooglePrezzoPubblicoMinimoXExport()) { + parm = getParm("GOOGLE_PREZZO_PUBBLICO_MINIMO_X_EXPORT"); + parm.setApFull(getApFull()); + parm.setNumero(getPGooglePrezzoPubblicoMinimoXExport()); + parm.save(); + refreshParm = true; + } + if (getParm("GOOGLE_QTA_MINIMA_X_EXPORT").getNumero() != (double)getPGoogleQtaMinimaXExport()) { + parm = getParm("GOOGLE_QTA_MINIMA_X_EXPORT"); + parm.setApFull(getApFull()); + parm.setNumero((double)getPGoogleQtaMinimaXExport()); + parm.save(); + refreshParm = true; + } + if (!getPStripePrivateKey().isEmpty() && !getPStripePrivateKey().equals(getParm("STRIPE_PRIVATE_KEY").getTesto())) { + parm = getParm("STRIPE_PRIVATE_KEY"); + parm.setApFull(getApFull()); + parm.setTesto(getPStripePrivateKey()); + parm.save(); + refreshParm = true; + } + if (!getPStripePublicKey().isEmpty() && !getPStripePublicKey().equals(getParm("STRIPE_PUBLIC_KEY").getTesto())) { + parm = getParm("STRIPE_PUBLIC_KEY"); + parm.setApFull(getApFull()); + parm.setTesto(getPStripePublicKey()); + parm.save(); + refreshParm = true; + } + if (!getPStripeReturnUrl().isEmpty() && !getPStripeReturnUrl().equals(getParm("STRIPE_RETURN_URL").getTesto())) { + parm = getParm("STRIPE_RETURN_URL"); + parm.setApFull(getApFull()); + parm.setTesto(getPStripeReturnUrl()); + parm.save(); + refreshParm = true; + } + parm = getParm("REWRITE_URL_LANG"); + parm.setApFull(getApFull()); + parm.setTesto(getTopLingueAttivita()); + parm.save(); + parm = getParm("NEWS_LANG_DEFAULT"); + parm.setApFull(getApFull()); + parm.setTesto("it"); + parm.save(); + parm = getParm("LANG_AVAILABLE"); + parm.setApFull(getApFull()); + parm.setTesto(getTopLingueAttivita()); + parm.save(); + refreshParm = true; + if (refreshParm) + getApFull().resetCurrentApParms(); + return rp; + } + + public String getLangDefault() { + return getParm("LANG_PRIMARY").getTesto(); + } + + public String getLangDisponibili() { + return getParm("LANG_AVAILABLE").getTesto(); + } + + public String getLangSeNonDisponibile() { + if (getFlgTopLingue() == 0L) + return "it"; + return "en"; + } + + protected ResParm resetDefault() { + String sql = "update ATTIVITA set flgDefault = null"; + return update(sql); + } + + public String getTelefonoAttivita() { + return (this.telefonoAttivita == null) ? "" : this.telefonoAttivita.trim(); + } + + public void setTelefonoAttivita(String telefonoAttivita) { + this.telefonoAttivita = telefonoAttivita; + } + + public String getEmailAttivita() { + return (this.emailAttivita == null) ? "" : this.emailAttivita.trim(); + } + + public boolean isHeadCategorie() { + if (getFlgHeadCategorie() == 0L) + return false; + return true; + } + + public boolean isMailChimp() { + if (getFlgNewsletterType() == 2L && !getMailchimpSubscribeForm().isEmpty()) + return true; + return false; + } + + public boolean isNewsletterInterna() { + return (getFlgNewsletterType() == 1L); + } + + public boolean isNewsletter() { + return !(getFlgNewsletterType() == 0L); + } + + public boolean isHeadMarche() { + if (getFlgHeadMarche() == 0L) + return false; + return true; + } + + public boolean isQuotazione() { + if (getFlgQuotazione() == 0L) + return false; + return true; + } + + public boolean isHeadNews() { + if (getFlgHeadNewsType() == 0L) + return false; + return true; + } + + public boolean isMainSxCategorie() { + return !(getFlgMainSxCategorie() == 0L); + } + + public boolean isMainSxVetrinaBestsellers() { + return (getFlgMainSxVetrinaBestseller() == 1L); + } + + public boolean isMainSxVetrinaOfferte() { + return (getFlgMainSxVetrinaOfferte() == 1L); + } + + public boolean isMainSxUltimiVisualizzati() { + return (getFlgMainSxUltimiVisualizzati() == 1L); + } + + public boolean isMainSxText(String l_lang) { + return !(getMainSxText(l_lang).isEmpty() || getMainSxTitle(l_lang).isEmpty()); + } + + public boolean isMainTestoCentrale(String l_lang) { + return !(getMainTestoCentrale(l_lang).isEmpty() || getMainTestoTitle(l_lang).isEmpty()); + } + + public boolean isDetailDxVetrinaBestseller() { + return (getFlgDetailDxVetrinaBestseller() == 1L); + } + + public boolean isCheckoutGuest() { + return (getFlgCheckoutGuest() == 1L); + } + + public boolean isCoupon() { + return (getFlgCoupon() == 1L); + } + + public boolean isDetailDxText(String l_lang) { + return !(getDetailDxText(l_lang).isEmpty() || getDetailDxTitle(l_lang).isEmpty()); + } + + public boolean isTelefonoAttivita() { + if (getFlgTopTelefono() == 0L || getTelefonoAttivita().isEmpty()) + return false; + return true; + } + + public boolean isTopChatWhatsapp() { + if (getFlgTopChatWhatsapp() == 0L || getCellulareAttivita().isEmpty()) + return false; + return true; + } + + public boolean isFooterChatWhatsapp() { + if (getFlgFooterChatWhatsapp() == 0L || getCellulareAttivita().isEmpty()) + return false; + return true; + } + + public boolean isTopChatTelegram() { + if (getFlgTopChatTelegram() == 0L || getChatTelegramUsername().isEmpty()) + return false; + return true; + } + + public boolean isFooterChatTelegram() { + if (getFlgFooterChatTelegram() == 0L || getChatTelegramUsername().isEmpty()) + return false; + return true; + } + + public boolean isDetailShareAddThis() { + return !(getFlgDetailShareAddThis() == 0L); + } + + public void setEmailAttivita(String emailAttivita) { + this.emailAttivita = emailAttivita; + setMailFrom(emailAttivita); + } + + public String getTopLingueAttivita() { + return (this.topLingueAttivita == null) ? "" : this.topLingueAttivita.trim(); + } + + public void setTopLingueAttivita(String topLingueAttivita) { + this.topLingueAttivita = topLingueAttivita; + } + + public Vectumerator findLangAttivita() { + Vectumerator vec = new Vectumerator(); + String lingue = getTopLingueAttivita(); + StringTokenizer st = new StringTokenizer(lingue, ","); + while (st.hasMoreTokens()) { + Lang lg = new Lang(); + lg.setLang(st.nextToken()); + vec.add(lg); + } + return vec; + } + + public String getImgFileName(int imgNumber) { + return getImgFileName(imgNumber, getImgTmst()); + } + + public String getImgLogo() { + return getPathImg() + getPathImg(); + } + + public String getImgLogoAdmin() { + if (new File(getDocBase() + getDocBase() + getPathImg()).exists()) + return getPathImg() + getPathImg(); + return "admin/_V4/_logo/logo.png"; + } + + public String getImgFavicon() { + String faviconDir = getDocBase() + getDocBase(); + DBAdapter.checkAndMakeDir(faviconDir); + String nomeFileIcoFull = faviconDir + faviconDir; + if (!new File(nomeFileIcoFull).exists()) + try { + ResParm rp = new ResParm(true); + String fileOrig = getDocBase() + getDocBase() + getPathImg(); + ScaleImage si = new ScaleImage(fileOrig, "32/", 0L, 32, 0, true, false); + rp = si.scaleIt(); + fileOrig = si.getTheScaledImageName(); + if (rp.getStatus()) { + BufferedImage bi = ImageIO.read(new File(fileOrig)); + DBAdapter.mkDirs(nomeFileIcoFull); + ICOEncoder.write(bi, new File(nomeFileIcoFull)); + } + } catch (Exception e) { + logDebug(true, e.getMessage()); + } + if (new File(getDocBase() + getDocBase() + getPathImg()).exists()) + return getPathImg() + getPathImg(); + return "admin/_V4/_logo/favicon.ico"; + } + + private String getNomeFileIco() { + return getImgTmst() + "_fi/favicon.ico"; + } + + private String getNomeFileIcoAdmin() { + return getImgTmst() + "_faviconAdmin.ico"; + } + + public String getImgFileName(int imgNumber, int scaledWidth) { + String targetDir = getDocBase() + getDocBase(); + String newImageName = "" + scaledWidth + "/" + scaledWidth; + String srcFileName = targetDir + targetDir; + String targetFileName = targetDir + targetDir; + ResParm rp = ScaleImage.scaleImageToFile(srcFileName, targetFileName, getPathTmpFull(), scaledWidth, 75); + if (rp.getStatus()) + return newImageName; + return getImgFileName(imgNumber, getImgTmst()); + } + + public String getImgFileName(int imgNumber, String l_Tmst) { + return "" + getId_attivita() + "_" + getId_attivita() + "_" + l_Tmst + ".jpg"; + } + + public String getImgFileName(long imgNumber) { + return getImgFileName((int)imgNumber); + } + + public boolean isEmailAttivita() { + if (getFlgTopMail() == 0L || getEmailAttivita().isEmpty()) + return false; + return true; + } + + public String getMailFrom() { + return (this.mailFrom == null) ? "" : this.mailFrom.trim(); + } + + public void setMailFrom(String mailFrom) { + this.mailFrom = mailFrom; + } + + public String getMailTitolarePrivacy() { + return (this.mailTitolarePrivacy == null) ? "" : this.mailTitolarePrivacy.trim(); + } + + public void setMailTitolarePrivacy(String mailTitolarePrivacy) { + this.mailTitolarePrivacy = mailTitolarePrivacy; + } + + public String getMailFooterCalcolato(String l_lang) { + if (getId_attivita() == 0L) + return ""; + String l_fileName = getDocBase() + "admin/cc/_template/mailFooter-" + getDocBase() + ".html"; + if (new File(l_fileName).exists()) { + MailMessage mf = new MailMessage(this.apFull, l_fileName); + mf.setString("ragioneSociale", getNomeAttivita()); + mf.setString("sedeLegale", getIndirizzoCompletoSede()); + mf.setString("cf", getCodFisc()); + mf.setString("telefono", getTelefonoAttivita()); + mf.setString("email", getEmailAttivita()); + mf.setString("pIva", getPIva()); + mf.setString("sdi", getCodiceIdentificativoFE()); + mf.setString("pec", getPec()); + return mf.getMessage(); + } + return ""; + } + + public String getMailTitle() { + return (this.mailTitle == null) ? "" : this.mailTitle.trim(); + } + + public void setMailTitle(String mailTitle) { + this.mailTitle = mailTitle; + } + + public long getFlgCartProcediPagamento() { + return this.flgCartProcediPagamento; + } + + public void setFlgCartProcediPagamento(long flgCartProcediPagamento) { + this.flgCartProcediPagamento = flgCartProcediPagamento; + } + + public long getId_vettore() { + return this.id_vettore; + } + + public void setId_vettore(long id_vettore) { + this.id_vettore = id_vettore; + setVettore(null); + } + + public Vettore getVettore() { + this.vettore = (Vettore)getSecondaryObject(this.vettore, Vettore.class, getId_vettore()); + return this.vettore; + } + + public void setVettore(Vettore vettore) { + this.vettore = vettore; + } + + public String getMailCoordinateBancarie() { + return (this.mailCoordinateBancarie == null) ? "" : this.mailCoordinateBancarie.trim(); + } + + public void setMailCoordinateBancarie(String mailCoordinateBancarie) { + this.mailCoordinateBancarie = mailCoordinateBancarie; + } + + public ResParm sendLostPasswordMailMessage(String lostEmail, String lang, HttpServletRequest req) { + ResParm rp = new ResParm(true); + try { + String subject = getMailSubject(); + Users bean = new Users(getApFull()); + UsersCR CR = new UsersCR(); + CR.setEMail(lostEmail); + bean.findUsersByEmail(lostEmail); + if (bean.getDBState() == 1) { + MailMessage mf = new MailMessage(getApFull(), getLostPwdMailMessage(lang)); + mf.setQuestionMark(false); + mf.setString("login", bean.getLogin()); + if (bean.isSocialAccount()) { + mf.setString("pwd", bean.getSocialIdType() + " social account"); + mf.setString("extra", + translate("Puoi accedere tramite il tuo account", lang) + " " + translate("Puoi accedere tramite il tuo account", lang) + ".
" + bean.getSocialIdType() + " " + + translate("Se non puoi più accedere al tuo account", lang) + ", " + bean.getSocialIdType()); + } else { + mf.setString("pwd", bean.getPwd()); + } + mf.setString("nominativo", bean.getNominativo()); + mf.setString("nome", bean.getNome()); + mf.setString("cognome", bean.getCognome()); + sendMailStandardData(mf, lang, req); + MailProperties mp = new MailProperties(); + mp.setProperty("FROM", getMailFrom()); + mp.setProperty("TO", bean.getEMail()); + if (!getMailBcc().isEmpty()) { + mp.put("BCC", getEmailAttivita() + "," + getEmailAttivita()); + } else { + mp.setProperty("BCC", getEmailAttivita()); + } + mp.setProperty("SUBJECT", mf.getMailSubject() + " - " + mf.getMailSubject()); + mp.setProperty("ID_USERS", String.valueOf(bean.getId_users())); + rp = mf.sendMailMessage(mp, true); + if (rp.getStatus()) + rp.setMsg(translate("La tua password e' stata inviata correttamente all'indirizzo", lang) + translate("La tua password e' stata inviata correttamente all'indirizzo", lang)); + } else { + rp.setStatus(false); + rp.setMsg(translate("Email non in archivio", lang)); + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e.toString() + "\n" + e.toString()); + } + return rp; + } + + public ResParm sendUserDataMailMessageCC(Users l_user, String lang, HttpServletRequest req) { + ResParm rp = new ResParm(true); + try { + if (getDBState() == 1) { + String userMailMessage = getUserMailMessage(lang); + if (l_user.isUseControCodeAccess() && !l_user.getControlCode().isEmpty()) + userMailMessage = userMailMessage.substring(0, userMailMessage.length() - 5) + "CC" + userMailMessage.substring(0, userMailMessage.length() - 5); + MailMessage mf = new MailMessage(getApFull(), userMailMessage); + mf.setQuestionMark(false); + if (!l_user.getControlCode().isEmpty()) + mf.setString("controlCode", l_user.getControlCode()); + mf.setString("nota", l_user.getNota()); + mf.setString("login", l_user.getLogin()); + mf.setString("pwd", l_user.getPwd()); + Clifor l_cliente = l_user.getClifor(); + mf.setString("nome", l_cliente.getNome()); + mf.setString("cognome", l_cliente.getCognome()); + mf.setString("cellulare", l_cliente.getCellulare()); + mf.setString("indirizzo", l_cliente.getIndirizzo()); + mf.setString("numero", l_cliente.getNumeroCivico()); + if (l_cliente.getCapZona().isEmpty()) { + mf.setString("cap", l_cliente.getCapComune()); + } else { + mf.setString("cap", l_cliente.getCapZona()); + } + mf.setString("citta", l_cliente.getDescrizioneComune()); + mf.setString("provincia", l_cliente.getProvinciaComune()); + mf.setString("codfisc", l_cliente.getCodFisc()); + mf.setString("codSDI", l_cliente.getCodiceIdentificativoFE()); + mf.setString("pec", l_cliente.getPec()); + mf.setString("piva", l_cliente.getPIva()); + mf.setString("email", l_cliente.getEMail()); + mf.setString("nazione", l_cliente.getNazione().getDescrizione(lang)); + DestinazioneDiversa l_dd = l_cliente.getCurrentDD(); + if (l_dd.getId_destinazioneDiversa() == 0L) { + mf.setString("indirizzoSped", l_cliente.getIndirizzo()); + mf.setString("numeroSped", l_cliente.getNumeroCivico()); + if (l_cliente.getCapZona().isEmpty()) { + mf.setString("capSped", l_cliente.getCapComune()); + } else { + mf.setString("capSped", l_cliente.getCapZona()); + } + mf.setString("cittaSped", l_cliente.getDescrizioneComune()); + mf.setString("provinciaSped", l_cliente.getProvinciaComune()); + mf.setString("nazioneSped", l_cliente.getNazione().getDescrizione(lang)); + } else { + if (l_dd.getPressoDD().isEmpty()) { + mf.setString("indirizzoSped", l_dd.getIndirizzoDD()); + } else { + mf.setString("indirizzoSped", " c/o " + l_dd.getPressoDD() + "
" + l_dd.getIndirizzoDD()); + } + mf.setString("numeroSped", l_dd.getNumeroCivicoDD()); + if (l_dd.getCapZonaDD().isEmpty()) { + mf.setString("capSped", l_dd.getCapComuneDD()); + } else { + mf.setString("capSped", l_dd.getCapZonaDD()); + } + mf.setString("cittaSped", l_dd.getDescrizioneComuneDD()); + mf.setString("provinciaSped", l_dd.getProvinciaComuneDD()); + mf.setString("nazioneSped", l_dd.getNazioneDD().getDescrizione(lang)); + } + sendMailStandardData(mf, lang, req); + mf.setString("titolarePrivacy", getMailTitolarePrivacy()); + MailProperties mp = new MailProperties(); + mp.setProperty("FROM", getMailFrom()); + mp.setProperty("TO", l_cliente.getEMail()); + if (!getMailBcc().isEmpty()) { + mp.put("BCC", getEmailAttivita() + "," + getEmailAttivita()); + } else { + mp.setProperty("BCC", getEmailAttivita()); + } + mp.setProperty("SUBJECT", + mf.getMailSubject() + " " + mf.getMailSubject()); + mp.setProperty("ID_USERS", String.valueOf(l_user.getId_users())); + rp = mf.sendMailMessage(mp, true); + } else { + rp.setStatus(false); + rp.setMsg(translate("Email non in archivio", lang)); + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e.getMessage()); + } + return rp; + } + + private void sendMailStandardData(MailMessage mf, String l_lang, HttpServletRequest req) { + sendMailStandardData(mf, l_lang, this, req); + } + + public static final void sendMailStandardData(MailMessage mf, String l_lang, Attivita bean, HttpServletRequest req) { + String l_wwwaddress = bean.getWwwAddress(); + mf.setString("wwwaddress", l_wwwaddress); + mf.setString("logo", l_wwwaddress + l_wwwaddress + bean.getPathImg()); + mf.setString("titolarePrivacy", bean.getMailTitolarePrivacy()); + mf.setString("footer", bean.getMailFooter(l_lang)); + mf.setString("mailContatto", bean.getEmailAttivita()); + mf.setString("firma", bean.getNomeAttivita()); + if (req != null) + mf.setString("ip", req.getRemoteHost() + " " + req.getRemoteHost()); + mf.setString("timestamp", new java.util.Date(System.currentTimeMillis()).toString()); + String social = "\"\""; + if (!bean.getAccountFacebook().isEmpty()) { + String s = social.replace("#", bean.getAccountFacebook()); + s = s.replace("@", "facebook"); + System.out.println(s); + mf.setString("socialFacebook", s); + } + if (!bean.getAccountTwitter().isEmpty()) { + String s = social.replace("#", bean.getAccountTwitter()); + s = s.replace("@", "twitter"); + mf.setString("socialTwitter", s); + } + if (!bean.getAccountInstagram().isEmpty()) { + String s = social.replace("#", bean.getAccountInstagram()); + s = s.replace("@", "instagram"); + mf.setString("socialInstagram", s); + } + if (bean.getTopColoreHex().isEmpty()) { + mf.setString("topColor", "#3e7cb4"); + } else { + mf.setString("topColor", bean.getTopColoreHex()); + } + if (bean.getTopFontColorHex().isEmpty()) { + mf.setString("topFontColor", "#fff"); + } else { + mf.setString("topFontColor", bean.getTopFontColorHex()); + } + } + + protected String getUserMailMessage(String lang) { + if (lang != null && lang.isEmpty()) + lang = "it"; + String temp = getDocBase() + getDocBase(); + if (lang != null && !lang.isEmpty()) { + int dot = temp.lastIndexOf("."); + if (dot > 0) + temp = temp.substring(0, dot) + "_" + temp.substring(0, dot) + lang.toLowerCase(); + } + return temp; + } + + protected String getLostPwdMailMessage(String lang) { + if (lang != null && lang.isEmpty()) + lang = "it"; + String temp = getDocBase() + getDocBase(); + if (lang != null && !lang.isEmpty()) { + int dot = temp.lastIndexOf("."); + if (dot > 0) + temp = temp.substring(0, dot) + "_" + temp.substring(0, dot) + lang.toLowerCase(); + } + return temp; + } + + public ResParm sendOrderMailMessageCC(Documento l_documento, Users l_user, String lang, boolean mailAdmin, boolean mailUser, boolean isPagamentoVariato, boolean isSpedito, HttpServletRequest req) { + lang = "it"; + ResParm rp = new ResParm(true); + if (l_documento.getId_tipoDocumento() != l_documento.getId_docOrdineWWW() || + l_documento.getTmstInvioMailOrdine() == null); + NumberFormat nf = getNf(); + String RIGA_RIEPILOGO = " \n ##desc##\n Eu ##prezzo##\n "; + String rigaRiepilogoAltreSpese = ""; + if (l_documento.getSpeseAltre() > 0.0D) { + rigaRiepilogoAltreSpese = " \n ##desc##\n Eu ##prezzo##\n ".replace("##desc##", translate(l_documento.getDescSpeseAltre(), lang)); + rigaRiepilogoAltreSpese = rigaRiepilogoAltreSpese.replace("##prezzo##", nf.format(l_documento.getSpeseAltre())); + } + String urlBase = getWwwAddress(); + MailProperties mp = new MailProperties(); + if (l_documento.getId_documento() == 0L) { + rp.setStatus(false); + rp.setMsg(translate("ERRORE! Codice Documento nullo! Contattare l'amministratore del sito", lang)); + handleDebug(rp.getMsg(), 0); + return rp; + } + try { + int ordineInverso = (l_documento.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Documento fattura = null; + if (isSpedito) + if (l_documento.isFatturaONotaDiCredito()) { + fattura = l_documento.getDocumentoFiglioUno(); + } else { + fattura = l_documento; + } + String subject = getMailSubject(); + String notePagamento = "", statoPagamento = ""; + String notaStato = " " + translate(l_documento.getStatoOrdineWww(), lang) + " "; + String linkOrdineDiretto = ""; + String orderLine = ""; + String orderLine2 = ""; + DoubleOperator totaleCosto = new DoubleOperator(); + double totaleQta = 0.0D; + statoPagamento = translate("Metodo di pagamento scelto ", lang) + ": " + translate("Metodo di pagamento scelto ", lang); + if (l_documento.getStatoPagato() >= 1L) + statoPagamento = statoPagamento + "
" + statoPagamento + translate("Transazione n. ", lang) + " " + l_documento.getDescTransaction() + " " + translate("del", lang); + if (l_user.isProfileNoReg()) { + linkOrdineDiretto = "
" + translate("Per accedere direttamente all'ordine: ", lang); + linkOrdineDiretto = linkOrdineDiretto + "" + l_documento.getLinkOrdineWwwNoReg(l_user) + ""; + } else { + linkOrdineDiretto = "
" + translate("Per accedere direttamente all'ordine: ", lang); + linkOrdineDiretto = linkOrdineDiretto + "" + l_documento.getLinkOrdineWww() + ""; + } + if (l_documento.getStatoPagato() == 0L) { + if (l_documento.getFlgProcediPagamento() == 1L) { + notePagamento = l_documento.getTipoPagamento().getMsgMailProcedi(lang); + if (l_documento.getTipoPagamento().getFlgTipoPagamento() != 5L); + notePagamento = notePagamento + notePagamento; + } else { + notePagamento = l_documento.getTipoPagamento().getMsgMailAspetta(lang); + } + } else { + notePagamento = ""; + } + if (l_documento.getFlgStatoOrdineWww() == 2L) + notaStato = translate(getParm("MSG_ORDINE_SPEDITO").getTesto(), lang); + if (mailUser || isPagamentoVariato) { + String temp; + String mmFile = l_documento.getCheckOutMailMessage(lang); + if (isSpedito) + mmFile = mmFile.replace(".html", "_spedito.html"); + MailMessage mf = new MailMessage(getApFull(), mmFile); + if (isSpedito) { + if (fattura.getDataSpedizione() == null) + fattura.setDataSpedizione(DBAdapter.getToday()); + mf.setString("dataSpedizione", getDataFormat().format(fattura.getDataSpedizione())); + mf.setString("corriere", fattura.getVettore().getDescrizione()); + mf.setString("nColli", String.valueOf(fattura.getNColli())); + String str = ""; + if (!l_documento.getNotaSpedizione().isEmpty()) + str = str + "

" + str; + mf.setString("notaContrassegno", str); + if (!fattura.getVettore().getLinkTracking().isEmpty() && !fattura.getTrackingSpedizione().isEmpty()) { + String id_docCrypt = crypt(String.valueOf(fattura.getId_documento())); + String link = fattura.getVettore().getLinkTracking() + fattura.getVettore().getLinkTracking(); + String track = translate("Potra' verificare la spedizione al seguente", lang) + " link "; + mf.setString("tracking", track); + } + } + mf.setQuestionMark(false); + mf.setLong("id_ordine", l_documento.getProgOrdineWww()); + mf.setString("stato", translate(l_documento.getStatoOrdineWww(), lang)); + mf.setString("dataOrdine", getDataFormat().format(l_documento.getDataDocumento())); + mf.setString("statoPagamento", statoPagamento); + mf.setString("notaPagamento", notePagamento); + mf.setLong("id_users", l_documento.getClifor().getId_clifor()); + mf.setString("nome", l_documento.getClifor().getNome()); + mf.setString("cognome", l_documento.getClifor().getCognome()); + mf.setString("indirizzo", l_documento.getClifor().getIndirizzo()); + mf.setString("numero", l_documento.getClifor().getNumeroCivico()); + if (l_documento.getClifor().getCapZona().isEmpty()) { + mf.setString("cap", l_documento.getClifor().getCapComune()); + } else { + mf.setString("cap", l_documento.getClifor().getCapZona()); + } + mf.setString("citta", l_documento.getClifor().getDescrizioneComune()); + mf.setString("provincia", l_documento.getClifor().getProvinciaComune()); + mf.setString("codfisc", l_documento.getClifor().getCodFisc()); + mf.setString("codSDI", l_documento.getClifor().getCodiceIdentificativoFE()); + mf.setString("pec", l_documento.getClifor().getPec()); + mf.setString("piva", l_documento.getClifor().getPIva()); + mf.setString("email", l_documento.getClifor().getEMail()); + mf.setString("nazione", l_documento.getClifor().getNazione().getDescrizione(lang)); + if (l_documento.getIndirizzoSped().trim().equals("")) { + if (l_documento.getPresso().isEmpty()) { + mf.setString("indirizzoSped", l_documento.getClifor().getIndirizzo()); + } else { + mf.setString("indirizzoSped", "c/o " + + l_documento.getPresso() + "
" + l_documento.getClifor().getIndirizzo()); + } + mf.setString("numeroSped", l_documento.getClifor().getNumeroCivico()); + if (l_documento.getClifor().getCapZona().isEmpty()) { + mf.setString("capSped", l_documento.getClifor().getCapComune()); + } else { + mf.setString("capSped", l_documento.getClifor().getCapZona()); + } + mf.setString("cittaSped", l_documento.getClifor().getDescrizioneComune()); + mf.setString("provinciaSped", l_documento.getClifor().getProvinciaComune()); + mf.setString("nazioneSped", l_documento.getClifor().getNazione().getDescrizione(lang)); + } else { + if (l_documento.getPresso().isEmpty()) { + mf.setString("indirizzoSped", l_documento.getIndirizzoSped()); + } else { + mf.setString("indirizzoSped", " c/o " + l_documento.getPresso() + "
" + l_documento.getIndirizzoSped()); + } + mf.setString("numeroSped", l_documento.getNumeroCivicoSped()); + mf.setString("capSped", l_documento.getCapSped()); + mf.setString("cittaSped", l_documento.getCittaSped()); + mf.setString("provinciaSped", l_documento.getProvinciaSped()); + mf.setString("nazioneSped", l_documento.getNazioneSped().getDescrizione(lang)); + } + Vectumerator enu = l_documento.findRigheDocumento(0, 0, ordineInverso); + while (enu.hasMoreElements()) { + String imgSrc; + RigaDocumento row = (RigaDocumento)enu.nextElement(); + if (row.getId_articolo() > 0L) { + imgSrc = ""; + } else { + imgSrc = ""; + } + orderLine = orderLine + " " + orderLine + imgSrc + "€ " + row.getDescrizioneRigaCompleta() + "" + nf.format(row.getImponibile()) + "" + row.getQuantita() + "€ " + ((row.getSconto() == 0.0D) ? "" : (nf.format(row.getSconto()) + " %")) + "\n"; + totaleQta += row.getQuantita(); + } + mf.setString("orderline", orderLine); + if (l_documento.getTotaleScontiAbbuoniConIva() > 0.0D) { + mf.setString("descSconto", "**** " + translate("SCONTO INCONDIZIONATO", lang) + " *****"); + mf.setString("scontoInc", " - " + nf.format(l_documento.getTotaleScontiAbbuoni())); + } + mf.setString("qta", nf.format(totaleQta)); + mf.setString("totale", nf.format(l_documento.getImponibileTotale())); + mf.setString("totaleOrdine", nf.format(l_documento.getTotaleDocumento())); + mf.setString("iva", nf.format(l_documento.getImportoIvaTotale())); + if (l_documento.isSpeseSpedizioneWwwPreventivo()) { + mf.setString("speseSped", " " + translate("da preventivare", lang)); + } else { + mf.setString("speseSped", nf.format(l_documento.getSpeseTrasporto())); + } + if (l_documento.getSpeseAltre() > 0.0D) + mf.setString("rigaRiepilogo1", rigaRiepilogoAltreSpese); + if (l_documento.getNotePagamento().isEmpty()) { + temp = l_documento.getNotaAggiuntiva(); + } else { + temp = "" + l_documento.getNotePagamento() + "
" + l_documento.getNotaAggiuntiva(); + } + if (!l_documento.getNotaMail().isEmpty()) + temp = temp + "
" + temp; + mf.setString("nota", temp); + mf.setLong("codiceOrdine", l_documento.getProgOrdineWww()); + mf.setString("telefono", l_documento.getClifor().getCellulare() + " " + l_documento.getClifor().getCellulare()); + mf.setString("linkOrdineDiretto", linkOrdineDiretto); + sendMailStandardData(mf, lang, req); + String theSubject = translate(subject, lang); + String l_email = l_documento.getClifor().getEMail(); + if (mailUser) { + theSubject = theSubject + " - " + theSubject + " " + translate("Ordine n.", lang) + " - " + l_documento.getProgOrdineWww(); + if (l_documento.getFlgPagata() == 1L) + theSubject = theSubject + " - " + theSubject + " " + translate("Pagato tramite ", lang); + } + if (isPagamentoVariato) { + theSubject = theSubject + theSubject + " " + translate("Ordine n.", lang) + " - " + l_documento.getProgOrdineWww() + " - "; + theSubject = theSubject + theSubject; + theSubject = theSubject + theSubject; + } + mp.put("TO", l_email); + if (!getMailBcc().isEmpty()) { + mp.put("BCC", getEmailAttivita() + "," + getEmailAttivita()); + } else { + mp.setProperty("BCC", getEmailAttivita()); + } + mp.setProperty("FROM", getMailFrom()); + if (l_documento.hasDocumentiFiglio()) { + Documento fatturaAll = l_documento.getDocumentoFiglioUno(); + if (fatturaAll.getId_documento() > 0L && fatturaAll.getFlgStato() != 0L) { + DocumentoCR CRf = new DocumentoCR(getApFull()); + CRf.setId_documentoS(fatturaAll.getId_documento()); + fatturaAll.creaDocumentoPdf(CRf, true); + mp.put("FILES", CRf.getFilePdf()); + } + } + mp.put("SUBJECT", theSubject); + mp.put("MSG", mf.getMessage()); + System.out.println(mf.getMessage()); + mp.setProperty("ISHTML", "true"); + rp = sendMailMessage(mp); + if (rp.getStatus() && isSpedito) { + fattura.setDataInvioMailSped(getToday()); + fattura.save(); + } + } + if (mailAdmin) { + String temp; + String mmfAdmMessage = l_documento.getCheckOutMailMessage("it"); + mmfAdmMessage = mmfAdmMessage.replace(".html", "_Adm.html"); + MailMessage mfAdm = new MailMessage(getApFull(), mmfAdmMessage); + mfAdm.setQuestionMark(false); + mfAdm.setLong("id_ordine", l_documento.getProgOrdineWww()); + mfAdm.setString("stato", l_documento.getStato()); + mfAdm.setString("dataOrdine", getDataFormat().format(l_documento.getDataDocumento())); + mfAdm.setString("statoPagamento", statoPagamento); + mfAdm.setString("notaPagamento", notePagamento); + mfAdm.setLong("id_users", l_documento.getClifor().getId_clifor()); + mfAdm.setLong("id_clifor", l_documento.getClifor().getId_clifor()); + mfAdm.setString("nominativo", l_documento.getClifor().getCognome()); + mfAdm.setString("nome", l_documento.getClifor().getNome()); + mfAdm.setString("cognome", l_documento.getClifor().getCognome()); + mfAdm.setString("indirizzo", l_documento.getClifor().getIndirizzo()); + mfAdm.setString("numero", l_documento.getClifor().getNumeroCivico()); + if (l_documento.getClifor().getCapZona().isEmpty()) { + mfAdm.setString("cap", l_documento.getClifor().getCapComune()); + } else { + mfAdm.setString("cap", l_documento.getClifor().getCapZona()); + } + mfAdm.setString("citta", l_documento.getClifor().getDescrizioneComune()); + mfAdm.setString("provincia", l_documento.getClifor().getProvinciaComune()); + mfAdm.setString("codfisc", l_documento.getClifor().getCodFisc()); + mfAdm.setString("codSDI", l_documento.getClifor().getCodiceIdentificativoFE()); + mfAdm.setString("pec", l_documento.getClifor().getPec()); + mfAdm.setString("piva", l_documento.getClifor().getPIva()); + mfAdm.setString("email", l_documento.getClifor().getEMail()); + if (l_documento.getIndirizzoSped().trim().equals("")) { + if (l_documento.getPresso().isEmpty()) { + mfAdm.setString("indirizzoSped", l_documento.getClifor().getIndirizzo()); + } else { + mfAdm.setString("indirizzoSped", "c/o " + + l_documento.getPresso() + "
" + l_documento.getClifor().getIndirizzo()); + } + mfAdm.setString("numeroSped", l_documento.getClifor().getNumeroCivico()); + if (l_documento.getClifor().getCapZona().isEmpty()) { + mfAdm.setString("capSped", l_documento.getClifor().getCapComune()); + } else { + mfAdm.setString("capSped", l_documento.getClifor().getCapZona()); + } + mfAdm.setString("cittaSped", l_documento.getClifor().getDescrizioneComune()); + mfAdm.setString("provinciaSped", l_documento.getClifor().getProvinciaComune()); + mfAdm.setString("nazioneSped", l_documento.getClifor().getNazione().getDescrizione(lang)); + } else { + if (l_documento.getPresso().isEmpty()) { + mfAdm.setString("indirizzoSped", l_documento.getIndirizzoSped()); + } else { + mfAdm.setString("indirizzoSped", "c/o " + l_documento.getPresso() + "
" + l_documento.getIndirizzoSped()); + } + mfAdm.setString("numeroSped", l_documento.getNumeroCivicoSped()); + mfAdm.setString("capSped", l_documento.getCapSped()); + mfAdm.setString("cittaSped", l_documento.getCittaSped()); + mfAdm.setString("provinciaSped", l_documento.getProvinciaSped()); + mfAdm.setString("nazioneSped", l_documento.getNazioneSped().getDescrizione(lang)); + } + orderLine2 = ""; + totaleCosto = new DoubleOperator(); + totaleQta = 0.0D; + String stileRicarico = ""; + Vectumerator enu = l_documento.findRigheDocumento(0, 0, ordineInverso); + while (enu.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)enu.nextElement(); + StringBuilder sbLinkAdmin = new StringBuilder(); + sbLinkAdmin.append("
"); + sbLinkAdmin.append(row.getArticolo().getCodice()); + sbLinkAdmin.append(""); + String fornitoreUltimoCosto = "
" + row.getArticolo().getFornitoreCostoNuovo().getCognomeNome(); + orderLine2 = orderLine2 + " " + orderLine2 + row.getCodiceArticolo() + "" + sbLinkAdmin.toString() + " " + row.getDescrizioneRigaCompleta() + "" + row.getArticolo().getCodiciAlternativi() + getNf0().format(row.getArticolo().getQuantita()) + "" + ((row.getArticolo().getFlgEbay() == 1L) ? " EBAY " : "") + nf.format(row.getArticolo().getCostoNetto()) + "" + fornitoreUltimoCosto + "" + row.getArticolo().getRicaricoEffettivoDaCostoNetto() + "" + nf.format(row.getImponibile()) + "" + getNf0().format(row.getQuantita()) + "" + ((row.getSconto() == 0.0D) ? "" : (nf.format(row.getSconto()) + " %")) + "\n"; + DoubleOperator totaleArticolo = new DoubleOperator(row.getImponibile()); + totaleArticolo.multiply(row.getQuantita()); + totaleCosto.add(totaleArticolo); + totaleQta += row.getQuantita(); + } + mfAdm.setString("orderline", orderLine2); + mfAdm.setString("qta", nf.format(totaleQta)); + mfAdm.setString("iva", nf.format(l_documento.getImportoIvaTotale())); + if (l_documento.isSpeseSpedizioneWwwPreventivo()) { + mfAdm.setString("speseSped", " " + translate("da preventivare", lang)); + } else { + mfAdm.setString("speseSped", nf.format(l_documento.getSpeseTrasporto())); + } + if (l_documento.getSpeseAltre() > 0.0D) + mfAdm.setString("rigaRiepilogo1", rigaRiepilogoAltreSpese); + mfAdm.setString("totale", nf.format(l_documento.getImponibileTotale())); + mfAdm.setString("totaleOrdine", nf.format(l_documento.getTotaleDocumento())); + if (l_documento.getNotePagamento().isEmpty()) { + temp = "Nota su Ordine: " + l_documento.getNotaAggiuntiva(); + } else { + temp = "Nota Pagamento: " + l_documento.getNotePagamento() + "
Nota su Ordine: " + l_documento.getNotaAggiuntiva(); + } + if (!l_documento.getNotaMail().isEmpty()) + temp = temp + "
Nota Mail: " + temp; + mfAdm.setString("nota", temp); + mfAdm.setString("notaAmm", "Nota su cliente: " + l_documento.getClifor().getNota()); + mfAdm.setLong("codiceOrdine", l_documento.getProgOrdineWww()); + mfAdm.setString("telefono", l_documento.getClifor().getCellulare() + " " + l_documento.getClifor().getCellulare()); + mfAdm.setString("orderline", orderLine2); + mfAdm.setString("notaStato", notaStato); + sendMailStandardData(mfAdm, lang, req); + String sbjAdmin = subject + " - Adm Ordine n. " + subject + " - " + String.valueOf(l_documento.getProgOrdineWww()) + " - " + + l_documento.getNominativoDocumento() + " - "; + if (isPagamentoVariato) + sbjAdmin = sbjAdmin + "PAGAMENTO VARIATO "; + if (l_documento.getFlgPagata() == 1L) { + sbjAdmin = sbjAdmin + sbjAdmin + " " + translate("Pagato tramite ", lang); + } else { + sbjAdmin = sbjAdmin + sbjAdmin; + } + mp = new MailProperties(); + mp.put("TO", getEmailAttivita()); + if (!getMailBcc().isEmpty()) + mp.put("BCC", getMailBcc()); + mp.setProperty("FROM", getMailFrom()); + mp.put("SUBJECT", sbjAdmin); + mp.put("MSG", mfAdm.getMessage()); + mp.setProperty("ISHTML", "true"); + rp.append(sendMailMessage(mp)); + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e); + System.out.println("sendOrderMailMessageCC ERRORE INVIO EMAIL:"); + e.printStackTrace(); + } + if (!rp.getStatus()) { + handleDebug(rp.getMsg(), 2); + System.out.println("sendOrderMailMessageCC ERRORE INVIO EMAIL:" + rp.getMsg()); + } else { + Timestamp tmst = getTimestamp(); + l_documento.setTmstInvioMailOrdine(tmst); + l_documento.superSave(); + } + return rp; + } + + public ResParm sendResoMailMessage() { + ResParm rp = new ResParm(true); + return rp; + } + + public ResParm sendMLMailMessage(Users l_user, String lang, HttpServletRequest req) { + ResParm rp = new ResParm(true); + try { + if (lang.equals("")) + lang = "it"; + MailMessage mf = new MailMessage(getApFull(), getDocBase() + getDocBase()); + mf.setQuestionMark(false); + String indirizzoWWW = getWwwAddressParm(); + if (!l_user.getControlCode().isEmpty()) { + String codiceConferma = "" + + translate("Clicca qui per attivare", l_user.getLangMl()) + " "; + mf.setString("codiceConferma", codiceConferma); + } + sendMailStandardData(mf, lang, req); + MailProperties mp = new MailProperties(); + mp.setProperty("FROM", getMailFrom()); + mp.setProperty("TO", l_user.getEMail()); + if (!getMailBcc().isEmpty()) { + mp.put("BCC", getEmailAttivita() + "," + getEmailAttivita()); + } else { + mp.setProperty("BCC", getEmailAttivita()); + } + mp.setProperty("SUBJECT", mf.getMailSubject() + " - " + mf.getMailSubject()); + rp = mf.sendMailMessage(mp, true); + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e.toString() + "\n" + e.toString()); + } + return rp; + } + + public String getWwwAddress() { + return (this.wwwAddress == null) ? "" : this.wwwAddress.trim(); + } + + public void setWwwAddress(String wwwAddress) { + this.wwwAddress = wwwAddress; + } + + public String getTopFontColorHex() { + return (this.topFontColorHex == null) ? "" : this.topFontColorHex; + } + + public void setTopFontColorHex(String topFontColor) { + this.topFontColorHex = topFontColor; + } + + public String getBackgroundColorHex() { + return (this.backgroundColorHex == null) ? "" : this.backgroundColorHex.trim(); + } + + public void setBackgroundColorHex(String backgroundColorHex) { + this.backgroundColorHex = backgroundColorHex; + } + + public String getBackgroundColorFooterHex() { + return (this.backgroundColorFooterHex == null) ? "" : this.backgroundColorFooterHex.trim(); + } + + public void setBackgroundColorFooterHex(String backgroundColorFooterHex) { + this.backgroundColorFooterHex = backgroundColorFooterHex; + } + + public String getBackgroundColorNavHoverHex() { + return (this.backgroundColorNavHoverHex == null) ? "" : this.backgroundColorNavHoverHex.trim(); + } + + public void setBackgroundColorNavHoverHex(String backgroundColorNavHoverHex) { + this.backgroundColorNavHoverHex = backgroundColorNavHoverHex; + } + + public String getBackgroundCustomFeatureBox() { + return (this.backgroundCustomFeatureBox == null) ? "" : this.backgroundCustomFeatureBox.trim(); + } + + public void setBackgroundCustomFeatureBox(String backgroundCustomFeatureBox) { + this.backgroundCustomFeatureBox = backgroundCustomFeatureBox; + } + + public String getHeadCategorieBorderColorHex() { + return (this.headCategorieBorderColorHex == null) ? "" : this.headCategorieBorderColorHex.trim(); + } + + public void setHeadCategorieBorderColorHex(String headCategorieBorderColorHex) { + this.headCategorieBorderColorHex = headCategorieBorderColorHex; + } + + public String getMainTextColorHex() { + return (this.mainTextColorHex == null) ? "" : this.mainTextColorHex.trim(); + } + + public void setMainTextColorHex(String mainTextColorHex) { + this.mainTextColorHex = mainTextColorHex; + } + + public String getLeftMenuTextColorHex() { + return (this.leftMenuTextColorHex == null) ? "" : this.leftMenuTextColorHex.trim(); + } + + public void setLeftMenuTextColorHex(String leftMenuTextColorHex) { + this.leftMenuTextColorHex = leftMenuTextColorHex; + } + + public String getLeftMenuSubTextColorHex() { + return (this.leftMenuSubTextColorHex == null) ? "" : this.leftMenuSubTextColorHex.trim(); + } + + public void setLeftMenuSubTextColorHex(String leftMenuSubTextColorHex) { + this.leftMenuSubTextColorHex = leftMenuSubTextColorHex; + } + + public String getSubtitleHex() { + return (this.subtitleHex == null) ? "" : this.subtitleHex.trim(); + } + + public void setSubtitleHex(String subtitleHex) { + this.subtitleHex = subtitleHex; + } + + public String getBodyBackgroundHex() { + return (this.bodyBackgroundHex == null) ? "" : this.bodyBackgroundHex.trim(); + } + + public void setBodyBackgroundHex(String bodyBackgroundHex) { + this.bodyBackgroundHex = bodyBackgroundHex; + } + + public String getFooterTextH5Hex() { + return (this.footerTextH5Hex == null) ? "" : this.footerTextH5Hex.trim(); + } + + public void setFooterTextH5Hex(String footerTextH5Hex) { + this.footerTextH5Hex = footerTextH5Hex; + } + + public String getFooterTextliHex() { + return (this.footerTextliHex == null) ? "" : this.footerTextliHex.trim(); + } + + public void setFooterTextliHex(String footerTextliHex) { + this.footerTextliHex = footerTextliHex; + } + + public String getFooterTextliAHex() { + return (this.footerTextliAHex == null) ? "" : this.footerTextliAHex.trim(); + } + + public void setFooterTextliAHex(String footerTextliAHex) { + this.footerTextliAHex = footerTextliAHex; + } + + public String getPaypalClientId() { + return (this.paypalClientId == null) ? "" : this.paypalClientId.trim(); + } + + public void setPaypalClientId(String paypalApiPwd) { + this.paypalClientId = paypalApiPwd; + } + + public String getPaypalClientSecret() { + return (this.paypalClientSecret == null) ? "" : this.paypalClientSecret.trim(); + } + + public void setPaypalClientSecret(String paypalApiSignature) { + this.paypalClientSecret = paypalApiSignature; + } + + public double getCostoContrassegno() { + return this.costoContrassegno; + } + + public void setCostoContrassegno(double costoContrassegno) { + this.costoContrassegno = costoContrassegno; + } + + public String getMainSxTitle(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("mainSxTitle", l_lang); + } + + public String getCartTitle(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("cartTitle", l_lang); + } + + public String getCartText(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("cartText", l_lang); + } + + public String getPrivacy(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("privacy", l_lang); + } + + public String getTermConditions(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("termConditions", l_lang); + } + + public boolean isSocial(String l_lang) { + return (isFacebook() || isTwitter() || isInstagram() || isTripAdvisorScript(l_lang)); + } + + public String getReturnConditions(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("returnConditions", l_lang); + } + + public String getDetailDxTitle(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("detailDxTitle", l_lang); + } + + public String getDetailXsTitle(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("detailXsTitle", l_lang); + } + + public String getCookiePolicyText(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("cookiePolicyText", l_lang); + } + + public String getCheckCartText(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("checkCartText", l_lang); + } + + public boolean isCartText(String l_lang) { + return !(getCartText(l_lang).isEmpty() || getCartTitle(l_lang).isEmpty()); + } + + public boolean useDescLangTables() { + return true; + } + + public long getFlgNewsletterType() { + return this.flgNewsletterType; + } + + public void setFlgNewsletterType(long flgNewsletterType) { + this.flgNewsletterType = flgNewsletterType; + } + + public String getMailchimpSubscribeForm() { + return (this.mailchimpSubscribeForm == null) ? "" : this.mailchimpSubscribeForm.trim(); + } + + public void setMailchimpSubscribeForm(String mailchimpSubscribeForm) { + this.mailchimpSubscribeForm = mailchimpSubscribeForm; + } + + public String getTagManagerHead() { + return (this.tagManagerHead == null) ? "" : this.tagManagerHead.trim(); + } + + public void setTagManagerHead(String tagManagerHead) { + this.tagManagerHead = tagManagerHead; + } + + public String getTagManagerBody() { + return (this.tagManagerBody == null) ? "" : this.tagManagerBody.trim(); + } + + public void setTagManagerBody(String tagManagerBody) { + this.tagManagerBody = tagManagerBody; + } + + public static final String getNewsletterType(long l_flgNewsletterType) { + switch ((int)l_flgNewsletterType) { + case 0: + return "Nessuna"; + case 2: + return "Mailchimp"; + case 1: + return "Interna"; + } + return "??"; + } + + public String getNewsletterType() { + return getNewsletterType(getFlgNewsletterType()); + } + + public long getFlgDetailCompara() { + return this.flgDetailCompara; + } + + public void setFlgDetailCompara(long flgDetailCompara) { + this.flgDetailCompara = flgDetailCompara; + } + + public long getFlgDetailWishlist() { + return this.flgDetailWishlist; + } + + public void setFlgDetailWishlist(long flgDetailWishlist) { + this.flgDetailWishlist = flgDetailWishlist; + } + + public long getFlgDetailShareAddThis() { + return this.flgDetailShareAddThis; + } + + public void setFlgDetailShareAddThis(long flgDetailShareAddThis) { + this.flgDetailShareAddThis = flgDetailShareAddThis; + } + + public boolean isDetailWishlist() { + return !(getFlgDetailWishlist() == 0L); + } + + public boolean isLingueAttive() { + if (getFlgTopLingue() == 0L || getTopLingueAttivita().isEmpty()) + return false; + return true; + } + + public boolean isDetailReviews() { + return (getFlgDetailReviews() == 0L) ? false : false; + } + + public boolean isMainBanner() { + return !(getFlgMainBanner() == 0L); + } + + public boolean isMainUltimi() { + return (getFlgMainUltimi() == 1L && getMainUltimiNum() > 0L); + } + + public boolean isMainUltimaNews() { + return !(getFlgMainUltimaNews() == 0L); + } + + public boolean isMainVetrina() { + return !(getFlgMainVetrina() == 0L); + } + + public boolean isMainVetrinaCategorie() { + return !(getFlgMainVetrinaCategorie() == 0L); + } + + public boolean isMainMiniBanner() { + return !(getFlgMainMiniBanner() == 0L); + } + + public boolean isDetailRelatedProducts() { + return !(getFlgDetailRelatedProducts() == 0L); + } + + public boolean isDetailCompara() { + return !(getFlgDetailCompara() == 0L); + } + + public boolean isDetailDxVetrinaOfferte() { + return (getFlgDetailDxVetrinaOfferte() == 1L); + } + + public long getFlgMainMiniBanner() { + return this.flgMainMiniBanner; + } + + public void setFlgMainMiniBanner(long flgMainMiniBanner) { + this.flgMainMiniBanner = flgMainMiniBanner; + } + + public String getIndirizzoCompletoAttivitaHtml() { + StringBuilder sb = new StringBuilder(); + sb.append(getIndirizzoAttivita()); + sb.append(" "); + sb.append(getNumeroCivicoAttivita()); + sb.append("
"); + if (getCapZonaAttivita().isEmpty()) { + sb.append(getCapComuneAttivita()); + } else { + sb.append(getCapZonaAttivita()); + } + sb.append(" "); + sb.append(getDescrizioneComuneAttivita()); + sb.append(" ("); + sb.append(getDescrizioneProvinciaAttivita()); + sb.append(")
"); + return sb.toString(); + } + + public String getMainSubtitleBottomBorderHex() { + return (this.mainSubtitleBottomBorderHex == null) ? "" : this.mainSubtitleBottomBorderHex.trim(); + } + + public void setMainSubtitleBottomBorderHex(String mainSubtitleBottomBorderHex) { + this.mainSubtitleBottomBorderHex = mainSubtitleBottomBorderHex; + } + + public boolean isNOSocialNOnewsletter(String l_lang) { + return (!isSocial(l_lang) && getFlgNewsletterType() == 0L); + } + + public String getIndirizzoSede() { + return (this.indirizzoSede == null) ? "" : this.indirizzoSede.trim(); + } + + public void setIndirizzoSede(String indirizzoSede) { + this.indirizzoSede = indirizzoSede; + } + + public String getNumeroCivicoSede() { + return (this.numeroCivicoSede == null) ? "" : this.numeroCivicoSede.trim(); + } + + public void setNumeroCivicoSede(String numeroCivicoSede) { + this.numeroCivicoSede = numeroCivicoSede; + } + + public long getId_comuneSede() { + return this.id_comuneSede; + } + + public void setId_comuneSede(long id_comuneSede) { + this.id_comuneSede = id_comuneSede; + setComuneSede(null); + } + + public String getDescrizioneComuneSede() { + return (this.descrizioneComuneSede == null) ? "" : this.descrizioneComuneSede.trim(); + } + + public void setDescrizioneComuneSede(String descrizioneComuneSede) { + this.descrizioneComuneSede = descrizioneComuneSede; + } + + public String getDescrizioneProvinciaSede() { + return (this.descrizioneProvinciaSede == null) ? "" : this.descrizioneProvinciaSede.trim(); + } + + public void setDescrizioneProvinciaSede(String descrizioneProvinciaSede) { + this.descrizioneProvinciaSede = descrizioneProvinciaSede; + } + + public String getCapComuneSede() { + return (this.capComuneSede == null) ? "" : this.capComuneSede.trim(); + } + + public void setCapComuneSede(String capComuneSede) { + this.capComuneSede = capComuneSede; + } + + public Comune getComuneSede() { + this.comuneSede = (Comune)getSecondaryObject(this.comuneSede, Comune.class, getId_comuneSede()); + return this.comuneSede; + } + + public void setComuneSede(Comune comuneSede) { + this.comuneSede = comuneSede; + } + + public String getCapZonaSede() { + return (this.capZonaSede == null) ? "" : this.capZonaSede.trim(); + } + + public void setCapZonaSede(String capZonaSede) { + this.capZonaSede = capZonaSede; + } + + public String getTelefonoSede() { + return (this.telefonoSede == null) ? "" : this.telefonoSede.trim(); + } + + public void setTelefonoSede(String telefonoSede) { + this.telefonoSede = telefonoSede; + } + + public String getCodFisc() { + return (this.codFisc == null) ? "" : this.codFisc.trim(); + } + + public void setCodFisc(String codFisc) { + this.codFisc = codFisc; + } + + public String getPIva() { + return (this.pIva == null) ? "" : this.pIva.trim(); + } + + public void setPIva(String pIva) { + this.pIva = pIva; + } + + public String getPec() { + return (this.pec == null) ? "" : this.pec.trim(); + } + + public void setPec(String pec) { + this.pec = pec; + } + + public String getCodiceIdentificativoFE() { + return (this.codiceIdentificativoFE == null) ? "" : this.codiceIdentificativoFE.trim().toUpperCase(); + } + + public void setCodiceIdentificativoFE(String codiceIdentificativoFE) { + this.codiceIdentificativoFE = codiceIdentificativoFE; + } + + public String getContatto() { + return (this.contatto == null) ? "" : this.contatto.trim(); + } + + public void setContatto(String contatto) { + this.contatto = contatto; + } + + public boolean isTagManagerAttivo() { + if (getTagManagerBody().isEmpty() || getTagManagerHead().isEmpty()) + return false; + return true; + } + + public long getQtaDisponibilitaBassa() { + return this.qtaDisponibilitaBassa; + } + + public void setQtaDisponibilitaBassa(long qtaDisponibilitaBassa) { + this.qtaDisponibilitaBassa = qtaDisponibilitaBassa; + } + + public long getFlgAcquistaSoloDisponibile() { + return this.flgAcquistaSoloDisponibile; + } + + public void setFlgAcquistaSoloDisponibile(long flgAcquistaSoloDisponibile) { + this.flgAcquistaSoloDisponibile = flgAcquistaSoloDisponibile; + } + + protected void initFields() { + super.initFields(); + setQtaDisponibilitaBassa(5L); + setPHEAD_DOC1(null); + setPHEAD_DOC2(null); + setPBCC(null); + setPCC(null); + setPDOC_BCC(null); + setPFROM(null); + setPSUBJECT(null); + setPCCArrotondaDecimalePerPrezziBassi(0.0D); + setPCCArrotondaPrezzoAEuroSopra(0.0D); + setPCCRicaricoMinimoOfferte(0.0D); + setPGooglePrezzoPubblicoMinimoXExport(0.0D); + setPGoogleQtaMinimaXExport(0L); + setPStripePrivateKey(null); + setPStripePublicKey(null); + setPStripeReturnUrl(null); + } + + public String getGoogleFtpUser() { + return (this.googleFtpUser == null) ? "" : this.googleFtpUser; + } + + public void setGoogleFtpUser(String googleFtpUser) { + this.googleFtpUser = googleFtpUser; + } + + public String getGoogleFtpPassword() { + return (this.googleFtpPassword == null) ? "" : this.googleFtpPassword.trim(); + } + + public void setGoogleFtpPassword(String googleFtpPassword) { + this.googleFtpPassword = googleFtpPassword; + } + + public String getGoogleNomiFileFeed() { + return (this.googleNomiFileFeed == null) ? "" : this.googleNomiFileFeed; + } + + public Vectumerator findGoogleNomiFileFeed() { + Vectumerator res = new Vectumerator(); + StringTokenizer st = new StringTokenizer(getGoogleNomiFileFeed(), ","); + while (st.hasMoreTokens()) { + StringAdapter row = new StringAdapter(); + row.setDescrizione(st.nextToken()); + res.add(row); + } + return res; + } + + public void setGoogleNomiFileFeed(String googleNomiFileFeed) { + this.googleNomiFileFeed = googleNomiFileFeed; + } + + public long getFlgGoogleMerchant() { + return this.flgGoogleMerchant; + } + + public void setFlgGoogleMerchant(long flgGoogleMerchant) { + this.flgGoogleMerchant = flgGoogleMerchant; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + super.prepareSave(ps); + } + + public boolean isEbay() { + if (getFlgEbay() <= 0L) + return false; + return true; + } + + public boolean isPaypalRateDettaglio() { + if (getFlgPaypalRate() == 0L || getPaypalRateScriptHead().isEmpty() || getPaypalRateScriptBodyDett().isEmpty()) + return false; + return true; + } + + public boolean isPaypalRatePagine() { + if (getFlgPaypalRate() == 0L || getPaypalRateScriptHead().isEmpty() || getPaypalRateScriptBodyCat().isEmpty()) + return false; + return true; + } + + public boolean isPaypalRate() { + if (getFlgPaypalRate() == 0L || (getPaypalRateScriptHead().isEmpty() && getPaypalRateScriptBodyCat().isEmpty())) + return false; + return true; + } + + public String getDirittoDiRecesso(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("dirittoDiRecesso", l_lang); + } + + public boolean isSpedizioneGratis() { + return (getDeliveryFreeAbove() == 0.0D); + } + + public boolean isSpedizioneGratisOltre() { + return (getDeliveryFreeAbove() > 0.0D); + } + + protected String getNotificheMailMessage(String lang) { + if (lang != null && lang.isEmpty()) + lang = "it"; + String temp = getDocBase() + getDocBase(); + if (lang != null && !lang.isEmpty()) { + int dot = temp.lastIndexOf("."); + if (dot > 0) + temp = temp.substring(0, dot) + "_" + temp.substring(0, dot) + lang.toLowerCase(); + } + return temp; + } + + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab NOTIFICHE WISHLIST (" + + DBAdapter.getNow().toString() + ")\n#################"); + long t0 = System.currentTimeMillis(); + Attivita attivita = getDefaultInstance(ap); + rp = attivita.startThreadNotifiche(); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab NOTIFICHE WISHLIST (" + DBAdapter.getNow().toString() + ")\n#################"); + long tn = System.currentTimeMillis(); + long duration = (tn - t0) / 60000L; + msg.append("Durata: " + duration + " minuti.\n"); + rp.setMsg(msg.toString()); + return rp; + } + + public long getFlgTopChatWhatsapp() { + return this.flgTopChatWhatsapp; + } + + public void setFlgTopChatWhatsapp(long flgTopChatWhatsapp) { + this.flgTopChatWhatsapp = flgTopChatWhatsapp; + } + + public long getFlgTopChatTelegram() { + return this.flgTopChatTelegram; + } + + public void setFlgTopChatTelegram(long flgTopChatTelegram) { + this.flgTopChatTelegram = flgTopChatTelegram; + } + + public long getFlgFooterChatWhatsapp() { + return this.flgFooterChatWhatsapp; + } + + public void setFlgFooterChatWhatsapp(long flgFooterChatWhatsapp) { + this.flgFooterChatWhatsapp = flgFooterChatWhatsapp; + } + + public long getFlgFooterChatTelegram() { + return this.flgFooterChatTelegram; + } + + public void setFlgFooterChatTelegram(long flgFooterChatTelegram) { + this.flgFooterChatTelegram = flgFooterChatTelegram; + } + + public long getFlgSubito() { + return this.flgSubito; + } + + public void setFlgSubito(long flgSubito) { + this.flgSubito = flgSubito; + } + + public String getCellulareAttivita() { + return (this.cellulareAttivita == null) ? "" : this.cellulareAttivita.trim(); + } + + public void setCellulareAttivita(String cellulareAttivita) { + this.cellulareAttivita = cellulareAttivita; + } + + public String getChatTelegramUsername() { + return (this.chatTelegramUsername == null) ? "" : this.chatTelegramUsername.trim(); + } + + public void setChatTelegramUsername(String chatTelegramUsername) { + this.chatTelegramUsername = chatTelegramUsername; + } + + public final ResParm startThreadNotifiche() { + if (!isThreadAttivo()) { + new ThreadNotificheWL(); + return new ResParm(true, "Thread Invio Notifiche Wishlist avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public static boolean isThreadAttivo() { + return threadWL; + } + + public long getMainUltimiNum() { + return this.mainUltimiNum; + } + + public long getMainUltimiFetch() { + return getMainUltimiNum() * 4L; + } + + public void setMainUltimiNum(long mainUltimiNum) { + this.mainUltimiNum = mainUltimiNum; + } + + public long getFlgMainUltimi() { + return this.flgMainUltimi; + } + + public void setFlgMainUltimi(long flgMainUltimi) { + this.flgMainUltimi = flgMainUltimi; + } + + public long getFlgMainUltimaNews() { + return this.flgMainUltimaNews; + } + + public void setFlgMainUltimaNews(long flgMainUltimaNews) { + this.flgMainUltimaNews = flgMainUltimaNews; + } + + public String getMainTestoCentrale(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("mainTestoCentrale", l_lang); + } + + public String getMainTestoTitle(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("mainTestoTitle", l_lang); + } + + public String getMainTagDesc(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("mainTagDesc", l_lang); + } + + public String getMainTagH1(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("mainTagH1", l_lang); + } + + public String getMainTagH2(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("mainTagH2", l_lang); + } + + public String getMainTagTitle(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("mainTagTitle", l_lang); + } + + public String getMainTagKeyword(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("mainTagKeyword", l_lang); + } + + public double getDeliveryCost() { + return this.deliveryCost; + } + + public void setDeliveryCost(double deliveryCost) { + this.deliveryCost = deliveryCost; + } + + public String getRecaptchaV2Key() { + return (this.recaptchaV2Key == null) ? "" : this.recaptchaV2Key.trim(); + } + + public boolean isRecaptcha() { + return !getRecaptchaV2Key().isEmpty(); + } + + public void setRecaptchaV2Key(String recaptchaV2Key) { + this.recaptchaV2Key = recaptchaV2Key; + } + + public boolean isGoogleMerchant() { + if (getFlgGoogleMerchant() <= 0L || getGoogleFtpPassword().isEmpty() || getGoogleFtpUser().isEmpty()) + return false; + return true; + } + + public boolean isTrovaprezziOrdine() { + if (getTrovaprezziTrustedProgramScript().isEmpty() || getFlgTrovaprezzi() != 1L) + return false; + return true; + } + + public boolean isTrovaprezziAcquisto() { + if (getTrovaprezziTrustedProgramScript().isEmpty() || getFlgTrovaprezzi() != 2L) + return false; + return true; + } + + public boolean isGoogleMerchantRecensioni() { + if (isGoogleMerchant() && getFlgGoogleMerchantRecensioni() == 1L && !getGoogleMerchantRecensioniScript().isEmpty()) + return true; + return false; + } + + public boolean isGoogleMerchantRecensioniBadge() { + if (isGoogleMerchant() && getFlgGoogleMerchantRecensioniBadge() == 1L && !getGoogleMerchantRecensioniScript().isEmpty()) + return true; + return false; + } + + public boolean isSubito() { + if (getFlgSubito() <= 0L) + return false; + return true; + } + + public long getFlgEbay() { + return this.flgEbay; + } + + public void setFlgEbay(long flgEbay) { + this.flgEbay = flgEbay; + } + + public long getId_listinoEbay() { + return this.id_listinoEbay; + } + + public void setId_listinoEbay(long id_listinoEbay) { + this.id_listinoEbay = id_listinoEbay; + setListinoEbay(null); + } + + public Listino getListinoEbay() { + this.listinoEbay = (Listino)getSecondaryObject(this.listinoEbay, Listino.class, getId_listinoEbay()); + return this.listinoEbay; + } + + public void setListinoEbay(Listino listinoEbay) { + this.listinoEbay = listinoEbay; + } + + public String getPHEAD_DOC1() { + return this.pHEAD_DOC1; + } + + public void setPHEAD_DOC1(String pHEAD_DOC1) { + this.pHEAD_DOC1 = pHEAD_DOC1; + } + + public String getPHEAD_DOC2() { + return this.pHEAD_DOC2; + } + + public void setPHEAD_DOC2(String pHEAD_DOC2) { + this.pHEAD_DOC2 = pHEAD_DOC2; + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + setPHEAD_DOC1(getParm("HEAD_DOC1").getTesto()); + setPHEAD_DOC2(getParm("HEAD_DOC2").getTesto()); + setPBCC(getParm("BCC").getTesto()); + setPCC(getParm("CC").getTesto()); + setPFROM(getParm("FROM").getTesto()); + setPSUBJECT(getParm("SUBJECT").getTesto()); + setPDOC_BCC(getParm("DOC_BCC").getTesto()); + setPCCArrotondaPrezzoAEuroSopra(getParm("CC_ARROTONDA_PREZZO_A_EURO_SOPRA").getNumero()); + setPCCArrotondaDecimalePerPrezziBassi(getParm("CC_ARROTONDA_DECIMALE_PER_PREZZI_BASSI").getNumero()); + setFlgIvaEsteroAziendeEsente(getParm("IVA_ESTERO_AZIENDA_ESENTE").getNumeroLong()); + setFlgIvaOneStopShop(getParm("IVA_CEE_ONE_STOP_SHOP").getNumeroLong()); + setPCCRicaricoMinimoOfferte(getParm("CC_RICARICO_MINIMO_OFFERTE").getNumero()); + setPGoogleSigninClientId(getParm("GOOGLE_SIGNIN_CLIENT_ID").getTesto()); + setFlgGoogleSignin(getParm("GOOGLE_SIGNIN_ENABLE").getNumeroLong()); + setPFacebookSigninClientId(getParm("FACEBOOK_SIGNIN_CLIENT_ID").getTesto()); + setPFacebookSigninSecretKey(getParm("FACEBOOK_SIGNIN_SECRET_KEY").getTesto()); + setFlgFacebookSignin(getParm("FACEBOOK_SIGNIN_ENABLE").getNumeroLong()); + setPGooglePrezzoPubblicoMinimoXExport(getParm("GOOGLE_PREZZO_PUBBLICO_MINIMO_X_EXPORT").getNumeroDouble()); + setPGoogleQtaMinimaXExport(getParm("GOOGLE_QTA_MINIMA_X_EXPORT").getNumeroLong()); + setPStripePrivateKey(getParm("STRIPE_PRIVATE_KEY").getTesto()); + setPStripePublicKey(getParm("STRIPE_PUBLIC_KEY").getTesto()); + setPStripeReturnUrl(getParm("STRIPE_RETURN_URL").getTesto()); + } + + public String getCciaa() { + return (this.cciaa == null) ? "" : this.cciaa.trim(); + } + + public void setCciaa(String cciaa) { + this.cciaa = cciaa; + } + + public String getFaxAttivita() { + return (this.faxAttivita == null) ? "" : this.faxAttivita.trim(); + } + + public void setFaxAttivita(String faxAttivita) { + this.faxAttivita = faxAttivita; + } + + public String getPFROM() { + return this.pFROM; + } + + public void setPFROM(String pFROM) { + this.pFROM = pFROM; + } + + public String getPBCC() { + return this.pBCC; + } + + public void setPBCC(String pBCC) { + this.pBCC = pBCC; + } + + public String getPCC() { + return this.pCC; + } + + public void setPCC(String pCC) { + this.pCC = pCC; + } + + public String getPSUBJECT() { + return this.pSUBJECT; + } + + public void setPSUBJECT(String pSUBJECT) { + this.pSUBJECT = pSUBJECT; + } + + public String getPDOC_BCC() { + return this.pDOC_BCC; + } + + public void setPDOC_BCC(String pDOC_BCC) { + this.pDOC_BCC = pDOC_BCC; + } + + public String getEbayFulfillmentPolicyId() { + return (this.ebayFulfillmentPolicyId == null) ? "" : this.ebayFulfillmentPolicyId.trim(); + } + + public void setEbayFulfillmentPolicyId(String ebayFulfillmentPolicyId) { + this.ebayFulfillmentPolicyId = ebayFulfillmentPolicyId; + } + + public String getEbayPaymentPolicyId() { + return (this.ebayPaymentPolicyId == null) ? "" : this.ebayPaymentPolicyId.trim(); + } + + public void setEbayPaymentPolicyId(String ebayPaymentPolicyId) { + this.ebayPaymentPolicyId = ebayPaymentPolicyId; + } + + public String getEbayReturnPolicyId() { + return (this.ebayReturnPolicyId == null) ? "" : this.ebayReturnPolicyId.trim(); + } + + public void setEbayReturnPolicyId(String ebayReturnPolicyId) { + this.ebayReturnPolicyId = ebayReturnPolicyId; + } + + public String getEbayMerchantLocationKey() { + return (this.ebayMerchantLocationKey == null) ? "" : this.ebayMerchantLocationKey.trim(); + } + + public void setEbayMerchantLocationKey(String ebayMerchantLocationKey) { + this.ebayMerchantLocationKey = ebayMerchantLocationKey; + } + + public ResParm ebayCaricaProfilesId() { + ResParm rp = new ResParm(); + return rp; + } + + public boolean isEbayPubblicabile() { + if (getEbayFulfillmentPolicyId().isEmpty() || getEbayPaymentPolicyId().isEmpty() || getEbayReturnPolicyId().isEmpty()) + return false; + return isEbay(); + } + + public String getEbayOAuthRefreshToken() { + return (this.ebayOAuthRefreshToken == null) ? "" : this.ebayOAuthRefreshToken.trim(); + } + + public void setEbayOAuthRefreshToken(String ebayOAuthAuthCode) { + this.ebayOAuthRefreshToken = ebayOAuthAuthCode; + } + + public Timestamp getEbayOAuthRefreshTokenExpire() { + return this.ebayOAuthRefreshTokenExpire; + } + + public void setEbayOAuthRefreshTokenExpire(Timestamp ebayOAuthAuthCodeExpire) { + this.ebayOAuthRefreshTokenExpire = ebayOAuthAuthCodeExpire; + } + + public String getEbayOAuthUserToken() { + return (this.ebayOAuthUserToken == null) ? "" : this.ebayOAuthUserToken.trim(); + } + + public void setEbayOAuthUserToken(String ebayOAuthUserCode) { + this.ebayOAuthUserToken = ebayOAuthUserCode; + } + + public Timestamp getEbayOAuthUserTokenExpire() { + return this.ebayOAuthUserTokenExpire; + } + + public void setEbayOAuthUserTokenExpire(Timestamp ebayOAuthUserCodeExpire) { + this.ebayOAuthUserTokenExpire = ebayOAuthUserCodeExpire; + } + + public boolean isEbayOAuthUserTokenExpired() { + if (getEbayOAuthUserToken().isEmpty()) + return true; + int gap = 10000; + if (Calendar.getInstance().getTimeInMillis() + (long)gap > getEbayOAuthUserTokenExpire().getTime()) + return true; + return false; + } + + public boolean isEbayOAuthRefreshTokenExpired() { + if (getEbayOAuthRefreshToken().isEmpty()) + return true; + int gap = 10000; + if (Calendar.getInstance().getTimeInMillis() + (long)gap > getEbayOAuthRefreshTokenExpire().getTime()) + return true; + return false; + } + + public ResParm superSave() { + return super.save(); + } + + public ResParm ebayUpdateFulfillmentPolicyId() { + ResParm rp = new ResParm(true); + if (getId_attivita() > 0L) { + EbayAbliaApi bean = new EbayAbliaApi(getApFull()); + EbayResult ebayRes = bean.ebayGetFulfillmentPolicy(); + if (ebayRes.isOk()) { + setEbayFulfillmentPolicyId((String)ebayRes.getResult()); + rp = superSave(); + if (rp.getStatus()) + rp.setMsg(ebayRes.getMsg()); + } else { + rp.setStatus(false); + rp.setMsg(ebayRes.getMsg()); + } + } + return rp; + } + + public ResParm ebayUpdatePaymentPolicyId() { + ResParm rp = new ResParm(true); + if (getId_attivita() > 0L) { + EbayAbliaApi bean = new EbayAbliaApi(getApFull()); + EbayResult ebayRes = bean.ebayGetPaymentPolicy(); + if (ebayRes.isOk()) { + setEbayPaymentPolicyId((String)ebayRes.getResult()); + rp = superSave(); + if (rp.getStatus()) + rp.setMsg(ebayRes.getMsg()); + } else { + rp.setStatus(false); + rp.setMsg(ebayRes.getMsg()); + } + } + return rp; + } + + public ResParm ebayCreaMerchantLocationKey() { + ResParm rp = new ResParm(true); + if (getId_attivita() > 0L) { + EbayAbliaApi bean = new EbayAbliaApi(getApFull()); + EbayResult ebayRes = bean.ebayCreateInventoryLocation(getEbayMerchantLocationKey()); + if (ebayRes.isOk()) { + rp.setMsg(ebayRes.getMsg()); + } else { + rp.setStatus(false); + rp.setMsg(ebayRes.getMsg()); + } + } + return rp; + } + + public ResParm ebayUpdateReturnPolicyId() { + ResParm rp = new ResParm(true); + if (getId_attivita() > 0L) { + EbayAbliaApi bean = new EbayAbliaApi(getApFull()); + EbayResult ebayRes = bean.ebayGetReturnPolicy(); + if (ebayRes.isOk()) { + setEbayReturnPolicyId((String)ebayRes.getResult()); + rp = superSave(); + if (rp.getStatus()) + rp.setMsg(ebayRes.getMsg()); + } else { + rp.setStatus(false); + rp.setMsg(ebayRes.getMsg()); + } + } + return rp; + } + + public boolean isDetailXsText(String l_lang) { + return !(getDetailXsText(l_lang).isEmpty() || getDetailXsTitle(l_lang).isEmpty()); + } + + public String getDescSpeseSpedizioni(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("descSpeseSpedizioni", l_lang); + } + + public long getFlgIcecat() { + return this.flgIcecat; + } + + public void setFlgIcecat(long flgIcecat) { + this.flgIcecat = flgIcecat; + } + + public String getIcecatUsername() { + return (this.icecatUsername == null) ? "" : this.icecatUsername.trim(); + } + + public void setIcecatUsername(String icecatUsername) { + this.icecatUsername = icecatUsername; + } + + public String getIcecatPassword() { + return (this.icecatPassword == null) ? "" : this.icecatPassword; + } + + public void setIcecatPassword(String icecatPassowrd) { + this.icecatPassword = icecatPassowrd; + } + + public boolean isIcecat() { + return (getFlgIcecat() == 1L && !getIcecatUsername().isEmpty()); + } + + public String getHomePage(String lang) { + if (getTopLingueAttivita().indexOf(",") > 0) { + if (lang.equals("it")) { + if (getWwwAddress().endsWith("/")) + return getWwwAddress().substring(0, getWwwAddress().length() - 1); + return getWwwAddress(); + } + return getWwwAddress() + "index-" + getWwwAddress() + ".html"; + } + if (getWwwAddress().endsWith("/")) + return getWwwAddress().substring(0, getWwwAddress().length() - 1); + return getWwwAddress(); + } + + public long getPercentileMaxPerPreventivo() { + return this.percentileMaxPerPreventivo; + } + + public void setPercentileMaxPerPreventivo(long flgPercSpedizioneSuperato) { + this.percentileMaxPerPreventivo = flgPercSpedizioneSuperato; + } + + public String getDescrizioneAttivita(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("descrizioneAttivita", l_lang); + } + + public String getSloganTrasporto(String l_lang) { + if (l_lang.isEmpty()) + l_lang = "it"; + return getDescTxtLang("sloganTrasporto", l_lang); + } + + public double getPCCArrotondaPrezzoAEuroSopra() { + return this.pCCArrotondaPrezzoAEuroSopra; + } + + public void setPCCArrotondaPrezzoAEuroSopra(double prezzoConIvaMinimoConArrotondamento) { + this.pCCArrotondaPrezzoAEuroSopra = prezzoConIvaMinimoConArrotondamento; + } + + public double getPCCArrotondaDecimalePerPrezziBassi() { + return this.pCCArrotondaDecimalePerPrezziBassi; + } + + public void setPCCArrotondaDecimalePerPrezziBassi(double pCCArrotondaDecimalePerPrezziBassi) { + this.pCCArrotondaDecimalePerPrezziBassi = pCCArrotondaDecimalePerPrezziBassi; + } + + public double getDeliveryCostConIva() { + long l_id_ivaV = getParm("CODICE_IVA_STD_VEND").getNumeroLong(); + if (l_id_ivaV == 0L) + return getDeliveryCost(); + Iva iva = new Iva(getApFull()); + iva.findByPrimaryKey(l_id_ivaV); + return conIva(getDeliveryCost(), (double)iva.getAliquota()); + } + + public long getFlgIvaOneStopShop() { + return this.flgIvaOneStopShop; + } + + public void setFlgIvaOneStopShop(long flgOneStopShop) { + this.flgIvaOneStopShop = flgOneStopShop; + } + + public long getFlgIvaEsteroAziendeEsente() { + return this.flgIvaEsteroAziendeEsente; + } + + public void setFlgIvaEsteroAziendeEsente(long flgIvaEsteroAziendeEsente) { + this.flgIvaEsteroAziendeEsente = flgIvaEsteroAziendeEsente; + } + + public String getGoogleMerchantRecensioniScript() { + return (this.googleMerchantRecensioniScript == null) ? "" : this.googleMerchantRecensioniScript.trim(); + } + + public String getGoogleMerchantRecensioniScript(Documento doc) { + String temp = getGoogleMerchantRecensioniScript(); + temp = temp.replace("ORDER_ID", String.valueOf(doc.getProgOrdineWww())); + temp = temp.replace("CUSTOMER_EMAIL", doc.getClifor().getEMail()); + temp = temp.replace("COUNTRY_CODE", doc.getClifor().getNazione().getCodice()); + temp = temp.replace("YYYY-MM-DD", String.valueOf(doc.getDataDocumento())); + StringBuilder sb = new StringBuilder("\"products\":["); + Vectumerator vec = doc.findRigheDocumento(0, 0, 0); + boolean firstRow = true; + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (!firstRow && !row.getArticolo().getCodiceEan().isEmpty()) + sb.append(","); + if (!row.getArticolo().getCodiceEan().isEmpty()) { + sb.append("{\"gtin\":\""); + sb.append(row.getArticolo().getCodiceEan()); + sb.append("\"}"); + firstRow = false; + } + } + sb.append("]"); + if (!firstRow) { + temp = temp.replace("PRODUCTS", sb.toString()); + } else { + temp = temp.replace("PRODUCTS", ""); + } + return temp; + } + + public void setGoogleMerchantRecensioniScript(String googleMerchantRecensioniScript) { + this.googleMerchantRecensioniScript = googleMerchantRecensioniScript; + } + + public String getGoogleMerchantRecensioniScriptBadge() { + return (this.googleMerchantRecensioniScriptBadge == null) ? "" : this.googleMerchantRecensioniScriptBadge.trim(); + } + + public void setGoogleMerchantRecensioniScriptBadge(String googleMerchantRecensioniScriptBadge) { + this.googleMerchantRecensioniScriptBadge = googleMerchantRecensioniScriptBadge; + } + + public long getFlgGoogleMerchantRecensioni() { + return this.flgGoogleMerchantRecensioni; + } + + public void setFlgGoogleMerchantRecensioni(long flgGoogleMerchatRecensioni) { + this.flgGoogleMerchantRecensioni = flgGoogleMerchatRecensioni; + } + + public long getFlgGoogleMerchantRecensioniBadge() { + return this.flgGoogleMerchantRecensioniBadge; + } + + public void setFlgGoogleMerchantRecensioniBadge(long flgGoogleMerchatRecensioniBadge) { + this.flgGoogleMerchantRecensioniBadge = flgGoogleMerchatRecensioniBadge; + } + + public GoogleReviews getReview(boolean userReview) { + boolean debug = false; + GoogleReviews res = new GoogleReviews(); + if (getGoogleApiKey().isEmpty() || getGoogleSiteId().isEmpty()) { + res.setStatus(false); + res.setMsg("APikey o Site id non impostati"); + } + Date dataRating = getParm(GoogleReview.P_GOOGLE_REVIEW_DATE).getDataParm(); + if (userReview || dataRating == null || getDateDiff(dataRating, getToday()) != 0L) { + String HTTP_REVIEW = "https://maps.googleapis.com/maps/api/place/details/json?cid=CID&language=it&key=API_KEY"; + String httpReviev = "https://maps.googleapis.com/maps/api/place/details/json?cid=CID&language=it&key=API_KEY".replace("CID", getGoogleSiteId()).replace("API_KEY", getGoogleApiKey()); + try { + if (debug) + System.out.println("Google Review --> getReview: "); + CloseableHttpClient client = HttpClients.createDefault(); + HttpGet request = new HttpGet(httpReviev); + request.setHeader("Accept", "application/json"); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Content-Language", "it-IT"); + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (debug) + System.out.println("Status Code: " + statusCode); + JSONObject jo = new JSONObject(); + if (statusCode >= 400) { + jo = new JSONObject(content); + System.out.println(jo.toString(4)); + } else { + jo = new JSONObject(content); + if (jo.has("result")) { + JSONObject jRes = jo.getJSONObject("result"); + res.setRating(jRes.getDouble("rating")); + res.setUserRatingsTotal(jRes.getLong("user_ratings_total")); + JSONArray jRev = jRes.getJSONArray("reviews"); + Vectumerator vecGr = res.getReviews(); + for (int i = 0; i < jRev.length(); i++) { + jRev.getJSONObject(i); + GoogleReview gr = new GoogleReview(jRev.getJSONObject(i)); + vecGr.add(gr); + } + } + } + Parm parm = getParm(GoogleReview.P_GOOGLE_REVIEW_DATE); + parm.setDataParm(getToday()); + parm.save(); + parm = getParm(GoogleReview.P_GOOGLE_REVIEW_RATING); + parm.setNumero(res.getRating()); + parm.save(); + parm = getParm(GoogleReview.P_GOOGLE_REVIEW_USER_RATING_TOTALS); + parm.setNumero((double)res.getUserRatingsTotal()); + parm.save(); + getApFull().resetCurrentApParms(); + return res; + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + res.setStatus(false); + res.setMsg(e.getMessage()); + return res; + } + } + res.setRating(getParm(GoogleReview.P_GOOGLE_REVIEW_RATING).getNumeroDouble()); + res.setUserRatingsTotal(getParm(GoogleReview.P_GOOGLE_REVIEW_USER_RATING_TOTALS).getNumeroLong()); + return res; + } + + public String getGoogleApiKey() { + return (this.googleApiKey == null) ? "" : this.googleApiKey.trim(); + } + + public void setGoogleApiKey(String googleApiKey) { + this.googleApiKey = googleApiKey; + } + + public String getGoogleSiteId() { + return (this.googleSiteId == null) ? "" : this.googleSiteId.trim(); + } + + public void setGoogleSiteId(String googleSiteId) { + this.googleSiteId = googleSiteId; + } + + public long getFlgAmz() { + return this.flgAmz; + } + + public void setFlgAmz(long flgAmz) { + this.flgAmz = flgAmz; + } + + public long getId_listinoAmz() { + return this.id_listinoAmz; + } + + public void setId_listinoAmz(long id_listinoAnz) { + this.id_listinoAmz = id_listinoAnz; + setListinoAmz(null); + } + + public Listino getListinoAmz() { + this.listinoAmz = (Listino)getSecondaryObject(this.listinoAmz, Listino.class, getId_listinoAmz()); + return this.listinoAmz; + } + + public void setListinoAmz(Listino listinoAmz) { + this.listinoAmz = listinoAmz; + } + + public long getFlgTrovaprezzi() { + return this.flgTrovaprezzi; + } + + public void setFlgTrovaprezzi(long flgTrovaprezzi) { + this.flgTrovaprezzi = flgTrovaprezzi; + } + + public boolean isTrovaprezzi() { + if (getFlgTrovaprezzi() <= 0L) + return false; + return true; + } + + public boolean isIdealo() { + if (getFlgIdealo() <= 0L) + return false; + return true; + } + + public String getTrovaprezziTrustedProgramScript() { + return (this.trovaprezziTrustedProgramScript == null) ? "" : this.trovaprezziTrustedProgramScript.trim(); + } + + public String getTrovaprezziTrustedProgramScript(Documento doc) { + String temp = getTrovaprezziTrustedProgramScript(); + temp = temp.replace("IDORDINE", String.valueOf(doc.getProgOrdineWww())); + temp = temp.replace("EMAILCLIENTE", doc.getClifor().getEMail()); + temp = temp.replace("TOTALECARRELLO", String.valueOf(doc.getTotaleDocumento())); + StringBuilder items = new StringBuilder(); + String item = getTrovaprezziTrustedProgramScriptItem(); + Vectumerator vec = doc.findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + item = item.replace("SKU", row.getArticolo().getCodice()); + item = item.replace("NOMEPRODOTTO", row.getArticolo().getNome()); + items.append(" "); + items.append(item); + item = getTrovaprezziTrustedProgramScriptItem(); + } + temp = temp.replace("ITEMS", items.toString()); + return temp; + } + + public void setTrovaprezziTrustedProgramScript(String trovaprezziTrustedProgramScript) { + this.trovaprezziTrustedProgramScript = trovaprezziTrustedProgramScript; + } + + public String getTrovaprezziTrustedProgramScriptItem() { + return (this.trovaprezziTrustedProgramScriptItem == null) ? "" : this.trovaprezziTrustedProgramScriptItem.trim(); + } + + public void setTrovaprezziTrustedProgramScriptItem(String trovaprezziTrustedProgramScriptItem) { + this.trovaprezziTrustedProgramScriptItem = trovaprezziTrustedProgramScriptItem; + } + + public double getCheckCartPercScontoMax() { + return this.checkCartPercScontoMax; + } + + public void setCheckCartPercScontoMax(double checkCartPercScontoMax) { + this.checkCartPercScontoMax = checkCartPercScontoMax; + } + + public String getCookiePolicyTheme() { + return (this.cookiePolicyTheme == null) ? "" : this.cookiePolicyTheme.trim(); + } + + public void setCookiePolicyTheme(String cookiePolicyTheme) { + this.cookiePolicyTheme = cookiePolicyTheme; + } + + public long getFlgIdealo() { + return this.flgIdealo; + } + + public void setFlgIdealo(long flgIdealo) { + this.flgIdealo = flgIdealo; + } + + public String getIdealoTag() { + return (this.idealoTag == null) ? "" : this.idealoTag.trim(); + } + + public void setIdealoTag(String idealoTag) { + this.idealoTag = idealoTag; + } + + public double getPCCRicaricoMinimoOfferte() { + return this.pCCRicaricoMinimoOfferte; + } + + public void setPCCRicaricoMinimoOfferte(double pCCRicaricoMinimoOfferte) { + this.pCCRicaricoMinimoOfferte = pCCRicaricoMinimoOfferte; + } + + public String getPGoogleSigninClientId() { + return (this.pGoogleSigninClientId == null) ? "" : this.pGoogleSigninClientId.trim(); + } + + public void setPGoogleSigninClientId(String pGoogleSigninClientId) { + this.pGoogleSigninClientId = pGoogleSigninClientId; + } + + public long getFlgGoogleSignin() { + return this.flgGoogleSignin; + } + + public void setFlgGoogleSignin(long flgGoogleSignin) { + this.flgGoogleSignin = flgGoogleSignin; + } + + public boolean isGoogleSignIn() { + if (getFlgGoogleSignin() <= 0L || getPGoogleSigninClientId().isEmpty()) + return false; + return true; + } + + public boolean isSocialSignIn() { + return (isGoogleSignIn() || isFacebookSignIn()); + } + + public boolean isFacebookSignIn() { + if (getFlgFacebookSignin() <= 0L || getPFacebookSigninClientId().isEmpty() || getPFacebookSigninSecretKey().isEmpty()) + return false; + return true; + } + + public String getPFacebookSigninClientId() { + return this.pFacebookSigninClientId; + } + + public void setPFacebookSigninClientId(String pFacebookSigninClientId) { + this.pFacebookSigninClientId = pFacebookSigninClientId; + } + + public long getFlgFacebookSignin() { + return this.flgFacebookSignin; + } + + public void setFlgFacebookSignin(long flgFacebookSignin) { + this.flgFacebookSignin = flgFacebookSignin; + } + + public String getMainPageOrganizationStructData() { + String ORG_STRUCT_DATA_TEMPLATE = ""; + String result = "".replace("#URL", getWwwAddress()); + result = result.replace("#LOGO", getWwwAddress() + getWwwAddress()); + result = result.replace("#TEL", getTelefonoAttivita()); + return result; + } + + public String getNomeAttivitaSeo() { + return (this.nomeAttivitaSeo == null) ? "" : this.nomeAttivitaSeo.trim(); + } + + public void setNomeAttivitaSeo(String nomeAttivitaSeo) { + this.nomeAttivitaSeo = nomeAttivitaSeo; + } + + public String getPaypalRateScriptHead() { + return (this.paypalRateScriptHead == null) ? "" : this.paypalRateScriptHead.trim(); + } + + public void setPaypalRateScriptHead(String paypalRateScriptHead) { + this.paypalRateScriptHead = paypalRateScriptHead; + } + + public String getPaypalRateScriptBodyDett() { + return (this.paypalRateScriptBodyDett == null) ? "" : this.paypalRateScriptBodyDett.trim(); + } + + public String getPaypalRateScriptBodyDett(double importo) { + return getPaypalRateScriptBodyDett().replace("#", String.valueOf(importo)); + } + + public void setPaypalRateScriptBodyDett(String paypalRateScriptBody) { + this.paypalRateScriptBodyDett = paypalRateScriptBody; + } + + public String getPaypalRateScriptBodyCat() { + return (this.paypalRateScriptBodyCat == null) ? "" : this.paypalRateScriptBodyCat.trim(); + } + + public void setPaypalRateScriptBodyCat(String paypalRateScriptBodyCat) { + this.paypalRateScriptBodyCat = paypalRateScriptBodyCat; + } + + public double getPGooglePrezzoPubblicoMinimoXExport() { + return this.pGooglePrezzoPubblicoMinimoXExport; + } + + public void setPGooglePrezzoPubblicoMinimoXExport(double pGooglePrezzoPubblicoMinimoXExport) { + this.pGooglePrezzoPubblicoMinimoXExport = pGooglePrezzoPubblicoMinimoXExport; + } + + public long getPGoogleQtaMinimaXExport() { + return this.pGoogleQtaMinimaXExport; + } + + public void setPGoogleQtaMinimaXExport(long pGoogleQtaMinimaXExport) { + this.pGoogleQtaMinimaXExport = pGoogleQtaMinimaXExport; + } + + public boolean isLingueAttiveHref(String canonical, HttpServletRequest req) { + boolean debug = false; + if (isLingueAttive()) { + String uriEnd; + if (debug) { + System.out.println("canonical:" + canonical); + System.out.println("request uri: " + req.getRequestURI()); + } + if (req.getAttribute("javax.servlet.forward.request_uri") != null) { + if (debug) + System.out.println("forward uri:" + req.getAttribute("javax.servlet.forward.request_uri").toString()); + uriEnd = req.getAttribute("javax.servlet.forward.request_uri").toString(); + } else { + uriEnd = req.getRequestURI(); + } + if (debug) + System.out.println("uriend:" + uriEnd); + if (canonical.endsWith(uriEnd)) + return true; + return false; + } + return false; + } + + public String getIndexNowApiKey() { + return (this.indexNowApiKey == null) ? "" : this.indexNowApiKey.trim(); + } + + public String getIndexNowKeyLocation() { + if (getIndexNowApiKey().isEmpty()) + return ""; + return getWwwAddress() + getWwwAddress() + ".txt"; + } + + public void setIndexNowApiKey(String indexNowApiKey) { + this.indexNowApiKey = indexNowApiKey; + } + + public long getIndexNowUrlQuota() { + return (this.indexNowUrlQuota == 0L) ? 100L : this.indexNowUrlQuota; + } + + public void setIndexNowUrlQuota(long indexNowUrlQuota) { + this.indexNowUrlQuota = indexNowUrlQuota; + } + + public Date getIndexNowDay() { + return this.indexNowDay; + } + + public void setIndexNowDay(Date indexNowDay) { + this.indexNowDay = indexNowDay; + } + + public long getIndexNowDayCount() { + return this.indexNowDayCount; + } + + public void setIndexNowDayCount(long indexNowDayCount) { + this.indexNowDayCount = indexNowDayCount; + } + + public long getSitemapHashcode() { + return (long)getWwwAddress().hashCode(); + } + + public String getNoCacheTs() { + Calendar cal = Calendar.getInstance(); + StringBuilder temp = new StringBuilder(String.valueOf(cal.getTimeInMillis()).substring(4)); + return temp.toString().trim(); + } + + public String getPStripePublicKey() { + return (this.pStripePublicKey == null) ? "" : this.pStripePublicKey.trim(); + } + + public void setPStripePublicKey(String pStripePublicKey) { + this.pStripePublicKey = pStripePublicKey; + } + + public String getPStripePrivateKey() { + return (this.pStripePrivateKey == null) ? "" : this.pStripePrivateKey.trim(); + } + + public void setPStripePrivateKey(String pStripePrivateKey) { + this.pStripePrivateKey = pStripePrivateKey; + } + + public String getPStripeReturnUrl() { + return (this.pStripeReturnUrl == null) ? "" : this.pStripeReturnUrl.trim(); + } + + public void setPStripeReturnUrl(String pStripeReturnUrl) { + this.pStripeReturnUrl = pStripeReturnUrl; + } + + public long getFlgPaypalRate() { + return this.flgPaypalRate; + } + + public void setFlgPaypalRate(long flgPaypalRate) { + this.flgPaypalRate = flgPaypalRate; + } + + public boolean isAmz() { + if (getFlgAmz() <= 0L) + return false; + return true; + } + + public String getPFacebookSigninSecretKey() { + return this.pFacebookSigninSecretKey; + } + + public void setPFacebookSigninSecretKey(String pFacebookSigninSecretKey) { + this.pFacebookSigninSecretKey = pFacebookSigninSecretKey; + } + + public String getAmzLwaClientId() { + return (this.amzLwaClientId == null) ? "" : this.amzLwaClientId.trim(); + } + + public void setAmzLwaClientId(String amzLwaClientId) { + this.amzLwaClientId = amzLwaClientId; + } + + public String getAmzLwaClientSecret() { + return (this.amzLwaClientSecret == null) ? "" : this.amzLwaClientSecret.trim(); + } + + public void setAmzLwaClientSecret(String amzLwaClientSecret) { + this.amzLwaClientSecret = amzLwaClientSecret; + } + + public String getAmzLwaAuthToken() { + return (this.amzLwaAuthToken == null) ? "" : this.amzLwaAuthToken.trim(); + } + + public void setAmzLwaAuthToken(String amzLwaAuthToken) { + this.amzLwaAuthToken = amzLwaAuthToken; + } + + public String getAmzLwaAccessToken() { + return (this.amzLwaAccessToken == null) ? "" : this.amzLwaAccessToken.trim(); + } + + public void setAmzLwaAccessToken(String amzLwaAccessToken) { + this.amzLwaAccessToken = amzLwaAccessToken; + } + + public String getAmzLwaRefreshToken() { + return (this.amzLwaRefreshToken == null) ? "" : this.amzLwaRefreshToken.trim(); + } + + public void setAmzLwaRefreshToken(String amzLwaRefreshToken) { + this.amzLwaRefreshToken = amzLwaRefreshToken; + } + + public Timestamp getAmzLwaAccessTokenExpireTS() { + return this.amzLwaAccessTokenExpireTS; + } + + public void setAmzLwaAccessTokenExpireTS(Timestamp amzLwaAccessTokenExpireTS) { + this.amzLwaAccessTokenExpireTS = amzLwaAccessTokenExpireTS; + } + + public String getAmzStsAccessKeyId() { + return (this.amzStsAccessKeyId == null) ? "" : this.amzStsAccessKeyId.trim(); + } + + public void setAmzStsAccessKeyId(String amzStsAccessKeyId) { + this.amzStsAccessKeyId = amzStsAccessKeyId; + } + + public String getAmzStsSecretAccessKey() { + return (this.amzStsSecretAccessKey == null) ? "" : this.amzStsSecretAccessKey.trim(); + } + + public void setAmzStsSecretAccessKey(String amzStsSecretAccessKey) { + this.amzStsSecretAccessKey = amzStsSecretAccessKey; + } + + public String getAmzStsSessionToken() { + return (this.amzStsSessionToken == null) ? "" : this.amzStsSessionToken.trim(); + } + + public void setAmzStsSessionToken(String amzStsSessionToken) { + this.amzStsSessionToken = amzStsSessionToken; + } + + public Timestamp getAmzStsSessionTokenTS() { + return this.amzStsSessionTokenTS; + } + + public void setAmzStsSessionTokenTS(Timestamp amzStsSessionTokenTS) { + this.amzStsSessionTokenTS = amzStsSessionTokenTS; + } + + public String getAmzIamRoleARN() { + return (this.amzIamRoleARN == null) ? "" : this.amzIamRoleARN.trim(); + } + + public void setAmzIamRoleARN(String amzIamRoleARN) { + this.amzIamRoleARN = amzIamRoleARN; + } + + public String getAmzIamAccessKey() { + return (this.amzIamAccessKey == null) ? "" : this.amzIamAccessKey.trim(); + } + + public void setAmzIamAccessKey(String amzIamAccessKey) { + this.amzIamAccessKey = amzIamAccessKey; + } + + public String getAmzIamSecretKey() { + return (this.amzIamSecretKey == null) ? "" : this.amzIamSecretKey.trim(); + } + + public void setAmzIamSecretKey(String amzIamSecretKey) { + this.amzIamSecretKey = amzIamSecretKey; + } + + public String getAmzMarketplaces() { + return (this.amzMarketplaces == null) ? "" : this.amzMarketplaces.trim(); + } + + public void setAmzMarketplaces(String amzMarketplaces) { + this.amzMarketplaces = amzMarketplaces; + } + + public String getAmzSellerid() { + return (this.amzSellerid == null) ? "" : this.amzSellerid.trim(); + } + + public void setAmzSellerid(String amzSellerid) { + this.amzSellerid = amzSellerid; + } + + public ResParm amzUpdateTokens(boolean force) { + ResParm rp = new ResParm(); + AmzSellerApi asa = new AmzSellerApi(this); + if (force) { + asa.setLwaAccessTokenExpireTS(null); + asa.setStsSessionTokenTS(null); + } + AmzResult res = asa.amzGetMarketplaces(); + rp.setMsg(res.getMsg()); + rp.setStatus(res.isOk()); + return rp; + } + + public String getAmzMerchantShippingGroupFree() { + return (this.amzMerchantShippingGroupFree == null) ? "" : this.amzMerchantShippingGroupFree.trim(); + } + + public void setAmzMerchantShippingGroupFree(String amzMerchantShippingGroupFree) { + this.amzMerchantShippingGroupFree = amzMerchantShippingGroupFree; + } + + public String getPathImg() { + return "_img/_imgAttivita/"; + } + + public double getDeliveryCostPudo() { + return this.deliveryCostPudo; + } + + public void setDeliveryCostPudo(double deliveryCostPudo) { + this.deliveryCostPudo = deliveryCostPudo; + } + + public double getDeliveryCostPudoConIva() { + long l_id_ivaV = getParm("CODICE_IVA_STD_VEND").getNumeroLong(); + if (l_id_ivaV == 0L) + return getDeliveryCostPudo(); + Iva iva = new Iva(getApFull()); + iva.findByPrimaryKey(l_id_ivaV); + return conIva(getDeliveryCostPudo(), (double)iva.getAliquota()); + } + + public String getImgFaviconAdmin() { + String faviconDir = getDocBase() + getDocBase(); + DBAdapter.checkAndMakeDir(faviconDir); + String nomeFileIcoFull = faviconDir + faviconDir; + if (!new File(nomeFileIcoFull).exists()) + try { + ResParm rp = new ResParm(true); + String fileOrig = getDocBase() + getDocBase() + getPathImg(); + ScaleImage si = new ScaleImage(fileOrig, "32/", 0L, 32, 0, true, false); + rp = si.scaleIt(); + fileOrig = si.getTheScaledImageName(); + if (rp.getStatus()) { + BufferedImage bi = ImageIO.read(new File(fileOrig)); + DBAdapter.mkDirs(nomeFileIcoFull); + ICOEncoder.write(bi, new File(nomeFileIcoFull)); + } + } catch (Exception e) { + logDebug(true, e.getMessage()); + } + if (new File(nomeFileIcoFull).exists()) + return getPathImg() + getPathImg(); + return "admin/_V4/_logo/favicon.ico"; + } + + public Attivita() {} +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/AttivitaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/AttivitaCR.java new file mode 100644 index 00000000..0ad41ed3 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/AttivitaCR.java @@ -0,0 +1,509 @@ +package it.acxent.cc; + +import it.acxent.anag.Clifor; +import it.acxent.anag.Comune; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class AttivitaCR extends CRAdapter { + private long id_attivita; + + private long id_tipoAttivita; + + private long id_clifor; + + private String nomeAttivita; + + private String descrizioneAttivita; + + private String indirizzoAttivita; + + private String numeroCivicoAttivita; + + private long id_comune; + + private String descrizioneComuneAttivita; + + private String descrizioneProvinciaAttivita; + + private String capComuneAttivita; + + private long flgGusti; + + private Date dataIscrizione; + + private String codiceAttivita; + + private String noteAttivita; + + private String imgTmst; + + private long fglMainSxCategorie; + + private long flgMainSxVetrinaBestseller; + + private long flgMainSxVetrinaOfferte; + + private long flgMainSxUltimiVisualizzati; + + private String mainSxText; + + private long flgMainBanner; + + private long flgMainVetrina; + + private long flgMainVetrinaCategorie; + + private long flgTopTelefono; + + private long flgTopLingue; + + private long flgTopMail; + + private String topColoreHex; + + private long flgHeadCategorie; + + private long flgHeadMarche; + + private long flgHeadNewsType; + + private long flgHeadPagine; + + private String headColoreHex; + + private long flgDetailReviews; + + private long flgDetailRelatedProducts; + + private String detailDxText; + + private long flgDetailDxVetrinaBestseller; + + private long flgDetailDxVetrinaOfferte; + + private long flgCoupon; + + private long flgCheckoutGuest; + + private String accountFacebook; + + private String accountTwitter; + + private String accountInstagram; + + private long flgSocialSide; + + private long flgFooterSocial; + + private TipoAttivita tipoAttivita; + + private Clifor clifor; + + private Comune comune; + + public AttivitaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AttivitaCR() {} + + public static final String getHeadNewsType(long l_flgHeadNewsType) { + return Attivita.getHeadNewsType(l_flgHeadNewsType); + } + + public String getHeadNewsType() { + return getHeadNewsType(getFlgHeadNewsType()); + } + + public void setId_attivita(long newId_attivita) { + this.id_attivita = newId_attivita; + } + + public void setId_tipoAttivita(long newId_tipoAttivita) { + this.id_tipoAttivita = newId_tipoAttivita; + setTipoAttivita(null); + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setNomeAttivita(String newNomeAttivita) { + this.nomeAttivita = newNomeAttivita; + } + + public void setDescrizioneAttivita(String newDescrizioneAttivita) { + this.descrizioneAttivita = newDescrizioneAttivita; + } + + public void setIndirizzoAttivita(String newIndirizzoAttivita) { + this.indirizzoAttivita = newIndirizzoAttivita; + } + + public void setNumeroCivicoAttivita(String newNumeroCivicoAttivita) { + this.numeroCivicoAttivita = newNumeroCivicoAttivita; + } + + public void setId_comune(long newId_comune) { + this.id_comune = newId_comune; + setComune(null); + } + + public void setDescrizioneComuneAttivita(String newDescrizioneComuneAttivita) { + this.descrizioneComuneAttivita = newDescrizioneComuneAttivita; + } + + public void setDescrizioneProvinciaAttivita(String newDescrizioneProvinciaAttivita) { + this.descrizioneProvinciaAttivita = newDescrizioneProvinciaAttivita; + } + + public void setCapComuneAttivita(String newCapComuneAttivita) { + this.capComuneAttivita = newCapComuneAttivita; + } + + public void setFlgGusti(long newFlgGusti) { + this.flgGusti = newFlgGusti; + } + + public void setDataIscrizione(Date newDataIscrizione) { + this.dataIscrizione = newDataIscrizione; + } + + public void setCodiceAttivita(String newCodiceAttivita) { + this.codiceAttivita = newCodiceAttivita; + } + + public void setNoteAttivita(String newNoteAttivita) { + this.noteAttivita = newNoteAttivita; + } + + public void setImgTmst(String newImgTmst) { + this.imgTmst = newImgTmst; + } + + public void setFglMainSxCategorie(long newFglMainSxCategorie) { + this.fglMainSxCategorie = newFglMainSxCategorie; + } + + public void setFlgMainSxVetrinaBestseller(long newFlgMainSxVetrinaBestseller) { + this.flgMainSxVetrinaBestseller = newFlgMainSxVetrinaBestseller; + } + + public void setFlgMainSxVetrinaOfferte(long newFlgMainSxVetrinaOfferte) { + this.flgMainSxVetrinaOfferte = newFlgMainSxVetrinaOfferte; + } + + public void setFlgMainSxUltimiVisualizzati(long newFlgMainSxUltimiVisualizzati) { + this.flgMainSxUltimiVisualizzati = newFlgMainSxUltimiVisualizzati; + } + + public void setMainSxText(String newMainSxText) { + this.mainSxText = newMainSxText; + } + + public void setFlgMainBanner(long newFlgMainBanner) { + this.flgMainBanner = newFlgMainBanner; + } + + public void setFlgMainVetrina(long newFlgMainVetrina) { + this.flgMainVetrina = newFlgMainVetrina; + } + + public void setFlgMainVetrinaCategorie(long newFlgMainVetrinaCategorie) { + this.flgMainVetrinaCategorie = newFlgMainVetrinaCategorie; + } + + public void setFlgTopTelefono(long newFlgTopTelefono) { + this.flgTopTelefono = newFlgTopTelefono; + } + + public void setFlgTopLingue(long newFlgTopLingue) { + this.flgTopLingue = newFlgTopLingue; + } + + public void setFlgTopMail(long newFlgTopMail) { + this.flgTopMail = newFlgTopMail; + } + + public void setTopColoreHex(String newTopColoreHex) { + this.topColoreHex = newTopColoreHex; + } + + public void setFlgHeadCategorie(long newFlgHeadCategorie) { + this.flgHeadCategorie = newFlgHeadCategorie; + } + + public void setFlgHeadMarche(long newFlgHeadMarche) { + this.flgHeadMarche = newFlgHeadMarche; + } + + public void setFlgHeadNewsType(long newFlgHeadNewsType) { + this.flgHeadNewsType = newFlgHeadNewsType; + } + + public void setFlgHeadPagine(long newFlgHeadPagine) { + this.flgHeadPagine = newFlgHeadPagine; + } + + public void setHeadColoreHex(String newHeadColoreHex) { + this.headColoreHex = newHeadColoreHex; + } + + public void setFlgDetailReviews(long newFlgDetailReviws) { + this.flgDetailReviews = newFlgDetailReviws; + } + + public void setFlgDetailRelatedProducts(long newFlgDetailRelatedProducts) { + this.flgDetailRelatedProducts = newFlgDetailRelatedProducts; + } + + public void setDetailDxText(String newDetailDxText) { + this.detailDxText = newDetailDxText; + } + + public void setFlgDetailDxVetrinaBestseller(long newFlgDetailDxVetrinaBestseller) { + this.flgDetailDxVetrinaBestseller = newFlgDetailDxVetrinaBestseller; + } + + public void setFlgDetailDxVetrinaOfferte(long newFlgDetailDxVetrinaOfferte) { + this.flgDetailDxVetrinaOfferte = newFlgDetailDxVetrinaOfferte; + } + + public void setFlgCoupon(long newFlgCoupon) { + this.flgCoupon = newFlgCoupon; + } + + public void setFlgCheckoutGuest(long newFlgCheckoutGuest) { + this.flgCheckoutGuest = newFlgCheckoutGuest; + } + + public void setAccountFacebook(String newAccountFacebook) { + this.accountFacebook = newAccountFacebook; + } + + public void setAccountTwitter(String newAccountTwitter) { + this.accountTwitter = newAccountTwitter; + } + + public void setAccountInstagram(String newAccountInstagram) { + this.accountInstagram = newAccountInstagram; + } + + public void setFlgSocialSide(long newFlgSocialSide) { + this.flgSocialSide = newFlgSocialSide; + } + + public void setFlgFooterSocial(long newFlgFooterSocial) { + this.flgFooterSocial = newFlgFooterSocial; + } + + public long getId_attivita() { + return this.id_attivita; + } + + public long getId_tipoAttivita() { + return this.id_tipoAttivita; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public String getNomeAttivita() { + return (this.nomeAttivita == null) ? "" : this.nomeAttivita.trim(); + } + + public String getDescrizioneAttivita() { + return (this.descrizioneAttivita == null) ? "" : this.descrizioneAttivita.trim(); + } + + public String getIndirizzoAttivita() { + return (this.indirizzoAttivita == null) ? "" : this.indirizzoAttivita.trim(); + } + + public String getNumeroCivicoAttivita() { + return (this.numeroCivicoAttivita == null) ? "" : this.numeroCivicoAttivita.trim(); + } + + public long getId_comune() { + return this.id_comune; + } + + public String getDescrizioneComuneAttivita() { + return (this.descrizioneComuneAttivita == null) ? "" : this.descrizioneComuneAttivita.trim(); + } + + public String getDescrizioneProvinciaAttivita() { + return (this.descrizioneProvinciaAttivita == null) ? "" : this.descrizioneProvinciaAttivita.trim(); + } + + public String getCapComuneAttivita() { + return (this.capComuneAttivita == null) ? "" : this.capComuneAttivita.trim(); + } + + public long getFlgGusti() { + return this.flgGusti; + } + + public Date getDataIscrizione() { + return this.dataIscrizione; + } + + public String getCodiceAttivita() { + return (this.codiceAttivita == null) ? "" : this.codiceAttivita.trim(); + } + + public String getNoteAttivita() { + return (this.noteAttivita == null) ? "" : this.noteAttivita.trim(); + } + + public String getImgTmst() { + return (this.imgTmst == null) ? "" : this.imgTmst.trim(); + } + + public long getFglMainSxCategorie() { + return this.fglMainSxCategorie; + } + + public long getFlgMainSxVetrinaBestseller() { + return this.flgMainSxVetrinaBestseller; + } + + public long getFlgMainSxVetrinaOfferte() { + return this.flgMainSxVetrinaOfferte; + } + + public long getFlgMainSxUltimiVisualizzati() { + return this.flgMainSxUltimiVisualizzati; + } + + public String getMainSxText() { + return (this.mainSxText == null) ? "" : this.mainSxText.trim(); + } + + public long getFlgMainBanner() { + return this.flgMainBanner; + } + + public long getFlgMainVetrina() { + return this.flgMainVetrina; + } + + public long getFlgMainVetrinaCategorie() { + return this.flgMainVetrinaCategorie; + } + + public long getFlgTopTelefono() { + return this.flgTopTelefono; + } + + public long getFlgTopLingue() { + return this.flgTopLingue; + } + + public long getFlgTopMail() { + return this.flgTopMail; + } + + public String getTopColoreHex() { + return (this.topColoreHex == null) ? "" : this.topColoreHex.trim(); + } + + public long getFlgHeadCategorie() { + return this.flgHeadCategorie; + } + + public long getFlgHeadMarche() { + return this.flgHeadMarche; + } + + public long getFlgHeadNewsType() { + return this.flgHeadNewsType; + } + + public long getFlgHeadPagine() { + return this.flgHeadPagine; + } + + public String getHeadColoreHex() { + return (this.headColoreHex == null) ? "" : this.headColoreHex.trim(); + } + + public long getFlgDetailReviews() { + return this.flgDetailReviews; + } + + public long getFlgDetailRelatedProducts() { + return this.flgDetailRelatedProducts; + } + + public String getDetailDxText() { + return (this.detailDxText == null) ? "" : this.detailDxText.trim(); + } + + public long getFlgDetailDxVetrinaBestseller() { + return this.flgDetailDxVetrinaBestseller; + } + + public long getFlgDetailDxVetrinaOfferte() { + return this.flgDetailDxVetrinaOfferte; + } + + public long getFlgCoupon() { + return this.flgCoupon; + } + + public long getFlgCheckoutGuest() { + return this.flgCheckoutGuest; + } + + public String getAccountFacebook() { + return (this.accountFacebook == null) ? "" : this.accountFacebook.trim(); + } + + public String getAccountTwitter() { + return (this.accountTwitter == null) ? "" : this.accountTwitter.trim(); + } + + public String getAccountInstagram() { + return (this.accountInstagram == null) ? "" : this.accountInstagram.trim(); + } + + public long getFlgSocialSide() { + return this.flgSocialSide; + } + + public long getFlgFooterSocial() { + return this.flgFooterSocial; + } + + public void setTipoAttivita(TipoAttivita newTipoAttivita) { + this.tipoAttivita = newTipoAttivita; + } + + public TipoAttivita getTipoAttivita() { + this.tipoAttivita = (TipoAttivita)getSecondaryObject(this.tipoAttivita, TipoAttivita.class, getId_tipoAttivita()); + return this.tipoAttivita; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setComune(Comune newComune) { + this.comune = newComune; + } + + public Comune getComune() { + this.comune = (Comune)getSecondaryObject(this.comune, Comune.class, getId_comune()); + return this.comune; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/AttivitaTipoPagamento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/AttivitaTipoPagamento.java new file mode 100644 index 00000000..c3e45a33 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/AttivitaTipoPagamento.java @@ -0,0 +1,112 @@ +package it.acxent.cc; + +import it.acxent.anag.TipoPagamento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class AttivitaTipoPagamento extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1587713686703L; + + private long id_attivitaTipoPagamento; + + private long id_attivita; + + private long id_tipoPagamento; + + private Attivita attivita; + + private TipoPagamento tipoPagamento; + + public AttivitaTipoPagamento(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AttivitaTipoPagamento() {} + + public void setId_attivitaTipoPagamento(long newId_attivitaTipoPagamento) { + this.id_attivitaTipoPagamento = newId_attivitaTipoPagamento; + } + + public void setId_attivita(long newId_attivita) { + this.id_attivita = newId_attivita; + setAttivita(null); + } + + public void setId_tipoPagamento(long newId_tipoPagamento) { + this.id_tipoPagamento = newId_tipoPagamento; + setTipoPagamento(null); + } + + public long getId_attivitaTipoPagamento() { + return this.id_attivitaTipoPagamento; + } + + public long getId_attivita() { + return this.id_attivita; + } + + public long getId_tipoPagamento() { + return this.id_tipoPagamento; + } + + public void setAttivita(Attivita newAttivita) { + this.attivita = newAttivita; + } + + public Attivita getAttivita() { + this.attivita = (Attivita)getSecondaryObject(this.attivita, Attivita.class, + + getId_attivita()); + return this.attivita; + } + + public void setTipoPagamento(TipoPagamento newTipoPagamento) { + this.tipoPagamento = newTipoPagamento; + } + + public TipoPagamento getTipoPagamento() { + this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, + + getId_tipoPagamento()); + return this.tipoPagamento; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(AttivitaTipoPagamentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ATTIVITA_TIPO_PAGAMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/AttivitaTipoPagamentoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/AttivitaTipoPagamentoCR.java new file mode 100644 index 00000000..e0fd0975 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/AttivitaTipoPagamentoCR.java @@ -0,0 +1,71 @@ +package it.acxent.cc; + +import it.acxent.anag.TipoPagamento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AttivitaTipoPagamentoCR extends CRAdapter { + private long id_attivitaTipoPagamento; + + private long id_attivita; + + private long id_tipoPagamento; + + private Attivita attivita; + + private TipoPagamento tipoPagamento; + + public AttivitaTipoPagamentoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AttivitaTipoPagamentoCR() {} + + public void setId_attivitaTipoPagamento(long newId_attivitaTipoPagamento) { + this.id_attivitaTipoPagamento = newId_attivitaTipoPagamento; + } + + public void setId_attivita(long newId_attivita) { + this.id_attivita = newId_attivita; + setAttivita(null); + } + + public void setId_tipoPagamento(long newId_tipoPagamento) { + this.id_tipoPagamento = newId_tipoPagamento; + setTipoPagamento(null); + } + + public long getId_attivitaTipoPagamento() { + return this.id_attivitaTipoPagamento; + } + + public long getId_attivita() { + return this.id_attivita; + } + + public long getId_tipoPagamento() { + return this.id_tipoPagamento; + } + + public void setAttivita(Attivita newAttivita) { + this.attivita = newAttivita; + } + + public Attivita getAttivita() { + this.attivita = (Attivita)getSecondaryObject(this.attivita, Attivita.class, + + getId_attivita()); + return this.attivita; + } + + public void setTipoPagamento(TipoPagamento newTipoPagamento) { + this.tipoPagamento = newTipoPagamento; + } + + public TipoPagamento getTipoPagamento() { + this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, + + getId_tipoPagamento()); + return this.tipoPagamento; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronArticoloAutoOfferte.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronArticoloAutoOfferte.java new file mode 100644 index 00000000..f729f5c1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronArticoloAutoOfferte.java @@ -0,0 +1,45 @@ +package it.acxent.cc; + +import it.acxent.art.ArticoloCR; +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.Timer; + +public class CCCronArticoloAutoOfferte implements CrontabInterface { + public static void main(String[] args) { + String hostname = "localhost"; + String db = "cc"; + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + CCCronArticoloAutoOfferte bean = new CCCronArticoloAutoOfferte(); + bean.crontabJob(apTarget); + } + + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + Timer timer = new Timer(); + timer.start(); + System.out.println("CCCronSitemapXml start..."); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab CCCronArticoloAutoOfferte CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + ArticoloCR CR = new ArticoloCR(ap); + CR.setFlgReadyForWeb(1L); + CR.setFlgEscludiWeb(0L); + ArticoloAutoOfferte aao = new ArticoloAutoOfferte(ap); + aao.setId_vetrinaAO(2L); + aao.setNArticoliAO(50L); + aao.setNGiorniAO(3L); + aao.setGiacenzaMinimaAO(6L); + aao.setPercScontoOffertaAO(2.5D); + rp = aao.starAutoOfferte(ap, false); + msg.append("\n################# Fine crontab CCCronArticoloAutoOfferte CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + timer.stop(); + msg.append("Durata aggiornamento: " + timer.getDurataHourMin() + "\n"); + rp.setMsg("\n" + rp.getMsg() + "\n" + msg.toString()); + System.out.println(msg.toString()); + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronCreaIdealoXml.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronCreaIdealoXml.java new file mode 100644 index 00000000..600022d2 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronCreaIdealoXml.java @@ -0,0 +1,48 @@ +package it.acxent.cc; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; + +public class CCCronCreaIdealoXml implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + System.out.println("CCCronCreaTrovaprezziXml start..."); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab IDEALO XML OFFERTE CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + msg.append("\n\n"); + msg.append(ap.getMsg()); + msg.append("\n\n"); + long t0 = System.currentTimeMillis(); + ArticoloCR CR = new ArticoloCR(ap); + CR.setFlgQta(1L); + CR.setFlgIdealo(1L); + CR.setFileNameIdealo("idealo_f3.xml"); + CR.setFlgReadyForWeb(1L); + CR.setFlgEscludiWeb(0L); + CR.setLangReadyForWeb("it"); + Articolo art = new Articolo(ap); + if (art.isLocalhost()); + rp = art.creaFileXmlIdealo(CR); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab IDEALO XML OFFERTE CC (" + DBAdapter.getNow().toString() + ")\n#################"); + long tn = System.currentTimeMillis(); + long duration = (tn - t0) / 60000L; + msg.append("Durata aggiornamento: " + duration + " minuti.\n"); + rp.setMsg(msg.toString()); + System.out.println(msg.toString()); + return rp; + } + + public static void main(String[] args) { + String hostname = "localhost"; + String db = "cc"; + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + CCCronCreaIdealoXml bean = new CCCronCreaIdealoXml(); + bean.crontabJob(apTarget); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronCreaTrovaprezziXml.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronCreaTrovaprezziXml.java new file mode 100644 index 00000000..d3e69796 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronCreaTrovaprezziXml.java @@ -0,0 +1,46 @@ +package it.acxent.cc; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; + +public class CCCronCreaTrovaprezziXml implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + System.out.println("CCCronCreaTrovaprezziXml start..."); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab TROVAPREZZI XML OFFERTE CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + msg.append("\n\n"); + msg.append(ap.getMsg()); + msg.append("\n\n"); + long t0 = System.currentTimeMillis(); + ArticoloCR CR = new ArticoloCR(ap); + CR.setFlgTrovaprezzi(1L); + CR.setFileNameTrovaprezzi("trovaprezzi-f3.xml"); + CR.setFlgEscludiWeb(0L); + Articolo art = new Articolo(ap); + if (art.isLocalhost()); + rp = art.creaFileXmlTrovaprezzi(CR); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab TROVAPREZZI XML OFFERTE CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + long tn = System.currentTimeMillis(); + long duration = (tn - t0) / 60000L; + msg.append("Durata aggiornamento: " + duration + " minuti.\n"); + rp.setMsg(msg.toString()); + System.out.println(msg.toString()); + return rp; + } + + public static void main(String[] args) { + String hostname = "localhost"; + String db = "cc"; + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + CCCronCreaTrovaprezziXml bean = new CCCronCreaTrovaprezziXml(); + bean.crontabJob(apTarget); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronIcecatAuto.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronIcecatAuto.java new file mode 100644 index 00000000..7f34793f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronIcecatAuto.java @@ -0,0 +1,35 @@ +package it.acxent.cc; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.Timer; + +public class CCCronIcecatAuto implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + Timer timer = new Timer(); + timer.start(); + System.out.println("CCCrontIcecatAuto start..."); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab Icecat Auto CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + ArticoloCR CR = new ArticoloCR(ap); + CR.setFlgReadyForWeb(0L); + CR.setFlgEscludiWeb(-1L); + CR.setFlgQta(1L); + CR.setQtaDa(1L); + CR.setQtaA(9999L); + Articolo art = new Articolo(ap); + rp = art.startThreadIcecatAuto(ap, CR); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab Import Icecat Auto CC (" + DBAdapter.getNow().toString() + ")\n#################"); + timer.stop(); + msg.append("Durata aggiornamento: " + timer.getDurataHourMin() + "\n"); + rp.setMsg(msg.toString()); + System.out.println(msg.toString()); + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronIcecatAutomatorGoogle.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronIcecatAutomatorGoogle.java new file mode 100644 index 00000000..986c034e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronIcecatAutomatorGoogle.java @@ -0,0 +1,108 @@ +package it.acxent.cc; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.common.CrontabInterface; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.Timer; +import it.acxent.util.Vectumerator; + +public class CCCronIcecatAutomatorGoogle implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + Timer timer = new Timer(); + timer.start(); + String TAG_THREAD_MSG = "ICECAT+AUTOMATOR+SITEMAP+GOOGLE "; + System.out.println("CCCrontIcecatAuto start..."); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab " + TAG_THREAD_MSG + " (" + + DBAdapter.getNow().toString() + ")\n#################"); + StatusMsg.updateMsgByTag(ap, TAG_THREAD_MSG, " THREAD ICECAT IN ESECUZIONE ......"); + msg.append("************* THREAD ICECAT ***************+\n"); + ResParm rp = new ResParm(true); + Articolo art = new Articolo(ap); + ArticoloCR ACR = new ArticoloCR(ap); + ACR.setFlgReadyForWeb(0L); + ACR.setFlgEscludiWeb(-1L); + ACR.setFlgQta(1L); + ACR.setQtaDa(1L); + ACR.setQtaA(9999L); + rp = art.startThreadIcecatAuto(ap, ACR); + msg.append(rp.getMsg()); + msg.append("\n"); + while (Articolo.isThreadIcecatAuto()) { + try { + Thread.sleep(3000L); + } catch (Exception e) {} + } + msg.append("\nfine ICECAT. Lap time:" + timer.getDurataHourMin()); + StatusMsg.updateMsgByTag(ap, TAG_THREAD_MSG, " THREAD AUTOMATOR IN ESECUZIONE ......"); + msg.append("\n\n************* THREAD AUTOMATOR ***************+\n"); + rp = new ResParm(true); + WwwAutomator automator = new WwwAutomator(ap); + WwwAutomatorCR CRWA = new WwwAutomatorCR(); + CRWA.setFlgAbilita(1L); + rp = automator.startAutomator(ap, CRWA, true); + msg.append(rp.getMsg()); + msg.append("\n"); + while (WwwAutomator.isThreadAttivo()) { + try { + Thread.sleep(3000L); + } catch (Exception e) {} + } + msg.append("\nfine AUTOMATOR. Lap time:" + timer.getDurataHourMin()); + StatusMsg.updateMsgByTag(ap, TAG_THREAD_MSG, " THREAD SITEMAP IN ESECUZIONE ......"); + msg.append("\n\n************* THREAD SITEMAP ***************+\n"); + rp = art.startThreadCreaSitemaps(ap, ACR); + if (rp.getStatus()) { + Thread t = (Thread)rp.getExtraInfo("thread", null); + if (t != null) + try { + t.join(); + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } + msg.append("\nfine SITEMAP. Lap time:" + timer.getDurataHourMin()); + } else { + msg.append("\nErrore nella generazione delle sitemap: " + rp.getMsg() + "\n"); + } + StatusMsg.updateMsgByTag(ap, TAG_THREAD_MSG, " THREAD GOOGLE MERCHANT IN ESECUZIONE ......"); + msg.append("\n\n************* THREAD GOOGLE MERCHANT ***************+\n"); + rp = new ResParm(true); + ACR = new ArticoloCR(ap); + ACR.setFlgQta(1L); + ACR.setFlgGoogle(1L); + ACR.setGoogleFeedFileName("offerte"); + ACR.setFileNameGoogle("offerte.xml"); + art = new Articolo(ap); + Vectumerator vec = art.findByCR(ACR, 0, 0); + CCImport bean = new CCImport(); + if (!art.isLocalhost()) { + if (ap.getParmValue("GOOGLE_FTP_USER", "").equals("") || + ap.getParmValue("GOOGLE_FTP_PASSWORD", "").equals("")) { + msg.append("parametri ftp google non impostati. impossibile inviare il feed via ftp a google\n"); + } else { + rp = bean.startGoogleFtp(ap, ACR); + msg.append("Numero record inviati a google via ftp feed " + ACR.getGoogleFeedFileName() + ": " + vec.getTotNumberOfRecords() + "\n"); + msg.append(rp.getMsg()); + } + } else { + msg.append("thread google xml non avviato sulla crontab perché localhost!!\n"); + msg.append(rp.getMsg()); + } + while (CCImport.isThreadGoogleMerchant()) { + try { + Thread.sleep(3000L); + } catch (Exception e) {} + } + msg.append("\nfine GOOGLE MERCHANT. Lap time:" + timer.getDurataHourMin()); + StatusMsg.deleteMsgByTag(ap, TAG_THREAD_MSG); + msg.append("\n################# Fine crontab " + TAG_THREAD_MSG + "(" + DBAdapter.getNow().toString() + ")\n#################"); + timer.stop(); + msg.append("Durata aggiornamento: " + timer.getDurataHourMin() + "\n"); + rp.setMsg(msg.toString()); + System.out.println(msg.toString()); + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportBestit.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportBestit.java new file mode 100644 index 00000000..7c37ca27 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportBestit.java @@ -0,0 +1,25 @@ +package it.acxent.cc; + +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; + +public class CCCronImportBestit implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import BESTIT CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + long t0 = System.currentTimeMillis(); + CCImport ccImport = new CCImport(); + long[] flgTipoImportA = { 0L }; + rp = ccImport.startImportBestit(ap, flgTipoImportA, true); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab Import BESTIT CC (" + DBAdapter.getNow().toString() + ")\n#################"); + long tn = System.currentTimeMillis(); + long duration = (tn - t0) / 60000L; + msg.append("Durata aggiornamento: " + duration + " minuti.\n"); + rp.setMsg(msg.toString()); + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportCgross.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportCgross.java new file mode 100644 index 00000000..f243f6f8 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportCgross.java @@ -0,0 +1,24 @@ +package it.acxent.cc; + +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; + +public class CCCronImportCgross implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import CGross CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + long t0 = System.currentTimeMillis(); + CCImport ccImport = new CCImport(); + rp = ccImport.startImportCgross(ap, null, true); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab Import CGross CC (" + DBAdapter.getNow().toString() + ")\n#################"); + long tn = System.currentTimeMillis(); + long duration = (tn - t0) / 60000L; + msg.append("Durata aggiornamento: " + duration + " minuti.\n"); + rp.setMsg(msg.toString()); + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportDatamatic.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportDatamatic.java new file mode 100644 index 00000000..4909bdab --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportDatamatic.java @@ -0,0 +1,24 @@ +package it.acxent.cc; + +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; + +public class CCCronImportDatamatic implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import DATAMATIC MAIL CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + long t0 = System.currentTimeMillis(); + CCImport ccImport = new CCImport(); + rp = ccImport.startImportDatamaticMail(ap, true); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab Import DATAMATIC MAIL CC (" + DBAdapter.getNow().toString() + ")\n#################"); + long tn = System.currentTimeMillis(); + long duration = (tn - t0) / 60000L; + msg.append("Durata aggiornamento: " + duration + " minuti.\n"); + rp.setMsg(msg.toString()); + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportIngramMicroDispo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportIngramMicroDispo.java new file mode 100644 index 00000000..40273494 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportIngramMicroDispo.java @@ -0,0 +1,25 @@ +package it.acxent.cc; + +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; + +public class CCCronImportIngramMicroDispo implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import Ingrammicro DISPO CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + long t0 = System.currentTimeMillis(); + CCImport ccImport = new CCImport(); + rp = ccImport.startImportIngramMicro(ap, 1L, true); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab Import Ingrammicro DISPO CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + long tn = System.currentTimeMillis(); + long duration = (tn - t0) / 60000L; + msg.append("Durata aggiornamento: " + duration + " minuti.\n"); + rp.setMsg(msg.toString()); + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportIngramMicroListino.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportIngramMicroListino.java new file mode 100644 index 00000000..44d321ff --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportIngramMicroListino.java @@ -0,0 +1,24 @@ +package it.acxent.cc; + +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; + +public class CCCronImportIngramMicroListino implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import Ingrammicro LISTINO CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + long t0 = System.currentTimeMillis(); + CCImport ccImport = new CCImport(); + rp = ccImport.startImportIngramMicro(ap, 0L, true); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab Import Ingrammicro LISTINO CC (" + DBAdapter.getNow().toString() + ")\n#################"); + long tn = System.currentTimeMillis(); + long duration = (tn - t0) / 60000L; + msg.append("Durata aggiornamento: " + duration + " minuti.\n"); + rp.setMsg(msg.toString()); + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportLogicom.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportLogicom.java new file mode 100644 index 00000000..52ae3817 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportLogicom.java @@ -0,0 +1,24 @@ +package it.acxent.cc; + +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; + +public class CCCronImportLogicom implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import LOGICOM MAIL CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + long t0 = System.currentTimeMillis(); + CCImport ccImport = new CCImport(); + rp = ccImport.startImportLogicomMail(ap, true); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab Import LOGICOM MAIL CC (" + DBAdapter.getNow().toString() + ")\n#################"); + long tn = System.currentTimeMillis(); + long duration = (tn - t0) / 60000L; + msg.append("Durata aggiornamento: " + duration + " minuti.\n"); + rp.setMsg(msg.toString()); + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportRunner.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportRunner.java new file mode 100644 index 00000000..834bd863 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronImportRunner.java @@ -0,0 +1,25 @@ +package it.acxent.cc; + +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; + +public class CCCronImportRunner implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import RUNNER CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + long t0 = System.currentTimeMillis(); + CCImport ccImport = new CCImport(); + long[] flgTipoImportA = { 0L, 1L }; + rp = ccImport.startImportRunner(ap, flgTipoImportA, true); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab Import RUNNER CC (" + DBAdapter.getNow().toString() + ")\n#################"); + long tn = System.currentTimeMillis(); + long duration = (tn - t0) / 60000L; + msg.append("Durata aggiornamento: " + duration + " minuti.\n"); + rp.setMsg(msg.toString()); + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronIndexNowGiornaliero.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronIndexNowGiornaliero.java new file mode 100644 index 00000000..04f67e3c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronIndexNowGiornaliero.java @@ -0,0 +1,34 @@ +package it.acxent.cc; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.Timer; + +public class CCCronIndexNowGiornaliero implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + Timer timer = new Timer(); + timer.start(); + System.out.println("CCCronIndexNowGiornaliero start..."); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab INDEXNOW CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + Articolo bean = new Articolo(ap); + ArticoloCR CR = new ArticoloCR(); + CR.setFlgOrderBy(10L); + CR.setFlgEscludiWeb(0L); + CR.setFlgReadyForWeb(1L); + CR.setLangReadyForWeb("it"); + rp = bean.callIndexNow(CR); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab INDEXNOW CC (" + DBAdapter.getNow().toString() + ")\n#################"); + timer.stop(); + msg.append("Durata aggiornamento: " + timer.getDurataHourMin() + "\n"); + rp.setMsg(msg.toString()); + System.out.println(msg.toString()); + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronSendGoogleXml.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronSendGoogleXml.java new file mode 100644 index 00000000..03607c9f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronSendGoogleXml.java @@ -0,0 +1,43 @@ +package it.acxent.cc; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.Vectumerator; + +public class CCCronSendGoogleXml implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + System.out.println("CCCronSendGoogleXml start..."); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab Import SEND GOOGLE XML OFFERTE CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + long t0 = System.currentTimeMillis(); + ArticoloCR CR = new ArticoloCR(ap); + CR.setFlgQta(0L); + CR.setFlgGoogle(1L); + CR.setGoogleFeedFileName("merchant"); + CR.setFileNameGoogle("merchant.xml"); + Articolo art = new Articolo(ap); + Vectumerator vec = art.findByCR(CR, 0, 0); + System.out.println("numero record;" + vec.getTotNumberOfRecords()); + CCImport bean = new CCImport(); + if (!art.isLocalhost()) { + rp = bean.startGoogleFtp(ap, CR); + msg.append("Numero record inviati a google via ftp feed " + CR.getGoogleFeedFileName() + ": " + vec.getTotNumberOfRecords() + "\n"); + msg.append(rp.getMsg()); + } else { + msg.append("thread google xml non avviato sulla crontab perché localhost!!\n"); + msg.append(rp.getMsg()); + } + msg.append("\n################# Fine crontab Import SEND GOOGLE XML OFFERTE CC (" + DBAdapter.getNow().toString() + ")\n#################"); + long tn = System.currentTimeMillis(); + long duration = (tn - t0) / 60000L; + msg.append("Durata aggiornamento: " + duration + " minuti.\n"); + rp.setMsg(msg.toString()); + System.out.println(msg.toString()); + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronSitemapXml.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronSitemapXml.java new file mode 100644 index 00000000..8eb28d94 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronSitemapXml.java @@ -0,0 +1,51 @@ +package it.acxent.cc; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Timer; +import it.acxent.www.Sitemap; +import it.acxent.www.SitemapCR; + +public class CCCronSitemapXml implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + Timer timer = new Timer(); + timer.start(); + System.out.println("CCCronSitemapXml start..."); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab CCCronSitemapXml CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + ArticoloCR ACR = new ArticoloCR(ap); + ACR.setFlgReadyForWeb(1L); + ACR.setFlgEscludiWeb(0L); + ACR.setLangReadyForWeb("it"); + SitemapCR CR = new SitemapCR(ap); + CR.setACR(ACR); + Articolo art = new Articolo(ap); + String lang = art.getParm("LANG_AVAILABLE").getTesto(); + StringTokenizer st = new StringTokenizer(lang, ","); + String filenamePre = "sitemap"; + String filenameXml = ".xml"; + while (st.hasMoreTokens()) { + String currentLang = st.nextToken(); + msg.append("creazione sitemap in lingua " + currentLang + " file " + CR.getSitemapFilename() + ".xml\n"); + CR.setLangSitemap(currentLang); + Sitemap sitemap = new Sitemap(ap); + CR.setSitemapFilename("sitemap"); + CR.setFlgSitemapType(10L); + rp = sitemap.creaFileXmlSitemap(CR); + msg.append(rp.getMsg()); + msg.append("\n"); + } + msg.append("\n################# Fine crontab CCCronSitemapXml CC (" + DBAdapter.getNow().toString() + ")\n#################"); + timer.stop(); + msg.append("Durata aggiornamento: " + timer.getDurataHourMin() + "\n"); + rp.setMsg(msg.toString()); + System.out.println(msg.toString()); + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronWwwAutomator.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronWwwAutomator.java new file mode 100644 index 00000000..ae8eed07 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCCronWwwAutomator.java @@ -0,0 +1,29 @@ +package it.acxent.cc; + +import it.acxent.common.CrontabInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.Timer; + +public class CCCronWwwAutomator implements CrontabInterface { + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + Timer timer = new Timer(); + timer.start(); + System.out.println("CCCronWwwAutomator start..."); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab WWW AUTOMATOR CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + WwwAutomator bean = new WwwAutomator(ap); + WwwAutomatorCR CR = new WwwAutomatorCR(); + CR.setFlgAbilita(1L); + rp = bean.startAutomator(ap, CR, true); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab WWW AUTOMATOR CC (" + DBAdapter.getNow().toString() + ")\n#################"); + timer.stop(); + msg.append("Durata aggiornamento: " + timer.getDurataHourMin() + "\n"); + rp.setMsg(msg.toString()); + System.out.println(msg.toString()); + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCImport.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCImport.java new file mode 100644 index 00000000..a1e95948 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CCImport.java @@ -0,0 +1,7265 @@ +package it.acxent.cc; + +import it.acxent.anag.Clifor; +import it.acxent.anag.ListinoArticolo; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.art.ArticoloFornitore; +import it.acxent.art.Marca; +import it.acxent.art.StatoUsato; +import it.acxent.common.CrontabInterface; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.mail.MailAccount; +import it.acxent.mail.MailMessage; +import it.acxent.mail.MailProperties; +import it.acxent.mail.MailService; +import it.acxent.util.Debug; +import it.acxent.util.DoubleOperator; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Timer; +import it.acxent.util.Vectumerator; +import it.acxent.util.XLSFileReader; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.sql.Date; +import java.sql.Timestamp; +import java.text.NumberFormat; +import java.util.Calendar; +import java.util.HashSet; +import javax.mail.Address; +import javax.mail.Message; +import javax.mail.Multipart; +import javax.mail.internet.InternetAddress; +import javax.mail.internet.MimeBodyPart; +import javax.mail.internet.MimeMessage; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +public class CCImport extends Debug implements CrontabInterface { + private static final long serialVersionUID = 4217105704596337740L; + + private Attivita attivita; + + public static final long INGRAM_TIPO_IMPORT_LISTINO = 0L; + + public static final long INGRAM_TIPO_IMPORT_DISPO = 1L; + + public static final long INGRAM_TIPO_IMPORT_SIAE = 2L; + + private static final int FORNITORE_COMPUTERGROSS = 1970; + + private static final int FORNITORE_DATAMATIC = 1971; + + private static final int FORNITORE_ESPRINET = 1973; + + private static final int FORNITORE_INGRAMMICRO = 1995; + + private static final int FORNITORE_LOGICOM = 1997; + + private static final int FORNITORE_FLEXIT = 2001; + + private static final int FORNITORE_BREVI = 2111; + + private static final int FORNITORE_RUNNER = 2117; + + private static final int FORNITORE_BESTIT = 2131; + + public static boolean threadImportCGross = false; + + public static boolean threadImportFlexit = false; + + public static boolean threadImportDatamatic = false; + + public static boolean threadImportEsprinet = false; + + public static boolean threadImportBrevi = false; + + public static boolean threadImportIngramMicro = false; + + public static boolean threadImportRunner = false; + + public static boolean threadImportBestit = false; + + public static boolean threadImportLocicom = false; + + public static boolean threadGoogleMerchant = false; + + public static boolean threadTrovaprezzi = false; + + class ThreadImportComputerGross extends Thread { + private static final String CGROSS_URL = "212.19.96.117"; + + private static final String CGROSS_URL_sftp = "sftp.computergross.it"; + + private static final String CGROSS_USER = "82596"; + + private static final String CGROSS_PWD = "2t2bebql"; + + private static final String CGROSS_PWD_new = "wLT0%3n*aK5 hsMarche = new HashSet<>(); + HashSet hsTipi = new HashSet<>(); + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + if (debug) { + fileCsv = "/Users/acolzi/Documents/webapps/cc/_tmp/LISTINO_82596.CSV"; + } else { + new File(fileCsv).delete(); + DBAdapter.unzip(l_fileNameZip, targetDir); + } + if (rp.getStatus()) { + StatusMsg.updateMsgByTag(this.apFull, "IMPORT CGROSS ", "Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, l_id_fornitore); + String currentLine = ""; + try { + reader = new BufferedReader(new FileReader(fileCsv)); + if (reader != null) { + reader.readLine(); + Calendar cal = Calendar.getInstance(); + String l_descrizioneTecnica = ""; + Marca marca = new Marca(this.apFull); + Articolo art = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + while ((currentLine = reader.readLine()) != null) { + isNuovo = false; + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + StringTokenizer st = new StringTokenizer(currentLine, ";", '"'); + if (st.countToken() >= 6) { + String l_marcaDesc = st.getToken(0); + marca.findByDescrizioneImport(l_marcaDesc); + if (marca.getId_marca() > 0L) { + long dispoL, l1; + double prezzo, streetprice; + Date dataInizioPromo, dataFinePromo; + if (!hsMarche.contains(Long.valueOf(marca.getId_marca()))) { + hsMarche.add(Long.valueOf(marca.getId_marca())); + System.out.println("NUOVA marca GESTITA: " + l_marcaDesc); + } + String l_articoloCodiceFornitore = st.getToken(5).trim(); + String l_articoloCodiceAlternativoFornitore = "CG_" + l_articoloCodiceFornitore; + String l_articoloCodiceProduttore = st.getToken(6).trim(); + String l_codiceEan = st.getToken(4).trim(); + if (l_codiceEan.length() < 13) + l_codiceEan = DBAdapter.zeroLeft(l_codiceEan, 13); + if (l_codiceEan.equals("0000000000000") || l_codiceEan.indexOf("99999999") >= 0) + l_codiceEan = ""; + String l_categoriaImport = st.getToken(1).trim(); + if (!st.getToken(1).trim().equals(st.getToken(2).trim())) + l_categoriaImport = l_categoriaImport + " " + l_categoriaImport; + if (!st.getToken(1).trim().equals(st.getToken(3).trim()) && + !st.getToken(2).trim().equals(st.getToken(3).trim())) + l_categoriaImport = l_categoriaImport + " " + l_categoriaImport; + art.resetBean(); + if (debug && + l_articoloCodiceAlternativoFornitore.equals("CG_6TR83ET")) + System.out.println(l_articoloCodiceAlternativoFornitore); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(l_id_fornitore, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + if (art.getId_articolo() == 0L && !l_codiceEan.isEmpty()) + art.findByCodiceEanSerie(l_codiceEan, serie); + if (art.getId_articolo() == 0L && !l_articoloCodiceProduttore.isEmpty()) + art.findByCodiceProduttoreMarca(l_articoloCodiceProduttore, marca.getId_marca()); + String urlImmagine = ""; + if (st.countToken() > 7); + String l_nome = st.getToken(7).trim(); + String appoggiaPrezzo = st.getToken(12).trim(); + String appoggiaStreetPrice = st.getToken(11).trim(); + String inizioPromo = st.getToken(16).trim(); + String finePromo = st.getToken(17).trim(); + String dispo = st.getToken(20).trim(); + String dispoFutura = st.getToken(21).trim(); + l_descrizioneTecnica = ""; + try { + prezzo = Double.valueOf(appoggiaPrezzo.replace(',', '.')); + streetprice = Double.valueOf(appoggiaStreetPrice.replace(',', '.')); + if (!inizioPromo.equals("0")) { + cal.set(1, Integer.valueOf(inizioPromo.substring(0, 4)).intValue()); + cal.set(2, Integer.valueOf(inizioPromo.substring(4, 6)) - 1); + cal.set(5, Integer.valueOf(inizioPromo.substring(6, 8)).intValue()); + dataInizioPromo = new Date(cal.getTimeInMillis()); + } else { + dataInizioPromo = null; + } + if (!finePromo.equals("0")) { + cal.set(1, Integer.valueOf(finePromo.substring(0, 4)).intValue()); + cal.set(2, Integer.valueOf(finePromo.substring(4, 6)) - 1); + cal.set(5, Integer.valueOf(finePromo.substring(6, 8)).intValue()); + cal.add(6, -1); + dataFinePromo = new Date(cal.getTimeInMillis()); + } else { + dataFinePromo = null; + } + if (dispo.startsWith(",")) { + dispoL = 0L; + } else { + dispoL = Long.parseLong(dispo.substring(0, dispo.indexOf(','))); + } + if (dispoFutura.startsWith(",")) { + long dispoFuturaL = 0L; + } else { + long dispoFuturaL = Long.parseLong(dispoFutura.substring(0, dispoFutura.indexOf(','))); + } + l1 = 0L; + if (dispoL + l1 > 0L) { + salvaArticoloNuovo = true; + } else { + salvaArticoloNuovo = false; + } + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato: " + appoggiaPrezzo + "\n" + currentLine + "\n"); + continue; + } + if (art.getId_articolo() > 0L) { + if (art.getId_tipo() != 1L && !hsTipi.contains(Long.valueOf(art.getId_tipo()))) + hsTipi.add(Long.valueOf(art.getId_tipo())); + System.out.print("*"); + if (debug); + art.aggiornaCodiciAlternativi(false); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCategoriaImport().indexOf(l_categoriaImport) < 0) + art.setCategoriaImport(art.getCategoriaImport() + art.getCategoriaImport()); + if (marca.getId_marca() > 0L && art.getId_marca() == 0L) + art.setId_marca(marca.getId_marca()); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } else if (salvaArticoloNuovo) { + double percentualeRicarico; + isNuovo = true; + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(l_id_tipoDaDafinire); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + art.setNome(l_nome); + art.setDescrizione(l_nome); + art.setCodiceEan(l_codiceEan); + art.setCategoriaImport(l_categoriaImport); + art.setId_marca(0L); + art.setFlgEscludiWebArt(1L); + art.setCostoNetto(prezzo); + art.setFlgModImportazione(1L); + if (prezzo <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCodiciAlternativi().length() > 50) + System.out.println(art.getCodice() + " " + art.getCodice()); + if (marca.getId_marca() > 0L) + art.setId_marca(marca.getId_marca()); + art.setId_fornitoreCostoNuovo(l_id_fornitore); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + if (!rp.getStatus()) { + err.append("Art. Nuovo: " + l_articoloCodiceAlternativoFornitore + " - " + + art.getDescrizione() + " - " + rp.getMsg() + " - "); + artNuovoKO++; + } else { + artNuovo++; + if (urlImmagine != null && !urlImmagine.isEmpty() && urlImmagine.endsWith(".jpg")) + art.caricaImmaginaDaRemoto(urlImmagine); + } + } else { + artNuovoNonSalvato++; + } + if (art.getId_articolo() > 0L && prezzo > 0.0D) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(l_id_fornitore, art.getId_articolo(), -1L); + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(l_id_fornitore); + af.setCostoVecchio(af.getCostoTotale()); + af.setCosto(prezzo); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + af.setCodiceFornitore(l_articoloCodiceFornitore); + af.setDispSede(dispoL); + af.setDispCash(l1); + af.setFlgPromo((dataFinePromo == null) ? 0L : 1L); + af.setStreetPrice(streetprice); + af.setDataInizioPromo(dataInizioPromo); + af.setDataFinePromo(dataFinePromo); + rp = af.save(); + if (rp.getStatus()) { + art.aggiornaPrezziEDispoByFornitori(streetprice, isNuovo); + if (art.getFlgModImportazione() == 2L) { + prezzoModificato++; + } else if (art.getFlgModImportazione() == 3L) { + prezzoNonModificato++; + } + if (art.getFlgEscludiWebArt() == 2L) { + articoloSospeso++; + } else if (art.getFlgEscludiWebArt() == 0L) { + articoloVisibile++; + } + } + } + } else { + artEscluso++; + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + sb = new StringBuilder(" Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE CGROSS " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT CGROSS ", sb.toString()); + } + rp = Articolo.updateArticoloNonTrovati(this.apFull, "IMPORT CGROSS ", l_id_fornitore, hsMarche, hsTipi); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! IMPORT CGROSS record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT CGROSS ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import Articolo e Prezzi COMPUTER GROSS " + serie + " avvenuta correttamente. - File:" + fileCsv + " - Record processati: "); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + sb.append(" - Update articoli non trovati: - "); + sb.append(rp.getMsg()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import Articolo e Prezzi CGROSS " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + } + } + + public void run() { + boolean debug = false; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT CGROSS ", "...inizio ..."); + String serverSftp = "sftp.computergross.it"; + String user = "82596"; + String passNew = "wLT0%3n*aK5= 6) { + long dispoL, dispoCashL, dispoTotL; + double prezzo; + String l_articoloCodiceFornitore = st.getToken(colCodiceFornitore).trim(); + String l_articoloCodiceAlternativoFornitore = "DM_" + l_articoloCodiceFornitore; + String l_articoloCodiceProduttore = st.getToken(colCodiceVendor).trim(); + String l_codiceEan = st.getToken(colCodiceEan).trim(); + if (l_codiceEan.length() < 13) + l_codiceEan = DBAdapter.zeroLeft(l_codiceEan, 13); + if (l_codiceEan.equals("0000000000000") || l_codiceEan.indexOf("99999999") >= 0) + l_codiceEan = ""; + Articolo art = new Articolo(this.apFull); + if (debug && + l_articoloCodiceAlternativoFornitore.equals("CG_7DB75EA")) + System.out.println(l_articoloCodiceAlternativoFornitore); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(1971L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + if (art.getId_articolo() == 0L && !l_codiceEan.isEmpty()) + art.findByCodiceEanSerie(l_codiceEan, serie); + String urlImmagine = ""; + if (st.countToken() > 7); + String l_nome = st.getToken(colNome).trim(); + String appoggiaPrezzo = st.getToken(colPrezzo).trim(); + if (!st.getToken(colPrezzoPromo).trim().equals("0,00")) + isPromo = true; + String dispo = st.getToken(colDispoCentrale).trim(); + String dispoCash = st.getToken(colDispoCash).trim(); + l_descrizioneTecnica = ""; + try { + prezzo = Double.valueOf(appoggiaPrezzo.replace(',', '.')); + dispoL = Long.parseLong(dispo); + dispoCashL = Long.parseLong(dispoCash); + dispoTotL = dispoL + dispoCashL; + if (dispoTotL > 0L) { + salvaArticoloNuovo = true; + } else { + salvaArticoloNuovo = false; + } + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato: " + appoggiaPrezzo + "\n" + currentLine + "\n"); + continue; + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (debug); + if (dispoTotL > 0L) { + if (art.getCostoNetto() != prezzo) { + art.setFlgModImportazione(2L); + prezzoModificato++; + } else { + art.setCostoNuovo(0.0D); + art.setFlgModImportazione(3L); + prezzoNonModificato++; + } + double streetprice = art.getStreetPrice(); + } else { + art.setFlgModImportazione(3L); + prezzoNonModificato++; + } + art.aggiornaCodiciAlternativi(false); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } else { + artNuovoNonSalvato++; + } + if (art.getId_articolo() > 0L && prezzo > 0.0D) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(1971L, art.getId_articolo(), -1L); + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(1971L); + af.setCostoVecchio(af.getCostoTotale()); + af.setCosto(prezzo); + af.setStreetPrice(af.getStreetPrice()); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + af.setCodiceFornitore(l_articoloCodiceFornitore); + af.setDispCash(dispoCashL); + af.setDispSede(dispoL); + af.setFlgPromo(isPromo ? 1L : 0L); + rp = af.save(); + if (rp.getStatus()) { + double dispoF = af.getDispoFornitoriByArticolo(art.getId_articolo()); + art.setQuantita(dispoF); + if (dispoF == 0.0D) { + if (art.getFlgEscludiWebArt() == 0L) { + art.setFlgEscludiWebArt(2L); + articoloSospeso++; + } + } else if (art.getFlgEscludiWebArt() == 2L && art.getId_tipo() > 0L) { + art.setFlgEscludiWebArt(0L); + articoloVisibile++; + } + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + art.superSave(); + } + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Large: Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE DATAMATIC " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ALSO ", sb.toString()); + } + if (SOSPENDI_DOPO_N_GG > 0L) + bean.update("UPDATE ARTICOLO SET flgEscludiWebArt=2,flgEscludiWeb=2 WHERE codice LIKE '" + serie + "%' and flgModImportazione = 0 and DATEDIFF(CURDATE(), dataUltimoImport)>=" + SOSPENDI_DOPO_N_GG + ";"); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! IMPORT ALSO record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ALSO ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import Articolo e Prezzi DATAMATIC " + serie + " avvenuta correttamente. Record processati: "); + sb.append(i); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import Articolo e Prezzi DATAMATIC " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + + public ResParm importUtenteFinale(String l_fileName) { + boolean debug = false; + boolean salvaArticoloNuovo = true; + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/utenteFinale.csv"; + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ALSO ", "Utente Finale: Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 1971L); + String currentLine = ""; + try { + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + reader.readLine(); + String l_descrizioneTecnica = ""; + Marca marca = new Marca(this.apFull); + while ((currentLine = reader.readLine()) != null) { + StringTokenizer st = new StringTokenizer(currentLine, ";", '"'); + if (st.countToken() >= 12) { + String l_marcaDesc = st.getToken(3); + marca.findByDescrizioneImport(l_marcaDesc); + if (marca.getId_marca() > 0L) { + double streetprice; + String l_articoloCodiceFornitore = st.getToken(0).trim(); + String l_articoloCodiceAlternativoFornitore = "DM_" + l_articoloCodiceFornitore; + Articolo art = new Articolo(this.apFull); + if (debug && + l_articoloCodiceAlternativoFornitore.equals("DM_HPW1A53A")) + System.out.println(l_articoloCodiceAlternativoFornitore); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(1971L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + String urlImmagine = ""; + if (st.countToken() > 7); + String l_nome = st.getToken(1).trim(); + String appoggiaStreetPrice = st.getToken(9).trim(); + try { + streetprice = Double.valueOf(appoggiaStreetPrice.replace(',', '.')); + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato: " + appoggiaStreetPrice + "\n" + currentLine + "\n"); + continue; + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (debug); + if (art.getCodice().equals("0000004221")) + System.out.println(l_articoloCodiceFornitore); + if (streetprice > 0.0D && art.getStreetPrice() != streetprice) { + art.setStreetPrice(streetprice); + if (streetprice <= 0.0D || art.getPrezzoArticolo(null).getPrezzoBase() <= streetprice) { + art.setFlgModImportazione(3L); + prezzoNonModificato++; + } + } else { + art.setFlgModImportazione(3L); + prezzoNonModificato++; + } + if (marca.getId_marca() > 0L && art.getId_marca() == 0L) + art.setId_marca(marca.getId_marca()); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + if (rp.getStatus() && art.getId_articolo() > 0L) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(1971L, art.getId_articolo(), -1L); + if (streetprice != 0.0D && af.getStreetPrice() != streetprice) { + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(1971L); + af.setStreetPrice(streetprice); + rp = af.save(); + } + } + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } else if (salvaArticoloNuovo) { + double percentualeRicarico; + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + art.setNome(l_nome); + art.setDescrizione(l_nome); + if (marca.getId_marca() > 0L && art.getId_marca() == 0L) + art.setId_marca(marca.getId_marca()); + art.setFlgEscludiWebArt(1L); + art.setFlgModImportazione(1L); + if (streetprice <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + if (rp.getStatus()) { + ListinoArticolo lab = art.getListinoArticoloBase(); + lab.setPrezzoLA(streetprice); + lab.save(); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + } + if (!rp.getStatus()) { + err.append("Art. Nuovo: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + artNuovoKO++; + } else { + artNuovo++; + } + } else { + artNuovoNonSalvato++; + } + } else { + artEscluso++; + System.out.println("marca scartata: " + l_marcaDesc); + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Utente Finale: Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE DATAMATIC " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ALSO ", sb.toString()); + } + bean.update("UPDATE ARTICOLO SET flgEscludiWebArt=2,flgEscludiWeb=2 WHERE codice LIKE '" + serie + "%' and flgModImportazione = 0 and quantita <=0;"); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! IMPORT ALSO record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ALSO ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import Articolo e Prezzi DATAMATIC " + serie + " avvenuta correttamente. Record processati: "); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import Utente Finale (street price) DATAMATIC " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + + public ResParm importXlsOLD(String l_fileName) { + boolean debug = false; + boolean salvaArticoloNuovo = true; + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + HashSet hsMarche = new HashSet<>(); + HashSet hsTipi = new HashSet<>(); + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + String fileCsv = l_fileName + ".csv"; + rp = DBAdapter.convertXlsToCsv(this.apFull, l_fileName, fileCsv); + if (rp.getStatus()) { + l_fileName = fileCsv; + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/largeXLS.csv"; + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ALSO ", "Large: Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 1971L); + int colCodiceVendor = 0; + int colCodiceEan = -1; + int colCodiceFornitore = 1; + int colNome = 2; + int colPrezzo = 5; + int colDispoCentrale = 3; + int colDispoCash = 4; + String currentLine = ""; + try { + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + reader.readLine(); + Calendar cal = Calendar.getInstance(); + String l_descrizioneTecnica = ""; + boolean isPromo = false; + while ((currentLine = reader.readLine()) != null) { + isPromo = false; + StringTokenizer st = new StringTokenizer(currentLine, ";", '"'); + if (st.countToken() >= 6) { + String l_codiceEan; + long dispoL, dispoCashL, dispoTotL; + double prezzo; + String l_articoloCodiceFornitore = st.getToken(colCodiceFornitore).trim(); + String l_articoloCodiceAlternativoFornitore = "DM_" + l_articoloCodiceFornitore; + String l_articoloCodiceProduttore = st.getToken(colCodiceVendor).trim(); + if (colCodiceEan < 0) { + l_codiceEan = ""; + } else { + l_codiceEan = st.getToken(colCodiceEan).trim(); + if (l_codiceEan.length() < 13) + l_codiceEan = DBAdapter.zeroLeft(l_codiceEan, 13); + if (l_codiceEan.equals("0000000000000") || l_codiceEan.indexOf("99999999") >= 0) + l_codiceEan = ""; + } + Articolo art = new Articolo(this.apFull); + if (debug && + l_articoloCodiceAlternativoFornitore.equals("CG_7DB75EA")) + System.out.println(l_articoloCodiceAlternativoFornitore); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(1971L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + String urlImmagine = ""; + if (st.countToken() > 7); + String l_nome = st.getToken(colNome).trim(); + String appoggiaPrezzo = st.getToken(colPrezzo).trim(); + if (!st.getToken(7).trim().equals("0,00")) + isPromo = true; + String dispo = st.getToken(colDispoCentrale).trim(); + String dispoCash = st.getToken(colDispoCash).trim(); + l_descrizioneTecnica = ""; + try { + prezzo = Double.valueOf(appoggiaPrezzo.replace(',', '.')); + dispoL = Long.parseLong(dispo); + dispoCashL = Long.parseLong(dispoCash); + dispoTotL = dispoL + dispoCashL; + if (dispoTotL > 0L) { + salvaArticoloNuovo = true; + } else { + salvaArticoloNuovo = false; + } + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato: " + appoggiaPrezzo + "\n" + currentLine + "\n"); + continue; + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (art.getId_tipo() != 1L && !hsTipi.contains(Long.valueOf(art.getId_tipo()))) + hsTipi.add(Long.valueOf(art.getId_tipo())); + if (!hsMarche.contains(Long.valueOf(art.getId_marca()))) { + hsMarche.add(Long.valueOf(art.getId_marca())); + System.out.println("NUOVA marca GESTITA: " + art.getMarca().getDescrizione()); + } + if (debug); + if (dispoTotL > 0L) { + if (art.getCostoNetto() != prezzo) { + art.setFlgModImportazione(2L); + prezzoModificato++; + } else { + art.setCostoNuovo(0.0D); + art.setFlgModImportazione(3L); + prezzoNonModificato++; + } + double streetprice = art.getStreetPrice(); + } else { + art.setFlgModImportazione(3L); + prezzoNonModificato++; + } + art.aggiornaCodiciAlternativi(false); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } else { + artNuovoNonSalvato++; + } + if (art.getId_articolo() > 0L && prezzo > 0.0D) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(1971L, art.getId_articolo(), -1L); + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(1971L); + af.setCostoVecchio(af.getCostoTotale()); + af.setCosto(prezzo); + af.setStreetPrice(af.getStreetPrice()); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + af.setCodiceFornitore(l_articoloCodiceFornitore); + af.setDispCash(dispoCashL); + af.setDispSede(dispoL); + af.setFlgPromo(isPromo ? 1L : 0L); + rp = af.save(); + if (rp.getStatus()) { + double dispoF = af.getDispoFornitoriByArticolo(art.getId_articolo()); + art.setQuantita(dispoF); + if (dispoF == 0.0D) { + if (art.getFlgEscludiWebArt() == 0L) { + art.setFlgEscludiWebArt(2L); + articoloSospeso++; + } + } else if (art.getFlgEscludiWebArt() == 2L && art.getId_tipo() > 0L) { + art.setFlgEscludiWebArt(0L); + articoloVisibile++; + } + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + art.superSave(); + } + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Large: Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE DATAMATIC " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ALSO ", sb.toString()); + } + rp = Articolo.updateArticoloNonTrovati(this.apFull, "IMPORT ALSO ", 1971L, hsMarche, hsTipi); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! IMPORT ALSO record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ALSO ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import Articolo e Prezzi DATAMATIC " + serie + " avvenuta correttamente. - File:" + l_fileName + " - Record processati: "); + sb.append(i); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + sb.append(" - Update articoli non trovati: - "); + sb.append(rp.getMsg()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import Articolo e Prezzi DATAMATIC " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + + public ResParm importXls(String l_fileName) { + return null; + } + } + + class ThreadImportEsprinet extends Thread { + private ApplParmFull apFull; + + private String fileCsvlarge; + + private final String TAG_THREAD_MSG = "IMPORT ESPRINET "; + + private boolean sendEmail; + + private static final long l_id_fornitore = 1973L; + + private static final long l_id_tipoDaDafinire = 1L; + + public ThreadImportEsprinet(ApplParmFull apFull, String fileXls, boolean sendEmail) { + this.apFull = apFull; + this.fileCsvlarge = fileXls; + this.sendEmail = sendEmail; + if (!CCImport.isThreadEsprinetAttivo()) { + CCImport.threadImportEsprinet = true; + start(); + } + } + + public void run() { + boolean debug = false; + boolean salvaArticoloNuovo = true; + String TAG_THREAD_MSG = "IMPORT ESPRINET "; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ESPRINET ", "...inizio ..."); + String serie = ""; + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("##############\nIMPORT ESPRINET " + serie + "\nSTART: " + start.toString()); + ResParm rp = new ResParm(true); + BufferedReader reader = null; + String targetDir = this.apFull.getParm("DOCBASE").getTesto() + this.apFull.getParm("DOCBASE").getTesto(); + String fileCsv = this.fileCsvlarge.substring(this.fileCsvlarge.lastIndexOf('/') + 1); + String l_fileName = this.fileCsvlarge; + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/" + fileCsv; + if (l_fileName.endsWith(".csv")) { + rp = importGiornalieroCSV(l_fileName); + } else { + rp = importGiornalieroXls(l_fileName); + } + timer.stop(); + rp.setMsg("Import concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + if (this.sendEmail) + CCImport.this.sendArticoliCambiatiByEmail(this.apFull, rp.getMsg(), 1973L); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ESPRINET ", rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.apFull, "IMPORT ESPRINET "); + CCImport.threadImportEsprinet = false; + System.out.println(rp.getMsg()); + if (CCImport.this.getAttivita(this.apFull).getFlgEbay() == 1L) { + Articolo bean = new Articolo(this.apFull); + bean.startThreadAllineaEbay(this.apFull, new ArticoloCR()); + } + if (CCImport.this.getAttivita(this.apFull).getFlgAmz() == 1L) { + Articolo bean = new Articolo(this.apFull); + bean.startThreadAllineaAmz(this.apFull, new ArticoloCR()); + } + } + + public ResParm importGiornalieroXls(String l_fileName) { + boolean debug = false; + boolean salvaArticoloNuovo = true; + boolean isNuovo = false; + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + StringBuilder scartoCodici = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + HashSet hsMarche = new HashSet<>(); + HashSet hsTipi = new HashSet<>(); + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + if (debug) + l_fileName = "/Users/acolzi/Downloads/Listino-Storageaaaa2.xlsx"; + XLSFileReader xfr = new XLSFileReader(l_fileName); + Articolo bean = new Articolo(this.apFull); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ESPRINET ", ": Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 1973L); + String currentLine = ""; + try { + Marca marca = new Marca(this.apFull); + Calendar cal = Calendar.getInstance(); + String l_descrizioneTecnica = ""; + boolean isPromo = false; + Articolo art = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + xfr.nextRecord(); + while (xfr.nextRecord()) { + isNuovo = false; + isPromo = false; + String l_marcaDesc = xfr.getField(5); + marca.findByDescrizioneImport(l_marcaDesc); + if (marca.getId_marca() > 0L) { + long dispoL; + double prezzo, streetprice; + if (!hsMarche.contains(Long.valueOf(marca.getId_marca()))) { + hsMarche.add(Long.valueOf(marca.getId_marca())); + System.out.println("NUOVA marca GESTITA: " + l_marcaDesc); + } + String l_articoloCodiceFornitore = xfr.getField(0).trim(); + String l_articoloCodiceAlternativoFornitore = "ES_" + l_articoloCodiceFornitore; + String l_articoloCodiceProduttore = xfr.getField(1).trim(); + String l_codiceEan = xfr.getField(2).trim(); + if (l_codiceEan.equals("0000000000000") || l_codiceEan.indexOf("99999999") >= 0) + l_codiceEan = ""; + String l_categoriaImport = xfr.getField(7).trim(); + if (!xfr.getField(7).trim().equals(xfr.getField(9).trim())) + l_categoriaImport = l_categoriaImport + " " + l_categoriaImport; + art.resetBean(); + String l_nome = xfr.getField(3).trim(); + l_nome = l_nome.replace("Ñ", ""); + if (debug && + l_articoloCodiceFornitore.equals("MZ-V7S250BW")) + System.out.println("cod prod: " + l_articoloCodiceFornitore); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(1973L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + if (art.getId_articolo() == 0L && !l_codiceEan.isEmpty()) { + if (l_codiceEan.length() < 13) + l_codiceEan = DBAdapter.zeroLeft(l_codiceEan, 13); + art.findByCodiceEanSerie(l_codiceEan, serie); + if (art.getId_articolo() == 0L && !l_articoloCodiceProduttore.isEmpty()) + art.findByCodiceProduttoreMarca(l_articoloCodiceProduttore, marca.getId_marca()); + } + String urlImmagine = ""; + String appoggiaPrezzo = xfr.getField(15).trim(); + appoggiaPrezzo = appoggiaPrezzo.replaceAll("[^0-9,]", ""); + String appoggiaStreetPrice = xfr.getField(14).trim(); + appoggiaStreetPrice = appoggiaStreetPrice.replaceAll("[^0-9,]", ""); + String dispo = xfr.getField(10).trim(); + l_descrizioneTecnica = ""; + try { + prezzo = Double.valueOf(appoggiaPrezzo.replace(',', '.')); + streetprice = Double.valueOf(appoggiaStreetPrice.replace(',', '.')); + dispoL = (long)Double.parseDouble(dispo); + long dispoTotL = dispoL; + if (dispoTotL > 0L) { + salvaArticoloNuovo = true; + } else { + salvaArticoloNuovo = false; + } + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato: " + appoggiaPrezzo + "\n" + currentLine + "\n"); + recordErrati++; + continue; + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (art.getId_tipo() != 1L && !hsTipi.contains(Long.valueOf(art.getId_tipo()))) + hsTipi.add(Long.valueOf(art.getId_tipo())); + if (debug); + art.aggiornaCodiciAlternativi(false); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCategoriaImport().indexOf(l_categoriaImport) < 0) + art.setCategoriaImport(art.getCategoriaImport() + art.getCategoriaImport()); + if (marca.getId_marca() > 0L && art.getId_marca() == 0L) + art.setId_marca(marca.getId_marca()); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } else if (salvaArticoloNuovo) { + double percentualeRicarico; + isNuovo = true; + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + art.setNome(l_nome); + art.setDescrizione(l_nome); + art.setCodiceEan(l_codiceEan); + art.setCategoriaImport(l_categoriaImport); + art.setId_marca(marca.getId_marca()); + art.setFlgEscludiWebArt(1L); + art.setCostoNetto(prezzo); + art.setFlgModImportazione(1L); + if (prezzo <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setNome(l_nome); + art.setDescrizione(l_nome); + art.setCodiceEan(l_codiceEan); + art.setId_marca(0L); + art.setFlgEscludiWebArt(1L); + art.setCostoNetto(prezzo); + art.setFlgModImportazione(1L); + if (prezzo <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCodiciAlternativi().length() > 50) + System.out.println(art.getCodice() + " " + art.getCodice()); + if (marca.getId_marca() > 0L) + art.setId_marca(marca.getId_marca()); + art.setId_fornitoreCostoNuovo(1973L); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + if (rp.getStatus()) { + DoubleOperator prezzoPubblico = new DoubleOperator(percentualeRicarico); + prezzoPubblico.setScale(2, 5); + prezzoPubblico.divide(100.0F); + prezzoPubblico.add(1); + prezzoPubblico.multiply(prezzo); + if (streetprice > 0.0D && prezzoPubblico.getResult() > streetprice) + prezzoPubblico = new DoubleOperator(streetprice); + ListinoArticolo lab = art.getListinoArticoloBase(); + if (prezzoPubblico.getResult() != lab.getPrezzoIvaLA()) { + System.out.println("Articolo " + art.getCodice() + " prezzo cambiato da " + lab.getPrezzoIvaLA() + " a " + + prezzoPubblico.getResult()); + lab.setPrezzoLA(prezzoPubblico.getResult()); + lab.save(); + } + art.setStreetPrice(streetprice); + if (art.getPrezzoArticolo(null).getPrezzoBase() > streetprice) { + ListinoArticolo listinoArticoloBase = art.getListinoArticoloBase(); + System.out.println(listinoArticoloBase.getId_listinoArticolo()); + listinoArticoloBase.setPrezzoLA(streetprice); + rp = listinoArticoloBase.save(); + } + if (!l_descrizioneTecnica.isEmpty()) + art.setDescTxtLang("descrizioneCommerciale", "it", l_descrizioneTecnica); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + } + if (!rp.getStatus()) { + err.append("Art. Nuovo: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + artNuovoKO++; + } else { + artNuovo++; + if (urlImmagine != null && !urlImmagine.isEmpty() && urlImmagine.endsWith(".jpg")) + art.caricaImmaginaDaRemoto(urlImmagine); + } + } else { + artNuovoNonSalvato++; + } + if (art.getId_articolo() > 0L && prezzo > 0.0D) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(1973L, art.getId_articolo(), -1L); + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(1973L); + af.setCostoVecchio(af.getCostoTotale()); + af.setCosto(prezzo); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + af.setCodiceFornitore(l_articoloCodiceFornitore); + af.setStreetPrice(streetprice); + af.setDispSede(dispoL); + af.setFlgPromo(isPromo ? 1L : 0L); + rp = af.save(); + if (rp.getStatus()) { + art.aggiornaPrezziEDispoByFornitori(streetprice, isNuovo); + if (art.getFlgModImportazione() == 2L) { + prezzoModificato++; + } else if (art.getFlgModImportazione() == 3L) { + prezzoNonModificato++; + } + if (art.getFlgEscludiWebArt() == 2L) { + articoloSospeso++; + } else if (art.getFlgEscludiWebArt() == 0L) { + articoloVisibile++; + } + } + } + } else { + artEscluso++; + System.out.println("marca scartata: " + l_marcaDesc); + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Large: Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE ESPRINET " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ESPRINET ", sb.toString()); + } + rp = Articolo.updateArticoloNonTrovati(this.apFull, "IMPORT ESPRINET ", 1973L, hsMarche, hsTipi); + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! IMPORT ESPRINET record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ESPRINET ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import Articolo e Prezzi ESPRINET " + serie + " avvenuta correttamente. - File:" + l_fileName + " - Record processati: "); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + sb.append(" - Update articoli non trovati: - "); + sb.append(rp.getMsg()); + sb.append(" - DEBUG ESPRINTET SCARTO CODICI: - "); + sb.append(scartoCodici.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import Articolo e Prezzi ESPRINET " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + + public ResParm importGiornalieroCSV(String l_fileName) { + boolean debug = false; + boolean salvaArticoloNuovo = true; + boolean isNuovo = false; + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + long SOSPENDI_DOPO_N_GG = this.apFull.getParm("CC_SOSPENDI_DOPO_N_GG_NO_IMPORT").getNumeroLong(); + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/large.csv"; + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ESPRINET ", ":xxx Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 1973L); + String currentLine = ""; + try { + Marca marca = new Marca(this.apFull); + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + reader.readLine(); + Calendar cal = Calendar.getInstance(); + String l_descrizioneTecnica = ""; + boolean isPromo = false; + Articolo art = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + while ((currentLine = reader.readLine()) != null) { + isNuovo = false; + isPromo = false; + StringTokenizer st = new StringTokenizer(currentLine, ";", '"'); + if (st.countToken() >= 6) { + String l_marcaDesc = st.getToken(5); + marca.findByDescrizioneImport(l_marcaDesc); + if (marca.getId_marca() > 0L) { + long dispoL; + double prezzo, streetprice; + String l_articoloCodiceFornitore = st.getToken(0).trim(); + String l_articoloCodiceAlternativoFornitore = "ES_" + l_articoloCodiceFornitore; + String l_articoloCodiceProduttore = st.getToken(1).trim(); + String l_codiceEan = st.getToken(2).trim(); + if (l_codiceEan.length() < 13) + l_codiceEan = DBAdapter.zeroLeft(l_codiceEan, 13); + if (l_codiceEan.equals("0000000000000") || l_codiceEan.indexOf("99999999") >= 0) + l_codiceEan = ""; + art.resetBean(); + if (debug && + l_articoloCodiceAlternativoFornitore.equals("CG_7DB75EA")) + System.out.println(l_articoloCodiceAlternativoFornitore); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(1973L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + if (art.getId_articolo() == 0L && !l_codiceEan.isEmpty()) + art.findByCodiceEanSerie(l_codiceEan, serie); + if (art.getId_articolo() == 0L && !l_articoloCodiceProduttore.isEmpty()) + art.findByCodiceProduttoreMarca(l_articoloCodiceProduttore, marca.getId_marca()); + String urlImmagine = ""; + if (st.countToken() > 7); + String l_nome = st.getToken(3).trim(); + String appoggiaPrezzo = st.getToken(15).trim(); + appoggiaPrezzo = appoggiaPrezzo.replaceAll("[^0-9,]", ""); + String appoggiaStreetPrice = st.getToken(14).trim(); + appoggiaStreetPrice = appoggiaStreetPrice.replaceAll("[^0-9,]", ""); + String dispo = st.getToken(10).trim(); + l_descrizioneTecnica = ""; + try { + prezzo = Double.valueOf(appoggiaPrezzo.replace(',', '.')); + streetprice = Double.valueOf(appoggiaStreetPrice.replace(',', '.')); + dispoL = Long.parseLong(dispo); + long dispoTotL = dispoL; + if (dispoTotL > 0L) { + salvaArticoloNuovo = true; + } else { + salvaArticoloNuovo = false; + } + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato:" + appoggiaPrezzo + "\n" + currentLine + "\n"); + recordErrati++; + continue; + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (debug); + art.aggiornaCodiciAlternativi(false); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCodiciAlternativi().length() > 50) + System.out.println(art.getCodice() + " " + art.getCodice()); + if (marca.getId_marca() > 0L && art.getId_marca() == 0L) + art.setId_marca(marca.getId_marca()); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } else if (salvaArticoloNuovo) { + double percentualeRicarico; + isNuovo = true; + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + art.setNome(l_nome); + art.setDescrizione(l_nome); + art.setCodiceEan(l_codiceEan); + art.setId_marca(marca.getId_marca()); + art.setFlgEscludiWebArt(1L); + art.setCostoNetto(prezzo); + art.setFlgModImportazione(1L); + if (prezzo <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setNome(l_nome); + art.setDescrizione(l_nome); + art.setCodiceEan(l_codiceEan); + art.setId_marca(0L); + art.setFlgEscludiWebArt(1L); + art.setCostoNetto(prezzo); + art.setFlgModImportazione(1L); + if (prezzo <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCodiciAlternativi().length() > 50) + System.out.println(art.getCodice() + " " + art.getCodice()); + if (marca.getId_marca() > 0L) + art.setId_marca(marca.getId_marca()); + art.setId_fornitoreCostoNuovo(1973L); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + if (rp.getStatus()) { + DoubleOperator prezzoPubblico = new DoubleOperator(percentualeRicarico); + prezzoPubblico.setScale(2, 5); + prezzoPubblico.divide(100.0F); + prezzoPubblico.add(1); + prezzoPubblico.multiply(prezzo); + if (streetprice > 0.0D && prezzoPubblico.getResult() > streetprice) + prezzoPubblico = new DoubleOperator(streetprice); + ListinoArticolo lab = art.getListinoArticoloBase(); + if (prezzoPubblico.getResult() != lab.getPrezzoIvaLA()) { + System.out.println("Articolo " + art.getCodice() + " prezzo cambiato da " + + lab.getPrezzoIvaLA() + " a " + prezzoPubblico.getResult()); + lab.setPrezzoLA(prezzoPubblico.getResult()); + lab.save(); + } + art.setStreetPrice(streetprice); + if (art.getPrezzoArticolo(null).getPrezzoBase() > streetprice) { + ListinoArticolo listinoArticoloBase = art.getListinoArticoloBase(); + System.out.println(listinoArticoloBase.getId_listinoArticolo()); + listinoArticoloBase.setPrezzoLA(streetprice); + rp = listinoArticoloBase.save(); + } + if (!l_descrizioneTecnica.isEmpty()) + art.setDescTxtLang("descrizioneCommerciale", "it", l_descrizioneTecnica); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + } + if (!rp.getStatus()) { + err.append("Art. Nuovo: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + artNuovoKO++; + } else { + artNuovo++; + if (urlImmagine != null && !urlImmagine.isEmpty() && urlImmagine.endsWith(".jpg")) + art.caricaImmaginaDaRemoto(urlImmagine); + } + } else { + artNuovoNonSalvato++; + } + if (art.getId_articolo() > 0L && prezzo > 0.0D) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(1973L, art.getId_articolo(), -1L); + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(1973L); + af.setCostoVecchio(af.getCostoTotale()); + af.setCosto(prezzo); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + af.setCodiceFornitore(l_articoloCodiceFornitore); + af.setStreetPrice(streetprice); + af.setDispSede(dispoL); + af.setFlgPromo(isPromo ? 1L : 0L); + rp = af.save(); + if (rp.getStatus()) { + art.aggiornaPrezziEDispoByFornitori(streetprice, isNuovo); + if (art.getFlgModImportazione() == 2L) { + prezzoModificato++; + } else if (art.getFlgModImportazione() == 3L) { + prezzoNonModificato++; + } + if (art.getFlgEscludiWebArt() == 2L) { + articoloSospeso++; + } else if (art.getFlgEscludiWebArt() == 0L) { + articoloVisibile++; + } + } + } + } else { + artEscluso++; + System.out.println("marca scartata: " + l_marcaDesc); + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Large: Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE ESPRINET " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ESPRINET ", sb.toString()); + } + if (SOSPENDI_DOPO_N_GG > 0L) + bean.update("UPDATE ARTICOLO SET flgEscludiWebArt=2,flgEscludiWeb=2 WHERE codice LIKE '" + serie + "%' and flgModImportazione = 0 and DATEDIFF(CURDATE(), dataUltimoImport)>=" + SOSPENDI_DOPO_N_GG + ";"); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! IMPORT ESPRINET record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT ESPRINET ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import Articolo e Prezzi ESPRINET " + serie + " avvenuta correttamente. Record processati: "); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import Articolo e Prezzi ESPRINET " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + } + + class ThreadGoogleFtp extends Thread { + private ApplParmFull apFull; + + private ArticoloCR CR; + + private final String TAG_THREAD_MSG = "GOOGLE MERCHANT FTP "; + + public ThreadGoogleFtp(ApplParmFull apFull, ArticoloCR CR) { + this.apFull = apFull; + this.CR = CR; + if (!CCImport.isThreadGoogleMerchant()) { + CCImport.threadGoogleMerchant = true; + start(); + } + } + + public void run() { + boolean debug = false; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.apFull, "GOOGLE MERCHANT FTP ", "...inizio ..."); + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("##############\n GOOGLE MERCHANT FTP \nSTART: " + start.toString()); + ResParm rp = new ResParm(true); + Articolo articolo = new Articolo(this.apFull); + rp = articolo.creaFileXmlGoogle(this.CR, true, false); + if (rp.getStatus()) { + String temp = (String)rp.getReturnObj(); + String fileDainviare = articolo.getDocBase() + articolo.getDocBase() + this.apFull.getParm("PATH_TMP").getTesto(); + String fileRemoto = this.CR.getFileNameGoogle(); + String user = this.apFull.getParm("GOOGLE_FTP_USER").getTesto(); + String pass = this.apFull.getParm("GOOGLE_FTP_PASSWORD").getTesto(); + if (!articolo.isLocalhost()) { + DBAdapter.sendFileViaSFtp("partnerupload.google.com", 19321, "[partnerupload.google.com]:19321 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDUvACPnrXEiscmd7NoP7diO1w3uP9uGJ55/SDL5eviKZhy/WLTLMGRcJDWj3GPRVdAy2xVVOU4IxUIK8nxdZP5O0s5bJVzT2XRP4IXYKUrPn7AkQlnifP7M0InAMnK7S1KHvwBgWBaGfb0OBeI46a+iKBduCMD9xER6ymTVbcgNzt1o52vNGTUiQp28Q5jUBs3yvQ8Ag7d4U0qEioV95ef4AbjDwO8jV09hQGjBIsTZoMo2Tmo+FVKah2YO0+QFKe1pk5zL2nXlgF7hUxN65lIeS3PhRZzVF80Qe5vXjjuKfiJVkBdSxLoq84uXx6XCjvWci2JbTUbsavoaDO3VBy5", user, pass, fileDainviare, fileRemoto); + } else { + StatusMsg.updateMsgByTag(this.apFull, "GOOGLE MERCHANT FTP ", "Invio file ftp google annullato (localhost):\n" + rp.getMsg()); + } + } else { + StatusMsg.updateMsgByTag(this.apFull, "GOOGLE MERCHANT FTP ", "Creazione file google xml fallito:\n" + rp.getMsg()); + } + timer.stop(); + StatusMsg.updateMsgByTag(this.apFull, "GOOGLE MERCHANT FTP ", "Invio concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.apFull, "GOOGLE MERCHANT FTP "); + CCImport.threadGoogleMerchant = false; + System.out.println(rp.getMsg()); + } + } + + class ThreadImportDatamatic extends Thread { + private ApplParmFull apFull; + + private final String TAG_THREAD_MSG = "CHECK MAIL DATAMATIC "; + + private boolean sendEmail; + + private static final long l_id_fornitore = 1971L; + + private boolean DEBUG_CK_MAIL_DM = false; + + private String fileCsvlarge; + + private static final long l_id_tipoDaDafinire = 1L; + + public ThreadImportDatamatic(ApplParmFull apFull, String fileXls, boolean sendEmail) { + this.apFull = apFull; + this.fileCsvlarge = fileXls; + this.sendEmail = sendEmail; + if (!CCImport.isThreadDatamaticAttivo()) { + CCImport.threadImportDatamatic = true; + start(); + } + } + + public ThreadImportDatamatic(ApplParmFull apFull, boolean sendMail) { + this.apFull = apFull; + this.sendEmail = sendMail; + if (!CCImport.isThreadDatamaticAttivo()) { + CCImport.threadImportDatamatic = true; + start(); + } + } + + public void run() { + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL DATAMATIC ", "...inizio ..."); + boolean debug = false; + String serie = ""; + System.out.println("##############\nIMPORT ALSO " + serie + "\nSTART: " + String.valueOf(timer.getTStart())); + ResParm rp = new ResParm(true); + if (this.fileCsvlarge != null && !this.fileCsvlarge.isEmpty()) { + BufferedReader reader = null; + String targetDir = this.apFull.getParm("DOCBASE").getTesto() + this.apFull.getParm("DOCBASE").getTesto(); + String fileCsv = this.fileCsvlarge.substring(this.fileCsvlarge.lastIndexOf('/') + 1); + String l_fileName = this.fileCsvlarge; + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/" + fileCsv; + boolean isLarge = false, isUtenteFinale = false, isXls = false; + if (l_fileName.toLowerCase().endsWith("xls")) { + isXls = true; + } else { + try { + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + String currentLine = reader.readLine(); + StringTokenizer st = new StringTokenizer(currentLine, ";", '"'); + if (st.countToken() == 8) { + isLarge = true; + } else if (st.countToken() == 12) { + isUtenteFinale = true; + } + } + } catch (Exception e) { + rp.setStatus(false); + rp.setException(e); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + } + if (rp.getStatus()) { + if (isXls) + rp = importXls(l_fileName); + if (isLarge) { + rp = importLarge(l_fileName); + } else if (isUtenteFinale) { + rp = importUtenteFinale(l_fileName); + } + } + timer.stop(); + rp.setMsg("Import concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + if (this.sendEmail) + CCImport.this.sendArticoliCambiatiByEmail(this.apFull, rp.getMsg(), 1971L); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL DATAMATIC ", rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.apFull, "CHECK MAIL DATAMATIC "); + CCImport.threadImportDatamatic = false; + System.out.println(rp.getMsg()); + } else { + MailAccount account = new MailAccount("mail.acxent.it", "acx-ammi", "Pinocchio9901!"); + if (!this.DEBUG_CK_MAIL_DM) { + rp = fetchMessages(account, DBAdapter.getToday()); + } else { + rp.setStatus(true); + String l_file = "/Users/acolzi/Documents/webapps/cc/_tmp/AAAdatam.XLS"; + l_file = "/Users/acolzi/Downloads/FLX3933324.XLS"; + rp.setMsg(l_file); + } + if (rp.getStatus()) { + System.out.println(rp.getMsg()); + String fileXLS = rp.getMsg(); + importXls(fileXLS); + } + System.out.println("############FINE IMPORT DATAMATIC"); + timer.stop(); + rp.setMsg("Import concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + if (this.sendEmail) { + System.out.println("############ invio mail DATAMATIC"); + CCImport.this.sendArticoliCambiatiByEmail(this.apFull, rp.getMsg(), 1971L); + System.out.println("############ invio mail DATAMATIC fatto?????"); + } + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL DATAMATIC ", rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.apFull, "CHECK MAIL DATAMATIC "); + CCImport.threadImportDatamatic = false; + System.out.println(rp.getMsg()); + if (CCImport.this.getAttivita(this.apFull).getFlgEbay() == 1L) { + Articolo bean = new Articolo(this.apFull); + bean.startThreadAllineaEbay(this.apFull, new ArticoloCR()); + } + if (CCImport.this.getAttivita(this.apFull).getFlgAmz() == 1L) { + Articolo bean = new Articolo(this.apFull); + bean.startThreadAllineaAmz(this.apFull, new ArticoloCR()); + } + } + } + + public ResParm fetchMessages(MailAccount account, Date theDate) { + ResParm rp = new ResParm(true); + MailService mailService = new MailService(account.getMailServer(), account.getMailUser(), account.getMailPassword()); + rp = mailService.login(); + int messageCount = 0, messageSaved = 0; + if (rp.getStatus()) + try { + String from = "info@ALSOTECHNOLOGYMILANO.IT"; + String theSubject = "Listino Also elaborato in XLS"; + Calendar cal = Calendar.getInstance(); + String fileNameXls = "DM_" + String.valueOf(cal.getTimeInMillis()) + ".xls"; + String destFile = this.apFull.getParm("DOCBASE").getTesto() + this.apFull.getParm("DOCBASE").getTesto() + this.apFull.getParm("PATH_TMP").getTesto(); + Message[] messages = mailService.getMessages(theDate); + rp.setStatus(false); + rp.setMsg("Mail also non trovata"); + System.out.println("message id fromAddress subject"); + for (int i = 0; i < messages.length; i++) { + messageCount++; + String text = ""; + String messageId = ""; + String subject = ""; + try { + messageId = messages[i].getHeader("Message-ID")[0]; + } catch (Exception e) {} + if (messageId == null || messageId.isEmpty()) { + MimeMessage cmsg = new MimeMessage(mailService.getMimeMessages(i)); + messageId = cmsg.getMessageID(); + } + subject = messages[i].getSubject(); + Address[] fromAddress = messages[i].getFrom(); + InternetAddress address = (InternetAddress)fromAddress[0]; + String temp = messageId + " " + messageId + " " + String.valueOf(messages[i].getSentDate()) + " " + String.valueOf(address); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL DATAMATIC ", temp); + System.out.println(temp); + if (subject.indexOf(theSubject) >= 0) { + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL DATAMATIC ", "Trovata mail con oggetto " + theSubject); + String contentType = messages[i].getContentType(); + String messageContent = ""; + String attachFiles = ""; + if (contentType.contains("multipart")) { + Multipart multiPart = (Multipart)messages[i].getContent(); + int numberOfParts = multiPart.getCount(); + for (int partCount = 0; partCount < numberOfParts; partCount++) { + MimeBodyPart part = (MimeBodyPart)multiPart.getBodyPart(partCount); + if ("attachment".equalsIgnoreCase(part.getDisposition())) { + String fileName = part.getFileName(); + attachFiles = attachFiles + attachFiles + ", "; + part.saveFile(destFile); + } else { + messageContent = part.getContent().toString(); + } + } + if (attachFiles.length() > 1) + attachFiles = attachFiles.substring(0, attachFiles.length() - 2); + } + if (new File(destFile).exists()) { + rp.setStatus(true); + rp.setMsg(destFile); + break; + } + break; + } + } + mailService.logout(); + } catch (Exception e) { + e.printStackTrace(); + rp.setException(e); + rp.setStatus(false); + } + return rp; + } + + public ResParm importXls(String l_fileName) { + boolean salvaArticoloNuovo = true; + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + boolean isNuovo = false; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + HashSet hsMarche = new HashSet<>(); + HashSet hsTipi = new HashSet<>(); + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + String fileCsv = l_fileName + ".csv"; + if (!this.DEBUG_CK_MAIL_DM) { + rp = DBAdapter.convertXlsToCsv(this.apFull, l_fileName, fileCsv); + } else { + rp.setStatus(true); + } + if (rp.getStatus()) { + l_fileName = fileCsv; + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + if (this.DEBUG_CK_MAIL_DM) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/largeXLS.csv"; + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL DATAMATIC ", "Large XLS: Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 1971L); + int colCodiceVendor = 0; + int colCodiceEan = -1; + int colCodiceFornitore = 1; + int colNome = 2; + int colPrezzo = 5; + int colPrezzoPromo = 6; + int colDispoCentrale = 3; + int colDispoCash = 4; + String currentLine = ""; + try { + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + reader.readLine(); + Calendar cal = Calendar.getInstance(); + String l_codiceEan = ""; + String l_descrizioneTecnica = ""; + boolean isPromo = false; + while ((currentLine = reader.readLine()) != null) { + isPromo = false; + StringTokenizer st = new StringTokenizer(currentLine, ";", '"'); + if (st.countToken() >= 6) { + long dispoL, dispoCashL; + double prezzo; + String l_articoloCodiceFornitore = st.getToken(colCodiceFornitore).trim(); + String l_articoloCodiceAlternativoFornitore = "DM_" + l_articoloCodiceFornitore; + String l_articoloCodiceProduttore = st.getToken(colCodiceVendor).trim(); + Articolo art = new Articolo(this.apFull); + if (this.DEBUG_CK_MAIL_DM && + l_articoloCodiceAlternativoFornitore.equals("DM_400AJPC")) + System.out.println(l_articoloCodiceAlternativoFornitore); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(1971L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + if (art.getId_articolo() == 0L && !l_articoloCodiceProduttore.isEmpty()) + art.findByCodiceProduttore(l_articoloCodiceProduttore); + String urlImmagine = ""; + if (st.countToken() > 7); + String l_nome = st.getToken(colNome).trim(); + String appoggiaPrezzo = st.getToken(colPrezzo).trim(); + if (!st.getToken(colPrezzoPromo).trim().equals("0,00")) + isPromo = true; + String dispo = st.getToken(colDispoCentrale).trim(); + String dispoCash = st.getToken(colDispoCash).trim(); + l_descrizioneTecnica = ""; + try { + prezzo = Double.valueOf(appoggiaPrezzo.replace(',', '.')); + dispoL = Long.parseLong(dispo); + dispoCashL = Long.parseLong(dispoCash); + long dispoTotL = dispoL + dispoCashL; + if (dispoTotL > 0L) { + salvaArticoloNuovo = true; + } else { + salvaArticoloNuovo = false; + } + } catch (Exception e) { + err.append("Record scartato prezzo errato:" + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato: " + appoggiaPrezzo + "\n" + currentLine + "\n"); + continue; + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (art.getId_tipo() != 1L && !hsTipi.contains(Long.valueOf(art.getId_tipo()))) + hsTipi.add(Long.valueOf(art.getId_tipo())); + if (this.DEBUG_CK_MAIL_DM); + art.aggiornaCodiciAlternativi(false); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } else { + artNuovoNonSalvato++; + } + if (art.getId_articolo() > 0L && prezzo > 0.0D) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(1971L, art.getId_articolo(), -1L); + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(1971L); + af.setCostoVecchio(af.getCostoTotale()); + af.setCosto(prezzo); + af.setStreetPrice(af.getStreetPrice()); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + af.setCodiceFornitore(l_articoloCodiceFornitore); + af.setDispCash(dispoCashL); + af.setDispSede(dispoL); + af.setFlgPromo(isPromo ? 1L : 0L); + rp = af.save(); + if (rp.getStatus()) { + art.aggiornaPrezziEDispoByFornitori(0.0D, isNuovo); + if (art.getFlgModImportazione() == 2L) { + prezzoModificato++; + } else if (art.getFlgModImportazione() == 3L) { + prezzoNonModificato++; + } + if (art.getFlgEscludiWebArt() == 2L) { + articoloSospeso++; + } else if (art.getFlgEscludiWebArt() == 0L) { + articoloVisibile++; + } + } + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Large xls MAIL: Record processati: "); + if (this.DEBUG_CK_MAIL_DM) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE DATAMATIC " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL DATAMATIC ", sb.toString()); + } + rp = Articolo.updateArticoloNonTrovati(this.apFull, "CHECK MAIL DATAMATIC ", 1971L, hsMarche, hsTipi); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! CHECK MAIL DATAMATIC record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL DATAMATIC ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import Articolo e Prezzi DATAMATIC " + serie + " avvenuta correttamente. Record processati: "); + sb.append(i); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + sb.append(" - Update articoli non trovati: - "); + sb.append(rp.getMsg()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import Articolo e Prezzi DATAMATIC " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + + private ResParm importLargeDatamaticFromFileXls(String fileCsvlarge, String serie) { + ResParm rp = new ResParm(true); + rp = importXls(fileCsvlarge); + return rp; + } + + public ResParm importLarge(String l_fileName) { + boolean debug = false; + boolean salvaArticoloNuovo = true; + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + long SOSPENDI_DOPO_N_GG = this.apFull.getParm("CC_SOSPENDI_DOPO_N_GG_NO_IMPORT").getNumeroLong(); + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/large.csv"; + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL DATAMATIC ", "Large: Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 1971L); + String currentLine = ""; + int colCodiceVendor = 0; + int colCodiceEan = 1; + int colCodiceFornitore = 2; + int colNome = 3; + int colPrezzo = 6; + int colPrezzoPromo = 7; + int colDispoCentrale = 4; + int colDispoCash = 5; + try { + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + reader.readLine(); + Calendar cal = Calendar.getInstance(); + String l_descrizioneTecnica = ""; + boolean isPromo = false; + while ((currentLine = reader.readLine()) != null) { + isPromo = false; + StringTokenizer st = new StringTokenizer(currentLine, ";", '"'); + if (st.countToken() >= 6) { + long dispoL, dispoCashL, dispoTotL; + double prezzo; + String l_articoloCodiceFornitore = st.getToken(colCodiceFornitore).trim(); + String l_articoloCodiceAlternativoFornitore = "DM_" + l_articoloCodiceFornitore; + String l_articoloCodiceProduttore = st.getToken(colCodiceVendor).trim(); + String l_codiceEan = st.getToken(colCodiceEan).trim(); + if (l_codiceEan.length() < 13) + l_codiceEan = DBAdapter.zeroLeft(l_codiceEan, 13); + if (l_codiceEan.equals("0000000000000") || l_codiceEan.indexOf("99999999") >= 0) + l_codiceEan = ""; + Articolo art = new Articolo(this.apFull); + if (debug && + l_articoloCodiceAlternativoFornitore.equals("CG_7DB75EA")) + System.out.println(l_articoloCodiceAlternativoFornitore); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(1971L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + if (art.getId_articolo() == 0L && !l_codiceEan.isEmpty()) + art.findByCodiceEanSerie(l_codiceEan, serie); + String urlImmagine = ""; + if (st.countToken() > 7); + String l_nome = st.getToken(colNome).trim(); + String appoggiaPrezzo = st.getToken(colPrezzo).trim(); + if (!st.getToken(colPrezzoPromo).trim().equals("0,00")) + isPromo = true; + String dispo = st.getToken(colDispoCentrale).trim(); + String dispoCash = st.getToken(colDispoCash).trim(); + l_descrizioneTecnica = ""; + try { + prezzo = Double.valueOf(appoggiaPrezzo.replace(',', '.')); + dispoL = Long.parseLong(dispo); + dispoCashL = Long.parseLong(dispoCash); + dispoTotL = dispoL + dispoCashL; + if (dispoTotL > 0L) { + salvaArticoloNuovo = true; + } else { + salvaArticoloNuovo = false; + } + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato: " + appoggiaPrezzo + "\n" + currentLine + "\n"); + continue; + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (debug); + if (dispoTotL > 0L) { + if (art.getCostoNetto() != prezzo) { + art.setFlgModImportazione(2L); + prezzoModificato++; + } else { + art.setCostoNuovo(0.0D); + art.setFlgModImportazione(3L); + prezzoNonModificato++; + } + double streetprice = art.getStreetPrice(); + } else { + art.setFlgModImportazione(3L); + prezzoNonModificato++; + } + art.aggiornaCodiciAlternativi(false); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } else { + artNuovoNonSalvato++; + } + if (art.getId_articolo() > 0L && prezzo > 0.0D) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(1971L, art.getId_articolo(), -1L); + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(1971L); + af.setCostoVecchio(af.getCostoTotale()); + af.setCosto(prezzo); + af.setStreetPrice(af.getStreetPrice()); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + af.setCodiceFornitore(l_articoloCodiceFornitore); + af.setDispCash(dispoCashL); + af.setDispSede(dispoL); + af.setFlgPromo(isPromo ? 1L : 0L); + rp = af.save(); + if (rp.getStatus()) { + double dispoF = af.getDispoFornitoriByArticolo(art.getId_articolo()); + art.setQuantita(dispoF); + if (dispoF == 0.0D) { + if (art.getFlgEscludiWebArt() == 0L) { + art.setFlgEscludiWebArt(2L); + articoloSospeso++; + } + } else if (art.getFlgEscludiWebArt() == 2L && art.getId_tipo() > 0L) { + art.setFlgEscludiWebArt(0L); + articoloVisibile++; + } + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + art.superSave(); + } + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Large: Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE DATAMATIC " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL DATAMATIC ", sb.toString()); + } + if (SOSPENDI_DOPO_N_GG > 0L) + bean.update("UPDATE ARTICOLO SET flgEscludiWebArt=2,flgEscludiWeb=2 WHERE codice LIKE '" + serie + "%' and flgModImportazione = 0 and DATEDIFF(CURDATE(), dataUltimoImport)>=" + SOSPENDI_DOPO_N_GG + ";"); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! CHECK MAIL DATAMATIC record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL DATAMATIC ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import Articolo e Prezzi DATAMATIC " + serie + " avvenuta correttamente. Record processati: "); + sb.append(i); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import Articolo e Prezzi DATAMATIC " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + + public ResParm importUtenteFinale(String l_fileName) { + boolean debug = false; + boolean salvaArticoloNuovo = true; + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/utenteFinale.csv"; + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL DATAMATIC ", "Utente Finale: Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 1971L); + String currentLine = ""; + try { + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + reader.readLine(); + String l_descrizioneTecnica = ""; + Marca marca = new Marca(this.apFull); + while ((currentLine = reader.readLine()) != null) { + StringTokenizer st = new StringTokenizer(currentLine, ";", '"'); + if (st.countToken() >= 12) { + String l_marcaDesc = st.getToken(3); + marca.findByDescrizioneImport(l_marcaDesc); + if (marca.getId_marca() > 0L) { + double streetprice; + String l_articoloCodiceFornitore = st.getToken(0).trim(); + String l_articoloCodiceAlternativoFornitore = "DM_" + l_articoloCodiceFornitore; + Articolo art = new Articolo(this.apFull); + if (debug && + l_articoloCodiceAlternativoFornitore.equals("DM_HPW1A53A")) + System.out.println(l_articoloCodiceAlternativoFornitore); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(1971L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + String urlImmagine = ""; + if (st.countToken() > 7); + String l_nome = st.getToken(1).trim(); + String appoggiaStreetPrice = st.getToken(9).trim(); + try { + streetprice = Double.valueOf(appoggiaStreetPrice.replace(',', '.')); + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato: " + appoggiaStreetPrice + "\n" + currentLine + "\n"); + continue; + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (debug); + if (art.getCodice().equals("0000004221")) + System.out.println(l_articoloCodiceFornitore); + if (streetprice > 0.0D && art.getStreetPrice() != streetprice) { + art.setStreetPrice(streetprice); + if (streetprice <= 0.0D || art.getPrezzoArticolo(null).getPrezzoBase() <= streetprice) { + art.setFlgModImportazione(3L); + prezzoNonModificato++; + } + } else { + art.setFlgModImportazione(3L); + prezzoNonModificato++; + } + if (marca.getId_marca() > 0L && art.getId_marca() == 0L) + art.setId_marca(marca.getId_marca()); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + if (rp.getStatus() && art.getId_articolo() > 0L) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(1971L, art.getId_articolo(), -1L); + if (streetprice != 0.0D && af.getStreetPrice() != streetprice) { + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(1971L); + af.setStreetPrice(streetprice); + rp = af.save(); + } + } + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } else if (salvaArticoloNuovo) { + double percentualeRicarico; + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + art.setNome(l_nome); + art.setDescrizione(l_nome); + if (marca.getId_marca() > 0L && art.getId_marca() == 0L) + art.setId_marca(marca.getId_marca()); + art.setFlgEscludiWebArt(1L); + art.setFlgModImportazione(1L); + if (streetprice <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + if (rp.getStatus()) { + ListinoArticolo lab = art.getListinoArticoloBase(); + lab.setPrezzoLA(streetprice); + lab.save(); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + } + if (!rp.getStatus()) { + err.append("Art. Nuovo: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + artNuovoKO++; + } else { + artNuovo++; + } + } else { + artNuovoNonSalvato++; + } + } else { + artEscluso++; + System.out.println("marca scartata: " + l_marcaDesc); + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Utente Finale: Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE DATAMATIC " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL DATAMATIC ", sb.toString()); + } + bean.update("UPDATE ARTICOLO SET flgEscludiWebArt=2,flgEscludiWeb=2 WHERE codice LIKE '" + serie + "%' and flgModImportazione = 0 and quantita <=0;"); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! CHECK MAIL DATAMATIC record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL DATAMATIC ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import Articolo e Prezzi DATAMATIC " + serie + " avvenuta correttamente. Record processati: "); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import Utente Finale (street price) DATAMATIC " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + } + + class ThreadImportIngramMicro extends Thread { + private static final String INGRAM_URL_FTP_LISTINO = "ftpsecure.ingrammicro.com"; + + private static final String INGRAM_URL_FTP_DISPO = "ftpsecure.ingrammicro.com"; + + private static final String INGRAM_URL_SFTP_LISTINO = "mercury.ingrammicro.com"; + + private static final String INGRAM_URL_SFTP_DISPO = "mercury.ingrammicro.com"; + + private static final String INGRAM_URL_SFTP_SIAE = "mercury.ingrammicro.com"; + + private static final String INGRAM_FTP_DIR_LISTINO = "/FUSION/IT/ABL630/"; + + private static final String INGRAM_FTP_DIR_DISPO = "/FUSION/IT/AVAIL/"; + + private static final String INGRAM_SFTP_DIR_LISTINO = "/"; + + private static final String INGRAM_SFTP_DIR_DISPO = "/AVAIL/"; + + private static final String INGRAM_SFTP_DIR_SIAE = "/"; + + private static final String INGRAM_USER = "IT630910"; + + private static final String INGRAM_PWD = "pAc6uT0P"; + + private static final String INGRAM_SFTP_PWD = "cvaTL07@0%"; + + private static final String INGRAM_FILE_DISPO = "TOTITHRL.ZIP"; + + private static final String INGRAM_FILE_LISTINO = "PRICE.ZIP"; + + private static final String INGRAM_FILE_SIAE = "ITSKUFEE.ZIP"; + + private ApplParmFull apFull; + + private boolean sendEmail; + + private long tipoImport; + + private String TAG_THREAD_MSG = "IMPORT INGRAMMICRO "; + + private static final long l_id_tipoDaDafinire = 1L; + + private static final long l_id_fornitore = 1995L; + + public ThreadImportIngramMicro(ApplParmFull apFull, long l_tipoImport, boolean sendEmail) { + this.apFull = apFull; + this.sendEmail = sendEmail; + this.tipoImport = l_tipoImport; + if (!CCImport.isThreadIngramMicroAttivo()) { + CCImport.threadImportIngramMicro = true; + start(); + } + } + + public void run() { + String fileZip; + boolean debug = false; + Timer timer = new Timer(); + timer.start(); + String server = "mercury.ingrammicro.com"; + String tipoImportS = " DISPO "; + String dirFtp = "/AVAIL/"; + String user = "IT630910"; + String pass = "cvaTL07@0%"; + String serie = ""; + if (this.tipoImport == 0L) { + server = "mercury.ingrammicro.com"; + fileZip = "PRICE.ZIP"; + dirFtp = "/"; + tipoImportS = " LISTINO "; + } else if (this.tipoImport == 1L) { + server = "mercury.ingrammicro.com"; + fileZip = "TOTITHRL.ZIP"; + dirFtp = "/AVAIL/"; + tipoImportS = " DISPO "; + } else { + server = "mercury.ingrammicro.com"; + fileZip = "ITSKUFEE.ZIP"; + dirFtp = "/"; + tipoImportS = " SIAE "; + } + this.TAG_THREAD_MSG += this.TAG_THREAD_MSG; + StatusMsg.updateMsgByTag(this.apFull, this.TAG_THREAD_MSG, "...inizio ..."); + String fileCsv = fileZip.replace(".ZIP", ".TXT"); + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("##############\nIMPORT INGRAM " + tipoImportS + " " + serie + "\nSTART: " + start.toString()); + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + HashSet hsMarche = new HashSet<>(); + HashSet hsTipi = new HashSet<>(); + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + String targetDir = this.apFull.getParm("DOCBASE").getTesto() + this.apFull.getParm("DOCBASE").getTesto(); + String l_fileName = targetDir + targetDir; + String l_fileNameZip = targetDir + targetDir; + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/" + fileCsv; + if (!debug) { + StatusMsg.updateMsgByTag(this.apFull, this.TAG_THREAD_MSG, "Download nuovo file " + fileZip); + new File(l_fileName).delete(); + new File(l_fileNameZip).delete(); + rp = DBAdapter.getFileViaSFtp(server, 21, user, pass, dirFtp + dirFtp, l_fileNameZip); + if (rp.getStatus()) + DBAdapter.unzip(l_fileNameZip, targetDir); + } + if (this.tipoImport == 0L) { + rp = importListinoCSV(l_fileName); + } else if (this.tipoImport == 1L) { + rp = importDispoCSV(l_fileName); + } else { + rp = importSiaeCSV(l_fileName); + } + timer.stop(); + rp.setMsg("Import concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + if (this.sendEmail) + CCImport.this.sendArticoliCambiatiByEmail(this.apFull, rp.getMsg(), 1995L); + StatusMsg.updateMsgByTag(this.apFull, this.TAG_THREAD_MSG, rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.apFull, this.TAG_THREAD_MSG); + CCImport.threadImportIngramMicro = false; + System.out.println(rp.getMsg()); + if (CCImport.this.getAttivita(this.apFull).getFlgEbay() == 1L) + bean.startThreadAllineaEbay(this.apFull, new ArticoloCR()); + if (CCImport.this.getAttivita(this.apFull).getFlgAmz() == 1L) + bean.startThreadAllineaAmz(this.apFull, new ArticoloCR()); + } + + public ResParm importListinoCSV(String l_fileName) { + boolean debug = false; + boolean salvaArticoloNuovo = false; + boolean isNuovo = false; + boolean isArticoloCercatoConSku = true; + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + long SOSPENDI_DOPO_N_GG = this.apFull.getParm("CC_SOSPENDI_DOPO_N_GG_NO_IMPORT").getNumeroLong(); + if (SOSPENDI_DOPO_N_GG < 6L) + SOSPENDI_DOPO_N_GG = 6L; + String CLASSE_PRODOTTO_RICONDIZIONATO = "P"; + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + Articolo art = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/PRICE1.TXT"; + StatusMsg.updateMsgByTag(this.apFull, this.TAG_THREAD_MSG, ": Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 1995L); + String currentLine = ""; + try { + Marca marca = new Marca(this.apFull); + CategoriaIngrammicro categoriaIngrammicro = new CategoriaIngrammicro(this.apFull); + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + Calendar cal = Calendar.getInstance(); + String l_descrizioneTecnica = ""; + boolean isPromo = false; + while ((currentLine = reader.readLine()) != null) { + isNuovo = false; + isPromo = false; + StringTokenizer st = new StringTokenizer(currentLine, ","); + if (st.countToken() >= 6) { + String l_action = st.getToken(0); + String l_marcaDesc = st.getToken(3); + if (l_marcaDesc.indexOf("-") > 0) + l_marcaDesc = l_marcaDesc.substring(0, l_marcaDesc.indexOf("-")).trim(); + marca.findByDescrizioneImport(l_marcaDesc); + if (marca.getId_marca() > 0L) { + String l_classeProdotto = st.getToken(17).trim(); + String l_articoloCodiceFornitore = st.getToken(1).trim(); + String l_articoloCodiceProduttore = st.getToken(7).trim(); + String l_nome = st.getToken(4).trim() + " " + st.getToken(4).trim(); + if (!l_classeProdotto.equals("P")) { + String l_categoriaImport; + double prezzo, streetprice; + String l_codiceCategoria = st.getToken(21).trim(); + categoriaIngrammicro.findByCodice(l_codiceCategoria); + if (categoriaIngrammicro.getId_categoriaIngrammiro() > 0L) { + l_categoriaImport = categoriaIngrammicro.getDescrizione(); + } else { + l_categoriaImport = ""; + } + String l_articoloCodiceAlternativoFornitore = "IM_" + l_articoloCodiceFornitore; + String l_codiceEan = st.getToken(9).trim(); + if (l_codiceEan.length() < 13) + l_codiceEan = DBAdapter.zeroLeft(l_codiceEan, 13); + if (l_codiceEan.equals("0000000000000") || l_codiceEan.indexOf("99999999") >= 0) + l_codiceEan = ""; + if (debug && + l_articoloCodiceAlternativoFornitore.equals("CG_7DB75EA")) + System.out.println(l_articoloCodiceAlternativoFornitore); + art.resetBean(); + isArticoloCercatoConSku = false; + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(1995L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) { + art = af.getArticolo(); + isArticoloCercatoConSku = true; + } + } + if (art.getId_articolo() == 0L && !l_codiceEan.isEmpty()) { + art.findByCodiceEanSerie(l_codiceEan, serie); + if (art.getId_articolo() > 0L) + isArticoloCercatoConSku = false; + } + if (art.getId_articolo() == 0L && !l_articoloCodiceProduttore.isEmpty()) { + art.findByCodiceProduttoreMarca(l_articoloCodiceProduttore, marca.getId_marca()); + if (art.getId_articolo() > 0L) + isArticoloCercatoConSku = false; + } + if (art.getId_articolo() > 0L && !isArticoloCercatoConSku) { + af.findByFornitoreArticolo(art.getId_articolo(), 1995L, 0L); + if (af.getId_articoloFornitore() > 0L && + !af.getCodiceFornitore().equals(l_articoloCodiceFornitore)) + art.resetBean(); + } + String urlImmagine = ""; + if (st.countToken() > 7); + String appoggiaPrezzo = st.getToken(14).trim(); + String appoggiaStreetPrice = st.getToken(6).trim(); + l_descrizioneTecnica = ""; + try { + prezzo = Double.valueOf(appoggiaPrezzo.replace(',', '.')); + streetprice = Double.valueOf(appoggiaStreetPrice.replace(',', '.')); + if (l_action.equals("A") || l_action.equals("C")) { + salvaArticoloNuovo = true; + } else { + salvaArticoloNuovo = false; + } + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato:" + appoggiaPrezzo + "\n" + currentLine + "\n"); + recordErrati++; + continue; + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (debug); + art.aggiornaCodiciAlternativi(false); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCodiciAlternativi().length() > 50) + System.out.println(art.getCodice() + " " + art.getCodice()); + if (!l_categoriaImport.isEmpty() && art.getCategoriaImport().indexOf(l_categoriaImport) < 0) + art.setCategoriaImport(art.getCategoriaImport() + art.getCategoriaImport()); + if (marca.getId_marca() > 0L && art.getId_marca() == 0L) + art.setId_marca(marca.getId_marca()); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } else if (salvaArticoloNuovo) { + double percentualeRicarico; + isNuovo = true; + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + art.setNome(l_nome); + art.setDescrizione(l_nome); + art.setCodiceEan(l_codiceEan); + art.setId_marca(marca.getId_marca()); + art.setCategoriaImport(l_categoriaImport); + art.setFlgEscludiWebArt(1L); + art.setCostoNetto(prezzo); + art.setFlgModImportazione(1L); + if (prezzo <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setNome(l_nome); + art.setDescrizione(l_nome); + art.setCodiceEan(l_codiceEan); + art.setId_marca(0L); + art.setFlgEscludiWebArt(1L); + art.setCostoNetto(prezzo); + art.setFlgModImportazione(1L); + if (prezzo <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCodiciAlternativi().length() > 50) + System.out.println(art.getCodice() + " " + art.getCodice()); + if (marca.getId_marca() > 0L) + art.setId_marca(marca.getId_marca()); + art.setId_fornitoreCostoNuovo(1995L); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + if (rp.getStatus()) { + DoubleOperator prezzoPubblico = new DoubleOperator(percentualeRicarico); + prezzoPubblico.setScale(2, 5); + prezzoPubblico.divide(100.0F); + prezzoPubblico.add(1); + prezzoPubblico.multiply(prezzo); + if (streetprice > 0.0D && prezzoPubblico.getResult() > streetprice) + prezzoPubblico = new DoubleOperator(streetprice); + ListinoArticolo lab = art.getListinoArticoloBase(); + if (prezzoPubblico.getResult() != lab.getPrezzoIvaLA()) { + System.out.println("Articolo " + art.getCodice() + " prezzo cambiato da " + + lab.getPrezzoIvaLA() + " a " + prezzoPubblico.getResult()); + lab.setPrezzoLA(prezzoPubblico.getResult()); + lab.save(); + } + art.setStreetPrice(streetprice); + if (art.getPrezzoArticolo(null).getPrezzoBase() > streetprice) { + ListinoArticolo listinoArticoloBase = art.getListinoArticoloBase(); + System.out.println(listinoArticoloBase.getId_listinoArticolo()); + listinoArticoloBase.setPrezzoLA(streetprice); + rp = listinoArticoloBase.save(); + } + if (!l_descrizioneTecnica.isEmpty()) + art.setDescTxtLang("descrizioneCommerciale", "it", l_descrizioneTecnica); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + } + if (!rp.getStatus()) { + err.append("Art. Nuovo: " + l_articoloCodiceAlternativoFornitore + " - " + + art.getDescrizione() + " - " + rp.getMsg() + " - "); + artNuovoKO++; + } else { + artNuovo++; + if (urlImmagine != null && !urlImmagine.isEmpty() && urlImmagine.endsWith(".jpg")) + art.caricaImmaginaDaRemoto(urlImmagine); + } + } else { + artNuovoNonSalvato++; + } + if (art.getId_articolo() > 0L && prezzo > 0.0D) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(1995L, art.getId_articolo(), -1L); + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(1995L); + af.setCostoVecchio(af.getCostoTotale()); + af.setCosto(prezzo); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + af.setCodiceFornitore(l_articoloCodiceFornitore); + af.setStreetPrice(streetprice); + af.setFlgPromo(isPromo ? 1L : 0L); + rp = af.save(); + if (rp.getStatus()) { + art.aggiornaPrezziEDispoByFornitori(streetprice, isNuovo); + if (art.getFlgModImportazione() == 2L) { + prezzoModificato++; + } else if (art.getFlgModImportazione() == 3L) { + prezzoNonModificato++; + } + if (art.getFlgEscludiWebArt() == 2L) { + articoloSospeso++; + } else if (art.getFlgEscludiWebArt() == 0L) { + articoloVisibile++; + } + } + } + } else { + artEscluso++; + System.out.println("prodotto ricondizionato escluso: codice Forn.:" + l_articoloCodiceFornitore + " codice produttore: " + l_articoloCodiceProduttore + "\n" + l_nome); + } + } else { + artEscluso++; + System.out.println("marca scartata: " + l_marcaDesc); + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE INGRAMMICRO " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, this.TAG_THREAD_MSG, sb.toString()); + } + if (SOSPENDI_DOPO_N_GG > 0L) + bean.update("UPDATE ARTICOLO SET flgEscludiWebArt=2,flgEscludiWeb=2 WHERE codice LIKE '" + serie + "%' and flgModImportazione = 0 and DATEDIFF(CURDATE(), dataUltimoImport)>=" + SOSPENDI_DOPO_N_GG + ";"); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! " + this.TAG_THREAD_MSG + " record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, this.TAG_THREAD_MSG, "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import Articolo e Prezzi INGRAMMICRO " + serie + " avvenuta correttamente. Record processati: "); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import Articolo e Prezzi INGRAMMICRO " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + + public ResParm importDispoCSV(String l_fileName) { + boolean debug = false; + boolean salvaArticoloNuovo = false; + boolean isNuovo = false; + boolean isArticoloCercatoConSku = true; + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + long SOSPENDI_DOPO_N_GG = this.apFull.getParm("CC_SOSPENDI_DOPO_N_GG_NO_IMPORT").getNumeroLong(); + if (SOSPENDI_DOPO_N_GG < 6L) + SOSPENDI_DOPO_N_GG = 6L; + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/PRICE1.TXT"; + StatusMsg.updateMsgByTag(this.apFull, this.TAG_THREAD_MSG, ": Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 1995L); + String currentLine = ""; + try { + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + Calendar cal = Calendar.getInstance(); + String l_descrizioneTecnica = ""; + boolean isPromo = false; + Articolo art = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + while ((currentLine = reader.readLine()) != null) { + isNuovo = false; + isPromo = false; + StringTokenizer st = new StringTokenizer(currentLine, ",", '"'); + if (st.countToken() >= 4) { + long dispoL; + String l_articoloCodiceFornitore = st.getToken(0).trim(); + String l_articoloCodiceAlternativoFornitore = "IM_" + l_articoloCodiceFornitore; + String l_articoloCodiceProduttore = st.getToken(1).trim(); + if (debug && + l_articoloCodiceAlternativoFornitore.equals("CG_7DB75EA")) + System.out.println(l_articoloCodiceAlternativoFornitore); + art.resetBean(); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(1995L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + String dispo = st.getToken(2).trim(); + try { + dispoL = Long.parseLong(dispo); + } catch (Exception e) { + err.append("Record scartato dispo errata: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato dispo errato: " + l_articoloCodiceAlternativoFornitore + " dispo rilevato:" + dispo + "\n" + currentLine + "\n"); + recordErrati++; + continue; + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (debug); + art.aggiornaCodiciAlternativi(false); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiciAlternativi().length() > 50) + System.out.println(art.getCodice() + " " + art.getCodice()); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } else { + artNuovoNonSalvato++; + } + if (art.getId_articolo() > 0L) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(1995L, art.getId_articolo(), -1L); + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(1995L); + af.setCodiceFornitore(l_articoloCodiceFornitore); + af.setDispSede(dispoL); + af.setFlgPromo(isPromo ? 1L : 0L); + rp = af.save(); + if (rp.getStatus()) { + art.aggiornaPrezziEDispoByFornitori(af.getStreetPrice(), isNuovo); + if (art.getFlgModImportazione() == 2L) { + prezzoModificato++; + } else if (art.getFlgModImportazione() == 3L) { + prezzoNonModificato++; + } + if (art.getFlgEscludiWebArt() == 2L) { + articoloSospeso++; + } else if (art.getFlgEscludiWebArt() == 0L) { + articoloVisibile++; + } + } + } + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE INGRAMMICRO " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, this.TAG_THREAD_MSG, sb.toString()); + } + if (SOSPENDI_DOPO_N_GG > 0L) + bean.update("UPDATE ARTICOLO SET flgEscludiWebArt=2,flgEscludiWeb=2 WHERE codice LIKE '" + serie + "%' and flgModImportazione = 0 and DATEDIFF(CURDATE(), dataUltimoImport)>=" + SOSPENDI_DOPO_N_GG + ";"); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! " + this.TAG_THREAD_MSG + " record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, this.TAG_THREAD_MSG, "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import DISPONIBILITA' INGRAMMICRO " + serie + " avvenuta correttamente. Record processati: "); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import DISPONIBILITA' INGRAMMICRO " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + + public ResParm importSiaeCSV(String l_fileName) { + boolean debug = false; + String serie = ""; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/ITSKUFEE.TXT"; + String currentLine = ""; + try { + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + Calendar cal = Calendar.getInstance(); + while ((currentLine = reader.readLine()) != null) { + StringTokenizer st = new StringTokenizer(currentLine, "~"); + if (st.countToken() >= 4) { + double prezzoSiae; + String l_articoloCodiceFornitore = st.getToken(1).trim(); + String l_articoloCodiceAlternativoFornitore = "IM_" + l_articoloCodiceFornitore; + if (debug && + l_articoloCodiceAlternativoFornitore.equals("CG_7DB75EA")) + System.out.println(l_articoloCodiceAlternativoFornitore); + af.findByCodiceFornitore(1995L, l_articoloCodiceFornitore); + String appoggiaPrezzoSiae = st.getToken(3).trim(); + try { + prezzoSiae = Double.valueOf(appoggiaPrezzoSiae.replace(',', '.')); + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo siae:" + appoggiaPrezzoSiae + "\n" + currentLine + "\n"); + recordErrati++; + continue; + } + if (af.getId_articoloFornitore() > 0L) { + System.out.print("*"); + if (debug); + af.findByCodiceFornitore(1995L, l_articoloCodiceFornitore); + if (af.getCostoAggiuntivo() != prezzoSiae) { + af.setCostoAggiuntivo(prezzoSiae); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + rp = af.save(); + if (rp.getStatus()) { + Articolo art = af.getArticolo(); + art.aggiornaPrezziEDispoByFornitori(art.getStreetPrice(), false); + if (art.getFlgModImportazione() == 2L) { + prezzoModificato++; + } else if (art.getFlgModImportazione() == 3L) { + prezzoNonModificato++; + } + if (art.getFlgEscludiWebArt() == 2L) { + articoloSospeso++; + } else if (art.getFlgEscludiWebArt() == 0L) { + articoloVisibile++; + } + } + } else { + prezzoNonModificato++; + } + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + + af.getArticolo().getDescrizione() + " - " + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE INGRAMMICRO " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, this.TAG_THREAD_MSG, sb.toString()); + } + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! " + this.TAG_THREAD_MSG + " record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, this.TAG_THREAD_MSG, "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import Prezzi SIAE INGRAMMICRO " + serie + " avvenuta correttamente. Record processati: "); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import Articolo e Prezzi INGRAMMICRO " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + } + + class ThreadImportLogicom extends Thread { + private ApplParmFull apFull; + + private String fileCsvlarge; + + private final String TAG_THREAD_MSG = "IMPORT LOGICOM "; + + private boolean sendEmail; + + private static final long l_id_fornitore = 1997L; + + private static final long l_id_tipoDaDafinire = 1L; + + public ThreadImportLogicom(ApplParmFull apFull, String fileXls, boolean sendEmail) { + this.apFull = apFull; + this.fileCsvlarge = fileXls; + this.sendEmail = sendEmail; + if (!CCImport.isThreadLogicomAttivo()) { + CCImport.threadImportLocicom = true; + start(); + } + } + + public void run() { + boolean debug = false; + boolean salvaArticoloNuovo = true; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT LOGICOM ", "...inizio ..."); + String serie = ""; + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("##############\nIMPORT LOGICOM " + serie + "\nSTART: " + start.toString()); + ResParm rp = new ResParm(true); + BufferedReader reader = null; + String targetDir = this.apFull.getParm("DOCBASE").getTesto() + this.apFull.getParm("DOCBASE").getTesto(); + String fileCsv = this.fileCsvlarge.substring(this.fileCsvlarge.lastIndexOf('/') + 1); + String l_fileName = this.fileCsvlarge; + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/" + fileCsv; + rp = importGiornaliero(l_fileName); + timer.stop(); + rp.setMsg("Import concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + if (this.sendEmail) + CCImport.this.sendArticoliCambiatiByEmail(this.apFull, rp.getMsg(), 1997L); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT LOGICOM ", rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.apFull, "IMPORT LOGICOM "); + CCImport.threadImportLocicom = false; + System.out.println(rp.getMsg()); + if (CCImport.this.getAttivita(this.apFull).getFlgEbay() == 1L) { + Articolo bean = new Articolo(this.apFull); + bean.startThreadAllineaEbay(this.apFull, new ArticoloCR()); + } + if (CCImport.this.getAttivita(this.apFull).getFlgAmz() == 1L) { + Articolo bean = new Articolo(this.apFull); + bean.startThreadAllineaAmz(this.apFull, new ArticoloCR()); + } + } + + public ResParm importGiornaliero(String l_fileName) { + boolean debug = false; + boolean salvaArticoloNuovo = true; + boolean isNuovo = false; + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + StringBuilder scartoCodici = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + HashSet hsMarche = new HashSet<>(); + HashSet hsTipi = new HashSet<>(); + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + XLSFileReader xfr = new XLSFileReader(l_fileName); + Articolo bean = new Articolo(this.apFull); + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/large.csv"; + StatusMsg.updateMsgByTag(this.apFull, "IMPORT LOGICOM ", ": Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 1997L); + String currentLine = ""; + try { + Marca marca = new Marca(this.apFull); + Calendar cal = Calendar.getInstance(); + String l_descrizioneTecnica = ""; + boolean isPromo = false; + Articolo art = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + xfr.nextRecord(); + while (xfr.nextRecord()) { + isNuovo = false; + isPromo = false; + String l_marcaDesc = xfr.getField(7); + marca.findByDescrizioneImport(l_marcaDesc); + if (marca.getId_marca() > 0L) { + long dispoL; + double prezzo, prezzoSiae, prezzoTot; + if (!hsMarche.contains(Long.valueOf(marca.getId_marca()))) { + hsMarche.add(Long.valueOf(marca.getId_marca())); + System.out.println("NUOVA marca GESTITA: " + l_marcaDesc); + } + String urlImmagine = xfr.getField(20).trim(); + String l_articoloCodiceFornitore = xfr.getField(1).trim(); + String l_articoloCodiceAlternativoFornitore = "LC_" + l_articoloCodiceFornitore; + String l_articoloCodiceProduttore = xfr.getField(1).trim(); + String l_codiceEan = xfr.getField(11).trim(); + art.resetBean(); + String l_nome = xfr.getField(6).trim(); + if (debug && + l_articoloCodiceAlternativoFornitore.equals("LC_CC640EE")) + System.out.println(l_articoloCodiceAlternativoFornitore); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(1997L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + if (art.getId_articolo() == 0L && !l_codiceEan.isEmpty()) { + art.findByCodiceEanSerie(l_codiceEan, serie); + if (art.getId_articolo() == 0L) { + l_codiceEan = "0" + l_codiceEan; + art.findByCodiceEanSerie(l_codiceEan, serie); + } + if (art.getId_articolo() == 0L && !l_articoloCodiceProduttore.isEmpty()) + art.findByCodiceProduttoreMarca(l_articoloCodiceProduttore, marca.getId_marca()); + } + String appoggiaPrezzo = xfr.getField(5).trim(); + String appoggiaPrezzoSiae = xfr.getField(9).trim(); + String dispo = xfr.getField(10).trim(); + l_descrizioneTecnica = ""; + try { + prezzo = Double.valueOf(appoggiaPrezzo.replace(',', '.')); + prezzoSiae = Double.valueOf(appoggiaPrezzoSiae.replace(',', '.')); + if (prezzoSiae == 0.0D) { + prezzoTot = prezzo; + } else { + DoubleOperator dop = new DoubleOperator(prezzo); + dop.add(prezzoSiae); + prezzoTot = dop.getResult(); + } + dispoL = (long)Double.parseDouble(dispo); + long dispoTotL = dispoL; + if (dispoTotL > 0L) { + salvaArticoloNuovo = true; + } else { + salvaArticoloNuovo = false; + } + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato: " + appoggiaPrezzo + "\n" + currentLine + "\n"); + recordErrati++; + continue; + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (art.getId_tipo() != 1L && !hsTipi.contains(Long.valueOf(art.getId_tipo()))) + hsTipi.add(Long.valueOf(art.getId_tipo())); + if (debug); + art.aggiornaCodiciAlternativi(false); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (marca.getId_marca() > 0L && art.getId_marca() == 0L) + art.setId_marca(marca.getId_marca()); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + if (urlImmagine != null && !urlImmagine.isEmpty() && urlImmagine.endsWith(".jpg")) + if (!new File(art.getDocBase() + art.getDocBase() + art.getPathImg()).exists()) + art.caricaImmaginaDaRemoto(urlImmagine); + artAggiornati++; + } + } else if (salvaArticoloNuovo) { + double percentualeRicarico; + isNuovo = true; + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + art.setNome(l_nome); + art.setDescrizione(l_nome); + art.setCodiceEan(l_codiceEan); + art.setFlgEscludiWebArt(1L); + art.setCostoNetto(prezzoTot); + art.setFlgModImportazione(1L); + if (prezzo <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCodiciAlternativi().length() > 50) + System.out.println(art.getCodice() + " " + art.getCodice()); + if (marca.getId_marca() > 0L) + art.setId_marca(marca.getId_marca()); + art.setId_fornitoreCostoNuovo(1997L); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + if (!urlImmagine.isEmpty() && !art.isImgExist(1)) + art.caricaImmaginaDaRemoto(urlImmagine); + if (rp.getStatus()) { + DoubleOperator prezzoPubblico = new DoubleOperator(percentualeRicarico); + prezzoPubblico.setScale(2, 5); + prezzoPubblico.divide(100.0F); + prezzoPubblico.add(1); + prezzoPubblico.multiply(prezzoTot); + double streetprice = art.getStreetPrice(); + if (streetprice > 0.0D && prezzoPubblico.getResult() > streetprice) + prezzoPubblico = new DoubleOperator(streetprice); + ListinoArticolo lab = art.getListinoArticoloBase(); + if (prezzoPubblico.getResult() != lab.getPrezzoIvaLA()) { + System.out.println("Articolo " + art.getCodice() + " prezzo cambiato da " + lab.getPrezzoIvaLA() + " a " + + prezzoPubblico.getResult()); + lab.setPrezzoLA(prezzoPubblico.getResult()); + lab.save(); + } + art.setStreetPrice(streetprice); + if (art.getPrezzoArticolo(null).getPrezzoBase() > streetprice); + if (!l_descrizioneTecnica.isEmpty()) + art.setDescTxtLang("descrizioneCommerciale", "it", l_descrizioneTecnica); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + } + if (!rp.getStatus()) { + err.append("Art. Nuovo: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + artNuovoKO++; + } else { + artNuovo++; + if (urlImmagine != null && !urlImmagine.isEmpty() && urlImmagine.endsWith(".jpg")) + art.caricaImmaginaDaRemoto(urlImmagine); + } + } else { + artNuovoNonSalvato++; + } + if (art.getId_articolo() > 0L && prezzo > 0.0D) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(1997L, art.getId_articolo(), -1L); + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(1997L); + af.setCostoVecchio(af.getCostoTotale()); + af.setCosto(prezzo); + af.setCostoAggiuntivo(prezzoSiae); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + af.setCodiceFornitore(l_articoloCodiceFornitore); + af.setDispSede(dispoL); + af.setFlgPromo(isPromo ? 1L : 0L); + rp = af.save(); + if (rp.getStatus()) { + art.aggiornaPrezziEDispoByFornitori(art.getStreetPrice(), isNuovo); + if (art.getFlgModImportazione() == 2L) { + prezzoModificato++; + } else if (art.getFlgModImportazione() == 3L) { + prezzoNonModificato++; + } + if (art.getFlgEscludiWebArt() == 2L) { + articoloSospeso++; + } else if (art.getFlgEscludiWebArt() == 0L) { + articoloVisibile++; + } + } + } + } else { + artEscluso++; + System.out.println("marca scartata: " + l_marcaDesc); + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Large: Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE LOGICOM " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT LOGICOM ", sb.toString()); + } + rp = Articolo.updateArticoloNonTrovati(this.apFull, "IMPORT LOGICOM ", 1997L, hsMarche, hsTipi); + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! IMPORT LOGICOM record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT LOGICOM ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import Articolo e Prezzi LOGICOM " + serie + " avvenuta correttamente. - File:" + l_fileName + " - Record processati: "); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + sb.append(" - Update articoli non trovati: - "); + sb.append(rp.getMsg()); + sb.append(" - DEBUG LOGICOM SCARTO CODICI: - "); + sb.append(scartoCodici.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import Articolo e Prezzi LOGICOM " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + } + + class ThreadCheckMailLogicom extends Thread { + private ApplParmFull apFull; + + private final String TAG_THREAD_MSG = "CHECK MAIL LOGICOM "; + + private boolean sendEmail; + + private static final long l_id_fornitore = 1997L; + + public ThreadCheckMailLogicom(ApplParmFull apFull, boolean sendMail) { + this.apFull = apFull; + this.sendEmail = sendMail; + if (!CCImport.isThreadLogicomAttivo()) { + CCImport.threadImportLocicom = true; + start(); + } + } + + public void run() { + boolean debug = false; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL LOGICOM ", "...inizio ..."); + String serie = ""; + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("##############\nIMPORT LOGICOM " + serie + "\nSTART: " + start.toString()); + ResParm rp = new ResParm(true); + MailAccount account = new MailAccount("mail.acxent.it", "acx-ordini", "pippolone1000"); + if (!debug) { + rp = fetchMessages(account, DBAdapter.getToday()); + } else { + rp.setStatus(true); + String l_file = "/Users/acolzi/Documents/webapps/cc/_tmp/FLX3933324.XLS"; + rp.setMsg(l_file); + } + if (rp.getStatus()) { + System.out.println(rp.getMsg()); + String fileXLS = rp.getMsg(); + synchronized (this) { + CCImport.threadImportLocicom = false; + new CCImport.ThreadImportLogicom(this.apFull, fileXLS, true); + } + } + System.out.println("############FINE IMPORT LOGICOM"); + timer.stop(); + rp.setMsg("Import concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL LOGICOM ", rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.apFull, "CHECK MAIL LOGICOM "); + CCImport.threadImportLocicom = false; + System.out.println(rp.getMsg()); + } + + public ResParm fetchMessages(MailAccount account, Date theDate) { + ResParm rp = new ResParm(true); + MailService mailService = new MailService(account.getMailServer(), account.getMailUser(), account.getMailPassword()); + rp = mailService.login(); + int messageCount = 0, messageSaved = 0; + if (rp.getStatus()) + try { + String from = "Navision@Logicom-Italia.it"; + String theSubject = "Logicom Partners (IT) - Pricelist"; + Calendar cal = Calendar.getInstance(); + String fileNameXls = "LC_" + String.valueOf(cal.getTimeInMillis()) + ".xlsx"; + String destFile = this.apFull.getParm("DOCBASE").getTesto() + this.apFull.getParm("DOCBASE").getTesto() + this.apFull.getParm("PATH_TMP").getTesto(); + Message[] messages = mailService.getMessages(theDate); + rp.setStatus(false); + rp.setMsg("Mail logicom non trovata"); + System.out.println("message id fromAddress subject"); + for (int i = 0; i < messages.length; i++) { + messageCount++; + String text = ""; + String messageId = ""; + String subject = ""; + try { + messageId = messages[i].getHeader("Message-ID")[0]; + } catch (Exception e) {} + if (messageId == null || messageId.isEmpty()) { + MimeMessage cmsg = new MimeMessage(mailService.getMimeMessages(i)); + messageId = cmsg.getMessageID(); + } + subject = messages[i].getSubject(); + Address[] fromAddress = messages[i].getFrom(); + InternetAddress address = (InternetAddress)fromAddress[0]; + String temp = messageId + " " + messageId + " " + String.valueOf(messages[i].getSentDate()) + " " + String.valueOf(address); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL LOGICOM ", temp); + System.out.println(temp); + if (subject.indexOf(theSubject) >= 0) { + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL LOGICOM ", "Trovata mail con oggetto " + theSubject); + String contentType = messages[i].getContentType(); + String messageContent = ""; + String attachFiles = ""; + if (contentType.contains("multipart")) { + Multipart multiPart = (Multipart)messages[i].getContent(); + int numberOfParts = multiPart.getCount(); + for (int partCount = 0; partCount < numberOfParts; partCount++) { + MimeBodyPart part = (MimeBodyPart)multiPart.getBodyPart(partCount); + if ("attachment".equalsIgnoreCase(part.getDisposition())) { + String fileName = part.getFileName(); + attachFiles = attachFiles + attachFiles + ", "; + part.saveFile(destFile); + } else { + messageContent = part.getContent().toString(); + } + } + if (attachFiles.length() > 1) + attachFiles = attachFiles.substring(0, attachFiles.length() - 2); + } + if (new File(destFile).exists()) { + rp.setStatus(true); + rp.setMsg(destFile); + break; + } + break; + } + } + mailService.logout(); + } catch (Exception e) { + e.printStackTrace(); + rp.setException(e); + rp.setStatus(false); + } + return rp; + } + } + + class ThreadImportFlexit extends Thread { + private ApplParmFull apFull; + + private String fileCsvlarge; + + private final String TAG_THREAD_MSG = "IMPORT FLEXIT "; + + private boolean sendEmail; + + private static final long l_id_fornitore = 2001L; + + private static final long l_id_tipoDaDafinire = 1L; + + public ThreadImportFlexit(ApplParmFull apFull, String fileXls, boolean sendEmail) { + this.apFull = apFull; + this.fileCsvlarge = fileXls; + this.sendEmail = sendEmail; + if (!CCImport.isThreadFlexitAttivo()) { + CCImport.threadImportFlexit = true; + start(); + } + } + + public void run() { + boolean debug = false; + boolean salvaArticoloNuovo = true; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT FLEXIT ", "...inizio ..."); + String serie = ""; + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("##############\nIMPORT FLEXIT " + serie + "\nSTART: " + start.toString()); + ResParm rp = new ResParm(true); + BufferedReader reader = null; + String targetDir = this.apFull.getParm("DOCBASE").getTesto() + this.apFull.getParm("DOCBASE").getTesto(); + String fileCsv = this.fileCsvlarge.substring(this.fileCsvlarge.lastIndexOf('/') + 1); + String l_fileName = this.fileCsvlarge; + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/" + fileCsv; + rp = importGiornaliero(l_fileName); + timer.stop(); + rp.setMsg("Import concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + if (this.sendEmail) + CCImport.this.sendArticoliCambiatiByEmail(this.apFull, rp.getMsg(), 2001L); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT FLEXIT ", rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.apFull, "IMPORT FLEXIT "); + CCImport.threadImportFlexit = false; + System.out.println(rp.getMsg()); + if (CCImport.this.getAttivita(this.apFull).getFlgEbay() == 1L) { + Articolo bean = new Articolo(this.apFull); + bean.startThreadAllineaEbay(this.apFull, new ArticoloCR()); + } + if (CCImport.this.getAttivita(this.apFull).getFlgAmz() == 1L) { + Articolo bean = new Articolo(this.apFull); + bean.startThreadAllineaAmz(this.apFull, new ArticoloCR()); + } + } + + public ResParm importGiornaliero(String l_fileName) { + boolean debug = false; + boolean salvaArticoloNuovo = true; + boolean isNuovo = false; + StringBuilder err = new StringBuilder(); + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuilder sb = new StringBuilder(); + StringBuilder scartoCodici = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + HashSet hsMarche = new HashSet<>(); + HashSet hsTipi = new HashSet<>(); + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + XLSFileReader xfr = new XLSFileReader(l_fileName); + Articolo bean = new Articolo(this.apFull); + if (debug); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT FLEXIT ", ": Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 2001L); + String currentLine = ""; + StatoUsato statoUsato = new StatoUsato(this.apFull); + try { + Marca marca = new Marca(this.apFull); + Calendar cal = Calendar.getInstance(); + String urlImmagine = ""; + String l_descrizioneTecnica = ""; + boolean isPromo = false; + Articolo art = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + xfr.nextRecord(); + while (xfr.nextRecord()) { + isNuovo = false; + isPromo = false; + String l_marcaDesc = xfr.getField(8); + marca.findByDescrizioneImport(l_marcaDesc); + if (marca.getId_marca() > 0L) { + if (!hsMarche.contains(Long.valueOf(marca.getId_marca()))) { + hsMarche.add(Long.valueOf(marca.getId_marca())); + System.out.println("NUOVA marca GESTITA: " + l_marcaDesc); + } + String l_statoUsato = xfr.getField(4).trim(); + statoUsato.findBySigla(l_statoUsato); + if (statoUsato.getId_statoUsato() == 0L) { + System.out.println("ERRORE!!!! FLEXIT NON TROVATO STATO USATO " + l_statoUsato); + err.append("ERRORE!!!! FLEXIT NON TROVATO STATO USATO " + l_statoUsato); + err.append("\n"); + } else { + long dispoL; + double prezzo, prezzoSiae, prezzoTot; + String l_articoloCodiceFornitore = xfr.getField(0).trim().replace(".0", "") + xfr.getField(0).trim().replace(".0", ""); + String l_articoloCodiceAlternativoFornitore = "FX_" + l_articoloCodiceFornitore; + String l_articoloCodiceProduttore = xfr.getField(1).trim(); + String l_codiceEan = xfr.getField(2).trim(); + if (l_codiceEan.equals("0000000000000") || l_codiceEan.indexOf("99999999") >= 0) + l_codiceEan = ""; + art.resetBean(); + String l_nome = xfr.getField(5).trim(); + String l_nomeAgg = xfr.getField(6).trim(); + if (debug && + l_articoloCodiceAlternativoFornitore.equals("FX_CC640EE")) + System.out.println(l_articoloCodiceAlternativoFornitore); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(2001L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + if (af.getArticolo().getId_statoUsato() == statoUsato.getId_statoUsato() || ( + statoUsato.getId_statoUsato() >= 1L && statoUsato.getId_statoUsato() <= 3L && + af.getArticolo().getFlgUsato() == 0L)) { + art = af.getArticolo(); + } else { + err.append("trovato articolo ma stato diverso flexit.... ERRORE: " + l_articoloCodiceFornitore); + err.append("\n"); + System.out.println("trovato articolo ma stato diverso flexit.... ERRORE: " + l_articoloCodiceFornitore); + } + } + if (art.getId_articolo() == 0L && !l_codiceEan.isEmpty()) { + art.findByCodiceEanSerie(l_codiceEan, serie); + if (art.getId_articolo() == 0L) + art.findByCodiceEanSerie("0" + l_codiceEan, serie); + if (art.getId_articolo() == 0L && !l_articoloCodiceProduttore.isEmpty()) + art.findByCodiceProduttoreMarca(l_articoloCodiceProduttore, marca.getId_marca()); + } + if (art.getId_articolo() > 0L) + if (art.getId_statoUsato() != statoUsato.getId_statoUsato() && (statoUsato.getId_statoUsato() < 1L || + statoUsato.getId_statoUsato() > 3L || art.getFlgUsato() != 0L)) + art.resetBean(); + String appoggiaPrezzo = xfr.getField(7).trim(); + String dispo = xfr.getField(3).trim(); + if (dispo.equals("50+")) + dispo = "50"; + l_descrizioneTecnica = ""; + try { + prezzo = Double.valueOf(appoggiaPrezzo.replace(',', '.')); + prezzoSiae = 0.0D; + if (prezzoSiae == 0.0D) { + prezzoTot = prezzo; + } else { + DoubleOperator dop = new DoubleOperator(prezzo); + dop.add(prezzoSiae); + prezzoTot = dop.getResult(); + } + dispoL = (long)Double.parseDouble(dispo); + long dispoTotL = dispoL; + if (dispoTotL > 0L) { + salvaArticoloNuovo = true; + } else { + salvaArticoloNuovo = false; + } + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato: " + appoggiaPrezzo + "\n" + currentLine + "\n"); + recordErrati++; + continue; + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (art.getId_tipo() != 1L && !hsTipi.contains(Long.valueOf(art.getId_tipo()))) + hsTipi.add(Long.valueOf(art.getId_tipo())); + if (debug); + art.aggiornaCodiciAlternativi(false); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (marca.getId_marca() > 0L && art.getId_marca() == 0L) + art.setId_marca(marca.getId_marca()); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + if (urlImmagine != null && !urlImmagine.isEmpty() && urlImmagine.endsWith(".jpg")) + if (!new File(art.getDocBase() + art.getDocBase() + art.getPathImg()).exists()) + art.caricaImmaginaDaRemoto(urlImmagine); + artAggiornati++; + } + } else if (salvaArticoloNuovo) { + double percentualeRicarico; + isNuovo = true; + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + art.setNome(l_nome); + art.setDescTxtLang("descrizioneBreve", "it", l_descrizioneTecnica); + if (statoUsato.getId_statoUsato() > 3L) { + art.setId_statoUsato(statoUsato.getId_statoUsato()); + art.setFlgUsato(2L); + } else { + art.setFlgUsato(0L); + art.setId_statoUsato(statoUsato.getId_statoUsato()); + } + art.setCodiceEan(l_codiceEan); + art.setFlgEscludiWebArt(1L); + art.setCostoNetto(prezzoTot); + art.setFlgModImportazione(1L); + if (prezzo <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCodiciAlternativi().length() > 50) + System.out.println(art.getCodice() + " " + art.getCodice()); + if (marca.getId_marca() > 0L) + art.setId_marca(marca.getId_marca()); + art.setId_fornitoreCostoNuovo(2001L); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + if (!urlImmagine.isEmpty() && !art.isImgExist(1)) + art.caricaImmaginaDaRemoto(urlImmagine); + if (rp.getStatus()) { + DoubleOperator prezzoPubblico = new DoubleOperator(percentualeRicarico); + prezzoPubblico.setScale(2, 5); + prezzoPubblico.divide(100.0F); + prezzoPubblico.add(1); + prezzoPubblico.multiply(prezzoTot); + double streetprice = art.getStreetPrice(); + if (streetprice <= 0.0D || prezzoPubblico.getResult() > streetprice); + ListinoArticolo lab = art.getListinoArticoloBase(); + if (prezzoPubblico.getResult() != lab.getPrezzoIvaLA()) { + lab.setPrezzoLA(prezzoPubblico.getResult()); + lab.save(); + } + art.setStreetPrice(streetprice); + if (art.getPrezzoArticolo(null).getPrezzoBase() > streetprice); + if (!l_descrizioneTecnica.isEmpty()) + art.setDescTxtLang("descrizioneCommerciale", "it", l_descrizioneTecnica); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + } + if (!rp.getStatus()) { + err.append("Art. Nuovo: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + artNuovoKO++; + } else { + artNuovo++; + if (urlImmagine != null && !urlImmagine.isEmpty() && urlImmagine.endsWith(".jpg")) + art.caricaImmaginaDaRemoto(urlImmagine); + } + } else { + artNuovoNonSalvato++; + } + if (art.getId_articolo() > 0L && prezzo > 0.0D) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(2001L, art.getId_articolo(), -1L); + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(2001L); + af.setCostoVecchio(af.getCostoTotale()); + af.setCosto(prezzo); + af.setCostoAggiuntivo(prezzoSiae); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + af.setCodiceFornitore(l_articoloCodiceFornitore); + af.setDispSede(dispoL); + af.setFlgPromo(isPromo ? 1L : 0L); + rp = af.save(); + if (rp.getStatus()) { + art.aggiornaPrezziEDispoByFornitori(art.getStreetPrice(), isNuovo); + if (art.getFlgModImportazione() == 2L) { + prezzoModificato++; + } else if (art.getFlgModImportazione() == 3L) { + prezzoNonModificato++; + } + if (art.getFlgEscludiWebArt() == 2L) { + articoloSospeso++; + } else if (art.getFlgEscludiWebArt() == 0L) { + articoloVisibile++; + } + } + } + } + } else { + artEscluso++; + System.out.println("marca scartata: " + l_marcaDesc); + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Large: Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE FLEXIT " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT FLEXIT ", sb.toString()); + } + rp = Articolo.updateArticoloNonTrovati(this.apFull, "IMPORT FLEXIT ", 2001L, hsMarche, hsTipi); + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! IMPORT FLEXIT record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT FLEXIT ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import Articolo e Prezzi FLEXIT " + serie + " avvenuta correttamente. - File:" + l_fileName + " - Record processati: "); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + sb.append(" - Update articoli non trovati: - "); + sb.append(rp.getMsg()); + sb.append(" - DEBUG FLEXIT SCARTO CODICI: - "); + sb.append(scartoCodici.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import Articolo e Prezzi FLEXIT " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + System.out.println(err.toString()); + return rp; + } + } + + class ThreadCheckMailFlexit extends Thread { + private ApplParmFull apFull; + + private final String TAG_THREAD_MSG = "CHECK MAIL FLEXIT "; + + private boolean sendEmail; + + private static final long l_id_fornitore = 2001L; + + public ThreadCheckMailFlexit(ApplParmFull apFull, boolean sendMail) { + this.apFull = apFull; + this.sendEmail = sendMail; + if (!CCImport.isThreadFlexitAttivo()) { + CCImport.threadImportFlexit = true; + start(); + } + } + + public void run() { + boolean debug = false; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL FLEXIT ", "...inizio ..."); + String serie = ""; + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("##############\nIMPORT FLEXIT " + serie + "\nSTART: " + start.toString()); + ResParm rp = new ResParm(true); + MailAccount account = new MailAccount("mail.acxent.it", "acx-ordini", "pippolone1000"); + if (!debug) { + rp = fetchMessages(account, DBAdapter.getToday()); + } else { + rp.setStatus(true); + String l_file = "/Users/acolzi/Documents/webapps/cc/_tmp/FLX3933324.XLS"; + rp.setMsg(l_file); + } + if (rp.getStatus()) { + System.out.println(rp.getMsg()); + String fileXLS = rp.getMsg(); + synchronized (this) { + CCImport.threadImportFlexit = false; + new CCImport.ThreadImportFlexit(this.apFull, fileXLS, true); + } + } + System.out.println("############FINE IMPORT FLEXIT"); + timer.stop(); + rp.setMsg("Import concluso. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL FLEXIT ", rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.apFull, "CHECK MAIL FLEXIT "); + CCImport.threadImportFlexit = false; + System.out.println(rp.getMsg()); + } + + public ResParm fetchMessages(MailAccount account, Date theDate) { + ResParm rp = new ResParm(true); + MailService mailService = new MailService(account.getMailServer(), account.getMailUser(), account.getMailPassword()); + rp = mailService.login(); + int messageCount = 0, messageSaved = 0; + if (rp.getStatus()) + try { + String from = "Riccardo.Gilardi@flexitdistribution.com"; + String theSubject = "Lista prodotti disponibili a stock"; + Calendar cal = Calendar.getInstance(); + String fileNameXls = "FX_" + String.valueOf(cal.getTimeInMillis()) + ".xlsx"; + String destFile = this.apFull.getParm("DOCBASE").getTesto() + this.apFull.getParm("DOCBASE").getTesto() + this.apFull.getParm("PATH_TMP").getTesto(); + Message[] messages = mailService.getMessages(theDate); + rp.setStatus(false); + rp.setMsg("Mail FLEXIT non trovata"); + System.out.println("message id fromAddress subject"); + for (int i = 0; i < messages.length; i++) { + messageCount++; + String text = ""; + String messageId = ""; + String subject = ""; + try { + messageId = messages[i].getHeader("Message-ID")[0]; + } catch (Exception e) {} + if (messageId == null || messageId.isEmpty()) { + MimeMessage cmsg = new MimeMessage(mailService.getMimeMessages(i)); + messageId = cmsg.getMessageID(); + } + subject = messages[i].getSubject(); + Address[] fromAddress = messages[i].getFrom(); + InternetAddress address = (InternetAddress)fromAddress[0]; + String temp = messageId + " " + messageId + " " + String.valueOf(messages[i].getSentDate()) + " " + String.valueOf(address); + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL FLEXIT ", temp); + System.out.println(temp); + if (subject.indexOf(theSubject) >= 0) { + StatusMsg.updateMsgByTag(this.apFull, "CHECK MAIL FLEXIT ", "Trovata mail con oggetto " + theSubject); + String contentType = messages[i].getContentType(); + String messageContent = ""; + String attachFiles = ""; + if (contentType.contains("multipart")) { + Multipart multiPart = (Multipart)messages[i].getContent(); + int numberOfParts = multiPart.getCount(); + for (int partCount = 0; partCount < numberOfParts; partCount++) { + MimeBodyPart part = (MimeBodyPart)multiPart.getBodyPart(partCount); + if ("attachment".equalsIgnoreCase(part.getDisposition())) { + String fileName = part.getFileName(); + attachFiles = attachFiles + attachFiles + ", "; + part.saveFile(destFile); + } else { + messageContent = part.getContent().toString(); + } + } + if (attachFiles.length() > 1) + attachFiles = attachFiles.substring(0, attachFiles.length() - 2); + } + if (new File(destFile).exists()) { + rp.setStatus(true); + rp.setMsg(destFile); + break; + } + break; + } + } + mailService.logout(); + } catch (Exception e) { + e.printStackTrace(); + rp.setException(e); + rp.setStatus(false); + } + return rp; + } + } + + class ThreadTrovaprezziXml extends Thread { + private ApplParmFull apFull; + + private ArticoloCR CR; + + private final String TAG_THREAD_MSG = "TROVAPREZZI "; + + public ThreadTrovaprezziXml(ApplParmFull apFull, ArticoloCR CR) { + this.apFull = apFull; + this.CR = CR; + if (!CCImport.isThreadTrovaprezzi()) { + CCImport.threadTrovaprezzi = true; + start(); + } + } + + public void run() { + boolean debug = false; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.apFull, "TROVAPREZZI ", "...inizio ..."); + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("##############\n TROVAPREZZI \nSTART: " + start.toString()); + ResParm rp = new ResParm(true); + Articolo articolo = new Articolo(this.apFull); + rp = articolo.creaFileXmlTrovaprezzi(this.CR); + timer.stop(); + StatusMsg.updateMsgByTag(this.apFull, "TROVAPREZZI ", "File " + + this.CR.getFileNameTrovaprezzi() + " creato. DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.apFull, "TROVAPREZZI "); + CCImport.threadTrovaprezzi = false; + System.out.println(rp.getMsg()); + } + } + + class ThreadImportBrevi extends Thread { + private ApplParmFull apFull; + + private String fileXlM; + + private final String TAG_THREAD_MSG = "IMPORT BREVI "; + + private boolean sendEmail; + + private static final long l_id_fornitore = 2111L; + + private static final long l_id_tipoDaDafinire = 1L; + + public ThreadImportBrevi(ApplParmFull apFull, String fileXlM, boolean sendEmail) { + this.apFull = apFull; + this.fileXlM = fileXlM; + this.sendEmail = sendEmail; + if (!CCImport.isThreadEsprinetAttivo()) { + CCImport.threadImportBrevi = true; + start(); + } + } + + public void run() { + boolean debug = false; + boolean salvaArticoloNuovo = true; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BREVI ", "...inizio ..."); + String serie = ""; + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("##############\nIMPORT BREVI " + serie + "\nSTART: " + start.toString()); + ResParm rp = new ResParm(true); + BufferedReader reader = null; + String targetDir = this.apFull.getParm("DOCBASE").getTesto() + this.apFull.getParm("DOCBASE").getTesto(); + String l_fileName = this.fileXlM; + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/" + this.fileXlM; + rp = importGiornalieroXlm(l_fileName); + timer.stop(); + rp.setMsg("Import concluso. IMPORT BREVI DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + if (this.sendEmail) + CCImport.this.sendArticoliCambiatiByEmail(this.apFull, rp.getMsg(), 2111L); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BREVI ", rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.apFull, "IMPORT BREVI "); + CCImport.threadImportBrevi = false; + System.out.println(rp.getMsg()); + } + + public ResParm importGiornalieroXlm(String l_fileName) { + boolean debug = false; + boolean salvaArticoloNuovo = true; + boolean isNuovo = false; + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + StringBuilder scartoCodici = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + HashSet hsMarche = new HashSet<>(); + HashSet hsTipi = new HashSet<>(); + int totArticoli = 0; + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + if (debug) + l_fileName = "/Users/acolzi/Downloads/brvlist_17052022125006.xlm"; + Articolo bean = new Articolo(this.apFull); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BREVI ", ": Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 2111L); + String currentLine = ""; + try { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + Document doc = builder.parse(new File(l_fileName)); + Marca marca = new Marca(this.apFull); + Calendar cal = Calendar.getInstance(); + String l_descrizioneTecnica = ""; + boolean isPromo = false; + Articolo art = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + NodeList nArticoli = doc.getElementsByTagName("articolo"); + totArticoli = nArticoli.getLength(); + for (int nArt = 0; nArt < nArticoli.getLength(); nArt++) { + Node nArticolo = nArticoli.item(nArt); + Element eArticolo = (Element)nArticolo; + isNuovo = false; + isPromo = false; + String l_marcaDesc = eArticolo.getElementsByTagName("produttore").item(0).getTextContent(); + marca.findByDescrizioneImport(l_marcaDesc); + if (marca.getId_marca() > 0L) { + String l_articoloCodiceProduttore, l_codiceEan; + long dispoL, dispoCashL; + double prezzo, streetprice, siae; + if (!hsMarche.contains(Long.valueOf(marca.getId_marca()))) { + hsMarche.add(Long.valueOf(marca.getId_marca())); + System.out.println("NUOVA marca GESTITA: " + l_marcaDesc); + } + String l_articoloCodiceFornitore = eArticolo.getElementsByTagName("codice").item(0).getTextContent(); + String l_articoloCodiceAlternativoFornitore = "BR_" + l_articoloCodiceFornitore; + if (eArticolo.getElementsByTagName("codiceproduttore").item(0) == null) { + l_articoloCodiceProduttore = ""; + } else { + l_articoloCodiceProduttore = eArticolo.getElementsByTagName("codiceproduttore").item(0).getTextContent(); + } + if (eArticolo.getElementsByTagName("ean").item(0) == null) { + l_codiceEan = ""; + } else { + l_codiceEan = eArticolo.getElementsByTagName("ean").item(0).getTextContent(); + } + if (l_codiceEan.equals("0000000000000") || l_codiceEan.indexOf("99999999") >= 0) + l_codiceEan = ""; + String l_categoriaImport = eArticolo.getElementsByTagName("categoria_merceologica_primaria").item(0).getTextContent(); + if (!eArticolo.getElementsByTagName("categoria_merceologica_primaria").item(0).getTextContent().trim().equals( + eArticolo.getElementsByTagName("categoria_merceologica_secondaria").item(0).getTextContent().trim())) + l_categoriaImport = l_categoriaImport + " " + l_categoriaImport; + art.resetBean(); + String l_nome = eArticolo.getElementsByTagName("descrizione").item(0).getTextContent(); + l_nome = l_nome.replace("Ñ", ""); + if (debug && + l_articoloCodiceFornitore.equals("MZ-V7S250BW")) + System.out.println("cod prod: " + l_articoloCodiceFornitore); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(2111L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + if (art.getId_articolo() == 0L && !l_codiceEan.isEmpty()) { + if (l_codiceEan.length() < 13) + l_codiceEan = DBAdapter.zeroLeft(l_codiceEan, 13); + art.findByCodiceEanSerie(l_codiceEan, serie); + if (art.getId_articolo() == 0L && !l_articoloCodiceProduttore.isEmpty()) + art.findByCodiceProduttoreMarca(l_articoloCodiceProduttore, marca.getId_marca()); + } + String urlImmagine = ""; + String appoggiaPrezzo = eArticolo.getElementsByTagName("prezzo_netto").item(0).getTextContent(); + appoggiaPrezzo = appoggiaPrezzo.replaceAll("[^0-9,]", ""); + appoggiaPrezzo = appoggiaPrezzo.replace(".", ""); + appoggiaPrezzo = appoggiaPrezzo.replace(',', '.'); + String appoggiaPercScont = eArticolo.getElementsByTagName("sconto").item(0).getTextContent(); + appoggiaPercScont = appoggiaPercScont.replaceAll("[^0-9,]", ""); + String appoggiaSiae = eArticolo.getElementsByTagName("siae").item(0).getTextContent(); + appoggiaSiae = appoggiaSiae.replaceAll("[^0-9,]", ""); + appoggiaSiae = appoggiaSiae.replace(".", ""); + appoggiaSiae = appoggiaSiae.replace(',', '.'); + String dispo = eArticolo.getElementsByTagName("disponibilita_sede").item(0).getTextContent(); + String dispoImp = eArticolo.getElementsByTagName("impegnato_sede").item(0).getTextContent(); + String dispoCash = eArticolo.getElementsByTagName("disponibilita_filiale").item(0).getTextContent(); + String dispoCashImp = eArticolo.getElementsByTagName("impegnato_filiale").item(0).getTextContent(); + l_descrizioneTecnica = ""; + try { + prezzo = Double.valueOf(appoggiaPrezzo); + double percSconto = Double.valueOf(appoggiaPercScont); + if (percSconto > 0.0D) + isPromo = true; + siae = Double.valueOf(appoggiaSiae); + streetprice = 0.0D; + dispoL = (long)Double.parseDouble(dispo) - (long)Double.parseDouble(dispoImp); + if (dispoL < 0L) + dispoL = 0L; + dispoCashL = (long)Double.parseDouble(dispoCash) - (long)Double.parseDouble(dispoCashImp); + long dispoTotL = dispoL + dispoCashL; + if (dispoTotL > 0L) { + salvaArticoloNuovo = true; + } else { + salvaArticoloNuovo = false; + } + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato: " + appoggiaPrezzo + "\n" + currentLine + "\n"); + recordErrati++; + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (art.getId_tipo() != 1L && !hsTipi.contains(Long.valueOf(art.getId_tipo()))) + hsTipi.add(Long.valueOf(art.getId_tipo())); + if (debug); + art.aggiornaCodiciAlternativi(false); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCategoriaImport().indexOf(l_categoriaImport) < 0) + art.setCategoriaImport(art.getCategoriaImport() + art.getCategoriaImport()); + if (marca.getId_marca() > 0L && art.getId_marca() == 0L) + art.setId_marca(marca.getId_marca()); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } else if (salvaArticoloNuovo) { + double percentualeRicarico; + isNuovo = true; + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + art.setNome(l_nome); + art.setDescrizione(l_nome); + art.setCodiceEan(l_codiceEan); + art.setCategoriaImport(l_categoriaImport); + art.setId_marca(marca.getId_marca()); + art.setFlgEscludiWebArt(1L); + art.setCostoNetto(prezzo); + art.setFlgModImportazione(1L); + if (prezzo <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setNome(l_nome); + art.setDescrizione(l_nome); + art.setCodiceEan(l_codiceEan); + art.setId_marca(0L); + art.setFlgEscludiWebArt(1L); + art.setCostoNetto(prezzo); + art.setFlgModImportazione(1L); + if (prezzo <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCodiciAlternativi().length() > 50) + System.out.println(art.getCodice() + " " + art.getCodice()); + if (marca.getId_marca() > 0L) + art.setId_marca(marca.getId_marca()); + art.setId_fornitoreCostoNuovo(2111L); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + if (rp.getStatus()) { + DoubleOperator prezzoPubblico = new DoubleOperator(percentualeRicarico); + prezzoPubblico.setScale(2, 5); + prezzoPubblico.divide(100.0F); + prezzoPubblico.add(1); + prezzoPubblico.multiply(prezzo); + if (streetprice > 0.0D && prezzoPubblico.getResult() > streetprice) + prezzoPubblico = new DoubleOperator(streetprice); + ListinoArticolo lab = art.getListinoArticoloBase(); + if (prezzoPubblico.getResult() != lab.getPrezzoIvaLA()) { + System.out.println("Articolo " + art.getCodice() + " prezzo cambiato da " + lab.getPrezzoIvaLA() + " a " + + prezzoPubblico.getResult()); + lab.setPrezzoLA(prezzoPubblico.getResult()); + lab.save(); + } + art.setStreetPrice(streetprice); + if (art.getPrezzoArticolo(null).getPrezzoBase() > streetprice) { + ListinoArticolo listinoArticoloBase = art.getListinoArticoloBase(); + System.out.println(listinoArticoloBase.getId_listinoArticolo()); + listinoArticoloBase.setPrezzoLA(streetprice); + rp = listinoArticoloBase.save(); + } + if (!l_descrizioneTecnica.isEmpty()) + art.setDescTxtLang("descrizioneCommerciale", "it", l_descrizioneTecnica); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + } + if (!rp.getStatus()) { + err.append("Art. Nuovo: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + artNuovoKO++; + } else { + artNuovo++; + if (urlImmagine != null && !urlImmagine.isEmpty() && urlImmagine.endsWith(".jpg")) + art.caricaImmaginaDaRemoto(urlImmagine); + } + } else { + artNuovoNonSalvato++; + } + if (art.getId_articolo() > 0L && prezzo > 0.0D) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(2111L, art.getId_articolo(), -1L); + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(2111L); + af.setCostoVecchio(af.getCostoTotale()); + af.setCosto(prezzo); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + af.setCodiceFornitore(l_articoloCodiceFornitore); + af.setStreetPrice(streetprice); + af.setDispCash(dispoCashL); + int giornoMeseAttuale = cal.get(5); + cal.add(2, 1); + cal.set(5, 1); + cal.add(6, -1); + int giornoFineMeseAttuale = cal.get(5); + if (giornoMeseAttuale <= giornoFineMeseAttuale - 5) { + af.setDispSede(dispoL); + } else { + af.setDispSede(0L); + } + af.setCostoAggiuntivo(siae); + af.setFlgControlloCostoAggAF(1L); + af.setFlgPromo(isPromo ? 1L : 0L); + rp = af.save(); + if (rp.getStatus()) { + art.aggiornaPrezziEDispoByFornitori(streetprice, isNuovo); + if (art.getFlgModImportazione() == 2L) { + prezzoModificato++; + } else if (art.getFlgModImportazione() == 3L) { + prezzoNonModificato++; + } + if (art.getFlgEscludiWebArt() == 2L) { + articoloSospeso++; + } else if (art.getFlgEscludiWebArt() == 0L) { + articoloVisibile++; + } + } + } + } else { + artEscluso++; + System.out.println("marca scartata: " + l_marcaDesc); + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Large: Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE BREVI " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- tot art: "); + sb.append(totArticoli); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BREVI ", sb.toString()); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! IMPORT BREVI record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BREVI ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import Articolo e Prezzi BREVI " + serie + " avvenuta correttamente. - File:" + l_fileName + " - Record processati: "); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + sb.append(" - Update articoli non trovati: - "); + sb.append(rp.getMsg()); + sb.append(" - DEBUG BREVI SCARTO CODICI: - "); + sb.append(scartoCodici.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import Articolo e Prezzi BREVI " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + } + + class ThreadImportRunner extends Thread { + private static final String RUNNER_FTP_URL = "runnertechstore.it"; + + private static final String RUNNER_FTP_USER = "C250453"; + + private static final String RUNNER_FTP_PWD = "rfukd8f0"; + + private static final String PREFISSO_CODICE_RUNNER = "RU_"; + + private ApplParmFull apFull; + + private final String TAG_THREAD_MSG = "IMPORT RUNNER "; + + private boolean sendEmail; + + private long[] flgTipoImportAr; + + private static final long l_id_fornitore = 2117L; + + private static final long l_id_tipoDaDafinire = 1L; + + private static final long TIPO_IMPORT_RUNNER_ANAGRAFICA = 0L; + + private static final long TIPO_IMPORT_RUNNER_PREZZI = 1L; + + private static final long TIPO_IMPORT_RUNNER_DESC_IMG = 2L; + + private static final long TIPO_IMPORT_RUNNER_DISPO = 3L; + + private static final long TIPO_IMPORT_RUNNER_PESO = 4L; + + private String getTipoImport(long flgTipoImport) { + switch ((int)flgTipoImport) { + case 0: + return " Anagrafica"; + case 2: + return " Descrizione e Immagini"; + case 3: + return " Dispo"; + case 1: + return " Prezzi"; + case 4: + return " Peso"; + } + return "??"; + } + + private String getTipoImportPathFtp(long flgTipoImport) { + switch ((int)flgTipoImport) { + case 0: + return "articoli.txt"; + case 2: + return "descp.txt"; + case 3: + return "dispo.txt"; + case 1: + return "C250453/prezzi.txt"; + case 4: + return "peso.txt"; + } + return "??"; + } + + public ThreadImportRunner(ApplParmFull apFull, long[] flgTipoImportAr, boolean sendEmail) { + this.apFull = apFull; + this.sendEmail = sendEmail; + this.flgTipoImportAr = flgTipoImportAr; + if (!CCImport.isThreadRunnerAttivo()) { + CCImport.threadImportRunner = true; + start(); + } + } + + public void run() { + boolean debug = false; + boolean salvaArticoloNuovo = true; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT RUNNER ", "...inizio ..."); + String serverFtp = "runnertechstore.it"; + String user = "C250453"; + String pass = "rfukd8f0"; + String serie = ""; + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("##############\n IMPORT RUNNER " + serie + "\nSTART: " + start.toString()); + ResParm rp = new ResParm(true); + StringBuilder sbMsg = new StringBuilder(); + String targetDir = this.apFull.getParm("DOCBASE").getTesto() + this.apFull.getParm("DOCBASE").getTesto(); + for (int i = 0; i < this.flgTipoImportAr.length; i++) { + String l_fileToDownload = getTipoImportPathFtp(this.flgTipoImportAr[i]); + String l_fileName = targetDir + targetDir; + l_fileName = l_fileName.replace(".txt", "_" + DBAdapter.getTimeNameForFileUpload() + ".txt"); + if (!debug) { + StatusMsg.updateMsgByTag(this.apFull, "IMPORT RUNNER ", + getTipoImport(this.flgTipoImportAr[i]) + ": Download nuovo file " + getTipoImport(this.flgTipoImportAr[i]) + " su " + l_fileToDownload); + new File(l_fileName).delete(); + rp = DBAdapter.getFileViaFtp(serverFtp, user, pass, l_fileToDownload, l_fileName); + } else { + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/" + getTipoImportPathFtp(this.flgTipoImportAr[i]); + } + if (!new File(l_fileName).exists()) + StatusMsg.updateMsgByTag(this.apFull, "IMPORT RUNNER ", + getTipoImport(this.flgTipoImportAr[i]) + ": ERRORE!! FILE " + getTipoImport(this.flgTipoImportAr[i]) + " NON TROVATO!!!"); + switch ((int)this.flgTipoImportAr[i]) { + case 0: + rp = importAnagraficaDispoCSV(l_fileName); + break; + case 2: + rp = importDecrizioniImgCSV(l_fileName); + break; + case 1: + rp = importPrezzoCSV(l_fileName); + break; + } + } + timer.stop(); + rp.setMsg("Import concluso. IMPORT RUNNER DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + if (this.sendEmail) + CCImport.this.sendArticoliCambiatiByEmail(this.apFull, rp.getMsg(), 2117L); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT RUNNER ", rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.apFull, "IMPORT RUNNER "); + CCImport.threadImportRunner = false; + System.out.println(rp.getMsg()); + if (CCImport.this.getAttivita(this.apFull).getFlgEbay() == 1L) { + Articolo bean = new Articolo(this.apFull); + bean.startThreadAllineaEbay(this.apFull, new ArticoloCR()); + } + if (CCImport.this.getAttivita(this.apFull).getFlgAmz() == 1L) { + Articolo bean = new Articolo(this.apFull); + bean.startThreadAllineaAmz(this.apFull, new ArticoloCR()); + } + } + + public ResParm importAnagraficaDispoCSV(String l_fileName) { + boolean debug = false; + boolean salvaArticoloNuovo = true; + boolean isNuovo = false; + String TAG_EXTRA = " ANAGRAFICA E DISPO"; + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + long SOSPENDI_DOPO_N_GG = this.apFull.getParm("CC_SOSPENDI_DOPO_N_GG_NO_IMPORT").getNumeroLong(); + String CVS_SEPARATOR = "|"; + int colArticoloCodiceAlternativoFornitore = 0; + int colArticoloCodiceProduttore = 1; + int colArticoloCodiceEAN = 2; + int colArticoloDescrizione = 3; + int colArticoloMarca = 4; + int colArticoloCodiceCategoria = 6; + int colArticoloDescCategoria = 7; + int colArticoloDispo = 8; + int colArticoloPromo = 10; + int colArticoloDataPromo = 11; + if (SOSPENDI_DOPO_N_GG < 6L) + SOSPENDI_DOPO_N_GG = 6L; + String CLASSE_PRODOTTO_RICONDIZIONATO = "XXXXX"; + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + Articolo art = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + if (debug) + l_fileName = "/Users/acolzi/Downloads/articolid-link.txt"; + StatusMsg.updateMsgByTag(this.apFull, "IMPORT RUNNER ", " ANAGRAFICA E DISPO: Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 2117L); + String currentLine = ""; + try { + Marca marca = new Marca(this.apFull); + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + Calendar cal = Calendar.getInstance(); + String l_descrizioneTecnica = ""; + boolean isPromo = false; + reader.readLine(); + while ((currentLine = reader.readLine()) != null) { + isNuovo = false; + isPromo = false; + StringTokenizer st = new StringTokenizer(currentLine, CVS_SEPARATOR); + if (st.countToken() >= 6) { + String l_marcaDesc = st.getToken(colArticoloMarca); + marca.findByDescrizioneImport(l_marcaDesc); + if (marca.getId_marca() > 0L) { + String l_classeProdotto = "yy"; + String l_articoloCodiceFornitore = st.getToken(colArticoloCodiceAlternativoFornitore).trim(); + String l_articoloCodiceProduttore = st.getToken(colArticoloCodiceProduttore).trim(); + String l_nome = st.getToken(colArticoloDescrizione).trim(); + String dispo = st.getToken(colArticoloDispo); + long dispoL = Long.parseLong(dispo); + isPromo = st.getToken(colArticoloPromo).equals("1"); + String finePromo = st.getToken(colArticoloDataPromo); + if (finePromo != null && !finePromo.isEmpty()) { + cal.set(1, Integer.valueOf(finePromo.substring(6, 10)).intValue()); + cal.set(2, Integer.valueOf(finePromo.substring(3, 5)) - 1); + cal.set(5, Integer.valueOf(finePromo.substring(0, 2)).intValue()); + cal.add(6, -1); + Date dataFinePromo = new Date(cal.getTimeInMillis()); + } else { + Date dataFinePromo = null; + } + if (!l_classeProdotto.equals("XXXXX")) { + String l_codiceCategoria = st.getToken(colArticoloCodiceCategoria).trim(); + String l_categoriaImport = st.getToken(colArticoloDescCategoria).trim(); + String l_articoloCodiceAlternativoFornitore = "RU_" + l_articoloCodiceFornitore; + String l_codiceEan = st.getToken(colArticoloCodiceEAN).trim(); + if (l_codiceEan.length() < 13) + l_codiceEan = DBAdapter.zeroLeft(l_codiceEan, 13); + if (l_codiceEan.equals("0000000000000") || l_codiceEan.indexOf("99999999") >= 0) + l_codiceEan = ""; + if (debug && + l_articoloCodiceAlternativoFornitore.equals("CG_7DB75EA")) + System.out.println(l_articoloCodiceAlternativoFornitore); + art.resetBean(); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(2117L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + if (art.getId_articolo() == 0L && !l_codiceEan.isEmpty()) + art.findByCodiceEanSerie(l_codiceEan, serie); + if (art.getId_articolo() == 0L && !l_articoloCodiceProduttore.isEmpty()) + art.findByCodiceProduttoreMarca(l_articoloCodiceProduttore, marca.getId_marca()); + String urlImmagine = ""; + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (debug); + art.aggiornaCodiciAlternativi(false); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCodiciAlternativi().length() > 90) + System.out.println(art.getCodice() + " " + art.getCodice()); + if (!l_categoriaImport.isEmpty() && art.getCategoriaImport().indexOf(l_categoriaImport) < 0) + art.setCategoriaImport(art.getCategoriaImport() + art.getCategoriaImport()); + if (marca.getId_marca() > 0L && art.getId_marca() == 0L) + art.setId_marca(marca.getId_marca()); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.superSave(); + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } else if (salvaArticoloNuovo) { + isNuovo = true; + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + art.setNome(l_nome); + art.setDescrizione(l_nome); + art.setCodiceEan(l_codiceEan); + art.setId_marca(marca.getId_marca()); + art.setCategoriaImport(l_categoriaImport); + art.setFlgEscludiWebArt(1L); + art.setFlgModImportazione(1L); + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setNome(l_nome); + art.setDescrizione(l_nome); + art.setCodiceEan(l_codiceEan); + art.setId_marca(0L); + art.setFlgEscludiWebArt(1L); + art.setFlgModImportazione(1L); + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCodiciAlternativi().length() > 90) + System.out.println(art.getCodice() + " " + art.getCodice()); + if (marca.getId_marca() > 0L) + art.setId_marca(marca.getId_marca()); + art.setId_fornitoreCostoNuovo(2117L); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + if (!rp.getStatus()) { + err.append("Art. Nuovo: " + l_articoloCodiceAlternativoFornitore + " - " + + art.getDescrizione() + " - " + rp.getMsg() + " - "); + artNuovoKO++; + } else { + artNuovo++; + } + } else { + artNuovoNonSalvato++; + } + boolean test = false; + if (art.getId_articolo() > 0L) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(2117L, art.getId_articolo(), -1L); + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(2117L); + af.setCodiceFornitore(l_articoloCodiceFornitore); + if (af.getDispSede() != dispoL) { + test = true; + if (af.getId_articolo() == 146297L) + DBAdapter.printDebug("XXXXXXXXXXXXXXXXXXXXXXXXXXXX 146297 XXXXXXXXXXXXXXXX"); + DBAdapter.printDebug("\nRunner - cambio dispo fornitore per articolo: " + art.getCodice() + " da " + + af.getDispSede() + " a " + dispoL + " + aggiornamento data ultimo prezzo"); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + } + af.setDispSede(dispoL); + af.setFlgPromo(isPromo ? 1L : 0L); + DBAdapter.printDebug(test, "\nRunner - articolo: " + art.getCodice() + " salvo dispo a " + dispoL + " ====" + + af.getDispSede()); + rp = af.save(); + DBAdapter.printDebug(test, "\nRunner - articolo: " + art.getCodice() + " SALVATO: dispo a " + + af.getDispSede() + " RP:" + rp.getMsg()); + if (rp.getStatus()) { + art.aggiornaPrezziEDispoByFornitori(0.0D, isNuovo); + if (art.getFlgModImportazione() == 2L) { + prezzoModificato++; + } else if (art.getFlgModImportazione() == 3L) { + prezzoNonModificato++; + } + if (art.getFlgEscludiWebArt() == 2L) { + articoloSospeso++; + } else if (art.getFlgEscludiWebArt() == 0L) { + articoloVisibile++; + } + } + } + } else { + artEscluso++; + System.out.println("prodotto ricondizionato escluso: codice Forn.:" + l_articoloCodiceFornitore + " codice produttore: " + l_articoloCodiceProduttore + "\n" + l_nome); + } + } else { + artEscluso++; + System.out.println("marca scartata: " + l_marcaDesc); + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE INGRAMMICRO " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT RUNNER ", " ANAGRAFICA E DISPO" + sb.toString()); + } + ArticoloCR CR = new ArticoloCR(this.apFull); + CR.setId_fornitore(2117L); + CR.setFlgModImportazione(0L); + Vectumerator vec = bean.findByCR(CR, 0, 0); + i = 0; + while (vec.hasMoreElements()) { + i++; + StatusMsg.updateMsgByTag(this.apFull, "IMPORT RUNNER ", " ANAGRAFICA E DISPO aggiornamento articoli non trovati " + i + " su " + + vec.getTotNumberOfRecords()); + Articolo row = (Articolo)vec.nextElement(); + if (row.getId_fornitoreCostoNuovo() == 2117L) { + row.azzeraQuantita(2L); + continue; + } + String s_sql_sqring = "UPDATE ARTICOLO_FORNITORE SET dispSede=0, dispCash=0 where id_articolo=" + row.getId_articolo() + " and id_clifor=2117"; + rp = row.update(s_sql_sqring); + rp.append(row.aggiornaPrezziEDispoByFornitori(0.0D, false)); + } + if (SOSPENDI_DOPO_N_GG > 0L) + bean.update("UPDATE ARTICOLO SET flgEscludiWebArt=2,flgEscludiWeb=2 WHERE codice LIKE '" + serie + "%' and flgModImportazione = 0 and DATEDIFF(CURDATE(), dataUltimoImport)>=" + SOSPENDI_DOPO_N_GG + ";"); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! IMPORT RUNNER record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT RUNNER ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import IMPORT RUNNER ANAGRAFICA E DISPO " + serie + " avvenuta correttamente. Record processati: "); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import IMPORT RUNNER ANAGRAFICA E DISPO " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + + public ResParm importPrezzoCSV(String l_fileName) { + boolean debug = false; + boolean salvaArticoloNuovo = false; + boolean isNuovo = false; + String TAG_EXTRA = " PREZZI"; + isNuovo = false; + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + long SOSPENDI_DOPO_N_GG = this.apFull.getParm("CC_SOSPENDI_DOPO_N_GG_NO_IMPORT").getNumeroLong(); + String CVS_SEPARATOR = "|"; + int colArticoloCodiceAlternativoFornitore = 0; + int colPrezzo = 1; + if (SOSPENDI_DOPO_N_GG < 6L) + SOSPENDI_DOPO_N_GG = 6L; + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + Articolo art = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + if (debug) + l_fileName = "/Users/acolzi/Downloads/prezzyashi.txt"; + StatusMsg.updateMsgByTag(this.apFull, "IMPORT RUNNER ", " PREZZI: Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 2117L); + String currentLine = ""; + try { + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + Calendar cal = Calendar.getInstance(); + String l_descrizioneTecnica = ""; + boolean isPromo = false; + reader.readLine(); + while ((currentLine = reader.readLine()) != null) { + isNuovo = false; + isPromo = false; + StringTokenizer st = new StringTokenizer(currentLine, CVS_SEPARATOR); + if (st.countToken() >= 2) { + double prezzo; + String l_articoloCodiceFornitore = st.getToken(colArticoloCodiceAlternativoFornitore).trim(); + String l_articoloCodiceAlternativoFornitore = "RU_" + l_articoloCodiceFornitore; + String appoggiaPrezzo = st.getToken(colPrezzo).trim(); + try { + prezzo = Double.valueOf(appoggiaPrezzo.replace(',', '.')); + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato: " + appoggiaPrezzo + "\n" + currentLine + "\n"); + continue; + } + art.resetBean(); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(2117L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(2117L, art.getId_articolo(), -1L); + if (af.getCosto() != prezzo || art.getCostoNetto() == 0.0D) { + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(2117L); + af.setCostoVecchio(af.getCostoTotale()); + af.setCosto(prezzo); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + af.setCodiceFornitore(l_articoloCodiceFornitore); + af.setStreetPrice(0.0D); + rp = af.save(); + if (rp.getStatus()) { + art.aggiornaPrezziEDispoByFornitori(0.0D, isNuovo); + if (art.getFlgModImportazione() == 2L) { + prezzoModificato++; + } else if (art.getFlgModImportazione() == 3L) { + prezzoNonModificato++; + } + if (art.getFlgEscludiWebArt() == 2L) { + articoloSospeso++; + } else if (art.getFlgEscludiWebArt() == 0L) { + articoloVisibile++; + } + } + } + if (art.getFlgEscludiWebArt() == 2L) { + articoloSospeso++; + } else if (art.getFlgEscludiWebArt() == 0L) { + articoloVisibile++; + } + } else { + artEscluso++; + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE IMPORT RUNNER " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. non trovati: "); + sb.append(artEscluso); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT RUNNER ", " PREZZI" + sb.toString()); + } + if (SOSPENDI_DOPO_N_GG > 0L) + bean.update("UPDATE ARTICOLO SET flgEscludiWebArt=2,flgEscludiWeb=2 WHERE codice LIKE '" + serie + "%' and flgModImportazione = 0 and DATEDIFF(CURDATE(), dataUltimoImport)>=" + SOSPENDI_DOPO_N_GG + ";"); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! IMPORT RUNNER record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT RUNNER ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import IMPORT RUNNER PREZZI " + serie + " avvenuta correttamente. Record processati: "); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import IMPORT RUNNER PREZZI " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + + public ResParm importDecrizioniImgCSV(String l_fileName) { + boolean debug = false; + boolean salvaArticolo = false; + String TAG_EXTRA = " DESCRIZIONI E IMMAGINI"; + String serie = ""; + String l_lang = "it"; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + int artAggiornati = 0, artEscluso = 0, artNonSalvato = 0, artDescrizioneAggiunta = 0, artImgSalvata = 0, recordErrati = 0; + String CVS_SEPARATOR = "|"; + int colArticoloCodiceAlternativoFornitore = 0; + int colLinkImg = 1; + int colDescrizione = 3; + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + Articolo art = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + if (debug) + l_fileName = "/Users/acolzi/Documents/webapps/cc/_tmp/PRICE1.TXT"; + String currentLine = ""; + try { + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + reader.readLine(); + while ((currentLine = reader.readLine()) != null) { + salvaArticolo = false; + StringTokenizer st = new StringTokenizer(currentLine, CVS_SEPARATOR); + if (st.countToken() >= 2) { + String l_articoloCodiceFornitore = st.getToken(colArticoloCodiceAlternativoFornitore).trim(); + String l_articoloCodiceAlternativoFornitore = "RU_" + l_articoloCodiceFornitore; + String l_descrizione = st.getToken(colDescrizione); + String l_linkImmagine = st.getToken(colLinkImg); + art.resetBean(); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(2117L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (!l_linkImmagine.isEmpty()) + if (!art.isImgExist(1)) { + salvaArticolo = true; + art.caricaImmaginaDaRemoto(l_linkImmagine, 1L); + artImgSalvata++; + } + if (art.getDescrizioneCommerciale(l_lang).isEmpty() && !l_descrizione.isEmpty()) { + art.setDescTxtLang("descrizioneCommerciale", l_lang, l_descrizione); + if (art.getDescrizioneBreve(l_lang).isEmpty()) + art.setDescTxtLang("descrizioneBreve", l_lang, art.getNome()); + salvaArticolo = true; + artDescrizioneAggiunta++; + } + if (salvaArticolo) { + System.out.println("importDecrizioniImgCSV runner: codice: " + art.getId_articolo()); + art.setFlgTipoSchedaArticoloWww(2L); + rp = art.save(); + if (!rp.getStatus()) + artNonSalvato++; + } + } else { + artEscluso++; + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE IMPORT RUNNER " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. desc aggiunta: "); + sb.append(artDescrizioneAggiunta); + sb.append("- art. img salvata: "); + sb.append(artImgSalvata); + sb.append("- art. non salvati: "); + sb.append(artNonSalvato); + sb.append("- art. non trovati: "); + sb.append(artEscluso); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT RUNNER ", " DESCRIZIONI E IMMAGINI" + sb.toString()); + } + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! IMPORT RUNNER record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT RUNNER ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import IMPORT RUNNER DESCRIZIONI E IMMAGINI " + serie + " avvenuta correttamente. Record processati: "); + sb.append(i); + sb.append("- art. desc aggiunta: "); + sb.append(artDescrizioneAggiunta); + sb.append("- art. img salvata: "); + sb.append(artImgSalvata); + sb.append("- art. non salvati: "); + sb.append(artNonSalvato); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import IMPORT RUNNER DESCRIZIONI E IMMAGINI " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + } + + class ThreadImportBestIt extends Thread { + private static final String BESTIT_LOCAL_PATH = "/home/sites/f3/_listini/_bestit/"; + + private static final String PREFISSO_CODICE_BESTIT = "BI_"; + + private ApplParmFull apFull; + + private final String TAG_THREAD_MSG = "IMPORT BESTIT "; + + private boolean sendEmail; + + private long[] flgTipoImportAr; + + private static final long l_id_fornitore = 2131L; + + private static final long l_id_tipoDaDafinire = 1L; + + private static final long TIPO_IMPORT_BESTIT_ANAG_DISPO_PREZZI = 0L; + + private static final long TIPO_IMPORT_BESTIT_DESC_IMG = 1L; + + private String getTipoImport(long flgTipoImport) { + switch ((int)flgTipoImport) { + case 0: + return " Anag, Dispo, Prezzi"; + case 1: + return " Descrizione e Immagini"; + } + return "??"; + } + + public ThreadImportBestIt(ApplParmFull apFull, long[] flgTipoImportAr, boolean sendEmail) { + this.apFull = apFull; + this.sendEmail = sendEmail; + this.flgTipoImportAr = flgTipoImportAr; + if (!CCImport.isThreadEsprinetAttivo()) { + CCImport.threadImportBestit = true; + start(); + } + } + + public void run() { + String l_fileName; + boolean debug = false; + boolean salvaArticoloNuovo = true; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BESTIT ", "...inizio ..."); + String serie = ""; + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("##############\n IMPORT BESTIT " + serie + "\nSTART: " + start.toString()); + ResParm rp = new ResParm(true); + String l_fileToDownload = "EsportaArticoli.txt"; + StringBuilder sbMsg = new StringBuilder(); + String targetDir = "/home/sites/f3/_listini/_bestit/"; + if (debug) { + l_fileName = "/Users/acolzi/Downloads/" + l_fileToDownload; + } else { + l_fileName = targetDir + targetDir; + } + if (new File(l_fileName).exists()) { + for (int i = 0; i < this.flgTipoImportAr.length; i++) { + if (!debug) + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BESTIT ", + getTipoImport(this.flgTipoImportAr[i]) + ": Elaborazione nuovo file " + getTipoImport(this.flgTipoImportAr[i]) + " su " + l_fileToDownload); + if (!new File(l_fileName).exists()) + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BESTIT ", + getTipoImport(this.flgTipoImportAr[i]) + ": ERRORE!! FILE " + getTipoImport(this.flgTipoImportAr[i]) + " NON TROVATO!!!"); + switch ((int)this.flgTipoImportAr[i]) { + case 0: + rp = importAnagDispoPrezzoCSV(l_fileName); + break; + case 1: + rp = importDecrizioniImgCSV(l_fileName); + break; + } + } + } else { + rp.setMsg("ERRORE!! file " + l_fileName + " NON TROVATO"); + } + timer.stop(); + rp.setMsg("Import concluso. IMPORT BESTIT DURATA: " + timer.getDurataHourMin() + "\n" + rp.getMsg()); + if (this.sendEmail) + CCImport.this.sendArticoliCambiatiByEmail(this.apFull, rp.getMsg(), 2131L); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BESTIT ", rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(this.apFull, "IMPORT BESTIT "); + CCImport.threadImportBestit = false; + System.out.println(rp.getMsg()); + if (CCImport.this.getAttivita(this.apFull).getFlgEbay() == 1L) { + Articolo bean = new Articolo(this.apFull); + bean.startThreadAllineaEbay(this.apFull, new ArticoloCR()); + } + if (CCImport.this.getAttivita(this.apFull).getFlgAmz() == 1L) { + Articolo bean = new Articolo(this.apFull); + bean.startThreadAllineaAmz(this.apFull, new ArticoloCR()); + } + } + + public ResParm importAnagDispoPrezzoCSV(String l_fileName) { + boolean debug = false; + boolean salvaArticoloNuovo = true; + boolean isNuovo = false; + String TAG_EXTRA = " ANAGRAFICA DISPO PREZZO"; + String serie = ""; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + int artAggiornati = 0, artEscluso = 0, artNuovo = 0, artNuovoKO = 0, artNuovoNonSalvato = 0, recordErrati = 0; + int prezzoModificato = 0, prezzoNonModificato = 0, articoloSospeso = 0, articoloVisibile = 0, articoloInOrdine = 0; + long SOSPENDI_DOPO_N_GG = this.apFull.getParm("CC_SOSPENDI_DOPO_N_GG_NO_IMPORT").getNumeroLong(); + String CVS_SEPARATOR = "|"; + int colArticoloCodiceAlternativoFornitore = 2; + int colArticoloCodiceProduttore = 1; + int colArticoloCodiceEAN = 11; + int colArticoloDescrizione = 3; + int colArticoloMarca = 0; + int colArticoloCodiceCategoria = 4; + int colArticoloDescCategoria = 10; + int colArticoloDispo = 6; + int colPrezzo = 5; + int colPrezzoOfferta = 9; + int colStreetprice = -1; + int colLinkFoto = 12; + int colSchedaTecnica = 13; + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BESTIT ", ": Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 2131L); + String currentLine = ""; + try { + Marca marca = new Marca(this.apFull); + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + reader.readLine(); + Calendar cal = Calendar.getInstance(); + String l_descrizioneTecnica = ""; + boolean isPromo = false; + Articolo art = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + while ((currentLine = reader.readLine()) != null) { + String dispoCash = ""; + double streetprice = 0.0D; + isNuovo = false; + isPromo = false; + StringTokenizer st = new StringTokenizer(currentLine, CVS_SEPARATOR, '"'); + if (st.countToken() >= 6) { + String l_marcaDesc = st.getToken(colArticoloMarca); + marca.findByDescrizioneImport(l_marcaDesc); + if (marca.getId_marca() > 0L) { + long dispoL; + double prezzo; + String l_nome = st.getToken(colArticoloDescrizione).trim(); + String urlImmagine = st.getToken(colLinkFoto); + l_descrizioneTecnica = st.getToken(colSchedaTecnica); + String l_codiceCategoria = st.getToken(colArticoloCodiceCategoria).trim(); + String l_categoriaImport = l_codiceCategoria + " " + l_codiceCategoria; + String l_articoloCodiceFornitore = st.getToken(colArticoloCodiceAlternativoFornitore).trim(); + String l_articoloCodiceAlternativoFornitore = "BI_" + l_articoloCodiceFornitore; + l_articoloCodiceAlternativoFornitore = "BI_" + l_articoloCodiceFornitore; + String l_articoloCodiceProduttore = st.getToken(colArticoloCodiceProduttore).trim(); + String l_codiceEan = st.getToken(colArticoloCodiceEAN).trim(); + if (l_codiceEan.length() < 13) + l_codiceEan = DBAdapter.zeroLeft(l_codiceEan, 13); + if (l_codiceEan.equals("0000000000000") || l_codiceEan.indexOf("99999999") >= 0) + l_codiceEan = ""; + art.resetBean(); + if (debug && + l_articoloCodiceAlternativoFornitore.equals("CG_7DB75EA")) + System.out.println(l_articoloCodiceAlternativoFornitore); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(2131L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + if (art.getId_articolo() == 0L && !l_codiceEan.isEmpty()) + art.findByCodiceEanSerie(l_codiceEan, serie); + if (art.getId_articolo() == 0L && !l_articoloCodiceProduttore.isEmpty()) + art.findByCodiceProduttoreMarca(l_articoloCodiceProduttore, marca.getId_marca()); + if (st.countToken() > 7); + String appoggiaPrezzo = st.getToken(colPrezzo).trim(); + String appoggiaPrezzoOfferta = st.getToken(colPrezzoOfferta).trim(); + String dispo = st.getToken(colArticoloDispo).trim(); + try { + prezzo = Double.valueOf(appoggiaPrezzo.replace(',', '.')); + double prezzoOfferta = Double.valueOf(appoggiaPrezzoOfferta.replace(',', '.')); + dispoL = Long.parseLong(dispo); + long dispoTotL = dispoL; + if (dispoTotL > 0L) { + salvaArticoloNuovo = true; + } else { + salvaArticoloNuovo = false; + } + } catch (Exception e) { + err.append("Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " - "); + System.out.println("err: Record scartato prezzo errato: " + l_articoloCodiceAlternativoFornitore + " prezzo rilevato:" + appoggiaPrezzo + "\n" + currentLine + "\n"); + recordErrati++; + continue; + } + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (debug); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (!l_categoriaImport.isEmpty() && art.getCategoriaImport().indexOf(l_categoriaImport) < 0) + art.setCategoriaImport(art.getCategoriaImport() + art.getCategoriaImport()); + if (marca.getId_marca() > 0L && art.getId_marca() == 0L) + art.setId_marca(marca.getId_marca()); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + if (!rp.getStatus()) { + err.append("Art. agg: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + } else { + artAggiornati++; + } + } else if (salvaArticoloNuovo) { + double percentualeRicarico; + isNuovo = true; + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + art.setNome(l_nome); + art.setDescrizione(l_nome); + art.setCodiceEan(l_codiceEan); + art.setId_marca(marca.getId_marca()); + art.setFlgEscludiWebArt(1L); + art.setCostoNetto(prezzo); + art.setFlgModImportazione(1L); + if (prezzo <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setId_iva(this.apFull.getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + art.setId_tipo(1L); + if (!serie.isEmpty()) { + art.setCodice(art.getCodicePrimoLiberoBySerie(serie)); + System.out.println("nuovoCodice: " + art.getCodice()); + } + art.setNome(l_nome); + art.setDescrizione(l_nome); + art.setCodiceEan(l_codiceEan); + art.setId_marca(marca.getId_marca()); + art.setCategoriaImport(l_categoriaImport); + art.setFlgEscludiWebArt(1L); + art.setCostoNetto(prezzo); + art.setFlgModImportazione(1L); + if (prezzo <= (double)costoLimiteRicarico) { + percentualeRicarico = (double)ricaricoSottoLimite; + } else { + percentualeRicarico = (double)ricaricoSopraLimite; + } + art.setPercRicarico(percentualeRicarico); + art.setCodiciAlternativi(l_articoloCodiceAlternativoFornitore); + if (art.getCodiceProduttore().isEmpty() && !l_articoloCodiceProduttore.isEmpty()) + art.setCodiceProduttore(l_articoloCodiceProduttore); + if (art.getCodiceEan().isEmpty() && !l_codiceEan.isEmpty()) + art.setCodiceEan(l_codiceEan); + if (art.getCodiciAlternativi().length() > 50) + System.out.println(art.getCodice() + " " + art.getCodice()); + if (marca.getId_marca() > 0L) + art.setId_marca(marca.getId_marca()); + art.setId_fornitoreCostoNuovo(2131L); + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + if (rp.getStatus()) { + DoubleOperator prezzoPubblico = new DoubleOperator(percentualeRicarico); + prezzoPubblico.setScale(2, 5); + prezzoPubblico.divide(100.0F); + prezzoPubblico.add(1); + prezzoPubblico.multiply(prezzo); + if (streetprice > 0.0D && prezzoPubblico.getResult() > streetprice) + prezzoPubblico = new DoubleOperator(streetprice); + ListinoArticolo lab = art.getListinoArticoloBase(); + if (prezzoPubblico.getResult() != lab.getPrezzoIvaLA()) { + System.out.println("Articolo " + art.getCodice() + " prezzo cambiato da " + + lab.getPrezzoIvaLA() + " a " + prezzoPubblico.getResult()); + lab.setPrezzoLA(prezzoPubblico.getResult()); + lab.save(); + } + art.setStreetPrice(streetprice); + if (art.getPrezzoArticolo(null).getPrezzoBase() > streetprice) { + ListinoArticolo listinoArticoloBase = art.getListinoArticoloBase(); + System.out.println(listinoArticoloBase.getId_listinoArticolo()); + listinoArticoloBase.setPrezzoLA(streetprice); + rp = listinoArticoloBase.save(); + } + art.setCountImportNonTrovato(0L); + art.setDataUltimoImport(DBAdapter.getToday()); + rp = art.save(); + } + if (!rp.getStatus()) { + err.append("Art. Nuovo: " + l_articoloCodiceAlternativoFornitore + " - " + art.getDescrizione() + " - " + + rp.getMsg() + " - "); + artNuovoKO++; + } else { + artNuovo++; + if (urlImmagine != null && !urlImmagine.isEmpty() && urlImmagine.endsWith(".jpg")) + art.caricaImmaginaDaRemoto(urlImmagine); + } + } else { + artNuovoNonSalvato++; + } + if (art.getId_articolo() > 0L && prezzo > 0.0D) { + af = new ArticoloFornitore(this.apFull); + af.findByFornitoreArticolo(2131L, art.getId_articolo(), -1L); + af.setId_articolo(art.getId_articolo()); + af.setId_clifor(2131L); + af.setCostoVecchio(af.getCostoTotale()); + af.setCosto(prezzo); + af.setDataUltimoPrezzo(DBAdapter.getToday()); + af.setCodiceFornitore(l_articoloCodiceFornitore); + af.setStreetPrice(streetprice); + af.setDispSede(dispoL); + af.setFlgPromo(isPromo ? 1L : 0L); + rp = af.save(); + if (rp.getStatus()) { + art.aggiornaCodiciAlternativi(false); + art.aggiornaPrezziEDispoByFornitori(streetprice, isNuovo); + if (art.getFlgModImportazione() == 2L) { + prezzoModificato++; + } else if (art.getFlgModImportazione() == 3L) { + prezzoNonModificato++; + } + if (art.getFlgEscludiWebArt() == 2L) { + articoloSospeso++; + } else if (art.getFlgEscludiWebArt() == 0L) { + articoloVisibile++; + } + } + } + } else { + artEscluso++; + System.out.println("marca scartata: " + l_marcaDesc); + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Large: Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE ESPRINET " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BESTIT ", sb.toString()); + } + ArticoloCR CR = new ArticoloCR(this.apFull); + CR.setId_fornitore(2131L); + CR.setFlgModImportazione(0L); + Vectumerator vec = bean.findByCR(CR, 0, 0); + i = 0; + while (vec.hasMoreElements()) { + i++; + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BESTIT ", " ANAGRAFICA DISPO PREZZO aggiornamento articoli non trovati " + i + " su " + + vec.getTotNumberOfRecords()); + Articolo row = (Articolo)vec.nextElement(); + if (row.getId_fornitoreCostoNuovo() == 2131L) { + row.azzeraQuantita(2L); + continue; + } + String s_sql_sqring = "UPDATE ARTICOLO_FORNITORE SET dispSede=0, dispCash=0 where id_articolo=" + row.getId_articolo() + " and id_clifor=2131"; + rp = row.update(s_sql_sqring); + rp.append(row.aggiornaPrezziEDispoByFornitori(0.0D, false)); + } + if (SOSPENDI_DOPO_N_GG > 0L) + bean.update("UPDATE ARTICOLO SET flgEscludiWebArt=2,flgEscludiWeb=2 WHERE codice LIKE '" + serie + "%' and flgModImportazione = 0 and DATEDIFF(CURDATE(), dataUltimoImport)>=" + SOSPENDI_DOPO_N_GG + ";"); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! IMPORT BESTIT record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BESTIT ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import IMPORT BESTIT ANAGRAFICA DISPO PREZZO " + serie + " avvenuta correttamente. Record processati: "); + sb.append(i); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- art. nuovi: "); + sb.append(artNuovo); + sb.append("- art. nuovi NON SALVATI: "); + sb.append(artNuovoNonSalvato); + sb.append("- art. nuovi KO: "); + sb.append(artNuovoKO); + sb.append("- prezzi modificati: "); + sb.append(prezzoModificato); + sb.append("- prezzi NON modificati: "); + sb.append(prezzoNonModificato); + sb.append("- articoli sospesi: "); + sb.append(articoloSospeso); + sb.append("- articoli Visibili: "); + sb.append(articoloVisibile); + sb.append("- articoli in ordine: "); + sb.append(articoloInOrdine); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import IMPORT BESTIT ANAGRAFICA DISPO PREZZO " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + + public ResParm importDecrizioniImgCSV(String l_fileName) { + boolean debug = false; + boolean salvaArticolo = false; + boolean isNuovo = false; + String TAG_EXTRA = " ANAGRAFICA DISPO PREZZO"; + String serie = ""; + String l_lang = "it"; + long costoLimiteRicarico = 500L; + long ricaricoSottoLimite = 6L, ricaricoSopraLimite = 7L; + ResParm rp = new ResParm(true); + StringBuffer err = new StringBuffer(); + StringBuilder sb = new StringBuilder(); + int i = 0; + int se1 = 10; + int se2 = 100; + int artAggiornati = 0, artEscluso = 0, artNonSalvato = 0, artDescrizioneAggiunta = 0, artImgSalvata = 0, recordErrati = 0; + long SOSPENDI_DOPO_N_GG = this.apFull.getParm("CC_SOSPENDI_DOPO_N_GG_NO_IMPORT").getNumeroLong(); + String CVS_SEPARATOR = "|"; + int colArticoloCodiceAlternativoFornitore = 2; + int colArticoloCodiceProduttore = 1; + int colArticoloCodiceEAN = 11; + int colArticoloDescrizione = 3; + int colArticoloMarca = 0; + int colArticoloCodiceCategoria = 4; + int colArticoloDescCategoria = 10; + int colArticoloDispo = 6; + int colPrezzo = 5; + int colPrezzoOfferta = 9; + int colStreetprice = -1; + int colLinkFoto = 12; + int colSchedaTecnica = 13; + BufferedReader reader = null; + Articolo bean = new Articolo(this.apFull); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BESTIT ", ": Aggiornamento stato a non trovato su tutti gli articoli con fornitore dato"); + bean.updateModimportazioneByFornitore(0L, 2131L); + String currentLine = ""; + try { + Marca marca = new Marca(this.apFull); + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) { + reader.readLine(); + Calendar cal = Calendar.getInstance(); + String l_descrizioneTecnica = ""; + boolean isPromo = false; + Articolo art = new Articolo(this.apFull); + ArticoloFornitore af = new ArticoloFornitore(this.apFull); + while ((currentLine = reader.readLine()) != null) { + isNuovo = false; + isPromo = false; + StringTokenizer st = new StringTokenizer(currentLine, CVS_SEPARATOR, '"'); + if (st.countToken() >= 6) { + String l_marcaDesc = st.getToken(colArticoloMarca); + marca.findByDescrizioneImport(l_marcaDesc); + if (marca.getId_marca() > 0L) { + String l_nome = st.getToken(colArticoloDescrizione).trim(); + l_descrizioneTecnica = st.getToken(colSchedaTecnica); + String l_linkImmagine = st.getToken(colLinkFoto); + String l_articoloCodiceFornitore = st.getToken(colArticoloCodiceAlternativoFornitore).trim(); + String l_articoloCodiceAlternativoFornitore = "BI_" + l_articoloCodiceFornitore; + String l_articoloCodiceProduttore = st.getToken(colArticoloCodiceProduttore).trim(); + String l_codiceEan = st.getToken(colArticoloCodiceEAN).trim(); + if (l_codiceEan.length() < 13) + l_codiceEan = DBAdapter.zeroLeft(l_codiceEan, 13); + if (l_codiceEan.equals("0000000000000") || l_codiceEan.indexOf("99999999") >= 0) + l_codiceEan = ""; + art.resetBean(); + if (art.getId_articolo() == 0L) { + af.findByCodiceFornitore(2131L, l_articoloCodiceFornitore); + if (af.getId_articolo() > 0L) + art = af.getArticolo(); + } + if (art.getId_articolo() == 0L && !l_codiceEan.isEmpty()) + art.findByCodiceEanSerie(l_codiceEan, serie); + if (art.getId_articolo() == 0L && !l_articoloCodiceProduttore.isEmpty()) + art.findByCodiceProduttoreMarca(l_articoloCodiceProduttore, marca.getId_marca()); + if (st.countToken() > 7); + if (art.getId_articolo() > 0L) { + System.out.print("*"); + if (!l_linkImmagine.isEmpty()) + if (!art.isImgExist(1)) { + salvaArticolo = true; + l_linkImmagine = l_linkImmagine.replace("http:", "https:"); + art.caricaImmaginaDaRemoto(l_linkImmagine, 1L); + artImgSalvata++; + } + if (l_descrizioneTecnica != null && + art.getDescrizioneCommerciale(l_lang).isEmpty() && !l_descrizioneTecnica.isEmpty()) { + art.setDescTxtLang("descrizioneCommerciale", l_lang, l_descrizioneTecnica); + if (art.getDescrizioneBreve(l_lang).isEmpty()) + art.setDescTxtLang("descrizioneBreve", l_lang, art.getNome()); + salvaArticolo = true; + artDescrizioneAggiunta++; + } + if (salvaArticolo) { + art.setFlgTipoSchedaArticoloWww(3L); + rp = art.save(); + if (!rp.getStatus()) + artNonSalvato++; + } + } else { + artEscluso++; + } + } else { + artEscluso++; + System.out.println("marca scartata: " + l_marcaDesc); + } + } else { + err.append("Pochi campi: " + i + " - " + currentLine); + recordErrati++; + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + sb = new StringBuilder(" Large: Record processati: "); + if (debug) + sb.append("ATTENZIONE!!!! DEBUG ATTIVO. FILE ESPRINET " + serie + " SICURAMENTE NON AGGIORNATO."); + sb.append(i); + sb.append("- art. desc aggiunta: "); + sb.append(artDescrizioneAggiunta); + sb.append("- art. img salvata: "); + sb.append(artImgSalvata); + sb.append("- art. non salvati: "); + sb.append(artNonSalvato); + sb.append("- art. non trovati: "); + sb.append(artEscluso); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" "); + sb.append(err.toString()); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BESTIT ", sb.toString()); + } + if (SOSPENDI_DOPO_N_GG > 0L) + bean.update("UPDATE ARTICOLO SET flgEscludiWebArt=2,flgEscludiWeb=2 WHERE codice LIKE '" + serie + "%' and flgModImportazione = 0 and DATEDIFF(CURDATE(), dataUltimoImport)>=" + SOSPENDI_DOPO_N_GG + ";"); + } + } catch (Exception exception) { + CCImport.this.handleDebug(exception); + exception.printStackTrace(); + System.out.println("ERRORE!!!! IMPORT BESTIT record: " + i + "\n" + currentLine); + StatusMsg.updateMsgByTag(this.apFull, "IMPORT BESTIT ", "ERRORE + " + exception.getMessage() + "
" + currentLine); + } finally { + try { + reader.close(); + } catch (Exception e) { + CCImport.this.handleDebug(e); + } + } + System.out.println(err.toString()); + if (err.length() == 0) { + sb = new StringBuilder("Import IMPORT BESTIT ANAGRAFICA DISPO PREZZO " + serie + " avvenuta correttamente. Record processati: "); + sb.append(i); + sb.append("- art. desc aggiunta: "); + sb.append(artDescrizioneAggiunta); + sb.append("- art. img salvata: "); + sb.append(artImgSalvata); + sb.append("- art. non salvati: "); + sb.append(artNonSalvato); + sb.append("- art. esclusi: "); + sb.append(artEscluso); + sb.append("- art. aggiornati: "); + sb.append(artAggiornati); + sb.append("- record errati: "); + sb.append(recordErrati); + sb.append(" - "); + sb.append(err.toString()); + rp.setStatus(true); + rp.setMsg(sb.toString()); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Import IMPORT BESTIT ANAGRAFICA DISPO PREZZO " + serie + " avvenuta con errori. Articoli processati: " + i + " - " + + err.toString()); + } + return rp; + } + } + + public static boolean isThreadCgrossAttivo() { + return threadImportCGross; + } + + public static boolean isThreadRunnerAttivo() { + return threadImportRunner; + } + + public static boolean isThreadGoogleMerchant() { + return threadGoogleMerchant; + } + + public static boolean isThreadTrovaprezzi() { + return threadTrovaprezzi; + } + + public static boolean isThreadDatamaticAttivo() { + return threadImportDatamatic; + } + + public static boolean isThreadEsprinetAttivo() { + return threadImportEsprinet; + } + + public static boolean isThreadImportBreviAttivo() { + return threadImportBrevi; + } + + public static boolean isThreadFlexitAttivo() { + return threadImportFlexit; + } + + public static boolean isThreadIngramMicroAttivo() { + return threadImportIngramMicro; + } + + public static boolean isThreadLogicomAttivo() { + return threadImportLocicom; + } + + public final ResParm startImportCgross(ApplParmFull apFull, String fileZip, boolean sendEmail) { + boolean test = false; + if (test) { + System.out.println("startImportCgross...testtttttt"); + return sendArticoliCambiatiByEmail(apFull, "test", 1970L); + } + if (!isThreadCgrossAttivo()) { + new ThreadImportComputerGross(apFull, fileZip, sendEmail); + return new ResParm(true, "Thread Import CGROSS avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public final ResParm startImportDatamatic(ApplParmFull apFull, String fileXls, boolean sendEmail) { + if (!isThreadDatamaticAttivo()) { + new ThreadImportDatamatic(apFull, fileXls, sendEmail); + return new ResParm(true, "Thread Import DATAMATIC avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public final ResParm startImportEsprinet(ApplParmFull apFull, String fileXls, boolean sendEmail) { + if (!isThreadEsprinetAttivo()) { + new ThreadImportEsprinet(apFull, fileXls, sendEmail); + return new ResParm(true, "Thread Import ESPRINET avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public final ResParm sendArticoliCambiatiByEmail(ApplParmFull apFull, String msg, long l_id_fornitore) { + ResParm rp = new ResParm(); + String TDAP = ""; + String TDAP_CENTER = ""; + String TDCH = ""; + String fileName = apFull.getParm("DOCBASE").getTesto() + "admin/art/_mailMessage/articoliModificati.html"; + MailMessage mm = new MailMessage(apFull, fileName); + NumberFormat nf = apFull.getNf(); + Articolo articolo = new Articolo(apFull); + ArticoloCR CR = new ArticoloCR(); + StringBuilder sb = new StringBuilder(); + mm.setDate("data", DBAdapter.getToday()); + mm.setString("risultato", msg); + String oggettoMessaggio = "Import automatico "; + if (l_id_fornitore == 0L) { + mm.setString("fornitore", "Non impostato"); + oggettoMessaggio = oggettoMessaggio + " fornitore non impostato"; + } else { + Clifor fornitore = new Clifor(apFull); + fornitore.findByPrimaryKey(l_id_fornitore); + if (fornitore.getId_clifor() == 0L) { + mm.setString("fornitore", "Attenzione! codice fornitore " + l_id_fornitore + " NON TROVATO"); + oggettoMessaggio = oggettoMessaggio + " fornitore " + oggettoMessaggio + " NON TROVATO"; + } else { + mm.setString("fornitore", fornitore.getCognome()); + oggettoMessaggio = oggettoMessaggio + " fornitore " + oggettoMessaggio; + } + } + CR.setFlgModImportazione(2L); + CR.setFlgEscludiWeb(0L); + CR.setId_fornitore(l_id_fornitore); + Vectumerator vec = articolo.findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + sb.append(""); + sb.append(""); + sb.append(row.getCodice()); + sb.append("
"); + sb.append(row.getCodice()); + sb.append(""); + sb.append(""); + sb.append(""); + if (row.getFlgSubito() == 1L) { + sb.append("V"); + } else { + sb.append(" "); + } + sb.append(""); + sb.append(""); + if (row.getFlgEbay() == 1L) { + sb.append("V"); + } else { + sb.append(" "); + } + if (!row.getEbayOfferId().isEmpty()) + sb.append(" - " + row.getEbayOfferId()); + sb.append(""); + sb.append(""); + if (row.getFlgGoogle() == 1L) { + sb.append("V"); + if (!row.getGoogleFeedFileName().isEmpty()) { + sb.append(" "); + sb.append(row.getGoogleFeedFileName()); + } + } else { + sb.append(" "); + } + sb.append(""); + sb.append(""); + sb.append(row.getCodiciAlternativiLink()); + sb.append(" "); + sb.append(row.getCodiceEan()); + sb.append(""); + sb.append(""); + sb.append(row.getMarca().getDescrizione() + " " + row.getMarca().getDescrizione() + " - " + row.getTipo().getDescrizioneCompleta()); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getCostoPrecedente())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getCostoNetto())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getPercRicarico())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getImponibilePrecedenteIva())); + sb.append(""); + if (row.isPrezzoVenditaSalito()) { + sb.append("+"); + } else if (row.isPrezzoVenditaSceso()) { + sb.append("-"); + } else { + sb.append(""); + sb.append("="); + } + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getPrezzoPubblicoIva())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getStreetPriceIva())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getRicaricoEffettivoDaCostoNetto())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getQuantita())); + sb.append(""); + sb.append(""); + sb.append(row.getEscludiWeb()); + sb.append(""); + sb.append(""); + sb.append("\n"); + } + sb.append(""); + mm.setString("listaArticoli", sb.toString()); + CR.setFlgModImportazione(1L); + CR.setFlgEscludiWeb(-1L); + CR.setId_fornitore(l_id_fornitore); + vec = articolo.findByCR(CR, 0, 0); + sb = new StringBuilder(); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + sb.append(""); + sb.append(""); + sb.append(row.getCodice()); + sb.append("
"); + sb.append(row.getCodice()); + sb.append(""); + sb.append(""); + sb.append(""); + if (row.getFlgSubito() == 1L) { + sb.append("V"); + } else { + sb.append(" "); + } + sb.append(""); + sb.append(""); + if (row.getFlgEbay() == 1L) { + sb.append("V"); + } else { + sb.append(" "); + } + if (!row.getEbayOfferId().isEmpty()) + sb.append(" - " + row.getEbayOfferId()); + sb.append(""); + sb.append(""); + if (row.getFlgGoogle() == 1L) { + sb.append("V"); + if (!row.getGoogleFeedFileName().isEmpty()) { + sb.append(" "); + sb.append(row.getGoogleFeedFileName()); + } + } else { + sb.append(" "); + } + sb.append(""); + sb.append(""); + sb.append(row.getCodiciAlternativiLink()); + sb.append(" "); + sb.append(row.getCodiceEan()); + sb.append(""); + sb.append(""); + sb.append(row.getMarca().getDescrizione() + " " + row.getMarca().getDescrizione() + " - " + row.getTipo().getDescrizioneCompleta() + " (" + + row.getNome().substring(0, Math.min(row.getNome().length(), 50)) + ")"); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getCostoPrecedente())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getCostoNetto())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getPercRicarico())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getImponibilePrecedenteIva())); + sb.append(""); + if (row.isPrezzoVenditaSalito()) { + sb.append("+"); + } else if (row.isPrezzoVenditaSceso()) { + sb.append("-"); + } else { + sb.append(""); + sb.append("="); + } + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getPrezzoPubblicoIva())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getStreetPriceIva())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getRicaricoEffettivoDaCostoNetto())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getQuantita())); + sb.append(""); + sb.append(""); + sb.append(row.getEscludiWeb()); + sb.append(""); + sb.append(""); + sb.append("\n"); + } + sb.append(""); + mm.setString("listaArticoliNuovi", sb.toString()); + CR.setFlgModImportazione(0L); + CR.setFlgEscludiWeb(0L); + CR.setId_fornitore(l_id_fornitore); + vec = articolo.findByCR(CR, 0, 0); + sb = new StringBuilder(); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + sb.append(""); + sb.append(""); + sb.append(row.getCodice()); + sb.append("
"); + sb.append(row.getCodice()); + sb.append(""); + sb.append(""); + sb.append(""); + if (row.getFlgSubito() == 1L) { + sb.append("V"); + } else { + sb.append(" "); + } + sb.append(""); + sb.append(""); + if (row.getFlgEbay() == 1L) { + sb.append("V"); + } else { + sb.append(" "); + } + if (!row.getEbayOfferId().isEmpty()) + sb.append(" - " + row.getEbayOfferId()); + sb.append(""); + sb.append(""); + if (row.getFlgGoogle() == 1L) { + sb.append("V"); + if (!row.getGoogleFeedFileName().isEmpty()) { + sb.append(" "); + sb.append(row.getGoogleFeedFileName()); + } + } else { + sb.append(" "); + } + sb.append(""); + sb.append(""); + sb.append(row.getCodiciAlternativiLink()); + sb.append(" "); + sb.append(row.getCodiceEan()); + sb.append(""); + sb.append(""); + sb.append(row.getMarca().getDescrizione() + " " + row.getMarca().getDescrizione() + " - " + row.getTipo().getDescrizioneCompleta()); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getCostoPrecedente())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getCostoNetto())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getPercRicarico())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getImponibilePrecedenteIva())); + sb.append(""); + if (row.isPrezzoVenditaSalito()) { + sb.append("+"); + } else if (row.isPrezzoVenditaSceso()) { + sb.append("-"); + } else { + sb.append(""); + sb.append("="); + } + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getPrezzoPubblicoIva())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getStreetPriceIva())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getRicaricoEffettivoDaCostoNetto())); + sb.append(""); + sb.append(""); + sb.append(nf.format(row.getQuantita())); + sb.append(""); + sb.append(""); + sb.append(row.getEscludiWeb()); + sb.append(" ("); + sb.append(row.getCountImportNonTrovato()); + sb.append(")"); + sb.append(""); + sb.append(""); + sb.append("\n"); + } + sb.append(""); + mm.setString("listaArticoliNonTrovati", sb.toString()); + String from = apFull.getParm("FROM").getTesto(); + MailProperties mp = new MailProperties(); + mp.setProperty("FROM", from); + mp.setProperty("TO", from); + mp.setProperty("SUBJECT", oggettoMessaggio); + System.out.println("sendArticoliCambiatiByEmail: from: " + from + " to " + from + " oggetto: " + oggettoMessaggio); + rp = mm.sendMailMessage(mp, true); + return rp; + } + + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + StringBuffer msg = new StringBuffer("\n################# Inizio crontab Giornaliera CC (" + + DBAdapter.getNow().toString() + ")\n#################"); + long t0 = System.currentTimeMillis(); + rp = startImportCgross(ap, null, true); + msg.append(rp.getMsg()); + msg.append("\n################# Fine crontab Giornaliera CC (" + DBAdapter.getNow().toString() + ")\n#################"); + long tn = System.currentTimeMillis(); + long duration = (tn - t0) / 60000L; + msg.append("Durata aggiornamento: " + duration + " minuti.\n"); + rp.setMsg(msg.toString()); + return rp; + } + + public final ResParm startGoogleFtp(ApplParmFull apFull, ArticoloCR CR) { + if (!isThreadGoogleMerchant()) { + new ThreadGoogleFtp(apFull, CR); + return new ResParm(true, "Thread GOOGLE FTP avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread GOOGLE FTP in esecuzione!!!"); + } + + public final ResParm startTrovaprezziXml(ApplParmFull apFull, ArticoloCR CR) { + if (!isThreadTrovaprezzi()) { + new ThreadTrovaprezziXml(apFull, CR); + return new ResParm(true, "Thread TROVAPREZZI avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread TROVAPREZZI in esecuzione!!!"); + } + + public final ResParm startImportLogicomMail(ApplParmFull apFull, boolean sendEmail) { + if (!isThreadLogicomAttivo()) { + new ThreadCheckMailLogicom(apFull, sendEmail); + return new ResParm(true, "Thread Import LOGICOM MAIL avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public final ResParm startImportIngramMicro(ApplParmFull apFull, long l_tipoImport, boolean sendEmail) { + boolean test = false; + if (test) { + System.out.println("startImportIngramMigro TEST"); + return sendArticoliCambiatiByEmail(apFull, "test", 1995L); + } + if (!isThreadIngramMicroAttivo()) { + new ThreadImportIngramMicro(apFull, l_tipoImport, sendEmail); + return new ResParm(true, "Thread Import INGRAMMICRO+" + l_tipoImport + " avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public final ResParm startImportLogicom(ApplParmFull apFull, String fileXls, boolean sendEmail) { + if (!isThreadLogicomAttivo()) { + new ThreadImportLogicom(apFull, fileXls, sendEmail); + return new ResParm(true, "Thread Import LOGICOM avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public final ResParm startImportDatamaticMail(ApplParmFull apFull, boolean sendEmail) { + if (!isThreadDatamaticAttivo()) { + new ThreadImportDatamatic(apFull, sendEmail); + return new ResParm(true, "Thread Import DATAMATIC MAIL avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public final ResParm startImportFlexit(ApplParmFull apFull, String fileXls, boolean sendEmail) { + if (!isThreadFlexitAttivo()) { + new ThreadImportFlexit(apFull, fileXls, sendEmail); + return new ResParm(true, "Thread Import FLEXIT avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public final ResParm startImportFlexitMail(ApplParmFull apFull, boolean sendEmail) { + if (!isThreadFlexitAttivo()) { + new ThreadCheckMailFlexit(apFull, sendEmail); + return new ResParm(true, "Thread Import FLEXIT MAIL avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public final ResParm startImportBrevi(ApplParmFull apFull, String fileXls, boolean sendEmail) { + if (!isThreadImportBreviAttivo()) { + new ThreadImportBrevi(apFull, fileXls, sendEmail); + return new ResParm(true, "Thread Import BREVI avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread IMPORT BREVI in esecuzione!!!"); + } + + public final ResParm startImportRunner(ApplParmFull apFull, long[] flgTipoImportA, boolean sendEmail) { + if (!isThreadRunnerAttivo()) { + new ThreadImportRunner(apFull, flgTipoImportA, sendEmail); + return new ResParm(true, "Thread Import RUNNER avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread IMPORT RUNNER in esecuzione!!!"); + } + + public Attivita getAttivita(ApplParmFull apFull) { + if (this.attivita == null) + this.attivita = Attivita.getDefaultInstance(apFull); + return this.attivita; + } + + public final ResParm startImportBestit(ApplParmFull apFull, long[] flgTipoImportA, boolean sendEmail) { + if (!isThreadBestitAttivo()) { + new ThreadImportBestIt(apFull, flgTipoImportA, sendEmail); + return new ResParm(true, "Thread Import BESTIT avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread IMPORT BESTIT in esecuzione!!!"); + } + + public static boolean isThreadBestitAttivo() { + return threadImportBestit; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CategoriaIngrammicro.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CategoriaIngrammicro.java new file mode 100644 index 00000000..aef285b0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CategoriaIngrammicro.java @@ -0,0 +1,97 @@ +package it.acxent.cc; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class CategoriaIngrammicro extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1635180606311L; + + private long id_categoriaIngrammiro; + + private String descrizione; + + private String codice; + + public CategoriaIngrammicro(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CategoriaIngrammicro() {} + + public void setId_categoriaIngrammiro(long newId_categoriaIngrammiro) { + this.id_categoriaIngrammiro = newId_categoriaIngrammiro; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setCodice(String newCodice) { + this.codice = newCodice; + } + + public long getId_categoriaIngrammiro() { + return this.id_categoriaIngrammiro; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getCodice() { + return (this.codice == null) ? "" : this.codice.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(CategoriaIngrammicroCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CATEGORIA_INGRAMMICRO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByCodice(String l_codice) { + String s_Sql_Find = "select A.* from CATEGORIA_INGRAMMICRO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice='" + l_codice + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CategoriaIngrammicroCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CategoriaIngrammicroCR.java new file mode 100644 index 00000000..36472024 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/CategoriaIngrammicroCR.java @@ -0,0 +1,42 @@ +package it.acxent.cc; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class CategoriaIngrammicroCR extends CRAdapter { + private long id_categoriaIngrammiro; + + private String descrizione; + + private String codice; + + public CategoriaIngrammicroCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CategoriaIngrammicroCR() {} + + public void setId_categoriaIngrammiro(long newId_categoriaIngrammiro) { + this.id_categoriaIngrammiro = newId_categoriaIngrammiro; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setCodice(String newCodice) { + this.codice = newCodice; + } + + public long getId_categoriaIngrammiro() { + return this.id_categoriaIngrammiro; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getCodice() { + return (this.codice == null) ? "" : this.codice.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/GoogleReview.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/GoogleReview.java new file mode 100644 index 00000000..ac7e5784 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/GoogleReview.java @@ -0,0 +1,82 @@ +package it.acxent.cc; + +import org.json.JSONObject; + +public class GoogleReview { + public static String P_GOOGLE_REVIEW_DATE = "GOOGLE_REVIEW_DATE"; + + public static String P_GOOGLE_REVIEW_RATING = "GOOGLE_REVIEW_RATING"; + + public static String P_GOOGLE_REVIEW_USER_RATING_TOTALS = "GOOGLE_REVIEW_USER_RATING_TOTALS"; + + private String author_name; + + private String author_url; + + private String profile_photo_url; + + private String relative_time_description; + + private String text; + + private long rating; + + public GoogleReview(JSONObject jo) { + setAuthor_name(jo.getString("author_name")); + setAuthor_url(jo.getString("author_url")); + setProfile_photo_url(jo.getString("profile_photo_url")); + setRelative_time_description(jo.getString("relative_time_description")); + setRating(jo.getLong("rating")); + setText(jo.getString("text")); + } + + public GoogleReview() {} + + public String getAuthor_name() { + return (this.author_name == null) ? "" : this.author_name.trim(); + } + + public void setAuthor_name(String author_name) { + this.author_name = author_name; + } + + public String getAuthor_url() { + return (this.author_url == null) ? "" : this.author_url.trim(); + } + + public void setAuthor_url(String author_url) { + this.author_url = author_url; + } + + public String getProfile_photo_url() { + return (this.profile_photo_url == null) ? "" : this.profile_photo_url.trim(); + } + + public void setProfile_photo_url(String profile_photo_url) { + this.profile_photo_url = profile_photo_url; + } + + public String getRelative_time_description() { + return (this.relative_time_description == null) ? "" : this.relative_time_description.trim(); + } + + public void setRelative_time_description(String relative_time_description) { + this.relative_time_description = relative_time_description; + } + + public String getText() { + return (this.text == null) ? "" : this.text.trim(); + } + + public void setText(String text) { + this.text = text; + } + + public long getRating() { + return this.rating; + } + + public void setRating(long rating) { + this.rating = rating; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/GoogleReviews.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/GoogleReviews.java new file mode 100644 index 00000000..162c3e92 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/GoogleReviews.java @@ -0,0 +1,75 @@ +package it.acxent.cc; + +import it.acxent.util.Vectumerator; + +public class GoogleReviews { + private Vectumerator reviews; + + private long userRatingsTotal; + + private double rating; + + private String msg; + + private boolean status; + + public Vectumerator getReviews() { + if (this.reviews == null) + this.reviews = new Vectumerator(); + return this.reviews; + } + + public void setReviews(Vectumerator reviews) { + this.reviews = reviews; + } + + public long getUserRatingsTotal() { + return this.userRatingsTotal; + } + + public String getFontAwesomeSvgRatingStars() { + String STAR_PIENA = ""; + String STAR_VUOTA = ""; + String STAR_META = ""; + StringBuilder sb = new StringBuilder(); + double l_rating = getRating(); + for (int i = 0; i <= 4; i++) { + if (l_rating <= (double)i + 0.25D) { + sb.append(""); + } else if (l_rating <= (double)i + 0.75D) { + sb.append(""); + } else { + sb.append(""); + } + } + return sb.toString(); + } + + public void setUserRatingsTotal(long userRatingsTotal) { + this.userRatingsTotal = userRatingsTotal; + } + + public double getRating() { + return this.rating; + } + + public void setRating(double rating) { + this.rating = rating; + } + + public String getMsg() { + return (this.msg == null) ? "" : this.msg.trim(); + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public boolean isStatus() { + return this.status; + } + + public void setStatus(boolean status) { + this.status = status; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/TipoAttivita.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/TipoAttivita.java new file mode 100644 index 00000000..94f2fa95 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/TipoAttivita.java @@ -0,0 +1,73 @@ +package it.acxent.cc; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoAttivita extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1586902588918L; + + private long id_tipoAttivita; + + private String descrizione; + + public TipoAttivita(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoAttivita() {} + + public void setId_tipoAttivita(long newId_tipoAttivita) { + this.id_tipoAttivita = newId_tipoAttivita; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoAttivita() { + return this.id_tipoAttivita; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoAttivitaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_ATTIVITA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/TipoAttivitaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/TipoAttivitaCR.java new file mode 100644 index 00000000..0c1714fb --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/TipoAttivitaCR.java @@ -0,0 +1,32 @@ +package it.acxent.cc; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoAttivitaCR extends CRAdapter { + private long id_tipoAttivita; + + private String descrizione; + + public TipoAttivitaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoAttivitaCR() {} + + public void setId_tipoAttivita(long newId_tipoAttivita) { + this.id_tipoAttivita = newId_tipoAttivita; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoAttivita() { + return this.id_tipoAttivita; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/UpdateArticoli.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/UpdateArticoli.java new file mode 100644 index 00000000..07564d28 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/UpdateArticoli.java @@ -0,0 +1,162 @@ +package it.acxent.cc; + +import it.acxent.anag.Listino; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.art.Marca; +import it.acxent.art.Tipo; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.util.DbConsole; +import it.acxent.util.Vectumerator; +import java.sql.Time; +import java.util.StringTokenizer; + +public class UpdateArticoli extends DbConsole { + public static void main(String[] args) { + UpdateArticoli bean = new UpdateArticoli(); + bean.doImport(); + System.exit(0); + } + + public void doImport() { + String db = "cc"; + int i = 0; + int se1 = 10; + int se2 = 100; + String hostname = "10.0.0.5"; + String temp = getCi().readLine("Hostname (" + hostname + "):"); + if (!temp.isEmpty()) + hostname = temp; + temp = getCi().readLine("Database name (" + db + "):"); + if (!temp.isEmpty()) + db = temp; + System.out.println("Db: " + db); + ApplParmFull apTarget = new ApplParmFull(new ApplParm(3, "//" + hostname + "/" + db, "root", "root", 1, 10, 300)); + apTarget.setDebug(false); + StringBuffer msg = new StringBuffer(); + try { + Articolo bean = new Articolo(apTarget); + long l_id_tipoEffettivo = 80L; + double ricarico = 13.0D; + long l_id_listinoEbay = 5L; + long l_qtaMax = 20L; + long l_qtaEbay = 15L; + String searchTxt = "ink"; + long qtaMinRicerca = 5L; + long l_id_marcaRicerca = 2L; + long l_id_tipoRIcerca = 1L; + boolean caricaEbay = false; + long l_flgEbayPubblicato = -1L; + System.out.println("---------------- DATI DA INSERIRE ----------------"); + temp = getCi().readLine("l_id_tipoEffettivo (" + l_id_tipoEffettivo + "):"); + if (!temp.isEmpty()) + l_id_tipoEffettivo = Long.parseLong(temp); + Tipo tipo = new Tipo(apTarget); + tipo.findByPrimaryKey(l_id_tipoEffettivo); + System.out.println("Tipo effettivo scelto: " + tipo.getDescrizioneCompleta()); + temp = getCi().readLine("ricarico (" + ricarico + "):"); + if (!temp.isEmpty()) + ricarico = Double.parseDouble(temp); + temp = getCi().readLine("l_id_listinoEbay (" + l_id_listinoEbay + "):"); + if (!temp.isEmpty()) + l_id_listinoEbay = Long.parseLong(temp); + Listino listino = new Listino(apTarget); + listino.findByPrimaryKey(l_id_listinoEbay); + System.out.println("Listino ebay scelto: " + listino.getDescrizioneCompleta()); + temp = getCi().readLine("l_qtaMax (" + l_qtaMax + "):"); + if (!temp.isEmpty()) + l_qtaMax = Long.parseLong(temp); + temp = getCi().readLine("l_qtaEbay (" + l_qtaEbay + "):"); + if (!temp.isEmpty()) + l_qtaEbay = Long.parseLong(temp); + temp = getCi().readLine("caricaebay (" + (caricaEbay ? "y" : "n") + " y/n):"); + if (!temp.isEmpty()) + caricaEbay = temp.toLowerCase().equals("y"); + System.out.println("---------------- CRITERI DI RICERCA ----------------"); + temp = getCi().readLine("l_id_tipoRIcerca (" + l_id_tipoRIcerca + "):"); + if (!temp.isEmpty()) + l_id_tipoRIcerca = Long.parseLong(temp); + tipo.findByPrimaryKey(l_id_tipoRIcerca); + System.out.println("Tipo ricerca scelto: " + tipo.getDescrizioneCompleta()); + temp = getCi().readLine("searchTxt (" + searchTxt + "):"); + if (!temp.isEmpty()) + searchTxt = temp; + temp = getCi().readLine("qtaMinRicerca (" + qtaMinRicerca + "):"); + if (!temp.isEmpty()) + qtaMinRicerca = Long.parseLong(temp); + temp = getCi().readLine("l_id_marcaRicerca (" + l_id_marcaRicerca + "):"); + if (!temp.isEmpty()) + l_id_marcaRicerca = Long.parseLong(temp); + Marca marca = new Marca(apTarget); + marca.findByPrimaryKey(l_id_marcaRicerca); + System.out.println("Marca ricerca scelta: " + marca.getDescrizione()); + temp = getCi().readLine("l_flgEbayPubblicato (" + l_flgEbayPubblicato + "):"); + if (!temp.isEmpty()) + l_flgEbayPubblicato = Long.parseLong(temp); + System.out.println("ciclo articoli"); + ArticoloCR CR = new ArticoloCR(); + CR.setSearchTxt(searchTxt); + CR.setFlgEscludiWeb(0L); + CR.setFlgQta(1L); + CR.setQtaDa(qtaMinRicerca); + CR.setId_marca(l_id_marcaRicerca); + CR.setId_tipo(l_id_tipoRIcerca); + CR.setFlgEbayPubblicato(l_flgEbayPubblicato); + Vectumerator vec = bean.findByCR(CR, 0, 0); + System.out.println("Tot Record: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + Articolo row = (Articolo)vec.nextElement(); + System.out.println(row.getCodice() + " " + row.getCodice()); + row.setId_tipo(l_id_tipoEffettivo); + row.superSave(); + row.caricaIcecat(); + row.setPercRicarico(ricarico); + row.setCostoNuovo(row.getCostoNetto()); + row.setPrezzoIvatoBarrato(row.getStreetPriceIva()); + row.setFlgEbay(1L); + row.setId_listinoEbay(l_id_listinoEbay); + row.setQtaMaxAcquistoWww(l_qtaMax); + row.setQtaEbay(l_qtaEbay); + row.setFlgGoogle(1L); + row.setFlgEscludiWebArt(0L); + row.save(); + row.aggiornaPrezzoNettoConCostoNuovo(); + if (caricaEbay && !row.isEbayPubblicato()) + row.ebayPublishFull(); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " / " + i); + } + System.out.println("fine ciclo \n" + msg.toString()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9][0-9][0-9]")) + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + StringTokenizer st = new StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + return null; + } catch (Exception e) { + return null; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/WwwAutomator.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/WwwAutomator.java new file mode 100644 index 00000000..d9d56b79 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/WwwAutomator.java @@ -0,0 +1,449 @@ +package it.acxent.cc; + +import it.acxent.art.ArticoloCR; +import it.acxent.art.Tipo; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.mail.MailProperties; +import it.acxent.util.Timer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class WwwAutomator extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1667311885432L; + + private long id_wwwAutomator; + + private long id_tipo; + + private String categoriaImport; + + private String searchTxt; + + private String ultimaEsecuzione; + + class ThreadAutomator extends Thread { + private String TAG_THREAD_MSG = "AUTOMATOR "; + + private ApplParmFull apFull; + + private boolean sendEmail; + + private WwwAutomatorCR CR; + + public ThreadAutomator(ApplParmFull apFull, WwwAutomatorCR CR, boolean sendEmail) { + this.apFull = apFull; + this.sendEmail = sendEmail; + this.CR = CR; + if (!WwwAutomator.isThreadAttivo()) { + WwwAutomator.threadAutomator = true; + start(); + } + } + + public void run() { + boolean debug = false; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(WwwAutomator.this.getApFull(), this.TAG_THREAD_MSG, "...inizio ..."); + ResParm rp = new ResParm(true); + StringBuilder sb = new StringBuilder(); + int i = 1; + int se1 = 10; + int se2 = 100; + WwwAutomator bean = new WwwAutomator(this.apFull); + Vectumerator vec = bean.findByCR(this.CR, 0, 0); + while (vec.hasMoreElements()) { + WwwAutomator row = (WwwAutomator)vec.nextElement(); + String temp = "Aggiornamento " + i + " su " + vec.getTotNumberOfRecords() + " - " + row.getDescrizione(); + StatusMsg.updateMsgByTag(WwwAutomator.this.getApFull(), this.TAG_THREAD_MSG, temp); + DBAdapter.printDebug(debug, this.TAG_THREAD_MSG + this.TAG_THREAD_MSG); + ArticoloBulkUpdate abu = new ArticoloBulkUpdate(this.apFull); + ArticoloCR CR = new ArticoloCR(this.apFull); + CR.setSearchTxt(row.getSearchTxt()); + CR.setCategoriaImport(row.getCategoriaImport()); + CR.setId_tipo(1L); + abu.setFlgGoogleBA(row.getFlgGoogle()); + abu.setRicaricoBA(row.getRicarico()); + abu.setPrezzoPubblicoDaBA(row.getPrezzoPubblicoDa()); + abu.setRicaricoOltreBA(row.getRicaricoOltre()); + abu.setQtaMaxAcquistoWwwBA(row.getQtaMaxAcquistoWww()); + abu.setId_tipoBA(row.getId_tipo()); + abu.setPreviewSizes(""); + abu.setPreviewSizes1(""); + abu.setFlgEscludiWebArtBA(0L); + rp = abu.starBulkUpdate(this.apFull, CR, row); + StatusMsg.updateMsgByTag(WwwAutomator.this.getApFull(), this.TAG_THREAD_MSG, " in attesa di bulk update ..." + temp); + while (true) { + if (ArticoloBulkUpdate.isThreadAttivo()) { + try { + sleep(3000L); + } catch (Exception e) {} + continue; + } + break; + } + if (row.getUltimaEsecuzione().indexOf("record processati: 0") < 0) { + sb.append("-------------------------------------------"); + sb.append("
"); + sb.append(row.getDescrizione()); + sb.append(" "); + sb.append(row.getUltimaEsecuzione()); + sb.append("
"); + } + DBAdapter.printDebug(debug, this.TAG_THREAD_MSG + " FINE CICLO.... RIPARTO... " + this.TAG_THREAD_MSG + "\n"); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " / " + i); + } + timer.stop(); + rp.setMsg(this.TAG_THREAD_MSG + " concluso. DURATA: " + this.TAG_THREAD_MSG); + if (this.sendEmail) { + MailProperties mp = new MailProperties(); + String eMail = WwwAutomator.this.getApFull().getParm("TO").getTesto(); + mp.put("TO", eMail); + mp.setProperty("FROM", WwwAutomator.this.getApFull().getParm("FROM").getTesto()); + mp.put("SUBJECT", this.TAG_THREAD_MSG); + mp.put("ISHTML", "true"); + mp.setProperty("BCC", ""); + mp.setProperty("CC", ""); + mp.put("MSG", this.TAG_THREAD_MSG + " concluso. DURATA: " + this.TAG_THREAD_MSG + "
" + + timer.getDurataHourMin()); + try { + WwwAutomator.this.sendMailMessage(mp); + } catch (Exception e) { + e.printStackTrace(); + } + } + StatusMsg.updateMsgByTag(WwwAutomator.this.getApFull(), this.TAG_THREAD_MSG, rp.getMsg()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(WwwAutomator.this.getApFull(), this.TAG_THREAD_MSG); + WwwAutomator.threadAutomator = false; + System.out.println(rp.getMsg()); + } + } + + private long qtaMaxAcquistoWww = 5L; + + private double ricarico = 7.0D; + + private long flgGoogle = 1L; + + private long flgAbilita = 1L; + + private long ordine; + + private Tipo tipo; + + private double prezzoPubblicoDa; + + private double ricaricoOltre; + + private static boolean threadAutomator = false; + + public WwwAutomator(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public void setId_wwwAutomator(long newId_wwwAutomator) { + this.id_wwwAutomator = newId_wwwAutomator; + } + + public void setId_tipo(long newId_tipo) { + this.id_tipo = newId_tipo; + setTipo(null); + } + + public void setCategoriaImport(String newCategoriaImport) { + this.categoriaImport = newCategoriaImport; + } + + public void setSearchTxt(String newSearchTxt) { + this.searchTxt = newSearchTxt; + } + + public void setQtaMaxAcquistoWww(long newQtaMaxAcquistoWww) { + this.qtaMaxAcquistoWww = newQtaMaxAcquistoWww; + } + + public void setRicarico(double newRicaricoBA) { + this.ricarico = newRicaricoBA; + } + + public void setFlgGoogle(long newFlgGoogle) { + this.flgGoogle = newFlgGoogle; + } + + public long getId_wwwAutomator() { + return this.id_wwwAutomator; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public String getCategoriaImport() { + return (this.categoriaImport == null) ? "" : this.categoriaImport.trim(); + } + + public String getSearchTxt() { + return (this.searchTxt == null) ? "" : this.searchTxt.trim(); + } + + public long getQtaMaxAcquistoWww() { + return this.qtaMaxAcquistoWww; + } + + public double getRicarico() { + return this.ricarico; + } + + public long getFlgGoogle() { + return this.flgGoogle; + } + + public void setTipo(Tipo newTipo) { + this.tipo = newTipo; + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo()); + return this.tipo; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(WwwAutomatorCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from WWW_AUTOMATOR AS A left join TIPO as B on A.id_tipo=B.id_tipo"; + String s_Sql_Order = " ORDER BY A.ORDINE, B.descrizione, A.searchTxt, A.categoriaImport"; + if (CR.getFlgOrderBy() == 99L) + s_Sql_Order = " ORDER BY B.descrizioneR,A.ORDINE, A.searchTxt, A.categoriaImport"; + WcString wc = new WcString(); + if (CR.getId_wwwAutomator() > 0L) + wc.addWc("A.id_wwwAutomator=" + CR.getId_wwwAutomator()); + if (CR.getId_tipo() > 0L) + if (CR.getTipo().isFoglia()) { + wc.addWc("A.id_tipo=" + CR.getId_tipo()); + } else { + Vectumerator vecTipo = CR.getTipo().findFigliAll(CR.getId_tipo(), true); + if (vecTipo.hasMoreElements()) { + StringBuilder sb = new StringBuilder("("); + while (vecTipo.hasMoreElements()) { + Tipo row = (Tipo)vecTipo.nextElement(); + sb.append("A.id_tipo=" + row.getId_tipo()); + if (vecTipo.hasMoreElements()) + sb.append(" or "); + } + sb.append(")"); + wc.addWc(sb.toString()); + } + } + if (CR.getFlgAbilita() == 0L) { + wc.addWc("(A.flgAbilita = o or A.flgAbilita is null)"); + } else if (CR.getFlgAbilita() > 0L) { + wc.addWc("A.flgAbilita=" + CR.getFlgAbilita()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getUltimaEsecuzione() { + return (this.ultimaEsecuzione == null) ? "" : this.ultimaEsecuzione.trim(); + } + + public void setUltimaEsecuzione(String ultimaEsecuzione) { + this.ultimaEsecuzione = ultimaEsecuzione; + } + + public long getFlgAbilita() { + return this.flgAbilita; + } + + public void setFlgAbilita(long flgAbilita) { + this.flgAbilita = flgAbilita; + } + + public ResParm eseguiAutomator() { + ResParm rp = new ResParm(); + if (getId_wwwAutomator() > 0L && getFlgAbilita() == 1L) { + WwwAutomatorCR CR = new WwwAutomatorCR(); + CR.setId_wwwAutomator(getId_wwwAutomator()); + startAutomator(getApFull(), CR, false); + } + return rp; + } + + public final ResParm startAutomator(ApplParmFull apFull, WwwAutomatorCR CR, boolean sendEmail) { + boolean test = false; + if (!isThreadAttivo()) { + new ThreadAutomator(apFull, CR, sendEmail); + return new ResParm(true, "Thread AUTOMATOR avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public static boolean isThreadAttivo() { + return threadAutomator; + } + + public String getDescrizione() { + return "" + getOrdine() + " " + getOrdine() + " " + getId_wwwAutomator() + " cat: " + getTipo().getDescrizioneCompleta() + " search: " + getCategoriaImport(); + } + + protected void initFields() { + super.initFields(); + setFlgGoogle(1L); + setFlgAbilita(1L); + setQtaMaxAcquistoWww(5L); + setRicarico(7.0D); + } + + private long calcolaOrdine() { + try { + String s_sqlFind = "select max(ordine) as _max from WWW_AUTOMATOR WHERE id_wwwAutomator!=" + getId_wwwAutomator(); + PreparedStatement ps = getConn().prepareStatement(s_sqlFind); + long res = (long)getMax(ps, true) + 1L; + long decine = res / 10L; + return (decine + 1L) * 10L; + } catch (Exception e) { + handleDebug(e); + return 0L; + } + } + + public ResParm save() { + if (getOrdine() == 0L) + setOrdine(calcolaOrdine()); + ResParm rp = super.save(); + return rp; + } + + public long getOrdine() { + return this.ordine; + } + + public void setOrdine(long ordine) { + this.ordine = ordine; + } + + public ResParm spostaGiu() { + ResParm rp = new ResParm(); + if (getDBState() == 1) { + try { + long ordineBean = getOrdine(); + String s_sqlFind = "select A.* from WWW_AUTOMATOR as A WHERE A.ordine>" + ordineBean + " order by A.ordine asc"; + PreparedStatement ps = getConn().prepareStatement(s_sqlFind); + Vectumerator vec = findRows(ps); + if (vec.hasMoreElements()) { + WwwAutomator tg = (WwwAutomator)vec.nextElement(); + long ordineTG = tg.getOrdine(); + tg.setOrdine(-ordineBean); + rp = tg.save(); + if (rp.getStatus()) { + setOrdine(ordineTG); + rp = save(); + if (rp.getStatus()) { + tg.setOrdine(ordineBean); + rp = tg.save(); + } + } + } else { + rp.setStatus(true); + rp.setMsg("Raggiunto valore massimo!"); + } + } catch (Exception e) { + handleDebug(e); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore!. Record non salvato"); + } + return rp; + } + + public ResParm spostaSu() { + ResParm rp = new ResParm(); + if (getDBState() == 1) { + try { + long ordineBean = getOrdine(); + String s_sqlFind = "select A.* from WWW_AUTOMATOR as A WHERE A.ordine< " + ordineBean + " order by A.ordine desc"; + PreparedStatement ps = getConn().prepareStatement(s_sqlFind); + Vectumerator vec = findRows(ps); + if (vec.hasMoreElements()) { + WwwAutomator tg = (WwwAutomator)vec.nextElement(); + long ordineTG = tg.getOrdine(); + tg.setOrdine(-ordineBean); + rp = tg.save(); + if (rp.getStatus()) { + setOrdine(ordineTG); + rp = save(); + if (rp.getStatus()) { + tg.setOrdine(ordineBean); + rp = tg.save(); + } + } + } else { + rp.setStatus(true); + rp.setMsg("Raggiunto valore minimo!"); + } + } catch (Exception e) { + handleDebug(e); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore!. Record non salvato"); + } + return rp; + } + + public ResParm ripristinoOrdine() { + WwwAutomatorCR CR = new WwwAutomatorCR(); + CR.setFlgOrderBy(99L); + long currentOrdine = 10L; + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + WwwAutomator row = (WwwAutomator)vec.nextElement(); + row.setOrdine(currentOrdine); + row.save(); + currentOrdine += 10L; + } + return new ResParm(true); + } + + public double getPrezzoPubblicoDa() { + return this.prezzoPubblicoDa; + } + + public void setPrezzoPubblicoDa(double prezzoPubblicoA) { + this.prezzoPubblicoDa = prezzoPubblicoA; + } + + public double getRicaricoOltre() { + return this.ricaricoOltre; + } + + public void setRicaricoOltre(double ricaricoOltre) { + this.ricaricoOltre = ricaricoOltre; + } + + public WwwAutomator() {} +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/WwwAutomatorCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/WwwAutomatorCR.java new file mode 100644 index 00000000..477ec357 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/WwwAutomatorCR.java @@ -0,0 +1,107 @@ +package it.acxent.cc; + +import it.acxent.art.Tipo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class WwwAutomatorCR extends CRAdapter { + private long id_wwwAutomator; + + private long id_tipo; + + private String categoriaImport; + + private String searchTxt; + + private long qtaMaxAcquistoWww; + + private double ricarico; + + private long flgGoogle; + + private Tipo tipo; + + private long flgAbilita = -1L; + + public WwwAutomatorCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public WwwAutomatorCR() {} + + public void setId_wwwAutomator(long newId_wwwAutomator) { + this.id_wwwAutomator = newId_wwwAutomator; + } + + public void setId_tipo(long newId_tipo) { + this.id_tipo = newId_tipo; + setTipo(null); + } + + public void setCategoriaImport(String newCategoriaImport) { + this.categoriaImport = newCategoriaImport; + } + + public void setSearchTxt(String newSearchTxt) { + this.searchTxt = newSearchTxt; + } + + public void setQtaMaxAcquistoWww(long newQtaMaxAcquistoWww) { + this.qtaMaxAcquistoWww = newQtaMaxAcquistoWww; + } + + public void setRicarico(double newRicaricoBA) { + this.ricarico = newRicaricoBA; + } + + public void setFlgGoogle(long newFlgGoogle) { + this.flgGoogle = newFlgGoogle; + } + + public long getId_wwwAutomator() { + return this.id_wwwAutomator; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public String getCategoriaImport() { + return (this.categoriaImport == null) ? "" : this.categoriaImport.trim(); + } + + public String getSearchTxt() { + return (this.searchTxt == null) ? "" : this.searchTxt.trim(); + } + + public long getQtaMaxAcquistoWww() { + return this.qtaMaxAcquistoWww; + } + + public double getRicarico() { + return this.ricarico; + } + + public long getFlgGoogle() { + return this.flgGoogle; + } + + public void setTipo(Tipo newTipo) { + this.tipo = newTipo; + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, + + getId_tipo()); + return this.tipo; + } + + public long getFlgAbilita() { + return this.flgAbilita; + } + + public void setFlgAbilita(long flgAbilita) { + this.flgAbilita = flgAbilita; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/api/CcApi.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/api/CcApi.java new file mode 100644 index 00000000..5e880a0c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/api/CcApi.java @@ -0,0 +1,108 @@ +package it.acxent.cc.api; + +import it.acxent.api.ApiClientResult; +import it.acxent.api._AblApiClient; +import it.acxent.cc.Attivita; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.util.EntityUtils; +import org.json.JSONObject; + +public class CcApi extends _AblApiClient { + public static final String API_PRODUCTION = "https://api.cupsolidale.it/api/v1/"; + + public static final String API_SANDBOX = "https://sandboxapi.cupsolidale.it/api/v1/"; + + private Attivita attivita; + + private boolean debug = false; + + private static final String URI_POST_IMPORT_CC = "/importcc/{id_documento}"; + + public CcApi(ApplParmFull apFull) { + super(apFull); + setUsername("acx-test"); + setPassword("1qaz2wsx"); + setUseSandbox(false); + } + + public CcApi() {} + + public static void main(String[] args) { + String hostname = "localhost"; + String db = "misericordia"; + ApplParmFull ap = new ApplParmFull(new ApplParm(17, "//" + hostname + ":3308/" + db, db, "root", "root", 1, 10, 300)); + CcApi api = new CcApi(ap); + ApiClientResult res = api._postImportcc(1234L); + System.out.println(res.getMsg()); + } + + public Attivita getAttivita() { + if (this.attivita == null) + this.attivita = Attivita.getDefaultInstance(getApFull()); + return this.attivita; + } + + public String getEndpointProduction() { + return "https://atr.f3.com/api/"; + } + + public String getEndpointSandbox() { + return "http://localhost/atr4/api/"; + } + + public ApiClientResult _postImportcc(long l_id_documento) { + ApiClientResult resER = new ApiClientResult(); + try { + if (this.debug) + System.out.println("CCApi --> _postImportcc"); + CloseableHttpClient client = HttpClients.createDefault(); + HttpPost request = new HttpPost(getEndpoint() + getEndpoint()); + request.setHeader("Authorization", getBase64BasicCredential()); + request.setHeader("Accept", "application/json"); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Content-Language", "it-IT"); + CloseableHttpResponse closeableHttpResponse = client.execute((HttpUriRequest)request); + String content = EntityUtils.toString(closeableHttpResponse.getEntity()); + int statusCode = closeableHttpResponse.getStatusLine().getStatusCode(); + if (this.debug) { + System.out.println("Status Code: " + statusCode); + System.out.println("\ncontent = " + content); + } + if (statusCode >= 400) { + resER.setOk(false); + JSONObject jo = new JSONObject(content); + resER.setMsg(jo.toString(2)); + resER.setResult(jo); + } else { + JSONObject jo = new JSONObject(content); + if (this.debug) + System.out.println(jo.toString(4)); + if (jo.has("success")) { + if (jo.getBoolean("success") == true) { + resER.setMsg(jo.getString("msg")); + resER.setOk(true); + resER.setResult(Long.valueOf(jo.getLong("id_rigaBolla"))); + } else { + resER.setMsg(jo.getString("msg")); + resER.setOk(false); + } + } else { + resER.setMsg("Errore! Risposta non corretta!"); + resER.setOk(false); + } + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + resER.setOk(false); + resER.setMsg(e.getMessage()); + } + return resER; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/api/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/api/package-info.java new file mode 100644 index 00000000..f4296b9f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/api/package-info.java @@ -0,0 +1 @@ +package it.acxent.cc.api; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/package-info.java new file mode 100644 index 00000000..d36ce284 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/package-info.java @@ -0,0 +1 @@ +package it.acxent.cc; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/ArticoloSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/ArticoloSvlt.java new file mode 100644 index 00000000..ca32c163 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/ArticoloSvlt.java @@ -0,0 +1,46 @@ +package it.acxent.cc.servlet; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.common.Access; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ArticoloSvlt extends AblServletSvlt { + private static final long serialVersionUID = 8449640401787842418L; + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ArticoloCR(getApFull(req)); + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + super.search(req, res); + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Articolo(getApFull(req)); + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected String getBeanPageName(HttpServletRequest req) { + String temp = getBeanName(req); + Access access = new Access(getApFull(req)); + access.findByPrimaryKey(Access.convertFieldToTableName(temp)); + if (getRequestParameter(req, "sw").equals("1")) { + if (!access.getSuffissoE().isEmpty()) + return temp + temp + "E"; + return temp + "E"; + } + return temp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/CCMailer.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/CCMailer.java new file mode 100644 index 00000000..4e368e0d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/CCMailer.java @@ -0,0 +1,149 @@ +package it.acxent.cc.servlet; + +import it.acxent.cc.Attivita; +import it.acxent.common.Blacklist; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.mail.MailMessage; +import it.acxent.mail.MailProperties; +import it.acxent.servlet.AcMailer; +import java.sql.Timestamp; +import java.util.Date; +import java.util.Enumeration; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class CCMailer extends AcMailer { + private static final long serialVersionUID = 4639118494615519041L; + + protected ResParm checkBlacklist(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(true); + if (apFull.getParm("MAIL_BLACKLIST_AUTO_FILL").isTrue()) { + System.out.println(getClass().getName()); + Blacklist bl = new Blacklist(apFull); + bl.findByIp(apFull.getReqIpAddress(), false); + bl.setIpAddress(apFull.getReqIpAddress()); + bl.setFatalCount(bl.getFatalCount() + 1L); + if (apFull.getParm("MAIL_BLACKLIST_AUTO_ENABLE").isTrue()) { + Timestamp tmstStartCount = bl.getTmstStartCount(); + double secondiTraFatal = (double)((DBAdapter.getTimestamp().getTime() - tmstStartCount.getTime()) / 1000L); + if (secondiTraFatal < 60.0D) { + double l_fatalCountMax = apFull.getParm("MAIL_BLACKLIST_MAX_COUNT").getNumeroDouble() * secondiTraFatal / 60.0D; + System.out.println("#####\nsecondiFraInviiMailer: " + l_fatalCountMax + " current send mail count for " + + bl.getIpAddress() + ": " + bl.getFatalCount() + "\n#####"); + if (l_fatalCountMax > 0.0D && (double)bl.getFatalCount() > l_fatalCountMax) { + bl.setTmstStartBlacklist(DBAdapter.getTimestamp()); + bl.setDescrizione("Too many mailer send. Probably a sql injection attack!!!"); + bl.setNotaBlacklist(apFull.getReqUrl()); + bl.setFlgAttivo(1L); + sendDebugMailMessage(req, "ACXENT MAILER AUTO BLACKLIST :" + bl.getIpAddress(), + String.valueOf(bl.getTmstStartBlacklist()) + "\n\n" + String.valueOf(bl.getTmstStartBlacklist())); + rp.setStatus(false); + rp.setMsg(apFull.translate("Attenzione! Sono stati rilevati troppi invii da questo ip. Il tuo indirizzo ip è stato messo in blacklist:", + + getLang(req)) + " " + apFull.translate("Attenzione! Sono stati rilevati troppi invii da questo ip. Il tuo indirizzo ip è stato messo in blacklist:", getLang(req))); + } + } else { + bl.setTmstStartCount(DBAdapter.getTimestamp()); + bl.setFatalCount(1L); + } + } + bl.save(); + } + return rp; + } + + protected void sendMail(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + try { + ResParm rp = checkBlacklist(req, res); + if (rp.getStatus()) { + MailMessage mf = null; + String mailMessageFile = getMailMessageFile(req); + String lang = getLang(req); + String ipAddress = req.getRemoteHost() + " " + req.getRemoteHost(); + Date d = new Date(System.currentTimeMillis()); + if (!mailMessageFile.isEmpty()) { + mf = new MailMessage(apFull, mailMessageFile); + Attivita.sendMailStandardData(mf, lang, Attivita.getDefaultInstance(apFull), req); + } + Enumeration enu = req.getParameterNames(); + StringBuffer theMsg = new StringBuffer(""); + String attName = ""; + String attValue = ""; + while (enu.hasMoreElements()) { + attName = enu.nextElement(); + attValue = getRequestParameter(req, attName); + if (!attName.equals("cmd") && !attName.equals("act") && !attName.equals("mailFrom") && + + !attName.equals("MAIL_FROM_MAILER") && !attName.equals("MAIL_TO_MAILER") && !attName.equals("mailSubject") && + !attName.equals("mailOkMsg") && !attName.equals("mailKoMsg") && + !attName.equals("mailResponsePage") && !attName.equals("mailFile")) { + if (mf != null) { + mf.setString(attName, attValue); + continue; + } + theMsg.append(attName); + theMsg.append(": "); + theMsg.append(attValue); + theMsg.append("\n"); + } + } + MailProperties prop = new MailProperties(); + if (getRequestParameter(req, "mailTo").trim().isEmpty()) { + if (getRequestParameter(req, "MAIL_TO_MAILER").trim().isEmpty()) { + prop.setProperty("TO", getParm("MAIL_TO_MAILER").getTesto().trim()); + } else { + prop.setProperty("TO", getParm(getRequestParameter(req, "MAIL_TO_MAILER")).getTesto().trim()); + } + } else { + prop.setProperty("TO", getRequestParameter(req, getRequestParameter(req, "mailTo").trim())); + } + if (!getParm("MAIL_BCC_MAILER").getTesto().equals("")) + prop.setProperty("BCC", getParm("MAIL_BCC_MAILER").getTesto()); + if (getRequestParameter(req, "mailFrom").equals("")) { + prop.setProperty("FROM", getParm(getRequestParameter(req, "MAIL_FROM_MAILER")).getTesto()); + } else { + prop.setProperty("FROM", getRequestParameter(req, "mailFrom")); + } + prop.setProperty("SUBJECT", getRequestParameter(req, "mailSubject")); + if (mf != null) { + mf.setString("ip", ipAddress); + mf.setString("timestamp", d.toString()); + prop.setProperty("MSG", mf.getMessage()); + prop.setProperty("ISHTML", String.valueOf(isMessageHtml(mailMessageFile))); + } else { + theMsg.append("\nIP: "); + theMsg.append(ipAddress); + theMsg.append("\ntimestamp:"); + theMsg.append(d.toString()); + theMsg.append("\n"); + prop.setProperty("MSG", theMsg.toString()); + prop.setProperty("ISHTML", "false"); + } + DBAdapter.logDebug(true, "\n" + prop.toString()); + MailMessage mm = new MailMessage(getApFull()); + mm.sendMailMessage(prop, false); + if (getRequestParameter(req, "mailOkMsg").equals("")) { + sendMessage(req, apFull.translate("La mail e' stata inviata correttamente.", getLang(req))); + } else { + sendMessage(req, getRequestParameter(req, "mailOkMsg")); + } + chiamaJsp(req, res); + } else { + sendMessage(req, rp.getMsg()); + chiamaJsp(req, res); + } + } catch (Exception e) { + handleDebug(e); + if (getRequestParameter(req, "mailKoMsg").equals("")) { + sendMessage(req, apFull.translate("Impossibile inviare mail: ", getLang(req)) + " " + apFull.translate("Impossibile inviare mail: ", getLang(req))); + } else { + sendMessage(req, getRequestParameter(req, "mailKoMsg") + ": " + getRequestParameter(req, "mailKoMsg")); + } + chiamaJsp(req, res); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/CartSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/CartSvlt.java new file mode 100644 index 00000000..62af3d6d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/CartSvlt.java @@ -0,0 +1,1725 @@ +package it.acxent.cc.servlet; + +import it.acxent.anag.Cliente; +import it.acxent.anag.Clifor; +import it.acxent.anag.DestinazioneDiversa; +import it.acxent.anag.Iva; +import it.acxent.anag.Nazione; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.Users; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.art.ArticoloTaglia; +import it.acxent.art.ArticoloVariante; +import it.acxent.cart.AcCartObject; +import it.acxent.cart.Cart; +import it.acxent.cart.CartItem; +import it.acxent.cart.CartItemId; +import it.acxent.cart.CartStatus; +import it.acxent.cart.servlet.AcCartSvlt; +import it.acxent.cc.Attivita; +import it.acxent.cloudmsg.MsgJson; +import it.acxent.cloudmsg.PushNotificationService; +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoCR; +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.gtm.GoogleDataLayer; +import it.acxent.gtm.GoogleDataLayerBuilder; +import it.acxent.log.Log; +import it.acxent.rd.RemoteDevice; +import it.acxent.servlet.SavedHttpRequest; +import it.acxent.util.AbMessages; +import it.acxent.util.CodiceFiscale; +import it.acxent.util.DoubleOperator; +import it.acxent.util.RandomString; +import it.acxent.util.Vectumerator; +import it.acxent.www.Promozione; +import java.sql.Date; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +public class CartSvlt extends it.acxent.www.servlet.CartSvlt { + private static final long serialVersionUID = -1138852541424484366L; + + private Iva deliveryIva; + + protected void afterAddItem(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + try { + AcCartObject aco = getCartObject(req); + CartItem cartItem = new CartItem(aco, apFull, aco.getQuantity()); + Attivita attivita = Attivita.getDefaultInstance(apFull); + if (attivita.isTagManagerAttivo()) { + GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.addItemToCart("eec.add", cartItem)); + req.setAttribute("_gdl", gdl); + } + if (getCal(req).equals("list")) { + req.setAttribute("cmd", "search"); + req.setAttribute("act", "listaArticoli"); + RequestDispatcher rd = getServletContext().getRequestDispatcher("/Catalogo.abl"); + rd.forward((ServletRequest)req, (ServletResponse)res); + } else if (getCal(req).equals("wl")) { + req.setAttribute("cmd", "search"); + req.setAttribute("act", ""); + RequestDispatcher rd = getServletContext().getRequestDispatcher("/Wishlist.abl"); + rd.forward((ServletRequest)req, (ServletResponse)res); + } else { + req.setAttribute("cmd", "md"); + Articolo bean = (Articolo)req.getAttribute("bean"); + req.setAttribute("id_articolo", Long.valueOf(bean.getId_articolo())); + req.setAttribute("id_articoloVariante", Long.valueOf(bean.getId_articoloVariante())); + req.setAttribute("id_articoloVarianteKit", Long.valueOf(bean.getId_articoloVarianteKit())); + req.setAttribute("id_articoloTaglia", Long.valueOf(bean.getId_articoloTaglia())); + req.setAttribute("id_taglia", Long.valueOf(bean.getArticoloTaglia().getId_taglia())); + req.setAttribute("id_articoloTagliaKit", Long.valueOf(bean.getId_articoloTagliaKit())); + RequestDispatcher rd = getServletContext().getRequestDispatcher("/Catalogo.abl"); + rd.forward((ServletRequest)req, (ServletResponse)res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected void afterCheckCart(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Cart cart = getCart(req); + Attivita attivita = Attivita.getDefaultInstance(apFull); + if (attivita.isTagManagerAttivo()) { + GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.showCart("eec.checkout", "1", cart)); + req.setAttribute("_gdl", gdl); + } + gestionePromozioni(cart, req); + String callingJsp = getRequestParameter(req, "callingJsp"); + if (!callingJsp.isEmpty()) { + setJspPageRelative(callingJsp, req); + } else { + setJspPageRelative("cart.jsp", req); + } + try { + callJsp(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void afterCheckOut(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + if (getAct(req).equals(ACT_LOGIN) && getLoginUserId(req) > 0L) { + GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.eventStep("eec.checkout", "2")); + req.setAttribute("_gdl", gdl); + } + Attivita attivita = Attivita.getDefaultInstance(apFull); + String l_lang = getLang(req); + Cart cart = getCart(req); + gestionePromozioni(cart, req); + String callingJsp = getRequestParameter(req, "callingJsp"); + if (callingJsp.equals("checkOut.jsp")) { + cart.setNote(getRequestParameter(req, "note")); + cart.setFlgPayment(getRequestLongParameter(req, "flgPayment")); + } + if (cart.getFlgPayment() > 0L) { + TipoPagamento tp = new TipoPagamento(apFull); + tp.findByPrimaryKey(cart.getFlgPayment()); + cart.setDescPayment(tp.getDescrizioneWww(getLang(req))); + } + setCart(req, cart); + gestioneScontiCommissioniTipoPagamento(cart, req); + req.setAttribute("listaNazioni", new Nazione(apFull).findAllAttive(getLang(req))); + Users user = (Users)getLoginUser(req); + req.setAttribute("listaTipoPagamento", getListaTipiPagamento(req, cart)); + setJspPageRelative("checkOut.jsp", req); + if (user.isProfileNoReg()) { + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + } + try { + callJsp(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void afterDeleteCart(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative("index.jsp", req); + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void afterDeleteItem(HttpServletRequest req, HttpServletResponse res) { + Cart cart = getCart(req); + String l_codicePromozione = cart.getCodPromo(); + if (l_codicePromozione != null && !l_codicePromozione.isEmpty()) { + Promozione promozione = new Promozione(getApFull(req)); + promozione.findByCodicePromozione(l_codicePromozione); + if (promozione.getDBState() == 1) { + Users utente = (Users)getLoginUser(req); + long resPromo = promozione.isValid(utente, cart); + if (resPromo != Promozione.PROMOZIONE_VALIDA) { + cart.setDiscountPerc(0L); + cart.setDescDiscountPerc(""); + cart.setDescDiscount(""); + cart.setCodPromo(""); + setCart(req, cart); + } + } + } + try { + checkCart(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void afterModifyItems(HttpServletRequest req, HttpServletResponse res) { + try { + updateDeliveryCost(getCart(req), req); + checkCart(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected String getCheckCartJspPage(HttpServletRequest req) { + return null; + } + + protected String getCheckOutJspPage(HttpServletRequest req) { + return null; + } + + protected String getDeleteItemJspPage(HttpServletRequest req) { + return null; + } + + protected String getModifyItemJspPage(HttpServletRequest req) { + return null; + } + + protected it.acxent.common.Users getUser(HttpServletRequest req) { + ApplParmFull apFull = getApFull(); + return new Users(apFull); + } + + protected void afterOrderRecorded(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long id_clifor = getRequestLongParameter(req, "id_clifor"); + forceJspPageRelative("documento.jsp", req); + callJsp(req, res); + } + + protected ResParm sendLostPasswordMessage(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Attivita attivita = Attivita.getDefaultInstance(apFull); + String lostEmail = getRequestParameter(req, AcCartSvlt.ATTR_LOSTPWDEMAIL); + if (lostEmail.isEmpty()) + return new ResParm(false, attivita.translate("Email errata", getLang(req))); + return attivita.sendLostPasswordMailMessage(lostEmail, getLang(req), req); + } + + protected boolean checkAvailability(HttpServletRequest req) { + return getParm("CC_CHECK_AVAIL").isTrue(); + } + + protected void logOn(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + try { + String jspPage = "/checkOut.jsp"; + if (jspPage.isEmpty()) + jspPage = getJspHomePage(req); + if (!getLogin(req).isEmpty()) + if (checkLoginName(req, res) == 5L) { + setDeliveryIva(null); + if (isFirstAccess(req)) { + SavedHttpRequest shr = (SavedHttpRequest)req.getSession().getAttribute("savedHttpRequest"); + if (shr == null) { + shr = new SavedHttpRequest(); + shr.setCompleteRequestedURI(req.getRequestURI()); + shr.setServletPath(req.getServletPath()); + shr.setAllParametersNAttributes(req); + req.getSession().setAttribute("savedHttpRequest", shr); + } + forceJspPageRelative(getCheckCCPage(), req); + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } else { + String idCryptParm = "idcrypt"; + String l_id_ordineCript = (String)req.getSession().getAttribute(idCryptParm); + if (l_id_ordineCript != null && !l_id_ordineCript.isEmpty()) { + System.out.println("aaa"); + if (!getCal(req).isEmpty()) { + setJspPageRelative(getCal(req), req); + } else { + setJspPageRelative("ShowOrdine.abl", req); + } + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } else { + String thePage = getRequestParameter(req, "thePage"); + if (getCart(req).getNumberOfItems() > 0L || thePage.isEmpty()) { + setJspPageRelative(jspPage, req); + } else { + setJspPageRelative(thePage, req); + HttpSession session = req.getSession(); + Users users = (Users)session.getAttribute("utenteLogon"); + if (users.getId_clifor() != 0L) { + DocumentoCR CR = new DocumentoCR(); + CR.setId_clifor(users.getId_clifor()); + req.setAttribute("list", new Documento(apFull).findByCR(CR, 0, 0)); + } + } + req.setAttribute("listaNazioni", new Nazione(apFull).findAllAttive(getLang(req))); + req.setAttribute("listaTipoPagamento", getListaTipiPagamento(req, getCart(req))); + callJsp(req, res); + } + } + } else { + sendMessage(req, AbMessages.getMessage(getLang(req), "LOGIN_FAIL")); + String thePage = getRequestParameter(req, "thePage"); + if (thePage.isEmpty()) { + setJspPageRelative(jspPage, req); + } else { + setJspPageRelative(thePage, req); + } + callJsp(req, res); + } + } catch (Exception e) { + handleDebug(e); + sendMessage(req, e.getMessage()); + setJspPageRelative(getCal(req), req); + callJsp(req, res); + } + } + + public AcCartObject getCartObject(HttpServletRequest req) throws Exception { + ApplParmFull apFull = getApFull(req); + String l_lang = getLang(req); + double l_quantity = getRequestDoubleParameter(req, "qt"); + if (l_quantity == 0.0D) + l_quantity = 1.0D; + CartItemId articoloID = scomponiIdSuRequest(req); + Articolo bean = new Articolo(apFull); + bean.findByCartitemId(articoloID); + req.setAttribute("bean", bean); + AcCartObject aco = new AcCartObject(Articolo.class, articoloID, l_quantity); + aco.setCodPromo(bean.getCodicePromozione()); + aco.setLang(l_lang); + return aco; + } + + protected ResParm recordOrder(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String lang = getLang(req); + Attivita attivita = Attivita.getDefaultInstance(apFull); + ResParm rp = new ResParm(true); + synchronized (this) { + try { + System.out.println("record ORDINE ----------------------------"); + Cart cart = getCart(req); + if (rp.getStatus()) { + Users utente = (Users)getLoginUser(req); + long l_id_tipoOrdine = getParm("ID_DOC_ORDINE_WWW").getNumeroLong(); + Documento ordine = new Documento(apFull); + ordine.setId_tipoDocumento(l_id_tipoOrdine); + ordine.setFlgStato(1L); + ordine.setId_clifor(utente.getId_clifor()); + ordine.setDataDocumento(new Date(new java.util.Date().getTime())); + ordine.setNominativoDocumento(utente.getDescrizione()); + ordine.setId_tipoPagamento(cart.getFlgPayment()); + ordine.setFlgRitiroNegozio(cart.getFlgPickup()); + ordine.setNotaAggiuntiva(cart.getNote()); + ordine.setFlgDeliveryType(cart.getFlgDeliveryType()); + ordine.setPudoId(cart.getPudoId()); + ordine.setPudoDesc(cart.getPudoDesc()); + ordine.setKgLordo(0.5D); + ordine.setFlgTrasporto(1L); + if (cart.getDiscountPerc() > 0L) + ordine.setPercScontoIncondizionato((double)cart.getDiscountPerc()); + DoubleOperator spese = new DoubleOperator(cart.getMoreCost()); + spese.add(cart.getDeliveryCost()); + if (cart.getDeliveryWarnCost() > 0.0D) { + spese.add(cart.getDeliveryWarnCost()); + ordine.setFlgAvvisoConsegna(1L); + } + ordine.setSpeseTrasporto(spese.getResult()); + ordine.setId_ivaDoc(cart.getId_ivaDelivery()); + ordine.setFlgStatoOrdineWww(0L); + ordine.setFlgPagata(0L); + ordine.setFlgWwwRichiedeFattura(1L); + long ckDestinazioneDiversa = getRequestLongParameter(req, "ckDestinazioneDiversa"); + ckDestinazioneDiversa = 1L; + DestinazioneDiversa dd = utente.getClifor().getDestinazioneDiversa(0); + if (ckDestinazioneDiversa == 1L && dd.getId_destinazioneDiversa() > 0L) { + ordine.setPresso(dd.getPressoDD()); + ordine.setIndirizzoSped(dd.getIndirizzoDD()); + ordine.setNumeroCivicoSped(dd.getNumeroCivicoDD()); + ordine.setCittaSped(dd.getDescrizioneComuneDD()); + ordine.setProvinciaSped(dd.getProvinciaComuneDD()); + ordine.setCapSped(dd.getCapComuneDD()); + ordine.setId_nazioneSped(dd.getId_nazioneDD()); + System.out.println("Destinazione diversa :" + ordine.getPresso()); + } + if (isCostoSpedizioneFull()) { + if (getParm(Cart.P_PROCEDI_PAGAMENTO).isTrue()) { + if (cart.isCostoSpedizionePreventivo()) { + ordine.setFlgProcediPagamento(0L); + } else { + ordine.setFlgProcediPagamento(1L); + } + } else { + ordine.setFlgProcediPagamento(0L); + } + } else if (getParm(Cart.P_PROCEDI_PAGAMENTO).isTrue()) { + if (!ordine.getId_nazioneSped().isEmpty()) { + if (ordine.getNazioneSped().getFlgPreventivoWww() == 0L) + ordine.setFlgProcediPagamento(1L); + } else if (ordine.getClifor().getNazione().getFlgPreventivoWww() == 0L) { + ordine.setFlgProcediPagamento(1L); + } + } + if (cart.hasItemConScontoTroppoAlto()) + ordine.setFlgProcediPagamento(0L); + rp = ordine.save(); + boolean ebayUpdate = false; + boolean amzUpdate = false; + if (rp.getStatus()) { + Enumeration enu = cart.getItems(); + while (enu.hasMoreElements()) { + CartItem ci = enu.nextElement(); + if (ci.getQuantity() > 0.0D) { + RigaDocumento rigaOrdine = new RigaDocumento(apFull); + Articolo articolo = (Articolo)ci.getDbItem(); + if (articolo.getCartItemType() == 0L) { + rigaOrdine.setId_articolo(articolo.getId_articolo()); + rigaOrdine.setQuantita(ci.getQuantity()); + rigaOrdine.setNr(ci.getQuantity()); + rigaOrdine.setPrezzoPubblicoConIva(ci.getPriceWVat(utente.getId_users())); + rigaOrdine.setImponibile(ci.getPrice()); + if (cart.getDiscountPercTot() > 0.0D) { + rigaOrdine.setSconto(cart.getDiscountPercTot()); + } else { + rigaOrdine.setSconto(articolo.getPrezzoArticolo(ordine.getClifor()).getPercSconto()); + } + rigaOrdine.setDescrizioneRiga(rigaOrdine.getArticolo().getDescrizioneCompleta(lang)); + rigaOrdine.setId_iva(articolo.getIvaByClifor(utente.getClifor()).getId_iva()); + rp = Documento.addRigaDocumento(ordine, rigaOrdine); + if (rp.getStatus()) + Articolo.aggiornaDispoEPrezzoArticoloFornitore(rigaOrdine.getArticolo(), (long)-rigaOrdine.getNr(), 0L, true); + if (rp.getStatus()) { + if (attivita.isEbay() && + !rigaOrdine.getArticolo().isEbayPrezzoQtaAllineati()) + ebayUpdate = true; + if (attivita.isAmz() && + !rigaOrdine.getArticolo().isAmazonPrezzoQtaAllineati()) + amzUpdate = true; + } + continue; + } + if (articolo.getCartItemType() == 3L) { + rigaOrdine.setId_articolo(articolo.getId_articolo()); + rigaOrdine.setId_articoloVariante(articolo.getId_articoloVariante()); + rigaOrdine.setId_articoloTaglia(articolo.getId_articoloTaglia()); + rigaOrdine.setQuantita(ci.getQuantity()); + rigaOrdine.setNr(ci.getQuantity()); + rigaOrdine.setPrezzoPubblicoConIva(ci.getPriceWVat(utente.getId_users())); + rigaOrdine.setImponibile(ci.getPrice()); + if (cart.getDiscountPercTot() > 0.0D) { + rigaOrdine.setSconto(cart.getDiscountPercTot()); + } else { + rigaOrdine.setSconto(articolo.getPrezzoArticolo(ordine.getClifor()).getPercSconto()); + } + rigaOrdine.setDescrizioneRiga(rigaOrdine.getArticolo().getDescrizioneCompleta(lang)); + rigaOrdine.setId_iva(articolo.getId_iva()); + rigaOrdine.setId_iva(articolo.getIvaByClifor(utente.getClifor()).getId_iva()); + rp = Documento.addRigaDocumento(ordine, rigaOrdine); + if (rp.getStatus()); + continue; + } + if (articolo.getCartItemType() == 5L) { + rigaOrdine.setId_articolo(articolo.getId_articolo()); + rigaOrdine.setId_articoloVariante(articolo.getId_articoloVariante()); + rigaOrdine.setId_articoloTaglia(articolo.getId_articoloTaglia()); + rigaOrdine.setQuantita(ci.getQuantity()); + rigaOrdine.setNr(ci.getQuantity()); + rigaOrdine.setPrezzoPubblicoConIva(ci.getPriceWVat(utente.getId_users())); + rigaOrdine.setImponibile(ci.getPrice()); + if (cart.getDiscountPercTot() > 0.0D) { + rigaOrdine.setSconto(cart.getDiscountPercTot()); + } else { + rigaOrdine.setSconto(articolo.getPrezzoArticolo(ordine.getClifor()).getPercSconto()); + } + rigaOrdine.setDescrizioneRiga(rigaOrdine.getArticolo().getDescrizioneCompleta(lang)); + rigaOrdine.setId_iva(articolo.getId_iva()); + rp = Documento.addRigaDocumento(ordine, rigaOrdine); + rigaOrdine = new RigaDocumento(apFull); + rigaOrdine.setId_articolo(articolo.getArticoloVarianteKit().getId_articolo()); + rigaOrdine.setId_articoloVariante(articolo.getArticoloVarianteKit().getId_articoloVariante()); + rigaOrdine.setId_articoloTaglia(articolo.getId_articoloTagliaKit()); + rigaOrdine.setQuantita(ci.getQuantity()); + rigaOrdine.setNr(ci.getQuantity()); + rigaOrdine.setDescrizioneRiga(rigaOrdine.getArticolo().getDescrizioneCompleta(lang)); + rigaOrdine.setId_iva(articolo.getIvaByClifor(utente.getClifor()).getId_iva()); + rp = Documento.addRigaDocumento(ordine, rigaOrdine); + if (rp.getStatus()); + } + } + } + ordine.setFlgStato(1L); + ordine.setFlgStatoOrdineWww(0L); + ordine.setFlgStatoPrenotazione(0L); + rp = ordine.save(); + if (rp.getStatus()) + if (!cart.getCodPromo().isEmpty()) { + Promozione promo = new Promozione(apFull); + promo.findByCodicePromozione(cart.getCodPromo()); + if (promo.getDBState() == 1) { + rp = Promozione.addUtilizzo(promo, utente.getId_users(), ordine.getId_documento()); + Log.addAltro(apFull, req.getRemoteAddr(), utente.getId_users(), "Promo " + + promo.getDescrizione() + " codice: " + promo.getCodicePromozione() + " utilizzata in data " + + String.valueOf(promo.getDataUtilizzoPromozione()) + " su ordine " + + ordine.getNumeroDocumentoCompleto()); + } else { + handleDebug("Attenzione! recordOrder: promozione " + cart.getCodPromo() + " non trovata!!", 0); + } + if (!rp.getStatus()) + handleDebug("ATTENZIONE! Promozione " + promo.getId_promozione() + " relativa all'ordine " + + ordine.getNumeroDocumentoCompleto() + " Non aggiornata!", 0); + } + if (ebayUpdate && attivita.isEbay()) { + Articolo art = new Articolo(getApFull()); + System.out.println("recordorder: avvio thread allinemento ebay"); + art.startThreadAllineaEbay(apFull, new ArticoloCR()); + } + if (amzUpdate && attivita.isAmz()) { + Articolo art = new Articolo(getApFull()); + System.out.println("recordorder: avvio thread allinemento amz"); + art.startThreadAllineaAmz(apFull, new ArticoloCR()); + } + if (!rp.getStatus()) { + sendMessage(req, "Ordine registrato ma non è stato possibile inviare email di conferma: " + rp.getMsg()); + rp.setStatus(true); + rp.setMsg("Ordine registrato ma non è stato possibile inviare email di conferma: " + rp.getMsg()); + } + ordine.setFlgOrdineWwwAppenaCreato(1L); + req.setAttribute(PROP_ORDER, ordine); + int ordineInverso = (ordine.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + req.setAttribute("righeDocumento", ordine.findRigheDocumento(0, 0, ordineInverso)); + req.setAttribute("listaTipoPagamento", getListaTipiPagamento(req, cart)); + forceJspPageRelative("documento.jsp", req); + } else { + handleDebug(rp.getMsg(), 1); + forceJspPageRelative("checkOut.jsp", req); + forceMessage(req, "Attenzione! Impossibile registrare l'ordine: " + rp.getMsg()); + } + if (rp.getStatus()) + if (attivita.isTagManagerAttivo()) { + GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.eventStep("eec.checkout", "4")); + req.setAttribute("_gdl", gdl); + } + } else { + req.setAttribute("listaNazioni", new Nazione(apFull).findAllAttive(getLang(req))); + } + } catch (Exception e) { + handleDebug(e); + sendMessage(req, "CheckOut: record order error: " + e.getMessage()); + } + } + return rp; + } + + protected String getJspHomePage(HttpServletRequest req) { + return "index.jsp"; + } + + protected ResParm sendCheckOutMessage(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento ordine = (Documento)req.getAttribute(PROP_ORDER); + Attivita attivita = Attivita.getDefaultInstance(apFull); + Users utente = (Users)getLoginUser(req); + ResParm rp = new ResParm(true); + rp = attivita.sendOrderMailMessageCC(ordine, utente, utente.getLang(), true, true, false, false, req); + inviaNotificaOrdineAdmin(req, res, ordine); + return rp; + } + + protected double getDeliveryCost(HttpServletRequest req, Cart cart) { + if (isCostoSpedizioneFull()) + return getDeliveryCostPercentile(req, cart); + ApplParmFull apFull = getApFull(req); + double totCart = cart.getTotPriceVAT(); + if (getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumeroDouble() >= 0.0D && totCart >= + getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumeroDouble()) { + System.out.println("free above: " + getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumeroDouble() + " totCart:" + totCart); + return 0.0D; + } + double delivCost = 0.0D; + long l_flgTipoPagamento = cart.getFlgPayment(); + TipoPagamento tp = new TipoPagamento(getApFull()); + tp.findByPrimaryKey(l_flgTipoPagamento); + if (tp.getFlgAbilitatoNegozio() == 0L) { + if (getAct2(req).startsWith("changePudo")) + if (getAct2(req).equals("changePudoOn")) { + cart.setFlgDeliveryType(2L); + } else if (getAct2(req).equals("changePudoOff")) { + cart.setFlgDeliveryType(0L); + } + Users user = (Users)getLoginUser(req); + if (user != null && user.isProfileNoReg()) { + long l_id_clifor = user.getId_clifor(); + if (user.getApFull() == null) + user = new Users(apFull); + fillObject(req, user); + user.setId_clifor(l_id_clifor); + fillObject(req, user.getClifor()); + DestinazioneDiversa dd = new DestinazioneDiversa(apFull); + fillObject(req, dd); + user.getClifor().setCurrentDD(dd); + } + if (user != null) + if (cart.getFlgDeliveryType() == 2L) { + delivCost = getParm(Cart.P_DELIVERY_COST_PUDO).getNumeroDouble(); + } else { + DestinazioneDiversa dd = user.getClifor().getCurrentDD(); + boolean preventivoSpedizione = false; + if (!dd.getId_nazioneDD().isEmpty()) { + if (dd.getNazioneDD().getFlgPreventivoWww() == 0L) { + delivCost = dd.getNazioneDD().getCostoSpedizione(); + } else { + delivCost = 0.0D; + preventivoSpedizione = true; + } + } else if (user.getClifor().getNazione().getFlgPreventivoWww() == 0L) { + delivCost = user.getClifor().getNazione().getCostoSpedizione(); + } else { + delivCost = 0.0D; + preventivoSpedizione = true; + } + if (delivCost == 0.0D && !preventivoSpedizione) { + delivCost = getParm(Cart.P_DELIVERY_COST).getNumeroDouble(); + } else { + delivCost = getParm(Cart.P_DELIVERY_COST).getNumeroDouble(); + } + } + } + if (tp.getFlgAbilitatoNegozio() == 1L) { + delivCost = 0.0D; + } else if (tp.getFlgAbilitatoCorriere() == 1L) { + cart.setMoreCost(getMoreCost(req)); + cart.setDescMoreCost(tp.getDescrizione(getLang(req))); + } else { + cart.setMoreCost(0.0D); + cart.setDescMoreCost(""); + } + if (getAct2(req).startsWith("changePudo")) + if (getAct2(req).equals("changePudoOn")) { + cart.setFlgDeliveryType(2L); + } else { + cart.setFlgDeliveryType(0L); + } + if (getAct2(req).startsWith("changeDWC")) + if (getAct2(req).equals("changeDWC0")) { + cart.setDeliveryWarnCost(0.0D); + } else { + cart.setDeliveryWarnCost(getDeliveryWarnCost(req)); + } + System.out.println("deliv cost no above: " + delivCost); + return delivCost; + } + + protected double getDeliveryCostFull(HttpServletRequest req, Cart cart) { + boolean debug = false; + ApplParmFull apFull = getApFull(req); + double totCart = cart.getTotPriceVAT(); + if (getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumeroDouble() >= 0.0D && totCart >= + getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumeroDouble()) { + System.out.println("getDeliveryCostFull: free above: " + + getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumeroDouble() + " totCart:" + totCart); + return 0.0D; + } + String l_id_nazione = "I"; + double delivCost = 0.0D; + long l_flgTipoPagamento = cart.getFlgPayment(); + TipoPagamento tp = new TipoPagamento(getApFull()); + tp.findByPrimaryKey(l_flgTipoPagamento); + if (tp.getFlgAbilitatoNegozio() == 0L) { + Attivita attivita = Attivita.getDefaultInstance(apFull); + boolean isPreventivoSuPercentile = (attivita.getPercentileMaxPerPreventivo() <= 0L); + Users user = (Users)getLoginUser(req); + if (user != null && user.isProfileNoReg()) { + long l_id_clifor = user.getId_clifor(); + if (user.getApFull() == null) + user = new Users(apFull); + fillObject(req, user); + user.setId_clifor(l_id_clifor); + fillObject(req, user.getClifor()); + DestinazioneDiversa dd = new DestinazioneDiversa(apFull); + fillObject(req, dd); + user.getClifor().setCurrentDD(dd); + } + if (user != null) { + DestinazioneDiversa dd = user.getClifor().getCurrentDD(); + if (!dd.getId_nazioneDD().isEmpty()) + l_id_nazione = dd.getId_nazioneDD(); + } + double maxCostoSpedizione = 0.0D; + double minCostoSpedizione = 9999.0D; + long totPercentile = 0L; + Enumeration enu = cart.getItems(); + cart.setCostoSpedizionePreventivo(false); + while (enu.hasMoreElements()) { + CartItem row = enu.nextElement(); + if (row.isCostoSpedizionePreventivo(l_id_nazione)) + cart.setCostoSpedizionePreventivo(true); + double temp = row.getDeliveryCost(l_id_nazione); + if (maxCostoSpedizione < temp) + maxCostoSpedizione = temp; + if (minCostoSpedizione > temp) + minCostoSpedizione = temp; + totPercentile += row.getPercentileSpedizione() * (long)row.getQuantity(); + } + if (cart.isCostoSpedizionePreventivo()) { + delivCost = 0.0D; + } else if (totPercentile >= 100L) { + if (isPreventivoSuPercentile) { + cart.setCostoSpedizionePreventivo(true); + delivCost = 0.0D; + } else { + DoubleOperator dop = new DoubleOperator((float)(totPercentile - 100L)); + dop.multiply(minCostoSpedizione); + dop.divide(100.0F); + dop.setScale(2, 4); + dop.add(maxCostoSpedizione); + delivCost = dop.getResult(); + } + } else { + delivCost = maxCostoSpedizione; + } + if (debug) { + System.out.println("--------------------------------"); + System.out.println("percentile : " + totPercentile); + System.out.println("max deliv cost : " + maxCostoSpedizione); + System.out.println("min deliv cost : " + minCostoSpedizione); + System.out.println("PREVENTIVO: " + cart.isCostoSpedizionePreventivo()); + } + } + if (tp.getFlgAbilitatoNegozio() == 1L) { + delivCost = 0.0D; + cart.setCostoSpedizionePreventivo(false); + } else if (tp.getFlgAbilitatoCorriere() == 1L) { + cart.setMoreCost(getMoreCost(req)); + cart.setDescMoreCost(tp.getDescrizione(getLang(req))); + } else { + cart.setMoreCost(0.0D); + cart.setDescMoreCost(""); + } + if (getAct2(req).startsWith("changeDWC")) + if (getAct2(req).equals("changeDWC0")) { + cart.setDeliveryWarnCost(0.0D); + } else { + cart.setDeliveryWarnCost(getDeliveryWarnCost(req)); + } + if (debug) { + System.out.println("deliv cost : " + delivCost); + System.out.println("--------------------------------"); + } + return delivCost; + } + + public void _aggiornaNazione(HttpServletRequest req, HttpServletResponse res) { + Users user = (Users)getLoginUser(req); + if (user != null && user.getDBState() == 1) { + Clifor clifor = user.getClifor(); + clifor.setId_nazione(getRequestParameter(req, "id_nazione")); + clifor.save(); + req.setAttribute("cmd", CMD_CHECKOUT); + req.setAttribute("act", ATTR_CART); + checkOut(req, res); + } else { + forceJspPage("/index.jsp", req); + callJsp(req, res); + } + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("aggiornaNazione")) { + _aggiornaNazione(req, res); + } else if (getCmd(req).equals("saveNotaCart")) { + _saveNotaCart(req, res); + } else { + super.otherCommands(req, res); + } + } + + protected ResParm saveUser(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(true); + Users bean = (Users)getLoginUser(req); + fillObject(req, bean); + Cliente cli = new Cliente(apFull); + fillObject(req, cli); + bean.setClifor(cli); + String msg = "Impossibile Registrare un nuovo utente:"; + if (bean.isLogonDuplicated()) { + msg = msg + " Login già presente in archivio"; + rp.setStatus(false); + rp.setMsg(msg); + return rp; + } + if (bean.isEmailDuplicated()) { + Users userMl = new Users(apFull); + userMl.findUsersByEmail(bean.getEMail()); + if (userMl.getId_userProfile() == bean.getIdUserProfileMailingList()) { + req.setAttribute("id_users", String.valueOf(userMl.getId_users())); + req.setAttribute("flgValido", "S"); + req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww())); + rp = saveUserAndClifor(req, res); + } else { + msg = msg + " Email già presente in archivio"; + forceMessage(req, msg); + req.setAttribute("bean", bean); + callJsp(req, res); + } + } else { + if (cli.isCodFiscDuplicated()) { + msg = msg + " Codice Fiscale già presente in archivio"; + rp.setStatus(false); + rp.setMsg(msg); + return rp; + } + if (cli.isPIvaDuplicated()) { + msg = msg + " Partita Iva già presente in archivio"; + rp.setStatus(false); + rp.setMsg(msg); + return rp; + } + if (!cli.getCodFisc().isEmpty() && !CodiceFiscale.controlloFormale(cli.getCodFisc())) { + msg = msg + " Il codice fiscale non è valido:"; + rp.setStatus(false); + rp.setMsg(msg); + return rp; + } + if (!cli.getPIva().isEmpty() && cli.getPIva().length() != 11) { + msg = msg + " Partita iva non valida:"; + rp.setStatus(false); + rp.setMsg(msg); + return rp; + } + req.setAttribute("flgValido", "S"); + req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww())); + rp = saveUserAndClifor(req, res); + } + return rp; + } + + protected ResParm saveUserAndClifor(HttpServletRequest req, HttpServletResponse res) { + ResParm rp = new ResParm(true); + Users user = (Users)getLoginUser(req); + long l_id_users = getLoginUserId(req); + fillObject(req, user); + Clifor cliente = user.getClifor(); + fillObject(req, cliente); + String nominativo = getRequestParameter(req, "nominativo"); + if (!nominativo.isEmpty()) { + cliente.setFlgAzienda(1L); + cliente.setCognome(nominativo); + cliente.setNome(""); + } + cliente.setFlgTipo("C"); + rp = cliente.save(); + if (rp.getStatus()) { + long ckDestinazioneDiversa = getRequestLongParameter(req, "ckDestinazioneDiversa"); + if (ckDestinazioneDiversa == 1L) { + DestinazioneDiversa dd = cliente.getCurrentDD(); + fillObject(req, dd); + if (!dd.getIndirizzoDD().isEmpty()) { + if (dd.getId_destinazioneDiversa() > 0L) { + dd.findByPrimaryKey(dd.getId_destinazioneDiversa()); + fillObject(req, dd); + } + dd.setId_clifor(cliente.getId_clifor()); + dd.setId_nazioneDD(cliente.getId_nazione()); + dd.setFlgDDDefault(1L); + dd.setDescrizioneDD("Sped. WWW"); + rp.append(dd.save()); + } + } + } + if (rp.getStatus()) { + user.setId_clifor(cliente.getId_clifor()); + if (user.getId_userProfile() == 0L) + user.setId_userProfile(10L); + user.setFlgValido("S"); + rp.append(user.save()); + } + if (!rp.getStatus()) { + sendMessage(req, "Impossibile salvare: " + rp.getMsg()); + rp.setStatus(false); + rp.setMsg("Impossibile salvare: " + rp.getMsg()); + return rp; + } + return rp; + } + + protected boolean useDeliveryCostOnUser() { + return false; + } + + public void _saveNotaCart(HttpServletRequest req, HttpServletResponse res) { + Cart cart = getCart(req); + cart.setNote(getRequestParameter(req, "note")); + setCart(req, cart); + } + + protected void afterCheckOutNoReg(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Attivita attivita = Attivita.getDefaultInstance(apFull); + if (attivita.isTagManagerAttivo()) { + GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.eventStep("eec.checkout", "3")); + req.setAttribute("_gdl", gdl); + } + Cart cart = getCart(req); + gestionePromozioni(cart, req); + String callingJsp = getRequestParameter(req, "callingJsp"); + if (callingJsp.equals("checkOut.jsp")) { + cart.setNote(getRequestParameter(req, "note")); + cart.setFlgPayment(getRequestLongParameter(req, "flgPayment")); + setCart(req, cart); + } + gestioneScontiCommissioniTipoPagamento(cart, req); + req.setAttribute("listaNazioni", new Nazione(apFull).findAllAttive(getLang(req))); + Users user = (Users)getLoginUser(req); + if (user.getApFull() == null) + user = new Users(apFull); + fillObject(req, user); + fillObject(req, user.getClifor()); + DestinazioneDiversa dd = new DestinazioneDiversa(apFull); + fillObject(req, dd); + user.getClifor().setCurrentDD(dd); + req.setAttribute("beanUser", user); + req.setAttribute("listaTipoPagamento", getListaTipiPagamento(req, cart)); + super.afterCheckOutNoReg(req, res); + } + + protected ResParm recordOrderNoRegOLD(HttpServletRequest req, HttpServletResponse res) { + ResParm rp = saveNoRegUser(req, res); + ApplParmFull apFull = getApFull(req); + if (rp.getStatus()) { + try { + Users utente = (Users)rp.getReturnObj(); + req.getSession(true).setAttribute("loginUser_id", new Long(utente.getId_users())); + req.getSession(true).setAttribute("utenteLogon", utente); + Cart cart = getCart(req); + long l_id_tipoOrdine = getParm("ID_DOC_ORDINE_WWW").getNumeroLong(); + Documento ordine = new Documento(apFull); + ordine.setId_tipoDocumento(l_id_tipoOrdine); + ordine.setFlgStato(1L); + ordine.setId_clifor(utente.getId_clifor()); + ordine.setDataDocumento(new Date(new java.util.Date().getTime())); + ordine.setNominativoDocumento(utente.getDescrizione()); + ordine.setId_tipoPagamento(cart.getFlgPayment()); + ordine.setFlgRitiroNegozio(cart.getFlgPickup()); + ordine.setNotaAggiuntiva(cart.getNote()); + ordine.setKgLordo(0.5D); + ordine.setFlgTrasporto(1L); + if (cart.getDiscountPerc() > 0L) + ordine.setPercScontoIncondizionato((double)cart.getDiscountPerc()); + DoubleOperator spese = new DoubleOperator(cart.getMoreCost()); + spese.add(cart.getDeliveryCost()); + if (cart.getDeliveryWarnCost() > 0.0D) { + spese.add(cart.getDeliveryWarnCost()); + ordine.setFlgAvvisoConsegna(1L); + } + ordine.setSpeseTrasporto(spese.getResult()); + if (ordine.getClifor().isPrezzoWebEsente()) + if (ordine.getClifor().getNazione().getFlgCee() == 1L) { + ordine.setId_ivaDoc(ordine.getCodiceIvaCeeAziendaArt41()); + } else { + ordine.setId_ivaDoc(ordine.getCodiceIvaArt8_A()); + } + if (req.getParameter("note") != null && !req.getParameter("note").equals("")) + ordine.setNote(req.getParameter("note")); + ordine.setFlgStatoOrdineWww(0L); + ordine.setFlgPagata(0L); + ordine.setFlgWwwRichiedeFattura(1L); + long l_rbflgPayment = getRequestLongParameter(req, "rbflgPayment"); + if (l_rbflgPayment == 0L) + l_rbflgPayment = 1L; + ordine.setId_tipoPagamento(l_rbflgPayment); + long ckDestinazioneDiversa = getRequestLongParameter(req, "ckDestinazioneDiversa"); + ckDestinazioneDiversa = 1L; + DestinazioneDiversa dd = utente.getClifor().getDestinazioneDiversa(0); + if (ckDestinazioneDiversa == 1L && dd.getId_destinazioneDiversa() > 0L) { + ordine.setPresso(dd.getPressoDD()); + ordine.setIndirizzoSped(dd.getIndirizzoDD()); + ordine.setNumeroCivicoSped(dd.getNumeroCivicoDD()); + ordine.setCittaSped(dd.getDescrizioneComuneDD()); + ordine.setProvinciaSped(dd.getProvinciaComuneDD()); + ordine.setCapSped(dd.getCapComuneDD()); + ordine.setId_nazioneSped(dd.getId_nazioneDD()); + System.out.println("Destinazione diversa :" + ordine.getPresso()); + } + if (getParm(Cart.P_PROCEDI_PAGAMENTO).isTrue()) + if (!ordine.getId_nazioneSped().isEmpty()) { + if (ordine.getNazioneSped().getFlgPreventivoWww() == 0L) + ordine.setFlgProcediPagamento(1L); + } else if (ordine.getClifor().getNazione().getFlgPreventivoWww() == 0L) { + ordine.setFlgProcediPagamento(1L); + } + rp = ordine.save(); + boolean ebayUpdate = false; + if (rp.getStatus()) { + Enumeration enu = cart.getItems(); + String lang = getLang(req); + while (enu.hasMoreElements()) { + CartItem ci = enu.nextElement(); + if (ci.getQuantity() > 0.0D) { + RigaDocumento rigaOrdine = new RigaDocumento(apFull); + Articolo articolo = (Articolo)ci.getDbItem(); + if (articolo.getCartItemType() == 0L) { + rigaOrdine.setId_articolo(articolo.getId_articolo()); + rigaOrdine.setQuantita(ci.getQuantity()); + rigaOrdine.setNr(ci.getQuantity()); + rigaOrdine.setPrezzoPubblicoConIva(ci.getPriceWVat(utente.getId_users())); + rigaOrdine.setImponibile(ci.getPrice()); + if (cart.getDiscountPercTot() > 0.0D) { + rigaOrdine.setSconto(cart.getDiscountPercTot()); + } else { + rigaOrdine.setSconto(articolo.getPrezzoArticolo(ordine.getClifor()).getPercSconto()); + } + rigaOrdine.setDescrizioneRiga(rigaOrdine.getArticolo().getDescrizioneCompleta(lang)); + rp = Documento.addRigaDocumento(ordine, rigaOrdine); + if (rp.getStatus()) + Articolo.aggiornaDispoEPrezzoArticoloFornitore(rigaOrdine.getArticolo(), (long)-rigaOrdine.getNr(), 0L, true); + if (rp.getStatus() && + !rigaOrdine.getArticolo().isEbayPrezzoQtaAllineati()) + ebayUpdate = true; + continue; + } + if (articolo.getCartItemType() == 3L) { + rigaOrdine.setId_articolo(articolo.getId_articolo()); + rigaOrdine.setId_articoloVariante(articolo.getId_articoloVariante()); + rigaOrdine.setId_articoloTaglia(articolo.getId_articoloTaglia()); + rigaOrdine.setQuantita(ci.getQuantity()); + rigaOrdine.setNr(ci.getQuantity()); + rigaOrdine.setPrezzoPubblicoConIva(ci.getPriceWVat(utente.getId_users())); + rigaOrdine.setImponibile(ci.getPrice()); + if (cart.getDiscountPercTot() > 0.0D) { + rigaOrdine.setSconto(cart.getDiscountPercTot()); + } else { + rigaOrdine.setSconto(articolo.getPrezzoArticolo(ordine.getClifor()).getPercSconto()); + } + rigaOrdine.setDescrizioneRiga(rigaOrdine.getArticolo().getDescrizioneCompleta(lang)); + rigaOrdine.setId_iva(articolo.getId_iva()); + rp = Documento.addRigaDocumento(ordine, rigaOrdine); + if (rp.getStatus()); + continue; + } + if (articolo.getCartItemType() == 5L) { + rigaOrdine.setId_articolo(articolo.getId_articolo()); + rigaOrdine.setId_articoloVariante(articolo.getId_articoloVariante()); + rigaOrdine.setId_articoloTaglia(articolo.getId_articoloTaglia()); + rigaOrdine.setQuantita(ci.getQuantity()); + rigaOrdine.setNr(ci.getQuantity()); + rigaOrdine.setPrezzoPubblicoConIva(ci.getPriceWVat(utente.getId_users())); + rigaOrdine.setImponibile(ci.getPrice()); + if (cart.getDiscountPercTot() > 0.0D) { + rigaOrdine.setSconto(cart.getDiscountPercTot()); + } else { + rigaOrdine.setSconto(articolo.getPrezzoArticolo(ordine.getClifor()).getPercSconto()); + } + rigaOrdine.setDescrizioneRiga(rigaOrdine.getArticolo().getDescrizioneCompleta(lang)); + rigaOrdine.setId_iva(articolo.getId_iva()); + rp = Documento.addRigaDocumento(ordine, rigaOrdine); + rigaOrdine = new RigaDocumento(apFull); + rigaOrdine.setId_articolo(articolo.getArticoloVarianteKit().getId_articolo()); + rigaOrdine.setId_articoloVariante(articolo.getArticoloVarianteKit().getId_articoloVariante()); + rigaOrdine.setId_articoloTaglia(articolo.getId_articoloTagliaKit()); + rigaOrdine.setQuantita(ci.getQuantity()); + rigaOrdine.setNr(ci.getQuantity()); + rigaOrdine.setDescrizioneRiga(rigaOrdine.getArticolo().getDescrizioneCompleta(lang)); + rp = Documento.addRigaDocumento(ordine, rigaOrdine); + if (rp.getStatus()); + } + } + } + ordine.setFlgStato(1L); + ordine.setFlgStatoOrdineWww(0L); + ordine.setFlgStatoPrenotazione(0L); + ordine.setNote("Tel. :" + ordine.getClifor().getTelefono() + " - Email: " + ordine.getClifor().getEMail()); + Promozione promo = new Promozione(apFull); + if (!cart.getDescDiscount().isEmpty()) { + promo.findByCodicePromozione(cart.getDescDiscount()); + if (promo.getDBState() == 1) + ordine.setNotePagamento("Promo: " + promo.getDescrizioneCompleta(lang)); + } + rp = ordine.save(); + if (rp.getStatus()) { + if (promo.getDBState() == 1) { + rp = Promozione.addUtilizzo(promo, utente.getId_users(), ordine.getId_documento()); + Log.addAltro(apFull, req.getRemoteAddr(), utente.getId_users(), "Promo " + + promo.getDescrizione() + " codice: " + promo.getCodicePromozione() + " utilizzata in data " + + String.valueOf(promo.getDataUtilizzoPromozione()) + " su ordine " + ordine.getNumeroDocumentoCompleto()); + } else { + handleDebug("Attenzione! recordOrder: promozione " + cart.getDescDiscountPerc() + " non trovata!!", 0); + } + if (!rp.getStatus()) + handleDebug("ATTENZIONE! Promozione " + promo.getId_promozione() + " relativa all'ordine " + + ordine.getNumeroDocumentoCompleto() + " Non aggiornata!", 0); + } + } else { + handleDebug(rp.getMsg(), 1); + forceJspPageRelative("checkOut.jsp", req); + forceMessage(req, "Attenzione! Impossibile registrare l'ordine: " + rp.getMsg()); + } + System.out.println("fine record ORDINE ############"); + if (!rp.getStatus()) { + sendMessage(req, "Ordine registrato ma non è stato possibile inviare email di conferma: " + rp.getMsg()); + rp.setStatus(true); + rp.setMsg("Ordine registrato ma non è stato possibile inviare email di conferma: " + rp.getMsg()); + } + req.setAttribute(PROP_ORDER, ordine); + int ordineInverso = (ordine.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + req.setAttribute("righeDocumento", ordine.findRigheDocumento(0, 0, ordineInverso)); + TipoPagamento tp = new TipoPagamento(apFull); + Vectumerator vec = tp.findPagamentiWww((ordine.getFlgRitiroNegozio() == 1L), (ordine.getFlgDeliveryType() > 0L)); + req.setAttribute("listaTipoPagamento", vec); + forceJspPageRelative("documento.jsp", req); + } catch (Exception e) { + handleDebug(e); + sendMessage(req, e.getMessage()); + rp.setStatus(false); + rp.setMsg(e.getMessage()); + } + } else { + Users user = new Users(getApFull()); + fillObject(req, user); + req.setAttribute("bean", user); + rp.setStatus(false); + rp.setMsg("Impossibile salvare l'ordine: " + rp.getMsg()); + } + if (rp.getStatus()) { + GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.eventStep("eec.checkout", "4")); + req.setAttribute("_gdl", gdl); + } + return rp; + } + + protected ResParm saveNoRegUser(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Users bean = new Users(apFull); + fillObject(req, bean); + bean.setEMail(bean.getLogin()); + Cliente cli = new Cliente(apFull); + req.setAttribute("eMail", bean.getLogin()); + fillObject(req, cli); + bean.setClifor(cli); + String msg = ""; + boolean pivaOk = true; + String l_pIva = bean.getPIva(); + ResParm rp = new ResParm(true); + if (!l_pIva.isEmpty()) + pivaOk = true; + Users userMl = new Users(getApFull(req)); + Users userCF = new Users(getApFull(req)); + if (bean.isEmailDuplicated()) { + userMl.findUsersByEmail(bean.getEMail()); + if (userMl.getId_userProfile() == bean.getIdUserProfileMailingList()) { + fillObject(req, userMl); + userMl.setId_userProfile(bean.getIdUserProfileNoReg()); + userMl.setFlgValido("S"); + rp = userMl.save(); + req.setAttribute("id_users", Long.valueOf(userMl.getId_users())); + rp = saveNoRegUserAndClifor(req, res); + } else if (userMl.getId_userProfile() == bean.getIdUserProfileNoReg()) { + if (userMl.getCodFisc().equals(bean.getCodFisc())) { + long l_id_clifor = userMl.getId_clifor(); + long l_id_user = userMl.getId_users(); + fillObject(req, userMl); + userMl.setId_users(l_id_user); + userMl.setId_clifor(l_id_clifor); + rp = userMl.save(); + req.setAttribute("id_users", Long.valueOf(userMl.getId_users())); + rp = saveNoRegUserAndClifor(req, res); + } else { + msg = msg + " Codice Fiscale associata a questa email diverso!!!!!"; + rp.setStatus(false); + rp.setMsg(msg); + } + } else { + msg = msg + " Email già presente in archivio perché ti sei già registrato. Effettua il login"; + rp.setStatus(false); + rp.setMsg(msg); + } + } + if (!rp.getStatus()) + return rp; + if (bean.isCodFiscDuplicated()) { + userCF.findUsersByCodiceFiscale(bean.getCodFisc()); + if (userCF.getId_userProfile() == bean.getIdUserProfileNoReg()) { + if (userCF.getEMail().equals(bean.getEMail())) { + long l_id_user = userCF.getId_users(); + fillObject(req, userCF); + userCF.setId_users(l_id_user); + rp = userCF.save(); + req.setAttribute("id_users", Long.valueOf(userCF.getId_users())); + rp = saveNoRegUserAndClifor(req, res); + } else { + msg = msg + " Codice Fiscale già utilizzato con un indirizzo email diverso!!!!!"; + rp.setStatus(false); + rp.setMsg(msg); + } + } else { + msg = msg + " Codice Fiscale già presente in archivio perché ti sei già registrato. Effettua il login"; + rp.setStatus(false); + rp.setMsg(msg); + } + } else if (!bean.getCodFisc().isEmpty() && bean.getId_nazione().equals("I") && !CodiceFiscale.controlloFormale(bean.getCodFisc())) { + msg = msg + " Il codice fiscale non è valido:"; + rp.setStatus(false); + rp.setMsg(msg); + } else { + req.setAttribute("flgValido", "S"); + req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileNoReg())); + rp = saveNoRegUserAndClifor(req, res); + } + return rp; + } + + protected ResParm saveNoRegUserAndClifor(HttpServletRequest req, HttpServletResponse res) { + ResParm rp = new ResParm(true); + ApplParmFull apFull = getApFull(req); + Users user = new Users(apFull); + long l_id_users = getRequestLongParameter(req, "id_users"); + user.findByPrimaryKey(l_id_users); + long l_id_clifor = user.getId_clifor(); + fillObject(req, user); + user.setId_clifor(l_id_clifor); + if (user.getId_nazione().toLowerCase().equals("i")) { + user.setLangMl("it"); + user.setLang("it"); + } else { + user.setLangMl("en"); + user.setLang("en"); + } + Clifor cliente = user.getClifor(); + fillObject(req, cliente); + cliente.setId_clifor(l_id_clifor); + cliente.setFlgTipo("C"); + rp = cliente.save(); + if (rp.getStatus()) { + DestinazioneDiversa dd = cliente.getCurrentDD(); + fillObject(req, dd); + if (dd.getIndirizzoDD().isEmpty()) { + if (dd.getId_destinazioneDiversa() != 0L) + rp.append(dd.delete()); + } else { + dd.setId_clifor(cliente.getId_clifor()); + dd.setFlgDDDefault(1L); + dd.setDescrizioneDD("Sped. WWW"); + rp.append(dd.save()); + } + } + if (rp.getStatus()) { + user.setId_clifor(cliente.getId_clifor()); + if (user.getId_userProfile() == 0L) + user.setId_userProfile(user.getIdUserProfileNoReg()); + user.setFlgValido("S"); + if (user.getPwd().isEmpty()) { + RandomString randomString = new RandomString(8); + user.setPwd(randomString.nextString()); + } + rp.append(user.save()); + } + if (!rp.getStatus()) { + sendMessage(req, "Impossibile salvare: " + rp.getMsg()); + rp.setStatus(false); + rp.setMsg("Impossibile salvare: " + rp.getMsg()); + return rp; + } + rp.setReturnObj(user); + return rp; + } + + public AcCartObject getCartObjectOld(HttpServletRequest req) throws Exception { + ApplParmFull apFull = getApFull(req); + String l_id = getRequestParameter(req, "id"); + long l_id_articolo = 0L, l_id_articoloVariante = 0L, l_id_articoloTaglia = 0L; + if (!l_id.isEmpty()) { + if (l_id.indexOf("av_") >= 0) { + l_id_articoloVariante = Long.parseLong(l_id.substring(3)); + req.setAttribute("id_articoloVariante", Long.valueOf(l_id_articoloVariante)); + } else { + l_id_articolo = Long.parseLong(l_id); + req.setAttribute("id_articolo", Long.valueOf(l_id_articolo)); + } + } else { + l_id_articolo = getRequestLongParameter(req, "id_articolo"); + l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante"); + l_id_articoloTaglia = getRequestLongParameter(req, "id_articoloTaglia"); + } + double l_quantity = getRequestDoubleParameter(req, "qt"); + if (l_quantity == 0.0D) + l_quantity = 1.0D; + if (l_id_articoloTaglia > 0L) { + ArticoloTaglia at = new ArticoloTaglia(apFull); + at.findByPrimaryKey(l_id_articoloTaglia); + if (at.getQuantitaAtByMagFisico(1L) > 0.0D) { + req.setAttribute("bean", at.getArticoloVariante()); + AcCartObject acCartObject = new AcCartObject(ArticoloTaglia.class, at.getItemId(), l_quantity); + acCartObject.setCodPromo(at.getCodicePromozione()); + return acCartObject; + } + return null; + } + if (l_id_articoloVariante > 0L) { + ArticoloVariante av = new ArticoloVariante(apFull); + av.findByPrimaryKey(l_id_articoloVariante); + if (av.getQuantitaAvByMagFisico(1L) > 0.0D) { + req.setAttribute("bean", av); + AcCartObject acCartObject = new AcCartObject(ArticoloVariante.class, av.getItemId(), l_quantity); + acCartObject.setCodPromo(av.getCodicePromozione()); + return acCartObject; + } + return null; + } + Articolo bean = new Articolo(apFull); + bean.findByPrimaryKey(l_id_articolo); + req.setAttribute("bean", bean); + AcCartObject aco = new AcCartObject(Articolo.class, bean.getItemId(), l_quantity); + aco.setCodPromo(bean.getCodicePromozione()); + return aco; + } + + protected CartItemId scomponiIdSuRequest(HttpServletRequest req) throws Exception { + String l_id = getRequestParameter(req, "id"); + CartItemId articoloID = new CartItemId(); + articoloID.caricaCartItemIdFromReqId(l_id); + if (articoloID.getId_articoloTaglia() > 0L) + req.setAttribute("id_articoloTaglia", Long.valueOf(articoloID.getId_articoloTaglia())); + if (articoloID.getId_articoloTagliaKit() > 0L) + req.setAttribute("id_articoloTagliaKit", Long.valueOf(articoloID.getId_articoloTagliaKit())); + if (articoloID.getId_articoloVarianteKit() > 0L) + req.setAttribute("id_articoloVarianteKit", Long.valueOf(articoloID.getId_articoloVarianteKit())); + if (articoloID.getId_articoloVariante() > 0L) + req.setAttribute("id_articoloVariante", Long.valueOf(articoloID.getId_articoloVariante())); + if (articoloID.getId_articolo() > 0L) + req.setAttribute("id_articolo", Long.valueOf(articoloID.getId_articolo())); + return articoloID; + } + + protected CartItemId getRequestParameterCartItemId(HttpServletRequest req, String parmName) { + if (req.getAttribute(parmName) != null && req.getAttribute(parmName) instanceof CartItemId) + return (CartItemId)req.getAttribute(parmName); + return null; + } + + private void gestionePromozioni(Cart cart, HttpServletRequest req) { + ApplParmFull apFull = getApFull(req); + Attivita attivita = Attivita.getDefaultInstance(apFull); + String l_lang = getLang(req); + String l_codicePromozione = getRequestParameter(req, "codicePromozione"); + if (l_codicePromozione.isEmpty()) + l_codicePromozione = getRequestParameter(req, "codicePromozioneXs"); + if (!l_codicePromozione.isEmpty()) { + CartStatus cs = (CartStatus)req.getAttribute(ATTR_CART_STATUS); + Promozione promozione = new Promozione(getApFull(req)); + promozione.findByCodicePromozione(l_codicePromozione); + if (promozione.getDBState() == 0) { + sendMessage(req, attivita.translate("Codice Promozione non valido.", l_lang)); + } else { + Users utente = (Users)getLoginUser(req); + long resPromo = promozione.isValid(utente); + if (resPromo == Promozione.PROMOZIONE_VALIDA) { + cart.setDiscountPerc(promozione.getPercSconto()); + cart.setDescDiscountPerc(promozione.getDescrizione(l_lang)); + cart.setCodPromo(promozione.getCodicePromozione()); + setCart(req, cart); + } else if (resPromo == Promozione.PROMOZIONE_SCADUTA) { + sendMessage(req, attivita.translate("Codice Promozione scaduta.", l_lang)); + } else if (resPromo == Promozione.PROMOZIONE_NON_VALIDA) { + sendMessage(req, attivita.translate("Codice Promozione Non Valida.", l_lang)); + } else if (resPromo == Promozione.PROMOZIONE_UTENTE_NULL) { + sendMessage(req, + attivita.translate("Codice Promozione per Utente. Devi fare il login per poterla utilizzare.", l_lang)); + } + } + } + } + + protected void afterCheckCartOLD(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String l_lang = getLang(req); + Attivita attivita = Attivita.getDefaultInstance(apFull); + String l_codicePromozione = getRequestParameter(req, "codicePromozione"); + if (l_codicePromozione.isEmpty()) + l_codicePromozione = getRequestParameter(req, "codicePromozioneXs"); + Cart cart = getCart(req); + if (!l_codicePromozione.isEmpty()) { + CartStatus cs = (CartStatus)req.getAttribute(ATTR_CART_STATUS); + Promozione promozione = new Promozione(getApFull(req)); + promozione.findByCodicePromozione(l_codicePromozione); + if (promozione.getDBState() == 0) { + sendMessage(req, attivita.translate("Codice Promozione non valido.", l_lang)); + } else { + Users utente = (Users)getLoginUser(req); + long resPromo = promozione.isValid(utente); + if (resPromo == Promozione.PROMOZIONE_VALIDA) { + cart.setDiscountPerc(promozione.getPercSconto()); + cart.setDescDiscountPerc(promozione.getDescrizione(l_lang)); + cart.setDescDiscount(promozione.getCodicePromozione()); + setCart(req, cart); + } else if (resPromo == Promozione.PROMOZIONE_SCADUTA) { + sendMessage(req, attivita.translate("Codice Promozione scaduta.", l_lang)); + } else if (resPromo == Promozione.PROMOZIONE_NON_VALIDA) { + sendMessage(req, attivita.translate("Codice Promozione Non Valida.", l_lang)); + } else if (resPromo == Promozione.PROMOZIONE_UTENTE_NULL) { + sendMessage(req, + attivita.translate("Codice Promozione per Utente. Devi fare il login per poterla utilizzare.", l_lang)); + } + } + } + String callingJsp = getRequestParameter(req, "callingJsp"); + if (!callingJsp.isEmpty()) { + setJspPageRelative(callingJsp, req); + } else { + setJspPageRelative("cart.jsp", req); + } + try { + callJsp(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void afterCheckOutNoRegOLD(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Attivita attivita = Attivita.getDefaultInstance(apFull); + String l_lang = getLang(req); + String l_codicePromozione = getRequestParameter(req, "codicePromozione"); + if (l_codicePromozione.isEmpty()) + l_codicePromozione = getRequestParameter(req, "codicePromozioneXs"); + Cart cart = getCart(req); + if (!l_codicePromozione.isEmpty()) { + CartStatus cs = (CartStatus)req.getAttribute(ATTR_CART_STATUS); + Promozione promozione = new Promozione(getApFull(req)); + promozione.findByCodicePromozione(l_codicePromozione); + if (promozione.getDBState() == 0) { + sendMessage(req, "Codice Promozione non valido."); + } else { + Users utente = (Users)getLoginUser(req); + long resPromo = promozione.isValid(utente); + if (resPromo == Promozione.PROMOZIONE_VALIDA) { + cart.setDiscountPerc(promozione.getPercSconto()); + cart.setDescDiscountPerc(promozione.getDescrizione(l_lang)); + cart.setCodPromo(promozione.getCodicePromozione()); + setCart(req, cart); + } else if (resPromo == Promozione.PROMOZIONE_SCADUTA) { + sendMessage(req, attivita.translate("Codice Promozione scaduta.", l_lang)); + } else if (resPromo == Promozione.PROMOZIONE_NON_VALIDA) { + sendMessage(req, attivita.translate("Codice Promozione Non Valida.", l_lang)); + } else if (resPromo == Promozione.PROMOZIONE_UTENTE_NULL) { + sendMessage(req, + attivita.translate("Codice Promozione per Utente. Devi fare il login per poterla utilizzare.", l_lang)); + } + } + } + cart.setNote(getRequestParameter(req, "note")); + cart.setFlgPayment(getRequestLongParameter(req, "flgPayment")); + setCart(req, cart); + req.setAttribute("listaNazioni", new Nazione(apFull).findAllAttive(getLang(req))); + Users user = (Users)getLoginUser(req); + boolean isTipoPagEstero = false; + if (user.getApFull() == null) + user = new Users(apFull); + fillObject(req, user); + fillObject(req, user.getClifor()); + DestinazioneDiversa dd = new DestinazioneDiversa(apFull); + fillObject(req, dd); + user.getClifor().setCurrentDD(dd); + if (user != null) + isTipoPagEstero = !user.getClifor().getId_nazione().equals("I"); + req.setAttribute("beanUser", user); + req.setAttribute("listaTipoPagamento", new TipoPagamento(getApFull(req)).findPagamentiWww(isTipoPagEstero, false)); + super.afterCheckOutNoReg(req, res); + } + + private void gestioneScontiCommissioniTipoPagamento(Cart cart, HttpServletRequest req) { + ApplParmFull apFull = getApFull(req); + Attivita attivita = Attivita.getDefaultInstance(apFull); + String l_lang = getLang(req); + TipoPagamento tp = new TipoPagamento(apFull); + tp.findByPrimaryKey(cart.getFlgPayment()); + if (tp.getPercWwwSconto() > 0.0D) { + cart.setPercDiscountPay(tp.getPercWwwSconto()); + cart.setDescDiscountPay(attivita.translate("Sconto per ", l_lang) + " " + attivita.translate("Sconto per ", l_lang)); + } else { + cart.setPercDiscountPay(0.0D); + cart.setDescDiscountPay(""); + } + if (tp.getPercWwwSconto() == 0.0D && tp.getPercWwwCommissione() > 0.0D) { + cart.setPercCommissionPay(tp.getPercWwwSconto()); + cart.setDescCommissionPay(attivita.translate("Contributo pratiche elettroniche", l_lang)); + } else { + cart.setPercCommissionPay(0.0D); + cart.setDescCommissionPay(""); + } + setCart(req, cart); + } + + protected double getDeliveryCostPercentile(HttpServletRequest req, Cart cart) { + boolean debug = false; + ApplParmFull apFull = getApFull(req); + double totCart = cart.getTotPriceVAT(); + if (getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumeroDouble() >= 0.0D && totCart >= + getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumeroDouble()) { + System.out.println("getDeliveryCostFull: free above: " + + getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumeroDouble() + " totCart:" + totCart); + return 0.0D; + } + String l_id_nazione = "I"; + Nazione nazione = null; + double delivCost = 0.0D; + long l_flgTipoPagamento = cart.getFlgPayment(); + TipoPagamento tp = new TipoPagamento(getApFull()); + tp.findByPrimaryKey(l_flgTipoPagamento); + if (tp.getFlgAbilitatoNegozio() == 0L) { + Attivita attivita = Attivita.getDefaultInstance(apFull); + long percentileMax = attivita.getPercentileMaxPerPreventivo(); + Users user = (Users)getLoginUser(req); + if (user != null && user.isProfileNoReg()) { + long l_id_clifor = user.getId_clifor(); + if (user.getApFull() == null) + user = new Users(apFull); + fillObject(req, user); + user.setId_clifor(l_id_clifor); + fillObject(req, user.getClifor()); + DestinazioneDiversa dd = new DestinazioneDiversa(apFull); + fillObject(req, dd); + user.getClifor().setCurrentDD(dd); + } + if (user != null) { + DestinazioneDiversa dd = user.getClifor().getCurrentDD(); + if (!dd.getId_nazioneDD().isEmpty()) { + l_id_nazione = dd.getId_nazioneDD(); + nazione = new Nazione(apFull); + nazione.findByPrimaryKey(l_id_nazione); + } else { + l_id_nazione = user.getClifor().getId_nazione(); + nazione = user.getClifor().getNazione(); + } + } + if (nazione == null) { + nazione = new Nazione(apFull); + nazione.findByPrimaryKey(l_id_nazione); + } + double maxCostoSpedizione = 0.0D; + long totPercentile = 0L; + Enumeration enu = cart.getItems(); + cart.setCostoSpedizionePreventivo((nazione.getFlgPreventivoWww() == 1L)); + while (enu.hasMoreElements()) { + CartItem row = enu.nextElement(); + if (row.isCostoSpedizionePreventivo(l_id_nazione)) + cart.setCostoSpedizionePreventivo(true); + double temp = row.getDeliveryCost(l_id_nazione); + if (maxCostoSpedizione < temp) + maxCostoSpedizione = temp; + totPercentile += row.getPercentileSpedizione() * (long)row.getQuantity(); + } + if (cart.isCostoSpedizionePreventivo()) { + delivCost = 0.0D; + } else if (totPercentile >= 100L) { + if (totPercentile >= percentileMax) { + cart.setCostoSpedizionePreventivo(true); + delivCost = 0.0D; + } else { + DoubleOperator dop = new DoubleOperator((float)(totPercentile - 100L)); + dop.multiply(maxCostoSpedizione); + dop.divide(100.0F); + dop.setScale(2, 4); + dop.add(maxCostoSpedizione); + delivCost = dop.getResult(); + } + } else { + delivCost = maxCostoSpedizione; + } + if (debug) { + System.out.println("--------------------------------"); + System.out.println("percentile : " + totPercentile + " max percentile: " + percentileMax); + System.out.println("max deliv cost: " + maxCostoSpedizione); + System.out.println("PREVENTIVO: " + cart.isCostoSpedizionePreventivo()); + } + } + if (tp.getFlgAbilitatoNegozio() == 1L) { + delivCost = 0.0D; + cart.setCostoSpedizionePreventivo(false); + } else if (tp.getFlgAbilitatoCorriere() == 1L) { + cart.setMoreCost(getMoreCost(req)); + cart.setDescMoreCost(tp.getDescrizione(getLang(req))); + } else { + cart.setMoreCost(0.0D); + cart.setDescMoreCost(""); + } + if (getAct2(req).startsWith("changeDWC")) + if (getAct2(req).equals("changeDWC0")) { + cart.setDeliveryWarnCost(0.0D); + } else { + cart.setDeliveryWarnCost(getDeliveryWarnCost(req)); + } + if (debug) { + System.out.println("deliv cost : " + delivCost); + System.out.println("--------------------------------"); + } + return delivCost; + } + + protected ResParm recordOrderNoReg(HttpServletRequest req, HttpServletResponse res) { + ResParm rp = saveNoRegUser(req, res); + ApplParmFull apFull = getApFull(req); + String lang = getLang(req); + if (rp.getStatus()) { + Users utente = (Users)rp.getReturnObj(); + req.getSession(true).setAttribute("loginUser_id", new Long(utente.getId_users())); + req.getSession(true).setAttribute("utenteLogon", utente); + return recordOrder(req, res); + } + Users user = new Users(getApFull()); + fillObject(req, user); + req.setAttribute("bean", user); + rp.setStatus(false); + rp.setMsg("Impossibile salvare l'ordine: " + rp.getMsg()); + return rp; + } + + protected long getDeliveryIvaId(HttpServletRequest req) { + return getDeliveryIva(req).getId_iva(); + } + + protected double getDeliveryIvaAliquota(HttpServletRequest req) { + return (double)getDeliveryIva(req).getAliquota(); + } + + private Iva getDeliveryIva(HttpServletRequest req) { + if (this.deliveryIva == null) + if (getLoginUserId(req) > 0L) { + Users user = new Users(getApFull(req)); + user.findByPrimaryKey(getLoginUserId(req)); + if (user.getClifor().getId_clifor() > 0L) { + DestinazioneDiversa dd = user.getClifor().getCurrentDD(); + if (user.getClifor().isPrezzoWebEsente()) { + if (dd.getId_destinazioneDiversa() > 0L) { + if (user.getClifor().getNazione().getCodice().equals("IT") && + user.getClifor().getFlgAzienda() == 1L && + dd.getNazioneDD().getFlgCee() == 1L) { + this.deliveryIva = user.getClifor().getIvaArt58(); + } else if (user.getClifor().getNazione().getFlgCee() == 1L && + !user.getClifor().getNazione().getCodice().equals("IT") && + user.getClifor().getFlgAzienda() == 1L && + dd.getNazioneDD().getFlgCee() == 1L) { + this.deliveryIva = user.getClifor().getIvaArt41(); + } else { + this.deliveryIva = user.getClifor().getIvaArt8A(); + } + } else if (user.getClifor().getNazione().getFlgCee() == 1L) { + this.deliveryIva = user.getClifor().getIvaArt41(); + } else { + this.deliveryIva = user.getClifor().getIvaArt8A(); + } + } else if (user.getClifor().isIvaCeeOneStopShop()) { + boolean oss = false; + if (user.getClifor().getFlgAzienda() == 0L && + user.getClifor().getNazione().getFlgCee() == 1L && + !user.getClifor().getNazione().getCodice().equals("IT")) + if (dd.getId_destinazioneDiversa() > 0L) { + if (dd.getNazioneDD().getFlgCee() == 1L && + !dd.getNazioneDD().getCodice().equals("IT")) { + oss = true; + } else { + oss = false; + } + } else { + oss = true; + } + if (oss) { + Nazione nazioneOss; + if (dd.getId_destinazioneDiversa() > 0L) { + nazioneOss = dd.getNazioneDD(); + } else { + nazioneOss = user.getClifor().getNazione(); + } + if (nazioneOss.getId_iva() != 0L) { + this.deliveryIva = nazioneOss.getIva(); + } else { + handleDebug("ERRORE! CartSvlt.getDeliveryIva Aliquota iva OSS per " + nazioneOss.getDescrizione() + " non impostata!!!!", 1); + this.deliveryIva = new Iva(getApFull(req)); + this.deliveryIva.findByPrimaryKey(getParm(Cart.P_DELIVERY_IVA_ID).getNumeroLong()); + } + } else { + this.deliveryIva = new Iva(getApFull(req)); + this.deliveryIva.findByPrimaryKey(getParm(Cart.P_DELIVERY_IVA_ID).getNumeroLong()); + } + } else { + this.deliveryIva = new Iva(getApFull(req)); + this.deliveryIva.findByPrimaryKey(getParm(Cart.P_DELIVERY_IVA_ID).getNumeroLong()); + } + } else { + this.deliveryIva = new Iva(getApFull(req)); + this.deliveryIva.findByPrimaryKey(getParm(Cart.P_DELIVERY_IVA_ID).getNumeroLong()); + } + } else { + this.deliveryIva = new Iva(getApFull(req)); + this.deliveryIva.findByPrimaryKey(getParm(Cart.P_DELIVERY_IVA_ID).getNumeroLong()); + } + return (this.deliveryIva == null) ? new Iva(getApFull(req)) : this.deliveryIva; + } + + public void setDeliveryIva(Iva deliveryIva) { + this.deliveryIva = deliveryIva; + } + + protected void logOut(HttpServletRequest req, HttpServletResponse res) { + super.logOut(req, res); + setDeliveryIva(null); + } + + protected void resetDeliveryIva() { + setDeliveryIva(null); + } + + private ResParm inviaNotificaOrdineAdmin(HttpServletRequest req, HttpServletResponse res, Documento ordine) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(); + ordine.calcolaCostiWww(); + RemoteDevice bean = new RemoteDevice(apFull); + bean.findFirstAvailable(); + if (bean.getId_remoteDevice() > 0L) { + String messaggio = "Cliente: " + ordine.getClifor().getCognomeNome() + " tot ordine: " + + getNf().format(ordine.getTotaleDocumento()) + " Netto: " + getNf().format(ordine.getWwwNettoOrdine()) + " " + + getNf().format(ordine.getWwwNettoOrdinePerc()) + "%\n" + ordine.getDescrizioneRighe(); + String filejsonAuth = getParm("FIREBASE_JSON_AUTH_PRIVATE_KEY").getTesto(); + PushNotificationService pns = new PushNotificationService(filejsonAuth); + MsgJson notifica = new MsgJson("notification", "Ordine Web " + ordine.getProgOrdineWww(), messaggio); + MsgJson data = new MsgJson("notification", "Ordine Web", "Ordine Web " + + ordine.getProgOrdineWww() + messaggio); + List list = new ArrayList<>(); + list.add(bean.getFcmToken()); + pns.sendPushNotification(list, notifica, data, "smsgateway-f05ec"); + } + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/CatalogoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/CatalogoSvlt.java new file mode 100644 index 00000000..4a3c1d7d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/CatalogoSvlt.java @@ -0,0 +1,583 @@ +package it.acxent.cc.servlet; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.art.ArticoloComponente; +import it.acxent.art.ArticoloTaglia; +import it.acxent.art.ArticoloVariante; +import it.acxent.art.Lista; +import it.acxent.art.Marca; +import it.acxent.art.Tipo; +import it.acxent.art.TipoAccessorio; +import it.acxent.common.Users; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class CatalogoSvlt extends it.acxent.www.servlet.CatalogoSvlt { + boolean debug = false; + + private static final long serialVersionUID = -5684833919477899107L; + + protected int getPageRow(HttpServletRequest req) { + int pr = (int)getRequestLongParameter(req, "pageRow"); + if (pr == 0) + return 12; + return pr; + } + + protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + try { + req.setAttribute("listaPadri", getTipo(req).findPadri()); + if (this.debugTs) + System.out.println("fillComboAfterDetail listaPadri: ms: " + this.timer.getDurataMilliSec()); + Articolo bean = (Articolo)l_bean; + req.setAttribute("listaAccessori", bean.getAccessori()); + if (this.debugTs) + System.out.println("fillComboAfterDetail listaAccessori: ms: " + this.timer.getDurataMilliSec()); + req.setAttribute("listaTipiAccessorio", new TipoAccessorio(apFull).findAll()); + if (this.debugTs) + System.out.println("fillComboAfterDetail listaTipiAccessorio: ms: " + this.timer.getDurataMilliSec()); + req.setAttribute("listaArticoloComponenti", new ArticoloComponente(apFull).findByArticolo(bean.getId_articolo())); + if (this.debugTs) + System.out.println("fillComboAfterDetail listaArticoloComponenti: ms: " + this.timer.getDurataMilliSec()); + if (getAct(req).equals("zoom")) { + String imgNumber = getRequestParameter(req, "imgNumber"); + req.setAttribute("imgNumber", imgNumber); + } + if (req.getAttribute("msg").equals("Lettura effettuata") || req.getAttribute("msg").equals("Read Ok")) + req.setAttribute("msg", ""); + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected void showBean(HttpServletRequest req, HttpServletResponse res) { + if (this.debugTs) + this.timer.start(); + if (this.debugTs) + System.out.println("\n############### showBean start: ms: " + this.timer.getDurataMilliSec()); + ApplParmFull apFull = getApFull(req); + Articolo bean = new Articolo(apFull); + String url = (String)req.getAttribute("_requestUrl"); + boolean vaiAvanti = true; + try { + String redirectLink = "index.html"; + if (url.indexOf("Catalogo.abl?") > 0) { + vaiAvanti = false; + String codice = getRequestParameter(req, "id_articolo"); + bean.findByCodice(codice); + if (bean.getId_articolo() > 0L) { + String lang = "it"; + redirectLink = bean.getTipo().getDescrizioneCompletaPlus(lang) + "+" + bean.getTipo().getDescrizioneCompletaPlus(lang) + "+articolo-" + DBAdapter.convertStringToLink(bean.getDescrizioneNomeUrl()) + "--it.html"; + } + } + if (!vaiAvanti) { + res.setStatus(301); + res.setHeader("Location", redirectLink); + res.setHeader("Connection", "close"); + vaiAvanti = false; + } + } catch (Exception e) {} + if (this.debugTs) + System.out.println("showBean redirect: ms: " + this.timer.getDurataMilliSec()); + if (vaiAvanti) { + ArticoloCR CR = (ArticoloCR)req.getSession().getAttribute("CR"); + if (CR == null) + CR = new ArticoloCR(apFull); + CR.setSearchTxtWeb(getRequestParameter(req, "searchTxtWeb")); + CR.setLang(getLang(req)); + if (this.debug) + System.out.println("attcr1" + CR.getFlgDisponibile()); + req.setAttribute("CR", CR); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.findByPrimaryKey(l_id_articolo); + if (this.debugTs) + System.out.println("showBean findByPrimaryKey: ms: " + this.timer.getDurataMilliSec()); + if (bean.getId_articolo() > 0L) { + if (!isRequestFromCrawler(req).getStatus()) { + Users user = getLoginUser(req); + if (user == null || user.getId_userProfile() != 1L) + Articolo.addImpression(bean); + } + req.setAttribute("act", "articolo"); + } else { + sendMessage(req, bean.translate("Il prodotto che stai cercando non è più disponibile.", getLang(req))); + forceJspPage("/form-ricerca-prodotti.jsp", req); + } + if (this.debugTs) + System.out.println("showBean impression: ms: " + this.timer.getDurataMilliSec()); + super.showBean(req, res); + if (this.debugTs) { + this.timer.stop(); + System.out.println("--------------- stop ShowBean: ms: " + this.timer.getDurataMilliSec()); + } + } + } + + protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = (ArticoloCR)CRA; + req.setAttribute("listaPadri", CR.getTipo().findPadri()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + ApplParmFull apFull = getApFull(req); + return new Articolo(apFull); + } + + protected String getBeanPageName(HttpServletRequest req) { + return super.getBeanPageName(req); + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(apFull); + Articolo bean = new Articolo(apFull); + String l_lang = getLang(req); + if (getAct(req).equals("back")) { + CR = (ArticoloCR)req.getSession().getAttribute("CR"); + if (CR != null) { + if (CR.getPageNumber() > 0) + req.setAttribute("pageNumber", String.valueOf(CR.getPageNumber())); + } else { + CR = new ArticoloCR(apFull); + } + } else { + fillObject(req, CR); + } + boolean faiRicerca = true; + if (this.debug) + System.out.println("catalogo 1"); + if (CR.getSearchTxtWeb().length() > 3 && CR.getSearchTxtWeb().startsWith("**")) { + if (this.debug) + System.out.println("catalogo 2"); + CR.setCodice(CR.getSearchTxtWeb().substring(2)); + CR.setSearchTxtWeb(""); + bean.findByCodice(CR.getCodice()); + if (bean.getId_articolo() > 0L) { + if (this.debug) + System.out.println("catalogo 3"); + req.setAttribute("listaPadri", bean.getTipo().findPadri()); + req.setAttribute("act", "articolo"); + req.setAttribute("id_articolo", Long.valueOf(bean.getId_articolo())); + super.showBean(req, res); + faiRicerca = false; + } + } else { + if (this.debug) + System.out.println("catalogo 4"); + if (CR.getSearchTxtWeb().length() > 3 && CR.getSearchTxtWeb().startsWith("@")) { + if (this.debug) + System.out.println("catalogo 5"); + CR.setTagArticolo(CR.getSearchTxtWeb().substring(1)); + } + } + String url = (String)req.getAttribute("_requestUrl"); + if (this.debug) + System.out.println("catalogo 6"); + try { + boolean redirect = false; + if (url.indexOf("sendinblue") < 0) + if (url.indexOf("addItem") > 0) { + redirect = false; + } else if (url.indexOf("Catalogo.abl?") > 0) { + redirect = true; + } else if (url.indexOf("_") > 0) { + redirect = true; + } + if (redirect) { + if (this.debug) + System.out.println("catalogo 7"); + res.setStatus(301); + res.setHeader("Location", "index.html"); + res.setHeader("Connection", "close"); + faiRicerca = false; + } + } catch (Exception e) { + System.out.println("----------------------------- ERRORE url\n" + url); + } + if (this.debug) + System.out.println("catalogo 8"); + if (faiRicerca) { + if (this.debug) + System.out.println("catalogo 9"); + if (CR.getPageRow() > 96) { + CR.setPageRow(96); + } else if (CR.getPageRow() <= 0) { + CR.setPageRow(12); + } + if (CR.getPageNumber() <= 0) + CR.setPageNumber(1); + if (!CR.getTag().isEmpty()) { + if (this.debug) + System.out.println("catalogo 10"); + req.getSession().removeAttribute("tag"); + } + CR.setId_tipo(CR.getId_tipoSel()); + CR.setFlgNascondi(0L); + CR.setFlgEscludiWeb(0L); + if (!CR.getFiltri_id().isEmpty()) { + if (this.debug) + System.out.println("catalogo 11"); + ArticoloCR.setCCCRFromtFiltriId(CR); + } + bean.setId_iva(bean.getCodiceIvaVendStd()); + if (CR.getSearchTxtWeb().length() == 0) { + CR.setPrezzoMax(bean.getPrezzoPubblicoIvaArticoloMaxByCR(CR)); + CR.setPrezzoMin(bean.getPrezzoPubblicoIvaArticoloMinByCR(CR)); + } + if (this.debug) + System.out.println("catalogo 12"); + String tag = ""; + if (req.getSession().getAttribute("tag") != null) + tag = (String)req.getSession().getAttribute("tag"); + CR.setTag(tag); + if (this.debug) + System.out.println("catalogo 13"); + Vectumerator list = bean.findWebByArticoloCR(CR, getPageNumber(req), getPageRow(req)); + try { + if (this.debug) + System.out.println("catalogo 14"); + ArticoloCR CRS = CR.getClone(); + req.getSession().setAttribute("CR", CRS); + if (this.debug) + System.out.println("attcr2" + CR.getFlgDisponibile()); + req.setAttribute("CR", CRS); + } catch (Exception e) { + e.printStackTrace(); + } + if (this.debug) + System.out.println("catalogo 15"); + if (list.getTotNumberOfRecords() > 0) { + if (this.debug) + System.out.println("catalogo 16"); + req.setAttribute("list", list); + req.setAttribute("listaPadri", CR.getTipo().findPadri()); + if (CR.getSearchTxtWeb().isEmpty()) { + req.setAttribute("listaMarcheCR", new Marca(apFull).findMarchePresentiByTipoTag(CR.getId_tipo(), CR.getTag())); + } else { + req.setAttribute("listaMarcheCR", new Marca(apFull).findWebByArticoloCR(CR, 0, 0)); + long id_tipoSel = CR.getId_tipoSel(); + CR.setId_tipoSel(0L); + req.setAttribute("listaTipoCR", new Tipo(apFull).findWebByArticoloCR(CR, 0, 0)); + CR.setId_tipoSel(id_tipoSel); + } + forceJspPage("/articoloCR.jsp", req); + } else { + forceJspPage("/form-ricerca-prodotti.jsp", req); + } + if (this.debug) + System.out.println("catalogo -------------------"); + callJsp(req, res); + } + } + + public void _aggiornaQuantitaTaglie(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_articoloTaglia = getRequestLongParameter(req, "id_articoloTaglia"); + ArticoloTaglia at = new ArticoloTaglia(apFull); + at.findByPrimaryKey(l_id_articoloTaglia); + sendHtmlMsgResponse(req, res, String.valueOf((long)at.getQuantitaAt())); + } + + public void _searchAv(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(apFull); + fillObject(req, CR); + CR.setFlgNascondi(0L); + CR.setFlgEscludiWeb(0L); + req.setAttribute("list", new ArticoloVariante(apFull).findWebByArticoloCR(CR, getPageNumber(req), getPageRow(req))); + req.setAttribute("listaPadri", CR.getTipo().findPadri()); + if (this.debug) + System.out.println("attcr3" + CR.getFlgDisponibile()); + req.setAttribute("CR", CR); + forceJspPage("/articoloVarianteCR.jsp", req); + callJsp(req, res); + } + + protected void searchVarianti(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(apFull); + if (getAct(req).equals("back")) { + CR = (ArticoloCR)req.getSession().getAttribute("CR"); + if (CR != null) { + if (CR.getPageNumber() > 0) + req.setAttribute("pageNumber", String.valueOf(CR.getPageNumber())); + } else { + CR = new ArticoloCR(apFull); + } + } else { + fillObject(req, CR); + } + fillObject(req, CR); + CR.setId_tipo(CR.getId_tipoSel()); + CR.setFlgNascondi(0L); + CR.setFlgEscludiWeb(0L); + req.setAttribute("list", new ArticoloVariante(apFull).findWebByArticoloCR(CR, getPageNumber(req), getPageRow(req))); + req.setAttribute("listaPadri", CR.getTipo().findPadri()); + Lista lista = new Lista(getApFull(req)); + req.setAttribute("listaCaratteristica1", lista.findLista(1L, 0, 0)); + req.getSession().setAttribute("CR", CR); + req.setAttribute("listaFiltri", lista.findByTipo(CR.getId_tipo(), getLang(req))); + if (this.debug) + System.out.println("attcr4" + CR.getFlgDisponibile()); + req.setAttribute("CR", CR); + forceJspPage("/articoloVarianteCR.jsp", req); + callJsp(req, res); + } + + public void _level1(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(apFull); + fillObject(req, CR); + if (!CR.getTag().isEmpty()) + req.getSession().removeAttribute("tag"); + if (this.debug) + System.out.println("attcr5" + CR.getFlgDisponibile()); + req.setAttribute("CR", CR); + long l_id_tipoPadre = CR.getId_tipoSel(); + Tipo tipo = new Tipo(apFull); + tipo.findByPrimaryKey(l_id_tipoPadre); + req.setAttribute("currentTipo", tipo); + forceJspPage("/level1.jsp", req); + callJsp(req, res); + } + + private void updateCRFiltri(ArticoloCR CR, String currentFiltro, String currentValues) { + if (currentValues.endsWith(",")) + currentValues = currentValues.substring(0, currentValues.length() - 1); + if (!currentFiltro.isEmpty() && !currentValues.isEmpty()) + if (currentFiltro.toLowerCase().equals("m")) { + CR.setId_marche(currentValues); + } else if (currentFiltro.equals("pd")) { + CR.setPrezzoDa((double)Long.parseLong(currentValues)); + } else if (currentFiltro.toLowerCase().equals("pa")) { + CR.setPrezzoA((double)Long.parseLong(currentValues)); + } else if (currentFiltro.toLowerCase().equals("c")) { + CR.setFlgCondizioni(currentValues); + } else if (currentFiltro.toLowerCase().equals("d")) { + CR.setFlgDisponibilita(currentValues); + } + } + + public void _mdCodice(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String l_codice = getRequestParameter(req, "codice"); + Articolo bean = new Articolo(apFull); + bean.findByCodice(l_codice); + if (bean.getId_articolo() > 0L) { + req.setAttribute("id_articolo", Long.valueOf(bean.getId_articolo())); + showBean(req, res); + } else { + forceJspPage("/index.html", req); + callJsp(req, res); + } + } + + protected void searchOLD(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloCR CR = new ArticoloCR(apFull); + Articolo bean = new Articolo(apFull); + String l_lang = getLang(req); + if (getAct(req).equals("back")) { + CR = (ArticoloCR)req.getSession().getAttribute("CR"); + if (CR != null) { + if (CR.getPageNumber() > 0) + req.setAttribute("pageNumber", String.valueOf(CR.getPageNumber())); + } else { + CR = new ArticoloCR(apFull); + } + } else { + fillObject(req, CR); + } + boolean faiRicerca = true; + if (CR.getSearchTxtWeb().length() > 3 && CR.getSearchTxtWeb().startsWith("**")) { + CR.setCodice(CR.getSearchTxtWeb().substring(2)); + CR.setSearchTxtWeb(""); + bean.findByCodice(CR.getCodice()); + if (bean.getId_articolo() > 0L) { + req.setAttribute("listaPadri", bean.getTipo().findPadri()); + req.setAttribute("act", "articolo"); + req.setAttribute("id_articolo", Long.valueOf(bean.getId_articolo())); + super.showBean(req, res); + faiRicerca = false; + } + } else if (CR.getSearchTxtWeb().length() > 3 && CR.getSearchTxtWeb().startsWith("@")) { + CR.setTagArticolo(CR.getSearchTxtWeb().substring(1)); + } + String url = (String)req.getAttribute("_requestUrl"); + try { + boolean redirect = false; + if (url.indexOf("sendinblue") < 0) + if (url.indexOf("addItem") > 0) { + redirect = false; + } else if (url.indexOf("Catalogo.abl?") > 0) { + redirect = true; + } else if (url.indexOf("_") > 0) { + redirect = true; + } + if (redirect) { + res.setStatus(301); + res.setHeader("Location", "index.html"); + res.setHeader("Connection", "close"); + faiRicerca = false; + } + } catch (Exception e) { + System.out.println("----------------------------- ERRORE url\n" + url); + } + if (faiRicerca) { + if (CR.getPageRow() > 96) { + CR.setPageRow(96); + } else if (CR.getPageRow() <= 0) { + CR.setPageRow(12); + } + if (CR.getPageNumber() <= 0) + CR.setPageNumber(1); + if (!CR.getTag().isEmpty()) + req.getSession().removeAttribute("tag"); + CR.setId_tipo(CR.getId_tipoSel()); + CR.setFlgNascondi(0L); + CR.setFlgEscludiWeb(0L); + if (!CR.getFiltri_id().isEmpty()) { + String filtri = "M,PD,PA,C,D,"; + StringTokenizer st = new StringTokenizer(CR.getFiltri_id(), ","); + String currentFiltro = ""; + StringBuilder currentValues = new StringBuilder(); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + if (filtri.contains(token + ",")) { + updateCRFiltri(CR, currentFiltro, currentValues.toString()); + currentFiltro = token; + currentValues = new StringBuilder(); + continue; + } + currentValues.append(token); + currentValues.append(","); + } + updateCRFiltri(CR, currentFiltro, currentValues.toString()); + } + bean.setId_iva(bean.getCodiceIvaVendStd()); + if (CR.getSearchTxtWeb().length() == 0) { + CR.setPrezzoMax(bean.getPrezzoPubblicoIvaArticoloMaxByCR(CR)); + CR.setPrezzoMin(bean.getPrezzoPubblicoIvaArticoloMinByCR(CR)); + } + String tag = ""; + if (req.getSession().getAttribute("tag") != null) + tag = (String)req.getSession().getAttribute("tag"); + CR.setTag(tag); + Vectumerator list = bean.findWebByArticoloCR(CR, getPageNumber(req), getPageRow(req)); + try { + ArticoloCR CRS = CR.getClone(); + req.getSession().setAttribute("CR", CRS); + if (this.debug) + System.out.println("attcr6" + CR.getFlgDisponibile()); + req.setAttribute("CR", CRS); + } catch (Exception e) { + e.printStackTrace(); + } + if (list.getTotNumberOfRecords() > 0) { + req.setAttribute("list", list); + req.setAttribute("listaPadri", CR.getTipo().findPadri()); + if (CR.getSearchTxtWeb().isEmpty()) { + req.setAttribute("listaMarcheCR", new Marca(apFull).findMarchePresentiByTipoTag(CR.getId_tipo(), CR.getTag())); + } else { + req.setAttribute("listaMarcheCR", new Marca(apFull).findWebByArticoloCR(CR, 0, 0)); + long id_tipoSel = CR.getId_tipoSel(); + CR.setId_tipoSel(0L); + req.setAttribute("listaTipoCR", new Tipo(apFull).findWebByArticoloCR(CR, 0, 0)); + CR.setId_tipoSel(id_tipoSel); + } + forceJspPage("/articoloCR.jsp", req); + } else { + forceJspPage("/form-ricerca-prodotti.jsp", req); + } + callJsp(req, res); + } + } + + public void _fetchInclude(HttpServletRequest req, HttpServletResponse res) { + String items = getRequestParameter(req, "items").trim(); + if (items.isEmpty()) { + req.setAttribute("lastItems", DBAdapter.AB_EMPTY_VECTUMERATOR); + } else { + String id_articolo = getRequestParameter(req, "id_articolo"); + if (!id_articolo.equals("undefined")) + items = items.replace(id_articolo, ""); + items = items.replaceAll(",,", ""); + if (items.isEmpty() || items.equals(",")) { + req.setAttribute("lastItems", DBAdapter.AB_EMPTY_VECTUMERATOR); + } else { + ArticoloCR CR = new ArticoloCR(); + CR.setLastItems(items); + req.setAttribute("lastItems", new Articolo(getApFull(req)).findWebByArticoloCR(CR, 0, 0)); + } + } + req.setAttribute("nf", getNf()); + req.setAttribute("nf0", getNf0()); + forceJspPage("/_inc_lastItems.jsp", req); + callJsp(req, res); + } + + protected void callJsp(HttpServletRequest req, HttpServletResponse res) { + super.callJsp(req, res); + } + + public void _infoProdotto(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + Articolo bean = new Articolo(apFull); + bean.findByPrimaryKey(l_id_articolo); + if (bean.getId_articolo() > 0L) { + ArticoloCR CR = (ArticoloCR)req.getSession().getAttribute("CR"); + if (CR == null) + CR = new ArticoloCR(apFull); + CR.setLang(getLang(req)); + if (this.debug) + System.out.println("attcr7" + CR.getFlgDisponibile()); + req.setAttribute("CR", CR); + req.setAttribute("bean", bean); + forceJspPage("/form-info-prodotto.jsp", req); + callJsp(req, res); + } else { + forceJspPage("/form-ricerca-prodotti.jsp", req); + callJsp(req, res); + } + } + + protected void fillObject(HttpServletRequest req, Object CRo) { + ArticoloCR CR = (ArticoloCR)CRo; + super.fillObject(req, CR); + String q = getRequestParameter(req, "q"); + if (!q.isEmpty()) + CR.setSearchTxtWeb(q); + } + + public void _loadLastItems(HttpServletRequest req, HttpServletResponse res) { + String items = getRequestParameter(req, "items").trim(); + if (items.isEmpty()) { + req.setAttribute("lastItems", DBAdapter.AB_EMPTY_VECTUMERATOR); + } else { + String id_articolo = getRequestParameter(req, "id_articolo"); + if (!id_articolo.equals("undefined")) + items = items.replace(id_articolo, ""); + items = items.replaceAll(",,", ""); + if (items.isEmpty() || items.equals(",")) { + req.setAttribute("lastItems", DBAdapter.AB_EMPTY_VECTUMERATOR); + } else { + ArticoloCR CR = new ArticoloCR(); + CR.setLastItems(items); + req.setAttribute("lastItems", new Articolo(getApFull(req)).findWebByArticoloCR(CR, 0, 0)); + } + } + req.setAttribute("nf", getNf()); + req.setAttribute("nf0", getNf0()); + forceJspPage("/_inc_lastItems.jsp", req); + callJsp(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/IndexWwwSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/IndexWwwSvlt.java new file mode 100644 index 00000000..2bb30c10 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/IndexWwwSvlt.java @@ -0,0 +1,42 @@ +package it.acxent.cc.servlet; + +import it.acxent.cc.Attivita; +import it.acxent.jsp.Ab; +import it.acxent.servlet.AcServlet; +import java.util.Locale; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class IndexWwwSvlt extends AcServlet { + private static final long serialVersionUID = -6624665938374872005L; + + private static final String HTML = ".html"; + + private static final String INDEX = "index-"; + + private static final String LOCATION = "Location"; + + private static final String _INC_MENU_JSP = "_inc_menu.jsp"; + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + try { + Attivita attivita = Attivita.getDefaultInstance(getApFull(req)); + String currentLang = (String)req.getSession().getAttribute("LANG".toLowerCase()); + if (currentLang == null || currentLang.isEmpty()) + currentLang = Ab.getBrowserLang(req, Locale.ENGLISH.getLanguage()); + if (attivita.getLangDisponibili().indexOf(currentLang) < 0) + currentLang = attivita.getLangSeNonDisponibile(); + req.getSession().setAttribute("LANG".toLowerCase(), currentLang); + String url = req.getRequestURL().toString(); + System.out.println("INDEX.HTML Incomming URL = " + url + " lang_:" + currentLang); + res.setStatus(301); + res.setHeader("Location", attivita.getWwwAddress() + "index-" + attivita.getWwwAddress() + ".html"); + } catch (Exception e) { + handleDebug(e); + } + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/LogonSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/LogonSvlt.java new file mode 100644 index 00000000..3908b79b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/LogonSvlt.java @@ -0,0 +1,64 @@ +package it.acxent.cc.servlet; + +import it.acxent.common.Users; +import it.acxent.db.ApplParmFull; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class LogonSvlt extends it.acxent.servlet.LogonSvlt { + protected boolean checkLoginProfile(HttpServletRequest req) { + try { + if (getLoginUser(req) == null) { + forceJspPage(getLoginPage(req, null), req); + return true; + } + if (getLoginUser(req).getFlgValido().equals("N")) { + forceJspPage(getLoginPage(req, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return false; + } + if (getLoginUser(req).getId_userProfile() == getParm("USER_PROFILE_ID_WWW").getNumeroLong()) { + forceJspPage(getLoginPage(req, null), req); + return true; + } + forceJspPage(getLoginPage(req, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return false; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + + protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) { + return getRequestParameter(req, "thePage"); + } + + protected Users getUser(HttpServletRequest req) { + ApplParmFull apFull = getApFull(); + return new it.acxent.anag.Users(apFull); + } + + protected void loginOK(HttpServletRequest req, HttpServletResponse res) throws Exception { + ApplParmFull apFull = getApFull(req); + req.setAttribute("msg", ""); + req.setAttribute("cmd", "updateCart"); + setJspPage("Cart.abl", req); + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } + + protected boolean useControlCodeAccess() { + return false; + } + + protected void loginKO(HttpServletRequest req, HttpServletResponse res) { + super.loginKO(req, res); + forceMessage(req, "Login errato o inesistente!"); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/OrdineSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/OrdineSvlt.java new file mode 100644 index 00000000..ea2afa68 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/OrdineSvlt.java @@ -0,0 +1,274 @@ +package it.acxent.cc.servlet; + +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.Users; +import it.acxent.cc.Attivita; +import it.acxent.common.Access; +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.AbMessages; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class OrdineSvlt extends it.acxent.www.servlet.OrdineSvlt { + private static final long serialVersionUID = 8880000554136161006L; + + protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) { + Documento bean = (Documento)l_bean; + req.setAttribute("listaTipoPagamento", new TipoPagamento( + getApFull(req)).findPagamentiWww(!bean.getClifor().getId_nazione().equals("I"), + (bean.getFlgDeliveryType() == 2L))); + int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso)); + if (req.getAttribute("msg").equals("Lettura effettuata")) + req.setAttribute("msg", ""); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Documento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new DocumentoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected void payBonifico(HttpServletRequest req, HttpServletResponse res) { + try { + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id_documento); + bean.setDataPagamento(DBAdapter.getToday()); + ResParm rp = bean.save(); + String theMsg = ""; + if (rp.getStatus()); + } catch (Exception e) { + e.printStackTrace(); + forceMessage(req, e.getMessage()); + } + showBean(req, res); + } + + protected void payCc(HttpServletRequest req, HttpServletResponse res) { + try { + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id_documento); + long l_flgTipoPagamento = getRequestLongParameter(req, "flgTipoPagamento"); + ResParm rp = bean.save(); + String theMsg = ""; + req.setAttribute("bean", bean); + if (rp.getStatus()) { + forceJspPageRelative("DocumentoCc.jsp", req); + int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso)); + callJsp(req, res); + } + } catch (Exception e) { + e.printStackTrace(); + forceMessage(req, e.getMessage()); + showBean(req, res); + } + } + + protected void refreshPayment(HttpServletRequest req, HttpServletResponse res) { + try { + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id_documento); + long l_id_tipoPagamento = getRequestLongParameter(req, "id_tipoPagamento"); + bean.setId_tipoPagamento(l_id_tipoPagamento); + ResParm rp = bean.save(); + String theMsg = ""; + req.setAttribute("bean", bean); + forceJspPageRelative("Documento.jsp", req); + callJsp(req, res); + } catch (Exception e) { + e.printStackTrace(); + forceMessage(req, e.getMessage()); + showBean(req, res); + } + } + + protected void cancelOrder(HttpServletRequest req, HttpServletResponse res) { + try { + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id_documento); + bean.setFlgStatoOrdineWww(99L); + bean.setFlgStatoPrenotazione(100L); + ResParm rp = bean.save(); + String theMsg = ""; + req.setAttribute("bean", bean); + sendMessage(req, "Documento annullato"); + showBean(req, res); + } catch (Exception e) { + e.printStackTrace(); + forceMessage(req, e.getMessage()); + showBean(req, res); + } + } + + protected void sendMailOrder(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(apFull); + try { + bean.findByPrimaryKey(l_id); + Attivita attivita = Attivita.getDefaultInstance(apFull); + Users utente = (Users)getLoginUser(req); + rp = attivita.sendOrderMailMessageCC(bean, utente, utente.getLang(), true, true, false, false, req); + sendMessage(req, rp.getMsg()); + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + } + showBean(req, res); + } + + protected String getCRAttribute(HttpServletRequest req) { + return "CROrd"; + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + DocumentoCR CR = new DocumentoCR(getApFull(req)); + fillObject(req, CR); + if (getLoginUserId(req) != null && getLoginUserId(req) > 0L) { + Users user = (Users)getLoginUser(req); + System.out.println("ordinesvlt beforeSearch: id_clifor " + user.getId_clifor()); + if (user.getId_clifor() == 0L) { + req.setAttribute("id_clifor", "-1"); + } else { + req.setAttribute("id_clifor", String.valueOf(user.getId_clifor())); + } + req.setAttribute("id_tipoDocumento", Long.valueOf(getParm("ID_DOC_ORDINE_WWW").getNumeroLong())); + if (CR.getFlgStatoOrdineWww() < 0L) + req.setAttribute("flgStatoOrdineWww", "0"); + req.setAttribute("id_users", "0"); + } else { + sendMessage(req, " "); + } + return new ResParm(true); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + String idCryptParm = "idcrypt"; + String l_id_ordineCript = (String)req.getSession().getAttribute(idCryptParm); + if (l_id_ordineCript != null && !l_id_ordineCript.isEmpty()) { + _vediOrdineCrypt(req, res); + } else { + String cmd = getCmd(req); + if (cmd.equals("payBon")) { + payBonifico(req, res); + } else if (cmd.equals("payCc")) { + payCc(req, res); + } else if (cmd.equals("refreshPayment")) { + refreshPayment(req, res); + } else if (cmd.equals("cancelOrder")) { + cancelOrder(req, res); + } else if (cmd.equals("sendMailOrder")) { + sendMailOrder(req, res); + } else { + forceJspPageRelative("documentoCR.jsp", req); + search(req, res); + } + } + } + + protected void showBean(HttpServletRequest req, HttpServletResponse res) { + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id_documento); + if (bean.getDBState() == 1 && bean.getId_tipoPagamento() == 4L && bean.getFlgProcediPagamento() == 1L && + bean.getDescTransaction().isEmpty()) + bean.agiornaNuovoId_documentoXpay(); + super.showBean(req, res); + } + + public void _impostaMP(HttpServletRequest req, HttpServletResponse res) { + Users user = (Users)getLoginUser(req); + ApplParmFull apFull = getApFull(req); + Attivita attivita = Attivita.getDefaultInstance(apFull); + if (user != null && user.getDBState() == 1) { + Documento bean = new Documento(apFull); + long l_id_documento = getRequestLongParameter(req, "id_documento"); + long l_id_tipoPagamento = getRequestLongParameter(req, "id_tipoPagamento"); + bean.findByPrimaryKey(l_id_documento); + if (bean.getId_documento() > 0L) { + bean.setId_tipoPagamento(l_id_tipoPagamento); + bean.setSpeseTrasporto(bean.getDeliveryCostOrdine(user.getClifor())); + ResParm rp = bean.save(); + if (rp.getStatus()) + attivita.sendOrderMailMessageCC(bean, user, user.getLang(), true, true, true, false, req); + } + showBean(req, res); + } else { + showBean(req, res); + } + } + + public void _aggiornaRichiediFattura(HttpServletRequest req, HttpServletResponse res) { + Users user = (Users)getLoginUser(req); + ApplParmFull apFull = getApFull(req); + if (user != null && user.getDBState() == 1) { + Documento bean = new Documento(apFull); + long l_id_documento = getRequestLongParameter(req, "id_documento"); + long l_flgWwwRichiedeFattura = getRequestLongParameter(req, "flgWwwRichiedeFattura"); + bean.findByPrimaryKey(l_id_documento); + if (bean.getId_documento() > 0L) { + bean.setFlgWwwRichiedeFattura(l_flgWwwRichiedeFattura); + bean.superSave(); + } + } + } + + protected ResParm beforeSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + return super.beforeSave(beanA, req, res); + } + + protected String getBeanPageName(HttpServletRequest req) { + String temp = getBeanName(req); + Users user = (Users)getLoginUser(req); + ApplParmFull apFull = getApFull(req); + Access access = new Access(getApFull(req)); + access.findByPrimaryKey(Access.convertFieldToTableName(temp)); + if (getRequestParameter(req, "sw").equals("1")) { + if (!access.getSuffissoE().isEmpty()) + return temp + temp + "E"; + return temp + "E"; + } + return temp; + } + + public void _aggiornaRichiediFatturaMd(HttpServletRequest req, HttpServletResponse res) { + Users user = (Users)getLoginUser(req); + ApplParmFull apFull = getApFull(req); + if (user != null && user.getDBState() == 1) { + Documento bean = new Documento(apFull); + long l_id_documento = getRequestLongParameter(req, "id_documento"); + long l_flgWwwRichiedeFattura = getRequestLongParameter(req, "flgWwwRichiedeFattura"); + bean.findByPrimaryKey(l_id_documento); + if (bean.getId_documento() > 0L) { + bean.setFlgWwwRichiedeFattura(l_flgWwwRichiedeFattura); + bean.superSave(); + } + showBean(req, res); + } + } + + protected String getBEANAttribute(HttpServletRequest req) { + return super.getBEANAttribute(req); + } + + protected boolean isCostoSpedizioneFull() { + return getParm("CC_COSTO_SPED_FULL").isTrue(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/PayPalDoPaymentSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/PayPalDoPaymentSvlt.java new file mode 100644 index 00000000..cc1ffbdf --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/PayPalDoPaymentSvlt.java @@ -0,0 +1,61 @@ +package it.acxent.cc.servlet; + +import it.acxent.anag.Users; +import it.acxent.bank.paypal.PayPalResp; +import it.acxent.cart.Cart; +import it.acxent.cc.Attivita; +import it.acxent.contab.Documento; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.gtm.GoogleDataLayer; +import it.acxent.gtm.GoogleDataLayerBuilder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class PayPalDoPaymentSvlt extends PayPalSvlt { + protected static ApplParmFull ap2; + + protected void recordOrder(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) { + ApplParmFull apFull = getApFull(req); + Users utente = (Users)getLoginUser(req); + if (ppResponse != null && ppResponse.isPaymentDone()) { + long l_id_ordine = ppResponse.getId_ordine(); + Documento bean = new Documento(apFull); + System.out.println("paypaldopayment recordOrder: " + l_id_ordine); + bean.findByProgOrdineWww(l_id_ordine); + bean.setDataPagamento(DBAdapter.getToday()); + bean.setDataTransaction(DBAdapter.getToday()); + bean.setDescTransaction(ppResponse.getTRANSACTIONID()); + bean.setFlgPagata(1L); + ResParm rp = bean.save(); + if (rp.getStatus()) + rp = bean.sendOrderMailMessageTuttofoto(utente, true, true, false, false); + Attivita attivita = Attivita.getDefaultInstance(apFull); + if (attivita.isTagManagerAttivo()) { + GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.purchaseOrder("eec.purchase", bean)); + req.setAttribute("_gdl", gdl); + } + } + } + + protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) { + long l_id_ordine = 0L; + if (ppResponse != null) + l_id_ordine = ppResponse.getId_ordine(); + Documento bean = new Documento(getApFull()); + bean.findByProgOrdineWww(l_id_ordine); + req.setAttribute("bean", bean); + } + + protected String getCheckOutMailMessage() { + return getParm(Cart.P_CHECKOUTMSG).getTesto(); + } + + protected ApplParmFull getAp2() { + if (ap2 == null) + ap2 = new ApplParmFull(new ApplParm(getApFull().getParm("DBDRIVER2").getNumeroInt(), getApFull().getParm("DBNAME2").getTesto(), getApFull().getParm("USER2").getTesto(), getApFull().getParm("PASSWORD2").getTesto())); + return ap2; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/PayPalResponseSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/PayPalResponseSvlt.java new file mode 100644 index 00000000..202d8756 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/PayPalResponseSvlt.java @@ -0,0 +1,35 @@ +package it.acxent.cc.servlet; + +import it.acxent.bank.paypal.PayPalResp; +import it.acxent.bank.servlet.paypal.GetPayPalResponseSvlt; +import it.acxent.cart.Cart; +import it.acxent.contab.Documento; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class PayPalResponseSvlt extends GetPayPalResponseSvlt { + private static final long serialVersionUID = -7370187024494888710L; + + protected static ApplParmFull ap2; + + protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) { + long l_id_ordine = 0L; + if (ppResponse != null) + l_id_ordine = ppResponse.getId_ordine(); + Documento bean = new Documento(getApFull()); + bean.findByProgOrdineWww(l_id_ordine); + req.setAttribute("bean", bean); + } + + protected String getCheckOutMailMessage() { + return getParm(Cart.P_CHECKOUTMSG).getTesto(); + } + + protected ApplParmFull getAp2() { + if (ap2 == null) + ap2 = new ApplParmFull(new ApplParm(getApFull().getParm("DBDRIVER2").getNumeroInt(), getApFull().getParm("DBNAME2").getTesto(), getApFull().getParm("USER2").getTesto(), getApFull().getParm("PASSWORD2").getTesto())); + return ap2; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/PayPalSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/PayPalSvlt.java new file mode 100644 index 00000000..aedfc18c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/PayPalSvlt.java @@ -0,0 +1,65 @@ +package it.acxent.cc.servlet; + +import it.acxent.anag.Users; +import it.acxent.bank.paypal.PayPalResp; +import it.acxent.cart.Cart; +import it.acxent.contab.Documento; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class PayPalSvlt extends it.acxent.bank.servlet.paypal.PayPalSvlt { + private static final long serialVersionUID = -7977873008193998783L; + + protected static ApplParmFull ap2; + + protected String getCheckOutMailMessage() { + return getParm(Cart.P_CHECKOUTMSG).getTesto(); + } + + protected ApplParmFull getAp2() { + if (ap2 == null) + ap2 = new ApplParmFull(new ApplParm(getApFull().getParm("DBDRIVER2").getNumeroInt(), getApFull().getParm("DBNAME2").getTesto(), getApFull().getParm("USER2").getTesto(), getApFull().getParm("PASSWORD2").getTesto())); + return ap2; + } + + protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) { + long l_id_ordine = 0L; + if (ppResponse != null) + l_id_ordine = ppResponse.getId_ordine(); + Documento bean = new Documento(getApFull()); + bean.findByProgOrdineWww(l_id_ordine); + req.setAttribute("bean", bean); + } + + protected void recordOrder(HttpServletRequest req, HttpServletResponse res, PayPalResp ppResponse) { + ApplParmFull apFull = getApFull(req); + Users utente = (Users)getLoginUser(req); + if (ppResponse != null && ppResponse.isPaymentDone()) { + long l_id_ordine = ppResponse.getId_ordine(); + Documento bean = new Documento(apFull); + System.out.println("paypalsvlt recordOrder: " + l_id_ordine); + bean.findByProgOrdineWww(l_id_ordine); + bean.setDataPagamento(DBAdapter.getToday()); + bean.setDataTransaction(DBAdapter.getToday()); + bean.setDescTransaction(ppResponse.getTRANSACTIONID()); + bean.setFlgPagata(1L); + ResParm rp = bean.save(); + if (rp.getStatus()) { + if (bean.getFlgWwwRichiedeFattura() == 1L) { + long l = 22L; + } else { + long l = 23L; + } + rp = bean.sendOrderMailMessageTuttofoto(utente, true, true, false, false); + } + } + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + super.processRequest(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/PaypalCheckoutSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/PaypalCheckoutSvlt.java new file mode 100644 index 00000000..a81430d1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/PaypalCheckoutSvlt.java @@ -0,0 +1,77 @@ +package it.acxent.cc.servlet; + +import it.acxent.anag.Users; +import it.acxent.bank.paypalcheckout.PayPalReq; +import it.acxent.cc.Attivita; +import it.acxent.contab.Documento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.gtm.GoogleDataLayer; +import it.acxent.gtm.GoogleDataLayerBuilder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.json.JSONObject; + +public class PaypalCheckoutSvlt extends it.acxent.bank.servlet.paypalcheckout.PaypalCheckoutSvlt { + private static final long serialVersionUID = 5775575153032080843L; + + protected void recordOrder(HttpServletRequest req, HttpServletResponse res, JSONObject jso) { + ApplParmFull apFull = getApFull(req); + String orderId = jso.getString("id"); + String status = jso.getString("status"); + System.out.println("paypalsvltcheckout recordOrder prog www: status" + status + " orderid:" + orderId); + if (status.equals("COMPLETED")) { + Documento bean = new Documento(apFull); + bean.findByDescTransaction(orderId); + System.out.println("paypalsvltcheckout recordOrder prog www: " + bean.getProgOrdineWww() + " TROVATO E APPROVATO"); + bean.setDataPagamento(DBAdapter.getToday()); + bean.setDataTransaction(DBAdapter.getToday()); + bean.setDescTransaction(orderId); + bean.setFlgPagata(1L); + ResParm rp = bean.save(); + if (rp.getStatus()) { + if (bean.getFlgWwwRichiedeFattura() == 1L) { + long l = 22L; + } else { + long l = 23L; + } + Attivita attivita1 = Attivita.getDefaultInstance(apFull); + Users utente = (Users)getLoginUser(req); + rp = attivita1.sendOrderMailMessageCC(bean, utente, utente.getLang(), true, true, false, false, req); + } + Attivita attivita = Attivita.getDefaultInstance(apFull); + if (attivita.isTagManagerAttivo()) { + GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.purchaseOrder("eec.purchase", bean)); + req.setAttribute("_gdl", gdl); + } + } + } + + protected PayPalReq getPayPalReq(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + PayPalReq pReq = new PayPalReq(); + String l_id_docCrypt = getRequestParameter(req, "id"); + long l_id = 0L; + try { + l_id = Long.parseLong(DBAdapter.deCrypt(l_id_docCrypt)); + } catch (Exception e) {} + if (l_id > 0L) { + Documento doc = new Documento(apFull); + doc.findByPrimaryKey(l_id); + pReq.setId_ordine(doc.getId_documento()); + pReq.setAmt(doc.getTotaleDocumento()); + } + return pReq; + } + + protected void updatePaypalOrderId(HttpServletRequest req, PayPalReq pReq) { + ApplParmFull apFull = getApFull(req); + Documento doc = new Documento(apFull); + doc.findByPrimaryKey(pReq.getId_ordine()); + if (doc.getId_documento() > 0L) { + doc.setDescTransaction(pReq.getPaypalOrderId()); + doc.superSave(); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/ResoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/ResoSvlt.java new file mode 100644 index 00000000..e48f9b10 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/ResoSvlt.java @@ -0,0 +1,78 @@ +package it.acxent.cc.servlet; + +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.AbMessages; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ResoSvlt extends it.acxent.www.servlet.ResoSvlt { + private static final long serialVersionUID = -1875981812979270687L; + + protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) { + Documento bean = (Documento)l_bean; + int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso)); + if (req.getAttribute("msg").equals("Lettura effettuata")) + req.setAttribute("msg", ""); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Documento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new DocumentoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected void sendMailReso(HttpServletRequest req, HttpServletResponse res) { + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_ordine"); + bean = new Documento(getApFull(req)); + try { + bean.findByPrimaryKey(l_id); + rp = bean.sendResoMailMessage(); + sendMessage(req, rp.getMsg()); + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + } + showBean(req, res); + } + + protected String getCRAttribute(HttpServletRequest req) { + return "CRRes"; + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + DocumentoCR CR = new DocumentoCR(getApFull(req)); + if (getLoginUserId(req) != null) + req.setAttribute("id_users", String.valueOf(getLoginUserId(req).longValue())); + return new ResParm(true); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + String cmd = getCmd(req); + if (cmd.equals("sendMailReso")) { + sendMailReso(req, res); + } else { + search(req, res); + } + } + + protected String getBeanPageName(HttpServletRequest req) { + return "reso"; + } + + protected ResParm afterSave(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) { + Documento bean = (Documento)l_bean; + return bean.sendResoMailMessage(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/RicevutaSellaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/RicevutaSellaSvlt.java new file mode 100644 index 00000000..a85a9cd7 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/RicevutaSellaSvlt.java @@ -0,0 +1,76 @@ +package it.acxent.cc.servlet; + +import it.acxent.anag.Users; +import it.acxent.bank.sella.SellaResp; +import it.acxent.bank.servlet.sella.GetSellaResponseSvlt; +import it.acxent.cart.Cart; +import it.acxent.cc.Attivita; +import it.acxent.contab.Documento; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.gtm.GoogleDataLayer; +import it.acxent.gtm.GoogleDataLayerBuilder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class RicevutaSellaSvlt extends GetSellaResponseSvlt { + private static final long serialVersionUID = -5795730239132540019L; + + protected static ApplParmFull ap2; + + protected void recordOrder(HttpServletRequest req, HttpServletResponse res, SellaResp sellaRes) { + boolean debug = false; + ApplParmFull apFull = getApFull(req); + Users utente = (Users)getLoginUser(req); + if (sellaRes != null && sellaRes.getMyerrorcode().equals("0")) { + long l_id_ordine = sellaRes.getId_ordine(); + if (debug) + l_id_ordine = 48081L; + Documento bean = new Documento(apFull); + System.out.println("sella recordOrder: " + l_id_ordine); + bean.findByProgOrdineWww(l_id_ordine); + bean.setDataPagamento(DBAdapter.getToday()); + bean.setDataTransaction(DBAdapter.getToday()); + bean.setDescTransaction(sellaRes.getMyauthcode()); + bean.setFlgPagata(1L); + ResParm rp = bean.save(); + if (rp.getStatus()) + rp = bean.sendOrderMailMessageTuttofoto(utente, true, true, false, false); + Attivita attivita = Attivita.getDefaultInstance(apFull); + if (attivita.isTagManagerAttivo()) { + GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.purchaseOrder("eec.purchase", bean)); + req.setAttribute("_gdl", gdl); + } + } + } + + protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, SellaResp sellaRes) { + boolean debug = false; + long l_id_ordine = 0L; + if (sellaRes != null) + l_id_ordine = sellaRes.getId_ordine(); + if (debug) + l_id_ordine = 48081L; + Documento bean = new Documento(getApFull()); + bean.findByProgOrdineWww(l_id_ordine); + if (debug) { + sellaRes.setMyerrorcode("0"); + recordOrder(req, res, sellaRes); + } + req.setAttribute("bean", bean); + } + + protected String getCheckOutMailMessage() { + return getParm(Cart.P_CHECKOUTMSG).getTesto(); + } + + protected ApplParmFull getAp2() { + if (ap2 == null) + ap2 = new ApplParmFull(new ApplParm(getApFull().getParm("DBDRIVER2").getNumeroInt(), getApFull().getParm("DBNAME2").getTesto(), getApFull().getParm("USER2").getTesto(), getApFull().getParm("PASSWORD2").getTesto())); + return ap2; + } + + public void _test(HttpServletRequest req, HttpServletResponse res) {} +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/ShowOrdineSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/ShowOrdineSvlt.java new file mode 100644 index 00000000..73488583 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/ShowOrdineSvlt.java @@ -0,0 +1,40 @@ +package it.acxent.cc.servlet; + +import it.acxent.anag.Users; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ShowOrdineSvlt extends it.acxent.www.servlet.ShowOrdineSvlt { + private static final long serialVersionUID = 3253536598483259418L; + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + super.otherCommands(req, res); + } + + public void _vediOrdineCrypt(HttpServletRequest req, HttpServletResponse res) { + String l_id_userCript = getRequestParameter(req, "uc"); + if (l_id_userCript.isEmpty()) { + super._vediOrdineCrypt(req, res); + } else { + String l_login = DBAdapter.deCrypt(l_id_userCript); + if (!l_login.isEmpty()) { + ApplParmFull apFull = getApFull(req); + Users user = new Users(apFull); + user.findByLogin(l_login); + if (user.isNoReg()) { + String ip = req.getRemoteHost(); + user.setCurrentIp(ip); + req.getSession().setAttribute("utenteLogon", user); + req.getSession().setAttribute("loginUser_id", new Long(user.getId_users())); + super._vediOrdineCrypt(req, res); + } else { + search(req, res); + } + } else { + search(req, res); + } + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/StripeResponseSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/StripeResponseSvlt.java new file mode 100644 index 00000000..a8de45c3 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/StripeResponseSvlt.java @@ -0,0 +1,77 @@ +package it.acxent.cc.servlet; + +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.Users; +import it.acxent.bank.servlet.stripe._StripeResponseSvlt; +import it.acxent.bank.stripe.StripeResp; +import it.acxent.cc.Attivita; +import it.acxent.contab.Documento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.gtm.GoogleDataLayer; +import it.acxent.gtm.GoogleDataLayerBuilder; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class StripeResponseSvlt extends _StripeResponseSvlt { + private static final long serialVersionUID = -4056911711739700875L; + + protected void recordOrder(HttpServletRequest req, HttpServletResponse res, StripeResp stripeRes) { + boolean debug = false; + ApplParmFull apFull = getApFull(req); + String status = stripeRes.getRedirect_status(); + String clientSecret = stripeRes.getPayment_intent_client_secret(); + if (debug) + System.out.println("StripeSvlt recordOrder prog www: status" + status + " clientSecret:" + clientSecret); + if (status.equals("succeeded")) { + Documento bean = new Documento(apFull); + bean.findByDescTransactionStripe(stripeRes.getPayment_intent_client_secret()); + if (debug) + System.out.println("StripeSvlt recordOrder prog www: " + bean.getProgOrdineWww() + " TROVATO E APPROVATO"); + bean.setDataPagamento(DBAdapter.getToday()); + bean.setDataTransaction(DBAdapter.getToday()); + bean.setDescTransaction(clientSecret); + bean.setFlgPagata(1L); + ResParm rp = bean.save(); + if (rp.getStatus()) { + if (bean.getFlgWwwRichiedeFattura() == 1L) { + long l = 22L; + } else { + long l = 23L; + } + Attivita attivita1 = Attivita.getDefaultInstance(apFull); + Users utente = (Users)getLoginUser(req); + rp = attivita1.sendOrderMailMessageCC(bean, utente, utente.getLang(), true, true, false, false, req); + } + Attivita attivita = Attivita.getDefaultInstance(apFull); + if (attivita.isTagManagerAttivo()) { + GoogleDataLayer gdl = new GoogleDataLayer(GoogleDataLayerBuilder.purchaseOrder("eec.purchase", bean)); + req.setAttribute("_gdl", gdl); + } + } + } + + protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, StripeResp stripeRes) { + boolean debug = false; + ApplParmFull apFull = getApFull(req); + String clientSecret = null; + if (stripeRes != null) { + String status = stripeRes.getRedirect_status(); + clientSecret = stripeRes.getPayment_intent_client_secret(); + } + Documento bean = new Documento(apFull); + bean.findByDescTransactionStripe(clientSecret); + if (debug) { + clientSecret = "xxx"; + stripeRes.setRedirect_status("succeeded"); + recordOrder(req, res, stripeRes); + } + req.setAttribute("bean", bean); + req.setAttribute("listaTipoPagamento", new TipoPagamento( + getApFull(req)).findPagamentiWww(!bean.getClifor().getId_nazione().equals("I"), + (bean.getFlgDeliveryType() == 2L))); + int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso)); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/StripeSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/StripeSvlt.java new file mode 100644 index 00000000..49e88f9f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/StripeSvlt.java @@ -0,0 +1,28 @@ +package it.acxent.cc.servlet; + +import it.acxent.bank.servlet.stripe._StripeSvlt; +import it.acxent.contab.Documento; +import it.acxent.db.ResParm; +import javax.servlet.http.HttpServletRequest; + +public class StripeSvlt extends _StripeSvlt { + private static final long serialVersionUID = -1087656160829384851L; + + protected ResParm saveClientSecret(HttpServletRequest req, long l_id, String l_clientSecret) { + Documento doc = new Documento(getApFull(req)); + doc.findByPrimaryKey(l_id); + if (doc.getId_documento() > 0L) { + doc.setDescTransactionStripe(l_clientSecret); + return doc.superSave(); + } + return new ResParm(false, "no doc found:" + l_id); + } + + protected long getAmount(HttpServletRequest req, long l_id) { + Documento doc = new Documento(getApFull(req)); + doc.findByPrimaryKey(l_id); + if (doc.getId_documento() > 0L) + return Math.round(doc.getTotaleDocumento() * 100.0D); + return 0L; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/UsersSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/UsersSvlt.java new file mode 100644 index 00000000..5c3d5e3d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/UsersSvlt.java @@ -0,0 +1,544 @@ +package it.acxent.cc.servlet; + +import it.acxent.anag.Cliente; +import it.acxent.anag.Clifor; +import it.acxent.anag.DestinazioneDiversa; +import it.acxent.anag.Nazione; +import it.acxent.anag.NazioneCR; +import it.acxent.anag.Users; +import it.acxent.anag.UsersCR; +import it.acxent.cc.Attivita; +import it.acxent.contab.Documento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.reg.EcDc; +import it.acxent.util.CodiceFiscale; +import it.acxent.util.Vectumerator; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class UsersSvlt extends it.acxent.www.servlet.UsersSvlt { + private static final long serialVersionUID = 2411106203332570806L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) { + NazioneCR nCR = new NazioneCR(); + nCR.setLang(getLang(req)); + req.setAttribute("listaNazioni", new Nazione(getApFull(req)).findAllAttive(getLang(req))); + if (req.getAttribute("msg").equals("Lettura effettuata")) + req.setAttribute("msg", ""); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Users(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new UsersCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + NazioneCR nCR = new NazioneCR(); + nCR.setLang(getLang(req)); + req.setAttribute("listaNazioni", new Nazione(apFull).findAllAttive(getLang(req))); + sendMessage(req, ""); + Users bean = new Users(apFull); + bean.setFlgMl(1L); + bean.setId_userProfile(bean.getIdUserProfileWww()); + bean.setId_nazione("I"); + bean.setCallingJsp(getRequestParameter(req, "callingJsp")); + bean.setId_documento(getRequestLongParameter(req, "id_documento")); + try { + req.getSession().removeAttribute("utenteLogon"); + req.getSession().removeAttribute("loginUser_id"); + } catch (Exception e) {} + req.setAttribute("bean", bean); + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected String getBeanPageName(HttpServletRequest req) { + String temp = super.getBeanPageName(req); + Users user = (Users)getLoginUser(req); + ApplParmFull apFull = getApFull(req); + if (user != null && user.getDBState() == 1 && + user.isProfileNoReg()) + temp = "usersNoReg"; + return temp; + } + + protected String getCmd(HttpServletRequest req) { + if (super.getCmd(req).isEmpty()) + return "ni"; + return super.getCmd(req); + } + + protected String newDispathcerAfterShowBean(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Users bean = (Users)beanA; + bean.setCallingJsp(getRequestParameter(req, "callingJsp")); + bean.setId_documento(getRequestLongParameter(req, "id_documento")); + req.setAttribute("bean", bean); + return ""; + } + + private boolean mailConfermaCambiamentoDati(HttpServletRequest req, Users bean) { + Attivita attivita = Attivita.getDefaultInstance(getApFull(req)); + return attivita.sendUserDataMailMessageCC(bean, getLang(req), req).getStatus(); + } + + protected String getRegistrazioneMailMessage() { + return getParm("MAIL_REG").getTesto(); + } + + protected void sqlActions(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String l_lang = getLang(req); + Users bean = new Users(apFull); + long l_id_users = getRequestLongParameter(req, "id_users"); + if (l_id_users > 0L) + bean.findByPrimaryKey(l_id_users); + fillObject(req, bean); + bean.setEMail(bean.getLogin()); + req.setAttribute("eMail", bean.getLogin()); + Cliente cli = new Cliente(getApFull(req)); + if (bean.getId_users() > 0L) + cli.findByPrimaryKey(bean.getId_clifor()); + fillObject(req, cli); + DestinazioneDiversa dd = new DestinazioneDiversa(getApFull(req)); + fillObject(req, dd); + cli.setCurrentDD(dd); + bean.setClifor(cli); + String msg = bean.translate("Impossibile Registrare un nuovo utente:", l_lang); + boolean continuoRegistrazione = true; + if (l_id_users == 0L || (l_id_users > 0L && bean.isProfileNoReg())) + if (bean.isEmailDuplicated()) { + Users userMl = new Users(getApFull(req)); + userMl.findUsersByEmail(bean.getEMail()); + if (userMl.getId_userProfile() == bean.getIdUserProfileMailingList()) { + req.setAttribute("id_users", String.valueOf(userMl.getId_users())); + req.setAttribute("flgValido", "S"); + req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww())); + req.getSession().setAttribute("_sendUserMail", String.valueOf(userMl.getId_users())); + saveUserAndClifor(req, res); + } else if (userMl.getId_userProfile() == bean.getIdUserProfileNoReg()) { + if (userMl.getClifor().getCodFisc().toLowerCase().equals(bean.getCodFisc().toLowerCase())) { + req.setAttribute("id_users", String.valueOf(userMl.getId_users())); + req.setAttribute("flgValido", "S"); + req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww())); + req.getSession().setAttribute("_sendUserMail", String.valueOf(userMl.getId_users())); + saveUserAndClifor(req, res); + } else { + msg = msg + " Email associata ad un codice fiscale diverso!"; + forceMessage(req, msg); + setJspPageRelative(getBeanPageName(req) + ".jsp", req); + fillComboAfterDetail((DBAdapter)bean, req, res); + req.setAttribute("beanUser", bean); + callJsp(req, res); + } + } else { + msg = msg + " " + msg; + forceMessage(req, msg); + setJspPageRelative(getBeanPageName(req) + ".jsp", req); + fillComboAfterDetail((DBAdapter)bean, req, res); + req.setAttribute("beanUser", bean); + continuoRegistrazione = false; + callJsp(req, res); + } + } else if (cli.isCodFiscDuplicated()) { + msg = msg + " " + msg; + forceMessage(req, msg); + fillComboAfterDetail((DBAdapter)bean, req, res); + setJspPageRelative(getBeanPageName(req) + ".jsp", req); + cli.setCodFisc(""); + bean.setCodFisc(""); + bean.setClifor(cli); + req.setAttribute("beanUser", bean); + continuoRegistrazione = false; + callJsp(req, res); + } else if (cli.isPIvaDuplicated()) { + msg = msg + " " + msg; + forceMessage(req, msg); + fillComboAfterDetail((DBAdapter)bean, req, res); + setJspPageRelative(getBeanPageName(req) + ".jsp", req); + bean.setPIva(""); + cli.setPIva(""); + bean.setPIva(""); + bean.setClifor(cli); + req.setAttribute("beanUser", bean); + continuoRegistrazione = false; + callJsp(req, res); + } else if (!cli.getCodFisc().isEmpty() && cli.getId_nazione().toLowerCase().equals("i") && + !CodiceFiscale.controlloFormale(cli.getCodFisc())) { + msg = msg + " " + msg; + forceMessage(req, msg); + fillComboAfterDetail((DBAdapter)bean, req, res); + setJspPageRelative(getBeanPageName(req) + ".jsp", req); + cli.setCodFisc(""); + bean.setCodFisc(""); + bean.setClifor(cli); + req.setAttribute("beanUser", bean); + continuoRegistrazione = false; + callJsp(req, res); + } else if (!cli.getPIva().isEmpty() && cli.getId_nazione().toLowerCase().equals("i") && cli.getPIva().length() != 11) { + msg = msg + " " + msg; + forceMessage(req, msg); + fillComboAfterDetail((DBAdapter)bean, req, res); + setJspPageRelative(getBeanPageName(req) + ".jsp", req); + bean.setPIva(""); + cli.setPIva(""); + bean.setPIva(""); + bean.setClifor(cli); + req.setAttribute("beanUser", bean); + continuoRegistrazione = false; + callJsp(req, res); + } + if (continuoRegistrazione) { + if (bean.isProfileNoReg() || bean.isProfilML()) { + req.setAttribute("flgValido", "N"); + } else { + req.setAttribute("flgValido", "S"); + } + if (bean.getId_userProfile() == 0L) + req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww())); + saveUserAndClifor(req, res); + } + } + + protected void recordMailingList(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Attivita attivita = Attivita.getDefaultInstance(apFull); + String l_lang = getLang(req); + Users bean = new Users(apFull); + fillObject(req, bean); + ResParm rp = new ResParm(); + String msg = attivita.translate("Impossibile Registrare utente ML:", l_lang); + if (bean.isEmailDuplicated()) { + msg = msg + " " + msg + " - " + attivita.translate("Email già presente in archivio", l_lang); + rp.setStatus(false); + rp.setMsg(msg); + if (bean.isEmailDuplicatedNoMl()) { + rp.setErrorCode(1L); + } else { + rp.setErrorCode(2L); + } + req.setAttribute("RP", rp); + forceJspPageRelative("mailingListUser.jsp", req); + callJsp(req, res); + } else { + bean.setFlgValido("N"); + bean.setFlgMl(1L); + bean.setId_userProfile(bean.getIdUserProfileMailingList()); + bean.setLangMl(getRequestParameter(req, "langMl")); + bean.setLogin(bean.getEMail()); + bean.setCognome("MLC_" + bean.getEMail()); + bean.setNome("MLN_" + bean.getEMail()); + if (bean.getLogin().length() > 30) + bean.setLogin(bean.getLogin().substring(0, 30)); + if (bean.getCognome().length() > 30) + bean.setCognome(bean.getCognome().substring(0, 30)); + if (bean.getNome().length() > 30) + bean.setNome(bean.getNome().substring(0, 30)); + rp = bean.save(); + if (rp.getStatus()) { + Clifor clifor = new Clifor(apFull); + clifor.setFlgTipo("C"); + clifor.setCognome(bean.getCognome()); + clifor.setNome(bean.getNome()); + clifor.setEMail(bean.getEMail()); + clifor.setFlgMl(1L); + rp = clifor.save(); + if (rp.getStatus()) { + bean.setId_clifor(clifor.getId_clifor()); + rp.append(bean.save()); + } + if (!rp.getStatus()) + handleDebug("recordMailingList: " + rp.getMsg(), 0); + attivita.sendMLMailMessage(bean, getLang(req), req); + } + forceJspPageRelative("mailingListUser.jsp", req); + callJsp(req, res); + } + } + + protected void checkCc(HttpServletRequest req, HttpServletResponse res) { + Users bean = new Users(getApFull(req)); + fillObject(req, bean); + ResParm rp = new ResParm(); + String msg = bean.translate("Impossibile Registrare utente ML:", getLang(req)); + if (bean.isEmailDuplicated()) { + msg = msg + " Email già presente in archivio - " + msg; + rp.setStatus(false); + rp.setMsg(msg); + if (bean.isEmailDuplicatedNoMl()) { + rp.setErrorCode(1L); + } else { + rp.setErrorCode(2L); + } + req.setAttribute("RP", rp); + forceJspPageRelative("mailingListUser.jsp", req); + callJsp(req, res); + } else { + bean.setFlgValido("N"); + bean.setFlgMl(1L); + bean.setId_userProfile(bean.getIdUserProfileMailingList()); + bean.setLogin("ML_" + bean.getEMail()); + bean.setCognome("MLC_" + bean.getEMail()); + bean.setNome("MLN_" + bean.getEMail()); + rp = bean.save(); + if (rp.getStatus()) + bean.sendMLMailMessageOLD(req.getRemoteHost() + " " + req.getRemoteHost()); + forceJspPageRelative("mailingListUser.jsp", req); + callJsp(req, res); + } + } + + protected it.acxent.common.Users getUser(HttpServletRequest req) { + return new Users(getApFull(req)); + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + String msg; + Users bean = (Users)beanA; + ApplParmFull apFull = getApFull(req); + String l_lang = getLang(req); + Attivita attivita = Attivita.getDefaultInstance(apFull); + long l_id_user = getRequestLongParameter(req, "id_users"); + if (bean.getDBState() == 1) { + msg = attivita.translate("Salvataggio effettuato", l_lang); + req.getSession().setAttribute("utenteLogon", bean); + req.getSession().setAttribute("loginUser_id", new Long(bean.getId_users())); + if (req.getSession().getAttribute("_sendUserMail") != null || l_id_user == 0L) { + req.getSession().removeAttribute("_sendUserMail"); + if (!mailConfermaCambiamentoDati(req, bean)) { + msg = msg + " " + msg; + bean.setFlgEmailOk(0L); + } else { + msg = msg + " Inviata mail di conferma."; + bean.setFlgEmailOk(1L); + } + } else { + bean.setFlgEmailOk(1L); + } + setJspPageRelative(getBeanPageName(req) + "Reg.jsp", req); + } else { + msg = attivita.translate("ERRORE!. Non è stato possibile salvare. Contattare l'amministratore o immettere login diverso", l_lang); + } + forceMessage(req, msg); + return new ResParm(true); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("ML")) { + recordMailingList(req, res); + } else if (getCmd(req).equals("MLF")) { + recordMailingListF(req, res); + } else if (getCmd(req).equals("checkCC")) { + recordMailingList(req, res); + } else if (getCmd(req).equals("checkUCF")) { + checkUserCF(req, res); + } else { + super.otherCommands(req, res); + } + } + + protected void saveUserAndClifor(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Users user = new Users(apFull); + long l_id_users = getRequestLongParameter(req, "id_users"); + String l_lang = getLang(req); + user.findByPrimaryKey(l_id_users); + fillObject(req, user); + if (user.getId_nazione().toLowerCase().equals("i")) { + user.setLangMl("it"); + user.setLang("it"); + } else { + user.setLangMl("en"); + user.setLang("en"); + } + Clifor cliente = user.getClifor(); + fillObject(req, cliente); + cliente.setFlgTipo("C"); + if (cliente.getFlgAzienda() == 1L) { + cliente.setNome(""); + cliente.setCognome(getRequestParameter(req, "ragioneSociale")); + } + cliente.setContatto(user.getCognomeNome()); + ResParm rp = cliente.save(); + if (rp.getStatus()) { + DestinazioneDiversa dd = cliente.getCurrentDD(); + fillObject(req, dd); + if (dd.getIndirizzoDD().isEmpty()) { + if (dd.getId_destinazioneDiversa() != 0L) + rp.append(dd.delete()); + } else { + dd.setId_clifor(cliente.getId_clifor()); + dd.setFlgDDDefault(1L); + dd.setDescrizioneDD("Sped. WWW"); + rp.append(dd.save()); + } + } + if (rp.getStatus()) { + user.setId_clifor(cliente.getId_clifor()); + if (user.getId_userProfile() == 0L) + user.setId_userProfile(user.getIdUserProfileWww()); + user.setFlgValido("S"); + rp.append(user.save()); + } + if (rp.getStatus()) { + afterSave((DBAdapter)user, req, res); + forceMessage(req, user.translate("Record salvato correttamente", l_lang)); + String callingJsp = getRequestParameter(req, "callingJsp"); + if (callingJsp.isEmpty()) { + req.setAttribute("bean", user); + forceJspPage("/usersReg.jsp", req); + callJsp(req, res); + } else { + long l_id_documento = getRequestLongParameter(req, "id_documento"); + if (l_id_documento > 0L) { + Documento documento = new Documento(apFull); + documento.findByPrimaryKey(l_id_documento); + if (documento.getId_documento() > 0L) { + documento.setSpeseTrasporto(documento.getDeliveryCostOrdine(user.getClifor())); + rp = documento.save(); + } + } + if (callingJsp.endsWith("html")) { + try { + res.sendRedirect(callingJsp); + } catch (Exception e) { + e.printStackTrace(); + } + } else { + forceJspPage("/" + callingJsp, req); + callJsp(req, res); + } + } + } else { + sendMessage(req, user.translate("Impossibile salvare: ", l_lang) + user.translate("Impossibile salvare: ", l_lang)); + forceJspPage("/users.jsp", req); + req.setAttribute("listaNazioni", new Nazione(apFull).findAllAttive(getLang(req))); + req.setAttribute("bean", user); + callJsp(req, res); + } + } + + protected void checkUserCF(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String l_cf = getRequestParameter(req, "codFiscR"); + String l_lang = getLang(req); + Attivita attivita = Attivita.getDefaultInstance(apFull); + ResParm rp = new ResParm(true); + if (l_cf.isEmpty()) { + rp.setStatus(false); + rp.setMsg("Codice Fiscale errato!"); + } else { + Clifor clifor = new Clifor(getApFull(req)); + clifor.findByCF(l_cf, "C"); + if (clifor.getDBState() == 0) { + rp.setStatus(false); + rp.setMsg(attivita.translate("Il Codice Fiscale richiesto non è nei nostri database.", l_lang)); + } else if (clifor.getDBState() == 1 && clifor.getEMail().isEmpty()) { + rp.setStatus(false); + rp.setMsg( + attivita.translate("Il Codice Fiscale è nei nostri database ma l'indirizzo email non è stato comunicato.", l_lang)); + } else { + Users user = new Users(getApFull(req)); + Vectumerator vec = user.findByClifor(clifor.getId_clifor(), 1, 1); + if (vec.getTotNumberOfRecords() == 0) { + user.setCognome(clifor.getCognome()); + user.setNome(clifor.getNome()); + if (clifor.getFlgAzienda() == 1L) + user.setNominativo(clifor.getCognome()); + user.setFlgValido("S"); + user.setId_userProfile(user.getIdUserProfileWww()); + user.setId_clifor(clifor.getId_clifor()); + user.setEMail(clifor.getEMail()); + if (!clifor.getCellulare().isEmpty()) { + user.setTelefono(clifor.getCellulare()); + } else { + user.setTelefono(clifor.getTelefono()); + } + user.setLogin(user.getEMail()); + user.setPwd(String.valueOf(Math.random() * 1000000.0D).substring(0, 6)); + rp = user.save(); + if (rp.getStatus()) { + rp = user.sendUserDataMailMessage(); + if (rp.getStatus()) + rp.setMsg(attivita.translate("Utente creato correttamente. Una Mail ti è stata inviata all'indirizzo email", l_lang) + " " + attivita.translate("Utente creato correttamente. Una Mail ti è stata inviata all'indirizzo email", l_lang)); + } else { + rp.setStatus(false); + rp.setMsg(attivita.translate("Utente creato correttamente ma non è stato possibile inviare l'email di conferma.", l_lang)); + } + } else { + rp.setStatus(false); + rp.setMsg(attivita.translate("Attenzione! Il codice fiscale è nei nostri database ma esiste già un utente web associato. Richiedi i dati di accesso attraverso il recupero del login tramite indirizzo email.", l_lang)); + } + } + } + if (rp.getStatus()) { + forceJspPage("/usersReg.jsp", req); + } else { + forceJspPage("/usersRegError.jsp", req); + } + sendMessage(req, rp.getMsg()); + callJsp(req, res); + } + + protected void showBean(HttpServletRequest req, HttpServletResponse res) { + long l_id_usersDoc = getRequestLongParameter(req, "id_usersDoc"); + req.setAttribute("id_users", String.valueOf(getLoginUserId(req))); + if (l_id_usersDoc > 0L) + req.setAttribute("id_users", Long.valueOf(l_id_usersDoc)); + super.showBean(req, res); + } + + protected void recordMailingListF(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String l_lang = getLang(req); + Attivita attivita = Attivita.getDefaultInstance(apFull); + Users bean = new Users(getApFull(req)); + String l_eMail = EcDc.decode64String(getRequestParameter(req, "eMail")); + ResParm rp = new ResParm(false); + String msg = attivita.translate("Impossibile Registrare utente : ", l_lang); + bean.findByEmail(l_eMail); + if (bean.getDBState() == 1) { + if (bean.getFlgValido().equals("N")) { + msg = msg + "Email " + msg + l_eMail; + rp.setErrorCode(9L); + } else if (bean.getFlgMl() == 1L) { + msg = msg + "Email " + msg + l_eMail; + rp.setErrorCode(9L); + } else { + bean.setFlgMl(1L); + rp = bean.save(); + msg = "Email " + l_eMail + " iscritta correttamente alla newsletter."; + if (rp.getStatus()) + rp.append(bean.sendMLMailMessage(req.getRemoteHost() + " " + req.getRemoteHost(), bean.getLang())); + if (!rp.getStatus()) { + msg = msg + msg + " " + attivita.translate(" Attenzione. Ci sono stati problemi nella registrazione o nell'invio della mail di conferma: ", l_lang); + rp.setErrorCode(9L); + } + } + } else { + msg = msg + "Email " + msg + " " + l_eMail; + rp.setErrorCode(9L); + } + sendMessage(req, msg); + rp.setMsg(msg); + req.setAttribute("RP", rp); + forceJspPageRelative("mailingListUser.jsp", req); + callJsp(req, res); + } + + protected String getBEANAttribute(HttpServletRequest req) { + return super.getBEANAttribute(req) + "User"; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/_CCvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/_CCvlt.java new file mode 100644 index 00000000..1d97d6b0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/_CCvlt.java @@ -0,0 +1,106 @@ +package it.acxent.cc.servlet; + +import it.acxent.cart.Cart; +import it.acxent.common.Users; +import it.acxent.db.ApplParmFull; +import it.acxent.servlet.AblServletSvlt; +import java.text.NumberFormat; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class _CCvlt extends AblServletSvlt { + public static final String PARM_PRONTA_CONSEGNA = "flgProntaConsegna"; + + private static NumberFormat nf0; + + protected boolean checkLoginProfile(HttpServletRequest req) { + try { + if (getLoginUser(req) == null) { + forceJspPage(getLoginPage(null, null), req); + return true; + } + if (getLoginUser(req).getFlgValido().equals("N")) { + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return false; + } + if (getLoginUser(req).getId_userProfile() > 0L) + return true; + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return true; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + + protected long getLoginUserGrant(HttpServletRequest req, String l_permesso) { + return super.getLoginUserGrant(req, l_permesso); + } + + protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) { + return "Registra.abl"; + } + + protected Users getUser(HttpServletRequest req) { + ApplParmFull apFull = getApFull(); + return new it.acxent.anag.Users(apFull); + } + + protected boolean useAlwaysSendRedirect() { + return true; + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + public String getPathImgArticoli() { + return getDocBase() + "/" + getDocBase(); + } + + public long getHomeType() { + return getParm("HOME_TYPE").getNumeroLong(); + } + + protected int getPageRow(HttpServletRequest req) { + int pageRow = getParm("PAGE_ROW").getNumeroInt(); + return (pageRow == 0) ? 4 : pageRow; + } + + public NumberFormat getNf0(HttpServletRequest req) { + if (nf0 == null) { + nf0 = NumberFormat.getInstance(getLocale(req)); + nf0.setMaximumFractionDigits(0); + nf0.setMinimumFractionDigits(0); + } + return nf0; + } + + protected double getDeliveryCost(HttpServletRequest req) { + return getParm(Cart.P_DELIVERY_COST).getNumeroDouble(); + } + + protected double getMoreCost(HttpServletRequest req) { + return getParm(Cart.P_MORE_COST).getNumeroDouble(); + } + + protected double getDeliveryWarnCost(HttpServletRequest req) { + return getParm(Cart.P_DELIVERY_WARN_COST).getNumeroDouble(); + } + + protected long getFlgProntaConsegna(HttpServletRequest req) { + if (req.getSession().getAttribute("flgProntaConsegna") == null || ((String) + req.getSession().getAttribute("flgProntaConsegna")).isEmpty()) + return 0L; + try { + return Long.parseLong((String)req.getSession().getAttribute("flgProntaConsegna")); + } catch (Exception e) { + handleDebug(e, 2); + return 0L; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/admin/ArticoloSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/admin/ArticoloSvlt.java new file mode 100644 index 00000000..49072ed4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/admin/ArticoloSvlt.java @@ -0,0 +1,184 @@ +package it.acxent.cc.servlet.admin; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.cc.Attivita; +import it.acxent.cc.CCCronSendGoogleXml; +import it.acxent.cc.CCImport; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ArticoloSvlt extends it.acxent.art.servlet.ArticoloSvlt { + private static final long serialVersionUID = -2291450542550759704L; + + public void _sendGoogleXml(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCCronSendGoogleXml sgx = new CCCronSendGoogleXml(); + ResParm rp = sgx.crontabJob(apFull); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _importListinoIngramMicro(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + ResParm rp = bean.startImportIngramMicro(apFull, 0L, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _importDispoIngramMicro(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + ResParm rp = bean.startImportIngramMicro(apFull, 1L, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _importArticoliDatamaticMail(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + ResParm rp = bean.startImportDatamaticMail(apFull, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _importArticoliEsprinet(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + String fileCsv = getPathTmpFull() + getPathTmpFull(); + ResParm rp = bean.startImportEsprinet(apFull, fileCsv, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _importArticoliBrevi(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + String fileCsv = getPathTmpFull() + getPathTmpFull(); + ResParm rp = bean.startImportBrevi(apFull, fileCsv, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) { + Attivita attivita = Attivita.getDefaultInstance(getApFull(req)); + super.fillComboAfterDetail(l_bean, req, res); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + super.fillComboAfterSearch(CR, req, res); + } + + public void _importArticoliLogicom(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + String fileCsv = getPathTmpFull() + getPathTmpFull(); + ResParm rp = bean.startImportLogicom(apFull, fileCsv, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _importArticoliDatamatic(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + String fileCsv = getPathTmpFull() + getPathTmpFull(); + ResParm rp = bean.startImportDatamatic(apFull, fileCsv, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _importArticoliLogicomMail(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + ResParm rp = bean.startImportLogicomMail(apFull, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _importArticoliFlexit(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + String fileCsv = getPathTmpFull() + getPathTmpFull(); + ResParm rp = bean.startImportFlexit(apFull, fileCsv, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _importArticoliFlexitMail(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + ResParm rp = bean.startImportFlexitMail(apFull, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _importRunner(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + String s_flgTipoImport = getRequestParameter(req, "flgTipoImportRunner"); + String[] s_flgTipoImportA = s_flgTipoImport.split(","); + long[] result = new long[s_flgTipoImportA.length]; + for (int i = 0; i < s_flgTipoImportA.length; i++) + result[i] = Long.parseLong(s_flgTipoImportA[i]); + ResParm rp = bean.startImportRunner(apFull, result, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _importSiaeIngramMicro(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + ResParm rp = bean.startImportIngramMicro(apFull, 2L, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _importArticoliCgross(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + ResParm rp = bean.startImportCgross(apFull, null, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _importArticoliCgrossWeb(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + String fileZip = getPathTmpFull() + getPathTmpFull(); + ResParm rp = bean.startImportCgross(apFull, fileZip, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _importBestit(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CCImport bean = new CCImport(); + String s_flgTipoImport = getRequestParameter(req, "flgTipoImportBestit"); + String[] s_flgTipoImportA = s_flgTipoImport.split(","); + long[] result = new long[s_flgTipoImportA.length]; + for (int i = 0; i < s_flgTipoImportA.length; i++) + result[i] = Long.parseLong(s_flgTipoImportA[i]); + ResParm rp = bean.startImportBestit(apFull, result, true); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _creaSitemapsStandard(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Articolo art = new Articolo(apFull); + ArticoloCR ACR = new ArticoloCR(apFull); + ACR.setFlgReadyForWeb(0L); + ACR.setFlgEscludiWeb(-1L); + ACR.setFlgQta(1L); + ACR.setQtaDa(1L); + ACR.setQtaA(9999L); + ResParm rp = art.startThreadCreaSitemaps(getApFull(), ACR); + sendMessage(req, rp.getMsg()); + search(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/admin/AttivitaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/admin/AttivitaSvlt.java new file mode 100644 index 00000000..e56a18a7 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/admin/AttivitaSvlt.java @@ -0,0 +1,306 @@ +package it.acxent.cc.servlet.admin; + +import it.acxent.anag.Listino; +import it.acxent.cc.Attivita; +import it.acxent.cc.AttivitaCR; +import it.acxent.cc.TipoAttivita; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.mail.MailMessage; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.servlet.AddImgSvlt; +import java.io.File; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/cc/Attivita.abl"}) +public class AttivitaSvlt extends AblServletSvlt implements AddImgSvlt { + private static final long serialVersionUID = 4963856767196841700L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipoAttivita", new TipoAttivita(apFull).findAll()); + req.setAttribute("listaListino", new Listino(apFull).findNoListinoBase()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipoAttivita", new TipoAttivita(apFull).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Attivita(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new AttivitaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipoAttivita", new TipoAttivita(apFull).findAll()); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + protected boolean isLoadImageServlet() { + return true; + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + req.getSession().removeAttribute("attivita"); + Attivita.resetDefaultInstance(); + return super.afterSave(beanA, req, res); + } + + public void _mdd(HttpServletRequest req, HttpServletResponse res) { + Attivita attivita = Attivita.getDefaultInstance(getApFull(req)); + req.setAttribute("id_attivita", Long.valueOf(attivita.getId_attivita())); + showBean(req, res); + } + + public void _caricaPrivacy(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_attivita = getRequestLongParameter(req, "id_attivita"); + Attivita bean = new Attivita(apFull); + bean.findByPrimaryKey(l_id_attivita); + fillObject(req, bean); + String l_fileName = getDocBase() + "admin/cc/_template/privacy-" + getDocBase() + ".html"; + if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) { + MailMessage mf = new MailMessage(apFull, l_fileName); + mf.setString("ragioneSociale", bean.getNomeAttivita()); + mf.setString("sedeLegale", bean.getIndirizzoCompletoSede()); + mf.setString("cf", bean.getCodFisc()); + mf.setString("responsabileTrattamento", bean.getContatto()); + bean.setDescTxtLang("privacy", bean.getCurrentLang(), mf.getMessage()); + bean.save(); + } + showBean(req, res); + } + + public void _caricaCookiePolicy(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_attivita = getRequestLongParameter(req, "id_attivita"); + Attivita bean = new Attivita(apFull); + bean.findByPrimaryKey(l_id_attivita); + fillObject(req, bean); + String l_fileName = getDocBase() + "admin/cc/_template/cookiePolicy-" + getDocBase() + ".html"; + if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) { + MailMessage mf = new MailMessage(apFull, l_fileName); + mf.setString("ragioneSociale", bean.getNomeAttivita()); + mf.setString("sedeLegale", bean.getIndirizzoCompletoSede()); + mf.setString("cf", bean.getCodFisc()); + mf.setString("pec", bean.getPec()); + mf.setString("email", bean.getEmailAttivita()); + mf.setString("sito", req.getHeader("Host")); + mf.setString("pIva", bean.getPIva()); + mf.setString("indirizzoRestituzione", bean.getIndirizzoCompletoAttivita()); + mf.setString("responsabileTrattamento", bean.getContatto()); + bean.setDescTxtLang("cookiePolicyText", bean.getCurrentLang(), mf.getMessage()); + bean.save(); + } + showBean(req, res); + } + + protected ResParm beforeSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Attivita bean = (Attivita)beanA; + if (bean.getWwwAddress().isEmpty()) { + String serverName; + if (req.getHeader("x-forwarded-proto") == null) { + serverName = req.getScheme() + "://" + req.getScheme() + req.getServerName() + "/"; + } else { + serverName = req.getHeader("x-forwarded-proto") + "://" + req.getHeader("x-forwarded-proto") + req.getServerName() + "/"; + } + bean.setWwwAddress(serverName); + } + return super.beforeSave(beanA, req, res); + } + + public void _caricaFooter(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_attivita = getRequestLongParameter(req, "id_attivita"); + Attivita bean = new Attivita(apFull); + bean.findByPrimaryKey(l_id_attivita); + fillObject(req, bean); + String l_fileName = getDocBase() + "admin/cc/_template/footer-" + getDocBase() + ".html"; + if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) { + MailMessage mf = new MailMessage(apFull, l_fileName); + mf.setString("ragioneSociale", bean.getNomeAttivita()); + mf.setString("sedeLegale", bean.getIndirizzoCompletoSede()); + mf.setString("cf", bean.getCodFisc()); + mf.setString("telefono", bean.getTelefonoAttivita()); + mf.setString("email", bean.getEmailAttivita()); + mf.setString("pIva", bean.getPIva()); + mf.setString("sdi", bean.getCodiceIdentificativoFE()); + mf.setString("pec", bean.getPec()); + bean.setDescTxtLang("footerText", bean.getCurrentLang(), mf.getMessage()); + bean.save(); + } + showBean(req, res); + } + + public void _caricaTermsConditions(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_attivita = getRequestLongParameter(req, "id_attivita"); + Attivita bean = new Attivita(apFull); + bean.findByPrimaryKey(l_id_attivita); + fillObject(req, bean); + String l_fileName = getDocBase() + "admin/cc/_template/termsConditions-" + getDocBase() + ".html"; + if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) { + MailMessage mf = new MailMessage(apFull, l_fileName); + mf.setString("ragioneSociale", bean.getNomeAttivita()); + mf.setString("sedeLegale", bean.getIndirizzoCompletoSede()); + mf.setString("cf", bean.getCodFisc()); + mf.setString("email", bean.getEmailAttivita()); + mf.setString("sito", req.getHeader("Host")); + mf.setString("pIva", bean.getPIva()); + mf.setString("indirizzoRestituzione", bean.getIndirizzoCompletoAttivita()); + mf.setString("responsabileTrattamento", bean.getContatto()); + bean.setDescTxtLang("termConditions", bean.getCurrentLang(), mf.getMessage()); + bean.save(); + } + showBean(req, res); + } + + public void _sendNotificheWishlist(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_attivita = getRequestLongParameter(req, "id_attivita"); + Attivita bean = new Attivita(apFull); + bean.findByPrimaryKey(l_id_attivita); + ResParm rp = bean.startThreadNotifiche(); + System.out.println(rp.getMsg()); + showBean(req, res); + } + + public void _ebayCreaMerchantLocationKey(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Attivita bean = new Attivita(apFull); + long l_id = getRequestLongParameter(req, "id_attivita"); + bean.findByPrimaryKey(l_id); + if (bean.getId_attivita() > 0L) { + fillObject(req, bean); + ResParm rp = bean.save(); + if (rp.getStatus()) { + rp = bean.ebayCreaMerchantLocationKey(); + if (rp.getStatus()) { + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, rp.getErrMsg()); + } + } else { + sendMessage(req, rp.getErrMsg()); + } + showBean(req, res); + } else { + sendMessage(req, "Errore! Attivita non trovato"); + search(req, res); + } + } + + public void _ebayReturnPolicyId(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Attivita bean = new Attivita(apFull); + long l_id = getRequestLongParameter(req, "id_attivita"); + bean.findByPrimaryKey(l_id); + if (bean.getId_attivita() > 0L) { + ResParm rp = bean.ebayUpdateReturnPolicyId(); + if (rp.getStatus()) { + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, rp.getErrMsg()); + } + showBean(req, res); + } else { + sendMessage(req, "Errore! Attivita non trovato"); + search(req, res); + } + } + + public void _amzUpdateTokens(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Attivita bean = new Attivita(apFull); + long l_id = getRequestLongParameter(req, "id_attivita"); + bean.findByPrimaryKey(l_id); + if (bean.getId_attivita() > 0L) { + ResParm rp = bean.amzUpdateTokens(false); + if (rp.getStatus()) { + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, rp.getErrMsg()); + } + showBean(req, res); + } else { + sendMessage(req, "Errore! Attivita non trovato"); + search(req, res); + } + } + + public void _ebayFulfillmentPolicyId(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Attivita bean = new Attivita(apFull); + long l_id = getRequestLongParameter(req, "id_attivita"); + bean.findByPrimaryKey(l_id); + if (bean.getId_attivita() > 0L) { + ResParm rp = bean.ebayUpdateFulfillmentPolicyId(); + if (rp.getStatus()) { + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, rp.getErrMsg()); + } + showBean(req, res); + } else { + sendMessage(req, "Errore! Attivita non trovato"); + search(req, res); + } + } + + public void _caricaDirittoDiRecesso(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_attivita = getRequestLongParameter(req, "id_attivita"); + Attivita bean = new Attivita(apFull); + bean.findByPrimaryKey(l_id_attivita); + fillObject(req, bean); + String l_fileName = getDocBase() + "admin/cc/_template/dirittoDiRecesso-" + getDocBase() + ".html"; + if (bean.getId_attivita() > 0L && new File(l_fileName).exists()) { + MailMessage mf = new MailMessage(apFull, l_fileName); + mf.setString("ragioneSociale", bean.getNomeAttivita()); + mf.setString("sedeLegale", bean.getIndirizzoCompletoSede()); + mf.setString("cf", bean.getCodFisc()); + mf.setString("pec", bean.getPec()); + mf.setString("email", bean.getEmailAttivita()); + mf.setString("sito", req.getHeader("Host")); + mf.setString("pIva", bean.getPIva()); + mf.setString("indirizzoRestituzione", bean.getIndirizzoCompletoAttivita()); + mf.setString("responsabileTrattamento", bean.getContatto()); + bean.setDescTxtLang("dirittoDiRecesso", bean.getCurrentLang(), mf.getMessage()); + bean.save(); + } + showBean(req, res); + } + + public void _ebayPaymentPolicyId(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Attivita bean = new Attivita(apFull); + long l_id = getRequestLongParameter(req, "id_attivita"); + bean.findByPrimaryKey(l_id); + if (bean.getId_attivita() > 0L) { + ResParm rp = bean.ebayUpdatePaymentPolicyId(); + if (rp.getStatus()) { + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, rp.getErrMsg()); + } + showBean(req, res); + } else { + sendMessage(req, "Errore! Attivita non trovato"); + search(req, res); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/admin/TipoAttivitaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/admin/TipoAttivitaSvlt.java new file mode 100644 index 00000000..3bf53af6 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/admin/TipoAttivitaSvlt.java @@ -0,0 +1,33 @@ +package it.acxent.cc.servlet.admin; + +import it.acxent.cc.TipoAttivita; +import it.acxent.cc.TipoAttivitaCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/cc/TipoAttivita.abl"}) +public class TipoAttivitaSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoAttivita(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoAttivitaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/admin/WwwAutomatorSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/admin/WwwAutomatorSvlt.java new file mode 100644 index 00000000..2905f774 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/admin/WwwAutomatorSvlt.java @@ -0,0 +1,122 @@ +package it.acxent.cc.servlet.admin; + +import it.acxent.cc.WwwAutomator; +import it.acxent.cc.WwwAutomatorCR; +import it.acxent.cc.servlet._CCvlt; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/cc/WwwAutomator.abl"}) +public class WwwAutomatorSvlt extends _CCvlt { + private static final long serialVersionUID = 5418623699135974920L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new WwwAutomator(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new WwwAutomatorCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + search(req, res); + } + + public void _duplicaAutomator(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id = getRequestLongParameter(req, "id_wwwAutomator"); + WwwAutomator bean = new WwwAutomator(apFull); + bean.findByPrimaryKey(l_id); + if (bean.getId_wwwAutomator() > 0L) { + bean.setId_wwwAutomator(0L); + bean.setDBState(0); + bean.setUltimaEsecuzione(""); + req.setAttribute("bean", bean); + forceMessage(req, "Attenzione! Il Record è stato Duplicato!!"); + } + showBean(req, res); + } + + public void _eseguiAutomatorFullCR(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + WwwAutomator bean = new WwwAutomator(apFull); + WwwAutomatorCR CR = new WwwAutomatorCR(); + fillObject(req, CR); + CR.setFlgAbilita(1L); + bean.startAutomator(getApFull(), CR, false); + search(req, res); + } + + public void _spostaGiu(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id = getRequestLongParameter(req, "id_wwwAutomatorSposta"); + WwwAutomator bean = new WwwAutomator(apFull); + bean.findByPrimaryKey(l_id); + if (bean.getId_wwwAutomator() > 0L) { + ResParm rp = bean.spostaGiu(); + sendMessage(req, rp.getMsg()); + } + search(req, res); + } + + public void _spostaSu(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id = getRequestLongParameter(req, "id_wwwAutomatorSposta"); + WwwAutomator bean = new WwwAutomator(apFull); + bean.findByPrimaryKey(l_id); + if (bean.getId_wwwAutomator() > 0L) { + ResParm rp = bean.spostaSu(); + sendMessage(req, rp.getMsg()); + } + search(req, res); + } + + public void _eseguiAutomatorCR(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id = getRequestLongParameter(req, "id_wwwAutomator"); + WwwAutomator bean = new WwwAutomator(apFull); + bean.findByPrimaryKey(l_id); + if (bean.getId_wwwAutomator() > 0L) { + ResParm rp = bean.eseguiAutomator(); + sendMessage(req, rp.getMsg()); + } + search(req, res); + } + + public void _eseguiAutomator(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id = getRequestLongParameter(req, "id_wwwAutomator"); + WwwAutomator bean = new WwwAutomator(apFull); + bean.findByPrimaryKey(l_id); + if (bean.getId_wwwAutomator() > 0L) { + ResParm rp = bean.eseguiAutomator(); + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + public void _ripristinoOrdine(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + WwwAutomator bean = new WwwAutomator(apFull); + bean.ripristinoOrdine(); + sendMessage(req, "Ordine tipo + ordine ripristinato"); + search(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/package-info.java new file mode 100644 index 00000000..96fa5879 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/servlet/package-info.java @@ -0,0 +1 @@ +package it.acxent.cc.servlet; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/AttivitaTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/AttivitaTag.java new file mode 100644 index 00000000..ef3dee47 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/AttivitaTag.java @@ -0,0 +1,20 @@ +package it.acxent.cc.taglib; + +import it.acxent.cc.Attivita; +import it.acxent.taglib.AbstractDbTag; +import javax.servlet.jsp.JspException; + +public class AttivitaTag extends AbstractDbTag { + private static final long serialVersionUID = 5692636146746905942L; + + public int doAfterBody() throws JspException { + return 0; + } + + public int doStartTag() { + Attivita bean = Attivita.getDefaultInstance(getApFull()); + getReq().setAttribute("_listaLangAtt", bean.findLangAttivita()); + getReq().getSession().setAttribute("attivita", bean); + return 2; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/GoogleReviewTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/GoogleReviewTag.java new file mode 100644 index 00000000..503fb987 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/GoogleReviewTag.java @@ -0,0 +1,34 @@ +package it.acxent.cc.taglib; + +import it.acxent.cc.Attivita; +import it.acxent.cc.GoogleReviews; +import it.acxent.taglib.AbstractDbTag; +import javax.servlet.jsp.JspException; + +public class GoogleReviewTag extends AbstractDbTag { + private static final long serialVersionUID = 5692636146746905942L; + + private boolean userreview = false; + + public int doAfterBody() throws JspException { + return 0; + } + + public int doStartTag() { + Attivita bean = Attivita.getDefaultInstance(getApFull()); + GoogleReviews rev = bean.getReview(isUserreview()); + getReq().setAttribute("_rating", getNf1().format(rev.getRating())); + getReq().setAttribute("_reviews", rev.getReviews()); + getReq().setAttribute("_userRatingsTotal", getNf0().format(rev.getUserRatingsTotal())); + getReq().setAttribute("_starsFAS", rev.getFontAwesomeSvgRatingStars()); + return 2; + } + + public boolean isUserreview() { + return this.userreview; + } + + public void setUserreview(boolean userreview) { + this.userreview = userreview; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/GoogleReviewsTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/GoogleReviewsTag.java new file mode 100644 index 00000000..6a5df486 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/GoogleReviewsTag.java @@ -0,0 +1,77 @@ +package it.acxent.cc.taglib; + +import it.acxent.cc.Attivita; +import it.acxent.cc.GoogleReview; +import it.acxent.cc.GoogleReviews; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.text.NumberFormat; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; + +public class GoogleReviewsTag extends AbstractDbTag { + private String rowbeanname; + + private Vectumerator theList; + + private boolean soloattivi = true; + + public int doAfterBody() throws JspException { + try { + if (this.theList.hasMoreElements()) { + GoogleReview row = (GoogleReview)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + String body = getBodyContent().getString(); + this.bodyContent.getEnclosingWriter().print(body); + return 0; + } catch (IOException ex) { + throw new JspTagException(ex.toString()); + } + } + + public int doStartTag() { + Attivita bean = Attivita.getDefaultInstance(getApFull()); + GoogleReviews rev = bean.getReview(true); + this.theList = rev.getReviews(); + if (this.theList == null) + return 0; + this.theList.moveFirst(); + if (this.theList.hasMoreElements()) { + GoogleReview row = (GoogleReview)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("nfV", getNf()); + this.pageContext.setAttribute("nf0V", getNf()); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + return 0; + } + + public String getRowbeanname() { + return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname; + } + + public void setRowbeanname(String s) { + this.rowbeanname = s; + } + + public NumberFormat getNf() { + return getApFull().getNf2(); + } + + public NumberFormat getNf0() { + return getApFull().getNf0(); + } + + public boolean isSoloattivi() { + return this.soloattivi; + } + + public void setSoloattivi(boolean soloattivi) { + this.soloattivi = soloattivi; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/GoogleReviewsTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/GoogleReviewsTagExtraInfo.java new file mode 100644 index 00000000..6b30d308 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/GoogleReviewsTagExtraInfo.java @@ -0,0 +1,13 @@ +package it.acxent.cc.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class GoogleReviewsTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean"; + String rowBeanClass = "it.acxent.cc.GoogleReview"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nfV", "java.text.NumberFormat", true, 0), new VariableInfo("nf0V", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/MarcaTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/MarcaTag.java new file mode 100644 index 00000000..2f625d39 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/MarcaTag.java @@ -0,0 +1,63 @@ +package it.acxent.cc.taglib; + +import it.acxent.art.Marca; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.text.NumberFormat; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; + +public class MarcaTag extends AbstractDbTag { + private String rowbeanname; + + private Vectumerator theList; + + public int doAfterBody() throws JspException { + try { + if (this.theList.hasMoreElements()) { + Marca row = (Marca)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + String body = getBodyContent().getString(); + this.bodyContent.getEnclosingWriter().print(body); + return 0; + } catch (IOException ex) { + throw new JspTagException(ex.toString()); + } + } + + public int doStartTag() { + this.theList = new Marca(getApFull()).findMarchePresentiByTipoTag(0L, null); + if (this.theList == null) + return 0; + this.theList.moveFirst(); + if (this.theList.hasMoreElements()) { + Marca row = (Marca)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("nfV", getNf()); + this.pageContext.setAttribute("nf0V", getNf()); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + return 0; + } + + public String getRowbeanname() { + return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname; + } + + public void setRowbeanname(String s) { + this.rowbeanname = s; + } + + public NumberFormat getNf() { + return getApFull().getNf2(); + } + + public NumberFormat getNf0() { + return getApFull().getNf0(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/MarcaTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/MarcaTagExtraInfo.java new file mode 100644 index 00000000..8cab141c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/MarcaTagExtraInfo.java @@ -0,0 +1,13 @@ +package it.acxent.cc.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class MarcaTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean"; + String rowBeanClass = "it.acxent.art.Marca"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nfV", "java.text.NumberFormat", true, 0), new VariableInfo("nf0V", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/NazioneTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/NazioneTag.java new file mode 100644 index 00000000..2999f277 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/NazioneTag.java @@ -0,0 +1,77 @@ +package it.acxent.cc.taglib; + +import it.acxent.anag.Nazione; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.text.NumberFormat; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; + +public class NazioneTag extends AbstractDbTag { + private String rowbeanname; + + private Vectumerator theList; + + private boolean soloattivi = true; + + public int doAfterBody() throws JspException { + try { + if (this.theList.hasMoreElements()) { + Nazione row = (Nazione)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + String body = getBodyContent().getString(); + this.bodyContent.getEnclosingWriter().print(body); + return 0; + } catch (IOException ex) { + throw new JspTagException(ex.toString()); + } + } + + public int doStartTag() { + if (isSoloattivi()) { + this.theList = new Nazione(getApFull()).findAllAttive(getLang()); + } else { + this.theList = new Nazione(getApFull()).findAll(getLang()); + } + if (this.theList == null) + return 0; + this.theList.moveFirst(); + if (this.theList.hasMoreElements()) { + Nazione row = (Nazione)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("nfV", getNf()); + this.pageContext.setAttribute("nf0V", getNf()); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + return 0; + } + + public String getRowbeanname() { + return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname; + } + + public void setRowbeanname(String s) { + this.rowbeanname = s; + } + + public NumberFormat getNf() { + return getApFull().getNf2(); + } + + public NumberFormat getNf0() { + return getApFull().getNf0(); + } + + public boolean isSoloattivi() { + return this.soloattivi; + } + + public void setSoloattivi(boolean soloattivi) { + this.soloattivi = soloattivi; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/NazioneTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/NazioneTagExtraInfo.java new file mode 100644 index 00000000..23da429e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/NazioneTagExtraInfo.java @@ -0,0 +1,13 @@ +package it.acxent.cc.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class NazioneTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean"; + String rowBeanClass = "it.acxent.anag.Nazione"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nfV", "java.text.NumberFormat", true, 0), new VariableInfo("nf0V", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/StatoUsatoTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/StatoUsatoTag.java new file mode 100644 index 00000000..af21c32e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/StatoUsatoTag.java @@ -0,0 +1,63 @@ +package it.acxent.cc.taglib; + +import it.acxent.art.StatoUsato; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.text.NumberFormat; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; + +public class StatoUsatoTag extends AbstractDbTag { + private String rowbeanname; + + private Vectumerator theList; + + public int doAfterBody() throws JspException { + try { + if (this.theList.hasMoreElements()) { + StatoUsato row = (StatoUsato)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + String body = getBodyContent().getString(); + this.bodyContent.getEnclosingWriter().print(body); + return 0; + } catch (IOException ex) { + throw new JspTagException(ex.toString()); + } + } + + public int doStartTag() { + this.theList = new StatoUsato(getApFull()).findSoloUsato(); + if (this.theList == null) + return 0; + this.theList.moveFirst(); + if (this.theList.hasMoreElements()) { + StatoUsato row = (StatoUsato)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("nfV", getNf()); + this.pageContext.setAttribute("nf0V", getNf()); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + return 0; + } + + public String getRowbeanname() { + return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname; + } + + public void setRowbeanname(String s) { + this.rowbeanname = s; + } + + public NumberFormat getNf() { + return getApFull().getNf2(); + } + + public NumberFormat getNf0() { + return getApFull().getNf0(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/StatoUsatoTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/StatoUsatoTagExtraInfo.java new file mode 100644 index 00000000..c9c9f222 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/StatoUsatoTagExtraInfo.java @@ -0,0 +1,13 @@ +package it.acxent.cc.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class StatoUsatoTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean"; + String rowBeanClass = "it.acxent.art.StatoUsato"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nfV", "java.text.NumberFormat", true, 0), new VariableInfo("nf0V", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/TipoPagamentoTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/TipoPagamentoTag.java new file mode 100644 index 00000000..54b3cb98 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/TipoPagamentoTag.java @@ -0,0 +1,63 @@ +package it.acxent.cc.taglib; + +import it.acxent.anag.TipoPagamento; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.text.NumberFormat; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; + +public class TipoPagamentoTag extends AbstractDbTag { + private String rowbeanname; + + private Vectumerator theList; + + public int doAfterBody() throws JspException { + try { + if (this.theList.hasMoreElements()) { + TipoPagamento row = (TipoPagamento)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + String body = getBodyContent().getString(); + this.bodyContent.getEnclosingWriter().print(body); + return 0; + } catch (IOException ex) { + throw new JspTagException(ex.toString()); + } + } + + public int doStartTag() { + this.theList = new TipoPagamento(getApFull()).findPagamentiWww(false, false); + if (this.theList == null) + return 0; + this.theList.moveFirst(); + if (this.theList.hasMoreElements()) { + TipoPagamento row = (TipoPagamento)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("nfV", getNf()); + this.pageContext.setAttribute("nf0V", getNf()); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + return 0; + } + + public String getRowbeanname() { + return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname; + } + + public void setRowbeanname(String s) { + this.rowbeanname = s; + } + + public NumberFormat getNf() { + return getApFull().getNf2(); + } + + public NumberFormat getNf0() { + return getApFull().getNf0(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/TipoPagamentoTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/TipoPagamentoTagExtraInfo.java new file mode 100644 index 00000000..c8992a17 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/TipoPagamentoTagExtraInfo.java @@ -0,0 +1,13 @@ +package it.acxent.cc.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class TipoPagamentoTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean"; + String rowBeanClass = "it.acxent.anag.TipoPagamento"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nfV", "java.text.NumberFormat", true, 0), new VariableInfo("nf0V", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/package-info.java new file mode 100644 index 00000000..90c618c4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/cc/taglib/package-info.java @@ -0,0 +1 @@ +package it.acxent.cc.taglib; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/AllegatoDocumento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/AllegatoDocumento.java new file mode 100644 index 00000000..642466aa --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/AllegatoDocumento.java @@ -0,0 +1,149 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class AllegatoDocumento extends _ContabAdapter implements Serializable { + private long id_allegatoDocumento; + + private long id_documento; + + private long id_tipoAllegatoDocumento; + + private String nomeFile; + + private Documento documento; + + private TipoAllegatoDocumento tipoAllegatoDocumento; + + public AllegatoDocumento(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AllegatoDocumento() {} + + public void setId_allegatoDocumento(long newId_allegatoDocumento) { + this.id_allegatoDocumento = newId_allegatoDocumento; + } + + public void setId_documento(long newId_documento) { + this.id_documento = newId_documento; + setDocumento(null); + } + + public void setId_tipoAllegatoDocumento(long newId_tipoAllegatoDocumento) { + this.id_tipoAllegatoDocumento = newId_tipoAllegatoDocumento; + setTipoAllegatoDocumento(null); + } + + public void setNomeFile(String newNomeFile) { + this.nomeFile = newNomeFile; + } + + public long getId_allegatoDocumento() { + return this.id_allegatoDocumento; + } + + public long getId_documento() { + return this.id_documento; + } + + public long getId_tipoAllegatoDocumento() { + return this.id_tipoAllegatoDocumento; + } + + public String getNomeFile() { + return (this.nomeFile == null) ? "" : this.nomeFile.trim(); + } + + public void setDocumento(Documento newDocumento) { + this.documento = newDocumento; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, + getId_documento()); + return this.documento; + } + + public void setTipoAllegatoDocumento(TipoAllegatoDocumento newTipoAllegatoDocumento) { + this.tipoAllegatoDocumento = newTipoAllegatoDocumento; + } + + public TipoAllegatoDocumento getTipoAllegatoDocumento() { + this.tipoAllegatoDocumento = (TipoAllegatoDocumento)getSecondaryObject(this.tipoAllegatoDocumento, TipoAllegatoDocumento.class, + + getId_tipoAllegatoDocumento()); + return this.tipoAllegatoDocumento; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(AllegatoDocumentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ALLEGATO_DOCUMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByDocumentoNomeFile(long l_id_documento, String l_id_nomeFile) { + String s_Sql_Find = "select A.* from ALLEGATO_DOCUMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + wc.addWc("A.nomeFile='" + l_id_nomeFile + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findByDocumentoTipo(long l_id_documento, long l_id_tipoAllegatoDocumento, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ALLEGATO_DOCUMENTO AS A"; + String s_Sql_Order = " order by A.nomeFile"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + if (l_id_tipoAllegatoDocumento > 0L) + wc.addWc("A.id_tipoAllegatoDocumento=" + l_id_tipoAllegatoDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getNomeFileSuDisco() { + return "" + getId_documento() + "_" + getId_documento(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/AllegatoDocumentoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/AllegatoDocumentoCR.java new file mode 100644 index 00000000..49c493d2 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/AllegatoDocumentoCR.java @@ -0,0 +1,80 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AllegatoDocumentoCR extends CRAdapter { + private long id_allegatoDocumento; + + private long id_documento; + + private long id_tipoAllegatoDocumento; + + private String nomeFile; + + private Documento documento; + + private TipoAllegatoDocumento tipoAllegatoDocumento; + + public AllegatoDocumentoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AllegatoDocumentoCR() {} + + public void setId_allegatoDocumento(long newId_allegatoDocumento) { + this.id_allegatoDocumento = newId_allegatoDocumento; + } + + public void setId_documento(long newId_documento) { + this.id_documento = newId_documento; + setDocumento(null); + } + + public void setId_tipoAllegatoDocumento(long newId_tipoAllegatoDocumento) { + this.id_tipoAllegatoDocumento = newId_tipoAllegatoDocumento; + setTipoAllegatoDocumento(null); + } + + public void setNomeFile(String newNomeFile) { + this.nomeFile = newNomeFile; + } + + public long getId_allegatoDocumento() { + return this.id_allegatoDocumento; + } + + public long getId_documento() { + return this.id_documento; + } + + public long getId_tipoAllegatoDocumento() { + return this.id_tipoAllegatoDocumento; + } + + public String getNomeFile() { + return (this.nomeFile == null) ? "" : this.nomeFile.trim(); + } + + public void setDocumento(Documento newDocumento) { + this.documento = newDocumento; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, + + getId_documento()); + return this.documento; + } + + public void setTipoAllegatoDocumento(TipoAllegatoDocumento newTipoAllegatoDocumento) { + this.tipoAllegatoDocumento = newTipoAllegatoDocumento; + } + + public TipoAllegatoDocumento getTipoAllegatoDocumento() { + this.tipoAllegatoDocumento = (TipoAllegatoDocumento)getSecondaryObject(this.tipoAllegatoDocumento, TipoAllegatoDocumento.class, + + getId_tipoAllegatoDocumento()); + return this.tipoAllegatoDocumento; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/CausaleContabile.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/CausaleContabile.java new file mode 100644 index 00000000..9e97436d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/CausaleContabile.java @@ -0,0 +1,73 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.DBAdapterException; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class CausaleContabile extends DBAdapter implements Serializable { + private static final long serialVersionUID = 8044331984020899695L; + + private long id_causaleContabile; + + private String descrizione; + + public CausaleContabile(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CausaleContabile() {} + + public long getId_causaleContabile() { + return this.id_causaleContabile; + } + + public void setId_causaleContabile(long id_incassoPagamento) { + this.id_causaleContabile = id_incassoPagamento; + } + + public Vectumerator findByCR(CausaleContabileCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CAUSALE_CONTABILE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void deleteCascade() {} + + protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException { + return null; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/CausaleContabileCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/CausaleContabileCR.java new file mode 100644 index 00000000..b85861eb --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/CausaleContabileCR.java @@ -0,0 +1,35 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.io.Serializable; + +public class CausaleContabileCR extends CRAdapter implements Serializable { + private static final long serialVersionUID = 8044331984020899695L; + + private long id_causaleContabile; + + private String descrizione; + + public CausaleContabileCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CausaleContabileCR() {} + + public long getId_causaleContabile() { + return this.id_causaleContabile; + } + + public void setId_causaleContabile(long id_incassoPagamento) { + this.id_causaleContabile = id_incassoPagamento; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/CausaleMagazzino.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/CausaleMagazzino.java new file mode 100644 index 00000000..ff86a9bb --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/CausaleMagazzino.java @@ -0,0 +1,278 @@ +package it.acxent.contab; + +import it.acxent.anag.MagFisico; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class CausaleMagazzino extends _ContabAdapter implements Serializable { + private static final long serialVersionUID = 1393916760598955841L; + + private long id_causaleMagazzino; + + private String descrizione; + + private long id_magFisicoPartenza; + + private long id_magFisicoArrivo; + + private long flgVisualizzazioneArrivo; + + private long flgVisualizzazionePartenza; + + private long flgScaricoPartenza; + + private long flgScaricoArrivo; + + private MagFisico magFisicoPartenza; + + private MagFisico magFisicoArrivo; + + private long flgCaricoArrivo; + + private long flgCaricoPartenza; + + private long flgPartenzaInterno; + + private long flgArrivoInterno; + + private long flgArrivoLavorazione; + + private long flgPartenzaLavorazione; + + private String nota; + + public CausaleMagazzino(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CausaleMagazzino() {} + + public void setId_causaleMagazzino(long newId_causaleMagazzino) { + this.id_causaleMagazzino = newId_causaleMagazzino; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setId_magFisicoPartenza(long newId_magFisicoPartenza) { + this.id_magFisicoPartenza = newId_magFisicoPartenza; + setMagFisicoPartenza(null); + } + + public void setId_magFisicoArrivo(long newId_magFisicoArrivo) { + this.id_magFisicoArrivo = newId_magFisicoArrivo; + setMagFisicoArrivo(null); + } + + public void setFlgVisualizzazioneArrivo(long newFlgVisualizzazioneArrivo) { + this.flgVisualizzazioneArrivo = newFlgVisualizzazioneArrivo; + } + + public void setFlgVisualizzazionePartenza(long newFlgVisualizzazionePartenza) { + this.flgVisualizzazionePartenza = newFlgVisualizzazionePartenza; + } + + public void setFlgCaricoPartenza(long newFlgCaricoPartenza) { + this.flgCaricoPartenza = newFlgCaricoPartenza; + } + + public void setFlgScaricoPartenza(long newFlgScaricoPartenza) { + this.flgScaricoPartenza = newFlgScaricoPartenza; + } + + public void setFlgCaricoArrivo(long newFlgCaricoArrivo) { + this.flgCaricoArrivo = newFlgCaricoArrivo; + } + + public void setFlgScaricoArrivo(long newFlgScaricoArrivo) { + this.flgScaricoArrivo = newFlgScaricoArrivo; + } + + public long getId_causaleMagazzino() { + return this.id_causaleMagazzino; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getDescrizionePartenza() { + if (getId_magFisicoPartenza() == 0L) { + StringBuilder sb = new StringBuilder(); + if (getFlgPartenzaInterno() == 1L) + sb.append("Qualsiasi magazzino interno - "); + if (getFlgPartenzaLavorazione() == 1L) + sb.append("Qualsiasi magazzino Lav. "); + return sb.toString(); + } + return getMagFisicoPartenza().getDescrizione(); + } + + public String getDescrizioneArrivo() { + if (getId_magFisicoArrivo() == 0L) { + StringBuilder sb = new StringBuilder(); + if (getFlgArrivoInterno() == 1L) + sb.append("Qualsiasi magazzino interno - "); + if (getFlgArrivoLavorazione() == 1L) + sb.append("Qualsiasi magazzino Lav. "); + return sb.toString(); + } + return getMagFisicoArrivo().getDescrizione(); + } + + public long getId_magFisicoPartenza() { + return this.id_magFisicoPartenza; + } + + public long getId_magFisicoArrivo() { + return this.id_magFisicoArrivo; + } + + public long getFlgVisualizzazioneArrivo() { + return this.flgVisualizzazioneArrivo; + } + + public long getFlgVisualizzazionePartenza() { + return this.flgVisualizzazionePartenza; + } + + public long getFlgCaricoPartenza() { + return this.flgCaricoPartenza; + } + + public long getFlgScaricoPartenza() { + return this.flgScaricoPartenza; + } + + public long getFlgCaricoArrivo() { + return this.flgCaricoArrivo; + } + + public long getFlgScaricoArrivo() { + return this.flgScaricoArrivo; + } + + public void setMagFisicoPartenza(MagFisico newMagFisicoPartenza) { + this.magFisicoPartenza = newMagFisicoPartenza; + } + + public MagFisico getMagFisicoPartenza() { + this.magFisicoPartenza = (MagFisico)getSecondaryObject(this.magFisicoPartenza, MagFisico.class, getId_magFisicoPartenza()); + return this.magFisicoPartenza; + } + + public void setMagFisicoArrivo(MagFisico newMagFisicoArrivo) { + this.magFisicoArrivo = newMagFisicoArrivo; + } + + public MagFisico getMagFisicoArrivo() { + this.magFisicoArrivo = (MagFisico)getSecondaryObject(this.magFisicoArrivo, MagFisico.class, getId_magFisicoArrivo()); + return this.magFisicoArrivo; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(CausaleMagazzinoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CAUSALE_MAGAZZINO AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgPartenzaInterno() { + return this.flgPartenzaInterno; + } + + public void setFlgPartenzaInterno(long flgPartenzaInterno) { + this.flgPartenzaInterno = flgPartenzaInterno; + } + + public long getFlgArrivoInterno() { + return this.flgArrivoInterno; + } + + public void setFlgArrivoInterno(long flgArrivoInterno) { + this.flgArrivoInterno = flgArrivoInterno; + } + + public long getFlgArrivoLavorazione() { + return this.flgArrivoLavorazione; + } + + public void setFlgArrivoLavorazione(long flgArrivoLavorazione) { + this.flgArrivoLavorazione = flgArrivoLavorazione; + } + + public long getFlgPartenzaLavorazione() { + return this.flgPartenzaLavorazione; + } + + public void setFlgPartenzaLavorazione(long flgPartenzaLavorazione) { + this.flgPartenzaLavorazione = flgPartenzaLavorazione; + } + + public String getNota() { + return (this.nota == null) ? "" : this.nota.trim(); + } + + public void setNota(String nota) { + this.nota = nota; + } + + public ResParm save() { + if (getFlgArrivoInterno() == 1L || getFlgArrivoLavorazione() == 1L) + setId_magFisicoArrivo(0L); + if (getFlgPartenzaInterno() == 1L || getFlgPartenzaLavorazione() == 1L) + setId_magFisicoPartenza(0L); + return super.save(); + } + + public boolean isMagArrivo() { + if (getId_magFisicoArrivo() > 0L || isMagArrivoDaScegliere()) + return true; + return false; + } + + public boolean isMagPartenza() { + if (getId_magFisicoPartenza() > 0L || isMagPartenzaDaScegliere()) + return true; + return false; + } + + public boolean isMagArrivoDaScegliere() { + if (getFlgArrivoInterno() == 1L || getFlgArrivoLavorazione() == 1L) + return true; + return false; + } + + public boolean isMagPartenzaDaScegliere() { + if (getFlgPartenzaInterno() == 1L || getFlgPartenzaLavorazione() == 1L) + return true; + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/CausaleMagazzinoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/CausaleMagazzinoCR.java new file mode 100644 index 00000000..b926fde8 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/CausaleMagazzinoCR.java @@ -0,0 +1,141 @@ +package it.acxent.contab; + +import it.acxent.anag.MagFisico; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class CausaleMagazzinoCR extends CRAdapter { + private long id_causaleMagazzino; + + private String descrizione; + + private long id_magFisicoPartenza; + + private long id_magFisicoArrivo; + + private long flgVisualizzazioneArrivo; + + private long flgVisualizzazionePartenza; + + private long flgCaricoPartenza; + + private long flgScaricoPartenza; + + private long flgCaricoArrivo; + + private long flgScaricoArrivo; + + private MagFisico magFisicoPartenza; + + private MagFisico magFisicoArrivo; + + public CausaleMagazzinoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CausaleMagazzinoCR() {} + + public void setId_causaleMagazzino(long newId_causaleMagazzino) { + this.id_causaleMagazzino = newId_causaleMagazzino; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setId_magFisicoPartenza(long newId_magFisicoPartenza) { + this.id_magFisicoPartenza = newId_magFisicoPartenza; + setMagFisicoPartenza(null); + } + + public void setId_magFisicoArrivo(long newId_magFisicoArrivo) { + this.id_magFisicoArrivo = newId_magFisicoArrivo; + setMagFisicoArrivo(null); + } + + public void setFlgVisualizzazioneArrivo(long newFlgVisualizzazioneArrivo) { + this.flgVisualizzazioneArrivo = newFlgVisualizzazioneArrivo; + } + + public void setFlgVisualizzazionePartenza(long newFlgVisualizzazionePartenza) { + this.flgVisualizzazionePartenza = newFlgVisualizzazionePartenza; + } + + public void setFlgCaricoPartenza(long newFlgCaricoPartenza) { + this.flgCaricoPartenza = newFlgCaricoPartenza; + } + + public void setFlgScaricoPartenza(long newFlgScaricoPartenza) { + this.flgScaricoPartenza = newFlgScaricoPartenza; + } + + public void setFlgCaricoArrivo(long newFlgCaricoArrivo) { + this.flgCaricoArrivo = newFlgCaricoArrivo; + } + + public void setFlgScaricoArrivo(long newFlgScaricoArrivo) { + this.flgScaricoArrivo = newFlgScaricoArrivo; + } + + public long getId_causaleMagazzino() { + return this.id_causaleMagazzino; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getId_magFisicoPartenza() { + return this.id_magFisicoPartenza; + } + + public long getId_magFisicoArrivo() { + return this.id_magFisicoArrivo; + } + + public long getFlgVisualizzazioneArrivo() { + return this.flgVisualizzazioneArrivo; + } + + public long getFlgVisualizzazionePartenza() { + return this.flgVisualizzazionePartenza; + } + + public long getFlgCaricoPartenza() { + return this.flgCaricoPartenza; + } + + public long getFlgScaricoPartenza() { + return this.flgScaricoPartenza; + } + + public long getFlgCaricoArrivo() { + return this.flgCaricoArrivo; + } + + public long getFlgScaricoArrivo() { + return this.flgScaricoArrivo; + } + + public void setMagFisicoPartenza(MagFisico newMagFisicoPartenza) { + this.magFisicoPartenza = newMagFisicoPartenza; + } + + public MagFisico getMagFisicoPartenza() { + this.magFisicoPartenza = (MagFisico)getSecondaryObject(this.magFisicoPartenza, MagFisico.class, + + getId_magFisicoPartenza()); + return this.magFisicoPartenza; + } + + public void setMagFisicoArrivo(MagFisico newMagFisicoArrivo) { + this.magFisicoArrivo = newMagFisicoArrivo; + } + + public MagFisico getMagFisicoArrivo() { + this.magFisicoArrivo = (MagFisico)getSecondaryObject(this.magFisicoArrivo, MagFisico.class, + + getId_magFisicoArrivo()); + return this.magFisicoArrivo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DistintaRiba.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DistintaRiba.java new file mode 100644 index 00000000..12c0fadd --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DistintaRiba.java @@ -0,0 +1,1305 @@ +package it.acxent.contab; + +import com.lowagie.text.Cell; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Element; +import com.lowagie.text.HeaderFooter; +import com.lowagie.text.Image; +import com.lowagie.text.PageSize; +import com.lowagie.text.Phrase; +import com.lowagie.text.pdf.PdfWriter; +import it.acxent.anag.AbiCab; +import it.acxent.anag.Banca; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.FileWr; +import it.acxent.util.PdfFontFactory; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.Vectumerator; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.text.NumberFormat; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; + +public class DistintaRiba extends _ContabAdapter implements Serializable { + private static final long serialVersionUID = 7363737491608872716L; + + private long id_distintaRiba; + + private long id_banca; + + private Banca banca; + + private Date dataPresentazione; + + private double importoScadenza; + + private long flgStatoDistinta; + + private long flgAccorpaScadenze; + + private long flgContabilizzata; + + private long timestampElaborazione; + + private double importoManuale; + + private double maxDistinta; + + public static final long STATO_BOZZA = 0L; + + public static final long STATO_PRESENTATA = 1L; + + public DistintaRiba(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DistintaRiba() {} + + public Date getDataPresentazione() { + return this.dataPresentazione; + } + + public void setDataPresentazione(Date data) { + this.dataPresentazione = data; + } + + public double getImportoScadenza() { + return this.importoScadenza; + } + + public void setImportoScadenza(double importo) { + this.importoScadenza = importo; + } + + protected void deleteCascade() { + DocumentoScadenzaCR CR = new DocumentoScadenzaCR(); + CR.setId_distintaRiba(getId_distintaRiba()); + Vectumerator vec = new DocumentoScadenza(getApFull()).findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + DocumentoScadenza ds = (DocumentoScadenza)vec.nextElement(); + ds.setId_distintaRiba(0L); + ds.save(); + } + } + + protected ResParm checkDeleteCascade() { + ResParm rp = new ResParm(true); + if (getFlgContabilizzata() == 1L) { + rp.setStatus(false); + rp.setMsg("ERRORE! Impossibile eliminare, la distinta è stata contabilizzata!"); + return rp; + } + if (getFlgStatoDistinta() == 1L) { + rp.setStatus(false); + rp.setMsg("ERRORE! Impossibile eliminare, la distinta è stata presentata!"); + return rp; + } + return rp; + } + + public ResParm delete() { + return super.delete(); + } + + public ResParm save() { + return super.save(); + } + + public long getFlgStatoDistinta() { + return this.flgStatoDistinta; + } + + public void setFlgStatoDistinta(long flgTipoIncasso) { + this.flgStatoDistinta = flgTipoIncasso; + } + + public String getDescrizioneFlgStatoDistinta() { + String ret = ""; + if (getFlgStatoDistinta() == 0L) { + ret = "Bozza"; + } else if (getFlgStatoDistinta() == 1L) { + ret = "Presentata"; + } + return ret; + } + + public Vectumerator findByCR(DistintaRibaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "SELECT * FROM DISTINTA_RIBA AS A "; + String s_Sql_Order = " order by A.dataPresentazione desc, A.id_distintaRiba desc "; + WcString wc = new WcString(); + if (CR.getDataPresentazioneDa() != null) + wc.addWc(" A.dataPresentazione >= ? "); + if (CR.getDataPresentazioneA() != null) + wc.addWc(" A.dataPresentazione <= ? "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + int dataCount = 0; + if (CR.getDataPresentazioneDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataPresentazioneDa()); + } + if (CR.getDataPresentazioneA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataPresentazioneA()); + } + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ByteArrayOutputStream creaReportPdf(DistintaRibaCR CR) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + CR.setFilePdf(getPathTmpFull() + "ReportPagamenti.pdf"); + try { + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + Calendar cal = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + SimpleDateFormat sdfh = new SimpleDateFormat("hh:mm"); + Phrase pH = new Phrase("Data/ora stampa: " + sdf.format(getToday()) + " " + sdfh.format(Long.valueOf(cal.getTimeInMillis())) + " pag. "); + HeaderFooter footer = new HeaderFooter(pH, true); + footer.setAlignment(2); + footer.setBorder(0); + this.document.setFooter(footer); + this.document.open(); + boolean accorpaScadenze = false; + if (CR.getId_distintaRiba() > 0L) { + DistintaRiba bean = new DistintaRiba(getApFull()); + bean.findByPrimaryKey(CR.getId_distintaRiba()); + this.document = creaReport(bean, (bean.getFlgAccorpaScadenze() == 1L)); + } else if (CR.getTimestampElaborazione() > 0L) { + Vectumerator vec = findDistinteByTimestamp(CR.getTimestampElaborazione()); + while (vec.hasMoreElements()) { + DistintaRiba distintaRiba = (DistintaRiba)vec.nextElement(); + CR.setId_distintaRiba(distintaRiba.getId_distintaRiba()); + this.document = creaReport(distintaRiba, (distintaRiba.getFlgAccorpaScadenze() == 1L)); + if (vec.hasMoreElements()) { + this.document.setPageCount(0); + this.document.newPage(); + } + } + } + this.document.close(); + this.document = null; + FileOutputStream fos = new FileOutputStream(new File(CR.getFilePdf())); + fos.write(ba.toByteArray()); + fos.close(); + System.out.println("Creato file documento " + CR.getFilePdf()); + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + private Document creaReport(DistintaRiba bean, boolean accorpaScadenze) { + try { + prepareNewPdfCorpoDocument(); + int cellLeading = 10; + NumberFormat nf = NumberFormat.getInstance(); + nf.setMinimumFractionDigits(2); + nf.setMaximumFractionDigits(2); + int[] col = { 5, 5, 20, 5, 5 }; + DoubleOperator dp = new DoubleOperator(); + SimpleDateFormat df = getDataFormat(); + float imgLogoWidth = getDocLogoWidth(); + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + imgLogo.scaleToFit(imgLogoWidth, imgLogoWidth); + Cell cell = new Cell(); + cell.addElement(new Chunk(imgLogo, 0.0F, 0.0F)); + cell.addElement(new Chunk(" Distinta presentazione RI.BA. n. " + + bean.getId_distintaRiba() + " del " + df.format(bean.getDataPresentazione()), PdfFontFactory.PDF_fGrandeB)); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(bean.getBanca().getDescrizione(), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(20); + this.pdfcorpo.addCell(cell); + AbiCab abiCab = new AbiCab(getApFull()); + abiCab.findByAbiCab(bean.getBanca().getAbi(), bean.getBanca().getCab()); + cell = new Cell(new Chunk(abiCab.getAgenzia(), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(20); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("IBAN: " + bean.getBanca().getIban(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + long totaleRicevute = 0L; + DocumentoScadenzaCR CRds = new DocumentoScadenzaCR(); + CRds.setId_distintaRiba(bean.getId_distintaRiba()); + Vectumerator vec = new DocumentoScadenza(getApFull()).findByCR(CRds, 0, 0); + if (accorpaScadenze) + vec = accorpaScadenze(vec); + while (vec.hasMoreElements()) { + DocumentoScadenza ds = (DocumentoScadenza)vec.nextElement(); + totaleRicevute++; + cell = new Cell(new Chunk("Ord.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(1); + cell.setColspan(4); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Importo", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(1); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Scadenza", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(1); + cell.setColspan(4); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("ABI", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(1); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("CAB", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(1); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Banca", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(1); + cell.setColspan(21); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(String.valueOf(totaleRicevute), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(4); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(ds.getImportoScadenza()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(df.format(ds.getDataScadenza()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(4); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getAbi(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getCab(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getBancaDesc(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(21); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Debitore", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(16); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Indirizzo", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(12); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Località", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(10); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Prov.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(String.valueOf(ds.getDocumento().getClifor().getId_clifor()) + "-" + String.valueOf(ds.getDocumento().getClifor().getId_clifor()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(16); + cell.setMaxLines(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getIndirizzo(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(12); + cell.setMaxLines(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getCapComune() + " " + ds.getDocumento().getClifor().getCapComune(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(10); + cell.setMaxLines(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getProvinciaComune(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + cell.setMaxLines(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Rif.documento del debito", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(28); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Partita I.V.A.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Cod.Fiscale", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(7); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getListaDocumentiPdf(), PdfFontFactory.PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(28); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getPIva(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getCodFisc(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(7); + this.pdfcorpo.addCell(cell); + dp.add(ds.getImportoScadenza()); + } + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("NR° TOTALE RICEVUTE RI.BA.", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(String.valueOf(totaleRicevute), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("IMPORTO TOTALE RICEVUTE RI.BA.", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(dp.getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + } catch (Exception e) { + e.printStackTrace(); + } + return this.document; + } + + public long getId_distintaRiba() { + return this.id_distintaRiba; + } + + public void setId_distintaRiba(long id_distintaRiba) { + this.id_distintaRiba = id_distintaRiba; + } + + public long getId_banca() { + return this.id_banca; + } + + public void setId_banca(long id_banca) { + this.id_banca = id_banca; + setBanca(null); + } + + public Banca getBanca() { + this.banca = (Banca)getSecondaryObject(this.banca, Banca.class, getId_banca()); + return this.banca; + } + + public void setBanca(Banca banca) { + this.banca = banca; + } + + public long getFlgAccorpaScadenze() { + return this.flgAccorpaScadenze; + } + + public void setFlgAccorpaScadenze(long flgAccorpaScadenze) { + this.flgAccorpaScadenze = flgAccorpaScadenze; + } + + public long getFlgContabilizzata() { + return this.flgContabilizzata; + } + + public void setFlgContabilizzata(long flgContabilizzata) { + this.flgContabilizzata = flgContabilizzata; + } + + public double getImportoTotale() { + DoubleOperator dop = new DoubleOperator(); + if (getId_distintaRiba() > 0L) { + DocumentoScadenzaCR CR = new DocumentoScadenzaCR(); + CR.setId_distintaRiba(getId_distintaRiba()); + Vectumerator vec = new DocumentoScadenza(getApFull()).findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + DocumentoScadenza ds = (DocumentoScadenza)vec.nextElement(); + dop.add(ds.getImportoScadenza()); + } + } + return dop.getResult(); + } + + public Vectumerator accorpaScadenze(Vectumerator vec) { + HashMap hm = new HashMap<>(); + while (vec.hasMoreElements()) { + DocumentoScadenza ds = (DocumentoScadenza)vec.nextElement(); + if (hm.get(ds.getDataScadenza()) == null) { + ds.setListaDocumenti(ds.getDocumento().getTipoDocumento().getCodice() + " - " + ds.getDocumento().getTipoDocumento().getCodice() + " del " + ds.getDocumento().getNumeroDocumento()); + hm.put(ds.getDataScadenza(), ds); + continue; + } + DoubleOperator dop = new DoubleOperator(); + DocumentoScadenza dshm = hm.get(ds.getDataScadenza()); + dop.add(dshm.getImportoScadenza()); + dop.add(ds.getImportoScadenza()); + dshm.setImportoScadenza(dop.getResult()); + dshm.setFlgAccorpata(1L); + StringBuilder sb = new StringBuilder(dshm.getListaDocumenti()); + sb.append("
"); + sb.append(ds.getDocumento().getTipoDocumento().getCodice() + " - " + ds.getDocumento().getTipoDocumento().getCodice() + " del " + ds.getDocumento().getNumeroDocumento()); + dshm.setListaDocumenti(sb.toString()); + hm.put(ds.getDataScadenza(), dshm); + } + vec = new Vectumerator(); + Map map = hm; + for (Map.Entry entry : map.entrySet()) + vec.add(entry.getValue()); + vec.sort((o1, o2) -> o1.getDataScadenza().compareTo(o2.getDataScadenza())); + return vec; + } + + public ResParm creaFile() { + ResParm rp = new ResParm(true); + try { + System.out.println("Inizio creazione file"); + SimpleDateFormat df = new SimpleDateFormat("HHmm"); + String orario = df.format(getNow()).replace(":", ""); + String nomeFile = getBanca().getCodiceAlt() + "-" + getBanca().getCodiceAlt() + ".TXT"; + String path = getDocBase() + getDocBase() + getParm("PATH_FILE_RIBA").getTesto(); + if (!new File(path).exists()) + new File(path).mkdirs(); + String retPath = "../../" + getParm("PATH_FILE_RIBA").getTesto() + nomeFile; + String codiceSia = getParm("AZIENDA_CODICE_SIA").getTesto(); + String abi = getBanca().getAbi(); + String cab = getBanca().getCab(); + String conto = getBanca().getConto(); + String data = getDateInline(getDataPresentazione()); + String pIvaAzienda = getParm("AZIENDA_PIVA").getTesto(); + if (cab.isEmpty() || abi.isEmpty() || conto.isEmpty() || pIvaAzienda.isEmpty()) + return new ResParm(false, "ERRORE! mancano gli estremi della banca o la partita iva dell'azienda"); + long lenNomeFile = (long)nomeFile.length(); + int fillerPrimaRiga = (int)(20L - lenNomeFile + 74L); + int fillerUltimaRiga = (int)(20L - lenNomeFile + 6L); + File fileExist = new File(path); + if (fileExist.exists()) + fileExist.delete(); + fileExist = null; + FileWr f = new FileWr(path); + f.setAppend(false); + f.setDosNl(true); + StringBuilder sb = new StringBuilder(); + sb.append(" "); + sb.append("IB"); + sb.append(spaceRight(codiceSia, 5)); + sb.append(spaceRight(abi, 5)); + sb.append(data); + sb.append(spaceRight(nomeFile, 20)); + sb.append(spaceLeft("", 74)); + sb.append("E"); + sb.append(spaceLeft("", 6)); + f.writeLine(sb.toString()); + long progressivo = 0L; + DoubleOperator importiNegativi = new DoubleOperator(); + DocumentoScadenzaCR CR = new DocumentoScadenzaCR(); + CR.setId_distintaRiba(getId_distintaRiba()); + Vectumerator vec = new DocumentoScadenza(getApFull()).findByCR(CR, 0, 0); + if (getFlgAccorpaScadenze() == 1L) + vec = accorpaScadenze(vec); + while (vec.hasMoreElements()) { + progressivo++; + DocumentoScadenza scad = (DocumentoScadenza)vec.nextElement(); + sb = new StringBuilder(); + sb.append(" "); + sb.append("14"); + sb.append(zeroLeft(progressivo, 7)); + sb.append(spaceLeft("", 12)); + sb.append(getDateInline(scad.getDataScadenza())); + sb.append("30000"); + sb.append(zeroLeft(getImportoInCentesimi(scad.getImportoScadenza()), 13)); + importiNegativi.add(scad.getImportoScadenza()); + sb.append("-"); + sb.append(spaceRight(abi, 5)); + sb.append(spaceRight(cab, 5)); + sb.append(spaceRight(conto, 12)); + sb.append(spaceRight(scad.getDocumento().getClifor().getAbi(), 5)); + sb.append(spaceRight(scad.getDocumento().getClifor().getCab(), 5)); + sb.append(spaceLeft("", 12)); + sb.append(spaceLeft(codiceSia, 5)); + sb.append("4"); + sb.append(spaceLeft("", 22)); + sb.append("E"); + f.writeLine(sb.toString()); + sb = new StringBuilder(); + sb.append(" "); + sb.append("20"); + sb.append(zeroLeft(progressivo, 7)); + sb.append(spaceRight("C.T. EXPRESS S.C.R.L. VIA G. DI VITTORIO 50052 EMPOLI FI", 96)); + sb.append(spaceRight("", 14)); + f.writeLine(sb.toString()); + String descrizioneCliente = scad.getDocumento().getClifor().getDescrizioneCliente(); + String segmentoUno = descrizioneCliente.substring(0, (descrizioneCliente.length() > 19) ? 19 : descrizioneCliente.length()); + String segmentoDue = ""; + if (descrizioneCliente.length() > 19) + segmentoDue = descrizioneCliente.substring(19, (descrizioneCliente.length() > 39) ? 39 : descrizioneCliente.length()); + sb = new StringBuilder(); + sb.append(" "); + sb.append("30"); + sb.append(zeroLeft(progressivo, 7)); + sb.append(spaceRight(descrizioneCliente.substring(0, (descrizioneCliente.length() > 59) ? 59 : descrizioneCliente.length()), 60)); + sb.append(spaceRight(scad.getDocumento().getClifor().getCodFisc(), 16)); + sb.append(spaceRight("", 34)); + f.writeLine(sb.toString()); + sb = new StringBuilder(); + sb.append(" "); + sb.append("40"); + sb.append(zeroLeft(progressivo, 7)); + sb.append(spaceRight(scad.getDocumento().getClifor().getIndirizzo(), 30)); + sb.append(spaceRight(scad.getDocumento().getClifor().getCapComune(), 5)); + sb.append(spaceRight( + scad.getDocumento().getClifor().getDescrizioneComune() + " " + scad.getDocumento().getClifor().getDescrizioneComune(), 25)); + sb.append(spaceRight("", 50)); + f.writeLine(sb.toString()); + String fatture = scad.getListaDocumenti().isEmpty() ? scad.getDocumento().getNumeroDocumento() : scad.getListaDocumenti(); + fatture = fatture.replace("
", " "); + segmentoUno = fatture.substring(0, (fatture.length() > 39) ? 39 : fatture.length()); + segmentoDue = ""; + if (fatture.length() > 39) + segmentoDue = fatture.substring(39, (fatture.length() > 79) ? 79 : fatture.length()); + sb = new StringBuilder(); + sb.append(" "); + sb.append("50"); + sb.append(zeroLeft(progressivo, 7)); + sb.append(spaceRight(segmentoUno, 40)); + sb.append(spaceRight(segmentoDue, 40)); + sb.append(spaceRight("", 10)); + sb.append(spaceRight(pIvaAzienda, 16)); + sb.append(spaceRight("", 4)); + f.writeLine(sb.toString()); + sb = new StringBuilder(); + sb.append(" "); + sb.append("51"); + sb.append(zeroLeft(progressivo, 7)); + sb.append(zeroLeft(progressivo, 10)); + sb.append(spaceRight("C.T. EXPRESS S.C.R.L. ", 20)); + sb.append(spaceRight("", 80)); + f.writeLine(sb.toString()); + sb = new StringBuilder(); + sb.append(" "); + sb.append("70"); + sb.append(zeroLeft(progressivo, 7)); + sb.append(spaceRight("", 110)); + f.writeLine(sb.toString()); + } + sb = new StringBuilder(); + sb.append(" "); + sb.append("EF"); + sb.append(spaceLeft(codiceSia, 5)); + sb.append(spaceLeft(abi, 5)); + sb.append(spaceLeft(data, 6)); + sb.append(nomeFile); + sb.append(spaceLeft("", fillerUltimaRiga)); + sb.append(zeroLeft(progressivo, 7)); + sb.append(zeroLeft(getImportoInCentesimi(importiNegativi.getResult()), 15)); + sb.append(zeroLeft(0, 15)); + long numeroRecord = progressivo * 7L + 2L; + sb.append(zeroLeft(numeroRecord, 7)); + sb.append(spaceLeft("", 24)); + sb.append("E"); + sb.append(spaceLeft("", 6)); + f.writeLine(sb.toString()); + f.closeFile(); + setFlgStatoDistinta(1L); + save(); + System.out.println("File creato!"); + rp.setMsg(retPath); + } catch (Exception e) { + handleDebug(e); + rp.setException(e); + rp.setStatus(false); + } + return rp; + } + + public long getTimestampElaborazione() { + return this.timestampElaborazione; + } + + public void setTimestampElaborazione(long timestampElaborazione) { + this.timestampElaborazione = timestampElaborazione; + } + + public void findDistintaByTimestampBanca(long l_timestamp, long id_banca) { + String s_Sql_Find = "SELECT * FROM DISTINTA_RIBA AS A "; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc(" A.timestampElaborazione = " + l_timestamp); + wc.addWc(" A.id_banca = " + id_banca); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findDistinteByTimestamp(long l_timestamp) { + String s_Sql_Find = "SELECT * FROM DISTINTA_RIBA AS A "; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc(" A.timestampElaborazione = " + l_timestamp); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getImportoManuale() { + return this.importoManuale; + } + + public void setImportoManuale(double importoManuale) { + this.importoManuale = importoManuale; + } + + public Vectumerator findDistinte() { + String s_Sql_Find = "SELECT A.timestampElaborazione, A.dataPresentazione FROM DISTINTA_RIBA AS A "; + String s_Sql_Group = " GROUP BY A.timestampElaborazione "; + String s_Sql_Order = " ORDER BY A.dataPresentazione DESC limit 10"; + WcString wc = new WcString(); + wc.addWc("(A.flgStatoDistinta is null or A.flgStatoDistinta=0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getMaxDistinta() { + return this.maxDistinta; + } + + public void setMaxDistinta(double maxDistinta) { + this.maxDistinta = maxDistinta; + } + + public ResParm creaFile2() { + ResParm rp = new ResParm(true); + try { + System.out.println("Inizio creazione file"); + SimpleDateFormat df = new SimpleDateFormat("HHmm"); + String orario = df.format(getNow()).replace(":", ""); + String nomeFile = getBanca().getCodiceAlt() + "-" + getBanca().getCodiceAlt() + ".TXT"; + String path = getDocBase() + getDocBase() + getParm("PATH_FILE_RIBA").getTesto(); + if (!new File(path).exists()) + new File(path).mkdirs(); + String retPath = "../../" + getParm("PATH_FILE_RIBA").getTesto() + nomeFile; + String codiceSia = getParm("AZIENDA_CODICE_SIA").getTesto(); + String abi = getBanca().getAbi(); + String cab = getBanca().getCab(); + String conto = getBanca().getConto(); + String data = getDateInline(getDataPresentazione()); + String pIvaAzienda = getParm("AZIENDA_PIVA").getTesto(); + if (cab.isEmpty() || abi.isEmpty() || conto.isEmpty() || pIvaAzienda.isEmpty()) + return new ResParm(false, "ERRORE! mancano gli estremi della banca o la partita iva dell'azienda"); + long lenNomeFile = (long)nomeFile.length(); + int fillerPrimaRiga = (int)(20L - lenNomeFile + 74L); + int fillerUltimaRiga = (int)(20L - lenNomeFile + 6L); + File fileExist = new File(path); + if (fileExist.exists()) + fileExist.delete(); + fileExist = null; + FileWr f = new FileWr(path); + f.setAppend(false); + StringBuilder sb = new StringBuilder(); + sb.append(" "); + sb.append("IB"); + sb.append(codiceSia); + sb.append(abi); + sb.append(data); + sb.append(nomeFile); + sb.append(spaceLeft("", fillerPrimaRiga)); + sb.append("E"); + sb.append(spaceLeft("", 6)); + f.writeLine(sb.toString()); + long progressivo = 1L; + DocumentoScadenzaCR CR = new DocumentoScadenzaCR(); + CR.setId_distintaRiba(getId_distintaRiba()); + Vectumerator vec = new DocumentoScadenza(getApFull()).findByCR(CR, 0, 0); + if (getFlgAccorpaScadenze() == 1L) + vec = accorpaScadenze(vec); + while (vec.hasMoreElements()) { + DocumentoScadenza scad = (DocumentoScadenza)vec.nextElement(); + sb = new StringBuilder(); + sb.append(" "); + sb.append("14"); + sb.append(zeroLeft(progressivo, 7)); + sb.append(spaceLeft("", 11)); + sb.append(getDateInline(scad.getDataScadenza())); + sb.append("30000"); + sb.append(zeroLeft(getImportoInCentesimi(scad.getImportoScadenza()), 13)); + sb.append("-"); + sb.append(abi); + sb.append(cab); + sb.append(spaceRight(conto, 12)); + sb.append(spaceRight(scad.getDocumento().getClifor().getAbi(), 5)); + sb.append(spaceRight(scad.getDocumento().getClifor().getCab(), 5)); + sb.append(spaceLeft("", 12)); + sb.append(codiceSia); + sb.append(spaceLeft("", 22)); + sb.append("E"); + f.writeLine(sb.toString()); + sb = new StringBuilder(); + sb.append(" "); + sb.append("20"); + sb.append(zeroLeft(progressivo, 7)); + sb.append(spaceRight("C.T. EXPRESS S.C.R.L. VI", 24)); + sb.append(spaceRight("A G. DI VITTORIO 50052 E", 24)); + sb.append(spaceRight("MPOLI FI", 24)); + sb.append(spaceRight("", 24)); + sb.append(spaceRight("", 14)); + f.writeLine(sb.toString()); + String descrizioneCliente = scad.getDocumento().getClifor().getDescrizioneCliente(); + String segmentoUno = descrizioneCliente.substring(0, (descrizioneCliente.length() > 19) ? 19 : descrizioneCliente.length()); + String segmentoDue = ""; + if (descrizioneCliente.length() > 19) + segmentoDue = descrizioneCliente.substring(19, (descrizioneCliente.length() > 39) ? 39 : descrizioneCliente.length()); + sb = new StringBuilder(); + sb.append(" "); + sb.append("30"); + sb.append(zeroLeft(progressivo, 7)); + sb.append(spaceRight(segmentoUno, 20)); + sb.append(spaceRight(segmentoDue, 20)); + sb.append(spaceRight(scad.getDocumento().getClifor().getCodFisc(), 16)); + sb.append(spaceRight("", 34)); + f.writeLine(sb.toString()); + sb = new StringBuilder(); + sb.append(" "); + sb.append("40"); + sb.append(zeroLeft(progressivo, 7)); + sb.append(spaceRight(scad.getDocumento().getClifor().getIndirizzo(), 20)); + sb.append(spaceRight(scad.getDocumento().getClifor().getCapComune(), 5)); + sb.append(spaceRight( + scad.getDocumento().getClifor().getDescrizioneComune() + scad.getDocumento().getClifor().getDescrizioneComune(), 25)); + sb.append(spaceRight("", 50)); + f.writeLine(sb.toString()); + String fatture = scad.getListaDocumenti().isEmpty() ? scad.getDocumento().getNumeroDocumento() : scad.getListaDocumenti(); + fatture = fatture.replace("
", " "); + segmentoUno = fatture.substring(0, (fatture.length() > 39) ? 39 : fatture.length()); + segmentoDue = ""; + if (fatture.length() > 39) + segmentoDue = fatture.substring(39, (fatture.length() > 79) ? 79 : fatture.length()); + sb = new StringBuilder(); + sb.append(" "); + sb.append("50"); + sb.append(zeroLeft(progressivo, 7)); + sb.append(spaceRight(segmentoUno, 40)); + sb.append(spaceRight(segmentoDue, 40)); + sb.append(spaceRight("", 10)); + sb.append(spaceRight(pIvaAzienda, 16)); + sb.append(spaceRight("", 4)); + f.writeLine(sb.toString()); + sb = new StringBuilder(); + sb.append(" "); + sb.append("51"); + sb.append(zeroLeft(progressivo, 7)); + sb.append(zeroLeft(progressivo, 10)); + sb.append(spaceRight("C.T. EXPRESS S.C.R.L. ", 20)); + sb.append(spaceRight("", 80)); + f.writeLine(sb.toString()); + sb = new StringBuilder(); + sb.append(" "); + sb.append("70"); + sb.append(zeroLeft(progressivo, 7)); + sb.append(zeroLeft(progressivo, 10)); + sb.append(spaceRight("", 110)); + f.writeLine(sb.toString()); + progressivo++; + } + sb = new StringBuilder(); + sb.append(" "); + sb.append("EF"); + sb.append(codiceSia); + sb.append(abi); + sb.append(data); + sb.append(nomeFile); + sb.append(spaceLeft("", fillerUltimaRiga)); + sb.append(zeroLeft(0, 7)); + sb.append(zeroLeft(0, 15)); + sb.append(zeroLeft(0, 15)); + sb.append(zeroLeft(0, 7)); + sb.append(spaceLeft("", 24)); + sb.append("E"); + sb.append(spaceLeft("", 6)); + f.writeLine(sb.toString()); + f.closeFile(); + setFlgStatoDistinta(1L); + save(); + System.out.println("File creato!"); + rp.setMsg(retPath); + } catch (Exception e) { + handleDebug(e); + rp.setException(e); + rp.setStatus(false); + } + return rp; + } + + private Document creaReportOld(DistintaRibaCR CR) { + try { + prepareNewPdfCorpoDocument(); + int cellLeading = 10; + NumberFormat nf = NumberFormat.getInstance(); + nf.setMinimumFractionDigits(2); + nf.setMaximumFractionDigits(2); + int[] col = { 5, 5, 20, 5, 5 }; + DoubleOperator dp = new DoubleOperator(); + SimpleDateFormat df = getDataFormat(); + float imgLogoWidth = getDocLogoWidth(); + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + imgLogo.scaleToFit(imgLogoWidth, imgLogoWidth); + Cell cell = new Cell(); + cell.addElement(new Chunk(imgLogo, 0.0F, 0.0F)); + cell.addElement(new Chunk(" Distinta presentazione RI.BA. n. " + + getId_distintaRiba() + " del " + df.format(getDataPresentazione()), PdfFontFactory.PDF_fGrandeB)); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getBanca().getDescrizione(), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(20); + this.pdfcorpo.addCell(cell); + AbiCab abiCab = new AbiCab(getApFull()); + abiCab.findByAbiCab(getBanca().getAbi(), getBanca().getCab()); + cell = new Cell(new Chunk(abiCab.getAgenzia(), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(20); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("IBAN: " + getBanca().getIban(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + long totaleRicevute = 0L; + DocumentoScadenzaCR CRds = new DocumentoScadenzaCR(); + CRds.setId_distintaRiba(CR.getId_distintaRiba()); + Vectumerator vec = new DocumentoScadenza(getApFull()).findByCR(CRds, 0, 0); + if (CR.getFlgAccorpaScadenze() == 1L || getFlgAccorpaScadenze() == 1L) + vec = accorpaScadenze(vec); + while (vec.hasMoreElements()) { + DocumentoScadenza ds = (DocumentoScadenza)vec.nextElement(); + cell = new Cell(new Chunk("Ord.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(1); + cell.setColspan(4); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Importo", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(1); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Scadenza", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(1); + cell.setColspan(4); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("ABI", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(1); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("CAB", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(1); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Banca", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(1); + cell.setColspan(21); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(String.valueOf(totaleRicevute), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(4); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(ds.getImportoScadenza()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(df.format(ds.getDataScadenza()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(4); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getAbi(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getCab(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getBancaDesc(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(21); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Cod.cliente", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(4); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Debitore", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Indirizzo", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(10); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Località", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(6); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Prov.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(String.valueOf(ds.getDocumento().getClifor().getId_clifor()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(4); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getDescrizioneCliente(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getIndirizzo(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(10); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getDescrizioneComune(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(6); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getProvinciaComune(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Rif.documento del debito", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(20); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Partita totaleRicevute.V.A.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(10); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Cod.Fiscale", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(10); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getListaDocumentiPdf(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(20); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getPIva(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(10); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(ds.getDocumento().getClifor().getCodFisc(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(10); + this.pdfcorpo.addCell(cell); + dp.add(ds.getImportoScadenza()); + totaleRicevute++; + } + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("NR° TOTALE RICEVUTE RI.BA.", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(String.valueOf(totaleRicevute), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("IMPORTO TOTALE RICEVUTE RI.BA.", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(dp.getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + } catch (Exception e) { + e.printStackTrace(); + } + return this.document; + } + + public ByteArrayOutputStream creaReportPdfOLD____(DistintaRibaCR CR) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + Calendar cal = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + SimpleDateFormat sdfh = new SimpleDateFormat("hh:mm"); + Phrase pH = new Phrase("Data/ora stampa: " + sdf.format(getToday()) + " " + sdfh.format(Long.valueOf(cal.getTimeInMillis())) + " pag. "); + HeaderFooter footer = new HeaderFooter(pH, true); + footer.setAlignment(2); + footer.setBorder(0); + this.document.setFooter(footer); + this.document.open(); + CR.setFilePdf(getPathTmpFull() + "ReportPagamenti.pdf"); + this.document.close(); + this.document = null; + FileOutputStream fos = new FileOutputStream(new File(CR.getFilePdf())); + fos.write(ba.toByteArray()); + fos.close(); + System.out.println("Creato file documento " + CR.getFilePdf()); + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DistintaRibaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DistintaRibaCR.java new file mode 100644 index 00000000..603401c1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DistintaRibaCR.java @@ -0,0 +1,150 @@ +package it.acxent.contab; + +import it.acxent.anag.Banca; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class DistintaRibaCR extends CRAdapter { + private long id_distintaRiba; + + private long id_banca; + + private Banca banca; + + private Date dataPresentazione; + + private Date dataPresentazioneDa; + + private Date dataPresentazioneA; + + private double importoScadenza; + + private long flgStatoDistinta; + + private long flgAccorpaScadenze; + + private long flgContabilizzata; + + private String filePdf; + + private long timestampElaborazione; + + public static final long STATO_BOZZA = 0L; + + public static final long STATO_PRESENTATA = 1L; + + public DistintaRibaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DistintaRibaCR() {} + + public Date getDataPresentazione() { + return this.dataPresentazione; + } + + public void setDataPresentazione(Date data) { + this.dataPresentazione = data; + } + + public double getImportoScadenza() { + return this.importoScadenza; + } + + public void setImportoScadenza(double importo) { + this.importoScadenza = importo; + } + + public long getFlgStatoDistinta() { + return this.flgStatoDistinta; + } + + public void setFlgStatoDistinta(long flgTipoIncasso) { + this.flgStatoDistinta = flgTipoIncasso; + } + + public String getDescrizioneFlgStatoDistinta() { + String ret = ""; + if (getFlgStatoDistinta() == 0L) { + ret = "Bozza"; + } else if (getFlgStatoDistinta() == 1L) { + ret = "Presentata"; + } + return ret; + } + + public long getId_distintaRiba() { + return this.id_distintaRiba; + } + + public void setId_distintaRiba(long id_distintaRiba) { + this.id_distintaRiba = id_distintaRiba; + } + + public long getId_banca() { + return this.id_banca; + } + + public void setId_banca(long id_banca) { + this.id_banca = id_banca; + setBanca(null); + } + + public Banca getBanca() { + this.banca = (Banca)getSecondaryObject(this.banca, Banca.class, getId_banca()); + return this.banca; + } + + public void setBanca(Banca banca) { + this.banca = banca; + } + + public long getFlgAccorpaScadenze() { + return this.flgAccorpaScadenze; + } + + public void setFlgAccorpaScadenze(long flgAccorpaScadenze) { + this.flgAccorpaScadenze = flgAccorpaScadenze; + } + + public long getFlgContabilizzata() { + return this.flgContabilizzata; + } + + public void setFlgContabilizzata(long flgContabilizzata) { + this.flgContabilizzata = flgContabilizzata; + } + + public Date getDataPresentazioneDa() { + return this.dataPresentazioneDa; + } + + public void setDataPresentazioneDa(Date dataPresentazioneDa) { + this.dataPresentazioneDa = dataPresentazioneDa; + } + + public Date getDataPresentazioneA() { + return this.dataPresentazioneA; + } + + public void setDataPresentazioneA(Date dataPresentazioneA) { + this.dataPresentazioneA = dataPresentazioneA; + } + + public String getFilePdf() { + return (this.filePdf == null) ? AB_EMPTY_STRING : this.filePdf; + } + + public void setFilePdf(String filePdf) { + this.filePdf = filePdf; + } + + public long getTimestampElaborazione() { + return this.timestampElaborazione; + } + + public void setTimestampElaborazione(long timestampElaborazione) { + this.timestampElaborazione = timestampElaborazione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocFiglioPadre.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocFiglioPadre.java new file mode 100644 index 00000000..e4d04902 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocFiglioPadre.java @@ -0,0 +1,164 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class DocFiglioPadre extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1564387437366L; + + private long id_docFiglioPadre; + + private long id_documentoPadre; + + private long id_documentoFiglio; + + private Documento documentoPadre; + + private Documento documentoFiglio; + + public DocFiglioPadre(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DocFiglioPadre() {} + + public void setId_docFiglioPadre(long newId_documentoPF) { + this.id_docFiglioPadre = newId_documentoPF; + } + + public void setId_documentoPadre(long newId_documentoPadre) { + this.id_documentoPadre = newId_documentoPadre; + setDocumentoPadre(null); + } + + public void setId_documentoFiglio(long newId_documentoFiglio) { + this.id_documentoFiglio = newId_documentoFiglio; + setDocumentoFiglio(null); + } + + public long getId_docFiglioPadre() { + return this.id_docFiglioPadre; + } + + public long getId_documentoPadre() { + return this.id_documentoPadre; + } + + public long getId_documentoFiglio() { + return this.id_documentoFiglio; + } + + public void setDocumentoPadre(Documento newDocumentoPadre) { + this.documentoPadre = newDocumentoPadre; + } + + public Documento getDocumentoPadre() { + this.documentoPadre = (Documento)getSecondaryObject(this.documentoPadre, Documento.class, getId_documentoPadre()); + return this.documentoPadre; + } + + public void setDocumentoFiglio(Documento newDocumentoFiglio) { + this.documentoFiglio = newDocumentoFiglio; + } + + public Documento getDocumentoFiglio() { + this.documentoFiglio = (Documento)getSecondaryObject(this.documentoFiglio, Documento.class, getId_documentoFiglio()); + return this.documentoFiglio; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(DocFiglioPadreCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from DOC_FIGLIO_PADRE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByFiglioPadre(long l_id_documentoFiglio, long l_id_documentoPadre) { + String s_Sql_Find = "select A.* from DOC_FIGLIO_PADRE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_documentoFiglio=" + l_id_documentoFiglio); + wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public Vectumerator findByFiglio(long l_id_documentoFiglio) { + String s_Sql_Find = "select A.* from DOC_FIGLIO_PADRE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_documentoFiglio=" + l_id_documentoFiglio); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByPadre(long l_id_documentoPadre) { + String s_Sql_Find = "select A.* from DOC_FIGLIO_PADRE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm delete() { + if (getDocumentoFiglio().getTipoDocumento().getFlgTipologia() == 210L) { + getDocumentoFiglio().setFlgStatoLavorazione(0L); + getDocumentoFiglio().superSave(); + } + return super.delete(); + } + + protected void afterDelete() { + super.afterDelete(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocFiglioPadreCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocFiglioPadreCR.java new file mode 100644 index 00000000..394f29f8 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocFiglioPadreCR.java @@ -0,0 +1,70 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class DocFiglioPadreCR extends CRAdapter { + private long id_docFiglioPadre; + + private long id_documentoPadre; + + private long id_documentoFiglio; + + private Documento documentoPadre; + + private Documento documentoFiglio; + + public DocFiglioPadreCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DocFiglioPadreCR() {} + + public void setId_docFiglioPadre(long newId_documentoPF) { + this.id_docFiglioPadre = newId_documentoPF; + } + + public void setId_documentoPadre(long newId_documentoPadre) { + this.id_documentoPadre = newId_documentoPadre; + setDocumentoPadre(null); + } + + public void setId_documentoFiglio(long newId_documentoFiglio) { + this.id_documentoFiglio = newId_documentoFiglio; + setDocumentoFiglio(null); + } + + public long getId_docFiglioPadre() { + return this.id_docFiglioPadre; + } + + public long getId_documentoPadre() { + return this.id_documentoPadre; + } + + public long getId_documentoFiglio() { + return this.id_documentoFiglio; + } + + public void setDocumentoPadre(Documento newDocumentoPadre) { + this.documentoPadre = newDocumentoPadre; + } + + public Documento getDocumentoPadre() { + this.documentoPadre = (Documento)getSecondaryObject(this.documentoPadre, Documento.class, + + getId_documentoPadre()); + return this.documentoPadre; + } + + public void setDocumentoFiglio(Documento newDocumentoFiglio) { + this.documentoFiglio = newDocumentoFiglio; + } + + public Documento getDocumentoFiglio() { + this.documentoFiglio = (Documento)getSecondaryObject(this.documentoFiglio, Documento.class, + + getId_documentoFiglio()); + return this.documentoFiglio; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocPrel.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocPrel.java new file mode 100644 index 00000000..8059c3fc --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocPrel.java @@ -0,0 +1,199 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class DocPrel extends _ContabAdapter implements Serializable { + public static final long TIPO_GENERAZIONE_RIGA_0 = 0L; + + public static final long TIPO_GENERAZIONE_DOC_1 = 1L; + + public static final long TIPO_GENERAZIONE_TIPO_ART_2 = 2L; + + private long id_docPrel; + + private long id_tipoDocumentoPrel; + + private long id_tipoDocumento; + + private TipoDocumento tipoDocumentoPrel; + + private TipoDocumento tipoDocumento; + + private long flgTipoGenerazione; + + public DocPrel(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DocPrel() {} + + public static final String getTipoGenerazione(long l_flgTipoGenerazione) { + if (l_flgTipoGenerazione == 0L) + return "Riga Riga"; + if (l_flgTipoGenerazione == 1L) + return "Per documento"; + if (l_flgTipoGenerazione == 2L) + return "Per tipo articolo/riga"; + return ""; + } + + public String getTipoGenerazione() { + return getTipoGenerazione(getFlgTipoGenerazione()); + } + + public void setId_docPrel(long newId_docPrel) { + this.id_docPrel = newId_docPrel; + } + + public void setId_tipoDocumentoPrel(long newId_tipoDocumentoPrel) { + this.id_tipoDocumentoPrel = newId_tipoDocumentoPrel; + setTipoDocumentoPrel(null); + } + + public void setId_tipoDocumento(long newId_tipoDocumento) { + this.id_tipoDocumento = newId_tipoDocumento; + setTipoDocumento(null); + } + + public long getId_docPrel() { + return this.id_docPrel; + } + + public long getId_tipoDocumentoPrel() { + return this.id_tipoDocumentoPrel; + } + + public long getId_tipoDocumento() { + return this.id_tipoDocumento; + } + + public void setTipoDocumentoPrel(TipoDocumento newTipoDocumentoPrel) { + this.tipoDocumentoPrel = newTipoDocumentoPrel; + } + + public TipoDocumento getTipoDocumentoPrel() { + this.tipoDocumentoPrel = (TipoDocumento)getSecondaryObject(this.tipoDocumentoPrel, TipoDocumento.class, getId_tipoDocumentoPrel()); + return this.tipoDocumentoPrel; + } + + public void setTipoDocumento(TipoDocumento newTipoDocumento) { + this.tipoDocumento = newTipoDocumento; + } + + public TipoDocumento getTipoDocumento() { + this.tipoDocumento = (TipoDocumento)getSecondaryObject(this.tipoDocumento, TipoDocumento.class, getId_tipoDocumento()); + return this.tipoDocumento; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(DocPrelCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from DOC_PREL AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByTipoDocumentoTipoDocumentoPrel(long l_id_tipoDocumento, long l_id_tipoDocumentoPrel) { + String s_Sql_Find = "select A.* from DOC_PREL AS A"; + String s_Sql_order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_tipoDocumento=" + l_id_tipoDocumento); + wc.addWc("A.id_tipoDocumentoPrel=" + l_id_tipoDocumentoPrel); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 0); + } + } + + public Vectumerator findPrelevabiliByTipoDocumentoGen(long l_id_tipoDocumento, long l_tipoRicerca, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from DOC_PREL AS A,TIPO_DOCUMENTO AS B"; + String s_Sql_order = " order by B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_tipoDocumentoPrel=B.id_tipoDocumento"); + wc.addWc("A.id_tipoDocumento=" + l_id_tipoDocumento); + if (l_tipoRicerca == 1L) { + wc.addWc("(B.flgUsato is null or B.flgUsato=0)"); + } else if (l_tipoRicerca == 2L) { + wc.addWc("B.flgUsato=1"); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findGenerabiliByTipoDocumentoPrel(long l_id_tipoDocumentoPrel, long l_flgUsato, long l_id_tipologiaDocumento, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from DOC_PREL AS A,TIPO_DOCUMENTO AS B"; + String s_Sql_order = " order by B.ordineNuovoDocumento, B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_tipoDocumento=B.id_tipoDocumento"); + wc.addWc("A.id_tipoDocumentoPrel=" + l_id_tipoDocumentoPrel); + if (l_flgUsato == 1L) { + wc.addWc("(B.flgUsato is null or B.flgUsato=0)"); + } else if (l_flgUsato == 2L) { + wc.addWc("B.flgUsato=1"); + } + if (l_id_tipologiaDocumento > 0L) + wc.addWc("B.id_tipologiaDocumento=" + l_id_tipologiaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByTipoDocumentoGenPrel(long l_id_tipoDocumentoGen, long l_id_tipoDocumentoPrel) { + String s_Sql_Find = "select A.* from DOC_PREL AS A,TIPO_DOCUMENTO AS B"; + String s_Sql_order = " order by B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_tipoDocumentoPrel=B.id_tipoDocumento"); + wc.addWc("A.id_tipoDocumentoPrel=" + l_id_tipoDocumentoPrel); + wc.addWc("A.id_tipoDocumento=" + l_id_tipoDocumentoGen); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 0); + } + } + + public long getFlgTipoGenerazione() { + return this.flgTipoGenerazione; + } + + public void setFlgTipoGenerazione(long flgTipoGenerazione) { + this.flgTipoGenerazione = flgTipoGenerazione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocPrelCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocPrelCR.java new file mode 100644 index 00000000..39c6d7db --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocPrelCR.java @@ -0,0 +1,70 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class DocPrelCR extends CRAdapter { + private long id_docPrel; + + private long id_tipoDocumentoPrel; + + private long id_tipoDocumento; + + private TipoDocumento tipoDocumentoPrel; + + private TipoDocumento tipoDocumento; + + public DocPrelCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DocPrelCR() {} + + public void setId_docPrel(long newId_docPrel) { + this.id_docPrel = newId_docPrel; + } + + public void setId_tipoDocumentoPrel(long newId_tipoDocumentoPrel) { + this.id_tipoDocumentoPrel = newId_tipoDocumentoPrel; + setTipoDocumentoPrel(null); + } + + public void setId_tipoDocumento(long newId_tipoDocumento) { + this.id_tipoDocumento = newId_tipoDocumento; + setTipoDocumento(null); + } + + public long getId_docPrel() { + return this.id_docPrel; + } + + public long getId_tipoDocumentoPrel() { + return this.id_tipoDocumentoPrel; + } + + public long getId_tipoDocumento() { + return this.id_tipoDocumento; + } + + public void setTipoDocumentoPrel(TipoDocumento newTipoDocumentoPrel) { + this.tipoDocumentoPrel = newTipoDocumentoPrel; + } + + public TipoDocumento getTipoDocumentoPrel() { + this.tipoDocumentoPrel = (TipoDocumento)getSecondaryObject(this.tipoDocumentoPrel, TipoDocumento.class, + + getId_tipoDocumentoPrel()); + return this.tipoDocumentoPrel; + } + + public void setTipoDocumento(TipoDocumento newTipoDocumento) { + this.tipoDocumento = newTipoDocumento; + } + + public TipoDocumento getTipoDocumento() { + this.tipoDocumento = (TipoDocumento)getSecondaryObject(this.tipoDocumento, TipoDocumento.class, + + getId_tipoDocumento()); + return this.tipoDocumento; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/Documento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/Documento.java new file mode 100644 index 00000000..abc8b13d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/Documento.java @@ -0,0 +1,22525 @@ +package it.acxent.contab; + +import com.lowagie.text.Cell; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.HeaderFooter; +import com.lowagie.text.Image; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Phrase; +import com.lowagie.text.Rectangle; +import com.lowagie.text.Table; +import com.lowagie.text.pdf.Barcode128; +import com.lowagie.text.pdf.PdfContentByte; +import com.lowagie.text.pdf.PdfPCell; +import com.lowagie.text.pdf.PdfPTable; +import com.lowagie.text.pdf.PdfWriter; +import it.acxent.anag.Aspetto; +import it.acxent.anag.Banca; +import it.acxent.anag.CausaleTrasporto; +import it.acxent.anag.Clifor; +import it.acxent.anag.Comune; +import it.acxent.anag.DestinazioneDiversa; +import it.acxent.anag.Esercizio; +import it.acxent.anag.Iva; +import it.acxent.anag.MagFisico; +import it.acxent.anag.Nazione; +import it.acxent.anag.NazioneCR; +import it.acxent.anag.Porto; +import it.acxent.anag.RegCassa; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.Users; +import it.acxent.anag.Vettore; +import it.acxent.anag._AnagAdapter; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloArticoloComponente; +import it.acxent.art.ArticoloUsato; +import it.acxent.art.Taglia; +import it.acxent.brt.api.json.PudoAddress; +import it.acxent.cart.Cart; +import it.acxent.caship.BarcodeCash; +import it.acxent.caship.EpsonCash; +import it.acxent.common.Access; +import it.acxent.common.CrontabInterface; +import it.acxent.common.StatusMsg; +import it.acxent.contab.iva.RigaRegistroIvaItem; +import it.acxent.contab.iva.RigheRegistroIva; +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.DbInterface; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.fattele.FEAllegatiInterface; +import it.acxent.fattele.FEDatiAnagraficiInterface; +import it.acxent.fattele.FEDatiDDT; +import it.acxent.fattele.FEDatiPagamento; +import it.acxent.fattele.FEDatiRiepilogoInterface; +import it.acxent.fattele.FEDatiRitenutaInterface; +import it.acxent.fattele.FEDatiTrasportoInterface; +import it.acxent.fattele.FEDettaglioLinea; +import it.acxent.fattele.FEDettaglioLineeInterface; +import it.acxent.fattele.FEDettaglioPagamento; +import it.acxent.fattele.FEScontoMaggiorazione; +import it.acxent.fattele.FEScontoMaggiorazioneInterface; +import it.acxent.fattele.FESedeInterface; +import it.acxent.fattele.FatturaElettronicaInterface; +import it.acxent.fattele.FeXml; +import it.acxent.mail.MailMessage; +import it.acxent.mail.MailProperties; +import it.acxent.newsletter.CodaMessaggi; +import it.acxent.reg.EcDc; +import it.acxent.tex.anag.ArticoloArticoloTessuto; +import it.acxent.tex.anag.ArticoloTessuto; +import it.acxent.tex.anag.ArticoloTessutoColore; +import it.acxent.tex.anag.Lavorazione; +import it.acxent.tex.conf.NumeroTeliRiga; +import it.acxent.tex.lav.LavPezza; +import it.acxent.tools.PDFMerger; +import it.acxent.util.AbMessages; +import it.acxent.util.DoubleOperator; +import it.acxent.util.FileWr; +import it.acxent.util.PdfFontFactory; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Timer; +import it.acxent.util.Vectumerator; +import java.awt.Color; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.Serializable; +import java.net.URLEncoder; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Time; +import java.sql.Timestamp; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; + +public class Documento extends _ContabAdapter implements Serializable, AddImgInterface, DocumentoInterface, CrontabInterface, FatturaElettronicaInterface, FEDatiTrasportoInterface { + private static final long serialVersionUID = -7533437477318901983L; + + public static final int ST_BOZZA = 0; + + public static final int ST_EMESSA = 1; + + public static final int ST_PROFORMA = 2; + + public static final int TRASPORTO_MITTENTE = 1; + + public static final int TRASPORTO_VETTORE = 3; + + public static final int TRASPORTO_DESTINATARIO = 2; + + public static final String PARM_IDCRYPT = "idcrypt"; + + public static final String PARM_USER_CODE = "uc"; + + private static final String TAG_SEND_MAIL_DOCS_EXT = "Sendmail Docs Ext"; + + private static final String TAG_SEND_MAIL_DOCS_CLIFOR = "Sendmail Docs"; + + private static final long STAMPA_TIPO_CORPO_FATTURA_STANDARD_0 = 0L; + + private static final long STAMPA_TIPO_CORPO_FATTURA_SEMPLICE_1 = 1L; + + private static final long STAMPA_TIPO_CORPO_FATTURA_PROFESSIONISTA_SEMPLICE_3 = 2L; + + public static final int[] cols_FT_STD_ = new int[] { 23, 4, 4, 2, 4, 3 }; + + public static final int[] cols_FT_SEMPLICE_ = new int[] { 33, 4, 3 }; + + public static final int[] cols_FT_PRO_SEMPLICE_ = new int[] { 33, 7 }; + + public static final int[] cols_RICEVUTA_ = new int[] { 18, 8, 7, 7 }; + + public static final int[] cols_DDT_ = new int[] { 30, 10 }; + + public static final int[] cols_FT_ACQ_BOLLA_CARICO_ = new int[] { 18, 5, 2, 2, 2, 2, 2, 2, 2, 3 }; + + public static final int DELIVERY_TYPE_0_STANDARD = 0; + + public static final int DELIVERY_TYPE_1_IN_NEGOZIO = 1; + + public static final int DELIVERY_TYPE_2_PUDO = 2; + + private static final long DOCUMENTO_RIGHE_USATO_NO = 0L; + + private static final long DOCUMENTO_RIGHE_USATO_SOLO_USATO_RM = 1L; + + private static final long DOCUMENTO_RIGHE_USATO_USATO_RM_E_STD = 2L; + + private static final long DOCUMENTO_RIGHE_USATO_SOLO_USATO_IVA = 3L; + + private static final long DOCUMENTO_RIGHE_USATO_USATO_IVA_E_STD = 4L; + + private static final long DOCUMENTO_RIGHE_USATO_USATO_RM_E_USATO_IVA = 5L; + + private static final long DOCUMENTO_RIGHE_USATO_USATO_RM_USATO_IVA_E_STD = 6L; + + public static final long STATO_LAVORAZIONE_CONCLUSA = 100L; + + public static final long STATO_LAVORAZIONE_DA_PIANIFICARE = 0L; + + public static final long STATO_LAVORAZIONE_IN_LAVORAZIONE = 20L; + + public static final long STATO_LAVORAZIONE_FASE_TAGLIO = 30L; + + public static final long STATO_LAVORAZIONE_NESSUNA = -1L; + + public static final long STATO_LAVORAZIONE_PIANIFICATA = 10L; + + public static final long BARCODE_TYPE_LUNGHEZZA_TOTALE = 0L; + + public static final long BARCODE_TYPE_LUNGHEZZA_TOTALE_MENO_1 = 1L; + + public static final long BARCODE_TYPE_GENERATO = 100L; + + public static final String PERM_RIAPRI_FATTURA_XML = "RIAPRI_FATTURA_XML"; + + public static final int EXPORT_BARTOLINI_NO = 0; + + public static final int EXPORT_BARTOLINI_DA_FARE = 1; + + public static final int EXPORT_BARTOLINI_FATTO_NO_ETICHETTE = 2; + + public static final int EXPORT_BARTOLINI_FATTO_CON_ETICHETTE = 3; + + private static final String BART_TIPO_SERVIZIO = "BART_TIPO_SERVIZIO"; + + private static final String BART_GEST_CONTRASS = "BART_GEST_CONTRASS"; + + private static final String BART_P_OPER_PARTENZA = "BART_P_OPER"; + + private static final String BART_COD_CLIENTE_MITTENTE = "BART_COD_CLI"; + + private static final String BART_SEGNO = " "; + + public static final String VABCTR_ITALIA = "000"; + + public static final String VABCTR_EUROPA = "303"; + + public static final String VABCTR_EXTRA_EUROPA = "305"; + + public static final String VABCTR_PUDO_ITALIA = "309"; + + public static final int TIPO_RITIRO_NORMALE = 0; + + public static final int TIPO_RITIRO_CONTESTUALE = 1; + + public static final int TIPO_CONSEGNA_NORMALE = 0; + + public static final int TIPO_CONSEGNA_PER_APPUNTAMENTO = 1; + + public static final int TIPO_CONSEGNA_FUORI_MISURA = 2; + + public static final int TIPO_CONSEGNA_AI_PIANI = 3; + + public static final int TIPO_CONSEGNA_SUPERMERCATI = 4; + + public static final int MOD_ACCREDITO_SU_CC = 0; + + public static final int MOD_ACCREDITO_ASS_VID = 1; + + public static final int MOD_ACCREDITO_CONTANTE = 2; + + public static final int MOD_ACCREDITO_ASS_INT_MITTENTE = 3; + + public static final int MOD_ACCREDITO_ASS_CIRC_INT_MITTENTE = 4; + + public static final int WWW_TIPO_ORDINE_INTERNO = 0; + + public static final int WWW_TIPO_ORDINE_EBAY = 1; + + public static final int WWW_TIPO_ORDINE_AMAZON = 2; + + private RigheRegistroIva rigaRegistroIva; + + private RigheRegistroIva rigaRegistroIvaCompleto; + + private long id_documento; + + private long id_tipoDocumento; + + private long id_clifor; + + private long id_vettore; + + private long id_tipoPagamento; + + private long flgSys; + + private long flgStato = 1L; + + private long flgStatoPrecedente; + + private Date dataDocumento; + + private long progDocumento; + + private long progOrdineWww; + + private long id_esercizio; + + private String riferimento; + + private String note; + + private Date dataRiferimento; + + private long flgTipoDocumento; + + private double scontoIncondizionato; + + private Date dataPagamento; + + private Date dataRegistrazioneDI; + + private String dichiarazioneIntento; + + private long flgWwwRichiedeFattura; + + private long flgPagata; + + private long flgExport; + + private long flgTrasporto; + + private double abbuono; + + private long nColli; + + private Date dataAvviso; + + private Date dataStampaIva; + + private long flgTrasportoAssicurato; + + private String notaSpedizione; + + private Date dataConsegna; + + private Time oraConsegna; + + private double speseTrasporto; + + private double speseIncasso; + + private String descSpeseAltre; + + private long id_bancaAnticipo; + + private Banca bancaAnticipo; + + private long flgEmsta; + + private String notaSblocco; + + private TipoDocumento tipoDocumento; + + private Clifor clifor; + + private Vettore vettore; + + private TipoPagamento tipoPagamento; + + private Esercizio esercizio; + + private Aspetto aspetto; + + private double acconto; + + private double importoIvaTotale; + + private double importoRMRighe; + + private double imponibileTotale; + + private double importoIvaRighe; + + private long flgMantieniArticoloRiga; + + private long flgSingleLineArt; + + private Documento documentoFiglio; + + private long id_documentoFiglio; + + private long flgEmettiFatturaScontrino; + + private String echoScontrino; + + private String indirizzoSped; + + private double prezzo1000Colpi; + + private double prezzoAnnodatura; + + private Comune comuneSped; + + private long id_comuneSped; + + private String numeroCivicoSped; + + private long flgInEsaurimento; + + private double importoTotale; + + private long flgAutoAdd; + + private double percContIntegrativo; + + private long numPagDocumento; + + private double kgNetto; + + private double volume; + + private double kgLordo; + + private CausaleTrasporto causaleTrasporto; + + private long id_causaleTrasporto; + + private double speseAltre; + + private String ibanCF; + + private String cellDocumento; + + private long id_contatore; + + private long flgStatoPrenotazione; + + private String iban; + + private String notePagamento; + + private long id_destinazioneDiversa; + + private DestinazioneDiversa destinazioneDiversa; + + private String causale; + + private String progDocumentoAgg; + + private Date dataStampaBollato; + + private Date dataChiusura; + + private long id_users; + + private Users users; + + private long flgInserisciReso; + + private String eMailDocumento; + + private double percRitenutaAcconto; + + private double imponibileRighe; + + private double rimborsoArt15; + + private Date dataScadenzaPagamento; + + private long flgPagamentoDataFissa; + + private long flgHaDocumentoPadre; + + public long getProgOrdineWww() { + return this.progOrdineWww; + } + + public void setProgOrdineWww(long progOrdineWww) { + this.progOrdineWww = progOrdineWww; + } + + private long flgInviaAvviso = 1L; + + private long flgStatoRiparazione; + + private double cauzione; + + private long flgDocumentoPrelevato; + + private long flgHasDocumentiPrelevabili = -1L; + + private String descrizioneDifetto; + + private String interventoEffettuato; + + private long flgPreventivo; + + private double importoPreventivo; + + private String notaMail; + + private String descrizionePreventivo; + + private String faxDocumento; + + private String telDocumento; + + private long id_usersIntervento; + + private long id_usersChiusura; + + private Users usersIntervento; + + private Users usersChiusura; + + private long flgStatoRiparazionePrecedente; + + private Documento documentoFiglioUno; + + private long id_porto; + + private Porto porto; + + private long id_tipoDocumentoFiglio; + + private long progDocumentoB; + + private String progDocumentoAggB; + + private long id_esercizioB; + + private long flgTipoMovimento = 0L; + + private String nominativoDocumento; + + private long id_cliforListino; + + private Clifor cliforListino; + + private String descrizioneAllegato; + + private long id_ivaDoc = getCodiceIvaVendStd(); + + private Iva ivaDoc; + + private double importoConsuntivo; + + private String descTransaction; + + private Date dataTransaction; + + private long flgProcediPagamento; + + private long flgStatoOrdineWww = 0L; + + private String capSped; + + private String cittaSped; + + private String provinciaSped; + + private String id_documentoXpay; + + private double contanti; + + private long flgRitiroNegozio; + + private long flgStatoPrenotazionePrecedene; + + private long id_magFisicoPartenza; + + private long id_magFisicoArrivo; + + private MagFisico magFisicoArrivo; + + private MagFisico magFisicoPartenza; + + private Date dataDownload; + + private Time oraDownload; + + private String ipDownload; + + private long flgDownload; + + private Timestamp tmstStampato; + + private String testoAgg; + + private String bic; + + private long id_magFisicoPartenza2; + + private long flgDocumentoPrelevatoPrecedente; + + private long flgSuper; + + private String clienteNome; + + private String clienteCognome; + + private String clienteIndirizzo; + + private String clienteCf; + + private String clientePiva; + + private Date dataRestituzioneAcconto; + + private String descrizioneRighePrenotazione; + + private double percAgente; + + private double percRespCommerciale; + + private Timestamp tmstFileXml; + + private Timestamp tmstInvioMail; + + private long flgArt8; + + private long id_cliforPrecedente; + + private String bancaCFDesc; + + private String descrizioneDocumento; + + private double percScontoIncondizionato; + + private String id_nazioneSped; + + private Nazione nazioneSped; + + private Timestamp tmstFilePdf; + + private double importoBolloEsenzione; + + private double imponibileBolloEsenzione; + + private String progFileFE; + + private long flgStatoInvioXml; + + private Timestamp tmstInvioXml; + + private String codiceCIG; + + private String codiceCUP; + + private String codiceCommessa; + + private String bancaDesc; + + private long id_aspetto; + + private long id_magFisicoArrivo2; + + private MagFisico magFisicoArrivo2; + + private MagFisico magFisicoPartenza2; + + private Timestamp tsFineLavorazione; + + private Timestamp tsInizioLavorazione; + + private long flgStatoLavorazione = 100L; + + private long flgBarcodeType; + + private long flgBarcodeSequenzaNumeri; + + private String ordineCodiceCIG; + + private String ordineCodiceCUP; + + private Articolo articolo; + + private long id_articolo; + + private String presso; + + private long id_taglia; + + private Taglia taglia; + + private String trackingSpedizione; + + private long flgWwwTipoOrdine; + + private double wwwCostoOrdine; + + private double wwwCostoSpedizione; + + private double wwwCostoTariffa; + + private long id_rigaBollaAtr; + + private long totaleColpi; + + private long flgTipoGenerazione; + + private long flgBartolini; + + private long flgTipoRitiro; + + private long flgAvvisoConsegna; + + private Date dataSpedizione; + + private Date dataInvioMailSped; + + private double valoreDichiarato; + + private double costoEffettivoSped; + + private long flgModoAccredito; + + private Documento documentoPadreUno; + + private long flgInGaranzia; + + private Timestamp tmstInvioMailOrdine; + + private long flgStatoOrdineWwwPrecedente = 0L; + + private String descDocumenti; + + private String notaAggiuntiva; + + private long flgOrdineWwwAppenaCreato = 0L; + + private long flgOrdineWwwAppenaPagato = 0L; + + private String stripeClientSecret; + + private String FERiferimentoTipoDato; + + private String FERiferimentoTesto; + + private double FERiferimentoNumero; + + private Date FERiferimentoData; + + private long id_lavorazione; + + private Lavorazione lavorazione; + + private String descTransactionStripe; + + private long flgStatoLavorazionePrecedente; + + private double prezzoCatenaAlMt; + + private Date dataCambioStatoLavorazione; + + private long flgGRS; + + private double totaleDocumento; + + private long flgDeliveryType; + + private String pudoId; + + private String pudoDesc; + + public double getImponibileBolloEsenzione() { + return this.imponibileBolloEsenzione; + } + + public void setImponibileBolloEsenzione(double imponibileBolloEsenzione) { + this.imponibileBolloEsenzione = imponibileBolloEsenzione; + } + + public static boolean threadSendMail = false; + + public static boolean threadCreaFattureTessitura = false; + + public static String threadSendMailMsg = ""; + + public static final int RIGHE_DISPONIBILI_NO = 0; + + public static final int RIGHE_DISPONIBILI_TUTTE = 2; + + public static final int RIGHE_DISPONIBILI_NON_TUTTE = 1; + + public static final long ORDINE_WWW_RESO_NESSUNA_RICHIESTA = 0L; + + public static final long ORDINE_WWW_RESO_RICHIESTA_ACCETTATA = 2L; + + public static final long ORDINE_WWW_RESO_RICHIESTA_COMPLETATA = 3L; + + public static final long ORDINE_WWW_RESO_RICHIESTA_IN_CORSO = 1L; + + public static final long ORDINE_WWW_RESO_RICHIESTA_RESPINTA = 99L; + + public static final long ORDINE_WWW_STATO_APERTO_CONFERMATO = 0L; + + public static final long ORDINE_WWW_STATO_IN_LAVORAZIONE = 1L; + + public static final long ORDINE_WWW_STATO_SPEDITO = 2L; + + public static final long ORDINE_WWW_STATO_CHIUSO = 9L; + + public static final long ORDINE_WWW_STATO_CHIUSI_E_ANNULLATI_CR = 11L; + + public static final long ORDINE_WWW_STATO_APERTI_FINO_A_SPEDITO_CR = 10L; + + public static final long ORDINE_WWW_STATO_ANNULLATO = 99L; + + public static final long ORDINE_WWW_STATO_PAG_NON_PAGATO = 0L; + + public static final long ORDINE_WWW_STATO_PAG_PAGATO = 2L; + + public static final long ORDINE_WWW_STATO_PAG_TRANS_OK = 1L; + + public static final long TIPO_MOVIMENTO_SCARICO = 2L; + + public static final long TIPO_MOVIMENTO_CARICO_E_SCARICO = 3L; + + public static final long TIPO_MOVIMENTO_CARICO = 1L; + + public static final long TIPO_MOVIMENTO_IND = 0L; + + public static final int ST_GARANZIA_NO = 0; + + public static final int ST_GARANZIA_SI = 1; + + public static final int ST_GARANZIA_DOA = 2; + + public static final int ST_PRENOTAZIONE_ACCETTATO = 0; + + public static final int ST_PRENOTAZIONE_ORDINATA = 10; + + public static final int ST_PRENOTAZIONE_ARRIVATO = 20; + + public static final int ST_PRENOTAZIONE_SPEDITO = 30; + + public static final int ST_PRENOTAZIONE_CHIUSA = 90; + + public static final int ST_PRENOTAZIONE_ANNULLATO = 100; + + public static final int ST_PRENOTAZIONE_APERTE = 200; + + public static final int AVVISO_FAX = 4; + + public static final int AVVISO_SMS = 2; + + public static final int AVVISO_EMAIL_SMS = 3; + + public static final int AVVISO_EMAIL = 1; + + public static final int ST_RIPARAZIONE_NON_VISIONATO = 0; + + public static final int ST_RIPARAZIONE_IN_RIP_ESTERNA = 1; + + public static final int ST_RIPARAZIONE_ATTESA_PREVENTIVO = 2; + + public static final int ST_RIPARAZIONE_PREVENTIVO_ACCETTATO = 3; + + public static final int ST_RIPARAZIONE_PREVENTIVO_NON_ACCETTATO = 4; + + public static final int ST_RIPARAZIONE_RIPARATO = 10; + + public static final int ST_RIPARAZIONE_NON_RIPARATO = 11; + + public static final int ST_RIPARAZIONE_RICONSEGNATO = 99; + + public static final int RPT_VENDITE_GIORNALIERE = 0; + + public static final int RPT_VENDITE_COMPLETO = 1; + + public static final int RPT_VENDITE_COMPATTO = 2; + + public static final int RPT_VENDITE_GIORN_PIUGIORNI = 3; + + public static final int RPT_ORDINI_INEVASI = 4; + + public static final int RPT_FATTURATO = 5; + + public static final int RPT_VENDITE_SERVIZI = 6; + + public static final int RPT_DOCUMENTI_GIORNALIERO = 7; + + public static final int RPT_DOCUMENTI_DETTAGLIO = 8; + + public static final int RPT_DOCUMENTI_GIORNALIERO_PER_NAZIONE = 9; + + public static final int RPT_DOCUMENTI_DETTAGLIO_CON_DDT = 10; + + public static final int AVVISO_ERR = 9; + + public static final int AVVISO_MANUALE = 5; + + public static final long TIPO_CARICO_SCARICO_NESSUNO = -1L; + + public static final long TIPO_CARICO_SCARICO_ANAGRAFICHE = 0L; + + public static final long TIPO_CARICO_SCARICO_DISPO = 1L; + + private static Hashtable tipoDocumentoHT; + + private class ArticoloGroup { + private String descrizione; + + private double quantita; + + private double valore; + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } + + public double getQuantita() { + return this.quantita; + } + + public void setQuantita(double quantita) { + this.quantita = quantita; + } + + public double getValore() { + return this.valore; + } + + public void setValore(double valore) { + this.valore = valore; + } + } + + public static String getStato(long l_flgStato) { + switch ((int)l_flgStato) { + case 0: + return "Bozza"; + case 1: + return "Emessa"; + case 2: + return "Proforma"; + case -1: + return "-- Tutti --"; + } + return "????"; + } + + public static String getBartolini(long l_flgBartolini) { + switch ((int)l_flgBartolini) { + case 1: + return "Da Fare"; + case 3: + return "Fatto Con Etich."; + case 2: + return "Fatto No Etich."; + case 0: + return "No"; + case -1: + return "-"; + } + return "????"; + } + + public static String getTipoRitiro(long l_flgTipoRitiro) { + switch ((int)l_flgTipoRitiro) { + case 1: + return "Contestuale"; + case 0: + return "Normale"; + } + return "????"; + } + + public static String getAvvisoConsegna(long l_flgTipoConsegna) { + switch ((int)l_flgTipoConsegna) { + case 3: + return "Ai Piani"; + case 2: + return "Fuori Misura"; + case 0: + return "Normale"; + case 1: + return "Per Appuntamento"; + case 4: + return "Supermercati"; + } + return "????"; + } + + public static String getWwwTipoOrdine(long l_flgWwwTipoOrdine) { + switch ((int)l_flgWwwTipoOrdine) { + case 1: + return "Ebay"; + case 2: + return "Amazon"; + case 0: + return "Interno"; + } + return "????"; + } + + public String getWwwTipoOrdine() { + return getWwwTipoOrdine(getFlgWwwTipoOrdine()); + } + + public static String getModoAccredito(long l_flgModAccredito) { + switch ((int)l_flgModAccredito) { + case 4: + return "Ass. Circ. Int. Mittente"; + case 3: + return "Ass. Int. Mittente"; + case 1: + return "Normale"; + case 2: + return "Contante"; + case 0: + return "Su c.c."; + } + return "????"; + } + + public static String getTrasportoAssicurato(long l_flgTrasportoAssicurato) { + switch ((int)l_flgTrasportoAssicurato) { + case 0: + return "No"; + case 1: + return "Si"; + } + return "????"; + } + + class ThreadSendMailExt extends Thread { + private DocumentoCR CR; + + private String email; + + private String path; + + private String testoAgg; + + public ThreadSendMailExt(DocumentoCR l_CR, String l_email, String l_path, String l_testoAgg) { + this.CR = l_CR; + this.email = l_email; + this.path = l_path; + this.testoAgg = l_testoAgg; + if (!Documento.isThreadAttivo()) { + Documento.threadSendMail = true; + start(); + } + } + + public void run() { + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("##############\nSendmail thread\nSTART: " + start.toString()); + ResParm rp = new ResParm(true); + StatusMsg.updateMsgByTag(Documento.this.getApFull(), "Sendmail Docs Ext", "Attenzione! Thread invio email in esecuzione!!! "); + rp = Documento.this.sendDocumentiMailMessageExt(this.CR, this.email, this.path, this.testoAgg); + Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("STOP: " + start.toString()); + SimpleDateFormat dfMS = new SimpleDateFormat("HH:mm:ss "); + System.out.println("DURATA: " + dfMS.format(new Time(stop.getTime() - start.getTime() - 3600000L)) + "Risultato invio email:\n" + + rp.getMsg() + "\n\nInvio email concluso\n****************"); + try { + sleep(3000L); + } catch (Exception e) {} + Documento.threadSendMail = false; + StatusMsg.deleteMsgByTag(Documento.this.getApFull(), "Sendmail Docs Ext"); + } + } + + class ThreadSendMailClifor extends Thread { + private DocumentoCR CR; + + private String path; + + private String testoAgg; + + public ThreadSendMailClifor(DocumentoCR l_CR, String l_path, String l_testoAgg) { + this.CR = l_CR; + this.path = l_path; + this.testoAgg = l_testoAgg; + if (!Documento.isThreadAttivo()) { + Documento.threadSendMail = true; + start(); + } + } + + public void run() { + Timestamp start = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("##############\nSendmail thread\nSTART: " + start.toString()); + ResParm rp = new ResParm(true); + StatusMsg.updateMsgByTag(Documento.this.getApFull(), "Sendmail Docs", "Attenzione! Thread invio email in esecuzione!!! "); + rp = Documento.this.sendDocumentiMailMessagePerClifor(this.CR, this.path, this.testoAgg); + Timestamp stop = new Timestamp(Calendar.getInstance().getTimeInMillis()); + System.out.println("STOP: " + start.toString()); + SimpleDateFormat dfMS = new SimpleDateFormat("HH:mm:ss "); + System.out.println("DURATA: " + dfMS.format(new Time(stop.getTime() - start.getTime() - 3600000L)) + "Risultato invio email:\n" + + rp.getMsg() + "\n\ninvio email concluso\n****************"); + try { + sleep(3000L); + } catch (Exception e) {} + Documento.threadSendMail = false; + StatusMsg.deleteMsgByTag(Documento.this.getApFull(), "Sendmail Docs"); + } + } + + class ThreadCreaFtTessitura extends Thread { + private DocumentoCR CR; + + private long l_id_cliforR; + + private long l_id; + + private long l_id_tipoDocumentoFiglio; + + private long l_flgTipoGenerazione; + + private Users operatore; + + public ThreadCreaFtTessitura(DocumentoCR l_CR, long l_id_cliforR, long l_id, long l_id_tipoDocumentoFiglio, long l_flgTipoGenerazione, Users operatore) { + this.CR = l_CR; + this.l_flgTipoGenerazione = l_flgTipoGenerazione; + this.l_id = l_id; + this.l_id_cliforR = l_id_cliforR; + this.l_id_tipoDocumentoFiglio = l_id_tipoDocumentoFiglio; + this.operatore = operatore; + if (!Documento.isThreadAttivo()) { + Documento.threadCreaFattureTessitura = true; + start(); + } + } + + public void run() { + Timer timer = new Timer(); + timer.start(); + String TAG_THREAD_MSG = "CREAZIONE FT TESSITURA"; + StatusMsg.updateMsgByTag(Documento.this.getApFull(), TAG_THREAD_MSG, "INIZIO CREAZIONE FATTURE....."); + ResParm rp = new ResParm(true); + ApplParmFull apFull = Documento.this.getApFull(); + Documento bean = new Documento(apFull); + TipoDocumento tdDaGenerare = new TipoDocumento(apFull); + tdDaGenerare.findByPrimaryKey(this.l_id_tipoDocumentoFiglio); + if (tdDaGenerare.hasPadreConTipologia(200L)) { + if (this.l_id_cliforR == 0L || this.l_id == 0L) { + if (this.CR.getId_tipoDocumento() == 0L) { + rp.setMsg("Errore! Tipo del documento non trovata!"); + rp.setStatus(false); + } else { + StatusMsg.updateMsgByTag(Documento.this.getApFull(), TAG_THREAD_MSG, "Inizio ciclo Clienti ....."); + Vectumerator vecClifor = bean.findCliforByCR(this.CR); + while (vecClifor.hasMoreElements()) { + Clifor rowClifor = (Clifor)vecClifor.nextElement(); + HashMap hmDdt = new HashMap<>(); + HashMap hmDispTess = new HashMap<>(); + this.CR.setId_clifor(rowClifor.getId_clifor()); + Vectumerator vec = bean.findByCR(this.CR, 0, 0); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + hmDdt.put(new Long(row.getId_documento()), row); + LavPezza lp = new LavPezza(apFull); + Vectumerator vecLP = lp.findByDocumentoBolla(row.getId_documento()); + while (vecLP.hasMoreElements()) { + LavPezza rowLP = (LavPezza)vecLP.nextElement(); + Long lpKey = new Long(rowLP.getRigaDocumento().getId_documento()); + if (!hmDispTess.containsKey(lpKey)) + hmDispTess.put(lpKey, rowLP.getRigaDocumento().getDocumento()); + } + StatusMsg.updateMsgByTag(Documento.this.getApFull(), TAG_THREAD_MSG, "Inizio ciclo Fatturazione per " + + rowClifor.getCognomeNome() + " ..."); + for (Map.Entry entry : hmDispTess.entrySet()) { + System.out.println("Key = " + + String.valueOf(entry.getKey()) + ", Value = " + entry.getValue().getNumeroDocumentoCompleto()); + rp = entry.getValue().creaDocumentoFiglioDaDisposizioniTessitura(rowClifor.getId_clifor(), this.l_id_tipoDocumentoFiglio, this.operatore, true, this.l_flgTipoGenerazione, hmDdt); + } + } + } + } + } else { + bean.findByPrimaryKey(this.l_id); + HashMap hmDdt = new HashMap<>(); + HashMap hmDispTess = new HashMap<>(); + hmDdt.put(new Long(this.l_id), bean); + LavPezza lp = new LavPezza(apFull); + Vectumerator vecLP = lp.findByDocumentoBolla(this.l_id); + while (vecLP.hasMoreElements()) { + LavPezza rowLP = (LavPezza)vecLP.nextElement(); + Long lpKey = new Long(rowLP.getRigaDocumento().getId_documento()); + if (!hmDispTess.containsKey(lpKey)) + hmDispTess.put(lpKey, rowLP.getRigaDocumento().getDocumento()); + } + StatusMsg.updateMsgByTag(Documento.this.getApFull(), TAG_THREAD_MSG, "Inizio ciclo Fatturazione per DDT " + + bean.getNumeroDocumentoCompleto() + " ..."); + for (Map.Entry entry : hmDispTess.entrySet()) { + System.out.println("Key = " + String.valueOf(entry.getKey()) + ", Value = " + entry.getValue().getNumeroDocumentoCompleto()); + rp = entry.getValue().creaDocumentoFiglioDaDisposizioniTessitura(bean.getId_clifor(), this.l_id_tipoDocumentoFiglio, this.operatore, true, this.l_flgTipoGenerazione, hmDdt); + } + } + timer.stop(); + StatusMsg.updateMsgByTag(Documento.this.getApFull(), TAG_THREAD_MSG, "Preparazione Fattura Tessitura conclusa: " + + timer.getDurataHourMin()); + } else { + timer.stop(); + StatusMsg.updateMsgByTag(Documento.this.getApFull(), TAG_THREAD_MSG, "Errore! Documento generabile non ha come padre una disposizione tessitura!" + + timer.getDurataHourMin()); + } + try { + sleep(3000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(Documento.this.getApFull(), TAG_THREAD_MSG); + Documento.threadCreaFattureTessitura = false; + } + } + + private static boolean ripristinoThreadRun = false; + + public Documento(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Documento() {} + + public void setId_documento(long newId_documento) { + this.id_documento = newId_documento; + } + + public void setId_tipoDocumento(long newId_tipoDocumento) { + this.id_tipoDocumento = newId_tipoDocumento; + setTipoDocumento(null); + setFlgAutoAdd(getTipoDocumento().getFlgAutoAdd()); + setFlgSingleLineArt(getTipoDocumento().getFlgSingleLineArt()); + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_vettore(long newId_vettore) { + this.id_vettore = newId_vettore; + setVettore(null); + } + + public void setId_tipoPagamento(long newId_tipoPagamento) { + this.id_tipoPagamento = newId_tipoPagamento; + setTipoPagamento(null); + } + + public void setFlgSys(long newFlgSys) { + this.flgSys = newFlgSys; + } + + public void setFlgStato(long newFlgStato) { + this.flgStato = newFlgStato; + } + + public void setDataDocumento(Date newDataDocumento) { + this.dataDocumento = newDataDocumento; + } + + public void setProgDocumento(long newProgDocumento) { + this.progDocumento = newProgDocumento; + } + + public void setId_esercizio(long newId_esercizio) { + this.id_esercizio = newId_esercizio; + setEsercizio(null); + } + + public void setRiferimento(String newRiferimento) { + this.riferimento = newRiferimento; + } + + public void setDataRiferimento(Date newDataRiferimento) { + this.dataRiferimento = newDataRiferimento; + } + + public void setFlgTipoDocumento(long newFlgTipoDocumento) { + this.flgTipoDocumento = newFlgTipoDocumento; + } + + public void setScontoIncondizionato(double newSconto) { + this.scontoIncondizionato = newSconto; + } + + public void setDataPagamento(Date newDataPagamento) { + this.dataPagamento = newDataPagamento; + } + + public void setDataRegistrazioneDI(Date newDataRegistrazioneDI) { + this.dataRegistrazioneDI = newDataRegistrazioneDI; + } + + public void setDichiarazioneIntento(String newDichiarazioneIntento) { + this.dichiarazioneIntento = newDichiarazioneIntento; + } + + public void setFlgArt8(long newFlgArt8) { + this.flgArt8 = newFlgArt8; + } + + public void setFlgPagata(long newFlgPagata) { + this.flgPagata = newFlgPagata; + } + + public void setFlgExport(long newFlgExport) { + this.flgExport = newFlgExport; + } + + public void setFlgTrasporto(long newFlgTrasporto) { + this.flgTrasporto = newFlgTrasporto; + } + + public void setKgLordo(double newKg) { + this.kgLordo = newKg; + } + + public void setNColli(long newNColli) { + this.nColli = newNColli; + } + + public void setDataStampaBollato(Date newDataStampaBollato) { + this.dataStampaBollato = newDataStampaBollato; + } + + public void setDataStampaIva(Date newDataStampaIva) { + this.dataStampaIva = newDataStampaIva; + } + + public void setFlgTrasportoAssicurato(long newFlgTrasportoAssicurato) { + this.flgTrasportoAssicurato = newFlgTrasportoAssicurato; + } + + public void setNotaSpedizione(String newNotaSpedizione) { + this.notaSpedizione = newNotaSpedizione; + } + + public void setDataConsegna(Date newDataConsegna) { + this.dataConsegna = newDataConsegna; + } + + public void setOraConsegna(Time newOraConsegna) { + this.oraConsegna = newOraConsegna; + } + + public void setSpeseTrasporto(double newSpeseTrasporto) { + this.speseTrasporto = newSpeseTrasporto; + } + + public void setSpeseAltre(double newSpeseAltre) { + this.speseAltre = newSpeseAltre; + } + + public void setDescSpeseAltre(String newDescSpeseAltre) { + this.descSpeseAltre = newDescSpeseAltre; + } + + public void setId_aspetto(long newId_aspetto) { + this.id_aspetto = newId_aspetto; + setAspetto(null); + } + + public long getId_documento() { + return this.id_documento; + } + + public long getId_tipoDocumento() { + return this.id_tipoDocumento; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_vettore() { + return this.id_vettore; + } + + public long getId_tipoPagamento() { + return this.id_tipoPagamento; + } + + public long getFlgSys() { + return this.flgSys; + } + + public long getFlgStato() { + return this.flgStato; + } + + public Date getDataDocumento() { + return this.dataDocumento; + } + + public long getProgDocumento() { + return this.progDocumento; + } + + public long getId_esercizio() { + return this.id_esercizio; + } + + public long getId_contatore() { + return getTipoDocumento().getId_contatore(); + } + + public String getRiferimento() { + return (this.riferimento == null) ? "" : this.riferimento.trim(); + } + + public Date getDataRiferimento() { + return this.dataRiferimento; + } + + public long getFlgTipoDocumento() { + return this.flgTipoDocumento; + } + + public double getScontoIncondizionato() { + return this.scontoIncondizionato; + } + + public Date getDataPagamento() { + return this.dataPagamento; + } + + public Date getDataRegistrazioneDI() { + return this.dataRegistrazioneDI; + } + + public String getDichiarazioneIntento() { + return (this.dichiarazioneIntento == null) ? "" : this.dichiarazioneIntento.trim(); + } + + public long getFlgArt8() { + return this.flgArt8; + } + + public long getFlgPagata() { + return this.flgPagata; + } + + public long getFlgExport() { + return this.flgExport; + } + + public long getFlgTrasporto() { + return this.flgTrasporto; + } + + public double getKgLordo() { + return this.kgLordo; + } + + public long getNColli() { + return this.nColli; + } + + public Date getDataStampaBollato() { + return this.dataStampaBollato; + } + + public Date getDataStampaIva() { + return this.dataStampaIva; + } + + public long getFlgTrasportoAssicurato() { + return this.flgTrasportoAssicurato; + } + + public String getNotaSpedizione() { + return (this.notaSpedizione == null) ? "" : this.notaSpedizione.trim(); + } + + public Date getDataConsegna() { + return this.dataConsegna; + } + + public Time getOraConsegna() { + return this.oraConsegna; + } + + public double getSpeseTrasporto() { + return this.speseTrasporto; + } + + public double getSpeseTrasportoConIva() { + return conIva(getSpeseTrasporto(), (double)getIvaDoc().getAliquota()); + } + + public double getSpeseIncassoConIva() { + return conIva(getSpeseIncasso(), (double)getIvaDoc().getAliquota()); + } + + public double getSpeseAltreConIva() { + return conIva(getSpeseAltre(), (double)getIvaDoc().getAliquota()); + } + + public double getSpeseAltre() { + return this.speseAltre; + } + + public String getDescSpeseAltre() { + return (this.descSpeseAltre == null) ? "" : this.descSpeseAltre.trim(); + } + + public long getId_aspetto() { + return this.id_aspetto; + } + + public void setTipoDocumento(TipoDocumento newTipoDocumento) { + this.tipoDocumento = newTipoDocumento; + } + + public TipoDocumento getTipoDocumento() { + this.tipoDocumento = (TipoDocumento)getSecondaryObject(this.tipoDocumento, TipoDocumento.class, getId_tipoDocumento()); + return this.tipoDocumento; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setVettore(Vettore newVettore) { + this.vettore = newVettore; + } + + public Vettore getVettore() { + this.vettore = (Vettore)getSecondaryObject(this.vettore, Vettore.class, getId_vettore()); + return this.vettore; + } + + public void setTipoPagamento(TipoPagamento newTipoPagamento) { + this.tipoPagamento = newTipoPagamento; + } + + public TipoPagamento getTipoPagamento() { + this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, getId_tipoPagamento()); + return this.tipoPagamento; + } + + public void setEsercizio(Esercizio newEsercizio) { + this.esercizio = newEsercizio; + } + + public Esercizio getEsercizio() { + this.esercizio = (Esercizio)getSecondaryObject(this.esercizio, Esercizio.class, getId_esercizio()); + return this.esercizio; + } + + public void setAspetto(Aspetto newAspetto) { + this.aspetto = newAspetto; + } + + public Aspetto getAspetto() { + this.aspetto = (Aspetto)getSecondaryObject(this.aspetto, Aspetto.class, getId_aspetto()); + return this.aspetto; + } + + protected ResParm checkDeleteCascade() { + Access access = new Access(getApFull()); + access.findByPrimaryKey(getTableBeanName()); + ResParm rp = checkEMSTA(); + if (rp.getStatus() && + hasScadenzeSuRiba()) { + rp.setStatus(false); + rp.setMsg("ERRORE! Esistono delle distinte riba già legate alle scadenze"); + } + if (rp.getStatus()) { + Vectumerator vec = findRigheDocumento(0, 0, 0); + if (vec.hasMoreElements() && access.getFlgDeleteCascade() == 0L) + return new ResParm(false, "Attenzione!! Cancellazione in cascaTa non abilitata"); + } + return rp; + } + + protected void deleteCascade() { + Access access = new Access(getApFull()); + access.findByPrimaryKey(getTableBeanName()); + String currentPdfFile = getPathStampaDocumentoFull(); + File pdfFile = new File(currentPdfFile); + if (pdfFile.exists()) + pdfFile.delete(); + if (getId_tipoDocumento() == getId_docRiparazione() || access.getFlgDeleteCascade() == 1L) { + Vectumerator vecR = findRigheDocumento(0L, 0, 0, 0); + while (vecR.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecR.nextElement(); + row.delete(); + } + vecR = findRigheDocumento(1L, 0, 0, 0); + while (vecR.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecR.nextElement(); + row.delete(); + } + vecR = findRigheDocumento(100L, 0, 0, 0); + while (vecR.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecR.nextElement(); + row.delete(); + } + } + Vectumerator vec = findDocFiglioPadreByFiglio(); + while (vec.hasMoreElements()) { + DbInterface row = (DbInterface)vec.nextElement(); + row.delete(); + } + vec = findDocFiglioPadreByPadre(); + while (vec.hasMoreElements()) { + DbInterface row = (DbInterface)vec.nextElement(); + row.delete(); + } + ResParm rp = update("update DOCUMENTO set id_documentoFiglio=null where id_documentoFiglio=" + getId_documento()); + rp = update("update RIGA_DOCUMENTO set id_documentoPadre=null where id_documentoPadre=" + getId_documento()); + DocumentoAgente da = new DocumentoAgente(getApFull()); + da.deleteAgentiByDocumento(getId_documento()); + DocumentoPagamento dp = new DocumentoPagamento(getApFull()); + Vectumerator vecDp = dp.findByDocumento(getId_documento()); + while (vecDp.hasMoreElements()) { + DocumentoPagamento rowDp = (DocumentoPagamento)vecDp.nextElement(); + rowDp.delete(); + } + Vectumerator vecs = new DocumentoScadenza(getApFull()).findByDocumento(getId_documento()); + while (vecs.hasMoreElements()) { + DocumentoScadenza ds = (DocumentoScadenza)vecs.nextElement(); + ds.delete(); + } + rp.append(update("DELETE FROM PROMOZIONE_USER where id_documento=" + getId_documento())); + } + + public String getBartolini() { + return getBartolini(getFlgBartolini()); + } + + public String getModoAccredito() { + return getModoAccredito(getFlgModoAccredito()); + } + + public String getTipoRitiro() { + return getTipoRitiro(getFlgTipoRitiro()); + } + + public String getAvvisoConsegna() { + return getAvvisoConsegna(getFlgAvvisoConsegna()); + } + + public String getTrasportoAssicurato() { + return getTrasportoAssicurato(getFlgTrasportoAssicurato()); + } + + public String getTrasporto() { + return getTrasporto(getFlgTrasporto()); + } + + public boolean isRigheConSeriali() { + if (getTipoCaricoScarico() == -1L) + return false; + if (getTipoCaricoScarico() == 1L) + return true; + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getArticolo().getTipo().getFlgTipoMagazzino() == 2L && row.getSeriale().isEmpty()) + return false; + } + return true; + } + + public boolean isProgConBuchi() { + Calendar cal = Calendar.getInstance(); + return isProgConBuchi((long)cal.get(1)); + } + + public boolean isProgConBuchi(long anno) { + if (getFlgStato() == 0L || getFlgStato() == 2L) + return false; + if (getTipoDocumento().getContatore().getFlgControllo() == 0L) + return false; + String l_progPrimoBuco = trovaProgPrimoBuco(anno); + if (l_progPrimoBuco.isEmpty()) + return false; + return true; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + setRigaRegistroIva(null); + setRigaRegistroIvaCompleto(null); + if (getId_clifor() == 0L) + setId_clifor(1L); + if (getId_clifor() > 1L) + setNominativoDocumento(getClifor().getDescrizioneCompleta()); + Calendar cal = Calendar.getInstance(); + if (getDataDocumento() == null) + setDataDocumento(getToday()); + if (getTmstInvioXml() == null && + getClifor().getFlgArt8() == 1L) { + setFlgArt8(getClifor().getFlgArt8()); + setDichiarazioneIntento(getClifor().getDichiarazioneIntento()); + setDataRegistrazioneDI(getClifor().getDataRegistrazioneDI()); + if (getNote().indexOf(getDichiarazioneIntento()) < 0) { + String temp = "Operazione non imponibile ai sensi dell’articolo 8, comma 1, lettera c) D.P.R. 633/1972, come da vostra dichiarazione di intento riferimento dell'agenzia delle entrate al nr. " + getDichiarazioneIntento() + " del " + getDataFormat().format(getDataRegistrazioneDI()); + if (getNote().length() > 0) { + setNote(temp + "\n" + temp); + } else { + setNote(temp); + } + } + } + if (getBancaDesc().isEmpty() || getIban().isEmpty() || getBic().isEmpty()) { + Banca banca = new Banca(getApFull()); + banca.findBancaDefault(); + if (banca.getId_banca() > 0L) { + setBancaDesc(banca.getDescrizione()); + setIban(banca.getIban()); + setBic(banca.getBic()); + } + } + cal.setTime(getDataDocumento()); + setId_esercizio((long)cal.get(1)); + if (getFlgStato() != getFlgStatoPrecedente() || getProgDocumento() == 0L) { + if (getFlgStato() == 0L || getFlgStato() == 2L) + if (getProgDocumento() != 0L) { + setProgDocumentoB(getProgDocumento()); + setProgDocumentoAggB(getProgDocumentoAgg()); + setId_esercizioB(getId_esercizio()); + } else { + setProgDocumentoB(0L); + setProgDocumentoAggB(null); + setId_esercizioB(0L); + } + if (getId_tipoDocumento() == getId_docOrdineWWW() && + getProgOrdineWww() == 0L) + try { + Documento fatt = (Documento)clone(); + setProgOrdineWww(fatt.calcolaProgOrdineWww()); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + throw new SQLException(e.getMessage()); + } + cal.setTime(getDataDocumento()); + try { + Documento fatt = (Documento)clone(); + setProgDocumento(fatt.calcolaProgDocumento()); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + throw new SQLException(e.getMessage()); + } + if (getParm("DATA_FATTURA_PRIMA_DISPONIBILE").getNumeroInt() == 1 && getId_tipoDocumento() != getId_docCassa() && + getFlgStato() != getFlgStatoPrecedente() && getFlgStato() == 1L) { + Documento documento = new Documento(getApFull()); + documento.setId_tipoDocumento(getId_tipoDocumento()); + documento.findUltimoDocumentoEmesso(); + setDataDocumento(documento.getDataDocumento()); + } + } + if (getId_tipoDocumento() == getId_docRiparazione() && getId_usersChiusura() != 0L && getDataChiusura() == null) + setDataChiusura(getToday()); + if (getId_tipoDocumento() == getId_docRiparazione() && getId_usersChiusura() != 0L && + getFlgStatoRiparazione() != 99L) + setFlgStatoRiparazione(99L); + if (getFlgStatoRiparazione() != getFlgStatoRiparazionePrecedente()) { + String noteTemp = " \n" + getStatoRiparazione() + " in data " + String.valueOf(getToday()); + setNote(getNote() + getNote()); + } + if (getId_tipoDocumento() == 1L) + setFlgPagata(1L); + if (getDataPagamento() != null) + setFlgPagata(1L); + if (getFlgPagata() == 1L && getDataPagamento() == null) + setDataPagamento(getToday()); + long resHasUsato = hasRigheConUsato(); + if (resHasUsato > 0L) { + RigaDocumento rf = new RigaDocumento(getApFull()); + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + rf = (RigaDocumento)vec.nextElement(); + if (rf.getId_articolo() > 0L) { + ArticoloUsato au = new ArticoloUsato(getApFull()); + Vectumerator vecAu = au.findByRigaDocumento(rf.getId_rigaDocumento()); + while (vecAu.hasMoreElements()) { + au = (ArticoloUsato)vecAu.nextElement(); + au.setNumeroDocumento(getNumeroDocumento()); + au.setDataDocumento(getDataDocumento()); + au.save(); + } + } + } + } + if (getFlgBartolini() >= 1L && getDataSpedizione() == null) + setDataSpedizione(getToday()); + if (getDataSpedizione() != null || getTmstInvioMail() != null) { + Documento forseOrdine = getDocumentoPadreUno(); + if (forseOrdine.getId_tipoDocumento() == getId_docOrdineWWW()) + if (getTmstInvioMail() != null) { + forseOrdine.setFlgStatoOrdineWww(9L); + forseOrdine.superSave(); + } else if (forseOrdine.getFlgStatoOrdineWww() < 2L && getDataSpedizione() != null) { + forseOrdine.setFlgStatoOrdineWww(2L); + forseOrdine.superSave(); + } + } + super.prepareSave(ps); + } + + private ResParm calcoloStatoLavorazione() { + ResParm rp = new ResParm(true); + if (getTipoDocumento().getFlgTipologia() == 220L) + if (getFlgStatoLavorazione() == 100L) { + DocFiglioPadre dfp = new DocFiglioPadre(getApFull()); + Vectumerator vec = dfp.findByPadre(getId_documento()); + while (vec.hasMoreElements()) { + DocFiglioPadre row = (DocFiglioPadre)vec.nextElement(); + row.getDocumentoFiglio().setFlgStatoLavorazione(100L); + row.getDocumentoFiglio().superSave(); + } + } else if (getFlgStatoLavorazione() == 20L) { + DocFiglioPadre dfp = new DocFiglioPadre(getApFull()); + Vectumerator vec = dfp.findByPadre(getId_documento()); + while (vec.hasMoreElements()) { + DocFiglioPadre row = (DocFiglioPadre)vec.nextElement(); + row.getDocumentoFiglio().setFlgStatoLavorazione(20L); + row.getDocumentoFiglio().superSave(); + } + } else if (getFlgStatoLavorazione() == 30L) { + DocFiglioPadre dfp = new DocFiglioPadre(getApFull()); + Vectumerator vec = dfp.findByPadre(getId_documento()); + while (vec.hasMoreElements()) { + DocFiglioPadre row = (DocFiglioPadre)vec.nextElement(); + row.getDocumentoFiglio().setFlgStatoLavorazione(30L); + row.getDocumentoFiglio().superSave(); + } + } + if (getTipoDocumento().getFlgTipologia() == 200L) { + boolean calcoloAutomatico = false; + if (!calcoloAutomatico) { + RigaDocumento rd = new RigaDocumento(getApFull()); + long totalePezze = rd.getTotalePezzeStacchiByDocumento(getId_documento()); + Vectumerator vec = rd.findByDocumento(getId_documento(), 0L, "", 0, 0, 0); + long l_totaleColpi = 0L; + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + l_totaleColpi += row.getTotColpiRiga(); + } + setTotaleColpi(l_totaleColpi); + if (getFlgStatoLavorazione() != 100L) + if (getStacchiTotali() == getPezzeTotali()) { + setFlgStatoLavorazione(100L); + if (getTsFineLavorazione() == null) + setTsFineLavorazione(getTimestamp()); + } else if (getPezzeTotali() > 0L) { + setFlgStatoLavorazione(20L); + setTsFineLavorazione(null); + } else if (hasAlmentoUnaRigaTessTelaio()) { + setFlgStatoLavorazione(10L); + setTsFineLavorazione(null); + } else { + setFlgStatoLavorazione(0L); + setTsFineLavorazione(null); + } + } else { + Vectumerator vec = new RigaDocumento(getApFull()).findByDocumento(getId_documento(), 0L, "", 0, 0, 0); + boolean hasAlmenoUnTelaio = false, hasTuttiTelaio = true; + boolean hasAlmenoUnIniziale = false, hasTuttiIniziale = true; + boolean hasAlmenoUnFinale = false, hasTuttiFinale = true; + long l_totaleColpi = 0L; + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + l_totaleColpi += row.getTotColpiRiga(); + if (row.getId_telaio() > 0L) { + hasAlmenoUnTelaio = true; + } else { + hasTuttiTelaio = false; + } + if (row.getColpoInizialeRiga() > 0L) { + hasAlmenoUnIniziale = true; + } else { + hasTuttiIniziale = false; + } + if (row.getColpoFinaleRiga() > 0L) { + hasAlmenoUnFinale = true; + continue; + } + hasTuttiFinale = false; + } + if (hasTuttiFinale && hasTuttiIniziale && hasTuttiTelaio) { + setFlgStatoLavorazione(100L); + if (getTsFineLavorazione() == null) + setTsFineLavorazione(getTimestamp()); + } else if (hasAlmenoUnIniziale) { + setFlgStatoLavorazione(20L); + if (getTsInizioLavorazione() == null) + setTsInizioLavorazione(getTimestamp()); + } else if (hasTuttiTelaio) { + setFlgStatoLavorazione(10L); + } else { + setFlgStatoLavorazione(0L); + } + setTotaleColpi(l_totaleColpi); + } + } + return rp; + } + + public ResParm aggiornaSerialeTessutoDisposizioneTessitura() { + ResParm rp = new ResParm(true); + Vectumerator vecrd1 = findRigheDocumento(0, 0, 0); + while (vecrd1.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecrd1.nextElement(); + StringBuilder sb = new StringBuilder(getLavorazione().getAbbreviazione()); + sb.append("/"); + sb.append(getClifor().getId_clifor()); + sb.append("/"); + Vectumerator vetrdf = row.findRigheFilatiByRDTessuto(row.getId_rigaDocumento()); + while (vetrdf.hasMoreElements()) { + RigaDocumento rowF = (RigaDocumento)vetrdf.nextElement(); + sb.append(rowF.getSeriale()); + if (vetrdf.hasMoreElements()) + sb.append("/"); + } + row.setSeriale(sb.toString()); + row.superSave(); + } + return rp; + } + + public ResParm aggiornaSerialeTessutoLavorazione() { + ResParm rp = new ResParm(true); + Vectumerator vecrd1 = findRigheDocumento2(0, 0, 0); + while (vecrd1.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecrd1.nextElement(); + if (row.getSeriale().isEmpty()) { + RigaDocumento rowPartenza = row.getRigaDocumentoTessutoA(); + StringBuilder sb = new StringBuilder(getLavorazione().getAbbreviazione()); + sb.append("/"); + sb.append(getClifor().getId_clifor()); + sb.append("/"); + sb.append(rowPartenza.getSeriale()); + row.setSeriale(sb.toString()); + row.superSave(); + } + } + return rp; + } + + public ResParm aggiornaStatoLavorazione() { + if (getId_documento() > 0L) { + calcoloStatoLavorazione(); + return super.save(); + } + return new ResParm(false); + } + + public Vectumerator findPercentualiAgenti(DocumentoCR CR) { + String s_Sql_Find = "SELECT A.id_agente, A.percAgente, A.id_respCommerciale, A.percRespCommerciale, SUM(A.imponibileTotale) AS imponibileTotale FROM DOCUMENTO AS A INNER JOIN TIPO_DOCUMENTO AS B ON A.id_tipoDocumento = B.id_tipoDocumento "; + String s_Sql_Group = " GROUP BY A.id_agente, A.percAgente, A.id_respCommerciale, A.percRespCommerciale "; + String s_Sql_Order = " ORDER BY A.id_agente, A.id_respCommerciale "; + WcString wc = new WcString(); + wc.addWc(" B.flgTipologia = 1"); + if (CR.getDataDocumentoDa() != null) + wc.addWc(" A.dataDocumento >= ? "); + if (CR.getDataDocumentoA() != null) + wc.addWc(" A.dataDocumento <= ? "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group); + int i = 1; + if (CR.getDataDocumentoDa() != null) { + stmt.setDate(i, CR.getDataDocumentoDa()); + i++; + } + if (CR.getDataDocumentoA() != null) + stmt.setDate(i, CR.getDataDocumentoA()); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getProvvigioneAgente() { + DoubleOperator dop = new DoubleOperator(); + dop.add(getPercAgente()); + dop.multiply(getImponibileTotale()); + dop.divide(100.0F); + return dop.getResult(); + } + + public double getProvvigioneRespCommerciale() { + DoubleOperator dop = new DoubleOperator(); + dop.add(getPercRespCommerciale()); + dop.multiply(getImponibileTotale()); + dop.divide(100.0F); + return dop.getResult(); + } + + private long calcolaProgDocumento(long anno) { + try { + String s_sql = "select max(progDocumento) as _max from DOCUMENTO"; + WcString wc = new WcString(); + wc.addWc("dataDocumento>=? and dataDocumento<=? "); + wc.addWc("id_contatore =" + getId_contatore()); + if (getFlgStato() == 0L) { + wc.addWc("(flgStato is null or flgStato=0)"); + } else { + wc.addWc("flgStato =" + getFlgStato()); + } + wc.addWc("id_documento !=" + getId_documento()); + PreparedStatement ps = getConn().prepareStatement(s_sql + s_sql); + Date firstOfYear = getFirstOfYear((int)anno); + Date lastOfYear = getLastOfYear((int)anno); + ps.setDate(1, firstOfYear); + ps.setDate(2, lastOfYear); + return (long)getMax(ps) + 1L; + } catch (Exception e) { + return 0L; + } + } + + private long calcolaProgDocumento() { + long anno = getCurrentEsercizio(); + if (getDataDocumento() != null) { + Calendar cal = Calendar.getInstance(); + cal.setTime(getDataDocumento()); + anno = (long)cal.get(1); + } + return calcolaProgDocumento(anno); + } + + public RigheRegistroIva getRigaRegistroIva() { + if (this.rigaRegistroIva == null) { + Vectumerator vecRighe = findRigheDocumento(0, 0, 0); + this.rigaRegistroIva = new RigheRegistroIva(); + while (vecRighe.hasMoreElements()) { + RigaDocumento rf = (RigaDocumento)vecRighe.nextElement(); + this.rigaRegistroIva.addRigaDocumento(rf); + } + } + return this.rigaRegistroIva; + } + + public RigheRegistroIva getRigaRegistroIvaCompleto() { + if (this.rigaRegistroIvaCompleto == null) { + Vectumerator vecRighe = findRigheDocumento(0, 0, 0); + this.rigaRegistroIvaCompleto = new RigheRegistroIva(); + while (vecRighe.hasMoreElements()) { + RigaDocumento rf = (RigaDocumento)vecRighe.nextElement(); + this.rigaRegistroIvaCompleto.addRigaDocumento(rf); + } + boolean isNotaDiCredito = !(getTipoDocumento().getFlgTipologia() == 1L); + boolean isPiva = !getClifor().getPIva().isEmpty(); + if (getTipoDocumento().isTipoFatturaProfessionisti()) { + double ci = getImportoContIntegrativo(); + DoubleOperator ciIva = new DoubleOperator(ci); + ciIva.setScale(4, 5); + ciIva.multiply(getIvaDoc().getAliquota()); + ciIva.divide(100.0F); + this.rigaRegistroIvaCompleto.addRigaDocumento(getIvaDoc(), ci, ciIva.getResult(), isNotaDiCredito, isPiva); + } else { + if (getTotaleAltriCosti() != 0.0D) { + DoubleOperator csi = new DoubleOperator(getTotaleAltriCosti()); + csi.setScale(4, 5); + csi.multiply(getIvaDoc().getAliquota()); + csi.divide(100.0F); + this.rigaRegistroIvaCompleto.addRigaDocumento(getIvaDoc(), getTotaleAltriCosti(), csi.getResult(), isNotaDiCredito, isPiva); + } + double totaleScontiAbbuoni = getTotaleScontiAbbuoni(); + if (totaleScontiAbbuoni != 0.0D) { + DoubleOperator csi = new DoubleOperator(totaleScontiAbbuoni); + csi.setScale(4, 5); + csi.multiply(getIvaDoc().getAliquota()); + csi.divide(100.0F); + this.rigaRegistroIvaCompleto.addRigaDocumento(getIvaDoc(), -totaleScontiAbbuoni, -csi.getResult(), isNotaDiCredito, isPiva); + } + } + } + return this.rigaRegistroIvaCompleto; + } + + public Vectumerator findRigheDocumento(long l_flgCodiceRiga, String l_search, int pageNumber, int pageRows, int ordinamentoRiga) { + return new RigaDocumento(getApFull()).findByDocumento(getId_documento(), l_flgCodiceRiga, l_search, pageNumber, pageRows, ordinamentoRiga); + } + + public Vectumerator findRigheDocumento(String l_search, int pageNumber, int pageRows, int ordinamentoRiga) { + return findRigheDocumento(0L, l_search, pageNumber, pageRows, ordinamentoRiga); + } + + public Vectumerator findRigheDocumento(RigaDocumentoCR CR, int pageNumber, int pageRows, boolean ordineInverso) { + return new RigaDocumento(getApFull()).findByDocumento(CR, pageNumber, pageRows, 1); + } + + public Vectumerator findRigheDocumentoDisposizioneTaglio(int pageNumber, int pageRows, int ordinamentoRiga) { + return findRigheDocumento(100L, pageNumber, pageRows, ordinamentoRiga); + } + + public double getImponibileRighe() { + return this.imponibileRighe; + } + + public void setImponibileRighe(double imponibileRighe) { + this.imponibileRighe = imponibileRighe; + } + + public double getImportoIvaRighe() { + return this.importoIvaRighe; + } + + public void setImportoIvaRighe(double importoIvaRighe) { + this.importoIvaRighe = importoIvaRighe; + } + + public double getImportoRMRighe() { + return this.importoRMRighe; + } + + public void setImportoRMRighe(double importoRMRighe) { + this.importoRMRighe = importoRMRighe; + } + + public String getNumeroDocumento() { + if (getProgDocumentoAgg().isEmpty()) + return "" + getProgDocumento() + "/" + getProgDocumento(); + return "" + getProgDocumento() + "-" + getProgDocumento() + "/" + getProgDocumentoAgg(); + } + + public String getNumeroDocumentoCompleto() { + String stato = ""; + stato = stato + stato; + return stato + stato + " " + getTipoDocumento().getCodice(); + } + + public double getTotaleDocumento() { + if (getTipoDocumento().getFlgCorrispettivi() == 0L) { + DoubleOperator doubleOperator = new DoubleOperator(getImponibileTotale()); + doubleOperator.add(getImportoIvaTotale()); + if (getTipoDocumento().isTipoFatturaProfessionisti()) { + doubleOperator.add(getRimborsoArt15()); + doubleOperator.subtract(getImportoRitenutaAcconto()); + } + doubleOperator.setScale(2, 5); + return doubleOperator.getResult(); + } + DoubleOperator temp = new DoubleOperator(getImportoTotale()); + temp.subtract(getTotaleScontiAbbuoniConIva()); + temp.add(getTotaleAltriCostiConIva()); + temp.setScale(2, 5); + return temp.getResult(); + } + + public double getTotaleDocumentoArrotondato() { + if (getTotaleDocumento() > 0.0D) + return (double)Math.round(getTotaleDocumento()); + return 0.0D; + } + + public double getImportoIvaTotale() { + return this.importoIvaTotale; + } + + public double getImponibileTotale() { + return this.imponibileTotale; + } + + public String trovaPrimoBuco() { + Calendar cal = Calendar.getInstance(); + return trovaPrimoBuco((long)cal.get(1)); + } + + public String trovaPrimoBuco(long anno) { + String l_progPrimoBuco = trovaProgPrimoBuco(anno); + if (l_progPrimoBuco.isEmpty()) + return "Progressivi ok"; + if (l_progPrimoBuco.toLowerCase().startsWith("err")) + return l_progPrimoBuco; + return "Primo Progressivo Contatore " + getTipoDocumento().getContatore().getDescrizione() + " Mancante o con data errata anno " + anno + ": " + l_progPrimoBuco; + } + + public String getNote() { + return (this.note == null) ? "" : this.note.trim(); + } + + public void setNote(String note) { + this.note = note; + } + + public long getFlgStatoPrecedente() { + return this.flgStatoPrecedente; + } + + public void setFlgStatoPrecedente(long flgStatoPrecedente) { + this.flgStatoPrecedente = flgStatoPrecedente; + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + setId_cliforPrecedente(getId_clifor()); + setFlgStatoPrecedente(getFlgStato()); + setFlgStatoRiparazionePrecedente(getFlgStatoRiparazione()); + setFlgStatoPrenotazionePrecedene(getFlgStatoPrenotazione()); + setFlgDocumentoPrelevatoPrecedente(getFlgDocumentoPrelevato()); + setFlgStatoOrdineWwwPrecedente(getFlgStatoOrdineWww()); + setFlgStatoLavorazionePrecedente(getFlgStatoLavorazione()); + } + + protected void initFields() { + super.initFields(); + setId_cliforPrecedente(0L); + setFlgStatoPrecedente(0L); + setFlgStatoRiparazionePrecedente(0L); + setFlgStatoPrenotazionePrecedene(0L); + setFlgDocumentoPrelevatoPrecedente(0L); + setFlgStatoOrdineWwwPrecedente(0L); + setFlgStatoLavorazionePrecedente(-1L); + setRigaRegistroIva(null); + setFlgInviaAvviso(1L); + setRigaRegistroIvaCompleto(null); + setFlgHaDocumentoPadre(-1L); + setDocumentoFiglioUno(null); + setId_tipoDocumentoFiglio(0L); + setFlgStatoLavorazione(-1L); + } + + protected boolean useNullFor0() { + return true; + } + + public static final synchronized ResParm addSerialeSuRigheDocumento(DocumentoInterface doc, long l_id_articolo, long l_id_articoloVariante, String l_seriale) { + ResParm rp = doc.checkEMSTA(); + if (!rp.getStatus()) + return new ResParm(false, "ATTENZIONE! Tentativo di modificare una riga documento: " + rp.getMsg()); + if (doc.getTipoCaricoScarico() == 0L) { + RigaDocumentoCR CR = new RigaDocumentoCR(doc.getApFull()); + CR.setId_documento(doc.getId_documento()); + CR.setId_articolo(l_id_articolo); + CR.setId_articoloVariante(l_id_articoloVariante); + CR.setFlgTipoRicerca(0L); + CR.setSeriale(l_seriale); + Vectumerator vec = new RigaDocumento(doc.getApFull()).findByCR(CR, 0, 0); + if (vec.getTotNumberOfRecords() > 0) { + rp.setMsg("ERRORE! seriale " + l_seriale + " già inserito nel documento."); + } else { + CR.setSeriale(""); + vec = new RigaDocumento(doc.getApFull()).findByCR(CR, 0, 0); + boolean rowFound = false; + while (vec.hasMoreElements() && !rowFound) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getSeriale().isEmpty()) { + if (row.getQuantita() == 1.0D) { + row.setSeriale(l_seriale); + row.setQtaSlipStampate(0L); + row.save(); + } else if (row.getQuantita() > 1.0D) { + try { + row.setQuantita(row.getQuantita() - 1.0D); + row.setQuantitaUdm(row.getQuantita() - 1.0D); + if (row.getQtaSlipStampate() > 0L) + row.setQtaSlipStampate(row.getQtaSlipStampate() - 1L); + row.save(); + RigaDocumento row1 = (RigaDocumento)row.clone(); + row1.setQuantita(1.0D); + row1.setQuantitaUdm(1.0D); + row1.setId_rigaDocumento(0L); + row1.setSeriale(l_seriale); + row1.setQtaSlipStampate(0L); + addRigaDocumento(doc, row1); + } catch (Exception e) {} + } + rowFound = true; + } + } + if (rowFound) { + rp.setMsg("Seriale aggiunto correttamente"); + } else { + rp.setMsg("Attenzione! Il seriale non corrisponde a nessun articolo del documento"); + } + } + } + return rp; + } + + public ResParm delRigaDocumento(RigaDocumento row) { + ResParm rp = new ResParm(false); + rp = checkEMSTA(); + if (rp.getStatus()) { + RigaDocumento bean = new RigaDocumento(getApFull()); + bean.findByPrimaryKey(row.getId_rigaDocumento()); + if (bean.getQuantitaPrelevata() > 0.0D) { + rp.setStatus(false); + rp.setMsg("ERRORE! Impossibile cancellare righe prelevate!"); + } else { + Documento doc = bean.getDocumento(); + rp = bean.delete(); + if (rp.getStatus()) + rp.append(doc.save()); + } + } else { + rp.setMsg("ERRORE! Fattura emessa o stampata! Impossibile eliminare."); + } + return rp; + } + + public void setImportoIvaTotale(double importoIvaTotale) { + this.importoIvaTotale = importoIvaTotale; + } + + public void setImponibileTotale(double imponibileTotale) { + this.imponibileTotale = imponibileTotale; + } + + public double getTotaleAltriCosti() { + DoubleOperator temp = new DoubleOperator(getSpeseTrasporto()); + temp.add(getSpeseAltre()); + temp.add(getSpeseIncasso()); + temp.setScale(2, 5); + return temp.getResult(); + } + + public double getTotaleScontiAbbuoni() { + DoubleOperator temp = new DoubleOperator(getScontoIncondizionato()); + temp.add(getAbbuono()); + temp.setScale(2, 5); + return temp.getResult(); + } + + public double getTotaleScontiAbbuoniConIva() { + return conIva(getTotaleScontiAbbuoni(), (double)getIvaDoc().getAliquota()); + } + + public double getTotaleAltriCostiConIva() { + return conIva(getTotaleAltriCosti(), (double)getIvaDoc().getAliquota()); + } + + public long getFlgAutoAdd() { + return getTipoDocumento().getFlgAutoAdd(); + } + + public void setFlgAutoAdd(long flgAutoAdd) { + this.flgAutoAdd = flgAutoAdd; + } + + public long getFlgSingleLineArt() { + return getTipoDocumento().getFlgSingleLineArt(); + } + + public void setFlgSingleLineArt(long flgSingleLineArt) { + this.flgSingleLineArt = flgSingleLineArt; + } + + public ByteArrayOutputStream creaLabelDispoTessitura4x2(DocumentoCR CR) { + long pHMarg = 2L; + long l_indent = 4L; + long totLen = 40L; + String l_descrizioneTipo = ""; + int nCol = 2; + int nRow = 4; + float labelHeight = (PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow; + int altezzaCod = 60; + int larghezzaCod = 520; + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + this.document = new Document(PageSize.A4, 0.0F, 0.0F, 0.0F, 0.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + String titoloReport = getNumeroDocumentoCompleto(); + SimpleDateFormat tf = new SimpleDateFormat("HH:mm:ss"); + Date today = getToday(); + titoloReport = titoloReport + ". Stampato il " + titoloReport + " " + getDataFormat().format(today); + this.document.open(); + long labelNumber = 0L; + this.pdfPcorpo = new PdfPTable(nCol); + this.pdfPcorpo.setWidthPercentage(100.0F); + Documento doc = new Documento(getApFull()); + doc.findByPrimaryKey(CR.getId_documentoS()); + if (doc.getTipoDocumento().getFlgTipologia() == 200L) { + if (CR.getBlankLabels() > 0L) { + PdfPCell pdfPCell = new PdfPCell(); + pdfPCell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + pdfPCell.setHorizontalAlignment(1); + pdfPCell.setBorder(0); + for (int i = 0; (long)i < CR.getBlankLabels(); i++) { + labelNumber++; + this.pdfPcorpo.addCell(pdfPCell); + } + } + Vectumerator vec = findByCR(CR, 0, 0); + long numbOfLabels = 1L; + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vecRighe = row.findRigheDocumento(0, 0, ordineInverso); + while (vecRighe.hasMoreElements()) { + RigaDocumento rowRD = (RigaDocumento)vecRighe.nextElement(); + numbOfLabels = rowRD.getStacchi(); + String descLabel = rowRD.getDescrizioneRigaCompleta(); + PdfContentByte cb = this.writer.getDirectContent(); + Barcode128 codeBar = new Barcode128(); + codeBar.setCodeType(9); + for (int i = 0; (long)i < numbOfLabels; i++) { + PdfPCell cellLabel = new PdfPCell(); + cellLabel.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + PdfPTable pdfPtableLabel = new PdfPTable(2); + pdfPtableLabel.setWidthPercentage(100.0F); + PdfPCell pdfPCell1 = new PdfPCell(); + String ditta = getHeaderDoocumento(1).substring(0, getHeaderDoocumento(1).indexOf("\n")); + Paragraph paragraph = creaParagrafoConGrassetto(ditta + "\n" + ditta, PDF_fPiccolo, PDF_fPiccoloB); + paragraph.setLeading(10.0F); + pdfPCell1.addElement((Element)paragraph); + pdfPCell1.setHorizontalAlignment(1); + pdfPCell1.setColspan(2); + pdfPtableLabel.addCell(pdfPCell1); + pdfPCell1 = new PdfPCell(); + pdfPCell1.addElement(new Chunk("TELA: " + row.getRiferimento() + " - " + rowRD.getCodiceCartellinoIdx((long)i), PdfFontFactory.PDF_H_GrandissimoB)); + pdfPCell1.addElement(new Chunk("ARTICOLO: " + descLabel, PdfFontFactory.PDF_H_GrandeB)); + pdfPCell1.setColspan(2); + pdfPtableLabel.addCell(pdfPCell1); + pdfPCell1 = new PdfPCell(); + pdfPCell1.addElement(new Chunk("MT: \n ", PdfFontFactory.PDF_H_GrandissimoB)); + pdfPCell1.setColspan(1); + pdfPtableLabel.addCell(pdfPCell1); + pdfPCell1 = new PdfPCell(); + pdfPCell1.addElement(new Chunk("KG: ", PdfFontFactory.PDF_H_GrandissimoB)); + pdfPCell1.setColspan(1); + pdfPtableLabel.addCell(pdfPCell1); + pdfPCell1 = new PdfPCell(); + codeBar.setCode(rowRD.getCodiceCartellinoIdx((long)i)); + Image imgBarcode = codeBar.createImageWithBarcode(cb, null, null); + imgBarcode.scaleToFit((float)larghezzaCod, (float)altezzaCod); + pdfPCell1.addElement(new Chunk(imgBarcode, 10.0F, (float)(-altezzaCod + 15))); + pdfPCell1.setColspan(2); + pdfPCell1.setBorder(0); + pdfPtableLabel.addCell(pdfPCell1); + cellLabel.addElement((Element)pdfPtableLabel); + this.pdfPcorpo.addCell(cellLabel); + labelNumber++; + } + } + } + long numberBlankCell = (long)nCol - labelNumber % (long)nCol; + PdfPCell cell = new PdfPCell(); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorderColor(Color.MAGENTA); + if (numberBlankCell != (long)nCol) + for (int i = 0; (long)i < numberBlankCell; i++) + this.pdfPcorpo.addCell(cell); + } else { + Phrase ph = new Phrase("Attenzione! Non ci sono etichette da stampare!"); + PdfPCell cell = new PdfPCell(ph); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorder(0); + cell.setColspan(nCol); + this.pdfPcorpo.addCell(cell); + } + this.document.add((Element)this.pdfPcorpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + @Deprecated + public Documento getDocumentoFiglio() { + this.documentoFiglio = (Documento)getSecondaryObject(this.documentoFiglio, Documento.class, getId_documentoFiglio()); + return this.documentoFiglio; + } + + public void setDocumentoFiglio(Documento documentoFiglio) { + this.documentoFiglio = documentoFiglio; + } + + public long getId_documentoFiglio() { + return this.id_documentoFiglio; + } + + public void setId_documentoFiglio(long id_documentoFiglio) { + this.id_documentoFiglio = id_documentoFiglio; + setDocumentoFiglio(null); + } + + public long getFlgEmettiFatturaScontrino() { + return this.flgEmettiFatturaScontrino; + } + + public void setFlgEmettiFatturaScontrino(long flgEmettiFatturaScontrino) { + this.flgEmettiFatturaScontrino = flgEmettiFatturaScontrino; + } + + public ResParm generaScontrino() { + ResParm rp = new ResParm(true); + return rp; + } + + private String getCashStringSiemens() { + StringBuffer temp = new StringBuffer(); + String sep = "|"; + temp.append("KXCL"); + temp.append(sep); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + String rowString = row.getCashStringSiemens(); + if (!rowString.isEmpty()) { + temp.append(rowString); + temp.append(sep); + } + } + String leNote = ""; + if (!getCliforListino().getCodiceCartaFidelity().isEmpty()) + leNote = "Fidelity Card: " + getCliforListino().getCodiceCartaFidelity() + " - " + getCliforListino().getListino().getDescrizione(); + if (!getNote().isEmpty()) + leNote = leNote + " " + leNote; + if (!leNote.trim().isEmpty()) { + leNote = leNote.trim().replace('\r', ' '); + StringBuffer sbNote = new StringBuffer(); + for (int i = 0; i < leNote.length(); i++) { + if ((leNote.charAt(i) == ' ' && sbNote.length() > 23) || leNote.charAt(i) == '\n' || leNote.charAt(i) == '\r') { + temp.append("KXSE" + sbNote.toString()); + temp.append(sep); + sbNote = new StringBuffer(); + } + if (leNote.charAt(i) != '\n' && leNote.charAt(i) != '\r') + sbNote.append(leNote.charAt(i)); + } + if (sbNote.length() > 0) { + temp.append("KXSE" + sbNote.toString()); + temp.append(sep); + } + } + TipoPagamento tp = getTipoPagamento(); + if (tp.getDBState() == 1) { + temp.append("KX" + tp.getCodiceTenderCassa() + tp.getDescrizione()); + } else { + temp.append("KXT1"); + } + temp.append(sep); + temp.append("KXAC"); + temp.append(sep); + return temp.toString(); + } + + public boolean isScontrinoEmesso() { + return !getEchoScontrino().isEmpty(); + } + + public void setEchoScontrino(String l_echo) { + this.echoScontrino = l_echo; + } + + public ResParm stampaScontrino(boolean isFiscale, RegCassa l_regCassa) { + boolean test = false; + if (test) { + ResParm rp = aggiornaEchoScontrino(" test cassa siemens "); + return rp; + } + if (l_regCassa.getFlgTipoCassa() == 0L) + return stampaScontrinoSiemens(isFiscale, l_regCassa); + return stampaScontrinoEpson(isFiscale, l_regCassa); + } + + public ResParm aggiornaEchoScontrino(String theMsg) { + setEchoScontrino(theMsg); + return super.save(); + } + + public ResParm associaOrdineTaglioADosposizioneTaglio(long l_id_documentoOrdineTaglio) { + if (getTipoDocumento().getFlgObbligoPrelievo() == 1L) + return new ResParm(false, "ERRORE! Figlio non generabile. Documento con obbligo di prelievo"); + long righeCreate = 0L; + ResParm rp = new ResParm(); + ResParm rpRow = new ResParm(); + DocFiglioPadre dfp = new DocFiglioPadre(getApFull()); + Vectumerator rowDfp = dfp.findByFiglio(l_id_documentoOrdineTaglio); + if (rowDfp.getTotNumberOfRecords() == 0) { + dfp.setId_documentoPadre(getId_documento()); + dfp.setId_documentoFiglio(l_id_documentoOrdineTaglio); + rp = dfp.save(); + dfp.getDocumentoFiglio().setFlgStatoLavorazione(20L); + dfp.getDocumentoFiglio().superSave(); + Documento documentoFiglio = dfp.getDocumentoFiglio(); + Vectumerator rowRdf = documentoFiglio.findRigheDocumento(0, 0, 0); + while (rowRdf.hasMoreElements()) { + RigaDocumento rd = (RigaDocumento)rowRdf.nextElement(); + rd.setId_documento(getId_documento()); + rd.setId_rigaDocumento(0L); + rd.setDBState(0); + rd.setFlgSingleLineArt(1L); + rp = addRigaDocumento(this, rd); + if (!rp.getStatus()) + break; + rd.setNrOriginale(rd.getNr()); + rd.superSave(); + } + } else { + rp.setStatus(false); + DocFiglioPadre currentDfp = (DocFiglioPadre)rowDfp.nextElement(); + if (currentDfp.getId_documentoPadre() == getId_documento()) { + rp.setMsg("Errore! Ordine taglio gia' legato alla disposizione corrente"); + } else { + rp.setMsg("Errore! Ordine taglio legato ad un altra disposizione"); + } + } + findByPrimaryKey(getId_documento()); + return rp; + } + + public String getEchoScontrino() { + return (this.echoScontrino == null) ? "" : this.echoScontrino.trim(); + } + + public long getTipoRigaDocumento() { + if (getTipoDocumento().getFlgClienteFornitore().equals("F")); + return 0L; + } + + public ByteArrayOutputStream creaDocumentoPdf(DocumentoCR CR, boolean soloFile) { + if (CR.getId_documentoS() > 0L) { + CR.setFilePdf(getPathStampaDocumentoFull()); + if (new File(CR.getFilePdf()).exists()) { + if (soloFile) + return null; + return getByteArrayFromFile(CR.getFilePdf()); + } + } else { + CR.setFilePdf(getPathTmpFull() + "docs_" + getPathTmpFull() + ".pdf"); + } + boolean creaFile = true; + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + int pageNumber = 1; + try { + if (CR.getId_documentoS() > 0L) { + Documento bean = null; + bean = new Documento(getApFull()); + bean.findByPrimaryKey(CR.getId_documentoS()); + bean.setCurrentLang(getCurrentLang()); + if (bean.getTipoDocumento().getTipologiaDocumento().getCodice() == 220L) { + this.document = new Document(PageSize.A5, 20.0F, 20.0F, 20.0F, 10.0F); + } else if (bean.getTipoDocumento().getFlgTipoStampa() == 12L) { + this.document = new Document(PageSize.A4.rotate(), 20.0F, 20.0F, 20.0F, 10.0F); + } else { + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F); + } + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + this.document = creaDocumentoUno(bean, this.document, pageNumber); + CR.setFilePdf(bean.getPathStampaDocumentoFull()); + bean.superSave(); + setDescDocumenti(bean.getDescDocumenti()); + if (bean.getTmstStampato() == null) + bean.saveTmstStampato(); + } else { + String temp = ""; + Vectumerator vec = new Documento(getApFull()).findByCR(CR, 0, 0); + boolean firstrecord = true; + while (vec.hasMoreElements()) { + pageNumber = 1; + Documento row = (Documento)vec.nextElement(); + if (firstrecord) { + if (row.getTipoDocumento().getTipologiaDocumento().getCodice() == 220L) { + this.document = new Document(PageSize.A5, 20.0F, 20.0F, 20.0F, 10.0F); + } else { + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F); + } + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + firstrecord = false; + } + this.document = creaDocumentoUno(row, this.document, pageNumber); + temp = temp + temp; + if (vec.hasMoreElements()) { + this.document.newPage(); + temp = temp + " \n"; + } + if (row.getTmstStampato() == null) + row.saveTmstStampato(); + } + setDescDocumenti(temp); + CR.setFilePdf(getDocBase() + getDocBase() + "_" + getPathStampeDocumenti() + "docs.pdf"); + } + if (this.document != null) { + this.document.close(); + this.document = null; + } + if (creaFile) { + ResParm rp = createFileFromByteArray(ba, CR.getFilePdf()); + if (rp.getStatus()) { + DBAdapter.printDebug(true, "Creato file documento " + CR.getFilePdf()); + } else { + DBAdapter.printDebug(true, "ATTENZIONE! IMPOSSIBILE CREARE DOCUMENTO! ID: " + CR.getId_documentoS() + " filepdf: " + + CR.getFilePdf() + "\n rp.getmsg:" + rp.getMsg()); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + protected void creaDocumentoIntestazione(Table l_pdfCorpo) { + try { + String descCliente, descDestinazione; + int cellLeading = 8; + SimpleDateFormat df = getDataFormat(); + float imgLogoWidth = getDocLogoWidth(); + Cell cell = new Cell(); + try { + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + if (imgLogoWidth > 0.0F) + imgLogo.scaleToFit(imgLogoWidth, imgLogoWidth); + cell.addElement(new Chunk(imgLogo, 0.0F, 0.0F)); + } catch (Exception e) { + cell.addElement(new Chunk("\n\n", PdfFontFactory.PDF_fPiccolo)); + } + Paragraph paragraph = creaParagrafoConGrassetto("\n" + getHeaderDoocumento(1) + "\n" + getHeaderDoocumento(2), PDF_fPiccolo, PDF_fPiccoloB); + paragraph.setLeading(10.0F); + cell.addElement((Element)paragraph); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(22); + l_pdfCorpo.addCell(cell); + if (getId_clifor() > 0L) { + descCliente = ""; + if (getClifor().getpIva().isEmpty() && getClifor().getCodFisc().isEmpty() && getClifor().getCognome().isEmpty()) { + descCliente = "AUTOFATTURA\n"; + descCliente = descCliente + descCliente; + } else { + descCliente = descCliente + descCliente + "\n"; + descCliente = descCliente + descCliente; + String capComune = getClifor().getCapComune(); + if (!getClifor().getCapZona().isEmpty()) + capComune = getClifor().getCapZona(); + if (!getClifor().getNumeroCivico().isEmpty()) + descCliente = descCliente + " n." + descCliente; + descCliente = descCliente + "\n" + descCliente + " " + capComune; + if (!getClifor().getProvinciaComune().isEmpty()) + descCliente = descCliente + " (" + descCliente + ")"; + if (!getClifor().getId_nazione().isEmpty()) + descCliente = descCliente + " " + descCliente; + } + } else { + descCliente = getNominativoDocumento(); + } + if (!getIndirizzoSped().isEmpty() && !getPresso().isEmpty()) { + descDestinazione = ""; + descDestinazione = descDestinazione + "c/o " + descDestinazione + "\n"; + descDestinazione = descDestinazione + descDestinazione + " n." + getIndirizzoSped() + "\n" + getNumeroCivicoSped() + " " + getCapSped() + " (" + getCittaSped() + ")"; + if (!getId_nazioneSped().isEmpty()) + descDestinazione = descDestinazione + " " + descDestinazione; + } else if (getId_destinazioneDiversa() == 0L) { + if (getParm("DESTINAZIONE").getNumeroLong() == 1L) { + descDestinazione = "IDEM\n\n"; + } else { + descDestinazione = ""; + } + } else { + descDestinazione = ""; + if (!getDestinazioneDiversa().getPressoDD().isEmpty()) + descDestinazione = descDestinazione + "c/o " + descDestinazione + "\n"; + descDestinazione = descDestinazione + descDestinazione + " n." + getDestinazioneDiversa().getIndirizzoDD() + "\n" + getDestinazioneDiversa().getNumeroCivicoDD() + " " + getDestinazioneDiversa().getCapComuneDD() + " (" + getDestinazioneDiversa().getDescrizioneComuneDD() + ")"; + if (!getDestinazioneDiversa().getId_nazioneDD().isEmpty()) + descDestinazione = descDestinazione + " " + descDestinazione; + } + cell = new Cell(); + cell.addElement(new Chunk("\n\nSPETT.LE\n\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(descCliente, PdfFontFactory.PDF_fGrande)); + if (!descDestinazione.isEmpty()) { + cell.addElement(new Chunk("\nDESTINAZIONE\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(descDestinazione, PdfFontFactory.PDF_fGrande)); + } + cell.setVerticalAlignment(4); + cell.setLeading(12.0F); + cell.setBorder(0); + cell.setRowspan(3); + cell.setColspan(18); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("TIPO DOCUMENTO\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk("\n", PdfFontFactory.PDF_fMedio)); + if (getFlgStato() == 0L) + cell.addElement(new Chunk("(B) ", PdfFontFactory.PDF_fMedioB)); + if (getFlgStato() == 2L) { + cell.addElement(new Chunk("FATTURA PROFORMA\n", PdfFontFactory.PDF_fGrandeB)); + } else { + cell.addElement(new Chunk(getTipoDocumento().getDescrizioneStampa() + "\n", PdfFontFactory.PDF_fGrandeB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("N. DOC.\n\n", PdfFontFactory.PDF_fPiccolissimo)); + if (getProgOrdineWww() > 0L) { + cell.addElement(new Chunk(String.valueOf(getProgOrdineWww()), PdfFontFactory.PDF_fMedioB)); + } else { + cell.addElement(new Chunk(String.valueOf(getNumeroDocumento()), PdfFontFactory.PDF_fMedioB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(4); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("DATA\n\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(df.format(getDataDocumento()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(4); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Pag.\n\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(getNf0().format(getNumPagDocumento()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("xx", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + cell.setRowspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("RIF. INTERNO \n", PdfFontFactory.PDF_fPiccolissimo)); + if (!getDescrizioneDocumentiPadre().isEmpty()) { + if (getParm("ORDINI_WWW_USA_PROG_WWW").isTrue()) { + cell.addElement(new Chunk(getNf0().format(getDocumentoPadreUno().getProgOrdineWww()), PdfFontFactory.PDF_fMedioB)); + } else { + cell.addElement(new Chunk(getDescrizioneDocumentiPadre(), PdfFontFactory.PDF_fPiccolissimo4)); + } + } else { + cell.addElement(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimoB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setMaxLines(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("COD. C/F\t\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(String.valueOf(getClifor().getId_clifor()), PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(3); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("PARTITA IVA/CF\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(getClifor().getPIva() + " / " + getClifor().getPIva(), PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(11); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("RIF. CLIENTE/FORNITORE \n", PdfFontFactory.PDF_fPiccolissimo)); + if (!getRiferimento().isEmpty()) { + cell.addElement(new Chunk(getRiferimento(), PdfFontFactory.PDF_fPiccolissimoB)); + if (getDataRiferimento() != null) + cell.addElement(new Chunk(" del " + df.format(getDataRiferimento()), PdfFontFactory.PDF_fPiccolissimoB)); + } else { + cell.addElement(new Chunk(".", PdfFontFactory.PDF_fPiccoloBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(8); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("CONDIZIONI DI PAGAMENTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (getFlgPagamentoDataFissa() > 0L) { + if (getDataScadenzaPagamento() != null) + cell.addElement(new Chunk(getPagamentoDataFissa() + " al " + getPagamentoDataFissa(), PdfFontFactory.PDF_fPiccolissimoB)); + } else { + cell.addElement(new Chunk(getTipoPagamento().getDescrizione(), PdfFontFactory.PDF_fPiccolissimoB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(12); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("BANCA D'APPOGGIO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (getTipoPagamento().getFlgTipoPagamento() == 1L && !getBancaCFDesc().isEmpty()) + if (getIbanCF().isEmpty()) { + cell.addElement(new Chunk(getBancaCFDesc(), PdfFontFactory.PDF_fPiccolissimoB)); + } else { + cell.addElement(new Chunk( + getBancaCFDesc() + " Abi: " + getBancaCFDesc() + " Cab: " + getAbiCF(), PdfFontFactory.PDF_fPiccolissimoB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + if (getTipoDocumento().getFlgTipoStampa() == 2L) { + creaDocumentoIntestazioneCorpoDDT(l_pdfCorpo); + } else if (getTipoDocumento().getFlgTipoStampa() == 3L) { + creaDocumentoIntestazioneCorpoFtPro(l_pdfCorpo); + } else if (getTipoDocumento().getFlgTipoStampa() == 6L) { + creaDocumentoIntestazioneCorpoFtSemplice(l_pdfCorpo); + } else if (getTipoDocumento().getFlgTipoStampa() == 12L) { + creaDocumentoIntestazioneCorpoFtAcquisto(l_pdfCorpo); + } else if (getTipoDocumento().getFlgTipoStampa() == 11L) { + creaDocumentoIntestazioneCorpoRicevuta(l_pdfCorpo); + } else { + creaDocumentoIntestazioneCorpoFt(l_pdfCorpo); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoDisposizioneTaglioXLavorazione(Table l_pdfCorpo) { + String prtLang = getLangPrimary(); + try { + int cellLeading = 10; + SimpleDateFormat df = getDataFormat(); + float imgLogoWidth = getDocLogoWidth() / 4.0F; + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + if (imgLogoWidth > 0.0F) + imgLogo.scaleToFit(imgLogoWidth, imgLogoWidth); + Cell cell = new Cell(); + String desc = getArticolo().getDescrizioneCompleta(prtLang); + cell.addElement(new Chunk(desc, + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrandissimoXB, prtLang))); + if (getId_taglia() > 0L) { + desc = desc + desc + ": " + translate("taglia", prtLang); + cell.addElement(new Chunk(desc, PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fMedio, prtLang))); + } + if (!getArticolo().getNotaArticolo().isEmpty()) + cell.addElement(new Chunk("\n" + DBAdapter.convertHtmlToString(getArticolo().getNotaArticolo()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, prtLang))); + if (!getArticolo().getNoteTessutiBaseHtml(prtLang).isEmpty()) + cell.addElement(new Chunk("\n" + getArticolo().getNoteTessutiBase(prtLang), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, prtLang))); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(22); + l_pdfCorpo.addCell(cell); + String imgFileName = getDocBase() + getDocBase() + getArticolo().getPathImg(); + if (new File(imgFileName).exists()) { + imgLogoWidth = 60.0F; + Image imgArt = Image.getInstance(imgFileName); + if (imgLogoWidth > 0.0F) + imgArt.scaleToFit(imgLogoWidth, imgLogoWidth); + cell = new Cell(); + cell.addElement(new Chunk(imgArt, 0.0F, 0.0F)); + } else { + cell = new Cell(); + } + cell.setBorder(0); + cell.setColspan(8); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(getNumeroDocumentoCompleto(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrande, prtLang))); + cell.addElement(new Chunk(" " + getDataFormat().format(getDataDocumento()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrande, prtLang))); + if (!getRiferimento().isEmpty()) { + cell.addElement(new Chunk("\nRIF. ", + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrande, prtLang))); + cell.addElement(new Chunk(getRiferimento() + " " + getRiferimento(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrande, prtLang))); + } + cell.addElement(new Chunk("\n", PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimo, prtLang))); + cell.addElement(new Chunk(getClifor().getDescrizioneCompleta(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimo, prtLang))); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(translate("N. CAPI", prtLang) + "\n\n" + translate("N. CAPI", prtLang), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrandeB, prtLang))); + cell.addElement(new Chunk("\n", PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fMedio, prtLang))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + Vectumerator vecTessuti = findRigheDocumentoDisposizioneTaglio(0, 0, 0); + long totTessuti = (long)vecTessuti.getTotNumberOfRecords(); + int colSpan = (int)(15L / totTessuti); + int totColSpan = 0; + while (vecTessuti.hasMoreElements()) { + RigaDocumento rowTessuto = (RigaDocumento)vecTessuti.nextElement(); + cell = new Cell(); + cell.addElement(new Chunk(rowTessuto.getDescrizioneRiga(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, prtLang))); + if (rowTessuto.getId_articoloTessutoColore() == 0L) { + cell.addElement(new Chunk("\n" + rowTessuto.getMtTessutoXTaglio() + " " + translate("Mt.", prtLang), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccoloB, prtLang))); + cell.addElement(new Chunk("\n" + rowTessuto.getNumTeli() + " " + translate("Teli", prtLang), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccoloB, prtLang))); + } else { + cell.addElement(new Chunk("\n" + rowTessuto.getMtTessutoXTaglio() + " " + translate("Mt.", prtLang), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrandeBlu, prtLang))); + cell.addElement(new Chunk("\n" + rowTessuto.getNumTeli() + " " + translate("Teli", prtLang), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrandeBlu, prtLang))); + } + cell.addElement(new Chunk("\n" + rowTessuto.getCapiPerTelo() + " " + translate("C./telo", prtLang), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccoloB, prtLang))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(colSpan * 2); + totColSpan += colSpan * 2; + l_pdfCorpo.addCell(cell); + } + if (totColSpan < 30) { + cell = new Cell(); + cell.addElement(new Chunk("", + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimo, prtLang))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBorder(0); + cell.setColspan(30 - totColSpan); + l_pdfCorpo.addCell(cell); + } + cell = new Cell(); + cell.addElement(new Chunk(translate("QTA'", prtLang), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccoloB, prtLang))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(3); + cell.setBackgroundColor(Color.LIGHT_GRAY); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(translate("COLORE", prtLang) + "\n", + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccoloB, prtLang))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + cell.setBackgroundColor(Color.LIGHT_GRAY); + l_pdfCorpo.addCell(cell); + Vectumerator vecArticoli = findRigheDocumento(0, 0, 0); + while (vecArticoli.hasMoreElements()) { + RigaDocumento rowArticolo = (RigaDocumento)vecArticoli.nextElement(); + totColSpan = 0; + cell = new Cell(); + cell.addElement(new Chunk(getNf0().format(rowArticolo.getQuantita()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(3); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + desc = rowArticolo.getArticoloVariante().getColore().getDescrizione(prtLang); + if (prtLang.equals("cn")) { + cell.addElement(new Chunk(rowArticolo.getArticoloVariante().getColore().getDescrizione("it") + "\n", + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, prtLang))); + cell.addElement(new Chunk(desc, + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fMedio, prtLang))); + } else { + cell.addElement(new Chunk(desc, + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccoloB, prtLang))); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + vecTessuti.moveFirst(); + while (vecTessuti.hasMoreElements()) { + RigaDocumento rowTessuto = (RigaDocumento)vecTessuti.nextElement(); + cell = new Cell(); + cell.addElement(new Chunk( + getNf0().format(rowTessuto.getNumeroTeliRigaByArticolo(rowArticolo.getId_rigaDocumento()).getNumTeliRiga()) + " " + getNf0().format(rowTessuto.getNumeroTeliRigaByArticolo(rowArticolo.getId_rigaDocumento()).getNumTeliRiga()), + + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, prtLang))); + cell.addElement(new Chunk("\n" + + getNf0().format(rowTessuto.getNumeroTeliRigaByArticolo(rowArticolo.getId_rigaDocumento()).getMtTessutoRiga()) + " " + + translate("mt.", prtLang), PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(colSpan); + totColSpan += colSpan; + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.setColspan(colSpan); + totColSpan += colSpan; + l_pdfCorpo.addCell(cell); + } + if (totColSpan < 30) { + cell = new Cell(); + cell.addElement(new Chunk("", + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimo, prtLang))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(30 - totColSpan); + l_pdfCorpo.addCell(cell); + } + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoDisposizioneTaglioXDispositore(Table l_pdfCorpo) { + try { + int cellLeading = 10; + SimpleDateFormat df = getDataFormat(); + Cell blankRow = new Cell(); + blankRow.setVerticalAlignment(4); + blankRow.setHorizontalAlignment(0); + blankRow.setLeading((float)cellLeading); + blankRow.setBorder(0); + blankRow.setColspan(40); + float imgLogoWidth = getDocLogoWidth() / 4.0F; + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + if (imgLogoWidth > 0.0F) + imgLogo.scaleToFit(imgLogoWidth, imgLogoWidth); + Cell cell = new Cell(); + String desc = getArticolo().getDescrizioneCompleta(getCurrentLang()); + cell.addElement(new Chunk(desc, + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrandissimoXB, getCurrentLang()))); + if (getId_taglia() > 0L) { + desc = desc + desc + ": " + translate("taglia", getCurrentLang()); + cell.addElement(new Chunk(desc, + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fMedio, getCurrentLang()))); + } + if (!getArticolo().getNotaArticolo().isEmpty()) + cell.addElement(new Chunk("\n" + DBAdapter.convertHtmlToString(getArticolo().getNotaArticolo()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, getCurrentLang()))); + if (!getArticolo().getNoteTessutiBaseHtml(getCurrentLang()).isEmpty()) + cell.addElement(new Chunk("\n" + getArticolo().getNoteTessutiBase(getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, getCurrentLang()))); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(22); + l_pdfCorpo.addCell(cell); + String imgFileName = getDocBase() + getDocBase() + getArticolo().getPathImg(); + if (new File(imgFileName).exists()) { + imgLogoWidth = 60.0F; + Image imgArt = Image.getInstance(imgFileName); + if (imgLogoWidth > 0.0F) + imgArt.scaleToFit(imgLogoWidth, imgLogoWidth); + cell = new Cell(); + cell.addElement(new Chunk(imgArt, 0.0F, 0.0F)); + } else { + cell = new Cell(); + } + cell.setBorder(0); + cell.setColspan(8); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(getNumeroDocumentoCompleto(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrande, getCurrentLang()))); + cell.addElement(new Chunk(" " + getDataFormat().format(getDataDocumento()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrande, getCurrentLang()))); + if (!getRiferimento().isEmpty()) { + cell.addElement(new Chunk("\nRIF. ", + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrande, getCurrentLang()))); + cell.addElement(new Chunk(getRiferimento() + " " + getRiferimento(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrande, getCurrentLang()))); + } + cell.addElement(new Chunk("\n", + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimo, getCurrentLang()))); + cell.addElement(new Chunk(getClifor().getDescrizioneCompleta(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimo, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(translate("N. CAPI", getCurrentLang()) + "\n\n" + translate("N. CAPI", getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrandeB, getCurrentLang()))); + cell.addElement(new Chunk("\n", + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fMedio, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(translate("Rif. Ordini", getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimoB, getCurrentLang()))); + cell.addElement(new Chunk("\n" + getDescDocFiglioPadreByPadre(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimo, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(30); + l_pdfCorpo.addCell(cell); + l_pdfCorpo.addCell(blankRow); + Vectumerator vecDispo = findRigheDocumento(0, 0, 0); + cell = new Cell(); + cell.addElement(new Chunk(translate("Disposizione Globale", getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimoB, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(translate("Descrizione", getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimoB, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(translate("Q.tà Orig", getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimoB, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(translate("Q.tà", getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimoB, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + while (vecDispo.hasMoreElements()) { + RigaDocumento rowDispo = (RigaDocumento)vecDispo.nextElement(); + cell = new Cell(); + cell.addElement(new Chunk(rowDispo.getDescrizioneRigaCompleta(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(getNf().format(rowDispo.getNrOriginale()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(getNf().format(rowDispo.getNr()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + } + l_pdfCorpo.addCell(blankRow); + Vectumerator vecTessuti = findRigheDocumento2("", 0, 0, 2); + cell = new Cell(); + cell.addElement(new Chunk(translate("Elenco Tessuti Necessari", getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimoB, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(translate("Descrizione", getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimoB, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(translate("Q.tà", getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimoB, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(translate("Disponibilità", getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimoB, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + while (vecTessuti.hasMoreElements()) { + RigaDocumento rowTessuti = (RigaDocumento)vecTessuti.nextElement(); + cell = new Cell(); + cell.addElement(new Chunk(rowTessuti.getDescrizioneRiga(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(getNf().format(rowTessuti.getQuantita()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(getNf().format(rowTessuti.getQuantitaEffettiva()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + } + } catch (Exception e) { + handleDebug(e); + } + } + + private Document creaDocumentoUno(Documento bean, Document l_document, int pageNumber) { + try { + Table l_pdfCorpo = getNewPdfCorpoDocument(); + bean.setNumPagDocumento(1L); + if (bean.getTipoDocumento().getTipologiaDocumento().getCodice() == 220L) { + if (getPrtCommand() == 1L) { + bean.creaDocumentoDisposizioneTaglioXLavorazione(l_pdfCorpo); + } else { + bean.creaDocumentoDisposizioneTaglioXDispositore(l_pdfCorpo); + this.document.add((Element)l_pdfCorpo); + this.document.newPage(); + l_pdfCorpo = getNewPdfCorpoDocument(); + bean.creaDocumentoDisposizioneTaglioXDispositoreElencoOrdini(l_pdfCorpo); + } + } else if (bean.getTipoDocumento().getFlgTipoStampa() == 2L) { + bean.creaDocumentoIntestazione(l_pdfCorpo); + bean.creaDocumentoCorpoDDT(l_document, l_pdfCorpo); + bean.creaDocumentoFooterDDT(l_pdfCorpo, true); + bean.creaDocumentoFooterDDTFirme(l_pdfCorpo, true); + } else if (bean.getTipoDocumento().getFlgTipoStampa() == 1L) { + bean.creaDocumentoIntestazione(l_pdfCorpo); + bean.creaDocumentoCorpoFt(l_document, l_pdfCorpo); + bean.creaDocumentoFooterDDT(l_pdfCorpo, true); + bean.creaDocumentoFooterFatture(l_pdfCorpo, true); + bean.creaDocumentoFooterDDTFirme(l_pdfCorpo, true); + } else if (bean.getTipoDocumento().getFlgTipoStampa() == 0L) { + bean.creaDocumentoIntestazione(l_pdfCorpo); + bean.creaDocumentoCorpoFt(l_document, l_pdfCorpo); + bean.creaDocumentoFooterFatture(l_pdfCorpo, true); + } else if (bean.getTipoDocumento().getFlgTipoStampa() == 12L) { + bean.creaDocumentoIntestazione(l_pdfCorpo); + bean.creaDocumentoCorpoFtAcquistoBollaCarico(l_document, l_pdfCorpo); + bean.creaDocumentoFooterFatture(l_pdfCorpo, true); + } else if (bean.getTipoDocumento().getFlgTipoStampa() == 7L) { + bean.creaDocumentoIntestazione(l_pdfCorpo); + bean.creaDocumentoCorpoFt(l_document, l_pdfCorpo); + bean.creaDocumentoFooterFattureConPesiEColli(l_pdfCorpo, true); + } else if (bean.getTipoDocumento().getFlgTipoStampa() == 6L) { + bean.creaDocumentoIntestazione(l_pdfCorpo); + bean.creaDocumentoCorpoFtSemplice(l_document, l_pdfCorpo); + creaDocumentoFooterFattureSemplici(l_pdfCorpo, true); + } else if (bean.getTipoDocumento().getFlgTipoStampa() == 3L) { + bean.creaDocumentoIntestazione(l_pdfCorpo); + bean.creaDocumentoCorpoFtPro(l_document, l_pdfCorpo); + bean.creaDocumentoFooterFatturePro(l_pdfCorpo, true); + } else if (bean.getTipoDocumento().getFlgTipoStampa() == 4L) { + bean.creaDocumentoIntestazioneS(l_pdfCorpo); + bean.creaDocumentoCorpoFtProS(l_document, l_pdfCorpo); + bean.creaDocumentoFooterFattureProS(l_pdfCorpo, true); + } else if (bean.getTipoDocumento().getFlgTipoStampa() == 5L) { + bean.creaDocumentoSchedaRiparazione(l_pdfCorpo); + } else if (bean.getTipoDocumento().getFlgTipoStampa() == 11L) { + bean.creaDocumentoIntestazione(l_pdfCorpo); + bean.creaDocumentoCorpoRicevuta(l_document, l_pdfCorpo); + bean.creaDocumentoFooterRicevute(l_pdfCorpo, true); + } + bean.setDescDocumenti(bean.getNumeroDocumentoCompleto()); + this.document.add((Element)l_pdfCorpo); + } catch (Exception e) { + e.printStackTrace(); + } + return this.document; + } + + protected int incrementaNumRighe(int riga, int righePerPagina, Document l_document, Table l_pdfCorpo, boolean hasMoreRow) { + riga++; + int rpp = righePerPagina; + if (hasMoreRow) + rpp += 5; + if (riga >= righePerPagina && hasMoreRow) { + if (getTipoDocumento().getFlgTipoStampa() == 2L) { + creaDocumentoFooterDDTTotale(l_pdfCorpo, false); + creaDocumentoFooterDDT(l_pdfCorpo, false); + creaDocumentoFooterDDTFirme(l_pdfCorpo, false); + } else if (getTipoDocumento().getFlgTipoStampa() == 1L) { + creaDocumentoFooterDDT(l_pdfCorpo, false); + creaDocumentoFooterFatture(l_pdfCorpo, false); + creaDocumentoFooterDDTFirme(l_pdfCorpo, false); + } else if (getTipoDocumento().getFlgTipoStampa() == 0L) { + creaDocumentoFooterFattureConPesiEColli(l_pdfCorpo, false); + } else if (getTipoDocumento().getFlgTipoStampa() == 6L) { + creaDocumentoFooterFattureSemplici(l_pdfCorpo, false); + } else if (getTipoDocumento().getFlgTipoStampa() == 3L) { + creaDocumentoIntestazione(l_pdfCorpo); + creaDocumentoCorpoFtPro(l_document, l_pdfCorpo); + creaDocumentoFooterFatturePro(l_pdfCorpo, false); + } else if (getTipoDocumento().getFlgTipoStampa() == 4L) { + creaDocumentoIntestazioneS(l_pdfCorpo); + creaDocumentoCorpoFtProS(l_document, l_pdfCorpo); + creaDocumentoFooterFattureProS(l_pdfCorpo, false); + } else if (getTipoDocumento().getFlgTipoStampa() == 11L) { + creaDocumentoIntestazione(l_pdfCorpo); + creaDocumentoCorpoRicevuta(l_document, l_pdfCorpo); + creaDocumentoFooterRicevute(l_pdfCorpo, false); + } else if (getTipoDocumento().getFlgTipoStampa() == 7L) { + creaDocumentoFooterFattureConPesiEColli(l_pdfCorpo, false); + } + try { + l_document.add((Element)l_pdfCorpo); + l_document.newPage(); + l_pdfCorpo.deleteAllRows(); + setNumPagDocumento(getNumPagDocumento() + 1L); + creaDocumentoIntestazione(l_pdfCorpo); + } catch (Exception e) { + handleDebug(e, 2); + } + riga = 0; + } + return riga; + } + + public String getNumeroDocumentoPdf() { + String sep = "-"; + StringBuilder sb = new StringBuilder(getTipoDocumento().getCodice()); + sb.append("-"); + sb.append(getProgDocumento()); + sb.append("-"); + if (!getProgDocumentoAgg().isEmpty()) { + sb.append(getProgDocumentoAgg()); + sb.append("-"); + } + sb.append(getId_esercizio()); + sb.append("-"); + sb.append(getParm("STAMPA_NOME_DOCUMENTO").getTesto()); + return sb.toString(); + } + + public Comune getComuneSped() { + this.comuneSped = (Comune)getSecondaryObject(this.comuneSped, Comune.class, getId_comuneSped()); + return this.comuneSped; + } + + public long getId_comuneSped() { + return this.id_comuneSped; + } + + public String getIndirizzoSped() { + return (this.indirizzoSped == null) ? "" : this.indirizzoSped.trim(); + } + + public String getPresso() { + return (this.presso == null) ? "" : this.presso.trim(); + } + + public void setId_comuneSped(long newId_comuneSped) { + this.id_comuneSped = newId_comuneSped; + setComuneSped(null); + } + + public void setIndirizzoSped(String indirizzoSped) { + this.indirizzoSped = indirizzoSped; + } + + public void setPresso(String presso) { + this.presso = presso; + } + + public void setComuneSped(Comune comuneSped) { + this.comuneSped = comuneSped; + } + + public String getDescrizioneDocumentiPadre() { + Vectumerator vec = findDocumentiPadre(); + StringBuffer temp = new StringBuffer(); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + temp.append(row.getNumeroDocumentoCompleto()); + if (vec.hasMoreElements()) + temp.append(", "); + } + return temp.toString(); + } + + public String getDescrizioneDocumentiPadreId() { + Vectumerator vec = findDocumentiPadre(); + StringBuffer temp = new StringBuffer(); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + temp.append(row.getId_documento()); + if (vec.hasMoreElements()) + temp.append(", "); + } + return temp.toString(); + } + + public boolean hasLabelDaStampare() { + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getArticolo().getFlgStampaEtichetteT() == 1L) + return true; + } + return false; + } + + private String getCashStringSiemensNonFiscale() { + StringBuffer temp = new StringBuffer(); + String sep = "|"; + temp.append("KXCL"); + temp.append(sep); + temp.append("KXSE" + getNumeroDocumentoCompleto()); + temp.append(sep); + temp.append("KXSESig. " + getNominativoDocumento()); + temp.append(sep); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + temp.append(row.getCashStringNonFiscale()); + } + if (getAcconto() > 0.0D) { + temp.append("KXSEAcconto: " + getNf().format(getAcconto())); + temp.append(sep); + } + temp.append("KXSEArrivederci e Grazie"); + temp.append(sep); + temp.append("KXCE"); + return temp.toString(); + } + + public String getStato() { + return getStato(getFlgStato()); + } + + public Vectumerator findRigheDocumentoPrelevabili(int pageNumber, int pageRows) { + return new RigaDocumento(getApFull()).findRighePrelevabiliByDocumento(this, pageNumber, pageRows); + } + + public ResParm addRigaDocumentoDaPrelevareM(RigaDocumento rddp, double l_qtaDaPrelevare) { + ResParm rp = new ResParm(false); + rp = checkEMSTA(); + if (rp.getStatus()) { + DoubleOperator dop = new DoubleOperator(l_qtaDaPrelevare); + Vectumerator vec = findRigheDocumentoByArticoloArticoloVariante(rddp.getId_articolo(), + rddp.getId_articoloVariante()); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getId_articolo() == rddp.getId_articolo() && row.getId_articoloVariante() == rddp.getId_articoloVariante()) + if (row.getQuantita() != 0.0D) { + RigaDocumentoP rdp = new RigaDocumentoP(getApFull()); + rdp.setId_rigaDocumento(row.getId_rigaDocumento()); + rdp.setId_documento(row.getId_documento()); + rdp.setId_rigaDocumentoPrelevata(rddp.getId_rigaDocumento()); + if (row.getQuantita() <= dop.getResult()) { + rdp.setQuantitaPrelevata(row.getQuantita()); + } else { + rdp.setQuantitaPrelevata(dop.getResult()); + } + rp = row.addRigaDocumentoP(rdp); + if (rp.getStatus()) { + Movimento mov = new Movimento(getApFull()); + mov.setId_articolo(row.getId_articolo()); + mov.setId_articoloVariante(row.getId_articoloVariante()); + mov.setId_articoloTaglia(row.getId_articoloTaglia()); + mov.setId_clifor(getId_clifor()); + mov.setId_causaleMagazzino(getTipoDocumento().getId_causaleMagazzino()); + long l_id_magazzinoFisicoDocumentoDaPrelevare = rddp.getDocumento().getTipoDocumento().getCausaleMagazzino() + .getId_magFisicoArrivo(); + mov.setId_magFisico(l_id_magazzinoFisicoDocumentoDaPrelevare); + mov.setId_rigaDocumento(row.getId_rigaDocumento()); + if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 1L) { + mov.setNr(-1.0D * rdp.getQuantitaPrelevata()); + } else if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 2L) { + mov.setKg(-1.0D * rdp.getQuantitaPrelevata()); + } else if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 3L) { + mov.setMt(-1.0D * rdp.getQuantitaPrelevata()); + } + rp = mov.save(); + dop.subtract(rdp.getQuantitaPrelevata()); + } + if (dop.getResult() <= 0.0D) + break; + } + } + boolean checkPrelievo = true; + Documento ordine = rddp.getDocumento(); + Vectumerator vecRows = ordine.findRigheDocumento(0, 0, 0); + while (vecRows.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRows.nextElement(); + if (row.getFlgRigaPrelevata() == 0L) { + checkPrelievo = false; + break; + } + } + if (checkPrelievo) { + ordine.setFlgDocumentoPrelevato(1L); + ordine.superSave(); + } + } else { + rp.setMsg("ERRORE! Fattura emessa o stampata! Impossibile salvare."); + } + return rp; + } + + public ResParm addRigaDocumentoDaPrelevare(RigaDocumento rddp, double l_qtaDaPrelevare) { + ResParm rp = new ResParm(false); + rp = checkEMSTA(); + if (rp.getStatus()) { + DoubleOperator dop = new DoubleOperator(l_qtaDaPrelevare); + Vectumerator vec = findRigheDocumentoByArticoloArticoloVariante(rddp.getId_articolo(), + rddp.getId_articoloVariante()); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getId_articolo() == rddp.getId_articolo() && row.getId_articoloVariante() == rddp.getId_articoloVariante()) + if (row.getQuantita() != 0.0D) { + try { + double qtaPrelevata; + RigaDocumento rd = (RigaDocumento)row.clone(); + rd.setId_rigaDocumento(0L); + rd.setDBState(0); + rd.setId_rigaDocumentoMov(row.getId_rigaDocumento()); + rd.setId_rigaDocumentoPrelevata(rddp.getId_rigaDocumento()); + rd.setId_magFisico(rddp.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo()); + rd.setSegnoMov(-1L); + if (row.getQuantita() <= dop.getResult()) { + qtaPrelevata = row.getQuantita(); + } else { + qtaPrelevata = dop.getResult(); + } + if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 1L) { + rd.setNr(qtaPrelevata); + } else if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 2L) { + rd.setKg(qtaPrelevata); + } else if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 3L) { + rd.setMt(qtaPrelevata); + } + rp = rd.saveMov(); + } catch (Exception e) { + e.printStackTrace(); + } + if (dop.getResult() <= 0.0D) + break; + } + } + boolean checkPrelievo = true; + Documento ordine = rddp.getDocumento(); + Vectumerator vecRows = ordine.findRigheDocumento(0, 0, 0); + while (vecRows.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRows.nextElement(); + if (row.getFlgRigaPrelevata() == 0L) { + checkPrelievo = false; + break; + } + } + if (checkPrelievo) { + ordine.setFlgDocumentoPrelevato(1L); + ordine.superSave(); + } + } else { + rp.setMsg("ERRORE! Fattura emessa o stampata! Impossibile salvare."); + } + return rp; + } + + public ResParm delRigaDocumentoDaPrelevare(long id_rigaDocumento, long id_rigaDocumentoPrelevata) { + ResParm rp = new ResParm(false); + return rp; + } + + public Vectumerator findRigheDocumentoPrelevateAssociate(int pageNumber, int pageRows) { + return new RigaDocumentoP(getApFull()).findByDocumento(getId_documento(), pageNumber, pageRows); + } + + public String getNumeroCivicoSped() { + return (this.numeroCivicoSped == null) ? "" : this.numeroCivicoSped.trim(); + } + + public void setNumeroCivicoSped(String numeroCivicoSped) { + this.numeroCivicoSped = numeroCivicoSped; + } + + public String getDocumentoPrelevato() { + return (this.flgDocumentoPrelevato == 0L) ? "Aperto" : "Chiuso"; + } + + public void setFlgDocumentoPrelevato(long flgDocumentoPrelevato) { + this.flgDocumentoPrelevato = flgDocumentoPrelevato; + } + + public void aggiornaFlgDocumentoPrelevato(long l_flgDocumentoPrelevato) { + if (l_flgDocumentoPrelevato != getFlgDocumentoPrelevato()) { + setFlgDocumentoPrelevato(l_flgDocumentoPrelevato); + save(); + } + } + + public void verificaEAggiornaFlgDocumentoPrelevato() { + if (new RigaDocumento(getApFull()).isAllRighePrelevateByDocumento(getId_documento())) { + aggiornaFlgDocumentoPrelevato(1L); + } else { + aggiornaFlgDocumentoPrelevato(0L); + } + } + + protected long getId_docRiparazione() { + return getParm("ID_DOC_RIPARAZIONE").getNumeroLong(); + } + + public boolean isPrelevataNoObbligo() { + if (getTipoDocumento().getFlgTipoDocumentoPrelevabile() == 0L || getId_tipoDocumento() == getId_docCassa()) + return true; + return !(getFlgDocumentoPrelevato() == 0L); + } + + public long getTipoCaricoScarico() { + if (getTipoDocumento().getFlgNoAnag() == 1L) + return -1L; + if (getId_magFisicoPartenza() != 0L) + return 1L; + if (getTipoDocumento().getCausaleMagazzino().getId_magFisicoPartenza() != 0L) + return 1L; + return 0L; + } + + public ByteArrayOutputStream creaReportPdf(int flgTipo, DocumentoCR CR) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + String titoloReport = ""; + try { + long numGiorni; + switch (flgTipo) { + case 7: + case 9: + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 20.0F); + break; + case 0: + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 20.0F); + break; + case 8: + case 10: + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 20.0F); + break; + case 3: + this.document = new Document(PageSize.A4.rotate(), 20.0F, 20.0F, 20.0F, 20.0F); + break; + case 1: + this.document = new Document(PageSize.A4.rotate(), 20.0F, 20.0F, 20.0F, 20.0F); + break; + case 2: + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 20.0F); + case 4: + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 20.0F); + break; + case 6: + this.document = new Document(PageSize.A4.rotate(), 20.0F, 20.0F, 20.0F, 20.0F); + break; + default: + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 20.0F); + break; + } + switch (flgTipo) { + case 7: + titoloReport = "Report Vendite Giornaliere"; + break; + case 9: + titoloReport = "Report Vendite Giornaliere x Nazione"; + break; + case 0: + titoloReport = "Report Vendite Giornaliere"; + break; + case 8: + titoloReport = "Report Documenti"; + break; + case 10: + titoloReport = "Report Documenti con DDT"; + break; + case 3: + titoloReport = "Report Vendite Giornaliere"; + break; + case 1: + titoloReport = "Report Vendite Completo"; + break; + case 2: + titoloReport = "Report Vendite Compatto"; + break; + case 4: + titoloReport = "Report Ordini Inevasi"; + break; + case 6: + titoloReport = "Vendite servizi"; + break; + default: + titoloReport = "Report ???"; + break; + } + SimpleDateFormat tf = new SimpleDateFormat("HH:mm:ss"); + Date today = getToday(); + titoloReport = titoloReport + ". Stampato il " + titoloReport + " " + getDataFormat().format(today); + this.writer = PdfWriter.getInstance(this.document, ba); + if (flgTipo != 99) { + Phrase pH = new Phrase(new Chunk(titoloReport + " - Pag. n. ", PDF_A_Piccolo)); + HeaderFooter header = new HeaderFooter(pH, true); + header.setAlignment(2); + header.setBorder(0); + this.document.setFooter(header); + } + this.document.open(); + prepareNewPdfCorpoDocument(); + switch (flgTipo) { + case 7: + creaReportUnoGiornaliero(CR, false); + break; + case 9: + creaReportUnoGiornalieroXNazione(CR, false); + break; + case 0: + if (CR.getDataDocumentoDa() == null) + CR.setDataDocumentoDa(getToday()); + CR.setDataDocumentoA(CR.getDataDocumentoDa()); + creaReportUnaVendite(CR, false); + break; + case 8: + if (CR.getDataDocumentoDa() == null) + CR.setDataDocumentoDa(getToday()); + creaReportDettagliDocumenti(CR, false); + break; + case 10: + if (CR.getDataDocumentoDa() == null) + CR.setDataDocumentoDa(getToday()); + creaReportDettagliDocumenti(CR, true); + break; + case 3: + if (CR.getDataDocumentoDa() == null) + CR.setDataDocumentoDa(getToday()); + if (CR.getDataDocumentoA() == null) + CR.setDataDocumentoA(getToday()); + numGiorni = getDateDiff(CR.getDataDocumentoDa(), CR.getDataDocumentoA()); + if (numGiorni >= 0L) { + Calendar cal = Calendar.getInstance(); + cal.setTime(CR.getDataDocumentoDa()); + for (int i = 0; (long)i <= numGiorni; i++) { + CR.setDataDocumentoDa(new Date(cal.getTimeInMillis())); + CR.setDataDocumentoA(new Date(cal.getTimeInMillis())); + creaReportUnaVendite(CR, false); + if ((long)i < numGiorni) { + this.document.newPage(); + cal.add(6, 1); + } + } + } + break; + case 1: + if (CR.getDataDocumentoDa() == null) + CR.setDataDocumentoDa(getToday()); + if (CR.getDataDocumentoA() == null) + CR.setDataDocumentoA(getToday()); + creaReportUnaVendite(CR, false); + break; + case 2: + if (CR.getDataDocumentoDa() == null) + CR.setDataDocumentoDa(getToday()); + creaReportUnaVendite(CR, true); + break; + case 4: + CR.setId_tipoDocumento(getId_docOrdine()); + CR.setFlgDocumentoPrelevato(1L); + creaReportUnaOrdiniInevasi(CR, true); + break; + case 6: + creaReportUnaVenditeServizi(CR, true); + break; + } + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + private Document creaReportUnaVenditeServizi(DocumentoCR CR, boolean soloCompatto) { + int rowCellLeading = 6; + NumberFormat nf3 = NumberFormat.getInstance(); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf0 = NumberFormat.getInstance(); + nf0.setMaximumFractionDigits(0); + nf0.setMinimumFractionDigits(0); + int col_1 = 2, col_2 = 3, col_3 = 6, col_4 = 3, col_5 = 3, col_6 = 3, col_7 = 3, col_8 = 6, col_9 = 4, col_10 = 3, col_11 = 2; + int col_12 = 2; + int cellLeading = 12; + long id_articolo = 0L; + DoubleOperator totQta = new DoubleOperator(); + DoubleOperator totImporti = new DoubleOperator(); + DoubleOperator totQtaArt = new DoubleOperator(); + DoubleOperator totImportiArt = new DoubleOperator(); + SimpleDateFormat df = getDataFormat(); + try { + Cell rigaVuota = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimo)); + rigaVuota.setVerticalAlignment(4); + rigaVuota.setHorizontalAlignment(0); + rigaVuota.setLeading((float)cellLeading); + rigaVuota.setBorder(0); + rigaVuota.setColspan(40); + rigaVuota.setRowspan(1); + String intestazioneReport = "Data: dal " + df.format(CR.getDataDocumentoDa()) + " al " + df.format(CR.getDataDocumentoA()); + if (CR.getId_tipo() != 0L) + intestazioneReport = intestazioneReport + " - Tipo: " + intestazioneReport; + if (CR.getId_articolo() != 0L) + intestazioneReport = intestazioneReport + " - Articolo: " + intestazioneReport; + creaIntestazioneReport(CR.getTipoReport(), intestazioneReport); + Cell cell = new Cell(new Chunk("ID", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Tipo art.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Articolo", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Operatore", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Tipo doc.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Documento", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Data doc.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Cliente/Fornitore", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Nota riga", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_9); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Seriale", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_10); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Q.tà", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_11); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Importo", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_12); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.pdfcorpo.endHeaders(); + Vectumerator vec = new RigaDocumento(getApFull()).findVenditeServizi(CR); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (id_articolo > 0L && id_articolo != row.getId_articolo()) { + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_1); + cell.setRowspan(1); + cell.setBackgroundColor(Color.yellow); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Totale articolo", PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_2); + cell.setRowspan(1); + cell.setBackgroundColor(Color.yellow); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_3 + col_4 + col_5 + col_6 + col_7 + col_8 + col_9 + col_10); + cell.setRowspan(1); + cell.setBackgroundColor(Color.yellow); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totQtaArt.getResult()), PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_11); + cell.setRowspan(1); + cell.setBackgroundColor(Color.yellow); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totImportiArt.getResult()), PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_12); + cell.setBackgroundColor(Color.yellow); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + totQtaArt = new DoubleOperator(); + totImportiArt = new DoubleOperator(); + } + cell = new Cell(new Chunk(String.valueOf(row.getId_documento()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(row.getArticolo().getTipo().getDescrizione(), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(convertHtmlToString(row.getArticolo().getDescrizioneCompleta()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(row.getDocumento().getUsers().getCognomeNome(), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(row.getDocumento().getTipoDocumento().getDescrizione(), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(row.getDocumento().getNumeroDocumento(), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(df.format(row.getDocumento().getDataDocumento()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(row.getDocumento().getClifor().getDescrizioneCliente(), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(row.getNotaRigaDocumento(), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_9); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(row.getSeriale(), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_10); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(row.getQuantita()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_11); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(row.getImporto()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_12); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + totQtaArt.add(row.getQuantita()); + totImportiArt.add(row.getImporto()); + totQta.add(row.getQuantita()); + totImporti.add(row.getImporto()); + id_articolo = row.getId_articolo(); + } + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_1); + cell.setRowspan(1); + cell.setBackgroundColor(Color.yellow); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Totale articolo", PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_2); + cell.setRowspan(1); + cell.setBackgroundColor(Color.yellow); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_3 + col_4 + col_5 + col_6 + col_7 + col_8 + col_9 + col_10); + cell.setRowspan(1); + cell.setBackgroundColor(Color.yellow); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totQtaArt.getResult()), PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_11); + cell.setRowspan(1); + cell.setBackgroundColor(Color.yellow); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totImportiArt.getResult()), PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_12); + cell.setBackgroundColor(Color.yellow); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Totale", PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_3 + col_4 + col_5 + col_6 + col_7 + col_8 + col_9 + col_10); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totQta.getResult()), PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_11); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totImporti.getResult()), PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_12); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + } catch (Exception e) { + handleDebug(e); + } + return this.document; + } + + protected Document creaIntestazioneReport(String titolo, String sottoTitolo) { + int cellLeading = 12; + int corpoPadding = 2; + try { + Cell rigaVuota = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimo)); + rigaVuota.setVerticalAlignment(4); + rigaVuota.setHorizontalAlignment(0); + rigaVuota.setLeading((float)cellLeading); + rigaVuota.setBorder(0); + rigaVuota.setColspan(40); + rigaVuota.setRowspan(1); + float imgLogoWidth = getDocLogoWidth(); + File imgLogoFile = new File(getDocBase() + getDocBase()); + if (imgLogoFile.exists()) { + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + imgLogo.scaleToFit(imgLogoWidth, imgLogoWidth); + imgLogo.setAlignment(5); + this.pdfcorpo = new Table(40); + this.pdfcorpo.setWidth(100.0F); + this.pdfcorpo.setPadding((float)corpoPadding); + this.pdfcorpo.setSpacing(0.0F); + this.pdfcorpo.setWidths(colWidthsRighe40); + this.pdfcorpo.setBorder(0); + Cell cell1 = new Cell(); + cell1.add(new Chunk(imgLogo, 10.0F, 0.0F)); + cell1.setLeading(12.0F); + cell1.setBorder(0); + cell1.setColspan(16); + cell1.setRowspan(1); + this.pdfcorpo.addCell(cell1); + } + Cell cell = new Cell(new Chunk("Report: " + titolo, PdfFontFactory.PDF_fGrandeB)); + cell.add(new Chunk("\n\n" + sottoTitolo, PdfFontFactory.PDF_fMedio)); + cell.setLeading(12.0F); + cell.setBorder(0); + cell.setVerticalAlignment(4); + cell.setColspan(18); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fGrandeB)); + cell.setLeading(12.0F); + cell.setBorder(0); + cell.setVerticalAlignment(6); + cell.setColspan(6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.pdfcorpo.addCell(rigaVuota); + this.document.add((Element)this.pdfcorpo); + this.pdfcorpo = new Table(40); + this.pdfcorpo.setWidth(100.0F); + this.pdfcorpo.setPadding((float)corpoPadding); + this.pdfcorpo.setSpacing(0.0F); + this.pdfcorpo.setWidths(colWidthsRighe40); + this.pdfcorpo.setBorder(0); + } catch (Exception e) { + handleDebug(e); + } + return this.document; + } + + public String getLinkOrdineWww() { + try { + return getWwwAddressParm() + "ShowOrdine.abl?idcrypt=" + getWwwAddressParm(); + } catch (Exception e) { + return "link unavailable!!"; + } + } + + public String getLinkOrdineWwwNoReg(Users l_user) { + try { + return getWwwAddressParm() + "ShowOrdine.abl?idcrypt=" + getWwwAddressParm() + "&uc=" + URLEncoder.encode(getId_documentoCript(), "utf-8"); + } catch (Exception e) { + return "link unavailable!!"; + } + } + + public String getLinkOrdineWwwAuto() { + if (getClifor().getUserWww().getId_userProfile() == getClifor().getUserWww().getIdUserProfileNoReg()) + return getLinkOrdineWwwNoReg(getClifor().getUserWww()); + return getLinkOrdineWww(); + } + + public double getImportoTotaleRigheCorrispettivi() { + Vectumerator vec = findRigheDocumento(0, 0, 0); + DoubleOperator dop = new DoubleOperator(); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + dop.add(row.getTotImportoRigaConSconto()); + } + return dop.getResult(); + } + + public static final double scorporaIva(double importo, Iva iva) { + DoubleOperator dop = new DoubleOperator((float)iva.getAliquota()); + dop.setScale(4, 5); + dop.divide(100.0F); + dop.add(1); + DoubleOperator dop2 = new DoubleOperator(importo); + dop2.setScale(4, 5); + dop2.divide(dop); + dop2.setScale(2, 5); + return dop2.getResult(); + } + + public static final String getTipoReport(long l_flgTipoReport) { + if (l_flgTipoReport == 0L) + return "Vendite del Giorno"; + if (l_flgTipoReport == 3L) + return "Vendite Giornaliere"; + if (l_flgTipoReport == 1L) + return "Vendite Completo"; + if (l_flgTipoReport == 2L) + return "Vendite Compatto"; + if (l_flgTipoReport == 4L) + return "Ordini Invevasi"; + if (l_flgTipoReport == 5L) + return "Fatturato"; + if (l_flgTipoReport == 6L) + return "Vendite servizi"; + if (l_flgTipoReport == 7L) + return "Giornaliero"; + if (l_flgTipoReport == 9L) + return "Giornaliero x Nazione"; + if (l_flgTipoReport == 8L) + return "Dettaglio Documenti"; + if (l_flgTipoReport == 10L) + return "Dettaglio Documenti con DDT"; + return ""; + } + + public static final String getTipoDotocumentoUsato(long l_flg) { + if (l_flg == 0L) + return "0- No Usato"; + if (l_flg == 3L) + return "3- Usato Iva"; + if (l_flg == 1L) + return "1- Usato RM"; + if (l_flg == 4L) + return "4- Usato iva e Std"; + if (l_flg == 2L) + return "2- Usato RM e std"; + if (l_flg == 5L) + return "5- Usato RM e Usato IVA"; + if (l_flg == 6L) + return "6- Usato RM, Usato IVA e std"; + return "??"; + } + + public double getImportoTotale() { + return this.importoTotale; + } + + public void setImportoTotale(double importoTotale) { + this.importoTotale = importoTotale; + } + + public boolean isDataOkOld() { + if (getDBState() == 1 && getFlgStato() == 1L) { + Documento bean = new Documento(getApFull()); + bean.findByProgressivoEsercizioContatore(getProgDocumento() - 1L, getId_esercizio(), getId_contatore()); + if (bean != null && bean.getDBState() == 1) { + if (getDateDiff(bean.getDataDocumento(), getDataDocumento()) >= 0L) + return true; + return false; + } + return true; + } + return true; + } + + public void findByProgressivoEsercizioContatore(long l_progDocumento, long l_id_esercizio, long l_id_contatore) { + String s_Sql_Find = "select A.* from DOCUMENTO AS A"; + String s_Sql_Order = " order by A.dataDocumento desc, A.id_esercizio desc, A.progDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.flgStato=1"); + wc.addWc("A.progDocumento=" + l_progDocumento); + wc.addWc("A.id_esercizio=" + l_id_esercizio); + wc.addWc("A.id_contatore=" + l_id_contatore); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public static ResParm aggiornaCostoUltimoFornitore(ApplParmFull ap, long l_id_articolo) { + ResParm rp = new ResParm(true); + int i = 0; + int se1 = 10; + int se2 = 100; + String currentDoc = ""; + long l_id_documento = 0L; + System.out.println("Ricerca righe documento......."); + Vectumerator vec = new RigaDocumento(ap).findAllPerRiordinoMagazzino(l_id_articolo, 0, 0); + System.out.println("Num righe documento trovate: " + vec.getTotNumberOfRecords()); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (l_id_documento != row.getId_documento()) { + currentDoc = row.getDocumento().getNumeroDocumentoCompleto(); + l_id_documento = row.getId_documento(); + System.out.println("\n" + currentDoc); + } + if (row.getId_documento() == 0L) { + row.delete(); + } else { + rp = row.savexAggiornaCostoUltimoFornitore(); + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + if (!rp.getStatus()) { + rp.setMsg("ERRORE DOCUMENTO " + row.getDocumento().getNumeroDocumentoCompleto() + "\n" + rp.getMsg()); + return rp; + } + } + rp.setMsg("Ripristino magazzino ok"); + return rp; + } + + public long getFlgMantieniArticoloRiga() { + return this.flgMantieniArticoloRiga; + } + + public void setFlgMantieniArticoloRiga(long flgUltimoArticoloRiga) { + this.flgMantieniArticoloRiga = flgUltimoArticoloRiga; + } + + public double getAcconto() { + return this.acconto; + } + + public void setAcconto(double acconto) { + this.acconto = acconto; + } + + public static String getStatoPrenotazione(long l_flgStatoPrenotazione) { + switch ((int)l_flgStatoPrenotazione) { + case 10: + return "Ordinati"; + case 0: + return "Accettati"; + case 20: + return "Arrivati"; + case 30: + return "Spediti"; + case 90: + return "Chiusi"; + case 100: + return "Annullati"; + case 200: + return "Aperte"; + } + return "????"; + } + + public static String getStatoPrenotazioneArt(long l_flgStatoPrenotazioneArt) { + switch ((int)l_flgStatoPrenotazioneArt) { + case 0: + return "Da ordinare"; + case 20: + return "Arrivato parziale"; + case 30: + return "Arrivato totale"; + case 15: + return "Ordinato parziale"; + case 10: + return "Ordinato totale"; + } + return "????"; + } + + public long getFlgStatoPrenotazione() { + return this.flgStatoPrenotazione; + } + + public void setFlgStatoPrenotazione(long flgStatoPrenotazione) { + this.flgStatoPrenotazione = flgStatoPrenotazione; + } + + public boolean isDocumentoFiglioCreabile() { + if (getTipoDocumento().getTipologiaDocumento().getFlgGestioneSeparata() == 0L) { + if (getTipoDocumento().getTipologiaDocumento().getCodice() == 200L) { + if (getPrezzo1000Colpi() != 0.0D) { + long pezzeFatturate = getPezzeTotaliFatturate(); + long pezzeInviate = getPezzeTotaliInviate(); + if (pezzeInviate > pezzeFatturate) + return true; + return false; + } + return false; + } + if (getTipoDocumento().findDocGen(0L, 0L, 1, 1).hasMoreElements()) { + RigaDocumento rd = new RigaDocumento(getApFull()); + return !rd.isAllRighePrelevateByDocumento(getId_documento()); + } + return false; + } + return false; + } + + public boolean isDocumentoWwwNonPagato() { + if (getFlgStatoOrdineWww() == 99L || getFlgPagata() == 1L) + return false; + return true; + } + + public boolean isOrdineWww() { + if (getId_tipoDocumento() == getParm("ID_DOC_ORDINE_WWW").getNumeroLong()) + return true; + return false; + } + + public boolean hasRigheDocumento() { + Vectumerator vec = findRigheDocumento(1, 1, 0); + if (vec.hasMoreElements()) + return true; + return false; + } + + protected void creaDocumentoCorpoDDT(Document l_document, Table l_pdfCorpo) { + int righePerPagina = (int)getTipoDocumento().getRighePerPagina(); + if (righePerPagina <= 0) + righePerPagina = 10; + int maxCarDesc = (int)getTipoDocumento().getMaxCarDesc(); + if (maxCarDesc == 0) + maxCarDesc = 35; + int riga = 0; + int cellLeadingRow = getDocLeadRow(); + if (cellLeadingRow == 0) + cellLeadingRow = 12; + Font PDF_frow = getTipoDocumento().getPdfFontRow(); + NumberFormat nf = getNf(); + int ordinamentoRighe = (int)getTipoDocumento().getFlgOrdinamentoRigheStampa(); + Vectumerator vec = findRigheDocumento(0, 0, ordinamentoRighe); + try { + String str1; + String currentDescRigaRagg = ""; + if (!getPudoId().isEmpty()) { + str1 = "Fermo Point BRT\n" + getPudoDesc() + "\n" + getNote(); + } else { + str1 = getNote(); + } + if (!getPudoId().isEmpty()) { + str1 = "Fermo Point BRT\n" + getPudoDesc() + "\n" + getNote(); + } else { + str1 = getNote(); + } + ArrayList alNote = RigaDocumentoItemPdf.getArrayListNota(str1, 0, cols_DDT_, PDF_frow); + if (getDocPosizioneNota() == 0L) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getId_rigaDocumento() == 18463L) + System.out.println("creaDocumentoCorpoDDT: " + row.getId_rigaDocumento()); + double quantita = row.getQuantita(); + if (ordinamentoRighe == 3 && + !row.getDescrizioneRigaRaggruppamento().isEmpty()) { + if (!currentDescRigaRagg.equals(row.getDescrizioneRigaRaggruppamento())) { + currentDescRigaRagg = row.getDescrizioneRigaRaggruppamento(); + ArrayList arrayList1 = new ArrayList<>(); + arrayList1.add(new RigaDocumentoItemPdf(30, currentDescRigaRagg, PDF_frow)); + arrayList1.add(new RigaDocumentoItemPdf(10, " ", PDF_frow, 2)); + riga = inserisciRigaDocumento(arrayList1, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + } + String str = row.getDescrizioneRigaDettaglio(); + if (!row.getNotaRigaDocumento().isEmpty()) + str = str + " " + str; + ArrayList arrayList = new ArrayList<>(); + arrayList.add(new RigaDocumentoItemPdf(30, str, PDF_frow)); + arrayList.add(new RigaDocumentoItemPdf(10, nf.format(quantita), PDF_frow, 2)); + riga = inserisciRigaDocumento(arrayList, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + continue; + } + String desc = row.getDescrizioneRigaCompleta(); + if (!row.getNotaRigaDocumento().isEmpty()) + desc = desc + " " + desc; + ArrayList dati = new ArrayList<>(); + dati.add(new RigaDocumentoItemPdf(cols_DDT_[0], desc, PDF_frow)); + dati.add(new RigaDocumentoItemPdf(cols_DDT_[1], nf.format(quantita), PDF_frow, 2)); + riga = inserisciRigaDocumento(dati, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + } + if (getDocPosizioneNota() == 1L && !str1.isEmpty()) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + if (righePerPagina - riga > 0) + riga = inserisciRigheVuote(righePerPagina - riga, cols_DDT_, riga, l_document, l_pdfCorpo, cellLeadingRow); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoIntestazioneCorpoDDT(Table l_pdfCorpo) { + int cellLeading = 8; + try { + Cell cell = new Cell(); + cell.addElement(new Chunk("DESCRIZIONE", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_DDT_[0]); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("QUAN.", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_DDT_[1]); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoIntestazioneCorpoFtSemplice(Table l_pdfCorpo) { + int cellLeading = 8; + try { + Cell cell = new Cell(); + cell.addElement(new Chunk("DESCRIZIONE", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[0] + cols_FT_STD_[1] + cols_FT_STD_[2] + cols_FT_STD_[3]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPORTO", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[4]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IVA", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[5]); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoFooterDDTFirme(Table l_pdfCorpo, boolean isUltimaPagina) { + try { + int cellLeading = 8; + NumberFormat nf = getNf(); + Cell cell = new Cell(); + if (isUltimaPagina) { + cell.add(new Chunk("Pregasi controllare bene l'esatta intestazione del documento e della partita iva. In caso di errata intestazione non ci terremo responsabili in solido come previsto dall'art. 41 DPR 28/10/72 rif 833", PdfFontFactory.PDF_fPiccolissimo)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(20); + cell.setRowspan(1); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("DATA E ORA TRASP.\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setRowspan(1); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("FIRMA CONDUCENTE\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + cell.setRowspan(1); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("FIRMA DESTINATARIO\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + cell.setRowspan(1); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e, 2); + } + } + + protected void creaDocumentoFooterFattureSemplici(Table l_pdfCorpo, boolean isUltimaPagina) { + int cellLeading = 8; + NumberFormat nf = getNf(); + RigheRegistroIva rri = getRigaRegistroIvaCompleto(); + String codIva = "", imponibile = "", aliquota = "", imposta = ""; + if (rri != null) { + Enumeration enuRrri = rri.elementsFatt(); + while (enuRrri.hasMoreElements()) { + RigaRegistroIvaItem rrii = enuRrri.nextElement(); + if (rrii.getImponibile() != 0.0D) { + if (getFlgArt8() == 1L) { + imponibile = imponibile + "\n" + imponibile; + imposta = imposta + "\n0"; + codIva = codIva + "\n" + codIva; + aliquota = aliquota + "\n" + aliquota; + continue; + } + imponibile = imponibile + "\n" + imponibile; + imposta = imposta + "\n" + imposta; + codIva = codIva + "\n" + codIva; + aliquota = aliquota + "\n" + aliquota; + } + } + } + try { + Cell cell = new Cell(new Chunk("ALIQ.", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(codIva, PdfFontFactory.PDF_fPiccolissimoB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setRowspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPONIBILE", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(imponibile, PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setRowspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPOSTA\t", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(imposta, PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + cell.setRowspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(16); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE NETTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getImponibileTotale() != 0.0D) { + cell.add(new Chunk(nf.format(getImponibileTotale()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SCADENZE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && !getNotePagamento().isEmpty()) { + cell.add(new Chunk(getNotePagamento(), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(23); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOT. IMPONIBILE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(nf.format(getImponibileTotale()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOT. IMPOSTA\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(nf.format(getImportoIvaTotale()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(16); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE DOCUMENTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getTotaleDocumento() != 0.0D) { + cell.add(new Chunk(nf.format(getTotaleDocumento()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e, 2); + } + } + + protected void creaDocumentoFooterDDT(Table l_pdfCorpo, boolean isUltimaPagina) { + try { + int cellLeading = 8; + NumberFormat nf = getNf(); + Cell cell = new Cell(new Chunk("TRASPORTO A CURA\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && !getTrasporto().isEmpty()) { + cell.add(new Chunk(getTrasporto(), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(14); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("CAUSALE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getId_causaleTrasporto() != 0L) { + cell.add(new Chunk(getCausaleTrasporto().getDescrizione(), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(14); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("PESO LORDO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getKgLordo() != 0.0D) { + cell.add(new Chunk(nf.format(getKgLordo()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("PESO NETTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getKgNetto() != 0.0D) { + cell.add(new Chunk(nf.format(getKgNetto()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("PORTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getId_porto() != 0L) { + cell.add(new Chunk(getPorto().getDescrizione(), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(14); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("ASPETTO ESTERIORE BENI\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getId_aspetto() != 0L) { + cell.add(new Chunk(getAspetto().getDescrizione(), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(8); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("VOLUME\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getVolume() != 0.0D) { + cell.add(new Chunk(nf.format(getVolume()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("COLLI\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getNColli() != 0L) { + cell.add(new Chunk(nf.format(getNColli()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("Q.tà Articoli\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getQuantitaTotaleDocumento() != 0.0D) { + cell.add(new Chunk(nf.format(getQuantitaTotaleDocumento()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("VETTORE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getId_vettore() != 0L) { + StringBuilder vett = new StringBuilder(); + vett.append(getVettore().getDescrizione()); + if (!getVettore().getIndirizzo().isEmpty()) { + vett.append(" "); + vett.append(getVettore().getIndirizzo()); + } + if (!getVettore().getCodFiscale().isEmpty()) { + vett.append(" C.F. "); + vett.append(getVettore().getCodFiscale()); + } + if (!getVettore().getPIva().isEmpty()) { + vett.append(" P.I. "); + vett.append(getVettore().getPIva()); + } + vett.append("\n"); + if (!getVettore().getIscrizioneAlbo().isEmpty()) { + vett.append("Iscr. Albo "); + vett.append(getVettore().getIscrizioneAlbo()); + } + if (!getNotaSpedizione().isEmpty()) + vett.append(getNotaSpedizione()); + cell.add(new Chunk(vett.toString(), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(28); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("DATA RITIRO\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.add(new Chunk("xx", PdfFontFactory.PDF_fPiccoloBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("FIRMA VETTORE\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.add(new Chunk("xx", PdfFontFactory.PDF_fPiccoloBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e, 2); + } + } + + public long getNumPagDocumento() { + return this.numPagDocumento; + } + + public void setNumPagDocumento(long numPagDocumento) { + this.numPagDocumento = numPagDocumento; + } + + public String getDescrizioneRigheHtmlOld() { + StringBuffer temp = new StringBuffer(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + temp.append(""); + temp.append(getNf().format(row.getQuantita())); + temp.append(" "); + temp.append(row.getDescrizioneRigaCompleta()); + temp.append(""); + if (row.getId_articolo() != 0L) { + temp.append(" nr."); + temp.append(getNf().format(row.getArticolo().getQuantitaEffettiva())); + temp.append(" ("); + temp.append(getNf().format(row.getArticolo().getQuantita())); + temp.append(")"); + } + if (vec.hasMoreElements()) + temp.append("
"); + } + return temp.toString(); + } + + public void setAbbuono(double abbuono) { + this.abbuono = abbuono; + } + + public double getKgNetto() { + return this.kgNetto; + } + + public void setKgNetto(double kgNetto) { + this.kgNetto = kgNetto; + } + + public double getVolume() { + return this.volume; + } + + public double getVolumeM3() { + return (getId_documento() == 0L) ? 0.0D : new RigaDocumento(getApFull()).getVolumeM3ByDocumento(getId_documento()); + } + + public long getVolumeCm3() { + return (getId_documento() == 0L) ? 0L : new RigaDocumento(getApFull()).getVolumeCm3ByDocumento(getId_documento()); + } + + public void setVolume(double volume) { + this.volume = volume; + } + + public CausaleTrasporto getCausaleTrasporto() { + this.causaleTrasporto = (CausaleTrasporto)getSecondaryObject(this.causaleTrasporto, CausaleTrasporto.class, getId_causaleTrasporto()); + return this.causaleTrasporto; + } + + public void setCausaleTrasporto(CausaleTrasporto causaleTrasporto) { + this.causaleTrasporto = causaleTrasporto; + } + + public long getId_causaleTrasporto() { + return this.id_causaleTrasporto; + } + + public void setId_causaleTrasporto(long id_causaleTrasporto) { + this.id_causaleTrasporto = id_causaleTrasporto; + setCausaleTrasporto(null); + } + + public double getSpeseIncasso() { + return this.speseIncasso; + } + + public void setSpeseIncasso(double speseIncasso) { + this.speseIncasso = speseIncasso; + } + + public double getTotaleDaPagare() { + DoubleOperator temp = new DoubleOperator(getTotaleDocumento()); + temp.subtract(getAcconto()); + temp.setScale(2, 5); + return temp.getResult(); + } + + public String getBancaDesc() { + return (this.bancaDesc == null) ? "" : this.bancaDesc.trim(); + } + + public String getEMailDocumento() { + return (this.eMailDocumento == null) ? "" : this.eMailDocumento.trim(); + } + + public void setBancaDesc(String banca) { + this.bancaDesc = banca; + } + + public void setEMailDocumento(String cellulare) { + this.eMailDocumento = cellulare; + } + + public Vectumerator findRigheDocumento(long l_flgCodiceRiga, int pageNumber, int pageRows, int ordinamentoRiga) { + return new RigaDocumento(getApFull()).findByDocumento(getId_documento(), l_flgCodiceRiga, "", pageNumber, pageRows, ordinamentoRiga); + } + + public Vectumerator findRigheDocumentoOBRiferimento(int pageNumber, int pageRows) { + return new RigaDocumento(getApFull()).findByDocumento(getId_documento(), 0L, "", pageNumber, pageRows, 10); + } + + public Vectumerator findRigheDocumento(int pageNumber, int pageRows, int ordinamentoRiga) { + return findRigheDocumento(0L, pageNumber, pageRows, ordinamentoRiga); + } + + public Vectumerator findRigheDocumento2(int pageNumber, int pageRows, int ordinamentoRiga) { + return findRigheDocumento(1L, pageNumber, pageRows, ordinamentoRiga); + } + + public Vectumerator findRigheDocumentoByArticoloArticoloVariante(long l_id_articolo, long l_id_articoloVariante) { + return new RigaDocumento(getApFull()).findByDocumentoArticoloArticoloVariante(getId_documento(), l_id_articolo, l_id_articoloVariante); + } + + public void setId_contatore(long id_contatore) { + this.id_contatore = id_contatore; + } + + public String getStatoPrenotazione() { + return getStatoPrenotazione(getFlgStatoPrenotazione()); + } + + public String getStatoCompleto() { + StringBuffer res = new StringBuffer(); + if (getTipoDocumento().getFlgTipologia() == 210L || + getTipoDocumento().getFlgTipologia() == 220L || + getTipoDocumento().getFlgTipologia() == 200L) { + res.append(getStatoLavorazione()); + res.append(" - "); + } + if (getTipoDocumento().getFlgTipologia() == 4L) { + res.append(getStatoPrenotazione()); + res.append(" - "); + } + if (getTipoDocumento().getFlgTipoDocumentoPrelevabile() == 1L && getTipoDocumento().getFlgObbligoPrelievo() == 1L) { + if (getFlgDocumentoPrelevato() == 1L) { + res.append("Chiuso"); + } else { + res.append("Aperto"); + } + res.append(" - "); + } + if (getId_tipoDocumento() == 1L) { + if (getEchoScontrino().isEmpty() && getFlgEmettiFatturaScontrino() == 0L) { + res.append("Scontrino non emesso"); + res.append(" - "); + } + } else if (getTipoDocumento().getFlgTipologia() == 1L || + getTipoDocumento().getFlgTipologia() == 2L) { + if (getFlgPagata() == 1L) { + res.append("Pagata"); + if (getDataPagamento() != null) + res.append(" " + getDataFormat().format(getDataPagamento())); + } else { + res.append("NON Pagata"); + } + } else if (getTipoDocumento().getFlgTipologia() == 0L) { + res.append(getStato()); + } + if (getId_tipoDocumento() == getId_docOrdine()) { + res.append(getDocumentoPrelevato()); + res.append(" - "); + } + if (isOrdineWww()) { + res.append(getStatoOrdineWww()); + res.append(" - "); + if (getFlgPagata() == 1L) { + res.append("Pagata"); + if (getDataPagamento() != null) + res.append(" " + getDataFormat().format(getDataPagamento())); + } else { + res.append("NON Pagata"); + } + } else if (getTipoDocumento().getFlgTipologia() == 3L) { + res.append(getStatoOrdineWww()); + res.append(" - "); + if (getFlgPagata() == 1L) { + res.append("Pagata"); + if (getDataPagamento() != null) + res.append(" " + getDataFormat().format(getDataPagamento())); + } else { + res.append("NON Pagata"); + } + } + return res.toString(); + } + + public String getIban() { + return (this.iban == null) ? "" : this.iban.trim(); + } + + public void setIban(String iban) { + this.iban = iban; + } + + public String getAbiCF() { + if (getIbanCF().length() < 11) + return "??"; + return getIbanCF().substring(5, 10); + } + + public String getCab() { + if (getIban().length() < 16) + return "??"; + return getIban().substring(10, 15); + } + + public String getConto() { + if (getIban().length() < 27) + return "??"; + return getIban().substring(15); + } + + public void findPrimoScontrinoAperto(long l_id_user) { + String s_Sql_Find = "select A.* from DOCUMENTO AS A"; + String s_Sql_Order = " order by A.dataDocumento desc, A.id_esercizio desc, A.progDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_tipoDocumento=1"); + if (l_id_user != 0L) + wc.addWc("A.lastUpdId_user=" + l_id_user); + wc.addWc("(A.echoScontrino is null or A.echoScontrino ='')"); + wc.addWc("(A.flgEmettiFatturaScontrino is null or A.flgEmettiFatturaScontrino =0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getNotePagamento() { + return (this.notePagamento == null) ? "" : this.notePagamento.trim(); + } + + public void setNotePagamento(String notePagamento) { + this.notePagamento = notePagamento; + } + + public long getId_destinazioneDiversa() { + return this.id_destinazioneDiversa; + } + + public void setId_destinazioneDiversa(long id_destinazioneDiversa) { + this.id_destinazioneDiversa = id_destinazioneDiversa; + setDestinazioneDiversa(null); + } + + public DestinazioneDiversa getDestinazioneDiversa() { + this.destinazioneDiversa = (DestinazioneDiversa)getSecondaryObject(this.destinazioneDiversa, DestinazioneDiversa.class, + getId_destinazioneDiversa()); + return this.destinazioneDiversa; + } + + public void setDestinazioneDiversa(DestinazioneDiversa destinazioneDiversa) { + this.destinazioneDiversa = destinazioneDiversa; + } + + public ResParm impostaFlgPagata(long l_flgPagata) { + if (getDBState() == 1) { + setFlgPagata(l_flgPagata); + return super.save(); + } + return new ResParm(false, "Errore. Documento non valido."); + } + + public String getDescDocumenti() { + return (this.descDocumenti == null) ? "" : this.descDocumenti.trim(); + } + + public void setDescDocumenti(String descDocumenti) { + this.descDocumenti = descDocumenti; + } + + public String getProgDocumentoAgg() { + return (this.progDocumentoAgg == null) ? "" : this.progDocumentoAgg; + } + + public void setProgDocumentoAgg(String progDocumentoAgg) { + this.progDocumentoAgg = progDocumentoAgg; + } + + protected boolean useNullForString() { + return false; + } + + public ByteArrayOutputStream creaLabelDocumentoArticoliAccA4Pdf(DocumentoCR CR) { + long pHMarg = getParm("LABEL_ART_A4_MARGINE").getNumeroLong(); + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + this.document = new Document(PageSize.A4, 0.0F, 0.0F, 10.0F, -20.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + String titoloReport = getNumeroDocumentoCompleto(); + SimpleDateFormat tf = new SimpleDateFormat("HH:mm:ss"); + Date today = getToday(); + titoloReport = titoloReport + ". Stampato il " + titoloReport + " " + getDataFormat().format(today); + this.document.open(); + long labelNumber = 0L; + String dim = getParm("LABEL_ART_A4_COL_ROW").getTesto(); + int nCol = Integer.parseInt(dim.substring(0, dim.indexOf(','))); + int nRow = Integer.parseInt(dim.substring(dim.indexOf(',') + 1)); + this.pdfPcorpo = new PdfPTable(nCol); + this.pdfPcorpo.setWidthPercentage(100.0F); + Documento doc = new Documento(getApFull()); + doc.findByPrimaryKey(CR.getId_documentoS()); + if (doc.hasLabelAccessoriDaStampare()) { + if (CR.getBlankLabels() > 0L) { + PdfPCell pdfPCell = new PdfPCell(); + pdfPCell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + pdfPCell.setBorder(0); + for (int i = 0; (long)i < CR.getBlankLabels(); i++) { + labelNumber++; + this.pdfPcorpo.addCell(pdfPCell); + } + } + Vectumerator vec = findByCR(CR, 0, 0); + long numbOfLabels = 1L; + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vecRighe = row.findRigheDocumento(0, 0, ordineInverso); + while (vecRighe.hasMoreElements()) { + RigaDocumento rowRD = (RigaDocumento)vecRighe.nextElement(); + if (rowRD.getFlgUdm() == 1L) { + numbOfLabels = (long)rowRD.getQuantita(); + } else { + numbOfLabels = 1L; + } + rowRD.getArticolo().setWriter(getWriter()); + rowRD.getArticolo().setPdfPcorpo(getPdfPcorpo()); + String descLabel = rowRD.getDescrizioneRigaCompleta(); + numbOfLabels = (long)rowRD.getArticolo().addLabelUnArticoloAccA4Pdf(nRow, numbOfLabels, labelNumber, descLabel); + labelNumber += numbOfLabels; + } + } + long numberBlankCell = (long)nCol - labelNumber % (long)nCol; + PdfPCell cell = new PdfPCell(); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorder(0); + if (numberBlankCell != (long)nCol) + for (int i = 0; (long)i < numberBlankCell; i++) + this.pdfPcorpo.addCell(cell); + } else { + Phrase ph = new Phrase("Attenzione! Non ci sono etichette da stampare!"); + PdfPCell cell = new PdfPCell(ph); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorder(0); + cell.setColspan(nCol); + this.pdfPcorpo.addCell(cell); + } + this.document.add((Element)this.pdfPcorpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public boolean hasLabelAccessoriDaStampare() { + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getArticolo().getFlgStampaAccessoriT() == 1L) + return true; + } + return false; + } + + public Date getDataAvviso() { + return this.dataAvviso; + } + + public void setDataAvviso(Date dataAvviso) { + this.dataAvviso = dataAvviso; + } + + public Date getDataChiusura() { + return this.dataChiusura; + } + + public void setDataChiusura(Date dataChiusura) { + this.dataChiusura = dataChiusura; + } + + public long getId_users() { + return this.id_users; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users()); + return this.users; + } + + public void setId_users(long newId_users) { + this.id_users = newId_users; + setUsers(null); + } + + public void setUsers(Users users) { + this.users = users; + } + + public String getNominativoDocumento() { + return (this.nominativoDocumento == null) ? "" : this.nominativoDocumento; + } + + public ResParm sendAvvisoRiparazione() { + ResParm rp = new ResParm(true); + String msg = ""; + if (getId_documento() == 0L || getFlgInviaAvviso() == 0L) { + rp.setMsg("Errore! Impossibile inviare avviso."); + rp.setStatus(false); + } else { + msg = ""; + } + if (!getEMailDocumento().isEmpty()) { + MailMessage mm = new MailMessage(getApFull()); + if (getId_tipoDocumento() == getId_docRiparazione()) { + mm.setTextMessage(getMessaggioAvvisoRiparazioneEmail()); + } else { + mm.setTextMessage(getMessaggioAvvisoPrenotazioneEmail()); + } + mm.setString("cliente", getNominativoDocumento()); + mm.setString("ndocumento", getNumeroDocumentoCompleto()); + MailProperties mp = new MailProperties(); + mp.setProperty("TO", getEMailDocumento()); + if (getId_tipoDocumento() == getId_docRiparazione()) { + mp.setProperty("SUBJECT", getMailSubject() + " - Avviso riparazione"); + } else { + mp.setProperty("SUBJECT", getMailSubject() + " - Avviso arrivo prenotazione"); + } + mp.setProperty("MSG", mm.getMessage()); + rp = mm.sendMailMessage(mp, true); + if (rp.getStatus()) + rp.append(aggiornaDataAvviso(getToday())); + } + if (!getCellDocumento().isEmpty()) { + MailMessage mm = new MailMessage(getApFull()); + if (getId_tipoDocumento() == getId_docRiparazione()) { + mm.setTextMessage(getMessaggioAvvisoRiparazioneSms()); + } else { + mm.setTextMessage(getMessaggioAvvisoPrenotazioneSms()); + } + mm.setString("cliente", getNominativoDocumento()); + mm.setString("ndocumento", getNumeroDocumentoCompleto()); + CodaMessaggi cm = new CodaMessaggi(getApFull()); + cm.setDataCreazione(getToday()); + cm.setCellulare(getCellDocumento()); + cm.setTestoMessaggio(mm.getMessage()); + cm.setFlgTipo(2L); + cm.setFlgStatoInvio(0L); + rp = cm.save(); + if (rp.getStatus()) + rp.append(aggiornaDataAvviso(getToday())); + } + return rp; + } + + public double getAbbuono() { + return this.abbuono; + } + + public static final Hashtable getTipoDocumentoHT(ApplParmFull ap) { + if (tipoDocumentoHT == null) { + tipoDocumentoHT = new Hashtable(); + Vectumerator vec = new TipoDocumento(ap).findAll(); + while (vec.hasMoreElements()) { + TipoDocumento row = (TipoDocumento)vec.nextElement(); + row.getCausaleMagazzino(); + tipoDocumentoHT.put(new Long(row.getId_tipoDocumento()), row); + } + } + return tipoDocumentoHT; + } + + public String getCellDocumento() { + return (this.cellDocumento == null) ? "" : this.cellDocumento.trim(); + } + + public void setCellDocumento(String telDocumento) { + this.cellDocumento = telDocumento; + } + + public long getFlgInviaAvviso() { + return this.flgInviaAvviso; + } + + public void setFlgInviaAvviso(long flgInviaAvviso) { + this.flgInviaAvviso = flgInviaAvviso; + } + + public static final String getInviaAvviso(long l_flgInviaAvviso) { + switch ((int)l_flgInviaAvviso) { + case 1: + return "Email"; + case 2: + return "Sms"; + } + return "No"; + } + + public String getInviaAvviso() { + return getInviaAvviso(getFlgInviaAvviso()); + } + + public ResParm aggiornaStatoPrenotazione(long l_flgStatoPrenotazionePrecedente, long l_flgStatoPrenotazione) { + if (getId_tipoDocumento() == getId_docPrenotazione()) { + if (l_flgStatoPrenotazionePrecedente != l_flgStatoPrenotazione) { + String noteTemp = " \n" + getStatoPrenotazione(l_flgStatoPrenotazione) + " in data " + String.valueOf(getToday()); + setNote(getNote() + getNote()); + } + setFlgStatoPrenotazione(l_flgStatoPrenotazione); + if (l_flgStatoPrenotazione == 90L || l_flgStatoPrenotazione == 100L) { + setDataChiusura(getToday()); + } else { + setDataChiusura(null); + setDataRestituzioneAcconto(null); + } + } + ResParm rp = super.save(); + if (rp.getStatus()) { + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getId_articolo() > 0L) { + row.getArticolo().resetCalcoloQuantita(); + row.resetStatoPrenotazioneByArticolo(row.getId_articolo(), row.getId_articoloVariante(), row.getId_articoloTaglia()); + } + } + } + return rp; + } + + public double getPercContIntegrativo() { + return this.percContIntegrativo; + } + + public void setPercContIntegrativo(double percContIntegrativo) { + this.percContIntegrativo = percContIntegrativo; + } + + public double getPercRitenutaAcconto() { + return this.percRitenutaAcconto; + } + + public void setPercRitenutaAcconto(double percRitenutaAcconto) { + this.percRitenutaAcconto = percRitenutaAcconto; + } + + public double getRimborsoArt15() { + return this.rimborsoArt15; + } + + public void setRimborsoArt15(double rimborsoArt15) { + this.rimborsoArt15 = rimborsoArt15; + } + + protected void creaDocumentoIntestazioneCorpoFtPro(Table l_pdfCorpo) { + int cellLeading = 8; + try { + Cell cell = new Cell(); + cell.addElement(new Chunk("DESCRIZIONE", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[0]); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("QUAN.", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[1]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("PREZZO", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[2]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SC.", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[3]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPORTO", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[4]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IVA", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[5]); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoFooterFatturePro(Table l_pdfCorpo, boolean isUltimaPagina) { + int cellLeading = 8; + NumberFormat nf = getNf(); + RigheRegistroIva rri = getRigaRegistroIvaCompleto(); + String codIva = "", imponibile = "", aliquota = "", imposta = ""; + if (rri != null) { + Enumeration enuRrri = rri.elementsFatt(); + while (enuRrri.hasMoreElements()) { + RigaRegistroIvaItem rrii = enuRrri.nextElement(); + if (rrii.getImponibile() != 0.0D) { + if (getFlgArt8() == 1L) { + imponibile = imponibile + "\n" + imponibile; + imposta = imposta + "\n0"; + codIva = codIva + "\n" + codIva; + aliquota = aliquota + "\n" + aliquota; + continue; + } + imponibile = imponibile + "\n" + imponibile; + imposta = imposta + "\n" + imposta; + codIva = codIva + "\n" + codIva; + aliquota = aliquota + "\n" + aliquota; + } + } + } + try { + Cell cell = new Cell(new Chunk("ALIQ.", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(codIva, PdfFontFactory.PDF_fPiccolissimoB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setRowspan(3); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPONIBILE", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(imponibile, PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setRowspan(3); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPOSTA\t", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(imposta, PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + cell.setRowspan(3); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE FATTURA\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getImponibileRighe() != 0.0D) { + cell.add(new Chunk(nf.format(getImponibileRighe()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("CONTRIBUTO INTEGRATIVO " + getPercContIntegrativo() + "%\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getImportoContIntegrativo() != 0.0D) { + cell.add(new Chunk(nf.format(getImportoContIntegrativo()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(16); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE IMP. FATTURA\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getImponibileTotale() != 0.0D) { + cell.add(new Chunk(nf.format(getImponibileTotale()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(23); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IVA TOTALE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getImportoIvaTotale() != 0.0D) { + cell.add(new Chunk(nf.format(getImportoIvaTotale()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("RIMBORSI SPESE ART. 15\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getRimborsoArt15() != 0.0D) { + cell.add(new Chunk(nf.format(getRimborsoArt15()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(9); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE COMPLESSIVO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getTotaleDocumentoSenzaRitenuta() != 0.0D) { + cell.add(new Chunk(nf.format(getTotaleDocumentoSenzaRitenuta()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOT. IMPONIBILE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(nf.format(getImponibileTotale()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOT. IMPOSTA\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(nf.format(getImportoIvaTotale()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("RITENUTA D'ACCONTO " + getPercRitenutaAcconto() + "%\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getImportoRitenutaAcconto() != 0.0D) { + cell.add(new Chunk(nf.format(getImportoRitenutaAcconto()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(16); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE DOCUMENTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getTotaleDocumento() != 0.0D) { + cell.add(new Chunk(nf.format(getTotaleDocumento()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e, 2); + } + } + + public double getImportoContIntegrativo() { + if (getPercContIntegrativo() == 0.0D) + return 0.0D; + DoubleOperator ci = new DoubleOperator(getRigaRegistroIva().getTotImponibile()); + ci.setScale(4, 5); + ci.multiply(getPercContIntegrativo()); + ci.divide(100.0F); + ci.setScale(2, 1); + return ci.getResult(); + } + + public void setRigaRegistroIva(RigheRegistroIva rigaRegistroIva) { + this.rigaRegistroIva = rigaRegistroIva; + } + + public void setRigaRegistroIvaCompleto(RigheRegistroIva rigaRegistroIvaCompleto) { + this.rigaRegistroIvaCompleto = rigaRegistroIvaCompleto; + } + + public double getTotaleDocumentoSenzaRitenuta() { + if (getTipoDocumento().getFlgCorrispettivi() == 0L) { + DoubleOperator temp = new DoubleOperator(getImponibileTotale()); + temp.add(getImportoIvaTotale()); + if (getTipoDocumento().isTipoFatturaProfessionisti()) + temp.add(getRimborsoArt15()); + temp.setScale(2, 5); + return temp.getResult(); + } + return getImportoTotale(); + } + + public double getImportoRitenutaAcconto() { + if (getPercRitenutaAcconto() == 0.0D) + return 0.0D; + DoubleOperator ci = new DoubleOperator(getImponibileRighe()); + ci.setScale(4, 5); + ci.multiply(getPercRitenutaAcconto()); + ci.divide(100.0F); + ci.setScale(2, 1); + return ci.getResult(); + } + + protected void creaDocumentoIntestazioneS(Table l_pdfCorpo) { + Font pdfFont = getTipoDocumento().getPdfFont(); + Font pdfFontMedio = getTipoDocumento().getPdfFont(2); + Font pdfFontPiccolo = getTipoDocumento().getPdfFont(-2); + Font pdfFontGrande = getTipoDocumento().getPdfFont(4); + Font pdfFontHF = getTipoDocumento().getPdfFontHeaderFooter(); + try { + String descDestinazione; + int cellLeading = 8; + SimpleDateFormat df = getDataFormat(); + float imgLogoWidth = getDocLogoWidth(); + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + if (imgLogoWidth > 0.0F) + imgLogo.scaleToFit(imgLogoWidth, imgLogoWidth); + Cell cell = new Cell(); + cell.addElement(new Chunk(imgLogo, 0.0F, 0.0F)); + Paragraph paragraph = creaParagrafoConGrassetto("\n" + getHeaderDoocumento(1) + "\n" + getHeaderDoocumento(2), PDF_fPiccolo, PDF_fPiccoloB); + paragraph.setLeading(10.0F); + cell.addElement((Element)paragraph); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(22); + l_pdfCorpo.addCell(cell); + String descCliente = getClifor().getCognomeNome() + "\n"; + String capComune = getClifor().getCapComune(); + if (!getClifor().getCapZona().isEmpty()) + capComune = getClifor().getCapZona(); + descCliente = descCliente + descCliente + " n." + getClifor().getIndirizzo() + "\n" + getClifor().getNumeroCivico() + " " + capComune + " (" + getClifor().getDescrizioneComune() + ")\nP.Iva/Cod. Fisc " + getClifor().getProvinciaComune() + " / " + getClifor().getPIva(); + if (getId_destinazioneDiversa() == 0L) { + if (getParm("DESTINAZIONE").getNumeroLong() == 1L) { + descDestinazione = "IDEM\n\n"; + } else { + descDestinazione = ""; + } + } else { + descDestinazione = getClifor().getCognomeNome() + "\n"; + if (!getDestinazioneDiversa().getPressoDD().isEmpty()) + descDestinazione = descDestinazione + "c/o " + descDestinazione + "\n"; + descDestinazione = descDestinazione + descDestinazione + " n." + getDestinazioneDiversa().getIndirizzoDD() + "\n" + getDestinazioneDiversa().getNumeroCivicoDD() + " " + getDestinazioneDiversa().getCapComuneDD() + " (" + getDestinazioneDiversa().getComuneDD().getDescrizione() + ")\n "; + } + cell = new Cell(); + cell.addElement(new Chunk("\n\nSPETT.LE\n\n", pdfFont)); + cell.addElement(new Chunk(descCliente, pdfFontGrande)); + cell.addElement(new Chunk("\nDESTINAZIONE\n", pdfFont)); + cell.addElement(new Chunk(descDestinazione, pdfFontGrande)); + cell.setVerticalAlignment(4); + cell.setLeading(12.0F); + cell.setBorder(0); + cell.setRowspan(3); + cell.setColspan(18); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("\n\nDATA", pdfFontMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("\n\n" + df.format(getDataDocumento()), pdfFontMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(17); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + if (getFlgStato() == 0L) { + cell.addElement(new Chunk("BOZZA", pdfFontMedio)); + } else if (getFlgStato() == 2L) { + cell.addElement(new Chunk("PROFORMA", pdfFontMedio)); + } else { + cell.addElement(new Chunk(getTipoDocumento().getDescrizioneStampa(), pdfFontMedio)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("N. " + String.valueOf(getNumeroDocumento()), pdfFontMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(11); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Pag. ", pdfFontPiccolo)); + cell.addElement(new Chunk(getNf0().format(getNumPagDocumento()), pdfFontPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(4); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("xx", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + cell.setRowspan(1); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("xx", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + cell.setRowspan(1); + l_pdfCorpo.addCell(cell); + creaDocumentoIntestazioneCorpoFtProS(l_pdfCorpo); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoFooterFattureProS(Table l_pdfCorpo, boolean isUltimaPagina) { + Font PDF_font = getTipoDocumento().getPdfFont(); + Font PDF_fontGrande = getTipoDocumento().getPdfFont(2); + int cellLeading = 14; + NumberFormat nf = getNf(); + RigheRegistroIva rri = getRigaRegistroIvaCompleto(); + String codIva = "", imponibile = "", aliquota = "", imposta = ""; + if (rri != null) { + Enumeration enuRrri = rri.elementsFatt(); + while (enuRrri.hasMoreElements()) { + RigaRegistroIvaItem rrii = enuRrri.nextElement(); + if (rrii.getImponibile() != 0.0D) { + if (getFlgArt8() == 1L) { + imponibile = imponibile + "\n" + imponibile; + imposta = imposta + "\n0"; + codIva = codIva + "\n" + codIva; + aliquota = aliquota + "\n" + aliquota; + continue; + } + imponibile = imponibile + "\n" + imponibile; + imposta = imposta + "\n" + imposta; + codIva = codIva + "\n" + codIva; + aliquota = aliquota + "\n" + aliquota; + } + } + } + try { + Cell cell = new Cell(); + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorderWidthBottom(2.0F); + cell.setBorderColorLeft(Color.white); + cell.setBorderColorTop(Color.white); + cell.setBorderColorRight(Color.white); + cell.setBorderColorBottom(Color.gray); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(15); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE FATTURA", PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(14); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("€", PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(nf.format(getImponibileRighe()), PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(9); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(15); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("CONTRIBUTO INTEGRATIVO " + nf.format(getPercContIntegrativo()) + "%", PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(14); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("€", PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(nf.format(getImportoContIntegrativo()), PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(9); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(15); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPONIBILE", PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(14); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("€", PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(nf.format(getImponibileTotale()), PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(9); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(15); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IVA", PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(14); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("€", PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(nf.format(getImportoIvaTotale()), PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(9); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(15); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("RIMBORSI SPESE ART. 15", PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(14); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("€", PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(nf.format(getRimborsoArt15()), PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(9); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(15); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE COMPLESSIVO", PDF_fontGrande)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(14); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("€", PDF_fontGrande)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(nf.format(getTotaleDocumentoSenzaRitenuta()), PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(9); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(15); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("RITENUTA D'ACCONTO " + nf.format(getPercRitenutaAcconto()) + "%", PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(14); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("€", PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(nf.format(getImportoRitenutaAcconto()), PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(9); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(15); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("NETTO DA PAGARE", PDF_fontGrande)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorderWidthTop(2.0F); + cell.setBorderColorLeft(Color.white); + cell.setBorderColorTop(Color.gray); + cell.setBorderColorRight(Color.white); + cell.setBorderColorBottom(Color.gray); + cell.setColspan(14); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("€", PDF_font)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorderWidthTop(2.0F); + cell.setBorderColorLeft(Color.white); + cell.setBorderColorTop(Color.gray); + cell.setBorderColorRight(Color.white); + cell.setBorderColorBottom(Color.gray); + cell.setColspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(nf.format(getTotaleDocumento()), PDF_fontGrande)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorderWidthTop(2.0F); + cell.setBorderColorLeft(Color.white); + cell.setBorderColorTop(Color.gray); + cell.setBorderColorRight(Color.white); + cell.setBorderColorBottom(Color.gray); + cell.setColspan(9); + l_pdfCorpo.addCell(cell); + if (!getFooterDocumento(1).isEmpty()) { + String temp; + cell = new Cell(); + if (!getFooterDocumento(2).isEmpty()) { + temp = getFooterDocumento(1) + "\n" + getFooterDocumento(1); + } else { + temp = getFooterDocumento(1); + } + cell.add(new Chunk("\n\n\n\n\n\n\n\n\n" + temp, getTipoDocumento().getPdfFontHeaderFooter())); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + } + } catch (Exception e) { + handleDebug(e, 2); + } + } + + protected void creaDocumentoIntestazioneCorpoFtProS(Table l_pdfCorpo) { + int cellLeading = 8; + Font pdfFont = getTipoDocumento().getPdfFont(); + try { + Cell cell = new Cell(); + cell.addElement(new Chunk("DESCRIZIONE", pdfFont)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(30); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("ONORARI", pdfFont)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoFooterDDTTotale(Table l_pdfCorpo, boolean isUltimaPagina) { + try { + int cellLeading = 8; + NumberFormat nf = getNf(); + Cell cell = new Cell(); + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(28); + cell.setRowspan(1); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE DOCUMENTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getTotaleDocumento() != 0.0D) { + cell.add(new Chunk(nf.format(getTotaleDocumento()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(12); + cell.setRowspan(1); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e, 2); + } + } + + public Date getDataScadenzaPagamento() { + return this.dataScadenzaPagamento; + } + + public void setDataScadenzaPagamento(Date dataScadenzaPagamento) { + this.dataScadenzaPagamento = dataScadenzaPagamento; + } + + public long getFlgPagamentoDataFissa() { + return this.flgPagamentoDataFissa; + } + + public void setFlgPagamentoDataFissa(long flgPagamentoDataFissa) { + this.flgPagamentoDataFissa = flgPagamentoDataFissa; + } + + public String getPagamentoDataFissa() { + return TipoPagamento.getTipoPagamento(getFlgPagamentoDataFissa()); + } + + public static final String getPagamentoDataFissa(long l_flg) { + return TipoPagamento.getTipoPagamento(l_flg); + } + + public long getFlgHaDocumentoPadre() { + return this.flgHaDocumentoPadre; + } + + public void setFlgHaDocumentoPadre(long flgHaDocumentiPadre) { + this.flgHaDocumentoPadre = flgHaDocumentiPadre; + } + + public boolean hasDocumentiFiglio() { + Vectumerator vec = findDocumentiFiglio(1, 1); + if (vec.hasMoreElements()) + return true; + return false; + } + + public void findOrdineBozza(long l_id_clifor) { + String s_Sql_Find = "select A.* from DOCUMENTO AS A, TIPO_DOCUMENTO AS B"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_tipoDocumento=B.id_tipoDocumento"); + wc.addWc("(A.flgStato is null or A.flgStato=0)"); + wc.addWc("A.id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public ByteArrayOutputStream creaSlip(DocumentoCR CR) { + CR.setFlgSlip(1L); + int numeroSlipXPagina = 4; + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + long totSlipStampate = 0L; + try { + this.document = new Document(PageSize.A4, 10.0F, 10.0F, 10.0F, 10.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + String titoloReport = "Slip"; + SimpleDateFormat tf = new SimpleDateFormat("HH:mm:ss"); + Date today = getToday(); + titoloReport = titoloReport + ". Stampato il " + titoloReport + " " + getDataFormat().format(today); + this.document.open(); + CR.setFlgSlip(1L); + CR.setId_tipoDocumento(getParm("ID_DOC_PRENOTAZIONE").getNumeroLong()); + CR.setFlgStatoPrenotazione(200L); + Vectumerator vec = findByCR(CR, 0, 0); + if (vec.hasMoreElements()) { + System.out.println(" TOT RIGHE: " + vec.size()); + while (vec.hasMoreElements()) { + Documento rowDoc = (Documento)vec.nextElement(); + Vectumerator vecR = rowDoc.findRigheDocumentoPerSlip(); + while (vecR.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecR.nextElement(); + double[] stati = { 0.0D, 0.0D }; + row.checkStatoRigaQta(stati); + if (stati[0] == 30.0D || stati[0] == 20.0D) { + long totSlipDaStampare = 0L; + if (stati[0] != 30.0D) { + totSlipDaStampare = (long)stati[1]; + } else { + totSlipDaStampare = (long)row.getQuantita(); + } + if (row.getQtaSlipStampate() > 0L) + if (totSlipDaStampare > row.getQtaSlipStampate() && (double)totSlipDaStampare >= row.getQuantita()) { + totSlipDaStampare = (long)(row.getQuantita() - (double)row.getQtaSlipStampate()); + } else if (totSlipDaStampare > row.getQtaSlipStampate()) { + totSlipDaStampare -= row.getQtaSlipStampate(); + } else if (totSlipDaStampare < row.getQtaSlipStampate()) { + totSlipDaStampare = 0L; + } + for (int num = 0; (long)num < totSlipDaStampare; num++) { + totSlipStampate++; + this.pdfcorpo = new Table(40); + this.pdfcorpo.setWidth(100.0F); + this.pdfcorpo.setBorderWidth(1.0F); + this.pdfcorpo.setBorderColor(Color.gray); + this.pdfcorpo.setPadding(2.0F); + this.pdfcorpo.setSpacing(0.0F); + this.pdfcorpo.setOffset(10.0F); + this.pdfcorpo.setWidths(colWidthsRighe40); + Cell cell = new Cell(); + cell.addElement(new Chunk(getParm("HEAD_SLIP").getTesto(), PdfFontFactory.PDF_fGrandeB)); + cell.setBorder(0); + cell.setLeading(12.0F); + cell.setRowspan(1); + cell.setColspan(40); + cell.setHorizontalAlignment(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Prenotazione n.", PdfFontFactory.PDF_fMedioB)); + cell.addElement(new Chunk(" " + rowDoc.getNumeroDocumentoCompleto(), PdfFontFactory.PDF_fMedio)); + cell.setBorder(0); + cell.setLeading(12.0F); + cell.setRowspan(1); + cell.setColspan(10); + cell.setHorizontalAlignment(0); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("del ", PdfFontFactory.PDF_fMedioB)); + cell.addElement(new Chunk(getDataFormat().format(rowDoc.getDataDocumento()), PdfFontFactory.PDF_fMedio)); + cell.setBorder(0); + cell.setLeading(12.0F); + cell.setRowspan(1); + cell.setColspan(10); + cell.setHorizontalAlignment(0); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Cliente: ", PdfFontFactory.PDF_fMedioB)); + cell.addElement(new Chunk(rowDoc.getNominativoDocumento(), PdfFontFactory.PDF_fMedio)); + cell.setBorder(0); + cell.setLeading(12.0F); + cell.setRowspan(1); + cell.setColspan(20); + cell.setHorizontalAlignment(0); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Articolo: ", PdfFontFactory.PDF_fMedioB)); + cell.addElement(new Chunk(row.getDescrizioneRigaCompleta(), PdfFontFactory.PDF_fMedio)); + cell.setBorder(0); + cell.setLeading(12.0F); + cell.setRowspan(1); + cell.setColspan(20); + cell.setHorizontalAlignment(0); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(rowDoc.getClifor().getIndirizzoCompleto(), PdfFontFactory.PDF_fMedio)); + cell.setBorder(0); + cell.setLeading(12.0F); + cell.setRowspan(1); + cell.setColspan(20); + cell.setHorizontalAlignment(0); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Note: ", PdfFontFactory.PDF_fMedioB)); + cell.addElement(new Chunk( + String.valueOf(formattaNoteDocumento(rowDoc.getNote(), 0, 8, true)) + " " + String.valueOf(formattaNoteDocumento(rowDoc.getNote(), 0, 8, true)), PdfFontFactory.PDF_fMedio)); + cell.setBorder(0); + cell.setLeading(12.0F); + cell.setRowspan(1); + cell.setColspan(20); + cell.setHorizontalAlignment(0); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Cell. " + rowDoc.getCellDocumento() + ( + !rowDoc.getTelDocumento().isEmpty() ? (" - Tel. " + rowDoc.getTelDocumento()) : ""), PdfFontFactory.PDF_fMedio)); + cell.setBorder(0); + cell.setLeading(12.0F); + cell.setRowspan(1); + cell.setColspan(20); + cell.setHorizontalAlignment(0); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + if (totSlipStampate % (long)numeroSlipXPagina == 0L) + this.document.newPage(); + } + if (CR.getFlgSimulazione() == 0L && totSlipDaStampare > 0L) { + row.setQtaSlipStampate(row.getQtaSlipStampate() + totSlipDaStampare); + row.superSave(); + } + } + } + } + if (totSlipStampate == 0L) { + Phrase ph = new Phrase("Attenzione! Non ci sono slip da stampare!"); + this.document.add((Element)ph); + } + System.out.println(" Fine "); + } else { + Phrase ph = new Phrase("Attenzione! Non ci sono slip da stampare!"); + this.document.add((Element)ph); + } + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public long getFlgInserisciReso() { + return this.flgInserisciReso; + } + + public void setFlgInserisciReso(long flgInserisciReso) { + this.flgInserisciReso = flgInserisciReso; + } + + public String getDescrizioneRigheHtml() { + StringBuffer temp = new StringBuffer(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + if (vec.hasMoreElements()) { + temp.append(""); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + temp.append(""); + } + temp.append("
"); + temp.append(""); + temp.append(getNf().format(row.getQuantita())); + temp.append(" "); + temp.append(row.getDescrizioneRigaCompleta()); + temp.append(""); + temp.append("
"); + } + return temp.toString(); + } + + public String getDescrizioneRighe() { + StringBuffer temp = new StringBuffer(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + if (vec.hasMoreElements()) + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + temp.append(getNf().format(row.getQuantita())); + temp.append(" "); + temp.append(row.getDescrizioneRigaCompleta()); + if (vec.hasMoreElements()) + temp.append("\n"); + } + return temp.toString(); + } + + public long getTipoAvviso() { + if (getFlgInviaAvviso() == 1L) { + if (!getEMailDocumento().isEmpty() && getCellDocumento().isEmpty()) + return 1L; + if (getEMailDocumento().isEmpty() && !getCellDocumento().isEmpty()) + return 2L; + if (!getEMailDocumento().isEmpty() && !getCellDocumento().isEmpty()) + return 3L; + return 9L; + } + return 0L; + } + + public String getTipoAvvisoDesc() { + switch ((int)getTipoAvviso()) { + case 2: + return "SMS"; + case 1: + return "Email"; + case 3: + return "Email + SMS"; + } + return "!! PARAMETRI NON IMPOSTATI"; + } + + public static String getStatoRiparazione(long l_flgStatoRiparazione) { + switch ((int)l_flgStatoRiparazione) { + case 0: + return "Non Visionato"; + case 1: + return "Riparazione Esterna"; + case 2: + return "Preventivo"; + case 3: + return "Prev.Accettato"; + case 4: + return "Prev. NON Accettato"; + case 10: + return "Riparato"; + case 11: + return "Non Riparato"; + case 99: + return "Riconsegnato"; + } + return "????"; + } + + public long getFlgInGaranzia() { + return this.flgInGaranzia; + } + + public void setFlgInGaranzia(long flgInGaranzia) { + this.flgInGaranzia = flgInGaranzia; + } + + public long getFlgStatoRiparazione() { + return this.flgStatoRiparazione; + } + + public void setFlgStatoRiparazione(long flgStatoRiparazione) { + this.flgStatoRiparazione = flgStatoRiparazione; + } + + public double getCauzione() { + return this.cauzione; + } + + public void setCauzione(double cauzione) { + this.cauzione = cauzione; + } + + public String getStatoRiparazione() { + return getStatoRiparazione(getFlgStatoRiparazione()); + } + + private boolean hasDocumentiPrelevabili() { + if (getDBState() == 1) { + if (getTipoDocumento().hasDocPrel()) { + Vectumerator vec = findRigheDocumentoPrelevabili(0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getQtaPrelevabileByDocumento(getId_documento()) > 0.0D) + return true; + } + return false; + } + return false; + } + return false; + } + + public long getFlgHasDocumentiPrelevabili() { + if (this.flgHasDocumentiPrelevabili == -1L) + if (hasDocumentiPrelevabili()) { + this.flgHasDocumentiPrelevabili = 1L; + } else { + this.flgHasDocumentiPrelevabili = 0L; + } + return this.flgHasDocumentiPrelevabili; + } + + public void setFlgHasDocumentiPrelevabili(long flgHasDocumentiPrelevabili) { + this.flgHasDocumentiPrelevabili = flgHasDocumentiPrelevabili; + } + + protected void creaDocumentoSchedaRiparazione(Table l_pdfCorpo) { + try { + String descCliente; + int cellLeading = 10; + SimpleDateFormat df = getDataFormat(); + float imgLogoWidth = getDocLogoWidth(); + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + imgLogo.scaleToFit(imgLogoWidth, imgLogoWidth); + Cell cell = new Cell(); + cell.addElement(new Chunk(imgLogo, 0.0F, 0.0F)); + Paragraph paragraph = creaParagrafoConGrassetto("\n" + getHeaderDoocumento(1) + "\n" + getHeaderDoocumento(2), PDF_fPiccolo, PDF_fPiccoloB); + paragraph.setLeading(10.0F); + cell.addElement((Element)paragraph); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(22); + l_pdfCorpo.addCell(cell); + if (getId_clifor() > 1L) { + descCliente = getClifor().getCognomeNome() + "\n"; + String capComune = getClifor().getCapComune(); + if (!getClifor().getCapZona().isEmpty()) + capComune = getClifor().getCapZona(); + descCliente = descCliente + descCliente + " n." + getClifor().getIndirizzo() + "\n" + getClifor().getNumeroCivico() + " " + capComune + " (" + getClifor().getDescrizioneComune() + ")"; + } else { + descCliente = getNominativoDocumento(); + } + if (getId_destinazioneDiversa() == 0L) { + if (getParm("DESTINAZIONE").getNumeroLong() == 1L) { + String descDestinazione = "IDEM\n\n"; + } else { + String descDestinazione = ""; + } + } else { + String descDestinazione = getClifor().getCognomeNome() + "\n"; + if (!getDestinazioneDiversa().getPressoDD().isEmpty()) + descDestinazione = descDestinazione + "c/o " + descDestinazione + "\n"; + descDestinazione = descDestinazione + descDestinazione + " n." + getDestinazioneDiversa().getIndirizzoDD() + "\n" + getDestinazioneDiversa().getNumeroCivicoDD() + " " + getDestinazioneDiversa().getComuneDD().getCap() + " (" + getDestinazioneDiversa().getComuneDD().getDescrizione() + ")\n "; + } + cell = new Cell(); + cell.addElement(new Chunk("\n\nSPETT.LE\n\n", PdfFontFactory.PDF_fPiccolissimoB)); + cell.addElement(new Chunk(descCliente, PdfFontFactory.PDF_fGrande)); + cell.setVerticalAlignment(4); + cell.setLeading(12.0F); + cell.setBorder(0); + cell.setRowspan(3); + cell.setColspan(18); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("TIPO DOCUMENTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (getFlgStato() == 0L) { + cell.addElement(new Chunk("(B) ", PdfFontFactory.PDF_fMedioB)); + } else if (getFlgStato() == 2L) { + cell.addElement(new Chunk("PROFORMA\n", PdfFontFactory.PDF_fMedioB)); + } else { + cell.addElement(new Chunk(getTipoDocumento().getDescrizioneStampa() + "\n", PdfFontFactory.PDF_fPiccoloB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("N. DOC.\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(String.valueOf(getNumeroDocumento()), PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(4); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("DATA\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(df.format(getDataDocumento()), PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(4); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Operatore\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(getUsers().getCognomeNome(), PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("xx", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + cell.setRowspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Recapiti: ", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk("Cell: " + + getCellDocumento() + " Tel:" + getTelDocumento() + " Fax:" + getFaxDocumento() + " - " + getEMailDocumento(), PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + Vectumerator vec = findRigheDocumento(1, 1, 0); + RigaDocumento row = new RigaDocumento(getApFull()); + if (vec.hasMoreElements()) + row = (RigaDocumento)vec.nextElement(); + cell = new Cell(); + cell.addElement(new Chunk("APPARATO: ", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(8); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(row.getDescrizioneRigaCompleta(), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(32); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("GARANZIA: ", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(8); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(getInGaranzia(), PdfFontFactory.PDF_fMedioB)); + cell.addElement(new Chunk(" - Doc. n. " + getRiferimento(), PdfFontFactory.PDF_fMedioB)); + cell.addElement(new Chunk(" del " + df.format(getDataRiferimento()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(32); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("ACCESSORI: ", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(8); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(row.getNotaRigaDocumento(), PdfFontFactory.PDF_fMedioB)); + if (getFlgPagamentoDataFissa() > 0L) { + if (getDataScadenzaPagamento() != null) + cell.addElement(new Chunk(getPagamentoDataFissa() + " al " + getPagamentoDataFissa(), PdfFontFactory.PDF_fPiccolissimoB)); + } else { + cell.addElement(new Chunk(getTipoPagamento().getDescrizione(), PdfFontFactory.PDF_fPiccolissimoB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(32); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + if (!getDescrizioneDifetto().isEmpty()) { + cell = new Cell(); + cell.addElement(new Chunk("DESCRIZIONE DIFETTO\n", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.gray); + cell.setBorder(0); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(getDescrizioneDifetto() + "\n\n.", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + } + if (getFlgStatoRiparazione() < 2L) { + cell = new Cell(); + cell.addElement(new Chunk("INFORMIAMO LA GENTILE CLIENTELA CHE\n", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.gray); + cell.setBorder(0); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(getParm("RIP_NOTA_SCHEDA_RIPARAZIONE").getTesto() + "\n\n.", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + l_pdfCorpo.setComplete(true); + cell = new Cell(); + cell.addElement(new Chunk("x", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("\n\n\n\n\n\n\n\nFirma per accettazione\n\n\n\n______________________", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + } + if (getFlgStatoRiparazione() == 2L) { + cell = new Cell(); + cell.addElement(new Chunk("IL PREVENTIVO PREVEDE \n", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.gray); + cell.setBorder(0); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(getDescrizionePreventivo() + "\n\n.", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(getParm("RIP_NOTA_ACCETTAZIONE_PREVENTIVO").getTesto() + "\n\n.", PdfFontFactory.PDF_fGrande)); + cell.addElement(new Chunk("\n\nTOTALE PREVENTIVO: ", PdfFontFactory.PDF_fGrandeRouge)); + cell.addElement(new Chunk(getNf().format(getImportoPreventivo()) + " + IVA", PdfFontFactory.PDF_fGrandeRouge)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("\n\n\n\n\\n.", PdfFontFactory.PDF_fPiccoloBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + l_pdfCorpo.setComplete(true); + Image imgSquare = Image.getInstance(getDocBase() + "admin/_V3/_img/Icons/48x48/shadow/bullet_square_grey.gif"); + imgSquare.scaleToFit(16.0F, 16.0F); + cell = new Cell(); + cell.addElement(new Chunk(imgSquare, -6.0F, 0.0F)); + cell.addElement(new Chunk("PREVENTIVO ACCETTATO\n\n", PdfFontFactory.PDF_fMedioB)); + cell.addElement(new Chunk(imgSquare, -6.0F, 0.0F)); + cell.addElement(new Chunk("PREVENTIVO NON ACCETTATO", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Timbro e firma\n\n\n\n______________________", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + } + if (getFlgStatoRiparazione() >= 10L) { + cell = new Cell(); + cell.addElement(new Chunk("INTERVENTO EFFETTUATO\n", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.gray); + cell.setBorder(0); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(getInterventoEffettuato() + "\n\n.", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + if (!row.getSerialeSost().isEmpty()) { + cell = new Cell(); + cell.addElement(new Chunk("Nuovo S/N: " + row.getSerialeSost(), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + } + cell = new Cell(); + cell.addElement(new Chunk(getNotaAggiuntiva() + "\n\n.", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + l_pdfCorpo.setComplete(true); + cell = new Cell(); + cell.addElement(new Chunk("x", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("\n\n\n\n\n\n\nFirma per ritiro\n\n\n\n______________________", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + } + } catch (Exception e) { + handleDebug(e); + } + } + + public ResParm aggiornaStatoRiparazione(long l_flgStatoRiparazione) { + setFlgStatoRiparazione(l_flgStatoRiparazione); + if (getId_tipoDocumento() == getId_docPrenotazione()) { + if (l_flgStatoRiparazione == 99L) + setDataChiusura(getToday()); + String noteTemp = " \n" + getStatoRiparazione(l_flgStatoRiparazione) + " in data " + String.valueOf(getToday()); + setNote(getNote() + getNote()); + return super.save(); + } + return new ResParm(true); + } + + public String getDescrizioneDifetto() { + return (this.descrizioneDifetto == null) ? "" : this.descrizioneDifetto.trim(); + } + + public void setDescrizioneDifetto(String descrizioneDifetto) { + this.descrizioneDifetto = descrizioneDifetto; + } + + public String getIntestazioneDocumento() { + if (getId_clifor() > 1L) + return getClifor().getDescrizioneCompleta(); + return getNominativoDocumento(); + } + + public void setInterventoEffettuato(String interventoEffettuato) { + this.interventoEffettuato = interventoEffettuato; + } + + public long getFlgPreventivo() { + return this.flgPreventivo; + } + + public void setFlgPreventivo(long flgPreventivo) { + this.flgPreventivo = flgPreventivo; + } + + public double getImportoPreventivo() { + return this.importoPreventivo; + } + + public void setImportoPreventivo(double importoPreventivo) { + this.importoPreventivo = importoPreventivo; + } + + protected int getStringValueCase(String l_colomnName) { + if (l_colomnName != null && l_colomnName.startsWith("eMailDocumento")) + return 0; + return super.getStringValueCase(l_colomnName); + } + + public String getNotaAggiuntiva() { + return (this.notaAggiuntiva == null) ? "" : this.notaAggiuntiva.trim(); + } + + public void setNotaAggiuntiva(String notaAggiuntiva) { + this.notaAggiuntiva = notaAggiuntiva; + } + + public String getDescrizionePreventivo() { + return (this.descrizionePreventivo == null) ? "" : this.descrizionePreventivo; + } + + public void setDescrizionePreventivo(String descrizionePreventivo) { + this.descrizionePreventivo = descrizionePreventivo; + } + + public ResParm aggiornaDataAvviso(Date l_dataAvviso) { + setDataAvviso(l_dataAvviso); + String noteTemp = " \nAvvisato in data " + String.valueOf(getToday()); + setNote(getNote() + getNote()); + return super.save(); + } + + protected long getId_docOrdine() { + return getParm("ID_DOC_ORDINE").getNumeroLong(); + } + + protected long getId_docPrenotazione() { + return getParm("ID_DOC_PRENOTAZIONE").getNumeroLong(); + } + + private Document creaReportUnaOrdiniInevasi(DocumentoCR CR, boolean soloCompatto) { + int rowCellLeading = 6; + NumberFormat nf3 = NumberFormat.getInstance(); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf0 = NumberFormat.getInstance(); + nf0.setMaximumFractionDigits(0); + nf0.setMinimumFractionDigits(0); + int col_1 = 4, col_2 = 16, col_3 = 3, col_4 = 3, col_5 = 14; + int cellLeading = 12; + SimpleDateFormat df = getDataFormat(); + try { + Cell rigaVuota = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimo)); + rigaVuota.setVerticalAlignment(4); + rigaVuota.setHorizontalAlignment(0); + rigaVuota.setLeading((float)cellLeading); + rigaVuota.setBorder(0); + rigaVuota.setColspan(40); + rigaVuota.setRowspan(1); + String intestazioneReport = "Data: dal " + df.format(CR.getDataDocumentoDa()) + " al " + df.format(CR.getDataDocumentoA()); + if (CR.getId_tipo() != 0L) + intestazioneReport = intestazioneReport + " - Tipo: " + intestazioneReport; + creaIntestazioneReport(CR.getTipoReport(), intestazioneReport); + Cell cell = new Cell(new Chunk("Doc.", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Articolo", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Q.ta ord.", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Q.ta prel.", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Fornitore", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.pdfcorpo.endHeaders(); + Vectumerator vec = new RigaDocumento(getApFull()).findOrdini(CR); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + cell = new Cell(new Chunk(row.getDocumento().getNumeroDocumentoCompleto(), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(row.getDescrizioneRigaCompleta(), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf0.format(row.getQuantita()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf0.format(row.getQuantitaPrelevata()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(row.getDocumento().getClifor().getDescrizioneCompleta(), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("TOTALE RECORD: ", PdfFontFactory.PDF_fGrande)); + cell.add(new Chunk(String.valueOf(vec.getTotNumberOfRecords()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + } catch (Exception e) { + handleDebug(e); + } + return this.document; + } + + public void findDocumentoBozza(long l_id_tipoDocumento, long l_id_clifor) { + String s_Sql_Find = "select A.* from DOCUMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_tipoDocumento=" + l_id_tipoDocumento); + wc.addWc("(A.flgStato is null or A.flgStato=0)"); + wc.addWc("A.id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getFaxDocumento() { + return (this.faxDocumento == null) ? "" : this.faxDocumento; + } + + public void setFaxDocumento(String faxDocumento) { + this.faxDocumento = faxDocumento; + } + + public String getTelDocumento() { + return (this.telDocumento == null) ? "" : this.telDocumento; + } + + public void setTelDocumento(String telDocumento) { + this.telDocumento = telDocumento; + } + + public long getId_usersIntervento() { + return this.id_usersIntervento; + } + + public void setId_usersIntervento(long id_usersIntervento) { + this.id_usersIntervento = id_usersIntervento; + setUsersIntervento(this.usersIntervento); + } + + public long getId_usersChiusura() { + return this.id_usersChiusura; + } + + public void setId_usersChiusura(long id_usersChiusura) { + this.id_usersChiusura = id_usersChiusura; + setUsersChiusura(null); + } + + public Users getUsersIntervento() { + this.usersIntervento = (Users)getSecondaryObject((DBAdapter)this.usersIntervento, Users.class, getId_usersIntervento()); + return this.usersIntervento; + } + + public void setUsersIntervento(Users usersIntervento) { + this.usersIntervento = usersIntervento; + } + + public Users getUsersChiusura() { + this.usersChiusura = (Users)getSecondaryObject((DBAdapter)this.usersChiusura, Users.class, getId_usersChiusura()); + return this.usersChiusura; + } + + public void setUsersChiusura(Users usersChiusura) { + this.usersChiusura = usersChiusura; + } + + public long getFlgStatoRiparazionePrecedente() { + return this.flgStatoRiparazionePrecedente; + } + + public void setFlgStatoRiparazionePrecedente(long flgStatoRiparazionePrecedente) { + this.flgStatoRiparazionePrecedente = flgStatoRiparazionePrecedente; + } + + public String getInGaranzia() { + return getInGaranzia(getFlgInGaranzia()); + } + + public Vectumerator findDocumentiFiglio() { + return findDocumentiFiglio(0, 0); + } + + public Vectumerator findDocumentiPadre() { + if (getId_documento() == 0L) + return AB_EMPTY_VECTUMERATOR; + StringBuffer s_Sql_Find = new StringBuffer("select D.* from DOCUMENTO AS D where id_documento in (select B.id_documentoPadre from DOCUMENTO AS A, RIGA_DOCUMENTO AS B "); + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("B.id_documento=" + getId_documento()); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + ")"); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDocumentiPadreDesc(String javascript) { + Vectumerator vec = findDocumentiPadre(); + if (!vec.hasMoreElements()) + return ""; + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + if (javascript != null) { + sb.append(""); + } else { + sb.append(row.getNumeroDocumentoCompleto()); + } + if (vec.hasMoreElements()) + sb.append(", "); + } + return sb.toString(); + } + + public String getDocumentiPadreDesc() { + return getDocumentiPadreDesc(null); + } + + public String getDocumentiFiglioDesc(String javascript) { + Vectumerator vec = findDocumentiFiglio(); + if (!vec.hasMoreElements()) + return ""; + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + if (javascript != null) { + sb.append(""); + } else { + sb.append(row.getNumeroDocumentoCompleto()); + } + if (vec.hasMoreElements()) + sb.append(", "); + } + return sb.toString(); + } + + public String getDocumentiFiglioDesc() { + return getDocumentiFiglioDesc(null); + } + + public String getDescrizioneRigheHtmlCompleta() { + StringBuffer temp = new StringBuffer(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + if (vec.hasMoreElements()) { + temp.append(""); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + temp.append(""); + } + temp.append("
"); + temp.append(""); + temp.append(getNf().format(row.getQuantita())); + temp.append(" "); + temp.append(row.getDescrizioneRigaCompleta()); + temp.append(""); + temp.append(""); + if (row.getId_articolo() != 0L) { + temp.append(getNf().format(row.getArticolo().getQuantitaEffettiva())); + temp.append(""); + temp.append(getNf().format(row.getArticolo().getQuantita())); + temp.append(""); + } + temp.append("
"); + } + return temp.toString(); + } + + public String getDescrizioneRigheCompleta() { + if (!getDescrizioneRighePrenotazione().isEmpty()) + return getDescrizioneRighePrenotazione(); + StringBuffer temp = new StringBuffer(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + if (vec.hasMoreElements()) + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + temp.append(getNf().format(row.getQuantita())); + temp.append(" "); + temp.append(row.getDescrizioneRigaCompleta()); + temp.append(" "); + if (row.getId_articolo() != 0L) { + temp.append(getNf().format(row.getArticolo().getQuantitaEffettiva())); + temp.append(" "); + temp.append(getNf().format(row.getArticolo().getQuantita())); + temp.append(" "); + } + temp.append(" - "); + } + return temp.toString(); + } + + public boolean isUnDocumentoFiglioCreato() { + StringBuffer s_Sql_Find = new StringBuffer("select B.id_documento from DOCUMENTO AS A, RIGA_DOCUMENTO AS B "); + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("B.id_documentoPadre=" + getId_documento()); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + " limit 1"); + Vectumerator vec = findRows(stmt); + if (vec.hasMoreElements()) + return true; + return false; + } catch (SQLException e) { + handleDebug(e); + return false; + } + } + + public String getDocumentiFigliDesc() { + Vectumerator vec = findDocumentiFiglio(); + StringBuffer sb = new StringBuffer(); + if (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + sb.append(row.getNumeroDocumentoCompleto()); + if (vec.hasMoreElements()) + sb.append(" - "); + } + return sb.toString(); + } + + public Documento getDocumentoFiglioUno() { + if (this.documentoFiglioUno == null) { + Vectumerator vec = findDocumentiFiglio(); + if (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + this.documentoFiglioUno = row; + } + } + return (this.documentoFiglioUno == null) ? new Documento(getApFull()) : this.documentoFiglioUno; + } + + public void setDocumentoFiglioUno(Documento documentoFiglioUno) { + this.documentoFiglioUno = documentoFiglioUno; + } + + public long getId_porto() { + return this.id_porto; + } + + public void setId_porto(long id_porto) { + this.id_porto = id_porto; + setPorto(null); + } + + public Porto getPorto() { + this.porto = (Porto)getSecondaryObject(this.porto, Porto.class, getId_porto()); + return this.porto; + } + + public void setPorto(Porto porto) { + this.porto = porto; + } + + public boolean isFatturaONotaDiCredito() { + if (getDBState() == 1 && getFlgStato() == 1L) { + if (getTipoDocumento().getFlgTipologia() == 1L || + getTipoDocumento().getFlgTipologia() == 2L) + return true; + return false; + } + return false; + } + + public void findPrecedente(long l_progDocumento, long l_annoDocumento, long l_id_contatore) { + String s_Sql_Find = "select A.* from DOCUMENTO AS A"; + String s_Sql_Order = " order by A.progDocumento desc limit 1"; + WcString wc = new WcString(); + wc.addWc("A.flgStato=1"); + wc.addWc("A.progDocumento<" + l_progDocumento); + wc.addWc("A.id_esercizio=" + l_annoDocumento); + wc.addWc("A.id_contatore=" + l_id_contatore); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findSuccessiva(long l_progDocumento, long l_id_esercizio, long l_id_contatore) { + String s_Sql_Find = "select A.* from DOCUMENTO AS A"; + String s_Sql_Order = " order by A.progDocumento asc limit 1"; + WcString wc = new WcString(); + wc.addWc("A.flgStato=1"); + wc.addWc("A.progDocumento>" + l_progDocumento); + wc.addWc("A.id_esercizio=" + l_id_esercizio); + wc.addWc("A.id_contatore=" + l_id_contatore); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public long getId_tipoDocumentoFiglio() { + return this.id_tipoDocumentoFiglio; + } + + public void setId_tipoDocumentoFiglio(long idTipoDocumentoFiglio) { + this.id_tipoDocumentoFiglio = idTipoDocumentoFiglio; + } + + public long getId_esercizioB() { + return this.id_esercizioB; + } + + public void setId_esercizioB(long idEsercizioB) { + this.id_esercizioB = idEsercizioB; + } + + public long getProgDocumentoB() { + return this.progDocumentoB; + } + + public void setProgDocumentoB(long progDocumentoB) { + this.progDocumentoB = progDocumentoB; + } + + public String getProgDocumentoAggB() { + return this.progDocumentoAggB; + } + + public void setProgDocumentoAggB(String progDocumentoAggB) { + this.progDocumentoAggB = progDocumentoAggB; + } + + private int findByCRTotRecord(DocumentoCR CR) { + StringBuffer s_Sql_Find = new StringBuffer("select count(*) as tot from DOCUMENTO AS A "); + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + findByCRCreateStmtDate(CR, stmt); + return (int)getTots(stmt); + } catch (Exception e) { + handleDebug(e); + return 0; + } + } + + public void findByCRCreateWC(DocumentoCR CR, StringBuffer s_Sql_Find, WcString wc) { + if (CR.getFlgRicercaPerTaglio() == 1L || !CR.getSeriale().isEmpty() || CR.getId_articoloTessuto() != 0L || CR.getId_iva() != 0L || + CR.getId_articoloVariante() != 0L || CR.getId_telaio() != 0L || CR.getId_articolo() != 0L || + !CR.getDescrizioneCompletaArticolo().isEmpty() || CR.getFlgSlip() > 0L || CR.getId_tipo() != 0L || CR.getId_marca() != 0L || + !CR.getNotaBarcode().isEmpty() || !CR.getRiferimentoAzienda().isEmpty() || CR.getFlgReport().equals("S") || + !CR.getNMatricola().isEmpty() || !CR.getSearchArticolo().isEmpty()) { + s_Sql_Find.append(" inner join RIGA_DOCUMENTO AS B ON A.id_documento=B.id_documento"); + s_Sql_Find.replace(0, 11, "select DISTINCT A.*"); + if (CR.getFlgRicercaPerTaglio() == 1L || CR.getId_tipo() != 0L || CR.getId_marca() != 0L) { + s_Sql_Find.append(" inner join ARTICOLO as D ON B.id_articolo=D.id_articolo"); + } else if (!CR.getNMatricola().isEmpty()) { + s_Sql_Find.append(" left join ARTICOLO as D ON B.id_articolo=D.id_articolo"); + } + if (CR.getId_tipo() != 0L) + s_Sql_Find.append(" inner join TIPO as E on D.id_tipo=E.id_tipo "); + } + if (CR.getFlgOrderBy() == 9L || CR.getId_contatore() != 0L || CR.getFlgSoloFattureElettroniche() == 1L || + CR.getFlgTipologia() >= 0L || !CR.getFlgClienteFornitore().isEmpty() || !CR.getRiferimentoAzienda().isEmpty() || + CR.getFlgXmlGenerato() >= 0L || CR.getFlgOss() > 0L) { + s_Sql_Find.append(" inner join TIPO_DOCUMENTO AS C ON A.id_tipoDocumento= C.id_tipoDocumento"); + if (CR.getFlgTipologia() >= 0L || CR.getFlgSoloFattureElettroniche() == 1L || CR.getFlgXmlGenerato() >= 0L) + s_Sql_Find.append(" inner join TIPOLOGIA_DOCUMENTO AS TD ON TD.id_tipologiaDocumento=C.id_tipologiaDocumento"); + } + if (CR.getFlgPA() >= 0L || CR.getFlgSplitPayment() >= 0L || !CR.getId_nazione().isEmpty() || CR.getFlgMl() >= 0L || + CR.getFlgOrderBy() == 2L) + s_Sql_Find.append(" inner join CLIFOR AS CF ON CF.id_clifor=A.id_clifor"); + if (CR.getId_marca() != 0L) + wc.addWc("D.id_marca=" + CR.getId_marca()); + if (!CR.getNotaBarcode().isEmpty()) + wc.addWc("B.notaBarcode LIKE '%" + CR.getNotaBarcode() + "%'"); + if (CR.getFlgXmlGenerato() == 0L) { + wc.addWc("A.tmstFileXml is null"); + wc.addWc("A.id_esercizio >=2019"); + wc.addWc("(TD.codice=1 or TD.codice=2)"); + wc.addWc("A.flgStato='1'"); + } else if (CR.getFlgXmlGenerato() > 0L) { + wc.addWc("A.tmstFileXml is not null"); + wc.addWc("A.id_esercizio >=2019"); + wc.addWc("A.flgStato='1'"); + } + if (CR.getProgOrdineWww() != 0L) + wc.addWc("A.progOrdineWww=" + CR.getProgOrdineWww()); + if (CR.getId_documentoS() != 0L) + wc.addWc("A.id_documento=" + CR.getId_documentoS()); + if (CR.getId_documentoNo() != 0L) + wc.addWc("A.id_documento!=" + CR.getId_documentoNo()); + if (CR.getId_clifor() != 0L) + wc.addWc("A.id_clifor=" + CR.getId_clifor()); + if (CR.getId_users() > 0L) + wc.addWc("A.id_users=" + CR.getId_users()); + if (CR.getId_contatore() != 0L) { + wc.addWc("C.id_contatore=" + CR.getId_contatore()); + } else if (CR.getId_clifor() == 0L && !CR.getNominativoDocumento().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getNominativoDocumento().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = prepareSqlString(st.nextToken()); + txt.append("(A.nominativoDocumento like '%" + token + "%' )"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getFlgMl() == 0L) { + wc.addWc("(CF.flgMl is null or CF.flgMl=0)"); + } else if (CR.getFlgMl() > 0L) { + wc.addWc("CF.flgMl=" + CR.getFlgMl()); + } + if (CR.getId_telaio() != 0L) + wc.addWc("B.id_telaio=" + CR.getId_telaio()); + if (CR.getId_articoloDocumento() != 0L) + wc.addWc("A.id_articolo=" + CR.getId_articoloDocumento()); + if (CR.getId_articoloVariante() != 0L) { + wc.addWc("B.id_articoloVariante=" + CR.getId_articoloVariante()); + } else if (CR.getId_articolo() != 0L) { + wc.addWc("B.id_articolo=" + CR.getId_articolo()); + } else if (!CR.getSearchArticolo().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchArticolo().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = prepareSqlString(st.nextToken()); + txt.append("(B.descrizioneRiga like '%" + token + "%' )"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_iva() != 0L) + wc.addWc("B.id_iva=" + CR.getId_iva()); + if (CR.getId_articoloTessuto() != 0L) + wc.addWc("B.id_articoloTessuto=" + CR.getId_articoloTessuto()); + if (CR.getId_tipo() != 0L) + wc.addWc("(E.id_tipo=" + CR.getId_tipo() + " or E.indici like'%:" + CR.getId_tipo() + ":%')"); + if (CR.getFlgTipologia() >= 0L) + if (CR.getFlgTipologia() == 100L) { + wc.addWc("A.id_tipoDocumento=1"); + } else if (CR.getFlgTipologia() == 20L) { + wc.addWc("(TD.codice=1 OR TD.codice=2)"); + wc.addWc("A.id_tipoDocumento<>1"); + } else if (CR.getFlgTipologia() == 1L) { + wc.addWc("TD.codice=" + CR.getFlgTipologia()); + wc.addWc("A.id_tipoDocumento<>1"); + } else if (CR.getFlgTipologia() == 0L) { + wc.addWc("(TD.codice is null or TD.codice=" + CR.getFlgTipologia() + ")"); + } else { + wc.addWc("TD.codice=" + CR.getFlgTipologia()); + } + if (CR.getFlgStatoLavorazione() == 0L) { + wc.addWc("(A.flgStatoLavorazione is null or A.flgStatoLavorazione=0)"); + } else if (CR.getFlgStatoLavorazione() > 0L) { + wc.addWc("A.flgStatoLavorazione=" + CR.getFlgStatoLavorazione()); + } else if (CR.getFlgStatoLavorazione() == -1L) { + wc.addWc("(A.flgStatoLavorazione=0 is null or A.flgStatoLavorazione=0 or A.flgStatoLavorazione=20 or A.flgStatoLavorazione=10 ) "); + } + if (!CR.getSeriale().isEmpty()) { + String temp = CR.getSeriale(); + temp = temp.replace("%", "\\%"); + temp = temp.replace("_", "\\_"); + temp = temp.replace("*", "%"); + wc.addWc("B.seriale like '" + CR.getSeriale() + "'"); + } + if (!CR.getNMatricola().isEmpty()) + wc.addWc("(D.nMatricola like'%" + CR.getNMatricola() + "%' or B.seriale like'%" + CR.getNMatricola() + "%')"); + if (CR.getProgDocumento() != 0L && CR.getProgDocumentoA() == 0L) { + wc.addWc("A.progDocumento =" + CR.getProgDocumento()); + } else if (CR.getProgDocumento() != 0L && CR.getProgDocumentoA() != 0L) { + wc.addWc("A.progDocumento >=" + CR.getProgDocumento()); + wc.addWc("A.progDocumento <=" + CR.getProgDocumentoA()); + } + if (CR.getId_esercizio() != 0L) + wc.addWc("A.id_esercizio =" + CR.getId_esercizio()); + if (CR.getFlgInvioMail() == 0L) + wc.addWc("A.tmstInvioMail is null"); + if (CR.getFlgSoloFattureElettroniche() == 1L) { + wc.addWc("(TD.codice=1 OR TD.codice=2)"); + wc.addWc("A.flgStato=1"); + } + if (CR.getTotaleDocumentoDa() > 0.0D) + wc.addWc("A.totaleDocumento >=" + CR.getTotaleDocumentoDa()); + if (CR.getTotaleDocumentoA() > 0.0D) + wc.addWc("A.totaleDocumento <=" + CR.getTotaleDocumentoA()); + if (CR.getId_tipoPagamento() != 0L) + wc.addWc("A.id_tipoPagamento =" + CR.getId_tipoPagamento()); + if (CR.getNumScontrino() != 0L) + wc.addWc("A.echoScontrino like'%" + CR.getNumScontrino() + " %'"); + if (!CR.getRiferimento().isEmpty()) + wc.addWc("A.riferimento like'%" + CR.getRiferimento() + "%'"); + if (CR.getFlgBartolini() == 0L) { + wc.addWc("(A.flgBartolini is null or flgBartolini=0)"); + } else if (CR.getFlgBartolini() > 0L) { + wc.addWc("A.flgBartolini =" + CR.getFlgBartolini()); + } + if (CR.getFlgStato() == 0L) { + wc.addWc("(A.flgStato is null or flgStato=0)"); + } else if (CR.getFlgStato() > 0L) { + wc.addWc("A.flgStato =" + CR.getFlgStato()); + } + if (CR.getFlgInviatoAvviso() == 0L) { + wc.addWc("A.dataAvviso is null"); + } else if (CR.getFlgInviatoAvviso() > 0L) { + wc.addWc("A.dataAvviso is not null"); + } + if (CR.getFlgStatoRiparazione() == 0L) { + wc.addWc("(A.flgStatoRiparazione is null or flgStatoRiparazione=0)"); + } else if (CR.getFlgStatoRiparazione() > 0L) { + wc.addWc("A.flgStatoRiparazione =" + CR.getFlgStatoRiparazione()); + } + if (CR.getFlgSlip() > 0L) { + wc.addWc("B.quantita>COALESCE(B.qtaSlipStampate, 0)"); + wc.addWc("B.quantita>0"); + } + if (CR.getFlgSplitPayment() == 0L) { + wc.addWc("(CF.flgSplitPayment is null or CF.flgSplitPayment=0)"); + } else if (CR.getFlgSplitPayment() > 0L) { + wc.addWc("CF.flgSplitPayment =" + CR.getFlgSplitPayment()); + } + if (!CR.getId_nazione().isEmpty()) + wc.addWc("CF.id_nazione ='" + CR.getId_nazione() + "'"); + if (CR.getFlgPA() == 0L) { + wc.addWc("(CF.flgPA is null or CF.flgPA=0)"); + } else if (CR.getFlgPA() > 0L) { + wc.addWc("CF.flgPA =" + CR.getFlgPA()); + } + if (CR.getFlgPagata() == 0L) { + wc.addWc("(A.flgPagata is null or flgPagata=0)"); + } else if (CR.getFlgPagata() > 0L) { + wc.addWc("A.flgPagata =" + CR.getFlgPagata()); + } + if (CR.getFlgStatoPrenotazione() == 0L) { + wc.addWc("(A.flgStatoPrenotazione is null or flgStatoPrenotazione=0)"); + } else if (CR.getFlgStatoPrenotazione() == 200L) { + wc.addWc("(A.flgStatoPrenotazione is null or flgStatoPrenotazione=0 or A.flgStatoPrenotazione <90)"); + } else if (CR.getFlgStatoPrenotazione() > 0L) { + wc.addWc("A.flgStatoPrenotazione =" + CR.getFlgStatoPrenotazione()); + } + if (CR.getFlgDocumentoPrelevato() == 0L) { + wc.addWc("(A.flgDocumentoPrelevato is null or A.flgDocumentoPrelevato=0)"); + } else if (CR.getFlgDocumentoPrelevato() > 0L) { + wc.addWc("A.flgDocumentoPrelevato =" + CR.getFlgDocumentoPrelevato()); + } + if (CR.getFlgHasDocumentiPrelevabili() == 0L) { + wc.addWc("(A.flgHasDocumentiPrelevabili is null or A.flgHasDocumentiPrelevabili=0)"); + } else if (CR.getFlgHasDocumentiPrelevabili() > 0L) { + wc.addWc("A.flgHasDocumentiPrelevabili =" + CR.getFlgHasDocumentiPrelevabili()); + } + if (CR.getId_tipoDocumento() != 0L) + wc.addWc("A.id_tipoDocumento=" + CR.getId_tipoDocumento()); + if (CR.getDataScontrino() != null) + wc.addWc("A.echoScontrino like'% " + CR.getDataScontrinoF() + " %'"); + if (CR.getId_bancaAnticipo() == 0L) { + wc.addWc("A.id_bancaAnticipo >0"); + } else if (CR.getId_bancaAnticipo() > 0L) { + wc.addWc("A.id_bancaAnticipo =" + CR.getId_bancaAnticipo()); + } + if (CR.getFlgStatoOrdineWww() == 0L) { + wc.addWc("(A.flgStatoOrdineWww is null or A.flgStatoOrdineWww=0)"); + } else if (CR.getFlgStatoOrdineWww() == 10L) { + wc.addWc("(A.flgStatoOrdineWww is null or A.flgStatoOrdineWww <9)"); + } else if (CR.getFlgStatoOrdineWww() == 11L) { + wc.addWc("(A.flgStatoOrdineWww =9 or A.flgStatoOrdineWww =99 )"); + } else if (CR.getFlgStatoOrdineWww() > 0L) { + wc.addWc("A.flgStatoOrdineWww =" + CR.getFlgStatoOrdineWww()); + } + if (CR.getDataDocumentoDa() != null) + wc.addWc("A.dataDocumento>=?"); + if (CR.getDataDocumentoA() != null) + wc.addWc("A.dataDocumento<=?"); + if (CR.getDataChiusuraDa() != null) + wc.addWc("A.dataChiusura>=?"); + if (CR.getDataChiusuraA() != null) + wc.addWc("A.dataChiusura<=?"); + if (CR.getDataRiferimentoDa() != null) + wc.addWc("A.dataRiferimento>=?"); + if (CR.getDataRiferimentoA() != null) + wc.addWc("A.dataRiferimento<=?"); + if (CR.getFlgSuperR() == 0L) { + wc.addWc("(A.flgSuper=0 OR A.flgSuper IS NULL)"); + } else if (CR.getFlgSuperR() > 0L) { + wc.addWc(" A.flgSuper= " + CR.getFlgSuperR()); + } else if (CR.getFlgSuper() == 0L) { + wc.addWc("(A.flgSuper=0 OR A.flgSuper IS NULL)"); + } + if (!CR.getFlgClienteFornitore().isEmpty() || !CR.getRiferimentoAzienda().isEmpty()) { + if (!CR.getRiferimentoAzienda().isEmpty()) + wc.addWc(" C.riferimento = '" + CR.getRiferimentoAzienda() + "'"); + if (!CR.getFlgClienteFornitore().isEmpty()) + wc.addWc(" C.flgClienteFornitore = '" + CR.getFlgClienteFornitore() + "'"); + } + if (CR.getFlgOss() > 0L) + wc.addWc("( C.flgOss =0 or C.flgOss is null or C.flgOss = " + CR.getFlgOss() + ")"); + if (CR.getCreateTmst() != null) + wc.addWc("A.createTmst 0L) { + wc.addWc("A.flgGRS =" + CR.getFlgGRS()); + } + } + + public Vectumerator findCliforByCR(DocumentoCR CR) { + StringBuffer s_Sql_Find = new StringBuffer("select A.id_clifor from DOCUMENTO AS A "); + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + findByCRCreateStmtDate(CR, stmt); + Vectumerator vec = findRows(stmt); + Vectumerator vecRes = new Vectumerator(); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + vecRes.add(row.getClifor()); + } + return vecRes; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByCR(DocumentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Order; + StringBuffer s_Sql_Find = new StringBuffer("select A.* from DOCUMENTO AS A "); + if (CR.getTipoDocumento().getFlgClienteFornitore().equals("F") && ( + CR.getTipoDocumento().getFlgTipologia() == 1L || + CR.getTipoDocumento().getFlgTipologia() == 2L)) { + if (CR.getFlgOrderBy() == 1L) { + s_Sql_Order = " order by A.dataRiferimento asc, A.id_esercizio asc, A.progDocumento asc"; + } else { + s_Sql_Order = " order by A.dataRiferimento desc, A.id_esercizio desc, A.progDocumento desc"; + } + } else if (CR.getFlgOrderBy() == 1L) { + s_Sql_Order = " order by A.dataDocumento asc, A.id_esercizio asc, A.progDocumento asc"; + } else if (CR.getFlgOrderBy() == 9L) { + s_Sql_Order = " order by C.flgUsato desc, A.dataDocumento asc, A.id_esercizio asc, A.progDocumento asc"; + } else if (CR.getFlgOrderBy() == 2L) { + s_Sql_Order = " order by CF.cognome, CF.nome, A.dataDocumento asc, A.id_esercizio asc, A.progDocumento asc"; + } else { + s_Sql_Order = " order by A.dataDocumento desc, A.id_esercizio desc, A.progDocumento desc "; + } + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + findByCRCreateStmtDate(CR, stmt); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByCRCreateStmtDate(DocumentoCR CR, PreparedStatement stmt) { + try { + int dataCount = 0; + if (CR.getDataDocumentoDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoDa()); + } + if (CR.getDataDocumentoA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoA()); + } + if (CR.getDataChiusuraDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataChiusuraDa()); + } + if (CR.getDataChiusuraA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataChiusuraDa()); + } + if (CR.getDataRiferimentoDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataRiferimentoDa()); + } + if (CR.getDataRiferimentoA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataRiferimentoA()); + } + if (CR.getCreateTmst() != null) { + dataCount++; + stmt.setTimestamp(dataCount, CR.getCreateTmst()); + } + } catch (SQLException e) { + handleDebug(e); + } + } + + public static final String getInGaranzia(long l_flgInviaAvviso) { + switch ((int)l_flgInviaAvviso) { + case 0: + return "NO"; + case 1: + return "SI"; + case 2: + return "DOA"; + } + return "No"; + } + + protected boolean isUseSafeUpdate() { + return true; + } + + public long getFlgDocumentoPrelevato() { + return this.flgDocumentoPrelevato; + } + + private Vectumerator findRientri(String l_seriale, int pageNumber, int pageRows) { + DocumentoCR CR = new DocumentoCR(); + CR.setSeriale(l_seriale); + CR.setId_tipoDocumento(getId_docRiparazione()); + CR.setId_documentoNo(getId_documento()); + return findByCR(CR, pageNumber, pageRows); + } + + public boolean isRientro(String l_seriale) { + if (getId_documento() == 0L || l_seriale.trim().isEmpty()) + return false; + Vectumerator vec = findRientri(l_seriale, 1, 1); + if (vec.hasMoreElements()) + return true; + return false; + } + + public Vectumerator findRientri(String l_seriale) { + return findRientri(l_seriale, 0, 0); + } + + public boolean hasRigheDocumentoPrenotazioneArrivate() { + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getFlgPrenotazioneArrivata() == 0L) + return false; + } + return true; + } + + public static String getTrasporto(long l_flgTrasporto) { + switch ((int)l_flgTrasporto) { + case 1: + return "Mittente"; + case 2: + return "Destinatario"; + case 3: + return "Vettore"; + } + return ""; + } + + public long getFlgTipoMovimento() { + long id_p = getTipoDocumento().getCausaleMagazzino().getId_magFisicoPartenza(); + long id_a = getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo(); + if (id_p > 0L && id_a > 0L) + return 3L; + if (id_p > 0L && id_a == 0L) + return 2L; + if (id_p == 0L && id_a > 0L) + return 1L; + return 0L; + } + + public void setFlgTipoMovimento(long flgTipoMovimento) { + this.flgTipoMovimento = flgTipoMovimento; + } + + public ResParm delAllegato(AllegatoDocumento row) { + AllegatoDocumento bean = new AllegatoDocumento(getApFull()); + bean.findByPrimaryKey(row.getId_allegatoDocumento()); + return bean.delete(); + } + + public ResParm addAllegato(AllegatoDocumento row) { + AllegatoDocumento bean = new AllegatoDocumento(getApFull()); + bean.findByDocumentoNomeFile(row.getId_documento(), row.getNomeFile()); + if (bean.getDBState() == 1) + return new ResParm(false, "Nome File Duplicato"); + row.setDBState(0); + ResParm rp = row.save(); + return rp; + } + + public Vectumerator getAllegati(long l_id_tipoAllegatoDocumento) { + return new AllegatoDocumento(getApFull()).findByDocumentoTipo(getId_documento(), l_id_tipoAllegatoDocumento, 0, 0); + } + + public void setNominativoDocumento(String nominativoDocumento) { + this.nominativoDocumento = nominativoDocumento; + } + + public long getId_cliforListino() { + if (getId_documentoFiglio() == 0L) + return this.id_cliforListino; + return getDocumentoFiglio().getId_clifor(); + } + + public void setId_cliforListino(long id_cliforListino) { + this.id_cliforListino = id_cliforListino; + setCliforListino(null); + } + + public Clifor getCliforListino() { + if (getId_documentoFiglio() == 0L) { + this.cliforListino = (Clifor)getSecondaryObject(this.cliforListino, Clifor.class, getId_cliforListino()); + return this.cliforListino; + } + return getDocumentoFiglio().getClifor(); + } + + public void setCliforListino(Clifor cliforListino) { + this.cliforListino = cliforListino; + } + + public void applicaListinoByClifor(Clifor l_clifor) { + synchronized (this) { + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getId_articolo() != 0L) { + row.setSconto(row.getArticolo().getPrezzoArticolo(l_clifor).getPercSconto()); + row.setImponibile(row.getArticolo().getPrezzoArticolo(l_clifor).getPrezzoBase()); + row.setPrezzoPubblicoConIva(row.getArticolo().getPrezzoArticoloIva(l_clifor).getPrezzoFinale()); + addRigaDocumento(this, row); + } + } + } + } + + protected long getDocumentoAnnoIniziale() { + return getTipoDocumento().getContatore().getAnnoIniziale(); + } + + protected long getDocumentoNumeroIniziale() { + return getTipoDocumento().getContatore().getProgIniziale(); + } + + private String trovaProgPrimoBuco(long anno) { + if (getTipoDocumento().getContatore().getFlgControllo() == 0L) + return ""; + try { + String s_SqlFatt = "select * from DOCUMENTO where dataDocumento>=? and dataDocumento<=? and progDocumentoAgg ='' and id_contatore=" + getTipoDocumento().getId_contatore() + " and flgStato ='1' order by progDocumento, dataDocumento"; + PreparedStatement ps = getConn().prepareStatement(s_SqlFatt); + Date firstOfYear = getFirstOfYear((int)anno); + Date lastOfYear = getLastOfYear((int)anno); + ps.setDate(1, firstOfYear); + ps.setDate(2, lastOfYear); + Vectumerator vec = findRows(ps); + long i = 0L; + Date lastDate = firstOfYear; + if (getDocumentoAnnoIniziale() == anno && getDocumentoNumeroIniziale() > 1L) + i = getDocumentoNumeroIniziale() - 1L; + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + if (row.getProgDocumentoAgg().isEmpty()) + i++; + if (row.getProgDocumento() != i) + return row.getNumeroDocumentoCompleto() + " del " + row.getNumeroDocumentoCompleto(); + if (getDateDiff(row.getDataDocumento(), lastDate) > 0L) + return row.getNumeroDocumentoCompleto() + " del " + row.getNumeroDocumentoCompleto(); + lastDate = row.getDataDocumento(); + } + return ""; + } catch (Exception e) { + handleDebug(e, 2); + return "Errore! " + e.getMessage(); + } + } + + public String getDescrizioneAllegato() { + return (this.descrizioneAllegato == null) ? "" : this.descrizioneAllegato; + } + + public void setDescrizioneAllegato(String descrizioneAllegato) { + this.descrizioneAllegato = descrizioneAllegato; + } + + public long getId_ivaDoc() { + return this.id_ivaDoc; + } + + public Iva getIvaDoc() { + this.ivaDoc = (Iva)getSecondaryObject(this.ivaDoc, Iva.class, getId_ivaDoc()); + return this.ivaDoc; + } + + public void setId_ivaDoc(long newId_iva) { + this.id_ivaDoc = newId_iva; + setIvaDoc(null); + } + + public void setIvaDoc(Iva newIva) { + this.ivaDoc = newIva; + } + + public String getInterventoEffettuato() { + return (this.interventoEffettuato == null) ? "" : this.interventoEffettuato.trim(); + } + + public double getImportoConsuntivo() { + return this.importoConsuntivo; + } + + public void setImportoConsuntivo(double importoConsuntivo) { + this.importoConsuntivo = importoConsuntivo; + } + + protected void creaDocumentoFooterFatture(Table l_pdfCorpo, boolean isUltimaPagina) { + double totImponibileMerce, totImponibile, totImposta; + int cellLeading = 8; + NumberFormat nf = getNf(); + RigheRegistroIva rri = getRigaRegistroIvaCompleto(); + String codIva = "", imponibile = "", aliquota = "", imposta = ""; + DoubleOperator totaleFatturaFromRri = new DoubleOperator(); + DoubleOperator totaleIvaFromRri = new DoubleOperator(); + if (rri != null) { + Enumeration enuRrri = rri.elementsFatt(); + while (enuRrri.hasMoreElements()) { + RigaRegistroIvaItem rrii = enuRrri.nextElement(); + if (rrii.getImponibile() != 0.0D) { + if (getFlgArt8() == 1L) { + imponibile = imponibile + "\n" + imponibile; + imposta = imposta + "\n0"; + codIva = codIva + "\n" + codIva; + aliquota = aliquota + "\n" + aliquota; + continue; + } + imponibile = imponibile + "\n" + imponibile; + imposta = imposta + "\n" + imposta; + codIva = codIva + "\n" + codIva; + aliquota = aliquota + "\n" + aliquota; + totaleFatturaFromRri.add(rrii.getImponibile()); + totaleIvaFromRri.add(rrii.getImportoIva()); + } + } + } + long resHasUsato = hasRigheConUsato(); + if (resHasUsato == 1L) { + totImponibileMerce = totaleFatturaFromRri.getResult(); + totImponibile = totaleFatturaFromRri.getResult(); + totImposta = totaleIvaFromRri.getResult(); + } else { + totImponibileMerce = getImponibileRighe(); + totImponibile = getImponibileTotale(); + totImposta = getImportoIvaTotale(); + } + try { + String bancaDesc; + Cell cell = new Cell(new Chunk("ALIQ.", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(codIva, PdfFontFactory.PDF_fPiccolissimoB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setRowspan(3); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPONIBILE", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(imponibile, PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setRowspan(3); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPOSTA\t", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(imposta, PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + cell.setRowspan(3); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SCONTO INC.\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(nf.format(getScontoIncondizionato()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("ABBUONO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getAbbuono() != 0.0D) { + cell.add(new Chunk(nf.format(getAbbuono()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SPESE TRASPORTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getSpeseTrasporto() != 0.0D) { + cell.add(new Chunk(nf.format(getSpeseTrasporto()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE MERCE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && totImponibileMerce != 0.0D) { + cell.add(new Chunk(nf.format(totImponibileMerce), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SPESE INCASSO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getSpeseIncasso() != 0.0D) { + cell.add(new Chunk(nf.format(getSpeseIncasso()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SPESE VARIE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getSpeseAltre() != 0.0D) { + cell.add(new Chunk(nf.format(getSpeseAltre()), PdfFontFactory.PDF_fPiccoloB)); + if (!getDescSpeseAltre().isEmpty()) + cell.add(new Chunk(" " + getDescSpeseAltre(), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(11); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE NETTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && totImponibile != 0.0D) { + cell.add(new Chunk(nf.format(totImponibile), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + String temp = getElencoScadenze2Righe(); + cell = new Cell(new Chunk("SCADENZE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && !temp.isEmpty()) { + cell.add(new Chunk(temp, PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(23); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOT. ESENTE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina); + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOT. IMPONIBILE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(nf.format(totImponibile), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOT. IMPOSTA\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(nf.format(totImposta), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("ACCONTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getAcconto() != 0.0D) { + cell.add(new Chunk(nf.format(getAcconto()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE DOCUMENTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getTotaleDocumento() != 0.0D) { + cell.add(new Chunk("EUR " + nf.format(getTotaleDocumento()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + if (getIban().isEmpty()) { + Banca banca = new Banca(getApFull()); + bancaDesc = banca.getBancheDefaultBonificoDesc(); + } else { + bancaDesc = getBancaDesc() + " " + getBancaDesc(); + } + cell = new Cell(new Chunk("NS BANCA: " + bancaDesc, PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading(10.0F); + cell.setBorder(2); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e, 2); + } + } + + protected void creaDocumentoIntestazioneCorpoFt(Table l_pdfCorpo) { + int cellLeading = 8; + try { + Cell cell = new Cell(); + cell.addElement(new Chunk("DESCRIZIONE", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[0]); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("QUAN.", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[1]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("PREZZO", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[2]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SC.", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[3]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPORTO", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[4]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IVA", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_STD_[5]); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e); + } + } + + public ByteArrayOutputStream creaLabelDocumentoArticoliAccZebraPdf(DocumentoCR CR) { + long pHMarg = 2L; + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + String dim = getParm("LABEL_ART_SIZE").getTesto(); + long xx = Long.parseLong(dim.substring(0, dim.indexOf(','))); + long yy = Long.parseLong(dim.substring(dim.indexOf(',') + 1)); + Rectangle label = new Rectangle(getPdfPointSize(yy), getPdfPointSize(xx)); + this.document = new Document(label.rotate(), 2.0F, 2.0F, 2.0F, 2.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + String titoloReport = getNumeroDocumentoCompleto(); + SimpleDateFormat tf = new SimpleDateFormat("HH:mm:ss"); + Date today = getToday(); + titoloReport = titoloReport + ". Stampato il " + titoloReport + " " + getDataFormat().format(today); + this.document.open(); + long labelNumber = 0L; + int nCol = 4; + int nRow = 10; + float[] widths = { 0.25F, 0.25F, 0.25F, 0.25F }; + this.pdfPcorpo = new PdfPTable(widths); + this.pdfPcorpo.setWidthPercentage(100.0F); + Documento doc = new Documento(getApFull()); + doc.findByPrimaryKey(CR.getId_documentoS()); + if (doc.hasLabelAccessoriDaStampare()) { + Vectumerator vec = findByCR(CR, 0, 0); + long numbOfLabels = 1L; + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vecRighe = row.findRigheDocumento(0, 0, ordineInverso); + while (vecRighe.hasMoreElements()) { + RigaDocumento rowRD = (RigaDocumento)vecRighe.nextElement(); + if (rowRD.getFlgUdm() == 1L) { + numbOfLabels = (long)rowRD.getQuantita(); + } else { + numbOfLabels = 1L; + } + rowRD.getArticolo().setWriter(getWriter()); + rowRD.getArticolo().setPdfPcorpo(getPdfPcorpo()); + rowRD.getArticolo().setDocument(this.document); + String descLabel = rowRD.getDescrizioneRigaCompleta(); + numbOfLabels = (long)rowRD.getArticolo().addLabelUnArticoloAccZebraPdf(numbOfLabels, labelNumber, descLabel); + labelNumber += numbOfLabels; + } + } + long numberBlankCell = (long)nCol - labelNumber % (long)nCol; + PdfPCell cell = new PdfPCell(); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorder(0); + if (numberBlankCell != (long)nCol) + for (int i = 0; (long)i < numberBlankCell; i++) + this.pdfPcorpo.addCell(cell); + } else { + Phrase ph = new Phrase("Attenzione! Non ci sono etichette da stampare!"); + PdfPCell cell = new PdfPCell(ph); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorder(0); + cell.setColspan(nCol); + this.pdfPcorpo.addCell(cell); + } + this.document.add((Element)this.pdfPcorpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public ByteArrayOutputStream creaLabelDocumentoArticoliZebraPdf(DocumentoCR CR) { + long pHMarg = 2L; + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + String dim = getParm("LABEL_ART_SIZE").getTesto(); + long xx = Long.parseLong(dim.substring(0, dim.indexOf(','))); + long yy = Long.parseLong(dim.substring(dim.indexOf(',') + 1)); + Rectangle label = new Rectangle(getPdfPointSize(yy), getPdfPointSize(xx)); + this.document = new Document(label.rotate(), 2.0F, 2.0F, 2.0F, 2.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + this.document.open(); + long labelNumber = 0L; + int nCol = 4; + int nRow = 10; + float[] widths = { 0.25F, 0.25F, 0.25F, 0.25F }; + this.pdfPcorpo = new PdfPTable(widths); + this.pdfPcorpo.setWidthPercentage(100.0F); + Documento doc = new Documento(getApFull()); + doc.findByPrimaryKey(CR.getId_documentoS()); + if (doc.hasLabelDaStampare()) { + if (CR.getBlankLabels() > 0L) { + PdfPCell pdfPCell = new PdfPCell(); + pdfPCell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + pdfPCell.setBorder(0); + for (int i = 0; (long)i < CR.getBlankLabels(); i++) { + labelNumber++; + this.pdfPcorpo.addCell(pdfPCell); + } + } + Vectumerator vec = findByCR(CR, 0, 0); + long numbOfLabels = 1L; + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vecRighe = row.findRigheDocumento(0, 0, ordineInverso); + while (vecRighe.hasMoreElements()) { + RigaDocumento rowRD = (RigaDocumento)vecRighe.nextElement(); + if (rowRD.getFlgUdm() == 1L) { + numbOfLabels = (long)rowRD.getQuantita(); + } else { + numbOfLabels = 1L; + } + rowRD.getArticolo().setWriter(getWriter()); + rowRD.getArticolo().setPdfPcorpo(getPdfPcorpo()); + rowRD.getArticolo().setDocument(this.document); + String descLabel = rowRD.getDescrizioneRigaCompleta(); + numbOfLabels = (long)rowRD.getArticolo().addLabelUnArticoloZebraPdf(numbOfLabels, null); + labelNumber += numbOfLabels; + } + } + long numberBlankCell = (long)nCol - labelNumber % (long)nCol; + PdfPCell cell = new PdfPCell(); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorder(0); + if (numberBlankCell != (long)nCol) + for (int i = 0; (long)i < numberBlankCell; i++) + this.pdfPcorpo.addCell(cell); + } else { + Phrase ph = new Phrase("Attenzione! Non ci sono etichette da stampare!"); + PdfPCell cell = new PdfPCell(ph); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorder(0); + cell.setColspan(nCol); + this.pdfPcorpo.addCell(cell); + } + this.document.add((Element)this.pdfPcorpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public String getDescTransaction() { + return (this.descTransaction == null) ? "" : this.descTransaction; + } + + public void setDescTransaction(String descTransaction) { + this.descTransaction = descTransaction; + } + + public Date getDataTransaction() { + return this.dataTransaction; + } + + public void setDataTransaction(Date dataTransaction) { + this.dataTransaction = dataTransaction; + } + + public long getFlgProcediPagamento() { + return this.flgProcediPagamento; + } + + public void setFlgProcediPagamento(long flgProcediPagamento) { + this.flgProcediPagamento = flgProcediPagamento; + } + + public long getFlgStatoOrdineWww() { + return this.flgStatoOrdineWww; + } + + public void setFlgStatoOrdineWww(long flgStatoOrdineWww) { + this.flgStatoOrdineWww = flgStatoOrdineWww; + } + + public static final String getStatoOrdineWww(long l_flgStato) { + if (l_flgStato == 0L) + return "Confermato"; + if (l_flgStato == 1L) + return "In Lavorazione"; + if (l_flgStato == 2L) + return "Spedito"; + if (l_flgStato == 9L) + return "Chiuso"; + if (l_flgStato == 99L) + return "Annullato"; + if (l_flgStato == 10L) + return "Aperti"; + if (l_flgStato == 11L) + return "Chiusi e Annullati"; + if (l_flgStato == -1L) + return "-- Tutti --"; + return "??"; + } + + public static final String getStatoResoWww(long l_flgStato) { + if (l_flgStato == 1L) + return "Richiesta Reso"; + if (l_flgStato == 2L) + return "Reso accettato"; + if (l_flgStato == 3L) + return "Reso Completato"; + if (l_flgStato == 99L) + return "Reso Respinto"; + if (l_flgStato == 0L) + return "Nessuna Richiesta"; + return "??"; + } + + public long getId_ordine() { + return getId_documento(); + } + + public String getStatoOrdineWww() { + if (getFlgStatoOrdineWww() == 2L && !getTrackingSpedizione().isEmpty()) + return getVettore().getDescrizione() + " " + getVettore().getDescrizione(); + return getStatoOrdineWww(getFlgStatoOrdineWww()); + } + + public long getStatoPagato() { + if (getDataPagamento() != null) + return 2L; + if (getTipoPagamento().getFlgTipoPagamento() == 5L) { + if (getDataTransaction() != null && getDataPagamento() == null) + return 1L; + return 0L; + } + return 0L; + } + + public ResParm sendResoMailMessage() { + ResParm rp = new ResParm(true); + return rp; + } + + public void setId_ordine(long l_id_ordine) { + setId_documento(l_id_ordine); + } + + public String getCapSped() { + return (this.capSped == null) ? "" : this.capSped; + } + + public String getCittaSped() { + return (this.cittaSped == null) ? "" : this.cittaSped; + } + + public void setCapSped(String capSped) { + this.capSped = capSped; + } + + public void setCittaSped(String cittaSped) { + this.cittaSped = cittaSped; + } + + public String getProvinciaSped() { + return (this.provinciaSped == null) ? "" : this.provinciaSped.trim(); + } + + public void setProvinciaSped(String provinciaSped) { + this.provinciaSped = provinciaSped; + } + + private static final synchronized ResParm addRigaDocumentoMagArticolo(DocumentoInterface doc, RigaDocumento rd) { + ResParm rp = doc.checkEMSTA(); + if (!rp.getStatus()) + return new ResParm(false, "ATTENZIONE! Tentativo di aggiungere una riga documento: " + rp.getMsg()); + rd.setId_documento(doc.getId_documento()); + double l_qtaDb = 0.0D; + long l_statoDb = 0L; + long l_statoOrdineWwwDb = -99L; + if (rd.getId_rigaDocumento() > 0L) { + RigaDocumento rdB = new RigaDocumento(doc.getApFull()); + rdB.findByPrimaryKey(rd.getId_rigaDocumento()); + if (rdB.getId_articolo() == rd.getId_articolo()) { + l_qtaDb = rdB.getNr(); + l_statoDb = rdB.getDocumento().getFlgStato(); + l_statoOrdineWwwDb = rdB.getDocumento().getFlgStatoOrdineWww(); + } else { + l_qtaDb = 0.0D; + DoubleOperator dop = new DoubleOperator(rdB.getNr()); + dop.multiply(-doc.getTipoDocumento().getFlgMovMagazzino()); + dop.add(rdB.getArticolo().getQuantita()); + rdB.getArticolo().setQuantita(dop.getResult()); + rp = rdB.getArticolo().superSave(); + } + } + if (rp.getStatus()) + rp = rd.save(); + if (rp.getStatus()) + if (rd.getArticolo().usaMagazzino() && doc.getTipoDocumento().getFlgMovMagazzino() != 0L) + if (doc.getFlgStato() == 1L && doc.getFlgStatoOrdineWww() != 99L) { + DoubleOperator dop = new DoubleOperator(rd.getNr()); + dop.subtract(l_qtaDb); + dop.multiply(doc.getTipoDocumento().getFlgMovMagazzino()); + dop.add(rd.getArticolo().getQuantita()); + rd.getArticolo().setQuantita(dop.getResult()); + if (rd.getArticolo().getQuantita() <= 0.0D && ( + rd.getArticolo().getFlgUsato() > 0L || + rd.getArticolo().getFlgStockOfferte() == 2L || + rd.getArticolo().getFlgStockOfferte() == 3L || + rd.getArticolo().getFlgEbay() == 1L)) + rd.getArticolo().setFlgEscludiWebArt(1L); + rd.getArticolo().handleQuantitaDebugBeforeSave("documento.addRigaDocumentoMagArticolo"); + rp.append(rd.getArticolo().superSave()); + } + rp.append(doc.save()); + if (rp.getStatus()) + rp.setMsg("Riga aggiunta correttamente"); + return rp; + } + + public static final synchronized ResParm addRigaDocumento(DocumentoInterface doc, RigaDocumento row) { + ResParm rp = doc.checkEMSTA(); + if (!rp.getStatus()) + return new ResParm(false, "ATTENZIONE! Tentativo di aggiungere una riga documento: " + rp.getMsg()); + if (doc.getParm("USA_MAGAZZINO").isTrue()) + return addRigaDocumentoMagArticolo(doc, row); + RigaDocumento RD = new RigaDocumento(doc.getApFull()); + double l_quantitaDisponibileMagPartenza = 0.0D; + double l_quantitaDisponibileTuttiMagazziniInterniEsterni = 0.0D; + double l_quantitaDisponibileMagazziniInterni = 0.0D; + long l_id_magFisicoPartenza = row.getDocumento().getId_magFisicoPartenza(); + long l_id_magFisicoArrivo = row.getDocumento().getId_magFisicoArrivo(); + rp = new ResParm(true); + RigaDocumento rowOnDb = new RigaDocumento(doc.getApFull()); + rowOnDb.findByPrimaryKey(row.getId_rigaDocumento()); + if (!row.getSeriale().trim().isEmpty() && row.getArticolo().getFlgSerialiMassivi() == 0L) { + row.setQuantita(1.0D); + row.setQuantitaUdm(1.0D); + } + if (rowOnDb.getDBState() == 1 && (rowOnDb.getId_articolo() != row.getId_articolo() || + rowOnDb.getId_articoloVariante() != row.getId_articoloVariante() || !rowOnDb.getSeriale().equals(row.getSeriale()))) { + rp = rowOnDb.delete(); + if (!rp.getStatus()) + return rp; + row.setId_rigaDocumento(0L); + row.setDBState(0); + } + if (row.getId_articolo() != 0L && l_id_magFisicoPartenza > 0L) { + RD.findMagDisponibilitaPuntuale(row.getId_articolo(), row.getId_articoloVariante(), row.getId_articoloTaglia(), + row.getSeriale(), l_id_magFisicoPartenza, 0L, 0L); + l_quantitaDisponibileMagPartenza = RD.getQuantita(); + if (rowOnDb.getDBState() == 1) + l_quantitaDisponibileMagPartenza += rowOnDb.getQuantita(); + if (row.getArticolo().getTipo().getFlgTipoMagazzino() > 0L && + row.getArticolo().getTipo().getFlgTipoMagazzino() < 9L && row.getId_articolo() != 0L && l_id_magFisicoPartenza != 0L && + + row.getFlgReso() == 0L && l_quantitaDisponibileMagPartenza < row.getQuantita()) { + rp.setStatus(false); + rp.setMsg("Attenzione. Tentativo di utilizzare un articolo non disponibile"); + return rp; + } + } + if (row.getId_articolo() != 0L && l_id_magFisicoPartenza > 0L && + row.getDocumento().getMagFisicoPartenza().getFlgTipo() == 1L && + row.getArticolo().getTipo().getFlgTipoMagazzino() > 0L && + row.getArticolo().getTipo().getFlgTipoMagazzino() < 9L && row.getId_articolo() != 0L && + rowOnDb.getDBState() == 0 && row.getFlgReso() == 0L && row.getFlgIgnoraPrenotazione() == 0L) { + double totArticoliEffettivi = 0.0D; + if (row.getSeriale().isEmpty()) { + RD.findMagDisponibilitaPuntualeMagazziniInterni(row.getId_articolo(), row.getId_articoloVariante(), + row.getId_articoloTaglia(), null, 0L); + l_quantitaDisponibileMagazziniInterni = RD.getQuantita(); + totArticoliEffettivi = l_quantitaDisponibileMagazziniInterni - row.getTotArticoliImpegnati(row.getId_articolo(), row.getId_articoloVariante(), row.getId_articoloTaglia()); + } else { + RigaDocumento rd = new RigaDocumento(row.getApFull()); + rd.findRigaImpegnoBySeriale(row.getId_articolo(), row.getId_articoloVariante(), row.getSeriale()); + if (rd.getDBState() == 1) { + if (row.getFlgIgnoraPrenotazione() == 1L) { + rd.setSeriale(""); + rd.save(); + totArticoliEffettivi = 1.0D; + } else { + totArticoliEffettivi = 0.0D; + } + } else { + RD.findMagDisponibilitaPuntualeMagazziniInterni(row.getId_articolo(), row.getId_articoloVariante(), + row.getId_articoloTaglia(), null, 0L); + l_quantitaDisponibileMagazziniInterni = RD.getQuantita(); + totArticoliEffettivi = l_quantitaDisponibileMagazziniInterni - row.getTotArticoliImpegnati(row.getId_articolo(), row.getId_articoloVariante(), row.getId_articoloTaglia()); + } + if (totArticoliEffettivi <= 0.0D) { + rp.setStatus(false); + rp.setMsg("Attenzione. L'articolo è in magazzino ma non disponibile perchè risulta impegnato. "); + return rp; + } + } + } + if (l_id_magFisicoArrivo > 0L && ( + row.getDocumento().getMagFisicoArrivo().getFlgTipo() == 1L || + row.getDocumento().getMagFisicoArrivo().getFlgTipo() == 2L) && + !row.getSeriale().trim().isEmpty() && row.getArticolo().getTipo().getFlgTipoMagazzino() == 2L && + rowOnDb.getDBState() == 0) { + if (RD.getParm("SERIALI_UNIVOCI").isTrue()) { + RD.findMagDisponibilitaGlobaleMagazziniInterniEsterni(row.getId_articolo(), row.getSeriale(), 0L); + } else { + RD.findMagDisponibilitaPuntualeMagazziniInterniEsterni(row.getId_articolo(), row.getId_articoloVariante(), + row.getId_articoloTaglia(), row.getSeriale(), 0L); + } + l_quantitaDisponibileTuttiMagazziniInterniEsterni = RD.getQuantita(); + if (l_quantitaDisponibileTuttiMagazziniInterniEsterni >= 1.0D) { + rp.setStatus(false); + rp.setMsg("Attenzione. Stai inserendo un seriale già caricato in magazzino."); + return rp; + } + } + long l_numSeriali = 1L; + if (doc.getTipoDocumento().getFlgTipologia() != 3L && + row.getArticolo().getFlgSerialiMassivi() == 1L && row.getQuantita() > 1.0D) { + l_numSeriali = (long)row.getQuantita(); + row.setQuantita(1.0D); + row.setQuantitaUdm(1.0D); + } + for (int i = 0; (long)i < l_numSeriali; i++) { + RigaDocumento bean = new RigaDocumento(doc.getApFull()); + if (row.getId_rigaDocumento() != 0L) { + bean.findByPrimaryKey(row.getId_rigaDocumento()); + } else if (row.getId_articolo() != 0L && row.getFlgSingleLineArt() == 1L && ( + doc.getTipoDocumento().getFlgTipologia() == 3L || + doc.getTipoDocumento().getFlgTipologia() == 4L || + row.getArticolo().getTipo().getFlgTipoMagazzino() != 2L)) { + if (row.getId_articoloTaglia() != 0L) { + bean.findFirstByDocumentoArticoloTaglia(row.getId_documento(), row.getId_articoloTaglia()); + } else if (row.getId_articoloVariante() != 0L) { + bean.findFirstByDocumentoArticoloVariante(row.getId_documento(), row.getId_articoloVariante()); + } else if (row.getId_articolo() != 0L) { + bean.findFirstByDocumentoArticolo(row.getId_documento(), row.getId_articolo()); + } + row.setId_rigaDocumento(bean.getId_rigaDocumento()); + row.addQuantita(bean.getQuantita()); + } + row.setDBState(bean.getDBState()); + row.setQuantitaOld(bean.getQuantitaOld()); + row.setId_documento(doc.getId_documento()); + rp.append(row.save()); + if (!rp.getStatus()) + return rp; + if (l_numSeriali > 1L) + try { + long currentSeriale = Long.valueOf(row.getSeriale()); + currentSeriale++; + String newSeriale = zeroLeft(currentSeriale, row.getSeriale().length()); + row.setSeriale(newSeriale); + row.setId_rigaDocumento(0L); + row.setDBState(0); + } catch (Exception e) { + rp.setStatus(false); + rp.setMsg("Errore! seriale non numerico per carico massivo: " + row.getSeriale()); + return rp; + } + } + if (rp.getStatus()) + rp.setMsg(AbMessages.getMessage("SAVE_OK")); + return rp; + } + + public static final synchronized ResParm riordinaRigheDocPerRiferimentoOld(DocumentoInterface doc) { + ResParm rp = new ResParm(true); + String TAG_THREAD_MSG = "RIORDINO RIGHE"; + Vectumerator vecRD = doc.findRigheDocumentoOBRiferimento(0, 0); + StatusMsg.updateMsgByTag(doc.getApFull(), "RIORDINO RIGHE", "...inizio ..."); + int i = 0; + int totRighe = vecRD.getTotNumberOfRecords(); + while (vecRD.hasMoreElements() && rp.getStatus()) { + i++; + RigaDocumento row = (RigaDocumento)vecRD.nextElement(); + StatusMsg.updateMsgByTag(doc.getApFull(), "RIORDINO RIGHE", "riga " + i + " su " + totRighe); + try { + RigaDocumento rowNew = (RigaDocumento)row.clone(); + rowNew.setId_rigaDocumento(0L); + rowNew.setDBState(0); + rp = rowNew.save(); + if (rp.getStatus()) + rp = row.delete(); + } catch (CloneNotSupportedException e) { + e.printStackTrace(); + } + } + if (rp.getStatus()) + rp.setMsg("Riordino righe per riferimento completato"); + StatusMsg.deleteMsgByTag(doc.getApFull(), "RIORDINO RIGHE"); + return rp; + } + + public static final synchronized Vectumerator findTessutiPerTaglio(Documento bean) { + ResParm rp = new ResParm(true); + boolean debug = false; + String debugIngo = "findTessutiPerTaglio"; + HashMap hmTess = new HashMap<>(); + Vectumerator vec = bean.findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getId_articoloVariante() > 0L) { + Vectumerator vecAAT = row.getArticoloVariante().findArticoliTessuto(); + while (vecAAT.hasMoreElements()) { + DoubleOperator dop; + ArticoloTessutoColore atc; + ArticoloArticoloTessuto rowAAT = (ArticoloArticoloTessuto)vecAAT.nextElement(); + logDebug(debug, "" + rowAAT.getId_articoloTessuto() + " " + rowAAT.getId_articoloTessuto() + " " + rowAAT.getId_articoloTessutoColore() + " " + + + rowAAT.getArticoloTessutoColore().getDescrizioneCompleta()); + if (hmTess.containsKey(Long.valueOf(rowAAT.getId_articoloTessutoColore()))) { + atc = hmTess.get(Long.valueOf(rowAAT.getId_articoloTessutoColore())); + dop = new DoubleOperator(atc.getMtLavorazioneTaglio()); + } else { + atc = rowAAT.getArticoloTessutoColore(); + dop = new DoubleOperator(); + } + DoubleOperator dopRow = new DoubleOperator(rowAAT.getMtATT()); + NumeroTeliRiga ntr = row.getNumeroTeliRigaByTessuto(row.getId_rigaDocumento()); + System.out.println("findTessutiPerTaglio num teli riga: " + ntr.getNumTeliRiga() + " capi per telo: " + + row.getCapiPerTelo() + " quantita': " + row.getQuantita()); + dopRow.multiply(row.getQuantita()); + dop.add(dopRow.getResult()); + atc.setMtLavorazioneTaglio(dop.getResult()); + hmTess.put(Long.valueOf(rowAAT.getId_articoloTessutoColore()), atc); + } + continue; + } + if (row.getId_articolo() > 0L) { + Vectumerator vecAAT = row.getArticolo().findArticoliTessuto(); + while (vecAAT.hasMoreElements()) { + DoubleOperator dop; + ArticoloTessutoColore atc; + ArticoloArticoloTessuto rowAAT = (ArticoloArticoloTessuto)vecAAT.nextElement(); + if (hmTess.containsKey(Long.valueOf(rowAAT.getId_articoloTessutoColore()))) { + atc = hmTess.get(Long.valueOf(rowAAT.getId_articoloTessutoColore())); + dop = new DoubleOperator(atc.getMtLavorazioneTaglio()); + } else { + atc = rowAAT.getArticoloTessutoColore(); + dop = new DoubleOperator(); + } + DoubleOperator dopRow = new DoubleOperator(rowAAT.getMtATT()); + dopRow.multiply(row.getQuantita()); + dop.add(dopRow.getResult()); + atc.setMtLavorazioneTaglio(dop.getResult()); + hmTess.put(Long.valueOf(rowAAT.getId_articoloTessutoColore()), atc); + } + } + } + Vectumerator vecRes = new Vectumerator(); + Set keySet = hmTess.keySet(); + for (Long key : keySet) { + ArticoloTessutoColore atc = hmTess.get(key); + vecRes.add(atc); + logDebug(debug, "art tess:" + atc.getId_articoloTessuto() + " art tess col: " + atc.getId_articoloTessutoColore() + " mt" + + atc.getMtLavorazioneTaglio()); + } + return vecRes; + } + + public static final synchronized Vectumerator findTessutiBasePerTaglio(Documento bean) { + ResParm rp = new ResParm(true); + boolean debug = false; + String debugIngo = "findTessutiBasePerTaglio"; + Vectumerator vecRes = new Vectumerator(); + Vectumerator vec = bean.getArticolo().findArticoliTessuto(); + HashMap hmTess = new HashMap<>(); + while (vec.hasMoreElements()) { + ArticoloArticoloTessuto rowAAT = (ArticoloArticoloTessuto)vec.nextElement(); + if (rowAAT.getId_articoloTessutoColore() == 0L) { + System.out.println(rowAAT.getId_articoloTessuto()); + if (hmTess.containsKey(Long.valueOf(rowAAT.getId_articoloTessuto()))) { + at = hmTess.get(Long.valueOf(rowAAT.getId_articoloTessuto())); + continue; + } + ArticoloTessuto at = rowAAT.getArticoloTessuto(); + hmTess.put(Long.valueOf(rowAAT.getId_articoloTessuto()), at); + } + } + Vectumerator vecRD = bean.findRigheDocumento(1L, 0, 0, 0); + while (vecRD.hasMoreElements()) { + RigaDocumento rowRD = (RigaDocumento)vecRD.nextElement(); + System.out.println(rowRD.getId_articoloTessuto()); + if (hmTess.containsKey(Long.valueOf(rowRD.getId_articoloTessuto()))) { + ArticoloTessuto at = hmTess.get(Long.valueOf(rowRD.getId_articoloTessuto())); + DoubleOperator dop = new DoubleOperator(at.getMtLavorazioneTaglio()); + dop.add(rowRD.getMt()); + at.setMtLavorazioneTaglio(dop.getResult()); + hmTess.put(Long.valueOf(rowRD.getId_articoloTessuto()), at); + } + } + Set keySet = hmTess.keySet(); + for (Long key : keySet) + vecRes.add(hmTess.get(key)); + return vecRes; + } + + private String getNuovoProgressivoDocumentoXpay() { + return String.valueOf(Calendar.getInstance().getTimeInMillis() + (long)(Math.random() * 1000.0D)); + } + + public String getId_documentoXpay() { + if (this.id_documentoXpay != null && this.id_documentoXpay.isEmpty()) + return null; + return this.id_documentoXpay; + } + + public String getId_documentoCript() { + return crypt(String.valueOf(getId_documento())); + } + + public void setId_documentoXpay(String id_ordineIG) { + this.id_documentoXpay = id_ordineIG; + } + + public ResParm agiornaNuovoId_documentoXpay() { + ResParm rp = new ResParm(); + if (getDBState() == 1) { + setId_documentoXpay(getNuovoProgressivoDocumentoXpay()); + rp = super.save(); + } else { + rp.setStatus(false); + rp.setMsg("agiornaNuovoId_documentoXpay: Documento nullo"); + } + return rp; + } + + public void findByDocumentoXpay(String l_id_documentoXpay) { + String s_Sql_Find = "select A.* from DOCUMENTO as A where id_documentoXpay='" + l_id_documentoXpay + "'"; + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 2); + } + } + + public ResParm sendOrderMailMessage(String lang, boolean mailAdmin, boolean mailUser, boolean isPagamentoVariato) { + ResParm rp = new ResParm(true); + if (getId_documento() == 0L) { + rp.setStatus(false); + rp.setMsg("ERRORE! Codice Documento nullo! contattare l'amministratore del sito"); + handleDebug(rp.getMsg(), 0); + return rp; + } + try { + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + String subject = getMailSubject(); + NumberFormat nf = getNf(); + String notePagamento = "", statoPagamento = "", notaStato = ""; + String orderLine = ""; + String orderLine2 = ""; + DoubleOperator totaleCosto = new DoubleOperator(); + double totaleQta = 0.0D; + statoPagamento = "Metodo di pagamento scelto: " + getTipoPagamento().getDescrizione(); + if (getStatoPagato() == 1L) + statoPagamento = statoPagamento + "
Transazione n. " + statoPagamento + " del " + getDescTransaction(); + if (getStatoPagato() == 2L) + statoPagamento = statoPagamento + "
Data Pagamento: " + statoPagamento; + if (getStatoPagato() == 0L) { + if (getFlgProcediPagamento() == 1L) { + notePagamento = getTipoPagamento().getMsgMailProcedi(lang); + if (getTipoPagamento().getFlgTipoPagamento() == 5L) + notePagamento = notePagamento + "
Clicca qui"; + } else { + notePagamento = getTipoPagamento().getMsgMailAspetta(lang); + } + } else { + notePagamento = ""; + } + if (getFlgStatoOrdineWww() == 2L) + notaStato = getParm("MSG_ORDINE_SPEDITO").getTesto(); + if (mailUser || isPagamentoVariato) { + MailMessage mf = new MailMessage(getApFull(), getCheckOutMailMessage(lang)); + mf.setQuestionMark(false); + mf.setString("id_ordine", String.valueOf(getId_ordine())); + mf.setString("stato", getStato()); + mf.setString("dataOrdine", getDataFormat().format(getDataDocumento())); + mf.setString("statoPagamento", statoPagamento); + mf.setString("notaPagamento", notePagamento); + mf.setLong("id_users", getClifor().getId_clifor()); + mf.setString("nominativo", getClifor().getCognome()); + mf.setString("nome", getClifor().getNome()); + mf.setString("cognome", getClifor().getCognome()); + mf.setString("indirizzo", getClifor().getIndirizzo()); + mf.setString("numero", getClifor().getNumeroCivico()); + String capComune = getClifor().getCapComune(); + if (!getClifor().getCapZona().isEmpty()) + capComune = getClifor().getCapZona(); + mf.setString("cap", capComune); + mf.setString("citta", getClifor().getDescrizioneComune()); + mf.setString("nazione", getClifor().getNazione().getDescrizione(lang)); + mf.setString("provincia", getClifor().getProvinciaComune()); + mf.setString("codfisc", getClifor().getCodFisc()); + mf.setString("piva", getClifor().getPIva()); + mf.setString("email", getClifor().getEMail()); + if (getIndirizzoSped().trim().equals("")) { + if (getPresso().isEmpty()) { + mf.setString("indirizzoSped", getClifor().getIndirizzo()); + } else { + mf.setString("indirizzoSped", getClifor().getIndirizzo() + " c/o " + getClifor().getIndirizzo()); + } + mf.setString("numeroSped", getClifor().getNumeroCivico()); + mf.setString("capSped", getClifor().getCapComune()); + mf.setString("cittaSped", getClifor().getDescrizioneComune()); + mf.setString("provinciaSped", getClifor().getProvinciaComune()); + mf.setString("nazioneSped", getClifor().getNazione().getDescrizione(lang)); + } else { + if (getPresso().isEmpty()) { + mf.setString("indirizzoSped", getIndirizzoSped()); + } else { + mf.setString("indirizzoSped", getIndirizzoSped() + " c/o " + getIndirizzoSped()); + } + mf.setString("numeroSped", getNumeroCivicoSped()); + mf.setString("capSped", getCapSped()); + mf.setString("cittaSped", getCittaSped()); + mf.setString("provinciaSped", getProvinciaSped()); + mf.setString("nazioneSped", getNazioneSped().getDescrizione(lang)); + } + Vectumerator enu = findRigheDocumento(0, 0, ordineInverso); + while (enu.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)enu.nextElement(); + orderLine = orderLine + " " + orderLine + " " + row.getDescrizioneRigaCompleta() + " " + nf.format(row.getImponibile()) + " " + nf.format(row.getSconto()) + " " + row.getQuantita() + "\n"; + totaleQta += row.getQuantita(); + } + mf.setString("orderline", orderLine); + if (getTotaleScontiAbbuoniConIva() > 0.0D) { + mf.setString("descSconto", "**** " + translate("SCONTO INCONDIZIONATO", lang) + " *****"); + mf.setString("scontoInc", " - " + nf.format(getTotaleScontiAbbuoniConIva())); + } + mf.setString("qta", nf.format(totaleQta)); + mf.setString("totale", nf.format(getImponibileTotale())); + mf.setString("totaleOrdine", nf.format(getTotaleDocumento())); + mf.setString("iva", nf.format(getImportoIvaTotale())); + mf.setString("speseSped", nf.format(getSpeseTrasporto())); + mf.setString("nota", String.valueOf(getNote())); + mf.setString("notaStato", notaStato); + mf.setString("codiceOrdine", String.valueOf(getId_ordine())); + mf.setString("telefono", getClifor().getCellulare()); + String theSubject = subject; + if (mailUser) + rp = mf.sendMailMessageSystem(getClifor().getEMail(), theSubject + " - Ordine n. " + theSubject, + true); + if (isPagamentoVariato) { + theSubject = theSubject + " - Ordine n. " + theSubject + " - " + String.valueOf(getId_ordine()) + " - "; + theSubject = theSubject + "PAGAMENTO VARIATO "; + theSubject = theSubject + theSubject; + rp.append(mf.sendMailMessageSystem(getMailTo(), theSubject, false)); + } + } + if (mailAdmin) { + String mmfAdmMessage = getCheckOutMailMessage(lang); + MailMessage mfAdm = new MailMessage(getApFull(), mmfAdmMessage); + mfAdm.setQuestionMark(false); + mfAdm.setString("id_ordine", String.valueOf(getId_ordine())); + mfAdm.setString("stato", getStato()); + mfAdm.setString("dataOrdine", getDataFormat().format(getDataDocumento())); + mfAdm.setString("statoPagamento", statoPagamento); + mfAdm.setString("notaPagamento", notePagamento); + mfAdm.setLong("id_users", getClifor().getId_clifor()); + mfAdm.setString("nominativo", getClifor().getCognome()); + mfAdm.setString("nome", getClifor().getNome()); + mfAdm.setString("cognome", getClifor().getCognome()); + mfAdm.setString("indirizzo", getClifor().getIndirizzo()); + mfAdm.setString("numero", getClifor().getNumeroCivico()); + mfAdm.setString("cap", getClifor().getCapComune()); + mfAdm.setString("citta", getClifor().getDescrizioneComune()); + mfAdm.setString("provincia", getClifor().getProvinciaComune()); + mfAdm.setString("codfisc", getClifor().getCodFisc()); + mfAdm.setString("piva", getClifor().getPIva()); + mfAdm.setString("email", getClifor().getEMail()); + if (getIndirizzoSped().trim().equals("")) { + if (getPresso().isEmpty()) { + mfAdm.setString("indirizzoSped", getClifor().getIndirizzo()); + } else { + mfAdm.setString("indirizzoSped", getClifor().getIndirizzo() + " c/o " + getClifor().getIndirizzo()); + } + mfAdm.setString("numeroSped", getClifor().getNumeroCivico()); + mfAdm.setString("capSped", getClifor().getCapComune()); + mfAdm.setString("cittaSped", getClifor().getDescrizioneComune()); + mfAdm.setString("provinciaSped", getClifor().getProvinciaComune()); + } else { + if (getPresso().isEmpty()) { + mfAdm.setString("indirizzoSped", getIndirizzoSped()); + } else { + mfAdm.setString("indirizzoSped", getIndirizzoSped() + " c/o " + getIndirizzoSped()); + } + mfAdm.setString("numeroSped", getNumeroCivicoSped()); + mfAdm.setString("capSped", getCapSped()); + mfAdm.setString("cittaSped", getCittaSped()); + mfAdm.setString("provinciaSped", getProvinciaSped()); + } + orderLine2 = ""; + totaleCosto = new DoubleOperator(); + totaleQta = 0.0D; + String stileRicarico = ""; + Vectumerator enu = findRigheDocumento(0, 0, ordineInverso); + while (enu.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)enu.nextElement(); + orderLine2 = orderLine2 + " " + orderLine2 + " " + row.getDescrizioneRigaCompleta() + " " + nf.format(row.getImponibile()) + " " + nf.format(row.getSconto()) + " " + row.getQuantita() + "\n"; + DoubleOperator totaleArticolo = new DoubleOperator(row.getImponibile()); + totaleArticolo.multiply(row.getQuantita()); + totaleCosto.add(totaleArticolo); + totaleQta += row.getQuantita(); + } + mfAdm.setString("orderline", orderLine2); + mfAdm.setString("qta", nf.format(totaleQta)); + mfAdm.setString("iva", nf.format(getImportoIvaTotale())); + mfAdm.setString("speseSped", nf.format(getSpeseTrasporto())); + mfAdm.setString("totale", nf.format(getImponibileTotale())); + mfAdm.setString("totaleOrdine", nf.format(getTotaleDocumento())); + mfAdm.setString("nota", String.valueOf(getNote())); + mfAdm.setString("notaAmm", "Nota su cliente:" + + String.valueOf(getClifor().getNota() + "\nNota su Ordine: " + getClifor().getNota() + "\nNota Mail: " + getNotaAggiuntiva())); + mfAdm.setString("codiceOrdine", String.valueOf(getId_ordine())); + mfAdm.setString("telefono", getClifor().getCellulare()); + mfAdm.setString("orderline", orderLine2); + mfAdm.setString("notaStato", notaStato); + String sbjAdmin = subject + " - Adm Ordine n. " + subject + " - " + String.valueOf(getId_ordine()) + " - "; + if (isPagamentoVariato) + sbjAdmin = sbjAdmin + "PAGAMENTO VARIATO "; + sbjAdmin = sbjAdmin + sbjAdmin; + String to = getMailTo(); + rp.append(mfAdm.sendMailMessageSystem(to, sbjAdmin, true)); + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e); + System.out.println("ERRORE INVIO EMAIL:"); + e.printStackTrace(); + } + if (!rp.getStatus()) { + handleDebug(rp.getMsg(), 2); + System.out.println("ERRORE INVIO EMAIL:" + rp.getMsg()); + } + return rp; + } + + public String getCheckOutMailMessage(String lang) { + if (lang != null && lang.isEmpty()) + lang = "it"; + String temp = getDocBase() + getDocBase(); + if (lang != null && !lang.isEmpty()) { + int dot = temp.lastIndexOf("."); + if (dot > 0) + temp = temp.substring(0, dot) + "_" + temp.substring(0, dot) + lang.toLowerCase(); + } + return temp; + } + + public String getId_ordineCript() { + return crypt(String.valueOf(getId_ordine())); + } + + public ResParm stampaScontrinoEpson(boolean isFiscale, RegCassa l_regCassa) { + EpsonCash ep; + ResParm rp = new ResParm(true); + boolean footerFirma = false; + BarcodeCash bc = null; + NumberFormat nf = NumberFormat.getInstance(); + nf.setMaximumFractionDigits(2); + nf.setMinimumFractionDigits(2); + if (isFiscale) { + ep = new EpsonCash(1L, 1, l_regCassa.getIpCassa()); + } else { + ep = new EpsonCash(1L, 2, l_regCassa.getIpCassa()); + } + Vectumerator vec = new RigaDocumento(getApFull()).findByDocumento(0L, getId_documento(), "", 0, 0, 0); + while (vec.hasMoreElements()) { + String descrizioneAggiuntiva; + RigaDocumento row = (RigaDocumento)vec.nextElement(); + String reparto = "" + row.getReparto().getSiglaEpson() + row.getReparto().getSiglaEpson(); + StringBuffer temp = new StringBuffer(); + if (row.isDescScontrinoFull()) { + temp.append(" "); + if (row.getId_articoloVariante() != 0L) { + temp.append(row.getArticoloVariante().getDescrizioneCompleta()); + } else { + temp.append(row.getArticolo().getDescrizioneCompleta()); + } + if (!row.getSeriale().isEmpty()) { + temp.append(" "); + temp.append(row.getSeriale()); + } + } + temp.append(" "); + temp.append(row.getDescrizioneRiga()); + String desc = temp.toString().trim(); + desc = desc.replaceAll("€", "euro"); + if (row.getImportoConSconto() < 0.0D) { + if (row.getFlgReso() == 1L || row.getArticolo().getFlgNegativo() == 1L) { + ep.addRefund(desc, row.getQuantita(), row.getImportoConSconto(), false, row.getReparto().getSiglaEpson(), 4L); + continue; + } + ep.addDiscoutUplift(desc, row.getImportoConSconto(), false, row.getReparto().getSiglaEpson(), 3L); + continue; + } + String notaRigaDocumento = row.getNotaRigaDocumento() + " "; + if (getCodiceIvaVendStd() != row.getIva().getId_iva()) { + if (isFiscale) { + descrizioneAggiuntiva = DBAdapter.spaceRight(row.getIva().getDescrizione(), 37) + DBAdapter.spaceRight(row.getIva().getDescrizione(), 37); + if (!row.getSeriale().isEmpty()) + descrizioneAggiuntiva = descrizioneAggiuntiva + descrizioneAggiuntiva; + } else if (row.getSconto() > 0.0D) { + descrizioneAggiuntiva = DBAdapter.spaceRight("SCONT0 APPLICATO " + + String.valueOf(nf.format(row.getSconto())) + "%", 37) + DBAdapter.spaceRight("SCONT0 APPLICATO " + String.valueOf(nf.format(row.getSconto())) + "%", 37); + if (!row.getSeriale().isEmpty()) + descrizioneAggiuntiva = descrizioneAggiuntiva + descrizioneAggiuntiva; + } else { + descrizioneAggiuntiva = notaRigaDocumento; + if (!row.getSeriale().isEmpty()) + descrizioneAggiuntiva = descrizioneAggiuntiva + descrizioneAggiuntiva; + } + } else { + descrizioneAggiuntiva = notaRigaDocumento; + if (!row.getSeriale().isEmpty()) + descrizioneAggiuntiva = descrizioneAggiuntiva + descrizioneAggiuntiva; + } + if (isFiscale) { + if (row.getSconto() > 0.0D) { + ep.addArticle(desc, row.getQuantita(), row.getImporto(), false, row.getReparto().getSiglaEpson(), descrizioneAggiuntiva); + ep.addDiscoutUplift("SCONT0 " + row.getSconto() + "%", row.getImportoSconto(), false, + row.getReparto().getSiglaEpson(), 3L); + continue; + } + ep.addArticle(desc, row.getQuantita(), row.getImportoConSconto(), false, row.getReparto().getSiglaEpson(), descrizioneAggiuntiva); + continue; + } + bc = null; + if (row.getArticolo().getTipo().getFlgStampaBarcode() == 1L && !row.getNotaBarcode().isEmpty()) { + footerFirma = true; + bc = new BarcodeCash(); + bc.setPosizione(10L); + bc.setLarghezza(2L); + bc.setAltezza(66L); + bc.setPosizioneTesto(BarcodeCash.POSIZIONE_TESTO_SOTTO); + bc.setFontTesto(BarcodeCash.FONT_C); + bc.setTipoBarcode(BarcodeCash.BARCODE_CODE39); + bc.setCode(row.getNotaBarcode()); + } + System.out.println(desc + "\n" + desc); + ep.addArticle(desc, row.getQuantita(), row.getImportoConSconto(), false, row.getReparto().getSiglaEpson(), descrizioneAggiuntiva, bc); + } + DoubleOperator importoPagatoD = new DoubleOperator(getContanti()); + importoPagatoD.add(getAcconto()); + double importoPagato = importoPagatoD.getResult(); + if (importoPagato < getTotaleDocumento()) + importoPagato = getTotaleDocumento(); + ep.addTotal(getTipoPagamento().getDescrizione(), importoPagato, Long.valueOf(getTipoPagamento().getCodiceCassaEpson()).longValue()); + String leNote = ""; + if (getAcconto() > 0.0D) + leNote = "ACCONTO EURO " + String.valueOf(nf.format(getAcconto())).replace(".", ","); + if (!getCliforListino().getCodiceCartaFidelity().isEmpty()) + leNote = leNote + "Fidelity Card: " + leNote + " " + getCliforListino().getCodiceCartaFidelity() + " LISTINO " + getCliforListino().getDescrizioneCompleta(); + if (!getNote().isEmpty()) + leNote = (leNote + " " + leNote).trim(); + if (leNote.length() > 0) + ep.addMessageFooter(leNote); + if (footerFirma) { + ep.addMessageFooter(" "); + ep.addMessageFooter(" "); + ep.addMessageFooter("FIRMA PER CONVALIDA"); + ep.addMessageFooter(" "); + ep.addMessageFooter(" "); + ep.addMessageFooter("____________________________"); + ep.addMessageFooter(" "); + } + if (isFiscale) { + ep.addMessageFooter("N. DOCUMENTO " + getProgDocumento() + "/" + getId_esercizio()); + ep.addMessageFooter("OP. " + getId_users()); + if (!getParm("CASSA_STAMPA_PROMO").isEmpty()) { + ep.addMessageFooter(" "); + ep.addMessageFooter(getParm("CASSA_STAMPA_PROMO").getTesto()); + } + } else { + ep.addMessageBody("N. DOCUMENTO " + getProgDocumento() + "/" + getId_esercizio()); + ep.addMessageBody("OP. " + getId_users()); + } + rp = ep.stampa(); + if (rp.getStatus() && isFiscale) { + Calendar cal = Calendar.getInstance(); + Timestamp ts = new Timestamp(cal.getTimeInMillis()); + rp.append(aggiornaEchoScontrino(rp.getMsg() + " - " + rp.getMsg())); + } + if (!getParm("CASSA_STAMPA_DISPLAY").getTesto().isEmpty() || !getParm("CASSA_STAMPA_DISPLAY1").getTesto().equals("")) + stampaDisplayCassa(l_regCassa, getParm("CASSA_STAMPA_DISPLAY").getTesto(), getParm("CASSA_STAMPA_DISPLAY1").getTesto(), 5); + return rp; + } + + public ResParm stampaScontrinoSiemens(boolean isFiscale, RegCassa l_regCassa) { + ResParm rp = new ResParm(true); + return rp; + } + + public double getContanti() { + return this.contanti; + } + + public void setContanti(double contanti) { + this.contanti = contanti; + } + + public long getFlgRitiroNegozio() { + return this.flgRitiroNegozio; + } + + public void setFlgRitiroNegozio(long flgRitiroNegozio) { + this.flgRitiroNegozio = flgRitiroNegozio; + } + + private int hasRigheDisponibili() { + if (getDBState() == 1) { + Vectumerator vec = findRigheDocumento(0, 0, 0); + int isDisponibile = 0; + boolean isRowDisponibile = false; + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getId_articoloTaglia() > 0L) { + if (row.getArticoloTaglia().getQuantitaT() > 0.0D) + isRowDisponibile = true; + } else if (row.getId_articoloVariante() > 0L) { + if (row.getArticoloVariante().getQuantitaAv() > 0.0D) + isRowDisponibile = true; + } else if (row.getArticolo().getQuantita() > 0.0D) { + isRowDisponibile = true; + } + if (isRowDisponibile) { + isDisponibile = 2; + continue; + } + if (isDisponibile == 2) { + isDisponibile = 1; + break; + } + } + return isDisponibile; + } + return 0; + } + + public ResParm sendDocumentiMailMessage(DocumentoCR CR, String eMail, String path) { + ResParm rp = new ResParm(true); + creaDocumentoPdf(CR, true); + String fileName = CR.getFilePdf(); + if (isFileExist(fileName)) + try { + MailProperties mp = new MailProperties(); + String corpoMessaggio = ""; + if (CR.getFlgLink() == 1L) { + fileName = fileName.replace(getDocBase(), ""); + fileName = fileName.replace(getPathStampeDocumenti(), ""); + fileName = URLEncoder.encode(EcDc.encodeDizionario(fileName, _AnagAdapter.KEY_ENCODE_DIZ), "utf-8"); + String id = URLEncoder.encode(EcDc.encodeDizionario(String.valueOf(getId_documento()), _AnagAdapter.KEY_ENCODE_DIZ), "utf-8"); + corpoMessaggio = "Clicca sul documento per scaricarlo:
" + getDescDocumenti() + ""; + } else { + corpoMessaggio = "In allegato i seguenti documenti in formato PDF.

" + getDescDocumenti(); + mp.put("FILES", fileName); + } + if (!getTestoAgg().isEmpty()) + corpoMessaggio = corpoMessaggio + "

" + corpoMessaggio; + if (!getParm("DOC_FIRMA_INVIO_FATTURA").getTesto().isEmpty() && getFlgStato() == 1L) + corpoMessaggio = corpoMessaggio + "

" + corpoMessaggio + "

"; + mp.setProperty("TO", eMail); + mp.setProperty("ISHTML", "true"); + mp.setProperty("FROM", getMessaggioDocumentiEmailFrom()); + if (CR.getId_documentoS() > 0L) { + mp.setProperty("SUBJECT", getMailSubject() + " - Documento n. " + getMailSubject()); + } else { + mp.setProperty("SUBJECT", getMailSubject() + " - Spedizione documenti "); + } + mp.setProperty("MSG", corpoMessaggio); + mp.setProperty("BCC", getParm("DOC_BCC").getTesto()); + sendMailMessage(mp); + } catch (Exception e) { + rp.setStatus(false); + rp.setException(e); + } + if (rp.getStatus()) { + Timestamp tmst = getTimestamp(); + setTmstInvioMail(tmst); + superSave(); + } + return rp; + } + + public final ResParm startInvioMailExt(DocumentoCR CR, String email, String path, String testoAgg) { + if (!isThreadAttivo()) { + new ThreadSendMailExt(CR, email, path, testoAgg); + return new ResParm(true, "Thread Invio Mail a clienti avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public ResParm stampaReportFinanziario(RegCassa l_regCassa) { + ResParm rp = new ResParm(true); + EpsonCash ep = new EpsonCash(1L, 5, l_regCassa.getIpCassa()); + rp = ep.stampa(); + return rp; + } + + public ResParm stampaReportGiornaliero(RegCassa l_regCassa) { + ResParm rp = new ResParm(true); + EpsonCash ep = new EpsonCash(1L, 4, l_regCassa.getIpCassa()); + rp = ep.stampa(); + return rp; + } + + public ResParm ristampaScontrino(RegCassa l_regCassa) { + ResParm rp = new ResParm(true); + EpsonCash ep = new EpsonCash(1L, 3, l_regCassa.getIpCassa()); + rp = ep.stampa(); + return rp; + } + + public void stampaDisplayCassa(final RegCassa l_regCassa, final String linea1, final String linea2, int sec) { + final int ssec = sec; + new Thread() { + public void run() { + try { + Thread.sleep((long)(ssec * 1000)); + Documento.this.stampaDisplayCassa(l_regCassa, linea1, linea2); + } catch (Exception e) { + e.printStackTrace(); + } + } + }.start(); + } + + public ResParm apriCassa(RegCassa l_regCassa) { + ResParm rp = new ResParm(true); + if (l_regCassa.getFlgTipoCassa() == 0L) + return rp; + EpsonCash ep = new EpsonCash(1L, 7, l_regCassa.getIpCassa()); + ep.openDrawer(getParm("CASSA_STAMPA_DISPLAY").getTesto(), getParm("CASSA_STAMPA_DISPLAY1").getTesto(), + getParm("CASSA_STAMPA_DISPLAY_TIMEOUT").getNumeroInt()); + rp = ep.stampa(); + return rp; + } + + public ResParm stampaDisplayCassa(RegCassa l_regCassa, String linea1, String linea2) { + ResParm rp = new ResParm(true); + EpsonCash ep = new EpsonCash(1L, 6, l_regCassa.getIpCassa()); + if (l_regCassa.getFlgTipoCassa() == 0L) + return rp; + ep.displayString(linea1, linea2); + rp = ep.stampa(); + return rp; + } + + public ResParm stampaDisplayCassa(RegCassa l_regCassa, RigaDocumento row) { + ResParm rp = new ResParm(true); + EpsonCash ep = new EpsonCash(1L, 6, l_regCassa.getIpCassa()); + if (l_regCassa.getFlgTipoCassa() == 0L) + return rp; + ep.displayString(row.getArticolo().getNome(), row.getQuantita(), row.getPrezzoPubblicoConIva()); + rp = ep.stampa(); + return rp; + } + + public ResParm ristampaListaScontrini(DocumentoCR CR, boolean isFiscale, RegCassa l_regCassa) { + ResParm rp = new ResParm(true); + if (l_regCassa.getFlgTipoCassa() == 0L) + return rp; + return ristampaListaScontriniEpson(CR, isFiscale, l_regCassa); + } + + public ResParm ristampaListaScontriniEpson(DocumentoCR CR, boolean isFiscale, RegCassa l_regCassa) { + ResParm rp = new ResParm(true); + Documento doc = new Documento(getApFull()); + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + doc = (Documento)vec.nextElement(); + EpsonCash ep = new EpsonCash(1L, 8, l_regCassa.getIpCassa()); + String[] num = doc.getEchoScontrino().split(" - "); + long cod = Long.valueOf("0" + num[0]); + if (cod > 0L) + ep.reprintReceipt(Long.valueOf(num[0]).longValue(), doc.getDataPagamento()); + } + return rp; + } + + public ResParm stampaScontrinoPrenotazione(boolean isFiscale, RegCassa l_regCassa) { + ResParm rp = new ResParm(true); + if (l_regCassa.getFlgTipoCassa() == 0L) { + rp.setMsg(""); + } else { + rp = stampaScontrinoPrenotazioneEpson(isFiscale, l_regCassa); + } + return rp; + } + + public ResParm stampaScontrinoPrenotazioneEpson(boolean isFiscale, RegCassa l_regCassa) { + EpsonCash ep; + ResParm rp = new ResParm(true); + boolean footerFirma = false; + BarcodeCash bc = null; + if (isFiscale) { + ep = new EpsonCash(1L, 1, l_regCassa.getIpCassa()); + } else { + ep = new EpsonCash(1L, 2, l_regCassa.getIpCassa()); + StringBuilder sb = new StringBuilder(); + sb.append(getNominativoDocumento() + " "); + sb.append(getClifor().getIndirizzoCompleto() + " "); + if (!getCellDocumento().isEmpty()) { + sb.append(" Cell. " + getCellDocumento() + " "); + } else if (!getClifor().getCellulare().isEmpty()) { + sb.append(" Cell. " + getClifor().getCellulare() + " "); + } + if (!getTelDocumento().isEmpty()) { + sb.append(" Tel. " + getTelDocumento() + " "); + } else if (!getClifor().getTelefono().isEmpty()) { + sb.append(" Tel. " + getClifor().getTelefono() + " "); + } + if (!getEMailDocumento().isEmpty()) { + sb.append(" EMail. " + getEMailDocumento() + " "); + } else if (!getClifor().getEMail().isEmpty()) { + sb.append(" EMail. " + getClifor().getEMail() + " "); + } + ep.addMessageBody(sb.toString()); + } + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + while (vec.hasMoreElements()) { + String descIva; + RigaDocumento row = (RigaDocumento)vec.nextElement(); + String reparto = "" + row.getReparto().getSiglaEpson() + row.getReparto().getSiglaEpson(); + StringBuffer temp = new StringBuffer(); + if (row.isDescScontrinoFull()) { + temp.append(" "); + if (row.getId_articoloVariante() != 0L) { + temp.append(row.getArticoloVariante().getDescrizioneCompleta()); + } else { + temp.append(row.getArticolo().getDescrizioneCompleta()); + } + if (!row.getSeriale().isEmpty()) { + temp.append(" "); + temp.append(row.getSeriale()); + } + } + temp.append(" "); + temp.append(row.getDescrizioneRiga()); + String desc = temp.toString().trim(); + desc = desc.replaceAll("€", "euro"); + if (row.getImportoConSconto() < 0.0D) { + if (row.getFlgReso() == 1L) { + ep.addRefund(desc, row.getQuantita(), row.getImportoConSconto(), false, row.getReparto().getSiglaEpson(), 4L); + continue; + } + ep.addDiscoutUplift(desc, row.getImportoConSconto(), false, row.getReparto().getSiglaEpson(), 3L); + continue; + } + if (getCodiceIvaVendStd() != row.getIva().getId_iva()) { + if (isFiscale) { + descIva = DBAdapter.spaceRight(row.getIva().getDescrizione(), 38) + DBAdapter.spaceRight(row.getIva().getDescrizione(), 38); + } else { + descIva = DBAdapter.spaceRight(row.getIva().getDescrizione(), 40) + DBAdapter.spaceRight(row.getIva().getDescrizione(), 40); + } + } else { + descIva = row.getNotaRigaDocumento(); + } + if (isFiscale) { + ep.addArticle(desc, row.getQuantita(), row.getImportoConSconto(), false, row.getReparto().getSiglaEpson(), descIva); + continue; + } + bc = null; + if (row.getArticolo().getTipo().getFlgStampaBarcode() == 1L && !row.getNotaBarcode().isEmpty()) { + footerFirma = true; + bc = new BarcodeCash(); + bc.setPosizione(10L); + bc.setLarghezza(2L); + bc.setAltezza(66L); + bc.setPosizioneTesto(BarcodeCash.POSIZIONE_TESTO_SOTTO); + bc.setFontTesto(BarcodeCash.FONT_C); + bc.setTipoBarcode(BarcodeCash.BARCODE_CODE39); + bc.setCode(row.getNotaBarcode()); + } + ep.addArticle(desc, row.getQuantita(), row.getImportoConSconto(), false, row.getReparto().getSiglaEpson(), descIva, bc); + } + Double importoPagato = getContanti(); + if (importoPagato == 0.0D) + importoPagato = getTotaleDocumento(); + ep.addTotal(getTipoPagamento().getDescrizione(), importoPagato.doubleValue(), Long.valueOf(getTipoPagamento().getCodiceCassaEpson()).longValue()); + String leNote = ""; + if (!getCliforListino().getCodiceCartaFidelity().isEmpty()) + leNote = "Fidelity Card: " + getCliforListino().getCodiceCartaFidelity() + " - " + getCliforListino().getListino().getDescrizione(); + if (leNote.length() > 0) + ep.addMessageFooter(leNote); + if (footerFirma) { + ep.addMessageFooter(" "); + ep.addMessageFooter(" "); + ep.addMessageFooter("FIRMA PER CONVALIDA"); + ep.addMessageFooter(" "); + ep.addMessageFooter(" "); + ep.addMessageFooter("____________________________"); + ep.addMessageFooter(" "); + } + if (isFiscale) { + ep.addMessageFooter("N. DOCUMENTO " + getProgDocumento() + "/" + getId_esercizio()); + ep.addMessageFooter("OP. " + getProgDocumento()); + } else { + if (getAcconto() > 0.0D) { + NumberFormat nf = NumberFormat.getInstance(); + nf.setMaximumFractionDigits(2); + nf.setMinimumFractionDigits(2); + ep.addMessageBody(DBAdapter.spaceRight("ACCONTO ", 20) + DBAdapter.spaceRight("ACCONTO ", 20)); + } + ep.addMessageBody("N. DOCUMENTO " + getProgDocumento() + "/" + getId_esercizio()); + ep.addMessageBody("OP. " + getId_users()); + } + rp = ep.stampa(); + if (rp.getStatus() && isFiscale) { + Calendar cal = Calendar.getInstance(); + Timestamp ts = new Timestamp(cal.getTimeInMillis()); + rp.append(aggiornaEchoScontrino(rp.getMsg() + " - " + rp.getMsg())); + } + if (!getParm("CASSA_STAMPA_DISPLAY").getTesto().isEmpty() || !getParm("CASSA_STAMPA_DISPLAY1").getTesto().equals("")) + stampaDisplayCassa(l_regCassa, getParm("CASSA_STAMPA_DISPLAY").getTesto(), getParm("CASSA_STAMPA_DISPLAY1").getTesto(), 5); + return rp; + } + + public String getCurrentTab() { + if (super.getCurrentTab().isEmpty()) { + if (getTipoDocumento().getFlgTipologia() == 5L) + return "#DIF"; + if (getTipoDocumento().getFlgAFT() == 0L) + return "#RIGHE"; + if (getTipoDocumento().getFlgAFT() == 1L) + return "#RIGHEF"; + if (getTipoDocumento().getFlgAFT() == 2L) + return "#RIGHET"; + return "#RIGHE"; + } + return super.getCurrentTab(); + } + + public Vectumerator findDocumentiFiglioRiga(long l_id_rigaDocumento) { + StringBuffer s_Sql_Find = new StringBuffer("select D.* from DOCUMENTO AS D where id_documento in (select B.id_documento from DOCUMENTO AS A, RIGA_DOCUMENTO AS B "); + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("B.id_rigaDocumentoPadre=" + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + ")"); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getTotDocumentiFiglioRiga(long l_id_rigaDocumento) { + StringBuffer s_Sql_Find = new StringBuffer("select count(id_documento) as _sum from DOCUMENTO AS D where id_documento= (select B.id_documentoPadre from DOCUMENTO AS A, RIGA_DOCUMENTO AS B "); + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("B.id_rigaDocumentoPadre=" + l_id_rigaDocumento); + String s_Sql_Group = " GROUP BY D.id_documento "; + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + ")" + wc.toString()); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + private Document creaReportUnaVenditex(DocumentoCR CR, boolean soloCompatto) { + int rowCellLeading = 6; + NumberFormat nf3 = NumberFormat.getInstance(); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf0 = NumberFormat.getInstance(); + nf0.setMaximumFractionDigits(0); + nf0.setMinimumFractionDigits(0); + int col_1 = 3, col_2 = 10, col_3 = 7, col_4 = 4, col_99 = 3, col_98 = 1, col_5 = 4, col_6 = 2, col_7 = 3, col_8 = 4; + int cellLeading = 12; + DoubleOperator totArt = new DoubleOperator(); + DoubleOperator totVendita = new DoubleOperator(); + DoubleOperator totImportoChiusi = new DoubleOperator(); + DoubleOperator totImportoScontrino = new DoubleOperator(); + DoubleOperator totImportoFatDaSc = new DoubleOperator(); + DoubleOperator totImportoDDTDaSc = new DoubleOperator(); + DoubleOperator totQtaChiusi = new DoubleOperator(); + DoubleOperator totQtaScontrino = new DoubleOperator(); + DoubleOperator totQtaFatDaSc = new DoubleOperator(); + DoubleOperator totQtaDDTDaSc = new DoubleOperator(); + List lstCh = new ArrayList<>(); + List lstScont = new ArrayList<>(); + List lstFatt = new ArrayList<>(); + List lstDDT = new ArrayList<>(); + Hashtable htPag = new Hashtable(); + Hashtable htArticoli = new Hashtable(); + SimpleDateFormat df = getDataFormat(); + try { + Cell rigaVuota = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimo)); + rigaVuota.setVerticalAlignment(4); + rigaVuota.setHorizontalAlignment(0); + rigaVuota.setLeading((float)cellLeading); + rigaVuota.setBorder(0); + rigaVuota.setColspan(40); + rigaVuota.setRowspan(1); + String intestazioneReport = "Data: dal " + df.format(CR.getDataDocumentoDa()) + " al " + df.format(CR.getDataDocumentoA()); + if (CR.getId_tipo() != 0L) + intestazioneReport = intestazioneReport + " - Tipo: " + intestazioneReport; + creaIntestazioneReport(CR.getTipoReport(), intestazioneReport); + Cell cell = new Cell(new Chunk("Doc.", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Articolo", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Cliente", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("N.Telefono", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Operatore", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_99); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Pag.", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Pr. V.", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Q.tà", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Tot.", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.pdfcorpo.endHeaders(); + Vectumerator vec = new RigaDocumento(getApFull()).findVenditeGiornaliere(CR, getId_docCassa()); + while (vec.hasMoreElements()) { + String nDoc, descCliente, descPag; + DoubleOperator dopPag, doubleOperator1, doubleOperator2; + ArticoloGroup ag; + RigaDocumento row = (RigaDocumento)vec.nextElement(); + totArt.add(row.getQuantita()); + totVendita.add(row.getTotImportoRigaConSconto()); + String descArticolo = row.getReparto().getDescrizione() + " - " + row.getReparto().getDescrizione() + "-" + row.getArticolo().getTipo().getDescrizione(); + if (!row.getDocumento().isUnDocumentoFiglioCreato()) { + nDoc = row.getDocumento().getNumeroDocumentoCompleto(); + if (row.getDocumento().getEchoScontrino().equals("CHIUSO")) { + descCliente = "NO SCONTRINO"; + } else { + descCliente = "scontrino"; + } + descPag = row.getDocumento().getTipoPagamento().getDescrizione(); + } else { + Documento docFiglio = row.getDocumento().getDocumentoFiglioUno(); + nDoc = docFiglio.getNumeroDocumentoCompleto(); + descCliente = docFiglio.getClifor().getDescrizioneCompleta(); + descPag = docFiglio.getTipoPagamento().getDescrizione(); + } + if (!row.getNotaRigaDocumento().isEmpty()) + descCliente = descCliente + " - " + descCliente; + String nTel = ""; + if (!row.getNotaBarcode().isEmpty()) + nTel = row.getNotaBarcode(); + String descOper = ""; + if (row.getDocumento().getId_users() != 0L) + descOper = row.getDocumento().getUsers().getDescrizione(); + if (row.getDocumento().getEchoScontrino().equals("CHIUSO")) { + if (!lstCh.contains(row.getDocumento().getNumeroDocumento())) { + totQtaChiusi.add(1); + lstCh.add(row.getDocumento().getNumeroDocumento()); + } + totImportoChiusi.add(row.getTotImportoRigaConSconto()); + } else if (row.getDocumento().getTipoDocumento().getId_tipoDocumento() == 1L && + !row.getDocumento().isUnDocumentoFiglioCreato()) { + if (!lstScont.contains(row.getDocumento().getNumeroDocumento())) { + totQtaScontrino.add(1); + lstScont.add(row.getDocumento().getNumeroDocumento()); + } + totImportoScontrino.add(row.getTotImportoRigaConSconto()); + } else { + Documento docFiglio = row.getDocumento().getDocumentoFiglioUno(); + if (docFiglio.getTipoDocumento().getFlgTipologia() == 1L) { + if (!lstFatt.contains(row.getDocumento().getNumeroDocumento())) { + totQtaFatDaSc.add(1); + lstFatt.add(row.getDocumento().getNumeroDocumento()); + } + totImportoFatDaSc.add(row.getTotImportoRigaConSconto()); + } + if (docFiglio.getTipoDocumento().getFlgTipologia() == 0L) { + if (!lstDDT.contains(row.getDocumento().getNumeroDocumento())) { + totQtaDDTDaSc.add(1); + lstDDT.add(row.getDocumento().getNumeroDocumento()); + } + totImportoDDTDaSc.add(row.getTotImportoRigaConSconto()); + } + } + if (htPag.containsKey(descPag)) { + dopPag = (DoubleOperator)htPag.get(descPag); + } else { + dopPag = new DoubleOperator(); + } + dopPag.add(row.getTotImportoRigaConSconto()); + htPag.put(descPag, dopPag); + String descArticoloGroup = row.getReparto().getDescrizione(); + String agKey = descArticoloGroup; + if (htArticoli.containsKey(agKey)) { + ag = (ArticoloGroup)htArticoli.get(agKey); + doubleOperator1 = new DoubleOperator(ag.getQuantita()); + doubleOperator2 = new DoubleOperator(ag.getValore()); + } else { + ag = new ArticoloGroup(); + ag.setDescrizione(descArticoloGroup); + doubleOperator1 = new DoubleOperator(); + doubleOperator2 = new DoubleOperator(); + } + doubleOperator1.add(row.getQuantita()); + doubleOperator2.add(row.getTotImportoRigaConSconto()); + ag.setQuantita(doubleOperator1.getResult()); + ag.setValore(doubleOperator2.getResult()); + htArticoli.put(agKey, ag); + if (!soloCompatto) { + cell = new Cell(new Chunk(nDoc, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(descArticolo, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(descCliente, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nTel, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(descOper, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_99); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(descPag, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(row.getImporto()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(row.getQuantita()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(row.getTotImportoRigaConSconto()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + } + if (!soloCompatto) { + Enumeration tpEnum = htPag.keys(); + while (tpEnum.hasMoreElements()) { + String tpKey = tpEnum.nextElement(); + cell = new Cell(new Chunk(tpKey, PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_99 + col_5 + col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(htPag.get(tpKey).getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("Totale Scontrini ", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_99 + col_5 + col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totQtaScontrino.getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totImportoScontrino.getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Totale Chiusi ", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_99 + col_5 + col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totQtaChiusi.getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totImportoChiusi.getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Totale DDT da Scontrino ", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_99 + col_5 + col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totQtaDDTDaSc.getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totImportoDDTDaSc.getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Totale Fattura da Scontrino ", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_99 + col_5 + col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totQtaFatDaSc.getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totImportoFatDaSc.getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALI ", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_99 + col_5 + col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + totQtaScontrino.add(totQtaChiusi.getResult()); + totQtaScontrino.add(totQtaDDTDaSc.getResult()); + totQtaScontrino.add(totQtaFatDaSc.getResult()); + cell = new Cell(new Chunk(getNf().format(totQtaScontrino.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totVendita.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE RECORD: ", PdfFontFactory.PDF_fGrande)); + cell.add(new Chunk(String.valueOf(vec.getTotNumberOfRecords()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("ELENCO VENDITE RAGGRUPPATE PER REPARTI", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_99 + col_5 + col_6 + col_7 + col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + Enumeration agEnum = htArticoli.keys(); + Vectumerator agVectum = new Vectumerator(agEnum); + Collections.sort((List)agVectum); + DoubleOperator dopQ = new DoubleOperator(); + DoubleOperator dopValore = new DoubleOperator(); + while (agVectum.hasMoreElements()) { + String agKey = (String)agVectum.nextElement(); + ArticoloGroup agRow = htArticoli.get(agKey); + dopQ.add(agRow.getQuantita()); + dopValore.add(agRow.getValore()); + cell = new Cell(new Chunk(agRow.getDescrizione(), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_99 + col_5 + col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(agRow.getQuantita()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(agRow.getValore()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("TOTALI ", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_99 + col_5 + col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(dopQ.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(dopValore.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + } catch (Exception e) { + handleDebug(e); + } + return this.document; + } + + public long findTotRigheDocumentoDaPrelevare() { + return new RigaDocumento(getApFull()).findRigheDaPrelevareByDocumento(getId_documento()); + } + + public double getTotAccontiByDocumentoPadre(long l_id_documento) { + String s_Sql_Find = "select SUM(A.acconto) AS _sum from DOCUMENTO AS A, RIGA_DOCUMENTO AS B"; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("B.id_documentoPadre=" + l_id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public double getTotAccontiByDocumento(long l_id_documento) { + String s_Sql_Find = "select SUM(A.acconto) AS _sum from DOCUMENTO AS A "; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public long getFlgStatoPrenotazionePrecedene() { + return this.flgStatoPrenotazionePrecedene; + } + + public void setFlgStatoPrenotazionePrecedene(long flgStatoPrenotazionePrecedene) { + this.flgStatoPrenotazionePrecedene = flgStatoPrenotazionePrecedene; + } + + public ResParm stampaScontrinoEpsonScontoManuale(boolean isFiscale, RegCassa l_regCassa) { + EpsonCash ep; + ResParm rp = new ResParm(true); + boolean footerFirma = false; + BarcodeCash bc = null; + NumberFormat nf = NumberFormat.getInstance(); + nf.setMaximumFractionDigits(2); + nf.setMinimumFractionDigits(2); + if (isFiscale) { + ep = new EpsonCash(1L, 1, l_regCassa.getIpCassa()); + } else { + ep = new EpsonCash(1L, 2, l_regCassa.getIpCassa()); + } + Vectumerator vec = new RigaDocumento(getApFull()).findByDocumento(0L, getId_documento(), "", 0, 0, 0); + while (vec.hasMoreElements()) { + String descIva; + RigaDocumento row = (RigaDocumento)vec.nextElement(); + String reparto = "" + row.getReparto().getSiglaEpson() + row.getReparto().getSiglaEpson(); + StringBuffer temp = new StringBuffer(); + if (row.isDescScontrinoFull()) { + temp.append(" "); + if (row.getId_articoloVariante() != 0L) { + temp.append(row.getArticoloVariante().getDescrizioneCompleta()); + } else { + temp.append(row.getArticolo().getDescrizioneCompleta()); + } + if (!row.getSeriale().isEmpty()) { + temp.append(" "); + temp.append(row.getSeriale()); + } + } + temp.append(" "); + temp.append(row.getDescrizioneRiga()); + String desc = temp.toString().trim(); + desc = desc.replaceAll("€", "euro"); + if (row.getImportoConSconto() < 0.0D) { + if (row.getFlgReso() == 1L || row.getArticolo().getFlgNegativo() == 1L) { + ep.addRefund(desc, row.getQuantita(), row.getImportoConSconto(), false, row.getReparto().getSiglaEpson(), 4L); + continue; + } + ep.addDiscoutUplift(desc, row.getImportoConSconto(), false, row.getReparto().getSiglaEpson(), 3L); + continue; + } + String notaRigaDocumento = row.getNotaRigaDocumento() + " "; + if (getCodiceIvaVendStd() != row.getIva().getId_iva()) { + if (isFiscale) { + if (row.getSconto() > 0.0D) { + descIva = DBAdapter.spaceRight(row.getIva().getDescrizione(), 37) + DBAdapter.spaceRight(row.getIva().getDescrizione(), 37) + DBAdapter.spaceRight("SCONT0 APPLICATO " + String.valueOf(nf.format(row.getSconto())) + "%", 37); + if (!row.getSeriale().isEmpty()) + descIva = descIva + descIva; + } else { + descIva = DBAdapter.spaceRight(row.getIva().getDescrizione(), 37) + DBAdapter.spaceRight(row.getIva().getDescrizione(), 37); + if (!row.getSeriale().isEmpty()) + descIva = descIva + descIva; + } + } else { + descIva = DBAdapter.spaceRight(row.getIva().getDescrizione(), 39) + DBAdapter.spaceRight(row.getIva().getDescrizione(), 39); + if (!row.getSeriale().isEmpty()) + descIva = descIva + descIva; + } + } else if (row.getSconto() > 0.0D) { + descIva = DBAdapter.spaceRight("SCONT0 APPLICATO " + String.valueOf(nf.format(row.getSconto())) + "%", 37) + DBAdapter.spaceRight("SCONT0 APPLICATO " + String.valueOf(nf.format(row.getSconto())) + "%", 37); + if (!row.getSeriale().isEmpty()) + descIva = descIva + descIva; + } else { + descIva = notaRigaDocumento; + if (!row.getSeriale().isEmpty()) + descIva = descIva + descIva; + } + if (isFiscale) { + ep.addArticle(desc, row.getQuantita(), row.getImportoConSconto(), false, row.getReparto().getSiglaEpson(), descIva); + continue; + } + bc = null; + if (row.getArticolo().getTipo().getFlgStampaBarcode() == 1L && !row.getNotaBarcode().isEmpty()) { + footerFirma = true; + bc = new BarcodeCash(); + bc.setPosizione(10L); + bc.setLarghezza(2L); + bc.setAltezza(66L); + bc.setPosizioneTesto(BarcodeCash.POSIZIONE_TESTO_SOTTO); + bc.setFontTesto(BarcodeCash.FONT_C); + bc.setTipoBarcode(BarcodeCash.BARCODE_CODE39); + bc.setCode(row.getNotaBarcode()); + } + ep.addArticle(desc, row.getQuantita(), row.getImportoConSconto(), false, row.getReparto().getSiglaEpson(), descIva, bc); + } + if (getAcconto() > 0.0D) + ep.addDiscoutUplift("ACCONTO ", getAcconto(), false, 0L, 0L); + Double importoPagato = getContanti(); + if (importoPagato == 0.0D) + importoPagato = getTotaleDocumento(); + ep.addTotal(getTipoPagamento().getDescrizione(), importoPagato.doubleValue(), Long.valueOf(getTipoPagamento().getCodiceCassaEpson()).longValue()); + String leNote = ""; + if (!getCliforListino().getCodiceCartaFidelity().isEmpty()) + leNote = "Fidelity Card: " + getCliforListino().getCodiceCartaFidelity() + " " + getCliforListino().getDescrizioneCompleta() + " LISTINO " + getCliforListino().getListino().getDescrizione(); + if (!getNote().isEmpty()) + leNote = (leNote + " " + leNote).trim(); + if (leNote.length() > 0) + ep.addMessageFooter(leNote); + if (footerFirma) { + ep.addMessageFooter(" "); + ep.addMessageFooter(" "); + ep.addMessageFooter("FIRMA PER CONVALIDA"); + ep.addMessageFooter(" "); + ep.addMessageFooter(" "); + ep.addMessageFooter("____________________________"); + ep.addMessageFooter(" "); + } + if (isFiscale) { + ep.addMessageFooter("N. DOCUMENTO " + getProgDocumento() + "/" + getId_esercizio()); + ep.addMessageFooter("OP. " + getId_users()); + if (!getParm("CASSA_STAMPA_PROMO").isEmpty()) { + ep.addMessageFooter(" "); + ep.addMessageFooter(getParm("CASSA_STAMPA_PROMO").getTesto()); + } + } else { + ep.addMessageBody("N. DOCUMENTO " + getProgDocumento() + "/" + getId_esercizio()); + ep.addMessageBody("OP. " + getId_users()); + } + rp = ep.stampa(); + if (rp.getStatus() && isFiscale) { + Calendar cal = Calendar.getInstance(); + Timestamp ts = new Timestamp(cal.getTimeInMillis()); + rp.append(aggiornaEchoScontrino(rp.getMsg() + " - " + rp.getMsg())); + } + if (!getParm("CASSA_STAMPA_DISPLAY").getTesto().isEmpty() || !getParm("CASSA_STAMPA_DISPLAY1").getTesto().equals("")) + stampaDisplayCassa(l_regCassa, getParm("CASSA_STAMPA_DISPLAY").getTesto(), getParm("CASSA_STAMPA_DISPLAY1").getTesto(), 5); + return rp; + } + + public Vectumerator findPrenConAccontiByDate(Date dataInizio, Date dataFine) { + String s_Sql_Find = "select A.* from DOCUMENTO AS A "; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.dataDocumento>=?"); + wc.addWc("A.dataDocumento<=?"); + wc.addWc("A.acconto>0"); + wc.addWc("A.dataRestituzioneAcconto IS NULL"); + wc.addWc("A.id_tipoDocumento= " + getParm("ID_DOC_PRENOTAZIONE").getNumeroLong()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + int dataCount = 0; + dataCount++; + stmt.setDate(dataCount, dataInizio); + dataCount++; + stmt.setDate(dataCount, dataFine); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findPrenAnnConAccontiByDate(Date dataInizio, Date dataFine) { + String s_Sql_Find = "select A.* from DOCUMENTO AS A "; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.dataRestituzioneAcconto>=?"); + wc.addWc("A.dataRestituzioneAcconto<=?"); + wc.addWc("A.acconto>0"); + wc.addWc("NOT A.dataRestituzioneAcconto IS NULL"); + wc.addWc("A.id_tipoDocumento= " + getParm("ID_DOC_PRENOTAZIONE").getNumeroLong()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + int dataCount = 0; + dataCount++; + stmt.setDate(dataCount, dataInizio); + dataCount++; + stmt.setDate(dataCount, dataFine); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm addRigaPrenotazionePrelevataDaOrdine(RigaDocumento rdPrenotazione, double l_qtaDaPrelevare) { + ResParm rp = new ResParm(false); + rp = checkEMSTA(); + if (rp.getStatus()) { + DoubleOperator dop = new DoubleOperator(l_qtaDaPrelevare); + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getId_articolo() == rdPrenotazione.getId_articolo() && + row.getId_articoloVariante() == rdPrenotazione.getId_articoloVariante()) + if (row.getQuantita() != 0.0D) { + RigaDocumentoPM rdp = new RigaDocumentoPM(getApFull()); + rdp.setId_rigaDocumento(row.getId_rigaDocumento()); + rdp.setId_rigaDocumentoPrelevata(rdPrenotazione.getId_rigaDocumento()); + if (row.getQuantita() <= dop.getResult()) { + rdp.setQuantitaPrelevata(row.getQuantita()); + } else { + rdp.setQuantitaPrelevata(dop.getResult()); + } + rp = row.addRigaDocumentoPM(rdp); + if (rp.getStatus()) + dop.subtract(rdp.getQuantitaPrelevata()); + if (dop.getResult() <= 0.0D) + break; + } + } + } else { + rp.setMsg("ERRORE! Fattura emessa o stampata! Impossibile eliminare."); + } + return rp; + } + + protected StringBuffer formattaNoteDocumento(String temp, int caratteriTotali, int righeTotali, boolean righeMancanti) { + StringBuffer rigaNote = new StringBuffer(); + int righe = 0; + int totLen = 0; + if (caratteriTotali > 0) { + totLen = caratteriTotali; + } else { + totLen = temp.length(); + } + temp = temp.trim(); + for (int i = 0; i < totLen; i++) { + if (temp.charAt(i) == '\n') { + righe++; + if (righe >= righeTotali) + break; + } + rigaNote.append(temp.charAt(i)); + } + if (righeMancanti) + for (int j = 0; j < righeTotali - righe; j++) + rigaNote.append('\n'); + return rigaNote; + } + + public ResParm checkStatoPrenotazioneByDocumento() { + long stato = -1L; + ResParm rp = new ResParm(false); + long l_flgStatoPrenotazionePrecedente = getFlgStatoPrenotazione(); + setFlgStatoPrenotazione(0L); + superSave(); + stato = -1L; + Vectumerator vecRig = findRigheDocumento(0, 0, 0); + while (vecRig.hasMoreElements()) { + RigaDocumento rig = (RigaDocumento)vecRig.nextElement(); + stato = rig.getStatoPrenotazione(); + if (stato != 30L) + break; + } + if (stato == 30L) + rp = aggiornaStatoPrenotazione(l_flgStatoPrenotazionePrecedente, 20L); + return rp; + } + + public ResParm superSave() { + return super.save(); + } + + public Vectumerator findDocumentiOrdiniByRigaPrenotazione(long l_id_rigaDocumento) { + StringBuffer s_Sql_Find = new StringBuffer("select A.* from DOCUMENTO AS A inner join RIGA_DOCUMENTO as B on A.id_documento =B.id_documento inner join RIGA_DOCUMENTO_P_M AS C ON B.id_rigaDocumento= C.id_rigaDocumento"); + WcString wc = new WcString(); + wc.addWc("C.id_rigaDocumentoPrelevata=" + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizioneStampaDocumento() { + if (getTipoDocumento().getFlgTipoStampa() == 10L) + return "Copia Non Fiscale"; + if (getTipoDocumento().getFlgTipoStampa() == 9L) + return "Stampa Scontrino Fiscale"; + return "Stampa Documento"; + } + + public long getId_magFisicoPartenza() { + return this.id_magFisicoPartenza; + } + + public void setId_magFisicoPartenza(long id_magFisicoPartenza) { + this.id_magFisicoPartenza = id_magFisicoPartenza; + setMagFisicoPartenza(null); + } + + public long getId_magFisicoArrivo() { + return this.id_magFisicoArrivo; + } + + public void setId_magFisicoArrivo(long id_magFisicoArrivo) { + this.id_magFisicoArrivo = id_magFisicoArrivo; + setMagFisicoArrivo(null); + } + + public MagFisico getMagFisicoArrivo() { + this.magFisicoArrivo = (MagFisico)getSecondaryObject(this.magFisicoArrivo, MagFisico.class, getId_magFisicoArrivo()); + return this.magFisicoArrivo; + } + + public void setMagFisicoArrivo(MagFisico magFisicoArrivo) { + this.magFisicoArrivo = magFisicoArrivo; + } + + public MagFisico getMagFisicoPartenza() { + this.magFisicoPartenza = (MagFisico)getSecondaryObject(this.magFisicoPartenza, MagFisico.class, getId_magFisicoPartenza()); + return this.magFisicoPartenza; + } + + public void setMagFisicoPartenza(MagFisico magFisicoPartenza) { + this.magFisicoPartenza = magFisicoPartenza; + } + + public double getTotDocumentiPrelievoOrdine(long l_id_rigaDocumento) { + StringBuffer s_Sql_Find = new StringBuffer("select count(*) as _sum from RIGA_DOCUMENTO_P AS A "); + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumentoPrelevata=" + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public Vectumerator findDocumentiPrelievoOrdine(long l_id_rigaDocumento) { + StringBuffer s_Sql_Find = new StringBuffer("select A.* from DOCUMENTO AS A inner join RIGA_DOCUMENTO as B on A.id_documento = B.id_documento inner join RIGA_DOCUMENTO_P AS C ON B.id_rigaDocumento= C.id_rigaDocumento "); + WcString wc = new WcString(); + wc.addWc("C.id_rigaDocumentoPrelevata=" + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getTotDocumentiPrelievoOrdineP(long l_id_rigaDocumento) { + StringBuffer s_Sql_Find = new StringBuffer(" select count(*) as _sum from RIGA_DOCUMENTO_P AS A "); + WcString wc = new WcString(); + wc.addWc(" A.id_rigaDocumento = " + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public Vectumerator findDocumentiPrelievoOrdineP(long l_id_rigaDocumento) { + StringBuffer s_Sql_Find = new StringBuffer("select A.* from DOCUMENTO AS A inner join RIGA_DOCUMENTO as B on A.id_documento = B.id_documento inner join RIGA_DOCUMENTO_P AS C ON B.id_rigaDocumento= C.id_rigaDocumentoPrelevata "); + WcString wc = new WcString(); + wc.addWc("C.id_rigaDocumento=" + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findRigheDocumentoPerSlip() { + return new RigaDocumento(getApFull()).findByDocumentoPerSlip(getId_documento()); + } + + public Date getDataDownload() { + return this.dataDownload; + } + + public void setDataDownload(Date dataDownload) { + this.dataDownload = dataDownload; + } + + public String getIpDownload() { + return this.ipDownload; + } + + public void setIpDownload(String ipDownload) { + this.ipDownload = ipDownload; + } + + public long getFlgDownload() { + return this.flgDownload; + } + + public void setFlgDownload(long flgDownload) { + this.flgDownload = flgDownload; + } + + public Timestamp getTmstStampato() { + return this.tmstStampato; + } + + public void setTmstStampato(Timestamp tmstStampato) { + this.tmstStampato = tmstStampato; + } + + public Vectumerator findByClifor(long l_id_clifor, int pageNumber, int pageRows) { + StringBuffer s_Sql_Find = new StringBuffer("select A.* from DOCUMENTO AS A "); + WcString wc = new WcString(); + wc.addWc(" A.id_clifor = " + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getTestoAgg() { + return (this.testoAgg == null) ? "" : this.testoAgg; + } + + public void setTestoAgg(String testoAgg) { + this.testoAgg = testoAgg; + } + + public Time getOraDownload() { + return this.oraDownload; + } + + public void setOraDownload(Time oraDownload) { + this.oraDownload = oraDownload; + } + + public void findUltimoDocumentoEmesso() { + String s_Sql_Find = "select A.* from DOCUMENTO AS A"; + String s_Sql_Order = " order by A.dataDocumento desc, A.id_esercizio desc, A.progDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_tipoDocumento=" + getId_tipoDocumento()); + wc.addWc("A.flgStato=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getBic() { + return (this.bic == null) ? "" : this.bic; + } + + public void setBic(String bic) { + this.bic = bic; + } + + protected int inserisciRigaDocumento(ArrayList dati, int idColDesc, int riga, Document l_document, Table pdfcorpo, int cellLeading, boolean hasMoreRow) { + String indent = ""; + boolean debug = false; + if (getTipoDocumento().getIndentNuovaRiga() > 0L) + indent = " ".substring(0, (int)getTipoDocumento().getIndentNuovaRiga()); + int righePerPagina = (int)getTipoDocumento().getRighePerPagina(); + int maxCharLength = (int)getTipoDocumento().getMaxCarDesc(); + if (maxCharLength == 0) + maxCharLength = 35; + int righeAggiuntivePagineIntermedie = 5; + String temp = dati.get(idColDesc).getDesc(); + temp = temp.replace("€", "€"); + int bordi = 0; + Color colore = Color.black; + long bordoColonne = getTipoDocumento().getFlgBordoColonna(); + long bordoRighe = getTipoDocumento().getFlgBordoRiga(); + String coloreBordo = getTipoDocumento().getColoreBordoInterno(); + boolean allineamentoInAlto = (getTipoDocumento().getFlgAllineamentoRiga() == 0L); + try { + ArrayList righeDescrizione = convertStringToMultiline(temp, maxCharLength); + int allineamentoInAltoVal = 0; + int allineamentoIBassoVal = righeDescrizione.size() - 1; + for (int row = 0; row < righeDescrizione.size(); row++) { + boolean moreDesc; + String desc = righeDescrizione.get(row); + if (row > 0) + desc = indent + indent; + if (row + 1 < righeDescrizione.size()) { + moreDesc = true; + } else { + moreDesc = false; + } + for (int col = 0; col < dati.size(); col++) { + Cell cell; + if (allineamentoInAlto) { + if (row == allineamentoInAltoVal || col == idColDesc) { + if (col == idColDesc) { + cell = new Cell(new Chunk(desc, dati.get(col).getPdfFont())); + } else { + cell = new Cell(new Chunk(dati.get(col).getDesc(), dati.get(col).getPdfFont())); + } + } else { + cell = new Cell(new Chunk("", dati.get(col).getPdfFont())); + } + } else if ((row == 0 && col == 0) || (row == allineamentoIBassoVal && row > 0 && col > 0) || col == idColDesc) { + if (col == idColDesc) { + cell = new Cell(new Chunk(desc, dati.get(col).getPdfFont())); + } else { + cell = new Cell(new Chunk(dati.get(col).getDesc(), dati.get(col).getPdfFont())); + } + } else if (moreDesc) { + cell = new Cell(new Chunk("", dati.get(col).getPdfFont())); + } else { + cell = new Cell(new Chunk(dati.get(col).getDesc(), dati.get(col).getPdfFont())); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(dati.get(col).getCellAlign()); + cell.setLeading((float)cellLeading); + if (dati.get(col).getPdfFont().getColor() == Color.white) { + settaBordiEColori(cell, bordoColonne, 0L, moreDesc, coloreBordo); + } else { + settaBordiEColori(cell, bordoColonne, bordoRighe, moreDesc, coloreBordo); + } + cell.setMaxLines(1); + cell.setColspan(dati.get(col).getColSpan()); + pdfcorpo.addCell(cell); + } + riga = incrementaNumRighe(riga, righePerPagina, l_document, pdfcorpo, (hasMoreRow || moreDesc)); + } + } catch (Exception e) { + handleDebug(e); + } + return riga; + } + + protected void settaBordiEColori(Cell cell, long bordoColonne, long bordoRighe, boolean moreDesc, String coloreBordo) { + int bordi = 0; + Color colore = Color.black; + if (bordoColonne == 1L) { + bordi = 12; + if (bordoRighe == 1L && !moreDesc) + bordi = 14; + } else if (bordoRighe == 1L && !moreDesc) { + bordi = 2; + } + cell.setBorder(bordi); + if (!coloreBordo.isEmpty()) + colore = getColorFromHex("#" + coloreBordo); + cell.setBorderColor(colore); + } + + protected ResParm saveTmstStampato() { + if (getFlgStato() == 1L) { + Calendar cal = Calendar.getInstance(); + Timestamp ts = new Timestamp(cal.getTimeInMillis()); + setTmstStampato(ts); + return super.save(); + } + return new ResParm(true); + } + + public Vectumerator findDocumentiFiglio(int pageNumber, int pageRow) { + if (getId_documento() == 0L) + return AB_EMPTY_VECTUMERATOR; + StringBuffer s_Sql_Find = new StringBuffer("select D.* from DOCUMENTO AS D where id_documento in (select B.id_documento from DOCUMENTO AS A, RIGA_DOCUMENTO AS B "); + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("B.id_documentoPadre=" + getId_documento()); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + ")"); + return findRows(stmt, pageNumber, pageRow); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + private boolean hasDocumentiPadre() { + Vectumerator vec = findDocumentiPadre(); + if (vec.hasMoreElements()) + return true; + return false; + } + + public long getId_bancaAnticipo() { + return this.id_bancaAnticipo; + } + + public void setId_bancaAnticipo(long id_bancaAnticipo) { + this.id_bancaAnticipo = id_bancaAnticipo; + setBancaAnticipo(null); + } + + public Banca getBancaAnticipo() { + this.bancaAnticipo = (Banca)getSecondaryObject(this.bancaAnticipo, Banca.class, getId_bancaAnticipo()); + return this.bancaAnticipo; + } + + public void setBancaAnticipo(Banca bancaAnticipo) { + this.bancaAnticipo = bancaAnticipo; + } + + public void aggiornaFlgHasDocumentiPrelavabili() { + setFlgHasDocumentiPrelevabili(-1L); + super.save(); + } + + public double getQuantitaTotaleDocumento() { + if (getId_documento() == 0L) + return 0.0D; + return new RigaDocumento(getApFull()).getQuantitaTotaleByDocumento(getId_documento()); + } + + protected void creaDocumentoFooterFattureConTotaliNewDaTestare(Table l_pdfCorpo, boolean isUltimaPagina) { + int cellLeading = 8; + NumberFormat nf = getNf(); + RigheRegistroIva rri = getRigaRegistroIvaCompleto(); + String codIva = "", imponibile = "", aliquota = "", imposta = ""; + if (rri != null) { + Enumeration enuRrri = rri.elementsFatt(); + while (enuRrri.hasMoreElements()) { + RigaRegistroIvaItem rrii = enuRrri.nextElement(); + if (rrii.getImponibile() != 0.0D) { + if (getFlgArt8() == 1L) { + imponibile = imponibile + "\n" + imponibile; + imposta = imposta + "\n0"; + codIva = codIva + "\n" + codIva; + aliquota = aliquota + "\n" + aliquota; + continue; + } + imponibile = imponibile + "\n" + imponibile; + imposta = imposta + "\n" + imposta; + codIva = codIva + "\n" + codIva; + aliquota = aliquota + "\n" + aliquota; + } + } + } + try { + Cell cell = new Cell(new Chunk("ALIQ.", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(codIva, PdfFontFactory.PDF_fPiccolissimoB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setRowspan(4); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPONIBILE", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setRowspan(1); + l_pdfCorpo.addCell(cell); + if (isUltimaPagina) { + cell.add(new Chunk(imponibile, PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setRowspan(3); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPOSTA\t", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(imposta, PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + cell.setRowspan(4); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE MERCE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getImponibileRighe() != 0.0D) { + cell.add(new Chunk(nf.format(getImponibileRighe()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SCONTO INCONDIZIONATO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(nf.format(getScontoIncondizionato()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(9); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE NETTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getImponibileTotale() != 0.0D) { + cell.add(new Chunk(nf.format(getImponibileTotale()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SPESE TRASPORTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getSpeseTrasporto() != 0.0D) { + cell.add(new Chunk(nf.format(getSpeseTrasporto()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SPESE INCASSO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getSpeseIncasso() != 0.0D) { + cell.add(new Chunk(nf.format(getSpeseIncasso()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SPESE VARIE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getSpeseAltre() != 0.0D) { + cell.add(new Chunk(nf.format(getSpeseAltre()), PdfFontFactory.PDF_fPiccoloB)); + if (!getDescSpeseAltre().isEmpty()) + cell.add(new Chunk(" " + getDescSpeseAltre(), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(13); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SCADENZE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && !getNotePagamento().isEmpty()) { + cell.add(new Chunk(getNotePagamento(), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(23); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("PESO LORDO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getKgLordo() != 0.0D) { + cell.add(new Chunk(nf.format(getKgLordo()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("PESO NETTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getKgNetto() != 0.0D) { + cell.add(new Chunk(nf.format(getKgNetto()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("N. COLLI\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getNColli() != 0L) { + cell.add(new Chunk(nf.format(getNColli()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("Q.TA' ARTICOLI\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getQuantitaTotaleDocumento() != 0.0D) { + cell.add(new Chunk(nf.format(getQuantitaTotaleDocumento()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(8); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOT. IMPONIBILE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(nf.format(getImponibileTotale()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOT. IMPOSTA\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(nf.format(getImportoIvaTotale()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOT. ESENTE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina); + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("ACCONTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getAcconto() != 0.0D) { + cell.add(new Chunk(nf.format(getAcconto()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("ABBUONO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getAbbuono() != 0.0D) { + cell.add(new Chunk(nf.format(getAbbuono()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE DOCUMENTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getTotaleDocumento() != 0.0D) { + cell.add(new Chunk(nf.format(getTotaleDocumento()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e, 2); + } + } + + public boolean isPrelevata() { + if (getTipoDocumento().getFlgTipoDocumentoPrelevabile() == 0L || getTipoDocumento().getFlgObbligoPrelievo() == 0L) + return true; + return !(getFlgDocumentoPrelevato() == 0L); + } + + public long getFlgDocumentoPrelevatoPrecedente() { + return this.flgDocumentoPrelevatoPrecedente; + } + + public void setFlgDocumentoPrelevatoPrecedente(long flgDocumentoPrelevatoPrecedente) { + this.flgDocumentoPrelevatoPrecedente = flgDocumentoPrelevatoPrecedente; + } + + public String getPagamentiHtml() { + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + StringBuilder html = new StringBuilder(); + NumberFormat nf = NumberFormat.getInstance(); + nf.setMaximumFractionDigits(2); + nf.setMinimumFractionDigits(2); + html.append(""); + html.append("Data: "); + html.append(""); + html.append(""); + html.append("Importo: "); + html.append(""); + html.append(""); + html.append("Tipo pagamento: "); + html.append(""); + html.append(""); + html.append("Nota "); + html.append(""); + DocumentoPagamento dp = new DocumentoPagamento(getApFull()); + Vectumerator vec = dp.findByDocumento(getId_documento()); + while (vec.hasMoreElements()) { + dp = (DocumentoPagamento)vec.nextElement(); + html.append(""); + html.append(df.format(dp.getData())); + html.append(""); + html.append(""); + html.append(nf.format(Math.abs(dp.getImporto()))); + html.append(""); + html.append(""); + html.append(dp.getTipoPagamento().getDescrizione()); + html.append(""); + html.append(""); + html.append(dp.getNota()); + html.append(""); + } + return html.toString(); + } + + public void impostaPagato(Date data) { + if (getFlgPagata() == 0L || getDataPagamento() != data) { + setFlgPagata(1L); + setDataPagamento(data); + superSave(); + } + if (isFatturaONotaDiCredito()) { + DocumentoPagamento pag = new DocumentoPagamento(getApFull()); + double saldoPagamenti = pag.getSaldoRateByDocumento(getId_documento()); + DoubleOperator dp = new DoubleOperator(getTotaleDocumento()); + dp.subtract(Math.abs(saldoPagamenti)); + if (dp.getResult() > 0.0D) { + pag.setId_documento(getId_documento()); + pag.setData((data == null) ? getToday() : data); + pag.setImporto(dp.getResult()); + pag.setFlgTipoMovimento(3L); + pag.setFlgTipoIncasso(1L); + pag.save(); + } + } + } + + public void impostaNonPagato() { + setFlgPagata(0L); + setDataPagamento(null); + superSave(); + String sql = "DELETE FROM DOCUMENTO_PAGAMENTO WHERE id_documento = " + getId_documento() + " AND flgTipoMovimento = 3"; + update(sql); + } + + public ResParm delete() { + return super.delete(); + } + + public ResParm checkEMSTA() { + ResParm rp = new ResParm(true); + if (getTmstInvioXml() != null) { + rp.setStatus(false); + rp.setMsg("Attenzione! File XML fattura elettronica impostato a inviato! Saranno salvati solo alcuni dati."); + return rp; + } + if (getFlgEmsta() == 0L && + getFlgStatoPrecedente() == 1L) { + if (getParm("BLOCCO_FATTURE_EMSTA").getNumeroLong() == 1L) { + rp.setStatus(false); + rp.setMsg("Attenzione! Fattura emessa! Saranno salvati solo alcuni dati."); + return rp; + } + if (getParm("BLOCCO_FATTURE_EMSTA").getNumeroLong() == 2L && getTmstStampato() != null) { + rp.setStatus(false); + rp.setMsg("Attenzione! Fattura stampata! Saranno salvati solo alcuni dati."); + return rp; + } + } + return rp; + } + + protected void creaDocumentoIntestazioneRicevutaOld(Table l_pdfCorpo) { + try { + String descCliente, descDestinazione; + int cellLeading = 8; + SimpleDateFormat df = getDataFormat(); + float imgLogoWidth = getDocLogoWidth(); + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + imgLogo.scaleToFit(imgLogoWidth, imgLogoWidth); + Cell cell = new Cell(); + cell.addElement(new Chunk(imgLogo, 0.0F, 0.0F)); + cell.addElement(new Chunk("\n" + getHeaderDoocumento(1) + "\n" + getHeaderDoocumento(2), PdfFontFactory.PDF_fPiccolo)); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(22); + l_pdfCorpo.addCell(cell); + if (getId_clifor() > 0L) { + descCliente = ""; + if (!getClienteNome().isEmpty() && !getClienteCognome().isEmpty() && !getClienteCf().isEmpty()) { + descCliente = getClienteCognome() + " " + getClienteCognome() + "\n"; + descCliente = descCliente + descCliente + "\n"; + } else if (getClifor().getpIva().isEmpty() && getClifor().getCodFisc().isEmpty() && getClifor().getCognome().isEmpty()) { + descCliente = "AUTOFATTURA\n"; + descCliente = descCliente + descCliente; + } else { + descCliente = descCliente + descCliente + "\n"; + descCliente = descCliente + descCliente; + if (!getClifor().getNumeroCivico().isEmpty()) + descCliente = descCliente + " n." + descCliente; + descCliente = descCliente + "\n" + descCliente + " " + getClifor().getCapComune(); + if (!getClifor().getProvinciaComune().isEmpty()) + descCliente = descCliente + " (" + descCliente + ")"; + if (!getClifor().getId_nazione().isEmpty()) + descCliente = descCliente + " " + descCliente; + } + } else { + descCliente = getNominativoDocumento(); + } + if (!getIndirizzoSped().isEmpty() && !getPresso().isEmpty()) { + descDestinazione = getClifor().getCognomeNome() + "\n"; + descDestinazione = descDestinazione + "c/o " + descDestinazione + "\n"; + descDestinazione = descDestinazione + descDestinazione + " n." + getIndirizzoSped() + "\n" + getNumeroCivicoSped() + " " + getCapSped() + " (" + getCittaSped() + ")"; + if (!getId_nazioneSped().isEmpty()) + descDestinazione = descDestinazione + " " + descDestinazione; + } else if (getId_destinazioneDiversa() == 0L) { + if (getParm("DESTINAZIONE").getNumeroLong() == 1L) { + descDestinazione = "IDEM\n\n"; + } else { + descDestinazione = ""; + } + } else { + descDestinazione = getClifor().getCognomeNome() + "\n"; + if (!getDestinazioneDiversa().getPressoDD().isEmpty()) + descDestinazione = descDestinazione + "c/o " + descDestinazione + "\n"; + descDestinazione = descDestinazione + descDestinazione + " n." + getDestinazioneDiversa().getIndirizzoDD() + "\n" + getDestinazioneDiversa().getNumeroCivicoDD() + " " + getDestinazioneDiversa().getCapComuneDD() + " (" + getDestinazioneDiversa().getDescrizioneComuneDD() + ")"; + if (!getDestinazioneDiversa().getId_nazioneDD().isEmpty()) + descDestinazione = descDestinazione + " " + descDestinazione; + } + cell = new Cell(); + cell.addElement(new Chunk("\n\nSPETT.LE\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(descCliente, PdfFontFactory.PDF_fGrande)); + if (!descDestinazione.isEmpty()) { + cell.addElement(new Chunk("\nDESTINAZIONE\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(descDestinazione, PdfFontFactory.PDF_fGrande)); + } + cell.setVerticalAlignment(4); + cell.setLeading(12.0F); + cell.setBorder(0); + cell.setRowspan(3); + cell.setColspan(18); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("TIPO DOCUMENTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (getFlgStato() == 0L) + cell.addElement(new Chunk("(B) ", PdfFontFactory.PDF_fMedioB)); + if (getFlgStato() == 2L) { + cell.addElement(new Chunk("FATTURA PROFORMA\n", PdfFontFactory.PDF_fPiccolissimoB)); + } else { + cell.addElement(new Chunk(getTipoDocumento().getDescrizioneStampa() + "\n", PdfFontFactory.PDF_fPiccoloB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("N. DOC.\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(String.valueOf(getNumeroDocumento()), PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(4); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("DATA\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(df.format(getDataDocumento()), PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Pag.\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(getNf0().format(getNumPagDocumento()), PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(4); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("xx", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + cell.setRowspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("RIF. INTERNO \n", PdfFontFactory.PDF_fPiccolissimo)); + if (!getDescrizioneDocumentiPadre().isEmpty()) { + cell.addElement(new Chunk(getDescrizioneDocumentiPadre(), PdfFontFactory.PDF_fPiccolissimo4)); + } else { + cell.addElement(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimoB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setMaxLines(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("COD. C/F\t\n", PdfFontFactory.PDF_fPiccolissimo)); + if (getClienteNome().isEmpty() && getClienteCognome().isEmpty() && getClienteCf().isEmpty()) + cell.addElement(new Chunk(String.valueOf(getClifor().getId_clifor()), PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(3); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("PARTITA IVA/CF\n", PdfFontFactory.PDF_fPiccolissimo)); + if (getClienteNome().isEmpty() && getClienteCognome().isEmpty() && getClienteCf().isEmpty()) { + cell.addElement(new Chunk(getClifor().getPIva() + " / " + getClifor().getPIva(), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.addElement(new Chunk(getClientePiva() + " / " + getClientePiva(), PdfFontFactory.PDF_fPiccoloB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(11); + l_pdfCorpo.addCell(cell); + creaDocumentoIntestazioneCorpoRicevuta(l_pdfCorpo); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoCorpoRicevuta(Document l_document, Table l_pdfCorpo) { + int righePerPagina = (int)getTipoDocumento().getRighePerPagina(); + if (righePerPagina <= 0) + righePerPagina = 10; + int maxCarDesc = (int)getTipoDocumento().getMaxCarDesc(); + if (maxCarDesc == 0) + maxCarDesc = 35; + int riga = 0; + int cellLeadingRow = getDocLeadRow(); + if (cellLeadingRow == 0) + cellLeadingRow = 12; + Font PDF_frow = getTipoDocumento().getPdfFontRow(); + Font PDF_frowSmall = getTipoDocumento().getPdfFontRowSmall(); + NumberFormat nf = getNf(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + try { + String s_note; + long resHasUsato = hasRigheConUsato(); + if (!getPudoId().isEmpty()) { + s_note = "Fermo Point BRT\n" + getPudoDesc() + "\n" + getNote(); + } else { + s_note = getNote(); + } + if (resHasUsato == 1L || resHasUsato == 2L || resHasUsato == 5L || resHasUsato == 6L) { + Iva ivaRM = new Iva(getApFull()); + ivaRM.findByPrimaryKey(getCodiceIvaRegimeMargine()); + s_note = s_note + "\n" + s_note; + } + ArrayList alNote = RigaDocumentoItemPdf.getArrayListNota(s_note, 0, cols_RICEVUTA_, PDF_frow); + if (getDocPosizioneNota() == 0L) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + while (vec.hasMoreElements()) { + String desc, descQta; + double prezzoUnitarioConIva, importoRigaConIva; + RigaDocumento row = (RigaDocumento)vec.nextElement(); + double quantita = row.getQuantita(); + if (row.getSconto() > 0.0D) { + String scontoS = nf.format(row.getSconto()); + } else { + String scontoS = ""; + } + if (!row.getIva().getFlgTipo().equals("R")) { + desc = row.getDescrizioneRiga(); + if (!row.getSeriale().isEmpty()) { + String temp = row.getSeriale().replace("\n", ""); + temp = temp.replace("\r", ""); + desc = desc + "\nS/N " + desc; + } + if (row.getArticolo().isSuperGaranzia()) + desc = desc + " - Supergaranzia"; + prezzoUnitarioConIva = row.getImportoConSconto(); + importoRigaConIva = row.getTotImportoRigaConSconto(); + } else { + desc = row.getDescrizioneRiga(); + if (!row.getSeriale().isEmpty()) { + String temp = row.getSeriale().replace("\n", ""); + temp = temp.replace("\r", ""); + desc = desc + "\nS/N " + desc; + } + if (row.getArticolo().isSuperGaranzia()) + desc = desc + " - Supergaranzia"; + prezzoUnitarioConIva = row.getImportoConSconto(); + importoRigaConIva = row.getTotImportoRigaConSconto(); + } + if (row.getSeriale().isEmpty() && !row.getArticolo().getNMatricola().isEmpty()) + desc = desc + " Mat. N. " + desc; + if (!row.getNotaBarcode().isEmpty()) + desc = desc + " - " + desc; + String codIva = row.getIva().getDescrizioneRigaStampaAuto(); + if (!row.getNotaRigaDocumento().isEmpty()) + desc = desc + " " + desc; + if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() != 1L) { + if (isQuantitaMagazzinoIntere()) { + descQta = row.getUdm() + " " + row.getUdm(); + } else { + descQta = row.getUdm() + " " + row.getUdm(); + } + } else if (isQuantitaMagazzinoIntere()) { + descQta = getNf0().format(quantita); + } else { + descQta = nf.format(quantita); + } + ArrayList dati = new ArrayList<>(); + dati.add(new RigaDocumentoItemPdf(cols_RICEVUTA_[0], desc, PDF_frow)); + dati.add(new RigaDocumentoItemPdf(cols_RICEVUTA_[1], descQta, PDF_frow, 2)); + dati.add(new RigaDocumentoItemPdf(cols_RICEVUTA_[2], nf.format(prezzoUnitarioConIva), PDF_frow, 2)); + dati.add(new RigaDocumentoItemPdf(cols_RICEVUTA_[3], nf.format(importoRigaConIva), PDF_frow, 2)); + riga = inserisciRigaDocumento(dati, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + } + if (getDocPosizioneNota() == 1L && !s_note.isEmpty()) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + if (righePerPagina - riga > 0) + riga = inserisciRigheVuote(righePerPagina - riga, cols_RICEVUTA_, riga, l_document, l_pdfCorpo, cellLeadingRow); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoCorpoRicevutaOld(Document l_document, Table l_pdfCorpo) { + long bordoColonne = getTipoDocumento().getFlgBordoColonna(); + long bordoRighe = getTipoDocumento().getFlgBordoRiga(); + String coloreBordo = getTipoDocumento().getColoreBordoInterno(); + int righePerPagina = (int)getTipoDocumento().getRighePerPagina(); + int maxCarDesc = (int)getTipoDocumento().getMaxCarDesc(); + if (maxCarDesc == 0) + maxCarDesc = 35; + int riga = 0; + int cellLeadingRow = getDocLeadRow(); + if (cellLeadingRow == 0) + cellLeadingRow = 12; + Font PDF_frow = getTipoDocumento().getPdfFontRow(); + Font PDF_frowSmall = getTipoDocumento().getPdfFontRowSmall(); + NumberFormat nf = getNf(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + int colonneDesc = 18; + int[] ncb = new int[0]; + int[] nca = { 8, 7, 7 }; + try { + String s_note = getNote(); + if (getDocPosizioneNota() == 0L) + riga = inserisciNoteDocumento(s_note, riga, righePerPagina, l_document, l_pdfCorpo, cellLeadingRow, maxCarDesc, colonneDesc, ncb, nca, PDF_frow, + vec.hasMoreElements()); + while (vec.hasMoreElements()) { + String desc; + double prezzoUnitarioConIva, importoRigaConIva; + RigaDocumento row = (RigaDocumento)vec.nextElement(); + double quantita = row.getQuantita(); + if (!row.getIva().getFlgTipo().equals("R")) { + desc = row.getDescrizioneRiga(); + prezzoUnitarioConIva = row.getImportoConSconto(); + importoRigaConIva = row.getTotImportoRigaConSconto(); + } else { + desc = "???"; + prezzoUnitarioConIva = row.getImportoConSconto(); + importoRigaConIva = row.getTotImportoRigaConSconto(); + } + if (!row.getNotaRigaDocumento().isEmpty()) + desc = desc + " " + desc; + riga = inserisciDescRigaDocumentoNew(desc, riga, righePerPagina, l_document, l_pdfCorpo, cellLeadingRow, maxCarDesc, colonneDesc, ncb, nca, PDF_frow, + vec.hasMoreElements()); + if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() != 1L) { + cell = new Cell(new Chunk(row.getArticolo().getTipo().getTipologiaArticolo().getUdm() + " " + row.getArticolo().getTipo().getTipologiaArticolo().getUdm(), PDF_frow)); + } else { + cell = new Cell(new Chunk(nf.format(quantita), PDF_frow)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeadingRow); + settaBordiEColori(cell, bordoColonne, bordoRighe, false, coloreBordo); + cell.setColspan(nca[0]); + l_pdfCorpo.addCell(cell); + Cell cell = new Cell(new Chunk("€ " + nf.format(prezzoUnitarioConIva), PDF_frow)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeadingRow); + settaBordiEColori(cell, bordoColonne, bordoRighe, false, coloreBordo); + cell.setColspan(nca[1]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("€ " + nf.format(importoRigaConIva), PDF_frow)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeadingRow); + settaBordiEColori(cell, bordoColonne, bordoRighe, false, coloreBordo); + cell.setColspan(nca[2]); + l_pdfCorpo.addCell(cell); + riga = incrementaNumRighe(riga, righePerPagina, l_document, l_pdfCorpo, vec.hasMoreElements()); + } + if (getDocPosizioneNota() == 1L && !s_note.isEmpty()) + riga = inserisciNoteDocumento(s_note, riga, righePerPagina, l_document, l_pdfCorpo, cellLeadingRow, maxCarDesc, colonneDesc, ncb, nca, PDF_frow, + vec.hasMoreElements()); + for (int i = riga; i < righePerPagina; i++) { + for (int k = 0; k < ncb.length; k++) { + Cell cell1 = new Cell(new Chunk(".", PdfFontFactory.PDF_fMedioBianco)); + cell1.setLeading((float)cellLeadingRow); + cell1.setBorder(0); + cell1.setColspan(ncb[k]); + l_pdfCorpo.addCell(cell1); + } + Cell cell = new Cell(new Chunk(".", PdfFontFactory.PDF_fMedioBianco)); + cell.setLeading((float)cellLeadingRow); + cell.setBorder(0); + cell.setColspan(colonneDesc); + l_pdfCorpo.addCell(cell); + for (int j = 0; j < nca.length; j++) { + cell = new Cell(new Chunk(".", PdfFontFactory.PDF_fMedioBianco)); + cell.setLeading((float)cellLeadingRow); + cell.setBorder(0); + cell.setColspan(nca[j]); + l_pdfCorpo.addCell(cell); + } + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoIntestazioneCorpoRicevuta(Table l_pdfCorpo) { + int cellLeading = 8; + try { + Cell cell = new Cell(); + cell.addElement(new Chunk("DESCRIZIONE", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_RICEVUTA_[0]); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("QUAN.", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_RICEVUTA_[1]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("PREZZO", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_RICEVUTA_[2]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPORTO", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_RICEVUTA_[3]); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoFooterRicevute(Table l_pdfCorpo, boolean isUltimaPagina) { + int cellLeading = 8; + NumberFormat nf = getNf(); + RigheRegistroIva rri = getRigaRegistroIvaCompleto(); + String codIva = "", imponibile = "", aliquota = "", imposta = ""; + if (rri != null) { + Enumeration enuRrri = rri.elementsFatt(); + while (enuRrri.hasMoreElements()) { + RigaRegistroIvaItem rrii = enuRrri.nextElement(); + if (rrii.getImponibile() != 0.0D) { + if (getFlgArt8() == 1L) { + imponibile = imponibile + "\n" + imponibile; + imposta = imposta + "\n0"; + codIva = codIva + "\n" + codIva; + aliquota = aliquota + "\n" + aliquota; + continue; + } + imponibile = imponibile + "\n" + imponibile; + imposta = imposta + "\n" + imposta; + codIva = codIva + "\n" + codIva; + aliquota = aliquota + "\n" + aliquota; + } + } + } + try { + Cell cell = new Cell(new Chunk("SPESE TRASPORTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getSpeseTrasportoConIva() != 0.0D) { + cell.add(new Chunk(nf.format(getSpeseTrasportoConIva()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SPESE INCASSO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getSpeseIncassoConIva() != 0.0D) { + cell.add(new Chunk(nf.format(getSpeseIncassoConIva()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SPESE VARIE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getSpeseAltre() != 0.0D) { + cell.add(new Chunk(nf.format(getSpeseAltreConIva()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SCONTI E ABBUONI\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getTotaleScontiAbbuoni() != 0.0D) { + cell.add(new Chunk(nf.format(getTotaleScontiAbbuoniConIva()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("Q.TA' ARTICOLI\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getQuantitaTotaleDocumento() != 0.0D) { + cell.add(new Chunk(nf.format(getQuantitaTotaleDocumento()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE DOCUMENTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getTotaleDocumento() != 0.0D) { + cell.add(new Chunk(nf.format(getTotaleDocumento()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e, 2); + } + } + + public long getFlgSuper() { + return this.flgSuper; + } + + public void setFlgSuper(long flgSuper) { + this.flgSuper = flgSuper; + } + + protected void creaDocumentoFooterFattureConPesiEColli(Table l_pdfCorpo, boolean isUltimaPagina) { + int cellLeading = 8; + NumberFormat nf = getNf(); + RigheRegistroIva rri = getRigaRegistroIvaCompleto(); + String codIva = "", imponibile = "", aliquota = "", imposta = ""; + if (rri != null) { + Enumeration enuRrri = rri.elementsFatt(); + while (enuRrri.hasMoreElements()) { + RigaRegistroIvaItem rrii = enuRrri.nextElement(); + if (rrii.getImponibile() != 0.0D) { + if (getFlgArt8() == 1L) { + imponibile = imponibile + "\n" + imponibile; + imposta = imposta + "\n0"; + codIva = codIva + "\n" + codIva; + aliquota = aliquota + "\n" + aliquota; + continue; + } + imponibile = imponibile + "\n" + imponibile; + imposta = imposta + "\n" + imposta; + codIva = codIva + "\n" + codIva; + aliquota = aliquota + "\n" + aliquota; + } + } + } + try { + Cell cell = new Cell(new Chunk("ALIQ.", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(codIva, PdfFontFactory.PDF_fPiccolissimoB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setRowspan(4); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPONIBILE", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(imponibile, PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setRowspan(4); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPOSTA\t", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(imposta, PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + cell.setRowspan(4); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SCONTO INC.\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(nf.format(getScontoIncondizionato()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("ABBUONO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getAbbuono() != 0.0D) { + cell.add(new Chunk(nf.format(getAbbuono()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SPESE TRASPORTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getSpeseTrasporto() != 0.0D) { + cell.add(new Chunk(nf.format(getSpeseTrasporto()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE MERCE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getImponibileRighe() != 0.0D) { + cell.add(new Chunk(nf.format(getImponibileRighe()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SPESE INCASSO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getSpeseIncasso() != 0.0D) { + cell.add(new Chunk(nf.format(getSpeseIncasso()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SPESE VARIE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getSpeseAltre() != 0.0D) { + cell.add(new Chunk(nf.format(getSpeseAltre()), PdfFontFactory.PDF_fPiccoloB)); + if (!getDescSpeseAltre().isEmpty()) + cell.add(new Chunk(" " + getDescSpeseAltre(), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(11); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE NETTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getImponibileTotale() != 0.0D) { + cell.add(new Chunk(nf.format(getImponibileTotale()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SCADENZE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && !getNotePagamento().isEmpty()) { + cell.add(new Chunk(getNotePagamento(), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(23); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("PESO LORDO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getKgLordo() != 0.0D) { + cell.add(new Chunk(nf.format(getKgLordo()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("PESO NETTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getKgNetto() != 0.0D) { + cell.add(new Chunk(nf.format(getKgNetto()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("N. COLLI\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getNColli() != 0L) { + cell.add(new Chunk(nf.format(getNColli()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("Q.TA' ARTICOLI\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getQuantitaTotaleDocumento() != 0.0D) { + cell.add(new Chunk(nf.format(getQuantitaTotaleDocumento()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOT. ESENTE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina); + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOT. IMPONIBILE\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(nf.format(getImponibileTotale()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOT. IMPOSTA\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina) { + cell.add(new Chunk(nf.format(getImportoIvaTotale()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("ACCONTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getAcconto() != 0.0D) { + cell.add(new Chunk(nf.format(getAcconto()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE DOCUMENTO\n", PdfFontFactory.PDF_fPiccolissimo)); + if (isUltimaPagina && getTotaleDocumento() != 0.0D) { + cell.add(new Chunk(nf.format(getTotaleDocumento()), PdfFontFactory.PDF_fPiccoloB)); + } else { + cell.add(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(7); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e, 2); + } + } + + public String getClienteNome() { + return (this.clienteNome == null) ? "" : this.clienteNome; + } + + public void setClienteNome(String clienteNome) { + this.clienteNome = clienteNome; + } + + public String getClienteCognome() { + return (this.clienteCognome == null) ? "" : this.clienteCognome; + } + + public void setClienteCognome(String clienteCognome) { + this.clienteCognome = clienteCognome; + } + + public String getClienteIndirizzo() { + return (this.clienteIndirizzo == null) ? "" : this.clienteIndirizzo; + } + + public void setClienteIndirizzo(String clienteIndirizzo) { + this.clienteIndirizzo = clienteIndirizzo; + } + + public String getClienteCf() { + return (this.clienteCf == null) ? "" : this.clienteCf; + } + + public void setClienteCf(String clienteCf) { + this.clienteCf = clienteCf; + } + + public String getClientePiva() { + return (this.clientePiva == null) ? "" : this.clientePiva; + } + + public void setClientePiva(String clientePiva) { + this.clientePiva = clientePiva; + } + + public long getFlgEmsta() { + return this.flgEmsta; + } + + public void setFlgEmsta(long flgEmsta) { + this.flgEmsta = flgEmsta; + } + + public String getNotaSblocco() { + return (this.notaSblocco == null) ? "" : this.notaSblocco; + } + + public void setNotaSblocco(String notaSblocco) { + this.notaSblocco = notaSblocco; + } + + private Document creaReportUnaVendite(DocumentoCR CR, boolean soloCompatto) { + long l_id_tipoDocumento = CR.getId_tipoDocumento(); + if (l_id_tipoDocumento == 0L) + l_id_tipoDocumento = getId_docCassa(); + int rowCellLeading = 6; + NumberFormat nf3 = NumberFormat.getInstance(); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf0 = NumberFormat.getInstance(); + nf0.setMaximumFractionDigits(0); + nf0.setMinimumFractionDigits(0); + int col_4 = 0, col_99 = 0; + int col_1 = 2, col_2 = 11, col_3 = 5, col_98 = 3, col_5 = 4, col_6 = 2, col_7 = 3, col_8 = 4; + int col_97 = 2, col_96 = 2, col_95 = 2; + int cellLeading = 12; + String descCliente = "", descDocumento = ""; + DoubleOperator totArt = new DoubleOperator(); + DoubleOperator totVendita = new DoubleOperator(); + DoubleOperator totImportoChiusi = new DoubleOperator(); + DoubleOperator totImportoScontrino = new DoubleOperator(); + DoubleOperator totImportoFatDaSc = new DoubleOperator(); + DoubleOperator totImportoDDTDaSc = new DoubleOperator(); + DoubleOperator totQtaChiusi = new DoubleOperator(); + DoubleOperator totQtaScontrino = new DoubleOperator(); + DoubleOperator totQtaFatDaSc = new DoubleOperator(); + DoubleOperator totQtaDDTDaSc = new DoubleOperator(); + List lstCh = new ArrayList<>(); + List lstScont = new ArrayList<>(); + List lstFatt = new ArrayList<>(); + List lstDDT = new ArrayList<>(); + Hashtable htAcconti = new Hashtable<>(); + Hashtable htPag = new Hashtable(); + Hashtable htArticoli = new Hashtable(); + DoubleOperator dopAcc = new DoubleOperator(); + DoubleOperator totImp = new DoubleOperator(); + DoubleOperator totAcc = new DoubleOperator(); + DoubleOperator totAccEnt = new DoubleOperator(); + SimpleDateFormat df = getDataFormat(); + try { + Cell rigaVuota = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimo)); + rigaVuota.setVerticalAlignment(4); + rigaVuota.setHorizontalAlignment(0); + rigaVuota.setLeading((float)cellLeading); + rigaVuota.setBorder(0); + rigaVuota.setColspan(40); + rigaVuota.setRowspan(1); + String intestazioneReport = "Data: dal " + df.format(CR.getDataDocumentoDa()) + " al " + df.format(CR.getDataDocumentoA()); + if (CR.getId_tipo() != 0L) + intestazioneReport = intestazioneReport + " - Tipo: " + intestazioneReport; + creaIntestazioneReport(CR.getTipoReport(), intestazioneReport); + Cell cell = new Cell(new Chunk("Doc.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Articolo", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Cliente", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + if (col_4 > 0) { + cell = new Cell(new Chunk("N. Tel.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + if (col_99 > 0) { + cell = new Cell(new Chunk("Operatore", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_99); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("Tipo Doc.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_98); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Pag.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Pr. V.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Q.tà", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Tot.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Stampe", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_97); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Moduli", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_96); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("N.Gest", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_95); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.pdfcorpo.endHeaders(); + Vectumerator vec = new RigaDocumento(getApFull()).findVenditeGiornaliere(CR, l_id_tipoDocumento); + while (vec.hasMoreElements()) { + String nDoc, descPag, descOper, nTel; + DoubleOperator dopPag, dopQ, dopValore; + ArticoloGroup ag; + descCliente = ""; + descDocumento = ""; + RigaDocumento row = (RigaDocumento)vec.nextElement(); + totArt.add(row.getQuantita()); + totVendita.add(row.getTotImportoRigaConSconto()); + String descArticolo = row.getReparto().getDescrizione() + " - " + row.getReparto().getDescrizione() + "-" + row.getArticolo().getTipo().getDescrizione(); + if (row.getDocumento().getId_tipoDocumento() == getId_docCassa()) { + if (!row.getDocumento().isUnDocumentoFiglioCreato()) { + nDoc = row.getDocumento().getNumeroDocumentoCompleto(); + if (row.getDocumento().getEchoScontrino().equals("CHIUSO")) { + descDocumento = "NO SCONTRINO"; + } else { + descDocumento = "scontrino"; + } + descPag = row.getDocumento().getTipoPagamento().getDescrizione(); + } else { + Documento docFiglio = row.getDocumento().getDocumentoFiglioUno(); + nDoc = docFiglio.getNumeroDocumentoCompleto(); + descCliente = docFiglio.getClifor().getDescrizioneCompleta(); + descPag = docFiglio.getTipoPagamento().getDescrizione(); + } + if (!row.getNotaRigaDocumento().isEmpty()) { + if (!descCliente.isEmpty()) + descCliente = descCliente + " - "; + descCliente = descCliente + descCliente; + } + nTel = ""; + if (!row.getNotaBarcode().isEmpty()) + nTel = row.getNotaBarcode(); + descOper = ""; + if (row.getDocumento().getId_users() != 0L) + descOper = row.getDocumento().getUsers().getDescrizione(); + if (row.getDocumento().getEchoScontrino().equals("CHIUSO")) { + if (!lstCh.contains(row.getDocumento().getNumeroDocumento())) { + totQtaChiusi.add(1); + lstCh.add(row.getDocumento().getNumeroDocumento()); + } + totImportoChiusi.add(row.getTotImportoRigaConSconto()); + } else if (row.getDocumento().getTipoDocumento().getId_tipoDocumento() == 1L && + !row.getDocumento().isUnDocumentoFiglioCreato()) { + if (!lstScont.contains(row.getDocumento().getNumeroDocumento())) { + totQtaScontrino.add(1); + lstScont.add(row.getDocumento().getNumeroDocumento()); + } + totImportoScontrino.add(row.getTotImportoRigaConSconto()); + } else { + Documento docFiglio = row.getDocumento().getDocumentoFiglioUno(); + if (docFiglio.getTipoDocumento().getFlgTipologia() == 1L) { + if (!lstFatt.contains(row.getDocumento().getNumeroDocumento())) { + totQtaFatDaSc.add(1); + lstFatt.add(row.getDocumento().getNumeroDocumento()); + } + totImportoFatDaSc.add(row.getTotImportoRigaConSconto()); + } + if (docFiglio.getTipoDocumento().getFlgTipologia() == 0L) { + if (!lstDDT.contains(row.getDocumento().getNumeroDocumento())) { + totQtaDDTDaSc.add(1); + lstDDT.add(row.getDocumento().getNumeroDocumento()); + } + totImportoDDTDaSc.add(row.getTotImportoRigaConSconto()); + } + } + } else { + nDoc = row.getDocumento().getNumeroDocumentoCompleto(); + descCliente = row.getDocumento().getClifor().getDescrizioneCompleta(); + descDocumento = row.getDocumento().getTipoDocumento().getDescrizioneStampa(); + descPag = row.getDocumento().getTipoPagamento().getDescrizione(); + nTel = ""; + descOper = ""; + } + if (htPag.containsKey(descPag)) { + dopPag = (DoubleOperator)htPag.get(descPag); + } else { + dopPag = new DoubleOperator(); + } + dopPag.add(row.getTotImportoRigaConSconto()); + htPag.put(descPag, dopPag); + totImp.add(row.getTotImportoRigaConSconto()); + String descArticoloGroup = row.getReparto().getDescrizione(); + String agKey = descArticoloGroup; + if (htArticoli.containsKey(agKey)) { + ag = (ArticoloGroup)htArticoli.get(agKey); + dopQ = new DoubleOperator(ag.getQuantita()); + dopValore = new DoubleOperator(ag.getValore()); + } else { + ag = new ArticoloGroup(); + ag.setDescrizione(descArticoloGroup); + dopQ = new DoubleOperator(); + dopValore = new DoubleOperator(); + } + dopQ.add(row.getQuantita()); + dopValore.add(row.getTotImportoRigaConSconto()); + ag.setQuantita(dopQ.getResult()); + ag.setValore(dopValore.getResult()); + htArticoli.put(agKey, ag); + if (!soloCompatto) { + cell = new Cell(new Chunk(nDoc, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(descArticolo, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(descCliente, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + if (col_4 > 0) { + cell = new Cell(new Chunk(nTel, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + if (col_99 > 0) { + cell = new Cell(new Chunk(descOper, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_99); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk(descDocumento, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_98); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(descPag, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(row.getImporto()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(row.getQuantita()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + double totAcconti = getTotAccontiByDocumento(row.getId_documento()); + if (totAcconti > 0.0D) { + cell = new Cell(new Chunk(getNf().format(row.getTotImportoRigaConSconto()) + " *", PdfFontFactory.PDF_fPiccolissimo)); + if (!htAcconti.containsKey(nDoc)) { + dopAcc = new DoubleOperator(totAcconti); + htAcconti.put(nDoc, dopAcc); + } else { + dopAcc = new DoubleOperator(); + } + } else { + cell = new Cell(new Chunk(getNf().format(row.getTotImportoRigaConSconto()), PdfFontFactory.PDF_fPiccolissimo)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_97); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_96); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_95); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + } + cell = new Cell(new Chunk("TOTALI", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_99 + col_5 + col_6 + col_98); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totImp.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_8); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col_97 + col_96 + col_95); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + int corpoPadding = 2; + this.document.newPage(); + } catch (Exception e) { + handleDebug(e); + } + return this.document; + } + + public void creaFileCvs(DocumentoCR CR) { + try { + Vectumerator list = findByCR(CR, 0, 0); + CR.setFileName(getPathTmp() + "reportDocumenti_" + getPathTmp() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "Numero;Data;Tipo;Intestazione;Articolo;Stato;Anticipato;Imponibile;Importo;Doc. Padre;Doc. figlio;Pagamenti;Fatt. Elett"; + outCvsFile.writeLine("Criteri di ricerca: " + CR.getDescrizioneCR()); + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + Documento row = (Documento)list.nextElement(); + StringBuilder theLine = new StringBuilder(); + theLine.append(row.getNumeroDocumentoCompleto()); + theLine.append(SEP); + theLine.append(getDataFormat().format(row.getDataDocumento())); + theLine.append(SEP); + theLine.append(row.getTipoDocumento().getDescrizione()); + theLine.append(SEP); + if (row.getNominativoDocumento().isEmpty()) { + theLine.append(row.getClifor().getDescrizioneCompleta()); + } else { + theLine.append(row.getNominativoDocumento()); + } + theLine.append(SEP); + if (row.getId_articolo() != 0L) + theLine.append(row.getArticolo().getDescrizioneCompleta()); + theLine.append(SEP); + theLine.append(row.getStatoCompleto()); + theLine.append(SEP); + theLine.append(row.getBancaAnticipo().getDescrizione()); + theLine.append(SEP); + theLine.append(getNf().format(row.getImponibileTotaleConSegno())); + theLine.append(SEP); + theLine.append(getNf().format(row.getTotaleDocumentoConSegno())); + theLine.append(SEP); + theLine.append(row.getDocumentiPadreDesc()); + theLine.append(SEP); + theLine.append(row.getDocumentiFiglioDesc()); + theLine.append(SEP); + theLine.append(row.getTipoPagamento().getDescrizione()); + theLine.append(SEP); + if (row.getTmstInvioXml() == null) { + theLine.append(""); + } else { + theLine.append(row.getFEProgressivoFile() + " " + row.getFEProgressivoFile()); + } + theLine.append(SEP); + outCvsFile.writeLine(theLine.toString()); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + + public void creaFileArticoliCvs(DocumentoCR CR) { + try { + Vectumerator list = new RigaDocumento(getApFull()).findRigheReportArticoliCsv(CR); + CR.setFileName(getPathTmp() + "reportDocumentiArticoli_" + getPathTmp() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "DOCUMENTO;CODICE ARTICOLO;ARTICOLO;SERIALE;PREZZO VENDITA;Q.TA"; + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)list.nextElement(); + s1 = "\"" + row.getDocumento().getNumeroDocumento() + "\"" + SEP + "\"" + row.getArticolo().getCodice() + "\"" + SEP + "\"" + ((row.getId_articolo() > 0L) ? row.getArticolo().getDescrizioneCompleta() : (row.getDescrizioneRiga() + "*")) + "\"" + SEP + "\"" + row.getSeriale() + "\"" + SEP + getNf().format(row.getTotImportoRigaConSconto()) + SEP + getNf0().format(row.getQuantita()) + SEP; + outCvsFile.writeLine(s1); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + + public Date getDataRestituzioneAcconto() { + return this.dataRestituzioneAcconto; + } + + public void setDataRestituzioneAcconto(Date dataRestituzioneAcconto) { + this.dataRestituzioneAcconto = dataRestituzioneAcconto; + } + + public Vectumerator findParmTipiFattureVendita() { + Vectumerator ret = new Vectumerator(); + String parm = getParm("TIPO_FATTURE_VENDITA").getTesto(); + TipoDocumento td = new TipoDocumento(getApFull()); + if (!parm.isEmpty()) + for (String p : parm.split(",")) { + td = new TipoDocumento(getApFull()); + td.findByPrimaryKey(Long.parseLong(p)); + if (td.getDBState() == 1) + ret.add(td); + } + return ret; + } + + public Vectumerator findParmTipiFattureAcquisto() { + Vectumerator ret = new Vectumerator(); + String parm = getParm("TIPO_FATTURE_ACQUISTO").getTesto(); + TipoDocumento td = new TipoDocumento(getApFull()); + if (!parm.isEmpty()) + for (String p : parm.split(",")) { + td = new TipoDocumento(getApFull()); + td.findByPrimaryKey(Long.parseLong(p)); + if (td.getDBState() == 1) + ret.add(td); + } + return ret; + } + + public ResParm creaFattureDaLista(DocumentoCR CR) { + ResParm rp = new ResParm(true); + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Documento doc = (Documento)vec.nextElement(); + if (!doc.hasDocumentiFiglio()) + rp = doc.creaDocumentoFiglio(doc.getId_clifor(), CR.getId_tipoDocumentoF(), CR.getUsers(), true, + CR.getFlgTipoGenerazione()); + } + return rp; + } + + public void creaFileCvsRiparazioni(DocumentoCR CR) { + try { + SimpleDateFormat df = getApFull().getDataFormat(); + NumberFormat nf = getApFull().getNf(); + Vectumerator list = findByCR(CR, 0, 0); + CR.setFileName(getPathTmp() + "reportRiparazioni_" + getPathTmp() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + StringBuilder sb = new StringBuilder(); + String s1 = "Numero;Data;Intestazione;;Stato;Cauzione;Data avviso;Data chiusura;Operatore accettazione;Operatore chiusura"; + outCvsFile.writeLine(CR.getDescrizioneCR()); + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + Documento row = (Documento)list.nextElement(); + sb = new StringBuilder(); + sb.append(row.getNumeroDocumentoCompleto()); + sb.append(SEP); + sb.append(df.format(row.getDataDocumento())); + sb.append(SEP); + sb.append(row.getNominativoDocumento()); + sb.append(SEP); + sb.append(row.getDescrizioneRighe()); + sb.append(SEP); + sb.append(row.getStatoCompleto()); + sb.append(SEP); + sb.append(nf.format(row.getCauzione())); + sb.append(SEP); + sb.append(df.format(row.getDataAvviso())); + sb.append(SEP); + sb.append(df.format(row.getDataChiusura())); + sb.append(SEP); + sb.append(row.getUsers().getCognomeNome()); + sb.append(SEP); + sb.append(row.getUsersChiusura().getCognomeNome()); + outCvsFile.writeLine(sb.toString()); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + + public void creaFileCvsPrenotazioni(DocumentoCR CR) { + try { + SimpleDateFormat df = getApFull().getDataFormat(); + NumberFormat nf = getApFull().getNf(); + Vectumerator list = new Vectumerator(); + if (CR.getFlgStatoPrenotazioneArt() > -1L) { + list = findPrenotazioniByCR(CR); + } else { + list = findByCR(CR, 0, 0); + } + CR.setFileName(getPathTmp() + "reportPrenotazioni_" + getPathTmp() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + StringBuilder sb = new StringBuilder(); + String s1 = "Numero;Data;Intestazione;Oggetti;Stato;Acconto;Data avviso;Data chiusura;Operatore"; + outCvsFile.writeLine(CR.getDescrizioneCR()); + outCvsFile.writeLine(s1); + list.moveFirst(); + while (list.hasMoreElements()) { + Documento row = (Documento)list.nextElement(); + sb = new StringBuilder(); + sb.append(row.getNumeroDocumentoCompleto()); + sb.append(SEP); + sb.append(df.format(row.getDataDocumento())); + sb.append(SEP); + sb.append(row.getNominativoDocumento()); + sb.append(SEP); + if (CR.getFlgStatoPrenotazioneArt() > -1L) { + sb.append(row.getDescrizioneRighePrenotazione()); + } else { + sb.append(row.getDescrizioneRigheCompleta()); + } + sb.append(SEP); + sb.append(row.getStatoCompleto()); + sb.append(SEP); + sb.append(nf.format(row.getAcconto())); + sb.append(SEP); + sb.append(df.format(row.getDataAvviso())); + sb.append(SEP); + sb.append(df.format(row.getDataChiusura())); + sb.append(SEP); + sb.append(row.getUsers().getCognomeNome()); + outCvsFile.writeLine(sb.toString()); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + + public String getDescrizioneRighePrenotazione() { + return (this.descrizioneRighePrenotazione == null) ? "" : this.descrizioneRighePrenotazione; + } + + public Vectumerator findPrenotazioniByCR(DocumentoCR CR) { + long nRighe = 0L; + long nRigheScartate = 0L; + Vectumerator vec = new Documento(getApFull()).findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Documento doc = (Documento)vec.nextElement(); + RigaDocumento row = new RigaDocumento(getApFull()); + Vectumerator vecr = row.findByDocumento(doc.getId_documento(), 0L, "", 0, 0, 0); + nRighe = (long)vecr.size(); + nRigheScartate = 0L; + while (vecr.hasMoreElements()) { + row = (RigaDocumento)vecr.nextElement(); + long stato = row.getStatoPrenotazione(); + if (stato != CR.getFlgStatoPrenotazioneArt()) { + nRigheScartate++; + continue; + } + StringBuilder sb = new StringBuilder(); + sb.append(getNf().format(row.getQuantita())); + sb.append(" "); + sb.append(row.getDescrizioneRigaCompleta()); + sb.append(" "); + if (row.getId_articolo() != 0L) { + sb.append(getNf().format(row.getArticolo().getQuantitaEffettiva())); + sb.append(" "); + sb.append(getNf().format(row.getArticolo().getQuantita())); + sb.append(" "); + } + sb.append(" - "); + doc.setDescrizioneRighePrenotazione(doc.getDescrizioneRighePrenotazione() + doc.getDescrizioneRighePrenotazione()); + } + if (nRighe == nRigheScartate) + vec.remove(doc); + } + return vec; + } + + public void setDescrizioneRighePrenotazione(String descrizioneRighePrenotazione) { + this.descrizioneRighePrenotazione = descrizioneRighePrenotazione; + } + + public static final synchronized ResParm addRigaDocumentoMov(DocumentoInterface doc, RigaDocumento row) { + Movimento mov = new Movimento(doc.getApFull()); + double l_quantitaDisponibileMagPartenza = 0.0D; + double l_quantitaDisponibileTuttiMagazziniInterniEsterni = 0.0D; + double l_quantitaDisponibileMagazziniInterni = 0.0D; + long l_id_magFisicoPartenza = row.getDocumento().getId_magFisicoPartenza(); + long l_id_magFisicoArrivo = row.getDocumento().getId_magFisicoArrivo(); + ResParm rp = new ResParm(true); + RigaDocumento rowOnDb = new RigaDocumento(doc.getApFull()); + rowOnDb.findByPrimaryKey(row.getId_rigaDocumento()); + if (!row.getSeriale().trim().isEmpty() && row.getArticolo().getFlgSerialiMassivi() == 0L) { + row.setQuantita(1.0D); + row.setQuantitaUdm(1.0D); + } + if (rowOnDb.getDBState() == 1 && (rowOnDb.getId_articolo() != row.getId_articolo() || + rowOnDb.getId_articoloVariante() != row.getId_articoloVariante() || !rowOnDb.getSeriale().equals(row.getSeriale()))) { + rp = rowOnDb.delete(); + if (!rp.getStatus()) + return rp; + row.setId_rigaDocumento(0L); + row.setDBState(0); + } + if (row.getId_articolo() != 0L && l_id_magFisicoPartenza > 0L) { + mov.findDisponibilitaPuntuale(row.getId_articolo(), row.getId_articoloVariante(), row.getId_articoloTaglia(), row.getSeriale(), l_id_magFisicoPartenza, 0L); + l_quantitaDisponibileMagPartenza = mov.getQuantita(); + if (rowOnDb.getDBState() == 1) + l_quantitaDisponibileMagPartenza += rowOnDb.getQuantita(); + if (row.getArticolo().getTipo().getFlgTipoMagazzino() > 0L && + row.getArticolo().getTipo().getFlgTipoMagazzino() < 9L && row.getId_articolo() != 0L && l_id_magFisicoPartenza != 0L && + + row.getFlgReso() == 0L && l_quantitaDisponibileMagPartenza < row.getQuantita()) { + rp.setStatus(false); + rp.setMsg("Attenzione. Tentativo di utilizzare un articolo non disponibile"); + return rp; + } + } + if (row.getId_articolo() != 0L && l_id_magFisicoPartenza > 0L && + row.getDocumento().getMagFisicoPartenza().getFlgTipo() == 1L && + row.getArticolo().getTipo().getFlgTipoMagazzino() > 0L && + row.getArticolo().getTipo().getFlgTipoMagazzino() < 9L && row.getId_articolo() != 0L && + rowOnDb.getDBState() == 0 && row.getFlgReso() == 0L && row.getFlgIgnoraPrenotazione() == 0L) { + double totArticoliEffettivi = 0.0D; + if (row.getSeriale().isEmpty()) { + mov.findDisponibilitaPuntualeMagazziniInterni(row.getId_articolo(), row.getId_articoloVariante(), + row.getId_articoloTaglia(), null, 0L); + l_quantitaDisponibileMagazziniInterni = mov.getQuantita(); + totArticoliEffettivi = l_quantitaDisponibileMagazziniInterni - row.getTotArticoliImpegnati(row.getId_articolo(), row.getId_articoloVariante(), row.getId_articoloTaglia()); + } else { + RigaDocumento rd = new RigaDocumento(row.getApFull()); + rd.findRigaImpegnoBySeriale(row.getId_articolo(), row.getId_articoloVariante(), row.getSeriale()); + if (rd.getDBState() == 1) { + if (row.getFlgIgnoraPrenotazione() == 1L) { + rd.setSeriale(""); + rd.save(); + totArticoliEffettivi = 1.0D; + } else { + totArticoliEffettivi = 0.0D; + } + } else { + mov.findDisponibilitaPuntualeMagazziniInterni(row.getId_articolo(), row.getId_articoloVariante(), + row.getId_articoloTaglia(), null, 0L); + l_quantitaDisponibileMagazziniInterni = mov.getQuantita(); + totArticoliEffettivi = l_quantitaDisponibileMagazziniInterni - row.getTotArticoliImpegnati(row.getId_articolo(), row.getId_articoloVariante(), row.getId_articoloTaglia()); + } + if (totArticoliEffettivi <= 0.0D) { + rp.setStatus(false); + rp.setMsg("Attenzione. L'articolo è in magazzino ma non disponibile perchè risulta impegnato. "); + return rp; + } + } + } + if (l_id_magFisicoArrivo > 0L && ( + row.getDocumento().getMagFisicoArrivo().getFlgTipo() == 1L || + row.getDocumento().getMagFisicoArrivo().getFlgTipo() == 2L) && + !row.getSeriale().trim().isEmpty() && row.getArticolo().getTipo().getFlgTipoMagazzino() == 2L && + rowOnDb.getDBState() == 0) { + if (mov.getParm("SERIALI_UNIVOCI").isTrue()) { + mov.findDisponibilitaGlobaleMagazziniInterniEsterni(row.getId_articolo(), row.getSeriale(), 0L); + } else { + mov.findDisponibilitaPuntualeMagazziniInterniEsterni(row.getId_articolo(), row.getId_articoloVariante(), + row.getId_articoloTaglia(), row.getSeriale(), 0L); + } + l_quantitaDisponibileTuttiMagazziniInterniEsterni = mov.getQuantita(); + if (l_quantitaDisponibileTuttiMagazziniInterniEsterni >= 1.0D) { + rp.setStatus(false); + rp.setMsg("Attenzione. Stai inserendo un seriale già caricato in magazzino."); + return rp; + } + } + long l_numSeriali = 1L; + if (doc.getTipoDocumento().getFlgTipologia() != 3L && + row.getArticolo().getFlgSerialiMassivi() == 1L && row.getQuantita() > 1.0D) { + l_numSeriali = (long)row.getQuantita(); + row.setQuantita(1.0D); + row.setQuantitaUdm(1.0D); + } + for (int i = 0; (long)i < l_numSeriali; i++) { + RigaDocumento bean = new RigaDocumento(doc.getApFull()); + if (row.getId_rigaDocumento() != 0L) { + bean.findByPrimaryKey(row.getId_rigaDocumento()); + } else if (row.getId_articolo() != 0L && row.getFlgSingleLineArt() == 1L && ( + doc.getTipoDocumento().getFlgTipologia() == 3L || + doc.getTipoDocumento().getFlgTipologia() == 4L || + row.getArticolo().getTipo().getFlgTipoMagazzino() != 2L)) { + if (row.getId_articoloTaglia() != 0L) { + bean.findFirstByDocumentoArticoloTaglia(row.getId_documento(), row.getId_articoloTaglia()); + } else if (row.getId_articoloVariante() != 0L) { + bean.findFirstByDocumentoArticoloVariante(row.getId_documento(), row.getId_articoloVariante()); + } else if (row.getId_articolo() != 0L) { + bean.findFirstByDocumentoArticolo(row.getId_documento(), row.getId_articolo()); + } + row.setId_rigaDocumento(bean.getId_rigaDocumento()); + row.addQuantita(bean.getQuantita()); + } + row.setDBState(bean.getDBState()); + row.setQuantitaOld(bean.getQuantitaOld()); + row.setId_documento(doc.getId_documento()); + rp.append(row.save()); + if (!rp.getStatus()) + return rp; + if (l_numSeriali > 1L) + try { + long currentSeriale = Long.valueOf(row.getSeriale()); + currentSeriale++; + String newSeriale = zeroLeft(currentSeriale, row.getSeriale().length()); + row.setSeriale(newSeriale); + row.setId_rigaDocumento(0L); + row.setDBState(0); + } catch (Exception e) { + rp.setStatus(false); + rp.setMsg("Errore! seriale non numerico per carico massivo: " + row.getSeriale()); + return rp; + } + } + if (rp.getStatus()) + rp.setMsg(AbMessages.getMessage("SAVE_OK")); + return rp; + } + + public double getPercAgente() { + return this.percAgente; + } + + public void setPercAgente(double percAgente) { + this.percAgente = percAgente; + } + + public double getPercRespCommerciale() { + return this.percRespCommerciale; + } + + public void setPercRespCommerciale(double percRespCommerciale) { + this.percRespCommerciale = percRespCommerciale; + } + + public String getPathStampeDocumenti() { + if (getApFull() == null) + return ""; + if (getDataDocumento() != null) { + Calendar cal = Calendar.getInstance(); + cal.setTime(getDataDocumento()); + return getApFull().getAp().getResource("DOC_PATH") + getApFull().getAp().getResource("DOC_PATH") + "/"; + } + return getPathTmp(); + } + + public String getPathStampaDocumentoFull() { + if (getTmstFilePdf() == null) + setTmstFilePdf(getTimestamp()); + File pathDir = new File(getDocBase() + getDocBase()); + if (!pathDir.exists()) + pathDir.mkdirs(); + return getDocBase() + getDocBase() + getPathStampeDocumenti() + "_" + getNumeroDocumentoPdf() + ".pdf"; + } + + public Timestamp getTmstFilePdf() { + return this.tmstFilePdf; + } + + public void setTmstFilePdf(Timestamp tmstFilePdf) { + this.tmstFilePdf = tmstFilePdf; + } + + public boolean hasScadenzeSuRiba() { + return new DocumentoScadenza(getApFull()).hasScadenzaConRiba(getId_documento()); + } + + public Timestamp getTmstInvioMail() { + return this.tmstInvioMail; + } + + public void setTmstInvioMail(Timestamp tmstInvioMail) { + this.tmstInvioMail = tmstInvioMail; + } + + public ByteArrayOutputStream creaPdfEtichettePackingListZEBRA(String l_printer) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + int cellLeading = 6; + try { + Chunk destinazione; + String dim = getParm("LABEL_PK_LIST_SIZE").getTesto(); + long xx = Long.parseLong(dim.substring(0, dim.indexOf(','))); + long yy = Long.parseLong(dim.substring(dim.indexOf(',') + 1)); + Rectangle label = new Rectangle(getPdfPointSize(yy), getPdfPointSize(xx)); + this.document = new Document(label.rotate(), 2.0F, 2.0F, 2.0F, 2.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + creaPdfEtichettePackingListPreparaIntestazioneZebra(); + int numColli = 0; + long numTotColli = 0L; + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getArticolo().hasComponentiArticoli()) { + Vectumerator vecAac = row.getArticolo().getArticoliComponenti(); + numTotColli += (long)vecAac.getTotNumberOfRecords() * (long)row.getQuantita(); + continue; + } + numTotColli += (long)row.getQuantita(); + } + String sp = " "; + Font pdfTagliando = new Font(2, 14.0F, 1); + Chunk nome = new Chunk(sp + "Spett.le " + sp + "\n", pdfTagliando); + if (getId_destinazioneDiversa() == 0L) { + StringBuilder sb = new StringBuilder(sp); + sb.append(getClifor().getIndirizzo()); + sb.append(getClifor().getNumeroCivico()); + sb.append("\n"); + sb.append(sp); + sb.append(getClifor().getCapZona().isEmpty() ? getClifor().getCapComune() : getClifor().getCapZona()); + sb.append(" ("); + sb.append(getClifor().getProvinciaComune()); + sb.append(")"); + sb.append("\n"); + sb.append("\n"); + destinazione = new Chunk(sb.toString(), pdfTagliando); + } else { + destinazione = new Chunk(sp + sp + "\n" + getDestinazioneDiversa().getPressoDD() + sp + "\n\n", pdfTagliando); + } + vec.moveFirst(); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + for (int i = 0; (double)i < row.getQuantita(); i++) { + if (row.getId_articolo() > 0L) { + String descrizioneArticolo = row.getArticolo().getCodice() + "\n" + row.getArticolo().getCodice() + sp; + if (row.getId_articoloVariante() > 0L) + descrizioneArticolo = row.getArticolo().getCodice() + " " + row.getArticolo().getCodice() + "\n" + row.getArticoloVariante().getCodiceVariante() + sp + " " + row.getArticolo().getNome(); + if (row.getArticolo().hasComponentiArticoli()) { + Vectumerator vecAac = row.getArticolo().getArticoliComponenti(); + while (vecAac.hasMoreElements()) { + numColli++; + ArticoloArticoloComponente rowAac = (ArticoloArticoloComponente)vecAac.nextElement(); + Chunk descrizione = new Chunk(sp + sp + "\n" + descrizioneArticolo + sp + "\n", + PdfFontFactory.PDF_fMedioB); + Chunk colli = new Chunk(sp + " Collo " + sp + "/" + numColli + "\n", PdfFontFactory.PDF_fMedioB); + Paragraph p = new Paragraph(); + p.add(nome); + p.add(destinazione); + p.add(colli); + p.add(descrizione); + Cell cell = new Cell((Element)p); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + if (vecAac.hasMoreElements()) { + this.document.add((Element)this.pdfcorpo); + this.document.newPage(); + creaPdfEtichettePackingListPreparaIntestazioneZebra(); + } + } + } else { + numColli++; + Chunk descrizione = new Chunk(sp + sp + "\n", PdfFontFactory.PDF_fMedioB); + Chunk colli = new Chunk(sp + " Collo " + sp + "/" + numColli + "\n", PdfFontFactory.PDF_fMedioB); + Paragraph p = new Paragraph(); + p.add(nome); + p.add(destinazione); + p.add(colli); + p.add(descrizione); + Cell cell = new Cell((Element)p); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + } + } else { + String descrizioneArticolo = row.getDescrizioneRigaCompleta(); + numColli++; + Chunk descrizione = new Chunk(sp + sp + "\n", PdfFontFactory.PDF_fMedioB); + Chunk colli = new Chunk(sp + " Collo " + sp + "/" + numColli + "\n", PdfFontFactory.PDF_fMedioB); + Paragraph p = new Paragraph(); + p.add(nome); + p.add(destinazione); + p.add(colli); + p.add(descrizione); + Cell cell = new Cell((Element)p); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + } + if ((double)i < row.getQuantita() - 1.0D) { + this.document.add((Element)this.pdfcorpo); + this.document.newPage(); + creaPdfEtichettePackingListPreparaIntestazioneZebra(); + } + } + if (vec.hasMoreElements()) { + this.document.add((Element)this.pdfcorpo); + this.document.newPage(); + creaPdfEtichettePackingListPreparaIntestazioneZebra(); + } + } + this.document.add((Element)this.pdfcorpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + private PdfPCell creaPdfEtichettePackingListPreparaIntestazioneCellaA4(float fixedHeight) { + String sp = ""; + int cellLeading = 18, cellLeading2 = 0; + int paddingLeft = 10; + PdfPCell cell = new PdfPCell(); + cell.setFixedHeight(fixedHeight); + try { + float imgLogoWidth = getDocLogoWidth(); + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + imgLogo.scaleToFit(imgLogoWidth - 70.0F, imgLogoWidth - 70.0F); + cell.addElement(new Chunk(imgLogo, 2.0F, -imgLogo.getScaledHeight() + 12.0F)); + cell.addElement(new Chunk("\n\n" + sp + "Mittente:,", PdfFontFactory.PDF_fPiccolo)); + Paragraph paragraph = creaParagrafoConGrassetto(sp + sp + getHeaderDoocumento(1) + sp, PDF_fPiccolo, PDF_fPiccoloB); + paragraph.setLeading(10.0F); + cell.addElement((Element)paragraph); + cell.setBorder(0); + cell.setPaddingLeft((float)paddingLeft); + cell.setPaddingRight((float)paddingLeft); + cell.setColspan(1); + } catch (Exception e) { + e.printStackTrace(); + } + return cell; + } + + public String getElencoScadenze() { + StringBuilder sb = new StringBuilder(); + if (getId_documento() > 0L) { + DocumentoScadenza scadenza = new DocumentoScadenza(getApFull()); + Vectumerator vec = scadenza.findByDocumento(getId_documento()); + if (vec.hasMoreElements()) + while (vec.hasMoreElements()) { + scadenza = (DocumentoScadenza)vec.nextElement(); + if (sb.length() > 0) + sb.append(" - "); + sb.append(getDataFormat().format(scadenza.getDataScadenza())); + sb.append(" "); + sb.append(getNf().format(scadenza.getImportoScadenza())); + } + } + return sb.toString(); + } + + public Vectumerator getElencoScadenze(DocumentoPagamentoCR CR) { + DocumentoScadenza scadenza = new DocumentoScadenza(getApFull()); + DocumentoScadenzaCR CRDS = new DocumentoScadenzaCR(); + CRDS.setId_documento(getId_documento()); + CRDS.setDataScadenzaDa(CR.getDataScadenzaDa()); + CRDS.setDataScadenzaA(CR.getDataScadenzaA()); + return scadenza.findByCR(CRDS, 0, 0); + } + + public ResParm sendOrderMailMessageRavinale(String lang, boolean mailAdmin, boolean mailUser, boolean isPagamentoVariato) { + ResParm rp = new ResParm(true); + mailAdmin = false; + String urlBase = getParm("CODA_MESSAGGI_IMG_URL_BASE").getTesto() + "_img/_imgArt/_var/80/"; + MailProperties mp = new MailProperties(); + if (getId_documento() == 0L) { + rp.setStatus(false); + rp.setMsg("ERRORE! Codice Documento nullo! contattare l'amministratore del sito"); + handleDebug(rp.getMsg(), 0); + return rp; + } + try { + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + String subject = getMailSubject(); + NumberFormat nf = getNf(); + String notePagamento = "", statoPagamento = ""; + String notaStato = " " + translate("in lavorazione", lang) + " "; + String orderLine = ""; + String orderLine2 = ""; + DoubleOperator totaleCosto = new DoubleOperator(); + double totaleQta = 0.0D; + statoPagamento = translate("Metodo di pagamento scelto", lang) + ": " + translate("Metodo di pagamento scelto", lang); + if (getStatoPagato() == 1L) + statoPagamento = statoPagamento + "
" + statoPagamento + translate("Transazione n. ", lang) + " " + getDescTransaction() + " " + translate("del", lang); + if (getStatoPagato() == 2L) + statoPagamento = statoPagamento + "
" + statoPagamento + ": " + translate("Data Pagamento", lang); + Users l_user = getClifor().getUserWww(); + String linkOrdineDiretto = ""; + if (l_user.isProfileNoReg()) { + linkOrdineDiretto = "
" + translate("Per accedere direttamente all'ordine: ", lang); + linkOrdineDiretto = linkOrdineDiretto + "" + getLinkOrdineWwwNoReg(l_user) + ""; + } + if (l_user.isProfileNoReg()) { + linkOrdineDiretto = "
" + translate("Per accedere direttamente all'ordine: ", lang); + linkOrdineDiretto = linkOrdineDiretto + "" + getLinkOrdineWwwNoReg(l_user) + ""; + } else { + linkOrdineDiretto = "
" + translate("Per accedere direttamente all'ordine: ", lang); + linkOrdineDiretto = linkOrdineDiretto + "" + getLinkOrdineWww() + ""; + } + if (getStatoPagato() == 0L) { + if (getFlgProcediPagamento() == 1L) { + notePagamento = getTipoPagamento().getMsgMailProcedi(lang); + if (getTipoPagamento().getFlgTipoPagamento() != 5L); + notePagamento = notePagamento + notePagamento; + } else { + notePagamento = getTipoPagamento().getMsgMailAspetta(lang); + } + } else { + notePagamento = ""; + } + if (getFlgStatoOrdineWww() == 2L) + notaStato = translate(getParm("MSG_ORDINE_SPEDITO").getTesto(), lang); + if (mailUser || isPagamentoVariato) { + MailMessage mf = new MailMessage(getApFull(), getCheckOutMailMessage(lang)); + mf.setQuestionMark(false); + if (getFlgStatoOrdineWww() == 2L) { + if (getDataSpedizione() == null) + setDataSpedizione(DBAdapter.getToday()); + mf.setString("dataSpedizione", getDataFormat().format(getDataSpedizione())); + mf.setString("corriere", getVettore().getDescrizione()); + mf.setString("nColli", String.valueOf(getNColli())); + String temp = ""; + if (!getNotaSpedizione().isEmpty()) + temp = temp + "

" + temp; + mf.setString("notaContrassegno", temp); + if (!getVettore().getLinkTracking().isEmpty() && !getTrackingSpedizione().isEmpty()) { + String id_docCrypt = crypt(String.valueOf(getId_documento())); + String link = getVettore().getLinkTracking() + getVettore().getLinkTracking(); + String track = translate("Potra' verificare la spedizione al seguente", lang) + " link "; + mf.setString("tracking", track); + } + } + mf.setString("id_ordine", getNumeroDocumentoCompleto()); + mf.setString("stato", translate(getStatoOrdineWww(), lang)); + mf.setString("dataOrdine", getDataFormat().format(getDataDocumento())); + mf.setString("statoPagamento", statoPagamento); + mf.setString("notaPagamento", notePagamento); + mf.setLong("id_users", getClifor().getId_clifor()); + mf.setString("nominativo", getClifor().getCognome()); + mf.setString("nome", getClifor().getNome()); + mf.setString("cognome", getClifor().getCognome()); + mf.setString("indirizzo", getClifor().getIndirizzo()); + mf.setString("numero", getClifor().getNumeroCivico()); + String capComune = getClifor().getCapComune(); + if (!getClifor().getCapZona().isEmpty()) + capComune = getClifor().getCapZona(); + mf.setString("cap", capComune); + mf.setString("citta", getClifor().getDescrizioneComune()); + mf.setString("provincia", getClifor().getProvinciaComune()); + mf.setString("codfisc", getClifor().getCodFisc()); + mf.setString("codSDI", getClifor().getCodiceIdentificativoFE()); + mf.setString("pec", getClifor().getPec()); + mf.setString("piva", getClifor().getPIva()); + mf.setString("email", getClifor().getEMail()); + mf.setString("nazione", getClifor().getNazione().getDescrizione(lang)); + if (getIndirizzoSped().trim().equals("")) { + if (getPresso().isEmpty()) { + mf.setString("indirizzoSped", getClifor().getIndirizzo()); + } else { + mf.setString("indirizzoSped", getClifor().getIndirizzo() + " c/o " + getClifor().getIndirizzo()); + } + mf.setString("numeroSped", getClifor().getNumeroCivico()); + mf.setString("capSped", getClifor().getCapComune()); + mf.setString("cittaSped", getClifor().getDescrizioneComune()); + mf.setString("provinciaSped", getClifor().getProvinciaComune()); + mf.setString("nazioneSped", getClifor().getNazione().getDescrizione(lang)); + } else { + if (getPresso().isEmpty()) { + mf.setString("indirizzoSped", getIndirizzoSped()); + } else { + mf.setString("indirizzoSped", getIndirizzoSped() + " c/o " + getIndirizzoSped()); + } + mf.setString("numeroSped", getNumeroCivicoSped()); + mf.setString("capSped", getCapSped()); + mf.setString("cittaSped", getCittaSped()); + mf.setString("provinciaSped", getProvinciaSped()); + mf.setString("nazioneSped", getNazioneSped().getDescrizione(lang)); + } + Vectumerator enu = findRigheDocumento(0, 0, ordineInverso); + while (enu.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)enu.nextElement(); + orderLine = orderLine + " " + row.getArticoloVariante().getImgFileName(1) + "" + row.getDescrizioneRigaCompleta() + "" + row.getImportoConSconto() + "Eu " + row.getQuantita() + "\n"; + totaleQta += row.getQuantita(); + } + if (getSpeseAltre() > 0.0D) + orderLine = orderLine + "\n " + orderLine + "\n Eu " + getDescSpeseAltre() + "\n "; + mf.setString("orderline", orderLine); + if (getTotaleScontiAbbuoniConIva() > 0.0D) { + mf.setString("descSconto", "**** " + translate("SCONTO INCONDIZIONATO", lang) + " *****"); + mf.setString("scontoInc", " - " + nf.format(getTotaleScontiAbbuoniConIva())); + } + mf.setString("qta", nf.format(totaleQta)); + mf.setString("totale", nf.format(getImponibileTotale())); + mf.setString("totaleOrdine", nf.format(getTotaleDocumento())); + mf.setString("iva", nf.format(getImportoIvaTotale())); + mf.setString("speseSped", nf.format(getSpeseTrasportoConIva())); + if (getNotePagamento().isEmpty()) { + mf.setString("nota", String.valueOf(getNote())); + } else { + mf.setString("nota", "" + getNotePagamento() + "
" + String.valueOf(getNote())); + } + mf.setString("codiceOrdine", getNumeroDocumentoCompleto()); + mf.setString("telefono", getClifor().getCellulare()); + String theSubject = translate(subject, lang); + String l_email = getClifor().getEMail(); + if (mailUser) + theSubject = theSubject + " - " + theSubject + " " + translate("Ordine n.", lang) + " - " + getNumeroDocumentoCompleto(); + if (isPagamentoVariato) { + l_email = getMailTo(); + theSubject = theSubject + theSubject + " " + translate("Ordine n.", lang) + " - " + getNumeroDocumentoCompleto() + " - "; + theSubject = theSubject + theSubject; + theSubject = theSubject + theSubject; + } + mp.put("TO", l_email); + mp.setProperty("FROM", getParm("FROM").getTesto()); + if (this.flgWwwRichiedeFattura == 1L) + Vectumerator vectumerator = findDocumentiFiglio(); + if (hasDocumentiFiglio()) { + Documento fattura = getDocumentoFiglioUno(); + if (fattura.getId_documento() > 0L) { + DocumentoCR CRf = new DocumentoCR(getApFull()); + CRf.setId_documentoS(fattura.getId_documento()); + fattura.creaDocumentoPdf(CRf, true); + mp.put("FILES", CRf.getFilePdf()); + } + } + mp.put("SUBJECT", theSubject); + mp.put("MSG", mf.getMessage()); + mp.setProperty("ISHTML", "true"); + rp = sendMailMessage(mp); + } + if (mailAdmin) { + String mmfAdmMessage = getCheckOutMailMessage(lang); + MailMessage mfAdm = new MailMessage(getApFull(), mmfAdmMessage); + mfAdm.setQuestionMark(false); + mfAdm.setString("id_ordine", getNumeroDocumentoCompleto()); + mfAdm.setString("stato", getStato()); + mfAdm.setString("dataOrdine", getDataFormat().format(getDataDocumento())); + mfAdm.setString("statoPagamento", statoPagamento); + mfAdm.setString("notaPagamento", notePagamento); + mfAdm.setLong("id_users", getClifor().getId_clifor()); + mfAdm.setString("nominativo", getClifor().getCognome()); + mfAdm.setString("nome", getClifor().getNome()); + mfAdm.setString("cognome", getClifor().getCognome()); + mfAdm.setString("indirizzo", getClifor().getIndirizzo()); + mfAdm.setString("numero", getClifor().getNumeroCivico()); + mfAdm.setString("cap", getClifor().getCapComune()); + mfAdm.setString("citta", getClifor().getDescrizioneComune()); + mfAdm.setString("provincia", getClifor().getProvinciaComune()); + mfAdm.setString("codfisc", getClifor().getCodFisc()); + mfAdm.setString("piva", getClifor().getPIva()); + mfAdm.setString("email", getClifor().getEMail()); + if (getIndirizzoSped().trim().equals("")) { + if (getPresso().isEmpty()) { + mfAdm.setString("indirizzoSped", getClifor().getIndirizzo()); + } else { + mfAdm.setString("indirizzoSped", getClifor().getIndirizzo() + " c/o " + getClifor().getIndirizzo()); + } + mfAdm.setString("numeroSped", getClifor().getNumeroCivico()); + mfAdm.setString("capSped", getClifor().getCapComune()); + mfAdm.setString("cittaSped", getClifor().getDescrizioneComune()); + mfAdm.setString("provinciaSped", getClifor().getProvinciaComune()); + } else { + if (getPresso().isEmpty()) { + mfAdm.setString("indirizzoSped", getIndirizzoSped()); + } else { + mfAdm.setString("indirizzoSped", getIndirizzoSped() + " c/o " + getIndirizzoSped()); + } + mfAdm.setString("numeroSped", getNumeroCivicoSped()); + mfAdm.setString("capSped", getCapSped()); + mfAdm.setString("cittaSped", getCittaSped()); + mfAdm.setString("provinciaSped", getProvinciaSped()); + } + orderLine2 = ""; + totaleCosto = new DoubleOperator(); + totaleQta = 0.0D; + String stileRicarico = ""; + Vectumerator enu = findRigheDocumento(0, 0, ordineInverso); + while (enu.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)enu.nextElement(); + orderLine2 = orderLine2 + " " + row.getArticoloVariante().getImgFileName(1) + "" + row.getDescrizioneRigaCompleta() + "" + row.getImportoConSconto() + "Eu " + row.getQuantita() + "\n"; + DoubleOperator totaleArticolo = new DoubleOperator(row.getImponibile()); + totaleArticolo.multiply(row.getQuantita()); + totaleCosto.add(totaleArticolo); + totaleQta += row.getQuantita(); + } + mfAdm.setString("orderline", orderLine2); + mfAdm.setString("qta", nf.format(totaleQta)); + mfAdm.setString("iva", nf.format(getImportoIvaTotale())); + mfAdm.setString("speseSped", nf.format(getSpeseTrasporto())); + mfAdm.setString("totale", nf.format(getImponibileTotale())); + mfAdm.setString("totaleOrdine", nf.format(getTotaleDocumento())); + if (getNotePagamento().isEmpty()) { + mfAdm.setString("nota", String.valueOf(getNote())); + } else { + mfAdm.setString("nota", "" + getNotePagamento() + "
" + String.valueOf(getNote())); + } + mfAdm.setString("notaAmm", "Nota su cliente:" + + String.valueOf(getClifor().getNota() + "\nNota su Ordine: " + getClifor().getNota())); + mfAdm.setString("codiceOrdine", getNumeroDocumentoCompleto()); + mfAdm.setString("telefono", getClifor().getCellulare()); + mfAdm.setString("orderline", orderLine2); + mfAdm.setString("notaStato", notaStato); + String sbjAdmin = subject + " - Adm Ordine n. " + subject + " - " + String.valueOf(getId_ordine()) + " - "; + if (isPagamentoVariato) + sbjAdmin = sbjAdmin + "PAGAMENTO VARIATO "; + sbjAdmin = sbjAdmin + sbjAdmin; + String to = getMailTo(); + rp.append(mfAdm.sendMailMessageSystem(to, sbjAdmin, true)); + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e); + System.out.println("ERRORE INVIO EMAIL:"); + e.printStackTrace(); + } + if (!rp.getStatus()) { + handleDebug(rp.getMsg(), 2); + System.out.println("ERRORE INVIO EMAIL:" + rp.getMsg()); + } + return rp; + } + + public static final synchronized ResParm addRigaDocumentoFilato(Documento doc, RigaDocumento row) { + long l_id_magFisicoPartenza, l_id_magFisicoArrivo; + ResParm rp = doc.checkEMSTA(); + if (!rp.getStatus()) + return new ResParm(false, "ATTENZIONE! Tentativo di aggiungere una riga documento: " + rp.getMsg()); + RigaDocumento RD = new RigaDocumento(doc.getApFull()); + double l_quantitaDisponibileMagPartenza = 0.0D; + double l_quantitaDisponibileTuttiMagazziniInterniEsterni = 0.0D; + double l_quantitaDisponibileMagazziniInterni = 0.0D; + if (row.getFlgCodiceRiga() == 0L) { + l_id_magFisicoPartenza = row.getDocumento().getId_magFisicoPartenza(); + l_id_magFisicoArrivo = row.getDocumento().getId_magFisicoArrivo(); + } else { + l_id_magFisicoPartenza = row.getDocumento().getId_magFisicoPartenza2(); + l_id_magFisicoArrivo = row.getDocumento().getId_magFisicoArrivo2(); + } + rp = new ResParm(true); + RigaDocumento rowOnDb = new RigaDocumento(doc.getApFull()); + rowOnDb.findByPrimaryKey(row.getId_rigaDocumento()); + if (rowOnDb.getDBState() == 1 && (rowOnDb.getId_articoloFilatoColore() != row.getId_articoloFilatoColore() || + !rowOnDb.getSeriale().equals(row.getSeriale()))) { + rp = rowOnDb.delete(); + if (!rp.getStatus()) + return rp; + row.setId_rigaDocumento(0L); + row.setDBState(0); + } + if (row.getId_articoloFilatoColore() != 0L && l_id_magFisicoPartenza > 0L) { + RD.findMagFilatoDisponibilitaPuntuale(row.getId_articoloFilatoColore(), 0L, 0L, row.getSeriale(), l_id_magFisicoPartenza, 0L, 0L, ""); + l_quantitaDisponibileMagPartenza = RD.getQuantita(); + if (rowOnDb.getDBState() == 1) + l_quantitaDisponibileMagPartenza += rowOnDb.getQuantita(); + if (row.getArticoloFilatoColore().getArticoloFilato().getTipo().getFlgTipoMagazzino() > 0L && + row.getArticoloFilatoColore().getArticoloFilato().getTipo().getFlgTipoMagazzino() < 9L && + row.getId_articoloFilatoColore() != 0L && l_id_magFisicoPartenza != 0L && + row.getFlgReso() == 0L && l_quantitaDisponibileMagPartenza < row.getQuantita()) { + rp.setStatus(false); + rp.setMsg("Attenzione. Tentativo di utilizzare un articolo non disponibile"); + return rp; + } + } + if (row.getId_articoloFilatoColore() != 0L && l_id_magFisicoPartenza > 0L && + row.getDocumento().getMagFisicoPartenza().getFlgTipo() == 1L && + row.getArticoloFilatoColore().getArticoloFilato().getTipo().getFlgTipoMagazzino() > 0L && + row.getArticoloFilatoColore().getArticoloFilato().getTipo().getFlgTipoMagazzino() < 9L && + row.getId_articoloFilatoColore() != 0L && rowOnDb.getDBState() == 0 && + row.getFlgReso() == 0L && row.getFlgIgnoraPrenotazione() == 0L) { + double totArticoliEffettivi = 0.0D; + if (row.getSeriale().isEmpty()) { + RD.findMagFilatoDisponibilitaPuntualeMagazziniInterni(row.getId_articoloFilatoColore(), 0L, 0L, null); + l_quantitaDisponibileMagazziniInterni = RD.getQuantita(); + double totArticoliImpegnati = row.getTotFilatiImpegnati(row.getId_articoloFilatoColore(), 0L, 0L, ""); + totArticoliEffettivi = l_quantitaDisponibileMagazziniInterni - totArticoliImpegnati; + } else { + if (row.getArticoloFilatoColore().getArticoloFilato().getTipo().getFlgTipoMagazzino() != 2L) + if (row.getArticoloFilatoColore().getArticoloFilato().getTipo().getFlgTipoMagazzino() == 3L) { + RD.findMagFilatoDisponibilitaPuntualeMagazziniInterni(row.getId_articoloFilatoColore(), 0L, 0L, null); + l_quantitaDisponibileMagazziniInterni = RD.getQuantita(); + double totArticoliImpegnati = row.getTotFilatiImpegnati(row.getId_articoloFilatoColore(), 0L, 0L, row.getSeriale()); + totArticoliEffettivi = l_quantitaDisponibileMagazziniInterni - totArticoliImpegnati; + } else { + RD.findMagFilatoDisponibilitaPuntualeMagazziniInterni(row.getId_articoloFilatoColore(), 0L, 0L, null); + l_quantitaDisponibileMagazziniInterni = RD.getQuantita(); + double totArticoliImpegnati = row.getTotFilatiImpegnati(row.getId_articoloFilatoColore(), 0L, 0L, ""); + totArticoliEffettivi = l_quantitaDisponibileMagazziniInterni - totArticoliImpegnati; + } + if (totArticoliEffettivi <= 0.0D) { + rp.setStatus(false); + rp.setMsg("Attenzione. L'articolo è in magazzino ma non disponibile perchè risulta impegnato. "); + return rp; + } + } + } + if (l_id_magFisicoArrivo > 0L && ( + row.getDocumento().getMagFisicoArrivo().getFlgTipo() == 1L || + row.getDocumento().getMagFisicoArrivo().getFlgTipo() == 2L) && + !row.getSeriale().trim().isEmpty() && rowOnDb.getDBState() == 0) { + RD.findMagFilatoDisponibilitaPuntualeMagazziniInterniEsterni(row.getId_articoloFilatoColore(), 0L, 0L, row.getSeriale(), 0L); + l_quantitaDisponibileTuttiMagazziniInterniEsterni = RD.getQuantita(); + if (l_quantitaDisponibileTuttiMagazziniInterniEsterni >= 1.0D) { + rp.setStatus(false); + rp.setMsg("Attenzione. Stai inserendo un seriale già caricato in magazzino."); + return rp; + } + } + row.setId_documento(doc.getId_documento()); + rp.append(row.saveFilato()); + if (rp.getStatus() && + doc.getTipoDocumento().getFlgTipologia() == 201L) + rp.append(doc.aggiornaSerialeTessutoDisposizioneTessitura()); + return rp; + } + + public long getFlgWwwRichiedeFattura() { + return this.flgWwwRichiedeFattura; + } + + public void setFlgWwwRichiedeFattura(long flgWwwRichiedeFattura) { + this.flgWwwRichiedeFattura = flgWwwRichiedeFattura; + } + + public ByteArrayOutputStream creaPdfEtichettePackingListA4(DocumentoCR CR) { + long pHMarg = getParm("LABEL_PK_LIST_A4_MARGINE").getNumeroLong(); + int cellLeading = 6; + boolean stampaImmagineArticolo = false; + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + this.document = new Document(PageSize.A4, 2.0F, 2.0F, 2.0F, 2.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + String titoloReport = getNumeroDocumentoCompleto(); + SimpleDateFormat tf = new SimpleDateFormat("HH:mm:ss"); + Date today = getToday(); + titoloReport = titoloReport + ". Stampato il " + titoloReport + " " + getDataFormat().format(today); + this.document.open(); + int altezzaCod = 40; + int larghezzaCod = 300; + PdfContentByte cb = this.writer.getDirectContent(); + Barcode128 codeBar = new Barcode128(); + codeBar.setCodeType(9); + long labelNumber = 0L; + String dim = getParm("LABEL_PK_LIST_A4_COL_ROW").getTesto(); + int nCol = Integer.parseInt(dim.substring(0, dim.indexOf(','))); + int nRow = Integer.parseInt(dim.substring(dim.indexOf(',') + 1)); + float fixedHeight = (PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow - 4.0F; + this.pdfPcorpo = new PdfPTable(nCol); + this.pdfPcorpo.setWidthPercentage(100.0F); + Documento doc = new Documento(getApFull()); + doc.findByPrimaryKey(CR.getId_documentoS()); + if (CR.getBlankLabels() > 0L) { + PdfPCell cell = new PdfPCell(); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorder(0); + for (int i = 0; (long)i < CR.getBlankLabels(); i++) { + labelNumber++; + this.pdfPcorpo.addCell(cell); + } + } + Vectumerator vec = findByCR(CR, 0, 0); + long numbOfLabels = 1L; + while (vec.hasMoreElements()) { + Chunk destinazione; + Documento rowDoc = (Documento)vec.nextElement(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vecRighe = rowDoc.findRigheDocumento(0, 0, ordineInverso); + int numColli = 0; + long numTotColli = 0L; + while (vecRighe.hasMoreElements()) { + RigaDocumento rd = (RigaDocumento)vecRighe.nextElement(); + if (rd.getArticolo().hasComponentiArticoli()) { + Vectumerator vecAac = rd.getArticolo().getArticoliComponenti(); + numTotColli += (long)vecAac.getTotNumberOfRecords() * (long)rd.getQuantita(); + continue; + } + numTotColli += (long)rd.getQuantita(); + } + String sp = ""; + Font pdfTagliando = new Font(2, 12.0F, 1); + Chunk numDoc = new Chunk(sp + sp + " " + getTipoDocumento().getDescrizioneStampa() + " del " + getNumeroDocumento() + "\n", + PdfFontFactory.PDF_fPiccoloB); + Chunk nome = new Chunk(sp + "Spett.le\n" + sp + "\n", pdfTagliando); + if (getId_destinazioneDiversa() == 0L) { + StringBuilder sb = new StringBuilder(sp); + sb.append(getClifor().getIndirizzo()); + sb.append(getClifor().getNumeroCivico()); + sb.append("\n"); + sb.append(sp); + sb.append(getClifor().getCapZona().isEmpty() ? getClifor().getCapComune() : getClifor().getCapZona()); + sb.append(" ("); + sb.append(getClifor().getProvinciaComune()); + sb.append(")"); + sb.append("\n"); + sb.append("__________________________________________\n"); + destinazione = new Chunk(sb.toString(), pdfTagliando); + } else { + destinazione = new Chunk(sp + sp + "\n" + getDestinazioneDiversa().getPressoDD() + sp + "\n\n", pdfTagliando); + } + vecRighe.moveFirst(); + while (vecRighe.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRighe.nextElement(); + for (int i = 0; (double)i < row.getQuantita(); i++) { + if (row.getId_articolo() > 0L) { + String descrizioneArticolo = row.getArticolo().getCodice() + "\n" + row.getArticolo().getCodice() + sp; + if (row.getId_articoloVariante() > 0L) + descrizioneArticolo = row.getArticolo().getCodice() + "\n" + row.getArticolo().getCodice() + "\n" + row.getArticoloVariante().getCodiceVariante() + sp + " " + row.getArticolo().getNome(); + if (!row.getNotaRigaDocumento().isEmpty()) + descrizioneArticolo = descrizioneArticolo + ": " + descrizioneArticolo; + if (row.getArticolo().hasComponentiArticoli()) { + Vectumerator vecAac = row.getArticolo().getArticoliComponenti(); + while (vecAac.hasMoreElements()) { + numColli++; + ArticoloArticoloComponente rowAac = (ArticoloArticoloComponente)vecAac.nextElement(); + Chunk descrizione = new Chunk(sp + sp + "\n" + descrizioneArticolo + sp + "\n", + PdfFontFactory.PDF_fMedioB); + Chunk colli = new Chunk(sp + "Collo " + sp + "/" + numColli + "\n", PdfFontFactory.PDF_fMedioB); + Paragraph p = new Paragraph(); + p.add(numDoc); + p.add(nome); + p.add(destinazione); + p.add(colli); + p.add(descrizione); + StringBuilder pv = new StringBuilder(); + if (rowAac.getArticoloComponente().getPesoKg() > 0.0D) { + pv.append("Peso: Kg " + getNf().format(rowAac.getArticoloComponente().getPesoKg())); + pv.append(" "); + } + if (rowAac.getArticoloComponente().getVolumeM3() > 0.0D) + pv.append("Volume: mc " + getNf().format(rowAac.getArticoloComponente().getVolumeM3())); + if (pv.length() > 0) + p.add(new Chunk(pv.toString(), PdfFontFactory.PDF_fMedioB)); + PdfPCell pdfPCell = creaPdfEtichettePackingListPreparaIntestazioneCellaA4(fixedHeight); + pdfPCell.addElement((Element)p); + codeBar.setCode(row.getArticolo().getCodice() + " " + row.getArticolo().getCodice() + " " + row.getArticoloVariante().getCodiceVariante()); + Image imgBarcode = codeBar.createImageWithBarcode(cb, null, null); + imgBarcode.scaleToFit((float)larghezzaCod, (float)altezzaCod); + pdfPCell.addElement(new Chunk(imgBarcode, 1.0F, -50.0F)); + if (rowAac.getArticoloComponente().isImgExist(1) && stampaImmagineArticolo) { + Image imgArticolo = Image.getInstance(getDocBase() + getDocBase() + rowAac.getArticolo().getPathImg()); + imgArticolo.scaleToFit(100.0F, 100.0F); + pdfPCell.addElement(new Chunk(imgArticolo, 2.0F, -imgArticolo.getScaledHeight() - 10.0F)); + } + this.pdfPcorpo.addCell(pdfPCell); + labelNumber++; + } + } else { + numColli++; + Chunk descrizione = new Chunk(sp + sp + "\n", PdfFontFactory.PDF_fMedioB); + Chunk colli = new Chunk(sp + "Collo " + sp + "/" + numColli + "\n", PdfFontFactory.PDF_fMedioB); + Paragraph p = new Paragraph(); + p.add(numDoc); + p.add(nome); + p.add(destinazione); + p.add(colli); + p.add(descrizione); + StringBuilder pv = new StringBuilder(); + if (row.getArticolo().getPesoKg() > 0.0D) { + pv.append("Peso: Kg " + getNf().format(row.getArticolo().getPesoKg())); + pv.append(" "); + } + if (row.getArticolo().getVolumeM3() > 0.0D) + pv.append("Volume: mc " + getNf().format(row.getArticolo().getVolumeM3())); + if (pv.length() > 0) + p.add(new Chunk(pv.toString(), PdfFontFactory.PDF_fMedioB)); + PdfPCell pdfPCell = creaPdfEtichettePackingListPreparaIntestazioneCellaA4(fixedHeight); + pdfPCell.addElement((Element)p); + codeBar.setCode(row.getArticolo().getCodice() + " " + row.getArticolo().getCodice()); + Image imgBarcode = codeBar.createImageWithBarcode(cb, null, null); + imgBarcode.scaleToFit((float)larghezzaCod, (float)altezzaCod); + pdfPCell.addElement(new Chunk(imgBarcode, 1.0F, -50.0F)); + if (row.getArticoloVariante().isImgExist(1) && stampaImmagineArticolo) { + Image imgArticolo = Image.getInstance(getDocBase() + getDocBase() + row.getArticoloVariante().getPathImg()); + imgArticolo.scaleToFit(100.0F, 100.0F); + pdfPCell.addElement(new Chunk(imgArticolo, 10.0F, -imgArticolo.getScaledHeight() - 50.0F)); + } + this.pdfPcorpo.addCell(pdfPCell); + labelNumber++; + } + } else { + String descrizioneArticolo = row.getDescrizioneRigaCompleta(); + numColli++; + Chunk descrizione = new Chunk(sp + sp + "\n", PdfFontFactory.PDF_fMedioB); + Chunk colli = new Chunk(sp + "Collo " + sp + "/" + numColli + "\n", PdfFontFactory.PDF_fMedioB); + Paragraph p = new Paragraph(); + p.add(numDoc); + p.add(nome); + p.add(destinazione); + p.add(colli); + p.add(descrizione); + PdfPCell pdfPCell = creaPdfEtichettePackingListPreparaIntestazioneCellaA4(fixedHeight); + pdfPCell.addElement((Element)p); + this.pdfPcorpo.addCell(pdfPCell); + labelNumber++; + } + } + } + long numberBlankCell = (long)nCol - labelNumber % (long)nCol; + PdfPCell cell = new PdfPCell(); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorder(0); + if (numberBlankCell != (long)nCol) + for (int i = 0; (long)i < numberBlankCell; i++) + this.pdfPcorpo.addCell(cell); + this.document.add((Element)this.pdfPcorpo); + this.document.close(); + this.document = null; + } + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public int addLabelPkListA4Pdf(RigaDocumento row, int nRow, long numberOflabel, String l_descrizione) { + long pHMarg = 2L; + long l_indent = 4L; + int totNumbOflabel = 1; + try { + long numTotColli = 0L; + if (row.getArticolo().hasComponentiArticoli()) { + Vectumerator vecAac = row.getArticolo().getArticoliComponenti(); + numTotColli += (long)vecAac.getTotNumberOfRecords() * (long)row.getQuantita(); + } else { + numTotColli += (long)row.getQuantita(); + } + int altezzaCod = 50; + int larghezzaCod = 120; + PdfContentByte cb = this.writer.getDirectContent(); + Barcode128 codeBar = new Barcode128(); + codeBar.setCodeType(9); + codeBar.setCode("9898"); + Image imgBarcode = codeBar.createImageWithBarcode(cb, null, null); + imgBarcode.scaleToFit((float)larghezzaCod, (float)altezzaCod); + PdfPCell cell = new PdfPCell(); + cell.setBorder(0); + cell.addElement(new Chunk(imgBarcode, 20.0F, (float)(-altezzaCod + 10))); + cell.addElement(new Chunk("\n\n\n\n " + l_descrizione, PdfFontFactory.PDF_fPiccolissimo6)); + cell.setVerticalAlignment(4); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setIndent((float)l_indent); + } catch (Exception e) { + e.printStackTrace(); + } + return totNumbOflabel; + } + + private void creaPdfEtichettePackingListPreparaIntestazioneZebra() { + int cellLeading = 8; + try { + prepareNewPdfCorpoDocument(); + float imgLogoWidth = getDocLogoWidth(); + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + imgLogo.scaleToFit(imgLogoWidth - 10.0F, imgLogoWidth - 10.0F); + Cell cell = new Cell(); + cell.addElement(new Chunk(imgLogo, 0.0F, 0.0F)); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(18); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Mittente:,", PdfFontFactory.PDF_fPiccolo)); + Paragraph paragraph = creaParagrafoConGrassetto("\n" + getHeaderDoocumento(1) + "\n" + getHeaderDoocumento(2), PDF_fPiccolo, PDF_fPiccoloB); + paragraph.setLeading(10.0F); + cell.addElement((Element)paragraph); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(22); + this.pdfcorpo.addCell(cell); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public boolean isOrdineWwwFatturaObbligatoria() { + if (getClifor().getNazione().getFlgCee() == 0L) + return true; + return false; + } + + public boolean isOrdineWwwCodiceFiscaleObbligatorio() { + if (getId_tipoDocumento() == getId_docOrdineWWW()) { + if (getClifor().getNazione().getCodice().toLowerCase().equals(Locale.ITALY.getLanguage())) + return true; + return false; + } + return false; + } + + public boolean isOrdineWwwPagabile() { + if (getId_tipoDocumento() == getId_docOrdineWWW()) { + if (getFlgProcediPagamento() == 1L && getStatoPagato() == 0L && (!isOrdineWwwCodiceFiscaleObbligatorio() || ( + isOrdineWwwCodiceFiscaleObbligatorio() && !getClifor().getCodFisc().isEmpty()))) + return true; + return false; + } + return false; + } + + public boolean isFlgWwwRichiedeFatturaModificabile() { + if (getId_tipoDocumento() == getId_docOrdineWWW()) { + if (isOrdineWwwFatturaObbligatoria()) + return false; + if (hasDocumentiFiglio() || getStatoPagato() == 1L) + return false; + return true; + } + return false; + } + + public ByteArrayOutputStream creaDocumentoPdfMerge(DocumentoCR CR, boolean soloFile) { + if (CR.getId_documentoS() > 0L) + return creaDocumentoPdf(CR, soloFile); + CR.setFilePdf(getPathTmpFull() + "docs_" + getPathTmpFull() + ".pdf"); + Vectumerator vec = new Documento(getApFull()).findByCR(CR, 0, 0); + String[] args = new String[vec.getTotNumberOfRecords() + 1]; + int i = 0; + List listOfPdfFiles = new ArrayList<>(); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + String currentInputFile = row.getPathStampaDocumentoFull(); + if (!new File(currentInputFile).exists()) { + DocumentoCR CRrow = new DocumentoCR(getApFull()); + CRrow.setId_documentoS(row.getId_documento()); + System.out.println("Creo file " + currentInputFile); + creaDocumentoPdf(CRrow, soloFile); + } + args[i] = currentInputFile; + listOfPdfFiles.add(new File(currentInputFile)); + i++; + } + args[i] = CR.getFilePdf(); + if (this.document != null) { + this.document.close(); + this.document = null; + } + PDFMerger.concatenatePdfs(listOfPdfFiles, new File(CR.getFilePdf())); + return getByteArrayFromFile(CR.getFilePdf()); + } + + public boolean isCaricoConIva() { + if (getTipoDocumento().getFlgImportoIva() == 1L) + return true; + return false; + } + + public ResParm crontabJob(ApplParmFull ap) { + ResParm rp = new ResParm(true); + setApFull(ap); + rp.append(annullaOrdiniWebVecchi()); + System.out.println("Crontab ordini eseguita"); + return rp; + } + + public ResParm annullaOrdiniWebVecchi() { + ResParm rp = new ResParm(true); + int oreAnnullamento = getParm("ORDINI_WEB_ORE_ANNULLAMENTO").getNumeroInt(); + if (oreAnnullamento == 0) { + rp.setMsg("Annulla Ordini Web non pagati: oreAnnullamento a 0"); + return rp; + } + int numAnnullati = 0; + StringBuffer msg = new StringBuffer(); + DocumentoCR CR = new DocumentoCR(getApFull()); + CR.setId_tipoDocumento(getParm("ID_DOC_ORDINE_WWW").getNumeroLong()); + CR.setFlgPagata(0L); + Calendar cal = Calendar.getInstance(); + cal.add(12, -oreAnnullamento); + CR.setCreateTmst(new Timestamp(cal.getTimeInMillis())); + Vectumerator vec = findByCR(CR, 0, 0); + String lang = "it"; + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + Vectumerator vecUsers = row.getClifor().findUsers(1, 1); + if (vecUsers.hasMoreElements()) { + Users user = (Users)vecUsers.nextElement(); + if (!user.getLang().isEmpty()) + lang = user.getLang(); + } + rp = row.sendOrderDeleteMailMessage(lang, true, true); + if (rp.getStatus()) { + rp = row.delete(); + numAnnullati++; + } + } + msg.append("Tot Ordini Annullati: " + numAnnullati); + msg.append("\n Fine Annulla Ordini Web non pagati ---\n"); + rp.setMsg(msg.toString()); + return rp; + } + + public ResParm sendOrderDeleteMailMessage(String lang, boolean mailAdmin, boolean mailUser) { + ResParm rp = new ResParm(true); + mailAdmin = false; + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + String urlBase = getParm("CODA_MESSAGGI_IMG_URL_BASE").getTesto() + "_img/_imgArt/_var/80/"; + MailProperties mp = new MailProperties(); + if (getId_documento() == 0L) { + rp.setStatus(false); + rp.setMsg("ERRORE! Codice Documento nullo! contattare l'amministratore del sito"); + handleDebug(rp.getMsg(), 0); + return rp; + } + try { + String subject = "Ordine Annullato "; + NumberFormat nf = getNf(); + String notePagamento = "", statoPagamento = "", notaStato = " "; + String orderLine = ""; + String orderLine2 = ""; + DoubleOperator totaleCosto = new DoubleOperator(); + double totaleQta = 0.0D; + statoPagamento = translate("ORDINE ANNULLATO", lang); + notePagamento = ""; + if (mailUser) { + MailMessage mf = new MailMessage(getApFull(), getCheckOutMailMessage(lang)); + mf.setQuestionMark(false); + mf.setString("id_ordine", getNumeroDocumentoCompleto()); + mf.setString("stato", translate(getStatoOrdineWww(), lang)); + mf.setString("dataOrdine", getDataFormat().format(getDataDocumento())); + mf.setString("statoPagamento", statoPagamento); + mf.setString("notaPagamento", notePagamento); + mf.setLong("id_users", getClifor().getId_clifor()); + mf.setString("nominativo", getClifor().getCognome()); + mf.setString("nome", getClifor().getNome()); + mf.setString("cognome", getClifor().getCognome()); + mf.setString("indirizzo", getClifor().getIndirizzo()); + mf.setString("numero", getClifor().getNumeroCivico()); + String capComune = getClifor().getCapComune(); + if (!getClifor().getCapZona().isEmpty()) + capComune = getClifor().getCapZona(); + mf.setString("cap", capComune); + mf.setString("citta", getClifor().getDescrizioneComune()); + mf.setString("provincia", getClifor().getProvinciaComune()); + mf.setString("codfisc", getClifor().getCodFisc()); + mf.setString("piva", getClifor().getPIva()); + mf.setString("email", getClifor().getEMail()); + if (getIndirizzoSped().trim().equals("")) { + if (getPresso().isEmpty()) { + mf.setString("indirizzoSped", getClifor().getIndirizzo()); + } else { + mf.setString("indirizzoSped", getClifor().getIndirizzo() + " c/o " + getClifor().getIndirizzo()); + } + mf.setString("numeroSped", getClifor().getNumeroCivico()); + mf.setString("capSped", getClifor().getCapComune()); + mf.setString("cittaSped", getClifor().getDescrizioneComune()); + mf.setString("provinciaSped", getClifor().getProvinciaComune()); + } else { + if (getPresso().isEmpty()) { + mf.setString("indirizzoSped", getIndirizzoSped()); + } else { + mf.setString("indirizzoSped", getIndirizzoSped() + " c/o " + getIndirizzoSped()); + } + mf.setString("numeroSped", getNumeroCivicoSped()); + mf.setString("capSped", getCapSped()); + mf.setString("cittaSped", getCittaSped()); + mf.setString("provinciaSped", getProvinciaSped()); + } + Vectumerator enu = findRigheDocumento(0, 0, ordineInverso); + while (enu.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)enu.nextElement(); + orderLine = orderLine + " " + row.getArticoloVariante().getImgFileName(1) + "" + row.getDescrizioneRigaCompleta() + "" + row.getImportoConSconto() + "€" + row.getQuantita() + "\n"; + totaleQta += row.getQuantita(); + } + mf.setString("orderline", orderLine); + if (getTotaleScontiAbbuoniConIva() > 0.0D) { + mf.setString("descSconto", "**** " + translate("SCONTO INCONDIZIONATO", lang) + " *****"); + mf.setString("scontoInc", " - " + nf.format(getTotaleScontiAbbuoniConIva())); + } + mf.setString("qta", nf.format(totaleQta)); + mf.setString("totale", nf.format(getImponibileTotale())); + mf.setString("totaleOrdine", nf.format(getTotaleDocumento())); + mf.setString("iva", nf.format(getImportoIvaTotale())); + mf.setString("speseSped", nf.format(getSpeseTrasportoConIva())); + mf.setString("nota", String.valueOf(getNote())); + mf.setString("notaStato", notaStato); + mf.setString("codiceOrdine", getNumeroDocumentoCompleto()); + mf.setString("telefono", getClifor().getCellulare()); + String theSubject = translate(subject, lang); + String l_email = getClifor().getEMail(); + if (mailUser) + theSubject = theSubject + " - " + theSubject + " " + translate("Ordine n.", lang); + mp.put("TO", l_email); + mp.setProperty("FROM", getParm("FROM").getTesto()); + mp.put("SUBJECT", theSubject); + mp.put("MSG", mf.getMessage()); + mp.setProperty("ISHTML", "true"); + rp = sendMailMessage(mp); + } + if (mailAdmin) { + String mmfAdmMessage = getCheckOutMailMessage(lang); + MailMessage mfAdm = new MailMessage(getApFull(), mmfAdmMessage); + mfAdm.setQuestionMark(false); + mfAdm.setString("id_ordine", getNumeroDocumentoCompleto()); + mfAdm.setString("stato", getStato()); + mfAdm.setString("dataOrdine", getDataFormat().format(getDataDocumento())); + mfAdm.setString("statoPagamento", statoPagamento); + mfAdm.setString("notaPagamento", notePagamento); + mfAdm.setLong("id_users", getClifor().getId_clifor()); + mfAdm.setString("nominativo", getClifor().getCognome()); + mfAdm.setString("nome", getClifor().getNome()); + mfAdm.setString("cognome", getClifor().getCognome()); + mfAdm.setString("indirizzo", getClifor().getIndirizzo()); + mfAdm.setString("numero", getClifor().getNumeroCivico()); + mfAdm.setString("cap", getClifor().getCapComune()); + mfAdm.setString("citta", getClifor().getDescrizioneComune()); + mfAdm.setString("provincia", getClifor().getProvinciaComune()); + mfAdm.setString("codfisc", getClifor().getCodFisc()); + mfAdm.setString("piva", getClifor().getPIva()); + mfAdm.setString("email", getClifor().getEMail()); + if (getIndirizzoSped().trim().equals("")) { + if (getPresso().isEmpty()) { + mfAdm.setString("indirizzoSped", getClifor().getIndirizzo()); + } else { + mfAdm.setString("indirizzoSped", getClifor().getIndirizzo() + " c/o " + getClifor().getIndirizzo()); + } + mfAdm.setString("numeroSped", getClifor().getNumeroCivico()); + mfAdm.setString("capSped", getClifor().getCapComune()); + mfAdm.setString("cittaSped", getClifor().getDescrizioneComune()); + mfAdm.setString("provinciaSped", getClifor().getProvinciaComune()); + } else { + if (getPresso().isEmpty()) { + mfAdm.setString("indirizzoSped", getIndirizzoSped()); + } else { + mfAdm.setString("indirizzoSped", getIndirizzoSped() + " c/o " + getIndirizzoSped()); + } + mfAdm.setString("numeroSped", getNumeroCivicoSped()); + mfAdm.setString("capSped", getCapSped()); + mfAdm.setString("cittaSped", getCittaSped()); + mfAdm.setString("provinciaSped", getProvinciaSped()); + } + orderLine2 = ""; + totaleCosto = new DoubleOperator(); + totaleQta = 0.0D; + String stileRicarico = ""; + Vectumerator enu = findRigheDocumento(0, 0, ordineInverso); + while (enu.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)enu.nextElement(); + orderLine2 = orderLine2 + " " + row.getArticoloVariante().getImgFileName(1) + "" + row.getDescrizioneRigaCompleta() + "" + row.getImportoConSconto() + "€" + row.getQuantita() + "\n"; + DoubleOperator totaleArticolo = new DoubleOperator(row.getImponibile()); + totaleArticolo.multiply(row.getQuantita()); + totaleCosto.add(totaleArticolo); + totaleQta += row.getQuantita(); + } + mfAdm.setString("orderline", orderLine2); + mfAdm.setString("qta", nf.format(totaleQta)); + mfAdm.setString("iva", nf.format(getImportoIvaTotale())); + mfAdm.setString("speseSped", nf.format(getSpeseTrasporto())); + mfAdm.setString("totale", nf.format(getImponibileTotale())); + mfAdm.setString("totaleOrdine", nf.format(getTotaleDocumento())); + mfAdm.setString("nota", String.valueOf(getNote())); + mfAdm.setString("notaAmm", "Nota su cliente:" + + String.valueOf(getClifor().getNota() + "\nNota su Ordine: " + getClifor().getNota()) + "\nNota Mail: " + + getNotaMail()); + mfAdm.setString("codiceOrdine", getNumeroDocumentoCompleto()); + mfAdm.setString("telefono", getClifor().getCellulare()); + mfAdm.setString("orderline", orderLine2); + mfAdm.setString("notaStato", notaStato); + String sbjAdmin = subject + " - Adm Ordine n. " + subject + " - " + String.valueOf(getId_ordine()) + " - "; + sbjAdmin = sbjAdmin + sbjAdmin; + String to = getMailTo(); + rp.append(mfAdm.sendMailMessageSystem(to, sbjAdmin, true)); + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e); + System.out.println("ERRORE INVIO EMAIL:"); + e.printStackTrace(); + } + if (!rp.getStatus()) { + handleDebug(rp.getMsg(), 2); + System.out.println("ERRORE INVIO EMAIL:" + rp.getMsg()); + } + return rp; + } + + protected int inserisciNoteDocumento(String temp, int riga, int righePerPagina, Document l_document, Table l_pdfCorpo, int cellLeading, int maxCharLength, int numColonneDesc, int[] numColonneBefore, int[] numColonneAfter, Font theFont, boolean hasMoreRow) { + String indent = ""; + if (getTipoDocumento().getIndentNuovaRiga() > 0L) + indent = " ".substring(0, (int)getTipoDocumento().getIndentNuovaRiga()); + int rows = 0; + temp = temp.trim(); + temp = temp.replace("€", "€"); + int bordi = 0; + Color colore = Color.black; + long bordoColonne = getTipoDocumento().getFlgBordoColonna(); + long bordoRighe = getTipoDocumento().getFlgBordoRiga(); + String coloreBordo = getTipoDocumento().getColoreBordoInterno(); + try { + ArrayList res = convertStringToMultiline(temp, maxCharLength); + for (int j = 0; j < res.size(); j++) { + Cell cell; + boolean moreDesc; + String desc = res.get(j); + if (rows > 0) + desc = indent + indent; + if (j + 1 < res.size()) { + moreDesc = true; + } else { + moreDesc = false; + } + for (int k = 0; k < numColonneBefore.length; k++) { + cell = new Cell(); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + settaBordiEColori(cell, bordoColonne, bordoRighe, moreDesc, coloreBordo); + cell.setMaxLines(1); + cell.setColspan(numColonneBefore[k]); + l_pdfCorpo.addCell(cell); + } + if (desc.isEmpty()) { + cell = new Cell(new Chunk(".", theFont)); + } else { + cell = new Cell(new Chunk(desc, theFont)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + settaBordiEColori(cell, bordoColonne, bordoRighe, moreDesc, coloreBordo); + cell.setColspan(numColonneDesc); + l_pdfCorpo.addCell(cell); + for (int i = 0; i < numColonneAfter.length; i++) { + cell = new Cell(); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + settaBordiEColori(cell, bordoColonne, bordoRighe, moreDesc, coloreBordo); + cell.setMaxLines(1); + cell.setColspan(numColonneAfter[i]); + l_pdfCorpo.addCell(cell); + } + riga = incrementaNumRighe(riga, righePerPagina, l_document, l_pdfCorpo, hasMoreRow); + desc = ""; + rows++; + } + } catch (Exception e) { + handleDebug(e); + } + return riga; + } + + protected int inserisciDescRigaDocumentoNewOLD(String temp, int riga, int righePerPagina, Document l_document, Table pdfcorpo, int cellLeading, int maxCharLength, int numColonneDesc, int[] numColonneBefore, int[] numColonneAfter, Font theFont, boolean hasMoreRow) { + String indent = ""; + boolean debug = false; + if (getTipoDocumento().getIndentNuovaRiga() > 0L) + indent = " ".substring(0, (int)getTipoDocumento().getIndentNuovaRiga()); + int rows = 0; + temp = temp.trim(); + temp = temp.replace("€", "€"); + int bordi = 0; + Color colore = Color.black; + long bordoColonne = getTipoDocumento().getFlgBordoColonna(); + long bordoRighe = getTipoDocumento().getFlgBordoRiga(); + String coloreBordo = getTipoDocumento().getColoreBordoInterno(); + try { + StringTokenizer st = new StringTokenizer(temp.replaceAll("\n", "\n "), " "); + StringBuffer currentLine = new StringBuffer(); + String desc = ""; + while (st.hasMoreTokens()) { + if (currentLine.toString().endsWith("\n")) { + desc = currentLine.toString().replaceAll("\n", ""); + currentLine = new StringBuffer(); + } else { + String token = st.nextToken(); + if (currentLine.length() + token.length() > maxCharLength) { + desc = currentLine.toString(); + currentLine = new StringBuffer(token); + } else { + if (currentLine.length() > 0) + currentLine.append(" "); + currentLine.append(token); + if (token.endsWith("\n") || !st.hasMoreTokens()) { + desc = currentLine.toString().replaceAll("\n", ""); + currentLine = new StringBuffer(); + } + } + } + if (desc.length() > 0) { + Cell cell; + boolean moreDesc; + if (rows > 0) + desc = indent + indent; + if (currentLine.length() > 0 || st.hasMoreTokens()) { + moreDesc = true; + } else { + moreDesc = false; + } + if (rows > 0) + for (int i = 0; i < numColonneBefore.length; i++) { + cell = new Cell(); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + settaBordiEColori(cell, bordoColonne, bordoRighe, moreDesc, coloreBordo); + cell.setMaxLines(1); + cell.setColspan(numColonneBefore[i]); + pdfcorpo.addCell(cell); + } + if (debug) + desc = "" + riga + "/" + riga + " " + righePerPagina; + if (desc.isEmpty()) { + cell = new Cell(new Chunk(".", theFont)); + } else { + cell = new Cell(new Chunk(desc, theFont)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + settaBordiEColori(cell, bordoColonne, bordoRighe, moreDesc, coloreBordo); + cell.setColspan(numColonneDesc); + pdfcorpo.addCell(cell); + if (moreDesc) { + for (int i = 0; i < numColonneAfter.length; i++) { + cell = new Cell(); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + settaBordiEColori(cell, bordoColonne, bordoRighe, moreDesc, coloreBordo); + cell.setMaxLines(1); + cell.setColspan(numColonneAfter[i]); + pdfcorpo.addCell(cell); + } + riga = incrementaNumRighe(riga, righePerPagina, l_document, pdfcorpo, hasMoreRow); + } + desc = ""; + rows++; + } + } + if (currentLine.length() > 0) { + String descrizione = currentLine.toString(); + if (rows > 0) { + descrizione = indent + indent; + for (int i = 0; i < numColonneBefore.length; i++) { + Cell cell1 = new Cell(); + cell1.setVerticalAlignment(4); + cell1.setLeading((float)cellLeading); + settaBordiEColori(cell1, bordoColonne, bordoRighe, false, coloreBordo); + cell1.setMaxLines(1); + cell1.setColspan(numColonneBefore[i]); + pdfcorpo.addCell(cell1); + } + } + if (debug) + descrizione = "" + riga + "/" + riga + " " + righePerPagina; + Cell cell = new Cell(new Chunk(descrizione, theFont)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + settaBordiEColori(cell, bordoColonne, bordoRighe, false, coloreBordo); + cell.setColspan(numColonneDesc); + pdfcorpo.addCell(cell); + } + } catch (Exception e) { + handleDebug(e); + } + return riga; + } + + protected int inserisciDescRigaDocumentoNew(String temp, int riga, int righePerPagina, Document l_document, Table pdfcorpo, int cellLeading, int maxCharLength, int numColonneDesc, int[] numColonneBefore, int[] numColonneAfter, Font theFont, boolean hasMoreRow) { + String indent = ""; + boolean debug = false; + if (getTipoDocumento().getIndentNuovaRiga() > 0L) + indent = " ".substring(0, (int)getTipoDocumento().getIndentNuovaRiga()); + int rows = 0; + temp = temp.trim(); + temp = temp.replace("€", "€"); + int bordi = 0; + Color colore = Color.black; + long bordoColonne = getTipoDocumento().getFlgBordoColonna(); + long bordoRighe = getTipoDocumento().getFlgBordoRiga(); + String coloreBordo = getTipoDocumento().getColoreBordoInterno(); + try { + ArrayList res = convertStringToMultiline(temp, maxCharLength); + for (int j = 0; j < res.size(); j++) { + Cell cell; + boolean moreDesc; + String desc = res.get(j); + if (rows > 0) + desc = indent + indent; + if (j + 1 < res.size()) { + moreDesc = true; + } else { + moreDesc = false; + } + if (rows > 0) + for (int i = 0; i < numColonneBefore.length; i++) { + cell = new Cell(); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + settaBordiEColori(cell, bordoColonne, bordoRighe, moreDesc, coloreBordo); + cell.setMaxLines(1); + cell.setColspan(numColonneBefore[i]); + pdfcorpo.addCell(cell); + } + if (debug) + desc = "" + riga + "/" + riga + " " + righePerPagina; + if (desc.isEmpty()) { + cell = new Cell(new Chunk(".", theFont)); + } else { + cell = new Cell(new Chunk(desc, theFont)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + settaBordiEColori(cell, bordoColonne, bordoRighe, moreDesc, coloreBordo); + cell.setColspan(numColonneDesc); + pdfcorpo.addCell(cell); + if (moreDesc) { + for (int i = 0; i < numColonneAfter.length; i++) { + cell = new Cell(); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + settaBordiEColori(cell, bordoColonne, bordoRighe, moreDesc, coloreBordo); + cell.setMaxLines(1); + cell.setColspan(numColonneAfter[i]); + pdfcorpo.addCell(cell); + } + riga = incrementaNumRighe(riga, righePerPagina, l_document, pdfcorpo, hasMoreRow); + } + rows++; + } + } catch (Exception e) { + handleDebug(e); + } + return riga; + } + + protected int inserisciNotaDocumento(ArrayList dati, int idColDesc, int riga, Document l_document, Table pdfcorpo, int cellLeading, boolean hasMoreRow) { + String indent = ""; + boolean debug = false; + if (getTipoDocumento().getIndentNuovaRiga() > 0L) + indent = " ".substring(0, (int)getTipoDocumento().getIndentNuovaRiga()); + int righePerPagina = (int)getTipoDocumento().getRighePerPagina(); + int maxCharLength = (int)getTipoDocumento().getMaxCarDesc(); + if (maxCharLength == 0) + maxCharLength = 35; + String temp = dati.get(idColDesc).getDesc(); + temp = temp.replace("€", "€"); + int bordi = 0; + Color colore = Color.black; + long bordoColonne = getTipoDocumento().getFlgBordoColonna(); + long bordoRighe = getTipoDocumento().getFlgBordoRiga(); + String coloreBordo = getTipoDocumento().getColoreBordoInterno(); + boolean allineamentoInAlto = (getTipoDocumento().getFlgAllineamentoRiga() == 0L); + try { + ArrayList righeDescrizione = convertStringToMultiline(temp, maxCharLength); + int allineamentoInAltoVal = 0; + int allineamentoIBassoVal = righeDescrizione.size() - 1; + for (int row = 0; row < righeDescrizione.size(); row++) { + boolean moreDesc; + String desc = righeDescrizione.get(row); + if (row > 0) + desc = indent + indent; + if (row + 1 < righeDescrizione.size()) { + moreDesc = true; + } else { + moreDesc = false; + } + for (int col = 0; col < dati.size(); col++) { + Cell cell; + if (allineamentoInAlto) { + if (row == allineamentoInAltoVal || col == idColDesc) { + if (col == idColDesc) { + cell = new Cell(new Chunk(desc, dati.get(col).getPdfFont())); + } else { + cell = new Cell(new Chunk(dati.get(col).getDesc(), dati.get(col).getPdfFont())); + } + } else { + cell = new Cell(new Chunk("", dati.get(col).getPdfFont())); + } + } else if (row == allineamentoIBassoVal || col == idColDesc) { + if (col == idColDesc) { + cell = new Cell(new Chunk(desc, dati.get(col).getPdfFont())); + } else { + cell = new Cell(new Chunk(dati.get(col).getDesc(), dati.get(col).getPdfFont())); + } + } else { + cell = new Cell(new Chunk("", dati.get(col).getPdfFont())); + } + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + settaBordiEColori(cell, bordoColonne, bordoRighe, moreDesc, coloreBordo); + cell.setMaxLines(1); + cell.setColspan(dati.get(col).getColSpan()); + pdfcorpo.addCell(cell); + } + riga = incrementaNumRighe(riga, righePerPagina, l_document, pdfcorpo, hasMoreRow); + } + } catch (Exception e) { + handleDebug(e); + } + return riga; + } + + protected int inserisciRigheVuote(int nRighe, int[] colsDocumento_, int riga, Document l_document, Table l_pdfCorpo, int cellLeadingRow) { + Font PDF_frow = getTipoDocumento().getPdfFontRow(); + Font PDF_frowBianco = new Font(1, PDF_frow.getSize(), 1, Color.white); + ArrayList alNote = RigaDocumentoItemPdf.getArrayListNota(".", 0, colsDocumento_, PDF_frowBianco); + for (int i = 0; i < nRighe; i++) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, false); + return riga; + } + + protected int inserisciRigheVuoteOLD(int nRighe, int[] colSpan, int riga, Document l_document, Table pdfcorpo, int cellLeading) { + String indent = ""; + boolean debug = false; + if (getTipoDocumento().getIndentNuovaRiga() > 0L) + indent = " ".substring(0, (int)getTipoDocumento().getIndentNuovaRiga()); + int righePerPagina = (int)getTipoDocumento().getRighePerPagina(); + int maxCharLength = (int)getTipoDocumento().getMaxCarDesc(); + if (maxCharLength == 0) + maxCharLength = 35; + long bordoColonne = getTipoDocumento().getFlgBordoColonna(); + long bordoRighe = getTipoDocumento().getFlgBordoRiga(); + String coloreBordo = getTipoDocumento().getColoreBordoInterno(); + boolean allineamentoInAlto = (getTipoDocumento().getFlgAllineamentoRiga() == 0L); + Font PDF_frow = getTipoDocumento().getPdfFontRow(); + Font PDF_frowBianco = new Font(1, PDF_frow.getSize(), 1, Color.white); + try { + for (int row = 0; row < nRighe; row++) { + boolean moreDesc; + if (row + 1 < nRighe) { + moreDesc = true; + } else { + moreDesc = false; + } + for (int col = 0; col < colSpan.length; col++) { + Cell cell; + if (col == 0) { + cell = new Cell(new Chunk(".", PDF_frowBianco)); + } else { + cell = new Cell(new Chunk("", PDF_frowBianco)); + } + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + settaBordiEColori(cell, bordoColonne, bordoRighe, moreDesc, coloreBordo); + cell.setMaxLines(1); + cell.setColspan(colSpan[col]); + pdfcorpo.addCell(cell); + } + riga = incrementaNumRighe(riga, righePerPagina, l_document, pdfcorpo, moreDesc); + } + } catch (Exception e) { + handleDebug(e); + } + return riga; + } + + public Vectumerator findByCROld(DocumentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Order; + boolean flgOttimizzo = (getParm("OTTIMIZZO").getNumero() == 1.0D); + if (CR.getId_contatore() != 0L || CR.getFlgTipologia() >= 0L || CR.getFlgSlip() > 0L || CR.getId_tipo() != 0L) + flgOttimizzo = false; + StringBuffer s_Sql_Find = new StringBuffer("select A.* from DOCUMENTO AS A "); + if (CR.getTipoDocumento().getFlgClienteFornitore().equals("F") && ( + CR.getTipoDocumento().getFlgTipologia() == 1L || + CR.getTipoDocumento().getFlgTipologia() == 2L)) { + if (CR.getFlgOrderBy() == 1L) { + s_Sql_Order = " order by A.dataRiferimento asc, A.id_esercizio asc, A.progDocumento asc"; + } else { + s_Sql_Order = " order by A.dataRiferimento desc, A.id_esercizio desc, A.progDocumento desc"; + } + } else if (CR.getFlgOrderBy() == 1L) { + s_Sql_Order = " order by A.dataDocumento asc, A.id_esercizio asc, A.progDocumento asc"; + } else { + s_Sql_Order = " order by A.dataDocumento desc, A.id_esercizio desc, A.progDocumento desc"; + } + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt; + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + } else { + if (pageNumber == 0) + pageNumber = 1; + int start = (pageNumber - 1) * pageRows; + int stop = start + pageRows; + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + " limit " + s_Sql_Order + "," + start); + } + findByCRCreateStmtDate(CR, stmt); + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) + return findRows(stmt, pageNumber, pageRows); + Vectumerator vec = findRows(stmt, 1, pageRows); + vec.setPageNumber(pageNumber); + vec.setTotNumberOfRecords(findByCRTotRecord(CR)); + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getPesoKg() { + return (getId_documento() == 0L) ? 0.0D : (double)new RigaDocumento(getApFull()).getPesoKgByDocumento(getId_documento()); + } + + public Vectumerator findByAgenti(DocumentoCR CR) { + String s_Sql_Find = "SELECT A.id_agente, A.percAgente, A.id_respCommerciale, A.percRespCommerciale, SUM(A.imponibileTotale) AS imponibileTotale FROM DOCUMENTO AS A INNER JOIN TIPO_DOCUMENTO AS B ON A.id_tipoDocumento = B.id_tipoDocumento "; + String s_Sql_Group = " GROUP BY A.id_agente, A.percAgente, A.id_respCommerciale, A.percRespCommerciale "; + String s_Sql_Order = " ORDER BY A.id_agente, A.id_respCommerciale "; + WcString wc = new WcString(); + wc.addWc(" B.flgTipologia = 1"); + if (CR.getDataDocumentoDa() != null) + wc.addWc(" A.dataDocumento >= ? "); + if (CR.getDataDocumentoA() != null) + wc.addWc(" A.dataDocumento <= ? "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group); + int i = 1; + if (CR.getDataDocumentoDa() != null) { + stmt.setDate(i, CR.getDataDocumentoDa()); + i++; + } + if (CR.getDataDocumentoA() != null) + stmt.setDate(i, CR.getDataDocumentoA()); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public static final synchronized ResParm addRigaDocumentoTessuto(Documento doc, RigaDocumento row, long l_flgCodiceRiga) { + long l_id_magFisicoPartenza, l_id_magFisicoArrivo; + MagFisico magFisicoPartenza, magFisicoArrivo; + if (row.getId_articoloTessutoColore() > 0L) + row.setId_articoloTessuto(row.getArticoloTessutoColore().getId_articoloTessuto()); + ResParm rp = doc.checkEMSTA(); + if (!rp.getStatus()) + return new ResParm(false, "ATTENZIONE! Tentativo di aggiungere una riga documento: " + rp.getMsg()); + RigaDocumento RD = new RigaDocumento(doc.getApFull()); + double l_quantitaDisponibileMagPartenza = 0.0D; + double l_quantitaDisponibileTuttiMagazziniInterniEsterni = 0.0D; + double l_quantitaDisponibileMagazziniInterni = 0.0D; + if (l_flgCodiceRiga == 0L) { + l_id_magFisicoPartenza = row.getDocumento().getId_magFisicoPartenza(); + l_id_magFisicoArrivo = row.getDocumento().getId_magFisicoArrivo(); + magFisicoPartenza = row.getDocumento().getMagFisicoPartenza(); + magFisicoArrivo = row.getDocumento().getMagFisicoArrivo(); + } else { + l_id_magFisicoPartenza = row.getDocumento().getId_magFisicoPartenza2(); + l_id_magFisicoArrivo = row.getDocumento().getId_magFisicoArrivo2(); + magFisicoPartenza = row.getDocumento().getMagFisicoPartenza2(); + magFisicoArrivo = row.getDocumento().getMagFisicoArrivo2(); + } + rp = new ResParm(true); + RigaDocumento rowOnDb = new RigaDocumento(doc.getApFull()); + rowOnDb.findByPrimaryKey(row.getId_rigaDocumento()); + if (!row.getSeriale().trim().isEmpty() && row.getArticoloTessuto().getTipo().getFlgTipoMagazzino() == 2L) + row.setQuantita(1.0D); + if (rowOnDb.getDBState() == 1 && ( + rowOnDb.getId_articoloTessuto() != row.getId_articoloTessuto() || !rowOnDb.getSeriale().equals(row.getSeriale()))) { + rp = rowOnDb.delete(); + if (!rp.getStatus()) + return rp; + row.setId_rigaDocumento(0L); + row.setDBState(0); + } + if (row.getId_articoloTessuto() != 0L && l_id_magFisicoPartenza > 0L) { + RD.findMagTessutoDisponibilita(row.getId_articoloTessuto(), row.getId_articoloTessutoColore(), row.getSeriale(), l_id_magFisicoPartenza, 0L, -1L, 0L, "", DATA_NULL); + l_quantitaDisponibileMagPartenza = RD.getQuantita(); + if (rowOnDb.getDBState() == 1) + l_quantitaDisponibileMagPartenza += rowOnDb.getQuantita(); + if (row.getArticoloTessuto().getTipo().getFlgMagNegativo() == 0L && + row.getArticoloTessuto().getTipo().getFlgTipoMagazzino() > 0L && + row.getArticoloTessuto().getTipo().getFlgTipoMagazzino() < 9L && + row.getId_articoloTessuto() != 0L && l_id_magFisicoPartenza != 0L && + row.getFlgReso() == 0L && l_quantitaDisponibileMagPartenza < row.getQuantita()) { + rp.setStatus(false); + rp.setMsg("Attenzione. Tentativo di utilizzare un articolo non disponibile"); + return rp; + } + } + if (row.getId_articoloTessuto() != 0L && l_id_magFisicoPartenza > 0L && + magFisicoPartenza.getFlgTipo() == 1L && + row.getArticoloTessuto().getTipo().getFlgTipoMagazzino() > 0L && + row.getArticoloTessuto().getTipo().getFlgTipoMagazzino() < 9L && row.getId_articoloTessuto() != 0L && + rowOnDb.getDBState() == 0 && row.getFlgReso() == 0L && row.getFlgIgnoraPrenotazione() == 0L) { + double totArticoliEffettivi = 0.0D; + if (row.getSeriale().isEmpty()) { + RD.findMagTessutoDisponibilitaPuntualeMagazziniInterni(row.getId_articoloTessuto(), row.getId_articoloTessutoColore(), null, -1L); + l_quantitaDisponibileMagazziniInterni = RD.getQuantita(); + double totArticoliImpegnati = row.getTotTessutiImpegnati(row.getId_articoloTessuto(), ""); + totArticoliEffettivi = l_quantitaDisponibileMagazziniInterni - totArticoliImpegnati; + } else { + if (row.getArticoloTessuto().getTipo().getFlgTipoMagazzino() != 2L) + if (row.getArticoloTessuto().getTipo().getFlgTipoMagazzino() == 3L) { + RD.findMagTessutoDisponibilitaPuntualeMagazziniInterni(row.getId_articoloTessuto(), row.getId_articoloTessutoColore(), + row.getSeriale(), -1L); + l_quantitaDisponibileMagazziniInterni = RD.getQuantita(); + double totArticoliImpegnati = row.getTotTessutiImpegnati(row.getId_articoloTessuto(), row.getSeriale()); + totArticoliEffettivi = l_quantitaDisponibileMagazziniInterni - totArticoliImpegnati; + } else { + RD.findMagTessutoDisponibilitaPuntualeMagazziniInterni(row.getId_articoloTessuto(), row.getId_articoloTessutoColore(), + row.getSeriale(), -1L); + l_quantitaDisponibileMagazziniInterni = RD.getQuantita(); + double totArticoliImpegnati = row.getTotTessutiImpegnati(row.getId_articoloTessuto(), ""); + totArticoliEffettivi = l_quantitaDisponibileMagazziniInterni - totArticoliImpegnati; + } + if (totArticoliEffettivi <= 0.0D) { + rp.setStatus(false); + rp.setMsg("Attenzione. L'articolo è in magazzino ma non disponibile perchè risulta impegnato. "); + return rp; + } + } + } + if (l_id_magFisicoArrivo > 0L && ( + magFisicoArrivo.getFlgTipo() == 1L || + magFisicoArrivo.getFlgTipo() == 2L) && + !row.getSeriale().trim().isEmpty() && row.getArticoloTessuto().getTipo().getFlgTipoMagazzino() == 2L && + rowOnDb.getDBState() == 0) { + if (row.getParm("SERIALI_UNIVOCI").isTrue() && + row.getArticoloTessuto().getTipo().getFlgTipoMagazzino() == 2L) { + RD.findMagDisponibilitaGlobaleMagazziniInterniEsterni(row.getId_articoloTessuto(), row.getSeriale(), 0L); + RD.findMagTessutoDisponibilitaGlobaleMagazziniInterniEsterni(row.getId_articoloTessuto(), row.getId_articoloTessutoColore(), + row.getSeriale(), 0L); + } else { + RD.findMagTessutoDisponibilitaPuntualeMagazziniInterniEsterni(row.getId_articoloTessuto(), + row.getId_articoloTessutoColore(), row.getSeriale(), -1L, 0L); + } + l_quantitaDisponibileTuttiMagazziniInterniEsterni = RD.getQuantita(); + if (l_quantitaDisponibileTuttiMagazziniInterniEsterni >= 1.0D) { + rp.setStatus(false); + rp.setMsg("Attenzione. Stai inserendo un seriale già caricato in magazzino."); + return rp; + } + } + row.setId_documento(doc.getId_documento()); + if (l_flgCodiceRiga == 1L) + row.setFlgCodiceRiga(1L); + rp.append(row.saveTessuto()); + if (rp.getStatus() && + doc.getTipoDocumento().getFlgTipologia() == 202L && + row.getFlgCodiceRiga() == 1L) + rp.append(doc.aggiornaSerialeTessutoLavorazione()); + if (rp.getStatus()) + rp.setMsg(AbMessages.getMessage("SAVE_OK")); + return rp; + } + + public static final ArrayList convertStringToMultiline(String temp, int maxCharLength) { + if (temp.trim().isEmpty()) { + ArrayList arrayList = new ArrayList<>(); + arrayList.add(""); + return arrayList; + } + String SPACE = " "; + String NL = "\n"; + temp = temp.trim(); + ArrayList res = new ArrayList<>(); + StringTokenizer st = new StringTokenizer(temp.replaceAll("\n", "\n "), " "); + StringBuffer currentLine = new StringBuffer(); + String desc = ""; + while (st.hasMoreTokens()) { + if (currentLine.toString().endsWith("\n")) { + desc = currentLine.toString().replaceAll("\n", ""); + currentLine = new StringBuffer(); + } else { + String token = st.nextToken(); + if (currentLine.length() + token.length() > maxCharLength) { + desc = currentLine.toString(); + currentLine = new StringBuffer(token); + } else { + if (currentLine.length() > 0) + currentLine.append(" "); + currentLine.append(token); + if (token.endsWith("\n") || !st.hasMoreTokens()) { + desc = currentLine.toString().replaceAll("\n", ""); + currentLine = new StringBuffer(); + } + } + } + if (desc.length() > 0) { + res.add(desc); + desc = ""; + } + } + if (currentLine.length() > 0) + res.add(currentLine.toString()); + return res; + } + + public static final synchronized ResParm addRigaDocumentoOld(DocumentoInterface doc, RigaDocumento row) { + Movimento mov = new Movimento(doc.getApFull()); + RigaDocumento RD = new RigaDocumento(doc.getApFull()); + double l_quantitaDisponibileMagPartenza = 0.0D; + double l_quantitaDisponibileTuttiMagazziniInterniEsterni = 0.0D; + double l_quantitaDisponibileMagazziniInterni = 0.0D; + long l_id_magFisicoPartenza = row.getDocumento().getId_magFisicoPartenza(); + long l_id_magFisicoArrivo = row.getDocumento().getId_magFisicoArrivo(); + ResParm rp = new ResParm(true); + RigaDocumento rowOnDb = new RigaDocumento(doc.getApFull()); + rowOnDb.findByPrimaryKey(row.getId_rigaDocumento()); + if (!row.getSeriale().trim().isEmpty() && row.getArticolo().getFlgSerialiMassivi() == 0L) { + row.setQuantita(1.0D); + row.setQuantitaUdm(1.0D); + } + if (rowOnDb.getDBState() == 1 && (rowOnDb.getId_articolo() != row.getId_articolo() || + rowOnDb.getId_articoloVariante() != row.getId_articoloVariante() || !rowOnDb.getSeriale().equals(row.getSeriale()))) { + rp = rowOnDb.delete(); + if (!rp.getStatus()) + return rp; + row.setId_rigaDocumento(0L); + row.setDBState(0); + } + if (row.getId_articolo() != 0L && l_id_magFisicoPartenza > 0L) { + mov.findDisponibilitaPuntuale(row.getId_articolo(), row.getId_articoloVariante(), row.getId_articoloTaglia(), row.getSeriale(), l_id_magFisicoPartenza, 0L); + RD.findMagDisponibilitaPuntuale(row.getId_articolo(), row.getId_articoloVariante(), row.getId_articoloTaglia(), + row.getSeriale(), l_id_magFisicoPartenza, 0L, 0L); + l_quantitaDisponibileMagPartenza = RD.getQuantita(); + if (l_quantitaDisponibileMagPartenza != mov.getQuantita()) { + l_quantitaDisponibileMagPartenza = mov.getQuantita(); + System.out.println("Documento.addrigadocumento: ERRORE findMagDisponibilitaPuntuale : l_quantitaDisponibileMagPartenza " + + RD.getQuantita() + " " + mov.getQuantita()); + } + if (rowOnDb.getDBState() == 1) + l_quantitaDisponibileMagPartenza += rowOnDb.getQuantita(); + if (row.getArticolo().getTipo().getFlgTipoMagazzino() > 0L && + row.getArticolo().getTipo().getFlgTipoMagazzino() < 9L && row.getId_articolo() != 0L && l_id_magFisicoPartenza != 0L && + + row.getFlgReso() == 0L && l_quantitaDisponibileMagPartenza < row.getQuantita()) { + rp.setStatus(false); + rp.setMsg("Attenzione. Tentativo di utilizzare un articolo non disponibile"); + return rp; + } + } + if (row.getId_articolo() != 0L && l_id_magFisicoPartenza > 0L && + row.getDocumento().getMagFisicoPartenza().getFlgTipo() == 1L && + row.getArticolo().getTipo().getFlgTipoMagazzino() > 0L && + row.getArticolo().getTipo().getFlgTipoMagazzino() < 9L && row.getId_articolo() != 0L && + rowOnDb.getDBState() == 0 && row.getFlgReso() == 0L && row.getFlgIgnoraPrenotazione() == 0L) { + double totArticoliEffettivi = 0.0D; + if (row.getSeriale().isEmpty()) { + mov.findDisponibilitaPuntualeMagazziniInterni(row.getId_articolo(), row.getId_articoloVariante(), + row.getId_articoloTaglia(), null, 0L); + RD.findMagDisponibilitaPuntualeMagazziniInterni(row.getId_articolo(), row.getId_articoloVariante(), + row.getId_articoloTaglia(), null, 0L); + l_quantitaDisponibileMagazziniInterni = RD.getQuantita(); + if (l_quantitaDisponibileMagazziniInterni != mov.getQuantita()) { + l_quantitaDisponibileMagazziniInterni = mov.getQuantita(); + System.out.println("Documento.addrigadocumento: ERRORE findMagDisponibilitaPuntuale l_quantitaDisponibileMagazziniInterni:" + + + RD.getQuantita() + " " + mov.getQuantita()); + } + totArticoliEffettivi = l_quantitaDisponibileMagazziniInterni - row.getTotArticoliImpegnati(row.getId_articolo(), row.getId_articoloVariante(), row.getId_articoloTaglia()); + } else { + RigaDocumento rd = new RigaDocumento(row.getApFull()); + rd.findRigaImpegnoBySeriale(row.getId_articolo(), row.getId_articoloVariante(), row.getSeriale()); + if (rd.getDBState() == 1) { + if (row.getFlgIgnoraPrenotazione() == 1L) { + rd.setSeriale(""); + rd.save(); + totArticoliEffettivi = 1.0D; + } else { + totArticoliEffettivi = 0.0D; + } + } else { + mov.findDisponibilitaPuntualeMagazziniInterni(row.getId_articolo(), row.getId_articoloVariante(), + row.getId_articoloTaglia(), null, 0L); + RD.findMagDisponibilitaPuntualeMagazziniInterni(row.getId_articolo(), row.getId_articoloVariante(), + row.getId_articoloTaglia(), null, 0L); + l_quantitaDisponibileMagazziniInterni = mov.getQuantita(); + l_quantitaDisponibileMagazziniInterni = RD.getQuantita(); + if (l_quantitaDisponibileMagazziniInterni != mov.getQuantita()) { + l_quantitaDisponibileMagazziniInterni = mov.getQuantita(); + System.out.println("Documento.addrigadocumento: ERRORE findMagDisponibilitaPuntuale l_quantitaDisponibileMagazziniInterni non ser:" + + + RD.getQuantita() + " " + mov.getQuantita()); + } + totArticoliEffettivi = l_quantitaDisponibileMagazziniInterni - row.getTotArticoliImpegnati(row.getId_articolo(), row.getId_articoloVariante(), row.getId_articoloTaglia()); + } + if (totArticoliEffettivi <= 0.0D) { + rp.setStatus(false); + rp.setMsg("Attenzione. L'articolo è in magazzino ma non disponibile perchè risulta impegnato. "); + return rp; + } + } + } + if (l_id_magFisicoArrivo > 0L && ( + row.getDocumento().getMagFisicoArrivo().getFlgTipo() == 1L || + row.getDocumento().getMagFisicoArrivo().getFlgTipo() == 2L) && + !row.getSeriale().trim().isEmpty() && row.getArticolo().getTipo().getFlgTipoMagazzino() == 2L && + rowOnDb.getDBState() == 0) { + if (mov.getParm("SERIALI_UNIVOCI").isTrue()) { + mov.findDisponibilitaGlobaleMagazziniInterniEsterni(row.getId_articolo(), row.getSeriale(), 0L); + RD.findMagDisponibilitaGlobaleMagazziniInterniEsterni(row.getId_articolo(), row.getSeriale(), 0L); + } else { + mov.findDisponibilitaPuntualeMagazziniInterniEsterni(row.getId_articolo(), row.getId_articoloVariante(), + row.getId_articoloTaglia(), row.getSeriale(), 0L); + RD.findMagDisponibilitaPuntualeMagazziniInterniEsterni(row.getId_articolo(), row.getId_articoloVariante(), + row.getId_articoloTaglia(), row.getSeriale(), 0L); + } + l_quantitaDisponibileTuttiMagazziniInterniEsterni = RD.getQuantita(); + if (l_quantitaDisponibileTuttiMagazziniInterniEsterni != mov.getQuantita()) { + l_quantitaDisponibileTuttiMagazziniInterniEsterni = mov.getQuantita(); + System.out.println("Documento.addrigadocumento: ERRORE findMagDisponibilitaPuntualeMagazziniInterniEsterni l_quantitaDisponibileTuttiMagazziniInterniEsterni:" + + + RD.getQuantita() + " " + mov.getQuantita()); + } + if (l_quantitaDisponibileTuttiMagazziniInterniEsterni >= 1.0D) { + rp.setStatus(false); + rp.setMsg("Attenzione. Stai inserendo un seriale già caricato in magazzino."); + return rp; + } + } + long l_numSeriali = 1L; + if (doc.getTipoDocumento().getFlgTipologia() != 3L && + row.getArticolo().getFlgSerialiMassivi() == 1L && row.getQuantita() > 1.0D) { + l_numSeriali = (long)row.getQuantita(); + row.setQuantita(1.0D); + row.setQuantitaUdm(1.0D); + } + for (int i = 0; (long)i < l_numSeriali; i++) { + RigaDocumento bean = new RigaDocumento(doc.getApFull()); + if (row.getId_rigaDocumento() != 0L) { + bean.findByPrimaryKey(row.getId_rigaDocumento()); + } else if (row.getId_articolo() != 0L && row.getFlgSingleLineArt() == 1L && ( + doc.getTipoDocumento().getFlgTipologia() == 3L || + doc.getTipoDocumento().getFlgTipologia() == 4L || + row.getArticolo().getTipo().getFlgTipoMagazzino() != 2L)) { + if (row.getId_articoloTaglia() != 0L) { + bean.findFirstByDocumentoArticoloTaglia(row.getId_documento(), row.getId_articoloTaglia()); + } else if (row.getId_articoloVariante() != 0L) { + bean.findFirstByDocumentoArticoloVariante(row.getId_documento(), row.getId_articoloVariante()); + } else if (row.getId_articolo() != 0L) { + bean.findFirstByDocumentoArticolo(row.getId_documento(), row.getId_articolo()); + } + row.setId_rigaDocumento(bean.getId_rigaDocumento()); + row.addQuantita(bean.getQuantita()); + } + row.setDBState(bean.getDBState()); + row.setQuantitaOld(bean.getQuantitaOld()); + row.setId_documento(doc.getId_documento()); + rp.append(row.save()); + if (!rp.getStatus()) + return rp; + if (l_numSeriali > 1L) + try { + long currentSeriale = Long.valueOf(row.getSeriale()); + currentSeriale++; + String newSeriale = zeroLeft(currentSeriale, row.getSeriale().length()); + row.setSeriale(newSeriale); + row.setId_rigaDocumento(0L); + row.setDBState(0); + } catch (Exception e) { + rp.setStatus(false); + rp.setMsg("Errore! seriale non numerico per carico massivo: " + row.getSeriale()); + return rp; + } + } + if (rp.getStatus()) + rp.setMsg(AbMessages.getMessage("SAVE_OK")); + return rp; + } + + public long getId_cliforPrecedente() { + return this.id_cliforPrecedente; + } + + public void setId_cliforPrecedente(long id_cliforDb) { + this.id_cliforPrecedente = id_cliforDb; + } + + public boolean isDataOk() { + if (getTipoDocumento().getContatore().getFlgControllo() == 0L) + return true; + if (getDBState() == 1 && getFlgStato() == 1L) { + Documento beanPrec = new Documento(getApFull()); + beanPrec.findPrecedente(getProgDocumento(), getId_esercizio(), getId_contatore()); + boolean l_flgOk = true; + if (beanPrec != null && beanPrec.getDBState() == 1) + if (getDateDiff(beanPrec.getDataDocumento(), getDataDocumento()) >= 0L) { + l_flgOk = true; + } else { + l_flgOk = false; + } + if (l_flgOk) { + Documento beanSucc = new Documento(getApFull()); + beanSucc.findSuccessiva(getProgDocumento(), getId_esercizio(), getId_contatore()); + if (beanSucc != null && beanSucc.getDBState() == 1) + if (getDateDiff(beanSucc.getDataDocumento(), getDataDocumento()) <= 0L) { + l_flgOk = true; + } else { + l_flgOk = false; + } + } + return l_flgOk; + } + return true; + } + + public String getIbanCF() { + return (this.ibanCF == null) ? "" : this.ibanCF.trim(); + } + + public void setIbanCF(String ibanCF) { + this.ibanCF = ibanCF; + } + + public String getBancaCFDesc() { + return (this.bancaCFDesc == null) ? "" : this.bancaCFDesc.trim(); + } + + public void setBancaCFDesc(String bancaCFDesc) { + this.bancaCFDesc = bancaCFDesc; + } + + public double getPercScontoIncondizionato() { + return this.percScontoIncondizionato; + } + + public void setPercScontoIncondizionato(double percScontoIncondizionato) { + this.percScontoIncondizionato = percScontoIncondizionato; + } + + public String getAbi() { + if (getIban().length() < 11) + return "??"; + return getIban().substring(5, 10); + } + + public String getCabCF() { + if (getIbanCF().length() < 16) + return "??"; + return getIbanCF().substring(10, 15); + } + + public String getContoCF() { + if (getIbanCF().length() < 27) + return "??"; + return getIbanCF().substring(15); + } + + public String getId_nazioneSped() { + return (this.id_nazioneSped == null) ? "" : this.id_nazioneSped.trim(); + } + + public void setId_nazioneSped(String id_nazioneSped) { + this.id_nazioneSped = id_nazioneSped; + setNazioneSped(null); + } + + public Nazione getNazioneSped() { + this.nazioneSped = (Nazione)getSecondaryObject(this.nazioneSped, Nazione.class, getId_nazioneSped()); + return this.nazioneSped; + } + + public void setNazioneSped(Nazione nazioneSped) { + this.nazioneSped = nazioneSped; + } + + public String getElencoScadenze2Righe() { + StringBuilder sb1 = new StringBuilder(); + StringBuilder sb2 = new StringBuilder(); + if (getId_documento() > 0L) { + DocumentoScadenza scadenza = new DocumentoScadenza(getApFull()); + Vectumerator vec = scadenza.findByDocumento(getId_documento()); + if (vec.hasMoreElements()) + while (vec.hasMoreElements()) { + scadenza = (DocumentoScadenza)vec.nextElement(); + sb1.append(" " + getDataFormat().format(scadenza.getDataScadenza()) + " "); + String temp = getNf().format(scadenza.getImportoScadenza()); + sb2.append(spaceRight(spaceLeft("", (14 - temp.length()) / 2 + 1) + spaceLeft("", (14 - temp.length()) / 2 + 1), 14)); + } + } + return sb1.toString() + "\n" + sb1.toString(); + } + + private Document creaReportUnoGiornaliero(DocumentoCR CR, boolean soloCompatto) { + long l_id_tipoDocumento = CR.getId_tipoDocumento(); + if (l_id_tipoDocumento == 0L) + l_id_tipoDocumento = getId_docCassa(); + int rowCellLeading = 6; + NumberFormat nf3 = NumberFormat.getInstance(); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf0 = NumberFormat.getInstance(); + nf0.setMaximumFractionDigits(0); + nf0.setMinimumFractionDigits(0); + int col_1 = 5, col_2 = 3, col_3 = 3, col_4 = 19, col_5 = 5, col_6 = 5; + int cellLeading = 12; + String descCliente = "", descDocumento = ""; + DoubleOperator totGiorno = new DoubleOperator(); + DoubleOperator totaleComplessivo = new DoubleOperator(); + SimpleDateFormat df = getDataFormat(); + Color currentColor = Color.ORANGE; + try { + Cell rigaVuota = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimo)); + rigaVuota.setVerticalAlignment(4); + rigaVuota.setHorizontalAlignment(0); + rigaVuota.setLeading((float)cellLeading); + rigaVuota.setBorder(0); + rigaVuota.setColspan(40); + rigaVuota.setRowspan(1); + String intestazioneReport = "Data: dal " + df.format(CR.getDataDocumentoDa()) + " al " + df.format(CR.getDataDocumentoA()); + if (CR.getId_tipo() != 0L) + intestazioneReport = intestazioneReport + " - Tipo: " + intestazioneReport; + creaIntestazioneReport(CR.getTipoReport(), intestazioneReport); + Cell cell = new Cell(new Chunk("Doc.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Data", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Tipo", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col_3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Intestazione", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col_4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Importo", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.pdfcorpo.endHeaders(); + CR.setFlgOrderBy(1L); + Vectumerator vec = new Documento(getApFull()).findByCR(CR, 0, 0); + Date currentData = null; + while (vec.hasMoreElements()) { + descCliente = ""; + descDocumento = ""; + Documento row = (Documento)vec.nextElement(); + if (currentData == null) { + currentData = row.getDataDocumento(); + } else if (DBAdapter.getDateDiff(currentData, row.getDataDocumento()) != 0L) { + cell = new Cell(new Chunk("TOTALE " + getDataFormat().format(currentData), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totGiorno.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + currentData = row.getDataDocumento(); + totGiorno = new DoubleOperator(); + } + totGiorno.add(row.getTotaleDocumentoConSegno()); + totaleComplessivo.add(row.getTotaleDocumentoConSegno()); + String nDoc = row.getNumeroDocumentoCompleto(); + descCliente = row.getClifor().getDescrizioneCompleta(); + descDocumento = row.getTipoDocumento().getDescrizioneStampa(); + String descPag = row.getStatoCompleto(); + cell = new Cell(new Chunk(nDoc, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getDataFormat().format(row.getDataDocumento()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(descDocumento, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(descCliente, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_4 + col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(row.getTotaleDocumentoConSegno()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("TOTALE " + getDataFormat().format(currentData), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totGiorno.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE da " + getDataFormat().format(CR.getDataDocumentoDa()) + " a " + getDataFormat().format(CR.getDataDocumentoA()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.green); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totaleComplessivo.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.green); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + this.document.newPage(); + } catch (Exception e) { + handleDebug(e); + } + return this.document; + } + + public String getFECodiceDestinatario() { + return getClifor().getCodiceIdentificativoFE(); + } + + public String getFEPecDestinatario() { + return getClifor().getPec(); + } + + public String getFEProgressivo() { + return Long.toString(getId_documento(), 36); + } + + public String getFERappFiscaleIdPaese() { + return null; + } + + public String getFERappFiscalepartitaIva() { + return null; + } + + public String getFERappFiscaleCodiceFiscale() { + return null; + } + + public String getFERappFiscaleDenominazione() { + return null; + } + + public String getFERappFiscaleNome() { + return null; + } + + public String getFERappFiscaleCognome() { + return null; + } + + public String getFERappFiscaleTitolo() { + return null; + } + + public String getFERappFiscaleCodEORI() { + return null; + } + + public boolean isPubblicaAmministrazione() { + return (getClifor().getFlgPA() == 1L); + } + + public Date getFeDataDocumento() { + return getDataDocumento(); + } + + public boolean isFatturaElettronicaGenerabile() { + if (isFatturaElettronicaOn()) { + if ((getTipoDocumento().getFlgTipologia() == 1L || + getTipoDocumento().getFlgTipologia() == 2L) && + getTipoDocumento().getFlgClienteFornitore().equals("C") && + getFlgStato() == 1L && getId_esercizio() >= 2019L) + return true; + return false; + } + return false; + } + + public ResParm getFatturaElettronicaXml() { + ResParm rp = new ResParm(); + if (isFatturaElettronicaGenerabile()) { + if (getTmstInvioXml() == null) { + FeXml feXml = new FeXml(this); + rp = feXml.getXmlFile(false); + } else { + rp.setStatus(false); + rp.setMsg("Errore! XML Impostato ad inviato!"); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! Impossibile creare fattura xml."); + } + return rp; + } + + public ResParm getFattureElettronicaXmlZip(DocumentoCR CR) { + ResParm rp = new ResParm(); + CR.setFlgSoloFattureElettroniche(1L); + Vectumerator vec = findByCR(CR, 0, 0); + if (vec.hasMoreElements()) { + FeXml feXml = new FeXml(this, vec); + rp = feXml.getXmlFile(false); + } else { + rp.setStatus(false); + rp.setMsg("Errore! Impossibile creare zip fatture xml! Non e' stata trovata nessuna fattura idonea"); + } + return rp; + } + + public Timestamp getTmstFileXml() { + return this.tmstFileXml; + } + + public void setTmstFileXml(Timestamp tmstFileXml) { + this.tmstFileXml = tmstFileXml; + } + + public FEDatiAnagraficiInterface getFEDatiAnagraficiCessionario() { + return getClifor(); + } + + public String getFEDivisa() { + return "EUR"; + } + + public String getFENumeroDocumento() { + if (getTipoDocumento().getFlgFETipoNumeroFattura() == 1L) + return String.valueOf(getProgDocumento()); + return getNumeroDocumentoCompleto(); + } + + public double getFEImportoTotaleDocumento() { + return getTotaleDocumento(); + } + + public double getFEArrotondamento() { + return 0.0D; + } + + public String getFECausale() { + return getCausale(); + } + + public boolean isFEArt73() { + return false; + } + + public String getFETipoDocumento() { + return getTipoDocumento().getTipologiaDocumento().getFlgTDFelett(); + } + + public String getFEDatiOrdineAcquistoRifNumLinea() { + return null; + } + + public String getFEDatiOrdineAcquistoNumItem() { + return ""; + } + + public String getFEDatiOrdineAcquistoCodCommessaConv() { + return ""; + } + + public String getFEDatiOrdineAcquistoCodiceCUP() { + return getOrdineCodiceCUP(); + } + + public String getFEDatiOrdineAcquistoCodiceCIG() { + return getOrdineCodiceCIG(); + } + + public String getFEDatiOrdineAcquistoIdDocumento() { + return getRiferimento(); + } + + public Date getFEDatiOrdineAcquistoData() { + return getDataRiferimento(); + } + + public String getFEDatiSALRiferimentoFase() { + return null; + } + + public Vectumerator getFEDatiDDT() { + return null; + } + + public FESedeInterface getFESedeCessonario() { + return getClifor(); + } + + public FESedeInterface getFEStabileOrg() { + return null; + } + + public FEDatiRitenutaInterface getFeDatiRitenuta() { + return null; + } + + public FEDatiTrasportoInterface getFEDatiTrasporto() { + return this; + } + + public Vectumerator getFEDettaglioLinee() { + Vectumerator vec = findRigheDocumento(0, 0, 1); + Vectumerator vec2 = new Vectumerator(vec.elements()); + return vec2; + } + + public Vectumerator getFEDatiRiepilogo() { + Vectumerator vec; + RigheRegistroIva rri = getRigaRegistroIvaCompleto(); + if (getTipoDocumento().getFlgUsato() == 1L) { + vec = new Vectumerator(rri.elementsFattNoType()); + } else { + vec = new Vectumerator(rri.elementsNoType()); + } + return vec; + } + + public FEAllegatiInterface getFEAllegatiInterface() { + return null; + } + + public String getFeBolloVirtuale() { + if (getImportoBolloEsenzione() > 0.0D) + return "SI"; + return ""; + } + + public double getFEImportoBollo() { + return getImportoBolloEsenzione(); + } + + public double getImportoBolloEsenzione() { + return this.importoBolloEsenzione; + } + + public void setImportoBolloEsenzione(double importoBolloEsenzione) { + this.importoBolloEsenzione = importoBolloEsenzione; + } + + public FEDatiAnagraficiInterface getFEDatiTrasportoAnagraficiVettore() { + return getVettore(); + } + + public String getFEDatiTrasportoInterfaceNumeroLicenzaGuida() { + return null; + } + + public String getFEDatiTrasportoMezzoTrasporto() { + return null; + } + + public String getFEDatiTrasportoCausaleTrasporto() { + return getCausaleTrasporto().getDescrizione(); + } + + public long getFEDatiTrasportoNumeroColli() { + return getNColli(); + } + + public String getFEDatiTrasportoDescrizione() { + return getNotaSpedizione(); + } + + public String getFEDatiTrasportoUnitaMisuraPeso() { + return "Kg"; + } + + public double getFEDatiTrasportoPesoLordo() { + return getKgLordo(); + } + + public double getFEDatiTrasportoPesoNetto() { + return getKgNetto(); + } + + public Time getFEDatiTrasportoDataOraRitiro() { + return null; + } + + public Date getFEDatiTrasportoDataInizioTrasporto() { + return getDataDocumento(); + } + + public String getFEDatiTrasportoTipoResa() { + return null; + } + + public FESedeInterface getFEDatiTrasportoIndirizzoResa() { + return null; + } + + public Time getFEDatiTrasportoDataOraConsegna() { + return null; + } + + public Vectumerator getFEScontoMaggiorazione() { + if (getScontoIncondizionato() == 0.0D && getAbbuono() == 0.0D) + return null; + Vectumerator vec = new Vectumerator(); + if (getScontoIncondizionato() > 0.0D) + vec.add(new FEScontoMaggiorazione("SC", 0.0D, getScontoIncondizionato())); + if (getAbbuono() > 0.0D) + vec.add(new FEScontoMaggiorazione("SC", 0.0D, getAbbuono())); + return vec; + } + + public ResParm sendDocumentiMailMessageExt(DocumentoCR CR, String eMail, String path, String testoAgg) { + ResParm rp = new ResParm(true); + StatusMsg.updateMsgByTag(getApFull(), "Sendmail Docs Ext", "Preparazione mail massiva a " + eMail + " in corso.."); + Vectumerator vec = findByCR(CR, 0, 0); + StringBuilder sbFileNames = new StringBuilder(); + StringBuilder sbFileNamesDesc = new StringBuilder(); + while (vec.hasMoreElements()) { + Documento doc = (Documento)vec.nextElement(); + CR.setId_documentoS(doc.getId_documento()); + StatusMsg.updateMsgByTag(getApFull(), "Sendmail Docs Ext", "Preparazione documento pdf " + + doc.getNumeroDocumento() + " in corso."); + doc.creaDocumentoPdf(CR, true); + sbFileNames.append(CR.getFilePdf()); + sbFileNamesDesc.append(doc.getNumeroDocumento()); + if (vec.hasMoreElements()) { + sbFileNames.append(","); + sbFileNamesDesc.append("
"); + } + } + String subject = getMailSubject() + " - Spedizione documenti "; + String l_testoAgg = testoAgg + "

Elenco documenti allegati:
" + testoAgg + "

"; + StatusMsg.updateMsgByTag(getApFull(), "Sendmail Docs Ext", "Invio mail massiva a " + eMail + " in corso.."); + rp = sendDocumentiMailMessage(sbFileNames.toString(), subject, eMail, l_testoAgg, path, + (CR.getFlgLink() == 1L)); + if (rp.getStatus()) { + vec.moveFirst(); + Timestamp tmst = getTimestamp(); + while (vec.hasMoreElements()) { + Documento doc = (Documento)vec.nextElement(); + doc.setTmstInvioMail(tmst); + } + } + return rp; + } + + private ResParm sendDocumentiMailMessage(String fileNames, String subject, String eMail, String testoAgg, String path, boolean useLink) { + ResParm rp = new ResParm(true); + if (!fileNames.isEmpty()) + try { + MailProperties mp = new MailProperties(); + String corpoMessaggio = ""; + if (useLink) { + fileNames = fileNames.replace(getDocBase(), ""); + fileNames = fileNames.replace(getPathStampeDocumenti(), ""); + fileNames = URLEncoder.encode(EcDc.encodeDizionario(fileNames, _AnagAdapter.KEY_ENCODE_DIZ), "utf-8"); + String id = URLEncoder.encode(EcDc.encodeDizionario(String.valueOf(getId_documento()), _AnagAdapter.KEY_ENCODE_DIZ), "utf-8"); + corpoMessaggio = "Clicca sul documento per scaricarlo:
" + getDescDocumenti() + ""; + } else { + corpoMessaggio = "In allegato i seguenti documenti in formato PDF.
" + getDescDocumenti(); + mp.put("FILES", fileNames); + } + if (!testoAgg.isEmpty()) + corpoMessaggio = corpoMessaggio + "

" + corpoMessaggio; + if (!getParm("DOC_FIRMA_INVIO_FATTURA").getTesto().isEmpty() && getFlgStato() == 1L) + corpoMessaggio = corpoMessaggio + "

" + corpoMessaggio + "

"; + mp.setProperty("TO", eMail); + mp.setProperty("ISHTML", "true"); + mp.setProperty("FROM", getMessaggioDocumentiEmailFrom()); + mp.setProperty("SUBJECT", subject); + mp.setProperty("MSG", corpoMessaggio); + mp.setProperty("BCC", getParm("DOC_BCC").getTesto()); + sendMailMessage(mp); + } catch (Exception e) { + rp.setException(e); + } + return rp; + } + + public static boolean isThreadAttivo() { + return (threadSendMail || threadCreaFattureTessitura); + } + + public final ResParm startThreadCreaFtTessitura(DocumentoCR l_CR, long l_id_cliforR, long l_id, long l_id_tipoDocumentoFiglio, long l_flgTipoGenerazione, Users operatore) { + if (!isThreadAttivo()) { + new ThreadCreaFtTessitura(l_CR, l_id_cliforR, l_id, l_id_tipoDocumentoFiglio, l_flgTipoGenerazione, operatore); + return new ResParm(true, "Thread Crea Fattura Tessitura avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public ResParm sendDocumentiMailMessagePerClifor(DocumentoCR CR, String path, String testoAgg) { + ResParm rp = new ResParm(true); + CR.setFlgTipologia(20L); + CR.setFlgStato(1L); + Vectumerator vec = findByCR(CR, 0, 0); + HashMap hmClifor = new HashMap<>(); + while (vec.hasMoreElements()) { + Documento documento = (Documento)vec.nextElement(); + if (!hmClifor.containsKey(Long.valueOf(documento.getId_clifor()))) + hmClifor.put(new Long(documento.getId_clifor()), documento.getClifor()); + } + Clifor row = new Clifor(getApFull()); + for (Map.Entry entry : hmClifor.entrySet()) { + long key = entry.getKey(); + row.findByPrimaryKey(key); + System.out.println("Invio mail massive a " + row.getNominativoCompleto() + " - " + row.getEMail()); + StatusMsg.updateMsgByTag(getApFull(), "Sendmail Docs", "Invio mail massive a " + + row.getNominativoCompleto() + " - " + row.getEMail() + " in corso.."); + CR.setId_clifor(key); + CR.setId_documentoS(0L); + vec = findByCR(CR, 0, 0); + StringBuilder sbFileNames = new StringBuilder(); + StringBuilder sbFileNamesDesc = new StringBuilder(); + while (vec.hasMoreElements()) { + Documento doc = (Documento)vec.nextElement(); + CR.setId_documentoS(doc.getId_documento()); + doc.creaDocumentoPdf(CR, true); + sbFileNames.append(CR.getFilePdf()); + sbFileNamesDesc.append(doc.getNumeroDocumento()); + if (vec.hasMoreElements()) { + sbFileNames.append(","); + sbFileNamesDesc.append("
"); + } + } + String subject = getMailSubject() + " - Spedizione documenti "; + String l_testoAgg = testoAgg + "

Elenco documenti allegati:
" + testoAgg + "

"; + rp = sendDocumentiMailMessage(sbFileNames.toString(), subject, row.getEMail(), l_testoAgg, path, + (CR.getFlgLink() == 1L)); + if (rp.getStatus()) { + vec.moveFirst(); + Timestamp tmst = getTimestamp(); + while (vec.hasMoreElements()) { + Documento doc = (Documento)vec.nextElement(); + doc.setTmstInvioMail(tmst); + doc.superSave(); + } + } + } + return rp; + } + + public String getProgFileFE() { + if (getId_documento() == 0L) + return null; + return Long.toString(getId_documento(), 36); + } + + public void setProgFileFE(String progFileFE) { + this.progFileFE = progFileFE; + } + + public String getFEProgressivoFile() { + return getProgFileFE(); + } + + public Vectumerator getFEDettaglioLineeAltre() { + if (getSpeseTrasporto() > 0.0D || getSpeseIncasso() > 0.0D || getSpeseAltre() > 0.0D || getScontoIncondizionato() > 0.0D || getAbbuono() > 0.0D) { + Vectumerator vec = new Vectumerator(); + if (getSpeseTrasporto() > 0.0D) + vec.add(new FEDettaglioLinea("", "Spesa trasporto", 1.0D, getSpeseTrasporto(), getSpeseTrasporto(), + (double)getIvaDoc().getAliquota(), getIvaDoc().getFENatura())); + if (getSpeseIncasso() > 0.0D) + vec.add(new FEDettaglioLinea("", "Spese incasso", 1.0D, getSpeseIncasso(), getSpeseIncasso(), + (double)getIvaDoc().getAliquota(), getIvaDoc().getFENatura())); + if (getSpeseAltre() > 0.0D) + vec.add(new FEDettaglioLinea("", + getDescSpeseAltre().equals("") ? "Altre Spese" : getDescSpeseAltre(), 1.0D, getSpeseAltre(), + getSpeseAltre(), (double)getIvaDoc().getAliquota(), getIvaDoc().getFENatura())); + if (getScontoIncondizionato() > 0.0D) + vec.add(new FEDettaglioLinea("SC", "Sconto Incondizionato", 1.0D, -getScontoIncondizionato(), + -getScontoIncondizionato(), (double)getIvaDoc().getAliquota(), getIvaDoc().getFENatura())); + if (getAbbuono() > 0.0D) + vec.add(new FEDettaglioLinea("SC", "Sconto Incondizionato", 1.0D, -getAbbuono(), + -getAbbuono(), (double)getIvaDoc().getAliquota(), getIvaDoc().getFENatura())); + return vec; + } + return null; + } + + public String getFEParmSfx() { + return getTipoDocumento().getSuffissoFattElett(); + } + + public ResParm setFEAggiornaTmstFileXml() { + setTmstFileXml(getTimestamp()); + return superSave(); + } + + public long getFlgStatoInvioXml() { + return this.flgStatoInvioXml; + } + + public void setFlgStatoInvioXml(long flgStatoInvioXml) { + this.flgStatoInvioXml = flgStatoInvioXml; + } + + public Timestamp getTmstInvioXml() { + return this.tmstInvioXml; + } + + public void setTmstInvioXml(Timestamp tmstInvioXml) { + this.tmstInvioXml = tmstInvioXml; + } + + public boolean isFileXmlCreato() { + if (getTmstFileXml() == null) + return false; + return true; + } + + public String getFELinkXml(String parmSfx) { + return FeXml.getFileXmlToDocbase(this, parmSfx); + } + + public String getCodiceCIG() { + return (this.codiceCIG == null) ? "" : this.codiceCIG.trim(); + } + + public void setCodiceCIG(String codiceCIG) { + this.codiceCIG = codiceCIG; + } + + public String getCodiceCUP() { + return (this.codiceCUP == null) ? "" : this.codiceCUP.trim(); + } + + public void setCodiceCUP(String codiceCUP) { + this.codiceCUP = codiceCUP; + } + + public String getCodiceCommessa() { + return (this.codiceCommessa == null) ? "" : this.codiceCommessa.trim(); + } + + public void setCodiceCommessa(String codiceCommessa) { + this.codiceCommessa = codiceCommessa; + } + + public Vectumerator getFEDatiPagamento() { + if (getId_tipoPagamento() == 0L) + return null; + Vectumerator res = new Vectumerator(); + FEDatiPagamento datiPagamento = new FEDatiPagamento(); + datiPagamento.setCondizioniPagamento("TP02"); + Vectumerator vecDettaglioPagamento = new Vectumerator(); + DocumentoScadenza scadenza = new DocumentoScadenza(getApFull()); + Vectumerator vec = scadenza.findByDocumento(getId_documento()); + if (vec.hasMoreElements()) + while (vec.hasMoreElements()) { + scadenza = (DocumentoScadenza)vec.nextElement(); + FEDettaglioPagamento dp = new FEDettaglioPagamento(); + dp.setModalitaPagamento(getTipoPagamento().getFEModalitaPagamento()); + dp.setDataScadenzaPagamento(scadenza.getDataScadenza()); + dp.setImportoPagamento(scadenza.getImportoScadenza()); + if (getTipoPagamento().getFlgTipoPagamento() == 1L) { + if (!getBancaCFDesc().isEmpty()) + dp.setIstitutoFinanziario(getBancaCFDesc()); + if (!getClifor().getAbi().isEmpty() && !getClifor().getCab().isEmpty()) { + dp.setABI(getClifor().getAbi()); + dp.setCAB(getClifor().getCab()); + } + } else if (getTipoPagamento().getFlgTipoPagamento() == 2L) { + if (!getIban().isEmpty()) + dp.setIBAN(getIban()); + if (!getBic().isEmpty()) + dp.setBIC(getBic()); + } + vecDettaglioPagamento.add(dp); + } + datiPagamento.setVecDettaglioPagamento(vecDettaglioPagamento); + res.add(datiPagamento); + return res; + } + + public long getId_magFisicoPartenza2() { + return this.id_magFisicoPartenza2; + } + + public void setId_magFisicoPartenza2(long id_magFisicoPartenza2) { + this.id_magFisicoPartenza2 = id_magFisicoPartenza2; + setMagFisicoPartenza2(null); + } + + public String getDescrizioneDocumento() { + return this.descrizioneDocumento; + } + + public void setDescrizioneDocumento(String descrizioneDocumento) { + this.descrizioneDocumento = descrizioneDocumento; + } + + public long getId_magFisicoArrivo2() { + return this.id_magFisicoArrivo2; + } + + public void setId_magFisicoArrivo2(long id_magFisicoArrivo2) { + this.id_magFisicoArrivo2 = id_magFisicoArrivo2; + setMagFisicoArrivo2(null); + } + + public MagFisico getMagFisicoArrivo2() { + this.magFisicoArrivo2 = (MagFisico)getSecondaryObject(this.magFisicoArrivo2, MagFisico.class, getId_magFisicoArrivo2()); + return this.magFisicoArrivo2; + } + + public void setMagFisicoArrivo2(MagFisico magFisicoArrivo2) { + this.magFisicoArrivo2 = magFisicoArrivo2; + } + + public MagFisico getMagFisicoPartenza2() { + this.magFisicoPartenza2 = (MagFisico)getSecondaryObject(this.magFisicoPartenza2, MagFisico.class, getId_magFisicoPartenza2()); + return this.magFisicoPartenza2; + } + + public void setMagFisicoPartenza2(MagFisico magFisicoPartenza2) { + this.magFisicoPartenza2 = magFisicoPartenza2; + } + + public boolean isRigheArticoliEnabled(int tabNumber) { + if (tabNumber == 1) { + if (getTipoDocumento().getFlgAFT() == 0L) + return true; + return false; + } + if (getTipoDocumento().getFlgAFT2() == 0L) + return true; + return false; + } + + public long isRigheArticoliEnabled() { + return isRigheArticoliEnabled(1) ? 1L : 0L; + } + + public boolean isRigheTessutiEnabled(int tabNumber) { + if (tabNumber == 1) { + if (getTipoDocumento().getFlgAFT() == 2L) + return true; + return false; + } + if (getTipoDocumento().getFlgAFT2() == 2L) + return true; + return false; + } + + public long isRigheTessutiEnabled() { + return isRigheTessutiEnabled(1) ? 1L : 0L; + } + + public boolean isRigheFilatiEnabled(int tabNumber) { + if (tabNumber == 1) { + if (getTipoDocumento().getFlgAFT() == 1L) + return true; + return false; + } + if (getTipoDocumento().getFlgAFT2() == 1L) + return true; + return false; + } + + public long isRigheFilatiEnabled() { + return isRigheFilatiEnabled(1) ? 1L : 0L; + } + + public boolean isMagazzinoArticoloEnabled(int l_numArticolo) { + if (isRigheArticoliEnabled(l_numArticolo) && ((l_numArticolo == 1 && getTipoDocumento().getId_causaleMagazzino() > 0L) || (l_numArticolo == 2 && + getTipoDocumento().getId_causaleMagazzino2() > 0L))) + return true; + return false; + } + + public boolean isMagazzinoFilatoEnabled(int l_numArticolo) { + if (isRigheFilatiEnabled(l_numArticolo) && ((l_numArticolo == 1 && getTipoDocumento().getId_causaleMagazzino() > 0L) || (l_numArticolo == 2 && + getTipoDocumento().getId_causaleMagazzino2() > 0L))) + return true; + return false; + } + + public boolean isMagazzinoFilatoSelected(int l_numArticolo) { + if (!isMagazzinoFilatoEnabled(l_numArticolo)) + return true; + if (l_numArticolo == 1) { + if (getId_magFisicoArrivo() > 0L || getId_magFisicoPartenza() > 0L) + return true; + return false; + } + if (getId_magFisicoArrivo2() > 0L || getId_magFisicoPartenza2() > 0L) + return true; + return false; + } + + public boolean isMagazzinoTessutoEnabled(int l_numArticolo) { + if (isRigheTessutiEnabled(l_numArticolo) && ((l_numArticolo == 1 && getTipoDocumento().getId_causaleMagazzino() > 0L) || (l_numArticolo == 2 && + getTipoDocumento().getId_causaleMagazzino2() > 0L))) + return true; + return false; + } + + public boolean isMagazzinoTessutoSelected(int l_numArticolo) { + if (!isMagazzinoTessutoEnabled(l_numArticolo)) + return true; + if (l_numArticolo == 1) { + if (getId_magFisicoArrivo() > 0L || getId_magFisicoPartenza() > 0L) + return true; + return false; + } + if (getId_magFisicoArrivo2() > 0L || getId_magFisicoPartenza2() > 0L) + return true; + return false; + } + + public Timestamp getTsFineLavorazione() { + return this.tsFineLavorazione; + } + + public String getTsFineLavorazioneS() { + return (getTsFineLavorazione() == null) ? "" : getTimestampFormat().format(getTsFineLavorazione()); + } + + public Timestamp getTsInizioLavorazione() { + return this.tsInizioLavorazione; + } + + public String getTsInizioLavorazioneS() { + return (getTsInizioLavorazione() == null) ? "" : getTimestampFormat().format(getTsInizioLavorazione()); + } + + public void setTsFineLavorazione(Timestamp tsFineLavorazione) { + this.tsFineLavorazione = tsFineLavorazione; + } + + public static final String getStatoLavorazione(long l_flgStatoLavorazione) { + if (l_flgStatoLavorazione == 0L) + return "Da Pianificare"; + if (l_flgStatoLavorazione == 10L) + return "Pianificata"; + if (l_flgStatoLavorazione == 20L) + return "In Lavorazione"; + if (l_flgStatoLavorazione == 30L) + return "In Fase di Taglio"; + if (l_flgStatoLavorazione == 100L) + return "Concluso"; + if (l_flgStatoLavorazione == -1L) + return "Aperta"; + return "-- scegli stato lavorazione --"; + } + + public void setTsInizioLavorazione(Timestamp tsInizioLavorazione) { + this.tsInizioLavorazione = tsInizioLavorazione; + } + + public long getFlgStatoLavorazione() { + return this.flgStatoLavorazione; + } + + public String getStatoLavorazione() { + return getStatoLavorazione(getFlgStatoLavorazione()); + } + + public void setFlgStatoLavorazione(long flgStatoLavorazione) { + this.flgStatoLavorazione = flgStatoLavorazione; + } + + public double getMtTotali() { + if (getId_documento() == 0L || getTipoDocumento().getFlgTipologia() != 200L) + return 0.0D; + return new LavPezza(getApFull()).getTotMetriByDocumentoDTESS(getId_documento(), false); + } + + public long getPezzeTotali() { + if (getId_documento() > 0L) + return new LavPezza(getApFull()).getTotPezzeByDocumentoDTESS(getId_documento()); + return 0L; + } + + public long getPezzeTotaliInviate() { + if (getId_documento() > 0L) + return new LavPezza(getApFull()).getTotPezzeInviateByDocumentoDTESS(getId_documento()); + return 0L; + } + + public long getPezzeTotaliFatturate() { + if (getId_documento() > 0L) + return new LavPezza(getApFull()).getTotPezzeFatturateByDocumentoDTESS(getId_documento()); + return 0L; + } + + public long getStacchiTotali() { + if (getId_documento() > 0L) + return new RigaDocumento(getApFull()).getTotalePezzeStacchiByDocumento(getId_documento()); + return 0L; + } + + public long getFlgBarcodeType() { + return this.flgBarcodeType; + } + + public void setFlgBarcodeType(long flgBarcodeType) { + this.flgBarcodeType = flgBarcodeType; + } + + public long getFlgBarcodeSequenzaNumeri() { + return this.flgBarcodeSequenzaNumeri; + } + + public void setFlgBarcodeSequenzaNumeri(long flgBarcodeSequenzaNumeri) { + this.flgBarcodeSequenzaNumeri = flgBarcodeSequenzaNumeri; + } + + public String getBarcodeType() { + return getBarcodeType(getFlgBarcodeType()); + } + + public String getOrdineCodiceCIG() { + return (this.ordineCodiceCIG == null) ? "" : this.ordineCodiceCIG.trim(); + } + + public String getOrdineCodiceCUP() { + return (this.ordineCodiceCUP == null) ? "" : this.ordineCodiceCUP.trim(); + } + + public void setOrdineCodiceCIG(String ordineCodiceCIG) { + this.ordineCodiceCIG = ordineCodiceCIG; + } + + public void setOrdineCodiceCUP(String ordineCodiceCUP) { + this.ordineCodiceCUP = ordineCodiceCUP; + } + + public ResParm addRigaDocumentoDaPrelevareOLD(RigaDocumento rddp, double l_qtaDaPrelevare) { + ResParm rp = new ResParm(false); + rp = checkEMSTA(); + if (rp.getStatus()) { + DoubleOperator dop = new DoubleOperator(l_qtaDaPrelevare); + Vectumerator vec = findRigheDocumentoByArticoloArticoloVariante(rddp.getId_articolo(), + rddp.getId_articoloVariante()); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getId_articolo() == rddp.getId_articolo() && row.getId_articoloVariante() == rddp.getId_articoloVariante()) + if (row.getQuantita() != 0.0D) { + RigaDocumentoP rdp = new RigaDocumentoP(getApFull()); + rdp.setId_rigaDocumento(row.getId_rigaDocumento()); + rdp.setId_documento(row.getId_documento()); + rdp.setId_rigaDocumentoPrelevata(rddp.getId_rigaDocumento()); + if (row.getQuantita() <= dop.getResult()) { + rdp.setQuantitaPrelevata(row.getQuantita()); + } else { + rdp.setQuantitaPrelevata(dop.getResult()); + } + rp = row.addRigaDocumentoP(rdp); + try { + double qtaPrelevata; + RigaDocumento rd = (RigaDocumento)row.clone(); + rd.setId_rigaDocumento(0L); + rd.setDBState(0); + rd.setId_rigaDocumentoMov(row.getId_rigaDocumento()); + rd.setId_rigaDocumentoPrelevata(rddp.getId_rigaDocumento()); + rd.setId_magFisico(rddp.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo()); + rd.setSegnoMov(-1L); + if (row.getQuantita() <= dop.getResult()) { + qtaPrelevata = row.getQuantita(); + } else { + qtaPrelevata = dop.getResult(); + } + if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 1L) { + rd.setNr(qtaPrelevata); + } else if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 2L) { + rd.setKg(qtaPrelevata); + } else if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 3L) { + rd.setMt(qtaPrelevata); + } + rp = rd.saveMov(); + } catch (Exception e) { + e.printStackTrace(); + } + if (rp.getStatus()) { + Movimento mov = new Movimento(getApFull()); + mov.setId_articolo(row.getId_articolo()); + mov.setId_articoloVariante(row.getId_articoloVariante()); + mov.setId_articoloTaglia(row.getId_articoloTaglia()); + mov.setId_clifor(getId_clifor()); + mov.setId_causaleMagazzino(getTipoDocumento().getId_causaleMagazzino()); + long l_id_magazzinoFisicoDocumentoDaPrelevare = rddp.getDocumento().getTipoDocumento().getCausaleMagazzino() + .getId_magFisicoArrivo(); + mov.setId_magFisico(l_id_magazzinoFisicoDocumentoDaPrelevare); + mov.setId_rigaDocumento(row.getId_rigaDocumento()); + if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 1L) { + mov.setNr(-1.0D * rdp.getQuantitaPrelevata()); + } else if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 2L) { + mov.setKg(-1.0D * rdp.getQuantitaPrelevata()); + } else if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 3L) { + mov.setMt(-1.0D * rdp.getQuantitaPrelevata()); + } + rp = mov.save(); + dop.subtract(rdp.getQuantitaPrelevata()); + } + if (dop.getResult() <= 0.0D) + break; + } + } + boolean checkPrelievo = true; + Documento ordine = rddp.getDocumento(); + Vectumerator vecRows = ordine.findRigheDocumento(0, 0, 0); + while (vecRows.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRows.nextElement(); + if (row.getFlgRigaPrelevata() == 0L) { + checkPrelievo = false; + break; + } + } + if (checkPrelievo) { + ordine.setFlgDocumentoPrelevato(1L); + ordine.superSave(); + } + } else { + rp.setMsg("ERRORE! Fattura emessa o stampata! Impossibile salvare."); + } + return rp; + } + + public ResParm save() { + return saveSynchro(this); + } + + public Vectumerator findByCRSoloArticoli(DocumentoCR CR, int pageNumber, int pageRows) { + StringBuffer s_Sql_Find = new StringBuffer("select A.id_documento,A.progDocumento,A.dataDocumento, A.id_esercizio,A.id_clifor,A.id_tipoDocumento, A.id_articolo,A.id_taglia from DOCUMENTO AS A "); + String s_Sql_Order = " order by A.dataDocumento asc, A.id_esercizio asc, A.progDocumento asc, D.nome"; + WcString wc = new WcString(); + CR.setFlgRicercaPerTaglio(1L); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + findByCRCreateStmtDate(CR, stmt); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public static String getBarcodeType(long l_flgBarcodeType) { + switch ((int)l_flgBarcodeType) { + case 100: + return "Generato"; + case 0: + return "Lunghezza Totale"; + case 1: + return "Lunghezza Totale -1"; + } + return "????"; + } + + public long getTipoCaricoScarico2() { + if (getTipoDocumento().getFlgNoAnag2() == 1L) + return -1L; + if (getId_magFisicoPartenza2() != 0L) + return 1L; + if (getTipoDocumento().getCausaleMagazzino2().getId_magFisicoPartenza() != 0L) + return 1L; + return 0L; + } + + public long getId_taglia() { + return this.id_taglia; + } + + public Taglia getTaglia() { + this.taglia = (Taglia)getSecondaryObject(this.taglia, Taglia.class, getId_taglia()); + return this.taglia; + } + + public void setId_taglia(long id_taglia) { + this.id_taglia = id_taglia; + } + + public void setTaglia(Taglia taglia) { + this.taglia = taglia; + } + + public double getTotNr() { + if (getId_documento() == 0L) + return 0.0D; + String s_Sql_Find = "select SUM(A.nr) AS _sum from RIGA_DOCUMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_documento = " + getId_documento()); + wc.addWc("flgCodiceRiga =0 "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public static final synchronized ResParm calcolaTessutiTaglioCHENONSERVEAUNTUBO(Documento bean, String lang) { + ResParm rp = new ResParm(true); + boolean debug = false; + String debugInfo = "calcolaTessutiTaglio"; + RigaDocumento rd = new RigaDocumento(bean.getApFull()); + rd.impostaDaCancellareByDocumentoCodiceriga(bean.getId_documento(), 1L, true); + Vectumerator vecRd = bean.findRigheDocumento(0, 0, 0); + if (vecRd.getTotNumberOfRecords() > 0) { + Vectumerator vecTessTaglio = findTessutiPerTaglio(bean); + while (vecTessTaglio.hasMoreElements()) { + ArticoloTessutoColore row = (ArticoloTessutoColore)vecTessTaglio.nextElement(); + rd = new RigaDocumento(bean.getApFull()); + rd.findByDocumentoArticoloTessutoColore(bean.getId_documento(), row.getId_articoloTessutoColore(), 1L); + if (rd.getId_rigaDocumento() > 0L) { + rd.setMt(row.getMtLavorazioneTaglio()); + } else { + rd.setId_documento(bean.getId_documento()); + rd.setFlgCodiceRiga(1L); + rd.setId_articoloTessutoColore(row.getId_articoloTessutoColore()); + rd.setId_articoloTessuto(rd.getArticoloTessutoColore().getId_articoloTessuto()); + rd.setMt(row.getMtLavorazioneTaglio()); + rd.setDescrizioneRiga(rd.getArticoloTessutoColore().getDescrizioneCompleta()); + rd.setId_causaleMagazzino(bean.getTipoDocumento().getId_causaleMagazzino2()); + } + rd.setFlgDaCancellare(0L); + addRigaDocumentoTessuto(bean, rd, 1L); + } + ArticoloArticoloTessuto att = new ArticoloArticoloTessuto(bean.getApFull()); + boolean salvaNtr = true; + while (vecRd.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRd.nextElement(); + if (row.getFlgDaCancellare() == 1L) { + row.delete(); + continue; + } + NumeroTeliRiga ntr = new NumeroTeliRiga(bean.getApFull()); + Vectumerator vec100 = bean.findRigheDocumentoDisposizioneTaglio(0, 0, 2); + while (vec100.hasMoreElements()) { + RigaDocumento row100 = (RigaDocumento)vec100.nextElement(); + ntr.findByRDArticoloRDTessuto(row.getId_rigaDocumento(), row100.getId_rigaDocumento()); + if (ntr.getId_numeroTeliRiga() > 0L); + salvaNtr = true; + if (row100.getId_articoloTessutoColore() > 0L) { + att.findByArticoloVarianteArticoloTessutoColore(row.getId_articoloVariante(), row100.getId_articoloTessuto(), + row100.getId_articoloTessutoColore()); + if (att.getId_articoloArticoloTessuto() == 0L) + salvaNtr = false; + } + if (salvaNtr) { + ntr.setId_rigaDocumentoArticolo(row.getId_rigaDocumento()); + ntr.setId_rigaDocumentoTessuto(row100.getId_rigaDocumento()); + long numTeli = (long)Math.ceil(row.getNr() / (double)row100.getCapiPerTelo()); + ntr.setNumTeliRiga(numTeli); + if (att.getId_articoloArticoloTessuto() <= 0L) + att.findByArticoloVarianteArticoloTessutoColore(row.getId_articoloVariante(), + row100.getId_articoloTessuto(), 0L); + DoubleOperator metriRd = new DoubleOperator(row.getNr()); + metriRd.multiply(att.getMtATT()); + metriRd.setScale(2, 5); + ntr.setMtTessutoRiga(metriRd.getResult()); + ntr.save(); + } + att.setId_articoloArticoloTessuto(0L); + att.setDBState(0); + } + } + } + RigaDocumentoCR CR = new RigaDocumentoCR(); + CR.setFlgDaCancellare(1L); + CR.setId_documento(bean.getId_documento()); + vecRd = rd.findByCR(CR, 0, 0); + while (vecRd.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRd.nextElement(); + row.delete(); + } + return rp; + } + + public String getCausale() { + return (this.causale == null) ? "" : this.causale.trim(); + } + + public void setCausale(String causale) { + this.causale = causale; + } + + public ByteArrayOutputStream creaLabelDocumentoArticoliA4Pdf(DocumentoCR CR) { + long pHMarg = getParm("LABEL_ART_A4_MARGINE").getNumeroLong(); + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + this.document = new Document(PageSize.A4, 0.0F, 0.0F, 0.0F, 0.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + String titoloReport = getNumeroDocumentoCompleto(); + SimpleDateFormat tf = new SimpleDateFormat("HH:mm:ss"); + Date today = getToday(); + titoloReport = titoloReport + ". Stampato il " + titoloReport + " " + getDataFormat().format(today); + this.document.open(); + long labelNumber = 0L; + String dim = getParm("LABEL_ART_A4_COL_ROW").getTesto(); + int nCol = Integer.parseInt(dim.substring(0, dim.indexOf(','))); + int nRow = Integer.parseInt(dim.substring(dim.indexOf(',') + 1)); + this.pdfPcorpo = new PdfPTable(nCol); + this.pdfPcorpo.setWidthPercentage(100.0F); + Documento doc = new Documento(getApFull()); + doc.findByPrimaryKey(CR.getId_documentoS()); + if (doc.hasLabelDaStampare()) { + if (CR.getBlankLabels() > 0L) { + PdfPCell pdfPCell = new PdfPCell(); + pdfPCell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + pdfPCell.setBorder(0); + for (int i = 0; (long)i < CR.getBlankLabels(); i++) { + labelNumber++; + this.pdfPcorpo.addCell(pdfPCell); + } + } + Vectumerator vec = findByCR(CR, 0, 0); + long numbOfLabels = 1L; + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vecRighe = row.findRigheDocumento(0, 0, ordineInverso); + while (vecRighe.hasMoreElements()) { + RigaDocumento rowRD = (RigaDocumento)vecRighe.nextElement(); + if (rowRD.getFlgUdm() == 1L) { + numbOfLabels = (long)rowRD.getQuantita(); + } else { + numbOfLabels = 1L; + } + rowRD.getArticolo().setWriter(getWriter()); + rowRD.getArticolo().setPdfPcorpo(getPdfPcorpo()); + String descLabel = rowRD.getDescrizioneRigaCompleta(); + numbOfLabels = (long)rowRD.getArticolo().addLabelUnArticoloA4Pdf(titoloReport, nRow, numbOfLabels, descLabel, + rowRD.getId_articoloVariante()); + labelNumber += numbOfLabels; + } + } + long numberBlankCell = (long)nCol - labelNumber % (long)nCol; + PdfPCell cell = new PdfPCell(); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorder(0); + if (numberBlankCell != (long)nCol) + for (int i = 0; (long)i < numberBlankCell; i++) + this.pdfPcorpo.addCell(cell); + } else { + Phrase ph = new Phrase("Attenzione! Non ci sono etichette da stampare!"); + PdfPCell cell = new PdfPCell(ph); + cell.setFixedHeight((PageSize.A4.getHeight() - (float)pHMarg) / (float)nRow); + cell.setBorder(0); + cell.setColspan(nCol); + this.pdfPcorpo.addCell(cell); + } + this.document.add((Element)this.pdfPcorpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public boolean hasTutteRigheTessTelaio() { + if (getId_documento() == 0L) + return false; + Vectumerator vec = new RigaDocumento(getApFull()).findRigheSenzaTelaioByDocumento(getId_documento()); + if (vec.hasMoreElements()) + return false; + return true; + } + + public boolean hasAlmentoUnaRigaTessTelaio() { + if (getId_documento() == 0L) + return false; + Vectumerator vec = new RigaDocumento(getApFull()).findRigheConTelaioByDocumento(getId_documento()); + if (vec.hasMoreElements()) + return true; + return false; + } + + public long getTotaleColpi() { + return this.totaleColpi; + } + + public void setTotaleColpi(long totaleColpi) { + this.totaleColpi = totaleColpi; + } + + public Vectumerator findRigheDocumento2(String l_search, int pageNumber, int pageRows, int ordinamentoRiga) { + return findRigheDocumento(1L, l_search, pageNumber, pageRows, ordinamentoRiga); + } + + public ResParm creaDocumentoFiglio(long l_id_clifor, long l_id_tipoDocumentoDaGenerare, Users operatore, boolean creaBozza, long l_flgTipoCreazione) { + String TAG_THREAD_MSG = "CREAZIONE DOCUMENTO FIGLIO"; + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "inizio...."); + ResParm rp = new ResParm(true); + if (getTipoDocumento().getTipologiaDocumento().getCodice() == 200L) { + rp.append(creaDocumentoFiglioDaDisposizioniTessitura(l_id_clifor, l_id_tipoDocumentoDaGenerare, operatore, creaBozza, l_flgTipoCreazione)); + } else { + long resRigheUsato = hasRigheConUsato(); + if (resRigheUsato == 0L) { + rp.append(creaDocumentoFiglioConControlloUsato(l_id_clifor, l_id_tipoDocumentoDaGenerare, operatore, creaBozza, l_flgTipoCreazione, false)); + } else { + Vectumerator vecDP; + TipoDocumento tdDaGenerare = new TipoDocumento(getApFull()); + tdDaGenerare.findByPrimaryKey(l_id_tipoDocumentoDaGenerare); + if (tdDaGenerare.getId_tipoDocumento() == 0L) { + vecDP = AB_EMPTY_VECTUMERATOR; + } else { + vecDP = getTipoDocumento().findDocGen(2L, + tdDaGenerare.getId_tipologiaDocumento(), 1, 1); + } + if (vecDP.hasMoreElements()) { + DocPrel dpUsato = (DocPrel)vecDP.nextElement(); + long l_id_tipoDocumentoUSATO = dpUsato.getId_tipoDocumento(); + if (resRigheUsato == 2L || resRigheUsato == 4L || resRigheUsato == 6L) + rp.append(creaDocumentoFiglioConControlloUsato(l_id_clifor, l_id_tipoDocumentoDaGenerare, operatore, creaBozza, l_flgTipoCreazione, false)); + if (resRigheUsato == 2L || resRigheUsato == 1L || resRigheUsato == 6L || resRigheUsato == 5L) + rp.append(creaDocumentoFiglioConControlloUsato(l_id_clifor, l_id_tipoDocumentoUSATO, operatore, false, l_flgTipoCreazione, true)); + if (resRigheUsato == 3L || resRigheUsato == 4L || resRigheUsato == 6L || resRigheUsato == 5L) + rp.append(creaDocumentoFiglioConControlloUsato(l_id_clifor, l_id_tipoDocumentoUSATO, operatore, false, l_flgTipoCreazione, false)); + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Non ho documenti di tipo usato come figlio."); + } + } + } + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, rp.getMsg()); + StatusMsg.deleteMsgByTag(getApFull(), TAG_THREAD_MSG); + return rp; + } + + private ResParm creaDocumentoFiglioConControlloUsato(long l_id_clifor, long l_id_tipoDocumentoFiglio, Users operatore, boolean creaBozza, long l_flgTipoCreazioneRiga, boolean seUsatoCreaRm) { + if (l_id_clifor == 0L) + l_id_clifor = getId_clifor(); + if (getTipoDocumento().getFlgObbligoPrelievo() == 1L) + return new ResParm(false, "ERRORE! Figlio non generabile. Documento con obbligo di prelievo"); + long righeCreate = 0L; + ResParm rp = new ResParm(); + ResParm rpRow = new ResParm(); + if (getDBState() == 1) { + TipoDocumento tdGen = new TipoDocumento(getApFull()); + tdGen.findByPrimaryKey(l_id_tipoDocumentoFiglio); + boolean isDocUsato = (tdGen.getFlgUsato() == 1L); + long resRigheUsato = hasRigheConUsato(); + if (!isDocumentoFiglioCreabile()) { + rp.setStatus(false); + rp.setMsg("Errore! Documento figlio non creabile..."); + } else if (!getTipoDocumento().isTipoDocGenerabile(l_id_tipoDocumentoFiglio)) { + rp.setStatus(false); + rp.setMsg("Errore! Il tipo di documento " + tdGen.getDescrizioneCompleta() + " non è generabile!"); + } else { + TipoDocumento tdf = new TipoDocumento(getApFull()); + tdf.findByPrimaryKey(l_id_tipoDocumentoFiglio); + if (tdf.getId_causaleMagazzino() != 0L && hasRigheDisponibili() == 0) { + rp.setMsg("Errore! L'attuale documento non ha articoli disponibili per lo scarico mentre il documento figlio prevede lo scarico dal magazzino."); + } else { + Documento doc = new Documento(getApFull()); + if (creaBozza) + doc.findDocumentoBozza(l_id_tipoDocumentoFiglio, l_id_clifor); + if (doc.getDBState() == 0) { + Clifor clienteDoc; + doc.setId_tipoDocumento(l_id_tipoDocumentoFiglio); + if (tdf.getId_tipoDocumento() == getId_docCassa()) { + if (getTipoDocumento().getFlgTipologia() == 4L) { + if (getId_clifor() > 1L) { + doc.setId_clifor(getId_clifor()); + doc.setId_cliforListino(getId_clifor()); + clienteDoc = doc.getCliforListino(); + } else { + clienteDoc = new Clifor(getApFull()); + } + } else { + doc.setId_clifor(1L); + doc.setId_cliforListino(l_id_clifor); + clienteDoc = doc.getCliforListino(); + } + } else { + doc.setId_clifor(l_id_clifor); + clienteDoc = doc.getClifor(); + } + if (operatore != null) { + if (getId_tipoDocumento() == getId_docCassa()) { + Vectumerator vecp = findDocumentiPadre(); + if (vecp.size() == 1) { + Documento docp = (Documento)vecp.nextElement(); + if (docp.getTipoDocumento().getTipologiaDocumento() + .getCodice() == 4L) + doc.setId_users(docp.getId_users()); + } else { + doc.setId_users(operatore.getId_users()); + } + } else if (getTipoDocumento().getFlgTipologia() == 4L) { + doc.setId_users(0L); + } else { + doc.setId_users(operatore.getId_users()); + } + } else { + doc.setId_users(getId_users()); + } + doc.setNominativoDocumento(getNominativoDocumento()); + if (clienteDoc.getId_tipoPagamento() != 0L) { + doc.setId_tipoPagamento(clienteDoc.getId_tipoPagamento()); + } else { + doc.setId_tipoPagamento(getId_tipoPagamento()); + } + doc.setDataDocumento(getToday()); + if (getFlgPagata() == 1L) { + doc.setFlgPagata(1L); + doc.setDescTransaction(getDescTransaction()); + } + } + if (creaBozza) + doc.setFlgStato(0L); + double accontiDiff = 0.0D; + double importiRighe = 0.0D; + double totAcconti = getTotAccontiByDocumentoPadre(getId_documento()); + if (getAcconto() > totAcconti) + accontiDiff = getAcconto() - totAcconti; + doc.setNote(getNote()); + doc.setDataScadenzaPagamento(getDataScadenzaPagamento()); + doc.setFlgPagamentoDataFissa(getFlgPagamentoDataFissa()); + doc.setIban(getIban()); + doc.setBic(getBic()); + doc.setId_destinazioneDiversa(getId_destinazioneDiversa()); + doc.setPresso(getPresso()); + doc.setIndirizzoSped(getIndirizzoSped()); + doc.setNumeroCivicoSped(getNumeroCivicoSped()); + doc.setCittaSped(getCittaSped()); + doc.setProvinciaSped(getProvinciaSped()); + doc.setCapSped(getCapSped()); + doc.setId_nazioneSped(getId_nazioneSped()); + doc.setNColli(getNColli()); + doc.setKgLordo(getKgLordo()); + doc.setKgNetto(getKgNetto()); + doc.setVolume(getVolume()); + doc.setId_causaleTrasporto(getId_causaleTrasporto()); + doc.setId_vettore(getId_vettore()); + doc.setFlgTrasporto(getFlgTrasporto()); + doc.setId_aspetto(getId_aspetto()); + doc.setId_porto(getId_porto()); + doc.setNotePagamento(getNotePagamento()); + doc.setNotaSpedizione(getNotaSpedizione()); + doc.setNote(getNote()); + doc.setNotaAggiuntiva(getNotaAggiuntiva()); + doc.setNotaMail(getNotaMail()); + doc.setRiferimento(getRiferimento()); + doc.setDataRiferimento(getDataRiferimento()); + doc.setFlgDeliveryType(getFlgDeliveryType()); + doc.setPudoId(getPudoId()); + doc.setPudoDesc(getPudoDesc()); + DoubleOperator totCosti = new DoubleOperator(); + long speseStd = 0L; + if (!isDocUsato) { + speseStd = 0L; + } else if (resRigheUsato == 2L || resRigheUsato == 4L || resRigheUsato == 6L) { + speseStd = 2L; + } else if (seUsatoCreaRm) { + if (resRigheUsato == 1L) { + speseStd = 1L; + } else { + speseStd = 2L; + } + } else if (resRigheUsato == 3L || resRigheUsato == 5L) { + speseStd = 0L; + } else { + speseStd = 2L; + } + if (speseStd == 0L) { + doc.setSpeseTrasporto(getSpeseTrasporto()); + doc.setSpeseIncasso(getSpeseIncasso()); + doc.setSpeseAltre(getSpeseAltre()); + doc.setDescSpeseAltre(getDescSpeseAltre()); + doc.setId_ivaDoc(getId_ivaDoc()); + doc.setScontoIncondizionato(getScontoIncondizionato()); + doc.setAbbuono(getAbbuono()); + } + if (speseStd == 1L) { + totCosti.add(getSpeseAltreConIva()); + totCosti.add(getSpeseIncassoConIva()); + totCosti.add(getSpeseTrasportoConIva()); + } + if (speseStd == 2L); + doc.setOrdineCodiceCIG(getOrdineCodiceCIG()); + doc.setOrdineCodiceCUP(getOrdineCodiceCUP()); + rp = doc.save(); + if (rp.getStatus()) + if (l_flgTipoCreazioneRiga == 0L) { + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements() && rp.getStatus()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + boolean aggiungiRiga = false; + if (!isDocUsato && row.getArticolo().getFlgUsato() == 0L) { + aggiungiRiga = true; + } else if (isDocUsato && + row.getArticolo().getFlgUsato() > 0L) { + if (seUsatoCreaRm && row.getIva().getFlgTipo().equals("R")) { + aggiungiRiga = true; + } else if (!seUsatoCreaRm && !row.getIva().getFlgTipo().equals("R")) { + aggiungiRiga = true; + } + } + if (aggiungiRiga && + row.getFlgRigaPrelevata() == 0L) { + boolean isDisponibile = false; + double qta = row.getQuantita(); + boolean totPrelevata = false; + if (tdf.getId_causaleMagazzino() == 0L) { + totPrelevata = true; + isDisponibile = true; + } else if ((row.getArticolo().getTipo().getFlgTipoMagazzino() == 2L && + !row.getSeriale().equals("")) || + row.getArticolo().getTipo().getFlgTipoMagazzino() != 2L) { + if (row.getId_articoloVariante() > 0L) { + if (row.getArticoloVariante().getQuantitaAv() > 0.0D) { + if (row.getArticoloVariante().getQuantitaAv() < row.getQuantita()) { + qta = row.getArticoloVariante().getQuantitaAv(); + } else { + qta = row.getQuantita(); + totPrelevata = true; + } + isDisponibile = true; + } + } else if (row.getArticolo().getQuantita() > 0.0D) { + if (row.getArticolo().getQuantita() < row.getQuantita()) { + qta = row.getArticolo().getQuantita(); + } else { + qta = row.getQuantita(); + totPrelevata = true; + } + isDisponibile = true; + } + } + if (isDisponibile) { + righeCreate++; + RigaDocumento rDoc = new RigaDocumento(getApFull()); + rDoc.setId_documento(doc.getId_documento()); + rDoc.setId_articolo(row.getId_articolo()); + rDoc.setId_articoloVariante(row.getId_articoloVariante()); + rDoc.setId_iva(row.getId_iva()); + rDoc.setId_magFisico(row.getId_magFisico()); + rDoc.setSeriale(row.getSeriale()); + if (righeCreate == 1L && totCosti.getResult() > 0.0D) { + totCosti.add(row.getImponibile()); + rDoc.setImponibile(totCosti.getResult()); + } else { + rDoc.setImponibile(row.getImponibile()); + } + rDoc.setQuantita(qta); + rDoc.setQuantitaUdm(qta); + rDoc.setDescrizioneRiga(row.getDescrizioneRiga()); + rDoc.setNotaRigaDocumento(row.getNotaRigaDocumento()); + rDoc.setNotaBarcode(row.getNotaBarcode()); + rDoc.setSconto(row.getSconto()); + rDoc.setPercL1(row.getPercL1()); + rDoc.setPercL2(row.getPercL2()); + rDoc.setPercL3(row.getPercL3()); + rDoc.setImporto(row.getImporto()); + importiRighe += row.getTotImportoRigaConSconto(); + rDoc.setId_documentoPadre(getId_documento()); + rDoc.setId_rigaDocumentoPadre(row.getId_rigaDocumento()); + if (getId_tipoDocumento() == getId_docRiparazione()) + if (getImportoConsuntivo() > 0.0D) { + rDoc.setImponibile(getImportoConsuntivo()); + } else { + rDoc.setImponibile(getImportoPreventivo()); + } + if (doc.getTipoDocumento().getFlgImportoIva() == 1L) + rDoc.setPrezzoPubblicoConIva(row.getImporto()); + rpRow = rDoc.save(); + if (rpRow.getStatus()) { + rp.append(rpRow); + if (totPrelevata) { + row.setFlgRigaPrelevata(1L); + rp.append(row.superSave()); + continue; + } + row.setQuantita(row.getQuantita() - qta); + rp.append(row.superSave()); + } + } + } + } + } else if (l_flgTipoCreazioneRiga == 1L) { + righeCreate++; + RigaDocumento rDoc = new RigaDocumento(getApFull()); + rDoc.setId_documento(doc.getId_documento()); + rDoc.setId_iva(getId_ivaDoc()); + rDoc.setImponibile(getImponibileTotale()); + rDoc.setNr(1.0D); + rDoc.setDescrizioneRiga("Ns. documento " + + getNumeroDocumentoCompleto() + " del " + getDataFormat().format(getDataDocumento())); + rDoc.setImporto(getTotaleDocumento()); + importiRighe += getTotaleDocumento(); + rDoc.setId_documentoPadre(getId_documento()); + if (doc.getTipoDocumento().getFlgImportoIva() == 1L) + rDoc.setPrezzoPubblicoConIva(getTotaleDocumento()); + rpRow = rDoc.save(); + if (rpRow.getStatus()) { + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements() && rp.getStatus()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getFlgRigaPrelevata() == 0L) { + row.setFlgRigaPrelevata(1L); + rp.append(row.superSave()); + } + } + } + } else if (l_flgTipoCreazioneRiga == 2L) { + + } + rp = doc.save(); + if (rp.getStatus()) { + if (righeCreate == 0L) { + rp = new ResParm(false); + rp.setMsg("ERRORE! Nessun rigo prelevabile!"); + doc.delete(); + } else if (accontiDiff > 0.0D) { + if (findTotRigheDocumentoDaPrelevare() == 0L) { + doc.setAcconto(accontiDiff); + } else if (importiRighe < accontiDiff) { + doc.setAcconto(importiRighe); + } else { + doc.setAcconto(accontiDiff); + } + doc.save(); + } + if (operatore != null) { + setId_users(operatore.getId_users()); + StringBuffer sb = new StringBuffer(); + sb.append(getLogRecord()); + if (!getLogRecord().equals("")) + sb.append("
"); + sb.append("Creato Documento figlio "); + sb.append(tdGen.getDescrizione()); + sb.append(" da "); + sb.append(operatore.getCognomeNome()); + sb.append(" il "); + sb.append(getTimestampFormat().format(getTimestamp())); + setLogRecord(sb.toString()); + save(); + } + if (findTotRigheDocumentoDaPrelevare() == 0L) { + setFlgStato(1L); + setFlgDocumentoPrelevato(1L); + setFlgStatoPrenotazione(90L); + super.save(); + } + } + } + } + } + findByPrimaryKey(getId_documento()); + return rp; + } + + public Vectumerator findOrdiniTaglioAperti() { + String s_Sql_Find = "select A.* from DOCUMENTO AS A INNER JOIN TIPO_DOCUMENTO AS B ON A.id_tipoDocumento=B.id_tipoDocumento inner join TIPOLOGIA_DOCUMENTO AS C ON C.id_tipologiaDocumento=B.id_tipologiaDocumento left join DOC_FIGLIO_PADRE AS E ON A.id_documento=E.id_documentoFiglio"; + String s_Sql_Order = " order by A.dataDocumento desc, A.id_esercizio desc, A.progDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.flgStato=1"); + wc.addWc("C.codice=210"); + wc.addWc("E.id_docFiglioPadre is null"); + wc.addWc("A.id_articolo=" + getId_articolo()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + System.out.println(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public static final String getTipoGenerazione(long l_flgTipoGenerazione) { + return DocPrel.getTipoGenerazione(l_flgTipoGenerazione); + } + + public long getFlgTipoGenerazione() { + return this.flgTipoGenerazione; + } + + public String getTipoGenerazione() { + return getTipoGenerazione(getFlgTipoGenerazione()); + } + + public void setFlgTipoGenerazione(long flgTipoGenerazione) { + this.flgTipoGenerazione = flgTipoGenerazione; + } + + protected void creaDocumentoCorpoFt(Document l_document, Table l_pdfCorpo) { + int righePerPagina = (int)getTipoDocumento().getRighePerPagina(); + if (righePerPagina <= 0) + righePerPagina = 10; + int maxCarDesc = (int)getTipoDocumento().getMaxCarDesc(); + if (maxCarDesc == 0) + maxCarDesc = 35; + int riga = 0; + int cellLeadingRow = getDocLeadRow(); + if (cellLeadingRow == 0) + cellLeadingRow = 12; + Font PDF_frow = getTipoDocumento().getPdfFontRow(); + Font PDF_frowSmall = getTipoDocumento().getPdfFontRowSmall(); + NumberFormat nf = getNf(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + try { + String s_note; + long resHasUsato = hasRigheConUsato(); + if (!getPudoId().isEmpty()) { + s_note = "Fermo Point BRT\n" + getPudoDesc() + "\n" + getNote(); + } else { + s_note = getNote(); + } + if (resHasUsato == 1L || resHasUsato == 2L || resHasUsato == 5L || resHasUsato == 6L) { + Iva ivaRM = new Iva(getApFull()); + ivaRM.findByPrimaryKey(getCodiceIvaRegimeMargine()); + s_note = s_note + "\n" + s_note; + } + ArrayList alNote = RigaDocumentoItemPdf.getArrayListNota(s_note, 0, cols_FT_STD_, PDF_frow); + if (getDocPosizioneNota() == 0L) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + while (vec.hasMoreElements()) { + String desc, descQta; + double imponibile, importo; + String scontoS; + RigaDocumento row = (RigaDocumento)vec.nextElement(); + double quantita = row.getQuantita(); + if (row.getSconto() > 0.0D) { + scontoS = nf.format(row.getSconto()); + } else { + scontoS = ""; + } + if (!row.getIva().getFlgTipo().equals("R")) { + desc = row.getDescrizioneRiga(); + if (!row.getSeriale().isEmpty()) { + String temp = row.getSeriale().replace("\n", ""); + temp = temp.replace("\r", ""); + desc = desc + "\nS/N " + desc; + } + if (row.getArticolo().isSuperGaranzia()) + desc = desc + " - Supergaranzia"; + imponibile = row.getImponibile(); + importo = row.getTotImponibileRigaConSconto(); + } else { + desc = row.getDescrizioneRiga(); + if (!row.getSeriale().isEmpty()) { + String temp = row.getSeriale().replace("\n", ""); + temp = temp.replace("\r", ""); + desc = desc + "\nS/N " + desc; + } + if (row.getArticolo().isSuperGaranzia()) + desc = desc + " - Supergaranzia"; + if (row.getArticolo().isSuperGaranzia()) + desc = desc + " - Supergaranzia"; + imponibile = row.getImponibile(); + importo = row.getTotImponibileRigaConSconto(); + } + if (row.getSeriale().isEmpty() && !row.getArticolo().getNMatricola().isEmpty()) + desc = desc + " Mat. N. " + desc; + if (!row.getNotaBarcode().isEmpty()) + desc = desc + " - " + desc; + String codIva = row.getIva().getDescrizioneRigaStampaAuto(); + if (!row.getNotaRigaDocumento().isEmpty()) + desc = desc + " " + desc; + if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() != 1L) { + if (isQuantitaMagazzinoIntere()) { + descQta = row.getArticolo().getTipo().getTipologiaArticolo().getUdm() + " " + row.getArticolo().getTipo().getTipologiaArticolo().getUdm(); + } else if (row.getRifTipoArticolo() == 20L) { + descQta = "C. " + getNf0().format(quantita * 1000.0D); + } else if (row.getRifTipoArticolo() == 21L) { + descQta = nf.format(quantita); + } else { + descQta = row.getUdm() + " " + row.getUdm(); + } + } else if (isQuantitaMagazzinoIntere()) { + descQta = getNf0().format(quantita); + } else { + descQta = nf.format(quantita); + } + ArrayList dati = new ArrayList<>(); + dati.add(new RigaDocumentoItemPdf(cols_FT_STD_[0], desc, PDF_frow)); + dati.add(new RigaDocumentoItemPdf(cols_FT_STD_[1], descQta, PDF_frow, 2)); + if (row.getRifTipoArticolo() == 20L) { + dati.add(new RigaDocumentoItemPdf(cols_FT_STD_[2], getNf5().format(imponibile / 1000.0D), PDF_frow, 2)); + } else { + dati.add(new RigaDocumentoItemPdf(cols_FT_STD_[2], nf.format(imponibile), PDF_frow, 2)); + } + dati.add(new RigaDocumentoItemPdf(cols_FT_STD_[3], scontoS, PDF_frow, 2)); + dati.add(new RigaDocumentoItemPdf(cols_FT_STD_[4], nf.format(importo), PDF_frow, 2)); + if (codIva.length() >= 10) { + dati.add(new RigaDocumentoItemPdf(cols_FT_STD_[5], codIva, PDF_frowSmall, 2)); + } else { + dati.add(new RigaDocumentoItemPdf(cols_FT_STD_[5], codIva, PDF_frow, 2)); + } + riga = inserisciRigaDocumento(dati, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + } + if (getDocPosizioneNota() == 1L && !s_note.isEmpty()) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + if (righePerPagina - riga > 0) + riga = inserisciRigheVuote(righePerPagina - riga, cols_FT_STD_, riga, l_document, l_pdfCorpo, cellLeadingRow); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoCorpoFtSemplice(Document l_document, Table l_pdfCorpo) { + int righePerPagina = (int)getTipoDocumento().getRighePerPagina(); + if (righePerPagina <= 0) + righePerPagina = 10; + int maxCarDesc = (int)getTipoDocumento().getMaxCarDesc(); + if (maxCarDesc == 0) + maxCarDesc = 35; + int riga = 0; + int cellLeadingRow = getDocLeadRow(); + if (cellLeadingRow == 0) + cellLeadingRow = 12; + Font PDF_frow = getTipoDocumento().getPdfFontRow(); + Font PDF_frowSmall = getTipoDocumento().getPdfFontRowSmall(); + NumberFormat nf = getNf(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + int colSpanDescrizione = cols_FT_SEMPLICE_[0]; + try { + String s_note; + long resHasUsato = hasRigheConUsato(); + if (!getPudoId().isEmpty()) { + s_note = "Fermo Point BRT\n" + getPudoDesc() + "\n" + getNote(); + } else { + s_note = getNote(); + } + if (resHasUsato == 1L || resHasUsato == 2L || resHasUsato == 5L || resHasUsato == 6L) { + Iva ivaRM = new Iva(getApFull()); + ivaRM.findByPrimaryKey(getCodiceIvaRegimeMargine()); + s_note = s_note + "\n" + s_note; + } + ArrayList alNote = RigaDocumentoItemPdf.getArrayListNota(s_note, 0, cols_FT_SEMPLICE_, PDF_frow); + if (getDocPosizioneNota() == 0L) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + while (vec.hasMoreElements()) { + String desc; + double importo; + RigaDocumento row = (RigaDocumento)vec.nextElement(); + double quantita = row.getQuantita(); + if (row.getSconto() > 0.0D) { + String scontoS = nf.format(row.getSconto()); + } else { + String scontoS = ""; + } + if (!row.getIva().getFlgTipo().equals("R")) { + desc = row.getDescrizioneRiga(); + if (!row.getSeriale().isEmpty()) { + String temp = row.getSeriale().replace("\n", ""); + temp = temp.replace("\r", ""); + desc = desc + "\nS/N " + desc; + } + if (row.getArticolo().isSuperGaranzia()) + desc = desc + " - Supergaranzia"; + double imponibile = row.getImponibile(); + importo = row.getTotImponibileRigaConSconto(); + } else { + desc = row.getDescrizioneRiga(); + if (!row.getSeriale().isEmpty()) { + String temp = row.getSeriale().replace("\n", ""); + temp = temp.replace("\r", ""); + desc = desc + "\nS/N " + desc; + } + if (row.getArticolo().isSuperGaranzia()) + desc = desc + " - Supergaranzia"; + double imponibile = row.getImponibile(); + importo = row.getTotImponibileRigaConSconto(); + } + if (row.getSeriale().isEmpty() && !row.getArticolo().getNMatricola().isEmpty()) + desc = desc + " Mat. N. " + desc; + if (!row.getNotaBarcode().isEmpty()) + desc = desc + " - " + desc; + String codIva = row.getIva().getDescrizioneRigaStampaAuto(); + if (!row.getNotaRigaDocumento().isEmpty()) + desc = desc + " " + desc; + if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() != 1L) { + if (isQuantitaMagazzinoIntere()) { + String descQta = row.getUdm() + " " + row.getUdm(); + } else { + String descQta = row.getUdm() + " " + row.getUdm(); + } + } else if (isQuantitaMagazzinoIntere()) { + String descQta = getNf0().format(quantita); + } else { + String descQta = nf.format(quantita); + } + ArrayList dati = new ArrayList<>(); + dati.add(new RigaDocumentoItemPdf(colSpanDescrizione, desc, PDF_frow)); + dati.add(new RigaDocumentoItemPdf(cols_FT_SEMPLICE_[1], nf.format(importo), PDF_frow, 2)); + if (codIva.length() >= 10) { + dati.add(new RigaDocumentoItemPdf(cols_FT_SEMPLICE_[2], codIva, PDF_frowSmall, 2)); + } else { + dati.add(new RigaDocumentoItemPdf(cols_FT_SEMPLICE_[2], codIva, PDF_frow, 2)); + } + riga = inserisciRigaDocumento(dati, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + } + if (getDocPosizioneNota() == 1L && !s_note.isEmpty()) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + if (righePerPagina - riga > 0) + riga = inserisciRigheVuote(righePerPagina - riga, cols_FT_SEMPLICE_, riga, l_document, l_pdfCorpo, cellLeadingRow); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoCorpoFtPro(Document l_document, Table l_pdfCorpo) { + creaDocumentoCorpoFt(l_document, l_pdfCorpo); + } + + protected void creaDocumentoCorpoFtProS(Document l_document, Table l_pdfCorpo) { + int righePerPagina = (int)getTipoDocumento().getRighePerPagina(); + if (righePerPagina <= 0) + righePerPagina = 10; + int maxCarDesc = (int)getTipoDocumento().getMaxCarDesc(); + if (maxCarDesc == 0) + maxCarDesc = 35; + int riga = 0; + int cellLeadingRow = getDocLeadRow(); + if (cellLeadingRow == 0) + cellLeadingRow = 12; + Font PDF_frow = getTipoDocumento().getPdfFontRow(); + Font PDF_frowSmall = getTipoDocumento().getPdfFontRowSmall(); + NumberFormat nf = getNf(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + int colSpanDescrizione = cols_FT_PRO_SEMPLICE_[0]; + try { + long resHasUsato = hasRigheConUsato(); + String s_note = getNote(); + if (resHasUsato == 1L || resHasUsato == 2L || resHasUsato == 5L || resHasUsato == 6L) { + Iva ivaRM = new Iva(getApFull()); + ivaRM.findByPrimaryKey(getCodiceIvaRegimeMargine()); + s_note = s_note + "\n" + s_note; + } + ArrayList alNote = RigaDocumentoItemPdf.getArrayListNota(s_note, 0, cols_FT_PRO_SEMPLICE_, PDF_frow); + if (getDocPosizioneNota() == 0L) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + while (vec.hasMoreElements()) { + String desc; + double importo; + RigaDocumento row = (RigaDocumento)vec.nextElement(); + double quantita = row.getQuantita(); + if (row.getSconto() > 0.0D) { + String scontoS = nf.format(row.getSconto()); + } else { + String scontoS = ""; + } + if (!row.getIva().getFlgTipo().equals("R")) { + desc = row.getDescrizioneRiga(); + if (!row.getSeriale().isEmpty()) { + String temp = row.getSeriale().replace("\n", ""); + temp = temp.replace("\r", ""); + desc = desc + "\nS/N " + desc; + } + if (row.getArticolo().isSuperGaranzia()) + desc = desc + " - Supergaranzia"; + double imponibile = row.getImponibile(); + importo = row.getTotImponibileRigaConSconto(); + } else { + desc = row.getDescrizioneRiga(); + if (!row.getSeriale().isEmpty()) { + String temp = row.getSeriale().replace("\n", ""); + temp = temp.replace("\r", ""); + desc = desc + "\nS/N " + desc; + } + if (row.getArticolo().isSuperGaranzia()) + desc = desc + " - Supergaranzia"; + double imponibile = row.getImponibile(); + importo = row.getTotImponibileRigaConSconto(); + } + if (row.getSeriale().isEmpty() && !row.getArticolo().getNMatricola().isEmpty()) + desc = desc + " Mat. N. " + desc; + if (!row.getNotaBarcode().isEmpty()) + desc = desc + " - " + desc; + String codIva = row.getIva().getDescrizioneRigaStampaAuto(); + if (!row.getNotaRigaDocumento().isEmpty()) + desc = desc + " " + desc; + if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() != 1L) { + if (isQuantitaMagazzinoIntere()) { + String descQta = row.getUdm() + " " + row.getUdm(); + } else { + String descQta = row.getUdm() + " " + row.getUdm(); + } + } else if (isQuantitaMagazzinoIntere()) { + String descQta = getNf0().format(quantita); + } else { + String descQta = nf.format(quantita); + } + ArrayList dati = new ArrayList<>(); + dati.add(new RigaDocumentoItemPdf(colSpanDescrizione, desc, PDF_frow)); + dati.add(new RigaDocumentoItemPdf(cols_FT_PRO_SEMPLICE_[1], "€ " + nf.format(importo), PDF_frow, 2)); + riga = inserisciRigaDocumento(dati, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + } + if (getDocPosizioneNota() == 1L && !s_note.isEmpty()) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + if (righePerPagina - riga > 0) + riga = inserisciRigheVuote(righePerPagina - riga, cols_FT_PRO_SEMPLICE_, riga, l_document, l_pdfCorpo, cellLeadingRow); + } catch (Exception e) { + handleDebug(e); + } + } + + public boolean puoRiaprireInvioXml(long l_id_userLogon) { + if (l_id_userLogon == 0L) + return false; + if (getUserLogon(l_id_userLogon).getGrantType("RIAPRI_FATTURA_XML", false) > 0L) + return true; + return false; + } + + public Vectumerator findDocFiglioPadreByPadre() { + if (getId_documento() == 0L) + return AB_EMPTY_VECTUMERATOR; + DocFiglioPadre dfp = new DocFiglioPadre(getApFull()); + return dfp.findByPadre(getId_documento()); + } + + public Vectumerator findDocFiglioPadreByFiglio() { + if (getId_documento() == 0L) + return AB_EMPTY_VECTUMERATOR; + DocFiglioPadre dfp = new DocFiglioPadre(getApFull()); + return dfp.findByFiglio(getId_documento()); + } + + public String getDescDocFiglioPadreByFiglio() { + if (getId_documento() == 0L) + return ""; + Vectumerator vec = findDocFiglioPadreByFiglio(); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + DocFiglioPadre row = (DocFiglioPadre)vec.nextElement(); + sb.append(row.getDocumentoPadre().getNumeroDocumentoCompleto() + " " + row.getDocumentoPadre().getNumeroDocumentoCompleto()); + if (vec.hasMoreElements()) + sb.append("\n"); + } + return sb.toString(); + } + + public String getDescDocFiglioPadreByFiglioHtml() { + return DBAdapter.convertStringToHtml(getDescDocFiglioPadreByFiglio()); + } + + public String getDescDocFiglioPadreByPadre() { + if (getId_documento() == 0L) + return ""; + Vectumerator vec = findDocFiglioPadreByPadre(); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + DocFiglioPadre row = (DocFiglioPadre)vec.nextElement(); + sb.append( + row.getDocumentoFiglio().getNumeroDocumentoCompleto() + " " + row.getDocumentoFiglio().getNumeroDocumentoCompleto()); + if (vec.hasMoreElements()) + sb.append("\n"); + } + return sb.toString(); + } + + public String getDescDocFiglioPadreByPadreHtml() { + return DBAdapter.convertStringToHtml(getDescDocFiglioPadreByPadre()); + } + + public ResParm ricalcolaDisposizioneTaglio() { + if (getId_documento() == 0L || getTipoDocumento().getFlgTipologia() != 220L) + return new ResParm(false, "Errore! Documento nullo o non e' una disposizione di taglio"); + ResParm rp = new ResParm(true); + RigaDocumentoCR rdCR = new RigaDocumentoCR(getApFull()); + rdCR.setId_documento(getId_documento()); + Vectumerator vecRo = findRigheDocumento(rdCR, 0, 0, false); + while (vecRo.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRo.nextElement(); + rp.append(row.delete()); + } + if (rp.getStatus()) { + Vectumerator vecDfp = findDocFiglioPadreByPadre(); + long l_id_documentoOrdineTaglio = 0L; + while (vecDfp.hasMoreElements()) { + DocFiglioPadre rowOrdineTaglio = (DocFiglioPadre)vecDfp.nextElement(); + l_id_documentoOrdineTaglio = rowOrdineTaglio.getId_documentoFiglio(); + rowOrdineTaglio.delete(); + associaOrdineTaglioADosposizioneTaglio(l_id_documentoOrdineTaglio); + } + } else { + rp.setMsg("Errore ricalcolo disposizioni taglio: " + rp.getMsg()); + } + if (!rp.getStatus()) + rp.setMsg("Errore ricalcolo disposizioni taglio: " + rp.getMsg()); + return rp; + } + + public static final synchronized ResParm calcolaTessutiTaglio(Documento bean, String lang) { + boolean nuovo = true; + if (nuovo) + return calcolaTessutiTaglioNew(bean, lang); + return calcolaTessutiTaglioNONOTTIMIZZATO(bean, lang); + } + + public static final synchronized ResParm calcolaTessutiTaglioNew(Documento bean, String lang) { + ResParm rp = new ResParm(true); + boolean debug = false; + String debugInfo = "calcolaTessutiTaglio"; + RigaDocumento rd = new RigaDocumento(bean.getApFull()); + rd.impostaDaCancellareByDocumentoCodiceriga(bean.getId_documento(), 1L, true); + rd.impostaDaCancellareByDocumentoCodiceriga(bean.getId_documento(), 100L, true); + Vectumerator vecRd = bean.findRigheDocumento(0, 0, 0); + if (vecRd.getTotNumberOfRecords() > 0) { + Vectumerator vec = bean.getArticolo().findArticoliTessuto(); + HashMap hmTess = new HashMap<>(); + HashMap hmTessCol = new HashMap<>(); + while (vec.hasMoreElements()) { + ArticoloArticoloTessuto rowAAT = (ArticoloArticoloTessuto)vec.nextElement(); + if (rowAAT.getId_articoloTessutoColore() == 0L) + if (!hmTess.containsKey(Long.valueOf(rowAAT.getId_articoloTessuto()))) { + System.out.println("AT: " + rowAAT.getId_articoloTessuto()); + ArticoloTessuto at = rowAAT.getArticoloTessuto(); + hmTess.put(Long.valueOf(rowAAT.getId_articoloTessuto()), at); + } + if (rowAAT.getId_articoloTessutoColore() > 0L) { + if (hmTessCol.containsKey(Long.valueOf(rowAAT.getId_articoloTessutoColore()))) + continue; + System.out.println("AC: " + rowAAT.getId_articoloTessutoColore()); + ArticoloTessutoColore atc = rowAAT.getArticoloTessutoColore(); + hmTessCol.put(Long.valueOf(rowAAT.getId_articoloTessutoColore()), atc); + } + } + Set keySet = hmTess.keySet(); + for (Long key : keySet) { + ArticoloTessuto at = hmTess.get(key); + RigaDocumento rdTessTaglio = new RigaDocumento(bean.getApFull()); + rdTessTaglio.findByDocumentoArticoloTessuto(bean.getId_documento(), at.getId_articoloTessuto(), 100L); + if (rdTessTaglio.getId_rigaDocumento() > 0L) { + rdTessTaglio.setFlgDaCancellare(0L); + } else { + rdTessTaglio.setFlgCodiceRiga(100L); + rdTessTaglio.setDescrizioneRiga(at.getDescrizioneCompleta(lang)); + rdTessTaglio.setId_documento(bean.getId_documento()); + rdTessTaglio.setId_articoloTessuto(at.getId_articoloTessuto()); + } + if (rdTessTaglio.getCapiPerTelo() == 0L) + if (at.getCapiPerTelo() > 0L) { + rdTessTaglio.setCapiPerTelo(at.getCapiPerTelo()); + } else { + rdTessTaglio.setCapiPerTelo(8L); + } + rp = rdTessTaglio.superSave(); + } + Set keySetCol = hmTessCol.keySet(); + for (Long key : keySetCol) { + ArticoloTessutoColore atc = hmTessCol.get(key); + RigaDocumento rdTessTaglio = new RigaDocumento(bean.getApFull()); + rdTessTaglio.findByDocumentoArticoloTessutoColore(bean.getId_documento(), atc.getId_articoloTessutoColore(), 100L); + if (rdTessTaglio.getId_rigaDocumento() > 0L) { + rdTessTaglio.setFlgDaCancellare(0L); + } else { + rdTessTaglio.setFlgCodiceRiga(100L); + rdTessTaglio.setDescrizioneRiga(atc.getDescrizioneCompleta(lang)); + rdTessTaglio.setId_documento(bean.getId_documento()); + rdTessTaglio.setId_articoloTessutoColore(atc.getId_articoloTessutoColore()); + } + if (rdTessTaglio.getCapiPerTelo() == 0L) + rdTessTaglio.setCapiPerTelo(8L); + rp = rdTessTaglio.superSave(); + } + ArticoloArticoloTessuto att = new ArticoloArticoloTessuto(bean.getApFull()); + boolean salvaNtr = true; + while (vecRd.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRd.nextElement(); + NumeroTeliRiga ntr = new NumeroTeliRiga(bean.getApFull()); + Vectumerator vec100 = bean.findRigheDocumentoDisposizioneTaglio(0, 0, 2); + while (vec100.hasMoreElements()) { + RigaDocumento row100 = (RigaDocumento)vec100.nextElement(); + if (row.isTessutoPrincipale(row100.getId_articoloTessuto(), row100.getId_articoloTessutoColore())) { + ntr.findByRDArticoloRDTessuto(row.getId_rigaDocumento(), row100.getId_rigaDocumento()); + if (ntr.getId_numeroTeliRiga() > 0L); + salvaNtr = true; + if (row100.getId_articoloTessutoColore() > 0L) { + att.findByArticoloVarianteArticoloTessutoColore(row.getId_articoloVariante(), + row100.getId_articoloTessuto(), row100.getId_articoloTessutoColore()); + if (att.getId_articoloArticoloTessuto() == 0L) + salvaNtr = false; + } + if (salvaNtr) { + ntr.setId_rigaDocumentoArticolo(row.getId_rigaDocumento()); + ntr.setId_rigaDocumentoTessuto(row100.getId_rigaDocumento()); + long numTeli = (long)Math.ceil(row.getNrOriginale() / (double)row100.getCapiPerTelo()); + ntr.setNumTeliRiga(numTeli); + long nrNew = numTeli * row100.getCapiPerTelo(); + if ((double)nrNew >= row.getNrOriginale()) { + row.setNr((double)nrNew); + row.superSave(); + } + if (att.getId_articoloArticoloTessuto() <= 0L) + att.findByArticoloVarianteArticoloTessutoColore(row.getId_articoloVariante(), + row100.getId_articoloTessuto(), 0L); + DoubleOperator metriRd = new DoubleOperator(row.getNr()); + metriRd.multiply(att.getMtATT()); + metriRd.setScale(2, 5); + ntr.setMtTessutoRiga(metriRd.getResult()); + ntr.save(); + } + att.setId_articoloArticoloTessuto(0L); + att.setDBState(0); + } + } + vec100.moveFirst(); + while (vec100.hasMoreElements()) { + RigaDocumento row100 = (RigaDocumento)vec100.nextElement(); + if (!row.isTessutoPrincipale(row100.getId_articoloTessuto(), row100.getId_articoloTessutoColore())) { + ntr.findByRDArticoloRDTessuto(row.getId_rigaDocumento(), row100.getId_rigaDocumento()); + if (ntr.getId_numeroTeliRiga() > 0L); + salvaNtr = true; + if (row100.getId_articoloTessutoColore() > 0L) { + att.findByArticoloVarianteArticoloTessutoColore(row.getId_articoloVariante(), + row100.getId_articoloTessuto(), row100.getId_articoloTessutoColore()); + if (att.getId_articoloArticoloTessuto() == 0L) + salvaNtr = false; + } + if (salvaNtr) { + ntr.setId_rigaDocumentoArticolo(row.getId_rigaDocumento()); + ntr.setId_rigaDocumentoTessuto(row100.getId_rigaDocumento()); + long numTeli = (long)Math.ceil(row.getNr() / (double)row100.getCapiPerTelo()); + System.out.println(numTeli); + ntr.setNumTeliRiga(numTeli); + if (att.getId_articoloArticoloTessuto() <= 0L) + att.findByArticoloVarianteArticoloTessutoColore(row.getId_articoloVariante(), + row100.getId_articoloTessuto(), 0L); + long nrNew = numTeli * row100.getCapiPerTelo(); + DoubleOperator metriRd = new DoubleOperator((float)nrNew); + metriRd.multiply(att.getMtATT()); + metriRd.setScale(2, 5); + ntr.setMtTessutoRiga(metriRd.getResult()); + ntr.save(); + } + att.setId_articoloArticoloTessuto(0L); + att.setDBState(0); + } + } + } + Vectumerator vecTessTaglio = findTessutiPerTaglio(bean); + while (vecTessTaglio.hasMoreElements()) { + ArticoloTessutoColore row = (ArticoloTessutoColore)vecTessTaglio.nextElement(); + rd = new RigaDocumento(bean.getApFull()); + rd.findByDocumentoArticoloTessutoColore(bean.getId_documento(), row.getId_articoloTessutoColore(), 1L); + if (rd.getId_rigaDocumento() > 0L) { + rd.setMt(row.getMtLavorazioneTaglio()); + } else { + rd.setId_documento(bean.getId_documento()); + rd.setFlgCodiceRiga(1L); + rd.setId_articoloTessutoColore(row.getId_articoloTessutoColore()); + rd.setId_articoloTessuto(rd.getArticoloTessutoColore().getId_articoloTessuto()); + rd.setMt(row.getMtLavorazioneTaglio()); + rd.setDescrizioneRiga(rd.getArticoloTessutoColore().getDescrizioneCompleta()); + rd.setId_causaleMagazzino(bean.getTipoDocumento().getId_causaleMagazzino2()); + } + rd.setFlgDaCancellare(0L); + addRigaDocumentoTessuto(bean, rd, 1L); + boolean trovato = false; + if (rd.getId_articoloTessutoColore() > 0L && + hmTessCol.containsKey(Long.valueOf(rd.getId_articoloTessutoColore()))) { + ArticoloTessutoColore atc = hmTessCol.get(Long.valueOf(rd.getId_articoloTessutoColore())); + DoubleOperator dop = new DoubleOperator(atc.getMtLavorazioneTaglio()); + dop.add(rd.getMt()); + atc.setMtLavorazioneTaglio(dop.getResult()); + hmTessCol.put(Long.valueOf(rd.getId_articoloTessutoColore()), atc); + trovato = true; + } + if (!trovato && + hmTess.containsKey(Long.valueOf(rd.getId_articoloTessuto()))) { + ArticoloTessuto at = hmTess.get(Long.valueOf(rd.getId_articoloTessuto())); + DoubleOperator dop = new DoubleOperator(at.getMtLavorazioneTaglio()); + dop.add(rd.getMt()); + at.setMtLavorazioneTaglio(dop.getResult()); + hmTess.put(Long.valueOf(rd.getId_articoloTessuto()), at); + } + } + while (vecRd.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRd.nextElement(); + if (row.getFlgDaCancellare() == 1L) { + row.delete(); + continue; + } + NumeroTeliRiga ntr = new NumeroTeliRiga(bean.getApFull()); + Vectumerator vec100 = bean.findRigheDocumentoDisposizioneTaglio(0, 0, 2); + while (vec100.hasMoreElements()) { + RigaDocumento row100 = (RigaDocumento)vec100.nextElement(); + ntr.findByRDArticoloRDTessuto(row.getId_rigaDocumento(), row100.getId_rigaDocumento()); + if (ntr.getId_numeroTeliRiga() > 0L); + salvaNtr = true; + if (row100.getId_articoloTessutoColore() > 0L) { + att.findByArticoloVarianteArticoloTessutoColore(row.getId_articoloVariante(), row100.getId_articoloTessuto(), + row100.getId_articoloTessutoColore()); + if (att.getId_articoloArticoloTessuto() == 0L) + salvaNtr = false; + } + if (salvaNtr) { + ntr.setId_rigaDocumentoArticolo(row.getId_rigaDocumento()); + ntr.setId_rigaDocumentoTessuto(row100.getId_rigaDocumento()); + long numTeli = (long)Math.ceil(row.getNr() / (double)row100.getCapiPerTelo()); + ntr.setNumTeliRiga(numTeli); + long nrNew = numTeli * row100.getCapiPerTelo(); + if ((double)nrNew > row.getNr()) { + row.setNr((double)nrNew); + row.superSave(); + } + if (att.getId_articoloArticoloTessuto() <= 0L) + att.findByArticoloVarianteArticoloTessutoColore(row.getId_articoloVariante(), + row100.getId_articoloTessuto(), 0L); + DoubleOperator metriRd = new DoubleOperator(row.getNr()); + metriRd.multiply(att.getMtATT()); + metriRd.setScale(2, 5); + ntr.setMtTessutoRiga(metriRd.getResult()); + ntr.save(); + } + att.setId_articoloArticoloTessuto(0L); + att.setDBState(0); + } + } + } + RigaDocumentoCR CR = new RigaDocumentoCR(); + CR.setFlgDaCancellare(1L); + CR.setId_documento(bean.getId_documento()); + vecRd = rd.findByCR(CR, 0, 0); + while (vecRd.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRd.nextElement(); + row.delete(); + } + return rp; + } + + public static final synchronized ResParm calcolaDisposizioneTaglio(Documento bean, String lang) { + ResParm rp = new ResParm(true); + boolean debug = false; + String debugInfo = "calcolaTessutiTaglio"; + RigaDocumento rd = new RigaDocumento(bean.getApFull()); + rd.impostaDaCancellareByDocumentoCodiceriga(bean.getId_documento(), 100L, true); + Vectumerator vecRd = bean.findRigheDocumento(0, 0, 0); + if (vecRd.getTotNumberOfRecords() > 0) { + Vectumerator vec = bean.getArticolo().findArticoliTessuto(); + HashMap hmTess = new HashMap<>(); + HashMap hmTessCol = new HashMap<>(); + while (vec.hasMoreElements()) { + ArticoloArticoloTessuto rowAAT = (ArticoloArticoloTessuto)vec.nextElement(); + if (rowAAT.getId_articoloTessutoColore() == 0L) + if (!hmTess.containsKey(Long.valueOf(rowAAT.getId_articoloTessuto()))) { + System.out.println("AT: " + rowAAT.getId_articoloTessuto()); + ArticoloTessuto at = rowAAT.getArticoloTessuto(); + hmTess.put(Long.valueOf(rowAAT.getId_articoloTessuto()), at); + } + if (rowAAT.getId_articoloTessutoColore() > 0L) { + if (hmTessCol.containsKey(Long.valueOf(rowAAT.getId_articoloTessutoColore()))) + continue; + System.out.println("AC: " + rowAAT.getId_articoloTessutoColore()); + ArticoloTessutoColore atc = rowAAT.getArticoloTessutoColore(); + hmTessCol.put(Long.valueOf(rowAAT.getId_articoloTessutoColore()), atc); + } + } + Vectumerator vecTessTaglio = findTessutiPerTaglio(bean); + while (vecTessTaglio.hasMoreElements()) { + ArticoloTessutoColore row = (ArticoloTessutoColore)vecTessTaglio.nextElement(); + rd = new RigaDocumento(bean.getApFull()); + rd.findByDocumentoArticoloTessutoColore(bean.getId_documento(), row.getId_articoloTessutoColore(), 1L); + if (rd.getId_rigaDocumento() > 0L) { + rd.setMt(row.getMtLavorazioneTaglio()); + } else { + rd.setId_documento(bean.getId_documento()); + rd.setFlgCodiceRiga(1L); + rd.setId_articoloTessutoColore(row.getId_articoloTessutoColore()); + rd.setId_articoloTessuto(rd.getArticoloTessutoColore().getId_articoloTessuto()); + rd.setMt(row.getMtLavorazioneTaglio()); + rd.setDescrizioneRiga(rd.getArticoloTessutoColore().getDescrizioneCompleta()); + rd.setId_causaleMagazzino(bean.getTipoDocumento().getId_causaleMagazzino2()); + } + rd.setFlgDaCancellare(0L); + addRigaDocumentoTessuto(bean, rd, 1L); + boolean trovato = false; + if (rd.getId_articoloTessutoColore() > 0L && + hmTessCol.containsKey(Long.valueOf(rd.getId_articoloTessutoColore()))) { + ArticoloTessutoColore atc = hmTessCol.get(Long.valueOf(rd.getId_articoloTessutoColore())); + DoubleOperator dop = new DoubleOperator(atc.getMtLavorazioneTaglio()); + dop.add(rd.getMt()); + atc.setMtLavorazioneTaglio(dop.getResult()); + hmTessCol.put(Long.valueOf(rd.getId_articoloTessutoColore()), atc); + trovato = true; + } + if (!trovato && + hmTess.containsKey(Long.valueOf(rd.getId_articoloTessuto()))) { + ArticoloTessuto at = hmTess.get(Long.valueOf(rd.getId_articoloTessuto())); + DoubleOperator dop = new DoubleOperator(at.getMtLavorazioneTaglio()); + dop.add(rd.getMt()); + at.setMtLavorazioneTaglio(dop.getResult()); + hmTess.put(Long.valueOf(rd.getId_articoloTessuto()), at); + } + } + Set keySet = hmTess.keySet(); + for (Long key : keySet) { + ArticoloTessuto at = hmTess.get(key); + RigaDocumento rdTessTaglio = new RigaDocumento(bean.getApFull()); + rdTessTaglio.findByDocumentoArticoloTessuto(bean.getId_documento(), at.getId_articoloTessuto(), 100L); + if (rdTessTaglio.getId_rigaDocumento() > 0L) { + rdTessTaglio.setFlgDaCancellare(0L); + } else { + rdTessTaglio.setFlgCodiceRiga(100L); + rdTessTaglio.setDescrizioneRiga(at.getDescrizioneCompleta(lang)); + rdTessTaglio.setId_documento(bean.getId_documento()); + rdTessTaglio.setId_articoloTessuto(at.getId_articoloTessuto()); + } + if (rdTessTaglio.getCapiPerTelo() == 0L) + if (at.getCapiPerTelo() > 0L) { + rdTessTaglio.setCapiPerTelo(at.getCapiPerTelo()); + } else { + rdTessTaglio.setCapiPerTelo(8L); + } + rdTessTaglio.setMt(at.getMtLavorazioneTaglio()); + rp = rdTessTaglio.superSave(); + } + Set keySetCol = hmTessCol.keySet(); + for (Long key : keySetCol) { + ArticoloTessutoColore atc = hmTessCol.get(key); + RigaDocumento rdTessTaglio = new RigaDocumento(bean.getApFull()); + rdTessTaglio.findByDocumentoArticoloTessutoColore(bean.getId_documento(), atc.getId_articoloTessutoColore(), 100L); + if (rdTessTaglio.getId_rigaDocumento() > 0L) { + rdTessTaglio.setFlgDaCancellare(0L); + } else { + rdTessTaglio.setFlgCodiceRiga(100L); + rdTessTaglio.setDescrizioneRiga(atc.getDescrizioneCompleta(lang)); + rdTessTaglio.setId_documento(bean.getId_documento()); + rdTessTaglio.setId_articoloTessutoColore(atc.getId_articoloTessutoColore()); + } + rdTessTaglio.setCapiPerTelo(8L); + rdTessTaglio.setMt(atc.getMtLavorazioneTaglio()); + rp = rdTessTaglio.superSave(); + } + ArticoloArticoloTessuto att = new ArticoloArticoloTessuto(bean.getApFull()); + boolean salvaNtr = true; + while (vecRd.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRd.nextElement(); + if (row.getFlgDaCancellare() == 1L) { + row.delete(); + continue; + } + NumeroTeliRiga ntr = new NumeroTeliRiga(bean.getApFull()); + Vectumerator vec100 = bean.findRigheDocumentoDisposizioneTaglio(0, 0, 2); + while (vec100.hasMoreElements()) { + RigaDocumento row100 = (RigaDocumento)vec100.nextElement(); + ntr.findByRDArticoloRDTessuto(row.getId_rigaDocumento(), row100.getId_rigaDocumento()); + if (ntr.getId_numeroTeliRiga() > 0L); + salvaNtr = true; + if (row100.getId_articoloTessutoColore() > 0L) { + att.findByArticoloVarianteArticoloTessutoColore(row.getId_articoloVariante(), row100.getId_articoloTessuto(), + row100.getId_articoloTessutoColore()); + if (att.getId_articoloArticoloTessuto() == 0L) + salvaNtr = false; + } + if (salvaNtr) { + ntr.setId_rigaDocumentoArticolo(row.getId_rigaDocumento()); + ntr.setId_rigaDocumentoTessuto(row100.getId_rigaDocumento()); + long numTeli = (long)Math.ceil(row.getNr() / (double)row100.getCapiPerTelo()); + ntr.setNumTeliRiga(numTeli); + if (att.getId_articoloArticoloTessuto() <= 0L) + att.findByArticoloVarianteArticoloTessutoColore(row.getId_articoloVariante(), + row100.getId_articoloTessuto(), 0L); + DoubleOperator metriRd = new DoubleOperator(row.getNr()); + metriRd.multiply(att.getMtATT()); + metriRd.setScale(2, 5); + ntr.setMtTessutoRiga(metriRd.getResult()); + ntr.save(); + } + att.setId_articoloArticoloTessuto(0L); + att.setDBState(0); + } + } + } + RigaDocumentoCR CR = new RigaDocumentoCR(); + CR.setFlgDaCancellare(1L); + CR.setId_documento(bean.getId_documento()); + vecRd = rd.findByCR(CR, 0, 0); + while (vecRd.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRd.nextElement(); + row.delete(); + } + return rp; + } + + public ResParm creaFileMailingList(DocumentoCR CR) { + ResParm rp = new ResParm(); + try { + CR.setFlgMl(1L); + CR.setFlgOrderBy(2L); + Vectumerator vec = findByCR(CR, 0, 0); + CR.setFileName(DBAdapter.getTimeNameForFileUpload() + ".txt"); + String fullFileName = getPathTmpFull() + getPathTmpFull(); + FileWr fw = new FileWr(fullFileName, "UTF-8"); + HashSet mailInviateHM = new HashSet<>(); + System.out.println("---------------------- CREAZIONE MAILING LIST FATTURE.... ----------------------"); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + String email = row.getClifor().getEMail().trim(); + if (!email.isEmpty()) { + if (!mailInviateHM.contains(email)) { + mailInviateHM.add(email); + fw.writeLine(email); + continue; + } + System.out.println("doppione: " + email); + } + } + System.out.println("----------------------"); + fw.closeFile(); + if (mailInviateHM.size() > 0) { + rp.setStatus(true); + rp.setMsg(getPathTmp() + getPathTmp()); + } else { + rp.setStatus(false); + rp.setMsg("Elenco mailing listo vuoto!!"); + } + } catch (Exception e) { + handleDebug(e); + rp.setException(e); + rp.setStatus(false); + } + return rp; + } + + public static final synchronized ResParm calcolaTessutiTaglioNONOTTIMIZZATO(Documento bean, String lang) { + ResParm rp = new ResParm(true); + boolean debug = false; + String debugInfo = "calcolaTessutiTaglio"; + RigaDocumento rd = new RigaDocumento(bean.getApFull()); + rd.impostaDaCancellareByDocumentoCodiceriga(bean.getId_documento(), 1L, true); + rd.impostaDaCancellareByDocumentoCodiceriga(bean.getId_documento(), 100L, true); + Vectumerator vecRd = bean.findRigheDocumento(0, 0, 0); + if (vecRd.getTotNumberOfRecords() > 0) { + Vectumerator vec = bean.getArticolo().findArticoliTessuto(); + HashMap hmTess = new HashMap<>(); + HashMap hmTessCol = new HashMap<>(); + while (vec.hasMoreElements()) { + ArticoloArticoloTessuto rowAAT = (ArticoloArticoloTessuto)vec.nextElement(); + if (rowAAT.getId_articoloTessutoColore() == 0L) + if (!hmTess.containsKey(Long.valueOf(rowAAT.getId_articoloTessuto()))) { + System.out.println("AT: " + rowAAT.getId_articoloTessuto()); + ArticoloTessuto at = rowAAT.getArticoloTessuto(); + hmTess.put(Long.valueOf(rowAAT.getId_articoloTessuto()), at); + } + if (rowAAT.getId_articoloTessutoColore() > 0L) { + if (hmTessCol.containsKey(Long.valueOf(rowAAT.getId_articoloTessutoColore()))) + continue; + System.out.println("AC: " + rowAAT.getId_articoloTessutoColore()); + ArticoloTessutoColore atc = rowAAT.getArticoloTessutoColore(); + hmTessCol.put(Long.valueOf(rowAAT.getId_articoloTessutoColore()), atc); + } + } + Vectumerator vecTessTaglio = findTessutiPerTaglio(bean); + while (vecTessTaglio.hasMoreElements()) { + ArticoloTessutoColore row = (ArticoloTessutoColore)vecTessTaglio.nextElement(); + rd = new RigaDocumento(bean.getApFull()); + rd.findByDocumentoArticoloTessutoColore(bean.getId_documento(), row.getId_articoloTessutoColore(), 1L); + if (rd.getId_rigaDocumento() > 0L) { + rd.setMt(row.getMtLavorazioneTaglio()); + } else { + rd.setId_documento(bean.getId_documento()); + rd.setFlgCodiceRiga(1L); + rd.setId_articoloTessutoColore(row.getId_articoloTessutoColore()); + rd.setId_articoloTessuto(rd.getArticoloTessutoColore().getId_articoloTessuto()); + rd.setMt(row.getMtLavorazioneTaglio()); + rd.setDescrizioneRiga(rd.getArticoloTessutoColore().getDescrizioneCompleta()); + rd.setId_causaleMagazzino(bean.getTipoDocumento().getId_causaleMagazzino2()); + } + rd.setFlgDaCancellare(0L); + addRigaDocumentoTessuto(bean, rd, 1L); + boolean trovato = false; + if (rd.getId_articoloTessutoColore() > 0L && + hmTessCol.containsKey(Long.valueOf(rd.getId_articoloTessutoColore()))) { + ArticoloTessutoColore atc = hmTessCol.get(Long.valueOf(rd.getId_articoloTessutoColore())); + DoubleOperator dop = new DoubleOperator(atc.getMtLavorazioneTaglio()); + dop.add(rd.getMt()); + atc.setMtLavorazioneTaglio(dop.getResult()); + hmTessCol.put(Long.valueOf(rd.getId_articoloTessutoColore()), atc); + trovato = true; + } + if (!trovato && + hmTess.containsKey(Long.valueOf(rd.getId_articoloTessuto()))) { + ArticoloTessuto at = hmTess.get(Long.valueOf(rd.getId_articoloTessuto())); + DoubleOperator dop = new DoubleOperator(at.getMtLavorazioneTaglio()); + dop.add(rd.getMt()); + at.setMtLavorazioneTaglio(dop.getResult()); + hmTess.put(Long.valueOf(rd.getId_articoloTessuto()), at); + } + } + Set keySet = hmTess.keySet(); + for (Long key : keySet) { + ArticoloTessuto at = hmTess.get(key); + RigaDocumento rdTessTaglio = new RigaDocumento(bean.getApFull()); + rdTessTaglio.findByDocumentoArticoloTessuto(bean.getId_documento(), at.getId_articoloTessuto(), 100L); + if (rdTessTaglio.getId_rigaDocumento() > 0L) { + rdTessTaglio.setFlgDaCancellare(0L); + } else { + rdTessTaglio.setFlgCodiceRiga(100L); + rdTessTaglio.setDescrizioneRiga(at.getDescrizioneCompleta(lang)); + rdTessTaglio.setId_documento(bean.getId_documento()); + rdTessTaglio.setId_articoloTessuto(at.getId_articoloTessuto()); + } + if (rdTessTaglio.getCapiPerTelo() == 0L) + rdTessTaglio.setCapiPerTelo(8L); + rdTessTaglio.setMt(at.getMtLavorazioneTaglio()); + rp = rdTessTaglio.superSave(); + } + Set keySetCol = hmTessCol.keySet(); + for (Long key : keySetCol) { + ArticoloTessutoColore atc = hmTessCol.get(key); + RigaDocumento rdTessTaglio = new RigaDocumento(bean.getApFull()); + rdTessTaglio.findByDocumentoArticoloTessutoColore(bean.getId_documento(), atc.getId_articoloTessutoColore(), 100L); + if (rdTessTaglio.getId_rigaDocumento() > 0L) { + rdTessTaglio.setFlgDaCancellare(0L); + } else { + rdTessTaglio.setFlgCodiceRiga(100L); + rdTessTaglio.setDescrizioneRiga(atc.getDescrizioneCompleta(lang)); + rdTessTaglio.setId_documento(bean.getId_documento()); + rdTessTaglio.setId_articoloTessutoColore(atc.getId_articoloTessutoColore()); + } + if (rdTessTaglio.getCapiPerTelo() == 0L) + rdTessTaglio.setCapiPerTelo(8L); + rdTessTaglio.setMt(atc.getMtLavorazioneTaglio()); + rp = rdTessTaglio.superSave(); + } + ArticoloArticoloTessuto att = new ArticoloArticoloTessuto(bean.getApFull()); + boolean salvaNtr = true; + while (vecRd.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRd.nextElement(); + if (row.getFlgDaCancellare() == 1L) { + row.delete(); + continue; + } + NumeroTeliRiga ntr = new NumeroTeliRiga(bean.getApFull()); + Vectumerator vec100 = bean.findRigheDocumentoDisposizioneTaglio(0, 0, 2); + while (vec100.hasMoreElements()) { + RigaDocumento row100 = (RigaDocumento)vec100.nextElement(); + ntr.findByRDArticoloRDTessuto(row.getId_rigaDocumento(), row100.getId_rigaDocumento()); + if (ntr.getId_numeroTeliRiga() > 0L); + salvaNtr = true; + if (row100.getId_articoloTessutoColore() > 0L) { + att.findByArticoloVarianteArticoloTessutoColore(row.getId_articoloVariante(), row100.getId_articoloTessuto(), + row100.getId_articoloTessutoColore()); + if (att.getId_articoloArticoloTessuto() == 0L) + salvaNtr = false; + } + if (salvaNtr) { + ntr.setId_rigaDocumentoArticolo(row.getId_rigaDocumento()); + ntr.setId_rigaDocumentoTessuto(row100.getId_rigaDocumento()); + long numTeli = (long)Math.ceil(row.getNr() / (double)row100.getCapiPerTelo()); + ntr.setNumTeliRiga(numTeli); + long nrNew = numTeli * row100.getCapiPerTelo(); + if ((double)nrNew > row.getNr()) { + row.setNr((double)nrNew); + row.superSave(); + } + if (att.getId_articoloArticoloTessuto() <= 0L) + att.findByArticoloVarianteArticoloTessutoColore(row.getId_articoloVariante(), + row100.getId_articoloTessuto(), 0L); + DoubleOperator metriRd = new DoubleOperator(row.getNr()); + metriRd.multiply(att.getMtATT()); + metriRd.setScale(2, 5); + ntr.setMtTessutoRiga(metriRd.getResult()); + ntr.save(); + } + att.setId_articoloArticoloTessuto(0L); + att.setDBState(0); + } + } + } + RigaDocumentoCR CR = new RigaDocumentoCR(); + CR.setFlgDaCancellare(1L); + CR.setId_documento(bean.getId_documento()); + vecRd = rd.findByCR(CR, 0, 0); + while (vecRd.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRd.nextElement(); + row.delete(); + } + return rp; + } + + public static final synchronized ResParm calcolaTessutiTaglioOld(Documento bean, String lang) { + ResParm rp = new ResParm(true); + boolean debug = false; + String debugInfo = "calcolaTessutiTaglio"; + Vectumerator vecRdTess = bean.findRigheDocumento2(0, 0, 2); + while (vecRdTess.hasMoreElements()) { + RigaDocumento rowRdTess = (RigaDocumento)vecRdTess.nextElement(); + rowRdTess.delete(); + } + Vectumerator vecRdTag = bean.findRigheDocumentoDisposizioneTaglio(0, 0, 2); + while (vecRdTag.hasMoreElements()) { + RigaDocumento rowRdTess = (RigaDocumento)vecRdTag.nextElement(); + rowRdTess.delete(); + } + Vectumerator vec = bean.getArticolo().findArticoliTessuto(); + HashMap hmTess = new HashMap<>(); + HashMap hmTessCol = new HashMap<>(); + while (vec.hasMoreElements()) { + ArticoloArticoloTessuto rowAAT = (ArticoloArticoloTessuto)vec.nextElement(); + if (rowAAT.getId_articoloTessutoColore() == 0L) + if (!hmTess.containsKey(Long.valueOf(rowAAT.getId_articoloTessuto()))) { + System.out.println("AT: " + rowAAT.getId_articoloTessuto()); + ArticoloTessuto at = rowAAT.getArticoloTessuto(); + hmTess.put(Long.valueOf(rowAAT.getId_articoloTessuto()), at); + } + if (rowAAT.getId_articoloTessutoColore() > 0L) { + if (hmTessCol.containsKey(Long.valueOf(rowAAT.getId_articoloTessutoColore()))) + continue; + System.out.println("AC: " + rowAAT.getId_articoloTessutoColore()); + ArticoloTessutoColore atc = rowAAT.getArticoloTessutoColore(); + hmTessCol.put(Long.valueOf(rowAAT.getId_articoloTessutoColore()), atc); + } + } + Vectumerator vecTessTaglio = findTessutiPerTaglio(bean); + while (vecTessTaglio.hasMoreElements()) { + ArticoloTessutoColore row = (ArticoloTessutoColore)vecTessTaglio.nextElement(); + RigaDocumento rd = new RigaDocumento(bean.getApFull()); + rd.findByDocumentoArticoloTessutoColore(bean.getId_documento(), row.getId_articoloTessutoColore(), 1L); + if (rd.getId_rigaDocumento() > 0L) { + rd.setMt(row.getMtLavorazioneTaglio()); + } else { + rd.setId_documento(bean.getId_documento()); + rd.setFlgCodiceRiga(1L); + rd.setId_articoloTessutoColore(row.getId_articoloTessutoColore()); + rd.setId_articoloTessuto(rd.getArticoloTessutoColore().getId_articoloTessuto()); + rd.setMt(row.getMtLavorazioneTaglio()); + rd.setDescrizioneRiga(rd.getArticoloTessutoColore().getDescrizioneCompleta()); + rd.setId_causaleMagazzino(bean.getTipoDocumento().getId_causaleMagazzino2()); + } + addRigaDocumentoTessuto(bean, rd, 1L); + boolean trovato = false; + if (rd.getId_articoloTessutoColore() > 0L && + hmTessCol.containsKey(Long.valueOf(rd.getId_articoloTessutoColore()))) { + ArticoloTessutoColore atc = hmTessCol.get(Long.valueOf(rd.getId_articoloTessutoColore())); + DoubleOperator dop = new DoubleOperator(atc.getMtLavorazioneTaglio()); + dop.add(rd.getMt()); + atc.setMtLavorazioneTaglio(dop.getResult()); + hmTessCol.put(Long.valueOf(rd.getId_articoloTessutoColore()), atc); + trovato = true; + } + if (!trovato && + hmTess.containsKey(Long.valueOf(rd.getId_articoloTessuto()))) { + ArticoloTessuto at = hmTess.get(Long.valueOf(rd.getId_articoloTessuto())); + DoubleOperator dop = new DoubleOperator(at.getMtLavorazioneTaglio()); + dop.add(rd.getMt()); + at.setMtLavorazioneTaglio(dop.getResult()); + hmTess.put(Long.valueOf(rd.getId_articoloTessuto()), at); + } + } + Set keySet = hmTess.keySet(); + for (Long key : keySet) { + ArticoloTessuto at = hmTess.get(key); + RigaDocumento rdTessTaglio = new RigaDocumento(bean.getApFull()); + rdTessTaglio.setFlgCodiceRiga(100L); + rdTessTaglio.setDescrizioneRiga(at.getDescrizioneCompleta(lang)); + rdTessTaglio.setId_documento(bean.getId_documento()); + rdTessTaglio.setId_articoloTessuto(at.getId_articoloTessuto()); + rdTessTaglio.setCapiPerTelo(8L); + rdTessTaglio.setMt(at.getMtLavorazioneTaglio()); + rp = rdTessTaglio.superSave(); + } + Set keySetCol = hmTessCol.keySet(); + for (Long key : keySetCol) { + ArticoloTessutoColore atc = hmTessCol.get(key); + RigaDocumento rdTessTaglio = new RigaDocumento(bean.getApFull()); + rdTessTaglio.setFlgCodiceRiga(100L); + rdTessTaglio.setDescrizioneRiga(atc.getDescrizioneCompleta(lang)); + rdTessTaglio.setId_documento(bean.getId_documento()); + rdTessTaglio.setId_articoloTessutoColore(atc.getId_articoloTessutoColore()); + rdTessTaglio.setCapiPerTelo(8L); + rdTessTaglio.setMt(atc.getMtLavorazioneTaglio()); + rp = rdTessTaglio.superSave(); + } + return rp; + } + + public long getNumDisposizioniByArticolo() { + if (getId_articolo() > 0L) + return getNumDisposizioniByArticolo(getId_articolo()); + return 0L; + } + + public long getNumDisposizioniByArticolo(long l_id_articolo) { + StringBuffer s_Sql_Find = new StringBuffer("select count(id_documento) as _count from DOCUMENTO AS D inner join TIPO_DOCUMENTO AS T ON D.id_tipoDocumento=T.id_tipoDocumento inner join TIPOLOGIA_DOCUMENTO AS TD ON T.id_tipologiaDocumento=TD.id_tipologiaDocumento"); + WcString wc = new WcString(); + wc.addWc("TD.codice=220"); + wc.addWc("D.id_articolo=" + l_id_articolo); + String s_Sql_Group = ""; + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + return getCount(stmt, "_count"); + } catch (SQLException e) { + handleDebug(e); + return 0L; + } + } + + public ResParm sendOrderMailMessageTuttofoto(Users l_user, boolean mailAdmin, boolean mailUser, boolean isPagamentoVariato, boolean isSpedito) { + String lang = l_user.getLang(); + lang = "it"; + ResParm rp = new ResParm(true); + if (getId_tipoDocumento() == getId_docOrdineWWW() && + getTmstInvioMailOrdine() == null) + sendOrderEbayWarningMessage(); + String urlBase = getParm("CODA_MESSAGGI_IMG_URL_BASE").getTesto() + "_img/_imgArt/"; + MailProperties mp = new MailProperties(); + if (getId_documento() == 0L) { + rp.setStatus(false); + rp.setMsg("ERRORE! Codice Documento nullo! contattare l'amministratore del sito"); + handleDebug(rp.getMsg(), 0); + return rp; + } + try { + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Documento fattura = null; + if (isSpedito) + fattura = getDocumentoFiglioUno(); + String subject = getMailSubject(); + NumberFormat nf = getNf(); + String notePagamento = "", statoPagamento = ""; + String notaStato = " " + translate(getStatoOrdineWww(), lang) + " "; + String linkOrdineDiretto = ""; + String orderLine = ""; + String orderLine2 = ""; + DoubleOperator totaleCosto = new DoubleOperator(); + double totaleQta = 0.0D; + statoPagamento = translate("Metodo di pagamento scelto", lang) + ": " + translate("Metodo di pagamento scelto", lang); + if (getStatoPagato() == 1L) + statoPagamento = statoPagamento + "
" + statoPagamento + translate("Transazione n. ", lang) + " " + getDescTransaction() + " " + translate("del", lang); + if (getStatoPagato() == 2L) + statoPagamento = statoPagamento + "
" + statoPagamento + ": " + translate("Data Pagamento", lang); + if (getStatoPagato() == 0L) { + if (getFlgProcediPagamento() == 1L) { + notePagamento = getTipoPagamento().getMsgMailProcedi(lang); + if (getTipoPagamento().getFlgTipoPagamento() == 5L) + notePagamento = notePagamento + "
" + getLinkOrdineWww() + ""; + } else { + notePagamento = getTipoPagamento().getMsgMailAspetta(lang); + } + } else { + notePagamento = ""; + } + if (l_user.isProfileNoReg()) { + linkOrdineDiretto = "
" + translate("Per accedere direttamente all'ordine: ", lang); + linkOrdineDiretto = linkOrdineDiretto + "" + getLinkOrdineWwwNoReg(l_user) + ""; + } + if (getFlgStatoOrdineWww() == 2L) + notaStato = translate(getParm("MSG_ORDINE_SPEDITO").getTesto(), lang); + if (mailUser || isPagamentoVariato) { + String mmFile = getCheckOutMailMessage(lang); + if (isSpedito) + mmFile = mmFile.replace(".html", "_spedito.html"); + MailMessage mf = new MailMessage(getApFull(), mmFile); + if (isSpedito) { + mf.setString("dataSpedizione", getDataFormat().format(fattura.getDataSpedizione())); + mf.setString("corriere", fattura.getVettore().getDescrizione()); + mf.setString("nColli", String.valueOf(fattura.getNColli())); + String temp = ""; + if (getId_tipoPagamento() == 1L) + temp = "La informiamo che alla consegna, il corriere richiedera' l'importo di " + nf.format(fattura.getTotaleDocumento()) + " euro del contrassegno"; + if (!getNotaSpedizione().isEmpty()) + temp = temp + "

" + temp; + mf.setString("notaContrassegno", temp); + if (!fattura.getVettore().getLinkTracking().isEmpty() && !fattura.getTrackingSpedizione().isEmpty()) { + String id_docCrypt = crypt(String.valueOf(fattura.getId_documento())); + String link = fattura.getVettore().getLinkTracking() + fattura.getVettore().getLinkTracking(); + String track = "Potra' verificare la spedizione da domani mattina al seguente link "; + mf.setString("tracking", track); + } + } + mf.setQuestionMark(false); + mf.setLong("id_ordine", getProgOrdineWww()); + mf.setString("stato", translate(getStatoOrdineWww(), lang)); + mf.setString("dataOrdine", getDataFormat().format(getDataDocumento())); + mf.setString("statoPagamento", statoPagamento); + mf.setString("notaPagamento", notePagamento); + mf.setLong("id_users", getClifor().getId_clifor()); + mf.setString("nome", getClifor().getNome()); + mf.setString("cognome", getClifor().getCognome()); + mf.setString("indirizzo", getClifor().getIndirizzo()); + mf.setString("numero", getClifor().getNumeroCivico()); + if (getClifor().getCapZona().isEmpty()) { + mf.setString("cap", getClifor().getCapComune()); + } else { + mf.setString("cap", getClifor().getCapZona()); + } + mf.setString("citta", getClifor().getDescrizioneComune()); + mf.setString("provincia", getClifor().getProvinciaComune()); + mf.setString("codfisc", getClifor().getCodFisc()); + mf.setString("codSDI", getClifor().getCodiceIdentificativoFE()); + mf.setString("pec", getClifor().getPec()); + mf.setString("piva", getClifor().getPIva()); + mf.setString("email", getClifor().getEMail()); + mf.setString("nazione", getClifor().getNazione().getDescrizione(lang)); + if (getFlgDeliveryType() == 2L) { + mf.setString("indirizzoSped", "Presso punto di ritiro
" + getPudoDesc()); + } else if (getIndirizzoSped().trim().equals("")) { + if (getPresso().isEmpty()) { + mf.setString("indirizzoSped", getClifor().getIndirizzo()); + } else { + mf.setString("indirizzoSped", "c/o " + getPresso() + "
" + getClifor().getIndirizzo()); + } + mf.setString("numeroSped", getClifor().getNumeroCivico()); + if (getClifor().getCapZona().isEmpty()) { + mf.setString("capSped", getClifor().getCapComune()); + } else { + mf.setString("capSped", getClifor().getCapZona()); + } + mf.setString("cittaSped", getClifor().getDescrizioneComune()); + mf.setString("provinciaSped", getClifor().getProvinciaComune()); + mf.setString("nazioneSped", getClifor().getNazione().getDescrizione(lang)); + } else { + if (getPresso().isEmpty()) { + mf.setString("indirizzoSped", getIndirizzoSped()); + } else { + mf.setString("indirizzoSped", " c/o " + getPresso() + "
" + getIndirizzoSped()); + } + mf.setString("numeroSped", getNumeroCivicoSped()); + mf.setString("capSped", getCapSped()); + mf.setString("cittaSped", getCittaSped()); + mf.setString("provinciaSped", getProvinciaSped()); + mf.setString("nazioneSped", getNazioneSped().getDescrizione(lang)); + } + Vectumerator enu = findRigheDocumento(0, 0, ordineInverso); + while (enu.hasMoreElements()) { + String imgSrc; + RigaDocumento row = (RigaDocumento)enu.nextElement(); + if (row.getId_articolo() > 0L) { + imgSrc = ""; + } else { + imgSrc = ""; + } + orderLine = orderLine + " " + orderLine + imgSrc + "" + row.getDescrizioneRigaCompleta() + "" + nf.format(row.getImponibile()) + " " + row.getQuantita() + "\n"; + totaleQta += row.getQuantita(); + } + mf.setString("orderline", orderLine); + if (getTotaleScontiAbbuoniConIva() > 0.0D) { + mf.setString("descSconto", "**** " + translate("SCONTO INCONDIZIONATO", lang) + " *****"); + mf.setString("scontoInc", " - " + nf.format(getTotaleScontiAbbuoni())); + } + mf.setString("qta", nf.format(totaleQta)); + mf.setString("totale", nf.format(getImponibileTotale())); + mf.setString("totaleOrdine", nf.format(getTotaleDocumento())); + mf.setString("iva", nf.format(getImportoIvaTotale())); + mf.setString("speseSped", nf.format(getSpeseTrasporto())); + mf.setString("speseSpedIva", nf.format(getSpeseTrasportoConIva())); + if (getNotePagamento().isEmpty()) { + mf.setString("nota", String.valueOf(getNotaAggiuntiva())); + } else { + mf.setString("nota", "" + getNotePagamento() + "
" + String.valueOf(getNotaAggiuntiva())); + } + mf.setLong("codiceOrdine", getProgOrdineWww()); + mf.setString("telefono", getClifor().getCellulare() + " " + getClifor().getCellulare()); + mf.setString("linkOrdineDiretto", linkOrdineDiretto); + String theSubject = translate(subject, lang); + String l_email = getClifor().getEMail(); + if (mailUser) + theSubject = theSubject + " - " + theSubject + " " + translate("Ordine n.", lang) + " - " + getProgOrdineWww(); + if (isPagamentoVariato) { + theSubject = theSubject + theSubject + " " + translate("Ordine n.", lang) + " - " + getProgOrdineWww() + " - "; + theSubject = theSubject + theSubject; + theSubject = theSubject + theSubject; + } + mp.put("TO", l_email); + mp.put("BCC", getMailTo()); + mp.setProperty("FROM", getParm("FROM").getTesto()); + mp.put("SUBJECT", theSubject); + mp.put("MSG", mf.getMessage()); + mp.setProperty("ISHTML", "true"); + rp = sendMailMessage(mp); + if (rp.getStatus() && isSpedito) { + fattura.setDataInvioMailSped(getToday()); + fattura.save(); + } + } + if (mailAdmin) { + String mmfAdmMessage = getCheckOutMailMessage(lang); + mmfAdmMessage = mmfAdmMessage.replace(".html", "_Adm.html"); + MailMessage mfAdm = new MailMessage(getApFull(), mmfAdmMessage); + mfAdm.setQuestionMark(false); + mfAdm.setLong("id_ordine", getProgOrdineWww()); + mfAdm.setString("stato", getStato()); + mfAdm.setString("dataOrdine", getDataFormat().format(getDataDocumento())); + mfAdm.setString("statoPagamento", statoPagamento); + mfAdm.setString("notaPagamento", notePagamento); + mfAdm.setLong("id_users", getClifor().getId_clifor()); + mfAdm.setLong("id_clifor", getClifor().getId_clifor()); + mfAdm.setString("nominativo", getClifor().getCognome()); + mfAdm.setString("nome", getClifor().getNome()); + mfAdm.setString("cognome", getClifor().getCognome()); + mfAdm.setString("indirizzo", getClifor().getIndirizzo()); + mfAdm.setString("numero", getClifor().getNumeroCivico()); + if (getClifor().getCapZona().isEmpty()) { + mfAdm.setString("cap", getClifor().getCapComune()); + } else { + mfAdm.setString("cap", getClifor().getCapZona()); + } + mfAdm.setString("citta", getClifor().getDescrizioneComune()); + mfAdm.setString("provincia", getClifor().getProvinciaComune()); + mfAdm.setString("codfisc", getClifor().getCodFisc()); + mfAdm.setString("codSDI", getClifor().getCodiceIdentificativoFE()); + mfAdm.setString("pec", getClifor().getPec()); + mfAdm.setString("piva", getClifor().getPIva()); + mfAdm.setString("email", getClifor().getEMail()); + if (getFlgDeliveryType() == 2L) { + mfAdm.setString("indirizzoSped", "Presso punto di ritiro
" + getPudoDesc()); + } else if (getIndirizzoSped().trim().equals("")) { + if (getPresso().isEmpty()) { + mfAdm.setString("indirizzoSped", getClifor().getIndirizzo()); + } else { + mfAdm.setString("indirizzoSped", "c/o " + getPresso() + "
" + getClifor().getIndirizzo()); + } + mfAdm.setString("numeroSped", getClifor().getNumeroCivico()); + if (getClifor().getCapZona().isEmpty()) { + mfAdm.setString("capSped", getClifor().getCapComune()); + } else { + mfAdm.setString("capSped", getClifor().getCapZona()); + } + mfAdm.setString("cittaSped", getClifor().getDescrizioneComune()); + mfAdm.setString("provinciaSped", getClifor().getProvinciaComune()); + mfAdm.setString("nazioneSped", getClifor().getNazione().getDescrizione(lang)); + } else { + if (getPresso().isEmpty()) { + mfAdm.setString("indirizzoSped", getIndirizzoSped()); + } else { + mfAdm.setString("indirizzoSped", "c/o " + getPresso() + "
" + getIndirizzoSped()); + } + mfAdm.setString("numeroSped", getNumeroCivicoSped()); + mfAdm.setString("capSped", getCapSped()); + mfAdm.setString("cittaSped", getCittaSped()); + mfAdm.setString("provinciaSped", getProvinciaSped()); + mfAdm.setString("nazioneSped", getNazioneSped().getDescrizione(lang)); + } + orderLine2 = ""; + totaleCosto = new DoubleOperator(); + totaleQta = 0.0D; + String stileRicarico = ""; + Vectumerator enu = findRigheDocumento(0, 0, ordineInverso); + while (enu.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)enu.nextElement(); + orderLine2 = orderLine2 + " " + orderLine2 + "" + row.getCodiceArticolo() + " " + row.getDescrizioneRigaCompleta() + "" + row.getArticolo().getCodiciAlternativi() + row.getArticolo().getScaffale() + ((row.getArticolo().getFlgEbay() == 1L) ? " EBAY " : "") + "" + ((row.getArticolo().getFlgStockOfferte() == 2L) ? " OUTLET " : "") + "" + getNf0().format(row.getArticolo().getQuantita()) + "" + nf.format(row.getArticolo().getCostoNetto()) + "" + row.getArticolo().getRicaricoEffettivoDaCostoNetto() + "" + nf.format(row.getImponibile()) + "" + nf.format(row.getSconto()) + "" + getNf0().format(row.getQuantita()) + "\n"; + DoubleOperator totaleArticolo = new DoubleOperator(row.getImponibile()); + totaleArticolo.multiply(row.getQuantita()); + totaleCosto.add(totaleArticolo); + totaleQta += row.getQuantita(); + } + mfAdm.setString("orderline", orderLine2); + mfAdm.setString("qta", nf.format(totaleQta)); + mfAdm.setString("iva", nf.format(getImportoIvaTotale())); + mfAdm.setString("speseSped", nf.format(getSpeseTrasporto())); + mfAdm.setString("speseSpedIva", nf.format(getSpeseTrasportoConIva())); + mfAdm.setString("totale", nf.format(getImponibileTotale())); + mfAdm.setString("totaleOrdine", nf.format(getTotaleDocumento())); + if (getNotePagamento().isEmpty()) { + mfAdm.setString("nota", String.valueOf(getNotaAggiuntiva())); + } else { + mfAdm.setString("nota", "" + getNotePagamento() + "
" + String.valueOf(getNotaAggiuntiva())); + } + mfAdm.setString("notaAmm", "Nota su cliente: " + + String.valueOf(getClifor().getNota() + "
Nota su Ordine: " + getClifor().getNota())); + mfAdm.setLong("codiceOrdine", getProgOrdineWww()); + mfAdm.setString("telefono", getClifor().getCellulare() + " " + getClifor().getCellulare()); + mfAdm.setString("orderline", orderLine2); + mfAdm.setString("notaStato", notaStato); + String sbjAdmin = subject + " - Adm Ordine n. " + subject + " - " + String.valueOf(getProgOrdineWww()) + " - "; + if (isPagamentoVariato) + sbjAdmin = sbjAdmin + "PAGAMENTO VARIATO "; + sbjAdmin = sbjAdmin + sbjAdmin; + String to = getMailTo(); + rp.append(mfAdm.sendMailMessageSystem(to, sbjAdmin, true)); + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e); + System.out.println("ERRORE INVIO EMAIL:"); + e.printStackTrace(); + } + if (!rp.getStatus()) { + handleDebug(rp.getMsg(), 2); + System.out.println("ERRORE INVIO EMAIL:" + rp.getMsg()); + } else { + Timestamp tmst = getTimestamp(); + setTmstInvioMailOrdine(tmst); + superSave(); + } + return rp; + } + + private Document creaReportDettagliDocumenti(DocumentoCR CR, boolean conDdt) { + String prtLang = getLangPrimary(); + long l_id_tipoDocumento = CR.getId_tipoDocumento(); + if (l_id_tipoDocumento == 0L) + l_id_tipoDocumento = getId_docCassa(); + int rowCellLeading = 6; + NumberFormat nf3 = NumberFormat.getInstance(); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf0 = NumberFormat.getInstance(); + nf0.setMaximumFractionDigits(0); + nf0.setMinimumFractionDigits(0); + int col_1 = 5, col_2 = 3, col_3 = 5, col_4 = 12, col_5 = 5, col_6 = 5, col_7 = 5; + int cellLeading = 12; + String descCliente = "", descDocumento = ""; + DoubleOperator totQuantita = new DoubleOperator(); + DoubleOperator totDdt = new DoubleOperator(); + DoubleOperator totaleComplessivo = new DoubleOperator(); + DoubleOperator totaleDocumento = new DoubleOperator(); + DoubleOperator totalePezzeDocumento = new DoubleOperator(); + SimpleDateFormat df = getDataFormat(); + Color currentColor = Color.ORANGE; + try { + Cell rigaVuota = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimo)); + rigaVuota.setVerticalAlignment(4); + rigaVuota.setHorizontalAlignment(0); + rigaVuota.setLeading((float)cellLeading); + rigaVuota.setBorder(0); + rigaVuota.setColspan(40); + rigaVuota.setRowspan(1); + String intestazioneReport = translate("Data: dal ", prtLang) + translate("Data: dal ", prtLang) + " " + df.format(CR.getDataDocumentoDa()) + " " + + translate("al", prtLang); + if (CR.getId_tipo() != 0L) + intestazioneReport = intestazioneReport + " - Tipo: " + intestazioneReport; + creaIntestazioneReport(CR.getTipoReport(), intestazioneReport); + Cell cell = new Cell(new Chunk("Doc.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(translate("Data", prtLang), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(translate("Tipo", prtLang), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(translate("Intestazione", prtLang), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Stato", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Q.ta", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Importo", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.pdfcorpo.endHeaders(); + CR.setFlgOrderBy(1L); + Vectumerator vec = new Documento(getApFull()).findByCR(CR, 0, 0); + Date currentData = null; + Color coloreIntestazioneRiga = Color.LIGHT_GRAY; + while (vec.hasMoreElements()) { + descCliente = ""; + descDocumento = ""; + Documento row = (Documento)vec.nextElement(); + String nDoc = row.getNumeroDocumentoCompleto(); + descCliente = row.getClifor().getDescrizioneCompleta(); + descDocumento = row.getTipoDocumento().getDescrizioneStampa(); + String descPag = row.getStatoCompleto(); + totaleDocumento = new DoubleOperator(); + Vectumerator vecRiga = row.findRigheDocumento(0, 0, + (int)row.getTipoDocumento().getFlgOrdinamentoRigheStampa()); + while (vecRiga.hasMoreElements()) { + RigaDocumento rowRD = (RigaDocumento)vecRiga.nextElement(); + if (CR.getId_articoloTessuto() == 0L || ( + CR.getId_articoloTessuto() > 0L && CR.getId_articoloTessuto() == rowRD.getId_articoloTessuto())) { + double importoRigaConSconto = (double)rowRD.getDocumento().getTipoDocumento().fixDocumentoConImportiNegativi() * + rowRD.getTotImportoRigaConSconto(); + totaleDocumento.add(importoRigaConSconto); + cell = new Cell(new Chunk(rowRD.getDescrizioneRigaCompleta(), PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimo, prtLang))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + if (row.getTipoDocumento().getFlgTipologia() == 200L) { + cell = new Cell(new Chunk(getNf().format(rowRD.getStacchi()), PdfFontFactory.PDF_fPiccolissimo)); + } else { + cell = new Cell(new Chunk(rowRD.getUdmQuantita(), PdfFontFactory.PDF_fPiccolissimo)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(importoRigaConSconto), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + if (conDdt && row.getTipoDocumento().getFlgTipologia() == 200L) { + LavPezza lp = new LavPezza(getApFull()); + Vectumerator vecLP = lp.findDdtByRigaDocumento(rowRD.getId_rigaDocumento()); + while (vecLP.hasMoreElements()) { + LavPezza rowLP = (LavPezza)vecLP.nextElement(); + Documento ddt = rowLP.getRigaDocumentoBolla().getDocumento(); + cell = new Cell(new Chunk("====> " + ddt.getNumeroDocumentoCompleto() + " del " + df.format(ddt.getDataDocumento()), PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimo, prtLang))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(String.valueOf(rowLP.getCount()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + } + } + } + totaleComplessivo.add(totaleDocumento); + totQuantita.add(row.getTotNr()); + totalePezzeDocumento.add(row.getStacchiTotali()); + cell = new Cell(new Chunk(nDoc, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setBackgroundColor(coloreIntestazioneRiga); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getDataFormat().format(row.getDataDocumento()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setBackgroundColor(coloreIntestazioneRiga); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(descDocumento, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setBackgroundColor(coloreIntestazioneRiga); + cell.setColspan(col_3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(descCliente, PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimo, prtLang))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setBackgroundColor(coloreIntestazioneRiga); + cell.setColspan(col_4); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(descPag, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setBackgroundColor(coloreIntestazioneRiga); + cell.setColspan(col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + if (row.getTipoDocumento().getFlgTipologia() == 200L) { + cell = new Cell(new Chunk(getNf().format(row.getStacchiTotali()), PdfFontFactory.PDF_fPiccolissimo)); + } else { + cell = new Cell(new Chunk(getNf().format(row.getTotNr()), PdfFontFactory.PDF_fPiccolissimo)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setBackgroundColor(coloreIntestazioneRiga); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totaleDocumento.getResult()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setBackgroundColor(coloreIntestazioneRiga); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("TOTALE " + getDataFormat().format(currentData), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + if (totalePezzeDocumento.getResult() != 0.0D) { + cell = new Cell(new Chunk(getNf().format(totalePezzeDocumento.getResult()), PdfFontFactory.PDF_fGrandeB)); + } else { + cell = new Cell(new Chunk(getNf().format(totQuantita.getResult()), PdfFontFactory.PDF_fGrandeB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totaleComplessivo.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_7); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + this.document.newPage(); + } catch (Exception e) { + handleDebug(e); + } + return this.document; + } + + public boolean isRata0() { + if (isRata0Attiva()) { + if (getTotaleDocumento() >= getRatealeImportoMinimo()) + return true; + return false; + } + return hasRigheRata0(); + } + + public boolean hasRigheRata0() { + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getArticolo().getFlgRateale0() == 0L) + return false; + } + return true; + } + + public long hasRigheConUsato() { + Vectumerator vec = findRigheDocumento(0, 0, 0); + boolean hasUsatoRm = false; + boolean hasUsatoIva = false; + boolean hasIvaStd = false; + long l_id_iva_rm = getCodiceIvaRegimeMargine(); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getArticolo().getFlgUsato() > 0L) { + if (row.getArticolo().getId_iva() == l_id_iva_rm) { + hasUsatoRm = true; + continue; + } + hasUsatoIva = true; + continue; + } + if (getTipoDocumento().getFlgUsato() == 1L) { + hasUsatoRm = true; + continue; + } + hasIvaStd = true; + } + if ((!hasUsatoIva ? true : false) & (!hasUsatoRm ? true : false)) + return 0L; + if (!hasIvaStd) { + if (hasUsatoIva && hasUsatoRm) + return 5L; + if (hasUsatoIva && !hasUsatoRm) + return 3L; + if (hasUsatoRm && !hasUsatoIva) + return 1L; + } else { + if (hasUsatoIva && hasUsatoRm) + return 6L; + if (hasUsatoIva && !hasUsatoRm) + return 4L; + if (hasUsatoRm && !hasUsatoIva) + return 2L; + } + return 0L; + } + + public double getRatealeImportoMinimo() { + return getParm("SELLA_P_CREDIT_IMPORTO_MINIMO").getNumeroDouble(); + } + + public boolean hasRigheDocumento2() { + Vectumerator vec = findRigheDocumento2(1, 1, 0); + if (vec.hasMoreElements()) + return true; + return false; + } + + protected void creaDocumentoDisposizioneTaglioXDispositoreElencoOrdini(Table l_pdfCorpo) { + try { + int cellLeading = 10; + SimpleDateFormat df = getDataFormat(); + Cell blankRow = new Cell(); + blankRow.setVerticalAlignment(4); + blankRow.setHorizontalAlignment(0); + blankRow.setLeading((float)cellLeading); + blankRow.setBorder(0); + blankRow.setColspan(40); + float imgLogoWidth = getDocLogoWidth() / 4.0F; + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + if (imgLogoWidth > 0.0F) + imgLogo.scaleToFit(imgLogoWidth, imgLogoWidth); + Cell cell = new Cell(); + String desc = getArticolo().getDescrizioneCompleta(getCurrentLang()); + cell.addElement(new Chunk(desc, + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrandissimoXB, getCurrentLang()))); + if (getId_taglia() > 0L) { + desc = desc + desc + ": " + translate("taglia", getCurrentLang()); + cell.addElement(new Chunk(desc, + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fMedio, getCurrentLang()))); + } + if (!getArticolo().getNotaArticolo().isEmpty()) + cell.addElement(new Chunk("\n" + DBAdapter.convertHtmlToString(getArticolo().getNotaArticolo()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, getCurrentLang()))); + if (!getArticolo().getNoteTessutiBaseHtml(getCurrentLang()).isEmpty()) + cell.addElement(new Chunk("\n" + getArticolo().getNoteTessutiBase(getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, getCurrentLang()))); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(22); + l_pdfCorpo.addCell(cell); + String imgFileName = getDocBase() + getDocBase() + getArticolo().getPathImg(); + if (new File(imgFileName).exists()) { + imgLogoWidth = 60.0F; + Image imgArt = Image.getInstance(imgFileName); + if (imgLogoWidth > 0.0F) + imgArt.scaleToFit(imgLogoWidth, imgLogoWidth); + cell = new Cell(); + cell.addElement(new Chunk(imgArt, 0.0F, 0.0F)); + } else { + cell = new Cell(); + } + cell.setBorder(0); + cell.setColspan(8); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(getNumeroDocumentoCompleto(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrande, getCurrentLang()))); + cell.addElement(new Chunk(" " + getDataFormat().format(getDataDocumento()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrande, getCurrentLang()))); + if (!getRiferimento().isEmpty()) { + cell.addElement(new Chunk("\nRIF. ", + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrande, getCurrentLang()))); + cell.addElement(new Chunk(getRiferimento() + " " + getRiferimento(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrande, getCurrentLang()))); + } + cell.addElement(new Chunk("\n", + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimo, getCurrentLang()))); + cell.addElement(new Chunk(getClifor().getDescrizioneCompleta(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimo, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(translate("N. CAPI", getCurrentLang()) + "\n\n" + translate("N. CAPI", getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fGrandeB, getCurrentLang()))); + cell.addElement(new Chunk("\n", + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fMedio, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(translate("Rif. Ordini", getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimoB, getCurrentLang()))); + cell.addElement(new Chunk("\n" + getDescDocFiglioPadreByPadre(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimo, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(30); + l_pdfCorpo.addCell(cell); + l_pdfCorpo.addCell(blankRow); + Vectumerator vecOrdini = new DocFiglioPadre(getApFull()).findByPadre(getId_documento()); + while (vecOrdini.hasMoreElements()) { + DocFiglioPadre rowDFP = (DocFiglioPadre)vecOrdini.nextElement(); + StringBuilder temp = new StringBuilder(translate("Ordine: ", getCurrentLang())); + temp.append(rowDFP.getDocumentoFiglio().getNumeroDocumentoCompleto()); + temp.append(" "); + temp.append(df.format(rowDFP.getDocumentoFiglio().getDataDocumento())); + temp.append(" "); + temp.append(rowDFP.getDocumentoFiglio().getClifor().getDescrizioneCompleta()); + cell = new Cell(); + cell.addElement(new Chunk(temp.toString(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimoB, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(translate("Descrizione", getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimoB, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(translate("Q.tà", getCurrentLang()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimoB, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("", + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolissimoB, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBorder(0); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + Vectumerator vecDispo = rowDFP.getDocumentoFiglio().findRigheDocumento(0, 0, 0); + while (vecDispo.hasMoreElements()) { + RigaDocumento rowDispo = (RigaDocumento)vecDispo.nextElement(); + cell = new Cell(); + cell.addElement(new Chunk(rowDispo.getDescrizioneRigaCompleta(), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk(getNf().format(rowDispo.getNr()), + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("", + PdfFontFactory.getInstance(getApFull()).getPdfFont(PdfFontFactory.PDF_fPiccolo, getCurrentLang()))); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setRowspan(2); + cell.setBorder(0); + cell.setColspan(10); + l_pdfCorpo.addCell(cell); + } + l_pdfCorpo.addCell(blankRow); + } + } catch (Exception e) { + handleDebug(e); + } + } + + public boolean isDocumentoTrasporto() { + long l_codice = getTipoDocumento().getTipologiaDocumento().getCodice(); + if (l_codice == 0L || l_codice == 1L || l_codice == 2L || l_codice == 3L) + return true; + return false; + } + + public long getFlgBartolini() { + return this.flgBartolini; + } + + public void setFlgBartolini(long flgBartolini) { + this.flgBartolini = flgBartolini; + } + + public long getFlgTipoRitiro() { + return this.flgTipoRitiro; + } + + public void setFlgTipoRitiro(long flgTipoRitiro) { + this.flgTipoRitiro = flgTipoRitiro; + } + + public long getFlgAvvisoConsegna() { + return this.flgAvvisoConsegna; + } + + public void setFlgAvvisoConsegna(long flgAvvisoConsegna) { + this.flgAvvisoConsegna = flgAvvisoConsegna; + } + + public Date getDataSpedizione() { + return this.dataSpedizione; + } + + public void setDataSpedizione(Date dataSpedizione) { + this.dataSpedizione = dataSpedizione; + } + + public Date getDataInvioMailSped() { + return this.dataInvioMailSped; + } + + public void setDataInvioMailSped(Date dataInvioMailSped) { + this.dataInvioMailSped = dataInvioMailSped; + } + + public double getValoreDichiarato() { + return this.valoreDichiarato; + } + + public void setValoreDichiarato(double valoreDichiarato) { + this.valoreDichiarato = valoreDichiarato; + } + + public double getCostoEffettivoSped() { + return this.costoEffettivoSped; + } + + public void setCostoEffettivoSped(double costoEffettivoSped) { + this.costoEffettivoSped = costoEffettivoSped; + } + + public long getFlgModoAccredito() { + return this.flgModoAccredito; + } + + public void setFlgModoAccredito(long flgModoAccredito) { + this.flgModoAccredito = flgModoAccredito; + } + + public boolean isEmailSpedInviabile() { + if (getDBState() == 1 && getFlgStato() == 1L && getNColli() > 0L && getId_vettore() > 0L) + return true; + return false; + } + + public ResParm exportFileBartolini(DocumentoCR CR) { + SimpleDateFormat df = new SimpleDateFormat("ddMMyy_hhmm"); + String targetDir = getPathTmpFull(); + String prefissoFile = "BART_" + df.format(DBAdapter.getToday()); + if (CR.getFlgSimulazione() == 1L) + prefissoFile = "SIMUL_" + prefissoFile; + String FNVAB00R = targetDir + targetDir + "_FNVAB00R.dat"; + String filePdf = targetDir + targetDir + "_Spedizione.pdf"; + String FNVAT00R = targetDir + targetDir + "_FNVAT00R.dat"; + ResParm rp = new ResParm(false, "Errore in export: " + FNVAT00R + "
"); + try { + int numRecord = 0; + StringBuffer errMsg = new StringBuffer(); + CR.setFileName(prefissoFile + "_FNVAB00R.dat," + prefissoFile + "_FNVAT00R.dat," + prefissoFile + "_Spedizione.pdf"); + File dirCli = new File(targetDir); + boolean dirOk = true; + if (!dirCli.exists()) + dirOk = dirCli.mkdirs(); + if (dirOk) { + new File(FNVAB00R).delete(); + new File(FNVAT00R).delete(); + new File(filePdf).delete(); + FileWr f_FNVAB00R = new FileWr(FNVAB00R, "UTF-8", false); + FileWr f_FNVAT00R = new FileWr(FNVAT00R, "UTF-8", false); + CR.setFlgBartolini(1L); + Vectumerator vec = findByCR(CR, 0, 0); + boolean flgErr = false; + while (vec.hasMoreElements()) { + Documento rowbean = (Documento)vec.nextElement(); + numRecord++; + if (rowbean.getNColli() <= 0L) { + flgErr = true; + errMsg.append("Ft. " + rowbean.getNumeroDocumentoCompleto() + ": n. colli errato"); + continue; + } + String s1 = rowbean.getRecordBartoliniFNVAB00R(); + f_FNVAB00R.writeLine(s1); + if (rowbean.getFlgDeliveryType() == 2L && rowbean.getPudoId().isEmpty()) { + flgErr = true; + errMsg.append(rowbean.getNumeroDocumentoCompleto() + " " + rowbean.getNumeroDocumentoCompleto() + " Impostato delivery type pudo ma pudo non selezionato!!"); + } + for (int i = 0; (long)i < rowbean.getNColli(); i++) { + s1 = rowbean.getRecordBartoliniFNVAT00R((long)(i + 1)); + f_FNVAT00R.writeLine(s1); + } + if (!rowbean.getPudoId().isEmpty()) { + s1 = rowbean.getRecordBartoliniFNVAT00RPudo(); + f_FNVAT00R.writeLine(s1); + } + s1 = rowbean.getRecordBartoliniFNVAT00REmail(); + f_FNVAT00R.writeLine(s1); + if (!rowbean.getClifor().getCellulare().isEmpty() || !rowbean.getClifor().getTelefono().isEmpty()) { + s1 = rowbean.getRecordBartoliniFNVAT00RSms(); + f_FNVAT00R.writeLine(s1); + } + } + f_FNVAB00R.closeFile(); + f_FNVAT00R.closeFile(); + rp.setStatus(true); + if (flgErr) { + rp.setStatus(false); + rp.setMsg("Generazione file export BARTOLINI CON ERRORI!!!.
Numero Record: " + numRecord + "
" + + errMsg.toString()); + } else { + createFileFromByteArray(creaReportBartoliniPdf(CR), filePdf); + if (CR.getFlgSimulazione() == 0L && !flgErr) { + vec.moveFirst(); + while (vec.hasMoreElements()) { + Documento rowbean = (Documento)vec.nextElement(); + rowbean.aggiornaFlgBartolini(2L); + } + } + rp.setMsg("Generazione file export BARTOLINI avvenuta con successo.
Numero Record: " + numRecord); + } + } + } catch (Exception e) { + handleDebug(e); + rp.setException(e); + rp.setStatus(false); + } + return rp; + } + + private String getRecordBartoliniFNVAB00R() { + StringBuffer temp = new StringBuffer(); + SimpleDateFormat df = new SimpleDateFormat("yyyy MMdd"); + NumberFormat nf3 = NumberFormat.getInstance(Locale.ITALY); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf1 = NumberFormat.getInstance(Locale.ITALY); + nf1.setMaximumFractionDigits(1); + nf1.setMinimumFractionDigits(1); + Date today = getToday(); + temp.append(" "); + temp.append(" "); + temp.append(spaceRight(getParm("BART_COD_CLI").getTesto(), 7)); + temp.append(" "); + temp.append(spaceRight(getParm("BART_P_OPER").getTesto(), 3)); + temp.append(" "); + temp.append(df.format(today)); + temp.append(" "); + temp.append("00"); + temp.append(" "); + temp.append(String.valueOf(getId_esercizio()).substring(2, 4)); + temp.append(zeroLeft(String.valueOf(getProgDocumento()), 5)); + if (getId_tipoPagamento() == 1L) { + temp.append("4 "); + } else { + temp.append("1 "); + } + temp.append(" "); + temp.append("000"); + String desc = getClifor().getCognomeNome(); + if (!getPresso().isEmpty()) + desc = getPresso() + " Sig. " + getPresso(); + desc = desc.replace("’", "'"); + desc = DBAdapter.convertStringToStringNoAccenti(desc); + temp.append(spaceRight(desc, 70)); + if (getIndirizzoSped().isEmpty()) { + desc = getClifor().getIndirizzo() + " n." + getClifor().getIndirizzo() + " "; + } else { + desc = getIndirizzoSped() + " n." + getIndirizzoSped(); + } + desc = DBAdapter.convertStringToStringNoAccenti(desc); + temp.append(spaceRight(desc, 35)); + if (getIndirizzoSped().isEmpty()) { + String capComune = getClifor().getCapComune(); + if (!getClifor().getCapZona().isEmpty()) + capComune = getClifor().getCapZona(); + temp.append(spaceRight(capComune, 9)); + } else { + temp.append(spaceRight(getCapSped(), 9)); + } + if (getIndirizzoSped().isEmpty()) { + desc = getClifor().getDescrizioneComune(); + desc = DBAdapter.convertStringToStringNoAccenti(desc); + temp.append(spaceRight(desc, 35)); + } else { + desc = getCittaSped(); + desc = DBAdapter.convertStringToStringNoAccenti(desc); + temp.append(spaceRight(desc, 35)); + } + if (getClifor().getNazione().getCodice().isEmpty() || getClifor().getNazione().getCodice().toLowerCase().equals("it")) { + if (getIndirizzoSped().isEmpty()) { + temp.append(spaceRight(getClifor().getProvinciaComune(), 2)); + } else { + temp.append(spaceRight(getProvinciaSped(), 2)); + } + } else { + temp.append(spaceRight("", 2)); + } + System.out.println(getClifor().getCognomeNome() + " id: " + getClifor().getCognomeNome() + " idn:" + getClifor().getId_nazione() + " code:" + + getClifor().getNazione().getId_nazione()); + if (getClifor().getNazione().getCodice().isEmpty() || getClifor().getNazione().getCodice().toLowerCase().equals("it")) { + temp.append(" "); + } else { + temp.append(spaceRight(getClifor().getNazione().getCodice(), 3)); + } + temp.append(" "); + temp.append(" "); + temp.append(" "); + if (!getPudoId().isEmpty()) { + temp.append(spaceRight("309", 3)); + } else { + temp.append(spaceRight("000", 3)); + } + temp.append(spaceRight(getParm("BART_TIPO_SERVIZIO").getTesto(), 1)); + temp.append(" "); + if (getFlgTrasportoAssicurato() == 1L) { + desc = nf3.format(getValoreDichiarato()); + desc = desc.replace(".", ""); + temp.append(zeroLeft(desc, 14)); + } else { + temp.append(zeroLeft("0,000", 14)); + } + if (getFlgTrasportoAssicurato() == 1L) { + temp.append("EUR"); + } else { + temp.append(" "); + } + temp.append(spaceRight("MATERIALE FOTOGRAFICO", 15)); + temp.append(" "); + temp.append(zeroLeft(String.valueOf(getNColli()), 5)); + temp.append(" "); + temp.append(zeroLeft(nf1.format(getKgLordo()), 8)); + temp.append(" "); + temp.append(zeroLeft(String.valueOf("0,000"), 6)); + temp.append(" "); + temp.append(zeroLeft("0,000", 14)); + temp.append(" "); + if (getId_tipoPagamento() == 1L) { + desc = nf3.format(getTotaleDocumento()); + desc = desc.replace(".", ""); + temp.append(zeroLeft(desc, 14)); + } else { + temp.append(zeroLeft(String.valueOf("0,000"), 14)); + } + if (getId_tipoPagamento() != 1L) { + temp.append(" "); + } else { + switch ((int)getFlgModoAccredito()) { + case 2: + temp.append(" "); + break; + case 3: + temp.append("BM"); + break; + case 4: + temp.append("CM"); + break; + default: + temp.append(" "); + break; + } + } + if (getId_tipoPagamento() == 1L) { + temp.append("EUR"); + } else { + temp.append(" "); + } + if (getId_tipoPagamento() == 1L) { + temp.append(spaceRight(getParm("BART_GEST_CONTRASS").getTesto(), 2)); + } else { + temp.append(" "); + } + temp.append(" "); + temp.append(zeroLeft(String.valueOf(getId_esercizio()) + String.valueOf(getId_esercizio()), 15)); + temp.append(spaceLeft(getNumeroDocumentoCompleto(), 15)); + temp.append(" "); + temp.append(zeroLeft("0", 7)); + temp.append(" "); + temp.append(zeroLeft("0", 7)); + temp.append(" "); + desc = "Tel.: " + getClifor().getTelefono() + " " + getClifor().getCellulare() + " " + getNotaSpedizione(); + if (desc.length() > 70) + desc = desc.substring(0, 70); + temp.append(spaceRight(desc, 70)); + temp.append(" "); + temp.append("00"); + if (getClifor().getNazione().getCodice().isEmpty() || getClifor().getNazione().getCodice().toLowerCase().equals("it")) { + temp.append("7Q"); + } else { + temp.append("7R"); + } + temp.append(" "); + temp.append(" "); + temp.append("00000000"); + temp.append(" "); + temp.append(" "); + temp.append("0000"); + temp.append(" "); + temp.append(" "); + temp.append(" "); + temp.append(zeroLeft("0,000", 14)); + temp.append(" "); + if (getFlgTipoRitiro() == 1L) { + temp.append("RC"); + } else { + temp.append(" "); + } + temp.append(" "); + temp.append(" "); + if (getFlgAvvisoConsegna() == 1L) { + temp.append("A"); + } else if (getFlgAvvisoConsegna() == 2L) { + temp.append("F"); + } else if (getFlgAvvisoConsegna() == 4L) { + temp.append("S"); + } else if (getFlgAvvisoConsegna() == 3L) { + temp.append("P"); + } else { + temp.append(" "); + } + temp.append(" "); + temp.append(" "); + temp.append(" "); + temp.append(zeroLeft("00", 9)); + temp.append(spaceLeft(" ", 25)); + temp.append(spaceLeft(" ", 9)); + temp.append(spaceLeft(" ", 3)); + temp.append("\r"); + return temp.toString(); + } + + private String getRecordBartoliniFNVAT00R(long l_nCollo) { + SimpleDateFormat dfY = new SimpleDateFormat("yyyy"); + NumberFormat nf3 = NumberFormat.getInstance(Locale.ITALY); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf1 = NumberFormat.getInstance(Locale.ITALY); + nf1.setMaximumFractionDigits(1); + nf1.setMinimumFractionDigits(1); + Date today = getToday(); + StringBuffer temp = new StringBuffer(); + temp.append(" "); + temp.append(" "); + temp.append(spaceRight(getParm("BART_COD_CLI").getTesto(), 7)); + temp.append(" "); + temp.append(spaceRight(getParm("BART_P_OPER").getTesto(), 3)); + temp.append(" "); + temp.append(dfY.format(today)); + temp.append(" "); + temp.append("00"); + temp.append(" "); + temp.append(String.valueOf(getId_esercizio()).substring(2, 4)); + temp.append(zeroLeft(String.valueOf(getProgDocumento()), 5)); + temp.append("E"); + temp.append(spaceRight(getCodeBar(l_nCollo), 35)); + temp.append("\r"); + return temp.toString(); + } + + private String getRecordBartoliniFNVAT00RPudo() { + SimpleDateFormat dfY = new SimpleDateFormat("yyyy"); + NumberFormat nf3 = NumberFormat.getInstance(Locale.ITALY); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf1 = NumberFormat.getInstance(Locale.ITALY); + nf1.setMaximumFractionDigits(1); + nf1.setMinimumFractionDigits(1); + Date today = getToday(); + StringBuffer temp = new StringBuffer(); + temp.append(" "); + temp.append(" "); + temp.append(spaceRight(getParm("BART_COD_CLI").getTesto(), 7)); + temp.append(" "); + temp.append(spaceRight(getParm("BART_P_OPER").getTesto(), 3)); + temp.append(" "); + temp.append(dfY.format(today)); + temp.append(" "); + temp.append("00"); + temp.append(" "); + temp.append(String.valueOf(getId_esercizio()).substring(2, 4)); + temp.append(zeroLeft(String.valueOf(getProgDocumento()), 5)); + temp.append("U"); + temp.append(spaceRight(getPudoId(), 35)); + temp.append("\r"); + return temp.toString(); + } + + private String getRecordBartoliniFNVAT00REmail() { + StringBuffer temp = new StringBuffer(); + SimpleDateFormat dfY = new SimpleDateFormat("yyyy"); + NumberFormat nf3 = NumberFormat.getInstance(Locale.ITALY); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf1 = NumberFormat.getInstance(Locale.ITALY); + nf1.setMaximumFractionDigits(1); + nf1.setMinimumFractionDigits(1); + Date today = getToday(); + temp.append(" "); + temp.append(" "); + temp.append(spaceRight(getParm("BART_COD_CLI").getTesto(), 7)); + temp.append(" "); + temp.append(spaceRight(getParm("BART_P_OPER").getTesto(), 3)); + temp.append(" "); + temp.append(dfY.format(today)); + temp.append(" "); + temp.append("00"); + temp.append(" "); + temp.append(String.valueOf(getId_esercizio()).substring(2, 4)); + temp.append(zeroLeft(String.valueOf(getProgDocumento()), 5)); + temp.append("I"); + temp.append(spaceRight(getClifor().getEMail(), 35)); + temp.append("\r"); + return temp.toString(); + } + + public ByteArrayOutputStream creaReportBartoliniPdf(DocumentoCR CR) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + String titoloReport = ""; + try { + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 20.0F); + titoloReport = "Report Bartolini"; + SimpleDateFormat tf = new SimpleDateFormat("HH:mm:ss"); + Date today = getToday(); + titoloReport = titoloReport + ". Stampato il " + titoloReport + " " + getDataFormat().format(today); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + prepareNewPdfCorpoDocument(); + int rowCellLeading = 6; + int col1 = 4, col2 = 16, col3 = 2, col4 = 2, col5 = 4, col6 = 4, col7 = 8; + int cellLeading = 8; + Cell cell = new Cell(); + Paragraph paragraph = creaParagrafoConGrassetto("\n" + getHeaderDoocumento(1) + "\n" + getHeaderDoocumento(2), PDF_fPiccolo, PDF_fPiccoloB); + paragraph.setLeading(10.0F); + cell.addElement((Element)paragraph); + cell.setLeading(10.0F); + cell.setMaxLines(7); + cell.setBorder(0); + cell.setColspan(24); + this.pdfcorpo.addCell(cell); + Vettore vettore = new Vettore(getApFull()); + vettore.findByPrimaryKey(3L); + String descVettore = vettore.getDescrizione(); + descVettore = descVettore + "\nData Stampa: " + descVettore; + cell = new Cell(); + cell.add(new Chunk("\n\nSPETT.LE\n\n", PDF_fPiccolissimo)); + cell.add(new Chunk(descVettore, PDF_fGrande)); + cell.setVerticalAlignment(4); + cell.setLeading(12.0F); + cell.setBorder(0); + cell.setColspan(16); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Numero Sped.", PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Destinatario", PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col2); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Colli", PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Kg", PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col4); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Contrass.", PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Assic", PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col6); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Note", PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(col7); + this.pdfcorpo.addCell(cell); + CR.setFlgBartolini(1L); + Vectumerator vec = findByCR(CR, 0, 0); + long nColliTot = 0L; + while (vec.hasMoreElements()) { + Documento rowBean = (Documento)vec.nextElement(); + nColliTot += rowBean.getNColli(); + String temp = String.valueOf(rowBean.getId_esercizio()).substring(2, 4) + String.valueOf(rowBean.getId_esercizio()).substring(2, 4); + cell = new Cell(new Chunk(temp, PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col1); + this.pdfcorpo.addCell(cell); + temp = rowBean.getClifor().getCognomeNome(); + if (!rowBean.getPresso().isEmpty()) + temp = temp + " c/o " + temp; + if (rowBean.getIndirizzoSped().isEmpty()) { + temp = temp + " " + temp + " n." + rowBean.getClifor().getIndirizzo() + " "; + } else { + temp = temp + " " + temp + " n." + rowBean.getIndirizzoSped(); + } + if (rowBean.getIndirizzoSped().isEmpty()) { + String capComune = getClifor().getCapComune(); + if (!getClifor().getCapZona().isEmpty()) + capComune = getClifor().getCapZona(); + temp = temp + " " + temp; + } else { + temp = temp + " " + temp; + } + if (rowBean.getIndirizzoSped().isEmpty()) { + temp = temp + " " + temp; + } else { + temp = temp + " " + temp; + } + if (rowBean.getIndirizzoSped().isEmpty()) { + temp = temp + " " + temp; + } else { + temp = temp + " " + temp; + } + if (!rowBean.getPudoId().isEmpty()) + temp = temp + " (Pudo: " + temp + ")"; + cell = new Cell(new Chunk(temp, PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col2); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(String.valueOf(rowBean.getNColli()), PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(String.valueOf(rowBean.getKgLordo()), PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col4); + this.pdfcorpo.addCell(cell); + if (rowBean.getId_tipoPagamento() == 1L) { + temp = getNf2().format(rowBean.getTotaleDocumento()); + switch ((int)rowBean.getFlgModoAccredito()) { + case 3: + temp = temp + " Ass. Banc. Int. Mittente"; + break; + case 4: + temp = temp + " Ass. Circ. Int. Mittente"; + break; + } + } else { + temp = ""; + } + cell = new Cell(new Chunk(temp, PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col5); + this.pdfcorpo.addCell(cell); + if (rowBean.getFlgTrasportoAssicurato() == 1L) { + temp = "si: " + getNf2().format(rowBean.getValoreDichiarato()); + } else { + temp = "no"; + } + cell = new Cell(new Chunk(temp, PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col6); + this.pdfcorpo.addCell(cell); + if (rowBean.getFlgTipoRitiro() == 0L) { + temp = "Tel.: " + rowBean.getClifor().getTelefono() + " " + rowBean.getClifor().getCellulare() + "\n" + rowBean.getNotaSpedizione(); + } else { + temp = "Tel.: " + rowBean.getClifor().getTelefono() + "\nTipo Ritiro: " + rowBean.getTipoRitiro() + "\n" + rowBean.getNotaSpedizione(); + } + if (rowBean.getFlgAvvisoConsegna() != 0L) + temp = temp + "\n" + temp; + if (temp.length() > 70) + temp = temp.substring(0, 70) + " (ATTENZIONE!! SOPRA 70 CARATTERI!!)"; + cell = new Cell(new Chunk(temp, PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col7); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("TOT COLLI: ", PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(col1 + col2); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(String.valueOf(nColliTot), PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("TOT SPED.: ", PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(col4 + col5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(String.valueOf(vec.getTotNumberOfRecords()), PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col6); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col7); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public ResParm aggiornaFlgBartolini(long l_flg) { + setFlgBartolini(l_flg); + return super.save(); + } + + private String getCodeBar(long l_nCollo) { + StringBuffer codeBar = new StringBuffer(); + codeBar.append(String.valueOf(getId_esercizio())); + codeBar.append(zeroLeft(String.valueOf(getProgDocumento()), 6)); + codeBar.append(zeroLeft(String.valueOf(l_nCollo), 3)); + return codeBar.toString(); + } + + private String getCodeBarCkDigit(long l_nCollo) { + String temp = getCodeBar(l_nCollo); + long sumDispari = 0L; + long sumPari = 0L; + boolean isPari = false; + for (int i = 0; i < temp.length(); i++) { + if (isPari) { + sumPari += Long.parseLong(temp.substring(i, i + 1)); + } else { + sumDispari += Long.parseLong(temp.substring(i, i + 1)) * 3L; + } + isPari = !isPari; + } + long tot = sumPari + sumDispari; + long decSup = (tot / 10L + 1L) * 10L; + if (decSup - tot == 10L) + return "0"; + return String.valueOf(decSup - tot); + } + + public ResParm sendSpeditoMailMessage(String lang) { + Documento ordine = getDocumentoPadreUno(); + if (ordine.getId_documento() > 0L) + return ordine.sendOrderMailMessageTuttofoto(getClifor().getUserWww(), false, true, false, true); + return new ResParm(false, "Errore! Tentativo di invio mail spedizione su un documento che non ha un ordine allegato"); + } + + public Documento getDocumentoPadreUno() { + if (this.documentoPadreUno == null) { + Vectumerator vec = findDocumentiPadre(); + if (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + this.documentoPadreUno = row; + } + } + return (this.documentoPadreUno == null) ? new Documento(getApFull()) : this.documentoPadreUno; + } + + public void setDocumentoPadreUno(Documento documentoPadreUno) { + this.documentoPadreUno = documentoPadreUno; + } + + public ResParm sendOrderEbayWarningMessage() { + ResParm rp = new ResParm(true); + if (getId_ordine() == 0L) { + rp.setStatus(false); + rp.setMsg("ERRORE! Codice Ordine nullo! contattare l'amministratore del sito"); + handleDebug(rp.getMsg(), 0); + return rp; + } + rp = controlloArticoliEbay(); + if (!rp.getStatus()) { + String elencoArticoliEbay = convertStringToHtml(rp.getMsg()); + try { + String subject = "Ordine " + getId_ordine() + " - Articoli ebay a zero!"; + String to = getMailToSfx("EBAY"); + if (to.isEmpty()) { + to = getMailTo(); + subject = subject + " PARAMETRO TO_EBAY NON IMPOSTATO!"; + } + NumberFormat nf = getNf(); + MailMessage mfAdm = new MailMessage(getApFull(), getDocBase() + getDocBase()); + mfAdm.setQuestionMark(false); + mfAdm.setString("id_ordine", String.valueOf(getProgOrdineWww())); + mfAdm.setString("dataOrdine", getDataFormat().format(getDataDocumento())); + mfAdm.setString("elencoArticoliEbay", elencoArticoliEbay); + rp = mfAdm.sendMailMessageSystem(to, subject, false); + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e); + System.out.println("ERRORE INVIO EMAIL:"); + e.printStackTrace(); + } + } else { + rp.setMsg("Articoli ebay non trovati o con giacenza >0"); + } + if (!rp.getStatus()) { + handleDebug(rp.getMsg(), 2); + System.out.println("ERRORE INVIO EMAIL:" + rp.getMsg()); + } + return rp; + } + + public ResParm controlloArticoliEbay() { + Vectumerator vec = findRigheDocumento(0, 0, 0); + StringBuilder sb = new StringBuilder(); + ResParm rp = new ResParm(true); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getArticolo().isEbayGiacenza0()) { + if (sb.length() > 0) + sb.append("\n"); + sb.append(row.getArticolo().getCodice()); + sb.append(" - "); + sb.append(row.getArticolo().getDescrizione()); + sb.append(" q.ta: "); + sb.append(row.getArticolo().getQuantita()); + rp.setStatus(false); + } + } + rp.setMsg(sb.toString()); + return rp; + } + + public long getFlgInEsaurimento() { + return this.flgInEsaurimento; + } + + public void setFlgInEsaurimento(long flgInEsaurimento) { + this.flgInEsaurimento = flgInEsaurimento; + } + + protected void creaDocumentoCorpoFtAcquistoBollaCarico(Document l_document, Table l_pdfCorpo) { + int righePerPagina = (int)getTipoDocumento().getRighePerPagina(); + if (righePerPagina <= 0) + righePerPagina = 10; + int maxCarDesc = (int)getTipoDocumento().getMaxCarDesc(); + if (maxCarDesc == 0) + maxCarDesc = 35; + int riga = 0; + int cellLeadingRow = getDocLeadRow(); + if (cellLeadingRow == 0) + cellLeadingRow = 12; + Font PDF_frow = getTipoDocumento().getPdfFontRow(); + Font PDF_frowSmall = getTipoDocumento().getPdfFontRowSmall(); + NumberFormat nf = getNf(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + int[] colSpanNota = { 40 }; + try { + long resHasUsato = hasRigheConUsato(); + String s_note = getNote(); + if (resHasUsato == 1L || resHasUsato == 2L || resHasUsato == 5L || resHasUsato == 6L) { + Iva ivaRM = new Iva(getApFull()); + ivaRM.findByPrimaryKey(getCodiceIvaRegimeMargine()); + s_note = s_note + "\n" + s_note; + } + ArrayList alNote = RigaDocumentoItemPdf.getArrayListNota(s_note, 0, colSpanNota, PDF_frow); + if (getDocPosizioneNota() == 0L) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + while (vec.hasMoreElements()) { + String desc, descQta; + double imponibile, importo; + String scontoS; + RigaDocumento row = (RigaDocumento)vec.nextElement(); + double quantita = row.getQuantita(); + if (row.getSconto() > 0.0D) { + scontoS = nf.format(row.getSconto()); + } else { + scontoS = ""; + } + if (!row.getIva().getFlgTipo().equals("R")) { + if (row.getCodiceArticolo().isEmpty()) { + desc = row.getDescrizioneRiga(); + } else { + desc = row.getCodiceArticolo() + " - " + row.getCodiceArticolo(); + } + if (!row.getSeriale().isEmpty()) { + String temp = row.getSeriale().replace("\n", ""); + temp = temp.replace("\r", ""); + desc = desc + " S/N " + desc; + } + if (row.getArticolo().isSuperGaranzia()) + desc = desc + " - Supergaranzia"; + imponibile = row.getImponibile(); + importo = row.getTotImponibileRigaConSconto(); + } else { + if (row.getCodiceArticolo().isEmpty()) { + desc = row.getDescrizioneRiga(); + } else { + desc = row.getCodiceArticolo() + " - " + row.getCodiceArticolo(); + } + if (!row.getSeriale().isEmpty()) { + String temp = row.getSeriale().replace("\n", ""); + temp = temp.replace("\r", ""); + desc = desc + " S/N " + desc; + } + if (row.getArticolo().isSuperGaranzia()) + desc = desc + " - Supergaranzia"; + imponibile = row.getImponibile(); + importo = row.getTotImponibileRigaConSconto(); + } + if (row.getSeriale().isEmpty() && !row.getArticolo().getNMatricola().isEmpty()) + desc = desc + " Mat. N. " + desc; + if (!row.getNotaBarcode().isEmpty()) + desc = desc + " - " + desc; + String codIva = row.getIva().getDescrizioneRigaStampaAuto(); + if (!row.getNotaRigaDocumento().isEmpty()) + desc = desc + " " + desc; + if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() != 1L) { + if (isQuantitaMagazzinoIntere()) { + descQta = row.getUdm() + " " + row.getUdm(); + } else { + descQta = row.getUdm() + " " + row.getUdm(); + } + } else if (isQuantitaMagazzinoIntere()) { + descQta = getNf0().format(quantita); + } else { + descQta = nf.format(quantita); + } + ArrayList dati = new ArrayList<>(); + dati.add(new RigaDocumentoItemPdf(cols_FT_ACQ_BOLLA_CARICO_[0], desc, PDF_frow)); + dati.add(new RigaDocumentoItemPdf(cols_FT_ACQ_BOLLA_CARICO_[1], row.getArticolo().getCodiciAlternativi(), PDF_frow, 2)); + dati.add(new RigaDocumentoItemPdf(cols_FT_ACQ_BOLLA_CARICO_[2], row.getArticolo().getScaffale(), PDF_frow, 2)); + if (getParm("USA_MAGAZZINO").isTrue()) { + if (isQuantitaMagazzinoIntere()) { + dati.add(new RigaDocumentoItemPdf(cols_FT_ACQ_BOLLA_CARICO_[3], + getNf0().format(row.getArticolo().getQuantita()), PDF_frow, 2)); + } else { + dati.add(new RigaDocumentoItemPdf(cols_FT_ACQ_BOLLA_CARICO_[3], + getNf2().format(row.getArticolo().getQuantita()), PDF_frow, 2)); + } + } else { + dati.add(new RigaDocumentoItemPdf(cols_FT_ACQ_BOLLA_CARICO_[3], + row.getArticolo().getQuantitaMagazzinoMovimentoHtml(), PDF_frow, 2)); + } + dati.add(new RigaDocumentoItemPdf(cols_FT_ACQ_BOLLA_CARICO_[4], + nf.format(row.getArticolo().getRicaricoEffettivoDaCostoNetto()), PDF_frow, 2)); + dati.add(new RigaDocumentoItemPdf(cols_FT_ACQ_BOLLA_CARICO_[5], descQta, PDF_frow, 2)); + dati.add(new RigaDocumentoItemPdf(cols_FT_ACQ_BOLLA_CARICO_[7], nf.format(imponibile), PDF_frow, 2)); + dati.add(new RigaDocumentoItemPdf(cols_FT_ACQ_BOLLA_CARICO_[7], scontoS, PDF_frow, 2)); + dati.add(new RigaDocumentoItemPdf(cols_FT_ACQ_BOLLA_CARICO_[8], nf.format(importo), PDF_frow, 2)); + if (codIva.length() >= 10) { + dati.add(new RigaDocumentoItemPdf(cols_FT_ACQ_BOLLA_CARICO_[9], codIva, PDF_frowSmall, 2)); + } else { + dati.add(new RigaDocumentoItemPdf(cols_FT_ACQ_BOLLA_CARICO_[9], codIva, PDF_frow, 2)); + } + riga = inserisciRigaDocumento(dati, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + } + if (getDocPosizioneNota() == 1L && !s_note.isEmpty()) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + if (righePerPagina - riga > 0) + riga = inserisciRigheVuote(righePerPagina - riga, colSpanNota, riga, l_document, l_pdfCorpo, cellLeadingRow); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void creaDocumentoIntestazioneCorpoFtAcquisto(Table l_pdfCorpo) { + int cellLeading = 8; + int col1 = 20, col2 = 3, col3 = 2, col4 = 2, col5 = 2, col6 = 2, col7 = 2, col8 = 2, col9 = 2, col10 = 3; + try { + Cell cell = new Cell(); + cell.addElement(new Chunk("DESCRIZIONE", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_ACQ_BOLLA_CARICO_[0]); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Cod. For.", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_ACQ_BOLLA_CARICO_[1]); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Scaff.", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_ACQ_BOLLA_CARICO_[2]); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Giac.", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_ACQ_BOLLA_CARICO_[3]); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Ric.%", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_ACQ_BOLLA_CARICO_[4]); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("QUAN.", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_ACQ_BOLLA_CARICO_[5]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("PREZZO", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_ACQ_BOLLA_CARICO_[6]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("SC.", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_ACQ_BOLLA_CARICO_[7]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IMPORTO", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_ACQ_BOLLA_CARICO_[8]); + l_pdfCorpo.addCell(cell); + cell = new Cell(new Chunk("IVA", PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.lightGray); + cell.setColspan(cols_FT_ACQ_BOLLA_CARICO_[9]); + l_pdfCorpo.addCell(cell); + } catch (Exception e) { + handleDebug(e); + } + } + + private long calcolaProgOrdineWww() { + try { + String s_sql = "select max(progOrdineWww) as _max from DOCUMENTO"; + WcString wc = new WcString(); + wc.addWc("id_tipoDocumento =" + getId_docOrdineWWW()); + wc.addWc("id_documento !=" + getId_documento()); + PreparedStatement ps = getConn().prepareStatement(s_sql + s_sql); + long numOrdiniWwwGiorno = getParm("CC_N_ORDINI_WWW_AL_GIORNO").getNumeroLong(); + if (numOrdiniWwwGiorno > 0L) { + long ultimoOrdine = (long)getMax(ps, true); + Documento doc = new Documento(getApFull()); + doc.findByProgOrdineWww(ultimoOrdine); + long giorni = getDateDiff(doc.getDataDocumento(), getDataDocumento()); + if (giorni < 0L) + giorni = 0L; + long nuovoOrdineWww = ultimoOrdine + 1L + giorni * numOrdiniWwwGiorno + (long)(Math.random() * (double)numOrdiniWwwGiorno); + return nuovoOrdineWww; + } + return (long)getMax(ps, true) + 1L; + } catch (Exception e) { + return 0L; + } + } + + private String getRecordContabSeiSoft(double l_totFattura, double l_imponibile, double l_iva, String l_aliquota, String sottoConto) { + StringBuffer temp = new StringBuffer(); + String sep = "\t"; + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yy"); + temp.append(spaceLeft(String.valueOf(getProgDocumento()), 6)); + temp.append(sep); + temp.append(spaceLeft(df.format(getDataDocumento()), 8)); + temp.append(sep); + temp.append(spaceLeft(" ", 5)); + temp.append(sep); + if (getClifor().getFlgAzienda() == 1L) { + if (getClifor().getCognome().isEmpty()) { + temp.append(spaceRight(getClifor().getNome(), 35)); + } else { + temp.append(spaceRight(getClifor().getCognome(), 35)); + } + temp.append(sep); + temp.append(spaceRight(getClifor().getCognome(), 35)); + temp.append(sep); + temp.append(spaceRight(getClifor().getNome(), 35)); + temp.append(sep); + } else { + temp.append(spaceRight("", 35)); + temp.append(sep); + temp.append(spaceRight(getClifor().getCognome(), 35)); + temp.append(sep); + temp.append(spaceRight(getClifor().getNome(), 35)); + temp.append(sep); + } + temp.append(spaceRight(getClifor().getIndirizzo(), 35)); + temp.append(sep); + temp.append(spaceRight(getClifor().getNumeroCivico(), 10)); + temp.append(sep); + if (getClifor().getCapZona().isEmpty()) { + temp.append(spaceRight(getClifor().getCapComune(), 35)); + } else { + temp.append(spaceRight(getClifor().getCapZona(), 35)); + } + temp.append(sep); + temp.append(spaceRight(getClifor().getDescrizioneComune(), 35)); + temp.append(sep); + temp.append(spaceRight(getClifor().getProvinciaComune(), 35)); + temp.append(sep); + temp.append(spaceRight(getClifor().getId_nazione(), 4)); + temp.append(sep); + temp.append(spaceLeft(String.valueOf(l_totFattura), 9)); + temp.append(sep); + temp.append(spaceLeft(String.valueOf(l_imponibile), 9)); + temp.append(sep); + temp.append(spaceLeft(String.valueOf(l_iva), 9)); + temp.append(sep); + temp.append(spaceLeft(l_aliquota, 4)); + temp.append(sep); + temp.append(spaceLeft(sottoConto, 4)); + temp.append(sep); + temp.append(spaceLeft(getClifor().getPIva(), 16)); + temp.append(sep); + temp.append(spaceLeft(getId_tipoPagamento(), 4)); + temp.append(sep); + temp.append(spaceLeft(df.format(getDataDocumento()), 8)); + temp.append(sep); + temp.append(spaceLeft(getClifor().getCodFisc(), 16)); + temp.append("\r"); + return temp.toString(); + } + + public ResParm exportFileContabSeiSoft(DocumentoCR CR) { + ResParm rp = new ResParm(true); + try { + int numRecordFatt = 0, numRecordNc = 0, numRecordFattUsato = 0, numRecordNcUsato = 0; + String contoVenditaPrivati = getParm("SEISOFT_CONTO_VEND_PRIV").getTesto(); + String contoVenditaPrivatiUsato = getParm("SEISOFT_CONTO_VEND_PRIV_USATO").getTesto(); + String contoVenditaAziende = getParm("SEISOFT_CONTO_VEND_AZ").getTesto(); + String contoVenditaAziendeUsato = getParm("SEISOFT_CONTO_VEND_AZ_USATO").getTesto(); + String contoVenditaPrivatiNoleggio = getParm("SEISOFT_CONTO_NOL_PRIV").getTesto(); + String contoVenditaAziendeNoleggio = getParm("SEISOFT_CONTO_NOL_AZ").getTesto(); + String contoSpese = getParm("SEISOFT_CONTO_SPESE").getTesto(); + String contoRMIvaEsente = getParm("SEISOFT_CONTO_RM_IVA_ESENTE").getTesto(); + String contoRMIva = getParm("SEISOFT_CONTO_RM_IVA_VEND").getTesto(); + if (CR.getFlgSimulazione() == 1L) { + CR.setFileName("SIMUL_EXPORT_CONTAB.txt"); + } else { + Calendar cal = Calendar.getInstance(); + String temp = String.valueOf(cal.getTimeInMillis()); + CR.setFileName("sei_export_" + temp + ".txt"); + } + String filename = CR.getFileName(); + String filenameUsato = "USATO_" + CR.getFileName(); + String target = getPathTmpFull(); + new File(target + target).delete(); + new File(target + target).delete(); + FileWr outFileFatt = new FileWr(target + target, "UTF-8", false); + FileWr outFileFattUsato = new FileWr(target + target, "UTF-8", false); + String temp2 = System.getProperty("line.separator"); + if (temp2.equals("\n")); + CR.setFlgTipologia(20L); + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Documento currentFattura = (Documento)vec.nextElement(); + if (currentFattura.getClifor().getCodFisc().length() != 11 && currentFattura.getClifor().getCodFisc().length() != 16) { + rp.setStatus(false); + rp.setMsg("ERRORE! Impossibile esportare le fatture. La fattura n. " + currentFattura.getNumeroDocumentoCompleto() + " " + + currentFattura.getClifor().getCognomeNome() + " non ha una codice fiscale valido."); + break; + } + RigheRegistroIva rri = currentFattura.getRigaRegistroIva(); + DoubleOperator totaleSconti = new DoubleOperator(); + if (currentFattura.getScontoIncondizionato() > 0.0D) + totaleSconti.add(currentFattura.getScontoIncondizionato()); + if (currentFattura.getAbbuono() > 0.0D) + totaleSconti.add(currentFattura.getAbbuono()); + if (totaleSconti.getResult() > 0.0D) { + DoubleOperator dop = new DoubleOperator(conIva(totaleSconti.getResult(), (double)getIvaDoc().getAliquota())); + dop.subtract(totaleSconti.getResult()); + rri.addRigaDocumento(currentFattura.getIvaDoc(), -totaleSconti.getResult(), -dop.getResult(), false, false); + } + Enumeration enuRrri = rri.elements(); + while (enuRrri.hasMoreElements()) { + String contoVendita, codIva; + RigaRegistroIvaItem rrii = enuRrri.nextElement(); + double imponibile = rrii.getImponibile2(); + double iva = rrii.getImportoIva2(); + if (currentFattura.getTipoDocumento().getFlgUsato() == 1L && rrii.isRegimeDelMargine()) { + if (rrii.getIva().getFlgTipo().equals("R")) { + codIva = contoRMIvaEsente; + } else { + codIva = contoRMIva; + } + } else { + codIva = String.valueOf(rrii.getIva().getAliquota()); + } + if (currentFattura.getId_tipoDocumento() == getId_docFtNoleggio()) { + if (currentFattura.getClifor().getFlgAzienda() == 1L) { + contoVendita = contoVenditaAziendeNoleggio; + } else { + contoVendita = contoVenditaPrivatiNoleggio; + } + } else if (currentFattura.getTipoDocumento().getFlgUsato() == 1L) { + if (!rrii.isRegimeDelMargine()) { + contoVendita = contoVenditaAziendeUsato; + } else { + contoVendita = contoVenditaPrivatiUsato; + } + } else if (currentFattura.getClifor().getFlgAzienda() == 1L) { + contoVendita = contoVenditaAziende; + } else { + contoVendita = contoVenditaPrivati; + } + if (currentFattura.getTipoDocumento().getFlgUsato() == 0L) { + if (currentFattura.getTipoDocumento().getFlgTipologia() == 1L) { + System.out.println("FT: " + currentFattura.getNumeroDocumentoCompleto()); + outFileFatt.writeLine(currentFattura.getRecordContabSeiSoft(currentFattura.getTotaleDocumento(), imponibile, iva, codIva, contoVendita)); + numRecordFatt++; + continue; + } + outFileFatt.writeLine(currentFattura.getRecordContabSeiSoft(-currentFattura.getTotaleDocumento(), -imponibile, -iva, codIva, contoVendita)); + numRecordNc++; + continue; + } + if (currentFattura.getTipoDocumento().getFlgTipologia() == 1L) { + System.out.println("FT USATO: " + currentFattura.getNumeroDocumentoCompleto()); + outFileFattUsato.writeLine(currentFattura.getRecordContabSeiSoft(currentFattura.getTotaleDocumento(), imponibile, iva, codIva, contoVendita)); + numRecordFattUsato++; + continue; + } + if (currentFattura.getTipoDocumento().getFlgTipologia() == 2L) { + System.out.println("nc USATO: " + currentFattura.getNumeroDocumentoCompleto()); + outFileFattUsato.writeLine(currentFattura.getRecordContabSeiSoft(-currentFattura.getTotaleDocumento(), -imponibile, -iva, codIva, contoVendita)); + numRecordNcUsato++; + } + } + if (currentFattura.getSpeseTrasporto() > 0.0D) { + DoubleOperator csi = new DoubleOperator(currentFattura.getSpeseTrasporto()); + csi.setScale(4, 5); + csi.multiply(currentFattura.getIvaDoc().getAliquota()); + csi.divide(100.0F); + csi.setScale(2, 5); + double ivaSpeseSpedizione = csi.getResult(); + if (currentFattura.getTipoDocumento().getFlgUsato() == 0L) { + if (currentFattura.getTipoDocumento().getFlgTipologia() == 1L) { + outFileFatt.writeLine(currentFattura.getRecordContabSeiSoft(currentFattura.getTotaleDocumento(), + currentFattura.getSpeseTrasporto(), ivaSpeseSpedizione, + String.valueOf(currentFattura.getIvaDoc().getAliquota()), contoSpese)); + numRecordFattUsato++; + } else { + outFileFatt.writeLine(currentFattura.getRecordContabSeiSoft(-currentFattura.getTotaleDocumento(), + -currentFattura.getSpeseTrasporto(), -ivaSpeseSpedizione, + String.valueOf(currentFattura.getIvaDoc().getAliquota()), contoSpese)); + numRecordNc++; + } + } else if (currentFattura.getTipoDocumento().getFlgTipologia() == 1L) { + outFileFattUsato.writeLine(currentFattura.getRecordContabSeiSoft(currentFattura.getTotaleDocumento(), + currentFattura.getSpeseTrasporto(), ivaSpeseSpedizione, + String.valueOf(currentFattura.getIvaDoc().getAliquota()), contoSpese)); + numRecordFatt++; + } else { + outFileFatt.writeLine(currentFattura.getRecordContabSeiSoft(-currentFattura.getTotaleDocumento(), + -currentFattura.getSpeseTrasporto(), -ivaSpeseSpedizione, + String.valueOf(currentFattura.getIvaDoc().getAliquota()), contoSpese)); + numRecordNcUsato++; + } + } + if (CR.getFlgSimulazione() == 0L) + currentFattura.aggiornaExportRecord(); + } + outFileFatt.closeFile(); + outFileFattUsato.closeFile(); + if (rp.getStatus()) { + rp.setMsg("Generazione file export avvenuta con successo.
Fatture: " + numRecordFatt + " Note di Credito: " + numRecordNc + "
USATO: Fatture: " + numRecordFattUsato + " Note di Credito: " + numRecordNcUsato); + } else { + rp.setMsg("Errore in export: " + target + filename + "
" + rp.getMsg()); + } + } catch (Exception e) { + handleDebug(e); + rp.setException(e); + rp.setStatus(false); + } + return rp; + } + + public ResParm aggiornaExportRecord() { + setFlgExport(1L); + return super.save(); + } + + public ByteArrayOutputStream creaPdfEtichetteConfezione(String l_printer) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + int NUMERO_ETICHETTE = 4; + int cellLeading = 6; + try { + String dim = getParm("LABEL_PK_LIST_SIZE").getTesto(); + long xx = Long.parseLong(dim.substring(0, dim.indexOf(','))); + long yy = Long.parseLong(dim.substring(dim.indexOf(',') + 1)); + Rectangle label = new Rectangle(getPdfPointSize(20L), getPdfPointSize(200L)); + this.document = new Document(label.rotate(), 2.0F, 2.0F, 2.0F, 2.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + prepareNewPdfCorpoDocument(); + int numColli = 0; + long numTotColli = 0L; + Vectumerator vec = findRigheDocumento(0, 0, 0); + String sp = " "; + Font pdfTagliando = new Font(2, 14.0F, 1); + Chunk madeInItaly = new Chunk(sp + "PRODOTTO IN ITALIA\n", pdfTagliando); + Chunk descConfezione = new Chunk(sp + "via yuri gagarin ...\nC.H. PIVA 00000000", pdfTagliando); + vec.moveFirst(); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + for (int i = 0; i < NUMERO_ETICHETTE; i++) { + if (row.getId_articolo() > 0L) { + String descrizioneArticolo = row.getArticolo().getNome(); + numColli++; + Paragraph p = new Paragraph(); + p.add(madeInItaly); + p.add("COMPOSIZIONE"); + p.add("SIMBOLI"); + p.add(descrizioneArticolo); + Cell cell = new Cell((Element)p); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + } + if ((double)i < row.getQuantita() - 1.0D) { + this.document.add((Element)this.pdfcorpo); + this.document.newPage(); + prepareNewPdfCorpoDocument(); + } + } + if (vec.hasMoreElements()) { + this.document.add((Element)this.pdfcorpo); + this.document.newPage(); + prepareNewPdfCorpoDocument(); + } + } + this.document.add((Element)this.pdfcorpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public Timestamp getTmstInvioMailOrdine() { + return this.tmstInvioMailOrdine; + } + + public void setTmstInvioMailOrdine(Timestamp tmstInvioMailOrdine) { + this.tmstInvioMailOrdine = tmstInvioMailOrdine; + } + + public long getFlgStatoOrdineWwwPrecedente() { + return this.flgStatoOrdineWwwPrecedente; + } + + public void setFlgStatoOrdineWwwPrecedente(long flgStatoOrdineWwwPrecedente) { + this.flgStatoOrdineWwwPrecedente = flgStatoOrdineWwwPrecedente; + } + + private static final synchronized ResParm aggiornaRigheDocumentoMagArticolo(DocumentoInterface doc, boolean isTipoMovimentoInverso) { + ResParm rp = new ResParm(); + Vectumerator vec = doc.findRigheDocumento(0L, 0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento rd = (RigaDocumento)vec.nextElement(); + if (rd.getArticolo().usaMagazzino() && doc.getTipoDocumento().getFlgMovMagazzino() != 0L) { + DoubleOperator dop = new DoubleOperator(rd.getArticolo().getQuantita()); + if ((doc.getTipoDocumento().getFlgMovMagazzino() == 1L && isTipoMovimentoInverso) || ( + doc.getTipoDocumento().getFlgMovMagazzino() == -1L && !isTipoMovimentoInverso)) { + dop.subtract(rd.getNr()); + } else { + dop.add(rd.getNr()); + } + rd.getArticolo().setQuantita(dop.getResult()); + if (rd.getArticolo().getQuantita() <= 0.0D) { + if (rd.getArticolo().getFlgUsato() > 0L || rd.getArticolo().getFlgStockOfferte() == 2L || + rd.getArticolo().getFlgStockOfferte() == 3L || + rd.getArticolo().getFlgEbay() == 1L) + rd.getArticolo().setFlgEscludiWebArt(1L); + } else { + rd.getArticolo().setFlgEscludiWebArt(0L); + } + rd.getArticolo().handleQuantitaDebugBeforeSave("documento.addRigaDocumentoMagArticolo"); + rp.append(rd.getArticolo().superSave()); + } + } + return rp; + } + + public String getTrackingSpedizione() { + if (getParm("WEB_SEND_ORDER_MAIL_CODE").getNumeroLong() == 2L && ( + this.trackingSpedizione == null || this.trackingSpedizione.isEmpty()) && getFlgStato() == 1L) + this.trackingSpedizione = String.valueOf(getId_esercizio()) + String.valueOf(getId_esercizio()); + return (this.trackingSpedizione == null) ? "" : this.trackingSpedizione.trim(); + } + + public void setTrackingSpedizione(String trackingSpedizione) { + this.trackingSpedizione = trackingSpedizione; + } + + public void findByProgOrdineWww(long l_ProgOrdineWww) { + String s_Sql_Find = "select A.* from DOCUMENTO AS A"; + String s_Sql_Order = " order by A.dataDocumento desc, A.progOrdineWww,A.id_esercizio desc, A.progDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.flgStato=1"); + wc.addWc("A.progOrdineWww=" + l_ProgOrdineWww); + wc.addWc("A.id_tipoDocumento=" + getId_docOrdineWWW()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + private Document creaLabelBartoliniPdfUno(Documento bean, Document l_document, int pageNumber) { + try { + String descCliente, descDestinazione; + Table l_pdfCorpo = getNewPdfCorpoDocument(); + bean.setNumPagDocumento(1L); + int cellLeading = 8; + SimpleDateFormat df = getDataFormat(); + float imgLogoWidth = getDocLogoWidth(); + Image imgLogo = Image.getInstance(getDocBase() + getDocBase()); + if (imgLogoWidth > 0.0F) + imgLogo.scaleToFit(imgLogoWidth, imgLogoWidth); + Cell cell = new Cell(); + cell.addElement(new Chunk(imgLogo, 0.0F, 0.0F)); + Paragraph paragraph = creaParagrafoConGrassetto("\n" + getHeaderDoocumento(1) + "\n" + getHeaderDoocumento(2), PDF_fPiccolo, PDF_fPiccoloB); + paragraph.setLeading(10.0F); + cell.addElement((Element)paragraph); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(22); + l_pdfCorpo.addCell(cell); + if (bean.getId_clifor() > 0L) { + descCliente = ""; + if (bean.getClifor().getpIva().isEmpty() && bean.getClifor().getCodFisc().isEmpty() && + bean.getClifor().getCognome().isEmpty()) { + descCliente = "AUTOFATTURA\n"; + descCliente = descCliente + descCliente; + } else { + descCliente = descCliente + descCliente + "\n"; + descCliente = descCliente + descCliente; + String capComune = bean.getClifor().getCapComune(); + if (!bean.getClifor().getCapZona().isEmpty()) + capComune = bean.getClifor().getCapZona(); + if (!bean.getClifor().getNumeroCivico().isEmpty()) + descCliente = descCliente + " n." + descCliente; + descCliente = descCliente + "\n" + descCliente + " " + capComune; + if (!bean.getClifor().getProvinciaComune().isEmpty()) + descCliente = descCliente + " (" + descCliente + ")"; + if (!bean.getClifor().getId_nazione().isEmpty()) + descCliente = descCliente + " " + descCliente; + } + } else { + descCliente = bean.getNominativoDocumento(); + } + if (!bean.getIndirizzoSped().isEmpty() && !bean.getPresso().isEmpty()) { + descDestinazione = ""; + descDestinazione = descDestinazione + "c/o " + descDestinazione + "\n"; + descDestinazione = descDestinazione + descDestinazione + " n." + bean.getIndirizzoSped() + "\n" + bean.getNumeroCivicoSped() + " " + bean.getCapSped() + " (" + bean.getCittaSped() + ")"; + if (!bean.getId_nazioneSped().isEmpty()) + descDestinazione = descDestinazione + " " + descDestinazione; + } else if (bean.getId_destinazioneDiversa() == 0L) { + if (getParm("DESTINAZIONE").getNumeroLong() == 1L) { + descDestinazione = "IDEM\n\n"; + } else { + descDestinazione = ""; + } + } else { + descDestinazione = ""; + if (!bean.getDestinazioneDiversa().getPressoDD().isEmpty()) + descDestinazione = descDestinazione + "c/o " + descDestinazione + "\n"; + descDestinazione = descDestinazione + descDestinazione + " n." + bean.getDestinazioneDiversa().getIndirizzoDD() + "\n" + bean.getDestinazioneDiversa().getNumeroCivicoDD() + " " + bean.getDestinazioneDiversa().getCapComuneDD() + " (" + bean.getDestinazioneDiversa().getDescrizioneComuneDD() + ")"; + if (!bean.getDestinazioneDiversa().getId_nazioneDD().isEmpty()) + descDestinazione = descDestinazione + " " + descDestinazione; + } + cell = new Cell(); + cell.addElement(new Chunk("\n\nSPETT.LE\n\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(descCliente, PdfFontFactory.PDF_fGrande)); + if (!descDestinazione.isEmpty()) { + cell.addElement(new Chunk("\nDESTINAZIONE\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(descDestinazione, PdfFontFactory.PDF_fGrande)); + } + cell.setVerticalAlignment(4); + cell.setLeading(12.0F); + cell.setBorder(0); + cell.setRowspan(3); + cell.setColspan(18); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("TIPO DOCUMENTO\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk("\n", PdfFontFactory.PDF_fMedio)); + if (getFlgStato() == 0L) + cell.addElement(new Chunk("(B) ", PdfFontFactory.PDF_fMedioB)); + if (getFlgStato() == 2L) { + cell.addElement(new Chunk("FATTURA PROFORMA\n", PdfFontFactory.PDF_fGrandeB)); + } else { + cell.addElement(new Chunk(bean.getTipoDocumento().getDescrizioneStampa() + "\n", PdfFontFactory.PDF_fGrandeB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(12); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("N. DOC.\n\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(String.valueOf(bean.getNumeroDocumento()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(4); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("DATA\n\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(df.format(bean.getDataDocumento()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(4); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("xx", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + cell.setRowspan(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("RIF. INTERNO \n", PdfFontFactory.PDF_fPiccolissimo)); + if (!bean.getDescrizioneDocumentiPadre().isEmpty()) { + if (getParm("ORDINI_WWW_USA_PROG_WWW").isTrue()) { + cell.addElement(new Chunk(getNf0().format(bean.getDocumentoPadreUno().getProgOrdineWww()), PdfFontFactory.PDF_fMedioB)); + } else { + cell.addElement(new Chunk(bean.getDescrizioneDocumentiPadre(), PdfFontFactory.PDF_fPiccolissimo4)); + } + } else { + cell.addElement(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimoB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + cell.setMaxLines(2); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("COD. C/F\t\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(String.valueOf(bean.getClifor().getId_clifor()), PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(3); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("PARTITA IVA/CF\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(bean.getClifor().getPIva() + " / " + bean.getClifor().getPIva(), PdfFontFactory.PDF_fPiccoloB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(11); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("Telefoni\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk( + bean.getClifor().getTelefono() + " " + bean.getClifor().getTelefono(), PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + cell = new Cell(); + cell.addElement(new Chunk("CONDIZIONI DI PAGAMENTO\n", PdfFontFactory.PDF_fPiccolissimo)); + cell.addElement(new Chunk(bean.getTipoPagamento().getDescrizione(), PdfFontFactory.PDF_fPiccolissimoB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(20); + l_pdfCorpo.addCell(cell); + if (!bean.getPudoId().isEmpty()) { + cell = new Cell(); + cell.addElement(new Chunk("CONSEGNA PRESSO FERMOPOINT ", PdfFontFactory.PDF_fGrandeB)); + cell.addElement(new Chunk(bean.getPudoDesc(), PdfFontFactory.PDF_fGrandeBlu)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(40); + l_pdfCorpo.addCell(cell); + } + l_document.add((Element)l_pdfCorpo); + } catch (Exception e) { + e.printStackTrace(); + } + return l_document; + } + + public ByteArrayOutputStream creaBartoliniCodBarrePdf(DocumentoCR CR) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + this.document = new Document(PageSize.A4, 0.0F, 0.0F, 0.0F, 0.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + int altezzaCod = 50; + int larghezzaCod = 120; + int labelNumber = 0; + int nCol = 3; + int nRow = 8; + CR.setFlgBartolini(2L); + Vectumerator vec = findByCR(CR, 0, 0); + float[] widths = { 0.33F, 0.33F, 0.33F }; + PdfPTable corpo = new PdfPTable(widths); + corpo.setWidthPercentage(100.0F); + if (CR.getBlankLabels() > 0L) { + PdfPCell pdfPCell = new PdfPCell(); + pdfPCell.setFixedHeight(PageSize.A4.getHeight() / (float)nRow); + pdfPCell.setBorder(0); + for (int i = 0; (long)i < CR.getBlankLabels(); i++) { + labelNumber++; + corpo.addCell(pdfPCell); + } + } + PdfContentByte cb = this.writer.getDirectContent(); + Barcode128 codeBar = new Barcode128(); + codeBar.setCodeType(9); + while (vec.hasMoreElements()) { + Documento rowBean = (Documento)vec.nextElement(); + for (int i = 0; (long)i < rowBean.getNColli(); i++) { + labelNumber++; + PdfPCell pdfPCell = new PdfPCell(); + pdfPCell.setBorder(0); + codeBar.setCode(rowBean.getCodeBar((long)(i + 1))); + Image imgBarcode = codeBar.createImageWithBarcode(cb, null, null); + imgBarcode.scaleToFit((float)larghezzaCod, (float)altezzaCod); + pdfPCell.addElement(new Chunk(imgBarcode, 30.0F, (float)(-altezzaCod + 10))); + pdfPCell.addElement(new Chunk("\n\n\n TuttoFoto - Ft. n. " + rowBean.getNumeroDocumento() + " collo n. " + i + 1 + " di " + + rowBean.getNColli(), PDF_fPiccoloB)); + pdfPCell.setVerticalAlignment(4); + pdfPCell.setFixedHeight(PageSize.A4.getHeight() / (float)nRow); + pdfPCell.setIndent(20.0F); + corpo.addCell(pdfPCell); + } + if (CR.getFlgSimulazione() == 0L) + rowBean.aggiornaFlgBartolini(3L); + } + int numberBlankCell = nCol - labelNumber % nCol; + PdfPCell cell = new PdfPCell(); + cell.setFixedHeight(PageSize.A4.getHeight() / (float)nRow); + cell.setBorder(0); + if (numberBlankCell != 3) + for (int i = 0; i < numberBlankCell; i++) + corpo.addCell(cell); + this.document.add((Element)corpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public ByteArrayOutputStream creaBartoliniLabelPdf(DocumentoCR CR) { + boolean creaFile = false; + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + int pageNumber = 1; + try { + if (CR.getId_documentoS() > 0L) { + Documento bean = null; + bean = new Documento(getApFull()); + bean.findByPrimaryKey(CR.getId_documentoS()); + bean.setCurrentLang(getCurrentLang()); + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + this.document = creaLabelBartoliniPdfUno(bean, this.document, pageNumber); + CR.setFilePdf(bean.getPathStampaDocumentoFull()); + setDescDocumenti(bean.getDescDocumenti()); + } else { + String temp = ""; + Vectumerator vec = new Documento(getApFull()).findByCR(CR, 0, 0); + System.out.println("" + vec.getTotNumberOfRecords() + " " + vec.getTotNumberOfRecords()); + boolean firstrecord = true; + while (vec.hasMoreElements()) { + System.out.println("dengtro: " + vec.getTotNumberOfRecords() + " " + vec.hasMoreElements()); + pageNumber = 1; + Documento row = (Documento)vec.nextElement(); + if (firstrecord) { + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + this.document.open(); + firstrecord = false; + } + System.out.println("Creazione pdf doc. n. " + row.getNumeroDocumentoCompleto()); + this.document = creaLabelBartoliniPdfUno(row, this.document, pageNumber); + if (vec.hasMoreElements()) + this.document.newPage(); + } + CR.setFilePdf(getDocBase() + getDocBase() + "_" + getPathStampeDocumenti() + "docs.pdf"); + } + this.document.close(); + this.document = null; + if (creaFile) { + createFileFromByteArray(ba, CR.getFilePdf()); + System.out.println("Creato file label bartolini " + CR.getFilePdf()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public ResParm saveOLD() { + boolean debug = false; + ResParm rp = new ResParm(); + if (getFlgStato() == 0L && getFlgDocumentoPrelevato() == 1L) { + rp.setStatus(false); + rp.setMsg("ERRORE! Impossibile salvare una bozza con stato prelevamento chiuso!"); + return rp; + } + rp = calcoloStatoLavorazione(); + if (!rp.getStatus()) + return rp; + boolean salvaAgenti = false; + long statoPrecedente = getFlgStatoPrecedente(); + long statoOrdineWwwPrecedente = getFlgStatoOrdineWwwPrecedente(); + long statoPrelevatoPrecedente = getFlgDocumentoPrelevatoPrecedente(); + long statoPrenotazionePrecedente = getFlgStatoPrenotazionePrecedene(); + long l_id_cliforPrecedente = getId_cliforPrecedente(); + String currentPdfFile = getPathStampaDocumentoFull(); + File pdfFile = new File(currentPdfFile); + if (pdfFile.exists()) + pdfFile.delete(); + setTmstFilePdf(null); + synchronized (this) { + try { + rp = checkEMSTA(); + if (!rp.getStatus()) { + Documento documento = (Documento)clone(); + findByPrimaryKey(documento.getId_documento()); + setNote(documento.getNote()); + setNotaAggiuntiva(documento.getNotaAggiuntiva()); + logDebug(debug, "Documento.save:save note"); + superSave(); + return rp; + } + if (rp.getStatus() && + hasScadenzeSuRiba()) { + rp.setStatus(false); + rp.setMsg("ERRORE! Esistono delle distinte riba già legate alle scadenze"); + return rp; + } + if (getFlgStato() != statoPrecedente && new DocumentoPagamento( + getApFull()).hasPagamentiEffettuatiByDocumento(getId_documento())) + return new ResParm(false, "ERRORE! Non posso cambiare stato documento in " + + getStato() + ": sono stati inseriti dei pagamenti."); + if (getDBState() == 0) + salvaAgenti = true; + Documento doc = new Documento(getApFull()); + doc.findByPrimaryKey(getId_documento()); + if (doc.getId_clifor() != getId_clifor()) + salvaAgenti = true; + if (getTipoDocumento().getFlgTipologia() == 4L) { + if (getId_documentoXpay() == null || getId_documentoXpay().isEmpty()) + setId_documentoXpay(getNuovoProgressivoDocumentoXpay()); + } else { + setId_documentoXpay(null); + } + if (getDBState() == 1) + if (getTipoDocumento().getFlgCorrispettivi() == 0L) { + RigaDocumento rf = new RigaDocumento(getApFull()); + RigheRegistroIva rri = getRigaRegistroIva(); + setImponibileRighe(rri.getTotImponibile()); + setImportoIvaRighe(rri.getTotIva()); + rri = getRigaRegistroIvaCompleto(); + setImponibileTotale(rri.getTotImponibile()); + setImportoIvaTotale(rri.getTotIva()); + setImportoRMRighe(rf.getTotImportoRMRighe(getId_documento())); + } else { + double importoTotale = getImportoTotaleRigheCorrispettivi(); + setImportoTotale(importoTotale); + } + if (hasDocumentiPadre()) { + setFlgHaDocumentoPadre(1L); + } else { + setFlgHaDocumentoPadre(0L); + } + if (hasDocumentiFiglio()) { + setFlgEmettiFatturaScontrino(1L); + } else { + setFlgEmettiFatturaScontrino(0L); + } + if (isFatturaONotaDiCredito() && l_id_cliforPrecedente != 0L && l_id_cliforPrecedente != getId_clifor()) + if (getId_documento() > 0L) + new DocumentoAgente(getApFull()).deleteAgentiByDocumento(getId_documento()); + if (isFatturaONotaDiCredito() && l_id_cliforPrecedente != getId_clifor()) { + if (getClifor().getId_agente() > 0L) { + DocumentoAgente da = new DocumentoAgente(getApFull()); + da.setId_documento(getId_documento()); + da.setId_cliforDA(getClifor().getId_agente()); + da.setPercDocumentoAgente(getClifor().getPercAgente()); + logDebug(debug, "Documento.save:save documento agente1"); + da.save(); + } + if (getClifor().getId_respCommerciale() > 0L) { + DocumentoAgente da = new DocumentoAgente(getApFull()); + da.setId_documento(getId_documento()); + da.setId_cliforDA(getClifor().getId_respCommerciale()); + da.setPercDocumentoAgente(getClifor().getPercRespCommerciale()); + logDebug(debug, "Documento.save:save documento agente2"); + da.save(); + } + } + if (getId_destinazioneDiversa() > 0L && getIndirizzoSped().isEmpty()) { + setPresso(getDestinazioneDiversa().getPressoDD()); + setIndirizzoSped(getDestinazioneDiversa().getIndirizzoDD()); + setNumeroCivicoSped(getDestinazioneDiversa().getNumeroCivicoDD()); + setCittaSped(getDestinazioneDiversa().getDescrizioneComuneDD()); + setProvinciaSped(getDestinazioneDiversa().getProvinciaComuneDD()); + if (getDestinazioneDiversa().getCapZonaDD().isEmpty()) { + setCapSped(getDestinazioneDiversa().getCapComuneDD()); + } else { + setCapSped(getDestinazioneDiversa().getCapZonaDD()); + } + setId_nazioneSped(getDestinazioneDiversa().getId_nazioneDD()); + } + logDebug(debug, "Documento.save:super save"); + rp = super.save(); + if (rp.getStatus()) { + if (getParm("USA_MAGAZZINO").isTrue()) + if ((statoPrecedente != 0L && getFlgStato() == 0L && + getFlgStatoOrdineWww() != 99L) || (statoPrecedente == 0L && + getFlgStato() != 0L && + getFlgStatoOrdineWww() != 99L) || (statoOrdineWwwPrecedente != 99L && + + getFlgStatoOrdineWww() == 99L && statoPrecedente != 0L) || (statoOrdineWwwPrecedente == 99L && + + getFlgStatoOrdineWww() != 99L && statoPrecedente != 0L)) { + boolean isTipoMovimentoInverso = false; + if (getFlgStato() == 0L || getFlgStatoOrdineWww() == 99L) + isTipoMovimentoInverso = true; + boolean isStatoOrdineWwwAnnullato = (getFlgStatoOrdineWww() == 99L); + aggiornaRigheDocumentoMagArticolo(this, isTipoMovimentoInverso); + } + if (getId_tipoDocumento() == getId_docPrenotazione() && + statoPrenotazionePrecedente != getFlgStatoPrenotazione()) + checkStatoPrenotazioneByDocumento(); + if (isFatturaONotaDiCredito()) { + DocumentoScadenza ds = new DocumentoScadenza(getApFull()); + rp = ds.deleteByDocumento(getId_documento()); + if (getFlgStato() == 1L) { + DocumentoPagamento dp = new DocumentoPagamento(getApFull()); + dp.findRecordDocumentoByDocumento(getId_documento()); + dp.delete(); + dp.setId_documento(getId_documento()); + dp.setId_tipoPagamento(0L); + dp.setFlgTipoMovimento(1L); + dp.setData(getDataDocumento()); + if (getClifor().getFlgSplitPayment() == 0L) { + dp.setImporto(getTotaleDocumento()); + } else { + dp.setImporto(getImponibileTotale()); + } + dp.setNota("Emissione fattura."); + logDebug(debug, "Documento.save: documento pagamento"); + dp.save(); + if (rp.getStatus()) { + TipoPagamento tipoPagamento = new TipoPagamento(getApFull()); + Vectumerator vec = tipoPagamento.getScadenzeDocumento(getId_documento()); + while (vec.hasMoreElements()) { + ds = (DocumentoScadenza)vec.nextElement(); + logDebug(debug, "Documento.save:save documento scadenza"); + rp = ds.save(); + } + } + } else { + DocumentoPagamento dp = new DocumentoPagamento(getApFull()); + dp.findRecordDocumentoByDocumento(getId_documento()); + dp.delete(); + } + } else { + DocumentoScadenza ds = new DocumentoScadenza(getApFull()); + rp = ds.deleteByDocumento(getId_documento()); + DocumentoPagamento dp = new DocumentoPagamento(getApFull()); + dp.findRecordDocumentoByDocumento(getId_documento()); + dp.delete(); + } + if (statoPrelevatoPrecedente != getFlgDocumentoPrelevato()) + if (getFlgDocumentoPrelevato() == 0L) { + Vectumerator vec = new RigaDocumento(getApFull()) + .findRigheNonPrelevatePreChiusuraByDocumento(getId_documento()); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + row.setFlgRigaPrelevata(0L); + row.superSave(); + } + } else if (getFlgDocumentoPrelevato() == 1L) { + Vectumerator vec = new RigaDocumento(getApFull()) + .findRigheNonPrelevateByDocumento(getId_documento()); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + row.settaRigaPrelevata(); + } + } + if (getFlgPagata() == 1L) { + impostaPagato(getDataPagamento()); + if (hasDocumentiPadre()) { + Vectumerator vecPadri = findDocumentiPadre(); + while (vecPadri.hasMoreElements()) { + Documento row = (Documento)vecPadri.nextElement(); + row.setFlgPagata(1L); + row.impostaPagato(getDataPagamento()); + } + } + } else { + impostaNonPagato(); + } + } + } catch (Exception e) { + rp.setMsg(e.getMessage()); + } + } + return rp; + } + + public double getDeliveryCostOrdine(Clifor clifor) { + double delivCost = 0.0D, moreCost = 0.0D, warnCost = 0.0D; + if (clifor != null && clifor.getDBState() == 1) { + DestinazioneDiversa dd = clifor.getCurrentDD(); + if (!dd.getId_nazioneDD().isEmpty()) { + delivCost = dd.getNazioneDD().getCostoSpedizione(); + } else { + delivCost = clifor.getNazione().getCostoSpedizione(); + } + if (delivCost == 0.0D) + delivCost = getParm(Cart.P_DELIVERY_COST).getNumeroDouble(); + } else { + delivCost = getParm(Cart.P_DELIVERY_COST).getNumeroDouble(); + } + long l_flgTipoPagamento = getId_tipoPagamento(); + if (getTipoPagamento().getFlgAbilitatoNegozio() == 1L) { + delivCost = 0.0D; + } else { + if (getTipoPagamento().getFlgAbilitatoCorriere() == 1L) { + moreCost = getParm(Cart.P_MORE_COST).getNumeroDouble(); + } else { + moreCost = 0.0D; + } + if (getFlgAvvisoConsegna() == 1L) { + warnCost = getParm(Cart.P_DELIVERY_WARN_COST).getNumeroDouble(); + } else { + warnCost = 0.0D; + } + } + DoubleOperator dop = new DoubleOperator(delivCost); + dop.add(moreCost); + dop.add(warnCost); + return dop.getResult(); + } + + private void creaDocumentoCorpoFt(Document l_document, Table l_pdfCorpo, long tipoCorpoFattura) { + int righePerPagina = (int)getTipoDocumento().getRighePerPagina(); + if (righePerPagina <= 0) + righePerPagina = 10; + int maxCarDesc = (int)getTipoDocumento().getMaxCarDesc(); + if (maxCarDesc == 0) + maxCarDesc = 35; + int riga = 0; + int cellLeadingRow = getDocLeadRow(); + if (cellLeadingRow == 0) + cellLeadingRow = 12; + Font PDF_frow = getTipoDocumento().getPdfFontRow(); + Font PDF_frowSmall = getTipoDocumento().getPdfFontRowSmall(); + NumberFormat nf = getNf(); + int ordineInverso = (getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + Vectumerator vec = findRigheDocumento(0, 0, ordineInverso); + int colSpanDescrizione = cols_FT_STD_[0]; + if (tipoCorpoFattura == 1L || tipoCorpoFattura == 2L) + colSpanDescrizione = cols_FT_STD_[0] + cols_FT_STD_[1] + cols_FT_STD_[2] + cols_FT_STD_[3]; + try { + long resHasUsato = hasRigheConUsato(); + String s_note = getNote(); + if (resHasUsato == 1L || resHasUsato == 2L || resHasUsato == 5L || resHasUsato == 6L) { + Iva ivaRM = new Iva(getApFull()); + ivaRM.findByPrimaryKey(getCodiceIvaRegimeMargine()); + s_note = s_note + "\n" + s_note; + } + ArrayList alNote = RigaDocumentoItemPdf.getArrayListNota(s_note, 0, cols_FT_STD_, PDF_frow); + if (getDocPosizioneNota() == 0L) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + while (vec.hasMoreElements()) { + String desc, descQta; + double imponibile, importo; + String scontoS; + RigaDocumento row = (RigaDocumento)vec.nextElement(); + double quantita = row.getQuantita(); + if (row.getSconto() > 0.0D) { + scontoS = nf.format(row.getSconto()); + } else { + scontoS = ""; + } + if (!row.getIva().getFlgTipo().equals("R")) { + desc = row.getDescrizioneRiga(); + if (!row.getSeriale().isEmpty()) { + String temp = row.getSeriale().replace("\n", ""); + temp = temp.replace("\r", ""); + desc = desc + "\nS/N " + desc; + } + if (row.getArticolo().isSuperGaranzia()) + desc = desc + " - Supergaranzia"; + imponibile = row.getImponibile(); + importo = row.getTotImponibileRigaConSconto(); + } else { + desc = row.getDescrizioneRiga(); + if (row.getArticolo().isSuperGaranzia()) + desc = desc + " - Supergaranzia"; + imponibile = row.getImponibile(); + importo = row.getTotImponibileRigaConSconto(); + } + if (row.getSeriale().isEmpty() && !row.getArticolo().getNMatricola().isEmpty()) + desc = desc + " Mat. N. " + desc; + if (!row.getNotaBarcode().isEmpty()) + desc = desc + " - " + desc; + String codIva = row.getIva().getDescrizioneRigaStampaAuto(); + if (!row.getNotaRigaDocumento().isEmpty()) + desc = desc + " " + desc; + if (row.getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() != 1L) { + if (isQuantitaMagazzinoIntere()) { + descQta = row.getUdm() + " " + row.getUdm(); + } else { + descQta = row.getUdm() + " " + row.getUdm(); + } + } else if (isQuantitaMagazzinoIntere()) { + descQta = getNf0().format(quantita); + } else { + descQta = nf.format(quantita); + } + ArrayList dati = new ArrayList<>(); + dati.add(new RigaDocumentoItemPdf(colSpanDescrizione, desc, PDF_frow)); + if (tipoCorpoFattura == 0L) { + dati.add(new RigaDocumentoItemPdf(cols_FT_STD_[1], descQta, PDF_frow, 2)); + dati.add(new RigaDocumentoItemPdf(cols_FT_STD_[2], nf.format(imponibile), PDF_frow, 2)); + dati.add(new RigaDocumentoItemPdf(cols_FT_STD_[3], scontoS, PDF_frow, 2)); + } + if (tipoCorpoFattura == 0L || tipoCorpoFattura == 1L) { + dati.add(new RigaDocumentoItemPdf(cols_FT_STD_[4], nf.format(importo), PDF_frow, 2)); + if (codIva.length() >= 10) { + dati.add(new RigaDocumentoItemPdf(6, codIva, PDF_frowSmall, 2)); + } else { + dati.add(new RigaDocumentoItemPdf(6, codIva, PDF_frow, 2)); + } + } else if (tipoCorpoFattura == 2L) { + dati.add(new RigaDocumentoItemPdf(10, "€ " + nf.format(importo), PDF_frow, 2)); + } + riga = inserisciRigaDocumento(dati, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + } + if (getDocPosizioneNota() == 1L && !s_note.isEmpty()) + riga = inserisciRigaDocumento(alNote, 0, riga, l_document, l_pdfCorpo, cellLeadingRow, vec.hasMoreElements()); + if (righePerPagina - riga > 0) + riga = inserisciRigheVuote(righePerPagina - riga, cols_FT_STD_, riga, l_document, l_pdfCorpo, cellLeadingRow); + } catch (Exception e) { + handleDebug(e); + } + } + + public ResParm sendSpeditoMailMessageOld(String lang) { + ResParm rp = new ResParm(true); + try { + NumberFormat nf = getNf(); + if (getDataSpedizione() == null) { + setDataSpedizione(getToday()); + save(); + } + String mmFile = getCheckOutMailMessage(lang); + mmFile = mmFile.replace(".html", "_spedito.html"); + MailMessage mf = new MailMessage(getApFull(), mmFile); + mf.setQuestionMark(false); + String descOrdine = "Ordine "; + if (getDocumentoPadreUno().getId_ordine() > 0L) { + descOrdine = "Ordine n. " + getDocumentoPadreUno().getId_documento() + " del " + getDataFormat().format(getDocumentoPadreUno().getDataDocumento()); + mf.setString("descOrdine", descOrdine); + mf.setString("codiceOrdine", String.valueOf(getDocumentoPadreUno().getId_ordine())); + } + mf.setString("nomeCliente", getClifor().getCognomeNome()); + mf.setString("dataSpedizione", getDataFormat().format(getDataSpedizione())); + mf.setString("corriere", getVettore().getDescrizione()); + mf.setString("nColli", String.valueOf(getNColli())); + mf.setString("nome", getClifor().getNome()); + mf.setString("cognome", getClifor().getCognome()); + mf.setString("indirizzo", getClifor().getIndirizzo()); + mf.setString("numero", getClifor().getNumeroCivico()); + String capComune = getClifor().getCapComune(); + if (!getClifor().getCapZona().isEmpty()) + capComune = getClifor().getCapZona(); + mf.setString("cap", capComune); + mf.setString("citta", getClifor().getDescrizioneComune()); + mf.setString("provincia", getClifor().getProvinciaComune()); + mf.setString("codfisc", getClifor().getCodFisc()); + mf.setString("piva", getClifor().getPIva()); + mf.setString("email", getClifor().getEMail()); + mf.setString("telefono", getClifor().getTelefono()); + if (getIndirizzoSped().trim().isEmpty()) { + if (getPresso().isEmpty()) { + mf.setString("indirizzoSped", getClifor().getIndirizzo()); + } else { + mf.setString("indirizzoSped", getClifor().getIndirizzo() + " c/o " + getClifor().getIndirizzo()); + } + mf.setString("numeroSped", getClifor().getNumeroCivico()); + mf.setString("capSped", capComune); + mf.setString("cittaSped", getClifor().getDescrizioneComune()); + mf.setString("provinciaSped", getClifor().getProvinciaComune()); + } else { + if (getPresso().isEmpty()) { + mf.setString("indirizzoSped", getIndirizzoSped()); + } else { + mf.setString("indirizzoSped", getIndirizzoSped() + " c/o " + getIndirizzoSped()); + } + mf.setString("numeroSped", getNumeroCivicoSped()); + mf.setString("capSped", getCapSped()); + mf.setString("cittaSped", getCittaSped()); + mf.setString("provinciaSped", getProvinciaSped()); + } + String temp = ""; + if (getId_tipoPagamento() == 1L) + temp = "La informiamo che alla consegna, il corriere richiedera' l'importo di " + nf.format(getTotaleDocumento()) + " euro del contrassegno"; + if (!getNotaSpedizione().isEmpty()) + temp = temp + "

" + temp; + mf.setString("nota", temp); + if (!getVettore().getLinkTracking().isEmpty()) { + String track = "Potra' verificare la spedizione da domani mattina al seguente link "; + mf.setString("tracking", track); + } + rp = mf.sendMailMessageSystem(getClifor().getEMail(), "Tuttofoto - Spedizione " + descOrdine, true); + if (rp.getStatus()) { + setDataInvioMailSped(getToday()); + save(); + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e); + } + return rp; + } + + public static synchronized ResParm saveSynchro(Documento bean) { + boolean debug = false; + ResParm rp = new ResParm(); + if (bean.getFlgStato() == 0L && bean.getFlgDocumentoPrelevato() == 1L) { + rp.setStatus(false); + rp.setMsg("ERRORE! Impossibile salvare una bozza con stato prelevamento chiuso!"); + return rp; + } + rp = bean.calcoloStatoLavorazione(); + if (!rp.getStatus()) + return rp; + boolean salvaAgenti = false; + long statoPrecedente = bean.getFlgStatoPrecedente(); + long statoOrdineWwwPrecedente = bean.getFlgStatoOrdineWwwPrecedente(); + long statoPrelevatoPrecedente = bean.getFlgDocumentoPrelevatoPrecedente(); + long statoPrenotazionePrecedente = bean.getFlgStatoPrenotazionePrecedene(); + long statoLavorazionePrecedente = bean.getFlgStatoLavorazionePrecedente(); + long l_id_cliforPrecedente = bean.getId_cliforPrecedente(); + String currentPdfFile = bean.getPathStampaDocumentoFull(); + File pdfFile = new File(currentPdfFile); + if (pdfFile.exists()) + pdfFile.delete(); + bean.setTmstFilePdf(null); + try { + rp = bean.checkEMSTA(); + if (!rp.getStatus()) { + Documento documento = (Documento)bean.clone(); + bean.findByPrimaryKey(documento.getId_documento()); + bean.setNote(documento.getNote()); + bean.setNotaAggiuntiva(documento.getNotaAggiuntiva()); + bean.setNotaMail(documento.getNotaMail()); + bean.setFlgPagata(documento.getFlgPagata()); + if (bean.getFlgPagata() == 1L) { + if (documento.getDataPagamento() == null) { + bean.setDataPagamento(getToday()); + } else { + bean.setDataPagamento(documento.getDataPagamento()); + } + } else { + bean.setDataPagamento(null); + } + bean.setDataInvioMailSped(documento.getDataInvioMailSped()); + bean.setFlgDocumentoPrelevato(documento.getFlgDocumentoPrelevato()); + bean.setDataSpedizione(documento.getDataSpedizione()); + logDebug(debug, "Documento.save:save note"); + String infoMsg = rp.getMsg(); + rp = bean.superSave(); + if (rp.getStatus()) { + rp.setStatus(true); + rp.setInfoMsg(infoMsg); + } + return rp; + } + if (rp.getStatus() && + bean.hasScadenzeSuRiba()) { + rp.setStatus(false); + rp.setMsg("ERRORE! Esistono delle distinte riba già legate alle scadenze"); + return rp; + } + if (bean.getFlgStato() != statoPrecedente && new DocumentoPagamento( + bean.getApFull()).hasPagamentiEffettuatiByDocumento(bean.getId_documento())) + return new ResParm(false, "ERRORE! Non posso cambiare stato documento in " + + bean.getStato() + ": sono stati inseriti dei pagamenti."); + if (bean.getDBState() == 0) + salvaAgenti = true; + Documento doc = new Documento(bean.getApFull()); + doc.findByPrimaryKey(bean.getId_documento()); + if (doc.getId_clifor() != bean.getId_clifor()) + salvaAgenti = true; + if (bean.getTipoDocumento().getFlgTipologia() == 4L) { + if (bean.getId_documentoXpay() == null || bean.getId_documentoXpay().isEmpty()) + bean.setId_documentoXpay(bean.getNuovoProgressivoDocumentoXpay()); + } else { + bean.setId_documentoXpay(null); + } + if (bean.getDBState() == 1) + if (bean.getTipoDocumento().getFlgCorrispettivi() == 0L) { + RigaDocumento rf = new RigaDocumento(bean.getApFull()); + RigheRegistroIva rri = bean.getRigaRegistroIva(); + bean.setImponibileRighe(rri.getTotImponibile()); + bean.setImportoIvaRighe(rri.getTotIva()); + rri = bean.getRigaRegistroIvaCompleto(); + bean.setImponibileTotale(rri.getTotImponibile()); + bean.setImportoIvaTotale(rri.getTotIva()); + bean.setImportoRMRighe(rf.getTotImportoRMRighe(bean.getId_documento())); + } else { + double importoTotale = bean.getImportoTotaleRigheCorrispettivi(); + bean.setImportoTotale(importoTotale); + } + if (bean.hasDocumentiPadre()) { + bean.setFlgHaDocumentoPadre(1L); + } else { + bean.setFlgHaDocumentoPadre(0L); + } + if (bean.hasDocumentiFiglio()) { + bean.setFlgEmettiFatturaScontrino(1L); + } else { + bean.setFlgEmettiFatturaScontrino(0L); + } + if (bean.isFatturaONotaDiCredito() && l_id_cliforPrecedente != 0L && l_id_cliforPrecedente != bean.getId_clifor()) + if (bean.getId_documento() > 0L) + new DocumentoAgente(bean.getApFull()).deleteAgentiByDocumento(bean.getId_documento()); + if (bean.isFatturaONotaDiCredito() && l_id_cliforPrecedente != bean.getId_clifor()) { + if (bean.getClifor().getId_agente() > 0L) { + DocumentoAgente da = new DocumentoAgente(bean.getApFull()); + da.setId_documento(bean.getId_documento()); + da.setId_cliforDA(bean.getClifor().getId_agente()); + da.setPercDocumentoAgente(bean.getClifor().getPercAgente()); + logDebug(debug, "Documento.save:save documento agente1"); + da.save(); + } + if (bean.getClifor().getId_respCommerciale() > 0L) { + DocumentoAgente da = new DocumentoAgente(bean.getApFull()); + da.setId_documento(bean.getId_documento()); + da.setId_cliforDA(bean.getClifor().getId_respCommerciale()); + da.setPercDocumentoAgente(bean.getClifor().getPercRespCommerciale()); + logDebug(debug, "Documento.save:save documento agente2"); + da.save(); + } + } + if (bean.getId_destinazioneDiversa() > 0L && bean.getIndirizzoSped().isEmpty()) { + bean.setPresso(bean.getDestinazioneDiversa().getPressoDD()); + bean.setIndirizzoSped(bean.getDestinazioneDiversa().getIndirizzoDD()); + bean.setNumeroCivicoSped(bean.getDestinazioneDiversa().getNumeroCivicoDD()); + bean.setCittaSped(bean.getDestinazioneDiversa().getDescrizioneComuneDD()); + bean.setProvinciaSped(bean.getDestinazioneDiversa().getProvinciaComuneDD()); + if (bean.getDestinazioneDiversa().getCapZonaDD().isEmpty()) { + bean.setCapSped(bean.getDestinazioneDiversa().getCapComuneDD()); + } else { + bean.setCapSped(bean.getDestinazioneDiversa().getCapZonaDD()); + } + bean.setId_nazioneSped(bean.getDestinazioneDiversa().getId_nazioneDD()); + } + rp = bean.superSave(); + if (rp.getStatus()) { + if (bean.getParm("USA_MAGAZZINO").isTrue()) + if ((statoPrecedente != 0L && bean.getFlgStato() == 0L && + bean.getFlgStatoOrdineWww() != 99L) || (statoPrecedente == 0L && + bean.getFlgStato() != 0L && + bean.getFlgStatoOrdineWww() != 99L) || (statoOrdineWwwPrecedente != 99L && + + bean.getFlgStatoOrdineWww() == 99L && statoPrecedente != 0L) || (statoOrdineWwwPrecedente == 99L && + + bean.getFlgStatoOrdineWww() != 99L && statoPrecedente != 0L)) { + boolean isTipoMovimentoInverso = false; + if (bean.getFlgStato() == 0L || bean.getFlgStatoOrdineWww() == 99L) + isTipoMovimentoInverso = true; + boolean isStatoOrdineWwwAnnullato = (bean.getFlgStatoOrdineWww() == 99L); + aggiornaRigheDocumentoMagArticolo(bean, isTipoMovimentoInverso); + } + if (bean.getId_tipoDocumento() == bean.getId_docPrenotazione() && + statoPrenotazionePrecedente != bean.getFlgStatoPrenotazione()) + bean.checkStatoPrenotazioneByDocumento(); + if (bean.isFatturaONotaDiCredito()) { + DocumentoScadenza ds = new DocumentoScadenza(bean.getApFull()); + rp = ds.deleteByDocumento(bean.getId_documento()); + if (bean.getFlgStato() == 1L) { + DocumentoPagamento dp = new DocumentoPagamento(bean.getApFull()); + dp.findRecordDocumentoByDocumento(bean.getId_documento()); + dp.delete(); + dp.setId_documento(bean.getId_documento()); + dp.setId_tipoPagamento(0L); + dp.setFlgTipoMovimento(1L); + dp.setData(bean.getDataDocumento()); + if (bean.getClifor().getFlgSplitPayment() == 0L) { + dp.setImporto(bean.getTotaleDocumento()); + } else { + dp.setImporto(bean.getImponibileTotale()); + } + dp.setNota("Emissione fattura."); + logDebug(debug, "Documento.save: documento pagamento"); + dp.save(); + if (rp.getStatus()) { + TipoPagamento tipoPagamento = new TipoPagamento(bean.getApFull()); + Vectumerator vec = tipoPagamento.getScadenzeDocumento(bean.getId_documento()); + while (vec.hasMoreElements()) { + ds = (DocumentoScadenza)vec.nextElement(); + logDebug(debug, "Documento.save:save documento scadenza"); + rp = ds.save(); + } + } + } else { + DocumentoPagamento dp = new DocumentoPagamento(bean.getApFull()); + dp.findRecordDocumentoByDocumento(bean.getId_documento()); + dp.delete(); + } + } else { + DocumentoScadenza ds = new DocumentoScadenza(bean.getApFull()); + rp = ds.deleteByDocumento(bean.getId_documento()); + DocumentoPagamento dp = new DocumentoPagamento(bean.getApFull()); + dp.findRecordDocumentoByDocumento(bean.getId_documento()); + dp.delete(); + } + if (statoPrelevatoPrecedente != bean.getFlgDocumentoPrelevato()) + if (bean.getFlgDocumentoPrelevato() == 0L) { + Vectumerator vec = new RigaDocumento(bean.getApFull()) + .findRigheNonPrelevatePreChiusuraByDocumento(bean.getId_documento()); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + row.setFlgRigaPrelevata(0L); + row.superSave(); + } + } else if (bean.getFlgDocumentoPrelevato() == 1L) { + Vectumerator vec = new RigaDocumento(bean.getApFull()) + .findRigheNonPrelevateByDocumento(bean.getId_documento()); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + row.settaRigaPrelevata(); + } + } + if (bean.getFlgPagata() == 1L) { + bean.impostaPagato(bean.getDataPagamento()); + if (bean.hasDocumentiPadre()) { + Vectumerator vecPadri = bean.findDocumentiPadre(); + while (vecPadri.hasMoreElements()) { + Documento row = (Documento)vecPadri.nextElement(); + row.setFlgPagata(1L); + row.impostaPagato(bean.getDataPagamento()); + } + } + } else { + bean.impostaNonPagato(); + } + if (bean.getTipoDocumento().getTipologiaDocumento().getCodice() == 200L) { + Vectumerator vecLp = new LavPezza(bean.getApFull()).findByDocumento(bean.getId_documento()); + while (vecLp.hasMoreElements()) { + LavPezza row = (LavPezza)vecLp.nextElement(); + if (row.getId_clifor() != bean.getId_clifor()) { + row.setId_clifor(bean.getId_clifor()); + row.superSave(); + } + } + } + if (bean.getTipoDocumento().getFlgTipologia() == 201L) + if (bean.getFlgStatoLavorazione() != statoLavorazionePrecedente) { + Vectumerator vecRT = bean.findRigheDocumento(0L, 0, 0, 0); + while (vecRT.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vecRT.nextElement(); + rp.append(RigaDocumento.aggiornaDispoTessuto(bean.getApFull(), + row.getArticoloTessutoColore().getId_articoloTessuto(), row.getId_articoloTessutoColore(), + row.getLastUpdId_user())); + } + } + } + } catch (Exception e) { + rp.setMsg(e.getMessage()); + } + return rp; + } + + public double getMtTotaliInviate() { + if (getId_documento() == 0L || getTipoDocumento().getFlgTipologia() != 200L) + return 0.0D; + return new LavPezza(getApFull()).getTotMetriByDocumentoDTESS(getId_documento(), true); + } + + public double getPrezzo1000Colpi() { + return this.prezzo1000Colpi; + } + + public void setPrezzo1000Colpi(double prezzo1000Colpi) { + this.prezzo1000Colpi = prezzo1000Colpi; + } + + public double getPrezzoAnnodatura() { + return this.prezzoAnnodatura; + } + + public void setPrezzoAnnodatura(double prezzoAnnodatura) { + this.prezzoAnnodatura = prezzoAnnodatura; + } + + private ResParm creaDocumentoFiglioDaDisposizioniTessitura(long l_id_clifor, long l_id_tipoDocumentoFiglio, Users operatore, boolean creaBozza, long l_flgTipoCreazioneRiga) { + return creaDocumentoFiglioDaDisposizioniTessitura(l_id_clifor, l_id_tipoDocumentoFiglio, operatore, creaBozza, l_flgTipoCreazioneRiga, null); + } + + private ResParm creaDocumentoFiglioDaDisposizioniTessituraBasataSuDisposizioneOLD(long l_id_clifor, long l_id_tipoDocumentoFiglio, Users operatore, boolean creaBozza, long l_flgTipoCreazioneRiga) { + String SPACE = " "; + if (l_id_clifor == 0L) + l_id_clifor = getId_clifor(); + if (getTipoDocumento().getFlgObbligoPrelievo() == 1L) + return new ResParm(false, "ERRORE! Figlio non generabile. Documento con obbligo di prelievo"); + long righeCreate = 0L; + ResParm rp = new ResParm(); + ResParm rpRow = new ResParm(); + if (getDBState() == 1) { + TipoDocumento tdGen = new TipoDocumento(getApFull()); + tdGen.findByPrimaryKey(l_id_tipoDocumentoFiglio); + LavPezza lavPezza = new LavPezza(getApFull()); + if (!isDocumentoFiglioCreabile()) { + rp.setStatus(false); + rp.setMsg("Errore! Documento figlio non creabile..."); + } else if (!getTipoDocumento().isTipoDocGenerabile(l_id_tipoDocumentoFiglio)) { + rp.setStatus(false); + rp.setMsg("Errore! Il tipo di documento " + tdGen.getDescrizioneCompleta() + " non è generabile!"); + } else { + TipoDocumento tdf = new TipoDocumento(getApFull()); + tdf.findByPrimaryKey(l_id_tipoDocumentoFiglio); + Documento doc = new Documento(getApFull()); + if (creaBozza) + doc.findDocumentoBozza(l_id_tipoDocumentoFiglio, l_id_clifor); + if (doc.getDBState() == 0) { + doc.setId_tipoDocumento(l_id_tipoDocumentoFiglio); + doc.setId_clifor(l_id_clifor); + Clifor clienteDoc = doc.getClifor(); + if (operatore != null) + doc.setId_users(getId_users()); + doc.setNominativoDocumento(getNominativoDocumento()); + if (clienteDoc.getId_tipoPagamento() != 0L) { + doc.setId_tipoPagamento(clienteDoc.getId_tipoPagamento()); + } else { + doc.setId_tipoPagamento(getId_tipoPagamento()); + } + doc.setDataDocumento(getToday()); + } + if (creaBozza) + doc.setFlgStato(0L); + double accontiDiff = 0.0D; + double importiRighe = 0.0D; + double totAcconti = getTotAccontiByDocumentoPadre(getId_documento()); + if (getAcconto() > totAcconti) + accontiDiff = getAcconto() - totAcconti; + doc.setNote(getNote()); + doc.setDataScadenzaPagamento(getDataScadenzaPagamento()); + doc.setFlgPagamentoDataFissa(getFlgPagamentoDataFissa()); + doc.setIban(getIban()); + doc.setId_destinazioneDiversa(getId_destinazioneDiversa()); + doc.setPresso(getPresso()); + doc.setIndirizzoSped(getIndirizzoSped()); + doc.setNumeroCivicoSped(getNumeroCivicoSped()); + doc.setCittaSped(getCittaSped()); + doc.setProvinciaSped(getProvinciaSped()); + doc.setCapSped(getCapSped()); + doc.setId_nazioneSped(getId_nazioneSped()); + doc.setNColli(getNColli()); + doc.setKgLordo(getKgLordo()); + doc.setKgNetto(getKgNetto()); + doc.setVolume(getVolume()); + doc.setId_causaleTrasporto(getId_causaleTrasporto()); + doc.setId_vettore(getId_vettore()); + doc.setFlgTrasporto(getFlgTrasporto()); + doc.setId_aspetto(getId_aspetto()); + doc.setId_porto(getId_porto()); + doc.setNotePagamento(getNotePagamento()); + doc.setNotaSpedizione(getNotaSpedizione()); + doc.setNote(getNote()); + doc.setNotaAggiuntiva(getNotaAggiuntiva()); + doc.setNotaMail(getNotaMail()); + doc.setRiferimento(getRiferimento()); + doc.setDataRiferimento(getDataRiferimento()); + DoubleOperator totCosti = new DoubleOperator(); + long speseStd = 0L; + speseStd = 0L; + if (speseStd == 0L) { + doc.setSpeseTrasporto(getSpeseTrasporto()); + doc.setSpeseIncasso(getSpeseIncasso()); + doc.setSpeseAltre(getSpeseAltre()); + doc.setDescSpeseAltre(getDescSpeseAltre()); + doc.setId_ivaDoc(getId_ivaDoc()); + doc.setScontoIncondizionato(getScontoIncondizionato()); + doc.setAbbuono(getAbbuono()); + } + if (speseStd == 1L) { + totCosti.add(getSpeseAltreConIva()); + totCosti.add(getSpeseIncassoConIva()); + totCosti.add(getSpeseTrasportoConIva()); + } + if (speseStd == 2L); + rp = doc.save(); + if (rp.getStatus()) + if (l_flgTipoCreazioneRiga == 0L) { + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements() && rp.getStatus()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getFlgRigaPrelevata() == 0L) { + righeCreate++; + RigaDocumento rDoc = new RigaDocumento(getApFull()); + rDoc.setId_documento(doc.getId_documento()); + rDoc.setId_iva(getCodiceIvaVendStd()); + rDoc.setId_magFisico(row.getId_magFisico()); + rDoc.setSeriale(row.getSeriale()); + if (getPrezzo1000Colpi() > 0.0D) { + StringBuilder sb = new StringBuilder(getRiferimento()); + sb.append(" "); + sb.append(row.getDescrizioneRiga()); + sb.append(" "); + sb.append("Disp. "); + sb.append(getNumeroDocumentoCompleto()); + sb.append(" Pz. "); + sb.append(lavPezza.getTotPezzeByDocumentoDTESS(getId_documento())); + sb.append(" Mt. "); + sb.append(getNf().format(lavPezza.getTotMetriByDocumentoDTESS(getId_documento(), false))); + sb.append(" Prezzo. "); + sb.append(getNf().format(getPrezzo1000Colpi())); + sb.append(" Rif. "); + Vectumerator vecLavPezza = lavPezza.findByDocumento(getId_documento()); + HashMap hmBolle = new HashMap<>(); + while (vecLavPezza.hasMoreElements()) { + LavPezza rowLP = (LavPezza)vecLavPezza.nextElement(); + if (!hmBolle.containsKey(Long.valueOf(rowLP.getRigaDocumentoBolla().getId_documento()))) + hmBolle.put(Long.valueOf(rowLP.getRigaDocumentoBolla().getId_documento()), + rowLP.getRigaDocumentoBolla().getDocumento()); + } + for (Map.Entry me : hmBolle.entrySet()) { + sb.append(me.getValue().getNumeroDocumento()); + sb.append(" "); + } + rDoc.setDescrizioneRiga(sb.toString()); + rDoc.setNr((double)(row.getTotColpiRiga() / 1000L)); + rDoc.setImponibile(getPrezzo1000Colpi()); + importiRighe += row.getTotImportoRigaConSconto(); + rDoc.setId_documentoPadre(row.getId_documento()); + rDoc.setId_rigaDocumentoPadre(row.getId_rigaDocumento()); + rpRow = addRigaDocumento(doc, rDoc); + if (rpRow.getStatus()) { + rp.append(rpRow); + row.setFlgRigaPrelevata(1L); + rp.append(row.superSave()); + } + } + } + } + if (getPrezzoAnnodatura() > 0.0D) { + righeCreate++; + RigaDocumento rDoc = new RigaDocumento(getApFull()); + rDoc.setId_documento(doc.getId_documento()); + rDoc.setId_documentoPadre(getId_documento()); + rDoc.setDescrizioneRiga("Annodatura"); + rDoc.setNr(1.0D); + rDoc.setImponibile(getPrezzoAnnodatura()); + rpRow = addRigaDocumento(doc, rDoc); + if (rpRow.getStatus()) + rp.append(rpRow); + } + } else if (l_flgTipoCreazioneRiga != 1L) { + if (l_flgTipoCreazioneRiga == 2L); + } + rp = doc.save(); + if (rp.getStatus()) { + if (righeCreate == 0L) { + rp = new ResParm(false); + rp.setMsg("ERRORE! Nessun rigo prelevabile!"); + doc.delete(); + } else if (accontiDiff > 0.0D) { + if (findTotRigheDocumentoDaPrelevare() == 0L) { + doc.setAcconto(accontiDiff); + } else if (importiRighe < accontiDiff) { + doc.setAcconto(importiRighe); + } else { + doc.setAcconto(accontiDiff); + } + doc.save(); + } + if (operatore != null) { + setId_users(operatore.getId_users()); + StringBuffer sb = new StringBuffer(); + sb.append(getLogRecord()); + if (!getLogRecord().equals("")) + sb.append("
"); + sb.append("Creato Documento figlio "); + sb.append(tdGen.getDescrizione()); + sb.append(" da "); + sb.append(operatore.getCognomeNome()); + sb.append(" il "); + sb.append(getTimestampFormat().format(getTimestamp())); + setLogRecord(sb.toString()); + save(); + } + if (findTotRigheDocumentoDaPrelevare() == 0L) { + setFlgStato(1L); + setFlgDocumentoPrelevato(1L); + setFlgStatoPrenotazione(90L); + super.save(); + } + } + } + } + findByPrimaryKey(getId_documento()); + return rp; + } + + public ResParm creaDocumentoFiglioDaDisposizioniTessitura(long l_id_clifor, long l_id_tipoDocumentoFiglio, Users operatore, boolean creaBozza, long l_flgTipoCreazioneRiga, HashMap hsDdtDaFatturare) { + if (l_id_clifor == 0L) + l_id_clifor = getId_clifor(); + String TAG_THREAD_MSG = "CREAZIONE FT TESSITURA"; + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, getClifor().getCognomeNome() + " " + getClifor().getCognomeNome()); + if (getTipoDocumento().getFlgObbligoPrelievo() == 1L) + return new ResParm(false, "ERRORE! Figlio non generabile. Documento con obbligo di prelievo"); + long righeCreate = 0L; + ResParm rp = new ResParm(); + ResParm rpRow = new ResParm(); + if (getDBState() == 1) { + TipoDocumento tdGen = new TipoDocumento(getApFull()); + tdGen.findByPrimaryKey(l_id_tipoDocumentoFiglio); + LavPezza lavPezza = new LavPezza(getApFull()); + if (!isDocumentoFiglioCreabile()) { + rp.setStatus(false); + rp.setMsg("Errore! Documento figlio non creabile..."); + } else if (!getTipoDocumento().isTipoDocGenerabile(l_id_tipoDocumentoFiglio)) { + rp.setStatus(false); + rp.setMsg("Errore! Il tipo di documento " + tdGen.getDescrizioneCompleta() + " non è generabile!"); + } else { + TipoDocumento tdf = new TipoDocumento(getApFull()); + tdf.findByPrimaryKey(l_id_tipoDocumentoFiglio); + Documento doc = new Documento(getApFull()); + if (creaBozza) + doc.findDocumentoBozza(l_id_tipoDocumentoFiglio, l_id_clifor); + if (doc.getDBState() == 0) { + doc.setId_tipoDocumento(l_id_tipoDocumentoFiglio); + doc.setId_clifor(l_id_clifor); + Clifor clienteDoc = doc.getClifor(); + if (operatore != null) + doc.setId_users(getId_users()); + doc.setNominativoDocumento(getNominativoDocumento()); + if (clienteDoc.getId_tipoPagamento() != 0L) { + doc.setId_tipoPagamento(clienteDoc.getId_tipoPagamento()); + } else { + doc.setId_tipoPagamento(getId_tipoPagamento()); + } + doc.setDataDocumento(getToday()); + } + if (creaBozza) + doc.setFlgStato(0L); + double accontiDiff = 0.0D; + double importiRighe = 0.0D; + double totAcconti = getTotAccontiByDocumentoPadre(getId_documento()); + if (getAcconto() > totAcconti) + accontiDiff = getAcconto() - totAcconti; + doc.setNote(getNote()); + doc.setDataScadenzaPagamento(getDataScadenzaPagamento()); + doc.setFlgPagamentoDataFissa(getFlgPagamentoDataFissa()); + doc.setIban(getIban()); + doc.setId_destinazioneDiversa(getId_destinazioneDiversa()); + doc.setPresso(getPresso()); + doc.setIndirizzoSped(getIndirizzoSped()); + doc.setNumeroCivicoSped(getNumeroCivicoSped()); + doc.setCittaSped(getCittaSped()); + doc.setProvinciaSped(getProvinciaSped()); + doc.setCapSped(getCapSped()); + doc.setId_nazioneSped(getId_nazioneSped()); + doc.setNColli(getNColli()); + doc.setKgLordo(getKgLordo()); + doc.setKgNetto(getKgNetto()); + doc.setVolume(getVolume()); + doc.setId_causaleTrasporto(getId_causaleTrasporto()); + doc.setId_vettore(getId_vettore()); + doc.setFlgTrasporto(getFlgTrasporto()); + doc.setId_aspetto(getId_aspetto()); + doc.setId_porto(getId_porto()); + doc.setNotePagamento(getNotePagamento()); + doc.setNotaSpedizione(getNotaSpedizione()); + doc.setNote(getNote()); + doc.setNotaAggiuntiva(getNotaAggiuntiva()); + doc.setNotaMail(getNotaMail()); + doc.setRiferimento(getRiferimento()); + doc.setDataRiferimento(getDataRiferimento()); + DoubleOperator totCosti = new DoubleOperator(); + long speseStd = 0L; + speseStd = 0L; + if (speseStd == 0L) { + doc.setSpeseTrasporto(getSpeseTrasporto()); + doc.setSpeseIncasso(getSpeseIncasso()); + doc.setSpeseAltre(getSpeseAltre()); + doc.setDescSpeseAltre(getDescSpeseAltre()); + doc.setId_ivaDoc(getId_ivaDoc()); + doc.setScontoIncondizionato(getScontoIncondizionato()); + doc.setAbbuono(getAbbuono()); + } + if (speseStd == 1L) { + totCosti.add(getSpeseAltreConIva()); + totCosti.add(getSpeseIncassoConIva()); + totCosti.add(getSpeseTrasportoConIva()); + } + if (speseStd == 2L); + rp = doc.save(); + if (rp.getStatus()) + if (l_flgTipoCreazioneRiga == 0L) { + RigaDocumento rdAnnodatura = new RigaDocumento(getApFull()); + rdAnnodatura.findRigaAnnodaturaByDocumentoPadre(getId_documento()); + if (rdAnnodatura.getId_rigaDocumento() == 0L) { + if (getPrezzoAnnodatura() > 0.0D) { + righeCreate++; + RigaDocumento rDoc = new RigaDocumento(getApFull()); + rDoc.setId_documento(doc.getId_documento()); + rDoc.setId_documentoPadre(getId_documento()); + rDoc.setDescrizioneRiga("Annodatura disp. " + getNumeroDocumentoCompleto() + " pezza " + getRiferimento()); + rDoc.setRifTipoArticolo(21L); + rDoc.setNr(1.0D); + rDoc.setImponibile(getPrezzoAnnodatura()); + rpRow = addRigaDocumento(doc, rDoc); + if (rpRow.getStatus()) + rp.append(rpRow); + } + } else { + System.out.println("Annodatura della disposizione " + getNumeroDocumentoCompleto() + " fatturata con ft " + + rdAnnodatura.getDocumento().getNumeroDocumentoCompleto()); + } + DoubleOperator metriTotaliPezza = new DoubleOperator(0.0D, 2); + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements() && rp.getStatus()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getFlgRigaPrelevata() == 0L) { + righeCreate++; + RigaDocumento rDoc = new RigaDocumento(getApFull()); + rDoc.setId_documento(doc.getId_documento()); + rDoc.setId_iva(getCodiceIvaVendStd()); + rDoc.setId_magFisico(row.getId_magFisico()); + rDoc.setSeriale(row.getSeriale()); + if (getPrezzo1000Colpi() > 0.0D) { + double totPezzeInviateDaFatturare = (double)lavPezza.getTotPezzeInviateDaFatturareByRigaDocumentoDTESS(row.getId_rigaDocumento(), hsDdtDaFatturare); + double totMetriInviateDaFatturare = lavPezza.getTotMetriDaFatturareByRigaDocumentoDTESS(row.getId_rigaDocumento(), hsDdtDaFatturare); + if (totPezzeInviateDaFatturare > 0.0D && totMetriInviateDaFatturare > 0.0D) { + metriTotaliPezza.add(totMetriInviateDaFatturare); + StringBuilder sb = new StringBuilder(row.getDescrizioneRiga()); + sb.append(" "); + sb.append("Tela "); + sb.append(getRiferimento()); + sb.append(" Pz. "); + sb.append(totPezzeInviateDaFatturare); + sb.append(" Mt. "); + sb.append(getNf().format(totMetriInviateDaFatturare)); + sb.append(" Colpi al Dm "); + sb.append(row.getNumColpiDM()); + sb.append(" Rif. DDT "); + Vectumerator vecLavPezza = lavPezza.findPezzeInviateDaFatturareByRIGADocumento(row.getId_rigaDocumento(), hsDdtDaFatturare); + HashMap hmBolle = new HashMap<>(); + HashMap hmRDBolle = new HashMap<>(); + while (vecLavPezza.hasMoreElements()) { + LavPezza rowLP = (LavPezza)vecLavPezza.nextElement(); + if (!hmBolle.containsKey(Long.valueOf(rowLP.getRigaDocumentoBolla().getId_documento()))) + hmBolle.put(Long.valueOf(rowLP.getRigaDocumentoBolla().getId_documento()), + rowLP.getRigaDocumentoBolla().getDocumento()); + if (!hmRDBolle.containsKey(Long.valueOf(rowLP.getId_rigaDocumentoBolla()))) + hmRDBolle.put(Long.valueOf(rowLP.getId_rigaDocumentoBolla()), rowLP.getRigaDocumentoBolla()); + } + for (Map.Entry me : hmBolle.entrySet()) { + sb.append(me.getValue().getNumeroDocumento()); + sb.append(" "); + } + rDoc.setDescrizioneRiga(sb.toString()); + DoubleOperator numeroColpi = new DoubleOperator(totMetriInviateDaFatturare); + numeroColpi.multiply(10); + numeroColpi.multiply(row.getNumColpiDM()); + numeroColpi.divide(1000.0F); + rDoc.setNr(numeroColpi.getResult()); + rDoc.setImponibile(getPrezzo1000Colpi()); + importiRighe += row.getTotImportoRigaConSconto(); + rDoc.setId_documentoPadre(row.getId_documento()); + rDoc.setId_rigaDocumentoPadre(row.getId_rigaDocumento()); + rDoc.setRifTipoArticolo(20L); + rpRow = addRigaDocumento(doc, rDoc); + if (rpRow.getStatus()) { + rp.append(rpRow); + for (Map.Entry me : hmRDBolle.entrySet()) { + me.getValue().setId_rigaDocumentoPadre(rDoc.getId_rigaDocumento()); + me.getValue().setId_documentoPadre(rDoc.getId_documento()); + rp.append(me.getValue().save()); + } + } + } + } + } + } + RigaDocumento rdCatena = new RigaDocumento(getApFull()); + if (rdCatena.getId_rigaDocumento() != 0L); + if (getPrezzoCatenaAlMt() > 0.0D) { + righeCreate++; + RigaDocumento rDoc = new RigaDocumento(getApFull()); + rDoc.setId_documento(doc.getId_documento()); + rDoc.setId_documentoPadre(getId_documento()); + rDoc.setDescrizioneRiga("Vendita Catena disp. " + getNumeroDocumentoCompleto() + " pezza " + + getRiferimento() + " mt. " + getNf().format(metriTotaliPezza.getResult()) + " " + + getNf().format(getPrezzoCatenaAlMt()) + "/mt"); + rDoc.setRifTipoArticolo(22L); + rDoc.setFlgUdm(3L); + rDoc.setMt(metriTotaliPezza.getResult()); + rDoc.setImponibile(getPrezzoCatenaAlMt()); + System.out.println("" + rDoc.getTotImponibileRiga() + " " + rDoc.getTotImponibileRiga() + " " + rDoc.getUdm()); + rpRow = addRigaDocumento(doc, rDoc); + if (rpRow.getStatus()) + rp.append(rpRow); + } + } else if (l_flgTipoCreazioneRiga != 1L) { + if (l_flgTipoCreazioneRiga == 2L); + } + rp = doc.save(); + if (rp.getStatus()) { + if (righeCreate == 0L) { + rp = new ResParm(false); + rp.setMsg("ERRORE! Nessun rigo prelevabile!"); + doc.delete(); + } else if (accontiDiff > 0.0D) { + if (findTotRigheDocumentoDaPrelevare() == 0L) { + doc.setAcconto(accontiDiff); + } else if (importiRighe < accontiDiff) { + doc.setAcconto(importiRighe); + } else { + doc.setAcconto(accontiDiff); + } + doc.save(); + } + if (operatore != null) { + setId_users(operatore.getId_users()); + StringBuffer sb = new StringBuffer(); + sb.append(getLogRecord()); + if (!getLogRecord().equals("")) + sb.append("
"); + sb.append("Creato Documento figlio "); + sb.append(tdGen.getDescrizione()); + sb.append(" da "); + sb.append(operatore.getCognomeNome()); + sb.append(" il "); + sb.append(getTimestampFormat().format(getTimestamp())); + setLogRecord(sb.toString()); + save(); + } + if (findTotRigheDocumentoDaPrelevare() == 0L) { + setFlgStato(1L); + setFlgDocumentoPrelevato(1L); + setFlgStatoPrenotazione(90L); + super.save(); + } + } + } + } + findByPrimaryKey(getId_documento()); + StatusMsg.deleteMsgByTag(getApFull(), TAG_THREAD_MSG); + return rp; + } + + public final ResParm startInvioMailClifor(DocumentoCR CR, String path, String testoAgg) { + if (!isThreadAttivo()) { + new ThreadSendMailClifor(CR, path, testoAgg); + return new ResParm(true, "Thread Invio Mail a clienti avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public ResParm cCaggiornaOrdineWwwByTipoPagamento(TipoPagamento l_tipoPagamento) { + ResParm rp = new ResParm(true); + if (getId_documento() > 0L && getId_tipoDocumento() == getId_docOrdineWWW()) { + if (l_tipoPagamento.getPercWwwSconto() != getTipoPagamento().getPercWwwSconto()) { + DoubleOperator dop = new DoubleOperator(l_tipoPagamento.getPercWwwSconto()); + dop.add(getPercScontoIncondizionato()); + double nuovoSconto = dop.getResult(); + Vectumerator row = findRigheDocumento(0, 0, 0); + while (row.hasMoreElements()) { + RigaDocumento rd = (RigaDocumento)row.nextElement(); + rd.setSconto(nuovoSconto); + rp = addRigaDocumento(this, rd); + if (!rp.getStatus()) + return rp; + } + } + if (l_tipoPagamento.getFlgAbilitatoNegozio() != getTipoPagamento().getFlgAbilitatoNegozio()) + if (l_tipoPagamento.getFlgAbilitatoNegozio() == 1L) { + setSpeseTrasporto(0.0D); + } else { + double totaleRigheConIva = getImportoTotaleRigheCorrispettivi(); + if (getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumeroDouble() >= 0.0D && totaleRigheConIva >= + getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumeroDouble()) { + System.out.println("free above: " + + getParm(Cart.P_DELIVERY_FREE_ABOVE).getNumeroDouble() + " totCart:" + totaleRigheConIva); + setSpeseTrasporto(0.0D); + } else { + double delivCost = 0.0D; + if (!getId_nazioneSped().isEmpty()) { + delivCost = getNazioneSped().getCostoSpedizione(); + } else { + DestinazioneDiversa dd = getClifor().getCurrentDD(); + if (!dd.getId_nazioneDD().isEmpty()) { + delivCost = dd.getNazioneDD().getCostoSpedizione(); + } else { + delivCost = getClifor().getNazione().getCostoSpedizione(); + } + if (delivCost == 0.0D) + delivCost = getParm(Cart.P_DELIVERY_COST).getNumeroDouble(); + } + setSpeseAltre(delivCost); + } + } + if (rp.getStatus()) { + setId_tipoPagamento(l_tipoPagamento.getId_tipoPagamento()); + rp = save(); + } + } + return rp; + } + + public boolean isSpeseSpedizioneWwwPreventivo() { + if (getFlgProcediPagamento() == 1L) + return false; + if (!getId_nazioneSped().isEmpty()) { + if (getNazioneSped().getFlgPreventivoWww() == 0L) + return false; + return true; + } + if (getClifor().getNazione().getFlgPreventivoWww() == 0L) + return false; + return true; + } + + public String getNotaMail() { + return (this.notaMail == null) ? "" : this.notaMail.trim(); + } + + public void setNotaMail(String notaMail) { + this.notaMail = notaMail; + } + + public long getFlgWwwTipoOrdine() { + return this.flgWwwTipoOrdine; + } + + public void setFlgWwwTipoOrdine(long flgWwwTipoOrdine) { + this.flgWwwTipoOrdine = flgWwwTipoOrdine; + } + + public double getWwwCostoOrdine() { + return this.wwwCostoOrdine; + } + + public double getWwwTotaleCosti() { + DoubleOperator dop = new DoubleOperator(getWwwCostoOrdine()); + dop.add(getWwwCostoSpedizione()); + dop.add(getWwwCostoTariffa()); + return dop.getResult(); + } + + public double getWwwNettoOrdine() { + DoubleOperator dop = new DoubleOperator(getImponibileTotale()); + dop.subtract(getWwwTotaleCosti()); + return dop.getResult(); + } + + public double getWwwNettoOrdinePerc() { + if (getWwwTotaleCosti() > 0.0D) { + DoubleOperator dop = new DoubleOperator(getImponibileTotale()); + dop.setScale(4, 5); + dop.divide(getWwwTotaleCosti()); + dop.subtract(1); + dop.multiply(100); + return dop.getResult(); + } + return 0.0D; + } + + public void calcolaCostiWww() { + if (getWwwCostoSpedizione() == 0.0D) + setWwwCostoSpedizione(getSpeseTrasporto()); + DoubleOperator costoOrdine = new DoubleOperator(); + costoOrdine.setScale(4, 5); + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + costoOrdine.add(row.getArticolo().getCostoNetto() * row.getQuantita()); + } + if (getWwwCostoOrdine() <= 0.0D) + setWwwCostoOrdine(costoOrdine.getResult()); + if (getWwwCostoTariffa() <= 0.0D) + if (getTipoPagamento().getWwwCommissionePercDefault() > 0.0D || getTipoPagamento().getWwwTariffaFissa() > 0.0D) { + if (getTipoPagamento().getWwwValoreSoglia() > 0.0D && getTipoPagamento().getWwwPercOltreSoglia() > 0.0D) { + if (getTotaleDocumento() > getTipoPagamento().getWwwValoreSoglia()) { + DoubleOperator commissione = new DoubleOperator(getTipoPagamento().getWwwValoreSoglia()); + commissione.setScale(4, 5); + commissione.multiply(getTipoPagamento().getWwwCommissionePercDefault()); + commissione.divide(100.0F); + DoubleOperator commissioneOltre = new DoubleOperator(getTotaleDocumento()); + commissioneOltre.setScale(4, 5); + commissioneOltre.subtract(getTipoPagamento().getWwwValoreSoglia()); + commissioneOltre.multiply(getTipoPagamento().getWwwPercOltreSoglia()); + commissioneOltre.divide(100.0F); + commissione.add(commissioneOltre); + commissione.add(getTipoPagamento().getWwwTariffaFissa()); + setWwwCostoTariffa(scorporaIva(commissione.getResult(), (double)getIvaDoc().getAliquota())); + } else { + DoubleOperator commissione = new DoubleOperator(getTotaleDocumento()); + commissione.setScale(4, 5); + commissione.multiply(getTipoPagamento().getWwwCommissionePercDefault()); + commissione.divide(100.0F); + commissione.add(getTipoPagamento().getWwwTariffaFissa()); + setWwwCostoTariffa(scorporaIva(commissione.getResult(), (double)getIvaDoc().getAliquota())); + } + } else { + DoubleOperator commissione = new DoubleOperator(getTotaleDocumento()); + commissione.setScale(4, 5); + commissione.multiply(getTipoPagamento().getWwwCommissionePercDefault()); + commissione.divide(100.0F); + commissione.add(getTipoPagamento().getWwwTariffaFissa()); + setWwwCostoTariffa(scorporaIva(commissione.getResult(), (double)getIvaDoc().getAliquota())); + } + } else { + setWwwCostoTariffa(0.0D); + } + } + + public void setWwwCostoOrdine(double wwwCostoOrdine) { + this.wwwCostoOrdine = wwwCostoOrdine; + } + + public double getWwwCostoSpedizione() { + return this.wwwCostoSpedizione; + } + + public void setWwwCostoSpedizione(double wwwCostoSpedizione) { + this.wwwCostoSpedizione = wwwCostoSpedizione; + } + + public double getWwwCostoTariffa() { + return this.wwwCostoTariffa; + } + + public void setWwwCostoTariffa(double wwwCostoTariffa) { + this.wwwCostoTariffa = wwwCostoTariffa; + } + + public long getId_rigaBollaAtr() { + return this.id_rigaBollaAtr; + } + + public void setId_rigaBollaAtr(long id_rigaBollaAtr) { + this.id_rigaBollaAtr = id_rigaBollaAtr; + } + + public void creaFileCvsRigheDocumento(DocumentoCR CR) { + try { + Vectumerator list = new RigaDocumento(getApFull()).findVenditeServizi(CR); + CR.setFileName(getPathTmp() + "reportDocumenti_" + getPathTmp() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "ID;Tipo articolo;Articolo;Operatore;Tipo documento;Numero documento;Data documento;Cliente/Fornitore;Nota documento;Seriale;Q.ta;Importo"; + outCvsFile.writeLine(CR.getDescrizioneCR()); + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)list.nextElement(); + s1 = String.valueOf(row.getId_documento()) + String.valueOf(row.getId_documento()) + "\"" + SEP + "\"" + row.getArticolo().getTipo().getDescrizione() + "\"" + SEP + "\"" + row.getArticolo().getDescrizioneCompleta() + SEP + row.getDocumento().getUsers().getCognomeNome() + SEP + row.getDocumento().getTipoDocumento().getDescrizione() + SEP + row.getDocumento().getNumeroDocumento() + SEP + getApFull().getDataFormat().format(row.getDocumento().getDataDocumento()) + SEP + row.getDocumento().getClifor().getDescrizioneCliente() + SEP + row.getNotaRigaDocumento() + SEP + row.getSeriale() + SEP + getNf().format(row.getQuantita()) + SEP; + outCvsFile.writeLine(s1); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + + public void findByDescTransaction(String l_descTransaction) { + String s_Sql_Find = "select A.* from DOCUMENTO AS A"; + String s_Sql_Order = " order by A.dataDocumento desc, A.progOrdineWww,A.id_esercizio desc, A.progDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.descTransaction='" + l_descTransaction + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public long getFlgOrdineWwwAppenaCreato() { + return this.flgOrdineWwwAppenaCreato; + } + + public void setFlgOrdineWwwAppenaCreato(long flgOrdineWwwAppenaCreato) { + this.flgOrdineWwwAppenaCreato = flgOrdineWwwAppenaCreato; + } + + public long getFlgOrdineWwwAppenaPagato() { + return this.flgOrdineWwwAppenaPagato; + } + + public void setFlgOrdineWwwAppenaPagato(long flgOrdineWwwAppenaPagato) { + this.flgOrdineWwwAppenaPagato = flgOrdineWwwAppenaPagato; + } + + public boolean hasRigaConScontoTroppoAlto() { + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.isScontoTroppoAlto()) + return true; + } + return false; + } + + private String getRecordBartoliniFNVAT00RSms() { + StringBuffer temp = new StringBuffer(); + SimpleDateFormat dfY = new SimpleDateFormat("yyyy"); + NumberFormat nf3 = NumberFormat.getInstance(Locale.ITALY); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf1 = NumberFormat.getInstance(Locale.ITALY); + nf1.setMaximumFractionDigits(1); + nf1.setMinimumFractionDigits(1); + Date today = getToday(); + temp.append(" "); + temp.append(" "); + temp.append(spaceRight(getParm("BART_COD_CLI").getTesto(), 7)); + temp.append(" "); + temp.append(spaceRight(getParm("BART_P_OPER").getTesto(), 3)); + temp.append(" "); + temp.append(dfY.format(today)); + temp.append(" "); + temp.append("00"); + temp.append(" "); + temp.append(String.valueOf(getId_esercizio()).substring(2, 4)); + temp.append(zeroLeft(String.valueOf(getProgDocumento()), 5)); + temp.append("S"); + if (!getClifor().getCellulare().isEmpty()) { + if (getClifor().getCellulare().startsWith("+")) { + temp.append(spaceRight(getClifor().getCellulare(), 16)); + } else { + temp.append(spaceRight(getClifor().getNazione().getPrefissoTel() + getClifor().getNazione().getPrefissoTel(), 16)); + } + } else if (getClifor().getTelefono().startsWith("+")) { + temp.append(spaceRight(getClifor().getTelefono(), 16)); + } else { + temp.append(spaceRight(getClifor().getNazione().getPrefissoTel() + getClifor().getNazione().getPrefissoTel(), 16)); + } + temp.append("SN"); + temp.append("\r"); + return temp.toString(); + } + + public ResParm eliminaRigheAzero() { + ResParm rp = new ResParm(true); + int numRigheCancellate = 0; + if (getId_documento() > 0L) { + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements() && rp.getStatus()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getTotImponibileRiga() == 0.0D) { + rp = row.delete(); + if (rp.getStatus()) + numRigheCancellate++; + } + } + } + if (rp.getStatus()) { + rp.setMsg("Cancellate " + numRigheCancellate + " righe"); + } else { + rp.setMsg("Errore! Righe Cancellate: " + numRigheCancellate + ". " + rp.getMsg()); + } + return rp; + } + + public String getStripeClientSecret() { + return (this.stripeClientSecret == null) ? "" : this.stripeClientSecret.trim(); + } + + public void setStripeClientSecret(String stripeClientSecret) { + this.stripeClientSecret = stripeClientSecret; + } + + public void findByStripeClientSecret(long l_stripeClientSecret) { + String s_Sql_Find = "select A.* from DOCUMENTO AS A"; + String s_Sql_Order = " order by A.dataDocumento desc, A.progOrdineWww,A.id_esercizio desc, A.progDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.stripeClientSecret=" + l_stripeClientSecret); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public static final synchronized ResParm riordinaRigheDocPerRiferimento(DocumentoInterface doc) { + ResParm rp = new ResParm(true); + String TAG_THREAD_MSG = "RIORDINO RIGHE"; + StatusMsg.updateMsgByTag(doc.getApFull(), "RIORDINO RIGHE", "...inizio ..."); + doc.annullaOrdinamentoRighe(); + Vectumerator vecRD = doc.findRigheDocumentoOBRiferimento(0, 0); + int i = 0; + int totRighe = vecRD.getTotNumberOfRecords(); + while (vecRD.hasMoreElements() && rp.getStatus()) { + RigaDocumento row = (RigaDocumento)vecRD.nextElement(); + StatusMsg.updateMsgByTag(doc.getApFull(), "RIORDINO RIGHE", "riga " + i + " su " + totRighe); + row.setOrdine((long)i); + rp = row.superSave(); + i++; + } + if (rp.getStatus()) + rp.setMsg("Riordino righe per riferimento completato"); + StatusMsg.deleteMsgByTag(doc.getApFull(), "RIORDINO RIGHE"); + return rp; + } + + public ResParm annullaOrdinamentoRighe() { + if (getId_documento() > 0L) + return update("update RIGA_ORDINE SET ordine=0 where id_documento=" + getId_documento()); + return new ResParm(true, "niente da fare..Documento."); + } + + public String getFERiferimentoTesto() { + return (this.FERiferimentoTesto == null) ? "" : this.FERiferimentoTesto.trim(); + } + + public void setFERiferimentoTesto(String fERiferimentoTesto) { + this.FERiferimentoTesto = fERiferimentoTesto; + } + + public double getFERiferimentoNumero() { + return this.FERiferimentoNumero; + } + + public void setFERiferimentoNumero(double fERiferimentoNumero) { + this.FERiferimentoNumero = fERiferimentoNumero; + } + + public Date getFERiferimentoData() { + return this.FERiferimentoData; + } + + public void setFERiferimentoData(Date fERiferimentoData) { + this.FERiferimentoData = fERiferimentoData; + } + + public long getId_lavorazione() { + return this.id_lavorazione; + } + + public void setId_lavorazione(long id_lavorazione) { + this.id_lavorazione = id_lavorazione; + setLavorazione(null); + } + + public Lavorazione getLavorazione() { + this.lavorazione = (Lavorazione)getSecondaryObject(this.lavorazione, Lavorazione.class, getId_lavorazione()); + return this.lavorazione; + } + + public void setLavorazione(Lavorazione lavorazione) { + this.lavorazione = lavorazione; + } + + public String getDescTransactionStripe() { + return (this.descTransactionStripe == null) ? "" : this.descTransactionStripe.trim(); + } + + public void setDescTransactionStripe(String descTransactionStripe) { + this.descTransactionStripe = descTransactionStripe; + } + + public void findByDescTransactionStripe(String l_descTransaction) { + String s_Sql_Find = "select A.* from DOCUMENTO AS A"; + String s_Sql_Order = " order by A.dataDocumento desc, A.progOrdineWww,A.id_esercizio desc, A.progDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.descTransactionStripe='" + l_descTransaction + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public long getFlgStatoLavorazionePrecedente() { + return this.flgStatoLavorazionePrecedente; + } + + public void setFlgStatoLavorazionePrecedente(long flgStatoLavorazionePrecedente) { + this.flgStatoLavorazionePrecedente = flgStatoLavorazionePrecedente; + } + + public void calcolaCostiWwwOLD() { + if (getWwwCostoSpedizione() == 0.0D) + setWwwCostoSpedizione(getSpeseTrasporto()); + DoubleOperator costoOrdine = new DoubleOperator(); + Vectumerator vec = findRigheDocumento(0, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + costoOrdine.add(row.getArticolo().getCostoNetto() * row.getQuantita()); + } + if (getWwwCostoOrdine() <= 0.0D) + setWwwCostoOrdine(costoOrdine.getResult()); + if (getFlgWwwTipoOrdine() == 0L) { + if (getTipoPagamento().getWwwCommissionePercDefault() > 0.0D || getTipoPagamento().getWwwTariffaFissa() > 0.0D) { + DoubleOperator commissione = new DoubleOperator(getTotaleDocumento()); + commissione.multiply(getTipoPagamento().getWwwCommissionePercDefault()); + commissione.divide(100.0F); + commissione.add(getTipoPagamento().getWwwTariffaFissa()); + if (getWwwCostoTariffa() <= 0.0D) + setWwwCostoTariffa(commissione.getResult()); + } else { + setWwwCostoTariffa(0.0D); + } + } else if (getFlgWwwTipoOrdine() == 1L) { + setId_tipoPagamento(TipoPagamento.getTipoPagamentoEbay(getApFull()).getId_tipoPagamento()); + DoubleOperator commissione = new DoubleOperator(); + vec.moveFirst(); + double tariffaFissa = getTipoPagamento().getWwwTariffaFissa(); + while (vec.hasMoreElements()) { + getTipoPagamento(); + RigaDocumento row = (RigaDocumento)vec.nextElement(); + DoubleOperator comRow = new DoubleOperator(row.getTotImportoRigaConSconto()); + if (row.getArticolo().getTipo().getEbayCommissione() > 0.0D) { + comRow.multiply(row.getArticolo().getTipo().getEbayCommissione()); + } else { + comRow.multiply(getTipoPagamento().getWwwCommissionePercDefault()); + } + comRow.divide(100.0F); + commissione.add(comRow); + if (row.getArticolo().getTipo().getEbayFissa() > 0.0D) + tariffaFissa = row.getArticolo().getTipo().getEbayFissa(); + } + commissione.add(tariffaFissa); + if (getWwwCostoTariffa() <= 0.0D) + setWwwCostoTariffa(commissione.getResult()); + } else if (getFlgWwwTipoOrdine() == 2L) { + setId_tipoPagamento(TipoPagamento.getTipoPagamentoAmazon(getApFull()).getId_tipoPagamento()); + DoubleOperator commissione = new DoubleOperator(); + double tariffaFissa = getTipoPagamento().getWwwTariffaFissa(); + vec.moveFirst(); + while (vec.hasMoreElements()) { + getTipoPagamento(); + RigaDocumento row = (RigaDocumento)vec.nextElement(); + DoubleOperator comRow = new DoubleOperator(row.getTotImportoRigaConSconto()); + if (row.getArticolo().getTipo().getAmazonCommissione() > 0.0D) { + comRow.multiply(row.getArticolo().getTipo().getAmazonCommissione()); + } else { + comRow.multiply(getTipoPagamento().getWwwCommissionePercDefault()); + } + comRow.divide(100.0F); + commissione.add(comRow); + if (row.getArticolo().getTipo().getAmazonFissa() > 0.0D) + tariffaFissa = row.getArticolo().getTipo().getAmazonFissa(); + } + commissione.add(tariffaFissa); + if (getWwwCostoTariffa() <= 0.0D) + setWwwCostoTariffa(commissione.getResult()); + } else { + setWwwCostoTariffa(0.0D); + } + } + + public String getNotaAtr() { + if (getId_documento() > 0L) { + StringBuilder sb = new StringBuilder(); + sb.append("Pagamento: "); + sb.append(getTipoPagamento().getDescrizione()); + sb.append("
"); + sb.append("N.B. LA FATTURA LA INVIO IO!!!! "); + sb.append("
"); + sb.append(getClifor().getCognomeNome()); + sb.append("
"); + sb.append(getClifor().getIndirizzoCompletoHtml()); + sb.append("
"); + sb.append("CF: " + getClifor().getCodFisc()); + sb.append("
"); + sb.append("P.IVA: " + getClifor().getPIva()); + sb.append("
"); + sb.append("Email (usa la mia..mettila nelle note): " + getClifor().getEMail()); + sb.append(" "); + sb.append("Cell.: " + getClifor().getCellulare()); + sb.append("
"); + sb.append("Cod. SDI: " + getClifor().getCodiceIdentificativoFE()); + sb.append(" "); + sb.append("Pec: " + getClifor().getPec()); + sb.append("
"); + if (!getPresso().isEmpty() || !getIndirizzoSped().isEmpty()) { + sb.append("Indirizzo Spedizione
"); + sb.append("Presso:" + getPresso()); + sb.append("
"); + sb.append(getIndirizzoSped() + " n. " + getIndirizzoSped()); + sb.append("
"); + sb.append(getCapSped() + " - " + getCapSped() + " (" + getCittaSped() + ")"); + sb.append("
"); + } + Vectumerator vec = findRigheDocumento(0, 0, 0); + sb.append(""); + StringBuilder descArt = new StringBuilder(); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + descArt.append(row.getDescrizioneRiga() + " "); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + sb.append(""); + } + sb.append(""); + sb.append(""); + sb.append(""); + sb.append("
Desc.Imp.qtaSc%IvaTot
"); + sb.append(row.getDescrizioneRiga()); + sb.append(""); + sb.append(getNf().format(row.getImponibile())); + sb.append(""); + sb.append(row.getQuantita()); + sb.append(""); + sb.append(getNf().format(row.getSconto())); + sb.append(""); + sb.append(row.getIva().getDescrizione()); + sb.append(""); + sb.append(getNf().format(row.getTotImponibileRigaConSconto())); + sb.append("
Spese spedizione " + getNf().format(getSpeseTrasporto()) + "
TOT IMPONIBILE ORDINE " + getNf().format(getImponibileTotale()) + "
TOT FATTURA COMPRESO IVA " + getNf().format(getTotaleDocumento()) + "
"); + return sb.toString(); + } + return ""; + } + + public String getDescrizioneArticoloAtr() { + if (getId_documento() > 0L) { + String temp = (getClifor().getFlgAzienda() == 1L) ? "Bus. " : "Priv. "; + Vectumerator vec = findRigheDocumento(0, 0, 0); + StringBuilder descArt = new StringBuilder(); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + descArt.append(row.getDescrizioneRiga() + " "); + } + temp = temp + temp + " " + getTipoPagamento().getDescrizione() + descArt.toString() + " " + getNumeroDocumento() + " " + getWwwTipoOrdine() + " "; + return temp; + } + return ""; + } + + public String getPathImg() { + return getDocBase() + getDocBase(); + } + + public String getPathAttach() { + return getDocBase() + getDocBase(); + } + + public double getPrezzoCatenaAlMt() { + return this.prezzoCatenaAlMt; + } + + public void setPrezzoCatenaAlMt(double prezzoCatenaAlMt) { + this.prezzoCatenaAlMt = prezzoCatenaAlMt; + } + + public Date getDataCambioStatoLavorazione() { + return this.dataCambioStatoLavorazione; + } + + public void setDataCambioStatoLavorazione(Date dataCambioStatoLavorazione) { + this.dataCambioStatoLavorazione = dataCambioStatoLavorazione; + } + + public long getFlgGRS() { + return this.flgGRS; + } + + public void setFlgGRS(long flgGRS) { + this.flgGRS = flgGRS; + } + + private Document creaReportUnoGiornalieroXNazione(DocumentoCR CR, boolean soloCompatto) { + long l_id_tipoDocumento = CR.getId_tipoDocumento(); + if (l_id_tipoDocumento == 0L) + l_id_tipoDocumento = getId_docCassa(); + int rowCellLeading = 6; + NumberFormat nf3 = NumberFormat.getInstance(); + nf3.setMaximumFractionDigits(3); + nf3.setMinimumFractionDigits(3); + NumberFormat nf0 = NumberFormat.getInstance(); + nf0.setMaximumFractionDigits(0); + nf0.setMinimumFractionDigits(0); + int col_1 = 5, col_2 = 3, col_3 = 3, col_4 = 19, col_5 = 5, col_6 = 5; + int cellLeading = 12; + String descCliente = "", descDocumento = ""; + DoubleOperator totGiorno = new DoubleOperator(); + DoubleOperator totaleComplessivo = new DoubleOperator(); + DoubleOperator totaleNazione = new DoubleOperator(); + SimpleDateFormat df = getDataFormat(); + Color currentColor = Color.ORANGE; + try { + Cell rigaVuota = new Cell(new Chunk(" ", PdfFontFactory.PDF_fPiccolissimo)); + rigaVuota.setVerticalAlignment(4); + rigaVuota.setHorizontalAlignment(0); + rigaVuota.setLeading((float)cellLeading); + rigaVuota.setBorder(0); + rigaVuota.setColspan(40); + rigaVuota.setRowspan(1); + Nazione nazione = new Nazione(getApFull()); + Vectumerator veNaz = nazione.findByCR(new NazioneCR(), 0, 0); + CR.setFlgOrderBy(1L); + while (veNaz.hasMoreElements()) { + Nazione rowNazione = (Nazione)veNaz.nextElement(); + CR.setId_nazione(rowNazione.getId_nazione()); + Vectumerator vec = new Documento(getApFull()).findByCR(CR, 0, 0); + totGiorno = new DoubleOperator(); + if (vec.hasMoreElements()) { + totaleNazione = new DoubleOperator(); + String intestazioneReport = rowNazione.getDescrizione_it() + " - Data: dal " + rowNazione.getDescrizione_it() + " al " + df.format(CR.getDataDocumentoDa()); + if (CR.getId_tipo() != 0L) + intestazioneReport = intestazioneReport + " - Tipo: " + intestazioneReport; + creaIntestazioneReport(CR.getTipoReport(), intestazioneReport); + Cell cell = new Cell(new Chunk("Doc.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Data", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Tipo", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col_3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Intestazione", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col_4 + col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Importo", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.pdfcorpo.endHeaders(); + Date currentData = null; + while (vec.hasMoreElements()) { + descCliente = ""; + descDocumento = ""; + Documento row = (Documento)vec.nextElement(); + if (currentData == null) { + currentData = row.getDataDocumento(); + } else if (DBAdapter.getDateDiff(currentData, row.getDataDocumento()) != 0L) { + cell = new Cell(new Chunk("TOTALE " + getDataFormat().format(currentData), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totGiorno.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + currentData = row.getDataDocumento(); + totGiorno = new DoubleOperator(); + } + totGiorno.add(row.getTotaleDocumentoConSegno()); + totaleComplessivo.add(row.getTotaleDocumentoConSegno()); + totaleNazione.add(row.getTotaleDocumentoConSegno()); + String nDoc = row.getNumeroDocumentoCompleto(); + descCliente = row.getClifor().getDescrizioneCompleta(); + descDocumento = row.getTipoDocumento().getDescrizioneStampa(); + String descPag = row.getStatoCompleto(); + cell = new Cell(new Chunk(nDoc, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_1); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getDataFormat().format(row.getDataDocumento()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_2); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(descDocumento, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_3); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(descCliente, PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_4 + col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(row.getTotaleDocumentoConSegno()), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)rowCellLeading); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("TOTALE " + getDataFormat().format(currentData), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totGiorno.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(currentColor); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE " + rowNazione.getDescrizione_it() + " da " + getDataFormat().format(CR.getDataDocumentoDa()) + " a " + getDataFormat().format(CR.getDataDocumentoA()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.green); + cell.setColspan(col_1 + col_2 + col_3 + col_4 + col_5); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(getNf().format(totaleNazione.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBackgroundColor(Color.green); + cell.setColspan(col_6); + cell.setRowspan(1); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + this.document.newPage(); + prepareNewPdfCorpoDocument(); + } + } + this.document.add((Element)this.pdfcorpo); + Paragraph pTotInt = new Paragraph(new Chunk("Totale Complessivo", PdfFontFactory.PDF_fGrandeB)); + Paragraph pTot = new Paragraph(new Chunk(getNf().format(totaleComplessivo.getResult()), PdfFontFactory.PDF_fGrandeB)); + this.document.add((Element)pTotInt); + this.document.add((Element)pTot); + } catch (Exception e) { + handleDebug(e); + } + return this.document; + } + + public String getFERiferimentoTipoDato() { + return (this.FERiferimentoTipoDato == null) ? "" : this.FERiferimentoTipoDato.trim(); + } + + public void setFERiferimentoTipoDato(String fERiferimentoTipoDato) { + this.FERiferimentoTipoDato = fERiferimentoTipoDato; + } + + public void setTotaleDocumento(double totaleDocumento) { + this.totaleDocumento = totaleDocumento; + } + + public double getImponibileTotaleConSegno() { + return (double)getTipoDocumento().fixDocumentoConImportiNegativi() * getImponibileTotale(); + } + + public double getTotaleDocumentoConSegno() { + return (double)getTipoDocumento().fixDocumentoConImportiNegativi() * getTotaleDocumento(); + } + + public long getFlgDeliveryType() { + return this.flgDeliveryType; + } + + public void setFlgDeliveryType(long flgDeliveryType) { + this.flgDeliveryType = flgDeliveryType; + } + + public String getPudoId() { + return (this.pudoId == null) ? "" : this.pudoId.trim(); + } + + public void setPudoId(String pudoId) { + this.pudoId = pudoId; + } + + public static String getDeliveryType(long l_flgDeliveryType) { + switch ((int)l_flgDeliveryType) { + case 0: + return "Spedizione Std"; + case 1: + return "Ritiro in negozio"; + case 2: + return "Fermo Point"; + } + return "????"; + } + + public String getDeliveryType() { + return getDeliveryType(getFlgDeliveryType()); + } + + public String getPudoDesc() { + return (this.pudoDesc == null) ? "" : this.pudoDesc.trim(); + } + + public void setPudoDesc(String pudoDesc) { + this.pudoDesc = pudoDesc; + } + + public PudoAddress getPudoAddress() { + String indirizzo = getClifor().getIndirizzo() + ", " + getClifor().getIndirizzo(); + String zipCode = getClifor().getCapZona().isEmpty() ? getClifor().getCapComune() : getClifor().getCapZona(); + String city = getClifor().getDescrizioneComune(); + if (!getIndirizzoSped().isEmpty()) { + indirizzo = getIndirizzoSped() + ", " + getIndirizzoSped(); + zipCode = getCapSped(); + city = getCittaSped().isEmpty() ? getComuneSped().getDescrizione() : getCittaSped(); + } + PudoAddress pa = new PudoAddress(indirizzo, zipCode, city); + return pa; + } + + public String getDescTransactionUser() { + if (getDescTransactionStripe().isEmpty()) { + if (getDescTransaction().isEmpty()) + return ""; + return getDescTransaction(); + } + return + + getDescTransactionStripe().replaceFirst("^((?:[^_]+_){2}).*", "$1").replaceAll("_$", ""); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoAgente.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoAgente.java new file mode 100644 index 00000000..d9006302 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoAgente.java @@ -0,0 +1,657 @@ +package it.acxent.contab; + +import com.lowagie.text.Cell; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.HeaderFooter; +import com.lowagie.text.PageSize; +import com.lowagie.text.Phrase; +import com.lowagie.text.Table; +import com.lowagie.text.pdf.PdfWriter; +import it.acxent.anag.Clifor; +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.PdfFontFactory; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.Vectumerator; +import java.awt.Color; +import java.io.ByteArrayOutputStream; +import java.io.FileOutputStream; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.text.NumberFormat; +import java.util.Calendar; + +public class DocumentoAgente extends _ContabAdapter implements Serializable { + private long id_documentoAgente; + + private long id_documento; + + private long id_cliforDA; + + private double percDocumentoAgente = -1.0D; + + private Documento documento; + + private Clifor agente; + + private double importoDocumentoAgente; + + public DocumentoAgente(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DocumentoAgente() {} + + public long getId_documentoAgente() { + return this.id_documentoAgente; + } + + public void setId_documentoAgente(long id_documentoAgente) { + this.id_documentoAgente = id_documentoAgente; + } + + public long getId_documento() { + return this.id_documento; + } + + public void setId_documento(long id_documento) { + this.id_documento = id_documento; + } + + public long getId_cliforDA() { + return this.id_cliforDA; + } + + public void setId_cliforDA(long id_clifor) { + this.id_cliforDA = id_clifor; + } + + public double getPercDocumentoAgente() { + return this.percDocumentoAgente; + } + + public void setPercDocumentoAgente(double percDocumentoAgente) { + this.percDocumentoAgente = percDocumentoAgente; + } + + public Documento getDocumento() { + this.documento = new Documento(getApFull()); + this.documento.findByPrimaryKey(getId_documento()); + return this.documento; + } + + public void setDocumento(Documento documento) { + this.documento = documento; + } + + public Clifor getAgente() { + this.agente = new Clifor(getApFull()); + this.agente.findByPrimaryKey(getId_cliforDA()); + return this.agente; + } + + public void setAgente(Clifor agente) { + this.agente = agente; + } + + public Vectumerator findByCR(DocumentoAgenteCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* , B.cognome, B.nome from DOCUMENTO_AGENTE AS A inner join CLIFOR AS B on A.id_cliforDA=B.id_clifor inner join DOCUMENTO as C on A.id_documento=C.id_documento"; + String s_Sql_Order = " order by B.cognome, B.nome, A.id_cliforDA"; + WcString wc = new WcString(); + if (CR.getId_documento() != 0L) + wc.addWc("A.id_documento = " + CR.getId_documento()); + if (CR.getId_cliforDA() != 0L) + wc.addWc("A.id_cliforDA = " + CR.getId_cliforDA()); + if (CR.getFlgPagata() == 0L) { + wc.addWc("(C.flgPagata is null or C.flgPagata=0)"); + } else if (CR.getFlgPagata() > 0L) { + wc.addWc("C.flgPagata =" + CR.getFlgPagata()); + } + if (CR.getDataDocumentoDa() != null) + wc.addWc("C.dataDocumento>=?"); + if (CR.getDataDocumentoA() != null) + wc.addWc("C.dataDocumento<=?"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + int dataCount = 0; + if (CR.getDataDocumentoDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoDa()); + } + if (CR.getDataDocumentoA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoA()); + } + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByDocumentoAgente(long l_id_documento, long l_id_agente) { + String s_Sql_Find = "select A.* from DOCUMENTO_AGENTE AS A"; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.id_documento = " + l_id_documento); + wc.addWc("A.id_clifor = " + l_id_agente); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void deleteAgentiByDocumento(long id_documento) { + DocumentoAgenteCR CR = new DocumentoAgenteCR(); + CR.setId_documento(id_documento); + Vectumerator vec = new DocumentoAgente(getApFull()).findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + DocumentoAgente row = (DocumentoAgente)vec.nextElement(); + row.delete(); + } + } + + public Vectumerator findByDocumento(long id_documento) { + String s_Sql_Find = "select A.* from DOCUMENTO_AGENTE AS A"; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.id_documento = " + id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getImportoDocumentoAgente() { + if (getId_documentoAgente() > 0L && getId_documento() > 0L && + this.importoDocumentoAgente == -1.0D) { + DoubleOperator dp = new DoubleOperator(getDocumento().getImponibileTotale()); + dp.setScale(2, 5); + dp.multiply(getPercDocumentoAgente()); + dp.divide(100.0F); + this.importoDocumentoAgente = dp.getResult(); + } + return (this.importoDocumentoAgente == -1.0D) ? 0.0D : this.importoDocumentoAgente; + } + + public void setImportoDocumentoAgente(double importoDocumentoAgente) { + this.importoDocumentoAgente = importoDocumentoAgente; + } + + public String getTotaleProvvigioniByDocumento(long id_documento) { + String s_Sql_Find = "select A.* from DOCUMENTO_AGENTE AS A"; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.id_documento = " + id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt); + Documento doc = new Documento(getApFull()); + doc.findByPrimaryKey(id_documento); + double totDoc = doc.getTotaleDaPagare(); + DoubleOperator totRes = new DoubleOperator(0.0F); + while (vec.hasMoreElements()) { + DocumentoAgente docage = (DocumentoAgente)vec.nextElement(); + DoubleOperator dp = new DoubleOperator(totDoc); + dp.multiply(docage.getPercDocumentoAgente()); + dp.divide(100.0F); + totRes.add(dp.getResult()); + } + NumberFormat nf2 = NumberFormat.getInstance(); + nf2.setMaximumFractionDigits(2); + nf2.setMinimumFractionDigits(2); + return String.valueOf(nf2.format(totRes.getResult())); + } catch (SQLException e) { + handleDebug(e); + return ""; + } + } + + public Vectumerator findByDocumentoOld(long id_documento) { + String s_Sql_Find = "select A.* from DOCUMENTO_AGENTE AS A"; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.id_documento = " + id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt); + Vectumerator vecres = new Vectumerator(); + Documento doc = new Documento(getApFull()); + doc.findByPrimaryKey(id_documento); + double totDoc = doc.getTotaleDaPagare(); + while (vec.hasMoreElements()) { + DocumentoAgente docage = (DocumentoAgente)vec.nextElement(); + DoubleOperator dp = new DoubleOperator(totDoc); + dp.multiply(docage.getPercDocumentoAgente()); + dp.divide(100.0F); + docage.setImportoDocumentoAgente(dp.getResult()); + vecres.add(docage); + } + return vecres; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void initFields() { + super.initFields(); + this.importoDocumentoAgente = -1.0D; + } + + public ByteArrayOutputStream creaPdfreportProvvigioni(DocumentoAgenteCR CR, RigaDocumentoProgettistaCR CRRDA) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + Cell cell = new Cell(); + int cellLeading = 10; + int corpoPadding = 2; + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + Calendar cal = Calendar.getInstance(); + SimpleDateFormat sdfh = new SimpleDateFormat("hh:mm"); + NumberFormat nf = NumberFormat.getInstance(); + nf.setMinimumFractionDigits(2); + nf.setMaximumFractionDigits(2); + Date dataVisita = null; + int col1 = 5, col2 = 18, col3 = 4, col4 = 4, col5 = 4, col6 = 2, col7 = 3; + try { + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F); + String nomeFile = CR.getFileName(); + if (nomeFile.isEmpty()) { + this.writer = PdfWriter.getInstance(this.document, ba); + } else { + PdfWriter.getInstance(this.document, new FileOutputStream(nomeFile)); + } + Font PDF_riga = PdfFontFactory.PDF_fPiccolo; + Phrase pHh = new Phrase(new Chunk("Provvigioni Agenti " + CR.getDescrizioneCR(), PdfFontFactory.PDF_fGrandeB)); + HeaderFooter header = new HeaderFooter(pHh, false); + header.setAlignment(0); + header.setBorder(0); + this.document.setHeader(header); + Phrase pH = new Phrase("Data/ora stampa: " + sdf.format(getToday()) + " " + sdfh.format(Long.valueOf(cal.getTimeInMillis())) + " pag. "); + HeaderFooter footer = new HeaderFooter(pH, true); + footer.setAlignment(2); + footer.setBorder(0); + this.document.setFooter(footer); + this.document.open(); + DocumentoAgente bean = new DocumentoAgente(getApFull()); + Table corpo = null; + corpo = new Table(40); + corpo.setWidth(100.0F); + corpo.setPadding((float)corpoPadding); + corpo.setSpacing(0.0F); + corpo.setWidths(colWidthsRighe40); + corpo.setBorder(0); + corpo.endHeaders(); + long l_id_currentAgente = 0L; + Clifor currentAgente = null; + Vectumerator vec = bean.findByCR(CR, 0, 0); + DoubleOperator totProvvAgente = new DoubleOperator(), totProvvigioni = new DoubleOperator(); + while (vec.hasMoreElements()) { + DocumentoAgente row = (DocumentoAgente)vec.nextElement(); + if (row.getId_cliforDA() != l_id_currentAgente) { + if (l_id_currentAgente > 0L) { + cell = new Cell(); + cell.add(new Chunk("TOTALE provvigioni per " + currentAgente.getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(40 - col7); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(getNf().format(totProvvAgente.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col7); + cell.setRowspan(1); + corpo.addCell(cell); + this.document.add((Element)corpo); + this.document.newPage(); + corpo = new Table(40); + corpo.setWidth(100.0F); + corpo.setPadding((float)corpoPadding); + corpo.setSpacing(0.0F); + corpo.setWidths(colWidthsRighe40); + corpo.setBorder(0); + } + cell = new Cell(); + cell.add(new Chunk("Elenco provvigioni per " + row.getAgente().getDescrizioneCompleta() + " (" + + row.getAgente().getDescrizioneAgenteResponsabileCommerciale() + ")", PdfFontFactory.PDF_fGrandeB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(40); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("N. Doc.", PdfFontFactory.PDF_fMedioB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col1); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Intestazione", PdfFontFactory.PDF_fMedioB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col2); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Data Doc.", PdfFontFactory.PDF_fMedioB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col3); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Tot. Doc.", PdfFontFactory.PDF_fMedioB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col4); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col5); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Perc.%", PdfFontFactory.PDF_fMedioB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col6); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Importo", PdfFontFactory.PDF_fMedioB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col7); + cell.setRowspan(1); + corpo.addCell(cell); + l_id_currentAgente = row.getId_cliforDA(); + currentAgente = row.getAgente(); + totProvvAgente = new DoubleOperator(); + } + totProvvAgente.add(row.getImportoDocumentoAgente()); + totProvvigioni.add(row.getImportoDocumentoAgente()); + cell = new Cell(); + cell.add(new Chunk(row.getDocumento().getNumeroDocumentoCompleto(), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col1); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(row.getDocumento().getNominativoDocumento(), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col2); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(getDataFormat().format(row.getDocumento().getDataDocumento()), PdfFontFactory.PDF_fPiccolo)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col3); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(getNf().format(row.getDocumento().getTotaleDocumento()), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col4); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(getNf().format(row.getDocumento().getImponibileTotale()), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col5); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(getNf().format(row.getPercDocumentoAgente()), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col6); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(nf.format(row.getImportoDocumentoAgente()), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col7); + cell.setRowspan(1); + corpo.addCell(cell); + } + if (l_id_currentAgente > 0L) { + cell = new Cell(); + cell.add(new Chunk("TOTALE provvigioni per " + currentAgente.getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(40 - col7); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(getNf().format(totProvvAgente.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col7); + cell.setRowspan(1); + corpo.addCell(cell); + } + this.document.add((Element)corpo); + RigaDocumentoProgettista beanRDA = new RigaDocumentoProgettista(getApFull()); + corpo = new Table(40); + corpo.setWidth(100.0F); + corpo.setPadding((float)corpoPadding); + corpo.setSpacing(0.0F); + corpo.setWidths(colWidthsRighe40); + corpo.setBorder(0); + corpo.endHeaders(); + long l_id_currentProgettista = 0L; + Clifor currentProgettista = null; + Vectumerator vecP = beanRDA.findByCR(CRRDA, 0, 0); + if (vecP.hasMoreElements()) + this.document.newPage(); + DoubleOperator totProvvProgettista = new DoubleOperator(), totProvvigioniP = new DoubleOperator(); + while (vecP.hasMoreElements()) { + RigaDocumentoProgettista row = (RigaDocumentoProgettista)vecP.nextElement(); + if (row.getId_cliforRDA() != l_id_currentProgettista) { + if (l_id_currentProgettista > 0L) { + cell = new Cell(); + cell.add(new Chunk("TOTALE provvigioni per " + row.getProgettista().getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(40 - col7); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(getNf().format(totProvvProgettista.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col7); + cell.setRowspan(1); + corpo.addCell(cell); + this.document.add((Element)corpo); + this.document.newPage(); + corpo = new Table(40); + corpo.setWidth(100.0F); + corpo.setPadding((float)corpoPadding); + corpo.setSpacing(0.0F); + corpo.setWidths(colWidthsRighe40); + corpo.setBorder(0); + } + cell = new Cell(); + cell.add(new Chunk("Elenco provvigioni per " + row.getProgettista().getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(40); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("N. Doc.", PdfFontFactory.PDF_fMedioB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col1); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Intestazione", PdfFontFactory.PDF_fMedioB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col2); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Data Doc.", PdfFontFactory.PDF_fMedioB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col3); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Articolo", PdfFontFactory.PDF_fMedioB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col4); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col5); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Perc.%", PdfFontFactory.PDF_fMedioB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col6); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Importo", PdfFontFactory.PDF_fMedioB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col7); + cell.setRowspan(1); + corpo.addCell(cell); + l_id_currentProgettista = row.getId_cliforRDA(); + currentProgettista = row.getProgettista(); + totProvvProgettista = new DoubleOperator(); + } + totProvvProgettista.add(row.getImportoRDA()); + totProvvigioniP.add(row.getImportoRDA()); + cell = new Cell(); + cell.add(new Chunk(row.getRigaDocumento().getDocumento().getNumeroDocumentoCompleto(), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col1); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(row.getRigaDocumento().getDocumento().getNominativoDocumento(), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col2); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(getDataFormat().format(row.getRigaDocumento().getDocumento().getDataDocumento()), PdfFontFactory.PDF_fPiccolo)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col3); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(row.getRigaDocumento().getDescrizioneRigaCompleta(), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col4); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(nf.format(row.getRigaDocumento().getTotImponibileRigaConSconto()), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col5); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(getNf().format(row.getPercRDA()), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col6); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(nf.format(row.getImportoRDA()), PDF_riga)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setColspan(col7); + cell.setRowspan(1); + corpo.addCell(cell); + } + if (l_id_currentProgettista > 0L) { + cell = new Cell(); + cell.add(new Chunk("TOTALE provvigioni per " + currentProgettista.getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(40 - col7); + cell.setRowspan(1); + corpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk(getNf().format(totProvvProgettista.getResult()), PdfFontFactory.PDF_fGrandeB)); + cell.setLeading((float)cellLeading); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.LIGHT_GRAY); + cell.setColspan(col7); + cell.setRowspan(1); + corpo.addCell(cell); + } + this.document.add((Element)corpo); + this.document.close(); + this.document = null; + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoAgenteCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoAgenteCR.java new file mode 100644 index 00000000..d4030953 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoAgenteCR.java @@ -0,0 +1,132 @@ +package it.acxent.contab; + +import it.acxent.anag.Clifor; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.FieldsDescriptor; +import java.sql.Date; +import java.util.HashMap; + +public class DocumentoAgenteCR extends CRAdapter { + private long id_documentoAgente; + + private long id_documento; + + private long id_cliforDA; + + private double percDocumentoAgente; + + private Documento documento; + + private Clifor agente; + + private Date dataDocumentoA; + + private Date dataDocumentoDa; + + private long flgPagata = -1L; + + public DocumentoAgenteCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DocumentoAgenteCR() {} + + public long getId_documentoAgente() { + return this.id_documentoAgente; + } + + public void setId_documentoAgente(long id_documentoAgente) { + this.id_documentoAgente = id_documentoAgente; + } + + public long getId_documento() { + return this.id_documento; + } + + public void setId_documento(long id_documento) { + this.id_documento = id_documento; + } + + public long getId_cliforDA() { + return this.id_cliforDA; + } + + public String getPagata() { + return getPagata(getFlgPagata()); + } + + public final String getPagata(long l_flgPagata) { + if (l_flgPagata == 0L) + return "No"; + if (l_flgPagata == 1L) + return "Si"; + return ""; + } + + public void setId_cliforDA(long id_clifor) { + this.id_cliforDA = id_clifor; + } + + public double getPercDocumentoAgente() { + return this.percDocumentoAgente; + } + + public void setPercDocumentoAgente(double percDocumentoAgente) { + this.percDocumentoAgente = percDocumentoAgente; + } + + public Documento getDocumento() { + this.documento = new Documento(getApFull()); + this.documento.findByPrimaryKey(getId_documento()); + return this.documento; + } + + public void setDocumento(Documento documento) { + this.documento = documento; + } + + public Clifor getAgente() { + this.agente = new Clifor(getApFull()); + this.agente.findByPrimaryKey(getId_cliforDA()); + return this.agente; + } + + public void setAgente(Clifor agente) { + this.agente = agente; + } + + public Date getDataDocumentoA() { + return this.dataDocumentoA; + } + + public void setDataDocumentoA(Date dataDocumentoA) { + this.dataDocumentoA = dataDocumentoA; + } + + public Date getDataDocumentoDa() { + return this.dataDocumentoDa; + } + + public void setDataDocumentoDa(Date dataDocumentoDa) { + this.dataDocumentoDa = dataDocumentoDa; + } + + public long getFlgPagata() { + return this.flgPagata; + } + + public void setFlgPagata(long flgPagata) { + this.flgPagata = flgPagata; + } + + protected void initCrFieldDescriptor() { + if (this.crFieldDescriptor == null) { + this.crFieldDescriptor = new HashMap(); + this.crFieldDescriptor.put("id_cliforDA", new FieldsDescriptor("id_cliforDA", 10L, "Agente", "")); + this.crFieldDescriptor.put("dataDocumentoDa", new FieldsDescriptor("dataDocumentoDa", 40L, "Data Documento Da", "")); + this.crFieldDescriptor.put("dataDocumentoA", new FieldsDescriptor("dataDocumentoA", 50L, "Data Documento A", "")); + this.crFieldDescriptor.put("flgPagata", new FieldsDescriptor("flgPagata", 60L, "Pagata", "")); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoCR.java new file mode 100644 index 00000000..3efd0f7e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoCR.java @@ -0,0 +1,1464 @@ +package it.acxent.contab; + +import it.acxent.anag.Aspetto; +import it.acxent.anag.Banca; +import it.acxent.anag.Clifor; +import it.acxent.anag.Esercizio; +import it.acxent.anag.Nazione; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.Users; +import it.acxent.anag.Vettore; +import it.acxent.annotation.CRDescriptor; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloVariante; +import it.acxent.art.Marca; +import it.acxent.art.Tipo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.FieldsDescriptor; +import it.acxent.tex.anag.ArticoloTessuto; +import it.acxent.tex.anag.Telaio; +import it.acxent.util.SimpleDateFormat; +import java.sql.Date; +import java.sql.Time; +import java.util.Calendar; +import java.util.HashMap; + +public class DocumentoCR extends CRAdapter { + private static final long serialVersionUID = -6450723676308692559L; + + private String flgClienteFornitore; + + private long id_documentoS; + + private long id_tipoDocumento; + + private long id_vettore; + + private long id_iva; + + private long id_tipoPagamento; + + private String flgSys; + + private long flgStato = -1L; + + @CRDescriptor(descrizione = "Data Da", abilita = true) + private Date dataDocumentoDa; + + @CRDescriptor(descrizione = "Data A", abilita = true) + private Date dataDocumentoA; + + private Date dataScontrino; + + private long progDocumento; + + private long id_contatore; + + private String filePdf; + + private Date dataRiferimento; + + private Date dataRiferimentoDa; + + private Date dataRiferimentoA; + + private long flgTipoDocumento; + + private double sconto; + + private Date dataPagamento; + + private Date dataRegistrazioneDI; + + private String dichiarazioneIntento; + + private long flgSimulazione; + + private long flgPagata = -1L; + + private long flgExport; + + private long flgPA = -1L; + + private long flgInviatoAvviso = -1L; + + private String kg; + + private long nColli; + + private Date dataStampaBollato; + + private Date dataStampaIva; + + private long flgTrasportoAssicurato; + + private String notaSpedizione; + + private Date dataConsegna; + + private Time oraConsegna; + + private double speseTrasporto; + + private double speseAltre; + + private String descSpeseAltre; + + private long id_aspetto; + + private String descrizioneRiga; + + private TipoDocumento tipoDocumento; + + private Clifor clifor; + + private Vettore vettore; + + private TipoPagamento tipoPagamento; + + private Esercizio esercizio; + + private Aspetto aspetto; + + private long blankLabels; + + private long numLabels; + + private long flgDocumentoPrelevato = -1L; + + private Date dataDocumento; + + private long numScontrino; + + private String seriale; + + private ArticoloVariante articoloVariante; + + private long id_articoloVariante; + + private Articolo articolo; + + private long id_articolo; + + private long flgStatoPrenotazione = -1L; + + private long flgStatoPrenotazioneArt = -1L; + + private String riferimento; + + private String eMailInvio; + + private long id_clifor; + + private long id_tipo; + + private Tipo tipo; + + private long flgArt8; + + private long flgSlip = -1L; + + private long flgStampaSlip = -1L; + + private long flgStatoRiparazione = -1L; + + private long flgTrasporto; + + private String nominativoDocumento; + + private String descrizioneCompletaArticolo; + + private long id_esercizio; + + private Date dataChiusuraA; + + private Date dataChiusuraDa; + + private String testoMessaggio; + + private long id_documentoNo; + + private long flgStatoOrdineWww = 10L; + + private long flgRitiroNegozio = -1L; + + private long progDocumentoA; + + private long id_bancaAnticipo = -1L; + + private long flgHasDocumentiPrelevabili = -1L; + + private long flgProvvisoria; + + private long id_marca; + + private Marca marca; + + private String notaBarcode; + + private Banca bancaAnticipo; + + private long flgSuper; + + private String riferimentoAzienda; + + private long flgSuperR = -1L; + + private long id_tipoDocumentoF; + + private String fileName; + + private Date dataEmissioneDocumento; + + private Users users; + + private long flgInvioMail = 1L; + + private long flgSoloFattureElettroniche; + + private long flgStatoLavorazione = -2L; + + private long id_tipoStampaDocumento; + + private TipoStampaDocumento tipoStampaDocumento; + + private long flgTipologia = -1L; + + private long flgRicercaPerTaglio; + + private long id_telaio; + + private Telaio telaio; + + private long flgTipoGenerazione; + + private long id_articoloDocumento; + + private long flgBartolini = -1L; + + private long flgXmlGenerato = -1L; + + private long flgSplitPayment = -1L; + + private long flgLink; + + private String nMatricola; + + private long progOrdineWww; + + private long id_articoloTessuto; + + private ArticoloTessuto articoloTessuto; + + private String searchArticolo; + + private long flgMl = -1L; + + private long flgOss; + + private long flgGRS = -1L; + + private double totaleDocumentoDa; + + private double totaleDocumentoA; + + @CRDescriptor(descrizione = "Nazione", abilita = true) + private String id_nazione; + + private Nazione nazione; + + public static final int ORDER_BY_NUMERO_FATT_DESC = 0; + + public static final int ORDER_BY_NUMERO_FATT_ASC = 1; + + public static final int ORDER_BY_CLIENTE = 2; + + public static final int ORDER_BY_REG_IVA = 9; + + public static final long INVIO_MAIL_TUTTE = 1L; + + public static final long INVIO_MAIL_NON_INVIATE = 0L; + + public DocumentoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DocumentoCR() {} + + public void setId_documentoS(long newId_documento) { + this.id_documentoS = newId_documento; + } + + public void setId_tipoDocumento(long newId_tipoDocumento) { + this.id_tipoDocumento = newId_tipoDocumento; + setTipoDocumento(null); + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_vettore(long newId_vettore) { + this.id_vettore = newId_vettore; + setVettore(null); + } + + public void setId_tipoPagamento(long newId_tipoPagamento) { + this.id_tipoPagamento = newId_tipoPagamento; + setTipoPagamento(null); + } + + public void setFlgSys(String newFlgSys) { + this.flgSys = newFlgSys; + } + + public void setFlgStato(long newFlgStato) { + this.flgStato = newFlgStato; + } + + public void setDataDocumento(Date newDataDocumento) { + this.dataDocumento = newDataDocumento; + } + + public void setProgDocumento(long newProgDocumento) { + this.progDocumento = newProgDocumento; + } + + public void setId_esercizio(long newId_esercizio) { + this.id_esercizio = newId_esercizio; + setEsercizio(null); + } + + public void setRiferimento(String newRiferimento) { + this.riferimento = newRiferimento; + } + + public void setDataRiferimento(Date newDataRiferimento) { + this.dataRiferimento = newDataRiferimento; + } + + public void setFlgTipoDocumento(long newFlgTipoDocumento) { + this.flgTipoDocumento = newFlgTipoDocumento; + } + + public void setSconto(double newSconto) { + this.sconto = newSconto; + } + + public void setDataPagamento(Date newDataPagamento) { + this.dataPagamento = newDataPagamento; + } + + public void setDataRegistrazioneDI(Date newDataRegistrazioneDI) { + this.dataRegistrazioneDI = newDataRegistrazioneDI; + } + + public void setDichiarazioneIntento(String newDichiarazioneIntento) { + this.dichiarazioneIntento = newDichiarazioneIntento; + } + + public void setFlgArt8(long newFlgArt8) { + this.flgArt8 = newFlgArt8; + } + + public void setFlgPagata(long newFlgPagata) { + this.flgPagata = newFlgPagata; + } + + public void setFlgExport(long newFlgExport) { + this.flgExport = newFlgExport; + } + + public void setFlgTrasporto(long newFlgTrasporto) { + this.flgTrasporto = newFlgTrasporto; + } + + public void setKg(String newKg) { + this.kg = newKg; + } + + public void setNColli(long newNColli) { + this.nColli = newNColli; + } + + public void setDataStampaBollato(Date newDataStampaBollato) { + this.dataStampaBollato = newDataStampaBollato; + } + + public void setDataStampaIva(Date newDataStampaIva) { + this.dataStampaIva = newDataStampaIva; + } + + public void setFlgTrasportoAssicurato(long newFlgTrasportoAssicurato) { + this.flgTrasportoAssicurato = newFlgTrasportoAssicurato; + } + + public void setNotaSpedizione(String newNotaSpedizione) { + this.notaSpedizione = newNotaSpedizione; + } + + public void setDataConsegna(Date newDataConsegna) { + this.dataConsegna = newDataConsegna; + } + + public void setOraConsegna(Time newOraConsegna) { + this.oraConsegna = newOraConsegna; + } + + public void setSpeseTrasporto(double newSpeseTrasporto) { + this.speseTrasporto = newSpeseTrasporto; + } + + public void setSpeseAltre(double newSpeseAltre) { + this.speseAltre = newSpeseAltre; + } + + public void setDescSpeseAltre(String newDescSpeseAltre) { + this.descSpeseAltre = newDescSpeseAltre; + } + + public void setId_aspetto(long newId_aspetto) { + this.id_aspetto = newId_aspetto; + setAspetto(null); + } + + public long getId_documentoS() { + return this.id_documentoS; + } + + public long getId_tipoDocumento() { + return this.id_tipoDocumento; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_vettore() { + return this.id_vettore; + } + + public long getId_tipoPagamento() { + return this.id_tipoPagamento; + } + + public String getFlgSys() { + return (this.flgSys == null) ? "" : this.flgSys.trim(); + } + + public long getFlgStato() { + return this.flgStato; + } + + public Date getDataDocumento() { + return this.dataDocumento; + } + + public long getProgDocumento() { + return this.progDocumento; + } + + public long getId_esercizio() { + return this.id_esercizio; + } + + public String getRiferimento() { + return (this.riferimento == null) ? "" : this.riferimento.trim(); + } + + public Date getDataRiferimento() { + return this.dataRiferimento; + } + + public long getFlgTipoDocumento() { + return this.flgTipoDocumento; + } + + public double getSconto() { + return this.sconto; + } + + public Date getDataPagamento() { + return this.dataPagamento; + } + + public Date getDataRegistrazioneDI() { + return this.dataRegistrazioneDI; + } + + public String getDichiarazioneIntento() { + return (this.dichiarazioneIntento == null) ? "" : this.dichiarazioneIntento.trim(); + } + + public long getFlgArt8() { + return this.flgArt8; + } + + public long getFlgPagata() { + return this.flgPagata; + } + + public long getFlgExport() { + return this.flgExport; + } + + public long getFlgTrasporto() { + return this.flgTrasporto; + } + + public String getKg() { + return (this.kg == null) ? "" : this.kg.trim(); + } + + public long getNColli() { + return this.nColli; + } + + public Date getDataStampaBollato() { + return this.dataStampaBollato; + } + + public Date getDataStampaIva() { + return this.dataStampaIva; + } + + public long getFlgTrasportoAssicurato() { + return this.flgTrasportoAssicurato; + } + + public String getNotaSpedizione() { + return (this.notaSpedizione == null) ? "" : this.notaSpedizione.trim(); + } + + public Date getDataConsegna() { + return this.dataConsegna; + } + + public Time getOraConsegna() { + return this.oraConsegna; + } + + public double getSpeseTrasporto() { + return this.speseTrasporto; + } + + public double getSpeseAltre() { + return this.speseAltre; + } + + public String getDescSpeseAltre() { + return (this.descSpeseAltre == null) ? "" : this.descSpeseAltre.trim(); + } + + public long getId_aspetto() { + return this.id_aspetto; + } + + public void setTipoDocumento(TipoDocumento newTipoDocumento) { + this.tipoDocumento = newTipoDocumento; + } + + public TipoDocumento getTipoDocumento() { + this.tipoDocumento = (TipoDocumento)getSecondaryObject(this.tipoDocumento, TipoDocumento.class, getId_tipoDocumento()); + return this.tipoDocumento; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setVettore(Vettore newVettore) { + this.vettore = newVettore; + } + + public Vettore getVettore() { + this.vettore = (Vettore)getSecondaryObject(this.vettore, Vettore.class, getId_vettore()); + return this.vettore; + } + + public void setTipoPagamento(TipoPagamento newTipoPagamento) { + this.tipoPagamento = newTipoPagamento; + } + + public TipoPagamento getTipoPagamento() { + this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, getId_tipoPagamento()); + return this.tipoPagamento; + } + + public void setEsercizio(Esercizio newEsercizio) { + this.esercizio = newEsercizio; + } + + public Esercizio getEsercizio() { + this.esercizio = (Esercizio)getSecondaryObject(this.esercizio, Esercizio.class, getId_esercizio()); + return this.esercizio; + } + + public void setAspetto(Aspetto newAspetto) { + this.aspetto = newAspetto; + } + + public Aspetto getAspetto() { + this.aspetto = (Aspetto)getSecondaryObject(this.aspetto, Aspetto.class, getId_aspetto()); + return this.aspetto; + } + + public Date getDataDocumentoDa() { + return this.dataDocumentoDa; + } + + public void setDataDocumentoDa(Date dataDocumentoDa) { + this.dataDocumentoDa = dataDocumentoDa; + } + + public Date getDataDocumentoA() { + return this.dataDocumentoA; + } + + public void setDataDocumentoA(Date dataDocumentoA) { + this.dataDocumentoA = dataDocumentoA; + } + + public String getStato() { + return getStato(getFlgStato()); + } + + public boolean isProgConBuchi() { + Calendar cal = Calendar.getInstance(); + return isProgConBuchi((long)cal.get(1)); + } + + public boolean isProgConBuchi(long anno) { + if (getApFull() == null || getId_tipoDocumento() == 0L) + return false; + if (anno == 0L) { + Calendar cal = Calendar.getInstance(); + anno = (long)cal.get(1); + } + Documento bean = new Documento(getApFull()); + bean.setId_tipoDocumento(getId_tipoDocumento()); + return bean.isProgConBuchi(anno); + } + + public String trovaPrimoBuco() { + Calendar cal = Calendar.getInstance(); + return trovaPrimoBuco((long)cal.get(1)); + } + + public String trovaPrimoBuco(long anno) { + if (getApFull() == null) + return "Impossibbile calcolare protocolli Fattura anno" + anno; + if (anno == 0L) { + Calendar cal = Calendar.getInstance(); + anno = (long)cal.get(1); + } + Documento bean = new Documento(getApFull()); + bean.setId_tipoDocumento(getId_tipoDocumento()); + return bean.trovaPrimoBuco(anno); + } + + public static final String getStato(long l_flgStato) { + return Documento.getStato(l_flgStato); + } + + public long getBlankLabels() { + return this.blankLabels; + } + + public void setBlankLabels(long blankLabels) { + this.blankLabels = blankLabels; + } + + public long getNumLabels() { + return this.numLabels; + } + + public void setNumLabels(long numLabels) { + this.numLabels = numLabels; + } + + public long getFlgDocumentoPrelevato() { + return this.flgDocumentoPrelevato; + } + + public void setFlgDocumentoPrelevato(long flgDocumentoPrelevato) { + this.flgDocumentoPrelevato = flgDocumentoPrelevato; + } + + public Date getDataScontrino() { + return this.dataScontrino; + } + + public void setDataScontrino(Date dataScontrino) { + this.dataScontrino = dataScontrino; + } + + public long getNumScontrino() { + return this.numScontrino; + } + + public void setNumScontrino(long numScontrino) { + this.numScontrino = numScontrino; + } + + public String getSeriale() { + return (this.seriale == null) ? AB_EMPTY_STRING : this.seriale.trim(); + } + + public void setSeriale(String seriale) { + this.seriale = seriale; + } + + public String getDescrizioneCompletaArticolo() { + if (getId_articoloVariante() != 0L) + return getArticoloVariante().getDescrizioneCompleta(); + if (getId_articolo() != 0L) + return getArticolo().getDescrizioneCompleta(); + return (this.descrizioneCompletaArticolo == null) ? AB_EMPTY_STRING : this.descrizioneCompletaArticolo.trim(); + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante()); + return this.articoloVariante; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setArticoloVariante(ArticoloVariante newArticoloVariante) { + this.articoloVariante = newArticoloVariante; + } + + public void setId_articoloVariante(long newId_articoloVariante) { + this.id_articoloVariante = newId_articoloVariante; + setArticoloVariante(null); + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public String getDataScontrinoF() { + if (this.dataScontrino != null) { + SimpleDateFormat df = new SimpleDateFormat("dd-MM-yy"); + return df.format(this.dataScontrino); + } + return AB_EMPTY_STRING; + } + + public final String getTipoReport() { + return Documento.getTipoReport(getFlgTipoReport()); + } + + public String getDescrizioneCR() { + return super.getDescrizioneCR(); + } + + public static final String getTipoReport(long l_flgTipoReport) { + return Documento.getTipoReport(l_flgTipoReport); + } + + public long getFlgStatoPrenotazione() { + return this.flgStatoPrenotazione; + } + + public void setFlgStatoPrenotazione(long flgStatoPrenotazione) { + this.flgStatoPrenotazione = flgStatoPrenotazione; + } + + public static String getStatoOrdineWww(long l_flgPrenotazione) { + return Documento.getStatoOrdineWww(l_flgPrenotazione); + } + + public String getFilePdf() { + return (this.filePdf == null) ? AB_EMPTY_STRING : this.filePdf.trim(); + } + + public void setFilePdf(String filePdf) { + this.filePdf = filePdf; + } + + public String getEMailInvio() { + return this.eMailInvio; + } + + public void setEMailInvio(String mailInvio) { + this.eMailInvio = mailInvio; + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo()); + return this.tipo; + } + + public void setId_tipo(long id_tipo) { + this.id_tipo = id_tipo; + setTipo(null); + } + + public long getId_tipo() { + return this.id_tipo; + } + + public void setTipo(Tipo tipo) { + this.tipo = tipo; + } + + public long getFlgSimulazione() { + return this.flgSimulazione; + } + + public void setFlgSimulazione(long flgSimulazione) { + this.flgSimulazione = flgSimulazione; + } + + public long getFlgSlip() { + return this.flgSlip; + } + + public void setFlgSlip(long flgSlip) { + this.flgSlip = flgSlip; + } + + public long getFlgStampaSlip() { + return this.flgStampaSlip; + } + + public void setFlgStampaSlip(long flgStampaSlip) { + this.flgStampaSlip = flgStampaSlip; + } + + public static String getStatoRiparazione(long l_flgRiparazione) { + return Documento.getStatoRiparazione(l_flgRiparazione); + } + + public long getFlgStatoRiparazione() { + return this.flgStatoRiparazione; + } + + public void setFlgStatoRiparazione(long flgStatoRiparazione) { + this.flgStatoRiparazione = flgStatoRiparazione; + } + + public long getFlgInviatoAvviso() { + return this.flgInviatoAvviso; + } + + public void setFlgInviatoAvviso(long flgInviatoAvviso) { + this.flgInviatoAvviso = flgInviatoAvviso; + } + + public String getNominativoDocumento() { + if (getId_clifor() == 0L) + return (this.nominativoDocumento == null) ? AB_EMPTY_STRING : this.nominativoDocumento.trim(); + return getClifor().getDescrizioneCompleta(); + } + + public void setNominativoDocumento(String descrizioneClifor) { + this.nominativoDocumento = descrizioneClifor; + } + + public void setDescrizioneCompletaArticolo(String descrizioneCompletaArticolo) { + this.descrizioneCompletaArticolo = descrizioneCompletaArticolo; + } + + public long getId_contatore() { + return this.id_contatore; + } + + public void setId_contatore(long id_contatore) { + this.id_contatore = id_contatore; + } + + public Date getDataChiusuraA() { + return this.dataChiusuraA; + } + + public void setDataChiusuraA(Date dataChiusuraA) { + this.dataChiusuraA = dataChiusuraA; + } + + public Date getDataChiusuraDa() { + return this.dataChiusuraDa; + } + + public void setDataChiusuraDa(Date dataChiusuraDa) { + this.dataChiusuraDa = dataChiusuraDa; + } + + public String getTestoMessaggio() { + return (this.testoMessaggio == null) ? AB_EMPTY_STRING : this.testoMessaggio.trim(); + } + + public void setTestoMessaggio(String testoMessaggio) { + this.testoMessaggio = testoMessaggio; + } + + public long getId_documentoNo() { + return this.id_documentoNo; + } + + public void setId_documentoNo(long idDocumentoNo) { + this.id_documentoNo = idDocumentoNo; + } + + public long getFlgStatoOrdineWww() { + return this.flgStatoOrdineWww; + } + + public void setFlgStatoOrdineWww(long flgStatoOrdineWww) { + this.flgStatoOrdineWww = flgStatoOrdineWww; + } + + public long getFlgRitiroNegozio() { + return this.flgRitiroNegozio; + } + + public void setFlgRitiroNegozio(long flgRitiroNegozio) { + this.flgRitiroNegozio = flgRitiroNegozio; + } + + public long getFlgLink() { + return this.flgLink; + } + + public void setFlgLink(long flgLink) { + this.flgLink = flgLink; + } + + public long getProgDocumentoA() { + return this.progDocumentoA; + } + + public void setProgDocumentoA(long progDocumentoA) { + this.progDocumentoA = progDocumentoA; + } + + public long getId_bancaAnticipo() { + return this.id_bancaAnticipo; + } + + public void setId_bancaAnticipo(long id_bancaAnticipo) { + this.id_bancaAnticipo = id_bancaAnticipo; + } + + public long getFlgHasDocumentiPrelevabili() { + return this.flgHasDocumentiPrelevabili; + } + + public void setFlgHasDocumentiPrelevabili(long flgHasDocumentiPrelevabili) { + this.flgHasDocumentiPrelevabili = flgHasDocumentiPrelevabili; + } + + public long getFlgProvvisoria() { + return this.flgProvvisoria; + } + + public void setFlgProvvisoria(long flgProvvisoria) { + this.flgProvvisoria = flgProvvisoria; + } + + public long getId_marca() { + return this.id_marca; + } + + public void setId_marca(long id_marca) { + this.id_marca = id_marca; + } + + public Marca getMarca() { + this.marca = (Marca)getSecondaryObject(this.marca, Marca.class, new Long(getId_marca())); + return this.marca; + } + + public void setMarca(Marca marca) { + this.marca = marca; + } + + public String getNotaBarcode() { + return (this.notaBarcode == null) ? AB_EMPTY_STRING : this.notaBarcode; + } + + public void setNotaBarcode(String notaBarcode) { + this.notaBarcode = notaBarcode; + } + + public Date getDataRiferimentoDa() { + return this.dataRiferimentoDa; + } + + public void setDataRiferimentoDa(Date dataRiferimentoDa) { + this.dataRiferimentoDa = dataRiferimentoDa; + } + + public Date getDataRiferimentoA() { + return this.dataRiferimentoA; + } + + public void setDataRiferimentoA(Date dataRiferimentoA) { + this.dataRiferimentoA = dataRiferimentoA; + } + + public String getCriteriDiRicerca() { + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + StringBuilder sb = new StringBuilder(); + if (getProgDocumento() > 0L) + sb.append("Numero documento Da: " + getProgDocumento()); + if (getProgDocumentoA() > 0L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Numero documento A: " + getProgDocumentoA()); + } + if (getId_esercizio() > 0L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Anno documento: " + getId_esercizio()); + } + if (getFlgStato() > 0L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Stato documento: " + getStato()); + } + if (getFlgTipologia() > 0L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Tipologia Documento: " + getTipoDocumento().getTipologia(getFlgTipologia())); + } + if (getId_clifor() > 0L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Cliente/Fornitore: " + getClifor().getDescrizioneCompleta()); + } + if (getDataDocumentoDa() != null) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Data documento Da: " + df.format(getDataDocumentoDa())); + } + if (getDataDocumentoA() != null) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Data documento A: " + df.format(getDataDocumentoA())); + } + if (getId_tipoPagamento() > 0L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Tipo pagamento: " + getTipoPagamento().getDescrizione()); + } + if (!getRiferimento().isEmpty()) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Riferimento fornitore: " + getRiferimento()); + } + if (getDataRiferimentoDa() != null) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Data riferimento Da: " + df.format(getDataRiferimentoDa())); + } + if (getDataRiferimentoA() != null) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Data riferimento A: " + df.format(getDataRiferimentoA())); + } + if (getFlgPagata() == -1L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Pagato: Tutti"); + } + if (getFlgPagata() == 0L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Pagato: No"); + } + if (getFlgPagata() == 1L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Pagato: Si"); + } + if (getId_bancaAnticipo() > 0L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Anticipo: " + getBancaAnticipo().getDescrizione()); + } + return sb.toString(); + } + + public Banca getBancaAnticipo() { + this.bancaAnticipo = (Banca)getSecondaryObject(this.bancaAnticipo, Banca.class, getId_bancaAnticipo()); + return this.bancaAnticipo; + } + + public void setBancaAnticipo(Banca bancaAnticipo) { + this.bancaAnticipo = bancaAnticipo; + } + + public long getFlgSuper() { + return this.flgSuper; + } + + public void setFlgSuper(long flgSuper) { + this.flgSuper = flgSuper; + } + + public String getFlgClienteFornitore() { + return (this.flgClienteFornitore == null) ? AB_EMPTY_STRING : this.flgClienteFornitore; + } + + public void setFlgClienteFornitore(String flgClienteFornitore) { + this.flgClienteFornitore = flgClienteFornitore; + } + + public String getRiferimentoAzienda() { + return (this.riferimentoAzienda == null) ? AB_EMPTY_STRING : this.riferimentoAzienda; + } + + public void setRiferimentoAzienda(String riferimentoAzienda) { + this.riferimentoAzienda = riferimentoAzienda; + } + + public long getFlgSuperR() { + return this.flgSuperR; + } + + public void setFlgSuperR(long flgSuperR) { + this.flgSuperR = flgSuperR; + } + + public String getFileName() { + return (this.fileName == null) ? AB_EMPTY_STRING : this.fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public Date getDataEmissioneDocumento() { + return this.dataEmissioneDocumento; + } + + public void setDataEmissioneDocumento(Date dataEmissioneDocumento) { + this.dataEmissioneDocumento = dataEmissioneDocumento; + } + + public Users getUsers() { + if (this.users == null) + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users()); + return this.users; + } + + public void setUsers(Users users) { + this.users = users; + } + + public long getId_tipoDocumentoF() { + return this.id_tipoDocumentoF; + } + + public void setId_tipoDocumentoF(long id_tipoDocumentoF) { + this.id_tipoDocumentoF = id_tipoDocumentoF; + } + + public long getFlgStatoPrenotazioneArt() { + return this.flgStatoPrenotazioneArt; + } + + public void setFlgStatoPrenotazioneArt(long flgStatoPrenotazioneArt) { + this.flgStatoPrenotazioneArt = flgStatoPrenotazioneArt; + } + + public static String getStatoPrenotazioneArt(long l_flgPrenotazioneArt) { + return Documento.getStatoPrenotazioneArt(l_flgPrenotazioneArt); + } + + public long getFlgInvioMail() { + return this.flgInvioMail; + } + + public void setFlgInvioMail(long flgInvioMail) { + this.flgInvioMail = flgInvioMail; + } + + public static String getStatoPrenotazione(long l_flgPrenotazione) { + return Documento.getStatoPrenotazione(l_flgPrenotazione); + } + + protected void initCrFieldDescriptor() { + if (this.crFieldDescriptor == null) { + this.crFieldDescriptor = new HashMap(); + this.crFieldDescriptor.put("progDocumento", new FieldsDescriptor("progDocumento", 10L, "Numero Documento", "")); + this.crFieldDescriptor.put("id_esercizio", new FieldsDescriptor("id_esercizio", 20L, "Anno Documento", "")); + this.crFieldDescriptor.put("id_clifor", new FieldsDescriptor("id_clifor", 30L, "Cliente/Fornitore", "")); + this.crFieldDescriptor.put("dataDocumentoDa", new FieldsDescriptor("dataDocumentoDa", 40L, "Data Documento Da", "")); + this.crFieldDescriptor.put("dataDocumentoA", new FieldsDescriptor("dataDocumentoA", 50L, "Data Documento A", "")); + } + } + + public long getFlgSoloFattureElettroniche() { + return this.flgSoloFattureElettroniche; + } + + public void setFlgSoloFattureElettroniche(long flgSoloFattureElettroniche) { + this.flgSoloFattureElettroniche = flgSoloFattureElettroniche; + } + + public static final String getStatoLavorazione(long l_flgStatoLavorazione) { + return Documento.getStatoLavorazione(l_flgStatoLavorazione); + } + + public long getFlgStatoLavorazione() { + return this.flgStatoLavorazione; + } + + public String getStatoLavorazione() { + return Documento.getStatoLavorazione(getFlgStatoLavorazione()); + } + + public void setFlgStatoLavorazione(long flgStatoLavorazione) { + this.flgStatoLavorazione = flgStatoLavorazione; + } + + public long getId_tipoStampaDocumento() { + return this.id_tipoStampaDocumento; + } + + public TipoStampaDocumento getTipoStampaDocumento() { + this.tipoStampaDocumento = (TipoStampaDocumento)getSecondaryObject(this.tipoStampaDocumento, TipoStampaDocumento.class, + getId_tipoStampaDocumento()); + return this.tipoStampaDocumento; + } + + public void setId_tipoStampaDocumento(long newId_tipoStampaDocumento) { + this.id_tipoStampaDocumento = newId_tipoStampaDocumento; + setTipoStampaDocumento(null); + } + + public void setTipoStampaDocumento(TipoStampaDocumento newTipoStampaDocumento) { + this.tipoStampaDocumento = newTipoStampaDocumento; + } + + public long getFlgTipologia() { + return this.flgTipologia; + } + + public void setFlgTipologia(long flgTipologia) { + this.flgTipologia = flgTipologia; + } + + public long getFlgRicercaPerTaglio() { + return this.flgRicercaPerTaglio; + } + + public void setFlgRicercaPerTaglio(long flgRicercaPerTaglio) { + this.flgRicercaPerTaglio = flgRicercaPerTaglio; + } + + public long getId_telaio() { + return this.id_telaio; + } + + public Telaio getTelaio() { + this.telaio = (Telaio)getSecondaryObject(this.telaio, Telaio.class, getId_telaio()); + return this.telaio; + } + + public void setId_telaio(long id_telaio) { + this.id_telaio = id_telaio; + setTelaio(null); + } + + public void setTelaio(Telaio telaio) { + this.telaio = telaio; + } + + public long getFlgTipoGenerazione() { + return this.flgTipoGenerazione; + } + + public void setFlgTipoGenerazione(long flgTipoGenerazione) { + this.flgTipoGenerazione = flgTipoGenerazione; + } + + public long getId_articoloDocumento() { + return this.id_articoloDocumento; + } + + public void setId_articoloDocumento(long id_articoloDocumento) { + this.id_articoloDocumento = id_articoloDocumento; + } + + public boolean isFatturaElettronicaOn() { + return getParm("FATTURA_ELETTRONICA_ON").isTrue(); + } + + public static String getBartolini(long l_flgBartolini) { + return Documento.getBartolini(l_flgBartolini); + } + + public String getBartolini() { + return Documento.getBartolini(getFlgBartolini()); + } + + public long getFlgBartolini() { + return this.flgBartolini; + } + + public void setFlgBartolini(long flgBartolini) { + this.flgBartolini = flgBartolini; + } + + public long getFlgXmlGenerato() { + return this.flgXmlGenerato; + } + + public void setFlgXmlGenerato(long flgXmlGenerato) { + this.flgXmlGenerato = flgXmlGenerato; + } + + public long getFlgPA() { + return this.flgPA; + } + + public void setFlgPA(long flgPA) { + this.flgPA = flgPA; + } + + public long getFlgSplitPayment() { + return this.flgSplitPayment; + } + + public void setFlgSplitPayment(long flgSplitPayment) { + this.flgSplitPayment = flgSplitPayment; + } + + public String getNMatricola() { + return (this.nMatricola == null) ? AB_EMPTY_STRING : this.nMatricola; + } + + public void setNMatricola(String matricola) { + this.nMatricola = matricola; + } + + public long getProgOrdineWww() { + return this.progOrdineWww; + } + + public void setProgOrdineWww(long progOrdineWww) { + this.progOrdineWww = progOrdineWww; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, getId_articoloTessuto()); + return this.articoloTessuto; + } + + public void setArticoloTessuto(ArticoloTessuto articoloTessuto) { + this.articoloTessuto = articoloTessuto; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public void setId_articoloTessuto(long id_articoloTessuto) { + this.id_articoloTessuto = id_articoloTessuto; + setArticoloTessuto(null); + } + + public String getSearchArticolo() { + if (getId_articolo() > 0L) + return getDescrizioneCompletaArticolo(); + return (this.searchArticolo == null) ? AB_EMPTY_STRING : this.searchArticolo.trim(); + } + + public void setSearchArticolo(String searchArticolo) { + this.searchArticolo = searchArticolo; + } + + public long getId_iva() { + return this.id_iva; + } + + public void setId_iva(long id_iva) { + this.id_iva = id_iva; + } + + public long getFlgMl() { + return this.flgMl; + } + + public void setFlgMl(long flgMl) { + this.flgMl = flgMl; + } + + public long getFlgOss() { + return this.flgOss; + } + + public void setFlgOss(long flgOss) { + this.flgOss = flgOss; + } + + public long getFlgGRS() { + return this.flgGRS; + } + + public void setFlgGRS(long flgGRS) { + this.flgGRS = flgGRS; + } + + public String getId_nazione() { + return (this.id_nazione == null) ? AB_EMPTY_STRING : this.id_nazione.trim(); + } + + public Nazione getNazione() { + this.nazione = (Nazione)getSecondaryObject(this.nazione, Nazione.class, getId_nazione()); + return this.nazione; + } + + public void setId_nazione(String newId_nazione) { + this.id_nazione = newId_nazione; + setNazione(null); + } + + public void setNazione(Nazione newNazione) { + this.nazione = newNazione; + } + + public double getTotaleDocumentoDa() { + return this.totaleDocumentoDa; + } + + public void setTotaleDocumentoDa(double totaleDocumentoDa) { + this.totaleDocumentoDa = totaleDocumentoDa; + } + + public double getTotaleDocumentoA() { + return this.totaleDocumentoA; + } + + public void setTotaleDocumentoA(double totaleDocumentoA) { + this.totaleDocumentoA = totaleDocumentoA; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoInterface.java new file mode 100644 index 00000000..313a7fa5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoInterface.java @@ -0,0 +1,810 @@ +package it.acxent.contab; + +import it.acxent.anag.Aspetto; +import it.acxent.anag.CausaleTrasporto; +import it.acxent.anag.Clifor; +import it.acxent.anag.Comune; +import it.acxent.anag.DestinazioneDiversa; +import it.acxent.anag.Esercizio; +import it.acxent.anag.Iva; +import it.acxent.anag.Porto; +import it.acxent.anag.RegCassa; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.Users; +import it.acxent.anag.Vettore; +import it.acxent.common.Parm; +import it.acxent.contab.iva.RigheRegistroIva; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.ByteArrayOutputStream; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.Time; + +public interface DocumentoInterface { + ApplParmFull getApFull(); + + ResParm delete(); + + Parm getParm(String paramString); + + ResParm getFatturaElettronicaXml(); + + void findByPrimaryKey(long paramLong); + + void setId_documento(long paramLong); + + void setId_tipoDocumento(long paramLong); + + void setId_clifor(long paramLong); + + void setId_vettore(long paramLong); + + void setId_tipoPagamento(long paramLong); + + void setFlgSys(long paramLong); + + void setCurrentFocus(String paramString); + + void setFlgStato(long paramLong); + + void setDataDocumento(Date paramDate); + + void setProgDocumento(long paramLong); + + void setId_esercizio(long paramLong); + + void setRiferimento(String paramString); + + void setDataRiferimento(Date paramDate); + + void setFlgTipoDocumento(long paramLong); + + void setScontoIncondizionato(double paramDouble); + + void setDataPagamento(Date paramDate); + + void setDataRegistrazioneDI(Date paramDate); + + void setDichiarazioneIntento(String paramString); + + void setFlgArt8(long paramLong); + + void setFlgPagata(long paramLong); + + void setFlgExport(long paramLong); + + void setFlgTrasporto(long paramLong); + + void setKgLordo(double paramDouble); + + void setNColli(long paramLong); + + void setDataStampaBollato(Date paramDate); + + void setDataStampaIva(Date paramDate); + + void setFlgTrasportoAssicurato(long paramLong); + + void setNotaSpedizione(String paramString); + + void setDataConsegna(Date paramDate); + + void setOraConsegna(Time paramTime); + + void setSpeseTrasporto(double paramDouble); + + void setSpeseAltre(double paramDouble); + + void setDescSpeseAltre(String paramString); + + void setId_aspetto(long paramLong); + + long getId_documento(); + + long getId_tipoDocumento(); + + long getId_clifor(); + + long getId_vettore(); + + long getId_tipoPagamento(); + + long getFlgSys(); + + long getFlgStato(); + + Date getDataDocumento(); + + long getProgDocumento(); + + long getId_esercizio(); + + long getId_contatore(); + + String getRiferimento(); + + Date getDataRiferimento(); + + long getFlgTipoDocumento(); + + double getScontoIncondizionato(); + + Date getDataPagamento(); + + Date getDataRegistrazioneDI(); + + String getDichiarazioneIntento(); + + long getFlgArt8(); + + long getFlgPagata(); + + long getFlgExport(); + + long getFlgTrasporto(); + + double getKgLordo(); + + long getNColli(); + + Date getDataStampaBollato(); + + Date getDataStampaIva(); + + long getFlgTrasportoAssicurato(); + + String getNotaSpedizione(); + + Date getDataConsegna(); + + Time getOraConsegna(); + + double getSpeseTrasporto(); + + double getSpeseAltre(); + + String getDescSpeseAltre(); + + long getId_aspetto(); + + void setTipoDocumento(TipoDocumento paramTipoDocumento); + + TipoDocumento getTipoDocumento(); + + void setClifor(Clifor paramClifor); + + Clifor getClifor(); + + void setVettore(Vettore paramVettore); + + Vettore getVettore(); + + void setTipoPagamento(TipoPagamento paramTipoPagamento); + + TipoPagamento getTipoPagamento(); + + void setEsercizio(Esercizio paramEsercizio); + + Esercizio getEsercizio(); + + void setAspetto(Aspetto paramAspetto); + + Aspetto getAspetto(); + + String getTrasporto(); + + boolean isRigheConSeriali(); + + boolean isProgConBuchi(); + + boolean isProgConBuchi(long paramLong); + + ResParm save(); + + RigheRegistroIva getRigaRegistroIva(); + + RigheRegistroIva getRigaRegistroIvaCompleto(); + + Vectumerator findRigheDocumento(long paramLong, String paramString, int paramInt1, int paramInt2, int paramInt3); + + double getImponibileRighe(); + + void setImponibileRighe(double paramDouble); + + double getImportoIvaRighe(); + + void setImportoIvaRighe(double paramDouble); + + double getImportoRMRighe(); + + void setImportoRMRighe(double paramDouble); + + String getNumeroDocumento(); + + String getNumeroDocumentoCompleto(); + + double getTotaleDocumento(); + + double getImportoIvaTotale(); + + double getImponibileTotale(); + + String trovaPrimoBuco(); + + String trovaPrimoBuco(long paramLong); + + String getNote(); + + void setNote(String paramString); + + long getFlgStatoPrecedente(); + + void setFlgStatoPrecedente(long paramLong); + + ResParm delRigaDocumento(RigaDocumento paramRigaDocumento); + + void setImportoIvaTotale(double paramDouble); + + void setImponibileTotale(double paramDouble); + + double getTotaleAltriCosti(); + + long getFlgAutoAdd(); + + void setFlgAutoAdd(long paramLong); + + long getFlgSingleLineArt(); + + void setFlgSingleLineArt(long paramLong); + + ByteArrayOutputStream creaLabelDocumentoArticoliA4Pdf(DocumentoCR paramDocumentoCR); + + Documento getDocumentoFiglio(); + + void setDocumentoFiglio(Documento paramDocumento); + + long getId_documentoFiglio(); + + void setId_documentoFiglio(long paramLong); + + long getFlgEmettiFatturaScontrino(); + + void setFlgEmettiFatturaScontrino(long paramLong); + + ResParm generaScontrino(); + + boolean isScontrinoEmesso(); + + void setEchoScontrino(String paramString); + + ResParm stampaScontrino(boolean paramBoolean, RegCassa paramRegCassa); + + ResParm aggiornaEchoScontrino(String paramString); + + ResParm creaDocumentoFiglio(long paramLong1, long paramLong2, Users paramUsers, boolean paramBoolean, long paramLong3); + + String getEchoScontrino(); + + long getTipoRigaDocumento(); + + ByteArrayOutputStream creaDocumentoPdf(DocumentoCR paramDocumentoCR, boolean paramBoolean); + + String getNumeroDocumentoPdf(); + + Comune getComuneSped(); + + long getId_comuneSped(); + + String getIndirizzoSped(); + + String getPresso(); + + void setId_comuneSped(long paramLong); + + void setIndirizzoSped(String paramString); + + void setPresso(String paramString); + + void setComuneSped(Comune paramComune); + + String getDescrizioneDocumentiPadre(); + + boolean hasLabelDaStampare(); + + String getStato(); + + Vectumerator findRigheDocumentoPrelevabili(int paramInt1, int paramInt2); + + ResParm addRigaDocumentoDaPrelevare(RigaDocumento paramRigaDocumento, double paramDouble); + + ResParm delRigaDocumentoDaPrelevare(long paramLong1, long paramLong2); + + Vectumerator findRigheDocumentoPrelevateAssociate(int paramInt1, int paramInt2); + + String getNumeroCivicoSped(); + + void setNumeroCivicoSped(String paramString); + + String getDocumentoPrelevato(); + + void setFlgDocumentoPrelevato(long paramLong); + + void aggiornaFlgDocumentoPrelevato(long paramLong); + + void verificaEAggiornaFlgDocumentoPrelevato(); + + boolean isPrelevata(); + + long getTipoCaricoScarico(); + + ByteArrayOutputStream creaReportPdf(int paramInt, DocumentoCR paramDocumentoCR); + + double getImportoTotaleRigheCorrispettivi(); + + double getImportoTotale(); + + void setImportoTotale(double paramDouble); + + boolean isDataOkOld(); + + void findByProgressivoEsercizioContatore(long paramLong1, long paramLong2, long paramLong3); + + long getFlgMantieniArticoloRiga(); + + void setFlgMantieniArticoloRiga(long paramLong); + + double getAcconto(); + + void setAcconto(double paramDouble); + + long getFlgStatoPrenotazione(); + + void setFlgStatoPrenotazione(long paramLong); + + boolean isDocumentoFiglioCreabile(); + + boolean isCaricoConIva(); + + boolean hasRigheDocumento(); + + boolean hasRigheDocumento2(); + + long getNumPagDocumento(); + + void setNumPagDocumento(long paramLong); + + String getDescrizioneRigheHtmlOld(); + + void setAbbuono(double paramDouble); + + double getKgNetto(); + + void setKgNetto(double paramDouble); + + double getVolume(); + + void setVolume(double paramDouble); + + CausaleTrasporto getCausaleTrasporto(); + + void setCausaleTrasporto(CausaleTrasporto paramCausaleTrasporto); + + long getId_causaleTrasporto(); + + void setId_causaleTrasporto(long paramLong); + + double getSpeseIncasso(); + + void setSpeseIncasso(double paramDouble); + + double getTotaleDaPagare(); + + String getBancaDesc(); + + String getEMailDocumento(); + + void setBancaDesc(String paramString); + + void setEMailDocumento(String paramString); + + Vectumerator findRigheDocumento(long paramLong, int paramInt1, int paramInt2, int paramInt3); + + void setId_contatore(long paramLong); + + String getStatoPrenotazione(); + + String getStatoCompleto(); + + String getIban(); + + void setIban(String paramString); + + String getAbi(); + + String getCab(); + + String getConto(); + + void findPrimoScontrinoAperto(long paramLong); + + String getNotePagamento(); + + void setNotePagamento(String paramString); + + long getId_destinazioneDiversa(); + + void setId_destinazioneDiversa(long paramLong); + + DestinazioneDiversa getDestinazioneDiversa(); + + void setDestinazioneDiversa(DestinazioneDiversa paramDestinazioneDiversa); + + ResParm impostaFlgPagata(long paramLong); + + String getDescDocumenti(); + + void setDescDocumenti(String paramString); + + String getProgDocumentoAgg(); + + void setProgDocumentoAgg(String paramString); + + ByteArrayOutputStream creaLabelDocumentoArticoliAccA4Pdf(DocumentoCR paramDocumentoCR); + + boolean hasLabelAccessoriDaStampare(); + + Date getDataAvviso(); + + void setDataAvviso(Date paramDate); + + Date getDataChiusura(); + + void setDataChiusura(Date paramDate); + + long getId_users(); + + Users getUsers(); + + void setId_users(long paramLong); + + void setUsers(Users paramUsers); + + String getNominativoDocumento(); + + ResParm sendAvvisoRiparazione(); + + double getAbbuono(); + + String getCellDocumento(); + + void setCellDocumento(String paramString); + + long getFlgInviaAvviso(); + + void setFlgInviaAvviso(long paramLong); + + String getInviaAvviso(); + + ResParm aggiornaStatoPrenotazione(long paramLong1, long paramLong2); + + double getPercContIntegrativo(); + + void setPercContIntegrativo(double paramDouble); + + double getPercRitenutaAcconto(); + + void setPercRitenutaAcconto(double paramDouble); + + double getRimborsoArt15(); + + void setRimborsoArt15(double paramDouble); + + double getImportoContIntegrativo(); + + void setRigaRegistroIva(RigheRegistroIva paramRigheRegistroIva); + + void setRigaRegistroIvaCompleto(RigheRegistroIva paramRigheRegistroIva); + + double getTotaleDocumentoSenzaRitenuta(); + + double getImportoRitenutaAcconto(); + + Date getDataScadenzaPagamento(); + + void setDataScadenzaPagamento(Date paramDate); + + long getFlgPagamentoDataFissa(); + + void setFlgPagamentoDataFissa(long paramLong); + + String getPagamentoDataFissa(); + + long getFlgHaDocumentoPadre(); + + void setFlgHaDocumentoPadre(long paramLong); + + void findOrdineBozza(long paramLong); + + ByteArrayOutputStream creaSlip(DocumentoCR paramDocumentoCR); + + long getFlgInserisciReso(); + + void setFlgInserisciReso(long paramLong); + + String getDescrizioneRigheHtml(); + + long getTipoAvviso(); + + String getTipoAvvisoDesc(); + + long getFlgInGaranzia(); + + void setFlgInGaranzia(long paramLong); + + long getFlgStatoRiparazione(); + + void setFlgStatoRiparazione(long paramLong); + + double getCauzione(); + + void setCauzione(double paramDouble); + + String getStatoRiparazione(); + + long getFlgHasDocumentiPrelevabili(); + + void setFlgHasDocumentiPrelevabili(long paramLong); + + ResParm aggiornaStatoRiparazione(long paramLong); + + String getDescrizioneDifetto(); + + void setDescrizioneDifetto(String paramString); + + String getIntestazioneDocumento(); + + void setInterventoEffettuato(String paramString); + + long getFlgPreventivo(); + + void setFlgPreventivo(long paramLong); + + double getImportoPreventivo(); + + void setImportoPreventivo(double paramDouble); + + String getNotaAggiuntiva(); + + void setNotaAggiuntiva(String paramString); + + String getDescrizionePreventivo(); + + void setDescrizionePreventivo(String paramString); + + ResParm aggiornaDataAvviso(Date paramDate); + + void findDocumentoBozza(long paramLong1, long paramLong2); + + String getFaxDocumento(); + + void setFaxDocumento(String paramString); + + String getTelDocumento(); + + void setTelDocumento(String paramString); + + long getId_usersIntervento(); + + void setId_usersIntervento(long paramLong); + + long getId_usersChiusura(); + + void setId_usersChiusura(long paramLong); + + Users getUsersIntervento(); + + void setUsersIntervento(Users paramUsers); + + Users getUsersChiusura(); + + void setUsersChiusura(Users paramUsers); + + long getFlgStatoRiparazionePrecedente(); + + void setFlgStatoRiparazionePrecedente(long paramLong); + + String getInGaranzia(); + + Vectumerator findDocumentiFiglio(); + + Vectumerator findDocumentiPadre(); + + String getDescrizioneRigheHtmlCompleta(); + + boolean isUnDocumentoFiglioCreato(); + + String getDocumentiFigliDesc(); + + Documento getDocumentoFiglioUno(); + + void setDocumentoFiglioUno(Documento paramDocumento); + + long getId_porto(); + + void setId_porto(long paramLong); + + Porto getPorto(); + + void setPorto(Porto paramPorto); + + boolean isDataOk(); + + void findPrecedente(long paramLong1, long paramLong2, long paramLong3); + + void findSuccessiva(long paramLong1, long paramLong2, long paramLong3); + + long getId_tipoDocumentoFiglio(); + + void setId_tipoDocumentoFiglio(long paramLong); + + long getId_esercizioB(); + + void setId_esercizioB(long paramLong); + + long getProgDocumentoB(); + + void setProgDocumentoB(long paramLong); + + String getProgDocumentoAggB(); + + void setProgDocumentoAggB(String paramString); + + void findByCRCreateWC(DocumentoCR paramDocumentoCR, StringBuffer paramStringBuffer, WcString paramWcString); + + Vectumerator findByCR(DocumentoCR paramDocumentoCR, int paramInt1, int paramInt2); + + void findByCRCreateStmtDate(DocumentoCR paramDocumentoCR, PreparedStatement paramPreparedStatement); + + long getFlgDocumentoPrelevato(); + + boolean isRientro(String paramString); + + Vectumerator findRientri(String paramString); + + boolean hasRigheDocumentoPrenotazioneArrivate(); + + long getFlgTipoMovimento(); + + void setFlgTipoMovimento(long paramLong); + + ResParm delAllegato(AllegatoDocumento paramAllegatoDocumento); + + ResParm addAllegato(AllegatoDocumento paramAllegatoDocumento); + + Vectumerator getAllegati(long paramLong); + + void setNominativoDocumento(String paramString); + + long getId_cliforListino(); + + void setId_cliforListino(long paramLong); + + Clifor getCliforListino(); + + void setCliforListino(Clifor paramClifor); + + void applicaListinoByClifor(Clifor paramClifor); + + String getDescrizioneAllegato(); + + void setDescrizioneAllegato(String paramString); + + long getId_ivaDoc(); + + Iva getIvaDoc(); + + void setId_ivaDoc(long paramLong); + + void setIvaDoc(Iva paramIva); + + String getInterventoEffettuato(); + + double getImportoConsuntivo(); + + void setImportoConsuntivo(double paramDouble); + + ByteArrayOutputStream creaLabelDocumentoArticoliAccZebraPdf(DocumentoCR paramDocumentoCR); + + ByteArrayOutputStream creaLabelDocumentoArticoliZebraPdf(DocumentoCR paramDocumentoCR); + + String getDescTransaction(); + + void setDescTransaction(String paramString); + + Date getDataTransaction(); + + void setDataTransaction(Date paramDate); + + long getFlgProcediPagamento(); + + void setFlgProcediPagamento(long paramLong); + + long getFlgStatoOrdineWww(); + + void setFlgStatoOrdineWww(long paramLong); + + long getId_ordine(); + + String getStatoOrdineWww(); + + long getStatoPagato(); + + ResParm sendResoMailMessage(); + + void setId_ordine(long paramLong); + + String getCapSped(); + + String getCittaSped(); + + void setCapSped(String paramString); + + void setCittaSped(String paramString); + + String getProvinciaSped(); + + void setProvinciaSped(String paramString); + + String getPathAttach(); + + String getId_documentoXpay(); + + void setId_documentoXpay(String paramString); + + ResParm agiornaNuovoId_documentoXpay(); + + void findByDocumentoXpay(String paramString); + + ResParm sendOrderMailMessage(String paramString, boolean paramBoolean1, boolean paramBoolean2, boolean paramBoolean3); + + String getId_ordineCript(); + + ResParm stampaScontrinoEpson(boolean paramBoolean, RegCassa paramRegCassa); + + ResParm stampaReportFinanziario(RegCassa paramRegCassa); + + ResParm stampaReportGiornaliero(RegCassa paramRegCassa); + + ResParm ristampaScontrino(RegCassa paramRegCassa); + + long getLastUpdId_user(); + + String getCurrentTab(); + + long getCurrentTabId(); + + void setCurrentTab(String paramString); + + void setCurrentTabId(long paramLong); + + boolean isFatturaONotaDiCredito(); + + String getAbiCF(); + + String getCabCF(); + + String getContoCF(); + + long getTipoCaricoScarico2(); + + ResParm checkEMSTA(); + + Vectumerator findRigheDocumentoOBRiferimento(int paramInt1, int paramInt2); + + ResParm annullaOrdinamentoRighe(); + + boolean isDocumentoWwwNonPagato(); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoPDF.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoPDF.java new file mode 100644 index 00000000..77fb77ea --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoPDF.java @@ -0,0 +1,42 @@ +package it.acxent.contab; + +import com.lowagie.text.Document; +import com.lowagie.text.Table; + +public class DocumentoPDF { + private Document document; + + private Table pdfcorpo; + + public DocumentoPDF(Document document, Table pdfcorpo, int pageNumber) { + this.document = document; + this.pdfcorpo = pdfcorpo; + this.pageNumber = pageNumber; + } + + private int pageNumber = 0; + + public Document getDocument() { + return this.document; + } + + public void setDocument(Document document) { + this.document = document; + } + + public Table getPdfcorpo() { + return this.pdfcorpo; + } + + public void setPdfcorpo(Table pdfcorpo) { + this.pdfcorpo = pdfcorpo; + } + + public int getPageNumber() { + return this.pageNumber; + } + + public void setPageNumber(int pageNumber) { + this.pageNumber = pageNumber; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoPagamento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoPagamento.java new file mode 100644 index 00000000..b6818e0a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoPagamento.java @@ -0,0 +1,974 @@ +package it.acxent.contab; + +import com.lowagie.text.Cell; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Element; +import com.lowagie.text.HeaderFooter; +import com.lowagie.text.PageSize; +import com.lowagie.text.Phrase; +import com.lowagie.text.pdf.PdfWriter; +import it.acxent.anag.TipoPagamento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.FileWr; +import it.acxent.util.PdfFontFactory; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.Vectumerator; +import java.awt.Color; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.text.NumberFormat; +import java.util.Calendar; + +public class DocumentoPagamento extends _ContabAdapter implements Serializable { + private static final long serialVersionUID = 8044331984020899695L; + + private long id_documentoPagamento; + + private long id_documento; + + private Documento documento; + + private Date data; + + private double importo; + + private String nota; + + private long id_tipoPagamento; + + private TipoPagamento tipoPagamento; + + private long flgTipoMovimento; + + private long flgTipoIncasso; + + public static final long DOCUMENTI_TUTTI = 0L; + + public static final long DOCUMENTI_APERTI = 1L; + + public static final long DOCUMENTI_CHIUSI = 2L; + + public static final long TIPO_MOVIMENTO_DOCUMENTO = 1L; + + public static final long TIPO_MOVIMENTO_RATA = 2L; + + public static final long TIPO_MOVIMENTO_STORNO = 3L; + + public static final long TIPO_INCASSO_ACCONTO = 0L; + + public static final long TIPO_INCASSO_SALDO = 1L; + + public DocumentoPagamento(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DocumentoPagamento() {} + + public long getId_documentoPagamento() { + return this.id_documentoPagamento; + } + + public void setId_documentoPagamento(long id_incassoPagamento) { + this.id_documentoPagamento = id_incassoPagamento; + } + + public Date getData() { + return this.data; + } + + public void setData(Date data) { + this.data = data; + } + + public double getImporto() { + return this.importo; + } + + public void setImporto(double importo) { + this.importo = importo; + } + + public String getNota() { + return (this.nota == null) ? "" : this.nota.trim(); + } + + public void setNota(String nota) { + this.nota = nota; + } + + public long getId_documento() { + return this.id_documento; + } + + public void setId_documento(long id_documento) { + this.id_documento = id_documento; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento()); + return this.documento; + } + + public void setDocumento(Documento documento) { + this.documento = documento; + } + + public Vectumerator findByCROldxx(DocumentoPagamentoCR CR, int pageNumber, int pageRows) { + String pre_S_Sql_Find = "SELECT * FROM DOCUMENTO_PAGAMENTO AS A WHERE A.id_documento IN ("; + String post_S_Sql_Find = ")"; + String s_Sql_Find = ""; + if (CR.getFlgTipoSaldo() > 0L) { + s_Sql_Find = "select A.id_documento "; + } else { + s_Sql_Find = "select A.* "; + } + s_Sql_Find = s_Sql_Find + " FROM DOCUMENTO_PAGAMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento "; + String s_Sql_Group = ""; + String s_Sql_Order = " ORDER BY B.progDocumento, B.dataDocumento "; + String s_Sql_Having = ""; + if (!CR.getFlgReport().isEmpty()) + s_Sql_Order = " ORDER BY B.nominativoDocumento, B.progDocumento, B.dataDocumento "; + WcString wc = new WcString(); + if (CR.getId_clifor() > 0L) + wc.addWc(" B.id_clifor = " + CR.getId_clifor()); + if (CR.getDataDa() != null) + wc.addWc(" A.data >= ? "); + if (CR.getDataA() != null) + wc.addWc(" A.data <= ? "); + if (CR.getDataFatturaDa() != null) + wc.addWc(" B.dataDocumento >= ? "); + if (CR.getDataFatturaA() != null) + wc.addWc(" B.dataDocumento <= ? "); + if (CR.getId_tipoPagamentoS() > 0L) + wc.addWc(" A.id_tipoPagamento = " + CR.getId_tipoPagamentoS()); + if (CR.getNumeroFattura() > 0L) + wc.addWc(" B.progDocumento = " + CR.getNumeroFattura()); + if (CR.getAnnoFattura() > 0L) + wc.addWc(" B.id_esercizio = " + CR.getAnnoFattura()); + if (CR.getId_documento() > 0L) + wc.addWc(" A.id_documento = " + CR.getId_documento()); + if (CR.getId_tipoDocumento() > 0L) + wc.addWc(" B.id_tipoDocumento = " + CR.getId_tipoDocumento()); + if (!CR.getRiferimento().isEmpty()) { + s_Sql_Find = s_Sql_Find + " inner join TIPO_DOCUMENTO AS T ON B.id_tipoDocumento=T.id_tipoDocumento"; + wc.addWc(" T.riferimento = '" + CR.getRiferimento() + "'"); + } + String sql = ""; + if (CR.getFlgTipoSaldo() > 0L) { + sql = pre_S_Sql_Find + pre_S_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having + s_Sql_Order; + } else { + sql = s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having; + } + try { + PreparedStatement stmt = getConn().prepareStatement(sql); + int dataCount = 0; + if (CR.getDataDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDa()); + } + if (CR.getDataA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataA()); + } + if (CR.getDataFatturaDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataFatturaDa()); + } + if (CR.getDataFatturaA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataFatturaA()); + } + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findSaldiByCR(DocumentoPagamentoCR CR, int pageNumber, int pageRows) { + String pre_S_Sql_Find = "SELECT * FROM DOCUMENTO_PAGAMENTO AS A WHERE A.id_documento IN ("; + String post_S_Sql_Find = ")"; + String s_Sql_Find = ""; + if (CR.getFlgTipoSaldo() > 0L) { + s_Sql_Find = "select A.id_documento "; + } else { + s_Sql_Find = "select A.* "; + } + s_Sql_Find = s_Sql_Find + " FROM DOCUMENTO_PAGAMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento "; + String s_Sql_Group = ""; + String s_Sql_Order = " ORDER BY B.progDocumento, B.dataDocumento "; + String s_Sql_Having = ""; + if (CR.getFlgTipoSaldo() == 1L) { + s_Sql_Group = " GROUP BY id_documento "; + s_Sql_Having = " HAVING SUM(importo) > 0 "; + } else if (CR.getFlgTipoSaldo() == 2L) { + s_Sql_Group = " GROUP BY id_documento "; + s_Sql_Having = " HAVING SUM(importo) <= 0 "; + } + if (!CR.getFlgReport().isEmpty()) + s_Sql_Order = " ORDER BY B.nominativoDocumento, B.progDocumento, B.dataDocumento "; + WcString wc = new WcString(); + if (CR.getId_clifor() > 0L) + wc.addWc(" B.id_clifor = " + CR.getId_clifor()); + if (CR.getDataDa() != null) + wc.addWc(" A.data >= ? "); + if (CR.getDataA() != null) + wc.addWc(" A.data <= ? "); + if (CR.getDataFatturaDa() != null) + wc.addWc(" B.dataDocumento >= ? "); + if (CR.getDataFatturaA() != null) + wc.addWc(" B.dataDocumento <= ? "); + if (CR.getId_tipoPagamentoS() > 0L) + wc.addWc(" A.id_tipoPagamento = " + CR.getId_tipoPagamentoS()); + if (CR.getNumeroFattura() > 0L) + wc.addWc(" B.progDocumento = " + CR.getNumeroFattura()); + if (CR.getAnnoFattura() > 0L) + wc.addWc(" B.id_esercizio = " + CR.getAnnoFattura()); + if (CR.getId_documento() > 0L) + wc.addWc(" A.id_documento = " + CR.getId_documento()); + String sql = ""; + if (CR.getFlgTipoSaldo() > 0L) { + sql = pre_S_Sql_Find + pre_S_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having + s_Sql_Order; + } else { + sql = s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having; + } + try { + PreparedStatement stmt = getConn().prepareStatement(sql); + int dataCount = 0; + if (CR.getDataDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDa()); + } + if (CR.getDataA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataA()); + } + if (CR.getDataFatturaDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataFatturaDa()); + } + if (CR.getDataFatturaA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataFatturaA()); + } + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void deleteCascade() {} + + public void findRecordDocumentoByDocumento(long id_documento) { + String s_Sql_Find = "select A.* from DOCUMENTO_PAGAMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_documento = " + id_documento); + wc.addWc(" A.flgTipoMovimento = 1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public double getSaldoControlloByDocumento() { + String s_Sql_Find = "select SUM(importo) AS _sum from DOCUMENTO_PAGAMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_documento = " + getId_documento()); + if (getId_documentoPagamento() > 0L) + wc.addWc(" A.id_documentoPagamento != " + getId_documentoPagamento()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public double getSaldoByDocumento(long id_documento) { + String s_Sql_Find = "select SUM(importo) AS _sum from DOCUMENTO_PAGAMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_documento = " + id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public double getTotByDocumento(long id_documento) { + String s_Sql_Find = "select SUM(importo) as _sum from DOCUMENTO_PAGAMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_documento = " + id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public double getSaldoRateByDocumento(long id_documento) { + String s_Sql_Find = "select SUM(importo) as _sum from DOCUMENTO_PAGAMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_documento = " + id_documento); + wc.addWc(" (A.flgTipoMovimento = 2 OR A.flgTipoMovimento = 3)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public ResParm delete() { + ResParm rp = new ResParm(true); + rp = super.delete(); + return rp; + } + + public Vectumerator findByClifor(long id_clifor, long tipoDocumenti) { + String s_Sql_Find = "select A.*, SUM(importo) AS importo, B.flgPagata as flgPagata FROM DOCUMENTO_PAGAMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento "; + String s_Sql_Group = " GROUP BY id_documento"; + String s_Sql_Order = ""; + String s_Sql_Having = ""; + WcString wc = new WcString(); + wc.addWc(" B.id_clifor = " + id_clifor); + if (tipoDocumenti == 1L) { + s_Sql_Having = " HAVING SUM(importo) != 0 and (flgPagata is null or flgPagata=0)"; + } else if (tipoDocumenti == 2L) { + s_Sql_Having = " HAVING SUM(importo) = 0"; + } + try { + PreparedStatement stmt = getConn() + .prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Order); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_tipoPagamento() { + return this.id_tipoPagamento; + } + + public void setId_tipoPagamento(long id_tipoPagamento) { + this.id_tipoPagamento = id_tipoPagamento; + } + + public TipoPagamento getTipoPagamento() { + this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, getId_tipoPagamento()); + return this.tipoPagamento; + } + + public void setTipoPagamento(TipoPagamento pagamento) { + this.tipoPagamento = pagamento; + } + + public long getFlgTipoMovimento() { + return this.flgTipoMovimento; + } + + public void setFlgTipoMovimento(long flgTipoMovimento) { + this.flgTipoMovimento = flgTipoMovimento; + } + + public ResParm save() { + if (getFlgTipoMovimento() == 2L || getFlgTipoMovimento() == 3L) { + if (getDocumento().getTipoDocumento().isFatturaVendita() || getDocumento().getTipoDocumento().isNotaCreditoAcquisto()) + setImporto(-1.0D * getImporto()); + } else if (getFlgTipoMovimento() == 1L) { + if (getDocumento().getTipoDocumento().isFatturaAcquisto() || getDocumento().getTipoDocumento().isNotaCreditoVendita()) + setImporto(-1.0D * getImporto()); + } + ResParm rp = super.save(); + if (rp.getStatus() && + getFlgTipoMovimento() == 2L) { + if (getFlgTipoIncasso() != 1L) { + double totDoc = getTotByDocumento(this.id_documento); + if (getDocumento().getTipoDocumento().isFatturaAcquisto() || getDocumento().getTipoDocumento().isNotaCreditoVendita()) + totDoc *= -1.0D; + if (totDoc <= 0.0D) { + setFlgTipoIncasso(1L); + } else { + setFlgTipoIncasso(0L); + } + } + if (getFlgTipoIncasso() == 1L) { + Documento doc = new Documento(getApFull()); + doc.findByPrimaryKey(getId_documento()); + doc.impostaPagato(getData()); + } + } + return rp; + } + + public double getImportoVis() { + if (getImporto() < 0.0D) + return getImporto() * -1.0D; + return getImporto(); + } + + protected void afterDelete() { + super.afterDelete(); + } + + public boolean hasPagamentiEffettuatiByDocumento(long id_documento) { + String s_Sql_Find = "select A.* from DOCUMENTO_PAGAMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_documento = " + id_documento); + wc.addWc(" A.flgTipoMovimento = 2"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt, 1, 1); + return vec.hasMoreElements(); + } catch (SQLException e) { + handleDebug(e); + return false; + } + } + + public Vectumerator findByDocumento(long l_id_documento) { + if (l_id_documento == 0L) + return AB_EMPTY_VECTUMERATOR; + String s_Sql_Find = "select A.* from DOCUMENTO_PAGAMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_documento = " + l_id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgTipoIncasso() { + return this.flgTipoIncasso; + } + + public void setFlgTipoIncasso(long flgTipoIncasso) { + this.flgTipoIncasso = flgTipoIncasso; + } + + public static final String getTipoIncasso(long l_flgTipoIncasso) { + String ret = ""; + if (l_flgTipoIncasso == 0L) { + ret = "Acconto"; + } else if (l_flgTipoIncasso == 1L) { + ret = "Saldo"; + } + return ret; + } + + public String getTipoIncasso() { + return getTipoIncasso(getFlgTipoIncasso()); + } + + public String getDescrizioneTipoMovimento() { + String ret = ""; + if (getFlgTipoMovimento() == 1L) { + ret = "Documento"; + } else if (getFlgTipoMovimento() == 2L) { + ret = "Rata"; + } else if (getFlgTipoMovimento() == 3L) { + ret = "Storno"; + } + return ret; + } + + public Vectumerator findByCR(DocumentoPagamentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "SELECT A.* FROM DOCUMENTO_PAGAMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento inner join CLIFOR AS C ON B.id_clifor=C.id_clifor"; + String s_Sql_Order = " ORDER BY B.id_esercizio, B.progDocumento, B.dataDocumento "; + if (!CR.getFlgReport().isEmpty()) + if (CR.getFlgClienteFornitore().equals("F")) { + s_Sql_Order = " ORDER BY C.cognome, C.nome , B.dataRiferimento, B.riferimento "; + } else { + s_Sql_Order = " ORDER BY C.cognome, C.nome ,B.id_esercizio, B.progDocumento, B.dataDocumento "; + } + if (CR.getDataScadenzaA() != null || CR.getDataScadenzaDa() != null) + s_Sql_Find = s_Sql_Find + " left join DOCUMENTO_SCADENZA AS DS ON B.id_documento=DS.id_documento"; + WcString wc = new WcString(); + if (CR.getId_clifor() > 0L) + wc.addWc(" B.id_clifor = " + CR.getId_clifor()); + if (CR.getId_tipoPagamentoS() > 0L) + wc.addWc(" A.id_tipoPagamento = " + CR.getId_tipoPagamentoS()); + if (CR.getNumeroFattura() > 0L) + wc.addWc(" B.progDocumento = " + CR.getNumeroFattura()); + if (CR.getAnnoFattura() > 0L) + wc.addWc(" B.id_esercizio = " + CR.getAnnoFattura()); + if (CR.getId_documento() > 0L) + wc.addWc(" A.id_documento = " + CR.getId_documento()); + if (CR.getId_tipoDocumento() > 0L) + wc.addWc(" B.id_tipoDocumento = " + CR.getId_tipoDocumento()); + if (!CR.getRiferimento().isEmpty() || !CR.getFlgClienteFornitore().isEmpty()) { + s_Sql_Find = s_Sql_Find + " inner join TIPO_DOCUMENTO AS T ON B.id_tipoDocumento=T.id_tipoDocumento"; + if (!CR.getRiferimento().isEmpty()) + wc.addWc(" T.riferimento = '" + CR.getRiferimento() + "'"); + if (!CR.getFlgClienteFornitore().isEmpty()) + wc.addWc(" T.flgClienteFornitore = '" + CR.getFlgClienteFornitore() + "'"); + } + if (CR.getFlgTipoSaldo() == 1L) { + wc.addWc("( B.flgPagata is null or B.flgPagata =0) "); + } else if (CR.getFlgTipoSaldo() == 2L) { + wc.addWc("B.flgPagata= 1 "); + } + if (!CR.getFlgTipoClifor().isEmpty()) + wc.addWc("C.flgTipo='" + CR.getFlgTipoClifor() + "'"); + if (CR.getDataDa() != null) + wc.addWc(" A.data >= ? "); + if (CR.getDataA() != null) + wc.addWc(" A.data <= ? "); + if (CR.getDataFatturaDa() != null) + wc.addWc(" B.dataDocumento >= ? "); + if (CR.getDataFatturaA() != null) + wc.addWc(" B.dataDocumento <= ? "); + if (CR.getDataRiferimentoDa() != null) + wc.addWc(" B.dataRiferimento >= ? "); + if (CR.getDataRiferimentoA() != null) + wc.addWc(" B.dataRiferimento <= ? "); + if (CR.getDataScadenzaDa() != null) + wc.addWc(" DS.dataScadenza >= ? "); + if (CR.getDataScadenzaA() != null) + wc.addWc(" DS.dataScadenza <= ? "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + int dataCount = 0; + if (CR.getDataDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDa()); + } + if (CR.getDataA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataA()); + } + if (CR.getDataFatturaDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataFatturaDa()); + } + if (CR.getDataFatturaA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataFatturaA()); + } + if (CR.getDataRiferimentoDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataRiferimentoDa()); + } + if (CR.getDataRiferimentoA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataRiferimentoA()); + } + if (CR.getDataScadenzaDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataScadenzaDa()); + } + if (CR.getDataScadenzaA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataScadenzaA()); + } + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ByteArrayOutputStream creaReportPdf(DocumentoPagamentoCR CR) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + Calendar cal = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + SimpleDateFormat sdfh = new SimpleDateFormat("hh:mm"); + Phrase pH = new Phrase("Data/ora stampa: " + sdf.format(getToday()) + " " + sdfh.format(Long.valueOf(cal.getTimeInMillis())) + " pag. "); + HeaderFooter footer = new HeaderFooter(pH, true); + footer.setAlignment(2); + footer.setBorder(0); + this.document.setFooter(footer); + this.document.open(); + CR.setFilePdf(getPathTmpFull() + "ReportPagamenti.pdf"); + this.document = creaReport(CR); + this.document.close(); + this.document = null; + FileOutputStream fos = new FileOutputStream(new File(CR.getFilePdf())); + fos.write(ba.toByteArray()); + fos.close(); + System.out.println("Creato file documento " + CR.getFilePdf()); + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public ResParm creaFileCvs(DocumentoPagamentoCR CR) { + ResParm rp = new ResParm(true); + try { + Vectumerator list = findByCR(CR, 0, 0); + DoubleOperator dpRottura = new DoubleOperator(); + DoubleOperator dpReport = new DoubleOperator(); + DoubleOperator scadCliforTotal = new DoubleOperator(); + DoubleOperator scadGrandTotal = new DoubleOperator(); + String salvaDescrizioneCliente = ""; + long l_id_clifor = 0L; + CR.setFileName(getPathTmp() + "exportPagamenti_" + getPathTmp() + "_" + getTimeNameForFileUpload() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "Criteri di ricerca: " + CR.getDescrizioneCR() + "\nIntestazione;Documento;Data;Importo;Nota;Saldo;Data Scadenza;Importo Scadenza"; + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + String l_numDocumento, l_dataDocumento, l_nota; + DocumentoPagamento row = (DocumentoPagamento)list.nextElement(); + System.out.println("creaFileCvs: " + row.getDocumento().getClifor().getDescrizioneCompleta() + " " + + row.getId_documentoPagamento()); + if (row.getId_documentoPagamento() == 41407L) + System.out.println("aaaa"); + if (l_id_clifor != row.getDocumento().getId_clifor()) { + if (l_id_clifor > 0L) { + s1 = SEP + SEP + SEP + SEP + "TOTALE PER " + SEP + salvaDescrizioneCliente + SEP + getNf().format(dpRottura.getResult()) + SEP + SEP; + outCvsFile.writeLine(s1); + dpRottura = new DoubleOperator(); + scadCliforTotal = new DoubleOperator(); + } + salvaDescrizioneCliente = ""; + } + salvaDescrizioneCliente = row.getDocumento().getClifor().getDescrizioneCompleta(); + if (row.getDocumento().getTipoDocumento().getFlgClienteFornitore().equals("F")) { + l_numDocumento = row.getDocumento().getRiferimento(); + l_dataDocumento = getDataFormat().format(row.getDocumento().getDataRiferimento()); + } else { + l_numDocumento = row.getDocumento().getNumeroDocumentoCompleto(); + l_dataDocumento = getDataFormat().format(row.getDocumento().getDataDocumento()); + } + String l_importo = getNf().format(row.getImporto()); + if (row.getFlgTipoMovimento() != 1L) { + l_nota = "Pagamento - " + row.getNota(); + } else { + l_nota = row.getNota(); + } + s1 = salvaDescrizioneCliente + salvaDescrizioneCliente + SEP + l_numDocumento + SEP + l_dataDocumento + SEP + l_importo + SEP; + outCvsFile.writeLine(s1); + dpRottura.add(row.getImporto()); + dpReport.add(row.getImporto()); + l_id_clifor = row.getDocumento().getId_clifor(); + if (row.getId_tipoPagamento() == 0L) { + Vectumerator vecScadenze = row.getDocumento().getElencoScadenze(CR); + while (vecScadenze.hasMoreElements()) { + DocumentoScadenza rowBeanDS = (DocumentoScadenza)vecScadenze.nextElement(); + s1 = ";;;;;;" + getDataFormat().format(rowBeanDS.getDataScadenza()) + SEP + getNf().format(rowBeanDS.getImportoScadenza()); + outCvsFile.writeLine(s1); + scadCliforTotal.add(rowBeanDS.getImportoScadenza()); + scadGrandTotal.add(rowBeanDS.getImportoScadenza()); + } + } + } + if (l_id_clifor > 0L) { + s1 = SEP + SEP + SEP + SEP + "TOTALE PER " + SEP + SEP + getNf().format(dpRottura.getResult()) + SEP + SEP; + outCvsFile.writeLine(s1); + } + if (dpReport.getResult() != 0.0D) { + s1 = SEP + SEP + SEP + SEP + "TOTALE REPORT" + SEP + SEP + getNf().format(dpReport.getResult()) + SEP + SEP; + outCvsFile.writeLine(s1); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + rp.setException(e); + rp.setStatus(false); + } + return rp; + } + + public String getDescrizioneFlgTipoIncasso() { + String ret = ""; + if (getFlgTipoIncasso() == 0L) { + ret = "Acconto"; + } else if (getFlgTipoIncasso() == 1L) { + ret = "Saldo"; + } + return ret; + } + + public static final String getTipoMovimento(long l_flgTipoMovimento) { + String ret = ""; + if (l_flgTipoMovimento == 1L) { + ret = "Documento"; + } else if (l_flgTipoMovimento == 2L) { + ret = "Rata"; + } else if (l_flgTipoMovimento == 3L) { + ret = "Storno"; + } + return ret; + } + + public String getTipoMovimento() { + return getTipoMovimento(getFlgTipoMovimento()); + } + + public long getId_clifor() { + return getDocumento().getId_clifor(); + } + + private Document creaReport(DocumentoPagamentoCR CR) { + try { + prepareNewPdfCorpoDocument(); + int cellLeading = 10; + NumberFormat nf = NumberFormat.getInstance(); + nf.setMinimumFractionDigits(2); + nf.setMaximumFractionDigits(2); + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + long id_clifor = 0L; + DoubleOperator dpRottura = new DoubleOperator(); + DoubleOperator dpReport = new DoubleOperator(); + String salvaDescrizioneCliente = ""; + Cell cell = new Cell(); + cell.add(new Chunk("REPORT PAGAMENTI", PdfFontFactory.PDF_fIntestazione)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(CR.getCriteriDiRicerca(), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Documento", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Data", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Importo", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Nota", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + this.pdfcorpo.endHeaders(); + CR.setFlgReport("S"); + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + DocumentoPagamento doc = (DocumentoPagamento)vec.nextElement(); + if (id_clifor != doc.getDocumento().getId_clifor()) { + if (id_clifor > 0L) { + cell = new Cell(new Chunk("Totale per " + salvaDescrizioneCliente, PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(dpRottura.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + dpRottura = new DoubleOperator(); + } + if (!doc.getDocumento().getClifor().getNominativoCompleto().isEmpty()) { + cell = new Cell(new Chunk(doc.getDocumento().getClifor().getDescrizioneCompleta(), PdfFontFactory.PDF_fGrandeB)); + if (doc.getDocumento().getClifor().getFlgTipo().equals("F")) { + cell.add(new Chunk(" iban: " + doc.getDocumento().getClifor().getIban(), PdfFontFactory.PDF_fGrandeB)); + cell.add(new Chunk(" Pag: " + doc.getDocumento().getTipoPagamento().getDescrizione(), PdfFontFactory.PDF_fMedioB)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + } + salvaDescrizioneCliente = ""; + } + if (doc.getFlgTipoMovimento() == 1L) { + if (doc.getDocumento().getTipoDocumento().getFlgClienteFornitore().equals("F")) { + cell = new Cell(new Chunk(doc.getDocumento().getRiferimento(), PdfFontFactory.PDF_fMedio)); + } else { + cell = new Cell(new Chunk(doc.getDocumento().getNumeroDocumentoCompleto(), PdfFontFactory.PDF_fMedio)); + } + } else { + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + if (doc.getFlgTipoMovimento() == 1L) { + if (doc.getDocumento().getTipoDocumento().getFlgClienteFornitore().equals("F")) { + cell = new Cell(new Chunk(df.format(doc.getDocumento().getDataRiferimento()), PdfFontFactory.PDF_fMedio)); + } else { + cell = new Cell(new Chunk(df.format(doc.getDocumento().getDataDocumento()), PdfFontFactory.PDF_fMedio)); + } + } else { + cell = new Cell(new Chunk(df.format(doc.getData()), PdfFontFactory.PDF_fMedio)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(doc.getImporto()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + if (doc.getFlgTipoMovimento() != 1L) { + cell = new Cell(new Chunk("Pagamento - ", PdfFontFactory.PDF_fMedio)); + cell.add(new Chunk(doc.getNota(), PdfFontFactory.PDF_fMedio)); + } else { + cell = new Cell(new Chunk(doc.getNota(), PdfFontFactory.PDF_fMedio)); + } + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + dpRottura.add(doc.getImporto()); + dpReport.add(doc.getImporto()); + salvaDescrizioneCliente = doc.getDocumento().getClifor().getNominativoCompleto(); + id_clifor = doc.getDocumento().getId_clifor(); + } + if (id_clifor > 0L) { + cell = new Cell(new Chunk("Totale per " + salvaDescrizioneCliente, PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(dpRottura.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + } + if (dpReport.getResult() != 0.0D) { + cell = new Cell(new Chunk("Totale Report ", PdfFontFactory.PDF_fGrandissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(dpReport.getResult()), PdfFontFactory.PDF_fGrandissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + } + this.document.add((Element)this.pdfcorpo); + } catch (Exception e) { + e.printStackTrace(); + } + return this.document; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoPagamentoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoPagamentoCR.java new file mode 100644 index 00000000..0ff72dc0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoPagamentoCR.java @@ -0,0 +1,423 @@ +package it.acxent.contab; + +import it.acxent.anag.Clifor; +import it.acxent.anag.TipoPagamento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.util.SimpleDateFormat; +import java.io.Serializable; +import java.sql.Date; + +public class DocumentoPagamentoCR extends CRAdapter implements Serializable { + private static final long serialVersionUID = 8044331984020899695L; + + private long id_documentoPagamento; + + private Date data; + + private double importo; + + private String nota; + + private long id_documento; + + private Documento documento; + + private long id_tipoPagamentoS; + + private Date dataDa; + + private Date dataA; + + private Date dataFatturaDa; + + private Date dataScadenzaA; + + private long numeroFattura; + + private long annoFattura; + + private long id_clifor; + + private Clifor clifor; + + private long flgTipoSaldo = 1L; + + private long id_tipoDocumento; + + private long flgTipoIncasso; + + private String filePdf; + + private String flgClienteFornitore; + + public static final long SALDO_DOCUMENTI_TUTTI = 0L; + + public static final long SALDO_DOCUMENTI_APERTI = 1L; + + public static final long SALDO_DOCUMENTI_CHIUSI = 2L; + + private String riferimento; + + private long flgTipoMovimento; + + private TipoPagamento tipoPagamento; + + private TipoDocumento tipoDocumento; + + private Date dataFatturaA; + + private Date dataScadenzaDa; + + private String flgTipoClifor; + + private Date dataRiferimentoDa; + + private Date dataRiferimentoA; + + public DocumentoPagamentoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DocumentoPagamentoCR() {} + + public long getId_documentoPagamento() { + return this.id_documentoPagamento; + } + + public void setId_documentoPagamento(long id_incassoPagamento) { + this.id_documentoPagamento = id_incassoPagamento; + } + + public Date getData() { + return this.data; + } + + public void setData(Date data) { + this.data = data; + } + + public double getImporto() { + return this.importo; + } + + public void setImporto(double importo) { + this.importo = importo; + } + + public String getNota() { + return (this.nota == null) ? "" : this.nota; + } + + public void setNota(String nota) { + this.nota = nota; + } + + public long getId_documento() { + return this.id_documento; + } + + public void setId_documento(long id_documento) { + this.id_documento = id_documento; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento()); + return this.documento; + } + + public void setDocumento(Documento documento) { + this.documento = documento; + } + + public long getId_tipoPagamentoS() { + return this.id_tipoPagamentoS; + } + + public void setId_tipoPagamentoS(long id_tipoPagamento) { + this.id_tipoPagamentoS = id_tipoPagamento; + } + + public Date getDataDa() { + return this.dataDa; + } + + public void setDataDa(Date dataDa) { + this.dataDa = dataDa; + } + + public Date getDataA() { + return this.dataA; + } + + public void setDataA(Date dataA) { + this.dataA = dataA; + } + + public Date getDataFatturaDa() { + return this.dataFatturaDa; + } + + public void setDataFatturaDa(Date dataFatturaDa) { + this.dataFatturaDa = dataFatturaDa; + } + + public Date getDataFatturaA() { + return this.dataFatturaA; + } + + public void setDataFatturaA(Date dataFatturaA) { + this.dataFatturaA = dataFatturaA; + } + + public long getNumeroFattura() { + return this.numeroFattura; + } + + public void setNumeroFattura(long numeroFattura) { + this.numeroFattura = numeroFattura; + } + + public long getAnnoFattura() { + return this.annoFattura; + } + + public void setAnnoFattura(long annoFattura) { + this.annoFattura = annoFattura; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setClifor(Clifor clifor) { + this.clifor = clifor; + } + + public long getFlgTipoSaldo() { + return this.flgTipoSaldo; + } + + public void setFlgTipoSaldo(long flgTipoSaldo) { + this.flgTipoSaldo = flgTipoSaldo; + } + + public long getId_tipoDocumento() { + return this.id_tipoDocumento; + } + + public void setId_tipoDocumento(long id_tipoDocumento) { + this.id_tipoDocumento = id_tipoDocumento; + } + + public long getFlgTipoIncasso() { + return this.flgTipoIncasso; + } + + public void setFlgTipoIncasso(long flgTipoIncasso) { + this.flgTipoIncasso = flgTipoIncasso; + } + + public long getFlgTipoMovimento() { + return this.flgTipoMovimento; + } + + public void setFlgTipoMovimento(long tipoMovimento) { + this.flgTipoMovimento = tipoMovimento; + } + + public String getRiferimento() { + return (this.riferimento == null) ? AB_EMPTY_STRING : this.riferimento.trim(); + } + + public void setRiferimento(String riferimento) { + this.riferimento = riferimento; + } + + public String getFilePdf() { + return this.filePdf; + } + + public void setFilePdf(String filePdf) { + this.filePdf = filePdf; + } + + public String getFlgClienteFornitore() { + return (this.flgClienteFornitore == null) ? AB_EMPTY_STRING : this.flgClienteFornitore; + } + + public void setFlgClienteFornitore(String flgAttivoPassivo) { + this.flgClienteFornitore = flgAttivoPassivo; + } + + public String getCriteriDiRicerca() { + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + StringBuilder sb = new StringBuilder(); + if (getId_clifor() > 0L) + sb.append("Cliente: " + getClifor().getCognomeNome()); + if (getDataDa() != null) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Data Da: " + df.format(getDataDa())); + } + if (getDataA() != null) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Data A: " + df.format(getDataA())); + } + if (getFlgTipoSaldo() == 0L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Tipo: Tutte"); + } + if (getFlgTipoSaldo() == 1L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Tipo: Aperte"); + } + if (getFlgTipoSaldo() == 2L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Tipo: Chiuse"); + } + if (getId_tipoPagamentoS() > 0L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Tipo Pagamento: " + getTipoPagamento().getDescrizione()); + } + if (!getRiferimento().isEmpty()) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Riferimento: " + getRiferimento()); + } + if (getId_tipoDocumento() > 0L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Tipo Documento: " + getTipoDocumento().getDescrizione()); + } + if (getNumeroFattura() > 0L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Numero Fattura: " + getNumeroFattura()); + } + if (getAnnoFattura() > 0L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Anno Fattura: " + getAnnoFattura()); + } + if (getDataFatturaDa() != null) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Data Doc. Da: " + df.format(getDataFatturaDa())); + } + if (getDataFatturaA() != null) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Data Doc. A: " + df.format(getDataFatturaA())); + } + if (getDataRiferimentoDa() != null) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Data Rif. Da: " + df.format(getDataRiferimentoDa())); + } + if (getDataRiferimentoA() != null) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Data Rif. A: " + df.format(getDataRiferimentoA())); + } + if (getFlgClienteFornitore().equals("C")) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Attività/Passività: Attività"); + } + if (getFlgClienteFornitore().equals("F")) { + if (sb.length() > 0) + sb.append(" "); + sb.append("Attività/Passività: Passività"); + } + return sb.toString(); + } + + public TipoPagamento getTipoPagamento() { + this.tipoPagamento = (TipoPagamento)getSecondaryObject(this.tipoPagamento, TipoPagamento.class, getId_tipoPagamentoS()); + return this.tipoPagamento; + } + + public void setTipoPagamento(TipoPagamento tipoPagamento) { + this.tipoPagamento = tipoPagamento; + } + + public TipoDocumento getTipoDocumento() { + this.tipoDocumento = (TipoDocumento)getSecondaryObject(this.tipoDocumento, TipoDocumento.class, getId_tipoDocumento()); + return this.tipoDocumento; + } + + public void setTipoDocumento(TipoDocumento tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public static final String getTipoIncasso(long l_flgTipoIncasso) { + return DocumentoPagamento.getTipoIncasso(l_flgTipoIncasso); + } + + public static final String getTipoMovimento(long l_flgTipoMovimento) { + return DocumentoPagamento.getTipoMovimento(l_flgTipoMovimento); + } + + public String getTipoIncasso() { + return DocumentoPagamento.getTipoIncasso(getFlgTipoIncasso()); + } + + public String getTipoMovimento() { + return DocumentoPagamento.getTipoMovimento(getFlgTipoMovimento()); + } + + public Date getDataScadenzaA() { + return this.dataScadenzaA; + } + + public void setDataScadenzaA(Date dataScadenzaA) { + this.dataScadenzaA = dataScadenzaA; + } + + public Date getDataScadenzaDa() { + return this.dataScadenzaDa; + } + + public void setDataScadenzaDa(Date dataScadenzaDa) { + this.dataScadenzaDa = dataScadenzaDa; + } + + public String getFlgTipoClifor() { + return (this.flgTipoClifor == null) ? AB_EMPTY_STRING : this.flgTipoClifor.trim(); + } + + public void setFlgTipoClifor(String flgTipoClifor) { + this.flgTipoClifor = flgTipoClifor; + } + + public Date getDataRiferimentoDa() { + return this.dataRiferimentoDa; + } + + public void setDataRiferimentoDa(Date dataRiferimentoDa) { + this.dataRiferimentoDa = dataRiferimentoDa; + } + + public Date getDataRiferimentoA() { + return this.dataRiferimentoA; + } + + public void setDataRiferimentoA(Date dataRiferimentoA) { + this.dataRiferimentoA = dataRiferimentoA; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoScadenza.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoScadenza.java new file mode 100644 index 00000000..12b308bc --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoScadenza.java @@ -0,0 +1,794 @@ +package it.acxent.contab; + +import com.lowagie.text.Cell; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Element; +import com.lowagie.text.HeaderFooter; +import com.lowagie.text.PageSize; +import com.lowagie.text.Phrase; +import com.lowagie.text.pdf.PdfWriter; +import it.acxent.anag.Banca; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.PdfFontFactory; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.Vectumerator; +import java.awt.Color; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.text.NumberFormat; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Random; + +public class DocumentoScadenza extends _ContabAdapter implements Serializable { + private static final long serialVersionUID = -4810747675006169924L; + + private long id_documentoScadenza; + + private long id_documento; + + private Documento documento; + + private long id_distintaRiba; + + private DistintaRiba distintaRiba; + + private Date dataScadenza; + + private double importoScadenza; + + private long flgScadenzaSelezionata; + + private long flgAccorpata; + + private String listaDocumenti; + + public DocumentoScadenza(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DocumentoScadenza() {} + + public long getId_documentoScadenza() { + return this.id_documentoScadenza; + } + + public void setId_documentoScadenza(long id_incassoPagamento) { + this.id_documentoScadenza = id_incassoPagamento; + } + + public void setDataScadenza(Date data) { + this.dataScadenza = data; + } + + public double getImportoScadenza() { + return this.importoScadenza; + } + + public void setImportoScadenza(double importo) { + this.importoScadenza = importo; + } + + public long getId_documento() { + return this.id_documento; + } + + public void setId_documento(long id_documento) { + this.id_documento = id_documento; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento()); + return this.documento; + } + + public void setDocumento(Documento documento) { + this.documento = documento; + } + + protected void deleteCascade() {} + + public ResParm delete() { + ResParm rp = new ResParm(true); + rp = super.delete(); + return rp; + } + + public ResParm save() { + return super.save(); + } + + public Vectumerator findByDocumento(long l_id_documento) { + if (l_id_documento == 0L) + return AB_EMPTY_VECTUMERATOR; + String s_Sql_Find = "select A.* from DOCUMENTO_SCADENZA AS A"; + String s_Sql_Order = " order by A.dataScadenza"; + WcString wc = new WcString(); + wc.addWc(" A.id_documento = " + l_id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgScadenzaSelezionata() { + return this.flgScadenzaSelezionata; + } + + public void setFlgScadenzaSelezionata(long flgTipoIncasso) { + this.flgScadenzaSelezionata = flgTipoIncasso; + } + + public Vectumerator findByCR(DocumentoScadenzaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = ""; + String s_Sql_Order = ""; + WcString wc = new WcString(); + s_Sql_Find = "SELECT * FROM DOCUMENTO_SCADENZA AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento LEFT JOIN TIPO_PAGAMENTO AS C ON B.id_tipoPagamento = C.id_tipoPagamento "; + if (CR.getFlgOrderImporto() == 1L) { + s_Sql_Order = " ORDER BY A.importoScadenza DESC "; + } else { + s_Sql_Order = " ORDER BY A.dataScadenza"; + } + if (CR.getDataScadenzaDa() != null) + wc.addWc(" A.dataScadenza >= ? "); + if (CR.getDataScadenzaA() != null) + wc.addWc(" A.dataScadenza <= ? "); + if (CR.getId_documento() > 0L) + wc.addWc(" A.id_documento = " + CR.getId_documento()); + if (CR.getFlgDaEstrarre() > 0L) + wc.addWc(" (A.id_distintaRiba = 0 OR A.id_distintaRiba IS NULL) "); + if (CR.getId_distintaRiba() > 0L) + wc.addWc(" A.id_distintaRiba = " + CR.getId_distintaRiba()); + if (CR.getId_clifor() > 0L) + wc.addWc(" B.id_clifor = " + CR.getId_clifor()); + if (CR.getDataFatturaDa() != null) + wc.addWc(" B.dataDocumento >= ? "); + if (CR.getDataFatturaA() != null) + wc.addWc(" B.dataDocumento <= ? "); + if (CR.getFlgTipoPagamento() > 0L) + wc.addWc(" C.flgTipoPagamento = " + CR.getFlgTipoPagamento()); + if (CR.getFlgSoloRiba() > 0L) { + s_Sql_Find = s_Sql_Find + " LEFT JOIN TIPO_PAGAMENTO AS T ON B.id_tipoPagamento = T.id_tipoPagamento "; + wc.addWc(" T.flgTipoPagamento = 1"); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + int dataCount = 0; + if (CR.getDataScadenzaDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataScadenzaDa()); + } + if (CR.getDataScadenzaA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataScadenzaA()); + } + if (CR.getDataFatturaDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataFatturaDa()); + } + if (CR.getDataFatturaA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataFatturaA()); + } + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ByteArrayOutputStream creaReportPdf(DocumentoScadenzaCR CR) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + Calendar cal = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + SimpleDateFormat sdfh = new SimpleDateFormat("hh:mm"); + Phrase pH = new Phrase("Data/ora stampa: " + sdf.format(getToday()) + " " + sdfh.format(Long.valueOf(cal.getTimeInMillis())) + " pag. "); + HeaderFooter footer = new HeaderFooter(pH, true); + footer.setAlignment(2); + footer.setBorder(0); + this.document.setFooter(footer); + this.document.open(); + CR.setFilePdf(getPathTmpFull() + "ReportPagamenti.pdf"); + if (new File(CR.getFilePdf()).exists()) + new File(CR.getFilePdf()).delete(); + this.document = creaReport(CR); + this.document.close(); + this.document = null; + FileOutputStream fos = new FileOutputStream(new File(CR.getFilePdf())); + fos.write(ba.toByteArray()); + fos.close(); + System.out.println("Creato file documento " + CR.getFilePdf()); + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + private Document creaReport(DocumentoScadenzaCR CR) { + try { + prepareNewPdfCorpoDocument(); + int cellLeading = 10; + NumberFormat nf = NumberFormat.getInstance(); + nf.setMinimumFractionDigits(2); + nf.setMaximumFractionDigits(2); + long id_clifor = 0L; + DoubleOperator dpRottura = new DoubleOperator(); + DoubleOperator dpReport = new DoubleOperator(); + String salvaDescrizioneCliente = ""; + Cell cell = new Cell(); + cell.add(new Chunk("REPORT SCADENZE", PdfFontFactory.PDF_fIntestazione)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Documento", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Data", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Importo", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Nota", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + this.pdfcorpo.endHeaders(); + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + DocumentoScadenza doc = (DocumentoScadenza)vec.nextElement(); + if (id_clifor != doc.getDocumento().getId_clifor()) { + if (id_clifor > 0L) { + cell = new Cell(new Chunk("Totale per " + salvaDescrizioneCliente, PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(dpRottura.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + dpRottura = new DoubleOperator(); + } + if (!doc.getDocumento().getClifor().getNominativoCompleto().isEmpty()) { + cell = new Cell(new Chunk(doc.getDocumento().getClifor().getNominativoCompleto(), PdfFontFactory.PDF_fGrandeB)); + if (doc.getDocumento().getClifor().getFlgTipo().equals("F")) + cell.add(new Chunk(" iban: " + doc.getDocumento().getClifor().getIban(), PdfFontFactory.PDF_fGrandeB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + } + salvaDescrizioneCliente = ""; + } + dpRottura.add(doc.getImportoScadenza()); + dpReport.add(doc.getImportoScadenza()); + salvaDescrizioneCliente = doc.getDocumento().getClifor().getNominativoCompleto(); + id_clifor = doc.getDocumento().getId_clifor(); + } + if (id_clifor > 0L) { + cell = new Cell(new Chunk("Totale per " + salvaDescrizioneCliente, PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(dpRottura.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("_", PdfFontFactory.PDF_fMedioBianco)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + } + if (dpReport.getResult() != 0.0D) { + cell = new Cell(new Chunk("Totale Report ", PdfFontFactory.PDF_fGrandissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(dpReport.getResult()), PdfFontFactory.PDF_fGrandissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(15); + this.pdfcorpo.addCell(cell); + } + this.document.add((Element)this.pdfcorpo); + } catch (Exception e) { + e.printStackTrace(); + } + return this.document; + } + + public long getId_distintaRiba() { + return this.id_distintaRiba; + } + + public void setId_distintaRiba(long id_distintaRiba) { + this.id_distintaRiba = id_distintaRiba; + setDistintaRiba(null); + } + + public DistintaRiba getDistintaRiba() { + this.distintaRiba = (DistintaRiba)getSecondaryObject(this.distintaRiba, DistintaRiba.class, getId_distintaRiba()); + return this.distintaRiba; + } + + public void setDistintaRiba(DistintaRiba distintaRiba) { + this.distintaRiba = distintaRiba; + } + + public Date getDataScadenza() { + return this.dataScadenza; + } + + public ResParm deleteByDocumento(long id_documento) { + String sql = "DELETE FROM DOCUMENTO_SCADENZA WHERE id_documento = " + id_documento; + return delete(sql); + } + + public long getFlgAccorpata() { + return this.flgAccorpata; + } + + public void setFlgAccorpata(long flgAccorpata) { + this.flgAccorpata = flgAccorpata; + } + + public String getListaDocumenti() { + return (this.listaDocumenti == null) ? "" : this.listaDocumenti; + } + + public String getListaDocumentiPdf() { + if (getFlgAccorpata() == 0L) + return getDocumento().getTipoDocumento().getCodice() + " - " + getDocumento().getTipoDocumento().getCodice() + " del " + getDocumento().getNumeroDocumento(); + return getListaDocumenti().replace("
", " "); + } + + public void setListaDocumenti(String listaDocumenti) { + this.listaDocumenti = listaDocumenti; + } + + public double getTotaleScadenzeByCR(DocumentoScadenzaCR CR) { + if ((CR.getDataFatturaDa() == null || CR.getDataFatturaA() == null) && ( + CR.getDataScadenzaDa() == null || CR.getDataScadenzaA() == null)) { + System.out.println("No"); + return 0.0D; + } + System.out.println("Si"); + DoubleOperator dop = new DoubleOperator(); + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + DocumentoScadenza ds = (DocumentoScadenza)vec.nextElement(); + dop.add(ds.getImportoScadenza()); + } + return dop.getResult(); + } + + public String randomNumber(long length) { + char[] caratteri = "0123456789".toCharArray(); + StringBuilder sb = new StringBuilder(); + Random random = new Random(); + for (int i = 0; (long)i < length; i++) { + char c = caratteri[random.nextInt(caratteri.length)]; + sb.append(c); + } + return sb.toString(); + } + + public void creaDistinte(DocumentoScadenzaCR CR) { + ResParm rp = new ResParm(true); + DoubleOperator dopInc = new DoubleOperator(); + DoubleOperator dopTot = new DoubleOperator(); + double importoBanca = 0.0D; + double importoTotaleRiba = getTotaleScadenzeByCR(CR); + Vectumerator vecd = new Vectumerator(); + Vectumerator vec = findByCR(CR, 0, 0); + CR.setTimestampElaborazione(Long.valueOf(randomNumber(9L)).longValue()); + if (importoTotaleRiba > 0.0D) + while (CR.getVecRiba().hasMoreElements()) { + Banca row = (Banca)CR.getVecRiba().nextElement(); + System.out.println(row.getDescrizione() + " " + row.getDescrizione()); + importoBanca = row.getImportoRiba(); + if (importoBanca > 0.0D && importoTotaleRiba > dopTot.getResult()) { + DistintaRiba dr = new DistintaRiba(getApFull()); + dr.setId_banca(row.getId_banca()); + dr.setDataPresentazione(CR.getDataDistintaRiba()); + dr.setFlgAccorpaScadenze(CR.getFlgAccorpaScadenze()); + dr.setFlgStatoDistinta(0L); + dr.setTimestampElaborazione(CR.getTimestampElaborazione()); + dr.setMaxDistinta(importoBanca); + rp = dr.save(); + if (rp.getStatus()) { + vecd.add(dr); + dopInc = new DoubleOperator(0.0F); + vec.moveFirst(); + while (vec.hasMoreElements()) { + DocumentoScadenza ds = (DocumentoScadenza)vec.nextElement(); + if (ds.getId_distintaRiba() == 0L) { + dopInc.add(ds.getImportoScadenza()); + if (importoBanca >= dopInc.getResult()) { + dopTot.add(ds.getImportoScadenza()); + ds.setFlgScadenzaSelezionata(0L); + ds.setId_distintaRiba(dr.getId_distintaRiba()); + rp = ds.save(); + if (!rp.getStatus()); + continue; + } + dopInc.subtract(ds.getImportoScadenza()); + } + } + } + } + } + while (vecd.hasMoreElements()) { + DistintaRiba dr = (DistintaRiba)vecd.nextElement(); + if (dr.getImportoTotale() == 0.0D) + dr.delete(); + } + } + + private Document creaListaScadenze(DocumentoScadenzaCR CR) { + try { + prepareNewPdfCorpoDocument(); + SimpleDateFormat df = getDataFormat(); + int cellLeading = 10; + NumberFormat nf = NumberFormat.getInstance(); + nf.setMinimumFractionDigits(2); + nf.setMaximumFractionDigits(2); + DoubleOperator dpReport = new DoubleOperator(); + int[] col = { 4, 3, 14, 3, 10, 2, 4 }; + Cell cell = new Cell(); + cell.add(new Chunk("Lista scadenze", PdfFontFactory.PDF_fIntestazione)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(); + cell.add(new Chunk("Criteri ricerca: " + CR.getDescrizioneCR(), PdfFontFactory.PDF_fPiccolissimo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(40); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Documento", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(col[0]); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Data doc.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(col[1]); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Cliente", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(col[2]); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Data scad.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(col[3]); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Tipo pag.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(col[4]); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("N. dist.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(col[5]); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Importo", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setBackgroundColor(Color.lightGray); + cell.setLeading((float)cellLeading); + cell.setColspan(col[6]); + this.pdfcorpo.addCell(cell); + this.pdfcorpo.endHeaders(); + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + DocumentoScadenza doc = (DocumentoScadenza)vec.nextElement(); + cell = new Cell(new Chunk(doc.getDocumento().getTipoDocumento().getCodice() + " " + doc.getDocumento().getTipoDocumento().getCodice(), PdfFontFactory.PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col[0]); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(df.format(doc.getDocumento().getDataDocumento()), PdfFontFactory.PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setColspan(col[1]); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(doc.getDocumento().getClifor().getDescrizioneCompleta(), PdfFontFactory.PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col[2]); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(df.format(doc.getDataScadenza()), PdfFontFactory.PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setColspan(col[3]); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(doc.getDocumento().getTipoPagamento().getDescrizioneTipo(), PdfFontFactory.PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(0); + cell.setLeading((float)cellLeading); + cell.setColspan(col[4]); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(String.valueOf(doc.getId_distintaRiba()), PdfFontFactory.PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setColspan(col[5]); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(doc.getImportoScadenza()), PdfFontFactory.PDF_fPiccolo)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(col[6]); + this.pdfcorpo.addCell(cell); + dpReport.add(doc.getImportoScadenza()); + } + if (dpReport.getResult() != 0.0D) { + cell = new Cell(new Chunk("Totale", PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(col[0] + col[1] + col[2] + col[3] + col[4] + col[5]); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(nf.format(dpReport.getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(col[6]); + this.pdfcorpo.addCell(cell); + } + this.document.add((Element)this.pdfcorpo); + } catch (Exception e) { + e.printStackTrace(); + } + return this.document; + } + + public ByteArrayOutputStream creaListaScadenzePdf(DocumentoScadenzaCR CR) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + this.document = new Document(PageSize.A4, 20.0F, 20.0F, 20.0F, 10.0F); + this.writer = PdfWriter.getInstance(this.document, ba); + Calendar cal = Calendar.getInstance(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + SimpleDateFormat sdfh = new SimpleDateFormat("hh:mm"); + Phrase pH = new Phrase("Data/ora stampa: " + sdf.format(getToday()) + " " + sdfh.format(Long.valueOf(cal.getTimeInMillis())) + " pag. "); + HeaderFooter footer = new HeaderFooter(pH, true); + footer.setAlignment(2); + footer.setBorder(0); + this.document.setFooter(footer); + this.document.open(); + CR.setFilePdf(getPathTmpFull() + "ReportScadenze.pdf"); + if (new File(CR.getFilePdf()).exists()) + new File(CR.getFilePdf()).delete(); + this.document = creaListaScadenze(CR); + this.document.close(); + this.document = null; + FileOutputStream fos = new FileOutputStream(new File(CR.getFilePdf())); + fos.write(ba.toByteArray()); + fos.close(); + System.out.println("Creato file documento " + CR.getFilePdf()); + } catch (Exception e) { + e.printStackTrace(); + } + return ba; + } + + public void creaDistintexx(DocumentoScadenzaCR CR) { + ResParm rp = new ResParm(true); + DoubleOperator dopInc = new DoubleOperator(); + DoubleOperator dopTot = new DoubleOperator(); + double importoBanca = 0.0D; + double importoTotaleRiba = getTotaleScadenzeByCR(CR); + Vectumerator vecd = new Vectumerator(); + Vectumerator vec = findByCR(CR, 0, 0); + CR.setTimestampElaborazione(Long.valueOf(randomNumber(9L)).longValue()); + HashMap hm = new HashMap<>(); + if (importoTotaleRiba > 0.0D) { + Iterator it = hm.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry pair = it.next(); + importoBanca = (Double)pair.getValue(); + if (importoBanca > 0.0D && importoTotaleRiba > dopTot.getResult()) { + DistintaRiba dr = new DistintaRiba(getApFull()); + dr.setId_banca(((Long)pair.getKey()).longValue()); + dr.setDataPresentazione(CR.getDataDistintaRiba()); + dr.setFlgAccorpaScadenze(CR.getFlgAccorpaScadenze()); + dr.setFlgStatoDistinta(0L); + dr.setTimestampElaborazione(CR.getTimestampElaborazione()); + dr.setMaxDistinta(importoBanca); + rp = dr.save(); + if (rp.getStatus()) { + vecd.add(dr); + dopInc = new DoubleOperator(0.0F); + vec.moveFirst(); + while (vec.hasMoreElements()) { + DocumentoScadenza ds = (DocumentoScadenza)vec.nextElement(); + if (ds.getId_distintaRiba() == 0L) { + dopInc.add(ds.getImportoScadenza()); + if (importoBanca >= dopInc.getResult()) { + dopTot.add(ds.getImportoScadenza()); + ds.setFlgScadenzaSelezionata(0L); + ds.setId_distintaRiba(dr.getId_distintaRiba()); + rp = ds.save(); + if (!rp.getStatus()); + continue; + } + dopInc.subtract(ds.getImportoScadenza()); + } + } + } + } + } + } + while (vecd.hasMoreElements()) { + DistintaRiba dr = (DistintaRiba)vecd.nextElement(); + if (dr.getImportoTotale() == 0.0D) + dr.delete(); + } + } + + public boolean hasScadenzaConRiba(long l_id_documento) { + if (l_id_documento == 0L) + return false; + String s_Sql_Find = "select A.* from DOCUMENTO_SCADENZA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_documento = " + l_id_documento); + wc.addWc(" A.id_distintaRiba>0 "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator res = findRows(stmt, 1, 1); + if (res.hasMoreElements()) + return true; + return false; + } catch (SQLException e) { + handleDebug(e); + return true; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoScadenzaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoScadenzaCR.java new file mode 100644 index 00000000..1ee88b40 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/DocumentoScadenzaCR.java @@ -0,0 +1,346 @@ +package it.acxent.contab; + +import it.acxent.anag.Banca; +import it.acxent.anag.Clifor; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.util.Vectumerator; +import java.sql.Date; + +public class DocumentoScadenzaCR extends CRAdapter { + private long id_documentoScadenza; + + private long id_documento; + + private Documento documento; + + private long id_distintaRiba; + + private DistintaRiba distintaRiba; + + private Date dataScadenza; + + private Date dataScadenzaDa; + + private Date dataScadenzaA; + + private Date dataScadenzaMDa; + + private Date dataScadenzaMA; + + private Date dataFatturaDa; + + private Date dataFatturaA; + + private double importoScadenza; + + private long flgScadenzaSelezionata; + + private long flgDaEstrarre; + + private long flgAccorpaScadenze = 1L; + + private long flgAll; + + private long id_clifor; + + private Vectumerator vecRiba; + + private Clifor clifor; + + private String filePdf; + + private String numDocumentoDa = "1"; + + private String numDocumentoA = "999999999"; + + private long flgDistinta; + + private Date dataDistintaRiba = DBAdapter.getToday(); + + private long timestampElaborazione; + + private long flgSoloRiba; + + private long flgGestioneDistinta; + + private long flgTipoPagamento; + + private long flgOrderImporto; + + private double totaleRiba; + + public DocumentoScadenzaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DocumentoScadenzaCR() {} + + public long getId_documentoScadenza() { + return this.id_documentoScadenza; + } + + public void setId_documentoScadenza(long id_incassoPagamento) { + this.id_documentoScadenza = id_incassoPagamento; + } + + public void setDataScadenza(Date data) { + this.dataScadenza = data; + } + + public double getImportoScadenza() { + return this.importoScadenza; + } + + public void setImportoScadenza(double importo) { + this.importoScadenza = importo; + } + + public long getId_documento() { + return this.id_documento; + } + + public void setId_documento(long id_documento) { + this.id_documento = id_documento; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento()); + return this.documento; + } + + public void setDocumento(Documento documento) { + this.documento = documento; + } + + public long getFlgScadenzaSelezionata() { + return this.flgScadenzaSelezionata; + } + + public void setFlgScadenzaSelezionata(long flgTipoIncasso) { + this.flgScadenzaSelezionata = flgTipoIncasso; + } + + public long getId_distintaRiba() { + return this.id_distintaRiba; + } + + public void setId_distintaRiba(long id_distintaRiba) { + this.id_distintaRiba = id_distintaRiba; + } + + public DistintaRiba getDistintaRiba() { + return this.distintaRiba; + } + + public void setDistintaRiba(DistintaRiba distintaRiba) { + this.distintaRiba = distintaRiba; + } + + public Date getDataScadenza() { + return this.dataScadenza; + } + + public Date getDataScadenzaDa() { + return this.dataScadenzaDa; + } + + public void setDataScadenzaDa(Date dataScadenzaDa) { + this.dataScadenzaDa = dataScadenzaDa; + } + + public Date getDataScadenzaA() { + return this.dataScadenzaA; + } + + public void setDataScadenzaA(Date dataScadenzaA) { + this.dataScadenzaA = dataScadenzaA; + } + + public String getFilePdf() { + return (this.filePdf == null) ? AB_EMPTY_STRING : this.filePdf; + } + + public void setFilePdf(String filePdf) { + this.filePdf = filePdf; + } + + public Date getDataScadenzaMDa() { + return this.dataScadenzaMDa; + } + + public void setDataScadenzaMDa(Date dataScadenzaMDa) { + this.dataScadenzaMDa = dataScadenzaMDa; + } + + public Date getDataScadenzaMA() { + return this.dataScadenzaMA; + } + + public void setDataScadenzaMA(Date dataScadenzaMA) { + this.dataScadenzaMA = dataScadenzaMA; + } + + public long getFlgDaEstrarre() { + return this.flgDaEstrarre; + } + + public void setFlgDaEstrarre(long flgDaEstrarre) { + this.flgDaEstrarre = flgDaEstrarre; + } + + public long getFlgAccorpaScadenze() { + return this.flgAccorpaScadenze; + } + + public void setFlgAccorpaScadenze(long flgAccorpaScadenze) { + this.flgAccorpaScadenze = flgAccorpaScadenze; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + setClifor(null); + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setClifor(Clifor clifor) { + this.clifor = clifor; + } + + public long getFlgAll() { + return this.flgAll; + } + + public void setFlgAll(long flgAll) { + this.flgAll = flgAll; + } + + public String getNumDocumentoDa() { + return (this.numDocumentoDa == null) ? AB_EMPTY_STRING : this.numDocumentoDa; + } + + public void setNumDocumentoDa(String numDocumentoDa) { + this.numDocumentoDa = numDocumentoDa; + } + + public String getNumDocumentoA() { + return (this.numDocumentoA == null) ? AB_EMPTY_STRING : this.numDocumentoA; + } + + public void setNumDocumentoA(String numDocumentoA) { + this.numDocumentoA = numDocumentoA; + } + + public long getFlgDistinta() { + return this.flgDistinta; + } + + public void setFlgDistinta(long flgDistinta) { + this.flgDistinta = flgDistinta; + } + + public Date getDataDistintaRiba() { + return this.dataDistintaRiba; + } + + public void setDataDistintaRiba(Date dataDistintaRiba) { + this.dataDistintaRiba = dataDistintaRiba; + } + + public long getTimestampElaborazione() { + return this.timestampElaborazione; + } + + public void setTimestampElaborazione(long timestampElaborazione) { + this.timestampElaborazione = timestampElaborazione; + } + + public double getMaxDistintaByBanca(long id_banca) { + double ret = 0.0D; + while (getVecRiba().hasMoreElements()) { + Banca row = (Banca)getVecRiba().nextElement(); + if (row.getId_banca() == id_banca) { + ret = row.getImportoRiba(); + break; + } + } + return ret; + } + + public long getFlgSoloRiba() { + return this.flgSoloRiba; + } + + public void setFlgSoloRiba(long flgSoloRiba) { + this.flgSoloRiba = flgSoloRiba; + } + + public Date getDataFatturaDa() { + return this.dataFatturaDa; + } + + public void setDataFatturaDa(Date dataFatturaDa) { + this.dataFatturaDa = dataFatturaDa; + } + + public Date getDataFatturaA() { + return this.dataFatturaA; + } + + public void setDataFatturaA(Date dataFatturaA) { + this.dataFatturaA = dataFatturaA; + } + + public long getFlgGestioneDistinta() { + return this.flgGestioneDistinta; + } + + public void setFlgGestioneDistinta(long flgGestioneDistinta) { + this.flgGestioneDistinta = flgGestioneDistinta; + } + + public long getFlgTipoPagamento() { + return this.flgTipoPagamento; + } + + public void setFlgTipoPagamento(long flgTipoPagamento) { + this.flgTipoPagamento = flgTipoPagamento; + } + + public long getFlgOrderImporto() { + return this.flgOrderImporto; + } + + public void setFlgOrderImporto(long flgOrderImporto) { + this.flgOrderImporto = flgOrderImporto; + } + + public Vectumerator getVecRiba() { + return (this.vecRiba == null) ? DBAdapter.AB_EMPTY_VECTUMERATOR : this.vecRiba; + } + + public void setVecRiba(Vectumerator vecRiba) { + this.vecRiba = vecRiba; + } + + public String getDescrizioneCR() { + return "da fare.."; + } + + public double getTotaleRiba() { + return this.totaleRiba; + } + + public void setTotaleRiba(double totaleRiba) { + this.totaleRiba = totaleRiba; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/IncassoPagamento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/IncassoPagamento.java new file mode 100644 index 00000000..acfbe302 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/IncassoPagamento.java @@ -0,0 +1,156 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.DBAdapterException; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class IncassoPagamento extends DBAdapter implements Serializable { + private static final long serialVersionUID = 8044331984020899695L; + + private long id_incassoPagamento; + + private Date dataIP; + + private double importoIP; + + private String notaIP; + + private long id_documento; + + private Documento documento; + + public IncassoPagamento(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public IncassoPagamento() {} + + public long getId_incassoPagamento() { + return this.id_incassoPagamento; + } + + public void setId_incassoPagamento(long id_incassoPagamento) { + this.id_incassoPagamento = id_incassoPagamento; + } + + public Date getDataIP() { + return this.dataIP; + } + + public void setDataIP(Date dataIP) { + this.dataIP = dataIP; + } + + public double getImportoIP() { + return this.importoIP; + } + + public void setImportoIP(double importoIP) { + this.importoIP = importoIP; + } + + public String getNotaIP() { + return (this.notaIP == null) ? "" : this.notaIP; + } + + public void setNotaIP(String notaIP) { + this.notaIP = notaIP; + } + + public long getId_documento() { + return this.id_documento; + } + + public void setId_documento(long id_documento) { + this.id_documento = id_documento; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento()); + return this.documento; + } + + public void setDocumento(Documento documento) { + this.documento = documento; + } + + public Vectumerator findByCR(IncassoPagamentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from INCASSO_PAGAMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void deleteCascade() {} + + public Vectumerator findByDocumento(long id_documento, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from INCASSO_PAGAMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_documento = " + id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getTotByDocumento(long id_documento) { + String s_Sql_Find = "select SUM(importoIP) as _tot from INCASSO_PAGAMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_documento = " + id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public ResParm save() { + return super.save(); + } + + public ResParm delete() { + ResParm rp = new ResParm(true); + rp = super.delete(); + return rp; + } + + protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException { + return new ResParm(true); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/IncassoPagamentoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/IncassoPagamentoCR.java new file mode 100644 index 00000000..ab7837af --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/IncassoPagamentoCR.java @@ -0,0 +1,77 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.io.Serializable; +import java.sql.Date; + +public class IncassoPagamentoCR extends CRAdapter implements Serializable { + private static final long serialVersionUID = 8044331984020899695L; + + private long id_incassoPagamento; + + private Date dataIP; + + private double importoIP; + + private String notaIP; + + private long id_documento; + + private Documento documento; + + public IncassoPagamentoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public IncassoPagamentoCR() {} + + public long getId_incassoPagamento() { + return this.id_incassoPagamento; + } + + public void setId_incassoPagamento(long id_incassoPagamento) { + this.id_incassoPagamento = id_incassoPagamento; + } + + public Date getDataIP() { + return this.dataIP; + } + + public void setDataIP(Date dataIP) { + this.dataIP = dataIP; + } + + public double getImportoIP() { + return this.importoIP; + } + + public void setImportoIP(double importoIP) { + this.importoIP = importoIP; + } + + public String getNotaIP() { + return (this.notaIP == null) ? "" : this.notaIP; + } + + public void setNotaIP(String notaIP) { + this.notaIP = notaIP; + } + + public long getId_documento() { + return this.id_documento; + } + + public void setId_documento(long id_documento) { + this.id_documento = id_documento; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento()); + return this.documento; + } + + public void setDocumento(Documento documento) { + this.documento = documento; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/MovContabile.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/MovContabile.java new file mode 100644 index 00000000..9160a86d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/MovContabile.java @@ -0,0 +1,116 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.DBAdapterException; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class MovContabile extends DBAdapter implements Serializable { + private static final long serialVersionUID = 3773329117463754505L; + + private long id_movContabile; + + private String descrizione; + + private long id_causaleContabile; + + private Date dataMovContabile; + + private long flgStato; + + private CausaleContabile causaleContabile; + + public MovContabile(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public MovContabile() {} + + public long getId_movContabile() { + return this.id_movContabile; + } + + public void setId_movContabile(long id_incassoPagamento) { + this.id_movContabile = id_incassoPagamento; + } + + public Vectumerator findByCR(MovContabileCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from MOV_CONTABILE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void deleteCascade() {} + + protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException { + return null; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } + + public long getId_causaleContabile() { + return this.id_causaleContabile; + } + + public void setId_causaleContabile(long id_causaleContabile) { + this.id_causaleContabile = id_causaleContabile; + setCausaleContabile(null); + } + + public Date getDataMovContabile() { + return this.dataMovContabile; + } + + public void setDataMovContabile(Date dataMovContabile) { + this.dataMovContabile = dataMovContabile; + } + + public long getFlgStato() { + return this.flgStato; + } + + public void setFlgStato(long flgStato) { + this.flgStato = flgStato; + } + + public CausaleContabile getCausaleContabile() { + this.causaleContabile = (CausaleContabile)getSecondaryObject(this.causaleContabile, CausaleContabile.class, getId_causaleContabile()); + return this.causaleContabile; + } + + public void setCausaleContabile(CausaleContabile causaleContabile) { + this.causaleContabile = causaleContabile; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/MovContabileCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/MovContabileCR.java new file mode 100644 index 00000000..aaeedf8e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/MovContabileCR.java @@ -0,0 +1,77 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.io.Serializable; +import java.sql.Date; + +public class MovContabileCR extends CRAdapter implements Serializable { + private static final long serialVersionUID = 1120016389762829114L; + + private long id_movContabile; + + private String descrizione; + + private long id_causaleContabile; + + private Date dataMovContabile; + + private long flgStato; + + private CausaleContabile causaleContabile; + + public MovContabileCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public MovContabileCR() {} + + public long getId_movContabile() { + return this.id_movContabile; + } + + public void setId_movContabile(long id_incassoPagamento) { + this.id_movContabile = id_incassoPagamento; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } + + public long getId_causaleContabile() { + return this.id_causaleContabile; + } + + public void setId_causaleContabile(long id_causaleContabile) { + this.id_causaleContabile = id_causaleContabile; + } + + public Date getDataMovContabile() { + return this.dataMovContabile; + } + + public void setDataMovContabile(Date dataMovContabile) { + this.dataMovContabile = dataMovContabile; + } + + public long getFlgStato() { + return this.flgStato; + } + + public void setFlgStato(long flgStato) { + this.flgStato = flgStato; + } + + public CausaleContabile getCausaleContabile() { + this.causaleContabile = (CausaleContabile)getSecondaryObject(this.causaleContabile, CausaleContabile.class, getId_causaleContabile()); + return this.causaleContabile; + } + + public void setCausaleContabile(CausaleContabile causaleContabile) { + this.causaleContabile = causaleContabile; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/Movimento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/Movimento.java new file mode 100644 index 00000000..3fb54128 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/Movimento.java @@ -0,0 +1,971 @@ +package it.acxent.contab; + +import it.acxent.anag.Clifor; +import it.acxent.anag.MagFisico; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloTaglia; +import it.acxent.art.ArticoloVariante; +import it.acxent.art.TipologiaArticolo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.FileWr; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Movimento extends _ContabAdapter implements Serializable { + private static final long serialVersionUID = -5378446506644250769L; + + private long id_movimento; + + private long id_rigaDocumento; + + private long id_articoloVariante; + + private long id_articoloTaglia; + + private long id_magFisico; + + private long id_clifor; + + private String seriale; + + private double kg; + + private double mt; + + private double nr; + + private RigaDocumento rigaDocumento; + + private Articolo articolo; + + private ArticoloVariante articoloVariante; + + private ArticoloTaglia articoloTaglia; + + private MagFisico magFisico; + + private Clifor clifor; + + private long id_articolo; + + private long id_rigaDocumentoP; + + private long id_causaleMagazzino; + + private CausaleMagazzino causaleMagazzino; + + private Date dataMovimento; + + public Movimento(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Movimento() {} + + protected void deleteCascade() {} + + public Vectumerator xxfindByCR(MovimentoCR CR, int pageNumber, int pageRows) { + return findSaldiArticoloByCR(CR, pageNumber, pageRows); + } + + public Vectumerator findSaldiArticoloByCR(MovimentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.id_articolo, A.id_articoloVariante, A.id_articoloTaglia, A.id_magFisico, A.seriale, A.id_clifor, SUM(A.kg) as kg, SUM(A.mt) as mt, SUM(A.nr) as nr from MOVIMENTO AS A INNER JOIN ARTICOLO AS B ON A.id_articolo = B.id_articolo "; + String s_Sql_Group = " group by A.id_articolo, id_articoloVariante, id_articoloTaglia, A.id_magFisico, A.seriale, A.id_clifor "; + String s_Sql_Order = " order by B.nome, A.id_magFisico, A.id_clifor "; + String s_Sql_Having = ""; + if (CR.getFlgInMagazzino() == 1L) { + s_Sql_Having = " Having SUM(kg) > 0 OR SUM(mt) > 0 OR SUM(nr) > 0 "; + } else if (CR.getFlgInMagazzino() == 2L) { + s_Sql_Having = " Having SUM(kg) < 0 OR SUM(mt) < 0 OR SUM(nr) < 0 "; + } else if (CR.getFlgInMagazzino() == 3L) { + s_Sql_Having = " Having SUM(kg) <> 0 OR SUM(mt) <> 0 OR SUM(nr) <> 0 "; + } + WcString wc = new WcString(); + if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) { + String star = ""; + String temp = CR.getSearchTxt(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("(B.codice like '" + token + "%' or B.nome like '" + token + "%' or B.codiceProduttore like '" + token + "%' or B.codiciAlternativi like '%," + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_articolo() > 0L) + wc.addWc(" A.id_articolo = " + CR.getId_articolo()); + if (CR.getId_articoloVariante() > 0L) + wc.addWc(" A.id_articoloVariante = " + CR.getId_articoloVariante()); + if (CR.getId_articoloTaglia() > 0L) + wc.addWc(" A.id_articoloTaglia = " + CR.getId_articoloTaglia()); + if (CR.getId_magFisico() > 0L) + wc.addWc(" A.id_magFisico = " + CR.getId_magFisico()); + if (CR.getId_clifor() > 0L) + wc.addWc(" A.id_clifor = " + CR.getId_clifor()); + try { + PreparedStatement stmt = getConn() + .prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_movimento() { + return this.id_movimento; + } + + public void setId_movimento(long id_movimento) { + this.id_movimento = id_movimento; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public void setId_rigaDocumento(long id_rigaDocumento) { + this.id_rigaDocumento = id_rigaDocumento; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + } + + public long getId_articoloTaglia() { + return this.id_articoloTaglia; + } + + public void setId_articoloTaglia(long id_articoloTaglia) { + this.id_articoloTaglia = id_articoloTaglia; + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public void setId_magFisico(long id_magFisico) { + this.id_magFisico = id_magFisico; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + } + + public String getSeriale() { + return (this.seriale == null) ? "" : this.seriale; + } + + public void setSeriale(String seriale) { + this.seriale = seriale; + } + + public double getKg() { + return this.kg; + } + + public void setKg(double kg) { + this.kg = kg; + } + + public double getMt() { + return this.mt; + } + + public void setMt(double mt) { + this.mt = mt; + } + + public double getNr() { + return this.nr; + } + + public void setNr(double nr) { + this.nr = nr; + } + + public RigaDocumento getRigaDocumento() { + this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, getId_rigaDocumento()); + return this.rigaDocumento; + } + + public void setRigaDocumento(RigaDocumento rigaDocumento) { + this.rigaDocumento = rigaDocumento; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public void setArticolo(Articolo articolo) { + this.articolo = articolo; + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante()); + return this.articoloVariante; + } + + public void setArticoloVariante(ArticoloVariante articoloVariante) { + this.articoloVariante = articoloVariante; + } + + public ArticoloTaglia getArticoloTaglia() { + this.articoloTaglia = (ArticoloTaglia)getSecondaryObject(this.articoloTaglia, ArticoloTaglia.class, getId_articoloTaglia()); + return this.articoloTaglia; + } + + public void setArticoloTaglia(ArticoloTaglia articoloTaglia) { + this.articoloTaglia = articoloTaglia; + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico()); + return this.magFisico; + } + + public void setMagFisico(MagFisico magFisico) { + this.magFisico = magFisico; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setClifor(Clifor clifor) { + this.clifor = clifor; + } + + public Vectumerator findByRigaDocumento(long l_id_rigaDocumento) { + String s_Sql_Find = "select A.* from MOVIMENTO AS A "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_rigaDocumento = " + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findDisponibilita(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, String l_seriale, long l_tipologia_magfisico, long l_id_clifor, Date dataA) { + String s_Sql_Sum = " SUM(A.kg) as kg, SUM(A.mt) as mt, SUM(A.nr) as nr from MOVIMENTO AS A "; + String s_Sql_colonne = ""; + String s_Sql_join = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_magFisico = B.id_magFisico "); + if (l_id_articolo != 0L) { + wc.addWc(" A.id_articolo = " + l_id_articolo); + s_Sql_colonne = s_Sql_colonne + " A.id_articolo,"; + } + if (l_id_articoloVariante != 0L) { + wc.addWc(" A.id_articoloVariante = " + l_id_articoloVariante); + s_Sql_colonne = s_Sql_colonne + " A.id_articoloVariante,"; + } + if (l_id_articoloTaglia != 0L) { + wc.addWc(" A.id_articoloTaglia = " + l_id_articoloTaglia); + s_Sql_colonne = s_Sql_colonne + " A.id_articoloTaglia,"; + } + if (l_tipologia_magfisico != 0L) { + wc.addWc(" B.flgTipo = " + l_tipologia_magfisico); + s_Sql_colonne = s_Sql_colonne + " A.id_magFisico,"; + } + if (l_seriale != null && !l_seriale.isEmpty()) { + wc.addWc(" A.seriale = " + l_seriale); + s_Sql_colonne = s_Sql_colonne + " A.seriale,"; + } + if (l_id_clifor != 0L) { + wc.addWc(" A.id_clifor = " + l_id_clifor); + s_Sql_colonne = s_Sql_colonne + " A.id_clifor,"; + } + if (dataA != null) { + s_Sql_join = " inner join RIGA_DOCUMENTO AS RD ON A.id_rigaDocumento=RD.id_rigaDocumento INNER JOIN DOCUMENTO AS DOC ON RD.id_documento=DOC.id_documento "; + wc.addWc(" DOC.dataDocumento <= ?"); + } + String s_sql_groupby = ""; + if (!s_Sql_colonne.isEmpty()) + s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1); + s_Sql_Sum = s_Sql_Sum + s_Sql_Sum + ", MAG_FISICO AS B"; + try { + PreparedStatement stmt = getConn() + .prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby); + if (dataA != null) + stmt.setDate(1, dataA); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findSaldiArticoloVarianteTagliaByCR(MovimentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select B.id_articolo, C.id_articoloVariante , SUM(A.kg) as kg, SUM(A.mt) as mt, SUM(A.nr) as nr from ARTICOLO AS B LEFT JOIN ARTICOLO_VARIANTE AS C ON B.id_articolo=C.id_articolo LEFT JOIN MOVIMENTO AS A ON A.id_articolo=B.id_articolo and A.id_articoloVariante=C.id_articoloVariante left JOIN MAG_FISICO AS D ON A.id_magFisico=D.id_magFisico "; + if (CR.getFlgTipoMagazzino() > 0L) + s_Sql_Find = s_Sql_Find + " and D.flgTipo = " + s_Sql_Find; + String s_Sql_Group = " group by B.id_articolo, C.id_articoloVariante"; + String s_Sql_Order = " order by B.nome, C.nomeV, A.id_articoloTaglia "; + String s_Sql_Having = ""; + if (CR.getFlgInMagazzino() == 1L) { + s_Sql_Having = " Having SUM(A.kg) > 0 OR SUM(A.mt) > 0 OR SUM(A.nr) > 0 "; + } else if (CR.getFlgInMagazzino() == 2L) { + s_Sql_Having = " Having SUM(A.kg) < 0 OR SUM(A.mt) < 0 OR SUM(A.nr) < 0 "; + } + WcString wc = new WcString(); + if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) { + String star = ""; + String temp = CR.getSearchTxt(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("(B.codice like '" + token + "%' or B.nome like '" + token + "%' or B.codiceProduttore like '" + token + "%' or B.codiciAlternativi like '%," + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_articolo() > 0L) + wc.addWc("B.id_articolo = " + CR.getId_articolo()); + if (CR.getId_magFisico() > 0L) + wc.addWc(" A.id_magFisico = " + CR.getId_magFisico()); + if (CR.getId_clifor() > 0L) + wc.addWc(" A.id_clifor = " + CR.getId_clifor()); + try { + PreparedStatement stmt = getConn() + .prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public boolean isArticoloDisponibile(long l_id_articolo, long l_id_articoloVariante, long l_id_taglia, String l_seriale, long l_id_magazzino) { + return (getQuantita() > 0.0D); + } + + public double getQuantita() { + TipologiaArticolo ta = getArticolo().getTipologiaArticolo(); + if (ta.getFlgUdm() == 1L) + return getNr(); + if (ta.getFlgUdm() == 3L) + return getMt(); + if (ta.getFlgUdm() == 2L) + return getKg(); + return 0.0D; + } + + public long getId_rigaDocumentoP() { + return this.id_rigaDocumentoP; + } + + public void setId_rigaDocumentoP(long id_rigaDocumentoP) { + this.id_rigaDocumentoP = id_rigaDocumentoP; + } + + public void findDisponibilitaPuntuale(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, String l_seriale, long l_id_magfisico, long l_id_clifor) { + String s_Sql_Sum = " SUM(kg) as kg, SUM(mt) as mt, SUM(nr) as nr from MOVIMENTO AS A"; + String s_Sql_colonne = ""; + WcString wc = new WcString(); + if (l_id_articolo != 0L) { + wc.addWc(" id_articolo = " + l_id_articolo); + s_Sql_colonne = s_Sql_colonne + " id_articolo,"; + } + if (l_id_articoloVariante != 0L) { + wc.addWc(" id_articoloVariante = " + l_id_articoloVariante); + s_Sql_colonne = s_Sql_colonne + " id_articoloVariante,"; + } + if (l_id_articoloTaglia != 0L) { + wc.addWc(" id_articoloTaglia = " + l_id_articoloTaglia); + s_Sql_colonne = s_Sql_colonne + " id_articoloTaglia,"; + } + if (l_id_magfisico != 0L) { + wc.addWc(" id_magFisico = " + l_id_magfisico); + s_Sql_colonne = s_Sql_colonne + " id_magFisico,"; + } + if (l_seriale != null && !l_seriale.isEmpty()) { + wc.addWc(" seriale = '" + l_seriale + "'"); + s_Sql_colonne = s_Sql_colonne + " seriale,"; + } + if (l_id_clifor != 0L) { + wc.addWc(" id_clifor = " + l_id_clifor); + s_Sql_colonne = s_Sql_colonne + " id_clifor,"; + } + String s_sql_groupby = ""; + if (!s_Sql_colonne.isEmpty()) + s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1); + try { + PreparedStatement stmt = getConn() + .prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public ResParm deleteP(long l_id_rigaDocumentoP) { + return delete("DELETE FROM MOVIMENTO WHERE id_rigaDocumentoP = " + l_id_rigaDocumentoP); + } + + public void findDisponibilitaPuntualeMagazziniInterni(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, String l_seriale, long l_id_clifor) { + String s_Sql_Sum = " SUM(kg) as kg, SUM(mt) as mt, SUM(nr) as nr from MOVIMENTO AS A"; + String s_Sql_colonne = ""; + WcString wc = new WcString(); + if (l_id_articolo != 0L) { + wc.addWc(" id_articolo = " + l_id_articolo); + s_Sql_colonne = s_Sql_colonne + " id_articolo,"; + } + if (l_id_articoloVariante != 0L) { + wc.addWc(" id_articoloVariante = " + l_id_articoloVariante); + s_Sql_colonne = s_Sql_colonne + " id_articoloVariante,"; + } + if (l_id_articoloTaglia != 0L) { + wc.addWc(" id_articoloTaglia = " + l_id_articoloTaglia); + s_Sql_colonne = s_Sql_colonne + " id_articoloTaglia,"; + } + MagFisico mag = new MagFisico(getApFull()); + Vectumerator vecMag = mag.findByTipo(1L); + if (vecMag.hasMoreElements()) { + StringBuilder mf = new StringBuilder(""); + s_Sql_colonne = s_Sql_colonne + " id_magFisico,"; + while (vecMag.hasMoreElements()) { + mag = (MagFisico)vecMag.nextElement(); + if (mf.length() > 0) + mf.append(" OR "); + mf.append(" id_magFisico = " + mag.getId_magFisico()); + } + mf.append(")"); + wc.addWc("(" + mf.toString()); + } + if (l_seriale != null && !l_seriale.isEmpty()) { + wc.addWc(" seriale = '" + l_seriale + "'"); + s_Sql_colonne = s_Sql_colonne + " seriale,"; + } + if (l_id_clifor != 0L) { + wc.addWc(" id_clifor = " + l_id_clifor); + s_Sql_colonne = s_Sql_colonne + " id_clifor,"; + } + String s_sql_groupby = ""; + if (!s_Sql_colonne.isEmpty()) + s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1); + try { + PreparedStatement stmt = getConn() + .prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public static ResParm aggiornaDispo(ApplParmFull ap, long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, long l_id_users) { + ResParm rp = new ResParm(true); + if (l_id_articolo != 0L || l_id_articoloVariante != 0L || l_id_articoloTaglia != 0L) { + Movimento mov = new Movimento(ap); + mov.findDisponibilitaPuntualeMagazziniInterni(l_id_articolo, l_id_articoloVariante, l_id_articoloTaglia, "", 0L); + Articolo art = new Articolo(ap); + art.findByPrimaryKey(l_id_articolo); + art.resetCalcoloQuantita(); + if (art.getTipo().getFlgTipoMagazzino() == 0L || art.getTipo().getFlgTipoMagazzino() == 9L) { + System.out.println("ATTENZIONE!!!!aggiornaDispo"); + art.setFlgDispo(1L); + } else { + if (l_id_articoloTaglia > 0L) { + ArticoloTaglia bean = new ArticoloTaglia(ap); + bean.findByPrimaryKey(l_id_articoloTaglia); + bean.setFlgDispo((mov.getQuantita() > 0.0D) ? 1L : 0L); + bean.save(); + } + if (l_id_articoloVariante > 0L) { + ArticoloVariante bean = new ArticoloVariante(ap); + bean.resetCalcoloQuantita(); + bean.save(); + } + art.setFlgDispo((mov.getQuantita() > 0.0D) ? 1L : 0L); + } + art.save(); + RigaDocumento rd = new RigaDocumento(ap); + rd.resetStatoPrenotazioneByArticolo(l_id_articolo, l_id_articoloVariante, l_id_articoloTaglia); + } + return rp; + } + + public ResParm save() { + setDataMovimento(getRigaDocumento().getDocumento().getDataDocumento()); + ResParm rp = super.save(); + if (rp.getStatus()) + rp = aggiornaDispo(getApFull(), getId_articolo(), getId_articoloVariante(), getId_articoloTaglia(), getLastUpdId_user()); + return rp; + } + + public ResParm delete(String sqlString) { + ResParm rp = new ResParm(false); + try { + Movimento mov = (Movimento)clone(); + rp = super.delete(sqlString); + aggiornaDispo(getApFull(), mov.getId_articolo(), mov.getId_articoloVariante(), mov.getId_articoloTaglia(), getLastInsertId()); + } catch (Exception e) { + rp.setStatus(false); + rp.setException(e); + } + return rp; + } + + public long getId_causaleMagazzino() { + return this.id_causaleMagazzino; + } + + public void setId_causaleMagazzino(long id_causaleMagazzino) { + this.id_causaleMagazzino = id_causaleMagazzino; + } + + public CausaleMagazzino getCausaleMagazzino() { + this.causaleMagazzino = (CausaleMagazzino)getSecondaryObject(this.causaleMagazzino, CausaleMagazzino.class, getId_causaleMagazzino()); + return this.causaleMagazzino; + } + + public void setCausaleMagazzino(CausaleMagazzino causaleMagazzino) { + this.causaleMagazzino = causaleMagazzino; + } + + public void findByRigaDocumentoCausale(long l_id_rigaDocumento, long l_id_causaleMagazzino) { + String s_Sql_Find = "select A.* from MOVIMENTO AS A "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_rigaDocumento = " + l_id_rigaDocumento); + wc.addWc(" A.id_causaleMagazzino = " + l_id_causaleMagazzino); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findBySerialeDisponibile(String l_seriale) { + String s_Sql_Find = "SELECT A.*, SUM(A.nr) AS nr from MOVIMENTO AS A "; + String s_Sql_Having = " HAVING nr > 0 "; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc(" A.seriale = '" + l_seriale + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findBySerialeEsistente(String l_seriale) { + String s_Sql_Find = "SELECT A.* from MOVIMENTO AS A "; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc(" A.seriale = '" + l_seriale + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Date getDataMovimento() { + return this.dataMovimento; + } + + public void setDataMovimento(Date dataMovimento) { + this.dataMovimento = dataMovimento; + } + + public String getDescrizioneArticolo() { + if (getId_articoloTaglia() != 0L) + return getArticoloTaglia().getDescrizioneCompleta(); + if (getId_articoloVariante() == 0L) + return getArticolo().getDescrizioneCompleta(); + return getArticoloVariante().getDescrizioneCompleta(); + } + + public Vectumerator findByCR(MovimentoCR CR, int pageNumber, int pageRows) { + if (CR.getFlgReport().equals("S") && CR.getFlgTipoReport() == 1L) + return findByCRCompatto(CR, pageNumber, pageRows); + boolean flgOttimizzo = (getParm("OTTIMIZZO").getNumero() == 1.0D); + StringBuffer s_Sql_Find = new StringBuffer("select A.* from MOVIMENTO AS A, RIGA_DOCUMENTO AS B, DOCUMENTO AS C, ARTICOLO AS D "); + String s_Sql_Order = " order by D.nome,D.codice, A.seriale, C.dataDocumento, C.id_esercizio desc, C.progDocumento desc"; + if (CR.getFlgOrderBy() == 1L) + s_Sql_Order = " order by C.dataDocumento asc, C.id_esercizio asc, C.progDocumento asc"; + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt; + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + } else { + if (pageNumber == 0) + pageNumber = 1; + int start = (pageNumber - 1) * pageRows; + int stop = start + pageRows; + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + " limit " + s_Sql_Order + "," + start); + } + findByCRCreateStmtDate(CR, stmt); + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) + return findRows(stmt, pageNumber, pageRows); + Vectumerator vec = findRows(stmt, 1, pageRows); + vec.setPageNumber(pageNumber); + vec.setTotNumberOfRecords(findByCRTotRecord(CR)); + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void findByCRCreateStmtDate(MovimentoCR CR, PreparedStatement stmt) { + try { + int dataCount = 0; + if (CR.getDataDocumentoDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoDa()); + } + if (CR.getDataDocumentoA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoA()); + } + if (CR.getDataRiferimentoDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataRiferimentoDa()); + } + if (CR.getDataRiferimentoA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataRiferimentoA()); + } + } catch (SQLException e) { + handleDebug(e); + } + } + + protected void findByCRCreateWC(MovimentoCR CR, StringBuffer s_Sql_Find, WcString wc) { + wc.addWc("A.id_rigaDocumento=B.id_rigaDocumento"); + wc.addWc("B.id_documento=C.id_documento"); + wc.addWc("B.id_articolo=D.id_articolo"); + if (!CR.getSearchTxt().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = prepareSqlString(st.nextToken()); + txt.append("(C.nominativoDocumento like '%" + token + "%' or D.nome like '%" + token + "%' )"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_articoloVariante() != 0L) { + wc.addWc("A.id_articoloVariante=" + CR.getId_articoloVariante()); + } else if (CR.getId_articolo() != 0L) { + wc.addWc("A.id_articolo=" + CR.getId_articolo()); + } + if (CR.getId_tipoDocumento() > 0L) + wc.addWc("C.id_tipoDocumento=" + CR.getId_tipoDocumento()); + if (CR.getId_esercizio() > 0L) + wc.addWc("year(C.dataDocumento)=" + CR.getId_esercizio()); + if (CR.getId_clifor() > 0L) + wc.addWc("C.id_clifor=" + CR.getId_clifor()); + if (CR.getId_magFisico() > 0L) + wc.addWc("A.id_magFisico=" + CR.getId_magFisico()); + if (CR.getId_tipo() != 0L) { + s_Sql_Find.append(" , TIPO AS E"); + wc.addWc("D.id_tipo=E.id_tipo"); + wc.addWc("(D.id_tipo=" + CR.getId_tipo() + " or E.indici like'%:" + CR.getId_tipo() + ":%')"); + } + if (CR.getId_marca() != 0L) + wc.addWc("D.id_marca=" + CR.getId_marca()); + if (!CR.getSeriale().isEmpty()) { + String temp = CR.getSeriale(); + temp = temp.replace("%", "\\%"); + temp = temp.replace("_", "\\_"); + temp = temp.replace("*", "%"); + wc.addWc("A.seriale like '" + CR.getSeriale() + "'"); + } + if (CR.getDataDocumentoDa() != null) + wc.addWc("C.dataDocumento>=?"); + if (CR.getDataDocumentoA() != null) + wc.addWc("C.dataDocumento<=?"); + if (CR.getDataRiferimentoDa() != null) + wc.addWc("C.dataRiferimento>=?"); + if (CR.getDataRiferimentoA() != null) + wc.addWc("C.dataRiferimento<=?"); + } + + private int findByCRTotRecord(MovimentoCR CR) { + StringBuffer s_Sql_Find = new StringBuffer("select count(*) as tot from MOVIMENTO AS A, RIGA_DOCUMENTO AS B, DOCUMENTO AS C, ARTICOLO AS D "); + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + findByCRCreateStmtDate(CR, stmt); + return (int)getTots(stmt); + } catch (Exception e) { + handleDebug(e); + return 0; + } + } + + public double getSaldoByArticoloVarianteTagliaMagazzino(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, long l_id_magFisico) { + String s_Sql_Find = "select SUM(A.kg) as kg, SUM(A.mt) as mt, SUM(A.nr) as nr from MOVIMENTO AS A "; + String s_Sql_Group = " group by A.id_articolo, A.id_articoloVariante, A.id_articoloTaglia "; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc(" A.id_articolo = " + l_id_articolo); + if (l_id_articoloVariante > 0L) + wc.addWc(" A.id_articoloVariante = " + l_id_articoloVariante); + if (l_id_articoloTaglia > 0L) + wc.addWc(" A.id_articoloTaglia = " + l_id_articoloTaglia); + wc.addWc(" A.id_magFisico = " + l_id_magFisico); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group); + findFirstRecord(stmt); + return getNr(); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public void creaFileCvs(MovimentoCR CR) { + try { + if (CR.getFlgReport().equals("S") && CR.getFlgTipoReport() == 1L) { + creaFileCvsCompatto(CR); + } else { + Vectumerator list = findByCR(CR, 0, 0); + CR.setFileName(getPathTmp() + "movMagazzino_" + getPathTmp() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "Operatore;Documento;Intestazione;Data;Cod. Articolo;Articolo;Seriale;Disp.Art.;Tipo Movimento;Magazzini;Q.ta;Kg;Mt;Nr."; + outCvsFile.writeLine(CR.getDescrizioneCR()); + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + Movimento row = (Movimento)list.nextElement(); + s1 = row.getRigaDocumento().getDocumento().getUsers().getCognomeNome() + row.getRigaDocumento().getDocumento().getUsers().getCognomeNome() + "\"" + SEP + "\"" + row.getRigaDocumento().getDocumento().getNumeroDocumentoCompleto() + SEP + row.getRigaDocumento().getDocumento().getClifor().getDescrizioneCompleta() + SEP + getDataFormat().format(row.getRigaDocumento().getDocumento().getDataDocumento()) + SEP + row.getCodiceArticolo() + SEP + row.getRigaDocumento().getDescrizioneRigaCompleta() + SEP + row.getSeriale() + SEP + getNf().format(row.getArticolo().getQuantita()) + SEP + row.getRigaDocumento().getDocumento().getTipoDocumento().getCausaleMagazzino().getDescrizione() + SEP + row.getMagFisico().getDescrizione() + SEP + getNf().format(row.getQuantita()) + SEP + getNf().format(row.getKg()) + SEP + getNf().format(row.getMt()) + SEP; + s1 = s1.replace("€", "€"); + s1 = s1.replace("»", "-->"); + outCvsFile.writeLine(s1); + } + outCvsFile.closeFile(); + } + } catch (Exception e) { + handleDebug(e); + } + } + + public Vectumerator findSaldiArticoloVarianteTagliaByCR_OLD(MovimentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.id_articolo, A.id_articoloVariante, A.id_articoloTaglia, SUM(A.kg) as kg, SUM(A.mt) as mt, SUM(A.nr) as nr from MOVIMENTO AS A INNER JOIN ARTICOLO AS B ON A.id_articolo=B.id_articolo LEFT JOIN ARTICOLO_VARIANTE AS C ON A.id_articoloVariante=C.id_articoloVariante INNER JOIN MAG_FISICO AS D ON A.id_magFisico=D.id_magFisico "; + String s_Sql_Group = " group by A.id_articolo, A.id_articoloVariante, A.id_articoloTaglia "; + String s_Sql_Order = " order by B.nome, C.nomeV, A.id_articoloTaglia "; + String s_Sql_Having = ""; + if (CR.getFlgInMagazzino() == 1L) { + s_Sql_Having = " Having SUM(kg) > 0 OR SUM(mt) > 0 OR SUM(nr) > 0 "; + } else if (CR.getFlgInMagazzino() == 2L) { + s_Sql_Having = " Having SUM(kg) < 0 OR SUM(mt) < 0 OR SUM(nr) < 0 "; + } + WcString wc = new WcString(); + if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) { + s_Sql_Find = s_Sql_Find + " LEFT JOIN ARTICOLO AS B ON A.id_articolo = B.id_articolo "; + String star = ""; + String temp = CR.getSearchTxt(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("(B.codice like '" + token + "%' or B.nome like '" + token + "%' or B.codiceProduttore like '" + token + "%' or B.codiciAlternativi like '%," + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_articolo() > 0L) + wc.addWc(" A.id_articolo = " + CR.getId_articolo()); + if (CR.getId_magFisico() > 0L) + wc.addWc(" A.id_magFisico = " + CR.getId_magFisico()); + if (CR.getFlgTipoMagazzino() > 0L) + wc.addWc(" D.flgTipo = " + CR.getFlgTipoMagazzino()); + if (CR.getId_clifor() > 0L) + wc.addWc(" A.id_clifor = " + CR.getId_clifor()); + try { + PreparedStatement stmt = getConn() + .prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findDisponibilitaPuntualeMagazziniInterniEsterni(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, String l_seriale, long l_id_clifor) { + String s_Sql_Sum = " SUM(kg) as kg, SUM(mt) as mt, SUM(nr) as nr from MOVIMENTO AS A"; + String s_Sql_colonne = ""; + WcString wc = new WcString(); + if (l_id_articolo != 0L) { + wc.addWc(" id_articolo = " + l_id_articolo); + s_Sql_colonne = s_Sql_colonne + " id_articolo,"; + } + if (l_id_articoloVariante != 0L) { + wc.addWc(" id_articoloVariante = " + l_id_articoloVariante); + s_Sql_colonne = s_Sql_colonne + " id_articoloVariante,"; + } + if (l_id_articoloTaglia != 0L) { + wc.addWc(" id_articoloTaglia = " + l_id_articoloTaglia); + s_Sql_colonne = s_Sql_colonne + " id_articoloTaglia,"; + } + MagFisico mag = new MagFisico(getApFull()); + StringBuilder mf = new StringBuilder(""); + Vectumerator vecMag = mag.findByTipo(1L); + if (vecMag.hasMoreElements()) + while (vecMag.hasMoreElements()) { + mag = (MagFisico)vecMag.nextElement(); + if (mf.length() > 0) + mf.append(" OR "); + mf.append(" id_magFisico = " + mag.getId_magFisico()); + } + vecMag = mag.findByTipo(2L); + if (vecMag.hasMoreElements()) + while (vecMag.hasMoreElements()) { + mag = (MagFisico)vecMag.nextElement(); + if (mf.length() > 0) + mf.append(" OR "); + mf.append(" id_magFisico = " + mag.getId_magFisico()); + } + if (mf.length() > 0) { + mf.append(")"); + wc.addWc("(" + mf.toString()); + s_Sql_colonne = s_Sql_colonne + " id_magFisico,"; + } + if (l_seriale != null && !l_seriale.isEmpty()) { + wc.addWc(" seriale = '" + l_seriale + "'"); + s_Sql_colonne = s_Sql_colonne + " seriale,"; + } + if (l_id_clifor != 0L) { + wc.addWc(" id_clifor = " + l_id_clifor); + s_Sql_colonne = s_Sql_colonne + " id_clifor,"; + } + String s_sql_groupby = ""; + if (!s_Sql_colonne.isEmpty()) + s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1); + try { + PreparedStatement stmt = getConn() + .prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findDisponibilitaGlobaleMagazziniInterniEsterni(long l_id_articolo, String l_seriale, long l_id_clifor) { + findDisponibilitaPuntualeMagazziniInterniEsterni(0L, 0L, 0L, l_seriale, l_id_clifor); + setId_articolo(l_id_articolo); + } + + public String getCodiceArticolo() { + return getArticolo().getCodice(); + } + + public Vectumerator findByCRCompatto(MovimentoCR CR, int pageNumber, int pageRows) { + boolean flgOttimizzo = (getParm("OTTIMIZZO").getNumero() == 1.0D); + StringBuffer s_Sql_Find = new StringBuffer("select A.id_articolo, A.id_articoloVariante, A.id_articoloTaglia, sum(A.kg) as Kg,sum(A.mt) as mt, sum(A.nr) as nr, D.nome, D.codice from MOVIMENTO AS A, RIGA_DOCUMENTO AS B, DOCUMENTO AS C, ARTICOLO AS D "); + String s_Sql_Order = " order by D.nome,D.codice"; + if (CR.getFlgOrderBy() == 1L) + s_Sql_Order = " order by C.dataDocumento asc, C.id_esercizio asc, C.progDocumento asc"; + String s_Sql_groupby = " group by A.id_articolo"; + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt; + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_groupby); + } else { + if (pageNumber == 0) + pageNumber = 1; + int start = (pageNumber - 1) * pageRows; + int stop = start + pageRows; + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_groupby + " limit " + s_Sql_Order + "," + start); + } + findByCRCreateStmtDate(CR, stmt); + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) + return findRows(stmt, pageNumber, pageRows); + Vectumerator vec = findRows(stmt, 1, pageRows); + vec.setPageNumber(pageNumber); + vec.setTotNumberOfRecords(findByCRTotRecord(CR)); + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void creaFileCvsCompatto(MovimentoCR CR) { + try { + Vectumerator list = findByCRCompatto(CR, 0, 0); + CR.setFileName(getPathTmp() + "movMagazzinoCompatto_" + getPathTmp() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "Cod. Articolo;Articolo;Tipo;Disp.Art.;Q.ta;Kg;Mt;Nr."; + outCvsFile.writeLine(CR.getDescrizioneCR()); + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + Movimento row = (Movimento)list.nextElement(); + s1 = row.getCodiceArticolo() + row.getCodiceArticolo() + SEP + row.getDescrizioneArticolo() + SEP + row.getArticolo().getTipo().getDescrizioneCompleta() + SEP + getNf().format(row.getArticolo().getQuantita()) + SEP + getNf().format(row.getQuantita()) + SEP + getNf().format(row.getKg()) + SEP + getNf().format(row.getMt()) + SEP; + s1 = s1.replace("€", "€"); + s1 = s1.replace("»", "-->"); + outCvsFile.writeLine(s1); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/MovimentoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/MovimentoCR.java new file mode 100644 index 00000000..75711171 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/MovimentoCR.java @@ -0,0 +1,463 @@ +package it.acxent.contab; + +import it.acxent.anag.Clifor; +import it.acxent.anag.MagFisico; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloTaglia; +import it.acxent.art.ArticoloVariante; +import it.acxent.art.Marca; +import it.acxent.art.Tipo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.util.SimpleDateFormat; +import java.io.Serializable; +import java.sql.Date; + +public class MovimentoCR extends CRAdapter implements Serializable { + private static final long serialVersionUID = -4078728447478246886L; + + public static final int TIPO_REPORT_STD = 0; + + public static final int TIPO_REPORT_COMPATTO = 1; + + private long id_movimento; + + private long id_rigaDocumento; + + private long id_articolo; + + private long id_articoloVariante; + + private long id_articoloTaglia; + + private long id_magFisico; + + private long id_clifor; + + private String seriale; + + private double kg; + + private double mt; + + private double nr; + + private RigaDocumento rigaDocumento; + + private Articolo articolo; + + private ArticoloVariante articoloVariante; + + private ArticoloTaglia articoloTaglia; + + private MagFisico magFisico; + + private Clifor clifor; + + private long flgInMagazzino = -1L; + + private long flgTipoMagazzino; + + private CausaleMagazzino causaleMagazzino; + + private long id_causaleMagazzino; + + private Date dataDocumentoA; + + private Date dataDocumentoDa; + + private String descrizioneCompletaArticolo; + + private long id_tipoDocumento; + + private long id_documento; + + private long id_documento2; + + private Date dataRiferimentoA; + + private Date dataRiferimentoDa; + + private long id_esercizio = -1L; + + private String fileName; + + private long id_marca; + + private long id_tipo; + + private Tipo tipo; + + private Marca marca; + + private TipoDocumento tipoDocumento; + + public static final long IN_MAGAZZINO = 1L; + + public static final long MAGAZZINO_NEGATIVO = 2L; + + public static final long IN_MAGAZZINO_O_NEGATIVO = 3L; + + public MovimentoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public MovimentoCR() {} + + public long getId_movimento() { + return this.id_movimento; + } + + public void setId_movimento(long id_movimento) { + this.id_movimento = id_movimento; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public void setId_rigaDocumento(long id_rigaDocumento) { + this.id_rigaDocumento = id_rigaDocumento; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + } + + public long getId_articoloTaglia() { + return this.id_articoloTaglia; + } + + public void setId_articoloTaglia(long id_articoloTaglia) { + this.id_articoloTaglia = id_articoloTaglia; + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public void setId_magFisico(long id_magFisico) { + this.id_magFisico = id_magFisico; + setMagFisico(null); + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + } + + public String getSeriale() { + return (this.seriale == null) ? AB_EMPTY_STRING : this.seriale.trim(); + } + + public void setSeriale(String seriale) { + this.seriale = seriale; + } + + public double getKg() { + return this.kg; + } + + public void setKg(double kg) { + this.kg = kg; + } + + public double getMt() { + return this.mt; + } + + public void setMt(double mt) { + this.mt = mt; + } + + public double getNr() { + return this.nr; + } + + public void setNr(double nr) { + this.nr = nr; + } + + public RigaDocumento getRigaDocumento() { + return this.rigaDocumento; + } + + public void setRigaDocumento(RigaDocumento rigaDocumento) { + this.rigaDocumento = rigaDocumento; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public void setArticolo(Articolo articolo) { + this.articolo = articolo; + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante()); + return this.articoloVariante; + } + + public void setArticoloVariante(ArticoloVariante articoloVariante) { + this.articoloVariante = articoloVariante; + } + + public ArticoloTaglia getArticoloTaglia() { + return this.articoloTaglia; + } + + public void setArticoloTaglia(ArticoloTaglia articoloTaglia) { + this.articoloTaglia = articoloTaglia; + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico()); + return this.magFisico; + } + + public void setMagFisico(MagFisico magFisico) { + this.magFisico = magFisico; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setClifor(Clifor clifor) { + this.clifor = clifor; + } + + public long getFlgInMagazzino() { + return this.flgInMagazzino; + } + + public void setFlgInMagazzino(long flgInMagazzino) { + this.flgInMagazzino = flgInMagazzino; + } + + public long getFlgTipoMagazzino() { + return this.flgTipoMagazzino; + } + + public void setFlgTipoMagazzino(long flgTipoMagazzino) { + this.flgTipoMagazzino = flgTipoMagazzino; + } + + public CausaleMagazzino getCausaleMagazzino() { + this.causaleMagazzino = (CausaleMagazzino)getSecondaryObject(this.causaleMagazzino, CausaleMagazzino.class, getId_causaleMagazzino()); + return this.causaleMagazzino; + } + + public long getId_causaleMagazzino() { + return this.id_causaleMagazzino; + } + + public void setCausaleMagazzino(CausaleMagazzino causaleMagazzino) { + this.causaleMagazzino = causaleMagazzino; + } + + public void setId_causaleMagazzino(long id_causaleMagazzino) { + this.id_causaleMagazzino = id_causaleMagazzino; + } + + public Date getDataDocumentoA() { + return this.dataDocumentoA; + } + + public void setDataDocumentoA(Date dataDocumentoA) { + this.dataDocumentoA = dataDocumentoA; + } + + public Date getDataDocumentoDa() { + return this.dataDocumentoDa; + } + + public void setDataDocumentoDa(Date dataDocumentoDa) { + this.dataDocumentoDa = dataDocumentoDa; + } + + public String getDescrizioneCompletaArticolo() { + if (getId_articoloVariante() != 0L) + return getArticoloVariante().getDescrizioneCompleta(); + if (getId_articolo() != 0L) + return getArticolo().getDescrizioneCompleta(); + return (this.descrizioneCompletaArticolo == null) ? AB_EMPTY_STRING : this.descrizioneCompletaArticolo.trim(); + } + + public long getId_tipoDocumento() { + return this.id_tipoDocumento; + } + + public void setId_tipoDocumento(long id_tipoDocumento) { + this.id_tipoDocumento = id_tipoDocumento; + setTipoDocumento(null); + } + + public long getId_documento() { + return this.id_documento; + } + + public void setId_documento(long id_documento) { + this.id_documento = id_documento; + } + + public long getId_documento2() { + return this.id_documento2; + } + + public void setId_documento2(long id_documento2) { + this.id_documento2 = id_documento2; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public Date getDataRiferimentoA() { + return this.dataRiferimentoA; + } + + public void setDataRiferimentoA(Date dataRiferimentoA) { + this.dataRiferimentoA = dataRiferimentoA; + } + + public Date getDataRiferimentoDa() { + return this.dataRiferimentoDa; + } + + public void setDataRiferimentoDa(Date dataRiferimentoDa) { + this.dataRiferimentoDa = dataRiferimentoDa; + } + + public long getId_esercizio() { + return this.id_esercizio; + } + + public void setId_esercizio(long id_esercizio) { + this.id_esercizio = id_esercizio; + } + + public String getFileName() { + return this.fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public long getId_marca() { + return this.id_marca; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo()); + return this.tipo; + } + + public void setId_marca(long newId_marca) { + this.id_marca = newId_marca; + setMarca(null); + } + + public void setId_tipo(long id_tipo) { + this.id_tipo = id_tipo; + setTipo(null); + } + + public Marca getMarca() { + return (Marca)getSecondaryObject(this.marca, Marca.class, new Long(getId_marca())); + } + + public void setMarca(Marca newMarca) { + this.marca = newMarca; + } + + public void setTipo(Tipo tipo) { + this.tipo = tipo; + } + + public String getTipoReport(long l_flgTipoReport) { + switch ((int)l_flgTipoReport) { + case 0: + return "Standard"; + case 1: + return "Compatto"; + } + return "??"; + } + + public String getDescrizioneCR() { + StringBuilder temp = new StringBuilder(); + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + if (!getSearchTxt().isEmpty()) + temp.append("Descrizione: " + getSearchTxt() + " - "); + if (getId_esercizio() != 0L) + temp.append("Anno: " + getId_esercizio() + " - "); + if (getDataDocumentoDa() != null && getDataDocumentoA() != null) { + temp.append("Data Documento: dal " + df.format(getDataDocumentoDa()) + " al " + df.format(getDataDocumentoA()) + " - "); + } else { + if (getDataDocumentoDa() != null) + temp.append("Data Documento: dal " + df.format(getDataDocumentoDa()) + " - "); + if (getDataDocumentoA() != null) + temp.append("Data Documento: al " + df.format(getDataDocumentoA()) + " - "); + } + if (getFlgInMagazzino() >= 0L) { + temp.append(" - In Magazzino:"); + if (getFlgInMagazzino() == 0L) + temp.append(" NO"); + if (getFlgInMagazzino() == 1L) + temp.append(" SI"); + if (getFlgInMagazzino() == 2L) + temp.append(" negativo"); + temp.append(" - "); + } + if (getId_magFisico() != 0L) + temp.append("Magazzino: " + getMagFisico().getDescrizione() + " - "); + if (getId_tipoDocumento() != 0L) + temp.append("Tipo Documento: " + getTipoDocumento().getDescrizioneCompleta() + " - "); + if (getId_articolo() != 0L) + temp.append("Articolo: " + getDescrizioneCompletaArticolo() + " - "); + if (getId_articoloVariante() != 0L) + temp.append("Variante: " + getArticoloVariante().getDescrizione() + " - "); + if (!getSeriale().isEmpty()) + temp.append("Seriale: " + getSeriale() + " - "); + if (getId_tipo() != 0L) + temp.append("Tipo: " + getTipo().getDescrizioneCompleta() + " - "); + if (getDataRiferimentoDa() != null && getDataRiferimentoA() != null) { + temp.append("Data Riferimento: dal " + df.format(getDataRiferimentoDa()) + " al " + df.format(getDataRiferimentoA()) + " - "); + } else { + if (getDataRiferimentoDa() != null) + temp.append("Data Riferimento: dal " + df.format(getDataRiferimentoDa()) + " - "); + if (getDataRiferimentoA() != null) + temp.append("Data Riferimento: al " + df.format(getDataRiferimentoA()) + " - "); + } + return temp.toString(); + } + + public TipoDocumento getTipoDocumento() { + this.tipoDocumento = (TipoDocumento)getSecondaryObject(this.tipoDocumento, TipoDocumento.class, getId_tipoDocumento()); + return this.tipoDocumento; + } + + public void setTipoDocumento(TipoDocumento tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/PianoConti.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/PianoConti.java new file mode 100644 index 00000000..6cac134a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/PianoConti.java @@ -0,0 +1,187 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.DBAdapterException; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class PianoConti extends DBAdapter implements Serializable { + private static final long serialVersionUID = 8044331984020899695L; + + private long id_pianoConti; + + private String contoCompleto; + + private String descrizione; + + private long flgTipo; + + private long flgCFBI; + + private long flgMovimentabile; + + private String mastro; + + private String conto; + + private String sottoconto; + + private static final long TIPO_ECONOMICO = 0L; + + private static final long TIPO_PATRIMONIALE = 1L; + + private static final long CFBI_NESSUNO = 0L; + + private static final long CFBI_CLIENTE = 1L; + + private static final long CFBI_FORNITORE = 2L; + + private static final long CFBI_BANCA = 3L; + + private static final long CFBI_IVA = 4L; + + public PianoConti(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public PianoConti() {} + + public long getId_pianoConti() { + return this.id_pianoConti; + } + + public void setId_pianoConti(long id_incassoPagamento) { + this.id_pianoConti = id_incassoPagamento; + } + + public String getConto() { + return (this.conto == null) ? "" : this.conto; + } + + public void setConto(String conto) { + this.conto = conto; + } + + public Vectumerator findByCR(PianoContiCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from PIANO_CONTI AS A"; + String s_Sql_Order = " ORDER BY contoCompleto "; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) + wc.addWc(" A.Descrizione like '%" + CR.getSearchTxt() + "%'"); + if (CR.getFlgMovimentabile() == 1L) + wc.addWc(" A.flgMovimentabile = 1 "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void deleteCascade() {} + + protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException { + return null; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public void setFlgTipo(long flgTipo) { + this.flgTipo = flgTipo; + } + + public long getFlgCFBI() { + return this.flgCFBI; + } + + public void setFlgCFBI(long flgCFBI) { + this.flgCFBI = flgCFBI; + } + + public long getFlgMovimentabile() { + return this.flgMovimentabile; + } + + public void setFlgMovimentabile(long flgMovimentabile) { + this.flgMovimentabile = flgMovimentabile; + } + + public String getDescrizioneTipo() { + return getDescrizioneTipo(getFlgTipo()); + } + + public String getDescrizioneTipo(long flgTipo) { + String ret = ""; + if (flgTipo == 0L) { + ret = "Economico"; + } else if (flgTipo == 1L) { + ret = "Patrimoniale"; + } + return ret; + } + + public String getDescrizioneCFBI() { + return getDescrizioneCFBI(getFlgCFBI()); + } + + public String getDescrizioneCFBI(long flgCFBI) { + String ret = ""; + if (flgCFBI == 0L) { + ret = "Nessuno"; + } else if (flgCFBI == 1L) { + ret = "Cliente"; + } else if (flgCFBI == 2L) { + ret = "Fornitore"; + } else if (flgCFBI == 3L) { + ret = "Banca"; + } else if (flgCFBI == 4L) { + ret = "Iva"; + } + return ret; + } + + public String getContoCompleto() { + return (this.contoCompleto == null) ? "" : this.contoCompleto; + } + + public void setContoCompleto(String contoCompleto) { + this.contoCompleto = contoCompleto; + } + + public String getMastro() { + return (this.mastro == null) ? "" : this.mastro; + } + + public void setMastro(String mastro) { + this.mastro = mastro; + } + + public String getSottoconto() { + return (this.sottoconto == null) ? "" : this.sottoconto; + } + + public void setSottoconto(String sottoconto) { + this.sottoconto = sottoconto; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + setContoCompleto(getMastro() + getMastro() + getConto()); + super.prepareSave(ps); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/PianoContiCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/PianoContiCR.java new file mode 100644 index 00000000..a0290d40 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/PianoContiCR.java @@ -0,0 +1,75 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.io.Serializable; + +public class PianoContiCR extends CRAdapter implements Serializable { + private static final long serialVersionUID = 8044331984020899695L; + + private long id_pianoConti; + + private String conto; + + private String descrizione; + + private long flgTipo; + + private long flgCFBI; + + private long flgMovimentabile; + + public PianoContiCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public PianoContiCR() {} + + public long getId_pianoConti() { + return this.id_pianoConti; + } + + public void setId_pianoConti(long id_incassoPagamento) { + this.id_pianoConti = id_incassoPagamento; + } + + public String getConto() { + return (this.conto == null) ? "" : this.conto; + } + + public void setConto(String conto) { + this.conto = conto; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public void setFlgTipo(long flgTipo) { + this.flgTipo = flgTipo; + } + + public long getFlgCFBI() { + return this.flgCFBI; + } + + public void setFlgCFBI(long flgCFBI) { + this.flgCFBI = flgCFBI; + } + + public long getFlgMovimentabile() { + return this.flgMovimentabile; + } + + public void setFlgMovimentabile(long flgMovimentabile) { + this.flgMovimentabile = flgMovimentabile; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RegistroIva.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RegistroIva.java new file mode 100644 index 00000000..53460e5e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RegistroIva.java @@ -0,0 +1,1707 @@ +package it.acxent.contab; + +import com.lowagie.text.Cell; +import com.lowagie.text.Chunk; +import com.lowagie.text.Document; +import com.lowagie.text.Element; +import com.lowagie.text.Font; +import com.lowagie.text.HeaderFooter; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Phrase; +import com.lowagie.text.Table; +import com.lowagie.text.pdf.PdfWriter; +import it.acxent.anag.Iva; +import it.acxent.contab.iva.RiepilogoIva; +import it.acxent.contab.iva.RiepilogoIvaItem; +import it.acxent.contab.iva.RigaRegistroIvaItem; +import it.acxent.contab.iva.RigheRegistroIva; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.PdfFontFactory; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.io.FileOutputStream; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.text.NumberFormat; +import java.util.Calendar; +import java.util.Enumeration; + +public class RegistroIva extends _ContabAdapter implements Serializable { + private long id_registroIva; + + private long anno; + + private Date dataUltimaStampa; + + private long ultimaPagina; + + private String flgTipoRegistro; + + private long ultimaRiga; + + private long flgTipoLiquidazione; + + private long flgMeseStampato; + + private long flgAnnoStampato; + + private long flgTrimestreStampato; + + private static long RI_ACQUISTI = 2L; + + private static long RI_VENDITA = 1L; + + private Date dataA; + + private Date dataDa; + + private String fileName; + + private long flgOss; + + private long paginaPdf; + + private boolean rivaOk = false; + + private long pagIniziale; + + private long rigaIniziale; + + private long flgDefinitivo; + + private boolean riepOk = false; + + private String flgPeriodo; + + static String PERIODO_I_TRIM = "1T"; + + static String PERIODO_II_TRIM = "2T"; + + static String PERIODO_IV_TRIM = "4T"; + + static String PERIODO_III_TRIM = "3T"; + + public RegistroIva() {} + + private RegistroIva(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public void setId_registroIva(long newId_registroIva) { + this.id_registroIva = newId_registroIva; + } + + public void setAnno(long newAnno) { + this.anno = newAnno; + } + + public void setDataUltimaStampa(Date newDataUltimaStampa) { + this.dataUltimaStampa = newDataUltimaStampa; + } + + public void setUltimaPagina(long newUltimaPagina) { + this.ultimaPagina = newUltimaPagina; + } + + public void setFlgTipoRegistro(String newFlgTipoRegistro) { + this.flgTipoRegistro = newFlgTipoRegistro; + } + + public void setUltimaRiga(long newUltimaRiga) { + this.ultimaRiga = newUltimaRiga; + } + + public void setFlgTipoLiquidazione(long newFlgTipoLiquidazione) { + this.flgTipoLiquidazione = newFlgTipoLiquidazione; + } + + public void setFlgMeseStampato(long newFlgMeseStampato) { + this.flgMeseStampato = newFlgMeseStampato; + } + + public void setFlgAnnoStampato(long newFlgAnnoStampato) { + this.flgAnnoStampato = newFlgAnnoStampato; + } + + public void setFlgTrimestreStampato(long newFlgTrimestreStampato) { + this.flgTrimestreStampato = newFlgTrimestreStampato; + } + + public long getId_registroIva() { + return this.id_registroIva; + } + + public long getAnno() { + return this.anno; + } + + public Date getDataUltimaStampa() { + return this.dataUltimaStampa; + } + + public long getUltimaPagina() { + return this.ultimaPagina; + } + + public String getFlgTipoRegistro() { + return (this.flgTipoRegistro == null) ? "" : this.flgTipoRegistro.trim(); + } + + public long getUltimaRiga() { + return this.ultimaRiga; + } + + public long getFlgTipoLiquidazione() { + return this.flgTipoLiquidazione; + } + + public long getFlgMeseStampato() { + return this.flgMeseStampato; + } + + public long getFlgAnnoStampato() { + return this.flgAnnoStampato; + } + + public long getFlgTrimestreStampato() { + return this.flgTrimestreStampato; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(RegistroIvaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from REGISTRO_IVA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public static final RegistroIva getInstance(ApplParmFull newApplParmFull, long l_tipo) { + RegistroIva ri = new RegistroIva(newApplParmFull); + try { + ri.findByPrimaryKey(l_tipo); + if (ri.getDBState() == 0) { + ri.setId_registroIva(l_tipo); + ri.setPagIniziale(1L); + ri.setAnno((long)Calendar.getInstance().get(1)); + ri.save(); + } + return ri; + } catch (Exception e) { + ri.handleDebug(e); + return null; + } + } + + private void creaIntestazione() { + try { + int cellLeading = 12; + Font fMedioB = new Font(2, 10.0F, 1); + Cell cell = new Cell(new Chunk("Riga", fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(2); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Data Reg.", fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("N. Doc.", fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Data Doc.", fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Ragione Sociale", fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(9); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Tipo", fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Totale Doc.", fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imponibile", fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Iva", fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Cod. Iva", fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(6); + this.pdfcorpo.addCell(cell); + } catch (Exception e) {} + } + + public void creaRegistroIvaPdf() { + RiepilogoIva riepilogoIva = new RiepilogoIva(); + this.paginaPdf = 0L; + String fullFileName = getPathTmpFull() + getPathTmpFull(); + if (isFileExist(fullFileName)) + new File(fullFileName).delete(); + try { + this.document = new Document(PageSize.A4.rotate(), 20.0F, 20.0F, 20.0F, 10.0F); + PdfWriter theWriter = PdfWriter.getInstance(this.document, new FileOutputStream(fullFileName)); + long numeroPagina = getPagIniziale(); + int cellLeading = 12; + Cell blankCell = new Cell(); + blankCell.setLeading((float)cellLeading); + blankCell.setBorder(0); + NumberFormat nf = getNf(); + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + Paragraph paragraph = creaParagrafoConGrassetto(getHeaderDoocumento(1) + "\n" + getHeaderDoocumento(1), PDF_fMedio, PDF_fMedioB); + Iva iva20 = new Iva(getApFull()); + iva20.findByPrimaryKey(getCodiceIvaVendStd()); + String temp = ""; + if (getPeriodo().isEmpty()) { + temp = temp + " - " + temp + " - " + df.format(getDataDa()); + } else { + temp = temp + " - " + temp; + } + if (getFlgDefinitivo() == 0L) + temp = temp + " - STAMPA DI PROVA"; + temp = temp + " pag. "; + if (getId_registroIva() == RI_ACQUISTI) { + paragraph.add(new Chunk("\nRegistro iva ACQUISTI " + temp, PdfFontFactory.PDF_fGrandeB)); + } else { + paragraph.add(new Chunk("\nRegistro iva VENDITE " + temp, PdfFontFactory.PDF_fGrandeB)); + } + HeaderFooter header = new HeaderFooter((Phrase)paragraph, true); + header.setAlignment(0); + header.setBorder(0); + this.document.setHeader(header); + this.document.setPageCount((int)numeroPagina - 1); + this.document.open(); + long numeroRiga = getRigaIniziale(); + prepareNewPdfCorpoDocument(); + this.pdfcorpo.setBorderWidth(1.0F); + creaIntestazione(); + this.pdfcorpo.endHeaders(); + Documento documento = new Documento(getApFull()); + DocumentoCR CR = new DocumentoCR(getApFull()); + CR.setDataDocumentoDa(getDataDa()); + CR.setDataDocumentoA(getDataA()); + CR.setFlgStato(1L); + CR.setFlgOrderBy(9L); + CR.setFlgOss(getFlgOss()); + if (getId_registroIva() == RI_ACQUISTI) { + CR.setFlgTipologia(20L); + CR.setFlgClienteFornitore("F"); + } else { + CR.setFlgTipologia(20L); + CR.setFlgClienteFornitore("C"); + } + Vectumerator vec = documento.findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Date dataDoc; + String numDoc; + Documento row = (Documento)vec.nextElement(); + if (row.getProgDocumento() == 5L) + System.out.println("555"); + Date dataReg = row.getDataDocumento(); + if (getId_registroIva() == RI_ACQUISTI) { + numDoc = row.getRiferimento(); + dataDoc = row.getDataRiferimento(); + } else { + numDoc = row.getNumeroDocumento(); + dataDoc = row.getDataDocumento(); + } + String ragSoc = row.getClifor().getDescrizioneCompleta(); + if (ragSoc.length() > 30) + ragSoc = ragSoc.substring(0, 30); + String tipo = row.getTipoDocumento().getDescrizione(); + double totDoc = row.getTotaleDocumentoSenzaRitenuta(); + RigheRegistroIva rri = row.getRigaRegistroIvaCompleto(); + if (row.getTipoDocumento().getFlgTipologia() == 1L) { + boolean fatturaPositiva = true; + } else { + boolean fatturaPositiva = false; + } + boolean isNotaDiCredito = true; + if (row.getTipoDocumento().getFlgTipologia() == 1L) + isNotaDiCredito = false; + boolean isPIva = !row.getClifor().getPIva().isEmpty(); + Enumeration enuRrri = rri.elements(); + boolean flgPrimaRiga = true; + while (enuRrri.hasMoreElements()) { + RigaRegistroIvaItem rrii = enuRrri.nextElement(); + double imponibile = rrii.getImponibile(); + double iva = rrii.getImportoIva(); + String codIva = rrii.getIva().getDescrizione(); + creaRigaRegistro(numeroRiga, row, dataReg, dataDoc, numDoc, ragSoc, tipo, codIva, totDoc, imponibile, iva, flgPrimaRiga); + flgPrimaRiga = false; + riepilogoIva.addRigaRegistroIvaItem(rrii, isNotaDiCredito, isPIva, + (row.getClifor().getFlgSplitPayment() == 1L)); + } + numeroRiga++; + } + Cell cell = new Cell(new Chunk("\n\n\n", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(8); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + this.document.newPage(); + float[] colWidthsRiepilogo = { 30.0F, 10.0F, 10.0F, 10.0F, 10.0F, 10.0F, 10.0F, 10.0F }; + if (getId_registroIva() == RI_VENDITA) { + this.pdfcorpo = new Table(8); + this.pdfcorpo.setWidth(100.0F); + this.pdfcorpo.setPadding(2.0F); + this.pdfcorpo.setSpacing(0.0F); + this.pdfcorpo.setWidths(colWidthsRiepilogo); + cell = new Cell(new Chunk("Codice IVA CON P.I./Cod. Fisc.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imposta", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Esente/N.I.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imponibile Indetr.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imposta Indetr.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Split Payment", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("% Ind.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + Enumeration enumeration = riepilogoIva.elementsConPI(); + DoubleOperator doubleOperator1 = new DoubleOperator(0.0F); + DoubleOperator doubleOperator2 = new DoubleOperator(0.0F); + DoubleOperator doubleOperator3 = new DoubleOperator(0.0F); + DoubleOperator doubleOperator4 = new DoubleOperator(0.0F); + DoubleOperator doubleOperator5 = new DoubleOperator(0.0F); + DoubleOperator doubleOperator6 = new DoubleOperator(0.0F); + while (enumeration.hasMoreElements()) { + RiepilogoIvaItem riepilogoIvaItem = enumeration.nextElement(); + doubleOperator1.add(riepilogoIvaItem.getImponibile()); + doubleOperator2.add(riepilogoIvaItem.getImposta()); + doubleOperator3.add(riepilogoIvaItem.getEsente()); + doubleOperator4.add(riepilogoIvaItem.getImponibileIndetraibile()); + doubleOperator5.add(riepilogoIvaItem.getImpostaIndetraibile()); + doubleOperator6.add(riepilogoIvaItem.getSplit()); + cell = new Cell(new Chunk(riepilogoIvaItem.getIva().getDescrizione(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getImponibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImponibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getImposta() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImposta()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getEsente() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getEsente()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getImponibileIndetraibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImponibileIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getImponibileIndetraibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImponibileIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getSplit() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getSplit()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getIva().getAliquotaIndetraibile() == 0L) ? "\n" : nf.format(riepilogoIvaItem.getIva().getAliquotaIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("TOTALI", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((doubleOperator1.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator1.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((doubleOperator2.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator2.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((doubleOperator3.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator3.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((doubleOperator4.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator4.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((doubleOperator5.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator5.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((doubleOperator6.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator6.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + this.pdfcorpo = new Table(8); + this.pdfcorpo.setWidth(100.0F); + this.pdfcorpo.setPadding(2.0F); + this.pdfcorpo.setSpacing(0.0F); + this.pdfcorpo.setWidths(colWidthsRiepilogo); + cell = new Cell(new Chunk("Codice IVA SENZA P.I./Cod. Fisc.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imposta", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Esente/N.I.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imponibile Indetr.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imposta Indetr.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Split Payment", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("% Ind.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + enumeration = riepilogoIva.elementsSenzaPI(); + doubleOperator1 = new DoubleOperator(0.0F); + doubleOperator2 = new DoubleOperator(0.0F); + doubleOperator3 = new DoubleOperator(0.0F); + doubleOperator4 = new DoubleOperator(0.0F); + doubleOperator5 = new DoubleOperator(0.0F); + doubleOperator6 = new DoubleOperator(0.0F); + while (enumeration.hasMoreElements()) { + RiepilogoIvaItem riepilogoIvaItem = enumeration.nextElement(); + doubleOperator1.add(riepilogoIvaItem.getImponibile()); + doubleOperator2.add(riepilogoIvaItem.getImposta()); + doubleOperator3.add(riepilogoIvaItem.getEsente()); + doubleOperator4.add(riepilogoIvaItem.getImponibileIndetraibile()); + doubleOperator5.add(riepilogoIvaItem.getImpostaIndetraibile()); + doubleOperator6.add(riepilogoIvaItem.getSplit()); + cell = new Cell(new Chunk(riepilogoIvaItem.getIva().getDescrizione(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getImponibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImponibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getImposta() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImposta()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getEsente() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getEsente()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getImponibileIndetraibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImponibileIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getImpostaIndetraibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImpostaIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getSplit() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getSplit()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getIva().getAliquotaIndetraibile() == 0L) ? "\n" : nf.format(riepilogoIvaItem.getIva().getAliquotaIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("TOTALI", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((doubleOperator1.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator1.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((doubleOperator2.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator2.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((doubleOperator3.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator3.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((doubleOperator4.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator4.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((doubleOperator5.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator5.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((doubleOperator6.getResult() == 0.0D) ? "\n" : nf.format(doubleOperator6.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + } + this.pdfcorpo = new Table(8); + this.pdfcorpo.setWidth(100.0F); + this.pdfcorpo.setPadding(2.0F); + this.pdfcorpo.setSpacing(0.0F); + this.pdfcorpo.setWidths(colWidthsRiepilogo); + cell = new Cell(new Chunk("Codice IVA TOTALI", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imposta", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Esente/N.I.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imponibile Indetr.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imposta Indetr.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Split Payment", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("% Ind.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + Enumeration vriep = riepilogoIva.elements(); + DoubleOperator totImponibile = new DoubleOperator(0.0F); + DoubleOperator totImposta = new DoubleOperator(0.0F); + DoubleOperator totEsente = new DoubleOperator(0.0F); + DoubleOperator totImponibileIndetraibile = new DoubleOperator(0.0F); + DoubleOperator totImpostaIndetraibile = new DoubleOperator(0.0F); + DoubleOperator totSplit = new DoubleOperator(0.0F); + while (vriep.hasMoreElements()) { + RiepilogoIvaItem riepilogoIvaItem = vriep.nextElement(); + totImponibile.add(riepilogoIvaItem.getImponibile()); + totImposta.add(riepilogoIvaItem.getImposta()); + totEsente.add(riepilogoIvaItem.getEsente()); + totImponibileIndetraibile.add(riepilogoIvaItem.getImponibileIndetraibile()); + totImpostaIndetraibile.add(riepilogoIvaItem.getImpostaIndetraibile()); + totSplit.add(riepilogoIvaItem.getSplit()); + cell = new Cell(new Chunk(riepilogoIvaItem.getIva().getDescrizione(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getImponibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImponibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getImposta() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImposta()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getEsente() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getEsente()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getImponibileIndetraibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImponibileIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getImpostaIndetraibile() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getImpostaIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getSplit() == 0.0D) ? "\n" : nf.format(riepilogoIvaItem.getSplit()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((riepilogoIvaItem.getIva().getAliquotaIndetraibile() == 0L) ? "\n" : nf.format(riepilogoIvaItem.getIva().getAliquotaIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("TOTALI", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totImponibile.getResult() == 0.0D) ? "\n" : nf.format(totImponibile.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totImposta.getResult() == 0.0D) ? "\n" : nf.format(totImposta.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totEsente.getResult() == 0.0D) ? "\n" : nf.format(totEsente.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totImponibileIndetraibile.getResult() == 0.0D) ? "\n" : nf.format(totImponibileIndetraibile.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totImpostaIndetraibile.getResult() == 0.0D) ? "\n" : nf.format(totImpostaIndetraibile.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totSplit.getResult() == 0.0D) ? "\n" : nf.format(totSplit.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + this.document.close(); + numeroPagina = (long)theWriter.getPageNumber(); + if (getFlgDefinitivo() == 1L) { + setDataUltimaStampa(getDataA()); + Calendar cal = Calendar.getInstance(); + cal.setTime(getDataA()); + setAnno((long)cal.get(1)); + setUltimaPagina(numeroPagina - 1L); + setUltimaRiga(numeroRiga - 1L); + save(); + } + setRivaOk(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + + private void creaRigaRegistro(long numeroRiga, Documento bean, Date dataReg, Date dataDoc, String numDoc, String ragSoc, String flgTipoFattura, String codIva, double totDoc, double imponibile, double iva, boolean flgPR) { + try { + int cellLeading = 12; + NumberFormat nf = getNf(); + SimpleDateFormat df = getDataFormat(); + String segno = (bean.getTipoDocumento().getFlgTipologia() == 1L) ? + "" : + "-"; + if (flgPR) { + cell = new Cell(new Chunk(String.valueOf(numeroRiga), PdfFontFactory.PDF_fMedio)); + } else { + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio)); + } + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(2); + this.pdfcorpo.addCell(cell); + if (flgPR) { + cell = new Cell(new Chunk(df.format(dataReg), PdfFontFactory.PDF_fMedio)); + } else { + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio)); + } + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + if (flgPR) { + cell = new Cell(new Chunk(numDoc, PdfFontFactory.PDF_fPiccolo)); + } else { + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio)); + } + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + if (flgPR) { + cell = new Cell(new Chunk(df.format(dataDoc), PdfFontFactory.PDF_fMedio)); + } else { + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio)); + } + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + if (flgPR) { + cell = new Cell(new Chunk(ragSoc, PdfFontFactory.PDF_fMedio)); + } else { + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio)); + } + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(9); + this.pdfcorpo.addCell(cell); + if (flgPR) { + cell = new Cell(new Chunk(bean.getTipoDocumento().getDescrizione(), PdfFontFactory.PDF_fPiccolissimo)); + } else { + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio)); + } + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(5); + this.pdfcorpo.addCell(cell); + if (flgPR) { + cell = new Cell(new Chunk(segno + segno, PdfFontFactory.PDF_fMedio)); + } else { + cell = new Cell(new Chunk("", PdfFontFactory.PDF_fMedio)); + } + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + Cell cell = new Cell(new Chunk(segno + segno, PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + if (bean.getClifor().getFlgSplitPayment() == 1L) { + cell = new Cell(new Chunk(segno + segno + " (split)", PdfFontFactory.PDF_fMedioRosso)); + } else { + cell = new Cell(new Chunk(segno + segno, PdfFontFactory.PDF_fMedio)); + } + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(3); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(codIva, PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(6); + this.pdfcorpo.addCell(cell); + } catch (Exception e) {} + } + + public void aggiustaRPAIniziale() { + long currentAnno; + Calendar cal = Calendar.getInstance(); + if (getDataUltimaStampa() == null) { + setAnno((long)getCurrentYear()); + currentAnno = getAnno(); + } else { + cal.setTime(getDataUltimaStampa()); + currentAnno = (long)cal.get(1); + cal.add(6, 1); + setAnno((long)cal.get(1)); + } + if (currentAnno == getAnno()) { + setPagIniziale(getUltimaPagina() + 1L); + setRigaIniziale(getUltimaRiga() + 1L); + } else { + setPagIniziale(1L); + setRigaIniziale(1L); + } + } + + public boolean isProtocolloConBuchi(long anno) { + if (getApFull() == null) + return false; + if (anno == 0L) { + Calendar cal = Calendar.getInstance(); + anno = (long)cal.get(1); + } + Documento bean = new Documento(getApFull()); + return bean.isProgConBuchi(anno); + } + + public boolean isRivaOk() { + return this.rivaOk; + } + + public void setDataA(Date date) { + if (getFlgPeriodo().isEmpty()) + this.dataA = date; + } + + public void setDataDa(Date date) { + if (getFlgPeriodo().isEmpty()) + this.dataDa = date; + } + + public void setRivaOk(boolean b) { + this.rivaOk = b; + } + + public String trovaPrimoBuco(long anno) { + if (getApFull() == null) + return "Protocolli F.A. anno" + anno + " ok"; + if (anno == 0L) { + Calendar cal = Calendar.getInstance(); + anno = (long)cal.get(1); + } + Documento bean = new Documento(getApFull()); + return bean.trovaPrimoBuco(anno); + } + + public long getPagIniziale() { + return (this.pagIniziale == 0L) ? (getUltimaPagina() + 1L) : this.pagIniziale; + } + + public void setPagIniziale(long newPagIniziale) { + this.pagIniziale = newPagIniziale; + } + + public long getRigaIniziale() { + return (this.rigaIniziale == 0L) ? (getUltimaRiga() + 1L) : this.rigaIniziale; + } + + public void setRigaIniziale(long l) { + this.rigaIniziale = l; + } + + public Date getDataA() { + return this.dataA; + } + + public Date getDataDa() { + return this.dataDa; + } + + public long getFlgDefinitivo() { + return this.flgDefinitivo; + } + + public void setFlgDefinitivo(long flgDefinitivo) { + this.flgDefinitivo = flgDefinitivo; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getNomeRegistro() { + if (!getFileName().isEmpty()) + return getFileName().substring(getFileName().lastIndexOf(File.separator) + 1); + return ""; + } + + public boolean isRiepOk() { + return this.riepOk; + } + + public void setRiepOk(boolean riepOk) { + this.riepOk = riepOk; + } + + public String getFlgPeriodo() { + return (this.flgPeriodo == null) ? "" : this.flgPeriodo.trim(); + } + + public void setFlgPeriodo(String l_flgPeriodo) { + this.flgPeriodo = (l_flgPeriodo == null) ? "" : l_flgPeriodo.trim(); + Calendar cal = Calendar.getInstance(); + cal.set(1, (int)getAnno()); + if (this.flgPeriodo.equals(PERIODO_I_TRIM)) { + Calendar temp = Calendar.getInstance(); + this.dataDa = DBAdapter.getFirstOfYear((int)getAnno()); + temp.set(cal.get(1), 2, 31); + Date td = new Date(temp.getTime().getTime()); + this.dataA = td; + } else if (this.flgPeriodo.equals(PERIODO_II_TRIM)) { + Calendar temp = Calendar.getInstance(); + temp.set(cal.get(1), 3, 1); + Date td = new Date(temp.getTime().getTime()); + this.dataDa = td; + temp.set(cal.get(1), 5, 30); + td = new Date(temp.getTime().getTime()); + this.dataA = td; + } else if (this.flgPeriodo.equals(PERIODO_III_TRIM)) { + Calendar temp = Calendar.getInstance(); + temp.set(cal.get(1), 6, 1); + Date td = new Date(temp.getTime().getTime()); + this.dataDa = td; + temp.set(cal.get(1), 8, 30); + td = new Date(temp.getTime().getTime()); + this.dataA = td; + } else if (this.flgPeriodo.equals(PERIODO_IV_TRIM)) { + Calendar temp = Calendar.getInstance(); + temp.set(cal.get(1), 9, 1); + Date td = new Date(temp.getTime().getTime()); + this.dataDa = td; + this.dataA = DBAdapter.getLastOfYear((int)getAnno()); + } + } + + public void creaRiepilogoIvaPdf() { + RiepilogoIva riepilogoIvaAcquisti = new RiepilogoIva(); + RiepilogoIva riepilogoIvaVendite = new RiepilogoIva(); + this.paginaPdf = 0L; + try { + this.document = new Document(PageSize.A4.rotate(), 20.0F, 20.0F, 20.0F, 10.0F); + PdfWriter theWriter = PdfWriter.getInstance(this.document, new FileOutputStream(getFileName())); + int cellLeading = 12; + Cell blankCell = new Cell(); + blankCell.setLeading((float)cellLeading); + blankCell.setBorder(0); + NumberFormat nf = getNf(); + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + Paragraph paragraph = creaParagrafoConGrassetto(getHeaderDoocumento(1) + "\n" + getHeaderDoocumento(1), PDF_fMedio, PDF_fMedioB); + Iva iva20 = new Iva(getApFull()); + iva20.findByPrimaryKey(getCodiceIvaVendStd()); + String temp = ""; + if (getPeriodo().isEmpty()) { + temp = temp + " - " + temp + " - " + df.format(getDataDa()); + } else { + temp = temp + " - " + temp; + } + temp = temp + " pag. "; + paragraph.add(new Chunk("\n\nSTAMPA RIEPILOGATIVA REGISTRI IVA " + temp, PdfFontFactory.PDF_fGrandeB)); + HeaderFooter header = new HeaderFooter((Phrase)paragraph, true); + header.setAlignment(0); + header.setBorder(0); + this.document.setHeader(header); + this.document.open(); + prepareNewPdfCorpoDocument(); + this.pdfcorpo.setBorderWidth(1.0F); + this.pdfcorpo.endHeaders(); + float[] colWidthsRiepilogo = { 30.0F, 10.0F, 10.0F, 10.0F, 10.0F, 10.0F, 10.0F, 10.0F }; + Documento documento = new Documento(getApFull()); + DocumentoCR CR = new DocumentoCR(getApFull()); + CR.setDataDocumentoDa(getDataDa()); + CR.setDataDocumentoA(getDataA()); + CR.setFlgStato(1L); + CR.setFlgOrderBy(1L); + CR.setId_contatore(1L); + Vectumerator vec = documento.findByCR(CR, 0, 0); + System.out.println("Vendite"); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + System.out.println(row.getNumeroDocumentoCompleto()); + RigheRegistroIva rri = row.getRigaRegistroIvaCompleto(); + Enumeration enuRrri = rri.elements(); + while (enuRrri.hasMoreElements()) + RigaRegistroIvaItem rrii = enuRrri.nextElement(); + } + this.pdfcorpo = new Table(8); + this.pdfcorpo.setWidth(100.0F); + this.pdfcorpo.setBorder(0); + this.pdfcorpo.setPadding(2.0F); + this.pdfcorpo.setSpacing(0.0F); + this.pdfcorpo.setWidths(colWidthsRiepilogo); + Cell cell = new Cell(new Chunk("REGISTRO IVA VENDITE", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(8); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Codice IVA ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imposta", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Esente/N.I.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Impon. Indetr.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imposta Indetr.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Split Payment", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("% Ind.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + Enumeration vriep = riepilogoIvaVendite.elements(); + DoubleOperator totImponibileVendite = new DoubleOperator(0.0F); + DoubleOperator totImpostaVendite = new DoubleOperator(0.0F); + DoubleOperator totEsenteVendite = new DoubleOperator(0.0F); + DoubleOperator totImponibileIndetraibileVendite = new DoubleOperator(0.0F); + DoubleOperator totImpostaIndetraibileVendite = new DoubleOperator(0.0F); + DoubleOperator totSplit = new DoubleOperator(0.0F); + while (vriep.hasMoreElements()) { + RiepilogoIvaItem ri = vriep.nextElement(); + totImponibileVendite.add(ri.getImponibile()); + totImpostaVendite.add(ri.getImposta()); + totEsenteVendite.add(ri.getEsente()); + totImponibileIndetraibileVendite.add(ri.getImponibileIndetraibile()); + totImpostaIndetraibileVendite.add(ri.getImpostaIndetraibile()); + totSplit.add(ri.getSplit()); + cell = new Cell(new Chunk(ri.getIva().getDescrizione(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((ri.getImponibile() == 0.0D) ? "\n" : nf.format(ri.getImponibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((ri.getImposta() == 0.0D) ? "\n" : nf.format(ri.getImposta()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((ri.getEsente() == 0.0D) ? "\n" : nf.format(ri.getEsente()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((ri.getImponibileIndetraibile() == 0.0D) ? "\n" : nf.format(ri.getImponibileIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((ri.getImpostaIndetraibile() == 0.0D) ? "\n" : nf.format(ri.getImpostaIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((ri.getSplit() == 0.0D) ? "\n" : nf.format(ri.getSplit()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((ri.getIva().getAliquotaIndetraibile() == 0L) ? "\n" : nf.format(ri.getIva().getAliquotaIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("TOTALI", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totImponibileVendite.getResult() == 0.0D) ? "\n" : nf.format(totImponibileVendite.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totImpostaVendite.getResult() == 0.0D) ? "\n" : nf.format(totImpostaVendite.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totEsenteVendite.getResult() == 0.0D) ? "\n" : nf.format(totEsenteVendite.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totImponibileIndetraibileVendite.getResult() == 0.0D) ? "\n" : nf.format(totImponibileIndetraibileVendite.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totImpostaIndetraibileVendite.getResult() == 0.0D) ? "\n" : nf.format(totImpostaIndetraibileVendite.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totSplit.getResult() == 0.0D) ? "\n" : nf.format(totSplit.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("\n\n\n", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(8); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + documento = new Documento(getApFull()); + CR = new DocumentoCR(getApFull()); + CR.setDataDocumentoDa(getDataDa()); + CR.setDataDocumentoA(getDataA()); + CR.setFlgStato(1L); + CR.setFlgOrderBy(1L); + CR.setId_contatore(2L); + vec = documento.findByCR(CR, 0, 0); + System.out.println("Acquisti"); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + System.out.println(row.getNumeroDocumentoCompleto()); + RigheRegistroIva rri = row.getRigaRegistroIvaCompleto(); + Enumeration enuRrri = rri.elements(); + while (enuRrri.hasMoreElements()) + RigaRegistroIvaItem rrii = enuRrri.nextElement(); + } + this.pdfcorpo = new Table(8); + this.pdfcorpo.setWidth(100.0F); + this.pdfcorpo.setBorder(0); + this.pdfcorpo.setPadding(2.0F); + this.pdfcorpo.setSpacing(0.0F); + this.pdfcorpo.setWidths(colWidthsRiepilogo); + cell = new Cell(new Chunk("REGISTRO IVA ACQUISTI", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(8); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Codice IVA ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imponibile", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imposta", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Esente/N.I.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Impon. Indetr.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Imposta Indetr.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Split Payment", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("% Ind.", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + vriep = riepilogoIvaAcquisti.elements(); + DoubleOperator totImponibileAcquisti = new DoubleOperator(0.0F); + DoubleOperator totImpostaAcquisti = new DoubleOperator(0.0F); + DoubleOperator totEsenteAcquisti = new DoubleOperator(0.0F); + DoubleOperator totImponibileIndetraibileAcquisti = new DoubleOperator(0.0F); + DoubleOperator totImpostaIndetraibileAcquisti = new DoubleOperator(0.0F); + DoubleOperator totSplitAcquisti = new DoubleOperator(0.0F); + while (vriep.hasMoreElements()) { + RiepilogoIvaItem ri = vriep.nextElement(); + totImponibileAcquisti.add(ri.getImponibile()); + totImpostaAcquisti.add(ri.getImposta()); + totEsenteAcquisti.add(ri.getEsente()); + totImponibileIndetraibileAcquisti.add(ri.getImponibileIndetraibile()); + totImpostaIndetraibileAcquisti.add(ri.getImpostaIndetraibile()); + totSplitAcquisti.add(ri.getSplit()); + cell = new Cell(new Chunk(ri.getIva().getDescrizione(), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((ri.getImponibile() == 0.0D) ? "\n" : nf.format(ri.getImponibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((ri.getImposta() == 0.0D) ? "\n" : nf.format(ri.getImposta()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((ri.getEsente() == 0.0D) ? "\n" : nf.format(ri.getEsente()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((ri.getImponibileIndetraibile() == 0.0D) ? "\n" : nf.format(ri.getImponibileIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((ri.getImpostaIndetraibile() == 0.0D) ? "\n" : nf.format(ri.getImpostaIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((ri.getSplit() == 0.0D) ? "\n" : nf.format(ri.getSplit()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((ri.getIva().getAliquotaIndetraibile() == 0L) ? "\n" : nf.format(ri.getIva().getAliquotaIndetraibile()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + } + cell = new Cell(new Chunk("TOTALI", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totImponibileAcquisti.getResult() == 0.0D) ? "\n" : nf.format(totImponibileAcquisti.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totImpostaAcquisti.getResult() == 0.0D) ? "\n" : nf.format(totImpostaAcquisti.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totEsenteAcquisti.getResult() == 0.0D) ? "\n" : nf.format(totEsenteAcquisti.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totImponibileIndetraibileAcquisti.getResult() == 0.0D) ? "\n" : nf.format(totImponibileIndetraibileAcquisti.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totImpostaIndetraibileAcquisti.getResult() == 0.0D) ? "\n" : nf.format(totImpostaIndetraibileAcquisti.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totSplitAcquisti.getResult() == 0.0D) ? "\n" : nf.format(totSplitAcquisti.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("\n", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("\n\n\n", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(8); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + float[] colWidthsPagamento = { 30.0F, 10.0F, 10.0F, 50.0F }; + this.pdfcorpo = new Table(4); + this.pdfcorpo.setWidth(100.0F); + this.pdfcorpo.setBorder(0); + this.pdfcorpo.setPadding(2.0F); + this.pdfcorpo.setSpacing(0.0F); + this.pdfcorpo.setWidths(colWidthsPagamento); + cell = new Cell(new Chunk("TOTALE IVA VENDITE", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("+", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totImpostaVendite.getResult() == 0.0D) ? "\n" : nf.format(totImpostaVendite.getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("TOTALE IVA ACQUISTI", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("-", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk((totImpostaAcquisti.getResult() == 0.0D) ? "\n" : nf.format(totImpostaAcquisti.getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("IMPOSTA DA PAGARE", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorderWidthLeft(1.0F); + cell.setBorderWidthRight(1.0F); + cell.setBorderWidthBottom(2.0F); + cell.setBorderWidthTop(2.0F); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("=", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBorderWidthLeft(1.0F); + cell.setBorderWidthRight(1.0F); + cell.setBorderWidthBottom(2.0F); + cell.setBorderWidthTop(2.0F); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + DoubleOperator impostaDaPagare = new DoubleOperator(totImpostaVendite.getResult()); + impostaDaPagare.subtract(totImpostaAcquisti); + cell = new Cell(new Chunk((impostaDaPagare.getResult() == 0.0D) ? "\n" : nf.format(impostaDaPagare.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorderWidthLeft(1.0F); + cell.setBorderWidthRight(1.0F); + cell.setBorderWidthBottom(2.0F); + cell.setBorderWidthTop(2.0F); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("Interessi 1%", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("+", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + DoubleOperator impostaDaVersare = new DoubleOperator(impostaDaPagare.getResult()); + impostaDaVersare.divide(100.0F); + impostaDaVersare.setScale(2, 5); + System.out.println(impostaDaVersare.getResult()); + cell = new Cell(new Chunk((impostaDaVersare.getResult() == 0.0D) ? "\n" : nf.format(impostaDaVersare.getResult()), PdfFontFactory.PDF_fMedio)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("IMPOSTA DA VERSARE", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setLeading((float)cellLeading); + cell.setBorderWidthLeft(1.0F); + cell.setBorderWidthRight(1.0F); + cell.setBorderWidthBottom(1.0F); + cell.setBorderWidthTop(2.0F); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk("=", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBorderWidthLeft(1.0F); + cell.setBorderWidthRight(1.0F); + cell.setBorderWidthBottom(1.0F); + cell.setBorderWidthTop(2.0F); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + impostaDaVersare.add(impostaDaPagare); + cell = new Cell(new Chunk((impostaDaVersare.getResult() == 0.0D) ? "\n" : nf.format(impostaDaVersare.getResult()), PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(2); + cell.setLeading((float)cellLeading); + cell.setBorderWidthLeft(1.0F); + cell.setBorderWidthRight(1.0F); + cell.setBorderWidthBottom(1.0F); + cell.setBorderWidthTop(2.0F); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + cell = new Cell(new Chunk(" ", PdfFontFactory.PDF_fMedioB)); + cell.setVerticalAlignment(4); + cell.setHorizontalAlignment(1); + cell.setLeading((float)cellLeading); + cell.setBorder(0); + cell.setColspan(1); + this.pdfcorpo.addCell(cell); + this.document.add((Element)this.pdfcorpo); + this.document.close(); + setRiepOk(true); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public String getFileName() { + return (this.fileName == null) ? "" : this.fileName; + } + + public static final String getPeriodo(String l_flgPeriodo) { + if (l_flgPeriodo.equals(PERIODO_I_TRIM)) + return "I TRIMESTRE"; + if (l_flgPeriodo.equals(PERIODO_II_TRIM)) + return "II TRIMESTRE"; + if (l_flgPeriodo.equals(PERIODO_III_TRIM)) + return "III TRIMESTRE"; + if (l_flgPeriodo.equals(PERIODO_IV_TRIM)) + return "IV TRIMESTRE"; + return ""; + } + + public String getPeriodo() { + return getPeriodo(getFlgPeriodo()) + " " + getPeriodo(getFlgPeriodo()); + } + + public String getOss() { + return TipoDocumento.getOss(getFlgOss()); + } + + public static String getOss(long l_flgOss) { + return TipoDocumento.getOss(l_flgOss); + } + + public long getFlgOss() { + return this.flgOss; + } + + public void setFlgOss(long flgOss) { + this.flgOss = flgOss; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RegistroIvaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RegistroIvaCR.java new file mode 100644 index 00000000..5fa6431d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RegistroIvaCR.java @@ -0,0 +1,114 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class RegistroIvaCR extends CRAdapter { + private long id_registroIva; + + private long anno; + + private Date dataUltimaStampa; + + private long ultimaPagina; + + private String flgTipoRegistro; + + private long ultimaRiga; + + private long flgTipoLiquidazione; + + private long flgMeseStampato; + + private long flgAnnoStampato; + + private long flgTrimestreStampato; + + public RegistroIvaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RegistroIvaCR() {} + + public void setId_registroIva(long newId_registroIva) { + this.id_registroIva = newId_registroIva; + } + + public void setAnno(long newAnno) { + this.anno = newAnno; + } + + public void setDataUltimaStampa(Date newDataUltimaStampa) { + this.dataUltimaStampa = newDataUltimaStampa; + } + + public void setUltimaPagina(long newUltimaPagina) { + this.ultimaPagina = newUltimaPagina; + } + + public void setFlgTipoRegistro(String newFlgTipoRegistro) { + this.flgTipoRegistro = newFlgTipoRegistro; + } + + public void setUltimaRiga(long newUltimaRiga) { + this.ultimaRiga = newUltimaRiga; + } + + public void setFlgTipoLiquidazione(long newFlgTipoLiquidazione) { + this.flgTipoLiquidazione = newFlgTipoLiquidazione; + } + + public void setFlgMeseStampato(long newFlgMeseStampato) { + this.flgMeseStampato = newFlgMeseStampato; + } + + public void setFlgAnnoStampato(long newFlgAnnoStampato) { + this.flgAnnoStampato = newFlgAnnoStampato; + } + + public void setFlgTrimestreStampato(long newFlgTrimestreStampato) { + this.flgTrimestreStampato = newFlgTrimestreStampato; + } + + public long getId_registroIva() { + return this.id_registroIva; + } + + public long getAnno() { + return this.anno; + } + + public Date getDataUltimaStampa() { + return this.dataUltimaStampa; + } + + public long getUltimaPagina() { + return this.ultimaPagina; + } + + public String getFlgTipoRegistro() { + return (this.flgTipoRegistro == null) ? "" : + this.flgTipoRegistro.trim(); + } + + public long getUltimaRiga() { + return this.ultimaRiga; + } + + public long getFlgTipoLiquidazione() { + return this.flgTipoLiquidazione; + } + + public long getFlgMeseStampato() { + return this.flgMeseStampato; + } + + public long getFlgAnnoStampato() { + return this.flgAnnoStampato; + } + + public long getFlgTrimestreStampato() { + return this.flgTrimestreStampato; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaCausaleContabile.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaCausaleContabile.java new file mode 100644 index 00000000..20619701 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaCausaleContabile.java @@ -0,0 +1,149 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.DBAdapterException; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class RigaCausaleContabile extends DBAdapter implements Serializable { + private static final long serialVersionUID = 3474479017832499327L; + + private long id_rigaCausaleContabile; + + private long id_causaleContabile; + + private long id_pianoConti; + + private long flgDA; + + private CausaleContabile causaleContabile; + + private PianoConti pianoConti; + + public static final long DARE = 0L; + + public static final long AVERE = 1L; + + public RigaCausaleContabile(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RigaCausaleContabile() {} + + public long getId_causaleContabile() { + return this.id_causaleContabile; + } + + public void setId_causaleContabile(long id_incassoPagamento) { + this.id_causaleContabile = id_incassoPagamento; + setCausaleContabile(null); + } + + public Vectumerator findByCR(RigaCausaleContabileCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_CAUSALE_CONTABILE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByCausaleContabile(long id_causaleContabile) { + String s_Sql_Find = "select A.* from RIGA_CAUSALE_CONTABILE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_causaleContabile = " + id_causaleContabile); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void deleteCascade() {} + + protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException { + return new ResParm(true); + } + + public long getId_rigaCausaleContabile() { + return this.id_rigaCausaleContabile; + } + + public void setId_rigaCausaleContabile(long id_rigaCausaleContabile) { + this.id_rigaCausaleContabile = id_rigaCausaleContabile; + } + + public long getId_pianoConti() { + return this.id_pianoConti; + } + + public void setId_pianoConti(long id_pianoConti) { + this.id_pianoConti = id_pianoConti; + setPianoConti(null); + } + + public long getFlgDA() { + return this.flgDA; + } + + public void setFlgDA(long flgDA) { + this.flgDA = flgDA; + } + + public CausaleContabile getCausaleContabile() { + this.causaleContabile = (CausaleContabile)getSecondaryObject(this.causaleContabile, CausaleContabile.class, getId_causaleContabile()); + return this.causaleContabile; + } + + public void setCausaleContabile(CausaleContabile causaleContabile) { + this.causaleContabile = causaleContabile; + } + + public PianoConti getPianoConti() { + this.pianoConti = (PianoConti)getSecondaryObject(this.pianoConti, PianoConti.class, getId_pianoConti()); + return this.pianoConti; + } + + public void setPianoConti(PianoConti pianoConti) { + this.pianoConti = pianoConti; + } + + public String getDescrizioneDA() { + return getDescrizioneDA(getFlgDA()); + } + + public String getDescrizioneDA(long flgDA) { + String ret = ""; + if (flgDA == 0L) { + ret = "Dare"; + } else if (flgDA == 1L) { + ret = "Avere"; + } + return ret; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaCausaleContabileCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaCausaleContabileCR.java new file mode 100644 index 00000000..2b80ff58 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaCausaleContabileCR.java @@ -0,0 +1,55 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.io.Serializable; + +public class RigaCausaleContabileCR extends CRAdapter implements Serializable { + private static final long serialVersionUID = 5861166998559498673L; + + private long id_rigaCausaleContabile; + + private long id_causaleContabile; + + private long id_pianoConti; + + private long flgDA; + + public RigaCausaleContabileCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RigaCausaleContabileCR() {} + + public long getId_causaleContabile() { + return this.id_causaleContabile; + } + + public void setId_causaleContabile(long id_incassoPagamento) { + this.id_causaleContabile = id_incassoPagamento; + } + + public long getId_rigaCausaleContabile() { + return this.id_rigaCausaleContabile; + } + + public void setId_rigaCausaleContabile(long id_rigaCausaleContabile) { + this.id_rigaCausaleContabile = id_rigaCausaleContabile; + } + + public long getId_pianoConti() { + return this.id_pianoConti; + } + + public void setId_pianoConti(long id_pianoConti) { + this.id_pianoConti = id_pianoConti; + } + + public long getFlgDA() { + return this.flgDA; + } + + public void setFlgDA(long flgDA) { + this.flgDA = flgDA; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumento.java new file mode 100644 index 00000000..f9a2b914 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumento.java @@ -0,0 +1,6630 @@ +package it.acxent.contab; + +import it.acxent.anag.Clifor; +import it.acxent.anag.Iva; +import it.acxent.anag.IvaInterface; +import it.acxent.anag.MagFisico; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.art.ArticoloFornitore; +import it.acxent.art.ArticoloProgettista; +import it.acxent.art.ArticoloTaglia; +import it.acxent.art.ArticoloUsato; +import it.acxent.art.ArticoloVariante; +import it.acxent.art.Reparto; +import it.acxent.art.TipologiaArticolo; +import it.acxent.cc.Attivita; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DbInterface; +import it.acxent.db.OrString; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.fattele.FEDettaglioLineeInterface; +import it.acxent.fattele.FEScontoMaggiorazione; +import it.acxent.fattele.FEScontoMaggiorazioneInterface; +import it.acxent.mail.MailMessage; +import it.acxent.newsletter.CodaMessaggi; +import it.acxent.tex.anag.ArticoloArticoloTessuto; +import it.acxent.tex.anag.ArticoloFilato; +import it.acxent.tex.anag.ArticoloFilatoColore; +import it.acxent.tex.anag.ArticoloFilatoColoreRitorto; +import it.acxent.tex.anag.ArticoloTessuto; +import it.acxent.tex.anag.ArticoloTessutoColore; +import it.acxent.tex.anag.FaseLavorazione; +import it.acxent.tex.anag.Pezza; +import it.acxent.tex.anag.Telaio; +import it.acxent.tex.conf.NumeroTeliRiga; +import it.acxent.tex.lav.LavPezza; +import it.acxent.util.AbMessages; +import it.acxent.util.DoubleOperator; +import it.acxent.util.FileWr; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; + +public class RigaDocumento extends _ContabAdapter implements Serializable, FEDettaglioLineeInterface, RigaDocumentoInterface { + private static final long serialVersionUID = 5978813491971046901L; + + public static final long CODICE_RIGA_0_PRINCIPALE = 0L; + + public static final long CODICE_RIGA_1_SECONDARIA = 1L; + + public static final long CODICE_RIGA_100_DISPO_TAGLIO = 100L; + + public static final long TIPO_RICERCA_SOLO_MAGAZZINO = 0L; + + public static final long TIPO_RICERCA_MAGAZZINO_INTERNO = 1L; + + public static final long TIPO_RICERCA_MAGAZZINO_ESTERNO = 2L; + + public static final long TIPO_RICERCA_MAGAZZINO_INTERNO_E_ESTERNO = 3L; + + public static final long STATO_DA_ORDINARE = 0L; + + public static final long STATO_ORDINATO_TUTTO = 10L; + + public static final long STATO_ORDINATO_PARZIALE = 15L; + + public static final long STATO_ARRIVATO_PARZIALE = 20L; + + public static final long STATO_ARRIVATO_TUTTO = 30L; + + public static final long STATO_CHIUSO = 40L; + + private long id_rigaDocumento; + + private long id_documento; + + private long ordineRiga; + + private long id_articoloVariante; + + private long id_iva = getCodiceIvaVendStd(); + + private long id_magFisico; + + private long id_articoloTaglia; + + private String serialeSost; + + private double imponibile; + + private double sconto; + + private double quantita; + + private String descrizioneRiga; + + private String descrizioneCodiceRiga; + + private String notaBarcode; + + private Documento documento; + + private Articolo articolo; + + private ArticoloVariante articoloVariante; + + private Iva iva; + + private MagFisico magFisico; + + private ArticoloTaglia articoloTaglia; + + private double quantitaOld; + + private long flgRigaPrelevata; + + private double quantitaPrelevata; + + private double quantitaAssociata; + + private long flgSingleLineArt; + + private double prezzoPubblicoConIva; + + private Reparto reparto; + + private double importo; + + private long segnoMov; + + private long flgCodiceRiga; + + private long flgPrenotazioneArrivata; + + private String seriale; + + private Documento documentoPadre; + + private long id_documentoPadre; + + private long id_rigaDocumentoPadre; + + private long id_articolo; + + private String notaRigaDocumento; + + private long flgIgnoraPrenotazione; + + private double kg; + + private double mt; + + private double nr; + + private long qtaSlipStampate; + + private long statoPrenotazione; + + private double qtaSaldoMovimento; + + private CausaleMagazzino causaleMagazzino; + + private Clifor clifor; + + private long id_causaleMagazzino; + + private long id_clifor; + + private long flgReso; + + private long flgDaCancellare; + + private long flgStatoLavorazioneRiga; + + private long id_rigaDocumentoMov; + + private long id_rigaDocumentoPrelevata; + + private RigaDocumento rigaDocumentoPrelevata; + + private long id_articoloFilato; + + private long id_articoloFilatoColore; + + private ArticoloFilatoColore articoloFilatoColore; + + private ArticoloFilatoColoreRitorto articoloFilatoColoreRitorto; + + private long id_pezza; + + private Pezza pezza; + + private long id_faseLavorazione; + + private FaseLavorazione faseLavorazione; + + private long id_articoloTessuto; + + private ArticoloTessuto articoloTessuto; + + private long id_articoloPrecedente; + + private double percL1; + + private double percL2; + + private double percL3; + + private String codiceCartellinoIniziale; + + private double metriStacchi; + + private long rifTipoArticolo = 1L; + + private long id_reparto; + + private long stacchi; + + private String codiceCartellinoStart; + + private String codiceCartellinoStop; + + private long numColpiDM; + + private long flgUdm; + + private long colpoFinaleRiga; + + private long colpoInizialeRiga; + + private long id_articoloTessutoColore; + + private ArticoloTessutoColore articoloTessutoColore; + + private long capiPerTelo; + + private long id_telaio; + + private Telaio telaio; + + private Timestamp tsFineLavorazioneRiga; + + private Timestamp tsInizioLavorazioneRiga; + + private long numTeliRiga; + + private long flgMov; + + private NumeroTeliRiga numeroTeliRiga; + + private double nrOriginale; + + private String descrizioneRigaRaggruppamento; + + private String descrizioneRigaDettaglio; + + private String flgDescPadreGenerazioneRiga; + + private long ordine; + + private long id_articoloFilatoColoreRitorto; + + private long id_rigaDocumentoTessutoA; + + private RigaDocumento rigaDocumentoTessutoA; + + public String getDescrizioneCodiceRiga() { + if (getId_articoloTaglia() > 0L) + return getArticoloTaglia().getCodiceAT(); + if (getId_articoloVariante() > 0L) + return getArticoloVariante().getCodiceVariante(); + if (getId_articolo() > 0L) + return getArticolo().getCodice(); + return (this.descrizioneCodiceRiga == null) ? "" : this.descrizioneCodiceRiga.trim(); + } + + public void setDescrizioneCodiceRiga(String descrizioneCodiceRiga) { + this.descrizioneCodiceRiga = descrizioneCodiceRiga; + } + + public String getFlgDescPadreGenerazioneRiga() { + return (this.flgDescPadreGenerazioneRiga == null) ? "" : this.flgDescPadreGenerazioneRiga.trim(); + } + + public void setFlgDescPadreGenerazioneRiga(String flgDescPadreGenerazioneRiga) { + this.flgDescPadreGenerazioneRiga = flgDescPadreGenerazioneRiga; + } + + public long getCapiPerTelo() { + return this.capiPerTelo; + } + + public void setCapiPerTelo(long capiPerTelo) { + this.capiPerTelo = capiPerTelo; + } + + public long getNumColpiDM() { + return this.numColpiDM; + } + + public void setNumColpiDM(long numColpiMetro) { + this.numColpiDM = numColpiMetro; + } + + public RigaDocumento(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public void setId_rigaDocumento(long newId_rigaDocumento) { + this.id_rigaDocumento = newId_rigaDocumento; + } + + public void setId_documento(long newId_documento) { + this.id_documento = newId_documento; + setDocumento(null); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setId_articoloVariante(long newId_articoloVariante) { + this.id_articoloVariante = newId_articoloVariante; + setArticoloVariante(null); + } + + public void setId_iva(long newId_iva) { + this.id_iva = newId_iva; + setIva(null); + } + + public void setId_magFisico(long newId_magFisico) { + this.id_magFisico = newId_magFisico; + setMagFisico(null); + } + + public void setId_articoloTaglia(long newId_taglia) { + this.id_articoloTaglia = newId_taglia; + setArticoloTaglia(null); + } + + public void setSeriale(String newSeriale) { + this.seriale = newSeriale; + } + + public void setImponibile(double newImponibile) { + this.imponibile = newImponibile; + } + + public void setFlgUdm(long newFlgUdm) { + this.flgUdm = newFlgUdm; + } + + public void setQuantita(double newQuantita) { + if (getParm("USA_MAGAZZINO").isFalse()) { + long l_flgUdm; + if (getId_articoloVariante() > 0L || getId_articolo() > 0L) { + l_flgUdm = getArticolo().getTipologiaArticolo().getFlgUdm(); + } else if (getId_articoloFilatoColore() > 0L) { + l_flgUdm = getArticoloFilatoColore().getTipologiaArticolo().getFlgUdm(); + } else if (getId_articoloTessutoColore() > 0L) { + l_flgUdm = getArticoloTessutoColore().getArticoloTessuto().getTipologiaArticolo().getFlgUdm(); + } else if (getId_articoloTessuto() > 0L) { + l_flgUdm = getArticoloTessuto().getTipologiaArticolo().getFlgUdm(); + } else { + l_flgUdm = 1L; + } + if (l_flgUdm == 1L) { + setNr(newQuantita); + } else if (l_flgUdm == 3L) { + setMt(newQuantita); + } else if (l_flgUdm == 2L) { + setKg(newQuantita); + } + } + this.quantita = newQuantita; + } + + public void setDescrizioneRiga(String newDescrizioneRiga) { + this.descrizioneRiga = newDescrizioneRiga; + } + + public void setNotaRigaDocumento(String newNoteRiga) { + this.notaRigaDocumento = newNoteRiga; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public long getId_documento() { + return this.id_documento; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public long getId_iva() { + return this.id_iva; + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public long getId_articoloTaglia() { + return this.id_articoloTaglia; + } + + public String getSeriale() { + return (this.seriale == null) ? "" : this.seriale.trim(); + } + + public double getImponibile() { + if (getFlgReso() == 1L) + return -Math.abs(this.imponibile); + return this.imponibile; + } + + public long getFlgUdm() { + long l_flgUdm = 0L; + if (getId_articoloVariante() > 0L || getId_articolo() > 0L) { + l_flgUdm = getArticolo().getTipologiaArticolo().getFlgUdm(); + } else if (getId_articoloFilatoColore() > 0L) { + l_flgUdm = getArticoloFilatoColore().getTipologiaArticolo().getFlgUdm(); + } else if (getId_articoloTessutoColore() > 0L) { + l_flgUdm = getArticoloTessutoColore().getArticoloTessuto().getTipologiaArticolo().getFlgUdm(); + } else if (getId_articoloTessuto() > 0L) { + l_flgUdm = getArticoloTessuto().getTipologiaArticolo().getFlgUdm(); + } + if (l_flgUdm == 0L) { + if (this.flgUdm == 0L) + return 1L; + return this.flgUdm; + } + return l_flgUdm; + } + + public String getQuantitaMagazzinoHtml() { + if (getId_articoloVariante() == 0L) + return getArticolo().getQuantitaMagazzinoMovimentoHtml(); + return getArticoloVariante().getQuantitaMagazzinoMovimentoHtml(); + } + + public String getQuantitaRigaHtml() { + StringBuilder sb = new StringBuilder(); + sb.append(getUdmQuantita()); + if (getQuantitaAssociata() > 0.0D) { + sb.append(" "); + sb.append(getQuantitaAssociata()); + sb.append(" "); + } + if (getQuantitaPrelevata() > 0.0D) { + sb.append(" "); + sb.append(getQuantitaPrelevata()); + sb.append(" "); + } + return sb.toString(); + } + + public String getDescrizioneRiga() { + return (this.descrizioneRiga == null) ? "" : this.descrizioneRiga.trim(); + } + + public String getDescrizioneRigaCompleta() { + String star, sn; + if (getId_articolo() != 0L || getId_articoloFilatoColore() != 0L) { + star = ""; + } else { + star = ""; + } + if (getId_articoloFilatoColore() != 0L) { + sn = " lotto: "; + } else { + sn = " s/n: "; + } + if (getSeriale().isEmpty()) + return getDescrizioneRiga() + getDescrizioneRiga(); + return getDescrizioneRiga() + getDescrizioneRiga() + star + sn; + } + + public String getNotaRigaDocumento() { + return (this.notaRigaDocumento == null) ? "" : this.notaRigaDocumento.trim(); + } + + public void setDocumento(Documento newDocumento) { + this.documento = newDocumento; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento()); + return this.documento; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public void setArticoloVariante(ArticoloVariante newArticoloVariante) { + this.articoloVariante = newArticoloVariante; + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante()); + return this.articoloVariante; + } + + public void setIva(Iva newIva) { + this.iva = newIva; + } + + public Iva getIva() { + this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, getId_iva()); + return this.iva; + } + + public void setMagFisico(MagFisico newMagFisico) { + this.magFisico = newMagFisico; + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico()); + return this.magFisico; + } + + public void setArticoloTaglia(ArticoloTaglia newArticoloTaglia) { + this.articoloTaglia = newArticoloTaglia; + } + + public ArticoloTaglia getArticoloTaglia() { + this.articoloTaglia = (ArticoloTaglia)getSecondaryObject(this.articoloTaglia, ArticoloTaglia.class, getId_articoloTaglia()); + return this.articoloTaglia; + } + + protected void deleteCascade() { + if (getFlgCodiceRiga() == 0L) { + delete("delete from NUMERO_TELI_RIGA where id_rigaDocumentoArticolo=" + getId_rigaDocumento()); + update("update LAV_PEZZA set id_rigaDocumentoBolla=null where id_rigaDocumentoBolla=" + getId_rigaDocumento()); + } else if (getFlgCodiceRiga() == 1L) { + delete("delete from NUMERO_TELI_RIGA where id_rigaDocumentoTessuto=" + getId_rigaDocumento()); + } + new RigaDocumentoProgettista(getApFull()).deleteByRigaDocumento(getId_rigaDocumento()); + ResParm rp = update("update RIGA_DOCUMENTO set id_rigaDocumentoPadre=null where id_rigaDocumentoPadre=" + getId_rigaDocumento()); + rp = update("update RIGA_DOCUMENTO set id_rigaDocumentoMov=null where id_rigaDocumentoMov=" + getId_rigaDocumento()); + rp = update("update RIGA_DOCUMENTO set id_rigaDocumentoPrelevata=null where id_rigaDocumentoPrelevata=" + getId_rigaDocumento()); + rp = update("update LAV_PEZZA set id_rigaDocumentoBolla=null where id_rigaDocumentoBolla=" + getId_rigaDocumento()); + } + + public Vectumerator findByCROld(RigaDocumentoCR CR, int pageNumber, int pageRows) { + if (CR.getFlgTipoRicerca() == 1L) + return findCompattaByCR(CR, pageNumber, pageRows); + boolean flgOttimizzo = true; + if (pageNumber == 0 && pageRows == 0) + flgOttimizzo = false; + StringBuffer s_Sql_Find = new StringBuffer("select A.* from RIGA_DOCUMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento=B.id_documento "); + s_Sql_Find.append(" INNER JOIN TIPO_DOCUMENTO AS C ON B.id_tipoDocumento=C.id_tipoDocumento "); + String s_Sql_Order = " order by B.dataDocumento desc, B.id_documentoFiglio desc "; + if (CR.getFlgOrderBy() == 5L) + s_Sql_Order = " order by B.dataDocumento asc "; + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt; + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + } else { + if (pageNumber == 0) + pageNumber = 1; + int start = (pageNumber - 1) * pageRows; + int stop = start + pageRows; + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + " limit " + s_Sql_Order + "," + start); + } + findByCRCreateStmtDate(CR, stmt); + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + Vectumerator vectumerator = findRows(stmt, pageNumber, pageRows); + if (!CR.getFlgReport().isEmpty()) + creaFileCvs(vectumerator, CR); + return vectumerator; + } + Vectumerator vec = findRows(stmt, 1, pageRows); + vec.setPageNumber(pageNumber); + vec.setTotNumberOfRecords(findByCRTotRecord(CR)); + if (!CR.getFlgReport().isEmpty()) + creaFileCvs(vec, CR); + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByDocumentoPerSlip(long l_id_documento) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A left join ARTICOLO AS B on A.id_articolo=B.id_articolo "; + String s_Sql_order = " order by A.id_rigaDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + wc.addWc("A.quantita>coalesce(qtaSlipStampate,0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getTotImportoRM() { + if (getIva().getFlgTipo().equals("R")) { + if (getSconto() > 0.0D) { + DoubleOperator temp = new DoubleOperator(100.0F); + temp.setScale(4, 5); + temp.subtract(getSconto()); + temp.multiply(getTotImponibileRiga()); + temp.divide(100.0F); + temp.setScale(2, 5); + return temp.getResult(); + } + return getTotImponibileRiga(); + } + return 0.0D; + } + + public double getTotImportoRMRighe(long l_id_documento) { + Vectumerator vec = findByDocumento(l_id_documento, 0L, "", 0, 0, 1); + DoubleOperator temp = new DoubleOperator(); + while (vec.hasMoreElements()) + RigaDocumento row = (RigaDocumento)vec.nextElement(); + return temp.getResult(); + } + + public double getTotIvaRiga4() { + DoubleOperator l_iva = new DoubleOperator(getTotImponibileRigaConSconto()); + if (!getIva().getFlgTipo().equals("R")) { + l_iva.setScale(4, 5); + l_iva.multiply(getIva().getAliquota()); + l_iva.divide(100.0F); + } else { + l_iva = new DoubleOperator(0.0F); + } + return l_iva.getResult(); + } + + public double getTotCostoUsato() { + DoubleOperator temp = new DoubleOperator(getArticolo().getCostoAcquisto()); + temp.multiply(getQuantita()); + temp.setScale(3, 5); + return temp.getResult(); + } + + public double getTotImponibileRigaConScontoOLD() { + if (!getIva().getFlgTipo().equals("R")) { + if (getSconto() == 0.0D && getPercL1() == 0.0D && getPercL2() == 0.0D && getPercL3() == 0.0D) + return getTotImponibileRiga(); + if (getSconto() > 0.0D) { + DoubleOperator doubleOperator = new DoubleOperator(100.0F); + doubleOperator.setScale(4, 5); + doubleOperator.subtract(getSconto()); + doubleOperator.multiply(getTotImponibileRiga()); + doubleOperator.divide(100.0F); + doubleOperator.setScale(2, 5); + return doubleOperator.getResult(); + } + DoubleOperator temp = new DoubleOperator(100.0F); + temp.setScale(4, 5); + double imponibile = getTotImponibileRiga(); + if (getPercL1() > 0.0D) { + temp.subtract(getPercL1()); + temp.multiply(imponibile); + temp.divide(100.0F); + imponibile = temp.getResult(); + } + if (getPercL2() > 0.0D) { + temp = new DoubleOperator(100.0F); + temp.subtract(getPercL2()); + temp.multiply(imponibile); + temp.divide(100.0F); + imponibile = temp.getResult(); + } + if (getPercL3() > 0.0D) { + temp = new DoubleOperator(100.0F); + temp.subtract(getPercL3()); + temp.multiply(imponibile); + temp.divide(100.0F); + } + temp.setScale(2, 5); + return temp.getResult(); + } + return getTotImponibileRiga(); + } + + public double getSconto() { + return this.sconto; + } + + public void setSconto(double sconto) { + this.sconto = sconto; + } + + public static String getUdm(long l_flgUdm) { + return TipologiaArticolo.getUdm(l_flgUdm); + } + + public String getUdm() { + return getUdm(getFlgUdm()); + } + + public String getUdmQuantita() { + return getUdm() + " " + getUdm(); + } + + public ResParm deleteMov() { + if (getId_rigaDocumentoMov() > 0L) + return super.delete(); + return new ResParm(false, "ERRORE! Tentativo di cancellare riga documento tramite deleteMov!!!"); + } + + private static final synchronized ResParm deleteMagArticolo(RigaDocumento rd) { + ResParm rp = new ResParm(true); + rp = deleteUsato(rd); + if (rp.getStatus()) { + if (rd.getArticolo().usaMagazzino() && rd.getDocumento().getTipoDocumento().getFlgMovMagazzino() != 0L && + rd.getDocumento().getFlgStato() == 1L && + rd.getDocumento().getFlgStatoOrdineWww() != 99L) { + DoubleOperator dop = new DoubleOperator((float)rd.getDocumento().getTipoDocumento().getFlgMovMagazzino()); + dop.multiply(-1); + dop.multiply(rd.getNr()); + dop.add(rd.getArticolo().getQuantita()); + rd.getArticolo().setQuantita(dop.getResult()); + rd.getArticolo().handleQuantitaDebugBeforeSave("rigaDocumento.deleteMagArticolo"); + rp = rd.getArticolo().superSave(); + } + if (rp.getStatus()) + rp.append(rd.superDelete()); + } + return rp; + } + + private static final synchronized ResParm deleteUsato(RigaDocumento rd) { + ResParm rp = new ResParm(true); + if (rd.getArticolo().getFlgUsato() > 0L) { + Documento doc = rd.getDocumento(); + long l_id_documento = rd.getId_documento(); + if (doc.getTipoDocumento().getFlgUsato() == 1L) { + if (rd.getArticolo().isArticoloUsatoVenduto()) { + ArticoloUsato au = new ArticoloUsato(rd.getApFull()); + Vectumerator vec = au.findByRigaDocumento(rd.getId_rigaDocumento()); + while (vec.hasMoreElements()) { + au = (ArticoloUsato)vec.nextElement(); + if (au.getId_rigaDocumento() == rd.getId_rigaDocumento()) { + Articolo articolo = au.getArticolo(); + rp = au.delete(); + if (rp.getStatus()) { + articolo.setFlgEscludiWebArt(0L); + articolo.save(); + } + continue; + } + rp.setStatus(false); + rp.setMsg("ERRORE! Impossibile eliminare, esistono movimenti successivi dell'articolo " + rd.getId_articolo() + "!"); + } + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Impossibile eliminare, esistono movimenti successivi dell'articolo " + rd.getId_articolo() + "!"); + } + } else if (!rd.getArticolo().isArticoloUsatoVenduto()) { + ArticoloUsato au = new ArticoloUsato(rd.getApFull()); + Vectumerator vec = au.findByRigaDocumento(rd.getId_rigaDocumento()); + while (vec.hasMoreElements()) { + au = (ArticoloUsato)vec.nextElement(); + if (au.getId_rigaDocumento() == rd.getId_rigaDocumento()) { + Articolo articolo = au.getArticolo(); + rp = au.delete(); + if (rp.getStatus()) { + articolo.setFlgEscludiWebArt(1L); + articolo.save(); + } + continue; + } + rp.setStatus(false); + rp.setMsg("ERRORE! Impossibile eliminare, esistono movimenti successivi dell'articolo " + rd.getId_articolo() + "!"); + } + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Impossibile eliminare, esistono movimenti successivi dell'articolo " + rd.getId_articolo() + "!"); + } + } + return rp; + } + + public ResParm delete() { + if (getId_rigaDocumento() == 0L) + return new ResParm(false, "ATTENZIONE! Tentativo di cancellare una riga documento nulla!!!"); + ResParm rp = getDocumento().checkEMSTA(); + if (!rp.getStatus()) + return new ResParm(false, "ATTENZIONE! Tentativo di cancellare una riga documento: " + rp.getMsg()); + if (getParm("USA_MAGAZZINO").isTrue()) + return deleteMagArticolo(this); + synchronized (this) { + rp = deleteUsato(this); + if (rp.getStatus()) { + if (getId_articolo() > 0L && (getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo() > 0L || + getDocumento().getTipoDocumento().getCausaleMagazzino().getFlgPartenzaInterno() == 1L || + getDocumento().getTipoDocumento().getCausaleMagazzino().getFlgPartenzaLavorazione() == 1L)) { + RigaDocumento rd = new RigaDocumento(getApFull()); + if (rd.getDocumento().getTipoDocumento().getCausaleMagazzino().isMagArrivo()) { + rd.findMagDisponibilitaPuntualeMagazziniInterni(getId_articolo(), getId_articoloVariante(), + getId_articoloTaglia(), getSeriale(), 0L); + if (rd.getQuantita() < getQuantita()) + return new ResParm(false, "ERRORE RD! Quantità non più disponibile in magazzino. E' stato effettuato uno scarico!"); + } + rd = new RigaDocumento(getApFull()); + rd.findRigaImpegnoBySeriale(getId_articolo(), getId_articoloVariante(), getSeriale()); + if (rd.getDBState() == 1) + return new ResParm(false, "ERRORE! Esiste una prenotazione per questo seriale!"); + } + RigaDocumento bean = (RigaDocumento)clone(); + if (getDocumento().getTipoDocumento().getFlgTipologia() == 3L) { + RigaDocumentoPM rdPM = new RigaDocumentoPM(getApFull()); + rdPM.findByRigaDocumento(getId_rigaDocumento()); + if (rdPM.getDBState() == 1) + rdPM.delete(); + } + if (getDocumento().getTipoDocumento().getFlgTipologia() == 4L) { + RigaDocumentoPM rdPM = new RigaDocumentoPM(getApFull()); + Vectumerator vec = rdPM.findByRigaDocumentoPrelevata(getId_rigaDocumento()); + while (vec.hasMoreElements()) { + DbInterface row = (DbInterface)vec.nextElement(); + row.delete(); + } + } + if (getDocumento().getTipoDocumento().getFlgTipologia() == 0L && getDocumento() + .getTipoDocumento().getFlgClienteFornitore().equals("C")) { + LavPezza rowLP = new LavPezza(getApFull()); + Vectumerator vecLP = rowLP.findByRigaDocumentoBolla(getId_rigaDocumento()); + while (vecLP.hasMoreElements()) { + LavPezza row = (LavPezza)vecLP.nextElement(); + row.setId_rigaDocumentoBolla(0L); + row.save(); + } + } + if (getDocumento().isDocumentoFiglioCreabile()) { + Vectumerator vecRDFigli = new RigaDocumento(getApFull()).findByDocumentoPadre(getId_documento(), 0, 0); + while (vecRDFigli.hasMoreElements()) { + RigaDocumento rowFiglio = (RigaDocumento)vecRDFigli.nextElement(); + rowFiglio.setId_documentoPadre(0L); + rowFiglio.setId_rigaDocumentoPadre(0L); + rowFiglio.superSave(); + } + } + String sql_delete_mov = "DELETE FROM RIGA_DOCUMENTO WHERE id_rigaDocumentoMov=" + getId_rigaDocumento(); + rp = delete(sql_delete_mov); + if (rp.getStatus()) { + long l_id_articolo = getId_articolo(); + long l_id_articoloVariante = getId_articoloVariante(); + long l_id_articoloTaglia = getId_articoloTaglia(); + long l_id_articoloFilatoColore = getId_articoloFilatoColore(); + long l_id_articoloTessuto = getId_articoloTessuto(); + long l_id_articoloTessutoColore = getId_articoloTessutoColore(); + rp = super.delete(); + setId_articolo(getId_articolo()); + setId_articoloVariante(l_id_articoloVariante); + setId_articoloTaglia(l_id_articoloTaglia); + setId_articoloFilatoColore(l_id_articoloFilatoColore); + setId_articoloTessuto(l_id_articoloTessuto); + setId_articoloTessutoColore(l_id_articoloTessutoColore); + rp = aggiornaDispo(); + } + if (rp.getStatus()) { + if (bean.getId_rigaDocumentoPadre() != 0L) { + RigaDocumento beanPadre = new RigaDocumento(getApFull()); + beanPadre.findByPrimaryKey(bean.getId_rigaDocumentoPadre()); + beanPadre.setFlgRigaPrelevata(0L); + rp = beanPadre.superSave(); + Documento doc = new Documento(getApFull()); + doc.findByPrimaryKey(beanPadre.getId_documento()); + doc.setDataChiusura(null); + doc.setFlgDocumentoPrelevato(0L); + doc.superSave(); + } + if (bean.getDocumento().getTipoDocumento().getId_causaleMagazzino() > 0L || + bean.getDocumento().getTipoDocumento().getFlgTipologia() == 4L) + bean.checkStatoPrenotazione(); + } + } + return rp; + } + } + + public void calcolaStatoLavorazioneRiga() { + if (getId_telaio() == 0L) { + setFlgStatoLavorazioneRiga(0L); + setTsInizioLavorazioneRiga(null); + setTsFineLavorazioneRiga(null); + setColpoFinaleRiga(0L); + setColpoInizialeRiga(0L); + } else { + if (getColpoInizialeRiga() > 0L) { + if (getTsInizioLavorazioneRiga() == null) + setTsInizioLavorazioneRiga(getTimestamp()); + } else { + setTsInizioLavorazioneRiga(null); + setTsFineLavorazioneRiga(null); + setColpoFinaleRiga(0L); + } + if (getColpoInizialeRiga() > 0L && getColpoFinaleRiga() > 0L) { + setFlgStatoLavorazioneRiga(100L); + if (getTsFineLavorazioneRiga() == null) + setTsFineLavorazioneRiga(getTimestamp()); + } else if (getColpoInizialeRiga() > 0L) { + setFlgStatoLavorazioneRiga(20L); + } else { + setFlgStatoLavorazioneRiga(10L); + } + } + } + + public ResParm save() { + ResParm rp = getDocumento().checkEMSTA(); + if (!rp.getStatus()) { + rp.setInfoMsg(rp.getMsg()); + return rp; + } + long l_id_articoloPrecedente = getId_articoloPrecedente(); + calcolaStatoLavorazioneRiga(); + rp = synchroSave(this); + if (rp.getStatus()) { + rp = aggiornaDispo(); + if (getDocumento().isFatturaONotaDiCredito()) { + if (getId_rigaDocumento() > 0L) + new RigaDocumentoProgettista(getApFull()).deleteByRigaDocumento(getId_rigaDocumento()); + Vectumerator vecPro = getArticolo().getProgettistiArticolo(); + while (vecPro.hasMoreElements()) { + ArticoloProgettista rowAP = (ArticoloProgettista)vecPro.nextElement(); + RigaDocumentoProgettista da = new RigaDocumentoProgettista(getApFull()); + da.setId_rigaDocumento(getId_rigaDocumento()); + da.setId_cliforRDA(rowAP.getId_progettista()); + da.setPercRDA(rowAP.getPercProvvigione()); + da.save(); + } + } + if (getDocumento().getTipoDocumento().getFlgUsato() == 1L && + getArticolo().getFlgUsato() > 0L) { + ArticoloUsato au = new ArticoloUsato(getApFull()); + Vectumerator vecAu = au.findByRigaDocumento(getId_rigaDocumento()); + while (vecAu.hasMoreElements()) + ((DbInterface)vecAu.nextElement()).delete(); + au.setId_articolo(getId_articolo()); + au.setDataDocumento(getDocumento().getDataDocumento()); + au.setNumeroDocumento(getDocumento().getNumeroDocumento()); + if (!getDocumento().getTipoDocumento().isNotaCreditoVendita()) { + au.setFlgTipoDocumento(2L); + } else { + au.setFlgTipoDocumento(3L); + } + au.setId_rigaDocumento(getId_rigaDocumento()); + au.setId_cliente(getDocumento().getId_clifor()); + au.setImporto(getImponibile()); + rp = au.save(); + if (rp.getStatus()) + if (getDocumento().getTipoDocumento().isNotaCreditoVendita()) { + au.getArticolo().setFlgEscludiWebArt(0L); + } else { + au.getArticolo().setFlgEscludiWebArt(1L); + } + au.getArticolo().save(); + } + } + return rp; + } + + private ResParm aggiornaDispo() { + if (getId_articolo() > 0L && getArticolo().usaMagazzino()) + return aggiornaDispo(getApFull(), getId_articolo(), getId_articoloVariante(), getId_articoloTaglia(), getLastUpdId_user()); + if (getId_articoloTessuto() > 0L && getArticoloTessuto().usaMagazzino()) + return aggiornaDispoTessuto(getApFull(), getId_articoloTessuto(), getId_articoloTessutoColore(), getLastUpdId_user()); + if (getId_articoloFilatoColore() > 0L && getArticoloFilatoColore().usaMagazzino()) + return aggiornaDispoFilato(getApFull(), getId_articoloFilatoColore(), getLastUpdId_user()); + return new ResParm(true); + } + + public ResParm saveFilato() { + ResParm rp = synchroSaveFilato(this); + if (rp.getStatus()) + if (getArticoloFilatoColore().usaMagazzino()) + rp = aggiornaDispoFilato(getApFull(), getId_articoloFilatoColore(), getLastUpdId_user()); + return rp; + } + + public ResParm saveTessuto() { + ResParm rp = synchroSaveTessuto(this); + if (rp.getStatus()) + if (getArticoloTessuto().usaMagazzino()) + rp = aggiornaDispoTessuto(getApFull(), getId_articoloTessuto(), getId_articoloTessutoColore(), getLastUpdId_user()); + return rp; + } + + public double getQuantitaOld() { + return this.quantitaOld; + } + + public void setQuantitaOld(double quantitaOld) { + this.quantitaOld = quantitaOld; + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + if (getParm("USA_MAGAZZINO").isTrue()) + setQuantitaOld(getQuantita()); + setId_articoloPrecedente(getId_articolo()); + try { + resetRstColumns(); + if (isColumnInResultSet(rst, "id_articoloFilato")) { + setId_articoloFilato(rst.getLong("id_articoloFilato")); + } else if (isColumnInResultSet(rst, "id_articoloTessutoColore")) { + setId_articoloTessutoColore(rst.getLong("id_articoloTessutoColore")); + } + } catch (SQLException e) { + e.printStackTrace(); + } + try { + if (getDocumento().getTipoDocumento().getFlgImportoIva() == 1L) + setPrezzoPubblicoConIva(getImporto()); + } catch (Exception e) { + String temp = "######### RIGADOCUMENTO FILLFIELD EXCEPTION ######\n"; + temp = temp + "id_rigadocumento: " + temp + " id_documento: " + getId_rigaDocumento() + "\n"; + temp = temp + "AP: " + temp + "\n"; + System.out.println(temp); + e.printStackTrace(); + System.out.println("***************************************************************"); + handleDebug(temp + "*********************************", 0); + } + } + + protected void initFields() { + super.initFields(); + setQuantitaOld(0.0D); + setId_iva(getCodiceIvaVendStd()); + setStatoPrenotazione(-1L); + setId_articoloFilato(0L); + setId_articoloPrecedente(0L); + setRifTipoArticolo(1L); + setNumeroTeliRiga(null); + } + + public String getDescrizioneTipoMovimento() { + if (getFlgReso() == 1L) + return "RESO"; + return getDocumento().getTipoDocumento().getCausaleMagazzino().getDescrizione(); + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + if (getDocumento().getTipoDocumento().getFlgTipologia() == 201L); + if (getDocumento().getTipoDocumento().getFlgTipologia() == 200L) + if (getDocumento().getFlgBarcodeType() != 100L) + if (!getCodiceCartellinoIniziale().isEmpty()) + try { + if (getDocumento().getFlgBarcodeType() == 0L) { + String start = getCodiceCartellinoIniziale().substring(0, getCodiceCartellinoIniziale().length()); + String pre = start.substring(0, start.length() - (int)getDocumento().getFlgBarcodeSequenzaNumeri()); + long numeroIniziale = Long.valueOf( + start.substring(start.length() - (int)getDocumento().getFlgBarcodeSequenzaNumeri(), start.length())); + long numeroFinale = numeroIniziale + getStacchi() - 1L; + setCodiceCartellinoStart(pre + pre); + setCodiceCartellinoStop(pre + pre); + } else if (getDocumento().getFlgBarcodeType() == 1L) { + String start = getCodiceCartellinoIniziale().substring(0, getCodiceCartellinoIniziale().length() - 1); + String pre = start.substring(0, start.length() - (int)getDocumento().getFlgBarcodeSequenzaNumeri()); + long numeroIniziale = Long.valueOf( + start.substring(start.length() - (int)getDocumento().getFlgBarcodeSequenzaNumeri(), start.length())); + long numeroFinale = numeroIniziale + getStacchi() - 1L; + setCodiceCartellinoStart(pre + pre); + setCodiceCartellinoStop(pre + pre); + } + } catch (Exception e) {} + if (getStacchi() > 0L && getMetriStacchi() > 0.0D) { + DoubleOperator dop = new DoubleOperator((float)getStacchi()); + dop.multiply(getMetriStacchi()); + dop.setScale(2, 5); + setMt(dop.getResult()); + } + if (getDocumento().getTipoDocumento().getFlgImportoIva() == 1L) { + setImporto(getPrezzoPubblicoConIva()); + setImponibile(Documento.scorporaIva(getPrezzoPubblicoConIva(), getIva())); + } else { + setImporto(getImportoCalc()); + } + super.prepareSave(ps); + } + + public MagFisico getMagFisicoPartenza() { + return getDocumento().getTipoDocumento().getCausaleMagazzino().getMagFisicoPartenza(); + } + + public MagFisico getMagFisicoArrivo() { + return getDocumento().getTipoDocumento().getCausaleMagazzino().getMagFisicoArrivo(); + } + + public long getFlgSingleLineArt() { + return this.flgSingleLineArt; + } + + public void setFlgSingleLineArt(long flgSingleLineArt) { + this.flgSingleLineArt = flgSingleLineArt; + } + + public void findFirstByDocumentoArticoloVariante(long l_id_documento, long l_id_articoloVariante) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A "; + String s_Sql_order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + wc.addWc("A.id_articoloVariante=" + l_id_articoloVariante); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 0); + } + } + + public void addQuantita(double l_quantita) { + DoubleOperator dop = new DoubleOperator(getQuantita()); + dop.add(l_quantita); + setQuantita(dop.getResult()); + setQuantitaUdm(dop.getResult()); + } + + public String getCashStringSiemens() { + if (getImportoConSconto() != 0.0D) { + StringBuffer temp = new StringBuffer(); + String sep = "|"; + if (getQuantita() > 1.0D) { + temp.append("KX" + (int)getQuantita() + "* "); + temp.append(sep); + } + String importo = getNf2().format(getImportoConSconto()); + importo = importo.replace(".", ""); + importo = importo.replace(",", ""); + String reparto = getReparto().getSigla() + getReparto().getSigla(); + if (reparto.isEmpty()) + reparto = "R9VARIE.."; + if (getImportoConSconto() < 0.0D) { + temp.append("KX- "); + temp.append(sep); + String rigaSconto = getDescrizioneRiga(); + if (rigaSconto.length() > 11) + rigaSconto = rigaSconto.substring(0, 11); + temp.append("KX" + importo.substring(1) + "GE" + rigaSconto); + } else { + temp.append("KX" + importo + reparto); + } + if (!getNotaRigaDocumento().isEmpty()) { + temp.append(sep); + temp.append("KXSE" + subString(getNotaRigaDocumento(), 24)); + } + if (isDescScontrinoFull()) { + temp.append(sep); + if (getId_articoloVariante() != 0L) { + temp.append("KXSE" + subString(getArticoloVariante().getDescrizioneCompleta(), 24)); + } else { + temp.append("KXSE" + subString(getArticolo().getDescrizioneCompleta(), 24)); + } + if (!getSeriale().isEmpty()) { + temp.append(sep); + temp.append("KXSES/N" + getSeriale()); + } + } + if (getIva().getAliquota() == 0L) { + temp.append(sep); + temp.append("KXSE" + getIva().getDescrizione()); + } + return temp.toString(); + } + return ""; + } + + public double getTotImportoRigaConSconto() { + DoubleOperator temp = new DoubleOperator(getImportoConSconto()); + temp.multiply(getQuantita()); + temp.setScale(3, 5); + return temp.getResult(); + } + + public double getImportoConSconto() { + if (getSconto() == 0.0D && getPercL1() == 0.0D && getPercL2() == 0.0D && getPercL3() == 0.0D) + return getImporto(); + DoubleOperator temp = new DoubleOperator(getImporto()); + temp.setScale(4, 5); + temp.subtract(getImportoSconto()); + temp.setScale(2, 5); + return temp.getResult(); + } + + public double getImponibileRigaConSconto() { + if (!getIva().getFlgTipo().equals("R")) { + if (getSconto() > 0.0D) { + DoubleOperator temp = new DoubleOperator(100.0F); + temp.setScale(4, 5); + temp.subtract(getSconto()); + temp.multiply(getImponibile()); + temp.divide(100.0F); + temp.setScale(2, 5); + return temp.getResult(); + } + return getImponibile(); + } + return 0.0D; + } + + protected ResParm aggiornaCostoUltimoFornitore() { + ResParm rp = new ResParm(true); + if (getId_articolo() == 0L && getId_articoloTessuto() == 0L) + return rp; + long l_id_clifor = 0L; + if (getDocumento().getTipoDocumento().getFlgClienteFornitore().equals("F")) + l_id_clifor = getDocumento().getId_clifor(); + if (l_id_clifor != 0L && getImponibile() > 0.0D && (getId_articolo() > 0L || getId_articoloTessuto() > 0L)) { + ArticoloFornitore af = new ArticoloFornitore(getApFull()); + if (getId_articolo() > 0L) { + af.findByFornitoreArticolo(l_id_clifor, getId_articolo(), -1L); + } else if (getId_articoloTessuto() > 0L) { + af.findByArticoloTessutoFornitore(l_id_clifor, getId_articoloTessuto()); + } + af.setId_articolo(getId_articolo()); + af.setId_articoloVariante(getId_articoloVariante()); + af.setId_articoloTessuto(getId_articoloTessuto()); + af.setId_articoloTessutoColore(getId_articoloTessutoColore()); + af.setId_clifor(getDocumento().getId_clifor()); + af.setCostoVecchio(af.getCostoTotale()); + af.setCosto(getImponibile()); + af.setDataUltimoPrezzo(getDocumento().getDataDocumento()); + rp = af.save(); + if (getId_articolo() > 0L) { + getArticolo().aggiornaUltimoCosto(getImponibile(), getDocumento().getDataDocumento()); + } else if (getId_articoloTessuto() > 0L) { + + } + } + return rp; + } + + public String getDescrizione() { + if (getId_articoloTaglia() != 0L) + return getArticoloTaglia().getDescrizioneCompleta(); + if (getId_articoloVariante() == 0L) + return getArticolo().getNome(); + return getArticoloVariante().getNomeV(); + } + + public void findFirstByDocumentoArticolo(long l_id_documento, long l_id_articolo) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A "; + String s_Sql_order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + wc.addWc("A.id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 0); + } + } + + public Vectumerator findRighePrelevabiliByDocumento(Documento l_documento, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A , DOCUMENTO AS B"; + String s_Sql_order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("B.flgStato =1"); + wc.addWc("A.flgRigaPrelevata !=1"); + if (l_documento.getId_clifor() == 0L) + return AB_EMPTY_VECTUMERATOR; + if (!l_documento.getTipoDocumento().getFlgClienteFornitore().equals("A")) + wc.addWc("B.id_clifor=" + l_documento.getId_clifor()); + Vectumerator vectumerator = l_documento.getTipoDocumento().findDocPrel(0L, 0, 0); + if (!vectumerator.hasMoreElements()) + return AB_EMPTY_VECTUMERATOR; + OrString or = new OrString(); + while (vectumerator.hasMoreElements()) { + DocPrel row = (DocPrel)vectumerator.nextElement(); + or.addOr("B.id_tipoDocumento=" + row.getId_tipoDocumentoPrel()); + } + wc.addWc(or.toString()); + Vectumerator vec = findByDocumento(l_documento.getId_documento(), -1L, "", 0, 0, 0); + if (!vec.hasMoreElements()) + return AB_EMPTY_VECTUMERATOR; + or = new OrString(); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getId_articoloVariante() == 0L) { + or.addOr("A.id_articolo=" + row.getId_articolo()); + continue; + } + or.addOr("A.id_articoloVariante=" + row.getId_articoloVariante()); + } + wc.addWc(or.toString()); + wc.addWc(" B.dataDocumento <= ? "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + stmt.setDate(1, l_documento.getDataDocumento()); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getCashStringNonFiscale() { + StringBuffer temp = new StringBuffer(); + String sep = "|"; + temp.append("KXCB"); + if (getQuantita() > 1.0D) + temp.append("" + (int)getQuantita() + "* "); + if (getId_articoloVariante() != 0L) { + temp.append(subString(getArticoloVariante().getDescrizioneCompleta(), 24)); + } else if (getId_articolo() != 0L) { + temp.append(subString(getArticolo().getDescrizioneCompleta(), 24)); + } else { + temp.append(subString(getDescrizioneRiga(), 24)); + } + if (!getNotaRigaDocumento().isEmpty()) { + temp.append(sep); + temp.append("KXSE" + subString(getNotaRigaDocumento(), 24)); + } + temp.append(sep); + return temp.toString(); + } + + public long getTotalePezzeStacchiByDocumento(long l_id_documento) { + String s_Sql_Find = "select sum(A.stacchi) as _sum from RIGA_DOCUMENTO AS A"; + WcString wc = new WcString(); + if (l_id_documento == 0L) + return 0L; + wc.addWc("A.id_documento=" + l_id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return (long)getSum(stmt); + } catch (Exception e) { + handleDebug(e, 0); + return 0L; + } + } + + public double getQtaPrenotazioneAssegnata(long l_id_articolo, long l_id_articoloVariante) { + String s_Sql_Find = "select sum(A.quantita) as _sum from RIGA_DOCUMENTO AS A, DOCUMENTO AS B"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("A.flgPrenotazioneArrivata =1"); + if (l_id_articolo != 0L) + wc.addWc("A.id_articolo =" + l_id_articolo); + if (l_id_articoloVariante != 0L) + wc.addWc("A.id_articoloVariante =" + l_id_articoloVariante); + wc.addWc("B.flgStatoPrenotazione<=20"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return getSum(stmt); + } catch (Exception e) { + handleDebug(e, 0); + return 0.0D; + } + } + + public void setQuantitaPrelevata(double quantitaPrelevata) { + this.quantitaPrelevata = quantitaPrelevata; + } + + public double getQuantitaRimanente() { + DoubleOperator dop = new DoubleOperator(getQuantita()); + dop.subtract(getQuantitaPrelevata()); + return dop.getResult(); + } + + private static synchronized ResParm addRigaDocumentoP(RigaDocumento rd, RigaDocumentoP row) { + RigaDocumentoP bean = new RigaDocumentoP(rd.getApFull()); + RigaDocumentoPKey theKey = new RigaDocumentoPKey(row.getId_rigaDocumento(), row.getId_rigaDocumentoPrelevata()); + bean.findByKey(theKey); + row.setDBState(bean.getDBState()); + ResParm rp = row.save(); + return rp; + } + + public ResParm addRigaDocumentoP(RigaDocumentoP row) { + return addRigaDocumentoP(this, row); + } + + public ResParm delRigaDocumentoP(RigaDocumentoP row) { + return delRigaDocumentoP(this, row); + } + + public ResParm addRigaDocumentoPM(RigaDocumentoPM row) { + return addRigaDocumentoPM(this, row); + } + + public ResParm delRigaDocumentoPM(RigaDocumentoPM row) { + return delRigaDocumentoPM(this, row); + } + + public void aggiornaQuantitaPrelevata() { + RigaDocumentoP rdp = new RigaDocumentoP(getApFull()); + setQuantitaPrelevata(rdp.getQuantitaPrelevatoByRigaDocumentoPrelevata(getId_rigaDocumento())); + if (getQuantitaPrelevata() >= getQuantita() && getQuantitaPrelevata() > 0.0D && getQuantita() > 0.0D) + setFlgRigaPrelevata(1L); + superSave(); + } + + private static synchronized ResParm delRigaDocumentoP(RigaDocumento rd, RigaDocumentoP row) { + RigaDocumentoP bean = new RigaDocumentoP(rd.getApFull()); + RigaDocumentoPKey theKey = new RigaDocumentoPKey(row.getId_rigaDocumento(), row.getId_rigaDocumentoPrelevata()); + bean.findByKey(theKey); + return bean.delete(); + } + + public double getQuantitaAssociata() { + return this.quantitaAssociata; + } + + public void setQuantitaAssociata(double quantitaAssociata) { + this.quantitaAssociata = quantitaAssociata; + } + + public void aggiornaQuantitaAssociata() { + String s_Sql_Find = "select sum(A.quantitaPrelevata) as _sum from RIGA_DOCUMENTO_P AS A"; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumento=" + getId_rigaDocumento()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + setQuantitaAssociata(getSum(stmt)); + superSave(); + } catch (Exception e) { + handleDebug(e, 0); + } + } + + public long getFlgRigaPrelevata() { + return this.flgRigaPrelevata; + } + + public void setFlgRigaPrelevata(long flgRigaPrelevata) { + this.flgRigaPrelevata = flgRigaPrelevata; + } + + public boolean isAllRighePrelevateByDocumento(long l_id_documento) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + wc.addWc("(A.id_rigaDocumentoMov=0 or A.id_rigaDocumentoMov is null)"); + wc.addWc("(A.flgRigaPrelevata is null or A.flgRigaPrelevata=0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + Vectumerator vec = findRows(stmt, 1, 1); + if (vec.hasMoreElements()) + return false; + return true; + } catch (Exception e) { + handleDebug(e, 0); + return false; + } + } + + public double getPrezzoPubblicoConIva() { + return this.prezzoPubblicoConIva; + } + + public void setPrezzoPubblicoConIva(double prezzoPubblicoConIva) { + this.prezzoPubblicoConIva = prezzoPubblicoConIva; + } + + public double getImportoCalc() { + if (getId_iva() != 0L) { + DoubleOperator ppi = new DoubleOperator(getImponibile()); + ppi.setScale(4, 5); + ppi.multiply(getIva().getAliquota()); + ppi.divide(100.0F); + ppi.add(getImponibile()); + ppi.setScale(2, 5); + return ppi.getResult(); + } + return getImponibile(); + } + + public long getId_reparto() { + if (this.id_reparto == 0L && getId_articolo() != 0L) + return getArticolo().getTipo().getId_reparto(); + return this.id_reparto; + } + + public Reparto getReparto() { + this.reparto = (Reparto)getSecondaryObject(this.reparto, Reparto.class, getId_reparto()); + return this.reparto; + } + + public void setId_reparto(long id_reparto) { + this.id_reparto = id_reparto; + setReparto(null); + } + + public void setReparto(Reparto reparto) { + this.reparto = reparto; + } + + public double getImporto() { + if (getId_articolo() == 0L) + return this.importo; + if (getArticolo().getFlgNegativo() == 1L || getFlgReso() == 1L) + return -Math.abs(this.importo); + return Math.abs(this.importo); + } + + public void setImporto(double importo) { + this.importo = importo; + } + + public Vectumerator findRigheDocumentoPrelevateDaStornare() { + String s_Sql_Find = "select * from riga_documento where flgRigaPrelevata=1 and quantitaPrelevata!=nr"; + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm savexAggiornaCostoUltimoFornitore() { + synchronized (this) { + ResParm rp = aggiornaCostoUltimoFornitore(); + return rp; + } + } + + public Vectumerator findVenditeGiornaliere(DocumentoCR CR, long l_id_docCassa) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A left join ARTICOLO AS C on A.id_articolo=C.id_articolo left join TIPO AS D on C.id_tipo=D.id_tipo left join REPARTO AS E on A.id_reparto=E.id_reparto , DOCUMENTO AS B "; + String s_Sql_Order = " order by B.dataDocumento, E.descrizione, D.descrizione, A.descrizioneRiga, A.notaBarcode "; + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("B.id_tipoDocumento= " + l_id_docCassa); + if (CR.getId_tipo() > 0L) + wc.addWc("(C.id_tipo=" + CR.getId_tipo() + " or D.indici like'%:" + CR.getId_tipo() + ":%')"); + wc.addWc("B.dataDocumento>=?"); + wc.addWc("B.dataDocumento<=?"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + int dataCount = 1; + stmt.setDate(dataCount, CR.getDataDocumentoDa()); + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoA()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm deleteNOMAG() { + synchronized (this) { + Vectumerator vec = new RigaDocumentoP(getApFull()).findByRigaDocumento(getId_rigaDocumento(), 0, 0); + while (vec.hasMoreElements()) { + DbInterface row = (DbInterface)vec.nextElement(); + row.delete(); + } + ResParm rp = super.delete(); + return rp; + } + } + + public ResParm superSave() { + return super.save(); + } + + public String getDescrizioneMovimentoMagazzino() { + String temp; + if (getFlgReso() == 1L) { + temp = getMagFisicoArrivo().getDescrizione() + "-->" + getMagFisicoArrivo().getDescrizione(); + } else { + temp = getMagFisicoPartenza().getDescrizione() + "-->" + getMagFisicoPartenza().getDescrizione(); + } + if (temp.equals("-->")) + return ""; + return temp; + } + + public double getQuantitaImpegnataByArticolo(long l_id_articolo) { + RigaDocumentoCR CR = new RigaDocumentoCR(getApFull()); + RigaDocumento bean = new RigaDocumento(getApFull()); + CR.setFlgTipologia(4L); + CR.setFlgRigaPrelevata(0L); + CR.setFlgStatoPrenotazione(200L); + CR.setId_articolo(l_id_articolo); + CR.setFlgTipoRicerca(0L); + Vectumerator vec = bean.findByCR(CR, 0, 0); + DoubleOperator dop = new DoubleOperator(); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + dop.add(row.getQuantita()); + dop.subtract(row.getQuantitaPrelevata()); + } + return dop.getResult(); + } + + public double getQuantitaImpegnataFilatoByArticoloFilatoColoreSeriale(long l_id_articoloFilatoColore, long l_id_articoloFilato, long l_id_coloreFilato, String l_seriale) { + MagFisico mf = new MagFisico(getApFull()); + mf.findMagazzinoOrdinato(); + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagFilatoDisponibilitaPuntuale(l_id_articoloFilatoColore, l_id_articoloFilato, l_id_coloreFilato, l_seriale, + mf.getId_magFisico(), 0L, 0L, "C"); + return rd.getQuantita(); + } + + public double getQuantitaImpegnataTessutoByArticoloTessutoColoreSeriale(long l_id_articoloTessutoColore, long l_id_articoloTessuto, long l_id_coloreTessuto, String l_seriale) { + MagFisico mf = new MagFisico(getApFull()); + mf.findMagazzinoOrdinato(); + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagTessutoDisponibilita(l_id_articoloTessuto, l_id_articoloTessutoColore, l_seriale, mf.getId_magFisico(), 0L, -1L, 0L, "C", DATA_NULL); + return rd.getQuantita(); + } + + public double getQuantitaInArrivoByArticolo(long l_id_articolo) { + MagFisico mf = new MagFisico(getApFull()); + mf.findMagazzinoOrdinato(); + if (mf.getId_magFisico() > 0L) { + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagDisponibilitaPuntuale(l_id_articolo, 0L, 0L, null, mf.getId_magFisico(), 0L, 0L); + return rd.getQuantita(); + } + return 0.0D; + } + + public double getQuantitaFilatoInArrivoByArticoloFilatoColoreSeriale(long l_id_articoloFilatoColore, long l_id_articolofilato, long l_id_colore, String l_seriale) { + MagFisico mf = new MagFisico(getApFull()); + mf.findMagazzinoOrdinato(); + if (mf.getId_magFisico() > 0L) { + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagFilatoDisponibilitaPuntuale(l_id_articoloFilatoColore, l_id_articolofilato, l_id_colore, l_seriale, + mf.getId_magFisico(), 0L, 0L, "F"); + return rd.getQuantita(); + } + return 0.0D; + } + + public double getQuantitaTessutoInArrivoByArticoloTessutoColoreSeriale(long l_id_articoloTessutoColore, long l_id_articoloTessuto, long l_id_colore, String l_seriale) { + MagFisico mf = new MagFisico(getApFull()); + mf.findMagazzinoOrdinato(); + if (mf.getId_magFisico() > 0L) { + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagTessutoDisponibilita(l_id_articoloTessuto, l_id_articoloTessutoColore, l_seriale, mf.getId_magFisico(), 0L, -1L, 0L, "F", DATA_NULL); + return rd.getQuantita(); + } + return 0.0D; + } + + public double getQuantitaTessutoLavorazioneByArticoloTessutoColoreSeriale(long l_id_articoloTessutoColore, long l_id_articoloTessuto, long l_id_colore, String l_seriale) { + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagTessutoDisponibilita(l_id_articoloTessuto, l_id_articoloTessutoColore, l_seriale, 0L, 0L, 20L, 0L, "", DATA_NULL); + return rd.getQuantita(); + } + + public double getQuantitaInArrivoByArticoloM(long l_id_articolo) { + MagFisico mf = new MagFisico(getApFull()); + mf.findMagazzinoOrdinato(); + Movimento mov = new Movimento(getApFull()); + mov.findDisponibilitaPuntuale(l_id_articolo, 0L, 0L, null, mf.getId_magFisico(), 0L); + return mov.getQuantita(); + } + + public double[] getQtaOrdinataPrelevataByRigaPrenotazione() { + double[] res = { 0.0D, 0.0D }; + if (getId_rigaDocumento() == 0L) + return res; + String s_Sql_Find = "SELECT Sum(A.quantita) as quantita, Sum(A.quantitaPrelevata) AS quantitaPrelevata FROM RIGA_DOCUMENTO as A inner join RIGA_DOCUMENTO_P_M AS B ON A.id_rigaDocumento=B.id_rigaDocumento"; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("B.id_rigaDocumentoPrelevata=" + getId_rigaDocumento()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt); + if (vec.hasMoreElements()) { + RigaDocumento r = (RigaDocumento)vec.nextElement(); + res[0] = r.getQuantita(); + res[1] = r.getQuantitaPrelevata(); + } + } catch (SQLException e) { + handleDebug(e); + } + return res; + } + + private static synchronized ResParm synchroSaveMagArticolo(RigaDocumento bean) { + ResParm rp = new ResParm(); + rp = bean.superSave(); + if (rp.getStatus()) + rp.append(bean.aggiornaCostoUltimoFornitore()); + return rp; + } + + private static synchronized ResParm synchroSave(RigaDocumento bean) { + ResParm rp = bean.getDocumento().checkEMSTA(); + if (!rp.getStatus()) + return new ResParm(false, "ATTENZIONE! Tentativo di modificare una riga documento: " + rp.getMsg()); + if (bean.getParm("USA_MAGAZZINO").isTrue()) + return synchroSaveMagArticolo(bean); + RigaDocumento rd = new RigaDocumento(bean.getApFull()); + rd.findByPrimaryKey(bean.getId_rigaDocumento()); + long l_flgRigaPrelevata = rd.getFlgRigaPrelevata(); + if (bean.getDBState() == 1) { + if (bean.getFlgRigaPrelevata() == 1L) + return new ResParm(false, "ERRORE! Non puoi modificare una riga chiusa!"); + if (bean.getQuantitaPrelevata() > 0.0D && bean.getQuantita() < bean.getQuantitaPrelevata()) + return new ResParm(false, "ERRORE! La quantità prelevata è maggiore della quantità della riga"); + } + if (bean.getQuantitaPrelevata() >= bean.getQuantita() && bean.getQuantitaPrelevata() > 0.0D && bean.getQuantita() > 0.0D) + bean.setFlgRigaPrelevata(1L); + double quantitaPrelevata1 = 0.0D; + if (bean.getArticolo().usaMagazzino()) { + RigaDocumentoP rdp = new RigaDocumentoP(bean.getApFull()); + rd.getMagQuantitaPrelevatoByRigaDocumento(bean.getId_rigaDocumento()); + quantitaPrelevata1 = rd.getQuantita(); + double quantitaPrelevata2 = rdp.getQuantitaPrelevatoByRigaDocumento(bean.getId_rigaDocumento()); + if (quantitaPrelevata1 != quantitaPrelevata2) { + System.out.println("Rigadocumento.synchroSave: ERRORE calcolo quantità prelevate" + quantitaPrelevata1 + "!= " + quantitaPrelevata2); + quantitaPrelevata1 = quantitaPrelevata2; + } + if (bean.getQuantita() < quantitaPrelevata1) + return new ResParm(false, "ERRORE! La quantità prelevata è maggiore della quantità della riga"); + } + RigaDocumento beanRB = null; + if (bean.getId_rigaDocumento() != 0L) { + beanRB = new RigaDocumento(bean.getApFull()); + beanRB.findByPrimaryKey(bean.getId_rigaDocumento()); + } + rp = new ResParm(true); + if (bean.getId_articolo() != 0L && bean.getArticolo().usaMagazzino()) { + long magPartenza = 0L; + long magArrivo = 0L; + long flgInternoPartenza = 0L; + long flgInternoArrivo = 0L; + if (bean.getDocumento().getId_magFisicoPartenza() == 0L) { + if (bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoPartenza() > 0L) { + magPartenza = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoPartenza(); + flgInternoPartenza = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getMagFisicoPartenza().getFlgTipo(); + } + } else { + magPartenza = bean.getDocumento().getId_magFisicoPartenza(); + flgInternoPartenza = bean.getDocumento().getMagFisicoPartenza().getFlgTipo(); + } + if (bean.getDocumento().getId_magFisicoArrivo() == 0L) { + if (bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo() > 0L) { + magArrivo = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo(); + flgInternoArrivo = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getMagFisicoArrivo().getFlgTipo(); + } + } else { + magArrivo = bean.getDocumento().getId_magFisicoArrivo(); + flgInternoArrivo = bean.getDocumento().getMagFisicoArrivo().getFlgTipo(); + } + if (magPartenza != 0L || (magPartenza == 0L && magArrivo == 0L)) { + long segnoMov = -1L; + if (bean.getFlgReso() == 1L) + segnoMov = 1L; + if (magPartenza == 0L && magArrivo == 0L) + segnoMov = 0L; + bean.setSegnoMov(segnoMov); + bean.setId_causaleMagazzino(bean.getDocumento().getTipoDocumento().getId_causaleMagazzino()); + bean.setId_magFisico(magPartenza); + if (flgInternoPartenza == 1L) { + bean.setId_clifor(0L); + } else { + bean.setId_clifor(bean.getDocumento().getId_clifor()); + } + rp = bean.superSave(); + } + if (rp.getStatus() && magArrivo != 0L) { + long segnoMov = 1L; + if (bean.getFlgReso() == 1L) + segnoMov = -1L; + if (magPartenza == 0L) { + bean.setSegnoMov(segnoMov); + bean.setId_causaleMagazzino(bean.getDocumento().getTipoDocumento().getId_causaleMagazzino()); + bean.setId_magFisico(magArrivo); + if (flgInternoArrivo == 1L) { + bean.setId_clifor(0L); + } else { + bean.setId_clifor(bean.getDocumento().getId_clifor()); + } + rp = bean.superSave(); + } else { + try { + RigaDocumento rd2 = (RigaDocumento)bean.clone(); + rd2.setDBState(0); + rd2.setId_rigaDocumento(0L); + rd2.setId_rigaDocumentoMov(bean.getId_rigaDocumento()); + rd2.setSegnoMov(segnoMov); + rd2.setId_magFisico(magArrivo); + if (flgInternoArrivo == 1L) { + rd2.setId_clifor(0L); + } else { + rd2.setId_clifor(bean.getDocumento().getId_clifor()); + } + rd2.setId_rigaDocumentoMov(bean.getId_rigaDocumento()); + rp = bean.superSave(); + } catch (Exception e) { + bean.handleDebug(e, 0); + rp.setException(e); + } + } + } + } else { + bean.setId_clifor(0L); + rp = bean.superSave(); + } + if (rp.getStatus()) { + rp.append(bean.getDocumento().save()); + rp.append(bean.aggiornaCostoUltimoFornitore()); + if (l_flgRigaPrelevata != bean.getFlgRigaPrelevata()) + if (bean.getFlgRigaPrelevata() == 0L) { + if (bean.getDocumento().getFlgDocumentoPrelevato() == 1L) + bean.getDocumento().aggiornaFlgDocumentoPrelevato(0L); + } else { + bean.getDocumento().verificaEAggiornaFlgDocumentoPrelevato(); + } + if (bean.getArticolo().usaMagazzino() && (bean.getDocumento().getTipoDocumento().getId_causaleMagazzino() > 0L || + bean.getDocumento().getTipoDocumento().getFlgTipologia() == 4L)) { + bean.resetStatoPrenotazioneByArticolo(bean.getId_articolo(), bean.getId_articoloVariante(), bean.getId_articoloTaglia()); + bean.checkStatoPrenotazione(); + } + } + if (rp.getStatus()) + rp.setMsg(AbMessages.getMessage("SAVE_OK")); + return rp; + } + + private static synchronized ResParm synchroSaveFilato(RigaDocumento bean) { + ResParm rp = bean.getDocumento().checkEMSTA(); + if (!rp.getStatus()) + return new ResParm(false, "ATTENZIONE! Tentativo di modificare una riga documento: " + rp.getMsg()); + RigaDocumento rd = new RigaDocumento(bean.getApFull()); + rd.findByPrimaryKey(bean.getId_rigaDocumento()); + long l_flgRigaPrelevata = rd.getFlgRigaPrelevata(); + if (bean.getDBState() == 1) { + if (bean.getFlgRigaPrelevata() == 1L) + return new ResParm(false, "ERRORE! Non puoi modificare una riga chiusa!"); + if (bean.getQuantitaPrelevata() > 0.0D && bean.getQuantita() < bean.getQuantitaPrelevata()) + return new ResParm(false, "ERRORE! La quantità prelevata è maggiore della quantità della riga"); + } + if (bean.getQuantitaPrelevata() >= bean.getQuantita() && bean.getQuantitaPrelevata() > 0.0D && bean.getQuantita() > 0.0D) + bean.setFlgRigaPrelevata(1L); + double quantitaPrelevata1 = 0.0D; + System.out.println(bean.getId_articoloFilatoColore()); + if (bean.getArticoloFilatoColore().isUsaMagazzino()) { + rd.getMagQuantitaPrelevatoByRigaDocumento(bean.getId_rigaDocumento()); + quantitaPrelevata1 = rd.getQuantita(); + if (bean.getQuantita() < quantitaPrelevata1) + return new ResParm(false, "ERRORE! La quantità prelevata è maggiore della quantità della riga"); + } + RigaDocumento beanRB = null; + if (bean.getId_rigaDocumento() != 0L) { + beanRB = new RigaDocumento(bean.getApFull()); + beanRB.findByPrimaryKey(bean.getId_rigaDocumento()); + } + rp = new ResParm(true); + long magPartenza = 0L; + long magArrivo = 0L; + long flgTipoMagFisicoPartenza = 0L; + long flgTipoMagFisicoArrivo = 0L; + long l_id_causalemagazzino = 0L; + if (bean.getFlgCodiceRiga() == 0L) { + l_id_causalemagazzino = bean.getDocumento().getTipoDocumento().getId_causaleMagazzino(); + if (bean.getDocumento().getId_magFisicoPartenza() == 0L) { + if (bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoPartenza() > 0L) { + magPartenza = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoPartenza(); + flgTipoMagFisicoPartenza = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getMagFisicoPartenza().getFlgTipo(); + } + } else { + magPartenza = bean.getDocumento().getId_magFisicoPartenza(); + flgTipoMagFisicoPartenza = bean.getDocumento().getMagFisicoPartenza().getFlgTipo(); + } + if (bean.getDocumento().getId_magFisicoArrivo() == 0L) { + if (bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo() > 0L) { + magArrivo = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo(); + flgTipoMagFisicoArrivo = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getMagFisicoArrivo().getFlgTipo(); + } + } else { + magArrivo = bean.getDocumento().getId_magFisicoArrivo(); + flgTipoMagFisicoArrivo = bean.getDocumento().getMagFisicoArrivo().getFlgTipo(); + } + } else { + l_id_causalemagazzino = bean.getDocumento().getTipoDocumento().getId_causaleMagazzino2(); + if (bean.getDocumento().getId_magFisicoPartenza2() == 0L) { + if (bean.getDocumento().getTipoDocumento().getCausaleMagazzino2().getId_magFisicoPartenza() > 0L) { + magPartenza = bean.getDocumento().getTipoDocumento().getCausaleMagazzino2().getId_magFisicoPartenza(); + flgTipoMagFisicoPartenza = bean.getDocumento().getTipoDocumento().getCausaleMagazzino2().getMagFisicoPartenza().getFlgTipo(); + } + } else { + magPartenza = bean.getDocumento().getId_magFisicoPartenza2(); + flgTipoMagFisicoPartenza = bean.getDocumento().getMagFisicoPartenza2().getFlgTipo(); + } + if (bean.getDocumento().getId_magFisicoArrivo2() == 0L) { + if (bean.getDocumento().getTipoDocumento().getCausaleMagazzino2().getId_magFisicoArrivo() > 0L) { + magArrivo = bean.getDocumento().getTipoDocumento().getCausaleMagazzino2().getId_magFisicoArrivo(); + flgTipoMagFisicoArrivo = bean.getDocumento().getTipoDocumento().getCausaleMagazzino2().getMagFisicoArrivo().getFlgTipo(); + } + } else { + magArrivo = bean.getDocumento().getId_magFisicoArrivo2(); + flgTipoMagFisicoArrivo = bean.getDocumento().getMagFisicoArrivo2().getFlgTipo(); + } + } + if (bean.getId_articoloFilatoColore() != 0L && bean.getArticoloFilatoColore().usaMagazzino() && (magArrivo > 0L || magPartenza > 0L)) { + if (magPartenza != 0L) { + long segnoMov = -1L; + if (bean.getFlgReso() == 1L) + segnoMov = 1L; + bean.setSegnoMov(segnoMov); + bean.setId_causaleMagazzino(l_id_causalemagazzino); + bean.setId_magFisico(magPartenza); + if (flgTipoMagFisicoPartenza == 1L) { + bean.setId_clifor(0L); + } else { + bean.setId_clifor(bean.getDocumento().getId_clifor()); + } + rp = bean.superSave(); + } + if (rp.getStatus() && magArrivo != 0L) { + long segnoMov = 1L; + if (bean.getFlgReso() == 1L) + segnoMov = -1L; + if (magPartenza == 0L) { + bean.setSegnoMov(segnoMov); + bean.setId_causaleMagazzino(l_id_causalemagazzino); + bean.setId_magFisico(magArrivo); + if (flgTipoMagFisicoArrivo == 1L) { + bean.setId_clifor(0L); + } else { + bean.setId_clifor(bean.getDocumento().getId_clifor()); + } + rp = bean.superSave(); + } else { + try { + RigaDocumento rd2 = (RigaDocumento)bean.clone(); + rd2.setDBState(0); + rd2.setId_rigaDocumento(0L); + rd2.setId_rigaDocumentoMov(bean.getId_rigaDocumento()); + rd2.setSegnoMov(segnoMov); + rd2.setId_magFisico(magArrivo); + if (flgTipoMagFisicoArrivo == 1L) { + rd2.setId_clifor(0L); + } else { + rd2.setId_clifor(bean.getDocumento().getId_clifor()); + } + rd2.setId_rigaDocumentoMov(bean.getId_rigaDocumento()); + rp = bean.superSave(); + } catch (Exception e) { + bean.handleDebug(e, 0); + rp.setException(e); + } + } + } + } else { + bean.setId_clifor(0L); + rp = bean.superSave(); + } + if (rp.getStatus()) { + rp.append(bean.getDocumento().save()); + rp.append(bean.aggiornaCostoUltimoFornitore()); + if (l_flgRigaPrelevata != bean.getFlgRigaPrelevata()) + if (bean.getFlgRigaPrelevata() == 0L) { + if (bean.getDocumento().getFlgDocumentoPrelevato() == 1L) + bean.getDocumento().aggiornaFlgDocumentoPrelevato(0L); + } else { + bean.getDocumento().verificaEAggiornaFlgDocumentoPrelevato(); + } + } + if (rp.getStatus()) + if (bean.getId_articoloFilatoColore() > 0L) { + rp.setMsg(AbMessages.getMessage("SAVE_OK")); + bean.getArticoloFilatoColore().getArticoloFilato().setQuantitaCalcolate(false); + bean.getArticoloFilatoColore().getArticoloFilato().superSave(); + bean.getArticoloFilatoColore().setQuantitaCalcolate(false); + bean.getArticoloFilatoColore().superSave(); + } else { + rp.setMsg("Attenzione! Articolo non in anagrafica!"); + } + return rp; + } + + public long getFlgReso() { + return this.flgReso; + } + + public void setFlgReso(long flgReso) { + this.flgReso = flgReso; + } + + public Vectumerator findOrdini(DocumentoCR CR) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A, DOCUMENTO AS B, ARTICOLO AS C, TIPO AS D, CLIFOR as E "; + String s_Sql_Order = " order by B.progDocumento, A.descrizioneRiga , A.seriale "; + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("A.id_articolo=C.id_articolo"); + wc.addWc("C.id_tipo=D.id_tipo"); + wc.addWc("B.id_clifor=E.id_clifor"); + wc.addWc("B.id_tipoDocumento= " + CR.getId_tipoDocumento()); + if (CR.getId_tipo() > 0L) + wc.addWc("(C.id_tipo=" + CR.getId_tipo() + " or D.indici like'%:" + CR.getId_tipo() + ":%')"); + wc.addWc("(B.flgDocumentoPrelevato is null or B.flgDocumentoPrelevato =0) "); + wc.addWc("(A.flgRigaPrelevata is null or A.flgRigaPrelevata =0) "); + if (CR.getDataDocumentoDa() != null) + wc.addWc("B.dataDocumento>=?"); + if (CR.getDataDocumentoA() != null) + wc.addWc("B.dataDocumento<=?"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + int dataCount = 1; + if (CR.getDataDocumentoDa() != null) { + stmt.setDate(dataCount, CR.getDataDocumentoDa()); + dataCount++; + } + if (CR.getDataDocumentoA() != null) { + stmt.setDate(dataCount, CR.getDataDocumentoA()); + dataCount++; + } + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgPrenotazioneArrivata() { + return this.flgPrenotazioneArrivata; + } + + public void setFlgPrenotazioneArrivata(long flgPrenotazioneArrivata) { + this.flgPrenotazioneArrivata = flgPrenotazioneArrivata; + } + + public boolean isAllRighePrenotazioneArrivateByDocumento(long l_id_documento) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + wc.addWc("(A.flgPrenotazioneArrivata is null or A.flgPrenotazioneArrivata=0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + Vectumerator vec = findRows(stmt, 1, 1); + if (vec.hasMoreElements()) + return false; + return true; + } catch (Exception e) { + handleDebug(e, 0); + return false; + } + } + + public double getQuantitaPrelevata() { + return this.quantitaPrelevata; + } + + public ResParm creaCodaMessaggio(String theMsg) { + ResParm rp = new ResParm(); + if (getId_documento() > 0L && getSeriale().length() == 10) { + MailMessage mm = new MailMessage(getApFull()); + mm.setTextMessage(theMsg); + CodaMessaggi cm = new CodaMessaggi(getApFull()); + cm.setDataCreazione(getToday()); + cm.setCellulare(getSeriale()); + cm.setTestoMessaggio(mm.getMessage()); + cm.setFlgTipo(2L); + cm.setFlgStatoInvio(0L); + rp = cm.save(); + } + return rp; + } + + public ResParm creaCodaMessaggiSms(RigaDocumentoCR CR) { + ResParm rp = new ResParm(); + Vectumerator vec = findByCR(CR, 0, 0); + int numMsg = 0; + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + rp = row.creaCodaMessaggio(CR.getTestoMessaggio()); + if (rp.getStatus()) + numMsg++; + } + rp.setMsg("Numero messaggi in coda: " + numMsg); + return rp; + } + + private void findCompattaByCRCreateStmtDate(RigaDocumentoCR CR, PreparedStatement stmt) { + try { + int dataCount = 0; + if (CR.getDataDocumentoDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoDa()); + } + if (CR.getDataDocumentoA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoA()); + } + if (CR.getDataRiferimentoDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataRiferimentoDa()); + } + if (CR.getDataRiferimentoA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataRiferimentoA()); + } + } catch (SQLException e) { + handleDebug(e); + } + } + + private void findCompattaByCRCreateWC(RigaDocumentoCR CR, StringBuffer s_Sql_Find, WcString wc) { + wc.addWc("(B.flgHaDocumentoPadre is null or B.flgHaDocumentoPadre =0)"); + wc.addWc("D.id_causaleMagazzino>0"); + if (CR.getId_tipo() != 0L) + wc.addWc("(F.id_tipo=" + CR.getId_tipo() + " or F.indici like'%:" + CR.getId_tipo() + ":%')"); + if (CR.getId_clifor() != 0L) + wc.addWc("B.id_clifor=" + CR.getId_clifor()); + if (CR.getProgDocumento() != 0L) + wc.addWc("B.progDocumento =" + CR.getProgDocumento()); + if (CR.getId_esercizio() != 0L) + wc.addWc("B.id_esercizio=" + CR.getId_esercizio()); + if (CR.getId_tipoDocumento() != 0L) + wc.addWc("B.id_tipoDocumento=" + CR.getId_tipoDocumento()); + if (CR.getId_articoloVariante() != 0L) { + wc.addWc("A.id_articoloVariante=" + CR.getId_articoloVariante()); + } else if (CR.getId_articolo() != 0L) { + wc.addWc("A.id_articolo=" + CR.getId_articolo()); + } + if (CR.getFlgTipoMovimento() == 1L) { + wc.addWc("(B.flgTipoMovimento=1 or B.flgTipoMovimento=3)"); + } else if (CR.getFlgTipoMovimento() == 2L) { + wc.addWc("(B.flgTipoMovimento=2 or B.flgTipoMovimento=3)"); + } + if (!CR.getSeriale().isEmpty()) { + String temp = CR.getSeriale(); + temp = prepareInputMySqlString(temp, false); + temp = temp.replace("*", "%"); + wc.addWc("A.seriale like '" + temp + "'"); + } + if (CR.getDataDocumentoDa() != null) + wc.addWc("B.dataDocumento>=?"); + if (CR.getDataDocumentoA() != null) + wc.addWc("B.dataDocumento<=?"); + if (CR.getDataRiferimentoDa() != null) + wc.addWc("B.dataRiferimento>=?"); + if (CR.getDataRiferimentoA() != null) + wc.addWc("B.dataRiferimento<=?"); + } + + private void creaFileCvs(Vectumerator list, RigaDocumentoCR CR) { + try { + CR.setFileName(getPathTmp() + "exportMovimenti_" + getPathTmp() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "Numero;Intestazione;Data;Articolo;Disp.Art.;Tipo Movimento;Magazzini;Q.ta;Sconto;Tot.;IVA;Importo Doc;n.colli tot"; + if (CR.getFlgTipoReport() >= 1L) + s1 = s1 + ";Q.tà variante"; + if (CR.getFlgTipoReport() == 2L) + s1 = s1 + ";Q.tà seriale"; + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)list.nextElement(); + s1 = " " + row.getDocumento().getNumeroDocumentoCompleto() + "\"" + SEP + row.getDocumento().getClifor().getDescrizioneCompleta() + SEP + getDataFormat().format(row.getDocumento().getDataDocumento()) + SEP + row.getDescrizioneRigaCompleta() + SEP + getNf().format(row.getArticolo().getQuantita()) + SEP + row.getDescrizioneTipoMovimento() + SEP + row.getDescrizioneMovimentoMagazzino() + SEP + row.getUdmQuantita() + SEP + getNf().format(row.getSconto()) + SEP + getNf().format(row.getTotImponibileRiga()) + SEP + row.getIva().getDescrizione() + SEP + getNf().format(row.getDocumento().getTotaleDocumento()) + SEP + getNf().format(row.getDocumento().getNColli()); + s1 = s1.replace("€", "€"); + outCvsFile.writeLine(s1); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + + public String getSerialeSost() { + return (this.serialeSost == null) ? "" : this.serialeSost.trim(); + } + + public void setSerialeSost(String serialeSost) { + this.serialeSost = serialeSost; + } + + public Documento getDocumentoPadre() { + this.documentoPadre = (Documento)getSecondaryObject(this.documentoPadre, Documento.class, getId_documentoPadre()); + return this.documentoPadre; + } + + public long getId_documentoPadre() { + return this.id_documentoPadre; + } + + public void setDocumentoPadre(Documento newDocumentoPadre) { + this.documentoPadre = newDocumentoPadre; + } + + public void setId_documentoPadre(long newId_documentoPadre) { + this.id_documentoPadre = newId_documentoPadre; + setDocumentoPadre(null); + } + + public Vectumerator findByDocumentoDocumentoPadre(long l_id_documento, long l_id_documentoPadre, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A left join ARTICOLO AS B on A.id_articolo=B.id_articolo "; + String s_Sql_order = " order by A.id_rigaDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByDocumentoPadre(long l_id_documentoPadre, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A "; + String s_Sql_order = " order by A.id_rigaDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findRigaAnnodaturaByDocumentoPadre(long l_id_documentoPadre) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A "; + String s_Sql_order = " order by A.id_rigaDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre); + wc.addWc("A.rifTipoArticolo=21"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 0); + } + } + + public void findRigaCatenaByDocumentoPadre(long l_id_documentoPadre) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A "; + String s_Sql_order = " order by A.id_rigaDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre); + wc.addWc("A.rifTipoArticolo=22"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 0); + } + } + + public void findByCodicePezza(String l_codicePezza) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A inner join DOCUMENTO AS B ON A.id_documento=B.id_documento"; + String s_Sql_order = " order by A.id_rigaDocumento desc"; + WcString wc = new WcString(); + String l_codicePezza_1 = l_codicePezza.substring(0, l_codicePezza.length() - 1); + wc.addWc("(A.codiceCartellinoStart<='" + l_codicePezza_1 + "' and A.codiceCartellinoStop>='" + l_codicePezza_1 + "' and B.flgBarcodeType=1) or (A.codiceCartellinoStart<='" + l_codicePezza + "' and A.codiceCartellinoStop>='" + l_codicePezza + "' and (B.flgBarcodeType!=1 or B.flgBarcodeType is null))"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + System.out.println(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 0); + } + } + + public Vectumerator findCompattaByCR(RigaDocumentoCR CR, int pageNumber, int pageRows) { + boolean flgOttimizzo = true; + if (pageNumber == 0 && pageRows == 0) + flgOttimizzo = false; + StringBuffer s_Sql_Find = new StringBuffer("select A.* from RIGA_DOCUMENTO AS A inner join DOCUMENTO AS B on A.id_documento=B.id_documento LEFT JOIN DOCUMENTO AS C ON B.id_documentoFiglio=C.id_documento inner join TIPO_DOCUMENTO AS D\tON B.id_tipoDocumento=D.id_tipoDocumento"); + String s_Sql_Order = " order by B.dataDocumento desc, B.progDocumento desc "; + if (CR.getFlgOrderBy() == 9L) + s_Sql_Order = " order by T.descrizione , E.nome "; + WcString wc = new WcString(); + if (CR.getId_tipo() != 0L || CR.getFlgOrderBy() == 9L) { + s_Sql_Find.append(", ARTICOLO AS E, TIPO AS F"); + wc.addWc("A.id_articolo=E.id_articolo"); + wc.addWc("E.id_tipo=F.id_tipo"); + } + if (CR.getFlgOrderBy() == 9L) { + s_Sql_Find.append(", TIPO AS T"); + wc.addWc("E.id_tipo=T.id_tipo"); + } + findCompattaByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt; + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + } else { + if (pageNumber == 0) + pageNumber = 1; + int start = (pageNumber - 1) * pageRows; + int stop = start + pageRows; + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + " limit " + s_Sql_Order + "," + start); + } + findCompattaByCRCreateStmtDate(CR, stmt); + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + Vectumerator vectumerator = findRows(stmt, pageNumber, pageRows); + if (!CR.getFlgReport().isEmpty()) + if (CR.getFlgOrderBy() == 9L) { + creaFileCvsTipoArticolo(vectumerator, CR); + } else { + creaFileCvs(vectumerator, CR); + } + return vectumerator; + } + Vectumerator vec = findRows(stmt, 1, pageRows); + vec.setPageNumber(pageNumber); + vec.setTotNumberOfRecords(findCompattaByCRTotRecord(CR)); + if (!CR.getFlgReport().isEmpty()) + if (CR.getFlgOrderBy() == 9L) { + creaFileCvsTipoArticolo(vec, CR); + } else { + creaFileCvs(vec, CR); + } + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + private int findCompattaByCRTotRecord(RigaDocumentoCR CR) { + StringBuffer s_Sql_Find = new StringBuffer("select count(A.id_rigaDocumento) as tot from RIGA_DOCUMENTO AS A inner join DOCUMENTO AS B on A.id_documento=B.id_documento LEFT JOIN DOCUMENTO AS C ON B.id_documentoFiglio=C.id_documento inner join TIPO_DOCUMENTO AS D\tON B.id_tipoDocumento=D.id_tipoDocumento"); + WcString wc = new WcString(); + if (CR.getId_tipo() != 0L || CR.getFlgOrderBy() == 9L) { + s_Sql_Find.append(", ARTICOLO AS E, TIPO AS F"); + wc.addWc("A.id_articolo=E.id_articolo"); + wc.addWc("E.id_tipo=F.id_tipo"); + } + findCompattaByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + findByCRCreateStmtDate(CR, stmt); + return (int)getTots(stmt); + } catch (Exception e) { + handleDebug(e); + return 0; + } + } + + private void creaFileCvsTipoArticolo(Vectumerator list, RigaDocumentoCR CR) { + try { + CR.setFileName(getPathTmp() + "exportMovimenti_" + getPathTmp() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "Numero;Intestazione;Data;Riferimento;Tipo;Articolo;Tipo Movimento;Q.ta;Sconto;Imp. Riga;IVA;Importo Doc."; + if (CR.getFlgTipoReport() >= 1L) + s1 = s1 + ";Q.tà variante"; + if (CR.getFlgTipoReport() == 2L) + s1 = s1 + ";Q.tà seriale"; + outCvsFile.writeLine(s1); + long l_id_currentArticolo = 0L; + DoubleOperator totQta = new DoubleOperator(); + while (list.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)list.nextElement(); + if (l_id_currentArticolo != row.getId_articolo()) { + if (l_id_currentArticolo != 0L) { + s1 = ";;;;;;;" + getNf().format(totQta.getResult()); + totQta = new DoubleOperator(); + outCvsFile.writeLine(s1); + } + l_id_currentArticolo = row.getId_articolo(); + } + totQta.add(row.getQuantita()); + s1 = " " + row.getDocumento().getNumeroDocumentoCompleto() + "\"" + SEP + row.getDocumento().getClifor().getDescrizioneCompleta() + SEP + getDataFormat().format(row.getDocumento().getDataDocumento()) + SEP + row.getDocumento().getRiferimento() + " " + getDataFormat().format(row.getDocumento().getDataRiferimento()) + SEP + row.getArticolo().getTipo().getDescrizione() + SEP + row.getArticolo().getNome() + SEP + row.getDescrizioneTipoMovimento() + SEP + getNf().format(row.getQuantita()) + SEP + getNf().format(row.getSconto()) + SEP + getNf().format(row.getTotImponibileRiga()) + SEP + row.getIva().getDescrizione() + SEP + getNf().format(row.getDocumento().getTotaleDocumento()) + SEP; + s1 = s1.replace("€", "€"); + outCvsFile.writeLine(s1); + } + s1 = ";;;;;;;" + getNf().format(totQta.getResult()); + outCvsFile.writeLine(s1); + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + + public long getOrdineRiga() { + return this.ordineRiga; + } + + public void setOrdineRiga(long ordineRiga) { + this.ordineRiga = ordineRiga; + } + + public double getQuantitaImpegnataByArticoloVariante(long l_id_articoloVariante) { + RigaDocumentoCR CR = new RigaDocumentoCR(getApFull()); + RigaDocumento bean = new RigaDocumento(getApFull()); + CR.setFlgTipologia(4L); + CR.setFlgRigaPrelevata(0L); + CR.setFlgStatoPrenotazione(200L); + CR.setId_articoloVariante(l_id_articoloVariante); + CR.setFlgTipoRicerca(0L); + Vectumerator vec = bean.findByCR(CR, 0, 0); + DoubleOperator dop = new DoubleOperator(); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + dop.add(row.getQuantita()); + dop.subtract(row.getQuantitaPrelevata()); + } + return dop.getResult(); + } + + public double getQuantitaImpegnataByArticoloTaglia(long l_id_articoloTaglia) { + RigaDocumentoCR CR = new RigaDocumentoCR(getApFull()); + RigaDocumento bean = new RigaDocumento(getApFull()); + CR.setFlgTipologia(4L); + CR.setFlgRigaPrelevata(0L); + CR.setFlgStatoPrenotazione(200L); + CR.setId_articoloTaglia(l_id_articoloTaglia); + CR.setFlgTipoRicerca(0L); + Vectumerator vec = bean.findByCR(CR, 0, 0); + DoubleOperator dop = new DoubleOperator(); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + dop.add(row.getQuantita()); + dop.subtract(row.getQuantitaPrelevata()); + } + return dop.getResult(); + } + + public double getQuantitaInArrivoByArticoloVariante(ArticoloVariante av) { + MagFisico mf = new MagFisico(getApFull()); + mf.findMagazzinoOrdinato(); + if (mf.getId_magFisico() > 0L) { + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagDisponibilitaPuntuale(av.getId_articolo(), av.getId_articoloVariante(), 0L, null, mf.getId_magFisico(), 0L, 0L); + return rd.getQuantita(); + } + return 0.0D; + } + + public double getQuantitaInArrivoByArticoloTaglia(ArticoloTaglia at) { + MagFisico mf = new MagFisico(getApFull()); + mf.findMagazzinoOrdinato(); + if (mf.getId_magFisico() > 0L) { + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagDisponibilitaPuntuale(at.getId_articolo(), at.getId_articoloVariante(), at.getId_articoloTaglia(), null, + mf.getId_magFisico(), 0L, 0L); + return rd.getQuantita(); + } + return 0.0D; + } + + public double getQuantitaInArrivoByArticoloVarianteM(ArticoloVariante av) { + MagFisico mf = new MagFisico(getApFull()); + mf.findMagazzinoOrdinato(); + Movimento mov = new Movimento(getApFull()); + mov.findDisponibilitaPuntuale(av.getId_articolo(), av.getId_articoloVariante(), 0L, null, mf.getId_magFisico(), 0L); + return mov.getQuantita(); + } + + public String getNotaBarcode() { + return (this.notaBarcode == null) ? "" : this.notaBarcode; + } + + public void setNotaBarcode(String notaBarcode) { + this.notaBarcode = notaBarcode; + } + + public boolean hasNote() { + if (getNotaBarcode().isEmpty() && getNotaRigaDocumento().isEmpty()) + return false; + return true; + } + + public long getFlgIgnoraPrenotazione() { + return this.flgIgnoraPrenotazione; + } + + public void setFlgIgnoraPrenotazione(long flgIgnoraPrenotazione) { + this.flgIgnoraPrenotazione = flgIgnoraPrenotazione; + } + + public Vectumerator findRigheSenzaTelaioByDocumento(long l_id_documento) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A inner join DOCUMENTO AS B ON A.id_documento=B.id_documento"; + String s_Sql_order = ""; + WcString wc = new WcString(); + wc.addWc("B.flgStato =1"); + wc.addWc("B.id_documento =" + l_id_documento); + wc.addWc("(A.id_telaio is null or A.id_telaio=0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findRigheConTelaioByDocumento(long l_id_documento) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A inner join DOCUMENTO AS B ON A.id_documento=B.id_documento"; + String s_Sql_order = ""; + WcString wc = new WcString(); + wc.addWc("B.flgStato =1"); + wc.addWc("B.id_documento =" + l_id_documento); + wc.addWc("A.id_telaio >0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getTotArticoliImpegnati(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia) { + String s_Sql_Find = "select sum(A.quantita) as _sum from RIGA_DOCUMENTO AS A , DOCUMENTO AS B, TIPO_DOCUMENTO AS C"; + String s_Sql_order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("B.id_tipoDocumento=C.id_tipoDocumento"); + wc.addWc("C.flgTipologia =4"); + wc.addWc("B.flgStato =1"); + wc.addWc("(B.flgStatoPrenotazione is null or B.flgStatoPrenotazione <90)"); + wc.addWc("A.flgRigaPrelevata !=1"); + wc.addWc("A.id_articolo=" + l_id_articolo); + if (l_id_articoloVariante == 0L) { + wc.addWc("(A.id_articoloVariante is null or A.id_articoloVariante=0)"); + } else if (l_id_articoloVariante > 0L) { + wc.addWc("A.id_articoloVariante=" + l_id_articoloVariante); + } + if (l_id_articoloTaglia == 0L) { + wc.addWc("(A.id_articoloTaglia is null or A.id_articoloTaglia=0)"); + } else if (l_id_articoloTaglia > 0L) { + wc.addWc("A.id_articoloTaglia=" + l_id_articoloTaglia); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return getSum(stmt); + } catch (Exception e) { + handleDebug(e, 0); + return 0.0D; + } + } + + public double getTotFilatiImpegnati(long l_id_articoloFilatoColore, long l_id_articoloFilato, long l_id_coloreFilato, String l_seriale) { + return 0.0D; + } + + public long getId_rigaDocumentoPadre() { + return this.id_rigaDocumentoPadre; + } + + public void setId_rigaDocumentoPadre(long id_rigaDocumentoPadre) { + this.id_rigaDocumentoPadre = id_rigaDocumentoPadre; + } + + public double getQuantita() { + if (getParm("USA_MAGAZZINO").isFalse()) { + long l_flgUdm = getFlgUdm(); + if (l_flgUdm == 1L) + return getNr(); + if (l_flgUdm == 3L) + return getMt(); + if (l_flgUdm == 2L) + return getKg(); + return getNr(); + } + return this.quantita; + } + + public long findRigheDaPrelevareByDocumento(long l_documento) { + String s_Sql_Find = "select COUNT(*) AS _count from RIGA_DOCUMENTO AS A "; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_documento); + wc.addWc("A.flgRigaPrelevata=0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return getCount(stmt, "_count"); + } catch (Exception e) { + handleDebug(e, 0); + return 0L; + } + } + + public double getImportoSconto() { + if (getSconto() == 0.0D && getPercL1() == 0.0D && getPercL2() == 0.0D && getPercL3() == 0.0D) + return 0.0D; + if (getSconto() > 0.0D) { + DoubleOperator doubleOperator = new DoubleOperator(getImporto()); + doubleOperator.setScale(4, 5); + doubleOperator.multiply(getSconto()); + doubleOperator.divide(100.0F); + doubleOperator.setScale(2, 5); + return doubleOperator.getResult(); + } + DoubleOperator temp = new DoubleOperator(getImporto()); + temp.setScale(4, 5); + DoubleOperator sconto = new DoubleOperator(); + sconto.setScale(4, 5); + if (getPercL1() > 0.0D) { + temp.multiply(getPercL1()); + temp.divide(100.0F); + sconto.add(temp.getResult()); + } + if (getPercL2() > 0.0D) { + temp = new DoubleOperator(getImporto()); + temp.subtract(sconto); + temp.multiply(getPercL2()); + temp.divide(100.0F); + sconto.add(temp.getResult()); + } + if (getPercL3() > 0.0D) { + temp = new DoubleOperator(getImporto()); + temp.subtract(sconto); + temp.multiply(getPercL3()); + temp.divide(100.0F); + sconto.add(temp.getResult()); + } + sconto.setScale(2, 5); + return sconto.getResult(); + } + + public void findFirstByDocumentoArticoloTaglia(long l_id_documento, long l_id_articoloTaglia) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A "; + String s_Sql_order = ""; + String wc = ""; + wc = buildWc(wc, "A.id_documento=" + l_id_documento); + wc = buildWc(wc, "A.id_articoloTaglia=" + l_id_articoloTaglia); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 0); + } + } + + private static synchronized ResParm delRigaDocumentoPM(RigaDocumento rd, RigaDocumentoPM row) { + RigaDocumentoPM bean = new RigaDocumentoPM(rd.getApFull()); + RigaDocumentoPMKey theKey = new RigaDocumentoPMKey(row.getId_rigaDocumento(), row.getId_rigaDocumentoPrelevata()); + bean.findByPrimaryKey(theKey); + return bean.delete(); + } + + private static synchronized ResParm addRigaDocumentoPM(RigaDocumento rd, RigaDocumentoPM row) { + RigaDocumentoPM bean = new RigaDocumentoPM(rd.getApFull()); + RigaDocumentoPMKey theKey = new RigaDocumentoPMKey(row.getId_rigaDocumento(), row.getId_rigaDocumentoPrelevata()); + bean.findByPrimaryKey(theKey); + if (bean != null) { + row.setDBState(bean.getDBState()); + } else { + row.setDBState(0); + } + ResParm rp = row.save(); + return rp; + } + + private long checkStatoRiga() { + long retVal = 0L; + DoubleOperator qtaEffettiva = new DoubleOperator(); + DoubleOperator qtaMagazzino = new DoubleOperator(); + if (getQuantita() > 0.0D) + if (getFlgRigaPrelevata() == 1L) { + retVal = 40L; + } else if (getId_articolo() != 0L || getId_articoloVariante() != 0L) { + if (!getSeriale().isEmpty()) { + retVal = 30L; + } else { + RigaDocumentoCR CR = new RigaDocumentoCR(); + CR.setFlgTipologia(4L); + CR.setFlgStatoPrenotazione(200L); + CR.setId_articolo(getId_articolo()); + CR.setId_articoloVariante(getId_articoloVariante()); + CR.setFlgTipoRicerca(0L); + CR.setFlgOrderBy(5L); + CR.setFlgRigaPrelevata(0L); + if (getId_articoloVariante() != 0L) { + qtaEffettiva.add(getArticoloVariante().getQuantitaInArrivoAv()); + qtaEffettiva.add(getArticoloVariante().getQuantitaAv()); + qtaMagazzino.add(getArticoloVariante().getQuantitaAv()); + } else if (getId_articolo() != 0L) { + qtaEffettiva.add(getArticolo().getQuantitaInArrivo()); + qtaEffettiva.add(getArticolo().getQuantita()); + qtaMagazzino.add(getArticolo().getQuantita()); + } + CR.setFlgNoSeriale(2L); + double qtAssociata = getRigheAssociateSeriali(CR); + double qtMagazzino = getQtaPrelevataPrenotazioni(); + qtaEffettiva.subtract(qtAssociata); + qtaEffettiva.subtract(getQtaOrdiniApertiPrenotazioni()); + qtaEffettiva.subtract(qtMagazzino); + qtaMagazzino.subtract(qtMagazzino); + qtaMagazzino.subtract(qtAssociata); + if (qtaEffettiva.getResult() >= 0.0D) { + CR.setFlgNoSeriale(1L); + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + double[] res = row.getQtaOrdinataPrelevataByRigaPrenotazione(); + double qtOrd = res[0]; + double qtPrel = res[1]; + double qtPrenoParziale = row.getQuantita(); + if (qtPrel >= qtPrenoParziale) { + retVal = 30L; + qtPrenoParziale = 0.0D; + } else if (qtPrel > 0.0D) { + retVal = 20L; + DoubleOperator dop = new DoubleOperator(qtPrenoParziale); + dop.subtract(qtPrel); + qtPrenoParziale = dop.getResult(); + } else if (qtOrd >= qtPrenoParziale) { + retVal = 10L; + qtPrenoParziale = 0.0D; + } else if (qtOrd > 0.0D) { + retVal = 15L; + DoubleOperator dop = new DoubleOperator(qtPrenoParziale); + dop.subtract(qtOrd); + qtPrenoParziale = dop.getResult(); + } + if (row.getId_rigaDocumento() == getId_rigaDocumento()) { + if (retVal == 30L || retVal == 10L) + break; + if (qtaMagazzino.getResult() >= qtPrenoParziale) { + if (retVal == 15L || retVal == 10L) { + retVal = 20L; + break; + } + retVal = 30L; + break; + } + if (qtaMagazzino.getResult() > 0.0D) { + retVal = 20L; + break; + } + if (qtaEffettiva.getResult() >= qtPrenoParziale) { + retVal = 10L; + break; + } + if (qtaEffettiva.getResult() > 0.0D) { + retVal = 15L; + break; + } + break; + } + qtaEffettiva.subtract(qtPrenoParziale); + qtaMagazzino.subtract(qtPrenoParziale); + retVal = 0L; + } + } + } + } + return retVal; + } + + public void checkStatoPrenotazione() { + Vectumerator vecDoc = findPrenotazioniAperteArrivate(getId_articolo(), getId_articoloVariante()); + while (vecDoc.hasMoreElements()) { + RigaDocumento rdoc = (RigaDocumento)vecDoc.nextElement(); + ResParm resParm = rdoc.getDocumento().checkStatoPrenotazioneByDocumento(); + } + getArticolo().resetCalcoloQuantita(); + } + + public Vectumerator findPrenotazioniAperteArrivate(long l_id_articolo, long l_id_articoloVariante) { + StringBuffer s_Sql_Find = new StringBuffer("select A.* from DOCUMENTO AS A, RIGA_DOCUMENTO AS B "); + WcString wc = new WcString(); + wc.addWc(" A.id_documento = B.id_documento "); + wc.addWc(" B.id_articolo = " + l_id_articolo); + if (l_id_articoloVariante == 0L) { + wc.addWc(" (B.id_articoloVariante =0 or B.id_articoloVariante is null) "); + } else { + wc.addWc(" B.id_articoloVariante = " + l_id_articoloVariante); + } + wc.addWc(" A.id_tipoDocumento = " + getParm("ID_DOC_PRENOTAZIONE").getNumeroLong()); + wc.addWc(" (A.flgStatoPrenotazione=200 OR A.flgStatoPrenotazione=20 OR A.flgStatoPrenotazione=0 OR A.flgStatoPrenotazione=10 OR A.flgStatoPrenotazione IS NULL)"); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getStatoRiga(long l_stato) { + String ret = ""; + if (l_stato == 0L) { + ret = "Da ordinare"; + } else if (l_stato == 15L) { + ret = "Ordinato Parziale"; + } else if (l_stato == 10L) { + ret = "Ordinato"; + } else if (l_stato == 20L) { + ret = "Arrivato Parziale"; + } else if (l_stato == 30L) { + ret = "Arrivato"; + } else if (l_stato == 40L) { + ret = "Chiuso"; + } + return ret; + } + + @Deprecated + private double getQuantitaByCR(RigaDocumentoCR CR) { + String s_Sql_Find = "SELECT Sum(A.quantita-A.quantitaPrelevata) AS _sum FROM RIGA_DOCUMENTO as A, DOCUMENTO AS B, TIPO_DOCUMENTO AS C"; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("B.id_tipoDocumento=C.id_tipoDocumento"); + if (CR.getId_articolo() != 0L) + wc.addWc("A.id_articolo=" + CR.getId_articolo()); + wc.addWc("B.id_articolo=" + CR.getId_articolo()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + double res = getSum(stmt); + return res; + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public long checkStatoRigaOld() { + long retVal = -1L; + DoubleOperator qtaEffettiva = new DoubleOperator(); + DoubleOperator qtaOrdiniAssociati = new DoubleOperator(); + DoubleOperator qtaMagazzino = new DoubleOperator(); + if (getId_articolo() != 0L || getId_articoloVariante() != 0L) { + if (!getSeriale().isEmpty()) { + retVal = 30L; + } else { + RigaDocumentoPM rdpm = new RigaDocumentoPM(getApFull()); + rdpm.findByRigaDocumentoPrelevata(getId_rigaDocumento()); + if (rdpm.getDBState() == 1) { + RigaDocumento rd = rdpm.getRigaDocumento(); + if (rd.getFlgRigaPrelevata() == 1L) { + if (getQuantita() == rd.getQuantita()) { + retVal = 30L; + } else { + retVal = 20L; + } + qtaOrdiniAssociati.add(rd.getQuantita()); + } else { + retVal = 10L; + } + } else { + retVal = 0L; + } + } + if (retVal == 0L) { + if (getId_articoloVariante() != 0L) { + qtaEffettiva.add(getArticoloVariante().getQuantitaInArrivoAv()); + qtaEffettiva.add(getArticoloVariante().getQuantitaAv()); + qtaMagazzino.add(getArticoloVariante().getQuantitaAv()); + } else if (getId_articolo() != 0L) { + qtaEffettiva.add(getArticolo().getQuantitaInArrivo()); + qtaEffettiva.add(getArticolo().getQuantita()); + qtaMagazzino.add(getArticolo().getQuantita()); + } + qtaEffettiva.subtract(qtaOrdiniAssociati.getResult()); + if (qtaEffettiva.getResult() > 0.0D) { + RigaDocumentoCR CR = new RigaDocumentoCR(); + CR.setFlgTipologia(4L); + CR.setFlgStatoPrenotazione(200L); + CR.setId_articolo(getId_articolo()); + CR.setId_articoloVariante(getId_articoloVariante()); + CR.setFlgTipoRicerca(0L); + CR.setFlgOrderBy(5L); + CR.setFlgRicercaNonOrdinati(true); + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (row.getId_rigaDocumento() == getId_rigaDocumento()) { + if (qtaMagazzino.getResult() >= getQuantita()) { + retVal = 30L; + break; + } + if (qtaMagazzino.getResult() > 0.0D) { + retVal = 20L; + break; + } + if (qtaEffettiva.getResult() >= getQuantita()) { + retVal = 10L; + break; + } + if (qtaEffettiva.getResult() > 0.0D) { + retVal = 15L; + break; + } + break; + } + qtaEffettiva.subtract(row.getQuantita()); + qtaMagazzino.subtract(row.getQuantita()); + } + } + } + } + return retVal; + } + + public double getQtaPrelevataPrenotazioni() { + String s_Sql_Find = "select SUM(Z.quantitaPrelevata) AS _sum FROM RIGA_DOCUMENTO AS Z INNER JOIN DOCUMENTO AS B ON Z.id_documento = B.id_documento INNER JOIN RIGA_DOCUMENTO_P_M AS C ON Z.id_rigaDocumento = C.id_rigaDocumento "; + String s_Sql_Find1 = " SELECT A.id_rigaDocumento FROM RIGA_DOCUMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento INNER JOIN RIGA_DOCUMENTO_P_M AS C ON A.id_rigaDocumento = C.id_rigaDocumentoPrelevata "; + WcString wc = new WcString(); + wc.addWc(" B.id_tipoDocumento = " + getParm("ID_DOC_ORDINE").getNumeroLong()); + wc.addWc(" Z.id_articolo = " + getId_articolo()); + if (getId_articoloVariante() != 0L) { + wc.addWc(" Z.id_articoloVariante = " + getId_articoloVariante()); + } else { + wc.addWc(" (Z.id_articoloVariante = 0 OR Z.id_articoloVariante IS NULL)"); + } + WcString wc1 = new WcString(); + wc1.addWc(" B.id_tipoDocumento = " + getParm("ID_DOC_PRENOTAZIONE").getNumeroLong()); + wc1.addWc(" A.id_articolo = " + getId_articolo()); + if (getId_articoloVariante() != 0L) { + wc1.addWc(" A.id_articoloVariante = " + getId_articoloVariante()); + } else { + wc1.addWc(" (A.id_articoloVariante = 0 OR A.id_articoloVariante IS NULL)"); + } + wc1.addWc(" (B.flgStatoPrenotazione = 0 OR B.flgStatoPrenotazione = 200 OR B.flgStatoPrenotazione = 20 OR B.flgStatoPrenotazione = 10 OR B.flgStatoPrenotazione IS NULL)"); + wc1.addWc("(A.flgRigaPrelevata is null or A.flgRigaPrelevata=0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + " AND C.id_rigaDocumentoPrelevata IN (" + + wc.toString() + s_Sql_Find1 + ")"); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public double getQtaOrdiniApertiPrenotazioni() { + String s_Sql_Find = "select SUM(Z.quantita - Z.quantitaPrelevata) AS _sum FROM RIGA_DOCUMENTO AS Z INNER JOIN DOCUMENTO AS B ON Z.id_documento = B.id_documento INNER JOIN RIGA_DOCUMENTO_P_M AS C ON Z.id_rigaDocumento = C.id_rigaDocumento "; + String s_Sql_Find1 = " SELECT A.id_rigaDocumento FROM RIGA_DOCUMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento INNER JOIN RIGA_DOCUMENTO_P_M AS C ON A.id_rigaDocumento = C.id_rigaDocumentoPrelevata "; + WcString wc = new WcString(); + wc.addWc(" B.id_tipoDocumento = " + getParm("ID_DOC_ORDINE").getNumeroLong()); + wc.addWc(" Z.id_articolo = " + getId_articolo()); + if (getId_articoloVariante() != 0L) { + wc.addWc(" Z.id_articoloVariante = " + getId_articoloVariante()); + } else { + wc.addWc(" (Z.id_articoloVariante = 0 OR Z.id_articoloVariante IS NULL)"); + } + WcString wc1 = new WcString(); + wc1.addWc(" B.id_tipoDocumento = " + getParm("ID_DOC_PRENOTAZIONE").getNumeroLong()); + wc1.addWc(" A.id_articolo = " + getId_articolo()); + if (getId_articoloVariante() != 0L) { + wc1.addWc(" A.id_articoloVariante = " + getId_articoloVariante()); + } else { + wc1.addWc(" (A.id_articoloVariante = 0 OR A.id_articoloVariante IS NULL)"); + } + wc1.addWc(" (B.flgStatoPrenotazione = 0 OR B.flgStatoPrenotazione = 200 OR B.flgStatoPrenotazione = 20 OR B.flgStatoPrenotazione = 10 OR B.flgStatoPrenotazione IS NULL)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + " AND C.id_rigaDocumentoPrelevata IN (" + + wc.toString() + s_Sql_Find1 + ")"); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public boolean hasQtaOrdinata() { + if (getDocumento().getTipoDocumento().getFlgTipologia() == 4L) { + double[] res = getQtaOrdinataPrelevataByRigaPrenotazione(); + double qtOrd = res[0]; + if (qtOrd > 0.0D) + return true; + return false; + } + return false; + } + + public Documento getDocumentoPrenotazione() { + if (getId_rigaDocumento() != 0L && getDocumento().getTipoDocumento().getFlgTipologia() == 3L) { + RigaDocumentoPM rdPm = new RigaDocumentoPM(getApFull()); + rdPm.findByRigaDocumento(getId_rigaDocumento()); + return rdPm.getRigaDocumentoPrelevata().getDocumento(); + } + return new Documento(getApFull()); + } + + public double getKg() { + return this.kg; + } + + public void setKg(double kg) { + this.kg = kg; + } + + public double getMt() { + return this.mt; + } + + public void setMt(double mt) { + this.mt = mt; + } + + public double getNr() { + return this.nr; + } + + public void setNr(double nr) { + this.nr = nr; + } + + public static synchronized ResParm aggiornaMovimento(RigaDocumento bean) { + ResParm rp = new ResParm(true); + if (bean.getArticolo().getTipo().getFlgTipoMagazzino() == 0L || + bean.getArticolo().getTipo().getFlgTipoMagazzino() == 9L) + return rp; + if (bean.getId_articolo() != 0L) { + long magPartenza = 0L; + long magArrivo = 0L; + long flgInternoPartenza = 0L; + long flgInternoArrivo = 0L; + if (bean.getDocumento().getId_magFisicoPartenza() == 0L) { + if (bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoPartenza() > 0L) { + magPartenza = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoPartenza(); + flgInternoPartenza = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getMagFisicoPartenza().getFlgTipo(); + } + } else { + magPartenza = bean.getDocumento().getId_magFisicoPartenza(); + flgInternoPartenza = bean.getDocumento().getMagFisicoPartenza().getFlgTipo(); + } + if (bean.getDocumento().getId_magFisicoArrivo() == 0L) { + if (bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo() > 0L) { + magArrivo = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo(); + flgInternoArrivo = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getMagFisicoArrivo().getFlgTipo(); + } + } else { + magArrivo = bean.getDocumento().getId_magFisicoArrivo(); + flgInternoArrivo = bean.getDocumento().getMagFisicoArrivo().getFlgTipo(); + } + cancellaMovimento(bean, magPartenza, magArrivo); + if (magPartenza != 0L || magArrivo != 0L) + Movimento movimento = new Movimento(bean.getApFull()); + if (magPartenza != 0L) { + Movimento mov = new Movimento(bean.getApFull()); + mov.setId_rigaDocumento(bean.getId_rigaDocumento()); + mov.setId_articolo(bean.getId_articolo()); + mov.setId_articoloVariante(bean.getId_articoloVariante()); + mov.setId_articoloTaglia(bean.getId_articoloTaglia()); + mov.setSeriale(bean.getSeriale()); + mov.setId_causaleMagazzino(bean.getDocumento().getTipoDocumento().getId_causaleMagazzino()); + if (bean.getFlgReso() == 1L) { + mov.setKg(bean.getKg()); + mov.setMt(bean.getMt()); + mov.setNr(bean.getNr()); + } else { + mov.setKg(-1.0D * bean.getKg()); + mov.setMt(-1.0D * bean.getMt()); + mov.setNr(-1.0D * bean.getNr()); + } + mov.setId_magFisico(magPartenza); + if (flgInternoPartenza == 1L) { + mov.setId_clifor(0L); + } else { + mov.setId_clifor(bean.getDocumento().getId_clifor()); + } + rp = mov.save(); + } + if (magArrivo != 0L) { + Movimento mov = new Movimento(bean.getApFull()); + mov.setId_rigaDocumento(bean.getId_rigaDocumento()); + mov.setId_articolo(bean.getId_articolo()); + mov.setId_articoloVariante(bean.getId_articoloVariante()); + mov.setId_articoloTaglia(bean.getId_articoloTaglia()); + mov.setSeriale(bean.getSeriale()); + mov.setId_causaleMagazzino(bean.getDocumento().getTipoDocumento().getId_causaleMagazzino()); + if (bean.getFlgReso() == 0L) { + mov.setKg(bean.getKg()); + mov.setMt(bean.getMt()); + mov.setNr(bean.getNr()); + } else { + mov.setKg(-1.0D * bean.getKg()); + mov.setMt(-1.0D * bean.getMt()); + mov.setNr(-1.0D * bean.getNr()); + } + mov.setId_magFisico(magArrivo); + if (flgInternoArrivo == 1L) { + mov.setId_clifor(0L); + } else { + mov.setId_clifor(bean.getDocumento().getId_clifor()); + } + rp.append(mov.save()); + } + } + return rp; + } + + public static synchronized ResParm cancellaMovimento(RigaDocumento bean, long l_id_magazzinoPartenza, long l_id_magazzinoArrivo) { + ResParm rp = new ResParm(true); + Movimento mov = new Movimento(bean.getApFull()); + Vectumerator vec = mov.findByRigaDocumento(bean.getId_rigaDocumento()); + if (l_id_magazzinoPartenza == 0L && l_id_magazzinoArrivo == 0L) { + while (vec.hasMoreElements()) { + mov = (Movimento)vec.nextElement(); + rp.append(mov.delete()); + } + } else { + while (vec.hasMoreElements()) { + mov = (Movimento)vec.nextElement(); + if (mov.getId_magFisico() == l_id_magazzinoPartenza || mov.getId_magFisico() == l_id_magazzinoArrivo) + rp.append(mov.delete()); + } + } + return rp; + } + + public double getQuantitaTotaleByDocumento(long l_id_documento) { + String s_Sql_Find = "select sum(quantita) AS _sum from RIGA_DOCUMENTO AS A"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public String getQuantitaMagazzinoMovimentoHtml() { + if (getId_articoloVariante() > 0L) + return getArticoloVariante().getQuantitaMagazzinoMovimentoHtml(); + if (getId_articolo() > 0L) + return getArticolo().getQuantitaMagazzinoMovimentoHtml(); + if (getId_articoloFilatoColore() > 0L) + return getArticoloFilatoColore().getQuantitaMagazzinoMovimentoHtml(); + if (getId_articoloTessutoColore() > 0L) + return getArticoloTessutoColore().getQuantitaMagazzinoMovimentoHtml(); + if (getId_articoloTessuto() > 0L) + return getArticoloTessuto().getQuantitaMagazzinoMovimentoHtml(); + return ""; + } + + public double getQuantitaEffettiva() { + if (getId_articoloVariante() > 0L) + return getArticoloVariante().getQuantitaEffettivaAv(); + if (getId_articolo() > 0L) + return getArticolo().getQuantitaEffettiva(); + if (getId_articoloFilatoColore() > 0L) + return getArticoloFilatoColore().getQuantitaEffettiva(); + if (getId_articoloTessutoColore() > 0L) + return getArticoloTessutoColore().getQuantitaEffettiva(); + if (getId_articoloTessuto() > 0L) + return getArticoloTessuto().getQuantitaEffettiva(); + return 0.0D; + } + + public double getQuantitaImpegnata() { + if (getId_articoloVariante() > 0L) + return getArticoloVariante().getQuantitaImpegnataAv(); + if (getId_articolo() > 0L) + return getArticolo().getQuantitaImpegnata(); + if (getId_articoloFilatoColore() > 0L) + return getArticoloFilatoColore().getQuantitaImpegnata(); + if (getId_articoloTessutoColore() > 0L) + return getArticoloTessutoColore().getQuantitaImpegnata(); + if (getId_articoloTessuto() > 0L) + return getArticoloTessuto().getQuantitaImpegnata(); + return 0.0D; + } + + public double getQuantitaInArrivo() { + if (getId_articoloVariante() > 0L) + return getArticoloVariante().getQuantitaInArrivoAv(); + if (getId_articolo() > 0L) + return getArticolo().getQuantitaInArrivo(); + if (getId_articoloFilatoColore() > 0L) + return getArticoloFilatoColore().getQuantitaInArrivo(); + if (getId_articoloTessutoColore() > 0L) + return getArticoloTessutoColore().getQuantitaInArrivo(); + if (getId_articoloTessuto() > 0L) + return getArticoloTessuto().getQuantitaInArrivo(); + return 0.0D; + } + + public ResParm aggiornaMovimentoPareggioRigaPrelevata() { + ResParm rp = new ResParm(true); + try { + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.getMagQuantitaPrelevatoByRigaDocumentoPrelevata(getId_rigaDocumento()); + double tot = rd.getQuantita(); + if (getDocumento().getId_tipoDocumento() == getId_docOrdine() && getQuantita() > tot) { + long id_causale_storno = getParm("STORNO_ORDINE_A_FORNITORE").getNumeroLong(); + DoubleOperator dp = new DoubleOperator(getQuantita()); + dp.subtract(tot); + double qtaDaPrelevare = dp.getResult(); + RigaDocumento rdStorno = new RigaDocumento(getApFull()); + rdStorno.findMagByRigaDocumentoCausale(getId_rigaDocumento(), id_causale_storno); + if (rdStorno.getId_rigaDocumento() == 0L) { + rdStorno = (RigaDocumento)clone(); + rdStorno.setId_rigaDocumento(0L); + rdStorno.setDBState(0); + } + rdStorno.setId_rigaDocumentoMov(getId_rigaDocumento()); + rdStorno.setId_causaleMagazzino(id_causale_storno); + rdStorno.setSegnoMov(getSegnoMov() * -1L); + rdStorno.setSeriale(getSeriale()); + if (getArticolo().getTipologiaArticolo().getFlgUdm() == 1L) { + rdStorno.setNr(qtaDaPrelevare); + } else if (getArticolo().getTipologiaArticolo().getFlgUdm() == 3L) { + rdStorno.setMt(qtaDaPrelevare); + } else if (getArticolo().getTipologiaArticolo().getFlgUdm() == 2L) { + rdStorno.setKg(qtaDaPrelevare); + } + rp = rdStorno.saveMov(); + } + } catch (Exception e) { + rp.setException(e); + } + return rp; + } + + public ResParm aggiornaMovimentoPareggioRigaPrelevataM() { + ResParm rp = new ResParm(true); + RigaDocumentoP rdp = new RigaDocumentoP(getApFull()); + double tot = rdp.getQuantitaPrelevatoByRigaDocumentoPrelevata(getId_rigaDocumento()); + if (getDocumento().getId_tipoDocumento() == getId_docOrdine() && getQuantita() > tot) { + long id_causale_storno = getParm("STORNO_ORDINE_A_FORNITORE").getNumeroLong(); + DoubleOperator dp = new DoubleOperator(getQuantita()); + dp.subtract(tot); + dp.multiply(-1); + double qtaDaPrelevare = dp.getResult(); + CausaleMagazzino cm = new CausaleMagazzino(getApFull()); + cm.findByPrimaryKey(id_causale_storno); + Movimento mov = new Movimento(getApFull()); + mov.findByRigaDocumentoCausale(getId_rigaDocumento(), id_causale_storno); + mov.setId_rigaDocumento(getId_rigaDocumento()); + mov.setId_articolo(getId_articolo()); + mov.setId_articoloVariante(getId_articoloVariante()); + mov.setId_articoloTaglia(getId_articoloTaglia()); + mov.setId_causaleMagazzino(id_causale_storno); + mov.setSeriale(getSeriale()); + if (getArticolo().getTipologiaArticolo().getFlgUdm() == 1L) { + mov.setNr(qtaDaPrelevare); + } else if (getArticolo().getTipologiaArticolo().getFlgUdm() == 3L) { + mov.setMt(qtaDaPrelevare); + } else if (getArticolo().getTipologiaArticolo().getFlgUdm() == 2L) { + mov.setKg(qtaDaPrelevare); + } + mov.setId_magFisico(cm.getId_magFisicoPartenza()); + if (cm.getMagFisicoPartenza().getFlgTipo() == 1L) { + mov.setId_clifor(0L); + } else { + mov.setId_clifor(getDocumento().getId_clifor()); + } + rp = mov.save(); + } + return rp; + } + + public Vectumerator findAllPerRiordinoMagazzino(long l_id_articolo, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A, DOCUMENTO AS B, TIPO_DOCUMENTO AS C"; + String s_Sql_Order = " order by B.dataDocumento asc,B.id_esercizio, A.id_documento"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("B.id_tipoDocumento=C.id_tipoDocumento"); + wc.addWc("(A.id_rigaDocumentoMov=0 or A.id_rigaDocumentoMov is null)"); + if (l_id_articolo != 0L) { + wc.addWc("A.id_articolo=" + l_id_articolo); + } else { + wc.addWc("A.id_articolo >0"); + } + wc.addWc("C.id_causaleMagazzino >0"); + try { + PreparedStatement stmt; + if (pageRows == 0 && pageNumber == 0) { + stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + } else { + int partenza = pageRows * (pageNumber - 1); + stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + " limit " + s_Sql_Order + " , " + partenza); + } + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void setQuantitaUdm(double qta) { + if (getArticolo().getTipologiaArticolo().getFlgUdm() == 1L) { + setNr(qta); + } else if (getArticolo().getTipologiaArticolo().getFlgUdm() == 2L) { + setKg(qta); + } else if (getArticolo().getTipologiaArticolo().getFlgUdm() == 3L) { + setMt(qta); + } else { + setNr(qta); + } + } + + public double getRigheAssociateSeriali(RigaDocumentoCR CR) { + StringBuffer s_Sql_Find = new StringBuffer("select COUNT(*) as _sum from RIGA_DOCUMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento=B.id_documento "); + s_Sql_Find.append(" INNER JOIN TIPO_DOCUMENTO AS C ON B.id_tipoDocumento=C.id_tipoDocumento "); + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + findByCRCreateStmtDate(CR, stmt); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public long getQtaSlipStampate() { + return this.qtaSlipStampate; + } + + public void setQtaSlipStampate(long qtaSlipStampate) { + this.qtaSlipStampate = qtaSlipStampate; + } + + public void checkStatoRigaQta(double[] stati) { + stati[0] = 0.0D; + stati[1] = 0.0D; + DoubleOperator qtaEffettiva = new DoubleOperator(); + DoubleOperator qtaMagazzino = new DoubleOperator(); + if (getFlgRigaPrelevata() == 1L) { + stati[0] = 40.0D; + } else if (getId_articolo() != 0L || getId_articoloVariante() != 0L) { + if (!getSeriale().isEmpty()) { + stati[0] = 30.0D; + } else { + RigaDocumentoCR CR = new RigaDocumentoCR(); + CR.setFlgTipologia(4L); + CR.setFlgStatoPrenotazione(200L); + CR.setId_articolo(getId_articolo()); + CR.setId_articoloVariante(getId_articoloVariante()); + CR.setFlgTipoRicerca(0L); + CR.setFlgOrderBy(5L); + CR.setFlgRigaPrelevata(0L); + if (getId_articoloVariante() != 0L) { + qtaEffettiva.add(getArticoloVariante().getQuantitaInArrivoAv()); + qtaEffettiva.add(getArticoloVariante().getQuantitaAv()); + qtaMagazzino.add(getArticoloVariante().getQuantitaAv()); + } else if (getId_articolo() != 0L) { + qtaEffettiva.add(getArticolo().getQuantitaInArrivo()); + qtaEffettiva.add(getArticolo().getQuantita()); + qtaMagazzino.add(getArticolo().getQuantita()); + } + CR.setFlgNoSeriale(2L); + double qtAssociata = getRigheAssociateSeriali(CR); + double qtMagazzino = getQtaPrelevataPrenotazioni(); + qtaEffettiva.subtract(qtAssociata); + qtaEffettiva.subtract(getQtaOrdiniApertiPrenotazioni()); + qtaEffettiva.subtract(qtMagazzino); + qtaMagazzino.subtract(qtMagazzino); + qtaMagazzino.subtract(qtAssociata); + if (qtaEffettiva.getResult() >= 0.0D) { + CR.setFlgNoSeriale(1L); + Vectumerator vec = findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + double[] res = row.getQtaOrdinataPrelevataByRigaPrenotazione(); + double qtOrd = res[0]; + double qtPrel = res[1]; + double qtPrenoParziale = row.getQuantita(); + if (qtPrel >= qtPrenoParziale) { + stati[0] = 30.0D; + qtPrenoParziale = 0.0D; + } else if (qtPrel > 0.0D) { + stati[0] = 20.0D; + DoubleOperator dop = new DoubleOperator(qtPrenoParziale); + dop.subtract(qtPrel); + qtPrenoParziale = dop.getResult(); + } else if (qtOrd >= qtPrenoParziale) { + stati[0] = 10.0D; + qtPrenoParziale = 0.0D; + } else if (qtOrd > 0.0D) { + stati[0] = 15.0D; + DoubleOperator dop = new DoubleOperator(qtPrenoParziale); + dop.subtract(qtOrd); + qtPrenoParziale = dop.getResult(); + } + if (row.getId_rigaDocumento() == getId_rigaDocumento()) { + if (stati[0] == 30.0D || stati[0] == 10.0D) + break; + if (qtaMagazzino.getResult() >= qtPrenoParziale) { + if (stati[0] == 15.0D || stati[0] == 10.0D) { + stati[0] = 20.0D; + stati[1] = qtPrenoParziale; + break; + } + stati[0] = 30.0D; + stati[1] = qtPrenoParziale; + break; + } + if (qtaMagazzino.getResult() > 0.0D) { + stati[0] = 20.0D; + stati[1] = qtaMagazzino.getResult(); + break; + } + if (qtaEffettiva.getResult() >= qtPrenoParziale) { + stati[0] = 10.0D; + break; + } + if (qtaEffettiva.getResult() > 0.0D) { + stati[0] = 15.0D; + break; + } + break; + } + qtaEffettiva.subtract(qtPrenoParziale); + qtaMagazzino.subtract(qtPrenoParziale); + stati[0] = 0.0D; + } + } + } + } + } + + public Vectumerator findByDocumento(long l_id_documento, long l_flgCodiceRiga, String l_search, int pageNumber, int pageRows, int ordinamentoRiga) { + RigaDocumentoCR CR = new RigaDocumentoCR(getApFull()); + CR.setId_documento(l_id_documento); + CR.setFlgCodiceRiga(l_flgCodiceRiga); + CR.setSearchTxt(l_search); + return findByDocumento(CR, pageNumber, pageRows, ordinamentoRiga); + } + + public Vectumerator findByDocumentoOLD(long l_id_documento, long l_flgCodiceRiga, String l_search, int pageNumber, int pageRows, boolean ordineInverso) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A left join ARTICOLO AS B on A.id_articolo=B.id_articolo "; + String s_Sql_order = " order by A.id_rigaDocumento desc"; + if (!ordineInverso) + s_Sql_order = " order by A.id_rigaDocumento asc"; + WcString wc = new WcString(); + wc.addWc("(A.id_rigaDocumentoMov=0 or A.id_rigaDocumentoMov is null)"); + wc.addWc("A.id_documento=" + l_id_documento); + if (l_flgCodiceRiga == 0L) { + wc.addWc("(A.flgCodiceRiga is null or A.flgCodiceRiga=0)"); + } else if (l_flgCodiceRiga > 0L) { + wc.addWc("A.flgCodiceRiga=" + l_flgCodiceRiga); + } + if (!l_search.isEmpty()) { + String star = ""; + String temp = l_search; + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("(B.codice like '" + token + "%' or A.seriale like '" + token + "' or A.descrizioneRiga like '" + token + "%' )"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByDocumento(RigaDocumentoCR CR, int pageNumber, int pageRows, int ordinamentoRiga) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A left join ARTICOLO AS B on A.id_articolo=B.id_articolo "; + String s_Sql_order = " order by A.ordine, A.id_rigaDocumento asc"; + if (ordinamentoRiga == 1) { + s_Sql_order = " order by A.ordine desc,A.id_rigaDocumento desc"; + } else if (ordinamentoRiga == 2) { + s_Sql_order = " order by A.descrizioneRiga asc"; + } else if (ordinamentoRiga == 3) { + s_Sql_order = " order by A.descrizioneRigaRaggruppamento asc, A.descrizioneRigaDettaglio, A.descrizioneRiga"; + } else if ((long)ordinamentoRiga == 10L) { + s_Sql_Find = s_Sql_Find + " INNER join DOCUMENTO AS D ON D.id_documento=A.id_documentoPadre"; + s_Sql_order = " order by D.riferimento, A.id_rigaDocumentoPadre, A.descrizioneRigaDettaglio, A.descrizioneRiga"; + } + WcString wc = new WcString(); + wc.addWc("(A.id_rigaDocumentoMov=0 or A.id_rigaDocumentoMov is null)"); + wc.addWc("A.id_documento=" + CR.getId_documento()); + if (CR.getFlgCodiceRiga() == 0L) { + wc.addWc("(A.flgCodiceRiga is null or A.flgCodiceRiga=0)"); + } else if (CR.getFlgCodiceRiga() > 0L) { + wc.addWc("A.flgCodiceRiga=" + CR.getFlgCodiceRiga()); + } + if (CR.getFlgStatoLavorazioneRiga() == 0L) { + wc.addWc("(A.flgStatoLavorazioneRiga is null or A.flgStatoLavorazioneRiga=0)"); + } else if (CR.getFlgStatoLavorazioneRiga() > 0L) { + wc.addWc("A.flgStatoLavorazioneRiga=" + CR.getFlgStatoLavorazioneRiga()); + } else if (CR.getFlgStatoLavorazioneRiga() == -1L) { + wc.addWc("(A.flgStatoLavorazioneRiga=0 is null or A.flgStatoLavorazioneRiga=0 or A.flgStatoLavorazioneRiga=20 or A.flgStatoLavorazioneRiga=10 ) "); + } + if (!CR.getSearchTxt().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("(B.codice like '" + token + "%' or A.seriale like '" + token + "' or A.descrizioneRiga like '" + token + "%' )"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByDocumentoArticoloArticoloVariante(long l_id_documento, long l_id_articolo, long l_id_articoloVariante) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A left join ARTICOLO AS B on A.id_articolo=B.id_articolo "; + String s_Sql_order = " order by A.id_rigaDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + if (l_id_articolo == 0L) { + wc.addWc("(A.id_articolo is null or A.id_articolo=0)"); + } else { + wc.addWc("A.id_articolo=" + l_id_articolo); + } + if (l_id_articoloVariante == 0L) { + wc.addWc("(A.id_articoloVariante is null or A.id_articoloVariante=0)"); + } else { + wc.addWc("A.id_articoloVariante=" + l_id_articoloVariante); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByDocumentoArticoloArticoloVarianteTaglia(long l_id_documento, long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A "; + String s_Sql_order = " order by A.id_rigaDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + if (l_id_articolo == 0L) { + wc.addWc("(A.id_articolo is null or A.id_articolo=0)"); + } else { + wc.addWc("A.id_articolo=" + l_id_articolo); + } + if (l_id_articoloVariante == 0L) { + wc.addWc("(A.id_articoloVariante is null or A.id_articoloVariante=0)"); + } else { + wc.addWc("A.id_articoloVariante=" + l_id_articoloVariante); + } + if (l_id_articoloTaglia == 0L) { + wc.addWc("(A.id_articoloTaglia is null or A.id_articoloTaglia=0)"); + } else { + wc.addWc("A.id_articoloTaglia=" + l_id_articoloTaglia); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 0); + } + } + + public void findByDocumentoArticoloTessutoColore(long l_id_documento, long l_id_articoloTessutoColore, long l_flgCodiceRiga) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A "; + String s_Sql_order = " order by A.id_rigaDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + wc.addWc("A.flgCodiceRiga=" + l_flgCodiceRiga); + wc.addWc("A.id_articoloTessutoColore=" + l_id_articoloTessutoColore); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 0); + } + } + + public void findByDocumentoArticoloTessuto(long l_id_documento, long l_id_articoloTessuto, long l_flgCodiceRiga) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A "; + String s_Sql_order = " order by A.id_rigaDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + wc.addWc("A.flgCodiceRiga=" + l_flgCodiceRiga); + wc.addWc("A.id_articoloTessuto=" + l_id_articoloTessuto); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 0); + } + } + + public long getStatoPrenotazione() { + if (getDocumento().getId_tipoDocumento() == getId_docPrenotazione()) + if (this.statoPrenotazione == -1L) { + this.statoPrenotazione = checkStatoRiga(); + super.save(); + } + return this.statoPrenotazione; + } + + public void setStatoPrenotazione(long statoPrenotazione) { + this.statoPrenotazione = statoPrenotazione; + } + + public ResParm resetStatoPrenotazioneByArticolo(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia) { + String s_sql_update = "update RIGA_DOCUMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento= B.id_documento SET statoPrenotazione=-1 "; + WcString wc = new WcString(); + wc.addWc("B.id_tipoDocumento=" + getId_docPrenotazione()); + if (l_id_articolo > 0L) + wc.addWc("A.id_articolo=" + l_id_articolo); + if (l_id_articoloVariante > 0L) + wc.addWc("A.id_articoloVariante=" + l_id_articoloVariante); + if (l_id_articoloTaglia > 0L) + wc.addWc("A.id_articoloTaglia=" + l_id_articoloTaglia); + ResParm rp = update(s_sql_update + s_sql_update); + return rp; + } + + public String getStatoRiga() { + return getStatoRiga(getStatoPrenotazione()); + } + + public void findRigaImpegnoBySeriale(long l_id_articolo, long l_id_articoloVariante, String l_seriale) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A , DOCUMENTO AS B "; + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + if (l_id_articoloVariante == 0L) { + wc.addWc("(A.id_articoloVariante=0 or A.id_articoloVariante is null)"); + } else { + wc.addWc("A.id_articoloVariante=" + l_id_articoloVariante); + } + wc.addWc("A.id_articolo=" + l_id_articolo); + wc.addWc("A.seriale='" + l_seriale + "'"); + wc.addWc("B.id_tipoDocumento=" + getId_docPrenotazione()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 0); + } + } + + public double getQuantitaMovimentoMagazzino() { + if (getDocumento().getTipoDocumento().getCausaleMagazzino().getMagFisicoArrivo() + .getFlgTipo() == 3L || + getDocumento().getTipoDocumento().getCausaleMagazzino().getMagFisicoPartenza() + .getFlgTipo() == 3L) + return 0.0D; + if (getArticolo().getTipo().getFlgTipoMagazzino() > 0L && + getArticolo().getTipo().getFlgTipoMagazzino() < 9L) { + if (getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoPartenza() > 0L) + return -getQuantita(); + if (getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo() > 0L) + return getQuantita(); + return 0.0D; + } + return 0.0D; + } + + public long findAllPerRiordinoMagazzinoTot(long l_id_articolo) { + String s_Sql_Find = "select COUNT(*) AS _tot from RIGA_DOCUMENTO AS A, DOCUMENTO AS B, TIPO_DOCUMENTO AS C"; + String s_Sql_Order = " order by B.dataDocumento asc,B.id_esercizio, A.id_documento"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("B.id_tipoDocumento=C.id_tipoDocumento"); + wc.addWc("(A.id_rigaDocumentoMov=0 or A.id_rigaDocumentoMov is null)"); + if (l_id_articolo != 0L) { + wc.addWc("A.id_articolo=" + l_id_articolo); + } else { + wc.addWc("A.id_articolo >0"); + } + wc.addWc("C.id_causaleMagazzino >0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return getCount(stmt, "_tot"); + } catch (SQLException e) { + handleDebug(e); + return 0L; + } + } + + public ResParm settaRigaPrelevata() { + if (getId_rigaDocumento() > 0L) { + setFlgRigaPrelevata(1L); + ResParm rp = super.save(); + if (rp.getStatus()) { + rp.append(aggiornaMovimentoPareggioRigaPrelevataM()); + rp.append(aggiornaMovimentoPareggioRigaPrelevata()); + getArticolo().resetCalcoloQuantita(); + } + return rp; + } + return new ResParm(false, "ERRORE! Tentativo di annullare una riga prelevata su una rigq inesistente!"); + } + + public ResParm annullaRigaPrelevata() { + if (getId_rigaDocumento() > 0L) { + setFlgRigaPrelevata(0L); + ResParm rp = synchroSave(this); + if (rp.getStatus()) { + RigaDocumento rdStorno = new RigaDocumento(getApFull()); + long id_causale_storno = getParm("STORNO_ORDINE_A_FORNITORE").getNumeroLong(); + rdStorno.findMagByRigaDocumentoCausale(getId_rigaDocumento(), id_causale_storno); + if (rdStorno.getId_rigaDocumento() != 0L) + rdStorno.deleteMov(); + rp = aggiornaDispo(); + } + return rp; + } + return new ResParm(false, "ERRORE! Tentativo di annullare una riga prelevata su una rigq inesistente!"); + } + + public Vectumerator findRigheNonPrelevateByDocumento(long l_id_documento) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A "; + String s_Sql_order = " order by A.id_rigaDocumento"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + wc.addWc("A.flgRigaPrelevata=0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findRigheNonPrelevatePreChiusuraByDocumento(long l_id_documento) { + String s_Sql_Find = "SELECT * FROM RIGA_DOCUMENTO AS A LEFT JOIN RIGA_DOCUMENTO_P AS B ON A.id_rigaDocumento = B.id_rigaDocumentoPrelevata"; + String s_Sql_order = " order by A.id_rigaDocumento"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + wc.addWc("B.id_rigaDocumento IS NULL"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findOrdiniByArticolo(long l_id_articolo) { + String s_Sql_Find = "SELECT A.id_documento, SUM(B.nr) AS nr FROM DOCUMENTO AS A INNER JOIN RIGA_DOCUMENTO AS B ON A.id_documento = B.id_documento "; + String s_Sql_GroupBy = " GROUP BY A.id_documento"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" B.id_articolo = " + l_id_articolo); + wc.addWc(" A.id_tipoDocumento = 8 "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Order); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findMovimentiDiCaricoByArticoloDocumento(long l_id_articolo, long l_id_documento) { + String s_Sql_Find = "SELECT E.id_documento, D.id_magFisico AS id_magFisico, SUM(D.nr) AS nr FROM RIGA_DOCUMENTO_P AS A LEFT JOIN RIGA_DOCUMENTO AS B ON A.id_rigadocumentoPrelevata = B.id_rigaDocumento LEFT JOIN DOCUMENTO AS C ON B.id_documento = C.id_documento LEFT JOIN MOVIMENTO AS D ON A.id_rigadocumento = D.id_rigaDocumento LEFT JOIN RIGA_DOCUMENTO AS E ON D.id_rigadocumento = E.id_rigadocumento "; + String s_Sql_GroupBy = " GROUP BY E.id_documento, D.id_magFisico"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" B.id_articolo = " + l_id_articolo); + wc.addWc(" C.id_documento = " + l_id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Order); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findDettaglioBollaByArticoloDocumento(long l_id_articolo, long l_id_documento) { + String s_Sql_Find = "SELECT COUNT(B.id_movimento) AS nr, A.id_rigaDocumento, A.id_documento FROM RIGA_DOCUMENTO AS A LEFT JOIN MOVIMENTO AS B ON A.id_rigadocumento = B.id_rigaDocumento "; + String s_Sql_GroupBy = " GROUP BY A.id_rigaDocumento"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_articolo = " + l_id_articolo); + wc.addWc(" A.id_documento = " + l_id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Order); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findOrdiniAFornitoreAperti() { + return findOrdiniAFornitoreAperti(0L); + } + + public Vectumerator findOrdiniAFornitoreAperti(long id_articolo) { + String s_Sql_Find = "SELECT SUM(A.nr) AS nr, A.id_articolo, A.id_articoloVariante, A.id_articoloTaglia FROM RIGA_DOCUMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento "; + String s_Sql_GroupBy = " GROUP BY A.id_articolo"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (id_articolo > 0L) + wc.addWc(" A.id_articolo = " + id_articolo); + wc.addWc(" B.id_tipoDocumento = 8 "); + wc.addWc(" (B.flgDocumentoPrelevato = 0 OR B.flgDocumentoPrelevato IS NULL) "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Order); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findOrdiniAFornitoreChiusi() { + String s_Sql_Find = "SELECT SUM(A.nr) AS nr, A.id_articolo, A.id_articoloVariante, A.id_articoloTaglia FROM RIGA_DOCUMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento "; + String s_Sql_GroupBy = " GROUP BY A.id_articolo"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" B.id_tipoDocumento = 8 "); + wc.addWc(" B.flgDocumentoPrelevato = 1 "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Order); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getQtaSaldoMovimento(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia) { + System.out.println("Rigadocumento.getQtaSaldoMovimento !!!!!!"); + if (this.qtaSaldoMovimento == 0.0D) { + Movimento mov = new Movimento(getApFull()); + setQtaSaldoMovimento( + mov.getSaldoByArticoloVarianteTagliaMagazzino(l_id_articolo, l_id_articoloVariante, l_id_articoloTaglia, 5L)); + } + return this.qtaSaldoMovimento; + } + + public void setQtaSaldoMovimento(double qtaSaldoMovimento) { + this.qtaSaldoMovimento = qtaSaldoMovimento; + } + + public void importMovimentoOrdiniAFornitore() { + long i = 0L; + String sql = "DELETE FROM MOVIMENTO WHERE id_magFisico = 5"; + delete(sql); + sql = "UPDATE ARTICOLO SET quantitaCalcolate=false"; + update(sql); + String s_Sql_Find = "SELECT A.* FROM RIGA_DOCUMENTO AS A INNER JOIN DOCUMENTO AS B ON A.id_documento = B.id_documento "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" B.id_tipoDocumento = 8 "); + wc.addWc(" (B.flgDocumentoPrelevato = 0 OR B.flgDocumentoPrelevato IS NULL) "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + MagFisico mf = new MagFisico(getApFull()); + mf.findMagazzinoOrdinato(); + Vectumerator vec = findRows(stmt, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumento rd = (RigaDocumento)vec.nextElement(); + Movimento mov = new Movimento(getApFull()); + mov.setId_articolo(rd.getId_articolo()); + mov.setId_articoloVariante(rd.getId_articoloVariante()); + mov.setId_articoloTaglia(rd.getId_articoloTaglia()); + mov.setId_clifor(rd.getDocumento().getId_clifor()); + mov.setId_magFisico(mf.getId_magFisico()); + mov.setId_causaleMagazzino(7L); + mov.setId_rigaDocumento(rd.getId_rigaDocumento()); + mov.setNr(rd.getQuantita()); + mov.save(); + Vectumerator vecRdp = new RigaDocumentoP(getApFull()).findByRigaDocumentoPrelevata(rd.getId_rigaDocumento(), 0, 0); + while (vecRdp.hasMoreElements()) { + RigaDocumentoP rdp = (RigaDocumentoP)vecRdp.nextElement(); + rd = rdp.getRigaDocumento(); + mov = new Movimento(getApFull()); + mov.setId_articolo(rd.getId_articolo()); + mov.setId_articoloVariante(rd.getId_articoloVariante()); + mov.setId_articoloTaglia(rd.getId_articoloTaglia()); + mov.setId_clifor(rd.getDocumento().getId_clifor()); + mov.setId_magFisico(mf.getId_magFisico()); + mov.setId_causaleMagazzino(2L); + mov.setId_rigaDocumento(rd.getId_rigaDocumento()); + mov.setNr(-1.0D * rd.getQuantita()); + mov.save(); + } + i++; + System.out.println("Riga " + i + " di " + vec.size()); + } + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findVenditeServizi(DocumentoCR CR) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A, DOCUMENTO AS B, ARTICOLO AS C, TIPO AS D, REPARTO AS E, TIPO_DOCUMENTO AS ZZ "; + String s_Sql_Order = " order by A.id_articolo, B.dataDocumento, E.descrizione, D.descrizione, A.descrizioneRiga, A.notaBarcode "; + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("A.id_articolo=C.id_articolo"); + wc.addWc("C.id_tipo=D.id_tipo"); + wc.addWc("A.id_reparto=E.id_reparto"); + wc.addWc("B.id_tipoDocumento = ZZ.id_tipoDocumento"); + wc.addWc("(B.flgHaDocumentoPadre IS NULL OR B.flgHaDocumentoPadre = 0)"); + wc.addWc(" ZZ.id_causaleMagazzino = 1 "); + wc.addWc(" D.flgTipoMagazzino = 9"); + if (CR.getId_tipo() > 0L) + wc.addWc("(C.id_tipo=" + CR.getId_tipo() + " or D.indici like'%:" + CR.getId_tipo() + ":%')"); + wc.addWc(" B.dataDocumento>=?"); + wc.addWc(" B.dataDocumento<=?"); + if (CR.getId_articolo() > 0L) + wc.addWc(" A.id_articolo = " + CR.getId_articolo()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + int dataCount = 1; + stmt.setDate(dataCount, CR.getDataDocumentoDa()); + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoA()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public CausaleMagazzino getCausaleMagazzino() { + this.causaleMagazzino = (CausaleMagazzino)getSecondaryObject(this.causaleMagazzino, CausaleMagazzino.class, getId_causaleMagazzino()); + return this.causaleMagazzino; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public long getId_causaleMagazzino() { + return this.id_causaleMagazzino; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setCausaleMagazzino(CausaleMagazzino causaleMagazzino) { + this.causaleMagazzino = causaleMagazzino; + } + + public void setClifor(Clifor clifor) { + this.clifor = clifor; + } + + public void setId_causaleMagazzino(long id_causaleMagazzino) { + this.id_causaleMagazzino = id_causaleMagazzino; + } + + public void setId_clifor(long l_id_clifor) { + this.id_clifor = l_id_clifor; + } + + public long getSegnoMov() { + return this.segnoMov; + } + + public void setSegnoMov(long segnoMov) { + this.segnoMov = segnoMov; + } + + public long getId_rigaDocumentoMov() { + return this.id_rigaDocumentoMov; + } + + public void setId_rigaDocumentoMov(long id_rigaDocumentoMov) { + this.id_rigaDocumentoMov = id_rigaDocumentoMov; + } + + private void findRigaDocumentoMovByRigaDocumento(long l_id_rigaDocumento) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A "; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumentoMov=" + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 0); + } + } + + public void findMagByRigaDocumentoCausale(long l_id_rigaDocumento, long l_id_causaleMagazzino) { + if (l_id_rigaDocumento > 0L && l_id_causaleMagazzino > 0L) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumentoMov = " + l_id_rigaDocumento); + wc.addWc("A.id_causaleMagazzino = " + l_id_causaleMagazzino); + wc.addWc("A.id_magFisico >0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } else { + initFields(); + setDBState(0); + } + } + + public void findMagBySerialeDisponibile(String l_seriale) { + String s_Sql_Find = "SELECT A.*, SUM(A.nr*segnoMov) AS nr from RIGA_DOCUMENTO AS A "; + String s_Sql_Having = " HAVING nr > 0 and A.id_magFisico>0"; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc(" A.seriale = '" + l_seriale + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findMagBySerialeEsistente(String l_seriale) { + String s_Sql_Find = "SELECT A.* from RIGA_DOCUMENTO AS A "; + String s_Sql_Order = " "; + WcString wc = new WcString(); + wc.addWc(" A.seriale = '" + l_seriale + "'"); + wc.addWc("A.id_magFisico>0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findMagFilatoDisponibilita(long l_id_articoloFilatoColore, long l_id_articoloFilato, long l_id_coloreFilato, String l_seriale, long l_tipologia_magfisico, long l_id_magFisico, long l_id_clifor, Date dataA) { + String s_Sql_Sum = " SUM(A.kg*segnoMov) as kg, SUM(A.mt*segnoMov) as mt, SUM(A.nr*segnoMov) as nr from RIGA_DOCUMENTO AS A "; + String s_Sql_colonne = ""; + String s_Sql_join = ""; + WcString wc = new WcString(); + if (l_id_articoloFilato > 0L || l_id_coloreFilato > 0L) + s_Sql_Sum = s_Sql_Sum + " inner join ARTICOLO_FILATO_COLORE AS F ON A.id_articoloFilatoColore=F.id_articoloFilatoColore"; + if (l_id_magFisico == 0L) { + wc.addWc("A.id_magFisico>0"); + } else { + wc.addWc("A.id_magFisico=" + l_id_magFisico); + } + if (l_id_articoloFilatoColore != 0L) { + wc.addWc(" A.id_articoloFilatoColore = " + l_id_articoloFilatoColore); + s_Sql_colonne = s_Sql_colonne + " A.id_articoloFilatoColore,"; + } + if (l_id_articoloFilato != 0L) { + wc.addWc(" F.id_articoloFilato = " + l_id_articoloFilato); + s_Sql_colonne = s_Sql_colonne + " F.id_articoloFilato,"; + } + if (l_id_coloreFilato != 0L) { + wc.addWc(" F.id_coloreFilato = " + l_id_coloreFilato); + s_Sql_colonne = s_Sql_colonne + " F.id_coloreFilato,"; + } + if (l_seriale != null && !l_seriale.isEmpty()) { + wc.addWc(" A.seriale = " + l_seriale); + s_Sql_colonne = s_Sql_colonne + " A.seriale,"; + } + if (l_id_clifor != 0L) { + wc.addWc(" A.id_clifor = " + l_id_clifor); + s_Sql_colonne = s_Sql_colonne + " A.id_clifor,"; + } + if (dataA != null) { + s_Sql_join = " INNER JOIN DOCUMENTO AS DOC ON A.id_documento=DOC.id_documento "; + wc.addWc(" DOC.dataDocumento <= ?"); + s_Sql_Sum = s_Sql_Sum + s_Sql_Sum; + } + if (l_tipologia_magfisico != 0L) { + wc.addWc(" B.flgTipo = " + l_tipologia_magfisico); + s_Sql_colonne = s_Sql_colonne + " A.id_magFisico,"; + s_Sql_Sum = s_Sql_Sum + ", MAG_FISICO AS B"; + wc.addWc(" A.id_magFisico = B.id_magFisico "); + } + String s_sql_groupby = ""; + if (!s_Sql_colonne.isEmpty()) + s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1); + try { + PreparedStatement stmt = getConn() + .prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby); + if (dataA != null) + stmt.setDate(1, dataA); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findMagDisponibilitaGlobaleMagazziniInterniEsterni(long l_id_articolo, String l_seriale, long l_id_clifor) { + findMagDisponibilitaPuntuale(0L, 0L, 0L, l_seriale, 0L, l_id_clifor, 3L); + setId_articolo(l_id_articolo); + } + + public void findMagFilatoDisponibilitaGlobaleMagazziniInterniEsterni(long l_id_articoloFilatoColore, String l_seriale, long l_id_clifor) { + findMagFilatoDisponibilitaPuntuale(0L, 0L, 0L, l_seriale, 0L, l_id_clifor, 3L, ""); + } + + public void findMagDisponibilitaPuntualeMagazziniInterni(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, String l_seriale, long l_id_clifor) { + findMagDisponibilitaPuntuale(l_id_articolo, l_id_articoloVariante, l_id_articoloTaglia, l_seriale, 0L, l_id_clifor, 1L); + } + + public void findMagFilatoDisponibilitaPuntualeMagazziniInterni(long l_id_articoloFilatoColore, long l_id_articoloFilato, long l_id_coloreFilato, String l_seriale) { + findMagFilatoDisponibilitaPuntuale(l_id_articoloFilatoColore, l_id_articoloFilato, l_id_coloreFilato, l_seriale, 0L, 0L, 1L, ""); + } + + public void findMagDisponibilitaPuntualeMagazziniInterniEsterni(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, String l_seriale, long l_id_clifor) { + findMagDisponibilitaPuntuale(l_id_articolo, l_id_articoloVariante, l_id_articoloTaglia, l_seriale, 0L, l_id_clifor, 3L); + } + + public void findMagFilatoDisponibilitaPuntualeMagazziniInterniEsterni(long l_id_articoloFilatoColore, long l_id_articoloFilato, long l_id_coloreFilato, String l_seriale, long l_id_clifor) { + findMagFilatoDisponibilitaPuntuale(l_id_articoloFilatoColore, l_id_articoloFilato, l_id_coloreFilato, l_seriale, 0L, l_id_clifor, 3L, ""); + } + + public void findMagDisponibilitaPuntuale(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, String l_seriale, long l_id_magfisico, long l_id_clifor, long flgTipoRicerca) { + String s_Sql_Sum = " SUM(segnoMov*kg) as kg, SUM(segnoMov*mt) as mt, SUM(segnoMov*nr) as nr from RIGA_DOCUMENTO AS A"; + String s_Sql_colonne = ""; + WcString wc = new WcString(); + if (flgTipoRicerca == 0L) + wc.addWc("A.id_magFisico>0"); + if (l_id_articolo != 0L) { + wc.addWc(" id_articolo = " + l_id_articolo); + s_Sql_colonne = s_Sql_colonne + " id_articolo,"; + } + if (l_id_articoloVariante != 0L) { + wc.addWc(" id_articoloVariante = " + l_id_articoloVariante); + s_Sql_colonne = s_Sql_colonne + " id_articoloVariante,"; + } + if (l_id_articoloTaglia != 0L) { + wc.addWc(" id_articoloTaglia = " + l_id_articoloTaglia); + s_Sql_colonne = s_Sql_colonne + " id_articoloTaglia,"; + } + if (l_id_magfisico != 0L) { + wc.addWc(" id_magFisico = " + l_id_magfisico); + s_Sql_colonne = s_Sql_colonne + " id_magFisico,"; + } + StringBuilder mf = new StringBuilder(""); + if (flgTipoRicerca > 0L && l_id_magfisico == 0L) { + MagFisico mag = new MagFisico(getApFull()); + if (flgTipoRicerca == 1L || flgTipoRicerca == 3L) { + Vectumerator vecMag = mag.findByTipo(1L); + if (vecMag.hasMoreElements()) + while (vecMag.hasMoreElements()) { + mag = (MagFisico)vecMag.nextElement(); + if (mf.length() > 0) + mf.append(" OR "); + mf.append(" id_magFisico = " + mag.getId_magFisico()); + } + } + if (flgTipoRicerca == 2L || flgTipoRicerca == 3L) { + Vectumerator vecMag = mag.findByTipo(2L); + if (vecMag.hasMoreElements()) + while (vecMag.hasMoreElements()) { + mag = (MagFisico)vecMag.nextElement(); + if (mf.length() > 0) + mf.append(" OR "); + mf.append(" id_magFisico = " + mag.getId_magFisico()); + } + } + } + if (mf.length() > 0) { + mf.append(")"); + wc.addWc("(" + mf.toString()); + s_Sql_colonne = s_Sql_colonne + " id_magFisico,"; + } + if (l_seriale != null && !l_seriale.isEmpty()) { + wc.addWc(" seriale = '" + l_seriale + "'"); + s_Sql_colonne = s_Sql_colonne + " seriale,"; + } + if (l_id_clifor != 0L) { + wc.addWc(" id_clifor = " + l_id_clifor); + s_Sql_colonne = s_Sql_colonne + " id_clifor,"; + } + String s_sql_groupby = ""; + if (!s_Sql_colonne.isEmpty()) + s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1); + try { + PreparedStatement stmt = getConn() + .prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findMagSaldiArticoloByCR(RigaDocumentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.id_articolo, A.id_articoloVariante, A.id_articoloTaglia, A.id_magFisico, A.seriale, A.id_clifor, SUM(A.kg*segnoMov) as kg, SUM(A.mt*segnoMov) as mt, SUM(A.nr*segnoMov) as nr from RIGA_DOCUMENTO AS A INNER JOIN ARTICOLO AS B ON A.id_articolo = B.id_articolo "; + String s_Sql_Group = " group by A.id_articolo, id_articoloVariante, id_articoloTaglia, A.id_magFisico, A.seriale, A.id_clifor "; + String s_Sql_Order = " order by B.nome, A.id_magFisico, A.id_clifor "; + String s_Sql_Having = ""; + if (CR.getFlgInMagazzino() == 1L) { + s_Sql_Having = " Having SUM(kg*segnoMov) > 0 OR SUM(mt*segnoMov) > 0 OR SUM(nr*segnoMov) > 0 "; + } else if (CR.getFlgInMagazzino() == 2L) { + s_Sql_Having = " Having SUM(kg*segnoMov) < 0 OR SUM(mt*segnoMov) < 0 OR SUM(nr*segnoMov) < 0 "; + } else if (CR.getFlgInMagazzino() == 3L) { + s_Sql_Having = " Having SUM(kg*segnoMov) <> 0 OR SUM(mt*segnoMov) <> 0 OR SUM(nr*segnoMov) <> 0 "; + } + WcString wc = new WcString(); + wc.addWc("A.id_magFisico>0"); + if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) { + String star = ""; + String temp = CR.getSearchTxt(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("(B.codice like '" + token + "%' or B.nome like '" + token + "%' or B.codiceProduttore like '" + token + "%' or B.codiciAlternativi like '%," + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_articolo() > 0L) + wc.addWc(" A.id_articolo = " + CR.getId_articolo()); + if (CR.getId_articoloVariante() > 0L) + wc.addWc(" A.id_articoloVariante = " + CR.getId_articoloVariante()); + if (CR.getId_magFisico() > 0L) + wc.addWc(" A.id_magFisico = " + CR.getId_magFisico()); + if (CR.getId_clifor() > 0L) + wc.addWc(" A.id_clifor = " + CR.getId_clifor()); + try { + PreparedStatement stmt = getConn() + .prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findMagFilatoSaldiArticoloFilatoByCR(RigaDocumentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select B.id_articoloFilato, C.id_articoloFilatoColore , SUM(A.kg*segnoMov) as kg, SUM(A.mt*segnoMov) as mt, SUM(A.nr*segnoMov) as nr from ARTICOLO_FILATO AS B LEFT JOIN ARTICOLO_FILATO_COLORE AS C ON B.id_articoloFilato=C.id_articoloFilato LEFT JOIN RIGA_DOCUMENTO AS A ON A.id_articoloFilato=B.id_articoloFilato and A.id_articoloFilatoColore=C.id_articoloFilatoColore left JOIN MAG_FISICO AS D ON A.id_magFisico=D.id_magFisico "; + if (CR.getFlgTipoMagazzino() > 0L) + s_Sql_Find = s_Sql_Find + " and D.flgTipo = " + s_Sql_Find; + String s_Sql_Group = " group by B.id_articoloFilato, C.id_articoloFilatoColore"; + String s_Sql_Order = " order by B.nome, C.nomeV, A.seriale "; + String s_Sql_Having = ""; + if (CR.getFlgInMagazzino() == 1L) { + s_Sql_Having = " Having SUM(A.kg*segnoMov) > 0 OR SUM(A.mt*segnoMov) > 0 OR SUM(A.nr*segnoMov) > 0 "; + } else if (CR.getFlgInMagazzino() == 2L) { + s_Sql_Having = " Having SUM(A.kg*segnoMov) < 0 OR SUM(A.mt*segnoMov) < 0 OR SUM(A.nr*segnoMov) < 0 "; + } + WcString wc = new WcString(); + wc.addWc("A.id_magFisico>0"); + if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) { + String star = ""; + String temp = CR.getSearchTxt(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("(B.codice like '" + token + "%' or B.nome like '" + token + "%' or B.codiceProduttore like '" + token + "%' or B.codiciAlternativi like '%," + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_articolo() > 0L) + wc.addWc("B.id_articolo = " + CR.getId_articolo()); + if (CR.getId_magFisico() > 0L) + wc.addWc(" A.id_magFisico = " + CR.getId_magFisico()); + if (CR.getId_clifor() > 0L) + wc.addWc(" A.id_clifor = " + CR.getId_clifor()); + try { + PreparedStatement stmt = getConn() + .prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm saveMagSuRIgaDocumento() { + RigaDocumento bean = this; + ResParm rp = new ResParm(true); + if (bean.getId_articolo() != 0L) { + long magPartenza = 0L; + long magArrivo = 0L; + long flgInternoPartenza = 0L; + long flgInternoArrivo = 0L; + if (bean.getDocumento().getId_magFisicoPartenza() == 0L) { + if (bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoPartenza() > 0L) { + magPartenza = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoPartenza(); + flgInternoPartenza = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getMagFisicoPartenza().getFlgTipo(); + } + } else { + magPartenza = bean.getDocumento().getId_magFisicoPartenza(); + flgInternoPartenza = bean.getDocumento().getMagFisicoPartenza().getFlgTipo(); + } + if (bean.getDocumento().getId_magFisicoArrivo() == 0L) { + if (bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo() > 0L) { + magArrivo = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo(); + flgInternoArrivo = bean.getDocumento().getTipoDocumento().getCausaleMagazzino().getMagFisicoArrivo().getFlgTipo(); + } + } else { + magArrivo = bean.getDocumento().getId_magFisicoArrivo(); + flgInternoArrivo = bean.getDocumento().getMagFisicoArrivo().getFlgTipo(); + } + if (magPartenza != 0L) { + long segnoMov = -1L; + if (bean.getFlgReso() == 1L) + segnoMov = 1L; + bean.setSegnoMov(segnoMov); + bean.setId_causaleMagazzino(bean.getDocumento().getTipoDocumento().getId_causaleMagazzino()); + bean.setId_magFisico(magPartenza); + if (flgInternoPartenza == 1L) { + bean.setId_clifor(0L); + } else { + bean.setId_clifor(bean.getDocumento().getId_clifor()); + } + rp = bean.superSave(); + } + if (rp.getStatus() && magArrivo != 0L) { + long segnoMov = 1L; + if (bean.getFlgReso() == 1L) + segnoMov = -1L; + if (magPartenza == 0L) { + bean.setSegnoMov(segnoMov); + bean.setId_causaleMagazzino(bean.getDocumento().getTipoDocumento().getId_causaleMagazzino()); + bean.setId_magFisico(magArrivo); + if (flgInternoArrivo == 1L) { + bean.setId_clifor(0L); + } else { + bean.setId_clifor(bean.getDocumento().getId_clifor()); + } + rp = bean.superSave(); + } else { + try { + RigaDocumento rd2 = (RigaDocumento)bean.clone(); + rd2.setDBState(0); + rd2.setId_rigaDocumento(0L); + rd2.setId_rigaDocumentoMov(bean.getId_rigaDocumento()); + rd2.setSegnoMov(segnoMov); + rd2.setId_magFisico(magArrivo); + if (flgInternoArrivo == 1L) { + rd2.setId_clifor(0L); + } else { + rd2.setId_clifor(bean.getDocumento().getId_clifor()); + } + rd2.setId_rigaDocumentoMov(bean.getId_rigaDocumento()); + rp = bean.superSave(); + } catch (Exception e) { + bean.handleDebug(e, 0); + rp.setException(e); + } + } + } + } + return rp; + } + + public Vectumerator findByCRCompatto(RigaDocumentoCR CR, int pageNumber, int pageRows) { + boolean flgOttimizzo = (getParm("OTTIMIZZO").getNumero() == 1.0D); + StringBuffer s_Sql_Find = new StringBuffer("select A.id_articolo, A.id_articoloVariante, A.id_articoloTaglia, sum(A.kg*segnoMov) as Kg,sum(A.mt*segnoMov) as mt, sum(A.nr*segnoMov) as nr, D.nome, D.codice from RIGA_DOCUMENTO AS A, DOCUMENTO AS C, ARTICOLO AS D "); + String s_Sql_Order = " order by D.nome,D.codice"; + if (CR.getFlgOrderBy() == 1L) + s_Sql_Order = " order by C.dataDocumento asc, C.id_esercizio asc, C.progDocumento asc"; + String s_Sql_groupby = " group by A.id_articolo"; + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt; + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_groupby); + } else { + if (pageNumber == 0) + pageNumber = 1; + int start = (pageNumber - 1) * pageRows; + int stop = start + pageRows; + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_groupby + " limit " + s_Sql_Order + "," + start); + } + findByCRCreateStmtDate(CR, stmt); + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) + return findRows(stmt, pageNumber, pageRows); + Vectumerator vec = findRows(stmt, 1, pageRows); + vec.setPageNumber(pageNumber); + vec.setTotNumberOfRecords(findByCRTotRecord(CR)); + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void findByCRCreateStmtDate(RigaDocumentoCR CR, PreparedStatement stmt) { + try { + int dataCount = 0; + if (CR.getDataDocumentoDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoDa()); + } + if (CR.getDataDocumentoA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoA()); + } + if (CR.getDataRiferimentoDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataRiferimentoDa()); + } + if (CR.getDataRiferimentoA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataRiferimentoA()); + } + } catch (SQLException e) { + handleDebug(e); + } + } + + private void findByCRCreateWC(RigaDocumentoCR CR, StringBuffer s_Sql_Find, WcString wc) { + wc.addWc("A.id_documento=C.id_documento"); + wc.addWc("C.id_tipoDocumento=TD.id_tipoDocumento "); + wc.addWc("TD.id_tipologiaDocumento=T.id_tipologiaDocumento "); + if (CR.getFlgRicercaMag() == RigaDocumentoCR.RICERCA_SOLO_RIGHE_DOC) { + wc.addWc("(A.id_rigaDocumentoMov=0 or A.id_rigaDocumentoMov is null)"); + } else if (CR.getFlgRicercaMag() == RigaDocumentoCR.RICERCA_SOLO_MAGAZZINO) { + wc.addWc("A.id_magFisico>0"); + } + if (!CR.getSearchTxt().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = prepareSqlString(st.nextToken()); + txt.append("(C.nominativoDocumento like '%" + token + "%' or D.nome like '%" + token + "%' )"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_articoloVariante() != 0L) { + wc.addWc("A.id_articoloVariante=" + CR.getId_articoloVariante()); + } else if (CR.getId_articolo() != 0L) { + wc.addWc("A.id_articolo=" + CR.getId_articolo()); + } + if (CR.getId_tipoDocumento() > 0L) + wc.addWc("C.id_tipoDocumento=" + CR.getId_tipoDocumento()); + if (CR.getId_esercizio() > 0L) + wc.addWc("year(C.dataDocumento)=" + CR.getId_esercizio()); + if (!CR.getRiferimento().isEmpty()) + wc.addWc("C.riferimento like '%" + CR.getRiferimento() + "%'"); + if (CR.getId_clifor() > 0L) + wc.addWc("C.id_clifor=" + CR.getId_clifor()); + if (CR.getId_magFisico() > 0L) + wc.addWc("A.id_magFisico=" + CR.getId_magFisico()); + if (CR.getId_tipo() != 0L) { + s_Sql_Find.append(" , TIPO AS E"); + wc.addWc("D.id_tipo=E.id_tipo"); + wc.addWc("(D.id_tipo=" + CR.getId_tipo() + " or E.indici like'%:" + CR.getId_tipo() + ":%')"); + } + if (CR.getId_marca() != 0L) + wc.addWc("D.id_marca=" + CR.getId_marca()); + if (CR.getFlgStatoPrenotazione() == 0L) { + wc.addWc("(C.flgStatoPrenotazione is null or C.flgStatoPrenotazione=0)"); + } else if (CR.getFlgStatoPrenotazione() == 200L) { + wc.addWc("(C.flgStatoPrenotazione is null or C.flgStatoPrenotazione=0 or C.flgStatoPrenotazione <90)"); + } else if (CR.getFlgStatoPrenotazione() > 0L) { + wc.addWc("C.flgStatoPrenotazione =" + CR.getFlgStatoPrenotazione()); + } + if (CR.getFlgTipologia() > 0L) + if (CR.getFlgTipologia() == 100L) { + wc.addWc("C.id_tipoDocumento=1"); + } else if (CR.getFlgTipologia() == 20L) { + wc.addWc("(T.codice=1 OR T.codice=2)"); + wc.addWc("C.id_tipoDocumento<>1"); + } else if (CR.getFlgTipologia() == 1L) { + wc.addWc("T.codice=" + CR.getFlgTipologia()); + wc.addWc("C.id_tipoDocumento<>1"); + } else { + wc.addWc("T.codice=" + CR.getFlgTipologia()); + } + if (CR.getFlgRigaPrelevata() == 0L) { + wc.addWc("(A.flgRigaPrelevata is null or A.flgRigaPrelevata=0)"); + } else if (CR.getFlgRigaPrelevata() > 0L) { + wc.addWc("A.flgRigaPrelevata=" + CR.getFlgRigaPrelevata()); + } + if (CR.getFlgDaCancellare() == 0L) { + wc.addWc("(A.flgDaCancellare is null or A.flgDaCancellare=0)"); + } else if (CR.getFlgDaCancellare() > 0L) { + wc.addWc("A.flgDaCancellare=" + CR.getFlgDaCancellare()); + } + if (!CR.getSeriale().isEmpty()) { + String temp = CR.getSeriale(); + temp = temp.replace("%", "\\%"); + temp = temp.replace("_", "\\_"); + temp = temp.replace("*", "%"); + wc.addWc("A.seriale like '" + CR.getSeriale() + "'"); + } + if (!CR.getRiferimento().isEmpty()) + wc.addWc("C.riferimento like '%" + CR.getRiferimento() + "%'"); + if (!CR.getDescrizioneCodiceRiga().isEmpty()) + wc.addWc("A.descrizioneCodiceRiga like '%" + CR.getDescrizioneCodiceRiga() + "%'"); + if (CR.getDataDocumentoDa() != null) + wc.addWc("C.dataDocumento>=?"); + if (CR.getDataDocumentoA() != null) + wc.addWc("C.dataDocumento<=?"); + if (CR.getDataRiferimentoDa() != null) + wc.addWc("C.dataRiferimento>=?"); + if (CR.getDataRiferimentoA() != null) + wc.addWc("C.dataRiferimento<=?"); + } + + private int findByCRTotRecord(RigaDocumentoCR CR) { + StringBuffer s_Sql_Find = new StringBuffer("select count(*) as tot from RIGA_DOCUMENTO AS A, DOCUMENTO AS C, ARTICOLO AS D "); + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + findByCRCreateStmtDate(CR, stmt); + return (int)getTots(stmt); + } catch (Exception e) { + handleDebug(e); + return 0; + } + } + + public String getCodiceArticolo() { + return getArticolo().getCodice(); + } + + public String getDescrizioneArticolo() { + if (getId_articoloTaglia() != 0L) + return getArticoloTaglia().getDescrizioneCompleta(); + if (getId_articoloVariante() == 0L) + return getArticolo().getDescrizioneCompleta(); + return getArticoloVariante().getDescrizioneCompleta(); + } + + public double getKgS() { + return this.kg * (double)getSegnoMov(); + } + + public double getMtS() { + return this.mt * (double)getSegnoMov(); + } + + public double getNrS() { + return this.nr * (double)getSegnoMov(); + } + + public long getId_rigaDocumentoPrelevata() { + return this.id_rigaDocumentoPrelevata; + } + + public RigaDocumento getRigaDocumentoPrelevata() { + this.rigaDocumentoPrelevata = (RigaDocumento)getSecondaryObject(this.rigaDocumentoPrelevata, RigaDocumento.class, + getId_rigaDocumentoPrelevata()); + return this.rigaDocumentoPrelevata; + } + + public void setId_rigaDocumentoPrelevata(long newId_rigaDocumentoPrelevata) { + this.id_rigaDocumentoPrelevata = newId_rigaDocumentoPrelevata; + setRigaDocumentoPrelevata(null); + } + + public void setRigaDocumentoPrelevata(RigaDocumento newRigaDocumentoPrelevata) { + this.rigaDocumentoPrelevata = newRigaDocumentoPrelevata; + } + + public ResParm saveMov() { + ResParm rp = superSave(); + if (rp.getStatus()) + rp = aggiornaDispo(); + return rp; + } + + public void creaFileCvsMov(RigaDocumentoCR CR) { + if (CR.getFlgReport().equals("S") && CR.getFlgTipoReport() == 1L) { + creaFileCvsCompattoMov(CR); + } else { + try { + Vectumerator list = findByCR(CR, 0, 0); + CR.setFileName(getPathTmp() + "movMagazzino_" + getPathTmp() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "Operatore;Documento;Intestazione;Data;Cod. Articolo;Articolo;Seriale;Disp.Art.;Tipo Movimento;Magazzini;Q.ta;Kg;Mt;Nr."; + outCvsFile.writeLine(CR.getDescrizioneCR()); + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)list.nextElement(); + s1 = row.getDocumento().getUsers().getCognomeNome() + row.getDocumento().getUsers().getCognomeNome() + "\"" + SEP + "\"" + row.getDocumento().getNumeroDocumentoCompleto() + SEP + row.getDocumento().getClifor().getDescrizioneCompleta() + SEP + getDataFormat().format(row.getDocumento().getDataDocumento()) + SEP + row.getCodiceArticolo() + SEP + row.getDescrizioneRigaCompleta() + SEP + row.getSeriale() + SEP + getNf().format(row.getArticolo().getQuantita()) + SEP + row.getDocumento().getTipoDocumento().getCausaleMagazzino().getDescrizione() + SEP + row.getMagFisico().getDescrizione() + SEP + getNf().format(row.getQuantita()) + SEP + getNf().format(row.getKg()) + SEP + getNf().format(row.getMt()) + SEP; + s1 = s1.replace("€", "€"); + s1 = s1.replace("»", "-->"); + outCvsFile.writeLine(s1); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + } + + public void creaFileCvsCompattoMov(RigaDocumentoCR CR) { + try { + Vectumerator list = findByCRCompatto(CR, 0, 0); + CR.setFileName(getPathTmp() + "movMagazzinoCompatto_" + getPathTmp() + ".csv"); + String theCvsFile = getDocBase() + getDocBase(); + String SEP = ";"; + new File(theCvsFile).delete(); + FileWr outCvsFile = new FileWr(theCvsFile, false); + String s1 = "Cod. Articolo;Articolo;Tipo;Disp.Art.;Q.ta;Kg;Mt;Nr."; + outCvsFile.writeLine(CR.getDescrizioneCR()); + outCvsFile.writeLine(s1); + while (list.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)list.nextElement(); + s1 = row.getCodiceArticolo() + row.getCodiceArticolo() + SEP + row.getDescrizioneArticolo() + SEP + row.getArticolo().getTipo().getDescrizioneCompleta() + SEP + getNf().format(row.getArticolo().getQuantita()) + SEP + getNf().format(row.getQuantita()) + SEP + getNf().format(row.getKg()) + SEP + getNf().format(row.getMt()) + SEP; + s1 = s1.replace("€", "€"); + s1 = s1.replace("»", "-->"); + outCvsFile.writeLine(s1); + } + outCvsFile.closeFile(); + } catch (Exception e) { + handleDebug(e); + } + } + + public ResParm deleteM() { + synchronized (this) { + if (getId_articolo() > 0L && getDocumento().getTipoDocumento().getCausaleMagazzino().getFlgCaricoArrivo() > 0L) { + Movimento mov = new Movimento(getApFull()); + mov.findDisponibilitaPuntualeMagazziniInterni(getId_articolo(), getId_articoloVariante(), getId_articoloTaglia(), + getSeriale(), 0L); + if (mov.getQuantita() < getQuantita()) + return new ResParm(false, "ERRORE! Quantità non più disponibile in magazzino. E' stato effettuato uno scarico!"); + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findRigaImpegnoBySeriale(getId_articolo(), getId_articoloVariante(), getSeriale()); + if (rd.getDBState() == 1) + return new ResParm(false, "ERRORE! Esiste una prenotazione per questo seriale!"); + } + RigaDocumento bean = (RigaDocumento)clone(); + Vectumerator vec = new RigaDocumentoP(getApFull()).findByRigaDocumento(getId_rigaDocumento(), 0, 0); + while (vec.hasMoreElements()) { + DbInterface row = (DbInterface)vec.nextElement(); + row.delete(); + } + if (getDocumento().getTipoDocumento().getFlgTipologia() == 3L) { + RigaDocumentoPM rdPM = new RigaDocumentoPM(getApFull()); + rdPM.findByRigaDocumento(getId_rigaDocumento()); + if (rdPM.getDBState() == 1) + rdPM.delete(); + } + if (getDocumento().getTipoDocumento().getFlgTipologia() == 4L) { + RigaDocumentoPM rdPM = new RigaDocumentoPM(getApFull()); + vec = rdPM.findByRigaDocumentoPrelevata(getId_rigaDocumento()); + while (vec.hasMoreElements()) { + DbInterface row = (DbInterface)vec.nextElement(); + row.delete(); + } + } + cancellaMovimento(bean, 0L, 0L); + Movimento.aggiornaDispo(getApFull(), getId_articolo(), getId_articoloVariante(), getId_articoloTaglia(), + getLastUpdId_user()); + ResParm rp = super.delete(); + if (rp.getStatus()) { + if (bean.getId_rigaDocumentoPadre() != 0L) { + RigaDocumento beanPadre = new RigaDocumento(getApFull()); + beanPadre.findByPrimaryKey(bean.getId_rigaDocumentoPadre()); + beanPadre.setFlgRigaPrelevata(0L); + rp = beanPadre.save(); + Documento doc = new Documento(getApFull()); + doc.findByPrimaryKey(beanPadre.getId_documento()); + doc.setDataChiusura(null); + doc.setFlgDocumentoPrelevato(0L); + doc.save(); + } + if (bean.getDocumento().getTipoDocumento().getId_causaleMagazzino() > 0L || + bean.getDocumento().getTipoDocumento().getFlgTipologia() == 4L) + bean.checkStatoPrenotazione(); + } + return rp; + } + } + + public static ResParm aggiornaDispo(ApplParmFull ap, long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, long l_id_users) { + ResParm rp = new ResParm(true); + if (l_id_articolo != 0L || l_id_articoloVariante != 0L || l_id_articoloTaglia != 0L) { + RigaDocumento rigaDocumento = new RigaDocumento(ap); + rigaDocumento.findMagDisponibilitaPuntualeMagazziniInterni(l_id_articolo, l_id_articoloVariante, l_id_articoloTaglia, "", 0L); + Articolo art = new Articolo(ap); + art.findByPrimaryKey(l_id_articolo); + art.resetCalcoloQuantita(); + if (art.getTipo().getFlgTipoMagazzino() == 0L || art.getTipo().getFlgTipoMagazzino() == 9L) { + System.out.println("ATTENZIONE!!!!aggiornaDispo"); + art.setFlgDispo(1L); + } else { + if (l_id_articoloTaglia > 0L) { + ArticoloTaglia bean = new ArticoloTaglia(ap); + bean.findByPrimaryKey(l_id_articoloTaglia); + bean.resetCalcoloQuantita(); + } + if (l_id_articoloVariante > 0L) { + ArticoloVariante bean = new ArticoloVariante(ap); + bean.findByPrimaryKey(l_id_articoloVariante); + bean.resetCalcoloQuantita(); + } + art.setFlgDispo((rigaDocumento.getQuantita() > 0.0D) ? 1L : 0L); + } + art.save(); + rigaDocumento.resetStatoPrenotazioneByArticolo(l_id_articolo, l_id_articoloVariante, l_id_articoloTaglia); + } + return rp; + } + + public void getMagQuantitaPrelevatoByRigaDocumentoPrelevata(long l_id_rigaDocumento) { + String s_Sql_Find = "select SUM(nr) as nr, SUM(kg) as kg, SUM(mt) as mt from RIGA_DOCUMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumentoMov>0"); + wc.addWc("A.id_rigaDocumentoPrelevata=" + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void getMagQuantitaPrelevatoByRigaDocumento(long l_id_rigaDocumento) { + String s_Sql_Find = "select SUM(nr) as nr, SUM(kg) as kg, SUM(mt) as mt from RIGA_DOCUMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumentoMov>0"); + wc.addWc("A.id_rigaDocumento=" + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findRigheReportArticoliCsv(DocumentoCR CR) { + String s_Sql_Order; + Documento doc = new Documento(getApFull()); + StringBuffer s_Sql_Find = new StringBuffer("select B.* from DOCUMENTO AS A "); + if (CR.getTipoDocumento().getFlgClienteFornitore().equals("F") && ( + CR.getTipoDocumento().getFlgTipologia() == 1L || + CR.getTipoDocumento().getFlgTipologia() == 2L)) { + if (CR.getFlgOrderBy() == 1L) { + s_Sql_Order = " order by A.dataRiferimento asc, A.id_esercizio asc, A.progDocumento asc"; + } else { + s_Sql_Order = " order by A.dataRiferimento desc, A.id_esercizio desc, A.progDocumento desc"; + } + } else if (CR.getFlgOrderBy() == 1L) { + s_Sql_Order = " order by A.dataDocumento asc, A.id_esercizio asc, A.progDocumento asc"; + } else { + s_Sql_Order = " order by A.dataDocumento desc, A.id_esercizio desc, A.progDocumento desc"; + } + WcString wc = new WcString(); + doc.findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + doc.findByCRCreateStmtDate(CR, stmt); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm superDelete() { + ResParm rp = getDocumento().checkEMSTA(); + if (!rp.getStatus()) { + rp.setInfoMsg(rp.getMsg()); + return rp; + } + return super.delete(); + } + + public long getId_articoloFilatoColore() { + return this.id_articoloFilatoColore; + } + + public void setId_articoloFilatoColore(long id_articoloFilatoColore) { + this.id_articoloFilatoColore = id_articoloFilatoColore; + setArticoloFilatoColore(null); + } + + public ArticoloFilatoColoreRitorto getArticoloFilatoColoreRitorto() { + this.articoloFilatoColoreRitorto = (ArticoloFilatoColoreRitorto)getSecondaryObject(this.articoloFilatoColoreRitorto, ArticoloFilatoColoreRitorto.class, + getId_articoloFilatoColoreRitorto()); + return this.articoloFilatoColoreRitorto; + } + + public void setArticoloFilatoColore(ArticoloFilatoColore articoloFilatoColore) { + this.articoloFilatoColore = articoloFilatoColore; + } + + public long getId_pezza() { + return this.id_pezza; + } + + public void setId_pezza(long id_pezza) { + this.id_pezza = id_pezza; + } + + public Pezza getPezza() { + return this.pezza; + } + + public void setPezza(Pezza pezza) { + this.pezza = pezza; + } + + public long getId_faseLavorazione() { + return this.id_faseLavorazione; + } + + public void setId_faseLavorazione(long id_faseLavorazione) { + this.id_faseLavorazione = id_faseLavorazione; + } + + public FaseLavorazione getFaseLavorazione() { + return this.faseLavorazione; + } + + public void setFaseLavorazione(FaseLavorazione faseLavorazione) { + this.faseLavorazione = faseLavorazione; + } + + public void findMagDisponibilita(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, String l_seriale, long l_tipologia_magfisico, long l_id_clifor, Date dataA) { + boolean guidoreni = false; + if (!guidoreni) { + String s_Sql_Sum = " SUM(A.kg*segnoMov) as kg, SUM(A.mt*segnoMov) as mt, SUM(A.nr*segnoMov) as nr from RIGA_DOCUMENTO AS A "; + String s_Sql_colonne = ""; + String s_Sql_join = ""; + WcString wc = new WcString(); + wc.addWc("A.id_magFisico>0"); + if (l_id_articolo != 0L) { + wc.addWc(" A.id_articolo = " + l_id_articolo); + s_Sql_colonne = s_Sql_colonne + " A.id_articolo,"; + } + if (l_id_articoloVariante != 0L) { + wc.addWc(" A.id_articoloVariante = " + l_id_articoloVariante); + s_Sql_colonne = s_Sql_colonne + " A.id_articoloVariante,"; + } + if (l_id_articoloTaglia != 0L) { + wc.addWc(" A.id_articoloTaglia = " + l_id_articoloTaglia); + s_Sql_colonne = s_Sql_colonne + " A.id_articoloTaglia,"; + } + if (l_seriale != null && !l_seriale.isEmpty()) { + wc.addWc(" A.seriale = " + l_seriale); + s_Sql_colonne = s_Sql_colonne + " A.seriale,"; + } + if (l_id_clifor != 0L) { + wc.addWc(" A.id_clifor = " + l_id_clifor); + s_Sql_colonne = s_Sql_colonne + " A.id_clifor,"; + } + if (dataA != null) { + s_Sql_join = " INNER JOIN DOCUMENTO AS DOC ON A.id_documento=DOC.id_documento "; + wc.addWc(" DOC.dataDocumento <= ?"); + s_Sql_Sum = s_Sql_Sum + s_Sql_Sum; + } + if (l_tipologia_magfisico != 0L) { + wc.addWc(" B.flgTipo = " + l_tipologia_magfisico); + s_Sql_Sum = s_Sql_Sum + " , MAG_FISICO AS B"; + wc.addWc(" A.id_magFisico = B.id_magFisico "); + } + String s_sql_groupby = ""; + if (!s_Sql_colonne.isEmpty()) + s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1); + try { + PreparedStatement stmt = getConn() + .prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby); + if (dataA != null) + stmt.setDate(1, dataA); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + } + + public void findMagFilatoDisponibilitaPuntuale(long l_id_articoloFilatoColore, long l_id_articoloFilato, long l_id_coloreFilato, String l_seriale, long l_id_magfisico, long l_id_clifor, long flgTipoRicerca, String l_flgCliFor) { + String s_Sql_Sum = " SUM(segnoMov*kg) as kg, SUM(segnoMov*mt) as mt, SUM(segnoMov*nr) as nr from RIGA_DOCUMENTO AS A"; + String s_Sql_colonne = ""; + WcString wc = new WcString(); + if (flgTipoRicerca == 0L) + wc.addWc("A.id_magFisico>0"); + if (l_id_articoloFilato > 0L || l_id_coloreFilato > 0L) + s_Sql_Sum = s_Sql_Sum + " inner join ARTICOLO_FILATO_COLORE AS F ON A.id_articoloFilatoColore=F.id_articoloFilatoColore"; + if (!l_flgCliFor.isEmpty()) + s_Sql_Sum = s_Sql_Sum + " inner join CLIFOR AS CF ON A.id_clifor=CF.id_clifor"; + if (l_id_articoloFilatoColore != 0L) { + wc.addWc(" A.id_articoloFilatoColore = " + l_id_articoloFilatoColore); + s_Sql_colonne = s_Sql_colonne + " A.id_articoloFilatoColore,"; + } + if (l_id_articoloFilato != 0L) { + wc.addWc(" F.id_articoloFilato = " + l_id_articoloFilato); + s_Sql_colonne = s_Sql_colonne + " F.id_articoloFilato,"; + } + if (l_id_coloreFilato != 0L) { + wc.addWc(" F.id_coloreFilato = " + l_id_coloreFilato); + s_Sql_colonne = s_Sql_colonne + " F.id_coloreFilato,"; + } + if (l_id_magfisico != 0L) { + wc.addWc(" id_magFisico = " + l_id_magfisico); + s_Sql_colonne = s_Sql_colonne + " id_magFisico,"; + } + if (!l_flgCliFor.isEmpty()) { + wc.addWc(" A.id_clifor='" + l_flgCliFor + "'"); + s_Sql_colonne = s_Sql_colonne + " A.id_clifor,"; + } + StringBuilder mf = new StringBuilder(""); + if (flgTipoRicerca > 0L && l_id_magfisico == 0L) { + MagFisico mag = new MagFisico(getApFull()); + if (flgTipoRicerca == 1L || flgTipoRicerca == 3L) { + Vectumerator vecMag = mag.findByTipo(1L); + if (vecMag.hasMoreElements()) + while (vecMag.hasMoreElements()) { + mag = (MagFisico)vecMag.nextElement(); + if (mf.length() > 0) + mf.append(" OR "); + mf.append(" id_magFisico = " + mag.getId_magFisico()); + } + } + if (flgTipoRicerca == 2L || flgTipoRicerca == 3L) { + Vectumerator vecMag = mag.findByTipo(2L); + if (vecMag.hasMoreElements()) + while (vecMag.hasMoreElements()) { + mag = (MagFisico)vecMag.nextElement(); + if (mf.length() > 0) + mf.append(" OR "); + mf.append(" id_magFisico = " + mag.getId_magFisico()); + } + } + } + if (mf.length() > 0) { + mf.append(")"); + wc.addWc("(" + mf.toString()); + s_Sql_colonne = s_Sql_colonne + " id_magFisico,"; + } + if (l_seriale != null && !l_seriale.isEmpty()) { + wc.addWc(" seriale = '" + l_seriale + "'"); + s_Sql_colonne = s_Sql_colonne + " seriale,"; + } + if (l_id_clifor != 0L) { + wc.addWc(" id_clifor = " + l_id_clifor); + s_Sql_colonne = s_Sql_colonne + " id_clifor,"; + } + String s_sql_groupby = ""; + if (!s_Sql_colonne.isEmpty()) + s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1); + try { + PreparedStatement stmt = getConn() + .prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findMagFisicoDisponibilita(long l_id_articolo, long l_id_articoloVariante, long l_id_articoloTaglia, String l_seriale, long l_id_magFisico, long l_id_clifor, Date dataA) { + boolean guidoreni = false; + if (!guidoreni) { + String s_Sql_Sum = " SUM(A.kg*segnoMov) as kg, SUM(A.mt*segnoMov) as mt, SUM(A.nr*segnoMov) as nr from RIGA_DOCUMENTO AS A "; + String s_Sql_colonne = ""; + String s_Sql_join = ""; + WcString wc = new WcString(); + if (l_id_articolo != 0L) { + wc.addWc(" A.id_articolo = " + l_id_articolo); + s_Sql_colonne = s_Sql_colonne + " A.id_articolo,"; + } + if (l_id_articoloVariante != 0L) { + wc.addWc(" A.id_articoloVariante = " + l_id_articoloVariante); + s_Sql_colonne = s_Sql_colonne + " A.id_articoloVariante,"; + } + if (l_id_articoloTaglia != 0L) { + wc.addWc(" A.id_articoloTaglia = " + l_id_articoloTaglia); + s_Sql_colonne = s_Sql_colonne + " A.id_articoloTaglia,"; + } + if (l_seriale != null && !l_seriale.isEmpty()) { + wc.addWc(" A.seriale = " + l_seriale); + s_Sql_colonne = s_Sql_colonne + " A.seriale,"; + } + if (l_id_clifor != 0L) { + wc.addWc(" A.id_clifor = " + l_id_clifor); + s_Sql_colonne = s_Sql_colonne + " A.id_clifor,"; + } + if (dataA != null) { + s_Sql_join = " INNER JOIN DOCUMENTO AS DOC ON A.id_documento=DOC.id_documento "; + wc.addWc(" DOC.dataDocumento <= ?"); + s_Sql_Sum = s_Sql_Sum + s_Sql_Sum; + } + if (l_id_magFisico != 0L) { + wc.addWc(" A.id_magFisico = " + l_id_magFisico); + s_Sql_colonne = s_Sql_colonne + " A.id_magFisico,"; + } else { + wc.addWc("A.id_magFisico>0"); + } + String s_sql_groupby = ""; + if (!s_Sql_colonne.isEmpty()) + s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1); + try { + PreparedStatement stmt = getConn() + .prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby); + if (dataA != null) + stmt.setDate(1, dataA); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + } + + public Vectumerator findMagSaldiArticoloVarianteTagliaByCR(RigaDocumentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select B.id_articolo, C.id_articoloVariante,T.id_articoloTaglia , SUM(A.kg*segnoMov) as kg, SUM(A.mt*segnoMov) as mt, SUM(A.nr*segnoMov) as nr from ARTICOLO AS B LEFT JOIN ARTICOLO_VARIANTE AS C ON B.id_articolo=C.id_articolo LEFT JOIN ARTICOLO_TAGLIA AS T ON T.id_articolo=T.id_articolo LEFT JOIN RIGA_DOCUMENTO AS A ON A.id_articolo=B.id_articolo and A.id_articoloVariante=C.id_articoloVariante and A.id_articoloTaglia=T.id_articoloTaglia left JOIN MAG_FISICO AS D ON A.id_magFisico=D.id_magFisico "; + if (CR.getFlgTipoMagazzino() > 0L) + s_Sql_Find = s_Sql_Find + " and D.flgTipo = " + s_Sql_Find; + String s_Sql_Group = " group by B.id_articolo, C.id_articoloVariante,T.id_articoloTaglia"; + String s_Sql_Order = " order by B.nome, C.nomeV, A.id_articoloTaglia "; + String s_Sql_Having = ""; + if (CR.getFlgInMagazzino() == 1L) { + s_Sql_Having = " Having SUM(A.kg*segnoMov) > 0 OR SUM(A.mt*segnoMov) > 0 OR SUM(A.nr*segnoMov) > 0 "; + } else if (CR.getFlgInMagazzino() == 2L) { + s_Sql_Having = " Having SUM(A.kg*segnoMov) < 0 OR SUM(A.mt*segnoMov) < 0 OR SUM(A.nr*segnoMov) < 0 "; + } + WcString wc = new WcString(); + wc.addWc("A.id_magFisico>0"); + if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) { + String star = ""; + String temp = CR.getSearchTxt(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("(B.codice like '" + token + "%' or B.nome like '" + token + "%' or B.codiceProduttore like '" + token + "%' or B.codiciAlternativi like '%," + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_articolo() > 0L) + wc.addWc("B.id_articolo = " + CR.getId_articolo()); + if (CR.getId_articoloVariante() > 0L) + wc.addWc("C.id_articoloVariante = " + CR.getId_articoloVariante()); + if (CR.getId_magFisico() > 0L) + wc.addWc(" A.id_magFisico = " + CR.getId_magFisico()); + if (CR.getId_clifor() > 0L) + wc.addWc(" A.id_clifor = " + CR.getId_clifor()); + try { + PreparedStatement stmt = getConn() + .prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findMagSaldiArticoloVarianteByCR(RigaDocumentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select B.id_articolo, C.id_articoloVariante , SUM(A.kg*segnoMov) as kg, SUM(A.mt*segnoMov) as mt, SUM(A.nr*segnoMov) as nr from ARTICOLO AS B LEFT JOIN ARTICOLO_VARIANTE AS C ON B.id_articolo=C.id_articolo LEFT JOIN RIGA_DOCUMENTO AS A ON A.id_articolo=B.id_articolo and A.id_articoloVariante=C.id_articoloVariante left JOIN MAG_FISICO AS D ON A.id_magFisico=D.id_magFisico "; + if (CR.getFlgTipoMagazzino() > 0L) + s_Sql_Find = s_Sql_Find + " and D.flgTipo = " + s_Sql_Find; + String s_Sql_Group = " group by B.id_articolo, C.id_articoloVariante, A.id_articoloTaglia"; + String s_Sql_Order = " order by B.nome, C.nomeV, A.id_articoloTaglia "; + String s_Sql_Having = ""; + if (CR.getFlgInMagazzino() == 1L) { + s_Sql_Having = " Having SUM(A.kg*segnoMov) > 0 OR SUM(A.mt*segnoMov) > 0 OR SUM(A.nr*segnoMov) > 0 "; + } else if (CR.getFlgInMagazzino() == 2L) { + s_Sql_Having = " Having SUM(A.kg*segnoMov) < 0 OR SUM(A.mt*segnoMov) < 0 OR SUM(A.nr*segnoMov) < 0 "; + } + WcString wc = new WcString(); + wc.addWc("A.id_magFisico>0"); + if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) { + String star = ""; + String temp = CR.getSearchTxt(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("(B.codice like '" + token + "%' or B.nome like '" + token + "%' or B.codiceProduttore like '" + token + "%' or B.codiciAlternativi like '%," + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_articolo() > 0L) + wc.addWc("B.id_articolo = " + CR.getId_articolo()); + if (CR.getId_magFisico() > 0L) + wc.addWc(" A.id_magFisico = " + CR.getId_magFisico()); + if (CR.getId_clifor() > 0L) + wc.addWc(" A.id_clifor = " + CR.getId_clifor()); + try { + PreparedStatement stmt = getConn() + .prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findMagSaldiArticoloTagliaByCR(RigaDocumentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select B.id_articolo, T.id_articoloTaglia , SUM(A.kg*segnoMov) as kg, SUM(A.mt*segnoMov) as mt, SUM(A.nr*segnoMov) as nr from ARTICOLO AS B LEFT JOIN ARTICOLO_TAGLIA AS T ON T.id_articolo=T.id_articolo LEFT JOIN RIGA_DOCUMENTO AS A ON A.id_articolo=B.id_articolo and A.id_articoloTaglia=T.id_articoloTaglia left JOIN MAG_FISICO AS D ON A.id_magFisico=D.id_magFisico "; + if (CR.getFlgTipoMagazzino() > 0L) + s_Sql_Find = s_Sql_Find + " and D.flgTipo = " + s_Sql_Find; + String s_Sql_Group = " group by B.id_articolo, T.id_articoloTaglia"; + String s_Sql_Order = " order by B.nome, B.nome, A.id_articoloTaglia "; + String s_Sql_Having = ""; + if (CR.getFlgInMagazzino() == 1L) { + s_Sql_Having = " Having SUM(A.kg*segnoMov) > 0 OR SUM(A.mt*segnoMov) > 0 OR SUM(A.nr*segnoMov) > 0 "; + } else if (CR.getFlgInMagazzino() == 2L) { + s_Sql_Having = " Having SUM(A.kg*segnoMov) < 0 OR SUM(A.mt*segnoMov) < 0 OR SUM(A.nr*segnoMov) < 0 "; + } + WcString wc = new WcString(); + wc.addWc("A.id_magFisico>0"); + if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) { + String star = ""; + String temp = CR.getSearchTxt(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("(B.codice like '" + token + "%' or B.nome like '" + token + "%' or B.codiceProduttore like '" + token + "%' or B.codiciAlternativi like '%," + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_articolo() > 0L) + wc.addWc("B.id_articolo = " + CR.getId_articolo()); + if (CR.getId_magFisico() > 0L) + wc.addWc(" A.id_magFisico = " + CR.getId_magFisico()); + if (CR.getId_clifor() > 0L) + wc.addWc(" A.id_clifor = " + CR.getId_clifor()); + try { + PreparedStatement stmt = getConn() + .prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public static ResParm aggiornaDispoFilato(ApplParmFull ap, long l_id_articoloFilatoColore, long l_id_users) { + ResParm rp = new ResParm(true); + if (l_id_articoloFilatoColore != 0L) { + RigaDocumento rigaDocumento = new RigaDocumento(ap); + rigaDocumento.findMagFilatoDisponibilitaPuntualeMagazziniInterni(l_id_articoloFilatoColore, 0L, 0L, ""); + ArticoloFilatoColore art = new ArticoloFilatoColore(ap); + art.findByPrimaryKey(l_id_articoloFilatoColore); + art.resetCalcoloQuantita(); + art.setFlgDispo((rigaDocumento.getQuantita() > 0.0D) ? 1L : 0L); + art.setLastUpdId_user(l_id_users); + art.save(); + ArticoloFilato af = art.getArticoloFilato(); + af.resetCalcoloQuantita(); + rigaDocumento.findMagFilatoDisponibilitaPuntualeMagazziniInterni(0L, af.getId_articoloFilato(), 0L, ""); + af.setFlgDispo((rigaDocumento.getQuantita() > 0.0D) ? 1L : 0L); + af.setLastUpdId_user(l_id_users); + af.save(); + } + return rp; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public void setId_articoloTessuto(long id_articoloTessuto) { + this.id_articoloTessuto = id_articoloTessuto; + setArticoloTessuto(null); + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, getId_articoloTessuto()); + return this.articoloTessuto; + } + + public void setArticoloTessuto(ArticoloTessuto articoloTessuto) { + this.articoloTessuto = articoloTessuto; + } + + public long getVolumeCm3ByDocumento(long l_id_documento) { + long volCM3 = 0L; + String s_Sql_Find = "select sum(B.volumeM3*1000000 +B.volumeCm3 )* A.quantita as _sum from RIGA_DOCUMENTO AS A left join ARTICOLO AS B on A.id_articolo=B.id_articolo "; + WcString wc = new WcString(); + wc.addWc("(A.id_rigaDocumentoMov=0 or A.id_rigaDocumentoMov is null)"); + wc.addWc("A.id_documento=" + l_id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + volCM3 = (long)getSum(stmt); + return volCM3; + } catch (Exception e) { + handleDebug(e, 0); + return 0L; + } + } + + public long getPesoKgByDocumento(long l_id_documento) { + long volCM3 = 0L; + String s_Sql_Find = "select sum(B.pesoKg)* A.quantita as _sum from RIGA_DOCUMENTO AS A left join ARTICOLO AS B on A.id_articolo=B.id_articolo "; + WcString wc = new WcString(); + wc.addWc("(A.id_rigaDocumentoMov=0 or A.id_rigaDocumentoMov is null)"); + wc.addWc("A.id_documento=" + l_id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + volCM3 = (long)getSum(stmt); + return volCM3; + } catch (Exception e) { + handleDebug(e, 0); + return 0L; + } + } + + public double getVolumeM3ByDocumento(long l_id_documento) { + DoubleOperator dop = new DoubleOperator((float)getVolumeCm3ByDocumento(l_id_documento)); + dop.setScale(4, 5); + dop.divide(1000000.0F); + return dop.getResult(); + } + + public void findMagTessutoDisponibilita(long l_id_articoloTessuto, long l_id_articoloTessutoColore, String l_seriale, long l_id_magFisico, long l_tipologia_magfisico, long l_flgStatoLavorazione, long l_id_clifor, String l_flgCliFor, Date dataA) { + String s_Sql_Sum = " SUM(A.kg*segnoMov) as kg, SUM(A.mt*segnoMov) as mt, SUM(A.nr*segnoMov) as nr from RIGA_DOCUMENTO AS A inner join DOCUMENTO AS DOC ON A.id_documento=DOC.id_documento "; + String s_Sql_colonne = ""; + String s_Sql_join = ""; + WcString wc = new WcString(); + if (l_tipologia_magfisico != 0L) { + s_Sql_Sum = s_Sql_Sum + " inner join MAG_FISICO AS B ON A.id_magFisico=B.id_magFisico"; + s_Sql_colonne = s_Sql_colonne + " A.id_magFisico,"; + wc.addWc(" B.flgTipo = " + l_tipologia_magfisico); + } else { + wc.addWc("A.id_magFisico>0"); + } + if (l_id_articoloTessuto > 0L) { + s_Sql_Sum = s_Sql_Sum + " inner join ARTICOLO_TESSUTO AS F ON A.id_articoloTessuto=F.id_articoloTessuto"; + s_Sql_colonne = s_Sql_colonne + " A.id_articoloTessuto,"; + } + if (l_id_articoloTessuto != 0L) { + wc.addWc(" A.id_articoloTessuto = " + l_id_articoloTessuto); + s_Sql_colonne = s_Sql_colonne + " A.id_articoloTessuto,"; + } + if (l_id_articoloTessutoColore != 0L) { + wc.addWc(" A.id_articoloTessutoColore = " + l_id_articoloTessutoColore); + s_Sql_colonne = s_Sql_colonne + " A.id_articoloTessutoColore,"; + } + if (l_seriale != null && !l_seriale.isEmpty()) { + wc.addWc(" A.seriale = '" + l_seriale + "'"); + s_Sql_colonne = s_Sql_colonne + " A.seriale,"; + } + if (l_id_clifor != 0L) { + wc.addWc(" A.id_clifor = " + l_id_clifor); + s_Sql_colonne = s_Sql_colonne + " A.id_clifor,"; + } + if (!l_flgCliFor.isEmpty()) { + wc.addWc(" A.id_clifor='" + l_flgCliFor + "'"); + s_Sql_colonne = s_Sql_colonne + " A.id_clifor,"; + } + if (l_flgStatoLavorazione == -1L || l_flgStatoLavorazione == 100L) { + wc.addWc("(DOC.flgStatoLavorazione=0 or DOC.flgStatoLavorazione is null or DOC.flgStatoLavorazione=100)"); + } else { + wc.addWc("(DOC.flgStatoLavorazione>0 and DOC.flgStatoLavorazione <100)"); + } + if (dataA != null) { + wc.addWc(" DOC.dataDocumento <= ?"); + s_Sql_Sum = s_Sql_Sum + s_Sql_Sum; + } + String s_sql_groupby = ""; + if (!s_Sql_colonne.isEmpty()) + s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1); + try { + PreparedStatement stmt = getConn() + .prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby); + if (dataA != null) + stmt.setDate(1, dataA); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findMagTessutoDisponibilitaGlobaleMagazziniInterniEsterni(long l_id_articoloTessuto, long l_id_articoloTessutoColore, String l_seriale, long l_id_clifor) { + findMagTessutoDisponibilita(0L, 0L, l_seriale, 0L, 0L, -1L, l_id_clifor, "", DATA_NULL); + } + + public void findMagTessutoDisponibilitaPuntualeOLD(long l_id_articoloTessuto, long l_id_articoloTessutoColore, String l_seriale, long l_id_magfisico, long l_flgStatoLavorazione, long l_id_clifor, long flgTipoRicerca, String l_flgCliFor) { + String s_Sql_Sum = " SUM(segnoMov*kg) as kg, SUM(segnoMov*mt) as mt, SUM(segnoMov*nr) as nr from RIGA_DOCUMENTO AS A"; + String s_Sql_colonne = ""; + WcString wc = new WcString(); + if (flgTipoRicerca == 0L) + wc.addWc("A.id_magFisico>0"); + if (l_id_articoloTessutoColore > 0L) { + s_Sql_Sum = s_Sql_Sum + " inner join ARTICOLO_TESSUTO_COLORE AS F ON A.id_articoloTessutoColore=F.id_articoloTessutoColore"; + } else if (l_id_articoloTessuto > 0L) { + s_Sql_Sum = s_Sql_Sum + " inner join ARTICOLO_TESSUTO AS F ON A.id_articoloTessuto=F.id_articoloTessuto"; + } + if (!l_flgCliFor.isEmpty()) + s_Sql_Sum = s_Sql_Sum + " inner join CLIFOR AS CF ON A.id_clifor=CF.id_clifor"; + if (l_id_articoloTessutoColore > 0L) { + wc.addWc(" A.id_articoloTessutoColore = " + l_id_articoloTessutoColore); + s_Sql_colonne = s_Sql_colonne + " A.id_articoloTessutoColore,"; + } else if (l_id_articoloTessuto != 0L) { + wc.addWc(" A.id_articoloTessuto = " + l_id_articoloTessuto); + s_Sql_colonne = s_Sql_colonne + " A.id_articoloTessuto,"; + } + if (l_id_magfisico != 0L) { + wc.addWc(" id_magFisico = " + l_id_magfisico); + s_Sql_colonne = s_Sql_colonne + " id_magFisico,"; + } + if (!l_flgCliFor.isEmpty()) { + wc.addWc(" A.id_clifor='" + l_flgCliFor + "'"); + s_Sql_colonne = s_Sql_colonne + " A.id_clifor,"; + } + StringBuilder mf = new StringBuilder(""); + if (flgTipoRicerca > 0L && l_id_magfisico == 0L) { + MagFisico mag = new MagFisico(getApFull()); + if (flgTipoRicerca == 1L || flgTipoRicerca == 3L) { + Vectumerator vecMag = mag.findByTipo(1L); + if (vecMag.hasMoreElements()) + while (vecMag.hasMoreElements()) { + mag = (MagFisico)vecMag.nextElement(); + if (mf.length() > 0) + mf.append(" OR "); + mf.append(" id_magFisico = " + mag.getId_magFisico()); + } + } + if (flgTipoRicerca == 2L || flgTipoRicerca == 3L) { + Vectumerator vecMag = mag.findByTipo(2L); + if (vecMag.hasMoreElements()) + while (vecMag.hasMoreElements()) { + mag = (MagFisico)vecMag.nextElement(); + if (mf.length() > 0) + mf.append(" OR "); + mf.append(" id_magFisico = " + mag.getId_magFisico()); + } + } + } + if (mf.length() > 0) { + mf.append(")"); + wc.addWc("(" + mf.toString()); + s_Sql_colonne = s_Sql_colonne + " id_magFisico,"; + } + if (l_seriale != null && !l_seriale.isEmpty()) { + wc.addWc(" seriale = '" + l_seriale + "'"); + s_Sql_colonne = s_Sql_colonne + " seriale,"; + } + if (l_id_clifor != 0L) { + wc.addWc(" id_clifor = " + l_id_clifor); + s_Sql_colonne = s_Sql_colonne + " id_clifor,"; + } + String s_sql_groupby = ""; + if (!s_Sql_colonne.isEmpty()) + s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1); + try { + PreparedStatement stmt = getConn() + .prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findMagTessutoDisponibilitaPuntualeMagazziniInterni(long l_id_articoloTessuto, long l_id_articoloTessutoColore, String l_seriale, long l_flgStatoLavorazione) { + findMagTessutoDisponibilita(l_id_articoloTessuto, l_id_articoloTessutoColore, l_seriale, 0L, 1L, -1L, 0L, "", DATA_NULL); + } + + public void findMagTessutoDisponibilitaPuntualeMagazziniInterniEsterni(long l_id_articoloTessuto, long l_id_articoloTessutoColore, String l_seriale, long l_flgStatoLavorazione, long l_id_clifor) { + findMagTessutoDisponibilita(l_id_articoloTessuto, l_id_articoloTessutoColore, l_seriale, 0L, 0L, -1L, l_id_clifor, "", DATA_NULL); + } + + public Vectumerator findMagTessutoSaldiArticoloTessutoByCR(RigaDocumentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select B.id_articoloFilato, C.id_articoloFilatoColore , SUM(A.kg*segnoMov) as kg, SUM(A.mt*segnoMov) as mt, SUM(A.nr*segnoMov) as nr from ARTICOLO_FILATO AS B LEFT JOIN ARTICOLO_FILATO_COLORE AS C ON B.id_articoloFilato=C.id_articoloFilato LEFT JOIN RIGA_DOCUMENTO AS A ON A.id_articoloFilato=B.id_articoloFilato and A.id_articoloFilatoColore=C.id_articoloFilatoColore left JOIN MAG_FISICO AS D ON A.id_magFisico=D.id_magFisico "; + if (CR.getFlgTipoMagazzino() > 0L) + s_Sql_Find = s_Sql_Find + " and D.flgTipo = " + s_Sql_Find; + String s_Sql_Group = " group by B.id_articoloFilato, C.id_articoloFilatoColore"; + String s_Sql_Order = " order by B.nome, C.nomeV, A.seriale "; + String s_Sql_Having = ""; + if (CR.getFlgInMagazzino() == 1L) { + s_Sql_Having = " Having SUM(A.kg*segnoMov) > 0 OR SUM(A.mt*segnoMov) > 0 OR SUM(A.nr*segnoMov) > 0 "; + } else if (CR.getFlgInMagazzino() == 2L) { + s_Sql_Having = " Having SUM(A.kg*segnoMov) < 0 OR SUM(A.mt*segnoMov) < 0 OR SUM(A.nr*segnoMov) < 0 "; + } + WcString wc = new WcString(); + wc.addWc("A.id_magFisico>0"); + if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) { + String star = ""; + String temp = CR.getSearchTxt(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + txt.append("(B.codice like '" + token + "%' or B.nome like '" + token + "%' or B.codiceProduttore like '" + token + "%' or B.codiciAlternativi like '%," + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_articolo() > 0L) + wc.addWc("B.id_articolo = " + CR.getId_articolo()); + if (CR.getId_magFisico() > 0L) + wc.addWc(" A.id_magFisico = " + CR.getId_magFisico()); + if (CR.getId_clifor() > 0L) + wc.addWc(" A.id_clifor = " + CR.getId_clifor()); + try { + PreparedStatement stmt = getConn() + .prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString() + s_Sql_Group + s_Sql_Having); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getTotTessutiImpegnati(long l_id_articoloTessuto, String l_seriale) { + return 0.0D; + } + + public static ResParm aggiornaDispoTessuto(ApplParmFull ap, long l_id_articoloTessuto, long l_id_articoloTessutoColore, long l_id_users) { + ResParm rp = new ResParm(true); + if (l_id_articoloTessutoColore != 0L) { + RigaDocumento rigaDocumento = new RigaDocumento(ap); + rigaDocumento.findMagTessutoDisponibilitaPuntualeMagazziniInterni(l_id_articoloTessuto, l_id_articoloTessutoColore, Articolo.SERIALE_NULL, -1L); + ArticoloTessutoColore art = new ArticoloTessutoColore(ap); + art.findByPrimaryKey(l_id_articoloTessutoColore); + art.resetCalcoloQuantita(); + art.setFlgDispo((rigaDocumento.getQuantita() > 0.0D) ? 1L : 0L); + art.setLastUpdId_user(l_id_users); + art.save(); + ArticoloTessuto af = art.getArticoloTessuto(); + af.resetCalcoloQuantita(); + rigaDocumento.findMagTessutoDisponibilitaPuntualeMagazziniInterni(l_id_articoloTessuto, 0L, Articolo.SERIALE_NULL, -1L); + af.setFlgDispo((rigaDocumento.getQuantita() > 0.0D) ? 1L : 0L); + af.setLastUpdId_user(l_id_users); + af.save(); + } + return rp; + } + + private static synchronized ResParm synchroSaveTessuto(RigaDocumento bean) { + long l_id_magFisicoPartenza, l_id_magFisicoArrivo; + MagFisico magFisicoPartenza, magFisicoArrivo; + CausaleMagazzino causaleMagazzino; + ResParm rp = bean.getDocumento().checkEMSTA(); + if (!rp.getStatus()) + return new ResParm(false, "ATTENZIONE! Tentativo di modificare una riga documento: " + rp.getMsg()); + double l_quantitaOld = bean.getQuantitaOld(); + RigaDocumento rd = new RigaDocumento(bean.getApFull()); + rd.findByPrimaryKey(bean.getId_rigaDocumento()); + long l_flgRigaPrelevata = rd.getFlgRigaPrelevata(); + if (bean.getDBState() == 1) { + if (bean.getFlgRigaPrelevata() == 1L) + return new ResParm(false, "ERRORE! Non puoi modificare una riga chiusa!"); + if (bean.getQuantitaPrelevata() > 0.0D && bean.getQuantita() < bean.getQuantitaPrelevata()) + return new ResParm(false, "ERRORE! La quantità prelevata è maggiore della quantità della riga"); + } + if (bean.getQuantitaPrelevata() >= bean.getQuantita() && bean.getQuantitaPrelevata() > 0.0D && bean.getQuantita() > 0.0D) + bean.setFlgRigaPrelevata(1L); + double quantitaPrelevata1 = 0.0D; + if (bean.getArticoloTessuto().isUsaMagazzino()) { + rd.getMagQuantitaPrelevatoByRigaDocumento(bean.getId_rigaDocumento()); + quantitaPrelevata1 = rd.getQuantita(); + if (bean.getQuantita() < quantitaPrelevata1) + return new ResParm(false, "ERRORE! La quantità prelevata è maggiore della quantità della riga"); + } + RigaDocumento beanRB = null; + if (bean.getId_rigaDocumento() != 0L) { + beanRB = new RigaDocumento(bean.getApFull()); + beanRB.findByPrimaryKey(bean.getId_rigaDocumento()); + } + rp = new ResParm(true); + long magPartenza = 0L; + long magArrivo = 0L; + long flgTipoMagFisicoPartenza = 0L; + long flgTipoMagFisicoArrivo = 0L; + if (bean.getFlgCodiceRiga() == 0L) { + l_id_magFisicoPartenza = bean.getDocumento().getId_magFisicoPartenza(); + l_id_magFisicoArrivo = bean.getDocumento().getId_magFisicoArrivo(); + magFisicoPartenza = bean.getDocumento().getMagFisicoPartenza(); + magFisicoArrivo = bean.getDocumento().getMagFisicoArrivo(); + causaleMagazzino = bean.getDocumento().getTipoDocumento().getCausaleMagazzino(); + } else { + l_id_magFisicoPartenza = bean.getDocumento().getId_magFisicoPartenza2(); + l_id_magFisicoArrivo = bean.getDocumento().getId_magFisicoArrivo2(); + magFisicoPartenza = bean.getDocumento().getMagFisicoPartenza2(); + magFisicoArrivo = bean.getDocumento().getMagFisicoArrivo2(); + causaleMagazzino = bean.getDocumento().getTipoDocumento().getCausaleMagazzino2(); + } + if (l_id_magFisicoPartenza == 0L) { + if (causaleMagazzino.getId_magFisicoPartenza() > 0L) { + magPartenza = causaleMagazzino.getId_magFisicoPartenza(); + flgTipoMagFisicoPartenza = causaleMagazzino.getMagFisicoPartenza().getFlgTipo(); + } + } else { + magPartenza = l_id_magFisicoPartenza; + flgTipoMagFisicoPartenza = magFisicoPartenza.getFlgTipo(); + } + if (l_id_magFisicoArrivo == 0L) { + if (causaleMagazzino.getId_magFisicoArrivo() > 0L) { + magArrivo = causaleMagazzino.getId_magFisicoArrivo(); + flgTipoMagFisicoArrivo = causaleMagazzino.getMagFisicoArrivo().getFlgTipo(); + } + } else { + magArrivo = l_id_magFisicoArrivo; + flgTipoMagFisicoArrivo = magFisicoArrivo.getFlgTipo(); + } + if (bean.getId_articoloTessuto() != 0L && bean.getArticoloTessuto().usaMagazzino() && (magArrivo > 0L || magPartenza > 0L)) { + if (magPartenza != 0L) { + long segnoMov = -1L; + if (bean.getFlgReso() == 1L) + segnoMov = 1L; + bean.setSegnoMov(segnoMov); + bean.setId_causaleMagazzino(causaleMagazzino.getId_causaleMagazzino()); + bean.setId_magFisico(magPartenza); + if (flgTipoMagFisicoPartenza == 1L) { + bean.setId_clifor(0L); + } else { + bean.setId_clifor(bean.getDocumento().getId_clifor()); + } + rp = bean.superSave(); + } + if (rp.getStatus() && magArrivo != 0L) { + long segnoMov = 1L; + if (bean.getFlgReso() == 1L) + segnoMov = -1L; + if (magPartenza == 0L) { + bean.setSegnoMov(segnoMov); + bean.setId_causaleMagazzino(causaleMagazzino.getId_causaleMagazzino()); + bean.setId_magFisico(magArrivo); + if (flgTipoMagFisicoArrivo == 1L) { + bean.setId_clifor(0L); + } else { + bean.setId_clifor(bean.getDocumento().getId_clifor()); + } + rp = bean.superSave(); + } else { + try { + RigaDocumento rd2 = (RigaDocumento)bean.clone(); + rd2.setDBState(0); + rd2.setId_rigaDocumento(0L); + rd2.setId_rigaDocumentoMov(bean.getId_rigaDocumento()); + rd2.setSegnoMov(segnoMov); + rd2.setId_magFisico(magArrivo); + if (flgTipoMagFisicoArrivo == 1L) { + rd2.setId_clifor(0L); + } else { + rd2.setId_clifor(bean.getDocumento().getId_clifor()); + } + rd2.setId_rigaDocumentoMov(bean.getId_rigaDocumento()); + rp = bean.superSave(); + } catch (Exception e) { + bean.handleDebug(e, 0); + rp.setException(e); + } + } + } + } else { + bean.setId_clifor(0L); + rp = bean.superSave(); + } + if (rp.getStatus()) { + if (bean.getDocumento().getTipoDocumento().getFlgTipologia() == 200L) + if (bean.getDocumento().getFlgBarcodeType() == 100L) { + String pre = zeroLeft(bean.getDocumento().getRiferimento(), 6) + "-" + zeroLeft(bean.getDocumento().getRiferimento(), 6); + long numeroIniziale = 1L; + long numeroFinale = numeroIniziale + bean.getStacchi() - 1L; + bean.setCodiceCartellinoStart(pre + pre); + bean.setCodiceCartellinoStop(pre + pre); + bean.setCodiceCartellinoIniziale(""); + bean.superSave(); + } + rp.append(bean.getDocumento().save()); + rp.append(bean.aggiornaCostoUltimoFornitore()); + if (l_flgRigaPrelevata != bean.getFlgRigaPrelevata()) + if (bean.getFlgRigaPrelevata() == 0L) { + if (bean.getDocumento().getFlgDocumentoPrelevato() == 1L) + bean.getDocumento().aggiornaFlgDocumentoPrelevato(0L); + } else { + bean.getDocumento().verificaEAggiornaFlgDocumentoPrelevato(); + } + } + if (rp.getStatus()) { + rp.setMsg(AbMessages.getMessage("SAVE_OK")); + bean.getArticoloTessuto().setQuantitaCalcolate(false); + bean.getArticoloTessuto().superSave(); + } + return rp; + } + + public long getId_articoloPrecedente() { + return this.id_articoloPrecedente; + } + + public void setId_articoloPrecedente(long id_articoloPrecedente) { + this.id_articoloPrecedente = id_articoloPrecedente; + } + + public double getPercL1() { + return this.percL1; + } + + public double getPercL2() { + return this.percL2; + } + + public double getPercL3() { + return this.percL3; + } + + public void setPercL1(double percL1) { + this.percL1 = percL1; + } + + public void setPercL2(double percL2) { + this.percL2 = percL2; + } + + public void setPercL3(double percL3) { + this.percL3 = percL3; + } + + public String getFETipoCessionePrestazione() { + return null; + } + + public String getFECodiceArticoloTipo() { + return getArticolo().getTipo().getDescrizione(); + } + + public String getFECodiceArticoloValore() { + return getCodiceArticolo(); + } + + public String getFEDescrizione() { + return getDescrizioneRigaCompleta(); + } + + public double getFEQuantita() { + return getQuantita(); + } + + public String getFEUnitaMisura() { + return getUdm(); + } + + public Date getFEDataInizioPeriodo() { + return null; + } + + public Date getFEDataFinePeriodo() { + return null; + } + + public double getFEPrezzoUnitario() { + return getImponibile(); + } + + public Vectumerator getFEScontoMaggiorazione() { + if (getSconto() > 0.0D) { + FEScontoMaggiorazione rowSm; + Vectumerator vecSM = new Vectumerator(); + if (getQuantita() == 1.0D) { + rowSm = new FEScontoMaggiorazione("SC", getSconto(), 0.0D); + } else { + rowSm = new FEScontoMaggiorazione("SC", getSconto(), 0.0D); + } + vecSM.add(rowSm); + return vecSM; + } + if (getPercL1() > 0.0D || getPercL2() > 0.0D || getPercL3() > 0.0D) { + FEScontoMaggiorazione rowSm; + Vectumerator vecSM = new Vectumerator(); + if (getQuantita() == 1.0D) { + rowSm = new FEScontoMaggiorazione("SC", 0.0D, getTotImponibileRigaSconto()); + } else { + DoubleOperator dop = new DoubleOperator(getTotImponibileRigaSconto()); + dop.setScale(4, 5); + dop.divide(getQuantita()); + dop.setScale(2, 5); + rowSm = new FEScontoMaggiorazione("SC", 0.0D, dop.getResult()); + } + vecSM.add(rowSm); + return vecSM; + } + return null; + } + + public double getFEPrezzoTotale() { + return getTotImponibileRigaConSconto(); + } + + public double getFEAliquotaIva() { + return (double)getIva().getAliquotaFE(); + } + + public double getFERitenuta() { + return 0.0D; + } + + public String getFENatura() { + return getIva().getFENatura(); + } + + public String getFERiferimentoAmministrazione() { + return null; + } + + public double getTotImponibileRigaSconto() { + if (!getIva().getFlgTipo().equals("R")) { + if (getSconto() == 0.0D && getPercL1() == 0.0D && getPercL2() == 0.0D && getPercL3() == 0.0D) + return 0.0D; + if (getSconto() > 0.0D) { + DoubleOperator doubleOperator = new DoubleOperator(getSconto()); + doubleOperator.setScale(4, 5); + doubleOperator.multiply(getTotImponibileRiga()); + doubleOperator.divide(100.0F); + doubleOperator.setScale(2, 5); + return doubleOperator.getResult(); + } + DoubleOperator temp = new DoubleOperator(); + temp.setScale(4, 5); + DoubleOperator imponibile = new DoubleOperator(getTotImponibileRiga()); + imponibile.setScale(4, 5); + DoubleOperator scontoTot = new DoubleOperator(); + scontoTot.setScale(4, 5); + if (getPercL1() > 0.0D) { + temp = new DoubleOperator(getPercL1()); + temp.multiply(imponibile); + temp.divide(100.0F); + scontoTot.add(temp.getResult()); + imponibile.subtract(temp.getResult()); + } + if (getPercL2() > 0.0D) { + temp = new DoubleOperator(getPercL2()); + temp.multiply(imponibile); + temp.divide(100.0F); + scontoTot.add(temp.getResult()); + imponibile.subtract(temp.getResult()); + } + if (getPercL3() > 0.0D) { + temp = new DoubleOperator(getPercL3()); + temp.multiply(imponibile); + temp.divide(100.0F); + scontoTot.add(temp.getResult()); + imponibile.subtract(temp.getResult()); + } + scontoTot.setScale(2, 5); + return scontoTot.getResult(); + } + return 0.0D; + } + + public double getTotImponibileRigaConSconto() { + DoubleOperator temp = new DoubleOperator(getTotImponibileRiga()); + temp.setScale(4, 5); + temp.subtract(getTotImponibileRigaSconto()); + temp.setScale(2, 5); + return temp.getResult(); + } + + public double getRDITotImponibile() { + return getTotImponibileRigaConSconto(); + } + + public double getRDITotImposta() { + return getTotIvaRiga4(); + } + + public double getRDITotCosto() { + return getTotCostoUsato(); + } + + public boolean isRDIPIva() { + return !getClifor().getpIva().isEmpty(); + } + + public boolean isRDINotaCredito() { + if (getDocumento().getTipoDocumento().getFlgTipologia() == 1L) + return true; + return false; + } + + public double getRDITotImponibileRM() { + return getTotImportoRM(); + } + + public double getTotImponibileRiga() { + DoubleOperator temp = new DoubleOperator(getImponibile()); + temp.multiply(getQuantita()); + temp.setScale(3, 5); + return temp.getResult(); + } + + public double getFECostoArticolo() { + return getArticolo().getCostoAcquisto(); + } + + public String getFEEsigibilitaIva() { + if (getDocumento().getClifor().getFlgSplitPayment() == 1L) + return "S"; + return null; + } + + public long getStacchi() { + return this.stacchi; + } + + public void setStacchi(long stacchi) { + this.stacchi = stacchi; + } + + public double getMetriStacchi() { + return this.metriStacchi; + } + + public void setMetriStacchi(double metriStacchi) { + this.metriStacchi = metriStacchi; + } + + public long getRifTipoArticolo() { + return (this.rifTipoArticolo == 0L) ? 1L : this.rifTipoArticolo; + } + + public void setRifTipoArticolo(long rifTipoArticolo) { + this.rifTipoArticolo = rifTipoArticolo; + } + + public String getCodiceCartellinoIniziale() { + return (this.codiceCartellinoIniziale == null) ? "" : this.codiceCartellinoIniziale.trim(); + } + + public void setCodiceCartellinoIniziale(String codiceCartellinoIniziale) { + this.codiceCartellinoIniziale = codiceCartellinoIniziale; + } + + public String getDescrizioneStatoPezze() { + if (getId_rigaDocumento() == 0L) + return ""; + StringBuilder sb = new StringBuilder(); + LavPezza lavPezza = new LavPezza(getApFull()); + Vectumerator vec = lavPezza.findByRigaDocumento(getId_rigaDocumento()); + if (vec.getTotNumberOfRecords() > 0) { + sb.append(vec.getTotNumberOfRecords()); + sb.append(" pezze per "); + lavPezza.findLastInserimentoByRigaDocumento(getId_rigaDocumento(), 0L); + sb.append(getNf().format(lavPezza.getMtPezza())); + sb.append(" mt "); + sb.append(lavPezza.getTsInserimentoS()); + } + return sb.toString(); + } + + public String getCodiceCartellinoStart() { + return (this.codiceCartellinoStart == null) ? "" : this.codiceCartellinoStart; + } + + public String getCodiceCartellinoStop() { + return (this.codiceCartellinoStop == null) ? "" : this.codiceCartellinoStop; + } + + public void setCodiceCartellinoStart(String codiceCartellinoStart) { + this.codiceCartellinoStart = codiceCartellinoStart; + } + + public void setCodiceCartellinoStop(String codiceCartellinoStop) { + this.codiceCartellinoStop = codiceCartellinoStop; + } + + public long getFlgCodiceRiga() { + return this.flgCodiceRiga; + } + + public void setFlgCodiceRiga(long flgCodiceRiga) { + this.flgCodiceRiga = flgCodiceRiga; + } + + public long getFlgStatoLavorazioneRiga() { + return this.flgStatoLavorazioneRiga; + } + + public void setFlgStatoLavorazioneRiga(long flgStatoLavorazione) { + this.flgStatoLavorazioneRiga = flgStatoLavorazione; + } + + public static final String getStatoLavorazione(long l_flgStatoLavorazione) { + return Documento.getStatoLavorazione(l_flgStatoLavorazione); + } + + public String getStatoLavorazione() { + return Documento.getStatoLavorazione(getFlgStatoLavorazioneRiga()); + } + + public Vectumerator findByCR(RigaDocumentoCR CR, int pageNumber, int pageRows) { + if (CR.getFlgReport().equals("S") && CR.getFlgTipoReport() == 1L) + return findByCRCompatto(CR, pageNumber, pageRows); + boolean flgOttimizzo = (getParm("OTTIMIZZO").getNumero() == 1.0D); + StringBuffer s_Sql_Find = new StringBuffer("select A.*, D.nome, D.codice, C.dataDocumento, C.id_esercizio, C.progDocumento from RIGA_DOCUMENTO AS A left join ARTICOLO AS D on A.id_articolo=D.id_articolo, DOCUMENTO AS C "); + s_Sql_Find.append(" ,TIPO_DOCUMENTO AS TD , TIPOLOGIA_DOCUMENTO AS T"); + String s_Sql_Order = " order by D.nome,D.codice, A.seriale, C.dataDocumento desc, C.id_esercizio desc, C.progDocumento desc"; + if (CR.getFlgOrderBy() == 1L) + s_Sql_Order = " order by C.dataDocumento asc, C.id_esercizio asc, C.progDocumento asc"; + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt; + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + } else { + if (pageNumber == 0) + pageNumber = 1; + int start = (pageNumber - 1) * pageRows; + int stop = start + pageRows; + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + " limit " + s_Sql_Order + "," + start); + } + findByCRCreateStmtDate(CR, stmt); + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) + return findRows(stmt, pageNumber, pageRows); + Vectumerator vec = findRows(stmt, 1, pageRows); + vec.setPageNumber(pageNumber); + vec.setTotNumberOfRecords(findByCRTotRecord(CR)); + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findRigheFilatiByRDTessuto(long l_id_rigaDocumentoTessuto) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A "; + String s_Sql_order = " order by A.id_rigaDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumentoTessutoA=" + l_id_rigaDocumentoTessuto); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getColpoFinaleRiga() { + return this.colpoFinaleRiga; + } + + public void setColpoFinaleRiga(long colpoFinale) { + this.colpoFinaleRiga = colpoFinale; + } + + public long getColpoInizialeRiga() { + return this.colpoInizialeRiga; + } + + public void setColpoInizialeRiga(long colpoIniziale) { + this.colpoInizialeRiga = colpoIniziale; + } + + public long getId_articoloTessutoColore() { + return this.id_articoloTessutoColore; + } + + public void setId_articoloTessutoColore(long id_articoloTessutoColore) { + this.id_articoloTessutoColore = id_articoloTessutoColore; + setArticoloTessutoColore(null); + } + + public ArticoloTessutoColore getArticoloTessutoColore() { + this.articoloTessutoColore = (ArticoloTessutoColore)getSecondaryObject(this.articoloTessutoColore, ArticoloTessutoColore.class, + getId_articoloTessutoColore()); + return this.articoloTessutoColore; + } + + public void setArticoloTessutoColore(ArticoloTessutoColore articoloTessutoColore) { + this.articoloTessutoColore = articoloTessutoColore; + } + + public String getCodiceCartellinoIdx(long idx) { + if (idx == 0L) + return getCodiceCartellinoStart(); + int idxPre = (int)((long)getCodiceCartellinoStart().length() - getDocumento().getFlgBarcodeSequenzaNumeri()); + String pre = getCodiceCartellinoStart().substring(0, idxPre); + long numIniziale = Long.parseLong(getCodiceCartellinoStart().substring(idxPre)); + return pre + pre; + } + + public long getTotColpiRiga() { + if (getColpoFinaleRiga() > getColpoInizialeRiga()) + return getColpoFinaleRiga() - getColpoInizialeRiga(); + return 0L; + } + + public long getId_telaio() { + return this.id_telaio; + } + + public Telaio getTelaio() { + this.telaio = (Telaio)getSecondaryObject(this.telaio, Telaio.class, getId_telaio()); + return this.telaio; + } + + public void setId_telaio(long id_telaio) { + this.id_telaio = id_telaio; + setTelaio(null); + } + + public void setTelaio(Telaio telaio) { + this.telaio = telaio; + } + + public Vectumerator findImpegniByClifor(long l_id_clifor, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A , DOCUMENTO AS B"; + String s_Sql_order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("B.flgStato =1"); + wc.addWc("A.flgRigaPrelevata !=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByTelaioUltimo(long l_id_telaio) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A"; + String s_Sql_Order = " order by A.tsFineLavorazioneRiga desc"; + WcString wc = new WcString(); + wc.addWc("A.flgStatoLavorazioneRiga=100"); + wc.addWc("A.id_telaio=" + l_id_telaio); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public ResParm updateFields(String fieldName, String value) { + if (getId_rigaDocumento() == 0L) + return new ResParm(false, "Errore! Impossibile aggiornare un bean nuovo."); + long valueL = 0L; + try { + valueL = Long.parseLong(value); + } catch (Exception e) {} + if (fieldName.equals("colpoInizialeRiga")) { + setColpoInizialeRiga(valueL); + } else if (fieldName.equals("colpoFinaleRiga")) { + if (valueL > 0L && valueL > getColpoInizialeRiga()) { + setColpoFinaleRiga(valueL); + } else { + setColpoFinaleRiga(0L); + } + } else if (fieldName.equals("id_telaio")) { + setId_telaio(valueL); + } + calcolaStatoLavorazioneRiga(); + if (getId_telaio() > 0L && getColpoInizialeRiga() == 0L) + setColpoInizialeRiga(getTelaio().findColpiIniziali()); + ResParm rp = super.save(); + if (rp.getStatus()) + rp = getDocumento().aggiornaStatoLavorazione(); + return rp; + } + + public Timestamp getTsFineLavorazioneRiga() { + return this.tsFineLavorazioneRiga; + } + + public void setTsFineLavorazioneRiga(Timestamp tsFineLavorazioneRiga) { + this.tsFineLavorazioneRiga = tsFineLavorazioneRiga; + } + + public Timestamp getTsInizioLavorazioneRiga() { + return this.tsInizioLavorazioneRiga; + } + + public void setTsInizioLavorazioneRiga(Timestamp tsInizioLavorazioneRiga) { + this.tsInizioLavorazioneRiga = tsInizioLavorazioneRiga; + } + + public boolean isCampoEditabile(String fieldname) { + if (fieldname.equals("id_telaio")) { + if (getFlgStatoLavorazioneRiga() == 0L || + getFlgStatoLavorazioneRiga() == 10L) + return true; + return false; + } + if (fieldname.equals("colpoInizialeRiga")) { + if ((getFlgStatoLavorazioneRiga() == 10L || + getFlgStatoLavorazioneRiga() == 20L) && getColpoFinaleRiga() == 0L) + return true; + return false; + } + if (fieldname.equals("colpoFinaleRiga")) { + if ((getFlgStatoLavorazioneRiga() == 10L || + getFlgStatoLavorazioneRiga() == 20L) && getColpoInizialeRiga() > 0L) + return true; + return false; + } + return true; + } + + public RigaDocumento findTelaioOccupato(long l_id_telaio) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A "; + String s_Sql_Order = " order by A.tsInizioLavorazioneRiga desc"; + WcString wc = new WcString(); + wc.addWc("(A.flgStatoLavorazioneRiga=10 or A.flgStatoLavorazioneRiga=20)"); + wc.addWc("A.id_telaio=" + l_id_telaio); + wc.addWc("A.id_rigaDocumento <>" + getId_rigaDocumento()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt, 1, 1); + if (vec.hasMoreElements()) + return (RigaDocumento)vec.nextElement(); + return new RigaDocumento(); + } catch (SQLException e) { + handleDebug(e); + return new RigaDocumento(); + } + } + + public long getNumTeli() { + long totCapi = (long)getDocumento().getTotNr(); + return totCapi / getCapiPerTelo(); + } + + public long getNumTeliRiga(long l_capiPerTelo) { + long totCapi = (long)getNr(); + return totCapi / l_capiPerTelo; + } + + public boolean isNumeroTeliOk() { + if (getNumTeli() <= getArticoloTessuto().getNumTeliMax()) + return true; + return false; + } + + public long getNumTeliRiga() { + return this.numTeliRiga; + } + + public void setNumTeliRiga(long numTeliRiga) { + this.numTeliRiga = numTeliRiga; + } + + public long getFlgDaCancellare() { + return this.flgDaCancellare; + } + + public void setFlgDaCancellare(long flgDaCancellare) { + this.flgDaCancellare = flgDaCancellare; + } + + public ResParm impostaDaCancellareByDocumentoCodiceriga(long l_id_documento, long l_flgCodiceRiga, boolean daCancellare) { + String s_Sql_Find = "UPDATE RIGA_DOCUMENTO as A SET flgDaCancellare=" + (daCancellare ? "1" : "0"); + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + wc.addWc("A.flgCodiceRiga=" + l_flgCodiceRiga); + return update(s_Sql_Find + s_Sql_Find); + } + + public NumeroTeliRiga getNumeroTeliRigaByArticolo(long l_id_rigaDocumentoArticolo) { + if (this.numeroTeliRiga == null || this.numeroTeliRiga.getId_rigaDocumentoArticolo() != l_id_rigaDocumentoArticolo) { + this.numeroTeliRiga = new NumeroTeliRiga(getApFull()); + this.numeroTeliRiga.findByRDArticoloRDTessuto(l_id_rigaDocumentoArticolo, getId_rigaDocumento()); + } + return (this.numeroTeliRiga == null) ? new NumeroTeliRiga(getApFull()) : this.numeroTeliRiga; + } + + public long getNumeroCapiByTeliRigaArticolo(long l_id_rigaDocumentoArticolo) { + return getNumeroTeliRigaByArticolo(l_id_rigaDocumentoArticolo).getNumTeliRiga() * getCapiPerTelo(); + } + + public void setNumeroTeliRiga(NumeroTeliRiga numeroTeliRiga) { + this.numeroTeliRiga = numeroTeliRiga; + } + + public String getDescrizioneArticoliCompleta(String lang) { + String star = "", sn = ""; + StringBuilder l_descrizioneRiga = new StringBuilder(); + if (getId_articoloVariante() != 0L) { + l_descrizioneRiga.append(getArticoloVariante().getDescrizione(lang)); + } else if (getId_articolo() != 0L) { + l_descrizioneRiga.append(getArticolo().getDescrizione(lang)); + } + if (getId_articoloTessutoColore() != 0L) { + l_descrizioneRiga.append(getArticoloTessutoColore().getDescrizione(lang)); + } else if (getId_articoloTessuto() != 0L) { + l_descrizioneRiga.append(getArticoloTessuto().getDescrizione(lang)); + } + if (getId_articoloFilatoColore() != 0L) + l_descrizioneRiga.append(getArticoloFilatoColore().getDescrizione(lang)); + if (l_descrizioneRiga.length() == 0) { + l_descrizioneRiga.append(getDescrizioneRiga()); + star = "*"; + } + if (getId_articoloFilatoColore() != 0L) { + sn = translate(" lotto: ", lang); + } else { + sn = translate(" s/n: ", lang); + } + if (getSeriale().isEmpty()) + return String.valueOf(l_descrizioneRiga) + String.valueOf(l_descrizioneRiga); + return String.valueOf(l_descrizioneRiga) + String.valueOf(l_descrizioneRiga) + star + sn; + } + + public double getDatiTelaioInLavorazione(long l_id_telaio) { + String s_Sql_Find = "select sum(A.quantita) as _sum from RIGA_DOCUMENTO AS A , DOCUMENTO AS B"; + String s_Sql_order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_documento=B.id_documento"); + wc.addWc("A.id_telaio=" + l_id_telaio); + wc.addWc("(A.flgStatoLavorazioneRiga =10 or A.flgStatoLavorazioneRiga =20)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return getSum(stmt); + } catch (Exception e) { + handleDebug(e, 0); + return 0.0D; + } + } + + public double getNrOriginale() { + return this.nrOriginale; + } + + public void setNrOriginale(double nrOriginale) { + this.nrOriginale = nrOriginale; + } + + public boolean isTessutoPrincipale(long l_id_articoloTessuto, long l_id_articoloTessutoColore) { + if (getId_articoloVariante() > 0L) + return getArticoloVariante().isTessutoPrincipale(l_id_articoloTessuto, l_id_articoloTessutoColore); + if (getId_articolo() > 0L) + return getArticolo().isTessutoPrincipale(l_id_articoloTessutoColore, l_id_articoloTessutoColore); + return false; + } + + public double getMtTessutoXTaglio() { + if (getFlgCodiceRiga() == 100L) { + long totCapi = (long)getDocumento().getTotNr(); + ArticoloArticoloTessuto aat = new ArticoloArticoloTessuto(getApFull()); + if (getId_articoloTessutoColore() > 0L) { + aat.findByArticoloArticoloTessutoColoreBase(getDocumento().getId_articolo(), getId_articoloTessutoColore()); + } else { + aat.findByArticoloArticoloTessutoBase(getDocumento().getId_articolo(), getId_articoloTessuto()); + } + DoubleOperator dop = new DoubleOperator((float)totCapi); + dop.multiply(aat.getMtATT()); + return dop.getResult(); + } + return 0.0D; + } + + public NumeroTeliRiga getNumeroTeliRigaByTessuto(long l_id_rigaDocumentoTessuto) { + if (this.numeroTeliRiga == null || this.numeroTeliRiga.getId_rigaDocumentoTessuto() != l_id_rigaDocumentoTessuto) { + this.numeroTeliRiga = new NumeroTeliRiga(getApFull()); + this.numeroTeliRiga.findByRDArticoloRDTessuto(getId_rigaDocumento(), l_id_rigaDocumentoTessuto); + } + return (this.numeroTeliRiga == null) ? new NumeroTeliRiga(getApFull()) : this.numeroTeliRiga; + } + + public String getDescrizioneRigaRaggruppamento() { + return (this.descrizioneRigaRaggruppamento == null) ? "" : this.descrizioneRigaRaggruppamento.trim(); + } + + public void setDescrizioneRigaRaggruppamento(String descrizioneRigaRaggruppamento) { + this.descrizioneRigaRaggruppamento = descrizioneRigaRaggruppamento; + } + + public String getDescrizioneRigaDettaglio() { + return (this.descrizioneRigaDettaglio == null) ? "" : this.descrizioneRigaDettaglio.trim(); + } + + public void setDescrizioneRigaDettaglio(String descrizioneRigaDettaglio) { + this.descrizioneRigaDettaglio = descrizioneRigaDettaglio; + } + + public Vectumerator findReportVenditeByArticoloCR(ArticoloCR CR) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO as A inner join DOCUMENTO AS B on A.id_documento=B.id_documento inner join ARTICOLO AS C on A.id_articolo=C.id_articolo inner join TIPO_DOCUMENTO AS TD ON B.id_tipoDocumento=TD.id_tipoDocumento"; + String s_Sql_order = " order by C.codice"; + if (CR.getFlgEscludiWeb() >= 0L || CR.getId_tipo() != 0L || CR.getFlgNascondi() >= 0L || !CR.getFlgReport().isEmpty()) + s_Sql_Find = s_Sql_Find + " inner join TIPO AS T ON T.id_tipo=C.id_tipo"; + WcString wc = new WcString(); + wc.addWc("TD.flgMovMagazzino =-1"); + wc.addWc("(B.flgStatoOrdineWww is null or B.flgStatoOrdineWww <> 99)"); + if (!CR.getCodice().isEmpty()) + wc.addWc("C.codice like'" + CR.getCodice() + "%'"); + if (CR.getId_iva() != 0L) + wc.addWc("C.id_iva=" + CR.getId_iva()); + if (CR.getId_clifor() != 0L) + wc.addWc("C.id_fornitore=" + CR.getId_clifor()); + if (CR.getFlgQta() == 1L) + if (CR.getQtaDa() == 0L) { + wc.addWc("(C.quantita<=" + CR.getQtaA() + ")"); + } else { + wc.addWc("(C.quantita>=" + CR.getQtaDa() + ")"); + wc.addWc("(C.quantita<=" + CR.getQtaA() + ")"); + } + if (CR.getFlgUsato() >= 0L) + wc.addWc("C.flgUsato=" + CR.getFlgUsato()); + if (!CR.getScaffale().isEmpty()) + if (CR.getScaffale().indexOf("*") > 0) { + String temp = CR.getScaffale().replace("*", "%"); + wc.addWc("C.scaffale like'" + temp + "'"); + } else { + wc.addWc("C.scaffale ='" + CR.getScaffale() + "'"); + } + if (!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) + if (CR.getSearchTxt().startsWith(",")) { + wc.addWc("C.codiciAlternativi like'%" + CR.getSearchTxt() + ",%'"); + } else { + wc.addWc("(C.codice like'%" + CR.getSearchTxt() + "%' or C.descrizioneSearch like'%" + CR.getSearchTxt() + "%')"); + } + if (CR.getId_marca() != 0L) + wc.addWc("C.id_marca=" + CR.getId_marca()); + if (!CR.getDescrizione().isEmpty()) + wc.addWc("C.descrizione like'%" + CR.getDescrizione() + "%'"); + if (CR.getId_tipo() != 0L) + wc.addWc("(T.id_tipo=" + CR.getId_tipo() + " or T.indici like'%:" + CR.getId_tipo() + ":%')"); + if (CR.getFlgEscludiWeb() == 0L) { + wc.addWc("(C.flgEscludiWeb=0 or C.flgEscludiWeb is null)"); + } else if (CR.getFlgEscludiWeb() > 0L) { + wc.addWc("C.flgEscludiWeb=" + CR.getFlgEscludiWeb()); + } + if (CR.getFlgWebNoVendita() == 0L) { + wc.addWc("(C.flgWebNoVendita=0 or C.flgWebNoVendita is null)"); + } else if (CR.getFlgWebNoVendita() > 0L) { + wc.addWc("C.flgWebNoVendita=" + CR.getFlgWebNoVendita()); + } + if (CR.getFlgStockOfferte() > 0L) + if (CR.getFlgStockOfferte() == 99L) { + wc.addWc("(C.flgStockOfferte=1 and (CdataScadenzaOfferta is null or C.dataScadenzaOfferta>=?))"); + } else { + wc.addWc("C.flgStockOfferte=" + CR.getFlgStockOfferte()); + } + if (CR.getDataDocumentoDa() != null) + wc.addWc("B.dataDocumento>=?"); + if (CR.getDataDocumentoA() != null) + wc.addWc("B.dataDocumento<=? "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + int dataCount = 1; + if (CR.getDataDocumentoDa() != null) { + stmt.setDate(dataCount, CR.getDataDocumentoDa()); + dataCount++; + } + if (CR.getDataDocumentoA() != null) { + stmt.setDate(dataCount, CR.getDataDocumentoA()); + dataCount++; + } + Vectumerator vec = findRows(stmt); + return vec; + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_colore() { + return getArticoloTessutoColore().getId_colore(); + } + + public double getPrezzoIvato() { + return conIva(getImponibile(), (double)getIva().getAliquota()); + } + + public double getMSQtaCaricataScaricataByArticolo(long l_id_articolo, long l_flgMovMagazzino, Date dataDocumentoDa, Date dataDocumentoA) { + String s_Sql_Find = "select SUM(Z.quantita) AS _sum FROM RIGA_DOCUMENTO AS Z INNER JOIN DOCUMENTO AS B ON Z.id_documento = B.id_documento inner join TIPO_DOCUMENTO AS TD ON B.id_tipoDocumento=TD.id_tipoDocumento"; + WcString wc = new WcString(); + wc.addWc("TD.flgMovMagazzino =" + l_flgMovMagazzino); + wc.addWc("(B.flgStatoOrdineWww is null or B.flgStatoOrdineWww <> 99)"); + wc.addWc(" Z.id_articolo = " + l_id_articolo); + if (dataDocumentoDa != null) + wc.addWc("B.dataDocumento>=?"); + if (dataDocumentoA != null) + wc.addWc("B.dataDocumento<=?"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + int dataCount = 0; + if (dataDocumentoDa != null) { + dataCount++; + stmt.setDate(dataCount, dataDocumentoDa); + } + if (dataDocumentoA != null) { + dataCount++; + stmt.setDate(dataCount, dataDocumentoA); + } + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public double getMSQtaCaricataScaricataByArticolo(long l_id_articolo, long l_flgMovMagazzino) { + return getMSQtaCaricataScaricataByArticolo(l_id_articolo, l_flgMovMagazzino, null, null); + } + + public double getQtaPrelevabileByDocumento(long l_id_documento) { + String s_Sql_Find = "select sum(A.quantita-A.quantitaAssociata) as _sum from RIGA_DOCUMENTO AS A"; + WcString wc = new WcString(); + if (l_id_documento == 0L) + return 0.0D; + wc.addWc("A.id_documento=" + l_id_documento); + if (getId_articoloVariante() == 0L) { + wc.addWc("A.id_articolo=" + getId_articolo()); + } else { + wc.addWc("A.id_articoloVariante=" + getId_articoloVariante()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + double qdp = getSum(stmt); + return Math.min(qdp, getQuantitaRimanente()); + } catch (Exception e) { + handleDebug(e, 0); + return 0.0D; + } + } + + protected ResParm checkDeleteCascade() { + LavPezza lp = new LavPezza(this.apFull); + Vectumerator vecLp = lp.findByRigaDocumento(getId_rigaDocumento()); + if (vecLp.getTotNumberOfRecords() > 0) + return new ResParm(false, "Errore! Impossibile cancellare riga " + + getId_rigaDocumento() + ": record legato a 1 o piu' pezze (LAV_PEZZA)"); + return super.checkDeleteCascade(); + } + + public String getCCDescrizioneRigaCompleta() { + return getDescrizioneRigaCompleta().replace("/", "/ "); + } + + public boolean isScontoTroppoAlto() { + if (getId_articolo() == 0L) + return false; + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + if (attivita.getCheckCartPercScontoMax() <= 0.0D) + return false; + if (Math.abs(getPercScontoRispettoAlPrezzoBarrato()) > attivita.getCheckCartPercScontoMax()) + return true; + return false; + } + + public double getPercScontoRispettoAlPrezzoBarrato() { + if (getArticolo().getPrezzoIvatoBarrato() == 0.0D) + return 0.0D; + DoubleOperator dop = new DoubleOperator(getPrezzoPubblicoConIva()); + dop.setScale(2, 5); + dop.divide(getArticolo().getPrezzoIvatoBarrato()); + dop.multiply(100); + dop.subtract(100); + return dop.getResult(); + } + + public long getOrdine() { + return this.ordine; + } + + public void setOrdine(long ordine) { + this.ordine = ordine; + } + + public long getId_articoloFilatoColoreRitorto() { + return this.id_articoloFilatoColoreRitorto; + } + + public void setId_articoloFilatoColoreRitorto(long id_articoloFilatoColoreRitorto) { + this.id_articoloFilatoColoreRitorto = id_articoloFilatoColoreRitorto; + } + + public ArticoloFilatoColore getArticoloFilatoColore() { + this.articoloFilatoColore = (ArticoloFilatoColore)getSecondaryObject(this.articoloFilatoColore, ArticoloFilatoColore.class, + getId_articoloFilatoColore()); + return this.articoloFilatoColore; + } + + public void setArticoloFilatoColoreRitorto(ArticoloFilatoColoreRitorto articoloFilatoColoreRitorto) { + this.articoloFilatoColoreRitorto = articoloFilatoColoreRitorto; + setArticoloFilatoColoreRitorto(null); + } + + public long getId_articoloFilato() { + return this.id_articoloFilato; + } + + public void setId_articoloFilato(long id_articoloFilato) { + this.id_articoloFilato = id_articoloFilato; + } + + public long getId_rigaDocumentoTessutoA() { + return this.id_rigaDocumentoTessutoA; + } + + public void setId_rigaDocumentoTessutoA(long id_rigaDocumentoTessuto) { + this.id_rigaDocumentoTessutoA = id_rigaDocumentoTessuto; + setRigaDocumentoTessutoA(null); + } + + public Vectumerator findByDocumentoArticolo(long l_id_documento, long l_id_articolo) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO AS A left join ARTICOLO AS B on A.id_articolo=B.id_articolo "; + String s_Sql_order = " order by A.id_rigaDocumento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + if (l_id_articolo == 0L) { + wc.addWc("(A.id_articolo is null or A.id_articolo=0)"); + } else { + wc.addWc("A.id_articolo=" + l_id_articolo); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e, 0); + return AB_EMPTY_VECTUMERATOR; + } + } + + public RigaDocumento getRigaDocumentoTessutoA() { + this.rigaDocumentoTessutoA = (RigaDocumento)getSecondaryObject(this.rigaDocumentoTessutoA, RigaDocumento.class, + getId_rigaDocumentoTessutoA()); + return this.rigaDocumentoTessutoA; + } + + public void setRigaDocumentoTessutoA(RigaDocumento rigaDocumentoTessutoA) { + this.rigaDocumentoTessutoA = rigaDocumentoTessutoA; + } + + public void findMagTessutoDisponibilitaOld(long l_id_articoloTessuto, long l_id_articoloTessutoColore, String l_seriale, long l_tipologia_magfisico, long l_id_clifor, Date dataA) { + String s_Sql_Sum = " SUM(A.kg*segnoMov) as kg, SUM(A.mt*segnoMov) as mt, SUM(A.nr*segnoMov) as nr from RIGA_DOCUMENTO AS A "; + String s_Sql_colonne = ""; + String s_Sql_join = ""; + WcString wc = new WcString(); + wc.addWc("A.id_magFisico>0"); + if (l_id_articoloTessuto > 0L) + s_Sql_Sum = s_Sql_Sum + " inner join ARTICOLO_TESSUTO AS F ON A.id_articoloTessuto=F.id_articoloTessuto"; + if (l_id_articoloTessuto != 0L) { + wc.addWc(" A.id_articoloTessuto = " + l_id_articoloTessuto); + s_Sql_colonne = s_Sql_colonne + " A.id_articoloTessuto,"; + } + if (l_id_articoloTessutoColore != 0L) { + wc.addWc(" A.id_articoloTessutoColore = " + l_id_articoloTessutoColore); + s_Sql_colonne = s_Sql_colonne + " A.id_articoloTessutoColore,"; + } + if (l_seriale != null && !l_seriale.isEmpty()) { + wc.addWc(" A.seriale = " + l_seriale); + s_Sql_colonne = s_Sql_colonne + " A.seriale,"; + } + if (l_id_clifor != 0L) { + wc.addWc(" A.id_clifor = " + l_id_clifor); + s_Sql_colonne = s_Sql_colonne + " A.id_clifor,"; + } + if (dataA != null) { + s_Sql_join = " INNER JOIN DOCUMENTO AS DOC ON A.id_documento=DOC.id_documento "; + wc.addWc(" DOC.dataDocumento <= ?"); + s_Sql_Sum = s_Sql_Sum + s_Sql_Sum; + } + if (l_tipologia_magfisico != 0L) { + wc.addWc(" B.flgTipo = " + l_tipologia_magfisico); + s_Sql_colonne = s_Sql_colonne + " A.id_magFisico,"; + s_Sql_Sum = s_Sql_Sum + ", MAG_FISICO AS B"; + wc.addWc(" A.id_magFisico = B.id_magFisico "); + } + String s_sql_groupby = ""; + if (!s_Sql_colonne.isEmpty()) + s_sql_groupby = " group by " + s_Sql_colonne.substring(0, s_Sql_colonne.length() - 1); + try { + PreparedStatement stmt = getConn() + .prepareStatement("select " + s_Sql_colonne + s_Sql_Sum + wc.toString() + s_sql_groupby); + if (dataA != null) + stmt.setDate(1, dataA); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public RigaDocumento() {} +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoCR.java new file mode 100644 index 00000000..278318ad --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoCR.java @@ -0,0 +1,710 @@ +package it.acxent.contab; + +import it.acxent.anag.Clifor; +import it.acxent.anag.Iva; +import it.acxent.anag.MagFisico; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloVariante; +import it.acxent.art.Marca; +import it.acxent.art.Taglia; +import it.acxent.art.Tipo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class RigaDocumentoCR extends CRAdapter { + public static long RICERCA_SOLO_MAGAZZINO = 2L; + + public static long RICERCA_SOLO_RIGHE_DOC = 1L; + + private long id_rigaDocumento; + + private long id_documento; + + private long id_articolo; + + private long id_articoloVariante; + + private long id_iva; + + private long id_magFisico; + + private long id_taglia; + + private String descrizioneCodiceRiga; + + private double imponibile; + + private long flgTipoRicerca = 1L; + + private String quantita; + + private String codiceCartellinoIniziale; + + private String noteRiga; + + private Documento documento; + + private Articolo articolo; + + private ArticoloVariante articoloVariante; + + private Iva iva; + + private MagFisico magFisico; + + private Taglia taglia; + + private Date dataDocumentoA; + + private Date dataDocumentoDa; + + private long flgStato = 1L; + + private long id_clifor; + + private long id_esercizio; + + private long id_tipoDocumento; + + private long progDocumento; + + private Clifor clifor; + + private String seriale; + + private long flgUdm; + + private long flgStatoPrenotazione = -1L; + + private long flgRigaPrelevata = -1L; + + private String testoMessaggio; + + private long flgTipoMovimento = 0L; + + private String fileName; + + private long id_tipo; + + private Tipo tipo; + + private Date dataRiferimentoDa; + + private Date dataRiferimentoA; + + private boolean flgRicercaNonOrdinati = false; + + private long flgArticoliConQuantita; + + private long flgTipologia; + + private long id_marca; + + private Marca marca; + + private long flgRicercaMag = RICERCA_SOLO_RIGHE_DOC; + + private long flgInMagazzino = -1L; + + private long flgTipoMagazzino; + + private long id_articoloFilato; + + private long id_articoloTaglia; + + private double percL1; + + private double percL2; + + private double percL3; + + private String riferimento; + + private long flgStatoLavorazioneRiga = -2L; + + private long flgStatoLavorazione = -2L; + + private String descrizioneRiga; + + private long id_tipologiaDocumento; + + private long id_tipoStampaDocumento; + + private TipologiaDocumento tipologiaDocumento; + + private TipoStampaDocumento tipoStampaDocumento; + + private long flgNoSeriale; + + private long flgCodiceRiga = 0L; + + private long flgDaCancellare = -1L; + + public static final long IN_MAGAZZINO = 1L; + + public static final long IN_MAGAZZINO_O_NEGATIVO = 3L; + + public static final long MAGAZZINO_NEGATIVO = 2L; + + public static final long TIPO_RICERCA_NORMALE = 0L; + + public static final long TIPO_RICERCA_COMPATTA = 1L; + + public static final long ORDER_BY_DATA_DOC_ASC = 5L; + + public static final long ORDER_BY_TIPO_ARTICOLO = 9L; + + public static final long ORDER_BY_RIFERIMENTO_DOC = 10L; + + public RigaDocumentoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RigaDocumentoCR() {} + + public void setId_rigaDocumento(long newId_rigaDocumento) { + this.id_rigaDocumento = newId_rigaDocumento; + } + + public void setId_documento(long newId_documento) { + this.id_documento = newId_documento; + setDocumento(null); + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setId_articoloVariante(long newId_articoloVariante) { + this.id_articoloVariante = newId_articoloVariante; + setArticoloVariante(null); + } + + public void setId_iva(long newId_iva) { + this.id_iva = newId_iva; + setIva(null); + } + + public void setId_magFisico(long newId_magFisico) { + this.id_magFisico = newId_magFisico; + setMagFisico(null); + } + + public void setId_taglia(long newId_taglia) { + this.id_taglia = newId_taglia; + setTaglia(null); + } + + public void setSeriale(String newSeriale) { + this.seriale = newSeriale; + } + + public void setImponibile(double newImponibile) { + this.imponibile = newImponibile; + } + + public void setFlgUdm(long newFlgUdm) { + this.flgUdm = newFlgUdm; + } + + public void setQuantita(String newQuantita) { + this.quantita = newQuantita; + } + + public void setDescrizioneRiga(String newDescrizioneRiga) { + this.descrizioneRiga = newDescrizioneRiga; + } + + public void setNoteRiga(String newNoteRiga) { + this.noteRiga = newNoteRiga; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public long getId_documento() { + return this.id_documento; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public long getId_iva() { + return this.id_iva; + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public long getId_taglia() { + return this.id_taglia; + } + + public String getSeriale() { + return (this.seriale == null) ? "" : this.seriale.trim(); + } + + public double getImponibile() { + return this.imponibile; + } + + public long getFlgUdm() { + return this.flgUdm; + } + + public String getQuantita() { + return (this.quantita == null) ? "" : this.quantita.trim(); + } + + public String getDescrizioneRiga() { + return (this.descrizioneRiga == null) ? "" : this.descrizioneRiga.trim(); + } + + public String getNoteRiga() { + return (this.noteRiga == null) ? "" : this.noteRiga.trim(); + } + + public void setDocumento(Documento newDocumento) { + this.documento = newDocumento; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento()); + return this.documento; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public void setArticoloVariante(ArticoloVariante newArticoloVariante) { + this.articoloVariante = newArticoloVariante; + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante()); + return this.articoloVariante; + } + + public void setIva(Iva newIva) { + this.iva = newIva; + } + + public Iva getIva() { + this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, getId_iva()); + return this.iva; + } + + public void setMagFisico(MagFisico newMagFisico) { + this.magFisico = newMagFisico; + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico()); + return this.magFisico; + } + + public void setTaglia(Taglia newTaglia) { + this.taglia = newTaglia; + } + + public Taglia getTaglia() { + this.taglia = (Taglia)getSecondaryObject(this.taglia, Taglia.class, getId_taglia()); + return this.taglia; + } + + public Date getDataDocumentoDa() { + return this.dataDocumentoDa; + } + + public void setDataDocumentoDa(Date dataDocumentoDa) { + this.dataDocumentoDa = dataDocumentoDa; + } + + public Date getDataDocumentoA() { + return this.dataDocumentoA; + } + + public void setDataDocumentoA(Date dataDocumentoA) { + this.dataDocumentoA = dataDocumentoA; + } + + public long getFlgStato() { + return this.flgStato; + } + + public void setFlgStato(long flgStato) { + this.flgStato = flgStato; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + setClifor(null); + } + + public long getId_esercizio() { + return this.id_esercizio; + } + + public void setId_esercizio(long id_esercizio) { + this.id_esercizio = id_esercizio; + } + + public long getId_tipoDocumento() { + return this.id_tipoDocumento; + } + + public void setId_tipoDocumento(long id_tipoDocumento) { + this.id_tipoDocumento = id_tipoDocumento; + } + + public long getProgDocumento() { + return this.progDocumento; + } + + public void setProgDocumento(long progDocumento) { + this.progDocumento = progDocumento; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setClifor(Clifor clifor) { + this.clifor = clifor; + } + + public String getDescrizioneCompletaArticolo() { + if (getId_articoloVariante() != 0L) + return getArticoloVariante().getDescrizioneCompleta(); + return getArticolo().getDescrizioneCompleta(); + } + + public static final String getStato(long l_flgStato) { + return DocumentoCR.getStato(l_flgStato); + } + + public long getFlgTipoRicerca() { + return this.flgTipoRicerca; + } + + public void setFlgTipoRicerca(long flgTipoRicerca) { + this.flgTipoRicerca = flgTipoRicerca; + } + + public long getFlgStatoPrenotazione() { + return this.flgStatoPrenotazione; + } + + public void setFlgStatoPrenotazione(long flgStatoPrenotazione) { + this.flgStatoPrenotazione = flgStatoPrenotazione; + } + + public long getFlgRigaPrelevata() { + return this.flgRigaPrelevata; + } + + public void setFlgRigaPrelevata(long flgRigaPrelevata) { + this.flgRigaPrelevata = flgRigaPrelevata; + } + + public String getTestoMessaggio() { + return (this.testoMessaggio == null) ? AB_EMPTY_STRING : this.testoMessaggio.trim(); + } + + public void setTestoMessaggio(String messaggioSms) { + this.testoMessaggio = messaggioSms; + } + + public long getFlgTipoMovimento() { + return this.flgTipoMovimento; + } + + public void setFlgTipoMovimento(long flgTipoMovimento) { + this.flgTipoMovimento = flgTipoMovimento; + } + + public String getFileName() { + return (this.fileName == null) ? AB_EMPTY_STRING : this.fileName.trim(); + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public void setId_tipo(long id_tipo) { + this.id_tipo = id_tipo; + setTipo(null); + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo()); + return this.tipo; + } + + public void setTipo(Tipo tipo) { + this.tipo = tipo; + } + + public Date getDataRiferimentoDa() { + return this.dataRiferimentoDa; + } + + public void setDataRiferimentoDa(Date dataRiferimentoDa) { + this.dataRiferimentoDa = dataRiferimentoDa; + } + + public Date getDataRiferimentoA() { + return this.dataRiferimentoA; + } + + public void setDataRiferimentoA(Date dataRiferimentoA) { + this.dataRiferimentoA = dataRiferimentoA; + } + + public boolean getFlgRicercaNonOrdinati() { + return this.flgRicercaNonOrdinati; + } + + public void setFlgRicercaNonOrdinati(boolean flgRicercaNonOrdinati) { + this.flgRicercaNonOrdinati = flgRicercaNonOrdinati; + } + + public long getFlgArticoliConQuantita() { + return this.flgArticoliConQuantita; + } + + public void setFlgArticoliConQuantita(long flgArticoliConQuantita) { + this.flgArticoliConQuantita = flgArticoliConQuantita; + } + + public long getFlgNoSeriale() { + return this.flgNoSeriale; + } + + public void setFlgNoSeriale(long flgNoSeriale) { + this.flgNoSeriale = flgNoSeriale; + } + + public long getId_marca() { + return this.id_marca; + } + + public Marca getMarca() { + return (Marca)getSecondaryObject(this.marca, Marca.class, new Long(getId_marca())); + } + + public void setId_marca(long newId_marca) { + this.id_marca = newId_marca; + setMarca(null); + } + + public void setMarca(Marca newMarca) { + this.marca = newMarca; + } + + public long getFlgRicercaMag() { + return this.flgRicercaMag; + } + + public void setFlgRicercaMag(long flgRicercaMag) { + this.flgRicercaMag = flgRicercaMag; + } + + public long getFlgInMagazzino() { + return this.flgInMagazzino; + } + + public void setFlgInMagazzino(long flgInMagazzino) { + this.flgInMagazzino = flgInMagazzino; + } + + public long getFlgTipoMagazzino() { + return this.flgTipoMagazzino; + } + + public void setFlgTipoMagazzino(long flgTipoMagazzino) { + this.flgTipoMagazzino = flgTipoMagazzino; + } + + public long getId_articoloFilato() { + return this.id_articoloFilato; + } + + public void setId_articoloFilato(long id_articoloFilato) { + this.id_articoloFilato = id_articoloFilato; + } + + public long getId_articoloTaglia() { + return this.id_articoloTaglia; + } + + public void setId_articoloTaglia(long id_articoloTaglia) { + this.id_articoloTaglia = id_articoloTaglia; + } + + public double getPercL1() { + return this.percL1; + } + + public double getPercL2() { + return this.percL2; + } + + public double getPercL3() { + return this.percL3; + } + + public void setPercL1(double percL1) { + this.percL1 = percL1; + } + + public void setPercL2(double percL2) { + this.percL2 = percL2; + } + + public void setPercL3(double percL3) { + this.percL3 = percL3; + } + + public String getRiferimento() { + return (this.riferimento == null) ? AB_EMPTY_STRING : this.riferimento.trim(); + } + + public void setRiferimento(String riferimento) { + this.riferimento = riferimento; + } + + public String getDescrizioneCodiceRiga() { + return (this.descrizioneCodiceRiga == null) ? AB_EMPTY_STRING : this.descrizioneCodiceRiga.trim(); + } + + public void setDescrizioneCodiceRiga(String descrizioneCodiceRiga) { + this.descrizioneCodiceRiga = descrizioneCodiceRiga; + } + + public long getFlgStatoLavorazioneRiga() { + return this.flgStatoLavorazioneRiga; + } + + public void setFlgStatoLavorazioneRiga(long flgStatoLavorazione) { + this.flgStatoLavorazioneRiga = flgStatoLavorazione; + } + + public static final String getStatoLavorazione(long l_flgStatoLavorazione) { + return Documento.getStatoLavorazione(l_flgStatoLavorazione); + } + + public String getStatoLavorazione() { + return Documento.getStatoLavorazione(getFlgStatoLavorazioneRiga()); + } + + public String getCodiceCartellinoIniziale() { + return (this.codiceCartellinoIniziale == null) ? AB_EMPTY_STRING : this.codiceCartellinoIniziale.trim(); + } + + public void setCodiceCartellinoIniziale(String codiceCartellinoIniziale) { + this.codiceCartellinoIniziale = codiceCartellinoIniziale; + } + + public long getId_tipologiaDocumento() { + return this.id_tipologiaDocumento; + } + + public long getId_tipoStampaDocumento() { + return this.id_tipoStampaDocumento; + } + + public TipologiaDocumento getTipologiaDocumento() { + this.tipologiaDocumento = (TipologiaDocumento)getSecondaryObject(this.tipologiaDocumento, TipologiaDocumento.class, + getId_tipologiaDocumento()); + return this.tipologiaDocumento; + } + + public TipoStampaDocumento getTipoStampaDocumento() { + this.tipoStampaDocumento = (TipoStampaDocumento)getSecondaryObject(this.tipoStampaDocumento, TipoStampaDocumento.class, + getId_tipoStampaDocumento()); + return this.tipoStampaDocumento; + } + + public void setId_tipologiaDocumento(long newId_tipologiaDocumento) { + this.id_tipologiaDocumento = newId_tipologiaDocumento; + setTipologiaDocumento(null); + } + + public void setId_tipoStampaDocumento(long newId_tipoStampaDocumento) { + this.id_tipoStampaDocumento = newId_tipoStampaDocumento; + setTipoStampaDocumento(null); + } + + public void setTipologiaDocumento(TipologiaDocumento newTipologiaDocumento) { + this.tipologiaDocumento = newTipologiaDocumento; + } + + public void setTipoStampaDocumento(TipoStampaDocumento newTipoStampaDocumento) { + this.tipoStampaDocumento = newTipoStampaDocumento; + } + + public long getFlgTipologia() { + return this.flgTipologia; + } + + public void setFlgTipologia(long flgTipologia) { + this.flgTipologia = flgTipologia; + } + + public long getFlgCodiceRiga() { + return this.flgCodiceRiga; + } + + public void setFlgCodiceRiga(long flgCodiceRiga) { + this.flgCodiceRiga = flgCodiceRiga; + } + + public long getFlgStatoLavorazione() { + return this.flgStatoLavorazione; + } + + public void setFlgStatoLavorazione(long flgStatoLavorazione) { + this.flgStatoLavorazione = flgStatoLavorazione; + } + + public String getStatoLavorazioneRiga() { + return Documento.getStatoLavorazione(getFlgStatoLavorazioneRiga()); + } + + public static final String getStatoLavorazioneRiga(long l_flgStatoLavorazione) { + return Documento.getStatoLavorazione(l_flgStatoLavorazione); + } + + public long getFlgDaCancellare() { + return this.flgDaCancellare; + } + + public void setFlgDaCancellare(long flgDaCancellare) { + this.flgDaCancellare = flgDaCancellare; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoInterface.java new file mode 100644 index 00000000..d0a1144d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoInterface.java @@ -0,0 +1,24 @@ +package it.acxent.contab; + +import it.acxent.anag.IvaInterface; +import it.acxent.db.ApplParmFull; + +public interface RigaDocumentoInterface { + IvaInterface getIva(); + + double getRDITotImponibile(); + + double getRDITotImposta(); + + double getRDITotCosto(); + + boolean isRDIPIva(); + + boolean isRDINotaCredito(); + + double getRDITotImponibileRM(); + + String getFEEsigibilitaIva(); + + ApplParmFull getApFull(); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoItemPdf.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoItemPdf.java new file mode 100644 index 00000000..60b45fca --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoItemPdf.java @@ -0,0 +1,71 @@ +package it.acxent.contab; + +import com.lowagie.text.Font; +import java.util.ArrayList; + +public class RigaDocumentoItemPdf { + private int colSpan; + + private String desc; + + private Font pdfFont; + + private int cellAlign = 0; + + public RigaDocumentoItemPdf(int colSpan, String desc, Font theFont) { + this.colSpan = colSpan; + this.desc = desc; + this.pdfFont = theFont; + } + + public RigaDocumentoItemPdf(int colSpan, String desc, Font theFont, int theCellAlign) { + this.colSpan = colSpan; + this.desc = desc; + this.pdfFont = theFont; + this.cellAlign = theCellAlign; + } + + public int getColSpan() { + return this.colSpan; + } + + public void setColSpan(int colSpan) { + this.colSpan = colSpan; + } + + public String getDesc() { + return (this.desc == null) ? "" : this.desc.trim(); + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public Font getPdfFont() { + return this.pdfFont; + } + + public void setPdfFont(Font theFont) { + this.pdfFont = theFont; + } + + public static final ArrayList getArrayListNota(String nota, int idColDesc, int[] colSpan, Font PDF_f) { + ArrayList res = new ArrayList<>(); + for (int i = 0; i < colSpan.length; i++) { + if (i == idColDesc) { + res.add(new RigaDocumentoItemPdf(colSpan[i], nota.trim(), PDF_f)); + } else { + res.add(new RigaDocumentoItemPdf(colSpan[i], "", PDF_f)); + } + } + return res; + } + + public int getCellAlign() { + return this.cellAlign; + } + + public void setCellAlign(int cellAlign) { + this.cellAlign = cellAlign; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoP.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoP.java new file mode 100644 index 00000000..0e52838c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoP.java @@ -0,0 +1,338 @@ +package it.acxent.contab; + +import it.acxent.anag.MagFisico; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.HashMap; + +public class RigaDocumentoP extends _ContabAdapter implements Serializable { + private static final long serialVersionUID = 1068781847344225625L; + + private long id_documento; + + private long id_rigaDocumento; + + private long id_rigaDocumentoPrelevata; + + private double quantitaPrelevata; + + private Documento documento; + + private RigaDocumento rigaDocumento; + + private RigaDocumento rigaDocumentoPrelevata; + + private long id_rigaDocumentoP; + + public RigaDocumentoP(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RigaDocumentoP() {} + + public void setId_documento(long newId_documento) { + this.id_documento = newId_documento; + setDocumento(null); + } + + public void setId_rigaDocumento(long newId_rigaDocumento) { + this.id_rigaDocumento = newId_rigaDocumento; + setRigaDocumento(null); + } + + public void setId_rigaDocumentoPrelevata(long newId_rigaDocumentoPrelevata) { + this.id_rigaDocumentoPrelevata = newId_rigaDocumentoPrelevata; + setRigaDocumentoPrelevata(null); + } + + public void setQuantitaPrelevata(double newQuantitaPrelevata) { + this.quantitaPrelevata = newQuantitaPrelevata; + } + + public long getId_documento() { + return this.id_documento; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public long getId_rigaDocumentoPrelevata() { + return this.id_rigaDocumentoPrelevata; + } + + public double getQuantitaPrelevata() { + return this.quantitaPrelevata; + } + + public void setDocumento(Documento newDocumento) { + this.documento = newDocumento; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento()); + return this.documento; + } + + public void setRigaDocumento(RigaDocumento newRigaDocumento) { + this.rigaDocumento = newRigaDocumento; + } + + public RigaDocumento getRigaDocumento() { + this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, getId_rigaDocumento()); + return this.rigaDocumento; + } + + public void setRigaDocumentoPrelevata(RigaDocumento newRigaDocumentoPrelevata) { + this.rigaDocumentoPrelevata = newRigaDocumentoPrelevata; + } + + public RigaDocumento getRigaDocumentoPrelevata() { + this.rigaDocumentoPrelevata = (RigaDocumento)getSecondaryObject(this.rigaDocumentoPrelevata, RigaDocumento.class, + getId_rigaDocumentoPrelevata()); + return this.rigaDocumentoPrelevata; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(RigaDocumentoPCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO_P AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm delete() { + RigaDocumento rd = getRigaDocumento(); + RigaDocumento rdP = getRigaDocumentoPrelevata(); + long id_rigaDocumentoP = getId_rigaDocumentoP(); + ResParm rp = super.delete(); + if (rp.getStatus()) { + rdP.setFlgRigaPrelevata(0L); + rdP.aggiornaQuantitaPrelevata(); + rdP.getDocumento().aggiornaFlgDocumentoPrelevato(0L); + rd.aggiornaQuantitaAssociata(); + RigaDocumento.cancellaMovimento(rd, rdP.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoPartenza(), + rdP.getDocumento().getTipoDocumento().getCausaleMagazzino().getId_magFisicoArrivo()); + rdP.getArticolo().resetCalcoloQuantita(); + } + return rp; + } + + public ResParm superDelete() { + ResParm rp = super.delete(); + return rp; + } + + public ResParm save() { + ResParm rp = super.save(); + if (rp.getStatus()) { + getRigaDocumentoPrelevata().aggiornaQuantitaPrelevata(); + getRigaDocumento().aggiornaQuantitaAssociata(); + } + return rp; + } + + public Vectumerator findByDocumento(long l_id_documento, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO_P AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByRigaDocumento(long l_id_rigaDocumento, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO_P AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumento=" + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByRigaDocumentoPrelevata(long l_id_rigaDocumentoPrelevata, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO_P AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumentoPrelevata=" + l_id_rigaDocumentoPrelevata); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByKey(RigaDocumentoPKey rdpK) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO_P AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumento=" + rdpK.getId_rigaDocumento()); + wc.addWc("A.id_rigaDocumentoPrelevata=" + rdpK.getId_rigaDocumentoPrelevata()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public long getId_rigaDocumentoP() { + return this.id_rigaDocumentoP; + } + + public void setId_rigaDocumentoP(long id_rigaDocumentoP) { + this.id_rigaDocumentoP = id_rigaDocumentoP; + } + + public double getQuantitaPrelevatoByRigaDocumentoPrelevata(long l_id_rigaDocumento) { + String s_Sql_Find = "select SUM(quantitaPrelevata) as _tot from RIGA_DOCUMENTO_P AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumentoPrelevata=" + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (double)getCount(stmt, "_tot"); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public void aggiustaOrdiniSuMovimenti() { + try { + HashMap ht = new HashMap<>(); + String s_Sql_Find = "SELECT A.* FROM RIGA_DOCUMENTO_P AS A WHERE A.id_rigaDocumentoPrelevata NOT IN (SELECT id_rigaDocumento FROM RIGA_DOCUMENTO)"; + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find); + Vectumerator vec = findRows(stmt, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumentoP rdp = (RigaDocumentoP)vec.nextElement(); + long id_articolo = rdp.getRigaDocumento().getId_articolo(); + Movimento mov = new Movimento(getApFull()); + mov.deleteP(rdp.getId_rigaDocumentoPrelevata()); + mov.setId_articolo(id_articolo); + mov.setId_articoloVariante(rdp.getRigaDocumento().getId_articoloVariante()); + mov.setId_articoloTaglia(rdp.getRigaDocumento().getId_articoloTaglia()); + mov.setId_clifor(rdp.getRigaDocumento().getDocumento().getId_clifor()); + mov.setId_causaleMagazzino(rdp.getRigaDocumento().getDocumento().getTipoDocumento().getId_causaleMagazzino()); + MagFisico mag = new MagFisico(getApFull()); + mag.findMagazzinoOrdinato(); + mov.setId_magFisico(mag.getId_magFisico()); + mov.setId_rigaDocumento(rdp.getId_rigaDocumento()); + if (rdp.getRigaDocumento().getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 1L) { + mov.setNr(-1.0D * rdp.getQuantitaPrelevata()); + } else if (rdp.getRigaDocumento().getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 2L) { + mov.setKg(-1.0D * rdp.getQuantitaPrelevata()); + } else if (rdp.getRigaDocumento().getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 3L) { + mov.setMt(-1.0D * rdp.getQuantitaPrelevata()); + } + mov.save(); + if (ht.containsKey(Long.valueOf(id_articolo))) { + long qta = ht.get(Long.valueOf(id_articolo)); + qta = (long)((double)qta + rdp.getQuantitaPrelevata()); + ht.put(Long.valueOf(id_articolo), Long.valueOf(qta)); + continue; + } + ht.put(Long.valueOf(id_articolo), Long.valueOf((long)rdp.getQuantitaPrelevata())); + } + } catch (SQLException e) { + handleDebug(e); + } + } + + public double getQuantitaPrelevatoByRigaDocumento(long l_id_rigaDocumento) { + String s_Sql_Find = "select SUM(quantitaPrelevata) as _tot from RIGA_DOCUMENTO_P AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumento=" + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (double)getCount(stmt, "_tot"); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public void aggiustaOrdiniSuRD() { + try { + int i = 0, j = 0; + int se1 = 10; + int se2 = 100; + String s_Sql_Find = "SELECT A.* FROM RIGA_DOCUMENTO_P AS A "; + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find); + Vectumerator vec = findRows(stmt, 0, 0); + while (vec.hasMoreElements()) { + RigaDocumentoP row = (RigaDocumentoP)vec.nextElement(); + if (row.getRigaDocumento().getId_rigaDocumento() == 0L || row.getRigaDocumentoPrelevata().getId_rigaDocumento() == 0L) { + row.delete(); + System.out.println("x"); + } else { + RigaDocumento rd = (RigaDocumento)row.getRigaDocumento().clone(); + rd.setId_rigaDocumento(0L); + rd.setDBState(0); + rd.setId_rigaDocumentoMov(row.getId_rigaDocumento()); + rd.setId_rigaDocumentoPrelevata(row.getId_rigaDocumentoPrelevata()); + MagFisico mag = new MagFisico(getApFull()); + mag.findMagazzinoOrdinato(); + rd.setId_magFisico(mag.getId_magFisico()); + rd.setSegnoMov(-1L); + if (row.getRigaDocumento().getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 1L) { + rd.setNr(row.getQuantitaPrelevata()); + } else if (row.getRigaDocumento().getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 2L) { + rd.setKg(row.getQuantitaPrelevata()); + } else if (row.getRigaDocumento().getArticolo().getTipo().getTipologiaArticolo().getFlgUdm() == 3L) { + rd.setMt(row.getQuantitaPrelevata()); + } + rd.setQuantitaPrelevata(row.getQuantitaPrelevata()); + rd.superSave(); + } + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println("" + i + " su " + i); + } + } catch (SQLException e) { + handleDebug(e); + } catch (Exception e) { + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPCR.java new file mode 100644 index 00000000..3deae715 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPCR.java @@ -0,0 +1,94 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class RigaDocumentoPCR extends CRAdapter { + private long id_documento; + + private long id_rigaDocumento; + + private long id_rigaDocumentoPrelevata; + + private double quantitaPrelevata; + + private Documento documento; + + private RigaDocumento rigaDocumento; + + private RigaDocumento rigaDocumentoPrelevata; + + public RigaDocumentoPCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RigaDocumentoPCR() {} + + public void setId_documento(long newId_documento) { + this.id_documento = newId_documento; + setDocumento(null); + } + + public void setId_rigaDocumento(long newId_rigaDocumento) { + this.id_rigaDocumento = newId_rigaDocumento; + setRigaDocumento(null); + } + + public void setId_rigaDocumentoPrelevata(long newId_rigaDocumentoPrelevata) { + this.id_rigaDocumentoPrelevata = newId_rigaDocumentoPrelevata; + setRigaDocumentoPrelevata(null); + } + + public void setQuantitaPrelevata(double newQuantitaPrelevata) { + this.quantitaPrelevata = newQuantitaPrelevata; + } + + public long getId_documento() { + return this.id_documento; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public long getId_rigaDocumentoPrelevata() { + return this.id_rigaDocumentoPrelevata; + } + + public double getQuantitaPrelevata() { + return this.quantitaPrelevata; + } + + public void setDocumento(Documento newDocumento) { + this.documento = newDocumento; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, + + getId_documento()); + return this.documento; + } + + public void setRigaDocumento(RigaDocumento newRigaDocumento) { + this.rigaDocumento = newRigaDocumento; + } + + public RigaDocumento getRigaDocumento() { + this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, + + getId_rigaDocumento()); + return this.rigaDocumento; + } + + public void setRigaDocumentoPrelevata(RigaDocumento newRigaDocumentoPrelevata) { + this.rigaDocumentoPrelevata = newRigaDocumentoPrelevata; + } + + public RigaDocumento getRigaDocumentoPrelevata() { + this.rigaDocumentoPrelevata = (RigaDocumento)getSecondaryObject(this.rigaDocumentoPrelevata, RigaDocumento.class, + + getId_rigaDocumentoPrelevata()); + return this.rigaDocumentoPrelevata; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPKey.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPKey.java new file mode 100644 index 00000000..3b820aff --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPKey.java @@ -0,0 +1,32 @@ +package it.acxent.contab; + +import java.io.Serializable; + +public class RigaDocumentoPKey implements Serializable { + private static final long serialVersionUID = -1567073687136477415L; + + private long id_rigaDocumento; + + private long id_rigaDocumentoPrelevata; + + public RigaDocumentoPKey(long newId_rigaDocumento, long newId_rigaDocumentoPrelevata) { + setId_rigaDocumento(newId_rigaDocumento); + setId_rigaDocumentoPrelevata(newId_rigaDocumentoPrelevata); + } + + public void setId_rigaDocumento(long newId_rigaDocumento) { + this.id_rigaDocumento = newId_rigaDocumento; + } + + public void setId_rigaDocumentoPrelevata(long newId_rigaDocumentoPrelevata) { + this.id_rigaDocumentoPrelevata = newId_rigaDocumentoPrelevata; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public long getId_rigaDocumentoPrelevata() { + return this.id_rigaDocumentoPrelevata; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPM.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPM.java new file mode 100644 index 00000000..2e6f8da6 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPM.java @@ -0,0 +1,161 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class RigaDocumentoPM extends _ContabAdapter implements Serializable { + private long id_rigaDocumento; + + private long id_rigaDocumentoPrelevata; + + private double quantitaPrelevata; + + private RigaDocumento rigaDocumento; + + private RigaDocumento rigaDocumentoPrelevata; + + public RigaDocumentoPM(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RigaDocumentoPM() {} + + public void setId_rigaDocumento(long newId_rigaDocumento) { + this.id_rigaDocumento = newId_rigaDocumento; + setRigaDocumento(null); + } + + public void setId_rigaDocumentoPrelevata(long newId_rigaDocumentoPrelevata) { + this.id_rigaDocumentoPrelevata = newId_rigaDocumentoPrelevata; + setRigaDocumentoPrelevata(null); + } + + public void setQuantitaPrelevata(double newQuantitaPrelevata) { + this.quantitaPrelevata = newQuantitaPrelevata; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public long getId_rigaDocumentoPrelevata() { + return this.id_rigaDocumentoPrelevata; + } + + public double getQuantitaPrelevata() { + return this.quantitaPrelevata; + } + + public void setRigaDocumento(RigaDocumento newRigaDocumento) { + this.rigaDocumento = newRigaDocumento; + } + + public RigaDocumento getRigaDocumento() { + this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, getId_rigaDocumento()); + return this.rigaDocumento; + } + + public void setRigaDocumentoPrelevata(RigaDocumento newRigaDocumentoPrelevata) { + this.rigaDocumentoPrelevata = newRigaDocumentoPrelevata; + } + + public RigaDocumento getRigaDocumentoPrelevata() { + this.rigaDocumentoPrelevata = (RigaDocumento)getSecondaryObject(this.rigaDocumentoPrelevata, RigaDocumento.class, + getId_rigaDocumentoPrelevata()); + return this.rigaDocumentoPrelevata; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(RigaDocumentoPCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO_P_M AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm delete() { + RigaDocumento rd = getRigaDocumento(); + RigaDocumento rdP = getRigaDocumentoPrelevata(); + ResParm rp = super.delete(); + return rp; + } + + public ResParm save() { + ResParm rp = super.save(); + return rp; + } + + public Vectumerator findByDocumento(long l_id_documento, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO_P_M AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_documento=" + l_id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByRigaDocumento(long l_id_rigaDocumento) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO_P_M AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumento=" + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findByRigaDocumentoPrelevata(long l_id_rigaDocumentoPrelevata) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO_P_M AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumentoPrelevata=" + l_id_rigaDocumentoPrelevata); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public static boolean isRigaPrenotazionePrelevata(RigaDocumento rd) { + RigaDocumentoPM rdpm = new RigaDocumentoPM(rd.getApFull()); + rdpm.findByRigaDocumentoPrelevata(rd.getId_rigaDocumento()); + if (rdpm.getDBState() == 1) + return true; + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPMCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPMCR.java new file mode 100644 index 00000000..f81b3a12 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPMCR.java @@ -0,0 +1,69 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class RigaDocumentoPMCR extends CRAdapter { + private long id_rigaDocumento; + + private long id_rigaDocumentoPrelevata; + + private double quantitaPrelevata; + + private RigaDocumento rigaDocumento; + + private RigaDocumento rigaDocumentoPrelevata; + + public RigaDocumentoPMCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RigaDocumentoPMCR() {} + + public void setId_rigaDocumento(long newId_rigaDocumento) { + this.id_rigaDocumento = newId_rigaDocumento; + setRigaDocumento(null); + } + + public void setId_rigaDocumentoPrelevata(long newId_rigaDocumentoPrelevata) { + this.id_rigaDocumentoPrelevata = newId_rigaDocumentoPrelevata; + setRigaDocumentoPrelevata(null); + } + + public void setQuantitaPrelevata(double newQuantitaPrelevata) { + this.quantitaPrelevata = newQuantitaPrelevata; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public long getId_rigaDocumentoPrelevata() { + return this.id_rigaDocumentoPrelevata; + } + + public double getQuantitaPrelevata() { + return this.quantitaPrelevata; + } + + public void setRigaDocumento(RigaDocumento newRigaDocumento) { + this.rigaDocumento = newRigaDocumento; + } + + public RigaDocumento getRigaDocumento() { + this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, + getId_rigaDocumento()); + return this.rigaDocumento; + } + + public void setRigaDocumentoPrelevata(RigaDocumento newRigaDocumentoPrelevata) { + this.rigaDocumentoPrelevata = newRigaDocumentoPrelevata; + } + + public RigaDocumento getRigaDocumentoPrelevata() { + this.rigaDocumentoPrelevata = (RigaDocumento)getSecondaryObject(this.rigaDocumentoPrelevata, RigaDocumento.class, + + getId_rigaDocumentoPrelevata()); + return this.rigaDocumentoPrelevata; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPMKey.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPMKey.java new file mode 100644 index 00000000..22b2b399 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoPMKey.java @@ -0,0 +1,30 @@ +package it.acxent.contab; + +import java.io.Serializable; + +public class RigaDocumentoPMKey implements Serializable { + private long id_rigaDocumento; + + private long id_rigaDocumentoPrelevata; + + public RigaDocumentoPMKey(long newId_rigaDocumento, long newId_rigaDocumentoPrelevata) { + setId_rigaDocumento(newId_rigaDocumento); + setId_rigaDocumentoPrelevata(newId_rigaDocumentoPrelevata); + } + + public void setId_rigaDocumento(long newId_rigaDocumento) { + this.id_rigaDocumento = newId_rigaDocumento; + } + + public void setId_rigaDocumentoPrelevata(long newId_rigaDocumentoPrelevata) { + this.id_rigaDocumentoPrelevata = newId_rigaDocumentoPrelevata; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public long getId_rigaDocumentoPrelevata() { + return this.id_rigaDocumentoPrelevata; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoProgettista.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoProgettista.java new file mode 100644 index 00000000..942e7ddf --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoProgettista.java @@ -0,0 +1,191 @@ +package it.acxent.contab; + +import it.acxent.anag.Clifor; +import it.acxent.anag._AnagAdapter; +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.Vectumerator; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class RigaDocumentoProgettista extends _AnagAdapter { + private long id_rigaDocumentoProgettista; + + private long id_rigaDocumento; + + private long id_cliforRDA; + + private double percRDA; + + private double importoRDA; + + private Clifor progettista; + + private RigaDocumento rigaDocumento; + + public RigaDocumentoProgettista() {} + + public RigaDocumentoProgettista(ApplParmFull newApplParm) { + super(newApplParm); + } + + public long getId_cliforRDA() { + return this.id_cliforRDA; + } + + public void setId_cliforRDA(long id_clifor) { + this.id_cliforRDA = id_clifor; + } + + public double getImportoRDA() { + if (getId_rigaDocumentoProgettista() > 0L && getId_rigaDocumento() > 0L && + this.importoRDA == -1.0D) { + DoubleOperator dp = new DoubleOperator(getRigaDocumento().getTotImponibileRigaConSconto()); + dp.setScale(2, 5); + dp.multiply(getPercRDA()); + dp.divide(100.0F); + this.importoRDA = dp.getResult(); + } + return (this.importoRDA == -1.0D) ? 0.0D : this.importoRDA; + } + + public void setImportoRDA(double importo) { + this.importoRDA = importo; + } + + public double getPercRDA() { + return this.percRDA; + } + + public void setPercRDA(double percArticolo) { + this.percRDA = percArticolo; + } + + public Vectumerator findByRigaDocumento(long id_rigaDocumento) { + String s_Sql_Find = "SELECT A.* FROM RIGA_DOCUMENTO_PROGETTISTA AS A "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_rigaDocumento = " + id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByDocumento(long id_documento) { + String s_Sql_Find = "SELECT A.* FROM RIGA_DOCUMENTO_PROGETTISTA AS A INNER JOIN RIGA_DOCUMENTO AS B ON A.id_rigaDocumento = B.id_rigaDocumento INNER JOIN DOCUMENTO AS C ON B.id_documento = C.id_documento "; + String s_Sql_Order = " order by id_rigaDocumento, id_articolo, id_cliforRDA, percRDA"; + WcString wc = new WcString(); + wc.addWc(" C.id_documento = " + id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_rigaDocumentoProgettista() { + return this.id_rigaDocumentoProgettista; + } + + public void setId_rigaDocumentoProgettista(long id_rigaDocumentoProgettista) { + this.id_rigaDocumentoProgettista = id_rigaDocumentoProgettista; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public void setId_rigaDocumento(long id_rigaDocumento) { + this.id_rigaDocumento = id_rigaDocumento; + setRigaDocumento(null); + } + + public Clifor getProgettista() { + this.progettista = new Clifor(getApFull()); + this.progettista.findByPrimaryKey(getId_cliforRDA()); + return this.progettista; + } + + public void setProgettista(Clifor clifor) { + this.progettista = clifor; + } + + public void findByRigaDocumentoProgettista(long id_rigaDocumento, long id_progettista) { + String s_Sql_Find = "SELECT A.* FROM RIGA_DOCUMENTO_PROGETTISTA AS A "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_rigaDocumento = " + id_rigaDocumento); + wc.addWc(" A.id_clifor = " + id_progettista); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + protected void initFields() { + super.initFields(); + this.importoRDA = -1.0D; + } + + public RigaDocumento getRigaDocumento() { + this.rigaDocumento = new RigaDocumento(getApFull()); + this.rigaDocumento.findByPrimaryKey(getId_rigaDocumento()); + return this.rigaDocumento; + } + + public void setRigaDocumento(RigaDocumento rigaDocumento) { + this.rigaDocumento = rigaDocumento; + } + + public Vectumerator findByCR(RigaDocumentoProgettistaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_DOCUMENTO_PROGETTISTA AS A inner join CLIFOR AS B on A.id_cliforRDA=B.id_clifor inner join RIGA_DOCUMENTO AS D ON A.id_rigaDocumento=D.id_rigaDocumento inner join DOCUMENTO as C on D.id_documento=C.id_documento"; + String s_Sql_Order = " order by B.cognome, B.nome, A.id_cliforRDA"; + WcString wc = new WcString(); + if (CR.getId_documento() != 0L) + wc.addWc("A.id_documento = " + CR.getId_documento()); + if (CR.getId_cliforDA() != 0L) + wc.addWc("A.id_cliforRDA = " + CR.getId_cliforDA()); + if (CR.getFlgPagata() == 0L) { + wc.addWc("(C.flgPagata is null or C.flgPagata=0)"); + } else if (CR.getFlgPagata() > 0L) { + wc.addWc("C.flgPagata =" + CR.getFlgPagata()); + } + if (CR.getDataDocumentoDa() != null) + wc.addWc("C.dataDocumento>=?"); + if (CR.getDataDocumentoA() != null) + wc.addWc("C.dataDocumento<=?"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + int dataCount = 0; + if (CR.getDataDocumentoDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoDa()); + } + if (CR.getDataDocumentoA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoA()); + } + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void deleteByRigaDocumento(long id_rigaDocumento) { + Vectumerator vec = new RigaDocumentoProgettista(getApFull()).findByRigaDocumento(id_rigaDocumento); + while (vec.hasMoreElements()) { + RigaDocumentoProgettista row = (RigaDocumentoProgettista)vec.nextElement(); + row.delete(); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoProgettistaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoProgettistaCR.java new file mode 100644 index 00000000..11010552 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaDocumentoProgettistaCR.java @@ -0,0 +1,108 @@ +package it.acxent.contab; + +import it.acxent.anag.Clifor; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class RigaDocumentoProgettistaCR extends CRAdapter { + private long id_documentoAgente; + + private long id_documento; + + private long id_cliforDA; + + private double percDocumentoAgente; + + private Documento documento; + + private Clifor agente; + + private Date dataDocumentoA; + + private Date dataDocumentoDa; + + private long flgPagata = -1L; + + public RigaDocumentoProgettistaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RigaDocumentoProgettistaCR() {} + + public long getId_documentoAgente() { + return this.id_documentoAgente; + } + + public void setId_documentoAgente(long id_documentoAgente) { + this.id_documentoAgente = id_documentoAgente; + } + + public long getId_documento() { + return this.id_documento; + } + + public void setId_documento(long id_documento) { + this.id_documento = id_documento; + } + + public long getId_cliforDA() { + return this.id_cliforDA; + } + + public void setId_cliforDA(long id_clifor) { + this.id_cliforDA = id_clifor; + } + + public double getPercDocumentoAgente() { + return this.percDocumentoAgente; + } + + public void setPercDocumentoAgente(double percDocumentoAgente) { + this.percDocumentoAgente = percDocumentoAgente; + } + + public Documento getDocumento() { + this.documento = new Documento(getApFull()); + this.documento.findByPrimaryKey(getId_documento()); + return this.documento; + } + + public void setDocumento(Documento documento) { + this.documento = documento; + } + + public Clifor getAgente() { + this.agente = new Clifor(getApFull()); + this.agente.findByPrimaryKey(getId_cliforDA()); + return this.agente; + } + + public void setAgente(Clifor agente) { + this.agente = agente; + } + + public Date getDataDocumentoA() { + return this.dataDocumentoA; + } + + public void setDataDocumentoA(Date dataDocumentoA) { + this.dataDocumentoA = dataDocumentoA; + } + + public Date getDataDocumentoDa() { + return this.dataDocumentoDa; + } + + public void setDataDocumentoDa(Date dataDocumentoDa) { + this.dataDocumentoDa = dataDocumentoDa; + } + + public long getFlgPagata() { + return this.flgPagata; + } + + public void setFlgPagata(long flgPagata) { + this.flgPagata = flgPagata; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaMovContabile.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaMovContabile.java new file mode 100644 index 00000000..95439aab --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaMovContabile.java @@ -0,0 +1,218 @@ +package it.acxent.contab; + +import it.acxent.anag.Banca; +import it.acxent.anag.Clifor; +import it.acxent.anag.Iva; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.DBAdapterException; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class RigaMovContabile extends DBAdapter implements Serializable { + private static final long serialVersionUID = -4169805255664880589L; + + private long id_rigaMovContabile; + + private long id_movContabile; + + private double importo; + + private long flgDA; + + private long id_pianoConti; + + private long id_clifor; + + private long id_banca; + + private long id_documento; + + private long id_iva; + + private MovContabile movContabile; + + private PianoConti pianoConti; + + private Clifor clifor; + + private Banca banca; + + private Documento documento; + + private Iva iva; + + public RigaMovContabile(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RigaMovContabile() {} + + public Vectumerator findByCR(RigaMovContabileCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RIGA_MOV_CONTABILE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void deleteCascade() {} + + protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException { + return null; + } + + public long getId_rigaMovContabile() { + return this.id_rigaMovContabile; + } + + public void setId_rigaMovContabile(long id_rigaMovContabile) { + this.id_rigaMovContabile = id_rigaMovContabile; + } + + public long getId_movContabile() { + return this.id_movContabile; + } + + public void setId_movContabile(long id_incassoPagamento) { + this.id_movContabile = id_incassoPagamento; + setMovContabile(null); + } + + public double getImporto() { + return this.importo; + } + + public void setImporto(double importo) { + this.importo = importo; + } + + public long getFlgDA() { + return this.flgDA; + } + + public void setFlgDA(long flgDA) { + this.flgDA = flgDA; + } + + public long getId_pianoConti() { + return this.id_pianoConti; + } + + public void setId_pianoConti(long id_pianoConti) { + this.id_pianoConti = id_pianoConti; + setPianoConti(null); + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + setClifor(null); + } + + public long getId_banca() { + return this.id_banca; + } + + public void setId_banca(long id_banca) { + this.id_banca = id_banca; + setBanca(null); + } + + public long getId_documento() { + return this.id_documento; + } + + public void setId_documento(long id_documento) { + this.id_documento = id_documento; + setDocumento(null); + } + + public long getId_iva() { + return this.id_iva; + } + + public void setId_iva(long id_iva) { + this.id_iva = id_iva; + setIva(null); + } + + public MovContabile getMovContabile() { + this.movContabile = (MovContabile)getSecondaryObject(this.movContabile, MovContabile.class, getId_movContabile()); + return this.movContabile; + } + + public void setMovContabile(MovContabile movContabile) { + this.movContabile = movContabile; + } + + public PianoConti getPianoConti() { + this.pianoConti = (PianoConti)getSecondaryObject(this.pianoConti, PianoConti.class, getId_pianoConti()); + return this.pianoConti; + } + + public void setPianoConti(PianoConti pianoConti) { + this.pianoConti = pianoConti; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setClifor(Clifor clifor) { + this.clifor = clifor; + } + + public Banca getBanca() { + this.banca = (Banca)getSecondaryObject(this.banca, Banca.class, getId_banca()); + return this.banca; + } + + public void setBanca(Banca banca) { + this.banca = banca; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento()); + return this.documento; + } + + public void setDocumento(Documento documento) { + this.documento = documento; + } + + public Iva getIva() { + this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, getId_iva()); + return this.iva; + } + + public void setIva(Iva iva) { + this.iva = iva; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaMovContabileCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaMovContabileCR.java new file mode 100644 index 00000000..e12355fa --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/RigaMovContabileCR.java @@ -0,0 +1,180 @@ +package it.acxent.contab; + +import it.acxent.anag.Banca; +import it.acxent.anag.Clifor; +import it.acxent.anag.Iva; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.io.Serializable; + +public class RigaMovContabileCR extends CRAdapter implements Serializable { + private static final long serialVersionUID = -639622181326860331L; + + private long id_rigaMovContabile; + + private long id_movContabile; + + private double importo; + + private long flgDA; + + private long id_pianoConti; + + private long id_clifor; + + private long id_banca; + + private long id_documento; + + private long id_iva; + + private MovContabile movContabile; + + private PianoConti pianoConti; + + private Clifor clifor; + + private Banca banca; + + private Documento documento; + + private Iva iva; + + public RigaMovContabileCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RigaMovContabileCR() {} + + public long getId_rigaMovContabile() { + return this.id_rigaMovContabile; + } + + public void setId_rigaMovContabile(long id_rigaMovContabile) { + this.id_rigaMovContabile = id_rigaMovContabile; + } + + public long getId_movContabile() { + return this.id_movContabile; + } + + public void setId_movContabile(long id_incassoPagamento) { + this.id_movContabile = id_incassoPagamento; + setMovContabile(null); + } + + public double getImporto() { + return this.importo; + } + + public void setImporto(double importo) { + this.importo = importo; + } + + public long getFlgDA() { + return this.flgDA; + } + + public void setFlgDA(long flgDA) { + this.flgDA = flgDA; + } + + public long getId_pianoConti() { + return this.id_pianoConti; + } + + public void setId_pianoConti(long id_pianoConti) { + this.id_pianoConti = id_pianoConti; + setPianoConti(null); + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + setClifor(null); + } + + public long getId_banca() { + return this.id_banca; + } + + public void setId_banca(long id_banca) { + this.id_banca = id_banca; + setBanca(null); + } + + public long getId_documento() { + return this.id_documento; + } + + public void setId_documento(long id_documento) { + this.id_documento = id_documento; + setDocumento(null); + } + + public long getId_iva() { + return this.id_iva; + } + + public void setId_iva(long id_iva) { + this.id_iva = id_iva; + setIva(null); + } + + public MovContabile getMovContabile() { + this.movContabile = (MovContabile)getSecondaryObject(this.movContabile, MovContabile.class, getId_movContabile()); + return this.movContabile; + } + + public void setMovContabile(MovContabile movContabile) { + this.movContabile = movContabile; + } + + public PianoConti getPianoConti() { + this.pianoConti = (PianoConti)getSecondaryObject(this.pianoConti, PianoConti.class, getId_pianoConti()); + return this.pianoConti; + } + + public void setPianoConti(PianoConti pianoConti) { + this.pianoConti = pianoConti; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setClifor(Clifor clifor) { + this.clifor = clifor; + } + + public Banca getBanca() { + this.banca = (Banca)getSecondaryObject(this.banca, Banca.class, getId_banca()); + return this.banca; + } + + public void setBanca(Banca banca) { + this.banca = banca; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento()); + return this.documento; + } + + public void setDocumento(Documento documento) { + this.documento = documento; + } + + public Iva getIva() { + this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, getId_iva()); + return this.iva; + } + + public void setIva(Iva iva) { + this.iva = iva; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoAllegatoDocumento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoAllegatoDocumento.java new file mode 100644 index 00000000..32dbe977 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoAllegatoDocumento.java @@ -0,0 +1,65 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoAllegatoDocumento extends _ContabAdapter implements Serializable { + private long id_tipoAllegatoDocumento; + + private String descrizione; + + public TipoAllegatoDocumento(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoAllegatoDocumento() {} + + public void setId_tipoAllegatoDocumento(long newId_tipoAllegatoDocumento) { + this.id_tipoAllegatoDocumento = newId_tipoAllegatoDocumento; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoAllegatoDocumento() { + return this.id_tipoAllegatoDocumento; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoAllegatoDocumentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_ALLEGATO_DOCUMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoAllegatoDocumentoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoAllegatoDocumentoCR.java new file mode 100644 index 00000000..a9abb43b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoAllegatoDocumentoCR.java @@ -0,0 +1,32 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoAllegatoDocumentoCR extends CRAdapter { + private long id_tipoAllegatoDocumento; + + private String descrizione; + + public TipoAllegatoDocumentoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoAllegatoDocumentoCR() {} + + public void setId_tipoAllegatoDocumento(long newId_tipoAllegatoDocumento) { + this.id_tipoAllegatoDocumento = newId_tipoAllegatoDocumento; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoAllegatoDocumento() { + return this.id_tipoAllegatoDocumento; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoDocumento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoDocumento.java new file mode 100644 index 00000000..0856978b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoDocumento.java @@ -0,0 +1,1446 @@ +package it.acxent.contab; + +import com.lowagie.text.Font; +import com.lowagie.text.pdf.BaseFont; +import it.acxent.anag.Contatore; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoDocumento extends _ContabAdapter implements Serializable { + private static final long serialVersionUID = -7366593986745626814L; + + private static final Font PDF_f_Default = new Font(2, 10.0F, 0); + + public static final int TIPOLOGIA_ALTRO = 99; + + public static final int TIPOLOGIA_BOLLA = 0; + + public static final int TIPOLOGIA_FATTURA_E_NOTA_CREDITO = 20; + + public static final int TIPOLOGIA_NOTA_CREDITO = 2; + + public static final int TIPOLOGIA_ORDINE = 3; + + public static final int TIPOLOGIA_SCONTRINO = 100; + + public static final int TIPOLOGIA_FATTURA = 1; + + public static final int TIPOLOGIA_RIPARAZIONE = 5; + + public static final int TIPOLOGIA_PRENOTAZIONE = 4; + + public static final int TIPOLOGIA_RICEVUTA = 150; + + public static final int TIPOLOGIA_RICEVUTA_A_CREDITO = 151; + + public static final int TIPOLOGIA_LAVORAZIONE_TESSITURA = 200; + + public static final int TIPOLOGIA_DISPOSIZIONE_TESSITURA = 201; + + public static final int TIPOLOGIA_LAVORAZIONE_TESSUTO = 202; + + public static final int TIPOLOGIA_ACCOPPIATURA_TESSUTO = 203; + + public static final int TIPOLOGIA_ORDINE_TAGLIO = 210; + + public static final int TIPOLOGIA_DISPOSIZIONE_TAGLIO = 220; + + public static final int TIPOLOGIA_ORDINE_A_FORNITORE = 8; + + public static final int TIPO_DOC_GEN_RICERCA_TUTTI = 0; + + public static final int TIPO_DOC_GEN_RICERCA_NO_USATO = 1; + + public static final int TIPO_DOC_GEN_RICERCA_SOLO_USATO = 2; + + public static final int MOV_MAG_SU_ARTICOLO_NO = 0; + + public static final int MOV_MAG_SU_ARTICOLO_SCARICO = -1; + + public static final int MOV_MAG_SU_ARTICOLO_CARICO = 1; + + public static final int GEST_DOC_RIGHE_PRELEVABILI_DAL_PADRE = 1; + + public static final int GEST_DOC_CREA_FIGLIO = 0; + + public static final int GEST_DOC_NESSUNO = 9; + + public static final int ORDINAMENTO_RIGHE_STAMPA_COME_INSERITO = 0; + + public static final int ORDINAMENTO_RIGHE_STAMPA_INVERSO = 1; + + public static final int ORDINAMENTO_RIGHE_STAMPA_DESCRIZIONE_RIGA = 2; + + public static final int ORDINAMENTO_RIGHE_STAMPA_CATEGORIZZATO = 3; + + public static final int TIPO_STAMPA_NESSUNA = -1; + + public static final int TIPO_STAMPA_FT_STD = 0; + + public static final int TIPO_STAMPA_FT_STD_CON_PESI_E_COLLI = 7; + + public static final int TIPO_STAMPA_FT_ACC = 1; + + public static final int TIPO_STAMPA_DDT = 2; + + public static final int TIPO_STAMPA_FT_PROFESS = 3; + + public static final int TIPO_STAMPA_FT_PROFESS_S = 4; + + public static final int TIPO_STAMPA_RIPARAZIONE = 5; + + public static final int TIPO_STAMPA_FT_SEMPLICE = 6; + + public static final int TIPO_STAMPA_SCONTRINO_FISCALE = 9; + + public static final int TIPO_STAMPA_SCONTRINO_NON_FISCALE = 10; + + public static final int TIPO_STAMPA_RICEVUTA = 11; + + public static final int TIPO_STAMPA_FT_ACQUISTO = 12; + + public static final String CLIENTE_FORNITORE_CLIENTE = "C"; + + public static final String CLIENTE_FORNITORE_FORNITORE = "F"; + + public static final int FONT_TIMES_NEW_ROMAN = 0; + + public static final int FONT_HELVETICA = 1; + + public static final int FONT_HELVETICA_MONOSPACED = 2; + + public static final int FE_TIPO_NUMERO_FATTURA_COMPLETO = 0; + + public static final int FE_TIPO_NUMERO_FATTURA_PROGRESSIVO = 1; + + public static final int OSS_IVA_TUTTE = 0; + + public static final int OSS_SOLO_IVA_OSS = 1; + + public static final int OSS_SOLO_IVA_NON_OSS = 2; + + private CausaleMagazzino causaleMagazzino; + + private String codice; + + private Contatore contatore; + + private String descrizione; + + private String descrizioneStampa; + + private long flgGestioneDoc; + + private String flgClienteFornitore; + + private long flgImportoIva; + + private long flgSingleLineArt; + + private boolean hasDocPrel; + + private long id_contatore; + + private long id_tipoDocumento; + + private long id_tipoDocumentoFiglio; + + public static final String getOss(long l_flgOss) { + switch ((int)l_flgOss) { + case 0: + return "Qualsiasi Iva"; + case 2: + return "Solo Iva NON Oss"; + case 1: + return "Solo Iva Oss"; + } + return "????"; + } + + public final String getTipologia(long l_flgTipologia) { + TipologiaDocumento td = new TipologiaDocumento(getApFull()); + td.findByCodice(l_flgTipologia); + return td.getDescrizione(); + } + + private boolean isCalcFieldOk = false; + + private boolean isDocumentoFiglioOk; + + private TipoDocumento tipoDocumentoFiglio; + + private long flgTipoDocumentoPrelevabile; + + private long flgObbligoPrelievo; + + private long flgCorrispettivi; + + private long flgTipoStampa; + + private String descMenu; + + private long flgAutoAdd; + + private long flgAllegato; + + private long numeroCopieStampa; + + private long righePerPagina; + + private long maxCarDesc; + + private String suffissoFattElett; + + private long flgBordoColonna; + + private String coloreBordoEsterno; + + private String coloreNuovoDocumento; + + private long indentNuovaRiga; + + private String riferimento; + + private String notaConfermaOrdine; + + private long docFontSizeFH; + + private long flgUsato; + + private long flgAFT; + + private long id_causaleMagazzino; + + private String nota; + + private long flgOrdinamentoRigheEdit; + + private long flgOrdinamentoRigheStampa; + + private long flgFontDocumento; + + private long flgFontCorpo; + + private long docFontSizeRow; + + private long docFontSize; + + private long flgAllineamentoRiga; + + private long monospacedWidth; + + private long flgBordoRiga; + + private long flgAFT2 = -1L; + + private long id_causaleMagazzino2; + + private CausaleMagazzino causaleMagazzino2; + + private long flgGestioneDocArticolo = 1L; + + private long flgNoAnag; + + private long flgNoAnag2; + + private long id_tipologiaDocumento; + + private long id_tipoStampaDocumento; + + private TipologiaDocumento tipologiaDocumento; + + private TipoStampaDocumento tipoStampaDocumento; + + private long flgTipoGenerazione; + + private long ordineNuovoDocumento; + + private String coloreBordoInterno; + + private long flgNascondiNuovo; + + private String suffissoCR; + + private String suffissoPD; + + private long flgMenu; + + private long flgMovMagazzino; + + private long flgFETipoNumeroFattura; + + private long flgOss; + + public TipoDocumento() {} + + public TipoDocumento(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoDocumento(ApplParmFull newApplParmFull, String l_codice) { + super(newApplParmFull); + findByCodice(l_codice); + } + + public ResParm addDocPrel(DocPrel row) { + if (row.getId_tipoDocumento() == row.getId_tipoDocumentoPrel()) + return new ResParm(false, "ERRORE! Non puoi collegare il tipo documento con se stesso."); + DocPrel bean = new DocPrel(getApFull()); + bean.findByPrimaryKey(row.getId_docPrel()); + if (bean != null) { + row.setDBState(bean.getDBState()); + } else { + row.setDBState(0); + } + ResParm rp = row.save(); + row.getTipoDocumentoPrel().save(); + return rp; + } + + private void calcField() { + if (!this.isCalcFieldOk) { + this.isCalcFieldOk = true; + if (getFlgGestioneDoc() == 1L) { + Vectumerator vec = findDocPrel(0L, 1, 1); + if (vec.hasMoreElements()) { + this.hasDocPrel = true; + } else { + this.hasDocPrel = false; + } + } else { + this.hasDocPrel = false; + } + } + } + + public ResParm delDocPrel(DocPrel row) { + DocPrel bean = new DocPrel(getApFull()); + bean.findByPrimaryKey(row.getId_docPrel()); + long l_id_tdPrel = bean.getId_tipoDocumentoPrel(); + ResParm rp = bean.delete(); + if (rp.getStatus()) { + TipoDocumento tdPrel = new TipoDocumento(getApFull()); + tdPrel.findByPrimaryKey(l_id_tdPrel); + tdPrel.save(); + } + return rp; + } + + protected void deleteCascade() {} + + public void findByCodice(String l_codice) { + String s_Sql_Find = "select A.* from TIPO_DOCUMENTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice='" + l_codice + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findByTipologiaClienteFornitoreAFT(long l_flgTipologia, String l_flgClienteFornitore, long l_flgAft, long l_flgAft2) { + String s_Sql_Find = "select A.* from TIPO_DOCUMENTO AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + if (l_flgTipologia == 0L) { + wc.addWc("(A.flgTipologia is null or A.flgTipologia=0)"); + } else if (l_flgTipologia > 0L) { + wc.addWc(" A.flgTipologia=" + l_flgTipologia); + } + if (l_flgAft == 0L) { + wc.addWc("(A.flgAft is null or A.flgAft=0)"); + } else if (l_flgAft > 0L) { + wc.addWc(" A.flgAft=" + l_flgAft); + } + if (l_flgAft2 == 0L) { + wc.addWc("(A.flgAft2 is null or A.flgAft2=0)"); + } else if (l_flgAft2 > 0L) { + wc.addWc(" A.flgAft2=" + l_flgAft2); + } + if (!l_flgClienteFornitore.isEmpty()) + wc.addWc(" A.flgClienteFornitore='" + l_flgClienteFornitore + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findDocPrel(long l_tipoRicerca, int pageNumber, int pageRows) { + return new DocPrel(getApFull()).findPrelevabiliByTipoDocumentoGen(getId_tipoDocumento(), l_tipoRicerca, pageNumber, pageRows); + } + + public Vectumerator findMenu() { + String s_Sql_Find = "select A.* from TIPO_DOCUMENTO AS A"; + String s_Sql_Order = " order by A.ordineNuovoDocumento, A.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.flgMenu=1"); + wc.addWc("(A.flgNascondiNuovo is null or A.flgNascondiNuovo=0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getCausaliMagazzinoDesc() { + StringBuilder sb = new StringBuilder(); + sb.append(getAFT()); + sb.append(": "); + sb.append(getCausaleMagazzino().getDescrizione()); + return sb.toString(); + } + + public String getCodice() { + return (this.codice == null) ? "" : this.codice.toUpperCase().trim(); + } + + public Contatore getContatore() { + this.contatore = (Contatore)getSecondaryObject(this.contatore, Contatore.class, getId_contatore()); + return this.contatore; + } + + public String getDescMenu() { + return (this.descMenu == null) ? "" : this.descMenu; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getDescrizioneCompleta() { + return (getCodice() + "-" + getCodice()).trim(); + } + + public String getDescrizioneStampa() { + return (this.descrizioneStampa == null) ? "" : this.descrizioneStampa; + } + + public long getFlgAutoAdd() { + return this.flgAutoAdd; + } + + public String getFlgClienteFornitore() { + return (this.flgClienteFornitore == null) ? "" : this.flgClienteFornitore; + } + + public long getFlgMenu() { + return this.flgMenu; + } + + public long getFlgSingleLineArt() { + return this.flgSingleLineArt; + } + + public long getFlgTipologia() { + return getTipologiaDocumento().getCodice(); + } + + public long getId_causaleMagazzino() { + return this.id_causaleMagazzino; + } + + public long getId_contatore() { + return this.id_contatore; + } + + public long getId_tipoDocumento() { + return this.id_tipoDocumento; + } + + public long getId_tipoDocumentoFiglio() { + return this.id_tipoDocumentoFiglio; + } + + @Deprecated + public TipoDocumento getTipoDocumentoFiglio() { + this.tipoDocumentoFiglio = (TipoDocumento)getSecondaryObject(this.tipoDocumentoFiglio, TipoDocumento.class, getId_tipoDocumentoFiglio()); + return this.tipoDocumentoFiglio; + } + + public String getTipologia() { + return getTipologia(getFlgTipologia()); + } + + public boolean hasDocPrel() { + calcField(); + return this.hasDocPrel; + } + + protected void initFields() { + super.initFields(); + this.isCalcFieldOk = false; + setFlgAFT2(-1L); + setFlgGestioneDocArticolo(1L); + } + + public boolean isDocumentoFiglioOk() { + calcField(); + return this.isDocumentoFiglioOk; + } + + public ResParm save() { + if (getId_tipoDocumento() != 0L && getId_tipoDocumento() == getId_tipoDocumentoFiglio()) + return new ResParm(false, "Errore! Il documento figlio deve essere diverso dal padre."); + if (getId_tipoStampaDocumento() > 0L) + setFlgTipoStampa(getTipoStampaDocumento().getCodice()); + if (getFlgTipologia() != 3L) + setNotaConfermaOrdine(null); + if (isDocumentoPrelevabile()) { + setFlgTipoDocumentoPrelevabile(1L); + } else { + setFlgTipoDocumentoPrelevabile(0L); + } + return super.save(); + } + + public void setCausaleMagazzino(CausaleMagazzino newCausaleMagazzino) { + this.causaleMagazzino = newCausaleMagazzino; + } + + public void setCodice(String codice) { + this.codice = codice; + } + + public void setContatore(Contatore contatore) { + this.contatore = contatore; + } + + public void setDescMenu(String descMenu) { + this.descMenu = descMenu; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setDescrizioneStampa(String descrizioneStampa) { + this.descrizioneStampa = descrizioneStampa; + } + + public void setFlgAutoAdd(long flgAutoAdd) { + this.flgAutoAdd = flgAutoAdd; + } + + public void setFlgClienteFornitore(String newFlgClienteFornitore) { + this.flgClienteFornitore = newFlgClienteFornitore; + } + + public void setFlgMenu(long flgMenu) { + this.flgMenu = flgMenu; + } + + public void setFlgSingleLineArt(long flgSingleLineArt) { + this.flgSingleLineArt = flgSingleLineArt; + } + + public void setId_causaleMagazzino(long newId_causaleMagazzino) { + this.id_causaleMagazzino = newId_causaleMagazzino; + setCausaleMagazzino(null); + } + + public void setId_contatore(long id_contatore) { + this.id_contatore = id_contatore; + setContatore(null); + } + + public void setId_tipoDocumento(long newId_tipoDocumento) { + this.id_tipoDocumento = newId_tipoDocumento; + } + + public void setId_tipoDocumentoFiglio(long id_tipoDocumentoFiglio) { + this.id_tipoDocumentoFiglio = id_tipoDocumentoFiglio; + setTipoDocumentoFiglio(null); + } + + public void setTipoDocumentoFiglio(TipoDocumento tipoDocumentoFiglio) { + this.tipoDocumentoFiglio = tipoDocumentoFiglio; + } + + public static String getClienteFornitore(String l_flgClienteFornitore) { + if (l_flgClienteFornitore.equals("F")) + return "Fornitore"; + if (l_flgClienteFornitore.equals("C")) + return "Cliente"; + return "Cliente/Fornitore"; + } + + public String getClienteFornitore() { + return getClienteFornitore(getFlgClienteFornitore()); + } + + private boolean isDocumentoPrelevabile() { + Vectumerator vec = new DocPrel(getApFull()).findGenerabiliByTipoDocumentoPrel(getId_tipoDocumento(), 0L, 0L, 1, 1); + if (vec.hasMoreElements()) + return true; + return false; + } + + public long getFlgTipoDocumentoPrelevabile() { + return this.flgTipoDocumentoPrelevabile; + } + + public void setFlgTipoDocumentoPrelevabile(long flgTipoDocumentoPrelevabile) { + this.flgTipoDocumentoPrelevabile = flgTipoDocumentoPrelevabile; + } + + public long getFlgTipoStampa() { + return this.flgTipoStampa; + } + + public void setFlgTipoStampa(long flgTipoStampa) { + this.flgTipoStampa = flgTipoStampa; + } + + public String getTipoStampa() { + return getTipoStampa(getFlgTipoStampa()); + } + + public String getTipoStampa(long l_flgTipoStampa) { + switch ((int)l_flgTipoStampa) { + case 1: + return "Ft. Acc."; + case 2: + return "DDT"; + case 0: + return "Fattura"; + case 7: + return "Fattura con pesi e colli"; + case 6: + return "Fattura Semplice"; + case 3: + return "FT. Profess."; + case 4: + return "FT. Profess. Semplice"; + case 9: + return "Scontrino Fiscale"; + case 10: + return "Scontrino NON Fiscale"; + case 5: + return "Riparazione"; + case 11: + return "Ricevuta"; + case 12: + return "Ft. Acq. o Bolla Carico"; + case -1: + return "-- nessuna --"; + } + return "????"; + } + + public long getFlgImportoIva() { + return this.flgImportoIva; + } + + public void setFlgImportoIva(long flgImportoIva) { + this.flgImportoIva = flgImportoIva; + } + + public long getFlgCorrispettivi() { + return this.flgCorrispettivi; + } + + public void setFlgCorrispettivi(long flgCorrispettivi) { + this.flgCorrispettivi = flgCorrispettivi; + } + + public long getFlgObbligoPrelievo() { + return this.flgObbligoPrelievo; + } + + public void setFlgObbligoPrelievo(long flgObbligoPrelievo) { + this.flgObbligoPrelievo = flgObbligoPrelievo; + } + + public Vectumerator findDocGen(long l_flgUsato, long l_id_tipologiaDocumento, int pageNumber, int pageRows) { + return new DocPrel(getApFull()).findGenerabiliByTipoDocumentoPrel(getId_tipoDocumento(), l_flgUsato, l_id_tipologiaDocumento, pageNumber, pageRows); + } + + public boolean isTipoDocGenerabile(long l_id_tipoDocumentoGenerabile) { + DocPrel dp = new DocPrel(getApFull()); + dp.findByTipoDocumentoGenPrel(l_id_tipoDocumentoGenerabile, getId_tipoDocumento()); + if (dp.getDBState() == 1) + return true; + return false; + } + + public String getDocumentiGenerabili() { + StringBuffer temp = new StringBuffer(); + String sep = ", "; + Vectumerator vec = findDocGen(0L, 0L, 0, 0); + while (vec.hasMoreElements()) { + DocPrel row = (DocPrel)vec.nextElement(); + temp.append(row.getTipoDocumento().getDescrizione()); + if (vec.hasMoreElements()) + temp.append(sep); + } + return temp.toString(); + } + + public String getDocumentiPrelevabili() { + StringBuffer temp = new StringBuffer(); + String sep = ", "; + Vectumerator vec = findDocPrel(0L, 0, 0); + while (vec.hasMoreElements()) { + DocPrel row = (DocPrel)vec.nextElement(); + temp.append(row.getTipoDocumentoPrel().getDescrizione()); + if (vec.hasMoreElements()) + temp.append(sep); + } + return temp.toString(); + } + + public boolean isTipoFatturaProfessionisti() { + if (getFlgTipoStampa() == 3L || getFlgTipoStampa() == 4L) + return true; + return false; + } + + public long getFlgGestioneDoc() { + return this.flgGestioneDoc; + } + + public void setFlgGestioneDoc(long flgGestioneDoc) { + this.flgGestioneDoc = flgGestioneDoc; + } + + public long getFlgAllegato() { + return this.flgAllegato; + } + + public void setFlgAllegato(long flgAllegato) { + this.flgAllegato = flgAllegato; + } + + public long getNumeroCopieStampa() { + return this.numeroCopieStampa; + } + + public void setNumeroCopieStampa(long numeroCopieStampa) { + this.numeroCopieStampa = numeroCopieStampa; + } + + public long getRighePerPagina() { + return this.righePerPagina; + } + + public void setRighePerPagina(long righePerPagina) { + this.righePerPagina = righePerPagina; + } + + public long getMaxCarDesc() { + return this.maxCarDesc; + } + + public void setMaxCarDesc(long maxCarDesc) { + this.maxCarDesc = maxCarDesc; + } + + public long getFlgBordoRiga() { + return this.flgBordoRiga; + } + + public void setFlgBordoRiga(long flgBordoRiga) { + this.flgBordoRiga = flgBordoRiga; + } + + public long getFlgBordoColonna() { + return this.flgBordoColonna; + } + + public void setFlgBordoColonna(long flgBordoColonna) { + this.flgBordoColonna = flgBordoColonna; + } + + public String getColoreBordoEsterno() { + return (this.coloreBordoEsterno == null) ? "" : this.coloreBordoEsterno; + } + + public void setColoreBordoEsterno(String coloreBordoEsterno) { + this.coloreBordoEsterno = coloreBordoEsterno; + } + + public String getColoreBordoInterno() { + return (this.coloreBordoInterno == null) ? "" : this.coloreBordoInterno; + } + + public void setColoreBordoInterno(String coloreBordoInterno) { + this.coloreBordoInterno = coloreBordoInterno; + } + + public long getIndentNuovaRiga() { + return this.indentNuovaRiga; + } + + public void setIndentNuovaRiga(long indentNuovaRiga) { + this.indentNuovaRiga = indentNuovaRiga; + } + + public boolean isFatturaAcquisto() { + if (getFlgTipologia() == 1L && getFlgClienteFornitore().equals("F")) + return true; + return false; + } + + public boolean isFatturaVendita() { + if (getFlgTipologia() == 1L && getFlgClienteFornitore().equals("C")) + return true; + return false; + } + + public boolean isNotaCreditoAcquisto() { + if (getFlgTipologia() == 2L && getFlgClienteFornitore().equals("F")) + return true; + return false; + } + + public boolean isNotaCreditoVendita() { + if (getFlgTipologia() == 2L && getFlgClienteFornitore().equals("C")) + return true; + return false; + } + + public long fixDocumentoConImportiNegativi() { + if (isFatturaAcquisto() || isNotaCreditoVendita()) + return -1L; + return 1L; + } + + public String getRiferimento() { + return (this.riferimento == null) ? "" : this.riferimento.trim(); + } + + public void setRiferimento(String riferimento) { + this.riferimento = riferimento; + } + + public Vectumerator findRiferimenti() { + String s_Sql_Find = "select A.riferimento from TIPO_DOCUMENTO AS A"; + String s_Sql_OrderBy = " order by A.riferimento"; + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + Vectumerator vec = findRows(stmt); + return vec; + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public boolean isTipoFatturaFornitore() { + if ((getFlgTipologia() == 1L || getFlgTipologia() == 2L) && getFlgClienteFornitore().equals("F")) + return true; + return false; + } + + public String getNotaConfermaOrdine() { + return (this.notaConfermaOrdine == null) ? "" : this.notaConfermaOrdine; + } + + public void setNotaConfermaOrdine(String noteConfermaOrdine) { + this.notaConfermaOrdine = noteConfermaOrdine; + } + + public long getDocFontSizeRow() { + return (this.docFontSizeRow <= 0L) ? 8L : this.docFontSizeRow; + } + + public void setDocFontSizeRow(long docFontRowSize) { + this.docFontSizeRow = docFontRowSize; + } + + public String getNota() { + return (this.nota == null) ? "" : this.nota.trim(); + } + + public void setNota(String nota) { + this.nota = nota; + } + + public CausaleMagazzino getCausaleMagazzino() { + this.causaleMagazzino = (CausaleMagazzino)getSecondaryObject(this.causaleMagazzino, CausaleMagazzino.class, getId_causaleMagazzino()); + return this.causaleMagazzino; + } + + public long getFlgAFT() { + return this.flgAFT; + } + + public void setFlgAFT(long flgAFT) { + this.flgAFT = flgAFT; + } + + public String getAFT() { + return getAFT(getFlgAFT()); + } + + public static final String getOrdinamentoRigheStampa(long l_flgOrdinamentoRigheStampa) { + switch ((int)l_flgOrdinamentoRigheStampa) { + case 0: + return "Come Inserito"; + case 1: + return "Inverso"; + case 3: + return "Categorizzato se previsto"; + case 2: + return "Descrizione Riga"; + } + return "??"; + } + + public String getOrdinamentoRigheStampa() { + return getOrdinamentoRigheStampa(getFlgOrdinamentoRigheStampa()); + } + + public static final String getFontCorpo(long l_flgFont) { + return getFontDocumento(l_flgFont); + } + + public String getFontDocumento() { + return getFontDocumento(getFlgFontDocumento()); + } + + public String getFontCorpo() { + return getFontDocumento(getFlgFontDocumento()); + } + + public long getFlgOrdinamentoRigheEdit() { + return this.flgOrdinamentoRigheEdit; + } + + public void setFlgOrdinamentoRigheEdit(long flgOrdinamentoRigheEdit) { + this.flgOrdinamentoRigheEdit = flgOrdinamentoRigheEdit; + } + + public long getFlgOrdinamentoRigheStampa() { + return this.flgOrdinamentoRigheStampa; + } + + public void setFlgOrdinamentoRigheStampa(long flgOrdinamentoRigheStampa) { + this.flgOrdinamentoRigheStampa = flgOrdinamentoRigheStampa; + } + + public long getFlgFontDocumento() { + return this.flgFontDocumento; + } + + public void setFlgFontDocumento(long flgFontDocumento) { + this.flgFontDocumento = flgFontDocumento; + } + + public long getFlgFontCorpo() { + return this.flgFontCorpo; + } + + public void setFlgFontCorpo(long flgFontCorpo) { + this.flgFontCorpo = flgFontCorpo; + } + + public static final String getAFT(long l_flgAFT) { + switch ((int)l_flgAFT) { + case -1: + return "NON IMPOSTATO"; + case 0: + return "Articolo"; + case 1: + return "Filato"; + case 2: + return "Tessuto"; + } + return "??"; + } + + public static final String getMovMagazzino(long l_flgMovMagazzino) { + switch ((int)l_flgMovMagazzino) { + case 1: + return "Carico"; + case 0: + return "No"; + case -1: + return "Scarico"; + } + return "??"; + } + + public String getMovMagazzino() { + return getMovMagazzino(getFlgMovMagazzino()); + } + + private static final Font getPdfFont(long flgFont, long size, long monospacedWidth, boolean isBold) { + BaseFont bf; + if (size == 0L) + size = 8L; + int fontType = isBold ? 1 : 0; + switch ((int)flgFont) { + case 0: + return new Font(2, (float)size, fontType); + case 1: + return new Font(1, (float)size, fontType); + case 2: + bf = null; + try { + bf = BaseFont.createFont("Helvetica", "winansi", false, false, null, null); + int[] widths = bf.getWidths(); + for (int k = 0; k < widths.length; k++) { + if (widths[k] != 0) + widths[k] = (int)monospacedWidth; + } + } catch (Exception e) { + e.printStackTrace(); + } + bf.setForceWidthsOutput(true); + return new Font(bf, (float)size); + } + return new Font(2, (float)size, fontType); + } + + private static final Font getPdfFont(long flgFont, long size, long monospacedWidth) { + return getPdfFont(flgFont, size, monospacedWidth, false); + } + + public Font getPdfFontRow() { + return getPdfFont(getFlgFontCorpo(), getDocFontSizeRow(), getMonospacedWidth()); + } + + public Font getPdfFontRow(int sizeToAdd) { + return getPdfFont(getFlgFontCorpo(), getDocFontSizeRow() + (long)sizeToAdd, getMonospacedWidth()); + } + + public Font getPdfFont() { + return getPdfFont(getFlgFontDocumento(), getDocFontSize(), getMonospacedWidth()); + } + + public Font getPdfFontBold() { + return getPdfFont(getFlgFontDocumento(), getDocFontSize(), getMonospacedWidth()); + } + + public Font getPdfFontHeaderFooterBold() { + return getPdfFont(getFlgFontDocumento(), getDocFontSizeFH(), getMonospacedWidth()); + } + + public Font getPdfFontRowSmall() { + return getPdfFont(getFlgFontCorpo(), getDocFontSizeRow() - 2L, getMonospacedWidth()); + } + + public long getDocFontSize() { + return (this.docFontSize <= 0L) ? 10L : this.docFontSize; + } + + public void setDocFontSize(long docFontSize) { + this.docFontSize = docFontSize; + } + + public long getDocFontSizeFH() { + return (this.docFontSizeFH <= 0L) ? 8L : this.docFontSizeFH; + } + + public void setDocFontSizeFH(long docFontSizeFH) { + this.docFontSizeFH = docFontSizeFH; + } + + public long getFlgAllineamentoRiga() { + return this.flgAllineamentoRiga; + } + + public void setFlgAllineamentoRiga(long flgAllineamentoRiga) { + this.flgAllineamentoRiga = flgAllineamentoRiga; + } + + public static final String getAllineamentoRiga(long l_flgAllineamentoRiga) { + switch ((int)l_flgAllineamentoRiga) { + case 0: + return "In Alto"; + case 1: + return "In Basso"; + } + return "????"; + } + + public String getAllineamentoRiga() { + return getAllineamentoRiga(getFlgAllineamentoRiga()); + } + + public long getMonospacedWidth() { + return (this.monospacedWidth == 0L) ? 600L : this.monospacedWidth; + } + + public void setMonospacedWidth(long monospacedWidth) { + this.monospacedWidth = monospacedWidth; + } + + public String getSuffissoFattElett() { + return (this.suffissoFattElett == null) ? "" : this.suffissoFattElett.trim(); + } + + public void setSuffissoFattElett(String suffissoFattElett) { + this.suffissoFattElett = suffissoFattElett; + } + + public static final String getFETipoDocumento(long l_flgTipologia) { + switch ((int)l_flgTipologia) { + case 1: + return "TD01"; + case 2: + return "TD04"; + } + return ""; + } + + public static final String getFETipoNumeroFattura(long l_flgFETipoNumeroFattura) { + switch ((int)l_flgFETipoNumeroFattura) { + case 0: + return "Completo"; + case 1: + return "Progressivo"; + } + return ""; + } + + public String getFETipoNumeroFattura() { + return getFETipoNumeroFattura(getFlgFETipoNumeroFattura()); + } + + public String getFETipoDocumento() { + return getFETipoDocumento(getFlgTipologia()); + } + + public CausaleMagazzino getCausaleMagazzino2() { + this.causaleMagazzino2 = (CausaleMagazzino)getSecondaryObject(this.causaleMagazzino2, CausaleMagazzino.class, getId_causaleMagazzino2()); + return this.causaleMagazzino2; + } + + public void setCausaleMagazzino2(CausaleMagazzino causaleMagazzino2) { + this.causaleMagazzino2 = causaleMagazzino2; + } + + public long getFlgAFT2() { + return this.flgAFT2; + } + + public void setFlgAFT2(long flgAFT2) { + this.flgAFT2 = flgAFT2; + } + + public long getId_causaleMagazzino2() { + return this.id_causaleMagazzino2; + } + + public void setId_causaleMagazzino2(long id_causaleMagazzino2) { + this.id_causaleMagazzino2 = id_causaleMagazzino2; + setCausaleMagazzino2(null); + } + + public String getAFT2() { + return getAFT(getFlgAFT2()); + } + + public static final String getAFT2(long l_flgAFT) { + return getAFT(l_flgAFT); + } + + public long getFlgGestioneDocArticolo() { + return (this.flgGestioneDocArticolo == 0L) ? 1L : this.flgGestioneDocArticolo; + } + + public void setFlgGestioneDocArticolo(long flgGestioneDocArticolo) { + this.flgGestioneDocArticolo = flgGestioneDocArticolo; + } + + public long getFlgNoAnag() { + return this.flgNoAnag; + } + + public void setFlgNoAnag(long flgNoAnag) { + this.flgNoAnag = flgNoAnag; + } + + public long getFlgNoAnag2() { + return this.flgNoAnag2; + } + + public void setFlgNoAnag2(long flgNoAnag2) { + this.flgNoAnag2 = flgNoAnag2; + } + + public Vectumerator findByCR(TipoDocumentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_DOCUMENTO AS A left join TIPOLOGIA_DOCUMENTO AS B ON A.id_tipologiaDocumento=B.id_tipologiaDocumento"; + String s_Sql_Order = " order by A.ordineNuovoDocumento,A.flgNascondiNuovo, A.descrizione"; + WcString wc = new WcString(); + if (CR.getFlgMenu() == 0L) { + wc.addWc("(A.flgMenu is null or A.flgMenu=0)"); + } else if (CR.getFlgMenu() == 1L) { + wc.addWc(" A.flgMenu==1"); + } + if (CR.getFlgNascondiNuovo() == 0L) { + wc.addWc("(A.flgNascondiNuovo is null or A.flgNascondiNuovo=0)"); + } else if (CR.getFlgNascondiNuovo() == 1L) { + wc.addWc(" A.flgNascondiNuovo==1"); + } + if (!CR.getFlgTipologie().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getFlgTipologie(), ","); + StringBuilder sb = new StringBuilder("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + sb.append("B.flgTipologia=" + Long.parseLong(token)); + if (st.hasMoreTokens()) + sb.append(" or "); + } + sb.append(")"); + wc.addWc(sb.toString()); + } + if (CR.getId_tipologiaDocumento() > 0L) + wc.addWc("A.id_tipologiaDocumento=" + CR.getId_tipologiaDocumento()); + if (CR.getFlgTipologia() >= 0L) + if (CR.getFlgTipologia() == 100L) { + wc.addWc("A.id_tipoDocumento=1"); + } else if (CR.getFlgTipologia() == 20L) { + wc.addWc("(B.codice=1 OR B.codice=2)"); + wc.addWc("A.id_tipoDocumento<>1"); + } else if (CR.getFlgTipologia() == 1L) { + wc.addWc("B.codice=" + CR.getFlgTipologia()); + wc.addWc("A.id_tipoDocumento<>1"); + } else if (CR.getFlgTipologia() == 0L) { + wc.addWc("(B.codice is null or B.codice=" + CR.getFlgTipologia() + ")"); + } else { + wc.addWc("B.codice=" + CR.getFlgTipologia()); + } + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void setTipologiaDocumento(TipologiaDocumento newTipologiaDocumento) { + this.tipologiaDocumento = newTipologiaDocumento; + } + + public long getId_tipologiaDocumento() { + return this.id_tipologiaDocumento; + } + + public long getId_tipoStampaDocumento() { + return this.id_tipoStampaDocumento; + } + + public void setId_tipologiaDocumento(long newId_tipologiaDocumento) { + this.id_tipologiaDocumento = newId_tipologiaDocumento; + setTipologiaDocumento(null); + } + + public void setId_tipoStampaDocumento(long newId_tipoStampaDocumento) { + this.id_tipoStampaDocumento = newId_tipoStampaDocumento; + setTipoStampaDocumento(null); + } + + public TipologiaDocumento getTipologiaDocumento() { + this.tipologiaDocumento = (TipologiaDocumento)getSecondaryObject(this.tipologiaDocumento, TipologiaDocumento.class, + getId_tipologiaDocumento()); + return this.tipologiaDocumento; + } + + public void setTipoStampaDocumento(TipoStampaDocumento newTipoStampaDocumento) { + this.tipoStampaDocumento = newTipoStampaDocumento; + } + + public TipoStampaDocumento getTipoStampaDocumento() { + this.tipoStampaDocumento = (TipoStampaDocumento)getSecondaryObject(this.tipoStampaDocumento, TipoStampaDocumento.class, + getId_tipoStampaDocumento()); + return this.tipoStampaDocumento; + } + + public long getFlgFETipoNumeroFattura() { + return this.flgFETipoNumeroFattura; + } + + public void setFlgFETipoNumeroFattura(long flgFETipoNumeroFattura) { + this.flgFETipoNumeroFattura = flgFETipoNumeroFattura; + } + + public String getTipoGenerazione() { + return getTipoGenerazione(getFlgTipoGenerazione()); + } + + public static final String getTipoGenerazione(long l_flgTipoGenerazione) { + return DocPrel.getTipoGenerazione(l_flgTipoGenerazione); + } + + public long getFlgTipoGenerazione() { + return this.flgTipoGenerazione; + } + + public void setFlgTipoGenerazione(long flgTipoGenerazione) { + this.flgTipoGenerazione = flgTipoGenerazione; + } + + public String getColoreNuovoDocumento() { + return (this.coloreNuovoDocumento == null) ? "" : this.coloreNuovoDocumento.trim(); + } + + public String getColoreNuovoDocumentoStyle() { + if (getColoreNuovoDocumento().equals("FFFFFF")) + return ""; + return " style='background-color:#" + getColoreNuovoDocumento() + "' "; + } + + public void setColoreNuovoDocumento(String coloreNuovoDocumento) { + this.coloreNuovoDocumento = coloreNuovoDocumento; + } + + public long getOrdineNuovoDocumento() { + return this.ordineNuovoDocumento; + } + + public void setOrdineNuovoDocumento(long ordineNuovoDocumento) { + this.ordineNuovoDocumento = ordineNuovoDocumento; + } + + public long getFlgNascondiNuovo() { + return this.flgNascondiNuovo; + } + + public void setFlgNascondiNuovo(long flgNascondiNuovo) { + this.flgNascondiNuovo = flgNascondiNuovo; + } + + public String getSuffissoCR() { + return (this.suffissoCR == null) ? "" : this.suffissoCR.trim(); + } + + public String getSuffissoPD() { + return (this.suffissoPD == null) ? "" : this.suffissoPD.trim(); + } + + public void setSuffissoCR(String suffissoCR) { + this.suffissoCR = suffissoCR; + } + + public void setSuffissoPD(String newSuffissoPD) { + this.suffissoPD = newSuffissoPD; + } + + public static final String getFontDocumento(long l_flgFont) { + switch ((int)l_flgFont) { + case 0: + return "Times New Roman"; + case 1: + return "Helvetica"; + case 2: + return "Helvetica Monospaced"; + } + return "??"; + } + + public long getFlgUsato() { + return this.flgUsato; + } + + public void setFlgUsato(long flgUsato) { + this.flgUsato = flgUsato; + } + + public long getFlgMovMagazzino() { + return this.flgMovMagazzino; + } + + public void setFlgMovMagazzino(long flgMovMagazzino) { + this.flgMovMagazzino = flgMovMagazzino; + } + + public boolean hasPadreConTipologia(long l_id_tipologiaDocumento) { + Vectumerator vecPadri = findDocPrel(1L, 0, 0); + while (vecPadri.hasMoreElements()) { + DocPrel rowTD = (DocPrel)vecPadri.nextElement(); + if (rowTD.getTipoDocumentoPrel().getTipologiaDocumento().getCodice() == l_id_tipologiaDocumento) + return true; + } + return false; + } + + public long getFlgOss() { + return this.flgOss; + } + + public void setFlgOss(long flgOss) { + this.flgOss = flgOss; + } + + public String getOss() { + return getOss(getFlgOss()); + } + + public Font getPdfFontHeaderFooter() { + return getPdfFont(getFlgFontDocumento(), getDocFontSizeFH(), getMonospacedWidth()); + } + + public Font getPdfFont(int sizeToAdd) { + return getPdfFont(getFlgFontDocumento(), getDocFontSize() + (long)sizeToAdd, getMonospacedWidth()); + } + + public Font getPdfFontBold(int sizeToAdd) { + return getPdfFont(getFlgFontDocumento(), getDocFontSize() + (long)sizeToAdd, getMonospacedWidth()); + } + + public Font getPdfFontHeaderFooter(int sizeToAdd) { + return getPdfFont(getFlgFontDocumento(), getDocFontSizeFH() + (long)sizeToAdd, getMonospacedWidth()); + } + + public Font getPdfFontHeaderFooterBold(int sizeToAdd) { + return getPdfFont(getFlgFontDocumento(), getDocFontSizeFH() + (long)sizeToAdd, getMonospacedWidth()); + } + + public static final String getTipologiaOld(long l_flgTipologia) { + switch ((int)l_flgTipologia) { + case 1: + return "Fattura"; + case 3: + return "Ordine"; + case 100: + return "Scontrino"; + case 0: + return "Bolla"; + case 2: + return "Nota di Credito"; + case 20: + return "Fattura + NC"; + case 4: + return "Prenotazione"; + case 5: + return "Riparazione"; + case 150: + return "Ricevuta"; + case 99: + return "Altro\t"; + case 200: + return "Lavorazione Tessitura"; + } + return "????"; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoDocumentoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoDocumentoCR.java new file mode 100644 index 00000000..cddd39a7 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoDocumentoCR.java @@ -0,0 +1,170 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoDocumentoCR extends CRAdapter { + private long id_tipoDocumento; + + private long id_causaleMagazzino; + + private String descrizione; + + private long flgTipologia = -1L; + + private CausaleMagazzino causaleMagazzino; + + private String flgClienteFornitore; + + private long flgMenu = -1L; + + private String flgTipologie; + + private long id_tipologiaDocumento; + + private long id_tipoStampaDocumento; + + private TipologiaDocumento tipologiaDocumento; + + private TipoStampaDocumento tipoStampaDocumento; + + private long flgNascondiNuovo = -1L; + + private long flgOss = -1L; + + public TipoDocumentoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoDocumentoCR() {} + + public void setId_tipoDocumento(long newId_tipoDocumento) { + this.id_tipoDocumento = newId_tipoDocumento; + } + + public void setId_causaleMagazzino(long newId_causaleMagazzino) { + this.id_causaleMagazzino = newId_causaleMagazzino; + setCausaleMagazzino(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setFlgTipologia(long newFlgTipologia) { + this.flgTipologia = newFlgTipologia; + } + + public long getId_tipoDocumento() { + return this.id_tipoDocumento; + } + + public long getId_causaleMagazzino() { + return this.id_causaleMagazzino; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getFlgTipologia() { + return this.flgTipologia; + } + + public void setCausaleMagazzino(CausaleMagazzino newCausaleMagazzino) { + this.causaleMagazzino = newCausaleMagazzino; + } + + public CausaleMagazzino getCausaleMagazzino() { + this.causaleMagazzino = (CausaleMagazzino)getSecondaryObject(this.causaleMagazzino, CausaleMagazzino.class, getId_causaleMagazzino()); + return this.causaleMagazzino; + } + + public String getTipologia() { + return getTipologia(getFlgTipologia()); + } + + public final String getTipologia(long l_flgTipologia) { + TipologiaDocumento td = new TipologiaDocumento(getApFull()); + td.findByCodice(l_flgTipologia); + return td.getDescrizione(); + } + + public String getFlgClienteFornitore() { + return (this.flgClienteFornitore == null) ? AB_EMPTY_STRING : this.flgClienteFornitore; + } + + public void setFlgClienteFornitore(String newFlgClienteFornitore) { + this.flgClienteFornitore = newFlgClienteFornitore; + } + + public long getFlgMenu() { + return this.flgMenu; + } + + public void setFlgMenu(long flgMenu) { + this.flgMenu = flgMenu; + } + + public String getFlgTipologie() { + return (this.flgTipologie == null) ? AB_EMPTY_STRING : this.flgTipologie.toString(); + } + + public void setFlgTipologie(String flgTipologie) { + this.flgTipologie = flgTipologie; + } + + public long getId_tipologiaDocumento() { + return this.id_tipologiaDocumento; + } + + public long getId_tipoStampaDocumento() { + return this.id_tipoStampaDocumento; + } + + public TipologiaDocumento getTipologiaDocumento() { + this.tipologiaDocumento = (TipologiaDocumento)getSecondaryObject(this.tipologiaDocumento, TipologiaDocumento.class, + getId_tipologiaDocumento()); + return this.tipologiaDocumento; + } + + public TipoStampaDocumento getTipoStampaDocumento() { + this.tipoStampaDocumento = (TipoStampaDocumento)getSecondaryObject(this.tipoStampaDocumento, TipoStampaDocumento.class, + getId_tipoStampaDocumento()); + return this.tipoStampaDocumento; + } + + public void setId_tipologiaDocumento(long newId_tipologiaDocumento) { + this.id_tipologiaDocumento = newId_tipologiaDocumento; + setTipologiaDocumento(null); + } + + public void setId_tipoStampaDocumento(long newId_tipoStampaDocumento) { + this.id_tipoStampaDocumento = newId_tipoStampaDocumento; + setTipoStampaDocumento(null); + } + + public void setTipologiaDocumento(TipologiaDocumento newTipologiaDocumento) { + this.tipologiaDocumento = newTipologiaDocumento; + } + + public void setTipoStampaDocumento(TipoStampaDocumento newTipoStampaDocumento) { + this.tipoStampaDocumento = newTipoStampaDocumento; + } + + public long getFlgNascondiNuovo() { + return this.flgNascondiNuovo; + } + + public void setFlgNascondiNuovo(long flgNascondiNuovo) { + this.flgNascondiNuovo = flgNascondiNuovo; + } + + public long getFlgOss() { + return this.flgOss; + } + + public void setFlgOss(long flgOss) { + this.flgOss = flgOss; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoStampaDocumento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoStampaDocumento.java new file mode 100644 index 00000000..8c8b4589 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoStampaDocumento.java @@ -0,0 +1,98 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoStampaDocumento extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1553591799994L; + + private long id_tipoStampaDocumento; + + private String Descrizione; + + private long codice; + + public TipoStampaDocumento(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoStampaDocumento() {} + + public void setId_tipoStampaDocumento(long newId_tipoStampaDocumento) { + this.id_tipoStampaDocumento = newId_tipoStampaDocumento; + } + + public void setDescrizione(String newDescrizione) { + this.Descrizione = newDescrizione; + } + + public long getId_tipoStampaDocumento() { + return this.id_tipoStampaDocumento; + } + + public String getDescrizione() { + return (this.Descrizione == null) ? "" : this.Descrizione.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoStampaDocumentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_STAMPA_DOCUMENTO AS A"; + String s_Sql_Order = " order by A.codice, A.descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getCodice() { + return this.codice; + } + + public void setCodice(long codice) { + this.codice = codice; + } + + public Vectumerator findByTipologiaDocumento(long l_id_tipologiaDocumento) { + String s_Sql_Find = "select A.* from TIPO_STAMPA_DOCUMENTO AS A inner join TIPOLOGIA_DOCUMENTO_TIPO_STAMPA AS B ON A.id_tipoStampaDocumento=B.id_tipoStampaDocumento"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + wc.addWc("B.id_tipologiaDocumento=" + l_id_tipologiaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoStampaDocumentoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoStampaDocumentoCR.java new file mode 100644 index 00000000..56edb81d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipoStampaDocumentoCR.java @@ -0,0 +1,42 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoStampaDocumentoCR extends CRAdapter { + private long id_tipoStampaDocumento; + + private String descrizione; + + private long codice; + + public TipoStampaDocumentoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoStampaDocumentoCR() {} + + public void setId_tipoStampaDocumento(long newId_tipoStampaDocumento) { + this.id_tipoStampaDocumento = newId_tipoStampaDocumento; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoStampaDocumento() { + return this.id_tipoStampaDocumento; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getCodice() { + return this.codice; + } + + public void setCodice(long codice) { + this.codice = codice; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipologiaDocumento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipologiaDocumento.java new file mode 100644 index 00000000..9175632c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipologiaDocumento.java @@ -0,0 +1,350 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipologiaDocumento extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1553591799856L; + + private long id_tipologiaDocumento; + + private String descrizione; + + private String suffissoPD; + + private long codice; + + private long flgArticolo2; + + private long flgGestioneSeparata; + + private String suffissoCR; + + private String flgTDFelett; + + private String nota; + + public TipologiaDocumento(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipologiaDocumento() {} + + public static final String getTDFelett(String l_flgTDFelett) { + if (l_flgTDFelett.equals("TD01")) + return "TD01 Fattura"; + if (l_flgTDFelett.equals("TD02")) + return "TD02 Acconto/Anticipo su Fattura"; + if (l_flgTDFelett.equals("TD03")) + return "TD31 Acconto/Anticipo su Parcella"; + if (l_flgTDFelett.equals("TD04")) + return "TD04 Nota di Credito"; + if (l_flgTDFelett.equals("TD05")) + return "TD05 Nota di Debito"; + if (l_flgTDFelett.equals("TD06")) + return "TD06 Parcella"; + if (l_flgTDFelett.equals("TD16")) + return "TD016 Integrazione ft. rev. charge interno"; + if (l_flgTDFelett.equals("TD17")) + return "TD17 Integr./autofattura per acquisto servizi dall'estero"; + if (l_flgTDFelett.equals("TD18")) + return "TD18 Integ. acquisto beni intracomunitari"; + if (l_flgTDFelett.equals("TD19")) + return "TD19 Integr./autofattura per acquisto beni ex art 17 co 2"; + if (l_flgTDFelett.equals("TD20")) + return "TD20 Autofattura per regolarizz. e integ. delle fatture"; + if (l_flgTDFelett.equals("TD21")) + return "TD21 Autofattura per splafonamento"; + if (l_flgTDFelett.equals("TD22")) + return "TD22 Estrazione beni da Deposito IVA"; + if (l_flgTDFelett.equals("TD23")) + return "TD23 Estrazione beni da Deposito IVA con versam. IVA"; + if (l_flgTDFelett.equals("TD24")) + return "TD24 Fatt. differita art. 21 co 4 lett. a"; + if (l_flgTDFelett.equals("TD25")) + return "TD25 Fatt. differita art. 21 co 4 terzo per. lett. b"; + if (l_flgTDFelett.equals("TD26")) + return "TD26 Fattura per autoconsumo o per cessioni gratuite"; + return "??"; + } + + public String getTDFelett() { + return getTDFelett(getFlgTDFelett()); + } + + public void setId_tipologiaDocumento(long newId_tipologiaDocumento) { + this.id_tipologiaDocumento = newId_tipologiaDocumento; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setSuffissoPD(String newSuffissoPD) { + this.suffissoPD = newSuffissoPD; + } + + public long getId_tipologiaDocumento() { + return this.id_tipologiaDocumento; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getSuffissoPD() { + return (this.suffissoPD == null) ? "" : this.suffissoPD.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public ResParm initTipologie() { + ResParm rp = new ResParm(true); + TipologiaDocumento bean = new TipologiaDocumento(getApFull()); + bean.findByCodice(-1L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(-1L); + bean.setDescrizione("-----"); + bean.save(); + } + bean.findByCodice(0L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(0L); + bean.setDescrizione("BOLLA"); + } + bean.save(); + bean.findByCodice(20L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(20L); + bean.setDescrizione("FATTURA_E_NOTA_CREDITO"); + } + bean.save(); + bean.findByCodice(2L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(2L); + bean.setDescrizione("NOTA_CREDITO"); + } + bean.save(); + bean.findByCodice(3L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(3L); + bean.setDescrizione("ORDINE"); + } + bean.save(); + bean.findByCodice(100L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(100L); + bean.setDescrizione("SCONTRINO"); + } + bean.setSuffissoPD("Cash"); + bean.save(); + bean.findByCodice(1L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(1L); + bean.setDescrizione("FATTURA"); + } + bean.save(); + bean.findByCodice(5L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(5L); + bean.setDescrizione("RIPARAZIONE"); + } + bean.save(); + bean.findByCodice(4L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(4L); + bean.setDescrizione("PRENOTAZIONE"); + } + bean.save(); + bean.findByCodice(150L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(150L); + bean.setDescrizione("RICEVUTA"); + } + bean.save(); + bean.findByCodice(151L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(151L); + bean.setDescrizione("RICEVUTA_A_CREDITO"); + } + bean.save(); + bean.findByCodice(200L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(200L); + bean.setDescrizione("LAVORAZIONE_TESSITURA"); + } + bean.setSuffissoPD("LavTess"); + bean.setSuffissoCR("LavTess"); + bean.save(); + bean.findByCodice(201L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(201L); + bean.setDescrizione("DISPOSIZIONE_TESSITURA"); + } + bean.setFlgArticolo2(1L); + bean.setSuffissoPD("DispoTessuto"); + bean.save(); + bean.findByCodice(202L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(202L); + bean.setDescrizione("LAVORAZIONE_TESSUTO"); + } + bean.setFlgArticolo2(1L); + bean.setSuffissoPD("LavTessuto"); + bean.save(); + bean.findByCodice(203L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(203L); + bean.setDescrizione("ACCOPPIATURA_TESSUTO"); + } + bean.setFlgArticolo2(1L); + bean.setSuffissoPD("Accoppiatura"); + bean.save(); + bean.findByCodice(210L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(210L); + bean.setDescrizione("ORDINE_TAGLIO"); + } + bean.setSuffissoPD("Taglio"); + bean.save(); + bean.findByCodice(220L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(220L); + bean.setDescrizione("DISPOSIZIONE_TAGLIO"); + } + bean.setSuffissoPD("DispoTaglio"); + bean.save(); + bean.findByCodice(8L); + if (bean.getId_tipologiaDocumento() == 0L) { + bean.setCodice(8L); + bean.setDescrizione("ORDINE_A_FORNITORE"); + bean.save(); + } + return rp; + } + + public long getCodice() { + return this.codice; + } + + public void setCodice(long codice) { + this.codice = codice; + } + + public Vectumerator findByTipologiaDocumento() { + return new TipologiaDocumentoTipoStampa(getApFull()).findByTipologiaDocumento(getId_tipologiaDocumento()); + } + + public String getElencoStampe() { + if (getId_tipologiaDocumento() == 0L) + return ""; + StringBuilder sb = new StringBuilder(); + Vectumerator vec = findByTipologiaDocumento(); + while (vec.hasMoreElements()) { + TipologiaDocumentoTipoStampa row = (TipologiaDocumentoTipoStampa)vec.nextElement(); + sb.append(row.getTipoStampaDocumento().getDescrizione()); + if (vec.hasMoreElements()) + sb.append(", "); + } + return sb.toString(); + } + + public long getFlgArticolo2() { + return this.flgArticolo2; + } + + public void setFlgArticolo2(long flgArticolo2) { + this.flgArticolo2 = flgArticolo2; + } + + public void findByCodice(long l_codice) { + String s_Sql_Find = "select A.* from TIPOLOGIA_DOCUMENTO AS A"; + String s_Sql_Order = " ORDER BY A.descrizione"; + WcString wc = new WcString(); + if (l_codice == 0L) { + wc.addWc("(A.codice=0 or A.codice is null)"); + } else { + wc.addWc("A.codice=" + l_codice); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public long getFlgGestioneSeparata() { + return this.flgGestioneSeparata; + } + + public void setFlgGestioneSeparata(long flgGestioneSeparata) { + this.flgGestioneSeparata = flgGestioneSeparata; + } + + public String getSuffissoCR() { + return (this.suffissoCR == null) ? "" : this.suffissoCR.trim(); + } + + public void setSuffissoCR(String suffissoCR) { + this.suffissoCR = suffissoCR; + } + + public String getDescrizione(String lang) { + return super.getDescrizione(lang); + } + + public String getFlgTDFelett() { + return (this.flgTDFelett == null) ? "" : this.flgTDFelett.trim(); + } + + public void setFlgTDFelett(String flgTDFelett) { + this.flgTDFelett = flgTDFelett; + } + + public Vectumerator findByCR(TipologiaDocumentoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPOLOGIA_DOCUMENTO AS A"; + String s_Sql_Order = " ORDER BY A.descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getNota() { + return (this.nota == null) ? "" : this.nota.trim(); + } + + public void setNota(String nota) { + this.nota = nota; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipologiaDocumentoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipologiaDocumentoCR.java new file mode 100644 index 00000000..3badb321 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipologiaDocumentoCR.java @@ -0,0 +1,52 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipologiaDocumentoCR extends CRAdapter { + private long id_tipologiaDocumento; + + private String descrizione; + + private String suffissoPD; + + private long codice; + + public TipologiaDocumentoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipologiaDocumentoCR() {} + + public void setId_tipologiaDocumento(long newId_tipologiaDocumento) { + this.id_tipologiaDocumento = newId_tipologiaDocumento; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setSuffissoPD(String newSuffissoPD) { + this.suffissoPD = newSuffissoPD; + } + + public long getId_tipologiaDocumento() { + return this.id_tipologiaDocumento; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getSuffissoPD() { + return (this.suffissoPD == null) ? "" : this.suffissoPD.trim(); + } + + public long getCodice() { + return this.codice; + } + + public void setCodice(long codice) { + this.codice = codice; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipologiaDocumentoTipoStampa.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipologiaDocumentoTipoStampa.java new file mode 100644 index 00000000..1dd9fc5d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipologiaDocumentoTipoStampa.java @@ -0,0 +1,124 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipologiaDocumentoTipoStampa extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1553591799904L; + + private long id_tipologiaDocumentoTipoStampa; + + private long id_tipologiaDocumento; + + private long id_tipoStampaDocumento; + + private TipologiaDocumento tipologiaDocumento; + + private TipoStampaDocumento tipoStampaDocumento; + + public TipologiaDocumentoTipoStampa(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipologiaDocumentoTipoStampa() {} + + public void setId_tipologiaDocumentoTipoStampa(long newId_tipologiaDocumentoTipoStampa) { + this.id_tipologiaDocumentoTipoStampa = newId_tipologiaDocumentoTipoStampa; + } + + public void setId_tipologiaDocumento(long newId_tipologiaDocumento) { + this.id_tipologiaDocumento = newId_tipologiaDocumento; + setTipologiaDocumento(null); + } + + public void setId_tipoStampaDocumento(long newId_tipoStampaDocumento) { + this.id_tipoStampaDocumento = newId_tipoStampaDocumento; + setTipoStampaDocumento(null); + } + + public long getId_tipologiaDocumentoTipoStampa() { + return this.id_tipologiaDocumentoTipoStampa; + } + + public long getId_tipologiaDocumento() { + return this.id_tipologiaDocumento; + } + + public long getId_tipoStampaDocumento() { + return this.id_tipoStampaDocumento; + } + + public void setTipologiaDocumento(TipologiaDocumento newTipologiaDocumento) { + this.tipologiaDocumento = newTipologiaDocumento; + } + + public TipologiaDocumento getTipologiaDocumento() { + this.tipologiaDocumento = (TipologiaDocumento)getSecondaryObject(this.tipologiaDocumento, TipologiaDocumento.class, + getId_tipologiaDocumento()); + return this.tipologiaDocumento; + } + + public void setTipoStampaDocumento(TipoStampaDocumento newTipoStampaDocumento) { + this.tipoStampaDocumento = newTipoStampaDocumento; + } + + public TipoStampaDocumento getTipoStampaDocumento() { + this.tipoStampaDocumento = (TipoStampaDocumento)getSecondaryObject(this.tipoStampaDocumento, TipoStampaDocumento.class, + getId_tipoStampaDocumento()); + return this.tipoStampaDocumento; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipologiaDocumentoTipoStampaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPOLOGIA_DOCUMENTO_TIPO_STAMPA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByTipologiaDocumento(long l_id_tipologiaDocumento) { + String s_Sql_Find = "select A.* from TIPOLOGIA_DOCUMENTO_TIPO_STAMPA AS A inner join TIPO_STAMPA_DOCUMENTO AS B on A.id_tipoStampaDocumento=B.id_tipoStampaDocumento"; + String s_Sql_Order = " order by B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_tipologiaDocumento=" + l_id_tipologiaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipologiaDocumentoTipoStampaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipologiaDocumentoTipoStampaCR.java new file mode 100644 index 00000000..3ecde2cc --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/TipologiaDocumentoTipoStampaCR.java @@ -0,0 +1,70 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipologiaDocumentoTipoStampaCR extends CRAdapter { + private long id_tipologiaDocumentoTipoStampa; + + private long id_tipologiaDocumento; + + private long id_tipoStampaDocumento; + + private TipologiaDocumento tipologiaDocumento; + + private TipoStampaDocumento tipoStampaDocumento; + + public TipologiaDocumentoTipoStampaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipologiaDocumentoTipoStampaCR() {} + + public void setId_tipologiaDocumentoTipoStampa(long newId_tipologiaDocumentoTipoStampa) { + this.id_tipologiaDocumentoTipoStampa = newId_tipologiaDocumentoTipoStampa; + } + + public void setId_tipologiaDocumento(long newId_tipologiaDocumento) { + this.id_tipologiaDocumento = newId_tipologiaDocumento; + setTipologiaDocumento(null); + } + + public void setId_tipoStampaDocumento(long newId_tipoStampaDocumento) { + this.id_tipoStampaDocumento = newId_tipoStampaDocumento; + setTipoStampaDocumento(null); + } + + public long getId_tipologiaDocumentoTipoStampa() { + return this.id_tipologiaDocumentoTipoStampa; + } + + public long getId_tipologiaDocumento() { + return this.id_tipologiaDocumento; + } + + public long getId_tipoStampaDocumento() { + return this.id_tipoStampaDocumento; + } + + public void setTipologiaDocumento(TipologiaDocumento newTipologiaDocumento) { + this.tipologiaDocumento = newTipologiaDocumento; + } + + public TipologiaDocumento getTipologiaDocumento() { + this.tipologiaDocumento = (TipologiaDocumento)getSecondaryObject(this.tipologiaDocumento, TipologiaDocumento.class, + + getId_tipologiaDocumento()); + return this.tipologiaDocumento; + } + + public void setTipoStampaDocumento(TipoStampaDocumento newTipoStampaDocumento) { + this.tipoStampaDocumento = newTipoStampaDocumento; + } + + public TipoStampaDocumento getTipoStampaDocumento() { + this.tipoStampaDocumento = (TipoStampaDocumento)getSecondaryObject(this.tipoStampaDocumento, TipoStampaDocumento.class, + + getId_tipoStampaDocumento()); + return this.tipoStampaDocumento; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/_ContabAdapter.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/_ContabAdapter.java new file mode 100644 index 00000000..1d5adb90 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/_ContabAdapter.java @@ -0,0 +1,34 @@ +package it.acxent.contab; + +import it.acxent.anag._AnagAdapter; +import it.acxent.db.ApplParmFull; + +public class _ContabAdapter extends _AnagAdapter { + public static final long SF_BOZZA = 0L; + + public static final long SF_EMESSA = 1L; + + public static final long SF_REG_IVA = 2L; + + public static final long CONTATORE_VENDITE = 1L; + + public static final long CONTATORE_ACQUISTI = 2L; + + public _ContabAdapter() {} + + public _ContabAdapter(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + protected String getFooterDocumento(int l_numb) { + return getParm("FOOT_DOC" + l_numb).getTesto(); + } + + protected String getHeaderDoocumento(int l_numb) { + return getParm("HEAD_DOC" + l_numb).getTesto(); + } + + protected boolean isDescScontrinoFull() { + return (getParm("DESC_SCONTRINO_FULL").getNumeroInt() == 1); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RegimeMargine.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RegimeMargine.java new file mode 100644 index 00000000..d569d26c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RegimeMargine.java @@ -0,0 +1,54 @@ +package it.acxent.contab.iva; + +import it.acxent.anag.IvaInterface; +import it.acxent.util.DoubleOperator; + +public class RegimeMargine { + private IvaInterface iva; + + private double importo; + + private double costo; + + private double imponibileMargine; + + private double impostaMargine; + + public RegimeMargine(IvaInterface l_ivaStdVendite, double l_mporto, double l_costo) { + this.iva = l_ivaStdVendite; + this.importo = l_mporto; + this.costo = l_costo; + DoubleOperator temp2 = new DoubleOperator((float)getIva().getAliquota()); + temp2.setScale(2, 5); + temp2.divide(100.0F); + temp2.add(1); + DoubleOperator impo = new DoubleOperator(this.importo); + impo.subtract(this.costo); + DoubleOperator l_imposta = new DoubleOperator(impo.getResult()); + impo.setScale(2, 5); + impo.divide(temp2); + this.imponibileMargine = impo.getResult(); + l_imposta.subtract(this.imponibileMargine); + this.impostaMargine = l_imposta.getResult(); + } + + public IvaInterface getIva() { + return this.iva; + } + + public void setIva(IvaInterface iva) { + this.iva = iva; + } + + public double getImponibileMargine() { + return this.imponibileMargine; + } + + public double getImpostaMargine() { + return this.impostaMargine; + } + + public double getCosto() { + return this.costo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RiepilogoIva.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RiepilogoIva.java new file mode 100644 index 00000000..b272c67f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RiepilogoIva.java @@ -0,0 +1,193 @@ +package it.acxent.contab.iva; + +import it.acxent.anag.Iva; +import it.acxent.anag.IvaInterface; +import it.acxent.contab.RigaDocumentoInterface; +import it.acxent.db.ApplParmFull; +import java.util.Enumeration; +import java.util.Hashtable; + +public class RiepilogoIva { + private Hashtable ri; + + private Hashtable riConPI; + + private Hashtable riSenzaPI; + + private ApplParmFull ap; + + private Iva ivaEsente; + + private Iva ivaStdVendite; + + private void addFatturaConPi(IvaInterface l_iva, double imponibile, double imposta, double costo, boolean isSplit) { + addFattura(l_iva, imponibile, imposta, costo, 0.0D, 0.0D, getRiConPI(), isSplit); + } + + private void addFatturaConPi(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, boolean isSplit) { + addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRiConPI(), isSplit); + } + + private void addNotaDiCreditoConPI(IvaInterface l_iva, double imponibile, double imposta, double costo, boolean isSplit) { + addFattura(l_iva, -imponibile, -imposta, costo, 0.0D, 0.0D, getRiConPI(), isSplit); + } + + private void addNotaDiCreditoConPI(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, boolean isSplit) { + addFattura(l_iva, -imponibile, -imposta, costo, speseAccessorie, arrotondamento, getRiConPI(), isSplit); + } + + public Enumeration elements() { + return getRi().elements(); + } + + public Enumeration elementsSenzaPI() { + return getRiSenzaPI().elements(); + } + + public Enumeration elementsConPI() { + return getRiConPI().elements(); + } + + public RiepilogoIva() {} + + public RiepilogoIva(ApplParmFull theAp) { + setAp(theAp); + } + + private Hashtable getRi() { + if (this.ri == null) + this.ri = new Hashtable<>(); + return this.ri; + } + + private Hashtable getRiConPI() { + if (this.riConPI == null) + this.riConPI = new Hashtable<>(); + return this.riConPI; + } + + private Hashtable getRiSenzaPI() { + if (this.riSenzaPI == null) + this.riSenzaPI = new Hashtable<>(); + return this.riSenzaPI; + } + + private void addFattura(IvaInterface l_iva, double imponibile, double imposta, double costo, boolean isSplit) { + addFattura(l_iva, imponibile, imposta, costo, 0.0D, 0.0D, isSplit); + } + + private void addFattura(IvaInterface l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, boolean isSplit) { + addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRi(), isSplit); + } + + private void addFattura(IvaInterface l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, Hashtable RI, boolean isSplit) { + RiepilogoIvaItem rii; + String theKey = String.valueOf(l_iva.getId_iva()); + if (RI.containsKey(theKey)) { + rii = RI.get(theKey); + } else { + rii = new RiepilogoIvaItem(l_iva); + } + rii.addImporto(imponibile, imposta, isSplit); + RI.put(theKey, rii); + } + + private void addNotaDiCredito(IvaInterface l_iva, double imponibile, double imposta, double costo, boolean isSplit) { + addFattura(l_iva, -imponibile, -imposta, costo, 0.0D, 0.0D, getRi(), isSplit); + } + + private void addNotaDiCredito(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, boolean isSplit) { + addFattura(l_iva, -imponibile, -imposta, costo, speseAccessorie, arrotondamento, getRi(), isSplit); + } + + private void addFatturaSenzaPi(IvaInterface l_iva, double imponibile, double imposta, double costo, boolean isSplit) { + addFattura(l_iva, imponibile, imposta, costo, 0.0D, 0.0D, getRiSenzaPI(), isSplit); + } + + private void addFatturaSenzaPi(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, boolean isSplit) { + addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRiSenzaPI(), isSplit); + } + + private void addNotaDiCreditoSenzaPI(IvaInterface l_iva, double imponibile, double imposta, double costo, boolean isSplit) { + addFattura(l_iva, -imponibile, -imposta, costo, 0.0D, 0.0D, getRiSenzaPI(), isSplit); + } + + private void addNotaDiCreditoSenzaPI(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, boolean isSplit) { + addFattura(l_iva, -imponibile, -imposta, costo, speseAccessorie, arrotondamento, getRiSenzaPI(), isSplit); + } + + public void addRigaDocumento(IvaInterface l_iva, double imponibile, double imposta, boolean isNotaDiCredito, boolean isPartitaIva, boolean isSplit) { + if (!isNotaDiCredito) { + addFattura(l_iva, imponibile, imposta, 0.0D, isSplit); + } else { + addNotaDiCredito(l_iva, imponibile, imposta, 0.0D, isSplit); + } + if (!isPartitaIva) { + if (!isNotaDiCredito) { + addFatturaSenzaPi(l_iva, imponibile, imposta, 0.0D, isSplit); + } else { + addNotaDiCreditoSenzaPI(l_iva, imponibile, imposta, 0.0D, isSplit); + } + } else if (!isNotaDiCredito) { + addFatturaConPi(l_iva, imponibile, imposta, 0.0D, isSplit); + } else { + addNotaDiCreditoConPI(l_iva, imponibile, imposta, 0.0D, isSplit); + } + } + + public void addRigaRegistroIvaItem(RigaRegistroIvaItem rrii, boolean isNotaDiCredito, boolean isPartitaIva, boolean isSplit) { + addRigaDocumento(rrii.getIva(), rrii.getImponibile(), rrii.getImportoIva(), isNotaDiCredito, isPartitaIva, isSplit); + } + + private void addRigaDocumento(RigaDocumentoInterface rigaDocumento, boolean isSplit) { + double imponibile, iva; + if (!rigaDocumento.getIva().isRegimeMargine()) { + imponibile = rigaDocumento.getRDITotImponibile(); + iva = rigaDocumento.getRDITotImposta(); + } else { + imponibile = rigaDocumento.getRDITotImponibileRM(); + iva = 0.0D; + } + String codIva = rigaDocumento.getIva().getDescrizione(); + if (!rigaDocumento.isRDINotaCredito()) { + addFattura(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto(), isSplit); + } else { + addNotaDiCredito(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto(), isSplit); + } + if (!rigaDocumento.isRDIPIva()) { + if (!rigaDocumento.isRDINotaCredito()) { + addFatturaSenzaPi(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto(), isSplit); + } else { + addNotaDiCreditoSenzaPI(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto(), isSplit); + } + } else if (!rigaDocumento.isRDINotaCredito()) { + addFatturaConPi(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto(), isSplit); + } else { + addNotaDiCreditoConPI(rigaDocumento.getIva(), imponibile, iva, rigaDocumento.getRDITotCosto(), isSplit); + } + } + + private ApplParmFull getApFull() { + return this.ap; + } + + private Iva getIvaEsente() { + if (this.ivaEsente == null) { + this.ivaEsente = new Iva(getApFull()); + this.ivaEsente.findByPrimaryKey(getApFull().getParm("CODICE_IVA_ESENTE").getNumeroLong()); + } + return this.ivaEsente; + } + + private Iva getIvaStdVendite() { + if (this.ivaStdVendite == null) { + this.ivaStdVendite = new Iva(getApFull()); + this.ivaStdVendite.findByPrimaryKey(getApFull().getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + } + return this.ivaStdVendite; + } + + private void setAp(ApplParmFull ap) { + this.ap = ap; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RiepilogoIvaItem.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RiepilogoIvaItem.java new file mode 100644 index 00000000..db960992 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RiepilogoIvaItem.java @@ -0,0 +1,135 @@ +package it.acxent.contab.iva; + +import it.acxent.anag.IvaInterface; +import it.acxent.util.DoubleOperator; + +public class RiepilogoIvaItem { + private double imponibile; + + private IvaInterface iva; + + private double imposta; + + private double esente; + + private double imponibileIndetraibile; + + private double impostaIndetraibile; + + private double percIndetraibile; + + private double split; + + public RiepilogoIvaItem(IvaInterface l_iva) { + setIva(l_iva); + } + + public double getEsente() { + return this.esente; + } + + public double getImponibile() { + return this.imponibile; + } + + public double getImponibileIndetraibile() { + return this.imponibileIndetraibile; + } + + public void addImporto(double imponibile, double imposta) { + addImporto(imponibile, imposta, false); + } + + public void addImporto(double imponibile, double imposta, boolean isSplit) { + DoubleOperator dImponibile = new DoubleOperator(imponibile); + dImponibile.setScale(4, 5); + DoubleOperator dImposta = new DoubleOperator(imposta); + DoubleOperator dSplit = new DoubleOperator(imposta); + dImposta.setScale(2, 5); + if (getIva().getFlgTipo().equals("I")) { + if (getIva().getAliquotaIndetraibile() == 0L) { + dImponibile.add(getImponibile()); + setImponibile(dImponibile.getResult()); + if (isSplit) { + dSplit.add(getSplit()); + setSplit(dSplit.getResult()); + } else { + dImposta.add(getImposta()); + setImposta(dImposta.getResult()); + } + } else { + dImponibile.add(getImponibile()); + setImponibile(dImponibile.getResult()); + DoubleOperator ivaDetraibile = new DoubleOperator(100.0F); + ivaDetraibile.subtract(getIva().getAliquotaIndetraibile()); + ivaDetraibile.multiply(imposta); + ivaDetraibile.divide(100.0F); + dImposta.subtract(ivaDetraibile); + ivaDetraibile.add(getImposta()); + setImposta(ivaDetraibile.getResult()); + dImposta.add(getImpostaIndetraibile()); + setImpostaIndetraibile(dImposta.getResult()); + } + } else if (getIva().getFlgTipo().equals("X") || getIva().getFlgTipo().equals("E") || + getIva().getFlgTipo().startsWith("N") || + getIva().getFlgTipo().startsWith("S") || + getIva().getFlgTipo().equals("R") || + getIva().getFlgTipo().startsWith("C") || + getIva().getFlgTipo().startsWith("C7")) { + dImponibile.add(getEsente()); + setEsente(dImponibile.getResult()); + } + } + + public double getImposta() { + return this.imposta; + } + + public double getImpostaIndetraibile() { + return this.impostaIndetraibile; + } + + public double getPercIndetraibile() { + return this.percIndetraibile; + } + + public void setEsente(double d) { + this.esente = d; + } + + public void setImponibile(double d) { + this.imponibile = d; + } + + public void setImponibileIndetraibile(double d) { + this.imponibileIndetraibile = d; + } + + public void setImposta(double d) { + this.imposta = d; + } + + public void setImpostaIndetraibile(double d) { + this.impostaIndetraibile = d; + } + + public void setPercIndetraibile(double d) { + this.percIndetraibile = d; + } + + public IvaInterface getIva() { + return this.iva; + } + + public void setIva(IvaInterface iva) { + this.iva = iva; + } + + public double getSplit() { + return this.split; + } + + public void setSplit(double split) { + this.split = split; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RiepilogoIvaOLD.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RiepilogoIvaOLD.java new file mode 100644 index 00000000..fc324392 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RiepilogoIvaOLD.java @@ -0,0 +1,127 @@ +package it.acxent.contab.iva; + +import it.acxent.anag.Iva; +import java.util.Enumeration; +import java.util.Hashtable; + +public class RiepilogoIvaOLD { + private Hashtable ri; + + private Hashtable riConPI; + + private Hashtable riSenzaPI; + + public void addFatturaConPi(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento) { + addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRiConPI()); + } + + public void addNotaDiCreditoConPI(Iva l_iva, double imponibile, double imposta, double costo) { + RiepilogoIvaItem rii; + String theKey = String.valueOf(l_iva.getId_iva()); + if (getRiConPI().containsKey(theKey)) { + rii = (RiepilogoIvaItem)getRiConPI().get(theKey); + } else { + rii = new RiepilogoIvaItem(l_iva); + } + rii.addImporto(-imponibile, -imposta); + getRiConPI().put(theKey, rii); + } + + public Enumeration elements() { + return getRi().elements(); + } + + public Enumeration elementsSenzaPI() { + return getRiSenzaPI().elements(); + } + + public Enumeration elementsConPI() { + return getRiConPI().elements(); + } + + private Hashtable getRi() { + if (this.ri == null) + this.ri = new Hashtable(); + return this.ri; + } + + private Hashtable getRiConPI() { + if (this.riConPI == null) + this.riConPI = new Hashtable(); + return this.riConPI; + } + + private Hashtable getRiSenzaPI() { + if (this.riSenzaPI == null) + this.riSenzaPI = new Hashtable(); + return this.riSenzaPI; + } + + public void setRiConPI(Hashtable riConPI) { + this.riConPI = riConPI; + } + + public void setRiSenzaPI(Hashtable riSenzaPI) { + this.riSenzaPI = riSenzaPI; + } + + public void addFattura(Iva l_iva, double imponibile, double imposta, double costo) { + addFattura(l_iva, imponibile, imposta, costo, 0.0D, 0.0D); + } + + public void addFattura(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento) { + addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRi()); + } + + private void addFattura(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento, Hashtable RI) { + RiepilogoIvaItem rii; + String theKey = String.valueOf(l_iva.getId_iva()); + if (getRi().containsKey(theKey)) { + rii = (RiepilogoIvaItem)getRi().get(theKey); + } else { + rii = new RiepilogoIvaItem(l_iva); + } + rii.addImporto(imponibile, imposta); + getRi().put(theKey, rii); + } + + public void addNotaDiCredito(Iva l_iva, double imponibile, double imposta, double costo) { + RiepilogoIvaItem rii; + String theKey = String.valueOf(l_iva.getId_iva()); + if (getRi().containsKey(theKey)) { + rii = (RiepilogoIvaItem)getRi().get(theKey); + } else { + rii = new RiepilogoIvaItem(l_iva); + } + rii.addImporto(-imponibile, -imposta); + getRi().put(theKey, rii); + } + + public void addFatturaSenzaPi(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento) { + addFattura(l_iva, imponibile, imposta, costo, speseAccessorie, arrotondamento, getRiSenzaPI()); + } + + public void addNotaDiCreditoSenzaPI(Iva l_iva, double imponibile, double imposta, double costo) { + RiepilogoIvaItem rii; + String theKey = String.valueOf(l_iva.getId_iva()); + if (getRiSenzaPI().containsKey(theKey)) { + rii = (RiepilogoIvaItem)getRiSenzaPI().get(theKey); + } else { + rii = new RiepilogoIvaItem(l_iva); + } + rii.addImporto(-imponibile, -imposta); + getRiSenzaPI().put(theKey, rii); + } + + public void addFatturaOLD(Iva l_iva, double imponibile, double imposta, double costo, double speseAccessorie, double arrotondamento) { + RiepilogoIvaItem rii; + String theKey = String.valueOf(l_iva.getId_iva()); + if (getRi().containsKey(theKey)) { + rii = (RiepilogoIvaItem)getRi().get(theKey); + } else { + rii = new RiepilogoIvaItem(l_iva); + } + rii.addImporto(imponibile, imposta); + getRi().put(theKey, rii); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RigaRegistroIvaItem.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RigaRegistroIvaItem.java new file mode 100644 index 00000000..cf92ce85 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RigaRegistroIvaItem.java @@ -0,0 +1,137 @@ +package it.acxent.contab.iva; + +import it.acxent.anag.IvaInterface; +import it.acxent.fattele.FEDatiRiepilogoInterface; +import it.acxent.util.DoubleOperator; + +public class RigaRegistroIvaItem implements FEDatiRiepilogoInterface { + private IvaInterface iva; + + private double importoIvaNoCalc; + + private double imponibile; + + private boolean regimeDelMargine = false; + + private String fEEsigibilitaIva; + + public RigaRegistroIvaItem(IvaInterface l_iva) { + setIva(l_iva); + } + + public void addImporto(double l_imponibile, double l_importoIva) { + DoubleOperator dImponibile = new DoubleOperator(getImponibile()); + dImponibile.setScale(4, 5); + dImponibile.add(l_imponibile); + setImponibile(dImponibile.getResult()); + DoubleOperator dImposta = new DoubleOperator(getImportoIvaNoCalc()); + dImposta.setScale(2, 5); + dImposta.add(l_importoIva); + setImportoIvaNoCalc(dImposta.getResult()); + } + + public double getImponibile() { + return this.imponibile; + } + + public double getImportoIva() { + return getImportoIvaCalc(); + } + + public double getImportoIvaNoCalc() { + return this.importoIvaNoCalc; + } + + public double xxgetImportoIvaSulTotaleImponibile() { + DoubleOperator temp = new DoubleOperator((float)getIva().getAliquota()); + temp.divide(100.0F); + temp.multiply(getImponibile()); + if (getImportoIva() != temp.getResult()) + System.out.println("RRI: importi iva calcolati diversi"); + return temp.getResult(); + } + + public void setImponibile(double d) { + this.imponibile = d; + } + + public void setImportoIvaNoCalc(double d) { + this.importoIvaNoCalc = d; + } + + public IvaInterface getIva() { + return this.iva; + } + + private double getImportoIvaCalc() { + if (getIva().isRegimeMargine()) + return 0.0D; + DoubleOperator temp = new DoubleOperator(getImponibile()); + temp.setScale(4, 5); + temp.multiply(getIva().getAliquota()); + temp.divide(100.0F); + return temp.getResult(); + } + + public void setIva(IvaInterface iva) { + this.iva = iva; + } + + public double getFEAliquotaIva() { + return (double)getIva().getAliquota(); + } + + public double getFEArrotondamento() { + return 0.0D; + } + + public String getFEEsigibilitaIva() { + return this.fEEsigibilitaIva; + } + + public double getFEImponibileImporto() { + return getImponibile(); + } + + public double getFEImposta() { + return getImportoIva(); + } + + public String getFENatura() { + return getIva().getFENatura(); + } + + public String getFERiferimentoNormativo() { + if (getFENatura().isEmpty()) + return null; + return getIva().getNotaEsenzione(); + } + + public double getFESpeseAccessorie() { + return 0.0D; + } + + public double getImponibile2() { + DoubleOperator dop = new DoubleOperator(getImponibile()); + dop.setScale(2, 5); + return dop.getResult(); + } + + public double getImportoIva2() { + DoubleOperator dop = new DoubleOperator(getImportoIvaCalc()); + dop.setScale(2, 5); + return dop.getResult(); + } + + public boolean isRegimeDelMargine() { + return this.regimeDelMargine; + } + + public void setRegimeDelMargine(boolean regimeDelMargine) { + this.regimeDelMargine = regimeDelMargine; + } + + public void setFEEsigibilitaIva(String fEEsigibilitaIva) { + this.fEEsigibilitaIva = fEEsigibilitaIva; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RigheRegistroIva.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RigheRegistroIva.java new file mode 100644 index 00000000..9e5e7e75 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/iva/RigheRegistroIva.java @@ -0,0 +1,275 @@ +package it.acxent.contab.iva; + +import it.acxent.anag.Iva; +import it.acxent.anag.IvaInterface; +import it.acxent.contab.RigaDocumentoInterface; +import it.acxent.util.DoubleOperator; +import java.util.Enumeration; +import java.util.Hashtable; + +public class RigheRegistroIva implements Cloneable { + private Hashtable ri; + + private DoubleOperator totImponibileDO; + + private double importoRM; + + private Hashtable riFatt; + + public void addRigaDocumento(Iva l_iva, double imponibile) { + DoubleOperator dop = new DoubleOperator(imponibile); + dop.setScale(4, 5); + dop.multiply(l_iva.getAliquota()); + dop.divide(100.0F); + dop.setScale(2, 5); + addRigaDocumento(l_iva, imponibile, dop.getResult(), false, false); + } + + public void addRigaDocumento(RigaDocumentoInterface rigaDocumento) { + RigaRegistroIvaItem rii; + if (!rigaDocumento.getIva().isRegimeMargine()) { + String str = String.valueOf(rigaDocumento.getIva().getId_iva()); + if (getRi().containsKey(str)) { + rii = getRi().get(str); + } else { + rii = new RigaRegistroIvaItem(rigaDocumento.getIva()); + } + rii.addImporto(rigaDocumento.getRDITotImponibile(), rigaDocumento.getRDITotImposta()); + getTotImponibileDO().add(rigaDocumento.getRDITotImponibile()); + rii.setFEEsigibilitaIva(rigaDocumento.getFEEsigibilitaIva()); + getRi().put(str, rii); + } else { + RigaRegistroIvaItem rigaRegistroIvaItem; + Iva ivaStdVend = rigaDocumento.getIva().getIvaStdRM(); + RegimeMargine rm = new RegimeMargine(ivaStdVend, rigaDocumento.getRDITotImponibile(), rigaDocumento.getRDITotCosto()); + String theKeyStdVend = String.valueOf(ivaStdVend.getId_iva()); + if (getRi().containsKey(theKeyStdVend)) { + rigaRegistroIvaItem = getRi().get(theKeyStdVend); + } else { + rigaRegistroIvaItem = new RigaRegistroIvaItem(ivaStdVend); + } + rigaRegistroIvaItem.setFEEsigibilitaIva(rigaDocumento.getFEEsigibilitaIva()); + rigaRegistroIvaItem.addImporto(rm.getImponibileMargine(), rm.getImpostaMargine()); + rigaRegistroIvaItem.setRegimeDelMargine(true); + getRi().put(theKeyStdVend, rigaRegistroIvaItem); + getTotImponibileDO().add(rm.getImponibileMargine()); + String rm_theKey = String.valueOf(rigaDocumento.getIva().getId_iva()); + if (getRi().containsKey(rm_theKey)) { + rigaRegistroIvaItem = getRi().get(rm_theKey); + } else { + rigaRegistroIvaItem = new RigaRegistroIvaItem(rigaDocumento.getIva()); + } + rigaRegistroIvaItem.setFEEsigibilitaIva(rigaDocumento.getFEEsigibilitaIva()); + rigaRegistroIvaItem.addImporto(rigaDocumento.getRDITotCosto(), 0.0D); + rigaRegistroIvaItem.setRegimeDelMargine(true); + getTotImponibileDO().add(rigaDocumento.getRDITotCosto()); + getRi().put(rm_theKey, rigaRegistroIvaItem); + } + String theKey = String.valueOf(rigaDocumento.getIva().getId_iva()); + if (getRiFatt().containsKey(theKey)) { + rii = getRiFatt().get(theKey); + } else { + rii = new RigaRegistroIvaItem(rigaDocumento.getIva()); + } + rii.addImporto(rigaDocumento.getRDITotImponibile(), rigaDocumento.getRDITotImposta()); + getRiFatt().put(theKey, rii); + } + + public Enumeration elements() { + return getRi().elements(); + } + + public Enumeration elementsNoType() { + return getRi().elements(); + } + + public Enumeration elementsFatt() { + return getRiFatt().elements(); + } + + public Enumeration elementsFattNoType() { + return getRiFatt().elements(); + } + + private Hashtable getRi() { + if (this.ri == null) + this.ri = new Hashtable<>(); + return this.ri; + } + + public double getImportoRM() { + return this.importoRM; + } + + public void setImportoRM(double importoRM) { + this.importoRM = importoRM; + } + + private void addRigaDocumentoRM(Iva l_iva, double imponibile, double imposta, double costo) { + String theKey = String.valueOf(l_iva.getId_iva()); + if (!l_iva.getFlgTipo().equals("R")) { + RigaRegistroIvaItem rii; + if (getRi().containsKey(theKey)) { + rii = getRi().get(theKey); + } else { + rii = new RigaRegistroIvaItem(l_iva); + } + rii.addImporto(imponibile, imposta); + getTotImponibileDO().add(imponibile); + getRi().put(theKey, rii); + } else { + synchronized (this) { + RigaRegistroIvaItem rii; + DoubleOperator dop = new DoubleOperator(this.importoRM); + dop.add(imponibile); + this.importoRM = dop.getResult(); + double l_imponibile = 0.0D; + if (getRi().containsKey(theKey)) { + rii = getRi().get(theKey); + } else { + rii = new RigaRegistroIvaItem(l_iva); + } + DoubleOperator impo = new DoubleOperator(imponibile); + DoubleOperator temp2 = new DoubleOperator((float)-l_iva.getAliquota()); + temp2.divide(100.0F); + temp2.add(1); + impo.subtract(costo); + DoubleOperator l_imposta = new DoubleOperator(impo.getResult()); + impo.setScale(4, 5); + impo.multiply(temp2); + l_imponibile = impo.getResult(); + l_imposta.subtract(l_imponibile); + rii.addImporto(l_imponibile, l_imposta.getResult()); + getTotImponibileDO().add(l_imponibile); + getRi().put(theKey, rii); + long l_id_ivaEs = l_iva.getParm("CODICE_IVA_REGIME_MARGINE").getNumeroLong(); + if (l_id_ivaEs == 0L) + l_id_ivaEs = l_iva.getId_iva(); + String es_theKey = String.valueOf(l_id_ivaEs); + if (getRi().containsKey(es_theKey)) { + rii = getRi().get(es_theKey); + } else { + Iva ivaEs = new Iva(l_iva.getApFull()); + ivaEs.findByPrimaryKey(l_id_ivaEs); + rii = new RigaRegistroIvaItem(ivaEs); + } + rii.addImporto(costo, 0.0D); + getRi().put(es_theKey, rii); + } + } + } + + private DoubleOperator getTotImponibileDO() { + if (this.totImponibileDO == null) { + this.totImponibileDO = new DoubleOperator(); + this.totImponibileDO.setScale(4, 5); + } + return this.totImponibileDO; + } + + public double getTotale() { + DoubleOperator dop = new DoubleOperator(getTotImponibile()); + dop.add(getTotIva()); + return dop.getResult(); + } + + public double getTotIva() { + Enumeration enu = getRi().elements(); + DoubleOperator dIva = new DoubleOperator(); + dIva.setScale(4, 5); + while (enu.hasMoreElements()) { + RigaRegistroIvaItem row = enu.nextElement(); + dIva.add(row.getImportoIva()); + } + dIva.setScale(2, 5); + return dIva.getResult(); + } + + public double getTotImponibile() { + return getTotImponibileDO().getResult(); + } + + public void addRigaDocumento(IvaInterface l_iva, double imponibile, double imposta, boolean isNotaDiCredito, boolean isPartitaIva) { + RigaRegistroIvaItem rii; + String theKey = String.valueOf(l_iva.getId_iva()); + if (getRi().containsKey(theKey)) { + rii = getRi().get(theKey); + } else { + rii = new RigaRegistroIvaItem(l_iva); + } + rii.addImporto(imponibile, imposta); + getTotImponibileDO().add(imponibile); + getRi().put(theKey, rii); + if (getRiFatt().containsKey(theKey)) { + rii = getRiFatt().get(theKey); + } else { + rii = new RigaRegistroIvaItem(l_iva); + } + rii.addImporto(imponibile, imposta); + getRiFatt().put(theKey, rii); + } + + protected Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + private void addRigaDocumentoRMOLD(Iva l_iva, double imponibile, double imposta, double costo) { + String theKey = String.valueOf(l_iva.getId_iva()); + if (!l_iva.getFlgTipo().equals("R")) { + RigaRegistroIvaItem rii; + if (getRi().containsKey(theKey)) { + rii = getRi().get(theKey); + } else { + rii = new RigaRegistroIvaItem(l_iva); + } + rii.addImporto(imponibile, imposta); + getTotImponibileDO().add(imponibile); + getRi().put(theKey, rii); + } else { + synchronized (this) { + RigaRegistroIvaItem rii; + DoubleOperator dop = new DoubleOperator(this.importoRM); + dop.add(imponibile); + this.importoRM = dop.getResult(); + double l_imponibile = 0.0D; + if (getRi().containsKey(theKey)) { + rii = getRi().get(theKey); + } else { + rii = new RigaRegistroIvaItem(l_iva); + } + DoubleOperator impo = new DoubleOperator(imponibile); + DoubleOperator temp2 = new DoubleOperator((float)-l_iva.getAliquota()); + temp2.divide(100.0F); + temp2.add(1); + impo.subtract(costo); + DoubleOperator l_imposta = new DoubleOperator(impo.getResult()); + impo.setScale(4, 5); + impo.multiply(temp2); + l_imponibile = impo.getResult(); + l_imposta.subtract(l_imponibile); + rii.addImporto(l_imponibile, l_imposta.getResult()); + getTotImponibileDO().add(l_imponibile); + getRi().put(theKey, rii); + long l_id_ivaEs = l_iva.getParm("CODICE_IVA_REGIME_MARGINE").getNumeroLong(); + if (l_id_ivaEs == 0L) + l_id_ivaEs = l_iva.getId_iva(); + String es_theKey = String.valueOf(l_id_ivaEs); + if (getRi().containsKey(es_theKey)) { + rii = getRi().get(es_theKey); + } else { + Iva ivaEs = new Iva(l_iva.getApFull()); + ivaEs.findByPrimaryKey(l_id_ivaEs); + rii = new RigaRegistroIvaItem(ivaEs); + } + rii.addImporto(costo, 0.0D); + getRi().put(es_theKey, rii); + } + } + } + + private Hashtable getRiFatt() { + if (this.riFatt == null) + this.riFatt = new Hashtable<>(); + return this.riFatt; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/CausaleContabileSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/CausaleContabileSvlt.java new file mode 100644 index 00000000..ef0c78b9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/CausaleContabileSvlt.java @@ -0,0 +1,73 @@ +package it.acxent.contab.servlet; + +import it.acxent.contab.CausaleContabile; +import it.acxent.contab.CausaleContabileCR; +import it.acxent.contab.RigaCausaleContabile; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contabConfig/CausaleContabile.abl"}) +public class CausaleContabileSvlt extends AblServletSvlt { + private static final long serialVersionUID = -442960013744440571L; + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) { + CausaleContabile bbean = (CausaleContabile)bean; + req.setAttribute("list", new RigaCausaleContabile(getApFull(req)).findByCausaleContabile(bbean.getId_causaleContabile())); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new CausaleContabile(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new CausaleContabileCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + super.prepareNewRecord(req, res); + } + + public void _addConto(HttpServletRequest req, HttpServletResponse res) { + long id_causaleContabile = getRequestLongParameter(req, "id_causaleContabile"); + long id_rigaCausaleContabile = getRequestLongParameter(req, "id_rigaCausaleContabile"); + ResParm rp = new ResParm(true); + CausaleContabile bean = new CausaleContabile(getApFull(req)); + bean.findByPrimaryKey(id_causaleContabile); + fillObject(req, bean); + rp = bean.save(); + if (rp.getStatus()) { + RigaCausaleContabile rBean = new RigaCausaleContabile(getApFull(req)); + rBean.findByPrimaryKey(id_rigaCausaleContabile); + fillObject(req, rBean); + rBean.setId_causaleContabile(bean.getId_causaleContabile()); + rBean.save(); + } + req.setAttribute("id_causaleContabile", Long.valueOf(bean.getId_causaleContabile())); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _modConto(HttpServletRequest req, HttpServletResponse res) { + long id_rigaCausaleContabile = getRequestLongParameter(req, "id_rigaCausaleContabile"); + RigaCausaleContabile riga = new RigaCausaleContabile(getApFull(req)); + riga.findByPrimaryKey(id_rigaCausaleContabile); + req.setAttribute("bean2", riga); + showBean(req, res); + } + + public void _delConto(HttpServletRequest req, HttpServletResponse res) { + long id_rigaCausaleContabile = getRequestLongParameter(req, "id_rigaCausaleContabile"); + RigaCausaleContabile riga = new RigaCausaleContabile(getApFull(req)); + riga.findByPrimaryKey(id_rigaCausaleContabile); + ResParm rp = riga.delete(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/CausaleMagazzinoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/CausaleMagazzinoSvlt.java new file mode 100644 index 00000000..e1bfb0e0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/CausaleMagazzinoSvlt.java @@ -0,0 +1,36 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.MagFisico; +import it.acxent.contab.CausaleMagazzino; +import it.acxent.contab.CausaleMagazzinoCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contabConfig/CausaleMagazzino.abl"}) +public class CausaleMagazzinoSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaMagFisico", new MagFisico(getApFull(req)).findAll()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaMagFisico", new MagFisico(getApFull(req)).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new CausaleMagazzino(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new CausaleMagazzinoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaMagFisico", new MagFisico(getApFull(req)).findAll()); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DistintaRibaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DistintaRibaSvlt.java new file mode 100644 index 00000000..92ffcc48 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DistintaRibaSvlt.java @@ -0,0 +1,81 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.Banca; +import it.acxent.anag.BancaCR; +import it.acxent.contab.DistintaRiba; +import it.acxent.contab.DistintaRibaCR; +import it.acxent.contab.DocumentoScadenza; +import it.acxent.contab.DocumentoScadenzaCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.Vectumerator; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contab/DistintaRiba.abl"}) +public class DistintaRibaSvlt extends AblServletSvlt { + private static final long serialVersionUID = -5831361296695092818L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + DistintaRiba bean = (DistintaRiba)beanA; + DocumentoScadenzaCR CR = new DocumentoScadenzaCR(); + fillObject(req, CR); + req.setAttribute("listaBanche", new Banca(getApFull(req)).findByCR(new BancaCR(), 0, 0)); + CR.setId_distintaRiba(bean.getId_distintaRiba()); + Vectumerator vec = new DocumentoScadenza(getApFull(req)).findByCR(CR, 0, 0); + if (CR.getFlgAccorpaScadenze() == 1L || bean.getFlgAccorpaScadenze() == 1L) + vec = bean.accorpaScadenze(vec); + req.setAttribute("listaScadenze", vec); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new DistintaRiba(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new DistintaRibaCR(getApFull(req)); + } + + protected void refresh(HttpServletRequest req, HttpServletResponse res) { + long id_distintaRiba = getRequestLongParameter(req, "id_distintaRiba"); + DistintaRiba bean = new DistintaRiba(getApFull(req)); + bean.findByPrimaryKey(id_distintaRiba); + fillComboAfterDetail(bean, req, res); + super.refresh(req, res); + } + + public void _creaFile(HttpServletRequest req, HttpServletResponse res) { + long id_distintaRiba = getRequestLongParameter(req, "id_distintaRiba"); + DistintaRiba bean = new DistintaRiba(getApFull(req)); + bean.findByPrimaryKey(id_distintaRiba); + ResParm rp = bean.creaFile(); + if (rp.getStatus()) { + req.setAttribute("retPath", rp.getMsg()); + sendMessage(req, "File creato correttamente"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + protected void print(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + try { + long l_id = getRequestLongParameter(req, "id_distintaRiba"); + DistintaRiba bean = new DistintaRiba(apFull); + bean.findByPrimaryKey(l_id); + DistintaRibaCR CR = new DistintaRibaCR(); + fillObject(req, CR); + CR.setId_distintaRiba(l_id); + sendPdf(res, bean.creaReportPdf(CR), "Riba_" + DBAdapter.getDayTimeTimestamp() + ".pdf"); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoOrdSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoOrdSvlt.java new file mode 100644 index 00000000..f57d2749 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoOrdSvlt.java @@ -0,0 +1,63 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.Iva; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.TipoPagamentoCR; +import it.acxent.anag.Users; +import it.acxent.anag.Vettore; +import it.acxent.contab.Documento; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.TipoDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contab/DocumentoOrd.abl"}) +public class DocumentoOrdSvlt extends DocumentoSvlt { + protected String getBeanPageName(HttpServletRequest req) { + return "documento"; + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Documento bean = (Documento)beanA; + super.fillComboAfterDetail(beanA, req, res); + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ResParm rp = new ResParm(true); + return rp; + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("id_tipoDocumento", String.valueOf(getId_docOrdine())); + return new ResParm(true); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("nf4", getNf4()); + req.setAttribute("listaOperatori", new Users(apFull) + .findUsersByProfileMax(9L)); + Documento bean = new Documento(apFull); + bean.setId_tipoDocumento(getId_docOrdine()); + bean.setFlgStato(1L); + bean.setId_tipoPagamento(1L); + req.setAttribute("bean", bean); + req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull) + .findByCR(new TipoPagamentoCR(), 0, 0)); + req.setAttribute("listaVettore", new Vettore(apFull).findAll()); + req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull) + .findAll()); + req.setAttribute("listaIva", new Iva(apFull).findAll()); + RigaDocumento bean2 = new RigaDocumento(apFull); + bean2.setId_iva(getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + req.setAttribute("bean2", bean2); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + search(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoPagamentoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoPagamentoSvlt.java new file mode 100644 index 00000000..67feb385 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoPagamentoSvlt.java @@ -0,0 +1,111 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.TipoPagamentoCR; +import it.acxent.contab.DocumentoPagamento; +import it.acxent.contab.DocumentoPagamentoCR; +import it.acxent.contab.TipoDocumento; +import it.acxent.contab.TipoDocumentoCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.StringTokenizer; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contab/DocumentoPagamento.abl"}) +public class DocumentoPagamentoSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaTipiPagamento", new TipoPagamento(getApFull(req)).findByCR(new TipoPagamentoCR(), 0, 0)); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipiPagamento", new TipoPagamento(apFull).findByCR(new TipoPagamentoCR(), 0, 0)); + TipoDocumentoCR TDCR = new TipoDocumentoCR(); + TDCR.setFlgTipologia(20L); + req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findByCR(TDCR, 0, 0)); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new DocumentoPagamento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new DocumentoPagamentoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaTipiPagamento", new TipoPagamento(getApFull(req)).findByCR(new TipoPagamentoCR(), 0, 0)); + DocumentoPagamento bean = new DocumentoPagamento(getApFull(req)); + bean.setId_documento(getRequestLongParameter(req, "id_documento")); + req.setAttribute("bean", bean); + } + + public void _loadLista(HttpServletRequest req, HttpServletResponse res) { + long id_clifor = getRequestLongParameter(req, "id_clifor"); + req.setAttribute("listaPagamenti", new DocumentoPagamento( + getApFull(req)).findByClifor(id_clifor, 1L)); + setJspPageRelative("/documentoPagamentoList.jsp", req); + callJsp(req, res); + } + + public void _savePagamenti(HttpServletRequest req, HttpServletResponse res) { + String listaDocumenti = getRequestParameter(req, "listaDocumenti"); + StringTokenizer st = new StringTokenizer(listaDocumenti, "|"); + DocumentoPagamento dp = null; + while (st.hasMoreTokens()) { + String documento = st.nextToken(); + StringTokenizer stDocumento = new StringTokenizer(documento, ","); + long id_documento = Long.valueOf(stDocumento.getToken(0)); + double importo = Double.valueOf(stDocumento.getToken(1)); + long flgStatoTipoIncasso = Long.valueOf(stDocumento.getToken(2)); + dp = new DocumentoPagamento(getApFull(req)); + fillObject(req, dp); + dp.setId_documento(id_documento); + dp.setFlgTipoMovimento(2L); + dp.setImporto(importo); + dp.setFlgTipoIncasso(flgStatoTipoIncasso); + dp.save(); + } + req.setAttribute("id_tipoPagamento", "0"); + search(req, res); + } + + protected String getBeanPageName(HttpServletRequest req) { + if (getAct(req).toLowerCase().equals("ins")) + return super.getBeanPageName(req) + super.getBeanPageName(req); + return super.getBeanPageName(req); + } + + public void _printReport(HttpServletRequest req, HttpServletResponse res) { + DocumentoPagamento bean = new DocumentoPagamento(getApFull(req)); + DocumentoPagamentoCR CR = new DocumentoPagamentoCR(getApFull(req)); + CR = (DocumentoPagamentoCR)req.getSession().getAttribute(getATTR_CRBEAN(req)); + sendPdf(res, bean.creaReportPdf(CR), "Report_Documenti_Pagamento " + DBAdapter.getDayTimeTimestamp()); + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + DocumentoPagamentoCR CR = new DocumentoPagamentoCR(getApFull(req)); + fillObject(req, CR); + if (CR.getId_clifor() > 0L) + if (CR.getClifor().getFlgTipo().equals("C")) { + req.setAttribute("flgClienteFornitore", "C"); + } else { + req.setAttribute("flgClienteFornitore", "F"); + } + return super.beforeSearch(req, res); + } + + public void _creaFileCvs(HttpServletRequest req, HttpServletResponse res) { + DocumentoPagamentoCR CR = (DocumentoPagamentoCR)req.getSession().getAttribute(getATTR_CRBEAN(req)); + DocumentoPagamento bean = new DocumentoPagamento(getApFull(req)); + bean.creaFileCvs(CR); + sendHtmlMsgResponse(req, res, "File export in formato cvs (Excel)"); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoPreSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoPreSvlt.java new file mode 100644 index 00000000..377333a8 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoPreSvlt.java @@ -0,0 +1,214 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.Iva; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.TipoPagamentoCR; +import it.acxent.anag.Users; +import it.acxent.anag.Vettore; +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoCR; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.TipoDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.Vectumerator; +import java.sql.Date; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contab/DocumentoPre.abl"}) +public class DocumentoPreSvlt extends DocumentoSvlt { + private static final long serialVersionUID = -3181095019824437439L; + + protected String getBeanPageName(HttpServletRequest req) { + if (getCmd(req).equals("search")) + return "documentoPre"; + return "documento"; + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + super.fillComboAfterDetail(beanA, req, res); + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ResParm rp = new ResParm(true); + return rp; + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + if (getRequestLongParameter(req, "flgTipologia") == 0L) + req.setAttribute("flgStatoPrenotazione", Integer.valueOf(200)); + req.setAttribute("flgTipologia", Integer.valueOf(4)); + return new ResParm(true); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("nf4", getNf4()); + req.setAttribute("listaOperatori", new Users(apFull).findUsersByProfileMax(9L)); + Documento bean = new Documento(apFull); + bean.setId_tipoDocumento(getId_docPrenotazione()); + bean.setFlgStato(1L); + bean.setId_tipoPagamento(1L); + req.setAttribute("bean", bean); + req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull).findByCR(new TipoPagamentoCR(), 0, 0)); + req.setAttribute("listaVettore", new Vettore(apFull).findAll()); + req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findAll()); + req.setAttribute("listaIva", new Iva(apFull).findAll()); + RigaDocumento bean2 = new RigaDocumento(apFull); + bean2.setId_iva(getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + req.setAttribute("bean2", bean2); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + super.otherCommands(req, res); + } + + public void _annAssPren(HttpServletRequest req, HttpServletResponse res) { + RigaDocumento row = new RigaDocumento(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_rigaDocumento"); + row.findByPrimaryKey(l_id); + row.setFlgPrenotazioneArrivata(0L); + ResParm rp = row.save(); + rp.append(row.getDocumento().aggiornaStatoPrenotazione(row.getDocumento().getFlgStatoPrenotazione(), 0L)); + if (rp.getStatus()) { + sendMessage(req, "Prenotazione riga aggiornata con successo!"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + public void _annullaSlip(HttpServletRequest req, HttpServletResponse res) { + RigaDocumento row = new RigaDocumento(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_rigaDocumento"); + row.findByPrimaryKey(l_id); + row.setQtaSlipStampate(0L); + ResParm rp = row.save(); + rp.append(row.getDocumento().aggiornaStatoPrenotazione(row.getDocumento().getFlgStatoPrenotazione(), 0L)); + if (rp.getStatus()) { + sendMessage(req, "Stampa slip azzerata. Prenotazione riga aggiornata con successo!"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + protected void XXXXotherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("aggionraSRCR")) { + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + long l_flgStatoRiparazione = getRequestLongParameter(req, "flgStatoRiparazioneS"); + ResParm rp = new ResParm(); + if (bean.getDBState() == 0) { + rp.setStatus(false); + rp.setMsg("Errore! Codice documento non valido"); + } else { + rp = bean.aggiornaStatoRiparazione(l_flgStatoRiparazione); + } + if (rp.getStatus()) { + sendMessage(req, "Stato Riparazione aggiornato."); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } else if (getCmd(req).equals("inviaAvviso")) { + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + ResParm rp = new ResParm(); + if (bean.getDBState() == 0) { + rp.setStatus(false); + rp.setMsg("Errore! Codice documento non valido"); + } else { + rp = bean.sendAvvisoRiparazione(); + } + if (rp.getStatus()) { + sendMessage(req, "Avviso inviato correttamente."); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } else if (getCmd(req).equals("annAssPren")) { + RigaDocumento row = new RigaDocumento(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_rigaDocumento"); + row.findByPrimaryKey(l_id); + row.setFlgPrenotazioneArrivata(0L); + ResParm rp = row.save(); + rp.append(row.getDocumento().aggiornaStatoPrenotazione(row.getDocumento().getFlgStatoPrenotazione(), 0L)); + if (rp.getStatus()) { + sendMessage(req, "Prenotazione riga aggiornata con successo!"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } else if (getCmd(req).equals("annullaSlip")) { + RigaDocumento row = new RigaDocumento(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_rigaDocumento"); + row.findByPrimaryKey(l_id); + row.setQtaSlipStampate(0L); + ResParm rp = row.save(); + rp.append(row.getDocumento().aggiornaStatoPrenotazione(row.getDocumento().getFlgStatoPrenotazione(), 0L)); + if (rp.getStatus()) { + sendMessage(req, "Stampa slip azzerata. Prenotazione riga aggiornata con successo!"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } else { + super.otherCommands(req, res); + } + } + + public void _addRestituzioneAcconto(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(true); + long id_documento = getRequestLongParameter(req, "id_documento"); + Date dataRestituzione = getRequestDateParameter(req, "dataRestituzioneAcconto"); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + req.setAttribute("CR", CR); + req.setAttribute("cmd", "search"); + if (id_documento > 0L) { + Documento bean = new Documento(apFull); + bean.findByPrimaryKey(id_documento); + bean.setDataRestituzioneAcconto(dataRestituzione); + rp = bean.aggiornaStatoPrenotazione(bean.getFlgStatoPrenotazione(), 100L); + } else { + rp = new ResParm(false, "ERRORE! Id documento non valido!"); + } + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _creaReportCsvPrenotazioni(HttpServletRequest req, HttpServletResponse res) { + DocumentoCR CR = (DocumentoCR)req.getSession().getAttribute("CRdocumentoPre"); + Documento bean = new Documento(getApFull(req)); + bean.creaFileCvsPrenotazioni(CR); + sendHtmlMsgResponse(req, res, "File export in formato cvs (Excel)"); + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + DocumentoCR CR = new DocumentoCR(getApFull(req)); + fillObject(req, CR); + if (CR.getFlgReport().equals("S")) { + req.getSession().setAttribute("CRdocumentoPre", CR); + if (CR.getFlgStatoPrenotazioneArt() > -1L) { + Documento bean = new Documento(getApFull(req)); + Vectumerator vec = bean.findPrenotazioniByCR(CR); + req.setAttribute("list", vec); + req.setAttribute("CR", CR); + callJsp(req, res); + } else { + super.search(req, res); + } + } else { + super.search(req, res); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoRipSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoRipSvlt.java new file mode 100644 index 00000000..b6453c52 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoRipSvlt.java @@ -0,0 +1,140 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.Iva; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.TipoPagamentoCR; +import it.acxent.anag.Users; +import it.acxent.anag.Vettore; +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoCR; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.TipoAllegatoDocumento; +import it.acxent.contab.TipoDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.AbMessages; +import it.acxent.util.Vectumerator; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contab/DocumentoRip.abl"}) +public class DocumentoRipSvlt extends DocumentoSvlt { + private static final long serialVersionUID = 6122990489236236941L; + + protected String getBeanPageName(HttpServletRequest req) { + return "documentoRip"; + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = (Documento)beanA; + int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheEdit() == 1L) ? 1 : 0; + Vectumerator vec = bean.findRigheDocumento(1, 1, ordineInverso); + if (vec.hasMoreElements()) { + RigaDocumento bean2 = (RigaDocumento)vec.nextElement(); + req.setAttribute("bean2", bean2); + } + req.setAttribute("listaDocGen", bean.getTipoDocumento().findDocGen(1L, 0L, 0, 0)); + req.setAttribute("listaOperatori", new Users(apFull).findUsersByFlgOperatore()); + req.setAttribute("listaDocFigli", bean.findDocumentiFiglio()); + req.setAttribute("listaDocPadri", bean.findDocumentiPadre()); + if (bean.getTipoDocumento().getFlgAllegato() == 1L) { + req.setAttribute("listaTipiAllegatoDocumento", new TipoAllegatoDocumento(apFull).findAll()); + req.setAttribute("listaAllegati", bean.getAllegati(0L)); + } + req.setAttribute("listaIva", new Iva(apFull).findAll()); + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Documento bean = (Documento)beanA; + RigaDocumento row = new RigaDocumento(getApFull(req)); + ResParm rp = new ResParm(true); + if (bean.getId_documento() != 0L) { + fillObject(req, row); + System.out.println(getRequestParameter(req, "flgReso")); + rp = Documento.addRigaDocumento(bean, row); + return bean.save(); + } + return rp; + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("id_tipoDocumento", String.valueOf(getId_docRiparazione())); + return new ResParm(true); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("nf4", getNf4()); + req.setAttribute("listaOperatori", new Users(apFull).findUsersByProfileMax(9L)); + Documento bean = new Documento(apFull); + bean.setId_tipoDocumento(getId_docRiparazione()); + bean.setFlgStato(1L); + bean.setId_tipoPagamento(1L); + req.setAttribute("bean", bean); + req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull).findByCR(new TipoPagamentoCR(), 0, 0)); + req.setAttribute("listaVettore", new Vettore(apFull).findAll()); + req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findAll()); + req.setAttribute("listaIva", new Iva(apFull).findAll()); + RigaDocumento bean2 = new RigaDocumento(apFull); + bean2.setId_iva(getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + req.setAttribute("bean2", bean2); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + super.otherCommands(req, res); + } + + protected void afterCreaDocFigli(HttpServletRequest req, HttpServletResponse res, Documento bean, long l_id_tipoDocumentoFiglio) { + TipoDocumento td = new TipoDocumento(getApFull(req)); + td.findByPrimaryKey(l_id_tipoDocumentoFiglio); + if (td.getFlgClienteFornitore().equals("F")) { + bean.setFlgStatoRiparazione(1L); + } else { + bean.setFlgStatoRiparazione(99L); + bean.setDataChiusura(DBAdapter.getToday()); + } + bean.save(); + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK")); + } + + public void _aggionraSRCR(HttpServletRequest req, HttpServletResponse res) { + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + long l_flgStatoRiparazione = getRequestLongParameter(req, "flgStatoRiparazioneS"); + ResParm rp = new ResParm(); + if (bean.getDBState() == 0) { + rp.setStatus(false); + rp.setMsg("Errore! Codice documento non valido"); + } else { + rp = bean.aggiornaStatoRiparazione(l_flgStatoRiparazione); + } + if (rp.getStatus()) { + sendMessage(req, "Stato Riparazione aggiornato."); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } + + public void _vediRientri(HttpServletRequest req, HttpServletResponse res) { + long l_id = getRequestLongParameter(req, "id_rigaDocumento"); + RigaDocumento bean2 = new RigaDocumento(getApFull(req)); + bean2.findByPrimaryKey(l_id); + req.setAttribute("list", new Documento(getApFull(req)).findRientri(bean2.getSeriale())); + req.setAttribute("bean2", bean2); + setJspPageRelative("rientriView.jsp", req); + callJsp(req, res); + } + + public void _creaReportCsvRiparazioni(HttpServletRequest req, HttpServletResponse res) { + DocumentoCR CR = (DocumentoCR)req.getSession().getAttribute(getATTR_CRBEAN(req)); + Documento bean = new Documento(getApFull(req)); + bean.creaFileCvsRiparazioni(CR); + sendHtmlMsgResponse(req, res, "File export in formato cvs (Excel)"); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoScadenzaAutoComboSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoScadenzaAutoComboSvlt.java new file mode 100644 index 00000000..2e5150af --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoScadenzaAutoComboSvlt.java @@ -0,0 +1,81 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.Banca; +import it.acxent.contab.DistintaRiba; +import it.acxent.contab.DocumentoScadenza; +import it.acxent.contab.DocumentoScadenzaCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.Vectumerator; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class DocumentoScadenzaAutoComboSvlt extends DocumentoScadenzaAutoOrdSvlt { + protected String getBeanPageName(HttpServletRequest req) { + return "documentoScadenzaAutoCombo"; + } + + protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) { + Vectumerator vecBanca; + ApplParmFull apFull = getApFull(req); + long timestampElaborazione = getRequestLongParameter(req, "timestampElaborazione"); + Vectumerator vec = new Vectumerator(); + if (timestampElaborazione > 0L) { + Banca banca = new Banca(apFull); + banca.resetPresentazioneRibaAuto(); + vecBanca = new Banca(apFull).findByOrdine(); + } else { + vecBanca = new Banca(apFull).findByOrdineVisibili(); + } + vecBanca.moveFirst(); + while (vecBanca.hasMoreElements()) { + Banca banca = (Banca)vecBanca.nextElement(); + DistintaRiba dr = new DistintaRiba(apFull); + if (timestampElaborazione > 0L) + dr.findDistintaByTimestampBanca(timestampElaborazione, banca.getId_banca()); + dr.setId_banca(banca.getId_banca()); + dr.setTimestampElaborazione(timestampElaborazione); + double importo = getRequestDoubleParameter(req, "distinta_" + banca.getId_banca()); + dr.setImportoManuale(importo); + if (timestampElaborazione == 0L || dr.getId_distintaRiba() > 0L) { + banca.addBancaAPresentazioneRibaAuto(); + vec.add(dr); + } + } + req.setAttribute("listaBanche", vec); + req.setAttribute("listaBancheNonVis", new Banca(apFull).findNonVisibili()); + req.setAttribute("listaEstrazioni", new DistintaRiba(apFull).findDistinte()); + } + + public void _init(HttpServletRequest req, HttpServletResponse res) { + Banca banca = new Banca(getApFull()); + banca.resetPresentazioneRibaAuto(); + fillComboAfterSearch(getBeanCR(req), req, res); + showBean(req, res); + } + + public void _rimuoviBancaDaDistinta(HttpServletRequest req, HttpServletResponse res) { + long id_banca = getRequestLongParameter(req, "id_banca"); + Banca banca = new Banca(getApFull()); + banca.findByPrimaryKey(id_banca); + ResParm rp = banca.rimuoviBancaAPresentazioneRibaAuto(); + DocumentoScadenza bean = new DocumentoScadenza(getApFull(req)); + DocumentoScadenzaCR CR = new DocumentoScadenzaCR(getApFull()); + fillObject(req, CR); + CR.setFlgDaEstrarre(1L); + CR.setFlgSoloRiba(1L); + double tot = bean.getTotaleScadenzeByCR(CR); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _addBancaADistinta(HttpServletRequest req, HttpServletResponse res) { + long id_banca = getRequestLongParameter(req, "id_bancaDaAggungere"); + Banca banca = new Banca(getApFull()); + banca.findByPrimaryKey(id_banca); + ResParm rp = banca.addBancaAPresentazioneRibaAuto(); + sendMessage(req, rp.getMsg()); + search(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoScadenzaAutoOrdSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoScadenzaAutoOrdSvlt.java new file mode 100644 index 00000000..a2a7305f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoScadenzaAutoOrdSvlt.java @@ -0,0 +1,184 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.Banca; +import it.acxent.anag.BancaCR; +import it.acxent.contab.DistintaRiba; +import it.acxent.contab.DistintaRibaCR; +import it.acxent.contab.DocumentoScadenza; +import it.acxent.contab.DocumentoScadenzaCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.HashMapUtil; +import it.acxent.util.Vectumerator; +import java.util.HashMap; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contab/DocumentoScadenzaAuto.abl"}) +public class DocumentoScadenzaAutoOrdSvlt extends AblServletSvlt { + private static final long serialVersionUID = -7830020471332013441L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long timestampElaborazione = getRequestLongParameter(req, "timestampElaborazione"); + Vectumerator vec = new Vectumerator(); + Vectumerator vecBanca = new Banca(apFull).findByOrdine(); + vecBanca.moveFirst(); + while (vecBanca.hasMoreElements()) { + Banca banca = (Banca)vecBanca.nextElement(); + DistintaRiba dr = new DistintaRiba(apFull); + if (timestampElaborazione > 0L) + dr.findDistintaByTimestampBanca(timestampElaborazione, banca.getId_banca()); + dr.setId_banca(banca.getId_banca()); + dr.setTimestampElaborazione(timestampElaborazione); + double importo = getRequestDoubleParameter(req, "distinta_" + banca.getId_banca()); + dr.setImportoManuale(importo); + vec.add(dr); + } + req.setAttribute("listaBanche", vec); + req.setAttribute("listaEstrazioni", new DistintaRiba(apFull).findDistinte()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new DocumentoScadenza(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new DocumentoScadenzaCR(getApFull(req)); + } + + public void _creaDistinta(HttpServletRequest req, HttpServletResponse res) { + DocumentoScadenza bean = new DocumentoScadenza(getApFull(req)); + DocumentoScadenzaCR CR = new DocumentoScadenzaCR(getApFull()); + fillObject(req, CR); + CR.setFlgDaEstrarre(1L); + CR.setFlgSoloRiba(1L); + CR.setFlgOrderImporto(1L); + System.out.println("_creaDistinta"); + Vectumerator vecRiba = new Vectumerator(); + Vectumerator vec = new Banca(getApFull(req)).findByOrdine(); + while (vec.hasMoreElements()) { + Banca row = (Banca)vec.nextElement(); + double importo = getRequestDoubleParameter(req, "distinta_" + row.getId_banca()); + if (importo > 0.0D) { + System.out.println("" + row.getId_banca() + " - " + row.getId_banca() + " " + row.getDescrizione()); + row.setImportoRiba(importo); + vecRiba.add(row); + } + } + CR.setVecRiba(vecRiba); + bean.creaDistinte(CR); + req.setAttribute("timestampElaborazione", Long.valueOf(CR.getTimestampElaborazione())); + req.setAttribute("CR", CR); + search(req, res); + } + + public void _eliminaDistinta(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long id_distintaRiba = getRequestLongParameter(req, "id_distintaRiba"); + DocumentoScadenzaCR CR = new DocumentoScadenzaCR(apFull); + fillObject(req, CR); + DistintaRiba distinta = new DistintaRiba(apFull); + distinta.findByPrimaryKey(id_distintaRiba); + req.setAttribute("timestampElaborazione", Long.valueOf(distinta.getTimestampElaborazione())); + ResParm rp = distinta.delete(); + req.setAttribute("CR", CR); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _selezionaScadenza(HttpServletRequest req, HttpServletResponse res) { + long id_documentoScadenza = getRequestLongParameter(req, "id_documentoScadenza"); + DocumentoScadenza documentoScadenza = new DocumentoScadenza(getApFull(req)); + documentoScadenza.findByPrimaryKey(id_documentoScadenza); + documentoScadenza.setFlgScadenzaSelezionata(1L); + documentoScadenza.save(); + } + + public void _deselezionaScadenza(HttpServletRequest req, HttpServletResponse res) { + long id_documentoScadenza = getRequestLongParameter(req, "id_documentoScadenza"); + DocumentoScadenza documentoScadenza = new DocumentoScadenza(getApFull(req)); + documentoScadenza.findByPrimaryKey(id_documentoScadenza); + documentoScadenza.setFlgScadenzaSelezionata(0L); + documentoScadenza.save(); + } + + protected String getBeanPageName(HttpServletRequest req) { + return "documentoScadenzaAutoOrd"; + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } + + public void _recuperaTotale(HttpServletRequest req, HttpServletResponse res) { + DocumentoScadenza bean = new DocumentoScadenza(getApFull(req)); + DocumentoScadenzaCR CR = new DocumentoScadenzaCR(getApFull()); + fillObject(req, CR); + CR.setFlgDaEstrarre(1L); + CR.setFlgSoloRiba(1L); + double tot = bean.getTotaleScadenzeByCR(CR); + sendHtmlMsgResponse(req, res, getNf().format(tot)); + } + + protected void print(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + try { + long l_id = getRequestLongParameter(req, "id_distintaRiba"); + DistintaRiba bean = new DistintaRiba(apFull); + bean.findByPrimaryKey(l_id); + DistintaRibaCR CR = new DistintaRibaCR(); + fillObject(req, CR); + CR.setId_distintaRiba(l_id); + sendPdf(res, bean.creaReportPdf(CR), "Report_Documenti_Scadenza " + DBAdapter.getDayTimeTimestamp()); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void _creaDistintaxx(HttpServletRequest req, HttpServletResponse res) { + DocumentoScadenza bean = new DocumentoScadenza(getApFull(req)); + DocumentoScadenzaCR CR = new DocumentoScadenzaCR(getApFull()); + fillObject(req, CR); + CR.setFlgDaEstrarre(1L); + CR.setFlgSoloRiba(1L); + CR.setFlgOrderImporto(1L); + HashMap hm = new HashMap<>(); + Vectumerator vec = new Banca(getApFull(req)).findByCR(new BancaCR(), 0, 0); + while (vec.hasMoreElements()) { + Banca banca = (Banca)vec.nextElement(); + double importo = getRequestDoubleParameter(req, "distinta_" + banca.getId_banca()); + if (importo > 0.0D) + hm.put(Long.valueOf(banca.getId_banca()), Double.valueOf(importo)); + } + hm = (HashMap)HashMapUtil.sortReverseByValue(hm); + bean.creaDistinte(CR); + req.setAttribute("timestampElaborazione", Long.valueOf(CR.getTimestampElaborazione())); + req.setAttribute("CR", CR); + showBean(req, res); + } + + public void _bancaMeno(HttpServletRequest req, HttpServletResponse res) { + long id_banca = getRequestLongParameter(req, "id_banca"); + Banca banca = new Banca(getApFull()); + banca.findByPrimaryKey(id_banca); + ResParm rp = banca.settaOrdineMeno(); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _bancaPiu(HttpServletRequest req, HttpServletResponse res) { + long id_banca = getRequestLongParameter(req, "id_banca"); + Banca banca = new Banca(getApFull()); + banca.findByPrimaryKey(id_banca); + ResParm rp = banca.settaOrdinePiu(); + sendMessage(req, rp.getMsg()); + search(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoScadenzaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoScadenzaSvlt.java new file mode 100644 index 00000000..695411aa --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoScadenzaSvlt.java @@ -0,0 +1,88 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.Banca; +import it.acxent.anag.BancaCR; +import it.acxent.contab.DistintaRiba; +import it.acxent.contab.DistintaRibaCR; +import it.acxent.contab.DocumentoScadenza; +import it.acxent.contab.DocumentoScadenzaCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.StringTokenizer; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contab/DocumentoScadenza.abl"}) +public class DocumentoScadenzaSvlt extends AblServletSvlt { + private static final long serialVersionUID = -7830020471332013441L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaBanche", new Banca(getApFull(req)).findByCR(new BancaCR(), 0, 0)); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new DocumentoScadenza(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new DocumentoScadenzaCR(getApFull(req)); + } + + public void _creaDistinta(HttpServletRequest req, HttpServletResponse res) { + String scadenzeSelezionate = req.getParameter("scadenzeSelezionate"); + StringTokenizer st = new StringTokenizer(scadenzeSelezionate, ";"); + DocumentoScadenza documentoScadenza = new DocumentoScadenza(getApFull(req)); + DistintaRibaCR CR = new DistintaRibaCR(); + fillObject(req, CR); + DistintaRiba distinta = new DistintaRiba(getApFull(req)); + fillObject(req, distinta); + distinta.setFlgStatoDistinta(0L); + ResParm rp = distinta.save(); + if (rp.getStatus()) + while (st.hasMoreTokens()) { + String s = st.nextToken(); + if (!s.isEmpty()) { + documentoScadenza = new DocumentoScadenza(getApFull(req)); + documentoScadenza.findByPrimaryKey(Long.valueOf(s)); + documentoScadenza.setFlgScadenzaSelezionata(0L); + documentoScadenza.setId_distintaRiba(distinta.getId_distintaRiba()); + documentoScadenza.save(); + } + } + search(req, res); + } + + public void _selezionaScadenza(HttpServletRequest req, HttpServletResponse res) { + long id_documentoScadenza = getRequestLongParameter(req, "id_documentoScadenza"); + DocumentoScadenza documentoScadenza = new DocumentoScadenza(getApFull(req)); + documentoScadenza.findByPrimaryKey(id_documentoScadenza); + documentoScadenza.setFlgScadenzaSelezionata(1L); + documentoScadenza.save(); + } + + public void _deselezionaScadenza(HttpServletRequest req, HttpServletResponse res) { + long id_documentoScadenza = getRequestLongParameter(req, "id_documentoScadenza"); + DocumentoScadenza documentoScadenza = new DocumentoScadenza(getApFull(req)); + documentoScadenza.findByPrimaryKey(id_documentoScadenza); + documentoScadenza.setFlgScadenzaSelezionata(0L); + documentoScadenza.save(); + } + + protected void print(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoScadenza bean = new DocumentoScadenza(apFull); + try { + DocumentoScadenzaCR CR = new DocumentoScadenzaCR(); + fillObject(req, CR); + sendPdf(res, bean.creaListaScadenzePdf(CR), "Report_Documenti_Scadenza " + DBAdapter.getDayTimeTimestamp()); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoSvlt.java new file mode 100644 index 00000000..9245b286 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/DocumentoSvlt.java @@ -0,0 +1,3135 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.Aspetto; +import it.acxent.anag.Banca; +import it.acxent.anag.CausaleTrasporto; +import it.acxent.anag.Clifor; +import it.acxent.anag.Fornitore; +import it.acxent.anag.Iva; +import it.acxent.anag.MagFisico; +import it.acxent.anag.Porto; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.TipoPagamentoCR; +import it.acxent.anag.Users; +import it.acxent.anag.Vettore; +import it.acxent.api.ApiClientResult; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloTaglia; +import it.acxent.art.ArticoloVariante; +import it.acxent.art.Colore; +import it.acxent.art.Reparto; +import it.acxent.art.Taglia; +import it.acxent.brt.api.BrtApi; +import it.acxent.brt.api.json.PudoPoint; +import it.acxent.cc.Attivita; +import it.acxent.cc.api.CcApi; +import it.acxent.contab.AllegatoDocumento; +import it.acxent.contab.DocFiglioPadre; +import it.acxent.contab.DocPrel; +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoAgente; +import it.acxent.contab.DocumentoCR; +import it.acxent.contab.DocumentoInterface; +import it.acxent.contab.DocumentoPagamento; +import it.acxent.contab.DocumentoScadenza; +import it.acxent.contab.Movimento; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.RigaDocumentoCR; +import it.acxent.contab.RigaDocumentoP; +import it.acxent.contab.RigaDocumentoPKey; +import it.acxent.contab.RigaDocumentoPM; +import it.acxent.contab.RigaDocumentoProgettista; +import it.acxent.contab.TipoAllegatoDocumento; +import it.acxent.contab.TipoDocumento; +import it.acxent.contab.TipoDocumentoCR; +import it.acxent.contab.TipologiaDocumento; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.jsp.Ab; +import it.acxent.tex.anag.ArticoloTessutoColore; +import it.acxent.tex.anag.Lavorazione; +import it.acxent.tex.anag.Telaio; +import it.acxent.tex.anag.TelaioCR; +import it.acxent.tex.lav.LavPezza; +import it.acxent.util.AbMessages; +import it.acxent.util.ReturnItem; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.util.HashMap; +import java.util.Map; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contab/Documento.abl", "/admin/contab/Documento.abl.pdf"}) +public class DocumentoSvlt extends _ContabSvlt { + private static final long serialVersionUID = 7285217818321285875L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoInterface bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (DocumentoInterface)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + if (bean.getId_tipoDocumento() == 1L && bean.isScontrinoEmesso() && getLoginUser(req).getId_userProfile() > 1L) { + forceMessage(req, "Attenzione! L'utente non ha i permessi per modificare uno scontrino emesso!!"); + showBean(req, res); + } else { + fillObject(req, bean); + rp = bean.save(); + l_id = bean.getId_documento(); + req.setAttribute("id_documento", String.valueOf(l_id)); + bean.setFlgMantieniArticoloRiga(getRequestLongParameter(req, "flgMantieniArticoloRiga")); + bean.setFlgAutoAdd(getRequestLongParameter(req, "flgAutoAdd")); + bean.setFlgSingleLineArt(getRequestLongParameter(req, "flgSingleLineArt")); + if (rp.getStatus() == true) { + if (getAct(req).equals("addRigaArticolo")) { + final RigaDocumento row = new RigaDocumento(apFull); + if (l_id != 0L) { + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + if (l_id_rigaDocumento > 0L) + row.findByPrimaryKey(l_id_rigaDocumento); + fillObject(req, row); + row.setLastUpdTmst(getRequestTmstParameter(req, "lastUpdTmstRow1")); + rp = Documento.addRigaDocumento(bean, row); + if (!rp.getStatus()) + forceMessage(req, rp.getMsg()); + if (row.getDocumento().getId_tipoDocumento() == row.getParm("ID_DOC_CASSA").getNumeroLong()) { + final Users theUser = (Users)getLoginUser(req); + new Thread() { + public void run() { + row.getDocumento().stampaDisplayCassa(theUser.getRegCassa(), row); + } + }.start(); + } + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + bean.findByPrimaryKey(l_id); + bean.setFlgMantieniArticoloRiga(getRequestLongParameter(req, "flgMantieniArticoloRiga")); + bean.setFlgAutoAdd(getRequestLongParameter(req, "flgAutoAdd")); + bean.setFlgSingleLineArt(getRequestLongParameter(req, "flgSingleLineArt")); + bean.setFlgInserisciReso(0L); + if (bean.getFlgMantieniArticoloRiga() == 1L) { + RigaDocumento row2 = new RigaDocumento(apFull); + row2.setId_articolo(row.getId_articolo()); + row2.setId_articoloVariante(row.getId_articoloVariante()); + row2.setDescrizioneRiga(row.getDescrizioneRiga()); + row2.setImponibile(row.getImponibile()); + row2.setId_iva(row.getId_iva()); + req.setAttribute("bean2", row2); + } + bean.setCurrentFocus("descrizioneRiga"); + req.setAttribute("bean", bean); + showBean(req, res); + } else if (getAct(req).equals("modRigaArticolo")) { + _modRigaArticolo(req, res); + } else if (getAct(req).equals("delRigaArticolo")) { + _delRigaArticolo(req, res); + } else if (getAct(req).equals("modRigaArticoloSeriale")) { + final RigaDocumento row = new RigaDocumento(apFull); + if (getRequestLongParameter(req, "id_rigaDocumento") != 0L) { + fillObject(req, row); + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + row.findByPrimaryKey(l_id_rigaDocumento); + req.setAttribute("bean2", row); + req.setAttribute("bean2", row); + if (row.getFlgReso() == 1L) { + bean.setFlgInserisciReso(1L); + req.setAttribute("bean", bean); + } + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("chiudiRigaArticolo")) { + final RigaDocumento row = new RigaDocumento(apFull); + if (getRequestLongParameter(req, "id_rigaDocumento") != 0L) { + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + row.findByPrimaryKey(l_id_rigaDocumento); + rp = row.settaRigaPrelevata(); + if (rp.getStatus()) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK")); + } else { + sendMessage(req, rp.getMsg()); + } + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("apriRigaArticolo")) { + final RigaDocumento row = new RigaDocumento(apFull); + if (getRequestLongParameter(req, "id_rigaDocumento") != 0L) { + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + row.findByPrimaryKey(l_id_rigaDocumento); + rp = row.annullaRigaPrelevata(); + if (rp.getStatus()) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK")); + } else { + sendMessage(req, rp.getMsg()); + } + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("prelevaArticolo")) { + final RigaDocumento row = new RigaDocumento(apFull); + if (getRequestLongParameter(req, "id_rigaDocumentoDaPrelevare") != 0L) { + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumentoDaPrelevare"); + row.findByPrimaryKey(l_id_rigaDocumento); + double qtaDaPrelevare = getRequestDoubleParameter(req, "qtaDaPrelevare"); + rp = bean.addRigaDocumentoDaPrelevare(row, qtaDaPrelevare); + if (rp.getStatus()) { + sendMessage(req, "Documento prelevato correttamente!"); + } else { + sendMessage(req, rp.getMsg()); + } + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("delPrelevaArticolo")) { + final RigaDocumentoP row = new RigaDocumentoP(apFull); + RigaDocumentoPKey pKey = new RigaDocumentoPKey(0L, 0L); + fillObject(req, pKey); + row.findByKey(pKey); + Documento ordine = row.getRigaDocumentoPrelevata().getDocumento(); + ordine.setFlgDocumentoPrelevato(0L); + ordine.superSave(); + rp = row.delete(); + if (rp.getStatus()) { + sendMessage(req, "Associazione tra documenti eliminata correttamente!"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } else if (getAct(req).equals("addAllegato")) { + final AllegatoDocumento row = new AllegatoDocumento(apFull); + fillObject(req, row); + rp = bean.addAllegato(row); + rp.append(creaFileAllegato(bean, req, res)); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delAllegato")) { + final AllegatoDocumento row = new AllegatoDocumento(apFull); + fillObject(req, row); + rp = bean.delAllegato(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Allegato Cancellato"); + showBean(req, res); + } else if (getAct(req).equals("addSeriale")) { + long l_id_articolo = getRequestLongParameter(req, "id_articoloS"); + long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVarianteS"); + String l_seriale = getRequestParameter(req, "serialeS"); + Movimento mov = new Movimento(apFull); + mov.findBySerialeDisponibile(l_seriale); + RigaDocumento rd = new RigaDocumento(apFull); + rd.findMagBySerialeDisponibile(l_seriale); + if (mov.getId_articolo() != rd.getId_articolo()) { + System.out.println("DocumentoSvlt:addrow:addSeriale: rd.findBySeriale non coincide con mov..."); + rp.setMsg("ERRORE! Seriale " + l_seriale + " inesistente o non disponibile"); + rp.setStatus(false); + } else if (rd.getId_articolo() != 0L) { + l_id_articolo = rd.getId_articolo(); + l_id_articoloVariante = rd.getId_articoloVariante(); + rp = Documento.addSerialeSuRigheDocumento(bean, l_id_articolo, l_id_articoloVariante, l_seriale); + } else { + rp.setMsg("ERRORE! Seriale " + l_seriale + " inesistente o non disponibile"); + rp.setStatus(false); + } + bean.setFlgMantieniArticoloRiga(getRequestLongParameter(req, "flgMantieniArticoloRiga")); + bean.setFlgAutoAdd(getRequestLongParameter(req, "flgAutoAdd")); + bean.setFlgSingleLineArt(getRequestLongParameter(req, "flgSingleLineArt")); + bean.setFlgInserisciReso(0L); + forceMessage(req, rp.getMsg()); + req.setAttribute("bean", bean); + showBean(req, res); + } + } else { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + super.processRequest(req, res); + } + + protected int getPageRow(HttpServletRequest req) { + long l_id_tipoDocumento = getRequestLongParameter(req, "id"); + TipoDocumento tipoDocumento = new TipoDocumento(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_documento"); + if (l_id > 0L) { + Documento bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + l_id_tipoDocumento = bean.getId_tipoDocumento(); + } + if (l_id_tipoDocumento == getId_docCassa() && !getAct(req).equals("del")) + return 0; + return super.getPageRow(req); + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = (Documento)beanA; + long l_id_tipoDocumento = bean.getId_tipoDocumento(); + if (l_id_tipoDocumento == getId_docRiparazione()) { + Vectumerator vec = bean.findRigheDocumento(1, 1, 0); + if (vec.hasMoreElements()) { + RigaDocumento bean2 = (RigaDocumento)vec.nextElement(); + req.setAttribute("bean2", bean2); + } + } + int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheEdit() == 1L) ? 1 : 0; + req.setAttribute("listaOperatori", new Users(apFull).findUsersByFlgOperatore()); + if (bean.getId_tipoDocumento() == getId_docCassa()) { + req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull).findCodiciTender()); + req.setAttribute("listaReparti", new Reparto(apFull).findAll()); + } else { + req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull).findByCR(new TipoPagamentoCR(), 0, 0)); + } + req.setAttribute("listaDestinazioneDiversa", bean.getClifor().getDestinazioniDiverse()); + req.setAttribute("listaVettore", new Vettore(apFull).findAll()); + req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findAll()); + req.setAttribute("listaAspetto", new Aspetto(apFull).findAll()); + req.setAttribute("listaPorto", new Porto(apFull).findAll()); + req.setAttribute("listaCausaleTrasporto", new CausaleTrasporto(apFull).findAll()); + if (bean.getTipoDocumento().getFlgOss() == 2L) { + req.setAttribute("listaIva", new Iva(apFull).findAllNonOss()); + } else if (bean.getTipoDocumento().getFlgOss() == 1L) { + req.setAttribute("listaIva", new Iva(apFull).findAllOss()); + } else { + req.setAttribute("listaIva", new Iva(apFull).findAll()); + } + RigaDocumentoCR CR2 = new RigaDocumentoCR(); + fillObject(req, CR2); + req.setAttribute("CR2", CR2); + CR2.setFlgCodiceRiga(0L); + req.setAttribute("listaRigheDocumento", bean.findRigheDocumento(CR2.getSearchRighe(), + (int)getRequestLongParameter(req, "pageNumber_righe"), getPageRow(req) / 2, ordineInverso)); + req.setAttribute("listaLavorazione", new Lavorazione(apFull).findByTipoDocumento(bean.getId_tipoDocumento())); + if (bean.getTipoDocumento().getFlgTipologia() == 201L || + bean.getTipoDocumento().getFlgTipologia() == 202L) { + long l_id_rdTessuto = 0L; + if (req.getAttribute("beanRDTessuto") == null) { + l_id_rdTessuto = getRequestLongParameter(req, "id_rigaDocumentoTessutoA"); + } else { + RigaDocumento rigaDocumento = (RigaDocumento)req.getAttribute("beanRDTessuto"); + if (rigaDocumento != null) + l_id_rdTessuto = rigaDocumento.getId_rigaDocumento(); + } + if (l_id_rdTessuto > 0L) { + RigaDocumento rdTessuto = new RigaDocumento(apFull); + rdTessuto.findByPrimaryKey(l_id_rdTessuto); + req.setAttribute("beanRDTessuto", rdTessuto); + if (rdTessuto.getId_rigaDocumento() > 0L) + req.setAttribute("listaRigheDocumento2", rdTessuto.findRigheFilatiByRDTessuto(l_id_rdTessuto)); + req.setAttribute("listaArticoloTessutoFilato", rdTessuto.getArticoloTessuto().findArticoliTessutoFilati(0, 0)); + } + } + req.setAttribute("listaDocPadri", bean.findDocumentiPadre()); + req.setAttribute("listaDocFigli", bean.findDocumentiFiglio()); + req.setAttribute("listaDocFPPadri", bean.findDocFiglioPadreByFiglio()); + req.setAttribute("listaDocFPFigli", bean.findDocFiglioPadreByPadre()); + RigaDocumento row = new RigaDocumento(apFull); + row = (RigaDocumento)req.getAttribute("bean2"); + if (row == null || row.getId_iva() == 0L) { + if (row == null) + row = new RigaDocumento(apFull); + row.setId_iva(row.getCodiceIvaVendStd()); + req.setAttribute("bean2", row); + } + if (bean.getTipoDocumento().hasDocPrel()) { + req.setAttribute("listaRigheDocumentoPrelevabili", bean.findRigheDocumentoPrelevabili(0, 0)); + req.setAttribute("listaRigheDocumentoPrelevati", bean.findRigheDocumentoPrelevateAssociate(0, 0)); + } + if (bean.getTipoDocumento().getFlgAllegato() == 1L) { + req.setAttribute("listaTipiAllegatoDocumento", new TipoAllegatoDocumento(apFull).findAll()); + req.setAttribute("listaAllegati", bean.getAllegati(0L)); + } + req.setAttribute("listaAgenti", new DocumentoAgente(apFull).findByDocumento(bean.getId_documento())); + req.setAttribute("totaleImportiAgenti", new DocumentoAgente(apFull)); + if (bean.getTipoDocumento().getCausaleMagazzino().isMagPartenzaDaScegliere()) + req.setAttribute("listaMagPartenza", new MagFisico(apFull) + .findByCausalePartenza(bean.getTipoDocumento().getCausaleMagazzino())); + if (bean.getTipoDocumento().getCausaleMagazzino().isMagArrivoDaScegliere()) + req.setAttribute("listaMagArrivo", new MagFisico(apFull).findByCausaleArrivo(bean.getTipoDocumento().getCausaleMagazzino())); + if (bean.getTipoDocumento().getCausaleMagazzino2().isMagPartenzaDaScegliere()) + req.setAttribute("listaMagPartenza2", new MagFisico(apFull) + .findByCausalePartenza(bean.getTipoDocumento().getCausaleMagazzino2())); + if (bean.getTipoDocumento().getCausaleMagazzino2().isMagArrivoDaScegliere()) + req.setAttribute("listaMagArrivo2", new MagFisico(apFull) + .findByCausaleArrivo(bean.getTipoDocumento().getCausaleMagazzino2())); + req.setAttribute("listaBanche", new Banca(apFull).findAll()); + req.setAttribute("listaPagamenti", new DocumentoPagamento(apFull).findByDocumento(bean.getId_documento())); + req.setAttribute("listaScadenze", new DocumentoScadenza(apFull).findByDocumento(bean.getId_documento())); + req.setAttribute("listaBancaAnticipo", new Banca(apFull).findAll()); + if (bean.getTipoDocumento().getFlgTipologia() == 200L) + req.setAttribute("listaTelaio", new Telaio(apFull).findByCR(new TelaioCR(), 0, 0)); + if (bean.getTipoDocumento().getFlgTipologia() == 210L) { + Vectumerator vecTaglia = new Taglia(apFull).findAll(); + req.setAttribute("listaTaglie", vecTaglia); + if (vecTaglia.hasMoreElements()) { + Taglia tagliaPrima = (Taglia)vecTaglia.nextElement(); + bean.setId_taglia(tagliaPrima.getId_taglia()); + } + req.setAttribute("listaColoriDaAggiungere", new Colore(apFull).findAll()); + req.setAttribute("listaRigheDocumento", bean.findRigheDocumento(CR2.getSearchRighe(), 0, 0, ordineInverso)); + } + if (bean.getTipoDocumento().getFlgTipologia() == 220L) { + req.setAttribute("listaOrdiniAssociati", new DocFiglioPadre(apFull).findByPadre(bean.getId_documento())); + req.setAttribute("listaRigheDocumento", bean.findRigheDocumento(CR2.getSearchRighe(), 0, 0, ordineInverso)); + } + if (bean.getFlgDeliveryType() == 2L) { + BrtApi brtapi = new BrtApi(apFull); + Vectumerator vecPudo = brtapi.findPudoPointByPudoAddress(bean.getPudoAddress()); + req.setAttribute("listaPudo", vecPudo); + } + } + + protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + req.setAttribute("listaTipologiaDocumento", new TipologiaDocumento(apFull).findAll()); + req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull).findByCR(new TipoPagamentoCR(), 0, 0)); + req.setAttribute("listaVettore", new Vettore(apFull).findAll()); + if (getLoginUser(req).getId_userProfile() == 10L) { + req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull) + .findByTipologiaClienteFornitoreAFT(-1L, "C", -1L, -1L)); + } else { + req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findByCR(new TipoDocumentoCR(), 0, 0)); + } + req.setAttribute("listaOperatori", new Users(apFull).findUsersByFlgOperatore()); + req.setAttribute("listaBancaAnticipo", new Banca(apFull).findAll()); + req.setAttribute("listaRiferimenti", new TipoDocumento(apFull).findRiferimenti()); + Vectumerator vecRet = new Vectumerator(); + Vectumerator vec = CR.getTipoDocumento().findDocGen(1L, 0L, 0, 0); + while (vec.hasMoreElements()) { + DocPrel doc = (DocPrel)vec.nextElement(); + vecRet.add(doc.getTipoDocumento()); + } + req.setAttribute("listaIva", new Iva(apFull).findAll()); + req.setAttribute("listaTipiDocumento", vecRet); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Documento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new DocumentoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("nf4", getNf4()); + req.setAttribute("listaOperatori", new Users(apFull).findUsersByFlgOperatore()); + long l_id_tipoDocumento = getRequestLongParameter(req, "id"); + if (l_id_tipoDocumento == 0L) + l_id_tipoDocumento = getRequestLongParameter(req, "id_tipoDocumento"); + Documento bean = new Documento(apFull); + bean.setId_tipoDocumento(l_id_tipoDocumento); + if (l_id_tipoDocumento == bean.getId_docOrdineTaglio()) { + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + bean.setId_articolo(l_id_articolo); + } + if (l_id_tipoDocumento == 1L) { + bean.findPrimoScontrinoAperto(getLoginUserId(req).longValue()); + if (bean.getDBState() == 0) { + bean.setId_tipoDocumento(l_id_tipoDocumento); + bean.setId_clifor(1L); + } else { + fillComboAfterDetail(bean, req, res); + } + req.setAttribute("listaDocGen", bean.getTipoDocumento().findDocGen(1L, 0L, 0, 0)); + } + req.setAttribute("listaLavorazione", new Lavorazione(apFull).findByTipoDocumento(bean.getId_tipoDocumento())); + bean.setFlgStato(1L); + bean.setId_tipoPagamento(1L); + bean.setId_ivaDoc(getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + bean.setPercContIntegrativo(getParm("PERC_CONT_INTEGRATIVO").getNumeroDouble()); + bean.setPercRitenutaAcconto(getParm("PERC_RITENUTA_ACCONTO").getNumeroDouble()); + req.setAttribute("bean", bean); + if (bean.getId_tipoDocumento() == 1L) { + req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull).findCodiciTender()); + req.setAttribute("listaReparti", new Reparto(apFull).findAll()); + } else { + req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull).findByCR(new TipoPagamentoCR(), 0, 0)); + } + req.setAttribute("listaVettore", new Vettore(apFull).findAll()); + req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findAll()); + req.setAttribute("listaIva", new Iva(apFull).findAll()); + req.setAttribute("listaAspetto", new Aspetto(apFull).findAll()); + req.setAttribute("listaPorto", new Porto(apFull).findAll()); + if (bean.getTipoDocumento().getCausaleMagazzino().isMagPartenzaDaScegliere()) + req.setAttribute("listaMagPartenza", new MagFisico(apFull) + .findByCausalePartenza(bean.getTipoDocumento().getCausaleMagazzino())); + if (bean.getTipoDocumento().getCausaleMagazzino().isMagArrivoDaScegliere()) + req.setAttribute("listaMagArrivo", new MagFisico(apFull).findByCausaleArrivo(bean.getTipoDocumento().getCausaleMagazzino())); + if (bean.getTipoDocumento().getCausaleMagazzino2().isMagPartenzaDaScegliere()) + req.setAttribute("listaMagPartenza2", new MagFisico(apFull) + .findByCausalePartenza(bean.getTipoDocumento().getCausaleMagazzino2())); + if (bean.getTipoDocumento().getCausaleMagazzino2().isMagArrivoDaScegliere()) + req.setAttribute("listaMagArrivo2", new MagFisico(apFull) + .findByCausaleArrivo(bean.getTipoDocumento().getCausaleMagazzino2())); + req.setAttribute("listaBanche", new Banca(apFull).findAll()); + RigaDocumento bean2 = new RigaDocumento(apFull); + bean2.setId_iva(getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + req.setAttribute("bean2", bean2); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + System.out.println(getCmd(req)); + search(req, res); + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Documento bean = (Documento)beanA; + bean.setFlgAutoAdd(getRequestLongParameter(req, "flgAutoAdd")); + bean.setFlgSingleLineArt(getRequestLongParameter(req, "flgSingleLineArt")); + if (getAct(req).equals("saveDisposizioneTaglio")) + bean.setId_clifor(bean.getArticolo().getId_fornitoreAbituale()); + req.setAttribute("bean", bean); + return super.afterSave(beanA, req, res); + } + + protected void print(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Users theUser = (Users)getLoginUser(req); + Users operatore = null; + long l_id_users = getRequestLongParameter(req, "id_oper"); + if (l_id_users > 0L) { + operatore = new Users(apFull); + operatore.findByPrimaryKey(l_id_users); + } + try { + if (getAct(req).equals("doc")) { + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(apFull); + bean.findByPrimaryKey(l_id); + if (bean.getTipoDocumento().getFlgTipoStampa() == 10L) { + ResParm rp = bean.stampaScontrinoPrenotazione(false, theUser.getRegCassa()); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else { + DocumentoCR CR = new DocumentoCR(); + fillObject(req, CR); + CR.setId_documentoS(l_id); + sendPdf(res, bean.creaDocumentoPdf(CR, false), "Doc " + bean.getNumeroDocumentoPdf() + DBAdapter.getDayTimeTimestamp()); + } + } else if (getAct(req).equals("lblArt")) { + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(apFull); + DocumentoCR CR = new DocumentoCR(); + fillObject(req, CR); + CR.setId_documentoS(l_id); + if (!getParm("LABEL_ART_A4_ZEBRA").isTrue()) { + sendPdf(res, bean.creaLabelDocumentoArticoliA4Pdf(CR), "Label Art Doc A4 " + + bean.getNumeroDocumentoPdf() + DBAdapter.getDayTimeTimestamp()); + } else { + sendPdf(res, bean.creaLabelDocumentoArticoliZebraPdf(CR), "Label Art Zebra " + + bean.getNumeroDocumentoPdf() + DBAdapter.getDayTimeTimestamp()); + } + } else if (getAct(req).equals("slip")) { + Documento bean = new Documento(apFull); + DocumentoCR CR = new DocumentoCR(); + fillObject(req, CR); + sendPdf(res, bean.creaSlip(CR), "Slip Doc " + bean.getNumeroDocumentoPdf() + DBAdapter.getDayTimeTimestamp()); + } else if (getAct(req).equals("lblArtAcc")) { + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(apFull); + DocumentoCR CR = new DocumentoCR(); + fillObject(req, CR); + CR.setId_documentoS(l_id); + if (getParm("LABEL_ART_A4_ZEBRA").getNumeroInt() == 0) { + sendPdf(res, bean.creaLabelDocumentoArticoliAccA4Pdf(CR), "Label Accessori A4 Doc " + + bean.getNumeroDocumentoPdf() + DBAdapter.getDayTimeTimestamp()); + } else { + sendPdf(res, bean.creaLabelDocumentoArticoliAccZebraPdf(CR), "Label Accessori Zebra Doc " + + bean.getNumeroDocumentoPdf() + DBAdapter.getDayTimeTimestamp()); + } + } else if (getAct(req).equals("ristampaScontrino")) { + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(apFull); + bean.findByPrimaryKey(l_id); + ResParm rp = bean.stampaScontrino(true, theUser.getRegCassa()); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("ristampaListaScontrini")) { + Documento bean = new Documento(apFull); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + ResParm rp = bean.ristampaListaScontrini(CR, true, theUser.getRegCassa()); + sendMessage(req, rp.getMsg()); + req.setAttribute("CR", CR); + forceJspPageRelative("documentoCR.jsp", req); + callJsp(req, res); + } else if (getAct(req).equals("stampaScontrinoNonFiscale")) { + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(apFull); + bean.findByPrimaryKey(l_id); + if (operatore != null) { + bean.setId_users(operatore.getId_users()); + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + bean.setLogRecord(bean.getLogRecord() + "
Scontrino Salvato - Operatore " + bean.getLogRecord() + " il " + operatore.getCognomeNome() + " " + + df.format(DBAdapter.getToday())); + } + ResParm rp = bean.stampaScontrino(false, theUser.getRegCassa()); + sendHtmlMsgResponse(req, res, "Scontrino non fiscale stampato. " + rp.getMsg() + ""); + } else if (getAct(req).equals("stampaScontrinoESalva")) { + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(apFull); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + if (operatore != null) { + bean.setId_users(operatore.getId_users()); + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + StringBuffer sb = new StringBuffer(); + sb.append(bean.getLogRecord()); + if (!bean.getLogRecord().isEmpty()) + sb.append("
"); + sb.append("Scontrino Salvato - Operatore "); + sb.append(operatore.getCognomeNome()); + sb.append(" il "); + sb.append(df.format(DBAdapter.getToday())); + sb.append(" "); + sb.append(DBAdapter.getNow()); + bean.setLogRecord(sb.toString()); + } + ResParm rp = bean.save(); + if (rp.getStatus()) { + if (bean.getFlgEmettiFatturaScontrino() == 0L) { + rp = bean.stampaScontrino(true, theUser.getRegCassa()); + } else { + rp.setMsg("Documento salvato. Scontrino NON STAMPATO (emissione fattura)!"); + } + if (rp.getStatus()) { + sendMessage(req, rp.getMsg()); + newRecord(req, res); + } else { + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } else { + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } else if (getAct(req).equals("chiudiScontrinoESalva")) { + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(apFull); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + if (operatore != null) { + bean.setId_users(operatore.getId_users()); + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + StringBuffer sb = new StringBuffer(); + sb.append(bean.getLogRecord()); + if (!bean.getLogRecord().isEmpty()) + sb.append("
"); + sb.append("Scontrino Salvato - Operatore "); + sb.append(operatore.getCognomeNome()); + sb.append(" il "); + sb.append(df.format(DBAdapter.getToday())); + sb.append(" "); + sb.append(DBAdapter.getNow()); + bean.setLogRecord(sb.toString()); + } + ResParm rp = bean.save(); + if (rp.getStatus()) { + if (bean.getFlgEmettiFatturaScontrino() == 0L) { + bean.setEchoScontrino("CHIUSO"); + rp = bean.save(); + } else { + rp.setMsg("Documento salvato. Scontrino NON CHIUSO (emissione fattura)!"); + } + if (rp.getStatus()) { + sendMessage(req, rp.getMsg()); + newRecord(req, res); + } else { + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } else { + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } else if (getAct(req).equals("stampaReportFinanziario")) { + Documento bean = new Documento(apFull); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + ResParm rp = bean.stampaReportFinanziario(theUser.getRegCassa()); + sendHtmlMsgResponse(req, res, "Report finanziario stampato. " + rp.getMsg() + ""); + } else if (getAct(req).equals("stampaReportGiornaliero")) { + Documento bean = new Documento(apFull); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + ResParm rp = bean.stampaReportGiornaliero(theUser.getRegCassa()); + sendHtmlMsgResponse(req, res, "Report giornaliero stampato. " + rp.getMsg() + ""); + } else if (getAct(req).equals("apriCassa")) { + Documento bean = new Documento(apFull); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + bean.apriCassa(theUser.getRegCassa()); + sendHtmlMsgResponse(req, res, "Cassa Aperta"); + } else if (getAct(req).equals("report")) { + int l_flgTipo = (int)getRequestLongParameter(req, "flgTipoReport"); + Documento bean = new Documento(apFull); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + sendPdf(res, bean.creaReportPdf(l_flgTipo, CR), "ReportDoc " + DBAdapter.getDayTimeTimestamp()); + } else { + search(req, res); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected String getBeanPageName(HttpServletRequest req) { + String temp; + ApplParmFull apFull = getApFull(req); + TipoDocumento tipoDocumento = new TipoDocumento(apFull); + TipologiaDocumento tipologiaDocumento = new TipologiaDocumento(apFull); + if (getCmd(req).equals("ni")) { + long l_id_tipoDocumento = getRequestLongParameter(req, "id"); + tipoDocumento.findByPrimaryKey(l_id_tipoDocumento); + } else if (!getCmd(req).equals("search")) { + long l_id_documento = getRequestLongParameter(req, "id_documento"); + if (l_id_documento > 0L) { + Documento bean = new Documento(apFull); + bean.findByPrimaryKey(l_id_documento); + tipoDocumento = bean.getTipoDocumento(); + } else { + long l_id_tipoDocumento = getRequestLongParameter(req, "id_tipoDocumento"); + tipoDocumento.findByPrimaryKey(l_id_tipoDocumento); + } + } else if (getCmd(req).equals("search")) { + long l_flgTipologia = getRequestLongParameter(req, "flgTipologia"); + tipologiaDocumento.findByCodice(l_flgTipologia); + } + if (getCmd(req).equals("asq") || (!getCmd(req).equals("search") && !getAct(req).equals("del"))) { + if (tipoDocumento.getId_tipoDocumento() > 0L) { + if (!tipoDocumento.getSuffissoPD().isEmpty()) { + temp = super.getBeanPageName(req) + super.getBeanPageName(req); + } else if (!tipoDocumento.getTipologiaDocumento().getSuffissoPD().isEmpty()) { + temp = super.getBeanPageName(req) + super.getBeanPageName(req); + } else { + temp = super.getBeanPageName(req); + } + if (getLoginUser(req).getId_userProfile() == 10L) + temp = temp + "Cli"; + return temp; + } + return super.getBeanPageName(req); + } + if (!tipoDocumento.getSuffissoCR().isEmpty()) { + temp = super.getBeanPageName(req) + super.getBeanPageName(req); + } else if (!tipologiaDocumento.getSuffissoCR().isEmpty()) { + temp = super.getBeanPageName(req) + super.getBeanPageName(req); + } else { + temp = super.getBeanPageName(req); + } + if (getLoginUser(req).getId_userProfile() == 10L) + temp = temp + "Cli"; + return temp; + } + + protected void showBean(HttpServletRequest req, HttpServletResponse res) { + super.showBean(req, res); + } + + protected void mail(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + Documento bean = new Documento(apFull); + long l_id = getRequestLongParameter(req, "id_documento"); + String eMail = getRequestParameter(req, "eMailInvio"); + String testoAgg = getRequestParameter(req, "testoAgg"); + if (getAct(req).equals("web")) { + bean.findByPrimaryKey(l_id); + eMail = bean.getClifor().getEMail(); + String lang = "it"; + if (!bean.getClifor().getNazione().getCodice().equals("IT")) + lang = "en"; + ResParm rp = new ResParm(); + long tipoInvio = getParm("WEB_SEND_ORDER_MAIL_CODE").getNumeroLong(); + if (tipoInvio == 0L) { + rp = bean.sendOrderMailMessageRavinale(lang, false, true, false); + } else if (tipoInvio == 1L) { + rp = bean.sendOrderMailMessageRavinale(lang, false, true, false); + } else if (tipoInvio == 2L) { + Users utente = bean.getClifor().getUserWww(); + rp = bean.sendOrderMailMessageTuttofoto(utente, true, true, false, false); + } else if (tipoInvio == 99L) { + Attivita attivita = Attivita.getDefaultInstance(apFull); + Users user = new Users(apFull); + user.findFirstByClifor(bean.getId_clifor()); + boolean spedito = (bean.getFlgStatoOrdineWww() == 2L); + rp = attivita.sendOrderMailMessageCC(bean, user, lang, true, true, false, spedito, req); + } + sendMessage(req, rp.getMsg()); + if (l_id > 0L) { + showBean(req, res); + } else { + search(req, res); + } + } else if (getAct(req).equals("clifor") || getAct(req).equals("ext")) { + bean.findByPrimaryKey(l_id); + if (getAct(req).equals("clifor")) + eMail = bean.getClifor().getEMail(); + if (!testoAgg.isEmpty()) + bean.setTestoAgg(testoAgg); + if (eMail.isEmpty()) { + sendMessage(req, "Errore! indirizzo email non valido!"); + if (l_id != 0L) { + showBean(req, res); + } else { + search(req, res); + } + } else { + CR.setId_documentoS(l_id); + String path = req.getScheme() + "://" + req.getScheme() + ":" + req.getServerName() + req.getServerPort() + "/GetFile.abl?id="; + ResParm rp = bean.sendDocumentiMailMessage(CR, eMail, path); + if (rp.getStatus()) { + sendMessage(req, "Mail inviata con successo"); + } else { + sendMessage(req, rp.getErrMsg()); + } + if (l_id > 0L) { + showBean(req, res); + } else { + search(req, res); + } + } + } else if (getAct(req).equals("cli")) { + String path = req.getScheme() + "://" + req.getScheme() + ":" + req.getServerName() + req.getServerPort() + "/GetFile.abl?id="; + bean.sendDocumentiMailMessage(CR, eMail, path); + search(req, res); + } else { + CR.setId_documentoS(l_id); + String path = req.getScheme() + "://" + req.getScheme() + ":" + req.getServerName() + req.getServerPort() + "/GetFile.abl?id="; + ResParm rp = bean.sendDocumentiMailMessage(CR, eMail, path); + if (rp.getStatus()) { + sendMessage(req, "Mail inviata con successo"); + } else { + sendMessage(req, rp.getErrMsg()); + } + if (l_id > 0L) { + showBean(req, res); + } else { + search(req, res); + } + } + } + + protected void mailOLD(HttpServletRequest req, HttpServletResponse res) { + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + String eMail = getRequestParameter(req, "eMailInvio"); + String testoAgg = getRequestParameter(req, "testoAgg"); + bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + if (getAct(req).equals("web")) { + eMail = bean.getClifor().getEMail(); + ResParm rp = bean.sendOrderMailMessage(getLang(req), false, true, false); + sendMessage(req, rp.getMsg()); + if (l_id > 0L) { + showBean(req, res); + } else { + search(req, res); + } + } else { + if (!testoAgg.isEmpty()) + bean.setTestoAgg(testoAgg); + if (getAct(req).equals("clifor")) + eMail = bean.getClifor().getEMail(); + if (eMail.isEmpty()) { + sendMessage(req, "Errore! indirizzo email non valido!"); + if (l_id != 0L) { + showBean(req, res); + } else { + search(req, res); + } + } else { + DocumentoCR CR = new DocumentoCR(getApFull(req)); + fillObject(req, CR); + CR.setId_documentoS(l_id); + String path = req.getScheme() + "://" + req.getScheme() + ":" + req.getServerName() + req.getServerPort() + "/GetFile.abl?id="; + ResParm rp = bean.sendDocumentiMailMessage(CR, eMail, path); + if (rp.getStatus()) { + sendMessage(req, "Mail inviata con successo"); + } else { + sendMessage(req, rp.getErrMsg()); + } + if (l_id > 0L) { + showBean(req, res); + } else { + search(req, res); + } + } + } + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + long l_id_tipoDocumento = getRequestLongParameter(req, "id"); + if (getId_docPrenotazione() > 0L && (l_id_tipoDocumento == getId_docPrenotazione() || l_id_tipoDocumento == getId_docRiparazione())) + req.setAttribute("id_tipoDocumento", String.valueOf(l_id_tipoDocumento)); + it.acxent.common.Users users = getLoginUser(req); + req.setAttribute("flgSuper", Long.valueOf(users.getFlgSuper())); + return super.beforeSearch(req, res); + } + + public void _associaOrdineTaglioS(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_documento = getRequestLongParameter(req, "id_documento"); + forceJspPageRelative("documentiOrdineTaglioLista.jsp", req); + Documento bean = new Documento(apFull); + bean.findByPrimaryKey(l_id_documento); + if (bean.getId_documento() > 0L) { + DocumentoCR CR = new DocumentoCR(apFull); + CR.setFlgTipologia(210L); + req.setAttribute("listaOrdiniTaglio", bean.findOrdiniTaglioAperti()); + } + showBean(req, res); + } + + public void _creaFattureDaDDtTessitura(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = new Documento(apFull); + long l_id_cliforR = getRequestLongParameter(req, "id_cliforR"); + long l_id = getRequestLongParameter(req, "id_documentoR"); + long l_flgTipoGenerazione = getRequestLongParameter(req, "flgTipoGenerazione"); + Users operatore = null; + long l_id_users = getRequestLongParameter(req, "id_oper"); + if (l_id_users > 0L) { + operatore = new Users(apFull); + operatore.findByPrimaryKey(l_id_users); + } else { + operatore = bean.getUsers(); + } + ResParm rp = new ResParm(true); + long l_id_tipoDocumentoFiglio = getRequestLongParameter(req, "id_tipoDocumentoF"); + TipoDocumento tdDaGenerare = new TipoDocumento(apFull); + tdDaGenerare.findByPrimaryKey(l_id_tipoDocumentoFiglio); + if (tdDaGenerare.hasPadreConTipologia(200L)) { + if (l_id_cliforR == 0L || l_id == 0L) { + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + if (CR.getId_tipoDocumento() == 0L) { + rp.setMsg("Errore! Tipo del documento non trovata!"); + rp.setStatus(false); + } else { + Vectumerator vecClifor = bean.findCliforByCR(CR); + while (vecClifor.hasMoreElements()) { + Clifor rowClifor = (Clifor)vecClifor.nextElement(); + HashMap hmDdt = new HashMap<>(); + HashMap hmDispTess = new HashMap<>(); + CR.setId_clifor(rowClifor.getId_clifor()); + Vectumerator vec = bean.findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + hmDdt.put(new Long(row.getId_documento()), row); + LavPezza lp = new LavPezza(apFull); + Vectumerator vecLP = lp.findByDocumentoBolla(row.getId_documento()); + while (vecLP.hasMoreElements()) { + LavPezza rowLP = (LavPezza)vecLP.nextElement(); + Long lpKey = new Long(rowLP.getRigaDocumento().getId_documento()); + if (!hmDispTess.containsKey(lpKey)) + hmDispTess.put(lpKey, rowLP.getRigaDocumento().getDocumento()); + } + for (Map.Entry entry : hmDispTess.entrySet()) { + System.out.println("Key = " + String.valueOf(entry.getKey()) + ", Value = " + entry.getValue().getNumeroDocumentoCompleto()); + rp = entry.getValue().creaDocumentoFiglioDaDisposizioniTessitura(rowClifor.getId_clifor(), l_id_tipoDocumentoFiglio, operatore, true, l_flgTipoGenerazione, hmDdt); + } + } + } + } + } else { + bean.findByPrimaryKey(l_id); + HashMap hmDdt = new HashMap<>(); + HashMap hmDispTess = new HashMap<>(); + hmDdt.put(new Long(l_id), bean); + LavPezza lp = new LavPezza(apFull); + Vectumerator vecLP = lp.findByDocumentoBolla(l_id); + while (vecLP.hasMoreElements()) { + LavPezza rowLP = (LavPezza)vecLP.nextElement(); + Long lpKey = new Long(rowLP.getRigaDocumento().getId_documento()); + if (!hmDispTess.containsKey(lpKey)) + hmDispTess.put(lpKey, rowLP.getRigaDocumento().getDocumento()); + } + for (Map.Entry entry : hmDispTess.entrySet()) { + System.out.println("Key = " + String.valueOf(entry.getKey()) + ", Value = " + entry.getValue().getNumeroDocumentoCompleto()); + rp = entry.getValue().creaDocumentoFiglioDaDisposizioniTessitura(bean.getId_clifor(), l_id_tipoDocumentoFiglio, operatore, true, l_flgTipoGenerazione, hmDdt); + } + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! Documento generabile non ha come padre una disposizione tessitura!"); + } + if (rp.getStatus()) { + afterCreaDocFigli(req, res, bean, l_id_tipoDocumentoFiglio); + } else { + sendMessage(req, rp.getErrMsg()); + } + String theForm = getRequestParameter(req, "theForm"); + String pageType = getRequestParameter(req, "pageType"); + if (theForm.equals("ricerca") || pageType.equals("R")) { + search(req, res); + } else { + req.setAttribute("id_documento", Long.valueOf(l_id)); + showBean(req, res); + } + } + + protected void callJsp(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("nf4", getNf4()); + super.callJsp(req, res); + } + + protected ResParm creaFileAllegato(DocumentoInterface beanA, HttpServletRequest req, HttpServletResponse res) { + synchronized (this) { + ResParm rp = new ResParm(true, ""); + Documento bean = (Documento)beanA; + String targetDir = bean.getPathAllegato(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + "/" + targetDir + "_"; + Vectumerator completeFileNames = (Vectumerator)req.getAttribute("completeAttachName"); + Vectumerator fileNames = (Vectumerator)req.getAttribute("attachName"); + if (completeFileNames.hasMoreElements()) { + String sourceFile = (String)completeFileNames.nextElement(); + String fileName = (String)fileNames.elementAt(0); + targetFile = targetFile + targetFile; + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + } + return rp; + } + } + + protected boolean isLoadImageServlet() { + return true; + } + + public void _listaPrenotazioni(HttpServletRequest req, HttpServletResponse res) { + forceJspPageRelative("documentoListaPrenotazioni.jsp", req); + DocumentoCR CRDoc = new DocumentoCR(getApFull(req)); + fillObject(req, CRDoc); + CRDoc.setFlgTipologia(4L); + CRDoc.setFlgStatoPrenotazione(200L); + CRDoc.setFlgDocumentoPrelevato(0L); + req.setAttribute("listaPrenota", new Documento(getApFull(req)).findByCR(CRDoc, CRDoc.getPageNumber(), 10)); + req.setAttribute("CR", CRDoc); + showBean(req, res); + } + + public void _loadPrenotazioniMagazzino(HttpServletRequest req, HttpServletResponse res) { + long id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + RigaDocumento rd = new RigaDocumento(getApFull(req)); + rd.findByPrimaryKey(id_rigaDocumento); + sendHtmlMsgResponse(req, res, rd.getQuantitaMagazzinoMovimentoHtml()); + } + + public void _listaOrdiniPrenotazione(HttpServletRequest req, HttpServletResponse res) { + forceJspPageRelative("documentoListaFigli.jsp", req); + long l_id = getRequestLongParameter(req, "id_rigaDocumento"); + req.setAttribute("listaFigli", new Documento(getApFull(req)).findDocumentiOrdiniByRigaPrenotazione(l_id)); + showBean(req, res); + } + + public void _riordinaCR(HttpServletRequest req, HttpServletResponse res) { + Articolo bean = new Articolo(getApFull(req)); + long l_id_fornitore = getRequestLongParameter(req, "id_cliforR"); + long l_id = getRequestLongParameter(req, "id_articoloR"); + long l_id_rigaPrenotazione = getRequestLongParameter(req, "id_rigaDocumentoR"); + long l_id_av = getRequestLongParameter(req, "id_articoloVarianteR"); + double l_qta = getRequestDoubleParameter(req, "qtaR"); + ResParm rp = new ResParm(true); + if (l_id_fornitore == 0L || l_id == 0L) { + rp.setMsg("Errore! Codice fornitore o articolo non valido"); + rp.setStatus(false); + } else { + RigaDocumento rd = new RigaDocumento(getApFull(req)); + rd.findByPrimaryKey(l_id_rigaPrenotazione); + double qtaDaRiordinare = bean.getQtaDaRiordinare(l_id_rigaPrenotazione); + if (l_id_rigaPrenotazione > 0L && qtaDaRiordinare < l_qta) { + rp.setMsg("Errore! Da questa prenotazione puoi ordinare al massimo " + qtaDaRiordinare + " articolo."); + rp.setStatus(false); + } else { + bean.findByPrimaryKey(l_id); + rp = Articolo.creaOrdine(bean, l_id_av, l_id_fornitore, l_qta); + if (rp.getStatus() && l_id_rigaPrenotazione > 0L) { + Documento beanR = (Documento)rp.getReturnObj(); + beanR.addRigaPrenotazionePrelevataDaOrdine(rd, l_qta); + } + } + } + if (rp.getStatus()) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + AbMessages.getMessage(getLocale(req), "SAVE_OK")); + } else { + sendMessage(req, rp.getErrMsg()); + } + showBean(req, res); + } + + public void _riordinaAVCR(HttpServletRequest req, HttpServletResponse res) { + long l_id_fornitore = getRequestLongParameter(req, "id_cliforR"); + long l_id_rigaPrenotazione = getRequestLongParameter(req, "id_rigaDocumentoR"); + String l_id_articoloVarianteRV = getRequestParameter(req, "id_articoloVarianteRV"); + String l_qtaArticoloVarianteRV = getRequestParameter(req, "qtaArticoloVarianteRV"); + ResParm rp = new ResParm(true); + if (l_id_fornitore == 0L || l_id_articoloVarianteRV.isEmpty()) { + rp.setMsg("Errore! Codice fornitore o articoli variante non validi"); + rp.setStatus(false); + } else { + StringTokenizer st = new StringTokenizer(l_id_articoloVarianteRV, ";"); + StringTokenizer stQta = new StringTokenizer(l_qtaArticoloVarianteRV, ";"); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + long l_id_articoloVariante = Long.valueOf(token); + ArticoloVariante bean = new ArticoloVariante(getApFull(req)); + bean.findByPrimaryKey(l_id_articoloVariante); + double l_qta = Double.valueOf(stQta.nextToken().replace(',', '.')); + if (l_qta > 0.0D) { + rp = Articolo.creaOrdine(bean.getArticolo(), l_id_articoloVariante, l_id_fornitore, l_qta); + if (rp.getStatus() && l_id_rigaPrenotazione > 0L) { + Documento beanR = (Documento)rp.getReturnObj(); + RigaDocumento rd = new RigaDocumento(getApFull(req)); + rd.findByPrimaryKey(l_id_rigaPrenotazione); + beanR.addRigaPrenotazionePrelevataDaOrdine(rd, l_qta); + } + } + } + } + if (rp.getStatus()) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + AbMessages.getMessage(getLocale(req), "SAVE_OK")); + } else { + sendMessage(req, rp.getErrMsg()); + } + showBean(req, res); + } + + public void _riordinaPrenotazione(HttpServletRequest req, HttpServletResponse res) { + ResParm rp = new ResParm(true); + Documento bean = new Documento(getApFull(req)); + fillObject(req, bean); + RigaDocumento rd = new RigaDocumento(getApFull(req)); + Vectumerator vec = rd.findByDocumento(0L, bean.getId_documento(), "", 0, 0, 0); + while (vec.hasMoreElements()) { + rd = (RigaDocumento)vec.nextElement(); + if (RigaDocumentoPM.isRigaPrenotazionePrelevata(rd)) { + ResParm rpe = new ResParm(false); + rpe.setMsg("L'articolo " + rd.getArticolo().getNome() + " ha gia' un ordine!"); + rp.append(rpe); + continue; + } + if (rd.getId_articoloVariante() != 0L) { + if (rd.getArticoloVariante().getId_fornitoreAbituale() != 0L) { + if (rd.getArticoloVariante().getQuantitaEffettivaAv() < 0.0D) { + rp.append(Articolo.creaOrdine(rd.getArticolo(), rd.getId_articoloVariante(), + rd.getArticoloVariante().getId_fornitoreAbituale(), rd.getQuantita())); + if (rp.getStatus()) { + Documento beanR = (Documento)rp.getReturnObj(); + beanR.addRigaPrenotazionePrelevataDaOrdine(rd, rd.getQuantita()); + } + } + continue; + } + ResParm rpe = new ResParm(false); + rpe.setMsg("L'articolo " + rd.getArticolo().getNome() + " non ha il fornitore abituale!"); + rp.append(rpe); + continue; + } + if (rd.getArticolo().getQuantitaEffettiva() < 0.0D) { + if (rd.getArticolo().getId_fornitoreAbituale() != 0L) { + rp.append( + Articolo.creaOrdine(rd.getArticolo(), 0L, rd.getArticolo().getId_fornitoreAbituale(), rd.getQuantita())); + if (rp.getStatus()) { + Documento beanR = (Documento)rp.getReturnObj(); + beanR.addRigaPrenotazionePrelevataDaOrdine(rd, rd.getQuantita()); + } + continue; + } + ResParm rpe = new ResParm(false); + rpe.setMsg("L'articolo " + rd.getArticolo().getNome() + " non ha il fornitore abituale!"); + rp.append(rpe); + } + } + if (rp.getStatus()) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + AbMessages.getMessage(getLocale(req), "SAVE_OK")); + } else { + sendMessage(req, rp.getErrMsg()); + } + showBean(req, res); + } + + public void _listaFigli(HttpServletRequest req, HttpServletResponse res) { + forceJspPageRelative("documentoListaFigli.jsp", req); + long l_id = getRequestLongParameter(req, "id_rigaDocumento"); + req.setAttribute("listaFigli", new Documento(getApFull(req)).findDocumentiFiglioRiga(l_id)); + showBean(req, res); + } + + public void _listaFigliOrdine(HttpServletRequest req, HttpServletResponse res) { + caricaListaFigliPadriOrdine(req, res, 0L); + } + + protected void afterCreaDocFigli(HttpServletRequest req, HttpServletResponse res, Documento bean, long l_id_tipoDocumentoFiglio) { + TipoDocumento td = new TipoDocumento(getApFull(req)); + td.findByPrimaryKey(l_id_tipoDocumentoFiglio); + if (td.getId_tipologiaDocumento() == 5L) { + if (td.getFlgClienteFornitore().equals("F")) { + bean.setFlgStatoRiparazione(1L); + } else { + bean.setFlgStatoRiparazione(99L); + bean.setDataChiusura(DBAdapter.getToday()); + } + bean.save(); + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK")); + } + } + + public void _generaDocumento(HttpServletRequest req, HttpServletResponse res) { + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + long l_flgTipoCreazione = getRequestLongParameter(req, "flgTipoCreazione"); + bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + bean.save(); + ResParm rp = new ResParm(); + long l_id_cliforFiglio = getRequestLongParameter(req, "id_clifor2"); + long l_id_tipoDocumentoFiglio = getRequestLongParameter(req, "flgEmettiFatturaScontrino"); + rp = bean.creaDocumentoFiglio(l_id_cliforFiglio, l_id_tipoDocumentoFiglio, (Users)getLoginUser(req), false, l_flgTipoCreazione); + if (rp.getStatus()) { + sendMessage(req, "Documento generata correttamente"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + public void _generaDocumentoDaScontrino(HttpServletRequest req, HttpServletResponse res) { + Users operatore = null; + long l_id_users = getRequestLongParameter(req, "id_oper"); + long l_flgTipoCreazione = getRequestLongParameter(req, "flgTipoCreazione"); + if (l_id_users > 0L) { + operatore = new Users(getApFull(req)); + operatore.findByPrimaryKey(l_id_users); + } + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + bean.save(); + ResParm rp = new ResParm(); + long l_id_cliforFiglio = getRequestLongParameter(req, "id_cliforListino"); + long l_id_tipoDocumentoFiglio = getRequestLongParameter(req, "flgEmettiFatturaScontrino"); + rp = bean.creaDocumentoFiglio(l_id_cliforFiglio, l_id_tipoDocumentoFiglio, operatore, false, l_flgTipoCreazione); + if (rp.getStatus()) { + sendMessage(req, "Documento generata correttamente"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + public void _procediPagamento(HttpServletRequest req, HttpServletResponse res) { + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + ResParm rp = new ResParm(); + if (bean.getDBState() == 0) { + rp.setStatus(false); + rp.setMsg("Errore! Codice documento non valido"); + } else { + bean.setFlgProcediPagamento(1L); + rp = bean.superSave(); + } + if (rp.getStatus()) { + sendMessage(req, "Documento " + bean.getNumeroDocumentoCompleto() + ": Procedi pagamento OK."); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } + + public void _aggionraSPCR(HttpServletRequest req, HttpServletResponse res) { + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + long l_flgStatoPrenotazione = getRequestLongParameter(req, "flgStatoPrenotazioneS"); + ResParm rp = new ResParm(); + if (bean.getDBState() == 0) { + rp.setStatus(false); + rp.setMsg("Errore! Codice documento non valido"); + } else { + rp = bean.aggiornaStatoPrenotazione(bean.getFlgStatoPrenotazione(), l_flgStatoPrenotazione); + } + if (rp.getStatus()) { + sendMessage(req, "Stato Prenotazione aggiornato."); + } else { + sendMessage(req, rp.getMsg()); + } + req.setAttribute("cmd", "search"); + search(req, res); + } + + public void _inviaAvviso(HttpServletRequest req, HttpServletResponse res) { + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + ResParm rp = new ResParm(); + if (bean.getDBState() == 0) { + rp.setStatus(false); + rp.setMsg("Errore! Codice documento non valido"); + } else { + rp = bean.sendAvvisoRiparazione(); + } + if (rp.getStatus()) { + sendMessage(req, "Avviso inviato correttamente."); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } + + public void _inviaSpedizioneAvvenuta(HttpServletRequest req, HttpServletResponse res) { + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + ResParm rp = new ResParm(); + if (bean.getDBState() == 0) { + rp.setStatus(false); + rp.setMsg("Errore! Codice documento non valido"); + } else { + rp = bean.sendSpeditoMailMessage(getLang(req)); + } + if (rp.getStatus()) { + sendMessage(req, "Avviso inviato correttamente."); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } + + public void _creaCodaSms(HttpServletRequest req, HttpServletResponse res) { + RigaDocumentoCR CR = new RigaDocumentoCR(); + fillObject(req, CR); + CR.setId_tipoDocumento(getId_docCassa()); + CR.setFlgTipoRicerca(0L); + RigaDocumento bean = new RigaDocumento(getApFull(req)); + Vectumerator vec = bean.findByCR(CR, 0, 0); + String l_msg = getRequestParameter(req, "testoMessaggio").trim(); + ResParm rp = new ResParm(true); + if (l_msg.isEmpty()) { + rp.setStatus(false); + rp.setMsg("ERRORE! Testo del messaggio vuoto!!"); + } else { + int i = 0; + int j = 0; + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + rp = row.creaCodaMessaggio(l_msg); + if (rp.getStatus()) { + i++; + continue; + } + j++; + } + sendMessage(req, "Creazione coda messaggi eseguita correttamente. Messaggi creati: " + i + " messaggi NON creati: " + j); + search(req, res); + } + } + + public void _applicaListino(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + if (l_id > 0L) { + bean = new Documento(apFull); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + if (bean.getId_cliforListino() > 0L) { + if (bean.getCliforListino().getId_tipoPagamento() == 0L) { + bean.setId_tipoPagamento(1L); + } else if (bean.getCliforListino().getTipoPagamento().getCodiceTenderCassa().isEmpty()) { + bean.setId_tipoPagamento(bean.getTipoPagamentoScontrinoConFattura().getId_tipoPagamento()); + } else { + bean.setId_tipoPagamento(bean.getCliforListino().getId_tipoPagamento()); + } + bean.save(); + bean.applicaListinoByClifor(bean.getCliforListino()); + } else { + if (bean.getId_clifor() > 0L) + if (bean.getClifor().getId_tipoPagamento() == 0L) { + bean.setId_tipoPagamento(1L); + } else if (bean.getClifor().getTipoPagamento().getCodiceTenderCassa().isEmpty()) { + bean.setId_tipoPagamento(bean.getTipoPagamentoScontrinoConFattura().getId_tipoPagamento()); + } else { + bean.setId_tipoPagamento(bean.getClifor().getId_tipoPagamento()); + } + bean.save(); + bean.applicaListinoByClifor(bean.getClifor()); + } + sendMessage(req, "Prezzi sul documenti aggiornati secondo il listino di " + bean.getCliforListino().getDescrizioneCompleta()); + } else { + bean = new Documento(apFull); + fillObject(req, bean); + if (bean.getId_cliforListino() > 0L) { + if (bean.getCliforListino().getId_tipoPagamento() == 0L) { + bean.setId_tipoPagamento(1L); + } else if (bean.getCliforListino().getTipoPagamento().getCodiceTenderCassa().isEmpty()) { + bean.setId_tipoPagamento(bean.getTipoPagamentoScontrinoConFattura().getId_tipoPagamento()); + } else { + bean.setId_tipoPagamento(bean.getCliforListino().getId_tipoPagamento()); + } + } else { + bean.setId_tipoPagamento(1L); + } + req.setAttribute("bean", bean); + } + showBean(req, res); + } + + public void _applicaListinoDoc(HttpServletRequest req, HttpServletResponse res) { + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + if (l_id > 0L) { + bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + bean.save(); + bean.applicaListinoByClifor(bean.getCliforListino()); + sendMessage(req, "Pressi sul documenti aggiornati secondo il listino di " + bean.getCliforListino().getDescrizioneCompleta()); + } else { + sendMessage(req, "Attenzione! Cliente per listino non trovato"); + } + showBean(req, res); + } + + public void _annAssPren(HttpServletRequest req, HttpServletResponse res) { + RigaDocumento row = new RigaDocumento(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_rigaDocumento"); + row.findByPrimaryKey(l_id); + row.setFlgPrenotazioneArrivata(0L); + ResParm rp = row.save(); + rp.append(row.getDocumento().aggiornaStatoPrenotazione(row.getDocumento().getFlgStatoPrenotazione(), 0L)); + if (rp.getStatus()) { + sendMessage(req, "Prenotazione riga aggiornata con successo!"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + public void _annullaSlip(HttpServletRequest req, HttpServletResponse res) { + RigaDocumento row = new RigaDocumento(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_rigaDocumento"); + row.findByPrimaryKey(l_id); + row.setQtaSlipStampate(0L); + ResParm rp = row.save(); + rp.append(row.getDocumento().aggiornaStatoPrenotazione(row.getDocumento().getFlgStatoPrenotazione(), 0L)); + if (rp.getStatus()) { + sendMessage(req, "Stampa slip azzerata. Prenotazione riga aggiornata con successo!"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + private void caricaListaFigliPadriOrdine(HttpServletRequest req, HttpServletResponse res, long tipoDoc) { + ApplParmFull apFull = getApFull(req); + forceJspPageRelative("documentoListaOrdine.jsp", req); + long l_id = getRequestLongParameter(req, "id_rigaDocumento"); + if (tipoDoc == 0L) { + req.setAttribute("listaFigliOrdine", new Documento(apFull).findDocumentiPrelievoOrdine(l_id)); + } else if (tipoDoc == 1L) { + req.setAttribute("listaFigliOrdine", new Documento(apFull).findDocumentiPrelievoOrdineP(l_id)); + } + showBean(req, res); + } + + public void _listaPadriOrdine(HttpServletRequest req, HttpServletResponse res) { + caricaListaFigliPadriOrdine(req, res, 1L); + } + + public void _sbloccaDocumento(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + StringBuilder sb = new StringBuilder(); + long id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(apFull); + bean.findByPrimaryKey(id_documento); + sb.append(bean.getNotaSblocco()); + sb.append("\nSbloccato da: " + apFull.getLastUpdUser().getLogin()); + bean.setFlgEmsta(1L); + bean.setNotaSblocco(sb.toString()); + bean.superSave(); + showBean(req, res); + } + + public void _calcolaTessutiTaglio(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (Documento)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + if (bean.getId_documento() > 0L) { + fillObject(req, bean); + rp = bean.save(); + if (rp.getStatus()) + rp = Documento.calcolaTessutiTaglio(bean, getLang(req)); + if (rp.getStatus() == true) { + sendMessage(req, "Calcolo tessuti effettuato"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + protected void mailOLD2(HttpServletRequest req, HttpServletResponse res) { + DocumentoCR CR = new DocumentoCR(getApFull(req)); + fillObject(req, CR); + Documento bean = new Documento(getApFull(req)); + long l_id = getRequestLongParameter(req, "id_documento"); + bean.findByPrimaryKey(l_id); + String eMail = getRequestParameter(req, "eMailInvio"); + String testoAgg = getRequestParameter(req, "testoAgg"); + if (getAct(req).equals("web")) { + eMail = bean.getClifor().getEMail(); + ResParm rp = bean.sendOrderMailMessage(getLang(req), false, true, false); + sendMessage(req, rp.getMsg()); + if (l_id > 0L) { + showBean(req, res); + } else { + search(req, res); + } + } else if (getAct(req).equals("clifor") || getAct(req).equals("ext")) { + bean.findByPrimaryKey(l_id); + if (getAct(req).equals("clifor")) + eMail = bean.getClifor().getEMail(); + if (!testoAgg.isEmpty()) + bean.setTestoAgg(testoAgg); + if (eMail.isEmpty()) { + sendMessage(req, "Errore! indirizzo email non valido!"); + if (l_id != 0L) { + showBean(req, res); + } else { + search(req, res); + } + } else { + CR.setId_documentoS(l_id); + String path = req.getScheme() + "://" + req.getScheme() + ":" + req.getServerName() + req.getServerPort() + "/GetFile.abl?id="; + ResParm rp = bean.sendDocumentiMailMessage(CR, eMail, path); + if (rp.getStatus()) { + sendMessage(req, "Mail inviata con successo"); + } else { + sendMessage(req, rp.getErrMsg()); + } + if (l_id > 0L) { + showBean(req, res); + } else { + search(req, res); + } + } + } else if (getAct(req).equals("cli")) { + String path = req.getScheme() + "://" + req.getScheme() + ":" + req.getServerName() + req.getServerPort() + "/GetFile.abl?id="; + search(req, res); + } + } + + protected void mailxx(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + Documento bean = new Documento(apFull); + long l_id = getRequestLongParameter(req, "id_documento"); + bean.findByPrimaryKey(l_id); + String eMail = getRequestParameter(req, "eMailInvio"); + String testoAgg = getRequestParameter(req, "testoAgg"); + if (getAct(req).equals("web")) { + eMail = bean.getClifor().getEMail(); + ResParm rp = bean.sendOrderMailMessage(getLang(req), false, true, false); + sendMessage(req, rp.getMsg()); + if (l_id > 0L) { + showBean(req, res); + } else { + search(req, res); + } + } else if (getAct(req).equals("clifor") || getAct(req).equals("ext")) { + bean.findByPrimaryKey(l_id); + if (getAct(req).equals("clifor")) + eMail = bean.getClifor().getEMail(); + if (!testoAgg.isEmpty()) + bean.setTestoAgg(testoAgg); + if (eMail.isEmpty()) { + sendMessage(req, "Errore! indirizzo email non valido!"); + if (l_id != 0L) { + showBean(req, res); + } else { + search(req, res); + } + } + } else if (getAct(req).equals("cli")) { + String path = req.getScheme() + "://" + req.getScheme() + ":" + req.getServerName() + req.getServerPort() + "/GetFile.abl?id="; + search(req, res); + } else { + CR.setId_documentoS(l_id); + String path = req.getScheme() + "://" + req.getScheme() + ":" + req.getServerName() + req.getServerPort() + "/GetFile.abl?id="; + ResParm rp = bean.sendDocumentiMailMessage(CR, eMail, path); + if (rp.getStatus()) { + sendMessage(req, "Mail inviata con successo"); + } else { + sendMessage(req, rp.getErrMsg()); + } + if (l_id > 0L) { + showBean(req, res); + } else { + search(req, res); + } + } + } + + public void _creaReportCsvNoSession(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + CR.setId_users(getUser(req).getId_users()); + Documento bean = new Documento(apFull); + bean.creaFileCvsRigheDocumento(CR); + sendHtmlMsgResponse(req, res, "File report in formato cvs (Excel)"); + } + + public void _impostaOrdineWww(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = new Documento(apFull); + long l_id_documento = getRequestLongParameter(req, "id"); + bean.findByPrimaryKey(l_id_documento); + if (bean.getId_documento() > 0L) { + long l_progOrdineWww = getRequestLongParameter(req, "progOrdineWww"); + bean.setProgOrdineWww(l_progOrdineWww); + ResParm rp = bean.superSave(); + if (rp.getStatus()) + sendHtmlMsgResponse(req, res, String.valueOf(bean.getProgOrdineWww())); + } + } + + public void _generaFatture(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(true); + long id_tipoDocumentoF = getRequestLongParameter(req, "id_tipoDocumentoF"); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + CR.setUsers((Users)getUser(req)); + CR.setId_tipoDocumentoF(id_tipoDocumentoF); + Documento bean = new Documento(apFull); + rp.append(bean.creaFattureDaLista(CR)); + if (rp.getStatus()) { + req.setAttribute("listaDocumenti", rp.getMsg()); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } + + public void _aggiornaThreadMsg(HttpServletRequest req, HttpServletResponse res) { + sendHtmlMsgResponse(req, res, Documento.threadSendMailMsg); + } + + public void _creaPdfEtichettePackingList(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(apFull); + bean.findByPrimaryKey(new Long(l_id)); + if (!getParm("LABEL_PK_LIST_A4_ZEBRA").isTrue()) { + DocumentoCR CR = new DocumentoCR(); + fillObject(req, CR); + CR.setId_documentoS(l_id); + sendPdf(res, bean.creaPdfEtichettePackingListA4(CR), "LabelPackingListA4 " + DBAdapter.getDayTimeTimestamp()); + } else { + sendPdf(res, bean.creaPdfEtichettePackingListZEBRA(null), "LabelPackingList " + DBAdapter.getDayTimeTimestamp()); + } + } + + public void _annullaDocumentiWeb(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = new Documento(apFull); + ResParm rp = bean.annullaOrdiniWebVecchi(); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _bloccaDocumento(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + StringBuilder sb = new StringBuilder(); + long id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(apFull); + bean.findByPrimaryKey(id_documento); + sb.append(bean.getNotaSblocco()); + sb.append("\nBloccato da: " + apFull.getLastUpdUser().getLogin()); + bean.setFlgEmsta(0L); + bean.setNotaSblocco(sb.toString()); + bean.superSave(); + showBean(req, res); + } + + public void _addRigaTessuto(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (Documento)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + l_id = bean.getId_documento(); + req.setAttribute("id_documento", String.valueOf(l_id)); + if (rp.getStatus() == true) { + RigaDocumento row = new RigaDocumento(apFull); + if (l_id != 0L) { + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + if (l_id_rigaDocumento > 0L) + row.findByPrimaryKey(l_id_rigaDocumento); + fillObject(req, row); + row.setLastUpdTmst(getRequestTmstParameter(req, "lastUpdTmstRow1")); + row.setId_rigaDocumentoTessutoA(0L); + row.setMt(getRequestDoubleParameter(req, "mtT")); + row.setKg(getRequestDoubleParameter(req, "kgT")); + long l_id_colore = getRequestLongParameter(req, "id_colore"); + if ((l_id_colore > 0L && row.getId_articoloTessutoColore() == 0L) || (row.getId_articoloTessutoColore() > 0L && l_id_colore != + row.getArticoloTessutoColore().getId_colore())) + if ((l_id_colore == 0L && row.getId_articoloTessutoColore() == 0L) || row.getId_articoloTessuto() == 0L) { + rp.setStatus(false); + rp.setMsg("Attenzione! Tessuto o Colore non selezionato!"); + } else { + ArticoloTessutoColore av = new ArticoloTessutoColore(apFull); + if (row.getId_articoloTessutoColore() > 0L) { + av.findByPrimaryKey(row.getId_articoloTessutoColore()); + } else { + av.findByArticoloTessutoColore(row.getId_articoloTessuto(), l_id_colore); + if (av.getId_articoloTessutoColore() == 0L) { + av.setId_articoloTessuto(row.getId_articoloTessuto()); + av.setId_colore(l_id_colore); + av.save(); + } + } + if (av.getId_articoloTessutoColore() == 0L) { + rp.setStatus(false); + rp.setMsg("Attenzione! Non e' stato possibile salvare il colore per il tessuto!"); + } else { + row.setId_articoloTessutoColore(av.getId_articoloTessutoColore()); + row.setDescrizioneRiga(row.getArticoloTessutoColore().getDescrizioneCompleta(getLang(req))); + } + } + if (row.getId_articoloTessutoColore() > 0L) + row.setDescrizioneRiga(row.getArticoloTessutoColore().getDescrizioneCompleta(getLang(req))); + if (rp.getStatus()) + rp = Documento.addRigaDocumentoTessuto(bean, row, 0L); + if (!rp.getStatus()) + forceMessage(req, rp.getMsg()); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + bean.findByPrimaryKey(l_id); + bean.setCurrentFocus("descrizioneRiga"); + req.setAttribute("bean", bean); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _creaXmlFE(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoInterface bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (DocumentoInterface)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + System.out.println("_creaXmlFE: prima di getFatturaElettronicaXml"); + rp = bean.getFatturaElettronicaXml(); + if (rp.getStatus()) { + sendHtmlMsgResponse(req, res, "Fattura Elettronica XML
Warning
" + + DBAdapter.convertStringToHtml(rp.getInfoMsg())); + } else { + sendHtmlMsgResponse(req, res, "Errori:
" + DBAdapter.convertStringToHtml(rp.getMsg()) + "Warning:
" + + DBAdapter.convertStringToHtml(rp.getInfoMsg())); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + sendHtmlMsgResponse(req, res, e.getMessage()); + } + } + } + + public void _delAgente(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoInterface bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (DocumentoInterface)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + l_id = bean.getId_documento(); + req.setAttribute("id_documento", String.valueOf(l_id)); + if (rp.getStatus() == true) { + long id_documentoAgente = getRequestLongParameter(req, "id_documentoAgente"); + DocumentoAgente row = new DocumentoAgente(apFull); + row.findByPrimaryKey(id_documentoAgente); + rp = row.delete(); + sendMessage(req, "Agente Cancellato"); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _delProgettista(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoInterface bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (DocumentoInterface)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + l_id = bean.getId_documento(); + req.setAttribute("id_documento", String.valueOf(l_id)); + if (rp.getStatus() == true) { + long id_rigaDocumentoProgettista = getRequestLongParameter(req, "id_rigaDocumentoProgettista"); + RigaDocumentoProgettista row = new RigaDocumentoProgettista(apFull); + row.findByPrimaryKey(id_rigaDocumentoProgettista); + rp = row.delete(); + sendMessage(req, "Progettista Cancellato"); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _stampaDocumentiCR(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + Documento bean = new Documento(apFull); + bean.creaDocumentoPdfMerge(CR, true); + String fileName = CR.getFilePdf().substring(CR.getFilePdf().lastIndexOf('/')); + String sr = req.getScheme() + "://" + req.getScheme() + ":" + req.getServerName() + req.getServerPort() + "/" + req.getContextPath() + + getPathTmp(); + try { + res.sendRedirect(sr); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void _aggiungiColoreTaglio(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + long l_id_taglia = getRequestLongParameter(req, "id_taglia"); + long l_id_colore = getRequestLongParameter(req, "id_coloreDaAggiungere"); + bean = (Documento)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + if (l_id == 0L) { + fillObject(req, bean); + bean.save(); + l_id = bean.getId_documento(); + req.setAttribute("id_documento", Long.valueOf(l_id)); + } else { + bean.findByPrimaryKey(l_id); + bean.setId_articolo(l_id_articolo); + bean.setId_taglia(l_id_taglia); + rp = bean.save(); + } + if (rp.getStatus()) + if (bean.getArticolo().isArticoloConfezioneOk()) { + ArticoloVariante av = new ArticoloVariante(apFull); + av.findByArticoloColore(l_id_articolo, l_id_colore); + if (av.getId_articoloVariante() == 0L) { + av.setId_articolo(l_id_articolo); + av.setId_colore(l_id_colore); + av.save(); + } + if (av.getId_articoloVariante() > 0L) { + rp = av.creaComposizioneDaArticoloBase(); + if (!rp.getStatus()) + forceMessage(req, "ERRORE! " + rp.getMsg()); + ArticoloTaglia at = new ArticoloTaglia(apFull); + at.findByArticoloTaglia(l_id_articolo, av.getId_articoloVariante(), l_id_taglia); + if (at.getId_articoloTaglia() == 0L) { + at.setId_articolo(l_id_articolo); + at.setId_articoloVariante(av.getId_articoloVariante()); + at.setId_taglia(l_id_taglia); + at.save(); + } + if (at.getId_articoloTaglia() > 0L) { + RigaDocumento rd = new RigaDocumento(apFull); + rd.findByDocumentoArticoloArticoloVarianteTaglia(bean.getId_documento(), at.getId_articolo(), + at.getId_articoloVariante(), at.getId_articoloTaglia()); + if (rd.getId_rigaDocumento() == 0L) { + rd.setId_documento(bean.getId_documento()); + rd.setId_articolo(at.getId_articolo()); + rd.setId_articoloVariante(at.getId_articoloVariante()); + rd.setId_articoloTaglia(at.getId_articoloTaglia()); + rd.setDescrizioneRiga(at.getDescrizioneCompleta(getLang(req))); + rd.setNr(1.0D); + rp = Documento.addRigaDocumento(bean, rd); + if (rp.getStatus()) { + sendMessage(req, "Articolo messo correttamente"); + } else { + sendMessage(req, "ERRORE! " + rp.getMsg()); + } + } else { + sendMessage(req, "ERRORE! Articolo già inserito"); + } + } + showBean(req, res); + } else { + sendMessage(req, "ERRORE! Variante Colore per quell'articolo non immessa"); + showBean(req, res); + } + } else { + sendMessage(req, "ERRORE! Articolo non completo!!! Aggiornare anagrafica con composizione tessuti e simboli lavaggio"); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _mailCommandExtCR(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + CR.setFlgInvioMail(getRequestLongParameter(req, "flgInvioMailM")); + Documento bean = new Documento(apFull); + long l_id = getRequestLongParameter(req, "id_documento"); + String eMail = getRequestParameter(req, "eMailInvio"); + String testoAgg = getRequestParameter(req, "testoAgg"); + bean.findByPrimaryKey(l_id); + if (getAct(req).equals("clifor")) + eMail = bean.getClifor().getEMail(); + if (!testoAgg.isEmpty()) + bean.setTestoAgg(testoAgg); + if (eMail.isEmpty()) { + sendMessage(req, "Errore! indirizzo email non valido!"); + search(req, res); + } else { + CR.setId_documentoS(l_id); + String path = req.getScheme() + "://" + req.getScheme() + ":" + req.getServerName() + req.getServerPort() + "/GetFile.abl?id="; + ResParm rp = bean.startInvioMailExt(CR, eMail, path, testoAgg); + if (rp.getStatus()) { + sendMessage(req, "Mail inviata con successo"); + } else { + sendMessage(req, rp.getErrMsg()); + } + if (l_id > 0L) { + showBean(req, res); + } else { + search(req, res); + } + } + } + + public void _mailCommandCliForCR(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + CR.setFlgInvioMail(getRequestLongParameter(req, "flgInvioMailM")); + Documento bean = new Documento(apFull); + long l_id = getRequestLongParameter(req, "id_documento"); + String testoAgg = getRequestParameter(req, "testoAgg"); + bean.findByPrimaryKey(l_id); + if (!testoAgg.isEmpty()) + bean.setTestoAgg(testoAgg); + CR.setId_documentoS(l_id); + String path = req.getScheme() + "://" + req.getScheme() + ":" + req.getServerName() + req.getServerPort() + "/GetFile.abl?id="; + ResParm rp = bean.startInvioMailClifor(CR, path, testoAgg); + if (rp.getStatus()) { + sendMessage(req, "Mail inviata con successo"); + } else { + sendMessage(req, rp.getErrMsg()); + } + if (l_id > 0L) { + showBean(req, res); + } else { + search(req, res); + } + } + + public void _creaXmlCRFE(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = new Documento(apFull); + DocumentoCR CR = new DocumentoCR(); + fillObject(req, CR); + CR.setFlgXmlGenerato(0L); + ResParm rp = new ResParm(true, ""); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + rp = bean.getFattureElettronicaXmlZip(CR); + if (rp.getStatus()) { + sendHtmlMsgResponse(req, res, "Zip Fatture Elettroniche XML
Warning:
" + + DBAdapter.convertStringToHtml(rp.getInfoMsg())); + } else { + sendHtmlMsgResponse(req, res, "Errori:
" + DBAdapter.convertStringToHtml(rp.getMsg()) + " Warning:
" + + DBAdapter.convertStringToHtml(rp.getInfoMsg())); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + sendHtmlMsgResponse(req, res, e.getMessage()); + } + } + } + + public void _creaXmlRowFE(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoInterface bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (DocumentoInterface)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + search(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + rp = bean.getFatturaElettronicaXml(); + if (rp.getStatus()) { + sendMessage(req, "Fattura elettronica " + + bean.getNumeroDocumentoCompleto() + " " + rp.getInfoMsg() + " creata correttamente!"); + } else { + sendMessage(req, "ERRORE! Fattura elettronica " + bean.getNumeroDocumentoCompleto() + ": " + rp.getInfoMsg()); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + sendHtmlMsgResponse(req, res, e.getMessage()); + } + search(req, res); + } + } + + public void _impostaXmlInviatoRowFE(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (Documento)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + search(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + if (bean.getId_documento() > 0L) { + bean.setTmstInvioXml(DBAdapter.getTimestamp()); + rp = bean.superSave(); + if (rp.getStatus()) { + sendMessage(req, "Fattura elettronica " + bean.getNumeroDocumentoCompleto() + " impostata ad Inviata!"); + } else { + sendMessage(req, "ERRORE! Fattura elettronica " + bean.getNumeroDocumentoCompleto() + ": " + rp.getInfoMsg()); + } + } else { + sendMessage(req, "ERRORE! Codice documento a zero o documento non trovato!"); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + sendHtmlMsgResponse(req, res, e.getMessage()); + } + search(req, res); + } + } + + public void _riapriXmlBloccatoFE(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (Documento)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + search(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + if (bean.getId_documento() > 0L) { + bean.setTmstInvioXml(null); + rp = bean.superSave(); + if (rp.getStatus()) { + sendMessage(req, "Fattura elettronica " + bean.getNumeroDocumentoCompleto() + " sbloccata per un nuovo invio!"); + } else { + sendMessage(req, "ERRORE! Fattura elettronica " + bean.getNumeroDocumentoCompleto() + ": " + rp.getInfoMsg()); + } + } else { + sendMessage(req, "ERRORE! Codice documento a zero o documento non trovato!"); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + sendHtmlMsgResponse(req, res, e.getMessage()); + } + showBean(req, res); + } + } + + protected String getBeanPageNameOLD(HttpServletRequest req) { + ApplParmFull apFull = getApFull(req); + long l_id_tipoDocumento = getRequestLongParameter(req, "id"); + if ((!getCmd(req).equals("search") && l_id_tipoDocumento != getId_docPrenotazione()) || l_id_tipoDocumento == + getId_docPrenotazione() || l_id_tipoDocumento == getId_docRiparazione()) { + long l_id = getRequestLongParameter(req, "id_documento"); + if (l_id > 0L) { + Documento bean = new Documento(apFull); + bean.findByPrimaryKey(l_id); + l_id_tipoDocumento = bean.getId_tipoDocumento(); + if (getId_docCassa() > 0L && l_id_tipoDocumento == getId_docCassa()) + return "documentoCash"; + if (getId_docPrenotazione() > 0L && l_id_tipoDocumento == getId_docPrenotazione()) { + if (getCmd(req).equals("search")) + return "documentoPre"; + return "documento"; + } + if (getId_docRiparazione() > 0L && l_id_tipoDocumento == getId_docRiparazione()) + return "documentoRip"; + if (getId_docRicevuta() > 0L && l_id_tipoDocumento == getId_docRicevuta()) + return "documentoRic"; + if (bean.getTipoDocumento().getFlgTipologia() == 200L) + return "documentoLav"; + return super.getBeanPageName(req); + } + return super.getBeanPageName(req); + } + return super.getBeanPageName(req); + } + + public void _ordineTaglioByArticolo(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(true, ""); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + Documento bean = new Documento(apFull); + long l_id_tipoDocumento = bean.getId_docOrdineTaglio(); + DocumentoCR CR = new DocumentoCR(apFull); + CR.setId_tipoDocumento(l_id_tipoDocumento); + CR.setId_articoloDocumento(l_id_articolo); + CR.setFlgStatoLavorazione(0L); + Vectumerator vecDoc = bean.findByCR(CR, 0, 0); + boolean ordineTrovato = false; + while (vecDoc.hasMoreElements()) { + Documento rowDoc = (Documento)vecDoc.nextElement(); + if (!rowDoc.hasRigheDocumento()) { + ordineTrovato = true; + req.setAttribute("id_documento", Long.valueOf(rowDoc.getId_documento())); + req.setAttribute("cmd", "md"); + try { + checkLangJspPage(req); + RequestDispatcher rd = getServletContext().getRequestDispatcher("/admin/contab/Documento.abl"); + rd.forward((ServletRequest)req, (ServletResponse)res); + break; + } catch (Exception e) { + StringBuilder msg = new StringBuilder(); + if (e.getCause() != null) { + msg.append("Causa:\n"); + msg.append(e.getCause().getMessage()); + msg.append("\n"); + } + msg.append(e.getMessage()); + handleDebug(e, 2); + forceMessage(req, getJspPage(req)); + req.setAttribute("errorMsg", msg.toString()); + RequestDispatcher rd = getServletContext().getRequestDispatcher("/admin/config/error.jsp"); + try { + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception exception) {} + } + } else { + + } + } + if (!ordineTrovato) { + req.setAttribute("id_tipoDocumento", Long.valueOf(l_id_tipoDocumento)); + req.setAttribute("id_articolo", Long.valueOf(l_id_articolo)); + newRecord(req, res); + } + } + + public void _addRigaTessuto2(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (Documento)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + l_id = bean.getId_documento(); + req.setAttribute("id_documento", String.valueOf(l_id)); + if (rp.getStatus() == true) { + RigaDocumento row = new RigaDocumento(apFull); + if (l_id != 0L) { + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + if (l_id_rigaDocumento > 0L) + row.findByPrimaryKey(l_id_rigaDocumento); + fillObject(req, row); + row.setLastUpdTmst(getRequestTmstParameter(req, "lastUpdTmstRow2")); + bean.setCurrentTab(row.getCurrentTab()); + bean.setCurrentTabId(row.getCurrentTabId()); + row.setId_articoloTessutoColore(getRequestLongParameter(req, "id_articoloTessutoColore2")); + row.setId_articoloTessuto(getRequestLongParameter(req, "id_articoloTessuto2")); + row.setSeriale(getRequestParameter(req, "seriale2")); + row.setDescrizioneRiga(getRequestParameter(req, "descrizioneRiga2")); + row.setMt(getRequestDoubleParameter(req, "mtT2")); + row.setKg(getRequestDoubleParameter(req, "kgT2")); + row.setFlgCodiceRiga(1L); + row.setId_causaleMagazzino(getRequestLongParameter(req, "id_causaleMagazzino2")); + row.setId_magFisico(getRequestLongParameter(req, "id_magFisico2")); + System.out.println(getRequestDoubleParameter(req, "quantita2")); + long l_id_colore = getRequestLongParameter(req, "id_colore2"); + if ((l_id_colore > 0L && row.getId_articoloTessutoColore() == 0L) || (row.getId_articoloTessutoColore() > 0L && l_id_colore != + row.getArticoloTessutoColore().getId_colore())) + if ((l_id_colore == 0L && row.getId_articoloTessutoColore() == 0L) || row.getId_articoloTessuto() == 0L) { + rp.setStatus(false); + rp.setMsg("Attenzione! Tessuto o Colore non selezionato!"); + } else { + ArticoloTessutoColore av = new ArticoloTessutoColore(apFull); + if (row.getId_articoloTessutoColore() > 0L) { + av.findByPrimaryKey(row.getId_articoloTessutoColore()); + } else { + av.findByArticoloTessutoColore(row.getId_articoloTessuto(), l_id_colore); + if (av.getId_articoloTessutoColore() == 0L) { + av.setId_articoloTessuto(row.getId_articoloTessuto()); + av.setId_colore(l_id_colore); + av.save(); + } + } + if (av.getId_articoloTessutoColore() == 0L) { + rp.setStatus(false); + rp.setMsg("Attenzione! Non e' stato possibile salvare il colore per il tessuto!"); + } else { + row.setId_articoloTessutoColore(av.getId_articoloTessutoColore()); + } + } + if (row.getId_articoloTessutoColore() > 0L) + row.setDescrizioneRiga(row.getArticoloTessutoColore().getDescrizioneCompleta(getLang(req))); + if (rp.getStatus()) + rp = Documento.addRigaDocumentoTessuto(bean, row, 1L); + if (!rp.getStatus()) + forceMessage(req, rp.getMsg()); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + bean.findByPrimaryKey(l_id); + bean.setCurrentFocus("descrizioneRiga"); + req.setAttribute("bean", bean); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _codBarreDispoTessitura(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(apFull); + DocumentoCR CR = new DocumentoCR(); + fillObject(req, CR); + CR.setId_documentoS(l_id); + sendPdf(res, bean.creaLabelDispoTessitura4x2(CR), "LabelDispoTessitura 4x2" + DBAdapter.getDayTimeTimestamp()); + } + + public void _aggiornaCapiRigaDocumentoTaglio(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + RigaDocumento rd = new RigaDocumento(apFull); + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_rigaDocumento"); + long l_qta = getRequestLongParameter(req, "nrNew"); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + rd.findByPrimaryKey(l_id); + if (rd.getId_rigaDocumento() > 0L) { + Documento bean = rd.getDocumento(); + System.out.println("" + rd.getQuantita() + " " + rd.getQuantita()); + rd.setNr((double)l_qta); + rd.setQuantita((double)l_qta); + rp = Documento.addRigaDocumento(bean, rd); + if (rp.getStatus()) { + Vectumerator vec = bean.findDocFiglioPadreByFiglio(); + if (vec.hasMoreElements()) { + Documento docDisposizioneTaglio = ((DocFiglioPadre)vec.nextElement()).getDocumentoPadre(); + System.out.println(docDisposizioneTaglio.getNumeroDocumentoCompleto()); + rp = docDisposizioneTaglio.ricalcolaDisposizioneTaglio(); + } + if (rp.getStatus()) { + sendHtmlMsgResponse(req, res, Ab.formatBeanMsg("Articolo aggiornato correttamente")); + } else { + sendHtmlMsgResponse(req, res, Ab.formatBeanMsg(rp.getMsg())); + } + } else { + sendHtmlMsgResponse(req, res, Ab.formatBeanMsg("ERRORE! " + rp.getMsg())); + } + } else { + sendHtmlMsgResponse(req, res, Ab.formatBeanMsg("Attenzione! Riga Documento non trovata!")); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _modRigaArticolo(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoInterface bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (DocumentoInterface)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + RigaDocumento row = new RigaDocumento(apFull); + if (getRequestLongParameter(req, "id_rigaDocumento") != 0L) { + fillObject(req, row); + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + row.findByPrimaryKey(l_id_rigaDocumento); + bean.setCurrentTab(row.getCurrentTab()); + bean.setCurrentTabId(row.getCurrentTabId()); + req.setAttribute("bean2", row); + if (bean.getTipoDocumento().getFlgTipologia() == 201L) { + long l_id_rdTessuto = getRequestLongParameter(req, "id_rigaDocumentoTessutoA"); + RigaDocumento rdt = new RigaDocumento(apFull); + rdt.findByPrimaryKey(l_id_rdTessuto); + req.setAttribute("beanRDTessuto", rdt); + req.setAttribute("id_rigaDocumentoTessutoA", Long.valueOf(rdt.getId_rigaDocumentoTessutoA())); + } + if (row.getFlgReso() == 1L) { + bean.setFlgInserisciReso(1L); + req.setAttribute("bean", bean); + } + bean.setFlgAutoAdd(0L); + req.setAttribute("bean", bean); + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _dissociaOrdineTaglio(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String l_lang = getLang(req); + long l_id = getRequestLongParameter(req, "id_docFiglioPadre"); + DocFiglioPadre bean = new DocFiglioPadre(apFull); + ResParm rp = new ResParm(); + bean.findByPrimaryKey(l_id); + if (bean.getId_docFiglioPadre() > 0L) + rp = bean.delete(); + if (rp.getStatus()) { + sendMessage(req, bean.translate("Ordine scollegato correttamente", l_lang)); + } else { + sendMessage(req, bean.translate("Errore! Impossibile scollegare ordine di taglio: " + rp.getMsg(), l_lang)); + } + showBean(req, res); + } + + public void _creaDocFigliS(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + forceJspPageRelative("documentoFigliCrea.jsp", req); + long l_id_tipoDocumento = getRequestLongParameter(req, "id_tipoDocumento"); + long l_id_documento = getRequestLongParameter(req, "id_documento"); + TipoDocumento TD = new TipoDocumento(apFull); + Vectumerator vecListaDocGen = new Vectumerator(); + if (l_id_documento > 0L) { + Documento bean = new Documento(apFull); + bean.findByPrimaryKey(l_id_documento); + TD = bean.getTipoDocumento(); + vecListaDocGen = bean.getTipoDocumento().findDocGen(1L, 0L, 0, 0); + } else if (l_id_tipoDocumento > 0L) { + TD.findByPrimaryKey(l_id_tipoDocumento); + vecListaDocGen = TD.findDocGen(1L, 0L, 0, 0); + } + req.setAttribute("listaDocGen", vecListaDocGen); + req.setAttribute("listaFornitori", new Fornitore(getApFull(req)).findAll()); + boolean creaFtTess = false; + if (TD.getTipologiaDocumento().getCodice() != 200L) + while (vecListaDocGen.hasMoreElements()) { + DocPrel docPrel = (DocPrel)vecListaDocGen.nextElement(); + if (docPrel.getTipoDocumento().hasPadreConTipologia(200L)) { + creaFtTess = true; + break; + } + } + req.setAttribute("creaFtTess", String.valueOf(creaFtTess)); + showBean(req, res); + } + + public void _associaOrdiniTaglio(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String l_lang = getLang(req); + String ordiniTaglio = getRequestParameter(req, "id_documenti"); + String[] id_documenti = ordiniTaglio.split(","); + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(apFull); + ResParm rp = new ResParm(true); + bean.findByPrimaryKey(l_id_documento); + if (bean.getId_documento() > 0L && id_documenti.length > 0) + for (int i = 0; i < id_documenti.length; i++) { + long l_id_documentoOrdineTaglio = Long.valueOf(id_documenti[i]); + rp.append(bean.associaOrdineTaglioADosposizioneTaglio(l_id_documentoOrdineTaglio)); + } + if (rp.getStatus()) { + sendMessage(req, bean.translate("Ordine associato correttamente", l_lang)); + } else { + sendMessage(req, bean.translate("Errore! Impossibile associare ordine di taglio: " + rp.getMsg(), l_lang)); + } + showBean(req, res); + } + + public void _impostaXmlInviatoFE(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (Documento)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + search(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + if (bean.getId_documento() > 0L) { + bean.setTmstInvioXml(DBAdapter.getTimestamp()); + rp = bean.superSave(); + if (rp.getStatus()) { + sendMessage(req, "Fattura elettronica " + bean.getNumeroDocumentoCompleto() + " impostata ad Inviata!"); + } else { + sendMessage(req, "ERRORE! Fattura elettronica " + bean.getNumeroDocumentoCompleto() + ": " + rp.getInfoMsg()); + } + } else { + sendMessage(req, "ERRORE! Codice documento a zero o documento non trovato!"); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + sendHtmlMsgResponse(req, res, e.getMessage()); + } + showBean(req, res); + } + } + + public void _associaOrdineTaglio(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String l_lang = getLang(req); + long l_id_documentoOrdineTaglio = getRequestLongParameter(req, "id_documentoOrdineTaglio"); + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(apFull); + ResParm rp = new ResParm(); + bean.findByPrimaryKey(l_id_documento); + if (bean.getId_documento() > 0L && l_id_documentoOrdineTaglio > 0L) + rp = bean.associaOrdineTaglioADosposizioneTaglio(l_id_documentoOrdineTaglio); + if (rp.getStatus()) { + sendMessage(req, bean.translate("Ordine associato correttamente", l_lang)); + } else { + sendMessage(req, bean.translate("Errore! Impossibile associare ordine di taglio: " + rp.getMsg(), l_lang)); + } + showBean(req, res); + } + + public void _printDisposizioneTaglio(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Users theUser = (Users)getLoginUser(req); + Users operatore = null; + long l_id_users = getRequestLongParameter(req, "id_oper"); + if (l_id_users > 0L) { + operatore = new Users(apFull); + operatore.findByPrimaryKey(l_id_users); + } + try { + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(apFull); + bean.findByPrimaryKey(l_id); + bean.setCurrentLang(getLang(req)); + DocumentoCR CR = new DocumentoCR(); + fillObject(req, CR); + CR.setId_documentoS(l_id); + new File(bean.getPathStampaDocumentoFull()).delete(); + bean.setPrtCommand(0L); + sendPdf(res, bean.creaDocumentoPdf(CR, false), "Dispo " + bean.getNumeroDocumentoCompleto() + DBAdapter.getDayTimeTimestamp()); + if (bean.getPrtCommand() == 1L && bean.getFlgStatoLavorazione() != 30L) { + bean.setFlgStatoLavorazione(30L); + bean.save(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void _addRigaFilato(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (Documento)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + l_id = bean.getId_documento(); + req.setAttribute("id_documento", String.valueOf(l_id)); + if (rp.getStatus() == true) { + RigaDocumento row = new RigaDocumento(apFull); + if (l_id != 0L) { + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + if (l_id_rigaDocumento > 0L) + row.findByPrimaryKey(l_id_rigaDocumento); + fillObject(req, row); + row.setLastUpdTmst(getRequestTmstParameter(req, "lastUpdTmstRow1")); + row.setKg(getRequestDoubleParameter(req, "kgF")); + System.out.println(getRequestDoubleParameter(req, "quantita")); + rp = Documento.addRigaDocumentoFilato(bean, row); + if (!rp.getStatus()) + forceMessage(req, rp.getMsg()); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + bean.findByPrimaryKey(l_id); + req.setAttribute("bean", bean); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + protected void newRecord(HttpServletRequest req, HttpServletResponse res) { + prepareNewRecord(req, res); + if (getRequestLongParameter(req, "id_tipoDocumento") > 0L) + req.setAttribute("id", Long.valueOf(getRequestLongParameter(req, "id_tipoDocumento"))); + setJspPageRelative(getBeanPrimaryPageName(req), req); + req.setAttribute("RI", new ReturnItem(req.getParameter("RI"))); + callJsp(req, res); + } + + public void _docPagato(HttpServletRequest req, HttpServletResponse res) { + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + ResParm rp = new ResParm(); + if (bean.getDBState() == 0) { + rp.setStatus(false); + rp.setMsg("Errore! Codice documento non valido"); + } else { + rp = bean.impostaFlgPagata(1L); + } + if (rp.getStatus()) { + sendMessage(req, "Documento " + bean.getNumeroDocumentoCompleto() + " pagato."); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } + + public void _creaElencoMail(HttpServletRequest req, HttpServletResponse res) { + Documento bean = new Documento(getApFull(req)); + DocumentoCR CR = new DocumentoCR(getApFull(req)); + fillObject(req, CR); + ResParm rp = bean.creaFileMailingList(CR); + if (rp.getStatus()) { + sendHtmlMsgResponse(req, res, "File Mailing List"); + } else { + sendHtmlMsgResponse(req, res, "Errori:
" + DBAdapter.convertStringToHtml(rp.getMsg())); + } + } + + public void _creaDocFigli(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = new Documento(apFull); + long l_id_fornitore = getRequestLongParameter(req, "id_cliforR"); + long l_id = getRequestLongParameter(req, "id_documentoR"); + long l_flgTipoGenerazione = getRequestLongParameter(req, "flgTipoGenerazione"); + Users operatore = null; + long l_id_users = getRequestLongParameter(req, "id_oper"); + if (l_id_users > 0L) { + operatore = new Users(apFull); + operatore.findByPrimaryKey(l_id_users); + } else { + operatore = bean.getUsers(); + } + ResParm rp = new ResParm(true); + long l_id_tipoDocumentoFiglio = getRequestLongParameter(req, "id_tipoDocumentoF"); + if (l_id_fornitore == 0L || l_id == 0L) { + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + if (CR.getId_tipoDocumento() == 0L) { + rp.setMsg("Errore! Intestazione del documento non trovata!"); + rp.setStatus(false); + } else { + Vectumerator vec = bean.findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + Documento row = (Documento)vec.nextElement(); + if (l_id_tipoDocumentoFiglio == getId_docCassa()) { + rp = row.creaDocumentoFiglio(row.getId_clifor(), l_id_tipoDocumentoFiglio, operatore, false, l_flgTipoGenerazione); + continue; + } + rp = row.creaDocumentoFiglio(row.getId_clifor(), l_id_tipoDocumentoFiglio, operatore, true, l_flgTipoGenerazione); + } + } + } else { + bean.findByPrimaryKey(l_id); + if (l_id_tipoDocumentoFiglio == getId_docCassa()) { + rp = bean.creaDocumentoFiglio(l_id_fornitore, l_id_tipoDocumentoFiglio, operatore, false, l_flgTipoGenerazione); + } else { + rp = bean.creaDocumentoFiglio(l_id_fornitore, l_id_tipoDocumentoFiglio, operatore, false, l_flgTipoGenerazione); + } + } + if (rp.getStatus()) { + afterCreaDocFigli(req, res, bean, l_id_tipoDocumentoFiglio); + } else { + sendMessage(req, rp.getErrMsg()); + } + String theForm = getRequestParameter(req, "theForm"); + String pageType = getRequestParameter(req, "pageType"); + if (theForm.equals("ricerca") || pageType.equals("R")) { + search(req, res); + } else { + req.setAttribute("id_documento", Long.valueOf(l_id)); + showBean(req, res); + } + } + + public void _creaFattureDaDDtTessituraThread(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = new Documento(apFull); + long l_id_cliforR = getRequestLongParameter(req, "id_cliforR"); + long l_id = getRequestLongParameter(req, "id_documentoR"); + long l_flgTipoGenerazione = getRequestLongParameter(req, "flgTipoGenerazione"); + Users operatore = null; + long l_id_users = getRequestLongParameter(req, "id_oper"); + if (l_id_users > 0L) { + operatore = new Users(apFull); + operatore.findByPrimaryKey(l_id_users); + } else { + operatore = bean.getUsers(); + } + long l_id_tipoDocumentoFiglio = getRequestLongParameter(req, "id_tipoDocumentoF"); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + ResParm rp = bean.startThreadCreaFtTessitura(CR, l_id_cliforR, l_id, l_id_tipoDocumentoFiglio, l_flgTipoGenerazione, operatore); + if (rp.getStatus()) { + sendMessage(req, "Mail inviata con successo"); + } else { + sendMessage(req, rp.getErrMsg()); + } + String theForm = getRequestParameter(req, "theForm"); + String pageType = getRequestParameter(req, "pageType"); + if (theForm.equals("ricerca") || pageType.equals("R")) { + search(req, res); + } else { + req.setAttribute("id_documento", Long.valueOf(l_id)); + showBean(req, res); + } + } + + public void _creaReportArticoliCsv(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoCR CR = new DocumentoCR(apFull); + fillObject(req, CR); + CR.setId_users(getUser(req).getId_users()); + Documento bean = new Documento(apFull); + CR.setFlgReport("S"); + bean.creaFileArticoliCvs(CR); + sendHtmlMsgResponse(req, res, "File report in formato cvs (Excel)"); + } + + public void _esportaSuATR(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (Documento)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + if (bean.getId_documento() > 0L) { + fillObject(req, bean); + bean.setFlgStatoOrdineWwwPrecedente(9L); + bean.save(); + System.out.println("_esportaSuATR: APATR..."); + System.out.println("_esportaSuATR: chiamaga rest"); + CcApi ccapi = new CcApi(apFull); + ApiClientResult result = ccapi._postImportcc(bean.getId_documento()); + rp.setStatus(result.isOk()); + rp.setMsg(result.getMsg()); + bean.setCurrentTab(getRequestParameter(req, "currentTab")); + bean.refreshBean(); + req.setAttribute("bean", bean); + if (rp.getStatus()) { + sendMessage(req, rp.getErrMsg()); + } else { + sendMessage(req, "Esport su FTR effettuata!"); + } + showBean(req, res); + } + } catch (Exception e) { + System.out.println("_esportaSuATR: exc:" + e.getMessage()); + e.printStackTrace(); + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _esportaSuATROLD(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (Documento)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + if (bean.getId_documento() > 0L) { + System.out.println("_esportaSuATR: APATR..."); + ApplParmFull apAtr = new ApplParmFull(new ApplParm(getApFull().getParm("dbDriver2").getNumeroInt(), + getApFull().getParm("database2").getTesto(), + getApFull().getParm("user2").getTesto(), + getApFull().getParm("password2").getTesto())); + System.out.println("_esportaSuATR: APATR:" + apAtr.getApDescription()); + bean.setCurrentTab(getRequestParameter(req, "currentTab")); + req.setAttribute("bean", bean); + if (rp.getStatus()) { + sendMessage(req, rp.getErrMsg()); + } else { + sendMessage(req, "Esport su FTR effettuata!"); + } + showBean(req, res); + } + } catch (Exception e) { + System.out.println("_esportaSuATR: exc:" + e.getMessage()); + e.printStackTrace(); + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _calcolaCostiWww(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (Documento)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + if (bean.getId_documento() > 0L) { + fillObject(req, bean); + bean.save(); + bean.calcolaCostiWww(); + bean.setCurrentTab(getRequestParameter(req, "currentTab")); + req.setAttribute("bean", bean); + sendMessage(req, "Calcolo costi WWW effettuato (non salvato)"); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _creaReportCsv(HttpServletRequest req, HttpServletResponse res) { + DocumentoCR CR = (DocumentoCR)req.getSession().getAttribute(getATTR_CRBEAN(req)); + Documento bean = new Documento(getApFull(req)); + bean.creaFileCvs(CR); + sendHtmlMsgResponse(req, res, "File Elenco Documenti in formato cvs (Excel)"); + } + + public void _ordinaRighePerTela(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoInterface bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (DocumentoInterface)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + l_id = bean.getId_documento(); + req.setAttribute("id_documento", String.valueOf(l_id)); + if (rp.getStatus() == true) { + if (l_id != 0L) { + rp = Documento.riordinaRigheDocPerRiferimento(bean); + if (!rp.getStatus()) + forceMessage(req, rp.getMsg()); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + bean.findByPrimaryKey(l_id); + req.setAttribute("bean", bean); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _eliminaRigheAZero(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(apFull); + bean.findByPrimaryKey(l_id_documento); + if (bean.getId_documento() > 0L) { + rp = bean.eliminaRigheAzero(); + } else { + rp = new ResParm(false, "Errore!! Documento non trovato! " + l_id_documento); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _addAgente(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoInterface bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (DocumentoInterface)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + long id_clifor = getRequestLongParameter(req, "id_cliforDA"); + long id_documento = getRequestLongParameter(req, "id_documento"); + double percDocumentoAgente = getRequestDoubleParameter(req, "percDocumentoAgente"); + DocumentoAgente row = new DocumentoAgente(apFull); + row.findByDocumentoAgente(id_documento, id_clifor); + row.setId_documento(id_documento); + row.setId_cliforDA(id_clifor); + row.setPercDocumentoAgente(percDocumentoAgente); + rp = row.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _sceltaTessuto(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoInterface bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (DocumentoInterface)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + RigaDocumento row = new RigaDocumento(apFull); + if (getRequestLongParameter(req, "id_rigaDocumento") != 0L) { + fillObject(req, row); + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + row.findByPrimaryKey(l_id_rigaDocumento); + if (bean.getTipoDocumento().getFlgTipologia() == 201L) { + bean.setCurrentTab("#RIGHEF2"); + } else if (bean.getTipoDocumento().getFlgTipologia() == 202L) { + bean.setCurrentTab("#RIGHET2"); + } + row.setCurrentTabId(getRequestLongParameter(req, "currentTabId")); + req.setAttribute("beanRDTessuto", row); + req.setAttribute("id_rigaDocumentoTessutoA", Long.valueOf(row.getId_rigaDocumentoTessutoA())); + bean.setFlgAutoAdd(0L); + req.setAttribute("bean", bean); + req.setAttribute("listaArticoloTessutoFilato", row.getArticoloTessuto().findArticoliTessutoFilati(0, 0)); + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _addRigaFilato2(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (Documento)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + l_id = bean.getId_documento(); + req.setAttribute("id_documento", String.valueOf(l_id)); + if (rp.getStatus() == true) { + RigaDocumento row = new RigaDocumento(apFull); + if (l_id != 0L) { + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + if (l_id_rigaDocumento > 0L) + row.findByPrimaryKey(l_id_rigaDocumento); + fillObject(req, row); + row.setLastUpdTmst(getRequestTmstParameter(req, "lastUpdTmstRow2")); + bean.setCurrentTab(row.getCurrentTab()); + bean.setCurrentTabId(row.getCurrentTabId()); + row.setKg(getRequestDoubleParameter(req, "kgF2")); + row.setId_articoloFilatoColore(getRequestLongParameter(req, "id_articoloFilatoColore2")); + row.setSeriale(getRequestParameter(req, "seriale2")); + row.setDescrizioneRiga(getRequestParameter(req, "descrizioneRiga2")); + System.out.println(getRequestDoubleParameter(req, "quantita2")); + System.out.println(getRequestDoubleParameter(req, "id_rigaDocumentoTessutoA")); + row.setFlgCodiceRiga(1L); + rp = Documento.addRigaDocumentoFilato(bean, row); + if (!rp.getStatus()) + forceMessage(req, rp.getMsg()); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + bean.findByPrimaryKey(l_id); + req.setAttribute("bean", bean); + if (bean.getTipoDocumento().getFlgTipologia() == 201L) { + long l_id_rdTessuto = getRequestLongParameter(req, "id_rigaDocumentoTessutoA"); + RigaDocumento rdt = new RigaDocumento(apFull); + rdt.findByPrimaryKey(l_id_rdTessuto); + req.setAttribute("beanRDTessuto", rdt); + req.setAttribute("id_rigaDocumentoTessutoA", Long.valueOf(rdt.getId_rigaDocumentoTessutoA())); + } + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _delRigaArticolo(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoInterface bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = (DocumentoInterface)getBean(req); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + bean.findByPrimaryKey(l_id); + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + if (l_id_rigaDocumento != 0L) { + RigaDocumento row = new RigaDocumento(apFull); + fillObject(req, row); + row.setLastUpdTmst(getRequestTmstParameter(req, "lastUpdTmstRow1")); + bean.setCurrentTab(row.getCurrentTab()); + bean.setCurrentTabId(row.getCurrentTabId()); + rp = bean.delRigaDocumento(row); + if (rp.getStatus()) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, rp.getMsg()); + } + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + if (bean.getTipoDocumento().getFlgTipologia() == 201L) { + long l_id_rdTessuto = getRequestLongParameter(req, "id_rigaDocumentoTessutoA"); + RigaDocumento rdt = new RigaDocumento(apFull); + rdt.findByPrimaryKey(l_id_rdTessuto); + req.setAttribute("beanRDTessuto", rdt); + req.setAttribute("id_rigaDocumentoTessutoA", Long.valueOf(rdt.getId_rigaDocumentoTessutoA())); + } + if (!bean.hasRigheDocumento() && bean.getId_tipoDocumento() == getId_docCassa()) { + long l_id_tipoDocumento = bean.getId_tipoDocumento(); + bean.delete(); + bean.setId_tipoDocumento(l_id_tipoDocumento); + req.setAttribute("id_documento", ""); + } else { + bean.save(); + } + bean.setFlgMantieniArticoloRiga(getRequestLongParameter(req, "flgMantieniArticoloRiga")); + bean.setFlgAutoAdd(getRequestLongParameter(req, "flgAutoAdd")); + bean.setFlgSingleLineArt(getRequestLongParameter(req, "flgSingleLineArt")); + bean.setCurrentFocus("descrizioneRiga"); + req.setAttribute("bean", bean); + showBean(req, res); + } + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Users theUser = new Users(apFull); + theUser.findByPrimaryKey(getLoginUserId(req)); + if (theUser.getId_userProfile() != 10L) { + super.search(req, res); + } else if (theUser.getId_clifor() > 0L) { + req.setAttribute("id_clifor", String.valueOf(theUser.getId_clifor())); + super.search(req, res); + } else { + sendGrantMessage(req, "Attenzione!! Non è stato impostato il cliente all'utente " + theUser.getLogin()); + callJsp(req, res); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/GetDocumentoAttachSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/GetDocumentoAttachSvlt.java new file mode 100644 index 00000000..e76fbe7a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/GetDocumentoAttachSvlt.java @@ -0,0 +1,18 @@ +package it.acxent.contab.servlet; + +import it.acxent.art.AllegatoArticolo; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/_attach/_doc/*"}) +public class GetDocumentoAttachSvlt extends it.acxent.servlet.GetFileSvlt { + private static final long serialVersionUID = -4630036169261100261L; + + protected String getFileName(HttpServletRequest req, HttpServletResponse res) { + AllegatoArticolo bean = new AllegatoArticolo(getApFull(req)); + bean.findByPrimaryKey(getRequestLongParameter(req, "id")); + String fileName = bean.getNomeFileCompleto(); + return fileName; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/GetFileSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/GetFileSvlt.java new file mode 100644 index 00000000..5f2ec12a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/GetFileSvlt.java @@ -0,0 +1,102 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag._AnagAdapter; +import it.acxent.contab.Documento; +import it.acxent.db.DBAdapter; +import it.acxent.reg.EcDc; +import it.acxent.servlet.AcServlet; +import java.io.File; +import java.io.FileInputStream; +import java.sql.Time; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class GetFileSvlt extends AcServlet { + protected void callJsp(HttpServletRequest req, HttpServletResponse res) { + File theFile = null; + FileInputStream fis = null; + try { + if (checkProfile(req, res)) { + Documento doc = new Documento(getApFull(req)); + String id = getIdDocumento(req, res); + doc.findByPrimaryKey(Long.valueOf(id)); + String fileName = getDocBase() + getDocBase() + doc.getPathTmp(); + String ext = fileName.substring(fileName.lastIndexOf('.') + 1, fileName.length()); + if (ext.toLowerCase().equals("html") || ext.toLowerCase().equals("jsp") || ext.toLowerCase().equals("php")) { + String thePage = req.getContextPath() + req.getContextPath(); + setJspPage(thePage, req); + res.sendRedirect(getJspPage(req)); + } else { + fileName = doc.getPathStampaDocumentoFull(); + ext = fileName.substring(fileName.lastIndexOf('.') + 1, fileName.length()); + theFile = new File(fileName); + res.setContentType("application/" + ext); + if (theFile.exists()) { + if (doc.getDBState() == 1) { + doc.setDataDownload(DBAdapter.getToday()); + doc.setOraDownload(new Time(DBAdapter.getTimestamp().getTime())); + doc.setIpDownload(req.getRemoteAddr()); + doc.setFlgDownload(1L); + doc.save(); + } + fis = new FileInputStream(theFile); + byte[] temp = new byte[1024]; + int nByte = 0; + ServletOutputStream sos = res.getOutputStream(); + while ((nByte = fis.read(temp)) != -1) + sos.write(temp, 0, nByte); + sos.flush(); + fis.close(); + sos.close(); + } else if (useAlwaysSendRedirect()) { + String absPage = getFileNotFoundJsp(req, res).startsWith("/") ? ( + req.getContextPath() + req.getContextPath()) : ( + req.getContextPath() + "/" + req.getContextPath()); + res.sendRedirect(absPage); + } else { + setJspPage(getFileNotFoundJsp(req, res), req); + res.sendRedirect(getJspPage(req)); + } + } + } else { + setJspPage(getFileNotFoundJsp(req, res), req); + res.sendRedirect(getJspPage(req)); + } + } catch (Exception e) { + e.printStackTrace(); + } finally { + theFile = null; + if (fis != null) + fis = null; + } + } + + protected String getFileName(HttpServletRequest req, HttpServletResponse res) { + String fileName = getRequestParameter(req, "id"); + fileName = EcDc.decodeDizionario(fileName, _AnagAdapter.KEY_ENCODE_DIZ); + return fileName; + } + + protected String getIdDocumento(HttpServletRequest req, HttpServletResponse res) { + String id = getRequestParameter(req, "id2"); + id = EcDc.decodeDizionario(id, _AnagAdapter.KEY_ENCODE_DIZ); + return id; + } + + protected String getFileNotFoundJsp(HttpServletRequest req, HttpServletResponse res) { + return "/fileNotFound.jsp"; + } + + protected boolean checkProfile(HttpServletRequest req, HttpServletResponse res) { + return true; + } + + protected void processRequest(HttpServletRequest request, HttpServletResponse response) { + callJsp(request, response); + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/GetIvaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/GetIvaSvlt.java new file mode 100644 index 00000000..13128593 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/GetIvaSvlt.java @@ -0,0 +1,20 @@ +package it.acxent.contab.servlet; + +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contab/GetIva.pdf"}) +public class GetIvaSvlt extends it.acxent.servlet.GetFileSvlt { + protected String getUploadPath() { + return getParm("PATH_TMP").getTesto(); + } + + protected String getFileName(HttpServletRequest req, HttpServletResponse res) { + return getDocBase() + getDocBase() + getUploadPath(); + } + + protected boolean checkProfile(HttpServletRequest req, HttpServletResponse res) { + return super.checkProfile(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/IncassoPagamentoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/IncassoPagamentoSvlt.java new file mode 100644 index 00000000..6ed78f10 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/IncassoPagamentoSvlt.java @@ -0,0 +1,31 @@ +package it.acxent.contab.servlet; + +import it.acxent.contab.IncassoPagamento; +import it.acxent.contab.IncassoPagamentoCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contab/IncassoPagamento.abl"}) +public class IncassoPagamentoSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new IncassoPagamento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new IncassoPagamentoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {} +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/MovimentoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/MovimentoSvlt.java new file mode 100644 index 00000000..418b7b8b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/MovimentoSvlt.java @@ -0,0 +1,193 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.Esercizio; +import it.acxent.anag.MagFisico; +import it.acxent.art.Articolo; +import it.acxent.art.Marca; +import it.acxent.contab.Movimento; +import it.acxent.contab.MovimentoCR; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.TipoDocumento; +import it.acxent.contab.TipoDocumentoCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.Vectumerator; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contab/Movimento.abl"}) +public class MovimentoSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findByCR(new TipoDocumentoCR(), 0, 0)); + req.setAttribute("listaMagFisico", new MagFisico(apFull).findAll()); + req.setAttribute("listaEsercizi", new Esercizio(apFull).findAll()); + req.setAttribute("listaMarche", new Marca(apFull).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Movimento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new MovimentoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("viewM")) { + setJspPageRelative("../../admin/art/articoloViewMovimento.jsp", req); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + long l_id_magFisico = getRequestLongParameter(req, "id_magFisico"); + long l_id_clifor = getRequestLongParameter(req, "id_clifor"); + long l_flgInMagazzino = getRequestLongParameter(req, "flgInMagazzino"); + Articolo bean = new Articolo(getApFull(req)); + bean.findByPrimaryKey(l_id_articolo); + MovimentoCR CR = new MovimentoCR(); + CR.setId_articolo(l_id_articolo); + CR.setId_magFisico(l_id_magFisico); + CR.setId_clifor(l_id_clifor); + CR.setFlgInMagazzino(l_flgInMagazzino); + Movimento mov = new Movimento(getApFull(req)); + Vectumerator vec = mov.findSaldiArticoloVarianteTagliaByCR(CR, 0, 0); + req.setAttribute("listaArticoliVarianteMovimento", vec); + req.setAttribute("bean", bean); + callJsp(req, res); + } else { + super.otherCommands(req, res); + } + } + + protected int getPageRow(HttpServletRequest req) { + return 55; + } + + public void _interrogazione2(HttpServletRequest req, HttpServletResponse res) { + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + MovimentoCR CR = new MovimentoCR(); + CR.setId_articolo(l_id_articolo); + RigaDocumento bean = new RigaDocumento(getApFull(req)); + req.setAttribute("list1", bean.findOrdiniByArticolo(l_id_articolo)); + req.setAttribute("CR", CR); + showBean(req, res); + } + + public void _loadDettaglio1(HttpServletRequest req, HttpServletResponse res) { + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + long l_id_documento = getRequestLongParameter(req, "id_documento"); + MovimentoCR CR = new MovimentoCR(); + CR.setId_articolo(l_id_articolo); + RigaDocumento bean = new RigaDocumento(getApFull(req)); + req.setAttribute("list1", bean.findOrdiniByArticolo(l_id_articolo)); + req.setAttribute("list2", bean.findMovimentiDiCaricoByArticoloDocumento(l_id_articolo, l_id_documento)); + req.setAttribute("CR", CR); + showBean(req, res); + } + + public void _loadDettaglio2(HttpServletRequest req, HttpServletResponse res) { + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + long l_id_documento = getRequestLongParameter(req, "id_documento"); + MovimentoCR CR = new MovimentoCR(); + CR.setId_articolo(l_id_articolo); + CR.setId_documento(l_id_documento); + RigaDocumento bean = new RigaDocumento(getApFull(req)); + req.setAttribute("list1", bean.findOrdiniByArticolo(l_id_articolo)); + req.setAttribute("list2", bean.findMovimentiDiCaricoByArticoloDocumento(l_id_articolo, l_id_documento)); + req.setAttribute("CR", CR); + showBean(req, res); + } + + public void _loadDettaglio3(HttpServletRequest req, HttpServletResponse res) { + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + long l_id_documento = getRequestLongParameter(req, "id_documento"); + long l_id_documento2 = getRequestLongParameter(req, "id_documento2"); + MovimentoCR CR = new MovimentoCR(); + CR.setId_articolo(l_id_articolo); + CR.setId_documento(l_id_documento); + CR.setId_documento2(l_id_documento2); + RigaDocumento bean = new RigaDocumento(getApFull(req)); + req.setAttribute("list1", bean.findOrdiniByArticolo(l_id_articolo)); + req.setAttribute("list2", bean.findMovimentiDiCaricoByArticoloDocumento(l_id_articolo, l_id_documento)); + req.setAttribute("list3", bean.findDettaglioBollaByArticoloDocumento(l_id_articolo, l_id_documento2)); + req.setAttribute("CR", CR); + showBean(req, res); + } + + public void _loadDettaglio4(HttpServletRequest req, HttpServletResponse res) { + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + long l_id_documento = getRequestLongParameter(req, "id_documento"); + long l_id_documento2 = getRequestLongParameter(req, "id_documento2"); + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + MovimentoCR CR = new MovimentoCR(); + CR.setId_articolo(l_id_articolo); + CR.setId_documento(l_id_documento); + CR.setId_documento2(l_id_documento2); + CR.setId_documento(l_id_rigaDocumento); + RigaDocumento bean = new RigaDocumento(getApFull(req)); + req.setAttribute("list1", bean.findOrdiniByArticolo(l_id_articolo)); + req.setAttribute("list2", bean.findMovimentiDiCaricoByArticoloDocumento(l_id_articolo, l_id_documento)); + req.setAttribute("list3", bean.findDettaglioBollaByArticoloDocumento(l_id_articolo, l_id_documento2)); + req.setAttribute("list4", new Movimento(getApFull(req)).findByRigaDocumento(l_id_rigaDocumento)); + req.setAttribute("CR", CR); + showBean(req, res); + } + + public void _aggiustaOrdini(HttpServletRequest req, HttpServletResponse res) { + RigaDocumento bean = new RigaDocumento(getApFull(req)); + bean.importMovimentoOrdiniAFornitore(); + showBean(req, res); + } + + public void _interrogazione3(HttpServletRequest req, HttpServletResponse res) { + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + MovimentoCR CR = new MovimentoCR(); + CR.setId_articolo(l_id_articolo); + RigaDocumento bean = new RigaDocumento(getApFull(req)); + req.setAttribute("CR", CR); + showBean(req, res); + } + + protected String getBeanPageName(HttpServletRequest req) { + if (getCmd(req).equals("interrogazione3")) + return "checkOrdinato"; + return super.getBeanPageName(req); + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + if (getBackRequest(req).equals(getACT_BACK())) { + MovimentoCR movimentoCR = (MovimentoCR)req.getSession().getAttribute(getATTR_CRBEAN(req)); + l_id_articolo = movimentoCR.getId_articolo(); + } + MovimentoCR CR = new MovimentoCR(getApFull(req)); + fillObject(req, CR); + if (l_id_articolo > 0L) { + Articolo articolo = new Articolo(getApFull(req)); + articolo.findByPrimaryKey(l_id_articolo); + if (articolo.getTipo().getFlgUsaVarianti() == 1L) + if (articolo.getDBState() == 1) + req.setAttribute("listaVarianti", articolo.findArticoliVarianti(-1L, -1L)); + } + if (CR.getId_esercizio() == -1L) + req.setAttribute("id_esercizio", Integer.valueOf(DBAdapter.getCurrentYear())); + return super.beforeSearch(req, res); + } + + public void _creaReportCsv(HttpServletRequest req, HttpServletResponse res) { + MovimentoCR CR = (MovimentoCR)req.getSession().getAttribute(getATTR_CRBEAN(req)); + CR.setFlgTipoReport(getRequestLongParameter(req, "flgTipoReport")); + CR.setId_users(getLoginUserId(req).longValue()); + Movimento bean = new Movimento(getApFull(req)); + bean.creaFileCvs(CR); + sendHtmlMsgResponse(req, res, "File report in formato cvs (Excel)"); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/PianoContiSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/PianoContiSvlt.java new file mode 100644 index 00000000..5aa2883c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/PianoContiSvlt.java @@ -0,0 +1,27 @@ +package it.acxent.contab.servlet; + +import it.acxent.contab.PianoConti; +import it.acxent.contab.PianoContiCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contabConfig/PianoConti.abl"}) +public class PianoContiSvlt extends AblServletSvlt { + private static final long serialVersionUID = -6143176459987431155L; + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new PianoConti(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new PianoContiCR(getApFull(req)); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/RegistroIvaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/RegistroIvaSvlt.java new file mode 100644 index 00000000..bbb8e150 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/RegistroIvaSvlt.java @@ -0,0 +1,108 @@ +package it.acxent.contab.servlet; + +import it.acxent.contab.RegistroIva; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.util.AbMessages; +import java.io.File; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contab/RegistroIva.abl"}) +public class RegistroIvaSvlt extends _ContabSvlt { + protected void xchiamaJsp(HttpServletRequest req, HttpServletResponse res) { + setJspPageRelative("registroIva.jsp", req); + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req)); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void print(HttpServletRequest req, HttpServletResponse res) { + try { + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) > 0L) { + if (getAct(req).equals("riva")) { + RegistroIva bean = RegistroIva.getInstance(getApFull(req), getTipoRegistro(req)); + fillObject(req, bean); + String nomeRegistro = "riva_" + String.valueOf(bean.getDataDa()) + "_" + String.valueOf(bean.getDataA()) + ".pdf"; + String fileName = getPathTmpFull() + getPathTmpFull(); + if (isFileExist(fileName)) + new File(fileName).delete(); + bean.setFileName(fileName); + bean.creaRegistroIvaPdf(); + bean.aggiustaRPAIniziale(); + req.setAttribute("bean", bean); + } else if (getAct(req).equals("riep")) { + RegistroIva bean = RegistroIva.getInstance(getApFull(req), getTipoRegistro(req)); + fillObject(req, bean); + String nomeRegistro = "riep_" + String.valueOf(bean.getDataDa()) + "_" + String.valueOf(bean.getDataA()) + ".pdf"; + String fileName = getPathTmpFull() + getPathTmpFull(); + if (isFileExist(fileName)) + new File(fileName).delete(); + bean.setFileName(fileName); + bean.creaRiepilogoIvaPdf(); + bean.aggiustaRPAIniziale(); + req.setAttribute("bean", bean); + } else { + sendMessage(req, "?? comando non valido!"); + } + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_R")); + } + } catch (Exception e) { + e.printStackTrace(); + } + forceJspPageRelative("registroIva.jsp", req); + callJsp(req, res); + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + RegistroIva bean = RegistroIva.getInstance(getApFull(req), getTipoRegistro(req)); + if (getLoginUserGrant(req, bean.getTableBeanName()) > 0L) { + fillObject(req, bean); + bean.aggiustaRPAIniziale(); + req.setAttribute("bean", bean); + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_R")); + } + forceJspPageRelative("registroIva.jsp", req); + callJsp(req, res); + } + + protected long getTipoRegistro(HttpServletRequest req) { + long tr = getRequestLongParameter(req, "id_registroIva"); + if (tr == 0L) + return 1L; + return tr; + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return RegistroIva.getInstance(getApFull(req), getTipoRegistro(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return null; + } + + public void _stampaRegistroIva(HttpServletRequest req, HttpServletResponse res) { + RegistroIva bean = RegistroIva.getInstance(getApFull(req), getTipoRegistro(req)); + fillObject(req, bean); + String nomeRegistro = "riva_" + String.valueOf(bean.getDataDa()) + "_" + String.valueOf(bean.getDataA()) + ".pdf"; + String fileName = nomeRegistro; + bean.setFileName(fileName); + bean.creaRegistroIvaPdf(); + bean.aggiustaRPAIniziale(); + req.setAttribute("bean", bean); + showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/RigaDocumentoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/RigaDocumentoSvlt.java new file mode 100644 index 00000000..7e4d9081 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/RigaDocumentoSvlt.java @@ -0,0 +1,223 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.Esercizio; +import it.acxent.anag.Iva; +import it.acxent.anag.MagFisico; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.Vettore; +import it.acxent.art.Marca; +import it.acxent.contab.Documento; +import it.acxent.contab.Movimento; +import it.acxent.contab.MovimentoCR; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.RigaDocumentoCR; +import it.acxent.contab.TipoDocumento; +import it.acxent.contab.TipoDocumentoCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.newsletter.CodaMessaggi; +import it.acxent.newsletter.TemplateMsg; +import it.acxent.util.AbMessages; +import it.acxent.util.Vectumerator; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contab/RigaDocumento.abl"}) +public class RigaDocumentoSvlt extends _ContabSvlt { + private static final long serialVersionUID = -4988119342406716471L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(apFull); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + req.setAttribute("id_documento", String.valueOf(bean.getId_documento())); + if (rp.getStatus() == true) { + if (getAct(req).equals("addRigaArticolo")) { + RigaDocumento row = new RigaDocumento(apFull); + if (l_id != 0L) { + fillObject(req, row); + rp = Documento.addRigaDocumento(bean, row); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("delRigaArticolo")) { + RigaDocumento row = new RigaDocumento(apFull); + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + if (l_id_rigaDocumento != 0L) { + fillObject(req, row); + bean.delRigaDocumento(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("modRigaArticolo")) { + RigaDocumento row = new RigaDocumento(apFull); + if (getRequestLongParameter(req, "id_rigaDocumento") != 0L) { + fillObject(req, row); + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + row.findByPrimaryKey(l_id_rigaDocumento); + req.setAttribute("bean2", row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } + } else { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected void mail(HttpServletRequest req, HttpServletResponse res) {} + + protected void print(HttpServletRequest req, HttpServletResponse res) {} + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + super.processRequest(req, res); + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + RigaDocumento bean = (RigaDocumento)beanA; + req.setAttribute("listaTipoPagamento", new TipoPagamento(apFull).findAll()); + req.setAttribute("listaVettore", new Vettore(apFull).findAll()); + req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findAll()); + req.setAttribute("listaIva", new Iva(apFull).findAll()); + } + + protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipoDocumento", new TipoDocumento(apFull).findByCR(new TipoDocumentoCR(), 0, 0)); + req.setAttribute("listaMagFisico", new MagFisico(apFull).findAll()); + req.setAttribute("listaEsercizi", new Esercizio(apFull).findAll()); + req.setAttribute("listaMarche", new Marca(apFull).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new RigaDocumento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new RigaDocumentoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("ov")) { + RigaDocumentoCR CR = new RigaDocumentoCR(getApFull(req)); + fillObject(req, CR); + CR.setId_tipoDocumento(getId_docOrdine()); + CR.setFlgTipoRicerca(0L); + req.setAttribute("CR", CR); + RigaDocumento bean = new RigaDocumento(getApFull(req)); + req.setAttribute("list", bean.findByCR(CR, 0, 0)); + setJspPageRelative("ordiniView.jsp", req); + callJsp(req, res); + } else if (getCmd(req).equals("creaCodaMsgTimCard")) { + creaCodaMessaggiTimCard(req, res); + } + search(req, res); + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + if (!getAct(req).contains("back")) { + long l_id_esercizio = getRequestLongParameter(req, "id_esercizio"); + if (l_id_esercizio == 0L) + req.setAttribute("id_esercizio", String.valueOf(DBAdapter.getCurrentYear())); + } + req.setAttribute("flgRicercaMag", Long.valueOf(RigaDocumentoCR.RICERCA_SOLO_MAGAZZINO)); + return super.beforeSearch(req, res); + } + + protected void creaCodaMessaggiTimCard(HttpServletRequest req, HttpServletResponse res) { + RigaDocumento bean = new RigaDocumento(getApFull(req)); + RigaDocumentoCR CR = new RigaDocumentoCR(getApFull(req)); + fillObject(req, CR); + CR.setFlgTipoRicerca(1L); + Vectumerator vec = bean.findByCR(CR, 0, 0); + long l_id_templateMsg = getRequestLongParameter(req, "id_templateMsg"); + TemplateMsg ts = new TemplateMsg(getApFull(req)); + ts.findByPrimaryKey(l_id_templateMsg); + String campagna = ts.getDescrizione() + " " + ts.getDescrizione(); + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + if (ts.getFlgTipo() == 1L) + continue; + if (row.getArticolo().getId_tipo() == 271L) { + CodaMessaggi cm = new CodaMessaggi(getApFull(req)); + cm.setFlgTipo(ts.getFlgTipo()); + cm.setCampagna(campagna); + cm.setCellulare(row.getSeriale().trim()); + cm.setTestoMessaggio(ts.getTestoMessaggio()); + cm.save(); + } + } + } + + public void _statoRigaPre(HttpServletRequest req, HttpServletResponse res) { + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + RigaDocumento bean = new RigaDocumento(getApFull(req)); + bean.findByPrimaryKey(l_id_rigaDocumento); + if (getAct(req).equals("reset")) { + bean.setStatoPrenotazione(-1L); + bean.superSave(); + } + long stato = bean.getStatoPrenotazione(); + req.setAttribute("stato", String.valueOf(stato)); + req.setAttribute("statoMsg", bean.getStatoRiga(stato)); + req.setAttribute("id", String.valueOf(l_id_rigaDocumento)); + sendCmdJspFetchPageResponse(req, res); + } + + protected int getPageRow(HttpServletRequest req) { + return 55; + } + + public void _creaReportCsv(HttpServletRequest req, HttpServletResponse res) { + RigaDocumentoCR CR = (RigaDocumentoCR)req.getSession().getAttribute( + getATTR_CRBEAN(req)); + CR.setFlgTipoReport(getRequestLongParameter(req, "flgTipoReport")); + CR.setId_users(getLoginUserId(req).longValue()); + RigaDocumento bean = new RigaDocumento(getApFull(req)); + bean.creaFileCvsMov(CR); + sendHtmlMsgResponse(req, res, "File report in formato cvs (Excel)"); + } + + public void _loadDettaglio4(HttpServletRequest req, HttpServletResponse res) { + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + long l_id_documento = getRequestLongParameter(req, "id_documento"); + long l_id_documento2 = getRequestLongParameter(req, "id_documento2"); + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + MovimentoCR CR = new MovimentoCR(); + CR.setId_articolo(l_id_articolo); + CR.setId_documento(l_id_documento); + CR.setId_documento2(l_id_documento2); + CR.setId_documento(l_id_rigaDocumento); + RigaDocumento bean = new RigaDocumento(getApFull(req)); + req.setAttribute("list1", bean.findOrdiniByArticolo(l_id_articolo)); + req.setAttribute("list2", bean.findMovimentiDiCaricoByArticoloDocumento(l_id_articolo, l_id_documento)); + req.setAttribute("list3", bean.findDettaglioBollaByArticoloDocumento(l_id_articolo, l_id_documento2)); + req.setAttribute("list4", new Movimento(getApFull(req)).findByRigaDocumento(l_id_rigaDocumento)); + req.setAttribute("CR", CR); + showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/TipoAllegatoDocumentoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/TipoAllegatoDocumentoSvlt.java new file mode 100644 index 00000000..999d62a4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/TipoAllegatoDocumentoSvlt.java @@ -0,0 +1,59 @@ +package it.acxent.contab.servlet; + +import it.acxent.contab.TipoAllegatoDocumento; +import it.acxent.contab.TipoAllegatoDocumentoCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.AbMessages; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contabConfig/TipoAllegatoDocumento.abl"}) +public class TipoAllegatoDocumentoSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + TipoAllegatoDocumento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_tipoDocumento"); + bean = new TipoAllegatoDocumento(apFull); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + l_id = bean.getId_tipoAllegatoDocumento(); + req.setAttribute("id_tipoAllegatoDocumento", String.valueOf(l_id)); + req.setAttribute("bean", bean); + if (rp.getStatus() != true) { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, + AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoAllegatoDocumento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoAllegatoDocumentoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/TipoDocumentoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/TipoDocumentoSvlt.java new file mode 100644 index 00000000..853d5b3b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/TipoDocumentoSvlt.java @@ -0,0 +1,198 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.Contatore; +import it.acxent.common.TtFont; +import it.acxent.contab.CausaleMagazzino; +import it.acxent.contab.DocPrel; +import it.acxent.contab.TipoDocumento; +import it.acxent.contab.TipoDocumentoCR; +import it.acxent.contab.TipoStampaDocumento; +import it.acxent.contab.TipologiaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.tex.anag.Lavorazione; +import it.acxent.tex.anag.TipoDocumentoLavorazione; +import it.acxent.util.AbMessages; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contabConfig/TipoDocumento.abl"}) +public class TipoDocumentoSvlt extends AblServletSvlt { + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + TipoDocumento bean = (TipoDocumento)beanA; + req.setAttribute("listaTipologiaDocumento", new TipologiaDocumento(apFull).findAll()); + req.setAttribute("listaTipoStampaDocumento", new TipoStampaDocumento(apFull) + .findByTipologiaDocumento(bean.getId_tipologiaDocumento())); + req.setAttribute("listaCausaliMagazzino", new CausaleMagazzino(apFull).findAll()); + req.setAttribute("listaContatori", new Contatore(apFull).findAll()); + if (bean.getFlgTipologia() != 3L) + req.setAttribute("listaDocumentiPadre", new TipoDocumento(apFull).findAll()); + if (bean.getFlgTipologia() == 4L) { + TipoDocumentoCR CR = new TipoDocumentoCR(); + CR.setFlgTipologie("0,1,2,4,5,100,"); + req.setAttribute("listaDocumentiFiglio", new TipoDocumento(apFull).findByCR(CR, 0, 0)); + } else { + req.setAttribute("listaDocumentiFiglio", new TipoDocumento(apFull).findAll()); + } + req.setAttribute("listaDocPrel", bean.findDocPrel(0L, 0, 0)); + req.setAttribute("listaDocGen", bean.findDocGen(0L, 0L, 0, 0)); + req.setAttribute("listaTtf", TtFont.getInstance(apFull).findAll()); + req.setAttribute("listaLavorazione", new Lavorazione(apFull).findAll()); + req.setAttribute("listaDocumentoLavorazione", new TipoDocumentoLavorazione(apFull).findByTipoDocumento(bean.getId_tipoDocumento())); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipologiaDocumento", new TipologiaDocumento(apFull).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoDocumento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoDocumentoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipologiaDocumento", new TipologiaDocumento(apFull).findAll()); + req.setAttribute("listaCausaliMagazzino", new CausaleMagazzino(apFull).findAll()); + req.setAttribute("listaContatori", new Contatore(apFull).findAll()); + req.setAttribute("listaTtf", TtFont.getInstance(apFull).findAll()); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("list")) { + TipoDocumento bean = new TipoDocumento(getApFull(req)); + TipoDocumentoCR CR = new TipoDocumentoCR(getApFull(req)); + CR.setFlgNascondiNuovo(0L); + req.setAttribute("list", bean.findByCR(CR, 0, 0)); + setJspPageRelative("tipoDocumentoL.jsp", req); + callJsp(req, res); + } else { + super.otherCommands(req, res); + } + } + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + TipoDocumento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_tipoDocumento"); + bean = new TipoDocumento(apFull); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + l_id = bean.getId_tipoDocumento(); + req.setAttribute("id_tipoDocumento", String.valueOf(l_id)); + req.setAttribute("bean", bean); + if (rp.getStatus() == true) { + if (getAct(req).equals("addDocPrel")) { + DocPrel row = new DocPrel(apFull); + if (l_id != 0L) { + fillObject(req, row); + row.setFlgTipoGenerazione(getRequestLongParameter(req, "flgTipoGenerazionePadre")); + rp = bean.addDocPrel(row); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("delDocPrel")) { + DocPrel row = new DocPrel(apFull); + long l_id_docPrel = getRequestLongParameter(req, "id_docPrel"); + if (l_id_docPrel != 0L) { + fillObject(req, row); + bean.delDocPrel(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("addDocFiglio")) { + DocPrel row = new DocPrel(apFull); + if (l_id != 0L) { + fillObject(req, row); + row.setId_tipoDocumentoPrel(row.getId_tipoDocumento()); + row.setId_tipoDocumento(getRequestLongParameter(req, "id_tipoDocumentoFiglio")); + rp = bean.addDocPrel(row); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("delDocPrel")) { + DocPrel row = new DocPrel(apFull); + long l_id_docPrel = getRequestLongParameter(req, "id_docPrel"); + if (l_id_docPrel != 0L) { + fillObject(req, row); + bean.delDocPrel(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } + } else { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + public void _addDocLavorazione(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(true, ""); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + TipoDocumentoLavorazione row = new TipoDocumentoLavorazione(apFull); + fillObject(req, row); + rp = row.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } + + public void _delDocLavorazione(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + TipoDocumentoLavorazione bean = new TipoDocumentoLavorazione(apFull); + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_tipoDocumentoLavorazione"); + bean.findByPrimaryKey(l_id); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + rp = bean.delete(); + if (rp.getStatus()) { + sendMessage(req, "Lavorazione Cancellata"); + } else { + sendMessage(req, "Errore! " + rp.getMsg()); + } + showBean(req, res); + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/TipoStampaDocumentoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/TipoStampaDocumentoSvlt.java new file mode 100644 index 00000000..0aa1129a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/TipoStampaDocumentoSvlt.java @@ -0,0 +1,58 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.Contatore; +import it.acxent.common.TtFont; +import it.acxent.contab.CausaleMagazzino; +import it.acxent.contab.TipoDocumento; +import it.acxent.contab.TipoDocumentoCR; +import it.acxent.contab.TipoStampaDocumento; +import it.acxent.contab.TipoStampaDocumentoCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contabConfig/TipoStampaDocumento.abl"}) +public class TipoStampaDocumentoSvlt extends AblServletSvlt { + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoStampaDocumento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoStampaDocumentoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaCausaliMagazzino", new CausaleMagazzino(apFull) + .findAll()); + req.setAttribute("listaContatori", new Contatore(apFull).findAll()); + req.setAttribute("listaTtf", TtFont.getInstance(apFull).findAll()); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("list")) { + TipoDocumento bean = new TipoDocumento(getApFull(req)); + TipoDocumentoCR CR = new TipoDocumentoCR(getApFull(req)); + CR.setFlgMenu(0L); + req.setAttribute("list", bean.findByCR(CR, 0, 0)); + setJspPageRelative("tipoDocumentoL.jsp", req); + callJsp(req, res); + } else { + super.otherCommands(req, res); + } + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/TipologiaDocumentoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/TipologiaDocumentoSvlt.java new file mode 100644 index 00000000..982be63e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/TipologiaDocumentoSvlt.java @@ -0,0 +1,102 @@ +package it.acxent.contab.servlet; + +import it.acxent.anag.Contatore; +import it.acxent.common.TtFont; +import it.acxent.contab.CausaleMagazzino; +import it.acxent.contab.TipoDocumento; +import it.acxent.contab.TipoDocumentoCR; +import it.acxent.contab.TipoStampaDocumento; +import it.acxent.contab.TipologiaDocumento; +import it.acxent.contab.TipologiaDocumentoCR; +import it.acxent.contab.TipologiaDocumentoTipoStampa; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/contabConfig/TipologiaDocumento.abl"}) +public class TipologiaDocumentoSvlt extends AblServletSvlt { + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + TipologiaDocumento bean = (TipologiaDocumento)beanA; + req.setAttribute("listaTipoStampaDocumento", new TipoStampaDocumento(apFull).findAll()); + req.setAttribute("listaStampeByTipologiaDocumento", bean.findByTipologiaDocumento()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipologiaDocumento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipologiaDocumentoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaCausaliMagazzino", new CausaleMagazzino(apFull).findAll()); + req.setAttribute("listaContatori", new Contatore(apFull).findAll()); + req.setAttribute("listaTtf", TtFont.getInstance(apFull).findAll()); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("list")) { + TipoDocumento bean = new TipoDocumento(getApFull(req)); + TipoDocumentoCR CR = new TipoDocumentoCR(getApFull(req)); + CR.setFlgMenu(0L); + req.setAttribute("list", bean.findByCR(CR, 0, 0)); + setJspPageRelative("tipoDocumentoL.jsp", req); + callJsp(req, res); + } else { + super.otherCommands(req, res); + } + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + public void _initTipologie(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + TipologiaDocumento bean = new TipologiaDocumento(apFull); + ResParm rp = bean.initTipologie(); + sendMessage(req, rp.getMsg()); + search(req, res); + } + + public void _delTipoStampa(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + TipologiaDocumentoTipoStampa bean2 = new TipologiaDocumentoTipoStampa(apFull); + fillObject(req, bean2); + if (bean2.getId_tipologiaDocumentoTipoStampa() > 0L) { + bean2.findByPrimaryKey(bean2.getId_tipologiaDocumentoTipoStampa()); + rp = bean2.delete(); + } else { + rp = new ResParm(false, "Errore! Impossibile cancellare tipo stampa "); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _addTipoStampa(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + TipologiaDocumentoTipoStampa bean2 = new TipologiaDocumentoTipoStampa(apFull); + fillObject(req, bean2); + if (bean2.getId_tipologiaDocumentoTipoStampa() > 0L) + bean2.findByPrimaryKey(bean2.getId_tipologiaDocumentoTipoStampa()); + if (bean2.getId_tipoStampaDocumento() > 0L) { + rp = bean2.save(); + } else { + rp = new ResParm(false, "Errore! Tipo Stampa non selezionata correttamente"); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/_ContabSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/_ContabSvlt.java new file mode 100644 index 00000000..b87a100e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/servlet/_ContabSvlt.java @@ -0,0 +1,101 @@ +package it.acxent.contab.servlet; + +import it.acxent.common.Users; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class _ContabSvlt extends AblServletSvlt { + protected static ApplParmFull ap2; + + protected boolean checkLoginProfile(HttpServletRequest req) { + try { + if (getLoginUser(req) == null) { + forceJspPage(getLoginPage(null, null), req); + return true; + } + if (getLoginUser(req).getFlgValido().equals("N")) { + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return false; + } + if (getLoginUser(req).getId_userProfile() > 0L) + return true; + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return true; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + + protected long getLoginUserGrant(HttpServletRequest req, String l_permesso) { + if (isSecureServlet(req)) + try { + return getLoginUser(req).getGrantType(l_permesso); + } catch (Exception e) { + handleDebug(e); + return 0L; + } + return 4L; + } + + protected String getAct3(HttpServletRequest req) { + return getRequestParameter(req, "act3"); + } + + protected String getCmd3(HttpServletRequest req) { + return getRequestParameter(req, "cmd3"); + } + + protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) { + return super.getLoginPage(req, res); + } + + protected Users getUser(HttpServletRequest req) { + return new it.acxent.anag.Users(getApFull(req)); + } + + protected boolean useAlwaysSendRedirect() { + return true; + } + + protected ApplParmFull getAp2() { + if (ap2 == null) { + ApplParmFull apFull = getApFull(); + ApplParm apx = new ApplParm(apFull.getParm("DBDRIVER2").getNumeroInt(), apFull.getParm("DBNAME2").getTesto(), + apFull.getParm("USER2").getTesto(), apFull.getParm("PASSWORD2").getTesto()); + ap2 = new ApplParmFull(apx); + } + return ap2; + } + + protected long getId_docCassa() { + return getParm("ID_DOC_CASSA").getNumeroLong(); + } + + protected long getId_docOrdine() { + return getParm("ID_DOC_ORDINE").getNumeroLong(); + } + + protected long getId_docPrenotazione() { + return getParm("ID_DOC_PRENOTAZIONE").getNumeroLong(); + } + + protected long getId_docRiparazione() { + return getParm("ID_DOC_RIPARAZIONE").getNumeroLong(); + } + + protected long getId_docOrdineWww() { + return getParm("ID_DOC_ORDINE_WWW").getNumeroLong(); + } + + protected long getId_docRicevuta() { + return getParm("ID_DOC_RICEVUTA").getNumeroLong(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/taglib/TipoDocumentoTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/taglib/TipoDocumentoTag.java new file mode 100644 index 00000000..2637589f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/taglib/TipoDocumentoTag.java @@ -0,0 +1,67 @@ +package it.acxent.contab.taglib; + +import it.acxent.contab.TipoDocumento; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.text.NumberFormat; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; + +public class TipoDocumentoTag extends AbstractDbTag { + private String rowbeanname; + + private NumberFormat nf; + + private Vectumerator theList; + + public int doAfterBody() throws JspException { + try { + if (this.theList.hasMoreElements()) { + TipoDocumento row = (TipoDocumento)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("nf", getNf()); + this.pageContext.setAttribute("idx", String.valueOf( + this.theList.getIndex())); + return 2; + } + String body = getBodyContent().getString(); + this.bodyContent.getEnclosingWriter().print(body); + return 0; + } catch (IOException ex) { + throw new JspTagException(ex.toString()); + } + } + + public int doStartTag() { + this.theList = new TipoDocumento(getApFull()).findMenu(); + if (this.theList == null) + return 0; + this.theList.moveFirst(); + if (this.theList.hasMoreElements()) { + TipoDocumento row = (TipoDocumento)this.theList.nextElement(); + this.pageContext.setAttribute(getRowbeanname(), row); + this.pageContext.setAttribute("nf", getNf()); + this.pageContext.setAttribute("idx", String.valueOf(this.theList.getIndex())); + return 2; + } + return 0; + } + + public String getRowbeanname() { + return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname; + } + + public void setRowbeanname(String s) { + this.rowbeanname = s; + } + + public NumberFormat getNf() { + if (this.nf == null) { + this.nf = NumberFormat.getInstance(); + this.nf.setMaximumFractionDigits(2); + this.nf.setMinimumFractionDigits(2); + } + return this.nf; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/taglib/TipoDocumentoTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/taglib/TipoDocumentoTagExtraInfo.java new file mode 100644 index 00000000..09dde341 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/taglib/TipoDocumentoTagExtraInfo.java @@ -0,0 +1,15 @@ +package it.acxent.contab.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class TipoDocumentoTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? + tagdata.getAttributeString("rowbeanname") : + "rowBean"; + String rowBeanClass = "it.acxent.contab.TipoDocumento"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("nf", "java.text.NumberFormat", true, 0), new VariableInfo("idx", "java.lang.String", true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/xDocFiglioPadre.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/xDocFiglioPadre.java new file mode 100644 index 00000000..62ff0c05 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/xDocFiglioPadre.java @@ -0,0 +1,154 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class xDocFiglioPadre extends _ContabAdapter implements Serializable { + private long id_documentoPadre; + + private long id_documentoFiglio; + + private Documento documentoPadre; + + private Documento documentoFiglio; + + private long id_docFiglioPadre; + + public xDocFiglioPadre(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public xDocFiglioPadre() {} + + public void setId_documentoPadre(long newId_documentoPadre) { + this.id_documentoPadre = newId_documentoPadre; + setDocumentoPadre(null); + } + + public void setId_documentoFiglio(long newId_documentoFiglio) { + this.id_documentoFiglio = newId_documentoFiglio; + setDocumentoFiglio(null); + } + + public long getId_documentoPadre() { + return this.id_documentoPadre; + } + + public long getId_documentoFiglio() { + return this.id_documentoFiglio; + } + + public void setDocumentoPadre(Documento newDocumentoPadre) { + this.documentoPadre = newDocumentoPadre; + } + + public Documento getDocumentoPadre() { + this.documentoPadre = (Documento)getSecondaryObject(this.documentoPadre, Documento.class, + getId_documentoPadre()); + return this.documentoPadre; + } + + public void setDocumentoFiglio(Documento newDocumentoFiglio) { + this.documentoFiglio = newDocumentoFiglio; + } + + public Documento getDocumentoFiglio() { + this.documentoFiglio = (Documento)getSecondaryObject(this.documentoFiglio, Documento.class, + getId_documentoFiglio()); + return this.documentoFiglio; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(xDocFiglioPadreCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from DOC_FIGLIO_PADRE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByDocumentoPadre(long l_id_documentoPadre) { + String s_Sql_Find = "select A.* from DOC_FIGLIO_PADRE AS A, DOCUMENTO as B"; + String s_Sql_Order = " order by B.id_esercizio, B.progDocumento"; + WcString wc = new WcString(); + wc.addWc("A.id_documentoFiglio=B.id_documento"); + wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByDocumentoFiglioPadre(long l_id_documentoFiglio, long l_id_documentoPadre) { + String s_Sql_Find = "select A.* from DOC_FIGLIO_PADRE AS A"; + WcString wc = new WcString(); + wc.addWc("A.id_documentoFiglio=" + l_id_documentoFiglio); + wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public long getId_docFiglioPadre() { + return this.id_docFiglioPadre; + } + + public void setId_docFiglioPadre(long id_docFiglioPadre) { + this.id_docFiglioPadre = id_docFiglioPadre; + } + + public void findByDocumentoPadreTipoFiglio(long l_id_documentoPadre, long l_id_tipoDocumentoFiglio) { + String s_Sql_Find = "select A.* from DOC_FIGLIO_PADRE AS A, DOCUMENTO AS B"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_documentoFiglio=B.id_documento"); + wc.addWc("A.id_documentoPadre=" + l_id_documentoPadre); + wc.addWc("B.id_tipoDocumento=" + l_id_tipoDocumentoFiglio); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public Vectumerator findByDocumentoFiglio(long l_id_documentoFiglio) { + String s_Sql_Find = "select A.* from DOC_FIGLIO_PADRE AS A, DOCUMENTO as B"; + String s_Sql_Order = " order by B.id_esercizio, B.progDocumento"; + WcString wc = new WcString(); + wc.addWc("A.id_documentoPadre=B.id_documento"); + wc.addWc("A.id_documentoFiglio=" + l_id_documentoFiglio); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/xDocFiglioPadreCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/xDocFiglioPadreCR.java new file mode 100644 index 00000000..686d1981 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/contab/xDocFiglioPadreCR.java @@ -0,0 +1,81 @@ +package it.acxent.contab; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Timestamp; + +public class xDocFiglioPadreCR extends CRAdapter { + private long id_documentoPadre; + + private long id_documentoFiglio; + + private long lastUpdId_user; + + private Timestamp lastUpdTmst; + + private Documento documentoPadre; + + private Documento documentoFiglio; + + public xDocFiglioPadreCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public xDocFiglioPadreCR() {} + + public void setId_documentoPadre(long newId_documentoPadre) { + this.id_documentoPadre = newId_documentoPadre; + setDocumentoPadre(null); + } + + public void setId_documentoFiglio(long newId_documentoFiglio) { + this.id_documentoFiglio = newId_documentoFiglio; + setDocumentoFiglio(null); + } + + public void setLastUpdId_user(long newLastUpdId_user) { + this.lastUpdId_user = newLastUpdId_user; + } + + public void setLastUpdTmst(Timestamp newLastUpdTmst) { + this.lastUpdTmst = newLastUpdTmst; + } + + public long getId_documentoPadre() { + return this.id_documentoPadre; + } + + public long getId_documentoFiglio() { + return this.id_documentoFiglio; + } + + public long getLastUpdId_user() { + return this.lastUpdId_user; + } + + public Timestamp getLastUpdTmst() { + return this.lastUpdTmst; + } + + public void setDocumentoPadre(Documento newDocumentoPadre) { + this.documentoPadre = newDocumentoPadre; + } + + public Documento getDocumentoPadre() { + this.documentoPadre = (Documento)getSecondaryObject(this.documentoPadre, Documento.class, + + getId_documentoPadre()); + return this.documentoPadre; + } + + public void setDocumentoFiglio(Documento newDocumentoFiglio) { + this.documentoFiglio = newDocumentoFiglio; + } + + public Documento getDocumentoFiglio() { + this.documentoFiglio = (Documento)getSecondaryObject(this.documentoFiglio, Documento.class, + + getId_documentoFiglio()); + return this.documentoFiglio; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEAllegatiInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEAllegatiInterface.java new file mode 100644 index 00000000..c2c44c68 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEAllegatiInterface.java @@ -0,0 +1,13 @@ +package it.acxent.fattele; + +public interface FEAllegatiInterface { + String getFENomeAttachment(); + + String getFEAlgoritmoCompressione(); + + String getFEFormatoAttachment(); + + String getFEDescrizioneAttachment(); + + String getFEFileAttachment(); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiAnagraficiInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiAnagraficiInterface.java new file mode 100644 index 00000000..b07ec6bc --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiAnagraficiInterface.java @@ -0,0 +1,21 @@ +package it.acxent.fattele; + +public interface FEDatiAnagraficiInterface { + String getFEPartitaIva(); + + String getFECodiceFiscale(); + + String getFEDenominazione(); + + String getFECognome(); + + String getFENome(); + + String getFETitolo(); + + String getFECodEORI(); + + String getFEPaese(); + + boolean isFEPaeseCEE(); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiDDT.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiDDT.java new file mode 100644 index 00000000..9ba6d8fc --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiDDT.java @@ -0,0 +1,43 @@ +package it.acxent.fattele; + +import java.sql.Date; + +public class FEDatiDDT { + private String numero; + + private long numLinea; + + private Date data; + + public FEDatiDDT(String numero, Date data, long numLinea) { + this.numero = numero; + this.data = data; + this.numLinea = numLinea; + } + + public FEDatiDDT() {} + + public String getNumero() { + return (this.numero == null) ? "" : this.numero.trim(); + } + + public void setNumero(String numero) { + this.numero = numero; + } + + public long getNumLinea() { + return this.numLinea; + } + + public void setNumLinea(long numLinea) { + this.numLinea = numLinea; + } + + public Date getData() { + return this.data; + } + + public void setData(Date data) { + this.data = data; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiPagamento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiPagamento.java new file mode 100644 index 00000000..7c14cce2 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiPagamento.java @@ -0,0 +1,25 @@ +package it.acxent.fattele; + +import it.acxent.util.Vectumerator; + +public class FEDatiPagamento { + private String condizioniPagamento; + + private Vectumerator vecDettaglioPagamento; + + public String getCondizioniPagamento() { + return (this.condizioniPagamento == null) ? "" : this.condizioniPagamento.trim(); + } + + public void setCondizioniPagamento(String condizioniPagamento) { + this.condizioniPagamento = condizioniPagamento; + } + + public Vectumerator getVecDettaglioPagamento() { + return this.vecDettaglioPagamento; + } + + public void setVecDettaglioPagamento(Vectumerator vecDettaglioPagamento) { + this.vecDettaglioPagamento = vecDettaglioPagamento; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiRiepilogo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiRiepilogo.java new file mode 100644 index 00000000..2d82786d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiRiepilogo.java @@ -0,0 +1,93 @@ +package it.acxent.fattele; + +public class FEDatiRiepilogo implements FEDatiRiepilogoInterface { + private double fEAliquotaIva; + + private String fENatura; + + private double fESpeseAccessorie; + + private double fEArrotondamento; + + private double fEImposta; + + private double fEImponibileImporto; + + private String fEEsigibilitaIva; + + private String fERiferimentoNormativo; + + public FEDatiRiepilogo(double fEImponibileImporto, double fEImposta, double fEAliquotaIva, String fERiferimentoNormativo, String fENatura) { + this.fEImponibileImporto = fEImponibileImporto; + this.fEImposta = fEImposta; + this.fEAliquotaIva = fEAliquotaIva; + this.fERiferimentoNormativo = fERiferimentoNormativo; + this.fENatura = fENatura; + } + + public FEDatiRiepilogo() {} + + public double getFEAliquotaIva() { + return this.fEAliquotaIva; + } + + public String getFENatura() { + return (this.fENatura == null) ? "" : this.fENatura; + } + + public double getFESpeseAccessorie() { + return this.fESpeseAccessorie; + } + + public double getFEArrotondamento() { + return this.fEArrotondamento; + } + + public double getFEImponibileImporto() { + return this.fEImponibileImporto; + } + + public double getFEImposta() { + return this.fEImposta; + } + + public String getFEEsigibilitaIva() { + return (this.fEEsigibilitaIva == null) ? "" : this.fEEsigibilitaIva.trim(); + } + + public String getFERiferimentoNormativo() { + return (this.fERiferimentoNormativo == null) ? "" : this.fERiferimentoNormativo.trim(); + } + + public void setFEAliquotaIva(double fEAliquotaIva) { + this.fEAliquotaIva = fEAliquotaIva; + } + + public void setFENatura(String fENatura) { + this.fENatura = fENatura; + } + + public void setfESpeseAccessorie(double fESpeseAccessorie) { + this.fESpeseAccessorie = fESpeseAccessorie; + } + + public void setFEArrotondamento(double fEArrotondamento) { + this.fEArrotondamento = fEArrotondamento; + } + + public void setFEImposta(double gfEImposta) { + this.fEImposta = gfEImposta; + } + + public void setFEEsigibilitaIva(String fEEsigibilitaIva) { + this.fEEsigibilitaIva = fEEsigibilitaIva; + } + + public void setFERiferimentoNormativo(String fERiferimentoNormativo) { + this.fERiferimentoNormativo = fERiferimentoNormativo; + } + + public void setFEImponibileImporto(double fEImponibileImporto) { + this.fEImponibileImporto = fEImponibileImporto; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiRiepilogoInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiRiepilogoInterface.java new file mode 100644 index 00000000..abf4db4e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiRiepilogoInterface.java @@ -0,0 +1,21 @@ +package it.acxent.fattele; + +public interface FEDatiRiepilogoInterface { + double getFEAliquotaIva(); + + String getFENatura(); + + double getFESpeseAccessorie(); + + double getFEArrotondamento(); + + double getFEImponibileImporto(); + + double getFEImposta(); + + String getFEEsigibilitaIva(); + + void setFEEsigibilitaIva(String paramString); + + String getFERiferimentoNormativo(); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiRitenutaInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiRitenutaInterface.java new file mode 100644 index 00000000..8f46a144 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiRitenutaInterface.java @@ -0,0 +1,3 @@ +package it.acxent.fattele; + +public interface FEDatiRitenutaInterface {} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiTrasportoInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiTrasportoInterface.java new file mode 100644 index 00000000..30e39e55 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDatiTrasportoInterface.java @@ -0,0 +1,34 @@ +package it.acxent.fattele; + +import java.sql.Date; +import java.sql.Time; + +public interface FEDatiTrasportoInterface { + FEDatiAnagraficiInterface getFEDatiTrasportoAnagraficiVettore(); + + String getFEDatiTrasportoInterfaceNumeroLicenzaGuida(); + + String getFEDatiTrasportoMezzoTrasporto(); + + String getFEDatiTrasportoCausaleTrasporto(); + + long getFEDatiTrasportoNumeroColli(); + + String getFEDatiTrasportoDescrizione(); + + String getFEDatiTrasportoUnitaMisuraPeso(); + + double getFEDatiTrasportoPesoLordo(); + + double getFEDatiTrasportoPesoNetto(); + + Time getFEDatiTrasportoDataOraRitiro(); + + Date getFEDatiTrasportoDataInizioTrasporto(); + + String getFEDatiTrasportoTipoResa(); + + FESedeInterface getFEDatiTrasportoIndirizzoResa(); + + Time getFEDatiTrasportoDataOraConsegna(); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDettaglioLinea.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDettaglioLinea.java new file mode 100644 index 00000000..07bd1508 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDettaglioLinea.java @@ -0,0 +1,182 @@ +package it.acxent.fattele; + +import it.acxent.util.Vectumerator; +import java.sql.Date; + +public class FEDettaglioLinea implements FEDettaglioLineeInterface, Cloneable { + private String fETipoCessionePrestazione; + + private String fECodiceArticoloTipo; + + private String fECodiceArticoloValore; + + private String fEDescrizione; + + private double fEQuantita; + + private String fEUnitaMisura; + + private Date fEDataInizioPeriodo; + + private Date fEDataFinePeriodo; + + private double fEPrezzoUnitario; + + private Vectumerator fEScontoMaggiorazione; + + private double fEPrezzoTotale; + + private double fEAliquotaIva; + + private double fERitenuta; + + private String fENatura; + + private String fERiferimentoAmministrazione; + + private double fECostoArticolo; + + public FEDettaglioLinea(String fETipoCessionePrestazione, String fEDescrizione, double fEQuantita, double fEPrezzoUnitario, double fEPrezzoTotale, double fEAliquotaIva, String fENatura) { + this.fETipoCessionePrestazione = fETipoCessionePrestazione; + this.fEDescrizione = fEDescrizione; + this.fEQuantita = fEQuantita; + this.fEPrezzoUnitario = fEPrezzoUnitario; + this.fEPrezzoTotale = fEPrezzoTotale; + this.fEAliquotaIva = fEAliquotaIva; + this.fENatura = fENatura; + } + + public FEDettaglioLinea() {} + + public void setFEQuantita(double fEQuantita) { + this.fEQuantita = fEQuantita; + } + + public void setFERiferimentoAmministrazione(String fERiferimentoAmministrazione) { + this.fERiferimentoAmministrazione = fERiferimentoAmministrazione; + } + + public void setFETipoCessionePrestazione(String fETipoCessionePrestazione) { + this.fETipoCessionePrestazione = fETipoCessionePrestazione; + } + + public void setFECodiceArticoloTipo(String fECodiceArticoloTipo) { + this.fECodiceArticoloTipo = fECodiceArticoloTipo; + } + + public void setFECodiceArticoloValore(String fECodiceArticoloValore) { + this.fECodiceArticoloValore = fECodiceArticoloValore; + } + + public void setFEDescrizione(String fEDescrizione) { + this.fEDescrizione = fEDescrizione; + } + + public void setFEUnitaMisura(String fEUnitaMisura) { + this.fEUnitaMisura = fEUnitaMisura; + } + + public void setFEDataInizioPeriodo(Date fEDataInizioPeriodo) { + this.fEDataInizioPeriodo = fEDataInizioPeriodo; + } + + public void setFEDataFinePeriodo(Date fEDataFinePeriodo) { + this.fEDataFinePeriodo = fEDataFinePeriodo; + } + + public void setFEPrezzoUnitario(double fEPrezzoUnitario) { + this.fEPrezzoUnitario = fEPrezzoUnitario; + } + + public void setFEScontoMaggiorazione(Vectumerator fEScontoMaggiorazione) { + this.fEScontoMaggiorazione = fEScontoMaggiorazione; + } + + public void setFECostoArticolo(double fECostoArticolo) { + this.fECostoArticolo = fECostoArticolo; + } + + public void setFEAliquotaIva(double fEAliquotaIva) { + this.fEAliquotaIva = fEAliquotaIva; + } + + public void setFERitenuta(double fERitenuta) { + this.fERitenuta = fERitenuta; + } + + public void setFENatura(String fENatura) { + this.fENatura = fENatura; + } + + public String getFETipoCessionePrestazione() { + return this.fETipoCessionePrestazione; + } + + public String getFECodiceArticoloTipo() { + return this.fECodiceArticoloTipo; + } + + public String getFECodiceArticoloValore() { + return this.fECodiceArticoloValore; + } + + public String getFEDescrizione() { + return this.fEDescrizione; + } + + public double getFEQuantita() { + return this.fEQuantita; + } + + public String getFEUnitaMisura() { + return this.fEUnitaMisura; + } + + public Date getFEDataInizioPeriodo() { + return this.fEDataInizioPeriodo; + } + + public Date getFEDataFinePeriodo() { + return this.fEDataFinePeriodo; + } + + public double getFEPrezzoUnitario() { + return this.fEPrezzoUnitario; + } + + public Vectumerator getFEScontoMaggiorazione() { + return this.fEScontoMaggiorazione; + } + + public double getFEPrezzoTotale() { + return this.fEPrezzoTotale; + } + + public double getFEAliquotaIva() { + return this.fEAliquotaIva; + } + + public double getFERitenuta() { + return this.fERitenuta; + } + + public String getFENatura() { + return this.fENatura; + } + + public String getFERiferimentoAmministrazione() { + return this.fERiferimentoAmministrazione; + } + + public double getFECostoArticolo() { + return this.fECostoArticolo; + } + + protected Object clone() throws CloneNotSupportedException { + return super.clone(); + } + + public void setFEPrezzoTotale(double fEPrezzoTotale) { + this.fEPrezzoTotale = fEPrezzoTotale; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDettaglioLineeInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDettaglioLineeInterface.java new file mode 100644 index 00000000..bad597e9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDettaglioLineeInterface.java @@ -0,0 +1,38 @@ +package it.acxent.fattele; + +import it.acxent.util.Vectumerator; +import java.sql.Date; + +public interface FEDettaglioLineeInterface { + String getFETipoCessionePrestazione(); + + String getFECodiceArticoloTipo(); + + String getFECodiceArticoloValore(); + + String getFEDescrizione(); + + double getFEQuantita(); + + String getFEUnitaMisura(); + + Date getFEDataInizioPeriodo(); + + Date getFEDataFinePeriodo(); + + double getFEPrezzoUnitario(); + + Vectumerator getFEScontoMaggiorazione(); + + double getFEPrezzoTotale(); + + double getFECostoArticolo(); + + double getFEAliquotaIva(); + + double getFERitenuta(); + + String getFENatura(); + + String getFERiferimentoAmministrazione(); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDettaglioPagamento.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDettaglioPagamento.java new file mode 100644 index 00000000..0a3e6834 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDettaglioPagamento.java @@ -0,0 +1,95 @@ +package it.acxent.fattele; + +import java.sql.Date; + +public class FEDettaglioPagamento { + private String beneficiario; + + private String modalitaPagamento; + + private Date dataScadenzaPagamento; + + private double importoPagamento; + + private String istitutoFinanziario; + + private String IBAN; + + private String ABI; + + private String CAB; + + private String BIC; + + public String getBeneficiario() { + return (this.beneficiario == null) ? "" : this.beneficiario.trim(); + } + + public void setBeneficiario(String beneficiario) { + this.beneficiario = beneficiario; + } + + public String getModalitaPagamento() { + return (this.modalitaPagamento == null) ? "" : this.modalitaPagamento.trim(); + } + + public void setModalitaPagamento(String modalitaPagamento) { + this.modalitaPagamento = modalitaPagamento; + } + + public Date getDataScadenzaPagamento() { + return this.dataScadenzaPagamento; + } + + public void setDataScadenzaPagamento(Date dataScadenzaPagamento) { + this.dataScadenzaPagamento = dataScadenzaPagamento; + } + + public double getImportoPagamento() { + return this.importoPagamento; + } + + public void setImportoPagamento(double importoPagamento) { + this.importoPagamento = importoPagamento; + } + + public String getIstitutoFinanziario() { + return (this.istitutoFinanziario == null) ? "" : this.istitutoFinanziario.trim(); + } + + public void setIstitutoFinanziario(String istitutoFinanziario) { + this.istitutoFinanziario = istitutoFinanziario; + } + + public String getIBAN() { + return (this.IBAN == null) ? "" : this.IBAN.trim(); + } + + public void setIBAN(String iBAN) { + this.IBAN = iBAN; + } + + public String getABI() { + return (this.ABI == null) ? "" : this.ABI.trim(); + } + + public void setABI(String aBI) { + this.ABI = aBI; + } + + public String getCAB() { + return (this.CAB == null) ? "" : this.CAB.trim(); + } + + public void setCAB(String cAB) { + this.CAB = cAB; + } + + public String getBIC() { + return (this.BIC == null) ? "" : this.BIC.trim(); + } + + public void setBIC(String bIC) { + this.BIC = bIC; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDettaglioPagamentoInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDettaglioPagamentoInterface.java new file mode 100644 index 00000000..419b486a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEDettaglioPagamentoInterface.java @@ -0,0 +1,3 @@ +package it.acxent.fattele; + +public interface FEDettaglioPagamentoInterface {} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEScontoMaggiorazione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEScontoMaggiorazione.java new file mode 100644 index 00000000..f6a632f5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEScontoMaggiorazione.java @@ -0,0 +1,41 @@ +package it.acxent.fattele; + +public class FEScontoMaggiorazione implements FEScontoMaggiorazioneInterface { + private String fETipoScontoMagg; + + private double fEPercentualeScontoMagg; + + private double fEImportoScontoMagg; + + public FEScontoMaggiorazione(String fETipoScontoMagg, double fEPercentualeScontoMagg, double fEImportoScontoMagg) { + this.fETipoScontoMagg = fETipoScontoMagg; + this.fEPercentualeScontoMagg = fEPercentualeScontoMagg; + this.fEImportoScontoMagg = fEImportoScontoMagg; + } + + public FEScontoMaggiorazione() {} + + public String getFETipoScontoMagg() { + return this.fETipoScontoMagg; + } + + public double getFEPercentualeScontoMagg() { + return this.fEPercentualeScontoMagg; + } + + public double getFEImportoScontoMagg() { + return this.fEImportoScontoMagg; + } + + public void setFETipoScontoMagg(String fETipoScontoMagg) { + this.fETipoScontoMagg = fETipoScontoMagg; + } + + public void setFEPercentualeScontoMagg(double fEPercentualeScontoMagg) { + this.fEPercentualeScontoMagg = fEPercentualeScontoMagg; + } + + public void setFEImportoScontoMagg(double fEImportoScontoMagg) { + this.fEImportoScontoMagg = fEImportoScontoMagg; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEScontoMaggiorazioneInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEScontoMaggiorazioneInterface.java new file mode 100644 index 00000000..04f0cc5b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FEScontoMaggiorazioneInterface.java @@ -0,0 +1,9 @@ +package it.acxent.fattele; + +public interface FEScontoMaggiorazioneInterface { + String getFETipoScontoMagg(); + + double getFEPercentualeScontoMagg(); + + double getFEImportoScontoMagg(); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FESedeInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FESedeInterface.java new file mode 100644 index 00000000..ffe4c155 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FESedeInterface.java @@ -0,0 +1,15 @@ +package it.acxent.fattele; + +public interface FESedeInterface { + String getFEIndirizzo(); + + String getFENumeroCivico(); + + String getFECAP(); + + String getFEComune(); + + String getFEProvincia(); + + String getFENazione(); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FatturaElettronicaInterface.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FatturaElettronicaInterface.java new file mode 100644 index 00000000..93c8c303 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FatturaElettronicaInterface.java @@ -0,0 +1,121 @@ +package it.acxent.fattele; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.util.Vectumerator; +import java.sql.Date; +import java.sql.Timestamp; + +public interface FatturaElettronicaInterface { + boolean isFatturaElettronicaGenerabile(); + + ResParm setFEAggiornaTmstFileXml(); + + String getDocBase(); + + String getPathTmp(); + + ApplParmFull getApFull(); + + String getFEParmSfx(); + + String getFECodiceDestinatario(); + + FEDatiAnagraficiInterface getFEDatiAnagraficiCessionario(); + + String getFEPecDestinatario(); + + String getFEProgressivo(); + + String getFEDivisa(); + + String getFENumeroDocumento(); + + double getFEImportoTotaleDocumento(); + + double getFEArrotondamento(); + + String getFECausale(); + + boolean isFEArt73(); + + Vectumerator getFEScontoMaggiorazione(); + + Vectumerator getFEDatiPagamento(); + + String getFETipoDocumento(); + + String getFEDatiOrdineAcquistoRifNumLinea(); + + String getFEDatiOrdineAcquistoNumItem(); + + String getFEDatiOrdineAcquistoCodCommessaConv(); + + String getFEDatiOrdineAcquistoCodiceCUP(); + + String getFEDatiOrdineAcquistoCodiceCIG(); + + String getFEDatiOrdineAcquistoIdDocumento(); + + Date getFEDatiOrdineAcquistoData(); + + String getFEDatiSALRiferimentoFase(); + + Vectumerator getFEDatiDDT(); + + FESedeInterface getFESedeCessonario(); + + FESedeInterface getFEStabileOrg(); + + String getFERappFiscaleIdPaese(); + + String getFERappFiscalepartitaIva(); + + String getFERappFiscaleCodiceFiscale(); + + String getFERappFiscaleDenominazione(); + + String getFERappFiscaleNome(); + + String getFERappFiscaleCognome(); + + String getFERappFiscaleTitolo(); + + String getFERappFiscaleCodEORI(); + + boolean isPubblicaAmministrazione(); + + Date getFeDataDocumento(); + + FEDatiRitenutaInterface getFeDatiRitenuta(); + + FEDatiTrasportoInterface getFEDatiTrasporto(); + + Vectumerator getFEDettaglioLinee(); + + Vectumerator getFEDettaglioLineeAltre(); + + Vectumerator getFEDatiRiepilogo(); + + FEAllegatiInterface getFEAllegatiInterface(); + + String getFeBolloVirtuale(); + + double getFEImportoBollo(); + + String getFEProgressivoFile(); + + String getFELinkXml(String paramString); + + Timestamp getTmstFileXml(); + + Timestamp getTmstInvioXml(); + + String getFERiferimentoTipoDato(); + + String getFERiferimentoTesto(); + + double getFERiferimentoNumero(); + + Date getFERiferimentoData(); +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FeXml.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FeXml.java new file mode 100644 index 00000000..dcdb9dab --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/FeXml.java @@ -0,0 +1,1698 @@ +package it.acxent.fattele; + +import it.acxent.anag.Iva; +import it.acxent.common.StatusMsg; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.DoubleOperator; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.io.FileOutputStream; +import java.text.DecimalFormat; +import java.text.NumberFormat; +import java.util.Calendar; +import java.util.Locale; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import javax.xml.validation.Validator; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +public class FeXml extends _FeXmlAdapter { + private boolean isBuildOk = false; + + private static final String TAG_BUILD_FE_XML = "Xml fatt. elett."; + + private FatturaElettronicaInterface fattura; + + private Vectumerator vecFatture; + + private Document dom; + + private Element rootElement; + + private SimpleDateFormat df; + + private DecimalFormat nf; + + public static final String REGIMI_FISCALI_VALIDI = ",RF01,RF02,RF04,RF05R,F06,RF07,RF08,RF09,RF10,RF11,RF12,RF13,RF14,RF15,RF16,RF17,RF18,RF19,"; + + public static final String TIPO_CASSA_VALIDI = ",TC01,TC02,TC04,TC05R,TC06,TC07,TC08,TC09,TC10,TC11,TC12,TC13,TC14,TC15,TC16,TC17,TC18,TC19,TC20,TC21,TC22,"; + + public static final String TIPO_SCONTO_MAGGIORAZIONE_VALIDI = ",SC,MG,"; + + public static final String TIPO_SCONTO_MAGGIORAZIONE_SCONTO = "SC"; + + public static final String TIPO_SCONTO_MAGGIORAZIONE_MAGGIORAZIONE = "MG"; + + public static final String TIPO_TRASMISSIONE_VERSO_PA = "FPA12"; + + public static final String TIPO_TRASMISSIONE_VERSO_PRIVATI = "FPR12"; + + public static final String TIPO_DOCUMENTO_01_FATTURA = "TD01"; + + public static final String TIPO_DOCUMENTO_02_ACCONTO_ANTICIPO_SU_FATTURA = "TD02"; + + public static final String TIPO_DOCUMENTO_03_ACCONTO_ANTICIPO_SU_PARCELLA = "TD03"; + + public static final String TIPO_DOCUMENTO_04_NOTA_DI_CREDITO = "TD04"; + + public static final String TIPO_DOCUMENTO_05_NOTA_DI_DEBITO = "TD05"; + + public static final String TIPO_DOCUMENTO_06_PARCELLA = "TD06"; + + public static final String TIPO_DOCUMENTO_16_INTEG_FT_REV_CHARGE_INT = "TD16"; + + public static final String TIPO_DOCUMENTO_17_INTEG_AUTOFAT_ACQ_SERV_ESTERO = "TD17"; + + public static final String TIPO_DOCUMENTO_18_INTEG_ACQ_BENI_INTRAC = "TD18"; + + public static final String TIPO_DOCUMENTO_19_INTEG_AUTOF_ACQ_ART17 = "TD19"; + + public static final String TIPO_DOCUMENTO_20_AUTOFATTURA = "TD20"; + + public static final String TIPO_DOCUMENTO_21_AUTOF_SPLAFONAMENTO = "TD21"; + + public static final String TIPO_DOCUMENTO_22_ESTRAZ_DA_DEPOSITO_IVA = "TD22"; + + public static final String TIPO_DOCUMENTO_23_ESTRAZ_DA_DEPOSITO_CON_VERSAMENTO = "TD23"; + + public static final String TIPO_DOCUMENTO_24_FATT_DIFF_ART_21_A_DPR_633_72 = "TD24"; + + public static final String TIPO_DOCUMENTO_25_FATT_DIFF_ART_21_B_DPR_633_72 = "TD25"; + + public static final String TIPO_DOCUMENTO_26_CESS_BENI_AMMORT = "TD26"; + + public static final String TIPO_DOCUMENTO_27_FATT_AUTOCONSUMO = "TD27"; + + public static final String IVA_TIPO_NATURA_VALIDI = ",N1,N2.1,N2.2,N3.1,N3.2,N3.3,N3.4,N3.5,N3.6,N4,N5,N6.1,N6.2,N6.3,N6.4,N6.5,N6.6,N6.7,N6.8,N6.9,N7,"; + + public static final String IVA_TIPO_NATURA_N1_ESCL_ART_15 = "N1"; + + public static final String IVA_TIPO_NATURA_N2_NON_SOGGETTO_NON_VALIDO_2021 = "N2"; + + public static final String IVA_TIPO_NATURA_N2_1_NON_SOGGETTO_ART_7 = "N2.1"; + + public static final String IVA_TIPO_NATURA_N2_2_NON_SOGGETTO_ALTRE = "N2.2"; + + public static final String IVA_TIPO_NATURA_N3_NON_IMPONIBILI_NON_VALIDO_2021 = "N3"; + + public static final String IVA_TIPO_NATURA_N3_1_NON_IMPONIBILI_ESPORTAZIONI = "N3.1"; + + public static final String IVA_TIPO_NATURA_N3_2_NON_IMPONIBILI_CESSIONI_INTRA = "N3.2"; + + public static final String IVA_TIPO_NATURA_N3_3_NON_IMPONIBILI_CESSIONI_S_MARINO = "N3.3"; + + public static final String IVA_TIPO_NATURA_N3_4_NON_IMPONIBILI_ASSIMILATE_CESS_ESP = "N3.4"; + + public static final String IVA_TIPO_NATURA_N3_5_NON_IMPONIBILI_DICHIARAZIONI_INTENTO = "N3.5"; + + public static final String IVA_TIPO_NATURA_N3_6_NON_IMPONIBILI_NON_CONCORRONO_PLAFOND = "N3.6"; + + public static final String IVA_TIPO_NATURA_N4_ESENTI = "N4"; + + public static final String IVA_TIPO_NATURA_N5_REGIME_DEL_MARGINE_IVA_NON_ESPOSTA = "N5"; + + public static final String IVA_TIPO_NATURA_N6_INVERSIONE_CONTABILE_NON_VALIDO_2021 = "N6"; + + public static final String IVA_TIPO_NATURA_N6_1_INVERSIONE_CONTABILE_ROTTAMI = "N6.1"; + + public static final String IVA_TIPO_NATURA_N6_2_INVERSIONE_CONTABILE_ORO_ARGENTO = "N6.2"; + + public static final String IVA_TIPO_NATURA_N6_3_INVERSIONE_CONTABILE_SUBAPPALTO_EDILE = "N6.3"; + + public static final String IVA_TIPO_NATURA_N6_4_INVERSIONE_CONTABILE_CESS_FABBRICATI = "N6.4"; + + public static final String IVA_TIPO_NATURA_N6_5_INVERSIONE_CONTABILE_CESS_CELLULARI = "N6.5"; + + public static final String IVA_TIPO_NATURA_N6_6_INVERSIONE_CONTABILE_PROD_ELETTRONCICI = "N6.6"; + + public static final String IVA_TIPO_NATURA_N6_7_INVERSIONE_CONTABILE_PREST_EDILE_E_CONNESSI = "N6.7"; + + public static final String IVA_TIPO_NATURA_N6_8_INVERSIONE_CONTABILE_SETT_ENERGETICO = "N6.8"; + + public static final String IVA_TIPO_NATURA_N6_9_INVERSIONE_CONTABILE_ALTRI_CASI = "N6.9"; + + public static final String IVA_TIPO_NATURA_N7_ALTRO_STATO_A_DISTANZA_SERV_TELE = "N7"; + + public static final String TIPO_CESSIONE_PRESTAZIONE_VALIDI = ",SC,PR,AB,AC,"; + + public static final String TIPO_CESSIONE_PRESTAZIONE_SCONTO = "SC"; + + public static final String TIPO_CESSIONE_PRESTAZIONE_PREMIO = "PR"; + + public static final String TIPO_CESSIONE_PRESTAZIONE_ABBUONO = "AB"; + + public static final String TIPO_CESSIONE_PRESTAZIONE_SPESA_ACCESSORIA = "AC"; + + public static final String TIPO_ESIGIBILITA_IVA_VALIDI = ",I,D,S,"; + + public static final String TIPO_ESIGIBILITA_IVA_IMMEDIATA = "I"; + + public static final String TIPO_ESIGIBILITA_IVA_DIFFERITA = "D"; + + public static final String TIPO_ESIGIBILITA_IVA_SCISSIONE = "S"; + + public static final String CONDIZIONI_PAGAMENTO_VALIDI = ",TP01,TP02,TP03,"; + + public static final String CONDIZIONI_PAGAMENTO_RATE_TP01 = "TP01"; + + public static final String CONDIZIONI_PAGAMENTO_COMPLETO_TP02 = "TP02"; + + public static final String CONDIZIONI_PAGAMENTO_ANTICIPO_TP03 = "TP03"; + + public static final String MODALITA_PAGAMENTO_VALIDI = ",MP01,MP02,MP03,MP04,MP05,MP06,MP07,MP08,MP00,MP10,MP11,MP12,MP13,MP14,MP15,MP16,MP17,MP18,MP19,MP20,MP21,MP22,"; + + public static final String FLAG_OPERAZIONE_INSERIMENTO = "I"; + + public static final String FLAG_OPERAZIONE_VARIAZIONE = "V"; + + public static final String FLAG_OPERAZIONE_RIMBORSO = "R"; + + public static final String FLAG_OPERAZIONE_CANCELLAZIONE = "C"; + + public static final String RIGA_ALTRI_DATI_GESTIONALI_VALUES = "INTENTO,NUMSCONTR"; + + public static final String RIGA_ALTRI_DATI_GESTIONALI_TIPO_DATO_INTENTO = "INTENTO"; + + public static final String RIGA_ALTRI_DATI_GESTIONALI_TIPO_DATO_SCONTRINO = "NUMSCONTR"; + + public static void main(String[] args) {} + + public FeXml(FatturaElettronicaInterface fattura) { + this.fattura = fattura; + this.vecFatture = null; + } + + public FeXml(FatturaElettronicaInterface fattura, Vectumerator vecFatture) { + this.vecFatture = vecFatture; + this.fattura = fattura; + } + + public static final String getFullFileXml(FatturaElettronicaInterface bean, String parmSfx) { + return bean.getDocBase() + bean.getDocBase(); + } + + public static final String getFileXmlToDocbase(FatturaElettronicaInterface bean, String parmSfx) { + Calendar cal = Calendar.getInstance(); + cal.setTime(bean.getFeDataDocumento()); + String nomeFile = getNomeFileXml(bean, parmSfx); + if (parmSfx != null && !parmSfx.equals("")) + return bean.getApFull().getParm("FELETT_PATH_FATTURE_REL" + parmSfx).getTesto() + bean.getApFull().getParm("FELETT_PATH_FATTURE_REL" + parmSfx).getTesto() + "/" + cal.get(1) + "/" + + cal.get(2) + 1; + return bean.getApFull().getParm("FELETT_PATH_FATTURE_REL").getTesto() + bean.getApFull().getParm("FELETT_PATH_FATTURE_REL").getTesto() + "/" + cal.get(1) + "/" + + cal.get(2) + 1; + } + + private String getNomeFileXml(FatturaElettronicaInterface bean) { + return getNomeFileXml(bean, ""); + } + + private static String getNomeFileXml(FatturaElettronicaInterface bean, String parmSfx) { + String nomeFile; + if (parmSfx != null && !parmSfx.isEmpty()) { + nomeFile = bean.getApFull().getParm("FELETT_TRASM_ID_PAESE" + parmSfx).getTesto() + bean.getApFull().getParm("FELETT_TRASM_ID_PAESE" + parmSfx).getTesto() + "_" + bean.getApFull().getParm("FELETT_TRASM_ID_CODICE" + parmSfx).getTesto() + ".xml"; + } else { + nomeFile = bean.getApFull().getParm("FELETT_TRASM_ID_PAESE").getTesto() + bean.getApFull().getParm("FELETT_TRASM_ID_PAESE").getTesto() + "_" + bean.getApFull().getParm("FELETT_TRASM_ID_CODICE").getTesto() + ".xml"; + } + return nomeFile; + } + + private ResParm buildOneXml(FatturaElettronicaInterface bean, String parmSfx) { + ResParm rp = new ResParm(); + StringBuilder errMsg = new StringBuilder(); + StringBuilder warnMsg = new StringBuilder(); + rp = checkDatiObbligatori(bean, parmSfx); + if (!rp.getStatus()) + return rp; + if (!bean.getFEDatiAnagraficiCessionario().getFEPaese().equals("IT") && !isFelettParm("FELETT_XML_ESTERO_SI" + parmSfx)) { + rp.setStatus(true); + rp.setInfoMsg(bean.getFENumeroDocumento() + ": Fattura vs. estero non obbiligatoria\n"); + return rp; + } + Element e = null; + SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd"); + SimpleDateFormat dTimef = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); + NumberFormat nf = NumberFormat.getInstance(Locale.US); + nf.setMaximumFractionDigits(2); + nf.setMinimumFractionDigits(2); + DecimalFormat nfe = (DecimalFormat)nf; + nfe.applyPattern("##0.00"); + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + try { + DocumentBuilder db = dbf.newDocumentBuilder(); + this.dom = db.newDocument(); + this.rootElement = this.dom.createElement("p:FatturaElettronica"); + this.rootElement.setAttribute("xmlns:ds", "http://www.w3.org/2000/09/xmldsig#"); + this.rootElement.setAttribute("xmlns:p", "http://ivaservizi.agenziaentrate.gov.it/docs/xsd/fatture/v1.2"); + if (bean.isPubblicaAmministrazione()) { + this.rootElement.setAttribute("versione", "FPA12"); + } else { + this.rootElement.setAttribute("versione", "FPR12"); + } + Element fatturaElettronicaHeader = this.dom.createElement("FatturaElettronicaHeader"); + Element datiTrasmissione = this.dom.createElement("DatiTrasmissione"); + Element idTrasmittente = this.dom.createElement("IdTrasmittente"); + e = this.dom.createElement("IdPaese"); + e.setTextContent(getFelettParm("FELETT_TRASM_ID_PAESE" + parmSfx)); + idTrasmittente.appendChild(e); + e = this.dom.createElement("IdCodice"); + e.setTextContent(getFelettParm("FELETT_TRASM_ID_CODICE" + parmSfx)); + idTrasmittente.appendChild(e); + datiTrasmissione.appendChild(idTrasmittente); + e = this.dom.createElement("ProgressivoInvio"); + e.setTextContent(bean.getFEProgressivo()); + datiTrasmissione.appendChild(e); + e = this.dom.createElement("FormatoTrasmissione"); + e.setTextContent(bean.isPubblicaAmministrazione() ? "FPA12" : "FPR12"); + datiTrasmissione.appendChild(e); + e = this.dom.createElement("CodiceDestinatario"); + if (bean.getFECodiceDestinatario() == null || bean.getFECodiceDestinatario().isEmpty()) { + if (bean.isPubblicaAmministrazione()) { + e.setTextContent("000000"); + } else if (bean.getFEDatiAnagraficiCessionario().getFEPaese().equals("IT")) { + e.setTextContent("0000000"); + } else { + e.setTextContent("XXXXXXX"); + } + } else { + e.setTextContent(bean.getFECodiceDestinatario().toUpperCase()); + } + datiTrasmissione.appendChild(e); + if (!getFelettParm("FELETT_TRASM_CONTATTO_TELEFONO" + parmSfx).isEmpty() || + !getFelettParm("FELETT_TRASM_CONTATTO_EMAIL" + parmSfx).isEmpty()) { + Element contattiTrasmittente = this.dom.createElement("ContattiTrasmittente"); + if (!getFelettParm("FELETT_TRASM_CONTATTO_TELEFONO" + parmSfx).isEmpty()) { + e = this.dom.createElement("Telefono"); + e.setTextContent(getFelettParm("FELETT_TRASM_CONTATTO_TELEFONO" + parmSfx)); + contattiTrasmittente.appendChild(e); + } + if (!getFelettParm("FELETT_TRASM_CONTATTO_EMAIL" + parmSfx).isEmpty()) { + e = this.dom.createElement("Email"); + e.setTextContent(getFelettParm("FELETT_TRASM_CONTATTO_EMAIL" + parmSfx)); + contattiTrasmittente.appendChild(e); + } + datiTrasmissione.appendChild(contattiTrasmittente); + } + if (bean.getFEPecDestinatario() != null && !bean.getFEPecDestinatario().isEmpty()) { + e = this.dom.createElement("PECDestinatario"); + e.setTextContent(bean.getFEPecDestinatario()); + datiTrasmissione.appendChild(e); + } else if (bean.getFECodiceDestinatario() == null || bean.getFECodiceDestinatario().isEmpty()) { + warnMsg.append("DatiTrasmissione-> PECDestinatario o CodiceDestinatario non impostati\n"); + } + fatturaElettronicaHeader.appendChild(datiTrasmissione); + Element cedentePrestatore = this.dom.createElement("CedentePrestatore"); + Element datiAnagrafici = this.dom.createElement("DatiAnagrafici"); + Element idFiscaleIVA = this.dom.createElement("IdFiscaleIVA"); + e = this.dom.createElement("IdPaese"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_ID_PAESE" + parmSfx)); + idFiscaleIVA.appendChild(e); + e = this.dom.createElement("IdCodice"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_ID_CODICE" + parmSfx)); + idFiscaleIVA.appendChild(e); + datiAnagrafici.appendChild(idFiscaleIVA); + e = this.dom.createElement("CodiceFiscale"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_COD_FISC" + parmSfx)); + datiAnagrafici.appendChild(e); + Element anagrafica = this.dom.createElement("Anagrafica"); + if (!getFelettParm("FELETT_CEDENTE_DENOMINAZIONE" + parmSfx).isEmpty()) { + e = this.dom.createElement("Denominazione"); + e.setTextContent(convertStringToXmlString(getFelettParm("FELETT_CEDENTE_DENOMINAZIONE" + parmSfx), 80)); + anagrafica.appendChild(e); + } else { + e = this.dom.createElement("Nome"); + e.setTextContent(convertStringToXmlString(getFelettParm("FELETT_CEDENTE_NOME" + parmSfx), 60)); + anagrafica.appendChild(e); + e = this.dom.createElement("Cognome"); + e.setTextContent(convertStringToXmlString(getFelettParm("FELETT_CEDENTE_COGNOME" + parmSfx), 60)); + anagrafica.appendChild(e); + if (!getFelettParm("FELETT_CEDENTE_TITOLO" + parmSfx).isEmpty()) { + e = this.dom.createElement("Titolo"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_TITOLO" + parmSfx)); + anagrafica.appendChild(e); + } + if (!getFelettParm("FELETT_CEDENTE_COD_EORI" + parmSfx).isEmpty()) { + e = this.dom.createElement("CodEORI"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_COD_EORI" + parmSfx)); + anagrafica.appendChild(e); + } + } + datiAnagrafici.appendChild(anagrafica); + e = this.dom.createElement("RegimeFiscale"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_REGIME_FISCALE" + parmSfx)); + datiAnagrafici.appendChild(e); + cedentePrestatore.appendChild(datiAnagrafici); + Element sede = this.dom.createElement("Sede"); + e = this.dom.createElement("Indirizzo"); + e.setTextContent(convertStringToXmlString(getFelettParm("FELETT_CEDENTE_SEDE_INDIRIZZO" + parmSfx), 60)); + sede.appendChild(e); + e = this.dom.createElement("NumeroCivico"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_SEDE_NUM_CIV" + parmSfx)); + sede.appendChild(e); + e = this.dom.createElement("CAP"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_SEDE_CAP" + parmSfx)); + sede.appendChild(e); + e = this.dom.createElement("Comune"); + e.setTextContent(convertStringToXmlString(getFelettParm("FELETT_CEDENTE_SEDE_COMUNE" + parmSfx), 60)); + sede.appendChild(e); + e = this.dom.createElement("Provincia"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_SEDE_PROV" + parmSfx).toUpperCase()); + sede.appendChild(e); + e = this.dom.createElement("Nazione"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_SEDE_NAZIONE" + parmSfx).toUpperCase()); + sede.appendChild(e); + cedentePrestatore.appendChild(sede); + if (!getFelettParm("FELETT_CEDENTE_STAB_ORG_INDIRIZZO" + parmSfx).isEmpty()) { + Element stabileOrganizzazione = this.dom.createElement("StabileOrganizzazione"); + e = this.dom.createElement("Indirizzo"); + e.setTextContent( + convertStringToXmlString(getFelettParm("FELETT_CEDENTE_STAB_ORG_INDIRIZZO" + parmSfx), 60)); + stabileOrganizzazione.appendChild(e); + e = this.dom.createElement("NumeroCivico"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_STAB_ORG_NUMERO_CIVICO" + parmSfx)); + stabileOrganizzazione.appendChild(e); + e = this.dom.createElement("CAP"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_STAB_ORG_CAP" + parmSfx)); + stabileOrganizzazione.appendChild(e); + e = this.dom.createElement("Comune"); + e.setTextContent(convertStringToXmlString(getFelettParm("FELETT_CEDENTE_STAB_ORG_COMUNE" + parmSfx), 60)); + stabileOrganizzazione.appendChild(e); + e = this.dom.createElement("Provincia"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_STAB_ORG_PROVINCIA" + parmSfx).toUpperCase()); + stabileOrganizzazione.appendChild(e); + e = this.dom.createElement("Nazione"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_STAB_ORG_NAZIONE" + parmSfx).toUpperCase()); + stabileOrganizzazione.appendChild(e); + cedentePrestatore.appendChild(stabileOrganizzazione); + } + if (!getFelettParm("FELETT_CEDENTE_RAPP_FISC_ID_CODICE" + parmSfx).isEmpty()) { + Element rappresentanteFiscale = this.dom.createElement("RappresentanteFiscale"); + Element element3 = this.dom.createElement("IdFiscaleIVA"); + e = this.dom.createElement("IdPaese"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_RAPP_FISC_ID_PAESE" + parmSfx)); + element3.appendChild(e); + e = this.dom.createElement("IdCodice"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_RAPP_FISC_ID_CODICE" + parmSfx)); + element3.appendChild(e); + rappresentanteFiscale.appendChild(element3); + if (!getFelettParm("FELETT_CEDENTE_RAPP_FISC_DENOMINAZIONE" + parmSfx).isEmpty()) { + e = this.dom.createElement("Denominazione"); + e.setTextContent(convertStringToXmlString( + getFelettParm("FELETT_CEDENTE_RAPP_FISC_DENOMINAZIONE" + parmSfx), 80)); + rappresentanteFiscale.appendChild(e); + } else { + e = this.dom.createElement("Nome"); + e.setTextContent( + convertStringToXmlString(getFelettParm("FELETT_CEDENTE_RAPP_FISC_NOME" + parmSfx), 60)); + rappresentanteFiscale.appendChild(e); + e = this.dom.createElement("Cognome"); + e.setTextContent( + convertStringToXmlString(getFelettParm("FELETT_CEDENTE_RAPP_FISC_COGNOME" + parmSfx), 60)); + rappresentanteFiscale.appendChild(e); + if (!getFelettParm("FELETT_CEDENTE_RAPP_FISC_TITOLO" + parmSfx).isEmpty()) { + e = this.dom.createElement("Titolo"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_TITOLO" + parmSfx)); + rappresentanteFiscale.appendChild(e); + } + if (!getFelettParm("FELETT_CEDENTE_RAPP_FISC_COD_EORI" + parmSfx).isEmpty()) { + e = this.dom.createElement("CodEORI"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_COD_EORI" + parmSfx)); + rappresentanteFiscale.appendChild(e); + } + } + cedentePrestatore.appendChild(rappresentanteFiscale); + } + if (!getFelettParm("FELETT_CEDENTE_ISCR_REA_UFFICIO" + parmSfx).isEmpty()) { + Element iscrizioneREA = this.dom.createElement("IscrizioneREA"); + e = this.dom.createElement("Ufficio"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_ISCR_REA_UFFICIO" + parmSfx)); + iscrizioneREA.appendChild(e); + e = this.dom.createElement("NumeroREA"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_ISCR_REA_NUMERO_REA" + parmSfx)); + iscrizioneREA.appendChild(e); + e = this.dom.createElement("CapitaleSociale"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_ISCR_REA_CAPITALE_SOCIALE" + parmSfx)); + iscrizioneREA.appendChild(e); + e = this.dom.createElement("SocioUnico"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_ISCR_REA_SOCIO_UNICO" + parmSfx)); + iscrizioneREA.appendChild(e); + e = this.dom.createElement("StatoLiquidazione"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_ISCR_REA_STATO_LIQUIDAZIONE" + parmSfx)); + iscrizioneREA.appendChild(e); + cedentePrestatore.appendChild(iscrizioneREA); + } + if (!getFelettParm("FELETT_CEDENTE_CONTATTI_TELEFONO" + parmSfx).isEmpty() || + !getFelettParm("FELETT_CEDENTE_CONTATTI_EMAIL" + parmSfx).isEmpty() || + !getFelettParm("FELETT_CEDENTE_CONTATTI_FAX" + parmSfx).isEmpty()) { + Element contatti = this.dom.createElement("Contatti"); + if (!getFelettParm("FELETT_CEDENTE_CONTATTI_TELEFONO" + parmSfx).isEmpty()) { + e = this.dom.createElement("Telefono"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_CONTATTI_TELEFONO" + parmSfx)); + contatti.appendChild(e); + } + if (!getFelettParm("FELETT_CEDENTE_CONTATTI_EMAIL" + parmSfx).isEmpty()) { + e = this.dom.createElement("Email"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_CONTATTI_EMAIL" + parmSfx)); + contatti.appendChild(e); + } + if (!getFelettParm("FELETT_CEDENTE_CONTATTI_FAX" + parmSfx).isEmpty()) { + e = this.dom.createElement("Fax"); + e.setTextContent(getFelettParm("FELETT_CEDENTE_CONTATTI_FAX" + parmSfx)); + contatti.appendChild(e); + } + cedentePrestatore.appendChild(contatti); + } + fatturaElettronicaHeader.appendChild(cedentePrestatore); + if (bean.getFERappFiscalepartitaIva() != null && !bean.getFERappFiscalepartitaIva().isEmpty()) { + Element rappresentanteFiscale = this.dom.createElement("RappresentanteFiscale"); + Element element3 = this.dom.createElement("IdFiscaleIVA"); + e = this.dom.createElement("IdPaese"); + e.setTextContent(bean.getFERappFiscaleIdPaese()); + element3.appendChild(e); + e = this.dom.createElement("IdCodice"); + e.setTextContent(bean.getFERappFiscalepartitaIva()); + element3.appendChild(e); + rappresentanteFiscale.appendChild(element3); + if (bean.getFERappFiscaleDenominazione() != null && !bean.getFERappFiscaleDenominazione().isEmpty()) { + e = this.dom.createElement("Denominazione"); + e.setTextContent(convertStringToXmlString(bean.getFERappFiscaleDenominazione(), 80)); + rappresentanteFiscale.appendChild(e); + } else { + e = this.dom.createElement("Nome"); + e.setTextContent(convertStringToXmlString(bean.getFERappFiscaleNome(), 60)); + rappresentanteFiscale.appendChild(e); + e = this.dom.createElement("Cognome"); + e.setTextContent(convertStringToXmlString(bean.getFERappFiscaleCognome(), 60)); + rappresentanteFiscale.appendChild(e); + if (bean.getFERappFiscaleTitolo() != null && !bean.getFERappFiscaleTitolo().isEmpty()) { + e = this.dom.createElement("Titolo"); + e.setTextContent(bean.getFERappFiscaleTitolo()); + rappresentanteFiscale.appendChild(e); + } + if (bean.getFERappFiscaleCodEORI() != null && !bean.getFERappFiscaleCodEORI().isEmpty()) { + e = this.dom.createElement("CodEORI"); + e.setTextContent(bean.getFERappFiscaleCodEORI()); + rappresentanteFiscale.appendChild(e); + } + } + fatturaElettronicaHeader.appendChild(rappresentanteFiscale); + } + Element cessionarioCommittente = this.dom.createElement("CessionarioCommittente"); + Element element1 = this.dom.createElement("DatiAnagrafici"); + if (bean.getFEDatiAnagraficiCessionario().getFEPaese().equals("IT")) { + if (bean.getFEDatiAnagraficiCessionario().getFEPartitaIva() != null && + !bean.getFEDatiAnagraficiCessionario().getFEPartitaIva().isEmpty()) { + Element element = this.dom.createElement("IdFiscaleIVA"); + e = this.dom.createElement("IdPaese"); + e.setTextContent(bean.getFEDatiAnagraficiCessionario().getFEPaese()); + element.appendChild(e); + e = this.dom.createElement("IdCodice"); + e.setTextContent(bean.getFEDatiAnagraficiCessionario().getFEPartitaIva()); + element.appendChild(e); + element1.appendChild(element); + } + } else { + Element element = this.dom.createElement("IdFiscaleIVA"); + e = this.dom.createElement("IdPaese"); + e.setTextContent(bean.getFEDatiAnagraficiCessionario().getFEPaese()); + element.appendChild(e); + e = this.dom.createElement("IdCodice"); + if (bean.getFEDatiAnagraficiCessionario().getFEPartitaIva() != null && + !bean.getFEDatiAnagraficiCessionario().getFEPartitaIva().isEmpty()) { + e.setTextContent(bean.getFEDatiAnagraficiCessionario().getFEPartitaIva()); + } else { + e.setTextContent("00000000000"); + } + element.appendChild(e); + element1.appendChild(element); + } + if (!bean.getFEDatiAnagraficiCessionario().getFECodiceFiscale().isEmpty() && + bean.getFEDatiAnagraficiCessionario().getFEPaese().toUpperCase().equals("IT")) { + e = this.dom.createElement("CodiceFiscale"); + e.setTextContent(bean.getFEDatiAnagraficiCessionario().getFECodiceFiscale()); + element1.appendChild(e); + } + anagrafica = this.dom.createElement("Anagrafica"); + if (bean.getFEDatiAnagraficiCessionario().getFEDenominazione() != null && + !bean.getFEDatiAnagraficiCessionario().getFEDenominazione().isEmpty()) { + e = this.dom.createElement("Denominazione"); + e.setTextContent( + convertStringToXmlString(bean.getFEDatiAnagraficiCessionario().getFEDenominazione(), 80)); + anagrafica.appendChild(e); + } else { + if (!bean.getFEDatiAnagraficiCessionario().getFENome().isEmpty()) { + e = this.dom.createElement("Nome"); + e.setTextContent(convertStringToXmlString(bean.getFEDatiAnagraficiCessionario().getFENome(), 60)); + anagrafica.appendChild(e); + } else { + errMsg.append("Cessionario Nome non valido oppure impostare Cliente a Azienda\n"); + } + if (!bean.getFEDatiAnagraficiCessionario().getFECognome().isEmpty()) { + e = this.dom.createElement("Cognome"); + e.setTextContent( + convertStringToXmlString(bean.getFEDatiAnagraficiCessionario().getFECognome(), 60)); + anagrafica.appendChild(e); + } else { + errMsg.append("Cessionario Cognome non valido\n"); + } + if (bean.getFEDatiAnagraficiCessionario().getFETitolo() != null && + !bean.getFEDatiAnagraficiCessionario().getFETitolo().isEmpty()) { + e = this.dom.createElement("Titolo"); + e.setTextContent(bean.getFEDatiAnagraficiCessionario().getFETitolo()); + anagrafica.appendChild(e); + } + if (bean.getFEDatiAnagraficiCessionario().getFECodEORI() != null && + !bean.getFEDatiAnagraficiCessionario().getFECodEORI().isEmpty()) { + e = this.dom.createElement("CodEORI"); + e.setTextContent(bean.getFEDatiAnagraficiCessionario().getFECodEORI()); + anagrafica.appendChild(e); + } + } + element1.appendChild(anagrafica); + cessionarioCommittente.appendChild(element1); + Element element2 = this.dom.createElement("Sede"); + FESedeInterface feSede = bean.getFESedeCessonario(); + e = this.dom.createElement("Indirizzo"); + e.setTextContent(convertStringToXmlString(feSede.getFEIndirizzo(), 60)); + element2.appendChild(e); + if (!feSede.getFENumeroCivico().isEmpty()) { + e = this.dom.createElement("NumeroCivico"); + if (feSede.getFENumeroCivico().length() > 8) { + e.setTextContent(feSede.getFENumeroCivico().substring(0, 8)); + warnMsg.append("Cessionario Sede numero civico > 8 caratteri\n"); + } else { + e.setTextContent(feSede.getFENumeroCivico()); + } + element2.appendChild(e); + } + if (bean.getFEDatiAnagraficiCessionario().getFEPaese().toUpperCase().equals("IT")) { + if (!feSede.getFECAP().isEmpty() && feSede.getFECAP().length() == 5) { + e = this.dom.createElement("CAP"); + e.setTextContent(feSede.getFECAP()); + element2.appendChild(e); + } else { + errMsg.append("Cessionario CAP non valido\n"); + } + } else { + e = this.dom.createElement("CAP"); + e.setTextContent("00000"); + element2.appendChild(e); + } + e = this.dom.createElement("Comune"); + e.setTextContent(convertStringToXmlString(feSede.getFEComune(), 60)); + element2.appendChild(e); + if (bean.getFEDatiAnagraficiCessionario().getFEPaese().toUpperCase().equals("IT")) { + e = this.dom.createElement("Provincia"); + if (feSede.getFEProvincia().length() == 2) { + e.setTextContent(feSede.getFEProvincia().toUpperCase()); + } else { + errMsg.append("Cessionario Sede Provincia IT errata\n"); + } + element2.appendChild(e); + } else if (!feSede.getFEProvincia().isEmpty()) { + e = this.dom.createElement("Provincia"); + if (feSede.getFEProvincia().length() > 2) { + e.setTextContent(feSede.getFEProvincia().substring(0, 2).toUpperCase()); + warnMsg.append("Cessionario Sede Provincia > 2 caratteri\n"); + } else { + e.setTextContent(feSede.getFEProvincia().toUpperCase()); + } + element2.appendChild(e); + } + e = this.dom.createElement("Nazione"); + e.setTextContent(feSede.getFENazione().toUpperCase()); + element2.appendChild(e); + cessionarioCommittente.appendChild(element2); + if (bean.getFEStabileOrg() != null) { + Element stabileOrganizzazione = this.dom.createElement("StabileOrganizzazione"); + FESedeInterface fESedeInterface = bean.getFEStabileOrg(); + e = this.dom.createElement("Indirizzo"); + e.setTextContent(convertStringToXmlString(fESedeInterface.getFEIndirizzo(), 60)); + element2.appendChild(e); + e = this.dom.createElement("NumeroCivico"); + e.setTextContent(fESedeInterface.getFENumeroCivico()); + element2.appendChild(e); + e = this.dom.createElement("CAP"); + e.setTextContent(fESedeInterface.getFECAP()); + element2.appendChild(e); + e = this.dom.createElement("Comune"); + e.setTextContent(convertStringToXmlString(fESedeInterface.getFEComune(), 60)); + element2.appendChild(e); + e = this.dom.createElement("Provincia"); + e.setTextContent(fESedeInterface.getFEProvincia().toUpperCase()); + element2.appendChild(e); + e = this.dom.createElement("Nazione"); + e.setTextContent(fESedeInterface.getFENazione().toUpperCase()); + element2.appendChild(e); + cessionarioCommittente.appendChild(stabileOrganizzazione); + } + fatturaElettronicaHeader.appendChild(cessionarioCommittente); + if (!getFelettParm("FELETT_INTERMEDIARIO_ID_CODICE" + parmSfx).isEmpty()) { + Element terzoIntermediario = this.dom.createElement("TerzoIntermediarioOSoggettoEmittente"); + Element element3 = this.dom.createElement("DatiAnagrafici"); + if (!getFelettParm("FELETT_INTERMEDIARIO_ID_PAESE" + parmSfx).isEmpty() && + !getFelettParm("FELETT_INTERMEDIARIO_ID_CODICE" + parmSfx).isEmpty()) { + Element element = this.dom.createElement("IdFiscaleIVA"); + e = this.dom.createElement("IdPaese"); + e.setTextContent(getFelettParm("FELETT_INTERMEDIARIO_ID_PAESE" + parmSfx)); + element.appendChild(e); + e = this.dom.createElement("IdCodice"); + e.setTextContent(getFelettParm("FELETT_INTERMEDIARIO_ID_CODICE" + parmSfx)); + element.appendChild(e); + element3.appendChild(element); + } else { + errMsg.append("TerzoIntermediarioOSoggettoEmittente " + parmSfx + ": FELETT_INTERMEDIARIO_ID_PAESE o FELETT_INTERMEDIARIO_ID_CODICE nulli\n"); + } + if (!getFelettParm("FELETT_INTERMEDIARIO_CODICE_FISCALE" + parmSfx).isEmpty()) { + e = this.dom.createElement("CodiceFiscale"); + e.setTextContent(getFelettParm("FELETT_INTERMEDIARIO_CODICE_FISCALE" + parmSfx)); + } else { + errMsg.append("TerzoIntermediarioOSoggettoEmittente " + parmSfx + ": FELETT_INTERMEDIARIO_CODICE_FISCALE nulli\n"); + } + element3.appendChild(e); + Element element4 = this.dom.createElement("Anagrafica"); + if (!getFelettParm("FELETT_INTERMEDIARIO_DENOMINAZIONE" + parmSfx).isEmpty()) { + e = this.dom.createElement("Denominazione"); + e.setTextContent(convertStringToXmlString( + getFelettParm("FELETT_INTERMEDIARIO_DENOMINAZIONE" + parmSfx), 80)); + element4.appendChild(e); + } else { + e = this.dom.createElement("Nome"); + e.setTextContent( + convertStringToXmlString(getFelettParm("FELETT_INTERMEDIARIO_NOME" + parmSfx), 60)); + element4.appendChild(e); + e = this.dom.createElement("Cognome"); + e.setTextContent( + convertStringToXmlString(getFelettParm("FELETT_INTERMEDIARIO_COGNOME" + parmSfx), 60)); + element4.appendChild(e); + if (!getFelettParm("FELETT_INTERMEDIARIO_TITOLO" + parmSfx).isEmpty()) { + e = this.dom.createElement("Titolo"); + e.setTextContent(getFelettParm("FELETT_INTERMEDIARIO_TITOLO" + parmSfx)); + element4.appendChild(e); + } + if (!getFelettParm("FELETT_INTERMEDIARIO_COD_EORI" + parmSfx).isEmpty()) { + e = this.dom.createElement("CodEORI"); + e.setTextContent(getFelettParm("FELETT_INTERMEDIARIO_COD_EORI" + parmSfx)); + element4.appendChild(e); + } + } + element3.appendChild(element4); + terzoIntermediario.appendChild(element3); + fatturaElettronicaHeader.appendChild(terzoIntermediario); + } + if (!getFelettParm("FELETT_INTERMEDIARIO_SOGGETTO_EMITTENTE" + parmSfx).isEmpty()) { + Element soggettoEmittente = this.dom.createElement("SoggettoEmittente"); + soggettoEmittente.setTextContent(getFelettParm("FELETT_INTERMEDIARIO_SOGGETTO_EMITTENTE" + parmSfx)); + fatturaElettronicaHeader.appendChild(soggettoEmittente); + } + this.rootElement.appendChild(fatturaElettronicaHeader); + Element FatturaElettronicaBody = this.dom.createElement("FatturaElettronicaBody"); + Element datiGenerali = this.dom.createElement("DatiGenerali"); + Element datiGeneraliDocumento = this.dom.createElement("DatiGeneraliDocumento"); + e = this.dom.createElement("TipoDocumento"); + e.setTextContent(bean.getFETipoDocumento()); + datiGeneraliDocumento.appendChild(e); + e = this.dom.createElement("Divisa"); + e.setTextContent(bean.getFEDivisa()); + datiGeneraliDocumento.appendChild(e); + e = this.dom.createElement("Data"); + e.setTextContent(df.format(bean.getFeDataDocumento())); + datiGeneraliDocumento.appendChild(e); + e = this.dom.createElement("Numero"); + e.setTextContent(bean.getFENumeroDocumento()); + datiGeneraliDocumento.appendChild(e); + if (bean.getFeDatiRitenuta() != null) { + Element datiRitenuta = this.dom.createElement("DatiRitenuta"); + datiGeneraliDocumento.appendChild(datiRitenuta); + } + if (bean.getFeBolloVirtuale() != null && !bean.getFeBolloVirtuale().isEmpty()) { + Element datiBollo = this.dom.createElement("DatiBollo"); + e = this.dom.createElement("BolloVirtuale"); + e.setTextContent(bean.getFeBolloVirtuale()); + datiBollo.appendChild(e); + e = this.dom.createElement("ImportoBollo"); + e.setTextContent(nfe.format(bean.getFEImportoBollo())); + datiBollo.appendChild(e); + datiGeneraliDocumento.appendChild(datiBollo); + } + Vectumerator vecSM = bean.getFEScontoMaggiorazione(); + if (vecSM != null) + while (vecSM.hasMoreElements()) { + FEScontoMaggiorazioneInterface rowSCMAG = (FEScontoMaggiorazioneInterface)vecSM.nextElement(); + Element scontoMaggiorazione = this.dom.createElement("ScontoMaggiorazione"); + if (",SC,MG,".indexOf("," + rowSCMAG.getFETipoScontoMagg() + ",") < 0) + errMsg.append("Dati Generali Tipo sconto maggiorazione diverso da +,SC,MG,\n"); + if ((rowSCMAG.getFEPercentualeScontoMagg() == 0.0D && rowSCMAG.getFEImportoScontoMagg() == 0.0D) || ( + rowSCMAG.getFEPercentualeScontoMagg() > 0.0D && rowSCMAG.getFEImportoScontoMagg() > 0.0D)) + errMsg.append("Dati Generali sconto maggiorazione percentuale e/o Importo non valido\n"); + e = this.dom.createElement("Tipo"); + e.setTextContent(rowSCMAG.getFETipoScontoMagg()); + scontoMaggiorazione.appendChild(e); + if (rowSCMAG.getFEPercentualeScontoMagg() > 0.0D) { + e = this.dom.createElement("Percentuale"); + e.setTextContent(nfe.format(rowSCMAG.getFEPercentualeScontoMagg())); + scontoMaggiorazione.appendChild(e); + } else { + e = this.dom.createElement("Importo"); + e.setTextContent(nfe.format(rowSCMAG.getFEImportoScontoMagg())); + scontoMaggiorazione.appendChild(e); + } + datiGeneraliDocumento.appendChild(scontoMaggiorazione); + } + if (bean.getFEImportoTotaleDocumento() == 0.0D) + warnMsg.append("Dati Generali Importo totale documento a zero\n"); + e = this.dom.createElement("ImportoTotaleDocumento"); + e.setTextContent(nfe.format(bean.getFEImportoTotaleDocumento())); + datiGeneraliDocumento.appendChild(e); + if (bean.getFEArrotondamento() > 0.0D) { + e = this.dom.createElement("Arrotondamento"); + e.setTextContent(nfe.format(bean.getFEArrotondamento())); + datiGeneraliDocumento.appendChild(e); + } + if (bean.getFECausale() != null && !bean.getFECausale().isEmpty()) { + e = this.dom.createElement("Causale"); + e.setTextContent(convertStringToXmlString(bean.getFECausale(), 200)); + datiGeneraliDocumento.appendChild(e); + } + if (bean.isFEArt73()) { + e = this.dom.createElement("Art73"); + e.setTextContent("SI"); + datiGeneraliDocumento.appendChild(e); + } + datiGenerali.appendChild(datiGeneraliDocumento); + if ((bean.getFEDatiOrdineAcquistoCodiceCIG() != null && !bean.getFEDatiOrdineAcquistoCodiceCIG().isEmpty()) || ( + bean.getFEDatiOrdineAcquistoIdDocumento() != null && + !bean.getFEDatiOrdineAcquistoIdDocumento().isEmpty())) { + Element datiOrdineAcquisto = this.dom.createElement("DatiOrdineAcquisto"); + if (bean.getFEDatiOrdineAcquistoIdDocumento() != null && + !bean.getFEDatiOrdineAcquistoIdDocumento().isEmpty()) { + e = this.dom.createElement("IdDocumento"); + e.setTextContent(bean.getFEDatiOrdineAcquistoIdDocumento()); + datiOrdineAcquisto.appendChild(e); + } + if (bean.getFEDatiOrdineAcquistoData() != null) { + e = this.dom.createElement("Data"); + e.setTextContent(df.format(bean.getFEDatiOrdineAcquistoData())); + datiOrdineAcquisto.appendChild(e); + } + if (bean.getFEDatiOrdineAcquistoRifNumLinea() != null && + !bean.getFEDatiOrdineAcquistoRifNumLinea().isEmpty()) { + e = this.dom.createElement("RiferimentoNumeroLinea"); + e.setTextContent(bean.getFEDatiOrdineAcquistoRifNumLinea()); + datiOrdineAcquisto.appendChild(e); + } + if (bean.getFEDatiOrdineAcquistoNumItem() != null && !bean.getFEDatiOrdineAcquistoNumItem().isEmpty()) { + e = this.dom.createElement("NumItem"); + e.setTextContent(bean.getFEDatiOrdineAcquistoNumItem()); + datiOrdineAcquisto.appendChild(e); + } + if (bean.getFEDatiOrdineAcquistoCodCommessaConv() != null && + !bean.getFEDatiOrdineAcquistoCodCommessaConv().isEmpty()) { + e = this.dom.createElement("CodiceCommessaConvenzione"); + e.setTextContent(bean.getFEDatiOrdineAcquistoCodCommessaConv()); + datiOrdineAcquisto.appendChild(e); + } + if (bean.getFEDatiOrdineAcquistoCodiceCUP() != null && !bean.getFEDatiOrdineAcquistoCodiceCUP().isEmpty()) { + e = this.dom.createElement("CodiceCUP"); + e.setTextContent(bean.getFEDatiOrdineAcquistoCodiceCUP()); + datiOrdineAcquisto.appendChild(e); + } + if (bean.getFEDatiOrdineAcquistoCodiceCIG() != null && !bean.getFEDatiOrdineAcquistoCodiceCIG().isEmpty()) { + e = this.dom.createElement("CodiceCIG"); + e.setTextContent(bean.getFEDatiOrdineAcquistoCodiceCIG()); + datiOrdineAcquisto.appendChild(e); + } + datiGenerali.appendChild(datiOrdineAcquisto); + } + if (bean.getFEDatiSALRiferimentoFase() != null && !bean.getFEDatiSALRiferimentoFase().isEmpty()) { + Element datiSAL = this.dom.createElement("DatiSAL"); + e = this.dom.createElement("RiferimentoFase"); + e.setTextContent(bean.getFEDatiSALRiferimentoFase()); + datiSAL.appendChild(e); + datiGenerali.appendChild(datiSAL); + } + Vectumerator vecDDDT = bean.getFEDatiDDT(); + if (vecDDDT != null) + while (vecDDDT.hasMoreElements()) { + FEDatiDDT rowDDT = (FEDatiDDT)vecDDDT.nextElement(); + Element datiDDT = this.dom.createElement("DatiDDT"); + e = this.dom.createElement("NumeroDDT"); + e.setTextContent(rowDDT.getNumero()); + datiDDT.appendChild(e); + e = this.dom.createElement("DataDDT"); + e.setTextContent(df.format(rowDDT.getData())); + datiDDT.appendChild(e); + if (rowDDT.getNumLinea() > 0L) { + e = this.dom.createElement("RiferimentoNumeroLinea"); + e.setTextContent(nfe.format(rowDDT.getNumLinea())); + datiDDT.appendChild(e); + } + datiGenerali.appendChild(datiDDT); + } + if (bean.getFEDatiTrasporto() != null) { + Element datiTrasporto = this.dom.createElement("DatiTrasporto"); + FEDatiTrasportoInterface feDatiTrasporto = bean.getFEDatiTrasporto(); + if (feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFEPartitaIva() != null && + !feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFEPartitaIva().isEmpty() && (( + feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFEDenominazione() != null && + !feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFEDenominazione().isEmpty()) || ( + feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFENome() != null && + !feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFENome().isEmpty()))) { + Element datiAnagraficiVettore = this.dom.createElement("DatiAnagraficiVettore"); + Element element3 = this.dom.createElement("IdFiscaleIVA"); + e = this.dom.createElement("IdPaese"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFEPaese()); + element3.appendChild(e); + e = this.dom.createElement("IdCodice"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFEPartitaIva()); + element3.appendChild(e); + datiAnagraficiVettore.appendChild(element3); + e = this.dom.createElement("CodiceFiscale"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFECodiceFiscale()); + datiAnagraficiVettore.appendChild(e); + Element anagraficaVettore = this.dom.createElement("Anagrafica"); + if (feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFEDenominazione() != null && + !feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFEDenominazione().isEmpty()) { + e = this.dom.createElement("Denominazione"); + e.setTextContent(convertStringToXmlString( + feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFEDenominazione(), 80)); + anagraficaVettore.appendChild(e); + } else { + e = this.dom.createElement("Nome"); + e.setTextContent(convertStringToXmlString( + feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFENome(), 60)); + anagraficaVettore.appendChild(e); + e = this.dom.createElement("Cognome"); + e.setTextContent(convertStringToXmlString( + feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFECognome(), 60)); + anagraficaVettore.appendChild(e); + if (feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFETitolo() != null && + !feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFETitolo().isEmpty()) { + e = this.dom.createElement("Titolo"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFETitolo()); + anagraficaVettore.appendChild(e); + } + if (feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFECodEORI() != null && + !feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFECodEORI().isEmpty()) { + e = this.dom.createElement("CodEORI"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoAnagraficiVettore().getFECodEORI()); + anagraficaVettore.appendChild(e); + } + } + datiAnagraficiVettore.appendChild(anagraficaVettore); + if (feDatiTrasporto.getFEDatiTrasportoInterfaceNumeroLicenzaGuida() != null && + !feDatiTrasporto.getFEDatiTrasportoInterfaceNumeroLicenzaGuida().isEmpty()) { + e = this.dom.createElement("NumeroLicenzaGuida"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoInterfaceNumeroLicenzaGuida()); + anagraficaVettore.appendChild(e); + } + datiTrasporto.appendChild(datiAnagraficiVettore); + } + if (feDatiTrasporto.getFEDatiTrasportoMezzoTrasporto() != null && + !feDatiTrasporto.getFEDatiTrasportoMezzoTrasporto().isEmpty()) { + e = this.dom.createElement("MezzoTrasporto"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoMezzoTrasporto()); + datiTrasporto.appendChild(e); + } + if (feDatiTrasporto.getFEDatiTrasportoCausaleTrasporto() != null && + !feDatiTrasporto.getFEDatiTrasportoCausaleTrasporto().isEmpty()) { + e = this.dom.createElement("CausaleTrasporto"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoCausaleTrasporto()); + datiTrasporto.appendChild(e); + } + if (feDatiTrasporto.getFEDatiTrasportoNumeroColli() > 0L) { + e = this.dom.createElement("NumeroColli"); + e.setTextContent(String.valueOf(feDatiTrasporto.getFEDatiTrasportoNumeroColli())); + datiTrasporto.appendChild(e); + } + if (feDatiTrasporto.getFEDatiTrasportoDescrizione() != null && + !feDatiTrasporto.getFEDatiTrasportoDescrizione().isEmpty()) { + e = this.dom.createElement("Descrizione"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoDescrizione()); + datiTrasporto.appendChild(e); + } + if (feDatiTrasporto.getFEDatiTrasportoUnitaMisuraPeso() != null && + !feDatiTrasporto.getFEDatiTrasportoUnitaMisuraPeso().isEmpty() && ( + feDatiTrasporto.getFEDatiTrasportoPesoLordo() > 0.0D || + feDatiTrasporto.getFEDatiTrasportoPesoLordo() > 0.0D)) { + e = this.dom.createElement("UnitaMisuraPeso"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoUnitaMisuraPeso()); + datiTrasporto.appendChild(e); + } + if (feDatiTrasporto.getFEDatiTrasportoPesoLordo() > 0.0D) { + e = this.dom.createElement("PesoLordo"); + e.setTextContent(nfe.format(feDatiTrasporto.getFEDatiTrasportoPesoLordo())); + datiTrasporto.appendChild(e); + } + if (feDatiTrasporto.getFEDatiTrasportoPesoNetto() > 0.0D) { + e = this.dom.createElement("PesoNetto"); + e.setTextContent(nfe.format(feDatiTrasporto.getFEDatiTrasportoPesoNetto())); + datiTrasporto.appendChild(e); + } + if (feDatiTrasporto.getFEDatiTrasportoDataOraRitiro() != null) { + e = this.dom.createElement("DataOraRitiro"); + e.setTextContent(dTimef.format(feDatiTrasporto.getFEDatiTrasportoDataOraRitiro())); + datiTrasporto.appendChild(e); + } + if (feDatiTrasporto.getFEDatiTrasportoDataInizioTrasporto() != null) { + e = this.dom.createElement("DataInizioTrasporto"); + e.setTextContent(df.format(feDatiTrasporto.getFEDatiTrasportoDataInizioTrasporto())); + datiTrasporto.appendChild(e); + } + if (feDatiTrasporto.getFEDatiTrasportoTipoResa() != null && + !feDatiTrasporto.getFEDatiTrasportoTipoResa().isEmpty()) { + e = this.dom.createElement("TipoResa"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoTipoResa()); + datiTrasporto.appendChild(e); + } + if (feDatiTrasporto.getFEDatiTrasportoIndirizzoResa() != null) { + Element indirizzoResa = this.dom.createElement("IndirizzoResa"); + if (feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFEIndirizzo() != null && + !feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFEIndirizzo().isEmpty()) { + e = this.dom.createElement("Indirizzo"); + e.setTextContent(convertStringToXmlString( + feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFEIndirizzo(), 60)); + datiTrasporto.appendChild(e); + } else { + errMsg.append("Dati Trasporto Indirizzo Resa: indirizzo\n"); + } + if (feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFENumeroCivico() != null && + !feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFENumeroCivico().isEmpty()) { + e = this.dom.createElement("NumeroCivico"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFENumeroCivico()); + datiTrasporto.appendChild(e); + } else { + errMsg.append("Dati Trasporto Indirizzo Resa: Numero Civico\n"); + } + if (feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFECAP() != null && + !feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFECAP().isEmpty()) { + e = this.dom.createElement("CAP"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFECAP()); + datiTrasporto.appendChild(e); + } else { + errMsg.append("Dati Trasporto Indirizzo Resa: CAP\n"); + } + if (feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFEComune() != null && + !feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFEComune().isEmpty()) { + e = this.dom.createElement("Comune"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFEComune()); + datiTrasporto.appendChild(e); + } else { + errMsg.append("Dati Trasporto Indirizzo Resa: Comune\n"); + } + if (feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFEProvincia() != null && + !feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFEProvincia().isEmpty()) { + e = this.dom.createElement("Provincia"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFEProvincia().toUpperCase()); + datiTrasporto.appendChild(e); + } else { + errMsg.append("Dati Trasporto Indirizzo Resa: Provincia\n"); + } + if (feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFENazione() != null && + !feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFENazione().isEmpty()) { + e = this.dom.createElement("Nazione"); + e.setTextContent(feDatiTrasporto.getFEDatiTrasportoIndirizzoResa().getFENazione().toUpperCase()); + datiTrasporto.appendChild(e); + } else { + errMsg.append("Dati Trasporto Indirizzo Resa: Nazione\n"); + } + datiTrasporto.appendChild(indirizzoResa); + } + if (feDatiTrasporto.getFEDatiTrasportoDataOraConsegna() != null) { + e = this.dom.createElement("DataOraConsegna"); + e.setTextContent(dTimef.format(feDatiTrasporto.getFEDatiTrasportoDataOraConsegna())); + datiTrasporto.appendChild(e); + } + datiGenerali.appendChild(datiTrasporto); + } + FatturaElettronicaBody.appendChild(datiGenerali); + Element datiBeniServizi = this.dom.createElement("DatiBeniServizi"); + Vectumerator vecDL = bean.getFEDettaglioLinee(); + Vectumerator vecDLA = bean.getFEDettaglioLineeAltre(); + if ((vecDL != null && vecDL.hasMoreElements()) || (vecDLA != null && vecDLA.hasMoreElements())) { + Vectumerator> vectorDL = new Vectumerator(); + if (vecDL != null) + vectorDL.add(vecDL); + if (vecDLA != null) + vectorDL.add(vecDLA); + int numLinea = 0; + while (vectorDL.hasMoreElements()) { + Vectumerator currentVecDL = (Vectumerator)vectorDL.nextElement(); + while (currentVecDL.hasMoreElements()) { + FEDettaglioLineeInterface rowDettLinee = (FEDettaglioLineeInterface)currentVecDL.nextElement(); + Element dettaglioLinee = this.dom.createElement("DettaglioLinee"); + numLinea++; + e = this.dom.createElement("NumeroLinea"); + e.setTextContent(String.valueOf(numLinea)); + dettaglioLinee.appendChild(e); + if (rowDettLinee.getFETipoCessionePrestazione() != null && + !rowDettLinee.getFETipoCessionePrestazione().isEmpty()) + if (",SC,PR,AB,AC," + .indexOf("," + rowDettLinee.getFETipoCessionePrestazione() + ",") >= 0) { + e = this.dom.createElement("TipoCessionePrestazione"); + e.setTextContent(rowDettLinee.getFETipoCessionePrestazione()); + dettaglioLinee.appendChild(e); + } else { + errMsg.append("Dati Beni Servizi->DettaglioLinee: TipoCessionePrestazione diverso da ,SC,PR,AB,AC,\n"); + } + if (rowDettLinee.getFECodiceArticoloValore() != null && + !rowDettLinee.getFECodiceArticoloValore().isEmpty()) { + Element codiceArticolo = this.dom.createElement("CodiceArticolo"); + if (rowDettLinee.getFECodiceArticoloTipo() != null && + !rowDettLinee.getFECodiceArticoloTipo().isEmpty()) { + e = this.dom.createElement("CodiceTipo"); + e.setTextContent(convertStringToXmlString(rowDettLinee.getFECodiceArticoloTipo(), 35)); + codiceArticolo.appendChild(e); + } + e = this.dom.createElement("CodiceValore"); + e.setTextContent(convertStringToXmlString(rowDettLinee.getFECodiceArticoloValore(), 35)); + codiceArticolo.appendChild(e); + dettaglioLinee.appendChild(codiceArticolo); + } + if (rowDettLinee.getFEDescrizione() != null && !rowDettLinee.getFEDescrizione().isEmpty()) { + e = this.dom.createElement("Descrizione"); + e.setTextContent(convertStringToXmlString(rowDettLinee.getFEDescrizione(), 1000)); + dettaglioLinee.appendChild(e); + } else { + errMsg.append("Dati Beni Servizi->DettaglioLinee: Descrizione\n"); + } + if (rowDettLinee.getFEQuantita() > 0.0D) { + e = this.dom.createElement("Quantita"); + e.setTextContent(nfe.format(rowDettLinee.getFEQuantita())); + dettaglioLinee.appendChild(e); + } else { + errMsg.append("Dati Beni Servizi->DettaglioLinee: Quantita<=0\n"); + } + if (rowDettLinee.getFEUnitaMisura() != null && !rowDettLinee.getFEUnitaMisura().isEmpty()) { + e = this.dom.createElement("UnitaMisura"); + e.setTextContent(rowDettLinee.getFEUnitaMisura()); + dettaglioLinee.appendChild(e); + } + if (rowDettLinee.getFEDataInizioPeriodo() != null) { + e = this.dom.createElement("dataInizioPeriodo"); + e.setTextContent(df.format(rowDettLinee.getFEDataInizioPeriodo())); + dettaglioLinee.appendChild(e); + } + if (rowDettLinee.getFEDataFinePeriodo() != null) { + e = this.dom.createElement("DataFinePeriodo"); + e.setTextContent(df.format(rowDettLinee.getFEDataFinePeriodo())); + dettaglioLinee.appendChild(e); + } + if (rowDettLinee.getFEPrezzoUnitario() == 0.0D) + warnMsg.append("Dati Beni Servizi->DettaglioLinee: Prezzo Unitario=0\n"); + e = this.dom.createElement("PrezzoUnitario"); + e.setTextContent(nfe.format(rowDettLinee.getFEPrezzoUnitario())); + dettaglioLinee.appendChild(e); + Vectumerator vectumerator = rowDettLinee.getFEScontoMaggiorazione(); + if (vectumerator != null) + while (vectumerator.hasMoreElements()) { + FEScontoMaggiorazioneInterface rowScontoMaggiorazione = (FEScontoMaggiorazioneInterface)vectumerator.nextElement(); + Element scontoMaggiorazione = this.dom.createElement("ScontoMaggiorazione"); + if (",SC,MG," + .indexOf("," + rowScontoMaggiorazione.getFETipoScontoMagg() + ",") >= 0) { + e = this.dom.createElement("Tipo"); + e.setTextContent(rowScontoMaggiorazione.getFETipoScontoMagg()); + scontoMaggiorazione.appendChild(e); + } else { + errMsg.append("Dati Beni Servizi->DettaglioLinee>ScontoMaggiorazione: Tipo diverso da ,SC,MG,\n"); + } + if (rowScontoMaggiorazione.getFEPercentualeScontoMagg() <= 0.0D && + rowScontoMaggiorazione.getFEImportoScontoMagg() <= 0.0D) { + errMsg.append("Dati Beni Servizi->DettaglioLinee->ScontoMaggiorazione: percentuale o importo non impostato<=0\n"); + } else if (rowScontoMaggiorazione.getFEPercentualeScontoMagg() > 0.0D) { + e = this.dom.createElement("Percentuale"); + e.setTextContent( + nfe.format(rowScontoMaggiorazione.getFEPercentualeScontoMagg())); + scontoMaggiorazione.appendChild(e); + } else { + e = this.dom.createElement("Importo"); + e.setTextContent(nfe.format(rowScontoMaggiorazione.getFEImportoScontoMagg())); + scontoMaggiorazione.appendChild(e); + } + dettaglioLinee.appendChild(scontoMaggiorazione); + } + if (rowDettLinee.getFEPrezzoTotale() == 0.0D) + warnMsg.append("Dati Beni Servizi->DettaglioLinee: Prezzo Totale=0\n"); + e = this.dom.createElement("PrezzoTotale"); + e.setTextContent(nfe.format(rowDettLinee.getFEPrezzoTotale())); + dettaglioLinee.appendChild(e); + e = this.dom.createElement("AliquotaIVA"); + e.setTextContent(nfe.format(rowDettLinee.getFEAliquotaIva())); + dettaglioLinee.appendChild(e); + if (rowDettLinee.getFERitenuta() > 0.0D) { + e = this.dom.createElement("Ritenuta"); + e.setTextContent(nfe.format(rowDettLinee.getFERitenuta())); + dettaglioLinee.appendChild(e); + } + if (rowDettLinee.getFENatura() != null && !rowDettLinee.getFENatura().isEmpty()) { + if (rowDettLinee.getFEAliquotaIva() == 0.0D && ",N1,N2.1,N2.2,N3.1,N3.2,N3.3,N3.4,N3.5,N3.6,N4,N5,N6.1,N6.2,N6.3,N6.4,N6.5,N6.6,N6.7,N6.8,N6.9,N7," + .indexOf("," + rowDettLinee.getFENatura() + ",") >= 0) { + e = this.dom.createElement("Natura"); + e.setTextContent(rowDettLinee.getFENatura()); + dettaglioLinee.appendChild(e); + } else { + errMsg.append("Dati Beni Servizi->DettaglioLinee linea " + numLinea + ": Natura errata(,N1,N2.1,N2.2,N3.1,N3.2,N3.3,N3.4,N3.5,N3.6,N4,N5,N6.1,N6.2,N6.3,N6.4,N6.5,N6.6,N6.7,N6.8,N6.9,N7,) o aliquota iva >0\n"); + } + } else if (rowDettLinee.getFEAliquotaIva() == 0.0D) { + errMsg.append("Dati Beni Servizi->DettaglioLinee linea " + numLinea + ": Natura non impostata con aliquota iva = 0\n"); + } + if (rowDettLinee.getFERiferimentoAmministrazione() != null && + !rowDettLinee.getFERiferimentoAmministrazione().isEmpty()) { + e = this.dom.createElement("RiferimentoAmministrazione"); + e.setTextContent(nfe.format(rowDettLinee.getFERiferimentoAmministrazione())); + dettaglioLinee.appendChild(e); + } + if (bean.getFERiferimentoTipoDato() != null && !bean.getFERiferimentoTipoDato().isEmpty() && + bean.getFERiferimentoTesto() != null && !bean.getFERiferimentoTesto().isEmpty() && + bean.getFERiferimentoData() != null) + if ("INTENTO,NUMSCONTR".indexOf(bean.getFERiferimentoTipoDato()) >= 0) { + Element AltriDatiGestionali = this.dom.createElement("AltriDatiGestionali"); + e = this.dom.createElement("TipoDato"); + e.setTextContent(bean.getFERiferimentoTipoDato()); + AltriDatiGestionali.appendChild(e); + e = this.dom.createElement("RiferimentoTesto"); + e.setTextContent(bean.getFERiferimentoTesto()); + AltriDatiGestionali.appendChild(e); + e = this.dom.createElement("RiferimentoNumero"); + e.setTextContent(nfe.format(bean.getFERiferimentoNumero())); + AltriDatiGestionali.appendChild(e); + e = this.dom.createElement("RiferimentoData"); + e.setTextContent(df.format(bean.getFERiferimentoData())); + AltriDatiGestionali.appendChild(e); + dettaglioLinee.appendChild(AltriDatiGestionali); + } else { + errMsg.append("Dati Beni Servizi->AltriDatiGestionali linea " + numLinea + ": tipo dato " + + bean.getFERiferimentoTipoDato() + " non valido(INTENTO,NUMSCONTR) \n"); + } + datiBeniServizi.appendChild(dettaglioLinee); + } + } + } else { + errMsg.append("Dati Beni e servizi: Non ci sono Dettaglio Linee!\n"); + } + Vectumerator vecDR = bean.getFEDatiRiepilogo(); + if (vecDR != null && vecDR.hasMoreElements()) { + while (vecDR.hasMoreElements()) { + FEDatiRiepilogoInterface rowDatiRiepilogo = (FEDatiRiepilogoInterface)vecDR.nextElement(); + Element datiRiepilogo = this.dom.createElement("DatiRiepilogo"); + e = this.dom.createElement("AliquotaIVA"); + e.setTextContent(nfe.format(rowDatiRiepilogo.getFEAliquotaIva())); + datiRiepilogo.appendChild(e); + if (rowDatiRiepilogo.getFENatura() != null && !rowDatiRiepilogo.getFENatura().isEmpty()) + if (rowDatiRiepilogo.getFEAliquotaIva() == 0.0D && ",N1,N2.1,N2.2,N3.1,N3.2,N3.3,N3.4,N3.5,N3.6,N4,N5,N6.1,N6.2,N6.3,N6.4,N6.5,N6.6,N6.7,N6.8,N6.9,N7," + .indexOf("," + rowDatiRiepilogo.getFENatura() + ",") >= 0) { + e = this.dom.createElement("Natura"); + e.setTextContent(rowDatiRiepilogo.getFENatura()); + datiRiepilogo.appendChild(e); + } else { + errMsg.append("Dati Beni Servizi->DatiRiepilogo: Natura errata(,N1,N2.1,N2.2,N3.1,N3.2,N3.3,N3.4,N3.5,N3.6,N4,N5,N6.1,N6.2,N6.3,N6.4,N6.5,N6.6,N6.7,N6.8,N6.9,N7,) o aliquota iva >0\n"); + } + if (rowDatiRiepilogo.getFESpeseAccessorie() > 0.0D) { + e = this.dom.createElement("SpeseAccessorie"); + e.setTextContent(nfe.format(rowDatiRiepilogo.getFESpeseAccessorie())); + datiRiepilogo.appendChild(e); + } + if (rowDatiRiepilogo.getFEArrotondamento() > 0.0D) { + e = this.dom.createElement("Arrotondamento"); + e.setTextContent(nfe.format(rowDatiRiepilogo.getFEArrotondamento())); + datiRiepilogo.appendChild(e); + } + e = this.dom.createElement("ImponibileImporto"); + e.setTextContent(nfe.format(rowDatiRiepilogo.getFEImponibileImporto())); + datiRiepilogo.appendChild(e); + e = this.dom.createElement("Imposta"); + e.setTextContent(nfe.format(rowDatiRiepilogo.getFEImposta())); + datiRiepilogo.appendChild(e); + if (rowDatiRiepilogo.getFEEsigibilitaIva() != null && + !rowDatiRiepilogo.getFEEsigibilitaIva().isEmpty()) + if (",I,D,S,".indexOf("," + rowDatiRiepilogo.getFEEsigibilitaIva() + ",") >= 0) { + if (rowDatiRiepilogo.getFEEsigibilitaIva().equals("S") && + rowDatiRiepilogo.equals("N6")) { + errMsg.append("Dati Beni Servizi->Dati Riepilogo: Esigibilita IVA impostata a Scissione ma la natura non e' inversione contabile (N6)\n"); + } else { + e = this.dom.createElement("EsigibilitaIVA"); + e.setTextContent(rowDatiRiepilogo.getFEEsigibilitaIva()); + datiRiepilogo.appendChild(e); + } + } else { + errMsg.append("Dati Beni Servizi->Dati Riepilogo: Esigibilita IVA errata(,I,D,S,)\n"); + } + if (rowDatiRiepilogo.getFERiferimentoNormativo() != null && + !rowDatiRiepilogo.getFERiferimentoNormativo().isEmpty()) { + e = this.dom.createElement("RiferimentoNormativo"); + e.setTextContent(convertStringToXmlString(rowDatiRiepilogo.getFERiferimentoNormativo(), 100)); + datiRiepilogo.appendChild(e); + } + datiBeniServizi.appendChild(datiRiepilogo); + } + } else { + errMsg.append("Dati Beni e servizi: Non ci sono dettagli di riepilogo!\n"); + } + FatturaElettronicaBody.appendChild(datiBeniServizi); + Vectumerator vecDP = bean.getFEDatiPagamento(); + if (vecDP != null) + while (vecDP.hasMoreElements()) { + FEDatiPagamento rowDatiPagamento = (FEDatiPagamento)vecDP.nextElement(); + Element datiPagamento = this.dom.createElement("DatiPagamento"); + if (",TP01,TP02,TP03,".indexOf("," + rowDatiPagamento.getCondizioniPagamento() + ",") < 0) + errMsg.append("Dati Pagamento: Condizioni pagamento diversi da +,TP01,TP02,TP03,\n"); + e = this.dom.createElement("CondizioniPagamento"); + e.setTextContent(rowDatiPagamento.getCondizioniPagamento()); + datiPagamento.appendChild(e); + Vectumerator vecDettaglioPagamento = rowDatiPagamento.getVecDettaglioPagamento(); + if (vecDettaglioPagamento.getTotNumberOfRecords() == 0) + errMsg.append("Dati Pagamento: Non ci sono dettagli Pagamenti\n"); + while (vecDettaglioPagamento.hasMoreElements()) { + FEDettaglioPagamento rowDettaglioPagamento = (FEDettaglioPagamento)vecDettaglioPagamento.nextElement(); + Element dettaglioPagamento = this.dom.createElement("DettaglioPagamento"); + if (!rowDettaglioPagamento.getBeneficiario().isEmpty()) { + e = this.dom.createElement("Beneficiario"); + e.setTextContent(convertStringToXmlString(rowDettaglioPagamento.getBeneficiario(), 200)); + dettaglioPagamento.appendChild(e); + } + if (",MP01,MP02,MP03,MP04,MP05,MP06,MP07,MP08,MP00,MP10,MP11,MP12,MP13,MP14,MP15,MP16,MP17,MP18,MP19,MP20,MP21,MP22,".indexOf("," + rowDettaglioPagamento.getModalitaPagamento() + ",") < 0) + errMsg.append("Dati Pagamento -> Dettaglio Pagamento: Modalita pagamento diversi da +,MP01,MP02,MP03,MP04,MP05,MP06,MP07,MP08,MP00,MP10,MP11,MP12,MP13,MP14,MP15,MP16,MP17,MP18,MP19,MP20,MP21,MP22,\n"); + e = this.dom.createElement("ModalitaPagamento"); + e.setTextContent(rowDettaglioPagamento.getModalitaPagamento()); + dettaglioPagamento.appendChild(e); + if (rowDettaglioPagamento.getDataScadenzaPagamento() != null) { + e = this.dom.createElement("DataScadenzaPagamento"); + e.setTextContent(df.format(rowDettaglioPagamento.getDataScadenzaPagamento())); + dettaglioPagamento.appendChild(e); + } + if (rowDettaglioPagamento.getImportoPagamento() < 0.0D) + errMsg.append("Dati Pagamento -> Dettaglio Pagamento: importo pagamento <=0: " + + rowDettaglioPagamento.getImportoPagamento() + "\n"); + e = this.dom.createElement("ImportoPagamento"); + e.setTextContent(nfe.format(rowDettaglioPagamento.getImportoPagamento())); + dettaglioPagamento.appendChild(e); + if (!rowDettaglioPagamento.getIstitutoFinanziario().isEmpty()) { + e = this.dom.createElement("IstitutoFinanziario"); + e.setTextContent(rowDettaglioPagamento.getIstitutoFinanziario()); + dettaglioPagamento.appendChild(e); + } + if (!rowDettaglioPagamento.getIBAN().isEmpty()) { + e = this.dom.createElement("IBAN"); + e.setTextContent(rowDettaglioPagamento.getIBAN()); + dettaglioPagamento.appendChild(e); + } + if (!rowDettaglioPagamento.getABI().isEmpty()) { + e = this.dom.createElement("ABI"); + e.setTextContent(rowDettaglioPagamento.getABI()); + dettaglioPagamento.appendChild(e); + } + if (!rowDettaglioPagamento.getCAB().isEmpty()) { + e = this.dom.createElement("CAB"); + e.setTextContent(rowDettaglioPagamento.getCAB()); + dettaglioPagamento.appendChild(e); + } + if (!rowDettaglioPagamento.getBIC().isEmpty()) { + e = this.dom.createElement("BIC"); + e.setTextContent(rowDettaglioPagamento.getBIC()); + dettaglioPagamento.appendChild(e); + } + datiPagamento.appendChild(dettaglioPagamento); + } + FatturaElettronicaBody.appendChild(datiPagamento); + } + if (bean.getFEAllegatiInterface() != null) { + Element allegati = this.dom.createElement("Allegati"); + if (bean.getFEAllegatiInterface().getFENomeAttachment() != null && + !bean.getFEAllegatiInterface().getFENomeAttachment().isEmpty()) { + e = this.dom.createElement("NomeAttachment"); + e.setTextContent(bean.getFEAllegatiInterface().getFENomeAttachment()); + allegati.appendChild(e); + } else { + errMsg.append("Allegati: Nome Attachment\n"); + } + if (bean.getFEAllegatiInterface().getFEAlgoritmoCompressione() != null && + !bean.getFEAllegatiInterface().getFEAlgoritmoCompressione().isEmpty()) { + e = this.dom.createElement("AlgoritmoCompressione"); + e.setTextContent(bean.getFEAllegatiInterface().getFEAlgoritmoCompressione()); + allegati.appendChild(e); + } else { + errMsg.append("Allegati: Algoritmo Compressione\n"); + } + if (bean.getFEAllegatiInterface().getFEFormatoAttachment() != null && + !bean.getFEAllegatiInterface().getFEFormatoAttachment().isEmpty()) { + e = this.dom.createElement("FormatoAttachment"); + e.setTextContent(bean.getFEAllegatiInterface().getFEFormatoAttachment()); + allegati.appendChild(e); + } else { + errMsg.append("Allegati: Formato Attachment\n"); + } + if (bean.getFEAllegatiInterface().getFEDescrizioneAttachment() != null && + !bean.getFEAllegatiInterface().getFEDescrizioneAttachment().isEmpty()) { + e = this.dom.createElement("DescrizioneAttachment"); + e.setTextContent(bean.getFEAllegatiInterface().getFEDescrizioneAttachment()); + allegati.appendChild(e); + } else { + errMsg.append("Allegati: Descrizione Attachment\n"); + } + if (bean.getFEAllegatiInterface().getFEFileAttachment() != null && + !bean.getFEAllegatiInterface().getFEFileAttachment().isEmpty()) { + if (new File(bean.getFEAllegatiInterface().getFEFileAttachment()).exists()) { + e = this.dom.createElement("FileAttachment"); + e.setTextContent( + DBAdapter.getBase64StringFromFile(bean.getFEAllegatiInterface().getFEFileAttachment())); + allegati.appendChild(e); + } else { + errMsg.append("Allegati: File Attachment non trovato!!\n"); + } + } else { + errMsg.append("Allegati: File Attachment\n"); + } + FatturaElettronicaBody.appendChild(allegati); + } + this.rootElement.appendChild(FatturaElettronicaBody); + this.dom.appendChild(this.rootElement); + Node pi = this.dom.createProcessingInstruction("xml-stylesheet", " type=\"text/xsl\" href=\"fatturaordinaria_v1.2.1.xsl\""); + this.dom.insertBefore(pi, this.rootElement); + if (warnMsg.length() > 0) + rp.setInfoMsg(bean.getFENumeroDocumento() + ": " + bean.getFENumeroDocumento()); + if (errMsg.length() > 0) { + rp.setStatus(false); + rp.setMsg(bean.getFENumeroDocumento() + ": " + bean.getFENumeroDocumento()); + return rp; + } + Transformer tr = TransformerFactory.newInstance().newTransformer(); + tr.setOutputProperty("indent", "yes"); + tr.setOutputProperty("method", "xml"); + tr.setOutputProperty("encoding", "UTF-8"); + tr.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + File xmlFile = new File(getFullFileXml(bean, parmSfx)); + String theDir = xmlFile.getAbsolutePath().substring(0, xmlFile.getAbsolutePath().lastIndexOf(File.separator) + 1); + DBAdapter.checkAndMakeDir(theDir); + tr.transform(new DOMSource(this.dom), new StreamResult(new FileOutputStream(new File(getFullFileXml(bean, parmSfx))))); + rp.setStatus(true); + this.isBuildOk = true; + bean.setFEAggiornaTmstFileXml(); + } catch (ParserConfigurationException|javax.xml.transform.TransformerFactoryConfigurationError|java.io.FileNotFoundException|javax.xml.transform.TransformerException pce) { + rp.setStatus(false); + rp.setMsg("BuildXml: Error trying to instantiate DocumentBuilder " + String.valueOf(pce)); + System.out.println(rp.getMsg()); + } + return rp; + } + + public ResParm getXmlFile(boolean fullPath, String parmSfx) { + ResParm rp = new ResParm(); + StringBuilder warnMsg = new StringBuilder(); + if (getVecFatture() == null) { + StatusMsg.updateMsgByTag(this.fattura.getApFull(), "Xml fatt. elett.", "Documento " + getFattura().getFENumeroDocumento()); + rp = buildOneXml(getFattura(), parmSfx); + if (rp.getStatus()) + if (fullPath) { + rp.setMsg(getFullFileXml(getFattura(), parmSfx)); + } else { + rp.setMsg(getFileXmlToDocbase(getFattura(), parmSfx)); + } + } else { + Calendar cal = Calendar.getInstance(); + String timeInMils = String.valueOf(cal.getTimeInMillis()); + String zipFIle = getFattura().getDocBase() + getFattura().getDocBase() + getFattura().getPathTmp() + ".zip"; + String tempDir = getFattura().getDocBase() + getFattura().getDocBase() + getFattura().getPathTmp() + "/"; + DBAdapter.checkAndMakeDir(tempDir); + try { + while (this.vecFatture.hasMoreElements()) { + FatturaElettronicaInterface row = (FatturaElettronicaInterface)this.vecFatture.nextElement(); + StatusMsg.updateMsgByTag(this.fattura.getApFull(), "Xml fatt. elett.", "File zip: Documento " + row.getFENumeroDocumento()); + if (row.isFatturaElettronicaGenerabile()) { + if (row.getTmstInvioXml() == null) { + rp = buildOneXml(row, parmSfx); + } else { + rp.setStatus(true); + warnMsg.append("Attenzione! Documento " + row.getFENumeroDocumento() + " impostato a File Xml Inviato! XML Non rigenerato"); + } + } else { + rp.setStatus(true); + warnMsg.append("Attenzione! Documento " + row.getFENumeroDocumento() + " Xml non generabile!"); + } + if (rp.getStatus()) { + DBAdapter.copyFile(getFullFileXml(row, parmSfx), tempDir + tempDir); + warnMsg.append(rp.getInfoMsg()); + } + } + } catch (Exception e) { + rp.setStatus(false); + rp.setMsg(e); + } + if (rp.getStatus()) { + File dirTmp = new File(tempDir); + rp.setStatus(DBAdapter.zipDir(dirTmp, zipFIle, false)); + if (rp.getStatus()) + rp.setMsg(zipFIle.substring(getFattura().getDocBase().length())); + } + } + StatusMsg.deleteMsgByTag(this.fattura.getApFull(), "Xml fatt. elett."); + if (warnMsg.length() > 0) + rp.setInfoMsg(warnMsg.toString()); + return rp; + } + + public ResParm getXmlFile(boolean fullPath) { + return getXmlFile(fullPath, getFattura().getFEParmSfx()); + } + + private String getZipFile() { + boolean ok = true; + return null; + } + + private SimpleDateFormat getDataFormat() { + if (this.df == null) + this.df = new SimpleDateFormat("yyyy-MM-dd"); + return this.df; + } + + private DecimalFormat getDecimalFormat() { + if (this.nf == null) { + NumberFormat nf1 = NumberFormat.getNumberInstance(Locale.US); + this.nf = (DecimalFormat)nf1; + this.nf.applyPattern("###.00"); + } + return this.nf; + } + + public static ResParm validate730PrecompilateSchema(String xmlPath, String xsdPath) { + ResParm rp = new ResParm(true); + try { + SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); + Schema schema = factory.newSchema(new File(xsdPath)); + Validator validator = schema.newValidator(); + validator.validate(new StreamSource(new File(xmlPath))); + } catch (Exception e) { + rp.setException(e); + rp.setMsg(e.getMessage()); + rp.setStatus(false); + System.out.println("Exception: " + e.getMessage()); + } + return rp; + } + + private FatturaElettronicaInterface getFattura() { + return this.fattura; + } + + private String getFelettParm(String theKey) { + return this.fattura.getApFull().getParm(theKey).getTesto(); + } + + private boolean isFelettParm(String theKey) { + return this.fattura.getApFull().getParm(theKey).isTrue(); + } + + private ResParm checkDatiObbligatori(FatturaElettronicaInterface bean, String parmSfx) { + ResParm rp = new ResParm(); + StringBuilder errMsg = new StringBuilder(); + if (!bean.getFEDatiAnagraficiCessionario().getFEPaese().isEmpty() && + !bean.getFEDatiAnagraficiCessionario().getFEPaese().equals("IT") && !isFelettParm("FELETT_XML_ESTERO_SI" + parmSfx)) { + rp.setStatus(true); + return rp; + } + if (getFelettParm("FELETT_TRASM_ID_PAESE" + parmSfx).isEmpty() || getFelettParm("FELETT_TRASM_ID_PAESE" + parmSfx).length() != 2) + errMsg.append("FELETT_TRASM_ID_PAESE" + parmSfx + ": nullo o errato\n"); + if (getFelettParm("FELETT_TRASM_ID_CODICE" + parmSfx).isEmpty() || (getFelettParm("FELETT_TRASM_ID_CODICE" + parmSfx).length() != 16 && + getFelettParm("FELETT_TRASM_ID_CODICE" + parmSfx).length() != 11)) + errMsg.append("FELETT_TRASM_ID_CODICE" + parmSfx + ": nullo o errato\n"); + if (bean.getFEProgressivo().length() > 10) + errMsg.append("Lunghezza Progressivo invio >10\n"); + if (getFelettParm("FELETT_CEDENTE_ID_PAESE" + parmSfx).isEmpty() || + getFelettParm("FELETT_CEDENTE_ID_PAESE" + parmSfx).length() != 2) + errMsg.append("FELETT_CEDENTE_ID_PAESE" + parmSfx + ": nullo o errato\n"); + if (getFelettParm("FELETT_CEDENTE_ID_CODICE" + parmSfx).isEmpty() || ( + getFelettParm("FELETT_CEDENTE_ID_CODICE" + parmSfx).length() != 16 && + getFelettParm("FELETT_CEDENTE_ID_CODICE" + parmSfx).length() != 11)) + errMsg.append("FELETT_CEDENTE_ID_CODICE" + parmSfx + ": nullo o errato\n"); + if (getFelettParm("FELETT_CEDENTE_COD_FISC" + parmSfx).isEmpty() || ( + getFelettParm("FELETT_CEDENTE_COD_FISC" + parmSfx).length() != 16 && + getFelettParm("FELETT_CEDENTE_COD_FISC" + parmSfx).length() != 11)) + errMsg.append("FELETT_CEDENTE_COD_FISC" + parmSfx + ": nullo o errato\n"); + if (getFelettParm("FELETT_CEDENTE_DENOMINAZIONE" + parmSfx).isEmpty() && + getFelettParm("FELETT_CEDENTE_COGNOME" + parmSfx).isEmpty()) + errMsg.append("FELETT_CEDENTE_DENOMINAZIONE" + parmSfx + " o FELETT_CEDENTE_COGNOME" + parmSfx + ": nullo o errato\n"); + if (getFelettParm("FELETT_CEDENTE_DENOMINAZIONE" + parmSfx).length() > 80) + errMsg.append("FELETT_CEDENTE_DENOMINAZIONE" + parmSfx + " > 80 caratteri\n"); + if (getFelettParm("FELETT_CEDENTE_COGNOME" + parmSfx).length() > 60) + errMsg.append("FELETT_CEDENTE_COGNOME" + parmSfx + " > 60 caratteri\n"); + if (getFelettParm("FELETT_CEDENTE_NOME" + parmSfx).length() > 60) + errMsg.append("FELETT_CEDENTE_NOME" + parmSfx + " > 60 caratteri\n"); + if (!getFelettParm("FELETT_CEDENTE_COD_EORI" + parmSfx).isEmpty() && ( + getFelettParm("FELETT_CEDENTE_COD_EORI" + parmSfx).length() < 13 || + getFelettParm("FELETT_CEDENTE_COD_EORI" + parmSfx).length() > 17)) + errMsg.append("FELETT_CEDENTE_COD_EORI" + parmSfx + ": lunghezza errata (13....17)\n"); + if (getFelettParm("FELETT_CEDENTE_REGIME_FISCALE" + parmSfx).isEmpty() || ",RF01,RF02,RF04,RF05R,F06,RF07,RF08,RF09,RF10,RF11,RF12,RF13,RF14,RF15,RF16,RF17,RF18,RF19," + .indexOf("," + getFelettParm("FELETT_CEDENTE_REGIME_FISCALE" + parmSfx) + ",") < 0) + errMsg.append("FELETT_CEDENTE_REGIME_FISCALE" + parmSfx + ": nullo o errato (codice RF non riconosciuto. Vedi note\n"); + if (getFelettParm("FELETT_CEDENTE_SEDE_INDIRIZZO" + parmSfx).isEmpty()) + errMsg.append("FELETT_CEDENTE_SEDE_INDIRIZZO" + parmSfx + ": nullo o errato \n"); + if (getFelettParm("FELETT_CEDENTE_SEDE_NUM_CIV" + parmSfx).isEmpty()) + errMsg.append("FELETT_CEDENTE_SEDE_NUM_CIV" + parmSfx + ": nullo o errato \n"); + if (getFelettParm("FELETT_CEDENTE_SEDE_NUM_CIV" + parmSfx).length() > 8) + errMsg.append("FELETT_CEDENTE_SEDE_NUM_CIV" + parmSfx + ": > 8 caratteri \n"); + if (getFelettParm("FELETT_CEDENTE_SEDE_CAP" + parmSfx).isEmpty()) + errMsg.append("FELETT_CEDENTE_SEDE_CAP" + parmSfx + ": nullo o errato \n"); + if (getFelettParm("FELETT_CEDENTE_SEDE_COMUNE" + parmSfx).isEmpty()) + errMsg.append("FELETT_CEDENTE_SEDE_COMUNE" + parmSfx + ": nullo o errato \n"); + if (getFelettParm("FELETT_CEDENTE_SEDE_PROV" + parmSfx).isEmpty() || + getFelettParm("FELETT_CEDENTE_SEDE_PROV" + parmSfx).length() != 2) + errMsg.append("FELETT_CEDENTE_SEDE_PROV" + parmSfx + ": nullo o errato (lunghezza !=2) \n"); + if (getFelettParm("FELETT_CEDENTE_SEDE_NAZIONE" + parmSfx).isEmpty()) + errMsg.append("FELETT_CEDENTE_SEDE_NAZIONE" + parmSfx + ": nullo o errato \n"); + if (bean.getFEDatiAnagraficiCessionario().getFEPaese().isEmpty() || + bean.getFEDatiAnagraficiCessionario().getFEPaese().length() != 2) + errMsg.append("Cessionario Paese nulla o errata\n"); + if (bean.getFEDatiAnagraficiCessionario().getFEPaese().equals("IT") && ( + bean.getFEDatiAnagraficiCessionario().getFECodiceFiscale().isEmpty() || ( + bean.getFEDatiAnagraficiCessionario().getFECodiceFiscale().length() != 16 && + bean.getFEDatiAnagraficiCessionario().getFECodiceFiscale().length() != 11))) + errMsg.append("Cessionario IT Codice fiscale errato\n"); + if (bean.getFEDatiAnagraficiCessionario().getFEDenominazione().isEmpty() && + bean.getFEDatiAnagraficiCessionario().getFECognome().isEmpty() && + bean.getFEDatiAnagraficiCessionario().getFENome().isEmpty()) + errMsg.append("Cessionario Denominazione e/o Cognome devono essere non nulli\n"); + if (bean.getFEDatiAnagraficiCessionario().getFEDenominazione() != null && + !bean.getFEDatiAnagraficiCessionario().getFEDenominazione().isEmpty()) { + if (bean.getFEDatiAnagraficiCessionario().getFEDenominazione().length() > 80) + errMsg.append("Cessionario Denominazione > 80 caratteri\n"); + } else { + if (bean.getFEDatiAnagraficiCessionario().getFECognome().length() > 60) + errMsg.append("Cessionario Cognome > 60 caratteri\n"); + if (bean.getFEDatiAnagraficiCessionario().getFENome().length() > 60) + errMsg.append("Cessionario Nome > 60 caratteri\n"); + } + if (bean.getFESedeCessonario().getFEIndirizzo().isEmpty()) + errMsg.append("Cessionario Sede Indirizzo\n"); + if (bean.getFESedeCessonario().getFENumeroCivico().isEmpty()) + errMsg.append("Cessionario Sede numero civico\n"); + if (bean.getFESedeCessonario().getFENumeroCivico().length() > 8) + errMsg.append("Cessionario Sede numero civico > 8 caratteri\n"); + if (bean.getFEDatiAnagraficiCessionario().getFEPaese().equals("IT")) { + if (bean.getFESedeCessonario().getFECAP().isEmpty()) + errMsg.append("Cessionario Sede Cap\n"); + if (bean.getFESedeCessonario().getFECAP().length() > 5) + errMsg.append("Cessionario Sede CAP > 5 caratteri\n"); + } + if (bean.getFESedeCessonario().getFEComune().isEmpty()) + errMsg.append("Cessionario Sede Comune\n"); + if (bean.getFEDatiAnagraficiCessionario().getFEPaese().equals("IT") && ( + bean.getFESedeCessonario().getFEProvincia().isEmpty() || bean.getFESedeCessonario().getFEProvincia().length() != 2)) + errMsg.append("Cessionario Sede Provincia vuota o di lunghezza diversa da 2\n"); + if (bean.getFESedeCessonario().getFENazione().isEmpty()) + errMsg.append("Cessionario Sede Nazione\n"); + if (bean.getFETipoDocumento().isEmpty()) + errMsg.append("Dati Generali Tipo Documento\n"); + if (bean.getFEDivisa().isEmpty()) + errMsg.append("Dati Generali Divisa\n"); + if (bean.getFeDataDocumento() == null) + errMsg.append("Dati Generali Data Documento\n"); + if (bean.getFENumeroDocumento().isEmpty()) + errMsg.append("Dati Generali Numero Documento\n"); + if (bean.getFeBolloVirtuale() != null && !bean.getFeBolloVirtuale().isEmpty() && ( + !bean.getFeBolloVirtuale().equals("SI") || bean.getFEImportoBollo() <= 0.0D)) + errMsg.append("Dati Generali Dati bollo errati\n"); + if (errMsg.length() > 0) { + rp.setStatus(false); + rp.setMsg(bean.getFENumeroDocumento() + ": " + bean.getFENumeroDocumento()); + } else { + rp.setStatus(true); + } + return rp; + } + + private Vectumerator getVecFatture() { + return this.vecFatture; + } + + private Vectumerator processaLineeRegimeMargine(Vectumerator vecDL) { + Vectumerator vecDLRes = new Vectumerator(); + while (vecDL.hasMoreElements()) { + FEDettaglioLineeInterface row = (FEDettaglioLineeInterface)vecDL.nextElement(); + if (row.getFENatura().equals("N5")) { + FEDettaglioLinea rowN5 = clonaDettaglioLineaInterface(row); + rowN5.setFEPrezzoUnitario(row.getFECostoArticolo()); + if (row.getFEQuantita() == 1.0D) { + rowN5.setFEPrezzoTotale(row.getFECostoArticolo()); + } else { + DoubleOperator dop = new DoubleOperator(row.getFECostoArticolo()); + dop.setScale(2, 5); + dop.multiply(row.getFEQuantita()); + rowN5.setFEPrezzoTotale(dop.getResult()); + } + vecDLRes.add(rowN5); + FEDettaglioLinea row22 = clonaDettaglioLineaInterface(row); + DoubleOperator dopImpo = new DoubleOperator(row.getFEPrezzoUnitario()); + dopImpo.setScale(2, 5); + dopImpo.subtract(row.getFECostoArticolo()); + double imponibile = Iva.scorporaIva(dopImpo.getResult(), 22.0D); + row22.setFEPrezzoUnitario(imponibile); + if (row.getFEQuantita() == 1.0D) { + row22.setFEPrezzoTotale(imponibile); + } else { + DoubleOperator dop = new DoubleOperator(imponibile); + dop.setScale(2, 5); + dop.multiply(row.getFEQuantita()); + row22.setFEPrezzoTotale(dop.getResult()); + } + row22.setFENatura(""); + row22.setFEAliquotaIva(22.0D); + vecDLRes.add(row22); + continue; + } + vecDLRes.add(row); + } + return vecDLRes; + } + + private FEDettaglioLinea clonaDettaglioLineaInterface(FEDettaglioLineeInterface row) { + FEDettaglioLinea rowClonata = new FEDettaglioLinea(); + rowClonata.setFEAliquotaIva(row.getFEAliquotaIva()); + rowClonata.setFECodiceArticoloTipo(row.getFECodiceArticoloTipo()); + rowClonata.setFECodiceArticoloValore(row.getFECodiceArticoloValore()); + rowClonata.setFECostoArticolo(row.getFECostoArticolo()); + rowClonata.setFEDataFinePeriodo(row.getFEDataFinePeriodo()); + rowClonata.setFEDataInizioPeriodo(row.getFEDataInizioPeriodo()); + rowClonata.setFEDescrizione(row.getFEDescrizione()); + rowClonata.setFENatura(row.getFENatura()); + rowClonata.setFEPrezzoTotale(row.getFEPrezzoTotale()); + rowClonata.setFEPrezzoUnitario(row.getFEPrezzoUnitario()); + rowClonata.setFEQuantita(row.getFEQuantita()); + rowClonata.setFERiferimentoAmministrazione(row.getFERiferimentoAmministrazione()); + rowClonata.setFERitenuta(row.getFERitenuta()); + rowClonata.setFEScontoMaggiorazione(row.getFEScontoMaggiorazione()); + rowClonata.setFETipoCessionePrestazione(row.getFETipoCessionePrestazione()); + rowClonata.setFEUnitaMisura(row.getFEUnitaMisura()); + return rowClonata; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/_FeXmlAdapter.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/_FeXmlAdapter.java new file mode 100644 index 00000000..8fb6f3f4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/fattele/_FeXmlAdapter.java @@ -0,0 +1,928 @@ +package it.acxent.fattele; + +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.security.cert.CertificateFactory; +import java.security.cert.X509Certificate; +import java.sql.Date; +import java.util.Calendar; +import java.util.Hashtable; +import java.util.Map; +import javax.crypto.Cipher; +import org.apache.commons.lang3.StringEscapeUtils; + +public class _FeXmlAdapter { + private Cipher cipher = null; + + private X509Certificate certificate = null; + + private static final Hashtable xmlReplaceCodes = new Hashtable<>(); + + public static final String P_FELETT_PATH_FATTURE_REL = "FELETT_PATH_FATTURE_REL"; + + public static final String P_FELETT_TRASM_ID_PAESE = "FELETT_TRASM_ID_PAESE"; + + public static final String P_FELETT_TRASM_ID_CODICE = "FELETT_TRASM_ID_CODICE"; + + public static final String P_FELETT_TRASM_CONTATTO_TELEFONO = "FELETT_TRASM_CONTATTO_TELEFONO"; + + public static final String P_FELETT_TRASM_CONTATTO_EMAIL = "FELETT_TRASM_CONTATTO_EMAIL"; + + public static final String P_FELETT_CEDENTE_ID_PAESE = "FELETT_CEDENTE_ID_PAESE"; + + public static final String P_FELETT_CEDENTE_ID_CODICE = "FELETT_CEDENTE_ID_CODICE"; + + public static final String P_FELETT_CEDENTE_COD_FISC = "FELETT_CEDENTE_COD_FISC"; + + public static final String P_FELETT_CEDENTE_DENOMINAZIONE = "FELETT_CEDENTE_DENOMINAZIONE"; + + public static final String P_FELETT_CEDENTE_NOME = "FELETT_CEDENTE_NOME"; + + public static final String P_FELETT_CEDENTE_COGNOME = "FELETT_CEDENTE_COGNOME"; + + public static final String P_FELETT_CEDENTE_TITOLO = "FELETT_CEDENTE_TITOLO"; + + public static final String P_FELETT_XML_ESTERO_SI = "FELETT_XML_ESTERO_SI"; + + public static final String P_FELETT_CEDENTE_SEDE_INDIRIZZO = "FELETT_CEDENTE_SEDE_INDIRIZZO"; + + public static final String P_FELETT_CEDENTE_SEDE_NUM_CIV = "FELETT_CEDENTE_SEDE_NUM_CIV"; + + public static final String P_FELETT_CEDENTE_SEDE_CAP = "FELETT_CEDENTE_SEDE_CAP"; + + public static final String P_FELETT_CEDENTE_SEDE_COMUNE = "FELETT_CEDENTE_SEDE_COMUNE"; + + public static final String P_FELETT_CEDENTE_SEDE_PROV = "FELETT_CEDENTE_SEDE_PROV"; + + public static final String P_FELETT_CEDENTE_SEDE_NAZIONE = "FELETT_CEDENTE_SEDE_NAZIONE"; + + public static final String P_FELETT_CEDENTE_STAB_ORG_INDIRIZZO = "FELETT_CEDENTE_STAB_ORG_INDIRIZZO"; + + public static final String P_FELETT_CEDENTE_STAB_ORG_NUMERO_CIVICO = "FELETT_CEDENTE_STAB_ORG_NUMERO_CIVICO"; + + public static final String P_FELETT_CEDENTE_STAB_ORG_CAP = "FELETT_CEDENTE_STAB_ORG_CAP"; + + public static final String P_FELETT_CEDENTE_STAB_ORG_COMUNE = "FELETT_CEDENTE_STAB_ORG_COMUNE"; + + public static final String P_FELETT_CEDENTE_STAB_ORG_PROVINCIA = "FELETT_CEDENTE_STAB_ORG_PROVINCIA"; + + public static final String P_FELETT_CEDENTE_STAB_ORG_NAZIONE = "FELETT_CEDENTE_STAB_ORG_NAZIONE"; + + public static final String P_FELETT_CEDENTE_RAPP_FISC_ID_PAESE = "FELETT_CEDENTE_RAPP_FISC_ID_PAESE"; + + public static final String P_FELETT_CEDENTE_RAPP_FISC_ID_CODICE = "FELETT_CEDENTE_RAPP_FISC_ID_CODICE"; + + public static final String P_FELETT_CEDENTE_RAPP_FISC_COD_FISC = "FELETT_CEDENTE_RAPP_FISC_COD_FISC"; + + public static final String P_FELETT_CEDENTE_RAPP_FISC_DENOMINAZIONE = "FELETT_CEDENTE_RAPP_FISC_DENOMINAZIONE"; + + public static final String P_FELETT_CEDENTE_RAPP_FISC_NOME = "FELETT_CEDENTE_RAPP_FISC_NOME"; + + public static final String P_FELETT_CEDENTE_RAPP_FISC_COGNOME = "FELETT_CEDENTE_RAPP_FISC_COGNOME"; + + public static final String P_FELETT_CEDENTE_RAPP_FISC_TITOLO = "FELETT_CEDENTE_RAPP_FISC_TITOLO"; + + public static final String P_FELETT_CEDENTE_RAPP_FISC_COD_EORI = "FELETT_CEDENTE_RAPP_FISC_COD_EORI"; + + public static final String P_FELETT_CEDENTE_ISCR_REA_UFFICIO = "FELETT_CEDENTE_ISCR_REA_UFFICIO"; + + public static final String P_FELETT_CEDENTE_ISCR_REA_NUMERO_REA = "FELETT_CEDENTE_ISCR_REA_NUMERO_REA"; + + public static final String P_FELETT_CEDENTE_ISCR_REA_CAPITALE_SOCIALE = "FELETT_CEDENTE_ISCR_REA_CAPITALE_SOCIALE"; + + public static final String P_FELETT_CEDENTE_ISCR_REA_SOCIO_UNICO = "FELETT_CEDENTE_ISCR_REA_SOCIO_UNICO"; + + public static final String P_FELETT_CEDENTE_ISCR_REA_STATO_LIQUIDAZIONE = "FELETT_CEDENTE_ISCR_REA_STATO_LIQUIDAZIONE"; + + public static final String P_FELETT_CEDENTE_CONTATTI_TELEFONO = "FELETT_CEDENTE_CONTATTI_TELEFONO"; + + public static final String P_FELETT_CEDENTE_CONTATTI_EMAIL = "FELETT_CEDENTE_CONTATTI_EMAIL"; + + public static final String P_FELETT_CEDENTE_CONTATTI_FAX = "FELETT_CEDENTE_CONTATTI_FAX"; + + public static final String P_FELETT_CEDENTE_REGIME_FISCALE = "FELETT_CEDENTE_REGIME_FISCALE"; + + public static final String P_FELETT_INTERMEDIARIO_ID_PAESE = "FELETT_INTERMEDIARIO_ID_PAESE"; + + public static final String P_FELETT_INTERMEDIARIO_ID_CODICE = "FELETT_INTERMEDIARIO_ID_CODICE"; + + public static final String P_FELETT_INTERMEDIARIO_CODICE_FISCALE = "FELETT_INTERMEDIARIO_CODICE_FISCALE"; + + public static final String P_FELETT_INTERMEDIARIO_DENOMINAZIONE = "FELETT_INTERMEDIARIO_DENOMINAZIONE"; + + public static final String P_FELETT_INTERMEDIARIO_NOME = "FELETT_INTERMEDIARIO_NOME"; + + public static final String P_FELETT_INTERMEDIARIO_COGNOME = "FELETT_INTERMEDIARIO_COGNOME"; + + public static final String P_FELETT_INTERMEDIARIO_TITOLO = "FELETT_INTERMEDIARIO_TITOLO"; + + public static final String P_FELETT_INTERMEDIARIO_COD_EORI = "FELETT_INTERMEDIARIO_COD_EORI"; + + public static final String P_FELETT_INTERMEDIARIO_SOGGETTO_EMITTENTE = "FELETT_INTERMEDIARIO_SOGGETTO_EMITTENTE"; + + public static final String PARM_TS_TEST = "TS_TEST"; + + public static final String TS_TEST_ENDPOINT_DETTAGLIO_ERRORI = "https://invioSS730pTest.sanita.finanze.it/EsitoStatoInviiWEB/DettaglioErrori730Service"; + + public static final String TS_TEST_ENDPOINT_ESITO_INVIO = "https://invioSS730pTest.sanita.finanze.it/EsitoStatoInviiWEB/EsitoInvioDatiSpesa730Service"; + + public static final String TS_TEST_ENDPOINT_INVIO = "https://invioSS730pTest.sanita.finanze.it/InvioTelematicoSS730pMtomWeb/InvioTelematicoSS730pMtomPort"; + + public static final String TS_TEST_ENDPOINT_RICEVUTE_PDF = "https://invioSS730pTest.sanita.finanze.it/Ricevute730ServiceWeb/ricevutePdf"; + + public static final String TS_ENDPOINT_DETTAGLIO_ERRORI = "https://invioSS730p.sanita.finanze.it/EsitoStatoInviiWEB/DettaglioErrori730Service"; + + public static final String TS_ENDPOINT_ESITO_INVIO = "https://invioSS730p.sanita.finanze.it/EsitoStatoInviiWEB/EsitoInvioDatiSpesa730Service"; + + public static final String TS_ENDPOINT_INVIO = "https://invioSS730p.sanita.finanze.it/InvioTelematicoSS730pMtomWeb/InvioTelematicoSS730pMtomPort"; + + public static final String TS_ENDPOINT_RICEVUTE_PDF = "https://invioSS730p.sanita.finanze.it/Ricevute730ServiceWeb/ricevutePdf"; + + public static final String TS_TEST_PINCODE = "8672142422"; + + public static final String TS_TEST_USERNAME = "USZV5FMF"; + + public static final String TS_TEST_PASSWORD = "P17WAPFZ"; + + public static final String TS_TEST_CF_PROPRIETARIO = "CCSRMO77A09H501E"; + + public static final String TS_TEST_PIVA_PROPRIETARIO = "03213213210"; + + public static final String TS_TEST_COD_SSA = "888888"; + + public static final long TIPO_SOGGETTO_STRUTTURA = 0L; + + public static final long TIPO_SOGGETTO_MEDICO = 1L; + + public static final String ESITO_INVIO_PDF_SCARICABILE = "0"; + + public static final String ESITO_INVIO_PRESENTE_UN_INVIO = "0"; + + public static final String ESITO_INVIO_RISCONTRATO_ERRORE = "1"; + + private String pathToCerXsd; + + public static final String P_FELETT_CEDENTE_COD_EORI = "FELETT_CEDENTE_COD_EORI"; + + static { + xmlReplaceCodes.put(Character.valueOf('à'), "a'"); + xmlReplaceCodes.put(Character.valueOf('á'), "a'"); + xmlReplaceCodes.put(Character.valueOf('è'), "e'"); + xmlReplaceCodes.put(Character.valueOf('é'), "e'"); + xmlReplaceCodes.put(Character.valueOf('ì'), "i'"); + xmlReplaceCodes.put(Character.valueOf('ò'), "o'"); + xmlReplaceCodes.put(Character.valueOf('ó'), "o'"); + xmlReplaceCodes.put(Character.valueOf('ù'), "u'"); + xmlReplaceCodes.put(Character.valueOf('ú'), "u'"); + xmlReplaceCodes.put(Character.valueOf('–'), "-"); + xmlReplaceCodes.put(Character.valueOf('“'), "\""); + xmlReplaceCodes.put(Character.valueOf('”'), "\""); + xmlReplaceCodes.put(Character.valueOf('•'), "*"); + xmlReplaceCodes.put(Character.valueOf('€'), "Euro "); + } + + private static final byte[] base64Chars = new byte[] { + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, + 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, + 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, + 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, + 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, + 56, 57, 43, 47 }; + + public static void main(String[] args) { + System.exit(0); + } + + public static long getDateDiff(Date date1, Date date2) { + if (date1 != null && date2 != null) { + Calendar c1 = Calendar.getInstance(); + Calendar c2 = Calendar.getInstance(); + c1.setTime(date1); + if (date2 != null) + c2.setTime(date2); + c1.set(11, 0); + c1.set(12, 0); + c1.set(13, 0); + c1.set(14, 0); + c2.set(11, 0); + c2.set(12, 0); + c2.set(13, 0); + c2.set(14, 0); + long difInDays = (c2.getTime().getTime() - c1.getTime().getTime()) / 86400000L; + return difInDays; + } + return 0L; + } + + private Cipher getCipher() { + if (this.cipher == null) + try { + this.cipher = Cipher.getInstance("RSA"); + } catch (Exception e) { + e.printStackTrace(); + } + return this.cipher; + } + + private X509Certificate getCertificate() { + if (this.certificate == null) + try { + System.out.println("getCertificate...."); + File certFile = new File(getPathToCerXsd() + "cer/SanitelCF.cer"); + FileInputStream fis = new FileInputStream(certFile); + BufferedInputStream bis = new BufferedInputStream(fis); + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + this.certificate = (X509Certificate)cf.generateCertificate(bis); + } catch (Exception e) { + e.printStackTrace(); + } + return this.certificate; + } + + protected String cifraSsl(String laStringa) { + try { + boolean wrapText = false; + String decoded = base64Encode(cifraSslByte(laStringa), wrapText); + return decoded; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + protected byte[] cifraSslByte(String laStringa) { + try { + getCipher().init(1, getCertificate()); + this.cipher.update(laStringa.getBytes()); + byte[] result = this.cipher.doFinal(); + this.cipher = null; + return result; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + public static void initApplicationParms(ApplParmFull ap) { + initApplicationParms(ap, ""); + } + + public static void initApplicationParms(ApplParmFull ap, String parmSfx) { + boolean debug = true; + if (ap != null) { + DBAdapter.logDebug(debug, "FeXml initParms:start"); + String l_tipoParm = ""; + Parm bean = new Parm(ap); + l_tipoParm = "FELETT_MAIN" + parmSfx; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("FELETT_PATH_FATTURE_REL" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_PATH_FATTURE_REL" + parmSfx); + bean.setDescrizione("FELETT_PATH_FATTURE_REL" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Path relativo a docbase in cui vengono salvati gli xml. Verra' create anche _zip per zip di n fatture xml"); + if (bean.getTesto().isEmpty()) + bean.setTesto("/_felett/"); + bean.save(); + bean.findByCodice("FELETT_XML_ESTERO_SI" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_XML_ESTERO_SI" + parmSfx); + bean.setDescrizione("FELETT_XML_ESTERO_SI" + parmSfx); + bean.setFlgTipo(5L); + bean.setNota("Impostare a VERO se vogliamo creare il file XML anche per i clienti esteri"); + bean.save(); + l_tipoParm = "FELETT_TRASMITTENTE" + parmSfx; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("FELETT_TRASM_ID_PAESE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_TRASM_ID_PAESE" + parmSfx); + bean.setDescrizione("FELETT_TRASM_ID_PAESE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Obbligatorio!! Codice del paese assegnante l’identifcativo fiscale al soggetto trasmittente.

Sigla della nazione espressa secondo lo standard ISO 3166-1 alpha-2 code.

Composto da ID_PAESE e ID_CODICE. E' l’identificativo univoco del soggetto trasmittente; per i soggetti residenti in Italia, siano essi persone fisiche o giuridiche, corrisponde al codice fiscale preceduto da IT; per i soggetti non residenti corrisponde al numero identificativo IVA (dove i primi due caratteri rappresentano il paese secondo lo standard ISO 3166-1 alpha-2 code, ed i restanti, fino ad un massimo di 28, il codice vero e proprio)"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_TRASM_ID_CODICE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_TRASM_ID_CODICE" + parmSfx); + bean.setDescrizione("FELETT_TRASM_ID_CODICE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Obbligatorio!! Numero di identificazione fiscale del trasmittente (per i soggetti stabiliti nel territorio dello Stato Italiano corrisponde al Codice Fiscale; per i non residenti si fa riferimento all’identificativo fiscale assegnato dall’autorita' del paese di residenza). In caso di IdPaese uguale a IT, il sistema ne verifica la presenza in Anagrafe Tributaria: se non esiste come codice fiscale, il file viene scartato con codice errore 00300.

Formato alfanumerico; lunghezza massima di 28 caratteri.

Composto da ID_PAESE e ID_CODICE. E' l’identificativo univoco del soggetto trasmittente; per i soggetti residenti in Italia, siano essi persone fisiche o giuridiche, corrisponde al codice fiscale preceduto da IT; per i soggetti non residenti corrisponde al numero identificativo IVA (dove i primi due caratteri rappresentano il paese secondo lo standard ISO 3166-1 alpha-2 code, ed i restanti, fino ad un massimo di 28, il codice vero e proprio)"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + l_tipoParm = "FELETT_TRASMITTENTE_CONTATTI" + parmSfx; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("FELETT_TRASM_CONTATTO_TELEFONO" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_TRASM_CONTATTO_TELEFONO" + parmSfx); + bean.setDescrizione("FELETT_TRASM_CONTATTO_TELEFONO" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Dati relativi ai contatti del trasmittente"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_TRASM_CONTATTO_EMAIL" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_TRASM_CONTATTO_EMAIL" + parmSfx); + bean.setDescrizione("FELETT_TRASM_CONTATTO_EMAIL" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Dati relativi ai contatti del trasmittente"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + l_tipoParm = "FELETT_CEDENTE" + parmSfx; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("FELETT_CEDENTE_ID_PAESE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_ID_PAESE" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_ID_PAESE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Numero di identificazione fiscale ai fini IVA; i primi due caratteri rappresentano il paese ( IT, DE, ES …..) ed i restanti (fino ad un massimo di 28) il codice vero e proprio che, per i residenti in Italia, corrisponde al numero di partita IVA."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_ID_CODICE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_ID_CODICE" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_ID_CODICE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Numero di identificazione fiscale ai fini IVA; i primi due caratteri rappresentano il paese ( IT, DE, ES …..) ed i restanti (fino ad un massimo di 28) il codice vero e proprio che, per i residenti in Italia, corrisponde al numero di partita IVA."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_COD_FISC" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_COD_FISC" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_COD_FISC" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Numero di Codice Fiscale"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_DENOMINAZIONE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_DENOMINAZIONE" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_DENOMINAZIONE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Ditta, denominazione o ragione sociale (ditta, impresa, società, ente), da valorizzare solo se non sono valorizzati gli elementi informativi 1.2.1.3.2 e 1.2.1.3.3 "); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_NOME" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_NOME" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_NOME" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Nome della persona fisica. Da valorizzare insieme all'elemento informativo 1.2.1.3.3 e solo se non è valorizzato l'elemento informativo 1.2.1.3.1 "); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_COGNOME" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_COGNOME" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_COGNOME" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Cognome della persona fisica. Da valorizzare insieme all'elemento informativo 1.2.1.3.2 e solo se non è valorizzato l'elemento informativo 1.2.1.3.1 "); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_TITOLO" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_TITOLO" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_TITOLO" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Titolo onorifico"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_COD_EORI" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_COD_EORI" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_COD_EORI" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Numero del Codice EORI (Economic Operator Registration and Identification) in base al Regolamento (CE) n. 312 del 16 aprile 2009. In vigore dal 1 luglio 2009"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + l_tipoParm = "FELETT_CEDENTE_SEDE" + parmSfx; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("FELETT_CEDENTE_SEDE_INDIRIZZO" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_SEDE_INDIRIZZO" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_SEDE_INDIRIZZO" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco contenente i dati della sede del cedente / prestatore. Si tratta della sede legale per le società e del domicilio fiscale per le ditte individuali e i lavoratori autonomi."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_SEDE_NUM_CIV" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_SEDE_NUM_CIV" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_SEDE_NUM_CIV" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco contenente i dati della sede del cedente / prestatore. Si tratta della sede legale per le società e del domicilio fiscale per le ditte individuali e i lavoratori autonomi."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_SEDE_CAP" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_SEDE_CAP" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_SEDE_CAP" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco contenente i dati della sede del cedente / prestatore. Si tratta della sede legale per le società e del domicilio fiscale per le ditte individuali e i lavoratori autonomi."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_SEDE_COMUNE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_SEDE_COMUNE" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_SEDE_COMUNE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco contenente i dati della sede del cedente / prestatore. Si tratta della sede legale per le società e del domicilio fiscale per le ditte individuali e i lavoratori autonomi."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_SEDE_PROV" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_SEDE_PROV" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_SEDE_PROV" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco contenente i dati della sede del cedente / prestatore. Si tratta della sede legale per le società e del domicilio fiscale per le ditte individuali e i lavoratori autonomi."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_SEDE_NAZIONE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_SEDE_NAZIONE" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_SEDE_NAZIONE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco contenente i dati della sede del cedente / prestatore. Si tratta della sede legale per le società e del domicilio fiscale per le ditte individuali e i lavoratori autonomi."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + l_tipoParm = "FELETT_CEDENTE_STAB_ORG" + parmSfx; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("FELETT_CEDENTE_STAB_ORG_INDIRIZZO" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_STAB_ORG_INDIRIZZO" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_STAB_ORG_INDIRIZZO" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi di cedente / prestatore non residente, con stabile organizzazione in Italia"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_STAB_ORG_NUMERO_CIVICO" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_STAB_ORG_NUMERO_CIVICO" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_STAB_ORG_NUMERO_CIVICO" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi di cedente / prestatore non residente, con stabile organizzazione in Italia"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_STAB_ORG_CAP" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_STAB_ORG_CAP" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_STAB_ORG_CAP" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi di cedente / prestatore non residente, con stabile organizzazione in Italia"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_STAB_ORG_COMUNE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_STAB_ORG_COMUNE" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_STAB_ORG_COMUNE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi di cedente / prestatore non residente, con stabile organizzazione in Italia"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_STAB_ORG_PROVINCIA" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_STAB_ORG_PROVINCIA" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_STAB_ORG_PROVINCIA" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi di cedente / prestatore non residente, con stabile organizzazione in Italia"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_STAB_ORG_NAZIONE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_STAB_ORG_NAZIONE" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_STAB_ORG_NAZIONE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi di cedente / prestatore non residente, con stabile organizzazione in Italia"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + l_tipoParm = "FELETT_CEDENTE_RAPP_FISC" + parmSfx; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("FELETT_CEDENTE_RAPP_FISC_ID_PAESE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_RAPP_FISC_ID_PAESE" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_RAPP_FISC_ID_PAESE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi in cui il cedente / prestatore si avvalga di un rappresentante fiscale in Italia."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_RAPP_FISC_ID_CODICE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_RAPP_FISC_ID_CODICE" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_RAPP_FISC_ID_CODICE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi in cui il cedente / prestatore si avvalga di un rappresentante fiscale in Italia."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_RAPP_FISC_COD_FISC" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_RAPP_FISC_COD_FISC" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_RAPP_FISC_COD_FISC" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Numero di Codice Fiscale"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_RAPP_FISC_DENOMINAZIONE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_RAPP_FISC_DENOMINAZIONE" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_RAPP_FISC_DENOMINAZIONE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi in cui il cedente / prestatore si avvalga di un rappresentante fiscale in Italia."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_RAPP_FISC_NOME" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_RAPP_FISC_NOME" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_RAPP_FISC_NOME" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi in cui il cedente / prestatore si avvalga di un rappresentante fiscale in Italia."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_RAPP_FISC_COGNOME" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_RAPP_FISC_COGNOME" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_RAPP_FISC_COGNOME" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi in cui il cedente / prestatore si avvalga di un rappresentante fiscale in Italia."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + l_tipoParm = "FELETT_CEDENTE_ISCR_REA" + parmSfx; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("FELETT_CEDENTE_ISCR_REA_UFFICIO" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_ISCR_REA_UFFICIO" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_ISCR_REA_UFFICIO" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi di società iscritte nel registro delle imprese ai sensi dell'art. 2250 del codice civile."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_ISCR_REA_NUMERO_REA" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_ISCR_REA_NUMERO_REA" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_ISCR_REA_NUMERO_REA" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi di società iscritte nel registro delle imprese ai sensi dell'art. 2250 del codice civile."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_ISCR_REA_CAPITALE_SOCIALE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_ISCR_REA_CAPITALE_SOCIALE" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_ISCR_REA_CAPITALE_SOCIALE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi di società iscritte nel registro delle imprese ai sensi dell'art. 2250 del codice civile."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_ISCR_REA_SOCIO_UNICO" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_ISCR_REA_SOCIO_UNICO" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_ISCR_REA_SOCIO_UNICO" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi di società iscritte nel registro delle imprese ai sensi dell'art. 2250 del codice civile."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_ISCR_REA_STATO_LIQUIDAZIONE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_ISCR_REA_STATO_LIQUIDAZIONE" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_ISCR_REA_STATO_LIQUIDAZIONE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Blocco da valorizzare nei casi di società iscritte nel registro delle imprese ai sensi dell'art. 2250 del codice civile."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + l_tipoParm = "FELETT_CEDENTE_CONTATTI" + parmSfx; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("FELETT_CEDENTE_CONTATTI_TELEFONO" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_CONTATTI_TELEFONO" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_CONTATTI_TELEFONO" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota(null); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_CONTATTI_EMAIL" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_CONTATTI_EMAIL" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_CONTATTI_EMAIL" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota(null); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_CEDENTE_CONTATTI_FAX" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_CONTATTI_FAX" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_CONTATTI_FAX" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota(null); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + l_tipoParm = "FELETT_CEDENTE_REGIME_FISCALE" + parmSfx; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("FELETT_CEDENTE_REGIME_FISCALE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_CEDENTE_REGIME_FISCALE" + parmSfx); + bean.setDescrizione("FELETT_CEDENTE_REGIME_FISCALE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("RF01 Ordinario
RF02 Contribuenti minimi (art.1, c.96-117, L. 244/07)
RF04 Agricoltura e attività connesse e pesca (artt.34 e 34-bis, DPR 633/72)
RF05 Vendita sali e tabacchi (art.74, c.1, DPR. 633/72)
RF06 Commercio fiammiferi (art.74, c.1, DPR 633/72)
RF07 Editoria (art.74, c.1, DPR 633/72)
RF08 Gestione servizi telefonia pubblica (art.74, c.1, DPR 633/72)
RF09 Rivendita documenti di trasporto pubblico e di sosta (art.74, c.1, DPR 633/72)
RF10 Intrattenimenti, giochi e altre attività di cui alla tariffa allegata al DPR 640/72 (art.74, c.6, DPR 633/72)
RF11 Agenzie viaggi e turismo (art.74-ter, DPR 633/72)
RF12 Agriturismo (art.5, c.2, L. 413/91)
RF13 Vendite a domicilio (art.25-bis, c.6, DPR 600/73)
RF14 Rivendita beni usati, oggetti d’arte, d’antiquariato o da collezione (art.36, DL 41/95)
RF15 Agenzie di vendite all’asta di oggetti d’arte, antiquariato o da collezione (art.40-bis, DL 41/95)
RF16 IVA per cassa P.A. (art.6, c.5, DPR 633/72)
RF17 IVA per cassa (art. 32-bis, DL 83/2012)
RF18 Altro
RF19 Regime forfettario (art.1, c.54-89, L. 190/2014) "); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + l_tipoParm = "FELETT_INTERMEDIARIO_SOGG_EMIT" + parmSfx; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("FELETT_INTERMEDIARIO_ID_PAESE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_INTERMEDIARIO_ID_PAESE" + parmSfx); + bean.setDescrizione("FELETT_INTERMEDIARIO_ID_PAESE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Dati relativi al soggetto terzo che emette fattura per conto del cedente / prestatore
Numero di identificazione fiscale ai fini IVA; i primi due caratteri rappresentano il paese ( IT, DE, ES …..) ed i restanti (fino ad un massimo di 28) il codice vero e proprio che, per i residenti in Italia, corrisponde al numero di partita IVA.
Codice della nazione espresso secondo lo standard ISO 3166-1 alpha-2 code"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_INTERMEDIARIO_ID_CODICE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_INTERMEDIARIO_ID_CODICE" + parmSfx); + bean.setDescrizione("FELETT_INTERMEDIARIO_ID_CODICE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Dati relativi al soggetto terzo che emette fattura per conto del cedente / prestatore
Numero di identificazione fiscale ai fini IVA; i primi due caratteri rappresentano il paese ( IT, DE, ES …..) ed i restanti (fino ad un massimo di 28) il codice vero e proprio che, per i residenti in Italia, corrisponde al numero di partita IVA.
Codice identificativo fiscale"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_INTERMEDIARIO_CODICE_FISCALE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_INTERMEDIARIO_CODICE_FISCALE" + parmSfx); + bean.setDescrizione("FELETT_INTERMEDIARIO_CODICE_FISCALE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Dati relativi al soggetto terzo che emette fattura per conto del cedente / prestatore
Numero di Codice Fiscale"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_INTERMEDIARIO_DENOMINAZIONE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_INTERMEDIARIO_DENOMINAZIONE" + parmSfx); + bean.setDescrizione("FELETT_INTERMEDIARIO_DENOMINAZIONE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Dati anagrafici identificativi del terzo intermediario
Ditta, denominazione o ragione sociale (ditta, impresa, società, ente), da valorizzare in alternativa agli elementi informativi 1.5.1.3.2 e 1.5.1.3.3 "); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_INTERMEDIARIO_NOME" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_INTERMEDIARIO_NOME" + parmSfx); + bean.setDescrizione("FELETT_INTERMEDIARIO_NOME" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Dati anagrafici identificativi del terzo intermediario
Nome della persona fisica. Da valorizzare insieme all'elemento informativo 1.5.1.3.3 ed in alternativa all'elemento informativo 1.5.1.3.1 "); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_INTERMEDIARIO_COGNOME" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_INTERMEDIARIO_COGNOME" + parmSfx); + bean.setDescrizione("FELETT_INTERMEDIARIO_COGNOME" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Dati anagrafici identificativi del terzo intermediario
Cognome della persona fisica. Da valorizzare insieme all'elemento informativo 1.5.1.3.2 ed in alternativa all'elemento informativo 1.5.1.3.1 "); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_INTERMEDIARIO_TITOLO" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_INTERMEDIARIO_CODICE_FISCALE" + parmSfx); + bean.setDescrizione("FELETT_INTERMEDIARIO_CODICE_FISCALE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Dati anagrafici identificativi del terzo intermediario
Titolo onorifico"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_INTERMEDIARIO_COD_EORI" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_INTERMEDIARIO_COD_EORI" + parmSfx); + bean.setDescrizione("FELETT_INTERMEDIARIO_COD_EORI" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Dati anagrafici identificativi del terzo intermediario
Numero del Codice EORI (Economic Operator Registration and Identification) in base al Regolamento (CE) n. 312 del 16 aprile 2009. In vigore dal 1 luglio 2009"); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + bean.findByCodice("FELETT_INTERMEDIARIO_SOGGETTO_EMITTENTE" + parmSfx); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FELETT_INTERMEDIARIO_SOGGETTO_EMITTENTE" + parmSfx); + bean.setDescrizione("FELETT_INTERMEDIARIO_SOGGETTO_EMITTENTE" + parmSfx); + bean.setFlgTipo(0L); + bean.setNota("Dati relativi al soggetto terzo che emette fattura per conto del cedente / prestatore
Da valorizzare in tutti i casi in cui la fattura è emessa da un soggetto diverso dal cedente/prestatore; indica se la fattura è emessa dal cessionario/committente oppure da un terzo per conto del cedente/prestatore
valori ammessi:
[CC]: cessionario / committente
[TZ]: terzo."); + if (bean.getTesto().isEmpty()) + bean.setTesto(null); + bean.save(); + DBAdapter.logDebug(debug, "FeXml initParms: stop"); + } + } + + protected static String base64Encode(byte[] data, boolean wrap) { + if (data == null) + return null; + byte[] encoded = new byte[(data.length + 2) / 3 * 4]; + int iDest = 0; + int iSrc; + for (iSrc = 0; iSrc < data.length - 2; iSrc += 3) { + encoded[iDest++] = (byte)(data[iSrc] >>> 2 & 0x3F); + encoded[iDest++] = (byte)(data[iSrc + 1] >>> 4 & 0xF | data[iSrc] << 4 & 0x3F); + encoded[iDest++] = (byte)(data[iSrc + 2] >>> 6 & 0x3 | data[iSrc + 1] << 2 & 0x3F); + encoded[iDest++] = (byte)(data[iSrc + 2] & 0x3F); + } + if (iSrc < data.length) { + encoded[iDest++] = (byte)(data[iSrc] >>> 2 & 0x3F); + if (iSrc < data.length - 1) { + encoded[iDest++] = (byte)(data[iSrc + 1] >>> 4 & 0xF | data[iSrc] << 4 & 0x3F); + encoded[iDest++] = (byte)(data[iSrc + 1] << 2 & 0x3F); + } else { + encoded[iDest++] = (byte)(data[iSrc] << 4 & 0x3F); + } + } + for (iSrc = 0; iSrc < iDest; iSrc++) + encoded[iSrc] = base64Chars[encoded[iSrc]]; + for (; iSrc < encoded.length; iSrc++) + encoded[iSrc] = 61; + if (!wrap) + return new String(encoded); + StringBuffer result = new StringBuffer(); + int r; + for (r = 0; r < iSrc / 76; r++) { + result.append(new String(encoded, r * 76, 76)); + result.append("\n"); + } + if (iSrc % 76 != 0) { + result.append(new String(encoded, r * 76, iSrc - r * 76)); + result.append("\n"); + } + return result.toString(); + } + + public String getPathToCerXsd() { + return this.pathToCerXsd; + } + + public void setPathToCerXsd(String fileNameSanitelCer) { + this.pathToCerXsd = fileNameSanitelCer; + } + + public static final String convertStringToXmlString(String value, int maxLenght) { + if (value != null) { + sanitizeLatinString(value); + if (maxLenght > 0 && value.length() > maxLenght) + return value.substring(1, maxLenght); + return value; + } + return ""; + } + + private static final Map charReplacements = Map.ofEntries(Map.entry(Character.valueOf('‘'), Character.valueOf('\'')), + + + Map.entry(Character.valueOf('’'), Character.valueOf('\'')), + Map.entry(Character.valueOf('“'), Character.valueOf('"')), + Map.entry(Character.valueOf('”'), Character.valueOf('"')), + Map.entry(Character.valueOf('«'), Character.valueOf('"')), + Map.entry(Character.valueOf('»'), Character.valueOf('"')), + Map.entry(Character.valueOf('–'), Character.valueOf('-')), + Map.entry(Character.valueOf('—'), Character.valueOf('-')), + Map.entry(Character.valueOf('…'), Character.valueOf('.')), + Map.entry(Character.valueOf('\u00A0'), Character.valueOf(' '))); + + public static String sanitizeLatinString(String input) { + if (input == null) + return null; + StringBuilder sb = new StringBuilder(); + for (char c : input.toCharArray()) { + if (charReplacements.containsKey(Character.valueOf(c))) { + sb.append(charReplacements.get(Character.valueOf(c))); + } else if (isLatinAllowed(c)) { + sb.append(c); + } + } + return sb.toString(); + } + + private static boolean isLatinAllowed(char c) { + if (c >= ' ' && c <= '~') + return true; + if (c >= 'À' && c <= 'ÿ') + return true; + if (c == '€') + return true; + return false; + } + + public static final String convertStringToXmlStringOld(String value, int maxLenght) { + boolean debug = false; + String ndosto = "convertStringToXmlString: "; + if (value != null) + try { + String temp = StringEscapeUtils.escapeXml11(value); + StringBuffer modifiedContent = new StringBuffer(); + for (int i = 0; i < temp.length(); i++) { + DBAdapter.logDebug(debug, ndosto + ndosto + "\n" + + temp.charAt(i) + " rimpiazzato con " + ndosto); + if (xmlReplaceCodes.containsKey(Character.valueOf(temp.charAt(i)))) { + modifiedContent.append(xmlReplaceCodes.get(Character.valueOf(temp.charAt(i)))); + } else { + modifiedContent.append(temp.charAt(i)); + } + } + String result = modifiedContent.toString(); + if (maxLenght > 0 && result.length() > maxLenght) + return result.substring(1, maxLenght); + return result; + } catch (Exception e) { + if (maxLenght > 0 && value.length() > maxLenght) + return value.substring(1, maxLenght); + return value; + } + return ""; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/glossario/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/glossario/package-info.java new file mode 100644 index 00000000..3d372761 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/glossario/package-info.java @@ -0,0 +1 @@ +package it.acxent.glossario; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/glossario/servlet/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/glossario/servlet/package-info.java new file mode 100644 index 00000000..5dff9063 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/glossario/servlet/package-info.java @@ -0,0 +1 @@ +package it.acxent.glossario.servlet; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/gtm/GoogleDataLayer.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/gtm/GoogleDataLayer.java new file mode 100644 index 00000000..888dd341 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/gtm/GoogleDataLayer.java @@ -0,0 +1,27 @@ +package it.acxent.gtm; + +public class GoogleDataLayer { + private String pushData; + + public static final String EEC_ADD = "eec.add"; + + public static final String EEC_CHECKOUT = "eec.checkout"; + + public GoogleDataLayer(String pushData) { + this.pushData = pushData; + } + + public GoogleDataLayer() {} + + public boolean isPushable() { + return !(getPushData() == null || getPushData().isEmpty()); + } + + public String getPushData() { + return this.pushData; + } + + public void setPushData(String pushData) { + this.pushData = pushData; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/gtm/GoogleDataLayerBuilder.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/gtm/GoogleDataLayerBuilder.java new file mode 100644 index 00000000..f7dacdb2 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/gtm/GoogleDataLayerBuilder.java @@ -0,0 +1,184 @@ +package it.acxent.gtm; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloTaglia; +import it.acxent.art.ArticoloVariante; +import it.acxent.cart.Cart; +import it.acxent.cart.CartItem; +import it.acxent.contab.Documento; +import it.acxent.contab.RigaDocumento; +import it.acxent.util.Vectumerator; +import java.util.Enumeration; +import org.json.JSONArray; +import org.json.JSONObject; + +public class GoogleDataLayerBuilder { + public static final long TIPO_EVENTO_DETTAGLIO_PRODOTTO_0 = 0L; + + public static final long TIPO_EVENTO_ADD_ITEM_1 = 1L; + + public static final long TIPO_EVENTO_DEL_ITEM_2 = 2L; + + public static final long TIPO_EVENTO_DELETE_CART_3 = 3L; + + public static final long TIPO_EVENTO_CHECKOUT_NEW_USER_4 = 10L; + + public static final long TIPO_EVENTO_CHECKOUT_STEP1_VEDI_CARRELLO_11 = 11L; + + public static final long TIPO_EVENTO_CHECKOUT_STEP2_PAGINA_LOGIN_12 = 12L; + + public static final long TIPO_EVENTO_CHECKOUT_STEP3_REGISTRAZIONE_ORDINE_13 = 13L; + + public static final long TIPO_EVENTO_CHECKOUT_STEP4_INIZIO_PAGAMENTO_14 = 14L; + + public static final long TIPO_EVENTO_PURCHASE_99 = 99L; + + private static final boolean debug = false; + + private long tipoEvento; + + private String evento; + + public static String getDettaglioProdotto(String evento, ArticoloVariante bean) { + JSONObject jo = new JSONObject(); + jo.put("event", evento); + JSONObject jecommerce = new JSONObject(); + JSONObject jdetail = new JSONObject(); + JSONArray jproducts = new JSONArray(); + JSONObject jrow = new JSONObject(); + jrow.put("name", bean.getDescrizione()); + jrow.put("id", bean.getCodiceVariante()); + jrow.put("category", bean.getTipo().getDescrizioneCompletaHypen("it")); + jproducts.put(jrow); + jdetail.put("products", jproducts); + jecommerce.put("detail", jdetail); + jo.put("ecommerce", jecommerce); + return jo.toString(); + } + + public static String getDettaglioProdotto(String evento, Articolo bean) { + JSONObject jo = new JSONObject(); + jo.put("event", evento); + JSONObject jecommerce = new JSONObject(); + JSONObject jdetail = new JSONObject(); + JSONArray jproducts = new JSONArray(); + JSONObject jrow = new JSONObject(); + if (bean.getId_articoloVariante() > 0L) { + jrow.put("name", bean.getArticoloVariante().getDescrizioneCompleta()); + jrow.put("id", bean.getArticoloVariante().getCodiceVariante()); + } else { + jrow.put("name", bean.getDescrizioneCompleta()); + jrow.put("id", bean.getCodice()); + } + jrow.put("category", bean.getTipo().getDescrizioneCompletaHypen("it")); + jproducts.put(jrow); + jdetail.put("products", jproducts); + jecommerce.put("detail", jdetail); + jo.put("ecommerce", jecommerce); + return jo.toString(); + } + + public static String addItemToCart(String evento, CartItem bean) { + JSONObject jo = new JSONObject(); + jo.put("event", evento); + JSONObject jecommerce = new JSONObject(); + JSONObject jadd = new JSONObject(); + JSONArray jproducts = new JSONArray(); + JSONObject jrow = new JSONObject(); + jrow.put("name", bean.getDbItem().getDescrizione()); + if (bean.getDbItem() instanceof ArticoloTaglia) { + jrow.put("id", ((ArticoloTaglia)bean.getDbItem()).getCodiceAT()); + } else if (bean.getDbItem() instanceof ArticoloVariante) { + jrow.put("id", ((ArticoloVariante)bean.getDbItem()).getCodiceVariante()); + } else if (bean.getDbItem() instanceof Articolo) { + jrow.put("id", ((Articolo)bean.getDbItem()).getCodice()); + } else { + jrow.put("id", "?? errore??"); + } + jrow.put("quantity", bean.getQuantity()); + jproducts.put(jrow); + jadd.put("products", jproducts); + jecommerce.put("add", jadd); + jo.put("ecommerce", jecommerce); + return jo.toString(); + } + + public static String showCart(String evento, String step, Cart cart) { + JSONObject jo = new JSONObject(); + jo.put("event", evento); + JSONObject jecommerce = new JSONObject(); + JSONObject jCheckout = new JSONObject(); + JSONObject jActionField = new JSONObject(); + JSONArray jproducts = new JSONArray(); + JSONObject jrow = new JSONObject(); + Enumeration enu = cart.getItems(); + String lang = "it"; + while (enu.hasMoreElements()) { + CartItem ci = enu.nextElement(); + if (ci.getQuantity() > 0.0D) { + jrow.put("name", ci.getDbItem().getDescrizione()); + if (ci.getDbItem() instanceof ArticoloTaglia) { + jrow.put("id", ((ArticoloTaglia)ci.getDbItem()).getCodiceAT()); + } else if (ci.getDbItem() instanceof ArticoloVariante) { + jrow.put("id", ((ArticoloVariante)ci.getDbItem()).getCodiceVariante()); + } else if (ci.getDbItem() instanceof Articolo) { + jrow.put("id", ((Articolo)ci.getDbItem()).getCodice()); + } else { + jrow.put("id", "?? errore??"); + } + jrow.put("quantity", ci.getQuantity()); + jproducts.put(jrow); + } + } + jActionField.put("step", step); + jCheckout.put("actionField", jActionField); + jCheckout.put("products", jproducts); + jecommerce.put("checkout", jCheckout); + jo.put("ecommerce", jecommerce); + return jo.toString(); + } + + public static String eventStep(String evento, String step) { + JSONObject jo = new JSONObject(); + jo.put("event", evento); + JSONObject jecommerce = new JSONObject(); + JSONObject jCheckout = new JSONObject(); + JSONObject jActionField = new JSONObject(); + jActionField.put("step", step); + jCheckout.put("actionField", jActionField); + jecommerce.put("checkout", jCheckout); + jo.put("ecommerce", jecommerce); + return jo.toString(); + } + + public static String purchaseOrder(String evento, Documento doc) { + JSONObject jo = new JSONObject(); + jo.put("event", evento); + JSONObject jecommerce = new JSONObject(); + JSONObject jPurchase = new JSONObject(); + JSONObject jActionField = new JSONObject(); + JSONArray jproducts = new JSONArray(); + JSONObject jrow = new JSONObject(); + Vectumerator vec = doc.findRigheDocumento(0, 0, 0); + String lang = "it"; + while (vec.hasMoreElements()) { + RigaDocumento row = (RigaDocumento)vec.nextElement(); + jrow.put("id", row.getDescrizioneCodiceRiga()); + jrow.put("name", row.getDescrizioneRiga()); + jrow.put("quantity", row.getQuantita()); + jrow.put("price", doc.getNf().format(row.getTotImportoRigaConSconto())); + jrow.put("category", row.getArticolo().getTipo().getDescrizioneCompletaSpaces("it")); + jproducts.put(jrow); + } + jActionField.put("id", doc.getNumeroDocumentoCompleto()); + jActionField.put("revenue", doc.getNf().format(doc.getTotaleDocumento())); + jActionField.put("tax", doc.getNf().format(doc.getImportoIvaTotale())); + jActionField.put("shipping", doc.getNf().format(doc.getTotaleAltriCostiConIva())); + jActionField.put("coupon", doc.getNotePagamento()); + jPurchase.put("actionField", jActionField); + jPurchase.put("products", jproducts); + jecommerce.put("purchase", jPurchase); + jo.put("ecommerce", jecommerce); + return jo.toString(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/gtm/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/gtm/package-info.java new file mode 100644 index 00000000..c496f7fc --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/gtm/package-info.java @@ -0,0 +1 @@ +package it.acxent.gtm; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/Challenge.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/Challenge.java new file mode 100644 index 00000000..ce7196b4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/Challenge.java @@ -0,0 +1,131 @@ +package it.acxent.human; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.util.PasswordPolicy; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.Random; + +public class Challenge { + private String hid; + + private String hokpage; + + private long httl; + + private String theChallenge; + + private LinkedHashSet theQuestion; + + public static final String _HC = "_HC_"; + + private ApplParmFull apFull; + + public Challenge(ApplParmFull apFull) { + this.apFull = apFull; + } + + public Challenge() {} + + public Challenge(ApplParmFull apFull, int sizeChallenge, int sizeQuestion) { + this.apFull = apFull; + setTheChallenge(PasswordPolicy.getRandomPassword(sizeChallenge, false)); + Random random = new Random(); + while (getTheQuestion().size() < sizeQuestion) { + int numeroCasuale = random.nextInt(sizeChallenge) + 1; + if (!getTheQuestion().contains(Integer.valueOf(numeroCasuale))) + getTheQuestion().add(Integer.valueOf(numeroCasuale)); + } + } + + public String getQuestion() { + return getQuestion("it"); + } + + public String getQuestion(String lang) { + StringBuilder sb = new StringBuilder(getApFull().translate("Inserisci l'elemento delle posizioni", lang) + " "); + int i = 0; + for (Iterator iterator = getTheQuestion().iterator(); iterator.hasNext(); ) { + int elemento = iterator.next(); + i++; + sb.append(getApFull().translate(DBAdapter.numberToString((double)elemento, false), lang)); + if (i < getTheQuestion().size()) + sb.append(", "); + } + return sb.toString(); + } + + public boolean checkAnswer(String answer) { + StringBuilder correctAnswer = new StringBuilder(); + for (Iterator iterator = getTheQuestion().iterator(); iterator.hasNext(); ) { + int elemento = iterator.next(); + correctAnswer.append(getTheChallenge().charAt(elemento - 1)); + } + if (correctAnswer.toString().equals(answer)) + return true; + return false; + } + + public String getTheChallenge() { + return (this.theChallenge == null) ? "" : this.theChallenge.trim(); + } + + public void setTheChallenge(String theChallenge) { + this.theChallenge = theChallenge; + } + + public LinkedHashSet getTheQuestion() { + if (this.theQuestion == null) + this.theQuestion = new LinkedHashSet<>(); + return this.theQuestion; + } + + public void setTheQuestion(LinkedHashSet theQuestion) { + this.theQuestion = theQuestion; + } + + public String getHtmlChallenge() { + StringBuilder sb = new StringBuilder("
"); + for (int i = 0; i < getTheChallenge().length(); i++) { + char carattere = getTheChallenge().charAt(i); + sb.append(""); + sb.append(carattere); + sb.append(""); + } + sb.append("
"); + return sb.toString(); + } + + public String getHid() { + return this.hid; + } + + public void setHid(String hid) { + this.hid = hid; + } + + public String getHokpage() { + return this.hokpage; + } + + public void setHokpage(String hokpage) { + this.hokpage = hokpage; + } + + public long getHttl() { + return this.httl; + } + + public void setHttl(long httl) { + this.httl = httl; + } + + public ApplParmFull getApFull() { + return this.apFull; + } + + public void setApFull(ApplParmFull apFull) { + this.apFull = apFull; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/package-info.java new file mode 100644 index 00000000..b60e8918 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/package-info.java @@ -0,0 +1 @@ +package it.acxent.human; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/servlet/HumanCeckSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/servlet/HumanCeckSvlt.java new file mode 100644 index 00000000..25d36b18 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/servlet/HumanCeckSvlt.java @@ -0,0 +1,72 @@ +package it.acxent.human.servlet; + +import it.acxent.cc.Attivita; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.human.Challenge; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import org.json.JSONObject; + +@WebServlet(urlPatterns = {"/HumanCeck.abl"}) +public class HumanCeckSvlt extends AblServletSvlt { + private static final String _SESSION_CHALLENGE = "_challenge"; + + private static final long serialVersionUID = 476646217816287146L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return null; + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return null; + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + _sendChallenge(req, res); + } + + public void _checkChallenge(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Challenge ch = (Challenge)req.getSession().getAttribute("_challenge"); + String ans = getRequestParameter(req, "h_answer"); + JSONObject jo = new JSONObject(); + if (ch.checkAnswer(ans)) { + long endTime = DBAdapter.getNow().getTime() + ch.getHttl() * 1000L; + req.getSession().setAttribute("_HC_" + ch.getHid(), Long.valueOf(endTime)); + jo.put("res", "true"); + Attivita attivita = Attivita.getDefaultInstance(apFull); + jo.put("page", attivita.getWwwAddress() + attivita.getWwwAddress()); + } else { + jo.put("res", "false"); + } + sendHtmlMsgResponse(req, res, jo.toString()); + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + _sendChallenge(req, res); + } + + protected String getBeanPageName(HttpServletRequest req) { + return "_inc_human_check.jsp"; + } + + public void _sendChallenge(HttpServletRequest req, HttpServletResponse res) { + Challenge ch = new Challenge(getApFull(req), 10, 3); + fillObject(req, ch); + req.getSession().setAttribute("_challenge", ch); + setJspPage("/_inc_human_check_challenge.jsp", req); + callJsp(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/servlet/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/servlet/package-info.java new file mode 100644 index 00000000..d400a8cd --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/servlet/package-info.java @@ -0,0 +1 @@ +package it.acxent.human.servlet; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/taglib/ElseHumanTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/taglib/ElseHumanTag.java new file mode 100644 index 00000000..7dd937d4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/taglib/ElseHumanTag.java @@ -0,0 +1,70 @@ +package it.acxent.human.taglib; + +import it.acxent.taglib.AbstractDbTag; +import java.io.IOException; +import java.io.Writer; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; + +public class ElseHumanTag extends AbstractDbTag { + private static final long serialVersionUID = 6183519243825318138L; + + public static final String BEAN_ID = "hid"; + + public static final String BEAN_TTL = "httl"; + + public static final String BEAN_PAGE = "hokpage"; + + private String hid; + + private String hokpage; + + private long httl; + + public int doAfterBody() throws JspException { + try { + this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter()); + return 0; + } catch (IOException ioexception) { + throw new JspTagException(ioexception.toString()); + } + } + + public int doStartTag() throws JspException { + if (getWhereCondition()) + return 0; + this.pageContext.setAttribute("hid", getHid()); + this.pageContext.setAttribute("hokpage", getHokpage()); + this.pageContext.setAttribute("httl", String.valueOf(getHttl())); + return 2; + } + + private boolean getWhereCondition() throws JspException { + String wc = "_WC_HC"; + return (Boolean)this.pageContext.getAttribute(wc); + } + + public String getHid() { + return (this.hid == null) ? "" : this.hid.trim(); + } + + public void setHid(String id) { + this.hid = id; + } + + public String getHokpage() { + return (this.hokpage == null) ? "" : this.hokpage.trim(); + } + + public void setHokpage(String page) { + this.hokpage = page; + } + + public long getHttl() { + return this.httl; + } + + public void setHttl(long ttl) { + this.httl = ttl; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/taglib/ElseHumanTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/taglib/ElseHumanTagExtraInfo.java new file mode 100644 index 00000000..776a0d7a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/taglib/ElseHumanTagExtraInfo.java @@ -0,0 +1,11 @@ +package it.acxent.human.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class ElseHumanTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + return new VariableInfo[] { new VariableInfo("hid", "java.lang.String", true, 0), new VariableInfo("hokpage", "java.lang.String", true, 0), new VariableInfo("httl", "java.lang.String", true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/taglib/IfHumanTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/taglib/IfHumanTag.java new file mode 100644 index 00000000..e73955df --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/taglib/IfHumanTag.java @@ -0,0 +1,127 @@ +package it.acxent.human.taglib; + +import it.acxent.common.Users; +import it.acxent.taglib.AbstractDbTag; +import java.io.IOException; +import java.io.Writer; +import java.util.Calendar; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.JspTagException; + +public class IfHumanTag extends AbstractDbTag { + private static final long serialVersionUID = -8243492975234898706L; + + private String hid; + + private boolean uselogonok = false; + + protected Users utente; + + protected boolean logonOk = false; + + protected static final String _WC = "_WC_HC"; + + protected static final String _NESTVAL = "_WC_HC_NESTVAL"; + + public int doAfterBody() throws JspException { + try { + this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter()); + return 0; + } catch (IOException ex) { + throw new JspTagException(ex.toString()); + } + } + + public int doStartTag() { + this.pageContext.setAttribute("_WC_HC", Boolean.valueOf(getWherecondition())); + if (getWherecondition()) + return 2; + return 0; + } + + private boolean getWherecondition() { + if (this.uselogonok && isUserLogged()) + return true; + Object obj = getReq().getSession().getAttribute(getSessionId()); + if (obj == null) + return false; + long tsMils = (Long)obj; + System.out.println(tsMils - Calendar.getInstance().getTimeInMillis()); + if (tsMils > Calendar.getInstance().getTimeInMillis()) + return true; + return false; + } + + private String getSessionId() { + return "_HC_" + getHid(); + } + + public String getHid() { + return (this.hid == null) ? "" : this.hid.trim(); + } + + public void setHid(String id) { + this.hid = id; + } + + public boolean isUselogonok() { + return this.uselogonok; + } + + public void setUselogonok(boolean logonok) { + this.uselogonok = logonok; + } + + private boolean isUserLogged() { + if (getLoginUserId(getReq()) != null && checkLoginProfile(getReq())) { + this.logonOk = true; + return true; + } + this.logonOk = false; + getReq().getSession().removeAttribute("utenteLogon"); + return false; + } + + protected Users getLoginUser(HttpServletRequest req) { + HttpSession session = req.getSession(true); + if (session.getAttribute("loginUser_id") != null) { + if (this.utente == null) { + Long l_id_utente = (Long)session.getAttribute("loginUser_id"); + Users utente = getUtente(); + utente.findByPrimaryKey(l_id_utente); + } + } else { + this.utente = null; + } + return this.utente; + } + + protected Long getLoginUserId(HttpServletRequest req) { + HttpSession session = req.getSession(true); + if (session.getAttribute("loginUser_id") != null) + return (Long)session.getAttribute("loginUser_id"); + return null; + } + + protected Users getUtente() { + return new Users(getApFull()); + } + + protected boolean isUseLogonCookie() { + String ulc = "false"; + if (this.pageContext.getServletContext().getInitParameter("useLogonCookie") != null) + ulc = this.pageContext.getServletContext().getInitParameter("useLogonCookie"); + return ulc.equals("true"); + } + + protected boolean checkLoginProfile(HttpServletRequest req) { + try { + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/taglib/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/taglib/package-info.java new file mode 100644 index 00000000..6653da07 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/human/taglib/package-info.java @@ -0,0 +1 @@ +package it.acxent.human.taglib; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/icecat/Icecat.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/icecat/Icecat.java new file mode 100644 index 00000000..a5cb9f2b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/icecat/Icecat.java @@ -0,0 +1,391 @@ +package it.acxent.icecat; + +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.Locale; +import java.util.Map; +import org.json.JSONArray; +import org.json.JSONObject; + +public class Icecat { + boolean debug = false; + + private static final String TABLE_HEADER_CATEGORY = "_category"; + + private static final String TABLE_ROW_VALUE = "_value"; + + private static final String TABLE_ROW_DESC = "_desc"; + + private static final String TABLE_ROWS = "\n_desc\n_value"; + + private static final String TABLE_HEADER = "\n_category\n"; + + private static final String TABLE_START = ""; + + private static final String J_REASONS_TO_BUY = "ReasonsToBuy"; + + private static final String J_PRESENTATION_VALUE = "PresentationValue"; + + private static final String J_FEATURE = "Feature"; + + private static final String J_FEATURES = "Features"; + + private static final String J_VALUE = "Value"; + + private static final String J_NAME = "Name"; + + private static final String J_FEATURE_GROUP = "FeatureGroup"; + + private static final String J_FEATURES_GROUPS = "FeaturesGroups"; + + private static final String J_PIC = "Pic"; + + private static final String J_GALLERY = "Gallery"; + + private static final String J_LONG_SUMMARY_DESCRIPTION = "LongSummaryDescription"; + + private static final String J_SHORT_SUMMARY_DESCRIPTION = "ShortSummaryDescription"; + + private static final String J_SUMMARY_DESCRIPTION = "SummaryDescription"; + + private static final String J_WARRANTY_INFO = "WarrantyInfo"; + + private static final String J_DISCLAIMER = "Disclaimer"; + + private static final String J_LONG_DESC = "LongDesc"; + + private static final String J_DESCRIPTION = "Description"; + + private static final String J_GENERATED_INT_TITLE = "GeneratedIntTitle"; + + private static final String J_TITLE_INFO = "TitleInfo"; + + private static final String J_TITLE = "Title"; + + private static final String J_DATA = "data"; + + private static final String J_GENERAL_INFO = "GeneralInfo"; + + public static final String CONTENT_All = "All"; + + public static final String CONTENT_GeneralInfo = "GeneralInfo"; + + public static final String CONTENT_Image = "Image"; + + public static final String CONTENT_Multimedia = "Multimedia"; + + public static final String CONTENT_Gallery = "Gallery"; + + public static final String CONTENT_FeatureLogos = "FeatureLogos"; + + public static final String CONTENTDescription = "Description"; + + public static final String CONTENTReasonsToBuy = "ReasonsToBuy"; + + public static final String CONTENT_Reviews = "Reviews"; + + public static final String CONTENT_Related = "Related"; + + public static final String CONTENT_Dictionary = "Dictionary"; + + private static final String SRV_ENDPOINT = "http://live.icecat.biz/api/?"; + + private String username; + + private String pwd; + + private String lang; + + private String content; + + private JSONObject jDatasheet; + + public Icecat(String username, String content, String lang) { + this.username = username; + this.content = content; + this.lang = lang; + } + + public Icecat(String username, String lang) { + this.username = username; + this.lang = lang; + } + + public Icecat(String username) { + this.username = username; + this.lang = Locale.ITALIAN.getLanguage(); + } + + public String getUsername() { + return (this.username == null) ? "openIcecat-live" : this.username.trim(); + } + + public void setUsername(String username) { + this.username = username; + } + + public String getLang() { + return this.lang; + } + + public void setLang(String lang) { + this.lang = lang; + } + + public String getContent() { + return (this.content == null) ? "All" : this.content.trim(); + } + + public void setContent(String content) { + this.content = content; + } + + public String getPwd() { + return this.pwd; + } + + public void setPwd(String pwd) { + this.pwd = pwd; + } + + public JSONObject getjDatasheet() { + return this.jDatasheet; + } + + public ResParm fetchGtin(String gtin) { + return fetchGtin(getContent(), gtin); + } + + public ResParm fetchProductCode(String brand, String productCode) { + return fetchProductCode(getContent(), brand, productCode); + } + + public ResParm fetchIcecatCode(String icecatCode) { + return fetchIcecatCode(getContent(), icecatCode); + } + + public ResParm fetchGtin(String content, String gtin) { + setjDatasheet(null); + StringBuilder sb = new StringBuilder("http://live.icecat.biz/api/?"); + sb.append("UserName="); + sb.append(getUsername()); + sb.append("&Language="); + sb.append(getLang().toLowerCase()); + sb.append("&Content="); + sb.append(content); + sb.append(">IN="); + sb.append(gtin); + ResParm rp = DBAdapter.getJSONObjectFromUrl(sb.toString()); + if (rp.getStatus()) { + setjDatasheet((JSONObject)rp.getReturnObj()); + } else { + DBAdapter.logDebug(this.debug, rp.getMsg()); + } + return rp; + } + + public ResParm fetchProductCode(String content, String brand, String productCode) { + setjDatasheet(null); + StringBuilder sb = new StringBuilder("http://live.icecat.biz/api/?"); + sb.append("UserName="); + sb.append(getUsername()); + sb.append("&Language="); + sb.append(getLang().toLowerCase()); + sb.append("&Content="); + sb.append(content); + sb.append("&Brand="); + sb.append(brand); + sb.append("&ProductCode="); + try { + sb.append(URLEncoder.encode(productCode, "UTF-8")); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + ResParm rp = DBAdapter.getJSONObjectFromUrl(sb.toString()); + if (rp.getStatus()) { + setjDatasheet((JSONObject)rp.getReturnObj()); + } else { + DBAdapter.logDebug(this.debug, rp.getMsg()); + } + return rp; + } + + public ResParm fetchIcecatCode(String content, String icecatCode) { + setjDatasheet(null); + StringBuilder sb = new StringBuilder("http://live.icecat.biz/api/?"); + sb.append("UserName="); + sb.append(getUsername()); + sb.append("&Language="); + sb.append(getLang().toLowerCase()); + sb.append("&Content="); + sb.append(content); + sb.append("&icecat_id="); + sb.append(icecatCode); + ResParm rp = DBAdapter.getJSONObjectFromUrl(sb.toString()); + if (rp.getStatus()) { + setjDatasheet((JSONObject)rp.getReturnObj()); + } else { + DBAdapter.logDebug(this.debug, rp.getMsg()); + } + return rp; + } + + public void setjDatasheet(JSONObject jDatasheet) { + this.jDatasheet = jDatasheet; + } + + public String getDSTitle() { + if (getjDatasheet() == null) + return ""; + return getjDatasheet().getJSONObject("data").getJSONObject("GeneralInfo").getJSONObject("TitleInfo") + .getString("GeneratedIntTitle"); + } + + public String getDSTitleLong() { + if (getjDatasheet() == null) + return ""; + return getjDatasheet().getJSONObject("data").getJSONObject("GeneralInfo").getString("Title"); + } + + public String getDSDescriptionLong() { + if (getjDatasheet() == null) + return ""; + return getjDatasheet().getJSONObject("data").getJSONObject("GeneralInfo").getJSONObject("Description").getString("LongDesc"); + } + + public String getDSDisclaimer() { + if (getjDatasheet() == null) + return ""; + return getjDatasheet().getJSONObject("data").getJSONObject("GeneralInfo").getJSONObject("Description").getString("Disclaimer"); + } + + public String getDSGaranzia() { + if (getjDatasheet() == null) + return ""; + return getjDatasheet().getJSONObject("data").getJSONObject("GeneralInfo").getJSONObject("Description") + .getString("WarrantyInfo"); + } + + public String getDSSummaryDescriptionShort() { + if (getjDatasheet() == null) + return ""; + return getjDatasheet().getJSONObject("data").getJSONObject("GeneralInfo").getJSONObject("SummaryDescription") + .getString("ShortSummaryDescription"); + } + + public String getDSSummaryDescriptionLong() { + if (getjDatasheet() == null) + return ""; + return getjDatasheet().getJSONObject("data").getJSONObject("GeneralInfo").getJSONObject("SummaryDescription") + .getString("LongSummaryDescription"); + } + + public LinkedHashSet getDSImageGallery() { + LinkedHashSet hsGal = new LinkedHashSet<>(); + if (getjDatasheet() != null) { + JSONArray jGallery = getjDatasheet().getJSONObject("data").getJSONArray("Gallery"); + jGallery.forEach(item -> { + JSONObject gal = (JSONObject)item; + hsGal.add(gal.getString("Pic")); + }); + } + return hsGal; + } + + public LinkedHashMap> getDSFeatures() { + LinkedHashMap> hsFeatures = new LinkedHashMap<>(); + if (getjDatasheet() != null) { + JSONArray jRows = getjDatasheet().getJSONObject("data").getJSONArray("FeaturesGroups"); + jRows.forEach(item -> { + JSONObject jrow = (JSONObject)item; + String title = jrow.getJSONObject("FeatureGroup").getJSONObject("Name").getString("Value"); + LinkedHashSet hsFeat = new LinkedHashSet<>(); + JSONArray jFeatures = jrow.getJSONArray("Features"); + jFeatures.forEach(item2 -> { + JSONObject jFeat = (JSONObject)item2; + IcecatFeature icef = new IcecatFeature(); + icef.setName(jFeat.getJSONObject("Feature").getJSONObject("Name").getString("Value")); + icef.setDescrizione(jFeat.getString("Description")); + icef.setValue(jFeat.getString("PresentationValue")); + hsFeat.add(icef); + }); + hsFeatures.put(title, hsFeat); + }); + } + return hsFeatures; + } + + public String getDSFeaturesTable(String footer) { + if (getjDatasheet() == null) + return ""; + StringBuilder sb = new StringBuilder("
"); + LinkedHashMap> features = getDSFeatures(); + for (Map.Entry> entry : features.entrySet()) { + String key = entry.getKey(); + sb.append("\n\n".replace("_category", key)); + LinkedHashSet icfSet = entry.getValue(); + for (IcecatFeature icf : icfSet) { + String temp = "\n\n".replace("_desc", icf.getName()); + temp = temp.replace("_value", icf.getValue()); + sb.append(temp); + } + } + if (!footer.isEmpty()) + sb.append("\n\n".replace("_category", footer)); + sb.append("\n
_category
_desc_value
_category
"); + return sb.toString(); + } + + public String getDSReasonToBuyTable(String intestazione) { + if (getjDatasheet() == null) + return ""; + LinkedHashSet hres = getDSReasonToBuy(); + if (hres.size() > 0) { + StringBuilder sb = new StringBuilder(""); + sb.append("\n\n".replace("_category", intestazione)); + for (IcecatReason icr : hres) { + String temp = "\n\n".replace("_desc", icr.getTitle()); + temp = temp.replace("_value", icr.getValue()); + sb.append(temp); + } + sb.append("\n
_category
_desc_value
"); + return sb.toString(); + } + return ""; + } + + public LinkedHashSet getDSReasonToBuy() { + LinkedHashSet hsReason = new LinkedHashSet<>(); + if (getjDatasheet() != null) { + JSONArray jRows = getjDatasheet().getJSONObject("data").getJSONArray("ReasonsToBuy"); + jRows.forEach(item -> { + JSONObject jrow = (JSONObject)item; + IcecatReason icer = new IcecatReason(); + icer.setTitle(jrow.getString("Title")); + icer.setValue(jrow.getString("Value")); + hsReason.add(icer); + }); + } + return hsReason; + } + + public HashMap getDSFeaturesHasMap() { + HashMap res = new HashMap<>(); + if (getjDatasheet() != null) { + LinkedHashMap> features = getDSFeatures(); + for (Map.Entry> entry : features.entrySet()) { + LinkedHashSet icfSet = entry.getValue(); + for (IcecatFeature icf : icfSet) + res.put(icf.getName(), icf.getValue()); + } + } + return res; + } + + public Icecat() {} +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/icecat/IcecatFeature.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/icecat/IcecatFeature.java new file mode 100644 index 00000000..68ed699a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/icecat/IcecatFeature.java @@ -0,0 +1,33 @@ +package it.acxent.icecat; + +public class IcecatFeature { + private String name; + + private String value; + + private String descrizione; + + public String getName() { + return (this.name == null) ? "" : this.name.trim(); + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return (this.value == null) ? "" : this.value.trim(); + } + + public void setValue(String value) { + this.value = value; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/icecat/IcecatReason.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/icecat/IcecatReason.java new file mode 100644 index 00000000..d1726452 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/icecat/IcecatReason.java @@ -0,0 +1,23 @@ +package it.acxent.icecat; + +public class IcecatReason { + private String title; + + private String value; + + public String getTitle() { + return (this.title == null) ? "" : this.title.trim(); + } + + public void setTitle(String name) { + this.title = name; + } + + public String getValue() { + return (this.value == null) ? "" : this.value.trim(); + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/icecat/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/icecat/package-info.java new file mode 100644 index 00000000..bbb07927 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/icecat/package-info.java @@ -0,0 +1 @@ +package it.acxent.icecat; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/AllegatoNews.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/AllegatoNews.java new file mode 100644 index 00000000..e0b95d49 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/AllegatoNews.java @@ -0,0 +1,157 @@ +package it.acxent.news; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class AllegatoNews extends DBAdapter implements Serializable { + private long id_allegatoNews; + + private long id_news; + + private long clickThroughAN; + + private String nomeFile; + + private News news; + + public AllegatoNews(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AllegatoNews() {} + + public void setId_allegatoNews(long newId_allegato) { + this.id_allegatoNews = newId_allegato; + } + + public void setId_news(long newId_news) { + this.id_news = newId_news; + setNews(null); + } + + public void setNomeFile(String newNomeFile) { + this.nomeFile = newNomeFile; + } + + public long getId_allegatoNews() { + return this.id_allegatoNews; + } + + public long getId_news() { + return this.id_news; + } + + public String getNomeFile() { + return (this.nomeFile == null) ? "" : this.nomeFile; + } + + public String getNomeFileCompleto() { + return getNomeFileCompleto(getDocBase() + getDocBase()); + } + + public String getNomeFileCompleto(String l_path) { + return l_path + l_path + "_" + getId_news(); + } + + public String getNomeFileRel() { + return getParm("NEWS_ATTACH_PATH").getTesto() + getParm("NEWS_ATTACH_PATH").getTesto() + "_" + getId_news(); + } + + public void setNews(News newNews) { + this.news = newNews; + } + + public News getNews() { + this.news = (News)getSecondaryObject(this.news, News.class, getId_news()); + return this.news; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() { + new File(getNomeFileCompleto()).delete(); + } + + public Vectumerator findByCR(AllegatoNewsCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ALLEGATO_NEWS AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findById_news(long l_id_news, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ALLEGATO_NEWS AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_news=" + l_id_news); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByNewsNomeFile(long l_id_news, String l_id_nomeFile) { + String s_Sql_Find = "select A.* from ALLEGATO_NEWS AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_news=" + l_id_news); + wc.addWc("A.nomeFile='" + l_id_nomeFile + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public long getClickThroughAN() { + return this.clickThroughAN; + } + + public void setClickThroughAN(long clickThroughAN) { + this.clickThroughAN = clickThroughAN; + } + + public void addClickThrough(String ipAddress, String entryPoint) { + try { + if (getDBState() == 1) + synchronized (this) { + setClickThroughAN(getClickThroughAN() + 1L); + save(); + } + } catch (Exception e) { + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/AllegatoNewsCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/AllegatoNewsCR.java new file mode 100644 index 00000000..129cd860 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/AllegatoNewsCR.java @@ -0,0 +1,56 @@ +package it.acxent.news; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AllegatoNewsCR extends CRAdapter { + private long id_allegatoNews; + + private long id_news; + + private String nomeFile; + + private News news; + + public AllegatoNewsCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AllegatoNewsCR() {} + + public void setId_allegatoNews(long newId_allegato) { + this.id_allegatoNews = newId_allegato; + } + + public void setId_news(long newId_news) { + this.id_news = newId_news; + setNews(null); + } + + public void setNomeFile(String newNomeFile) { + this.nomeFile = newNomeFile; + } + + public long getId_allegatoNews() { + return this.id_allegatoNews; + } + + public long getId_news() { + return this.id_news; + } + + public String getNomeFile() { + return (this.nomeFile == null) ? "" : this.nomeFile; + } + + public void setNews(News newNews) { + this.news = newNews; + } + + public News getNews() { + this.news = (News)getSecondaryObject(this.news, News.class, + + getId_news()); + return this.news; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/News.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/News.java new file mode 100644 index 00000000..f95c9ffa --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/News.java @@ -0,0 +1,488 @@ +package it.acxent.news; + +import it.acxent.anag.Users; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.DBAdapterException; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.mail.MailMessage; +import it.acxent.mail.MailProperties; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.net.URLEncoder; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Timestamp; + +public class News extends DBAdapter implements Serializable, AddImgInterface { + private Date dataNews; + + private Date dataFine; + + private Date dataFineVld; + + private Timestamp dataTmstUltAgg; + + private long flgVisibile; + + private long id_news; + + public static final String P_NEWS_ATTACH_PATH = "NEWS_ATTACH_PATH"; + + private static final String DEFAULT_NEWS_ATTACH_PATH = "_news/_attach/"; + + private static final String P_PATH_MAIL_NEWS = "PATH_MAIL_NEWS"; + + private String pathAllegatoOld; + + private long id_tipoNews; + + private TipoNews tipoNews; + + private Date dataInvio; + + public static final String P_NEWS_LANG_DEFAULT = "NEWS_LANG_DEFAULT"; + + class ThreadInviaNews extends Thread { + private final NewsCR CR; + + public ThreadInviaNews(NewsCR l_CR) { + this.CR = l_CR; + if (!News.isThreadAttivo()) { + News.threadInviaNews = true; + start(); + } + } + + public void run() { + try { + long numRecord = 0L; + long l_delayMsgEmail = News.this.getParm("CODA_MESSAGGI_EMAIL_DELAY").getNumeroLong() * 1000L; + Users users = new Users(this.CR.getApFull()); + NewsUsers nu = new NewsUsers(this.CR.getApFull()); + News news = new News(this.CR.getApFull()); + news.findByPrimaryKey(this.CR.getId_news()); + ResParm rp = new ResParm(true); + Vectumerator vec; + while ((vec = users.findUsersAbilitatiNewsByNews(this.CR.getId_news(), 1, 500)).hasMoreElements()) { + while (vec.hasMoreElements()) { + numRecord++; + Users row = (Users)vec.nextElement(); + rp = News.inviaMessaggioMail(news, row); + if (rp.getStatus()) { + rp = nu.addUser(news.getId_news(), row.getId_users(), ""); + } else { + rp = nu.addUser(news.getId_news(), row.getId_users(), rp.getMsg()); + } + if (news.getDataInvio() == null) { + news.setDataInvio(DBAdapter.getToday()); + news.save(); + } + News.threadInviaNewsMsg = "Attenzione! Thread invio news esecuzione!!! Record processati: " + numRecord; + if (vec.hasMoreElements()) { + System.out.println("sleep...."); + if (l_delayMsgEmail != 0L) + sleep(l_delayMsgEmail); + System.out.println(".. altro messaggio.."); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + News.this.handleDebug(e); + } + News.threadInviaNews = false; + System.out.println("Fine invio messaggio "); + } + } + + public static boolean threadInviaNews = false; + + public static String threadInviaNewsMsg = ""; + + private static final String DEFAULT_NEWS_IMG_PATH = "_news/_img/"; + + public static final String P_NEWS_IMG_PATH = "NEWS_IMG_PATH"; + + public static final String LIST_ALLEGATI = "listaAllegatiNews"; + + public News() {} + + public News(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(NewsCR CR, int pageNumber, int pageRows) throws DBAdapterException, SQLException { + String s_Sql_Find = "select A.* from NEWS AS A "; + s_Sql_Find = s_Sql_Find + " left JOIN TIPO_NEWS AS C ON A.id_tipoNews = C.id_tipoNews "; + String s_Sql_Order = " order by A.dataNews desc"; + if (CR.getFlgOrderBy() == 0L) + s_Sql_Order = " order by A.dataNews ASC"; + WcString wc = new WcString(); + if (!CR.getTitolo().isEmpty()) { + s_Sql_Find = s_Sql_Find + " INNER JOIN DESC_TXT_LANG AS B ON B.tabella = 'NEWS' AND ((B.campo = 'testo' AND B.idTabella = A.id_news and B.lang='it' ) OR (B.campo = 'titolo' AND B.idTabella = A.id_news and B.lang='it' )) "; + wc.addWc("B.descrizione like '%" + CR.getTitolo() + "%' "); + } + if (CR.getFlgVisibile() == 0L) { + wc.addWc("(A.flgVisibile is null or A.flgVisibile=0)"); + } else if (CR.getFlgVisibile() > 0L) { + wc.addWc("A.flgVisibile =" + CR.getFlgVisibile()); + } + if (CR.getFlgPubblica() > 0L) + wc.addWc("C.flgPubblica=" + CR.getFlgPubblica()); + if (CR.getId_tipoNews() > 0L) + wc.addWc("A.id_tipoNews=" + CR.getId_tipoNews()); + if (CR.getDataNews() != null) + wc.addWc("A.dataNews=?"); + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + int crCount = 1; + if (CR.getDataNews() != null) { + stmt.setDate(crCount, CR.getDataNews()); + crCount++; + } + return findRows(stmt, pageNumber, pageRows); + } + + public Date getDataNews() { + return this.dataNews; + } + + public String getFormattedDataNews() { + return getDataFormat().format(this.dataNews); + } + + public Date getDataFineVld() { + return this.dataFineVld; + } + + public Timestamp getDataTmstUltAgg() { + return this.dataTmstUltAgg; + } + + public long getId_news() { + return this.id_news; + } + + public void setDataNews(Date newData) { + this.dataNews = newData; + } + + public void setDataFineVld(Date newDataFineVld) { + this.dataFineVld = newDataFineVld; + } + + public void setDataTmstUltAgg(Timestamp newDataTmstUltAgg) { + this.dataTmstUltAgg = newDataTmstUltAgg; + } + + public void setId_news(long newId_news) { + this.id_news = newId_news; + } + + public void setFlgVisibile(long flgVisibile) { + this.flgVisibile = flgVisibile; + } + + public long getFlgVisibile() { + return this.flgVisibile; + } + + public String getVisibile() { + return (this.flgVisibile == 1L) ? "Si" : "No"; + } + + public String getPathAllegato() { + return getParm("NEWS_ATTACH_PATH").getTesto(); + } + + public String getPathAllegatoOld() { + return (this.pathAllegatoOld == null) ? "" : this.pathAllegatoOld; + } + + public String getNewsAttachPath() { + return getParm("NEWS_ATTACH_PATH").getTesto(); + } + + public ResParm addAllegato(AllegatoNews row) { + AllegatoNews bean = new AllegatoNews(getApFull()); + bean.findByNewsNomeFile(row.getId_news(), row.getNomeFile()); + if (bean.getDBState() == 1) + return new ResParm(false, "Nome File Duplicato"); + row.setDBState(0); + ResParm rp = row.save(); + return rp; + } + + public ResParm delAllegato(AllegatoNews row) { + AllegatoNews bean = new AllegatoNews(getApFull()); + bean.findByPrimaryKey(row.getId_allegatoNews()); + return bean.delete(); + } + + public Vectumerator getAllegati() { + return new AllegatoNews(getApFull()).findById_news(getId_news(), 0, 0); + } + + public static final void initApplicationParms(ApplParmFull ap) { + boolean debug = false; + if (ap != null) { + DBAdapter.logDebug(debug, "News initParms: start"); + Parm bean = new Parm(ap); + String l_tipoParm = "NEWS"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("NEWS_LANG_DEFAULT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("NEWS_LANG_DEFAULT"); + bean.setDescrizione("NEWS_LANG_DEFAULT"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("it"); + bean.setNota("LINGUA DI DEFAULT PER LA VISUALIZZAZIONE DELLE NEWS. SE NON C'E' LA DESCRIZIONE IL LINGUA PRENDO QUELLA DELLA LINGUA DI DEFAULT.
UTILIZZARE I CODICE STANDARD (it, en, de, fr, ...="); + bean.save(); + bean.findByCodice("NEWS_IMG_PATH"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("NEWS_IMG_PATH"); + bean.setDescrizione("NEWS_IMG_PATH"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_news/_img/"); + bean.setNota("NEWS IMG PATH RELATIVO A docBase. Default: _news/_img/. (deve finire con /)"); + bean.save(); + bean.findByCodice("NEWS_ATTACH_PATH"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("NEWS_ATTACH_PATH"); + bean.setDescrizione("NEWS_ATTACH_PATH"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_news/_attach/"); + bean.setNota("NEWS ATTACH PATH RELATIVO A docBase. Default: _news/_attach/. (deve finire con /)"); + bean.save(); + bean.findByCodice("PATH_IMG_NEWSLETTER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PATH_IMG_NEWSLETTER"); + bean.setDescrizione("PATH_IMG_NEWSLETTER"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_news/_newsletterImg/"); + bean.setNota("NEWSLETTER PATH IMMAGINI RELATIVO A docBase. Default: _news/_newsletterImg/. (deve finire con /)"); + bean.save(); + bean.findByCodice("PATH_MAIL_NEWS"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PATH_MAIL_NEWS"); + bean.setDescrizione("PATH_MAIL_NEWS"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("mailMessage/news.txt"); + bean.setNota("NEWS PATH RELATIVO AL TEMPLATE MAIL"); + bean.save(); + DBAdapter.logDebug(debug, "News initParms: stop"); + } + } + + public long getId_tipoNews() { + return this.id_tipoNews; + } + + public void setTipoNews(TipoNews newTipoNews) { + this.tipoNews = newTipoNews; + } + + public TipoNews getTipoNews() { + this.tipoNews = (TipoNews)getSecondaryObject(this.tipoNews, TipoNews.class, getId_tipoNews()); + return this.tipoNews; + } + + public void setId_tipoNews(long id_tipoNews) { + this.id_tipoNews = id_tipoNews; + setTipoNews(null); + } + + public String getPathImmagini() { + return getParm("NEWS_IMG_PATH").getTesto(); + } + + public String getNewsLangDefault() { + return getParm("NEWS_LANG_DEFAULT").getTesto(); + } + + public boolean useDescLangTables() { + return true; + } + + public String getTitolo() { + return getTitolo("it"); + } + + public String getTitolo(String lang) { + if (lang.isEmpty()) + lang = "it"; + String temp = getDescTxtLang("titolo", lang); + if (temp.isEmpty()) + return getDescTxtLang("titolo", getNewsLangDefault()); + return temp; + } + + public String getTitolo(String lang, int stringCaseType) { + String str = new String(); + str = convertStringCase(getTitolo(lang), stringCaseType); + return str; + } + + public String getTesto() { + return getTesto("it"); + } + + public String getTesto(String lang) { + if (lang.isEmpty()) + lang = "it"; + getDescTxtLang("testo", lang); + String temp = getDescTxtLang("testo", lang); + if (temp.isEmpty()) + return getDescTxtLang("testo", getNewsLangDefault()); + return temp; + } + + public String getTesto(String lang, int stringCaseType) { + String str = new String(); + str = convertStringCase(getTesto(lang), stringCaseType); + return str; + } + + public String getSommario() { + return getSommario("it"); + } + + public String getSommario(String lang) { + if (lang.isEmpty()) + lang = "it"; + String temp = getDescTxtLang("sommario", lang); + if (temp.isEmpty()) + return getDescTxtLang("sommario", getNewsLangDefault()); + return temp; + } + + public String getSommario(String lang, int stringCaseType) { + String str = new String(); + str = convertStringCase(getSommario(lang), stringCaseType); + return str; + } + + public String getLink() { + return getLink("it"); + } + + public String getLink(String lang) { + if (lang.isEmpty()) + lang = "it"; + String temp = getDescTxtLang("link", lang); + if (temp.isEmpty()) + return getDescTxtLang("link", getNewsLangDefault()); + return temp; + } + + public String getLink(String lang, int stringCaseType) { + String str = new String(); + str = convertStringCase(getTitolo(lang), stringCaseType); + return str; + } + + public Date getDataInvio() { + return this.dataInvio; + } + + public void setDataInvio(Date dataInvio) { + this.dataInvio = dataInvio; + } + + public static boolean isThreadAttivo() { + return threadInviaNews; + } + + public synchronized ResParm inviaMessaggi(NewsCR CR) { + if (!isThreadAttivo()) { + new ThreadInviaNews(CR); + return new ResParm(true, "Thread invio messaggi avviato...."); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public void findLastNews() { + String s_Sql_Find = "select A.* from NEWS AS A "; + String s_Sql_Order = " order by A.dataNews desc, A.id_news desc"; + WcString wc = new WcString(); + wc.addWc("A.flgVisibile=1"); + wc.addWc("(A.dataFine is null || A.dataFine>?)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + stmt.setDate(1, getToday()); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e); + } + } + + public String getTitoloUrl(String lang) { + String temp = getTitolo(lang); + try { + temp = temp.replace("/", "-"); + temp = temp.replace("€", "€"); + return URLEncoder.encode(temp, "utf-8"); + } catch (Exception e) { + return temp; + } + } + + public static final synchronized ResParm inviaMessaggioMail(News bean, Users users) { + ResParm rp = new ResParm(true); + MailProperties mp = new MailProperties(); + if (users.getEMail().isEmpty()) { + mp.put("TO", users.getClifor().getEMail()); + } else { + mp.put("TO", users.getEMail()); + } + mp.put("FROM", bean.getParm("CODA_MESSAGGI_MAIL_FROM").getTesto()); + mp.put("SUBJECT", "Econpower: " + bean.getTitolo(users.getLang())); + mp.put("ISHTML", "false"); + String mailMessage = bean.getDocBase() + bean.getDocBase(); + MailMessage mf = new MailMessage(bean.getApFull(), mailMessage); + mf.setQuestionMark(false); + if (users.getId_clifor() == 0L) { + mf.setString("cliente", users.getCognomeNome()); + } else { + mf.setString("cliente", users.getClifor().getDescrizioneCliente()); + } + mf.setString("sommario", bean.getSommario(users.getLang())); + mp.put("MSG", mf.getMessage()); + MailMessage mm = new MailMessage(bean.getApFull()); + rp = mm.sendMailMessage(mp, false); + return rp; + } + + public Date getDataFine() { + return this.dataFine; + } + + public void setDataFine(Date dataFine) { + this.dataFine = dataFine; + } + + public String getPathImg() { + return getPathImmagini(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/NewsCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/NewsCR.java new file mode 100644 index 00000000..bdea428a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/NewsCR.java @@ -0,0 +1,109 @@ +package it.acxent.news; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class NewsCR extends CRAdapter { + public static final long ORDER_BY_DATA_ASC = 0L; + + public static final long ORDER_BY_DATA_DESC = 1L; + + private String titolo; + + private long flgVisibile = -1L; + + private Date dataNews; + + private Date dataFine; + + private long flgTipo; + + private long id_news; + + private long flgPubblica; + + private long id_tipoNews; + + private TipoNews tipoNews; + + public NewsCR() {} + + public NewsCR(ApplParmFull newAp) { + super(newAp); + } + + public Date getDataNews() { + return this.dataNews; + } + + public String getTitolo() { + return (this.titolo == null) ? "" : this.titolo; + } + + public void setDataNews(Date newData) { + this.dataNews = newData; + } + + public void setTitolo(String newTitolo) { + this.titolo = newTitolo; + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public void setFlgTipo(long flgTipo) { + this.flgTipo = flgTipo; + } + + public void setFlgVisibile(long flgVisibile) { + this.flgVisibile = flgVisibile; + } + + public long getFlgVisibile() { + return this.flgVisibile; + } + + public long getId_news() { + return this.id_news; + } + + public void setId_news(long id_news) { + this.id_news = id_news; + } + + public long getFlgPubblica() { + return this.flgPubblica; + } + + public void setFlgPubblica(long flgPubblica) { + this.flgPubblica = flgPubblica; + } + + public long getId_tipoNews() { + return this.id_tipoNews; + } + + public TipoNews getTipoNews() { + this.tipoNews = (TipoNews)getSecondaryObject(this.tipoNews, TipoNews.class, getId_tipoNews()); + return this.tipoNews; + } + + public void setId_tipoNews(long id_tipoNews) { + this.id_tipoNews = id_tipoNews; + setTipoNews(null); + } + + public void setTipoNews(TipoNews newTipoNews) { + this.tipoNews = newTipoNews; + } + + public Date getDataFine() { + return this.dataFine; + } + + public void setDataFine(Date dataFine) { + this.dataFine = dataFine; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/NewsUsers.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/NewsUsers.java new file mode 100644 index 00000000..a481a202 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/NewsUsers.java @@ -0,0 +1,177 @@ +package it.acxent.news; + +import it.acxent.anag.Users; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.Calendar; + +public class NewsUsers extends DBAdapter implements Serializable { + private static final long serialVersionUID = 6424449574380883136L; + + private long id_newsUsers; + + private long id_users; + + private long id_news; + + private Timestamp tmstInvio; + + private News news; + + private Users users; + + private String result; + + public NewsUsers(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public NewsUsers() {} + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(NewsUsersCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from NEWS_USERS AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (CR.getId_news() > 0L) + wc.addWc(" A.id_news = " + CR.getId_news()); + if (CR.getId_users() > 0L) + wc.addWc(" A.id_users = " + CR.getId_users()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_newsUsers() { + return this.id_newsUsers; + } + + public void setId_newsUsers(long id_newsUsers) { + this.id_newsUsers = id_newsUsers; + } + + public long getId_users() { + return this.id_users; + } + + public void setId_users(long id_users) { + this.id_users = id_users; + } + + public long getId_news() { + return this.id_news; + } + + public void setId_news(long id_news) { + this.id_news = id_news; + } + + public Timestamp getTmstInvio() { + return this.tmstInvio; + } + + public void setTmstInvio(Timestamp tmstInvio) { + this.tmstInvio = tmstInvio; + } + + public void findByNewsUsers(long l_id_news, long l_id_users) { + String s_Sql_Find = "select A.* from NEWS_USERS AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_news = " + l_id_news); + wc.addWc(" A.id_users = " + l_id_users); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public News getNews() { + this.news = (News)getSecondaryObject(this.news, News.class, getId_news()); + return this.news; + } + + public void setNews(News news) { + this.news = news; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users()); + return this.users; + } + + public void setUsers(Users users) { + this.users = users; + } + + public Vectumerator findByNews(long l_id_news) { + String s_Sql_Find = "select A.* from NEWS_USERS AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_news = " + l_id_news); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByUsers(long l_id_users) { + String s_Sql_Find = "select A.* from NEWS_USERS AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_users = " + l_id_users); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public ResParm addUser(long l_id_news, long l_id_user, String result) { + findByNewsUsers(l_id_news, l_id_user); + setId_news(l_id_news); + setId_users(l_id_user); + setTmstInvio(new Timestamp(Calendar.getInstance().getTimeInMillis())); + setResult(result); + ResParm rp = save(); + return rp; + } + + public String getResult() { + return (this.result == null) ? "" : this.result.trim(); + } + + public void setResult(String result) { + this.result = result; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/NewsUsersCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/NewsUsersCR.java new file mode 100644 index 00000000..a6780e75 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/NewsUsersCR.java @@ -0,0 +1,77 @@ +package it.acxent.news; + +import it.acxent.anag.Users; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import java.sql.Date; + +public class NewsUsersCR extends CRAdapter { + private long id_newsUsers; + + private long id_users; + + private long id_news; + + private Date tmstInvio; + + private News news; + + private Users users; + + public NewsUsersCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public NewsUsersCR() {} + + public long getId_newsUsers() { + return this.id_newsUsers; + } + + public void setId_newsUsers(long id_newsUsers) { + this.id_newsUsers = id_newsUsers; + } + + public long getId_users() { + return this.id_users; + } + + public void setId_users(long id_users) { + this.id_users = id_users; + } + + public long getId_news() { + return this.id_news; + } + + public void setId_news(long id_news) { + this.id_news = id_news; + } + + public Date getTmstInvio() { + return this.tmstInvio; + } + + public void setTmstInvio(Date tmstInvio) { + this.tmstInvio = tmstInvio; + } + + public News getNews() { + this.news = (News)getSecondaryObject(this.news, News.class, getId_news()); + return this.news; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users()); + return this.users; + } + + public void setNews(News news) { + this.news = news; + } + + public void setUsers(Users users) { + this.users = users; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/Newsletter.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/Newsletter.java new file mode 100644 index 00000000..499d9360 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/Newsletter.java @@ -0,0 +1,171 @@ +package it.acxent.news; + +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Newsletter extends DBAdapter implements Serializable, AddImgInterface { + private long id_newsletter; + + private Date dataNewsletter; + + private String testo_it; + + private String testo_en; + + private String titolo_it; + + private String titolo_en; + + private String imgTmst; + + public static final String DEFAULT_NEWSLETTER_IMG_PATH = "_news/_newsletterImg/"; + + public static final String P_PATH_IMG_NEWSLETTER = "PATH_IMG_NEWSLETTER"; + + public Newsletter(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Newsletter() {} + + public void setId_newsletter(long newId_newsletter) { + this.id_newsletter = newId_newsletter; + } + + public void setDataNewsletter(Date newDataNewsletter) { + this.dataNewsletter = newDataNewsletter; + } + + public void setTitolo_it(String newTitolo_it) { + this.titolo_it = newTitolo_it; + } + + public void setTitolo_en(String newTitolo_en) { + this.titolo_en = newTitolo_en; + } + + public void setImgTmst(String newImgTmst) { + this.imgTmst = newImgTmst; + } + + public long getId_newsletter() { + return this.id_newsletter; + } + + public Date getDataNewsletter() { + return this.dataNewsletter; + } + + public String getTitolo_it() { + return (this.titolo_it == null) ? "" : this.titolo_it; + } + + public String getTitolo_en() { + return (this.titolo_en == null) ? "" : this.titolo_en; + } + + public String getImgTmst() { + return (this.imgTmst == null) ? "" : this.imgTmst; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(NewsletterCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from NEWSLETTER AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getPathImgNewsletter() { + return getParm("PATH_IMG_NEWSLETTER").getTesto(); + } + + public String getTitolo() { + return getTitolo_it(); + } + + public String getLinkPreview() { + if (getApFull() != null) { + String temp = getParm("SERVERNAME").getTesto(); + try { + return temp + "Newsletter.abl?id=" + temp; + } catch (Exception e) { + return "ERRORE encoding url"; + } + } + return ""; + } + + public String getTitolo(String lang) { + return getLangField("titolo", lang); + } + + public String getImgFileName(int imgNumber) { + return getImgFileName(imgNumber, getImgTmst()); + } + + public String getImgFileName(int imgNumber, String oldTmst) { + return "" + getId_newsletter() + "_" + getId_newsletter() + "_" + oldTmst + ".jpg"; + } + + public String getTesto_en() { + return (this.testo_en == null) ? "" : this.testo_en; + } + + public void setTesto_en(String testo_en) { + this.testo_en = testo_en; + } + + public String getTesto_it() { + return (this.testo_it == null) ? "" : this.testo_it; + } + + public void setTesto_it(String testo_it) { + this.testo_it = testo_it; + } + + public String getTesto() { + return getTesto_it(); + } + + public String getTesto(String lang) { + return getLangField("testo", lang); + } + + public String getPathImg() { + return getPathImgNewsletter(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/NewsletterCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/NewsletterCR.java new file mode 100644 index 00000000..0be9beb7 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/NewsletterCR.java @@ -0,0 +1,67 @@ +package it.acxent.news; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class NewsletterCR extends CRAdapter { + private long id_newsletter; + + private Date dataNewsletter; + + private String titolo_it; + + private String titolo_en; + + private String imgTmst; + + public NewsletterCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public NewsletterCR() {} + + public void setId_newsletter(long newId_newsletter) { + this.id_newsletter = newId_newsletter; + } + + public void setDataNewsletter(Date newDataNewsletter) { + this.dataNewsletter = newDataNewsletter; + } + + public void setTitolo_it(String newTitolo_it) { + this.titolo_it = newTitolo_it; + } + + public void setTitolo_en(String newTitolo_en) { + this.titolo_en = newTitolo_en; + } + + public void setImgTmst(String newImgTmst) { + this.imgTmst = newImgTmst; + } + + public long getId_newsletter() { + return this.id_newsletter; + } + + public Date getDataNewsletter() { + return this.dataNewsletter; + } + + public String getTitolo_it() { + return (this.titolo_it == null) ? "" : this.titolo_it; + } + + public String getTitolo_en() { + return (this.titolo_en == null) ? "" : this.titolo_en; + } + + public String getImgTmst() { + return (this.imgTmst == null) ? "" : this.imgTmst; + } + + public String getTitolo() { + return getTitolo_it(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/TipoNews.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/TipoNews.java new file mode 100644 index 00000000..bc797720 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/TipoNews.java @@ -0,0 +1,79 @@ +package it.acxent.news; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoNews extends DBAdapter implements Serializable { + private long id_tipoNews; + + private long flgPubblica; + + public TipoNews(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoNews() {} + + public void setId_tipoNews(long newId_tipoNews) { + this.id_tipoNews = newId_tipoNews; + } + + public long getId_tipoNews() { + return this.id_tipoNews; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoNewsCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_NEWS AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgPubblica() { + return this.flgPubblica; + } + + public void setFlgPubblica(long flgPubblica) { + this.flgPubblica = flgPubblica; + } + + public boolean useDescLangTables() { + return true; + } + + public String getDescrizione() { + return getDescrizione("it"); + } + + public String getDescrizione(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizione", lang); + } + + public String getDescrizione(String lang, int stringCaseType) { + String str = new String(); + str = convertStringCase(getDescrizione(lang), stringCaseType); + return str; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/TipoNewsCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/TipoNewsCR.java new file mode 100644 index 00000000..c3f2e094 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/TipoNewsCR.java @@ -0,0 +1,32 @@ +package it.acxent.news; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoNewsCR extends CRAdapter { + private long id_tipoNews; + + private String descrizione; + + public TipoNewsCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoNewsCR() {} + + public void setId_tipoNews(long newId_tipoNews) { + this.id_tipoNews = newId_tipoNews; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoNews() { + return this.id_tipoNews; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/GetNewsAttachSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/GetNewsAttachSvlt.java new file mode 100644 index 00000000..9f7699b1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/GetNewsAttachSvlt.java @@ -0,0 +1,24 @@ +package it.acxent.news.servlet; + +import it.acxent.news.AllegatoNews; +import it.acxent.servlet.GetFileSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/_news/_attach/*"}) +public class GetNewsAttachSvlt extends GetFileSvlt { + protected String getFileName(HttpServletRequest req, HttpServletResponse res) { + AllegatoNews bean = new AllegatoNews(getApFull(req)); + bean.findByPrimaryKey(getRequestLongParameter(req, "id")); + boolean isWeb = (getRequestLongParameter(req, "w") == 1L); + if (isWeb) + bean.addClickThrough(req.getRemoteAddr(), req.getServletPath()); + String fileName = bean.getNomeFileCompleto(); + return fileName; + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/NewsSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/NewsSvlt.java new file mode 100644 index 00000000..f1807ae2 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/NewsSvlt.java @@ -0,0 +1,202 @@ +package it.acxent.news.servlet; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.DBAdapterException; +import it.acxent.db.ResParm; +import it.acxent.news.AllegatoNews; +import it.acxent.news.News; +import it.acxent.news.NewsCR; +import it.acxent.news.TipoNews; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.Vectumerator; +import java.sql.SQLException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@Object(urlPatterns = {"/News.abl"}) +public class NewsSvlt extends AblServletSvlt { + private static final long serialVersionUID = 476646217816287146L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + News bean = (News)beanA; + req.setAttribute("listaAllegati", bean.getAllegati()); + req.setAttribute("listaTipoNews", new TipoNews(getApFull(req)).findAll()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaTipoNews", new TipoNews(getApFull(req)).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new News(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new NewsCR(getApFull(req)); + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + search(req, res); + } + + public void _last(HttpServletRequest req, HttpServletResponse res) { + News news = new News(getApFull(req)); + news.findLastNews(); + req.setAttribute("bean", news); + setJspPage("/news.jsp", req); + callJsp(req, res); + } + + public void _getTimelineOld(HttpServletRequest req, HttpServletResponse res) { + String lang = (String)req.getSession().getAttribute("lang"); + StringBuilder sb = new StringBuilder(); + try { + NewsCR CR = new NewsCR(); + CR.getFlgPubblica(); + CR.getId_tipoNews(); + Vectumerator vec = new News(getApFull(req)).findByCR(CR, 0, 0); + sb.append("{\"timeline\":{"); + sb.append("\"headline\":\"\","); + sb.append("\"type\":\"default\","); + sb.append("\"text\":\"

News TechnoPlants

\","); + sb.append("\"date\":[{"); + StringBuilder sbd = new StringBuilder(); + while (vec.hasMoreElements()) { + News news = (News)vec.nextElement(); + if (sbd.length() > 0) + sbd.append("},{"); + sbd.append("\"startDate\":\"" + news.getDataNews().toString().replace("-", ",") + "\","); + if (news.getDataFine() != null) { + sbd.append("\"endDate\":\"" + news.getDataFine().toString().replace("-", ",") + "\","); + } else { + sbd.append("\"endDate\":\"" + news.getDataNews().toString().replace("-", ",") + "\","); + } + sbd.append("\"headline\":\"" + news.getTitolo(lang) + "\","); + sbd.append("\"text\":\"prova\","); + sbd.append("\"tag\":\"" + news.getTipoNews().getDescrizione(lang) + "\","); + sbd.append("\"asset\":"); + sbd.append("{"); + if (news.getId_tipoNews() == 3L) { + if (!news.getLink(lang).isEmpty()) + sbd.append("\"media\":\"" + news.getLink(lang) + "\""); + } else { + if (isFileExist(getDocBase() + getDocBase() + news.getPathImmagini())) + sbd.append("\"media\":\"" + news.getPathImmagini() + news.getImgFileName(2) + "\","); + if (isFileExist(getDocBase() + getDocBase() + news.getPathImmagini())) + sbd.append("\"thumbnail\":\"" + news.getPathImmagini() + news.getImgFileName(1) + "\","); + sbd.append("\"caption\":\"" + news.getLink(lang) + "\""); + } + sbd.append("}"); + } + if (sbd.length() > 0) + sb.append(sbd.toString()); + sb.append("}]}}"); + } catch (DBAdapterException e) { + e.printStackTrace(); + } catch (SQLException e) { + e.printStackTrace(); + } + System.out.println(sb.toString()); + sendHtmlMsgResponse(req, res, sb.toString()); + } + + public void _getTimeline(HttpServletRequest req, HttpServletResponse res) { + String lang = (String)req.getSession().getAttribute("lang"); + StringBuilder sb = new StringBuilder(); + try { + NewsCR CR = new NewsCR(); + CR.getId_tipoNews(); + Vectumerator vec = new News(getApFull(req)).findByCR(CR, 0, 0); + sb.append("{"); + sb.append("\"events\":[{"); + StringBuilder sbd = new StringBuilder(); + while (vec.hasMoreElements()) { + News news = (News)vec.nextElement(); + if (sbd.length() > 0) + sbd.append("},{"); + String temp = news.getDataNews().toString(); + if (temp.equals("2020-03-17")) + System.out.println("_getTimeline: data " + temp); + sbd.append("\"start_date\":{\"month\": \""); + sbd.append(temp.substring(5, 7)); + sbd.append("\",\"day\": \""); + sbd.append(temp.substring(8, 10)); + sbd.append("\",\"year\": \""); + sbd.append(temp.substring(0, 4)); + sbd.append("\"},"); + if (news.getDataFine() != null) { + temp = news.getDataFine().toString(); + sbd.append("\"end_date\":{\"month\": \""); + sbd.append(temp.substring(5, 7)); + sbd.append("\",\"day\": \""); + sbd.append(temp.substring(8, 10)); + sbd.append("\",\"year\": \""); + sbd.append(temp.substring(0, 4)); + sbd.append("\"},"); + } else { + temp = news.getDataNews().toString(); + sbd.append("\"end_date\":{\"month\": \""); + sbd.append(temp.substring(5, 7)); + sbd.append("\",\"day\": \""); + sbd.append(temp.substring(8, 10)); + sbd.append("\",\"year\": \""); + sbd.append(temp.substring(0, 4)); + sbd.append("\"},"); + } + sbd.append("\"text\":{"); + sbd.append("\"headline\":\"" + news.getTitolo(lang) + "\","); + sbd.append("\"text\":\"" + news.getTesto(lang).replace("\"", "'") + "\""); + sbd.append("}"); + if (!news.getLink(lang).isEmpty()) { + sbd.append(",\"media\":{\"url\": \"" + news.getLink(lang) + "\""); + sbd.append(",\"caption\":\"" + news.getLink(lang) + "\""); + sbd.append("}"); + continue; + } + if (isFileExist(getDocBase() + getDocBase() + news.getPathImmagini())) { + sbd.append(",\"media\":{\"url\": \"" + news.getPathImmagini() + news.getImgFileName(2) + "\""); + sbd.append(",\"thumbnail\": \"" + news.getPathImmagini() + news.getImgFileName(2) + "\""); + sbd.append(",\"caption\":\"" + news.getTitolo(lang) + "\""); + sbd.append("}"); + continue; + } + if (isFileExist(getDocBase() + getDocBase() + news.getPathImmagini())) { + sbd.append(",\"media\":{\"url\": \"" + news.getPathImmagini() + news.getImgFileName(1) + "\""); + sbd.append(",\"thumbnail\": \"" + news.getPathImmagini() + news.getImgFileName(1) + "\""); + sbd.append(",\"caption\":\"" + news.getTitolo(lang) + "\""); + sbd.append("}"); + } + } + if (sbd.length() > 0) + sb.append(sbd.toString()); + sb.append("}]}"); + } catch (DBAdapterException e) { + e.printStackTrace(); + } catch (SQLException e) { + e.printStackTrace(); + } + System.out.println(sb.toString()); + sendHtmlMsgResponse(req, res, sb.toString()); + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("flgOrderBy", "1"); + return super.beforeSearch(req, res); + } + + public void _addClickThroughAttach(HttpServletRequest req, HttpServletResponse res) { + AllegatoNews bean = new AllegatoNews(getApFull(req)); + bean.findByPrimaryKey(getRequestLongParameter(req, "id")); + bean.addClickThrough(req.getRemoteAddr(), req.getServletPath()); + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("flgVisibile", "1"); + super.search(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/NewsletterSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/NewsletterSvlt.java new file mode 100644 index 00000000..960ab7e6 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/NewsletterSvlt.java @@ -0,0 +1,46 @@ +package it.acxent.news.servlet; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.news.Newsletter; +import it.acxent.news.NewsletterCR; +import it.acxent.reg.EcDc; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/Newsletter.abl"}) +public class NewsletterSvlt extends AblServletSvlt { + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Newsletter(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new NewsletterCR(getApFull(req)); + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected void showBean(HttpServletRequest req, HttpServletResponse res) { + String id = getRequestParameter(req, "id"); + if (!id.isEmpty()) { + String idd = EcDc.decode64String(id); + int nidx = idd.indexOf("xyz"); + if (nidx > 0) + req.setAttribute("id_newsletter", idd.substring(nidx + 3, + idd.length())); + } + super.showBean(req, res); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/CopyOfNewsSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/CopyOfNewsSvlt.java new file mode 100644 index 00000000..41a84dee --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/CopyOfNewsSvlt.java @@ -0,0 +1,133 @@ +package it.acxent.news.servlet.admin; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.news.AllegatoNews; +import it.acxent.news.News; +import it.acxent.news.NewsCR; +import it.acxent.news.TipoNews; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.AbMessages; +import it.acxent.util.Vectumerator; +import java.io.File; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class CopyOfNewsSvlt extends AblServletSvlt { + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + News bean = (News)beanA; + req.setAttribute("listaAllegati", bean.getAllegati()); + req.setAttribute("listaTipoNews", new TipoNews(getApFull(req)).findAll()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaTipoNews", new TipoNews(getApFull(req)).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new News(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new NewsCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected void manageMultipartRequest(HttpServletRequest req, HttpServletResponse res) { + String targetDir = getDocBase() + getDocBase(); + String[] fileNameParameters = { "nomeFile" }; + try { + if (getLoginUserGrant(req, new News().getTableBeanName()) >= 3L) { + if (manageMultipartRequestParameters(req, 2000, fileNameParameters, null, null, targetDir)) { + processNoEncTypeRequest(req, res); + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "MR_FILE_ERROR")); + showBean(req, res); + } + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_RW")); + showBean(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + long l_id = 0L; + ResParm rp = new ResParm(true, ""); + l_id = getRequestLongParameter(req, "id_news"); + News bean = new News(getApFull(req)); + try { + bean.findByPrimaryKey(l_id); + if (getAct(req).equals("addAllegato")) { + AllegatoNews row = new AllegatoNews(getApFull(req)); + fillObject(req, row); + rp = bean.addAllegato(row); + rp.append(creaFileAllegato(bean, req, res)); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delAllegato")) { + AllegatoNews row = new AllegatoNews(getApFull(req)); + fillObject(req, row); + rp = bean.delAllegato(row); + sendMessage(req, + + AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Allegato Cancellato"); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, + AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected ResParm creaFileAllegato(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + synchronized (this) { + ResParm rp = new ResParm(true, ""); + News bean = (News)beanA; + String targetDir = bean.getPathAllegato(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + "/" + targetDir + "_"; + Vectumerator completeFileNames = (Vectumerator) + req.getAttribute("completeAttachName"); + Vectumerator fileNames = (Vectumerator) + req.getAttribute("attachName"); + if (completeFileNames.hasMoreElements()) { + String sourceFile = (String)completeFileNames.nextElement(); + String fileName = (String)fileNames.elementAt(0); + targetFile = targetFile + targetFile; + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + } + return rp; + } + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getLoginUser(req).getId_users() == 1L && + getCmd(req).equals("init")) { + News.initApplicationParms(getApFull(req)); + sendMessage(req, "Parametri news creati."); + } + search(req, res); + } + + protected boolean isLoadImageServlet() { + return true; + } + + protected String getAttachPath(HttpServletRequest req) { + String act = getAct(req); + if (act.equals("addAllegato")) + return getParm("NEWS_ATTACH_PATH").getTesto(); + return getParm("NEWS_IMG_PATH").getTesto(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/NewsSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/NewsSvlt.java new file mode 100644 index 00000000..145d8086 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/NewsSvlt.java @@ -0,0 +1,232 @@ +package it.acxent.news.servlet.admin; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.news.AllegatoNews; +import it.acxent.news.News; +import it.acxent.news.NewsCR; +import it.acxent.news.NewsUsers; +import it.acxent.news.TipoNews; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.AbMessages; +import it.acxent.util.Vectumerator; +import java.io.File; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/news/News.abl"}) +public class NewsSvlt extends AblServletSvlt { + private static final long serialVersionUID = -6717828355281261494L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + News bean = (News)beanA; + req.setAttribute("listaAllegati", bean.getAllegati()); + req.setAttribute("listaTipoNews", new TipoNews(getApFull(req)).findAll()); + req.setAttribute("listaUsers", new NewsUsers(getApFull(req)).findByNews(bean.getId_news())); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaTipoNews", new TipoNews(getApFull(req)).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new News(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new NewsCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaTipoNews", new TipoNews(getApFull(req)).findAll()); + } + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + long l_id = 0L; + ResParm rp = new ResParm(true, ""); + l_id = getRequestLongParameter(req, "id_news"); + News bean = new News(getApFull(req)); + try { + bean.findByPrimaryKey(l_id); + if (getAct(req).equals("addAllegato")) { + AllegatoNews row = new AllegatoNews(getApFull(req)); + fillObject(req, row); + rp = bean.addAllegato(row); + rp.append(creaFileAllegato(bean, req, res)); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delAllegato")) { + AllegatoNews row = new AllegatoNews(getApFull(req)); + fillObject(req, row); + rp = bean.delAllegato(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Allegato Cancellato"); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected ResParm creaFileAllegato(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + synchronized (this) { + ResParm rp = new ResParm(true, ""); + News bean = (News)beanA; + String targetDir = getDocBase() + getDocBase(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + "/" + targetDir + "_"; + Vectumerator completeFileNames = (Vectumerator)req.getAttribute("completeAttachName"); + Vectumerator fileNames = (Vectumerator)req.getAttribute("attachName"); + if (completeFileNames.hasMoreElements()) { + String sourceFile = (String)completeFileNames.nextElement(); + String fileName = (String)fileNames.elementAt(0); + targetFile = targetFile + targetFile; + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + } + return rp; + } + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getLoginUser(req).getId_users() == 1L && + getCmd(req).equals("init")) { + News.initApplicationParms(getApFull(req)); + sendMessage(req, "Parametri news creati."); + } + search(req, res); + } + + protected boolean isLoadImageServlet() { + return true; + } + + protected String getAttachPath(HttpServletRequest req) { + String act = getAct(req); + if (act.equals("addAllegato")) + return getParm("NEWS_ATTACH_PATH").getTesto(); + return getParm("NEWS_IMG_PATH").getTesto(); + } + + protected ResParm afterImgFileSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + News bean = (News)beanA; + ResParm rp = super.afterImgFileSave(bean, req, res); + return rp; + } + + public void _inviaNews(HttpServletRequest req, HttpServletResponse res) { + long l_id_news = getRequestLongParameter(req, "id_news"); + NewsCR CR = new NewsCR(getApFull(req)); + CR.setId_news(l_id_news); + News bean = new News(getApFull(req)); + bean.inviaMessaggi(CR); + showBean(req, res); + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("flgOrderBy", Long.valueOf(1L)); + return super.beforeSearch(req, res); + } + + public void _modAllegato(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(); + News bean = new News(apFull); + long l_id = getRequestLongParameter(req, "id_news"); + bean.findByPrimaryKey(l_id); + if (bean.getId_news() > 0L) { + String fileName = getRequestParameter(req, "fileNameOnServer_1"); + String targetDir = getDocBase() + getDocBase(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + "/" + targetDir + "_" + bean.getId_news(); + String sourceFile = getPathTmpFull() + getPathTmpFull(); + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + long l_id_allegatoNews = getRequestLongParameter(req, "id_allegatoNews"); + AllegatoNews row = new AllegatoNews(apFull); + row.findByPrimaryKey(l_id_allegatoNews); + if (row.getId_allegatoNews() > 0L) { + fillObject(req, row); + row.setNomeFile(fileName); + rp = row.save(); + } else { + rp.setStatus(false); + rp.setMsg("Errore! Allegato news " + l_id_allegatoNews + " non trovato!"); + } + } else { + rp.setStatus(false); + rp.setMsg("Errore! News " + l_id + " non trovata!"); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _delAllegato(HttpServletRequest req, HttpServletResponse res) { + long l_id = 0L; + ResParm rp = new ResParm(true); + l_id = getRequestLongParameter(req, "id_news"); + News bean = new News(getApFull(req)); + try { + bean.findByPrimaryKey(l_id); + if (bean.getId_news() > 0L) { + AllegatoNews row = new AllegatoNews(getApFull(req)); + fillObject(req, row); + rp = bean.delAllegato(row); + if (rp.getStatus()) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Allegato Cancellato"); + showBean(req, res); + } else { + sendMessage(req, "Errore! " + rp.getMsg()); + showBean(req, res); + } + } else { + sendMessage(req, "Errore! news " + l_id + " non trovata"); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + public void _addAllegato(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(); + News bean = new News(apFull); + long l_id = getRequestLongParameter(req, "id_news"); + bean.findByPrimaryKey(l_id); + if (bean.getId_news() > 0L) { + String fileName = getRequestParameter(req, "fileNameOnServer_1"); + String targetDir = getDocBase() + getDocBase(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + "/" + targetDir + "_" + bean.getId_news(); + String sourceFile = getPathTmpFull() + getPathTmpFull(); + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + AllegatoNews row = new AllegatoNews(apFull); + fillObject(req, row); + row.setNomeFile(fileName); + rp = bean.addAllegato(row); + } else { + rp.setStatus(false); + rp.setMsg("Errore! News " + l_id + " non trovata!"); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/NewsUsersSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/NewsUsersSvlt.java new file mode 100644 index 00000000..f623b9ce --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/NewsUsersSvlt.java @@ -0,0 +1,35 @@ +package it.acxent.news.servlet.admin; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.news.NewsUsers; +import it.acxent.news.NewsUsersCR; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/news/NewsUsers.abl"}) +public class NewsUsersSvlt extends AblServletSvlt { + private static final long serialVersionUID = -6381039631036562905L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new NewsUsers(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new NewsUsersCR(getApFull(req)); + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return true; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + search(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/NewsletterSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/NewsletterSvlt.java new file mode 100644 index 00000000..44e5d6c9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/NewsletterSvlt.java @@ -0,0 +1,103 @@ +package it.acxent.news.servlet.admin; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.news.Newsletter; +import it.acxent.news.NewsletterCR; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.AbMessages; +import it.acxent.util.Vectumerator; +import java.io.File; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/news/Newsletter.abl"}) +public class NewsletterSvlt extends AblServletSvlt { + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Newsletter(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new NewsletterCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + long l_id = 0L; + l_id = getRequestLongParameter(req, "id_news"); + Newsletter bean = new Newsletter(getApFull(req)); + try { + bean.findByPrimaryKey(l_id); + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected ResParm creaFileAllegato(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + synchronized (this) { + ResParm rp = new ResParm(true, ""); + return rp; + } + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + synchronized (this) { + ResParm rp = new ResParm(true, ""); + Newsletter bean = (Newsletter)beanA; + String targetDir = getDocBase() + getDocBase(); + Vectumerator fileNames = (Vectumerator) + req.getAttribute("completeAttachName"); + String imgTmst = getTimeNameForFileUpload(); + boolean l_newImg = false; + while (fileNames.hasMoreElements()) { + String currentFileName = (String)fileNames.nextElement(); + if (currentFileName.indexOf("/img") >= 0) { + l_newImg = true; + int idx = Integer.parseInt(currentFileName.substring( + currentFileName.lastIndexOf("_") + 1, + currentFileName.lastIndexOf("."))); + if (isFileExist(currentFileName)) { + new File(targetDir + targetDir).delete(); + new File(currentFileName).renameTo(new File(targetDir + targetDir)); + } + } + } + if (l_newImg) + for (int i = 1; i <= 2; i++) { + String currentFileName = targetDir + targetDir; + if (isFileExist(currentFileName)) + new File(currentFileName).renameTo(new File(targetDir + targetDir)); + } + if (getRequestLongParameter(req, "cmdCancellaImmagine1") == 1L) { + String fileName = targetDir + targetDir; + new File(fileName).delete(); + } + if (getRequestLongParameter(req, "cmdCancellaImmagine2") == 1L) { + String fileName = targetDir + targetDir; + new File(fileName).delete(); + } + if (l_newImg) { + bean.setImgTmst(imgTmst); + rp = bean.save(); + req.setAttribute("bean", bean); + } + return rp; + } + } + + protected String getAttachPath(HttpServletRequest req) { + return ((Newsletter)getBean(req)).getPathImgNewsletter(); + } + + protected boolean isLoadImageServlet() { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/TipoNewsSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/TipoNewsSvlt.java new file mode 100644 index 00000000..7af28f20 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/servlet/admin/TipoNewsSvlt.java @@ -0,0 +1,33 @@ +package it.acxent.news.servlet.admin; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.news.TipoNews; +import it.acxent.news.TipoNewsCR; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/news/TipoNews.abl"}) +public class TipoNewsSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoNews(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoNewsCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/taglib/NewsTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/taglib/NewsTag.java new file mode 100644 index 00000000..8db1db5e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/taglib/NewsTag.java @@ -0,0 +1,115 @@ +package it.acxent.news.taglib; + +import it.acxent.news.News; +import it.acxent.news.NewsCR; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.io.Writer; +import javax.servlet.jsp.JspException; + +public class NewsTag extends AbstractDbTag { + private String rowbeanname; + + private Vectumerator theList; + + private long flgPubblica; + + private long orderby; + + private long limit = 0L; + + public int doAfterBody() throws JspException { + try { + boolean flgOk = false; + News obj = null; + while (this.theList.hasMoreElements()) { + if (!(obj = (News)this.theList.nextElement()).getTitolo().equals("")) { + flgOk = true; + break; + } + } + if (flgOk) { + this.pageContext.setAttribute(getRowbeanname(), obj); + this.pageContext.getRequest().setAttribute("listaAllegatiNews", + obj.getAllegati()); + return 2; + } + this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter()); + return 0; + } catch (IOException ioexception) { + throw new JspException(ioexception.getMessage()); + } catch (Exception exception) { + throw new JspException(exception.getMessage()); + } + } + + public void doInitBody() {} + + public int doStartTag() { + try { + NewsCR CR = new NewsCR(); + CR.setFlgVisibile(1L); + if (getFlgPubblica() != 0L) + CR.setFlgPubblica(this.flgPubblica); + CR.setFlgOrderBy(getOrderby()); + if (getLimit() == 0L) { + this.theList = new News(getApFull()).findByCR(CR, 0, 0); + } else { + this.theList = new News(getApFull()).findByCR(CR, 1, (int)getLimit()); + } + } catch (Exception e) { + this.theList = new Vectumerator(); + } + if (this.theList == null) + return 0; + this.theList.moveFirst(); + boolean flgOk = false; + News obj = null; + while (this.theList.hasMoreElements()) { + if (!(obj = (News)this.theList.nextElement()).getTitolo().equals("")) { + flgOk = true; + break; + } + } + if (flgOk) { + this.pageContext.setAttribute(getRowbeanname(), obj); + this.pageContext.getRequest().setAttribute("listaAllegatiNews", + obj.getAllegati()); + return 2; + } + return 0; + } + + public String getRowbeanname() { + return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname; + } + + public void setRowbeanname(String s) { + this.rowbeanname = s; + } + + public long getFlgPubblica() { + return this.flgPubblica; + } + + public void setFlgPubblica(long flgPubblica) { + this.flgPubblica = flgPubblica; + } + + public long getOrderby() { + return this.orderby; + } + + public void setOrderby(long orderby) { + this.orderby = orderby; + } + + public long getLimit() { + return this.limit; + } + + public void setLimit(long limit) { + this.limit = limit; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/taglib/NewsTagExtraInfo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/taglib/NewsTagExtraInfo.java new file mode 100644 index 00000000..1182f3eb --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/news/taglib/NewsTagExtraInfo.java @@ -0,0 +1,15 @@ +package it.acxent.news.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class NewsTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? + tagdata.getAttributeString("rowbeanname") : + "rowBean"; + String rowBeanClass = "it.acxent.news.News"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0), new VariableInfo("listaAllegatiNews", "it.acxent.util.Vectumerator", true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/AllegatoCodaMessaggi.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/AllegatoCodaMessaggi.java new file mode 100644 index 00000000..2897b536 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/AllegatoCodaMessaggi.java @@ -0,0 +1,132 @@ +package it.acxent.newsletter; + +import it.acxent.contab._ContabAdapter; +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class AllegatoCodaMessaggi extends _ContabAdapter implements Serializable { + private long id_allegatoCodaMessaggi; + + private long id_codaMessaggi; + + private String nomeFile; + + private CodaMessaggi codaMessaggi; + + public AllegatoCodaMessaggi(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AllegatoCodaMessaggi() {} + + public void setId_allegatoCodaMessaggi(long newId_allegatoCodaMessaggi) { + this.id_allegatoCodaMessaggi = newId_allegatoCodaMessaggi; + } + + public void setId_codaMessaggi(long newId_codaMessaggi) { + this.id_codaMessaggi = newId_codaMessaggi; + setCodaMessaggi(null); + } + + public void setNomeFile(String newNomeFile) { + this.nomeFile = newNomeFile; + } + + public long getId_allegatoCodaMessaggi() { + return this.id_allegatoCodaMessaggi; + } + + public long getId_codaMessaggi() { + return this.id_codaMessaggi; + } + + public String getNomeFile() { + return (this.nomeFile == null) ? "" : this.nomeFile.trim(); + } + + public void setCodaMessaggi(CodaMessaggi newCodaMessaggi) { + this.codaMessaggi = newCodaMessaggi; + } + + public CodaMessaggi getCodaMessaggi() { + this.codaMessaggi = (CodaMessaggi)getSecondaryObject(this.codaMessaggi, CodaMessaggi.class, + getId_codaMessaggi()); + return this.codaMessaggi; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(AllegatoCodaMessaggiCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ALLEGATO_CODA_MESSAGGI AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByCodaMessaggiNomeFile(long l_id_codaMessaggi, String l_id_nomeFile) { + String s_Sql_Find = "select A.* from ALLEGATO_CODA_MESSAGGI AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_codaMessaggi=" + l_id_codaMessaggi); + wc.addWc("A.nomeFile='" + l_id_nomeFile + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getNomeFileCompleto() { + return getNomeFileCompleto(getCodaMessaggi().getPathAllegato()); + } + + public String getNomeFileCompleto(String l_path) { + return l_path + l_path + "_" + getId_codaMessaggi(); + } + + public String getNomeFileSuDisco() { + return "" + getId_codaMessaggi() + "_" + getId_codaMessaggi(); + } + + public Vectumerator findByCodaMessaggi(long l_id_codaMessaggi, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ALLEGATO_CODA_MESSAGGI AS A"; + String s_Sql_Order = " order by A.nomeFile"; + WcString wc = new WcString(); + wc.addWc("A.id_codaMessaggi=" + l_id_codaMessaggi); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/AllegatoCodaMessaggiCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/AllegatoCodaMessaggiCR.java new file mode 100644 index 00000000..9e7840f4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/AllegatoCodaMessaggiCR.java @@ -0,0 +1,56 @@ +package it.acxent.newsletter; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AllegatoCodaMessaggiCR extends CRAdapter { + private long id_allegatoCodaMessaggi; + + private long id_codaMessaggi; + + private String nomeFile; + + private CodaMessaggi codaMessaggi; + + public AllegatoCodaMessaggiCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AllegatoCodaMessaggiCR() {} + + public void setId_allegatoCodaMessaggi(long newId_allegatoCodaMessaggi) { + this.id_allegatoCodaMessaggi = newId_allegatoCodaMessaggi; + } + + public void setId_codaMessaggi(long newId_codaMessaggi) { + this.id_codaMessaggi = newId_codaMessaggi; + setCodaMessaggi(null); + } + + public void setNomeFile(String newNomeFile) { + this.nomeFile = newNomeFile; + } + + public long getId_allegatoCodaMessaggi() { + return this.id_allegatoCodaMessaggi; + } + + public long getId_codaMessaggi() { + return this.id_codaMessaggi; + } + + public String getNomeFile() { + return (this.nomeFile == null) ? "" : this.nomeFile.trim(); + } + + public void setCodaMessaggi(CodaMessaggi newCodaMessaggi) { + this.codaMessaggi = newCodaMessaggi; + } + + public CodaMessaggi getCodaMessaggi() { + this.codaMessaggi = (CodaMessaggi)getSecondaryObject(this.codaMessaggi, CodaMessaggi.class, + + getId_codaMessaggi()); + return this.codaMessaggi; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/AllegatoTemplateMsg.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/AllegatoTemplateMsg.java new file mode 100644 index 00000000..c7bbb925 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/AllegatoTemplateMsg.java @@ -0,0 +1,136 @@ +package it.acxent.newsletter; + +import it.acxent.contab._ContabAdapter; +import it.acxent.db.ApplParmFull; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class AllegatoTemplateMsg extends _ContabAdapter implements Serializable { + private long id_allegatoTemplateMsg; + + private long id_templateMsg; + + private String nomeFile; + + private TemplateMsg templateMsg; + + public AllegatoTemplateMsg(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AllegatoTemplateMsg() {} + + public void setId_allegatoTemplateMsg(long newId_allegatoTemplateMsg) { + this.id_allegatoTemplateMsg = newId_allegatoTemplateMsg; + } + + public void setId_templateMsg(long newId_templateMsg) { + this.id_templateMsg = newId_templateMsg; + setTemplateMsg(null); + } + + public void setNomeFile(String newNomeFile) { + this.nomeFile = newNomeFile; + } + + public long getId_allegatoTemplateMsg() { + return this.id_allegatoTemplateMsg; + } + + public long getId_templateMsg() { + return this.id_templateMsg; + } + + public String getNomeFile() { + return (this.nomeFile == null) ? "" : this.nomeFile.trim(); + } + + public void setTemplateMsg(TemplateMsg newTemplateMsg) { + this.templateMsg = newTemplateMsg; + } + + public TemplateMsg getTemplateMsg() { + this.templateMsg = (TemplateMsg)getSecondaryObject(this.templateMsg, TemplateMsg.class, + + getId_templateMsg()); + return this.templateMsg; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(AllegatoTemplateMsgCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ALLEGATO_TEMPLATE_MSG AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.nomeFile like '%" + token + "%' )"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getNomeFileCompleto() { + return getNomeFileCompleto(getTemplateMsg().getPathAllegato()); + } + + public String getNomeFileCompleto(String l_path) { + return l_path + l_path; + } + + public String getNomeFileSuDisco() { + return "" + getId_templateMsg() + "_" + getId_templateMsg(); + } + + protected int getStringValueCase(String l_colomnName) { + return 0; + } + + public void findByTemplateMsgNomeFile(long l_id_templateMsg, String l_id_nomeFile) { + String s_Sql_Find = "select A.* from ALLEGATO_TEMPLATE_MSG AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_templateMsg=" + l_id_templateMsg); + wc.addWc("A.nomeFile='" + l_id_nomeFile + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Vectumerator findByTemplateMsg(long l_id_templateMsg, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ALLEGATO_TEMPLATE_MSG AS A"; + String s_Sql_Order = " order by A.nomeFile"; + WcString wc = new WcString(); + wc.addWc("A.id_templateMsg=" + l_id_templateMsg); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/AllegatoTemplateMsgCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/AllegatoTemplateMsgCR.java new file mode 100644 index 00000000..f2ff2af1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/AllegatoTemplateMsgCR.java @@ -0,0 +1,56 @@ +package it.acxent.newsletter; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AllegatoTemplateMsgCR extends CRAdapter { + private long id_allegatoTemplateMsg; + + private long id_templateMsg; + + private String nomeFile; + + private TemplateMsg templateMsg; + + public AllegatoTemplateMsgCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AllegatoTemplateMsgCR() {} + + public void setId_allegatoTemplateMsg(long newId_allegatoTemplateMsg) { + this.id_allegatoTemplateMsg = newId_allegatoTemplateMsg; + } + + public void setId_templateMsg(long newId_templateMsg) { + this.id_templateMsg = newId_templateMsg; + setTemplateMsg(null); + } + + public void setNomeFile(String newNomeFile) { + this.nomeFile = newNomeFile; + } + + public long getId_allegatoTemplateMsg() { + return this.id_allegatoTemplateMsg; + } + + public long getId_templateMsg() { + return this.id_templateMsg; + } + + public String getNomeFile() { + return (this.nomeFile == null) ? "" : this.nomeFile.trim(); + } + + public void setTemplateMsg(TemplateMsg newTemplateMsg) { + this.templateMsg = newTemplateMsg; + } + + public TemplateMsg getTemplateMsg() { + this.templateMsg = (TemplateMsg)getSecondaryObject(this.templateMsg, TemplateMsg.class, + + getId_templateMsg()); + return this.templateMsg; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/CodaMessaggi.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/CodaMessaggi.java new file mode 100644 index 00000000..6847d565 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/CodaMessaggi.java @@ -0,0 +1,1361 @@ +package it.acxent.newsletter; + +import it.acxent.cloudmsg.MsgJson; +import it.acxent.cloudmsg.PushNotificationService; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.contab._ContabAdapter; +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.mail.MailEmbededImages; +import it.acxent.mail.MailMessage; +import it.acxent.mail.MailProperties; +import it.acxent.rd.RemoteDevice; +import it.acxent.skebby.api.SmsSkebbyApi; +import it.acxent.skebby.api.SmsSkebbyApiResult; +import it.acxent.skebby.api.SmsSkebbyMessage; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Timer; +import it.acxent.util.Vectumerator; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.io.Serializable; +import java.net.URLEncoder; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.json.JSONObject; + +public class CodaMessaggi extends _ContabAdapter implements AddImgInterface, Serializable { + private static final long serialVersionUID = -2936105636659716818L; + + private String campiMail; + + private long id_codaMessaggi; + + private long flgTipo = 2L; + + private long flgStatoInvio; + + private Date dataCreazione; + + private String testoMessaggio; + + private String cellulare; + + private String mailTo; + + private String mailCc; + + private String mailBcc; + + private Date dataInvio; + + private String result; + + private String riferimento; + + private String destinatario; + + private String oggettoEmail; + + private String imgTmst; + + private String campagna; + + private long id_templateMsg; + + private TemplateMsg templateMsg; + + private String tmstPrimaLettura; + + private String tmstUltimaLettura; + + private long nLetture; + + private String ipPrimaLettura; + + private String ipUltimaLettura; + + private long id_remoteDevice; + + private RemoteDevice remoteDevice; + + public static boolean threadInvioCodaMessaggi = false; + + public static String threadInvioCodaMessaggiMsg = ""; + + public static boolean threadCancellaCodaMessaggi = false; + + public static String threadCancellaCodaMessaggiMsg = ""; + + public static boolean threadCreaCodaMessaggi = false; + + public static String threadCreaCodaMessaggiMsg = ""; + + public static final int STATO_CODA_INVIATO = 1; + + public static final int STATO_CODA_IN_CODA = 0; + + public static final int STATO_CODA_ERRORE = 2; + + public static final int STATO_CODA_IN_CODA_REMOTE_DEVICE = 3; + + public static final int STATO_CODA_REMOTE_DEVICE_INVIATO_AL_GATEWAY = 4; + + public static final int STATO_CODA_ANNULLATO = 9; + + public static final int STATO_CODA_TUTTI = -1; + + public static final int TIPO_MESSAGGIO_EMAIL = 1; + + public static final int TIPO_MESSAGGIO_TUTTI = -1; + + public static final int TIPO_MESSAGGIO_RD_SMS = 2; + + public static final int TIPO_MESSAGGIO_RD_WHATSAPP = 3; + + public static final int TIPO_MESSAGGIO_SKEBBY_SMS = 4; + + public static final int TIPO_MESSAGGIO_REMOTE_DEVICE = 99; + + class ThreadSendMsgs extends Thread { + private final CodaMessaggiCR CR; + + public ThreadSendMsgs(CodaMessaggiCR l_CR) { + this.CR = l_CR; + if (this.CR.getFlgStatoInvio() != 2L) + this.CR.setFlgStatoInvio(0L); + if (!CodaMessaggi.isThreadAttivo()) + if (this.CR.getFlgStatoInvio() < 0L || this.CR.getFlgStatoInvio() == 1L) { + CodaMessaggi.threadInvioCodaMessaggiMsg = "ATTENZIONE! TENTATIVO DI INVIARE TUTTI I MESSAGGI OPPURE QUELLI GIA' INVIATI
Selezionare solo messaggi in coda, annullati o errati."; + } else { + CodaMessaggi.threadInvioCodaMessaggi = true; + CodaMessaggi.threadInvioCodaMessaggiMsg = ""; + start(); + } + } + + public void run() { + HashMap mailInviateHM = new HashMap<>(); + HashMap mailDoppioniHM = new HashMap<>(); + long mailDoppione = 0L; + long mailInviate = 0L, numSms = 0L; + String TAG_THREAD_MSG = "INVIO MESSAGGI"; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(CodaMessaggi.this.getApFull(), "INVIO MESSAGGI", "...inizio ..."); + try { + List listRemoteDeviceToken = new ArrayList<>(); + long numRecord = 0L; + long l_delayMsgEmail = CodaMessaggi.this.getParm("CODA_MESSAGGI_EMAIL_DELAY").getNumeroLong() * 1000L; + long l_delayMsgSms = 0L; + RemoteDevice rd = new RemoteDevice(CodaMessaggi.this.getApFull()); + CodaMessaggi cm = new CodaMessaggi(CodaMessaggi.this.getApFull()); + ResParm rp = new ResParm(true); + rd.findFirstAvailable(); + listRemoteDeviceToken.add(rd.getFcmToken()); + Vectumerator vec; + while ((vec = cm.findByCR(this.CR, 1, 500)).hasMoreElements()) { + while (vec.hasMoreElements()) { + numRecord++; + CodaMessaggi row = (CodaMessaggi)vec.nextElement(); + if (row.getFlgTipo() == 4L) { + rp = CodaMessaggi.inviaSmsSkebby(row); + numSms++; + } else if (row.getFlgTipo() == 2L) { + if (rd.getId_remoteDevice() > 0L) { + row.setId_remoteDevice(rd.getId_remoteDevice()); + row.setFlgStatoInvio(3L); + row.save(); + numSms++; + } else { + row.setFlgStatoInvio(2L); + row.save(); + } + } else if (row.getFlgTipo() == 3L) { + if (rd.getId_remoteDevice() > 0L) { + row.setId_remoteDevice(rd.getId_remoteDevice()); + row.setFlgStatoInvio(3L); + row.save(); + numSms++; + } else { + row.setFlgStatoInvio(2L); + row.save(); + } + } else if (mailInviateHM.containsKey(row.getMailTo())) { + mailDoppione++; + System.out.println("MAILING LIST ERROR!! INVIO A MAIL GIA' PRESENTE: " + row.getId_codaMessaggi() + " " + + row.getMailTo() + " tot doppioni:" + mailDoppione); + mailDoppioniHM.put(row.getMailTo(), Long.valueOf(row.getId_codaMessaggi())); + row.setFlgStatoInvio(2L); + row.save(); + } else { + mailInviate++; + mailInviateHM.put(row.getMailTo(), Long.valueOf(row.getId_codaMessaggi())); + rp = CodaMessaggi.inviaMessaggioMail(row); + } + CodaMessaggi.threadInvioCodaMessaggiMsg = "Attenzione! Thread invio coda messaggi esecuzione!!! Record processati: " + numRecord; + StatusMsg.updateMsgByTag(CodaMessaggi.this.getApFull(), "INVIO MESSAGGI", "Mail inviate: " + mailInviate + " Sms in coda: " + numSms + " ..."); + if (vec.hasMoreElements()) { + if (row.getFlgTipo() == 2L) { + if (l_delayMsgSms > 0L) { + System.out.print("sleep...."); + sleep(l_delayMsgSms); + } + continue; + } + if (l_delayMsgEmail != 0L) { + System.out.print("sleep...."); + sleep(l_delayMsgEmail); + } + } + } + } + if (numSms <= 0L); + StatusMsg.updateMsgByTag(CodaMessaggi.this.getApFull(), "INVIO MESSAGGI", "Mail inviate: " + mailInviate + " Sms in coda: " + numSms + " ... chiamate al dispositivo remoto..."); + String fileJsonAuth = CodaMessaggi.this.getParm("FIREBASE_JSON_AUTH_PRIVATE_KEY").getTesto(); + PushNotificationService pns = new PushNotificationService(fileJsonAuth); + MsgJson notifica = new MsgJson("notification", "Sms Gateway: invio sms", "Ci sono sms da inviare...!"); + MsgJson data = new MsgJson("notification", "Sms", "Ci sono " + numSms + " sms da inviare.."); + pns.sendPushNotification(listRemoteDeviceToken, null, data, "smsgateway-f05ec"); + } catch (Exception e) { + e.printStackTrace(); + CodaMessaggi.this.handleDebug(e); + } + CodaMessaggi.threadInvioCodaMessaggi = false; + StringBuilder sb = new StringBuilder(); + for (Map.Entry entry : mailDoppioniHM.entrySet()) { + sb.append("Key : " + (String)entry.getKey() + " Value : " + String.valueOf(entry.getValue())); + sb.append("\n"); + System.out.println("Key : " + (String)entry.getKey() + " Value : " + String.valueOf(entry.getValue())); + } + if (sb.length() > 0) + CodaMessaggi.this.handleDebug("MAILING LIST ERROR!! INVIO A MAIL GIA' PRESENTI: tot doppioni:" + mailDoppione + "\n" + sb.toString(), 0); + timer.stop(); + StatusMsg.updateMsgByTag(CodaMessaggi.this.getApFull(), "INVIO MESSAGGI", "FINE INVIO MESSAGGI! DURATA: " + timer.getDurataHourMin() + "
Mail inviate: " + mailInviate + " mail doppioni: " + mailDoppione + " Sms in coda: " + numSms); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(CodaMessaggi.this.getApFull(), "INVIO MESSAGGI"); + } + } + + class ThreadCreaCodaMsgFile extends Thread { + private TemplateMsg templateMsg; + + private String filename; + + private ApplParmFull ap; + + public ThreadCreaCodaMsgFile(TemplateMsg l_templateMsg, String l_filename, ApplParmFull l_ap) { + this.templateMsg = l_templateMsg; + this.filename = l_filename; + this.ap = l_ap; + if (!CodaMessaggi.isThreadAttivo()) { + CodaMessaggi.threadCreaCodaMessaggi = true; + start(); + } + } + + public void run() { + int numRecord = 0; + BufferedReader reader = null; + String currentLine = null; + String TAG_THREAD_MSG = "CREA CODA MESSAGGI DA FILE"; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(CodaMessaggi.this.getApFull(), "CREA CODA MESSAGGI DA FILE", "...inizio ..."); + System.out.println("##############\nCrea coda messaggi da file\nSTART: " + String.valueOf(timer.getTStart())); + try { + reader = new BufferedReader(new FileReader(this.filename)); + while ((currentLine = reader.readLine()) != null) { + numRecord++; + CodaMessaggi cm = new CodaMessaggi(CodaMessaggi.this.getApFull()); + cm.setFlgTipo(1L); + cm.setCampagna(this.templateMsg.getDescrizione()); + cm.setMailTo(currentLine.trim()); + cm.setOggettoEmail(this.templateMsg.getOggettoEmail()); + cm.save(); + cm.useTemplate(this.templateMsg, true); + CodaMessaggi.threadCreaCodaMessaggiMsg = "Attenzione! Thread creazione coda messaggi da file in esecuzione!!! Record processati: " + numRecord; + } + } catch (Exception e) { + e.printStackTrace(); + CodaMessaggi.this.handleDebug(e); + } + timer.stop(); + CodaMessaggi.this.handleDebug("Crea coda messaggi da file. Creati " + numRecord + " messaggi.", 4); + System.out.println("DURATA: " + timer.getDurataHourMin() + "\nCrea coda messaggi da file concluso\n****************"); + StatusMsg.updateMsgByTag(CodaMessaggi.this.getApFull(), "CREA CODA MESSAGGI DA FILE", "Crea coda messaggi da file. Creati " + numRecord + " messaggi. DURATA: " + + timer.getDurataHourMin()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(CodaMessaggi.this.getApFull(), "CREA CODA MESSAGGI DA FILE"); + CodaMessaggi.threadCreaCodaMessaggi = false; + } + } + + class ThreadCreaCodaMessaggiByMailNewsletter extends Thread { + private MailNewsletterCR CR; + + private long id_templateMsg; + + public ThreadCreaCodaMessaggiByMailNewsletter(MailNewsletterCR CR, long id_templateMsg) { + synchronized (this) { + if (!CodaMessaggi.isThreadAttivo()) { + this.CR = CR; + this.id_templateMsg = id_templateMsg; + if (id_templateMsg > 0L) { + CodaMessaggi.threadCreaCodaMessaggi = true; + start(); + } + } + } + } + + public void run() { + long togliDuplicatiOgni = 1000L; + long numRecord = 0L; + String TAG_THREAD_MSG = "CREA CODA MESSAGGI DA Mail Newsletter"; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(CodaMessaggi.this.getApFull(), "CREA CODA MESSAGGI DA Mail Newsletter", "...inizio ..."); + System.out.println("##############\nCrea coda messaggi da MailNewsletter\nSTART: " + String.valueOf(timer.getTStart())); + ResParm rp = new ResParm(true); + MailNewsletter ml = new MailNewsletter(CodaMessaggi.this.getApFull()); + int j = 0; + if (this.CR.getInizio() == 0L) + this.CR.setInizio(1L); + long tot = this.CR.getFine() - this.CR.getInizio(); + int pagerow = 1000; + TemplateMsg ts = new TemplateMsg(CodaMessaggi.this.getApFull()); + ts.findByPrimaryKey(this.id_templateMsg); + String campagna = ts.getDescrizione() + " " + ts.getDescrizione(); + while ((long)j < tot / (long)pagerow + 1L) { + long inizio = (long)(j * pagerow) + this.CR.getInizio(); + long fine = inizio + (long)pagerow - 1L; + if (fine > this.CR.getFine()) + fine = this.CR.getFine(); + if (fine <= inizio) + break; + System.out.println("da " + inizio + " a " + fine); + Vectumerator vec = ml.findCodaByCR(this.CR, inizio, fine); + while (vec.hasMoreElements()) { + ml = (MailNewsletter)vec.nextElement(); + if (!ml.getEMail().trim().isEmpty()) { + CodaMessaggi cm = new CodaMessaggi(CodaMessaggi.this.getApFull()); + cm.setFlgTipo(1L); + cm.setCampagna(campagna); + cm.setMailTo(ml.getEMail().trim()); + cm.setOggettoEmail(ts.getOggettoEmail()); + cm.save(); + cm.useTemplate(ts, true); + ml.setId_templateMsg(this.id_templateMsg); + ml.setDataTemplate(DBAdapter.getToday()); + ml.save(); + numRecord++; + CodaMessaggi.threadCreaCodaMessaggiMsg = "Attenzione! Thread creazione coda messaggi in esecuzione!!! Record processati: " + numRecord; + if (numRecord % 100L == 0L) + System.out.print("."); + if (numRecord % 1000L == 0L) + System.out.println(numRecord); + } + } + j++; + } + timer.stop(); + CodaMessaggi.this.handleDebug("Creata coda mail per template " + this.id_templateMsg + ". Tot record creati: " + numRecord, 1); + System.out.println("DURATA: " + timer.getDurataHourMin() + "\nCrea coda messaggi da MailNewsletter concluso\n****************"); + CodaMessaggi.threadCreaCodaMessaggi = false; + StatusMsg.updateMsgByTag(CodaMessaggi.this.getApFull(), "CREA CODA MESSAGGI DA Mail Newsletter", "Crea coda messaggi da MailNewsletter concluso. DURATA: " + + timer.getDurataHourMin()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(CodaMessaggi.this.getApFull(), "CREA CODA MESSAGGI DA Mail Newsletter"); + } + } + + class ThreadCancellaCodaMsg extends Thread { + private CodaMessaggiCR CR; + + public ThreadCancellaCodaMsg(CodaMessaggiCR CR) { + this.CR = CR; + if (!CodaMessaggi.isThreadAttivo()) { + CodaMessaggi.threadCancellaCodaMessaggi = true; + start(); + } + } + + public void run() { + BufferedReader reader = null; + String currentLine = null; + String TAG_THREAD_MSG = "CREA CODA MESSAGGI DA Mail Newsletter"; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(CodaMessaggi.this.getApFull(), "CREA CODA MESSAGGI DA Mail Newsletter", "...inizio ..."); + System.out.println("##############\nCANCELLAZIONE coda messaggi\nSTART: " + String.valueOf(timer.getTStart())); + ResParm rp = new ResParm(true); + CodaMessaggi bean = new CodaMessaggi(CodaMessaggi.this.getApFull()); + int nrighe = 100; + int msgCancellati = 0; + Vectumerator vec; + while ((vec = bean.findByCR(this.CR, 1, nrighe)).hasMoreElements()) { + while (vec.hasMoreElements()) { + CodaMessaggi row = (CodaMessaggi)vec.nextElement(); + row.delete(); + msgCancellati++; + CodaMessaggi.threadCancellaCodaMessaggiMsg = "Attenzione! Thread CANCELLAZIONE coda messaggi da file in esecuzione!!! Record processati: " + msgCancellati; + } + } + timer.stop(); + CodaMessaggi.this.handleDebug("CANCELLAZIONE coda messaggi da file. CANCELLATI " + msgCancellati + " record.", 4); + System.out.println("DURATA: " + timer.getDurataHourMin() + "\nCANCELLAZIONE coda messaggi concluso\n****************"); + CodaMessaggi.threadCancellaCodaMessaggi = false; + StatusMsg.updateMsgByTag(CodaMessaggi.this.getApFull(), "CREA CODA MESSAGGI DA Mail Newsletter", "Cancellazione coda messaggi concluso. DURATA: " + + timer.getDurataHourMin()); + try { + sleep(10000L); + } catch (Exception e) {} + StatusMsg.deleteMsgByTag(CodaMessaggi.this.getApFull(), "CREA CODA MESSAGGI DA Mail Newsletter"); + } + } + + public CodaMessaggi(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CodaMessaggi() {} + + public void setId_codaMessaggi(long newId_codaInvio) { + this.id_codaMessaggi = newId_codaInvio; + } + + public void setFlgTipo(long newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public void setFlgStatoInvio(long newFlgStatoInvio) { + this.flgStatoInvio = newFlgStatoInvio; + } + + public void setDataCreazione(Date newDataCreazione) { + this.dataCreazione = newDataCreazione; + } + + public void setTestoMessaggio(String newMessaggio) { + this.testoMessaggio = newMessaggio; + } + + public void setCellulare(String newCellulare) { + this.cellulare = newCellulare; + } + + public void setMailTo(String newMailTo) { + this.mailTo = newMailTo; + } + + public void setMailCc(String newMailCc) { + this.mailCc = newMailCc; + } + + public void setMailBcc(String newMailBcc) { + this.mailBcc = newMailBcc; + } + + public long getId_codaMessaggi() { + return this.id_codaMessaggi; + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public long getFlgStatoInvio() { + return this.flgStatoInvio; + } + + public Date getDataCreazione() { + return this.dataCreazione; + } + + public String getTestoMessaggio() { + return (this.testoMessaggio == null) ? "" : this.testoMessaggio.trim(); + } + + public ResParm useTemplate(TemplateMsg l_ts, boolean soloTemplate) { + ResParm rp = new ResParm(true); + if (l_ts.getId_templateMsg() > 0L && l_ts.getFlgTipo() == 1L) { + setId_templateMsg(0L); + for (int i = 1; i <= 10; i++) + new File(getDocBase() + getDocBase() + getPathImg()).delete(); + setId_templateMsg(l_ts.getId_templateMsg()); + if (soloTemplate) { + setOggettoEmail(l_ts.getOggettoEmail()); + setTestoMessaggio(""); + } + rp = save(); + } else { + rp.setMsg("ERRORE! template non valido!"); + rp.setStatus(false); + } + return rp; + } + + public String getMailTo() { + return (this.mailTo == null) ? "" : this.mailTo.trim(); + } + + public String getMailCc() { + return (this.mailCc == null) ? "" : this.mailCc.trim(); + } + + public String getMailBcc() { + return (this.mailBcc == null) ? "" : this.mailBcc.trim(); + } + + public Vectumerator findByEmailTemplateMsg(String l_email, long l_id_template, int pageNumber, int pageRows) { + StringBuffer s_Sql_Find = new StringBuffer("select A.* from CODA_MESSAGGI AS A"); + String s_Sql_Order = " order by dataInvio desc"; + WcString wc = new WcString(); + wc.addWc("A.mailTo like '%" + l_email + "%'"); + wc.addWc("A.id_templateMsg=" + l_id_template); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Date getDataInvio() { + return this.dataInvio; + } + + public void setDataInvio(Date dataInvio) { + this.dataInvio = dataInvio; + } + + public static final String getStatoInvio(long l_flgStatoInvio) { + switch ((int)l_flgStatoInvio) { + case 0: + return "In coda"; + case 3: + return "In coda per Remote Device"; + case 1: + return "Inviato"; + case 9: + return "Annullato"; + case 2: + return "Errore"; + case 4: + return "Messaggio inviato al gateway"; + case -1: + return "Tutti"; + } + return "??"; + } + + public String getStatoInvio() { + return getStatoInvio(getFlgStatoInvio()); + } + + public String getStatoInvioCompleto() { + StringBuilder sb = new StringBuilder(getStatoInvio(getFlgStatoInvio())); + if (getFlgStatoInvio() == 3L || getFlgStatoInvio() == 4L) { + sb.append(" --> device remoto: "); + sb.append(getRemoteDevice().getDescrizione()); + } + return sb.toString(); + } + + public String getDestinatario() { + return (this.destinatario == null) ? "" : this.destinatario.trim(); + } + + public String getResult() { + return (this.result == null) ? "" : this.result; + } + + public void setResult(String result) { + this.result = result; + } + + public static final String getTipo(long l_flgTipo) { + switch ((int)l_flgTipo) { + case 2: + return "Sms"; + case 1: + return "Email"; + case 3: + return "WA TEST"; + case 4: + return "SMS skebby"; + case -1: + return "Tutti"; + } + return "??"; + } + + public String getTipo() { + return getTipo(getFlgTipo()); + } + + public String getRiferimento() { + return this.riferimento; + } + + public void setRiferimento(String riferimento) { + this.riferimento = riferimento; + } + + public ResParm save() { + if (getDataCreazione() == null) + setDataCreazione(getToday()); + if (getFlgStatoInvio() == 3L && getId_remoteDevice() == 0L) + setFlgStatoInvio(2L); + return super.save(); + } + + public static final synchronized ResParm inviaMessaggioMail(CodaMessaggi bean) { + ResParm rp = new ResParm(true); + String res = ""; + boolean useOpenTag = (bean.getParm("CODA_MESSAGGI_USE_OPEN_TAG").getNumeroLong() == 1L); + boolean useEmbedded = (bean.getParm("CODA_MESSAGGI_USE_EMBEDDED_IMG").getNumeroLong() == 1L); + MailProperties mp = new MailProperties(); + mp.put("TO", bean.getMailTo()); + mp.put("FROM", bean.getParm("CODA_MESSAGGI_MAIL_FROM").getTesto()); + mp.put("SUBJECT", bean.getOggettoEmail()); + mp.put("ISHTML", "true"); + if (useEmbedded) { + StringBuffer l_msg = new StringBuffer(); + String l_tmp = bean.getMessaggioDaInviare(); + int idxStart = 0; + int idxImg = 0; + int idxSrcRel = 0; + int idxSrcAbsStart = 0; + int idxSrcAbsStop = 0; + int idxCid = 0; + Vectumerator embed = new Vectumerator(); + while ((idxImg = l_tmp.indexOf("= 0) { + idxSrcRel = l_tmp.substring(idxImg).indexOf("src=\""); + if (idxSrcRel < 0) + return new ResParm(false, "Impossibile creare immagini embedded"); + idxSrcAbsStart = idxImg + idxSrcRel; + l_msg.append(l_tmp.substring(idxStart, idxSrcAbsStart)); + l_msg.append(" src=\"cid:imagePart_" + idxCid + "\""); + idxSrcRel = l_tmp.substring(idxSrcAbsStart + 5).indexOf("\""); + idxSrcAbsStop = idxSrcAbsStart + idxSrcRel; + String src = l_tmp.substring(idxSrcAbsStart + 5, idxSrcAbsStop + 5); + idxSrcRel = src.lastIndexOf("/"); + String filename = src.substring(idxSrcRel + 1); + String absFilename = bean.getDocBase() + bean.getDocBase() + bean.getPathImg(); + l_tmp = l_tmp.substring(idxSrcAbsStop + 5 + 1); + embed.add(new MailEmbededImages(absFilename, "imagePart_" + idxCid, filename)); + idxCid++; + } + l_msg.append(l_tmp); + l_msg.insert(0, "Mail Message"); + l_msg.append(""); + MailMessage mmCampi = new MailMessage(bean.getApFull()); + mmCampi.setTextMessage(l_msg.toString()); + mmCampi.setString("email", bean.getMailTo()); + try { + mmCampi.setString("emailUrl", URLEncoder.encode(bean.getMailTo(), "UTF-8")); + } catch (Exception e) {} + if (!bean.getCampiMail().isEmpty()) { + StringTokenizer st = new StringTokenizer(bean.getCampiMail(), "|"); + int i = 1; + while (st.hasMoreTokens()) { + String campo = st.nextToken(); + mmCampi.setString("campo" + i, campo); + i++; + } + } + mp.put("MSG", mmCampi.getMessageGtLt()); + StringBuffer fileNames = new StringBuffer(); + if (bean.getId_templateMsg() == 0L) { + Vectumerator vec = bean.getAllegati(); + while (vec.hasMoreElements()) { + AllegatoCodaMessaggi rowCS = (AllegatoCodaMessaggi)vec.nextElement(); + fileNames.append(rowCS.getNomeFileCompleto()); + if (vec.hasMoreElements()) + fileNames.append(","); + } + } else { + Vectumerator vec = bean.getTemplateMsg().getAllegati(); + while (vec.hasMoreElements()) { + AllegatoTemplateMsg rowCS = (AllegatoTemplateMsg)vec.nextElement(); + fileNames.append(rowCS.getNomeFileCompleto()); + if (vec.hasMoreElements()) + fileNames.append(","); + } + } + if (!fileNames.toString().trim().isEmpty()) + mp.put("FILES", fileNames.toString()); + MailMessage mm = new MailMessage(bean.getApFull()); + if (embed.getTotNumberOfRecords() == 0) { + rp = mm.sendMailMessage(mp, false); + } else { + rp = mm.sendMailMessageEmbedded(mp, embed); + } + } else { + String l_urlImg = bean.getParm("CODA_MESSAGGI_IMG_URL_BASE").getTesto(); + String l_msg = bean.getMessaggioDaInviare(); + int idx; + while ((idx = l_msg.indexOf("../")) >= 0) + l_msg = l_msg.substring(0, idx) + l_msg.substring(0, idx); + l_msg = l_msg.replaceAll("\"_img/_imgMsg", "\"" + l_urlImg + "_img/_imgMsg"); + l_msg = l_msg.replaceAll("\"/_img/_imgMsg", "\"" + l_urlImg + "_img/_imgMsg"); + l_msg = l_msg.replaceAll("href=\"/", "href=\"" + l_urlImg); + if (useOpenTag) { + String tmpTag = "
AblMlst"; + l_msg = l_msg + l_msg; + } + l_msg = "Mail Message" + l_msg.toString() + ""; + MailMessage mmCampi = new MailMessage(bean.getApFull()); + mmCampi.setTextMessage(l_msg.toString()); + mmCampi.setString("email", bean.getMailTo()); + try { + mmCampi.setString("emailUrl", URLEncoder.encode(bean.getMailTo(), "UTF-8")); + } catch (Exception e) {} + if (!bean.getCampiMail().isEmpty()) { + StringTokenizer st = new StringTokenizer(bean.getCampiMail(), "|"); + mmCampi.setTextMessage(l_msg.toString()); + int i = 1; + while (st.hasMoreTokens()) { + String campo = st.nextToken(); + mmCampi.setString("campo" + i, campo); + i++; + } + } + mp.put("MSG", mmCampi.getMessageGtLt()); + StringBuffer fileNames = new StringBuffer(); + if (bean.getId_templateMsg() == 0L) { + Vectumerator vec = bean.getAllegati(); + while (vec.hasMoreElements()) { + AllegatoCodaMessaggi rowCS = (AllegatoCodaMessaggi)vec.nextElement(); + fileNames.append(rowCS.getNomeFileCompleto()); + if (vec.hasMoreElements()) + fileNames.append(","); + } + } else { + Vectumerator vec = bean.getTemplateMsg().getAllegati(); + while (vec.hasMoreElements()) { + AllegatoTemplateMsg rowCS = (AllegatoTemplateMsg)vec.nextElement(); + fileNames.append(rowCS.getNomeFileCompleto()); + if (vec.hasMoreElements()) + fileNames.append(","); + } + } + if (!fileNames.toString().trim().isEmpty()) + mp.put("FILES", fileNames.toString()); + MailMessage mm = new MailMessage(bean.getApFull()); + Calendar cal = Calendar.getInstance(); + Timestamp ts = new Timestamp(cal.getTimeInMillis()); + System.out.println("#-#-#- " + ts.toString() + " invio messaggio a " + bean.getMailTo()); + rp = mm.sendMailMessage(mp, false); + } + if (!rp.getStatus()) { + String msg = bean.getDataFormat().format(getToday()) + " " + bean.getDataFormat().format(getToday()); + if (bean.getResult().length() > 0) { + bean.setResult(bean.getResult() + "
" + bean.getResult()); + } else { + bean.setResult(msg); + } + bean.setFlgStatoInvio(2L); + bean.save(); + } else { + bean.setFlgStatoInvio(1L); + bean.setDataInvio(getToday()); + rp.append(bean.save()); + } + return rp; + } + + public synchronized ResParm inviaMessaggiAll(CodaMessaggiCR CR) { + if (!isThreadAttivo()) { + new ThreadSendMsgs(CR); + return new ResParm(true, "Thread invio messaggi avviato....
" + threadInvioCodaMessaggiMsg); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public void setDestinatario(String destinatario) { + this.destinatario = destinatario; + } + + public String getDestinatarioCompleto() { + if (isSmsMessage()) + return getDestinatario() + " cell. " + getDestinatario(); + return getDestinatario() + " mail. " + getDestinatario(); + } + + protected void initFields() { + super.initFields(); + setFlgTipo(2L); + } + + public String getOggettoEmail() { + return (this.oggettoEmail == null) ? "" : this.oggettoEmail.trim(); + } + + public void setOggettoEmail(String oggettoEmail) { + this.oggettoEmail = oggettoEmail; + } + + protected int getStringValueCase(String name) { + if ((name != null && name.startsWith("mail")) || name.equals("testoMessaggio")) + return 0; + return super.getStringValueCase(name); + } + + public String getImgFileName(int imgNumber) { + return getImgFileName(imgNumber, getImgTmst()); + } + + public String getImgFileName(int imgNumber, String oldTmst) { + if (getId_templateMsg() == 0L) + return "CM_" + getId_codaMessaggi() + "_" + oldTmst + "_" + imgNumber + ".jpg"; + return getTemplateMsg().getImgFileName(imgNumber, oldTmst); + } + + public String getImgTmst() { + return (this.imgTmst == null) ? "" : this.imgTmst; + } + + public void setImgTmst(String imgTmst) { + this.imgTmst = imgTmst; + } + + public static boolean isThreadAttivo() { + return (threadCancellaCodaMessaggi || threadCreaCodaMessaggi || threadInvioCodaMessaggi || MailNewsletter.threadAddMailsFromFile); + } + + public void setCampagna(String campagna) { + this.campagna = campagna; + } + + public String getCellulare() { + return (this.cellulare == null) ? "" : this.cellulare.trim(); + } + + public long getId_templateMsg() { + return this.id_templateMsg; + } + + public void setId_templateMsg(long id_templateMsg) { + this.id_templateMsg = id_templateMsg; + setTemplateMsg(null); + } + + public TemplateMsg getTemplateMsg() { + this.templateMsg = (TemplateMsg)getSecondaryObject(this.templateMsg, TemplateMsg.class, getId_templateMsg()); + return this.templateMsg; + } + + public void setTemplateMsg(TemplateMsg templateMsg) { + this.templateMsg = templateMsg; + } + + public static synchronized void addLettura(CodaMessaggi bean, String l_ip) { + if (bean.getId_codaMessaggi() != 0L) { + Timestamp currentTmst = new Timestamp(System.currentTimeMillis()); + if (bean.getTmstPrimaLettura().isEmpty()) { + bean.setTmstPrimaLettura(currentTmst.toString()); + bean.setIpPrimaLettura(l_ip); + } + bean.setTmstUltimaLettura(currentTmst.toString()); + bean.setIpUltimaLettura(l_ip); + bean.setNLetture(bean.getNLetture() + 1L); + bean.save(); + } + } + + private void findByCRCreateStmtDate(CodaMessaggiCR CR, PreparedStatement stmt) {} + + private void findByCRCreateWC(CodaMessaggiCR CR, StringBuffer s_Sql_Find, WcString wc) { + if (CR.getId_codaMessaggiS() != 0L) { + wc.addWc("A.id_codaMessaggi=" + CR.getId_codaMessaggiS()); + } else { + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.destinatario like '%" + token + "%' or A.cellulare like '%" + token + "%' or A.mailTo like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (!CR.getCampagna().isEmpty()) + wc.addWc("A.campagna like'%" + CR.getCampagna() + "%'"); + if (CR.getFlgTipo() == 0L) { + wc.addWc("(A.flgTipo is null or flgTipo=0)"); + } else if (CR.getFlgTipo() == 99L) { + wc.addWc("(A.flgTipo =2 OR A.flgTipo =3)"); + } else if (CR.getFlgTipo() > 0L) { + wc.addWc("A.flgTipo =" + CR.getFlgTipo()); + } + } + if (CR.getFlgStatoInvio() == 0L) { + wc.addWc("(A.flgStatoInvio is null or flgStatoInvio=0)"); + } else if (CR.getFlgStatoInvio() > 0L) { + wc.addWc("A.flgStatoInvio =" + CR.getFlgStatoInvio()); + } + } + + private int findByCRTotRecord(CodaMessaggiCR CR) { + StringBuffer s_Sql_Find = new StringBuffer("select count(*) as tot from CODA_MESSAGGI AS A "); + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + findByCRCreateStmtDate(CR, stmt); + return (int)getTots(stmt); + } catch (Exception e) { + handleDebug(e); + return 0; + } + } + + protected void deleteCascade() { + if (getId_templateMsg() == 0L) + for (int i = 1; i <= 4; i++) + new File(getDocBase() + getDocBase() + getPathImg()).delete(); + } + + public final ResParm cancellazioneMassiva(CodaMessaggiCR CR) { + if (!isThreadAttivo()) { + new ThreadCancellaCodaMsg(CR); + return new ResParm(true, "Thread CANCELLAZIONE coda messaggi avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public ResParm detachTemplate(int numImmagini) { + ResParm rp = new ResParm(true); + if (getId_templateMsg() == 0L) { + rp.setStatus(false); + rp.setMsg("Attenzione! Il presente testoMessaggio non ha template associati!"); + } else { + TemplateMsg l_ts = getTemplateMsg(); + if (l_ts.getId_templateMsg() > 0L && l_ts.getFlgTipo() == 1L) { + setId_templateMsg(0L); + for (int i = 1; i <= numImmagini; i++) + new File(getDocBase() + getDocBase() + getPathImg()).delete(); + String temp = l_ts.getTestoMessaggio(); + setImgTmst(l_ts.getImgTmst()); + for (int j = 1; j <= numImmagini; j++) { + try { + copyFile(getDocBase() + getDocBase() + getPathImg(), getDocBase() + getDocBase() + getPathImg()); + temp = temp.replaceAll(l_ts.getImgFileName(j), getImgFileName(j)); + } catch (Exception e) { + rp.setException(e); + rp.setStatus(false); + } + } + setTestoMessaggio(temp); + rp = save(); + } else { + rp.setMsg("ERRORE! template non valido!"); + rp.setStatus(false); + } + } + return rp; + } + + public String getTmstPrimaLettura() { + return (this.tmstPrimaLettura == null) ? "" : this.tmstPrimaLettura.trim(); + } + + public void setTmstPrimaLettura(String tmstPrimaLettura) { + this.tmstPrimaLettura = tmstPrimaLettura; + } + + public String getTmstUltimaLettura() { + return (this.tmstUltimaLettura == null) ? "" : this.tmstUltimaLettura.trim(); + } + + public void setTmstUltimaLettura(String tmstUltimaLettura) { + this.tmstUltimaLettura = tmstUltimaLettura; + } + + public long getNLetture() { + return this.nLetture; + } + + public void setNLetture(long nLetture) { + this.nLetture = nLetture; + } + + public String getIpPrimaLettura() { + return (this.ipPrimaLettura == null) ? "" : this.ipPrimaLettura.trim(); + } + + public void setIpPrimaLettura(String ipPrimaLettura) { + this.ipPrimaLettura = ipPrimaLettura; + } + + public String getIpUltimaLettura() { + return (this.ipUltimaLettura == null) ? "" : this.ipUltimaLettura.trim(); + } + + public void setIpUltimaLettura(String ipUltimaLettura) { + this.ipUltimaLettura = ipUltimaLettura; + } + + public final ResParm creaCodaMessaggi(TemplateMsg l_templateMsg, String l_filename) { + if (!isThreadAttivo()) { + new ThreadCreaCodaMsgFile(l_templateMsg, l_filename, getApFull()); + return new ResParm(true, "Thread crea coda email tramite file e template avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public ResParm updateStatoMessaggi(long l_flgOldStato, long l_flgNewStato) { + ResParm rp = new ResParm(true); + String s_sqString = " update CODA_MESSAGGI SET flgStatoInvio=" + l_flgNewStato + " where flgStatoInvio=" + l_flgOldStato; + rp = update(s_sqString); + return rp; + } + + public Vectumerator findByCR(CodaMessaggiCR CR, int pageNumber, int pageRows) { + StringBuffer s_Sql_Find = new StringBuffer("select A.* from CODA_MESSAGGI AS A"); + String s_Sql_Order = " order by A.dataCreazione desc, A.mailTo"; + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + findByCRCreateStmtDate(CR, stmt); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm addAllegato(AllegatoCodaMessaggi row) { + AllegatoCodaMessaggi bean = new AllegatoCodaMessaggi(getApFull()); + bean.findByCodaMessaggiNomeFile(row.getId_codaMessaggi(), row.getNomeFile()); + if (bean.getDBState() == 1) + return new ResParm(false, "Nome File Duplicato"); + row.setDBState(0); + ResParm rp = row.save(); + return rp; + } + + public ResParm delAllegato(AllegatoCodaMessaggi row) { + AllegatoCodaMessaggi bean = new AllegatoCodaMessaggi(getApFull()); + bean.findByPrimaryKey(row.getId_allegatoCodaMessaggi()); + return bean.delete(); + } + + public static void initApplicationParms(ApplParmFull ap) { + boolean debug = false; + if (ap != null) { + DBAdapter.logDebug(debug, "Coda Messaggi initParms: start"); + String l_tipoParm = ""; + Parm bean = new Parm(ap); + l_tipoParm = "CODA MESSAGGI - NEWSLETTER"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("CODA_MESSAGGI_USE_EMBEDDED_IMG"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODA_MESSAGGI_USE_EMBEDDED_IMG"); + bean.setDescrizione("CODA_MESSAGGI_USE_EMBEDDED_IMG"); + bean.setFlgTipo(5L); + bean.setNota("0:NO
1:SI"); + bean.save(); + bean.findByCodice("CODA_MESSAGGI_USE_OPEN_TAG"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODA_MESSAGGI_USE_OPEN_TAG"); + bean.setDescrizione("CODA_MESSAGGI_USE_OPEN_TAG"); + bean.setFlgTipo(5L); + bean.setNota("0:NO
1:SI"); + bean.save(); + bean.findByCodice("CODA_MESSAGGI_PATH_IMG_MSG"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODA_MESSAGGI_PATH_IMG_MSG"); + bean.setDescrizione("CODA_MESSAGGI_PATH_IMG_MSG"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_img/_imgMsg/"); + bean.setNota("Path relativo a docbase che finisce con /"); + bean.save(); + bean.findByCodice("CODA_MESSAGGI_EMAIL_DELAY"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODA_MESSAGGI_EMAIL_DELAY"); + bean.setDescrizione("CODA_MESSAGGI_EMAIL_DELAY"); + bean.setFlgTipo(1L); + bean.setNota("RITARDO DI INVIO IN SECONDI TRA UNA MAIL E L'ALTRA.
O: NESSUN RITARDO"); + bean.save(); + bean.findByCodice("CODA_MESSAGGI_SMS_DELAY"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODA_MESSAGGI_SMS_DELAY"); + bean.setDescrizione("CODA_MESSAGGI_SMS_DELAY"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(2.0D); + bean.setNota("RITARDO DI INVIO IN SECONDI TRA UN SMS E L'ALTRO.
O: NESSUN RITARDO"); + bean.save(); + bean.findByCodice("CODA_MESSAGGI_IMG_URL_BASE"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODA_MESSAGGI_IMG_URL_BASE"); + bean.setDescrizione("CODA_MESSAGGI_IMG_URL_BASE"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("http://www.sitoweb.com/"); + bean.setNota("URL DI BASE PER IMMAGINI NELLE EMAIL."); + bean.save(); + bean.findByCodice("CODA_MESSAGGI_MAIL_FROM"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODA_MESSAGGI_MAIL_FROM"); + bean.setDescrizione("CODA_MESSAGGI_MAIL_FROM"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("newsletter@miodomini.com"); + bean.setNota("MAIL FROM UTILIZZATO DA CODA MESSAGGI"); + bean.save(); + bean.findByCodice("MAIL_INVIO_DOC"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIL_INVIO_DOC"); + bean.setDescrizione("MAIL_INVIO_DOC"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("mail@dominio.com"); + bean.setNota("INDIRIZZO EMAIL DIDEFAULT PER INVIO DOCUMENTI"); + bean.save(); + bean.findByCodice("CODA_MESSAGGI_ATTACH_PATH"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CODA_MESSAGGI_ATTACH_PATH"); + bean.setDescrizione("CODA_MESSAGGI_ATTACH_PATH"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_attach/_codaMessaggi/"); + bean.setNota("Path x attach coda messaggi relativo a docbase che finisce con /"); + bean.save(); + bean.findByCodice("TMPL_MSG_ATTACH_PATH"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("TMPL_MSG_ATTACH_PATH"); + bean.setDescrizione("TMPL_MSG_ATTACH_PATH"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_attach/_templateMessaggi/"); + bean.setNota("Path x attach template messaggi relativo a docbase che finisce con /"); + bean.save(); + DBAdapter.logDebug(debug, "Coda Messaggi initParms: stop"); + } + } + + public String getPathAllegato() { + return getDocBase() + getDocBase(); + } + + public Vectumerator getAllegati() { + return new AllegatoCodaMessaggi(getApFull()).findByCodaMessaggi(getId_codaMessaggi(), 0, 0); + } + + public String getCampiMail() { + return (this.campiMail == null) ? "" : this.campiMail.trim(); + } + + public void setCampiMail(String campiMail) { + this.campiMail = campiMail; + } + + public final ResParm creaCodaMessaggi(MailNewsletterCR CR, long id_templateMsg) { + if (!isThreadAttivo()) { + new ThreadCreaCodaMessaggiByMailNewsletter(CR, id_templateMsg); + return new ResParm(true, "Thread crea coda email tramite MailNewsletter avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public String getCampagna() { + return (this.campagna == null) ? "" : this.campagna.trim(); + } + + public String getMessaggioDaInviare() { + if (getId_templateMsg() == 0L) + return getTestoMessaggio(); + if (getTestoMessaggio().isEmpty()) + return getTemplateMsg().getTestoMessaggio(); + return getTestoMessaggio(); + } + + public String getTestoMessaggioScript() { + return DBAdapter.prepareScriptString(getTestoMessaggio(), true, false); + } + + public ResParm addCodaMessaggioByTemplate(String l_email, TemplateMsg l_templateMessage) { + ResParm rp = new ResParm(true); + if (getApFull() != null) { + if (!l_email.isEmpty()) { + CodaMessaggi cm = new CodaMessaggi(getApFull()); + cm.setFlgTipo(l_templateMessage.getFlgTipo()); + String campagna = l_templateMessage.getDescrizione() + " " + l_templateMessage.getDescrizione(); + cm.setCampagna(campagna); + cm.setMailTo(l_email.trim()); + cm.setOggettoEmail(l_templateMessage.getOggettoEmail()); + rp = cm.save(); + if (rp.getStatus()) + rp = cm.useTemplate(l_templateMessage, true); + } else { + rp.setStatus(true); + rp.setMsg("Attenzione! email vuota!"); + } + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Parametri db assenti!"); + } + return rp; + } + + public long getId_remoteDevice() { + return this.id_remoteDevice; + } + + public void setId_remoteDevice(long id_remoteDevice) { + this.id_remoteDevice = id_remoteDevice; + setRemoteDevice(null); + } + + public RemoteDevice getRemoteDevice() { + this.remoteDevice = (RemoteDevice)getSecondaryObject(this.remoteDevice, RemoteDevice.class, getId_remoteDevice()); + return this.remoteDevice; + } + + public void setRemoteDevice(RemoteDevice remoteDevice) { + this.remoteDevice = remoteDevice; + } + + public JSONObject getJsonSmsRecord() { + JSONObject jo = new JSONObject(); + jo.put("id_codaMessaggi", getId_codaMessaggi()); + jo.put("cellulare", getCellulare()); + jo.put("testoMessaggio", getTestoMessaggio()); + return jo; + } + + public Vectumerator findByCROLD(CodaMessaggiCR CR, int pageNumber, int pageRows) { + boolean flgOttimizzo = false; + int start = 0; + int stop = 0; + if (getApFull().getDbType() == 5 || getApFull().getDbType() == 3 || + getApFull().getDbType() == 17 || + getApFull().getDbType() == 14 || + getApFull().getDbType() == 13) + flgOttimizzo = true; + if (pageNumber == 0 && pageRows == 0) { + flgOttimizzo = false; + } else { + if (pageNumber == 0) + pageNumber = 1; + start = (pageNumber - 1) * pageRows; + stop = start + pageRows; + } + StringBuffer s_Sql_Find = new StringBuffer("select A.* from CODA_MESSAGGI AS A"); + if (flgOttimizzo && (getApFull().getDbType() == 14 || + getApFull().getDbType() == 13)) + s_Sql_Find = new StringBuffer("select TOP " + stop + " A.* from CODA_MESSAGGI AS A"); + String s_Sql_Order = " order by A.dataCreazione desc, A.mailTo"; + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt; + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) { + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + } else if (getApFull().getDbType() != 14 && + getApFull().getDbType() != 13) { + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString() + " limit " + s_Sql_Order + "," + start); + } else { + stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + wc.toString()); + } + findByCRCreateStmtDate(CR, stmt); + if ((pageNumber == 0 && pageRows == 0) || !flgOttimizzo) + return findRows(stmt, pageNumber, pageRows); + if (getApFull().getDbType() == 14 || + getApFull().getDbType() == 13) { + Vectumerator vectumerator = findRows(stmt, pageNumber, pageRows); + vectumerator.setPageNumber(pageNumber); + if (stop >= vectumerator.getTotNumberOfRecords() - 1) + vectumerator.setTotNumberOfRecords(findByCRTotRecord(CR)); + return vectumerator; + } + Vectumerator vec = findRows(stmt, 1, pageRows); + vec.setPageNumber(pageNumber); + vec.setTotNumberOfRecords(findByCRTotRecord(CR)); + return vec; + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public boolean isSmsMessage() { + if (getFlgTipo() == 2L || getFlgTipo() == 3L || + getFlgTipo() == 4L) + return true; + return false; + } + + public String getPathImg() { + return getParm("CODA_MESSAGGI_PATH_IMG_MSG").getTesto(); + } + + public static final synchronized ResParm inviaSmsSkebby(CodaMessaggi bean) { + ResParm rp = new ResParm(true); + SmsSkebbyApi skApi = new SmsSkebbyApi(bean.getApFull()); + String numero = bean.getCellulare(); + if (!numero.startsWith("+39")) + numero = "+39" + numero; + SmsSkebbyMessage smsMesg = new SmsSkebbyMessage(numero, bean.getTestoMessaggio()); + SmsSkebbyApiResult resF = skApi._sendMessage(smsMesg); + if (!resF.isOk()) { + String msg = bean.getDataFormat().format(getToday()) + " " + bean.getDataFormat().format(getToday()); + if (bean.getResult().length() > 0) { + bean.setResult(bean.getResult() + "
" + bean.getResult()); + } else { + bean.setResult(msg); + } + bean.setFlgStatoInvio(2L); + bean.save(); + } else { + bean.setFlgStatoInvio(1L); + String msg = bean.getDataFormat().format(getToday()) + " " + bean.getDataFormat().format(getToday()); + if (bean.getResult().length() > 0) { + bean.setResult(bean.getResult() + "
" + bean.getResult()); + } else { + bean.setResult(msg); + } + bean.setDataInvio(getToday()); + rp.append(bean.save()); + } + return rp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/CodaMessaggiCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/CodaMessaggiCR.java new file mode 100644 index 00000000..685f70ee --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/CodaMessaggiCR.java @@ -0,0 +1,172 @@ +package it.acxent.newsletter; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.rd.RemoteDevice; +import java.sql.Date; + +public class CodaMessaggiCR extends CRAdapter { + private long id_codaMessaggi; + + private long flgTipo = -1L; + + private long flgStatoInvio = 0L; + + private Date dataCreazione; + + private String messaggio; + + private String cellulare; + + private String mailTo; + + private String mailCc; + + private String mailBcc; + + private String campagna; + + private long id_codaMessaggiS; + + private String destinatario; + + private long id_remoteDevice; + + private RemoteDevice remoteDevice; + + public CodaMessaggiCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CodaMessaggiCR() {} + + public void setId_codaMessaggi(long newId_codaInvio) { + this.id_codaMessaggi = newId_codaInvio; + } + + public void setFlgTipo(long newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public void setFlgStatoInvio(long newFlgStatoInvio) { + this.flgStatoInvio = newFlgStatoInvio; + } + + public void setDataCreazione(Date newDataCreazione) { + this.dataCreazione = newDataCreazione; + } + + public void setMessaggio(String newMessaggio) { + this.messaggio = newMessaggio; + } + + public void setCellulare(String newCellulare) { + this.cellulare = newCellulare; + } + + public void setMailTo(String newMailTo) { + this.mailTo = newMailTo; + } + + public void setMailCc(String newMailCc) { + this.mailCc = newMailCc; + } + + public void setMailBcc(String newMailBcc) { + this.mailBcc = newMailBcc; + } + + public long getId_codaMessaggi() { + return this.id_codaMessaggi; + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public long getFlgStatoInvio() { + return this.flgStatoInvio; + } + + public Date getDataCreazione() { + return this.dataCreazione; + } + + public String getMessaggio() { + return (this.messaggio == null) ? "" : this.messaggio.trim(); + } + + public String getCellulare() { + return (this.cellulare == null) ? "" : this.cellulare.trim(); + } + + public String getMailTo() { + return (this.mailTo == null) ? "" : this.mailTo.trim(); + } + + public String getMailCc() { + return (this.mailCc == null) ? "" : this.mailCc.trim(); + } + + public String getMailBcc() { + return (this.mailBcc == null) ? "" : this.mailBcc.trim(); + } + + public static final String getStatoInvio(long l_flgStatoInvio) { + return CodaMessaggi.getStatoInvio(l_flgStatoInvio); + } + + public String getStatoInvio() { + return CodaMessaggi.getStatoInvio(getFlgStatoInvio()); + } + + public static final String getTipo(long l_flgTipo) { + return CodaMessaggi.getTipo(l_flgTipo); + } + + public String getTipo() { + return CodaMessaggi.getTipo(getFlgTipo()); + } + + public String getCampagna() { + return (this.campagna == null) ? AB_EMPTY_STRING : this.campagna.trim(); + } + + public void setCampagna(String campagna) { + this.campagna = campagna; + } + + public long getId_codaMessaggiS() { + return this.id_codaMessaggiS; + } + + public void setId_codaMessaggiS(long id_codaMessaggiS) { + this.id_codaMessaggiS = id_codaMessaggiS; + } + + public String getDestinatario() { + return (this.destinatario == null) ? AB_EMPTY_STRING : this.destinatario.trim(); + } + + public void setDestinatario(String destinatario) { + this.destinatario = destinatario; + } + + public long getId_remoteDevice() { + return this.id_remoteDevice; + } + + public RemoteDevice getRemoteDevice() { + this.remoteDevice = (RemoteDevice)getSecondaryObject(this.remoteDevice, RemoteDevice.class, getId_remoteDevice()); + return this.remoteDevice; + } + + public void setId_remoteDevice(long id_remoteDevice) { + this.id_remoteDevice = id_remoteDevice; + setRemoteDevice(null); + } + + public void setRemoteDevice(RemoteDevice remoteDevice) { + this.remoteDevice = remoteDevice; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/MailNewsletter.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/MailNewsletter.java new file mode 100644 index 00000000..a032b676 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/MailNewsletter.java @@ -0,0 +1,296 @@ +package it.acxent.newsletter; + +import it.acxent.anag.Users; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Time; +import java.sql.Timestamp; +import java.text.SimpleDateFormat; +import java.util.Calendar; + +public class MailNewsletter extends DBAdapter implements Serializable { + private static final long serialVersionUID = 2575790244816812859L; + + private long id_mailNewsletter; + + private String eMail; + + private long id_templateMsg; + + private TemplateMsg templateMsg; + + private Date dataTemplate; + + class addMailsFromFile extends Thread { + private String filename; + + private ApplParmFull ap; + + public addMailsFromFile(String l_filename, ApplParmFull l_ap) { + synchronized (this) { + if (!CodaMessaggi.isThreadAttivo()) { + MailNewsletter.threadAddMailsFromFile = true; + this.filename = l_filename; + this.ap = l_ap; + start(); + } + } + } + + public void run() { + long togliDuplicatiOgni = 1000L; + long numRecord = 0L, numDuplicati = 0L; + Timestamp start = new Timestamp(Calendar.getInstance() + .getTimeInMillis()); + System.out.println("##############\nMailNewsletter.addMailsFromFile\nSTART: " + + start.toString()); + ResParm rp = new ResParm(true); + MailNewsletter ml = new MailNewsletter(MailNewsletter.this.getApFull()); + try { + FileReader fr = new FileReader(this.filename); + BufferedReader br = new BufferedReader(fr); + long i = 0L; + String s; + while ((s = br.readLine()) != null) { + ml = new MailNewsletter(MailNewsletter.this.getApFull()); + ml.setEMail(s); + rp = ml.save(); + if (!rp.getStatus()) + numDuplicati++; + numRecord++; + MailNewsletter.threadAddMailsFromFileMsg = "Attenzione! Thread importazione indirizzi da file in esecuzione!!! Record inseriti: " + numRecord + " - duplicati o errori: " + numDuplicati; + i++; + if (i % 100L == 0L) + System.out.print("."); + if (i % 1000L == 0L) + System.out.println(i); + if (i % togliDuplicatiOgni == 0L) + System.out.println(" " + rp.getMsg()); + } + fr.close(); + } catch (FileNotFoundException e) { + MailNewsletter.this.handleDebug(e); + } catch (IOException e) { + MailNewsletter.this.handleDebug(e); + } + rp = MailNewsletter.this.cancellaDoppioni(); + System.out.println(" " + rp.getMsg()); + MailNewsletter.this.handleDebug("Aggiunte nuove mail a mailNewsletter. Tot nuovi record immessi: " + numRecord, 1); + Timestamp stop = new Timestamp(Calendar.getInstance() + .getTimeInMillis()); + System.out.println("STOP: " + start.toString()); + SimpleDateFormat dfMS = new SimpleDateFormat("HH:mm:ss "); + System.out.println("DURATA: " + + dfMS.format((java.util.Date)new Time(stop.getTime() - start.getTime() - 3600000L)) + "\nMailNewsletter.addMailsFromFile\n****************"); + MailNewsletter.threadAddMailsFromFile = false; + } + } + + public static boolean threadAddMailsFromFile = false; + + public static String threadAddMailsFromFileMsg = ""; + + public MailNewsletter(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public MailNewsletter() {} + + public void setId_mailNewsletter(long id_mailNewsletter) { + this.id_mailNewsletter = id_mailNewsletter; + } + + public long getId_mailNewsletter() { + return this.id_mailNewsletter; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findCodaByCR(MailNewsletterCR CR, long inizio, long fine) { + String s_Sql_Find = "select A.* from MAIL_NEWSLETTER AS A"; + String s_Sql_Order = " "; + WcString wc = new WcString(); + if (!CR.getEMailR().equals("")) + wc.addWc(" A.eMail LIKE '%" + CR.getEMailR() + "%' "); + try { + long start = inizio - 1L; + long stop = fine - start; + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString() + " limit " + s_Sql_Order + "," + start); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByIndirizzo(String indirizzo) { + String s_Sql_Find = "select A.* from MAIL_NEWSLETTER AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.indirizzo = '" + indirizzo + "' "); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public String getEMail() { + return (this.eMail == null) ? "" : this.eMail; + } + + public void setEMail(String indirizzo) { + this.eMail = indirizzo; + } + + public ResParm addIndirizzi(String fileName) { + if (!CodaMessaggi.isThreadAttivo()) { + new addMailsFromFile(fileName, getApFull()); + return new ResParm(true, "TThread inserimento indirizzi avviato"); + } + return new ResParm(false, "ATTENZIONE!! Thread in esecuzione!!!"); + } + + public ResParm delIndirizzi(String indirizzi) { + ResParm rp = new ResParm(true); + StringTokenizer st = null; + if (indirizzi.indexOf(",") > 0) { + st = new StringTokenizer(indirizzi, ","); + } else if (indirizzi.indexOf(";") > 0) { + st = new StringTokenizer(indirizzi, ";"); + } else { + st = new StringTokenizer(indirizzi, "\r\n"); + } + if (st != null) + while (st.hasMoreTokens()) { + String indirizzo = st.nextToken().trim(); + findByIndirizzo(indirizzo); + if (getDBState() == 1) + rp = delete(); + } + return rp; + } + + public ResParm impUtenti() { + ResParm rp = new ResParm(true); + Users user = new Users(getApFull()); + Vectumerator vec = user.findUsersByFlgMailingList(); + while (vec.hasMoreElements()) { + user = (Users)vec.nextElement(); + if (!user.getEMail().equals("")) { + MailNewsletter ml = new MailNewsletter(getApFull()); + ml.setEMail(user.getEMail()); + ml.save(); + } + } + return rp; + } + + public long getId_templateMsg() { + return this.id_templateMsg; + } + + public void setId_templateMsg(long id_templateMsg) { + this.id_templateMsg = id_templateMsg; + } + + public Date getDataTemplate() { + return this.dataTemplate; + } + + public void setDataTemplate(Date dataTemplate) { + this.dataTemplate = dataTemplate; + } + + public TemplateMsg getTemplateMsg() { + this.templateMsg = (TemplateMsg)getSecondaryObject(this.templateMsg, TemplateMsg.class, + getId_templateMsg()); + return this.templateMsg; + } + + public void setTemplateMsg(TemplateMsg templateMsg) { + this.templateMsg = templateMsg; + } + + public Vectumerator findByCR(MailNewsletterCR CR, int pageNumber, int pageRows) { + boolean flgOttimizzo = true; + if (pageNumber == 0 && pageRows == 0) + flgOttimizzo = false; + StringBuffer s_Sql_Find = new StringBuffer("select A.* from MAIL_NEWSLETTER AS A"); + String s_Sql_Order = ""; + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + if (!CR.getEMailR().equals("")) + wc.addWc(" A.eMail LIKE '%" + CR.getEMailR() + "%' "); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find) + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void findByCRCreateWC(MailNewsletterCR CR, StringBuffer s_Sql_Find, WcString wc) { + if (!CR.getEMailR().equals("")) + wc.addWc(" A.eMail LIKE '%" + CR.getEMailR() + "%' "); + } + + protected int findByCRTotRecord(MailNewsletterCR CR) { + StringBuffer s_Sql_Find = new StringBuffer("select count (A.id_mailNewsletter) as tot from MAIL_NEWSLETTER AS A"); + WcString wc = new WcString(); + findByCRCreateWC(CR, s_Sql_Find, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + String.valueOf(s_Sql_Find)); + return (int)getTots(stmt); + } catch (Exception e) { + handleDebug(e); + return 0; + } + } + + public ResParm cancellaDoppioni() { + String sql = "select id_mailNewsletter from MAIL_NEWSLETTER group by indirizzo having count(*) >1 limit 1, 1000 "; + try { + Vectumerator vec; + long i = 0L; + do { + PreparedStatement stmt = getConn().prepareStatement(sql); + vec = findRows(stmt); + while (vec.hasMoreElements()) { + MailNewsletter row = (MailNewsletter)vec.nextElement(); + row.delete(); + i++; + } + } while (vec.getTotNumberOfRecords() > 0); + return new ResParm(true, "Num. doppioni cancellati : " + i); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return new ResParm(false, e); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/MailNewsletterCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/MailNewsletterCR.java new file mode 100644 index 00000000..7db7d387 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/MailNewsletterCR.java @@ -0,0 +1,54 @@ +package it.acxent.newsletter; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class MailNewsletterCR extends CRAdapter { + private static final long serialVersionUID = 2575790244816812859L; + + private long id_mailNewsletter; + + private String eMailR; + + private long inizio; + + private long fine; + + public MailNewsletterCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public MailNewsletterCR() {} + + public void setId_mailNewsletter(long id_mailNewsletter) { + this.id_mailNewsletter = id_mailNewsletter; + } + + public long getId_mailNewsletter() { + return this.id_mailNewsletter; + } + + public String getEMailR() { + return (this.eMailR == null) ? AB_EMPTY_STRING : this.eMailR; + } + + public void setEMailR(String indirizzo) { + this.eMailR = indirizzo; + } + + public long getInizio() { + return this.inizio; + } + + public void setInizio(long inizio) { + this.inizio = inizio; + } + + public long getFine() { + return this.fine; + } + + public void setFine(long fine) { + this.fine = fine; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/NoMlist.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/NoMlist.java new file mode 100644 index 00000000..76cbaf81 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/NoMlist.java @@ -0,0 +1,180 @@ +package it.acxent.newsletter; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.reg.EcDc; +import it.acxent.util.FileWr; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.BufferedReader; +import java.io.DataInputStream; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.io.Serializable; +import java.net.URLEncoder; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Time; + +public class NoMlist extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1486503250372L; + + public static final String NO_MLIST_KEY1 = "Xg3Z5sFQ"; + + public static final String NO_MLIST_KEY2 = "Xg3Z22FQ"; + + public static final String OK_PAGE = "/mlistOk.jsp"; + + public static final String ATTR_EMAIL = "email"; + + private long id_noMlist; + + private String email; + + private Date dataCancellazione; + + private Time oraCancellazione; + + private String ipAddress; + + public NoMlist(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public NoMlist() {} + + public void setId_noMlist(long newId_noMlist) { + this.id_noMlist = newId_noMlist; + } + + public void setEmail(String newEmail) { + this.email = newEmail; + } + + public void setDataCancellazione(Date newDataCancellazione) { + this.dataCancellazione = newDataCancellazione; + } + + public void setOraCancellazione(Time newOraCancellazione) { + this.oraCancellazione = newOraCancellazione; + } + + public void setIpAddress(String newIpAddress) { + this.ipAddress = newIpAddress; + } + + public long getId_noMlist() { + return this.id_noMlist; + } + + public String getEmail() { + return (this.email == null) ? "" : this.email.trim(); + } + + public Date getDataCancellazione() { + return this.dataCancellazione; + } + + public Time getOraCancellazione() { + return this.oraCancellazione; + } + + public String getIpAddress() { + return (this.ipAddress == null) ? "" : this.ipAddress.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(NoMlistCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from NO_MLIST AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByEmail(String l_email) { + String s_Sql_Find = "select A.* from NO_MLIST AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.email='" + l_email + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public String elaboraEPulisci(String filename) { + int idx = filename.lastIndexOf("."); + String newFileName = filename.substring(0, idx) + "_elaborato.txt"; + try { + FileWr fw = new FileWr(newFileName); + NoMlist bean = new NoMlist(getApFull()); + FileInputStream fstream = new FileInputStream(filename); + DataInputStream in = new DataInputStream(fstream); + BufferedReader br = new BufferedReader(new InputStreamReader(in)); + String strLine; + while ((strLine = br.readLine()) != null) { + bean.findByEmail(strLine); + if (bean.getDBState() == 0) { + fw.writeLine(strLine); + continue; + } + System.out.println("Trovato " + strLine); + } + in.close(); + br.close(); + fw.closeFile(); + } catch (Exception e) {} + return newFileName; + } + + public static final String crittaEmail(String email) { + try { + String e1c = EcDc.encodeDizionario(email, "Xg3Z5sFQ"); + String e2c = EcDc.encodeDizionario(email, "Xg3Z22FQ"); + System.out.println(e1c + " " + e1c); + String action = "?e1=" + URLEncoder.encode(e1c, "utf-8") + "&e2=" + URLEncoder.encode(e2c, "utf-8"); + System.out.println(action); + return action; + } catch (Exception e) { + return null; + } + } + + public static final String decrittaEmail(String emailC1, String emailC2) { + String email1 = EcDc.decodeDizionario(emailC1, "Xg3Z5sFQ"); + String email2 = EcDc.decodeDizionario(emailC2, "Xg3Z22FQ"); + if (email1.equals(email2)) + return email1; + return null; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/NoMlistCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/NoMlistCR.java new file mode 100644 index 00000000..1dbbd8e1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/NoMlistCR.java @@ -0,0 +1,64 @@ +package it.acxent.newsletter; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; +import java.sql.Time; + +public class NoMlistCR extends CRAdapter { + private String email; + + private Date dataCancellazione; + + private Time oraCancellazione; + + private String ipAddress; + + private long id_noMlist; + + public NoMlistCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public NoMlistCR() {} + + public void setEmail(String newEmail) { + this.email = newEmail; + } + + public void setDataCancellazione(Date newDataCancellazione) { + this.dataCancellazione = newDataCancellazione; + } + + public void setOraCancellazione(Time newOraCancellazione) { + this.oraCancellazione = newOraCancellazione; + } + + public void setIpAddress(String newIpAddress) { + this.ipAddress = newIpAddress; + } + + public String getEmail() { + return (this.email == null) ? "" : this.email.trim(); + } + + public Date getDataCancellazione() { + return this.dataCancellazione; + } + + public Time getOraCancellazione() { + return this.oraCancellazione; + } + + public String getIpAddress() { + return (this.ipAddress == null) ? "" : this.ipAddress.trim(); + } + + public long getId_noMlist() { + return this.id_noMlist; + } + + public void setId_noMlist(long newId_noMlist) { + this.id_noMlist = newId_noMlist; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/TemplateMsg.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/TemplateMsg.java new file mode 100644 index 00000000..a47714a4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/TemplateMsg.java @@ -0,0 +1,317 @@ +package it.acxent.newsletter; + +import it.acxent.contab._ContabAdapter; +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Time; +import java.util.Calendar; +import java.util.Hashtable; + +public class TemplateMsg extends _ContabAdapter implements Serializable, AddImgInterface { + private long id_templateMsg; + + private String descrizione; + + private long flgTipo; + + private String testoMessaggio; + + private String imgTmst; + + private String oggettoEmail; + + private Hashtable nameParms; + + public TemplateMsg(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TemplateMsg() {} + + public void setId_templateMsg(long newId_templateMsg) { + this.id_templateMsg = newId_templateMsg; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setFlgTipo(long newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public void setTestoMessaggio(String newMessaggio) { + this.testoMessaggio = newMessaggio; + } + + public long getId_templateMsg() { + return this.id_templateMsg; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public String getTestoMessaggio() { + return (this.testoMessaggio == null) ? "" : this.testoMessaggio.trim(); + } + + public String getTestoMessaggioWithParms() { + if (this.testoMessaggio == null) + return ""; + if (getNameParms().size() == 0) + return this.testoMessaggio.trim(); + return getTestoMessaggioConParametri(getTestoMessaggioConParametriGtLt(this.testoMessaggio)); + } + + protected void deleteCascade() { + for (int i = 1; i <= 4; i++) + new File(getDocBase() + getDocBase() + getPathImg()).delete(); + } + + public Vectumerator findByCR(TemplateMsgCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TEMPLATE_MSG AS A"; + String s_Sql_Order = " order by A.descrizione desc"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getFlgTipo() > 0L) + wc.addWc(" A.flgTipo = " + CR.getFlgTipo()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public static final String getTipo(long l_flgTipo) { + return CodaMessaggi.getTipo(l_flgTipo); + } + + public String getTipo() { + return CodaMessaggi.getTipo(getFlgTipo()); + } + + protected int getStringValueCase(String l_colomnName) { + return 0; + } + + public String getImgFileName(int imgNumber) { + return getImgFileName(imgNumber, getImgTmst()); + } + + public String getImgFileName(int imgNumber, String oldTmst) { + return "" + getId_templateMsg() + "_" + getId_templateMsg() + "_" + oldTmst + ".jpg"; + } + + public String getImgTmst() { + return (this.imgTmst == null) ? "" : this.imgTmst.trim(); + } + + public void setImgTmst(String imgTmst) { + this.imgTmst = imgTmst; + } + + public Vectumerator findAll(long l_flgTipo) { + String s_Sql_Find = "select A.* from TEMPLATE_MSG AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.flgTipo=" + l_flgTipo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getOggettoEmail() { + return (this.oggettoEmail == null) ? "" : this.oggettoEmail.trim(); + } + + public void setOggettoEmail(String oggettoEmail) { + this.oggettoEmail = oggettoEmail; + } + + public String getDescrizioneCompleta() { + return getTipo() + "-" + getTipo(); + } + + public ResParm addAllegato(AllegatoTemplateMsg row) { + AllegatoTemplateMsg bean = new AllegatoTemplateMsg(getApFull()); + bean.findByTemplateMsgNomeFile(row.getId_templateMsg(), row.getNomeFile()); + if (bean.getDBState() == 1) + return new ResParm(false, "Nome File Duplicato"); + row.setDBState(0); + ResParm rp = row.save(); + return rp; + } + + public ResParm delAllegato(AllegatoTemplateMsg row) { + AllegatoTemplateMsg bean = new AllegatoTemplateMsg(getApFull()); + bean.findByPrimaryKey(row.getId_allegatoTemplateMsg()); + return bean.delete(); + } + + public String getPathAllegato() { + return getDocBase() + getDocBase(); + } + + public Vectumerator getAllegati() { + return new AllegatoTemplateMsg(getApFull()).findByTemplateMsg(getId_templateMsg(), 0, 0); + } + + public String getMessaggioLinkAssoluti() { + String l_urlImg = getParm("CODA_MESSAGGI_IMG_URL_BASE").getTesto(); + String l_msg = getTestoMessaggio(); + int idx; + while ((idx = l_msg.indexOf("../")) >= 0) + l_msg = l_msg.substring(0, idx) + l_msg.substring(0, idx); + l_msg = l_msg.replaceAll("\"_img/_imgMsg", "\"" + l_urlImg + "_img/_imgMsg"); + l_msg = l_msg.replaceAll("\"/_img/_imgMsg", "\"" + l_urlImg + "_img/_imgMsg"); + l_msg = l_msg.replaceAll("href=\"/", "href=\"" + l_urlImg); + return l_msg; + } + + public String getTestoMessaggioScript() { + return DBAdapter.prepareScriptString(getTestoMessaggio(), true, false); + } + + public Hashtable getNameParms() { + if (this.nameParms == null) + this.nameParms = new Hashtable<>(); + return this.nameParms; + } + + public void resetNameParms() { + this.nameParms = null; + } + + private String getTestoMessaggioConParametri(String message) { + if (message != null) { + String s = message.toString(); + int currentIndex = 0; + String parmKey = ""; + String parm = ""; + int startIndex; + while ((startIndex = s.indexOf("<%=", currentIndex)) != -1) { + int endIndex = s.indexOf("%>", startIndex + 3); + parmKey = s.substring(startIndex + 3, endIndex).trim(); + if (getNameParms().containsKey(parmKey) && !getNameParms().get(parmKey).isEmpty()) { + parm = getNameParms().get(parmKey); + s = s.substring(0, startIndex) + s.substring(0, startIndex) + parm; + int i; + if ((i = s.indexOf("")) != -1) { + int endDelIndex = i + parmKey.length() + 8; + s = s.substring(0, i) + s.substring(0, i); + i = s.indexOf("", i); + endDelIndex = i + 8; + s = s.substring(0, i) + s.substring(0, i); + } + continue; + } + int startDelIndex; + if ((startDelIndex = s.indexOf("")) != -1) { + int endDelIndex = s.indexOf("", startIndex + 3); + s = s.substring(0, startDelIndex) + s.substring(0, startDelIndex); + continue; + } + parm = ""; + s = s.substring(0, startIndex) + s.substring(0, startIndex) + parm; + } + return s; + } + return null; + } + + private String getTestoMessaggioConParametriGtLt(String message) { + if (message != null) { + String s = message.toString(); + int currentIndex = 0; + String parmKey = ""; + String parm = ""; + int startIndex; + while ((startIndex = s.indexOf("<%=", currentIndex)) != -1) { + int endIndex = s.indexOf("%>", startIndex + 6); + parmKey = s.substring(startIndex + 6, endIndex).trim(); + if (getNameParms().containsKey(parmKey) && !getNameParms().get(parmKey).isEmpty()) { + parm = getNameParms().get(parmKey); + s = s.substring(0, startIndex) + s.substring(0, startIndex) + parm; + int i; + if ((i = s.indexOf("<ab:if " + parmKey + ">")) != -1) { + int endDelIndex = i + parmKey.length() + 11; + s = s.substring(0, i) + s.substring(0, i); + i = s.indexOf("</ab:if>", i); + endDelIndex = i + 11; + s = s.substring(0, i) + s.substring(0, i); + } + continue; + } + int startDelIndex; + if ((startDelIndex = s.indexOf("<ab:if " + parmKey + ">")) != -1) { + int endDelIndex = s.indexOf("</ab:if>", startIndex + 5); + s = s.substring(0, startDelIndex) + s.substring(0, startDelIndex); + continue; + } + parm = ""; + s = s.substring(0, startIndex) + s.substring(0, startIndex) + parm; + } + return s; + } + return null; + } + + public void setParmMsgString(String attributeName, String s) { + getNameParms().put(attributeName, s); + } + + public void setParmMsgString(String attributeName, StringBuffer s) { + setParmMsgString(attributeName, s.toString()); + } + + public void setParmMsgTime(String attributeName, Date d) { + if (d != null) { + Calendar cal = Calendar.getInstance(); + cal.setTime(d); + String temp = "" + cal.get(11) + ":" + cal.get(11); + setParmMsgString(attributeName, temp); + } + } + + public void setParmMsgTime(String attributeName, Time d) { + setParmMsgString(attributeName, getDataFormat().format(d)); + } + + public String getPathImg() { + return getParm("CODA_MESSAGGI_PATH_IMG_MSG").getTesto(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/TemplateMsgCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/TemplateMsgCR.java new file mode 100644 index 00000000..d90334e2 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/TemplateMsgCR.java @@ -0,0 +1,60 @@ +package it.acxent.newsletter; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TemplateMsgCR extends CRAdapter { + private long id_templateMsg; + + private String descrizione; + + private long flgTipo; + + private String messaggio; + + public TemplateMsgCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TemplateMsgCR() {} + + public void setId_templateMsg(long newId_templateMsg) { + this.id_templateMsg = newId_templateMsg; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setFlgTipo(long newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public void setMessaggio(String newMessaggio) { + this.messaggio = newMessaggio; + } + + public long getId_templateMsg() { + return this.id_templateMsg; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public String getMessaggio() { + return (this.messaggio == null) ? "" : this.messaggio.trim(); + } + + public static final String getTipo(long l_flgTipo) { + return CodaMessaggi.getTipo(l_flgTipo); + } + + public String getTipo() { + return CodaMessaggi.getTipo(getFlgTipo()); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/CodaMessaggiOpenMailSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/CodaMessaggiOpenMailSvlt.java new file mode 100644 index 00000000..ee6c83b4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/CodaMessaggiOpenMailSvlt.java @@ -0,0 +1,36 @@ +package it.acxent.newsletter.servlet; + +import it.acxent.newsletter.CodaMessaggi; +import it.acxent.servlet.GetFileSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/_img/_imgMsg/logo/*"}) +public class CodaMessaggiOpenMailSvlt extends GetFileSvlt { + protected String getFileName(HttpServletRequest req, HttpServletResponse res) { + String temp = req.getRequestURI(); + int idx1 = temp.lastIndexOf("_") + 1; + int idx2 = temp.lastIndexOf(".png"); + try { + long l_id = Long.parseLong(temp.substring(idx1, idx2)); + if (l_id > 0L) { + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + bean.findByPrimaryKey(l_id); + if (bean.getDBState() == 1) + CodaMessaggi.addLettura(bean, req.getRemoteAddr()); + } + } catch (Exception e) { + e.printStackTrace(); + } + return getDocBase() + "_img/_imgMsg/logo/logoMsg.png"; + } + + protected boolean checkProfile(HttpServletRequest req, HttpServletResponse res) { + return true; + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/MailNewsletterSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/MailNewsletterSvlt.java new file mode 100644 index 00000000..ec61c0a5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/MailNewsletterSvlt.java @@ -0,0 +1,54 @@ +package it.acxent.newsletter.servlet; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.newsletter.MailNewsletter; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class MailNewsletterSvlt extends AblServletSvlt { + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return null; + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return null; + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("delNewsletter")) { + String indirizzo = getRequestParameter(req, "ind"); + try { + MailNewsletter ml = new MailNewsletter(getApFull(req)); + ml.delIndirizzi(indirizzo); + RequestDispatcher rd = getServletContext() + .getRequestDispatcher("/mailNewsletter.jsp"); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e, 2); + } + } + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + showBean(req, res); + } + + protected void sqlActions(HttpServletRequest req, HttpServletResponse res) { + showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/NoMlistSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/NoMlistSvlt.java new file mode 100644 index 00000000..ce15f2d9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/NoMlistSvlt.java @@ -0,0 +1,104 @@ +package it.acxent.newsletter.servlet; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.newsletter.NoMlist; +import it.acxent.newsletter.NoMlistCR; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/NoMlist.abl"}) +public class NoMlistSvlt extends AblServletSvlt { + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new NoMlist(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new NoMlistCR(getApFull(req)); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + NoMlist.crittaEmail("acolzi@f3.com"); + String e1 = getRequestParameter(req, "e1"); + String e2 = getRequestParameter(req, "e2"); + String email = NoMlist.decrittaEmail(e1, e2); + try { + if (email == null) { + req.setAttribute("email", email); + sendMessage(req, "Errore!"); + RequestDispatcher rd = getServletContext().getRequestDispatcher("/mlistOk.jsp"); + rd.forward((ServletRequest)req, (ServletResponse)res); + } else { + NoMlist bean = new NoMlist(getApFull(req)); + bean.findByEmail(email); + if (bean.getId_noMlist() > 0L) { + sendMessage(req, "Email " + email + " già esclusa dalle mailing list!"); + } else { + bean.setEmail(email); + bean.setDataCancellazione(DBAdapter.getToday()); + bean.setOraCancellazione(DBAdapter.getNow()); + bean.setIpAddress(req.getRemoteAddr()); + ResParm rp = bean.save(); + if (rp.getStatus()) { + sendMessage(req, "Email " + email + " esclusa correttamente dalle mailing list!"); + } else { + sendMessage(req, "Errore! Impossibile salvare. Email " + email + " " + rp.getMsg()); + } + } + RequestDispatcher rd = getServletContext().getRequestDispatcher("/mlistOk.jsp"); + rd.forward((ServletRequest)req, (ServletResponse)res); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void _cancellaMail(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String email = getRequestParameter(req, "email"); + try { + if (email.isEmpty()) { + req.setAttribute("email", email); + sendMessage(req, "Errore!"); + RequestDispatcher rd = getServletContext().getRequestDispatcher("/mlistOk.jsp"); + rd.forward((ServletRequest)req, (ServletResponse)res); + } else { + NoMlist bean = new NoMlist(apFull); + bean.findByEmail(email); + if (bean.getId_noMlist() > 0L) { + sendMessage(req, "Email " + email + " già esclusa dalle mailing list!"); + } else { + bean.setEmail(email); + bean.setDataCancellazione(DBAdapter.getToday()); + bean.setOraCancellazione(DBAdapter.getNow()); + bean.setIpAddress(req.getRemoteAddr()); + ResParm rp = bean.save(); + if (rp.getStatus()) { + sendMessage(req, "Email " + email + " esclusa correttamente dalle mailing list!"); + } else { + sendMessage(req, "Errore! Impossibile salvare. Email " + email + " " + rp.getMsg()); + } + } + RequestDispatcher rd = getServletContext().getRequestDispatcher("/mlistOk.jsp"); + rd.forward((ServletRequest)req, (ServletResponse)res); + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/ShowTemplateMsgWwwSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/ShowTemplateMsgWwwSvlt.java new file mode 100644 index 00000000..2ec2c695 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/ShowTemplateMsgWwwSvlt.java @@ -0,0 +1,37 @@ +package it.acxent.newsletter.servlet; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.newsletter.TemplateMsg; +import it.acxent.newsletter.TemplateMsgCR; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/ShowTemplateMsgWww.abl"}) +public class ShowTemplateMsgWwwSvlt extends AblServletSvlt { + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TemplateMsg(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TemplateMsgCR(getApFull(req)); + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + showBean(req, res); + } + + protected void sqlActions(HttpServletRequest req, HttpServletResponse res) { + showBean(req, res); + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/admin/CodaMessaggiSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/admin/CodaMessaggiSvlt.java new file mode 100644 index 00000000..bc3ecb94 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/admin/CodaMessaggiSvlt.java @@ -0,0 +1,420 @@ +package it.acxent.newsletter.servlet.admin; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.newsletter.AllegatoCodaMessaggi; +import it.acxent.newsletter.CodaMessaggi; +import it.acxent.newsletter.CodaMessaggiCR; +import it.acxent.newsletter.TemplateMsg; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.AbMessages; +import it.acxent.util.Vectumerator; +import java.io.File; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/newsletter/CodaMessaggi.abl"}) +public class CodaMessaggiSvlt extends AblServletSvlt { + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + CodaMessaggi bean = (CodaMessaggi)beanA; + req.setAttribute("listaTemplateMsg", new TemplateMsg( + getApFull(req)).findAll(bean.getFlgTipo())); + if (bean.getId_templateMsg() > 0L) + req.setAttribute("listaAllegatiTemplateMsg", bean.getTemplateMsg() + .getAllegati()); + req.setAttribute("listaAllegati", bean.getAllegati()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new CodaMessaggi(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new CodaMessaggiCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + req.setAttribute("bean", bean); + req.setAttribute("listaTemplateMsg", new TemplateMsg( + getApFull(req)).findAll(bean.getFlgTipo())); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + System.out.println(getCmd(req)); + super.otherCommands(req, res); + } + + protected String getAttachPath(HttpServletRequest req) { + return ((CodaMessaggi)getBean(req)).getPathImg(); + } + + protected boolean isLoadImageServlet() { + return true; + } + + protected ResParm afterImgFileSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + CodaMessaggi bean = (CodaMessaggi)beanA; + String oldImgTmst = bean.getImgTmst(); + ResParm rp = super.afterImgFileSave(bean, req, res); + String temp = bean.getTestoMessaggio(); + long l_totImgNumber = getRequestLongParameter(req, "totImgNumber"); + if (l_totImgNumber == 0L) + l_totImgNumber = 4L; + for (int i = 1; (long)i <= l_totImgNumber; i++) + temp = temp.replaceAll(bean.getImgFileName(i, oldImgTmst), + bean.getImgFileName(i)); + bean.setTestoMessaggio(temp); + rp.append(bean.save()); + return rp; + } + + protected ResParm creaFileAllegato(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + synchronized (this) { + ResParm rp = new ResParm(true, ""); + CodaMessaggi bean = (CodaMessaggi)beanA; + String targetDir = bean.getPathAllegato(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + "/" + targetDir + "_"; + Vectumerator completeFileNames = (Vectumerator) + req.getAttribute("completeAttachName"); + Vectumerator fileNames = (Vectumerator) + req.getAttribute("attachName"); + if (completeFileNames.hasMoreElements()) { + String sourceFile = (String)completeFileNames.nextElement(); + String fileName = (String)fileNames.elementAt(0); + targetFile = targetFile + targetFile; + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + } + return rp; + } + } + + public void _inviaMsg(HttpServletRequest req, HttpServletResponse res) { + long l_id = getRequestLongParameter(req, "id_codaMessaggi"); + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + bean.findByPrimaryKey(l_id); + ResParm rp = new ResParm(true); + req.setAttribute("id_codaMessaggi", + String.valueOf(bean.getId_codaMessaggi())); + if (bean.getDBState() == 1) { + CodaMessaggiCR CR = new CodaMessaggiCR(getApFull(req)); + CR.setId_codaMessaggiS(bean.getId_codaMessaggi()); + rp = bean.inviaMessaggiAll(CR); + sendMessage(req, rp.getMsg()); + } else { + rp.setStatus(false); + rp.setMsg("Errore!. Impossibile inviare messaggio nullo"); + } + if (rp.getStatus()) { + sendMessage(req, "Invio messaggio avvenuto con successo"); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } + + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + CodaMessaggi bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_codaMessaggi"); + bean = new CodaMessaggi(getApFull(req)); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + l_id = bean.getId_codaMessaggi(); + req.setAttribute("id_codaMessaggi", String.valueOf(l_id)); + req.setAttribute("bean", bean); + if (rp.getStatus() == true) { + if (getAct(req).equals("addAllegato")) { + AllegatoCodaMessaggi row = new AllegatoCodaMessaggi( + getApFull(req)); + fillObject(req, row); + rp = bean.addAllegato(row); + rp.append(creaFileAllegato(bean, req, res)); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delAllegato")) { + AllegatoCodaMessaggi row = new AllegatoCodaMessaggi( + getApFull(req)); + fillObject(req, row); + rp = bean.delAllegato(row); + sendMessage(req, + + AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Allegato Cancellato"); + showBean(req, res); + } + } else { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, + AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + public void _inviaMsgAll(HttpServletRequest req, HttpServletResponse res) { + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + CodaMessaggiCR CR = new CodaMessaggiCR(getApFull(req)); + fillObject(req, CR); + ResParm rp = new ResParm(true); + rp = bean.inviaMessaggiAll(CR); + sendMessage(req, rp.getMsg()); + if (getCmd(req).equals("inviaMsgD")) { + showBean(req, res); + } else { + search(req, res); + } + } + + public void _delMsgInviati(HttpServletRequest req, HttpServletResponse res) { + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + CodaMessaggiCR CR = new CodaMessaggiCR(getApFull(req)); + CR.setFlgStatoInvio(1L); + ResParm rp = bean.cancellazioneMassiva(CR); + forceMessage(req, rp.getMsg()); + search(req, res); + } + + public void _delMsgCR(HttpServletRequest req, HttpServletResponse res) { + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + CodaMessaggiCR CR = new CodaMessaggiCR(getApFull(req)); + fillObject(req, CR); + ResParm rp = bean.cancellazioneMassiva(CR); + forceMessage(req, rp.getMsg()); + search(req, res); + } + + public void _useTemplate(HttpServletRequest req, HttpServletResponse res) { + long l_id = getRequestLongParameter(req, "id_codaMessaggi"); + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + long l_id_templateMsg = getRequestLongParameter(req, "id_templateMsg"); + TemplateMsg ts = new TemplateMsg(getApFull(req)); + ts.findByPrimaryKey(l_id_templateMsg); + ResParm rp = bean.useTemplate(ts, true); + if (rp.getStatus()) { + sendMessage(req, "Template Messaggio associato correttamente."); + } else { + sendMessage(req, "ERRORE!. Impossibile associare template: " + + rp.getMsg()); + } + req.setAttribute("id_codaMessaggi", + String.valueOf(bean.getId_codaMessaggi())); + req.setAttribute("lastUpdTmst", bean.getLastUpdTmst() + .toString()); + showBean(req, res); + } + + public void _msgInCoda(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("inviaMsgD") || getCmd(req).equals("inviaMsg")) { + long l_id = getRequestLongParameter(req, "id_codaMessaggi"); + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + bean.findByPrimaryKey(l_id); + ResParm rp = new ResParm(true); + if (getCmd(req).equals("inviaMsgD")) { + fillObject(req, bean); + bean.save(); + } + req.setAttribute("id_codaMessaggi", + String.valueOf(bean.getId_codaMessaggi())); + if (bean.getDBState() == 1) { + CodaMessaggiCR CR = new CodaMessaggiCR(getApFull(req)); + CR.setId_codaMessaggiS(bean.getId_codaMessaggi()); + rp = bean.inviaMessaggiAll(CR); + sendMessage(req, rp.getMsg()); + } else { + rp.setStatus(false); + rp.setMsg("Errore!. Impossibile inviare messaggio nullo"); + } + if (rp.getStatus()) { + sendMessage(req, "Invio messaggio avvenuto con successo"); + } else { + sendMessage(req, rp.getMsg()); + } + if (getCmd(req).equals("inviaMsgD")) { + showBean(req, res); + } else { + search(req, res); + } + } else if (getCmd(req).equals("inviaMsgAll")) { + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + CodaMessaggiCR CR = new CodaMessaggiCR(getApFull(req)); + fillObject(req, CR); + ResParm rp = new ResParm(true); + rp = bean.inviaMessaggiAll(CR); + if (rp.getStatus()) { + sendMessage(req, "Messaggi in invio.......... "); + } else { + sendMessage(req, rp.getMsg()); + } + if (getCmd(req).equals("inviaMsgD")) { + showBean(req, res); + } else { + search(req, res); + } + } else if (getCmd(req).equals("delMsgInviati")) { + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + CodaMessaggiCR CR = new CodaMessaggiCR(getApFull(req)); + CR.setFlgStatoInvio(1L); + ResParm rp = bean.cancellazioneMassiva(CR); + forceMessage(req, rp.getMsg()); + search(req, res); + } else if (getCmd(req).equals("delMsgCR")) { + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + CodaMessaggiCR CR = new CodaMessaggiCR(getApFull(req)); + fillObject(req, CR); + ResParm rp = bean.cancellazioneMassiva(CR); + sendMessage(req, rp.getMsg()); + search(req, res); + } else if (getCmd(req).equals("useTemplate")) { + long l_id = getRequestLongParameter(req, "id_codaMessaggi"); + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + long l_id_templateMsg = getRequestLongParameter(req, "id_templateMsg"); + TemplateMsg ts = new TemplateMsg(getApFull(req)); + ts.findByPrimaryKey(l_id_templateMsg); + ResParm rp = bean.useTemplate(ts, true); + if (rp.getStatus()) { + sendMessage(req, "Template Messaggio associato correttamente."); + } else { + sendMessage(req, "ERRORE!. Impossibile associare template: " + + rp.getMsg()); + } + req.setAttribute("id_codaMessaggi", + String.valueOf(bean.getId_codaMessaggi())); + req.setAttribute("lastUpdTmst", bean.getLastUpdTmst() + .toString()); + showBean(req, res); + } else if (getCmd(req).equals("detachTemplate")) { + long l_id = getRequestLongParameter(req, "id_codaMessaggi"); + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + long imgNum = getRequestLongParameter(req, "imgNum"); + if (imgNum == 0L) + imgNum = 4L; + ResParm rp = bean.detachTemplate((int)imgNum); + if (rp.getStatus()) { + sendMessage(req, "Template Messaggio disassociato correttamente."); + } else { + sendMessage(req, "ERRORE!. Impossibile disassociare template: " + + rp.getMsg()); + } + req.setAttribute("id_codaMessaggi", + String.valueOf(bean.getId_codaMessaggi())); + showBean(req, res); + } else if (getCmd(req).equals("msgInCoda")) { + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + ResParm rp = bean.updateStatoMessaggi(2L, 0L); + if (rp.getStatus()) { + sendMessage(req, "Stati aggiornati correttamente."); + } else { + sendMessage(req, "ERRORE!. Impossibile aggiornare stato del messaggio: " + + + rp.getMsg()); + } + search(req, res); + } else { + super.otherCommands(req, res); + } + } + + public void _detachTemplate(HttpServletRequest req, HttpServletResponse res) { + long l_id = getRequestLongParameter(req, "id_codaMessaggi"); + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + long imgNum = getRequestLongParameter(req, "imgNum"); + if (imgNum == 0L) + imgNum = 4L; + ResParm rp = bean.detachTemplate((int)imgNum); + if (rp.getStatus()) { + sendMessage(req, "Template Messaggio disassociato correttamente."); + } else { + sendMessage(req, "ERRORE!. Impossibile disassociare template: " + + rp.getMsg()); + } + req.setAttribute("id_codaMessaggi", + String.valueOf(bean.getId_codaMessaggi())); + showBean(req, res); + } + + public void _inviaMsgD(HttpServletRequest req, HttpServletResponse res) { + long l_id = getRequestLongParameter(req, "id_codaMessaggi"); + CodaMessaggi bean = new CodaMessaggi(getApFull(req)); + bean.findByPrimaryKey(l_id); + ResParm rp = new ResParm(true); + fillObject(req, bean); + bean.save(); + req.setAttribute("id_codaMessaggi", + String.valueOf(bean.getId_codaMessaggi())); + if (bean.getDBState() == 1) { + CodaMessaggiCR CR = new CodaMessaggiCR(getApFull(req)); + CR.setId_codaMessaggiS(bean.getId_codaMessaggi()); + rp = bean.inviaMessaggiAll(CR); + sendMessage(req, rp.getMsg()); + } else { + rp.setStatus(false); + rp.setMsg("Errore!. Impossibile inviare messaggio nullo"); + } + if (rp.getStatus()) { + sendMessage(req, "Invio messaggio avvenuto con successo"); + } else { + sendMessage(req, rp.getMsg()); + } + showBean(req, res); + } + + public void _addAllegato(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CodaMessaggi bean = new CodaMessaggi(apFull); + long l_id = getRequestLongParameter(req, "id_codaMessaggi"); + bean.findByPrimaryKey(l_id); + String fileName = getRequestParameter(req, "fileNameOnServer_1"); + String targetDir = bean.getPathAllegato(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + "/" + targetDir + "_" + bean.getId_codaMessaggi(); + String sourceFile = getPathTmpFull() + getPathTmpFull(); + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + AllegatoCodaMessaggi row = new AllegatoCodaMessaggi(apFull); + fillObject(req, row); + row.setNomeFile(fileName); + ResParm rp = bean.addAllegato(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _delAllegato(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + CodaMessaggi bean = new CodaMessaggi(apFull); + long l_id = getRequestLongParameter(req, "id_codaMessaggi"); + bean.findByPrimaryKey(l_id); + AllegatoCodaMessaggi row = new AllegatoCodaMessaggi(apFull); + fillObject(req, row); + bean.delAllegato(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Allegato Cancellato"); + showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/admin/MailNewsletterSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/admin/MailNewsletterSvlt.java new file mode 100644 index 00000000..9f21b5cf --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/admin/MailNewsletterSvlt.java @@ -0,0 +1,110 @@ +package it.acxent.newsletter.servlet.admin; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.newsletter.CodaMessaggi; +import it.acxent.newsletter.MailNewsletter; +import it.acxent.newsletter.MailNewsletterCR; +import it.acxent.newsletter.TemplateMsg; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.AbMessages; +import it.acxent.util.Vectumerator; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/newsletter/MailNewsletter.abl"}) +public class MailNewsletterSvlt extends AblServletSvlt { + private static final long serialVersionUID = -7017882231079147417L; + + public void _cancGo(HttpServletRequest req, HttpServletResponse res) { + MailNewsletter ml = new MailNewsletter(getApFull(req)); + String indirizzi = getRequestParameter(req, "indirizzi"); + ml.delIndirizzi(indirizzi); + search(req, res); + } + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaTemplateMsg", new TemplateMsg(getApFull(req)) + .findAll(1L)); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new MailNewsletter(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new MailNewsletterCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + search(req, res); + } + + protected void manageMultipartRequest(HttpServletRequest req, HttpServletResponse res) { + int LIMIT = 148000; + String[] fileNameTypes = { + "txt", "xls", "ods", "mdb", "xml", "pdf", "odt", "doc", "html", "zip", + "csv" }; + String targetDir = getPathTmpFull(); + String[] fileNameParameters = { "fileName" }; + try { + if (manageMultipartRequestParameters(req, LIMIT, fileNameParameters, null, fileNameTypes, targetDir)) { + processNoEncTypeRequest(req, res); + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "MR_FILE_ERROR")); + search(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + public void _delNewsletter(HttpServletRequest req, HttpServletResponse res) { + MailNewsletter ml = new MailNewsletter(getApFull(req)); + String indirizzo = getRequestParameter(req, "ind"); + ml.delIndirizzi(indirizzo); + search(req, res); + } + + public void _impUtenti(HttpServletRequest req, HttpServletResponse res) { + MailNewsletter ml = new MailNewsletter(getApFull(req)); + ml.impUtenti(); + search(req, res); + } + + public void _impGo(HttpServletRequest req, HttpServletResponse res) { + if (!MailNewsletter.threadAddMailsFromFile) { + MailNewsletter ml = new MailNewsletter(getApFull(req)); + Vectumerator fn = (Vectumerator) + req.getAttribute("completeAttachName"); + String fileName = (String)fn.nextElement(); + ResParm rp = ml.addIndirizzi(fileName); + forceMessage(req, rp.getMsg()); + } else { + forceMessage(req, "ATTENZIONE!! Thread inserimento indirizzi ancora in esecuzione!!!"); + } + search(req, res); + } + + public void _creaCodaMail(HttpServletRequest req, HttpServletResponse res) { + MailNewsletter ml = new MailNewsletter(getApFull(req)); + MailNewsletterCR CR = new MailNewsletterCR(getApFull(req)); + fillObject(req, CR); + ResParm rp = new CodaMessaggi(getApFull(req)).creaCodaMessaggi(CR, + getRequestLongParameter(req, "id_templateMsg")); + forceMessage(req, rp.getMsg()); + search(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/admin/NoMlistSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/admin/NoMlistSvlt.java new file mode 100644 index 00000000..e87507a0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/admin/NoMlistSvlt.java @@ -0,0 +1,100 @@ +package it.acxent.newsletter.servlet.admin; + +import com.google.gson.Gson; +import it.acxent.common.JsonUploadFileResponse; +import it.acxent.common.Users; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.jsp.Ab; +import it.acxent.newsletter.NoMlist; +import it.acxent.newsletter.NoMlistCR; +import it.acxent.servlet.AblServletSvlt; +import java.io.File; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/newsletter//NoMlist.abl"}) +public class NoMlistSvlt extends AblServletSvlt { + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new NoMlist(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new NoMlistCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + super.otherCommands(req, res); + } + + public void _saveFile(HttpServletRequest req, HttpServletResponse res) { + try { + ApplParmFull apFull = getApFull(req); + Users utente = new Users(apFull); + long l_id_users = getLoginUserId(req); + utente.findByPrimaryKey(l_id_users); + if (utente.getId_users() > 0L) { + HashMap uploadedImages = (HashMap)req.getAttribute("_UFN"); + String currentFullFileName = "", currentFileName = ""; + if (!uploadedImages.isEmpty()) { + Iterator> iterator = uploadedImages.entrySet().iterator(); + if (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + currentFullFileName = entry.getValue(); + currentFileName = entry.getKey(); + } + } + if (!currentFullFileName.isEmpty()) + synchronized (this) { + String targetDir = getPathTmpFull(); + String newFileName = "" + utente.getId_users() + "_" + utente.getId_users() + "_" + getTimeNameForFileUpload(); + File cfn = new File(currentFullFileName); + File newFile = new File(targetDir + targetDir); + cfn.renameTo(newFile); + cfn = null; + newFile = null; + Gson gson = new Gson(); + if (newFileName.endsWith(".txt")) { + String fileElaborato = new NoMlist(apFull).elaboraEPulisci(targetDir + targetDir); + String fileElaboratoName = fileElaborato.replace(targetDir, ""); + sendHtmlMsgResponse(req, res, "[" + + gson.toJson(new JsonUploadFileResponse(true, + Ab.formatBeanMsg("File " + currentFileName + " Elaborato correttamente", ""), fileElaboratoName, "../../" + + + getPathImg(req) + fileElaboratoName)) + "]"); + } else { + sendHtmlMsgResponse(req, res, "[" + + + gson.toJson(new JsonUploadFileResponse(true, + Ab.formatBeanMsg("Mandami un txt bischero", ""), "", "to")) + "]"); + } + } + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + callJsp(req, res); + } + + public void _elaboraMlist(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long id_clifor = getRequestLongParameter(req, "id_clifor"); + if (id_clifor == 0L) + sendMessage(req, "ERRORE! Cliente non impostato"); + search(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/admin/TemplateMsgSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/admin/TemplateMsgSvlt.java new file mode 100644 index 00000000..4bb6a9e1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/servlet/admin/TemplateMsgSvlt.java @@ -0,0 +1,205 @@ +package it.acxent.newsletter.servlet.admin; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.newsletter.AllegatoTemplateMsg; +import it.acxent.newsletter.CodaMessaggi; +import it.acxent.newsletter.TemplateMsg; +import it.acxent.newsletter.TemplateMsgCR; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.AbMessages; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/newsletter/TemplateMsg.abl"}) +public class TemplateMsgSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + TemplateMsg bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_templateMsg"); + bean = new TemplateMsg(getApFull(req)); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + l_id = bean.getId_templateMsg(); + req.setAttribute("id_templateMsg", String.valueOf(l_id)); + req.setAttribute("bean", bean); + if (rp.getStatus() == true) { + if (getAct(req).equals("addAllegato")) { + AllegatoTemplateMsg row = new AllegatoTemplateMsg(getApFull(req)); + fillObject(req, row); + rp = bean.addAllegato(row); + rp.append(creaFileAllegato(bean, req, res)); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delAllegato")) { + AllegatoTemplateMsg row = new AllegatoTemplateMsg(getApFull(req)); + fillObject(req, row); + rp = bean.delAllegato(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Allegato Cancellato"); + showBean(req, res); + } + } else { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + TemplateMsg bean = (TemplateMsg)beanA; + req.setAttribute("listaAllegati", bean.getAllegati()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TemplateMsg(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TemplateMsgCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + TemplateMsg bean = new TemplateMsg(getApFull(req)); + bean.setFlgTipo(1L); + req.setAttribute("bean", bean); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + super.otherCommands(req, res); + } + + protected boolean isLoadImageServlet() { + return true; + } + + protected String getAttachPath(HttpServletRequest req) { + return ((TemplateMsg)getBean(req)).getPathImg(); + } + + protected ResParm afterImgFileSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + TemplateMsg bean = (TemplateMsg)beanA; + String oldImgTmst = bean.getImgTmst(); + ResParm rp = super.afterImgFileSave(bean, req, res); + String temp = bean.getTestoMessaggio(); + long l_totImgNumber = getRequestLongParameter(req, "totImgNumber"); + if (l_totImgNumber == 0L) + l_totImgNumber = 4L; + for (int i = 1; (long)i <= l_totImgNumber; i++) + temp = temp.replaceAll(bean.getImgFileName(i, oldImgTmst), bean.getImgFileName(i)); + bean.setTestoMessaggio(temp); + rp.append(bean.save()); + return rp; + } + + public void _creaCodaMsg(HttpServletRequest req, HttpServletResponse res) { + long l_id_templateMsg = getRequestLongParameter(req, "id_templateMsg"); + TemplateMsg ts = new TemplateMsg(getApFull(req)); + ts.findByPrimaryKey(l_id_templateMsg); + String targetDir = getPathTmpFull(); + String targetFile = targetDir + "creaCodaMsg_" + targetDir + "_" + getTimeNameForFileUpload() + ".txt"; + HashMap uploadedFiles = (HashMap)req.getAttribute("_UFN"); + if (!uploadedFiles.isEmpty()) { + Iterator> iterator = uploadedFiles.entrySet().iterator(); + if (iterator.hasNext()) { + Map.Entry entry = iterator.next(); + String sourceFile = entry.getValue(); + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + } + } + CodaMessaggi cm = new CodaMessaggi(getApFull(req)); + ResParm rp = cm.creaCodaMessaggi(ts, targetFile); + forceMessage(req, rp.getMsg()); + showBean(req, res); + } + + protected ResParm creaFileAllegato(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + synchronized (this) { + ResParm rp = new ResParm(true, ""); + TemplateMsg bean = (TemplateMsg)beanA; + String targetDir = bean.getPathAllegato(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + "/" + targetDir + "_"; + Vectumerator completeFileNames = (Vectumerator)req.getAttribute("completeAttachName"); + Vectumerator fileNames = (Vectumerator)req.getAttribute("attachName"); + if (completeFileNames.hasMoreElements()) { + String sourceFile = (String)completeFileNames.nextElement(); + String fileName = (String)fileNames.elementAt(0); + targetFile = targetFile + targetFile; + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + } + return rp; + } + } + + public void _addAllegato(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + TemplateMsg bean = new TemplateMsg(apFull); + long l_id = getRequestLongParameter(req, "id_templateMsg"); + bean.findByPrimaryKey(l_id); + String fileName = getRequestParameter(req, "fileNameOnServer_1"); + String targetDir = bean.getPathAllegato(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + "/" + targetDir + "_" + bean.getId_templateMsg(); + String sourceFile = getPathTmpFull() + getPathTmpFull(); + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + AllegatoTemplateMsg row = new AllegatoTemplateMsg(apFull); + fillObject(req, row); + row.setNomeFile(fileName); + ResParm rp = bean.addAllegato(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _delAllegato(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + TemplateMsg bean = new TemplateMsg(apFull); + long l_id = getRequestLongParameter(req, "id_templateMsg"); + bean.findByPrimaryKey(l_id); + AllegatoTemplateMsg row = new AllegatoTemplateMsg(apFull); + fillObject(req, row); + bean.delAllegato(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Allegato Cancellato"); + showBean(req, res); + } + + public void _creaCodaMsgLte(HttpServletRequest req, HttpServletResponse res) { + long l_id_templateMsg = getRequestLongParameter(req, "id_templateMsg"); + TemplateMsg ts = new TemplateMsg(getApFull(req)); + ts.findByPrimaryKey(l_id_templateMsg); + String fileName = getRequestParameter(req, "fileNameOnServer_99"); + String fullMlFIle = getPathTmpFull() + getPathTmpFull(); + CodaMessaggi cm = new CodaMessaggi(getApFull(req)); + ResParm rp = cm.creaCodaMessaggi(ts, fullMlFIle); + forceMessage(req, rp.getMsg()); + showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/RemoteDevice.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/RemoteDevice.java new file mode 100644 index 00000000..23368bf3 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/RemoteDevice.java @@ -0,0 +1,398 @@ +package it.acxent.rd; + +import com.google.zxing.BarcodeFormat; +import com.google.zxing.EncodeHintType; +import com.google.zxing.client.j2se.MatrixToImageWriter; +import com.google.zxing.common.BitMatrix; +import com.google.zxing.qrcode.QRCodeWriter; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.RandomString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.EnumMap; +import java.util.Map; +import javax.imageio.ImageIO; +import org.json.JSONObject; + +public class RemoteDevice extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1636646748813L; + + public static final String P_RD_API_LOGIN = "RD_API_LOGIN"; + + public static final String P_RD_API_PWD = "RD_API_PWD"; + + public static final String P_RD_API_SERVER = "RD_API_SERVER"; + + public static final String P_RD_TEST_SMS = "RD_TEST_SMS"; + + private long id_remoteDevice; + + private String descrizione; + + private String token; + + private String imei; + + private String ipAddress; + + private Timestamp updTmst; + + private String tokenOld; + + private String fcmToken; + + private long flgAbilitato; + + public static final String SMSGATEWAY_PROJECT_ID = "smsgateway-f05ec"; + + public RemoteDevice(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RemoteDevice() {} + + private String getQrTokenString() { + JSONObject jo = new JSONObject(); + jo.put("uri", getRemoteDeviceApiServer()); + jo.put("token", getToken()); + return jo.toString(); + } + + public String getRemoteDeviceApiServer() { + return getParm("RD_API_SERVER").getTesto(); + } + + public String getRemoteDeviceTestSms() { + return getParm("RD_TEST_SMS").getTesto(); + } + + public void setId_remoteDevice(long newId_remoteDevice) { + this.id_remoteDevice = newId_remoteDevice; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setToken(String newToken) { + this.token = newToken; + } + + public void setImei(String newImei) { + this.imei = newImei; + } + + public void setIpAddress(String newIpAddress) { + this.ipAddress = newIpAddress; + } + + public void setUpdTmst(Timestamp newUpdTmst) { + this.updTmst = newUpdTmst; + } + + public long getId_remoteDevice() { + return this.id_remoteDevice; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getToken() { + return (this.token == null) ? "" : this.token.trim(); + } + + public String getImei() { + return (this.imei == null) ? "" : this.imei.trim(); + } + + public String getIpAddress() { + return (this.ipAddress == null) ? "" : this.ipAddress.trim(); + } + + public Timestamp getUpdTmst() { + return this.updTmst; + } + + public String getUpdTmstS() { + return (this.updTmst == null) ? "" : this.updTmst.toString(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(RemoteDeviceCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from REMOTE_DEVICE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getQRCodeTokenFullFileName() { + if (getId_remoteDevice() > 0L) { + String targetdir = getDocBase() + "admin/rd/_qr/"; + File fileTd = new File(targetdir); + if (!fileTd.exists()) + fileTd.mkdirs(); + return targetdir + targetdir; + } + return ""; + } + + public String getQRCodeTokenFileName() { + if (getId_remoteDevice() > 0L) + return "token_" + getId_remoteDevice() + "_" + getImgTmst() + ".jpg"; + return ""; + } + + public ResParm generaNuovoToken() { + long l_id = getId_remoteDevice(); + ResParm rp = new ResParm(); + if (l_id > 0L) { + new File(getQRCodeTokenFullFileName()).delete(); + setImgTmst(getTimeNameForFileUpload()); + super.save(); + String fileName = getQRCodeTokenFullFileName(); + if (new File(fileName).exists()); + RandomString randomString = new RandomString(256); + String token = randomString.nextString(); + setToken(token); + rp = super.save(); + if (rp.getStatus()) + rp = creaQrCodeTokenFile(fileName, getQrTokenString(), 600); + } else { + rp.setStatus(false); + rp.setMsg("Salvare il record prima di generare il token"); + } + return rp; + } + + public ResParm creaQrCodeTokenFile(String fileName, String qrmsg, int size) { + ResParm rp = new ResParm(true); + if (new File(fileName).exists()); + try { + QRCodeWriter writer = new QRCodeWriter(); + Map hints = new EnumMap<>(EncodeHintType.class); + hints.put(EncodeHintType.CHARACTER_SET, "UTF-8"); + hints.put(EncodeHintType.MARGIN, Integer.valueOf(0)); + if (size <= 0) + size = 600; + BitMatrix matrix = writer.encode(qrmsg, BarcodeFormat.QR_CODE, size, size, hints); + BufferedImage image = MatrixToImageWriter.toBufferedImage(matrix); + ImageIO.write(image, "JPEG", new File(fileName)); + } catch (Exception e) { + e.printStackTrace(); + rp.setException(e); + } + return rp; + } + + protected void initFields() { + super.initFields(); + this.tokenOld = ""; + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + this.tokenOld = getToken(); + } + + public ResParm save() { + String l_tokenOld = this.tokenOld; + if (l_tokenOld != null && + !l_tokenOld.equals(getToken())) { + new File(getQRCodeTokenFullFileName()).delete(); + setImgTmst(getTimeNameForFileUpload()); + } + ResParm rp = super.save(); + if (rp.getStatus() && + l_tokenOld != null && + !l_tokenOld.equals(getToken())) + rp.append(creaQrCodeTokenFile(getQRCodeTokenFullFileName(), getQrTokenString(), 600)); + return rp; + } + + public Vectumerator findAvailable() { + String s_Sql_Find = "select A.* from REMOTE_DEVICE AS A"; + String s_Sql_Order = " order by A.updTmst desc"; + WcString wc = new WcString(); + wc.addWc("A.updTmst is not null"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findFirstAvailable() { + String s_Sql_Find = "select A.* from REMOTE_DEVICE AS A"; + String s_Sql_Order = " order by A.updTmst desc"; + WcString wc = new WcString(); + wc.addWc("A.updTmst is not null"); + wc.addWc("A.flgAbilitato=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public void findByToken(String l_token) { + String s_Sql_Find = "select A.* from REMOTE_DEVICE AS A"; + String s_Sql_Order = " order by A.updTmst desc"; + WcString wc = new WcString(); + wc.addWc("A.token='" + l_token + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public static void initApplicationParms(ApplParmFull ap) { + boolean debug = false; + if (ap != null) { + DBAdapter.logDebug(debug, "RemoteDevice initParms: start"); + String l_tipoParm = ""; + Parm bean = new Parm(ap); + l_tipoParm = "REMOTE DEVICE"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("RD_API_LOGIN"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("RD_API_LOGIN"); + bean.setDescrizione("RD_API_LOGIN"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("login"); + bean.setNota("LOGIN DI SCAMBIO TRA DEVICE E SERVER"); + bean.save(); + bean.findByCodice("RD_API_PWD"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("RD_API_PWD"); + bean.setDescrizione("RD_API_PWD"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("pwd"); + bean.setNota("PASSWORD DI SCAMBIO TRA DEVICE E SERVER"); + bean.save(); + bean.findByCodice("RD_API_SERVER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("RD_API_SERVER"); + bean.setDescrizione("RD_API_SERVER"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("http://10.10.0.50/cc/"); + bean.setNota("INDIRIZZO DEL SERVER DI REGISTRAZIONE DEI DEVICE
Es: http://10.10.0.50/cc/"); + bean.save(); + bean.findByCodice("RD_TEST_SMS"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("RD_TEST_SMS"); + bean.setDescrizione("RD_TEST_SMS"); + bean.setFlgTipo(0L); + bean.setNota("NUMERO CELLULARE DI TEST PER INVIO DI PROVA SMS
TUTTI I MESSAGGI VENGONO INVIATI A QUESTO CELLULARE"); + bean.save(); + bean.findByCodice("FIREBASE_SERVER_KEY"); + if (bean.getId_parm() > 0L) + bean.delete(); + bean.findByCodice("FIREBASE_JSON_AUTH_PRIVATE_KEY"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FIREBASE_JSON_AUTH_PRIVATE_KEY"); + bean.setDescrizione("FIREBASE_JSON_AUTH_PRIVATE_KEY"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("/Users/acolzi/Downloads/smsgateway-f05ec-firebase-adminsdk-uicut-dbc52f0758.json"); + bean.setNota("PERCORSO FULL AL FILE JSON CON LA CHIAVE DI AUTORIZZAZIONE DELLA APPLICAZIONE FIREBASE.
\"/Users/acolzi/Downloads/smsgateway-f05ec-firebase-adminsdk-uicut-dbc52f0758.json\""); + bean.save(); + DBAdapter.logDebug(debug, "RemoteDevice initParms: stop"); + StatusMsg.deleteMsgByTag(ap, "INIT"); + } + } + + public String getFcmToken() { + return (this.fcmToken == null) ? "" : this.fcmToken.trim(); + } + + public void setFcmToken(String fcmToken) { + this.fcmToken = fcmToken; + } + + public long getFlgAbilitato() { + return this.flgAbilitato; + } + + public void setFlgAbilitato(long flgAbilitato) { + this.flgAbilitato = flgAbilitato; + } + + public boolean isActive() { + if (getId_remoteDevice() == 0L || getFlgAbilitato() == 0L || getToken().isEmpty() || getFcmToken().isEmpty()) + return false; + return true; + } + + public boolean hasDeviceActive() { + String s_Sql_Find = "select A.* from REMOTE_DEVICE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.flgAbilitato=1"); + wc.addWc("A.token<>''"); + wc.addWc("A.fcmToken<>''"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt, 1, 1); + if (vec.hasMoreElements()) + return true; + return false; + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return false; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/RemoteDeviceCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/RemoteDeviceCR.java new file mode 100644 index 00000000..663f5246 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/RemoteDeviceCR.java @@ -0,0 +1,85 @@ +package it.acxent.rd; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Timestamp; + +public class RemoteDeviceCR extends CRAdapter { + private static final long serialVersionUID = 2234878834967039209L; + + private long id_remoteDevice; + + private String descrizione; + + private String token; + + private String imei; + + private String ipAddress; + + private Timestamp updTmst; + + private long flgAbilitato = -1L; + + public RemoteDeviceCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RemoteDeviceCR() {} + + public void setId_remoteDevice(long newId_remoteDevice) { + this.id_remoteDevice = newId_remoteDevice; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setToken(String newToken) { + this.token = newToken; + } + + public void setImei(String newImei) { + this.imei = newImei; + } + + public void setIpAddress(String newIpAddress) { + this.ipAddress = newIpAddress; + } + + public void setUpdTmst(Timestamp newUpdTmst) { + this.updTmst = newUpdTmst; + } + + public long getId_remoteDevice() { + return this.id_remoteDevice; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getToken() { + return (this.token == null) ? "" : this.token.trim(); + } + + public String getImei() { + return (this.imei == null) ? "" : this.imei.trim(); + } + + public String getIpAddress() { + return (this.ipAddress == null) ? "" : this.ipAddress.trim(); + } + + public Timestamp getUpdTmst() { + return this.updTmst; + } + + public long getFlgAbilitato() { + return this.flgAbilitato; + } + + public void setFlgAbilitato(long flgAbilitato) { + this.flgAbilitato = flgAbilitato; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/RdRequestJ.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/RdRequestJ.java new file mode 100644 index 00000000..7f533406 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/RdRequestJ.java @@ -0,0 +1,43 @@ +package it.acxent.rd.json; + +public class RdRequestJ { + private String token; + + private String fcmToken; + + private String imei; + + private String act; + + public String getToken() { + return this.token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getFcmToken() { + return this.fcmToken; + } + + public void setFcmToken(String fcmToken) { + this.fcmToken = fcmToken; + } + + public String getImei() { + return this.imei; + } + + public void setImei(String imei) { + this.imei = imei; + } + + public String getAct() { + return this.act; + } + + public void setAct(String act) { + this.act = act; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/RdResponseJ.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/RdResponseJ.java new file mode 100644 index 00000000..29870007 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/RdResponseJ.java @@ -0,0 +1,48 @@ +package it.acxent.rd.json; + +public class RdResponseJ { + public static final long STATUS_ALTRO_ERRORE = 99L; + + public static final long STATUS_TOKEN_GIA_ASSEGNATO = 2L; + + public static final long STATUS_TOKEN_NON_TROVATO = 1L; + + public static final long STATUS_OK = 0L; + + private String msg; + + public RdResponseJ(long status, String msg) { + this.status = status; + this.msg = msg; + } + + private long status = 0L; + + private String appVersion; + + public RdResponseJ() {} + + public String getMsg() { + return this.msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public long getStatus() { + return this.status; + } + + public void setStatus(long status) { + this.status = status; + } + + public String getAppVersion() { + return this.appVersion; + } + + public void setAppVersion(String appVersion) { + this.appVersion = appVersion; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/package-info.java new file mode 100644 index 00000000..f904e861 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/package-info.java @@ -0,0 +1 @@ +package it.acxent.rd.json; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/smsgateway/DataSmsMsgJ.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/smsgateway/DataSmsMsgJ.java new file mode 100644 index 00000000..43d4eeaf --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/smsgateway/DataSmsMsgJ.java @@ -0,0 +1,53 @@ +package it.acxent.rd.json.smsgateway; + +public class DataSmsMsgJ { + private long id_codaMessaggi; + + private long flgTipo; + + private String cellulare; + + private String smsToTest; + + private String testoMessaggio; + + public long getId_codaMessaggi() { + return this.id_codaMessaggi; + } + + public void setId_codaMessaggi(long id_codaMessaggi) { + this.id_codaMessaggi = id_codaMessaggi; + } + + public String getCellulare() { + return this.cellulare; + } + + public void setCellulare(String cellulare) { + this.cellulare = cellulare; + } + + public String getTestoMessaggio() { + return this.testoMessaggio; + } + + public void setTestoMessaggio(String testoMessaggio) { + this.testoMessaggio = testoMessaggio; + } + + public String getSmsToTest() { + return this.smsToTest; + } + + public void setSmsToTest(String smsToTest) { + this.smsToTest = smsToTest; + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public void setFlgTipo(long flgTipo) { + this.flgTipo = flgTipo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/smsgateway/RdRequestSmsGatewayJ.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/smsgateway/RdRequestSmsGatewayJ.java new file mode 100644 index 00000000..9cb4f957 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/smsgateway/RdRequestSmsGatewayJ.java @@ -0,0 +1,16 @@ +package it.acxent.rd.json.smsgateway; + +import it.acxent.rd.json.RdRequestJ; +import java.util.Vector; + +public class RdRequestSmsGatewayJ extends RdRequestJ { + private Vector data; + + public Vector getData() { + return this.data; + } + + public void setData(Vector data) { + this.data = data; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/smsgateway/RdResponseSmsGatewayJ.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/smsgateway/RdResponseSmsGatewayJ.java new file mode 100644 index 00000000..82890e03 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/smsgateway/RdResponseSmsGatewayJ.java @@ -0,0 +1,22 @@ +package it.acxent.rd.json.smsgateway; + +import it.acxent.rd.json.RdResponseJ; +import java.util.Vector; + +public class RdResponseSmsGatewayJ extends RdResponseJ { + private Vector data; + + public RdResponseSmsGatewayJ(long status, String msg) { + super(status, msg); + } + + public RdResponseSmsGatewayJ() {} + + public Vector getData() { + return this.data; + } + + public void setData(Vector data) { + this.data = data; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/smsgateway/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/smsgateway/package-info.java new file mode 100644 index 00000000..9ac2353b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/json/smsgateway/package-info.java @@ -0,0 +1 @@ +package it.acxent.rd.json.smsgateway; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/package-info.java new file mode 100644 index 00000000..7d72703a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/package-info.java @@ -0,0 +1 @@ +package it.acxent.rd; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/admin/RemoteDeviceSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/admin/RemoteDeviceSvlt.java new file mode 100644 index 00000000..9ca7e84b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/admin/RemoteDeviceSvlt.java @@ -0,0 +1,78 @@ +package it.acxent.rd.servlet.admin; + +import it.acxent.anag.servlet._AnagAdapterSvlt; +import it.acxent.cloudmsg.MsgJson; +import it.acxent.cloudmsg.PushNotificationService; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.rd.RemoteDevice; +import it.acxent.rd.RemoteDeviceCR; +import it.acxent.servlet.AddImgSvlt; +import java.util.ArrayList; +import java.util.List; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/rd/RemoteDevice.abl"}) +public class RemoteDeviceSvlt extends _AnagAdapterSvlt implements AddImgSvlt { + private static final long serialVersionUID = -759824794431772574L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new RemoteDevice(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new RemoteDeviceCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + public void _creaToken(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(); + RemoteDevice bean = new RemoteDevice(apFull); + long l_id = getRequestLongParameter(req, "id_remoteDevice"); + bean.findByPrimaryKey(l_id); + if (bean.getId_remoteDevice() > 0L) + rp = bean.generaNuovoToken(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _inviaNotifica(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(); + RemoteDevice bean = new RemoteDevice(apFull); + long l_id = getRequestLongParameter(req, "id_remoteDevice"); + bean.findByPrimaryKey(l_id); + if (bean.getId_remoteDevice() > 0L) { + String fileJsonAuth = getParm("FIREBASE_JSON_AUTH_PRIVATE_KEY").getTesto(); + PushNotificationService pns = new PushNotificationService(fileJsonAuth); + MsgJson notifica = new MsgJson("notification", "Test Remote Device Gateway", "Il tuo dispositivo e' correttamente registrato sul server " + + bean.getRemoteDeviceApiServer() + "!"); + MsgJson data = new MsgJson("notification", "Test RDG", "Test Remote Device Gateway"); + List list = new ArrayList<>(); + list.add(bean.getFcmToken()); + pns.sendPushNotification(list, notifica, data, "smsgateway-f05ec"); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + protected boolean isLoadImageServlet() { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/admin/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/admin/package-info.java new file mode 100644 index 00000000..298d6797 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/admin/package-info.java @@ -0,0 +1 @@ +package it.acxent.rd.servlet.admin; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/api/MobileApiSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/api/MobileApiSvlt.java new file mode 100644 index 00000000..3b577045 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/api/MobileApiSvlt.java @@ -0,0 +1,169 @@ +package it.acxent.rd.servlet.api; + +import com.google.gson.Gson; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.newsletter.CodaMessaggi; +import it.acxent.newsletter.CodaMessaggiCR; +import it.acxent.rd.RemoteDevice; +import it.acxent.rd.json.RdRequestJ; +import it.acxent.rd.json.RdResponseJ; +import it.acxent.rd.json.smsgateway.DataSmsMsgJ; +import it.acxent.rd.json.smsgateway.RdRequestSmsGatewayJ; +import it.acxent.rd.json.smsgateway.RdResponseSmsGatewayJ; +import it.acxent.util.Vectumerator; +import java.util.Vector; +import java.util.stream.Collectors; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/rdRest/Ma.abl"}) +public class MobileApiSvlt extends _RdApiSvlt { + private static final long serialVersionUID = -8266400675249237394L; + + private static final String TAG = "MobileApiSvlt "; + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + sendHtmlMsgResponse(req, res, "ERRORE invio "); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + _recordDevice(req, res); + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected void showBean(HttpServletRequest req, HttpServletResponse res) { + sendHtmlMsgResponse(req, res, "ERRORE!!"); + } + + public void _recordDevice(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String requestIp = req.getRemoteAddr(); + Gson gson = new Gson(); + try { + String responseBody = req.getReader().lines().collect(Collectors.joining(System.lineSeparator())); + RdRequestJ deviceRequest = (RdRequestJ)gson.fromJson(responseBody, RdRequestJ.class); + boolean authOk = checkBasicAuth(req, res); + if (authOk) { + RemoteDevice rd = new RemoteDevice(apFull); + rd.findByToken(deviceRequest.getToken()); + if (rd.getId_remoteDevice() > 0L) { + if (rd.getFcmToken().isEmpty() || rd.getFcmToken().equals(deviceRequest.getFcmToken())) { + rd.setImei(deviceRequest.getImei()); + rd.setToken(deviceRequest.getToken()); + rd.setFcmToken(deviceRequest.getFcmToken()); + rd.setIpAddress(requestIp); + rd.setUpdTmst(DBAdapter.getTimestamp()); + ResParm rp = rd.save(); + System.out.println(rp.getMsg()); + if (deviceRequest.getAct().isEmpty()) { + RdResponseJ rdJ = new RdResponseJ(0L, "Dispositivo registrato correttamente"); + String rdJson = gson.toJson(rdJ); + System.out.println("MobileApiSvlt " + rdJson); + sendHtmlMsgResponse(req, res, rdJson); + } else if (deviceRequest.getAct().equals("sms")) { + _smsGateway(req, res, responseBody, rd); + } else { + RdResponseJ rdJ = new RdResponseJ(99L, "Dispositivo registrato correttamente ma implementazione non trovata: " + + deviceRequest.getAct()); + String rdJson = gson.toJson(rdJ); + System.out.println("MobileApiSvlt " + rdJson); + sendHtmlMsgResponse(req, res, rdJson); + } + } else { + RdResponseJ rdJ = new RdResponseJ(2L, "Token già assegnato"); + sendHtmlMsgResponse(req, res, gson.toJson(rdJ)); + } + } else { + RdResponseJ rdJ = new RdResponseJ(1L, "Token non trovato!"); + sendHtmlMsgResponse(req, res, gson.toJson(rdJ)); + } + } else { + RdResponseJ rdJ = new RdResponseJ(99L, "Autenticazione fallita"); + sendHtmlMsgResponse(req, res, gson.toJson(rdJ)); + } + } catch (Exception e) { + e.printStackTrace(); + RdResponseJ rdJ = new RdResponseJ(99L, e.getMessage()); + sendHtmlMsgResponse(req, res, gson.toJson(rdJ)); + } + } + + public void __templateChiamata(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + boolean debug = false; + try { + long l_id_user = getRequestLongParameter(req, "id_user"); + boolean authOk = checkBasicAuth(req, res); + if (!authOk) + sendHtmlMsgResponse(req, res, "testina di vitello, _elencofoto"); + } catch (Exception e) { + e.printStackTrace(); + sendHtmlMsgResponse(req, res, "testina di vitello,_elencofoto eccezione: " + e.getMessage()); + } + } + + private void _smsGateway(HttpServletRequest req, HttpServletResponse res, String responseBody, RemoteDevice rd) { + ApplParmFull apFull = getApFull(req); + Gson gson = new Gson(); + try { + RdRequestSmsGatewayJ deviceRequest = (RdRequestSmsGatewayJ)gson.fromJson(responseBody, RdRequestSmsGatewayJ.class); + RdResponseSmsGatewayJ rdJ = new RdResponseSmsGatewayJ(0L, "Dispositivo registrato correttamente: SmsGateway"); + String smsToTest = getParm("RD_TEST_SMS").getTesto(); + CodaMessaggi cm = new CodaMessaggi(apFull); + CodaMessaggiCR cmCR = new CodaMessaggiCR(); + cmCR.setFlgTipo(99L); + cmCR.setFlgStatoInvio(3L); + cmCR.setId_remoteDevice(rd.getId_remoteDevice()); + Vectumerator vecCm = cm.findByCR(cmCR, 1, 10); + Vector dataVector = new Vector<>(); + if (vecCm.hasMoreElements()) { + while (vecCm.hasMoreElements()) { + CodaMessaggi cmRow = (CodaMessaggi)vecCm.nextElement(); + DataSmsMsgJ dataJ = new DataSmsMsgJ(); + System.out.println("MobileApiSvlt invio al gateway--->" + cmRow.getId_codaMessaggi() + " " + cmRow.getCellulare()); + dataJ.setCellulare(cmRow.getCellulare()); + dataJ.setId_codaMessaggi(cmRow.getId_codaMessaggi()); + dataJ.setTestoMessaggio(cmRow.getTestoMessaggio()); + dataJ.setSmsToTest(smsToTest); + dataJ.setFlgTipo(cmRow.getFlgTipo()); + dataVector.add(dataJ); + cmRow.setFlgStatoInvio(4L); + cmRow.save(); + } + rdJ.setData(dataVector); + } + if (deviceRequest.getData() != null) { + Vector vec = deviceRequest.getData(); + CodaMessaggi cmRow = new CodaMessaggi(apFull); + for (int i = 0; i < vec.size(); i++) { + DataSmsMsgJ row = vec.elementAt(i); + cmRow.findByPrimaryKey(row.getId_codaMessaggi()); + if (cmRow.getId_codaMessaggi() > 0L) { + System.out.println("MobileApiSvlt ricevuto dal gateway e imposto a inviato <----- " + cmRow.getId_codaMessaggi() + " " + + cmRow.getCellulare()); + cmRow.setFlgStatoInvio(1L); + cmRow.setDataInvio(DBAdapter.getToday()); + cmRow.save(); + } + } + } + String rdJson = gson.toJson(rdJ); + System.out.println("MobileApiSvlt " + rdJson); + sendHtmlMsgResponse(req, res, rdJson); + } catch (Exception e) { + e.printStackTrace(); + RdResponseJ rdJ = new RdResponseJ(99L, e.getMessage()); + sendHtmlMsgResponse(req, res, gson.toJson(rdJ)); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/api/_RdApiSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/api/_RdApiSvlt.java new file mode 100644 index 00000000..32e70728 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/api/_RdApiSvlt.java @@ -0,0 +1,73 @@ +package it.acxent.rd.servlet.api; + +import it.acxent.anag.servlet._AnagAdapterSvlt; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.rd.RemoteDevice; +import it.acxent.rd.RemoteDeviceCR; +import java.util.Base64; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class _RdApiSvlt extends _AnagAdapterSvlt { + private static final long serialVersionUID = 9062130951824536369L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new RemoteDevice(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new RemoteDeviceCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } + + protected String getBeanPageName(HttpServletRequest req) { + return "testTicket"; + } + + protected void search(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean checkBasicAuth(HttpServletRequest req, HttpServletResponse res) { + boolean authOk = true; + String apiLogin = getApFull().getParm("RD_API_LOGIN").getTesto().trim(); + String apiPwd = getApFull().getParm("RD_API_PWD").getTesto().trim(); + apiLogin = "rd1"; + apiPwd = "rdp"; + try { + String[] auth = getBasicAuthorizationHeaders(req, res); + if (auth != null) + if (auth[0].equals(apiLogin) && auth[1].equals(apiPwd)) + authOk = true; + } catch (Exception e) {} + return authOk; + } + + protected boolean allowUser(String auth) { + try { + if (auth == null) + return false; + if (!auth.toUpperCase().startsWith("BASIC ")) + return false; + String userpassEncoded = auth.substring(6); + String userpassDecoded = new String(Base64.getDecoder().decode(userpassEncoded)); + String[] account = userpassDecoded.split(":"); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {} +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/api/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/api/package-info.java new file mode 100644 index 00000000..9cf3af61 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/rd/servlet/api/package-info.java @@ -0,0 +1 @@ +package it.acxent.rd.servlet.api; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/redir/servlet/RedirAdminSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/redir/servlet/RedirAdminSvlt.java new file mode 100644 index 00000000..57cc0d35 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/redir/servlet/RedirAdminSvlt.java @@ -0,0 +1,72 @@ +package it.acxent.redir.servlet; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.servlet.SavedHttpRequest; +import java.util.StringTokenizer; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class RedirAdminSvlt extends AblServletSvlt { + private static final long serialVersionUID = -1632154565816362019L; + + private static final String _PARMS2 = "_parms"; + + private static final String _SVLT2 = "_svlt"; + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return null; + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return null; + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + String _svlt = getRequestParameter(req, "_svlt"); + String _parms = getRequestParameter(req, "_parms"); + StringTokenizer st = new StringTokenizer(_parms, "@"); + int delimIndex = 0; + while (st.hasMoreElements()) { + String parmValue = st.nextToken(); + delimIndex = parmValue.indexOf(":"); + String parm = parmValue.substring(0, delimIndex); + String value = parmValue.substring(delimIndex + 1); + req.setAttribute(parm, value); + } + SavedHttpRequest shr = (SavedHttpRequest)req.getSession().getAttribute("_shr"); + shr = new SavedHttpRequest(); + shr.setCompleteRequestedURI(req.getContextPath() + req.getContextPath()); + shr.setServletPath(_svlt); + shr.setAllParametersNAttributes(req); + if (useAlwaysSendRedirect()) + shr.setUseSendRedirect(true); + req.getSession().setAttribute("_shr", shr); + try { + res.sendRedirect(req.getContextPath() + "/admin/menu/index.jsp"); + } catch (Exception e2) { + e2.printStackTrace(); + } + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + search(req, res); + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/redir/servlet/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/redir/servlet/package-info.java new file mode 100644 index 00000000..e72bd67e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/redir/servlet/package-info.java @@ -0,0 +1 @@ +package it.acxent.redir.servlet; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/sms/SmsSender.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/sms/SmsSender.java new file mode 100644 index 00000000..7db3902a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/sms/SmsSender.java @@ -0,0 +1,311 @@ +package it.acxent.sms; + +import it.acxent.db.ResParm; +import it.acxent.util.StringTokenizer; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.UnsupportedEncodingException; +import java.net.URL; +import java.net.URLConnection; +import java.util.ArrayList; +import java.util.List; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.NameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; + +public class SmsSender implements Runnable { + private String[] recipients; + + private String username; + + private String password; + + private String url; + + private String messaggio; + + private int tipoInvio; + + public static final int TIPO_INVIO_BULK = 1; + + public static final int TIPO_INVIO_SKEBBY = 2; + + private static final String CHARSET = "UTF-8"; + + public static void sendSms(String telefono, String username, String password, String url, String messaggio, int tipoInvio) { + SmsSender sms = new SmsSender(); + sms.setRecipients(new String[] { telefono }); + sms.setUsername(username); + sms.setPassword(password); + sms.setUrl(url); + sms.setMessaggio(messaggio); + sms.setTipoInvio(tipoInvio); + Thread t = new Thread(sms); + t.start(); + } + + public String[] getRecipients() { + return this.recipients; + } + + public void setRecipients(String[] recipients) { + this.recipients = recipients; + } + + public String getUsername() { + return this.username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return this.password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getUrl() { + return this.url; + } + + public void setUrl(String url) { + this.url = url; + } + + public int getTipoInvio() { + return this.tipoInvio; + } + + public void setTipoInvio(int tipoInvio) { + this.tipoInvio = tipoInvio; + } + + public void run() { + switch (this.tipoInvio) { + case 1: + sendBulk(); + break; + case 2: + sendSkebby(); + break; + } + } + + public ResParm sendBulk() { + ResParm rp = new ResParm(true); + try { + CloseableHttpClient closeableHttpClient = HttpClients.createDefault(); + HttpPost httppost = new HttpPost(getUrl()); + List params = new ArrayList<>(); + params.add(new BasicNameValuePair("username", getUsername())); + params.add(new BasicNameValuePair("password", getPassword())); + params.add(new BasicNameValuePair("message", getMessaggio())); + params.add(new BasicNameValuePair("msisdn", this.recipients[0])); + params.add(new BasicNameValuePair("want_report", "1")); + httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); + HttpResponse response = closeableHttpClient.execute((HttpUriRequest)httppost); + BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent())); + StringBuffer result = new StringBuffer(); + String line = ""; + while ((line = rd.readLine()) != null) + result.append(line); + rd.close(); + System.out.println(result.toString()); + StringTokenizer st = new StringTokenizer(result.toString(), "|"); + if (st.countToken() == 3) { + String statusCode = st.nextToken(); + String statusDescription = st.nextToken(); + String batchId = st.nextToken(); + System.out.println("SMS RESPONSE (" + statusCode + "):"); + if (statusCode.equals("0")) { + rp.setStatus(true); + rp.setMsg("Inviato con successo"); + } else { + rp.setStatus(false); + if (statusCode.equals("1")) { + rp.setMsg("Schedulato e non inviato"); + } else if (statusCode.equals("22")) { + rp.setMsg("Internal fatal error"); + } else if (statusCode.equals("23")) { + rp.setMsg("Authentication failure"); + } else if (statusCode.equals("24")) { + rp.setMsg("Data validation failed"); + } else if (statusCode.equals("25")) { + rp.setMsg("You do not have sufficient credits"); + } else if (statusCode.equals("26")) { + rp.setMsg("Upstream credits not available"); + } else if (statusCode.equals("27")) { + rp.setMsg("You have exceeded your daily quota"); + } else if (statusCode.equals("28")) { + rp.setMsg("Upstream quota exceeded"); + } else if (statusCode.equals("40")) { + rp.setMsg("Temporarily unavailable"); + } else if (statusCode.equals("201")) { + rp.setMsg("Maximum batch size exceeded"); + } + } + } else { + rp = new ResParm(false, "Response error! " + result.toString()); + } + System.out.println(rp.getMsg()); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + rp = new ResParm(false, e); + } catch (IOException e) { + e.printStackTrace(); + rp = new ResParm(false, e); + } + return rp; + } + + public ResParm sendSkebby() { + ResParm rp = new ResParm(true); + try { + CloseableHttpClient closeableHttpClient = HttpClients.createDefault(); + HttpPost httppost = new HttpPost(getUrl()); + List params = new ArrayList<>(); + params.add(new BasicNameValuePair("method", "send_sms_classic")); + params.add(new BasicNameValuePair("username", getUsername())); + params.add(new BasicNameValuePair("password", getPassword())); + params.add(new BasicNameValuePair("recipients[]", this.recipients[0])); + params.add(new BasicNameValuePair("text", getMessaggio())); + params.add(new BasicNameValuePair("charset", "UTF-8")); + httppost.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); + HttpResponse response = closeableHttpClient.execute((HttpUriRequest)httppost); + HttpEntity resultEntity = response.getEntity(); + if (null != resultEntity) + System.out.println(EntityUtils.toString(resultEntity)); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return rp; + } + + public String getMessaggio() { + return (this.messaggio == null) ? "" : this.messaggio.trim(); + } + + public void setMessaggio(String messaggio) { + this.messaggio = messaggio; + } + + public ResParm sendBulk2() { + ResParm rp = new ResParm(true); + try { + String data = ""; + data = data + "username=" + data; + data = data + "&password=" + data; + data = data + "&message=" + data; + data = data + "&dca=16bit"; + data = data + "&want_report=1"; + data = data + "&msisdn=" + data; + URL url = new URL(getUrl()); + URLConnection conn = url.openConnection(); + conn.setDoOutput(true); + OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream()); + wr.write(data); + wr.flush(); + BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); + StringBuffer result = new StringBuffer(); + String line; + while ((line = rd.readLine()) != null) { + result.append(line); + System.out.println(line); + } + wr.close(); + rd.close(); + System.out.println(result.toString()); + StringTokenizer st = new StringTokenizer(result.toString(), "|"); + if (st.countToken() == 3) { + String statusCode = st.nextToken(); + String statusDescription = st.nextToken(); + String batchId = st.nextToken(); + System.out.println("SMS RESPONSE (" + statusCode + "):"); + if (statusCode.equals("0")) { + rp.setStatus(true); + rp.setMsg("Inviato con successo"); + } else { + rp.setStatus(false); + if (statusCode.equals("1")) { + rp.setMsg("Schedulato e non inviato"); + } else if (statusCode.equals("22")) { + rp.setMsg("Internal fatal error"); + } else if (statusCode.equals("23")) { + rp.setMsg("Authentication failure"); + } else if (statusCode.equals("24")) { + rp.setMsg("Data validation failed"); + } else if (statusCode.equals("25")) { + rp.setMsg("You do not have sufficient credits"); + } else if (statusCode.equals("26")) { + rp.setMsg("Upstream credits not available"); + } else if (statusCode.equals("27")) { + rp.setMsg("You have exceeded your daily quota"); + } else if (statusCode.equals("28")) { + rp.setMsg("Upstream quota exceeded"); + } else if (statusCode.equals("40")) { + rp.setMsg("Temporarily unavailable"); + } else if (statusCode.equals("201")) { + rp.setMsg("Maximum batch size exceeded"); + } + } + } else { + rp = new ResParm(false, "Response error! " + result.toString()); + } + System.out.println(rp.getMsg()); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + rp = new ResParm(false, e); + } catch (IOException e) { + e.printStackTrace(); + rp = new ResParm(false, e); + } + return rp; + } + + public static ResParm sendSmsSync(String telefono, String username, String password, String url, String messaggio, int tipoInvio) { + SmsSender sms = new SmsSender(); + ResParm rp = new ResParm(false); + sms.setRecipients(new String[] { telefono }); + sms.setUsername(username); + sms.setPassword(password); + sms.setUrl(url); + sms.setMessaggio(messaggio); + sms.setTipoInvio(tipoInvio); + switch (tipoInvio) { + case 1: + rp = sms.sendBulk(); + break; + case 2: + sms.sendSkebby(); + break; + } + return rp; + } + + public static String stringToHex(String s) { + char[] chars = s.toCharArray(); + StringBuffer output = new StringBuffer(); + for (int i = 0; i < chars.length; i++) { + String next = Integer.toHexString(chars[i]); + for (int j = 0; j < 4 - next.length(); j++) + output.append("0"); + output.append(next); + } + return output.toString(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/socialsignin/servlet/LogonSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/socialsignin/servlet/LogonSvlt.java new file mode 100644 index 00000000..ac8780d5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/socialsignin/servlet/LogonSvlt.java @@ -0,0 +1,56 @@ +package it.acxent.socialsignin.servlet; + +import it.acxent.common.Users; +import java.util.Properties; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@Deprecated +public class LogonSvlt extends it.acxent.servlet.LogonSvlt { + protected boolean checkLoginProfile(HttpServletRequest req) { + try { + if (getLoginUser(req) == null) { + forceJspPage(getLoginPage(req, null), req); + return true; + } + if (getLoginUser(req).getFlgValido().equals("N")) { + forceJspPage(getLoginPage(req, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return false; + } + if (getLoginUser(req).getId_userProfile() > 0L) { + forceJspPage(getLoginPage(req, null), req); + return true; + } + forceJspPage(getLoginPage(req, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return true; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + + protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) { + return getRequestParameter(req, "thePage"); + } + + protected Users getUser(HttpServletRequest req) { + return new it.acxent.anag.Users(getApFull(req)); + } + + protected void loginOK(HttpServletRequest req, HttpServletResponse res) throws Exception { + String url = "it.acxent.servlet.AcCartSvlt"; + Properties parm = new Properties(); + parm.setProperty("cmd", "updateCart"); + startRemoteCmd(getApFull(req), parm, url); + super.loginOK(req, res); + req.setAttribute("msg", ""); + } + + protected boolean useControlCodeAccess() { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/socialsignin/servlet/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/socialsignin/servlet/package-info.java new file mode 100644 index 00000000..af13aa38 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/socialsignin/servlet/package-info.java @@ -0,0 +1 @@ +package it.acxent.socialsignin.servlet; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/taglib/CartTag.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/taglib/CartTag.java new file mode 100644 index 00000000..78da1bc8 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/taglib/CartTag.java @@ -0,0 +1,87 @@ +package it.acxent.taglib; + +import it.acxent.cart.Cart; +import it.acxent.cart.CartItem; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.io.Writer; +import javax.servlet.http.HttpSession; +import javax.servlet.jsp.JspException; + +public class CartTag extends AbstractDbTag { + private String rowbeanitemclass; + + private Vectumerator theList; + + private CartItem cartItemObj; + + private String id_itemsVector; + + public int doAfterBody() throws JspException { + try { + if (this.theList.hasMoreElements()) { + this.cartItemObj = (CartItem)this.theList.nextElement(); + this.pageContext.setAttribute("rowBean", this.cartItemObj); + this.pageContext.setAttribute("rowBeanItem", this.cartItemObj.getDbItem()); + if (this.cartItemObj.getItemId() instanceof String || !this.cartItemObj.getCartItemTag().equals("")) { + this.id_itemsVector = this.id_itemsVector + "'" + this.id_itemsVector + this.cartItemObj.getCartItemTag() + "',"; + } else { + this.id_itemsVector = this.id_itemsVector + this.id_itemsVector + ","; + } + return 2; + } + this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter()); + this.id_itemsVector = this.id_itemsVector.substring(0, this.id_itemsVector.length() - 1); + this.pageContext.setAttribute("id_itemsVector", this.id_itemsVector); + return 0; + } catch (IOException ioexception) { + throw new JspException(ioexception.getMessage()); + } catch (Exception exception) { + throw new JspException(exception.getMessage()); + } + } + + public void doInitBody() {} + + public int doStartTag() { + try { + this.theList = new Vectumerator(getCart().getItems()); + } catch (Exception e) { + this.theList = new Vectumerator(); + } + if (this.theList == null || !this.theList.hasMoreElements()) + return 0; + this.id_itemsVector = ""; + this.theList.moveFirst(); + if (this.theList.hasMoreElements()) { + this.cartItemObj = (CartItem)this.theList.nextElement(); + this.pageContext.setAttribute("rowBean", this.cartItemObj); + this.pageContext.setAttribute("rowBeanItem", this.cartItemObj.getDbItem()); + if (this.cartItemObj.getItemId() instanceof String || !this.cartItemObj.getCartItemTag().equals("")) { + this.id_itemsVector = this.id_itemsVector + "'" + this.id_itemsVector + this.cartItemObj.getCartItemTag() + "',"; + } else { + this.id_itemsVector = this.id_itemsVector + this.id_itemsVector + ","; + } + } + return 2; + } + + private Cart getCart() { + HttpSession session = this.pageContext.getSession(); + if (session.getAttribute("cart") != null) { + Cart cart1 = (Cart)session.getAttribute("cart"); + cart1.setApplParmFull(getApFull()); + return cart1; + } + Cart cart = new Cart(getApFull()); + return cart; + } + + public String getRowbeanitemclass() { + return this.rowbeanitemclass; + } + + public void setRowbeanitemclass(String rowbeanclass) { + this.rowbeanitemclass = rowbeanclass; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/taglib/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/taglib/package-info.java new file mode 100644 index 00000000..6815ee1e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/taglib/package-info.java @@ -0,0 +1 @@ +package it.acxent.taglib; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/CategoriaOpzione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/CategoriaOpzione.java new file mode 100644 index 00000000..bad03080 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/CategoriaOpzione.java @@ -0,0 +1,71 @@ +package it.acxent.tarop; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class CategoriaOpzione extends DBAdapter implements Serializable { + private long id_categoriaOpzione; + + private String descrizione; + + public CategoriaOpzione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CategoriaOpzione() {} + + public void setId_categoriaOpzione(long newId_categoriaOpzione) { + this.id_categoriaOpzione = newId_categoriaOpzione; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_categoriaOpzione() { + return this.id_categoriaOpzione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(CategoriaOpzioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CATEGORIA_OPZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/CategoriaOpzioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/CategoriaOpzioneCR.java new file mode 100644 index 00000000..17fb05fd --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/CategoriaOpzioneCR.java @@ -0,0 +1,32 @@ +package it.acxent.tarop; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class CategoriaOpzioneCR extends CRAdapter { + private long id_categoriaOpzione; + + private String descrizione; + + public CategoriaOpzioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CategoriaOpzioneCR() {} + + public void setId_categoriaOpzione(long newId_categoriaOpzione) { + this.id_categoriaOpzione = newId_categoriaOpzione; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_categoriaOpzione() { + return this.id_categoriaOpzione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/Opzione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/Opzione.java new file mode 100644 index 00000000..cce8d5f4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/Opzione.java @@ -0,0 +1,369 @@ +package it.acxent.tarop; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.net.URLEncoder; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Opzione extends DBAdapter implements Serializable { + private long id_opzione; + + private long flgTipoOpzione; + + private long flgFM = -1L; + + private long flgPA = -1L; + + private long flgAR = -1L; + + private String descrizione; + + private String titolo; + + private String sottotitolo; + + private String costo; + + private String costoScontato; + + private String descrizioneSconto; + + private Date dataScadenza; + + private String descrizioneCompatibilita; + + private long id_categoriaOpzione; + + private CategoriaOpzione categoriaOpzione; + + public Opzione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Opzione() {} + + public void setId_opzione(long newId_opzione) { + this.id_opzione = newId_opzione; + } + + public void setFlgTipoOpzione(long newFlgTipoOpzione) { + this.flgTipoOpzione = newFlgTipoOpzione; + } + + public void setFlgFM(long newFlgFM) { + this.flgFM = newFlgFM; + } + + public void setFlgPA(long newFlgPA) { + this.flgPA = newFlgPA; + } + + public void setFlgAR(long newFlgAR) { + this.flgAR = newFlgAR; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setTitolo(String newTitlo) { + this.titolo = newTitlo; + } + + public void setSottotitolo(String newSottotitolo) { + this.sottotitolo = newSottotitolo; + } + + public void setCosto(String newCosto) { + this.costo = newCosto; + } + + public void setCostoScontato(String newCostoScontato) { + this.costoScontato = newCostoScontato; + } + + public void setDescrizioneSconto(String newDescrizioneSconto) { + this.descrizioneSconto = newDescrizioneSconto; + } + + public void setDataScadenza(Date newDataScadenza) { + this.dataScadenza = newDataScadenza; + } + + public void setDescrizioneCompatibilita(String newDescrizioneCompatibilita) { + this.descrizioneCompatibilita = newDescrizioneCompatibilita; + } + + public void setId_categoriaOpzione(long newId_categoriaOpzione) { + this.id_categoriaOpzione = newId_categoriaOpzione; + setCategoriaOpzione(null); + } + + public long getId_opzione() { + return this.id_opzione; + } + + public long getFlgTipoOpzione() { + return this.flgTipoOpzione; + } + + public long getFlgFM() { + return this.flgFM; + } + + public long getFlgPA() { + return this.flgPA; + } + + public long getFlgAR() { + return this.flgAR; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : + this.descrizione.trim(); + } + + public String getTitolo() { + return (this.titolo == null) ? "" : this.titolo.trim(); + } + + public String getSottotitolo() { + return (this.sottotitolo == null) ? "" : + this.sottotitolo.trim(); + } + + public String getCosto() { + return (this.costo == null) ? "" : this.costo.trim(); + } + + public String getCostoScontato() { + return (this.costoScontato == null) ? "" : + this.costoScontato.trim(); + } + + public String getDescrizioneSconto() { + return (this.descrizioneSconto == null) ? "" : + this.descrizioneSconto.trim(); + } + + public Date getDataScadenza() { + return this.dataScadenza; + } + + public String getDescrizioneCompatibilita() { + return (this.descrizioneCompatibilita == null) ? "" : + this.descrizioneCompatibilita.trim(); + } + + public long getId_categoriaOpzione() { + return this.id_categoriaOpzione; + } + + public void setCategoriaOpzione(CategoriaOpzione newCategoriaOpzione) { + this.categoriaOpzione = newCategoriaOpzione; + } + + public CategoriaOpzione getCategoriaOpzione() { + this.categoriaOpzione = (CategoriaOpzione)getSecondaryObject(this.categoriaOpzione, CategoriaOpzione.class, + + getId_categoriaOpzione()); + return this.categoriaOpzione; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(OpzioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from OPZIONE AS A, CATEGORIA_OPZIONE AS B"; + String s_Sql_Order = " ORDER BY B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_categoriaOpzione=B.id_categoriaOpzione"); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.titolo like '%" + token + "%' or A.sottoTitolo like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getFlgAR() == 0L) { + wc.addWc("(A.flgAR is null or A.flgAR=0)"); + } else if (CR.getFlgAR() > 0L) { + wc.addWc("A.flgAR =" + CR.getFlgAR()); + } + if (CR.getFlgFM() == 0L) { + wc.addWc("(A.flgFM is null or A.flgFM=0)"); + } else if (CR.getFlgFM() > 0L) { + wc.addWc("A.flgFM =" + CR.getFlgFM()); + } + if (CR.getFlgPA() == 0L) { + wc.addWc("(A.flgPA is null or A.flgPA=0)"); + } else if (CR.getFlgPA() > 0L) { + wc.addWc("A.flgPA =" + CR.getFlgPA()); + } + if (CR.getFlgTipoOpzione() == 0L) { + wc.addWc("(A.flgTipoOpzione is null or A.flgTipoOpzione=0)"); + } else if (CR.getFlgTipoOpzione() > 0L) { + wc.addWc("A.flgTipoOpzione =" + CR.getFlgTipoOpzione()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm addOpzioneArticolo(OpzioneArticolo row) { + OpzioneArticolo bean = new OpzioneArticolo(getApFull()); + if (row.getId_opzioneArticolo() != 0L) { + bean.findByPrimaryKey(row.getId_opzioneArticolo()); + } else { + bean.findById_articoloId_opzione(row.getId_articolo(), + row.getId_opzione()); + } + if (bean.getDBState() == 1) { + row.setDBState(bean.getDBState()); + row.setId_opzioneArticolo(bean.getId_opzioneArticolo()); + } + ResParm rp = row.save(); + return rp; + } + + public ResParm delOpzioneArticolo(OpzioneArticolo row) { + OpzioneArticolo bean = new OpzioneArticolo(getApFull()); + bean.findByPrimaryKey(row.getId_opzioneArticolo()); + return bean.delete(); + } + + public Vectumerator getOpzioniArticoli() { + return new OpzioneArticolo(getApFull()).findById_opzione(getId_opzione()); + } + + public String getAR() { + return Tariffa.getAR(getFlgAR()); + } + + public String getFM() { + return Tariffa.getFM(getFlgFM()); + } + + public String getPA() { + return Tariffa.getPA(getFlgPA()); + } + + public static String getTipoOpzione(long l_flgTipoOpzione) { + if (l_flgTipoOpzione == 0L) + return "Tariffa"; + if (l_flgTipoOpzione == 1L) + return "Tel. Associati"; + return "??"; + } + + public String getTipoOpzione() { + return getTipoOpzione(getFlgTipoOpzione()); + } + + public Vectumerator findWebByCR(OpzioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from OPZIONE AS A , CATEGORIA_OPZIONE AS B"; + String s_Sql_Order = " ORDER BY B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_categoriaOpzione=B.id_categoriaOpzione"); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.titolo like '%" + token + "%' or A.sottoTitolo like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getFlgAR() == 0L) { + wc.addWc("(A.flgAR is null or A.flgAR=0 or A.flgAR=2)"); + } else if (CR.getFlgAR() == 1L) { + wc.addWc("(A.flgAR =1 or A.flgAR=2)"); + } + if (CR.getFlgFM() == 0L) { + wc.addWc("(A.flgFM is null or A.flgFM=0)"); + } else if (CR.getFlgFM() > 0L) { + wc.addWc("A.flgFM =" + CR.getFlgFM()); + } + if (CR.getFlgPA() == 0L) { + wc.addWc("(A.flgPA is null or A.flgPA=0)"); + } else if (CR.getFlgPA() > 0L) { + wc.addWc("A.flgPA =" + CR.getFlgPA()); + } + if (CR.getFlgTipoOpzione() == 0L) { + wc.addWc("(A.flgTipoOpzione is null or A.flgTipoOpzione=0)"); + } else if (CR.getFlgTipoOpzione() > 0L) { + wc.addWc("A.flgTipoOpzione =" + CR.getFlgTipoOpzione()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByTariffa(long l_id_tariffa, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from OPZIONE AS A , CATEGORIA_OPZIONE AS B"; + String s_Sql_Order = " ORDER BY B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_categoriaOpzione=B.id_categoriaOpzione"); + wc.addWc("A.id_tariffa =" + l_id_tariffa); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator getTariffe(int pageNumber, int pageRows) { + TariffaCR CR = new TariffaCR(); + CR.setFlgAR(getFlgAR()); + CR.setFlgFM(getFlgFM()); + CR.setFlgPA(getFlgPA()); + return new Tariffa(getApFull()).findWebByCR(CR, 0, 0); + } + + public String getTitoloUrl() { + try { + return URLEncoder.encode(getTitolo().replace("/", "-"), "utf-8"); + } catch (Exception e) { + return getTitolo(); + } + } + + protected int getStringValueCase(String l_columnName) { + return 0; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/OpzioneArticolo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/OpzioneArticolo.java new file mode 100644 index 00000000..ae0a2e3c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/OpzioneArticolo.java @@ -0,0 +1,168 @@ +package it.acxent.tarop; + +import it.acxent.art.Articolo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class OpzioneArticolo extends DBAdapter implements Serializable { + private long id_opzioneArticolo; + + private long id_opzione; + + private String descrizioneOA; + + private long id_articolo; + + private Opzione opzione; + + private Articolo articolo; + + public OpzioneArticolo(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public OpzioneArticolo() {} + + public void setId_opzioneArticolo(long newId_opzioneArticolo) { + this.id_opzioneArticolo = newId_opzioneArticolo; + } + + public void setId_opzione(long newId_opzione) { + this.id_opzione = newId_opzione; + setOpzione(null); + } + + public void setDescrizioneOA(String newDescrizioneTO) { + this.descrizioneOA = newDescrizioneTO; + } + + public long getId_opzioneArticolo() { + return this.id_opzioneArticolo; + } + + public long getId_opzione() { + return this.id_opzione; + } + + public String getDescrizioneOA() { + return (this.descrizioneOA == null) ? "" : + this.descrizioneOA.trim(); + } + + public void setOpzione(Opzione newOpzione) { + this.opzione = newOpzione; + } + + public Opzione getOpzione() { + this.opzione = (Opzione)getSecondaryObject(this.opzione, Opzione.class, + getId_opzione()); + return this.opzione; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + getId_articolo()); + return this.articolo; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(OpzioneArticoloCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from OPZIONE_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findById_articoloId_opzione(long l_id_articolo, long l_id_opzione) { + String s_Sql_Find = "select A.* from OPZIONE_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + wc.addWc("A.id_opzione=" + l_id_opzione); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + setArticolo(null); + } + + public Vectumerator findById_opzione(long l_id_opzione) { + String s_Sql_Find = "select A.* from OPZIONE_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_opzione=" + l_id_opzione); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findById_articolo(long l_id_articolo) { + String s_Sql_Find = "select A.* from OPZIONE_ARTICOLO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/OpzioneArticoloCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/OpzioneArticoloCR.java new file mode 100644 index 00000000..8369c35e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/OpzioneArticoloCR.java @@ -0,0 +1,81 @@ +package it.acxent.tarop; + +import it.acxent.art.Articolo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class OpzioneArticoloCR extends CRAdapter { + private long id_opzioneArticolo; + + private long id_opzione; + + private String descrizioneOA; + + private Opzione opzione; + + private Articolo articolo; + + private long id_articolo; + + public OpzioneArticoloCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public OpzioneArticoloCR() {} + + public void setId_opzioneArticolo(long newId_opzioneArticolo) { + this.id_opzioneArticolo = newId_opzioneArticolo; + } + + public void setId_opzione(long newId_opzione) { + this.id_opzione = newId_opzione; + setOpzione(null); + } + + public void setDescrizioneOA(String newDescrizioneTO) { + this.descrizioneOA = newDescrizioneTO; + } + + public long getId_opzioneArticolo() { + return this.id_opzioneArticolo; + } + + public long getId_opzione() { + return this.id_opzione; + } + + public String getDescrizioneOA() { + return (this.descrizioneOA == null) ? "" : this.descrizioneOA.trim(); + } + + public void setOpzione(Opzione newOpzione) { + this.opzione = newOpzione; + } + + public Opzione getOpzione() { + this.opzione = (Opzione)getSecondaryObject(this.opzione, Opzione.class, + + getId_opzione()); + return this.opzione; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + + getId_articolo()); + return this.articolo; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public void setId_articolo(long id_articolo) { + this.id_articolo = id_articolo; + setArticolo(null); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/OpzioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/OpzioneCR.java new file mode 100644 index 00000000..0fca8fc4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/OpzioneCR.java @@ -0,0 +1,187 @@ +package it.acxent.tarop; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class OpzioneCR extends CRAdapter { + private long id_opzione; + + private long flgTipoOpzione = -1L; + + private long flgFM = -1L; + + private long flgPA = -1L; + + private long flgAR = -1L; + + private String descrizione; + + private String titlo; + + private String sottotitolo; + + private String costo; + + private String costoScontato; + + private String descrizioneSconto; + + private Date dataScadenza; + + private String descrizioneCompatibilita; + + private long id_categoriaOpzione; + + private CategoriaOpzione categoriaOpzione; + + private Date dataScadenzaDa; + + private Date dataScadenzaA; + + public OpzioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public OpzioneCR() {} + + public void setId_opzione(long newId_opzione) { + this.id_opzione = newId_opzione; + } + + public void setFlgTipoOpzione(long newFlgTipoOpzione) { + this.flgTipoOpzione = newFlgTipoOpzione; + } + + public void setFlgFM(long newFlgFM) { + this.flgFM = newFlgFM; + } + + public void setFlgPA(long newFlgPA) { + this.flgPA = newFlgPA; + } + + public void setFlgAR(long newFlgAR) { + this.flgAR = newFlgAR; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setTitlo(String newTitlo) { + this.titlo = newTitlo; + } + + public void setSottotitolo(String newSottotitolo) { + this.sottotitolo = newSottotitolo; + } + + public void setCosto(String newCosto) { + this.costo = newCosto; + } + + public void setCostoScontato(String newCostoScontato) { + this.costoScontato = newCostoScontato; + } + + public void setDescrizioneSconto(String newDescrizioneSconto) { + this.descrizioneSconto = newDescrizioneSconto; + } + + public void setDataScadenza(Date newDataScadenza) { + this.dataScadenza = newDataScadenza; + } + + public void setDescrizioneCompatibilita(String newDescrizioneCompatibilita) { + this.descrizioneCompatibilita = newDescrizioneCompatibilita; + } + + public void setId_categoriaOpzione(long newId_categoriaOpzione) { + this.id_categoriaOpzione = newId_categoriaOpzione; + setCategoriaOpzione(null); + } + + public long getId_opzione() { + return this.id_opzione; + } + + public long getFlgTipoOpzione() { + return this.flgTipoOpzione; + } + + public long getFlgFM() { + return this.flgFM; + } + + public long getFlgPA() { + return this.flgPA; + } + + public long getFlgAR() { + return this.flgAR; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getTitlo() { + return (this.titlo == null) ? "" : this.titlo.trim(); + } + + public String getSottotitolo() { + return (this.sottotitolo == null) ? "" : this.sottotitolo.trim(); + } + + public String getCosto() { + return (this.costo == null) ? "" : this.costo.trim(); + } + + public String getCostoScontato() { + return (this.costoScontato == null) ? "" : this.costoScontato.trim(); + } + + public String getDescrizioneSconto() { + return (this.descrizioneSconto == null) ? "" : this.descrizioneSconto.trim(); + } + + public Date getDataScadenza() { + return this.dataScadenza; + } + + public String getDescrizioneCompatibilita() { + return (this.descrizioneCompatibilita == null) ? "" : this.descrizioneCompatibilita.trim(); + } + + public long getId_categoriaOpzione() { + return this.id_categoriaOpzione; + } + + public void setCategoriaOpzione(CategoriaOpzione newCategoriaOpzione) { + this.categoriaOpzione = newCategoriaOpzione; + } + + public CategoriaOpzione getCategoriaOpzione() { + this.categoriaOpzione = (CategoriaOpzione)getSecondaryObject(this.categoriaOpzione, CategoriaOpzione.class, + + getId_categoriaOpzione()); + return this.categoriaOpzione; + } + + public Date getDataScadenzaDa() { + return this.dataScadenzaDa; + } + + public void setDataScadenzaDa(Date dataScadenzaDa) { + this.dataScadenzaDa = dataScadenzaDa; + } + + public Date getDataScadenzaA() { + return this.dataScadenzaA; + } + + public void setDataScadenzaA(Date dataScadenzaA) { + this.dataScadenzaA = dataScadenzaA; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/Tariffa.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/Tariffa.java new file mode 100644 index 00000000..a4cfd232 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/Tariffa.java @@ -0,0 +1,294 @@ +package it.acxent.tarop; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.net.URLEncoder; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Tariffa extends DBAdapter implements Serializable { + private long id_tariffa; + + private long flgFM; + + private long flgPA; + + private long flgAR; + + private long flgTablet; + + private String descrizione; + + private String titolo; + + private String sottotitolo; + + private String costo; + + private String costoScontato; + + private String descrizioneSconto; + + private Date dataScadenza; + + public Tariffa(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Tariffa() {} + + public void setId_tariffa(long newId_tipoTariffa) { + this.id_tariffa = newId_tipoTariffa; + } + + public void setFlgFM(long newFlgFM) { + this.flgFM = newFlgFM; + } + + public void setFlgPA(long newFlgPA) { + this.flgPA = newFlgPA; + } + + public void setFlgAR(long newFlgAR) { + this.flgAR = newFlgAR; + } + + public void setFlgTablet(long newFlgTablet) { + this.flgTablet = newFlgTablet; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setTitolo(String newTitolo) { + this.titolo = newTitolo; + } + + public void setSottotitolo(String newSottotitolo) { + this.sottotitolo = newSottotitolo; + } + + public void setCosto(String newCosto) { + this.costo = newCosto; + } + + public void setCostoScontato(String newCostoScontato) { + this.costoScontato = newCostoScontato; + } + + public void setDescrizioneSconto(String newDescrizioneSconto) { + this.descrizioneSconto = newDescrizioneSconto; + } + + public void setDataScadenza(Date newDataScadenza) { + this.dataScadenza = newDataScadenza; + } + + public long getId_tariffa() { + return this.id_tariffa; + } + + public long getFlgFM() { + return this.flgFM; + } + + public long getFlgPA() { + return this.flgPA; + } + + public long getFlgAR() { + return this.flgAR; + } + + public long getFlgTablet() { + return this.flgTablet; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : + this.descrizione.trim(); + } + + public String getTitolo() { + return (this.titolo == null) ? "" : this.titolo.trim(); + } + + public String getSottotitolo() { + return (this.sottotitolo == null) ? "" : + this.sottotitolo.trim(); + } + + public String getCosto() { + return (this.costo == null) ? "" : this.costo.trim(); + } + + public String getCostoScontato() { + return (this.costoScontato == null) ? "" : + this.costoScontato.trim(); + } + + public String getDescrizioneSconto() { + return (this.descrizioneSconto == null) ? "" : + this.descrizioneSconto.trim(); + } + + public Date getDataScadenza() { + return this.dataScadenza; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator getOpzioni(int pageNumber, int pageRows) { + OpzioneCR CR = new OpzioneCR(); + CR.setFlgAR(getFlgAR()); + CR.setFlgFM(getFlgFM()); + CR.setFlgPA(getFlgPA()); + return new Opzione(getApFull()).findWebByCR(CR, 0, 0); + } + + public static String getAR(long l_flgAR) { + if (l_flgAR == 0L) + return "Abbonamento"; + if (l_flgAR == 1L) + return "Ricaricabile"; + if (l_flgAR == 2L) + return "Abb. e Ric."; + return "??"; + } + + public static String getPA(long l_flgPA) { + if (l_flgPA == 0L) + return "Privati"; + if (l_flgPA == 1L) + return "Aziende"; + return "??"; + } + + public String getAR() { + return getAR(getFlgAR()); + } + + public String getFM() { + return getFM(getFlgFM()); + } + + public String getPA() { + return getPA(getFlgPA()); + } + + public Vectumerator findWebByCR(TariffaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TARIFFA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.titolo like '%" + token + "%' or A.sottoTitolo like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getFlgAR() == 0L) { + wc.addWc("(A.flgAR is null or A.flgAR=0 or A.flgAR=2)"); + } else if (CR.getFlgAR() == 1L) { + wc.addWc("(A.flgAR =1 or A.flgAR=2)"); + } + if (CR.getFlgFM() == 0L) { + wc.addWc("(A.flgFM is null or A.flgFM=0)"); + } else if (CR.getFlgFM() > 0L) { + wc.addWc("A.flgFM =" + CR.getFlgFM()); + } + if (CR.getFlgPA() == 0L) { + wc.addWc("(A.flgPA is null or A.flgPA=0)"); + } else if (CR.getFlgPA() > 0L) { + wc.addWc("A.flgPA =" + CR.getFlgPA()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getTitoloUrl() { + try { + return URLEncoder.encode(getTitolo().replace("/", "-"), "utf-8"); + } catch (Exception e) { + return getTitolo(); + } + } + + public Vectumerator findByCR(TariffaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TARIFFA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (CR.getFlgAR() == 0L) { + wc.addWc("(A.flgAR is null or A.flgAR=0)"); + } else if (CR.getFlgAR() > 0L) { + wc.addWc("A.flgAR =" + CR.getFlgAR()); + } + if (CR.getFlgFM() == 0L) { + wc.addWc("(A.flgFM is null or A.flgFM=0)"); + } else if (CR.getFlgFM() > 0L) { + wc.addWc("A.flgFM =" + CR.getFlgFM()); + } + if (CR.getFlgPA() == 0L) { + wc.addWc("(A.flgPA is null or A.flgPA=0)"); + } else if (CR.getFlgPA() > 0L) { + wc.addWc("A.flgPA =" + CR.getFlgPA()); + } + if (CR.getDataScadenzaDa() != null) + wc.addWc("A.dataScadenza>=?"); + if (CR.getDataScadenzaA() != null) + wc.addWc("A.dataScadenza<=?"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + int dataCount = 0; + if (CR.getDataScadenzaDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataScadenzaDa()); + } + if (CR.getDataScadenzaA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataScadenzaA()); + } + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public static String getFM(long l_flgFM) { + if (l_flgFM == 0L) + return "Mobile"; + if (l_flgFM == 1L) + return "Fisso solo tel."; + if (l_flgFM == 2L) + return "Fisso tel+internet"; + if (l_flgFM == 3L) + return "Internet e Tablet"; + return "??"; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/TariffaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/TariffaCR.java new file mode 100644 index 00000000..d2ec6007 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/TariffaCR.java @@ -0,0 +1,169 @@ +package it.acxent.tarop; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class TariffaCR extends CRAdapter { + private long id_tariffa; + + private long flgFM = -1L; + + private long flgPA = -1L; + + private long flgAR = -1L; + + private long flgTablet = -1L; + + private String descrizione; + + private String titolo; + + private String sottotitolo; + + private String costo; + + private String costoScontato; + + private String descrizioneSconto; + + private Date dataScadenza; + + private Date dataScadenzaA; + + private Date dataScadenzaDa; + + public TariffaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TariffaCR() {} + + public void setId_tariffa(long newId_tipoTariffa) { + this.id_tariffa = newId_tipoTariffa; + } + + public void setFlgFM(long newFlgFM) { + this.flgFM = newFlgFM; + } + + public void setFlgPA(long newFlgPA) { + this.flgPA = newFlgPA; + } + + public void setFlgAR(long newFlgAR) { + this.flgAR = newFlgAR; + } + + public void setFlgTablet(long newFlgTablet) { + this.flgTablet = newFlgTablet; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setTitolo(String newTitolo) { + this.titolo = newTitolo; + } + + public void setSottotitolo(String newSottotitolo) { + this.sottotitolo = newSottotitolo; + } + + public void setCosto(String newCosto) { + this.costo = newCosto; + } + + public void setCostoScontato(String newCostoScontato) { + this.costoScontato = newCostoScontato; + } + + public void setDescrizioneSconto(String newDescrizioneSconto) { + this.descrizioneSconto = newDescrizioneSconto; + } + + public void setDataScadenza(Date newDataScadenza) { + this.dataScadenza = newDataScadenza; + } + + public long getId_tariffa() { + return this.id_tariffa; + } + + public long getFlgFM() { + return this.flgFM; + } + + public long getFlgPA() { + return this.flgPA; + } + + public long getFlgAR() { + return this.flgAR; + } + + public long getFlgTablet() { + return this.flgTablet; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : + this.descrizione.trim(); + } + + public String getTitolo() { + return (this.titolo == null) ? "" : this.titolo.trim(); + } + + public String getSottotitolo() { + return (this.sottotitolo == null) ? "" : + this.sottotitolo.trim(); + } + + public String getCosto() { + return (this.costo == null) ? "" : this.costo.trim(); + } + + public String getCostoScontato() { + return (this.costoScontato == null) ? "" : + this.costoScontato.trim(); + } + + public String getDescrizioneSconto() { + return (this.descrizioneSconto == null) ? "" : + this.descrizioneSconto.trim(); + } + + public Date getDataScadenza() { + return this.dataScadenza; + } + + public Date getDataScadenzaA() { + return this.dataScadenzaA; + } + + public void setDataScadenzaA(Date dataScadenzaA) { + this.dataScadenzaA = dataScadenzaA; + } + + public Date getDataScadenzaDa() { + return this.dataScadenzaDa; + } + + public void setDataScadenzaDa(Date dataScadenzaDa) { + this.dataScadenzaDa = dataScadenzaDa; + } + + public String getAR() { + return Tariffa.getAR(getFlgAR()); + } + + public String getFM() { + return Tariffa.getFM(getFlgFM()); + } + + public String getPA() { + return Tariffa.getPA(getFlgPA()); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/OpzioneSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/OpzioneSvlt.java new file mode 100644 index 00000000..d0ffc422 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/OpzioneSvlt.java @@ -0,0 +1,74 @@ +package it.acxent.tarop.servlet; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.tarop.Opzione; +import it.acxent.tarop.OpzioneCR; +import it.acxent.tarop.Tariffa; +import it.acxent.tarop.TariffaCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/Opzione.abl"}) +public class OpzioneSvlt extends _TaropSvlt { + protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) { + Opzione bean = (Opzione)l_bean; + if (getCmd(req).equals("md")) { + req.setAttribute("listaTariffaOpzioni", bean.getTariffe(0, 0)); + req.setAttribute("listaOpzioniTelefoni", bean.getOpzioniArticoli()); + } + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Opzione(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new OpzioneCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected String getCRAttribute(HttpServletRequest req) { + return "CRT"; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + String cmd = getCmd(req); + if (cmd.equals("main")) { + main(req, res); + } else if (cmd.equals("detail")) { + dettaglio(req, res); + } else { + search(req, res); + } + } + + protected void main(HttpServletRequest req, HttpServletResponse res) { + forceJspPageRelative("tariffePromozioni.jsp", req); + callJsp(req, res); + } + + protected void dettaglio(HttpServletRequest req, HttpServletResponse res) { + try { + setJspPageRelative("tariffaCR.jsp", req); + TariffaCR CR = new TariffaCR(getApFull(req)); + fillObject(req, CR); + req.setAttribute("CRT", CR); + Tariffa bean = new Tariffa(getApFull(req)); + req.setAttribute("list", bean.findWebByCR(CR, 0, 0)); + Opzione opzione = new Opzione(getApFull(req)); + OpzioneCR CRO = new OpzioneCR(getApFull(req)); + fillObject(req, CRO); + req.setAttribute("listaOpzioni", opzione.findWebByCR(CRO, 0, 0)); + callJsp(req, res); + } catch (Exception e) { + e.printStackTrace(); + forceMessage(req, e.getMessage()); + } + showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/TariffaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/TariffaSvlt.java new file mode 100644 index 00000000..b0752665 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/TariffaSvlt.java @@ -0,0 +1,93 @@ +package it.acxent.tarop.servlet; + +import it.acxent.contab.Documento; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.tarop.Opzione; +import it.acxent.tarop.OpzioneCR; +import it.acxent.tarop.Tariffa; +import it.acxent.tarop.TariffaCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/Tariffa.abl"}) +public class TariffaSvlt extends _TaropSvlt { + protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) { + Tariffa bean = (Tariffa)l_bean; + if (getCmd(req).equals("md")) + req.setAttribute("listaOpzioniTariffa", bean.getOpzioni(0, 0)); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Tariffa(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TariffaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected void refreshPayment(HttpServletRequest req, HttpServletResponse res) { + try { + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id_documento); + long l_id_tipoPagamento = getRequestLongParameter(req, "id_tipoPagamento"); + bean.setId_tipoPagamento(l_id_tipoPagamento); + ResParm rp = bean.save(); + String theMsg = ""; + req.setAttribute("bean", bean); + forceJspPageRelative("Documento.jsp", req); + callJsp(req, res); + } catch (Exception e) { + e.printStackTrace(); + forceMessage(req, e.getMessage()); + showBean(req, res); + } + } + + protected String getCRAttribute(HttpServletRequest req) { + return "CRT"; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + String cmd = getCmd(req); + if (cmd.equals("main")) { + main(req, res); + } else if (cmd.equals("detail")) { + dettaglio(req, res); + } else { + search(req, res); + } + } + + protected void main(HttpServletRequest req, HttpServletResponse res) { + forceJspPageRelative("tariffePromozioni.jsp", req); + callJsp(req, res); + } + + protected void dettaglio(HttpServletRequest req, HttpServletResponse res) { + try { + setJspPageRelative("tariffaCR.jsp", req); + TariffaCR CR = new TariffaCR(getApFull(req)); + fillObject(req, CR); + req.setAttribute("CRT", CR); + Tariffa bean = new Tariffa(getApFull(req)); + req.setAttribute("list", bean.findWebByCR(CR, 0, 0)); + Opzione opzione = new Opzione(getApFull(req)); + OpzioneCR CRO = new OpzioneCR(getApFull(req)); + fillObject(req, CRO); + req.setAttribute("listaOpzioni", opzione.findWebByCR(CRO, 0, 0)); + callJsp(req, res); + } catch (Exception e) { + e.printStackTrace(); + forceMessage(req, e.getMessage()); + } + showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/_TaropSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/_TaropSvlt.java new file mode 100644 index 00000000..8170d99f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/_TaropSvlt.java @@ -0,0 +1,56 @@ +package it.acxent.tarop.servlet; + +import it.acxent.common.Users; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class _TaropSvlt extends AblServletSvlt { + protected boolean checkLoginProfile(HttpServletRequest req) { + try { + if (getLoginUser(req) == null) { + forceJspPage(getLoginPage(null, null), req); + return true; + } + if (getLoginUser(req).getFlgValido().equals("N")) { + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return false; + } + if (getLoginUser(req).getId_userProfile() > 0L) + return true; + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return true; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + + protected long checkProfile(HttpServletRequest req, String l_permesso) { + return 3L; + } + + protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) { + return "Registra.abl"; + } + + protected Users getUser(HttpServletRequest req) { + return new it.acxent.anag.Users(getApFull(req)); + } + + protected boolean useAlwaysSendRedirect() { + return true; + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + public String getPathImgArticoli() { + return getDocBase() + "/" + getDocBase(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/admin/CategoriaOpzioneSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/admin/CategoriaOpzioneSvlt.java new file mode 100644 index 00000000..17945315 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/admin/CategoriaOpzioneSvlt.java @@ -0,0 +1,33 @@ +package it.acxent.tarop.servlet.admin; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.tarop.CategoriaOpzione; +import it.acxent.tarop.CategoriaOpzioneCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/www/CategoriaOpzione.abl"}) +public class CategoriaOpzioneSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new CategoriaOpzione(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new CategoriaOpzioneCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/admin/OpzioneSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/admin/OpzioneSvlt.java new file mode 100644 index 00000000..b2b7b058 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/admin/OpzioneSvlt.java @@ -0,0 +1,96 @@ +package it.acxent.tarop.servlet.admin; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.tarop.CategoriaOpzione; +import it.acxent.tarop.Opzione; +import it.acxent.tarop.OpzioneArticolo; +import it.acxent.tarop.OpzioneCR; +import it.acxent.util.AbMessages; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@Object(urlPatterns = {"/admin/www/Opzione.abl"}) +public class OpzioneSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + Opzione bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_opzione"); + bean = new Opzione(getApFull(req)); + try { + bean.findByPrimaryKey(l_id); + fillObject(req, bean); + rp = bean.save(); + req.setAttribute("id_opzione", String.valueOf(bean.getId_opzione())); + if (rp.getStatus() == true) { + if (getAct(req).equals("addTelefono")) { + OpzioneArticolo row = new OpzioneArticolo(getApFull(req)); + long l_id_opzioneArticolo = getRequestLongParameter(req, "id_opzioneArticolo"); + fillObject(req, row); + rp = bean.addOpzioneArticolo(row); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delTelefono")) { + OpzioneArticolo row = new OpzioneArticolo(getApFull(req)); + long l_id_opzioneArticolo = getRequestLongParameter(req, "id_opzioneArticolo"); + if (l_id_opzioneArticolo != 0L) { + fillObject(req, row); + bean.delOpzioneArticolo(row); + sendMessage(req, "Cancellazione Effettuata"); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("modTelefono")) { + OpzioneArticolo row = new OpzioneArticolo(getApFull(req)); + long l_id_opzioneArticolo = getRequestLongParameter(req, "id_opzioneArticolo"); + if (l_id_opzioneArticolo != 0L) { + fillObject(req, row); + row.findByPrimaryKey(l_id_opzioneArticolo); + req.setAttribute("bean2", row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } + } else { + req.setAttribute("bean", bean); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, + AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Opzione bean = (Opzione)beanA; + req.setAttribute("listaCategorieOpzioni", new CategoriaOpzione( + getApFull(req)).findAll()); + req.setAttribute("listaTelefoni", bean.getOpzioniArticoli()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Opzione(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new OpzioneCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaCategorieOpzioni", new CategoriaOpzione( + getApFull(req)).findAll()); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/admin/TariffaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/admin/TariffaSvlt.java new file mode 100644 index 00000000..813708f5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tarop/servlet/admin/TariffaSvlt.java @@ -0,0 +1,33 @@ +package it.acxent.tarop.servlet.admin; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.tarop.Tariffa; +import it.acxent.tarop.TariffaCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/www/Tariffa.abl"}) +public class TariffaSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Tariffa(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TariffaCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/MovimentoFilato.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/MovimentoFilato.java new file mode 100644 index 00000000..8b41fa6b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/MovimentoFilato.java @@ -0,0 +1,232 @@ +package it.acxent.tex; + +import it.acxent.anag.Clifor; +import it.acxent.anag.MagFisico; +import it.acxent.contab.CausaleMagazzino; +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.tex.anag.ArticoloFilatoColore; +import it.acxent.tex.anag.Confezione; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class MovimentoFilato extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228168123L; + + private long id_movimentoFilato; + + private long id_rigaDocumento; + + private long id_causaleMagazzino; + + private long id_magFisico; + + private long id_clifor; + + private long id_articoloFilatoColore; + + private long id_confezione; + + private String partita; + + private String bagno; + + private double kg; + + private RigaDocumento rigaDocumento; + + private CausaleMagazzino causaleMagazzino; + + private MagFisico magFisico; + + private Clifor clifor; + + private ArticoloFilatoColore articoloFilatoColore; + + private Confezione confezione; + + public MovimentoFilato(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public MovimentoFilato() {} + + public void setId_movimentoFilato(long newId_movimentoFilato) { + this.id_movimentoFilato = newId_movimentoFilato; + } + + public void setId_rigaDocumento(long newId_rigaDocumento) { + this.id_rigaDocumento = newId_rigaDocumento; + setRigaDocumento(null); + } + + public void setId_causaleMagazzino(long newId_causaleMagazzino) { + this.id_causaleMagazzino = newId_causaleMagazzino; + setCausaleMagazzino(null); + } + + public void setId_magFisico(long newId_magFisico) { + this.id_magFisico = newId_magFisico; + setMagFisico(null); + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_confezione(long newId_confezione) { + this.id_confezione = newId_confezione; + setConfezione(null); + } + + public void setPartita(String newPartita) { + this.partita = newPartita; + } + + public void setBagno(String newBagno) { + this.bagno = newBagno; + } + + public void setKg(double newKg) { + this.kg = newKg; + } + + public long getId_movimentoFilato() { + return this.id_movimentoFilato; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public long getId_causaleMagazzino() { + return this.id_causaleMagazzino; + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_confezione() { + return this.id_confezione; + } + + public String getPartita() { + return (this.partita == null) ? "" : this.partita.trim(); + } + + public String getBagno() { + return (this.bagno == null) ? "" : this.bagno.trim(); + } + + public double getKg() { + return this.kg; + } + + public void setRigaDocumento(RigaDocumento newRigaDocumento) { + this.rigaDocumento = newRigaDocumento; + } + + public RigaDocumento getRigaDocumento() { + this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, getId_rigaDocumento()); + return this.rigaDocumento; + } + + public void setCausaleMagazzino(CausaleMagazzino newCausaleMagazzino) { + this.causaleMagazzino = newCausaleMagazzino; + } + + public CausaleMagazzino getCausaleMagazzino() { + this.causaleMagazzino = (CausaleMagazzino)getSecondaryObject(this.causaleMagazzino, CausaleMagazzino.class, getId_causaleMagazzino()); + return this.causaleMagazzino; + } + + public void setMagFisico(MagFisico newMagFisico) { + this.magFisico = newMagFisico; + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico()); + return this.magFisico; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setArticoloFilatoColore(ArticoloFilatoColore newArticoloFilatoColore) { + this.articoloFilatoColore = newArticoloFilatoColore; + } + + public ArticoloFilatoColore getArticoloFilato() { + this.articoloFilatoColore = (ArticoloFilatoColore)getSecondaryObject(this.articoloFilatoColore, ArticoloFilatoColore.class, + getId_articoloFilatoColore()); + return this.articoloFilatoColore; + } + + public void setConfezione(Confezione newConfezione) { + this.confezione = newConfezione; + } + + public Confezione getConfezione() { + this.confezione = (Confezione)getSecondaryObject(this.confezione, Confezione.class, getId_confezione()); + return this.confezione; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(MovimentoFilatoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from MOVIMENTO_FILATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_articoloFilatoColore() { + return this.id_articoloFilatoColore; + } + + public void setId_articoloFilatoColore(long id_articoloFilatoColore) { + this.id_articoloFilatoColore = id_articoloFilatoColore; + setArticoloFilatoColore(null); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/MovimentoFilatoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/MovimentoFilatoCR.java new file mode 100644 index 00000000..1cf2ca01 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/MovimentoFilatoCR.java @@ -0,0 +1,227 @@ +package it.acxent.tex; + +import it.acxent.anag.Clifor; +import it.acxent.anag.MagFisico; +import it.acxent.contab.CausaleMagazzino; +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.tex.anag.ArticoloFilato; +import it.acxent.tex.anag.ColoreFilato; +import it.acxent.tex.anag.Confezione; + +public class MovimentoFilatoCR extends CRAdapter { + private long id_movimentoFilato; + + private long id_rigaDocumento; + + private long id_causaleMagazzino; + + private long id_magFisico; + + private long id_clifor; + + private long id_articoloFilato; + + private long id_coloreFilato; + + private long id_confezione; + + private String partita; + + private String bagno; + + private double kg; + + private RigaDocumento rigaDocumento; + + private CausaleMagazzino causaleMagazzino; + + private MagFisico magFisico; + + private Clifor clifor; + + private ArticoloFilato articoloFilato; + + private ColoreFilato coloreFilato; + + private Confezione confezione; + + public MovimentoFilatoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public MovimentoFilatoCR() {} + + public void setId_movimentoFilato(long newId_movimentoFilato) { + this.id_movimentoFilato = newId_movimentoFilato; + } + + public void setId_rigaDocumento(long newId_rigaDocumento) { + this.id_rigaDocumento = newId_rigaDocumento; + setRigaDocumento(null); + } + + public void setId_causaleMagazzino(long newId_causaleMagazzino) { + this.id_causaleMagazzino = newId_causaleMagazzino; + setCausaleMagazzino(null); + } + + public void setId_magFisico(long newId_magFisico) { + this.id_magFisico = newId_magFisico; + setMagFisico(null); + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_articoloFilato(long newId_articoloFilato) { + this.id_articoloFilato = newId_articoloFilato; + setArticoloFilato(null); + } + + public void setId_coloreFilato(long newId_coloreFilato) { + this.id_coloreFilato = newId_coloreFilato; + setColoreFilato(null); + } + + public void setId_confezione(long newId_confezione) { + this.id_confezione = newId_confezione; + setConfezione(null); + } + + public void setPartita(String newPartita) { + this.partita = newPartita; + } + + public void setBagno(String newBagno) { + this.bagno = newBagno; + } + + public void setKg(double newKg) { + this.kg = newKg; + } + + public long getId_movimentoFilato() { + return this.id_movimentoFilato; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public long getId_causaleMagazzino() { + return this.id_causaleMagazzino; + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_articoloFilato() { + return this.id_articoloFilato; + } + + public long getId_coloreFilato() { + return this.id_coloreFilato; + } + + public long getId_confezione() { + return this.id_confezione; + } + + public String getPartita() { + return (this.partita == null) ? "" : this.partita.trim(); + } + + public String getBagno() { + return (this.bagno == null) ? "" : this.bagno.trim(); + } + + public double getKg() { + return this.kg; + } + + public void setRigaDocumento(RigaDocumento newRigaDocumento) { + this.rigaDocumento = newRigaDocumento; + } + + public RigaDocumento getRigaDocumento() { + this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, + + getId_rigaDocumento()); + return this.rigaDocumento; + } + + public void setCausaleMagazzino(CausaleMagazzino newCausaleMagazzino) { + this.causaleMagazzino = newCausaleMagazzino; + } + + public CausaleMagazzino getCausaleMagazzino() { + this.causaleMagazzino = (CausaleMagazzino)getSecondaryObject(this.causaleMagazzino, CausaleMagazzino.class, + + getId_causaleMagazzino()); + return this.causaleMagazzino; + } + + public void setMagFisico(MagFisico newMagFisico) { + this.magFisico = newMagFisico; + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, + + getId_magFisico()); + return this.magFisico; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, + + getId_clifor()); + return this.clifor; + } + + public void setArticoloFilato(ArticoloFilato newArticoloFilato) { + this.articoloFilato = newArticoloFilato; + } + + public ArticoloFilato getArticoloFilato() { + this.articoloFilato = (ArticoloFilato)getSecondaryObject(this.articoloFilato, ArticoloFilato.class, + + getId_articoloFilato()); + return this.articoloFilato; + } + + public void setColoreFilato(ColoreFilato newColoreFilato) { + this.coloreFilato = newColoreFilato; + } + + public ColoreFilato getColoreFilato() { + this.coloreFilato = (ColoreFilato)getSecondaryObject(this.coloreFilato, ColoreFilato.class, + + getId_coloreFilato()); + return this.coloreFilato; + } + + public void setConfezione(Confezione newConfezione) { + this.confezione = newConfezione; + } + + public Confezione getConfezione() { + this.confezione = (Confezione)getSecondaryObject(this.confezione, Confezione.class, + + getId_confezione()); + return this.confezione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/MovimentoTessuto.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/MovimentoTessuto.java new file mode 100644 index 00000000..6829000a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/MovimentoTessuto.java @@ -0,0 +1,108 @@ +package it.acxent.tex; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.tex.anag.ArticoloTessuto; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class MovimentoTessuto extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228168145L; + + private long id_movimentoTessuto; + + private long id_articoloTessuto; + + private String serie; + + private String colore; + + private ArticoloTessuto articoloTessuto; + + public MovimentoTessuto(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public MovimentoTessuto() {} + + public void setId_movimentoTessuto(long newId_movimentoTessuto) { + this.id_movimentoTessuto = newId_movimentoTessuto; + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public void setSerie(String newSerie) { + this.serie = newSerie; + } + + public void setColore(String newColore) { + this.colore = newColore; + } + + public long getId_movimentoTessuto() { + return this.id_movimentoTessuto; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public String getSerie() { + return (this.serie == null) ? "" : this.serie.trim(); + } + + public String getColore() { + return (this.colore == null) ? "" : this.colore.trim(); + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, + + getId_articoloTessuto()); + return this.articoloTessuto; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(MovimentoTessutoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from MOVIMENTO_TESSUTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/MovimentoTessutoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/MovimentoTessutoCR.java new file mode 100644 index 00000000..100327d9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/MovimentoTessutoCR.java @@ -0,0 +1,67 @@ +package it.acxent.tex; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.tex.anag.ArticoloTessuto; + +public class MovimentoTessutoCR extends CRAdapter { + private long id_movimentoTessuto; + + private long id_articoloTessuto; + + private String serie; + + private String colore; + + private ArticoloTessuto articoloTessuto; + + public MovimentoTessutoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public MovimentoTessutoCR() {} + + public void setId_movimentoTessuto(long newId_movimentoTessuto) { + this.id_movimentoTessuto = newId_movimentoTessuto; + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public void setSerie(String newSerie) { + this.serie = newSerie; + } + + public void setColore(String newColore) { + this.colore = newColore; + } + + public long getId_movimentoTessuto() { + return this.id_movimentoTessuto; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public String getSerie() { + return (this.serie == null) ? "" : this.serie.trim(); + } + + public String getColore() { + return (this.colore == null) ? "" : this.colore.trim(); + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, + + getId_articoloTessuto()); + return this.articoloTessuto; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Armatura.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Armatura.java new file mode 100644 index 00000000..fce85241 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Armatura.java @@ -0,0 +1,113 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Armatura extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228167115L; + + private long id_armatura; + + private String descrizione; + + private long numLicci; + + private long numColpi; + + private long partenza; + + public Armatura(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Armatura() {} + + public long getId_armatura() { + return this.id_armatura; + } + + public void setId_armatura(long id_armatura) { + this.id_armatura = id_armatura; + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArmaturaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARMATURA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) + wc.addWc("A.descrizione like '%" + CR.getSearchTxt().trim() + "%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getNumLicci() { + return this.numLicci; + } + + public void setNumLicci(long numLicci) { + this.numLicci = numLicci; + } + + public long getNumColpi() { + return this.numColpi; + } + + public void setNumColpi(long numColpi) { + this.numColpi = numColpi; + } + + public long getPartenza() { + return this.partenza; + } + + public void setPartenza(long partenza) { + this.partenza = partenza; + } + + public ResParm salvaDettaglio(Vectumerator vec) { + ResParm rp = new ResParm(true); + while (vec.hasMoreElements()) { + ArmaturaDettaglio row = (ArmaturaDettaglio)vec.nextElement(); + rp = row.save(); + } + return rp; + } + + public boolean isCellaSelezionata(long riga, long colonna) { + boolean ret = false; + ArmaturaDettaglio row = new ArmaturaDettaglio(getApFull()); + row.findByArmaturaRiga(getId_armatura(), riga); + if (row.getDBState() == 1) { + String col = row.getArmaturaRiga().substring((int)colonna - 1, (int)colonna); + if (col.equals("1")) + ret = true; + } + return ret; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArmaturaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArmaturaCR.java new file mode 100644 index 00000000..32d17d00 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArmaturaCR.java @@ -0,0 +1,65 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.io.Serializable; + +public class ArmaturaCR extends CRAdapter implements Serializable { + private static final long serialVersionUID = 1468228167115L; + + private long id_armatura; + + private String descrizione; + + private long numLicci; + + private long numColpi; + + private long partenza; + + public ArmaturaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArmaturaCR() {} + + public long getId_armatura() { + return this.id_armatura; + } + + public void setId_armatura(long id_armatura) { + this.id_armatura = id_armatura; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getNumLicci() { + return this.numLicci; + } + + public void setNumLicci(long numLicci) { + this.numLicci = numLicci; + } + + public long getNumColpi() { + return this.numColpi; + } + + public void setNumColpi(long numColpi) { + this.numColpi = numColpi; + } + + public long getPartenza() { + return this.partenza; + } + + public void setPartenza(long partenza) { + this.partenza = partenza; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArmaturaDettaglio.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArmaturaDettaglio.java new file mode 100644 index 00000000..9a0a4934 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArmaturaDettaglio.java @@ -0,0 +1,112 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ArmaturaDettaglio extends DBAdapter implements Serializable { + private static final long serialVersionUID = 4648124288665405351L; + + private long id_armaturaDettaglio; + + private long id_armatura; + + private long nRiga; + + private String armaturaRiga; + + public ArmaturaDettaglio(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArmaturaDettaglio() {} + + public long getId_armatura() { + return this.id_armatura; + } + + public void setId_armatura(long id_armatura) { + this.id_armatura = id_armatura; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArmaturaDettaglioCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARMATURA_DETTAGLIO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) + wc.addWc("A.descrizione like '%" + CR.getSearchTxt().trim() + "%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_armaturaDettaglio() { + return this.id_armaturaDettaglio; + } + + public void setId_armaturaDettaglio(long id_armaturaDettaglio) { + this.id_armaturaDettaglio = id_armaturaDettaglio; + } + + public long getNRiga() { + return this.nRiga; + } + + public void setNRiga(long nRiga) { + this.nRiga = nRiga; + } + + public String getArmaturaRiga() { + return (this.armaturaRiga == null) ? "" : this.armaturaRiga; + } + + public void setArmaturaRiga(String armaturaRiga) { + this.armaturaRiga = armaturaRiga; + } + + public Vectumerator findByArmatura(long l_id_armatura) { + String s_Sql_Find = "select A.* from ARMATURA_DETTAGLIO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_armatura = " + l_id_armatura); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByArmaturaRiga(long l_id_armatura, long l_nRiga) { + String s_Sql_Find = "select A.* from ARMATURA_DETTAGLIO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_armatura = " + l_id_armatura); + wc.addWc("A.nRiga = " + l_nRiga); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArmaturaDettaglioCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArmaturaDettaglioCR.java new file mode 100644 index 00000000..bfc85b25 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArmaturaDettaglioCR.java @@ -0,0 +1,55 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.io.Serializable; + +public class ArmaturaDettaglioCR extends CRAdapter implements Serializable { + private static final long serialVersionUID = 4648124288665405351L; + + private long id_armaturaDettaglio; + + private long id_armatura; + + private long nRiga; + + private String armaturaRiga; + + public ArmaturaDettaglioCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArmaturaDettaglioCR() {} + + public long getId_armatura() { + return this.id_armatura; + } + + public void setId_armatura(long id_armatura) { + this.id_armatura = id_armatura; + } + + public long getId_armaturaDettaglio() { + return this.id_armaturaDettaglio; + } + + public void setId_armaturaDettaglio(long id_armaturaDettaglio) { + this.id_armaturaDettaglio = id_armaturaDettaglio; + } + + public long getnRiga() { + return this.nRiga; + } + + public void setnRiga(long nRiga) { + this.nRiga = nRiga; + } + + public String getArmaturaRiga() { + return (this.armaturaRiga == null) ? AB_EMPTY_STRING : this.armaturaRiga; + } + + public void setArmaturaRiga(String armaturaRiga) { + this.armaturaRiga = armaturaRiga; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloArticoloTessuto.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloArticoloTessuto.java new file mode 100644 index 00000000..8972fbdb --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloArticoloTessuto.java @@ -0,0 +1,302 @@ +package it.acxent.tex.anag; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloVariante; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ArticoloArticoloTessuto extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1553527279921L; + + private long id_articoloArticoloTessuto; + + private long id_articolo; + + private long id_articoloTessuto; + + private ArticoloVariante articoloVariante; + + private ArticoloTessuto articoloTessuto; + + private long id_articoloVariante; + + private Articolo articolo; + + private long bordaturaMm; + + private ArticoloTessutoColore articoloTessutoColore; + + private long flgPrincipale; + + private long mmATT; + + private long id_articoloTessutoColore; + + public ArticoloArticoloTessuto(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloArticoloTessuto() {} + + public void setId_articoloArticoloTessuto(long newId_articoloArticoloTessuto) { + this.id_articoloArticoloTessuto = newId_articoloArticoloTessuto; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public long getId_articoloArticoloTessuto() { + return this.id_articoloArticoloTessuto; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public double getMtATT() { + DoubleOperator dop = new DoubleOperator((float)getMmATT()); + dop.setScale(4, 1); + dop.divide(1000.0F); + return dop.getResult(); + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, getId_articolo()); + return this.articolo; + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, getId_articoloTessuto()); + return this.articoloTessuto; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloArticoloTessutoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_ARTICOLO_TESSUTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (CR.getId_articoloTessuto() > 0L) + wc.addWc("A.id_articoloTessuto=" + CR.getId_articoloTessuto()); + if (CR.getId_articoloVariante() > 0L) { + wc.addWc("A.id_articoloVariante=" + CR.getId_articoloVariante()); + } else if (CR.getId_articoloVariante() == 0L) { + wc.addWc("(A.id_articoloVariante is null or A.id_articoloVariante=0)"); + } + if (CR.getId_articolo() > 0L) + wc.addWc("A.id_articolo=" + CR.getId_articolo()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ArticoloVariante getArticoloVariante() { + this.articoloVariante = (ArticoloVariante)getSecondaryObject(this.articoloVariante, ArticoloVariante.class, getId_articoloVariante()); + return this.articoloVariante; + } + + public void setArticoloVariante(ArticoloVariante articoloVariante) { + this.articoloVariante = articoloVariante; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + setArticoloVariante(null); + } + + public Vectumerator findByArticolo(long l_id_articolo) { + String s_Sql_Find = "select A.* from ARTICOLO_ARTICOLO_TESSUTO AS A inner join ARTICOLO_TESSUTO as B ON A.id_articoloTessuto= B.id_articoloTessuto"; + String s_Sql_Order = " order by B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + wc.addWc("A.id_articoloVariante is null"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByArticoloVariante(long l_id_articoloVariante) { + String s_Sql_Find = "select A.* from ARTICOLO_ARTICOLO_TESSUTO AS A inner join ARTICOLO_TESSUTO as B ON A.id_articoloTessuto= B.id_articoloTessuto"; + String s_Sql_Order = " order by B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_articoloVariante=" + l_id_articoloVariante); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_articoloTessutoColore() { + return this.id_articoloTessutoColore; + } + + public void setId_articoloTessutoColore(long id_articoloTessutoColore) { + this.id_articoloTessutoColore = id_articoloTessutoColore; + setArticoloTessutoColore(null); + } + + public ArticoloTessutoColore getArticoloTessutoColore() { + this.articoloTessutoColore = (ArticoloTessutoColore)getSecondaryObject(this.articoloTessutoColore, ArticoloTessutoColore.class, + getId_articoloTessutoColore()); + return this.articoloTessutoColore; + } + + public void setArticoloTessutoColore(ArticoloTessutoColore articoloTessutoColore) { + this.articoloTessutoColore = articoloTessutoColore; + } + + public void findByArticoloVarianteArticoloTessutoColore(long l_id_articoloVariante, long l_id_articolotessuto, long l_id_articolotessutoColore) { + String s_Sql_Find = "select A.* from ARTICOLO_ARTICOLO_TESSUTO AS A inner join ARTICOLO_TESSUTO as B ON A.id_articoloTessuto= B.id_articoloTessuto"; + String s_Sql_Order = " order by B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_articoloVariante=" + l_id_articoloVariante); + if (l_id_articolotessuto > 0L) + wc.addWc("A.id_articoloTessuto=" + l_id_articolotessuto); + if (l_id_articolotessutoColore > 0L) + wc.addWc("A.id_articoloTessutoColore=" + l_id_articolotessutoColore); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public void findByArticoloArticoloTessutoBase(long l_id_articolo, long l_id_articolotessuto) { + String s_Sql_Find = "select A.* from ARTICOLO_ARTICOLO_TESSUTO AS A inner join ARTICOLO_TESSUTO as B ON A.id_articoloTessuto= B.id_articoloTessuto"; + String s_Sql_Order = " order by B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + wc.addWc("A.id_articoloTessuto=" + l_id_articolotessuto); + wc.addWc("(A.id_articoloTessutoColore is null or A.id_articoloTessutoColore=0) "); + wc.addWc("A.id_articoloVariante is null"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public void findByArticoloArticoloTessutoColoreBase(long l_id_articolo, long l_id_articolotessutoColore) { + String s_Sql_Find = "select A.* from ARTICOLO_ARTICOLO_TESSUTO AS A inner join ARTICOLO_TESSUTO as B ON A.id_articoloTessuto= B.id_articoloTessuto"; + String s_Sql_Order = " order by B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_articolo=" + l_id_articolo); + wc.addWc("A.id_articoloTessutoColore=" + l_id_articolotessutoColore); + wc.addWc("A.id_articoloVariante is null"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public String getDescrizioneTessuto(String lang) { + if (getId_articoloTessutoColore() > 0L) + return getArticoloTessutoColore().getDescrizioneCompleta(lang); + if (getId_articoloTessuto() > 0L) + return getArticoloTessuto().getDescrizioneCompleta(lang); + return ""; + } + + public String getDescrizioneArticolo(String lang) { + if (getId_articoloTessutoColore() > 0L) + return getArticoloVariante().getDescrizioneCompleta(lang); + if (getId_articolo() > 0L) + return getArticolo().getDescrizioneCompleta(lang); + return ""; + } + + public long getFlgPrincipale() { + return this.flgPrincipale; + } + + public void setFlgPrincipale(long flgPrincipale) { + this.flgPrincipale = flgPrincipale; + } + + public ResParm save() { + if (getFlgPrincipale() == 1L) + resetPrincipaleByArticolo(getId_articolo(), getId_articoloVariante()); + return super.save(); + } + + protected ResParm resetPrincipaleByArticolo(long l_id_articolo, long l_id_articoloVariante) { + String sql = "update ARTICOLO_ARTICOLO_TESSUTO set flgPrincipale = null where id_articolo=" + l_id_articolo; + if (l_id_articoloVariante > 0L) { + sql = sql + " and id_articoloVariante=" + sql; + } else { + sql = sql + " and (id_articoloVariante is null or id_articoloVariante=0)"; + } + return update(sql); + } + + public long getMmATT() { + return this.mmATT; + } + + public void setMmATT(long mmATT) { + this.mmATT = mmATT; + } + + public long getBordaturaMm() { + return this.bordaturaMm; + } + + public void setBordaturaMm(long bordaturaMm) { + this.bordaturaMm = bordaturaMm; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloArticoloTessutoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloArticoloTessutoCR.java new file mode 100644 index 00000000..3f93abc2 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloArticoloTessutoCR.java @@ -0,0 +1,91 @@ +package it.acxent.tex.anag; + +import it.acxent.art.Articolo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloArticoloTessutoCR extends CRAdapter { + private long id_articoloArticoloTessuto; + + private long id_articolo; + + private long id_articoloTessuto; + + private double mtATT; + + private Articolo articolo; + + private ArticoloTessuto articoloTessuto; + + private long id_articoloVariante = -1L; + + public ArticoloArticoloTessutoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloArticoloTessutoCR() {} + + public void setId_articoloArticoloTessuto(long newId_articoloArticoloTessuto) { + this.id_articoloArticoloTessuto = newId_articoloArticoloTessuto; + } + + public void setId_articolo(long newId_articolo) { + this.id_articolo = newId_articolo; + setArticolo(null); + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public void setMtATT(double newMtATT) { + this.mtATT = newMtATT; + } + + public long getId_articoloArticoloTessuto() { + return this.id_articoloArticoloTessuto; + } + + public long getId_articolo() { + return this.id_articolo; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public double getMtATT() { + return this.mtATT; + } + + public void setArticolo(Articolo newArticolo) { + this.articolo = newArticolo; + } + + public Articolo getArticolo() { + this.articolo = (Articolo)getSecondaryObject(this.articolo, Articolo.class, + + getId_articolo()); + return this.articolo; + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, + + getId_articoloTessuto()); + return this.articoloTessuto; + } + + public long getId_articoloVariante() { + return this.id_articoloVariante; + } + + public void setId_articoloVariante(long id_articoloVariante) { + this.id_articoloVariante = id_articoloVariante; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilato.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilato.java new file mode 100644 index 00000000..e7ac28b0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilato.java @@ -0,0 +1,410 @@ +package it.acxent.tex.anag; + +import it.acxent.anag.Iva; +import it.acxent.anag.MagFisico; +import it.acxent.anag._AnagAdapter; +import it.acxent.art.Articolo; +import it.acxent.art.Tipo; +import it.acxent.art.TipologiaArticolo; +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.StringTokenizer; + +public class ArticoloFilato extends _AnagAdapter implements Serializable { + private static final long serialVersionUID = 1468228166479L; + + private long id_articoloFilato; + + private String descrizione; + + private long titolo; + + private long nCapi; + + private long flgNaturaTinto; + + private long id_tipo; + + private Tipo tipo; + + private long id_iva; + + private Iva iva; + + private long flgDispo; + + private boolean quantitaCalcolate; + + private double quantitaEffettiva; + + private double quantitaImpegnata; + + private double quantitaInArrivo; + + private String quantitaMagazzinoMovimentoHtml; + + private double quantitaW; + + private String codiceAF; + + private double quantita; + + private long id_magFisico; + + private MagFisico magFisico; + + public ArticoloFilato(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloFilato() {} + + public void setId_articoloFilato(long newId_articoloFilato) { + this.id_articoloFilato = newId_articoloFilato; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setTitolo(long newTitolo) { + this.titolo = newTitolo; + } + + public void setNCapi(long newNCapi) { + this.nCapi = newNCapi; + } + + public void setFlgNaturaTinto(long newFlgNaturaTinto) { + this.flgNaturaTinto = newFlgNaturaTinto; + } + + public long getId_articoloFilato() { + return this.id_articoloFilato; + } + + public String getDescrizione() { + return (this.descrizione == null) ? getCodiceAF() : this.descrizione.trim(); + } + + public long getTitolo() { + return this.titolo; + } + + public long getNCapi() { + return this.nCapi; + } + + public long getFlgNaturaTinto() { + return this.flgNaturaTinto; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloFilatoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_FILATO AS A "; + String s_Sql_Order = " order by A.codiceAF,A.descrizione"; + if ((!CR.getSearchTxt().isEmpty() && !CR.getSearchTxt().equals("*")) || CR.getFlgQta() == 1L) + s_Sql_Find = s_Sql_Find + " LEFT JOIN ARTICOLO_FILATO_COLORE AS B ON A.id_articoloFilato=B.id_articoloFilato"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_tipo() > 0L) + wc.addWc("A.id_tipo=" + CR.getId_tipo()); + if (CR.getFlgQta() == 1L) + if (CR.getQtaDa() == 0L) { + wc.addWc("(A.quantitaW<=" + CR.getQtaA() + " or B.quantitaAfc<=" + CR.getQtaA() + ")"); + } else { + wc.addWc("(A.quantitaW>=" + CR.getQtaDa() + " or B.quantitaAfc>=" + CR.getQtaDa() + ")"); + wc.addWc("(A.quantitaW<=" + CR.getQtaA() + " or B.quantitaAfc<=" + CR.getQtaA() + ")"); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getId_tipo() { + return this.id_tipo; + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo()); + return this.tipo; + } + + public void setId_tipo(long id_tipo) { + this.id_tipo = id_tipo; + setTipo(null); + } + + public void setTipo(Tipo tipo) { + this.tipo = tipo; + } + + public TipologiaArticolo getTipologiaArticolo() { + return getTipo().getTipologiaArticolo(); + } + + public long getId_iva() { + return this.id_iva; + } + + public Iva getIva() { + this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, getId_iva()); + return this.iva; + } + + public void setId_iva(long newId_iva) { + this.id_iva = newId_iva; + setIva(null); + } + + public void setIva(Iva newIva) { + this.iva = newIva; + } + + public Iva getIva(it.acxent.anag.Clifor l_clifor) { + this.iva = null; + if (l_clifor == null || l_clifor.getId_clifor() == 0L) { + this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, new Long(getId_iva())); + } else { + this.iva = new Iva(getApFull()); + this.iva.findByPrimaryKey(getId_iva(l_clifor)); + } + return this.iva; + } + + public long getId_iva(it.acxent.anag.Clifor l_clifor) { + if (l_clifor != null && l_clifor.getId_clifor() != 0L) { + if (l_clifor.getFlgArt8() == 1L) + return getCodiceIvaArt8_A(); + return this.id_iva; + } + return this.id_iva; + } + + public ResParm superSave() { + return save(); + } + + private synchronized void calcolaQuantita() { + if ((!isQuantitaCalcolate() ? true : false) & ((this.id_articoloFilato != 0L) ? true : false)) { + long l_flgDispo; + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagFilatoDisponibilita(0L, getId_articoloFilato(), 0L, null, 0L, 0L, 0L, null); + double q = rd.getQuantita(); + double nr = rd.getNr(); + double kg = rd.getKg(); + double mt = rd.getMt(); + setQuantitaW(q); + setQuantita(q); + setQuantitaImpegnata(new RigaDocumento(getApFull()).getQuantitaImpegnataFilatoByArticoloFilatoColoreSeriale(0L, + getId_articoloFilato(), 0L, "")); + double q1 = new RigaDocumento(getApFull()).getQuantitaFilatoInArrivoByArticoloFilatoColoreSeriale(0L, getId_articoloFilato(), 0L, ""); + setQuantitaInArrivo(q1); + if (getTipo().getFlgTipoMagazzino() != 9L && getTipo().getFlgTipoMagazzino() != 9L) { + DoubleOperator dop = new DoubleOperator(q); + dop.add(this.quantitaInArrivo); + dop.subtract(this.quantitaImpegnata); + setQuantitaEffettiva(dop.getResult()); + } + this.quantitaMagazzinoMovimentoHtml = Articolo.getMovimentoHtmlDesc(getTipologiaArticolo(), q, nr, kg, mt, this.quantitaInArrivo, this.quantitaImpegnata, this.quantitaEffettiva, + usaMagazzino(), getParm("USA_MAGAZZINO").isTrue(), + getNf()); + if (!usaMagazzino()) { + l_flgDispo = 1L; + } else { + l_flgDispo = (this.quantitaW > 0.0D) ? 1L : 0L; + } + String temp = "update ARTICOLO_FILATO set quantitaMagazzinoMovimentoHtml='" + this.quantitaMagazzinoMovimentoHtml + "', quantitaW=" + this.quantitaW + ", quantitaEffettiva=" + this.quantitaEffettiva + ", quantitaImpegnata=" + this.quantitaImpegnata + ", quantitaCalcolate=true, flgDispo=" + l_flgDispo + " where id_articoloFilato=" + + + getId_articoloFilato(); + update(temp); + setQuantitaCalcolate(true); + } + } + + public double getQuantitaEffettiva() { + if (!isQuantitaCalcolate() && this.id_articoloFilato != 0L) + calcolaQuantita(); + return this.quantitaEffettiva; + } + + public double getQuantitaImpegnata() { + if (!isQuantitaCalcolate() && this.id_articoloFilato != 0L) + calcolaQuantita(); + return this.quantitaImpegnata; + } + + public double getQuantitaInArrivo() { + if (!isQuantitaCalcolate() && this.id_articoloFilato != 0L) + calcolaQuantita(); + return this.quantitaInArrivo; + } + + public String getQuantitaMagazzinoMovimentoHtml() { + if (getParm("USA_MAGAZZINO").isTrue()) + return "--"; + if (!isQuantitaCalcolate() && this.id_articoloFilato != 0L) + calcolaQuantita(); + return (this.quantitaMagazzinoMovimentoHtml == null) ? "" : this.quantitaMagazzinoMovimentoHtml; + } + + public double getQuantitaW() { + if (!isQuantitaCalcolate() && this.id_articoloFilato != 0L) + calcolaQuantita(); + return this.quantitaW; + } + + public boolean isQuantitaCalcolate() { + return this.quantitaCalcolate; + } + + public void setQuantitaCalcolate(boolean quantitaCalcolate) { + this.quantitaCalcolate = quantitaCalcolate; + } + + public void setQuantitaEffettiva(double quantitaEffettiva) { + this.quantitaEffettiva = quantitaEffettiva; + } + + public void setQuantitaImpegnata(double quantitaImpegnata) { + this.quantitaImpegnata = quantitaImpegnata; + } + + public void setQuantitaInArrivo(double quantitaInArrivo) { + this.quantitaInArrivo = quantitaInArrivo; + } + + public void setQuantitaMagazzinoMovimentoHtml(String quantitaMagazzinoMovimentoHtml) { + this.quantitaMagazzinoMovimentoHtml = quantitaMagazzinoMovimentoHtml; + } + + public void setQuantitaW(double quantitaW) { + this.quantitaW = quantitaW; + } + + public long getFlgDispo() { + return this.flgDispo; + } + + public void setFlgDispo(long flgDispo) { + this.flgDispo = flgDispo; + } + + public void resetCalcoloQuantita() { + if (getId_articoloFilato() > 0L) { + update("update ARTICOLO_FILATO set quantitaCalcolate=false where id_articoloFilato=" + getId_articoloFilato()); + setQuantitaCalcolate(false); + } + } + + public boolean usaMagazzino() { + if (getTipo().getFlgTipoMagazzino() == 9L || getTipo().getFlgTipoMagazzino() == 0L) + return false; + return true; + } + + public String getCodiceAF() { + return (this.codiceAF == null) ? "" : this.codiceAF.trim(); + } + + public void setCodiceAF(String nota) { + this.codiceAF = nota; + } + + public String getDescrizioneCompleta() { + return getCodiceAF() + " " + getCodiceAF(); + } + + public void findByCodice(String l_codiceAF) { + String s_Sql_Find = "select A.* from ARTICOLO_FILATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codiceAF='" + l_codiceAF + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public double getQuantita() { + return getQuantita(null); + } + + public void setQuantita(double quantita) { + this.quantita = quantita; + } + + public double getQuantita(Date data) { + if (!usaMagazzino()) + return 0.0D; + if (getParm("USA_MAGAZZINO").isFalse()) { + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagFilatoDisponibilita(0L, getId_articoloFilato(), 0L, null, 0L, getId_magFisico(), 0L, data); + return rd.getQuantita(); + } + return this.quantita; + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico()); + return this.magFisico; + } + + public void setId_magFisico(long id_magFisico) { + this.id_magFisico = id_magFisico; + setMagFisico(null); + } + + public void setMagFisico(MagFisico magFisico) { + this.magFisico = magFisico; + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + try { + if (isColumnInResultSet(rst, "id_magFisico")) + setId_magFisico(rst.getLong("id_magFisico")); + if (isColumnInResultSet(rst, "quantita")) + setQuantita(rst.getDouble("quantita")); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoCR.java new file mode 100644 index 00000000..f228e428 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoCR.java @@ -0,0 +1,115 @@ +package it.acxent.tex.anag; + +import it.acxent.art.Tipo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloFilatoCR extends CRAdapter { + private long id_articoloFilato; + + private String descrizione; + + private long titolo; + + private long nCapi; + + private long flgNaturaTinto; + + private long id_tipo; + + private Tipo tipo; + + private long flgQta; + + private long qtaA = 9999L; + + private long qtaDa = 1L; + + public ArticoloFilatoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloFilatoCR() {} + + public void setId_articoloFilato(long newId_articoloFilato) { + this.id_articoloFilato = newId_articoloFilato; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setTitolo(long newTitolo) { + this.titolo = newTitolo; + } + + public void setNCapi(long newNCapi) { + this.nCapi = newNCapi; + } + + public void setFlgNaturaTinto(long newFlgNaturaTinto) { + this.flgNaturaTinto = newFlgNaturaTinto; + } + + public long getId_articoloFilato() { + return this.id_articoloFilato; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getTitolo() { + return this.titolo; + } + + public long getNCapi() { + return this.nCapi; + } + + public long getFlgNaturaTinto() { + return this.flgNaturaTinto; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo()); + return this.tipo; + } + + public void setId_tipo(long id_tipo) { + this.id_tipo = id_tipo; + setTipo(null); + } + + public void setTipo(Tipo tipo) { + this.tipo = tipo; + } + + public long getFlgQta() { + return this.flgQta; + } + + public void setFlgQta(long flgQta) { + this.flgQta = flgQta; + } + + public long getQtaA() { + return this.qtaA; + } + + public void setQtaA(long qtaA) { + this.qtaA = qtaA; + } + + public long getQtaDa() { + return this.qtaDa; + } + + public void setQtaDa(long qtaDa) { + this.qtaDa = qtaDa; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoColore.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoColore.java new file mode 100644 index 00000000..d0cab7a5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoColore.java @@ -0,0 +1,565 @@ +package it.acxent.tex.anag; + +import it.acxent.anag.Iva; +import it.acxent.anag.MagFisico; +import it.acxent.anag._AnagAdapter; +import it.acxent.art.Articolo; +import it.acxent.art.TipologiaArticolo; +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.StringTokenizer; + +public class ArticoloFilatoColore extends _AnagAdapter implements Serializable { + private static final long serialVersionUID = 1468228166501L; + + private long id_articoloFilatoColore; + + private long id_articoloFilato; + + private long id_coloreFilato; + + private long id_magFisico; + + private MagFisico magFisico; + + private double perc; + + private double quantitaInArrivo; + + private double quantitaImpegnata; + + private ArticoloFilato articoloFilato; + + private ColoreFilato coloreFilato; + + private boolean quantitaCalcolate; + + private String quantitaMagazzinoMovimentoHtml; + + private double quantitaEffettiva; + + private long flgDispo; + + private String seriale; + + private double quantitaAfc; + + private boolean quantitaDataCalcolate = false; + + private double quantitaData; + + private double quantitaAfcW; + + public ArticoloFilatoColore(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloFilatoColore() {} + + public long getId_articoloFilatoColore() { + return this.id_articoloFilatoColore; + } + + public void setId_articoloFilatoColore(long id_articoloFilatoColore) { + this.id_articoloFilatoColore = id_articoloFilatoColore; + } + + public void setId_articoloFilato(long newId_articoloFilato) { + this.id_articoloFilato = newId_articoloFilato; + setArticoloFilato(null); + } + + public void setId_coloreFilato(long newId_coloreFilato) { + this.id_coloreFilato = newId_coloreFilato; + setColoreFilato(null); + } + + public void setPerc(double newPerc) { + this.perc = newPerc; + } + + public long getId_articoloFilato() { + return this.id_articoloFilato; + } + + public long getId_coloreFilato() { + return this.id_coloreFilato; + } + + public double getPerc() { + return this.perc; + } + + public void setArticoloFilato(ArticoloFilato newArticoloFilato) { + this.articoloFilato = newArticoloFilato; + } + + public ArticoloFilato getArticoloFilato() { + this.articoloFilato = (ArticoloFilato)getSecondaryObject(this.articoloFilato, ArticoloFilato.class, getId_articoloFilato()); + return this.articoloFilato; + } + + public void setColoreFilato(ColoreFilato newColoreFilato) { + this.coloreFilato = newColoreFilato; + } + + public ColoreFilato getColoreFilato() { + this.coloreFilato = (ColoreFilato)getSecondaryObject(this.coloreFilato, ColoreFilato.class, getId_coloreFilato()); + return this.coloreFilato; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloFilatoColoreCR CR, int pageNumber, int pageRows) { + if (CR.getFlgTipoRicerca() == 1L) + return findByCRDispoMagazzino(CR, pageNumber, pageRows); + String s_Sql_Find = "select A.* from ARTICOLO_FILATO_COLORE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + s_Sql_Find = s_Sql_Find + " inner join ARTICOLO_FILATO AS B ON A.id_articoloFilato=B.id_articoloFilato inner join COLORE_FILATO AS C ON A.id_coloreFilato=C.id_coloreFilato"; + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(B.descrizione like '%" + token + "%' or C.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByArticoloFilato(long id_articoloFilato) { + String s_Sql_Find = "select A.* from ARTICOLO_FILATO_COLORE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_articoloFilato = " + id_articoloFilato); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByFilatoColore(long id_articoloFilato, long id_coloreFilato) { + String s_Sql_Find = "select A.* from ARTICOLO_FILATO_COLORE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_articoloFilato = " + id_articoloFilato); + wc.addWc(" A.id_coloreFilato = " + id_coloreFilato); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public Vectumerator findByCRSerMagazzino(ArticoloFilatoColoreCR CR, int pageNumber, int pageRows) { + try { + Vectumerator vec = new Vectumerator(); + String sql = "SELECT M.id_magFisico as id_magFisico,M.id_articoloFilatoColore as id_artmov, A.id_articoloFilatoColore,A.id_articoloFilato,A.id_ColoreFilato, M.id_clifor, M.seriale, SUM(segnoMov*kg) as quantitaAfc, SUM(segnoMov*kg) as kg, SUM(segnoMov*mt) as mt, SUM(segnoMov*nr) as nr, B.id_tipo,B.percSconto,B.id_iva,B.prezzoOfferta,B.prezzoPubblico FROM RIGA_DOCUMENTO AS M INNER JOIN ARTICOLO_FILATO_COLORE AS A ON A.id_articoloFilatoColore=M.id_articoloFilatoColore inner join ARTICOLO_FILATO AS B ON A.id_articoloFilato=B.id_articoloFilato"; + String s_Sql_GrouBy = " group by M.id_articoloFilatoColore, M.id_clifor, M.seriale ,M.id_magFisico "; + String s_Sql_Having = " HAVING ( kg>0 and A.id_articoloFilatoColore>0 and M.seriale is not null ) "; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + token = prepareInputMySqlString(token, false); + token = token.replace("*", "%"); + txt.append("(B.descrizione like '%" + token + "%' )"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (isDeleteLogic()) + if (CR.getFlgShowDeleteLogic() == 0L) { + wc.addWc("A.dataFineVld is null"); + } else { + wc.addWc("A.dataFineVld is not null"); + } + if (CR.getId_clifor() != 0L && CR.getMagFisico().getFlgTipo() == 0L) { + wc.addWc("(M.id_clifor=" + CR.getId_clifor() + ")"); + } else { + wc.addWc("(M.id_clifor=0 or M.id_clifor is null )"); + } + if (CR.getId_magFisico() > 0L) + wc.addWc(" M.id_magFisico=" + CR.getId_magFisico()); + String s_Sql_Find1 = "select 0 as id_magFisico, 0 as id_artmov, A.id_articoloFilatoColore,A.id_articoloFilato,A.id_ColoreFilato,0 as id_clifor,null as seriale,0 as quantitaAfc,0 as kg, 0 as mt, 0 as nr, B.id_tipo,B.percSconto,B.id_iva,B.prezzoOfferta,B.prezzoPubblico from ARTICOLO_FILATO_COLORE AS A inner join ARTICOLO_FILATO AS B ON A.id_articoloFilato=B.id_articoloFilato inner join TIPO as T on B.id_tipo=T.id_tipo"; + String s_Sql_Order = " "; + WcString wc1 = new WcString(); + wc1.addWc("(T.flgTipoMagazzino!=2 AND T.flgTipoMagazzino!=3)"); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + token = prepareInputMySqlString(token, false); + token = token.replace("*", "%"); + txt.append("(B.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc1.addWc(txt.toString()); + } + if (isDeleteLogic()) + if (CR.getFlgShowDeleteLogic() == 0L) { + wc1.addWc("A.dataFineVld is null"); + } else { + wc1.addWc("A.dataFineVld is not null"); + } + wc1.addWc(" (A.flgDispo > 0 ) "); + PreparedStatement stmt = getConn().prepareStatement("(" + sql + wc.toString() + s_Sql_GrouBy + s_Sql_Having + ") union (" + s_Sql_Find1 + + wc1.toString() + s_Sql_Order + ")"); + return findRows(stmt, pageNumber, 50); + } catch (SQLException e) { + handleDebug(e); + e.printStackTrace(); + return AB_EMPTY_VECTUMERATOR; + } + } + + private synchronized void calcolaQuantita() { + if ((!isQuantitaCalcolate() ? true : false) & ((this.id_articoloFilatoColore != 0L) ? true : false)) { + long l_flgDispo; + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagFilatoDisponibilita(getId_articoloFilatoColore(), 0L, 0L, null, 0L, 0L, 0L, null); + double q = rd.getQuantita(); + double nr = rd.getNr(); + double kg = rd.getKg(); + double mt = rd.getMt(); + setQuantitaAfcW(q); + setQuantitaAfc(q); + setQuantitaImpegnata(new RigaDocumento(getApFull()) + .getQuantitaImpegnataFilatoByArticoloFilatoColoreSeriale(getId_articoloFilatoColore(), 0L, 0L, "")); + double q1 = new RigaDocumento(getApFull()).getQuantitaFilatoInArrivoByArticoloFilatoColoreSeriale(getId_articoloFilatoColore(), 0L, 0L, ""); + setQuantitaInArrivo(q1); + if (getArticoloFilato().usaMagazzino()) { + DoubleOperator dop = new DoubleOperator(q); + dop.add(this.quantitaInArrivo); + dop.subtract(this.quantitaImpegnata); + setQuantitaEffettiva(dop.getResult()); + } + this.quantitaMagazzinoMovimentoHtml = Articolo.getMovimentoHtmlDesc(getTipologiaArticolo(), q, nr, kg, mt, this.quantitaInArrivo, this.quantitaImpegnata, this.quantitaEffettiva, + getArticoloFilato().usaMagazzino(), + getParm("USA_MAGAZZINO").isTrue(), getNf()); + if (!getArticoloFilato().usaMagazzino()) { + l_flgDispo = 1L; + } else { + l_flgDispo = (this.quantitaAfc > 0.0D) ? 1L : 0L; + } + String temp = "update ARTICOLO_FILATO_COLORE set quantitaMagazzinoMovimentoHtml='" + this.quantitaMagazzinoMovimentoHtml + "', quantitaAfc=" + this.quantitaAfc + ", quantitaEffettiva=" + this.quantitaEffettiva + ", quantitaImpegnata=" + this.quantitaImpegnata + ", quantitaCalcolate=true, flgDispo=" + l_flgDispo + " where id_articoloFilatoColore=" + + + + getId_articoloFilatoColore(); + update(temp); + setQuantitaCalcolate(true); + } + } + + public boolean isQuantitaCalcolate() { + return this.quantitaCalcolate; + } + + public void setQuantitaCalcolate(boolean quantitaCalcolate) { + this.quantitaCalcolate = quantitaCalcolate; + } + + public String getQuantitaMagazzinoMovimentoHtml() { + if (getParm("USA_MAGAZZINO").isTrue()) + return "--"; + if (!isQuantitaCalcolate() && this.id_articoloFilatoColore != 0L) + calcolaQuantita(); + return (this.quantitaMagazzinoMovimentoHtml == null) ? "" : this.quantitaMagazzinoMovimentoHtml; + } + + public void setQuantitaMagazzinoMovimentoHtml(String quantitaMagazzinoMovimentoHtml) { + this.quantitaMagazzinoMovimentoHtml = quantitaMagazzinoMovimentoHtml; + } + + public String getDescrizioneCompleta() { + if (getId_articoloFilato() == 0L) + return ""; + return getArticoloFilato().getDescrizione() + " - " + getArticoloFilato().getDescrizione(); + } + + public double getQuantitaInArrivo() { + if (!isQuantitaCalcolate() && this.id_articoloFilatoColore != 0L) + calcolaQuantita(); + return this.quantitaInArrivo; + } + + public void setQuantitaInArrivo(double quantitaInArrivo) { + this.quantitaInArrivo = quantitaInArrivo; + } + + public double getQuantitaImpegnata() { + if (!isQuantitaCalcolate() && this.id_articoloFilatoColore != 0L) + calcolaQuantita(); + return this.quantitaImpegnata; + } + + public void setQuantitaImpegnata(double quantitaImpegnata) { + this.quantitaImpegnata = quantitaImpegnata; + } + + public TipologiaArticolo getTipologiaArticolo() { + return getArticoloFilato().getTipo().getTipologiaArticolo(); + } + + public double getQuantitaEffettiva() { + if (!isQuantitaCalcolate() && this.id_articoloFilatoColore != 0L) + calcolaQuantita(); + return this.quantitaEffettiva; + } + + public void setQuantitaEffettiva(double quantitaEffettiva) { + this.quantitaEffettiva = quantitaEffettiva; + } + + public long getFlgDispo() { + return this.flgDispo; + } + + public void setFlgDispo(long flgDispo) { + this.flgDispo = flgDispo; + } + + public Iva getIva(it.acxent.anag.Clifor l_clifor) { + return getArticoloFilato().getIva(l_clifor); + } + + public long getId_iva(it.acxent.anag.Clifor l_clifor) { + return getArticoloFilato().getId_iva(l_clifor); + } + + public boolean isUsaSeriale() { + return (getArticoloFilato().getTipo().getFlgTipoMagazzino() == 2L); + } + + public boolean isUsaMagazzino() { + return (isUsaLotti() || isUsaSeriale()); + } + + public ResParm superSave() { + return save(); + } + + public boolean isUsaLotti() { + return (getArticoloFilato().getTipo().getFlgTipoMagazzino() == 3L); + } + + public String getSeriale() { + return (this.seriale == null) ? "" : this.seriale.trim(); + } + + public void setSeriale(String seriale) { + this.seriale = seriale; + } + + public void setQuantitaAfc(double quantita) { + this.quantitaAfc = quantita; + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + try { + if (isColumnInResultSet(rst, "seriale")) + setSeriale(rst.getString("seriale")); + if (isColumnInResultSet(rst, "id_magFisico")) + setId_magFisico(rst.getLong("id_magFisico")); + if (isColumnInResultSet(rst, "quantitaAfc")) + setQuantitaAfc(rst.getDouble("quantitaAfc")); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public Vectumerator findByCRDispoMagazzino(ArticoloFilatoColoreCR CR, int pageNumber, int pageRows) { + try { + String sql = "SELECT M.id_magFisico, M.id_articoloFilatoColore as id_artmov, A.id_articoloFilatoColore,A.id_articoloFilato,A.id_ColoreFilato, M.id_clifor, M.seriale, SUM(segnoMov*kg) as quantitaAfc, SUM(segnoMov*kg) as kg, SUM(segnoMov*mt) as mt, SUM(segnoMov*nr) as nr, B.id_tipo,B.percSconto,B.id_iva,B.prezzoOfferta,B.prezzoPubblico FROM RIGA_DOCUMENTO AS M INNER JOIN ARTICOLO_FILATO_COLORE AS A ON A.id_articoloFilatoColore=M.id_articoloFilatoColore inner join ARTICOLO_FILATO AS B ON A.id_articoloFilato=B.id_articoloFilato"; + String s_Sql_GrouBy = " group by M.id_articoloFilatoColore, M.id_clifor, M.seriale ,M.id_magFisico"; + String s_Sql_Having = " HAVING ( kg>0 and A.id_articoloFilatoColore>0 and M.seriale is not null ) "; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + token = prepareInputMySqlString(token, false); + token = token.replace("*", "%"); + txt.append("(B.descrizione like '%" + token + "%' )"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (isDeleteLogic()) + if (CR.getFlgShowDeleteLogic() == 0L) { + wc.addWc("A.dataFineVld is null"); + } else { + wc.addWc("A.dataFineVld is not null"); + } + if (CR.getId_clifor() != 0L && CR.getMagFisico().getFlgTipo() != 1L) { + wc.addWc("(M.id_clifor=" + CR.getId_clifor() + ")"); + } else { + wc.addWc("(M.id_clifor=0 or M.id_clifor is null )"); + } + if (CR.getId_magFisico() > 0L) + wc.addWc(" M.id_magFisico=" + CR.getId_magFisico()); + if (CR.getId_articoloFilato() > 0L) + wc.addWc(" A.id_articoloFilato=" + CR.getId_articoloFilato()); + if (CR.getId_articoloFilatoColore() > 0L) + wc.addWc(" M.id_articoloFilatoColore=" + CR.getId_articoloFilatoColore()); + PreparedStatement stmt = getConn().prepareStatement(sql + sql + wc.toString() + s_Sql_GrouBy); + return findRows(stmt, pageNumber, 50); + } catch (SQLException e) { + handleDebug(e); + e.printStackTrace(); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getRealTimeQuantitaImpegnata() { + return new RigaDocumento(getApFull()).getQuantitaImpegnataFilatoByArticoloFilatoColoreSeriale(getId_articoloFilatoColore(), 0L, 0L, + getSeriale()); + } + + public double getRealTimeQuantitaInArrivo() { + double q1 = new RigaDocumento(getApFull()).getQuantitaFilatoInArrivoByArticoloFilatoColoreSeriale(getId_articoloFilatoColore(), 0L, 0L, + getSeriale()); + return q1; + } + + public void resetCalcoloQuantita() { + if (getId_articoloFilatoColore() > 0L) { + update("update ARTICOLO_FILATO_COLORE set quantitaCalcolate=false where id_articoloFilatoColore=" + + getId_articoloFilatoColore()); + setQuantitaCalcolate(false); + } + } + + public boolean usaMagazzino() { + if (getArticoloFilato().getTipo().getFlgTipoMagazzino() == 9L || + getArticoloFilato().getTipo().getFlgTipoMagazzino() == 0L) + return false; + return true; + } + + public double getQuantitaV() { + return this.quantitaAfc; + } + + public double getQuantitaAfc(Date data) { + if (!usaMagazzino()) + return 0.0D; + if (getParm("USA_MAGAZZINO").isFalse()) { + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagFilatoDisponibilita(getId_articoloFilatoColore(), 0L, 0L, getSeriale(), 0L, + getId_magFisico(), 0L, data); + return rd.getQuantita(); + } + return this.quantitaAfc; + } + + public double getQuantitaData(Date data) { + if (!isQuantitaDataCalcolate()) { + this.quantitaData = getQuantitaAfc(data); + setQuantitaDataCalcolate(true); + } + return this.quantitaData; + } + + public boolean isQuantitaDataCalcolate() { + return this.quantitaDataCalcolate; + } + + public void setQuantitaDataCalcolate(boolean quantitaDataCalcolate) { + this.quantitaDataCalcolate = quantitaDataCalcolate; + } + + public double getQuantitaData() { + return this.quantitaData; + } + + public void setQuantitaData(double quantitaData) { + this.quantitaData = quantitaData; + } + + public double getQuantitaAfc() { + return getQuantitaAfc(null); + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public void setId_magFisico(long id_magFisico) { + this.id_magFisico = id_magFisico; + setMagFisico(null); + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico()); + return this.magFisico; + } + + public void setMagFisico(MagFisico magFisico) { + this.magFisico = magFisico; + } + + public double getQuantitaAfcW() { + if (!isQuantitaCalcolate() && this.id_articoloFilatoColore != 0L) + calcolaQuantita(); + return this.quantitaAfcW; + } + + public void setQuantitaAfcW(double quantitaAfcW) { + this.quantitaAfcW = quantitaAfcW; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoColoreCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoColoreCR.java new file mode 100644 index 00000000..4f20ef2b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoColoreCR.java @@ -0,0 +1,134 @@ +package it.acxent.tex.anag; + +import it.acxent.anag.MagFisico; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.io.Serializable; + +public class ArticoloFilatoColoreCR extends CRAdapter implements Serializable { + private static final long serialVersionUID = 1468228166501L; + + private long id_articoloFilatoColore; + + private long id_articoloFilato; + + private long id_coloreFilato; + + private double perc; + + private ArticoloFilato articoloFilato; + + private ColoreFilato coloreFilato; + + private long flgTipoRicerca = 0L; + + private long id_clifor; + + private long id_magFisico; + + private MagFisico magFisico; + + private it.acxent.anag.Clifor clifor; + + public ArticoloFilatoColoreCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloFilatoColoreCR() {} + + public long getId_articoloFilatoColore() { + return this.id_articoloFilatoColore; + } + + public void setId_articoloFilatoColore(long id_articoloFilatoColore) { + this.id_articoloFilatoColore = id_articoloFilatoColore; + } + + public void setId_articoloFilato(long newId_articoloFilato) { + this.id_articoloFilato = newId_articoloFilato; + setArticoloFilato(null); + } + + public void setId_coloreFilato(long newId_coloreFilato) { + this.id_coloreFilato = newId_coloreFilato; + setColoreFilato(null); + } + + public void setPerc(double newPerc) { + this.perc = newPerc; + } + + public long getId_articoloFilato() { + return this.id_articoloFilato; + } + + public long getId_coloreFilato() { + return this.id_coloreFilato; + } + + public double getPerc() { + return this.perc; + } + + public void setArticoloFilato(ArticoloFilato newArticoloFilato) { + this.articoloFilato = newArticoloFilato; + } + + public ArticoloFilato getArticoloFilato() { + this.articoloFilato = (ArticoloFilato)getSecondaryObject(this.articoloFilato, ArticoloFilato.class, getId_articoloFilato()); + return this.articoloFilato; + } + + public void setColoreFilato(ColoreFilato newColoreFilato) { + this.coloreFilato = newColoreFilato; + } + + public ColoreFilato getColoreFilato() { + this.coloreFilato = (ColoreFilato)getSecondaryObject(this.coloreFilato, ColoreFilato.class, getId_coloreFilato()); + return this.coloreFilato; + } + + public long getFlgTipoRicerca() { + return this.flgTipoRicerca; + } + + public void setFlgTipoRicerca(long flgTipoRicerca) { + this.flgTipoRicerca = flgTipoRicerca; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + setClifor(null); + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public void setId_magFisico(long id_magFisico) { + this.id_magFisico = id_magFisico; + setMagFisico(null); + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, new Long(getId_magFisico())); + return this.magFisico; + } + + public void setMagFisico(MagFisico magFisico) { + this.magFisico = magFisico; + } + + public it.acxent.anag.Clifor getClifor() { + this.clifor = (it.acxent.anag.Clifor)getSecondaryObject(this.clifor, it.acxent.anag.Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setClifor(it.acxent.anag.Clifor clifor) { + this.clifor = clifor; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoColoreRitorto.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoColoreRitorto.java new file mode 100644 index 00000000..a19fceef --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoColoreRitorto.java @@ -0,0 +1,162 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.StringTokenizer; + +public class ArticoloFilatoColoreRitorto extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228166501L; + + private long id_articoloFilatoColoreRitorto; + + private long id_articoloFilatoTestata; + + private long id_coloreFilatoTestata; + + private long id_articoloFilato; + + private long id_coloreFilato; + + private double perc; + + private ArticoloFilato articoloFilatoTestata; + + private ColoreFilato coloreFilatoTestata; + + private ArticoloFilato articoloFilato; + + private ColoreFilato coloreFilato; + + public ArticoloFilatoColoreRitorto(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloFilatoColoreRitorto() {} + + public void setId_articoloFilatoColoreRitorto(long newId_articoloFilatoColoreRitorto) { + this.id_articoloFilatoColoreRitorto = newId_articoloFilatoColoreRitorto; + } + + public void setId_articoloFilatoTestata(long newId_articoloFilatoTestata) { + this.id_articoloFilatoTestata = newId_articoloFilatoTestata; + setArticoloFilato(null); + } + + public void setId_coloreFilatoTestata(long newId_coloreFilatoTestata) { + this.id_coloreFilatoTestata = newId_coloreFilatoTestata; + setColoreFilato(null); + } + + public void setId_articoloFilato(long newId_articoloFilato) { + this.id_articoloFilato = newId_articoloFilato; + setArticoloFilato(null); + } + + public void setId_coloreFilato(long newId_coloreFilato) { + this.id_coloreFilato = newId_coloreFilato; + setColoreFilato(null); + } + + public void setPerc(double newPerc) { + this.perc = newPerc; + } + + public long getId_articoloFilatoColoreRitorto() { + return this.id_articoloFilatoColoreRitorto; + } + + public long getId_articoloFilatoTestata() { + return this.id_articoloFilatoTestata; + } + + public long getId_coloreFilatoTestata() { + return this.id_coloreFilatoTestata; + } + + public long getId_articoloFilato() { + return this.id_articoloFilato; + } + + public long getId_coloreFilato() { + return this.id_coloreFilato; + } + + public double getPerc() { + return this.perc; + } + + public void setArticoloFilatoTestata(ArticoloFilato newArticoloFilatoTestata) { + this.articoloFilatoTestata = newArticoloFilatoTestata; + } + + public ArticoloFilato getArticoloFilatoTestata() { + this.articoloFilatoTestata = (ArticoloFilato)getSecondaryObject(this.articoloFilatoTestata, ArticoloFilato.class, + getId_articoloFilatoTestata()); + return this.articoloFilatoTestata; + } + + public void setColoreFilatoTestata(ColoreFilato newColoreFilatoTestata) { + this.coloreFilatoTestata = newColoreFilatoTestata; + } + + public ColoreFilato getColoreFilatoTestata() { + this.coloreFilatoTestata = (ColoreFilato)getSecondaryObject(this.coloreFilatoTestata, ColoreFilato.class, getId_coloreFilatoTestata()); + return this.coloreFilatoTestata; + } + + public void setArticoloFilato(ArticoloFilato newArticoloFilato) { + this.articoloFilato = newArticoloFilato; + } + + public ArticoloFilato getArticoloFilato() { + this.articoloFilato = (ArticoloFilato)getSecondaryObject(this.articoloFilato, ArticoloFilato.class, getId_articoloFilato()); + return this.articoloFilato; + } + + public void setColoreFilato(ColoreFilato newColoreFilato) { + this.coloreFilato = newColoreFilato; + } + + public ColoreFilato getColoreFilato() { + this.coloreFilato = (ColoreFilato)getSecondaryObject(this.coloreFilato, ColoreFilato.class, getId_coloreFilato()); + return this.coloreFilato; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloFilatoColoreRitortoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_FILATO_COLORE_RITORTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoColoreRitortoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoColoreRitortoCR.java new file mode 100644 index 00000000..77f5d759 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoColoreRitortoCR.java @@ -0,0 +1,128 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloFilatoColoreRitortoCR extends CRAdapter { + private long id_articoloFilatoColoreRitorto; + + private long id_articoloFilatoTestata; + + private long id_coloreFilatoTestata; + + private long id_articoloFilato; + + private long id_coloreFilato; + + private double perc; + + private ArticoloFilato articoloFilatoTestata; + + private ColoreFilato coloreFilatoTestata; + + private ArticoloFilato articoloFilato; + + private ColoreFilato coloreFilato; + + public ArticoloFilatoColoreRitortoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloFilatoColoreRitortoCR() {} + + public void setId_articoloFilatoColoreRitorto(long newId_articoloFilatoColoreRitorto) { + this.id_articoloFilatoColoreRitorto = newId_articoloFilatoColoreRitorto; + } + + public void setId_articoloFilatoTestata(long newId_articoloFilatoTestata) { + this.id_articoloFilatoTestata = newId_articoloFilatoTestata; + setArticoloFilatoTestata(null); + } + + public void setId_coloreFilatoTestata(long newId_coloreFilatoTestata) { + this.id_coloreFilatoTestata = newId_coloreFilatoTestata; + setColoreFilatoTestata(null); + } + + public void setId_articoloFilato(long newId_articoloFilato) { + this.id_articoloFilato = newId_articoloFilato; + setArticoloFilato(null); + } + + public void setId_coloreFilato(long newId_coloreFilato) { + this.id_coloreFilato = newId_coloreFilato; + setColoreFilato(null); + } + + public void setPerc(double newPerc) { + this.perc = newPerc; + } + + public long getId_articoloFilatoColoreRitorto() { + return this.id_articoloFilatoColoreRitorto; + } + + public long getId_articoloFilatoTestata() { + return this.id_articoloFilatoTestata; + } + + public long getId_coloreFilatoTestata() { + return this.id_coloreFilatoTestata; + } + + public long getId_articoloFilato() { + return this.id_articoloFilato; + } + + public long getId_coloreFilato() { + return this.id_coloreFilato; + } + + public double getPerc() { + return this.perc; + } + + public void setArticoloFilatoTestata(ArticoloFilato newArticoloFilatoTestata) { + this.articoloFilatoTestata = newArticoloFilatoTestata; + } + + public ArticoloFilato getArticoloFilatoTestata() { + this.articoloFilatoTestata = (ArticoloFilato)getSecondaryObject(this.articoloFilatoTestata, ArticoloFilato.class, + + getId_articoloFilatoTestata()); + return this.articoloFilatoTestata; + } + + public void setColoreFilatoTestata(ColoreFilato newColoreFilatoTestata) { + this.coloreFilatoTestata = newColoreFilatoTestata; + } + + public ColoreFilato getColoreFilatoTestata() { + this.coloreFilatoTestata = (ColoreFilato)getSecondaryObject(this.coloreFilatoTestata, ColoreFilato.class, + + getId_coloreFilatoTestata()); + return this.coloreFilatoTestata; + } + + public void setArticoloFilato(ArticoloFilato newArticoloFilato) { + this.articoloFilato = newArticoloFilato; + } + + public ArticoloFilato getArticoloFilato() { + this.articoloFilato = (ArticoloFilato)getSecondaryObject(this.articoloFilato, ArticoloFilato.class, + + getId_articoloFilato()); + return this.articoloFilato; + } + + public void setColoreFilato(ColoreFilato newColoreFilato) { + this.coloreFilato = newColoreFilato; + } + + public ColoreFilato getColoreFilato() { + this.coloreFilato = (ColoreFilato)getSecondaryObject(this.coloreFilato, ColoreFilato.class, + + getId_coloreFilato()); + return this.coloreFilato; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoComponente.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoComponente.java new file mode 100644 index 00000000..21ec5742 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoComponente.java @@ -0,0 +1,164 @@ +package it.acxent.tex.anag; + +import it.acxent.art.Componente; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.StringTokenizer; + +public class ArticoloFilatoComponente extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228166523L; + + private long id_articoloFilatoComponente; + + private long id_componente; + + private long id_articoloFilato; + + private double percentuale; + + private Componente componente; + + private ArticoloFilato articoloFilato; + + public ArticoloFilatoComponente(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloFilatoComponente() {} + + public void setId_articoloFilatoComponente(long newId_articoloFilatoComponente) { + this.id_articoloFilatoComponente = newId_articoloFilatoComponente; + } + + public void setId_componente(long newId_componente) { + this.id_componente = newId_componente; + setComponente(null); + } + + public void setId_articoloFilato(long newId_articoloFilato) { + this.id_articoloFilato = newId_articoloFilato; + setArticoloFilato(null); + } + + public void setPercentuale(double newPercentuale) { + this.percentuale = newPercentuale; + } + + public long getId_articoloFilatoComponente() { + return this.id_articoloFilatoComponente; + } + + public long getId_componente() { + return this.id_componente; + } + + public long getId_articoloFilato() { + return this.id_articoloFilato; + } + + public double getPercentuale() { + return this.percentuale; + } + + public void setComponente(Componente newComponente) { + this.componente = newComponente; + } + + public Componente getComponente() { + this.componente = (Componente)getSecondaryObject(this.componente, Componente.class, getId_componente()); + return this.componente; + } + + public void setArticoloFilato(ArticoloFilato newArticoloFilato) { + this.articoloFilato = newArticoloFilato; + } + + public ArticoloFilato getArticoloFilato() { + this.articoloFilato = (ArticoloFilato)getSecondaryObject(this.articoloFilato, ArticoloFilato.class, getId_articoloFilato()); + return this.articoloFilato; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloFilatoComponenteCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_FILATO_COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByArticoloFilato(long l_id_articoloFilato) { + String s_Sql_Find = "select A.* from ARTICOLO_FILATO_COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_articoloFilato = " + l_id_articoloFilato); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm save() { + ResParm rp = isSalvabile(); + if (rp.getStatus()) + return super.save(); + return rp; + } + + private ResParm isSalvabile() { + boolean checkComponente = false; + DoubleOperator dop = new DoubleOperator(); + ArticoloFilatoComponente afc = new ArticoloFilatoComponente(getApFull()); + if (getId_articoloFilato() == 0L) + return new ResParm(false, "ERRORE! Filato non valido!"); + if (getPercentuale() == 0.0D) + return new ResParm(false, "ERRORE! Percentuale non valida!"); + Vectumerator vec = afc.findByArticoloFilato(getId_articoloFilato()); + while (vec.hasMoreElements()) { + afc = (ArticoloFilatoComponente)vec.nextElement(); + if (afc.getId_componente() == getId_componente()) + checkComponente = true; + dop.add(afc.getPercentuale()); + } + dop.add(getPercentuale()); + if (dop.getResult() <= 100.0D && !checkComponente) + return new ResParm(true); + if (dop.getResult() > 100.0D) + return new ResParm(false, "Percentuale errata!"); + return new ResParm(false, "Componente già selezionato!"); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoComponenteCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoComponenteCR.java new file mode 100644 index 00000000..3f49c3fc --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoComponenteCR.java @@ -0,0 +1,81 @@ +package it.acxent.tex.anag; + +import it.acxent.art.Componente; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloFilatoComponenteCR extends CRAdapter { + private long id_articoloFilatoComponente; + + private long id_componente; + + private long id_articoloFilato; + + private double percentuale; + + private Componente componente; + + private ArticoloFilato articoloFilato; + + public ArticoloFilatoComponenteCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloFilatoComponenteCR() {} + + public void setId_articoloFilatoComponente(long newId_articoloFilatoComponente) { + this.id_articoloFilatoComponente = newId_articoloFilatoComponente; + } + + public void setId_componente(long newId_componente) { + this.id_componente = newId_componente; + setComponente(null); + } + + public void setId_articoloFilato(long newId_articoloFilato) { + this.id_articoloFilato = newId_articoloFilato; + setArticoloFilato(null); + } + + public void setPercentuale(double newPercentuale) { + this.percentuale = newPercentuale; + } + + public long getId_articoloFilatoComponente() { + return this.id_articoloFilatoComponente; + } + + public long getId_componente() { + return this.id_componente; + } + + public long getId_articoloFilato() { + return this.id_articoloFilato; + } + + public double getPercentuale() { + return this.percentuale; + } + + public void setComponente(Componente newComponente) { + this.componente = newComponente; + } + + public Componente getComponente() { + this.componente = (Componente)getSecondaryObject(this.componente, Componente.class, + + getId_componente()); + return this.componente; + } + + public void setArticoloFilato(ArticoloFilato newArticoloFilato) { + this.articoloFilato = newArticoloFilato; + } + + public ArticoloFilato getArticoloFilato() { + this.articoloFilato = (ArticoloFilato)getSecondaryObject(this.articoloFilato, ArticoloFilato.class, + + getId_articoloFilato()); + return this.articoloFilato; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoFornitore.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoFornitore.java new file mode 100644 index 00000000..302138f0 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoFornitore.java @@ -0,0 +1,121 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.StringTokenizer; + +public class ArticoloFilatoFornitore extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228166546L; + + private long id_articoloFilatoFornitore; + + private long id_articoloFilato; + + private long id_clifor; + + private String descrizione; + + private ArticoloFilato articoloFilato; + + private it.acxent.anag.Clifor clifor; + + public ArticoloFilatoFornitore(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloFilatoFornitore() {} + + public void setId_articoloFilatoFornitore(long newId_articoloFilatoFornitore) { + this.id_articoloFilatoFornitore = newId_articoloFilatoFornitore; + } + + public void setId_articoloFilato(long newId_articoloFilato) { + this.id_articoloFilato = newId_articoloFilato; + setArticoloFilato(null); + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_articoloFilatoFornitore() { + return this.id_articoloFilatoFornitore; + } + + public long getId_articoloFilato() { + return this.id_articoloFilato; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public void setArticoloFilato(ArticoloFilato newArticoloFilato) { + this.articoloFilato = newArticoloFilato; + } + + public ArticoloFilato getArticoloFilato() { + this.articoloFilato = (ArticoloFilato)getSecondaryObject(this.articoloFilato, ArticoloFilato.class, + + getId_articoloFilato()); + return this.articoloFilato; + } + + public void setClifor(it.acxent.anag.Clifor newClifor) { + this.clifor = newClifor; + } + + public it.acxent.anag.Clifor getClifor() { + this.clifor = (it.acxent.anag.Clifor)getSecondaryObject(this.clifor, it.acxent.anag.Clifor.class, + + getId_clifor()); + return this.clifor; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloFilatoFornitoreCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_FILATO_FORNITORE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoFornitoreCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoFornitoreCR.java new file mode 100644 index 00000000..369144aa --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloFilatoFornitoreCR.java @@ -0,0 +1,80 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloFilatoFornitoreCR extends CRAdapter { + private long id_articoloFilatoFornitore; + + private long id_articoloFilato; + + private long id_clifor; + + private String descrizione; + + private ArticoloFilato articoloFilato; + + private it.acxent.anag.Clifor clifor; + + public ArticoloFilatoFornitoreCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloFilatoFornitoreCR() {} + + public void setId_articoloFilatoFornitore(long newId_articoloFilatoFornitore) { + this.id_articoloFilatoFornitore = newId_articoloFilatoFornitore; + } + + public void setId_articoloFilato(long newId_articoloFilato) { + this.id_articoloFilato = newId_articoloFilato; + setArticoloFilato(null); + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_articoloFilatoFornitore() { + return this.id_articoloFilatoFornitore; + } + + public long getId_articoloFilato() { + return this.id_articoloFilato; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public void setArticoloFilato(ArticoloFilato newArticoloFilato) { + this.articoloFilato = newArticoloFilato; + } + + public ArticoloFilato getArticoloFilato() { + this.articoloFilato = (ArticoloFilato)getSecondaryObject(this.articoloFilato, ArticoloFilato.class, + + getId_articoloFilato()); + return this.articoloFilato; + } + + public void setClifor(it.acxent.anag.Clifor newClifor) { + this.clifor = newClifor; + } + + public it.acxent.anag.Clifor getClifor() { + this.clifor = (it.acxent.anag.Clifor)getSecondaryObject(this.clifor, it.acxent.anag.Clifor.class, + + getId_clifor()); + return this.clifor; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessuto.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessuto.java new file mode 100644 index 00000000..5b550b69 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessuto.java @@ -0,0 +1,1422 @@ +package it.acxent.tex.anag; + +import it.acxent.anag.Iva; +import it.acxent.anag.MagFisico; +import it.acxent.anag._AnagAdapter; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloFornitore; +import it.acxent.art.ArticoloVariante; +import it.acxent.art.Tipo; +import it.acxent.art.TipologiaArticolo; +import it.acxent.common.SimboliLavaggio; +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.NumberFormat; +import java.util.HashMap; +import java.util.Locale; +import java.util.Set; + +public class ArticoloTessuto extends _AnagAdapter implements Serializable { + private static final long serialVersionUID = 1468228166614L; + + public static final long TINTO_FILO = 0L; + + public static final long TINTO_PEZZA = 1L; + + public static final long TIPO_TESSUTO_MAGLIERIA = 0L; + + public static final long TIPO_TESSUTO_NAVETTA = 1L; + + public static final long TIPO_TESSUTO_M_GREGGIO_O_TINTO = 0L; + + public static final long TIPO_TESSUTO_M_FINITO = 1L; + + public static final long TIPO_TESSUTO_M_ACCOPPIATO = 2L; + + public static final long TIPO_TESSUTO_M_LASERATO = 3L; + + public static final long TIPO_TESSUTO_M_NON_ACCOPPIATO = -2L; + + private ComposizioneResult composizioneATF; + + private long id_iva; + + private long id_stagione; + + private String descrizione; + + private long flgStato; + + private long altezzaMin; + + private long altezzaMax; + + private long lunghezzaFinita; + + private double pesoMin; + + private double pesoMax; + + private double pesoMq; + + private long lavaggio; + + private long candeggio; + + private long stiratura; + + private long asciugatura; + + private long pulituraSecco; + + private String codiceDoganale; + + private long flgUdm; + + private double prezzoBase; + + private Iva iva; + + private Stagione stagione; + + private SimboliLavaggio simboliLavaggio; + + private long altezzaGreggia; + + private double altezzaPettine; + + private Armatura armatura; + + private double caloOrdito; + + private double caloTrama; + + private Date dataUltimoPrezzoAcquisto; + + private long colpiFiniti; + + private long colpiSpecchio; + + private long colpiTelaio; + + private long filiCimosse; + + private long filiOrdito; + + private long flgAccoppiato; + + private long flgAcquistato; + + private long flgJaquard; + + private long flgTintoFiloPezza; + + private long id_armatura; + + private long id_articoloTessuto; + + private long id_rincorso; + + private long impettinatura; + + private long licci1; + + private long licci2; + + private long lunghezzaGreggia; + + private long mtOrdito; + + private double pesoGreggio; + + private long pettine; + + private long pezzaPerTela; + + private Rincorso rincorso; + + private String serie; + + private long tipoPettine; + + private long flgTipoAT; + + private long flgTipoTessutoM; + + private long id_articoloTessutoPadre; + + private ArticoloTessuto articoloTessutoPadre; + + private ArticoloTessutoColore articoloTessutoColore; + + private long id_tipo; + + private Tipo tipo; + + private double quantita; + + private boolean quantitaCalcolate; + + private double quantitaData; + + private boolean quantitaDataCalcolate = false; + + private double quantitaEffettiva; + + private double quantitaImpegnata; + + private double quantitaInArrivo; + + private double quantitaLavorazione; + + private String quantitaMagazzinoMovimentoHtml; + + private String codiceAT; + + private String descLavorazione; + + private long flgDispo; + + private long capiPerTelo; + + private long numTeliMax; + + private long id_articoloTessutoColore; + + private double mtLavorazioneTaglio; + + private String codiciAlternativiAt; + + private String notaTessuto; + + private double ultimoPrezzoAcquisto; + + private double quantitaW; + + private long id_magFisico; + + private MagFisico magFisico; + + private String seriale; + + public ArticoloTessuto(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloTessuto() {} + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + } + + public void setId_iva(long newId_iva) { + this.id_iva = newId_iva; + setIva(null); + } + + public void setId_stagione(long newId_stagione) { + this.id_stagione = newId_stagione; + setStagione(null); + } + + public void setFlgStato(long newFlgStato) { + this.flgStato = newFlgStato; + } + + public void setAltezzaMin(long newAltezzaMin) { + this.altezzaMin = newAltezzaMin; + } + + public void setAltezzaMax(long newAltezzaMax) { + this.altezzaMax = newAltezzaMax; + } + + public void setLunghezzaFinita(long newLunghezzaFinita) { + this.lunghezzaFinita = newLunghezzaFinita; + } + + public void setPesoMin(double newPesoMin) { + this.pesoMin = newPesoMin; + } + + public void setPesoMax(double newPesoMax) { + this.pesoMax = newPesoMax; + } + + public void setPesoMq(double newPesoMq) { + this.pesoMq = newPesoMq; + } + + public void setLavaggio(long newLavaggio) { + this.lavaggio = newLavaggio; + } + + public void setCandeggio(long newCandeggio) { + this.candeggio = newCandeggio; + } + + public void setStiratura(long newStiratura) { + this.stiratura = newStiratura; + } + + public void setAsciugatura(long newAsciugatura) { + this.asciugatura = newAsciugatura; + } + + public void setPulituraSecco(long newPulituraSecco) { + this.pulituraSecco = newPulituraSecco; + } + + public void setCodiceDoganale(String newCodiceDoganale) { + this.codiceDoganale = newCodiceDoganale; + } + + public void setFlgUdm(long newFlgUdm) { + this.flgUdm = newFlgUdm; + } + + public void setPrezzoBase(double newPrezzoBase) { + this.prezzoBase = newPrezzoBase; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public long getId_iva() { + return this.id_iva; + } + + public long getId_stagione() { + return this.id_stagione; + } + + public long getFlgStato() { + return this.flgStato; + } + + public long getAltezzaMin() { + return this.altezzaMin; + } + + public long getAltezzaMax() { + return this.altezzaMax; + } + + public long getLunghezzaFinita() { + return this.lunghezzaFinita; + } + + public double getPesoMin() { + return this.pesoMin; + } + + public double getPesoMax() { + return this.pesoMax; + } + + public double getPesoMq() { + return this.pesoMq; + } + + public long getLavaggio() { + return this.lavaggio; + } + + public long getCandeggio() { + return this.candeggio; + } + + public long getStiratura() { + return this.stiratura; + } + + public long getAsciugatura() { + return this.asciugatura; + } + + public long getPulituraSecco() { + return this.pulituraSecco; + } + + public String getCodiceDoganale() { + return (this.codiceDoganale == null) ? "" : this.codiceDoganale.trim(); + } + + public long getFlgUdm() { + return this.flgUdm; + } + + public double getPrezzoBase() { + return this.prezzoBase; + } + + public void setIva(Iva newIva) { + this.iva = newIva; + } + + public Iva getIva() { + this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, getId_iva()); + return this.iva; + } + + public void setStagione(Stagione newStagione) { + this.stagione = newStagione; + } + + public Stagione getStagione() { + this.stagione = (Stagione)getSecondaryObject(this.stagione, Stagione.class, getId_stagione()); + return this.stagione; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloTessutoCR CR, int pageNumber, int pageRows) { + if (CR.getFlgTipoRicerca() == 1L) + return findByCRSerMagazzino(CR, pageNumber, pageRows); + if (CR.getFlgTipoRicerca() == 2L) + return findByCRAv(CR, pageNumber, pageRows); + String s_Sql_Find = "select A.* from ARTICOLO_TESSUTO AS A"; + String s_Sql_Order = " order by A.codiceAT, A.descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%' or A.codiceAt like '%" + token + "%' or A.codiciAlternativiAt like '%," + token + ",%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getFlgTipoTessutoM() < 0L) { + if (CR.getFlgTipoTessutoM() == -2L) + wc.addWc("A.flgTipoTessutoM <>2"); + } else if (CR.getFlgTipoTessutoM() == 0L) { + wc.addWc("(A.flgTipoTessutoM is null or A.flgTipoTessutoM=0)"); + } else if (CR.getFlgTipoTessutoM() > 0L) { + wc.addWc("A.flgTipoTessutoM =" + CR.getFlgTipoTessutoM()); + } + if (CR.getId_tipo() > 0L) + wc.addWc("A.id_tipo=" + CR.getId_tipo()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } + + public SimboliLavaggio getSimboliLavaggio() { + if (this.simboliLavaggio == null) { + this.simboliLavaggio = new SimboliLavaggio(); + this.simboliLavaggio.setAsciugatura(getAsciugatura()); + this.simboliLavaggio.setCandeggio(getCandeggio()); + this.simboliLavaggio.setLavaggio(getLavaggio()); + this.simboliLavaggio.setPulituraSecco(getPulituraSecco()); + this.simboliLavaggio.setStiratura(getStiratura()); + } + return (this.simboliLavaggio == null) ? new SimboliLavaggio() : this.simboliLavaggio; + } + + public void setSimboliLavaggio(SimboliLavaggio simboliLavaggio) { + this.simboliLavaggio = simboliLavaggio; + } + + public String getDescrizioneAltezze() { + return "" + getAltezzaMin() + "/" + getAltezzaMin(); + } + + public String getDescrizionePesi() { + NumberFormat nf = NumberFormat.getInstance(); + nf.setMinimumFractionDigits(2); + nf.setMaximumFractionDigits(2); + return nf.format(getPesoMin()) + "/" + nf.format(getPesoMin()); + } + + public long getAltezzaGreggia() { + return this.altezzaGreggia; + } + + public void setAltezzaGreggia(long altezzaGreggia) { + this.altezzaGreggia = altezzaGreggia; + } + + public double getAltezzaPettine() { + return this.altezzaPettine; + } + + public void setAltezzaPettine(double altezzaPettine) { + this.altezzaPettine = altezzaPettine; + } + + public Armatura getArmatura() { + return this.armatura; + } + + public void setArmatura(Armatura armatura) { + this.armatura = armatura; + } + + public double getCaloOrdito() { + return this.caloOrdito; + } + + public void setCaloOrdito(double caloOrdito) { + this.caloOrdito = caloOrdito; + } + + public double getCaloTrama() { + return this.caloTrama; + } + + public void setCaloTrama(double caloTrama) { + this.caloTrama = caloTrama; + } + + public long getColpiFiniti() { + return this.colpiFiniti; + } + + public void setColpiFiniti(long colpiFiniti) { + this.colpiFiniti = colpiFiniti; + } + + public long getColpiSpecchio() { + return this.colpiSpecchio; + } + + public void setColpiSpecchio(long colpiSpecchio) { + this.colpiSpecchio = colpiSpecchio; + } + + public long getColpiTelaio() { + return this.colpiTelaio; + } + + public void setColpiTelaio(long colpiTelaio) { + this.colpiTelaio = colpiTelaio; + } + + public long getFiliCimosse() { + return this.filiCimosse; + } + + public void setFiliCimosse(long filiCimosse) { + this.filiCimosse = filiCimosse; + } + + public long getFiliOrdito() { + return this.filiOrdito; + } + + public void setFiliOrdito(long filiOrdito) { + this.filiOrdito = filiOrdito; + } + + public long getFlgAccoppiato() { + return this.flgAccoppiato; + } + + public void setFlgAccoppiato(long flgAccoppiato) { + this.flgAccoppiato = flgAccoppiato; + } + + public long getFlgAcquistato() { + return this.flgAcquistato; + } + + public void setFlgAcquistato(long flgAcquistato) { + this.flgAcquistato = flgAcquistato; + } + + public long getFlgJaquard() { + return this.flgJaquard; + } + + public void setFlgJaquard(long flgJaquard) { + this.flgJaquard = flgJaquard; + } + + public long getFlgTintoFiloPezza() { + return this.flgTintoFiloPezza; + } + + public void setFlgTintoFiloPezza(long flgTintoFiloPezza) { + this.flgTintoFiloPezza = flgTintoFiloPezza; + } + + public long getId_armatura() { + return this.id_armatura; + } + + public void setId_armatura(long id_armatura) { + this.id_armatura = id_armatura; + } + + public long getId_rincorso() { + return this.id_rincorso; + } + + public void setId_rincorso(long id_rincorso) { + this.id_rincorso = id_rincorso; + } + + public long getImpettinatura() { + return this.impettinatura; + } + + public void setImpettinatura(long impettinatura) { + this.impettinatura = impettinatura; + } + + public long getLicci1() { + return this.licci1; + } + + public void setLicci1(long licci1) { + this.licci1 = licci1; + } + + public long getLicci2() { + return this.licci2; + } + + public void setLicci2(long licci2) { + this.licci2 = licci2; + } + + public long getLunghezzaGreggia() { + return this.lunghezzaGreggia; + } + + public void setLunghezzaGreggia(long lunghezzaGreggia) { + this.lunghezzaGreggia = lunghezzaGreggia; + } + + public long getMtOrdito() { + return this.mtOrdito; + } + + public void setMtOrdito(long mtOrdito) { + this.mtOrdito = mtOrdito; + } + + public double getPesoGreggio() { + return this.pesoGreggio; + } + + public void setPesoGreggio(double pesoGreggio) { + this.pesoGreggio = pesoGreggio; + } + + public long getPettine() { + return this.pettine; + } + + public void setPettine(long pettine) { + this.pettine = pettine; + } + + public long getPezzaPerTela() { + return this.pezzaPerTela; + } + + public void setPezzaPerTela(long pezzaPerTela) { + this.pezzaPerTela = pezzaPerTela; + } + + public Rincorso getRincorso() { + return this.rincorso; + } + + public void setRincorso(Rincorso rincorso) { + this.rincorso = rincorso; + } + + public String getSerie() { + return this.serie; + } + + public void setSerie(String serie) { + this.serie = serie; + } + + public long getTipoPettine() { + return this.tipoPettine; + } + + public void setTipoPettine(long tipoPettine) { + this.tipoPettine = tipoPettine; + } + + public static final String getTipoAT(long l_flgTipoAT) { + switch ((int)l_flgTipoAT) { + case 0: + return "Maglieria"; + case 1: + return "Navetta"; + } + return "??"; + } + + public String getTipoAT() { + return getTipoAT(getFlgTipoAT()); + } + + public static final String getTipoTessutoM(long l_flgTipoTessutoM) { + switch ((int)l_flgTipoTessutoM) { + case 2: + return "Accoppiato"; + case 1: + return "Finito"; + case 0: + return "Greggio o tinto"; + case 3: + return "Laserato"; + case -1: + return " "; + } + return "??"; + } + + public String getTipoTessutoM() { + return getTipoTessutoM(getFlgTipoTessutoM()); + } + + public void setFlgTipoAT(long flgTipo) { + this.flgTipoAT = flgTipo; + } + + public long getFlgTipoTessutoM() { + return this.flgTipoTessutoM; + } + + public void setFlgTipoTessutoM(long flgTipoTessutoM) { + this.flgTipoTessutoM = flgTipoTessutoM; + } + + public long getFlgTipoAT() { + return this.flgTipoAT; + } + + public Vectumerator findArticoliTessutoAccoppiati() { + ArticoloTessutoAccoppiato atf = new ArticoloTessutoAccoppiato(getApFull()); + return atf.findByArticoloTessuto(getId_articoloTessuto()); + } + + public long getId_articoloTessutoPadre() { + return this.id_articoloTessutoPadre; + } + + public void setId_articoloTessutoPadre(long id_articoloTessutoPadre) { + this.id_articoloTessutoPadre = id_articoloTessutoPadre; + setArticoloTessutoPadre(null); + } + + public ArticoloTessuto getArticoloTessutoPadre() { + this.articoloTessutoPadre = (ArticoloTessuto)getSecondaryObject(this.articoloTessutoPadre, ArticoloTessuto.class, + getId_articoloTessutoPadre()); + return this.articoloTessutoPadre; + } + + public void setArticoloTessutoPadre(ArticoloTessuto articoloTessutoPadre) { + this.articoloTessutoPadre = articoloTessutoPadre; + } + + public Vectumerator findArticoliTessutoGreggi(int pageNumber, int pageRows) { + ArticoloTessutoCR CR = new ArticoloTessutoCR(); + CR.setFlgTipoTessutoM(0L); + return findByCR(CR, pageNumber, pageRows); + } + + public String getDescrizioneCompleta() { + if (getFlgTipoAT() == 0L) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(getCodiceAT()); + stringBuilder.append(" "); + stringBuilder.append(getDescrizione()); + return stringBuilder.toString(); + } + StringBuilder sb = new StringBuilder(); + sb.append(getCodiceAT()); + sb.append(" to do "); + sb.append(getDescrizione()); + return sb.toString(); + } + + public long getId_tipo() { + return this.id_tipo; + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo()); + return this.tipo; + } + + public void setId_tipo(long id_tipo) { + this.id_tipo = id_tipo; + setTipo(null); + } + + public void setTipo(Tipo tipo) { + this.tipo = tipo; + } + + public double getQuantita() { + return getQuantita(null); + } + + public double getQuantita(Date data) { + if (!usaMagazzino()) + return 0.0D; + if (getParm("USA_MAGAZZINO").isFalse()) { + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagTessutoDisponibilita(getId_articoloTessuto(), 0L, Articolo.SERIALE_NULL, 0L, 0L, -1L, 0L, "", data); + return rd.getQuantita(); + } + return this.quantita; + } + + public double getQuantitaData() { + return this.quantitaData; + } + + public double getQuantitaData(Date data) { + if (!isQuantitaDataCalcolate()) { + this.quantitaData = getQuantita(data); + setQuantitaDataCalcolate(true); + } + return this.quantitaData; + } + + public double getQuantitaEffettiva() { + if (!isQuantitaCalcolate() && getId_articoloTessuto() != 0L) + calcolaQuantita(); + return this.quantitaEffettiva; + } + + public double getQuantitaImpegnata() { + if (!isQuantitaCalcolate() && getId_articoloTessuto() != 0L) + calcolaQuantita(); + return this.quantitaImpegnata; + } + + public double getQuantitaInArrivo() { + if (!isQuantitaCalcolate() && getId_articoloTessuto() != 0L) + calcolaQuantita(); + return this.quantitaInArrivo; + } + + public String getQuantitaMagazzinoMovimentoHtml() { + if (getParm("USA_MAGAZZINO").isTrue()) + return "--"; + if (!isQuantitaCalcolate() && getId_articoloTessuto() != 0L) + calcolaQuantita(); + return (this.quantitaMagazzinoMovimentoHtml == null) ? "" : this.quantitaMagazzinoMovimentoHtml; + } + + public double getQuantitaV() { + return this.quantita; + } + + public double getRealTimeQuantitaImpegnata() { + return 0.0D; + } + + public double getRealTimeQuantitaInArrivo() { + double q1 = 0.0D; + return q1; + } + + public boolean isQuantitaCalcolate() { + return this.quantitaCalcolate; + } + + public void setQuantitaCalcolate(boolean quantitaCalcolate) { + this.quantitaCalcolate = quantitaCalcolate; + } + + public boolean isQuantitaDataCalcolate() { + return this.quantitaDataCalcolate; + } + + public void setQuantitaDataCalcolate(boolean quantitaDataCalcolate) { + this.quantitaDataCalcolate = quantitaDataCalcolate; + } + + public void setQuantitaData(double quantitaData) { + this.quantitaData = quantitaData; + } + + public void setQuantitaEffettiva(double quantitaEffettiva) { + this.quantitaEffettiva = quantitaEffettiva; + } + + public void setQuantitaImpegnata(double quantitaImpegnata) { + this.quantitaImpegnata = quantitaImpegnata; + } + + public void setQuantitaInArrivo(double quantitaInArrivo) { + this.quantitaInArrivo = quantitaInArrivo; + } + + public void setQuantitaMagazzinoMovimentoHtml(String quantitaMagazzinoMovimentoHtml) { + this.quantitaMagazzinoMovimentoHtml = quantitaMagazzinoMovimentoHtml; + } + + private synchronized void calcolaQuantita() { + if ((!isQuantitaCalcolate() ? true : false) & ((getId_articoloTessuto() != 0L) ? true : false)) { + long l_flgDispo; + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagTessutoDisponibilita(getId_articoloTessuto(), 0L, Articolo.SERIALE_NULL, 0L, 0L, -1L, 0L, "", DATA_NULL); + double q = rd.getQuantita(); + double nr = rd.getNr(); + double kg = rd.getKg(); + double mt = rd.getMt(); + setQuantitaW(q); + setQuantita(q); + setQuantitaLavorazione(new RigaDocumento(getApFull()).getQuantitaTessutoLavorazioneByArticoloTessutoColoreSeriale(0L, + getId_articoloTessuto(), 0L, Articolo.SERIALE_NULL)); + if (usaMagazzino()) { + DoubleOperator dop = new DoubleOperator(q); + dop.add(this.quantitaInArrivo); + dop.add(this.quantitaLavorazione); + dop.subtract(this.quantitaImpegnata); + setQuantitaEffettiva(dop.getResult()); + } + this.quantitaMagazzinoMovimentoHtml = ArticoloTessutoColore.getMovimentoHtmlDesc(getTipologiaArticolo(), q, nr, kg, mt, this.quantitaInArrivo, this.quantitaImpegnata, this.quantitaEffettiva, this.quantitaLavorazione, + usaMagazzino(), + getParm("USA_MAGAZZINO").isTrue(), getNf()); + if (!usaMagazzino()) { + l_flgDispo = 1L; + } else { + l_flgDispo = (this.quantita > 0.0D) ? 1L : 0L; + } + String temp = "update ARTICOLO_TESSUTO set quantitaMagazzinoMovimentoHtml='" + this.quantitaMagazzinoMovimentoHtml + "', quantita=" + this.quantita + ", quantitaEffettiva=" + this.quantitaEffettiva + ", quantitaImpegnata=" + this.quantitaImpegnata + ", quantitaLavorazione=" + this.quantitaLavorazione + ", quantitaCalcolate=true, flgDispo=" + l_flgDispo + " where id_articoloTessuto=" + + + + getId_articoloTessuto(); + update(temp); + setQuantitaCalcolate(true); + } + } + + public boolean usaMagazzino() { + if (getTipo().getFlgTipoMagazzino() == 9L || getTipo().getFlgTipoMagazzino() == 0L) + return false; + return true; + } + + public void setQuantita(double quantita) { + this.quantita = quantita; + } + + public TipologiaArticolo getTipologiaArticolo() { + return getTipo().getTipologiaArticolo(); + } + + public String getCodiceAT() { + return (this.codiceAT == null) ? "" : this.codiceAT; + } + + public void setCodiceAT(String codiceAT) { + this.codiceAT = codiceAT; + } + + public String getDescLavorazione() { + return (this.descLavorazione == null) ? "" : this.descLavorazione.trim(); + } + + public void setDescLavorazione(String descLavorazione) { + this.descLavorazione = descLavorazione; + } + + public void findByCodice(String l_codiceAT) { + String s_Sql_Find = "select A.* from ARTICOLO_TESSUTO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codiceAT='" + prepareInputMySqlString(l_codiceAT, false) + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public Vectumerator findArticoliTessutoFilati(int pageNumber, int pageRows) { + ArticoloTessutoFilato atf = new ArticoloTessutoFilato(getApFull()); + return atf.findByArticoloTessuto(getId_articoloTessuto(), pageNumber, pageRows); + } + + public String getDescrizioneCompletaLista() { + if (getFlgTipoAT() == 0L) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(getDescrizione()); + if (getFlgTipoTessutoM() == 1L) { + if (getId_articoloTessutoPadre() != 0L) { + stringBuilder.append("( Gr.: "); + stringBuilder.append(getArticoloTessutoPadre().getDescrizioneCompleta()); + stringBuilder.append(") "); + } + } else if (getFlgTipoTessutoM() == 2L) { + stringBuilder.append("( "); + Vectumerator vecAta = findArticoliTessutoAccoppiati(); + while (vecAta.hasMoreElements()) { + ArticoloTessutoAccoppiato row = (ArticoloTessutoAccoppiato)vecAta.nextElement(); + stringBuilder.append(row.getArticoloTessutoComponente().getDescrizioneCompleta()); + if (vecAta.hasMoreElements()) + stringBuilder.append(" + "); + } + stringBuilder.append(") "); + } + return stringBuilder.toString().trim(); + } + StringBuilder sb = new StringBuilder(); + sb.append(getDescrizione()); + return "todo"; + } + + public boolean isUsaLotti() { + return (getTipo().getFlgTipoMagazzino() == 3L); + } + + public void resetCalcoloQuantita() { + if (getId_articoloTessuto() > 0L) { + update("update ARTICOLO_TESSUTO set quantitaCalcolate=false where id_articoloTessuto=" + getId_articoloTessuto()); + setQuantitaCalcolate(false); + } + } + + public long getFlgDispo() { + return this.flgDispo; + } + + public void setFlgDispo(long flgDispo) { + this.flgDispo = flgDispo; + } + + public boolean isUsaMagazzino() { + return (isUsaLotti() || isUsaSeriale()); + } + + public boolean isUsaSeriale() { + return (getTipo().getFlgTipoMagazzino() == 2L); + } + + public ResParm superSave() { + return super.save(); + } + + public boolean isPercArticoloTessutoFilatoOk() { + if (getComposizioneATF().getPerc() == 100.0D) + return true; + return false; + } + + public String getPercArticoloTessutoFilato() { + if (getComposizioneATF() != null && getComposizioneATF().getPerc() == 100.0D) + return ""; + return getNf().format(getComposizioneATF().getPerc()) + "%"; + } + + public ComposizioneResult getComposizioneATF() { + if (this.composizioneATF == null && + getId_articoloTessuto() > 0L) { + StringBuilder comp = new StringBuilder(); + StringBuilder desc = new StringBuilder(); + DoubleOperator perc = new DoubleOperator(); + Vectumerator vec = findArticoliTessutoFilati(0, 0); + while (vec.hasMoreElements()) { + ArticoloTessutoFilato row = (ArticoloTessutoFilato)vec.nextElement(); + perc.add(row.getPercentuale()); + desc.append(row.getDescrizioneCompleta()); + if (vec.hasMoreElements()) + desc.append(" - "); + } + this.composizioneATF = new ComposizioneResult(perc.getResult(), "", desc.toString()); + } + return (this.composizioneATF == null) ? new ComposizioneResult(0.0D, "", "") : this.composizioneATF; + } + + public void setComposizioneATF(ComposizioneResult composizioneATF) { + this.composizioneATF = composizioneATF; + } + + protected void initFields() { + super.initFields(); + setComposizioneATF(null); + setId_articoloTessutoColore(0L); + } + + public Vectumerator findTessutiPerTaglioByArticolo(long l_id_articolo) { + HashMap hmTess = new HashMap<>(); + Articolo articolo = new Articolo(this.apFull); + articolo.findByPrimaryKey(l_id_articolo); + if (articolo.getId_articolo() > 0L) { + Vectumerator vecAAT = new Vectumerator(); + if (articolo.getFlgUsaVarianti() == 1L) { + Vectumerator vecVar = articolo.findArticoliVarianti(-1L, -1L); + while (vecVar.hasMoreElements()) { + ArticoloVariante rowAV = (ArticoloVariante)vecVar.nextElement(); + vecAAT = rowAV.findArticoliTessuto(); + while (vecAAT.hasMoreElements()) { + ArticoloArticoloTessuto rowAAT = (ArticoloArticoloTessuto)vecAAT.nextElement(); + if (!hmTess.containsKey(Long.valueOf(rowAAT.getId_articoloTessuto()))) + hmTess.put(Long.valueOf(rowAAT.getId_articoloTessuto()), rowAAT.getArticoloTessuto()); + } + } + } else { + vecAAT = articolo.findArticoliTessuto(); + while (vecAAT.hasMoreElements()) { + ArticoloArticoloTessuto rowAAT = (ArticoloArticoloTessuto)vecAAT.nextElement(); + if (!hmTess.containsKey(Long.valueOf(rowAAT.getId_articoloTessuto()))) + hmTess.put(Long.valueOf(rowAAT.getId_articoloTessuto()), rowAAT.getArticoloTessuto()); + } + } + } + Vectumerator vecRes = new Vectumerator(); + Set keySet = hmTess.keySet(); + for (Long key : keySet) + vecRes.add(hmTess.get(key)); + return vecRes; + } + + public long getCapiPerTelo() { + return this.capiPerTelo; + } + + public void setCapiPerTelo(long capiPerTelo) { + this.capiPerTelo = capiPerTelo; + } + + public long getNumTeliMax() { + return this.numTeliMax; + } + + public void setNumTeliMax(long numTeliMax) { + this.numTeliMax = numTeliMax; + } + + public Vectumerator findByCRAv(ArticoloTessutoCR CR, int pageNumber, int pageRows) { + if (CR.getFlgTipoRicerca() == 1L) + return AB_EMPTY_VECTUMERATOR; + String s_Sql_FindArtVar = "select B.id_articoloTessutoColore as id_articoloTessutoColore, A.* from ARTICOLO_TESSUTO AS A JOIN ARTICOLO_TESSUTO_COLORE AS B ON A.id_articoloTessuto=B.id_articoloTessuto inner join COLORE AS C ON B.id_colore=C.id_colore INNER JOIN TIPO AS T ON A.id_tipo=T.id_tipo"; + String s_Sql_FindArt = "select 0 as id_articoloTessutoColore, A.* from ARTICOLO_TESSUTO AS A INNER JOIN TIPO AS T ON A.id_tipo=T.id_tipo"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + StringBuffer wcArt = new StringBuffer(""); + StringBuffer wcArtVar = new StringBuffer(""); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + temp = prepareInputMySqlString(temp, true); + temp = temp.replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + while (st.hasMoreTokens()) { + String token = star + star; + wcArt.append("(A.codiceAT like '%" + token + "%' or A.descrizione like '%" + token + ",%')"); + wcArtVar.append("(A.codiceAT like '%" + token + "%' or A.descrizione like '%" + token + "%' or C.descrizione like '%" + token + "%' or A.codiciAlternativiAt like '%," + token + "%')"); + if (st.hasMoreTokens()) { + wcArt.append(" and "); + wcArtVar.append(" and "); + star = "%"; + } + } + } + if (wcArtVar.length() > 0) { + wcArtVar.append(" and "); + wcArt.append(" and "); + } + wcArtVar.insert(0, " where "); + wcArtVar.append(" B.id_articoloTessutoColore Is Not Null AND T.flgUsaVarianti=1 and (T.flgNascondi=0 or T.flgNascondi is null) and A.dataFineVld is null"); + wcArt.insert(0, " where "); + wcArt.append(" (T.flgUsaVarianti=0 or T.flgUsaVarianti is null) and (T.flgNascondi=0 or T.flgNascondi is null) and A.dataFineVld is null"); + try { + PreparedStatement stmt = getConn().prepareStatement("(" + s_Sql_FindArtVar + wcArtVar.toString() + s_Sql_Order + ") union (" + s_Sql_FindArt + + wcArt.toString() + s_Sql_Order + ")"); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ArticoloTessutoColore getArticoloTessutoColore() { + this.articoloTessutoColore = (ArticoloTessutoColore)getSecondaryObject(this.articoloTessutoColore, ArticoloTessutoColore.class, + getId_articoloTessutoColore()); + return this.articoloTessutoColore; + } + + public void setArticoloTessutoColore(ArticoloTessutoColore articoloTessutoColore) { + this.articoloTessutoColore = articoloTessutoColore; + } + + public long getId_articoloTessutoColore() { + return this.id_articoloTessutoColore; + } + + public void setId_articoloTessutoColore(long id_articoloTessutoColore) { + this.id_articoloTessutoColore = id_articoloTessutoColore; + setArticoloTessutoColore(null); + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + try { + if (isColumnInResultSet(rst, "id_articoloTessutoColore")) + setId_articoloTessutoColore(rst.getLong("id_articoloTessutoColore")); + if (isColumnInResultSet(rst, "seriale")) + setSeriale(rst.getString("seriale")); + if (isColumnInResultSet(rst, "id_magFisico")) + setId_magFisico(rst.getLong("id_magFisico")); + if (isColumnInResultSet(rst, "quantita")) + setQuantita(rst.getDouble("quantita")); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public String getDescrizioneCompleta(String lang) { + if (getFlgTipoAT() == 0L) { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(getCodiceAT()); + stringBuilder.append(" "); + stringBuilder.append(getDescrizione(lang)); + if (getId_articoloTessutoColore() > 0L) { + stringBuilder.append(" "); + stringBuilder.append(getArticoloTessutoColore().getColore().getDescrizione(lang)); + } + stringBuilder.append(" ("); + stringBuilder.append(getTipo().getDescrizioneCompletaSpaces(lang)); + stringBuilder.append(")"); + return stringBuilder.toString(); + } + StringBuilder sb = new StringBuilder(); + sb.append(getCodiceAT()); + sb.append(" "); + sb.append(getDescrizione(lang)); + return "todo"; + } + + public double getMtLavorazioneTaglio() { + return this.mtLavorazioneTaglio; + } + + public void setMtLavorazioneTaglio(double mtLavorazioneTaglio) { + this.mtLavorazioneTaglio = mtLavorazioneTaglio; + } + + public String getCodiciAlternativiAt() { + return (this.codiciAlternativiAt == null) ? "" : this.codiciAlternativiAt.trim(); + } + + public void setCodiciAlternativiAt(String codiciAlternativi) { + this.codiciAlternativiAt = codiciAlternativi; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + String temp = getCodiciAlternativiAt(); + if (!temp.isEmpty()) { + if (!temp.startsWith(",")) + temp = "," + temp; + if (!temp.endsWith(",")) + temp = temp + ","; + } + setCodiciAlternativiAt(temp); + super.prepareSave(ps); + } + + public String getNotaTessuto() { + return (this.notaTessuto == null) ? "" : this.notaTessuto.trim(); + } + + public void setNotaTessuto(String notaTessuto) { + this.notaTessuto = notaTessuto; + } + + private String calcolaProgCodice() { + try { + String s_sql = "select *, CONVERT(codiceAT,UNSIGNED INTEGER) as codice from ARTICOLO_TESSUTO as A"; + WcString wc = new WcString(); + wc.addWc("id_articoloTessuto !=" + getId_articoloTessuto()); + s_sql = " select B.codice as codiceAT from (" + s_sql + wc.toString() + ") as B order by codiceAT desc limit 1"; + PreparedStatement ps = getConn().prepareStatement(s_sql); + Vectumerator vec = findRows(ps); + if (!vec.hasMoreElements()) + return "1"; + ArticoloTessuto articoloTessuto = (ArticoloTessuto)vec.nextElement(); + return String.valueOf(Long.valueOf(articoloTessuto.getCodiceAT()) + 1L); + } catch (Exception e) { + return ""; + } + } + + public ResParm save() { + setDescrizione(getDescrizione(Locale.ITALIAN.getLanguage())); + if (getCodiceAT().isEmpty()) + setCodiceAT(zeroLeft(calcolaProgCodice(), 4)); + if (getId_tipo() == 0L) + setId_tipo(getCodiceTipoTessutoStandard()); + if (getId_iva() == 0L) + setId_iva(getCodiceIvaVendStd()); + return super.save(); + } + + public double getTotPercentualeComponenti() { + if (getId_articoloTessuto() == 0L) + return 0.0D; + return new ArticoloTessutoComponente(getApFull()).getTotPercentualeByArticoloTessuto(getId_articoloTessuto()); + } + + public double getUltimoPrezzoAcquisto() { + return this.ultimoPrezzoAcquisto; + } + + public void setUltimoPrezzoAcquisto(double ultimoPrezzoAcquisto) { + this.ultimoPrezzoAcquisto = ultimoPrezzoAcquisto; + } + + public it.acxent.anag.Clifor getFornitoreAbituale() { + ArticoloFornitore af = new ArticoloFornitore(getApFull()); + af.findByArticoloTessutoFornitoreAbituale(getId_articoloTessuto()); + return af.getFornitore(); + } + + public Vectumerator getFornitori() { + return new ArticoloFornitore(getApFull()).findById_articoloTessuto(getId_articoloTessuto(), 0, 0); + } + + public ResParm addFornitore(ArticoloFornitore ab) { + ResParm rp = new ResParm(true); + ArticoloFornitore bean = new ArticoloFornitore(getApFull()); + bean.findByPrimaryKey(ab.getId_articoloFornitore()); + ab.setDBState(bean.getDBState()); + if (ab.getFlgAbituale() == 1L) + rp = ab.deleteFlgAbitualeArticoloTessuto(ab.getId_articoloTessuto()); + rp.append(ab.save()); + return rp; + } + + public ResParm delFornitore(ArticoloFornitore ca) { + ArticoloFornitore bean = new ArticoloFornitore(getApFull()); + bean.findByPrimaryKey(ca.getId_articoloFornitore()); + return bean.delete(); + } + + public synchronized ResParm aggiornaUltimoCosto(double l_costoNuovo, Date l_dataCarico) { + ResParm rp = new ResParm(true); + if ((getDataUltimoPrezzoAcquisto() == null || getDateDiff(getDataUltimoPrezzoAcquisto(), l_dataCarico) >= 0L) && l_costoNuovo != + getUltimoPrezzoAcquisto()) { + setDataUltimoPrezzoAcquisto(l_dataCarico); + setUltimoPrezzoAcquisto(l_costoNuovo); + rp = super.save(); + } + return rp; + } + + public Date getDataUltimoPrezzoAcquisto() { + return this.dataUltimoPrezzoAcquisto; + } + + public void setDataUltimoPrezzoAcquisto(Date dataUltimoPrezzoAcquisto) { + this.dataUltimoPrezzoAcquisto = dataUltimoPrezzoAcquisto; + } + + public double getQuantitaW() { + if (!isQuantitaCalcolate() && this.id_articoloTessuto != 0L) + calcolaQuantita(); + return this.quantitaW; + } + + public void setQuantitaW(double quantitaW) { + this.quantitaW = quantitaW; + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico()); + return this.magFisico; + } + + public void setId_magFisico(long id_magFisico) { + this.id_magFisico = id_magFisico; + setMagFisico(null); + } + + public void setMagFisico(MagFisico magFisico) { + this.magFisico = magFisico; + } + + public String getSeriale() { + return (this.seriale == null) ? "" : this.seriale.trim(); + } + + public void setSeriale(String seriale) { + this.seriale = seriale; + } + + public double getQuantitaLavorazione() { + return this.quantitaLavorazione; + } + + public void setQuantitaLavorazione(double quantitaLavorazione) { + this.quantitaLavorazione = quantitaLavorazione; + } + + @Deprecated + public Vectumerator findByCRSerMagazzino(ArticoloTessutoCR CR, int pageNumber, int pageRows) { + return AB_EMPTY_VECTUMERATOR; + } + + public Iva getIva(it.acxent.anag.Clifor l_clifor) { + this.iva = null; + if (l_clifor == null || l_clifor.getId_clifor() == 0L) { + this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, new Long(getId_iva())); + } else { + this.iva = new Iva(getApFull()); + this.iva.findByPrimaryKey(getId_iva(l_clifor)); + } + return this.iva; + } + + public long getId_iva(it.acxent.anag.Clifor l_clifor) { + if (l_clifor != null && l_clifor.getId_clifor() != 0L) { + if (l_clifor.getFlgArt8() == 1L) + return getCodiceIvaArt8_A(); + return this.id_iva; + } + return this.id_iva; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoAccoppiato.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoAccoppiato.java new file mode 100644 index 00000000..13ef98b2 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoAccoppiato.java @@ -0,0 +1,123 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ArticoloTessutoAccoppiato extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1487851616034L; + + private long id_articoloTessutoAccoppiato; + + private long id_articoloTessuto; + + private long id_articoloTessutoComponente; + + private ArticoloTessuto articoloTessuto; + + private ArticoloTessuto articoloTessutoComponente; + + public ArticoloTessutoAccoppiato(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloTessutoAccoppiato() {} + + public void setId_articoloTessutoAccoppiato(long newId_articoloTessutoAccoppiato) { + this.id_articoloTessutoAccoppiato = newId_articoloTessutoAccoppiato; + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public void setId_articoloTessutoComponente(long newId_articoloTessutoComponente) { + this.id_articoloTessutoComponente = newId_articoloTessutoComponente; + setArticoloTessutoComponente(null); + } + + public long getId_articoloTessutoAccoppiato() { + return this.id_articoloTessutoAccoppiato; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public long getId_articoloTessutoComponente() { + return this.id_articoloTessutoComponente; + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, getId_articoloTessuto()); + return this.articoloTessuto; + } + + public void setArticoloTessutoComponente(ArticoloTessuto newArticoloTessutoComponente) { + this.articoloTessutoComponente = newArticoloTessutoComponente; + } + + public ArticoloTessuto getArticoloTessutoComponente() { + this.articoloTessutoComponente = (ArticoloTessuto)getSecondaryObject(this.articoloTessutoComponente, ArticoloTessuto.class, + getId_articoloTessutoComponente()); + return this.articoloTessutoComponente; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloTessutoAccoppiatoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_TESSUTO_ACCOPPIATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByArticoloTessuto(long l_id_articoloTessuto) { + String s_Sql_Find = "select A.* from ARTICOLO_TESSUTO_ACCOPPIATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articoloTessuto=" + l_id_articoloTessuto); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoAccoppiatoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoAccoppiatoCR.java new file mode 100644 index 00000000..71a486fa --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoAccoppiatoCR.java @@ -0,0 +1,70 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloTessutoAccoppiatoCR extends CRAdapter { + private long id_articoloTessutoAccoppiato; + + private long id_articoloTessuto; + + private long id_articoloTessutoComponente; + + private ArticoloTessuto articoloTessuto; + + private ArticoloTessuto articoloTessutoComponente; + + public ArticoloTessutoAccoppiatoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloTessutoAccoppiatoCR() {} + + public void setId_articoloTessutoAccoppiato(long newId_articoloTessutoAccoppiato) { + this.id_articoloTessutoAccoppiato = newId_articoloTessutoAccoppiato; + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public void setId_articoloTessutoComponente(long newId_articoloTessutoComponente) { + this.id_articoloTessutoComponente = newId_articoloTessutoComponente; + setArticoloTessutoComponente(null); + } + + public long getId_articoloTessutoAccoppiato() { + return this.id_articoloTessutoAccoppiato; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public long getId_articoloTessutoComponente() { + return this.id_articoloTessutoComponente; + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, + + getId_articoloTessuto()); + return this.articoloTessuto; + } + + public void setArticoloTessutoComponente(ArticoloTessuto newArticoloTessutoComponente) { + this.articoloTessutoComponente = newArticoloTessutoComponente; + } + + public ArticoloTessuto getArticoloTessutoComponente() { + this.articoloTessutoComponente = (ArticoloTessuto)getSecondaryObject(this.articoloTessutoComponente, ArticoloTessuto.class, + + getId_articoloTessutoComponente()); + return this.articoloTessutoComponente; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoCR.java new file mode 100644 index 00000000..a7689a36 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoCR.java @@ -0,0 +1,316 @@ +package it.acxent.tex.anag; + +import it.acxent.anag.Iva; +import it.acxent.anag.MagFisico; +import it.acxent.art.Tipo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloTessutoCR extends CRAdapter { + private long id_articoloTessuto; + + private long id_iva; + + private long id_stagione; + + private long flgStato; + + private long altezzaMin; + + private long altezzaMax; + + private long lunghezzaFinita; + + private double pesoMin; + + private double pesoMax; + + private double pesoMq; + + private long lavaggio; + + private long candeggio; + + private long stiratura; + + private long asciugatura; + + private long pulituraSecco; + + private String codiceDoganale; + + private long flgUdm; + + private double prezzoBase; + + private Iva iva; + + private Stagione stagione; + + private long flgTipoTessutoM = -1L; + + private long id_tipo; + + private Tipo tipo; + + public static final long TIPO_RICERCA_USA_MAG = 1L; + + public static final long TIPO_RICERCA_VAR = 2L; + + private long flgTipoRicerca = 0L; + + private it.acxent.anag.Clifor clifor; + + private long id_clifor; + + private long id_magFisico; + + private MagFisico magFisico; + + public ArticoloTessutoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloTessutoCR() {} + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + } + + public void setId_iva(long newId_iva) { + this.id_iva = newId_iva; + setIva(null); + } + + public void setId_stagione(long newId_stagione) { + this.id_stagione = newId_stagione; + setStagione(null); + } + + public void setFlgStato(long newFlgStato) { + this.flgStato = newFlgStato; + } + + public void setAltezzaMin(long newAltezzaMin) { + this.altezzaMin = newAltezzaMin; + } + + public void setAltezzaMax(long newAltezzaMax) { + this.altezzaMax = newAltezzaMax; + } + + public void setLunghezzaFinita(long newLunghezzaFinita) { + this.lunghezzaFinita = newLunghezzaFinita; + } + + public void setPesoMin(double newPesoMin) { + this.pesoMin = newPesoMin; + } + + public void setPesoMax(double newPesoMax) { + this.pesoMax = newPesoMax; + } + + public void setPesoMq(double newPesoMq) { + this.pesoMq = newPesoMq; + } + + public void setLavaggio(long newLavaggio) { + this.lavaggio = newLavaggio; + } + + public void setCandeggio(long newCandeggio) { + this.candeggio = newCandeggio; + } + + public void setStiratura(long newStiratura) { + this.stiratura = newStiratura; + } + + public void setAsciugatura(long newAsciugatura) { + this.asciugatura = newAsciugatura; + } + + public void setPulituraSecco(long newPulituraSecco) { + this.pulituraSecco = newPulituraSecco; + } + + public void setCodiceDoganale(String newCodiceDoganale) { + this.codiceDoganale = newCodiceDoganale; + } + + public void setFlgUdm(long newFlgUdm) { + this.flgUdm = newFlgUdm; + } + + public void setPrezzoBase(double newPrezzoBase) { + this.prezzoBase = newPrezzoBase; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public long getId_iva() { + return this.id_iva; + } + + public long getId_stagione() { + return this.id_stagione; + } + + public long getFlgStato() { + return this.flgStato; + } + + public long getAltezzaMin() { + return this.altezzaMin; + } + + public long getAltezzaMax() { + return this.altezzaMax; + } + + public long getLunghezzaFinita() { + return this.lunghezzaFinita; + } + + public double getPesoMin() { + return this.pesoMin; + } + + public double getPesoMax() { + return this.pesoMax; + } + + public double getPesoMq() { + return this.pesoMq; + } + + public long getLavaggio() { + return this.lavaggio; + } + + public long getCandeggio() { + return this.candeggio; + } + + public long getStiratura() { + return this.stiratura; + } + + public long getAsciugatura() { + return this.asciugatura; + } + + public long getPulituraSecco() { + return this.pulituraSecco; + } + + public String getCodiceDoganale() { + return (this.codiceDoganale == null) ? "" : this.codiceDoganale.trim(); + } + + public long getFlgUdm() { + return this.flgUdm; + } + + public double getPrezzoBase() { + return this.prezzoBase; + } + + public void setIva(Iva newIva) { + this.iva = newIva; + } + + public Iva getIva() { + this.iva = (Iva)getSecondaryObject(this.iva, Iva.class, getId_iva()); + return this.iva; + } + + public void setStagione(Stagione newStagione) { + this.stagione = newStagione; + } + + public Stagione getStagione() { + this.stagione = (Stagione)getSecondaryObject(this.stagione, Stagione.class, getId_stagione()); + return this.stagione; + } + + public long getFlgTipoTessutoM() { + return this.flgTipoTessutoM; + } + + public void setFlgTipoTessutoM(long flgTipoTessutoM) { + this.flgTipoTessutoM = flgTipoTessutoM; + } + + public long getId_tipo() { + return this.id_tipo; + } + + public Tipo getTipo() { + this.tipo = (Tipo)getSecondaryObject(this.tipo, Tipo.class, getId_tipo()); + return this.tipo; + } + + public void setId_tipo(long id_tipo) { + this.id_tipo = id_tipo; + setTipo(null); + } + + public void setTipo(Tipo tipo) { + this.tipo = tipo; + } + + public static final String getTipoTessutoM(long l_flgTipoTessutoM) { + return ArticoloTessuto.getTipoTessutoM(l_flgTipoTessutoM); + } + + public String getTipoTessutoM() { + return ArticoloTessuto.getTipoTessutoM(getFlgTipoTessutoM()); + } + + public long getFlgTipoRicerca() { + return this.flgTipoRicerca; + } + + public void setFlgTipoRicerca(long flgTipoRicerca) { + this.flgTipoRicerca = flgTipoRicerca; + } + + public it.acxent.anag.Clifor getClifor() { + this.clifor = (it.acxent.anag.Clifor)getSecondaryObject(this.clifor, it.acxent.anag.Clifor.class, getId_clifor()); + return this.clifor; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, new Long(getId_magFisico())); + return this.magFisico; + } + + public void setClifor(it.acxent.anag.Clifor clifor) { + this.clifor = clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + setClifor(null); + } + + public void setId_magFisico(long id_magFisico) { + this.id_magFisico = id_magFisico; + } + + public void setMagFisico(MagFisico magFisico) { + this.magFisico = magFisico; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoColore.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoColore.java new file mode 100644 index 00000000..9f937fc1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoColore.java @@ -0,0 +1,570 @@ +package it.acxent.tex.anag; + +import it.acxent.anag.MagFisico; +import it.acxent.anag._AnagAdapter; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloVariante; +import it.acxent.art.Colore; +import it.acxent.art.TipologiaArticolo; +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.text.NumberFormat; +import java.util.HashMap; +import java.util.Set; + +public class ArticoloTessutoColore extends _AnagAdapter implements Serializable { + private static final long serialVersionUID = 1554215588008L; + + private long id_articoloTessutoColore; + + private long id_articoloTessuto; + + private long id_colore; + + private double quantitaAtc; + + private boolean quantitaCalcolate; + + private double quantitaEffettiva; + + private double quantitaImpegnata; + + private double quantitaInArrivo; + + private double quantitaLavorazione; + + private String quantitaMagazzinoMovimentoHtml; + + private ArticoloTessuto articoloTessuto; + + private Colore colore; + + private double mtLavorazioneTaglio; + + private String seriale; + + private long flgDispo; + + private double quantitaAtcW; + + private long id_magFisico; + + private MagFisico magFisico; + + public ArticoloTessutoColore(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloTessutoColore() {} + + public void setId_articoloTessutoColore(long newId_articoloTessutoColore) { + this.id_articoloTessutoColore = newId_articoloTessutoColore; + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public void setId_colore(long newId_colore) { + this.id_colore = newId_colore; + setColore(null); + } + + public void setQuantitaAtc(double newQuantita) { + this.quantitaAtc = newQuantita; + } + + public void setQuantitaCalcolate(boolean newQuantitaCalcolate) { + this.quantitaCalcolate = newQuantitaCalcolate; + } + + public void setQuantitaEffettiva(double newQuantitaEffettiva) { + this.quantitaEffettiva = newQuantitaEffettiva; + } + + public void setQuantitaImpegnata(double newQuantitaImpegnata) { + this.quantitaImpegnata = newQuantitaImpegnata; + } + + public void setQuantitaInArrivo(double newQuantitaInArrivo) { + this.quantitaInArrivo = newQuantitaInArrivo; + } + + public void setQuantitaMagazzinoMovimentoHtml(String newQuantitaMagazzinoMovimentoHtml) { + this.quantitaMagazzinoMovimentoHtml = newQuantitaMagazzinoMovimentoHtml; + } + + public long getId_articoloTessutoColore() { + return this.id_articoloTessutoColore; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public long getId_colore() { + return this.id_colore; + } + + public boolean isQuantitaCalcolate() { + return this.quantitaCalcolate; + } + + public double getQuantitaEffettiva() { + if (!isQuantitaCalcolate() && getId_articoloTessuto() != 0L) + calcolaQuantita(); + return this.quantitaEffettiva; + } + + public double getQuantitaImpegnata() { + if (!isQuantitaCalcolate() && getId_articoloTessuto() != 0L) + calcolaQuantita(); + return this.quantitaImpegnata; + } + + public double getQuantitaInArrivo() { + if (!isQuantitaCalcolate() && getId_articoloTessuto() != 0L) + calcolaQuantita(); + return this.quantitaInArrivo; + } + + public String getQuantitaMagazzinoMovimentoHtml() { + if (!isQuantitaCalcolate() && getId_articoloTessuto() != 0L) + calcolaQuantita(); + return (this.quantitaMagazzinoMovimentoHtml == null) ? "" : this.quantitaMagazzinoMovimentoHtml.trim(); + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, getId_articoloTessuto()); + return this.articoloTessuto; + } + + public void setColore(Colore newColore) { + this.colore = newColore; + } + + public Colore getColore() { + this.colore = (Colore)getSecondaryObject(this.colore, Colore.class, getId_colore()); + return this.colore; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloTessutoColoreCR CR, int pageNumber, int pageRows) { + if (CR.getFlgTipoRicerca() == 1L) + return findByCRDispoMagazzino(CR, pageNumber, pageRows); + String s_Sql_Find = "select A.* from ARTICOLO_TESSUTO_COLORE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByArticoloTessutoColore(long l_id_articoloTessuto, long l_id_colore) { + String s_Sql_Find = "select A.* from ARTICOLO_TESSUTO_COLORE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_articoloTessuto = " + l_id_articoloTessuto); + wc.addWc(" A.id_colore = " + l_id_colore); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + private synchronized void calcolaQuantita() { + if ((!isQuantitaCalcolate() ? true : false) & ((getId_articoloTessuto() != 0L) ? true : false)) { + long l_flgDispo; + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagTessutoDisponibilita(getId_articoloTessuto(), getId_articoloTessutoColore(), Articolo.SERIALE_NULL, 0L, 0L, -1L, 0L, "", DATA_NULL); + double q = rd.getQuantita(); + double nr = rd.getNr(); + double kg = rd.getKg(); + double mt = rd.getMt(); + setQuantitaAtcW(q); + setQuantitaAtc(q); + setQuantitaLavorazione(new RigaDocumento(getApFull()).getQuantitaTessutoLavorazioneByArticoloTessutoColoreSeriale( + getId_articoloTessutoColore(), 0L, 0L, Articolo.SERIALE_NULL)); + if (usaMagazzino()) { + DoubleOperator dop = new DoubleOperator(q); + dop.add(this.quantitaInArrivo); + dop.add(this.quantitaLavorazione); + dop.subtract(this.quantitaImpegnata); + setQuantitaEffettiva(dop.getResult()); + } + this.quantitaMagazzinoMovimentoHtml = getMovimentoHtmlDesc(getArticoloTessuto().getTipologiaArticolo(), q, nr, kg, mt, this.quantitaInArrivo, this.quantitaImpegnata, this.quantitaEffettiva, this.quantitaLavorazione, + usaMagazzino(), + getParm("USA_MAGAZZINO").isTrue(), getNf()); + if (!usaMagazzino()) { + l_flgDispo = 1L; + } else { + l_flgDispo = (this.quantitaAtc > 0.0D) ? 1L : 0L; + } + String temp = "update ARTICOLO_TESSUTO_COLORE set quantitaMagazzinoMovimentoHtml='" + this.quantitaMagazzinoMovimentoHtml + "', quantitaAtc=" + this.quantitaAtc + ", quantitaEffettiva=" + this.quantitaEffettiva + ", quantitaImpegnata=" + this.quantitaImpegnata + ", quantitaLavorazione=" + this.quantitaLavorazione + ", quantitaCalcolate=true, flgDispo=" + l_flgDispo + " where id_articoloTessuto=" + + + + getId_articoloTessuto(); + update(temp); + setQuantitaCalcolate(true); + } + } + + public static final String getMovimentoHtmlDesc(TipologiaArticolo tipologiaArticolo, double q, double nr, double kg, double mt, double quantitaInArrivo, double quantitaImpegnata, double quantitaEffettiva, double quantitaLavorazione, boolean usaMagazzino, boolean usaMagazzinoSuArticoli, NumberFormat nf) { + StringBuilder sb = new StringBuilder(); + if (!usaMagazzino) { + sb.append("No magazzino"); + } else if (!usaMagazzinoSuArticoli) { + sb.append(" "); + if (tipologiaArticolo.getFlgNr() == 1L && + tipologiaArticolo.getFlgUdm() == 1L && nr < 0.0D) { + sb.append("n "); + sb.append(nf.format(nr)); + } + if (tipologiaArticolo.getFlgMt() == 1L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("mt "); + sb.append(nf.format(mt)); + } + if (tipologiaArticolo.getFlgKg() == 1L) { + if (sb.length() > 0) + sb.append(" "); + sb.append("kg "); + sb.append(nf.format(kg)); + } + sb.append(""); + sb.append(" + "); + sb.append(" "); + sb.append(nf.format(quantitaLavorazione)); + sb.append(""); + sb.append(" + "); + sb.append(" "); + sb.append(nf.format(quantitaInArrivo)); + sb.append(""); + sb.append(" - "); + sb.append(" "); + sb.append(nf.format(quantitaImpegnata)); + sb.append(""); + sb.append(" = "); + sb.append(tipologiaArticolo.getUdm()); + sb.append(" "); + sb.append(nf.format(quantitaEffettiva)); + sb.append(""); + } else { + DoubleOperator dp = new DoubleOperator(q); + dp.subtract(quantitaImpegnata); + sb.append(tipologiaArticolo.getUdm()); + sb.append(" "); + if (q < 0.0D) { + sb.append(" "); + sb.append(nf.format(q)); + sb.append(""); + } else { + sb.append(nf.format(q)); + } + sb.append(" - "); + sb.append(" "); + sb.append(nf.format(quantitaImpegnata)); + sb.append(""); + sb.append(" = "); + sb.append(" "); + sb.append(nf.format(dp.getResult())); + sb.append(""); + } + return sb.toString(); + } + + public boolean usaMagazzino() { + if (getArticoloTessuto().getTipo().getFlgTipoMagazzino() == 9L || + getArticoloTessuto().getTipo().getFlgTipoMagazzino() == 0L) + return false; + return true; + } + + public String getDescrizioneCompleta() { + StringBuilder sb = new StringBuilder(); + sb.append(getArticoloTessuto().getDescrizioneCompleta()); + sb.append(" "); + sb.append(getColore().getDescrizioneCompleta()); + return sb.toString(); + } + + public String getDescrizioneCompleta(String lang) { + StringBuilder sb = new StringBuilder(); + sb.append(getArticoloTessuto().getDescrizioneCompleta(lang)); + sb.append(" "); + sb.append(getColore().getDescrizioneCompleta(lang)); + return sb.toString(); + } + + public Vectumerator findTessutiPerTaglioByArticolo(long l_id_articolo) { + ResParm rp = new ResParm(true); + boolean debug = false; + String debugIngo = "findTessutiPerTaglioByArticolo"; + HashMap hmTess = new HashMap<>(); + Articolo articolo = new Articolo(this.apFull); + articolo.findByPrimaryKey(l_id_articolo); + if (articolo.getId_articolo() > 0L) { + Vectumerator vecAAT = new Vectumerator(); + if (articolo.getFlgUsaVarianti() == 1L) { + Vectumerator vecVar = articolo.findArticoliVarianti(-1L, -1L); + while (vecVar.hasMoreElements()) { + ArticoloVariante rowAV = (ArticoloVariante)vecVar.nextElement(); + vecAAT = rowAV.findArticoliTessuto(); + while (vecAAT.hasMoreElements()) { + ArticoloArticoloTessuto rowAAT = (ArticoloArticoloTessuto)vecAAT.nextElement(); + if (!hmTess.containsKey(Long.valueOf(rowAAT.getId_articoloTessutoColore()))) + hmTess.put(Long.valueOf(rowAAT.getId_articoloTessutoColore()), rowAAT.getArticoloTessutoColore()); + } + } + } else { + vecAAT = articolo.findArticoliTessuto(); + while (vecAAT.hasMoreElements()) { + ArticoloArticoloTessuto rowAAT = (ArticoloArticoloTessuto)vecAAT.nextElement(); + if (!hmTess.containsKey(Long.valueOf(rowAAT.getId_articoloTessutoColore()))) + hmTess.put(Long.valueOf(rowAAT.getId_articoloTessutoColore()), rowAAT.getArticoloTessutoColore()); + } + } + } + Vectumerator vecRes = new Vectumerator(); + Set keySet = hmTess.keySet(); + for (Long key : keySet) + vecRes.add(hmTess.get(key)); + return vecRes; + } + + public double getMtLavorazioneTaglio() { + return this.mtLavorazioneTaglio; + } + + public void setMtLavorazioneTaglio(double mtLavorazioneTaglio) { + this.mtLavorazioneTaglio = mtLavorazioneTaglio; + } + + public Vectumerator findByArticoloTessuto(long l_id_articoloTessuto) { + String s_Sql_Find = "select A.* from ARTICOLO_TESSUTO_COLORE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_articoloTessuto = " + l_id_articoloTessuto); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getQuantitaV() { + return this.quantitaAtc; + } + + public double getRealTimeQuantitaImpegnata() { + return new RigaDocumento(getApFull()).getQuantitaImpegnataTessutoByArticoloTessutoColoreSeriale(getId_articoloTessutoColore(), 0L, 0L, + getSeriale()); + } + + public double getRealTimeQuantitaInArrivo() { + double q1 = new RigaDocumento(getApFull()).getQuantitaTessutoInArrivoByArticoloTessutoColoreSeriale(getId_articoloTessutoColore(), 0L, 0L, + getSeriale()); + return q1; + } + + public String getSeriale() { + return this.seriale; + } + + public void setSeriale(String seriale) { + this.seriale = seriale; + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + try { + if (isColumnInResultSet(rst, "seriale")) + setSeriale(rst.getString("seriale")); + if (isColumnInResultSet(rst, "id_magFisico")) + setId_magFisico(rst.getLong("id_magFisico")); + if (isColumnInResultSet(rst, "quantitaAtc")) + setQuantitaAtc(rst.getDouble("quantitaAtc")); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public Vectumerator findByCRDispoMagazzino(ArticoloTessutoColoreCR CR, int pageNumber, int pageRows) { + try { + String sql = "SELECT M.id_magFisico, M.id_articoloTessutoColore as id_artmov, A.id_articoloTessutoColore,A.id_articoloTessuto,A.id_colore, M.id_clifor, M.seriale, SUM(segnoMov*kg) as quantitaAtc, SUM(segnoMov*kg) as kg, SUM(segnoMov*mt) as mt, SUM(segnoMov*nr) as nr, B.id_tipo FROM RIGA_DOCUMENTO AS M INNER JOIN ARTICOLO_TESSUTO_COLORE AS A ON A.id_articoloTessutoColore=M.id_articoloTessutoColore INNER JOIN COLORE AS CO ON CO.id_colore=A.id_colore inner join ARTICOLO_TESSUTO AS B ON A.id_articoloTessuto=B.id_articoloTessuto"; + String s_Sql_GrouBy = " group by M.id_articoloTessutoColore, M.id_clifor, M.seriale ,M.id_magFisico"; + String s_Sql_Having = " HAVING ( kg>0 and A.id_articoloTessutoColore>0 and M.seriale is not null ) "; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + String star = ""; + String temp = CR.getSearchTxt().trim(); + StringTokenizer st = new StringTokenizer(temp.trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = star + star; + token = prepareInputMySqlString(token, false); + token = token.replace("*", "%"); + txt.append("(B.descrizione like '%" + token + "%' or CO.descrizione like '%" + token + "%' or CO.codiceColore like '%" + token + "%')"); + if (st.hasMoreTokens()) { + txt.append(" and "); + star = "%"; + } + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (isDeleteLogic()) + if (CR.getFlgShowDeleteLogic() == 0L) { + wc.addWc("A.dataFineVld is null"); + } else { + wc.addWc("A.dataFineVld is not null"); + } + if (CR.getId_clifor() != 0L && CR.getMagFisico().getFlgTipo() == 0L) { + wc.addWc("(M.id_clifor=" + CR.getId_clifor() + ")"); + } else { + wc.addWc("(M.id_clifor=0 or M.id_clifor is null )"); + } + if (CR.getId_magFisico() > 0L) + wc.addWc(" M.id_magFisico=" + CR.getId_magFisico()); + if (CR.getId_articoloTessuto() > 0L) + wc.addWc(" A.id_articoloTessuto=" + CR.getId_articoloTessuto()); + if (CR.getId_articoloTessutoColore() > 0L) + wc.addWc(" M.id_articoloTessutoColore=" + CR.getId_articoloTessutoColore()); + PreparedStatement stmt = getConn().prepareStatement(sql + sql + wc.toString() + s_Sql_GrouBy); + return findRows(stmt, pageNumber, 50); + } catch (SQLException e) { + handleDebug(e); + e.printStackTrace(); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgDispo() { + return this.flgDispo; + } + + public void setFlgDispo(long flgDispo) { + this.flgDispo = flgDispo; + } + + public double getQuantitaAtc(Date data) { + if (!usaMagazzino()) + return 0.0D; + if (getParm("USA_MAGAZZINO").isFalse()) { + RigaDocumento rd = new RigaDocumento(getApFull()); + rd.findMagTessutoDisponibilita(getId_articoloTessuto(), 0L, getSeriale(), getId_magFisico(), 0L, -1L, 0L, "", data); + return rd.getQuantita(); + } + return this.quantitaAtc; + } + + public double getQuantitaAtc() { + return getQuantitaAtc(null); + } + + public double getQuantitaAtcW() { + if (!isQuantitaCalcolate() && getId_articoloTessutoColore() != 0L) + calcolaQuantita(); + return this.quantitaAtcW; + } + + public void setQuantitaAtcW(double quantitaAtW) { + this.quantitaAtcW = quantitaAtW; + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, getId_magFisico()); + return this.magFisico; + } + + public void setId_magFisico(long id_magFisico) { + this.id_magFisico = id_magFisico; + setMagFisico(null); + } + + public void setMagFisico(MagFisico magFisico) { + this.magFisico = magFisico; + } + + public double getQuantitaLavorazione() { + return this.quantitaLavorazione; + } + + public void setQuantitaLavorazione(double quantitaLavorazione) { + this.quantitaLavorazione = quantitaLavorazione; + } + + public double getRealTimeQuantitaLavorazione() { + double q1 = new RigaDocumento(getApFull()) + .getQuantitaTessutoLavorazioneByArticoloTessutoColoreSeriale(getId_articoloTessutoColore(), 0L, 0L, getSeriale()); + return q1; + } + + public void resetCalcoloQuantita() { + if (getId_articoloTessutoColore() > 0L) { + update("update ARTICOLO_TESSUTO_COLORE set quantitaCalcolate=false where id_articoloTessutocolore=" + + getId_articoloTessutoColore()); + setQuantitaCalcolate(false); + } + } + + public long getId_iva(it.acxent.anag.Clifor l_clifor) { + return getArticoloTessuto().getId_iva(l_clifor); + } + + public TipologiaArticolo getTipologiaArticolo() { + return getArticoloTessuto().getTipologiaArticolo(); + } + + public boolean isUsaLotti() { + return (getArticoloTessuto().getTipo().getFlgTipoMagazzino() == 3L); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoColoreCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoColoreCR.java new file mode 100644 index 00000000..fedde8d6 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoColoreCR.java @@ -0,0 +1,186 @@ +package it.acxent.tex.anag; + +import it.acxent.anag.MagFisico; +import it.acxent.art.Colore; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloTessutoColoreCR extends CRAdapter { + private long id_articoloTessutoColore; + + private long id_articoloTessuto; + + private long id_colore; + + private double quantita; + + private boolean quantitaCalcolate; + + private double quantitaEffettiva; + + private double quantitaImpegnata; + + private double quantitaInArrivo; + + private String quantitaMagazzinoMovimentoHtml; + + private ArticoloTessuto articoloTessuto; + + private Colore colore; + + private it.acxent.anag.Clifor clifor; + + private long id_clifor; + + private long id_magFisico; + + private MagFisico magFisico; + + private long flgTipoRicerca = 0L; + + public ArticoloTessutoColoreCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloTessutoColoreCR() {} + + public void setId_articoloTessutoColore(long newId_articoloTessutoColore) { + this.id_articoloTessutoColore = newId_articoloTessutoColore; + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public void setId_colore(long newId_colore) { + this.id_colore = newId_colore; + setColore(null); + } + + public void setQuantita(double newQuantita) { + this.quantita = newQuantita; + } + + public void setQuantitaCalcolate(boolean newQuantitaCalcolate) { + this.quantitaCalcolate = newQuantitaCalcolate; + } + + public void setQuantitaEffettiva(double newQuantitaEffettiva) { + this.quantitaEffettiva = newQuantitaEffettiva; + } + + public void setQuantitaImpegnata(double newQuantitaImpegnata) { + this.quantitaImpegnata = newQuantitaImpegnata; + } + + public void setQuantitaInArrivo(double newQuantitaInArrivo) { + this.quantitaInArrivo = newQuantitaInArrivo; + } + + public void setQuantitaMagazzinoMovimentoHtml(String newQuantitaMagazzinoMovimentoHtml) { + this.quantitaMagazzinoMovimentoHtml = newQuantitaMagazzinoMovimentoHtml; + } + + public long getId_articoloTessutoColore() { + return this.id_articoloTessutoColore; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public long getId_colore() { + return this.id_colore; + } + + public double getQuantita() { + return this.quantita; + } + + public boolean getQuantitaCalcolate() { + return this.quantitaCalcolate; + } + + public double getQuantitaEffettiva() { + return this.quantitaEffettiva; + } + + public double getQuantitaImpegnata() { + return this.quantitaImpegnata; + } + + public double getQuantitaInArrivo() { + return this.quantitaInArrivo; + } + + public String getQuantitaMagazzinoMovimentoHtml() { + return (this.quantitaMagazzinoMovimentoHtml == null) ? "" : this.quantitaMagazzinoMovimentoHtml.trim(); + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, + + getId_articoloTessuto()); + return this.articoloTessuto; + } + + public void setColore(Colore newColore) { + this.colore = newColore; + } + + public Colore getColore() { + this.colore = (Colore)getSecondaryObject(this.colore, Colore.class, + + getId_colore()); + return this.colore; + } + + public it.acxent.anag.Clifor getClifor() { + this.clifor = (it.acxent.anag.Clifor)getSecondaryObject(this.clifor, it.acxent.anag.Clifor.class, getId_clifor()); + return this.clifor; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_magFisico() { + return this.id_magFisico; + } + + public MagFisico getMagFisico() { + this.magFisico = (MagFisico)getSecondaryObject(this.magFisico, MagFisico.class, new Long(getId_magFisico())); + return this.magFisico; + } + + public void setClifor(it.acxent.anag.Clifor clifor) { + this.clifor = clifor; + } + + public void setId_clifor(long id_clifor) { + this.id_clifor = id_clifor; + setClifor(null); + } + + public void setId_magFisico(long id_magFisico) { + this.id_magFisico = id_magFisico; + setMagFisico(null); + } + + public void setMagFisico(MagFisico magFisico) { + this.magFisico = magFisico; + } + + public long getFlgTipoRicerca() { + return this.flgTipoRicerca; + } + + public void setFlgTipoRicerca(long flgTipoRicerca) { + this.flgTipoRicerca = flgTipoRicerca; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoComponente.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoComponente.java new file mode 100644 index 00000000..28d564e5 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoComponente.java @@ -0,0 +1,179 @@ +package it.acxent.tex.anag; + +import it.acxent.art.Componente; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ArticoloTessutoComponente extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228166638L; + + private long id_articoloTessutoComponente; + + private long id_componente; + + private long id_articoloTessuto; + + private double percentuale; + + private Componente componente; + + private ArticoloTessuto articoloTessuto; + + public ArticoloTessutoComponente(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloTessutoComponente() {} + + public void setId_articoloTessutoComponente(long newId_articoloTessutoComponente) { + this.id_articoloTessutoComponente = newId_articoloTessutoComponente; + } + + public void setId_componente(long newId_componente) { + this.id_componente = newId_componente; + setComponente(null); + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public void setPercentuale(double newPercentuale) { + this.percentuale = newPercentuale; + } + + public long getId_articoloTessutoComponente() { + return this.id_articoloTessutoComponente; + } + + public long getId_componente() { + return this.id_componente; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public double getPercentuale() { + return this.percentuale; + } + + public void setComponente(Componente newComponente) { + this.componente = newComponente; + } + + public Componente getComponente() { + this.componente = (Componente)getSecondaryObject(this.componente, Componente.class, getId_componente()); + return this.componente; + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, getId_articoloTessuto()); + return this.articoloTessuto; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloTessutoComponenteCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_TESSUTO_COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getTotPercentualeByArticoloTessuto(long l_id_articoloTessuto) { + String s_Sql_Find = "select sum(percentuale) as _sum from ARTICOLO_TESSUTO_COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_articoloTessuto = " + l_id_articoloTessuto); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return getSum(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return 0.0D; + } + } + + public ResParm save() { + ResParm rp = isSalvabile(); + if (rp.getStatus()) + return super.save(); + return rp; + } + + private ResParm isSalvabile() { + boolean checkComponente = false; + DoubleOperator dop = new DoubleOperator(); + ArticoloTessutoComponente afc = new ArticoloTessutoComponente(getApFull()); + if (getId_articoloTessuto() == 0L) + return new ResParm(false, "ERRORE! Tessuto non valido!"); + if (getPercentuale() == 0.0D) + return new ResParm(false, "ERRORE! Percentuale non valida!"); + Vectumerator vec = afc.findByArticoloTessuto(getId_articoloTessuto()); + while (vec.hasMoreElements()) { + afc = (ArticoloTessutoComponente)vec.nextElement(); + if (afc.getId_componente() == getId_componente()) + checkComponente = true; + dop.add(afc.getPercentuale()); + } + dop.add(getPercentuale()); + if (dop.getResult() <= 100.0D && !checkComponente) + return new ResParm(true); + if (dop.getResult() > 100.0D) + return new ResParm(false, "ERRORE! Percentuale errata!"); + return new ResParm(false, "ERRORE! Componente già selezionato!"); + } + + public Vectumerator findByArticoloTessuto(long l_id_articoloTessuto) { + String s_Sql_Find = "select A.* from ARTICOLO_TESSUTO_COMPONENTE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_articoloTessuto = " + l_id_articoloTessuto); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, 0, 0); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoComponenteCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoComponenteCR.java new file mode 100644 index 00000000..07b34724 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoComponenteCR.java @@ -0,0 +1,81 @@ +package it.acxent.tex.anag; + +import it.acxent.art.Componente; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloTessutoComponenteCR extends CRAdapter { + private long id_articoloTessutoComponente; + + private long id_componente; + + private long id_articoloTessuto; + + private double percentuale; + + private Componente componente; + + private ArticoloTessuto articoloTessuto; + + public ArticoloTessutoComponenteCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloTessutoComponenteCR() {} + + public void setId_articoloTessutoComponente(long newId_articoloTessutoComponente) { + this.id_articoloTessutoComponente = newId_articoloTessutoComponente; + } + + public void setId_componente(long newId_componente) { + this.id_componente = newId_componente; + setComponente(null); + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public void setPercentuale(double newPercentuale) { + this.percentuale = newPercentuale; + } + + public long getId_articoloTessutoComponente() { + return this.id_articoloTessutoComponente; + } + + public long getId_componente() { + return this.id_componente; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public double getPercentuale() { + return this.percentuale; + } + + public void setComponente(Componente newComponente) { + this.componente = newComponente; + } + + public Componente getComponente() { + this.componente = (Componente)getSecondaryObject(this.componente, Componente.class, + + getId_componente()); + return this.componente; + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, + + getId_articoloTessuto()); + return this.articoloTessuto; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoFilato.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoFilato.java new file mode 100644 index 00000000..45bb2f2c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoFilato.java @@ -0,0 +1,191 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.math.RoundingMode; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ArticoloTessutoFilato extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1487838624757L; + + private long id_articoloTessutoFilato; + + private long id_articoloTessuto; + + private long id_articoloFilatoColore; + + private String serie; + + private long ordine; + + private double percentuale; + + private long flgTramaOrdito; + + private String noteOrdTess; + + private ArticoloTessuto articoloTessuto; + + private ArticoloFilatoColore articoloFilatoColore; + + public ArticoloTessutoFilato(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloTessutoFilato() {} + + public void setId_articoloTessutoFilato(long newId_articoloTessutoFilato) { + this.id_articoloTessutoFilato = newId_articoloTessutoFilato; + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public void setId_articoloFilatoColore(long newId_articoloFilatoColore) { + this.id_articoloFilatoColore = newId_articoloFilatoColore; + setArticoloFilatoColore(null); + } + + public void setSerie(String newSerie) { + this.serie = newSerie; + } + + public void setOrdine(long newOrdine) { + this.ordine = newOrdine; + } + + public void setPercentuale(double newPercentuale) { + this.percentuale = newPercentuale; + } + + public void setFlgTramaOrdito(long newFlgTramaOrdito) { + this.flgTramaOrdito = newFlgTramaOrdito; + } + + public void setNoteOrdTess(String newNoteOrdTess) { + this.noteOrdTess = newNoteOrdTess; + } + + public long getId_articoloTessutoFilato() { + return this.id_articoloTessutoFilato; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public long getId_articoloFilatoColore() { + return this.id_articoloFilatoColore; + } + + public String getSerie() { + return (this.serie == null) ? "" : this.serie.trim(); + } + + public long getOrdine() { + return this.ordine; + } + + public double getPercentuale() { + return this.percentuale; + } + + public double getKgNecessari(double kgTot) { + if (kgTot == 0.0D) + return 0.0D; + DoubleOperator dop = new DoubleOperator(kgTot); + dop.multiply(getPercentuale()); + dop.divide(100.0F); + dop.setScale(2, RoundingMode.HALF_DOWN); + return dop.getResult(); + } + + public long getFlgTramaOrdito() { + return this.flgTramaOrdito; + } + + public String getNoteOrdTess() { + return (this.noteOrdTess == null) ? "" : this.noteOrdTess.trim(); + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, getId_articoloTessuto()); + return this.articoloTessuto; + } + + public void setArticoloFilatoColore(ArticoloFilatoColore newArticoloFilatoColore) { + this.articoloFilatoColore = newArticoloFilatoColore; + } + + public ArticoloFilatoColore getArticoloFilatoColore() { + this.articoloFilatoColore = (ArticoloFilatoColore)getSecondaryObject(this.articoloFilatoColore, ArticoloFilatoColore.class, + getId_articoloFilatoColore()); + return this.articoloFilatoColore; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloTessutoFilatoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_TESSUTO_FILATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByArticoloTessuto(long l_id_articoloTessuto, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_TESSUTO_FILATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_articoloTessuto=" + l_id_articoloTessuto); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizioneCompleta() { + if (getId_articoloTessutoFilato() == 0L) + return ""; + return getArticoloFilatoColore().getDescrizioneCompleta() + " " + getArticoloFilatoColore().getDescrizioneCompleta() + "%"; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoFilatoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoFilatoCR.java new file mode 100644 index 00000000..b53365a1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoFilatoCR.java @@ -0,0 +1,120 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloTessutoFilatoCR extends CRAdapter { + private long id_articoloTessutoFilato; + + private long id_articoloTessuto; + + private long id_articoloFilatoColore; + + private String serie; + + private long ordine; + + private double percentuale; + + private long flgTramaOrdito; + + private String noteOrdTess; + + private ArticoloTessuto articoloTessuto; + + private ArticoloFilatoColore articoloFilatoColore; + + public ArticoloTessutoFilatoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloTessutoFilatoCR() {} + + public void setId_articoloTessutoFilato(long newId_articoloTessutoFilato) { + this.id_articoloTessutoFilato = newId_articoloTessutoFilato; + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public void setId_articoloFilatoColore(long newId_articoloFilatoColore) { + this.id_articoloFilatoColore = newId_articoloFilatoColore; + setArticoloFilatoColore(null); + } + + public void setSerie(String newSerie) { + this.serie = newSerie; + } + + public void setOrdine(long newOrdine) { + this.ordine = newOrdine; + } + + public void setPercentuale(double newPercentuale) { + this.percentuale = newPercentuale; + } + + public void setFlgTramaOrdito(long newFlgTramaOrdito) { + this.flgTramaOrdito = newFlgTramaOrdito; + } + + public void setNoteOrdTess(String newNoteOrdTess) { + this.noteOrdTess = newNoteOrdTess; + } + + public long getId_articoloTessutoFilato() { + return this.id_articoloTessutoFilato; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public long getId_articoloFilatoColore() { + return this.id_articoloFilatoColore; + } + + public String getSerie() { + return (this.serie == null) ? "" : this.serie.trim(); + } + + public long getOrdine() { + return this.ordine; + } + + public double getPercentuale() { + return this.percentuale; + } + + public long getFlgTramaOrdito() { + return this.flgTramaOrdito; + } + + public String getNoteOrdTess() { + return (this.noteOrdTess == null) ? "" : this.noteOrdTess.trim(); + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, + + getId_articoloTessuto()); + return this.articoloTessuto; + } + + public void setArticoloFilatoColore(ArticoloFilatoColore newArticoloFilatoColore) { + this.articoloFilatoColore = newArticoloFilatoColore; + } + + public ArticoloFilatoColore getArticoloFilatoColore() { + this.articoloFilatoColore = (ArticoloFilatoColore)getSecondaryObject(this.articoloFilatoColore, ArticoloFilatoColore.class, + + getId_articoloFilatoColore()); + return this.articoloFilatoColore; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoLavorazione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoLavorazione.java new file mode 100644 index 00000000..8bec3711 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoLavorazione.java @@ -0,0 +1,131 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ArticoloTessutoLavorazione extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1487851616118L; + + private long id_articoloTessutoLavorazione; + + private long id_lavorazione; + + private long id_articoloTessuto; + + private long ordine; + + private long flgObbligatoria; + + private Lavorazione lavorazione; + + private ArticoloTessuto articoloTessuto; + + public ArticoloTessutoLavorazione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloTessutoLavorazione() {} + + public void setId_articoloTessutoLavorazione(long newId_articoloTessutoLavorazione) { + this.id_articoloTessutoLavorazione = newId_articoloTessutoLavorazione; + } + + public void setId_lavorazione(long newId_lavorazione) { + this.id_lavorazione = newId_lavorazione; + setLavorazione(null); + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public void setOrdine(long newOrdine) { + this.ordine = newOrdine; + } + + public void setFlgObbligatoria(long newFlgObbligatoria) { + this.flgObbligatoria = newFlgObbligatoria; + } + + public long getId_articoloTessutoLavorazione() { + return this.id_articoloTessutoLavorazione; + } + + public long getId_lavorazione() { + return this.id_lavorazione; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public long getOrdine() { + return this.ordine; + } + + public long getFlgObbligatoria() { + return this.flgObbligatoria; + } + + public void setLavorazione(Lavorazione newLavorazione) { + this.lavorazione = newLavorazione; + } + + public Lavorazione getLavorazione() { + this.lavorazione = (Lavorazione)getSecondaryObject(this.lavorazione, Lavorazione.class, + + getId_lavorazione()); + return this.lavorazione; + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, + + getId_articoloTessuto()); + return this.articoloTessuto; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ArticoloTessutoLavorazioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ARTICOLO_TESSUTO_LAVORAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoLavorazioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoLavorazioneCR.java new file mode 100644 index 00000000..3b1c902f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ArticoloTessutoLavorazioneCR.java @@ -0,0 +1,90 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ArticoloTessutoLavorazioneCR extends CRAdapter { + private long id_articoloTessutoLavorazione; + + private long id_lavorazione; + + private long id_articoloTessuto; + + private long ordine; + + private long flgObbligatoria; + + private Lavorazione lavorazione; + + private ArticoloTessuto articoloTessuto; + + public ArticoloTessutoLavorazioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ArticoloTessutoLavorazioneCR() {} + + public void setId_articoloTessutoLavorazione(long newId_articoloTessutoLavorazione) { + this.id_articoloTessutoLavorazione = newId_articoloTessutoLavorazione; + } + + public void setId_lavorazione(long newId_lavorazione) { + this.id_lavorazione = newId_lavorazione; + setLavorazione(null); + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public void setOrdine(long newOrdine) { + this.ordine = newOrdine; + } + + public void setFlgObbligatoria(long newFlgObbligatoria) { + this.flgObbligatoria = newFlgObbligatoria; + } + + public long getId_articoloTessutoLavorazione() { + return this.id_articoloTessutoLavorazione; + } + + public long getId_lavorazione() { + return this.id_lavorazione; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public long getOrdine() { + return this.ordine; + } + + public long getFlgObbligatoria() { + return this.flgObbligatoria; + } + + public void setLavorazione(Lavorazione newLavorazione) { + this.lavorazione = newLavorazione; + } + + public Lavorazione getLavorazione() { + this.lavorazione = (Lavorazione)getSecondaryObject(this.lavorazione, Lavorazione.class, + + getId_lavorazione()); + return this.lavorazione; + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, + + getId_articoloTessuto()); + return this.articoloTessuto; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Clifor.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Clifor.java new file mode 100644 index 00000000..466ef570 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Clifor.java @@ -0,0 +1,11 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; + +public class Clifor extends it.acxent.anag.Clifor { + public Clifor(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Clifor() {} +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/CliforCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/CliforCR.java new file mode 100644 index 00000000..42f47aed --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/CliforCR.java @@ -0,0 +1,11 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; + +public class CliforCR extends it.acxent.anag.CliforCR { + public CliforCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CliforCR() {} +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/CliforLavorazione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/CliforLavorazione.java new file mode 100644 index 00000000..f072de88 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/CliforLavorazione.java @@ -0,0 +1,117 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class CliforLavorazione extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1487851616559L; + + private long id_cliforLavorazione; + + private long id_clifor; + + private long id_lavorazione; + + private double costoLavorazione; + + private Clifor clifor; + + private Lavorazione lavorazione; + + public CliforLavorazione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CliforLavorazione() {} + + public void setId_cliforLavorazione(long newId_cliforLavorazione) { + this.id_cliforLavorazione = newId_cliforLavorazione; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_lavorazione(long newId_lavorazione) { + this.id_lavorazione = newId_lavorazione; + setLavorazione(null); + } + + public long getId_cliforLavorazione() { + return this.id_cliforLavorazione; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_lavorazione() { + return this.id_lavorazione; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public void setLavorazione(Lavorazione newLavorazione) { + this.lavorazione = newLavorazione; + } + + public Lavorazione getLavorazione() { + this.lavorazione = (Lavorazione)getSecondaryObject(this.lavorazione, Lavorazione.class, getId_lavorazione()); + return this.lavorazione; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(CliforLavorazioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CLIFOR_LAVORAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getCostoLavorazione() { + return this.costoLavorazione; + } + + public void setCostoLavorazione(double costoLavorazione) { + this.costoLavorazione = costoLavorazione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/CliforLavorazioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/CliforLavorazioneCR.java new file mode 100644 index 00000000..64348a33 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/CliforLavorazioneCR.java @@ -0,0 +1,70 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class CliforLavorazioneCR extends CRAdapter { + private long id_cliforLavorazione; + + private long id_clifor; + + private long id_lavorazione; + + private Clifor clifor; + + private Lavorazione lavorazione; + + public CliforLavorazioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public CliforLavorazioneCR() {} + + public void setId_cliforLavorazione(long newId_cliforLavorazione) { + this.id_cliforLavorazione = newId_cliforLavorazione; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_lavorazione(long newId_lavorazione) { + this.id_lavorazione = newId_lavorazione; + setLavorazione(null); + } + + public long getId_cliforLavorazione() { + return this.id_cliforLavorazione; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_lavorazione() { + return this.id_lavorazione; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, + + getId_clifor()); + return this.clifor; + } + + public void setLavorazione(Lavorazione newLavorazione) { + this.lavorazione = newLavorazione; + } + + public Lavorazione getLavorazione() { + this.lavorazione = (Lavorazione)getSecondaryObject(this.lavorazione, Lavorazione.class, + + getId_lavorazione()); + return this.lavorazione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFilato.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFilato.java new file mode 100644 index 00000000..d9765cd9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFilato.java @@ -0,0 +1,112 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ColoreFilato extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228167115L; + + private long id_coloreFilato; + + private String descrizione; + + private long flgGreggio; + + private long id_fondo; + + private Fondo fondo; + + public ColoreFilato(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ColoreFilato() {} + + public void setId_coloreFilato(long newId_coloreFilato) { + this.id_coloreFilato = newId_coloreFilato; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setFlgGreggio(long newFlgGreggio) { + this.flgGreggio = newFlgGreggio; + } + + public void setId_fondo(long newId_fondo) { + this.id_fondo = newId_fondo; + setFondo(null); + } + + public long getId_coloreFilato() { + return this.id_coloreFilato; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getFlgGreggio() { + return this.flgGreggio; + } + + public long getId_fondo() { + return this.id_fondo; + } + + public void setFondo(Fondo newFondo) { + this.fondo = newFondo; + } + + public Fondo getFondo() { + this.fondo = (Fondo)getSecondaryObject(this.fondo, Fondo.class, getId_fondo()); + return this.fondo; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ColoreFilatoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from COLORE_FILATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) + wc.addWc("A.descrizione like '%" + CR.getSearchTxt().trim() + "%'"); + if (CR.getFlgGreggioS() == 0L) { + wc.addWc("(A.flgGreggio = 0 OR A.flgGreggio IS NULL)"); + } else if (CR.getFlgGreggioS() > 0L) { + wc.addWc("A.flgGreggio = " + CR.getFlgGreggioS()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByDescrizione(String l_descrizione) { + String s_Sql_Find = "select A.* from COLORE_FILATO AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.descrizione ='" + l_descrizione + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e, 2); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFilatoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFilatoCR.java new file mode 100644 index 00000000..86513a48 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFilatoCR.java @@ -0,0 +1,66 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ColoreFilatoCR extends CRAdapter { + private long id_coloreFilato; + + private String descrizioneS; + + private long flgGreggioS = -1L; + + private long id_fondo; + + private Fondo fondo; + + public ColoreFilatoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ColoreFilatoCR() {} + + public void setId_coloreFilato(long newId_coloreFilato) { + this.id_coloreFilato = newId_coloreFilato; + } + + public void setDescrizioneS(String newDescrizione) { + this.descrizioneS = newDescrizione; + } + + public void setFlgGreggioS(long newFlgGreggio) { + this.flgGreggioS = newFlgGreggio; + } + + public void setId_fondo(long newId_fondo) { + this.id_fondo = newId_fondo; + setFondo(null); + } + + public long getId_coloreFilato() { + return this.id_coloreFilato; + } + + public String getDescrizioneS() { + return (this.descrizioneS == null) ? "" : this.descrizioneS.trim(); + } + + public long getFlgGreggioS() { + return this.flgGreggioS; + } + + public long getId_fondo() { + return this.id_fondo; + } + + public void setFondo(Fondo newFondo) { + this.fondo = newFondo; + } + + public Fondo getFondo() { + this.fondo = (Fondo)getSecondaryObject(this.fondo, Fondo.class, + + getId_fondo()); + return this.fondo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFilatoFornitore.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFilatoFornitore.java new file mode 100644 index 00000000..e106bf68 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFilatoFornitore.java @@ -0,0 +1,121 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.StringTokenizer; + +public class ColoreFilatoFornitore extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228167138L; + + private long id_coloreFilatoFornitore; + + private long id_clifor; + + private long id_coloreFilato; + + private String descrizione; + + private it.acxent.anag.Clifor clifor; + + private ColoreFilato coloreFilato; + + public ColoreFilatoFornitore(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ColoreFilatoFornitore() {} + + public void setId_coloreFilatoFornitore(long newId_coloreFilatoFornitore) { + this.id_coloreFilatoFornitore = newId_coloreFilatoFornitore; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_coloreFilato(long newId_coloreFilato) { + this.id_coloreFilato = newId_coloreFilato; + setColoreFilato(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_coloreFilatoFornitore() { + return this.id_coloreFilatoFornitore; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_coloreFilato() { + return this.id_coloreFilato; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public void setClifor(it.acxent.anag.Clifor newClifor) { + this.clifor = newClifor; + } + + public it.acxent.anag.Clifor getClifor() { + this.clifor = (it.acxent.anag.Clifor)getSecondaryObject(this.clifor, it.acxent.anag.Clifor.class, + + getId_clifor()); + return this.clifor; + } + + public void setColoreFilato(ColoreFilato newColoreFilato) { + this.coloreFilato = newColoreFilato; + } + + public ColoreFilato getColoreFilato() { + this.coloreFilato = (ColoreFilato)getSecondaryObject(this.coloreFilato, ColoreFilato.class, + + getId_coloreFilato()); + return this.coloreFilato; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ColoreFilatoFornitoreCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from COLORE_FILATO_FORNITORE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFilatoFornitoreCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFilatoFornitoreCR.java new file mode 100644 index 00000000..c92bf01f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFilatoFornitoreCR.java @@ -0,0 +1,80 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ColoreFilatoFornitoreCR extends CRAdapter { + private long id_coloreFilatoFornitore; + + private long id_clifor; + + private long id_coloreFilato; + + private String descrizione; + + private it.acxent.anag.Clifor clifor; + + private ColoreFilato coloreFilato; + + public ColoreFilatoFornitoreCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ColoreFilatoFornitoreCR() {} + + public void setId_coloreFilatoFornitore(long newId_coloreFilatoFornitore) { + this.id_coloreFilatoFornitore = newId_coloreFilatoFornitore; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public void setId_coloreFilato(long newId_coloreFilato) { + this.id_coloreFilato = newId_coloreFilato; + setColoreFilato(null); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_coloreFilatoFornitore() { + return this.id_coloreFilatoFornitore; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public long getId_coloreFilato() { + return this.id_coloreFilato; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public void setClifor(it.acxent.anag.Clifor newClifor) { + this.clifor = newClifor; + } + + public it.acxent.anag.Clifor getClifor() { + this.clifor = (it.acxent.anag.Clifor)getSecondaryObject(this.clifor, it.acxent.anag.Clifor.class, + + getId_clifor()); + return this.clifor; + } + + public void setColoreFilato(ColoreFilato newColoreFilato) { + this.coloreFilato = newColoreFilato; + } + + public ColoreFilato getColoreFilato() { + this.coloreFilato = (ColoreFilato)getSecondaryObject(this.coloreFilato, ColoreFilato.class, + + getId_coloreFilato()); + return this.coloreFilato; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFondo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFondo.java new file mode 100644 index 00000000..281b8c90 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFondo.java @@ -0,0 +1,125 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ColoreFondo extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228167159L; + + private long id_coloreFondo; + + private long id_fondo; + + private String colore; + + private Fondo fondo; + + public ColoreFondo(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ColoreFondo() {} + + public void setId_coloreFondo(long newId_coloreFondo) { + this.id_coloreFondo = newId_coloreFondo; + } + + public void setId_fondo(long newId_fondo) { + this.id_fondo = newId_fondo; + setFondo(null); + } + + public void setColore(String newColore) { + this.colore = newColore; + } + + public long getId_coloreFondo() { + return this.id_coloreFondo; + } + + public long getId_fondo() { + return this.id_fondo; + } + + public String getColore() { + return (this.colore == null) ? "" : this.colore.trim(); + } + + public void setFondo(Fondo newFondo) { + this.fondo = newFondo; + } + + public Fondo getFondo() { + this.fondo = (Fondo)getSecondaryObject(this.fondo, Fondo.class, getId_fondo()); + return this.fondo; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ColoreFondoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from COLORE_FONDO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByFondo(long id_fondo) { + String s_Sql_Find = "select A.* from COLORE_FONDO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_fondo = " + id_fondo); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByColoreDatiTecnici(String colore, long id_datiTecniciTessuto) { + String s_Sql_Find = "select A.* from COLORE_FONDO AS A INNER JOIN FONDO AS B ON A.id_fondo = B.id_fondo "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.colore = '" + colore + "' "); + wc.addWc(" B.id_datiTecniciTessuto = " + id_datiTecniciTessuto); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFondoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFondoCR.java new file mode 100644 index 00000000..ff2ab5a2 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ColoreFondoCR.java @@ -0,0 +1,56 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ColoreFondoCR extends CRAdapter { + private long id_coloreFondo; + + private long id_fondo; + + private String colore; + + private Fondo fondo; + + public ColoreFondoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ColoreFondoCR() {} + + public void setId_coloreFondo(long newId_coloreFondo) { + this.id_coloreFondo = newId_coloreFondo; + } + + public void setId_fondo(long newId_fondo) { + this.id_fondo = newId_fondo; + setFondo(null); + } + + public void setColore(String newColore) { + this.colore = newColore; + } + + public long getId_coloreFondo() { + return this.id_coloreFondo; + } + + public long getId_fondo() { + return this.id_fondo; + } + + public String getColore() { + return (this.colore == null) ? "" : this.colore.trim(); + } + + public void setFondo(Fondo newFondo) { + this.fondo = newFondo; + } + + public Fondo getFondo() { + this.fondo = (Fondo)getSecondaryObject(this.fondo, Fondo.class, + + getId_fondo()); + return this.fondo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ComposizioneResult.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ComposizioneResult.java new file mode 100644 index 00000000..87f94fbe --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ComposizioneResult.java @@ -0,0 +1,39 @@ +package it.acxent.tex.anag; + +public class ComposizioneResult { + private double perc; + + private String composizione; + + private String descrizione; + + public ComposizioneResult(double perc, String composizione, String descrizione) { + this.perc = perc; + this.composizione = composizione; + this.descrizione = descrizione; + } + + public double getPerc() { + return this.perc; + } + + public void setPerc(double perc) { + this.perc = perc; + } + + public String getComposizione() { + return this.composizione; + } + + public void setComposizione(String composizione) { + this.composizione = composizione; + } + + public String getDescrizione() { + return this.descrizione; + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Confezione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Confezione.java new file mode 100644 index 00000000..63ad67dd --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Confezione.java @@ -0,0 +1,83 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Confezione extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228167203L; + + private long id_confezione; + + private String descrizione; + + private long flgTipo; + + public Confezione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Confezione() {} + + public void setId_confezione(long newId_confezione) { + this.id_confezione = newId_confezione; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setFlgTipo(long newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public long getId_confezione() { + return this.id_confezione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getFlgTipo() { + return this.flgTipo; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(ConfezioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from CONFEZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ConfezioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ConfezioneCR.java new file mode 100644 index 00000000..996218ec --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/ConfezioneCR.java @@ -0,0 +1,42 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ConfezioneCR extends CRAdapter { + private long id_confezione; + + private String descrizione; + + private long flgTipo; + + public ConfezioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ConfezioneCR() {} + + public void setId_confezione(long newId_confezione) { + this.id_confezione = newId_confezione; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setFlgTipo(long newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public long getId_confezione() { + return this.id_confezione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getFlgTipo() { + return this.flgTipo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/FaseLavorazione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/FaseLavorazione.java new file mode 100644 index 00000000..c5d3c87c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/FaseLavorazione.java @@ -0,0 +1,93 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class FaseLavorazione extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228167621L; + + private long id_faseLavorazione; + + private long codFase; + + private String descrizione; + + private String descrizioneBreve; + + public FaseLavorazione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public FaseLavorazione() {} + + public void setId_faseLavorazione(long newId_faseLavorazione) { + this.id_faseLavorazione = newId_faseLavorazione; + } + + public void setCodFase(long newCodFase) { + this.codFase = newCodFase; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setDescrizioneBreve(String newDescizioneBreve) { + this.descrizioneBreve = newDescizioneBreve; + } + + public long getId_faseLavorazione() { + return this.id_faseLavorazione; + } + + public long getCodFase() { + return this.codFase; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getDescrizioneBreve() { + return (this.descrizioneBreve == null) ? "" : this.descrizioneBreve.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(FaseLavorazioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from FASE_LAVORAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/FaseLavorazioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/FaseLavorazioneCR.java new file mode 100644 index 00000000..43d9263f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/FaseLavorazioneCR.java @@ -0,0 +1,52 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class FaseLavorazioneCR extends CRAdapter { + private long id_faseLavorazione; + + private long codFase; + + private String descrizione; + + private String descizioneBreve; + + public FaseLavorazioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public FaseLavorazioneCR() {} + + public void setId_faseLavorazione(long newId_faseLavorazione) { + this.id_faseLavorazione = newId_faseLavorazione; + } + + public void setCodFase(long newCodFase) { + this.codFase = newCodFase; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setDescizioneBreve(String newDescizioneBreve) { + this.descizioneBreve = newDescizioneBreve; + } + + public long getId_faseLavorazione() { + return this.id_faseLavorazione; + } + + public long getCodFase() { + return this.codFase; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getDescizioneBreve() { + return (this.descizioneBreve == null) ? "" : this.descizioneBreve.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Fondo.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Fondo.java new file mode 100644 index 00000000..0280e908 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Fondo.java @@ -0,0 +1,93 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +@Deprecated +public class Fondo extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228167664L; + + private long id_fondo; + + private String descrizione; + + public Fondo(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Fondo() {} + + public void setId_fondo(long newId_fondo) { + this.id_fondo = newId_fondo; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_fondo() { + return this.id_fondo; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(FondoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from FONDO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByDatiTecniciTessuto(long id_datiTecniciTessuto) { + String s_Sql_Find = "select A.* from FONDO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc(" A.id_datiTecniciTessuto = " + id_datiTecniciTessuto); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator getColori() { + return new ColoreFondo(getApFull()).findByFondo(getId_fondo()); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/FondoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/FondoCR.java new file mode 100644 index 00000000..aa4a4f03 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/FondoCR.java @@ -0,0 +1,67 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +@Deprecated +public class FondoCR extends CRAdapter { + private long id_fondo; + + private long id_articoloTessuto; + + private String serie; + + private String descrizione; + + private ArticoloTessuto articoloTessuto; + + public FondoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public FondoCR() {} + + public void setId_fondo(long newId_fondo) { + this.id_fondo = newId_fondo; + } + + public void setId_articoloTessuto(long newId_articoloTessuto) { + this.id_articoloTessuto = newId_articoloTessuto; + setArticoloTessuto(null); + } + + public void setSerie(String newSerie) { + this.serie = newSerie; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_fondo() { + return this.id_fondo; + } + + public long getId_articoloTessuto() { + return this.id_articoloTessuto; + } + + public String getSerie() { + return (this.serie == null) ? "" : this.serie.trim(); + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public void setArticoloTessuto(ArticoloTessuto newArticoloTessuto) { + this.articoloTessuto = newArticoloTessuto; + } + + public ArticoloTessuto getArticoloTessuto() { + this.articoloTessuto = (ArticoloTessuto)getSecondaryObject(this.articoloTessuto, ArticoloTessuto.class, + + getId_articoloTessuto()); + return this.articoloTessuto; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Lavorazione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Lavorazione.java new file mode 100644 index 00000000..b9e62c4f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Lavorazione.java @@ -0,0 +1,149 @@ +package it.acxent.tex.anag; + +import it.acxent.art.TipologiaArticolo; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Lavorazione extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1487851617570L; + + private long id_lavorazione; + + private String descrizione; + + private String abbreviazione; + + private long id_tipoLavorazione; + + private long flgUdm; + + private double costo; + + private TipoLavorazione tipoLavorazione; + + public Lavorazione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Lavorazione() {} + + public void setId_lavorazione(long newId_lavorazione) { + this.id_lavorazione = newId_lavorazione; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setId_tipoLavorazione(long newId_tipoLavorazione) { + this.id_tipoLavorazione = newId_tipoLavorazione; + setTipoLavorazione(null); + } + + public long getId_lavorazione() { + return this.id_lavorazione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getId_tipoLavorazione() { + return this.id_tipoLavorazione; + } + + public void setTipoLavorazione(TipoLavorazione newTipoLavorazione) { + this.tipoLavorazione = newTipoLavorazione; + } + + public TipoLavorazione getTipoLavorazione() { + this.tipoLavorazione = (TipoLavorazione)getSecondaryObject(this.tipoLavorazione, TipoLavorazione.class, getId_tipoLavorazione()); + return this.tipoLavorazione; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(LavorazioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from LAVORAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public double getCosto() { + return this.costo; + } + + public void setCosto(double costo) { + this.costo = costo; + } + + public long getFlgUdm() { + return this.flgUdm; + } + + public void setFlgUdm(long flgUdm) { + this.flgUdm = flgUdm; + } + + public static String getUdm(long l_flgUdm) { + return TipologiaArticolo.getUdm(l_flgUdm); + } + + public String getUdm() { + return TipologiaArticolo.getUdm(getFlgUdm()); + } + + public Vectumerator findByTipoDocumento(long l_id_tipoDocumento) { + String s_Sql_Find = "select A.* from LAVORAZIONE AS A inner join TIPO_DOCUMENTO_LAVORAZIONE AS B ON B.id_lavorazione=A.id_lavorazione"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("B.id_tipoDocumento=" + l_id_tipoDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getAbbreviazione() { + return (this.abbreviazione == null) ? "" : this.abbreviazione.trim(); + } + + public void setAbbreviazione(String abbreviazione) { + this.abbreviazione = abbreviazione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/LavorazioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/LavorazioneCR.java new file mode 100644 index 00000000..e01a912a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/LavorazioneCR.java @@ -0,0 +1,56 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class LavorazioneCR extends CRAdapter { + private long id_lavorazione; + + private String descrizione; + + private long id_tipoLavorazione; + + private TipoLavorazione tipoLavorazione; + + public LavorazioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public LavorazioneCR() {} + + public void setId_lavorazione(long newId_lavorazione) { + this.id_lavorazione = newId_lavorazione; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setId_tipoLavorazione(long newId_tipoLavorazione) { + this.id_tipoLavorazione = newId_tipoLavorazione; + setTipoLavorazione(null); + } + + public long getId_lavorazione() { + return this.id_lavorazione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getId_tipoLavorazione() { + return this.id_tipoLavorazione; + } + + public void setTipoLavorazione(TipoLavorazione newTipoLavorazione) { + this.tipoLavorazione = newTipoLavorazione; + } + + public TipoLavorazione getTipoLavorazione() { + this.tipoLavorazione = (TipoLavorazione)getSecondaryObject(this.tipoLavorazione, TipoLavorazione.class, + + getId_tipoLavorazione()); + return this.tipoLavorazione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Pezza.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Pezza.java new file mode 100644 index 00000000..643e7536 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Pezza.java @@ -0,0 +1,21 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.DBAdapterException; +import it.acxent.db.ResParm; +import java.sql.SQLException; + +public class Pezza extends DBAdapter { + public Pezza() {} + + public Pezza(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException { + return null; + } + + protected void deleteCascade() {} +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Rincorso.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Rincorso.java new file mode 100644 index 00000000..194777ca --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Rincorso.java @@ -0,0 +1,72 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Rincorso extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228167115L; + + private long id_rincorso; + + private String descrizioneRincorso; + + private String dettaglioRincorso; + + public Rincorso(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Rincorso() {} + + public long getId_rincorso() { + return this.id_rincorso; + } + + public void setId_rincorso(long id_rincorso) { + this.id_rincorso = id_rincorso; + } + + public void setDescrizioneRincorso(String descrizioneRincorso) { + this.descrizioneRincorso = descrizioneRincorso; + } + + public String getDescrizioneRincorso() { + return (this.descrizioneRincorso == null) ? "" : this.descrizioneRincorso.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(RincorsoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from RINCORSO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) + wc.addWc("A.descrizione like '%" + CR.getSearchTxt().trim() + "%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDettaglioRincorso() { + return (this.dettaglioRincorso == null) ? "" : this.dettaglioRincorso; + } + + public void setDettaglioRincorso(String dettaglioRincorso) { + this.dettaglioRincorso = dettaglioRincorso; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/RincorsoCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/RincorsoCR.java new file mode 100644 index 00000000..8bfa3b4e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/RincorsoCR.java @@ -0,0 +1,35 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.io.Serializable; + +public class RincorsoCR extends CRAdapter implements Serializable { + private static final long serialVersionUID = 1468228167115L; + + private long id_rincorso; + + private String descrizione; + + public RincorsoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public RincorsoCR() {} + + public long getId_rincorso() { + return this.id_rincorso; + } + + public void setId_rincorso(long id_rincorso) { + this.id_rincorso = id_rincorso; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Stagione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Stagione.java new file mode 100644 index 00000000..e5273e01 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Stagione.java @@ -0,0 +1,83 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Stagione extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1468228168655L; + + private long id_stagione; + + public Stagione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Stagione() {} + + public void setId_stagione(long newId_stagione) { + this.id_stagione = newId_stagione; + } + + public long getId_stagione() { + return this.id_stagione; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(StagioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from STAGIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizione() { + return getDescrizione(""); + } + + public String getDescrizione(String lang) { + if (lang.isEmpty()) + lang = "it"; + return getDescTxtLang("descrizione", lang); + } + + public String getDescrizione(String lang, int stringCaseType) { + String str = new String(); + str = convertStringCase(getDescrizione(lang), stringCaseType); + return str; + } + + public boolean useDescLangTables() { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/StagioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/StagioneCR.java new file mode 100644 index 00000000..c2612210 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/StagioneCR.java @@ -0,0 +1,22 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class StagioneCR extends CRAdapter { + private long id_stagione; + + public StagioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public StagioneCR() {} + + public void setId_stagione(long newId_stagione) { + this.id_stagione = newId_stagione; + } + + public long getId_stagione() { + return this.id_stagione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Telaio.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Telaio.java new file mode 100644 index 00000000..bac96b98 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/Telaio.java @@ -0,0 +1,147 @@ +package it.acxent.tex.anag; + +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Telaio extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1550483866536L; + + public static final long TIPO_TELAIO_STD = 0L; + + public static final long TIPO_TELAIO_JACQUARD = 1L; + + private long id_telaio; + + private String descrizione; + + private String codiceTelaio; + + private long flgTipoTelaio; + + private long colpiMinuto; + + private RigaDocumento rigaDocumento; + + public Telaio(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Telaio() {} + + public void setId_telaio(long newId_telaio) { + this.id_telaio = newId_telaio; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setCodiceTelaio(String newCodiceTelaio) { + this.codiceTelaio = newCodiceTelaio; + } + + public void setFlgTipoTelaio(long newFlgTipoTelaio) { + this.flgTipoTelaio = newFlgTipoTelaio; + } + + public void setColpiMinuto(long newColpiMinuto) { + this.colpiMinuto = newColpiMinuto; + } + + public long getId_telaio() { + return this.id_telaio; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getCodiceTelaio() { + return (this.codiceTelaio == null) ? "" : this.codiceTelaio.trim(); + } + + public String getTipoTelaio() { + return getTipoTelaio(getFlgTipoTelaio()); + } + + public long getColpiMinuto() { + return this.colpiMinuto; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TelaioCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TELAIO AS A"; + String s_Sql_Order = " order by descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgTipoTelaio() { + return this.flgTipoTelaio; + } + + public long findColpiIniziali() { + if (getId_telaio() <= 0L) + return 0L; + RigaDocumento doc = new RigaDocumento(getApFull()); + doc.findByTelaioUltimo(getId_telaio()); + if (doc.getId_rigaDocumento() == 0L) + return 0L; + return doc.getColpoFinaleRiga(); + } + + public String getDescrizioneCompleta() { + StringBuilder sb = new StringBuilder(getDescrizione()); + sb.append(" mt. lav. "); + sb.append(getNf().format(getRigaDocumento().getDatiTelaioInLavorazione(getId_telaio()))); + return sb.toString(); + } + + public static final String getTipoTelaio(long l_flgTipoTelaio) { + switch ((int)l_flgTipoTelaio) { + case 1: + return "Jacquard"; + case 0: + return "Standard"; + } + return ""; + } + + public RigaDocumento getRigaDocumento() { + if (this.rigaDocumento == null) + this.rigaDocumento = new RigaDocumento(getApFull()); + return this.rigaDocumento; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TelaioCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TelaioCR.java new file mode 100644 index 00000000..8ace1509 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TelaioCR.java @@ -0,0 +1,70 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TelaioCR extends CRAdapter { + private long id_telaio; + + private String descrizione; + + private String codiceTelaio; + + private long flgTipoTelaio; + + private long colpiMinuto; + + public TelaioCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TelaioCR() {} + + public void setId_telaio(long newId_telaio) { + this.id_telaio = newId_telaio; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setCodiceTelaio(String newCodiceTelaio) { + this.codiceTelaio = newCodiceTelaio; + } + + public void setFlgTipoTelaio(long newFlgTipoTelaio) { + this.flgTipoTelaio = newFlgTipoTelaio; + } + + public void setColpiMinuto(long newColpiMinuto) { + this.colpiMinuto = newColpiMinuto; + } + + public long getId_telaio() { + return this.id_telaio; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getCodiceTelaio() { + return (this.codiceTelaio == null) ? "" : this.codiceTelaio.trim(); + } + + public long getFlgTipoTelaio() { + return this.flgTipoTelaio; + } + + public long getColpiMinuto() { + return this.colpiMinuto; + } + + public String getTipoTelaio() { + return Telaio.getTipoTelaio(getFlgTipoTelaio()); + } + + public static final String getTipoTelaio(long l_flgTipoTelaio) { + return Telaio.getTipoTelaio(l_flgTipoTelaio); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TipoDocumentoLavorazione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TipoDocumentoLavorazione.java new file mode 100644 index 00000000..a3b7122c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TipoDocumentoLavorazione.java @@ -0,0 +1,138 @@ +package it.acxent.tex.anag; + +import it.acxent.contab.TipoDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoDocumentoLavorazione extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1677754312426L; + + private long id_tipoDocumentoLavorazione; + + private long id_tipoDocumento; + + private long id_lavorazione; + + private TipoDocumento tipoDocumento; + + private Lavorazione lavorazione; + + public TipoDocumentoLavorazione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoDocumentoLavorazione() {} + + public void setId_tipoDocumentoLavorazione(long newId_tipoDocumentoLavorazione) { + this.id_tipoDocumentoLavorazione = newId_tipoDocumentoLavorazione; + } + + public void setId_tipoDocumento(long newId_tipoDocumento) { + this.id_tipoDocumento = newId_tipoDocumento; + setTipoDocumento(null); + } + + public void setId_lavorazione(long newId_lavorazione) { + this.id_lavorazione = newId_lavorazione; + setLavorazione(null); + } + + public long getId_tipoDocumentoLavorazione() { + return this.id_tipoDocumentoLavorazione; + } + + public long getId_tipoDocumento() { + return this.id_tipoDocumento; + } + + public long getId_lavorazione() { + return this.id_lavorazione; + } + + public void setTipoDocumento(TipoDocumento newTipoDocumento) { + this.tipoDocumento = newTipoDocumento; + } + + public TipoDocumento getTipoDocumento() { + this.tipoDocumento = (TipoDocumento)getSecondaryObject(this.tipoDocumento, TipoDocumento.class, getId_tipoDocumento()); + return this.tipoDocumento; + } + + public void setLavorazione(Lavorazione newLavorazione) { + this.lavorazione = newLavorazione; + } + + public Lavorazione getLavorazione() { + this.lavorazione = (Lavorazione)getSecondaryObject(this.lavorazione, Lavorazione.class, getId_lavorazione()); + return this.lavorazione; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoDocumentoLavorazioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_DOCUMENTO_LAVORAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByLavorazione(long l_id_lavorazione) { + String s_Sql_Find = "select A.* from TIPO_DOCUMENTO_LAVORAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_lavorazione=" + l_id_lavorazione); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByTipoDocumento(long l_id_tipoDocumento) { + String s_Sql_Find = "select A.* from TIPO_DOCUMENTO_LAVORAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_tipoDocumento=" + l_id_tipoDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TipoDocumentoLavorazioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TipoDocumentoLavorazioneCR.java new file mode 100644 index 00000000..6be5e4e3 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TipoDocumentoLavorazioneCR.java @@ -0,0 +1,73 @@ +package it.acxent.tex.anag; + +import it.acxent.contab.TipoDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoDocumentoLavorazioneCR extends CRAdapter { + private static final long serialVersionUID = -6752866295536270754L; + + private long id_documentoLavorazione; + + private long id_documento; + + private long id_lavorazione; + + private TipoDocumento tipoDocumento; + + private Lavorazione lavorazione; + + public TipoDocumentoLavorazioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoDocumentoLavorazioneCR() {} + + public void setId_documentoLavorazione(long newId_documentoLavorazione) { + this.id_documentoLavorazione = newId_documentoLavorazione; + } + + public void setId_documento(long newId_documento) { + this.id_documento = newId_documento; + setDocumento(null); + } + + public void setId_lavorazione(long newId_lavorazione) { + this.id_lavorazione = newId_lavorazione; + setLavorazione(null); + } + + public long getId_documentoLavorazione() { + return this.id_documentoLavorazione; + } + + public long getId_documento() { + return this.id_documento; + } + + public long getId_lavorazione() { + return this.id_lavorazione; + } + + public void setDocumento(TipoDocumento newDocumento) { + this.tipoDocumento = newDocumento; + } + + public TipoDocumento getDocumento() { + this.tipoDocumento = (TipoDocumento)getSecondaryObject(this.tipoDocumento, TipoDocumento.class, + + getId_documento()); + return this.tipoDocumento; + } + + public void setLavorazione(Lavorazione newLavorazione) { + this.lavorazione = newLavorazione; + } + + public Lavorazione getLavorazione() { + this.lavorazione = (Lavorazione)getSecondaryObject(this.lavorazione, Lavorazione.class, + + getId_lavorazione()); + return this.lavorazione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TipoLavorazione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TipoLavorazione.java new file mode 100644 index 00000000..a28ca5d9 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TipoLavorazione.java @@ -0,0 +1,73 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoLavorazione extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1487851619334L; + + private long id_tipoLavorazione; + + private String descrizione; + + public TipoLavorazione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoLavorazione() {} + + public void setId_tipoLavorazione(long newId_tipoLavorazione) { + this.id_tipoLavorazione = newId_tipoLavorazione; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoLavorazione() { + return this.id_tipoLavorazione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoLavorazioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_LAVORAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TipoLavorazioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TipoLavorazioneCR.java new file mode 100644 index 00000000..141b510c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/TipoLavorazioneCR.java @@ -0,0 +1,32 @@ +package it.acxent.tex.anag; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoLavorazioneCR extends CRAdapter { + private long id_tipoLavorazione; + + private String descrizione; + + public TipoLavorazioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoLavorazioneCR() {} + + public void setId_tipoLavorazione(long newId_tipoLavorazione) { + this.id_tipoLavorazione = newId_tipoLavorazione; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoLavorazione() { + return this.id_tipoLavorazione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArmaturaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArmaturaSvlt.java new file mode 100644 index 00000000..b7fed997 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArmaturaSvlt.java @@ -0,0 +1,49 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.tex.anag.Armatura; +import it.acxent.tex.anag.ArmaturaCR; +import it.acxent.tex.anag.ArmaturaDettaglio; +import it.acxent.util.Vectumerator; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/tessutoConfig/Armatura.abl"}) +public class ArmaturaSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = -4764615882757681658L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Armatura bean = (Armatura)beanA; + req.setAttribute("list", new ArmaturaDettaglio(getApFull(req)).findByArmatura(bean.getId_armatura())); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Armatura(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ArmaturaCR(getApFull(req)); + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Vectumerator vec = new Vectumerator(); + Armatura bean = (Armatura)beanA; + for (int i = 1; (long)i <= bean.getNumColpi(); i++) { + ArmaturaDettaglio row = new ArmaturaDettaglio(apFull); + row.findByArmaturaRiga(bean.getId_armatura(), (long)i); + row.setId_armatura(bean.getId_armatura()); + row.setNRiga((long)i); + row.setArmaturaRiga(getRequestParameter(req, "riga_" + i)); + vec.add(row); + } + bean.salvaDettaglio(vec); + return super.afterSave(beanA, req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArticoloFilatoColoreSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArticoloFilatoColoreSvlt.java new file mode 100644 index 00000000..0ae2936d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArticoloFilatoColoreSvlt.java @@ -0,0 +1,100 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.art.Componente; +import it.acxent.art.ComponenteCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.tex.anag.ArticoloFilato; +import it.acxent.tex.anag.ArticoloFilatoColore; +import it.acxent.tex.anag.ArticoloFilatoColoreCR; +import it.acxent.tex.anag.ArticoloFilatoComponente; +import it.acxent.util.Vectumerator; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/filato/ArticoloFilatoColore.abl"}) +public class ArticoloFilatoColoreSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = -759824067431772574L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloFilato bean = (ArticoloFilato)beanA; + req.setAttribute("listaComponenti", new Componente(apFull).findByCR(new ComponenteCR(), 0, 0)); + req.setAttribute("listaFilatoComponenti", new ArticoloFilatoComponente(apFull).findByArticoloFilato(bean.getId_articoloFilato())); + req.setAttribute("listaFilatiColori", new ArticoloFilatoColore(getApFull()).findByArticoloFilato(bean.getId_articoloFilato())); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new ArticoloFilatoColore(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ArticoloFilatoColoreCR(getApFull(req)); + } + + public void _xaddComponente(HttpServletRequest req, HttpServletResponse res) { + long id_articoloFilatoComponente = getRequestLongParameter(req, "id_articoloFilatoComponente"); + ArticoloFilatoComponente bean2 = new ArticoloFilatoComponente(getApFull()); + bean2.findByPrimaryKey(id_articoloFilatoComponente); + fillObject(req, bean2); + ResParm rp = bean2.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _xdelComponente(HttpServletRequest req, HttpServletResponse res) { + long id_articoloFilatoComponente = getRequestLongParameter(req, "id_articoloFilatoComponente"); + ArticoloFilatoComponente bean2 = new ArticoloFilatoComponente(getApFull()); + bean2.findByPrimaryKey(id_articoloFilatoComponente); + ResParm rp = bean2.delete(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _dettaglioDisponibilita(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloFilatoColoreCR CR = new ArticoloFilatoColoreCR(apFull); + fillObject(req, CR); + ArticoloFilatoColore bean = new ArticoloFilatoColore(apFull); + Vectumerator vec = bean.findByCRDispoMagazzino(CR, 0, 0); + req.setAttribute("list", vec); + req.setAttribute("nf", getNf()); + setJspPageRelative("articoloFilatoColoreDispo.jsp", req); + callJsp(req, res); + } + + public void _xdelColore(HttpServletRequest req, HttpServletResponse res) { + long id_articoloFilatoColore = getRequestLongParameter(req, "id_articoloFilatoColore"); + ArticoloFilatoColore bean2 = new ArticoloFilatoColore(getApFull()); + bean2.findByPrimaryKey(id_articoloFilatoColore); + ResParm rp = bean2.delete(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaComponenti", new Componente(getApFull()).findByCR(new ComponenteCR(), 0, 0)); + } + + protected String getBeanPageName(HttpServletRequest req) { + long flgTipoRicerca = getRequestLongParameter(req, "flgTipoRicerca"); + if (flgTipoRicerca == 1L) + return super.getBeanPageName(req) + "Ser"; + return super.getBeanPageName(req); + } + + public void _xaddColore(HttpServletRequest req, HttpServletResponse res) { + long id_articoloFilatoColore = getRequestLongParameter(req, "id_articoloFilatoColore"); + ArticoloFilatoColore bean2 = new ArticoloFilatoColore(getApFull()); + bean2.findByPrimaryKey(id_articoloFilatoColore); + fillObject(req, bean2); + ResParm rp = bean2.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArticoloFilatoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArticoloFilatoSvlt.java new file mode 100644 index 00000000..7193f0a1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArticoloFilatoSvlt.java @@ -0,0 +1,102 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.anag.Iva; +import it.acxent.art.Componente; +import it.acxent.art.ComponenteCR; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.RigaDocumentoCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.tex.anag.ArticoloFilato; +import it.acxent.tex.anag.ArticoloFilatoCR; +import it.acxent.tex.anag.ArticoloFilatoColore; +import it.acxent.tex.anag.ArticoloFilatoComponente; +import it.acxent.util.Vectumerator; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/filato/ArticoloFilato.abl"}) +public class ArticoloFilatoSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = -759824067431772574L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloFilato bean = (ArticoloFilato)beanA; + req.setAttribute("listaComponenti", new Componente(apFull).findByCR(new ComponenteCR(), 0, 0)); + req.setAttribute("listaFilatoComponenti", new ArticoloFilatoComponente(apFull).findByArticoloFilato(bean.getId_articoloFilato())); + req.setAttribute("listaFilatiColori", new ArticoloFilatoColore(getApFull()).findByArticoloFilato(bean.getId_articoloFilato())); + req.setAttribute("listaIva", new Iva(apFull).findAll()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new ArticoloFilato(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ArticoloFilatoCR(getApFull(req)); + } + + public void _addComponente(HttpServletRequest req, HttpServletResponse res) { + long id_articoloFilatoComponente = getRequestLongParameter(req, "id_articoloFilatoComponente"); + ArticoloFilatoComponente bean2 = new ArticoloFilatoComponente(getApFull()); + bean2.findByPrimaryKey(id_articoloFilatoComponente); + fillObject(req, bean2); + ResParm rp = bean2.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _delComponente(HttpServletRequest req, HttpServletResponse res) { + long id_articoloFilatoComponente = getRequestLongParameter(req, "id_articoloFilatoComponente"); + ArticoloFilatoComponente bean2 = new ArticoloFilatoComponente(getApFull()); + bean2.findByPrimaryKey(id_articoloFilatoComponente); + ResParm rp = bean2.delete(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _addColore(HttpServletRequest req, HttpServletResponse res) { + long id_articoloFilatoColore = getRequestLongParameter(req, "id_articoloFilatoColore"); + ArticoloFilatoColore bean2 = new ArticoloFilatoColore(getApFull()); + bean2.findByPrimaryKey(id_articoloFilatoColore); + fillObject(req, bean2); + ResParm rp = bean2.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _delColore(HttpServletRequest req, HttpServletResponse res) { + long id_articoloFilatoColore = getRequestLongParameter(req, "id_articoloFilatoColore"); + ArticoloFilatoColore bean2 = new ArticoloFilatoColore(getApFull()); + bean2.findByPrimaryKey(id_articoloFilatoColore); + ResParm rp = bean2.delete(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaComponenti", new Componente(apFull).findByCR(new ComponenteCR(), 0, 0)); + req.setAttribute("listaIva", new Iva(apFull).findAll()); + } + + public void _viewMRD(HttpServletRequest req, HttpServletResponse res) { + ArticoloFilato bean = new ArticoloFilato(getApFull(req)); + long l_id_articoloFilato = getRequestLongParameter(req, "id_articoloFilato"); + bean.findByPrimaryKey(l_id_articoloFilato); + setJspPageRelative("articoloFilatoViewMovimentoRD.jsp", req); + RigaDocumentoCR CR = new RigaDocumentoCR(); + CR.setId_articoloFilato(l_id_articoloFilato); + CR.setFlgTipoMagazzino(1L); + RigaDocumento mov = new RigaDocumento(getApFull(req)); + Vectumerator vec = mov.findMagFilatoSaldiArticoloFilatoByCR(CR, 0, 0); + req.setAttribute("listaArticoliVarianteMovimentoRD", vec); + req.setAttribute("bean", bean); + callJsp(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArticoloTessutoColoreSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArticoloTessutoColoreSvlt.java new file mode 100644 index 00000000..99d20f04 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArticoloTessutoColoreSvlt.java @@ -0,0 +1,62 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.art.Componente; +import it.acxent.art.ComponenteCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.tex.anag.ArticoloFilato; +import it.acxent.tex.anag.ArticoloFilatoColore; +import it.acxent.tex.anag.ArticoloFilatoComponente; +import it.acxent.tex.anag.ArticoloTessutoColore; +import it.acxent.tex.anag.ArticoloTessutoColoreCR; +import it.acxent.util.Vectumerator; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/tessuto/ArticoloTessutoColore.abl"}) +public class ArticoloTessutoColoreSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = -759826667431772574L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloFilato bean = (ArticoloFilato)beanA; + req.setAttribute("listaComponenti", new Componente(apFull).findByCR(new ComponenteCR(), 0, 0)); + req.setAttribute("listaFilatoComponenti", new ArticoloFilatoComponente(apFull).findByArticoloFilato(bean.getId_articoloFilato())); + req.setAttribute("listaFilatiColori", new ArticoloFilatoColore(getApFull()).findByArticoloFilato(bean.getId_articoloFilato())); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new ArticoloTessutoColore(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ArticoloTessutoColoreCR(getApFull(req)); + } + + public void _dettaglioDisponibilita(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloTessutoColoreCR CR = new ArticoloTessutoColoreCR(apFull); + fillObject(req, CR); + ArticoloTessutoColore bean = new ArticoloTessutoColore(apFull); + Vectumerator vec = bean.findByCRDispoMagazzino(CR, 0, 0); + req.setAttribute("list", vec); + req.setAttribute("nf", getNf()); + setJspPageRelative("articoloTessutoColoreDispo.jsp", req); + callJsp(req, res); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("listaComponenti", new Componente(getApFull()).findByCR(new ComponenteCR(), 0, 0)); + } + + protected String getBeanPageName(HttpServletRequest req) { + long flgTipoRicerca = getRequestLongParameter(req, "flgTipoRicerca"); + if (flgTipoRicerca == 1L) + return super.getBeanPageName(req) + "Ser"; + return super.getBeanPageName(req); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArticoloTessutoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArticoloTessutoSvlt.java new file mode 100644 index 00000000..0077f500 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ArticoloTessutoSvlt.java @@ -0,0 +1,344 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.anag.Fornitore; +import it.acxent.anag.Iva; +import it.acxent.anag.MagFisico; +import it.acxent.art.ArticoloFornitore; +import it.acxent.art.Colore; +import it.acxent.art.ColoreCR; +import it.acxent.art.Componente; +import it.acxent.art.ComponenteCR; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.RigaDocumentoCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.tex.anag.ArticoloFilatoColore; +import it.acxent.tex.anag.ArticoloTessuto; +import it.acxent.tex.anag.ArticoloTessutoAccoppiato; +import it.acxent.tex.anag.ArticoloTessutoCR; +import it.acxent.tex.anag.ArticoloTessutoColore; +import it.acxent.tex.anag.ArticoloTessutoComponente; +import it.acxent.tex.anag.ArticoloTessutoFilato; +import it.acxent.tex.anag.Stagione; +import it.acxent.util.AbMessages; +import it.acxent.util.Vectumerator; +import javax.servlet.RequestDispatcher; +import javax.servlet.ServletRequest; +import javax.servlet.ServletResponse; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/tessuto/ArticoloTessuto.abl"}) +public class ArticoloTessutoSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = -759824067431772574L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloTessuto bean = (ArticoloTessuto)beanA; + req.setAttribute("listaArticoloTessutoFilato", bean.findArticoliTessutoFilati(0, 0)); + req.setAttribute("listaComponenti", new Componente(apFull).findByCR(new ComponenteCR(), 0, 0)); + req.setAttribute("listaTessutoComponenti", new ArticoloTessutoComponente(apFull) + .findByArticoloTessuto(bean.getId_articoloTessuto())); + req.setAttribute("listaColori", new Colore(apFull).findByCR(new ColoreCR(), 0, 0)); + req.setAttribute("listaTessutoColori", new ArticoloTessutoColore(apFull).findByArticoloTessuto(bean.getId_articoloTessuto())); + req.setAttribute("listaStagioni", new Stagione(apFull).findAll()); + req.setAttribute("listaIva", new Iva(apFull).findAll()); + if (bean.getFlgTipoTessutoM() == 2L) + req.setAttribute("listaArticoloTessutoAccoppiato", bean.findArticoliTessutoAccoppiati()); + if (bean.getTipo().getFlgFornitori() == 1L) { + req.setAttribute("listaFornitori", new Fornitore(apFull).findAll()); + req.setAttribute("listaArticoloFornitori", bean.getFornitori()); + } + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new ArticoloTessuto(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ArticoloTessutoCR(getApFull(req)); + } + + public void _caricaColoreFilato(HttpServletRequest req, HttpServletResponse res) { + long id_articoloFilato = getRequestLongParameter(req, "id_articoloFilato"); + ArticoloFilatoColore afc = new ArticoloFilatoColore(getApFull(req)); + Vectumerator vecAfc = afc.findByArticoloFilato(id_articoloFilato); + req.setAttribute("listaColori", vecAfc); + try { + RequestDispatcher rd = getServletContext().getRequestDispatcher("/admin/tessutoConfig/_fetchComboFilatoColore.jsp"); + rd.forward((ServletRequest)req, (ServletResponse)res); + } catch (Exception e) { + handleDebug(e, 2); + } + } + + public void _delFilatoM(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + ArticoloTessutoFilato bean2 = new ArticoloTessutoFilato(getApFull(req)); + fillObject(req, bean2); + if (bean2.getId_articoloTessutoFilato() > 0L) { + bean2.findByPrimaryKey(bean2.getId_articoloTessutoFilato()); + rp = bean2.delete(); + } else { + rp = new ResParm(false, "Errore! Impossibile cancelalre filato"); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _modFilatoM(HttpServletRequest req, HttpServletResponse res) { + long id_articoloTessutoFilato = getRequestLongParameter(req, "id_articoloTessutoFilato"); + ArticoloTessutoFilato bean2 = new ArticoloTessutoFilato(getApFull()); + bean2.findByPrimaryKey(id_articoloTessutoFilato); + req.setAttribute("bean2", bean2); + ArticoloFilatoColore afc = new ArticoloFilatoColore(getApFull(req)); + Vectumerator vecAfc = afc.findByArticoloFilato(bean2.getArticoloFilatoColore().getId_articoloFilato()); + req.setAttribute("listaColori", vecAfc); + sendMessage(req, "Modifica Filato Colore"); + showBean(req, res); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("bean", getBean(req)); + req.setAttribute("listaComponenti", new Componente(apFull).findByCR(new ComponenteCR(), 0, 0)); + req.setAttribute("listaStagioni", new Stagione(apFull).findAll()); + req.setAttribute("listaIva", new Iva(apFull).findAll()); + } + + protected void showBean(HttpServletRequest req, HttpServletResponse res) { + super.showBean(req, res); + } + + public void _addFilatoM(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + ArticoloTessutoFilato bean2 = new ArticoloTessutoFilato(apFull); + fillObject(req, bean2); + if (bean2.getId_articoloTessutoFilato() > 0L) { + bean2.findByPrimaryKey(bean2.getId_articoloTessutoFilato()); + fillObject(req, bean2); + } + long id_articoloFilatoColore = getRequestLongParameter(req, "id_articoloFilatoColore"); + if (id_articoloFilatoColore == 0L) { + rp = new ResParm(false, "Errore! filato o colore non impostato correttamente"); + } else { + ArticoloFilatoColore afc = new ArticoloFilatoColore(apFull); + afc.findByPrimaryKey(id_articoloFilatoColore); + if (afc.getId_articoloFilatoColore() == 0L) { + rp = new ResParm(false, "Errore! Colore filato non trovato"); + } else { + bean2.setId_articoloFilatoColore(afc.getId_articoloFilatoColore()); + rp = bean2.save(); + } + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _addTessutAccoppiato(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + ArticoloTessutoAccoppiato bean2 = new ArticoloTessutoAccoppiato(apFull); + fillObject(req, bean2); + if (bean2.getId_articoloTessutoAccoppiato() > 0L) + bean2.findByPrimaryKey(bean2.getId_articoloTessutoAccoppiato()); + if (bean2.getId_articoloTessuto() > 0L && bean2.getId_articoloTessutoComponente() > 0L) { + rp = bean2.save(); + } else { + rp = new ResParm(false, "Errore! Tessuto accoppiato non selezionato correttamente"); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _delTessutAccoppiato(HttpServletRequest req, HttpServletResponse res) { + ResParm rp; + ApplParmFull apFull = getApFull(req); + ArticoloTessutoAccoppiato bean2 = new ArticoloTessutoAccoppiato(apFull); + fillObject(req, bean2); + if (bean2.getId_articoloTessutoAccoppiato() > 0L) { + bean2.findByPrimaryKey(bean2.getId_articoloTessutoAccoppiato()); + rp = bean2.delete(); + } else { + rp = new ResParm(false, "Errore! Impossibile cancelalre filato"); + } + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _viewMRD(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloTessuto bean = new ArticoloTessuto(apFull); + long l_id_articoloTessuto = getRequestLongParameter(req, "id_articoloTessuto"); + bean.findByPrimaryKey(l_id_articoloTessuto); + setJspPageRelative("articoloTessutoViewMovimentoRD.jsp", req); + RigaDocumentoCR CR = new RigaDocumentoCR(); + CR.setId_articolo(l_id_articoloTessuto); + CR.setFlgTipoMagazzino(1L); + RigaDocumento mov = new RigaDocumento(apFull); + Vectumerator vec = mov.findMagTessutoSaldiArticoloTessutoByCR(CR, 0, 0); + req.setAttribute("listaArticoliTessutoVarianteMovimentoRD", vec); + req.setAttribute("bean", bean); + req.setAttribute("mag_fisico", new MagFisico(apFull)); + callJsp(req, res); + } + + public void _addComponente(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_articoloTessuto = getRequestLongParameter(req, "id_articoloTessuto"); + ArticoloTessuto bean = new ArticoloTessuto(apFull); + bean.findByPrimaryKey(l_id_articoloTessuto); + if (bean.getId_articoloTessuto() > 0L) { + fillObject(req, bean); + ResParm rp = bean.save(); + if (rp.getStatus()) { + long id_articolotessutoComponente = getRequestLongParameter(req, "id_articoloTessutoComponente"); + ArticoloTessutoComponente bean2 = new ArticoloTessutoComponente(apFull); + bean2.findByPrimaryKey(id_articolotessutoComponente); + fillObject(req, bean2); + rp = bean2.save(); + req.setAttribute("currentFocus", "id_componente"); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, "ERRORE! " + rp.getMsg()); + } + } else { + sendMessage(req, "ERRORE! Tesuto non trovato!"); + } + showBean(req, res); + } + + public void _delComponente(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_articoloTessuto = getRequestLongParameter(req, "id_articoloTessuto"); + ArticoloTessuto bean = new ArticoloTessuto(apFull); + bean.findByPrimaryKey(l_id_articoloTessuto); + if (bean.getId_articoloTessuto() > 0L) { + fillObject(req, bean); + ResParm rp = bean.save(); + if (rp.getStatus()) { + long id_articolotessutoComponente = getRequestLongParameter(req, "id_articoloTessutoComponente"); + ArticoloTessutoComponente bean2 = new ArticoloTessutoComponente(getApFull()); + bean2.findByPrimaryKey(id_articolotessutoComponente); + rp = bean2.delete(); + req.setAttribute("currentFocus", "id_componente"); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, "ERRORE! " + rp.getMsg()); + } + } else { + sendMessage(req, "ERRORE! Tesuto non trovato!"); + } + showBean(req, res); + } + + public void _addFornitore(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloTessuto bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_articoloTessuto"); + bean = new ArticoloTessuto(apFull); + try { + bean.findByPrimaryKey(l_id); + ArticoloFornitore ca = new ArticoloFornitore(apFull); + if (!getRequestParameter(req, "id_clifor").equals("")) { + fillObject(req, ca); + rp = bean.addFornitore(ca); + if (rp.getStatus()) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, rp.getMsg()); + } + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + } catch (Exception e) { + e.printStackTrace(); + } + showBean(req, res); + } + + public void _delColore(HttpServletRequest req, HttpServletResponse res) { + long id_articoloTessutoColore = getRequestLongParameter(req, "id_articoloTessutoColore"); + ArticoloTessutoColore bean2 = new ArticoloTessutoColore(getApFull()); + bean2.findByPrimaryKey(id_articoloTessutoColore); + ResParm rp = bean2.delete(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _addColore(HttpServletRequest req, HttpServletResponse res) { + long id_articoloTessutoColore = getRequestLongParameter(req, "id_articoloTessutoColore"); + ArticoloTessutoColore bean2 = new ArticoloTessutoColore(getApFull()); + bean2.findByPrimaryKey(id_articoloTessutoColore); + fillObject(req, bean2); + ResParm rp = bean2.save(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } + + public void _modFornitore(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloTessuto bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_articoloTessuto"); + bean = new ArticoloTessuto(apFull); + try { + bean.findByPrimaryKey(l_id); + ArticoloFornitore ca = new ArticoloFornitore(apFull); + if (bean.getId_articoloTessuto() > 0L && getRequestLongParameter(req, "id_articoloFornitore") != 0L) { + fillObject(req, ca); + ca.findByPrimaryKey(ca.getId_articoloFornitore()); + req.setAttribute("beanAF", ca); + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } catch (Exception e) { + e.printStackTrace(); + } + showBean(req, res); + } + + public void _delFornitore(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ArticoloTessuto bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_articoloTessuto"); + bean = new ArticoloTessuto(apFull); + try { + bean.findByPrimaryKey(l_id); + ArticoloFornitore ca = new ArticoloFornitore(apFull); + if (bean.getId_articoloTessuto() > 0L && getRequestLongParameter(req, "id_articoloFornitore") != 0L) { + fillObject(req, ca); + rp = bean.delFornitore(ca); + if (rp.getStatus()) { + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_FAIL")); + } + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } catch (Exception e) { + e.printStackTrace(); + } + showBean(req, res); + } + + protected String getBeanPageName(HttpServletRequest req) { + long flgTipoRicerca = getRequestLongParameter(req, "flgTipoRicerca"); + if (flgTipoRicerca == 1L) + return super.getBeanPageName(req) + "Ser"; + return super.getBeanPageName(req); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ColoreFilatoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ColoreFilatoSvlt.java new file mode 100644 index 00000000..2ea9293f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ColoreFilatoSvlt.java @@ -0,0 +1,34 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.tex.anag.ColoreFilato; +import it.acxent.tex.anag.ColoreFilatoCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/filatoConfig/ColoreFilato.abl"}) +public class ColoreFilatoSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = 2381754886730461451L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaColori", new ColoreFilato(apFull).findByCR(new ColoreFilatoCR(apFull), 0, 0)); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new ColoreFilato(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ColoreFilatoCR(getApFull(req)); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ConfezioneSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ConfezioneSvlt.java new file mode 100644 index 00000000..e5d1ee99 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/ConfezioneSvlt.java @@ -0,0 +1,30 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.tex.anag.Confezione; +import it.acxent.tex.anag.ConfezioneCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/filatoConfig/Confezione.abl"}) +public class ConfezioneSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = 6770137718896083667L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Confezione(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ConfezioneCR(getApFull(req)); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/FaseLavorazioneSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/FaseLavorazioneSvlt.java new file mode 100644 index 00000000..14742a17 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/FaseLavorazioneSvlt.java @@ -0,0 +1,30 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.tex.anag.FaseLavorazione; +import it.acxent.tex.anag.FaseLavorazioneCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/tessConfig/FaseLavorazione.abl"}) +public class FaseLavorazioneSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = -6052440168181209388L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new FaseLavorazione(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new FaseLavorazioneCR(getApFull(req)); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/FondoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/FondoSvlt.java new file mode 100644 index 00000000..12d12387 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/FondoSvlt.java @@ -0,0 +1,26 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.tex.anag.Fondo; +import it.acxent.tex.anag.FondoCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/tessutoConfig/Fondi.abl"}) +public class FondoSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = 2381754886730461451L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Fondo(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new FondoCR(getApFull(req)); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/LavorazioneSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/LavorazioneSvlt.java new file mode 100644 index 00000000..018faf24 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/LavorazioneSvlt.java @@ -0,0 +1,38 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.tex.anag.Lavorazione; +import it.acxent.tex.anag.LavorazioneCR; +import it.acxent.tex.anag.TipoLavorazione; +import it.acxent.tex.anag.TipoLavorazioneCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/lavConfig/Lavorazione.abl"}) +public class LavorazioneSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = 2381754886730461451L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipoLavorazioni", new TipoLavorazione(apFull).findByCR(new TipoLavorazioneCR(apFull), 0, 0)); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Lavorazione(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new LavorazioneCR(getApFull(req)); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/RincorsoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/RincorsoSvlt.java new file mode 100644 index 00000000..d346f4f4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/RincorsoSvlt.java @@ -0,0 +1,30 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.tex.anag.Rincorso; +import it.acxent.tex.anag.RincorsoCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/tessutoConfig/Rincorso.abl"}) +public class RincorsoSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = -4764615882757681658L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Rincorso(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new RincorsoCR(getApFull(req)); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/StagioneSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/StagioneSvlt.java new file mode 100644 index 00000000..bffcaa44 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/StagioneSvlt.java @@ -0,0 +1,30 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.tex.anag.Stagione; +import it.acxent.tex.anag.StagioneCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/tessutoConfig/Stagione.abl"}) +public class StagioneSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = 2381754886730461451L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Stagione(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new StagioneCR(getApFull(req)); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/TelaioSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/TelaioSvlt.java new file mode 100644 index 00000000..9a9d78b4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/TelaioSvlt.java @@ -0,0 +1,30 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.tex.anag.Telaio; +import it.acxent.tex.anag.TelaioCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/tessConfig/Telaio.abl"}) +public class TelaioSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = 6770137718896083667L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Telaio(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TelaioCR(getApFull(req)); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/TipoLavorazioneSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/TipoLavorazioneSvlt.java new file mode 100644 index 00000000..7826ee83 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/TipoLavorazioneSvlt.java @@ -0,0 +1,33 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.tex.anag.TipoLavorazione; +import it.acxent.tex.anag.TipoLavorazioneCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/lavConfig/TipoLavorazione.abl"}) +public class TipoLavorazioneSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = 2381754886730461451L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new TipoLavorazione(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new TipoLavorazioneCR(getApFull(req)); + } + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/_AnagTexAdapterSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/_AnagTexAdapterSvlt.java new file mode 100644 index 00000000..0ae55663 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/anag/servlet/_AnagTexAdapterSvlt.java @@ -0,0 +1,53 @@ +package it.acxent.tex.anag.servlet; + +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class _AnagTexAdapterSvlt extends AblServletSvlt { + private static final long serialVersionUID = 6021726472382295093L; + + protected boolean checkLoginProfile(HttpServletRequest req) { + try { + if (getLoginUser(req) == null) { + forceJspPage(getLoginPage(null, null), req); + return true; + } + if (getLoginUser(req).getFlgValido().equals("N")) { + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return false; + } + if (getLoginUser(req).getId_userProfile() > 0L) + return true; + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return true; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + + protected String getAct3(HttpServletRequest req) { + return getRequestParameter(req, "act3"); + } + + protected String getCmd3(HttpServletRequest req) { + return getRequestParameter(req, "cmd3"); + } + + protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) { + return "/admin/menu/_inc-menu.jsp"; + } + + protected boolean useAlwaysSendRedirect() { + return super.useAlwaysSendRedirect(); + } + + protected String getPathImgArticoli() { + return getDocBase() + "/" + getDocBase(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/NumeroTeliRiga.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/NumeroTeliRiga.java new file mode 100644 index 00000000..c8faa262 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/NumeroTeliRiga.java @@ -0,0 +1,144 @@ +package it.acxent.tex.conf; + +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class NumeroTeliRiga extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1562752687604L; + + private long id_numeroTeliRiga; + + private double mtTessutoRiga; + + private long id_rigaDocumentoArticolo; + + private long id_rigaDocumentoTessuto; + + private RigaDocumento rigaDocumentoArticolo; + + private RigaDocumento rigaDocumentoTessuto; + + private long numTeliRiga; + + public NumeroTeliRiga(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public NumeroTeliRiga() {} + + public void setId_numeroTeliRiga(long newId_numeroTeliRiga) { + this.id_numeroTeliRiga = newId_numeroTeliRiga; + } + + public void setNumTeliRiga(long newNumTeliRiga) { + this.numTeliRiga = newNumTeliRiga; + } + + public void setId_rigaDocumentoArticolo(long newId_rigaDocumentoArticolo) { + this.id_rigaDocumentoArticolo = newId_rigaDocumentoArticolo; + setRigaDocumentoArticolo(null); + } + + public void setId_rigaDocumentoTessuto(long newId_rigaDocumentoTessuto) { + this.id_rigaDocumentoTessuto = newId_rigaDocumentoTessuto; + setRigaDocumentoTessuto(null); + } + + public long getId_numeroTeliRiga() { + return this.id_numeroTeliRiga; + } + + public long getNumTeliRiga() { + return this.numTeliRiga; + } + + public long getId_rigaDocumentoArticolo() { + return this.id_rigaDocumentoArticolo; + } + + public long getId_rigaDocumentoTessuto() { + return this.id_rigaDocumentoTessuto; + } + + public void setRigaDocumentoArticolo(RigaDocumento newRigaDocumentoArticolo) { + this.rigaDocumentoArticolo = newRigaDocumentoArticolo; + } + + public RigaDocumento getRigaDocumentoArticolo() { + this.rigaDocumentoArticolo = (RigaDocumento)getSecondaryObject(this.rigaDocumentoArticolo, RigaDocumento.class, + getId_rigaDocumentoArticolo()); + return this.rigaDocumentoArticolo; + } + + public void setRigaDocumentoTessuto(RigaDocumento newRigaDocumentoTessuto) { + this.rigaDocumentoTessuto = newRigaDocumentoTessuto; + } + + public RigaDocumento getRigaDocumentoTessuto() { + this.rigaDocumentoTessuto = (RigaDocumento)getSecondaryObject(this.rigaDocumentoTessuto, RigaDocumento.class, getId_rigaDocumentoTessuto()); + return this.rigaDocumentoTessuto; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(NumeroTeliRigaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from NUMERO_TELI_RIGA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByRDArticoloRDTessuto(long l_id_rigaDocumentoArticolo, long l_id_rigaDocumentoTessuto) { + String s_Sql_Find = "select A.* from NUMERO_TELI_RIGA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("id_rigaDocumentoArticolo=" + l_id_rigaDocumentoArticolo); + wc.addWc("id_rigaDocumentoTessuto=" + l_id_rigaDocumentoTessuto); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public double getMtTessutoRiga() { + return this.mtTessutoRiga; + } + + public void setMtTessutoRiga(double mtTessutoRiga) { + this.mtTessutoRiga = mtTessutoRiga; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/NumeroTeliRigaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/NumeroTeliRigaCR.java new file mode 100644 index 00000000..0fe697d1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/NumeroTeliRigaCR.java @@ -0,0 +1,81 @@ +package it.acxent.tex.conf; + +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class NumeroTeliRigaCR extends CRAdapter { + private long id_numeroTeliRiga; + + private long numTeliRiga; + + private long id_rigaDocumentoArticolo; + + private long id_rigaDocumentoTessuto; + + private RigaDocumento rigaDocumentoArticolo; + + private RigaDocumento rigaDocumentoTessuto; + + public NumeroTeliRigaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public NumeroTeliRigaCR() {} + + public void setId_numeroTeliRiga(long newId_numeroTeliRiga) { + this.id_numeroTeliRiga = newId_numeroTeliRiga; + } + + public void setNumTeliRiga(long newNumTeliRiga) { + this.numTeliRiga = newNumTeliRiga; + } + + public void setId_rigaDocumentoArticolo(long newId_rigaDocumentoArticolo) { + this.id_rigaDocumentoArticolo = newId_rigaDocumentoArticolo; + setRigaDocumentoArticolo(null); + } + + public void setId_rigaDocumentoTessuto(long newId_rigaDocumentoTessuto) { + this.id_rigaDocumentoTessuto = newId_rigaDocumentoTessuto; + setRigaDocumentoTessuto(null); + } + + public long getId_numeroTeliRiga() { + return this.id_numeroTeliRiga; + } + + public long getNumTeliRiga() { + return this.numTeliRiga; + } + + public long getId_rigaDocumentoArticolo() { + return this.id_rigaDocumentoArticolo; + } + + public long getId_rigaDocumentoTessuto() { + return this.id_rigaDocumentoTessuto; + } + + public void setRigaDocumentoArticolo(RigaDocumento newRigaDocumentoArticolo) { + this.rigaDocumentoArticolo = newRigaDocumentoArticolo; + } + + public RigaDocumento getRigaDocumentoArticolo() { + this.rigaDocumentoArticolo = (RigaDocumento)getSecondaryObject(this.rigaDocumentoArticolo, RigaDocumento.class, + + getId_rigaDocumentoArticolo()); + return this.rigaDocumentoArticolo; + } + + public void setRigaDocumentoTessuto(RigaDocumento newRigaDocumentoTessuto) { + this.rigaDocumentoTessuto = newRigaDocumentoTessuto; + } + + public RigaDocumento getRigaDocumentoTessuto() { + this.rigaDocumentoTessuto = (RigaDocumento)getSecondaryObject(this.rigaDocumentoTessuto, RigaDocumento.class, + + getId_rigaDocumentoTessuto()); + return this.rigaDocumentoTessuto; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/package-info.java new file mode 100644 index 00000000..4358b41c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/package-info.java @@ -0,0 +1 @@ +package it.acxent.tex.conf; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/servlet/TaglioSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/servlet/TaglioSvlt.java new file mode 100644 index 00000000..b75a850f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/servlet/TaglioSvlt.java @@ -0,0 +1,258 @@ +package it.acxent.tex.conf.servlet; + +import it.acxent.anag.Users; +import it.acxent.art.Articolo; +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoCR; +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.jsp.Ab; +import it.acxent.tex.anag.servlet._AnagTexAdapterSvlt; +import it.acxent.tex.conf.NumeroTeliRiga; +import it.acxent.util.AbMessages; +import it.acxent.util.ReturnItem; +import java.io.File; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/conf/Taglio.abl", "/admin/conf/Taglio.abl.pdf"}) +public class TaglioSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = -3363295530121263153L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Documento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new DocumentoCR(getApFull(req)); + } + + protected String getBeanPageName(HttpServletRequest req) { + return "taglio"; + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("flgTipologia", Integer.valueOf(220)); + try { + Documento bean = (Documento)getBean(req); + if (getLoginUserGrant(req, bean.getTableBeanName()) > 0L) { + ResParm rp = beforeSearch(req, res); + if (rp.getStatus()) { + DocumentoCR CR = (DocumentoCR)getBeanCR(req); + if (isSimpleServlet(req) || (!getAct(req).equals("del") && !getAct(req).startsWith("save") && + !getBackRequest(req).equals(getACT_BACK()))) + fillObject(req, CR); + if (getBackRequest(req).equals(getACT_BACK()) || getAct(req).equals("del")) { + CR = (DocumentoCR)req.getSession().getAttribute(getATTR_CRBEAN(req)); + if (CR == null) + CR = (DocumentoCR)getBeanCR(req); + req.setAttribute("_id", CR.get_id()); + if (!getAct(req).startsWith("del")) + fillObject(req, CR); + CR.setFlgReport(""); + if (getAct2(req).equals("back")) + CR.setPageNumber(1); + } + int l_pageRow = getPageRow(req); + if (getAct(req).equals("sw")) { + setJspPageRelative(getBeanPageName(req) + "F.jsp", req); + req.setAttribute("RI", new ReturnItem(req.getParameter("RI"))); + } + req.setAttribute(getCRAttribute(req), CR); + req.getSession().setAttribute(getATTR_CRBEAN(req), CR); + if (CR.getFlgReport().equals("")) { + req.setAttribute("list", bean.findByCR(CR, getPageNumber(req), getPageRow(req))); + } else { + req.setAttribute("list", bean.findByCR(CR, 0, 0)); + } + if (isSimpleServlet(req) && getCmd(req).equals("asq")) { + bean.setCurrentLang(getRequestParameter(req, "currentLang")); + req.setAttribute("bean", bean); + } + sendMessage(req, AbMessages.getMessage(getLocale(req), "SEARCH_OK")); + fillComboAfterSearch(CR, req, res); + callJsp(req, res); + } else { + sendMessage(req, rp.getMsg()); + callJsp(req, res); + } + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_R")); + callJsp(req, res); + } + } catch (Exception e) { + handleDebug(e, 0); + } + } + + public void _chiudiLavorazioneTaglio(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + ResParm rp = new ResParm(true); + bean = new Documento(apFull); + bean.findByPrimaryKey(l_id); + if (bean.getDBState() == 1) { + bean.setFlgStatoLavorazione(100L); + rp = bean.save(); + if (rp.getStatus()) { + sendMessage(req, "Lavorazione Chiusa "); + } else { + sendMessage(req, "ERRORE! " + rp.getMsg()); + req.setAttribute("bean", bean); + } + } else { + sendMessage(req, "ERRORE! Disposizione non trovata"); + } + search(req, res); + } + + public void _dettaglioDisposizione(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = null; + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Articolo articolo = new Articolo(apFull); + ResParm rp = new ResParm(true); + bean = new Documento(apFull); + bean.findByPrimaryKey(l_id_documento); + articolo = bean.getArticolo(); + if (bean.getDBState() == 1 && articolo.getDBState() == 1) { + req.setAttribute("listaRigheDocumento", bean.findRigheDocumento(0, 0, 0)); + req.setAttribute("listaRigheArticoliTessuto", + bean.findRigheDocumentoDisposizioneTaglio(0, 0, 0)); + req.setAttribute("bean", bean); + req.setAttribute("articolo", articolo); + setJspPageRelative("taglio.jsp", req); + callJsp(req, res); + } else { + sendMessage(req, "Errore! documento non trovato "); + search(req, res); + } + } + + protected void callJsp(HttpServletRequest req, HttpServletResponse res) { + super.callJsp(req, res); + } + + public void _aggiornaTeliArticoloTessuto(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + RigaDocumento rd = new RigaDocumento(apFull); + ResParm rp = new ResParm(true, ""); + long l_id_rigaDocumentoArticolo = getRequestLongParameter(req, "id_rigaDocumento"); + long l_id_rigaDocumentoTessuto = getRequestLongParameter(req, "id_rigaDocumento100"); + long l_numTeliRigaNew = getRequestLongParameter(req, "numTeliRigaNew"); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + rd.findByPrimaryKey(l_id_rigaDocumentoArticolo); + if (rd.getId_rigaDocumento() > 0L) { + req.setAttribute("id_documento", Long.valueOf(rd.getId_documento())); + NumeroTeliRiga ntr = new NumeroTeliRiga(apFull); + ntr.findByRDArticoloRDTessuto(l_id_rigaDocumentoArticolo, l_id_rigaDocumentoTessuto); + if (ntr.getId_numeroTeliRiga() > 0L) { + ntr.setNumTeliRiga(l_numTeliRigaNew); + rp = ntr.save(); + if (rp.getStatus()) { + Documento.calcolaTessutiTaglio(rd.getDocumento(), getLang(req)); + sendMessage(req, Ab.formatBeanMsg("Numero Teli aggiornati correttamente")); + _dettaglioDisposizione(req, res); + } else { + sendMessage(req, Ab.formatBeanMsg("ERRORE! " + rp.getMsg())); + _dettaglioDisposizione(req, res); + } + } else { + sendMessage(req, Ab.formatBeanMsg("Attenzione! Problema modifica teli riga!")); + _dettaglioDisposizione(req, res); + } + } else { + sendMessage(req, Ab.formatBeanMsg("Attenzione! Riga Documento non trovata!")); + _dettaglioDisposizione(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + _dettaglioDisposizione(req, res); + } + } + } + + public void _aggiornaCapiTelo(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + RigaDocumento rd = new RigaDocumento(apFull); + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_rigaDocumento"); + long l_qta = getRequestLongParameter(req, "capiPerTeloNew"); + if (getLoginUserGrant(req, getBean(req).getTableBeanName()) < 2L) { + sendGrantMessage(req, "Permessi di scrittura mancanti"); + showBean(req, res); + } else { + try { + rd.findByPrimaryKey(l_id); + if (rd.getId_rigaDocumento() > 0L) { + req.setAttribute("id_documento", Long.valueOf(rd.getId_documento())); + Documento bean = rd.getDocumento(); + rd.setCapiPerTelo(l_qta); + rp = rd.superSave(); + if (rp.getStatus()) { + Documento.calcolaTessutiTaglio(rd.getDocumento(), getLang(req)); + sendMessage(req, Ab.formatBeanMsg("Articolo aggiornato correttamente")); + _dettaglioDisposizione(req, res); + } else { + sendMessage(req, Ab.formatBeanMsg("ERRORE! " + rp.getMsg())); + _dettaglioDisposizione(req, res); + } + } else { + sendMessage(req, Ab.formatBeanMsg("Attenzione! Riga Documento non trovata!")); + _dettaglioDisposizione(req, res); + } + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + _dettaglioDisposizione(req, res); + } + } + } + + public void _printDisposizioneTaglio(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Users theUser = (Users)getLoginUser(req); + Users operatore = null; + long l_id_users = getRequestLongParameter(req, "id_oper"); + if (l_id_users > 0L) { + operatore = new Users(apFull); + operatore.findByPrimaryKey(l_id_users); + } + try { + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(apFull); + bean.findByPrimaryKey(l_id); + bean.setCurrentLang(getLang(req)); + DocumentoCR CR = new DocumentoCR(); + fillObject(req, CR); + CR.setId_documentoS(l_id); + new File(bean.getPathStampaDocumentoFull()).delete(); + bean.setPrtCommand(1L); + sendPdf(res, bean.creaDocumentoPdf(CR, false), "Dispo Taglio " + + bean.getNumeroDocumentoPdf() + DBAdapter.getDayTimeTimestamp()); + if (bean.getFlgStatoLavorazione() != 30L) { + bean.setFlgStatoLavorazione(30L); + bean.save(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/servlet/package-info.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/servlet/package-info.java new file mode 100644 index 00000000..16753e52 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/conf/servlet/package-info.java @@ -0,0 +1 @@ +package it.acxent.tex.conf.servlet; diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/json/JFondi.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/json/JFondi.java new file mode 100644 index 00000000..9a4c69b6 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/json/JFondi.java @@ -0,0 +1,30 @@ +package it.acxent.tex.json; + +public class JFondi { + private long id_fondo; + + private String descrizione; + + public JFondi(long id_fondo, String descrizione) { + this.id_fondo = id_fondo; + this.descrizione = descrizione; + } + + public JFondi() {} + + public long getId_fondo() { + return this.id_fondo; + } + + public void setId_fondo(long id_fondo) { + this.id_fondo = id_fondo; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/LavPezza.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/LavPezza.java new file mode 100644 index 00000000..989bd3dd --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/LavPezza.java @@ -0,0 +1,702 @@ +package it.acxent.tex.lav; + +import it.acxent.anag.Clifor; +import it.acxent.contab.Documento; +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.OrString; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.DoubleOperator; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.HashMap; +import java.util.Map; +import org.apache.commons.lang3.StringUtils; + +public class LavPezza extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1551182243537L; + + private long id_rigaDocumento; + + private Timestamp tsInserimento; + + private String codicePezza; + + private RigaDocumento rigaDocumento; + + private Clifor clifor; + + private long id_clifor; + + private double mtPezza; + + private RigaDocumento rigaDocumentoBolla; + + private long id_rigaDocumentoBolla; + + private long id_lavPezza; + + private String codicePancale; + + private long numColpi; + + private long count; + + public LavPezza(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public LavPezza() {} + + public void setId_lavPezza(long newId_lavPezza) { + this.id_lavPezza = newId_lavPezza; + } + + public void setId_rigaDocumento(long newId_rigaDocumento) { + this.id_rigaDocumento = newId_rigaDocumento; + setRigaDocumento(null); + } + + public void setTsInserimento(Timestamp newTsInserimento) { + this.tsInserimento = newTsInserimento; + } + + public void setCodicePezza(String newCodicePezza) { + this.codicePezza = newCodicePezza; + } + + public long getId_lavPezza() { + return this.id_lavPezza; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public Timestamp getTsInserimento() { + return this.tsInserimento; + } + + public String getCodicePezza() { + return (this.codicePezza == null) ? "" : this.codicePezza.trim(); + } + + public void setRigaDocumento(RigaDocumento newRigaDocumento) { + this.rigaDocumento = newRigaDocumento; + } + + public RigaDocumento getRigaDocumento() { + this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, getId_rigaDocumento()); + return this.rigaDocumento; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public long getTotPezzeByDocumentoDTESS(long l_id_documento) { + String s_Sql_Find = "select count(*) as tot from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS B ON A.id_rigaDocumento=B.id_rigaDocumento"; + WcString wc = new WcString(); + wc.addWc("B.id_documento=" + l_id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return (long)getTots(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0L; + } + } + + public long getTotPezzeInviateDaFatturareByDocumentoDTESS(long l_id_documento) { + String s_Sql_Find = "select count(*) as tot from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS RDDISPO ON A.id_rigaDocumento=RDDISPO.id_rigadocumento inner join RIGA_DOCUMENTO AS RDBOLLA ON RDBOLLA.id_rigaDocumento=A.id_rigaDocumentoBolla left join RIGA_DOCUMENTO AS RDFT ON RDFT.id_documento=RDBOLLA.id_documentoPadre"; + WcString wc = new WcString(); + wc.addWc("RDDISPO.id_documento=" + l_id_documento); + wc.addWc("RDFT.id_rigaDocumento is null"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return (long)getTots(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0L; + } + } + + public long getTotPezzeInviateDaFatturareByRigaDocumentoDTESS(long l_id_rigaDocumento, HashMap hsDdtDaFatturare) { + String s_Sql_Find = "select count(*) as tot from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS RDDISPO ON A.id_rigaDocumento=RDDISPO.id_rigadocumento inner join RIGA_DOCUMENTO AS RDBOLLA ON RDBOLLA.id_rigaDocumento=A.id_rigaDocumentoBolla left join RIGA_DOCUMENTO AS RDFT ON RDFT.id_documento=RDBOLLA.id_documentoPadre"; + WcString wc = new WcString(); + wc.addWc("RDDISPO.id_rigaDocumento=" + l_id_rigaDocumento); + wc.addWc("RDFT.id_rigaDocumento is null"); + if (hsDdtDaFatturare != null) { + OrString orBolle = new OrString(); + for (Map.Entry me : hsDdtDaFatturare.entrySet()) + orBolle.addOr("RDBOLLA.id_documento=" + me.getValue().getId_documento()); + wc.addWc(orBolle.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return (long)getTots(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0L; + } + } + + public long getTotPezzeFatturateByDocumentoDTESS(long l_id_documento) { + String s_Sql_Find = "select count(*) as tot from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS B ON A.id_rigaDocumento=B.id_rigaDocumento inner join RIGA_DOCUMENTO AS BF ON A.id_rigaDocumentoBolla=BF.id_rigaDocumento inner join RIGA_DOCUMENTO AS RDFT ON BF.id_rigaDocumentoPadre=RDFT.id_rigaDocumento"; + WcString wc = new WcString(); + wc.addWc("B.id_documento=" + l_id_documento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return (long)getTots(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0L; + } + } + + public double getTotMetriByDocumentoDTESS(long l_id_documento, boolean soloInviate) { + String s_Sql_Find = "select sum(mtPezza) as _sum from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS B ON A.id_rigaDocumento=B.id_rigaDocumento"; + WcString wc = new WcString(); + wc.addWc("B.id_documento=" + l_id_documento); + if (soloInviate) + wc.addWc("A.id_rigaDocumentoBolla>0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public double getTotMetriDaFatturareByDocumentoDTESS(long l_id_documento) { + String s_Sql_Find = "select sum(mtPezza) as _sum from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS RDDISPO ON A.id_rigaDocumento=RDDISPO.id_rigadocumento inner join RIGA_DOCUMENTO AS RDBOLLA ON RDBOLLA.id_rigaDocumento=A.id_rigaDocumentoBolla left join RIGA_DOCUMENTO AS RDFT ON RDFT.id_documento=RDBOLLA.id_documentoPadre"; + WcString wc = new WcString(); + wc.addWc("RDDISPO.id_documento=" + l_id_documento); + wc.addWc("RDFT.id_rigaDocumento is null"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public double getTotMetriDaFatturareByRigaDocumentoDTESS(long l_id_rigaDocumento, HashMap hsDdtDaFatturare) { + String s_Sql_Find = "select sum(mtPezza) as _sum from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS RDDISPO ON A.id_rigaDocumento=RDDISPO.id_rigadocumento inner join RIGA_DOCUMENTO AS RDBOLLA ON RDBOLLA.id_rigaDocumento=A.id_rigaDocumentoBolla left join RIGA_DOCUMENTO AS RDFT ON RDFT.id_documento=RDBOLLA.id_documentoPadre"; + WcString wc = new WcString(); + wc.addWc("RDDISPO.id_rigaDocumento=" + l_id_rigaDocumento); + wc.addWc("RDFT.id_rigaDocumento is null"); + if (hsDdtDaFatturare != null) { + OrString orBolle = new OrString(); + for (Map.Entry me : hsDdtDaFatturare.entrySet()) + orBolle.addOr("RDBOLLA.id_documento=" + me.getValue().getId_documento()); + wc.addWc(orBolle.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return getSum(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0.0D; + } + } + + public void findByCodicePezzaClifor(String l_codicePezza, long l_id_clifor) { + String s_Sql_Find = "select A.* from LAV_PEZZA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codicePezza='" + l_codicePezza + "'"); + wc.addWc("A.id_clifor=" + l_id_clifor); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public ResParm save() { + LavPezza bean = new LavPezza(getApFull()); + long l_id_cliforPancale = bean.findClientePancaleNonInviato(getCodicePancale()); + if (l_id_cliforPancale > 0L && l_id_cliforPancale != getId_clifor()) { + Clifor clifor = new Clifor(getApFull()); + clifor.findByPrimaryKey(l_id_cliforPancale); + return new ResParm(false, "Errore! pezza " + getCodicePezza() + ": Pancale " + getCodicePancale() + " con pezze di " + + clifor.getDescrizioneCliente()); + } + if (getTsInserimento() == null) + setTsInserimento(getTimestamp()); + if (getNumColpi() > 0L) { + if (getRigaDocumento().getNumColpiDM() > 0L) { + DoubleOperator dop = new DoubleOperator((float)getNumColpi()); + dop.setScale(2, 5); + dop.divide((float)getRigaDocumento().getNumColpiDM()); + setMtPezza(dop.getResult()); + } else { + return new ResParm(false, "Errore! Non è impostato Numero colpi metro sulla disposizione!"); + } + } else if (getMtPezza() <= 0.0D) { + return new ResParm(false, "Errore! non hai impostato numero colpi o metri!"); + } + return super.save(); + } + + public ResParm superSave() { + return super.save(); + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public Vectumerator findByCR(LavPezzaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from LAV_PEZZA AS A"; + String s_Sql_Order = " order by C.riferimento, B.descrizioneRiga, A.codicePezza, tsInserimento asc"; + WcString wc = new WcString(); + s_Sql_Find = s_Sql_Find + " inner join RIGA_DOCUMENTO AS B on A.id_rigaDocumento=B.id_rigaDocumento inner join DOCUMENTO as C on C.id_documento=B.id_documento"; + if (CR.getId_documentoBolla() > 0L) + s_Sql_Find = s_Sql_Find + " inner join RIGA_DOCUMENTO AS BBOLLA on A.id_rigaDocumentoBolla=BBOLLA.id_rigaDocumento"; + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_rigaDocumento() > 0L) + wc.addWc("A.id_rigaDocumento=" + CR.getId_rigaDocumento()); + if (CR.getId_rigaDocumentoBolla() > 0L) + wc.addWc("A.id_rigaDocumentoBolla=" + CR.getId_rigaDocumentoBolla()); + if (CR.getId_documento() > 0L) + wc.addWc("B.id_documento=" + CR.getId_documento()); + if (CR.getId_documentoBolla() > 0L) + wc.addWc("BBOLLA.id_documento=" + CR.getId_documentoBolla()); + if (!CR.getRiferimento().isEmpty()) + wc.addWc("C.riferimento like '%" + CR.getRiferimento() + "%'"); + if (!CR.getCodicePezza().isEmpty()) + wc.addWc("A.codicePezza like '%" + CR.getCodicePezza() + "%'"); + if (CR.getProgDocumento() != 0L && CR.getProgDocumentoA() == 0L) { + wc.addWc("C.progDocumento =" + CR.getProgDocumento()); + } else if (CR.getProgDocumento() != 0L && CR.getProgDocumentoA() != 0L) { + wc.addWc("C.progDocumento >=" + CR.getProgDocumento()); + wc.addWc("C.progDocumento <=" + CR.getProgDocumentoA()); + } + if (CR.getId_clifor() > 0L) + wc.addWc("C.id_clifor=" + CR.getId_clifor()); + if (!CR.getCodicePancale().isEmpty()) + wc.addWc("A.codicePancale='" + CR.getCodicePancale() + "'"); + if (CR.getFlgConBolla() == 0L) { + wc.addWc("(A.id_rigaDocumentoBolla is null or A.id_rigaDocumentoBolla=0)"); + } else if (CR.getFlgConBolla() > 0L) { + wc.addWc("A.id_rigaDocumentoBolla>0"); + } + if (CR.getDataDocumentoDa() != null) + wc.addWc("C.dataDocumento>=?"); + if (CR.getDataDocumentoA() != null) + wc.addWc("C.dataDocumento<=?"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + int dataCount = 0; + if (CR.getDataDocumentoDa() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoDa()); + } + if (CR.getDataDocumentoA() != null) { + dataCount++; + stmt.setDate(dataCount, CR.getDataDocumentoA()); + } + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findLastInserimentoByRigaDocumento(long l_id_rigaDocumento, long l_id_lavPezzaSave) { + String s_Sql_Find = "select A.* from LAV_PEZZA AS A"; + String s_Sql_Order = " order by tsInserimento desc"; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumento=" + l_id_rigaDocumento); + wc.addWc("A.id_lavPezza!=" + l_id_lavPezzaSave); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public String getTsInserimentoS() { + return (getTsInserimento() == null) ? "" : getTimestampFormat().format(getTsInserimento()); + } + + public double getMtPezza() { + return this.mtPezza; + } + + public void setMtPezza(double mtPezza) { + this.mtPezza = mtPezza; + } + + public Vectumerator findByRigaDocumento(long l_id_rigaDocumento) { + LavPezzaCR CR = new LavPezzaCR(getApFull()); + CR.setId_rigaDocumento(l_id_rigaDocumento); + return findByCR(CR, 0, 0); + } + + public Vectumerator findByDocumentoBolla(long l_id_documentoBolla) { + LavPezzaCR CR = new LavPezzaCR(getApFull()); + CR.setId_documentoBolla(l_id_documentoBolla); + CR.setFlgConBolla(1L); + return findByCR(CR, 0, 0); + } + + public Vectumerator findByRigaDocumentoBolla(long l_id_rigaDocumento) { + LavPezzaCR CR = new LavPezzaCR(getApFull()); + CR.setId_rigaDocumentoBolla(l_id_rigaDocumento); + return findByCR(CR, 0, 0); + } + + public Vectumerator findByDocumento(long l_id_documento) { + LavPezzaCR CR = new LavPezzaCR(getApFull()); + CR.setId_documento(l_id_documento); + CR.setFlgConBolla(-1L); + return findByCR(CR, 0, 0); + } + + public ResParm creaBollaDaLista(LavPezzaCR CR, String[] id_lavPezze) { + ResParm rp = new ResParm(true); + HashMap lst = new HashMap<>(); + SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy"); + boolean testRiferimenti = true; + if (testRiferimenti) { + for (int i = 0; i < id_lavPezze.length; i++) { + if (!id_lavPezze[i].isEmpty()) { + String riferimento; + LavPezza row = new LavPezza(getApFull()); + row.findByPrimaryKey(Long.valueOf(id_lavPezze[i])); + if (CR.getSearchTxt().isEmpty()) { + riferimento = ""; + } else { + riferimento = CR.getSearchTxt(); + } + rp = row.creaBolla(CR.getId_users(), false, CR.getId_tipoDocumento(), CR.getDataEmissioneDocumento(), riferimento); + if (rp.getStatus()) { + Documento l_documento = (Documento)rp.getReturnObj(); + if (!lst.containsKey(Long.valueOf(l_documento.getId_documento()))) + lst.put(Long.valueOf(l_documento.getId_documento()), l_documento); + } + } + } + Vectumerator vecDoc = new Vectumerator(); + if (rp.getStatus()) { + StringBuilder sb = new StringBuilder(); + for (Documento doc : lst.values()) { + if (CR.getFlgStato() > 0L) { + doc.setFlgStato(CR.getFlgStato()); + } else { + doc.setFlgStato(1L); + } + doc.save(); + vecDoc.add(doc); + } + rp.setMsg(sb.toString()); + rp.setReturnObj(vecDoc); + } + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Non puoi creare fatture con riferimenti diversi tra loro."); + } + return rp; + } + + public ResParm creaBolla(long l_id_users, boolean emetti, long l_id_tipoFattura, Date l_dataEmissioneDocumento, String riferimento) { + ResParm rp = new ResParm(true); + if (l_dataEmissioneDocumento == null) + l_dataEmissioneDocumento = getToday(); + Documento documento = new Documento(getApFull()); + documento.findDocumentoBozza(l_id_tipoFattura, getId_clifor()); + if (documento.getDBState() == 0) { + documento.setId_users(l_id_users); + documento.setId_clifor(getId_clifor()); + documento.setId_tipoPagamento(getClifor().getId_tipoPagamento()); + documento.setId_tipoDocumento(l_id_tipoFattura); + documento.setDataDocumento(l_dataEmissioneDocumento); + Calendar cal = Calendar.getInstance(); + cal.setTime(documento.getDataDocumento()); + documento.setId_esercizio((long)cal.get(1)); + documento.setId_documentoFiglio(0L); + rp = documento.superSave(); + } + if (rp.getStatus()) { + creaRigheDocumento(documento); + setRigaDocumento(null); + save(); + } + Vectumerator vecrd = documento.findRigheDocumento(0, 0, 0); + documento.setNColli((long)vecrd.getTotNumberOfRecords()); + documento.superSave(); + rp.setMsg(String.valueOf(documento.getId_documento())); + rp.setReturnObj(documento); + return rp; + } + + public ResParm creaRigheDocumento(Documento fatt) { + ResParm rp = new ResParm(true); + RigaDocumento rd = new RigaDocumento(getApFull()); + StringBuilder sbDettaglio = new StringBuilder(); + sbDettaglio.append(" N.: "); + if (getCodicePezza().length() > 2) { + String l_codicepezza = StringUtils.stripStart(getCodicePezza(), "0"); + if (getRigaDocumento().getDocumento().getFlgBarcodeType() == 1L) { + sbDettaglio.append(l_codicepezza.substring(0, l_codicepezza.length() - 1)); + } else { + sbDettaglio.append(l_codicepezza); + } + } + sbDettaglio.append(" "); + StringBuilder sbRaggruppamento = new StringBuilder(); + sbRaggruppamento.append("Tela: "); + sbRaggruppamento.append(getRigaDocumento().getDocumento().getRiferimento()); + sbRaggruppamento.append(" Articolo: "); + sbRaggruppamento.append(getRigaDocumento().getDescrizioneRiga()); + rd.setDescrizioneRiga(sbDettaglio.toString() + sbDettaglio.toString()); + rd.setDescrizioneRigaDettaglio(sbDettaglio.toString()); + rd.setDescrizioneRigaRaggruppamento(sbRaggruppamento.toString()); + rd.setMt(getMtPezza()); + rd.setNr(getMtPezza()); + rd.setId_documento(fatt.getId_documento()); + rp = rd.superSave(); + if (rp.getStatus()) { + setId_rigaDocumentoBolla(rd.getId_rigaDocumento()); + rp = save(); + } + return rp; + } + + public Documento getDocumento() { + return getRigaDocumento().getDocumento(); + } + + public RigaDocumento getRigaDocumentoBolla() { + this.rigaDocumentoBolla = (RigaDocumento)getSecondaryObject(this.rigaDocumentoBolla, RigaDocumento.class, getId_rigaDocumentoBolla()); + return this.rigaDocumentoBolla; + } + + public void setRigaDocumentoBolla(RigaDocumento rigaDocumentoBolla) { + this.rigaDocumentoBolla = rigaDocumentoBolla; + } + + public long getId_rigaDocumentoBolla() { + return this.id_rigaDocumentoBolla; + } + + public void setId_rigaDocumentoBolla(long id_rigaDocumentoBolla) { + this.id_rigaDocumentoBolla = id_rigaDocumentoBolla; + } + + public String getCodicePancale() { + return (this.codicePancale == null) ? "" : this.codicePancale.trim(); + } + + public void setCodicePancale(String codicePancale) { + this.codicePancale = codicePancale; + } + + public long getNumColpi() { + return this.numColpi; + } + + public void setNumColpi(long numColpi) { + this.numColpi = numColpi; + } + + public long findClientePancaleNonInviato(String l_codicePancale) { + String s_Sql_Find = "select A.id_clifor from LAV_PEZZA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codicePancale='" + l_codicePancale + "'"); + wc.addWc("(A.id_rigaDocumentoBolla is null or A.id_rigaDocumentoBolla=0)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = findRows(stmt); + if (vec.hasMoreElements()) { + LavPezza row = (LavPezza)vec.nextElement(); + return row.getId_clifor(); + } + return 0L; + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return 0L; + } + } + + public long getTotPezzeInviateByDocumentoDTESS(long l_id_documento) { + String s_Sql_Find = "select count(*) as tot from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS B ON A.id_rigaDocumento=B.id_rigaDocumento"; + WcString wc = new WcString(); + wc.addWc("B.id_documento=" + l_id_documento); + wc.addWc("A.id_rigaDocumentoBolla>0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return (long)getTots(stmt); + } catch (SQLException e) { + handleDebug(e); + return 0L; + } + } + + public Vectumerator findPezzeInviateDaFatturareByDocumento(long l_id_documento) { + String s_Sql_Find = "select A.* from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS RDDISPO ON A.id_rigaDocumento=RDDISPO.id_rigadocumento inner join RIGA_DOCUMENTO AS RDBOLLA ON RDBOLLA.id_rigaDocumento=A.id_rigaDocumentoBolla left join RIGA_DOCUMENTO AS RDFT ON RDFT.id_documento=RDBOLLA.id_documentoPadre"; + WcString wc = new WcString(); + wc.addWc("RDDISPO.id_documento=" + l_id_documento); + wc.addWc("RDFT.id_rigaDocumento is null"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findPezzeInviateDaFatturareByRIGADocumento(long l_id_rigaDocumento, HashMap hsDdtDaFatturare) { + String s_Sql_Find = "select A.* from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS RDDISPO ON A.id_rigaDocumento=RDDISPO.id_rigadocumento inner join RIGA_DOCUMENTO AS RDBOLLA ON RDBOLLA.id_rigaDocumento=A.id_rigaDocumentoBolla left join RIGA_DOCUMENTO AS RDFT ON RDFT.id_documento=RDBOLLA.id_documentoPadre"; + WcString wc = new WcString(); + wc.addWc("RDDISPO.id_rigaDocumento=" + l_id_rigaDocumento); + wc.addWc("RDFT.id_rigaDocumento is null"); + if (hsDdtDaFatturare != null) { + OrString orBolle = new OrString(); + for (Map.Entry me : hsDdtDaFatturare.entrySet()) + orBolle.addOr("RDBOLLA.id_documento=" + me.getValue().getId_documento()); + wc.addWc(orBolle.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getError() { + if (getId_lavPezza() == 0L) + return ""; + StringBuilder errmsg = new StringBuilder(); + if (getRigaDocumento().getId_documento() == 0L) { + errmsg.append("Pezza relativa ad un documento cancellato!!!"); + } else if (getId_clifor() != getRigaDocumento().getDocumento().getId_clifor()) { + errmsg.append("Cliente pezza diverso da cliente documento: pezza: " + getClifor().getDescrizioneCliente() + " doc: " + + getRigaDocumento().getDocumento().getId_clifor() + " - " + + getRigaDocumento().getDocumento().getClifor().getDescrizioneCliente()); + } + return errmsg.toString(); + } + + public boolean isError() { + if (getError().isEmpty()) + return false; + return true; + } + + public boolean isFatturata() { + if (getRigaDocumentoBolla().getId_documentoPadre() > 0L) + return true; + return false; + } + + public String getDocumentoFatturaNumero() { + if (isFatturata()) + return getRigaDocumentoBolla().getDocumentoPadre().getNumeroDocumentoCompleto(); + return ""; + } + + public boolean isInviata() { + if (getId_rigaDocumentoBolla() > 0L) + return true; + return false; + } + + public String getDocumentoBollaNumero() { + if (isInviata()) + return getRigaDocumentoBolla().getDocumento().getNumeroDocumentoCompleto(); + return ""; + } + + public Vectumerator findDdtByRigaDocumento(long l_id_rigaDocumento) { + String s_Sql_Find = "select MAX(A.id_rigaDocumentoBolla) as id_rigaDocumentoBolla, count(1) as count, B.id_documento from LAV_PEZZA AS A inner join RIGA_DOCUMENTO AS B ON A.id_rigaDocumentoBolla=B.id_rigaDocumento"; + String s_Sql_Order = " GROUP BY B.id_documento;"; + WcString wc = new WcString(); + wc.addWc("A.id_rigaDocumento=" + l_id_rigaDocumento); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getCount() { + return this.count; + } + + public void setCount(long count) { + this.count = count; + } + + protected void initFields() { + super.initFields(); + setCount(0L); + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + try { + if (isColumnInResultSet(rst, "count")) + setCount(rst.getLong("count")); + } catch (SQLException e) { + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/LavPezzaCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/LavPezzaCR.java new file mode 100644 index 00000000..d2aad95f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/LavPezzaCR.java @@ -0,0 +1,242 @@ +package it.acxent.tex.lav; + +import it.acxent.anag.Clifor; +import it.acxent.contab.Documento; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.TipoDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; +import java.sql.Timestamp; + +public class LavPezzaCR extends CRAdapter { + private long id_lavPezza; + + private long id_rigaDocumento; + + private Timestamp tsInserimento; + + private String codicePezza; + + private RigaDocumento rigaDocumento; + + private Clifor clifor; + + private long id_clifor; + + private long id_documento; + + private String riferimento; + + private Date dataEmissioneDocumento; + + private long id_tipoDocumento; + + private long flgStato = -1L; + + private long flgConBolla = 0L; + + private TipoDocumento tipoDocumento; + + private long id_rigaDocumentoBolla; + + private String codicePancale; + + private Date dataDocumentoA; + + private Date dataDocumentoDa; + + private long progDocumento; + + private long progDocumentoA; + + private long id_documentoBolla; + + public LavPezzaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public LavPezzaCR() {} + + public void setId_lavPezza(long newId_lavPezza) { + this.id_lavPezza = newId_lavPezza; + } + + public void setId_rigaDocumento(long newId_rigaDocumento) { + this.id_rigaDocumento = newId_rigaDocumento; + setRigaDocumento(null); + } + + public void setTsInserimento(Timestamp newTsInserimento) { + this.tsInserimento = newTsInserimento; + } + + public void setCodicePezza(String newCodicePezza) { + this.codicePezza = newCodicePezza; + } + + public long getId_lavPezza() { + return this.id_lavPezza; + } + + public long getId_rigaDocumento() { + return this.id_rigaDocumento; + } + + public Timestamp getTsInserimento() { + return this.tsInserimento; + } + + public String getCodicePezza() { + return (this.codicePezza == null) ? "" : this.codicePezza.trim(); + } + + public void setRigaDocumento(RigaDocumento newRigaDocumento) { + this.rigaDocumento = newRigaDocumento; + } + + public RigaDocumento getRigaDocumento() { + this.rigaDocumento = (RigaDocumento)getSecondaryObject(this.rigaDocumento, RigaDocumento.class, getId_rigaDocumento()); + return this.rigaDocumento; + } + + public Clifor getClifor() { + this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor()); + return this.clifor; + } + + public long getId_clifor() { + return this.id_clifor; + } + + public void setClifor(Clifor newClifor) { + this.clifor = newClifor; + } + + public void setId_clifor(long newId_clifor) { + this.id_clifor = newId_clifor; + setClifor(null); + } + + public long getId_documento() { + return this.id_documento; + } + + public void setId_documento(long id_documento) { + this.id_documento = id_documento; + } + + public String getRiferimento() { + return (this.riferimento == null) ? AB_EMPTY_STRING : this.riferimento.trim(); + } + + public void setRiferimento(String riferimento) { + this.riferimento = riferimento; + } + + public Date getDataEmissioneDocumento() { + return this.dataEmissioneDocumento; + } + + public void setDataEmissioneDocumento(Date dataEmissioneDocumento) { + this.dataEmissioneDocumento = dataEmissioneDocumento; + } + + public long getId_tipoDocumento() { + return this.id_tipoDocumento; + } + + public void setId_tipoDocumento(long id_tipoDocumento) { + this.id_tipoDocumento = id_tipoDocumento; + setTipoDocumento(null); + } + + public long getFlgStato() { + return this.flgStato; + } + + public void setFlgStato(long flgStato) { + this.flgStato = flgStato; + } + + public static final String getStato(long l_flgStato) { + return Documento.getStato(l_flgStato); + } + + public String getStato() { + return getStato(getFlgStato()); + } + + public long getFlgConBolla() { + return this.flgConBolla; + } + + public void setFlgConBolla(long flgSenzaBolla) { + this.flgConBolla = flgSenzaBolla; + } + + public TipoDocumento getTipoDocumento() { + this.tipoDocumento = (TipoDocumento)getSecondaryObject(this.tipoDocumento, TipoDocumento.class, getId_tipoDocumento()); + return this.tipoDocumento; + } + + public void setTipoDocumento(TipoDocumento tipoDocumento) { + this.tipoDocumento = tipoDocumento; + } + + public long getId_rigaDocumentoBolla() { + return this.id_rigaDocumentoBolla; + } + + public void setId_rigaDocumentoBolla(long id_rigaDocumentoBolla) { + this.id_rigaDocumentoBolla = id_rigaDocumentoBolla; + } + + public String getCodicePancale() { + return (this.codicePancale == null) ? AB_EMPTY_STRING : this.codicePancale.trim(); + } + + public void setCodicePancale(String codicePancale) { + this.codicePancale = codicePancale; + } + + public Date getDataDocumentoA() { + return this.dataDocumentoA; + } + + public void setDataDocumentoA(Date dataDocumentoA) { + this.dataDocumentoA = dataDocumentoA; + } + + public Date getDataDocumentoDa() { + return this.dataDocumentoDa; + } + + public void setDataDocumentoDa(Date dataDocumentoDa) { + this.dataDocumentoDa = dataDocumentoDa; + } + + public long getProgDocumento() { + return this.progDocumento; + } + + public void setProgDocumento(long progDocumento) { + this.progDocumento = progDocumento; + } + + public long getProgDocumentoA() { + return this.progDocumentoA; + } + + public void setProgDocumentoA(long progDocumentoA) { + this.progDocumentoA = progDocumentoA; + } + + public long getId_documentoBolla() { + return this.id_documentoBolla; + } + + public void setId_documentoBolla(long id_documentoBolla) { + this.id_documentoBolla = id_documentoBolla; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/servlet/BollaPezzaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/servlet/BollaPezzaSvlt.java new file mode 100644 index 00000000..2b08313d --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/servlet/BollaPezzaSvlt.java @@ -0,0 +1,121 @@ +package it.acxent.tex.lav.servlet; + +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.TipoDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.tex.anag.servlet._AnagTexAdapterSvlt; +import it.acxent.tex.lav.LavPezza; +import it.acxent.tex.lav.LavPezzaCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/lav/BollaPezza.abl"}) +public class BollaPezzaSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = -3363295810121263153L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipiDocumento", new TipoDocumento(apFull).findByTipologiaClienteFornitoreAFT(0L, "C", 0L, -1L)); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new LavPezza(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new LavPezzaCR(getApFull(req)); + } + + protected String getBeanPageName(HttpServletRequest req) { + return "bollaPezza"; + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + super.search(req, res); + } + + public void _dettaglioDisposizione(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + RigaDocumento bean = null; + String l_codicePezza = getRequestParameter(req, "codicePezza"); + LavPezza pezza = new LavPezza(apFull); + ResParm rp = new ResParm(true); + bean = new RigaDocumento(apFull); + bean.findByCodicePezza(l_codicePezza); + if (bean.getDBState() == 1) { + sendHtmlMsgResponse(req, res, bean.getDocumento().getClifor().getCognomeNome() + " " + bean.getDocumento().getClifor().getCognomeNome() + " " + bean.getDocumento().getRiferimento()); + } else { + sendHtmlMsgResponse(req, res, "Pezza NON Trovata"); + } + } + + public void _generaDocumento(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(true); + String lavPezze = getRequestParameter(req, "id_lavPezze"); + String[] id_lavPezze = lavPezze.split(","); + LavPezzaCR CR = new LavPezzaCR(apFull); + fillObject(req, CR); + CR.setId_users(getLoginUser(req).getId_users()); + LavPezza bean = new LavPezza(apFull); + rp.append(bean.creaBollaDaLista(CR, id_lavPezze)); + if (rp.getStatus()) { + req.setAttribute("listaDocumenti", rp.getReturnObj()); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } + + public void _mostraPezza(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id = getRequestLongParameter(req, "id_lavPezza"); + LavPezza bean = new LavPezza(apFull); + ResParm rp = new ResParm(true); + bean.findByPrimaryKey(l_id); + if (bean.getDBState() == 1) { + req.setAttribute("bean", bean); + } else { + sendMessage(req, "ERRORE! pezza non trovata"); + } + forceJspPageRelative("lavPezzaE.jsp", req); + callJsp(req, res); + } + + public void _aggiungiPezza(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + LavPezza bean = new LavPezza(apFull); + long l_id = getRequestLongParameter(req, "id_lavPezzaE"); + long l_numColpi = getRequestLongParameter(req, "numColpiE"); + double l_mtPezza = getRequestDoubleParameter(req, "mtPezzaE"); + String l_codicePancale = getRequestParameter(req, "codicePancaleE"); + ResParm rp = new ResParm(true); + bean.findByPrimaryKey(l_id); + if (bean.getDBState() == 1) { + bean.setMtPezza(l_mtPezza); + bean.setNumColpi(l_numColpi); + bean.setCodicePancale(l_codicePancale); + rp = bean.save(); + if (rp.getStatus()) { + sendMessage(req, "Pezza " + bean.getCodicePezza() + " aggiornata per Mt. " + l_mtPezza + " su Tela " + + bean.getDocumento().getRiferimento() + " di " + bean.getDocumento().getClifor().getCognomeNome()); + } else { + sendMessage(req, rp.getMsg()); + } + } else { + sendMessage(req, "ERRORE! pezza non trovata"); + } + search(req, res); + } + + protected int getPageRow(HttpServletRequest req) { + return 100; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/servlet/LavPezzaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/servlet/LavPezzaSvlt.java new file mode 100644 index 00000000..b08a1d04 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/servlet/LavPezzaSvlt.java @@ -0,0 +1,96 @@ +package it.acxent.tex.lav.servlet; + +import it.acxent.anag.Users; +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoCR; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.TipoDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.tex.anag.servlet._AnagTexAdapterSvlt; +import it.acxent.tex.lav.LavPezza; +import it.acxent.tex.lav.LavPezzaCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/lav/LavPezza.abl"}) +public class LavPezzaSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = -3363295810121263153L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTipiDocumento", new TipoDocumento(apFull).findByTipologiaClienteFornitoreAFT(0L, "C", 0L, -1L)); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new LavPezza(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new LavPezzaCR(getApFull(req)); + } + + protected String getBeanPageName(HttpServletRequest req) { + return "lavPezzaCli"; + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Users theUser = (Users)getLoginUser(req); + if (theUser.getId_userProfile() != 10L) { + super.search(req, res); + } else if (theUser.getId_clifor() > 0L) { + req.setAttribute("id_clifor", String.valueOf(theUser.getId_clifor())); + super.search(req, res); + } else { + sendGrantMessage(req, "Attenzione!! Non è stato impostato il cliente all'utente " + theUser.getLogin()); + callJsp(req, res); + } + } + + public void _dettaglioDisposizione(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + RigaDocumento bean = null; + String l_codicePezza = getRequestParameter(req, "codicePezza"); + LavPezza pezza = new LavPezza(apFull); + ResParm rp = new ResParm(true); + bean = new RigaDocumento(apFull); + bean.findByCodicePezza(l_codicePezza); + if (bean.getDBState() == 1) { + sendHtmlMsgResponse(req, res, bean.getDocumento().getClifor().getCognomeNome() + " " + bean.getDocumento().getClifor().getCognomeNome() + " " + bean.getDocumento().getRiferimento()); + } else { + sendHtmlMsgResponse(req, res, "Pezza NON Trovata"); + } + } + + protected int getPageRow(HttpServletRequest req) { + return 100; + } + + public void _printDoc(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Users theUser = (Users)getLoginUser(req); + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(apFull); + bean.findByPrimaryKey(l_id); + if (bean.getId_documento() > 0L) { + if (theUser.getId_userProfile() != 10L || (theUser.getId_userProfile() == 10L && theUser.getId_clifor() == bean.getId_clifor())) { + DocumentoCR CR = new DocumentoCR(); + fillObject(req, CR); + CR.setId_documentoS(l_id); + sendPdf(res, bean.creaDocumentoPdf(CR, false), "Doc " + bean.getNumeroDocumentoPdf() + DBAdapter.getDayTimeTimestamp()); + } else { + sendHtmlMsgResponse(req, res, "Attenzione!! Non hai i permessi per visualizzare questo documento!!"); + } + } else { + sendHtmlMsgResponse(req, res, "Attenzione!! Documento non trovato!!"); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/servlet/LavTessituraSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/servlet/LavTessituraSvlt.java new file mode 100644 index 00000000..5011610e --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/servlet/LavTessituraSvlt.java @@ -0,0 +1,181 @@ +package it.acxent.tex.lav.servlet; + +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoCR; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.RigaDocumentoCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.tex.anag.Telaio; +import it.acxent.tex.anag.servlet._AnagTexAdapterSvlt; +import it.acxent.tex.lav.LavPezza; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/lav/LavTessitura.abl"}) +public class LavTessituraSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = -3363295810121263153L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Documento bean = (Documento)beanA; + RigaDocumentoCR CRRD = new RigaDocumentoCR(apFull); + fillObject(req, CRRD); + req.setAttribute("CRRD", CRRD); + req.setAttribute("listaRigheDocumento", bean.findRigheDocumento(CRRD, 0, 0, false)); + req.setAttribute("listaTelaio", new Telaio(apFull).findAll()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTelaio", new Telaio(apFull).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new Documento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new DocumentoCR(getApFull(req)); + } + + protected String getBeanPageName(HttpServletRequest req) { + return "lavTessituraStart"; + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + DocumentoCR CR = new DocumentoCR(getApFull(req)); + req.setAttribute("flgTipologia", Integer.valueOf(200)); + super.search(req, res); + } + + public void _annullaStatoLavorazione(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id = 0L; + RigaDocumento bean = null; + l_id = getRequestLongParameter(req, "id_rigaDocumento"); + ResParm rp = new ResParm(true); + bean = new RigaDocumento(apFull); + bean.findByPrimaryKey(l_id); + if (bean.getId_rigaDocumento() > 0L && ( + bean.getFlgStatoLavorazioneRiga() == 20L || + bean.getFlgStatoLavorazioneRiga() == 10L)) { + bean.setFlgStatoLavorazioneRiga(0L); + bean.setId_telaio(0L); + bean.save(); + } + showBean(req, res); + } + + public void _impostaTelaio(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + long id_telaioR = getRequestLongParameter(req, "id_telaioR"); + long colpoInizialeR = getRequestLongParameter(req, "colpoInizialeR"); + bean = new Documento(apFull); + try { + bean.findByPrimaryKey(l_id); + if (bean.getId_documento() > 0L) { + ResParm rp = new ResParm(); + if (rp.getStatus()) { + sendMessage(req, "Telaio impostato correttamente"); + } else { + sendMessage(req, rp.getMsg()); + } + } else { + sendMessage(req, "Errore! Documento non valido"); + } + } catch (Exception e) { + handleDebug("Impossibile Salvare"); + handleDebug(e); + } + search(req, res); + } + + public void _impostaColpiFinali(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + long colpiFinaliR = getRequestLongParameter(req, "colpoFinaleR"); + bean = new Documento(apFull); + try { + bean.findByPrimaryKey(l_id); + ResParm rp = new ResParm(); + if (!rp.getStatus()) + sendMessage(req, rp.getMsg()); + } catch (Exception e) { + handleDebug("Impossibile Salvare"); + handleDebug(e); + } + search(req, res); + } + + public void _trovaColpiIniziali(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id = 0L; + Telaio bean = null; + l_id = getRequestLongParameter(req, "id_telaio"); + bean = new Telaio(apFull); + try { + bean.findByPrimaryKey(l_id); + sendHtmlMsgResponse(req, res, String.valueOf(bean.findColpiIniziali())); + } catch (Exception e) { + sendHtmlMsgResponse(req, res, " "); + } + } + + public void _updateLTSField(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_rigaDocumento = getRequestLongParameter(req, "id_rigaDocumento"); + RigaDocumento bean = new RigaDocumento(apFull); + bean.findByPrimaryKey(l_id_rigaDocumento); + ResParm rp = new ResParm(); + if (bean.getId_rigaDocumento() > 0L) { + String fieldName = getRequestParameter(req, "fieldName"); + String value = getRequestParameter(req, "value"); + rp = bean.updateFields(fieldName, value); + } else { + rp.setStatus(false); + rp.setMsg("Table desc non trovata!!!"); + } + if (getAct(req).endsWith("refresh")) { + if (rp.getStatus()) { + sendMessage(req, "Campo aggiornato correttamente. " + rp.getMsg()); + } else { + sendMessage(req, "Errore!! " + rp.getMsg()); + } + req.setAttribute("id_documento", Long.valueOf(bean.getId_documento())); + showBean(req, res); + } else if (rp.getStatus()) { + sendHtmlMsgResponse(req, res, "Campo aggiornato correttamente."); + } else { + sendHtmlMsgResponse(req, res, "Errore!! " + rp.getMsg()); + } + } + + public void _dettaglioPezze(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id = 0L; + Documento bean = null; + l_id = getRequestLongParameter(req, "id_documento"); + LavPezza pezza = new LavPezza(apFull); + ResParm rp = new ResParm(true); + bean = new Documento(apFull); + if (getLoginUser(req).getId_userProfile() == 10L) { + setJspPageRelative("lavPezzeViewCli.jsp", req); + } else { + setJspPageRelative("lavPezzeView.jsp", req); + } + bean.findByPrimaryKey(l_id); + req.setAttribute("bean", bean); + req.setAttribute("listaPezze", pezza.findByDocumento(l_id)); + callJsp(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/servlet/RecordPezzaSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/servlet/RecordPezzaSvlt.java new file mode 100644 index 00000000..9f84ca67 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/lav/servlet/RecordPezzaSvlt.java @@ -0,0 +1,181 @@ +package it.acxent.tex.lav.servlet; + +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.tex.anag.Telaio; +import it.acxent.tex.anag.servlet._AnagTexAdapterSvlt; +import it.acxent.tex.lav.LavPezza; +import it.acxent.tex.lav.LavPezzaCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/lav/RecordPezza.abl"}) +public class RecordPezzaSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = -3363295810121263153L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + req.setAttribute("listaTelaio", new Telaio(apFull).findAll()); + } + + protected DBAdapter getBean(HttpServletRequest req) { + return new LavPezza(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new LavPezzaCR(getApFull(req)); + } + + protected String getBeanPageName(HttpServletRequest req) { + return "lavPezza"; + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + LavPezza bean = new LavPezza(getApFull(req)); + fillObject(req, bean); + System.out.println(getRequestDoubleParameter(req, "mtPezza")); + req.setAttribute("bean", bean); + callJsp(req, res); + } + + public void _step1(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + RigaDocumento bean = null; + String l_codicePezza = getRequestParameter(req, "codicePezza"); + LavPezza pezza = new LavPezza(apFull); + ResParm rp = new ResParm(true); + bean = new RigaDocumento(apFull); + bean.findByCodicePezza(l_codicePezza); + if (bean.getDBState() == 1) { + req.setAttribute("step", "2"); + req.setAttribute("mtPezza", getNf().format(bean.getMetriStacchi())); + req.setAttribute("currentFocus", "mtPezza"); + } else { + req.setAttribute("step", "1"); + req.setAttribute("codicePezza", ""); + sendMessage(req, "ERRORE! pezza " + l_codicePezza + " non trovata"); + } + search(req, res); + } + + public void _dettaglioDisposizione(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + RigaDocumento bean = null; + String l_codicePezza = getRequestParameter(req, "codicePezza"); + LavPezza pezza = new LavPezza(apFull); + ResParm rp = new ResParm(true); + bean = new RigaDocumento(apFull); + bean.findByCodicePezza(l_codicePezza); + if (bean.getDBState() == 1) { + sendHtmlMsgResponse(req, res, bean.getDocumento().getClifor().getCognomeNome() + " " + bean.getDocumento().getClifor().getCognomeNome() + " " + bean.getDocumento().getRiferimento()); + } else { + sendHtmlMsgResponse(req, res, "Pezza NON Trovata"); + } + } + + protected void callJsp(HttpServletRequest req, HttpServletResponse res) { + super.callJsp(req, res); + } + + public void _aggiungiPezza(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + RigaDocumento bean = null; + String l_codicePezza = getRequestParameter(req, "codicePezza"); + long l_numColpi = getRequestLongParameter(req, "numColpi"); + double l_mtPezza = getRequestDoubleParameter(req, "mtPezza"); + String l_codicePancale = getRequestParameter(req, "codicePancale"); + LavPezza pezza = new LavPezza(apFull); + ResParm rp = new ResParm(true); + bean = new RigaDocumento(apFull); + bean.findByCodicePezza(l_codicePezza); + if (bean.getDBState() == 1) { + pezza = new LavPezza(apFull); + pezza.setId_rigaDocumento(bean.getId_rigaDocumento()); + pezza.setCodicePezza(l_codicePezza); + pezza.setMtPezza(l_mtPezza); + pezza.setNumColpi(l_numColpi); + pezza.setCodicePancale(l_codicePancale); + pezza.setId_clifor(bean.getDocumento().getId_clifor()); + rp = pezza.save(); + if (rp.getStatus()) { + sendMessage(req, "Pezza " + l_codicePezza + " inserita per Mt. " + pezza.getMtPezza() + " su Tela " + + bean.getDocumento().getRiferimento() + " di " + bean.getDocumento().getClifor().getCognomeNome()); + } else { + sendMessage(req, "ERRORE! pezza " + l_codicePezza + rp.getMsg()); + req.setAttribute("bean", pezza); + } + } else { + sendMessage(req, "ERRORE! pezza " + l_codicePezza + " non trovata"); + } + search(req, res); + } + + public void _step2(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + RigaDocumento bean = null; + String l_codicePezza = getRequestParameter(req, "codicePezza"); + long l_numColpi = getRequestLongParameter(req, "numColpi"); + double l_mtPezza = getRequestDoubleParameter(req, "mtPezza"); + LavPezza pezza = new LavPezza(apFull); + ResParm rp = new ResParm(true); + bean = new RigaDocumento(apFull); + bean.findByCodicePezza(l_codicePezza); + if (bean.getDBState() == 1) { + req.setAttribute("step", "3"); + } else { + req.setAttribute("step", "1"); + req.setAttribute("codicePezza", ""); + sendMessage(req, "ERRORE! pezza " + l_codicePezza + " non trovata"); + } + search(req, res); + } + + public void _step3(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + RigaDocumento bean = null; + String l_codicePezza = getRequestParameter(req, "codicePezza"); + long l_numColpi = getRequestLongParameter(req, "numColpi"); + double l_mtPezza = getRequestDoubleParameter(req, "mtPezza"); + String l_codicePancale = getRequestParameter(req, "codicePancale"); + LavPezza pezza = new LavPezza(apFull); + ResParm rp = new ResParm(true); + bean = new RigaDocumento(apFull); + bean.findByCodicePezza(l_codicePezza); + if (bean.getDBState() == 1) { + pezza = new LavPezza(apFull); + pezza.setId_rigaDocumento(bean.getId_rigaDocumento()); + pezza.setCodicePezza(l_codicePezza); + pezza.setMtPezza(l_mtPezza); + pezza.setNumColpi(l_numColpi); + pezza.setCodicePancale(DBAdapter.zeroLeft(l_codicePancale, 2)); + pezza.setId_clifor(bean.getDocumento().getId_clifor()); + rp = pezza.save(); + if (rp.getStatus()) { + sendMessage(req, "Pezza " + l_codicePezza + " inserita per Mt. " + pezza.getMtPezza() + " su Tela " + + bean.getDocumento().getRiferimento() + " di " + bean.getDocumento().getClifor().getCognomeNome()); + req.setAttribute("step", "1"); + req.setAttribute("codicePezza", ""); + } else if (rp.getMsg().indexOf("IDX_LAV_PEZZA_1") > 0) { + req.setAttribute("step", "1"); + req.setAttribute("codicePezza", ""); + sendMessage(req, "ERRORE! pezza " + l_codicePezza + " gia' registrata"); + } else { + req.setAttribute("step", "1"); + req.setAttribute("codicePezza", ""); + sendMessage(req, "ERRORE! pezza " + l_codicePezza + rp.getMsg()); + } + } else { + req.setAttribute("step", "1"); + req.setAttribute("codicePezza", ""); + sendMessage(req, "ERRORE! pezza " + l_codicePezza + " non trovata"); + } + search(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/servlet/DaProdurreSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/servlet/DaProdurreSvlt.java new file mode 100644 index 00000000..0d1e2d08 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/tex/servlet/DaProdurreSvlt.java @@ -0,0 +1,35 @@ +package it.acxent.tex.servlet; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.tex.anag.servlet._AnagTexAdapterSvlt; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/tessuto/DaProdurre.abl"}) +public class DaProdurreSvlt extends _AnagTexAdapterSvlt { + private static final long serialVersionUID = -3363295810121263153L; + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return null; + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return null; + } + + protected String getBeanPageName(HttpServletRequest req) { + return "daProdurre"; + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + callJsp(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/Promozione.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/Promozione.java new file mode 100644 index 00000000..9354f5e1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/Promozione.java @@ -0,0 +1,290 @@ +package it.acxent.www; + +import it.acxent.anag.Users; +import it.acxent.cart.Cart; +import it.acxent.cart.CartItem; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.util.Enumeration; +import java.util.Locale; + +public class Promozione extends _WwwAdapter implements Serializable { + public static long PROMOZIONE_VALIDA = 0L; + + public static long PROMOZIONE_SCADUTA = 1L; + + public static long PROMOZIONE_NON_VALIDA = 3L; + + public static long PROMOZIONE_UTENTE_NULL = 2L; + + private long flgUtilizzoPerUtente; + + private String codicePromozione; + + private Date dataInizio; + + private Date dataFine; + + private long percSconto; + + private String descrizione; + + private Date dataUtilizzoPromozione; + + private long numUtilizziMax; + + private long numUtilizzi; + + private long id_promozione; + + private long flgInvioML; + + private long flgArticolo; + + public Promozione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Promozione() {} + + public void setId_promozione(long newId_promozione) { + this.id_promozione = newId_promozione; + } + + public void setDataInizio(Date newDataInizio) { + this.dataInizio = newDataInizio; + } + + public void setDataFine(Date newDataFine) { + this.dataFine = newDataFine; + } + + public void setPercSconto(long newPercSconto) { + this.percSconto = newPercSconto; + } + + public long getId_promozione() { + return this.id_promozione; + } + + public Date getDataInizio() { + return this.dataInizio; + } + + public Date getDataFine() { + return this.dataFine; + } + + public long getPercSconto() { + return this.percSconto; + } + + public long isValid(Users l_users) { + if (getId_promozione() == 0L) + return PROMOZIONE_NON_VALIDA; + if (getFlgUtilizzoPerUtente() == 0L) { + if (getNumUtilizziMax() > 0L && getNumUtilizzi() >= getNumUtilizziMax()) + return PROMOZIONE_SCADUTA; + return isDateValid() ? PROMOZIONE_VALIDA : PROMOZIONE_SCADUTA; + } + if (getNumUtilizziMax() == 0L) + return isDateValid() ? PROMOZIONE_VALIDA : PROMOZIONE_SCADUTA; + if (isDateValid()) { + if (getNumUtilizziMax() == 0L) + return PROMOZIONE_VALIDA; + if (l_users == null || l_users.getId_users() == 0L) + return PROMOZIONE_UTENTE_NULL; + PromozioneUser po = new PromozioneUser(getApFull()); + long numUtilizziUtente = po.getNumutilizziByUserPromozione(l_users.getId_users(), getId_promozione()); + if (numUtilizziUtente >= getNumUtilizziMax()) + return PROMOZIONE_SCADUTA; + return PROMOZIONE_VALIDA; + } + return PROMOZIONE_SCADUTA; + } + + public long isValid(Users l_users, Cart cart) { + if (getFlgArticolo() == 0L) + return isValid(l_users); + boolean stepPromoArticolo = false; + Enumeration enu = cart.getItems(); + while (enu.hasMoreElements()) { + CartItem ci = enu.nextElement(); + if (ci.getCartObject().getCodPromo().equals(getCodicePromozione())) + stepPromoArticolo = true; + } + if (stepPromoArticolo) + return isValid(l_users); + return PROMOZIONE_NON_VALIDA; + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(PromozioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from PROMOZIONE AS A"; + String s_Sql_Order = " order by A.dataInizio desc, A.dataFine desc"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByCodicePromozione(String l_codicePromozione) { + String s_Sql_Find = "select A.* from PROMOZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codicePromozione='" + l_codicePromozione + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getCodicePromozione() { + return (this.codicePromozione == null) ? "" : this.codicePromozione; + } + + public void setCodicePromozione(String codicePromozione) { + this.codicePromozione = codicePromozione; + } + + public boolean useDescLangTables() { + return true; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public ResParm save() { + setDescrizione(getDescrizione(Locale.ITALIAN.getLanguage())); + return super.save(); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public static final synchronized ResParm addUtilizzo(Promozione bean, long l_id_user, long l_id_documento) { + if (bean.getId_promozione() > 0L) { + bean.setNumUtilizzi(bean.getNumUtilizzi() + 1L); + bean.setDataUtilizzoPromozione(getToday()); + ResParm rp = bean.save(); + if (rp.getStatus()) { + PromozioneUser pu = new PromozioneUser(bean.getApFull()); + pu.setId_users(l_id_user); + pu.setId_documento(l_id_documento); + pu.setId_promozione(bean.getId_promozione()); + rp = pu.save(); + } + if (rp.getStatus()) + return new ResParm(true, "Promozione aggiornata!"); + return rp; + } + return new ResParm(false, "Promozione Non Valida"); + } + + public void setDataUtilizzoPromozione(Date dataUtilizzoPromozione) { + this.dataUtilizzoPromozione = dataUtilizzoPromozione; + } + + public long getNumUtilizziMax() { + return this.numUtilizziMax; + } + + public void setNumUtilizziMax(long numUtilizziMax) { + this.numUtilizziMax = numUtilizziMax; + } + + public long getNumUtilizzi() { + return this.numUtilizzi; + } + + public void setNumUtilizzi(long numUtilizzi) { + this.numUtilizzi = numUtilizzi; + } + + public long getFlgUtilizzoPerUtente() { + return this.flgUtilizzoPerUtente; + } + + public void setFlgUtilizzoPerUtente(long flgUtilizzoPerUtente) { + this.flgUtilizzoPerUtente = flgUtilizzoPerUtente; + } + + public Date getDataUtilizzoPromozione() { + return this.dataUtilizzoPromozione; + } + + public String getDescrizioneCompleta() { + if (getId_promozione() == 0L) + return ""; + return getDescrizione() + " codice: " + getDescrizione() + " Sconto: " + getCodicePromozione() + "%"; + } + + public String getDescrizioneCompleta(String lang) { + if (getId_promozione() == 0L) + return ""; + return getDescrizione() + " " + getDescrizione() + ": " + translate("codice", lang) + " " + getCodicePromozione() + ": " + translate("Sconto", lang) + "%"; + } + + private boolean isDateValid() { + Date today = getToday(); + if (this.dataInizio == null && this.dataFine == null) + return true; + if (this.dataInizio != null && this.dataFine == null) { + if (getDateDiff(this.dataInizio, today) >= 0L) + return true; + return false; + } + if (this.dataInizio == null && this.dataFine != null) { + if (getDateDiff(today, this.dataFine) >= 0L) + return true; + return false; + } + if (getDateDiff(this.dataInizio, today) >= 0L && getDateDiff(today, this.dataFine) >= 0L) + return true; + return false; + } + + public long getFlgInvioML() { + return this.flgInvioML; + } + + public void setFlgInvioML(long flgInvioML) { + this.flgInvioML = flgInvioML; + } + + public long getFlgArticolo() { + return this.flgArticolo; + } + + public void setFlgArticolo(long flgArticolo) { + this.flgArticolo = flgArticolo; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/PromozioneCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/PromozioneCR.java new file mode 100644 index 00000000..4b4ec022 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/PromozioneCR.java @@ -0,0 +1,83 @@ +package it.acxent.www; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import java.sql.Date; + +public class PromozioneCR extends CRAdapter { + private long id_promozione; + + private String descrizione; + + private Date dataInizio; + + private Date dataFine; + + private long percSconto; + + private Date dataDa; + + private Date dataA; + + public PromozioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public PromozioneCR() {} + + public void setId_promozione(long newId_promozione) { + this.id_promozione = newId_promozione; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setDataInizio(Date newDataInizio) { + this.dataInizio = newDataInizio; + } + + public void setDataFine(Date newDataFine) { + this.dataFine = newDataFine; + } + + public void setPercSconto(long newPercSconto) { + this.percSconto = newPercSconto; + } + + public long getId_promozione() { + return this.id_promozione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public Date getDataInizio() { + return this.dataInizio; + } + + public Date getDataFine() { + return this.dataFine; + } + + public long getPercSconto() { + return this.percSconto; + } + + public Date getDataDa() { + return this.dataDa; + } + + public void setDataDa(Date dataDa) { + this.dataDa = dataDa; + } + + public Date getDataA() { + return this.dataA; + } + + public void setDataA(Date dataA) { + this.dataA = dataA; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/PromozioneUser.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/PromozioneUser.java new file mode 100644 index 00000000..605156ae --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/PromozioneUser.java @@ -0,0 +1,160 @@ +package it.acxent.www; + +import it.acxent.anag.Users; +import it.acxent.contab.Documento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class PromozioneUser extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1570012255698L; + + private long id_promozioneUser; + + private long id_promozione; + + private long id_users; + + private long id_documento; + + private Promozione promozione; + + private Users users; + + private Documento documento; + + public PromozioneUser(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public PromozioneUser() {} + + public void setId_promozioneUser(long newId_promozioneUser) { + this.id_promozioneUser = newId_promozioneUser; + } + + public void setId_promozione(long newId_promozione) { + this.id_promozione = newId_promozione; + setPromozione(null); + } + + public void setId_users(long newId_users) { + this.id_users = newId_users; + setUsers(null); + } + + public void setId_documento(long newId_documento) { + this.id_documento = newId_documento; + setDocumento(null); + } + + public long getId_promozioneUser() { + return this.id_promozioneUser; + } + + public long getId_promozione() { + return this.id_promozione; + } + + public long getId_users() { + return this.id_users; + } + + public long getId_documento() { + return this.id_documento; + } + + public void setPromozione(Promozione newPromozione) { + this.promozione = newPromozione; + } + + public Promozione getPromozione() { + this.promozione = (Promozione)getSecondaryObject(this.promozione, Promozione.class, getId_promozione()); + return this.promozione; + } + + public void setUsers(Users newUsers) { + this.users = newUsers; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users()); + return this.users; + } + + public void setDocumento(Documento newDocumento) { + this.documento = newDocumento; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, getId_documento()); + return this.documento; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(PromozioneUserCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from PROMOZIONE_USER AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByPromozione(long l_id_promozione) { + String s_Sql_Find = "select A.* from PROMOZIONE_USER AS A inner join DOCUMENTO AS B ON A.id_documento=B.id_documento"; + String s_Sql_Order = " order by B.dataDocumento , B.progDocumento desc "; + WcString wc = new WcString(); + wc.addWc("A.id_promozione=" + l_id_promozione); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public long getNumutilizziByUserPromozione(long l_id_users, long l_id_promozione) { + String s_Sql_Find = "select COUNT(*) AS _count from PROMOZIONE_USER AS A "; + WcString wc = new WcString(); + wc.addWc("A.id_users=" + l_id_users); + wc.addWc("A.id_promozione=" + l_id_promozione); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return getCount(stmt, "_count"); + } catch (Exception e) { + handleDebug(e, 0); + return 0L; + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/PromozioneUserCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/PromozioneUserCR.java new file mode 100644 index 00000000..cd023be4 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/PromozioneUserCR.java @@ -0,0 +1,97 @@ +package it.acxent.www; + +import it.acxent.anag.Users; +import it.acxent.contab.Documento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; + +public class PromozioneUserCR extends CRAdapter { + private long id_promozioneUser; + + private long id_promozione; + + private long id_users; + + private long id_documento; + + private Promozione promozione; + + private Users users; + + private Documento documento; + + public PromozioneUserCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public PromozioneUserCR() {} + + public void setId_promozioneUser(long newId_promozioneUser) { + this.id_promozioneUser = newId_promozioneUser; + } + + public void setId_promozione(long newId_promozione) { + this.id_promozione = newId_promozione; + setPromozione(null); + } + + public void setId_users(long newId_users) { + this.id_users = newId_users; + setUsers(null); + } + + public void setId_documento(long newId_documento) { + this.id_documento = newId_documento; + setDocumento(null); + } + + public long getId_promozioneUser() { + return this.id_promozioneUser; + } + + public long getId_promozione() { + return this.id_promozione; + } + + public long getId_users() { + return this.id_users; + } + + public long getId_documento() { + return this.id_documento; + } + + public void setPromozione(Promozione newPromozione) { + this.promozione = newPromozione; + } + + public Promozione getPromozione() { + this.promozione = (Promozione)getSecondaryObject(this.promozione, Promozione.class, + + getId_promozione()); + return this.promozione; + } + + public void setUsers(Users newUsers) { + this.users = newUsers; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, + + getId_users()); + return this.users; + } + + public void setDocumento(Documento newDocumento) { + this.documento = newDocumento; + } + + public Documento getDocumento() { + this.documento = (Documento)getSecondaryObject(this.documento, Documento.class, + + getId_documento()); + return this.documento; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/Sitemap.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/Sitemap.java new file mode 100644 index 00000000..2b090a61 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/Sitemap.java @@ -0,0 +1,905 @@ +package it.acxent.www; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.art.Marca; +import it.acxent.art.MarcaCR; +import it.acxent.art.Tipo; +import it.acxent.art.TipoCR; +import it.acxent.cc.Attivita; +import it.acxent.common.StatusMsg; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.io.FileOutputStream; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.text.NumberFormat; +import java.util.HashSet; +import java.util.Locale; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +public class Sitemap extends DBAdapter implements Serializable { + private static final String PATH_DEFAULT_SITEMAP = "_sitemap/"; + + private static final String SITEMAP_LASTMOD_FORMAT_DATE = "yyyy-MM-dd'T'hh:mm'+01:00'"; + + public static final long TIPO_MAIN = 0L; + + public static final long TIPO_MARCHE = 1L; + + public static final long TIPO_TIPO = 2L; + + public static final long TIPO_ARTICOLI = 3L; + + public static final long TIPO_ALL_UNICO_FILE = 9L; + + public static final long TIPO_ALL_SITEMAP_FILE_MULTIPLI = 10L; + + private static final String XML_HTTP_XML_APACHE_ORG_XSLT_INDENT_AMOUNT = "{http://xml.apache.org/xslt}indent-amount"; + + private static final String XML_HTTP_WWW_GOOGLE_COM_SCHEMAS_SITEMAP_IMAGE_1_1 = "http://www.google.com/schemas/sitemap-image/1.1"; + + private static final String XML_XMLNS_IMAGE = "xmlns:image"; + + private static final String XML_HTTP_WWW_GOOGLE_COM_SCHEMAS_SITEMAP_MOBILE_1_0 = "http://www.google.com/schemas/sitemap-mobile/1.0"; + + private static final String XML_HTTP_WWW_SITEMAPS_ORG_SCHEMAS_SITEMAP_0_9_XMLNS = "http://www.sitemaps.org/schemas/sitemap/0.9"; + + private static final String XML_XMLNS = "xmlns"; + + private static final String XML_XMLNS_MOBILE = "xmlns:mobile"; + + private static final String XML_HTTP_WWW_SITEMAPS_ORG_SCHEMAS_SITEMAP_0_9_LOCATION = "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"; + + private static final String XML_XSI_SCHEMA_LOCATION = "xsi:schemaLocation"; + + private static final String XML_HTTP_WWW_W3_ORG_2001_XML_SCHEMA_INSTANCE = "http://www.w3.org/2001/XMLSchema-instance"; + + private static final String XML_XMLNS_XSI = "xmlns:xsi"; + + private static final String XML_URLSET = "urlset"; + + private static final String XML_SITEMAPINDEX = "sitemapindex"; + + private static final long serialVersionUID = 1670513552734L; + + private long id_sitemap; + + private String descrizione; + + private String loc; + + private long priority; + + private long flgChangefreq; + + private long flgAbilita; + + private String langSitemap; + + public static final String SITEMAP_C_F_WEEKLY = "weekly"; + + public static final String SITEMAP_C_F_DAILY = "daily"; + + public static final String SITEMAP_C_F_HOURLY = "hourly"; + + public static final String SITEMAP_C_F_ALWAYS = "always"; + + public static final String SITEMAP_C_F_YEARLY = "yearly"; + + public static final String SITEMAP_C_F_MONTHLY = "monthly"; + + public static final String SITEMAP_C_F_NEVER = "never"; + + public static final long SITEMAP_C_F_ALWAYS_VAL = 0L; + + public static final long SITEMAP_C_F_HOURLY_VAL = 1L; + + public static final long SITEMAP_C_F_DAILY_VAL = 2L; + + public static final long SITEMAP_C_F_WEEKLY_VAL = 3L; + + public static final long SITEMAP_C_F_MONTHLY_VAL = 4L; + + public static final long SITEMAP_C_F_YEARLY_VAL = 5L; + + public static final long SITEMAP_C_F_NEVER_VAL = 9L; + + public static final String SITEMAP_ELEMENT_CHANGEFREQ = "changefreq"; + + public static final String SITEMAP_ELEMENT_PRIORITY = "priority"; + + public static final String SITEMAP_ELEMENT_LOC = "loc"; + + public static final String SITEMAP_ELEMENT_URL = "url"; + + public static final String SITEMAP_ELEMENT_SITEMAP = "sitemap"; + + public static final String SITEMAP_ELEMENT_LASTMOD = "lastmod"; + + public Sitemap(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Sitemap() {} + + public static final String getSitemapType(long l_flgSitemapType) { + if (l_flgSitemapType == 9L) + return "Completa unico file"; + if (l_flgSitemapType == 3L) + return "Articolo"; + if (l_flgSitemapType == 0L) + return "Main"; + if (l_flgSitemapType == 1L) + return "Marche"; + if (l_flgSitemapType == 2L) + return "Tipo"; + if (l_flgSitemapType == 10L) + return "Completa con file elenco sitemap"; + return ""; + } + + public void setId_sitemap(long newId_sitemap) { + this.id_sitemap = newId_sitemap; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setLoc(String newLoc) { + this.loc = newLoc; + } + + public void setPriority(long newPriority) { + this.priority = newPriority; + } + + public void setFlgChangefreq(long newChangefreq) { + this.flgChangefreq = newChangefreq; + } + + public void setFlgAbilita(long newFlgAbilita) { + this.flgAbilita = newFlgAbilita; + } + + public long getId_sitemap() { + return this.id_sitemap; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getLoc() { + return (this.loc == null) ? "" : this.loc.trim(); + } + + public long getPriority() { + return this.priority; + } + + public static final String getChangefreq(long l_flgChangefreq) { + switch ((int)l_flgChangefreq) { + case 0: + return "always"; + case 2: + return "daily"; + case 1: + return "hourly"; + case 9: + return "never"; + case 3: + return "weekly"; + case 5: + return "yearly"; + case 4: + return "monthly"; + } + return ""; + } + + public String getChangefreq() { + return getChangefreq(getFlgChangefreq()); + } + + public long getFlgChangefreq() { + return this.flgChangefreq; + } + + public long getFlgAbilita() { + return this.flgAbilita; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(SitemapCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from SITEMAP AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getDescrizione().isEmpty()) + wc.addWc("A.descrizione like '%" + CR.getDescrizione() + "%'"); + if (!CR.getLangSitemap().isEmpty()) + wc.addWc("A.langSitemap = '" + CR.getLangSitemap() + "'"); + if (CR.getFlgAbilita() == 0L) { + wc.addWc("(A.flgAbilita is null or A.flgAbilita=0)"); + } else if (CR.getFlgAbilita() > 0L) { + wc.addWc("A.flgAbilita = " + CR.getFlgAbilita()); + } + if (CR.getFlgChangefreq() == 0L) { + wc.addWc("(A.flgChangefreq is null or A.flgChangefreq=0)"); + } else if (CR.getFlgChangefreq() > 0L) { + wc.addWc("A.flgChangefreq = " + CR.getFlgChangefreq()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm creaFileXmlSitemap(ArticoloCR CR) { + SitemapCR SCR = new SitemapCR(); + SCR.setACR(CR); + SCR.setSitemapFilename(CR.getSitemapFilename()); + SCR.setFlgSitemapType(3L); + return creaFileXmlSitemap(SCR, 0L); + } + + public ResParm creaFileXmlSitemapOld(ArticoloCR CR, long l_flgTipo) { + String TAG_THREAD_MSG = "CREA XML SITEMAP ARTICOLI " + CR.getLang(); + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "...inizio ..."); + int numRecord = 0; + ResParm rp = new ResParm(true); + String SITEMAP_PRIORITY_1 = "1"; + String sitemapfilename = CR.getSitemapFilename(); + String sitemapTmpFile = "sitemap_" + System.currentTimeMillis() + ".xml"; + String filenameTmp = getDocBase() + getDocBase() + getParm("PATH_TMP").getTesto(); + File xmlFileTmp = new File(filenameTmp); + new File(filenameTmp).delete(); + Element e = null; + CR.setFlgEscludiWeb(0L); + String site = getParm("P_WWW_ADDRESS").getTesto(); + String lang = CR.getLang(); + if (lang.isEmpty()) { + lang = "it"; + CR.setLang(lang); + } + NumberFormat nf2 = NumberFormat.getInstance(Locale.US); + nf2.setMaximumFractionDigits(2); + nf2.setMinimumFractionDigits(2); + String wwwSite = getWwwAddressParm(); + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + try { + DocumentBuilder db = dbf.newDocumentBuilder(); + Document dom = db.newDocument(); + Element rootElement = dom.createElement("urlset"); + rootElement.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); + rootElement.setAttribute("xsi:schemaLocation", "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"); + rootElement.setAttribute("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9"); + rootElement.setAttribute("xmlns:image", "http://www.google.com/schemas/sitemap-image/1.1"); + ArticoloCR CRLink = new ArticoloCR(); + CRLink.setLang(CR.getLang()); + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + Element urlEl = dom.createElement("url"); + e = dom.createElement("loc"); + e.setTextContent(attivita.getHomePage(lang)); + urlEl.appendChild(e); + e = dom.createElement("priority"); + e.setTextContent("1"); + urlEl.appendChild(e); + e = dom.createElement("changefreq"); + e.setTextContent("daily"); + urlEl.appendChild(e); + rootElement.appendChild(urlEl); + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, " sitemap categorie ....."); + Tipo tipo = new Tipo(getApFull()); + TipoCR CRt = new TipoCR(); + ArticoloCR CRAvuoto = new ArticoloCR(getApFull()); + CRt.setFlgNascondi(0L); + CRt.setFlgEscludiWeb(0L); + Vectumerator vecT0 = tipo.findFigli(CRt, 0, 0, false); + while (vecT0.hasMoreElements()) { + Tipo row0 = (Tipo)vecT0.nextElement(); + Element element = dom.createElement("url"); + e = dom.createElement("loc"); + e.setTextContent(site + site); + element.appendChild(e); + e = dom.createElement("priority"); + e.setTextContent("1"); + element.appendChild(e); + e = dom.createElement("changefreq"); + e.setTextContent("daily"); + element.appendChild(e); + rootElement.appendChild(element); + if (!row0.isFoglia()) { + Vectumerator vecT1 = row0.findFigli(CRt, 0, 0, false); + while (vecT1.hasMoreElements()) { + Tipo row1 = (Tipo)vecT1.nextElement(); + element = dom.createElement("url"); + e = dom.createElement("loc"); + e.setTextContent(site + site); + element.appendChild(e); + e = dom.createElement("priority"); + e.setTextContent("1"); + element.appendChild(e); + e = dom.createElement("changefreq"); + e.setTextContent("daily"); + element.appendChild(e); + rootElement.appendChild(element); + if (!row1.isFoglia()) { + Vectumerator vecT2 = row1.findFigli(CRt, 0, 0, false); + while (vecT2.hasMoreElements()) { + Tipo row2 = (Tipo)vecT2.nextElement(); + element = dom.createElement("url"); + e = dom.createElement("loc"); + e.setTextContent(site + site); + element.appendChild(e); + e = dom.createElement("priority"); + e.setTextContent("1"); + element.appendChild(e); + e = dom.createElement("changefreq"); + e.setTextContent("daily"); + element.appendChild(e); + rootElement.appendChild(element); + if (!row2.isFoglia()) { + Vectumerator vecT3 = row2.findFigli(CRt, 0, 0, false); + while (vecT3.hasMoreElements()) { + Tipo row3 = (Tipo)vecT3.nextElement(); + element = dom.createElement("url"); + e = dom.createElement("loc"); + e.setTextContent(site + site); + element.appendChild(e); + e = dom.createElement("priority"); + e.setTextContent("1"); + element.appendChild(e); + e = dom.createElement("changefreq"); + e.setTextContent("daily"); + element.appendChild(e); + rootElement.appendChild(element); + } + } + } + } + } + } + } + Marca marca = new Marca(getApFull()); + MarcaCR CRmarca = new MarcaCR(getApFull()); + CRmarca.setFlgIncludiMainSitemap(1L); + Vectumerator vecM = marca.findByCR(CRmarca, 0, 0); + while (vecM.hasMoreElements()) { + Marca rowM = (Marca)vecM.nextElement(); + Element element = dom.createElement("url"); + e = dom.createElement("loc"); + e.setTextContent(site + site); + element.appendChild(e); + e = dom.createElement("priority"); + e.setTextContent(String.valueOf("1")); + element.appendChild(e); + e = dom.createElement("changefreq"); + e.setTextContent("daily"); + element.appendChild(e); + rootElement.appendChild(element); + } + SitemapCR CRSitemap = new SitemapCR(getApFull()); + CRSitemap.setFlgAbilita(1L); + CRSitemap.setLangSitemap(lang); + Vectumerator vecSm = findByCR(CRSitemap, 0, 0); + while (vecSm.hasMoreElements()) { + Sitemap row0 = (Sitemap)vecSm.nextElement(); + Element element = dom.createElement("url"); + e = dom.createElement("loc"); + e.setTextContent(site + site); + element.appendChild(e); + e = dom.createElement("priority"); + e.setTextContent(String.valueOf(row0.getPriorityReal())); + element.appendChild(e); + e = dom.createElement("daily"); + e.setTextContent(row0.getChangefreq()); + element.appendChild(e); + rootElement.appendChild(element); + } + Articolo bean = new Articolo(getApFull()); + Vectumerator vec = bean.findByCR(CR, 0, 0); + while (vec.hasMoreElements()) { + numRecord++; + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, " sitemap articoli " + numRecord + " su " + + vec.getTotNumberOfRecords()); + Articolo rowbean = (Articolo)vec.nextElement(); + Element element = dom.createElement("url"); + e = dom.createElement("loc"); + if (l_flgTipo == 1L) { + e.setTextContent(site + site); + } else { + e.setTextContent(site + site); + } + element.appendChild(e); + if (!rowbean.getSitemapPriorityReal().isEmpty()) { + e = dom.createElement("priority"); + e.setTextContent(rowbean.getSitemapPriorityReal()); + element.appendChild(e); + } + e = dom.createElement("changefreq"); + e.setTextContent("daily"); + element.appendChild(e); + rootElement.appendChild(element); + } + dom.appendChild(rootElement); + Transformer tr = TransformerFactory.newInstance().newTransformer(); + tr.setOutputProperty("indent", "yes"); + tr.setOutputProperty("method", "xml"); + tr.setOutputProperty("encoding", "UTF-8"); + tr.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + tr.transform(new DOMSource(dom), new StreamResult(new FileOutputStream(filenameTmp))); + File xmlFile = new File(getDocBase() + getDocBase()); + if (xmlFile.exists()) { + String xmlOldFile = getDocBase() + getDocBase() + getParm("PATH_TMP").getTesto(); + xmlFile.renameTo(new File(xmlOldFile)); + } + xmlFile = new File(getDocBase() + getDocBase()); + xmlFileTmp.renameTo(xmlFile); + rp.setStatus(true); + rp.setReturnObj(sitemapfilename); + rp.setMsg("Generazione sitemap " + sitemapfilename + " avvenuta con successo.
Numero Record: " + numRecord); + } catch (ParserConfigurationException|javax.xml.transform.TransformerFactoryConfigurationError|java.io.FileNotFoundException|javax.xml.transform.TransformerException pce) { + rp.setStatus(false); + rp.setMsg("BuildXml: Error trying to instantiate DocumentBuilder " + String.valueOf(pce)); + System.out.println(rp.getMsg()); + } + StatusMsg.deleteMsgByTag(getApFull(), TAG_THREAD_MSG); + return rp; + } + + public String getLangSitemap() { + return (this.langSitemap == null) ? "it" : this.langSitemap.trim(); + } + + public void setLangSitemap(String langSitemap) { + this.langSitemap = langSitemap; + } + + private ResParm creaFileXmlSitemapAuto(SitemapCR CR, long l_flgPersonalizzazione) { + String lang = CR.getLangSitemap(); + if (lang == null || lang.isEmpty()) + lang = "it"; + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + String TAG_THREAD_MSG = "CREA XML SITEMAP AUTO "; + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "... creazione delle varie sitemap " + lang + " ..."); + ResParm rp = new ResParm(true); + String sitemapfilenameSitemapAuto = getSitemapPath() + "sitemap-auto-" + getSitemapPath() + ".xml"; + CR.setSitemapFilename(""); + HashSet hsSitemaps = new HashSet<>(); + CR.setFlgSitemapType(0L); + rp = creaFileXmlSitemap(CR, l_flgPersonalizzazione); + if (rp.getStatus()) + hsSitemaps.add(CR.getSitemapFilename()); + if (rp.getStatus()) { + CR.setSitemapFilename(""); + CR.setFlgSitemapType(1L); + rp = creaFileXmlSitemap(CR, l_flgPersonalizzazione); + if (rp.getStatus()) + hsSitemaps.add(CR.getSitemapFilename()); + } + if (rp.getStatus()) { + CR.setSitemapFilename(""); + CR.setFlgSitemapType(2L); + rp = creaFileXmlSitemap(CR, l_flgPersonalizzazione); + if (rp.getStatus()) + hsSitemaps.add(CR.getSitemapFilename()); + } + Tipo tipo = new Tipo(getApFull()); + Vectumerator vecTipo = tipo.findTipoSitemap(); + if (vecTipo.getTotNumberOfRecords() == 0) { + CR.setSitemapFilename(""); + CR.setFlgSitemapType(3L); + rp = creaFileXmlSitemap(CR, l_flgPersonalizzazione); + if (rp.getStatus()) + hsSitemaps.add(CR.getSitemapFilename()); + } else { + ArticoloCR ACR = new ArticoloCR(getApFull()); + CR.setACR(ACR); + while (vecTipo.hasMoreElements()) { + Tipo rowTipo = (Tipo)vecTipo.nextElement(); + CR.setSitemapFilename(""); + ACR.setId_tipoSel(rowTipo.getId_tipo()); + CR.setFlgSitemapType(3L); + rp = creaFileXmlSitemap(CR, l_flgPersonalizzazione); + if (rp.getStatus()) + hsSitemaps.add(CR.getSitemapFilename()); + } + } + if (rp.getStatus()) { + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "CREAZIONE SITEMAP FINALE ELENCO SITEMAP " + lang + " ..."); + String sitemapTmpFile = "sitemap_" + System.currentTimeMillis() + ".xml"; + String filenameTmp = getDocBase() + getDocBase() + getParm("PATH_TMP").getTesto(); + File xmlFileTmp = new File(filenameTmp); + new File(filenameTmp).delete(); + Element e = null; + String site = getParm("P_WWW_ADDRESS").getTesto(); + NumberFormat nf2 = NumberFormat.getInstance(Locale.US); + nf2.setMaximumFractionDigits(2); + nf2.setMinimumFractionDigits(2); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm'+01:00'"); + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + try { + DocumentBuilder db = dbf.newDocumentBuilder(); + Document dom = db.newDocument(); + Element rootElement = dom.createElement("sitemapindex"); + rootElement.setAttribute("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9"); + for (String sitemap : hsSitemaps) { + Element urlEl = dom.createElement("sitemap"); + e = dom.createElement("loc"); + e.setTextContent(site + site + getSitemapPath()); + urlEl.appendChild(e); + e = dom.createElement("lastmod"); + e.setTextContent(sdf.format(getToday())); + urlEl.appendChild(e); + rootElement.appendChild(urlEl); + } + dom.appendChild(rootElement); + Transformer tr = TransformerFactory.newInstance().newTransformer(); + tr.setOutputProperty("indent", "yes"); + tr.setOutputProperty("method", "xml"); + tr.setOutputProperty("encoding", "UTF-8"); + tr.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + tr.transform(new DOMSource(dom), new StreamResult(new FileOutputStream(filenameTmp))); + File xmlFile = new File(getDocBase() + getDocBase()); + if (xmlFile.exists()) { + String xmlOldFile = getDocBase() + getDocBase() + getParm("PATH_TMP").getTesto(); + xmlFile.renameTo(new File(xmlOldFile)); + } + String fullXmlFileName = getDocBase() + getDocBase(); + DBAdapter.checkAndMakeDir(xmlFile.getParent()); + DBAdapter.moveFile(filenameTmp, fullXmlFileName); + rp.setStatus(true); + rp.setReturnObj(sitemapfilenameSitemapAuto); + rp.setMsg("Generazione sitemap " + sitemapfilenameSitemapAuto + " avvenuta con successo.
Numero sitemap create: " + + hsSitemaps.size()); + } catch (ParserConfigurationException|javax.xml.transform.TransformerFactoryConfigurationError|java.io.FileNotFoundException|javax.xml.transform.TransformerException pce) { + rp.setStatus(false); + rp.setMsg("creaFileXmlSitemapAuto: Error trying to instantiate DocumentBuilder " + String.valueOf(pce)); + System.out.println(rp.getMsg()); + } + } + StatusMsg.deleteMsgByTag(getApFull(), TAG_THREAD_MSG); + return rp; + } + + public ResParm creaFileXmlSitemap(SitemapCR CR) { + return creaFileXmlSitemap(CR, 0L); + } + + public ResParm creaFileXmlSitemap(SitemapCR CR, long l_flgPersonalizzazione) { + if (CR.getFlgSitemapType() == 10L) + return creaFileXmlSitemapAuto(CR, l_flgPersonalizzazione); + String lang = CR.getLangSitemap(); + if (lang == null || lang.isEmpty()) + lang = "it"; + boolean debug = true; + boolean isEmpty = false; + ArticoloCR CRLink = new ArticoloCR(); + CRLink.setLang(lang); + Attivita attivita = Attivita.getDefaultInstance(getApFull()); + String TAG_THREAD_MSG = "CREA XML SITEMAP "; + String sitemapfilename = CR.getSitemapFilename(); + if (CR.getFlgSitemapType() == 9L) { + TAG_THREAD_MSG = TAG_THREAD_MSG + " COMPLETA " + TAG_THREAD_MSG; + if (sitemapfilename.isEmpty()) { + sitemapfilename = "sitemapAll-" + lang + ".xml"; + } else if (sitemapfilename.endsWith("xml")) { + sitemapfilename.replace(".xml", "All-" + lang + ".xml"); + } else { + sitemapfilename = sitemapfilename + "All-" + sitemapfilename + ".xml"; + } + } else if (CR.getFlgSitemapType() == 3L) { + TAG_THREAD_MSG = TAG_THREAD_MSG + " ARTICOLI " + TAG_THREAD_MSG; + if (sitemapfilename.isEmpty()) + if (CR.getACR().getId_tipoSel() > 0L) { + if (CR.getACR().getTipoSel().getSitemapFileProdotti().isEmpty()) { + sitemapfilename = "sitemapArt_" + CR.getACR().getTipoSel().getDescrizione().replaceAll(" ", "_"); + } else { + sitemapfilename = "sitemapArt_" + CR.getACR().getTipoSel().getSitemapFileProdotti(); + } + sitemapfilename = sitemapfilename + "-" + sitemapfilename + ".xml"; + } else { + sitemapfilename = "sitemapArticoli-" + lang + ".xml"; + } + } else if (CR.getFlgSitemapType() == 0L) { + TAG_THREAD_MSG = TAG_THREAD_MSG + " MAIN " + TAG_THREAD_MSG; + if (sitemapfilename.isEmpty()) + sitemapfilename = "sitemapMain-" + lang + ".xml"; + } else if (CR.getFlgSitemapType() == 1L) { + TAG_THREAD_MSG = TAG_THREAD_MSG + " MARCHE " + TAG_THREAD_MSG; + if (sitemapfilename.isEmpty()) + sitemapfilename = "sitemapMarche-" + lang + ".xml"; + } else if (CR.getFlgSitemapType() == 2L) { + TAG_THREAD_MSG = TAG_THREAD_MSG + " TIPO " + TAG_THREAD_MSG; + if (sitemapfilename.isEmpty()) + sitemapfilename = "sitemapTipo-" + lang + ".xml"; + } else { + return new ResParm(false, "Errore! tipo " + CR.getFlgSitemapType() + " non riconosciuto"); + } + CR.setSitemapFilename(sitemapfilename); + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, "...inizio ..."); + int numRecord = 0; + ResParm rp = new ResParm(true); + String SITEMAP_PRIORITY_1 = "1.0"; + String sitemapTmpFile = "sitemap_" + System.currentTimeMillis() + ".xml"; + String filenameTmp = getDocBase() + getDocBase() + getParm("PATH_TMP").getTesto(); + File xmlFileTmp = new File(filenameTmp); + new File(filenameTmp).delete(); + Element e = null; + NumberFormat nf2 = NumberFormat.getInstance(Locale.US); + nf2.setMaximumFractionDigits(2); + nf2.setMinimumFractionDigits(2); + DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + try { + DocumentBuilder db = dbf.newDocumentBuilder(); + Document dom = db.newDocument(); + Element rootElement = dom.createElement("urlset"); + rootElement.setAttribute("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9"); + rootElement.setAttribute("xmlns:mobile", "http://www.google.com/schemas/sitemap-mobile/1.0"); + rootElement.setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); + rootElement.setAttribute("xsi:schemaLocation", "http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"); + rootElement.setAttribute("xmlns:image", "http://www.google.com/schemas/sitemap-image/1.1"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm'+01:00'"); + if (CR.getFlgSitemapType() == 9L || CR.getFlgSitemapType() == 0L) { + Element urlEl = dom.createElement("url"); + e = dom.createElement("loc"); + e.setTextContent(attivita.getHomePage(lang)); + urlEl.appendChild(e); + e = dom.createElement("lastmod"); + e.setTextContent(sdf.format(getToday())); + urlEl.appendChild(e); + e = dom.createElement("changefreq"); + e.setTextContent("daily"); + urlEl.appendChild(e); + e = dom.createElement("priority"); + e.setTextContent("1.0"); + urlEl.appendChild(e); + rootElement.appendChild(urlEl); + SitemapCR CRSitemap = new SitemapCR(getApFull()); + CRSitemap.setFlgAbilita(1L); + CRSitemap.setLangSitemap(lang); + Vectumerator vecSm = findByCR(CRSitemap, 0, 0); + if (vecSm.getTotNumberOfRecords() == 0) { + isEmpty = true; + } else { + while (vecSm.hasMoreElements()) { + Sitemap row0 = (Sitemap)vecSm.nextElement(); + urlEl = dom.createElement("url"); + e = dom.createElement("loc"); + e.setTextContent(getSite() + getSite()); + urlEl.appendChild(e); + e = dom.createElement("lastmod"); + e.setTextContent(sdf.format(row0.getLastUpdTmst())); + urlEl.appendChild(e); + e = dom.createElement("changefreq"); + e.setTextContent(row0.getChangefreq()); + urlEl.appendChild(e); + e = dom.createElement("priority"); + e.setTextContent(String.valueOf(row0.getPriorityReal())); + urlEl.appendChild(e); + rootElement.appendChild(urlEl); + } + } + } + if (CR.getFlgSitemapType() == 9L || CR.getFlgSitemapType() == 2L) { + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, " sitemap TIPO ....."); + Tipo tipo = new Tipo(getApFull()); + TipoCR CRt = new TipoCR(); + ArticoloCR CRAvuoto = new ArticoloCR(getApFull()); + CRAvuoto.setLang(lang); + CRt.setFlgNascondi(0L); + CRt.setFlgEscludiWeb(0L); + Vectumerator vecT0 = tipo.findFigli(CRt, 0, 0, false); + while (vecT0.hasMoreElements()) { + Tipo row0 = (Tipo)vecT0.nextElement(); + Element urlEl = dom.createElement("url"); + e = dom.createElement("loc"); + e.setTextContent(getSite() + getSite()); + urlEl.appendChild(e); + e = dom.createElement("lastmod"); + e.setTextContent(sdf.format(getToday())); + urlEl.appendChild(e); + e = dom.createElement("changefreq"); + e.setTextContent("daily"); + urlEl.appendChild(e); + e = dom.createElement("priority"); + e.setTextContent("1.0"); + urlEl.appendChild(e); + rootElement.appendChild(urlEl); + if (!row0.isFoglia()) { + Vectumerator vecT1 = row0.findFigli(CRt, 0, 0, false); + while (vecT1.hasMoreElements()) { + Tipo row1 = (Tipo)vecT1.nextElement(); + urlEl = dom.createElement("url"); + e = dom.createElement("loc"); + e.setTextContent(getSite() + getSite()); + urlEl.appendChild(e); + e = dom.createElement("lastmod"); + e.setTextContent(sdf.format(getToday())); + urlEl.appendChild(e); + e = dom.createElement("changefreq"); + e.setTextContent("daily"); + urlEl.appendChild(e); + e = dom.createElement("priority"); + e.setTextContent("1.0"); + urlEl.appendChild(e); + rootElement.appendChild(urlEl); + if (!row1.isFoglia()) { + Vectumerator vecT2 = row1.findFigli(CRt, 0, 0, false); + while (vecT2.hasMoreElements()) { + Tipo row2 = (Tipo)vecT2.nextElement(); + urlEl = dom.createElement("url"); + e = dom.createElement("loc"); + e.setTextContent(getSite() + getSite()); + urlEl.appendChild(e); + e = dom.createElement("lastmod"); + e.setTextContent(sdf.format(getToday())); + urlEl.appendChild(e); + e = dom.createElement("changefreq"); + e.setTextContent("daily"); + urlEl.appendChild(e); + e = dom.createElement("priority"); + e.setTextContent("1.0"); + urlEl.appendChild(e); + rootElement.appendChild(urlEl); + if (!row2.isFoglia()) { + Vectumerator vecT3 = row2.findFigli(CRt, 0, 0, false); + while (vecT3.hasMoreElements()) { + Tipo row3 = (Tipo)vecT3.nextElement(); + urlEl = dom.createElement("url"); + e = dom.createElement("loc"); + e.setTextContent(getSite() + getSite()); + urlEl.appendChild(e); + e = dom.createElement("lastmod"); + e.setTextContent(sdf.format(getToday())); + urlEl.appendChild(e); + e = dom.createElement("changefreq"); + e.setTextContent("daily"); + urlEl.appendChild(e); + e = dom.createElement("priority"); + e.setTextContent("1.0"); + urlEl.appendChild(e); + rootElement.appendChild(urlEl); + } + } + } + } + } + } + } + } + if (CR.getFlgSitemapType() == 9L || CR.getFlgSitemapType() == 1L) { + Marca marca = new Marca(getApFull()); + MarcaCR CRmarca = new MarcaCR(getApFull()); + CRmarca.setFlgIncludiMainSitemap(1L); + Vectumerator vecM = marca.findByCR(CRmarca, 0, 0); + while (vecM.hasMoreElements()) { + Marca rowM = (Marca)vecM.nextElement(); + Element urlEl = dom.createElement("url"); + e = dom.createElement("loc"); + e.setTextContent(getSite() + getSite()); + urlEl.appendChild(e); + e = dom.createElement("lastmod"); + e.setTextContent(sdf.format(getToday())); + urlEl.appendChild(e); + e = dom.createElement("changefreq"); + e.setTextContent("daily"); + urlEl.appendChild(e); + e = dom.createElement("priority"); + e.setTextContent(String.valueOf("1.0")); + urlEl.appendChild(e); + rootElement.appendChild(urlEl); + } + } + if (CR.getFlgSitemapType() == 9L || CR.getFlgSitemapType() == 3L) { + Articolo bean = new Articolo(getApFull()); + ArticoloCR ACR = CR.getACR(); + ACR.setFlgEscludiWeb(0L); + ACR.setFlgEscludiWeb(0L); + ACR.setFlgReadyForWeb(1L); + Vectumerator vec = bean.findByCR(ACR, 0, 0); + if (vec.getTotNumberOfRecords() == 0) { + isEmpty = true; + } else { + while (vec.hasMoreElements()) { + numRecord++; + StatusMsg.updateMsgByTag(getApFull(), TAG_THREAD_MSG, " sitemap articoli " + sitemapfilename + " " + numRecord + " su " + + vec.getTotNumberOfRecords()); + Articolo rowbean = (Articolo)vec.nextElement(); + Element urlEl = dom.createElement("url"); + e = dom.createElement("loc"); + if (l_flgPersonalizzazione == 1L) { + e.setTextContent(getSite() + getSite()); + } else { + e.setTextContent(getSite() + getSite()); + } + urlEl.appendChild(e); + e = dom.createElement("lastmod"); + e.setTextContent(sdf.format(rowbean.getLastUpdTmst())); + urlEl.appendChild(e); + e = dom.createElement("changefreq"); + e.setTextContent("daily"); + urlEl.appendChild(e); + if (!rowbean.getSitemapPriorityReal().isEmpty()) { + e = dom.createElement("priority"); + e.setTextContent(rowbean.getSitemapPriorityReal()); + urlEl.appendChild(e); + } + rootElement.appendChild(urlEl); + } + } + } + dom.appendChild(rootElement); + if (!isEmpty) { + Transformer tr = TransformerFactory.newInstance().newTransformer(); + tr.setOutputProperty("indent", "yes"); + tr.setOutputProperty("method", "xml"); + tr.setOutputProperty("encoding", "UTF-8"); + tr.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "4"); + tr.transform(new DOMSource(dom), new StreamResult(new FileOutputStream(filenameTmp))); + File xmlFile = new File(getDocBase() + getDocBase() + getSitemapPath()); + DBAdapter.checkAndMakeDir(xmlFile.getParent()); + if (xmlFile.exists()) { + String xmlOldFile = getDocBase() + getDocBase() + getParm("PATH_TMP").getTesto(); + xmlFile.renameTo(new File(xmlOldFile)); + } + String fullXmlFileName = getDocBase() + getDocBase() + getSitemapPath(); + DBAdapter.printDebug(debug, "creaFileXmlSitemap: rinomino la sitemap da " + + xmlFileTmp.getAbsolutePath() + " in " + fullXmlFileName); + DBAdapter.moveFile(xmlFileTmp.getAbsolutePath(), fullXmlFileName); + rp.setStatus(true); + rp.setReturnObj(sitemapfilename); + rp.setMsg("Generazione sitemap " + sitemapfilename + " avvenuta con successo.
Numero Record: " + numRecord); + } else { + rp.setStatus(false); + rp.setMsg("Generazione sitemap " + sitemapfilename + " non avvenuta perché non ci sono record da inserire."); + } + } catch (ParserConfigurationException|javax.xml.transform.TransformerFactoryConfigurationError|java.io.FileNotFoundException|javax.xml.transform.TransformerException pce) { + rp.setStatus(false); + rp.setMsg("creaFileXmlSitemap: Error trying to instantiate DocumentBuilder " + String.valueOf(pce)); + DBAdapter.printDebug(rp.getMsg()); + } + StatusMsg.deleteMsgByTag(getApFull(), TAG_THREAD_MSG); + return rp; + } + + public String getPriorityReal() { + if (getPriority() > 100L || getPriority() == 50L || getPriority() < 0L) + return ""; + double sp = (double)getPriority() / 100.0D; + return String.valueOf(sp); + } + + public String getSite() { + return getParm("P_WWW_ADDRESS").getTesto(); + } + + public String getSitemapPath() { + return "_sitemap/"; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/SitemapCR.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/SitemapCR.java new file mode 100644 index 00000000..d55d8132 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/SitemapCR.java @@ -0,0 +1,131 @@ +package it.acxent.www; + +import it.acxent.art.ArticoloCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class SitemapCR extends CRAdapter { + private static final long serialVersionUID = -8936385978941880964L; + + private long id_sitemap; + + private String descrizione; + + private String loc; + + private long priority; + + private long flgChangefreq = -1L; + + private long flgAbilita = -1L; + + private String sitemapFilename; + + private String langSitemap; + + private long flgSitemapType; + + private ArticoloCR ACR = null; + + public static final String getSitemapType(long l_flgSitemapType) { + return Sitemap.getSitemapType(l_flgSitemapType); + } + + public final String getSitemapType() { + return Sitemap.getSitemapType(getFlgSitemapType()); + } + + public static final String getChangefreq(long l_flgChangefreq) { + return Sitemap.getChangefreq(l_flgChangefreq); + } + + public String getChangefreq() { + return Sitemap.getChangefreq(getFlgChangefreq()); + } + + public SitemapCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public SitemapCR() {} + + public void setId_sitemap(long newId_sitemap) { + this.id_sitemap = newId_sitemap; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setLoc(String newLoc) { + this.loc = newLoc; + } + + public void setPriority(long newPriority) { + this.priority = newPriority; + } + + public void setFlgChangefreq(long newChangefreq) { + this.flgChangefreq = newChangefreq; + } + + public void setFlgAbilita(long newFlgAbilita) { + this.flgAbilita = newFlgAbilita; + } + + public long getId_sitemap() { + return this.id_sitemap; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getLoc() { + return (this.loc == null) ? "" : this.loc.trim(); + } + + public long getPriority() { + return this.priority; + } + + public long getFlgChangefreq() { + return this.flgChangefreq; + } + + public long getFlgAbilita() { + return this.flgAbilita; + } + + public String getSitemapFilename() { + return (this.sitemapFilename == null) ? AB_EMPTY_STRING : this.sitemapFilename.trim(); + } + + public void setSitemapFilename(String sitemapFilename) { + this.sitemapFilename = sitemapFilename; + } + + public String getLangSitemap() { + return (this.langSitemap == null) ? AB_EMPTY_STRING : this.langSitemap.trim(); + } + + public void setLangSitemap(String langSitemap) { + this.langSitemap = langSitemap; + } + + public long getFlgSitemapType() { + return this.flgSitemapType; + } + + public void setFlgSitemapType(long flgSitemapType) { + this.flgSitemapType = flgSitemapType; + } + + public ArticoloCR getACR() { + return (this.ACR == null) ? new ArticoloCR(getApFull()) : this.ACR; + } + + public void setACR(ArticoloCR aCR) { + this.ACR = aCR; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/_WwwAdapter.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/_WwwAdapter.java new file mode 100644 index 00000000..a63480e6 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/_WwwAdapter.java @@ -0,0 +1,58 @@ +package it.acxent.www; + +import it.acxent.anag._AnagAdapter; +import it.acxent.db.ApplParmFull; + +public class _WwwAdapter extends _AnagAdapter { + public static final long PAG_BONIFICO = 1L; + + public static final long PAG_CC = 0L; + + public static final long PAG_CONTANTI = 4L; + + public static final long PAG_CONTRASSEGNO = 3L; + + public static final long PAG_PAYPAL = 2L; + + public static final long PAG_POSTEPAY = 5L; + + public static final long PAG_RITIRO_IN_NEGOZIO = 7L; + + public static final long PAG_VAGLIA = 6L; + + public static final String P_MSG_TIPO_PAG_BONIFICO = "MSG_TP_BONIFICO"; + + public static final String P_MSG_TIPO_PAG_BONIFICO_NO_PROC = "MSG_TP_BONIFICO_NO_PROC"; + + public static final String P_MSG_TIPO_PAG_CARTA_DI_CREDITO = "MSG_TP_CARTA_DI_CREDITO"; + + public static final String P_MSG_TIPO_PAG_CARTA_DI_CREDITO_NO_PROC = "MSG_TP_CARTA_DI_CREDITO_NO_PRO"; + + public static final String P_MSG_TIPO_PAG_CONTRASSEGNO = "MSG_TP_CONTRASSEGNO"; + + public static final String P_MSG_TIPO_PAG_POSTAGIRO = "MSG_TP_POSTAGIRO"; + + public static final String P_MSG_TIPO_PAG_POSTAGIRO_NO_PROC = "MSG_TP_POSTAGIRO_NO_PROC"; + + public static final String P_MSG_TIPO_PAG_POSTEPAY = "MSG_TIPO_PAG_POSTEPAY"; + + public static final String P_MSG_TIPO_PAG_POSTEPAY_NO_PROC = "MSG_TIPO_PAG_POSTEPAY_NO_PROC"; + + public static final String P_MSG_TIPO_PAG_SALDO_NEGOZIO = "MSG_TP_NEGOZIO"; + + public static final String P_MSG_TIPO_PAG_SALDO_NEGOZIO_NO_PROC = "MSG_TP_NEGOZIO_NO_PROC"; + + public static final long STATO_PAG_NON_PAGATO = 0L; + + public static final long STATO_PAG_PAGATO = 2L; + + public static final long STATO_PAG_TRANS_OK = 1L; + + public _WwwAdapter() {} + + public _WwwAdapter(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + protected void deleteCascade() {} +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/CartSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/CartSvlt.java new file mode 100644 index 00000000..236ab049 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/CartSvlt.java @@ -0,0 +1,656 @@ +package it.acxent.www.servlet; + +import com.google.api.client.googleapis.auth.oauth2.GoogleIdToken; +import com.google.api.client.googleapis.auth.oauth2.GoogleIdTokenVerifier; +import com.google.api.client.http.javanet.NetHttpTransport; +import com.google.api.client.json.gson.GsonFactory; +import it.acxent.anag.Cliente; +import it.acxent.anag.Clifor; +import it.acxent.anag.DestinazioneDiversa; +import it.acxent.anag.TipoPagamento; +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloVariante; +import it.acxent.cart.AcCartObject; +import it.acxent.cart.Cart; +import it.acxent.cart.CartItem; +import it.acxent.cart.CartStatus; +import it.acxent.cart.servlet.AcCartSvlt; +import it.acxent.cc.Attivita; +import it.acxent.common.Postazione; +import it.acxent.common.Users; +import it.acxent.contab.Documento; +import it.acxent.contab.RigaDocumento; +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; +import it.acxent.util.CodiceFiscale; +import it.acxent.util.DoubleOperator; +import it.acxent.util.Vectumerator; +import it.acxent.www.Promozione; +import java.net.InetAddress; +import java.sql.Date; +import java.util.Base64; +import java.util.Collections; +import java.util.Enumeration; +import javax.crypto.Mac; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import org.apache.commons.codec.digest.HmacAlgorithms; +import org.apache.commons.codec.digest.HmacUtils; +import org.json.JSONObject; + +public class CartSvlt extends AcCartSvlt { + public AcCartObject getCartObject(HttpServletRequest req) throws Exception { + String l_id = getRequestParameter(req, "id"); + long l_id_articolo = 0L, l_id_articoloVariante = 0L; + if (!l_id.isEmpty()) { + if (l_id.indexOf("av_") >= 0) { + l_id_articoloVariante = Long.parseLong(l_id.substring(3)); + req.setAttribute("id_articoloVariante", Long.valueOf(l_id_articoloVariante)); + } else { + l_id_articolo = Long.parseLong(l_id); + req.setAttribute("id_articolo", Long.valueOf(l_id_articolo)); + } + } else { + l_id_articolo = getRequestLongParameter(req, "id_articolo"); + l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante"); + } + int l_quantity = (int)getRequestLongParameter(req, "qt"); + if (l_quantity == 0) + l_quantity = 1; + if (l_id_articoloVariante > 0L) { + ArticoloVariante av = new ArticoloVariante(getApFull(req)); + av.findByPrimaryKey(l_id_articoloVariante); + req.setAttribute("bean", av); + AcCartObject acCartObject = new AcCartObject(ArticoloVariante.class, av.getItemId(), (double)l_quantity); + return acCartObject; + } + Articolo bean = new Articolo(getApFull(req)); + bean.findByPrimaryKey(l_id_articolo); + req.setAttribute("bean", bean); + AcCartObject aco = new AcCartObject(Articolo.class, bean.getItemId(), (double)l_quantity); + return aco; + } + + protected double getDeliveryCost(HttpServletRequest req, Cart cart) { + return getParm(Cart.P_DELIVERY_COST).getNumeroDouble(); + } + + protected double getMoreCost(HttpServletRequest req) { + return getParm(Cart.P_MORE_COST).getNumeroDouble(); + } + + protected Users getUser(HttpServletRequest req) { + return new it.acxent.anag.Users(getApFull(req)); + } + + protected ResParm recordOrder(HttpServletRequest req, HttpServletResponse res) { + ResParm rp = new ResParm(true); + synchronized (this) { + try { + System.out.println("record ORDINE ----------------------------"); + Cart cart = getCart(req); + it.acxent.anag.Users utente = (it.acxent.anag.Users)getLoginUser(req); + long l_id_tipoOrdine = getParm("ID_DOC_ORDINE_WWW").getNumeroLong(); + Documento ordine = new Documento(getApFull(req)); + ordine.setId_tipoDocumento(l_id_tipoOrdine); + ordine.setFlgStato(1L); + ordine.setId_clifor(utente.getId_clifor()); + ordine.setDataDocumento(new Date(new java.util.Date().getTime())); + ordine.setNominativoDocumento(utente.getDescrizione()); + ordine.setFlgRitiroNegozio(cart.getFlgPickup()); + if (cart.getMoreCost() > 0.0D) { + DoubleOperator temp = new DoubleOperator(cart.getMoreCost()); + temp.add(cart.getDeliveryCost()); + ordine.setSpeseTrasporto(temp.getResult()); + } else { + ordine.setSpeseTrasporto(cart.getDeliveryCost()); + } + if (req.getParameter("note") != null && !req.getParameter("note").equals("")) + ordine.setNote(req.getParameter("note")); + ordine.setFlgStatoOrdineWww(0L); + ordine.setFlgStatoPrenotazione(0L); + ordine.setFlgPagata(0L); + long l_id_tipoPagamento = getRequestLongParameter(req, "id_tipoPagamento"); + ordine.setId_tipoPagamento(l_id_tipoPagamento); + if (getParm(Cart.P_PROCEDI_PAGAMENTO).getNumeroLong() == 1L) + ordine.setFlgProcediPagamento(1L); + rp = ordine.save(); + Enumeration enu = cart.getItems(); + String lang = getLang(req); + while (enu.hasMoreElements()) { + CartItem ci = enu.nextElement(); + if (ci.getQuantity() > 0.0D) { + RigaDocumento rigaOrdine = new RigaDocumento(getApFull(req)); + if (ci.getDbItem() instanceof ArticoloVariante) { + ArticoloVariante av = (ArticoloVariante)ci.getDbItem(); + rigaOrdine.setId_articolo(av.getId_articolo()); + rigaOrdine.setId_articoloVariante(av.getId_articoloVariante()); + rigaOrdine.setQuantita((double)(int)ci.getQuantity()); + rigaOrdine.setQuantitaUdm((double)(int)ci.getQuantity()); + rigaOrdine.setImponibile(av.getPrezzoArticolo(ordine.getClifor()).getPrezzoBase()); + rigaOrdine.setSconto(av.getPrezzoArticolo(ordine.getClifor()).getPercSconto()); + rigaOrdine.setDescrizioneRiga(rigaOrdine.getArticoloVariante().getDescrizioneCompleta()); + rigaOrdine.setId_iva(av.getArticolo().getId_iva()); + } else { + Articolo articolo = (Articolo)ci.getDbItem(); + rigaOrdine.setId_articolo(articolo.getId_articolo()); + rigaOrdine.setQuantita((double)(int)ci.getQuantity()); + rigaOrdine.setImponibile(articolo.getPrezzoArticolo(ordine.getClifor()).getPrezzoBase()); + rigaOrdine.setSconto(articolo.getPrezzoArticolo(ordine.getClifor()).getPercSconto()); + rigaOrdine.setDescrizioneRiga(rigaOrdine.getArticolo().getDescrizioneCompleta()); + rigaOrdine.setId_iva(articolo.getId_iva()); + } + rp = Documento.addRigaDocumento(ordine, rigaOrdine); + } + } + ordine.setFlgStato(1L); + ordine.save(); + rp = ordine.sendOrderMailMessage("it", true, true, false); + System.out.println("fine record ORDINE ############"); + req.setAttribute(PROP_ORDER, ordine); + int ordineInverso = (ordine.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + req.setAttribute("righeDocumento", ordine.findRigheDocumento(0, 0, ordineInverso)); + req.setAttribute("listaTipoPagamento", getListaTipiPagamento(req, cart)); + forceJspPageRelative("documento.jsp", req); + } catch (Exception e) { + handleDebug(e); + sendMessage(req, "CheckOut: record order error: " + e.getMessage()); + } + } + return rp; + } + + protected ResParm sendCheckOutMessage(HttpServletRequest req, HttpServletResponse res) { + Documento ordine = (Documento)req.getAttribute(PROP_ORDER); + ResParm rp = new ResParm(true); + if (ordine.getTipoPagamento().getFlgTipoPagamento() == 2L || + ordine.getTipoPagamento().getFlgTipoPagamento() == 3L) + rp = ordine.sendOrderMailMessage(getLang(req), true, true, false); + return rp; + } + + protected String getJspOrderPage(HttpServletRequest req) { + return "ordine.jsp"; + } + + protected boolean useControlCodeAccess() { + return false; + } + + protected void afterCheckOut(HttpServletRequest req, HttpServletResponse res) { + String l_lang = getLang(req); + String l_codicePromozione = getRequestParameter(req, "codicePromozione"); + Cart cart = getCart(req); + if (!l_codicePromozione.isEmpty()) { + CartStatus cs = (CartStatus)req.getAttribute(ATTR_CART_STATUS); + Promozione promozione = new Promozione(getApFull(req)); + promozione.findByCodicePromozione(l_codicePromozione); + if (promozione.getDBState() == 0) { + sendMessage(req, "Codice Promozione non valido."); + } else { + it.acxent.anag.Users utente = (it.acxent.anag.Users)getLoginUser(req); + long resPromo = promozione.isValid(utente); + if (resPromo == Promozione.PROMOZIONE_VALIDA) { + cart.setDiscountPerc(promozione.getPercSconto()); + cart.setDescDiscountPerc(promozione.getDescrizione(l_lang)); + cart.setDescDiscount(promozione.getCodicePromozione()); + setCart(req, cart); + } else if (resPromo == Promozione.PROMOZIONE_SCADUTA) { + sendMessage(req, "Codice Promozione scaduta."); + } else if (resPromo == Promozione.PROMOZIONE_NON_VALIDA) { + sendMessage(req, "Codice Promozione Non Valida."); + } else if (resPromo == Promozione.PROMOZIONE_UTENTE_NULL) { + sendMessage(req, "Codice Promozione per Utente. Devi fare il login per poterla utilizzare."); + } + } + } + req.setAttribute("listaTipoPagamento", getListaTipiPagamento(req, cart)); + long flgPayment = getRequestLongParameter(req, "id_tipoPagamento"); + cart.setFlgPayment(flgPayment); + if (flgPayment == 15L) { + cart.setMoreCost(getMoreCost(req)); + cart.setDescMoreCost("Contrassegno"); + } else { + cart.setMoreCost(0.0D); + cart.setDescMoreCost(""); + } + if (cart.getFlgPickup() == 1L) { + cart.setDeliveryCost(0.0D); + } else { + cart.setDeliveryCost(getDeliveryCost(req, cart)); + } + setCart(req, cart); + super.afterCheckOut(req, res); + } + + protected void afterModifyItems(HttpServletRequest req, HttpServletResponse res) { + String l_lang = getLang(req); + String l_codicePromozione = getRequestParameter(req, "codicePromozione"); + if (!l_codicePromozione.isEmpty()) { + Cart cart = getCart(req); + CartStatus cs = (CartStatus)req.getAttribute(ATTR_CART_STATUS); + Promozione promozione = new Promozione(getApFull(req)); + promozione.findByCodicePromozione(l_codicePromozione); + if (promozione.getDBState() == 0) { + sendMessage(req, "Codice Promozione non valido."); + } else { + it.acxent.anag.Users utente = (it.acxent.anag.Users)getLoginUser(req); + long resPromo = promozione.isValid(utente); + if (resPromo == Promozione.PROMOZIONE_VALIDA) { + cart.setDiscountPerc(promozione.getPercSconto()); + cart.setDescDiscountPerc(promozione.getDescrizione(l_lang)); + cart.setDescDiscount(promozione.getCodicePromozione()); + setCart(req, cart); + } else if (resPromo == Promozione.PROMOZIONE_SCADUTA) { + sendMessage(req, "Codice Promozione scaduta."); + } else if (resPromo == Promozione.PROMOZIONE_NON_VALIDA) { + sendMessage(req, "Codice Promozione Non Valida."); + } else if (resPromo == Promozione.PROMOZIONE_UTENTE_NULL) { + sendMessage(req, "Codice Promozione per Utente. Devi fare il login per poterla utilizzare."); + } + } + } + super.afterModifyItems(req, res); + } + + protected String getJspHomePage(HttpServletRequest req) { + return "documentoCR.jsp"; + } + + protected boolean checkAvailability(HttpServletRequest req) { + return true; + } + + protected ResParm sendLostPasswordMessage(HttpServletRequest req, HttpServletResponse res) { + it.acxent.anag.Users user = new it.acxent.anag.Users(getApFull(req)); + String lostEmail = getRequestParameter(req, AcCartSvlt.ATTR_LOSTPWDEMAIL); + if (lostEmail.isEmpty()) + return new ResParm(false, "Email errata"); + String id_profiles = String.valueOf(user.getIdUserProfileWww()); + return user.sendLostPasswordMailMessage(lostEmail, getLang(req)); + } + + protected ResParm saveUser(HttpServletRequest req, HttpServletResponse res) { + ResParm rp = new ResParm(true); + it.acxent.anag.Users bean = new it.acxent.anag.Users(getApFull(req)); + fillObject(req, bean); + Cliente cli = new Cliente(getApFull(req)); + fillObject(req, cli); + DestinazioneDiversa dd = new DestinazioneDiversa(getApFull(req)); + fillObject(req, dd); + cli.setCurrentDD(dd); + bean.setClifor(cli); + String msg = "Impossibile Registrare un nuovo utente:"; + if (bean.isLogonDuplicated()) { + msg = msg + " Login già presente in archivio"; + rp.setStatus(false); + rp.setMsg(msg); + return rp; + } + if (bean.isEmailDuplicated()) { + it.acxent.anag.Users userMl = new it.acxent.anag.Users(getApFull(req)); + userMl.findUsersByEmail(bean.getEMail()); + if (userMl.getId_userProfile() == bean.getIdUserProfileMailingList()) { + req.setAttribute("id_users", String.valueOf(userMl.getId_users())); + req.setAttribute("flgValido", "S"); + req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww())); + rp = saveUserAndClifor(req, res); + } else { + msg = msg + " Email già presente in archivio"; + forceMessage(req, msg); + req.setAttribute("bean", bean); + callJsp(req, res); + } + } else { + if (cli.isCodFiscDuplicated()) { + msg = msg + " Codice Fiscale già presente in archivio"; + rp.setStatus(false); + rp.setMsg(msg); + return rp; + } + if (cli.isPIvaDuplicated()) { + msg = msg + " Partita Iva già presente in archivio"; + rp.setStatus(false); + rp.setMsg(msg); + return rp; + } + if (!cli.getCodFisc().isEmpty() && !CodiceFiscale.controlloFormale(cli.getCodFisc())) { + msg = msg + " Il codice fiscale non è valido:"; + rp.setStatus(false); + rp.setMsg(msg); + return rp; + } + if (!cli.getPIva().isEmpty() && cli.getPIva().length() != 11) { + msg = msg + " Partita iva non valida:"; + rp.setStatus(false); + rp.setMsg(msg); + return rp; + } + req.setAttribute("flgValido", "S"); + req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww())); + rp = saveUserAndClifor(req, res); + } + return rp; + } + + protected ResParm saveUserAndClifor(HttpServletRequest req, HttpServletResponse res) { + ResParm rp = new ResParm(true); + it.acxent.anag.Users user = new it.acxent.anag.Users(getApFull(req)); + long l_id_users = getRequestLongParameter(req, "id_users"); + user.findByPrimaryKey(l_id_users); + fillObject(req, user); + Clifor cliente = user.getClifor(); + fillObject(req, cliente); + String nominativo = getRequestParameter(req, "nominativo"); + if (!nominativo.isEmpty()) { + cliente.setFlgAzienda(1L); + cliente.setCognome(nominativo); + cliente.setNome(""); + } + cliente.setFlgTipo("C"); + rp = cliente.save(); + if (rp.getStatus()) { + DestinazioneDiversa dd = cliente.getCurrentDD(); + fillObject(req, dd); + if (dd.getIndirizzoDD().isEmpty()) { + if (dd.getId_destinazioneDiversa() != 0L) + rp.append(dd.delete()); + } else { + dd.setId_clifor(cliente.getId_clifor()); + dd.setFlgDDDefault(1L); + dd.setDescrizioneDD("Sped. WWW"); + rp.append(dd.save()); + } + } + if (rp.getStatus()) { + user.setId_clifor(cliente.getId_clifor()); + if (user.getId_userProfile() == 0L) + user.setId_userProfile(user.getIdUserProfileWww()); + user.setFlgValido("S"); + rp.append(user.save()); + } + if (!rp.getStatus()) { + sendMessage(req, "Impossibile salvare: " + rp.getMsg()); + rp.setStatus(false); + rp.setMsg("Impossibile salvare: " + rp.getMsg()); + return rp; + } + return rp; + } + + protected ResParm recordOrderNoReg(HttpServletRequest req, HttpServletResponse res) { + return null; + } + + protected Vectumerator getListaTipiPagamento(HttpServletRequest req, Cart cart) { + it.acxent.anag.Users user = (it.acxent.anag.Users)getLoginUser(req); + if (user != null && user.getId_users() > 0L) { + boolean isTipoPagEstero = false; + if (user != null) + isTipoPagEstero = !user.getClifor().getId_nazione().equals("I"); + TipoPagamento tipoPagamento = new TipoPagamento(getApFull(req)); + Vectumerator vecLTP = tipoPagamento.findPagamentiWwwByClifor(user.getId_clifor()); + if (vecLTP.getTotNumberOfRecords() > 0) + return vecLTP; + return tipoPagamento.findPagamentiWww(isTipoPagEstero, false); + } + TipoPagamento tp = new TipoPagamento(getApFull(req)); + return tp.findPagamentiWww(false, false); + } + + public void _googleSignIn(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(true); + Attivita attivita = Attivita.getDefaultInstance(apFull); + GoogleIdTokenVerifier verifier = new GoogleIdTokenVerifier.Builder(new NetHttpTransport(), new GsonFactory()) + + .setAudience(Collections.singletonList(attivita.getPGoogleSigninClientId())) + + + + .build(); + String l_g_csrf_token = getRequestParameter(req, "g_csrf_token"); + String l_credential = getRequestParameter(req, "credential"); + String csrf_token_cookie = getCookie(req, "g_csrf_token").getValue(); + if (csrf_token_cookie == null || csrf_token_cookie.isEmpty()) { + rp.setStatus(false); + rp.setMsg("No CSRF token in Cookie"); + } + if (l_g_csrf_token.isEmpty()) { + rp.setStatus(false); + rp.setMsg("No CSRF token in post body"); + } + if (!l_g_csrf_token.equals(csrf_token_cookie)) { + rp.setStatus(false); + rp.setMsg("Failed to verify double submit cookie"); + } + if (l_credential.isEmpty()) { + rp.setStatus(false); + rp.setMsg("Failed to get credentials"); + } + if (rp.getStatus()) { + try { + GoogleIdToken idToken = verifier.verify(l_credential); + if (idToken != null) { + GoogleIdToken.Payload payload = idToken.getPayload(); + String userId = payload.getSubject(); + String email = payload.getEmail(); + boolean emailVerified = Boolean.valueOf(payload.getEmailVerified().booleanValue()); + String cognome = (String)payload.get("family_name"); + String nome = (String)payload.get("given_name"); + if (emailVerified) + socialLogin(req, res, 0L, userId, email, nome, cognome); + } else { + System.out.println("Invalid ID token.xx"); + } + } catch (Exception e) { + e.printStackTrace(); + } + } else { + String jspPage = getCal(req); + if (jspPage.isEmpty()) + jspPage = getJspHomePage(req); + _updateCart(req); + sendMessage(req, rp.getMsg()); + setJspPageRelative(jspPage, req); + callJsp(req, res); + } + } + + protected void socialLogin(HttpServletRequest req, HttpServletResponse res, long l_socialType, String l_socialId, String socialEmail, String l_nome, String l_cognome) { + boolean debug = false; + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(true); + try { + it.acxent.anag.Users utente = new it.acxent.anag.Users(apFull); + utente.findUsersBySocialId(l_socialId, l_socialType); + if (utente.getId_users() == 0L) { + if (debug) + System.out.println("socialLoginutente social non trovato provo email " + socialEmail); + utente.findUsersByEmail(socialEmail); + } + if (utente.getId_users() > 0L) { + if (debug) + System.out.println("socialLoginutente trovato "); + if (utente.getFlgValido().equals("S")) { + boolean saveUtente = false; + if (debug) + System.out.println("socialLoginutente valido "); + if (utente.getSocialId().isEmpty() || !utente.getSocialId().equals(l_socialId)) { + if (debug) + System.out.println("socialLoginutente trovato sovrascrivo dati social "); + utente.setSocialId(l_socialId); + utente.setFlgSocialIdType(l_socialType); + saveUtente = true; + } + if (utente.getId_userProfile() == utente.getIdUserProfileNoReg()) { + utente.setId_userProfile(utente.getIdUserProfileWww()); + saveUtente = true; + if (debug) + System.out.println("socialLoginutente trovato profilo no reg.. diventa www"); + } + if (saveUtente) + rp = utente.save(); + if (debug) + System.out.println("socialLoginutente salvato " + rp.getStatus() + " " + rp.getMsg()); + _updateCart(req); + HttpSession session = req.getSession(); + handleDebug("Ok. Recording loginuser_id in the session."); + session.setAttribute("loginUser_id", new Long(utente.getId_users())); + String ip = req.getRemoteHost(); + InetAddress ia = InetAddress.getByName(ip); + byte[] ipBytes = ia.getAddress(); + ia = InetAddress.getByAddress(ipBytes); + Postazione pos = new Postazione(getApFull(req)); + if (!ia.getHostName().isEmpty()) + pos.findByHostname(ia.getHostName()); + if (pos.getDBState() != 1) + pos.findByIp(ip); + if (pos.getDBState() == 1) + utente.setId_postazione(pos.getId_postazione()); + if (debug) + System.out.println("socialLoginsocialLoginByEmail: LOGIN EFFETTUATO: user:" + utente.getLogin() + " ip:" + ip + " HOSTNAME:" + + ia.getHostName() + " Postazione: " + utente.getPostazione().getDescrizione()); + utente.setCurrentIp(ip); + session.setAttribute("utenteLogon", utente); + req.setAttribute("logon", "logonOk"); + rp.setStatus(true); + } + } else { + if (debug) + System.out.println("socialLoginutente NON trovato lo creo "); + utente.setNome(l_nome); + utente.setCognome(l_cognome); + utente.setLogin(socialEmail); + utente.setEMail(socialEmail); + utente.setFlgValido("S"); + utente.setId_userProfile(utente.getIdUserProfileWww()); + utente.setSocialId(l_socialId); + utente.setFlgSocialIdType(l_socialType); + Clifor cliente = utente.getClifor(); + cliente.setNome(l_nome); + cliente.setCognome(l_cognome); + cliente.setEMail(socialEmail); + cliente.setFlgAzienda(0L); + cliente.setFlgTipo("C"); + rp = cliente.save(); + if (rp.getStatus()) { + utente.setId_clifor(cliente.getId_clifor()); + rp.append(utente.save()); + } + if (!rp.getStatus()) { + sendMessage(req, "Impossibile salvare: " + rp.getMsg()); + rp.setStatus(false); + rp.setMsg("Impossibile salvare: " + rp.getMsg()); + } + if (rp.getStatus()) { + HttpSession session = req.getSession(); + session.setAttribute("loginUser_id", new Long(utente.getId_users())); + session.setAttribute("utenteLogon", utente); + req.setAttribute("logon", "logonOk"); + } + } + if (rp.getStatus()) { + if (debug) + System.out.println("socialLoginsalvataggio ok "); + if (getCart(req).getNumberOfItems() == 0L) { + String jspPage = getCal(req); + if (jspPage.isEmpty()) + jspPage = getJspHomePage(req); + setJspPageRelative(jspPage, req); + callJsp(req, res); + } else { + setJspPageRelative("/cart.html", req); + callJsp(req, res); + } + } else { + if (debug) + System.out.println("socialLoginerrore " + rp.getMsg()); + String jspPage = getCal(req); + if (jspPage.isEmpty()) + jspPage = getJspHomePage(req); + sendMessage(req, rp.getMsg()); + setJspPageRelative(jspPage, req); + callJsp(req, res); + } + } catch (Exception e) { + e.printStackTrace(); + String jspPage = getCal(req); + if (jspPage.isEmpty()) + jspPage = getJspHomePage(req); + setJspPageRelative(jspPage, req); + sendMessage(req, e.getMessage()); + setJspPageRelative(jspPage, req); + callJsp(req, res); + } + } + + public void _facebookSignIn(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + ResParm rp = new ResParm(true); + Attivita attivita = Attivita.getDefaultInstance(apFull); + String l_id = getRequestParameter(req, "facebookId"); + String l_email = getRequestParameter(req, "facebookEmail"); + String l_name = getRequestParameter(req, "facebookName"); + String l_last_name = getRequestParameter(req, "facebookLast_name"); + String l_facebookSignedRequest = getRequestParameter(req, "facebookSignedRequest"); + int l_idx = l_facebookSignedRequest.indexOf("."); + String l_data = null; + if (!l_facebookSignedRequest.isEmpty() && l_idx > 0) { + try { + String l_signature64 = l_facebookSignedRequest.substring(0, l_idx); + String l_payload64 = l_facebookSignedRequest.substring(l_idx + 1); + l_data = new String(Base64.getUrlDecoder().decode(l_payload64)); + Mac mac = HmacUtils.getInitializedMac(HmacAlgorithms.HMAC_SHA_256, attivita.getPFacebookSigninSecretKey().getBytes()); + String sigExpected64 = Base64.getUrlEncoder().withoutPadding().encodeToString(mac.doFinal(l_payload64.getBytes())); + if (!sigExpected64.equals(l_signature64)) { + rp.setStatus(false); + rp.setMsg("Bad Signed JSON signature!"); + } + } catch (Exception e) { + e.printStackTrace(); + rp.setStatus(false); + rp.setMsg("Exception " + e.getMessage()); + } + } else { + rp.setStatus(false); + rp.setMsg("Failed to get signedRequest!"); + } + if (rp.getStatus() && l_data != null) { + JSONObject jo = new JSONObject(l_data); + if (!l_id.equals(jo.get("user_id"))) { + rp.setStatus(false); + rp.setMsg("Failed: cannot verify payload user_id!"); + } + } else if (rp.getStatus()) { + rp.setStatus(false); + rp.setMsg("Failed to get JSON payload"); + } + if (rp.getStatus()) + if (l_id.isEmpty()) { + rp.setStatus(false); + rp.setMsg("Failed to get email"); + } else if (l_email.isEmpty()) { + rp.setStatus(false); + rp.setMsg("Failed to get email"); + } else if (l_name.isEmpty()) { + rp.setStatus(false); + rp.setMsg("Failed to get name"); + } else if (l_last_name.isEmpty()) { + rp.setStatus(false); + rp.setMsg("Failed to get last name"); + } + if (rp.getStatus()) { + socialLogin(req, res, 1L, l_id, l_email, l_name, l_last_name); + } else { + String jspPage = getCal(req); + if (jspPage.isEmpty()) + jspPage = getJspHomePage(req); + _updateCart(req); + sendMessage(req, rp.getMsg()); + setJspPageRelative(jspPage, req); + callJsp(req, res); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/CatalogoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/CatalogoSvlt.java new file mode 100644 index 00000000..b7d1336f --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/CatalogoSvlt.java @@ -0,0 +1,260 @@ +package it.acxent.www.servlet; + +import it.acxent.art.Articolo; +import it.acxent.art.ArticoloCR; +import it.acxent.art.ArticoloVariante; +import it.acxent.art.ArticoloVarianteCR; +import it.acxent.art.Lista; +import it.acxent.art.Tipo; +import it.acxent.art.TipoAccessorio; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.tarop.OpzioneArticolo; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class CatalogoSvlt extends _WwwSvlt { + private static final long serialVersionUID = 8470016548703062874L; + + private Tipo tipo; + + protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) { + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + CR.setFlgDisponibile(1L); + req.setAttribute("listaPadri", getTipo(req).findPadri()); + if (getTipo(req).getFlgUsaVarianti() == 1L) { + CR.setFlgUsaDisponibilita(1L); + ArticoloVariante bean = (ArticoloVariante)l_bean; + req.setAttribute("listaArticoliVariante", bean.getArticolo().findArticoliVarianti(0L, 0L)); + CR.setId_tipoSel(bean.getArticolo().getId_tipo()); + long l_id_tipoAccessorio = getRequestLongParameter(req, "id_tipoAccessorio"); + long l_id_tipo = getRequestLongParameter(req, "id_tipo"); + req.setAttribute("listaAccessori", bean.getArticolo().getAccessori(l_id_tipoAccessorio, l_id_tipo, 0L)); + req.setAttribute("listaTipiAccessorio", new TipoAccessorio(getApFull(req)).findAll()); + Tipo tipo = new Tipo(getApFull(req)); + tipo.findByPrimaryKey(196L); + req.setAttribute("listaTipiAcc", tipo.findFigli(0, 0)); + req.setAttribute("listaCaratteristicheArticolo", bean.getArticolo().getCaratteristicheArticolo()); + req.setAttribute("listaOpzioniArticolo", new OpzioneArticolo(getApFull(req)).findById_articolo(bean.getId_articolo())); + } else { + Articolo bean = (Articolo)l_bean; + CR.setId_tipoSel(bean.getId_tipo()); + req.setAttribute("listaCaratteristicheArticolo", bean.getCaratteristicheArticolo()); + req.setAttribute("listaOpzioniArticolo", new OpzioneArticolo(getApFull(req)).findById_articolo(bean.getId_articolo())); + long l_id_tipoAccessorio = getRequestLongParameter(req, "id_tipoAccessorio"); + long l_id_tipo = getRequestLongParameter(req, "id_tipo"); + req.setAttribute("listaAccessori", bean.getAccessori(l_id_tipoAccessorio, l_id_tipo, 0L)); + } + req.setAttribute("CR", CR); + if (getAct(req).equals("zoom")) { + String imgNumber = getRequestParameter(req, "imgNumber"); + req.setAttribute("imgNumber", imgNumber); + } + if (req.getAttribute("msg").equals("Lettura effettuata") || req.getAttribute("msg").equals("Read Ok")) + req.setAttribute("msg", ""); + } + + protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) { + ArticoloCR CR = (ArticoloCR)CRA; + req.setAttribute("listaPadri", CR.getTipo().findPadri()); + Lista lista = new Lista(getApFull(req)); + req.setAttribute("listaCaratteristica1", lista.findLista(11L, 0, 0)); + req.setAttribute("listaCaratteristica2", lista.findLista(4L, 0, 0)); + req.setAttribute("listaCaratteristica3", lista.findLista(6L, 0, 0)); + req.setAttribute("listaCaratteristica4", lista.findLista(2L, 0, 0)); + } + + protected DBAdapter getBean(HttpServletRequest req) { + if (getTipo(req) == null) + return new Articolo(getApFull(req)); + if (getTipo(req).getFlgUsaVarianti() == 1L) { + if (getCmd(req).equalsIgnoreCase("md") && !getAct(req).equals("articolo")) + return new ArticoloVariante(getApFull(req)); + return new Articolo(getApFull(req)); + } + return new Articolo(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + if (getTipo(req) == null) + return new ArticoloCR(getApFull(req)); + if (getTipo(req).getFlgUsaVarianti() == 1L) { + if (getCmd(req).equalsIgnoreCase("md")) + return new ArticoloVarianteCR(getApFull(req)); + return new ArticoloCR(getApFull(req)); + } + return new ArticoloCR(getApFull(req)); + } + + protected int getPageRow(HttpServletRequest req) { + int pageRow = getParm("PAGE_ROW").getNumeroInt(); + return (pageRow == 0) ? 4 : pageRow; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("catalogo")) { + setJspPage("/catalogo.jsp", req); + callJsp(req, res); + } else { + search(req, res); + } + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + ResParm rp = new ResParm(true); + req.setAttribute("flgEscludiWeb", "0"); + req.setAttribute("flgDisponibile", "0"); + if (getRequestLongParameter(req, "flgOrderBy") < 2L) + req.setAttribute("flgOrderBy", String.valueOf(2L)); + return rp; + } + + protected String getBeanPageName(HttpServletRequest req) { + String jspPage; + if (getTipo(req) == null) { + jspPage = super.getBeanPageName(req); + } else if (getTipo(req).getFlgUsaVarianti() == 1L) { + jspPage = super.getBeanPageName(req); + if (getAct(req).equals("zoom")) { + ArticoloVariante bean = (ArticoloVariante)req.getAttribute("bean"); + String targetDir = getDocBase() + getDocBase(); + if (ArticoloVariante.isFileExist(targetDir + targetDir)) { + jspPage = jspPage + "Zoom6"; + } else { + jspPage = jspPage + "Zoom"; + } + } + } else { + if (getCmd(req).equals("search")) { + jspPage = "articolo"; + } else { + jspPage = "articolo"; + } + if (getAct(req).equals("zoom")) + jspPage = jspPage + "Zoom"; + } + return jspPage; + } + + protected void viewAllArticoliVariante(HttpServletRequest req, HttpServletResponse res) { + try { + ArticoloVarianteCR CR = new ArticoloVarianteCR(getApFull(req)); + ArticoloCR CRA = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + fillObject(req, CRA); + if (CR.getId_tipoSel() == 0L) + CR.setId_tipoSel(CRA.getId_tipoMenu()); + CR.setFlgNascondi(0L); + CR.setFlgDisponibile(1L); + CR.setFlgOrdinaArticolo(1L); + req.setAttribute("CR", CRA); + req.setAttribute("list", new ArticoloVariante(getApFull(req)).findByCR(CR, 0, 0)); + setJspPageRelative("articoloVarianteVACR.jsp", req); + callJsp(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected void viewAllArticoliAccessori(HttpServletRequest req, HttpServletResponse res) { + try { + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + CR.setFlgNascondi(0L); + CR.setFlgDisponibile(1L); + CR.setFlgOrdinaArticolo(1L); + if (CR.getId_tipoSel() == 0L) + CR.setId_tipoSel(CR.getId_tipoMenu()); + req.setAttribute("CR", CR); + req.setAttribute("list", new Articolo(getApFull(req)).findByCR(CR, 0, 0)); + setJspPageRelative("articoloAccVACR.jsp", req); + callJsp(req, res); + } catch (Exception e) { + handleDebug(e); + } + } + + protected Tipo getTipo(HttpServletRequest req) { + if (this.tipo == null) { + long l_id_tipo = getRequestLongParameter(req, "id_tipo"); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + if (l_id_articolo > 0L) { + Articolo bean = new Articolo(getApFull(req)); + bean.findByPrimaryKey(l_id_articolo); + this.tipo = bean.getTipo(); + } else if (l_id_tipo > 0L) { + this.tipo = new Tipo(getApFull(req)); + this.tipo.findByPrimaryKey(l_id_tipo); + } else { + this.tipo = new Tipo(getApFull(req)); + } + } + return this.tipo; + } + + private void setTipo(Tipo tipo) { + this.tipo = tipo; + } + + protected void processRequest(HttpServletRequest req, HttpServletResponse res) { + setTipo(null); + super.processRequest(req, res); + } + + protected void showBean(HttpServletRequest req, HttpServletResponse res) { + if (this.debugTs) + System.out.println("www.CataolgoSvlt.showBean impression: ms: " + this.timer.getDurataMilliSec()); + if (getAct(req).equals("articolo")) { + super.showBean(req, res); + } else { + long l_id_articoloVariante = getRequestLongParameter(req, "id_articoloVariante"); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + Articolo articolo = new Articolo(getApFull(req)); + if (l_id_articolo == 0L && l_id_articoloVariante > 0L) { + ArticoloVariante av = new ArticoloVariante(getApFull(req)); + av.findByPrimaryKey(l_id_articoloVariante); + req.setAttribute("id_articolo", Long.valueOf(av.getId_articolo())); + } + if (l_id_articoloVariante == 0L && getTipo(req) != null && getTipo(req).getFlgUsaVarianti() == 1L) { + articolo.findByPrimaryKey(l_id_articolo); + if (articolo.getArticoloVarianteBase() == null) { + req.setAttribute("md", "search"); + req.setAttribute("CR", new ArticoloCR()); + setJspPage("/articoloNonTrovato.jsp", req); + callJsp(req, res); + } else { + req.setAttribute("id_articoloVariante", Long.valueOf(articolo.getArticoloVarianteBase().getId_articoloVariante())); + super.showBean(req, res); + } + } else { + req.removeAttribute("bean"); + super.showBean(req, res); + } + } + } + + protected void ajaxActions(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("aj_accessori")) { + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + long l_id_tipoAccessorio = getRequestLongParameter(req, "id_tipoAccessorio"); + long l_id_tipo = getRequestLongParameter(req, "id_tipo"); + Articolo bean = new Articolo(getApFull(req)); + bean.findByPrimaryKey(l_id_articolo); + ArticoloCR CR = new ArticoloCR(getApFull(req)); + fillObject(req, CR); + req.setAttribute("bean", bean); + req.setAttribute("CR", CR); + req.setAttribute("listaAccessori", bean.getAccessori(l_id_tipoAccessorio, l_id_tipo, 0L)); + setJspPageRelative("aj_accessori.jsp", req); + callJsp(req, res); + } else { + super.ajaxActions(req, res); + } + } + + protected void superShowBean(HttpServletRequest req, HttpServletResponse res) { + super.showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/LogonSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/LogonSvlt.java new file mode 100644 index 00000000..4abe25ea --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/LogonSvlt.java @@ -0,0 +1,56 @@ +package it.acxent.www.servlet; + +import it.acxent.common.Users; +import java.util.Properties; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@Deprecated +public class LogonSvlt extends it.acxent.servlet.LogonSvlt { + protected boolean checkLoginProfile(HttpServletRequest req) { + try { + if (getLoginUser(req) == null) { + forceJspPage(getLoginPage(req, null), req); + return true; + } + if (getLoginUser(req).getFlgValido().equals("N")) { + forceJspPage(getLoginPage(req, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return false; + } + if (getLoginUser(req).getId_userProfile() > 0L) { + forceJspPage(getLoginPage(req, null), req); + return true; + } + forceJspPage(getLoginPage(req, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return true; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + + protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) { + return getRequestParameter(req, "thePage"); + } + + protected Users getUser(HttpServletRequest req) { + return new it.acxent.anag.Users(getApFull(req)); + } + + protected void loginOK(HttpServletRequest req, HttpServletResponse res) throws Exception { + String url = "it.acxent.servlet.AcCartSvlt"; + Properties parm = new Properties(); + parm.setProperty("cmd", "updateCart"); + startRemoteCmd(getApFull(req), parm, url); + super.loginOK(req, res); + req.setAttribute("msg", ""); + } + + protected boolean useControlCodeAccess() { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/OrdineSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/OrdineSvlt.java new file mode 100644 index 00000000..667cfe56 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/OrdineSvlt.java @@ -0,0 +1,230 @@ +package it.acxent.www.servlet; + +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.Users; +import it.acxent.common.Access; +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.AbMessages; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class OrdineSvlt extends _WwwSvlt { + protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) { + Documento bean = (Documento)l_bean; + req.setAttribute("listaTipoPagamento", new TipoPagamento(getApFull(req)).findPagamentiWww(false, false)); + int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso)); + if (req.getAttribute("msg").equals("Lettura effettuata")) + req.setAttribute("msg", ""); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Documento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new DocumentoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected void payBonifico(HttpServletRequest req, HttpServletResponse res) { + try { + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id_documento); + bean.setDataPagamento(DBAdapter.getToday()); + ResParm rp = bean.save(); + String theMsg = ""; + if (rp.getStatus()); + } catch (Exception e) { + e.printStackTrace(); + forceMessage(req, e.getMessage()); + } + showBean(req, res); + } + + protected void payCc(HttpServletRequest req, HttpServletResponse res) { + try { + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id_documento); + long l_flgTipoPagamento = getRequestLongParameter(req, "flgTipoPagamento"); + ResParm rp = bean.save(); + String theMsg = ""; + req.setAttribute("bean", bean); + if (rp.getStatus()) { + forceJspPageRelative("DocumentoCc.jsp", req); + int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso)); + callJsp(req, res); + } + } catch (Exception e) { + e.printStackTrace(); + forceMessage(req, e.getMessage()); + showBean(req, res); + } + } + + protected void refreshPayment(HttpServletRequest req, HttpServletResponse res) { + try { + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id_documento); + long l_id_tipoPagamento = getRequestLongParameter(req, "id_tipoPagamento"); + bean.setId_tipoPagamento(l_id_tipoPagamento); + ResParm rp = bean.save(); + String theMsg = ""; + req.setAttribute("bean", bean); + forceJspPageRelative("Documento.jsp", req); + callJsp(req, res); + } catch (Exception e) { + e.printStackTrace(); + forceMessage(req, e.getMessage()); + showBean(req, res); + } + } + + protected void cancelOrder(HttpServletRequest req, HttpServletResponse res) { + try { + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id_documento); + bean.setFlgStatoOrdineWww(99L); + bean.setFlgStatoPrenotazione(100L); + ResParm rp = bean.save(); + String theMsg = ""; + req.setAttribute("bean", bean); + sendMessage(req, "Documento annullato"); + showBean(req, res); + } catch (Exception e) { + e.printStackTrace(); + forceMessage(req, e.getMessage()); + showBean(req, res); + } + } + + protected void sendMailOrder(HttpServletRequest req, HttpServletResponse res) { + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(getApFull(req)); + try { + bean.findByPrimaryKey(l_id); + rp = bean.sendOrderMailMessage(getLang(req), true, true, false); + sendMessage(req, rp.getMsg()); + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + } + showBean(req, res); + } + + protected String getCRAttribute(HttpServletRequest req) { + return "CROrd"; + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + DocumentoCR CR = new DocumentoCR(getApFull(req)); + fillObject(req, CR); + if (getLoginUserId(req) != null && getLoginUserId(req) > 0L) { + Users user = (Users)getLoginUser(req); + if (user.getId_clifor() == 0L) { + req.setAttribute("id_clifor", "-1"); + } else { + req.setAttribute("id_clifor", String.valueOf(user.getId_clifor())); + } + req.setAttribute("id_tipoDocumento", Long.valueOf(getParm("ID_DOC_ORDINE_WWW").getNumeroLong())); + if (CR.getFlgStatoPrenotazione() < 0L) + req.setAttribute("flgStatoPrenotazione", "0"); + req.setAttribute("id_users", "0"); + } + return new ResParm(true); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + String idCryptParm = "idcrypt"; + String l_id_ordineCript = (String)req.getSession().getAttribute(idCryptParm); + if (l_id_ordineCript != null && !l_id_ordineCript.isEmpty()) { + _vediOrdineCrypt(req, res); + } else { + String cmd = getCmd(req); + if (cmd.equals("payBon")) { + payBonifico(req, res); + } else if (cmd.equals("payCc")) { + payCc(req, res); + } else if (cmd.equals("refreshPayment")) { + refreshPayment(req, res); + } else if (cmd.equals("cancelOrder")) { + cancelOrder(req, res); + } else if (cmd.equals("sendMailOrder")) { + sendMailOrder(req, res); + } else { + search(req, res); + } + } + } + + protected void showBean(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_user = getLoginUserId(req); + Users user = new Users(apFull); + user.findByPrimaryKey(l_id_user); + long l_id_documento = getRequestLongParameter(req, "id_documento"); + Documento bean = new Documento(apFull); + bean.findByPrimaryKey(l_id_documento); + if (user.getId_users() > 0L && bean.getDBState() == 1 && user.getId_clifor() != bean.getId_clifor()) { + sendMessage(req, "Errore! Ordine Errato!!"); + req.setAttribute("id_documento", "0"); + search(req, res); + } else { + if (bean.getDBState() == 1 && bean.getId_tipoPagamento() == 4L && + bean.getFlgProcediPagamento() == 1L && bean.getDescTransaction().isEmpty()) + bean.agiornaNuovoId_documentoXpay(); + super.showBean(req, res); + } + } + + public void _vediOrdineCrypt(HttpServletRequest req, HttpServletResponse res) { + String idCryptParm = "idcrypt"; + String l_id_ordineCript = getRequestParameter(req, idCryptParm); + if (l_id_ordineCript.isEmpty() && req.getSession().getAttribute(idCryptParm) != null) + l_id_ordineCript = (String)req.getSession().getAttribute(idCryptParm); + if (!l_id_ordineCript.isEmpty()) { + long l_id_ordine = -1L; + try { + l_id_ordine = Long.parseLong(DBAdapter.deCrypt(l_id_ordineCript)); + } catch (Exception e) {} + if (l_id_ordine > 0L) { + if (getLoginUserId(req) == 0L) { + req.getSession().setAttribute(idCryptParm, l_id_ordineCript); + } else { + req.getSession().removeAttribute(idCryptParm); + } + req.setAttribute("id_documento", String.valueOf(l_id_ordine)); + req.setAttribute("cmd", "md"); + showBean(req, res); + } else { + search(req, res); + } + } + } + + protected String getBeanPageName(HttpServletRequest req) { + String temp = getBeanName(req); + Access access = new Access(getApFull(req)); + access.findByPrimaryKey(Access.convertFieldToTableName(temp)); + if (getRequestParameter(req, "sw").equals("1")) { + if (!access.getSuffissoE().isEmpty()) + return temp + temp + "E"; + return temp + "E"; + } + return temp; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/ResoSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/ResoSvlt.java new file mode 100644 index 00000000..a6ba43a1 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/ResoSvlt.java @@ -0,0 +1,76 @@ +package it.acxent.www.servlet; + +import it.acxent.contab.Documento; +import it.acxent.contab.DocumentoCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.AbMessages; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ResoSvlt extends _WwwSvlt { + protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) { + Documento bean = (Documento)l_bean; + int ordineInverso = (bean.getTipoDocumento().getFlgOrdinamentoRigheStampa() == 1L) ? 1 : 0; + req.setAttribute("righeDocumento", bean.findRigheDocumento(0, 0, ordineInverso)); + if (req.getAttribute("msg").equals("Lettura effettuata")) + req.setAttribute("msg", ""); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Documento(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new DocumentoCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected void sendMailReso(HttpServletRequest req, HttpServletResponse res) { + Documento bean = null; + ResParm rp = new ResParm(true, ""); + long l_id = getRequestLongParameter(req, "id_ordine"); + bean = new Documento(getApFull(req)); + try { + bean.findByPrimaryKey(l_id); + rp = bean.sendResoMailMessage(); + sendMessage(req, rp.getMsg()); + } catch (Exception e) { + forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + } + showBean(req, res); + } + + protected String getCRAttribute(HttpServletRequest req) { + return "CRRes"; + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + DocumentoCR CR = new DocumentoCR(getApFull(req)); + if (getLoginUserId(req) != null) + req.setAttribute("id_users", String.valueOf(getLoginUserId(req).longValue())); + return new ResParm(true); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + String cmd = getCmd(req); + if (cmd.equals("sendMailReso")) { + sendMailReso(req, res); + } else { + search(req, res); + } + } + + protected String getBeanPageName(HttpServletRequest req) { + return "reso"; + } + + protected ResParm afterSave(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) { + Documento bean = (Documento)l_bean; + return bean.sendResoMailMessage(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/RicevutaXpaySvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/RicevutaXpaySvlt.java new file mode 100644 index 00000000..69a4ff34 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/RicevutaXpaySvlt.java @@ -0,0 +1,55 @@ +package it.acxent.www.servlet; + +import it.acxent.bank.servlet.xpay.GetXpayResponseSvlt; +import it.acxent.bank.xpay.XpayResp; +import it.acxent.contab.Documento; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class RicevutaXpaySvlt extends GetXpayResponseSvlt { + private static final long serialVersionUID = 8927367451552445757L; + + protected void preparePaymenResPage(HttpServletRequest req, HttpServletResponse res, XpayResp xpRes) { + String l_id_documentoXpay; + if (xpRes.getCodTrans() != null && !xpRes.getCodTrans().isEmpty()) { + l_id_documentoXpay = xpRes.getCodTrans(); + } else { + l_id_documentoXpay = (String)req.getSession().getAttribute("id_documentoXpay"); + } + Documento bean = new Documento(getApFull(req)); + bean.findByDocumentoXpay(l_id_documentoXpay); + req.setAttribute("bean", bean); + } + + protected void recordOrder(HttpServletRequest req, HttpServletResponse res, XpayResp xpRes) { + if (xpRes != null && xpRes.getEsito().equals("OK")) { + String l_id_documentoXpay = xpRes.getCodTrans(); + Documento bean = new Documento(getApFull(req)); + bean.findByDocumentoXpay(l_id_documentoXpay); + bean.setDataTransaction(DBAdapter.getToday()); + bean.setDataPagamento(DBAdapter.getToday()); + bean.setDescTransaction(xpRes.getCodAut()); + ResParm rp = bean.save(); + rp.append(bean.sendOrderMailMessage(getLang(req), true, true, false)); + req.setAttribute("id_documento", String.valueOf(bean.getId_documento())); + bean.setFlgOrdineWwwAppenaPagato(1L); + req.setAttribute("bean", bean); + if (rp.getStatus()) { + forceMessage(req, "L'ordine è stato pagato regolarmente."); + } else { + forceMessage(req, "Errore! L'ordine risulta pagato ma è stato impossibile aggiornare lo stato. Contattare l'amministratore del sito."); + } + } + } + + protected void resetId_documentoXpay(HttpServletRequest req, HttpServletResponse res, XpayResp xpRes) { + if (xpRes != null) { + String l_id_documentoXpay = xpRes.getCodTrans(); + Documento bean = new Documento(getApFull(req)); + bean.findByDocumentoXpay(l_id_documentoXpay); + bean.agiornaNuovoId_documentoXpay(); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/ShowOrdineSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/ShowOrdineSvlt.java new file mode 100644 index 00000000..8022b63c --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/ShowOrdineSvlt.java @@ -0,0 +1,40 @@ +package it.acxent.www.servlet; + +import it.acxent.anag.Users; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ShowOrdineSvlt extends OrdineSvlt { + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + _vediOrdineCrypt(req, res); + } + + public void _vediOrdineCrypt(HttpServletRequest req, HttpServletResponse res) { + String l_id_userCript = getRequestParameter(req, "uc"); + if (l_id_userCript.isEmpty()) { + super._vediOrdineCrypt(req, res); + } else { + String l_login = DBAdapter.deCrypt(l_id_userCript); + if (!l_login.isEmpty()) { + ApplParmFull apFull = getApFull(req); + Users user = new Users(apFull); + user.findByLogin(l_login); + if (user.getId_users() == 0L) + user.findByEmail(l_login); + if (user.isNoReg()) { + String ip = req.getRemoteHost(); + user.setCurrentIp(ip); + req.getSession().setAttribute("utenteLogon", user); + req.getSession().setAttribute("loginUser_id", new Long(user.getId_users())); + super._vediOrdineCrypt(req, res); + } else { + search(req, res); + } + } else { + search(req, res); + } + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/UsersSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/UsersSvlt.java new file mode 100644 index 00000000..60041e4a --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/UsersSvlt.java @@ -0,0 +1,384 @@ +package it.acxent.www.servlet; + +import it.acxent.anag.Cliente; +import it.acxent.anag.Clifor; +import it.acxent.anag.DestinazioneDiversa; +import it.acxent.anag.Nazione; +import it.acxent.anag.NazioneCR; +import it.acxent.anag.Users; +import it.acxent.anag.UsersCR; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.CodiceFiscale; +import it.acxent.util.Vectumerator; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class UsersSvlt extends _WwwSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) { + NazioneCR nCR = new NazioneCR(); + nCR.setLang(getLang(req)); + req.setAttribute("listaNazioni", new Nazione(getApFull(req)).findAllAttive(getLang(req))); + if (req.getAttribute("msg").equals("Lettura effettuata")) + req.setAttribute("msg", ""); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Users(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new UsersCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + NazioneCR nCR = new NazioneCR(); + nCR.setLang(getLang(req)); + req.setAttribute("listaNazioni", new Nazione(getApFull(req)).findAllAttive(getLang(req))); + sendMessage(req, ""); + Users bean = new Users(getApFull(req)); + bean.setFlgMl(1L); + bean.setId_userProfile(bean.getIdUserProfileWww()); + bean.setCallingJsp(getRequestParameter(req, "callingJsp")); + req.setAttribute("bean", bean); + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + protected String getBeanPageName(HttpServletRequest req) { + return super.getBeanPageName(req); + } + + protected String getCmd(HttpServletRequest req) { + if (super.getCmd(req).isEmpty()) + return "ni"; + return super.getCmd(req); + } + + protected String newDispathcerAfterShowBean(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Users bean = (Users)beanA; + bean.setCallingJsp(getRequestParameter(req, "callingJsp")); + req.setAttribute("bean", bean); + return ""; + } + + private boolean mailConfermaCambiamentoDati(HttpServletRequest req, Users bean) { + return bean.sendUserDataMailMessage().getStatus(); + } + + protected String getRegistrazioneMailMessage() { + return getParm("MAIL_REG").getTesto(); + } + + protected void sqlActions(HttpServletRequest req, HttpServletResponse res) { + Users bean = new Users(getApFull(req)); + fillObject(req, bean); + Cliente cli = new Cliente(getApFull(req)); + fillObject(req, cli); + DestinazioneDiversa dd = new DestinazioneDiversa(getApFull(req)); + fillObject(req, dd); + cli.setCurrentDD(dd); + bean.setClifor(cli); + String msg = "Impossibile Registrare un nuovo utente:"; + if (bean.isLogonDuplicated()) { + msg = msg + " Login già presente in archivio"; + forceMessage(req, msg); + setJspPageRelative(getBeanPageName(req) + ".jsp", req); + fillComboAfterDetail((DBAdapter)bean, req, res); + req.setAttribute("bean", bean); + callJsp(req, res); + } else if (bean.getEMail().isEmpty()) { + msg = msg + " Email non valida"; + forceMessage(req, msg); + setJspPageRelative(getBeanPageName(req) + ".jsp", req); + fillComboAfterDetail((DBAdapter)bean, req, res); + req.setAttribute("bean", bean); + callJsp(req, res); + } else if (bean.isEmailDuplicated()) { + Users userMl = new Users(getApFull(req)); + userMl.findUsersByEmail(bean.getEMail()); + if (userMl.getId_userProfile() == bean.getIdUserProfileMailingList()) { + req.setAttribute("id_users", String.valueOf(userMl.getId_users())); + req.setAttribute("flgValido", "S"); + req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww())); + saveUserAndClifor(req, res); + } else { + msg = msg + " Email già presente in archivio"; + forceMessage(req, msg); + setJspPageRelative(getBeanPageName(req) + ".jsp", req); + fillComboAfterDetail((DBAdapter)bean, req, res); + req.setAttribute("bean", bean); + callJsp(req, res); + } + } else if (cli.isCodFiscDuplicated()) { + msg = msg + " Codice Fiscale già presente in archivio"; + forceMessage(req, msg); + fillComboAfterDetail((DBAdapter)bean, req, res); + setJspPageRelative(getBeanPageName(req) + ".jsp", req); + req.setAttribute("bean", bean); + callJsp(req, res); + } else if (cli.isPIvaDuplicated()) { + msg = msg + " Partita Iva già presente in archivio"; + forceMessage(req, msg); + fillComboAfterDetail((DBAdapter)bean, req, res); + setJspPageRelative(getBeanPageName(req) + ".jsp", req); + req.setAttribute("bean", bean); + callJsp(req, res); + } else if (!cli.getCodFisc().isEmpty() && !CodiceFiscale.controlloFormale(cli.getCodFisc())) { + msg = msg + " Il codice fiscale non è valido:"; + forceMessage(req, msg); + fillComboAfterDetail((DBAdapter)bean, req, res); + setJspPageRelative(getBeanPageName(req) + ".jsp", req); + bean.setClifor(cli); + req.setAttribute("bean", bean); + callJsp(req, res); + } else if (!cli.getPIva().isEmpty() && cli.getPIva().length() != 11) { + msg = msg + " Partita iva non valida:"; + forceMessage(req, msg); + fillComboAfterDetail((DBAdapter)bean, req, res); + setJspPageRelative(getBeanPageName(req) + ".jsp", req); + bean.setClifor(cli); + req.setAttribute("bean", bean); + callJsp(req, res); + } else { + req.setAttribute("flgValido", "S"); + req.setAttribute("id_userProfile", Long.valueOf(bean.getIdUserProfileWww())); + saveUserAndClifor(req, res); + } + } + + protected void recordMailingList(HttpServletRequest req, HttpServletResponse res) { + String lang = getLang(req); + Users bean = new Users(getApFull(req)); + fillObject(req, bean); + ResParm rp = new ResParm(); + String msg = bean.translate("Impossibile Registrare utente ML:", lang); + if (bean.isEmailDuplicated()) { + msg = msg + " " + msg + " - " + bean.translate("Email già presente in archivio", lang); + rp.setStatus(false); + rp.setMsg(msg); + if (bean.isEmailDuplicatedNoMl()) { + rp.setErrorCode(1L); + } else { + rp.setErrorCode(2L); + } + req.setAttribute("RP", rp); + forceJspPageRelative("mailingListUser.jsp", req); + callJsp(req, res); + } else { + bean.setFlgValido("N"); + bean.setFlgMl(1L); + bean.setId_userProfile(bean.getIdUserProfileMailingList()); + bean.setLangMl(getRequestParameter(req, "langMl")); + bean.setLogin("ML_" + bean.getEMail()); + bean.setCognome("MLC_" + bean.getEMail()); + bean.setNome("MLN_" + bean.getEMail()); + if (bean.getLogin().length() > 30) + bean.setLogin(bean.getLogin().substring(0, 30)); + if (bean.getCognome().length() > 30) + bean.setCognome(bean.getCognome().substring(0, 30)); + if (bean.getNome().length() > 30) + bean.setNome(bean.getNome().substring(0, 30)); + rp = bean.save(); + if (rp.getStatus()) + bean.sendMLMailMessageOLD(req.getRemoteHost() + " " + req.getRemoteHost()); + forceJspPageRelative("mailingListUser.jsp", req); + callJsp(req, res); + } + } + + protected void checkCc(HttpServletRequest req, HttpServletResponse res) { + Users bean = new Users(getApFull(req)); + fillObject(req, bean); + ResParm rp = new ResParm(); + String msg = "Impossibile Registrare utente ML:"; + if (bean.isEmailDuplicated()) { + msg = msg + " Email già presente in archivio - " + msg; + rp.setStatus(false); + rp.setMsg(msg); + if (bean.isEmailDuplicatedNoMl()) { + rp.setErrorCode(1L); + } else { + rp.setErrorCode(2L); + } + req.setAttribute("RP", rp); + forceJspPageRelative("mailingListUser.jsp", req); + callJsp(req, res); + } else { + bean.setFlgValido("N"); + bean.setFlgMl(1L); + bean.setId_userProfile(bean.getIdUserProfileMailingList()); + bean.setLogin("ML_" + bean.getEMail()); + bean.setCognome("MLC_" + bean.getEMail()); + bean.setNome("MLN_" + bean.getEMail()); + rp = bean.save(); + if (rp.getStatus()) + bean.sendMLMailMessageOLD(req.getRemoteHost() + " " + req.getRemoteHost()); + forceJspPageRelative("mailingListUser.jsp", req); + callJsp(req, res); + } + } + + protected it.acxent.common.Users getUser(HttpServletRequest req) { + return new Users(getApFull(req)); + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + String msg; + Users bean = (Users)beanA; + long l_id_user = getRequestLongParameter(req, "id_users"); + if (bean.getDBState() == 1) { + msg = "Salvataggio effettuato"; + req.getSession().setAttribute("utenteLogon", bean); + req.getSession().setAttribute("loginUser_id", new Long(bean.getId_users())); + if (l_id_user == 0L) { + if (!mailConfermaCambiamentoDati(req, bean)) { + msg = msg + " Attenzione!! Impossibile mandare email di conferma."; + bean.setFlgEmailOk(0L); + } else { + msg = msg + " Inviata mail di conferma."; + bean.setFlgEmailOk(1L); + } + } else { + bean.setFlgEmailOk(1L); + } + setJspPageRelative(getBeanPageName(req) + "Reg.jsp", req); + } else { + msg = "ERRORE!. Non è stato possibile salvare. Contattare l'amministratore o immettere login diverso"; + } + forceMessage(req, msg); + return new ResParm(true); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("ML")) { + recordMailingList(req, res); + } else if (getCmd(req).equals("checkCC")) { + recordMailingList(req, res); + } else if (getCmd(req).equals("checkUCF")) { + checkUserCF(req, res); + } else { + super.otherCommands(req, res); + } + } + + protected void saveUserAndClifor(HttpServletRequest req, HttpServletResponse res) { + Users user = new Users(getApFull(req)); + long l_id_users = getRequestLongParameter(req, "id_users"); + user.findByPrimaryKey(l_id_users); + fillObject(req, user); + Clifor cliente = user.getClifor(); + fillObject(req, cliente); + String nominativo = getRequestParameter(req, "nominativo"); + if (!nominativo.isEmpty()) { + cliente.setFlgAzienda(1L); + cliente.setCognome(nominativo); + cliente.setNome(""); + } + cliente.setFlgTipo("C"); + ResParm rp = cliente.save(); + if (rp.getStatus()) { + DestinazioneDiversa dd = cliente.getCurrentDD(); + fillObject(req, dd); + if (dd.getIndirizzoDD().isEmpty()) { + if (dd.getId_destinazioneDiversa() != 0L) + rp.append(dd.delete()); + } else { + dd.setId_clifor(cliente.getId_clifor()); + dd.setFlgDDDefault(1L); + dd.setDescrizioneDD("Sped. WWW"); + rp.append(dd.save()); + } + } + if (rp.getStatus()) { + user.setId_clifor(cliente.getId_clifor()); + if (user.getId_userProfile() == 0L) + user.setId_userProfile(user.getIdUserProfileWww()); + user.setFlgValido("S"); + rp.append(user.save()); + } + if (rp.getStatus()) { + afterSave((DBAdapter)user, req, res); + sendMessage(req, "Record salvato correttamente"); + setJspPage("/usersReg.jsp", req); + } else { + sendMessage(req, "Impossibile salvare: " + rp.getMsg()); + setJspPage("/users.jsp", req); + req.setAttribute("listaNazioni", new Nazione(getApFull(req)).findAllAttive(getLang(req))); + } + req.setAttribute("bean", user); + callJsp(req, res); + } + + protected void checkUserCF(HttpServletRequest req, HttpServletResponse res) { + String l_cf = getRequestParameter(req, "codFiscR"); + ResParm rp = new ResParm(true); + if (l_cf.isEmpty()) { + rp.setStatus(false); + rp.setMsg("Codice Fiscale errato!"); + } else { + Clifor clifor = new Clifor(getApFull(req)); + clifor.findByCF(l_cf, "C"); + if (clifor.getDBState() == 0) { + rp.setStatus(false); + rp.setMsg("Il Codice Fiscale richiesto non è nei nostri database. "); + } else if (clifor.getDBState() == 1 && clifor.getEMail().isEmpty()) { + rp.setStatus(false); + rp.setMsg("Il Codice Fiscale è nei nostri database ma l'indirizzo email non è stato comunicato."); + } else { + Users user = new Users(getApFull(req)); + Vectumerator vec = user.findByClifor(clifor.getId_clifor(), 1, 1); + if (vec.getTotNumberOfRecords() == 0) { + user.setCognome(clifor.getCognome()); + user.setNome(clifor.getNome()); + if (clifor.getFlgAzienda() == 1L) + user.setNominativo(clifor.getCognome()); + user.setFlgValido("S"); + user.setId_userProfile(10L); + user.setId_clifor(clifor.getId_clifor()); + user.setEMail(clifor.getEMail()); + if (!clifor.getCellulare().isEmpty()) { + user.setTelefono(clifor.getCellulare()); + } else { + user.setTelefono(clifor.getTelefono()); + } + user.setLogin(user.getEMail()); + user.setPwd(String.valueOf(Math.random() * 1000000.0D).substring(0, 6)); + rp = user.save(); + if (rp.getStatus()) { + rp = user.sendUserDataMailMessage(); + if (rp.getStatus()) + rp.setMsg("Utente creato correttamente. Una Mail ti è stata inviata all'indirizzo email " + user.getEMail()); + } else { + rp.setStatus(false); + rp.setMsg("Utente creato correttamente ma non è stato possibile inviare l'email di conferma."); + } + } else { + rp.setStatus(false); + rp.setMsg("Attenzione! Il codice fiscale è nei nostri database ma esiste già un utente web associato. Richiedi i dati di accesso attraverso il recupero del login tramite indirizzo email."); + } + } + } + if (rp.getStatus()) { + forceJspPage("/usersReg.jsp", req); + } else { + forceJspPage("/usersRegError.jsp", req); + } + sendMessage(req, rp.getMsg()); + callJsp(req, res); + } + + protected void showBean(HttpServletRequest req, HttpServletResponse res) { + long l_id_usersDoc = getRequestLongParameter(req, "id_usersDoc"); + if (l_id_usersDoc > 0L) + req.setAttribute("id_users", Long.valueOf(l_id_usersDoc)); + super.showBean(req, res); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/WishlistSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/WishlistSvlt.java new file mode 100644 index 00000000..2b93d898 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/WishlistSvlt.java @@ -0,0 +1,174 @@ +package it.acxent.www.servlet; + +import com.google.gson.JsonObject; +import it.acxent.anag.Users; +import it.acxent.art.Wishlist; +import it.acxent.art.WishlistCR; +import it.acxent.contab.DocumentoCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class WishlistSvlt extends _WwwSvlt { + protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Wishlist(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new WishlistCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected String getCRAttribute(HttpServletRequest req) { + return "CRWL"; + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + DocumentoCR CR = new DocumentoCR(getApFull(req)); + if (getLoginUserId(req) != null) + req.setAttribute("id_users", String.valueOf(getLoginUserId(req).longValue())); + return new ResParm(true); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + search(req, res); + } + + protected String getBeanPageName(HttpServletRequest req) { + return super.getBeanPageName(req); + } + + public void _addToWishlist(HttpServletRequest req, HttpServletResponse res) { + Users user = (Users)getLoginUser(req); + ApplParmFull apFull = getApFull(req); + if (user.getId_users() > 0L) { + Wishlist wl = new Wishlist(apFull); + fillObject(req, wl); + ResParm rp = user.addArticoloToWishlist(wl, getLang(req)); + JsonObject jObj = new JsonObject(); + jObj.addProperty("id", Long.valueOf(wl.getId_articolo())); + if (rp.getStatus()) { + jObj.addProperty("type", "success"); + jObj.addProperty("msg", rp.getMsg()); + } else { + jObj.addProperty("type", "success"); + jObj.addProperty("msg", rp.getMsg()); + } + System.out.println(jObj.toString()); + sendHtmlMsgResponse(req, res, jObj.toString()); + } else { + user.setApFull(apFull); + JsonObject jObj = new JsonObject(); + jObj.addProperty("type", "warning"); + jObj.addProperty("msg", user.translate("Per utilizzare la tua Wish List, devi registrarti.", getLang(req))); + sendHtmlMsgResponse(req, res, jObj.toString()); + } + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + long l_id_user = getLoginUserId(req); + if (l_id_user > 0L) { + Wishlist wl = new Wishlist(apFull); + req.setAttribute("listWL", wl.findByUser(l_id_user, false)); + } + callJsp(req, res); + } + + public void _removeFromWishlist(HttpServletRequest req, HttpServletResponse res) { + Users user = (Users)getLoginUser(req); + ApplParmFull apFull = getApFull(req); + long l_id_articolo = getRequestLongParameter(req, "id_articolo"); + if (user.getId_users() > 0L) { + ResParm rp; + Wishlist wl = new Wishlist(apFull); + fillObject(req, wl); + wl.findByUserItem(user.getId_users(), wl); + if (wl.getId_wishlist() > 0L) { + rp = wl.delete(); + if (rp.getStatus()) + rp.setMsg(wl.translate("Elemento tolto dalla Wish List", getLang(req))); + } else { + rp = new ResParm(false, wl.translate("Errore! Elemento non più in Wish List", getLang(req))); + } + JsonObject jObj = new JsonObject(); + jObj.addProperty("id", Long.valueOf(l_id_articolo)); + if (rp.getStatus()) { + jObj.addProperty("type", "success"); + jObj.addProperty("msg", rp.getMsg()); + } else { + jObj.addProperty("type", "success"); + jObj.addProperty("msg", rp.getMsg()); + } + System.out.println(jObj.toString()); + sendHtmlMsgResponse(req, res, jObj.toString()); + } else { + user.setApFull(apFull); + JsonObject jObj = new JsonObject(); + jObj.addProperty("type", "warning"); + jObj.addProperty("msg", user.translate("Per utilizzare la tua Wish List, devi registrarti.", getLang(req))); + sendHtmlMsgResponse(req, res, jObj.toString()); + } + } + + public void _removeFromWishlistWl(HttpServletRequest req, HttpServletResponse res) { + Users user = (Users)getLoginUser(req); + ApplParmFull apFull = getApFull(req); + if (user.getId_users() > 0L) { + ResParm rp; + Wishlist wl = new Wishlist(apFull); + long l_id = getRequestLongParameter(req, "id_wishlist"); + wl.findByPrimaryKey(l_id); + if (wl.getId_wishlist() > 0L) { + rp = wl.delete(); + if (rp.getStatus()) + rp.setMsg(wl.translate("Elemento tolto dalla Wish List", getLang(req))); + } else { + rp = new ResParm(false, wl.translate("Errore! Elemento non più in Wish List", getLang(req))); + } + JsonObject jObj = new JsonObject(); + jObj.addProperty("id", Long.valueOf(l_id)); + if (rp.getStatus()) { + jObj.addProperty("type", "success"); + jObj.addProperty("msg", rp.getMsg()); + } else { + jObj.addProperty("type", "success"); + jObj.addProperty("msg", rp.getMsg()); + } + System.out.println(jObj.toString()); + sendHtmlMsgResponse(req, res, jObj.toString()); + } else { + user.setApFull(apFull); + JsonObject jObj = new JsonObject(); + jObj.addProperty("type", "warning"); + jObj.addProperty("msg", user.translate("Per utilizzare la tua Wish List, devi registrarti.", getLang(req))); + sendHtmlMsgResponse(req, res, jObj.toString()); + } + } + + public void _notificheToggle(HttpServletRequest req, HttpServletResponse res) { + Users user = (Users)getLoginUser(req); + ApplParmFull apFull = getApFull(req); + if (user.getId_users() > 0L) { + Wishlist wl = new Wishlist(apFull); + long l_id = getRequestLongParameter(req, "id_wishlist"); + wl.findByPrimaryKey(l_id); + if (wl.getId_wishlist() > 0L) { + wl.setFlgAbilitaAvviso((wl.getFlgAbilitaAvviso() == 0L) ? 1L : 0L); + ResParm rp = wl.save(); + if (rp.getStatus()) + rp.setMsg(wl.translate("Notifica aggiornata su Wish List", getLang(req))); + } else { + ResParm resParm = new ResParm(false, wl.translate("Errore! Elemento non più in Wish List", getLang(req))); + } + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/XpaySvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/XpaySvlt.java new file mode 100644 index 00000000..0d67b152 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/XpaySvlt.java @@ -0,0 +1,11 @@ +package it.acxent.www.servlet; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class XpaySvlt extends it.acxent.bank.servlet.xpay.XpaySvlt { + protected void prepareSendRequest(HttpServletRequest req, HttpServletResponse res) { + long l_id_documentoXpay = getRequestLongParameter(req, "id_documentoXpay"); + req.getSession().setAttribute("id_documentoXpay", new Long(l_id_documentoXpay)); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/_WwwSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/_WwwSvlt.java new file mode 100644 index 00000000..d9820080 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/_WwwSvlt.java @@ -0,0 +1,69 @@ +package it.acxent.www.servlet; + +import it.acxent.cart.Cart; +import it.acxent.common.Users; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class _WwwSvlt extends AblServletSvlt { + protected boolean checkLoginProfile(HttpServletRequest req) { + try { + if (getLoginUser(req) == null) { + forceJspPage(getLoginPage(null, null), req); + return true; + } + if (getLoginUser(req).getFlgValido().equals("N")) { + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return false; + } + if (getLoginUser(req).getId_userProfile() > 0L) + return true; + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return true; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + + protected long checkProfile(HttpServletRequest req, String l_permesso) { + return 3L; + } + + protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) { + return "Registra.abl"; + } + + protected Users getUser(HttpServletRequest req) { + return new it.acxent.anag.Users(getApFull(req)); + } + + protected boolean useAlwaysSendRedirect() { + return true; + } + + protected boolean isSecureServlet(HttpServletRequest req) { + return false; + } + + public String getPathImgArticoli() { + return getDocBase() + "/" + getDocBase(); + } + + protected double getDeliveryCost(HttpServletRequest req) { + return getParm(Cart.P_DELIVERY_COST).getNumeroDouble(); + } + + protected double getDeliveryWarnCost(HttpServletRequest req) { + return getParm(Cart.P_DELIVERY_WARN_COST).getNumeroDouble(); + } + + protected double getMoreCost(HttpServletRequest req) { + return getParm(Cart.P_MORE_COST).getNumeroDouble(); + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/admin/DocumentoOrdSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/admin/DocumentoOrdSvlt.java new file mode 100644 index 00000000..7a330731 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/admin/DocumentoOrdSvlt.java @@ -0,0 +1,117 @@ +package it.acxent.www.servlet.admin; + +import it.acxent.anag.Iva; +import it.acxent.anag.TipoPagamento; +import it.acxent.anag.TipoPagamentoCR; +import it.acxent.anag.Vettore; +import it.acxent.contab.Documento; +import it.acxent.contab.RigaDocumento; +import it.acxent.contab.TipoDocumento; +import it.acxent.contab.servlet.DocumentoSvlt; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class DocumentoOrdSvlt extends DocumentoSvlt { + protected String getBeanPageName(HttpServletRequest req) { + return "documentoOrd"; + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Documento bean = (Documento)beanA; + super.fillComboAfterDetail(beanA, req, res); + } + + protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ResParm rp = new ResParm(true); + return rp; + } + + protected ResParm beforeSearch(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("id_tipoDocumento", String.valueOf(getId_docOrdine())); + return new ResParm(true); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) { + req.setAttribute("nf4", getNf4()); + Documento bean = new Documento(getApFull(req)); + bean.setId_tipoDocumento(getId_docOrdineWww()); + bean.setFlgStato(1L); + bean.setId_tipoPagamento(1L); + req.setAttribute("bean", bean); + req.setAttribute("listaTipoPagamento", new TipoPagamento(getApFull(req)) + .findByCR(new TipoPagamentoCR(), 0, 0)); + req.setAttribute("listaVettore", new Vettore(getApFull(req)).findAll()); + req.setAttribute("listaTipoDocumento", new TipoDocumento( + getApFull(req)).findAll()); + req.setAttribute("listaIva", new Iva(getApFull(req)).findAll()); + RigaDocumento bean2 = new RigaDocumento(getApFull(req)); + bean2.setId_iva(getParm("CODICE_IVA_STD_VEND").getNumeroLong()); + req.setAttribute("bean2", bean2); + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("aggionraSRCR")) { + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + long l_flgStatoRiparazione = getRequestLongParameter(req, "flgStatoRiparazioneS"); + ResParm rp = new ResParm(); + if (bean.getDBState() == 0) { + rp.setStatus(false); + rp.setMsg("Errore! Codice documento non valido"); + } else { + rp = bean.aggiornaStatoRiparazione(l_flgStatoRiparazione); + } + if (rp.getStatus()) { + sendMessage(req, "Stato Riparazione aggiornato."); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } else if (getCmd(req).equals("inviaAvviso")) { + Documento bean = null; + long l_id = getRequestLongParameter(req, "id_documento"); + bean = new Documento(getApFull(req)); + bean.findByPrimaryKey(l_id); + ResParm rp = new ResParm(); + if (bean.getDBState() == 0) { + rp.setStatus(false); + rp.setMsg("Errore! Codice documento non valido"); + } else { + rp = bean.sendAvvisoRiparazione(); + } + if (rp.getStatus()) { + sendMessage(req, "Avviso inviato correttamente."); + } else { + sendMessage(req, rp.getMsg()); + } + search(req, res); + } else { + search(req, res); + } + } + + protected void mail(HttpServletRequest req, HttpServletResponse res) { + Documento ordine = (Documento)getBeanByRequest(req, res); + if (getAct(req).equals("reso")) { + ResParm rp = ordine.sendResoMailMessage(); + if (!rp.getStatus()) + forceMessage(req, rp.getMsg()); + } else { + super.mail(req, res); + } + showBean(req, res); + } + + protected String actionsAfterShowBean(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Documento bean = (Documento)beanA; + if (getAct2(req).equals("copiaDatiSped")) { + bean.save(); + req.setAttribute("bean", bean); + } + return ""; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/admin/PromozioneSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/admin/PromozioneSvlt.java new file mode 100644 index 00000000..03d6f17b --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/admin/PromozioneSvlt.java @@ -0,0 +1,36 @@ +package it.acxent.www.servlet.admin; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.www.Promozione; +import it.acxent.www.PromozioneCR; +import it.acxent.www.PromozioneUser; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class PromozioneSvlt extends _WwwAdminSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + ApplParmFull apFull = getApFull(req); + Promozione bean = (Promozione)beanA; + req.setAttribute("listaPromozioneUser", new PromozioneUser(apFull).findByPromozione(bean.getId_promozione())); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Promozione(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new PromozioneCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/admin/SitemapSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/admin/SitemapSvlt.java new file mode 100644 index 00000000..936eb3d6 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/admin/SitemapSvlt.java @@ -0,0 +1,67 @@ +package it.acxent.www.servlet.admin; + +import it.acxent.art.ArticoloCR; +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.www.Sitemap; +import it.acxent.www.SitemapCR; +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +@WebServlet(urlPatterns = {"/admin/www/Sitemap.abl"}) +public class SitemapSvlt extends AblServletSvlt { + private static final long serialVersionUID = -7155797701296961670L; + + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Sitemap(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new SitemapCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + protected boolean isLoadImageServlet() { + return false; + } + + public void _creaFileSitemapXml(HttpServletRequest req, HttpServletResponse res) { + try { + ApplParmFull apFull = getApFull(req); + SitemapCR CR = new SitemapCR(apFull); + fillObject(req, CR); + ArticoloCR ACR = new ArticoloCR(apFull); + CR.setACR(ACR); + CR.setSitemapFilename(CR.getSitemapFilename()); + CR.setLang(CR.getLangSitemap()); + CR.setFlgSitemapType(CR.getFlgSitemapType()); + ResParm rp = new Sitemap(getApFull(req)).creaFileXmlSitemap(CR); + if (rp.getStatus()) { + StringBuilder sb = new StringBuilder(); + String temp = (String)rp.getReturnObj(); + sb.append("File " + temp + "
"); + sendHtmlMsgResponse(req, res, sb.toString()); + } else { + sendHtmlMsgResponse(req, res, "ERRORE! " + rp.getMsg()); + } + } catch (Exception e) { + e.printStackTrace(); + sendHtmlMsgResponse(req, res, "ERRORE! " + e.getMessage()); + } + } +} diff --git a/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/admin/_WwwAdminSvlt.java b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/admin/_WwwAdminSvlt.java new file mode 100644 index 00000000..35f3f145 --- /dev/null +++ b/decompiled-libs/www/acxent-common-1.0.1/it/acxent/www/servlet/admin/_WwwAdminSvlt.java @@ -0,0 +1,77 @@ +package it.acxent.www.servlet.admin; + +import it.acxent.common.Users; +import it.acxent.db.ApplParm; +import it.acxent.db.ApplParmFull; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public abstract class _WwwAdminSvlt extends AblServletSvlt { + protected static ApplParmFull ap2; + + protected boolean checkLoginProfile(HttpServletRequest req) { + try { + if (getLoginUser(req) == null) { + forceJspPage(getLoginPage(null, null), req); + return true; + } + if (getLoginUser(req).getFlgValido().equals("N")) { + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return false; + } + if (getLoginUser(req).getId_userProfile() > 0L) + return true; + forceJspPage(super.getLoginPage(null, null), req); + req.getSession().removeAttribute("loginUser_id"); + req.getSession().removeAttribute("utenteLogon"); + return true; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + + protected long getLoginUserGrant(HttpServletRequest req, String l_permesso) { + if (isSecureServlet(req)) + try { + return getLoginUser(req).getGrantType(l_permesso); + } catch (Exception e) { + handleDebug(e); + return 0L; + } + return 4L; + } + + protected String getAct3(HttpServletRequest req) { + return getRequestParameter(req, "act3"); + } + + protected String getCmd3(HttpServletRequest req) { + return getRequestParameter(req, "cmd3"); + } + + protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) { + return super.getLoginPage(req, res); + } + + protected Users getUser(HttpServletRequest req) { + return new it.acxent.anag.Users(getApFull(req)); + } + + protected boolean useAlwaysSendRedirect() { + return true; + } + + protected ApplParmFull getAp2() { + if (ap2 == null) { + ApplParmFull apFull = getApFull(); + ApplParm apx = new ApplParm(apFull.getParm("DBDRIVER2").getNumeroInt(), apFull.getParm("DBNAME2").getTesto(), + apFull.getParm("USER2").getTesto(), apFull.getParm("PASSWORD2").getTesto()); + ap2 = new ApplParmFull(apx); + } + return ap2; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/META-INF/MANIFEST.MF b/decompiled-libs/www/acxent-core-1.0.1/META-INF/MANIFEST.MF new file mode 100644 index 00000000..138f4f61 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/META-INF/MANIFEST.MF @@ -0,0 +1,6 @@ +Manifest-Version: 1.0 +Created-By: Maven Jar Plugin 3.2.0 +Build-Jdk-Spec: 17 +Implementation-Title: Acxent Core Library +Implementation-Version: 1.0.1 + diff --git a/decompiled-libs/www/acxent-core-1.0.1/META-INF/maven/it.acxent/acxent-core/pom.properties b/decompiled-libs/www/acxent-core-1.0.1/META-INF/maven/it.acxent/acxent-core/pom.properties new file mode 100644 index 00000000..e96876ef --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/META-INF/maven/it.acxent/acxent-core/pom.properties @@ -0,0 +1,3 @@ +artifactId=acxent-core +groupId=it.acxent +version=1.0.1 diff --git a/decompiled-libs/www/acxent-core-1.0.1/META-INF/maven/it.acxent/acxent-core/pom.xml b/decompiled-libs/www/acxent-core-1.0.1/META-INF/maven/it.acxent/acxent-core/pom.xml new file mode 100644 index 00000000..ae5eb2ff --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/META-INF/maven/it.acxent/acxent-core/pom.xml @@ -0,0 +1,362 @@ + + 4.0.0 + it.acxent + acxent-core + 1.0.1 + Acxent Core Library + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + 11 + 11 + + + + org.apache.maven.plugins + maven-dependency-plugin + 3.7.0 + + + org.apache.maven.plugins + maven-toolchains-plugin + 3.1.0 + + + + toolchain + + + + + + + 11 + + + + + + org.apache.maven.plugins + maven-jar-plugin + 3.2.0 + + + + true + + + + + + + + + + + + true + always + fail + + OneBusWay + OneBusWay + http://nexus.onebusaway.org/nexus/content/repositories/public/ + default + + + + true + always + fail + + github-repo + https://maven.pkg.github.com/acolzi/repo + + true + + default + + + + + github-repo + GitHub acolzi Apache Maven Packages + https://maven.pkg.github.com/acolzi/repo + + + + + org.apache.poi + poi-excelant + 5.2.3 + pom.sha512 + + + org.apache.httpcomponents + httpclient + 4.5.14 + + + commons-fileupload + commons-fileupload + 1.5 + + + org.json + json + 20230618 + + + com.google.code.gson + gson + 2.10.1 + + + org.apache.pdfbox + pdfbox + 2.0.29 + + + org.apache.commons + commons-lang3 + 3.13.0 + + + org.apache.commons + commons-collections4 + 4.4 + + + org.apache.commons + commons-compress + 1.23.0 + + + org.apache.commons + commons-exec + 1.3 + + + org.apache.commons + commons-math3 + 3.6.1 + + + com.sun.mail + javax.mail + 1.6.2 + + + org.jsoup + jsoup + 1.16.1 + + + commons-net + commons-net + 3.9.0 + + + ant + ant-junit + 1.6.5 + + + com.jcraft + jsch + 0.1.55 + + + jexcelapi + jxl + 2.6 + + + org.apache.pdfbox + debugger-app + 2.0.29 + + + org.apache.pdfbox + pdfbox-tools + 2.0.29 + + + javax.servlet.jsp + javax.servlet.jsp-api + 2.3.3 + + + + javax.servlet + javax.servlet-api + 4.0.1 + + + org.apache.sanselan + sanselan + 0.97-incubator + + + com.drewnoakes + metadata-extractor + 2.18.0 + + + javax.media + jai_core + 1.1.3 + + + javax.media + jai_codec + 1.1.3 + + + com.google.guava + guava + 32.1.2-jre + + + commons-io + commons-io + 2.13.0 + + + com.mysql + mysql-connector-j + 9.5.0 + + + com.lowagie + itext + 2.1.7 + + + bouncycastle + bcprov-jdk14 + + + org.bouncycastle + bcprov-jdk14 + + + bouncycastle + bcmail-jdk14 + + + + + org.xhtmlrenderer + flying-saucer-pdf + 9.1.22 + + + org.bouncycastle + bcprov-jdk14 + + + + + org.bouncycastle + bcprov-jdk18on + 1.79 + + + org.apache.logging.log4j + log4j-core + 2.20.0 + + + org.docx4j + docx4j-core + 11.5.3 + + + org.docx4j + docx4j-openxml-objects + 11.5.3 + + + org.docx4j + docx4j-openxml-objects-pml + 11.5.3 + + + org.docx4j + docx4j-openxml-objects-sml + 11.5.3 + + + + com.google.auth + google-auth-library-oauth2-http + 1.25.0 + + + + jakarta.websocket + jakarta.websocket-api + 1.1.2 + provided + + + + org.reflections + reflections + 0.10.2 + + + com.github.victools + jsonschema-generator + 4.38.0 + + + org.hibernate.validator + hibernate-validator + 8.0.1.Final + + + jakarta.validation + jakarta.validation-api + 3.0.2 + + + io.swagger.core.v3 + swagger-annotations + 2.2.19 + + + + org.glassfish + jakarta.el + 4.0.2 + + + \ No newline at end of file diff --git a/decompiled-libs/www/acxent-core-1.0.1/ablia.properties b/decompiled-libs/www/acxent-core-1.0.1/ablia.properties new file mode 100644 index 00000000..a88f7f4d --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/ablia.properties @@ -0,0 +1,27 @@ +##################################################### +#### D E B U G ##################################### +##################################################### +#debug=true e debugLevel=0 vede solo i fatal e manda le mail +#debug=false e debugLevel=0 vede solo i fatal ma non manda le mail +#livelli di debug: +# 0 1 2 3 4 5 +# "FATAL! ", "INFO_1! ", "ERROR! ", "WARNING! ", "INFO! ", "DEBUG! " +USE_PARM_HT=true +DEBUG=true +LOG_FILE=/var/log/tomcat_f3.log +DEBUG_LEVEL=0 + +##################################################### +######PROPRIETA' UTILIZZATE DALLE SERVLET############ +##################################################### +locale=IT +dataFormat=dd/MM/yyyy +maximumFractionDigits=2 +minimumFractionDigits=2 + +#### PRAMETRI STANDARD PER EMAIL ### +#SMTP=localhost +#FROM=test@f3.com +#xTO=staff@f3.com +#xBCC=acolzi@f3.com +#xCC=staff@f3.com diff --git a/decompiled-libs/www/acxent-core-1.0.1/aggiornaV3.properties b/decompiled-libs/www/acxent-core-1.0.1/aggiornaV3.properties new file mode 100644 index 00000000..ab9aec28 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/aggiornaV3.properties @@ -0,0 +1,4 @@ +SOURCE_DIR=/Users/acolzi/Documents/_f3/work/F3ct/DBComuni/wwwES3.1/www/ +TARGET_DIR_1=/Users/acolzi/Documents/_f3/work/Coave/www/ +TARGET_DIR_2=/Users/acolzi/Documents/_f3/work/miser/www2/ +TARGET_DIR_3=/Users/acolzi/Documents/_f3/work/GAIAS/www/ diff --git a/decompiled-libs/www/acxent-core-1.0.1/com/f3/db/demo.gif b/decompiled-libs/www/acxent-core-1.0.1/com/f3/db/demo.gif new file mode 100644 index 00000000..8a65c57d Binary files /dev/null and b/decompiled-libs/www/acxent-core-1.0.1/com/f3/db/demo.gif differ diff --git a/decompiled-libs/www/acxent-core-1.0.1/com/f3/db/package-info.java b/decompiled-libs/www/acxent-core-1.0.1/com/f3/db/package-info.java new file mode 100644 index 00000000..5f008f5e --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/com/f3/db/package-info.java @@ -0,0 +1 @@ +package com.f3.db; \ No newline at end of file diff --git a/decompiled-libs/www/acxent-core-1.0.1/com/f3/db/versionLog.txt b/decompiled-libs/www/acxent-core-1.0.1/com/f3/db/versionLog.txt new file mode 100644 index 00000000..21ab5110 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/com/f3/db/versionLog.txt @@ -0,0 +1 @@ +acxent-core 4log diff --git a/decompiled-libs/www/acxent-core-1.0.1/com/f3/log/createLogMSsql.sql b/decompiled-libs/www/acxent-core-1.0.1/com/f3/log/createLogMSsql.sql new file mode 100644 index 00000000..b1b1662d --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/com/f3/log/createLogMSsql.sql @@ -0,0 +1,69 @@ +CREATE TABLE [LOG_MAIL] ( + [id_logMail] INTEGER IDENTITY(0,1) NOT NULL, + [id_users] INTEGER, + [tsInvio] DATETIME, + [oggetto] VARCHAR(254), + [lmTo] VARCHAR(254), + [lmCc] VARCHAR(254), + [lmBcc] VARCHAR(254), + [testoMessaggio] TEXT, + [result] VARCHAR(1000), + [lastUpdId_user] INTEGER, + [lastUpdTmst] DATETIME, + [createTmst] DATETIME, + [encodedFields] varchar(1000), + CONSTRAINT [PK_LOG_MAIL] PRIMARY KEY ([id_logMail]) +) + +# +CREATE TABLE [LOG_MAIL_ATTACH] ( + [id_logMailAttach] INTEGER IDENTITY(0,1) NOT NULL, + [nomeFile] VARCHAR(254), + [id_logMail] INTEGER, + [lastUpdId_user] INTEGER, + [lastUpdTmst] DATETIME, + [createTmst] DATETIME, + [encodedFields] varchar(1000), + CONSTRAINT [PK_LOG_MAIL_ATTACH] PRIMARY KEY ([id_logMailAttach]) +) + +# +CREATE TABLE [LOG] ( + [id_log] INTEGER IDENTITY(0,1) NOT NULL, + [id_users] INTEGER, + [id_blacklist] INTEGER, + [dataLog] DATETIME, + [descrizione] TEXT, + [ipAddress] CHAR(60), + [flgMovimento] INTEGER, + [tabella] VARCHAR(60), + [oraLog] DATETIME, + [pk] VARCHAR(40), + [pkValue] VARCHAR(40), + [lastUpdId_user] INTEGER, + [lastUpdTmst] DATETIME, + [createTmst] DATETIME, + [encodedFields] varchar(1000), + CONSTRAINT [PK_LOG] PRIMARY KEY ([id_log]) +) + +CREATE INDEX [IDX_LOG_1] ON [LOG] ([pk]) +CREATE INDEX [IDX_LOG_2] ON [LOG] ([dataLog]) + + +CREATE INDEX [IDX_LOG_5] ON [LOG] ([pkValue]) +CREATE INDEX [IDX_LOG_6] ON [LOG] ([id_users]) + +CREATE INDEX [IDX_LOG_8] ON [LOG] ([lastUpdTmst]) + + +##da verificare +CREATE INDEX [IDX_LOG_TAB_MOV_BL[] ON [LOG] ([tabella], [flgMovimento], [id_blacklist]); + +CREATE INDEX IDX_LOG_PURGE ON log (dataLog, id_log); + + +#ALTER TABLE [LOG_MAIL_ATTACH] ADD CONSTRAINT [LOG_MAIL_LOG_MAIL_ATTACH] + FOREIGN KEY ([id_logMail]) REFERENCES [LOG_MAIL] ([id_logMail]) + + diff --git a/decompiled-libs/www/acxent-core-1.0.1/com/f3/log/createLogMysql.sql b/decompiled-libs/www/acxent-core-1.0.1/com/f3/log/createLogMysql.sql new file mode 100644 index 00000000..eb0bf0de --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/com/f3/log/createLogMysql.sql @@ -0,0 +1,59 @@ +CREATE TABLE IF NOT EXISTS `LOG_MAIL` ( + `id_logMail` INTEGER NOT NULL AUTO_INCREMENT, + `id_users` INTEGER, + `oggetto` VARCHAR(254), + `tsInvio` DATETIME, + `lmTo` VARCHAR(254), + `lmCc` VARCHAR(254), + `lmBcc` VARCHAR(254), + `testoMessaggio` TEXT, + `result` VARCHAR(1000), + `lastUpdTmst` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `lastUpdId_user` int(11) DEFAULT NULL, + `createTmst` datetime DEFAULT NULL, + `encodedFields` varchar(1000) DEFAULT NULL, + CONSTRAINT `PK_LOG_MAIL` PRIMARY KEY (`id_logMail`) +); +# +CREATE TABLE IF NOT EXISTS `LOG_MAIL_ATTACH` ( + `id_logMailAttach` INTEGER NOT NULL AUTO_INCREMENT, + `nomeFile` VARCHAR(254), + `id_logMail` INTEGER, + `lastUpdTmst` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `lastUpdId_user` int(11) DEFAULT NULL, + `createTmst` datetime DEFAULT NULL, + `encodedFields` varchar(1000) DEFAULT NULL, + CONSTRAINT `PK_LOG_MAIL_ATTACH` PRIMARY KEY (`id_logMailAttach`), + CONSTRAINT `LOG_MAIL_LOG_MAIL_ATTACH` + FOREIGN KEY (`id_logMail`) REFERENCES `LOG_MAIL` (`id_logMail`) +); +# +CREATE TABLE `LOG` ( + `id_log` INTEGER NOT NULL AUTO_INCREMENT, + `id_users` INTEGER, + `id_blacklist` INTEGER, + `dataLog` DATE, + `descrizione` TEXT, + `ipAddress` CHAR(60), + `flgMovimento` INTEGER, + `tabella` VARCHAR(60), + `oraLog` TIME, + `pk` VARCHAR(40), + `pkValue` VARCHAR(40), + `lastUpdTmst` TIMESTAMP, + CONSTRAINT `PK_LOG` PRIMARY KEY (`id_log`) +); + +CREATE INDEX `IDX_LOG_pk` ON `LOG` (`pk`); + +CREATE INDEX `IDX_LOG_datalog` ON `LOG` (`dataLog`); + +CREATE INDEX `IDX_LOG_pkValue` ON `LOG` (`pkValue`); + +CREATE INDEX `IDX_LOG_id_users` ON `LOG` (`id_users`); + +CREATE INDEX `IDX_LOG_lastupttmst` ON `LOG` (`lastUpdTmst` DESC); + +CREATE INDEX `IDX_LOG_TAB_MOV_BL` ON `LOG` (`tabella`,`flgMovimento`,`id_blacklist`); + +CREATE INDEX `IDX_LOG_PURGE` ON `LOG` (`dataLog`,`id_log`); diff --git a/decompiled-libs/www/acxent-core-1.0.1/com/f3/log/createLogMysql8.sql b/decompiled-libs/www/acxent-core-1.0.1/com/f3/log/createLogMysql8.sql new file mode 100644 index 00000000..a9f75ecd --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/com/f3/log/createLogMysql8.sql @@ -0,0 +1,59 @@ +CREATE TABLE IF NOT EXISTS `LOG_MAIL` ( + `id_logMail` INTEGER NOT NULL AUTO_INCREMENT, + `id_users` INTEGER, + `oggetto` VARCHAR(254), + `tsInvio` DATETIME, + `lmTo` VARCHAR(254), + `lmCc` VARCHAR(254), + `lmBcc` VARCHAR(254), + `testoMessaggio` TEXT, + `result` VARCHAR(1000), + `lastUpdTmst` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `lastUpdId_user` int(11) DEFAULT NULL, + `createTmst` datetime DEFAULT NULL, + `encodedFields` varchar(1000) DEFAULT NULL, + CONSTRAINT `PK_LOG_MAIL` PRIMARY KEY (`id_logMail`) +); +# +CREATE TABLE IF NOT EXISTS `LOG_MAIL_ATTACH` ( + `id_logMailAttach` INTEGER NOT NULL AUTO_INCREMENT, + `nomeFile` VARCHAR(254), + `id_logMail` INTEGER, + `lastUpdTmst` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `lastUpdId_user` int(11) DEFAULT NULL, + `createTmst` datetime DEFAULT NULL, + `encodedFields` varchar(1000) DEFAULT NULL, + CONSTRAINT `PK_LOG_MAIL_ATTACH` PRIMARY KEY (`id_logMailAttach`), + CONSTRAINT `LOG_MAIL_LOG_MAIL_ATTACH` + FOREIGN KEY (`id_logMail`) REFERENCES `LOG_MAIL` (`id_logMail`) +); +# +CREATE TABLE IF NOT EXISTS `LOG` ( + `id_log` INTEGER NOT NULL AUTO_INCREMENT, + `id_users` INTEGER, + `id_blacklist` INTEGER, + `dataLog` DATE, + `descrizione` TEXT, + `ipAddress` CHAR(60), + `flgMovimento` INTEGER, + `tabella` VARCHAR(60), + `oraLog` TIME, + `pk` VARCHAR(40), + `pkValue` VARCHAR(40), + `lastUpdTmst` TIMESTAMP, + CONSTRAINT `PK_LOG` PRIMARY KEY (`id_log`) +); + +CREATE INDEX `IDX_LOG_pk` ON `LOG` (`pk`); + +CREATE INDEX `IDX_LOG_datalog` ON `LOG` (`dataLog`); + +CREATE INDEX `IDX_LOG_pkValue` ON `LOG` (`pkValue`); + +CREATE INDEX `IDX_LOG_id_users` ON `LOG` (`id_users`); + +CREATE INDEX `IDX_LOG_lastupttmst` ON `LOG` (`lastUpdTmst` DESC); + +CREATE INDEX `IDX_LOG_TAB_MOV_BL` ON `LOG` (`tabella`,`flgMovimento`,`id_blacklist`); + +CREATE INDEX `IDX_LOG_PURGE` ON `LOG` (`dataLog`,`id_log`); diff --git a/decompiled-libs/www/acxent-core-1.0.1/comuni.properties b/decompiled-libs/www/acxent-core-1.0.1/comuni.properties new file mode 100644 index 00000000..fadb4341 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/comuni.properties @@ -0,0 +1,8284 @@ +ABANO_TERME=A001 +ABBADIA_CERRETO=A004 +ABBADIA_LARIANA=A005 +ABBADIA_SAN_SALVATORE=A006 +ABBASANTA=A007 +ABBATEGGIO=A008 +ABBIATEGRASSO=A010 +ABETONE=A012 +ABRIOLA=A013 +ACATE=A014 +ACCADIA=A015 +ACCEGLIO=A016 +ACCETTURA=A017 +ACCIANO=A018 +ACCUMOLI=A019 +ACERENZA=A020 +ACERNO=A023 +ACERRA=A024 +ACI_BONACCORSI=A025 +ACI_CASTELLO=A026 +ACI_CATENA=A027 +ACI_SANT'ANTONIO=A029 +ACIREALE=A028 +ACQUACANINA=A031 +ACQUAFONDATA=A032 +ACQUAFORMOSA=A033 +ACQUAFREDDA=A034 +ACQUALAGNA=A035 +ACQUANEGRA_CREMONESE=A039 +ACQUANEGRA_SUL_CHIESE=A038 +ACQUAPENDENTE=A040 +ACQUAPPESA=A041 +ACQUARICA_DEL_CAPO=A042 +ACQUARO=A043 +ACQUASANTA_TERME=A044 +ACQUASPARTA=A045 +ACQUAVIVA_COLLECROCE=A050 +ACQUAVIVA_DELLE_FONTI=A048 +ACQUAVIVA_DI_ISERNIA=A051 +ACQUAVIVA_PICENA=A047 +ACQUAVIVA_PLATANI=A049 +ACQUEDOLCI=M211 +ACQUI_TERME=A052 +ACRI=A053 +ACUTO=A054 +ADELFIA=A055 +ADRANO=A056 +ADRARA_SAN_MARTINO=A057 +ADRARA_SAN_ROCCO=A058 +ADRIA=A059 +ADRO=A060 +AFFI=A061 +AFFILE=A062 +AFRAGOLA=A064 +AFRICA_SUD-OVEST=Z300 +AFRICO=A065 +AGAZZANO=A067 +AGEROLA=A068 +AGGIUS=A069 +AGIRA=A070 +AGLIANA=A071 +AGLIANO=A072 +AGLIE'=A074 +AGLIENTU=M848 +AGNA=A075 +AGNADELLO=A076 +AGNANA_CALABRA=A077 +AGNONE=A080 +AGNOSINE=A082 +AGORDO=A083 +AGOSTA=A084 +AGRA=A085 +AGRATE_BRIANZA=A087 +AGRATE_CONTURBIA=A088 +AGRIGENTO=A089 +AGROPOLI=A091 +AGUGLIANO=A092 +AGUGLIARO=A093 +AICURZIO=A096 +AIDOMAGGIORE=A097 +AIDONE=A098 +AIELLI=A100 +AIELLO_CALABRO=A102 +AIELLO_DEL_FRIULI=A103 +AIELLO_DEL_SABATO=A101 +AIETA=A105 +AILANO=A106 +AILOCHE=A107 +AIRASCA=A109 +AIROLA=A110 +AIROLE=A111 +AIRUNO=A112 +AISONE=A113 +ALA=A116 +ALA'_DEI_SARDI=A115 +ALA_DI_STURA=A117 +ALAGNA=A118 +ALAGNA_VALSESIA=A119 +ALANNO=A120 +ALANO_DI_PIAVE=A121 +ALASSIO=A122 +ALATRI=A123 +ALBA=A124 +ALBA_ADRIATICA=A125 +ALBAGIARA=A126 +ALBAIRATE=A127 +ALBANELLA=A128 +ALBANIA=Z100 +ALBANO_DI_LUCANIA=A131 +ALBANO_LAZIALE=A132 +ALBANO_SANT'ALESSANDRO=A129 +ALBANO_VERCELLESE=A130 +ALBAREDO_ARNABOLDI=A134 +ALBAREDO_D'ADIGE=A137 +ALBAREDO_PER_SAN_MARCO=A135 +ALBARETO=A138 +ALBARETTO_DELLA_TORRE=A139 +ALBAVILLA=A143 +ALBENGA=A145 +ALBERA_LIGURE=A146 +ALBEROBELLO=A149 +ALBERONA=A150 +ALBESE_CON_CASSANO=A153 +ALBETTONE=A154 +ALBI=A155 +ALBIANO=A158 +ALBIANO_D'IVREA=A157 +ALBIATE=A159 +ALBIDONA=A160 +ALBIGNASEGO=A161 +ALBINEA=A162 +ALBINO=A163 +ALBIOLO=A164 +ALBISOLA_MARINA=A165 +ALBISOLA_SUPERIORE=A166 +ALBIZZATE=A167 +ALBONESE=A171 +ALBOSAGGIA=A172 +ALBUGNANO=A173 +ALBUZZANO=A175 +ALCAMO=A176 +ALCARA_LI_FUSI=A177 +ALDENO=A178 +ALDINO=A179 +ALES=A180 +ALESSANDRIA=A182 +ALESSANDRIA_DEL_CARRETTO=A183 +ALESSANDRIA_DELLA_ROCCA=A181 +ALESSANO=A184 +ALEZIO=A185 +ALFANO=A186 +ALFEDENA=A187 +ALFIANELLO=A188 +ALFIANO_NATTA=A189 +ALFONSINE=A191 +ALGERIA=Z301 +ALGHERO=A192 +ALGUA=A193 +ALI'=A194 +ALI'_TERME=A201 +ALIA=A195 +ALIANO=A196 +ALICE_BEL_COLLE=A197 +ALICE_CASTELLO=A198 +ALICE_SUPERIORE=A199 +ALIFE=A200 +ALIMENA=A202 +ALIMINUSA=A203 +ALLAI=A204 +ALLAIN=A205 +ALLEGHE=A206 +ALLERONA=A207 +ALLISTE=A208 +ALLUMIERE=A210 +ALLUVIONI_CAMBIO'=A211 +ALME'=A214 +ALMENNO_SAN_BARTOLOMEO=A216 +ALMENNO_SAN_SALVATORE=A217 +ALMESE=A218 +ALONTE=A220 +ALPETTE=A221 +ALPIGNANO=A222 +ALSENO=A223 +ALSERIO=A224 +ALTAMURA=A225 +ALTARE=A226 +ALTAVILLA_IRPINA=A228 +ALTAVILLA_MILICIA=A229 +ALTAVILLA_MONFERRATO=A227 +ALTAVILLA_SILENTINA=A230 +ALTAVILLA_VICENTINA=A231 +ALTIDONA=A233 +ALTILIA=A234 +ALTINO=A235 +ALTISSIMO=A236 +ALTIVOLE=A237 +ALTO=A238 +ALTO_VOLTA=Z354 +ALTOFONTE=A239 +ALTOMONTE=A240 +ALTOPASCIO=A241 +ALVIANO=A242 +ALVIGNANO=A243 +ALVITO=A244 +ALZANO_LOMBARDO=A246 +ALZANO_SCRIVIA=A245 +ALZATE_BRIANZA=A249 +AMALFI=A251 +AMANDOLA=A252 +AMANTEA=A253 +AMARO=A254 +AMARONI=A255 +AMASENO=A256 +AMATO=A257 +AMATRICE=A258 +AMBIVERE=A259 +AMBLAR=A260 +AMEGLIA=A261 +AMELIA=A262 +AMENDOLARA=A263 +AMENO=A264 +AMOROSI=A265 +AMPEZZO=A267 +ANACAPRI=A268 +ANAGNI=A269 +ANCARANO=A270 +ANCONA=A271 +ANDALI=A272 +ANDALO=A274 +ANDALO_VALTELLINO=A273 +ANDEZENO=A275 +ANDORA=A278 +ANDORNO_MICCA=A280 +ANDORRA=Z101 +ANDRANO=A281 +ANDRATE=A282 +ANDREIS=A283 +ANDRETTA=A284 +ANDRIA=A285 +ANDRIANO=A286 +ANELA=A287 +ANFO=A288 +ANGERA=A290 +ANGHIARI=A291 +ANGIARI=A292 +ANGOLA=Z302 +ANGOLO_TERME=A293 +ANGRI=A294 +ANGROGNA=A295 +ANGUILLARA_SABAZIA=A297 +ANGUILLARA_VENETA=A296 +ANNICCO=A299 +ANNONE_DI_BRIANZA=A301 +ANNONE_VENETO=A302 +ANOIA=A303 +ANTEGNATE=A304 +ANTERIVO=A306 +ANTEY_SAINT_ANDRE'=A305 +ANTICOLI_CORRADO=A309 +ANTIGNANO=A312 +ANTILLE_BRITANNICHE=Z500 +ANTILLE_OLANDESI=Z501 +ANTILLO=A313 +ANTONIMINA=A314 +ANTRODOCO=A315 +ANTRONA_SCHIERANCO=A317 +ANVERSA_DEGLI_ABRUZZI=A318 +ANZANO_DEL_PARCO=A319 +ANZANO_DI_PUGLIA=A320 +ANZI=A321 +ANZIO=A323 +ANZOLA_DELL'EMILIA=A324 +ANZOLA_D'OSSOLA=A325 +AOSTA=A326 +APECCHIO=A327 +APICE=A328 +APIRO=A329 +APOLLOSA=A330 +APPIANO_GENTILE=A333 +APPIANO_SULLA_STRADA_DEL_VINO=A332 +APPIGNANO=A334 +APPIGNANO_DEL_TRONTO=A335 +APRICA=A337 +APRICALE=A338 +APRICENA=A339 +APRIGLIANO=A340 +APRILIA=A341 +AQUARA=A343 +AQUILA_DI_ARROSCIA=A344 +AQUILEIA=A346 +AQUILONIA=A347 +AQUINO=A348 +ARABIA_SAUDITA=Z203 +ARADEO=A350 +ARAGONA=A351 +ARAMENGO=A352 +ARBA=A354 +ARBOREA=A357 +ARBORIO=A358 +ARBUS=A359 +ARCADE=A360 +ARCE=A363 +ARCENE=A365 +ARCEVIA=A366 +ARCHI=A367 +ARCIDOSSO=A369 +ARCINAZZO_ROMANO=A370 +ARCISATE=A371 +ARCO=A372 +ARCOLA=A373 +ARCOLE=A374 +ARCONATE=A375 +ARCORE=A376 +ARCUGNANO=A377 +ARDARA=A379 +ARDAULI=A380 +ARDEA=M213 +ARDENNO=A382 +ARDESIO=A383 +ARDORE=A385 +ARENA=A386 +ARENA_PO=A387 +ARENZANO=A388 +ARESE=A389 +AREZZO=A390 +ARGEGNO=A391 +ARGELATO=A392 +ARGENTA=A393 +ARGENTERA=A394 +ARGENTINA=Z600 +ARGUELLO=A396 +ARGUSTO=A397 +ARI=A398 +ARIANO_IRPINO=A399 +ARIANO_NEL_POLESINE=A400 +ARICCIA=A401 +ARIELLI=A402 +ARIENZO=A403 +ARIGNANO=A405 +ARITZO=A407 +ARIZZANO=A409 +ARLENA_DI_CASTRO=A412 +ARLUNO=A413 +ARMENO=A414 +ARMENTO=A415 +ARMO=A417 +ARMUNGIA=A419 +ARNAD=A424 +ARNARA=A421 +ARNASCO=A422 +ARNESANO=A425 +AROLA=A427 +ARONA=A429 +AROSIO=A430 +ARPAIA=A431 +ARPAISE=A432 +ARPINO=A433 +ARQUA'_PETRARCA=A434 +ARQUA'_POLESINA=A435 +ARQUATA_DEL_TRONTO=A437 +ARQUATA_SCRIVIA=A436 +ARRE=A438 +ARRONE=A439 +ARSAGO_SEPRIO=A441 +ARSIE'=A443 +ARSIERO=A444 +ARSITA=A445 +ARSOLI=A446 +ARTA_TERME=A447 +ARTEGNA=A448 +ARTENA=A449 +ARTOGNE=A451 +ARVIER=A452 +ARZACHENA=A453 +ARZAGO_D'ADDA=A440 +ARZANA=A454 +ARZANO=A455 +ARZENE=A456 +ARZERGRANDE=A458 +ARZIGNANO=A459 +ASCEA=A460 +ASCIANO=A461 +ASCOLI_PICENO=A462 +ASCOLI_SATRIANO=A463 +ASCREA=A464 +ASIAGO=A465 +ASIGLIANO_VENETO=A467 +ASIGLIANO_VERCELLESE=A466 +ASOLA=A470 +ASOLO=A471 +ASSAGO=A473 +ASSEMINI=A474 +ASSISI=A475 +ASSO=A476 +ASSOLO=A477 +ASSORO=A478 +ASTI=A479 +ASUNI=A480 +ATELETA=A481 +ATELLA=A482 +ATENA_LUCANA=A484 +ATESSA=A485 +ATINA=A486 +ATRANI=A487 +ATRI=A488 +ATRIPALDA=A489 +ATTIGLIANO=A490 +ATTIMIS=A491 +ATZARA=A492 +AUDITORE=A493 +AUGUSTA=A494 +AULETTA=A495 +AULLA=A496 +AURANO=A497 +AURIGO=A499 +AURONZO_DI_CADORE=A501 +AUSONIA=A502 +AUSTIS=A503 +AUSTRALIA=Z700 +AUSTRIA=Z102 +AVEGNO=A506 +AVELENGO=A507 +AVELLA=A508 +AVELLINO=A509 +AVERARA=A511 +AVERSA=A512 +AVETRANA=A514 +AVEZZANO=A515 +AVIANO=A516 +AVIATICO=A517 +AVIGLIANA=A518 +AVIGLIANO=A519 +AVIGLIANO_UMBRO=A519 +AVIO=A520 +AVISE=A521 +AVOLA=A522 +AVOLASCA=A523 +AYAS=A094 +AYMAVILLES=A108 +AZEGLIO=A525 +AZZANELLO=A526 +AZZANO_D'ASTI=A527 +AZZANO_DECIMO=A530 +AZZANO_MELLA=A529 +AZZANO_SAN_PAOLO=A528 +AZZATE=A531 +AZZIO=A532 +AZZONE=A533 +BACENO=A534 +BACOLI=A535 +BADALUCCO=A536 +BADESI=M214 +BADIA=A537 +BADIA_CALAVENA=A540 +BADIA_PAVESE=A538 +BADIA_POLESINE=A539 +BADIA_TEDALDA=A541 +BADOLATO=A542 +BAGALADI=A544 +BAGHERIA=A546 +BAGNACAVALLO=A547 +BAGNARA_CALABRA=A552 +BAGNARA_DI_ROMAGNA=A551 +BAGNARIA=A550 +BAGNARIA_ARSA=A553 +BAGNASCO=A555 +BAGNATICA=A557 +BAGNI_DI_LUCCA=A560 +BAGNO_A_RIPOLI=A564 +BAGNO_DI_ROMAGNA=A565 +BAGNOLI_DEL_TRIGNO=A567 +BAGNOLI_DI_SOPRA=A568 +BAGNOLI_IRPINO=A566 +BAGNOLO_CREMASCO=A570 +BAGNOLO_DEL_SALENTO=A572 +BAGNOLO_DI_PO=A574 +BAGNOLO_IN_PIANO=A573 +BAGNOLO_MELLA=A569 +BAGNOLO_PIEMONTE=A571 +BAGNOLO_SAN_VITO=A575 +BAGNONE=A576 +BAGNOREGIO=A577 +BAGOLINO=A578 +BAHAMAS=Z502 +BAHREIN=Z204 +BAIA_E_LATINA=A579 +BAIANO=A580 +BAIARDO=A581 +BAIRO=A584 +BAISO=A586 +BALANGERO=A587 +BALDICHIERI_D'ASTI=A588 +BALDISSERO_CANAVESE=A590 +BALDISSERO_D'ALBA=A589 +BALDISSERO_TORINESE=A591 +BALESTRATE=A592 +BALESTRINO=A593 +BALLABIO=A594 +BALLAO=A597 +BALME=A599 +BALMUCCIA=A600 +BALOCCO=A601 +BALSORANO=A603 +BALVANO=A604 +BALZOLA=A605 +BANARI=A606 +BANCHETTE=A607 +BANNIO_ANZINO=A610 +BANZI=A612 +BAONE=A613 +BARADILI=A614 +BARAGIANO=A615 +BARANELLO=A616 +BARANO_D'ISCHIA=A617 +BARASSO=A619 +BARATILI_SAN_PIETRO=A621 +BARBANIA=A625 +BARBARA=A626 +BARBARANO_ROMANO=A628 +BARBARANO_VICENTINO=A627 +BARBARESCO=A629 +BARBARIGA=A630 +BARBATA=A631 +BARBERINO_DI_MUGELLO=A632 +BARBERINO_VAL_D'ELSA=A633 +BARBIANELLO=A634 +BARBIANO=A635 +BARBONA=A637 +BARCELLONA_POZZO_DI_GOTTO=A638 +BARCHI=A639 +BARCIS=A640 +BARD=A643 +BARDELLO=A645 +BARDI=A646 +BARDINETO=A647 +BARDOLINO=A650 +BARDONECCHIA=A651 +BAREGGIO=A652 +BARENGO=A653 +BARESSA=A655 +BARETE=A656 +BARGA=A657 +BARGAGLI=A658 +BARGE=A660 +BARGHE=A661 +BARI=A662 +BARI_SARDO=A663 +BARIANO=A664 +BARICELLA=A665 +BARILE=A666 +BARISCIANO=A667 +BARLASSINA=A668 +BARLETTA=A669 +BARNI=A670 +BAROLO=A671 +BARONE_CANAVESE=A673 +BARONISSI=A674 +BARRAFRANCA=A676 +BARRALI=A677 +BARREA=A678 +BARUMINI=A681 +BARZAGO=A683 +BARZANA=A684 +BARZANO'=A686 +BARZIO=A687 +BASALUZZO=A689 +BASCAPE'=A690 +BASCHI=A691 +BASCIANO=A692 +BASELGA_DI_PINE'=A694 +BASELICE=A696 +BASIANO=A697 +BASICO'=A698 +BASIGLIO=A699 +BASILIANO=A700 +BASSANO_BRESCIANO=A702 +BASSANO_DEL_GRAPPA=A703 +BASSANO_IN_TEVERINA=A706 +BASSANO_ROMANO=A704 +BASSIANO=A707 +BASSIGNANA=A708 +BASTIA=A710 +BASTIA_MONDOVI'=A709 +BASTIDA_DE'_DOSSI=A711 +BASTIDA_PANCARANA=A712 +BASTIGLIA=A713 +BASUTOLAND=Z303 +BATTAGLIA_TERME=A714 +BATTIFOLLO=A716 +BATTIPAGLIA=A717 +BATTUDA=A718 +BAUCINA=A719 +BAULADU=A721 +BAUNEI=A722 +BAVENO=A725 +BAZZANO=A726 +BECIUANIA=Z304 +BEDERO_VALCUVIA=A728 +BEDIZZOLE=A729 +BEDOLLO=A730 +BEDONIA=A731 +BEDULITA=A732 +BEE=A733 +BEINASCO=A734 +BEINETTE=A735 +BELCASTRO=A736 +BELFIORE=A737 +BELFORTE_ALL'ISAURO=A740 +BELFORTE_DEL_CHIENTI=A739 +BELFORTE_MONFERRATO=A738 +BELGIO=Z103 +BELGIOIOSO=A741 +BELGIRATE=A742 +BELLA=A743 +BELLAGIO=A744 +BELLANO=A745 +BELLANTE=A746 +BELLARIA_IGEA_MARINA=A747 +BELLEGRA=A749 +BELLINO=A750 +BELLINZAGO_LOMBARDO=A751 +BELLINZAGO_NOVARESE=A752 +BELLONA=A755 +BELLOSGUARDO=A756 +BELLUNO=A757 +BELLUSCO=A759 +BELMONTE_CALABRO=A762 +BELMONTE_CASTELLO=A763 +BELMONTE_DEL_SANNIO=A761 +BELMONTE_IN_SABINA=A765 +BELMONTE_MEZZAGNO=A764 +BELMONTE_PICENO=A760 +BELPASSO=A766 +BELSITO=A768 +BELVEDERE_DI_SPINELLO=A772 +BELVEDERE_LANGHE=A774 +BELVEDERE_MARITTIMO=A773 +BELVEDERE_OSTRENSE=A769 +BELVEGLIO=A770 +BELVI=A776 +BEMA=A777 +BENE_LARIO=A778 +BENE_VAGIENNA=A779 +BENESTARE=A780 +BENETUTTI=A781 +BENEVELLO=A782 +BENEVENTO=A783 +BENNA=A784 +BENTIVOGLIO=A785 +BERBENNO=A786 +BERBENNO_DI_VALTELLINA=A787 +BERCETO=A788 +BERCHIDDA=A789 +BEREGAZZO_CON_FIGLIARO=A791 +BEREGUARDO=A792 +BERGAMASCO=A793 +BERGAMO=A794 +BERGEGGI=A796 +BERGOLO=A798 +BERLINGO=A799 +BERMUDE=Z400 +BERNALDA=A801 +BERNAREGGIO=A802 +BERNATE_TICINO=A804 +BERNEZZO=A805 +BERRA=A806 +BERSONE=A808 +BERTINORO=A809 +BERTIOLO=A810 +BERTONICO=A811 +BERZANO_DI_SAN_PIETRO=A812 +BERZANO_DI_TORTONA=A813 +BERZO_DEMO=A816 +BERZO_INFERIORE=A816 +BERZO_SAN_FERMO=A815 +BESANA_IN_BRIANZA=A818 +BESANO=A819 +BESATE=A820 +BESENELLO=A821 +BESENZONE=A823 +BESNATE=A825 +BESOZZO=A826 +BESSUDE=A827 +BETTOLA=A831 +BETTONA=A832 +BEURA_CARDEZZA=A834 +BEVAGNA=A835 +BEVERINO=A836 +BEVILACQUA=A837 +BEZZECCA=A839 +BHUTAN=Z205 +BIANCAVILLA=A841 +BIANCHI=A842 +BIANCO=A843 +BIANDRATE=A844 +BIANDRONNO=A845 +BIANZANO=A846 +BIANZE'=A847 +BIANZONE=A848 +BIASSONO=A849 +BIBBIANO=A850 +BIBBIENA=A851 +BIBBONA=A852 +BIBIANA=A853 +BICCARI=A854 +BICINICCO=A855 +BIDONI'=A856 +BIELLA=A859 +BIENNO=A861 +BIENO=A863 +BIENTINA=A864 +BIGARELLO=A866 +BINAGO=A870 +BINASCO=A872 +BINETTO=A874 +BIOGLIO=A876 +BIONAZ=A877 +BIONE=A878 +BIRMANIA=Z206 +BIRORI=A880 +BISACCIA=A881 +BISACQUINO=A882 +BISCEGLIE=A883 +BISEGNA=A884 +BISENTI=A885 +BISIGNANO=A887 +BISTAGNO=A889 +BISUSCHIO=A891 +BITETTO=A892 +BITONTO=A893 +BITRITTO=A894 +BITTI=A895 +BIVONA=A896 +BIVONGI=A897 +BIZZARONE=A898 +BLEGGIO_INFERIORE=A901 +BLEGGIO_SUPERIORE=A902 +BLELLO=A903 +BLERA=A857 +BLESSAGNO=A904 +BLEVIO=A905 +BLUFI=A000 +BOARA_PISANI=A906 +BOBBIO=A909 +BOBBIO_PELLICE=A910 +BOCA=A911 +BOCCHIGLIERO=A912 +BOCCIOLETO=A914 +BOCENAGO=A916 +BODIO_LOMNAGO=A918 +BOFFALORA_D'ADDA=A919 +BOFFALORA_SOPRA_TICINO=A920 +BOGLIASCO=A922 +BOGNANCO=A925 +BOGOGNO=A929 +BOIANO=A930 +BOISSANO=A931 +BOLANO=A932 +BOLBENO=A933 +BOLGARE=A937 +BOLIVIA=Z601 +BOLLATE=A940 +BOLLENGO=A941 +BOLOGNA=A944 +BOLOGNANO=A945 +BOLOGNETTA=A946 +BOLOGNOLA=A947 +BOLOTANA=A948 +BOLSENA=A949 +BOLTIERE=A950 +BOLZANO=A952 +BOLZANO_NOVARESE=A953 +BOLZANO_VICENTINA=A954 +BOMARZO=A955 +BOMBA=A956 +BOMPENSIERE=A957 +BOMPIETRO=A958 +BOMPORTO=A959 +BONARCADO=A960 +BONASSOLA=A961 +BONATE_SOPRA=A963 +BONATE_SOTTO=A962 +BONAVIGO=A964 +BONDENO=A965 +BONDO=A967 +BONDONE=A968 +BONEA=A970 +BONEFRO=A971 +BONEMERSE=A972 +BONIFATI=A973 +BONITO=A975 +BONNANARO=A976 +BONO=A977 +BONORVA=A978 +BONVICINO=A979 +BORBONA=A981 +BORCA_DI_CADORE=A982 +BORDANO=A983 +BORDIGHERA=A984 +BORDOLANO=A986 +BORE=A987 +BORETTO=A988 +BORGARELLO=A989 +BORGARO_TORINESE=A990 +BORGETTO=A991 +BORGHETTO_D'ARROSCIA=A993 +BORGHETTO_DI_BORBERA=A998 +BORGHETTO_DI_VARA=A992 +BORGHETTO_LODIGIANO=A995 +BORGHETTO_SANTO_SPIRITO=A999 +BORGHI=B001 +BORGIA=B002 +BORGIALLO=B003 +BORGIO_VEREZZI=B005 +BORGO_A_MOZZANO=B007 +BORGO_D'ALE=B009 +BORGO_DI_TERZO=B010 +BORGO_PACE=B026 +BORGO_PRIOLO=B028 +BORGO_SAN_DALMAZZO=B033 +BORGO_SAN_GIACOMO=B035 +BORGO_SAN_GIOVANNI=B017 +BORGO_SAN_LORENZO=B036 +BORGO_SAN_MARTINO=B037 +BORGO_SAN_SIRO=B038 +BORGO_TICINO=B043 +BORGO_TOSSIGNANO=B044 +BORGO_VAL_DI_TARO=B042 +BORGO_VALSUGANA=B006 +BORGO_VELINO=A996 +BORGO_VERCELLI=B046 +BORGOFORTE=B011 +BORGOFRANCO_D'IVREA=B015 +BORGOFRANCO_SUL_PO=B013 +BORGOLAVEZZARO=B016 +BORGOMALE=B018 +BORGOMANERO=B019 +BORGOMARO=B020 +BORGOMASINO=B021 +BORGONE_SUSA=B024 +BORGONOVO_VAL_TIDONE=B025 +BORGORATTO_ALESSANDRINO=B029 +BORGORATTO_MORMOROLO=B030 +BORGORICCO=B031 +BORGOROSE=B008 +BORGOSATOLLO=B040 +BORGOSESIA=B041 +BORMIDA=B048 +BORMIO=B049 +BORNASCO=B051 +BORNO=B054 +BORONEDDU=B055 +BORORE=B056 +BORRELLO=B057 +BORRIANA=B058 +BORSO_DEL_GRAPPA=B061 +BORTIGALI=B062 +BORTIGIADAS=B063 +BORUTTA=B064 +BORZONASCA=B067 +BOSA=B068 +BOSARO=B069 +BOSCHI_SANT'ANNA=B070 +BOSCO_CHIESANUOVA=B073 +BOSCO_MARENGO=B071 +BOSCONERO=B075 +BOSCOREALE=B076 +BOSCOTRECASE=B077 +BOSENTINO=B078 +BOSIA=B079 +BOSIO=B080 +BOSISIO_PARINI=B081 +BOSNASCO=B082 +BOSSICO=B083 +BOSSOLASCO=B084 +BOTRICELLO=B085 +BOTRUGNO=B086 +BOTTANUCO=B088 +BOTTICINO=B091 +BOTTIDDA=B094 +BOVA=B097 +BOVA_MARINA=B099 +BOVALINO=B098 +BOVEGNO=B100 +BOVES=B101 +BOVEZZO=B102 +BOVILLE_ERNICA=A720 +BOVINO=B104 +BOVISIO_MASCIAGO=B105 +BOVOLENTA=B106 +BOVOLONE=B107 +BOZZOLE=B109 +BOZZOLO=B110 +BRA=B111 +BRACCA=B112 +BRACCIANO=B114 +BRACIGLIANO=B115 +BRAIES_PRAGS=B116 +BRALLO_DI_PREGOLA=B117 +BRANCALEONE=B118 +BRANDICO=B120 +BRANDIZZO=B121 +BRANZI=B123 +BRAONE=B124 +BRASILE=Z602 +BREBBIA=B126 +BREDA_DI_PIAVE=B128 +BREGANO=B131 +BREGANZE=B132 +BREGNANO=B134 +BREGUZZO=B135 +BREIA=B136 +BREMBATE=B137 +BREMBATE_DI_SOPRA=B138 +BREMBILLA=B140 +BREMBIO=B141 +BREME=B142 +BRENDOLA=B143 +BRENNA=B144 +BRENNERO=B145 +BRENO=B149 +BRENTA=B150 +BRENTINO_BELLUNO=B152 +BRENTONICO=B153 +BRENZONE=B154 +BRESCELLO=B156 +BRESCIA=B157 +BRESIMO=B158 +BRESSANA_BOTTARONE=B159 +BRESSANONE=B160 +BRESSANVIDO=B161 +BRESSO=B162 +BREZ=B165 +BREZZO_DI_BEDERO=B166 +BRIAGLIA=B167 +BRIATICO=B169 +BRICHERASIO=B171 +BRIENNO=B172 +BRIENZA=B173 +BRIGA_ALTA=B175 +BRIGA_NOVARESE=B176 +BRIGNANO_FRASCATA=B179 +BRIGNANO_GERA_D'ADDA=B178 +BRINDISI=B180 +BRINDISI_MONTAGNA=B181 +BRINZIO=B182 +BRIONA=B183 +BRIONE=B184 +BRIONE=B185 +BRIOSCO=B187 +BRISIGHELLA=B188 +BRISSAGO_VALTRAVAGLIA=B191 +BRISSOGNE=B192 +BRITTOLI=B193 +BRIVIO=B194 +BROCCOSTELLA=B195 +BROGLIANO=B196 +BROGNATURO=B197 +BROLO=B198 +BRONDELLO=B200 +BRONI=B201 +BRONTE=B202 +BRONZOLO=B203 +BROSSASCO=B204 +BROSSO=B205 +BROVELLO_CARPUGNINO=B207 +BROZOLO=B209 +BRUGHERIO=B212 +BRUGINE=B213 +BRUGNATO=B214 +BRUGNERA=B215 +BRUINO=B216 +BRUMANO=B217 +BRUNATE=B218 +BRUNEI=Z207 +BRUNELLO=B219 +BRUNICO=B220 +BRUNO=B221 +BRUSAPORTO=B223 +BRUSASCO=B225 +BRUSCIANO=B227 +BRUSIMPIANO=B228 +BRUSNENGO=B229 +BRUSSON=B230 +BRUZOLO=B232 +BRUZZANO_ZEFFIRIO=B234 +BUBBIANO=B235 +BUBBIO=B236 +BUCCHERI=B237 +BUCCHIANICO=B238 +BUCCIANO=B239 +BUCCINASCO=B240 +BUCCINO=B242 +BUCINE=B243 +BUDDUSO'=B246 +BUDOIA=B247 +BUDONI=B248 +BUDRIO=B249 +BUGGERRU=B250 +BUGGIANO=B251 +BUGLIO_IN_MONTE=B255 +BUGNARA=B256 +BUGUGGIATE=B258 +BUIA=B259 +BULCIAGO=B261 +BULGARIA=Z104 +BULGAROGRASSO=B262 +BULTEI=B264 +BULZI=B265 +BUONABITACOLO=B266 +BUONALBERGO=B267 +BUONCONVENTO=B269 +BUONVICINO=B270 +BURAGO_DI_MOLGORA=B272 +BURCEI=B274 +BURGIO=B275 +BURGOS=B276 +BURIASCO=B278 +BUROLO=B279 +BURONZO=B280 +BURUNDI=Z305 +BUSACHI=B281 +BUSALLA=B282 +BUSANA=B283 +BUSANO=B284 +BUSCA=B285 +BUSCATE=B286 +BUSCEMI=B287 +BUSETO_PALIZZOLO=B288 +BUSNAGO=B289 +BUSSERO=B292 +BUSSETO=B293 +BUSSI_SUL_TIRINO=B294 +BUSSO=B295 +BUSSOLENGO=B296 +BUSSOLENO=B297 +BUSTO_ARSIZIO=B300 +BUSTO_GAROLFO=B301 +BUTERA=B302 +BUTI=B303 +BUTTAPIETRA=B304 +BUTTIGLIERA_D'ASTI=B306 +BUTTRIO=B309 +BUTTUGLIERA_ALTA=B305 +CA'_D'ANDREA=B320 +CABELLA_LIGURE=B311 +CABIATE=B313 +CABRAS=B314 +CACCAMO=B315 +CACCURI=B319 +CADEGLIANO_VICONAGO=B326 +CADELBOSCO_DI_SOPRA=B328 +CADEO=B332 +CADERZONE=B335 +CADONEGHE=B345 +CADORAGO=B346 +CADREZZATE=B347 +CAERANO_DI_SAN_MARCO=B349 +CAFASSE=B350 +CAGGIANO=B351 +CAGLI=B352 +CAGLIARI=B354 +CAGLIO=B355 +CAGNANO_AMITERNO=B358 +CAGNANO_VARANO=B357 +CAGNO=B359 +CAGNO'=B360 +CAIANELLO=B361 +CAIAZZO=B362 +CAINES=B364 +CAINO=B365 +CAIOLO=B366 +CAIRANO=B367 +CAIRATE=B368 +CAIRO_MONTENOTTE=B369 +CAIVANO=B371 +CALABRITTO=B374 +CALALZO_DI_CADORE=B375 +CALAMANDRANA=B376 +CALAMONACI=B377 +CALANGIANUS=B378 +CALANNA=B379 +CALASCA_CASTIGLIONE=B380 +CALASCIBETTA=B381 +CALASCIO=B382 +CALASETTA=B383 +CALATABIANO=B384 +CALATAFIMI=B385 +CALAVINO=B386 +CALCATA=B388 +CALCERANICA_AL_LAGO=B389 +CALCI=B390 +CALCIANO=B391 +CALCINAIA=B392 +CALCINATE=B393 +CALCINATO=B394 +CALCIO=B395 +CALCO=B396 +CALDARO_SULLA_STRADA_DEL_VINO=B397 +CALDAROLA=B398 +CALDERARA_DI_RENO=B399 +CALDES=B400 +CALDIERO=B402 +CALDOGNO=B403 +CALDONAZZO=B404 +CALENDASCO=B405 +CALENZANO=B406 +CALESTANO=B408 +CALICE_AL_CORNOVIGLIO=B410 +CALICE_LIGURE=B409 +CALIMERA=B413 +CALITRI=B415 +CALIZZANO=B416 +CALLABIANA=B417 +CALLIANO=B418 +CALLIANO=B419 +CALOLZIOCORTE=B423 +CALOPEZZATI=B424 +CALOSSO=B425 +CALOVETO=B426 +CALTABELLOTTA=B427 +CALTAGIRONE=B428 +CALTANISSETTA=B429 +CALTAVUTURO=B430 +CALTIGNAGA=B431 +CALTO=B432 +CALTRANO=B433 +CALUSCO_D'ADDA=B434 +CALUSO=B435 +CALVAGESE_DELLA_RIVIERA=B436 +CALVANICO=B437 +CALVATONE=B439 +CALVELLO=B440 +CALVENE=B441 +CALVENZANO=B442 +CALVERA=B443 +CALVI=B444 +CALVI_DELL'UMBRIA=B446 +CALVI_RISORTA=B445 +CALVIGNANO=B447 +CALVIGNASCO=B448 +CALVISANO=B450 +CALVIZZANO=B452 +CAMAGNA_MONFERRATO=B453 +CAMAIORE=B455 +CAMAIRAGO=B456 +CAMANDONA=B457 +CAMASTRA=B460 +CAMBIAGO=B461 +CAMBIANO=B462 +CAMBIASCA=B463 +CAMBOGIA=Z208 +CAMBURZANO=B465 +CAMERANA=B467 +CAMERANO=B468 +CAMERANO_CASASCO=B469 +CAMERATA_CORNELLO=B471 +CAMERATA_NUOVA=B472 +CAMERATA_PICENA=B470 +CAMERI=B473 +CAMERINO=B474 +CAMEROTA=B476 +CAMIGLIANO=B477 +CAMINATA=B479 +CAMINI=B481 +CAMINO=B482 +CAMINO_AL_TAGLIAMENTO=B483 +CAMISANO=B484 +CAMISANO_VICENTINO=B485 +CAMMARATA=B486 +CAMO=B489 +CAMOGLI=B490 +CAMPAGNA=B492 +CAMPAGNA_LUPIA=B493 +CAMPAGNANO_DI_ROMA=B496 +CAMPAGNATICO=B497 +CAMPAGNOLA_CREMASCA=B498 +CAMPAGNOLA_EMILIA=B499 +CAMPANA=B500 +CAMPARADA=B501 +CAMPEGINE=B502 +CAMPELLO_SUL_CLITUNNO=B504 +CAMPERTOGNO=B505 +CAMPI_BISENZIO=B507 +CAMPI_SALENTINA=B506 +CAMPIGLIA_CERVO=B508 +CAMPIGLIA_DEI_BERICI=B511 +CAMPIGLIA_MARITTIMA=B509 +CAMPIGLIONE_FENILE=B512 +CAMPIONE_D'ITALIA=B513 +CAMPITELLO_DI_FASSA=B514 +CAMPLI=B515 +CAMPO_CALABRO=B516 +CAMPO_DI_GIOVE=B526 +CAMPO_DI_TRENS=B529 +CAMPO_LIGURE=B538 +CAMPO_NELL'ELBA=B553 +CAMPO_SAN_MARTINO=B564 +CAMPO_TURES=B570 +CAMPOBASSO=B519 +CAMPOBELLO_DI_LICATA=B520 +CAMPOBELLO_DI_MAZARA=B521 +CAMPOCHIARO=B522 +CAMPODARSEGO=B524 +CAMPODENNO=B525 +CAMPODIMELE=B527 +CAMPODIPIETRA=B528 +CAMPODOLCINO=B530 +CAMPODORO=B531 +CAMPOFELICE_DI_FITALIA=B533 +CAMPOFELICE_DI_ROCCELLA=B532 +CAMPOFILONE=B534 +CAMPOFIORITO=B535 +CAMPOFORMIDO=B536 +CAMPOFRANCO=B537 +CAMPOGALLIANO=B539 +CAMPOLATTARO=B541 +CAMPOLI_APPENNINO=B543 +CAMPOLI_DEL_MONTE_TABURNO=B542 +CAMPOLIETO=B544 +CAMPOLONGO_AL_TORRE=B545 +CAMPOLONGO_MAGGIORE=B546 +CAMPOLONGO_SUL_BRENTA=B547 +CAMPOMAGGIORE=B549 +CAMPOMARINO=B550 +CAMPOMORONE=B551 +CAMPONOGARA=B554 +CAMPORA=B555 +CAMPOREALE=B556 +CAMPORGIANO=B557 +CAMPOROSSO=B559 +CAMPOROTONDO_DI_FIASTRONE=B562 +CAMPOROTONDO_ETNEO=B561 +CAMPOSAMPIERO=B563 +CAMPOSANO=B565 +CAMPOSANTO=B566 +CAMPOSPINOSO=B567 +CAMPOTOSTO=B569 +CAMUGNANO=B572 +CANADA=Z401 +CANAL_SAN_BOVO=B577 +CANALE=B573 +CANALE_D'AGORDO=B574 +CANALE_DI_PANAMA=Z517 +CANALE_MONTERANO=B576 +CANARO=B578 +CANAZEI=B579 +CANCELLARA=B580 +CANCELLO_ED_ARNONE=B581 +CANDA=B582 +CANDELA=B584 +CANDELO=B586 +CANDIA_CANAVESE=B588 +CANDIA_LOMELLINA=B587 +CANDIANA=B589 +CANDIDA=B590 +CANDIDONI=B591 +CANDIOLO=B592 +CANEGRATE=B593 +CANELLI=B594 +CANEPINA=B597 +CANEVA=B598 +CANEVINO=B599 +CANICATTI'=B602 +CANICATTINI_BAGNI=B603 +CANINO=B604 +CANISCHIO=B605 +CANISTRO=B606 +CANNA=B607 +CANNALONGA=B608 +CANNARA=B609 +CANNERO_RIVIERA=B610 +CANNETO_PAVESE=B613 +CANNETO_SULL'OGLIO=B612 +CANNOBIO=B615 +CANNOLE=B616 +CANOLO=B617 +CANONICA_D'ADDA=B618 +CANOSA_DI_PUGLIA=B619 +CANOSA_SANNITA=B620 +CANOSIO=B621 +CANSANO=B624 +CANTAGALLO=B626 +CANTALICE=B627 +CANTALUPA=B628 +CANTALUPO_IN_SABINA=B631 +CANTALUPO_LIGURE=B629 +CANTALUPO_NEL_SANNIO=B630 +CANTARANA=B633 +CANTELLO=B634 +CANTERANO=B635 +CANTIANO=B636 +CANTOIRA=B637 +CANTU'=B639 +CANZANO=B640 +CANZO=B641 +CAORLE=B642 +CAORSO=B643 +CAPACCIO=B644 +CAPACI=B645 +CAPALBIO=B646 +CAPANNOLI=B647 +CAPANNORI=B648 +CAPENA=B649 +CAPERGNANICA=B650 +CAPESTRANO=B651 +CAPIAGO_INTIMIANO=B653 +CAPISTRANO=B655 +CAPISTRELLO=B656 +CAPITIGNANO=B658 +CAPIZZI=B660 +CAPIZZONE=B661 +CAPO_DI_PONTE=B664 +CAPO_D'ORLANDO=B666 +CAPO_VERDE=Z307 +CAPODIMONTE=B663 +CAPODRISE=B667 +CAPOLIVERI=B669 +CAPOLONA=B670 +CAPONAGO=B671 +CAPORCIANO=B672 +CAPOSELE=B674 +CAPOTERRA=B675 +CAPOVALLE=B676 +CAPPADOCIA=B677 +CAPPELLA_CANTONE=B679 +CAPPELLA_DE'_PICENARDI=B680 +CAPPELLA_MAGGIORE=B678 +CAPPELLE_SUL_TAVO=B681 +CAPRACOTTA=B682 +CAPRAIA_E_LIMITE=B684 +CAPRAIA_ISOLA=B685 +CAPRALBA=B686 +CAPRANICA=B688 +CAPRANICA_PRENESTINA=B687 +CAPRARICA_DI_LECCE=B690 +CAPRAROLA=B691 +CAPRAUNA=B692 +CAPRESE_MICHELANGELO=B693 +CAPREZZO=B694 +CAPRI=B696 +CAPRI_LEONE=B695 +CAPRIANA=B697 +CAPRIANO_DEL_COLLE=B698 +CAPRIATA_D'ORBA=B701 +CAPRIATE_SAN_GERVASIO=B703 +CAPRIATI_A_VOLTURNO=B704 +CAPRIE=B705 +CAPRIGLIA_IRPINA=B706 +CAPRIGLIO=B707 +CAPRILE=B708 +CAPRINO_BERGAMASCO=B710 +CAPRINO_VERONESE=B709 +CAPRIOLO=B711 +CAPRIVA_DEL_FRIULI=B712 +CAPUA=B715 +CAPURSO=B716 +CARAFFA_DEL_BIANCO=B718 +CARAFFA_DI_CATANZARO=B717 +CARAGLIO=B719 +CARAMAGNA_PIEMONTE=B720 +CARAMANICO_TERME=B722 +CARANO=B723 +CARAPELLE=B724 +CARAPELLE_CALVISIO=B725 +CARASCO=B726 +CARASSAI=B727 +CARATE_BRIANZA=B729 +CARATE_URIO=B730 +CARAVAGGIO=B731 +CARAVATE=B732 +CARAVINO=B733 +CARAVONICA=B734 +CARBOGNANO=B735 +CARBONARA_AL_TICINO=B741 +CARBONARA_DI_NOLA=B740 +CARBONARA_DI_PO=B739 +CARBONARA_SCRIVIA=B736 +CARBONATE=B742 +CARBONE=B743 +CARBONERA=B744 +CARBONIA=B745 +CARCARE=B748 +CARCERI=B749 +CARCOFORO=B752 +CARDANO_AL_CAMPO=B754 +CARDE'=B755 +CARDETO=B756 +CARDINALE=B758 +CARDITO=B759 +CAREGGINE=B760 +CAREMA=B762 +CARENNO=B763 +CARENTINO=B765 +CARERI=B766 +CARESANA=B767 +CARESANABLOT=B768 +CAREZZANO=B769 +CARFIZZI=B771 +CARGEGHE=B772 +CARIATI=B774 +CARIFE=B776 +CARIGNANO=B777 +CARIMATE=B778 +CARINARO=B779 +CARINI=B780 +CARINOLA=B781 +CARISIO=B782 +CARISOLO=B783 +CARLANTINO=B784 +CARLAZZO=B786 +CARLENTINI=B787 +CARLINO=B788 +CARLOFORTE=B789 +CARLOPOLI=B790 +CARMAGNOLA=B791 +CARMIANO=B792 +CARMIGNANO=B794 +CARMIGNANO_DI_BRENTA=B795 +CARNAGO=B796 +CARNATE=B798 +CAROBBIO_DEGLI_ANGELI=B801 +CAROLEI=B802 +CARONA=B803 +CARONIA=B804 +CARONNO_PERTUSELLA=B805 +CARONNO_VARESINO=B807 +CAROSINO=B808 +CAROVIGNO=B809 +CAROVILLI=B810 +CARPANETO_PIACENTINO=B812 +CARPANZANO=B813 +CARPASIO=B814 +CARPEGNA=B816 +CARPENEDOLO=B817 +CARPENETO=B818 +CARPI=B819 +CARPIANO=B820 +CARPIGNANO_SALENTINO=B822 +CARPIGNANO_SESIA=B823 +CARPINETI=B825 +CARPINETO_DELLA_NORA=B827 +CARPINETO_ROMANO=B828 +CARPINETO_SINELLO=B826 +CARPINO=B829 +CARPINONE=B830 +CARRARA=B832 +CARRARA_SAN_GIORGIO=B833 +CARRARA_SANTO_STEFANO=B834 +CARRE'=B835 +CARREGA_LIGURE=B836 +CARRO=B838 +CARRODANO=B839 +CARROSIO=B840 +CARRU'=B841 +CARSOLI=B842 +CARTIGLIANO=B844 +CARTIGNANO=B845 +CARTOCETO=B846 +CARTOSIO=B847 +CARTURA=B848 +CARUGATE=B850 +CARUGO=B851 +CARUNCHIO=B853 +CARVICO=B854 +CARZANO=B856 +CASABONA=B857 +CASACALENDA=B858 +CASACANDITELLA=B859 +CASAGIOVE=B860 +CASAL_CERMELLI=B870 +CASAL_DI_PRINCIPE=B872 +CASAL_VELINO=B895 +CASALANGUIDA=B861 +CASALATTICO=B862 +CASALBELTRAME=B864 +CASALBORDINO=B865 +CASALBORE=B866 +CASALBORGONE=B867 +CASALBUONO=B868 +CASALBUTTANO_ED_UNITI=B869 +CASALCIPRANO=B871 +CASALDUNI=B873 +CASALE_CORTE_CERRO=B876 +CASALE_CREMASCO_VIDOLASCO=B881 +CASALE_DI_SCODOSIA=B877 +CASALE_LITTA=B875 +CASALE_MARITTIMO=B878 +CASALE_MONFERRATO=B885 +CASALE_SUL_SILE=B879 +CASALECCHIO_DI_RENO=B880 +CASALEGGIO_BOIRO=B882 +CASALEGGIO_NOVARA=B883 +CASALEONE=B886 +CASALETTO_CEREDANO=B889 +CASALETTO_DI_SOPRA=B890 +CASALETTO_LODIGIANO=B887 +CASALETTO_SPARTANO=B888 +CASALETTO_VAPRIO=B891 +CASALFIUMANESE=B892 +CASALGRANDE=B893 +CASALGRASSO=B894 +CASALINCONTRADA=B896 +CASALINO=B897 +CASALMAGGIORE=B898 +CASALMAIOCCO=B899 +CASALMORANO=B900 +CASALMORO=B901 +CASALNOCETO=B902 +CASALNUOVO_DI_NAPOLI=B905 +CASALNUOVO_MONTEROTARO=B904 +CASALOLDO=B907 +CASALPUSTERLENGO=B910 +CASALROMANO=B911 +CASALSERUGO=B912 +CASALUCE=B916 +CASALVECCHIO_DI_PUGLIA=B917 +CASALVECCHIO_SICULO=B918 +CASALVIERI=B919 +CASALVOLONE=B920 +CASALZUIGNO=B921 +CASAMARCIANO=B922 +CASAMASSIMA=B923 +CASAMICCIOLA_TERME=B924 +CASANDRINO=B925 +CASANOVA_ELVO=B928 +CASANOVA_LERRONE=B927 +CASANOVA_LONATI=B929 +CASAPE=B932 +CASAPESENNA=H798 +CASAPINTA=B933 +CASAPROTA=B934 +CASAPULLA=B935 +CASARANO=B936 +CASARGO=B937 +CASARILE=B938 +CASARSA_DELLA_DELIZIA=B940 +CASARZA_LIGURE=B939 +CASASCO=B941 +CASASCO_D'INTELVI=B942 +CASATENOVO=B943 +CASATISMA=B945 +CASAVATORE=B946 +CASAZZA=B947 +CASCIA=B948 +CASCIAGO=B949 +CASCIANA_TERME=B559 +CASCINA=B950 +CASCINETTE_D'IVREA=B953 +CASEI_GEROLA=B954 +CASELETTE=B955 +CASELLA=B956 +CASELLE_IN_PITTARI=B959 +CASELLE_LANDI=B961 +CASELLE_LURANI=B958 +CASELLE_TORINESE=B960 +CASERTA=B963 +CASIER=B965 +CASIGNANA=B966 +CASINA=B967 +CASIRATE_D'ADDA=B971 +CASLINO_D'ERBA=B974 +CASNATE_CON_BERNATE=B977 +CASNIGO=B978 +CASOLA_DI_NAPOLI=B980 +CASOLA_IN_LUNIGIANA=B979 +CASOLA_VALSENIO=B982 +CASOLE_BRUZIO=B983 +CASOLE_D'ELSA=B984 +CASOLI=B985 +CASORATE_PRIMO=B988 +CASORATE_SEMPIONE=B987 +CASOREZZO=B989 +CASORIA=B990 +CASORZO=B991 +CASPERIA=A472 +CASPOGGIO=B993 +CASSACCO=B994 +CASSAGO_BRIANZA=B996 +CASSANO_ALLO_IONIO=C002 +CASSANO_D'ADDA=C003 +CASSANO_DELLE_MURGE=B998 +CASSANO_IRPINO=B997 +CASSANO_MAGNAGO=C004 +CASSANO_SPINOLA=C005 +CASSANO_VALCUVIA=B999 +CASSARO=C006 +CASSIGLIO=C007 +CASSINA_DE'_PECCHI=C014 +CASSINA_RIZZARDI=C020 +CASSINA_VALSASSINA=C024 +CASSINASCO=C022 +CASSINE=C027 +CASSINELLE=C030 +CASSINETTA_DI_LUGAGNANO=C033 +CASSINO=C034 +CASSOLA=C037 +CASSOLNOVO=C038 +CASTAGNARO=C041 +CASTAGNETO_CARDUCCI=C044 +CASTAGNETO_PO=C045 +CASTAGNITO=C046 +CASTAGNOLE_DELLE_LANZE=C049 +CASTAGNOLE_MONFERRATO=C047 +CASTAGNOLE_PIEMONTE=C048 +CASTANA=C050 +CASTANO_PRIMO=C052 +CASTEGGIO=C053 +CASTEGNATO=C055 +CASTEGNERO=C056 +CASTEL_BARONIA=C058 +CASTEL_BOGLIONE=C064 +CASTEL_BOLOGNESE=C065 +CASTEL_CAMPAGNANO=B494 +CASTEL_CASTAGNA=C040 +CASTEL_COLONNA=C071 +CASTEL_CONDINO=C000 +CASTEL_D'AIANO=C075 +CASTEL_D'ARIO=C076 +CASTEL_D'AZZANO=C078 +CASTEL_DEL_GIUDICE=C082 +CASTEL_DEL_MONTE=C083 +CASTEL_DEL_PIANO=C085 +CASTEL_DEL_RIO=C086 +CASTEL_DI_CASIO=B969 +CASTEL_DI_IERI=C090 +CASTEL_DI_IUDICA=C091 +CASTEL_DI_LAMA=C093 +CASTEL_DI_LUCIO=C094 +CASTEL_DI_SANGRO=C096 +CASTEL_DI_SASSO=C097 +CASTEL_DI_TORA=C098 +CASTEL_FOCOGNANO=C102 +CASTEL_FRENTANO=C114 +CASTEL_GABBIANO=C115 +CASTEL_GANDOLFO=C116 +CASTEL_GIORGIO=C117 +CASTEL_GOFFREDO=C118 +CASTEL_GUELFO_DI_BOLOGNA=C121 +CASTEL_MADAMA=C203 +CASTEL_MAGGIORE=C204 +CASTEL_MELLA=C208 +CASTEL_MOLA=C210 +CASTEL_MORRONE=C211 +CASTEL_RITALDI=C252 +CASTEL_ROCCHERO=C253 +CASTEL_ROZZONE=C255 +CASTEL_SAN_GIORGIO=C259 +CASTEL_SAN_GIOVANNI=C261 +CASTEL_SAN_LORENZO=C262 +CASTEL_SAN_NICCOLO'=C263 +CASTEL_SAN_PIETRO_ROMANO=C266 +CASTEL_SAN_PIETRO_TERME=C265 +CASTEL_SAN_VINCENZO=C270 +CASTEL_SANT'ANGELO=C268 +CASTEL_SANT'ELIA=C269 +CASTEL_VISCARDO=C289 +CASTEL_VITTORIO=C110 +CASTEL_VOLTURNO=C291 +CASTELBALDO=C057 +CASTELBELFORTE=C059 +CASTELBELLINO=C060 +CASTELBELLO_CIARDES=C062 +CASTELBIANCO=C063 +CASTELBOTTACCIO=C066 +CASTELBUONO=C067 +CASTELCIVITA=C069 +CASTELCOVATI=C072 +CASTELCUCCO=C073 +CASTELDACCIA=C074 +CASTELDELCI=C080 +CASTELDELFINO=C081 +CASTELDIDONE=C089 +CASTELFIDARDO=C100 +CASTELFIORENTINO=C101 +CASTELFONDO=C103 +CASTELFORTE=C104 +CASTELFRANCI=C105 +CASTELFRANCO_DI_SOPRA=C112 +CASTELFRANCO_DI_SOTTO=C113 +CASTELFRANCO_EMILIA=C107 +CASTELFRANCO_IN_MISCANO=C106 +CASTELFRANCO_VENETO=C111 +CASTELGOMBERTO=C119 +CASTELGRANDE=C120 +CASTELGUGLIELMO=C122 +CASTELGUIDONE=C123 +CASTELLABATE=C125 +CASTELLAFIUME=C126 +CASTELL'ALFERO=C127 +CASTELLALTO=C128 +CASTELLAMMARE_DEL_GOLFO=C130 +CASTELLAMMARE_DI_STABIA=C129 +CASTELLAMONTE=C133 +CASTELLANA_GROTTE=C134 +CASTELLANA_SICULA=C135 +CASTELLANETA=C136 +CASTELLANIA=C137 +CASTELLANZA=C139 +CASTELLAR=C140 +CASTELLAR_GUIDOBONO=C142 +CASTELLARANO=C141 +CASTELLARO=C143 +CASTELL'ARQUATO=C145 +CASTELLAVAZZO=C146 +CASTELL'AZZARA=C147 +CASTELLAZZO_BORMIDA=C148 +CASTELLAZZO_NOVARESE=C149 +CASTELLEONE=C153 +CASTELLEONE_DI_SUASA=C152 +CASTELLERO=C154 +CASTELLETTO_CERVO=C155 +CASTELLETTO_D'ERRO=C156 +CASTELLETTO_DI_BRANDUZZO=C157 +CASTELLETTO_D'ORBA=C158 +CASTELLETTO_MERLI=C160 +CASTELLETTO_MOLINA=C161 +CASTELLETTO_MONFERRATO=C162 +CASTELLETTO_SOPRA_TICINO=C166 +CASTELLETTO_STURA=C165 +CASTELLETTO_UZZONE=C167 +CASTELLI=C169 +CASTELLI_CALEPIO=C079 +CASTELLINA_IN_CHIANTI=C172 +CASTELLINA_MARITTIMA=C174 +CASTELLINALDO=C173 +CASTELLINO_DEL_BIFERNO=C175 +CASTELLINO_TANARO=C176 +CASTELLIRI=C177 +CASTELLO_CABIAGLIO=B312 +CASTELLO_D'AGOGNA=C184 +CASTELLO_D'ARGILE=C185 +CASTELLO_DEL_MATESE=C178 +CASTELLO_DELL'ACQUA=C186 +CASTELLO_DI_ANNONE=A300 +CASTELLO_DI_BRIANZA=C187 +CASTELLO_DI_CISTERNA=C188 +CASTELLO_DI_GODEGO=C190 +CASTELLO_DI_SERRAVALLE=C191 +CASTELLO_MOLINA_DI_FIEMME=C189 +CASTELLO_TESINO=C194 +CASTELLUCCHIO=C195 +CASTELLUCCIO_DEI_SAURI=C198 +CASTELLUCCIO_INFERIORE=C199 +CASTELLUCCIO_SUPERIORE=C201 +CASTELLUCCIO_VALMAGGIORE=C202 +CASTELL'UMBERTO=C051 +CASTELMAGNO=C205 +CASTELMARTE=C206 +CASTELMASSA=C207 +CASTELMAURO=C197 +CASTELMEZZANO=C209 +CASTELNOVETTO=C213 +CASTELNOVO_BARIANO=C215 +CASTELNOVO_DEL_FRIULI=C217 +CASTELNOVO_DI_SOTTO=C218 +CASTELNOVO_NE'MONTI=C219 +CASTELNUOVO=C216 +CASTELNUOVO_BELBO=C226 +CASTELNUOVO_BERARDENGA=C227 +CASTELNUOVO_BOCCA_D'ADDA=C228 +CASTELNUOVO_BORMIDA=C229 +CASTELNUOVO_BOZZENTE=C220 +CASTELNUOVO_CALCEA=C230 +CASTELNUOVO_CILENTO=C231 +CASTELNUOVO_DEL_GARDA=C225 +CASTELNUOVO_DELLA_DAUNIA=C222 +CASTELNUOVO_DI_CEVA=C214 +CASTELNUOVO_DI_CONZA=C235 +CASTELNUOVO_DI_FARFA=C224 +CASTELNUOVO_DI_GARFAGNANA=C236 +CASTELNUOVO_DI_PORTO=C237 +CASTELNUOVO_DI_VAL_DI_CECINA=C244 +CASTELNUOVO_DON_BOSCO=C232 +CASTELNUOVO_MAGRA=C240 +CASTELNUOVO_NIGRA=C241 +CASTELNUOVO_PARANO=C223 +CASTELNUOVO_RANGONE=C242 +CASTELNUOVO_SCRIVIA=C243 +CASTELPAGANO=C245 +CASTELPETROSO=C246 +CASTELPIZZUTO=C247 +CASTELPLANIO=C248 +CASTELPOTO=C250 +CASTELRAIMONDO=C251 +CASTELROTTO=C254 +CASTELSANTANGELO_SUL_NERA=C267 +CASTELSARACENO=C271 +CASTELSARDO=C272 +CASTELSEPRIO=C273 +CASTELSILANO=B968 +CASTELSPINA=C274 +CASTELTERMINI=C275 +CASTELVECCANA=C181 +CASTELVECCHIO_CALVISIO=C278 +CASTELVECCHIO_DI_ROCCA_BARBENA=C276 +CASTELVECCHIO_SUBEQUO=C279 +CASTELVENERE=C280 +CASTELVERDE=B129 +CASTELVERRINO=C200 +CASTELVETERE_IN_VAL_FORTORE=C284 +CASTELVETERE_SUL_CALORE=C283 +CASTELVETRANO=C286 +CASTELVETRO_DI_MODENA=C287 +CASTELVETRO_PIACENTINO=C288 +CASTELVISCONTI=C290 +CASTENASO=C292 +CASTENEDOLO=C293 +CASTIGLION_FIBOCCHI=C318 +CASTIGLION_FIORENTINO=C319 +CASTIGLIONE_A_CASAURIA=C308 +CASTIGLIONE_CHIAVARESE=C302 +CASTIGLIONE_COSENTINO=C301 +CASTIGLIONE_D'ADDA=C304 +CASTIGLIONE_DEI_PEPOLI=C296 +CASTIGLIONE_DEL_GENOVESI=C306 +CASTIGLIONE_DEL_LAGO=C309 +CASTIGLIONE_DELLA_PESCAIA=C310 +CASTIGLIONE_DELLE_STIVIERE=C312 +CASTIGLIONE_DI_GARFAGNANA=C303 +CASTIGLIONE_DI_SICILIA=C297 +CASTIGLIONE_D'INTELVI=C299 +CASTIGLIONE_D'ORCIA=C313 +CASTIGLIONE_FALLETTO=C314 +CASTIGLIONE_IN_TEVERINA=C315 +CASTIGLIONE_MESSER_MARINO=C298 +CASTIGLIONE_MESSER_RAIMONDO=C316 +CASTIGLIONE_OLONA=C300 +CASTIGLIONE_TINELLA=C317 +CASTIGLIONE_TORINESE=C307 +CASTIGNANO=C321 +CASTILENTI=C322 +CASTINO=C323 +CASTIONE_ANDEVENNO=C325 +CASTIONE_DELLA_PRESOLANA=C324 +CASTIONS_DI_STRADA=C327 +CASTIRAGA_VIDARDO=C329 +CASTO=C330 +CASTORANO=C331 +CASTREZZATO=C332 +CASTRI_DI_LECCE=C334 +CASTRIGNANO_DE'GRECI=C335 +CASTRIGNANO_DEL_CAPO=C336 +CASTRO=C337 +CASTRO=C338 +CASTRO_DEI_VOLSCI=C338 +CASTROCARO_TERME=C339 +CASTROCIELO=C340 +CASTROFILIPPO=C341 +CASTROLIBERO=C108 +CASTRONNO=C343 +CASTRONUOVO_DI_SANT'ANDREA=C345 +CASTRONUOVO_DI_SICILIA=C344 +CASTROPIGNANO=C346 +CASTROREALE=C347 +CASTROREGIO=C348 +CASTROVILLARI=C349 +CATANIA=C351 +CATANZARO=C352 +CATENANUOVA=C353 +CATIGNANO=C354 +CATTOLICA=C357 +CATTOLICA_ERACLEA=C356 +CAULONIA=C285 +CAUTANO=C359 +CAVA_DE'TIRRENI=C361 +CAVA_MANARA=C360 +CAVACURTA=C362 +CAVAGLIA=C363 +CAVAGLIETTO=C364 +CAVAGLIO_D'AGOGNA=C365 +CAVAGLIO_SPOCCIA=C367 +CAVAGNOLO=C369 +CAVAION_VERONESE=C370 +CAVALESE=C372 +CAVALLASCA=C374 +CAVALLERLEONE=C375 +CAVALLERMAGGIORE=C376 +CAVALLINO=C377 +CAVALLIRIO=C378 +CAVARENO=C380 +CAVARGNA=C381 +CAVARIA_CON_PREMEZZO=C382 +CAVARZERE=C383 +CAVASO_DEL_TOMBA=C384 +CAVASSO_NUOVO=C385 +CAVATORE=C387 +CAVAZZO_CARNICO=C389 +CAVE=C390 +CAVEDAGO=C392 +CAVEDINE=C393 +CAVENAGO_D'ADDA=C394 +CAVENAGO_DI_BRIANZA=C395 +CAVERNAGO=C396 +CAVEZZO=C398 +CAVIZZANA=C400 +CAVOUR=C404 +CAVRIAGO=C405 +CAVRIANA=C406 +CAVRIGLIA=C407 +CAZZAGO_BRABBIA=C409 +CAZZAGO_SAN_MARTINO=C408 +CAZZANO_DI_TRAMIGNA=C412 +CAZZANO_SANT'ANDREA=C410 +CECCANO=C413 +CECIMA=C414 +CECINA=C415 +CECOSLOVACCHIA=Z105 +CEDEGOLO=C417 +CEDRASCO=C418 +CEFALA'_DIANA=C420 +CEFALU'=C421 +CEGGIA=C422 +CEGLIE_MESSAPICO=C424 +CELANO=C426 +CELENZA_SUL_TRIGNO=C428 +CELENZA_VALFORTORE=C429 +CELICO=C430 +CELLA_DATI=C435 +CELLA_MONTE=C432 +CELLAMARE=C436 +CELLARA=C437 +CELLARENGO=C438 +CELLATICA=C439 +CELLE_DI_BULGHERIA=C444 +CELLE_DI_MACRA=C441 +CELLE_DI_SAN_VITO=C442 +CELLE_ENOMONDO=C440 +CELLE_LIGURE=C443 +CELLENO=C446 +CELLERE=C447 +CELLINO_ATTANASIO=C449 +CELLINO_SAN_MARCO=C448 +CELLIO=C450 +CELLOLE=C000 +CEMBRA=C452 +CENADI=C453 +CENATE_SOPRA=C456 +CENATE_SOTTO=C457 +CENCENIGHE_AGORDINO=C458 +CENE=C459 +CENESELLI=C461 +CENGIO=C463 +CENTA_SAN_NICOLO'=C467 +CENTALLO=C466 +CENTO=C469 +CENTOLA=C470 +CENTRACHE=C472 +CENTURIPE=C471 +CEPAGATTI=C474 +CEPPALONI=C476 +CEPPO_MORELLI=C478 +CEPRANO=C479 +CERAMI=C480 +CERANESI=C481 +CERANO=C483 +CERANO_D'INTELVI=C482 +CERANOVA=C484 +CERASO=C485 +CERCEMAGGIORE=C486 +CERCENASCO=C487 +CERCEPICCOLA=C488 +CERCHIARA_DI_CALABRIA=C489 +CERCHIO=C492 +CERCINO=C493 +CERCIVENTO=C494 +CERCOLA=C495 +CERDA=C496 +CEREA=C498 +CEREGNANO=C500 +CERENZIA=C501 +CERES=C497 +CERESARA=C502 +CERESETO=C503 +CERESOLE_ALBA=C504 +CERESOLE_REALE=C505 +CERETE=C506 +CERETTO_LOMELLINA=C508 +CERGNAGO=C509 +CERIALE=C510 +CERIANA=C511 +CERIANO_LAGHETTO=C512 +CERIGNALE=C513 +CERIGNOLA=C514 +CERISANO=C515 +CERMENATE=C516 +CERMES=A022 +CERMIGNANO=C517 +CERNOBBIO=C520 +CERNUSCO_LOMBARDONE=C521 +CERNUSCO_SUL_NAVIGLIO=C523 +CERRETO_CASTELLO=C526 +CERRETO_D'ASTI=C528 +CERRETO_D'ESI=C524 +CERRETO_DI_SPOLETO=C527 +CERRETO_GRUE=C507 +CERRETO_GUIDI=C529 +CERRETO_LAZIALE=C518 +CERRETO_SANNITA=C525 +CERRETTO_DELLE_LANGHE=C530 +CERRINA_MONFERRATO=C531 +CERRIONE=C532 +CERRO_AL_LAMBRO=C536 +CERRO_AL_VOLTURNO=C534 +CERRO_MAGGIORE=C537 +CERRO_TANARO=C533 +CERRO_VERONESE=C538 +CERSOSIMO=C539 +CERTALDO=C540 +CERTOSA_DI_PAVIA=C541 +CERVA=C542 +CERVARA_DI_ROMA=C543 +CERVARESE_SANTA_CROCE=C544 +CERVARO=C545 +CERVASCA=C547 +CERVATTO=C548 +CERVENO=C549 +CERVERE=C550 +CERVESINA=C551 +CERVETERI=C552 +CERVIA=C553 +CERVICATI=C554 +CERVIGNANO_D'ADDA=C555 +CERVIGNANO_DEL_FRIULI=C556 +CERVINARA=C557 +CERVINO=C558 +CERVO=C559 +CERZETO=C560 +CESA=C561 +CESANA_BRIANZA=C563 +CESANA_TORINESE=C564 +CESANO_BOSCONE=C565 +CESANO_MADERNO=C566 +CESARA=C567 +CESARO'=C568 +CESATE=C569 +CESENA=C573 +CESENATICO=C574 +CESINALI=C576 +CESIO=C578 +CESIOMAGGIORE=C577 +CESSALTO=C580 +CESSANITI=C581 +CESSAPALOMBO=C582 +CESSOLE=C583 +CETARA=C584 +CETO=C585 +CETONA=C587 +CETRARO=C588 +CEVA=C589 +CEVO=C591 +CEYLON=Z209 +CHALLANT_SAINT_VICTOR=C594 +CHALLANT_SAINT'ANSELME=C593 +CHAMBAVE=C595 +CHAMOIS=B491 +CHAMPDEPRAZ=C596 +CHAMPORCHER=B540 +CHARVENSOD=C598 +CHATILLON=C294 +CHERASCO=C599 +CHEREMULE=C600 +CHIALAMBERTO=C604 +CHIAMPO=C605 +CHIANCHE=C606 +CHIANCIANO_TERME=C608 +CHIANNI=C609 +CHIANOCCO=C610 +CHIARAMONTE_GULFI=C612 +CHIARAMONTI=C613 +CHIARANO=C614 +CHIARAVALLE=C615 +CHIARAVALLE_CENTRALE=C616 +CHIARI=C618 +CHIAROMONTE=C619 +CHIAUCI=C620 +CHIAVARI=C621 +CHIAVENNA=C623 +CHIAVERANO=C624 +CHIENES=C625 +CHIERI=C627 +CHIES_D'ALPAGO=C630 +CHIESA_IN_VALMALENCO=C628 +CHIESANUOVA=C629 +CHIESINA_UZZANESE=C631 +CHIETI=C632 +CHIEUTI=C633 +CHIEVE=C634 +CHIGNOLO_D'ISOLA=C635 +CHIGNOLO_PO=C637 +CHIOGGIA=C638 +CHIOMONTE=C639 +CHIONS=C640 +CHIOPRIS_VISCONE=C641 +CHITIGNANO=C648 +CHIUDUNO=C649 +CHIUPPANO=C650 +CHIURO=C651 +CHIUSA=C652 +CHIUSA_DI_PESIO=C653 +CHIUSA_DI_SAN_MICHELE=C655 +CHIUSA_SCLAFANI=C654 +CHIUSAFORTE=C656 +CHIUSANICO=C657 +CHIUSANO_D'ASTI=C658 +CHIUSANO_DI_SAN_DOMENICO=C659 +CHIUSAVECCHIA=C660 +CHIUSDINO=C661 +CHIUSI=C662 +CHIUSI_DELLA_VERNA=C663 +CHIVASSO=C665 +CIAD=Z309 +CIAMPINO=C000 +CIANCIANA=C668 +CIANO_D'ENZA=C669 +CIBIANA_DI_CADORE=C672 +CICAGNA=C673 +CICALA=C674 +CICCIANO=C675 +CICERALE=C676 +CICILIANO=C677 +CICOGNOLO=C678 +CICONIO=C679 +CIGLIANO=C680 +CIGLIE'=C681 +CIGOGNOLA=C684 +CIGOLE=C685 +CILAVEGNA=C686 +CILE=Z603 +CIMADOLMO=C689 +CIMBERGO=C691 +CIMEGO=C694 +CIMINA'=C695 +CIMINNA=C696 +CIMITILE=C697 +CIMOLAIS=C699 +CIMONE=C700 +CINA=Z210 +CINAGLIO=C701 +CINETO_ROMANO=C702 +CINGIA_DE'BOTTI=C703 +CINGOLI=C704 +CINIGIANO=C705 +CINISELLO_BALSAMO=C707 +CINISI=C708 +CINO=C709 +CINQUEFRONDI=C710 +CINTANO=C711 +CINTE_TESINO=C712 +CINTO_CAOMAGGIORE=C714 +CINTO_EUGANEO=C713 +CINZANO=C715 +CIORLANO=C716 +CIPRESSA=C718 +CIPRO=Z211 +CIRCELLO=C719 +CIRIE'=C722 +CIRIGLIANO=C723 +CIRIMIDO=C724 +CIRO'=C725 +CIRO'_MARINA=C726 +CIS=C727 +CISANO_BERGAMASCO=C728 +CISANO_SUL_NEVA=C729 +CISERANO=C730 +CISLAGO=C732 +CISLIANO=C733 +CISMON_DEL_GRAPPA=C734 +CISON_DI_VALMARINO=C735 +CISSONE=C738 +CISTERNA_D'ASTI=C739 +CISTERNA_DI_LATINA=C740 +CISTERNINO=C741 +CITERNA=C742 +CITTA'_DELLA_PIEVE=C744 +CITTA'_DI_CASTELLO=C745 +CITTA'_SANT'ANGELO=C750 +CITTA`DEL_VATICANO=Z106 +CITTADELLA=C743 +CITTADUCALE=C746 +CITTANOVA=C747 +CITTAREALE=C749 +CITTIGLIO=C751 +CIVATE=C752 +CIVENNA=C754 +CIVEZZA=C755 +CIVEZZANO=C756 +CIVIASCO=C757 +CIVIDALE_DEL_FRIULI=C758 +CIVIDATE_AL_PIANO=C759 +CIVIDATE_CAMUNO=C760 +CIVITA=C763 +CIVITA_CASTELLANA=C765 +CIVITA_D'ANTINO=C766 +CIVITACAMPOMARANO=C764 +CIVITALUPARELLA=C768 +CIVITANOVA_DEL_SANNIO=C769 +CIVITANOVA_MARCHE=C770 +CIVITAQUANA=C771 +CIVITAVECCHIA=C773 +CIVITELLA_ALFEDENA=C778 +CIVITELLA_CASANOVA=C779 +CIVITELLA_D'AGLIANO=C780 +CIVITELLA_DEL_TRONTO=C781 +CIVITELLA_DI_ROMAGNA=C777 +CIVITELLA_IN_VAL_DI_CHIANA=C774 +CIVITELLA_MESSER_RAIMONDO=C776 +CIVITELLA_PAGANICO=C782 +CIVITELLA_ROVETO=C783 +CIVITELLA_SAN_PAOLO=C784 +CIVO=C785 +CLAINO_CON_OSTENO=C787 +CLAUT=C790 +CLAUZETTO=C791 +CLAVESANA=C792 +CLAVIERE=C793 +CLES=C794 +CLETO=C795 +CLIVIO=C796 +CLOZ=C797 +CLUSONE=C800 +COASSOLO_TORINESE=C801 +COAZZE=C803 +COAZZOLO=C804 +COCCAGLIO=C806 +COCCONATO=C807 +COCQUIO_TREVISAGO=C810 +COCULLO=C811 +CODEVIGO=C812 +CODEVILLA=C813 +CODIGORO=C814 +CODOGNE'=C815 +CODOGNO=C816 +CODROIPO=C817 +CODRONGIANUS=C818 +COGGIOLA=C819 +COGLIATE=C820 +COGNE=C821 +COGOLETO=C823 +COGOLLO_DEL_CENGIO=C824 +COGORNO=C826 +COLAZZA=C829 +COLBORDOLO=C830 +COLCAVAGNO=C831 +COLERE=C835 +COLFELICE=C836 +COLI=C838 +COLICO=C839 +COLLAGNA=C840 +COLLALTO_SABINO=C841 +COLLARMELE=C844 +COLLAZZONE=C845 +COLLE_BRIANZA=C851 +COLLE_D'ANCHISE=C854 +COLLE_DI_TORA=C857 +COLLE_DI_VAL_D'ELSA=C847 +COLLE_SAN_MAGNO=C870 +COLLE_SANNITA=C846 +COLLE_SANTA_LUCIA=C872 +COLLE_UMBERTO=C848 +COLLEBEATO=C850 +COLLECCHIO=C852 +COLLECORVINO=C853 +COLLEDARA=C311 +COLLEDIMACINE=C855 +COLLEDIMEZZO=C856 +COLLEFERRO=C858 +COLLEGIOVE=C859 +COLLEGNO=C860 +COLLELONGO=C862 +COLLEPARDO=C864 +COLLEPASSO=C865 +COLLEPIETRO=C866 +COLLERETTO_CASTELNUOVO=C867 +COLLERETTO_GIACOSA=C868 +COLLESALVETTI=C869 +COLLESANO=C871 +COLLETORTO=C875 +COLLEVECCHIO=C876 +COLLI_A_VOLTURNO=C878 +COLLI_DEL_TRONTO=C877 +COLLI_SUL_VELINO=C880 +COLLIANO=C879 +COLLINAS=C882 +COLLIO=C883 +COLLOBIANO=C884 +COLLOREDO_DI_MONTE_ALBANO=C885 +COLMURANO=C886 +COLOBRARO=C888 +COLOGNA_VENETA=C890 +COLOGNE=C893 +COLOGNO_AL_SERIO=C894 +COLOGNO_MONZESE=C895 +COLOGNOLA_AI_COLLI=C897 +COLOMBIA=Z604 +COLONNA=C900 +COLONNELLA=C901 +COLONNO=C902 +COLORINA=C903 +COLORNO=C904 +COLOSIMI=C905 +COLTURANO=C908 +COLZATE=C910 +COMABBIO=C911 +COMACCHIO=C912 +COMANO=C914 +COMAZZO=C917 +COMEGLIANS=C918 +COMELICO_SUPERIORE=C920 +COMERIO=C922 +COMEZZANO_CIZZAGO=C925 +COMIGNAGO=C926 +COMISO=C927 +COMITINI=C928 +COMIZIANO=C929 +COMMESSAGGIO=C930 +COMMEZZADURA=C931 +COMO=C933 +COMPIANO=C934 +COMUN_NUOVO=C937 +COMUNANZA=C935 +CONA=C938 +CONCA_CASALE=C941 +CONCA_DEI_MARINI=C940 +CONCA_DELLA_CAMPANIA=C939 +CONCAMARISE=C943 +CONCEI=C944 +CONCERVIANO=C946 +CONCESIO=C948 +CONCO=C949 +CONCORDIA_SAGITTARIA=C950 +CONCORDIA_SULLA_SECCHIA=C951 +CONCOREZZO=C952 +CONDINO=C953 +CONDOFURI=C954 +CONDOVE=C955 +CONDRO'=C956 +CONEGLIANO=C957 +CONFIENZA=C958 +CONFIGNI=C959 +CONFLENTI=C960 +CONGO=Z311 +CONGO_LEOPODVILLE=Z312 +CONIOLO=C962 +CONSELICE=C963 +CONSELVE=C964 +CONSIGLIO_DI_RUMO=C965 +CONTARINA=C967 +CONTESSA_ENTELLINA=C968 +CONTIGLIANO=C969 +CONTRADA=C971 +CONTROGUERRA=C972 +CONTRONE=C973 +CONTURSI_TERME=C974 +CONVERSANO=C975 +CONZA_DELLA_CAMPANIA=C976 +CONZANO=C977 +COPERTINO=C978 +COPIANO=C979 +COPPARO=C980 +CORANA=C982 +CORATO=C983 +CORBARA=C984 +CORBETTA=C986 +CORBOLA=C987 +CORCHIANO=C988 +CORCIANO=C990 +CORDENONS=C991 +CORDIGNANO=C992 +CORDOVADO=C993 +COREA_DEL_NORD=Z214 +COREA_DEL_SUD=Z213 +COREDO=C994 +COREGLIA_ANTELMINELLI=C996 +COREGLIA_LIGURE=C995 +CORENO_AUSONIO=C998 +CORFINIO=C999 +CORI=D003 +CORIANO=D004 +CORIGLIANO_CALABRO=D005 +CORIGLIANO_D'OTRANTO=D006 +CORINALDO=D007 +CORIO=D008 +CORLEONE=D009 +CORLETO_MONFORTE=D011 +CORLETO_PERTICARA=D010 +CORMANO=D013 +CORMONS=D014 +CORNA_IMAGNA=D015 +CORNALBA=D016 +CORNALE=D017 +CORNAREDO=D018 +CORNATE_D'ADDA=D019 +CORNEDO_ALL'ISARCO=B799 +CORNEDO_VICENTINO=D020 +CORNEGLIANO_LAUDENSE=D021 +CORNELIANO_D'ALBA=D022 +CORNIGLIO=D026 +CORNO_DI_ROSAZZO=D027 +CORNO_GIOVINE=D028 +CORNOVECCHIO=D029 +CORNUDA=D030 +CORREGGIO=D037 +CORREZZANA=D038 +CORREZZOLA=D040 +CORRIDO=D041 +CORRIDONIA=D042 +CORROPOLI=D043 +CORSANO=D044 +CORSICO=D045 +CORSIONE=D046 +CORTACCIA_SULLA_STRADA_DEL_VIN=D048 +CORTALE=D049 +CORTANDONE=D050 +CORTANZE=D051 +CORTAZZONE=D052 +CORTE_BRUGNATELLA=D054 +CORTE_DE'CORTESI_CON_CIGNONE=D056 +CORTE_DE'FRATI=D057 +CORTE_FRANCA=D058 +CORTE_PALASIO=D068 +CORTEMAGGIORE=D061 +CORTEMILIA=D062 +CORTENO_GOLGI=D064 +CORTENOVA=D065 +CORTENUOVA=D066 +CORTEOLONA=D067 +CORTIGLIONE=D072 +CORTINA_D'AMPEZZO=A266 +CORTINA_SULLA_STRADA_DEL_VINO=D075 +CORTINO=D076 +CORTONA=D077 +CORVARA=D078 +CORVARA_IN_BADIA=D079 +CORVINO_SAN_QUIRICO=D081 +CORZANO=D082 +COSEANO=D085 +COSENZA=D086 +COSIO_DI_ARROSCIA=D087 +COSIO_VALTELLINO=D088 +COSOLETO=D089 +COSSANO_BELBO=D093 +COSSANO_CANAVESE=D092 +COSSATO=D094 +COSSERIA=D095 +COSSIGNANO=D096 +COSSOGNO=D099 +COSSOINE=D100 +COSSOMBRATO=D101 +COSTA_D'AVORIO=Z313 +COSTA_DEI_PIRATI=Z215 +COSTA_DE'NOBILI=D109 +COSTA_DI_MEZZATE=D110 +COSTA_DI_ROVIGO=D105 +COSTA_DI_SERINA=D111 +COSTA_MASNAGA=D112 +COSTA_RICA=Z503 +COSTA_VALLE_IMAGNA=D103 +COSTA_VESCOVATO=D102 +COSTA_VOLPINO=D117 +COSTABISSARA=D107 +COSTACCIARO=D108 +COSTANZANA=D113 +COSTARAINERA=D114 +COSTERMANO=D118 +COSTIGLIOLE_D'ASTI=D119 +COSTIGLIOLE_SALUZZO=D120 +COTIGNOLA=D121 +COTRONEI=D123 +COTTANELLO=D124 +COURMAYEUR=D012 +COVO=D126 +COZZO=D127 +CRACO=D128 +CRANDOLA_VALSASSINA=D131 +CRAVAGLIANA=D132 +CRAVANZANA=D133 +CRAVEGGIA=D134 +CREAZZO=D136 +CRECCHIO=D137 +CREDARO=D139 +CREDERA_RUBBIANO=D141 +CREMA=D142 +CREMELLA=D143 +CREMENAGA=D144 +CREMENO=D145 +CREMIA=D147 +CREMOLINO=D149 +CREMONA=D150 +CREMOSANO=D151 +CRESCENTINO=D154 +CRESPADORO=D156 +CRESPANO_DEL_GRAPPA=D157 +CRESPELLANO=D158 +CRESPIATICA=D159 +CRESPINA=D160 +CRESPINO=D161 +CRESSA=D162 +CREVACUORE=D165 +CREVALCORE=D166 +CREVOLADOSSOLA=D168 +CRISPANO=D170 +CRISPIANO=D171 +CRISSOLO=D172 +CROCEFIESCHI=D175 +CROCETTA_DEL_MONTELLO=C670 +CRODO=D177 +CROGNALETO=D179 +CROPALATI=D180 +CROPANI=D181 +CROSA=D182 +CROSIA=D184 +CROSIO_DELLA_VALLE=D185 +CROTONE=D122 +CROTTA_D'ADDA=D186 +CROVA=D187 +CROVIANA=D188 +CRUCOLI=D189 +CUASSO_AL_MONTE=D192 +CUBA=Z504 +CUCCARO_MONFERRATO=D194 +CUCCARO_VETERE=D195 +CUCCIAGO=D196 +CUCEGLIO=D197 +CUGGIONO=D198 +CUGLIATE_FABIASCO=D199 +CUGLIERI=D200 +CUGNOLI=D201 +CUMIANA=D202 +CUMIGNANO_SUL_NAVIGLIO=D203 +CUNARDO=D204 +CUNEO=D205 +CUNEVO=D206 +CUNICO=D207 +CUORGNE'=D208 +CUPELLO=D209 +CUPRA_MARITTIMA=D210 +CUPRAMONTANA=D211 +CURA_CARPIGNANO=B824 +CUREGGIO=D216 +CURIGLIA_CON_MONTEVIASCO=D217 +CURINGA=D218 +CURINO=D219 +CURNO=D221 +CURON_VENOSTA=D222 +CURSI=D223 +CURSOLO_ORASSO=D225 +CURTAROLO=D226 +CURTATONE=D227 +CURTI=D228 +CUSAGO=D229 +CUSANO_MILANINO=D231 +CUSANO_MUTRI=D230 +CUSINO=D232 +CUSIO=D233 +CUSTONACI=D234 +CUTIGLIANO=D235 +CUTRO=D236 +CUTROFIANO=D237 +CUVEGLIO=D238 +CUVIO=D239 +DAHOMEY=Z314 +DAIANO=D243 +DAIRAGO=D244 +DALMINE=D245 +DAMBEL=D246 +DANIMARCA=Z107 +DANTA_DI_CADORE=D247 +DAONE=D248 +DARE'=D250 +DARFO_BOARIO_TERME=D251 +DASA'=D253 +DAVAGNA=D255 +DAVERIO=D256 +DAVOLI=D257 +DAZIO=D258 +DECIMOMANNU=D259 +DECIMOPUTZU=D260 +DECOLLATURA=D261 +DEGO=D264 +DEIVA_MARINA=D265 +DELEBIO=D266 +DELIA=D267 +DELIANUOVA=D268 +DELICETO=D269 +DELLO=D270 +DEMONTE=D271 +DENICE=D272 +DENNO=D273 +DERNICE=D277 +DEROVERE=D278 +DERUTA=D279 +DERVIO=D280 +DESANA=D281 +DESENZANO_DEL_GARDA=D284 +DESIO=D286 +DESULO=D287 +DIAMANTE=D289 +DIANO_ARENTINO=D293 +DIANO_CASTELLO=D296 +DIANO_D'ALBA=D291 +DIANO_MARINA=D297 +DIANO_SAN_PIETRO=D298 +DICOMANO=D299 +DIGNANO=D300 +DIMARO=D302 +DINAMI=D303 +DIPIGNANO=D304 +DISO=D305 +DIVIGNANO=D309 +DIZZASCO=D310 +DOBBIACO=D311 +DOBERDO'_DEL_LAGO=D312 +DOGLIANI=D314 +DOGLIOLA=D315 +DOGNA=D316 +DOLCE'=D317 +DOLCEACQUA=D318 +DOLCEDO=D319 +DOLEGNA_DEL_COLLIO=D321 +DOLIANOVA=D323 +DOLO=D325 +DOLZAGO=D327 +DOMANICO=D328 +DOMASO=D329 +DOMEGGE_DI_CADORE=D330 +DOMICELLA=D331 +DOMODOSSOLA=D332 +DOMUS_DE_MARIA=D333 +DOMUSNOVAS=D334 +DON=D336 +DONADA=D337 +DONATO=D339 +DONGO=D341 +DONNAZ=D338 +DONORI=D344 +DORGALI=D345 +DORIO=D346 +DORMELLETTO=D347 +DORNO=D348 +DORSINO=D349 +DORZANO=D350 +DOSOLO=D351 +DOSSENA=D352 +DOSSO_DEL_LIRO=D355 +DOUES=D356 +DOVADOLA=D357 +DOVERA=D358 +DOZZA=D360 +DRAGONI=D361 +DRAPIA=D364 +DRENA=D365 +DRENCHIA=D366 +DRESANO=D367 +DREZZO=D369 +DRIZZONA=D370 +DRO'=D371 +DRONERO=D372 +DRUENTO=D373 +DRUOGNO=D374 +DUALCHI=D376 +DUBINO=D377 +DUEVILLE=D379 +DUGENTA=D380 +DUINO_AURISINA=D383 +DUMENZA=D384 +DUNO=D385 +DURAZZANO=D386 +DURONIA=C772 +DUSINO_SAN_MICHELE=D388 +EBOLI=D390 +ECUADOR=Z605 +EDOLO=D391 +EGITTO=Z336 +EGNA=D392 +EL_SALVADOR=Z506 +ELICE=D394 +ELINI=D395 +ELLO=D398 +ELVA=D401 +EMARESE=D402 +EMPOLI=D403 +ENDINE_GAIANO=D406 +ENEGO=D407 +ENEMONZO=D408 +ENNA=C342 +ENTRACQUE=D410 +ENTRATICO=D411 +ENVIE=D412 +EPISCOPIA=D414 +ERACLEA=D415 +ERBA=D416 +ERBE'=D419 +ERBEZZO=D420 +ERBUSCO=D421 +ERCHIE=D422 +ERCOLANO=H243 +ERICE=D423 +ERLI=D424 +ERTO_E_CASSO=D426 +ERVE=D428 +ESANATOGLIA=D429 +ESCALAPLANO=D430 +ESCOLCA=D431 +ESINE=D434 +ESINO_LARIO=D436 +ESPERIA=D440 +ESPORLATU=D441 +ESTE=D442 +ESTERZILI=D443 +ETIOPIA=Z315 +ETROUBLES=D444 +EUPILIO=D445 +EXILLES=D433 +FABBRICA_CURONE=D447 +FABBRICHE_DI_VALLICO=D449 +FABBRICO=D450 +FABRIANO=D451 +FABRICA_DI_ROMA=D452 +FABRIZIA=D453 +FABRO=D454 +FAEDIS=D455 +FAEDO=D457 +FAEDO_VALTELLINO=D456 +FAENZA=D458 +FAER_OER=Z108 +FAETO=D459 +FAGAGNA=D461 +FAGGETO_LARIO=D462 +FAGGIANO=D463 +FAGNANO_ALTO=D465 +FAGNANO_CASTELLO=D464 +FAGNANO_OLONA=D467 +FAI_DELLA_PAGANELLA=D468 +FAICCHIO=D469 +FALCADE=D470 +FALCIANO_DEL_MASSICO=D471 +FALCONARA_ALBANESE=D473 +FALCONARA_MARITTIMA=D472 +FALCONE=D474 +FALERIA=D475 +FALERNA=D476 +FALERONE=D477 +FALLO=D480 +FALMENTA=D481 +FALOPPIO=D482 +FALVATERRA=D483 +FALZES=D484 +FANANO=D486 +FANNA=D487 +FANO=D488 +FANO_ADRIANO=D485 +FARA_FILIORUM_PETRI=D494 +FARA_GERA_D'ADDA=D490 +FARA_IN_SABINA=D493 +FARA_NOVARESE=D492 +FARA_OLIVANA_CON_SOLA=D491 +FARA_SAN_MARTINO=D495 +FARA_VICENTINO=D496 +FARDELLA=D497 +FARIGLIANO=D499 +FARINDOLA=D501 +FARINI_D'OLMO=D502 +FARNESE=D503 +FARRA_D'ALPAGO=D506 +FARRA_DI_SOLIGO=D505 +FARRA_D'ISONZO=D504 +FASANO=D508 +FASCIA=D509 +FAUGLIA=D510 +FAULE=D511 +FAVALE_DI_MALVARO=D512 +FAVARA=D514 +FAVER=D516 +FAVIGNANA=D518 +FAVRIA=D520 +FED._ARABIA_MERID.=Z201 +FEISOGLIO=D523 +FELETTO=D524 +FELINO=D526 +FELITTO=D527 +FELIZZANO=D528 +FELONICA=D529 +FELTRE=D530 +FENEGRO'=D531 +FENESTRELLE=D532 +FENIS=D537 +FERENTILLO=D538 +FERENTINO=D539 +FERLA=D540 +FERMIGNANO=D541 +FERMO=D542 +FERNO=D543 +FEROLETO_ANTICO=D544 +FEROLETO_DELLA_CHIESA=D545 +FERRANDINA=D547 +FERRARA=D548 +FERRARA_DI_MONTE_BALDO=D549 +FERRAZZANO=D550 +FERRERA_DI_VARESE=D551 +FERRERA_ERBOGNONE=D552 +FERRERE=D554 +FERRIERE=D555 +FERRUZZANO=D557 +FIAMIGNANO=D560 +FIANO=D562 +FIANO_ROMANO=D561 +FIASTRA=D564 +FIAVE'=D565 +FICARAZZI=D567 +FICAROLO=D568 +FICARRA=D569 +FICULLE=D570 +FIDENZA=B034 +FIE'_ALLO_SCILIAR=D571 +FIERA_DI_PRIMIERO=D572 +FIEROZZO=D573 +FIESCO=D574 +FIESOLE=D575 +FIESSE=D576 +FIESSO_D'ARTICO=D578 +FIESSO_UMBERTIANO=D577 +FIGINO_SARANZA=D579 +FIGLINE_VALDARNO=D583 +FIGLINE_VEGLIATURO=D582 +FILACCIANO=D586 +FILADELFIA=D587 +FILAGO=D588 +FILANDARI=D589 +FILATTIERA=D590 +FILETTINO=D591 +FILETTO=D592 +FILIANO=D593 +FILIGHERA=D594 +FILIGNANO=D595 +FILIPPINE=Z216 +FILOGASO=D596 +FILOTTRANO=D597 +FINALE_EMILIA=D599 +FINALE_LIGURE=D600 +FINLANDIA=Z109 +FINO_DEL_MONTE=D604 +FINO_MORNASCO=D605 +FIORANO_AL_SERIO=D606 +FIORANO_CANAVESE=D608 +FIORANO_MODENESE=D607 +FIORDIMONTE=D609 +FIORENZUOLA_D'ARDA=D611 +FIRENZE=D612 +FIRENZUOLA=D613 +FIRMO=D614 +FISCIANO=D615 +FIUGGI=A310 +FIUMALBO=D617 +FIUMARA=D619 +FIUME_VENETO=D621 +FIUMEDINISI=D622 +FIUMEFREDDO_BRUZIO=D624 +FIUMEFREDDO_DI_SICILIA=D623 +FIUMICELLO=D627 +FIUMINATA=D628 +FIVIZZANO=D629 +FLAIBANO=D630 +FLAVON=D631 +FLERO=D634 +FLORESTA=D635 +FLORIDIA=D636 +FLORINAS=D637 +FLUMERI=D638 +FLUMINIMAGGIORE=D639 +FLUSSIO=D640 +FOBELLO=D641 +FOGGIA=D643 +FOGLIANISE=D644 +FOGLIANO_REDIPUGLIA=D645 +FOGLIZZO=D646 +FOIANO_DELLA_CHIANA=D649 +FOIANO_DI_VAL_FORTORE=D650 +FOLGARIA=D651 +FOLIGNANO=D652 +FOLIGNO=D653 +FOLLINA=D654 +FOLLO=D655 +FOLLONICA=D656 +FOMBIO=D660 +FONDACHELLI_FANTINA=D661 +FONDI=D662 +FONDO=D663 +FONNI=D665 +FONTAGNETO_D'AGOGNA=D675 +FONTAINEMORE=D666 +FONTANA_LIRI=D667 +FONTANAFREDDA=D670 +FONTANAROSA=D671 +FONTANELICE=D668 +FONTANELLA=D672 +FONTANELLATO=D673 +FONTANELLE=D674 +FONTANETTO_PO=D676 +FONTANIGORDA=D677 +FONTANILE=D678 +FONTANIVA=D679 +FONTE=D680 +FONTECCHIO=D681 +FONTECHIARI=D682 +FONTEGRECA=D683 +FONTENO=D684 +FONTEVIVO=D685 +FONZASO=D686 +FOPPOLO=D688 +FORANO=D689 +FORCE=D691 +FORCHIA=D693 +FORCOLA=D694 +FORDONGIANUS=D695 +FORENZA=D696 +FORESTO_SPARSO=D697 +FORGARIA_NEL_FRIULI=D700 +FORINO=D701 +FORIO=D702 +FORLI'=D704 +FORLI'_DEL_SANNIO=D703 +FORLIMPOPOLI=D705 +FORMAZZA=D706 +FORMELLO=D707 +FORMIA=D708 +FORMICOLA=D709 +FORMIGARA=D710 +FORMIGINE=D711 +FORMIGLIANA=D712 +FORMIGNANA=D713 +FORMOSA=Z217 +FORNACE=D714 +FORNELLI=D715 +FORNI_AVOLTRI=D718 +FORNI_DI_SOPRA=D719 +FORNI_DI_SOTTO=D720 +FORNO_CANAVESE=D725 +FORNO_DI_ZOLDO=D726 +FORNOVO_DI_TARO=D728 +FORNOVO_SAN_GIOVANNI=D727 +FORTE_DEI_MARMI=D730 +FORTEZZA=D731 +FORTUNAGO=D732 +FORZA_D'AGRO'=D733 +FOSCIANDORA=D734 +FOSDINOVO=D735 +FOSSA=D736 +FOSSACESIA=D738 +FOSSALTA_DI_PIAVE=D740 +FOSSALTA_DI_PORTOGRUARO=D741 +FOSSALTO=D737 +FOSSANO=D742 +FOSSATO_DI_VICO=D745 +FOSSATO_SERRALTA=D744 +FOSSO'=D748 +FOSSOMBRONE=D749 +FOZA=D750 +FRABOSA_SOPRANA=D751 +FRABOSA_SOTTANA=D752 +FRACONALTO=D559 +FRAGAGNANO=D754 +FRAGNETO_L'ABATE=D755 +FRAGNETO_MONFORTE=D756 +FRAINE=D757 +FRAMURA=D758 +FRANCAVILLA_AL_MARE=D763 +FRANCAVILLA_ANGITOLA=D762 +FRANCAVILLA_BISIO=D759 +FRANCAVILLA_D'ETE=D760 +FRANCAVILLA_DI_SICILIA=D765 +FRANCAVILLA_FONTANA=D761 +FRANCAVILLA_IN_SINNI=D766 +FRANCAVILLA_MARITTIMA=D764 +FRANCIA=Z110 +FRANCICA=D767 +FRANCOFONTE=D768 +FRANCOLISE=D769 +FRASCARO=D770 +FRASCAROLO=D771 +FRASCATI=D773 +FRASCINETO=D774 +FRASSILONGO=D775 +FRASSINELLE_POLESINE=D776 +FRASSINELLO_MONFERRATO=D777 +FRASSINETO_PO=D780 +FRASSINETTO=D781 +FRASSINO=D782 +FRASSINORO=D783 +FRASSO_SABINO=D785 +FRASSO_TELESINO=D784 +FRATTA_POLESINE=D788 +FRATTA_TODINA=D787 +FRATTAMAGGIORE=D789 +FRATTAMINORE=D790 +FRATTE_ROSA=D791 +FRAZZANO'=D793 +FREGONA=D794 +FRESAGRANDINARIA=D796 +FRESONARA=D797 +FRIGENTO=D798 +FRIGNANO=D799 +FRINCO=D802 +FRISA=D803 +FRISANCO=D804 +FRONT=D805 +FRONTINO=D807 +FRONTONE=D808 +FROSINONE=D810 +FROSOLONE=D811 +FROSSASCO=D812 +FRUGAROLO=D813 +FUBINE=D814 +FUCECCHIO=D815 +FUIPIANO_VALLE_IMAGNA=D817 +FUMANE=D818 +FUMONE=D819 +FUNES=D821 +FURCI=D823 +FURCI_SICULO=D824 +FURNARI=D825 +FURORE=D826 +FURTEI=D826 +FUSCALDO=D828 +FUSIGNANO=D829 +FUSINE=D830 +FUTANI=D832 +GABBIONETA_BINANUOVA=D834 +GABIANO=D835 +GABICCE_MARE=D836 +GABON=Z316 +GABY=D839 +GADESCO_PIEVE_DELMONA=D841 +GADONI=D842 +GAETA=D843 +GAGGI=D844 +GAGGIANO=D845 +GAGGIO_MONTANO=D847 +GAGLIANICO=D848 +GAGLIANO_ATERNO=D850 +GAGLIANO_CASTELFERRATO=D849 +GAGLIANO_DEL_CAPO=D851 +GAGLIATO=D852 +GAGLIOLE=D853 +GAIARINE=D854 +GAIBA=D855 +GAIOLA=D856 +GAIOLE_IN_CHIANTI=D858 +GAIRO=D859 +GAIS=D860 +GALATI_MAMERTINO=D861 +GALATINA=D862 +GALATONE=D863 +GALATRO=D864 +GALBIATE=D865 +GALEATA=D867 +GALGAGNANO=D868 +GALLARATE=D869 +GALLESE=D870 +GALLIATE=D872 +GALLIATE_LOMBARDO=D871 +GALLIAVOLA=D873 +GALLICANO=D874 +GALLICANO_NEL_LAZIO=D875 +GALLICCHIO=D876 +GALLIERA=D878 +GALLIERA_VENETA=D879 +GALLINARO=D881 +GALLIO=D882 +GALLIPOLI=D883 +GALLO=D884 +GALLODORO=D885 +GALLUCCIO=D886 +GALTELLI=D888 +GALZIGNANO_TERME=D889 +GAMALERO=D890 +GAMBARA=D891 +GAMBARANA=D892 +GAMBASCA=D894 +GAMBASSI_TERME=D895 +GAMBATESA=D896 +GAMBELLARA=D897 +GAMBERALE=D898 +GAMBETTOLA=D899 +GAMBIA=Z317 +GAMBOLO'=D901 +GAMBUGLIANO=D902 +GANDELLINO=D903 +GANDINO=D905 +GANDOSSO=D906 +GANGI=D907 +GARAGUSO=D909 +GARBAGNA=D910 +GARBAGNA_NOVARESE=D911 +GARBAGNATE_MILANESE=D912 +GARBAGNATE_MONASTERO=D913 +GARDA=D915 +GARDONE_RIVIERA=D917 +GARDONE_VAL_TROMPIA=D918 +GARESSIO=D920 +GARGALLO=D921 +GARGAZZONE=D923 +GARGNANO=D924 +GARLASCO=D925 +GARLATE=D926 +GARLENDA=D927 +GARNIGA=D928 +GARZENO=D930 +GARZIGLIANA=D931 +GASPERINA=D932 +GASSINO_TORINESE=D933 +GATTATICO=D934 +GATTEO=D935 +GATTICO=D937 +GATTINARA=D938 +GAVARDO=D940 +GAVAZZANA=D941 +GAVELLO=D942 +GAVERINA_TERME=D943 +GAVI=D944 +GAVIGNANO=D945 +GAVIRATE=D946 +GAVOI=D947 +GAVORRANO=D948 +GAZA=Z218 +GAZOLDO_DEGLI_IPPOLITI=D949 +GAZZADA_SCHIANNO=D951 +GAZZANIGA=D952 +GAZZO_PADOVANO=D956 +GAZZO_VERONESE=D957 +GAZZOLA=D958 +GAZZUOLO=D959 +GELA=D960 +GEMMANO=D961 +GEMONA_DEL_FRIULI=D962 +GEMONIO=D963 +GENAZZANO=D964 +GENGA=D965 +GENIVOLTA=D966 +GENOLA=D967 +GENONI=D968 +GENOVA=D969 +GENURI=D970 +GENZANO_DI_LUCANIA=D971 +GENZANO_DI_ROMA=D972 +GENZONE=D973 +GERA_LARIO=D974 +GERACE=D975 +GERACI_SICULO=D977 +GERANO=D978 +GERENZAGO=D980 +GERENZANO=D981 +GERGEI=D982 +GERMAGNANO=D983 +GERMAGNO=D984 +GERMANIA_EST=Z111 +GERMANIA_OVEST=Z112 +GERMASINO=D986 +GERMIGNAGA=D987 +GEROCARNE=D988 +GEROLA_ALTA=D990 +GEROSA=D991 +GERRE_DE'CAPRIOLI=D993 +GESICO=D994 +GESSATE=D995 +GESSOPALENA=D996 +GESTURI=D997 +GESUALDO=D998 +GHANA=Z318 +GHEDI=D999 +GHEMME=E001 +GHIFFA=E003 +GHILARZA=E004 +GHISALBA=E006 +GHISLARENGO=E007 +GIACCIANO_CON_BARUCHELLA=E008 +GIAGLIONE=E009 +GIAMAICA=Z507 +GIANICO=E010 +GIANO_DELL'UMBRIA=E012 +GIANO_VETUSTO=E011 +GIAPPONE=Z219 +GIARDINELLO=E013 +GIARDINI_NAXOS=E014 +GIAROLE=E015 +GIARRATANA=E016 +GIARRE=E017 +GIAVE=E019 +GIAVENO=E020 +GIAVERA_DEL_MONTELLO=E021 +GIBA=E022 +GIBELLINA=E023 +GIBILTERRA=Z113 +GIFFLENGA=E024 +GIFFONE=E025 +GIFFONI_SEI_CASALI=E026 +GIFFONI_VALLE_PIANA=E027 +GIGNESE=E028 +GIGNOD=E029 +GILDONE=E030 +GIMIGLIANO=E031 +GINESTRA=E033 +GINESTRA_DEGLI_SCHIAVONI=E034 +GINOSA=E036 +GIOI_CILENTO=E037 +GIOIA_DEI_MARSI=E040 +GIOIA_DEL_COLLE=E038 +GIOIA_SANNITICA=E039 +GIOIA_TAURO=E041 +GIOIOSA_IONICA=E044 +GIOIOSA_MAREA=E043 +GIORDANIA=Z220 +GIOVE=E045 +GIOVINAZZO=E047 +GIOVO=E048 +GIRASOLE=E049 +GIRIFALCO=E050 +GIRONICO=E051 +GISSI=E052 +GIUGGIANELLO=E053 +GIUGLIANO_IN_CAMPANIA=E054 +GIULIANA=E055 +GIULIANO_DI_ROMA=E057 +GIULIANO_TEATINO=E056 +GIULIANOVA=E058 +GIUNCUGNANO=E059 +GIUNGANO=E060 +GIURDIGNANO=E061 +GIUSSAGO=E062 +GIUSSANO=E063 +GIUSTENICE=E064 +GIUSTINO=E065 +GIUSVALLA=E066 +GIVOLETTO=E067 +GIZZERIA=E068 +GLORENZA=E069 +GODEGA_DI_SANT'URBANO=E071 +GODIASCO=E072 +GODRANO=E074 +GOITO=E078 +GOLASECCA=E079 +GOLFERENZO=E081 +GOMBITO=E082 +GONARS=E083 +GONI=E084 +GONNESA=E086 +GONNOSCODINA=E087 +GONNOSFANADIGA=E085 +GONNOSNO'=D585 +GONNOSTRAMATZA=E088 +GONZAGA=E089 +GORDONA=E090 +GORGA=E091 +GORGO_AL_MONTICANO=E092 +GORGOGLIONE=E093 +GORGONZOLA=E094 +GORIANO_SICOLI=E096 +GORIZIA=E098 +GORLA_MAGGIORE=E101 +GORLA_MINORE=E102 +GORLAGO=E100 +GORLE=E103 +GORNATE_OLONA=E104 +GORNO=E106 +GORO=E107 +GORRETO=E109 +GORZEGNO=E111 +GOSALDO=E113 +GOSSOLENGO=E114 +GOTTASECCA=E115 +GOTTOLENGO=E116 +GOVONE=E118 +GOZZANO=E120 +GRADARA=E121 +GRADISCA_D'ISONZO=E124 +GRADO=E125 +GRADOLI=E126 +GRAFFIGNANA=E127 +GRAFFIGNANO=E128 +GRAGLIA=E130 +GRAGNANO=E131 +GRAGNANO_TREBBIENSE=E132 +GRAMMICHELE=E133 +GRAN_BRETAGNA=Z114 +GRANA=E134 +GRANAGLIONE=E135 +GRANAROLO_DELL'EMILIA=E136 +GRANCONA=E138 +GRANDATE=E139 +GRANDOLA_ED_UNITI=E141 +GRANITI=E142 +GRANOZZO_CON_MONTICELLO=E143 +GRANTOLA=E144 +GRANTORTO=E145 +GRANZE=E146 +GRASSANO=E147 +GRASSOBBIO=E148 +GRATTERI=E149 +GRAUNO=E150 +GRAVEDONA=E151 +GRAVELLONA_LOMELLINA=E152 +GRAVELLONA_TOCE=E153 +GRAVERE=E154 +GRAVINA_DI_CATANIA=E156 +GRAVINA_DI_PUGLIA=E155 +GRAZZANISE=E158 +GRAZZANO_BADOGLIO=E159 +GRECCIO=E160 +GRECI=E161 +GRECIA=Z115 +GREGGIO=E163 +GREMIASCO=E164 +GRESSAN=E165 +GRESSONEY_LA_TRINITE=E167 +GRESSONEY_SAINT_JEAN=E168 +GREVE_IN_CHIANTI=E169 +GREZZAGO=E170 +GREZZANA=E171 +GRIANTE=E172 +GRICIGNANO_DI_AVERSA=E173 +GRIGNASCO=E177 +GRIGNO=E178 +GRIMACCO=E179 +GRIMALDI=E180 +GRINZANE_CAVOUR=E182 +GRISIGNANO_DI_ZOCCO=E184 +GRISOLIA=E185 +GRIZZANA_MORANDI=E187 +GROENLANDIA=Z402 +GROGNARDO=E188 +GROMO=E189 +GRONDONA=E191 +GRONE=E192 +GRONTARDO=E193 +GROPELLO_CAIROLI=E195 +GROPPARELLO=E196 +GROSCAVALLO=E199 +GROSIO=E200 +GROSOTTO=E201 +GROSSETO=E202 +GROSSO=E203 +GROTTAFERRATA=E204 +GROTTAGLIE=E205 +GROTTAMINARDA=E206 +GROTTAMMARE=E207 +GROTTAZZOLINA=E208 +GROTTE=E209 +GROTTE_DI_CASTRO=E210 +GROTTERIA=E212 +GROTTOLE=E213 +GROTTOLELLA=E214 +GRUARO=E215 +GRUGLIASCO=E216 +GRUMELLO_CREMONESE_ED_UNITI=E217 +GRUMELLO_DEL_MONTE=E219 +GRUMENTO_NOVA=E221 +GRUMES=E222 +GRUMO_APPULA=E223 +GRUMO_NEVANO=E224 +GRUMOLO_DELLE_ABBADESSE=E226 +GUADALUPA=Z508 +GUAGNANO=E227 +GUALDO=E228 +GUALDO_CATTANEO=E229 +GUALDO_TADINO=E230 +GUALTIERI=E232 +GUALTIERI_SICAMINO'=E233 +GUAMAGGIORE=E234 +GUANZATE=E235 +GUARCINO=E236 +GUARDA_VENETA=E240 +GUARDABOSONE=E237 +GUARDAMIGLIO=E238 +GUARDAVALLE=E239 +GUARDEA=E241 +GUARDIA_LOMBARDI=E245 +GUARDIA_PERTICARA=E246 +GUARDIA_PIEMONTESE=E242 +GUARDIA_SANFRAMONDI=E249 +GUARDIAGRELE=E243 +GUARDIALFIERA=E244 +GUARDIAREGIA=E248 +GUARDISTALLO=E250 +GUARENE=E251 +GUASILA=E252 +GUASTALLA=E253 +GUATEMALA=Z509 +GUAYANA_BRITANNICA=Z606 +GUAYANA_FRANCESE=Z607 +GUAYANA_OLANDESE=Z608 +GUAZZORA=E255 +GUBBIO=E256 +GUDO_VISCONTI=E258 +GUGLIONESI=E259 +GUIDIZZOLO=E261 +GUIDONIA_MONTECELIO=E263 +GUIGLIA=E264 +GUILMI=E266 +GUINEA=Z319 +GUINEA_PORTOGHESE=Z320 +GUINEA_SPAGNOLA=Z321 +GURRO=E269 +GUSPINI=E270 +GUSSAGO=E271 +GUSSOLA=E272 +HAITI=Z510 +HONDURAS=Z511 +HONDURAS_BRITANNICO=Z512 +HONE=E273 +HONG_KONG=Z221 +IACURSO=E274 +IDRO=E280 +IESOLO=C388 +IFNI=Z323 +IGLESIAS=E281 +IGLIANO=E282 +ILBONO=E283 +ILLASI=E284 +ILLORAI=E285 +IMBERSAGO=E287 +IMER=E288 +IMOLA=E289 +IMPERIA=E290 +IMPRUNETA=E291 +INARZO=E292 +INCISA_SCAPACCINO=E295 +INCISA_VAL_D'ARNO=E296 +INCUDINE=E297 +INDIA=Z222 +INDONESIA=Z223 +INDUNO_OLONA=E299 +INGRIA=E301 +INTRAGNA=E304 +INTROBIO=E305 +INTROD=E306 +INTRODACQUA=E307 +INTROZZO=E308 +INVERIGO=E309 +INVERNO_E_MONTELEONE=E310 +INVERSO_PINASCA=E311 +INVERUNO=E313 +INVORIO=E314 +INZAGO=E317 +IOLANDA_DI_SAVOIA=E320 +IONADI=E321 +IRAN=Z224 +IRAQ=Z225 +IRGOLI=E323 +IRIAN_OCC.=Z707 +IRLANDA=Z116 +IRLANDA_DEL_NORD=Z114 +IRMA=E325 +IRSINA=E326 +ISASCA=E327 +ISCA_SULLO_IONIO=E328 +ISCHIA=E329 +ISCHIA_DI_CASTRO=E330 +ISCHITELLA=E332 +ISEO=E333 +ISERA=E334 +ISERNIA=E335 +ISILI=E336 +ISLANDA=Z117 +ISNELLO=E337 +ISOLA_D'ASTI=E338 +ISOLA_DEL_CANTONE=E341 +ISOLA_DEL_GIGLIO=E348 +ISOLA_DEL_GRAN_SASSO=E343 +ISOLA_DEL_LIRI=E340 +ISOLA_DEL_PIANO=E351 +ISOLA_DELLA_SCALA=E349 +ISOLA_DELLE_FEMMINE=E350 +ISOLA_DI_CAPO_RIZZUTO=E339 +ISOLA_DI_FONDRA=E353 +ISOLA_DI_PASQUA=Z721 +ISOLA_DOVARESE=E356 +ISOLA_RIZZA=E358 +ISOLA_SANT'ANTONIO=E360 +ISOLA_VICENTINA=E354 +ISOLABELLA=E345 +ISOLABONA=E346 +ISOLATO=E342 +ISOLE_CAROLINE=Z701 +ISOLE_CHRISTMAS=Z702 +ISOLE_COCOS=Z212 +ISOLE_COMORE=Z310 +ISOLE_COOK=Z703 +ISOLE_FALKLAND=Z609 +ISOLE_FIGI=Z704 +ISOLE_GILBERT=Z705 +ISOLE_GUAM=Z706 +ISOLE_MACQUARIE=Z708 +ISOLE_MARCUS=Z709 +ISOLE_MARIANNE=Z710 +ISOLE_MARSHALL=Z711 +ISOLE_MAURIZIO=Z332 +ISOLE_MIDWAY=Z712 +ISOLE_NAURU=Z713 +ISOLE_NORFOLK=Z715 +ISOLE_NORMANNE=Z124 +ISOLE_REUNION=Z324 +ISOLE_RYUKYU=Z238 +ISOLE_SALOMONE=Z724 +ISOLE_SAVAGE=Z714 +ISOLE_SEICELLE=Z342 +ISOLE_TONGA=Z728 +ISOLE_TREMITI=E363 +ISOLE_VERGINI=Z520 +ISOLE_WALLIS=Z729 +ISORELLA=E364 +ISPANI=E365 +ISPICA=E366 +ISPRA=E367 +ISRAELE=Z226 +ISSIGLIO=E368 +ISSIME=E369 +ISSO=E370 +ISSOGNE=E371 +ISTRANA=E373 +ITALA=E374 +ITRI=E375 +ITTIREDDU=E376 +ITTIRI=E377 +IVANO_FRACENA=E378 +IVREA=E379 +IZANO=E380 +JELSI=E381 +JENNE=E382 +JERAGO_CON_ORAGO=E386 +JERZU=E387 +JESI=E388 +JOPPOLO=E389 +JOPPOLO_GIANCAXIO=E390 +JOVENCAN=E391 +JUGOSLAVIA=Z118 +KENYA=Z322 +KUWAIT=Z227 +LA_CASSA=E394 +LA_LOGGIA=E423 +LA_MADDALENA=E425 +LA_MAGDELEINE=A308 +LA_MORRA=E430 +LA_SALLE=E458 +LA_SPEZIA=E463 +LA_THUILE=E470 +LA_VALLE=E491 +LA_VALLE_AGORDINA=E490 +LABICO=E392 +LABRO=E393 +LACCHIARELLA=E395 +LACCO_AMENO=E396 +LACEDONIA=E397 +LACES=E398 +LACONI=E400 +LADISPOLI=M212 +LAERRU=E401 +LAGANADI=E402 +LAGHI=E403 +LAGLIO=E405 +LAGNASCO=E406 +LAGO=E407 +LAGONEGRO=E409 +LAGOSANTO=E410 +LAGUNDO=E412 +LAIGUEGLIA=E414 +LAINATE=E415 +LAINO=E416 +LAINO_BORGO=E417 +LAINO_CASTELLO=E419 +LAION=E420 +LAIVES=E421 +LAJATICO=E413 +LALLIO=E422 +LAMA_DEI_PELIGNI=E424 +LAMA_MOCOGNO=E426 +LAMBRUGO=E428 +LAMEZIA_TERME=M208 +LAMON=E429 +LAMPEDUSA_E_LINOSA=E431 +LAMPORECCHIO=E432 +LAMPORO=E433 +LANA=E434 +LANCIANO=E435 +LANDIONA=E436 +LANDRIANO=E437 +LANGHIRANO=E438 +LANGOSCO=E439 +LANUSEI=E441 +LANUVIO=C767 +LANZADA=E443 +LANZO_D'INTELVI=E444 +LANZO_TORINESE=E445 +LAOS=Z228 +LAPEDONA=E447 +LAPIO=E448 +LAPPANO=E450 +L'AQUILA=A345 +LARCIANO=E451 +LARDARO=E452 +LARDIRAGO=E454 +LARI=E455 +LARIANO=M207 +LARINO=E456 +LAS_PLASSAS=E464 +LASA=E457 +LASCARI=E459 +LASINO=E461 +LASNIGO=E462 +LASTEBASSE=E465 +LASTRA_A_SIGNA=E466 +LATERA=E467 +LATERINA=E468 +LATERZA=E469 +LATIANO=E471 +LATINA=E472 +LATISANA=E473 +LATRONICO=E474 +LATTARICO=E475 +LAUCO=E476 +LAUREANA_CILENTO=E480 +LAUREANA_DI_BORRELLO=E479 +LAUREGNO=E481 +LAURENZANA=E482 +LAURIA=E483 +LAURIANO=E484 +LAURINO=E485 +LAURITO=E486 +LAURO=E487 +LAVAGNA=E488 +LAVAGNO=E489 +LAVARONE=E492 +LAVELLO=E493 +LAVENA_PONTE_TRESA=E494 +LAVENO_MOMBELLO=E495 +LAVENONE=E497 +LAVIANO=E498 +LAVIS=E500 +LAZISE=E502 +LAZZATE=E504 +LECCE=E506 +LECCE_NEI_MARSI=E505 +LECCO=E507 +LEFFE=E509 +LEGGIUNO=E510 +LEGNANO=E512 +LEGNANO=E514 +LEGNARO=E515 +LEI=E517 +LEINI'=E518 +LEIVI=E519 +LEMIE=E520 +LENDINARA=E522 +LENI=E523 +LENNA=E524 +LENNO=E525 +LENO=E526 +LENOLA=E527 +LENTA=E528 +LENTATE_SUL_SEVESO=E530 +LENTELLA=E531 +LENTIAI=C562 +LENTINI=E532 +LEONESSA=E535 +LEONFORTE=E536 +LEPORANO=E537 +LEQUILE=E538 +LEQUIO_BERRIA=E540 +LEQUIO_TANARO=E539 +LERCARA_FRIDDI=E541 +LERICI=E542 +LERMA=E543 +LESA=E544 +LESEGNO=E546 +LESIGNANO_DE'BAGNI=E547 +LESINA=E549 +LESMO=E550 +LESSOLO=E551 +LESSONA=E552 +LESTIZZA=E553 +LETINO=E554 +LETOJANNI=E555 +LETTERE=E557 +LETTOMANOPPELLO=E558 +LETTOPALENA=E559 +LEVANTO=E560 +LEVATE=E562 +LEVERANO=E563 +LEVICE=E564 +LEVICO_TERME=E565 +LEVONE=E566 +LEZZENO=E569 +LIBANO=Z229 +LIBERI=E570 +LIBERIA=Z325 +LIBIA=Z326 +LIBRIZZI=E571 +LICATA=E573 +LICCIANA_NARDI=E574 +LICENZA=E576 +LICODIA_EUBEA=E578 +LIECHTENSTEIN=Z119 +LIERNA=E581 +LIGNANA=E583 +LIGNANO_SABBIADORO=E584 +LIGONCHIO=E585 +LIGOSULLO=E586 +LILLIANES=E587 +LIMANA=E588 +LIMATOLA=E589 +LIMBADI=E590 +LIMBIATE=E591 +LIMENA=E592 +LIMIDO_COMASCO=E593 +LIMINA=E594 +LIMONE_PIEMONTE=E597 +LIMONE_SUL_GARDA=E596 +LIMOSANO=E599 +LINAROLO=E600 +LINGUAGLOSSA=E602 +LIONI=E605 +LIPARI=E606 +LIPOMO=E607 +LIRIO=E608 +LISCATE=E610 +LISCIA=E611 +LISCIANO_NICCONE=E613 +LISIGNAGO=E614 +LISIO=E615 +LISSONE=E617 +LIVERI=E620 +LIVIGNO=E621 +LIVINALLONGO_DEL_COL_DI_LANA=E622 +LIVO=E623 +LIVO=E624 +LIVORNO=E625 +LIVORNO_FERRARIS=E626 +LIVRAGA=E627 +LIZZANELLO=E629 +LIZZANO=E630 +LIZZANO_IN_BELVEDERE=A771 +LOANO=E632 +LOAZZOLO=E633 +LOCANA=E635 +LOCATE_DI_TRIULZI=E639 +LOCATE_VARESINO=E638 +LOCATELLO=E640 +LOCERI=E644 +LOCOROTONDO=E645 +LOCRI=D976 +LOCULI=E646 +LODE'=E647 +LODI=E648 +LODI_VECCHIO=E651 +LODRINO=E652 +LOGRATO=E654 +LOIANO=E655 +LOMAGNA=E656 +LOMASO=E658 +LOMAZZO=E659 +LOMBARDORE=E660 +LOMBRIASCO=E661 +LOMELLO=E662 +LONA_LASES=E664 +LONATE_CEPPINO=E665 +LONATE_POZZOLO=E666 +LONATO=E667 +LONDA=E668 +LONGANO=E669 +LONGARE=E671 +LONGARONE=E672 +LONGHENA=E673 +LONGI=E674 +LONGIANO=E675 +LONGOBARDI=E677 +LONGOBUCCO=E678 +LONGONE_AL_SEGRINO=E679 +LONGONE_SABINO=E681 +LONIGO=E682 +LORANZE'=E683 +LOREGGIA=E684 +LOREGLIA=E685 +LORENZAGO_DI_CADORE=E687 +LORENZANA=E688 +LOREO=E689 +LORETO=E690 +LORETO_APRUTINO=E691 +LORIA=E692 +LORO_CIUFFENNA=E693 +LORO_PICENO=E694 +LORSICA=E695 +LOSINE=E698 +LOTZORAI=E700 +LOVERE=E704 +LOVERO=E705 +LOZIO=E706 +LOZZA=E707 +LOZZO_ATESTINO=E709 +LOZZO_DI_CADORE=E708 +LOZZOLO=E711 +LU_MONFERRATO=E712 +LUBRIANO=E713 +LUCCA=E715 +LUCCA_SICULA=E714 +LUCERA=E716 +LUCIGNANO=E718 +LUCINASCO=E719 +LUCITO=E722 +LUCO_DEI_MARSI=E723 +LUCOLI=E724 +LUGAGNANO_VAL_D'ARDA=E726 +LUGNACCO=E727 +LUGNANO_IN_TEVERINA=E729 +LUGO=E730 +LUGO_DI_VICENZA=E731 +LUINO=E734 +LUISAGO=E735 +LULA=E736 +LUMARZO=E737 +LUMEZZANE=E738 +LUNAMATRONA=E742 +LUNANO=E743 +LUNGAVILLA=B387 +LUNGRO=E745 +LUOGOSANO=E746 +LUOGOSANTO=E747 +LUPARA=E748 +LURAGO_D'ERBA=E749 +LURAGO_MARINONE=E750 +LURANO=E751 +LURAS=E752 +LURATE_CACCIVIO=E753 +LUSCIANO=E754 +LUSERNA=E757 +LUSERNA_SAN_GIOVANNI=E758 +LUSERNETTA=E759 +LUSEVERA=E760 +LUSIA=E761 +LUSIANA=E762 +LUSIGLIE'=E763 +LUSON=E764 +LUSSEMBURGO=Z120 +LUSTRA=E767 +LUVINATE=E769 +LUZZANA=E770 +LUZZARA=E772 +LUZZI=E773 +MACAO=Z231 +MACCAGNO=E775 +MACCASTORNA=E777 +MACCHIA_D'ISERNIA=E778 +MACCHIA_VALFORTORE=E780 +MACCHIAGODENA=E779 +MACELLO=E782 +MACERATA=E783 +MACERATA_CAMPANIA=E784 +MACERATA_FELTRIA=E785 +MACHERIO=E786 +MACLODIO=E787 +MACOMER=E788 +MACRA=E789 +MACUGNAGA=E790 +MADAGASCAR=Z327 +MADDALONI=E791 +MADIGNANO=E793 +MADONE=E794 +MADONNA_DEL_SASSO=E795 +MAENZA=E798 +MAFALDA=E799 +MAGASA=E800 +MAGENTA=E801 +MAGGIORA=E803 +MAGHERNO=E804 +MAGIONE=E805 +MAGISANO=E806 +MAGLIANO_ALFIERI=E809 +MAGLIANO_ALPI=E808 +MAGLIANO_DE'MARSI=E811 +MAGLIANO_DI_TENNA=E807 +MAGLIANO_IN_TOSCANA=E810 +MAGLIANO_ROMANO=E813 +MAGLIANO_SABINA=E812 +MAGLIANO_VETERE=E814 +MAGLIE=E815 +MAGLIOLO=E816 +MAGLIONE=E817 +MAGNACAVALLO=E818 +MAGNAGO=E819 +MAGNANO=E821 +MAGNANO_IN_RIVIERA=E820 +MAGOMADAS=E825 +MAGRE'_SULLA_STRADA_DEL_VINO=E829 +MAGREGLIO=E830 +MAIDA=E834 +MAIERA'=E835 +MAIERATO=E836 +MAIOLATI_SPONTINI=E837 +MAIOLO=E838 +MAIORI=E839 +MAIRAGO=E840 +MAIRANO=E841 +MAISSANA=E842 +MAJANO=E833 +MALAGNINO=E843 +MALALBERGO=E844 +MALAWI=Z328 +MALBORGHETTO_VALBRUNA=E847 +MALCESINE=E848 +MALDIVE=Z232 +MALE'=E850 +MALEGNO=E851 +MALEO=E852 +MALESCO=E853 +MALESIA=Z230 +MALETTO=E854 +MALFA=E855 +MALGESSO=E856 +MALGRATE=E858 +MALI=Z329 +MALITO=E859 +MALLARE=E609 +MALLES_VENOSTA=E862 +MALNATE=E863 +MALO=E864 +MALONNO=E865 +MALOSCO=E866 +MALTA=Z121 +MALTIGNANO=E868 +MALVAGNA=E869 +MALVICINO=E870 +MALVITO=E872 +MAMMOLA=E873 +MAMOIADA=E874 +MAN=Z122 +MANCIANO=E875 +MANDANICI=E876 +MANDAS=E877 +MANDATORICCIO=E878 +MANDELA=B632 +MANDELLO_DEL_LARIO=E879 +MANDELLO_VITTA=E880 +MANDURIA=E882 +MANERBA_DEL_GARDA=E883 +MANERBIO=E884 +MANFREDONIA=E885 +MANGO=E887 +MANGONE=E888 +MANIAGO=E889 +MANOCALZATI=E891 +MANOPPELLO=E892 +MANSUE'=E893 +MANTA=E894 +MANTELLO=E896 +MANTOVA=E897 +MANZANO=E899 +MANZIANA=E900 +MAPELLO=E901 +MARA=E902 +MARACALAGONIS=E903 +MARANELLO=E904 +MARANO_DI_NAPOLI=E906 +MARANO_DI_VALPOLICELLA=E911 +MARANO_EQUO=E908 +MARANO_LAGUNARE=E910 +MARANO_MARCHESATO=E914 +MARANO_PRINCIPATO=E915 +MARANO_SUL_PANARO=E905 +MARANO_TICINO=E907 +MARANO_VICENTINO=E912 +MARANZANA=E917 +MARATEA=E919 +MARCALLO_CON_CASONE=E921 +MARCARIA=E922 +MARCEDUSA=E923 +MARCELLINA=E924 +MARCELLINARA=E925 +MARCETELLI=E927 +MARCHENO=E928 +MARCHIROLO=E929 +MARCIANA=E930 +MARCIANA_MARINA=E931 +MARCIANISE=E932 +MARCIANO_DELLA_CHIANA=E933 +MARCIGNAGO=E934 +MARCON=E936 +MAREBBE=E938 +MARENE=E939 +MARENO_DI_PIAVE=E940 +MARENTINO=E941 +MARETTO=E944 +MARGARITA=E945 +MARGHERITA_DI_SAVOIA=E946 +MARGNO=E947 +MARIANA_MANTOVANA=E949 +MARIANO_COMENSE=E951 +MARIANO_DEL_FRIULI=E952 +MARIANOPOLI=E953 +MARIGLIANELLA=E954 +MARIGLIANO=E955 +MARINA_DI_GIOIOSA_IONICA=E956 +MARINEO=E957 +MARINO=E958 +MARLENGO=E959 +MARLIANA=E960 +MARMENTINO=E961 +MARMIROLO=E962 +MARMORA=E963 +MARNATE=E965 +MAROCCO=Z330 +MARONE=E967 +MAROPATI=E968 +MAROSTICA=E970 +MARRADI=E971 +MARRUBIU=E972 +MARSAGLIA=E973 +MARSALA=E974 +MARSCIANO=E975 +MARSICO_NUOVO=E976 +MARSICOVETERE=E977 +MARTA=E978 +MARTANO=E979 +MARTELLAGO=E980 +MARTELLO=E981 +MARTIGNACCO=E982 +MARTIGNANA_DI_PO=E983 +MARTIGNANO=E984 +MARTINA_FRANCA=E986 +MARTINENGO=E987 +MARTINIANA_PO=E988 +MARTINICA=Z513 +MARTINSICURO=E989 +MARTIRANO=E990 +MARTIRANO_LOMBARDO=E991 +MARTIS=E992 +MARTONE=E993 +MARUDO=E994 +MARUGGIO=E995 +MARZABOTTO=B689 +MARZANO=E999 +MARZANO_APPIO=E998 +MARZANO_DI_NOLA=E997 +MARZI=F001 +MARZIO=F002 +MASAINAS=F000 +MASATE=F003 +MASCALI=F004 +MASCALUCIA=F005 +MASCHITO=F006 +MASCIAGO_PRIMO=F007 +MASER=F009 +MASERA=F010 +MASERA'_DI_PADOVA=F011 +MASERADA_SUL_PIAVE=F012 +MASI=F013 +MASI_TORELLO=F016 +MASIO=F015 +MASLIANICO=F017 +MASON_VICENTINO=F019 +MASONE=F020 +MASSA=F023 +MASSA_D'ALBE=F022 +MASSA_E_COZZILE=F025 +MASSA_FERMANA=F021 +MASSA_FISCAGLIA=F026 +MASSA_LOMBARDA=F029 +MASSA_LUBRENSE=F030 +MASSA_MARITTIMA=F032 +MASSA_MARTANA=F024 +MASSAFRA=F027 +MASSALENGO=F028 +MASSANZAGO=F033 +MASSAROSA=F035 +MASSAZZA=F037 +MASSELLO=F041 +MASSERANO=F042 +MASSIGNANO=F044 +MASSIMENO=F045 +MASSIMINO=F046 +MASSINO_VISCONTI=F047 +MASSIOLA=F048 +MASULLAS=F050 +MATELICA=F051 +MATERA=F052 +MATHI=F053 +MATINO=F054 +MATRICE=F055 +MATTIE=F058 +MATTINATA=F059 +MAURITANIA=Z331 +MAZARA_DEL_VALLO=F061 +MAZZANO=F063 +MAZZANO_ROMANO=F064 +MAZZARA'_SANT'ANDREA=F066 +MAZZARINO=F065 +MAZZE'=F067 +MAZZIN=F068 +MAZZO_DI_VALTELLINA=F070 +MEANA_DI_SUSA=F074 +MEANA_SARDO=F073 +MEDA=F078 +MEDE=F080 +MEDEA=F081 +MEDESANO=F082 +MEDICINA=F083 +MEDIGLIA=F084 +MEDOLAGO=F085 +MEDOLE=F086 +MEDOLLA=F087 +MEDUNA_DI_LIVENZA=F088 +MEDUNO=F089 +MEGLIADINO_SAN_FIDENZIO=F091 +MEGLIADINO_SAN_VITALE=F092 +MEINA=F093 +MEL=F094 +MELARA=F095 +MELAZZO=F096 +MELDOLA=F097 +MELE=F098 +MELEGNANO=F100 +MELENDUGNO=F101 +MELETI=F102 +MELFI=F104 +MELICUCCA'=F105 +MELICUCCO=F106 +MELILLI=F107 +MELISSA=F108 +MELISSANO=F109 +MELITO_DI_NAPOLI=F111 +MELITO_DI_PORTO_SALVO=F112 +MELITO_IRPINO=F110 +MELIZZANO=F113 +MELLE=F114 +MELLO=F115 +MELPIGNANO=F117 +MELTINA=F118 +MELZO=F119 +MENAGGIO=F120 +MENAROLA=F121 +MENCONICO=F122 +MENDATICA=F123 +MENDICINO=F125 +MENFI=F126 +MENTANA=F127 +MEOLO=F130 +MERANA=F131 +MERANO=F132 +MERATE=F133 +MERCALLO=F134 +MERCATELLO_SUL_METAURO=F135 +MERCATINO_CONCA=F136 +MERCATO_SAN_SEVERINO=F138 +MERCATO_SARACENO=F139 +MERCENASCO=F140 +MERCOGLIANO=F141 +MERETO_DI_TOMBA=F144 +MERGO=F145 +MERGOZZO=F146 +MERI=F147 +MERLARA=F148 +MERLINO=F149 +MERONE=F151 +MESAGNE=F152 +MESE=F153 +MESENZANA=F154 +MESERO=F155 +MESOLA=F156 +MESORACA=F157 +MESSICO=Z514 +MESSINA=F158 +MESTRINO=F161 +META=F162 +MEUGLIANO=F164 +MEZZAGO=F165 +MEZZANA=F168 +MEZZANA_BIGLI=F170 +MEZZANA_MORTIGLIENGO=F167 +MEZZANA_RABATTONE=F171 +MEZZANE_DI_SOTTO=F172 +MEZZANEGO=F173 +MEZZANI=F174 +MEZZANINO=F175 +MEZZANO=F176 +MEZZEGRA=F181 +MEZZENILE=F182 +MEZZOCORONA=F183 +MEZZOJUSO=F184 +MEZZOLDO=F186 +MEZZOLOMBARDO=F187 +MEZZOMERICO=F188 +MIAGLIANO=F189 +MIANE=F190 +MIASINO=F191 +MIAZZINA=F192 +MICIGLIANO=F193 +MIGGIANO=F194 +MIGLIANICO=F196 +MIGLIARINO=F198 +MIGLIARO=F199 +MIGLIERINA=F200 +MIGLIONICO=F201 +MIGNANEGO=F202 +MIGNANO_MONTE_LUNGO=F203 +MILANO=F205 +MILAZZO=F206 +MILENA=E618 +MILETO=F207 +MILIS=F208 +MILITELLO_ROSMARINO=F210 +MILITELLO_V.C.=F209 +MILLESIMO=F213 +MILO=F214 +MILZANO=F216 +MINEO=F217 +MINERBE=F218 +MINERBIO=F219 +MINERVINO_DI_LECCE=F221 +MINERVINO_MURGE=F220 +MINORI=F223 +MINTURNO=F224 +MINUCCIANO=F225 +MIOGLIA=F226 +MIRA=F229 +MIRABELLA_ECLANO=F230 +MIRABELLA_IMBACCARI=F231 +MIRABELLO=F235 +MIRABELLO_MONFERRATO=F232 +MIRABELLO_SANNITICO=F233 +MIRADOLO_TERME=F238 +MIRANDA=F239 +MIRANDOLA=F240 +MIRANO=F241 +MIRTO=F242 +MISANO_ADRIATICO=F244 +MISANO_DI_GERA_D'ADDA=F243 +MISILMERI=F246 +MISINTO=F247 +MISSAGLIA=F248 +MISSANELLO=F249 +MISTERBIANCO=F250 +MISTRETTA=F251 +MOASCA=F254 +MOCONESI=F256 +MODENA=F257 +MODICA=F258 +MODIGLIANA=F259 +MODOLO=F261 +MODUGNO=F262 +MOENA=F263 +MOGGIO=F265 +MOGGIO_UDINESE=F266 +MOGLIA=F267 +MOGLIANO=F268 +MOGLIANO_VENETO=F269 +MOGORELLA=F270 +MOGORO=F272 +MOIANO=F274 +MOIMACCO=F275 +MOIO_ALCANTARA=F277 +MOIO_DE'CALVI=F276 +MOIO_DELLA_CIVITELLA=F278 +MOIOLA=F279 +MOLA_DI_BARI=F280 +MOLARE=F281 +MOLAZZANA=F283 +MOLFETTA=F284 +MOLINA_ATERNO=M255 +MOLINA_DI_LEDRO=F286 +MOLINARA=F287 +MOLINELLA=F288 +MOLINI_DI_TRIORA=F290 +MOLINO_DEI_TORTI=F293 +MOLISE=F294 +MOLITERNO=F295 +MOLLIA=F297 +MOLOCHIO=F301 +MOLTENO=F304 +MOLTRASIO=F305 +MOLVENA=F306 +MOLVENO=F307 +MOMBALDONE=F308 +MOMBARCARO=F309 +MOMBAROCCIO=F310 +MOMBARUZZO=F311 +MOMBASIGLIO=F312 +MOMBELLO_DI_TORINO=F315 +MOMBELLO_MONFERRATO=F313 +MOMBERCELLI=F316 +MOMO=F317 +MOMPANTERO=F318 +MOMPEO=F319 +MOMPERONE=F320 +MONACILIONI=F322 +MONACO=Z123 +MONALE=F323 +MONASTERACE=F324 +MONASTERO_BORMIDA=F325 +MONASTERO_DI_LANZO=F327 +MONASTERO_DI_VASCO=F326 +MONASTEROLO_CASOTTO=F329 +MONASTEROLO_DEL_CASTELLO=F328 +MONASTEROLO_DI_SAVIGLIANO=F330 +MONASTIER_DI_TREVISO=F332 +MONASTIR=F333 +MONCALIERI=F335 +MONCALVO=F336 +MONCENISIO=D553 +MONCESTINO=F337 +MONCHIERO=F338 +MONCHIO_DELLE_CORTI=F340 +MONCLASSICO=F341 +MONCRIVELLO=F342 +MONCUCCO_TORINESE=F343 +MONDAINO=F346 +MONDAVIO=F347 +MONDOLFO=F348 +MONDOVI'=F751 +MONDRAGONE=F352 +MONEGLIA=F354 +MONESIGLIO=F355 +MONFALCONE=F356 +MONFORTE_D'ALBA=F358 +MONFORTE_SAN_GIORGIO=F359 +MONFUMO=F360 +MONGARDINO=F361 +MONGHIDORO=F363 +MONGIANA=F364 +MONGIARDINO_LIGURE=F365 +MONGIUFFI_MELIA=F368 +MONGOLIA=Z233 +MONGRANDO=F369 +MONGRASSANO=F370 +MONGUELFO=F371 +MONGUZZO=F372 +MONIGA_DEL_GARDA=F373 +MONLEALE=F374 +MONNO=F375 +MONOPOLI=F376 +MONREALE=F377 +MONRUPINO=F378 +MONSAMPAOLO_DEL_TRONTO=F380 +MONSAMPIETRO_MORICO=F379 +MONSANO=F381 +MONSELICE=F382 +MONSUMMANO_TERME=F384 +MONTA'=F385 +MONTABONE=F386 +MONTACUTO=F387 +MONTAFIA=F390 +MONTAGANO=F391 +MONTAGNA=F392 +MONTAGNA_IN_VALTELLINA=F393 +MONTAGNANA=F394 +MONTAGNAREALE=F395 +MONTAGNE=F396 +MONTAGUTO=F397 +MONTAIONE=F398 +MONTALBANO_ELICONA=F400 +MONTALBANO_IONICO=F399 +MONTALCINO=F402 +MONTALDEO=F403 +MONTALDO_BORMIDA=F404 +MONTALDO_DI_MONDOVI'=F405 +MONTALDO_ROERO=F408 +MONTALDO_SCARAMPI=F409 +MONTALDO_TORINESE=F407 +MONTALE=F410 +MONTALENGHE=F411 +MONTALLEGRO=F414 +MONTALTO_DELLE_MARCHE=F415 +MONTALTO_DI_CASTRO=F419 +MONTALTO_DORA=F420 +MONTALTO_LIGURE=F406 +MONTALTO_PAVESE=F417 +MONTALTO_UFFUGO=F416 +MONTANARO=F422 +MONTANASO_LOMBARDO=F423 +MONTANERA=F424 +MONTANO_ANTILIA=F426 +MONTANO_LUCINO=F427 +MONTAPPONE=F428 +MONTAQUILA=F429 +MONTASOLA=F430 +MONTAURO=F432 +MONTAZZOLI=F433 +MONTE_ARGENTARIO=F437 +MONTE_CASTELLO_DI_VIBIO=F456 +MONTE_CAVALLO=F460 +MONTE_CERIGNONE=F467 +MONTE_COLOMBO=F476 +MONTE_CREMASCO=F434 +MONTE_DI_MALO=F486 +MONTE_DI_PROCIDA=F488 +MONTE_GIBERTO=F517 +MONTE_GRIDOLFO=F523 +MONTE_GRIMANO=F524 +MONTE_ISOLA=F532 +MONTE_MARENZO=F561 +MONTE_PORZIO=F589 +MONTE_PORZIO_CATONE=F590 +MONTE_ROBERTO=F600 +MONTE_ROMANO=F603 +MONTE_SAN_BIAGIO=F616 +MONTE_SAN_GIACOMO=F618 +MONTE_SAN_GIOVANNI_CAMPANO=F620 +MONTE_SAN_GIOVANNI_IN_SABINA=F619 +MONTE_SAN_GIUSTO=F621 +MONTE_SAN_MARTINO=F622 +MONTE_SAN_PIETRANGELI=F626 +MONTE_SAN_PIETRO=F627 +MONTE_SAN_SAVINO=F628 +MONTE_SAN_VITO=F634 +MONTE_SANTA_MARIA_TIBERINA=F629 +MONTE_SANT'ANGELO=F631 +MONTE_URANO=F653 +MONTE_VIDON_COMBATTE=F664 +MONTE_VIDON_CORRADO=F665 +MONTEBELLO_DELLA_BATTAGLIA=F440 +MONTEBELLO_DI_BERTONA=F441 +MONTEBELLO_IONICO=D746 +MONTEBELLO_SUL_SANGRO=B268 +MONTEBELLO_VICENTINO=F442 +MONTEBELLUNA=F443 +MONTEBRUNO=F445 +MONTEBUONO=F446 +MONTECALVO_IN_FOGLIA=F450 +MONTECALVO_IRPINO=F448 +MONTECALVO_VERSIGGIA=F449 +MONTECARLO=F452 +MONTECAROTTO=F453 +MONTECASSIANO=F454 +MONTECASTELLO=F455 +MONTECASTRILLI=F457 +MONTECATINI_TERME=A561 +MONTECATINI_VAL_DI_CECINA=F458 +MONTECCHIA_DI_CROSARA=F461 +MONTECCHIO=F462 +MONTECCHIO_EMILIA=F463 +MONTECCHIO_MAGGIORE=F464 +MONTECCHIO_PRECALCINO=F465 +MONTECHIARO_D'ACQUI=F469 +MONTECHIARO_D'ASTI=F468 +MONTECHIARUGOLO=F473 +MONTECICCARDO=F474 +MONTECILFONE=F475 +MONTECOMPATRI=F477 +MONTECOPIOLO=F478 +MONTECORICE=F479 +MONTECORVINO_PUGLIANO=F480 +MONTECORVINO_ROVELLA=F481 +MONTECOSARO=F482 +MONTECRESTESE=F483 +MONTECRETO=F484 +MONTEDINOVE=F487 +MONTEDORO=F489 +MONTEFALCIONE=F491 +MONTEFALCO=F492 +MONTEFALCONE_APPENNINO=F493 +MONTEFALCONE_DI_VAL_FORTORE=F494 +MONTEFALCONE_NEL_SANNIO=F495 +MONTEFANO=F496 +MONTEFELCINO=F497 +MONTEFERRANTE=F498 +MONTEFIASCONE=F499 +MONTEFINO=F500 +MONTEFIORE_CONCA=F502 +MONTEFIORE_DELL'ASO=F501 +MONTEFIORINO=F503 +MONTEFLAVIO=F504 +MONTEFORTE_CILENTO=F507 +MONTEFORTE_D'ALPONE=F508 +MONTEFORTE_IRPINO=F506 +MONTEFORTINO=F509 +MONTEFRANCO=F510 +MONTEFREDANE=F511 +MONTEFUSCO=F512 +MONTEGABBIONE=F513 +MONTEGALDA=F514 +MONTEGALDELLA=F515 +MONTEGALLO=F516 +MONTEGIOCO=F518 +MONTEGIORDANO=F519 +MONTEGIORGIO=F520 +MONTEGRANARO=F522 +MONTEGRINO_VALTRAVAGLIA=F526 +MONTEGROSSO_D'ASTI=F527 +MONTEGROSSO_PIAN_LATTE=F528 +MONTEGROTTO_TERME=F529 +MONTEIASI=F531 +MONTELABBATE=F533 +MONTELANICO=F534 +MONTELAPIANO=F535 +MONTELEONE_DI_FERMO=F536 +MONTELEONE_DI_PUGLIA=F538 +MONTELEONE_DI_SPOLETO=F540 +MONTELEONE_D'ORVIETO=F543 +MONTELEONE_ROCCA_DORIA=F542 +MONTELEONE_SABINO=F541 +MONTELEPRE=F544 +MONTELIBRETTI=F545 +MONTELLA=F546 +MONTELLO=F547 +MONTELONGO=F548 +MONTELPARO=F549 +MONTELUPO_ALBESE=F550 +MONTELUPO_FIORENTINO=F551 +MONTELUPONE=F552 +MONTEMAGGIORE_AL_METAURO=F555 +MONTEMAGGIORE_BELSITO=F553 +MONTEMAGNO=F556 +MONTEMALE_DI_CUNEO=F558 +MONTEMARANO=F559 +MONTEMARCIANO=F560 +MONTEMARZINO=F562 +MONTEMESOLA=F563 +MONTEMEZZO=F564 +MONTEMIGNAIO=F565 +MONTEMILETTO=F566 +MONTEMILONE=F568 +MONTEMITRO=F569 +MONTEMONACO=F570 +MONTEMURLO=F572 +MONTEMURRO=F573 +MONTENARS=F574 +MONTENERO_DI_BISACCIA=F576 +MONTENERO_SABINO=F579 +MONTENERO_VAL_COCCHIARA=F580 +MONTENERODOMO=F578 +MONTEODORISIO=F582 +MONTEPAONE=F586 +MONTEPARANO=F587 +MONTEPRANDONE=F591 +MONTEPULCIANO=F592 +MONTERADO=F593 +MONTERCHI=F594 +MONTEREALE=F595 +MONTEREALE_VALCELLINA=F596 +MONTERENZIO=F597 +MONTERIGGIONI=F598 +MONTERINALDO=F599 +MONTERODUNI=F601 +MONTERONI_D'ARBIA=F605 +MONTERONI_DI_LECCE=F604 +MONTEROSI=F606 +MONTEROSSO_AL_MARE=F609 +MONTEROSSO_ALMO=F610 +MONTEROSSO_CALABRO=F607 +MONTEROSSO_GRANA=F608 +MONTEROTONDO=F611 +MONTEROTONDO_MARITTIMO=F612 +MONTERUBBIANO=F614 +MONTESANO_SALENTINO=F623 +MONTESANO_SULLA_MARCELLANA=F625 +MONTESARCHIO=F636 +MONTESCAGLIOSO=F637 +MONTESCANO=F638 +MONTESCHENO=F639 +MONTESCUDAIO=F640 +MONTESCUDO=F641 +MONTESE=F642 +MONTESEGALE=F644 +MONTESILVANO=F646 +MONTESPERTOLI=F648 +MONTEU_DA_PO=F651 +MONTEU_ROERO=F654 +MONTEVAGO=F655 +MONTEVARCHI=F656 +MONTEVECCHIA=F657 +MONTEVEGLIO=F659 +MONTEVERDE=F660 +MONTEVERDI_MARITTIMO=F661 +MONTEVIALE=F662 +MONTEZEMOLO=F666 +MONTI=F667 +MONTIANO=F668 +MONTICELLI_BRUSATI=F672 +MONTICELLI_D'ONGINA=F671 +MONTICELLI_PAVESE=F670 +MONTICELLO_BRIANZA=F674 +MONTICELLO_CONTE_OTTO=F675 +MONTICELLO_D'ALBA=F669 +MONTICHIARI=F471 +MONTICIANO=F676 +MONTIERI=F677 +MONTIGLIO=F678 +MONTIGNOSO=F679 +MONTIOVET=F367 +MONTIRONE=F680 +MONTODINE=F681 +MONTOGGIO=F682 +MONTONE=F685 +MONTOPOLI_DI_SABINA=F687 +MONTOPOLI_DI_VAL_D'ARNO=F686 +MONTORFANO=F688 +MONTORIO_AL_VOMANO=F690 +MONTORIO_NEI_FRENTANI=F689 +MONTORIO_ROMANO=F692 +MONTORO_INFERIORE=F693 +MONTORO_SUPERIORE=F694 +MONTORSO_VICENTINO=F696 +MONTOTTONE=F697 +MONTRESTA=F698 +MONTU'_BECCARIA=F701 +MONVALLE=F703 +MONZA=F704 +MONZAMBANO=F705 +MONZUNO=F706 +MORANO_CALABRO=F708 +MORANO_SUL_PO=F707 +MORANSENGO=F709 +MORARO=F710 +MORAZZONE=F711 +MORBEGNO=F712 +MORBELLO=F713 +MORCIANO_DI_LEUCA=F716 +MORCIANO_DI_ROMAGNA=F715 +MORCONE=F717 +MORDANO=F718 +MORENGO=F720 +MORES=F721 +MORESCO=F722 +MORETTA=F723 +MORFASSO=F724 +MORGANO=F725 +MORGEX=F726 +MORGONGIORI=F727 +MORI=F728 +MORIAGO_DELLA_BATTAGLIA=F729 +MORICONE=F730 +MORIGERATI=F731 +MORIMONDO=D033 +MORINO=F732 +MORIONDO_TORINESE=F733 +MORLUPO=F734 +MORMANNO=F735 +MORNAGO=F736 +MORNESE=F737 +MORNICO_AL_SERIO=F738 +MORNICO_LOSANA=F739 +MOROLO=F740 +MOROZZO=F743 +MORRA_DE_SANCTIS=F744 +MORRO_D'ALBA=F745 +MORRO_D'ORO=F747 +MORRO_REATINO=F746 +MORRONE_DEL_SANNIO=F748 +MORROVALLE=F749 +MORSANO_AL_TAGLIAMENTO=F750 +MORSASCO=F751 +MORTARA=F754 +MORTEGLIANO=F756 +MORTERONE=F758 +MORUZZO=F760 +MOSCAZZANO=F761 +MOSCHIANO=F762 +MOSCIANO_SANT'ANGELO=F764 +MOSCUFO=F765 +MOSO_IN_PASSIRIA=F766 +MOSSA=F767 +MOSSANO=F768 +MOSSO_SANTA_MARIA=F769 +MOTTA_BALUFFI=F771 +MOTTA_CAMASTRA=F772 +MOTTA_D'AFFERMO=F773 +MOTTA_DE'CONTI=F774 +MOTTA_DI_LIVENZA=F770 +MOTTA_MONTECORVINO=F777 +MOTTA_SAN_GIOVANNI=F779 +MOTTA_SANTA_ANASTASIA=F781 +MOTTA_SANTA_LUCIA=F780 +MOTTA_VISCONTI=F783 +MOTTAFOLLONE=F775 +MOTTALCIATA=F776 +MOTTEGGIANA=B012 +MOTTOLA=F784 +MOZAMBICO=Z333 +MOZZAGROGNA=F785 +MOZZANICA=F786 +MOZZATE=F788 +MOZZECANE=F789 +MOZZO=F791 +MUCCIA=F793 +MUGGIA=F794 +MUGGIO'=F797 +MUGNANO_DEL_CARDINALE=F798 +MUGNANO_DI_NAPOLI=F799 +MULAZZANO=F801 +MULAZZO=F802 +MURA=F806 +MURAVERA=F808 +MURAZZANO=F809 +MURELLO=F811 +MURIALDO=F813 +MURISENGO=F814 +MURLO=F815 +MURO_LECCESE=F816 +MURO_LUCANO=F817 +MUROS=F818 +MUSCOLINE=F820 +MUSEI=F822 +MUSILE_DI_PIAVE=F826 +MUSSO=F828 +MUSSOLENTE=F829 +MUSSOMELI=F830 +MUZZANA_DEL_TURGNANO=F832 +MUZZANO=F833 +NAGO_TORBOLE=F835 +NALLES=F836 +NANNO=F837 +NANTO=F838 +NAPOLI=F839 +NARBOLIA=F840 +NARCAO=F841 +NARDO'=F842 +NARDODIPACE=F843 +NARNI=F844 +NARO=F845 +NARZOLE=F846 +NASINO=F847 +NASO=F848 +NATURNO=F849 +NAVE=F851 +NAVE_SAN_ROCCO=F853 +NAVELLI=F852 +NAZ_SCIAVES=F856 +NAZZANO=F857 +NE=F858 +NEBBIUNO=F859 +NEGRAR=F861 +NEIRONE=F862 +NEIVE=F863 +NEMBRO=F864 +NEMI=F865 +NEMOLI=F866 +NEONELI=F867 +NEPAL=Z234 +NEPI=F868 +NERETO=F870 +NEROLA=F871 +NERVESA_DELLA_BATTAGLIA=F872 +NERVIANO=F874 +NESPOLO=F876 +NESSO=F877 +NETRO=F878 +NETTUNO=F880 +NEVIANO=F881 +NEVIANO_DEGLI_ARDUINI=F882 +NEVIGLIE=F883 +NIARDO=F884 +NIBBIANO=F885 +NIBBIOLA=F886 +NIBIONNO=F887 +NICARAGUA=Z515 +NICHELINO=F889 +NICOLOSI=F890 +NICORVO=F891 +NICOSIA=F892 +NICOTERA=F893 +NIELLA_BELBO=F894 +NIELLA_TANARO=F895 +NIGER=Z334 +NIGERIA=Z335 +NIMIS=F898 +NISCEMI=F889 +NISSORIA=F900 +NIZZA_DI_SICILIA=F901 +NIZZA_MONFERRATO=F902 +NOALE=F904 +NOASCA=F906 +NOCARA=F907 +NOCCIANO=F908 +NOCERA_INFERIORE=F912 +NOCERA_SUPERIORE=F913 +NOCERA_TIRINESE=F910 +NOCERA_UMBRA=F911 +NOCETO=F914 +NOCI=F915 +NOCIGLIA=F916 +NOEPOLI=F917 +NOGARA=F918 +NOGAREDO=F920 +NOGAROLE_ROCCA=F921 +NOGAROLE_VICENTINO=F922 +NOICATTARO=F923 +NOLA=F924 +NOLE=F925 +NOLI=F926 +NOMAGLIO=F927 +NOMI=F929 +NONANTOLA=F930 +NONE=F931 +NONIO=F932 +NORAGUGUME=F933 +NORBELLO=F934 +NORCIA=F935 +NORMA=F937 +NORVEGIA=Z125 +NOSATE=F939 +NOTARESCO=F942 +NOTO=F943 +NOVA_LEVANTE=F949 +NOVA_MILANESE=F944 +NOVA_PONENTE=F950 +NOVA_SIRI=A942 +NOVAFELTRIA=F137 +NOVALEDO=F947 +NOVALESA=F948 +NOVARA=F952 +NOVARA_DI_SICILIA=F951 +NOVATE_MEZZOLA=F956 +NOVATE_MILANESE=F955 +NOVE=F957 +NOVEDRATE=F958 +NOVELLARA=F960 +NOVELLO=F961 +NOVENTA_DI_PIAVE=F963 +NOVENTA_PADOVANA=F962 +NOVENTA_VICENTINA=F964 +NOVI_DI_MODENA=F966 +NOVI_LIGURE=F965 +NOVI_VELIA=F967 +NOVIGLIO=F968 +NOVOLI=F970 +NUCETTO=F972 +NUGHEDU_DI_SAN_NICOLO'=F975 +NUGHEDU_SANTA_VITTORIA=F974 +NULE=F976 +NULVI=F977 +NUMANA=F978 +NUORO=F979 +NUOVA_CALEDONIA=Z716 +NUOVA_GUINEA=Z718 +NUOVA_ZELANDA=Z719 +NUOVE_EBRIDI=Z717 +NURACHI=F980 +NURAGUS=F981 +NURALLAO=F982 +NURAMINIS=F983 +NURECI=F985 +NURRI=F986 +NUS=F987 +NUSCO=F988 +NUVOLENTO=F989 +NUVOLERA=F990 +NUXIS=F991 +OCCHIEPPO_INFERIORE=F992 +OCCHIEPPO_SUPERIORE=F993 +OCCHIOBELLO=F994 +OCCIMIANO=F995 +OCRE=F996 +ODALENGO_GRANDE=F997 +ODALENGO_PICCOLO=F998 +ODERZO=F999 +ODOLO=G001 +OFENA=G002 +OFFAGNA=G003 +OFFANENGO=G004 +OFFIDA=G005 +OFFLAGA=G006 +OGGEBBIO=G007 +OGGIONA_CON_SANTO_STEFANO=G008 +OGGIONO=G009 +OGLIANICO=G010 +OGLIASTRO_CILENTO=G011 +OLBIA=G015 +OLCENENGO=G016 +OLDENICO=G018 +OLEGGIO=G019 +OLEGGIO_CASTELLO=G020 +OLEVANO_DI_LOMELLINA=G021 +OLEVANO_ROMANO=G022 +OLEVANO_SUL_TUSCIANO=G023 +OLGIATE_COMASCO=G025 +OLGIATE_MOLGORA=G026 +OLGIATE_OLONA=G028 +OLGINATE=G030 +OLIENA=G031 +OLIVA_GESSI=G032 +OLIVADI=G034 +OLIVERI=G036 +OLIVETO_CITRA=G039 +OLIVETO_LARIO=G040 +OLIVETO_LUCANO=G037 +OLIVETTA_SAN_MICHELE=G041 +OLIVOLA=G042 +OLLASTRA_SIMAXIS=G043 +OLLOLAI=G044 +OLLOMONT=G045 +OLMEDO=G046 +OLMENETA=G047 +OLMO_AL_BREMBO=G049 +OLMO_GENTILE=G048 +OLTRE_IL_COLLE=G050 +OLTRESSENDA_ALTA=G054 +OLTRONA_DI_SAN_MAMETTE=G056 +OLZAI=G058 +OMAN=Z235 +OME=G061 +OMEGNA=G062 +OMIGNANO=G063 +ONANI=G064 +ONANO=G065 +ONCINO=G066 +ONETA=G068 +ONIFAI=G070 +ONIFERI=G071 +ONO_SAN_PIETRO=G074 +ONORE=G075 +ONZO=G076 +OPERA=G078 +OPI=G079 +OPPEANO=G080 +OPPIDO_LUCANO=G081 +OPPIDO_MAMERTINA=G082 +ORA=G083 +ORANI=G084 +ORATINO=G086 +ORBASSANO=G087 +ORBETELLO=G088 +ORCIANO_DI_PESARO=G089 +ORCIANO_PISANO=G090 +ORCO_FEGLINO=D522 +ORDONA=G000 +ORERO=G093 +ORGIANO=G095 +ORGOSOLO=G097 +ORIA=G098 +ORICOLA=G102 +ORIGGIO=G103 +ORINO=G105 +ORIO_AL_SERIO=G108 +ORIO_CANAVESE=A109 +ORIO_LITTA=G107 +ORIOLO=G110 +ORIOLO_ROMANO=G111 +ORISTANO=G113 +ORMEA=G114 +ORMELLE=G115 +ORNAGO=G116 +ORNAVASSO=G117 +ORNICA=G118 +OROSEI=G119 +OROTELLI=G120 +ORRIA=G121 +ORROLI=G122 +ORSAGO=G123 +ORSARA_BORMIDA=G124 +ORSARA_DI_PUGLIA=G125 +ORSENIGO=G126 +ORSOGNA=G128 +ORSOMARSO=G129 +ORTA_DI_ATELLA=G130 +ORTA_NOVA=G131 +ORTA_SAN_GIULIO=G134 +ORTACESUS=G133 +ORTE=G135 +ORTELLE=G136 +ORTEZZANO=G137 +ORTIGNANO_RAGGIOLO=G139 +ORTISEI=G140 +ORTONA=G141 +ORTONA_DE'MARSI=G142 +ORTONOVO=G143 +ORTOVERO=G144 +ORTUCCHIO=G145 +ORTUERI=G146 +ORUNE=G147 +ORVIETO=G148 +ORVINIO=B595 +ORZINUOVI=G149 +ORZIVECCHI=G150 +OSASCO=G151 +OSASIO=G152 +OSCHIRI=G153 +OSIDDA=G154 +OSIGLIA=G155 +OSILO=G156 +OSIMO=G157 +OSINI=G158 +OSIO_SOPRA=G159 +OSIO_SOTTO=G160 +OSMATE=E529 +OSNAGO=G161 +OSOPPO=G163 +OSPEDALETTI=G164 +OSPEDALETTO=G168 +OSPEDALETTO_D'ALPINOLO=G165 +OSPEDALETTO_EUGANEO=G167 +OSPEDALETTO_LODIGIANO=G166 +OSPITALE_DI_CADORE=G169 +OSPITALETTO=G170 +OSSAGO_LODIGIANO=G171 +OSSANA=G173 +OSSI=G178 +OSSIMO=G179 +OSSONA=G181 +OSSUCCIO=G182 +OSTANA=G183 +OSTELLATO=G184 +OSTIANO=G185 +OSTIGLIA=G186 +OSTRA=F401 +OSTRA_VETERE=F581 +OSTUNI=G187 +OTRANTO=G188 +OTRICOLI=G189 +OTTANA=G191 +OTTATI=G192 +OTTAVIANO=G190 +OTTIGLIO=G193 +OTTOBIANO=G194 +OTTONE=G195 +OULX=G196 +OVADA=G197 +OVARO=G198 +OVIGLIO=G199 +OVINDOLI=G200 +OVODDA=G201 +OYACE=G012 +OZEGNA=G202 +OZIERI=G203 +OZZANO_DELL'EMILIA=G205 +OZZANO_MONFERRATO=G204 +OZZERO=G206 +PABILLONIS=G207 +PACE_DEL_MELA=G209 +PACECO=G208 +PACENTRO=G210 +PACHINO=G211 +PACIANO=G212 +PADENGHE_SUL_GARDA=G213 +PADERGNONE=G214 +PADERNA=G215 +PADERNO_D'ADDA=G218 +PADERNO_DEL_GRAPPA=G221 +PADERNO_DUGNANO=G220 +PADERNO_FRANCIACORTA=G217 +PADERNO_PONCHIELLI=G222 +PADOVA=G224 +PADRIA=G225 +PADULA=G226 +PADULI=G227 +PAESANA=G228 +PAESE=G229 +PAESI_BASSI=Z126 +PAGANI=G230 +PAGANICO_SABINO=G232 +PAGAZZANO=G233 +PAGLIARA=G234 +PAGLIETA=G237 +PAGNACCO=G238 +PAGNO=G240 +PAGNONA=G241 +PAGO_DEL_VALLO_DI_LAURO=G242 +PAGO_VEIANO=G243 +PAISCO_LOVENO=G247 +PAITONE=G248 +PAKISTAN=Z236 +PALADINA=G249 +PALAGANO=G250 +PALAGIANELLO=G251 +PALAGIANO=G252 +PALAGONIA=G253 +PALAIA=G254 +PALANZANO=G255 +PALATA=G257 +PALAU=G258 +PALAZZAGO=G259 +PALAZZO_ADRIANO=G263 +PALAZZO_CANAVESE=G262 +PALAZZO_PIGNANO=G260 +PALAZZO_SAN_GERVASIO=G261 +PALAZZOLO_ACREIDE=G267 +PALAZZOLO_DELLO_STELLA=G268 +PALAZZOLO_SULL'OGLIO=G264 +PALAZZOLO_VERCELLESE=G266 +PALAZZUOLO_SUL_SENIO=G270 +PALENA=G271 +PALERMITI=G272 +PALERMO=G273 +PALESTRINA=G274 +PALESTRO=G275 +PALIANO=G276 +PALIZZI=G277 +PALLAGORIO=G278 +PALLANZENO=G280 +PALLARE=G281 +PALMA_CAMPANIA=G283 +PALMA_DI_MONTECHIARO=G282 +PALMANOVA=G284 +PALMARIGGI=G285 +PALMAS_ARBOREA=G286 +PALMI=G288 +PALMIANO=G289 +PALMOLI=G290 +PALO_DEL_COLLE=G291 +PALOMBARA_SABINA=G293 +PALOMBARO=G294 +PALOMONTE=G292 +PALOSCO=G295 +PALU'=G297 +PALU'_DEL_FERSINA=G296 +PALUDI=G298 +PALUZZA=G300 +PAMPARATO=G302 +PANAMA=Z516 +PANCALIERI=G303 +PANCARANA=G304 +PANCHIA'=G305 +PANDINO=G306 +PANETTIERI=G307 +PANICALE=G308 +PANNARANO=G311 +PANNI=G312 +PANTELLERIA=G315 +PANTIGLIATE=G316 +PAOLA=G317 +PAOLISI=G318 +PAPASIDERO=G320 +PAPOZZE=G323 +PAPUASIA=Z720 +PARABIAGO=G324 +PARABITA=G325 +PARAGUAY=Z610 +PARATICO=G327 +PARCINES=G328 +PARE'=G329 +PARELLA=G330 +PARENTI=G331 +PARETE=G333 +PARETO=G334 +PARGHELIA=G335 +PARLASCO=G336 +PARMA=G337 +PARODI_LIGURE=G338 +PAROLDO=G339 +PAROLISE=G340 +PARONA=G342 +PARRANO=G344 +PARRE=G346 +PARTANNA=G347 +PARTINICO=G348 +PARUZZARO=G349 +PARZANICA=G350 +PASIAN_DI_PRATO=G352 +PASIANO_DI_PORDENONE=G353 +PASPARDO=G354 +PASSERANO_MARMORITO=G358 +PASSIGNANO_SUL_TRASIMENO=G359 +PASSIRANO=G361 +PASTENA=G362 +PASTORANO=G364 +PASTRENGO=G365 +PASTURANA=G367 +PASTURO=G368 +PATERNO=G369 +PATERNO'=G371 +PATERNO_CALABRO=G372 +PATERNOPOLI=G370 +PATRICA=G374 +PATTADA=G376 +PATTI=G377 +PATU'=G378 +PAU=G379 +PAULARO=G381 +PAULI_ARBAREI=G382 +PAULILATINO=G384 +PAULLO=G385 +PAUPISI=G386 +PAVAROLO=G387 +PAVIA=G388 +PAVIA_DI_UDINE=G389 +PAVONE_CANAVESE=G392 +PAVONE_DEL_MELLA=G391 +PAVULLO_NEL_FRIGNANO=G393 +PAZZANO=G394 +PECCIOLI=G395 +PECCO=G396 +PECETTO_DI_VALENZA=G397 +PECETTO_TORINESE=G398 +PECORARA=G399 +PEDACE=G400 +PEDARA=G402 +PEDASO=G403 +PEDAVENA=G404 +PEDEMONTE=G406 +PEDEROBBA=G408 +PEDESINA=G410 +PEDIVIGLIANO=G411 +PEDRENGO=G412 +PEGLIO=G415 +PEGLIO=G416 +PEGOGNAGA=G417 +PEIA=G418 +PEIO=G419 +PELAGO=G420 +PELLA=G421 +PELLEGRINO_PARMENSE=G424 +PELLEZZANO=G426 +PELLIO_INTELVI=G427 +PELLIZZANO=G428 +PELUGO=G429 +PENANGO=G430 +PENNA_IN_TEVERINA=G432 +PENNA_SAN_GIOVANNI=G436 +PENNA_SANT'ANDREA=G437 +PENNABILLI=G433 +PENNADOMO=G434 +PENNAPIEDIMONTE=G435 +PENNE=G438 +PENTONE=G439 +PERANO=G441 +PERAROLO_DI_CADORE=G442 +PERCA=G443 +PERCILE=G444 +PERDASDEFOGU=G445 +PERDAXIUS=G446 +PERDIFUMO=G447 +PEREGO=G448 +PERETO=G449 +PERFUGAS=G450 +PERGINE_VALDARNO=G451 +PERGINE_VALSUGANA=G452 +PERGOLA=G453 +PERINALDO=G454 +PERITO=G455 +PERLEDO=G456 +PERLETTO=G457 +PERLO=G458 +PERLOZ=G459 +PERNUMIA=G461 +PERO=C013 +PEROSA_ARGENTINA=G463 +PEROSA_CANAVESE=G462 +PERRERO=G465 +PERSICO_DOSIMO=G469 +PERTENGO=G471 +PERTICA_ALTA=G474 +PERTICA_BASSA=G475 +PERTOSA=G476 +PERTUSIO=G477 +PERU`=Z611 +PERUGIA=G478 +PESARO=G479 +PESCAGLIA=G480 +PESCANTINA=G481 +PESCARA=G482 +PESCAROLO_ED_UNITI=G483 +PESCASSEROLI=G484 +PESCATE=G485 +PESCHE=G486 +PESCHICI=G487 +PESCHIERA_BORROMEO=G488 +PESCHIERA_DEL_GARDA=G489 +PESCIA=G491 +PESCINA=G492 +PESCO_SANNITA=G494 +PESCOCOSTANZO=G493 +PESCOLANCIANO=G495 +PESCOPAGANO=G496 +PESCOPENNATARO=G497 +PESCOROCCHIANO=G498 +PESCOSANSONESCO=G499 +PESCOSOLIDO=G500 +PESSANO_CON_BORNAGO=G502 +PESSINA_CREMONESE=G504 +PESSINETTO=G505 +PETACCIATO=G506 +PETILIA_POLICASTRO=G508 +PETINA=G509 +PETRALIA_SOPRANA=G510 +PETRALIA_SOTTANA=G511 +PETRELLA_SALTO=G513 +PETRELLA_TIFERNINA=G512 +PETRIANO=G514 +PETRIOLO=G515 +PETRITOLI=G516 +PETRIZZI=G517 +PETRONA'=G518 +PETRURO_IRPINO=G519 +PETTENASCO=G520 +PETTINENGO=G521 +PETTINEO=G522 +PETTORANELLO_DEL_MOLISE=G523 +PETTORANO_SUL_GIZIO=G524 +PETTORAZZA_GRIMANI=G525 +PEVERAGNO=G526 +PEZZANA=G528 +PEZZAZE=G529 +PEZZOLO_VALLE_UZZONE=G532 +PIACENZA=G535 +PIACENZA_D'ADIGE=G534 +PIADENA=G536 +PIAGGE=G537 +PIAGGINE=G538 +PIAN_CAMUNO=G546 +PIAN_DI_SCO=G552 +PIANA_CRIXIA=G542 +PIANA_DEGLI_ALBANESI=G543 +PIANA_DI_CAIAZZO=G541 +PIANCASTAGNAIO=G547 +PIANCOGNO=G549 +PIANDIMELETO=G551 +PIANE_CRATI=G553 +PIANELLA=G555 +PIANELLO_DEL_LARIO=G556 +PIANELLO_VAL_TIDONE=G557 +PIANENGO=G558 +PIANEZZA=G559 +PIANEZZE=G560 +PIANFEI=G561 +PIANICO=G564 +PIANIGA=G565 +PIANO_DI_SORRENTO=G568 +PIANOPOLI=D546 +PIANORO=G570 +PIANSANO=G571 +PIANTEDO=G572 +PIARIO=G574 +PIASCO=G575 +PIATEDA=G576 +PIATTO=G577 +PIAZZA_AL_SERCHIO=G582 +PIAZZA_ARMERINA=G580 +PIAZZA_BREMBANA=G579 +PIAZZATORRE=G583 +PIAZZOLA_SUL_BRENTA=G587 +PIAZZOLO=G588 +PICCIANO=G589 +PICERNO=G590 +PICINISCO=G591 +PICO=G592 +PIEA=G593 +PIEDICAVALLO=G594 +PIEDILUCO=G595 +PIEDIMONTE_ETNEO=G597 +PIEDIMONTE_MATESE=G596 +PIEDIMONTE_SAN_GERMANO=G598 +PIEDIMULERA=G600 +PIEGARO=G601 +PIENZA=G602 +PIERANICA=G603 +PIETRA_DE'GIORGI=G612 +PIETRA_LIGURE=G605 +PIETRA_MARAZZI=G619 +PIETRABBONDANTE=G606 +PIETRABRUNA=G607 +PIETRACAMELA=G608 +PIETRACATELLA=G609 +PIETRACUPA=G610 +PIETRADEFUSI=G611 +PIETRAFERRAZZANA=G613 +PIETRAFITTA=G615 +PIETRAGALLA=G616 +PIETRALUNGA=G618 +PIETRAMELARA=G620 +PIETRAMONTECORVINO=G604 +PIETRANICO=G621 +PIETRAPAOLA=G622 +PIETRAPERTOSA=G623 +PIETRAPERZIA=G624 +PIETRAPORZIO=G625 +PIETRAROJA=G626 +PIETRARUBBIA=G627 +PIETRASANTA=G628 +PIETRASTORNINA=G629 +PIETRAVAIRANO=G630 +PIETRELCINA=G631 +PIEVE_A_NIEVOLE=G636 +PIEVE_ALBIGNOLA=G635 +PIEVE_D'ALPAGO=G638 +PIEVE_DEL_CAIRO=G639 +PIEVE_DI_BONO=G641 +PIEVE_DI_CADORE=G642 +PIEVE_DI_CENTO=G643 +PIEVE_DI_CORIANO=G633 +PIEVE_DI_LEDRO=G644 +PIEVE_DI_SOLIGO=G645 +PIEVE_DI_TECO=G632 +PIEVE_D'OLMI=G647 +PIEVE_EMANUELE=G634 +PIEVE_FISSIRAGA=G096 +PIEVE_FOSCIANA=G648 +PIEVE_LIGURE=G646 +PIEVE_PORTO_MORONE=G650 +PIEVE_SAN_GIACOMO=G651 +PIEVE_SANTO_STEFANO=G653 +PIEVE_TESINO=G656 +PIEVE_TORINA=G657 +PIEVE_VERGONTE=G658 +PIEVEBOVIGLIANA=G637 +PIEVEPELAGO=G649 +PIGLIO=G659 +PIGNA=G660 +PIGNATARO_INTERAMNA=G662 +PIGNATARO_MAGGIORE=G661 +PIGNOLA=G663 +PIGNONE=G664 +PIGRA=G665 +PILA=G666 +PIMENTEL=G669 +PIMONTE=G670 +PINAROLO_PO=G671 +PINASCA=G672 +PINCARA=G673 +PINEROLO=G674 +PINETO=F831 +PINO_D'ASTI=G676 +PINO_LAGO_MAGGIORE=G677 +PINO_TORINESE=G678 +PINZANO_AL_TAGLIAMENTO=G680 +PINZOLO=G681 +PIOBBICO=G682 +PIOBESI_D'ALBA=G683 +PIOBESI_TORINESE=G684 +PIODE=G685 +PIOLTELLO=G686 +PIOMBINO=G687 +PIOMBINO_DESE=G688 +PIORACO=G690 +PIOSSASCO=G691 +PIOVA'_MASSAIA=G692 +PIOVE_DI_SACCO=G693 +PIOVENE_ROCCHETTE=G694 +PIOVERA=G695 +PIOZZANO=G696 +PIOZZO=G697 +PIRAINO=G699 +PISA=G702 +PISANO=G703 +PISCINA=G705 +PISCIOTTA=G707 +PISOGNE=G710 +PISONIANO=G704 +PISTICCI=G712 +PISTOIA=G713 +PISTOLESA=G714 +PITCAIRN=Z722 +PITEGLIO=G715 +PITIGLIANO=G716 +PIUBEGA=G717 +PIURO=G718 +PIVERONE=G719 +PIZZALE=G720 +PIZZIGHETTONE=G721 +PIZZO=G722 +PIZZOFERRATO=G724 +PIZZOLI=G726 +PIZZONE=G727 +PIZZONI=G728 +PLACANICA=G729 +PLATACI=G733 +PLATANIA=G734 +PLATI'=G735 +PLAUS=G299 +PLESIO=G737 +PLOAGHE=G740 +PLODIO=G741 +POCAPAGLIA=G742 +POCENIA=G743 +PODENZANA=G746 +PODENZANO=G747 +POFI=G749 +POGGIARDO=G751 +POGGIBONSI=G752 +POGGIO_A_CAIANO=G754 +POGGIO_BERNI=G755 +POGGIO_BUSTONE=G756 +POGGIO_CATINO=G757 +POGGIO_IMPERIALE=G761 +POGGIO_MIRTETO=G763 +POGGIO_MOIANO=G764 +POGGIO_NATIVO=G765 +POGGIO_PICENZE=G766 +POGGIO_RENATICO=G768 +POGGIO_RUSCO=G753 +POGGIO_SAN_LORENZO=G770 +POGGIO_SAN_MARCELLO=G771 +POGGIO_SAN_VICINO=D566 +POGGIO_SANNITA=B317 +POGGIODOMO=G758 +POGGIOFIORITO=G760 +POGGIOMARINO=G762 +POGGIOREALE=G767 +POGGIORSINI=G769 +POGGIRIDENTI=G431 +POGLIANO_MILANESE=G772 +POGNANA_LARIO=G773 +POGNANO=G774 +POGNO=G775 +POIANA_MAGGIORE=G776 +POIRINO=G777 +POLAVENO=G779 +POLCENIGO=G780 +POLESELLA=G782 +POLESINE_PARMENSE=G783 +POLI=G784 +POLIA=G785 +POLICORO=G786 +POLIGNANO_A_MARE=G787 +POLINAGO=G789 +POLINESIA=Z723 +POLINO=G790 +POLISTENA=G791 +POLIZZI_GENEROSA=G792 +POLLA=G793 +POLLEIN=G794 +POLLENA_TROCCHIA=G795 +POLLENZA=F567 +POLLICA=G796 +POLLINA=G797 +POLLONE=G798 +POLLUTRI=G799 +POLONGHERA=G800 +POLONIA=Z127 +POLPENAZZE_DEL_GARDA=G801 +POLVERARA=G802 +POLVERIGI=G803 +POMARANCE=G804 +POMARETTO=G805 +POMARICO=G806 +POMARO_MONFERRATO=G807 +POMAROLO=G808 +POMBIA=G809 +POMEZIA=G811 +POMIGLIANO_D'ARCO=G812 +POMPEI=G813 +POMPEIANA=G814 +POMPIANO=G815 +POMPONESCO=G816 +POMPU=G817 +PONCARALE=G818 +PONDERANO=G820 +PONNA=G821 +PONSACCO=G822 +PONSO=G823 +PONT_BOZET=G545 +PONT_CANAVESE=G826 +PONT_SAINT_MARTIN=G854 +PONTASSIEVE=G825 +PONTE=G827 +PONTE_BUGGIANESE=G833 +PONTE_DELL'OLIO=G842 +PONTE_DI_LEGNO=G844 +PONTE_DI_PIAVE=G846 +PONTE_GARDENA=G830 +PONTE_IN_VALTELLINA=G829 +PONTE_LAMBRO=G847 +PONTE_NELLE_ALPI=B662 +PONTE_NIZZA=G851 +PONTE_NOSSA=F941 +PONTE_SAN_NICOLO'=G855 +PONTE_SAN_PIETRO=G856 +PONTEBBA=G831 +PONTECAGNANO_FAIANO=G834 +PONTECCHIO_POLESINE=G836 +PONTECHIANALE=G837 +PONTECORVO=G838 +PONTECURONE=G839 +PONTEDASSIO=G840 +PONTEDERA=G843 +PONTELANDOLFO=G848 +PONTELATONE=G849 +PONTELONGO=G850 +PONTENURE=G852 +PONTERANICA=G853 +PONTESTURA=G858 +PONTEVICO=G859 +PONTEY=G860 +PONTI=G861 +PONTI_SUL_MINCIO=G862 +PONTIDA=G864 +PONTINIA=G865 +PONTINVREA=G866 +PONTIROLO_NUOVO=G867 +PONTOGLIO=G869 +PONTREMOLI=G870 +PONZA=G871 +PONZANO_DI_FERMO=G873 +PONZANO_MONFERRATO=G872 +PONZANO_ROMANO=G874 +PONZANO_VENETO=G875 +PONZONE=G877 +POPOLI=G878 +POPPI=G879 +PORANO=G881 +PORCARI=G882 +PORCIA=G886 +PORDENONE=G888 +PORLEZZA=G889 +PORNASSIO=G890 +PORPETTO=G891 +PORRETTA_TERME=A558 +PORTACOMARO=G894 +PORTALBERA=G895 +PORTE=G900 +PORTICI=G902 +PORTICO_DI_CASERTA=G903 +PORTICO_E_SAN_BENEDETTO=G904 +PORTIGLIOLA=G905 +PORTO_AZZURRO=E680 +PORTO_CERESIO=G906 +PORTO_CESAREO=G000 +PORTO_EMPEDOCLE=F299 +PORTO_MANTOVANO=G917 +PORTO_RECANATI=G919 +PORTO_SAN_GIORGIO=G920 +PORTO_SANT'ELPIDIO=G921 +PORTO_TOLLE=G923 +PORTO_TORRES=G924 +PORTO_VALTRAVAGLIA=G907 +PORTOBUFFOLE'=G909 +PORTOCANNONE=G910 +PORTOFERRAIO=G912 +PORTOFINO=G913 +PORTOGALLO=Z128 +PORTOGRUARO=G914 +PORTOMAGGIORE=G916 +PORTOPALO_DI_CAPO_PASSERO=G000 +PORTOSCUSO=G922 +PORTOVENERE=G925 +PORTULA=G927 +POSADA=G929 +POSINA=G931 +POSITANO=G932 +POSSAGNO=G933 +POSTA=G934 +POSTA_FIBRENO=G935 +POSTAL=G936 +POSTALESIO=G937 +POSTIGLIONE=G939 +POSTUA=G940 +POTENZA=G942 +POTENZA_PICENA=F632 +POVE_DEL_GRAPPA=G943 +POVEGLIANO=G944 +POVEGLIANO_VERONESE=G945 +POVIGLIO=G947 +POVOLETTO=G949 +POZZA_DI_FASSA=G950 +POZZAGLIA_SABINO=G951 +POZZAGLIO_ED_UNITI=B914 +POZZALLO=G953 +POZZILLI=G954 +POZZO_D'ADDA=G955 +POZZOL_GROPPO=G960 +POZZOLENGO=G959 +POZZOLEONE=G957 +POZZOLO_FORMIGARO=G961 +POZZOMAGGIORE=G962 +POZZONOVO=G963 +POZZUOLI=G964 +POZZUOLO_DEL_FRIULI=G966 +POZZUOLO_MARTESANA=G965 +PRADALUNGA=G968 +PRADAMANO=G969 +PRADLEVES=G970 +PRAGELATO=G973 +PRAIA_A_MARE=G975 +PRAIANO=G976 +PRALBOINO=G977 +PRALI=G978 +PRALORMO=G979 +PRALUNGO=G980 +PRAMAGGIORE=G981 +PRAMOLLO=G982 +PRAROLO=G985 +PRAROSTINO=G986 +PRASCO=G987 +PRASCORSANO=G988 +PRASO=G980 +PRATA_CAMPORTACCIO=G993 +PRATA_D'ANSIDONIA=G992 +PRATA_DI_PORDENONE=G994 +PRATA_DI_PRINCIPATO=G990 +PRATA_SANNITA=G991 +PRATELLA=G995 +PRATIGLIONE=G997 +PRATO=G999 +PRATO_ALLO_STELVIO=H004 +PRATO_CARNICO=H002 +PRATO_SESIA=H001 +PRATOLA_PELIGNA=H007 +PRATOLA_SERRA=H006 +PRATOVECCHIO=H008 +PRAVISDOMINI=H010 +PRAY=G974 +PRAZZO=H011 +PRE'_SAINT_DIDIER=H042 +PRECENICCO=H014 +PRECI=H015 +PREDAPPIO=H017 +PREDAZZO=H018 +PREDOI=H019 +PREDORE=H020 +PREDOSA=H021 +PREGANZIOL=H022 +PREGNANA_MILANESE=H026 +PRELA'=H027 +PREMANA=H028 +PREMARIACCO=H029 +PREMENO=H030 +PREMIA=H033 +PREMILCUORE=H034 +PREMOLO=H036 +PREMOSELLO_CHIOVENDA=H037 +PREONE=H038 +PREORE=H039 +PREPOTTO=H040 +PRESEGLIE=H043 +PRESENZANO=H045 +PRESEZZO=H046 +PRESICCE=H047 +PRESSANA=H048 +PRESTINE=H050 +PRETORO=H052 +PREVALLE=H055 +PREZZA=H056 +PREZZO=H057 +PRIERO=H059 +PRIGNANO_CILENTO=H062 +PRIGNANO_SULLA_SECCHIA=H061 +PRIMALUNA=H063 +PRIOCCA=H068 +PRIOLA=H069 +PRIOLO=M279 +PRIVERNO=G698 +PRIZZI=H070 +PROCENO=H071 +PROCIDA=H072 +PROPATA=H073 +PROSERPIO=H074 +PROSSEDI=H076 +PROT._ARABIA_MERID.=Z202 +PROVAGLIO_D'ISEO=H078 +PROVAGLIO_VAL_SABBIA=H077 +PROVES=H081 +PROVVIDENTI=H083 +PRUNETTO=H085 +PUEGNAGO_SUL_GARDA=H086 +PUERTO_RICO=Z518 +PUGLIANELLO=H087 +PULA=H088 +PULFERO=H089 +PULSANO=H090 +PUMENENGO=H091 +PUOS_D'ALPAGO=H092 +PUSIANO=H094 +PUTIFIGARI=H095 +PUTIGNANO=H096 +QATAR=Z237 +QUADRELLE=H097 +QUADRI=H098 +QUAGLIUZZO=H100 +QUALIANO=H101 +QUARANTI=H102 +QUAREGNA=H103 +QUARGNENTO=H104 +QUARNA_SOPRA=H106 +QUARNA_SOTTO=H107 +QUARONA=H108 +QUARRATA=H109 +QUART=H110 +QUARTO=H114 +QUARTO_D'ALTINO=H117 +QUARTU_SANT'ELENA=H118 +QUASSOLO=H120 +QUATTORDIO=H121 +QUATTRO_CASTELLA=H122 +QUERO=H124 +QUILIANO=H126 +QUINCINETTO=H127 +QUINDICI=H128 +QUINGENTOLE=H129 +QUINTANO=H130 +QUINTO_DI_TREVISO=H131 +QUINTO_VERCELLESE=H132 +QUINTO_VICENTINO=H134 +QUINZANO_D'OGLIO=H140 +QUISTELLO=H143 +QUITTENGO=H145 +RABBI=H146 +RACALE=H147 +RACALMUTO=H148 +RACCONIGI=H150 +RACCUIA=H151 +RACINES=H152 +RADDA_IN_CHIANTI=H153 +RADDUSA=H154 +RADICOFANI=H156 +RADICONDOLI=H157 +RAFFADALI=H159 +RAGOGNA=H161 +RAGOLI=H162 +RAGUSA=H163 +RAIANO=H166 +RAMACCA=H168 +RAMISETO=G654 +RAMPONIO_VERNA=H171 +RANCIO_VALCUVIA=H173 +RANCO=H174 +RANDAZZO=H175 +RANICA=H176 +RANZANICO=H177 +RANZO=H180 +RAPAGNANO=H182 +RAPALLO=H183 +RAPINO=H184 +RAPOLANO_TERME=H185 +RAPOLLA=H186 +RAPONE=H187 +RASSA=H188 +RASUN_ANTERSELVA=H189 +RASURA=H192 +RAVANUSA=H194 +RAVARINO=H195 +RAVASCLETTO=H196 +RAVELLO=H198 +RAVENNA=H199 +RAVEO=H200 +RAVISCANINA=H202 +RE=H203 +REA=H204 +REALMONTE=H205 +REANA_DEL_ROIALE=H206 +REANO=H207 +RECALE=H210 +RECANATI=H211 +RECCO=H212 +RECETTO=H213 +RECOARO_TERME=H214 +REDAVALLE=H216 +REDONDESCO=H218 +REFRANCORE=H219 +REFRONTOLO=H220 +REGALBUTO=H221 +REGGELLO=H222 +REGGIO_CALABRIA=H224 +REGGIO_EMILIA=H223 +REGGIOLO=H225 +REINO=H227 +REITANO=H228 +REMANZACCO=H229 +REMEDELLO=H230 +RENATE=H233 +RENDE=H235 +RENON=H236 +REP._CENTRAFRICANA=Z308 +REP._DOMINICANA=Z505 +REP._SUDAFRICANA=Z347 +RESANA=H238 +RESCALDINA=H240 +RESIA=H242 +RESIUTTA=H244 +RESUTTANO=H245 +RETORBIDO=H246 +REVELLO=H247 +REVERE=H248 +REVIGLIASCO_D'ASTI=H250 +REVINE_LAGO=H253 +REVO'=H254 +REZZAGO=H255 +REZZATO=H256 +REZZO=H257 +REZZOAGLIO=H258 +RHEMES_NOTRE_DAME=H262 +RHEMES_SAINT_GEORGES=H263 +RHO=H264 +RHODESIA=Z337 +RIACE=H265 +RIALTO=H266 +RIANO=H267 +RIARDO=H268 +RIBERA=H269 +RIBORDONE=H270 +RICADI=H271 +RICALDONE=H272 +RICCIA=H273 +RICCIONE=H274 +RICCO'_DEL_GOLFO=H275 +RICENGO=H276 +RICIGLIANO=H277 +RIESE_PIO_X=H280 +RIESI=H281 +RIETI=H282 +RIFIANO=H284 +RIFREDDO=H285 +RIGNANO_FLAMINIO=H288 +RIGNANO_GARGANICO=H287 +RIGNANO_SULL'ARNO=H286 +RIGOLATO=H289 +RIMA_SAN_GIUSEPPE=H291 +RIMASCO=H292 +RIMELLA=H293 +RIMINI=H294 +RIO_DI_PUSTERIA=H299 +RIO_MARINA=H305 +RIO_NELL'ELBA=H297 +RIO_SALICETO=H298 +RIOFREDDO=H300 +RIOLA_SARDO=H301 +RIOLO_TERME=H302 +RIOLUNATO=H303 +RIOMAGGIORE=H304 +RIONERO_IN_VULTURE=H307 +RIONERO_SANNITICO=H308 +RIPA_TEATINA=H320 +RIPABOTTONI=H311 +RIPACANDIDA=H312 +RIPALIMOSANI=H313 +RIPALTA_ARPINA=H314 +RIPALTA_CREMASCA=H315 +RIPALTA_GUERINA=H316 +RIPARBELLA=H319 +RIPATRANSONE=H321 +RIPE=H322 +RIPE_SAN_GINESIO=H323 +RIPI=H324 +RIPOSTO=H325 +RITTANA=H326 +RIVA_DEL_GARDA=H330 +RIVA_DI_SOLTO=H331 +RIVA_LIGURE=H328 +RIVA_PRESSO_CHIERI=H337 +RIVA_VALDOBBIA=H329 +RIVALBA=H333 +RIVALTA_BORMIDA=H334 +RIVALTA_DI_TORINO=H335 +RIVAMONTE_AGORDINO=H327 +RIVANAZZANO=H336 +RIVARA=H338 +RIVAROLO_CANAVESE=H340 +RIVAROLO_DEL_RE_ED_UNITI=H341 +RIVAROLO_MANTOVANO=H342 +RIVARONE=H343 +RIVAROSSA=H344 +RIVE=H346 +RIVE_D'ARCANO=H347 +RIVELLO=H348 +RIVERGARO=H350 +RIVIGNANO=H352 +RIVISONDOLI=H353 +RIVODUTRI=H354 +RIVOLI=H355 +RIVOLI_VERONESE=H356 +RIVOLTA_D'ADDA=H357 +RIZZICONI=H359 +RO_FERRARESE=H360 +ROANA=H361 +ROASCHIA=H362 +ROASCIO=H363 +ROASIO=H365 +ROATTO=H366 +ROBASSOMERO=H367 +ROBBIATE=G223 +ROBBIO=H369 +ROBECCHETTO_CON_INDUNO=H371 +ROBECCO_D'OGLIO=H372 +ROBECCO_PAVESE=H375 +ROBECCO_SUL_NAVIGLIO=H373 +ROBELLA=H376 +ROBILANTE=H377 +ROBURENT=H378 +ROCCA_CANAVESE=H386 +ROCCA_CANTERANO=H387 +ROCCA_CIGLIE'=H391 +ROCCA_D'ARAZZO=H392 +ROCCA_D'ARCE=H393 +ROCCA_DE'BALDI=H395 +ROCCA_DE'GIORGI=H396 +ROCCA_D'EVANDRO=H398 +ROCCA_DI_BOTTE=H399 +ROCCA_DI_CAMBIO=H400 +ROCCA_DI_CAVE=H401 +ROCCA_DI_MEZZO=H402 +ROCCA_DI_NETO=H403 +ROCCA_DI_PAPA=H404 +ROCCA_GRIMALDA=H414 +ROCCA_IMPERIALE=H416 +ROCCA_MASSIMA=H421 +ROCCA_PIA=H429 +ROCCA_PIETORE=H379 +ROCCA_PRIORA=H432 +ROCCA_SAN_CASCIANO=H437 +ROCCA_SAN_FELICE=H438 +ROCCA_SAN_GIOVANNI=H439 +ROCCA_SANTA_MARIA=H440 +ROCCA_SANTO_STEFANO=H441 +ROCCA_SINIBALDA=H446 +ROCCA_SUSELLA=H450 +ROCCABASCERANA=H382 +ROCCABERNARDA=H383 +ROCCABIANCA=H384 +ROCCABRUNA=H385 +ROCCACASALE=H389 +ROCCADASPIDE=H394 +ROCCAFIORITA=H405 +ROCCAFLUVIONE=H390 +ROCCAFORTE_DEL_GRECO=H408 +ROCCAFORTE_LIGURE=H406 +ROCCAFORTE_MONDOVI'=H407 +ROCCAFORZATA=H409 +ROCCAFRANCA=H410 +ROCCAGIOVINE=H411 +ROCCAGLORIOSA=H412 +ROCCAGORGA=H413 +ROCCALBEGNA=H417 +ROCCALUMERA=H418 +ROCCAMANDOLFI=H420 +ROCCAMENA=H422 +ROCCAMONFINA=H423 +ROCCAMONTEPIANO=H424 +ROCCAMORICE=H425 +ROCCANOVA=H426 +ROCCANTICA=H427 +ROCCAPALUMBA=H428 +ROCCAPIEMONTE=H431 +ROCCARAINOLA=H433 +ROCCARASO=H434 +ROCCAROMANA=H436 +ROCCASCALEGNA=H442 +ROCCASECCA=H443 +ROCCASECCA_DEI_VOLSCI=H444 +ROCCASICURA=H445 +ROCCASPARVERA=H447 +ROCCASPINALVETI=H448 +ROCCASTRADA=H449 +ROCCAVALDINA=H380 +ROCCAVERANO=H451 +ROCCAVIGNALE=H452 +ROCCAVIONE=H453 +ROCCAVIVARA=H454 +ROCCELLA_IONICA=H456 +ROCCELLA_VALDEMONE=H455 +ROCCHETTA_A_VOLTURNO=H458 +ROCCHETTA_BELBO=H462 +ROCCHETTA_DI_VARA=H461 +ROCCHETTA_E_CROCE=H459 +ROCCHETTA_LIGURE=H465 +ROCCHETTA_NERVINA=H460 +ROCCHETTA_PALAFEA=H466 +ROCCHETTA_SANT'ANTONIO=H467 +ROCCHETTA_TANARO=H468 +RODANO=H470 +RODDI=H472 +RODDINO=H473 +RODELLO=H474 +RODENGO=H475 +RODENGO_SAIANO=H477 +RODERO=H478 +RODI_GARGANICO=H480 +RODI'_MILICI=H479 +RODIGO=H481 +ROE'_VOLCIANO=H484 +ROFRANO=H485 +ROGENO=H486 +ROGGIANO_GRAVINA=H488 +ROGHUDI=H489 +ROGLIANO=H490 +ROGNANO=H491 +ROGNO=H492 +ROGOLO=H493 +ROIATE=H494 +ROIO_DEL_SANGRO=H495 +ROISAN=H497 +ROLETTO=H498 +ROLO=H500 +ROMA=H501 +ROMAGNANO_AL_MONTE=H503 +ROMAGNANO_SESIA=H502 +ROMAGNESE=H505 +ROMALLO=H506 +ROMANA=H507 +ROMANENGO=H508 +ROMANIA=Z129 +ROMANO_CANAVESE=H511 +ROMANO_D'EZZELINO=H512 +ROMANO_DI_LOMBARDIA=H509 +ROMANS_D'ISONZO=H514 +ROMBIOLO=H516 +ROMENO=H517 +ROMENTINO=H518 +ROMETTA=H519 +RONAGO=H521 +RONCA'=H522 +RONCADE=H523 +RONCADELLE=H525 +RONCARO=H527 +RONCEGNO=H528 +RONCELLO=H529 +RONCHI_DEI_LEGIONARI=H531 +RONCHI_VALSUGANA=H532 +RONCHIS=H533 +RONCIGLIONE=H534 +RONCO_ALL'ADIGE=H540 +RONCO_BIELLESE=H538 +RONCO_BRIANTINO=H537 +RONCO_CANAVESE=H539 +RONCO_SCRIVIA=H536 +RONCOBELLO=H535 +RONCOFERRARO=H541 +RONCOFREDDO=H542 +RONCOLA=H544 +RONCONE=H545 +RONDANINA=H546 +RONDISSONE=H547 +RONSECCO=H549 +RONZO_CHIENIS=H551 +RONZONE=H552 +ROPPOLO=H553 +RORA'=H554 +RORETO_CHISONE=H555 +ROSA'=H556 +ROSARNO=H558 +ROSASCO=H559 +ROSATE=H560 +ROSAZZA=H561 +ROSCIANO=H562 +ROSCIGNO=H564 +ROSE=H565 +ROSELLO=H566 +ROSETO_DEGLI_ABRUZZI=F585 +ROSETO_VALFORTORE=H568 +ROSIGNANO_MARITTIMO=H570 +ROSIGNANO_MONFERRATO=H569 +ROSITO_CAPO_SPULICO=H572 +ROSOLINA=H573 +ROSOLINI=H574 +ROSORA=H575 +ROSSA=H577 +ROSSANA=H578 +ROSSANO=H579 +ROSSANO_VENETO=H580 +ROSSIGLIONE=H581 +ROSTA=H583 +ROTA_D'IMAGNA=H584 +ROTA_GRECA=H585 +ROTELLA=H588 +ROTELLO=H589 +ROTONDA=H590 +ROTONDELLA=H591 +ROTONDI=H592 +ROTTOFRENO=H593 +ROTZO=H594 +ROVAGNATE=H596 +ROVASENDA=H364 +ROVATO=H598 +ROVEGNO=H599 +ROVELLASCA=H601 +ROVELLO_PORRO=H602 +ROVERBELLA=H604 +ROVERCHIARA=H606 +ROVERE'_DELLA_LUNA=H607 +ROVERE'_VERONESE=H608 +ROVEREDO_DI_GUA'=H610 +ROVEREDO_IN_PIANO=H609 +ROVERETO=H612 +ROVESCALA=H614 +ROVETTA=H615 +ROVIANO=H618 +ROVIGO=H620 +ROVITO=H621 +ROVOLON=H622 +ROZZANO=H623 +RUANDA=Z338 +RUBANO=H625 +RUBIANA=H626 +RUBIERA=H627 +RUDA=H629 +RUDIANO=H630 +RUEGLIO=H631 +RUFFANO=H632 +RUFFIA=H633 +RUFFRE'=H634 +RUFINA=H635 +RUINAS=F271 +RUINO=H637 +RUMO=H639 +RUOTI=H641 +RUSSI=H642 +RUTIGLIANO=H643 +RUTINO=H644 +RUVIANO=H165 +RUVO_DEL_MONTE=H646 +RUVO_DI_PUGLIA=H645 +SABAUDIA=H647 +SABBIA=H648 +SABBIO_CHIESE=H650 +SABBIONETA=H652 +SACCO=H654 +SACCOLONGO=H655 +SACILE=H657 +SACROFANO=H658 +SADALI=H659 +SAGAMA=H661 +SAGLIANO_MICCA=H662 +SAGRADO=H665 +SAGRON_MIS=H666 +SAHARA_SPAGNOLO=Z339 +SAINT_CHRISTOPHE=H669 +SAINT_DENIS=H670 +SAINT_MARCEL=H671 +SAINT_NICOLAS=H672 +SAINT_OYEN=H673 +SAINT_PIERRE=H674 +SAINT_PIERRE=Z403 +SAINT_RHEMY=H675 +SAINT_VINCENT=H676 +SALA_BAGANZA=H682 +SALA_BIELLESE=H681 +SALA_BOLOGNESE=H678 +SALA_COMACINA=H679 +SALA_CONSILINA=H683 +SALA_MONFERRATO=H677 +SALANDRA=H687 +SALAPARUTA=H688 +SALARA=H689 +SALASCO=H690 +SALASSA=H691 +SALBERTRAND=H684 +SALCEDO=F810 +SALCITO=H693 +SALE=H694 +SALE_DELLE_LANGHE=H695 +SALE_MARASINO=H699 +SALE_SAN_GIOVANNI=H704 +SALEMI=H700 +SALENTO=H686 +SALERANO_CANAVESE=H702 +SALERANO_SUL_LAMBRO=H701 +SALERNO=H703 +SALETTO=H705 +SALGAREDA=H706 +SALI_VERCELLESE=H707 +SALICE_SALENTINO=H708 +SALICETO=H710 +SALISANO=H713 +SALIZZOLE=H714 +SALLE_NUOVA=H715 +SALMOUR=H716 +SALO'=H717 +SALORNO=H719 +SALSOMAGGIORE_TERME=H720 +SALTARA=H721 +SALTRIO=H723 +SALUDECIO=H724 +SALUGGIA=H725 +SALUSSOLA=H726 +SALUZZO=H727 +SALVE=H729 +SALVIROLA=H731 +SALVITELLE=H732 +SALZA_DI_PINEROLO=H734 +SALZA_IRPINA=H733 +SALZANO=H735 +SAM_MICHELE_SALENTIN=I045 +SAMARATE=H736 +SAMASSI=H738 +SAMATZAI=H739 +SAMBUCA_DI_SICILIA=H743 +SAMBUCA_PISTOIESE=H744 +SAMBUCI=H745 +SAMBUCO=H746 +SAMMICHELE_DI_BARI=H749 +SAMO=H013 +SAMOA_AMERICANE=Z725 +SAMOA_OCCIDENTALI=Z726 +SAMOLACO=H752 +SAMONE=H753 +SAMONE=H754 +SAMPEYRE=H755 +SAMUGHEO=H756 +SAN_BARTOLOMEO_AL_MARE=H763 +SAN_BARTOLOMEO_IN_GALDO=H764 +SAN_BARTOLOMEO_VAL_CAVARGNA=H760 +SAN_BASILE=H765 +SAN_BASILIO=H766 +SAN_BASSANO=H767 +SAN_BELLINO=H768 +SAN_BENEDETTO_BELBO=H770 +SAN_BENEDETTO_DEI_MARSI=H772 +SAN_BENEDETTO_DEL_TRONTO=H769 +SAN_BENEDETTO_IN_PERILLIS=H773 +SAN_BENEDETTO_PO=H771 +SAN_BENEDETTO_ULLANO=H774 +SAN_BENEDETTO_VAL_DI_SAMBRO=G566 +SAN_BENIGNO_CANAVESE=H775 +SAN_BERNARDINO_VERBANO=H777 +SAN_BIAGIO_DELLA_CIMA=H780 +SAN_BIAGIO_DI_CALLALTA=H781 +SAN_BIAGIO_PLATANI=H778 +SAN_BIAGIO_SARACINISCO=H779 +SAN_BIASE=H782 +SAN_BONIFACIO=H783 +SAN_BUONO=H784 +SAN_CALOGERO=H785 +SAN_CANDIDO=H786 +SAN_CANZIAN_D'ISONZO=H787 +SAN_CARLO_CANAVESE=H789 +SAN_CASCIANO_DEI_BAGNI=H790 +SAN_CASCIANO_IN_VAL_DI_PESA=H791 +SAN_CASSIANO=H000 +SAN_CATALDO=H792 +SAN_CESARIO_DI_LECCE=H793 +SAN_CESARIO_SUL_PANARO=H794 +SAN_CHIRICO_NUOVO=H795 +SAN_CHIRICO_RAPARO=H796 +SAN_CIPIRELLO=H797 +SAN_CIPRIANO_D'AVERSA=H798 +SAN_CIPRIANO_PICENTINO=H800 +SAN_CIPRIANO_PO=H799 +SAN_CLEMENTE=H801 +SAN_COLOMBANO_AL_LAMBRO=H803 +SAN_COLOMBANO_BELMONTE=H804 +SAN_COLOMBANO_CERTENOLI=H802 +SAN_CONO=H805 +SAN_COSMO_ALBANESE=H806 +SAN_COSTANTINO_ALBANESE=H808 +SAN_COSTANTINO_CALABRO=H807 +SAN_COSTANZO=H809 +SAN_CRISTOFORO=H810 +SAN_DAMIANO_AL_COLLE=H814 +SAN_DAMIANO_D'ASTI=H811 +SAN_DAMIANO_MACRA=H812 +SAN_DANIELE_DEL_FRIULI=H816 +SAN_DANIELE_PO=H815 +SAN_DEMETRIO_CORONE=H818 +SAN_DEMETRIO_NE'VESTINI=H819 +SAN_DIDERO=H820 +SAN_DONA'_DI_PIAVE=H823 +SAN_DONACI=H822 +SAN_DONATO_DI_LECCE=H826 +SAN_DONATO_DI_NINEA=H825 +SAN_DONATO_MILANESE=H827 +SAN_DONATO_VAL_DI_COMINO=H824 +SAN_DORLIGO_DELLA_VALLE=D324 +SAN_FEDELE_INTELVI=H830 +SAN_FELE=H831 +SAN_FELICE_A_CANCELLO=H834 +SAN_FELICE_CIRCEO=H836 +SAN_FELICE_DEL_BENACO=H838 +SAN_FELICE_DEL_MOLISE=H833 +SAN_FELICE_SUL_PANARO=H835 +SAN_FERDINANDO_DI_PUGLIA=H839 +SAN_FERMO_DELLA_BATTAGLIA=H840 +SAN_FILI=H841 +SAN_FILIPPO_DEL_MELA=H842 +SAN_FIOR=H843 +SAN_FIORANO=H844 +SAN_FLORIANO_DEL_COLLIO=H845 +SAN_FLORO=H846 +SAN_FRANCESCO_AL_CAMPO=H847 +SAN_FRATELLO=H850 +SAN_GAVINO_MONREALE=H856 +SAN_GEMINI=H857 +SAN_GENESIO_ATESINO=H858 +SAN_GENESIO_ED_UNITI=H859 +SAN_GENNARO_VESUVIANO=H860 +SAN_GERMANO_CHISONE=H862 +SAN_GERMANO_DEI_BERICI=H863 +SAN_GERMANO_VERCELLESE=H861 +SAN_GERVASIO_BRESCIANO=H865 +SAN_GIACOMO_DEGLI_SCHIAVONI=H867 +SAN_GIACOMO_DELLE_SEGNATE=H870 +SAN_GIACOMO_FILIPPO=H868 +SAN_GIACOMO_VERCELLESE=B952 +SAN_GILLIO=H873 +SAN_GIMIGNANO=H875 +SAN_GINESIO=H876 +SAN_GIORGIO_A_CREMANO=H892 +SAN_GIORGIO_A_LIRI=H880 +SAN_GIORGIO_ALBANESE=H881 +SAN_GIORGIO_CANAVESE=H890 +SAN_GIORGIO_DEL_SANNIO=H894 +SAN_GIORGIO_DELLA_RICHINVELDA=H891 +SAN_GIORGIO_DELLE_PERTICHE=H893 +SAN_GIORGIO_DI_LOMELLINA=H885 +SAN_GIORGIO_DI_MANTOVA=H883 +SAN_GIORGIO_DI_NOGARO=H895 +SAN_GIORGIO_DI_PESARO=H886 +SAN_GIORGIO_DI_PIANO=H896 +SAN_GIORGIO_DI_SUSA=H900 +SAN_GIORGIO_IN_BOSCO=H897 +SAN_GIORGIO_IONICO=H882 +SAN_GIORGIO_LA_MOLARA=H898 +SAN_GIORGIO_LUCANO=H888 +SAN_GIORGIO_MONFERRATO=H878 +SAN_GIORGIO_MORGETO=H889 +SAN_GIORGIO_PIACENTINO=H887 +SAN_GIORGIO_SCARAMPI=H899 +SAN_GIORGIO_SU_LEGNANO=H884 +SAN_GIOVANNI_A_PIRO=H907 +SAN_GIOVANNI_AL_NATISONE=H906 +SAN_GIOVANNI_BIANCO=H910 +SAN_GIOVANNI_D'ASSO=H911 +SAN_GIOVANNI_DEL_DOSSO=H912 +SAN_GIOVANNI_DI_GERACE=H903 +SAN_GIOVANNI_GEMINI=H914 +SAN_GIOVANNI_ILARIONE=H916 +SAN_GIOVANNI_IN_CROCE=H918 +SAN_GIOVANNI_IN_FIORE=H919 +SAN_GIOVANNI_IN_GALDO=H920 +SAN_GIOVANNI_IN_MARIGNANO=H921 +SAN_GIOVANNI_IN_PERSICETO=G467 +SAN_GIOVANNI_INCARICO=H917 +SAN_GIOVANNI_LA_PUNTA=H922 +SAN_GIOVANNI_LIPIONI=H923 +SAN_GIOVANNI_LUPATOTO=H924 +SAN_GIOVANNI_ROTONDO=H926 +SAN_GIOVANNI_SUERGIU=G287 +SAN_GIOVANNI_TEATINO=D690 +SAN_GIOVANNI_VALDARNO=H901 +SAN_GIULIANO_DEL_SANNIO=H928 +SAN_GIULIANO_DI_PUGLIA=H929 +SAN_GIULIANO_MILANESE=H930 +SAN_GIULIANO_TERME=A562 +SAN_GIUSEPPE_JATO=H933 +SAN_GIUSEPPE_VESUVIANO=H931 +SAN_GIUSTINO=H935 +SAN_GIUSTO_CANAVESE=H936 +SAN_GODENZO=H937 +SAN_GREGORIO_DA_SASSOLA=H942 +SAN_GREGORIO_DI_CATANIA=H940 +SAN_GREGORIO_D'IPPONA=H941 +SAN_GREGORIO_MAGNO=H943 +SAN_GREGORIO_MATESE=H939 +SAN_GREGORIO_NELLE_ALPI=H938 +SAN_LAZZARO_DI_SAVENA=H945 +SAN_LEO=H949 +SAN_LEONARDO=H951 +SAN_LEONARDO_IN_PASSIRIA=H952 +SAN_LEUCIO_DEL_SANNIO=H953 +SAN_LORENZELLO=H955 +SAN_LORENZO=H959 +SAN_LORENZO_AL_MARE=H957 +SAN_LORENZO_BELLIZZI=H961 +SAN_LORENZO_DEL_VALLO=H962 +SAN_LORENZO_DI_SEBATO=H956 +SAN_LORENZO_IN_BANALE=H966 +SAN_LORENZO_IN_CAMPO=H958 +SAN_LORENZO_ISONTINO=H964 +SAN_LORENZO_MAGGIORE=H967 +SAN_LORENZO_NUOVO=H969 +SAN_LUCA=H970 +SAN_LUCIDO=H971 +SAN_LUPO=H973 +SAN_MANGO_D'AQUINO=H976 +SAN_MANGO_PIEMONTE=H977 +SAN_MANGO_SUL_CALORE=H975 +SAN_MARCELLINO=H978 +SAN_MARCELLO=H979 +SAN_MARCELLO_PISTOIESE=H980 +SAN_MARCO_ARGENTANO=H981 +SAN_MARCO_D'ALUNZIO=H982 +SAN_MARCO_DEI_CAVOTI=H984 +SAN_MARCO_EVANGELISTA=F043 +SAN_MARCO_IN_LAMIS=H985 +SAN_MARCO_LA_CATOLA=H986 +SAN_MARINO=Z130 +SAN_MARTINO_AL_TAGLIAMENTO=H999 +SAN_MARTINO_ALFIERI=H987 +SAN_MARTINO_BUON_ALBERGO=I003 +SAN_MARTINO_CANAVESE=H997 +SAN_MARTINO_D'AGRI=H994 +SAN_MARTINO_DALL'ARGINE=I005 +SAN_MARTINO_DEL_LAGO=I007 +SAN_MARTINO_DI_FINITA=H992 +SAN_MARTINO_DI_LUPARI=I008 +SAN_MARTINO_DI_VENEZZE=H996 +SAN_MARTINO_IN_BADIA=H998 +SAN_MARTINO_IN_PASSIRIA=H989 +SAN_MARTINO_IN_PENSILIS=H990 +SAN_MARTINO_IN_RIO=I011 +SAN_MARTINO_IN_STRADA=I012 +SAN_MARTINO_SANNITA=I002 +SAN_MARTINO_SICCOMARIO=I014 +SAN_MARTINO_SULLA_MARRUCCINA=H991 +SAN_MARTINO_VALLE_CAUDINA=I016 +SAN_MARZANO_DI_SAN_GIUSEPPE=I018 +SAN_MARZANO_OLIVETO=I017 +SAN_MARZANO_SUL_SARNO=I019 +SAN_MASSIMO=I023 +SAN_MAURIZIO_CANAVESE=I024 +SAN_MAURIZIO_D'OPAGLIO=I025 +SAN_MAURO_CASTELVERDE=I028 +SAN_MAURO_CILENTO=I031 +SAN_MAURO_DI_SALINE=H712 +SAN_MAURO_FORTE=I029 +SAN_MAURO_LA_BRUCA=I032 +SAN_MAURO_MARCHESATO=I026 +SAN_MAURO_PASCOLI=I027 +SAN_MAURO_TORINESE=I030 +SAN_MICHELE_AL_TAGLIAMENTO=I040 +SAN_MICHELE_ALL'ADIGE=I041 +SAN_MICHELE_DI_GANZARIA=I035 +SAN_MICHELE_DI_SERINO=I034 +SAN_MICHELE_MONDOVI'=I037 +SAN_MINIATO=I046 +SAN_NAZARIO=I047 +SAN_NAZZARO=I049 +SAN_NAZZARO_SESIA=I052 +SAN_NAZZARO_VAL_CAVARGNA=I051 +SAN_NICOLA_ARCELLA=I060 +SAN_NICOLA_BARONIA=I061 +SAN_NICOLA_DA_CRISSA=I058 +SAN_NICOLA_DELL'ALTO=I057 +SAN_NICOLA_LA_STRADA=I056 +SAN_NICOLA_MANFREDI=I062 +SAN_NICOLO'_D'ARCIDANO=A368 +SAN_NICOLO'_DI_COMELICO=I063 +SAN_NICOLO'_GERREI=G383 +SAN_PANCRAZIO=I065 +SAN_PANCRAZIO_SALENTINO=I066 +SAN_PAOLO=G407 +SAN_PAOLO_ALBANESE=B906 +SAN_PAOLO_BEL_SITO=I073 +SAN_PAOLO_CERVO=I074 +SAN_PAOLO_D'ARGON=B310 +SAN_PAOLO_DI_CIVITATE=I072 +SAN_PAOLO_DI_JESI=I071 +SAN_PAOLO_SOLBRITO=I076 +SAN_PELLEGRINO_TERME=I079 +SAN_PIER_D'ISONZO=I082 +SAN_PIER_NICETO=I084 +SAN_PIERO_A_SIEVE=I085 +SAN_PIERO_PATTI=I086 +SAN_PIETRO_A_MAIDA=I093 +SAN_PIETRO_AL_NATISONE=I092 +SAN_PIETRO_AL_TANAGRO=I089 +SAN_PIETRO_APOSTOLO=I095 +SAN_PIETRO_AVELLANA=I096 +SAN_PIETRO_CLARENZA=I098 +SAN_PIETRO_DI_CADORE=I088 +SAN_PIETRO_DI_CARIDA'=I102 +SAN_PIETRO_DI_FELETTO=I103 +SAN_PIETRO_DI_MORUBIO=I105 +SAN_PIETRO_IN_AMANTEA=I108 +SAN_PIETRO_IN_CARIANO=I109 +SAN_PIETRO_IN_CASALE=I110 +SAN_PIETRO_IN_CERRO=G788 +SAN_PIETRO_IN_GU'=I107 +SAN_PIETRO_IN_GUARANO=I114 +SAN_PIETRO_IN_LAMA=I115 +SAN_PIETRO_INFINE=I113 +SAN_PIETRO_MOSEZZO=I116 +SAN_PIETRO_MUSSOLINO=I117 +SAN_PIETRO_VAL_LEMINA=I090 +SAN_PIETRO_VERNOTICO=I119 +SAN_PIETRO_VIMINARIO=I120 +SAN_PIO_DELLE_CAMERE=I121 +SAN_POLO_DEI_CAVALIERI=I125 +SAN_POLO_D'ENZA=I123 +SAN_POLO_DI_PIAVE=I124 +SAN_POLOMATESE=I122 +SAN_PONSO=I127 +SAN_POSSIDONIO=I128 +SAN_POTITO_SANNITICO=I130 +SAN_POTITO_ULTRA=I129 +SAN_PRISCO=I131 +SAN_PROCOPIO=I132 +SAN_PROSPERO_SULLA_SECCHIA=I133 +SAN_QUIRICO_D'ORCIA=I135 +SAN_QUIRINO=I136 +SAN_RAFFAELE_CIMENA=I137 +SAN_REMO=I138 +SAN_ROBERTO=I139 +SAN_ROCCO_AL_PORTO=I140 +SAN_ROMANO_IN_GARFAGNANA=I142 +SAN_RUFO=I143 +SAN_SALVATORE_DI_FITALIA=I147 +SAN_SALVATORE_MONFERRATO=I144 +SAN_SALVATORE_TELESINO=I145 +SAN_SALVO=I148 +SAN_SEBASTIANO_AL_VESUVIO=I151 +SAN_SEBASTIANO_CURONE=I150 +SAN_SEBASTIANO_DA_PO=I152 +SAN_SECONDO_DI_PINEROLO=I154 +SAN_SECONDO_PARMENSE=I153 +SAN_SEVERINO_LUCANO=I157 +SAN_SEVERINO_MARCHE=I156 +SAN_SEVERO=I158 +SAN_SOSSIO_BARONIA=I163 +SAN_SOSTENE=I164 +SAN_SOSTI=I165 +SAN_SPERATE=I166 +SAN_TAMMARO=I261 +SAN_TEODORO=I328 +SAN_TEODORO=I329 +SAN_TOMASO_AGORDINO=I347 +SAN_VALENTINO_IN_ABRUZZO_CITERIORE=I376 +SAN_VALENTINO_TORIO=I377 +SAN_VENANZO=I381 +SAN_VENDEMIANO=I382 +SAN_VERO_MILIS=I384 +SAN_VINCENZO=I390 +SAN_VINCENZO_LA_COSTA=I388 +SAN_VINCENZO_VALLE_ROVETO=I389 +SAN_VITALIANO=I391 +SAN_VITO=I402 +SAN_VITO_AL_TAGLIAMENTO=I403 +SAN_VITO_AL_TORRE=I404 +SAN_VITO_CHIETINO=I394 +SAN_VITO_DEI_NORMANNI=I396 +SAN_VITO_DI_CADORE=I392 +SAN_VITO_DI_FAGAGNA=I405 +SAN_VITO_DI_LEGUZZANO=I401 +SAN_VITO_LO_CAPO=I407 +SAN_VITO_ROMANO=I400 +SAN_VITO_SULLO_IONIO=I393 +SAN_VITTORE_DEL_LAZIO=I408 +SAN_VITTORE_OLONA=I409 +SAN_ZENO_DI_MONTAGNA=I414 +SAN_ZENO_NAVIGLIO=I412 +SAN_ZENONE_AL_LAMBRO=I415 +SAN_ZENONE_AL_PO=I416 +SAN_ZENONE_DEGLI_EZZELINI=I417 +SANARICA=H757 +SANDIGLIANO=H821 +SANDRIGO=H829 +SANFRE'=H851 +SANFRONT=H852 +SANGANO=H855 +SANGIANO=H872 +SANGINETO=H877 +SANGUINETTO=H944 +SANLURI=H974 +SANNAZZARO_DE'BURGONDI=I048 +SANNICANDRO_DI_BARI=I053 +SANNICANDRO_GARGANICO=I054 +SANNICOLA=I059 +SANSEPOLCRO=I155 +SANTA_BRIGIDA=I168 +SANTA_CATERINA_ALBANESE=I171 +SANTA_CATERINA_DELLO_IONIO=I170 +SANTA_CATERINA_VILLARMOSA=I169 +SANTA_CESAREA_TERME=I172 +SANTA_CRISTINA_D'ASPROMONTE=I176 +SANTA_CRISTINA_E_BISSONE=I175 +SANTA_CRISTINA_GELA=I174 +SANTA_CRISTINA_VALGARDENA=I173 +SANTA_CROCE_CAMERINA=I178 +SANTA_CROCE_DEL_SANNIO=I179 +SANTA_CROCE_DI_MAGLIANO=I181 +SANTA_CROCE_SULL'ARNO=I177 +SANTA_DOMENICA_TALAO=I183 +SANTA_DOMENICA_VITTORIA=I184 +SANTA_ELISABETTA=I185 +SANTA_FIORA=I187 +SANTA_FLAVIA=I188 +SANTA_GIULIETTA=I203 +SANTA_GIUSTA=I205 +SANTA_GIUSTINA=I206 +SANTA_GIUSTINA_IN_COLLE=I207 +SANTA_LUCE=I217 +SANTA_LUCIA_DEL_MELA=I220 +SANTA_LUCIA_DI_PIAVE=I221 +SANTA_LUCIA_DI_SERINO=I219 +SANTA_MARGHERITA_D'ADIGE=I226 +SANTA_MARGHERITA_DI_BELICE=I224 +SANTA_MARGHERITA_DI_STAFFORA=I230 +SANTA_MARGHERITA_LIGURE=I225 +SANTA_MARIA_A_MONTE=I232 +SANTA_MARIA_A_VICO=I233 +SANTA_MARIA_CAPUA_VETERE=I234 +SANTA_MARIA_DEL_CEDRO=C717 +SANTA_MARIA_DEL_MOLISE=I238 +SANTA_MARIA_DELLA_VERSA=I237 +SANTA_MARIA_DI_LICODIA=I240 +SANTA_MARIA_DI_SALA=I242 +SANTA_MARIA_HOE'=I243 +SANTA_MARIA_IMBARO=I244 +SANTA_MARIA_LA_FOSSA=I247 +SANTA_MARIA_LA_LONGA=I248 +SANTA_MARIA_MAGGIORE=I249 +SANTA_MARIA_NUOVA=I251 +SANTA_MARIA_REZZONICO=I252 +SANTA_MARINA=I253 +SANTA_MARINA_SALINA=I254 +SANTA_MARINELLA=I255 +SANTA_NINFA=I291 +SANTA_PAOLINA=I301 +SANTA_SEVERINA=I308 +SANTA_SOFIA=I310 +SANTA_SOFIA_D'EPIRO=I309 +SANTA_TERESA_DI_GALLURA=I312 +SANTA_TERESA_DI_RIVA=I311 +SANTA_VENERINA=I314 +SANTA_VITTORIA_D'ALBA=I316 +SANTA_VITTORIA_IN_MATENANO=I315 +SANT'ABBONDIO=I167 +SANTADI=I182 +SANT'AGAPITO=I189 +SANT'AGATA_BOLOGNESE=I191 +SANT'AGATA_DE'GOTI=I197 +SANT'AGATA_DEL_BIANCO=I198 +SANT'AGATA_DI_ESARO=I192 +SANT'AGATA_DI_MILITELLO=I199 +SANT'AGATA_DI_PUGLIA=I193 +SANT'AGATA_FELTRIA=I201 +SANT'AGATA_FOSSILI=I190 +SANT'AGATA_LI_BATTIATI=I202 +SANT'AGATA_SUL_SANTERNO=I196 +SANT'AGNELLO=I208 +SANT'AGOSTINO=I209 +SANT'ALBANO_STURA=I210 +SANT'ALESSIO_CON_VIALONE=I213 +SANT'ALESSIO_IN_ASPROMONTE=I214 +SANT'ALESSIO_SICULO=I215 +SANT'ALFIO=I216 +SANT'AMBROGIO_DI_TORINO=I258 +SANT'AMBROGIO_DI_VALPOLICELLA=I259 +SANT'AMBROGIO_SUL_GARIGLIANO=I256 +SANT'ANASTASIA=I262 +SANT'ANATOLIA_DI_NARCO=I263 +SANT'ANDREA_APOSTOLO_DELLO_IONIO=I266 +SANT'ANDREA_DEL_GARIGLIANO=I265 +SANT'ANDREA_DI_CONZA=I264 +SANT'ANDREA_FRIUS=I271 +SANT'ANGELO_A_CUPOLO=I277 +SANT'ANGELO_A_FASANELLA=I278 +SANT'ANGELO_A_SCALA=I280 +SANT'ANGELO_ALL'ESCA=I279 +SANT'ANGELO_D'ALIFE=I273 +SANT'ANGELO_DEI_LOMBARDI=I281 +SANT'ANGELO_DEL_PESCO=I282 +SANT'ANGELO_DI_BROLO=I283 +SANT'ANGELO_DI_PIOVE=I275 +SANT'ANGELO_IN_LIZZOLA=I285 +SANT'ANGELO_IN_PONTANO=I286 +SANT'ANGELO_IN_VADO=I287 +SANT'ANGELO_LE_FRATTE=I288 +SANT'ANGELO_LIMOSANO=I289 +SANT'ANGELO_LODIGIANO=I274 +SANT'ANGELO_LOMELLINA=I276 +SANT'ANGELO_MUXARO=I290 +SANT'ANGELO_ROMANO=I284 +SANT'ANNA_ARRESI=M209 +SANT'ANNA_D'ALFAEDO=I292 +SANT'ANTIMO=I293 +SANT'ANTIOCO=I294 +SANT'ANTONINO_DI_SUSA=I296 +SANT'ANTONIO_ABATE=I300 +SANT'ANTONIO_RUINAS=I298 +SANT'APOLLINARE=I302 +SANT'ARCANGELO=I305 +SANTARCANGELO_DI_ROMAGNA=I304 +SANT'ARCANGELO_TRIMONTE=F557 +SANT'ARPINO=I306 +SANT'ARSENIO=I307 +SANTE_MARIE=I326 +SANT'EGIDIO_ALLA_VIBRATA=I318 +SANT'EGIDIO_DEL_MONTE_ALBINO=I317 +SANT'ELENA=I319 +SANT'ELENA=Z340 +SANT'ELENA_SANNITA=B466 +SANT'ELIA_A_PIANISI=I320 +SANT'ELIA_FIUMERAPIDO=I321 +SANT'ELPIDIO_A_MARE=I324 +SANTENA=I327 +SANTERAMO_IN_COLLE=I330 +SANT'EUFEMIA_A_MAIELLA=I332 +SANT'EUFEMIA_D'ASPROMONTE=I333 +SANT'EUSANIO_DEL_SANGRO=I335 +SANT'EUSANIO_FORCONESE=I336 +SANTHIA'=I337 +SANTI_COSMA_E_DAMIANO=I339 +SANT'ILARIO_DELLO_IONIO=I341 +SANT'ILARIO_D'ENZA=I342 +SANT'IPPOLITO=I344 +SANTO_STEFANO_AL_MARE=I365 +SANTO_STEFANO_BELBO=I367 +SANTO_STEFANO_D'AVETO=I368 +SANTO_STEFANO_DEL_SOLE=I357 +SANTO_STEFANO_DI_CADORE=C919 +SANTO_STEFANO_DI_CAMASTRA=I370 +SANTO_STEFANO_DI_MAGRA=I363 +SANTO_STEFANO_DI_ROGLIANO=I359 +SANTO_STEFANO_DI_SESSANIO=I360 +SANTO_STEFANO_IN_ASPROMONTE=I371 +SANTO_STEFANO_LODIGIANO=I362 +SANTO_STEFANO_QUISQUINA=I356 +SANTO_STEFANO_ROERO=I372 +SANTO_STEFANO_TICINO=I361 +SANTO_STINO_DI_LIVENZA=I373 +SANT'OLCESE=I346 +SANTOMENNA=I260 +SANT'OMERO=I348 +SANT'OMOBONO_IMAGNA=I349 +SANT'ONOFRIO=I350 +SANTOPADRE=I351 +SANT'ORESTE=I352 +SANTORSO=I353 +SANT'ORSOLA=I354 +SANTU_LUSSURGIU=I374 +SANT'URBANO=I375 +SANZA=I410 +SANZENO=I411 +SAO_TOME`=Z341 +SAONARA=I418 +SAPONARA=I420 +SAPPADA=I421 +SAPRI=I422 +SARACENA=I423 +SARACINESCO=I424 +SARCEDO=I425 +SARCONI=I426 +SARDARA=I428 +SARDIGLIANO=I429 +SAREGO=I430 +SARENTINO=I431 +SAREZZANO=I432 +SAREZZO=I433 +SARMATO=I434 +SARMEDE=I435 +SARNANO=I436 +SARNICO=I437 +SARNO=I438 +SARNONICO=I439 +SARONNO=I441 +SARRE=I442 +SARROCH=I443 +SARSINA=I444 +SARTEANO=I445 +SARTIRANA_LOMELLINA=I447 +SARULE=I448 +SARZANA=I449 +SASSANO=I451 +SASSARI=I452 +SASSELLO=I453 +SASSETTA=I454 +SASSINORO=I455 +SASSO_DI_CASTALDA=I457 +SASSO_MARCONI=G972 +SASSOCORVARO=I459 +SASSOFELTRIO=I460 +SASSOFERRATO=I461 +SASSUOLO=I462 +SATRIANO=I463 +SATRIANO_DI_LUCANIA=G614 +SAURIS=I464 +SAUZE_DI_CESANA=I465 +SAUZE_D'OULX=I466 +SAVA=I467 +SAVELLI=I468 +SAVIANO=I469 +SAVIGLIANO=I470 +SAVIGNANO_IRPINO=I471 +SAVIGNANO_SUL_PANARO=I473 +SAVIGNANO_SUL_RUBICONE=I472 +SAVIGNO=I474 +SAVIGNONE=I475 +SAVIORE_DELL'ADAMELLO=I476 +SAVOCA=I477 +SAVOGNA=I478 +SAVOGNA_D'ISONZO=I479 +SAVOIA_DI_LUCANIA=H730 +SAVONA=I480 +SCAFA=I482 +SCAFATI=I483 +SCAGNELLO=I484 +SCALA=I486 +SCALA_COELI=I485 +SCALDASOLE=I487 +SCALEA=I489 +SCALENGHE=I490 +SCALETTA_ZANCLEA=I492 +SCAMPITELLA=I493 +SCANDALE=I494 +SCANDELUZZA=I495 +SCANDIANO=I496 +SCANDICCI=B962 +SCANDOLARA_RAVARA=I497 +SCANDOLARA_RIPA_D'OGLIO=I498 +SCANDRIGLIA=I499 +SCANNO=I501 +SCANO_DI_MONTIFERRO=I503 +SCANSANO=I504 +SCANZANO_IONICO=I000 +SCANZOROSCIATE=I506 +SCAPOLI=I507 +SCARLINO=I510 +SCARMAGNO=I511 +SCARNAFIGI=I512 +SCARPERIA=I514 +SCENA=I519 +SCERNI=I520 +SCHEGGIA_E_PASCELUPO=I522 +SCHEGGINO=I523 +SCHIAVI_DI_ABRUZZO=I526 +SCHIAVON=I527 +SCHIGNANO=I529 +SCHILPARIO=I530 +SCHIO=I531 +SCHIVENOGLIA=I532 +SCIACCA=I533 +SCIARA=I534 +SCICLI=I535 +SCIDO=I536 +SCIGLIANO=D290 +SCILLA=I537 +SCILLATO=I538 +SCIOLZE=I539 +SCISCIANO=I540 +SCLAFANI_BAGNI=I541 +SCONTRONE=I543 +SCOPA=I544 +SCOPELLO=I545 +SCOPPITO=I546 +SCORDIA=I548 +SCORRANO=I549 +SCORZE'=I551 +SCURCOLA_MARSICANA=I553 +SCURELLE=I554 +SCURZOLENGO=I555 +SEBORGA=I556 +SECINARO=I558 +SECLI=I559 +SECUGNAGO=I561 +SEDEGLIANO=I562 +SEDICO=I563 +SEDILO=I564 +SEDINI=I565 +SEDRIANO=I566 +SEDRINA=I567 +SEFRO=I569 +SEGARIU=I570 +SEGGIANO=I571 +SEGNI=I573 +SEGONZANO=I576 +SEGRATE=I577 +SEGUSINO=I578 +SELARGIUS=I580 +SELCI=I581 +SELEGAS=I582 +SELLANO=I585 +SELLERO=I588 +SELLIA=I589 +SELLIA_MARINA=I590 +SELVA_DEI_MOLINI=I593 +SELVA_DI_CADORE=I592 +SELVA_DI_PROGNO=I594 +SELVA_DI_VAL_GARDENA=I591 +SELVAZZANO_DENTRO=I595 +SELVE_MARCONE=I596 +SELVINO=I597 +SEMESTENE=I598 +SEMIANA=I599 +SEMINARA=I600 +SEMPRONIANO=I601 +SENAGO=I602 +SENALE_SAN_FELICE=I603 +SENALES=I604 +SENEGAL=Z343 +SENEGHE=I605 +SENERCHIA=I606 +SENIGA=I607 +SENIGALLIA=I608 +SENIS=I609 +SENISE=I610 +SENNA_COMASCO=I611 +SENNA_LODIGIANA=I612 +SENNARIOLO=I613 +SENNORI=I614 +SENORBI=I615 +SEPINO=I618 +SEPPIANA=I619 +SEQUALS=I621 +SERAVEZZA=I622 +SERDIANA=I624 +SEREGNO=I625 +SEREN_DEL_GRAPPA=I626 +SERGNANO=I627 +SERIATE=I628 +SERINA=I629 +SERINO=I630 +SERLE=I631 +SERMIDE=I632 +SERMONETA=I634 +SERNAGLIA_DELLA_BATTAGLIA=I635 +SERNIO=I636 +SEROLE=I637 +SERRA_D'AIELLO=I642 +SERRA_DE'CONTI=I643 +SERRA_PEDACE=I650 +SERRA_RICCO'=I640 +SERRA_SAN_BRUNO=I639 +SERRA_SAN_QUIRICO=I653 +SERRA_SANT'ABBONDIO=I654 +SERRACAPRIOLA=I641 +SERRADIFALCO=I644 +SERRALUNGA_D'ALBA=I646 +SERRALUNGA_DI_CREA=I645 +SERRAMANNA=I647 +SERRAMAZZONI=F357 +SERRAMEZZANA=I648 +SERRAMONACESCA=I649 +SERRAPETRONA=I651 +SERRARA_FONTANA=I652 +SERRASTRETTA=I655 +SERRATA=I656 +SERRAVALLE_A_PO=I662 +SERRAVALLE_DI_CHIENTI=I661 +SERRAVALLE_LANGHE=I659 +SERRAVALLE_PISTOIESE=I660 +SERRAVALLE_SCRIVIA=I657 +SERRAVALLE_SESIA=I663 +SERRE=I666 +SERRENTI=I667 +SERRI=I668 +SERRONE=I669 +SERRUNGARINA=I670 +SERSALE=I671 +SERVIGLIANO=C070 +SESSA_AURUNCA=I676 +SESSA_CILENTO=I677 +SESSAME=I678 +SESSANO_DEL_MOLISE=I679 +SESTA_GODANO=E070 +SESTINO=I681 +SESTO=I687 +SESTO_AL_REGHENA=I686 +SESTO_CALENDE=I688 +SESTO_CAMPANO=I682 +SESTO_ED_UNITI=I683 +SESTO_FIORENTINO=I684 +SESTO_SAN_GIOVANNI=I690 +SESTOLA=I689 +SESTRI_LEVANTE=I693 +SESTRIERE=I692 +SESTU=I695 +SETTALA=I696 +SETTEFRATI=I697 +SETTIME=I698 +SETTIMO_MILANESE=I700 +SETTIMO_ROTTARO=I701 +SETTIMO_SAN_PIETRO=I699 +SETTIMO_TORINESE=I703 +SETTIMO_VITTONE=I702 +SETTINGIANO=I704 +SETZU=I705 +SEUI=I706 +SEULO=I707 +SEVESO=I709 +SEZZADIO=I711 +SEZZE=I712 +SFRUZ=I714 +SGONICO=I715 +SGURGOLA=I716 +SIAMAGGIORE=I717 +SIAMANNA=I719 +SIANO=I720 +SIAPICCIA=I721 +SICIGNANO_DEGLI_ALBURNI=M253 +SICULIANA=I723 +SIDDI=I724 +SIDERNO=I725 +SIENA=I726 +SIERRA_LEONE=Z344 +SIGILLO=I727 +SIGNA=I728 +SIKKIM=Z239 +SILANDRO=I729 +SILANUS=I730 +SILEA=F116 +SILIGO=I732 +SILIQUA=I734 +SILIUS=I735 +SILLANO=I737 +SILLAVENGO=I736 +SILVANO_D'ORBA=I738 +SILVANO_PIETRA=I739 +SILVI=I741 +SIMALA=I742 +SIMAXIS=I743 +SIMBARIO=I744 +SIMERI_E_CRICHI=I745 +SINAGRA=I747 +SINALUNGA=A468 +SINDIA=I748 +SINGAPORE=Z230 +SINI=I749 +SINIO=I750 +SINISCOLA=I751 +SINNAI=I752 +SINOPOLI=I753 +SIRACUSA=I754 +SIRIA=Z240 +SIRIGNANO=I756 +SIRIS=I757 +SIRMIONE=I633 +SIROLO=I758 +SIRONE=I759 +SIROR=I760 +SIRTORI=I761 +SISSA=I763 +SIURGUS_DONIGALA=I765 +SIZIANO=E265 +SIZZANO=I677 +SLUDERNO=I771 +SMARANO=I772 +SMERILLO=I774 +SOAVE=I775 +SOCCHIEVE=I777 +SOGLIANO_AL_RUBICONE=I779 +SOGLIANO_CAVOUR=I780 +SOGLIO=I781 +SOIANO_DEL_LAGO=I782 +SOLAGNA=I783 +SOLARINO=I785 +SOLARO=I786 +SOLAROLO=I787 +SOLAROLO_RAINERIO=I790 +SOLARUSSA=I791 +SOLBIATE=I792 +SOLBIATE_ARNO=I793 +SOLBIATE_OLONA=I794 +SOLDANO=I796 +SOLEMINIS=I797 +SOLERO=I798 +SOLESINO=I799 +SOLETO=I800 +SOLFERINO=I801 +SOLIERA=I802 +SOLIGNANO=I803 +SOLOFRA=I805 +SOLONGHELLO=I808 +SOLOPACA=I809 +SOLTO_COLLINA=I812 +SOLZA=I813 +SOMAGLIA=I815 +SOMALIA=Z345 +SOMALIA_FRANCESE=Z346 +SOMANO=I817 +SOMMA_LOMBARDO=I819 +SOMMA_VESUVIANA=I820 +SOMMACAMPAGNA=I821 +SOMMARIVA_DEL_BOSCO=I822 +SOMMARIVA_PERNO=I823 +SOMMATINO=I824 +SOMMO=I825 +SONA=I826 +SONCINO=I827 +SONDALO=I828 +SONDRIO=I829 +SONGAVAZZO=I830 +SONICO=I831 +SONNINO=I832 +SOPRANA=I835 +SORA=I838 +SORAGA=I839 +SORAGNA=I840 +SORANO=I841 +SORBO_SAN_BASILE=I844 +SORBO_SERPICO=I843 +SORBOLO=I845 +SORDEVOLO=I847 +SORDIO=I848 +SORESINA=I849 +SORGA'=I850 +SORGONO=I851 +SORI=I852 +SORIANELLO=I853 +SORIANO_CALABRO=I854 +SORIANO_NEL_CIMINO=I855 +SORICO=I856 +SORISO=I857 +SORISOLE=I858 +SORMANO=I860 +SORRADILE=I861 +SORRENTO=I862 +SORSO=I863 +SORTINO=I864 +SOSPIRO=I865 +SOSPIROLO=I866 +SOSSANO=I867 +SOSTEGNO=I868 +SOTTO_IL_MONTE_GIOVANNI_XXIII=I869 +SOVER=I871 +SOVERATO=I872 +SOVERE=I873 +SOVERIA_MANNELLI=I874 +SOVERIA_SIMERI=I875 +SOVERZENE=I876 +SOVICILLE=I877 +SOVICO=I878 +SOVIZZO=I879 +SOVRAMONTE=I673 +SOZZAGO=I880 +SPADAFORA=I881 +SPADOLA=I884 +SPAGNA=Z131 +SPARANISE=I885 +SPARONE=I886 +SPECCHIA=I887 +SPELLO=I888 +SPERA=I889 +SPERLINGA=I891 +SPERLONGA=I892 +SPERONE=I893 +SPESSA=I894 +SPEZZANO_ALBANESE=I895 +SPEZZANO_DELLA_SILA=I896 +SPEZZANO_PICCOLO=I898 +SPIAZZO=I899 +SPIGNO_MONFERRATO=I901 +SPIGNO_SATURNIA=I902 +SPILAMBERTO=I903 +SPILIMBERGO=I904 +SPILINGA=I905 +SPINADESCO=I906 +SPINAZZOLA=I907 +SPINEA=I908 +SPINEDA=I909 +SPINETE=I910 +SPINETO_SCRIVIA=I911 +SPINETOLI=I912 +SPINO_D'ADDA=I914 +SPINONE_AL_LAGO=I916 +SPINOSO=I917 +SPIRANO=I919 +SPOLETO=I921 +SPOLTORE=I922 +SPONGANO=I923 +SPORMAGGIORE=I924 +SPORMINORE=I925 +SPOTORNO=I926 +SPRESIANO=I927 +SPRIANA=I928 +SQUILLACE=I929 +SQUINZANO=I930 +STAFFOLO=I932 +STAGNO_LOMBARDO=I935 +STAITI=I936 +STALETTI=I937 +STANGHELLA=I938 +STARANZANO=I939 +STATI_UNITI=Z404 +STAZZANO=I941 +STAZZEMA=I942 +STAZZONA=I943 +STEFANACONI=I945 +STELLA=I946 +STELLA_CILENTO=G887 +STELLANELLO=I947 +STELVIO=I948 +STENICO=I949 +STERNATIA=I950 +STEZZANO=I951 +STIA=I952 +STIENTA=I953 +STIGLIANO=I954 +STIGNANO=I955 +STILO=I956 +STIMIGLIANO=I959 +STIO=I960 +STORNARA=I962 +STORNARELLA=I963 +STORO=I964 +STRA'=I965 +STRADELLA=I968 +STRAMBINELLO=I969 +STRAMBINO=I970 +STRANGOLAGALLI=I973 +STREGNA=I974 +STREMBO=I975 +STRESA=I976 +STREVI=I977 +STRIANO=I978 +STRIGNO=I979 +STRONA=I980 +STRONCONE=I981 +STRONGOLI=I982 +STROPPIANA=I984 +STROPPO=I985 +STROZZA=I986 +STURNO=I990 +SUARDI=B014 +SUBBIANO=I991 +SUBIACO=I992 +SUCCIVO=I993 +SUDAN=Z348 +SUEGLIO=I994 +SUELLI=I995 +SUELLO=I996 +SUISIO=I997 +SULBIATE=I998 +SULMONA=I804 +SULZANO=L002 +SUMIRAGO=L003 +SUMMONTE=L004 +SUNI=L006 +SUNO=L007 +SUPERSANO=L008 +SUPINO=L009 +SURANO=L010 +SURBO=L011 +SUSA=L013 +SUSEGANA=L014 +SUSTINENTE=L015 +SUTERA=L016 +SUTRI=L017 +SUTRIO=L018 +SUVERETO=L019 +SUZZARA=L020 +SVEZIA=Z132 +SVIZZERA=Z133 +SWAZILAND=Z349 +TACENO=L022 +TADASUNI=L023 +TAGGIA=L024 +TAGLIACOZZO=L025 +TAGLIO_DI_PO=L026 +TAGLIOLO_MONFERRATO=L027 +TAIBON_AGORDINO=L030 +TAINO=L032 +TAIO=L033 +TAIPANA=G736 +TALAMELLO=L034 +TALAMONA=L035 +TALANA=L036 +TALEGGIO=L037 +TALLA=L038 +TALMASSONS=L039 +TAMBRE=L040 +TANGANICA=Z350 +TAORMINA=L042 +TAPOGLIANO=L044 +TARANO=L046 +TARANTA_PELIGNA=L047 +TARANTASCA=L048 +TARANTO=L049 +TARCENTO=L050 +TARQUINIA=D024 +TARSIA=L055 +TARTANO=L056 +TARVISIO=L057 +TARZO=L058 +TASSAROLO=L059 +TASSULLO=L060 +TAURANO=L061 +TAURASI=L062 +TAURIANOVA=L063 +TAURISANO=L064 +TAVAGNACCO=L065 +TAVAGNASCO=L066 +TAVARNELLE_VAL_DI_PESA=L067 +TAVAZZANO_CON_VILLAVESCO=F260 +TAVENNA=L069 +TAVERNA=L070 +TAVERNERIO=L071 +TAVERNOLA_BERGAMASCA=L073 +TAVERNOLE_SUL_MELLA=C698 +TAVIANO=L074 +TAVIGLIANO=L075 +TAVOLETO=L078 +TAVULLIA=L081 +TEANA=L082 +TEANO=L083 +TEGGIANO=D292 +TEGLIO=L084 +TEGLIO_VENETO=L085 +TELESE=L086 +TELGATE=L087 +TELTI=L088 +TELVE=L089 +TELVE_DI_SOPRA=L090 +TEMPIO_PAUSANIA=L093 +TEMU'=L094 +TENNA=L096 +TENNO=L097 +TEOLO=L100 +TEOR=L101 +TEORA=L102 +TERAMO=L103 +TERDOBBIATE=L104 +TERELLE=L105 +TERENTO=L106 +TERENZO=E548 +TERLAGO=L107 +TERLANO=L108 +TERLIZZI=L109 +TERME_VIGLIATORE=M210 +TERMENO_SULLA_STRADA_DEL_VINO=L111 +TERMINI_IMERESE=L112 +TERMOLI=L113 +TERNATE=L115 +TERNENGO=L116 +TERNI=L117 +TERNO_D'ISOLA=L118 +TERRACINA=L120 +TERRAGNOLO=L121 +TERRALBA=L122 +TERRANOVA_DA_SIBARI=L124 +TERRANOVA_DEI_PASSERINI=L125 +TERRANOVA_DI_POLLINO=L126 +TERRANOVA_SAPPO_MINULIO=L127 +TERRANUOVA_BRACCIOLINI=L123 +TERRASINI=L131 +TERRASSA_PADOVANA=L132 +TERRAVECCHIA=L134 +TERRAZZO=L136 +TERRES=L137 +TERRICCIOLA=L138 +TERRUGGIA=L139 +TERTENIA=L140 +TERZIGNO=L142 +TERZO=L143 +TERZO_D'AQUILEIA=L144 +TERZOLAS=L145 +TERZORIO=L146 +TESERO=L147 +TESIMO=L149 +TESSENNANO=L150 +TESTICO=L152 +TETI=L153 +TEULADA=L154 +TEVEROLA=L155 +TEZZE_SUL_BRENTA=L156 +THAILANDIA=Z241 +THIENE=L157 +THIESI=L158 +TIANA=L160 +TIARNO_DI_SOPRA=L162 +TIARNO_DI_SOTTO=L163 +TICENGO=L164 +TICINETO=L165 +TIGGIANO=L166 +TIGLIETO=L167 +TIGLIOLE=L168 +TIGNALE=L169 +TIMOR=Z242 +TINNURA=L172 +TIONE_DEGLI_ABRUZZI=L173 +TIONE_DI_TRENTO=L174 +TIRANO=L175 +TIRES=L176 +TIRIOLO=L177 +TIROLO=L178 +TISSI=L180 +TITO=L181 +TIVOLI=L182 +TIZZANO_VAL_PARMA=L183 +TOANO=L184 +TOCCO_CAUDIO=L185 +TOCCO_DA_CASAURIA=L186 +TOCENO=L187 +TODI=L188 +TOFFIA=L189 +TOGO=Z351 +TOIRANO=L190 +TOKELAU=Z727 +TOLENTINO=L191 +TOLFA=L192 +TOLLEGNO=L193 +TOLLO=L194 +TOLMEZZO=L195 +TOLVE=L197 +TOMBOLO=L199 +TON=L200 +TONADICO=L201 +TONARA=L202 +TONCO=L203 +TONENGO=L204 +TONEZZA_DEL_CIMONE=D717 +TORA_E_PICCILLI=L205 +TORANO_CASTELLO=L206 +TORANO_NUOVO=L207 +TORBOLE_CASAGLIA=L210 +TORCEGNO=L211 +TORCHIARA=L212 +TORCHIAROLO=L213 +TORELLA_DEL_SANNIO=L215 +TORELLA_DE'LOMBARDI=L214 +TORGIANO=L216 +TORGNON=L217 +TORINO=L219 +TORINO_DI_SANGRO=L218 +TORITTO=L220 +TORLINO_VIMERCATI=L221 +TORNACO=L223 +TORNARECCIO=L224 +TORNATA=L225 +TORNIMPARTE=L227 +TORNO=L228 +TORNOLO=L229 +TORO=L230 +TORPE'=L231 +TORRACA=L233 +TORRALBA=L235 +TORRAZZA_COSTE=L237 +TORRAZZA_PIEMONTE=L238 +TORRAZZO=L239 +TORRE_ANNUNZIATA=L245 +TORRE_BERETTI_E_CASTELLARO=L250 +TORRE_BOLDONE=L251 +TORRE_BORMIDA=L252 +TORRE_CAJETANI=L243 +TORRE_CANAVESE=L247 +TORRE_D'ARESE=L256 +TORRE_DE'BUSI=L257 +TORRE_DEL_GRECO=L259 +TORRE_DE'NEGRI=L262 +TORRE_DE'PASSERI=L263 +TORRE_DE'PICENARDI=L258 +TORRE_DE'ROVERI=L265 +TORRE_DI_MOSTO=L267 +TORRE_DI_RUGGIERO=L240 +TORRE_DI_SANTA_MARIA=L244 +TORRE_D'ISOLA=L269 +TORRE_LE_NOCELLE=L272 +TORRE_MONDOVI'=L241 +TORRE_ORSAIA=L274 +TORRE_PALLAVICINA=L276 +TORRE_PELLICE=L277 +TORRE_SAN_GIORGIO=L278 +TORRE_SAN_PATRIZIO=L279 +TORRE_SANTA_SUSANNA=L280 +TORREANO=L246 +TORREBELVICINO=L248 +TORREBRUNA=L253 +TORRECUSO=L254 +TORREGLIA=L270 +TORREGROTTA=L271 +TORREMAGGIORE=L273 +TORRESINA=L281 +TORRETTA=L282 +TORREVECCHIA_PIA=L285 +TORREVECCHIA_TEATINA=L284 +TORRI_DEL_BENACO=L287 +TORRI_DI_QUARTESOLO=L297 +TORRI_IN_SABINA=L286 +TORRIANA=I550 +TORRICE=L290 +TORRICELLA=L294 +TORRICELLA_DEL_PIZZO=L296 +TORRICELLA_IN_SABINA=L293 +TORRICELLA_PELIGNA=L291 +TORRICELLA_SICURA=L295 +TORRICELLA_VERZATE=L292 +TORRIGLIA=L298 +TORRILE=L299 +TORRIONI=L301 +TORRITA_DI_SIENA=L303 +TORRITA_TIBERINA=L302 +TORTOLI'=A355 +TORTONA=L304 +TORTORA=L305 +TORTORELLA=L306 +TORTORETO=L307 +TORTORICI=L308 +TORVISCOSA=L309 +TOSCOLANO_MADERNO=L312 +TOSSICIA=L314 +TOVO_DI_SANT'AGATA=L316 +TOVO_SAN_GIACOMO=L315 +TRABIA=L317 +TRADATE=L319 +TRAMATZA=L321 +TRAMBILENO=L322 +TRAMONTI=L323 +TRAMONTI_DI_SOPRA=L324 +TRAMONTI_DI_SOTTO=L325 +TRAMUTOLA=L326 +TRANA=L327 +TRANI=L328 +TRANSACQUA=L329 +TRAONA=L330 +TRAPANI=L331 +TRAPPETO=L332 +TRAREGO_VIGGIONA=L333 +TRASACCO=L334 +TRASAGHIS=L335 +TRASQUERA=L336 +TRATALIAS=L337 +TRAUSELLA=L338 +TRAVACO'_SICCOMARIO=I236 +TRAVAGLIATO=L339 +TRAVEDONA_MONATE=L342 +TRAVERSELLA=L345 +TRAVERSETOLO=L346 +TRAVES=L340 +TRAVESIO=L347 +TRAVO=L348 +TREBASELEGHE=L349 +TREBISACCE=L353 +TRECASALI=L354 +TRECASTAGNI=L355 +TRECATE=L356 +TRECCHINA=L357 +TRECENTA=L359 +TREDOZIO=L361 +TREGLIO=L363 +TREGNAGO=L364 +TREIA=L366 +TREISO=L367 +TREMENICO=L368 +TREMESTIERI_ETNEO=L369 +TREMEZZO=L371 +TREMOSINE=L372 +TRENTA=L375 +TRENTINARA=L377 +TRENTO=L378 +TRENTOLA_DUCENTA=L379 +TRENZANO=L380 +TREPPO_CARNICO=L381 +TREPPO_GRANDE=L382 +TREPUZZI=L383 +TREQUANDA=L384 +TRES=L385 +TRESANA=L386 +TRESCORE_BALNEARIO=L388 +TRESCORE_CREMASCO=L389 +TRESIGALLO=L390 +TRESIVIO=L392 +TRESNURAGHES=L393 +TREVENZUOLO=L396 +TREVI=L397 +TREVI_NEL_LAZIO=L398 +TREVICO=L399 +TREVIGLIO=L400 +TREVIGNANO=L402 +TREVIGNANO_ROMANO=L401 +TREVILLE=L403 +TREVIOLO=L404 +TREVISO=L407 +TREVISO_BRESCIANO=L406 +TREZZANO_ROSA=L408 +TREZZANO_SUL_NAVIGLIO=L409 +TREZZO_SULL'ADDA=L411 +TREZZO_TINELLA=L410 +TREZZONE=L413 +TRIBANO=L414 +TRIBIANO=L415 +TRIBOGNA=L416 +TRICARICO=L418 +TRICASE=L419 +TRICERRO=L420 +TRICESIMO=L421 +TRICHIANA=L422 +TRIEI=L423 +TRIESTE=L424 +TRIGGIANO=L425 +TRIGOLO=L426 +TRINIDAD=Z612 +TRINITA'=L427 +TRINITA'_D'AGULTU=L428 +TRINITAPOLI=B915 +TRINO=L429 +TRIORA=L430 +TRIPI=L431 +TRISOBBIO=L432 +TRISSINO=L433 +TRIUGGIO=L434 +TRIVENTO=L435 +TRIVERO=L436 +TRIVIGLIANO=L437 +TRIVIGNANO_UDINESE=L438 +TRIVIGNO=L439 +TRIVOLZIO=L440 +TRODENA=L444 +TROFARELLO=L445 +TROIA=L447 +TROINA=L448 +TROMELLO=L449 +TRONTANO=L450 +TRONZANO_LAGO_MAGGIORE=A705 +TRONZANO_VERCELLESE=L451 +TROPEA=L452 +TROVO=L453 +TRUCCAZZANO_D'ADDA=L454 +TUBRE=L455 +TUENNO=L457 +TUFARA=L458 +TUFILLO=L459 +TUFINO=L460 +TUFO=L461 +TUGLIE=L462 +TUILI=L463 +TULA=L464 +TUNISIA=Z352 +TUORO_SUL_TRASIMENO=L466 +TURANIA=G507 +TURANO_LODIGIANO=L469 +TURATE=L470 +TURBIGO=L471 +TURCHIA=Z243 +TURI=L472 +TURKS_E_CAICOS=Z519 +TURRI=L473 +TURRIACO=L474 +TURRIVALIGNANI=L475 +TURSI=L477 +TUSA=L478 +TUSCANIA=L310 +UBIALE_CLANEZZO=C789 +UBOLDO=L480 +UCRIA=L482 +UDINE=L483 +UGANDA=Z353 +UGENTO=L484 +UGGIANO_LA_CHIESA=L485 +UGGIATE_TREVANO=L487 +ULA'_TIRSO=L488 +ULASSAI=L489 +ULTIMO=L490 +UMBERTIDE=D786 +UMBRIATICO=L492 +UNGHERIA=Z134 +UNIONE_SOVIETICA=Z135 +URAGO_D'OGLIO=L494 +URAS=L496 +URBANA=L497 +URBANIA=L498 +URBE=L499 +URBINO=L500 +URBISAGLIA=L501 +URGNANO=L502 +URI=L503 +URUGUAY=Z613 +URURI=L505 +URZULEI=L506 +USCIO=L507 +USELLUS=L508 +USINI=L509 +USMATE_VELATE=L511 +USSANA=L512 +USSARAMANNA=L513 +USSASSAI=L514 +USSEAUX=L515 +USSEGLIO=L516 +USSITA=L517 +USTICA=L519 +UTA=L521 +UZZANO=L522 +VACCARIZZO_ALBANESE=L524 +VACONE=L525 +VACRI=L526 +VADENA=L527 +VADO_LIGURE=L528 +VAGLI_SOTTO=L533 +VAGLIA=L529 +VAGLIO_BASILICATA=L532 +VAGLIO_SERRA=L531 +VAIANO=L537 +VAIANO_CREMASCO=L535 +VAIE=L538 +VAILATE=L539 +VAIRANO_PATENORA=L540 +VAJONT=L000 +VAL_DELLA_TORRE=L555 +VAL_DI_NIZZA=L562 +VAL_DI_VIZZE=L564 +VAL_MASINO=L638 +VAL_REZZO=H259 +VALBONDIONE=L544 +VALBREMBO=L545 +VALBREVENNA=L546 +VALBRONA=L547 +VALDA=L550 +VALDAGNO=L551 +VALDAORA=L552 +VALDASTICO=L554 +VALDENGO=L556 +VALDERICE=G319 +VALDIDENTRO=L557 +VALDIERI=L558 +VALDINA=L561 +VALDISOTTO=L563 +VALDOBBIADENE=L565 +VALDUGGIA=L566 +VALEGGIO=L568 +VALEGGIO_SUL_MINCIO=L567 +VALENTANO=L569 +VALENZA=L570 +VALENZANO=L571 +VALERA_FRATTA=L572 +VALFABBRICA=L573 +VALFENERA=L574 +VALFLORIANA=L575 +VALFURVA=L576 +VALGANNA=L577 +VALGIOIE=L578 +VALGOGLIO=L579 +VALGRANA=L580 +VALGREGHENTINO=L581 +VALGRISANCHE=L582 +VALGUARNERA_CAROPEPE=L583 +VALLADA_AGORDINA=L584 +VALLANZENGO=L586 +VALLARSA=L588 +VALLATA=L589 +VALLE_AGRICOLA=L594 +VALLE_AURINA=L595 +VALLE_CASTELLANA=L597 +VALLE_DELL'ANGELO=G540 +VALLE_DI_CADORE=L590 +VALLE_DI_CASIES=L601 +VALLE_DI_MADDALONI=L591 +VALLE_LOMELLINA=L593 +VALLE_MOSSO=L606 +VALLE_SALIMBENE=L617 +VALLE_SAN_NICOLAO=L620 +VALLEBONA=L596 +VALLECORSA=L598 +VALLECROSIA=L599 +VALLEDOLMO=L603 +VALLEDORIA=L604 +VALLEFIORITA=I322 +VALLELONGA=L607 +VALLELUNGA_PRATAMENO=L609 +VALLEMAIO=L605 +VALLEPIETRA=L611 +VALLERANO=L612 +VALLERMOSA=L613 +VALLEROTONDA=L614 +VALLESACCARDA=L616 +VALLEVE=L623 +VALLI_DEL_PASUBIO=L624 +VALLINFREDA=L625 +VALLIO_TERME=L626 +VALLO_DELLA_LUCANIA=L628 +VALLO_DI_NERA=L627 +VALLO_TORINESE=L629 +VALLORIATE=L631 +VALMACCA=L633 +VALMADRERA=L634 +VALMALA=L636 +VALMONTONE=L639 +VALMOREA=L640 +VALMOZZOLA=L641 +VALNEGRA=L642 +VALPELLINE=L643 +VALPERGA=L644 +VALPRATO_SOANA=B510 +VALSAVARANCHE=L647 +VALSECCA=L649 +VALSINNI=D513 +VALSOLDA=C936 +VALSTAGNA=L650 +VALSTRONA=L651 +VALTOPINA=L653 +VALTORTA=L655 +VALTOURNANCHE=L654 +VALVA=L656 +VALVASONE=L657 +VALVERDE=L658 +VALVERDE=L659 +VALVESTINO=L468 +VANDOIES=L660 +VANZAGHELLO=L664 +VANZAGO=L665 +VANZONE_CON_SAN_CARLO=L666 +VAPRIO_D'ADDA=L667 +VAPRIO_D'AGOGNA=L668 +VARALLO=L669 +VARALLO_POMBIA=L670 +VARANO_BORGHI=L671 +VARANO_DE_MELEGARI=L672 +VARAPODIO=L673 +VARAZZE=L675 +VARCO_SABINO=L676 +VAREDO=L677 +VARENA=L678 +VARENNA=L680 +VARESE=L682 +VARESE_LIGURE=L681 +VARISELLA=L685 +VARMO=L686 +VARNA=L687 +VARSI=L689 +VARZI=L690 +VARZO=L691 +VAS=L692 +VASANELLO=A701 +VASIA=L693 +VASTO=E372 +VASTOGIRARDI=L696 +VATTARO=L697 +VAUDA_CANAVESE=L698 +VAZZANO=L699 +VAZZOLA=L700 +VECCHIANO=L702 +VEDANO_AL_LAMBRO=L704 +VEDANO_OLONA=L703 +VEDDASCA=L705 +VEDELAGO=L706 +VEDESETA=L707 +VEDUGGIO_CON_COLZANO=L709 +VEGGIANO=L710 +VEGLIE=L711 +VEGLIO=L712 +VEJANO=L713 +VELESO=L715 +VELEZZO_LOMELLINA=L716 +VELLETRI=L719 +VELLEZZO_BELLINI=L720 +VELO_D'ASTICO=L723 +VELO_VERONESE=L722 +VELTURNO=L724 +VENAFRO=L725 +VENARIA=L727 +VENAROTTA=L728 +VENASCA=L729 +VENAUS=L726 +VENDONE=L730 +VENDROGNO=L731 +VENEGONO_INFERIORE=L733 +VENEGONO_SUPERIORE=L734 +VENETICO=L735 +VENEZIA=L736 +VENEZUELA=Z614 +VENIANO=L737 +VENOSA=L738 +VENTICANO=L739 +VENTIMIGLIA=L741 +VENTIMIGLIA_DI_SICILIA=L740 +VENTOTENE=L742 +VENZONE=L743 +VERANO=L745 +VERANO_BRIANZA=L744 +VERBANIA=L746 +VERBICARO=L747 +VERCANA=L748 +VERCEIA=L749 +VERCELLI=L750 +VERCURAGO=L751 +VERDELLINO=L752 +VERDELLO=L753 +VERDERIO_INFERIORE=L755 +VERDERIO_SUPERIORE=L756 +VERDUNO=L758 +VERGATO=L762 +VERGEMOLI=L763 +VERGHERETO=L764 +VERGIATE=L765 +VERMEZZO=L768 +VERMIGLIO=L769 +VERNANTE=L771 +VERNASCA=L772 +VERNATE=L773 +VERNAZZA=L774 +VERNIO=L775 +VERNOLE=L776 +VEROLANUOVA=L777 +VEROLAVECCHIA=L778 +VEROLENGO=L770 +VEROLI=L780 +VERONA=L781 +VERONELLA=D193 +VERRAYES=L783 +VERRES=C282 +VERRETTO=L784 +VERRONE=L785 +VERRUA_PO=L788 +VERRUA_SAVOIA=L787 +VERTEMATE_CON_MINOPRIO=L792 +VERTOVA=L795 +VERUCCHIO=L797 +VERUNO=L798 +VERVIO=L799 +VERVO=L800 +VERZEGNIS=L801 +VERZINO=L802 +VERZUOLO=L804 +VESCOVANA=L805 +VESCOVATO=L806 +VESIME=L807 +VESPOLATE=L808 +VESSALICO=L809 +VESTENANOVA=L810 +VESTIGNE'=L811 +VESTONE=L812 +VESTRENO=L813 +VETRALLA=L814 +VETTO=L815 +VEZZA_D'ALBA=L817 +VEZZA_D'OGLIO=L816 +VEZZANO=L821 +VEZZANO_LIGURE=L819 +VEZZANO_SUL_CROSTOLO=L820 +VEZZI_PORTIO=L823 +VIADANA=L826 +VIADANICA=L827 +VIAGRANDE=L828 +VIALE_D'ASTI=L829 +VIALFRE'=L830 +VIANO=L831 +VIAREGGIO=L833 +VIARIGI=L834 +VIBO_VALENTIA=F537 +VIBONATI=L835 +VICALVI=L836 +VICARI=L837 +VICCHIO=L838 +VICENZA=L840 +VICO_CANAVESE=L548 +VICO_DEL_GARGANO=L842 +VICO_EQUENSE=L845 +VICO_NEL_LAZIO=L843 +VICOFORTE=L841 +VICOLI=L846 +VICOLUNGO=L847 +VICOPISANO=L850 +VICOVARO=L851 +VIDDALBA=L000 +VIDIGULFO=L854 +VIDOR=L856 +VIDRACCO=L857 +VIESTE=L858 +VIETNAM_DEL_NORD=Z245 +VIETNAM_DEL_SUD=Z244 +VIETRI_DI_POTENZA=L859 +VIETRI_SUL_MARE=L860 +VIGANELLA=L864 +VIGANO'=L866 +VIGANO_SAN_MARTINO=L865 +VIGARANO_MAINARDA=L868 +VIGASIO=L869 +VIGEVANO=L872 +VIGGIANELLO=L873 +VIGGIANO=L874 +VIGGIU'=L876 +VIGHIZZOLO_D'ESTE=L878 +VIGLIANO_BIELLESE=L880 +VIGLIANO_D'ASTI=L879 +VIGNALE_MONFERRATO=L881 +VIGNANELLO=L882 +VIGNATE=L883 +VIGNOLA=L885 +VIGNOLA_FALESINA=L886 +VIGNOLE_BORBERA=L887 +VIGNOLO=L888 +VIGNONE=L889 +VIGO_DI_CADORE=L890 +VIGO_DI_FASSA=L893 +VIGO_RENDENA=L903 +VIGODARZERE=L892 +VIGOLO=L894 +VIGOLO_VATTARO=L896 +VIGOLZONE=L897 +VIGONE=L898 +VIGONOVO=L899 +VIGONZA=L900 +VIGUZZOLO=L904 +VILLA_AGNEDO=L910 +VILLA_BARTOLOMEA=L912 +VILLA_BASILICA=L913 +VILLA_BISCOSSI=L917 +VILLA_CARCINA=L919 +VILLA_CASTELLI=L920 +VILLA_CELIERA=L922 +VILLA_COLLEMANDINA=L926 +VILLA_CORTESE=L928 +VILLA_D'ADDA=L929 +VILLA_D'ALME'=A215 +VILLA_DEL_BOSCO=L933 +VILLA_DEL_CONTE=L934 +VILLA_DI_BRIANO=D801 +VILLA_DI_CHIAVENNA=L907 +VILLA_DI_SERIO=L936 +VILLA_DI_TIRANO=L908 +VILLA_D'OGNA=L938 +VILLA_ESTENSE=L937 +VILLA_FARALDI=L943 +VILLA_GUARDIA=L956 +VILLA_LAGARINA=L957 +VILLA_LATINA=A081 +VILLA_LITERNO=L844 +VILLA_MINOZZO=L969 +VILLA_POMA=F804 +VILLA_RENDENA=M006 +VILLA_SAN_GIOVANNI=M018 +VILLA_SAN_GIOVANNI_IN_TUSCIA=H913 +VILLA_SAN_PIETRO=I118 +VILLA_SAN_SECONDO=M019 +VILLA_SANTA_LUCIA=L905 +VILLA_SANTA_LUCIA_DEGLI_ABRUZZI=M021 +VILLA_SANTA_MARIA=M022 +VILLA_SANT'ANGELO=M023 +VILLA_SANTINA=L909 +VILLA_SANTO_STEFANO=I364 +VILLA_VERDE=A609 +VILLA_VICENTINA=M034 +VILLABASSA=L914 +VILLABATE=L916 +VILLACHIARA=L923 +VILLACIDRO=L924 +VILLADEATI=L931 +VILLADOSE=L939 +VILLADOSSOLA=L906 +VILLAFALLETTO=L942 +VILLAFRANCA_D'ASTI=L945 +VILLAFRANCA_DI_VERONA=L949 +VILLAFRANCA_IN_LUNIGIANA=L946 +VILLAFRANCA_PADOVANA=L947 +VILLAFRANCA_PIEMONTE=L948 +VILLAFRANCA_SICULA=L944 +VILLAFRANCA_TIRRENA=L950 +VILLAFRATI=L951 +VILLAGA=L952 +VILLAGRANDESTRISAILI=L953 +VILLALAGO=L958 +VILLALBA=L959 +VILLALFONSINA=L961 +VILLALVERNIA=L963 +VILLAMAGNA=L964 +VILLAMAINA=L965 +VILLAMAR=L966 +VILLAMARZANA=L967 +VILLAMASSARGIA=L968 +VILLAMIROGLIO=L970 +VILLANDRO=L971 +VILLANOVA_BIELLESE=L978 +VILLANOVA_CANAVESE=L982 +VILLANOVA_D'ALBENGA=L975 +VILLANOVA_D'ARDENGHI=L983 +VILLANOVA_D'ASTI=L984 +VILLANOVA_DEL_BATTISTA=L973 +VILLANOVA_DEL_GHEBBO=L985 +VILLANOVA_DEL_SILLARO=L977 +VILLANOVA_DI_CAMPOSAMPIERO=L979 +VILLANOVA_MARCHESANA=L988 +VILLANOVA_MONDOVI'=L974 +VILLANOVA_MONFERRATO=L972 +VILLANOVA_MONTELEONE=L989 +VILLANOVA_SOLARO=L990 +VILLANOVA_SULL'ARDA=L980 +VILLANOVA_TRUSCHEDU=L991 +VILLANOVA_TULO=L992 +VILLANOVAFORRU=L986 +VILLANOVAFRANCA=L987 +VILLANTERIO=L994 +VILLANUOVA_SUL_CLISI=L995 +VILLAPIANA=B903 +VILLAPUTZU=L998 +VILLAR_DORA=L999 +VILLAR_FOCCHIARDO=M007 +VILLAR_PELLICE=M013 +VILLAR_PEROSA=M014 +VILLAR_SAN_COSTANZO=M015 +VILLARBASSE=M002 +VILLARBOIT=M003 +VILLAREGGIA=M004 +VILLARICCA=G309 +VILLAROMAGNANO=M009 +VILLAROSA=M011 +VILLASALTO=M016 +VILLASANTA=M017 +VILLASIMIUS=B738 +VILLASOR=M025 +VILLASPECIOSA=M026 +VILLASTELLONE=M027 +VILLATA=M028 +VILLAURBANA=M030 +VILLAVALLELONGA=M031 +VILLAVERLA=M032 +VILLENEUVE=L981 +VILLESSE=M043 +VILLETTA_BARREA=M041 +VILLETTE=M042 +VILLIMPENTA=M044 +VILLONGO=M045 +VILLORBA=M048 +VILMINORE_DI_SCALVE=M050 +VIMERCATE=M052 +VIMODRONE=M053 +VINADIO=M055 +VINCHIATURO=M057 +VINCHIO=M058 +VINCI=M059 +VINOVO=M060 +VINZAGLIO=M062 +VIOLA=M063 +VIONE=M065 +VIPITENO=M067 +VIRGILIO=H123 +VIRLE_PIEMONTE=M069 +VISANO=M070 +VISCHE=M071 +VISCIANO=M072 +VISCO=M073 +VISONE=M077 +VISSO=M078 +VISTARINO=M079 +VISTRORIO=M080 +VITA=M081 +VITERBO=M082 +VITICUSO=M083 +VITO_D'ASIO=M085 +VITORCHIANO=M086 +VITTORIA=M088 +VITTORIO_VENETO=M089 +VITTORITO=M090 +VITTUONE=M091 +VITULANO=M093 +VITULAZIO=M092 +VIU'=M094 +VIVARO=M096 +VIVARO_ROMANO=M095 +VIVERONE=M098 +VIZZINI=M100 +VIZZOLA_TICINO=M101 +VIZZOLO_PREDABISSI=M102 +VO=M103 +VOBARNO=M104 +VOBBIA=M105 +VOCCA=M106 +VODO_CADORE=M108 +VOGHERA=M109 +VOGHIERA=M110 +VOGOGNA=M111 +VOLANO=M113 +VOLLA=M115 +VOLONGO=M116 +VOLPAGO_DEL_MONTELLO=M118 +VOLPARA=M119 +VOLPEDO=M120 +VOLPEGLINO=M121 +VOLPIANO=M122 +VOLTA_MANTOVANA=M125 +VOLTAGGIO=M123 +VOLTAGO_AGORDINO=M124 +VOLTERRA=M126 +VOLTIDO=M127 +VOLTURARA_APPULA=M131 +VOLTURARA_IRPINA=M130 +VOLTURINO=M132 +VOLVERA=M133 +VOTTIGNASCO=M136 +YEMEN=Z246 +ZACCANOPOLI=M138 +ZAFFERANA_ETNEA=M139 +ZAGARISE=M140 +ZAGAROLO=M141 +ZAMBANA=M142 +ZAMBIA=Z355 +ZAMBRONE=M143 +ZANDOBBIO=M144 +ZANE'=M145 +ZANICA=M147 +ZANZIBAR=Z356 +ZAPPONETA=M000 +ZAVATTARELLO=M150 +ZECCONE=M152 +ZEDDIANI=M153 +ZELBIO=M156 +ZELO_BUON_PERSICO=M158 +ZELO_SURRIGONE=M160 +ZEME_LOMELLINA=M161 +ZENEVREDO=M162 +ZENSON_DI_PIAVE=M163 +ZERBA=M165 +ZERBO=M166 +ZERBOLO'=M167 +ZERFALIU=M168 +ZERI=M169 +ZERMEGHEDO=M170 +ZERO_BRANCO=M171 +ZEVIO=M172 +ZIANO_DI_FIEMME=M173 +ZIANO_PIACENTINO=L848 +ZIBELLO=M174 +ZIBIDO_SAN_GIACOMO=M176 +ZIGNAGO=M177 +ZIMELLA=M178 +ZIMONE=M179 +ZINASCO=M180 +ZOAGLI=M182 +ZOCCA=M183 +ZOGNO=M184 +ZOLA_PREDOSA=M185 +ZOLDO_ALTO=I345 +ZOLLINO=M187 +ZONE=M188 +ZOPPE'_DI_CADORE=M189 +ZOPPOLA=M190 +ZOVENCEDO=M194 +ZUBIENA=M196 +ZUCCARELLO=M197 +ZUCLO=M198 +ZUGLIANO=M199 +ZUGLIO=M200 +ZUMAGLIA=M201 +ZUMPANO=M202 +ZUNGOLI=M203 +ZUNGRI=M204 diff --git a/decompiled-libs/www/acxent-core-1.0.1/comuni.txt b/decompiled-libs/www/acxent-core-1.0.1/comuni.txt new file mode 100644 index 00000000..29e1433e --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/comuni.txt @@ -0,0 +1,8284 @@ +ABANO TERME;A001 +ABBADIA CERRETO;A004 +ABBADIA LARIANA;A005 +ABBADIA SAN SALVATORE;A006 +ABBASANTA;A007 +ABBATEGGIO;A008 +ABBIATEGRASSO;A010 +ABETONE;A012 +ABRIOLA;A013 +ACATE;A014 +ACCADIA;A015 +ACCEGLIO;A016 +ACCETTURA;A017 +ACCIANO;A018 +ACCUMOLI;A019 +ACERENZA;A020 +ACERNO;A023 +ACERRA;A024 +ACI BONACCORSI;A025 +ACI CASTELLO;A026 +ACI CATENA;A027 +ACI SANT'ANTONIO;A029 +ACIREALE;A028 +ACQUACANINA;A031 +ACQUAFONDATA;A032 +ACQUAFORMOSA;A033 +ACQUAFREDDA;A034 +ACQUALAGNA;A035 +ACQUANEGRA CREMONESE;A039 +ACQUANEGRA SUL CHIESE;A038 +ACQUAPENDENTE;A040 +ACQUAPPESA;A041 +ACQUARICA DEL CAPO;A042 +ACQUARO;A043 +ACQUASANTA TERME;A044 +ACQUASPARTA;A045 +ACQUAVIVA COLLECROCE;A050 +ACQUAVIVA DELLE FONTI;A048 +ACQUAVIVA DI ISERNIA;A051 +ACQUAVIVA PICENA;A047 +ACQUAVIVA PLATANI;A049 +ACQUEDOLCI;M211 +ACQUI TERME;A052 +ACRI;A053 +ACUTO;A054 +ADELFIA;A055 +ADRANO;A056 +ADRARA SAN MARTINO;A057 +ADRARA SAN ROCCO;A058 +ADRIA;A059 +ADRO;A060 +AFFI;A061 +AFFILE;A062 +AFRAGOLA;A064 +AFRICA SUD-OVEST;Z300 +AFRICO;A065 +AGAZZANO;A067 +AGEROLA;A068 +AGGIUS;A069 +AGIRA;A070 +AGLIANA;A071 +AGLIANO;A072 +AGLIE';A074 +AGLIENTU;M848 +AGNA;A075 +AGNADELLO;A076 +AGNANA CALABRA;A077 +AGNONE;A080 +AGNOSINE;A082 +AGORDO;A083 +AGOSTA;A084 +AGRA;A085 +AGRATE BRIANZA;A087 +AGRATE CONTURBIA;A088 +AGRIGENTO;A089 +AGROPOLI;A091 +AGUGLIANO;A092 +AGUGLIARO;A093 +AICURZIO;A096 +AIDOMAGGIORE;A097 +AIDONE;A098 +AIELLI;A100 +AIELLO CALABRO;A102 +AIELLO DEL FRIULI;A103 +AIELLO DEL SABATO;A101 +AIETA;A105 +AILANO;A106 +AILOCHE;A107 +AIRASCA;A109 +AIROLA;A110 +AIROLE;A111 +AIRUNO;A112 +AISONE;A113 +ALA;A116 +ALA' DEI SARDI;A115 +ALA DI STURA;A117 +ALAGNA;A118 +ALAGNA VALSESIA;A119 +ALANNO;A120 +ALANO DI PIAVE;A121 +ALASSIO;A122 +ALATRI;A123 +ALBA;A124 +ALBA ADRIATICA;A125 +ALBAGIARA;A126 +ALBAIRATE;A127 +ALBANELLA;A128 +ALBANIA;Z100 +ALBANO DI LUCANIA;A131 +ALBANO LAZIALE;A132 +ALBANO SANT'ALESSANDRO;A129 +ALBANO VERCELLESE;A130 +ALBAREDO ARNABOLDI;A134 +ALBAREDO D'ADIGE;A137 +ALBAREDO PER SAN MARCO;A135 +ALBARETO;A138 +ALBARETTO DELLA TORRE;A139 +ALBAVILLA;A143 +ALBENGA;A145 +ALBERA LIGURE;A146 +ALBEROBELLO;A149 +ALBERONA;A150 +ALBESE CON CASSANO;A153 +ALBETTONE;A154 +ALBI;A155 +ALBIANO;A158 +ALBIANO D'IVREA;A157 +ALBIATE;A159 +ALBIDONA;A160 +ALBIGNASEGO;A161 +ALBINEA;A162 +ALBINO;A163 +ALBIOLO;A164 +ALBISOLA MARINA;A165 +ALBISOLA SUPERIORE;A166 +ALBIZZATE;A167 +ALBONESE;A171 +ALBOSAGGIA;A172 +ALBUGNANO;A173 +ALBUZZANO;A175 +ALCAMO;A176 +ALCARA LI FUSI;A177 +ALDENO;A178 +ALDINO;A179 +ALES;A180 +ALESSANDRIA;A182 +ALESSANDRIA DEL CARRETTO;A183 +ALESSANDRIA DELLA ROCCA;A181 +ALESSANO;A184 +ALEZIO;A185 +ALFANO;A186 +ALFEDENA;A187 +ALFIANELLO;A188 +ALFIANO NATTA;A189 +ALFONSINE;A191 +ALGERIA;Z301 +ALGHERO;A192 +ALGUA;A193 +ALI';A194 +ALI' TERME;A201 +ALIA;A195 +ALIANO;A196 +ALICE BEL COLLE;A197 +ALICE CASTELLO;A198 +ALICE SUPERIORE;A199 +ALIFE;A200 +ALIMENA;A202 +ALIMINUSA;A203 +ALLAI;A204 +ALLAIN;A205 +ALLEGHE;A206 +ALLERONA;A207 +ALLISTE;A208 +ALLUMIERE;A210 +ALLUVIONI CAMBIO';A211 +ALME';A214 +ALMENNO SAN BARTOLOMEO;A216 +ALMENNO SAN SALVATORE;A217 +ALMESE;A218 +ALONTE;A220 +ALPETTE;A221 +ALPIGNANO;A222 +ALSENO;A223 +ALSERIO;A224 +ALTAMURA;A225 +ALTARE;A226 +ALTAVILLA IRPINA;A228 +ALTAVILLA MILICIA;A229 +ALTAVILLA MONFERRATO;A227 +ALTAVILLA SILENTINA;A230 +ALTAVILLA VICENTINA;A231 +ALTIDONA;A233 +ALTILIA;A234 +ALTINO;A235 +ALTISSIMO;A236 +ALTIVOLE;A237 +ALTO;A238 +ALTO VOLTA;Z354 +ALTOFONTE;A239 +ALTOMONTE;A240 +ALTOPASCIO;A241 +ALVIANO;A242 +ALVIGNANO;A243 +ALVITO;A244 +ALZANO LOMBARDO;A246 +ALZANO SCRIVIA;A245 +ALZATE BRIANZA;A249 +AMALFI;A251 +AMANDOLA;A252 +AMANTEA;A253 +AMARO;A254 +AMARONI;A255 +AMASENO;A256 +AMATO;A257 +AMATRICE;A258 +AMBIVERE;A259 +AMBLAR;A260 +AMEGLIA;A261 +AMELIA;A262 +AMENDOLARA;A263 +AMENO;A264 +AMOROSI;A265 +AMPEZZO;A267 +ANACAPRI;A268 +ANAGNI;A269 +ANCARANO;A270 +ANCONA;A271 +ANDALI;A272 +ANDALO;A274 +ANDALO VALTELLINO;A273 +ANDEZENO;A275 +ANDORA;A278 +ANDORNO MICCA;A280 +ANDORRA;Z101 +ANDRANO;A281 +ANDRATE;A282 +ANDREIS;A283 +ANDRETTA;A284 +ANDRIA;A285 +ANDRIANO;A286 +ANELA;A287 +ANFO;A288 +ANGERA;A290 +ANGHIARI;A291 +ANGIARI;A292 +ANGOLA;Z302 +ANGOLO TERME;A293 +ANGRI;A294 +ANGROGNA;A295 +ANGUILLARA SABAZIA;A297 +ANGUILLARA VENETA;A296 +ANNICCO;A299 +ANNONE DI BRIANZA;A301 +ANNONE VENETO;A302 +ANOIA;A303 +ANTEGNATE;A304 +ANTERIVO;A306 +ANTEY SAINT ANDRE';A305 +ANTICOLI CORRADO;A309 +ANTIGNANO;A312 +ANTILLE BRITANNICHE;Z500 +ANTILLE OLANDESI;Z501 +ANTILLO;A313 +ANTONIMINA;A314 +ANTRODOCO;A315 +ANTRONA SCHIERANCO;A317 +ANVERSA DEGLI ABRUZZI;A318 +ANZANO DEL PARCO;A319 +ANZANO DI PUGLIA;A320 +ANZI;A321 +ANZIO;A323 +ANZOLA DELL'EMILIA;A324 +ANZOLA D'OSSOLA;A325 +AOSTA;A326 +APECCHIO;A327 +APICE;A328 +APIRO;A329 +APOLLOSA;A330 +APPIANO GENTILE;A333 +APPIANO SULLA STRADA DEL VINO;A332 +APPIGNANO;A334 +APPIGNANO DEL TRONTO;A335 +APRICA;A337 +APRICALE;A338 +APRICENA;A339 +APRIGLIANO;A340 +APRILIA;A341 +AQUARA;A343 +AQUILA DI ARROSCIA;A344 +AQUILEIA;A346 +AQUILONIA;A347 +AQUINO;A348 +ARABIA SAUDITA;Z203 +ARADEO;A350 +ARAGONA;A351 +ARAMENGO;A352 +ARBA;A354 +ARBOREA;A357 +ARBORIO;A358 +ARBUS;A359 +ARCADE;A360 +ARCE;A363 +ARCENE;A365 +ARCEVIA;A366 +ARCHI;A367 +ARCIDOSSO;A369 +ARCINAZZO ROMANO;A370 +ARCISATE;A371 +ARCO;A372 +ARCOLA;A373 +ARCOLE;A374 +ARCONATE;A375 +ARCORE;A376 +ARCUGNANO;A377 +ARDARA;A379 +ARDAULI;A380 +ARDEA;M213 +ARDENNO;A382 +ARDESIO;A383 +ARDORE;A385 +ARENA;A386 +ARENA PO;A387 +ARENZANO;A388 +ARESE;A389 +AREZZO;A390 +ARGEGNO;A391 +ARGELATO;A392 +ARGENTA;A393 +ARGENTERA;A394 +ARGENTINA;Z600 +ARGUELLO;A396 +ARGUSTO;A397 +ARI;A398 +ARIANO IRPINO;A399 +ARIANO NEL POLESINE;A400 +ARICCIA;A401 +ARIELLI;A402 +ARIENZO;A403 +ARIGNANO;A405 +ARITZO;A407 +ARIZZANO;A409 +ARLENA DI CASTRO;A412 +ARLUNO;A413 +ARMENO;A414 +ARMENTO;A415 +ARMO;A417 +ARMUNGIA;A419 +ARNAD;A424 +ARNARA;A421 +ARNASCO;A422 +ARNESANO;A425 +AROLA;A427 +ARONA;A429 +AROSIO;A430 +ARPAIA;A431 +ARPAISE;A432 +ARPINO;A433 +ARQUA' PETRARCA;A434 +ARQUA' POLESINA;A435 +ARQUATA DEL TRONTO;A437 +ARQUATA SCRIVIA;A436 +ARRE;A438 +ARRONE;A439 +ARSAGO SEPRIO;A441 +ARSIE';A443 +ARSIERO;A444 +ARSITA;A445 +ARSOLI;A446 +ARTA TERME;A447 +ARTEGNA;A448 +ARTENA;A449 +ARTOGNE;A451 +ARVIER;A452 +ARZACHENA;A453 +ARZAGO D'ADDA;A440 +ARZANA;A454 +ARZANO;A455 +ARZENE;A456 +ARZERGRANDE;A458 +ARZIGNANO;A459 +ASCEA;A460 +ASCIANO;A461 +ASCOLI PICENO;A462 +ASCOLI SATRIANO;A463 +ASCREA;A464 +ASIAGO;A465 +ASIGLIANO VENETO;A467 +ASIGLIANO VERCELLESE;A466 +ASOLA;A470 +ASOLO;A471 +ASSAGO;A473 +ASSEMINI;A474 +ASSISI;A475 +ASSO;A476 +ASSOLO;A477 +ASSORO;A478 +ASTI;A479 +ASUNI;A480 +ATELETA;A481 +ATELLA;A482 +ATENA LUCANA;A484 +ATESSA;A485 +ATINA;A486 +ATRANI;A487 +ATRI;A488 +ATRIPALDA;A489 +ATTIGLIANO;A490 +ATTIMIS;A491 +ATZARA;A492 +AUDITORE;A493 +AUGUSTA;A494 +AULETTA;A495 +AULLA;A496 +AURANO;A497 +AURIGO;A499 +AURONZO DI CADORE;A501 +AUSONIA;A502 +AUSTIS;A503 +AUSTRALIA;Z700 +AUSTRIA;Z102 +AVEGNO;A506 +AVELENGO;A507 +AVELLA;A508 +AVELLINO;A509 +AVERARA;A511 +AVERSA;A512 +AVETRANA;A514 +AVEZZANO;A515 +AVIANO;A516 +AVIATICO;A517 +AVIGLIANA;A518 +AVIGLIANO;A519 +AVIGLIANO UMBRO;A519 +AVIO;A520 +AVISE;A521 +AVOLA;A522 +AVOLASCA;A523 +AYAS;A094 +AYMAVILLES;A108 +AZEGLIO;A525 +AZZANELLO;A526 +AZZANO D'ASTI;A527 +AZZANO DECIMO;A530 +AZZANO MELLA;A529 +AZZANO SAN PAOLO;A528 +AZZATE;A531 +AZZIO;A532 +AZZONE;A533 +BACENO;A534 +BACOLI;A535 +BADALUCCO;A536 +BADESI;M214 +BADIA;A537 +BADIA CALAVENA;A540 +BADIA PAVESE;A538 +BADIA POLESINE;A539 +BADIA TEDALDA;A541 +BADOLATO;A542 +BAGALADI;A544 +BAGHERIA;A546 +BAGNACAVALLO;A547 +BAGNARA CALABRA;A552 +BAGNARA DI ROMAGNA;A551 +BAGNARIA;A550 +BAGNARIA ARSA;A553 +BAGNASCO;A555 +BAGNATICA;A557 +BAGNI DI LUCCA;A560 +BAGNO A RIPOLI;A564 +BAGNO DI ROMAGNA;A565 +BAGNOLI DEL TRIGNO;A567 +BAGNOLI DI SOPRA;A568 +BAGNOLI IRPINO;A566 +BAGNOLO CREMASCO;A570 +BAGNOLO DEL SALENTO;A572 +BAGNOLO DI PO;A574 +BAGNOLO IN PIANO;A573 +BAGNOLO MELLA;A569 +BAGNOLO PIEMONTE;A571 +BAGNOLO SAN VITO;A575 +BAGNONE;A576 +BAGNOREGIO;A577 +BAGOLINO;A578 +BAHAMAS;Z502 +BAHREIN;Z204 +BAIA E LATINA;A579 +BAIANO;A580 +BAIARDO;A581 +BAIRO;A584 +BAISO;A586 +BALANGERO;A587 +BALDICHIERI D'ASTI;A588 +BALDISSERO CANAVESE;A590 +BALDISSERO D'ALBA;A589 +BALDISSERO TORINESE;A591 +BALESTRATE;A592 +BALESTRINO;A593 +BALLABIO;A594 +BALLAO;A597 +BALME;A599 +BALMUCCIA;A600 +BALOCCO;A601 +BALSORANO;A603 +BALVANO;A604 +BALZOLA;A605 +BANARI;A606 +BANCHETTE;A607 +BANNIO ANZINO;A610 +BANZI;A612 +BAONE;A613 +BARADILI;A614 +BARAGIANO;A615 +BARANELLO;A616 +BARANO D'ISCHIA;A617 +BARASSO;A619 +BARATILI SAN PIETRO;A621 +BARBANIA;A625 +BARBARA;A626 +BARBARANO ROMANO;A628 +BARBARANO VICENTINO;A627 +BARBARESCO;A629 +BARBARIGA;A630 +BARBATA;A631 +BARBERINO DI MUGELLO;A632 +BARBERINO VAL D'ELSA;A633 +BARBIANELLO;A634 +BARBIANO;A635 +BARBONA;A637 +BARCELLONA POZZO DI GOTTO;A638 +BARCHI;A639 +BARCIS;A640 +BARD;A643 +BARDELLO;A645 +BARDI;A646 +BARDINETO;A647 +BARDOLINO;A650 +BARDONECCHIA;A651 +BAREGGIO;A652 +BARENGO;A653 +BARESSA;A655 +BARETE;A656 +BARGA;A657 +BARGAGLI;A658 +BARGE;A660 +BARGHE;A661 +BARI;A662 +BARI SARDO;A663 +BARIANO;A664 +BARICELLA;A665 +BARILE;A666 +BARISCIANO;A667 +BARLASSINA;A668 +BARLETTA;A669 +BARNI;A670 +BAROLO;A671 +BARONE CANAVESE;A673 +BARONISSI;A674 +BARRAFRANCA;A676 +BARRALI;A677 +BARREA;A678 +BARUMINI;A681 +BARZAGO;A683 +BARZANA;A684 +BARZANO';A686 +BARZIO;A687 +BASALUZZO;A689 +BASCAPE';A690 +BASCHI;A691 +BASCIANO;A692 +BASELGA DI PINE';A694 +BASELICE;A696 +BASIANO;A697 +BASICO';A698 +BASIGLIO;A699 +BASILIANO;A700 +BASSANO BRESCIANO;A702 +BASSANO DEL GRAPPA;A703 +BASSANO IN TEVERINA;A706 +BASSANO ROMANO;A704 +BASSIANO;A707 +BASSIGNANA;A708 +BASTIA;A710 +BASTIA MONDOVI';A709 +BASTIDA DE' DOSSI;A711 +BASTIDA PANCARANA;A712 +BASTIGLIA;A713 +BASUTOLAND;Z303 +BATTAGLIA TERME;A714 +BATTIFOLLO;A716 +BATTIPAGLIA;A717 +BATTUDA;A718 +BAUCINA;A719 +BAULADU;A721 +BAUNEI;A722 +BAVENO;A725 +BAZZANO;A726 +BECIUANIA;Z304 +BEDERO VALCUVIA;A728 +BEDIZZOLE;A729 +BEDOLLO;A730 +BEDONIA;A731 +BEDULITA;A732 +BEE;A733 +BEINASCO;A734 +BEINETTE;A735 +BELCASTRO;A736 +BELFIORE;A737 +BELFORTE ALL'ISAURO;A740 +BELFORTE DEL CHIENTI;A739 +BELFORTE MONFERRATO;A738 +BELGIO;Z103 +BELGIOIOSO;A741 +BELGIRATE;A742 +BELLA;A743 +BELLAGIO;A744 +BELLANO;A745 +BELLANTE;A746 +BELLARIA IGEA MARINA;A747 +BELLEGRA;A749 +BELLINO;A750 +BELLINZAGO LOMBARDO;A751 +BELLINZAGO NOVARESE;A752 +BELLONA;A755 +BELLOSGUARDO;A756 +BELLUNO;A757 +BELLUSCO;A759 +BELMONTE CALABRO;A762 +BELMONTE CASTELLO;A763 +BELMONTE DEL SANNIO;A761 +BELMONTE IN SABINA;A765 +BELMONTE MEZZAGNO;A764 +BELMONTE PICENO;A760 +BELPASSO;A766 +BELSITO;A768 +BELVEDERE DI SPINELLO;A772 +BELVEDERE LANGHE;A774 +BELVEDERE MARITTIMO;A773 +BELVEDERE OSTRENSE;A769 +BELVEGLIO;A770 +BELVI;A776 +BEMA;A777 +BENE LARIO;A778 +BENE VAGIENNA;A779 +BENESTARE;A780 +BENETUTTI;A781 +BENEVELLO;A782 +BENEVENTO;A783 +BENNA;A784 +BENTIVOGLIO;A785 +BERBENNO;A786 +BERBENNO DI VALTELLINA;A787 +BERCETO;A788 +BERCHIDDA;A789 +BEREGAZZO CON FIGLIARO;A791 +BEREGUARDO;A792 +BERGAMASCO;A793 +BERGAMO;A794 +BERGEGGI;A796 +BERGOLO;A798 +BERLINGO;A799 +BERMUDE;Z400 +BERNALDA;A801 +BERNAREGGIO;A802 +BERNATE TICINO;A804 +BERNEZZO;A805 +BERRA;A806 +BERSONE;A808 +BERTINORO;A809 +BERTIOLO;A810 +BERTONICO;A811 +BERZANO DI SAN PIETRO;A812 +BERZANO DI TORTONA;A813 +BERZO DEMO;A816 +BERZO INFERIORE;A816 +BERZO SAN FERMO;A815 +BESANA IN BRIANZA;A818 +BESANO;A819 +BESATE;A820 +BESENELLO;A821 +BESENZONE;A823 +BESNATE;A825 +BESOZZO;A826 +BESSUDE;A827 +BETTOLA;A831 +BETTONA;A832 +BEURA CARDEZZA;A834 +BEVAGNA;A835 +BEVERINO;A836 +BEVILACQUA;A837 +BEZZECCA;A839 +BHUTAN;Z205 +BIANCAVILLA;A841 +BIANCHI;A842 +BIANCO;A843 +BIANDRATE;A844 +BIANDRONNO;A845 +BIANZANO;A846 +BIANZE';A847 +BIANZONE;A848 +BIASSONO;A849 +BIBBIANO;A850 +BIBBIENA;A851 +BIBBONA;A852 +BIBIANA;A853 +BICCARI;A854 +BICINICCO;A855 +BIDONI';A856 +BIELLA;A859 +BIENNO;A861 +BIENO;A863 +BIENTINA;A864 +BIGARELLO;A866 +BINAGO;A870 +BINASCO;A872 +BINETTO;A874 +BIOGLIO;A876 +BIONAZ;A877 +BIONE;A878 +BIRMANIA;Z206 +BIRORI;A880 +BISACCIA;A881 +BISACQUINO;A882 +BISCEGLIE;A883 +BISEGNA;A884 +BISENTI;A885 +BISIGNANO;A887 +BISTAGNO;A889 +BISUSCHIO;A891 +BITETTO;A892 +BITONTO;A893 +BITRITTO;A894 +BITTI;A895 +BIVONA;A896 +BIVONGI;A897 +BIZZARONE;A898 +BLEGGIO INFERIORE;A901 +BLEGGIO SUPERIORE;A902 +BLELLO;A903 +BLERA;A857 +BLESSAGNO;A904 +BLEVIO;A905 +BLUFI;A000 +BOARA PISANI;A906 +BOBBIO;A909 +BOBBIO PELLICE;A910 +BOCA;A911 +BOCCHIGLIERO;A912 +BOCCIOLETO;A914 +BOCENAGO;A916 +BODIO LOMNAGO;A918 +BOFFALORA D'ADDA;A919 +BOFFALORA SOPRA TICINO;A920 +BOGLIASCO;A922 +BOGNANCO;A925 +BOGOGNO;A929 +BOIANO;A930 +BOISSANO;A931 +BOLANO;A932 +BOLBENO;A933 +BOLGARE;A937 +BOLIVIA;Z601 +BOLLATE;A940 +BOLLENGO;A941 +BOLOGNA;A944 +BOLOGNANO;A945 +BOLOGNETTA;A946 +BOLOGNOLA;A947 +BOLOTANA;A948 +BOLSENA;A949 +BOLTIERE;A950 +BOLZANO;A952 +BOLZANO NOVARESE;A953 +BOLZANO VICENTINA;A954 +BOMARZO;A955 +BOMBA;A956 +BOMPENSIERE;A957 +BOMPIETRO;A958 +BOMPORTO;A959 +BONARCADO;A960 +BONASSOLA;A961 +BONATE SOPRA;A963 +BONATE SOTTO;A962 +BONAVIGO;A964 +BONDENO;A965 +BONDO;A967 +BONDONE;A968 +BONEA;A970 +BONEFRO;A971 +BONEMERSE;A972 +BONIFATI;A973 +BONITO;A975 +BONNANARO;A976 +BONO;A977 +BONORVA;A978 +BONVICINO;A979 +BORBONA;A981 +BORCA DI CADORE;A982 +BORDANO;A983 +BORDIGHERA;A984 +BORDOLANO;A986 +BORE;A987 +BORETTO;A988 +BORGARELLO;A989 +BORGARO TORINESE;A990 +BORGETTO;A991 +BORGHETTO D'ARROSCIA;A993 +BORGHETTO DI BORBERA;A998 +BORGHETTO DI VARA;A992 +BORGHETTO LODIGIANO;A995 +BORGHETTO SANTO SPIRITO;A999 +BORGHI;B001 +BORGIA;B002 +BORGIALLO;B003 +BORGIO VEREZZI;B005 +BORGO A MOZZANO;B007 +BORGO D'ALE;B009 +BORGO DI TERZO;B010 +BORGO PACE;B026 +BORGO PRIOLO;B028 +BORGO SAN DALMAZZO;B033 +BORGO SAN GIACOMO;B035 +BORGO SAN GIOVANNI;B017 +BORGO SAN LORENZO;B036 +BORGO SAN MARTINO;B037 +BORGO SAN SIRO;B038 +BORGO TICINO;B043 +BORGO TOSSIGNANO;B044 +BORGO VAL DI TARO;B042 +BORGO VALSUGANA;B006 +BORGO VELINO;A996 +BORGO VERCELLI;B046 +BORGOFORTE;B011 +BORGOFRANCO D'IVREA;B015 +BORGOFRANCO SUL PO;B013 +BORGOLAVEZZARO;B016 +BORGOMALE;B018 +BORGOMANERO;B019 +BORGOMARO;B020 +BORGOMASINO;B021 +BORGONE SUSA;B024 +BORGONOVO VAL TIDONE;B025 +BORGORATTO ALESSANDRINO;B029 +BORGORATTO MORMOROLO;B030 +BORGORICCO;B031 +BORGOROSE;B008 +BORGOSATOLLO;B040 +BORGOSESIA;B041 +BORMIDA;B048 +BORMIO;B049 +BORNASCO;B051 +BORNO;B054 +BORONEDDU;B055 +BORORE;B056 +BORRELLO;B057 +BORRIANA;B058 +BORSO DEL GRAPPA;B061 +BORTIGALI;B062 +BORTIGIADAS;B063 +BORUTTA;B064 +BORZONASCA;B067 +BOSA;B068 +BOSARO;B069 +BOSCHI SANT'ANNA;B070 +BOSCO CHIESANUOVA;B073 +BOSCO MARENGO;B071 +BOSCONERO;B075 +BOSCOREALE;B076 +BOSCOTRECASE;B077 +BOSENTINO;B078 +BOSIA;B079 +BOSIO;B080 +BOSISIO PARINI;B081 +BOSNASCO;B082 +BOSSICO;B083 +BOSSOLASCO;B084 +BOTRICELLO;B085 +BOTRUGNO;B086 +BOTTANUCO;B088 +BOTTICINO;B091 +BOTTIDDA;B094 +BOVA;B097 +BOVA MARINA;B099 +BOVALINO;B098 +BOVEGNO;B100 +BOVES;B101 +BOVEZZO;B102 +BOVILLE ERNICA;A720 +BOVINO;B104 +BOVISIO MASCIAGO;B105 +BOVOLENTA;B106 +BOVOLONE;B107 +BOZZOLE;B109 +BOZZOLO;B110 +BRA;B111 +BRACCA;B112 +BRACCIANO;B114 +BRACIGLIANO;B115 +BRAIES PRAGS;B116 +BRALLO DI PREGOLA;B117 +BRANCALEONE;B118 +BRANDICO;B120 +BRANDIZZO;B121 +BRANZI;B123 +BRAONE;B124 +BRASILE;Z602 +BREBBIA;B126 +BREDA DI PIAVE;B128 +BREGANO;B131 +BREGANZE;B132 +BREGNANO;B134 +BREGUZZO;B135 +BREIA;B136 +BREMBATE;B137 +BREMBATE DI SOPRA;B138 +BREMBILLA;B140 +BREMBIO;B141 +BREME;B142 +BRENDOLA;B143 +BRENNA;B144 +BRENNERO;B145 +BRENO;B149 +BRENTA;B150 +BRENTINO BELLUNO;B152 +BRENTONICO;B153 +BRENZONE;B154 +BRESCELLO;B156 +BRESCIA;B157 +BRESIMO;B158 +BRESSANA BOTTARONE;B159 +BRESSANONE;B160 +BRESSANVIDO;B161 +BRESSO;B162 +BREZ;B165 +BREZZO DI BEDERO;B166 +BRIAGLIA;B167 +BRIATICO;B169 +BRICHERASIO;B171 +BRIENNO;B172 +BRIENZA;B173 +BRIGA ALTA;B175 +BRIGA NOVARESE;B176 +BRIGNANO FRASCATA;B179 +BRIGNANO GERA D'ADDA;B178 +BRINDISI;B180 +BRINDISI MONTAGNA;B181 +BRINZIO;B182 +BRIONA;B183 +BRIONE;B184 +BRIONE;B185 +BRIOSCO;B187 +BRISIGHELLA;B188 +BRISSAGO VALTRAVAGLIA;B191 +BRISSOGNE;B192 +BRITTOLI;B193 +BRIVIO;B194 +BROCCOSTELLA;B195 +BROGLIANO;B196 +BROGNATURO;B197 +BROLO;B198 +BRONDELLO;B200 +BRONI;B201 +BRONTE;B202 +BRONZOLO;B203 +BROSSASCO;B204 +BROSSO;B205 +BROVELLO CARPUGNINO;B207 +BROZOLO;B209 +BRUGHERIO;B212 +BRUGINE;B213 +BRUGNATO;B214 +BRUGNERA;B215 +BRUINO;B216 +BRUMANO;B217 +BRUNATE;B218 +BRUNEI;Z207 +BRUNELLO;B219 +BRUNICO;B220 +BRUNO;B221 +BRUSAPORTO;B223 +BRUSASCO;B225 +BRUSCIANO;B227 +BRUSIMPIANO;B228 +BRUSNENGO;B229 +BRUSSON;B230 +BRUZOLO;B232 +BRUZZANO ZEFFIRIO;B234 +BUBBIANO;B235 +BUBBIO;B236 +BUCCHERI;B237 +BUCCHIANICO;B238 +BUCCIANO;B239 +BUCCINASCO;B240 +BUCCINO;B242 +BUCINE;B243 +BUDDUSO';B246 +BUDOIA;B247 +BUDONI;B248 +BUDRIO;B249 +BUGGERRU;B250 +BUGGIANO;B251 +BUGLIO IN MONTE;B255 +BUGNARA;B256 +BUGUGGIATE;B258 +BUIA;B259 +BULCIAGO;B261 +BULGARIA;Z104 +BULGAROGRASSO;B262 +BULTEI;B264 +BULZI;B265 +BUONABITACOLO;B266 +BUONALBERGO;B267 +BUONCONVENTO;B269 +BUONVICINO;B270 +BURAGO DI MOLGORA;B272 +BURCEI;B274 +BURGIO;B275 +BURGOS;B276 +BURIASCO;B278 +BUROLO;B279 +BURONZO;B280 +BURUNDI;Z305 +BUSACHI;B281 +BUSALLA;B282 +BUSANA;B283 +BUSANO;B284 +BUSCA;B285 +BUSCATE;B286 +BUSCEMI;B287 +BUSETO PALIZZOLO;B288 +BUSNAGO;B289 +BUSSERO;B292 +BUSSETO;B293 +BUSSI SUL TIRINO;B294 +BUSSO;B295 +BUSSOLENGO;B296 +BUSSOLENO;B297 +BUSTO ARSIZIO;B300 +BUSTO GAROLFO;B301 +BUTERA;B302 +BUTI;B303 +BUTTAPIETRA;B304 +BUTTIGLIERA D'ASTI;B306 +BUTTRIO;B309 +BUTTUGLIERA ALTA;B305 +CA' D'ANDREA;B320 +CABELLA LIGURE;B311 +CABIATE;B313 +CABRAS;B314 +CACCAMO;B315 +CACCURI;B319 +CADEGLIANO VICONAGO;B326 +CADELBOSCO DI SOPRA;B328 +CADEO;B332 +CADERZONE;B335 +CADONEGHE;B345 +CADORAGO;B346 +CADREZZATE;B347 +CAERANO DI SAN MARCO;B349 +CAFASSE;B350 +CAGGIANO;B351 +CAGLI;B352 +CAGLIARI;B354 +CAGLIO;B355 +CAGNANO AMITERNO;B358 +CAGNANO VARANO;B357 +CAGNO;B359 +CAGNO';B360 +CAIANELLO;B361 +CAIAZZO;B362 +CAINES;B364 +CAINO;B365 +CAIOLO;B366 +CAIRANO;B367 +CAIRATE;B368 +CAIRO MONTENOTTE;B369 +CAIVANO;B371 +CALABRITTO;B374 +CALALZO DI CADORE;B375 +CALAMANDRANA;B376 +CALAMONACI;B377 +CALANGIANUS;B378 +CALANNA;B379 +CALASCA CASTIGLIONE;B380 +CALASCIBETTA;B381 +CALASCIO;B382 +CALASETTA;B383 +CALATABIANO;B384 +CALATAFIMI;B385 +CALAVINO;B386 +CALCATA;B388 +CALCERANICA AL LAGO;B389 +CALCI;B390 +CALCIANO;B391 +CALCINAIA;B392 +CALCINATE;B393 +CALCINATO;B394 +CALCIO;B395 +CALCO;B396 +CALDARO SULLA STRADA DEL VINO;B397 +CALDAROLA;B398 +CALDERARA DI RENO;B399 +CALDES;B400 +CALDIERO;B402 +CALDOGNO;B403 +CALDONAZZO;B404 +CALENDASCO;B405 +CALENZANO;B406 +CALESTANO;B408 +CALICE AL CORNOVIGLIO;B410 +CALICE LIGURE;B409 +CALIMERA;B413 +CALITRI;B415 +CALIZZANO;B416 +CALLABIANA;B417 +CALLIANO;B418 +CALLIANO;B419 +CALOLZIOCORTE;B423 +CALOPEZZATI;B424 +CALOSSO;B425 +CALOVETO;B426 +CALTABELLOTTA;B427 +CALTAGIRONE;B428 +CALTANISSETTA;B429 +CALTAVUTURO;B430 +CALTIGNAGA;B431 +CALTO;B432 +CALTRANO;B433 +CALUSCO D'ADDA;B434 +CALUSO;B435 +CALVAGESE DELLA RIVIERA;B436 +CALVANICO;B437 +CALVATONE;B439 +CALVELLO;B440 +CALVENE;B441 +CALVENZANO;B442 +CALVERA;B443 +CALVI;B444 +CALVI DELL'UMBRIA;B446 +CALVI RISORTA;B445 +CALVIGNANO;B447 +CALVIGNASCO;B448 +CALVISANO;B450 +CALVIZZANO;B452 +CAMAGNA MONFERRATO;B453 +CAMAIORE;B455 +CAMAIRAGO;B456 +CAMANDONA;B457 +CAMASTRA;B460 +CAMBIAGO;B461 +CAMBIANO;B462 +CAMBIASCA;B463 +CAMBOGIA;Z208 +CAMBURZANO;B465 +CAMERANA;B467 +CAMERANO;B468 +CAMERANO CASASCO;B469 +CAMERATA CORNELLO;B471 +CAMERATA NUOVA;B472 +CAMERATA PICENA;B470 +CAMERI;B473 +CAMERINO;B474 +CAMEROTA;B476 +CAMIGLIANO;B477 +CAMINATA;B479 +CAMINI;B481 +CAMINO;B482 +CAMINO AL TAGLIAMENTO;B483 +CAMISANO;B484 +CAMISANO VICENTINO;B485 +CAMMARATA;B486 +CAMO;B489 +CAMOGLI;B490 +CAMPAGNA;B492 +CAMPAGNA LUPIA;B493 +CAMPAGNANO DI ROMA;B496 +CAMPAGNATICO;B497 +CAMPAGNOLA CREMASCA;B498 +CAMPAGNOLA EMILIA;B499 +CAMPANA;B500 +CAMPARADA;B501 +CAMPEGINE;B502 +CAMPELLO SUL CLITUNNO;B504 +CAMPERTOGNO;B505 +CAMPI BISENZIO;B507 +CAMPI SALENTINA;B506 +CAMPIGLIA CERVO;B508 +CAMPIGLIA DEI BERICI;B511 +CAMPIGLIA MARITTIMA;B509 +CAMPIGLIONE FENILE;B512 +CAMPIONE D'ITALIA;B513 +CAMPITELLO DI FASSA;B514 +CAMPLI;B515 +CAMPO CALABRO;B516 +CAMPO DI GIOVE;B526 +CAMPO DI TRENS;B529 +CAMPO LIGURE;B538 +CAMPO NELL'ELBA;B553 +CAMPO SAN MARTINO;B564 +CAMPO TURES;B570 +CAMPOBASSO;B519 +CAMPOBELLO DI LICATA;B520 +CAMPOBELLO DI MAZARA;B521 +CAMPOCHIARO;B522 +CAMPODARSEGO;B524 +CAMPODENNO;B525 +CAMPODIMELE;B527 +CAMPODIPIETRA;B528 +CAMPODOLCINO;B530 +CAMPODORO;B531 +CAMPOFELICE DI FITALIA;B533 +CAMPOFELICE DI ROCCELLA;B532 +CAMPOFILONE;B534 +CAMPOFIORITO;B535 +CAMPOFORMIDO;B536 +CAMPOFRANCO;B537 +CAMPOGALLIANO;B539 +CAMPOLATTARO;B541 +CAMPOLI APPENNINO;B543 +CAMPOLI DEL MONTE TABURNO;B542 +CAMPOLIETO;B544 +CAMPOLONGO AL TORRE;B545 +CAMPOLONGO MAGGIORE;B546 +CAMPOLONGO SUL BRENTA;B547 +CAMPOMAGGIORE;B549 +CAMPOMARINO;B550 +CAMPOMORONE;B551 +CAMPONOGARA;B554 +CAMPORA;B555 +CAMPOREALE;B556 +CAMPORGIANO;B557 +CAMPOROSSO;B559 +CAMPOROTONDO DI FIASTRONE;B562 +CAMPOROTONDO ETNEO;B561 +CAMPOSAMPIERO;B563 +CAMPOSANO;B565 +CAMPOSANTO;B566 +CAMPOSPINOSO;B567 +CAMPOTOSTO;B569 +CAMUGNANO;B572 +CANADA;Z401 +CANAL SAN BOVO;B577 +CANALE;B573 +CANALE D'AGORDO;B574 +CANALE DI PANAMA;Z517 +CANALE MONTERANO;B576 +CANARO;B578 +CANAZEI;B579 +CANCELLARA;B580 +CANCELLO ED ARNONE;B581 +CANDA;B582 +CANDELA;B584 +CANDELO;B586 +CANDIA CANAVESE;B588 +CANDIA LOMELLINA;B587 +CANDIANA;B589 +CANDIDA;B590 +CANDIDONI;B591 +CANDIOLO;B592 +CANEGRATE;B593 +CANELLI;B594 +CANEPINA;B597 +CANEVA;B598 +CANEVINO;B599 +CANICATTI';B602 +CANICATTINI BAGNI;B603 +CANINO;B604 +CANISCHIO;B605 +CANISTRO;B606 +CANNA;B607 +CANNALONGA;B608 +CANNARA;B609 +CANNERO RIVIERA;B610 +CANNETO PAVESE;B613 +CANNETO SULL'OGLIO;B612 +CANNOBIO;B615 +CANNOLE;B616 +CANOLO;B617 +CANONICA D'ADDA;B618 +CANOSA DI PUGLIA;B619 +CANOSA SANNITA;B620 +CANOSIO;B621 +CANSANO;B624 +CANTAGALLO;B626 +CANTALICE;B627 +CANTALUPA;B628 +CANTALUPO IN SABINA;B631 +CANTALUPO LIGURE;B629 +CANTALUPO NEL SANNIO;B630 +CANTARANA;B633 +CANTELLO;B634 +CANTERANO;B635 +CANTIANO;B636 +CANTOIRA;B637 +CANTU';B639 +CANZANO;B640 +CANZO;B641 +CAORLE;B642 +CAORSO;B643 +CAPACCIO;B644 +CAPACI;B645 +CAPALBIO;B646 +CAPANNOLI;B647 +CAPANNORI;B648 +CAPENA;B649 +CAPERGNANICA;B650 +CAPESTRANO;B651 +CAPIAGO INTIMIANO;B653 +CAPISTRANO;B655 +CAPISTRELLO;B656 +CAPITIGNANO;B658 +CAPIZZI;B660 +CAPIZZONE;B661 +CAPO DI PONTE;B664 +CAPO D'ORLANDO;B666 +CAPO VERDE;Z307 +CAPODIMONTE;B663 +CAPODRISE;B667 +CAPOLIVERI;B669 +CAPOLONA;B670 +CAPONAGO;B671 +CAPORCIANO;B672 +CAPOSELE;B674 +CAPOTERRA;B675 +CAPOVALLE;B676 +CAPPADOCIA;B677 +CAPPELLA CANTONE;B679 +CAPPELLA DE' PICENARDI;B680 +CAPPELLA MAGGIORE;B678 +CAPPELLE SUL TAVO;B681 +CAPRACOTTA;B682 +CAPRAIA E LIMITE;B684 +CAPRAIA ISOLA;B685 +CAPRALBA;B686 +CAPRANICA;B688 +CAPRANICA PRENESTINA;B687 +CAPRARICA DI LECCE;B690 +CAPRAROLA;B691 +CAPRAUNA;B692 +CAPRESE MICHELANGELO;B693 +CAPREZZO;B694 +CAPRI;B696 +CAPRI LEONE;B695 +CAPRIANA;B697 +CAPRIANO DEL COLLE;B698 +CAPRIATA D'ORBA;B701 +CAPRIATE SAN GERVASIO;B703 +CAPRIATI A VOLTURNO;B704 +CAPRIE;B705 +CAPRIGLIA IRPINA;B706 +CAPRIGLIO;B707 +CAPRILE;B708 +CAPRINO BERGAMASCO;B710 +CAPRINO VERONESE;B709 +CAPRIOLO;B711 +CAPRIVA DEL FRIULI;B712 +CAPUA;B715 +CAPURSO;B716 +CARAFFA DEL BIANCO;B718 +CARAFFA DI CATANZARO;B717 +CARAGLIO;B719 +CARAMAGNA PIEMONTE;B720 +CARAMANICO TERME;B722 +CARANO;B723 +CARAPELLE;B724 +CARAPELLE CALVISIO;B725 +CARASCO;B726 +CARASSAI;B727 +CARATE BRIANZA;B729 +CARATE URIO;B730 +CARAVAGGIO;B731 +CARAVATE;B732 +CARAVINO;B733 +CARAVONICA;B734 +CARBOGNANO;B735 +CARBONARA AL TICINO;B741 +CARBONARA DI NOLA;B740 +CARBONARA DI PO;B739 +CARBONARA SCRIVIA;B736 +CARBONATE;B742 +CARBONE;B743 +CARBONERA;B744 +CARBONIA;B745 +CARCARE;B748 +CARCERI;B749 +CARCOFORO;B752 +CARDANO AL CAMPO;B754 +CARDE';B755 +CARDETO;B756 +CARDINALE;B758 +CARDITO;B759 +CAREGGINE;B760 +CAREMA;B762 +CARENNO;B763 +CARENTINO;B765 +CARERI;B766 +CARESANA;B767 +CARESANABLOT;B768 +CAREZZANO;B769 +CARFIZZI;B771 +CARGEGHE;B772 +CARIATI;B774 +CARIFE;B776 +CARIGNANO;B777 +CARIMATE;B778 +CARINARO;B779 +CARINI;B780 +CARINOLA;B781 +CARISIO;B782 +CARISOLO;B783 +CARLANTINO;B784 +CARLAZZO;B786 +CARLENTINI;B787 +CARLINO;B788 +CARLOFORTE;B789 +CARLOPOLI;B790 +CARMAGNOLA;B791 +CARMIANO;B792 +CARMIGNANO;B794 +CARMIGNANO DI BRENTA;B795 +CARNAGO;B796 +CARNATE;B798 +CAROBBIO DEGLI ANGELI;B801 +CAROLEI;B802 +CARONA;B803 +CARONIA;B804 +CARONNO PERTUSELLA;B805 +CARONNO VARESINO;B807 +CAROSINO;B808 +CAROVIGNO;B809 +CAROVILLI;B810 +CARPANETO PIACENTINO;B812 +CARPANZANO;B813 +CARPASIO;B814 +CARPEGNA;B816 +CARPENEDOLO;B817 +CARPENETO;B818 +CARPI;B819 +CARPIANO;B820 +CARPIGNANO SALENTINO;B822 +CARPIGNANO SESIA;B823 +CARPINETI;B825 +CARPINETO DELLA NORA;B827 +CARPINETO ROMANO;B828 +CARPINETO SINELLO;B826 +CARPINO;B829 +CARPINONE;B830 +CARRARA;B832 +CARRARA SAN GIORGIO;B833 +CARRARA SANTO STEFANO;B834 +CARRE';B835 +CARREGA LIGURE;B836 +CARRO;B838 +CARRODANO;B839 +CARROSIO;B840 +CARRU';B841 +CARSOLI;B842 +CARTIGLIANO;B844 +CARTIGNANO;B845 +CARTOCETO;B846 +CARTOSIO;B847 +CARTURA;B848 +CARUGATE;B850 +CARUGO;B851 +CARUNCHIO;B853 +CARVICO;B854 +CARZANO;B856 +CASABONA;B857 +CASACALENDA;B858 +CASACANDITELLA;B859 +CASAGIOVE;B860 +CASAL CERMELLI;B870 +CASAL DI PRINCIPE;B872 +CASAL VELINO;B895 +CASALANGUIDA;B861 +CASALATTICO;B862 +CASALBELTRAME;B864 +CASALBORDINO;B865 +CASALBORE;B866 +CASALBORGONE;B867 +CASALBUONO;B868 +CASALBUTTANO ED UNITI;B869 +CASALCIPRANO;B871 +CASALDUNI;B873 +CASALE CORTE CERRO;B876 +CASALE CREMASCO VIDOLASCO;B881 +CASALE DI SCODOSIA;B877 +CASALE LITTA;B875 +CASALE MARITTIMO;B878 +CASALE MONFERRATO;B885 +CASALE SUL SILE;B879 +CASALECCHIO DI RENO;B880 +CASALEGGIO BOIRO;B882 +CASALEGGIO NOVARA;B883 +CASALEONE;B886 +CASALETTO CEREDANO;B889 +CASALETTO DI SOPRA;B890 +CASALETTO LODIGIANO;B887 +CASALETTO SPARTANO;B888 +CASALETTO VAPRIO;B891 +CASALFIUMANESE;B892 +CASALGRANDE;B893 +CASALGRASSO;B894 +CASALINCONTRADA;B896 +CASALINO;B897 +CASALMAGGIORE;B898 +CASALMAIOCCO;B899 +CASALMORANO;B900 +CASALMORO;B901 +CASALNOCETO;B902 +CASALNUOVO DI NAPOLI;B905 +CASALNUOVO MONTEROTARO;B904 +CASALOLDO;B907 +CASALPUSTERLENGO;B910 +CASALROMANO;B911 +CASALSERUGO;B912 +CASALUCE;B916 +CASALVECCHIO DI PUGLIA;B917 +CASALVECCHIO SICULO;B918 +CASALVIERI;B919 +CASALVOLONE;B920 +CASALZUIGNO;B921 +CASAMARCIANO;B922 +CASAMASSIMA;B923 +CASAMICCIOLA TERME;B924 +CASANDRINO;B925 +CASANOVA ELVO;B928 +CASANOVA LERRONE;B927 +CASANOVA LONATI;B929 +CASAPE;B932 +CASAPESENNA;H798 +CASAPINTA;B933 +CASAPROTA;B934 +CASAPULLA;B935 +CASARANO;B936 +CASARGO;B937 +CASARILE;B938 +CASARSA DELLA DELIZIA;B940 +CASARZA LIGURE;B939 +CASASCO;B941 +CASASCO D'INTELVI;B942 +CASATENOVO;B943 +CASATISMA;B945 +CASAVATORE;B946 +CASAZZA;B947 +CASCIA;B948 +CASCIAGO;B949 +CASCIANA TERME;B559 +CASCINA;B950 +CASCINETTE D'IVREA;B953 +CASEI GEROLA;B954 +CASELETTE;B955 +CASELLA;B956 +CASELLE IN PITTARI;B959 +CASELLE LANDI;B961 +CASELLE LURANI;B958 +CASELLE TORINESE;B960 +CASERTA;B963 +CASIER;B965 +CASIGNANA;B966 +CASINA;B967 +CASIRATE D'ADDA;B971 +CASLINO D'ERBA;B974 +CASNATE CON BERNATE;B977 +CASNIGO;B978 +CASOLA DI NAPOLI;B980 +CASOLA IN LUNIGIANA;B979 +CASOLA VALSENIO;B982 +CASOLE BRUZIO;B983 +CASOLE D'ELSA;B984 +CASOLI;B985 +CASORATE PRIMO;B988 +CASORATE SEMPIONE;B987 +CASOREZZO;B989 +CASORIA;B990 +CASORZO;B991 +CASPERIA;A472 +CASPOGGIO;B993 +CASSACCO;B994 +CASSAGO BRIANZA;B996 +CASSANO ALLO IONIO;C002 +CASSANO D'ADDA;C003 +CASSANO DELLE MURGE;B998 +CASSANO IRPINO;B997 +CASSANO MAGNAGO;C004 +CASSANO SPINOLA;C005 +CASSANO VALCUVIA;B999 +CASSARO;C006 +CASSIGLIO;C007 +CASSINA DE' PECCHI;C014 +CASSINA RIZZARDI;C020 +CASSINA VALSASSINA;C024 +CASSINASCO;C022 +CASSINE;C027 +CASSINELLE;C030 +CASSINETTA DI LUGAGNANO;C033 +CASSINO;C034 +CASSOLA;C037 +CASSOLNOVO;C038 +CASTAGNARO;C041 +CASTAGNETO CARDUCCI;C044 +CASTAGNETO PO;C045 +CASTAGNITO;C046 +CASTAGNOLE DELLE LANZE;C049 +CASTAGNOLE MONFERRATO;C047 +CASTAGNOLE PIEMONTE;C048 +CASTANA;C050 +CASTANO PRIMO;C052 +CASTEGGIO;C053 +CASTEGNATO;C055 +CASTEGNERO;C056 +CASTEL BARONIA;C058 +CASTEL BOGLIONE;C064 +CASTEL BOLOGNESE;C065 +CASTEL CAMPAGNANO;B494 +CASTEL CASTAGNA;C040 +CASTEL COLONNA;C071 +CASTEL CONDINO;C000 +CASTEL D'AIANO;C075 +CASTEL D'ARIO;C076 +CASTEL D'AZZANO;C078 +CASTEL DEL GIUDICE;C082 +CASTEL DEL MONTE;C083 +CASTEL DEL PIANO;C085 +CASTEL DEL RIO;C086 +CASTEL DI CASIO;B969 +CASTEL DI IERI;C090 +CASTEL DI IUDICA;C091 +CASTEL DI LAMA;C093 +CASTEL DI LUCIO;C094 +CASTEL DI SANGRO;C096 +CASTEL DI SASSO;C097 +CASTEL DI TORA;C098 +CASTEL FOCOGNANO;C102 +CASTEL FRENTANO;C114 +CASTEL GABBIANO;C115 +CASTEL GANDOLFO;C116 +CASTEL GIORGIO;C117 +CASTEL GOFFREDO;C118 +CASTEL GUELFO DI BOLOGNA;C121 +CASTEL MADAMA;C203 +CASTEL MAGGIORE;C204 +CASTEL MELLA;C208 +CASTEL MOLA;C210 +CASTEL MORRONE;C211 +CASTEL RITALDI;C252 +CASTEL ROCCHERO;C253 +CASTEL ROZZONE;C255 +CASTEL SAN GIORGIO;C259 +CASTEL SAN GIOVANNI;C261 +CASTEL SAN LORENZO;C262 +CASTEL SAN NICCOLO';C263 +CASTEL SAN PIETRO ROMANO;C266 +CASTEL SAN PIETRO TERME;C265 +CASTEL SAN VINCENZO;C270 +CASTEL SANT'ANGELO;C268 +CASTEL SANT'ELIA;C269 +CASTEL VISCARDO;C289 +CASTEL VITTORIO;C110 +CASTEL VOLTURNO;C291 +CASTELBALDO;C057 +CASTELBELFORTE;C059 +CASTELBELLINO;C060 +CASTELBELLO CIARDES;C062 +CASTELBIANCO;C063 +CASTELBOTTACCIO;C066 +CASTELBUONO;C067 +CASTELCIVITA;C069 +CASTELCOVATI;C072 +CASTELCUCCO;C073 +CASTELDACCIA;C074 +CASTELDELCI;C080 +CASTELDELFINO;C081 +CASTELDIDONE;C089 +CASTELFIDARDO;C100 +CASTELFIORENTINO;C101 +CASTELFONDO;C103 +CASTELFORTE;C104 +CASTELFRANCI;C105 +CASTELFRANCO DI SOPRA;C112 +CASTELFRANCO DI SOTTO;C113 +CASTELFRANCO EMILIA;C107 +CASTELFRANCO IN MISCANO;C106 +CASTELFRANCO VENETO;C111 +CASTELGOMBERTO;C119 +CASTELGRANDE;C120 +CASTELGUGLIELMO;C122 +CASTELGUIDONE;C123 +CASTELLABATE;C125 +CASTELLAFIUME;C126 +CASTELL'ALFERO;C127 +CASTELLALTO;C128 +CASTELLAMMARE DEL GOLFO;C130 +CASTELLAMMARE DI STABIA;C129 +CASTELLAMONTE;C133 +CASTELLANA GROTTE;C134 +CASTELLANA SICULA;C135 +CASTELLANETA;C136 +CASTELLANIA;C137 +CASTELLANZA;C139 +CASTELLAR;C140 +CASTELLAR GUIDOBONO;C142 +CASTELLARANO;C141 +CASTELLARO;C143 +CASTELL'ARQUATO;C145 +CASTELLAVAZZO;C146 +CASTELL'AZZARA;C147 +CASTELLAZZO BORMIDA;C148 +CASTELLAZZO NOVARESE;C149 +CASTELLEONE;C153 +CASTELLEONE DI SUASA;C152 +CASTELLERO;C154 +CASTELLETTO CERVO;C155 +CASTELLETTO D'ERRO;C156 +CASTELLETTO DI BRANDUZZO;C157 +CASTELLETTO D'ORBA;C158 +CASTELLETTO MERLI;C160 +CASTELLETTO MOLINA;C161 +CASTELLETTO MONFERRATO;C162 +CASTELLETTO SOPRA TICINO;C166 +CASTELLETTO STURA;C165 +CASTELLETTO UZZONE;C167 +CASTELLI;C169 +CASTELLI CALEPIO;C079 +CASTELLINA IN CHIANTI;C172 +CASTELLINA MARITTIMA;C174 +CASTELLINALDO;C173 +CASTELLINO DEL BIFERNO;C175 +CASTELLINO TANARO;C176 +CASTELLIRI;C177 +CASTELLO CABIAGLIO;B312 +CASTELLO D'AGOGNA;C184 +CASTELLO D'ARGILE;C185 +CASTELLO DEL MATESE;C178 +CASTELLO DELL'ACQUA;C186 +CASTELLO DI ANNONE;A300 +CASTELLO DI BRIANZA;C187 +CASTELLO DI CISTERNA;C188 +CASTELLO DI GODEGO;C190 +CASTELLO DI SERRAVALLE;C191 +CASTELLO MOLINA DI FIEMME;C189 +CASTELLO TESINO;C194 +CASTELLUCCHIO;C195 +CASTELLUCCIO DEI SAURI;C198 +CASTELLUCCIO INFERIORE;C199 +CASTELLUCCIO SUPERIORE;C201 +CASTELLUCCIO VALMAGGIORE;C202 +CASTELL'UMBERTO;C051 +CASTELMAGNO;C205 +CASTELMARTE;C206 +CASTELMASSA;C207 +CASTELMAURO;C197 +CASTELMEZZANO;C209 +CASTELNOVETTO;C213 +CASTELNOVO BARIANO;C215 +CASTELNOVO DEL FRIULI;C217 +CASTELNOVO DI SOTTO;C218 +CASTELNOVO NE'MONTI;C219 +CASTELNUOVO;C216 +CASTELNUOVO BELBO;C226 +CASTELNUOVO BERARDENGA;C227 +CASTELNUOVO BOCCA D'ADDA;C228 +CASTELNUOVO BORMIDA;C229 +CASTELNUOVO BOZZENTE;C220 +CASTELNUOVO CALCEA;C230 +CASTELNUOVO CILENTO;C231 +CASTELNUOVO DEL GARDA;C225 +CASTELNUOVO DELLA DAUNIA;C222 +CASTELNUOVO DI CEVA;C214 +CASTELNUOVO DI CONZA;C235 +CASTELNUOVO DI FARFA;C224 +CASTELNUOVO DI GARFAGNANA;C236 +CASTELNUOVO DI PORTO;C237 +CASTELNUOVO DI VAL DI CECINA;C244 +CASTELNUOVO DON BOSCO;C232 +CASTELNUOVO MAGRA;C240 +CASTELNUOVO NIGRA;C241 +CASTELNUOVO PARANO;C223 +CASTELNUOVO RANGONE;C242 +CASTELNUOVO SCRIVIA;C243 +CASTELPAGANO;C245 +CASTELPETROSO;C246 +CASTELPIZZUTO;C247 +CASTELPLANIO;C248 +CASTELPOTO;C250 +CASTELRAIMONDO;C251 +CASTELROTTO;C254 +CASTELSANTANGELO SUL NERA;C267 +CASTELSARACENO;C271 +CASTELSARDO;C272 +CASTELSEPRIO;C273 +CASTELSILANO;B968 +CASTELSPINA;C274 +CASTELTERMINI;C275 +CASTELVECCANA;C181 +CASTELVECCHIO CALVISIO;C278 +CASTELVECCHIO DI ROCCA BARBENA;C276 +CASTELVECCHIO SUBEQUO;C279 +CASTELVENERE;C280 +CASTELVERDE;B129 +CASTELVERRINO;C200 +CASTELVETERE IN VAL FORTORE;C284 +CASTELVETERE SUL CALORE;C283 +CASTELVETRANO;C286 +CASTELVETRO DI MODENA;C287 +CASTELVETRO PIACENTINO;C288 +CASTELVISCONTI;C290 +CASTENASO;C292 +CASTENEDOLO;C293 +CASTIGLION FIBOCCHI;C318 +CASTIGLION FIORENTINO;C319 +CASTIGLIONE A CASAURIA;C308 +CASTIGLIONE CHIAVARESE;C302 +CASTIGLIONE COSENTINO;C301 +CASTIGLIONE D'ADDA;C304 +CASTIGLIONE DEI PEPOLI;C296 +CASTIGLIONE DEL GENOVESI;C306 +CASTIGLIONE DEL LAGO;C309 +CASTIGLIONE DELLA PESCAIA;C310 +CASTIGLIONE DELLE STIVIERE;C312 +CASTIGLIONE DI GARFAGNANA;C303 +CASTIGLIONE DI SICILIA;C297 +CASTIGLIONE D'INTELVI;C299 +CASTIGLIONE D'ORCIA;C313 +CASTIGLIONE FALLETTO;C314 +CASTIGLIONE IN TEVERINA;C315 +CASTIGLIONE MESSER MARINO;C298 +CASTIGLIONE MESSER RAIMONDO;C316 +CASTIGLIONE OLONA;C300 +CASTIGLIONE TINELLA;C317 +CASTIGLIONE TORINESE;C307 +CASTIGNANO;C321 +CASTILENTI;C322 +CASTINO;C323 +CASTIONE ANDEVENNO;C325 +CASTIONE DELLA PRESOLANA;C324 +CASTIONS DI STRADA;C327 +CASTIRAGA VIDARDO;C329 +CASTO;C330 +CASTORANO;C331 +CASTREZZATO;C332 +CASTRI DI LECCE;C334 +CASTRIGNANO DE'GRECI;C335 +CASTRIGNANO DEL CAPO;C336 +CASTRO;C337 +CASTRO;C338 +CASTRO DEI VOLSCI;C338 +CASTROCARO TERME;C339 +CASTROCIELO;C340 +CASTROFILIPPO;C341 +CASTROLIBERO;C108 +CASTRONNO;C343 +CASTRONUOVO DI SANT'ANDREA;C345 +CASTRONUOVO DI SICILIA;C344 +CASTROPIGNANO;C346 +CASTROREALE;C347 +CASTROREGIO;C348 +CASTROVILLARI;C349 +CATANIA;C351 +CATANZARO;C352 +CATENANUOVA;C353 +CATIGNANO;C354 +CATTOLICA;C357 +CATTOLICA ERACLEA;C356 +CAULONIA;C285 +CAUTANO;C359 +CAVA DE'TIRRENI;C361 +CAVA MANARA;C360 +CAVACURTA;C362 +CAVAGLIA;C363 +CAVAGLIETTO;C364 +CAVAGLIO D'AGOGNA;C365 +CAVAGLIO SPOCCIA;C367 +CAVAGNOLO;C369 +CAVAION VERONESE;C370 +CAVALESE;C372 +CAVALLASCA;C374 +CAVALLERLEONE;C375 +CAVALLERMAGGIORE;C376 +CAVALLINO;C377 +CAVALLIRIO;C378 +CAVARENO;C380 +CAVARGNA;C381 +CAVARIA CON PREMEZZO;C382 +CAVARZERE;C383 +CAVASO DEL TOMBA;C384 +CAVASSO NUOVO;C385 +CAVATORE;C387 +CAVAZZO CARNICO;C389 +CAVE;C390 +CAVEDAGO;C392 +CAVEDINE;C393 +CAVENAGO D'ADDA;C394 +CAVENAGO DI BRIANZA;C395 +CAVERNAGO;C396 +CAVEZZO;C398 +CAVIZZANA;C400 +CAVOUR;C404 +CAVRIAGO;C405 +CAVRIANA;C406 +CAVRIGLIA;C407 +CAZZAGO BRABBIA;C409 +CAZZAGO SAN MARTINO;C408 +CAZZANO DI TRAMIGNA;C412 +CAZZANO SANT'ANDREA;C410 +CECCANO;C413 +CECIMA;C414 +CECINA;C415 +CECOSLOVACCHIA;Z105 +CEDEGOLO;C417 +CEDRASCO;C418 +CEFALA' DIANA;C420 +CEFALU';C421 +CEGGIA;C422 +CEGLIE MESSAPICO;C424 +CELANO;C426 +CELENZA SUL TRIGNO;C428 +CELENZA VALFORTORE;C429 +CELICO;C430 +CELLA DATI;C435 +CELLA MONTE;C432 +CELLAMARE;C436 +CELLARA;C437 +CELLARENGO;C438 +CELLATICA;C439 +CELLE DI BULGHERIA;C444 +CELLE DI MACRA;C441 +CELLE DI SAN VITO;C442 +CELLE ENOMONDO;C440 +CELLE LIGURE;C443 +CELLENO;C446 +CELLERE;C447 +CELLINO ATTANASIO;C449 +CELLINO SAN MARCO;C448 +CELLIO;C450 +CELLOLE;C000 +CEMBRA;C452 +CENADI;C453 +CENATE SOPRA;C456 +CENATE SOTTO;C457 +CENCENIGHE AGORDINO;C458 +CENE;C459 +CENESELLI;C461 +CENGIO;C463 +CENTA SAN NICOLO';C467 +CENTALLO;C466 +CENTO;C469 +CENTOLA;C470 +CENTRACHE;C472 +CENTURIPE;C471 +CEPAGATTI;C474 +CEPPALONI;C476 +CEPPO MORELLI;C478 +CEPRANO;C479 +CERAMI;C480 +CERANESI;C481 +CERANO;C483 +CERANO D'INTELVI;C482 +CERANOVA;C484 +CERASO;C485 +CERCEMAGGIORE;C486 +CERCENASCO;C487 +CERCEPICCOLA;C488 +CERCHIARA DI CALABRIA;C489 +CERCHIO;C492 +CERCINO;C493 +CERCIVENTO;C494 +CERCOLA;C495 +CERDA;C496 +CEREA;C498 +CEREGNANO;C500 +CERENZIA;C501 +CERES;C497 +CERESARA;C502 +CERESETO;C503 +CERESOLE ALBA;C504 +CERESOLE REALE;C505 +CERETE;C506 +CERETTO LOMELLINA;C508 +CERGNAGO;C509 +CERIALE;C510 +CERIANA;C511 +CERIANO LAGHETTO;C512 +CERIGNALE;C513 +CERIGNOLA;C514 +CERISANO;C515 +CERMENATE;C516 +CERMES;A022 +CERMIGNANO;C517 +CERNOBBIO;C520 +CERNUSCO LOMBARDONE;C521 +CERNUSCO SUL NAVIGLIO;C523 +CERRETO CASTELLO;C526 +CERRETO D'ASTI;C528 +CERRETO D'ESI;C524 +CERRETO DI SPOLETO;C527 +CERRETO GRUE;C507 +CERRETO GUIDI;C529 +CERRETO LAZIALE;C518 +CERRETO SANNITA;C525 +CERRETTO DELLE LANGHE;C530 +CERRINA MONFERRATO;C531 +CERRIONE;C532 +CERRO AL LAMBRO;C536 +CERRO AL VOLTURNO;C534 +CERRO MAGGIORE;C537 +CERRO TANARO;C533 +CERRO VERONESE;C538 +CERSOSIMO;C539 +CERTALDO;C540 +CERTOSA DI PAVIA;C541 +CERVA;C542 +CERVARA DI ROMA;C543 +CERVARESE SANTA CROCE;C544 +CERVARO;C545 +CERVASCA;C547 +CERVATTO;C548 +CERVENO;C549 +CERVERE;C550 +CERVESINA;C551 +CERVETERI;C552 +CERVIA;C553 +CERVICATI;C554 +CERVIGNANO D'ADDA;C555 +CERVIGNANO DEL FRIULI;C556 +CERVINARA;C557 +CERVINO;C558 +CERVO;C559 +CERZETO;C560 +CESA;C561 +CESANA BRIANZA;C563 +CESANA TORINESE;C564 +CESANO BOSCONE;C565 +CESANO MADERNO;C566 +CESARA;C567 +CESARO';C568 +CESATE;C569 +CESENA;C573 +CESENATICO;C574 +CESINALI;C576 +CESIO;C578 +CESIOMAGGIORE;C577 +CESSALTO;C580 +CESSANITI;C581 +CESSAPALOMBO;C582 +CESSOLE;C583 +CETARA;C584 +CETO;C585 +CETONA;C587 +CETRARO;C588 +CEVA;C589 +CEVO;C591 +CEYLON;Z209 +CHALLANT SAINT VICTOR;C594 +CHALLANT SAINT'ANSELME;C593 +CHAMBAVE;C595 +CHAMOIS;B491 +CHAMPDEPRAZ;C596 +CHAMPORCHER;B540 +CHARVENSOD;C598 +CHATILLON;C294 +CHERASCO;C599 +CHEREMULE;C600 +CHIALAMBERTO;C604 +CHIAMPO;C605 +CHIANCHE;C606 +CHIANCIANO TERME;C608 +CHIANNI;C609 +CHIANOCCO;C610 +CHIARAMONTE GULFI;C612 +CHIARAMONTI;C613 +CHIARANO;C614 +CHIARAVALLE;C615 +CHIARAVALLE CENTRALE;C616 +CHIARI;C618 +CHIAROMONTE;C619 +CHIAUCI;C620 +CHIAVARI;C621 +CHIAVENNA;C623 +CHIAVERANO;C624 +CHIENES;C625 +CHIERI;C627 +CHIES D'ALPAGO;C630 +CHIESA IN VALMALENCO;C628 +CHIESANUOVA;C629 +CHIESINA UZZANESE;C631 +CHIETI;C632 +CHIEUTI;C633 +CHIEVE;C634 +CHIGNOLO D'ISOLA;C635 +CHIGNOLO PO;C637 +CHIOGGIA;C638 +CHIOMONTE;C639 +CHIONS;C640 +CHIOPRIS VISCONE;C641 +CHITIGNANO;C648 +CHIUDUNO;C649 +CHIUPPANO;C650 +CHIURO;C651 +CHIUSA;C652 +CHIUSA DI PESIO;C653 +CHIUSA DI SAN MICHELE;C655 +CHIUSA SCLAFANI;C654 +CHIUSAFORTE;C656 +CHIUSANICO;C657 +CHIUSANO D'ASTI;C658 +CHIUSANO DI SAN DOMENICO;C659 +CHIUSAVECCHIA;C660 +CHIUSDINO;C661 +CHIUSI;C662 +CHIUSI DELLA VERNA;C663 +CHIVASSO;C665 +CIAD;Z309 +CIAMPINO;C000 +CIANCIANA;C668 +CIANO D'ENZA;C669 +CIBIANA DI CADORE;C672 +CICAGNA;C673 +CICALA;C674 +CICCIANO;C675 +CICERALE;C676 +CICILIANO;C677 +CICOGNOLO;C678 +CICONIO;C679 +CIGLIANO;C680 +CIGLIE';C681 +CIGOGNOLA;C684 +CIGOLE;C685 +CILAVEGNA;C686 +CILE;Z603 +CIMADOLMO;C689 +CIMBERGO;C691 +CIMEGO;C694 +CIMINA';C695 +CIMINNA;C696 +CIMITILE;C697 +CIMOLAIS;C699 +CIMONE;C700 +CINA;Z210 +CINAGLIO;C701 +CINETO ROMANO;C702 +CINGIA DE'BOTTI;C703 +CINGOLI;C704 +CINIGIANO;C705 +CINISELLO BALSAMO;C707 +CINISI;C708 +CINO;C709 +CINQUEFRONDI;C710 +CINTANO;C711 +CINTE TESINO;C712 +CINTO CAOMAGGIORE;C714 +CINTO EUGANEO;C713 +CINZANO;C715 +CIORLANO;C716 +CIPRESSA;C718 +CIPRO;Z211 +CIRCELLO;C719 +CIRIE';C722 +CIRIGLIANO;C723 +CIRIMIDO;C724 +CIRO';C725 +CIRO' MARINA;C726 +CIS;C727 +CISANO BERGAMASCO;C728 +CISANO SUL NEVA;C729 +CISERANO;C730 +CISLAGO;C732 +CISLIANO;C733 +CISMON DEL GRAPPA;C734 +CISON DI VALMARINO;C735 +CISSONE;C738 +CISTERNA D'ASTI;C739 +CISTERNA DI LATINA;C740 +CISTERNINO;C741 +CITERNA;C742 +CITTA' DELLA PIEVE;C744 +CITTA' DI CASTELLO;C745 +CITTA' SANT'ANGELO;C750 +CITTA`DEL VATICANO;Z106 +CITTADELLA;C743 +CITTADUCALE;C746 +CITTANOVA;C747 +CITTAREALE;C749 +CITTIGLIO;C751 +CIVATE;C752 +CIVENNA;C754 +CIVEZZA;C755 +CIVEZZANO;C756 +CIVIASCO;C757 +CIVIDALE DEL FRIULI;C758 +CIVIDATE AL PIANO;C759 +CIVIDATE CAMUNO;C760 +CIVITA;C763 +CIVITA CASTELLANA;C765 +CIVITA D'ANTINO;C766 +CIVITACAMPOMARANO;C764 +CIVITALUPARELLA;C768 +CIVITANOVA DEL SANNIO;C769 +CIVITANOVA MARCHE;C770 +CIVITAQUANA;C771 +CIVITAVECCHIA;C773 +CIVITELLA ALFEDENA;C778 +CIVITELLA CASANOVA;C779 +CIVITELLA D'AGLIANO;C780 +CIVITELLA DEL TRONTO;C781 +CIVITELLA DI ROMAGNA;C777 +CIVITELLA IN VAL DI CHIANA;C774 +CIVITELLA MESSER RAIMONDO;C776 +CIVITELLA PAGANICO;C782 +CIVITELLA ROVETO;C783 +CIVITELLA SAN PAOLO;C784 +CIVO;C785 +CLAINO CON OSTENO;C787 +CLAUT;C790 +CLAUZETTO;C791 +CLAVESANA;C792 +CLAVIERE;C793 +CLES;C794 +CLETO;C795 +CLIVIO;C796 +CLOZ;C797 +CLUSONE;C800 +COASSOLO TORINESE;C801 +COAZZE;C803 +COAZZOLO;C804 +COCCAGLIO;C806 +COCCONATO;C807 +COCQUIO TREVISAGO;C810 +COCULLO;C811 +CODEVIGO;C812 +CODEVILLA;C813 +CODIGORO;C814 +CODOGNE';C815 +CODOGNO;C816 +CODROIPO;C817 +CODRONGIANUS;C818 +COGGIOLA;C819 +COGLIATE;C820 +COGNE;C821 +COGOLETO;C823 +COGOLLO DEL CENGIO;C824 +COGORNO;C826 +COLAZZA;C829 +COLBORDOLO;C830 +COLCAVAGNO;C831 +COLERE;C835 +COLFELICE;C836 +COLI;C838 +COLICO;C839 +COLLAGNA;C840 +COLLALTO SABINO;C841 +COLLARMELE;C844 +COLLAZZONE;C845 +COLLE BRIANZA;C851 +COLLE D'ANCHISE;C854 +COLLE DI TORA;C857 +COLLE DI VAL D'ELSA;C847 +COLLE SAN MAGNO;C870 +COLLE SANNITA;C846 +COLLE SANTA LUCIA;C872 +COLLE UMBERTO;C848 +COLLEBEATO;C850 +COLLECCHIO;C852 +COLLECORVINO;C853 +COLLEDARA;C311 +COLLEDIMACINE;C855 +COLLEDIMEZZO;C856 +COLLEFERRO;C858 +COLLEGIOVE;C859 +COLLEGNO;C860 +COLLELONGO;C862 +COLLEPARDO;C864 +COLLEPASSO;C865 +COLLEPIETRO;C866 +COLLERETTO CASTELNUOVO;C867 +COLLERETTO GIACOSA;C868 +COLLESALVETTI;C869 +COLLESANO;C871 +COLLETORTO;C875 +COLLEVECCHIO;C876 +COLLI A VOLTURNO;C878 +COLLI DEL TRONTO;C877 +COLLI SUL VELINO;C880 +COLLIANO;C879 +COLLINAS;C882 +COLLIO;C883 +COLLOBIANO;C884 +COLLOREDO DI MONTE ALBANO;C885 +COLMURANO;C886 +COLOBRARO;C888 +COLOGNA VENETA;C890 +COLOGNE;C893 +COLOGNO AL SERIO;C894 +COLOGNO MONZESE;C895 +COLOGNOLA AI COLLI;C897 +COLOMBIA;Z604 +COLONNA;C900 +COLONNELLA;C901 +COLONNO;C902 +COLORINA;C903 +COLORNO;C904 +COLOSIMI;C905 +COLTURANO;C908 +COLZATE;C910 +COMABBIO;C911 +COMACCHIO;C912 +COMANO;C914 +COMAZZO;C917 +COMEGLIANS;C918 +COMELICO SUPERIORE;C920 +COMERIO;C922 +COMEZZANO CIZZAGO;C925 +COMIGNAGO;C926 +COMISO;C927 +COMITINI;C928 +COMIZIANO;C929 +COMMESSAGGIO;C930 +COMMEZZADURA;C931 +COMO;C933 +COMPIANO;C934 +COMUN NUOVO;C937 +COMUNANZA;C935 +CONA;C938 +CONCA CASALE;C941 +CONCA DEI MARINI;C940 +CONCA DELLA CAMPANIA;C939 +CONCAMARISE;C943 +CONCEI;C944 +CONCERVIANO;C946 +CONCESIO;C948 +CONCO;C949 +CONCORDIA SAGITTARIA;C950 +CONCORDIA SULLA SECCHIA;C951 +CONCOREZZO;C952 +CONDINO;C953 +CONDOFURI;C954 +CONDOVE;C955 +CONDRO';C956 +CONEGLIANO;C957 +CONFIENZA;C958 +CONFIGNI;C959 +CONFLENTI;C960 +CONGO;Z311 +CONGO LEOPODVILLE;Z312 +CONIOLO;C962 +CONSELICE;C963 +CONSELVE;C964 +CONSIGLIO DI RUMO;C965 +CONTARINA;C967 +CONTESSA ENTELLINA;C968 +CONTIGLIANO;C969 +CONTRADA;C971 +CONTROGUERRA;C972 +CONTRONE;C973 +CONTURSI TERME;C974 +CONVERSANO;C975 +CONZA DELLA CAMPANIA;C976 +CONZANO;C977 +COPERTINO;C978 +COPIANO;C979 +COPPARO;C980 +CORANA;C982 +CORATO;C983 +CORBARA;C984 +CORBETTA;C986 +CORBOLA;C987 +CORCHIANO;C988 +CORCIANO;C990 +CORDENONS;C991 +CORDIGNANO;C992 +CORDOVADO;C993 +COREA DEL NORD;Z214 +COREA DEL SUD;Z213 +COREDO;C994 +COREGLIA ANTELMINELLI;C996 +COREGLIA LIGURE;C995 +CORENO AUSONIO;C998 +CORFINIO;C999 +CORI;D003 +CORIANO;D004 +CORIGLIANO CALABRO;D005 +CORIGLIANO D'OTRANTO;D006 +CORINALDO;D007 +CORIO;D008 +CORLEONE;D009 +CORLETO MONFORTE;D011 +CORLETO PERTICARA;D010 +CORMANO;D013 +CORMONS;D014 +CORNA IMAGNA;D015 +CORNALBA;D016 +CORNALE;D017 +CORNAREDO;D018 +CORNATE D'ADDA;D019 +CORNEDO ALL'ISARCO;B799 +CORNEDO VICENTINO;D020 +CORNEGLIANO LAUDENSE;D021 +CORNELIANO D'ALBA;D022 +CORNIGLIO;D026 +CORNO DI ROSAZZO;D027 +CORNO GIOVINE;D028 +CORNOVECCHIO;D029 +CORNUDA;D030 +CORREGGIO;D037 +CORREZZANA;D038 +CORREZZOLA;D040 +CORRIDO;D041 +CORRIDONIA;D042 +CORROPOLI;D043 +CORSANO;D044 +CORSICO;D045 +CORSIONE;D046 +CORTACCIA SULLA STRADA DEL VIN;D048 +CORTALE;D049 +CORTANDONE;D050 +CORTANZE;D051 +CORTAZZONE;D052 +CORTE BRUGNATELLA;D054 +CORTE DE'CORTESI CON CIGNONE;D056 +CORTE DE'FRATI;D057 +CORTE FRANCA;D058 +CORTE PALASIO;D068 +CORTEMAGGIORE;D061 +CORTEMILIA;D062 +CORTENO GOLGI;D064 +CORTENOVA;D065 +CORTENUOVA;D066 +CORTEOLONA;D067 +CORTIGLIONE;D072 +CORTINA D'AMPEZZO;A266 +CORTINA SULLA STRADA DEL VINO;D075 +CORTINO;D076 +CORTONA;D077 +CORVARA;D078 +CORVARA IN BADIA;D079 +CORVINO SAN QUIRICO;D081 +CORZANO;D082 +COSEANO;D085 +COSENZA;D086 +COSIO DI ARROSCIA;D087 +COSIO VALTELLINO;D088 +COSOLETO;D089 +COSSANO BELBO;D093 +COSSANO CANAVESE;D092 +COSSATO;D094 +COSSERIA;D095 +COSSIGNANO;D096 +COSSOGNO;D099 +COSSOINE;D100 +COSSOMBRATO;D101 +COSTA D'AVORIO;Z313 +COSTA DEI PIRATI;Z215 +COSTA DE'NOBILI;D109 +COSTA DI MEZZATE;D110 +COSTA DI ROVIGO;D105 +COSTA DI SERINA;D111 +COSTA MASNAGA;D112 +COSTA RICA;Z503 +COSTA VALLE IMAGNA;D103 +COSTA VESCOVATO;D102 +COSTA VOLPINO;D117 +COSTABISSARA;D107 +COSTACCIARO;D108 +COSTANZANA;D113 +COSTARAINERA;D114 +COSTERMANO;D118 +COSTIGLIOLE D'ASTI;D119 +COSTIGLIOLE SALUZZO;D120 +COTIGNOLA;D121 +COTRONEI;D123 +COTTANELLO;D124 +COURMAYEUR;D012 +COVO;D126 +COZZO;D127 +CRACO;D128 +CRANDOLA VALSASSINA;D131 +CRAVAGLIANA;D132 +CRAVANZANA;D133 +CRAVEGGIA;D134 +CREAZZO;D136 +CRECCHIO;D137 +CREDARO;D139 +CREDERA RUBBIANO;D141 +CREMA;D142 +CREMELLA;D143 +CREMENAGA;D144 +CREMENO;D145 +CREMIA;D147 +CREMOLINO;D149 +CREMONA;D150 +CREMOSANO;D151 +CRESCENTINO;D154 +CRESPADORO;D156 +CRESPANO DEL GRAPPA;D157 +CRESPELLANO;D158 +CRESPIATICA;D159 +CRESPINA;D160 +CRESPINO;D161 +CRESSA;D162 +CREVACUORE;D165 +CREVALCORE;D166 +CREVOLADOSSOLA;D168 +CRISPANO;D170 +CRISPIANO;D171 +CRISSOLO;D172 +CROCEFIESCHI;D175 +CROCETTA DEL MONTELLO;C670 +CRODO;D177 +CROGNALETO;D179 +CROPALATI;D180 +CROPANI;D181 +CROSA;D182 +CROSIA;D184 +CROSIO DELLA VALLE;D185 +CROTONE;D122 +CROTTA D'ADDA;D186 +CROVA;D187 +CROVIANA;D188 +CRUCOLI;D189 +CUASSO AL MONTE;D192 +CUBA;Z504 +CUCCARO MONFERRATO;D194 +CUCCARO VETERE;D195 +CUCCIAGO;D196 +CUCEGLIO;D197 +CUGGIONO;D198 +CUGLIATE FABIASCO;D199 +CUGLIERI;D200 +CUGNOLI;D201 +CUMIANA;D202 +CUMIGNANO SUL NAVIGLIO;D203 +CUNARDO;D204 +CUNEO;D205 +CUNEVO;D206 +CUNICO;D207 +CUORGNE';D208 +CUPELLO;D209 +CUPRA MARITTIMA;D210 +CUPRAMONTANA;D211 +CURA CARPIGNANO;B824 +CUREGGIO;D216 +CURIGLIA CON MONTEVIASCO;D217 +CURINGA;D218 +CURINO;D219 +CURNO;D221 +CURON VENOSTA;D222 +CURSI;D223 +CURSOLO ORASSO;D225 +CURTAROLO;D226 +CURTATONE;D227 +CURTI;D228 +CUSAGO;D229 +CUSANO MILANINO;D231 +CUSANO MUTRI;D230 +CUSINO;D232 +CUSIO;D233 +CUSTONACI;D234 +CUTIGLIANO;D235 +CUTRO;D236 +CUTROFIANO;D237 +CUVEGLIO;D238 +CUVIO;D239 +DAHOMEY;Z314 +DAIANO;D243 +DAIRAGO;D244 +DALMINE;D245 +DAMBEL;D246 +DANIMARCA;Z107 +DANTA DI CADORE;D247 +DAONE;D248 +DARE';D250 +DARFO BOARIO TERME;D251 +DASA';D253 +DAVAGNA;D255 +DAVERIO;D256 +DAVOLI;D257 +DAZIO;D258 +DECIMOMANNU;D259 +DECIMOPUTZU;D260 +DECOLLATURA;D261 +DEGO;D264 +DEIVA MARINA;D265 +DELEBIO;D266 +DELIA;D267 +DELIANUOVA;D268 +DELICETO;D269 +DELLO;D270 +DEMONTE;D271 +DENICE;D272 +DENNO;D273 +DERNICE;D277 +DEROVERE;D278 +DERUTA;D279 +DERVIO;D280 +DESANA;D281 +DESENZANO DEL GARDA;D284 +DESIO;D286 +DESULO;D287 +DIAMANTE;D289 +DIANO ARENTINO;D293 +DIANO CASTELLO;D296 +DIANO D'ALBA;D291 +DIANO MARINA;D297 +DIANO SAN PIETRO;D298 +DICOMANO;D299 +DIGNANO;D300 +DIMARO;D302 +DINAMI;D303 +DIPIGNANO;D304 +DISO;D305 +DIVIGNANO;D309 +DIZZASCO;D310 +DOBBIACO;D311 +DOBERDO' DEL LAGO;D312 +DOGLIANI;D314 +DOGLIOLA;D315 +DOGNA;D316 +DOLCE';D317 +DOLCEACQUA;D318 +DOLCEDO;D319 +DOLEGNA DEL COLLIO;D321 +DOLIANOVA;D323 +DOLO;D325 +DOLZAGO;D327 +DOMANICO;D328 +DOMASO;D329 +DOMEGGE DI CADORE;D330 +DOMICELLA;D331 +DOMODOSSOLA;D332 +DOMUS DE MARIA;D333 +DOMUSNOVAS;D334 +DON;D336 +DONADA;D337 +DONATO;D339 +DONGO;D341 +DONNAZ;D338 +DONORI;D344 +DORGALI;D345 +DORIO;D346 +DORMELLETTO;D347 +DORNO;D348 +DORSINO;D349 +DORZANO;D350 +DOSOLO;D351 +DOSSENA;D352 +DOSSO DEL LIRO;D355 +DOUES;D356 +DOVADOLA;D357 +DOVERA;D358 +DOZZA;D360 +DRAGONI;D361 +DRAPIA;D364 +DRENA;D365 +DRENCHIA;D366 +DRESANO;D367 +DREZZO;D369 +DRIZZONA;D370 +DRO';D371 +DRONERO;D372 +DRUENTO;D373 +DRUOGNO;D374 +DUALCHI;D376 +DUBINO;D377 +DUEVILLE;D379 +DUGENTA;D380 +DUINO AURISINA;D383 +DUMENZA;D384 +DUNO;D385 +DURAZZANO;D386 +DURONIA;C772 +DUSINO SAN MICHELE;D388 +EBOLI;D390 +ECUADOR;Z605 +EDOLO;D391 +EGITTO;Z336 +EGNA;D392 +EL SALVADOR;Z506 +ELICE;D394 +ELINI;D395 +ELLO;D398 +ELVA;D401 +EMARESE;D402 +EMPOLI;D403 +ENDINE GAIANO;D406 +ENEGO;D407 +ENEMONZO;D408 +ENNA;C342 +ENTRACQUE;D410 +ENTRATICO;D411 +ENVIE;D412 +EPISCOPIA;D414 +ERACLEA;D415 +ERBA;D416 +ERBE';D419 +ERBEZZO;D420 +ERBUSCO;D421 +ERCHIE;D422 +ERCOLANO;H243 +ERICE;D423 +ERLI;D424 +ERTO E CASSO;D426 +ERVE;D428 +ESANATOGLIA;D429 +ESCALAPLANO;D430 +ESCOLCA;D431 +ESINE;D434 +ESINO LARIO;D436 +ESPERIA;D440 +ESPORLATU;D441 +ESTE;D442 +ESTERZILI;D443 +ETIOPIA;Z315 +ETROUBLES;D444 +EUPILIO;D445 +EXILLES;D433 +FABBRICA CURONE;D447 +FABBRICHE DI VALLICO;D449 +FABBRICO;D450 +FABRIANO;D451 +FABRICA DI ROMA;D452 +FABRIZIA;D453 +FABRO;D454 +FAEDIS;D455 +FAEDO;D457 +FAEDO VALTELLINO;D456 +FAENZA;D458 +FAER OER;Z108 +FAETO;D459 +FAGAGNA;D461 +FAGGETO LARIO;D462 +FAGGIANO;D463 +FAGNANO ALTO;D465 +FAGNANO CASTELLO;D464 +FAGNANO OLONA;D467 +FAI DELLA PAGANELLA;D468 +FAICCHIO;D469 +FALCADE;D470 +FALCIANO DEL MASSICO;D471 +FALCONARA ALBANESE;D473 +FALCONARA MARITTIMA;D472 +FALCONE;D474 +FALERIA;D475 +FALERNA;D476 +FALERONE;D477 +FALLO;D480 +FALMENTA;D481 +FALOPPIO;D482 +FALVATERRA;D483 +FALZES;D484 +FANANO;D486 +FANNA;D487 +FANO;D488 +FANO ADRIANO;D485 +FARA FILIORUM PETRI;D494 +FARA GERA D'ADDA;D490 +FARA IN SABINA;D493 +FARA NOVARESE;D492 +FARA OLIVANA CON SOLA;D491 +FARA SAN MARTINO;D495 +FARA VICENTINO;D496 +FARDELLA;D497 +FARIGLIANO;D499 +FARINDOLA;D501 +FARINI D'OLMO;D502 +FARNESE;D503 +FARRA D'ALPAGO;D506 +FARRA DI SOLIGO;D505 +FARRA D'ISONZO;D504 +FASANO;D508 +FASCIA;D509 +FAUGLIA;D510 +FAULE;D511 +FAVALE DI MALVARO;D512 +FAVARA;D514 +FAVER;D516 +FAVIGNANA;D518 +FAVRIA;D520 +FED. ARABIA MERID.;Z201 +FEISOGLIO;D523 +FELETTO;D524 +FELINO;D526 +FELITTO;D527 +FELIZZANO;D528 +FELONICA;D529 +FELTRE;D530 +FENEGRO';D531 +FENESTRELLE;D532 +FENIS;D537 +FERENTILLO;D538 +FERENTINO;D539 +FERLA;D540 +FERMIGNANO;D541 +FERMO;D542 +FERNO;D543 +FEROLETO ANTICO;D544 +FEROLETO DELLA CHIESA;D545 +FERRANDINA;D547 +FERRARA;D548 +FERRARA DI MONTE BALDO;D549 +FERRAZZANO;D550 +FERRERA DI VARESE;D551 +FERRERA ERBOGNONE;D552 +FERRERE;D554 +FERRIERE;D555 +FERRUZZANO;D557 +FIAMIGNANO;D560 +FIANO;D562 +FIANO ROMANO;D561 +FIASTRA;D564 +FIAVE';D565 +FICARAZZI;D567 +FICAROLO;D568 +FICARRA;D569 +FICULLE;D570 +FIDENZA;B034 +FIE' ALLO SCILIAR;D571 +FIERA DI PRIMIERO;D572 +FIEROZZO;D573 +FIESCO;D574 +FIESOLE;D575 +FIESSE;D576 +FIESSO D'ARTICO;D578 +FIESSO UMBERTIANO;D577 +FIGINO SARANZA;D579 +FIGLINE VALDARNO;D583 +FIGLINE VEGLIATURO;D582 +FILACCIANO;D586 +FILADELFIA;D587 +FILAGO;D588 +FILANDARI;D589 +FILATTIERA;D590 +FILETTINO;D591 +FILETTO;D592 +FILIANO;D593 +FILIGHERA;D594 +FILIGNANO;D595 +FILIPPINE;Z216 +FILOGASO;D596 +FILOTTRANO;D597 +FINALE EMILIA;D599 +FINALE LIGURE;D600 +FINLANDIA;Z109 +FINO DEL MONTE;D604 +FINO MORNASCO;D605 +FIORANO AL SERIO;D606 +FIORANO CANAVESE;D608 +FIORANO MODENESE;D607 +FIORDIMONTE;D609 +FIORENZUOLA D'ARDA;D611 +FIRENZE;D612 +FIRENZUOLA;D613 +FIRMO;D614 +FISCIANO;D615 +FIUGGI;A310 +FIUMALBO;D617 +FIUMARA;D619 +FIUME VENETO;D621 +FIUMEDINISI;D622 +FIUMEFREDDO BRUZIO;D624 +FIUMEFREDDO DI SICILIA;D623 +FIUMICELLO;D627 +FIUMINATA;D628 +FIVIZZANO;D629 +FLAIBANO;D630 +FLAVON;D631 +FLERO;D634 +FLORESTA;D635 +FLORIDIA;D636 +FLORINAS;D637 +FLUMERI;D638 +FLUMINIMAGGIORE;D639 +FLUSSIO;D640 +FOBELLO;D641 +FOGGIA;D643 +FOGLIANISE;D644 +FOGLIANO REDIPUGLIA;D645 +FOGLIZZO;D646 +FOIANO DELLA CHIANA;D649 +FOIANO DI VAL FORTORE;D650 +FOLGARIA;D651 +FOLIGNANO;D652 +FOLIGNO;D653 +FOLLINA;D654 +FOLLO;D655 +FOLLONICA;D656 +FOMBIO;D660 +FONDACHELLI FANTINA;D661 +FONDI;D662 +FONDO;D663 +FONNI;D665 +FONTAGNETO D'AGOGNA;D675 +FONTAINEMORE;D666 +FONTANA LIRI;D667 +FONTANAFREDDA;D670 +FONTANAROSA;D671 +FONTANELICE;D668 +FONTANELLA;D672 +FONTANELLATO;D673 +FONTANELLE;D674 +FONTANETTO PO;D676 +FONTANIGORDA;D677 +FONTANILE;D678 +FONTANIVA;D679 +FONTE;D680 +FONTECCHIO;D681 +FONTECHIARI;D682 +FONTEGRECA;D683 +FONTENO;D684 +FONTEVIVO;D685 +FONZASO;D686 +FOPPOLO;D688 +FORANO;D689 +FORCE;D691 +FORCHIA;D693 +FORCOLA;D694 +FORDONGIANUS;D695 +FORENZA;D696 +FORESTO SPARSO;D697 +FORGARIA NEL FRIULI;D700 +FORINO;D701 +FORIO;D702 +FORLI';D704 +FORLI' DEL SANNIO;D703 +FORLIMPOPOLI;D705 +FORMAZZA;D706 +FORMELLO;D707 +FORMIA;D708 +FORMICOLA;D709 +FORMIGARA;D710 +FORMIGINE;D711 +FORMIGLIANA;D712 +FORMIGNANA;D713 +FORMOSA;Z217 +FORNACE;D714 +FORNELLI;D715 +FORNI AVOLTRI;D718 +FORNI DI SOPRA;D719 +FORNI DI SOTTO;D720 +FORNO CANAVESE;D725 +FORNO DI ZOLDO;D726 +FORNOVO DI TARO;D728 +FORNOVO SAN GIOVANNI;D727 +FORTE DEI MARMI;D730 +FORTEZZA;D731 +FORTUNAGO;D732 +FORZA D'AGRO';D733 +FOSCIANDORA;D734 +FOSDINOVO;D735 +FOSSA;D736 +FOSSACESIA;D738 +FOSSALTA DI PIAVE;D740 +FOSSALTA DI PORTOGRUARO;D741 +FOSSALTO;D737 +FOSSANO;D742 +FOSSATO DI VICO;D745 +FOSSATO SERRALTA;D744 +FOSSO';D748 +FOSSOMBRONE;D749 +FOZA;D750 +FRABOSA SOPRANA;D751 +FRABOSA SOTTANA;D752 +FRACONALTO;D559 +FRAGAGNANO;D754 +FRAGNETO L'ABATE;D755 +FRAGNETO MONFORTE;D756 +FRAINE;D757 +FRAMURA;D758 +FRANCAVILLA AL MARE;D763 +FRANCAVILLA ANGITOLA;D762 +FRANCAVILLA BISIO;D759 +FRANCAVILLA D'ETE;D760 +FRANCAVILLA DI SICILIA;D765 +FRANCAVILLA FONTANA;D761 +FRANCAVILLA IN SINNI;D766 +FRANCAVILLA MARITTIMA;D764 +FRANCIA;Z110 +FRANCICA;D767 +FRANCOFONTE;D768 +FRANCOLISE;D769 +FRASCARO;D770 +FRASCAROLO;D771 +FRASCATI;D773 +FRASCINETO;D774 +FRASSILONGO;D775 +FRASSINELLE POLESINE;D776 +FRASSINELLO MONFERRATO;D777 +FRASSINETO PO;D780 +FRASSINETTO;D781 +FRASSINO;D782 +FRASSINORO;D783 +FRASSO SABINO;D785 +FRASSO TELESINO;D784 +FRATTA POLESINE;D788 +FRATTA TODINA;D787 +FRATTAMAGGIORE;D789 +FRATTAMINORE;D790 +FRATTE ROSA;D791 +FRAZZANO';D793 +FREGONA;D794 +FRESAGRANDINARIA;D796 +FRESONARA;D797 +FRIGENTO;D798 +FRIGNANO;D799 +FRINCO;D802 +FRISA;D803 +FRISANCO;D804 +FRONT;D805 +FRONTINO;D807 +FRONTONE;D808 +FROSINONE;D810 +FROSOLONE;D811 +FROSSASCO;D812 +FRUGAROLO;D813 +FUBINE;D814 +FUCECCHIO;D815 +FUIPIANO VALLE IMAGNA;D817 +FUMANE;D818 +FUMONE;D819 +FUNES;D821 +FURCI;D823 +FURCI SICULO;D824 +FURNARI;D825 +FURORE;D826 +FURTEI;D826 +FUSCALDO;D828 +FUSIGNANO;D829 +FUSINE;D830 +FUTANI;D832 +GABBIONETA BINANUOVA;D834 +GABIANO;D835 +GABICCE MARE;D836 +GABON;Z316 +GABY;D839 +GADESCO PIEVE DELMONA;D841 +GADONI;D842 +GAETA;D843 +GAGGI;D844 +GAGGIANO;D845 +GAGGIO MONTANO;D847 +GAGLIANICO;D848 +GAGLIANO ATERNO;D850 +GAGLIANO CASTELFERRATO;D849 +GAGLIANO DEL CAPO;D851 +GAGLIATO;D852 +GAGLIOLE;D853 +GAIARINE;D854 +GAIBA;D855 +GAIOLA;D856 +GAIOLE IN CHIANTI;D858 +GAIRO;D859 +GAIS;D860 +GALATI MAMERTINO;D861 +GALATINA;D862 +GALATONE;D863 +GALATRO;D864 +GALBIATE;D865 +GALEATA;D867 +GALGAGNANO;D868 +GALLARATE;D869 +GALLESE;D870 +GALLIATE;D872 +GALLIATE LOMBARDO;D871 +GALLIAVOLA;D873 +GALLICANO;D874 +GALLICANO NEL LAZIO;D875 +GALLICCHIO;D876 +GALLIERA;D878 +GALLIERA VENETA;D879 +GALLINARO;D881 +GALLIO;D882 +GALLIPOLI;D883 +GALLO;D884 +GALLODORO;D885 +GALLUCCIO;D886 +GALTELLI;D888 +GALZIGNANO TERME;D889 +GAMALERO;D890 +GAMBARA;D891 +GAMBARANA;D892 +GAMBASCA;D894 +GAMBASSI TERME;D895 +GAMBATESA;D896 +GAMBELLARA;D897 +GAMBERALE;D898 +GAMBETTOLA;D899 +GAMBIA;Z317 +GAMBOLO';D901 +GAMBUGLIANO;D902 +GANDELLINO;D903 +GANDINO;D905 +GANDOSSO;D906 +GANGI;D907 +GARAGUSO;D909 +GARBAGNA;D910 +GARBAGNA NOVARESE;D911 +GARBAGNATE MILANESE;D912 +GARBAGNATE MONASTERO;D913 +GARDA;D915 +GARDONE RIVIERA;D917 +GARDONE VAL TROMPIA;D918 +GARESSIO;D920 +GARGALLO;D921 +GARGAZZONE;D923 +GARGNANO;D924 +GARLASCO;D925 +GARLATE;D926 +GARLENDA;D927 +GARNIGA;D928 +GARZENO;D930 +GARZIGLIANA;D931 +GASPERINA;D932 +GASSINO TORINESE;D933 +GATTATICO;D934 +GATTEO;D935 +GATTICO;D937 +GATTINARA;D938 +GAVARDO;D940 +GAVAZZANA;D941 +GAVELLO;D942 +GAVERINA TERME;D943 +GAVI;D944 +GAVIGNANO;D945 +GAVIRATE;D946 +GAVOI;D947 +GAVORRANO;D948 +GAZA;Z218 +GAZOLDO DEGLI IPPOLITI;D949 +GAZZADA SCHIANNO;D951 +GAZZANIGA;D952 +GAZZO PADOVANO;D956 +GAZZO VERONESE;D957 +GAZZOLA;D958 +GAZZUOLO;D959 +GELA;D960 +GEMMANO;D961 +GEMONA DEL FRIULI;D962 +GEMONIO;D963 +GENAZZANO;D964 +GENGA;D965 +GENIVOLTA;D966 +GENOLA;D967 +GENONI;D968 +GENOVA;D969 +GENURI;D970 +GENZANO DI LUCANIA;D971 +GENZANO DI ROMA;D972 +GENZONE;D973 +GERA LARIO;D974 +GERACE;D975 +GERACI SICULO;D977 +GERANO;D978 +GERENZAGO;D980 +GERENZANO;D981 +GERGEI;D982 +GERMAGNANO;D983 +GERMAGNO;D984 +GERMANIA EST;Z111 +GERMANIA OVEST;Z112 +GERMASINO;D986 +GERMIGNAGA;D987 +GEROCARNE;D988 +GEROLA ALTA;D990 +GEROSA;D991 +GERRE DE'CAPRIOLI;D993 +GESICO;D994 +GESSATE;D995 +GESSOPALENA;D996 +GESTURI;D997 +GESUALDO;D998 +GHANA;Z318 +GHEDI;D999 +GHEMME;E001 +GHIFFA;E003 +GHILARZA;E004 +GHISALBA;E006 +GHISLARENGO;E007 +GIACCIANO CON BARUCHELLA;E008 +GIAGLIONE;E009 +GIAMAICA;Z507 +GIANICO;E010 +GIANO DELL'UMBRIA;E012 +GIANO VETUSTO;E011 +GIAPPONE;Z219 +GIARDINELLO;E013 +GIARDINI NAXOS;E014 +GIAROLE;E015 +GIARRATANA;E016 +GIARRE;E017 +GIAVE;E019 +GIAVENO;E020 +GIAVERA DEL MONTELLO;E021 +GIBA;E022 +GIBELLINA;E023 +GIBILTERRA;Z113 +GIFFLENGA;E024 +GIFFONE;E025 +GIFFONI SEI CASALI;E026 +GIFFONI VALLE PIANA;E027 +GIGNESE;E028 +GIGNOD;E029 +GILDONE;E030 +GIMIGLIANO;E031 +GINESTRA;E033 +GINESTRA DEGLI SCHIAVONI;E034 +GINOSA;E036 +GIOI CILENTO;E037 +GIOIA DEI MARSI;E040 +GIOIA DEL COLLE;E038 +GIOIA SANNITICA;E039 +GIOIA TAURO;E041 +GIOIOSA IONICA;E044 +GIOIOSA MAREA;E043 +GIORDANIA;Z220 +GIOVE;E045 +GIOVINAZZO;E047 +GIOVO;E048 +GIRASOLE;E049 +GIRIFALCO;E050 +GIRONICO;E051 +GISSI;E052 +GIUGGIANELLO;E053 +GIUGLIANO IN CAMPANIA;E054 +GIULIANA;E055 +GIULIANO DI ROMA;E057 +GIULIANO TEATINO;E056 +GIULIANOVA;E058 +GIUNCUGNANO;E059 +GIUNGANO;E060 +GIURDIGNANO;E061 +GIUSSAGO;E062 +GIUSSANO;E063 +GIUSTENICE;E064 +GIUSTINO;E065 +GIUSVALLA;E066 +GIVOLETTO;E067 +GIZZERIA;E068 +GLORENZA;E069 +GODEGA DI SANT'URBANO;E071 +GODIASCO;E072 +GODRANO;E074 +GOITO;E078 +GOLASECCA;E079 +GOLFERENZO;E081 +GOMBITO;E082 +GONARS;E083 +GONI;E084 +GONNESA;E086 +GONNOSCODINA;E087 +GONNOSFANADIGA;E085 +GONNOSNO';D585 +GONNOSTRAMATZA;E088 +GONZAGA;E089 +GORDONA;E090 +GORGA;E091 +GORGO AL MONTICANO;E092 +GORGOGLIONE;E093 +GORGONZOLA;E094 +GORIANO SICOLI;E096 +GORIZIA;E098 +GORLA MAGGIORE;E101 +GORLA MINORE;E102 +GORLAGO;E100 +GORLE;E103 +GORNATE OLONA;E104 +GORNO;E106 +GORO;E107 +GORRETO;E109 +GORZEGNO;E111 +GOSALDO;E113 +GOSSOLENGO;E114 +GOTTASECCA;E115 +GOTTOLENGO;E116 +GOVONE;E118 +GOZZANO;E120 +GRADARA;E121 +GRADISCA D'ISONZO;E124 +GRADO;E125 +GRADOLI;E126 +GRAFFIGNANA;E127 +GRAFFIGNANO;E128 +GRAGLIA;E130 +GRAGNANO;E131 +GRAGNANO TREBBIENSE;E132 +GRAMMICHELE;E133 +GRAN BRETAGNA;Z114 +GRANA;E134 +GRANAGLIONE;E135 +GRANAROLO DELL'EMILIA;E136 +GRANCONA;E138 +GRANDATE;E139 +GRANDOLA ED UNITI;E141 +GRANITI;E142 +GRANOZZO CON MONTICELLO;E143 +GRANTOLA;E144 +GRANTORTO;E145 +GRANZE;E146 +GRASSANO;E147 +GRASSOBBIO;E148 +GRATTERI;E149 +GRAUNO;E150 +GRAVEDONA;E151 +GRAVELLONA LOMELLINA;E152 +GRAVELLONA TOCE;E153 +GRAVERE;E154 +GRAVINA DI CATANIA;E156 +GRAVINA DI PUGLIA;E155 +GRAZZANISE;E158 +GRAZZANO BADOGLIO;E159 +GRECCIO;E160 +GRECI;E161 +GRECIA;Z115 +GREGGIO;E163 +GREMIASCO;E164 +GRESSAN;E165 +GRESSONEY LA TRINITE;E167 +GRESSONEY SAINT JEAN;E168 +GREVE IN CHIANTI;E169 +GREZZAGO;E170 +GREZZANA;E171 +GRIANTE;E172 +GRICIGNANO DI AVERSA;E173 +GRIGNASCO;E177 +GRIGNO;E178 +GRIMACCO;E179 +GRIMALDI;E180 +GRINZANE CAVOUR;E182 +GRISIGNANO DI ZOCCO;E184 +GRISOLIA;E185 +GRIZZANA MORANDI;E187 +GROENLANDIA;Z402 +GROGNARDO;E188 +GROMO;E189 +GRONDONA;E191 +GRONE;E192 +GRONTARDO;E193 +GROPELLO CAIROLI;E195 +GROPPARELLO;E196 +GROSCAVALLO;E199 +GROSIO;E200 +GROSOTTO;E201 +GROSSETO;E202 +GROSSO;E203 +GROTTAFERRATA;E204 +GROTTAGLIE;E205 +GROTTAMINARDA;E206 +GROTTAMMARE;E207 +GROTTAZZOLINA;E208 +GROTTE;E209 +GROTTE DI CASTRO;E210 +GROTTERIA;E212 +GROTTOLE;E213 +GROTTOLELLA;E214 +GRUARO;E215 +GRUGLIASCO;E216 +GRUMELLO CREMONESE ED UNITI;E217 +GRUMELLO DEL MONTE;E219 +GRUMENTO NOVA;E221 +GRUMES;E222 +GRUMO APPULA;E223 +GRUMO NEVANO;E224 +GRUMOLO DELLE ABBADESSE;E226 +GUADALUPA;Z508 +GUAGNANO;E227 +GUALDO;E228 +GUALDO CATTANEO;E229 +GUALDO TADINO;E230 +GUALTIERI;E232 +GUALTIERI SICAMINO';E233 +GUAMAGGIORE;E234 +GUANZATE;E235 +GUARCINO;E236 +GUARDA VENETA;E240 +GUARDABOSONE;E237 +GUARDAMIGLIO;E238 +GUARDAVALLE;E239 +GUARDEA;E241 +GUARDIA LOMBARDI;E245 +GUARDIA PERTICARA;E246 +GUARDIA PIEMONTESE;E242 +GUARDIA SANFRAMONDI;E249 +GUARDIAGRELE;E243 +GUARDIALFIERA;E244 +GUARDIAREGIA;E248 +GUARDISTALLO;E250 +GUARENE;E251 +GUASILA;E252 +GUASTALLA;E253 +GUATEMALA;Z509 +GUAYANA BRITANNICA;Z606 +GUAYANA FRANCESE;Z607 +GUAYANA OLANDESE;Z608 +GUAZZORA;E255 +GUBBIO;E256 +GUDO VISCONTI;E258 +GUGLIONESI;E259 +GUIDIZZOLO;E261 +GUIDONIA MONTECELIO;E263 +GUIGLIA;E264 +GUILMI;E266 +GUINEA;Z319 +GUINEA PORTOGHESE;Z320 +GUINEA SPAGNOLA;Z321 +GURRO;E269 +GUSPINI;E270 +GUSSAGO;E271 +GUSSOLA;E272 +HAITI;Z510 +HONDURAS;Z511 +HONDURAS BRITANNICO;Z512 +HONE;E273 +HONG KONG;Z221 +IACURSO;E274 +IDRO;E280 +IESOLO;C388 +IFNI;Z323 +IGLESIAS;E281 +IGLIANO;E282 +ILBONO;E283 +ILLASI;E284 +ILLORAI;E285 +IMBERSAGO;E287 +IMER;E288 +IMOLA;E289 +IMPERIA;E290 +IMPRUNETA;E291 +INARZO;E292 +INCISA SCAPACCINO;E295 +INCISA VAL D'ARNO;E296 +INCUDINE;E297 +INDIA;Z222 +INDONESIA;Z223 +INDUNO OLONA;E299 +INGRIA;E301 +INTRAGNA;E304 +INTROBIO;E305 +INTROD;E306 +INTRODACQUA;E307 +INTROZZO;E308 +INVERIGO;E309 +INVERNO E MONTELEONE;E310 +INVERSO PINASCA;E311 +INVERUNO;E313 +INVORIO;E314 +INZAGO;E317 +IOLANDA DI SAVOIA;E320 +IONADI;E321 +IRAN;Z224 +IRAQ;Z225 +IRGOLI;E323 +IRIAN OCC.;Z707 +IRLANDA;Z116 +IRLANDA DEL NORD;Z114 +IRMA;E325 +IRSINA;E326 +ISASCA;E327 +ISCA SULLO IONIO;E328 +ISCHIA;E329 +ISCHIA DI CASTRO;E330 +ISCHITELLA;E332 +ISEO;E333 +ISERA;E334 +ISERNIA;E335 +ISILI;E336 +ISLANDA;Z117 +ISNELLO;E337 +ISOLA D'ASTI;E338 +ISOLA DEL CANTONE;E341 +ISOLA DEL GIGLIO;E348 +ISOLA DEL GRAN SASSO;E343 +ISOLA DEL LIRI;E340 +ISOLA DEL PIANO;E351 +ISOLA DELLA SCALA;E349 +ISOLA DELLE FEMMINE;E350 +ISOLA DI CAPO RIZZUTO;E339 +ISOLA DI FONDRA;E353 +ISOLA DI PASQUA;Z721 +ISOLA DOVARESE;E356 +ISOLA RIZZA;E358 +ISOLA SANT'ANTONIO;E360 +ISOLA VICENTINA;E354 +ISOLABELLA;E345 +ISOLABONA;E346 +ISOLATO;E342 +ISOLE CAROLINE;Z701 +ISOLE CHRISTMAS;Z702 +ISOLE COCOS;Z212 +ISOLE COMORE;Z310 +ISOLE COOK;Z703 +ISOLE FALKLAND;Z609 +ISOLE FIGI;Z704 +ISOLE GILBERT;Z705 +ISOLE GUAM;Z706 +ISOLE MACQUARIE;Z708 +ISOLE MARCUS;Z709 +ISOLE MARIANNE;Z710 +ISOLE MARSHALL;Z711 +ISOLE MAURIZIO;Z332 +ISOLE MIDWAY;Z712 +ISOLE NAURU;Z713 +ISOLE NORFOLK;Z715 +ISOLE NORMANNE;Z124 +ISOLE REUNION;Z324 +ISOLE RYUKYU;Z238 +ISOLE SALOMONE;Z724 +ISOLE SAVAGE;Z714 +ISOLE SEICELLE;Z342 +ISOLE TONGA;Z728 +ISOLE TREMITI;E363 +ISOLE VERGINI;Z520 +ISOLE WALLIS;Z729 +ISORELLA;E364 +ISPANI;E365 +ISPICA;E366 +ISPRA;E367 +ISRAELE;Z226 +ISSIGLIO;E368 +ISSIME;E369 +ISSO;E370 +ISSOGNE;E371 +ISTRANA;E373 +ITALA;E374 +ITRI;E375 +ITTIREDDU;E376 +ITTIRI;E377 +IVANO FRACENA;E378 +IVREA;E379 +IZANO;E380 +JELSI;E381 +JENNE;E382 +JERAGO CON ORAGO;E386 +JERZU;E387 +JESI;E388 +JOPPOLO;E389 +JOPPOLO GIANCAXIO;E390 +JOVENCAN;E391 +JUGOSLAVIA;Z118 +KENYA;Z322 +KUWAIT;Z227 +LA CASSA;E394 +LA LOGGIA;E423 +LA MADDALENA;E425 +LA MAGDELEINE;A308 +LA MORRA;E430 +LA SALLE;E458 +LA SPEZIA;E463 +LA THUILE;E470 +LA VALLE;E491 +LA VALLE AGORDINA;E490 +LABICO;E392 +LABRO;E393 +LACCHIARELLA;E395 +LACCO AMENO;E396 +LACEDONIA;E397 +LACES;E398 +LACONI;E400 +LADISPOLI;M212 +LAERRU;E401 +LAGANADI;E402 +LAGHI;E403 +LAGLIO;E405 +LAGNASCO;E406 +LAGO;E407 +LAGONEGRO;E409 +LAGOSANTO;E410 +LAGUNDO;E412 +LAIGUEGLIA;E414 +LAINATE;E415 +LAINO;E416 +LAINO BORGO;E417 +LAINO CASTELLO;E419 +LAION;E420 +LAIVES;E421 +LAJATICO;E413 +LALLIO;E422 +LAMA DEI PELIGNI;E424 +LAMA MOCOGNO;E426 +LAMBRUGO;E428 +LAMEZIA TERME;M208 +LAMON;E429 +LAMPEDUSA E LINOSA;E431 +LAMPORECCHIO;E432 +LAMPORO;E433 +LANA;E434 +LANCIANO;E435 +LANDIONA;E436 +LANDRIANO;E437 +LANGHIRANO;E438 +LANGOSCO;E439 +LANUSEI;E441 +LANUVIO;C767 +LANZADA;E443 +LANZO D'INTELVI;E444 +LANZO TORINESE;E445 +LAOS;Z228 +LAPEDONA;E447 +LAPIO;E448 +LAPPANO;E450 +L'AQUILA;A345 +LARCIANO;E451 +LARDARO;E452 +LARDIRAGO;E454 +LARI;E455 +LARIANO;M207 +LARINO;E456 +LAS PLASSAS;E464 +LASA;E457 +LASCARI;E459 +LASINO;E461 +LASNIGO;E462 +LASTEBASSE;E465 +LASTRA A SIGNA;E466 +LATERA;E467 +LATERINA;E468 +LATERZA;E469 +LATIANO;E471 +LATINA;E472 +LATISANA;E473 +LATRONICO;E474 +LATTARICO;E475 +LAUCO;E476 +LAUREANA CILENTO;E480 +LAUREANA DI BORRELLO;E479 +LAUREGNO;E481 +LAURENZANA;E482 +LAURIA;E483 +LAURIANO;E484 +LAURINO;E485 +LAURITO;E486 +LAURO;E487 +LAVAGNA;E488 +LAVAGNO;E489 +LAVARONE;E492 +LAVELLO;E493 +LAVENA PONTE TRESA;E494 +LAVENO MOMBELLO;E495 +LAVENONE;E497 +LAVIANO;E498 +LAVIS;E500 +LAZISE;E502 +LAZZATE;E504 +LECCE;E506 +LECCE NEI MARSI;E505 +LECCO;E507 +LEFFE;E509 +LEGGIUNO;E510 +LEGNANO;E512 +LEGNANO;E514 +LEGNARO;E515 +LEI;E517 +LEINI';E518 +LEIVI;E519 +LEMIE;E520 +LENDINARA;E522 +LENI;E523 +LENNA;E524 +LENNO;E525 +LENO;E526 +LENOLA;E527 +LENTA;E528 +LENTATE SUL SEVESO;E530 +LENTELLA;E531 +LENTIAI;C562 +LENTINI;E532 +LEONESSA;E535 +LEONFORTE;E536 +LEPORANO;E537 +LEQUILE;E538 +LEQUIO BERRIA;E540 +LEQUIO TANARO;E539 +LERCARA FRIDDI;E541 +LERICI;E542 +LERMA;E543 +LESA;E544 +LESEGNO;E546 +LESIGNANO DE'BAGNI;E547 +LESINA;E549 +LESMO;E550 +LESSOLO;E551 +LESSONA;E552 +LESTIZZA;E553 +LETINO;E554 +LETOJANNI;E555 +LETTERE;E557 +LETTOMANOPPELLO;E558 +LETTOPALENA;E559 +LEVANTO;E560 +LEVATE;E562 +LEVERANO;E563 +LEVICE;E564 +LEVICO TERME;E565 +LEVONE;E566 +LEZZENO;E569 +LIBANO;Z229 +LIBERI;E570 +LIBERIA;Z325 +LIBIA;Z326 +LIBRIZZI;E571 +LICATA;E573 +LICCIANA NARDI;E574 +LICENZA;E576 +LICODIA EUBEA;E578 +LIECHTENSTEIN;Z119 +LIERNA;E581 +LIGNANA;E583 +LIGNANO SABBIADORO;E584 +LIGONCHIO;E585 +LIGOSULLO;E586 +LILLIANES;E587 +LIMANA;E588 +LIMATOLA;E589 +LIMBADI;E590 +LIMBIATE;E591 +LIMENA;E592 +LIMIDO COMASCO;E593 +LIMINA;E594 +LIMONE PIEMONTE;E597 +LIMONE SUL GARDA;E596 +LIMOSANO;E599 +LINAROLO;E600 +LINGUAGLOSSA;E602 +LIONI;E605 +LIPARI;E606 +LIPOMO;E607 +LIRIO;E608 +LISCATE;E610 +LISCIA;E611 +LISCIANO NICCONE;E613 +LISIGNAGO;E614 +LISIO;E615 +LISSONE;E617 +LIVERI;E620 +LIVIGNO;E621 +LIVINALLONGO DEL COL DI LANA;E622 +LIVO;E623 +LIVO;E624 +LIVORNO;E625 +LIVORNO FERRARIS;E626 +LIVRAGA;E627 +LIZZANELLO;E629 +LIZZANO;E630 +LIZZANO IN BELVEDERE;A771 +LOANO;E632 +LOAZZOLO;E633 +LOCANA;E635 +LOCATE DI TRIULZI;E639 +LOCATE VARESINO;E638 +LOCATELLO;E640 +LOCERI;E644 +LOCOROTONDO;E645 +LOCRI;D976 +LOCULI;E646 +LODE';E647 +LODI;E648 +LODI VECCHIO;E651 +LODRINO;E652 +LOGRATO;E654 +LOIANO;E655 +LOMAGNA;E656 +LOMASO;E658 +LOMAZZO;E659 +LOMBARDORE;E660 +LOMBRIASCO;E661 +LOMELLO;E662 +LONA LASES;E664 +LONATE CEPPINO;E665 +LONATE POZZOLO;E666 +LONATO;E667 +LONDA;E668 +LONGANO;E669 +LONGARE;E671 +LONGARONE;E672 +LONGHENA;E673 +LONGI;E674 +LONGIANO;E675 +LONGOBARDI;E677 +LONGOBUCCO;E678 +LONGONE AL SEGRINO;E679 +LONGONE SABINO;E681 +LONIGO;E682 +LORANZE';E683 +LOREGGIA;E684 +LOREGLIA;E685 +LORENZAGO DI CADORE;E687 +LORENZANA;E688 +LOREO;E689 +LORETO;E690 +LORETO APRUTINO;E691 +LORIA;E692 +LORO CIUFFENNA;E693 +LORO PICENO;E694 +LORSICA;E695 +LOSINE;E698 +LOTZORAI;E700 +LOVERE;E704 +LOVERO;E705 +LOZIO;E706 +LOZZA;E707 +LOZZO ATESTINO;E709 +LOZZO DI CADORE;E708 +LOZZOLO;E711 +LU MONFERRATO;E712 +LUBRIANO;E713 +LUCCA;E715 +LUCCA SICULA;E714 +LUCERA;E716 +LUCIGNANO;E718 +LUCINASCO;E719 +LUCITO;E722 +LUCO DEI MARSI;E723 +LUCOLI;E724 +LUGAGNANO VAL D'ARDA;E726 +LUGNACCO;E727 +LUGNANO IN TEVERINA;E729 +LUGO;E730 +LUGO DI VICENZA;E731 +LUINO;E734 +LUISAGO;E735 +LULA;E736 +LUMARZO;E737 +LUMEZZANE;E738 +LUNAMATRONA;E742 +LUNANO;E743 +LUNGAVILLA;B387 +LUNGRO;E745 +LUOGOSANO;E746 +LUOGOSANTO;E747 +LUPARA;E748 +LURAGO D'ERBA;E749 +LURAGO MARINONE;E750 +LURANO;E751 +LURAS;E752 +LURATE CACCIVIO;E753 +LUSCIANO;E754 +LUSERNA;E757 +LUSERNA SAN GIOVANNI;E758 +LUSERNETTA;E759 +LUSEVERA;E760 +LUSIA;E761 +LUSIANA;E762 +LUSIGLIE';E763 +LUSON;E764 +LUSSEMBURGO;Z120 +LUSTRA;E767 +LUVINATE;E769 +LUZZANA;E770 +LUZZARA;E772 +LUZZI;E773 +MACAO;Z231 +MACCAGNO;E775 +MACCASTORNA;E777 +MACCHIA D'ISERNIA;E778 +MACCHIA VALFORTORE;E780 +MACCHIAGODENA;E779 +MACELLO;E782 +MACERATA;E783 +MACERATA CAMPANIA;E784 +MACERATA FELTRIA;E785 +MACHERIO;E786 +MACLODIO;E787 +MACOMER;E788 +MACRA;E789 +MACUGNAGA;E790 +MADAGASCAR;Z327 +MADDALONI;E791 +MADIGNANO;E793 +MADONE;E794 +MADONNA DEL SASSO;E795 +MAENZA;E798 +MAFALDA;E799 +MAGASA;E800 +MAGENTA;E801 +MAGGIORA;E803 +MAGHERNO;E804 +MAGIONE;E805 +MAGISANO;E806 +MAGLIANO ALFIERI;E809 +MAGLIANO ALPI;E808 +MAGLIANO DE'MARSI;E811 +MAGLIANO DI TENNA;E807 +MAGLIANO IN TOSCANA;E810 +MAGLIANO ROMANO;E813 +MAGLIANO SABINA;E812 +MAGLIANO VETERE;E814 +MAGLIE;E815 +MAGLIOLO;E816 +MAGLIONE;E817 +MAGNACAVALLO;E818 +MAGNAGO;E819 +MAGNANO;E821 +MAGNANO IN RIVIERA;E820 +MAGOMADAS;E825 +MAGRE' SULLA STRADA DEL VINO;E829 +MAGREGLIO;E830 +MAIDA;E834 +MAIERA';E835 +MAIERATO;E836 +MAIOLATI SPONTINI;E837 +MAIOLO;E838 +MAIORI;E839 +MAIRAGO;E840 +MAIRANO;E841 +MAISSANA;E842 +MAJANO;E833 +MALAGNINO;E843 +MALALBERGO;E844 +MALAWI;Z328 +MALBORGHETTO VALBRUNA;E847 +MALCESINE;E848 +MALDIVE;Z232 +MALE';E850 +MALEGNO;E851 +MALEO;E852 +MALESCO;E853 +MALESIA;Z230 +MALETTO;E854 +MALFA;E855 +MALGESSO;E856 +MALGRATE;E858 +MALI;Z329 +MALITO;E859 +MALLARE;E609 +MALLES VENOSTA;E862 +MALNATE;E863 +MALO;E864 +MALONNO;E865 +MALOSCO;E866 +MALTA;Z121 +MALTIGNANO;E868 +MALVAGNA;E869 +MALVICINO;E870 +MALVITO;E872 +MAMMOLA;E873 +MAMOIADA;E874 +MAN;Z122 +MANCIANO;E875 +MANDANICI;E876 +MANDAS;E877 +MANDATORICCIO;E878 +MANDELA;B632 +MANDELLO DEL LARIO;E879 +MANDELLO VITTA;E880 +MANDURIA;E882 +MANERBA DEL GARDA;E883 +MANERBIO;E884 +MANFREDONIA;E885 +MANGO;E887 +MANGONE;E888 +MANIAGO;E889 +MANOCALZATI;E891 +MANOPPELLO;E892 +MANSUE';E893 +MANTA;E894 +MANTELLO;E896 +MANTOVA;E897 +MANZANO;E899 +MANZIANA;E900 +MAPELLO;E901 +MARA;E902 +MARACALAGONIS;E903 +MARANELLO;E904 +MARANO DI NAPOLI;E906 +MARANO DI VALPOLICELLA;E911 +MARANO EQUO;E908 +MARANO LAGUNARE;E910 +MARANO MARCHESATO;E914 +MARANO PRINCIPATO;E915 +MARANO SUL PANARO;E905 +MARANO TICINO;E907 +MARANO VICENTINO;E912 +MARANZANA;E917 +MARATEA;E919 +MARCALLO CON CASONE;E921 +MARCARIA;E922 +MARCEDUSA;E923 +MARCELLINA;E924 +MARCELLINARA;E925 +MARCETELLI;E927 +MARCHENO;E928 +MARCHIROLO;E929 +MARCIANA;E930 +MARCIANA MARINA;E931 +MARCIANISE;E932 +MARCIANO DELLA CHIANA;E933 +MARCIGNAGO;E934 +MARCON;E936 +MAREBBE;E938 +MARENE;E939 +MARENO DI PIAVE;E940 +MARENTINO;E941 +MARETTO;E944 +MARGARITA;E945 +MARGHERITA DI SAVOIA;E946 +MARGNO;E947 +MARIANA MANTOVANA;E949 +MARIANO COMENSE;E951 +MARIANO DEL FRIULI;E952 +MARIANOPOLI;E953 +MARIGLIANELLA;E954 +MARIGLIANO;E955 +MARINA DI GIOIOSA IONICA;E956 +MARINEO;E957 +MARINO;E958 +MARLENGO;E959 +MARLIANA;E960 +MARMENTINO;E961 +MARMIROLO;E962 +MARMORA;E963 +MARNATE;E965 +MAROCCO;Z330 +MARONE;E967 +MAROPATI;E968 +MAROSTICA;E970 +MARRADI;E971 +MARRUBIU;E972 +MARSAGLIA;E973 +MARSALA;E974 +MARSCIANO;E975 +MARSICO NUOVO;E976 +MARSICOVETERE;E977 +MARTA;E978 +MARTANO;E979 +MARTELLAGO;E980 +MARTELLO;E981 +MARTIGNACCO;E982 +MARTIGNANA DI PO;E983 +MARTIGNANO;E984 +MARTINA FRANCA;E986 +MARTINENGO;E987 +MARTINIANA PO;E988 +MARTINICA;Z513 +MARTINSICURO;E989 +MARTIRANO;E990 +MARTIRANO LOMBARDO;E991 +MARTIS;E992 +MARTONE;E993 +MARUDO;E994 +MARUGGIO;E995 +MARZABOTTO;B689 +MARZANO;E999 +MARZANO APPIO;E998 +MARZANO DI NOLA;E997 +MARZI;F001 +MARZIO;F002 +MASAINAS;F000 +MASATE;F003 +MASCALI;F004 +MASCALUCIA;F005 +MASCHITO;F006 +MASCIAGO PRIMO;F007 +MASER;F009 +MASERA;F010 +MASERA' DI PADOVA;F011 +MASERADA SUL PIAVE;F012 +MASI;F013 +MASI TORELLO;F016 +MASIO;F015 +MASLIANICO;F017 +MASON VICENTINO;F019 +MASONE;F020 +MASSA;F023 +MASSA D'ALBE;F022 +MASSA E COZZILE;F025 +MASSA FERMANA;F021 +MASSA FISCAGLIA;F026 +MASSA LOMBARDA;F029 +MASSA LUBRENSE;F030 +MASSA MARITTIMA;F032 +MASSA MARTANA;F024 +MASSAFRA;F027 +MASSALENGO;F028 +MASSANZAGO;F033 +MASSAROSA;F035 +MASSAZZA;F037 +MASSELLO;F041 +MASSERANO;F042 +MASSIGNANO;F044 +MASSIMENO;F045 +MASSIMINO;F046 +MASSINO VISCONTI;F047 +MASSIOLA;F048 +MASULLAS;F050 +MATELICA;F051 +MATERA;F052 +MATHI;F053 +MATINO;F054 +MATRICE;F055 +MATTIE;F058 +MATTINATA;F059 +MAURITANIA;Z331 +MAZARA DEL VALLO;F061 +MAZZANO;F063 +MAZZANO ROMANO;F064 +MAZZARA' SANT'ANDREA;F066 +MAZZARINO;F065 +MAZZE';F067 +MAZZIN;F068 +MAZZO DI VALTELLINA;F070 +MEANA DI SUSA;F074 +MEANA SARDO;F073 +MEDA;F078 +MEDE;F080 +MEDEA;F081 +MEDESANO;F082 +MEDICINA;F083 +MEDIGLIA;F084 +MEDOLAGO;F085 +MEDOLE;F086 +MEDOLLA;F087 +MEDUNA DI LIVENZA;F088 +MEDUNO;F089 +MEGLIADINO SAN FIDENZIO;F091 +MEGLIADINO SAN VITALE;F092 +MEINA;F093 +MEL;F094 +MELARA;F095 +MELAZZO;F096 +MELDOLA;F097 +MELE;F098 +MELEGNANO;F100 +MELENDUGNO;F101 +MELETI;F102 +MELFI;F104 +MELICUCCA';F105 +MELICUCCO;F106 +MELILLI;F107 +MELISSA;F108 +MELISSANO;F109 +MELITO DI NAPOLI;F111 +MELITO DI PORTO SALVO;F112 +MELITO IRPINO;F110 +MELIZZANO;F113 +MELLE;F114 +MELLO;F115 +MELPIGNANO;F117 +MELTINA;F118 +MELZO;F119 +MENAGGIO;F120 +MENAROLA;F121 +MENCONICO;F122 +MENDATICA;F123 +MENDICINO;F125 +MENFI;F126 +MENTANA;F127 +MEOLO;F130 +MERANA;F131 +MERANO;F132 +MERATE;F133 +MERCALLO;F134 +MERCATELLO SUL METAURO;F135 +MERCATINO CONCA;F136 +MERCATO SAN SEVERINO;F138 +MERCATO SARACENO;F139 +MERCENASCO;F140 +MERCOGLIANO;F141 +MERETO DI TOMBA;F144 +MERGO;F145 +MERGOZZO;F146 +MERI;F147 +MERLARA;F148 +MERLINO;F149 +MERONE;F151 +MESAGNE;F152 +MESE;F153 +MESENZANA;F154 +MESERO;F155 +MESOLA;F156 +MESORACA;F157 +MESSICO;Z514 +MESSINA;F158 +MESTRINO;F161 +META;F162 +MEUGLIANO;F164 +MEZZAGO;F165 +MEZZANA;F168 +MEZZANA BIGLI;F170 +MEZZANA MORTIGLIENGO;F167 +MEZZANA RABATTONE;F171 +MEZZANE DI SOTTO;F172 +MEZZANEGO;F173 +MEZZANI;F174 +MEZZANINO;F175 +MEZZANO;F176 +MEZZEGRA;F181 +MEZZENILE;F182 +MEZZOCORONA;F183 +MEZZOJUSO;F184 +MEZZOLDO;F186 +MEZZOLOMBARDO;F187 +MEZZOMERICO;F188 +MIAGLIANO;F189 +MIANE;F190 +MIASINO;F191 +MIAZZINA;F192 +MICIGLIANO;F193 +MIGGIANO;F194 +MIGLIANICO;F196 +MIGLIARINO;F198 +MIGLIARO;F199 +MIGLIERINA;F200 +MIGLIONICO;F201 +MIGNANEGO;F202 +MIGNANO MONTE LUNGO;F203 +MILANO;F205 +MILAZZO;F206 +MILENA;E618 +MILETO;F207 +MILIS;F208 +MILITELLO ROSMARINO;F210 +MILITELLO V.C.;F209 +MILLESIMO;F213 +MILO;F214 +MILZANO;F216 +MINEO;F217 +MINERBE;F218 +MINERBIO;F219 +MINERVINO DI LECCE;F221 +MINERVINO MURGE;F220 +MINORI;F223 +MINTURNO;F224 +MINUCCIANO;F225 +MIOGLIA;F226 +MIRA;F229 +MIRABELLA ECLANO;F230 +MIRABELLA IMBACCARI;F231 +MIRABELLO;F235 +MIRABELLO MONFERRATO;F232 +MIRABELLO SANNITICO;F233 +MIRADOLO TERME;F238 +MIRANDA;F239 +MIRANDOLA;F240 +MIRANO;F241 +MIRTO;F242 +MISANO ADRIATICO;F244 +MISANO DI GERA D'ADDA;F243 +MISILMERI;F246 +MISINTO;F247 +MISSAGLIA;F248 +MISSANELLO;F249 +MISTERBIANCO;F250 +MISTRETTA;F251 +MOASCA;F254 +MOCONESI;F256 +MODENA;F257 +MODICA;F258 +MODIGLIANA;F259 +MODOLO;F261 +MODUGNO;F262 +MOENA;F263 +MOGGIO;F265 +MOGGIO UDINESE;F266 +MOGLIA;F267 +MOGLIANO;F268 +MOGLIANO VENETO;F269 +MOGORELLA;F270 +MOGORO;F272 +MOIANO;F274 +MOIMACCO;F275 +MOIO ALCANTARA;F277 +MOIO DE'CALVI;F276 +MOIO DELLA CIVITELLA;F278 +MOIOLA;F279 +MOLA DI BARI;F280 +MOLARE;F281 +MOLAZZANA;F283 +MOLFETTA;F284 +MOLINA ATERNO;M255 +MOLINA DI LEDRO;F286 +MOLINARA;F287 +MOLINELLA;F288 +MOLINI DI TRIORA;F290 +MOLINO DEI TORTI;F293 +MOLISE;F294 +MOLITERNO;F295 +MOLLIA;F297 +MOLOCHIO;F301 +MOLTENO;F304 +MOLTRASIO;F305 +MOLVENA;F306 +MOLVENO;F307 +MOMBALDONE;F308 +MOMBARCARO;F309 +MOMBAROCCIO;F310 +MOMBARUZZO;F311 +MOMBASIGLIO;F312 +MOMBELLO DI TORINO;F315 +MOMBELLO MONFERRATO;F313 +MOMBERCELLI;F316 +MOMO;F317 +MOMPANTERO;F318 +MOMPEO;F319 +MOMPERONE;F320 +MONACILIONI;F322 +MONACO;Z123 +MONALE;F323 +MONASTERACE;F324 +MONASTERO BORMIDA;F325 +MONASTERO DI LANZO;F327 +MONASTERO DI VASCO;F326 +MONASTEROLO CASOTTO;F329 +MONASTEROLO DEL CASTELLO;F328 +MONASTEROLO DI SAVIGLIANO;F330 +MONASTIER DI TREVISO;F332 +MONASTIR;F333 +MONCALIERI;F335 +MONCALVO;F336 +MONCENISIO;D553 +MONCESTINO;F337 +MONCHIERO;F338 +MONCHIO DELLE CORTI;F340 +MONCLASSICO;F341 +MONCRIVELLO;F342 +MONCUCCO TORINESE;F343 +MONDAINO;F346 +MONDAVIO;F347 +MONDOLFO;F348 +MONDOVI';F751 +MONDRAGONE;F352 +MONEGLIA;F354 +MONESIGLIO;F355 +MONFALCONE;F356 +MONFORTE D'ALBA;F358 +MONFORTE SAN GIORGIO;F359 +MONFUMO;F360 +MONGARDINO;F361 +MONGHIDORO;F363 +MONGIANA;F364 +MONGIARDINO LIGURE;F365 +MONGIUFFI MELIA;F368 +MONGOLIA;Z233 +MONGRANDO;F369 +MONGRASSANO;F370 +MONGUELFO;F371 +MONGUZZO;F372 +MONIGA DEL GARDA;F373 +MONLEALE;F374 +MONNO;F375 +MONOPOLI;F376 +MONREALE;F377 +MONRUPINO;F378 +MONSAMPAOLO DEL TRONTO;F380 +MONSAMPIETRO MORICO;F379 +MONSANO;F381 +MONSELICE;F382 +MONSUMMANO TERME;F384 +MONTA';F385 +MONTABONE;F386 +MONTACUTO;F387 +MONTAFIA;F390 +MONTAGANO;F391 +MONTAGNA;F392 +MONTAGNA IN VALTELLINA;F393 +MONTAGNANA;F394 +MONTAGNAREALE;F395 +MONTAGNE;F396 +MONTAGUTO;F397 +MONTAIONE;F398 +MONTALBANO ELICONA;F400 +MONTALBANO IONICO;F399 +MONTALCINO;F402 +MONTALDEO;F403 +MONTALDO BORMIDA;F404 +MONTALDO DI MONDOVI';F405 +MONTALDO ROERO;F408 +MONTALDO SCARAMPI;F409 +MONTALDO TORINESE;F407 +MONTALE;F410 +MONTALENGHE;F411 +MONTALLEGRO;F414 +MONTALTO DELLE MARCHE;F415 +MONTALTO DI CASTRO;F419 +MONTALTO DORA;F420 +MONTALTO LIGURE;F406 +MONTALTO PAVESE;F417 +MONTALTO UFFUGO;F416 +MONTANARO;F422 +MONTANASO LOMBARDO;F423 +MONTANERA;F424 +MONTANO ANTILIA;F426 +MONTANO LUCINO;F427 +MONTAPPONE;F428 +MONTAQUILA;F429 +MONTASOLA;F430 +MONTAURO;F432 +MONTAZZOLI;F433 +MONTE ARGENTARIO;F437 +MONTE CASTELLO DI VIBIO;F456 +MONTE CAVALLO;F460 +MONTE CERIGNONE;F467 +MONTE COLOMBO;F476 +MONTE CREMASCO;F434 +MONTE DI MALO;F486 +MONTE DI PROCIDA;F488 +MONTE GIBERTO;F517 +MONTE GRIDOLFO;F523 +MONTE GRIMANO;F524 +MONTE ISOLA;F532 +MONTE MARENZO;F561 +MONTE PORZIO;F589 +MONTE PORZIO CATONE;F590 +MONTE ROBERTO;F600 +MONTE ROMANO;F603 +MONTE SAN BIAGIO;F616 +MONTE SAN GIACOMO;F618 +MONTE SAN GIOVANNI CAMPANO;F620 +MONTE SAN GIOVANNI IN SABINA;F619 +MONTE SAN GIUSTO;F621 +MONTE SAN MARTINO;F622 +MONTE SAN PIETRANGELI;F626 +MONTE SAN PIETRO;F627 +MONTE SAN SAVINO;F628 +MONTE SAN VITO;F634 +MONTE SANTA MARIA TIBERINA;F629 +MONTE SANT'ANGELO;F631 +MONTE URANO;F653 +MONTE VIDON COMBATTE;F664 +MONTE VIDON CORRADO;F665 +MONTEBELLO DELLA BATTAGLIA;F440 +MONTEBELLO DI BERTONA;F441 +MONTEBELLO IONICO;D746 +MONTEBELLO SUL SANGRO;B268 +MONTEBELLO VICENTINO;F442 +MONTEBELLUNA;F443 +MONTEBRUNO;F445 +MONTEBUONO;F446 +MONTECALVO IN FOGLIA;F450 +MONTECALVO IRPINO;F448 +MONTECALVO VERSIGGIA;F449 +MONTECARLO;F452 +MONTECAROTTO;F453 +MONTECASSIANO;F454 +MONTECASTELLO;F455 +MONTECASTRILLI;F457 +MONTECATINI TERME;A561 +MONTECATINI VAL DI CECINA;F458 +MONTECCHIA DI CROSARA;F461 +MONTECCHIO;F462 +MONTECCHIO EMILIA;F463 +MONTECCHIO MAGGIORE;F464 +MONTECCHIO PRECALCINO;F465 +MONTECHIARO D'ACQUI;F469 +MONTECHIARO D'ASTI;F468 +MONTECHIARUGOLO;F473 +MONTECICCARDO;F474 +MONTECILFONE;F475 +MONTECOMPATRI;F477 +MONTECOPIOLO;F478 +MONTECORICE;F479 +MONTECORVINO PUGLIANO;F480 +MONTECORVINO ROVELLA;F481 +MONTECOSARO;F482 +MONTECRESTESE;F483 +MONTECRETO;F484 +MONTEDINOVE;F487 +MONTEDORO;F489 +MONTEFALCIONE;F491 +MONTEFALCO;F492 +MONTEFALCONE APPENNINO;F493 +MONTEFALCONE DI VAL FORTORE;F494 +MONTEFALCONE NEL SANNIO;F495 +MONTEFANO;F496 +MONTEFELCINO;F497 +MONTEFERRANTE;F498 +MONTEFIASCONE;F499 +MONTEFINO;F500 +MONTEFIORE CONCA;F502 +MONTEFIORE DELL'ASO;F501 +MONTEFIORINO;F503 +MONTEFLAVIO;F504 +MONTEFORTE CILENTO;F507 +MONTEFORTE D'ALPONE;F508 +MONTEFORTE IRPINO;F506 +MONTEFORTINO;F509 +MONTEFRANCO;F510 +MONTEFREDANE;F511 +MONTEFUSCO;F512 +MONTEGABBIONE;F513 +MONTEGALDA;F514 +MONTEGALDELLA;F515 +MONTEGALLO;F516 +MONTEGIOCO;F518 +MONTEGIORDANO;F519 +MONTEGIORGIO;F520 +MONTEGRANARO;F522 +MONTEGRINO VALTRAVAGLIA;F526 +MONTEGROSSO D'ASTI;F527 +MONTEGROSSO PIAN LATTE;F528 +MONTEGROTTO TERME;F529 +MONTEIASI;F531 +MONTELABBATE;F533 +MONTELANICO;F534 +MONTELAPIANO;F535 +MONTELEONE DI FERMO;F536 +MONTELEONE DI PUGLIA;F538 +MONTELEONE DI SPOLETO;F540 +MONTELEONE D'ORVIETO;F543 +MONTELEONE ROCCA DORIA;F542 +MONTELEONE SABINO;F541 +MONTELEPRE;F544 +MONTELIBRETTI;F545 +MONTELLA;F546 +MONTELLO;F547 +MONTELONGO;F548 +MONTELPARO;F549 +MONTELUPO ALBESE;F550 +MONTELUPO FIORENTINO;F551 +MONTELUPONE;F552 +MONTEMAGGIORE AL METAURO;F555 +MONTEMAGGIORE BELSITO;F553 +MONTEMAGNO;F556 +MONTEMALE DI CUNEO;F558 +MONTEMARANO;F559 +MONTEMARCIANO;F560 +MONTEMARZINO;F562 +MONTEMESOLA;F563 +MONTEMEZZO;F564 +MONTEMIGNAIO;F565 +MONTEMILETTO;F566 +MONTEMILONE;F568 +MONTEMITRO;F569 +MONTEMONACO;F570 +MONTEMURLO;F572 +MONTEMURRO;F573 +MONTENARS;F574 +MONTENERO DI BISACCIA;F576 +MONTENERO SABINO;F579 +MONTENERO VAL COCCHIARA;F580 +MONTENERODOMO;F578 +MONTEODORISIO;F582 +MONTEPAONE;F586 +MONTEPARANO;F587 +MONTEPRANDONE;F591 +MONTEPULCIANO;F592 +MONTERADO;F593 +MONTERCHI;F594 +MONTEREALE;F595 +MONTEREALE VALCELLINA;F596 +MONTERENZIO;F597 +MONTERIGGIONI;F598 +MONTERINALDO;F599 +MONTERODUNI;F601 +MONTERONI D'ARBIA;F605 +MONTERONI DI LECCE;F604 +MONTEROSI;F606 +MONTEROSSO AL MARE;F609 +MONTEROSSO ALMO;F610 +MONTEROSSO CALABRO;F607 +MONTEROSSO GRANA;F608 +MONTEROTONDO;F611 +MONTEROTONDO MARITTIMO;F612 +MONTERUBBIANO;F614 +MONTESANO SALENTINO;F623 +MONTESANO SULLA MARCELLANA;F625 +MONTESARCHIO;F636 +MONTESCAGLIOSO;F637 +MONTESCANO;F638 +MONTESCHENO;F639 +MONTESCUDAIO;F640 +MONTESCUDO;F641 +MONTESE;F642 +MONTESEGALE;F644 +MONTESILVANO;F646 +MONTESPERTOLI;F648 +MONTEU DA PO;F651 +MONTEU ROERO;F654 +MONTEVAGO;F655 +MONTEVARCHI;F656 +MONTEVECCHIA;F657 +MONTEVEGLIO;F659 +MONTEVERDE;F660 +MONTEVERDI MARITTIMO;F661 +MONTEVIALE;F662 +MONTEZEMOLO;F666 +MONTI;F667 +MONTIANO;F668 +MONTICELLI BRUSATI;F672 +MONTICELLI D'ONGINA;F671 +MONTICELLI PAVESE;F670 +MONTICELLO BRIANZA;F674 +MONTICELLO CONTE OTTO;F675 +MONTICELLO D'ALBA;F669 +MONTICHIARI;F471 +MONTICIANO;F676 +MONTIERI;F677 +MONTIGLIO;F678 +MONTIGNOSO;F679 +MONTIOVET;F367 +MONTIRONE;F680 +MONTODINE;F681 +MONTOGGIO;F682 +MONTONE;F685 +MONTOPOLI DI SABINA;F687 +MONTOPOLI DI VAL D'ARNO;F686 +MONTORFANO;F688 +MONTORIO AL VOMANO;F690 +MONTORIO NEI FRENTANI;F689 +MONTORIO ROMANO;F692 +MONTORO INFERIORE;F693 +MONTORO SUPERIORE;F694 +MONTORSO VICENTINO;F696 +MONTOTTONE;F697 +MONTRESTA;F698 +MONTU' BECCARIA;F701 +MONVALLE;F703 +MONZA;F704 +MONZAMBANO;F705 +MONZUNO;F706 +MORANO CALABRO;F708 +MORANO SUL PO;F707 +MORANSENGO;F709 +MORARO;F710 +MORAZZONE;F711 +MORBEGNO;F712 +MORBELLO;F713 +MORCIANO DI LEUCA;F716 +MORCIANO DI ROMAGNA;F715 +MORCONE;F717 +MORDANO;F718 +MORENGO;F720 +MORES;F721 +MORESCO;F722 +MORETTA;F723 +MORFASSO;F724 +MORGANO;F725 +MORGEX;F726 +MORGONGIORI;F727 +MORI;F728 +MORIAGO DELLA BATTAGLIA;F729 +MORICONE;F730 +MORIGERATI;F731 +MORIMONDO;D033 +MORINO;F732 +MORIONDO TORINESE;F733 +MORLUPO;F734 +MORMANNO;F735 +MORNAGO;F736 +MORNESE;F737 +MORNICO AL SERIO;F738 +MORNICO LOSANA;F739 +MOROLO;F740 +MOROZZO;F743 +MORRA DE SANCTIS;F744 +MORRO D'ALBA;F745 +MORRO D'ORO;F747 +MORRO REATINO;F746 +MORRONE DEL SANNIO;F748 +MORROVALLE;F749 +MORSANO AL TAGLIAMENTO;F750 +MORSASCO;F751 +MORTARA;F754 +MORTEGLIANO;F756 +MORTERONE;F758 +MORUZZO;F760 +MOSCAZZANO;F761 +MOSCHIANO;F762 +MOSCIANO SANT'ANGELO;F764 +MOSCUFO;F765 +MOSO IN PASSIRIA;F766 +MOSSA;F767 +MOSSANO;F768 +MOSSO SANTA MARIA;F769 +MOTTA BALUFFI;F771 +MOTTA CAMASTRA;F772 +MOTTA D'AFFERMO;F773 +MOTTA DE'CONTI;F774 +MOTTA DI LIVENZA;F770 +MOTTA MONTECORVINO;F777 +MOTTA SAN GIOVANNI;F779 +MOTTA SANTA ANASTASIA;F781 +MOTTA SANTA LUCIA;F780 +MOTTA VISCONTI;F783 +MOTTAFOLLONE;F775 +MOTTALCIATA;F776 +MOTTEGGIANA;B012 +MOTTOLA;F784 +MOZAMBICO;Z333 +MOZZAGROGNA;F785 +MOZZANICA;F786 +MOZZATE;F788 +MOZZECANE;F789 +MOZZO;F791 +MUCCIA;F793 +MUGGIA;F794 +MUGGIO';F797 +MUGNANO DEL CARDINALE;F798 +MUGNANO DI NAPOLI;F799 +MULAZZANO;F801 +MULAZZO;F802 +MURA;F806 +MURAVERA;F808 +MURAZZANO;F809 +MURELLO;F811 +MURIALDO;F813 +MURISENGO;F814 +MURLO;F815 +MURO LECCESE;F816 +MURO LUCANO;F817 +MUROS;F818 +MUSCOLINE;F820 +MUSEI;F822 +MUSILE DI PIAVE;F826 +MUSSO;F828 +MUSSOLENTE;F829 +MUSSOMELI;F830 +MUZZANA DEL TURGNANO;F832 +MUZZANO;F833 +NAGO TORBOLE;F835 +NALLES;F836 +NANNO;F837 +NANTO;F838 +NAPOLI;F839 +NARBOLIA;F840 +NARCAO;F841 +NARDO';F842 +NARDODIPACE;F843 +NARNI;F844 +NARO;F845 +NARZOLE;F846 +NASINO;F847 +NASO;F848 +NATURNO;F849 +NAVE;F851 +NAVE SAN ROCCO;F853 +NAVELLI;F852 +NAZ SCIAVES;F856 +NAZZANO;F857 +NE;F858 +NEBBIUNO;F859 +NEGRAR;F861 +NEIRONE;F862 +NEIVE;F863 +NEMBRO;F864 +NEMI;F865 +NEMOLI;F866 +NEONELI;F867 +NEPAL;Z234 +NEPI;F868 +NERETO;F870 +NEROLA;F871 +NERVESA DELLA BATTAGLIA;F872 +NERVIANO;F874 +NESPOLO;F876 +NESSO;F877 +NETRO;F878 +NETTUNO;F880 +NEVIANO;F881 +NEVIANO DEGLI ARDUINI;F882 +NEVIGLIE;F883 +NIARDO;F884 +NIBBIANO;F885 +NIBBIOLA;F886 +NIBIONNO;F887 +NICARAGUA;Z515 +NICHELINO;F889 +NICOLOSI;F890 +NICORVO;F891 +NICOSIA;F892 +NICOTERA;F893 +NIELLA BELBO;F894 +NIELLA TANARO;F895 +NIGER;Z334 +NIGERIA;Z335 +NIMIS;F898 +NISCEMI;F889 +NISSORIA;F900 +NIZZA DI SICILIA;F901 +NIZZA MONFERRATO;F902 +NOALE;F904 +NOASCA;F906 +NOCARA;F907 +NOCCIANO;F908 +NOCERA INFERIORE;F912 +NOCERA SUPERIORE;F913 +NOCERA TIRINESE;F910 +NOCERA UMBRA;F911 +NOCETO;F914 +NOCI;F915 +NOCIGLIA;F916 +NOEPOLI;F917 +NOGARA;F918 +NOGAREDO;F920 +NOGAROLE ROCCA;F921 +NOGAROLE VICENTINO;F922 +NOICATTARO;F923 +NOLA;F924 +NOLE;F925 +NOLI;F926 +NOMAGLIO;F927 +NOMI;F929 +NONANTOLA;F930 +NONE;F931 +NONIO;F932 +NORAGUGUME;F933 +NORBELLO;F934 +NORCIA;F935 +NORMA;F937 +NORVEGIA;Z125 +NOSATE;F939 +NOTARESCO;F942 +NOTO;F943 +NOVA LEVANTE;F949 +NOVA MILANESE;F944 +NOVA PONENTE;F950 +NOVA SIRI;A942 +NOVAFELTRIA;F137 +NOVALEDO;F947 +NOVALESA;F948 +NOVARA;F952 +NOVARA DI SICILIA;F951 +NOVATE MEZZOLA;F956 +NOVATE MILANESE;F955 +NOVE;F957 +NOVEDRATE;F958 +NOVELLARA;F960 +NOVELLO;F961 +NOVENTA DI PIAVE;F963 +NOVENTA PADOVANA;F962 +NOVENTA VICENTINA;F964 +NOVI DI MODENA;F966 +NOVI LIGURE;F965 +NOVI VELIA;F967 +NOVIGLIO;F968 +NOVOLI;F970 +NUCETTO;F972 +NUGHEDU DI SAN NICOLO';F975 +NUGHEDU SANTA VITTORIA;F974 +NULE;F976 +NULVI;F977 +NUMANA;F978 +NUORO;F979 +NUOVA CALEDONIA;Z716 +NUOVA GUINEA;Z718 +NUOVA ZELANDA;Z719 +NUOVE EBRIDI;Z717 +NURACHI;F980 +NURAGUS;F981 +NURALLAO;F982 +NURAMINIS;F983 +NURECI;F985 +NURRI;F986 +NUS;F987 +NUSCO;F988 +NUVOLENTO;F989 +NUVOLERA;F990 +NUXIS;F991 +OCCHIEPPO INFERIORE;F992 +OCCHIEPPO SUPERIORE;F993 +OCCHIOBELLO;F994 +OCCIMIANO;F995 +OCRE;F996 +ODALENGO GRANDE;F997 +ODALENGO PICCOLO;F998 +ODERZO;F999 +ODOLO;G001 +OFENA;G002 +OFFAGNA;G003 +OFFANENGO;G004 +OFFIDA;G005 +OFFLAGA;G006 +OGGEBBIO;G007 +OGGIONA CON SANTO STEFANO;G008 +OGGIONO;G009 +OGLIANICO;G010 +OGLIASTRO CILENTO;G011 +OLBIA;G015 +OLCENENGO;G016 +OLDENICO;G018 +OLEGGIO;G019 +OLEGGIO CASTELLO;G020 +OLEVANO DI LOMELLINA;G021 +OLEVANO ROMANO;G022 +OLEVANO SUL TUSCIANO;G023 +OLGIATE COMASCO;G025 +OLGIATE MOLGORA;G026 +OLGIATE OLONA;G028 +OLGINATE;G030 +OLIENA;G031 +OLIVA GESSI;G032 +OLIVADI;G034 +OLIVERI;G036 +OLIVETO CITRA;G039 +OLIVETO LARIO;G040 +OLIVETO LUCANO;G037 +OLIVETTA SAN MICHELE;G041 +OLIVOLA;G042 +OLLASTRA SIMAXIS;G043 +OLLOLAI;G044 +OLLOMONT;G045 +OLMEDO;G046 +OLMENETA;G047 +OLMO AL BREMBO;G049 +OLMO GENTILE;G048 +OLTRE IL COLLE;G050 +OLTRESSENDA ALTA;G054 +OLTRONA DI SAN MAMETTE;G056 +OLZAI;G058 +OMAN;Z235 +OME;G061 +OMEGNA;G062 +OMIGNANO;G063 +ONANI;G064 +ONANO;G065 +ONCINO;G066 +ONETA;G068 +ONIFAI;G070 +ONIFERI;G071 +ONO SAN PIETRO;G074 +ONORE;G075 +ONZO;G076 +OPERA;G078 +OPI;G079 +OPPEANO;G080 +OPPIDO LUCANO;G081 +OPPIDO MAMERTINA;G082 +ORA;G083 +ORANI;G084 +ORATINO;G086 +ORBASSANO;G087 +ORBETELLO;G088 +ORCIANO DI PESARO;G089 +ORCIANO PISANO;G090 +ORCO FEGLINO;D522 +ORDONA;G000 +ORERO;G093 +ORGIANO;G095 +ORGOSOLO;G097 +ORIA;G098 +ORICOLA;G102 +ORIGGIO;G103 +ORINO;G105 +ORIO AL SERIO;G108 +ORIO CANAVESE;A109 +ORIO LITTA;G107 +ORIOLO;G110 +ORIOLO ROMANO;G111 +ORISTANO;G113 +ORMEA;G114 +ORMELLE;G115 +ORNAGO;G116 +ORNAVASSO;G117 +ORNICA;G118 +OROSEI;G119 +OROTELLI;G120 +ORRIA;G121 +ORROLI;G122 +ORSAGO;G123 +ORSARA BORMIDA;G124 +ORSARA DI PUGLIA;G125 +ORSENIGO;G126 +ORSOGNA;G128 +ORSOMARSO;G129 +ORTA DI ATELLA;G130 +ORTA NOVA;G131 +ORTA SAN GIULIO;G134 +ORTACESUS;G133 +ORTE;G135 +ORTELLE;G136 +ORTEZZANO;G137 +ORTIGNANO RAGGIOLO;G139 +ORTISEI;G140 +ORTONA;G141 +ORTONA DE'MARSI;G142 +ORTONOVO;G143 +ORTOVERO;G144 +ORTUCCHIO;G145 +ORTUERI;G146 +ORUNE;G147 +ORVIETO;G148 +ORVINIO;B595 +ORZINUOVI;G149 +ORZIVECCHI;G150 +OSASCO;G151 +OSASIO;G152 +OSCHIRI;G153 +OSIDDA;G154 +OSIGLIA;G155 +OSILO;G156 +OSIMO;G157 +OSINI;G158 +OSIO SOPRA;G159 +OSIO SOTTO;G160 +OSMATE;E529 +OSNAGO;G161 +OSOPPO;G163 +OSPEDALETTI;G164 +OSPEDALETTO;G168 +OSPEDALETTO D'ALPINOLO;G165 +OSPEDALETTO EUGANEO;G167 +OSPEDALETTO LODIGIANO;G166 +OSPITALE DI CADORE;G169 +OSPITALETTO;G170 +OSSAGO LODIGIANO;G171 +OSSANA;G173 +OSSI;G178 +OSSIMO;G179 +OSSONA;G181 +OSSUCCIO;G182 +OSTANA;G183 +OSTELLATO;G184 +OSTIANO;G185 +OSTIGLIA;G186 +OSTRA;F401 +OSTRA VETERE;F581 +OSTUNI;G187 +OTRANTO;G188 +OTRICOLI;G189 +OTTANA;G191 +OTTATI;G192 +OTTAVIANO;G190 +OTTIGLIO;G193 +OTTOBIANO;G194 +OTTONE;G195 +OULX;G196 +OVADA;G197 +OVARO;G198 +OVIGLIO;G199 +OVINDOLI;G200 +OVODDA;G201 +OYACE;G012 +OZEGNA;G202 +OZIERI;G203 +OZZANO DELL'EMILIA;G205 +OZZANO MONFERRATO;G204 +OZZERO;G206 +PABILLONIS;G207 +PACE DEL MELA;G209 +PACECO;G208 +PACENTRO;G210 +PACHINO;G211 +PACIANO;G212 +PADENGHE SUL GARDA;G213 +PADERGNONE;G214 +PADERNA;G215 +PADERNO D'ADDA;G218 +PADERNO DEL GRAPPA;G221 +PADERNO DUGNANO;G220 +PADERNO FRANCIACORTA;G217 +PADERNO PONCHIELLI;G222 +PADOVA;G224 +PADRIA;G225 +PADULA;G226 +PADULI;G227 +PAESANA;G228 +PAESE;G229 +PAESI BASSI;Z126 +PAGANI;G230 +PAGANICO SABINO;G232 +PAGAZZANO;G233 +PAGLIARA;G234 +PAGLIETA;G237 +PAGNACCO;G238 +PAGNO;G240 +PAGNONA;G241 +PAGO DEL VALLO DI LAURO;G242 +PAGO VEIANO;G243 +PAISCO LOVENO;G247 +PAITONE;G248 +PAKISTAN;Z236 +PALADINA;G249 +PALAGANO;G250 +PALAGIANELLO;G251 +PALAGIANO;G252 +PALAGONIA;G253 +PALAIA;G254 +PALANZANO;G255 +PALATA;G257 +PALAU;G258 +PALAZZAGO;G259 +PALAZZO ADRIANO;G263 +PALAZZO CANAVESE;G262 +PALAZZO PIGNANO;G260 +PALAZZO SAN GERVASIO;G261 +PALAZZOLO ACREIDE;G267 +PALAZZOLO DELLO STELLA;G268 +PALAZZOLO SULL'OGLIO;G264 +PALAZZOLO VERCELLESE;G266 +PALAZZUOLO SUL SENIO;G270 +PALENA;G271 +PALERMITI;G272 +PALERMO;G273 +PALESTRINA;G274 +PALESTRO;G275 +PALIANO;G276 +PALIZZI;G277 +PALLAGORIO;G278 +PALLANZENO;G280 +PALLARE;G281 +PALMA CAMPANIA;G283 +PALMA DI MONTECHIARO;G282 +PALMANOVA;G284 +PALMARIGGI;G285 +PALMAS ARBOREA;G286 +PALMI;G288 +PALMIANO;G289 +PALMOLI;G290 +PALO DEL COLLE;G291 +PALOMBARA SABINA;G293 +PALOMBARO;G294 +PALOMONTE;G292 +PALOSCO;G295 +PALU';G297 +PALU' DEL FERSINA;G296 +PALUDI;G298 +PALUZZA;G300 +PAMPARATO;G302 +PANAMA;Z516 +PANCALIERI;G303 +PANCARANA;G304 +PANCHIA';G305 +PANDINO;G306 +PANETTIERI;G307 +PANICALE;G308 +PANNARANO;G311 +PANNI;G312 +PANTELLERIA;G315 +PANTIGLIATE;G316 +PAOLA;G317 +PAOLISI;G318 +PAPASIDERO;G320 +PAPOZZE;G323 +PAPUASIA;Z720 +PARABIAGO;G324 +PARABITA;G325 +PARAGUAY;Z610 +PARATICO;G327 +PARCINES;G328 +PARE';G329 +PARELLA;G330 +PARENTI;G331 +PARETE;G333 +PARETO;G334 +PARGHELIA;G335 +PARLASCO;G336 +PARMA;G337 +PARODI LIGURE;G338 +PAROLDO;G339 +PAROLISE;G340 +PARONA;G342 +PARRANO;G344 +PARRE;G346 +PARTANNA;G347 +PARTINICO;G348 +PARUZZARO;G349 +PARZANICA;G350 +PASIAN DI PRATO;G352 +PASIANO DI PORDENONE;G353 +PASPARDO;G354 +PASSERANO MARMORITO;G358 +PASSIGNANO SUL TRASIMENO;G359 +PASSIRANO;G361 +PASTENA;G362 +PASTORANO;G364 +PASTRENGO;G365 +PASTURANA;G367 +PASTURO;G368 +PATERNO;G369 +PATERNO';G371 +PATERNO CALABRO;G372 +PATERNOPOLI;G370 +PATRICA;G374 +PATTADA;G376 +PATTI;G377 +PATU';G378 +PAU;G379 +PAULARO;G381 +PAULI ARBAREI;G382 +PAULILATINO;G384 +PAULLO;G385 +PAUPISI;G386 +PAVAROLO;G387 +PAVIA;G388 +PAVIA DI UDINE;G389 +PAVONE CANAVESE;G392 +PAVONE DEL MELLA;G391 +PAVULLO NEL FRIGNANO;G393 +PAZZANO;G394 +PECCIOLI;G395 +PECCO;G396 +PECETTO DI VALENZA;G397 +PECETTO TORINESE;G398 +PECORARA;G399 +PEDACE;G400 +PEDARA;G402 +PEDASO;G403 +PEDAVENA;G404 +PEDEMONTE;G406 +PEDEROBBA;G408 +PEDESINA;G410 +PEDIVIGLIANO;G411 +PEDRENGO;G412 +PEGLIO;G415 +PEGLIO;G416 +PEGOGNAGA;G417 +PEIA;G418 +PEIO;G419 +PELAGO;G420 +PELLA;G421 +PELLEGRINO PARMENSE;G424 +PELLEZZANO;G426 +PELLIO INTELVI;G427 +PELLIZZANO;G428 +PELUGO;G429 +PENANGO;G430 +PENNA IN TEVERINA;G432 +PENNA SAN GIOVANNI;G436 +PENNA SANT'ANDREA;G437 +PENNABILLI;G433 +PENNADOMO;G434 +PENNAPIEDIMONTE;G435 +PENNE;G438 +PENTONE;G439 +PERANO;G441 +PERAROLO DI CADORE;G442 +PERCA;G443 +PERCILE;G444 +PERDASDEFOGU;G445 +PERDAXIUS;G446 +PERDIFUMO;G447 +PEREGO;G448 +PERETO;G449 +PERFUGAS;G450 +PERGINE VALDARNO;G451 +PERGINE VALSUGANA;G452 +PERGOLA;G453 +PERINALDO;G454 +PERITO;G455 +PERLEDO;G456 +PERLETTO;G457 +PERLO;G458 +PERLOZ;G459 +PERNUMIA;G461 +PERO;C013 +PEROSA ARGENTINA;G463 +PEROSA CANAVESE;G462 +PERRERO;G465 +PERSICO DOSIMO;G469 +PERTENGO;G471 +PERTICA ALTA;G474 +PERTICA BASSA;G475 +PERTOSA;G476 +PERTUSIO;G477 +PERU`;Z611 +PERUGIA;G478 +PESARO;G479 +PESCAGLIA;G480 +PESCANTINA;G481 +PESCARA;G482 +PESCAROLO ED UNITI;G483 +PESCASSEROLI;G484 +PESCATE;G485 +PESCHE;G486 +PESCHICI;G487 +PESCHIERA BORROMEO;G488 +PESCHIERA DEL GARDA;G489 +PESCIA;G491 +PESCINA;G492 +PESCO SANNITA;G494 +PESCOCOSTANZO;G493 +PESCOLANCIANO;G495 +PESCOPAGANO;G496 +PESCOPENNATARO;G497 +PESCOROCCHIANO;G498 +PESCOSANSONESCO;G499 +PESCOSOLIDO;G500 +PESSANO CON BORNAGO;G502 +PESSINA CREMONESE;G504 +PESSINETTO;G505 +PETACCIATO;G506 +PETILIA POLICASTRO;G508 +PETINA;G509 +PETRALIA SOPRANA;G510 +PETRALIA SOTTANA;G511 +PETRELLA SALTO;G513 +PETRELLA TIFERNINA;G512 +PETRIANO;G514 +PETRIOLO;G515 +PETRITOLI;G516 +PETRIZZI;G517 +PETRONA';G518 +PETRURO IRPINO;G519 +PETTENASCO;G520 +PETTINENGO;G521 +PETTINEO;G522 +PETTORANELLO DEL MOLISE;G523 +PETTORANO SUL GIZIO;G524 +PETTORAZZA GRIMANI;G525 +PEVERAGNO;G526 +PEZZANA;G528 +PEZZAZE;G529 +PEZZOLO VALLE UZZONE;G532 +PIACENZA;G535 +PIACENZA D'ADIGE;G534 +PIADENA;G536 +PIAGGE;G537 +PIAGGINE;G538 +PIAN CAMUNO;G546 +PIAN DI SCO;G552 +PIANA CRIXIA;G542 +PIANA DEGLI ALBANESI;G543 +PIANA DI CAIAZZO;G541 +PIANCASTAGNAIO;G547 +PIANCOGNO;G549 +PIANDIMELETO;G551 +PIANE CRATI;G553 +PIANELLA;G555 +PIANELLO DEL LARIO;G556 +PIANELLO VAL TIDONE;G557 +PIANENGO;G558 +PIANEZZA;G559 +PIANEZZE;G560 +PIANFEI;G561 +PIANICO;G564 +PIANIGA;G565 +PIANO DI SORRENTO;G568 +PIANOPOLI;D546 +PIANORO;G570 +PIANSANO;G571 +PIANTEDO;G572 +PIARIO;G574 +PIASCO;G575 +PIATEDA;G576 +PIATTO;G577 +PIAZZA AL SERCHIO;G582 +PIAZZA ARMERINA;G580 +PIAZZA BREMBANA;G579 +PIAZZATORRE;G583 +PIAZZOLA SUL BRENTA;G587 +PIAZZOLO;G588 +PICCIANO;G589 +PICERNO;G590 +PICINISCO;G591 +PICO;G592 +PIEA;G593 +PIEDICAVALLO;G594 +PIEDILUCO;G595 +PIEDIMONTE ETNEO;G597 +PIEDIMONTE MATESE;G596 +PIEDIMONTE SAN GERMANO;G598 +PIEDIMULERA;G600 +PIEGARO;G601 +PIENZA;G602 +PIERANICA;G603 +PIETRA DE'GIORGI;G612 +PIETRA LIGURE;G605 +PIETRA MARAZZI;G619 +PIETRABBONDANTE;G606 +PIETRABRUNA;G607 +PIETRACAMELA;G608 +PIETRACATELLA;G609 +PIETRACUPA;G610 +PIETRADEFUSI;G611 +PIETRAFERRAZZANA;G613 +PIETRAFITTA;G615 +PIETRAGALLA;G616 +PIETRALUNGA;G618 +PIETRAMELARA;G620 +PIETRAMONTECORVINO;G604 +PIETRANICO;G621 +PIETRAPAOLA;G622 +PIETRAPERTOSA;G623 +PIETRAPERZIA;G624 +PIETRAPORZIO;G625 +PIETRAROJA;G626 +PIETRARUBBIA;G627 +PIETRASANTA;G628 +PIETRASTORNINA;G629 +PIETRAVAIRANO;G630 +PIETRELCINA;G631 +PIEVE A NIEVOLE;G636 +PIEVE ALBIGNOLA;G635 +PIEVE D'ALPAGO;G638 +PIEVE DEL CAIRO;G639 +PIEVE DI BONO;G641 +PIEVE DI CADORE;G642 +PIEVE DI CENTO;G643 +PIEVE DI CORIANO;G633 +PIEVE DI LEDRO;G644 +PIEVE DI SOLIGO;G645 +PIEVE DI TECO;G632 +PIEVE D'OLMI;G647 +PIEVE EMANUELE;G634 +PIEVE FISSIRAGA;G096 +PIEVE FOSCIANA;G648 +PIEVE LIGURE;G646 +PIEVE PORTO MORONE;G650 +PIEVE SAN GIACOMO;G651 +PIEVE SANTO STEFANO;G653 +PIEVE TESINO;G656 +PIEVE TORINA;G657 +PIEVE VERGONTE;G658 +PIEVEBOVIGLIANA;G637 +PIEVEPELAGO;G649 +PIGLIO;G659 +PIGNA;G660 +PIGNATARO INTERAMNA;G662 +PIGNATARO MAGGIORE;G661 +PIGNOLA;G663 +PIGNONE;G664 +PIGRA;G665 +PILA;G666 +PIMENTEL;G669 +PIMONTE;G670 +PINAROLO PO;G671 +PINASCA;G672 +PINCARA;G673 +PINEROLO;G674 +PINETO;F831 +PINO D'ASTI;G676 +PINO LAGO MAGGIORE;G677 +PINO TORINESE;G678 +PINZANO AL TAGLIAMENTO;G680 +PINZOLO;G681 +PIOBBICO;G682 +PIOBESI D'ALBA;G683 +PIOBESI TORINESE;G684 +PIODE;G685 +PIOLTELLO;G686 +PIOMBINO;G687 +PIOMBINO DESE;G688 +PIORACO;G690 +PIOSSASCO;G691 +PIOVA' MASSAIA;G692 +PIOVE DI SACCO;G693 +PIOVENE ROCCHETTE;G694 +PIOVERA;G695 +PIOZZANO;G696 +PIOZZO;G697 +PIRAINO;G699 +PISA;G702 +PISANO;G703 +PISCINA;G705 +PISCIOTTA;G707 +PISOGNE;G710 +PISONIANO;G704 +PISTICCI;G712 +PISTOIA;G713 +PISTOLESA;G714 +PITCAIRN;Z722 +PITEGLIO;G715 +PITIGLIANO;G716 +PIUBEGA;G717 +PIURO;G718 +PIVERONE;G719 +PIZZALE;G720 +PIZZIGHETTONE;G721 +PIZZO;G722 +PIZZOFERRATO;G724 +PIZZOLI;G726 +PIZZONE;G727 +PIZZONI;G728 +PLACANICA;G729 +PLATACI;G733 +PLATANIA;G734 +PLATI';G735 +PLAUS;G299 +PLESIO;G737 +PLOAGHE;G740 +PLODIO;G741 +POCAPAGLIA;G742 +POCENIA;G743 +PODENZANA;G746 +PODENZANO;G747 +POFI;G749 +POGGIARDO;G751 +POGGIBONSI;G752 +POGGIO A CAIANO;G754 +POGGIO BERNI;G755 +POGGIO BUSTONE;G756 +POGGIO CATINO;G757 +POGGIO IMPERIALE;G761 +POGGIO MIRTETO;G763 +POGGIO MOIANO;G764 +POGGIO NATIVO;G765 +POGGIO PICENZE;G766 +POGGIO RENATICO;G768 +POGGIO RUSCO;G753 +POGGIO SAN LORENZO;G770 +POGGIO SAN MARCELLO;G771 +POGGIO SAN VICINO;D566 +POGGIO SANNITA;B317 +POGGIODOMO;G758 +POGGIOFIORITO;G760 +POGGIOMARINO;G762 +POGGIOREALE;G767 +POGGIORSINI;G769 +POGGIRIDENTI;G431 +POGLIANO MILANESE;G772 +POGNANA LARIO;G773 +POGNANO;G774 +POGNO;G775 +POIANA MAGGIORE;G776 +POIRINO;G777 +POLAVENO;G779 +POLCENIGO;G780 +POLESELLA;G782 +POLESINE PARMENSE;G783 +POLI;G784 +POLIA;G785 +POLICORO;G786 +POLIGNANO A MARE;G787 +POLINAGO;G789 +POLINESIA;Z723 +POLINO;G790 +POLISTENA;G791 +POLIZZI GENEROSA;G792 +POLLA;G793 +POLLEIN;G794 +POLLENA TROCCHIA;G795 +POLLENZA;F567 +POLLICA;G796 +POLLINA;G797 +POLLONE;G798 +POLLUTRI;G799 +POLONGHERA;G800 +POLONIA;Z127 +POLPENAZZE DEL GARDA;G801 +POLVERARA;G802 +POLVERIGI;G803 +POMARANCE;G804 +POMARETTO;G805 +POMARICO;G806 +POMARO MONFERRATO;G807 +POMAROLO;G808 +POMBIA;G809 +POMEZIA;G811 +POMIGLIANO D'ARCO;G812 +POMPEI;G813 +POMPEIANA;G814 +POMPIANO;G815 +POMPONESCO;G816 +POMPU;G817 +PONCARALE;G818 +PONDERANO;G820 +PONNA;G821 +PONSACCO;G822 +PONSO;G823 +PONT BOZET;G545 +PONT CANAVESE;G826 +PONT SAINT MARTIN;G854 +PONTASSIEVE;G825 +PONTE;G827 +PONTE BUGGIANESE;G833 +PONTE DELL'OLIO;G842 +PONTE DI LEGNO;G844 +PONTE DI PIAVE;G846 +PONTE GARDENA;G830 +PONTE IN VALTELLINA;G829 +PONTE LAMBRO;G847 +PONTE NELLE ALPI;B662 +PONTE NIZZA;G851 +PONTE NOSSA;F941 +PONTE SAN NICOLO';G855 +PONTE SAN PIETRO;G856 +PONTEBBA;G831 +PONTECAGNANO FAIANO;G834 +PONTECCHIO POLESINE;G836 +PONTECHIANALE;G837 +PONTECORVO;G838 +PONTECURONE;G839 +PONTEDASSIO;G840 +PONTEDERA;G843 +PONTELANDOLFO;G848 +PONTELATONE;G849 +PONTELONGO;G850 +PONTENURE;G852 +PONTERANICA;G853 +PONTESTURA;G858 +PONTEVICO;G859 +PONTEY;G860 +PONTI;G861 +PONTI SUL MINCIO;G862 +PONTIDA;G864 +PONTINIA;G865 +PONTINVREA;G866 +PONTIROLO NUOVO;G867 +PONTOGLIO;G869 +PONTREMOLI;G870 +PONZA;G871 +PONZANO DI FERMO;G873 +PONZANO MONFERRATO;G872 +PONZANO ROMANO;G874 +PONZANO VENETO;G875 +PONZONE;G877 +POPOLI;G878 +POPPI;G879 +PORANO;G881 +PORCARI;G882 +PORCIA;G886 +PORDENONE;G888 +PORLEZZA;G889 +PORNASSIO;G890 +PORPETTO;G891 +PORRETTA TERME;A558 +PORTACOMARO;G894 +PORTALBERA;G895 +PORTE;G900 +PORTICI;G902 +PORTICO DI CASERTA;G903 +PORTICO E SAN BENEDETTO;G904 +PORTIGLIOLA;G905 +PORTO AZZURRO;E680 +PORTO CERESIO;G906 +PORTO CESAREO;G000 +PORTO EMPEDOCLE;F299 +PORTO MANTOVANO;G917 +PORTO RECANATI;G919 +PORTO SAN GIORGIO;G920 +PORTO SANT'ELPIDIO;G921 +PORTO TOLLE;G923 +PORTO TORRES;G924 +PORTO VALTRAVAGLIA;G907 +PORTOBUFFOLE';G909 +PORTOCANNONE;G910 +PORTOFERRAIO;G912 +PORTOFINO;G913 +PORTOGALLO;Z128 +PORTOGRUARO;G914 +PORTOMAGGIORE;G916 +PORTOPALO DI CAPO PASSERO;G000 +PORTOSCUSO;G922 +PORTOVENERE;G925 +PORTULA;G927 +POSADA;G929 +POSINA;G931 +POSITANO;G932 +POSSAGNO;G933 +POSTA;G934 +POSTA FIBRENO;G935 +POSTAL;G936 +POSTALESIO;G937 +POSTIGLIONE;G939 +POSTUA;G940 +POTENZA;G942 +POTENZA PICENA;F632 +POVE DEL GRAPPA;G943 +POVEGLIANO;G944 +POVEGLIANO VERONESE;G945 +POVIGLIO;G947 +POVOLETTO;G949 +POZZA DI FASSA;G950 +POZZAGLIA SABINO;G951 +POZZAGLIO ED UNITI;B914 +POZZALLO;G953 +POZZILLI;G954 +POZZO D'ADDA;G955 +POZZOL GROPPO;G960 +POZZOLENGO;G959 +POZZOLEONE;G957 +POZZOLO FORMIGARO;G961 +POZZOMAGGIORE;G962 +POZZONOVO;G963 +POZZUOLI;G964 +POZZUOLO DEL FRIULI;G966 +POZZUOLO MARTESANA;G965 +PRADALUNGA;G968 +PRADAMANO;G969 +PRADLEVES;G970 +PRAGELATO;G973 +PRAIA A MARE;G975 +PRAIANO;G976 +PRALBOINO;G977 +PRALI;G978 +PRALORMO;G979 +PRALUNGO;G980 +PRAMAGGIORE;G981 +PRAMOLLO;G982 +PRAROLO;G985 +PRAROSTINO;G986 +PRASCO;G987 +PRASCORSANO;G988 +PRASO;G980 +PRATA CAMPORTACCIO;G993 +PRATA D'ANSIDONIA;G992 +PRATA DI PORDENONE;G994 +PRATA DI PRINCIPATO;G990 +PRATA SANNITA;G991 +PRATELLA;G995 +PRATIGLIONE;G997 +PRATO;G999 +PRATO ALLO STELVIO;H004 +PRATO CARNICO;H002 +PRATO SESIA;H001 +PRATOLA PELIGNA;H007 +PRATOLA SERRA;H006 +PRATOVECCHIO;H008 +PRAVISDOMINI;H010 +PRAY;G974 +PRAZZO;H011 +PRE' SAINT DIDIER;H042 +PRECENICCO;H014 +PRECI;H015 +PREDAPPIO;H017 +PREDAZZO;H018 +PREDOI;H019 +PREDORE;H020 +PREDOSA;H021 +PREGANZIOL;H022 +PREGNANA MILANESE;H026 +PRELA';H027 +PREMANA;H028 +PREMARIACCO;H029 +PREMENO;H030 +PREMIA;H033 +PREMILCUORE;H034 +PREMOLO;H036 +PREMOSELLO CHIOVENDA;H037 +PREONE;H038 +PREORE;H039 +PREPOTTO;H040 +PRESEGLIE;H043 +PRESENZANO;H045 +PRESEZZO;H046 +PRESICCE;H047 +PRESSANA;H048 +PRESTINE;H050 +PRETORO;H052 +PREVALLE;H055 +PREZZA;H056 +PREZZO;H057 +PRIERO;H059 +PRIGNANO CILENTO;H062 +PRIGNANO SULLA SECCHIA;H061 +PRIMALUNA;H063 +PRIOCCA;H068 +PRIOLA;H069 +PRIOLO;M279 +PRIVERNO;G698 +PRIZZI;H070 +PROCENO;H071 +PROCIDA;H072 +PROPATA;H073 +PROSERPIO;H074 +PROSSEDI;H076 +PROT. ARABIA MERID.;Z202 +PROVAGLIO D'ISEO;H078 +PROVAGLIO VAL SABBIA;H077 +PROVES;H081 +PROVVIDENTI;H083 +PRUNETTO;H085 +PUEGNAGO SUL GARDA;H086 +PUERTO RICO;Z518 +PUGLIANELLO;H087 +PULA;H088 +PULFERO;H089 +PULSANO;H090 +PUMENENGO;H091 +PUOS D'ALPAGO;H092 +PUSIANO;H094 +PUTIFIGARI;H095 +PUTIGNANO;H096 +QATAR;Z237 +QUADRELLE;H097 +QUADRI;H098 +QUAGLIUZZO;H100 +QUALIANO;H101 +QUARANTI;H102 +QUAREGNA;H103 +QUARGNENTO;H104 +QUARNA SOPRA;H106 +QUARNA SOTTO;H107 +QUARONA;H108 +QUARRATA;H109 +QUART;H110 +QUARTO;H114 +QUARTO D'ALTINO;H117 +QUARTU SANT'ELENA;H118 +QUASSOLO;H120 +QUATTORDIO;H121 +QUATTRO CASTELLA;H122 +QUERO;H124 +QUILIANO;H126 +QUINCINETTO;H127 +QUINDICI;H128 +QUINGENTOLE;H129 +QUINTANO;H130 +QUINTO DI TREVISO;H131 +QUINTO VERCELLESE;H132 +QUINTO VICENTINO;H134 +QUINZANO D'OGLIO;H140 +QUISTELLO;H143 +QUITTENGO;H145 +RABBI;H146 +RACALE;H147 +RACALMUTO;H148 +RACCONIGI;H150 +RACCUIA;H151 +RACINES;H152 +RADDA IN CHIANTI;H153 +RADDUSA;H154 +RADICOFANI;H156 +RADICONDOLI;H157 +RAFFADALI;H159 +RAGOGNA;H161 +RAGOLI;H162 +RAGUSA;H163 +RAIANO;H166 +RAMACCA;H168 +RAMISETO;G654 +RAMPONIO VERNA;H171 +RANCIO VALCUVIA;H173 +RANCO;H174 +RANDAZZO;H175 +RANICA;H176 +RANZANICO;H177 +RANZO;H180 +RAPAGNANO;H182 +RAPALLO;H183 +RAPINO;H184 +RAPOLANO TERME;H185 +RAPOLLA;H186 +RAPONE;H187 +RASSA;H188 +RASUN ANTERSELVA;H189 +RASURA;H192 +RAVANUSA;H194 +RAVARINO;H195 +RAVASCLETTO;H196 +RAVELLO;H198 +RAVENNA;H199 +RAVEO;H200 +RAVISCANINA;H202 +RE;H203 +REA;H204 +REALMONTE;H205 +REANA DEL ROIALE;H206 +REANO;H207 +RECALE;H210 +RECANATI;H211 +RECCO;H212 +RECETTO;H213 +RECOARO TERME;H214 +REDAVALLE;H216 +REDONDESCO;H218 +REFRANCORE;H219 +REFRONTOLO;H220 +REGALBUTO;H221 +REGGELLO;H222 +REGGIO CALABRIA;H224 +REGGIO EMILIA;H223 +REGGIOLO;H225 +REINO;H227 +REITANO;H228 +REMANZACCO;H229 +REMEDELLO;H230 +RENATE;H233 +RENDE;H235 +RENON;H236 +REP. CENTRAFRICANA;Z308 +REP. DOMINICANA;Z505 +REP. SUDAFRICANA;Z347 +RESANA;H238 +RESCALDINA;H240 +RESIA;H242 +RESIUTTA;H244 +RESUTTANO;H245 +RETORBIDO;H246 +REVELLO;H247 +REVERE;H248 +REVIGLIASCO D'ASTI;H250 +REVINE LAGO;H253 +REVO';H254 +REZZAGO;H255 +REZZATO;H256 +REZZO;H257 +REZZOAGLIO;H258 +RHEMES NOTRE DAME;H262 +RHEMES SAINT GEORGES;H263 +RHO;H264 +RHODESIA;Z337 +RIACE;H265 +RIALTO;H266 +RIANO;H267 +RIARDO;H268 +RIBERA;H269 +RIBORDONE;H270 +RICADI;H271 +RICALDONE;H272 +RICCIA;H273 +RICCIONE;H274 +RICCO' DEL GOLFO;H275 +RICENGO;H276 +RICIGLIANO;H277 +RIESE PIO X;H280 +RIESI;H281 +RIETI;H282 +RIFIANO;H284 +RIFREDDO;H285 +RIGNANO FLAMINIO;H288 +RIGNANO GARGANICO;H287 +RIGNANO SULL'ARNO;H286 +RIGOLATO;H289 +RIMA SAN GIUSEPPE;H291 +RIMASCO;H292 +RIMELLA;H293 +RIMINI;H294 +RIO DI PUSTERIA;H299 +RIO MARINA;H305 +RIO NELL'ELBA;H297 +RIO SALICETO;H298 +RIOFREDDO;H300 +RIOLA SARDO;H301 +RIOLO TERME;H302 +RIOLUNATO;H303 +RIOMAGGIORE;H304 +RIONERO IN VULTURE;H307 +RIONERO SANNITICO;H308 +RIPA TEATINA;H320 +RIPABOTTONI;H311 +RIPACANDIDA;H312 +RIPALIMOSANI;H313 +RIPALTA ARPINA;H314 +RIPALTA CREMASCA;H315 +RIPALTA GUERINA;H316 +RIPARBELLA;H319 +RIPATRANSONE;H321 +RIPE;H322 +RIPE SAN GINESIO;H323 +RIPI;H324 +RIPOSTO;H325 +RITTANA;H326 +RIVA DEL GARDA;H330 +RIVA DI SOLTO;H331 +RIVA LIGURE;H328 +RIVA PRESSO CHIERI;H337 +RIVA VALDOBBIA;H329 +RIVALBA;H333 +RIVALTA BORMIDA;H334 +RIVALTA DI TORINO;H335 +RIVAMONTE AGORDINO;H327 +RIVANAZZANO;H336 +RIVARA;H338 +RIVAROLO CANAVESE;H340 +RIVAROLO DEL RE ED UNITI;H341 +RIVAROLO MANTOVANO;H342 +RIVARONE;H343 +RIVAROSSA;H344 +RIVE;H346 +RIVE D'ARCANO;H347 +RIVELLO;H348 +RIVERGARO;H350 +RIVIGNANO;H352 +RIVISONDOLI;H353 +RIVODUTRI;H354 +RIVOLI;H355 +RIVOLI VERONESE;H356 +RIVOLTA D'ADDA;H357 +RIZZICONI;H359 +RO FERRARESE;H360 +ROANA;H361 +ROASCHIA;H362 +ROASCIO;H363 +ROASIO;H365 +ROATTO;H366 +ROBASSOMERO;H367 +ROBBIATE;G223 +ROBBIO;H369 +ROBECCHETTO CON INDUNO;H371 +ROBECCO D'OGLIO;H372 +ROBECCO PAVESE;H375 +ROBECCO SUL NAVIGLIO;H373 +ROBELLA;H376 +ROBILANTE;H377 +ROBURENT;H378 +ROCCA CANAVESE;H386 +ROCCA CANTERANO;H387 +ROCCA CIGLIE';H391 +ROCCA D'ARAZZO;H392 +ROCCA D'ARCE;H393 +ROCCA DE'BALDI;H395 +ROCCA DE'GIORGI;H396 +ROCCA D'EVANDRO;H398 +ROCCA DI BOTTE;H399 +ROCCA DI CAMBIO;H400 +ROCCA DI CAVE;H401 +ROCCA DI MEZZO;H402 +ROCCA DI NETO;H403 +ROCCA DI PAPA;H404 +ROCCA GRIMALDA;H414 +ROCCA IMPERIALE;H416 +ROCCA MASSIMA;H421 +ROCCA PIA;H429 +ROCCA PIETORE;H379 +ROCCA PRIORA;H432 +ROCCA SAN CASCIANO;H437 +ROCCA SAN FELICE;H438 +ROCCA SAN GIOVANNI;H439 +ROCCA SANTA MARIA;H440 +ROCCA SANTO STEFANO;H441 +ROCCA SINIBALDA;H446 +ROCCA SUSELLA;H450 +ROCCABASCERANA;H382 +ROCCABERNARDA;H383 +ROCCABIANCA;H384 +ROCCABRUNA;H385 +ROCCACASALE;H389 +ROCCADASPIDE;H394 +ROCCAFIORITA;H405 +ROCCAFLUVIONE;H390 +ROCCAFORTE DEL GRECO;H408 +ROCCAFORTE LIGURE;H406 +ROCCAFORTE MONDOVI';H407 +ROCCAFORZATA;H409 +ROCCAFRANCA;H410 +ROCCAGIOVINE;H411 +ROCCAGLORIOSA;H412 +ROCCAGORGA;H413 +ROCCALBEGNA;H417 +ROCCALUMERA;H418 +ROCCAMANDOLFI;H420 +ROCCAMENA;H422 +ROCCAMONFINA;H423 +ROCCAMONTEPIANO;H424 +ROCCAMORICE;H425 +ROCCANOVA;H426 +ROCCANTICA;H427 +ROCCAPALUMBA;H428 +ROCCAPIEMONTE;H431 +ROCCARAINOLA;H433 +ROCCARASO;H434 +ROCCAROMANA;H436 +ROCCASCALEGNA;H442 +ROCCASECCA;H443 +ROCCASECCA DEI VOLSCI;H444 +ROCCASICURA;H445 +ROCCASPARVERA;H447 +ROCCASPINALVETI;H448 +ROCCASTRADA;H449 +ROCCAVALDINA;H380 +ROCCAVERANO;H451 +ROCCAVIGNALE;H452 +ROCCAVIONE;H453 +ROCCAVIVARA;H454 +ROCCELLA IONICA;H456 +ROCCELLA VALDEMONE;H455 +ROCCHETTA A VOLTURNO;H458 +ROCCHETTA BELBO;H462 +ROCCHETTA DI VARA;H461 +ROCCHETTA E CROCE;H459 +ROCCHETTA LIGURE;H465 +ROCCHETTA NERVINA;H460 +ROCCHETTA PALAFEA;H466 +ROCCHETTA SANT'ANTONIO;H467 +ROCCHETTA TANARO;H468 +RODANO;H470 +RODDI;H472 +RODDINO;H473 +RODELLO;H474 +RODENGO;H475 +RODENGO SAIANO;H477 +RODERO;H478 +RODI GARGANICO;H480 +RODI' MILICI;H479 +RODIGO;H481 +ROE' VOLCIANO;H484 +ROFRANO;H485 +ROGENO;H486 +ROGGIANO GRAVINA;H488 +ROGHUDI;H489 +ROGLIANO;H490 +ROGNANO;H491 +ROGNO;H492 +ROGOLO;H493 +ROIATE;H494 +ROIO DEL SANGRO;H495 +ROISAN;H497 +ROLETTO;H498 +ROLO;H500 +ROMA;H501 +ROMAGNANO AL MONTE;H503 +ROMAGNANO SESIA;H502 +ROMAGNESE;H505 +ROMALLO;H506 +ROMANA;H507 +ROMANENGO;H508 +ROMANIA;Z129 +ROMANO CANAVESE;H511 +ROMANO D'EZZELINO;H512 +ROMANO DI LOMBARDIA;H509 +ROMANS D'ISONZO;H514 +ROMBIOLO;H516 +ROMENO;H517 +ROMENTINO;H518 +ROMETTA;H519 +RONAGO;H521 +RONCA';H522 +RONCADE;H523 +RONCADELLE;H525 +RONCARO;H527 +RONCEGNO;H528 +RONCELLO;H529 +RONCHI DEI LEGIONARI;H531 +RONCHI VALSUGANA;H532 +RONCHIS;H533 +RONCIGLIONE;H534 +RONCO ALL'ADIGE;H540 +RONCO BIELLESE;H538 +RONCO BRIANTINO;H537 +RONCO CANAVESE;H539 +RONCO SCRIVIA;H536 +RONCOBELLO;H535 +RONCOFERRARO;H541 +RONCOFREDDO;H542 +RONCOLA;H544 +RONCONE;H545 +RONDANINA;H546 +RONDISSONE;H547 +RONSECCO;H549 +RONZO CHIENIS;H551 +RONZONE;H552 +ROPPOLO;H553 +RORA';H554 +RORETO CHISONE;H555 +ROSA';H556 +ROSARNO;H558 +ROSASCO;H559 +ROSATE;H560 +ROSAZZA;H561 +ROSCIANO;H562 +ROSCIGNO;H564 +ROSE;H565 +ROSELLO;H566 +ROSETO DEGLI ABRUZZI;F585 +ROSETO VALFORTORE;H568 +ROSIGNANO MARITTIMO;H570 +ROSIGNANO MONFERRATO;H569 +ROSITO CAPO SPULICO;H572 +ROSOLINA;H573 +ROSOLINI;H574 +ROSORA;H575 +ROSSA;H577 +ROSSANA;H578 +ROSSANO;H579 +ROSSANO VENETO;H580 +ROSSIGLIONE;H581 +ROSTA;H583 +ROTA D'IMAGNA;H584 +ROTA GRECA;H585 +ROTELLA;H588 +ROTELLO;H589 +ROTONDA;H590 +ROTONDELLA;H591 +ROTONDI;H592 +ROTTOFRENO;H593 +ROTZO;H594 +ROVAGNATE;H596 +ROVASENDA;H364 +ROVATO;H598 +ROVEGNO;H599 +ROVELLASCA;H601 +ROVELLO PORRO;H602 +ROVERBELLA;H604 +ROVERCHIARA;H606 +ROVERE' DELLA LUNA;H607 +ROVERE' VERONESE;H608 +ROVEREDO DI GUA';H610 +ROVEREDO IN PIANO;H609 +ROVERETO;H612 +ROVESCALA;H614 +ROVETTA;H615 +ROVIANO;H618 +ROVIGO;H620 +ROVITO;H621 +ROVOLON;H622 +ROZZANO;H623 +RUANDA;Z338 +RUBANO;H625 +RUBIANA;H626 +RUBIERA;H627 +RUDA;H629 +RUDIANO;H630 +RUEGLIO;H631 +RUFFANO;H632 +RUFFIA;H633 +RUFFRE';H634 +RUFINA;H635 +RUINAS;F271 +RUINO;H637 +RUMO;H639 +RUOTI;H641 +RUSSI;H642 +RUTIGLIANO;H643 +RUTINO;H644 +RUVIANO;H165 +RUVO DEL MONTE;H646 +RUVO DI PUGLIA;H645 +SABAUDIA;H647 +SABBIA;H648 +SABBIO CHIESE;H650 +SABBIONETA;H652 +SACCO;H654 +SACCOLONGO;H655 +SACILE;H657 +SACROFANO;H658 +SADALI;H659 +SAGAMA;H661 +SAGLIANO MICCA;H662 +SAGRADO;H665 +SAGRON MIS;H666 +SAHARA SPAGNOLO;Z339 +SAINT CHRISTOPHE;H669 +SAINT DENIS;H670 +SAINT MARCEL;H671 +SAINT NICOLAS;H672 +SAINT OYEN;H673 +SAINT PIERRE;H674 +SAINT PIERRE;Z403 +SAINT RHEMY;H675 +SAINT VINCENT;H676 +SALA BAGANZA;H682 +SALA BIELLESE;H681 +SALA BOLOGNESE;H678 +SALA COMACINA;H679 +SALA CONSILINA;H683 +SALA MONFERRATO;H677 +SALANDRA;H687 +SALAPARUTA;H688 +SALARA;H689 +SALASCO;H690 +SALASSA;H691 +SALBERTRAND;H684 +SALCEDO;F810 +SALCITO;H693 +SALE;H694 +SALE DELLE LANGHE;H695 +SALE MARASINO;H699 +SALE SAN GIOVANNI;H704 +SALEMI;H700 +SALENTO;H686 +SALERANO CANAVESE;H702 +SALERANO SUL LAMBRO;H701 +SALERNO;H703 +SALETTO;H705 +SALGAREDA;H706 +SALI VERCELLESE;H707 +SALICE SALENTINO;H708 +SALICETO;H710 +SALISANO;H713 +SALIZZOLE;H714 +SALLE NUOVA;H715 +SALMOUR;H716 +SALO';H717 +SALORNO;H719 +SALSOMAGGIORE TERME;H720 +SALTARA;H721 +SALTRIO;H723 +SALUDECIO;H724 +SALUGGIA;H725 +SALUSSOLA;H726 +SALUZZO;H727 +SALVE;H729 +SALVIROLA;H731 +SALVITELLE;H732 +SALZA DI PINEROLO;H734 +SALZA IRPINA;H733 +SALZANO;H735 +SAM MICHELE SALENTIN;I045 +SAMARATE;H736 +SAMASSI;H738 +SAMATZAI;H739 +SAMBUCA DI SICILIA;H743 +SAMBUCA PISTOIESE;H744 +SAMBUCI;H745 +SAMBUCO;H746 +SAMMICHELE DI BARI;H749 +SAMO;H013 +SAMOA AMERICANE;Z725 +SAMOA OCCIDENTALI;Z726 +SAMOLACO;H752 +SAMONE;H753 +SAMONE;H754 +SAMPEYRE;H755 +SAMUGHEO;H756 +SAN BARTOLOMEO AL MARE;H763 +SAN BARTOLOMEO IN GALDO;H764 +SAN BARTOLOMEO VAL CAVARGNA;H760 +SAN BASILE;H765 +SAN BASILIO;H766 +SAN BASSANO;H767 +SAN BELLINO;H768 +SAN BENEDETTO BELBO;H770 +SAN BENEDETTO DEI MARSI;H772 +SAN BENEDETTO DEL TRONTO;H769 +SAN BENEDETTO IN PERILLIS;H773 +SAN BENEDETTO PO;H771 +SAN BENEDETTO ULLANO;H774 +SAN BENEDETTO VAL DI SAMBRO;G566 +SAN BENIGNO CANAVESE;H775 +SAN BERNARDINO VERBANO;H777 +SAN BIAGIO DELLA CIMA;H780 +SAN BIAGIO DI CALLALTA;H781 +SAN BIAGIO PLATANI;H778 +SAN BIAGIO SARACINISCO;H779 +SAN BIASE;H782 +SAN BONIFACIO;H783 +SAN BUONO;H784 +SAN CALOGERO;H785 +SAN CANDIDO;H786 +SAN CANZIAN D'ISONZO;H787 +SAN CARLO CANAVESE;H789 +SAN CASCIANO DEI BAGNI;H790 +SAN CASCIANO IN VAL DI PESA;H791 +SAN CASSIANO;H000 +SAN CATALDO;H792 +SAN CESARIO DI LECCE;H793 +SAN CESARIO SUL PANARO;H794 +SAN CHIRICO NUOVO;H795 +SAN CHIRICO RAPARO;H796 +SAN CIPIRELLO;H797 +SAN CIPRIANO D'AVERSA;H798 +SAN CIPRIANO PICENTINO;H800 +SAN CIPRIANO PO;H799 +SAN CLEMENTE;H801 +SAN COLOMBANO AL LAMBRO;H803 +SAN COLOMBANO BELMONTE;H804 +SAN COLOMBANO CERTENOLI;H802 +SAN CONO;H805 +SAN COSMO ALBANESE;H806 +SAN COSTANTINO ALBANESE;H808 +SAN COSTANTINO CALABRO;H807 +SAN COSTANZO;H809 +SAN CRISTOFORO;H810 +SAN DAMIANO AL COLLE;H814 +SAN DAMIANO D'ASTI;H811 +SAN DAMIANO MACRA;H812 +SAN DANIELE DEL FRIULI;H816 +SAN DANIELE PO;H815 +SAN DEMETRIO CORONE;H818 +SAN DEMETRIO NE'VESTINI;H819 +SAN DIDERO;H820 +SAN DONA' DI PIAVE;H823 +SAN DONACI;H822 +SAN DONATO DI LECCE;H826 +SAN DONATO DI NINEA;H825 +SAN DONATO MILANESE;H827 +SAN DONATO VAL DI COMINO;H824 +SAN DORLIGO DELLA VALLE;D324 +SAN FEDELE INTELVI;H830 +SAN FELE;H831 +SAN FELICE A CANCELLO;H834 +SAN FELICE CIRCEO;H836 +SAN FELICE DEL BENACO;H838 +SAN FELICE DEL MOLISE;H833 +SAN FELICE SUL PANARO;H835 +SAN FERDINANDO DI PUGLIA;H839 +SAN FERMO DELLA BATTAGLIA;H840 +SAN FILI;H841 +SAN FILIPPO DEL MELA;H842 +SAN FIOR;H843 +SAN FIORANO;H844 +SAN FLORIANO DEL COLLIO;H845 +SAN FLORO;H846 +SAN FRANCESCO AL CAMPO;H847 +SAN FRATELLO;H850 +SAN GAVINO MONREALE;H856 +SAN GEMINI;H857 +SAN GENESIO ATESINO;H858 +SAN GENESIO ED UNITI;H859 +SAN GENNARO VESUVIANO;H860 +SAN GERMANO CHISONE;H862 +SAN GERMANO DEI BERICI;H863 +SAN GERMANO VERCELLESE;H861 +SAN GERVASIO BRESCIANO;H865 +SAN GIACOMO DEGLI SCHIAVONI;H867 +SAN GIACOMO DELLE SEGNATE;H870 +SAN GIACOMO FILIPPO;H868 +SAN GIACOMO VERCELLESE;B952 +SAN GILLIO;H873 +SAN GIMIGNANO;H875 +SAN GINESIO;H876 +SAN GIORGIO A CREMANO;H892 +SAN GIORGIO A LIRI;H880 +SAN GIORGIO ALBANESE;H881 +SAN GIORGIO CANAVESE;H890 +SAN GIORGIO DEL SANNIO;H894 +SAN GIORGIO DELLA RICHINVELDA;H891 +SAN GIORGIO DELLE PERTICHE;H893 +SAN GIORGIO DI LOMELLINA;H885 +SAN GIORGIO DI MANTOVA;H883 +SAN GIORGIO DI NOGARO;H895 +SAN GIORGIO DI PESARO;H886 +SAN GIORGIO DI PIANO;H896 +SAN GIORGIO DI SUSA;H900 +SAN GIORGIO IN BOSCO;H897 +SAN GIORGIO IONICO;H882 +SAN GIORGIO LA MOLARA;H898 +SAN GIORGIO LUCANO;H888 +SAN GIORGIO MONFERRATO;H878 +SAN GIORGIO MORGETO;H889 +SAN GIORGIO PIACENTINO;H887 +SAN GIORGIO SCARAMPI;H899 +SAN GIORGIO SU LEGNANO;H884 +SAN GIOVANNI A PIRO;H907 +SAN GIOVANNI AL NATISONE;H906 +SAN GIOVANNI BIANCO;H910 +SAN GIOVANNI D'ASSO;H911 +SAN GIOVANNI DEL DOSSO;H912 +SAN GIOVANNI DI GERACE;H903 +SAN GIOVANNI GEMINI;H914 +SAN GIOVANNI ILARIONE;H916 +SAN GIOVANNI IN CROCE;H918 +SAN GIOVANNI IN FIORE;H919 +SAN GIOVANNI IN GALDO;H920 +SAN GIOVANNI IN MARIGNANO;H921 +SAN GIOVANNI IN PERSICETO;G467 +SAN GIOVANNI INCARICO;H917 +SAN GIOVANNI LA PUNTA;H922 +SAN GIOVANNI LIPIONI;H923 +SAN GIOVANNI LUPATOTO;H924 +SAN GIOVANNI ROTONDO;H926 +SAN GIOVANNI SUERGIU;G287 +SAN GIOVANNI TEATINO;D690 +SAN GIOVANNI VALDARNO;H901 +SAN GIULIANO DEL SANNIO;H928 +SAN GIULIANO DI PUGLIA;H929 +SAN GIULIANO MILANESE;H930 +SAN GIULIANO TERME;A562 +SAN GIUSEPPE JATO;H933 +SAN GIUSEPPE VESUVIANO;H931 +SAN GIUSTINO;H935 +SAN GIUSTO CANAVESE;H936 +SAN GODENZO;H937 +SAN GREGORIO DA SASSOLA;H942 +SAN GREGORIO DI CATANIA;H940 +SAN GREGORIO D'IPPONA;H941 +SAN GREGORIO MAGNO;H943 +SAN GREGORIO MATESE;H939 +SAN GREGORIO NELLE ALPI;H938 +SAN LAZZARO DI SAVENA;H945 +SAN LEO;H949 +SAN LEONARDO;H951 +SAN LEONARDO IN PASSIRIA;H952 +SAN LEUCIO DEL SANNIO;H953 +SAN LORENZELLO;H955 +SAN LORENZO;H959 +SAN LORENZO AL MARE;H957 +SAN LORENZO BELLIZZI;H961 +SAN LORENZO DEL VALLO;H962 +SAN LORENZO DI SEBATO;H956 +SAN LORENZO IN BANALE;H966 +SAN LORENZO IN CAMPO;H958 +SAN LORENZO ISONTINO;H964 +SAN LORENZO MAGGIORE;H967 +SAN LORENZO NUOVO;H969 +SAN LUCA;H970 +SAN LUCIDO;H971 +SAN LUPO;H973 +SAN MANGO D'AQUINO;H976 +SAN MANGO PIEMONTE;H977 +SAN MANGO SUL CALORE;H975 +SAN MARCELLINO;H978 +SAN MARCELLO;H979 +SAN MARCELLO PISTOIESE;H980 +SAN MARCO ARGENTANO;H981 +SAN MARCO D'ALUNZIO;H982 +SAN MARCO DEI CAVOTI;H984 +SAN MARCO EVANGELISTA;F043 +SAN MARCO IN LAMIS;H985 +SAN MARCO LA CATOLA;H986 +SAN MARINO;Z130 +SAN MARTINO AL TAGLIAMENTO;H999 +SAN MARTINO ALFIERI;H987 +SAN MARTINO BUON ALBERGO;I003 +SAN MARTINO CANAVESE;H997 +SAN MARTINO D'AGRI;H994 +SAN MARTINO DALL'ARGINE;I005 +SAN MARTINO DEL LAGO;I007 +SAN MARTINO DI FINITA;H992 +SAN MARTINO DI LUPARI;I008 +SAN MARTINO DI VENEZZE;H996 +SAN MARTINO IN BADIA;H998 +SAN MARTINO IN PASSIRIA;H989 +SAN MARTINO IN PENSILIS;H990 +SAN MARTINO IN RIO;I011 +SAN MARTINO IN STRADA;I012 +SAN MARTINO SANNITA;I002 +SAN MARTINO SICCOMARIO;I014 +SAN MARTINO SULLA MARRUCCINA;H991 +SAN MARTINO VALLE CAUDINA;I016 +SAN MARZANO DI SAN GIUSEPPE;I018 +SAN MARZANO OLIVETO;I017 +SAN MARZANO SUL SARNO;I019 +SAN MASSIMO;I023 +SAN MAURIZIO CANAVESE;I024 +SAN MAURIZIO D'OPAGLIO;I025 +SAN MAURO CASTELVERDE;I028 +SAN MAURO CILENTO;I031 +SAN MAURO DI SALINE;H712 +SAN MAURO FORTE;I029 +SAN MAURO LA BRUCA;I032 +SAN MAURO MARCHESATO;I026 +SAN MAURO PASCOLI;I027 +SAN MAURO TORINESE;I030 +SAN MICHELE AL TAGLIAMENTO;I040 +SAN MICHELE ALL'ADIGE;I041 +SAN MICHELE DI GANZARIA;I035 +SAN MICHELE DI SERINO;I034 +SAN MICHELE MONDOVI';I037 +SAN MINIATO;I046 +SAN NAZARIO;I047 +SAN NAZZARO;I049 +SAN NAZZARO SESIA;I052 +SAN NAZZARO VAL CAVARGNA;I051 +SAN NICOLA ARCELLA;I060 +SAN NICOLA BARONIA;I061 +SAN NICOLA DA CRISSA;I058 +SAN NICOLA DELL'ALTO;I057 +SAN NICOLA LA STRADA;I056 +SAN NICOLA MANFREDI;I062 +SAN NICOLO' D'ARCIDANO;A368 +SAN NICOLO' DI COMELICO;I063 +SAN NICOLO' GERREI;G383 +SAN PANCRAZIO;I065 +SAN PANCRAZIO SALENTINO;I066 +SAN PAOLO;G407 +SAN PAOLO ALBANESE;B906 +SAN PAOLO BEL SITO;I073 +SAN PAOLO CERVO;I074 +SAN PAOLO D'ARGON;B310 +SAN PAOLO DI CIVITATE;I072 +SAN PAOLO DI JESI;I071 +SAN PAOLO SOLBRITO;I076 +SAN PELLEGRINO TERME;I079 +SAN PIER D'ISONZO;I082 +SAN PIER NICETO;I084 +SAN PIERO A SIEVE;I085 +SAN PIERO PATTI;I086 +SAN PIETRO A MAIDA;I093 +SAN PIETRO AL NATISONE;I092 +SAN PIETRO AL TANAGRO;I089 +SAN PIETRO APOSTOLO;I095 +SAN PIETRO AVELLANA;I096 +SAN PIETRO CLARENZA;I098 +SAN PIETRO DI CADORE;I088 +SAN PIETRO DI CARIDA';I102 +SAN PIETRO DI FELETTO;I103 +SAN PIETRO DI MORUBIO;I105 +SAN PIETRO IN AMANTEA;I108 +SAN PIETRO IN CARIANO;I109 +SAN PIETRO IN CASALE;I110 +SAN PIETRO IN CERRO;G788 +SAN PIETRO IN GU';I107 +SAN PIETRO IN GUARANO;I114 +SAN PIETRO IN LAMA;I115 +SAN PIETRO INFINE;I113 +SAN PIETRO MOSEZZO;I116 +SAN PIETRO MUSSOLINO;I117 +SAN PIETRO VAL LEMINA;I090 +SAN PIETRO VERNOTICO;I119 +SAN PIETRO VIMINARIO;I120 +SAN PIO DELLE CAMERE;I121 +SAN POLO DEI CAVALIERI;I125 +SAN POLO D'ENZA;I123 +SAN POLO DI PIAVE;I124 +SAN POLOMATESE;I122 +SAN PONSO;I127 +SAN POSSIDONIO;I128 +SAN POTITO SANNITICO;I130 +SAN POTITO ULTRA;I129 +SAN PRISCO;I131 +SAN PROCOPIO;I132 +SAN PROSPERO SULLA SECCHIA;I133 +SAN QUIRICO D'ORCIA;I135 +SAN QUIRINO;I136 +SAN RAFFAELE CIMENA;I137 +SAN REMO;I138 +SAN ROBERTO;I139 +SAN ROCCO AL PORTO;I140 +SAN ROMANO IN GARFAGNANA;I142 +SAN RUFO;I143 +SAN SALVATORE DI FITALIA;I147 +SAN SALVATORE MONFERRATO;I144 +SAN SALVATORE TELESINO;I145 +SAN SALVO;I148 +SAN SEBASTIANO AL VESUVIO;I151 +SAN SEBASTIANO CURONE;I150 +SAN SEBASTIANO DA PO;I152 +SAN SECONDO DI PINEROLO;I154 +SAN SECONDO PARMENSE;I153 +SAN SEVERINO LUCANO;I157 +SAN SEVERINO MARCHE;I156 +SAN SEVERO;I158 +SAN SOSSIO BARONIA;I163 +SAN SOSTENE;I164 +SAN SOSTI;I165 +SAN SPERATE;I166 +SAN TAMMARO;I261 +SAN TEODORO;I328 +SAN TEODORO;I329 +SAN TOMASO AGORDINO;I347 +SAN VALENTINO IN ABRUZZO CITERIORE;I376 +SAN VALENTINO TORIO;I377 +SAN VENANZO;I381 +SAN VENDEMIANO;I382 +SAN VERO MILIS;I384 +SAN VINCENZO;I390 +SAN VINCENZO LA COSTA;I388 +SAN VINCENZO VALLE ROVETO;I389 +SAN VITALIANO;I391 +SAN VITO;I402 +SAN VITO AL TAGLIAMENTO;I403 +SAN VITO AL TORRE;I404 +SAN VITO CHIETINO;I394 +SAN VITO DEI NORMANNI;I396 +SAN VITO DI CADORE;I392 +SAN VITO DI FAGAGNA;I405 +SAN VITO DI LEGUZZANO;I401 +SAN VITO LO CAPO;I407 +SAN VITO ROMANO;I400 +SAN VITO SULLO IONIO;I393 +SAN VITTORE DEL LAZIO;I408 +SAN VITTORE OLONA;I409 +SAN ZENO DI MONTAGNA;I414 +SAN ZENO NAVIGLIO;I412 +SAN ZENONE AL LAMBRO;I415 +SAN ZENONE AL PO;I416 +SAN ZENONE DEGLI EZZELINI;I417 +SANARICA;H757 +SANDIGLIANO;H821 +SANDRIGO;H829 +SANFRE';H851 +SANFRONT;H852 +SANGANO;H855 +SANGIANO;H872 +SANGINETO;H877 +SANGUINETTO;H944 +SANLURI;H974 +SANNAZZARO DE'BURGONDI;I048 +SANNICANDRO DI BARI;I053 +SANNICANDRO GARGANICO;I054 +SANNICOLA;I059 +SANSEPOLCRO;I155 +SANTA BRIGIDA;I168 +SANTA CATERINA ALBANESE;I171 +SANTA CATERINA DELLO IONIO;I170 +SANTA CATERINA VILLARMOSA;I169 +SANTA CESAREA TERME;I172 +SANTA CRISTINA D'ASPROMONTE;I176 +SANTA CRISTINA E BISSONE;I175 +SANTA CRISTINA GELA;I174 +SANTA CRISTINA VALGARDENA;I173 +SANTA CROCE CAMERINA;I178 +SANTA CROCE DEL SANNIO;I179 +SANTA CROCE DI MAGLIANO;I181 +SANTA CROCE SULL'ARNO;I177 +SANTA DOMENICA TALAO;I183 +SANTA DOMENICA VITTORIA;I184 +SANTA ELISABETTA;I185 +SANTA FIORA;I187 +SANTA FLAVIA;I188 +SANTA GIULIETTA;I203 +SANTA GIUSTA;I205 +SANTA GIUSTINA;I206 +SANTA GIUSTINA IN COLLE;I207 +SANTA LUCE;I217 +SANTA LUCIA DEL MELA;I220 +SANTA LUCIA DI PIAVE;I221 +SANTA LUCIA DI SERINO;I219 +SANTA MARGHERITA D'ADIGE;I226 +SANTA MARGHERITA DI BELICE;I224 +SANTA MARGHERITA DI STAFFORA;I230 +SANTA MARGHERITA LIGURE;I225 +SANTA MARIA A MONTE;I232 +SANTA MARIA A VICO;I233 +SANTA MARIA CAPUA VETERE;I234 +SANTA MARIA DEL CEDRO;C717 +SANTA MARIA DEL MOLISE;I238 +SANTA MARIA DELLA VERSA;I237 +SANTA MARIA DI LICODIA;I240 +SANTA MARIA DI SALA;I242 +SANTA MARIA HOE';I243 +SANTA MARIA IMBARO;I244 +SANTA MARIA LA FOSSA;I247 +SANTA MARIA LA LONGA;I248 +SANTA MARIA MAGGIORE;I249 +SANTA MARIA NUOVA;I251 +SANTA MARIA REZZONICO;I252 +SANTA MARINA;I253 +SANTA MARINA SALINA;I254 +SANTA MARINELLA;I255 +SANTA NINFA;I291 +SANTA PAOLINA;I301 +SANTA SEVERINA;I308 +SANTA SOFIA;I310 +SANTA SOFIA D'EPIRO;I309 +SANTA TERESA DI GALLURA;I312 +SANTA TERESA DI RIVA;I311 +SANTA VENERINA;I314 +SANTA VITTORIA D'ALBA;I316 +SANTA VITTORIA IN MATENANO;I315 +SANT'ABBONDIO;I167 +SANTADI;I182 +SANT'AGAPITO;I189 +SANT'AGATA BOLOGNESE;I191 +SANT'AGATA DE'GOTI;I197 +SANT'AGATA DEL BIANCO;I198 +SANT'AGATA DI ESARO;I192 +SANT'AGATA DI MILITELLO;I199 +SANT'AGATA DI PUGLIA;I193 +SANT'AGATA FELTRIA;I201 +SANT'AGATA FOSSILI;I190 +SANT'AGATA LI BATTIATI;I202 +SANT'AGATA SUL SANTERNO;I196 +SANT'AGNELLO;I208 +SANT'AGOSTINO;I209 +SANT'ALBANO STURA;I210 +SANT'ALESSIO CON VIALONE;I213 +SANT'ALESSIO IN ASPROMONTE;I214 +SANT'ALESSIO SICULO;I215 +SANT'ALFIO;I216 +SANT'AMBROGIO DI TORINO;I258 +SANT'AMBROGIO DI VALPOLICELLA;I259 +SANT'AMBROGIO SUL GARIGLIANO;I256 +SANT'ANASTASIA;I262 +SANT'ANATOLIA DI NARCO;I263 +SANT'ANDREA APOSTOLO DELLO IONIO;I266 +SANT'ANDREA DEL GARIGLIANO;I265 +SANT'ANDREA DI CONZA;I264 +SANT'ANDREA FRIUS;I271 +SANT'ANGELO A CUPOLO;I277 +SANT'ANGELO A FASANELLA;I278 +SANT'ANGELO A SCALA;I280 +SANT'ANGELO ALL'ESCA;I279 +SANT'ANGELO D'ALIFE;I273 +SANT'ANGELO DEI LOMBARDI;I281 +SANT'ANGELO DEL PESCO;I282 +SANT'ANGELO DI BROLO;I283 +SANT'ANGELO DI PIOVE;I275 +SANT'ANGELO IN LIZZOLA;I285 +SANT'ANGELO IN PONTANO;I286 +SANT'ANGELO IN VADO;I287 +SANT'ANGELO LE FRATTE;I288 +SANT'ANGELO LIMOSANO;I289 +SANT'ANGELO LODIGIANO;I274 +SANT'ANGELO LOMELLINA;I276 +SANT'ANGELO MUXARO;I290 +SANT'ANGELO ROMANO;I284 +SANT'ANNA ARRESI;M209 +SANT'ANNA D'ALFAEDO;I292 +SANT'ANTIMO;I293 +SANT'ANTIOCO;I294 +SANT'ANTONINO DI SUSA;I296 +SANT'ANTONIO ABATE;I300 +SANT'ANTONIO RUINAS;I298 +SANT'APOLLINARE;I302 +SANT'ARCANGELO;I305 +SANTARCANGELO DI ROMAGNA;I304 +SANT'ARCANGELO TRIMONTE;F557 +SANT'ARPINO;I306 +SANT'ARSENIO;I307 +SANTE MARIE;I326 +SANT'EGIDIO ALLA VIBRATA;I318 +SANT'EGIDIO DEL MONTE ALBINO;I317 +SANT'ELENA;I319 +SANT'ELENA;Z340 +SANT'ELENA SANNITA;B466 +SANT'ELIA A PIANISI;I320 +SANT'ELIA FIUMERAPIDO;I321 +SANT'ELPIDIO A MARE;I324 +SANTENA;I327 +SANTERAMO IN COLLE;I330 +SANT'EUFEMIA A MAIELLA;I332 +SANT'EUFEMIA D'ASPROMONTE;I333 +SANT'EUSANIO DEL SANGRO;I335 +SANT'EUSANIO FORCONESE;I336 +SANTHIA';I337 +SANTI COSMA E DAMIANO;I339 +SANT'ILARIO DELLO IONIO;I341 +SANT'ILARIO D'ENZA;I342 +SANT'IPPOLITO;I344 +SANTO STEFANO AL MARE;I365 +SANTO STEFANO BELBO;I367 +SANTO STEFANO D'AVETO;I368 +SANTO STEFANO DEL SOLE;I357 +SANTO STEFANO DI CADORE;C919 +SANTO STEFANO DI CAMASTRA;I370 +SANTO STEFANO DI MAGRA;I363 +SANTO STEFANO DI ROGLIANO;I359 +SANTO STEFANO DI SESSANIO;I360 +SANTO STEFANO IN ASPROMONTE;I371 +SANTO STEFANO LODIGIANO;I362 +SANTO STEFANO QUISQUINA;I356 +SANTO STEFANO ROERO;I372 +SANTO STEFANO TICINO;I361 +SANTO STINO DI LIVENZA;I373 +SANT'OLCESE;I346 +SANTOMENNA;I260 +SANT'OMERO;I348 +SANT'OMOBONO IMAGNA;I349 +SANT'ONOFRIO;I350 +SANTOPADRE;I351 +SANT'ORESTE;I352 +SANTORSO;I353 +SANT'ORSOLA;I354 +SANTU LUSSURGIU;I374 +SANT'URBANO;I375 +SANZA;I410 +SANZENO;I411 +SAO TOME`;Z341 +SAONARA;I418 +SAPONARA;I420 +SAPPADA;I421 +SAPRI;I422 +SARACENA;I423 +SARACINESCO;I424 +SARCEDO;I425 +SARCONI;I426 +SARDARA;I428 +SARDIGLIANO;I429 +SAREGO;I430 +SARENTINO;I431 +SAREZZANO;I432 +SAREZZO;I433 +SARMATO;I434 +SARMEDE;I435 +SARNANO;I436 +SARNICO;I437 +SARNO;I438 +SARNONICO;I439 +SARONNO;I441 +SARRE;I442 +SARROCH;I443 +SARSINA;I444 +SARTEANO;I445 +SARTIRANA LOMELLINA;I447 +SARULE;I448 +SARZANA;I449 +SASSANO;I451 +SASSARI;I452 +SASSELLO;I453 +SASSETTA;I454 +SASSINORO;I455 +SASSO DI CASTALDA;I457 +SASSO MARCONI;G972 +SASSOCORVARO;I459 +SASSOFELTRIO;I460 +SASSOFERRATO;I461 +SASSUOLO;I462 +SATRIANO;I463 +SATRIANO DI LUCANIA;G614 +SAURIS;I464 +SAUZE DI CESANA;I465 +SAUZE D'OULX;I466 +SAVA;I467 +SAVELLI;I468 +SAVIANO;I469 +SAVIGLIANO;I470 +SAVIGNANO IRPINO;I471 +SAVIGNANO SUL PANARO;I473 +SAVIGNANO SUL RUBICONE;I472 +SAVIGNO;I474 +SAVIGNONE;I475 +SAVIORE DELL'ADAMELLO;I476 +SAVOCA;I477 +SAVOGNA;I478 +SAVOGNA D'ISONZO;I479 +SAVOIA DI LUCANIA;H730 +SAVONA;I480 +SCAFA;I482 +SCAFATI;I483 +SCAGNELLO;I484 +SCALA;I486 +SCALA COELI;I485 +SCALDASOLE;I487 +SCALEA;I489 +SCALENGHE;I490 +SCALETTA ZANCLEA;I492 +SCAMPITELLA;I493 +SCANDALE;I494 +SCANDELUZZA;I495 +SCANDIANO;I496 +SCANDICCI;B962 +SCANDOLARA RAVARA;I497 +SCANDOLARA RIPA D'OGLIO;I498 +SCANDRIGLIA;I499 +SCANNO;I501 +SCANO DI MONTIFERRO;I503 +SCANSANO;I504 +SCANZANO IONICO;I000 +SCANZOROSCIATE;I506 +SCAPOLI;I507 +SCARLINO;I510 +SCARMAGNO;I511 +SCARNAFIGI;I512 +SCARPERIA;I514 +SCENA;I519 +SCERNI;I520 +SCHEGGIA E PASCELUPO;I522 +SCHEGGINO;I523 +SCHIAVI DI ABRUZZO;I526 +SCHIAVON;I527 +SCHIGNANO;I529 +SCHILPARIO;I530 +SCHIO;I531 +SCHIVENOGLIA;I532 +SCIACCA;I533 +SCIARA;I534 +SCICLI;I535 +SCIDO;I536 +SCIGLIANO;D290 +SCILLA;I537 +SCILLATO;I538 +SCIOLZE;I539 +SCISCIANO;I540 +SCLAFANI BAGNI;I541 +SCONTRONE;I543 +SCOPA;I544 +SCOPELLO;I545 +SCOPPITO;I546 +SCORDIA;I548 +SCORRANO;I549 +SCORZE';I551 +SCURCOLA MARSICANA;I553 +SCURELLE;I554 +SCURZOLENGO;I555 +SEBORGA;I556 +SECINARO;I558 +SECLI;I559 +SECUGNAGO;I561 +SEDEGLIANO;I562 +SEDICO;I563 +SEDILO;I564 +SEDINI;I565 +SEDRIANO;I566 +SEDRINA;I567 +SEFRO;I569 +SEGARIU;I570 +SEGGIANO;I571 +SEGNI;I573 +SEGONZANO;I576 +SEGRATE;I577 +SEGUSINO;I578 +SELARGIUS;I580 +SELCI;I581 +SELEGAS;I582 +SELLANO;I585 +SELLERO;I588 +SELLIA;I589 +SELLIA MARINA;I590 +SELVA DEI MOLINI;I593 +SELVA DI CADORE;I592 +SELVA DI PROGNO;I594 +SELVA DI VAL GARDENA;I591 +SELVAZZANO DENTRO;I595 +SELVE MARCONE;I596 +SELVINO;I597 +SEMESTENE;I598 +SEMIANA;I599 +SEMINARA;I600 +SEMPRONIANO;I601 +SENAGO;I602 +SENALE SAN FELICE;I603 +SENALES;I604 +SENEGAL;Z343 +SENEGHE;I605 +SENERCHIA;I606 +SENIGA;I607 +SENIGALLIA;I608 +SENIS;I609 +SENISE;I610 +SENNA COMASCO;I611 +SENNA LODIGIANA;I612 +SENNARIOLO;I613 +SENNORI;I614 +SENORBI;I615 +SEPINO;I618 +SEPPIANA;I619 +SEQUALS;I621 +SERAVEZZA;I622 +SERDIANA;I624 +SEREGNO;I625 +SEREN DEL GRAPPA;I626 +SERGNANO;I627 +SERIATE;I628 +SERINA;I629 +SERINO;I630 +SERLE;I631 +SERMIDE;I632 +SERMONETA;I634 +SERNAGLIA DELLA BATTAGLIA;I635 +SERNIO;I636 +SEROLE;I637 +SERRA D'AIELLO;I642 +SERRA DE'CONTI;I643 +SERRA PEDACE;I650 +SERRA RICCO';I640 +SERRA SAN BRUNO;I639 +SERRA SAN QUIRICO;I653 +SERRA SANT'ABBONDIO;I654 +SERRACAPRIOLA;I641 +SERRADIFALCO;I644 +SERRALUNGA D'ALBA;I646 +SERRALUNGA DI CREA;I645 +SERRAMANNA;I647 +SERRAMAZZONI;F357 +SERRAMEZZANA;I648 +SERRAMONACESCA;I649 +SERRAPETRONA;I651 +SERRARA FONTANA;I652 +SERRASTRETTA;I655 +SERRATA;I656 +SERRAVALLE A PO;I662 +SERRAVALLE DI CHIENTI;I661 +SERRAVALLE LANGHE;I659 +SERRAVALLE PISTOIESE;I660 +SERRAVALLE SCRIVIA;I657 +SERRAVALLE SESIA;I663 +SERRE;I666 +SERRENTI;I667 +SERRI;I668 +SERRONE;I669 +SERRUNGARINA;I670 +SERSALE;I671 +SERVIGLIANO;C070 +SESSA AURUNCA;I676 +SESSA CILENTO;I677 +SESSAME;I678 +SESSANO DEL MOLISE;I679 +SESTA GODANO;E070 +SESTINO;I681 +SESTO;I687 +SESTO AL REGHENA;I686 +SESTO CALENDE;I688 +SESTO CAMPANO;I682 +SESTO ED UNITI;I683 +SESTO FIORENTINO;I684 +SESTO SAN GIOVANNI;I690 +SESTOLA;I689 +SESTRI LEVANTE;I693 +SESTRIERE;I692 +SESTU;I695 +SETTALA;I696 +SETTEFRATI;I697 +SETTIME;I698 +SETTIMO MILANESE;I700 +SETTIMO ROTTARO;I701 +SETTIMO SAN PIETRO;I699 +SETTIMO TORINESE;I703 +SETTIMO VITTONE;I702 +SETTINGIANO;I704 +SETZU;I705 +SEUI;I706 +SEULO;I707 +SEVESO;I709 +SEZZADIO;I711 +SEZZE;I712 +SFRUZ;I714 +SGONICO;I715 +SGURGOLA;I716 +SIAMAGGIORE;I717 +SIAMANNA;I719 +SIANO;I720 +SIAPICCIA;I721 +SICIGNANO DEGLI ALBURNI;M253 +SICULIANA;I723 +SIDDI;I724 +SIDERNO;I725 +SIENA;I726 +SIERRA LEONE;Z344 +SIGILLO;I727 +SIGNA;I728 +SIKKIM;Z239 +SILANDRO;I729 +SILANUS;I730 +SILEA;F116 +SILIGO;I732 +SILIQUA;I734 +SILIUS;I735 +SILLANO;I737 +SILLAVENGO;I736 +SILVANO D'ORBA;I738 +SILVANO PIETRA;I739 +SILVI;I741 +SIMALA;I742 +SIMAXIS;I743 +SIMBARIO;I744 +SIMERI E CRICHI;I745 +SINAGRA;I747 +SINALUNGA;A468 +SINDIA;I748 +SINGAPORE;Z230 +SINI;I749 +SINIO;I750 +SINISCOLA;I751 +SINNAI;I752 +SINOPOLI;I753 +SIRACUSA;I754 +SIRIA;Z240 +SIRIGNANO;I756 +SIRIS;I757 +SIRMIONE;I633 +SIROLO;I758 +SIRONE;I759 +SIROR;I760 +SIRTORI;I761 +SISSA;I763 +SIURGUS DONIGALA;I765 +SIZIANO;E265 +SIZZANO;I677 +SLUDERNO;I771 +SMARANO;I772 +SMERILLO;I774 +SOAVE;I775 +SOCCHIEVE;I777 +SOGLIANO AL RUBICONE;I779 +SOGLIANO CAVOUR;I780 +SOGLIO;I781 +SOIANO DEL LAGO;I782 +SOLAGNA;I783 +SOLARINO;I785 +SOLARO;I786 +SOLAROLO;I787 +SOLAROLO RAINERIO;I790 +SOLARUSSA;I791 +SOLBIATE;I792 +SOLBIATE ARNO;I793 +SOLBIATE OLONA;I794 +SOLDANO;I796 +SOLEMINIS;I797 +SOLERO;I798 +SOLESINO;I799 +SOLETO;I800 +SOLFERINO;I801 +SOLIERA;I802 +SOLIGNANO;I803 +SOLOFRA;I805 +SOLONGHELLO;I808 +SOLOPACA;I809 +SOLTO COLLINA;I812 +SOLZA;I813 +SOMAGLIA;I815 +SOMALIA;Z345 +SOMALIA FRANCESE;Z346 +SOMANO;I817 +SOMMA LOMBARDO;I819 +SOMMA VESUVIANA;I820 +SOMMACAMPAGNA;I821 +SOMMARIVA DEL BOSCO;I822 +SOMMARIVA PERNO;I823 +SOMMATINO;I824 +SOMMO;I825 +SONA;I826 +SONCINO;I827 +SONDALO;I828 +SONDRIO;I829 +SONGAVAZZO;I830 +SONICO;I831 +SONNINO;I832 +SOPRANA;I835 +SORA;I838 +SORAGA;I839 +SORAGNA;I840 +SORANO;I841 +SORBO SAN BASILE;I844 +SORBO SERPICO;I843 +SORBOLO;I845 +SORDEVOLO;I847 +SORDIO;I848 +SORESINA;I849 +SORGA';I850 +SORGONO;I851 +SORI;I852 +SORIANELLO;I853 +SORIANO CALABRO;I854 +SORIANO NEL CIMINO;I855 +SORICO;I856 +SORISO;I857 +SORISOLE;I858 +SORMANO;I860 +SORRADILE;I861 +SORRENTO;I862 +SORSO;I863 +SORTINO;I864 +SOSPIRO;I865 +SOSPIROLO;I866 +SOSSANO;I867 +SOSTEGNO;I868 +SOTTO IL MONTE GIOVANNI XXIII;I869 +SOVER;I871 +SOVERATO;I872 +SOVERE;I873 +SOVERIA MANNELLI;I874 +SOVERIA SIMERI;I875 +SOVERZENE;I876 +SOVICILLE;I877 +SOVICO;I878 +SOVIZZO;I879 +SOVRAMONTE;I673 +SOZZAGO;I880 +SPADAFORA;I881 +SPADOLA;I884 +SPAGNA;Z131 +SPARANISE;I885 +SPARONE;I886 +SPECCHIA;I887 +SPELLO;I888 +SPERA;I889 +SPERLINGA;I891 +SPERLONGA;I892 +SPERONE;I893 +SPESSA;I894 +SPEZZANO ALBANESE;I895 +SPEZZANO DELLA SILA;I896 +SPEZZANO PICCOLO;I898 +SPIAZZO;I899 +SPIGNO MONFERRATO;I901 +SPIGNO SATURNIA;I902 +SPILAMBERTO;I903 +SPILIMBERGO;I904 +SPILINGA;I905 +SPINADESCO;I906 +SPINAZZOLA;I907 +SPINEA;I908 +SPINEDA;I909 +SPINETE;I910 +SPINETO SCRIVIA;I911 +SPINETOLI;I912 +SPINO D'ADDA;I914 +SPINONE AL LAGO;I916 +SPINOSO;I917 +SPIRANO;I919 +SPOLETO;I921 +SPOLTORE;I922 +SPONGANO;I923 +SPORMAGGIORE;I924 +SPORMINORE;I925 +SPOTORNO;I926 +SPRESIANO;I927 +SPRIANA;I928 +SQUILLACE;I929 +SQUINZANO;I930 +STAFFOLO;I932 +STAGNO LOMBARDO;I935 +STAITI;I936 +STALETTI;I937 +STANGHELLA;I938 +STARANZANO;I939 +STATI UNITI;Z404 +STAZZANO;I941 +STAZZEMA;I942 +STAZZONA;I943 +STEFANACONI;I945 +STELLA;I946 +STELLA CILENTO;G887 +STELLANELLO;I947 +STELVIO;I948 +STENICO;I949 +STERNATIA;I950 +STEZZANO;I951 +STIA;I952 +STIENTA;I953 +STIGLIANO;I954 +STIGNANO;I955 +STILO;I956 +STIMIGLIANO;I959 +STIO;I960 +STORNARA;I962 +STORNARELLA;I963 +STORO;I964 +STRA';I965 +STRADELLA;I968 +STRAMBINELLO;I969 +STRAMBINO;I970 +STRANGOLAGALLI;I973 +STREGNA;I974 +STREMBO;I975 +STRESA;I976 +STREVI;I977 +STRIANO;I978 +STRIGNO;I979 +STRONA;I980 +STRONCONE;I981 +STRONGOLI;I982 +STROPPIANA;I984 +STROPPO;I985 +STROZZA;I986 +STURNO;I990 +SUARDI;B014 +SUBBIANO;I991 +SUBIACO;I992 +SUCCIVO;I993 +SUDAN;Z348 +SUEGLIO;I994 +SUELLI;I995 +SUELLO;I996 +SUISIO;I997 +SULBIATE;I998 +SULMONA;I804 +SULZANO;L002 +SUMIRAGO;L003 +SUMMONTE;L004 +SUNI;L006 +SUNO;L007 +SUPERSANO;L008 +SUPINO;L009 +SURANO;L010 +SURBO;L011 +SUSA;L013 +SUSEGANA;L014 +SUSTINENTE;L015 +SUTERA;L016 +SUTRI;L017 +SUTRIO;L018 +SUVERETO;L019 +SUZZARA;L020 +SVEZIA;Z132 +SVIZZERA;Z133 +SWAZILAND;Z349 +TACENO;L022 +TADASUNI;L023 +TAGGIA;L024 +TAGLIACOZZO;L025 +TAGLIO DI PO;L026 +TAGLIOLO MONFERRATO;L027 +TAIBON AGORDINO;L030 +TAINO;L032 +TAIO;L033 +TAIPANA;G736 +TALAMELLO;L034 +TALAMONA;L035 +TALANA;L036 +TALEGGIO;L037 +TALLA;L038 +TALMASSONS;L039 +TAMBRE;L040 +TANGANICA;Z350 +TAORMINA;L042 +TAPOGLIANO;L044 +TARANO;L046 +TARANTA PELIGNA;L047 +TARANTASCA;L048 +TARANTO;L049 +TARCENTO;L050 +TARQUINIA;D024 +TARSIA;L055 +TARTANO;L056 +TARVISIO;L057 +TARZO;L058 +TASSAROLO;L059 +TASSULLO;L060 +TAURANO;L061 +TAURASI;L062 +TAURIANOVA;L063 +TAURISANO;L064 +TAVAGNACCO;L065 +TAVAGNASCO;L066 +TAVARNELLE VAL DI PESA;L067 +TAVAZZANO CON VILLAVESCO;F260 +TAVENNA;L069 +TAVERNA;L070 +TAVERNERIO;L071 +TAVERNOLA BERGAMASCA;L073 +TAVERNOLE SUL MELLA;C698 +TAVIANO;L074 +TAVIGLIANO;L075 +TAVOLETO;L078 +TAVULLIA;L081 +TEANA;L082 +TEANO;L083 +TEGGIANO;D292 +TEGLIO;L084 +TEGLIO VENETO;L085 +TELESE;L086 +TELGATE;L087 +TELTI;L088 +TELVE;L089 +TELVE DI SOPRA;L090 +TEMPIO PAUSANIA;L093 +TEMU';L094 +TENNA;L096 +TENNO;L097 +TEOLO;L100 +TEOR;L101 +TEORA;L102 +TERAMO;L103 +TERDOBBIATE;L104 +TERELLE;L105 +TERENTO;L106 +TERENZO;E548 +TERLAGO;L107 +TERLANO;L108 +TERLIZZI;L109 +TERME VIGLIATORE;M210 +TERMENO SULLA STRADA DEL VINO;L111 +TERMINI IMERESE;L112 +TERMOLI;L113 +TERNATE;L115 +TERNENGO;L116 +TERNI;L117 +TERNO D'ISOLA;L118 +TERRACINA;L120 +TERRAGNOLO;L121 +TERRALBA;L122 +TERRANOVA DA SIBARI;L124 +TERRANOVA DEI PASSERINI;L125 +TERRANOVA DI POLLINO;L126 +TERRANOVA SAPPO MINULIO;L127 +TERRANUOVA BRACCIOLINI;L123 +TERRASINI;L131 +TERRASSA PADOVANA;L132 +TERRAVECCHIA;L134 +TERRAZZO;L136 +TERRES;L137 +TERRICCIOLA;L138 +TERRUGGIA;L139 +TERTENIA;L140 +TERZIGNO;L142 +TERZO;L143 +TERZO D'AQUILEIA;L144 +TERZOLAS;L145 +TERZORIO;L146 +TESERO;L147 +TESIMO;L149 +TESSENNANO;L150 +TESTICO;L152 +TETI;L153 +TEULADA;L154 +TEVEROLA;L155 +TEZZE SUL BRENTA;L156 +THAILANDIA;Z241 +THIENE;L157 +THIESI;L158 +TIANA;L160 +TIARNO DI SOPRA;L162 +TIARNO DI SOTTO;L163 +TICENGO;L164 +TICINETO;L165 +TIGGIANO;L166 +TIGLIETO;L167 +TIGLIOLE;L168 +TIGNALE;L169 +TIMOR;Z242 +TINNURA;L172 +TIONE DEGLI ABRUZZI;L173 +TIONE DI TRENTO;L174 +TIRANO;L175 +TIRES;L176 +TIRIOLO;L177 +TIROLO;L178 +TISSI;L180 +TITO;L181 +TIVOLI;L182 +TIZZANO VAL PARMA;L183 +TOANO;L184 +TOCCO CAUDIO;L185 +TOCCO DA CASAURIA;L186 +TOCENO;L187 +TODI;L188 +TOFFIA;L189 +TOGO;Z351 +TOIRANO;L190 +TOKELAU;Z727 +TOLENTINO;L191 +TOLFA;L192 +TOLLEGNO;L193 +TOLLO;L194 +TOLMEZZO;L195 +TOLVE;L197 +TOMBOLO;L199 +TON;L200 +TONADICO;L201 +TONARA;L202 +TONCO;L203 +TONENGO;L204 +TONEZZA DEL CIMONE;D717 +TORA E PICCILLI;L205 +TORANO CASTELLO;L206 +TORANO NUOVO;L207 +TORBOLE CASAGLIA;L210 +TORCEGNO;L211 +TORCHIARA;L212 +TORCHIAROLO;L213 +TORELLA DEL SANNIO;L215 +TORELLA DE'LOMBARDI;L214 +TORGIANO;L216 +TORGNON;L217 +TORINO;L219 +TORINO DI SANGRO;L218 +TORITTO;L220 +TORLINO VIMERCATI;L221 +TORNACO;L223 +TORNARECCIO;L224 +TORNATA;L225 +TORNIMPARTE;L227 +TORNO;L228 +TORNOLO;L229 +TORO;L230 +TORPE';L231 +TORRACA;L233 +TORRALBA;L235 +TORRAZZA COSTE;L237 +TORRAZZA PIEMONTE;L238 +TORRAZZO;L239 +TORRE ANNUNZIATA;L245 +TORRE BERETTI E CASTELLARO;L250 +TORRE BOLDONE;L251 +TORRE BORMIDA;L252 +TORRE CAJETANI;L243 +TORRE CANAVESE;L247 +TORRE D'ARESE;L256 +TORRE DE'BUSI;L257 +TORRE DEL GRECO;L259 +TORRE DE'NEGRI;L262 +TORRE DE'PASSERI;L263 +TORRE DE'PICENARDI;L258 +TORRE DE'ROVERI;L265 +TORRE DI MOSTO;L267 +TORRE DI RUGGIERO;L240 +TORRE DI SANTA MARIA;L244 +TORRE D'ISOLA;L269 +TORRE LE NOCELLE;L272 +TORRE MONDOVI';L241 +TORRE ORSAIA;L274 +TORRE PALLAVICINA;L276 +TORRE PELLICE;L277 +TORRE SAN GIORGIO;L278 +TORRE SAN PATRIZIO;L279 +TORRE SANTA SUSANNA;L280 +TORREANO;L246 +TORREBELVICINO;L248 +TORREBRUNA;L253 +TORRECUSO;L254 +TORREGLIA;L270 +TORREGROTTA;L271 +TORREMAGGIORE;L273 +TORRESINA;L281 +TORRETTA;L282 +TORREVECCHIA PIA;L285 +TORREVECCHIA TEATINA;L284 +TORRI DEL BENACO;L287 +TORRI DI QUARTESOLO;L297 +TORRI IN SABINA;L286 +TORRIANA;I550 +TORRICE;L290 +TORRICELLA;L294 +TORRICELLA DEL PIZZO;L296 +TORRICELLA IN SABINA;L293 +TORRICELLA PELIGNA;L291 +TORRICELLA SICURA;L295 +TORRICELLA VERZATE;L292 +TORRIGLIA;L298 +TORRILE;L299 +TORRIONI;L301 +TORRITA DI SIENA;L303 +TORRITA TIBERINA;L302 +TORTOLI';A355 +TORTONA;L304 +TORTORA;L305 +TORTORELLA;L306 +TORTORETO;L307 +TORTORICI;L308 +TORVISCOSA;L309 +TOSCOLANO MADERNO;L312 +TOSSICIA;L314 +TOVO DI SANT'AGATA;L316 +TOVO SAN GIACOMO;L315 +TRABIA;L317 +TRADATE;L319 +TRAMATZA;L321 +TRAMBILENO;L322 +TRAMONTI;L323 +TRAMONTI DI SOPRA;L324 +TRAMONTI DI SOTTO;L325 +TRAMUTOLA;L326 +TRANA;L327 +TRANI;L328 +TRANSACQUA;L329 +TRAONA;L330 +TRAPANI;L331 +TRAPPETO;L332 +TRAREGO VIGGIONA;L333 +TRASACCO;L334 +TRASAGHIS;L335 +TRASQUERA;L336 +TRATALIAS;L337 +TRAUSELLA;L338 +TRAVACO' SICCOMARIO;I236 +TRAVAGLIATO;L339 +TRAVEDONA MONATE;L342 +TRAVERSELLA;L345 +TRAVERSETOLO;L346 +TRAVES;L340 +TRAVESIO;L347 +TRAVO;L348 +TREBASELEGHE;L349 +TREBISACCE;L353 +TRECASALI;L354 +TRECASTAGNI;L355 +TRECATE;L356 +TRECCHINA;L357 +TRECENTA;L359 +TREDOZIO;L361 +TREGLIO;L363 +TREGNAGO;L364 +TREIA;L366 +TREISO;L367 +TREMENICO;L368 +TREMESTIERI ETNEO;L369 +TREMEZZO;L371 +TREMOSINE;L372 +TRENTA;L375 +TRENTINARA;L377 +TRENTO;L378 +TRENTOLA DUCENTA;L379 +TRENZANO;L380 +TREPPO CARNICO;L381 +TREPPO GRANDE;L382 +TREPUZZI;L383 +TREQUANDA;L384 +TRES;L385 +TRESANA;L386 +TRESCORE BALNEARIO;L388 +TRESCORE CREMASCO;L389 +TRESIGALLO;L390 +TRESIVIO;L392 +TRESNURAGHES;L393 +TREVENZUOLO;L396 +TREVI;L397 +TREVI NEL LAZIO;L398 +TREVICO;L399 +TREVIGLIO;L400 +TREVIGNANO;L402 +TREVIGNANO ROMANO;L401 +TREVILLE;L403 +TREVIOLO;L404 +TREVISO;L407 +TREVISO BRESCIANO;L406 +TREZZANO ROSA;L408 +TREZZANO SUL NAVIGLIO;L409 +TREZZO SULL'ADDA;L411 +TREZZO TINELLA;L410 +TREZZONE;L413 +TRIBANO;L414 +TRIBIANO;L415 +TRIBOGNA;L416 +TRICARICO;L418 +TRICASE;L419 +TRICERRO;L420 +TRICESIMO;L421 +TRICHIANA;L422 +TRIEI;L423 +TRIESTE;L424 +TRIGGIANO;L425 +TRIGOLO;L426 +TRINIDAD;Z612 +TRINITA';L427 +TRINITA' D'AGULTU;L428 +TRINITAPOLI;B915 +TRINO;L429 +TRIORA;L430 +TRIPI;L431 +TRISOBBIO;L432 +TRISSINO;L433 +TRIUGGIO;L434 +TRIVENTO;L435 +TRIVERO;L436 +TRIVIGLIANO;L437 +TRIVIGNANO UDINESE;L438 +TRIVIGNO;L439 +TRIVOLZIO;L440 +TRODENA;L444 +TROFARELLO;L445 +TROIA;L447 +TROINA;L448 +TROMELLO;L449 +TRONTANO;L450 +TRONZANO LAGO MAGGIORE;A705 +TRONZANO VERCELLESE;L451 +TROPEA;L452 +TROVO;L453 +TRUCCAZZANO D'ADDA;L454 +TUBRE;L455 +TUENNO;L457 +TUFARA;L458 +TUFILLO;L459 +TUFINO;L460 +TUFO;L461 +TUGLIE;L462 +TUILI;L463 +TULA;L464 +TUNISIA;Z352 +TUORO SUL TRASIMENO;L466 +TURANIA;G507 +TURANO LODIGIANO;L469 +TURATE;L470 +TURBIGO;L471 +TURCHIA;Z243 +TURI;L472 +TURKS E CAICOS;Z519 +TURRI;L473 +TURRIACO;L474 +TURRIVALIGNANI;L475 +TURSI;L477 +TUSA;L478 +TUSCANIA;L310 +UBIALE CLANEZZO;C789 +UBOLDO;L480 +UCRIA;L482 +UDINE;L483 +UGANDA;Z353 +UGENTO;L484 +UGGIANO LA CHIESA;L485 +UGGIATE TREVANO;L487 +ULA' TIRSO;L488 +ULASSAI;L489 +ULTIMO;L490 +UMBERTIDE;D786 +UMBRIATICO;L492 +UNGHERIA;Z134 +UNIONE SOVIETICA;Z135 +URAGO D'OGLIO;L494 +URAS;L496 +URBANA;L497 +URBANIA;L498 +URBE;L499 +URBINO;L500 +URBISAGLIA;L501 +URGNANO;L502 +URI;L503 +URUGUAY;Z613 +URURI;L505 +URZULEI;L506 +USCIO;L507 +USELLUS;L508 +USINI;L509 +USMATE VELATE;L511 +USSANA;L512 +USSARAMANNA;L513 +USSASSAI;L514 +USSEAUX;L515 +USSEGLIO;L516 +USSITA;L517 +USTICA;L519 +UTA;L521 +UZZANO;L522 +VACCARIZZO ALBANESE;L524 +VACONE;L525 +VACRI;L526 +VADENA;L527 +VADO LIGURE;L528 +VAGLI SOTTO;L533 +VAGLIA;L529 +VAGLIO BASILICATA;L532 +VAGLIO SERRA;L531 +VAIANO;L537 +VAIANO CREMASCO;L535 +VAIE;L538 +VAILATE;L539 +VAIRANO PATENORA;L540 +VAJONT;L000 +VAL DELLA TORRE;L555 +VAL DI NIZZA;L562 +VAL DI VIZZE;L564 +VAL MASINO;L638 +VAL REZZO;H259 +VALBONDIONE;L544 +VALBREMBO;L545 +VALBREVENNA;L546 +VALBRONA;L547 +VALDA;L550 +VALDAGNO;L551 +VALDAORA;L552 +VALDASTICO;L554 +VALDENGO;L556 +VALDERICE;G319 +VALDIDENTRO;L557 +VALDIERI;L558 +VALDINA;L561 +VALDISOTTO;L563 +VALDOBBIADENE;L565 +VALDUGGIA;L566 +VALEGGIO;L568 +VALEGGIO SUL MINCIO;L567 +VALENTANO;L569 +VALENZA;L570 +VALENZANO;L571 +VALERA FRATTA;L572 +VALFABBRICA;L573 +VALFENERA;L574 +VALFLORIANA;L575 +VALFURVA;L576 +VALGANNA;L577 +VALGIOIE;L578 +VALGOGLIO;L579 +VALGRANA;L580 +VALGREGHENTINO;L581 +VALGRISANCHE;L582 +VALGUARNERA CAROPEPE;L583 +VALLADA AGORDINA;L584 +VALLANZENGO;L586 +VALLARSA;L588 +VALLATA;L589 +VALLE AGRICOLA;L594 +VALLE AURINA;L595 +VALLE CASTELLANA;L597 +VALLE DELL'ANGELO;G540 +VALLE DI CADORE;L590 +VALLE DI CASIES;L601 +VALLE DI MADDALONI;L591 +VALLE LOMELLINA;L593 +VALLE MOSSO;L606 +VALLE SALIMBENE;L617 +VALLE SAN NICOLAO;L620 +VALLEBONA;L596 +VALLECORSA;L598 +VALLECROSIA;L599 +VALLEDOLMO;L603 +VALLEDORIA;L604 +VALLEFIORITA;I322 +VALLELONGA;L607 +VALLELUNGA PRATAMENO;L609 +VALLEMAIO;L605 +VALLEPIETRA;L611 +VALLERANO;L612 +VALLERMOSA;L613 +VALLEROTONDA;L614 +VALLESACCARDA;L616 +VALLEVE;L623 +VALLI DEL PASUBIO;L624 +VALLINFREDA;L625 +VALLIO TERME;L626 +VALLO DELLA LUCANIA;L628 +VALLO DI NERA;L627 +VALLO TORINESE;L629 +VALLORIATE;L631 +VALMACCA;L633 +VALMADRERA;L634 +VALMALA;L636 +VALMONTONE;L639 +VALMOREA;L640 +VALMOZZOLA;L641 +VALNEGRA;L642 +VALPELLINE;L643 +VALPERGA;L644 +VALPRATO SOANA;B510 +VALSAVARANCHE;L647 +VALSECCA;L649 +VALSINNI;D513 +VALSOLDA;C936 +VALSTAGNA;L650 +VALSTRONA;L651 +VALTOPINA;L653 +VALTORTA;L655 +VALTOURNANCHE;L654 +VALVA;L656 +VALVASONE;L657 +VALVERDE;L658 +VALVERDE;L659 +VALVESTINO;L468 +VANDOIES;L660 +VANZAGHELLO;L664 +VANZAGO;L665 +VANZONE CON SAN CARLO;L666 +VAPRIO D'ADDA;L667 +VAPRIO D'AGOGNA;L668 +VARALLO;L669 +VARALLO POMBIA;L670 +VARANO BORGHI;L671 +VARANO DE MELEGARI;L672 +VARAPODIO;L673 +VARAZZE;L675 +VARCO SABINO;L676 +VAREDO;L677 +VARENA;L678 +VARENNA;L680 +VARESE;L682 +VARESE LIGURE;L681 +VARISELLA;L685 +VARMO;L686 +VARNA;L687 +VARSI;L689 +VARZI;L690 +VARZO;L691 +VAS;L692 +VASANELLO;A701 +VASIA;L693 +VASTO;E372 +VASTOGIRARDI;L696 +VATTARO;L697 +VAUDA CANAVESE;L698 +VAZZANO;L699 +VAZZOLA;L700 +VECCHIANO;L702 +VEDANO AL LAMBRO;L704 +VEDANO OLONA;L703 +VEDDASCA;L705 +VEDELAGO;L706 +VEDESETA;L707 +VEDUGGIO CON COLZANO;L709 +VEGGIANO;L710 +VEGLIE;L711 +VEGLIO;L712 +VEJANO;L713 +VELESO;L715 +VELEZZO LOMELLINA;L716 +VELLETRI;L719 +VELLEZZO BELLINI;L720 +VELO D'ASTICO;L723 +VELO VERONESE;L722 +VELTURNO;L724 +VENAFRO;L725 +VENARIA;L727 +VENAROTTA;L728 +VENASCA;L729 +VENAUS;L726 +VENDONE;L730 +VENDROGNO;L731 +VENEGONO INFERIORE;L733 +VENEGONO SUPERIORE;L734 +VENETICO;L735 +VENEZIA;L736 +VENEZUELA;Z614 +VENIANO;L737 +VENOSA;L738 +VENTICANO;L739 +VENTIMIGLIA;L741 +VENTIMIGLIA DI SICILIA;L740 +VENTOTENE;L742 +VENZONE;L743 +VERANO;L745 +VERANO BRIANZA;L744 +VERBANIA;L746 +VERBICARO;L747 +VERCANA;L748 +VERCEIA;L749 +VERCELLI;L750 +VERCURAGO;L751 +VERDELLINO;L752 +VERDELLO;L753 +VERDERIO INFERIORE;L755 +VERDERIO SUPERIORE;L756 +VERDUNO;L758 +VERGATO;L762 +VERGEMOLI;L763 +VERGHERETO;L764 +VERGIATE;L765 +VERMEZZO;L768 +VERMIGLIO;L769 +VERNANTE;L771 +VERNASCA;L772 +VERNATE;L773 +VERNAZZA;L774 +VERNIO;L775 +VERNOLE;L776 +VEROLANUOVA;L777 +VEROLAVECCHIA;L778 +VEROLENGO;L770 +VEROLI;L780 +VERONA;L781 +VERONELLA;D193 +VERRAYES;L783 +VERRES;C282 +VERRETTO;L784 +VERRONE;L785 +VERRUA PO;L788 +VERRUA SAVOIA;L787 +VERTEMATE CON MINOPRIO;L792 +VERTOVA;L795 +VERUCCHIO;L797 +VERUNO;L798 +VERVIO;L799 +VERVO;L800 +VERZEGNIS;L801 +VERZINO;L802 +VERZUOLO;L804 +VESCOVANA;L805 +VESCOVATO;L806 +VESIME;L807 +VESPOLATE;L808 +VESSALICO;L809 +VESTENANOVA;L810 +VESTIGNE';L811 +VESTONE;L812 +VESTRENO;L813 +VETRALLA;L814 +VETTO;L815 +VEZZA D'ALBA;L817 +VEZZA D'OGLIO;L816 +VEZZANO;L821 +VEZZANO LIGURE;L819 +VEZZANO SUL CROSTOLO;L820 +VEZZI PORTIO;L823 +VIADANA;L826 +VIADANICA;L827 +VIAGRANDE;L828 +VIALE D'ASTI;L829 +VIALFRE';L830 +VIANO;L831 +VIAREGGIO;L833 +VIARIGI;L834 +VIBO VALENTIA;F537 +VIBONATI;L835 +VICALVI;L836 +VICARI;L837 +VICCHIO;L838 +VICENZA;L840 +VICO CANAVESE;L548 +VICO DEL GARGANO;L842 +VICO EQUENSE;L845 +VICO NEL LAZIO;L843 +VICOFORTE;L841 +VICOLI;L846 +VICOLUNGO;L847 +VICOPISANO;L850 +VICOVARO;L851 +VIDDALBA;L000 +VIDIGULFO;L854 +VIDOR;L856 +VIDRACCO;L857 +VIESTE;L858 +VIETNAM DEL NORD;Z245 +VIETNAM DEL SUD;Z244 +VIETRI DI POTENZA;L859 +VIETRI SUL MARE;L860 +VIGANELLA;L864 +VIGANO';L866 +VIGANO SAN MARTINO;L865 +VIGARANO MAINARDA;L868 +VIGASIO;L869 +VIGEVANO;L872 +VIGGIANELLO;L873 +VIGGIANO;L874 +VIGGIU';L876 +VIGHIZZOLO D'ESTE;L878 +VIGLIANO BIELLESE;L880 +VIGLIANO D'ASTI;L879 +VIGNALE MONFERRATO;L881 +VIGNANELLO;L882 +VIGNATE;L883 +VIGNOLA;L885 +VIGNOLA FALESINA;L886 +VIGNOLE BORBERA;L887 +VIGNOLO;L888 +VIGNONE;L889 +VIGO DI CADORE;L890 +VIGO DI FASSA;L893 +VIGO RENDENA;L903 +VIGODARZERE;L892 +VIGOLO;L894 +VIGOLO VATTARO;L896 +VIGOLZONE;L897 +VIGONE;L898 +VIGONOVO;L899 +VIGONZA;L900 +VIGUZZOLO;L904 +VILLA AGNEDO;L910 +VILLA BARTOLOMEA;L912 +VILLA BASILICA;L913 +VILLA BISCOSSI;L917 +VILLA CARCINA;L919 +VILLA CASTELLI;L920 +VILLA CELIERA;L922 +VILLA COLLEMANDINA;L926 +VILLA CORTESE;L928 +VILLA D'ADDA;L929 +VILLA D'ALME';A215 +VILLA DEL BOSCO;L933 +VILLA DEL CONTE;L934 +VILLA DI BRIANO;D801 +VILLA DI CHIAVENNA;L907 +VILLA DI SERIO;L936 +VILLA DI TIRANO;L908 +VILLA D'OGNA;L938 +VILLA ESTENSE;L937 +VILLA FARALDI;L943 +VILLA GUARDIA;L956 +VILLA LAGARINA;L957 +VILLA LATINA;A081 +VILLA LITERNO;L844 +VILLA MINOZZO;L969 +VILLA POMA;F804 +VILLA RENDENA;M006 +VILLA SAN GIOVANNI;M018 +VILLA SAN GIOVANNI IN TUSCIA;H913 +VILLA SAN PIETRO;I118 +VILLA SAN SECONDO;M019 +VILLA SANTA LUCIA;L905 +VILLA SANTA LUCIA DEGLI ABRUZZI;M021 +VILLA SANTA MARIA;M022 +VILLA SANT'ANGELO;M023 +VILLA SANTINA;L909 +VILLA SANTO STEFANO;I364 +VILLA VERDE;A609 +VILLA VICENTINA;M034 +VILLABASSA;L914 +VILLABATE;L916 +VILLACHIARA;L923 +VILLACIDRO;L924 +VILLADEATI;L931 +VILLADOSE;L939 +VILLADOSSOLA;L906 +VILLAFALLETTO;L942 +VILLAFRANCA D'ASTI;L945 +VILLAFRANCA DI VERONA;L949 +VILLAFRANCA IN LUNIGIANA;L946 +VILLAFRANCA PADOVANA;L947 +VILLAFRANCA PIEMONTE;L948 +VILLAFRANCA SICULA;L944 +VILLAFRANCA TIRRENA;L950 +VILLAFRATI;L951 +VILLAGA;L952 +VILLAGRANDE STRISAILI;L953 +VILLALAGO;L958 +VILLALBA;L959 +VILLALFONSINA;L961 +VILLALVERNIA;L963 +VILLAMAGNA;L964 +VILLAMAINA;L965 +VILLAMAR;L966 +VILLAMARZANA;L967 +VILLAMASSARGIA;L968 +VILLAMIROGLIO;L970 +VILLANDRO;L971 +VILLANOVA BIELLESE;L978 +VILLANOVA CANAVESE;L982 +VILLANOVA D'ALBENGA;L975 +VILLANOVA D'ARDENGHI;L983 +VILLANOVA D'ASTI;L984 +VILLANOVA DEL BATTISTA;L973 +VILLANOVA DEL GHEBBO;L985 +VILLANOVA DEL SILLARO;L977 +VILLANOVA DI CAMPOSAMPIERO;L979 +VILLANOVA MARCHESANA;L988 +VILLANOVA MONDOVI';L974 +VILLANOVA MONFERRATO;L972 +VILLANOVA MONTELEONE;L989 +VILLANOVA SOLARO;L990 +VILLANOVA SULL'ARDA;L980 +VILLANOVA TRUSCHEDU;L991 +VILLANOVA TULO;L992 +VILLANOVAFORRU;L986 +VILLANOVAFRANCA;L987 +VILLANTERIO;L994 +VILLANUOVA SUL CLISI;L995 +VILLAPIANA;B903 +VILLAPUTZU;L998 +VILLAR DORA;L999 +VILLAR FOCCHIARDO;M007 +VILLAR PELLICE;M013 +VILLAR PEROSA;M014 +VILLAR SAN COSTANZO;M015 +VILLARBASSE;M002 +VILLARBOIT;M003 +VILLAREGGIA;M004 +VILLARICCA;G309 +VILLAROMAGNANO;M009 +VILLAROSA;M011 +VILLASALTO;M016 +VILLASANTA;M017 +VILLASIMIUS;B738 +VILLASOR;M025 +VILLASPECIOSA;M026 +VILLASTELLONE;M027 +VILLATA;M028 +VILLAURBANA;M030 +VILLAVALLELONGA;M031 +VILLAVERLA;M032 +VILLENEUVE;L981 +VILLESSE;M043 +VILLETTA BARREA;M041 +VILLETTE;M042 +VILLIMPENTA;M044 +VILLONGO;M045 +VILLORBA;M048 +VILMINORE DI SCALVE;M050 +VIMERCATE;M052 +VIMODRONE;M053 +VINADIO;M055 +VINCHIATURO;M057 +VINCHIO;M058 +VINCI;M059 +VINOVO;M060 +VINZAGLIO;M062 +VIOLA;M063 +VIONE;M065 +VIPITENO;M067 +VIRGILIO;H123 +VIRLE PIEMONTE;M069 +VISANO;M070 +VISCHE;M071 +VISCIANO;M072 +VISCO;M073 +VISONE;M077 +VISSO;M078 +VISTARINO;M079 +VISTRORIO;M080 +VITA;M081 +VITERBO;M082 +VITICUSO;M083 +VITO D'ASIO;M085 +VITORCHIANO;M086 +VITTORIA;M088 +VITTORIO VENETO;M089 +VITTORITO;M090 +VITTUONE;M091 +VITULANO;M093 +VITULAZIO;M092 +VIU';M094 +VIVARO;M096 +VIVARO ROMANO;M095 +VIVERONE;M098 +VIZZINI;M100 +VIZZOLA TICINO;M101 +VIZZOLO PREDABISSI;M102 +VO;M103 +VOBARNO;M104 +VOBBIA;M105 +VOCCA;M106 +VODO CADORE;M108 +VOGHERA;M109 +VOGHIERA;M110 +VOGOGNA;M111 +VOLANO;M113 +VOLLA;M115 +VOLONGO;M116 +VOLPAGO DEL MONTELLO;M118 +VOLPARA;M119 +VOLPEDO;M120 +VOLPEGLINO;M121 +VOLPIANO;M122 +VOLTA MANTOVANA;M125 +VOLTAGGIO;M123 +VOLTAGO AGORDINO;M124 +VOLTERRA;M126 +VOLTIDO;M127 +VOLTURARA APPULA;M131 +VOLTURARA IRPINA;M130 +VOLTURINO;M132 +VOLVERA;M133 +VOTTIGNASCO;M136 +YEMEN;Z246 +ZACCANOPOLI;M138 +ZAFFERANA ETNEA;M139 +ZAGARISE;M140 +ZAGAROLO;M141 +ZAMBANA;M142 +ZAMBIA;Z355 +ZAMBRONE;M143 +ZANDOBBIO;M144 +ZANE';M145 +ZANICA;M147 +ZANZIBAR;Z356 +ZAPPONETA;M000 +ZAVATTARELLO;M150 +ZECCONE;M152 +ZEDDIANI;M153 +ZELBIO;M156 +ZELO BUON PERSICO;M158 +ZELO SURRIGONE;M160 +ZEME LOMELLINA;M161 +ZENEVREDO;M162 +ZENSON DI PIAVE;M163 +ZERBA;M165 +ZERBO;M166 +ZERBOLO';M167 +ZERFALIU;M168 +ZERI;M169 +ZERMEGHEDO;M170 +ZERO BRANCO;M171 +ZEVIO;M172 +ZIANO DI FIEMME;M173 +ZIANO PIACENTINO;L848 +ZIBELLO;M174 +ZIBIDO SAN GIACOMO;M176 +ZIGNAGO;M177 +ZIMELLA;M178 +ZIMONE;M179 +ZINASCO;M180 +ZOAGLI;M182 +ZOCCA;M183 +ZOGNO;M184 +ZOLA PREDOSA;M185 +ZOLDO ALTO;I345 +ZOLLINO;M187 +ZONE;M188 +ZOPPE' DI CADORE;M189 +ZOPPOLA;M190 +ZOVENCEDO;M194 +ZUBIENA;M196 +ZUCCARELLO;M197 +ZUCLO;M198 +ZUGLIANO;M199 +ZUGLIO;M200 +ZUMAGLIA;M201 +ZUMPANO;M202 +ZUNGOLI;M203 +ZUNGRI;M204 diff --git a/decompiled-libs/www/acxent-core-1.0.1/debug.properties b/decompiled-libs/www/acxent-core-1.0.1/debug.properties new file mode 100644 index 00000000..90e31ede --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/debug.properties @@ -0,0 +1,5 @@ +###### SENDING DEBUG MAIL PROPERTIES ########## +SMTP=localhost +FROM=f3jar@f3.com +TO=acolzi@f3.com + diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/annotation/CRDescriptor.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/annotation/CRDescriptor.java new file mode 100644 index 00000000..63b15f35 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/annotation/CRDescriptor.java @@ -0,0 +1,16 @@ +package it.acxent.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Documented +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.FIELD}) +public @interface CRDescriptor { + String descrizione() default ""; + + boolean abilita() default true; +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/annotation/package-info.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/annotation/package-info.java new file mode 100644 index 00000000..375bbae6 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/annotation/package-info.java @@ -0,0 +1 @@ +package it.acxent.annotation; diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/api/ApiClientResult.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/api/ApiClientResult.java new file mode 100644 index 00000000..fb786726 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/api/ApiClientResult.java @@ -0,0 +1,41 @@ +package it.acxent.api; + +public class ApiClientResult { + private String msg; + + public ApiClientResult(String msg, boolean status, Object result) { + this.msg = msg; + this.ok = status; + this.result = result; + } + + private boolean ok = true; + + private Object result; + + public ApiClientResult() {} + + public String getMsg() { + return (this.msg == null) ? "" : this.msg.trim(); + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public boolean isOk() { + return this.ok; + } + + public void setOk(boolean status) { + this.ok = status; + } + + public Object getResult() { + return this.result; + } + + public void setResult(Object result) { + this.result = result; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/api/_AblApiClient.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/api/_AblApiClient.java new file mode 100644 index 00000000..e3d29f38 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/api/_AblApiClient.java @@ -0,0 +1,116 @@ +package it.acxent.api; + +import it.acxent.common.Parm; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import java.util.Base64; + +public abstract class _AblApiClient { + public static final String APPLICATION_JSON = "application/json"; + + public static final String IT_IT = "it-IT"; + + protected static final String UTF_8 = "UTF-8"; + + public static final String BEARER = "Bearer "; + + private ApplParmFull apFull = null; + + private boolean useSandbox; + + private String endpointSandbox; + + private String endpointProduction; + + private String username; + + private String password; + + private String token; + + public _AblApiClient(ApplParmFull apFull) { + this.apFull = apFull; + } + + public _AblApiClient() {} + + public static void initApplicationParms(ApplParmFull ap) { + if (ap != null) { + DBAdapter.logDebug(true, "api client: start"); + String l_tipoParm = "API CLIENT"; + Parm bean = new Parm(ap); + DBAdapter.logDebug(true, "api client initParms: stop"); + } + } + + public boolean isUseSandbox() { + return this.useSandbox; + } + + public void setUseSandbox(boolean useSandbox) { + this.useSandbox = useSandbox; + } + + protected String getBase64BasicCredential() { + String encoding = getUsername() + ":" + getUsername(); + return "Basic " + Base64.getEncoder().encodeToString(encoding.getBytes()); + } + + public ApplParmFull getApFull() { + return this.apFull; + } + + public void setApFull(ApplParmFull apFull) { + this.apFull = apFull; + } + + public void setEndpointSandbox(String endpointSandbox) { + this.endpointSandbox = endpointSandbox; + } + + public String getEndpointProduction() { + return this.endpointProduction; + } + + public void setEndpointProduction(String endpointProduction) { + this.endpointProduction = endpointProduction; + } + + public String getEndpointSandbox() { + return this.endpointSandbox; + } + + public String getEndpoint() { + if (isUseSandbox()) + return getEndpointSandbox(); + return getEndpointProduction(); + } + + public String getUsername() { + return this.username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return this.password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getToken() { + return this.token; + } + + public void setToken(String token) { + this.token = token; + } + + protected String getTokenBearer() { + return "Bearer " + getToken(); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/api/package-info.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/api/package-info.java new file mode 100644 index 00000000..b9de8485 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/api/package-info.java @@ -0,0 +1 @@ +package it.acxent.api; diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/bookmark/Bookmark.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/bookmark/Bookmark.java new file mode 100644 index 00000000..55a0103f --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/bookmark/Bookmark.java @@ -0,0 +1,80 @@ +package it.acxent.bookmark; + +import it.acxent.util.AbMessages; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.util.Hashtable; + +public class Bookmark implements Serializable { + private static final long serialVersionUID = 5581069861405842841L; + + private Hashtable items = null; + + private int numberOfItems = 0; + + private String msg; + + public Bookmark() { + this.items = new Hashtable(); + } + + public String addBookmarkItem(BookmarkItem theBI) { + if (!this.items.containsKey(theBI.getBookmarkItemId())) { + this.items.put(theBI.getBookmarkItemId(), theBI); + this.numberOfItems++; + setMsg(AbMessages.getMessage("BM_ITEM_ADDED")); + return AbMessages.getMessage("BM_ITEM_ADDED"); + } + setMsg(AbMessages.getMessage("BM_ITEM_PRESENT")); + return AbMessages.getMessage("BM_ITEM_PRESENT"); + } + + public void clear() { + this.items.clear(); + this.numberOfItems = 0; + } + + protected void finalize() throws Throwable { + this.items.clear(); + } + + public Vectumerator getItems() { + return new Vectumerator(this.items.elements()); + } + + public String getMsg() { + if (this.msg == null) + return ""; + String temp = this.msg; + setMsg(null); + return temp; + } + + public int getNumberOfItems() { + return this.numberOfItems; + } + + public String removeBookmarkItem(BookmarkItem theBI) { + if (this.items.containsKey(theBI.getBookmarkItemId())) { + this.items.remove(theBI.getBookmarkItemId()); + this.numberOfItems--; + setMsg(AbMessages.getMessage("BM_ITEM_DELETED")); + return AbMessages.getMessage("BM_ITEM_DELETED"); + } + setMsg(AbMessages.getMessage("BM_ITEM_NOT_PRESENT")); + return AbMessages.getMessage("BM_ITEM_NOT_PRESENT"); + } + + public String removeBookmarkItem(Long bookmarkItemId) { + if (this.items.containsKey(bookmarkItemId)) { + this.items.remove(bookmarkItemId); + this.numberOfItems--; + return AbMessages.getMessage("BM_ITEM_DELETED"); + } + return AbMessages.getMessage("BM_ITEM_NOT_PRESENT"); + } + + private void setMsg(String newMsg) { + this.msg = newMsg; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/bookmark/BookmarkItem.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/bookmark/BookmarkItem.java new file mode 100644 index 00000000..8725c0be --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/bookmark/BookmarkItem.java @@ -0,0 +1,136 @@ +package it.acxent.bookmark; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import java.io.Serializable; + +public class BookmarkItem implements Serializable { + private static final long serialVersionUID = 4969897129141278294L; + + private Object itemId; + + private Class itemClass; + + private ApplParmFull applParmFull; + + private DBAdapter dbItem; + + private String flgTipoBookmarkItem; + + public static final String TIPO_RISORSA = "R"; + + public static final String TIPO_LINK = "L"; + + private String link; + + private String itemDescription; + + public BookmarkItem(Object anItemPrimaryKey, Class theItemClass, String theItemDescription, ApplParmFull theApplParmFull) { + setItemClass(theItemClass); + setApplParmFull(theApplParmFull); + setFflgTipoBookmarkItem("R"); + setItemDescription(theItemDescription); + setItemId(anItemPrimaryKey); + } + + public BookmarkItem(String link) { + setLink(link); + setFflgTipoBookmarkItem("L"); + } + + public ApplParmFull getApplParmFull() { + return this.applParmFull; + } + + public Long getBookmarkItemId() { + if (getFlgTipoBookmarkItem().equals("L")) + return new Long((long)(getFlgTipoBookmarkItem() + getFlgTipoBookmarkItem()).hashCode()); + return new Long( + + + + (long)(getFlgTipoBookmarkItem() + getFlgTipoBookmarkItem() + String.valueOf(getItemId())).hashCode()); + } + + public DBAdapter getDbItem() { + if (this.dbItem == null && this.itemId != null) + try { + this + .dbItem = getItemClass().newInstance(); + this.dbItem.setApFull(getApplParmFull()); + this.dbItem.findByPrimaryKey(getItemId()); + } catch (Exception e) { + e.printStackTrace(); + } + return this.dbItem; + } + + private Class getItemClass() { + return this.itemClass; + } + + public String getItemDescription() { + return (this.itemDescription == null) ? "" : this.itemDescription; + } + + public Object getItemId() { + return new Long((String)this.itemId); + } + + public String getLink() { + return this.link; + } + + private void setApplParmFull(ApplParmFull newApplParmFull) { + this.applParmFull = newApplParmFull; + } + + private void setDbItem(DBAdapter newDbItem) { + this.dbItem = newDbItem; + } + + private void setFflgTipoBookmarkItem(String newFflgTipoBookmarkItem) { + this.flgTipoBookmarkItem = newFflgTipoBookmarkItem; + } + + private void setItemClass(Class newItemClass) { + this.itemClass = newItemClass; + } + + private void setItemDescription(String newItemDescription) { + this.itemDescription = newItemDescription; + } + + public void setItemId(Object newItemId) { + this.itemId = newItemId; + setDbItem(null); + } + + private void setLink(String newLink) { + this.link = newLink; + } + + public String getDescrizione() { + if (getFlgTipoBookmarkItem().equals("L")) + return getLink(); + if (getFlgTipoBookmarkItem().equals("R")) + return getItemDescription(); + return "???"; + } + + public String getFlgTipoBookmarkItem() { + return this.flgTipoBookmarkItem; + } + + public String getTipoBookmarkItem() { + if (getFlgTipoBookmarkItem().equals("L")) + return "Link"; + if (getFlgTipoBookmarkItem().equals("R")) + return "Risorsa"; + return "???"; + } + + public String getItemClassType() { + return this.itemClass.toString().substring(6); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/ApnsJson.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/ApnsJson.java new file mode 100644 index 00000000..4e9bc3ba --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/ApnsJson.java @@ -0,0 +1,15 @@ +package it.acxent.cloudmsg; + +public class ApnsJson { + private HeadersJson headers; + + public HeadersJson getHeaders() { + if (this.headers == null) + this.headers = new HeadersJson(); + return this.headers; + } + + public void setHeaders(HeadersJson headers) { + this.headers = headers; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/CloudMsgJson.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/CloudMsgJson.java new file mode 100644 index 00000000..404a482e --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/CloudMsgJson.java @@ -0,0 +1,51 @@ +package it.acxent.cloudmsg; + +public class CloudMsgJson { + private MsgJson notification; + + private MsgJson data; + + private String token; + + private ApnsJson apns; + + public CloudMsgJson(MsgJson notification, MsgJson data, String token) { + this.notification = notification; + this.data = data; + this.token = token; + } + + public CloudMsgJson() {} + + public MsgJson getNotification() { + return this.notification; + } + + public void setNotification(MsgJson notification) { + this.notification = notification; + } + + public MsgJson getData() { + return this.data; + } + + public void setData(MsgJson data) { + this.data = data; + } + + public String getToken() { + return this.token; + } + + public void setToken(String to) { + this.token = to; + } + + public ApnsJson getApns() { + return this.apns; + } + + public void setApns(ApnsJson apns) { + this.apns = apns; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/HeadersJson.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/HeadersJson.java new file mode 100644 index 00000000..4a268ab6 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/HeadersJson.java @@ -0,0 +1,16 @@ +package it.acxent.cloudmsg; + +import com.google.gson.annotations.SerializedName; + +public class HeadersJson { + @SerializedName("apns-priority") + private String apnspriority; + + public String getApnspriority() { + return (this.apnspriority == null) ? "10" : this.apnspriority.trim(); + } + + public void setApnspriority(String apnspriority) { + this.apnspriority = apnspriority; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/MsgJson.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/MsgJson.java new file mode 100644 index 00000000..6e405f4d --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/MsgJson.java @@ -0,0 +1,78 @@ +package it.acxent.cloudmsg; + +public class MsgJson { + public static final String NOTIFICATION_TYPE_NOTIFICATION = "notification"; + + private String notificationType; + + private String title; + + private String body; + + private String sound; + + private String priority; + + private String click_action; + + public MsgJson(String notificationType, String title, String body) { + this.title = title; + this.body = body; + } + + public MsgJson(String notificationType, String title, String body, String click_action) { + this.title = title; + this.body = body; + this.click_action = click_action; + } + + public MsgJson() {} + + public String getNotificationType() { + return this.notificationType; + } + + public void setNotificationType(String notificationType) { + this.notificationType = notificationType; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getBody() { + return this.body; + } + + public void setBody(String body) { + this.body = body; + } + + public String getSound() { + return (this.sound == null) ? "default" : this.sound.trim(); + } + + public void setSound(String sound) { + this.sound = sound; + } + + public String getPriority() { + return (this.priority == null) ? "high" : this.priority.trim(); + } + + public void setPriority(String priprity) { + this.priority = priprity; + } + + public String getClick_action() { + return this.click_action; + } + + public void setClick_action(String click_action) { + this.click_action = click_action; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/PushNotificationService.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/PushNotificationService.java new file mode 100644 index 00000000..42402e33 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/cloudmsg/PushNotificationService.java @@ -0,0 +1,109 @@ +package it.acxent.cloudmsg; + +import com.google.auth.oauth2.GoogleCredentials; +import com.google.gson.Gson; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Arrays; +import java.util.List; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.json.JSONObject; + +public class PushNotificationService { + private static final String MESSAGING_SCOPE = "https://www.googleapis.com/auth/firebase.messaging"; + + private static final String[] SCOPES = new String[] { "https://www.googleapis.com/auth/firebase.messaging" }; + + public PushNotificationService(String pathFileJsonAuth) { + setPathFileJsonAuth(pathFileJsonAuth); + } + + private final String FIREBASE_API_URL_OLD = "https://fcm.googleapis.com/fcm/send"; + + private final String FIREBASE_API_URL = "https://fcm.googleapis.com/v1/projects/{projectid}/messages:send"; + + private String pathFileJsonAuth; + + public static final String P_FIREBASE_JSON_AUTH_PRIVATE_KEY = "FIREBASE_JSON_AUTH_PRIVATE_KEY"; + + public void sendPushNotification(List tokens, MsgJson notifica, MsgJson data, String projectId) { + tokens.forEach(token -> { + System.out.println("\nCalling fcm Server >>>>>>>"); + String response = callToFcmServer(token, notifica, data, projectId); + System.out.println("Got response from fcm Server : " + response + "\n\n"); + }); + } + + private String callToFcmServer(String token, MsgJson notifica, MsgJson data, String projectId) { + CloudMsgJson cmj = new CloudMsgJson(notifica, data, token); + StringBuilder result = new StringBuilder(); + try { + CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build(); + HttpPost request = new HttpPost("https://fcm.googleapis.com/v1/projects/{projectid}/messages:send".replace("{projectid}", projectId)); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Authorization", "Bearer " + getServiceAccountAccessToken(getPathFileJsonAuth())); + Gson gson = new Gson(); + JSONObject joMessageV0 = new JSONObject(gson.toJson(cmj)); + JSONObject joMessageV1 = new JSONObject(); + joMessageV1.put("message", joMessageV0); + System.out.println("v0:\n" + joMessageV0.toString(4)); + System.out.println("v1:\n" + joMessageV1.toString(4)); + StringEntity params = new StringEntity(joMessageV1.toString()); + request.setEntity((HttpEntity)params); + HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request); + String content = EntityUtils.toString(resp.getEntity()); + int statusCode = resp.getStatusLine().getStatusCode(); + result.append("Status Code: " + statusCode); + result.append("\nstatusCode = " + statusCode); + result.append("\ncontent = " + content); + } catch (Exception e) { + e.printStackTrace(); + } + return result.toString(); + } + + private static String getServiceAccountAccessToken(String fileJsonAuth) throws IOException { + GoogleCredentials googleCredentials = GoogleCredentials.fromStream(new FileInputStream(fileJsonAuth)) + .createScoped(Arrays.asList(SCOPES)); + googleCredentials.refresh(); + return googleCredentials.getAccessToken().getTokenValue(); + } + + public String getPathFileJsonAuth() { + return this.pathFileJsonAuth; + } + + public void setPathFileJsonAuth(String firebaseServerkey) { + this.pathFileJsonAuth = firebaseServerkey; + } + + private String callToFcmServerOLD(String token, MsgJson notifica, MsgJson data, String projectId) { + CloudMsgJson cmj = new CloudMsgJson(notifica, data, token); + StringBuilder result = new StringBuilder(); + try { + CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build(); + HttpPost request = new HttpPost("https://fcm.googleapis.com/v1/projects/{projectid}/messages:send".replace("{projectid}", projectId)); + request.setHeader("Content-Type", "application/json"); + request.setHeader("Authorization", "key=" + getPathFileJsonAuth()); + Gson gson = new Gson(); + StringEntity params = new StringEntity(gson.toJson(cmj)); + request.setEntity((HttpEntity)params); + HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request); + String content = EntityUtils.toString(resp.getEntity()); + int statusCode = resp.getStatusLine().getStatusCode(); + result.append("Status Code: " + statusCode); + result.append("\nstatusCode = " + statusCode); + result.append("\ncontent = " + content); + } catch (Exception e) { + e.printStackTrace(); + } + return result.toString(); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Access.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Access.java new file mode 100644 index 00000000..663b3772 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Access.java @@ -0,0 +1,1364 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.ColumnDescriptor; +import it.acxent.db.DBAdapter; +import it.acxent.db.EncodedField; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.reg.EcDc; +import it.acxent.util.FileFormatter; +import it.acxent.util.FileWr; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Calendar; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Hashtable; + +public class Access extends DBAdapter implements Serializable { + private static final long serialVersionUID = -1780248797366622876L; + + private static HashMap htTablesSingleton; + + public static final long MASK_TYPE_SIMPLE = 0L; + + public static final long MASK_TYPE_SEARCH_DETAIL = 1L; + + public static final long PAGE_TYPE_CR = 0L; + + public static final long PAGE_TYPE_PRYMARY_DETAIL = 1L; + + public static final long PAGE_TYPE_SIMPLE_DETAIL = 2L; + + public static final long PAGE_TYPE_SIMPLE_DETAIL_FILTER = 3L; + + public static final long COMBO_NONE = 0L; + + public static final long COMBO_BOX = 1L; + + public static final long COMBO_AJAXSEARCH = 2L; + + public static final String PATH_PRIMARY_SIMPLE_PAGE_DEFAULT = "admin/config/_template/simple.jsp"; + + public static final String PATH_PRIMARY_DETAIL_PAGE_DEFAULT = "admin/config/_template/primaryDetail.jsp"; + + public static final String PATH_CR_PAGE_DEFAULT = "admin/config/_template/CR.jsp"; + + public static final String PATH_JAVASRIPT_PAGE_DEFAULT = "admin/config/_template/acxent.js"; + + private String attr1Maiuscoli; + + private String attrMaiuscoli; + + private String attrMinuscoli; + + private String suffissoPD; + + private long flgSafeUpdate; + + private String id_access; + + private long flgTabella; + + private long flgDeleteCascade; + + private String servletPath; + + private long flgMaskType; + + private String id_accessHeader; + + private Access accessHeader; + + private String nomeClasse; + + private long flgAutoPD; + + private String ajaxSearchServlet; + + private String comboDescColumn; + + private String ajstReturnFields; + + private long flgCombo; + + private long flgEncodeAlgoritmo; + + private long flgEncodeModalita; + + private String help; + + private long flgAutoAJST; + + private long flgAutoCR; + + private String descrizione; + + private String suffissoCR; + + private String attrEncoded; + + private String suffissoE; + + private long flgLogicDelete; + + private long flgRicercaSearchTxt; + + private String suffissoDirPages; + + private String attrCompressi; + + private String attrAsIs; + + public Access() {} + + public Access(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public static final String convertFieldToTableName(String className) { + String res = className.substring(0, 1).toLowerCase() + className.substring(0, 1).toLowerCase(); + res = res.replaceAll("(.)([A-Z])", "$1_$2"); + return res.toUpperCase(); + } + + public ResParm addAccess(String l_id_access) { + Access bean = new Access(getApFull()); + bean.findByPrimaryKey(l_id_access); + if (bean.getDBState() == 0) { + DBAdapter.logDebug(true, "getGrantType: addAccess " + l_id_access); + bean.setId_access(l_id_access); + if (l_id_access.startsWith("M_")) { + bean.setDescrizione("_Menu " + l_id_access.toLowerCase().substring(2)); + } else { + bean.setDescrizione(convertTo1stCap(l_id_access.replaceAll("_", " "))); + } + ResParm rp = bean.save(); + if (!rp.getStatus()) { + DBAdapter.logDebug(true, "getGrantType: addAccess ERROR: " + rp.getMsg()); + } else { + DBAdapter.logDebug(false, "getGrantType: addAccess OK: " + bean.getDescrizione()); + } + return rp; + } + return new ResParm(true, ""); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(AccessCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ACCESS AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().isEmpty()) + wc.addWc("(A.descrizione like'%" + CR.getSearchTxt() + "%' or A.id_access like '%" + CR.getSearchTxt() + "%')"); + if (CR.getFlgTabella() == 0L) { + wc.addWc("(A.flgTabella is null or A.flgTabella=0)"); + } else if (CR.getFlgTabella() > 0L) { + wc.addWc("A.flgTabella=" + CR.getFlgTabella()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e, 2); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public String getId_access() { + return (this.id_access == null) ? "" : this.id_access.toUpperCase().trim(); + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setId_access(String newId_permesso) { + this.id_access = newId_permesso; + } + + public String getAttr1Maiuscoli() { + return (this.attr1Maiuscoli == null) ? "" : this.attr1Maiuscoli.replaceAll(" ", ""); + } + + public void setAttr1Maiuscoli(String attr1Maiuscoli) { + this.attr1Maiuscoli = attr1Maiuscoli; + } + + public String getAttrMaiuscoli() { + return (this.attrMaiuscoli == null) ? "" : this.attrMaiuscoli.replaceAll(" ", "").trim(); + } + + public void setAttrMaiuscoli(String attrMaiuscoli) { + this.attrMaiuscoli = attrMaiuscoli; + } + + public String getAttrMinuscoli() { + return (this.attrMinuscoli == null) ? "" : this.attrMinuscoli.replaceAll(" ", ""); + } + + public void setAttrMinuscoli(String attrMinuscoli) { + this.attrMinuscoli = attrMinuscoli; + } + + public long getFlgSafeUpdate() { + return this.flgSafeUpdate; + } + + public void setFlgSafeUpdate(long flgSafeUpdate) { + this.flgSafeUpdate = flgSafeUpdate; + } + + public int getTableColumnStringValueCase(String columnName) { + if (getDBState() == 1 && columnName != null) { + String COMMA = ",", STAR = "*"; + String temp = "," + getAttrAsIs() + ","; + if (temp.indexOf("," + columnName + ",") >= 0) + return 0; + temp = "," + getAttrMaiuscoli() + ","; + if (temp.indexOf("," + columnName + ",") >= 0) + return 1; + temp = "," + getAttrMinuscoli() + ","; + if (temp.indexOf("," + columnName + ",") >= 0) + return 2; + temp = "," + getAttr1Maiuscoli() + ","; + if (temp.indexOf("," + columnName + ",") >= 0) + return 3; + if (getAttrMaiuscoli().equals("*")) + return 1; + if (getAttrMinuscoli().equals("*")) + return 2; + if (getAttr1Maiuscoli().equals("*")) + return 3; + return 0; + } + return 0; + } + + public boolean isTableColumnStringCompressed(String columnName) { + if (getDBState() == 1 && columnName != null) { + String temp = "," + getAttrCompressi() + ","; + if (temp.indexOf("," + columnName + ",") >= 0) + return true; + return false; + } + return false; + } + + protected int getStringValueCase(String l_columnName) { + return 0; + } + + public final Vectumerator getTableStringAttributes() { + if (getDBState() != 1) + return new Vectumerator<>(); + Vectumerator vec = new Vectumerator<>(); + ResultSet rstColumns = null; + try { + rstColumns = getConn().getMetaData().getColumns(null, null, getId_access(), null); + if (!rstColumns.next()) { + rstColumns.close(); + rstColumns = getConn().getMetaData().getColumns(null, null, getId_access().toLowerCase(), null); + } else { + rstColumns.close(); + rstColumns = getConn().getMetaData().getColumns(null, null, getId_access(), null); + } + while (rstColumns.next()) { + short dataType = rstColumns.getShort("DATA_TYPE"); + String columnName = rstColumns.getString("COLUMN_NAME"); + if (dataType == 12 || dataType == 1 || dataType == -16 || dataType == -1 || dataType == -15 || dataType == -9) + vec.add(columnName); + } + rstColumns.close(); + releaseConnection(rstColumns, null, false); + DescTxtLang dtl = new DescTxtLang(getApFull()); + Vectumerator vecDtl = dtl.findCampiTabella(getId_access()); + while (vecDtl.hasMoreElements()) { + DescTxtLang row = (DescTxtLang)vecDtl.nextElement(); + vec.add(row.getCampo()); + } + } catch (Exception e) { + e.printStackTrace(); + } finally {} + return vec; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + if (getTableStringAttributes().getTotNumberOfRecords() > 0) + setFlgTabella(1L); + super.prepareSave(ps); + } + + public long getFlgTabella() { + return this.flgTabella; + } + + public void setFlgTabella(long flgTabella) { + this.flgTabella = flgTabella; + } + + public long getFlgDeleteCascade() { + return this.flgDeleteCascade; + } + + public void setFlgDeleteCascade(long flgDeleteCascade) { + this.flgDeleteCascade = flgDeleteCascade; + } + + public void setServletPath(String newServletPath) { + this.servletPath = newServletPath; + } + + public void setFlgMaskType(long newFlgMaskType) { + this.flgMaskType = newFlgMaskType; + } + + public void setId_accessHeader(String newId_accessHeader) { + this.id_accessHeader = newId_accessHeader; + setAccessHeader(null); + } + + public String getServletPath() { + return (this.servletPath == null) ? "" : ( + this.servletPath.endsWith(DBAdapter.SEPARATOR) ? this.servletPath.trim() : (this.servletPath.trim() + this.servletPath.trim())); + } + + public long getFlgMaskType() { + return this.flgMaskType; + } + + public static final String getMaskType(long l_flgMaskType) { + switch ((int)l_flgMaskType) { + case 1: + return "Ricerca + dettaglio"; + case 0: + return "Semplice"; + } + return "??"; + } + + public String getMaskType() { + return getMaskType(getFlgMaskType()); + } + + public String getId_accessHeader() { + return (this.id_accessHeader == null) ? "" : this.id_accessHeader.trim(); + } + + public void setAccessHeader(Access newAccessHeader) { + this.accessHeader = newAccessHeader; + } + + public Access getAccessHeader() { + this.accessHeader = (Access)getSecondaryObject(this.accessHeader, Access.class, getId_accessHeader()); + return this.accessHeader; + } + + public ResParm createTableDesc() { + ResParm rp = new ResParm(); + if (!getId_access().isEmpty()) { + long rowOrdine = 0L, rowNumb = 0L, numCol = 0L; + long COL_LG_STD = 3L, COL_XS_STD = 6L, ROW_COL_STD = 4L; + try { + TableDesc td = new TableDesc(getApFull()); + Class theClass = Class.forName(getNomeClasse()); + DBAdapter obj = (DBAdapter)theClass.newInstance(); + obj.setApFull(getApFull()); + Hashtable columnDescriptor = initTableDescriptorDb.get(getApFull().getAp().getApCode(obj)); + Enumeration enu = columnDescriptor.elements(); + Vectumerator vecTd = td.findByTabella(getId_access(), 0L); + boolean aggiungoSolamente = false; + if (vecTd.getTotNumberOfRecords() > 0) + aggiungoSolamente = true; + while (enu.hasMoreElements()) { + ColumnDescriptor cd = enu.nextElement(); + short dataType = cd.getDataType(); + String columnName = cd.getColumnName(); + int columnSize = cd.getColumnSize(); + if (!columnName.equals("lastUpdId_user") && !columnName.equals("lastUpdTmst")) { + td.findByTabellaColonna(getId_access(), columnName); + if (!cd.isPk()) { + rowOrdine++; + if (numCol % ROW_COL_STD == 0L) { + rowNumb++; + rowOrdine = 1L; + } + numCol++; + } + if (td.getDBState() == 0) { + td.setId_access(getId_access()); + td.setNomeColonna(columnName); + td.setLabel(columnName.substring(0, 1).toUpperCase() + columnName.substring(0, 1).toUpperCase()); + td.setFlgTipo((long)dataType); + if (cd.isPk()) { + td.setFlgPk(1L); + td.setFlgHidden(1L); + } else if (cd.getColumnName().equals("createTmst") || cd.getColumnName().equals("encodedFields")) { + td.setFlgHidden(1L); + } else { + td.setColLg(COL_LG_STD); + td.setColXs(COL_XS_STD); + td.setColLgCR(COL_LG_STD); + td.setColXsCR(COL_XS_STD); + if (!aggiungoSolamente); + } + td.setMaxLenght((long)columnSize); + td.save(); + continue; + } + td.setMaxLenght((long)columnSize); + td.save(); + } + } + rp.setStatus(true); + rp.setMsg("Table Desc creata correttamente"); + } catch (Exception e) { + e.printStackTrace(); + rp.setException(e); + rp.setStatus(false); + } + } + return rp; + } + + public String getNomeClasse() { + return (this.nomeClasse == null) ? "" : this.nomeClasse.trim(); + } + + public void setNomeClasse(String className) { + this.nomeClasse = className; + } + + public ResParm creaPrimaryDetailJspPage() { + ResParm rp = new ResParm(); + try { + TableDesc td = new TableDesc(getApFull()); + Class theClass = Class.forName(getNomeClasse()); + DBAdapter obj = (DBAdapter)theClass.newInstance(); + obj.setApFull(getApFull()); + Hashtable columnDescriptors = initTableDescriptorDb.get(getApFull().getAp().getApCode(obj)); + String className = getNomeClasse().substring(getNomeClasse().lastIndexOf(".") + 1); + String jspPageName = className.substring(0, 1).toLowerCase() + className.substring(0, 1).toLowerCase(); + String primaryDetailJspFile = getDocBase() + getDocBase() + getServletPath(); + rp = creaJavascriptPage(); + FileFormatter myJsp = new FileFormatter(getDocBase() + "admin/config/_template/primaryDetail.jsp"); + myJsp.setQuestionMark(false); + myJsp.setString("pageTitle", getDescrizione()); + myJsp.setString("beanClass", getNomeClasse()); + myJsp.setString("className", className); + myJsp.setString("backToSearch", getServletPath() + getServletPath()); + myJsp.setString("actionPage", getServletPath().replace("/admin", "..") + getServletPath().replace("/admin", "..") + ".abl"); + myJsp.setString("javaScriptPage", getServletPath().replace("/admin", "..") + "_js/acxent-" + getServletPath().replace("/admin", "..") + ".js"); + Vectumerator vec = td.findHiddenByTable(getId_access()); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + TableDesc row = vec.nextElement(); + sb.append(getHiddenField(row, 1L)); + } + myJsp.setString("hiddenFields", sb.toString()); + vec = td.findPrimaryDetailFieldsByTable(getId_access()); + sb = new StringBuilder(); + long currentRowNumb = 0L; + boolean firstField = true; + while (vec.hasMoreElements()) { + TableDesc row = vec.nextElement(); + if (firstField) { + firstField = false; + row.setFirstField(true); + } + if (row.getRowNumb() != currentRowNumb) { + if (currentRowNumb > 0L) + sb.append(""); + sb.append("
"); + currentRowNumb = row.getRowNumb(); + } + sb.append(getDivField(row, 1L, false)); + } + sb.append("
"); + myJsp.setString("detailBody", sb.toString()); + myJsp.getMessage(); + File pdkf = new File(primaryDetailJspFile); + if (pdkf.exists()) + pdkf.delete(); + FileWr fw = new FileWr(primaryDetailJspFile); + fw.writeLine(myJsp.getMessageForJsp()); + fw.closeFile(); + rp.setStatus(true); + rp.setMsg("Primary Detail creata: " + primaryDetailJspFile); + } catch (Exception e) { + rp.setException(e); + } + return rp; + } + + public ResParm creaJavascriptPage() { + ResParm rp = new ResParm(); + try { + TableDesc td = new TableDesc(getApFull()); + String className = getNomeClasse().substring(getNomeClasse().lastIndexOf(".") + 1); + String jspPageName = className.substring(0, 1).toLowerCase() + className.substring(0, 1).toLowerCase(); + String javascriptPagePath = getDocBase() + getDocBase() + "_js"; + String javascriptPageFile = javascriptPagePath + "/acxent-" + javascriptPagePath + ".js"; + File dirJs = new File(javascriptPagePath); + if (!dirJs.exists()) + dirJs.mkdirs(); + File jsFile = new File(javascriptPageFile); + if (!jsFile.exists()) { + copyFile(getDocBase() + "admin/config/_template/acxent.js", javascriptPageFile); + rp.setStatus(true); + rp.setMsg("Js file creato: " + javascriptPageFile); + } else { + rp.setStatus(true); + rp.setMsg("Js file " + javascriptPageFile + " già presente."); + } + } catch (Exception e) { + rp.setException(e); + } + return rp; + } + + public ResParm creaCRJspPage() { + ResParm rp = new ResParm(); + try { + String CRJspFile; + TableDesc td = new TableDesc(getApFull()); + String className = getNomeClasse().substring(getNomeClasse().lastIndexOf(".") + 1); + String jspPageName = className.substring(0, 1).toLowerCase() + className.substring(0, 1).toLowerCase(); + if (getSuffissoDirPages().isEmpty()) { + CRJspFile = getDocBase() + getDocBase() + getServletPath(); + } else { + CRJspFile = getDocBase() + getDocBase() + getServletPath() + "/" + getSuffissoDirPages(); + } + rp = creaJavascriptPage(); + FileFormatter myJsp = new FileFormatter(getDocBase() + "admin/config/_template/CR.jsp"); + myJsp.setQuestionMark(false); + myJsp.setString("pageTitle", getDescrizione()); + myJsp.setString("beanClass", getNomeClasse()); + myJsp.setString("beanCRClass", getNomeClasse() + "CR"); + myJsp.setString("className", className); + myJsp.setString("backToSearch", getServletPath() + getServletPath()); + myJsp.setString("beanNameLowerCase", className.substring(0, 1).toLowerCase() + className.substring(0, 1).toLowerCase()); + myJsp.setString("actionPage", getServletPath().replace("/admin", "..") + getServletPath().replace("/admin", "..") + ".abl"); + myJsp.setString("javaScriptPage", getServletPath().replace("/admin", "..") + "_js/acxent-" + getServletPath().replace("/admin", "..") + ".js"); + Vectumerator vec = td.findHiddenByTable(getId_access()); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + TableDesc row = vec.nextElement(); + sb.append(getHiddenField(row, 0L)); + } + myJsp.setString("hiddenFields", sb.toString()); + vec = td.findCRFieldsByTable(getId_access()); + sb = new StringBuilder(); + long currentRowNumb = 0L; + long currentLgCount = 0L; + while (vec.hasMoreElements()) { + TableDesc row = vec.nextElement(); + if (row.getRowNumbCR() != currentRowNumb) { + if (currentRowNumb > 0L) + sb.append(""); + sb.append("
"); + currentRowNumb = row.getRowNumbCR(); + currentLgCount = 0L; + } + currentLgCount += row.getColLgCR(); + sb.append(getDivField(row, 0L, false)); + } + if (currentLgCount < 12L) { + sb.append("
"); + sb.append(" Cerca "); + sb.append("
"); + } else { + sb.append(" "); + } + sb.append("
"); + myJsp.setString("detailBody", sb.toString()); + vec = td.findCRListFieldsByTable(getId_access()); + StringBuilder sbThead = new StringBuilder(" "); + sb = new StringBuilder(); + while (vec.hasMoreElements()) { + String thcenter; + TableDesc row = vec.nextElement(); + if (row.getFlgFormField() == 3L) { + thcenter = " class=\"text-center\""; + } else { + thcenter = ""; + } + sbThead.append(""); + sbThead.append(row.getLabel()); + sbThead.append(""); + sb.append(""); + sb.append(getTagFieldView(row)); + sb.append(""); + } + myJsp.setString("thead", sbThead.toString()); + myJsp.setString("rowTd", sb.toString()); + myJsp.getMessage(); + File pdkf = new File(CRJspFile); + if (pdkf.exists()) + pdkf.delete(); + FileWr fw = new FileWr(CRJspFile); + fw.writeLine(myJsp.getMessageForJsp()); + fw.closeFile(); + rp.setStatus(true); + rp.setMsg("Pagina di ricerca CR creata: " + CRJspFile); + } catch (Exception e) { + rp.setException(e); + } + return rp; + } + + public Vectumerator findAccessHeader(String l_id_accessX) { + String s_Sql_Find = "select A.* from ACCESS AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.flgTabella=1"); + if (!l_id_accessX.isEmpty()) + wc.addWc("A.id_access <>'" + l_id_accessX + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return (Vectumerator)findRows(stmt); + } catch (Exception e) { + handleDebug(e, 2); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + private static final String getTagFieldView(TableDesc td) { + String theField = td.getNomeColonna(); + String rowBean = "rowBean"; + if (td.getFlgFormField() == 1L) { + String l_comboDescColumnMethod = td.getComboDescColumnMethod(); + String str1 = rowBean + "." + rowBean; + return getTagFieldViewFormatField(str1, 12); + } + if (td.getFlgFormField() == 2L) { + String temp = theField.substring(3); + String str1 = rowBean + ".get" + rowBean + temp.substring(0, 1).toUpperCase() + "()"; + return getTagFieldViewFormatField(str1, 12); + } + if (td.getFlgFormField() == 3L) { + StringBuilder tagFieldView = new StringBuilder(""); + return tagFieldView.toString(); + } + if (td.getFlgFormField() == 6L) { + String l_comboDescColumnMethod = td.getComboDescColumnMethod(); + String str1 = rowBean + "." + rowBean; + return getTagFieldViewFormatField(str1, 12); + } + String getMethod = rowBean + ".get" + rowBean + theField.substring(0, 1).toUpperCase() + "()"; + return getTagFieldViewFormatField(getMethod, (int)td.getFlgTipo()); + } + + private static final String getFieldValue(TableDesc td, long flgPageType) { + String value, bean, simpleDatailFilterPrefix; + String theField = td.getNomeColonna(); + if (flgPageType == 1L || flgPageType == 2L) { + bean = "bean"; + } else { + bean = "CR"; + } + if (flgPageType == 3L) { + simpleDatailFilterPrefix = "S"; + } else { + simpleDatailFilterPrefix = ""; + } + switch ((int)td.getFlgTipo()) { + case -16: + case -1: + case 1: + case 4: + case 12: + value = "<%=" + bean + ".get" + theField.substring(0, 1).toUpperCase() + theField.substring(1) + simpleDatailFilterPrefix + "()%>"; + break; + case 91: + value = "<%=df.format(" + bean + ".get" + theField.substring(0, 1).toUpperCase() + theField.substring(1) + simpleDatailFilterPrefix + "())%>"; + break; + case 3: + case 6: + case 8: + value = "<%=nf.format(" + bean + ".get" + theField.substring(0, 1).toUpperCase() + theField.substring(1) + simpleDatailFilterPrefix + "())%>"; + break; + default: + value = "??undefined type??"; + break; + } + return value; + } + + private static final String getHiddenField(TableDesc td, long flgPageType) { + String theField = td.getNomeColonna(); + String value = getFieldValue(td, flgPageType); + return ""; + } + + private static final String getDivField(TableDesc td, long flgPageType, boolean isLast) { + long l_colLg, l_colXs; + String bean, onChangeCR, submitLast, defaultFocus, mandatory, theFkBean; + String valueListPrefix = ""; + if (flgPageType == 1L || flgPageType == 2L) { + l_colLg = td.getColLg(); + l_colXs = td.getColXs(); + bean = "bean"; + onChangeCR = ""; + } else { + l_colLg = td.getColLgCR(); + l_colXs = td.getColXsCR(); + bean = "CR"; + onChangeCR = " onChange=\"searching()\""; + valueListPrefix = "-1,"; + } + if (td.isFirstField()) { + defaultFocus = " defaultFocus=\"focus\""; + } else { + defaultFocus = ""; + } + if (isLast) { + submitLast = " submit "; + } else { + submitLast = ""; + } + if (td.getFlgMandatory() == 1L) { + mandatory = " mandatory=\"R\" mandatory-desc=\"" + td.getLabel() + "\""; + } else { + mandatory = " mandatory=\"\" mandatory-desc=\"" + td.getLabel() + "\""; + } + String theField = td.getNomeColonna(); + String theFieldBoundColumn = td.getNomeColonna(); + if (flgPageType == 3L) { + theField = td.getNomeColonna() + "S"; + valueListPrefix = "-1,"; + } + String theFieldCapital = theField.substring(0, 1).toUpperCase() + theField.substring(0, 1).toUpperCase(); + if (td.getNomeColonna().indexOf("id_") == 0) { + theFkBean = td.getNomeColonna().substring(3, 4).toUpperCase() + td.getNomeColonna().substring(3, 4).toUpperCase(); + } else { + theFkBean = ""; + } + StringBuilder sb = new StringBuilder("

"); + String value = getFieldValue(td, flgPageType); + String theClass = getFieldDivClass(td, flgPageType, td.getFlgMandatory()); + String readonly = (flgPageType == 1L || flgPageType == 2L) ? ( + (td.getFlgReadOnly() == 1L) ? " readonly disabled=\"disabled\"" : "") : + ""; + if (td.getFlgFormField() == 0L) { + if (readonly.isEmpty()) { + if (td.getFlgTipo() == 91L) { + sb.append("
"); + } else { + sb.append(""); + } + } else { + String l_comboDescColumnMethod = td.getComboDescColumnMethod(); + if (!l_comboDescColumnMethod.isEmpty()) { + String navigazione = bean + bean; + sb.append("<%=" + navigazione + "%>"); + } else { + sb.append(""); + } + } + } else if (td.getFlgFormField() == 5L) { + if (flgPageType == 0L) { + sb.append(""); + } else { + sb.append(""); + } + } else if (td.getFlgFormField() == 1L) { + Access fkAccess = td.getFkAccess(); + String l_comboDescColumn = fkAccess.getComboDescColumn(); + sb.append(""); + sb.append("  "); + } else if (td.getFlgFormField() == 2L) { + String comboFlgBean = "", comboDefault = " "; + if (flgPageType == 3L) { + comboFlgBean = " bean=\"CR\""; + comboDefault = " "; + } + sb.append(""); + } else if (td.getFlgFormField() == 3L) { + sb.append(">"); + sb.append(""); + } else if (td.getFlgFormField() == 4L) { + sb.append(""); + } else if (td.getFlgFormField() == 6L) { + sb.append("\n
"); + sb.append("<%=" + bean + "." + td.getComboDescColumnMethod() + "%>"); + sb.append("\"" + mandatory + "/>
"); + } + sb.append("
"); + return sb.toString(); + } + + private static final String getTagFieldViewFormatField(String getMethod, int l_flgTipo) { + String result; + switch (l_flgTipo) { + case -16: + case -1: + case 1: + case 4: + case 12: + result = "<%=" + getMethod + "%>"; + break; + case 91: + case 92: + result = "<%=df.format(" + getMethod + ")%>"; + break; + case 3: + case 6: + case 8: + result = "<%=nf.format(" + getMethod + ")%>"; + break; + default: + result = "<%=" + getMethod + "%>"; + break; + } + return result; + } + + private static final String getFieldDivClass(TableDesc td, long flgPageType, long flgMandatory) { + StringBuilder sb; + String MANDATORYCLASS = "mandatory "; + if ((flgPageType == 1L || flgPageType == 2L) && flgMandatory == 1L) { + sb = new StringBuilder("mandatory "); + } else { + sb = new StringBuilder(); + } + if (td.getFlgFormField() == 0L) { + sb.append("form-control input-sm"); + switch ((int)td.getFlgTipo()) { + case 91: + sb.append(" datemask datepicker"); + break; + case 92: + sb.append(" timemask"); + break; + case 3: + case 4: + case 6: + case 8: + sb.append(" numberinput"); + break; + } + } else if (td.getFlgFormField() == 3L) { + sb.append("minimal"); + } else if (td.getFlgFormField() == 1L || td.getFlgFormField() == 2L) { + sb.append("form-control input-sm select2"); + } else if (td.getFlgFormField() == 5L) { + sb.append("form-control input-sm"); + } + return sb.toString(); + } + + public ResParm creaSimpleDetailJspPage() { + ResParm rp = new ResParm(); + boolean debug = false; + try { + TableDesc td = new TableDesc(getApFull()); + Class theClass = Class.forName(getNomeClasse()); + DBAdapter obj = (DBAdapter)theClass.newInstance(); + obj.setApFull(getApFull()); + Hashtable columnDescriptors = initTableDescriptorDb.get(getApFull().getAp().getApCode(obj)); + String className = getNomeClasse().substring(getNomeClasse().lastIndexOf(".") + 1); + String jspPageName = className.substring(0, 1).toLowerCase() + className.substring(0, 1).toLowerCase(); + String primaryDetailJspFile = getDocBase() + getDocBase() + getServletPath(); + String beanNameLowercase = className.substring(0, 1).toLowerCase() + className.substring(0, 1).toLowerCase(); + rp = creaJavascriptPage(); + FileFormatter myJsp = new FileFormatter(getDocBase() + "admin/config/_template/simple.jsp"); + myJsp.setQuestionMark(false); + myJsp.setString("pageTitle", getDescrizione()); + myJsp.setString("beanClass", getNomeClasse()); + myJsp.setString("beanCRClass", getNomeClasse() + "CR"); + myJsp.setString("className", className); + myJsp.setString("beanNameLowerCase", beanNameLowercase); + myJsp.setString("actionPage", getServletPath().replace("/admin", "..") + getServletPath().replace("/admin", "..") + ".abl"); + myJsp.setString("javaScriptPage", getServletPath().replace("/admin", "..") + "_js/acxent-" + getServletPath().replace("/admin", "..") + ".js"); + Vectumerator vec = td.findHiddenByTable(getId_access()); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + TableDesc row = vec.nextElement(); + sb.append(getHiddenField(row, 2L)); + } + myJsp.setString("hiddenFields", sb.toString()); + vec = td.findPrimaryDetailFieldsByTable(getId_access()); + sb = new StringBuilder(); + long currentRowNumb = 0L; + boolean firstField = true; + while (vec.hasMoreElements()) { + TableDesc row = vec.nextElement(); + if (debug) + System.out.println("Access.creaSimpleDetailJspPage dettaglio: " + row.getNomeColonna()); + if (firstField) { + firstField = false; + row.setFirstField(true); + } + if (row.getRowNumb() != currentRowNumb) { + if (currentRowNumb > 0L) + sb.append(""); + sb.append("
"); + currentRowNumb = row.getRowNumb(); + } + if (vec.hasMoreElements()) { + sb.append(getDivField(row, 2L, false)); + continue; + } + sb.append(getDivField(row, 2L, true)); + } + sb.append("
"); + myJsp.setString("detailBody", sb.toString()); + vec = td.findCRListFieldsByTable(getId_access()); + StringBuilder sbThead = new StringBuilder(" "); + sb = new StringBuilder(); + StringBuilder trSuccess = new StringBuilder("<%=rowBean.getId_"); + trSuccess.append(beanNameLowercase); + ColumnDescriptor pk = columnDescriptors.get("id_" + beanNameLowercase); + if (pk.getDataType() == 4) { + trSuccess.append("()==bean.getId_"); + trSuccess.append(beanNameLowercase); + trSuccess.append("()?\"class='success'\":\"\"%>"); + } else { + trSuccess.append("().equals(bean.getId_"); + trSuccess.append(beanNameLowercase); + trSuccess.append("())?\"class='success'\":\"\"%>"); + } + myJsp.setString("trSuccess", trSuccess.toString()); + while (vec.hasMoreElements()) { + String thcenter; + TableDesc row = vec.nextElement(); + if (debug) + System.out.println("Access.creaSimpleDetailJspPage lista: " + row.getNomeColonna()); + if (row.getFlgFormField() == 3L) { + thcenter = " class=\"text-center\""; + } else { + thcenter = ""; + } + sbThead.append(""); + sbThead.append(row.getLabel()); + sbThead.append(""); + sb.append(""); + sb.append(getTagFieldView(row)); + sb.append(""); + } + myJsp.setString("thead", sbThead.toString()); + myJsp.setString("rowTd", sb.toString()); + vec = td.findCRFieldsByTable(getId_access()); + if (vec.hasMoreElements()) { + sb = new StringBuilder(); + currentRowNumb = 0L; + long currentLgCount = 0L; + while (vec.hasMoreElements()) { + TableDesc row = vec.nextElement(); + if (row.getRowNumbCR() != currentRowNumb) { + if (currentRowNumb > 0L) + sb.append(""); + sb.append("
"); + currentRowNumb = row.getRowNumbCR(); + currentLgCount = 0L; + } + currentLgCount += row.getColLgCR(); + sb.append(getDivField(row, 3L, false)); + } + if (currentLgCount < 12L) { + sb.append("
"); + sb.append(" Cerca "); + sb.append("
"); + } else { + sb.append(" "); + } + sb.append("
"); + myJsp.setString("filterBody", sb.toString()); + } else { + myJsp.setString("", " hidden"); + } + myJsp.getMessage(); + File pdkf = new File(primaryDetailJspFile); + if (pdkf.exists()) + pdkf.delete(); + FileWr fw = new FileWr(primaryDetailJspFile); + fw.writeLine(myJsp.getMessageForJsp()); + fw.closeFile(); + rp.setStatus(true); + rp.setMsg("Simple Detail creata: " + primaryDetailJspFile); + } catch (Exception e) { + rp.setException(e); + e.printStackTrace(); + rp.setException(e); + } + return rp; + } + + public String getComboDescColumn() { + return (this.comboDescColumn == null) ? "" : this.comboDescColumn.trim(); + } + + public void setComboDescColumn(String newComboDescColumn) { + this.comboDescColumn = newComboDescColumn; + } + + public String getAjaxSearchServlet() { + return (this.ajaxSearchServlet == null) ? "" : this.ajaxSearchServlet.trim(); + } + + public void setAjaxSearchServlet(String ajaxSearchServlet) { + this.ajaxSearchServlet = ajaxSearchServlet; + } + + public String getAjstReturnFields() { + return (this.ajstReturnFields == null) ? "" : this.ajstReturnFields.trim(); + } + + public void setAjstReturnFields(String ajstReturnFields) { + this.ajstReturnFields = ajstReturnFields; + } + + public long getFlgCombo() { + return this.flgCombo; + } + + public void setFlgCombo(long flgCombo) { + this.flgCombo = flgCombo; + } + + public String getHelp() { + return (this.help == null) ? "" : this.help.trim(); + } + + public void setHelp(String help) { + this.help = help; + } + + public String getComboDescColumn(String l_id_fk) { + if (l_id_fk.indexOf("id_") != 0) + return ""; + String tabellaNavigazione = getTableNameByIdField(l_id_fk); + findByPrimaryKey(tabellaNavigazione); + if (getDBState() == 1) + return getComboDescColumn().isEmpty() ? "descrizione" : getComboDescColumn(); + return "descrizione"; + } + + public static String getTableNameByIdField(String foreignKey) { + if (foreignKey == null || !foreignKey.startsWith("id_")) + return ""; + String tableName = foreignKey.substring(3); + tableName = tableName.replaceAll("([a-z])([A-Z])", "$1_$2"); + return tableName.toUpperCase(); + } + + public String getCombo() { + return getCombo(getFlgCombo()); + } + + public static final String getCombo(long l_flgCombo) { + switch ((int)l_flgCombo) { + case 0: + return "No"; + case 1: + return "ComboBox"; + case 2: + return "Ajax"; + } + return "??"; + } + + public String getBeanAutoCRJspPage() { + if (!getId_access().isEmpty()) + return getId_access() + "_AUTO_" + getId_access() + "_CR.jsp"; + return ""; + } + + public String getBeanAutoPrimaryJspPage() { + if (!getId_access().isEmpty()) + return getId_access() + "_AUTO_" + getId_access() + "_PD.jsp"; + return ""; + } + + public long getFlgAutoPD() { + return this.flgAutoPD; + } + + public void setFlgAutoPD(long flgAutoPD) { + this.flgAutoPD = flgAutoPD; + } + + public long getFlgAutoAJST() { + return this.flgAutoAJST; + } + + public void setFlgAutoAJST(long flgAutoAJST) { + this.flgAutoAJST = flgAutoAJST; + } + + public long getFlgAutoCR() { + return this.flgAutoCR; + } + + public void setFlgAutoCR(long flgAutoCR) { + this.flgAutoCR = flgAutoCR; + } + + public ResParm exportAccessTableDescToXml() { + ResParm rp = new ResParm(true); + String targetDir = getDocBase() + "admin/config/_exportAccess/"; + File targetDirFile = new File(targetDir); + if (!targetDirFile.exists()) + targetDirFile.mkdirs(); + Calendar cal = Calendar.getInstance(); + String currentTimestamp = String.valueOf(cal.getTimeInMillis()); + String filename = targetDir + targetDir + "_access.xml"; + rp = xmlExport(filename, "SELECT * FROM ACCESS WHERE flgTabella=1", false, false); + if (rp.getStatus()) { + TableDesc td = new TableDesc(getApFull()); + rp = td.xmlExport(filename, true, true); + } + if (rp.getStatus()) + rp.setMsg("Creati il file di export: " + filename); + return rp; + } + + public ResParm importAccessTableDescFromXml(String fileXml) { + ResParm rp = new ResParm(true); + rp = xmlImport(fileXml); + if (rp.getStatus()) { + HashSet importedPks = (HashSet)rp.getReturnObj(); + TableDesc td = new TableDesc(getApFull()); + for (String pk : importedPks) + td.delete("delete from TABLE_DESC where id_access='" + pk + "'"); + rp = td.xmlImport(fileXml); + } + if (rp.getStatus()) + rp.setMsg("Import xml avvenuto correttamente: "); + return rp; + } + + private static HashMap getHtTablesSingleton() { + if (htTablesSingleton == null) + htTablesSingleton = new HashMap<>(); + return htTablesSingleton; + } + + public static final Access getAccess(DBAdapter theBean, ApplParmFull ap) { + String theKey; + if (theBean.getClass().getName().lastIndexOf('.') >= 0) { + theKey = theBean.getClass().getName().substring(theBean.getClass().getName().lastIndexOf('.') + 1).toUpperCase(); + } else { + theKey = theBean.getClass().getName().toUpperCase(); + } + if (!getHtTablesSingleton().containsKey(theKey)) { + Access bean = new Access(ap); + bean.findByPrimaryKey(theKey); + getHtTablesSingleton().put(theKey, bean); + } + return getHtTablesSingleton().get(theKey); + } + + public ResParm delete() { + ResParm rp = super.delete(); + if (rp.getStatus()) + htTablesSingleton = null; + return rp; + } + + public boolean isDeleteLogic() { + return false; + } + + public ResParm save() { + ResParm rp = super.save(); + if (rp.getStatus()) + htTablesSingleton = null; + return rp; + } + + public String getSuffissoPD() { + return (this.suffissoPD == null) ? "" : this.suffissoPD.trim(); + } + + public void setSuffissoPD(String suffissoPD) { + this.suffissoPD = suffissoPD; + } + + public String getSuffissoCR() { + return (this.suffissoCR == null) ? "" : this.suffissoCR.trim(); + } + + public void setSuffissoCR(String suffissoCR) { + this.suffissoCR = suffissoCR; + } + + public long getFlgEncodeAlgoritmo() { + return this.flgEncodeAlgoritmo; + } + + public void setFlgEncodeAlgoritmo(long algoritmo) { + this.flgEncodeAlgoritmo = algoritmo; + } + + public long getFlgEncodeModalita() { + return this.flgEncodeModalita; + } + + public void setFlgEncodeModalita(long flgModalita) { + this.flgEncodeModalita = flgModalita; + } + + public EncodedField getTableColumnEncodedField(String columnName) { + if (getDBState() == 1 && columnName != null) { + String COMMA = ",", STAR = "*"; + String temp = "," + getAttrEncoded() + ","; + if (temp.indexOf("," + columnName + ",") >= 0) + return new EncodedField(true, getFlgEncodeAlgoritmo(), getFlgEncodeModalita()); + return new EncodedField(); + } + return new EncodedField(); + } + + public String getAttrEncoded() { + return (this.attrEncoded == null) ? "" : this.attrEncoded.trim(); + } + + public void setAttrEncoded(String encodedFields) { + this.attrEncoded = encodedFields; + } + + public static final String getEncodeModalita(long l_flgEncodeModalita) { + return EncodedField.getModalita(l_flgEncodeModalita); + } + + public String getEncodeModalita() { + return EncodedField.getModalita(getFlgEncodeModalita()); + } + + public static final String getEncodeAlgoritmo(long l_flgEncodeAlgoritmo) { + return EcDc.getEncodeAlgoritmo(l_flgEncodeAlgoritmo); + } + + public String getEncodeAlgoritmo() { + return EcDc.getEncodeAlgoritmo(getFlgEncodeAlgoritmo()); + } + + public String getSuffissoE() { + return (this.suffissoE == null) ? "" : this.suffissoE.trim(); + } + + public void setSuffissoE(String suffissoE) { + this.suffissoE = suffissoE; + } + + public long getFlgLogicDelete() { + return this.flgLogicDelete; + } + + public void setFlgLogicDelete(long flgLogicDelete) { + this.flgLogicDelete = flgLogicDelete; + } + + public long getFlgRicercaSearchTxt() { + return this.flgRicercaSearchTxt; + } + + public void setFlgRicercaSearchTxt(long flgRicercaSearchTxt) { + this.flgRicercaSearchTxt = flgRicercaSearchTxt; + } + + public String getSuffissoDirPages() { + return (this.suffissoDirPages == null) ? "" : this.suffissoDirPages.trim(); + } + + public void setSuffissoDirPages(String suffissoDirPages) { + this.suffissoDirPages = suffissoDirPages; + } + + public String getAttrCompressi() { + return (this.attrCompressi == null) ? "" : this.attrCompressi.replaceAll(" ", ""); + } + + public void setAttrCompressi(String attrCompressi) { + this.attrCompressi = attrCompressi; + } + + public String getAttrAsIs() { + return (this.attrAsIs == null) ? "" : this.attrAsIs.trim(); + } + + public void setAttrAsIs(String attrAsIs) { + this.attrAsIs = attrAsIs; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessCR.java new file mode 100644 index 00000000..da84f2e6 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessCR.java @@ -0,0 +1,32 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AccessCR extends CRAdapter { + private String id_access; + + private long flgTabella = -1L; + + public AccessCR() {} + + public AccessCR(ApplParmFull newAp) { + super(newAp); + } + + public String getId_access() { + return this.id_access; + } + + public void setId_access(String id_access) { + this.id_access = id_access; + } + + public long getFlgTabella() { + return this.flgTabella; + } + + public void setFlgTabella(long flgTabella) { + this.flgTabella = flgTabella; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessDitta.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessDitta.java new file mode 100644 index 00000000..41c03dac --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessDitta.java @@ -0,0 +1,137 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class AccessDitta extends DBAdapter implements Serializable { + private static final long serialVersionUID = -1022126863968745800L; + + private long id_accessDitta; + + private String id_access; + + private String attr1Maiuscoli; + + private String attrMaiuscoli; + + private String attrMinuscoli; + + private String descrizione; + + private long flgSafeUpdate; + + private Access access; + + public AccessDitta(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AccessDitta() {} + + public void setId_accessDitta(long newId_accessDitta) { + this.id_accessDitta = newId_accessDitta; + } + + public void setId_access(String newId_access) { + this.id_access = newId_access; + setAccess(null); + } + + public void setAttr1Maiuscoli(String newAttr1Maiuscoli) { + this.attr1Maiuscoli = newAttr1Maiuscoli; + } + + public void setAttrMaiuscoli(String newAttrMaiuscoli) { + this.attrMaiuscoli = newAttrMaiuscoli; + } + + public void setAttrMinuscoli(String newAttrMinuscoli) { + this.attrMinuscoli = newAttrMinuscoli; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setFlgSafeUpdate(long newFlgSafeUpdate) { + this.flgSafeUpdate = newFlgSafeUpdate; + } + + public long getId_accessDitta() { + return this.id_accessDitta; + } + + public String getId_access() { + return (this.id_access == null) ? "" : this.id_access.trim(); + } + + public String getAttr1Maiuscoli() { + return (this.attr1Maiuscoli == null) ? "" : this.attr1Maiuscoli.trim(); + } + + public String getAttrMaiuscoli() { + return (this.attrMaiuscoli == null) ? "" : this.attrMaiuscoli.trim(); + } + + public String getAttrMinuscoli() { + return (this.attrMinuscoli == null) ? "" : this.attrMinuscoli.trim(); + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getFlgSafeUpdate() { + return this.flgSafeUpdate; + } + + public void setAccess(Access newAccess) { + this.access = newAccess; + } + + public Access getAccess() { + this.access = (Access)getSecondaryObject(this.access, Access.class, + + getId_access()); + return this.access; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(AccessDittaCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ACCESS_DITTA AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessDittaCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessDittaCR.java new file mode 100644 index 00000000..81892a49 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessDittaCR.java @@ -0,0 +1,96 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AccessDittaCR extends CRAdapter { + private long id_accessDitta; + + private String id_access; + + private String attr1Maiuscoli; + + private String attrMaiuscoli; + + private String attrMinuscoli; + + private String descrizione; + + private long flgSafeUpdate; + + private Access access; + + public AccessDittaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AccessDittaCR() {} + + public void setId_accessDitta(long newId_accessDitta) { + this.id_accessDitta = newId_accessDitta; + } + + public void setId_access(String newId_access) { + this.id_access = newId_access; + setAccess(null); + } + + public void setAttr1Maiuscoli(String newAttr1Maiuscoli) { + this.attr1Maiuscoli = newAttr1Maiuscoli; + } + + public void setAttrMaiuscoli(String newAttrMaiuscoli) { + this.attrMaiuscoli = newAttrMaiuscoli; + } + + public void setAttrMinuscoli(String newAttrMinuscoli) { + this.attrMinuscoli = newAttrMinuscoli; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setFlgSafeUpdate(long newFlgSafeUpdate) { + this.flgSafeUpdate = newFlgSafeUpdate; + } + + public long getId_accessDitta() { + return this.id_accessDitta; + } + + public String getId_access() { + return (this.id_access == null) ? "" : this.id_access.trim(); + } + + public String getAttr1Maiuscoli() { + return (this.attr1Maiuscoli == null) ? "" : this.attr1Maiuscoli.trim(); + } + + public String getAttrMaiuscoli() { + return (this.attrMaiuscoli == null) ? "" : this.attrMaiuscoli.trim(); + } + + public String getAttrMinuscoli() { + return (this.attrMinuscoli == null) ? "" : this.attrMinuscoli.trim(); + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getFlgSafeUpdate() { + return this.flgSafeUpdate; + } + + public void setAccess(Access newAccess) { + this.access = newAccess; + } + + public Access getAccess() { + this.access = (Access)getSecondaryObject(this.access, Access.class, + + getId_access()); + return this.access; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessGroup.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessGroup.java new file mode 100644 index 00000000..d12d4fc1 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessGroup.java @@ -0,0 +1,190 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class AccessGroup extends DBAdapter implements Serializable { + private long id_accessGroup; + + private String descrizione; + + private String nota; + + public AccessGroup(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AccessGroup() {} + + public void setId_accessGroup(long newId_accessGroup) { + this.id_accessGroup = newId_accessGroup; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_accessGroup() { + return this.id_accessGroup; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public String getUsers() { + if (getId_accessGroup() != 0L) { + Vectumerator vec = getUserAccessGroup(0, 0); + StringBuffer temp = new StringBuffer(); + while (vec.hasMoreElements()) { + UserAccessGroup row = vec.nextElement(); + temp.append(row.getUsers().getCognomeNome()); + if (vec.hasMoreElements()) + temp.append(", "); + } + return temp.toString(); + } + return ""; + } + + public String getAccesses() { + if (getId_accessGroup() != 0L) { + Vectumerator vec = findAccessGroupAccess(0, 0); + StringBuffer temp = new StringBuffer(); + while (vec.hasMoreElements()) { + AccessGroupAccess row = vec.nextElement(); + temp.append(row.getAccess().getId_access()); + temp.append(" (" + row.getRW() + ")"); + if (vec.hasMoreElements()) + temp.append(", "); + } + return temp.toString(); + } + return ""; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(AccessGroupCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ACCESS_GROUP AS A"; + String s_Sql_Order = " order by A.descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm addUser(UserAccessGroup row) { + UserAccessGroup bean = new UserAccessGroup(getApFull()); + if (row.getId_userAccessGroup() != 0L) { + bean.findByPrimaryKey(row.getId_userAccessGroup()); + } else { + bean.findByAccessGroupUser(row.getId_accessGroup(), row.getId_users()); + } + if (bean != null) { + row.setDBState(bean.getDBState()); + row.setId_userAccessGroup(bean.getId_userAccessGroup()); + } else { + row.setDBState(0); + } + return row.save(); + } + + public ResParm delAccess(AccessGroupAccess row) { + AccessGroupAccess bean = new AccessGroupAccess(getApFull()); + bean.findByPrimaryKey(row.getId_accessGroupAccess()); + return bean.delete(); + } + + public ResParm addAccess(AccessGroupAccess row) { + AccessGroupAccess bean = new AccessGroupAccess(getApFull()); + if (row.getId_accessGroupAccess() != 0L) { + bean.findByPrimaryKey(row.getId_accessGroupAccess()); + } else { + bean.findByAccessGroupAccess(row.getId_accessGroup(), row.getId_access()); + } + if (bean != null) { + row.setDBState(bean.getDBState()); + row.setId_accessGroupAccess(bean.getId_accessGroupAccess()); + } else { + row.setDBState(0); + } + return row.save(); + } + + public ResParm delUser(UserAccessGroup row) { + UserAccessGroup bean = new UserAccessGroup(getApFull()); + bean.findByPrimaryKey(row.getId_userAccessGroup()); + return bean.delete(); + } + + public Vectumerator findAccessGroupAccess(int pageNumber, int pageRows) { + return new AccessGroupAccess(getApFull()).findByAccessGroup(getId_accessGroup(), pageNumber, pageRows); + } + + public Vectumerator getUserAccessGroup(int pageNumber, int pageRows) { + return new UserAccessGroup(getApFull()).findByAccessGroup(getId_accessGroup(), pageNumber, pageRows); + } + + public long getFlgRW(String l_id_access) { + if (getId_accessGroup() == 0L) + return 0L; + AccessGroupAccess aga = new AccessGroupAccess(getApFull()); + aga.findByAccessGroupAccess(getId_accessGroup(), l_id_access); + return aga.getFlgRW(); + } + + public ResParm duplica() { + if (getId_accessGroup() == 0L) + return new ResParm(false, "Errore! bean non valido!"); + Vectumerator vecAGA = findAccessGroupAccess(0, 0); + setId_accessGroup(0L); + setDBState(0); + setDescrizione(getDescrizione() + " copia"); + ResParm rp = save(); + if (rp.getStatus()) + while (vecAGA.hasMoreElements()) { + AccessGroupAccess rowAGA = vecAGA.nextElement(); + rowAGA.setId_accessGroupAccess(0L); + rowAGA.setDBState(0); + rowAGA.setId_accessGroup(getId_accessGroup()); + rowAGA.save(); + } + return new ResParm(false, "Errore! bean non valido!"); + } + + public String getNota() { + return (this.nota == null) ? "" : this.nota.trim(); + } + + public void setNota(String nota) { + this.nota = nota; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessGroupAccess.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessGroupAccess.java new file mode 100644 index 00000000..62ce6598 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessGroupAccess.java @@ -0,0 +1,150 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class AccessGroupAccess extends DBAdapter implements Serializable { + private static final long serialVersionUID = -218207150565122890L; + + private long id_accessGroupAccess; + + private long flgRW; + + private String id_access; + + private long id_accessGroup; + + private Access access; + + private AccessGroup accessGroup; + + public AccessGroupAccess(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AccessGroupAccess() {} + + public void setId_accessGroupAccess(long newId_accessGroupAccess) { + this.id_accessGroupAccess = newId_accessGroupAccess; + } + + public void setFlgRW(long newFlgRW) { + this.flgRW = newFlgRW; + } + + public void setId_access(String newId_access) { + this.id_access = newId_access; + setAccess(null); + } + + public void setId_accessGroup(long newId_accessGroup) { + this.id_accessGroup = newId_accessGroup; + setAccessGroup(null); + } + + public long getId_accessGroupAccess() { + return this.id_accessGroupAccess; + } + + public long getFlgRW() { + return this.flgRW; + } + + public String getId_access() { + return (this.id_access == null) ? "" : this.id_access; + } + + public long getId_accessGroup() { + return this.id_accessGroup; + } + + public void setAccess(Access newAccess) { + this.access = newAccess; + } + + public Access getAccess() { + this.access = (Access)getSecondaryObject(this.access, Access.class, getId_access()); + return this.access; + } + + public void setAccessGroup(AccessGroup newAccessGroup) { + this.accessGroup = newAccessGroup; + } + + public AccessGroup getAccessGroup() { + this.accessGroup = (AccessGroup)getSecondaryObject((DBAdapter)this.accessGroup, AccessGroup.class, getId_accessGroup()); + return this.accessGroup; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(AccessGroupAccessCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ACCESS_GROUP_ACCESS AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getRW() { + return DBAdapter.getRW(getFlgRW()); + } + + public Vectumerator findByAccessGroup(long l_id_accessGroup, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ACCESS_GROUP_ACCESS AS A, ACCESS AS B"; + String s_Sql_Order = " order by B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_access=B.id_access"); + wc.addWc("A.id_accessGroup =" + l_id_accessGroup); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return (Vectumerator)findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + public void findByAccessGroupAccess(long l_id_accessGroup, String l_id_access) { + String s_Sql_Find = "select A.* from ACCESS_GROUP_ACCESS AS A, ACCESS AS B"; + String s_Sql_Order = " order by B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_access=B.id_access"); + wc.addWc("A.id_accessGroup =" + l_id_accessGroup); + wc.addWc("A.id_access ='" + l_id_access + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessGroupAccessCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessGroupAccessCR.java new file mode 100644 index 00000000..fa2e1549 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessGroupAccessCR.java @@ -0,0 +1,81 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; + +public class AccessGroupAccessCR extends CRAdapter { + private long id_accessGroupAccess; + + private long flgRW; + + private String id_access; + + private long id_accessGroup; + + private Access access; + + private AccessGroup accessGroup; + + public AccessGroupAccessCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AccessGroupAccessCR() {} + + public void setId_accessGroupAccess(long newId_accessGroupAccess) { + this.id_accessGroupAccess = newId_accessGroupAccess; + } + + public void setFlgRW(long newFlgRW) { + this.flgRW = newFlgRW; + } + + public void setId_access(String newId_access) { + this.id_access = newId_access; + setAccess(null); + } + + public void setId_accessGroup(long newId_accessGroup) { + this.id_accessGroup = newId_accessGroup; + setAccessGroup(null); + } + + public long getId_accessGroupAccess() { + return this.id_accessGroupAccess; + } + + public long getFlgRW() { + return this.flgRW; + } + + public String getId_access() { + return (this.id_access == null) ? "" : this.id_access; + } + + public long getId_accessGroup() { + return this.id_accessGroup; + } + + public void setAccess(Access newAccess) { + this.access = newAccess; + } + + public Access getAccess() { + this.access = (Access)getSecondaryObject(this.access, Access.class, + + getId_access()); + return this.access; + } + + public void setAccessGroup(AccessGroup newAccessGroup) { + this.accessGroup = newAccessGroup; + } + + public AccessGroup getAccessGroup() { + this.accessGroup = (AccessGroup)getSecondaryObject((DBAdapter)this.accessGroup, AccessGroup.class, + + getId_accessGroup()); + return this.accessGroup; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessGroupCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessGroupCR.java new file mode 100644 index 00000000..487af78c --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/AccessGroupCR.java @@ -0,0 +1,32 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class AccessGroupCR extends CRAdapter { + private long id_accessGroup; + + private String descrizione; + + public AccessGroupCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public AccessGroupCR() {} + + public void setId_accessGroup(long newId_accessGroup) { + this.id_accessGroup = newId_accessGroup; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_accessGroup() { + return this.id_accessGroup; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Blacklist.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Blacklist.java new file mode 100644 index 00000000..4bccc397 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Blacklist.java @@ -0,0 +1,383 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; + +public class Blacklist extends DBAdapter implements Serializable { + private static final long serialVersionUID = 5750918920606244553L; + + private long id_blacklist; + + private long flgAttivo; + + private String descrizione; + + private String notaBlacklist; + + private String eMail; + + private String ipAddress; + + private long fatalCount; + + private Timestamp tmstStartCount; + + private Timestamp tmstStartBlacklist; + + private long ipMax; + + private long ipMin; + + private ArrayList ipv4; + + public Blacklist(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Blacklist() {} + + public void setId_blacklist(long newId_blackList) { + this.id_blacklist = newId_blackList; + } + + public void setFlgAttivo(long newFlgAttivo) { + this.flgAttivo = newFlgAttivo; + } + + public void setIpAddress(String newIpAddress) { + this.ipAddress = newIpAddress; + } + + public void setEMail(String newEMail) { + this.eMail = newEMail; + } + + public long getId_blacklist() { + return this.id_blacklist; + } + + public String getAttivo() { + return (this.flgAttivo == 0L) ? "N" : "S"; + } + + public long getFlgAttivo() { + return this.flgAttivo; + } + + public String getIpAddress() { + return (this.ipAddress == null) ? "" : this.ipAddress.trim(); + } + + public String getEMail() { + return (this.eMail == null) ? "" : this.eMail.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(BlacklistCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from BLACKLIST AS A"; + String s_Sql_Order = " order by A.tmstStartBlacklist desc"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%' or A.ipAddress like '%" + token + "%' or A.eMail like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getFlgAttivo() == 0L) { + wc.addWc("(A.flgAttivo is null or A.flgAttivo=0)"); + } else if (CR.getFlgAttivo() == 1L) { + wc.addWc("A.flgAttivo =1"); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + public void findByIp(String l_ip, boolean soloAttivo) { + String s_Sql_Find = "select A.* from BLACKLIST AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.ipAddress like '" + l_ip + "%'"); + if (soloAttivo) + wc.addWc("A.flgAttivo=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByEmail(String l_eMail) { + String s_Sql_Find = "select A.* from BLACKLIST AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (l_eMail.indexOf("@") > 0) { + String temp = l_eMail.substring(l_eMail.indexOf("@")); + wc.addWc("(A.eMail like '" + temp + "%' or A.eMail like '%" + l_eMail + "%')"); + } else { + wc.addWc("A.eMail like '%" + l_eMail + "%'"); + } + wc.addWc("A.flgAttivo=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getDescrizioneCompleta() { + StringBuffer temp = new StringBuffer(getDescrizione()); + temp.append(" "); + if (!getIpAddress().isEmpty()) { + temp.append("Ip addr.: "); + temp.append(getIpAddress()); + } + if (!getEMail().isEmpty()) { + temp.append(" Email addr.: "); + temp.append(getEMail()); + } + return temp.toString().trim(); + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } + + public String getNotaBlacklist() { + return (this.notaBlacklist == null) ? "" : this.notaBlacklist.trim(); + } + + public void setNotaBlacklist(String notaBlacklist) { + this.notaBlacklist = notaBlacklist; + } + + public long getFatalCount() { + return this.fatalCount; + } + + public void setFatalCount(long fatalCount) { + this.fatalCount = fatalCount; + } + + public Timestamp getTmstStartCount() { + return (this.tmstStartCount == null) ? getTimestamp() : this.tmstStartCount; + } + + public void setTmstStartCount(Timestamp tmstStartCount) { + this.tmstStartCount = tmstStartCount; + } + + public Timestamp getTmstStartBlacklist() { + return this.tmstStartBlacklist; + } + + public void setTmstStartBlacklist(Timestamp tmstStartBlacklist) { + this.tmstStartBlacklist = tmstStartBlacklist; + } + + public ResParm save() { + if (getIpAddress().isEmpty()) { + setIpMax(0L); + setIpMin(0L); + } else { + long max = 0L, min = 0L; + int pot = 24; + if (getIpv4() != null) + for (Integer element : getIpv4()) { + System.out.println(element); + if (element == 0) { + max += 255L * (long)Math.pow(2.0D, (double)pot); + } else { + max += (long)element * (long)Math.pow(2.0D, (double)pot); + min += (long)element * (long)Math.pow(2.0D, (double)pot); + } + pot -= 8; + } + setIpMax(max); + setIpMin(min); + System.out.println("" + max + " " + max); + } + if (getTmstStartBlacklist() == null) + setTmstStartBlacklist(new Timestamp(getNow().getTime())); + return super.save(); + } + + @Deprecated + public ArrayList convertIpToIpv4Gpt(String l_ip) { + try { + ArrayList l_ipv4 = new ArrayList<>(); + StringTokenizer st = new StringTokenizer(l_ip, "."); + if (st.hasMoreTokens()) { + l_ipv4.add(Integer.valueOf(st.nextToken())); + } else { + l_ipv4.add(Integer.valueOf(0)); + } + if (st.hasMoreTokens()) { + l_ipv4.add(Integer.valueOf(st.nextToken())); + } else { + l_ipv4.add(Integer.valueOf(0)); + } + if (st.hasMoreTokens()) { + l_ipv4.add(Integer.valueOf(st.nextToken())); + } else { + l_ipv4.add(Integer.valueOf(0)); + } + if (st.hasMoreTokens()) { + l_ipv4.add(Integer.valueOf(st.nextToken())); + } else { + l_ipv4.add(Integer.valueOf(0)); + } + return l_ipv4; + } catch (Exception e) { + return null; + } + } + + public ArrayList convertIpToIpv4(String l_ip) { + try { + String[] parts = l_ip.trim().split("\\."); + if (parts.length != 4) + return null; + ArrayList ipv4 = new ArrayList<>(); + for (String part : parts) { + int val = Integer.parseInt(part); + if (val < 0 || val > 255) + return null; + ipv4.add(Integer.valueOf(val)); + } + return ipv4; + } catch (Exception e) { + handleDebug("Errore in convertIpToIpv4 per input: " + l_ip, 3); + return null; + } + } + + public long convertIpToLong(String l_ip) { + return convertIpv4ToLong(convertIpToIpv4(l_ip)); + } + + @Deprecated + public long convertIpv4ToLongGPT(ArrayList l_ipv4) { + if (l_ipv4 != null) { + long res = 0L; + int pot = 24; + for (Integer element : l_ipv4) { + res += (long)element * (long)Math.pow(2.0D, (double)pot); + pot -= 8; + } + return res; + } + return -1L; + } + + public long convertIpv4ToLong(ArrayList l_ipv4) { + if (l_ipv4 == null || l_ipv4.size() != 4) + return -1L; + long res = 0L; + for (int i = 0; i < 4; i++) { + int octet = l_ipv4.get(i); + if (octet < 0 || octet > 255) + return -1L; + res |= (long)octet << 8 * (3 - i); + } + return res; + } + + public long getIpMax(String l_ip) { + try { + long a = 0L, b = 0L, c = 0L, d = 0L; + StringTokenizer st = new StringTokenizer(l_ip, "."); + if (st.hasMoreTokens()) + a = Long.valueOf(st.nextToken()); + if (st.hasMoreTokens()) + b = Long.valueOf(st.nextToken()); + if (st.hasMoreTokens()) + c = Long.valueOf(st.nextToken()); + if (st.hasMoreTokens()) + d = Long.valueOf(st.nextToken()); + return d + c * 2L ^ 8L + b * 2L ^ 16L + a * 2L ^ 0x18L; + } catch (Exception e) { + return 0L; + } + } + + public long getIpMax() { + return this.ipMax; + } + + public void setIpMax(long ipMax) { + this.ipMax = ipMax; + } + + public long getIpMin() { + return this.ipMin; + } + + public void setIpMin(long ipMin) { + this.ipMin = ipMin; + } + + protected void initFields() { + super.initFields(); + setIpv4(null); + } + + public ArrayList getIpv4() { + if (getIpAddress().isEmpty()) + return null; + this.ipv4 = convertIpToIpv4(getIpAddress()); + return this.ipv4; + } + + public void setIpv4(ArrayList ipv4) { + this.ipv4 = ipv4; + } + + public void findByIpV4(String l_ip, boolean soloAttivo) { + String s_Sql_Find = "select A.* from BLACKLIST AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + DBAdapter.printDebug(false, "IP RICERCA:" + l_ip); + long ipLong = convertIpToLong(l_ip); + wc.addWc("A.ipMax>=" + ipLong); + wc.addWc("A.ipMin<=" + ipLong); + if (soloAttivo) + wc.addWc("A.flgAttivo=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/BlacklistCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/BlacklistCR.java new file mode 100644 index 00000000..d9df0c3e --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/BlacklistCR.java @@ -0,0 +1,64 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class BlacklistCR extends CRAdapter { + private static final long serialVersionUID = -8588412967337016926L; + + private long id_blacklist; + + private long flgAttivo = -1L; + + private String ipAddress; + + private String eMail; + + private String descrizione; + + public BlacklistCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public BlacklistCR() {} + + public void setId_blacklist(long newId_blackList) { + this.id_blacklist = newId_blackList; + } + + public void setFlgAttivo(long newFlgAttivo) { + this.flgAttivo = newFlgAttivo; + } + + public void setIpAddress(String newIpAddress) { + this.ipAddress = newIpAddress; + } + + public void setEMail(String newEMail) { + this.eMail = newEMail; + } + + public long getId_blacklist() { + return this.id_blacklist; + } + + public long getFlgAttivo() { + return this.flgAttivo; + } + + public String getIpAddress() { + return (this.ipAddress == null) ? "" : this.ipAddress.trim(); + } + + public String getEMail() { + return (this.eMail == null) ? "" : this.eMail.trim(); + } + + public String getDescrizione() { + return (this.descrizione == null) ? AB_EMPTY_STRING : this.descrizione.trim(); + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/CrontabInterface.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/CrontabInterface.java new file mode 100644 index 00000000..8d76ca9b --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/CrontabInterface.java @@ -0,0 +1,8 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.ResParm; + +public interface CrontabInterface { + ResParm crontabJob(ApplParmFull paramApplParmFull); +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DescLangItem.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DescLangItem.java new file mode 100644 index 00000000..c035d834 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DescLangItem.java @@ -0,0 +1,45 @@ +package it.acxent.common; + +import java.io.Serializable; + +public class DescLangItem implements Serializable { + private static final long serialVersionUID = -1620876542730237150L; + + private String value; + + private String lang; + + private String campo; + + public DescLangItem(String campo, String lang, String value) { + this.value = value; + this.lang = lang; + this.campo = campo; + } + + public DescLangItem() {} + + public String getCampo() { + return (this.campo == null) ? "" : this.campo.trim(); + } + + public void setCampo(String newCampo) { + this.campo = newCampo; + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang.trim(); + } + + public void setLang(String newLang) { + this.lang = newLang; + } + + public String getValue() { + return (this.value == null) ? "" : this.value.trim(); + } + + public void setValue(String value) { + this.value = value; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DescTxtLang.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DescTxtLang.java new file mode 100644 index 00000000..842b97bf --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DescTxtLang.java @@ -0,0 +1,276 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Hashtable; + +public class DescTxtLang extends DBAdapter implements Serializable { + private static Hashtable> initTableDescLangDescriptorDb; + + private String tabella; + + private long idTabella; + + private String campo; + + private String lang; + + private String descrizione; + + private String descrizione254; + + public DescTxtLang(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DescTxtLang() {} + + public void setTabella(String newTabella) { + this.tabella = newTabella; + } + + public void setIdTabella(long newIdTabella) { + this.idTabella = newIdTabella; + } + + public void setCampo(String newCampo) { + this.campo = newCampo; + } + + public void setLang(String newLang) { + this.lang = newLang; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public String getTabella() { + return (this.tabella == null) ? "" : this.tabella.trim(); + } + + public long getIdTabella() { + return this.idTabella; + } + + public String getCampo() { + return (this.campo == null) ? "" : this.campo.trim(); + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang.trim(); + } + + public String getDescrizioneScript() { + return DBAdapter.prepareScriptString(getDescrizione(), true, false); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(DescTxtLangCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from DESC_TXT_LANG AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizione254() { + return (this.descrizione254 == null) ? "" : this.descrizione254.trim(); + } + + public void setDescrizione254(String descrizione254) { + this.descrizione254 = descrizione254; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getDescrizione254Script() { + return DBAdapter.prepareScriptString(getDescrizione254(), true, false); + } + + public void findByIdtabellaLangTabellaCampo(long l_idTabella, String l_lang, String l_tabella, String l_campo) { + String s_Sql_Find = "select A.* from DESC_TXT_LANG AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.idTabella=" + l_idTabella); + wc.addWc("A.lang='" + l_lang + "'"); + wc.addWc("A.tabella='" + l_tabella + "'"); + wc.addWc("A.campo='" + l_campo + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public Vectumerator findCampiByIdtabellaLangTabella(long l_idTabella, String l_lang, String l_tabella) { + String s_Sql_Find = "select A.* from DESC_TXT_LANG AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.idTabella=" + l_idTabella); + wc.addWc("A.lang='" + l_lang + "'"); + wc.addWc("A.tabella='" + l_tabella + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + protected final int getStringValueCase(String l_columnName) { + return 0; + } + + public Vectumerator findCampiTabella(String l_tabella) { + String s_Sql_Find = "select A.campo from DESC_TXT_LANG AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.tabella='" + l_tabella + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm deleteByTabellaIdtabella(String l_tabella, long l_id_tabella) { + String s_Sql_Find = "delete from DESC_TXT_LANG "; + WcString wc = new WcString(); + wc.addWc("tabella='" + l_tabella + "'"); + wc.addWc("idTabella=" + l_id_tabella); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return delete(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return new ResParm(false, e); + } + } + + public Vectumerator findAllTxtByIdLangTable(long l_idTabella, String l_lang, String l_tabella) { + String s_Sql_Find = "select A.* from DESC_TXT_LANG AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.idTabella=" + l_idTabella); + if (!l_lang.isEmpty()) + wc.addWc("A.lang='" + l_lang + "'"); + wc.addWc("A.tabella='" + l_tabella + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public static void resetHashtables() { + if (initTableDescLangDescriptorDb != null) + initTableDescLangDescriptorDb.clear(); + } + + private static Hashtable> getInitTableDescLangDescriptorDb() { + if (initTableDescLangDescriptorDb == null) + initTableDescLangDescriptorDb = new Hashtable<>(); + return initTableDescLangDescriptorDb; + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + int l_stringCaseValue = 0; + Hashtable columnDescriptorHT = getInitTableDescLangDescriptorDb().get(getTabella() + getTabella()); + if (columnDescriptorHT != null && columnDescriptorHT.containsKey(getCampo())) { + l_stringCaseValue = columnDescriptorHT.get(getCampo()); + } else { + Access access = new Access(getApFull()); + access.findByPrimaryKey(getTabella()); + l_stringCaseValue = access.getTableColumnStringValueCase(getCampo()); + if (columnDescriptorHT == null) + columnDescriptorHT = new Hashtable<>(); + columnDescriptorHT.put(getCampo(), Integer.valueOf(l_stringCaseValue)); + getInitTableDescLangDescriptorDb().put(getTabella() + getTabella(), columnDescriptorHT); + } + if (l_stringCaseValue != 0) { + String temp; + switch (l_stringCaseValue) { + case 1: + temp = getDescrizione(); + if (temp != null) { + temp = temp.toUpperCase(); + temp = temp.replaceAll("&EURO;", "€"); + } + setDescrizione(temp); + temp = getDescrizione254(); + if (temp != null) { + temp = temp.toUpperCase(); + temp = temp.replaceAll("&EURO;", "€"); + } + setDescrizione254(temp); + break; + case 2: + temp = getDescrizione(); + if (temp != null) + temp = temp.toLowerCase(); + setDescrizione(temp); + temp = getDescrizione254(); + if (temp != null) + temp = temp.toLowerCase(); + setDescrizione254(temp); + break; + case 3: + temp = getDescrizione(); + if (temp != null) + temp = convertTo1stCap(temp); + setDescrizione(temp); + temp = getDescrizione254(); + if (temp != null) + temp = temp.toLowerCase(); + setDescrizione254(temp); + break; + } + } + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DescTxtLangCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DescTxtLangCR.java new file mode 100644 index 00000000..084e78dc --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DescTxtLangCR.java @@ -0,0 +1,62 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class DescTxtLangCR extends CRAdapter { + private String tabella; + + private long idTabella; + + private String campo; + + private String lang; + + private String descrizione; + + public DescTxtLangCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DescTxtLangCR() {} + + public void setTabella(String newTabella) { + this.tabella = newTabella; + } + + public void setIdTabella(long newIdTabella) { + this.idTabella = newIdTabella; + } + + public void setCampo(String newCampo) { + this.campo = newCampo; + } + + public void setLang(String newLang) { + this.lang = newLang; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public String getTabella() { + return (this.tabella == null) ? "" : this.tabella.trim(); + } + + public long getIdTabella() { + return this.idTabella; + } + + public String getCampo() { + return (this.campo == null) ? "" : this.campo.trim(); + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang.trim(); + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DescTxtLangKey.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DescTxtLangKey.java new file mode 100644 index 00000000..7831cc0b --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DescTxtLangKey.java @@ -0,0 +1,54 @@ +package it.acxent.common; + +import java.io.Serializable; + +public class DescTxtLangKey implements Serializable { + private String tabella; + + private long idTabella; + + private String campo; + + private String lang; + + public DescTxtLangKey() {} + + public DescTxtLangKey(String newTabella, long newIdTabella, String newCampo, String newLang) { + setTabella(newTabella); + setIdTabella(newIdTabella); + setCampo(newCampo); + setLang(newLang); + } + + public void setTabella(String newTabella) { + this.tabella = newTabella; + } + + public void setIdTabella(long newIdTabella) { + this.idTabella = newIdTabella; + } + + public void setCampo(String newCampo) { + this.campo = newCampo; + } + + public void setLang(String newLang) { + this.lang = newLang; + } + + public String getTabella() { + return (this.tabella == null) ? "" : this.tabella.trim(); + } + + public long getIdTabella() { + return this.idTabella; + } + + public String getCampo() { + return (this.campo == null) ? "" : this.campo.trim(); + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang.trim(); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Dictionary.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Dictionary.java new file mode 100644 index 00000000..3899dcdc --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Dictionary.java @@ -0,0 +1,55 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import java.io.Serializable; + +public class Dictionary extends DBAdapter implements Serializable { + private String id_dictionary; + + private String id_language; + + private String descrizione; + + public Dictionary() { + initFields(); + } + + public Dictionary(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public String getDescrizione() { + return (this.descrizione == null) ? "" : + this.descrizione; + } + + public String getId_dictionary() { + return (this.id_dictionary == null) ? "" : + this.id_dictionary; + } + + public String getId_language() { + return (this.id_language == null) ? "" : + this.id_language; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setId_dictionary(String newId_dictionary) { + this.id_dictionary = newId_dictionary; + } + + public void setId_language(String newId_language) { + this.id_language = newId_language; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DictionaryKey.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DictionaryKey.java new file mode 100644 index 00000000..1d3e666e --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DictionaryKey.java @@ -0,0 +1,25 @@ +package it.acxent.common; + +import java.io.Serializable; + +public class DictionaryKey implements Serializable { + private String id_dictionary; + + private String id_language; + + public String getId_dictionary() { + return this.id_dictionary; + } + + public String getId_language() { + return this.id_language; + } + + public void setId_dictionary(String newId_dictionary) { + this.id_dictionary = newId_dictionary; + } + + public void setId_language(String newId_language) { + this.id_language = newId_language; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DittaCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DittaCR.java new file mode 100644 index 00000000..4ac8f405 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/DittaCR.java @@ -0,0 +1,212 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class DittaCR extends CRAdapter { + private String cognome; + + private String nome; + + private String indirizzo; + + private String numeroCivico; + + private String descrizioneComune; + + private String provinciaComune; + + private String capComune; + + private String capZona; + + private String descrizioneNazione; + + private String codFisc; + + private String pIva; + + private String eMail; + + private String eMailAmm; + + private String cellulare; + + private String telefono; + + private String telefonoAmm; + + private String fax; + + private String nota; + + private String imgTmst; + + private long id_ditta; + + public DittaCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public DittaCR() {} + + public void setCognome(String newCognome) { + this.cognome = newCognome; + } + + public void setNome(String newNome) { + this.nome = newNome; + } + + public void setIndirizzo(String newIndirizzo) { + this.indirizzo = newIndirizzo; + } + + public void setNumeroCivico(String newNumeroCivico) { + this.numeroCivico = newNumeroCivico; + } + + public void setDescrizioneComune(String newDescrizioneComune) { + this.descrizioneComune = newDescrizioneComune; + } + + public void setProvinciaComune(String newProvinciaComune) { + this.provinciaComune = newProvinciaComune; + } + + public void setCapComune(String newCapComune) { + this.capComune = newCapComune; + } + + public void setCapZona(String newCapZona) { + this.capZona = newCapZona; + } + + public void setDescrizioneNazione(String newDescrizioneNazione) { + this.descrizioneNazione = newDescrizioneNazione; + } + + public void setCodFisc(String newCodFisc) { + this.codFisc = newCodFisc; + } + + public void setPIva(String newPIva) { + this.pIva = newPIva; + } + + public void setEMail(String newEMail) { + this.eMail = newEMail; + } + + public void setEMailAmm(String newEMailAmm) { + this.eMailAmm = newEMailAmm; + } + + public void setCellulare(String newCellulare) { + this.cellulare = newCellulare; + } + + public void setTelefono(String newTelefono) { + this.telefono = newTelefono; + } + + public void setTelefonoAmm(String newTelefonoAmm) { + this.telefonoAmm = newTelefonoAmm; + } + + public void setFax(String newFax) { + this.fax = newFax; + } + + public void setNota(String newNota) { + this.nota = newNota; + } + + public void setImgTmst(String newImgTmst) { + this.imgTmst = newImgTmst; + } + + public String getCognome() { + return (this.cognome == null) ? "" : this.cognome.trim(); + } + + public String getNome() { + return (this.nome == null) ? "" : this.nome.trim(); + } + + public String getIndirizzo() { + return (this.indirizzo == null) ? "" : this.indirizzo.trim(); + } + + public String getNumeroCivico() { + return (this.numeroCivico == null) ? "" : this.numeroCivico.trim(); + } + + public String getDescrizioneComune() { + return (this.descrizioneComune == null) ? "" : this.descrizioneComune.trim(); + } + + public String getProvinciaComune() { + return (this.provinciaComune == null) ? "" : this.provinciaComune.trim(); + } + + public String getCapComune() { + return (this.capComune == null) ? "" : this.capComune.trim(); + } + + public String getCapZona() { + return (this.capZona == null) ? "" : this.capZona.trim(); + } + + public String getDescrizioneNazione() { + return (this.descrizioneNazione == null) ? "" : this.descrizioneNazione.trim(); + } + + public String getCodFisc() { + return (this.codFisc == null) ? "" : this.codFisc.trim(); + } + + public String getPIva() { + return (this.pIva == null) ? "" : this.pIva.trim(); + } + + public String getEMail() { + return (this.eMail == null) ? "" : this.eMail.trim(); + } + + public String getEMailAmm() { + return (this.eMailAmm == null) ? "" : this.eMailAmm.trim(); + } + + public String getCellulare() { + return (this.cellulare == null) ? "" : this.cellulare.trim(); + } + + public String getTelefono() { + return (this.telefono == null) ? "" : this.telefono.trim(); + } + + public String getTelefonoAmm() { + return (this.telefonoAmm == null) ? "" : this.telefonoAmm.trim(); + } + + public String getFax() { + return (this.fax == null) ? "" : this.fax.trim(); + } + + public String getNota() { + return (this.nota == null) ? "" : this.nota.trim(); + } + + public String getImgTmst() { + return (this.imgTmst == null) ? "" : this.imgTmst.trim(); + } + + public long getId_ditta() { + return this.id_ditta; + } + + public void setId_ditta(long id_ditta) { + this.id_ditta = id_ditta; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/FieldCache.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/FieldCache.java new file mode 100644 index 00000000..442c88e0 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/FieldCache.java @@ -0,0 +1,113 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class FieldCache extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1720535007805L; + + private long id_fieldCache; + + private String fieldTag; + + private String descrizione; + + public FieldCache(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public FieldCache() {} + + public void setId_fieldCache(long newId_fieldCache) { + this.id_fieldCache = newId_fieldCache; + } + + public void setFieldTag(String newFieldTag) { + this.fieldTag = newFieldTag; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_fieldCache() { + return this.id_fieldCache; + } + + public String getFieldTag() { + return (this.fieldTag == null) ? "" : this.fieldTag.trim(); + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(FieldCacheCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from FIELD_CACHE AS A"; + String s_Sql_Order = " order by A.fieldTag, A.descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (!CR.getFieldTagS().isEmpty()) + wc.addWc("A.fieldTag='" + CR.getFieldTagS() + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + public void findByTagValore(String l_tag, String l_valore) { + String s_Sql_Find = "select A.* from FIELD_CACHE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.descrizione='" + l_valore + "'"); + wc.addWc("A.fieldTag='" + l_tag + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public Vectumerator findTags() { + String s_Sql_Find = "select distinct A.fieldTag from FIELD_CACHE AS A"; + String s_Sql_OrderBy = " order by A.fieldTag"; + WcString wc = new WcString(); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/FieldCacheCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/FieldCacheCR.java new file mode 100644 index 00000000..10557c3b --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/FieldCacheCR.java @@ -0,0 +1,42 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class FieldCacheCR extends CRAdapter { + private long id_fieldCacheS; + + private String fieldTagS; + + private String descrizioneS; + + public FieldCacheCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public FieldCacheCR() {} + + public void setId_fieldCacheS(long newId_fieldCache) { + this.id_fieldCacheS = newId_fieldCache; + } + + public void setFieldTagS(String newFieldTag) { + this.fieldTagS = newFieldTag; + } + + public void setDescrizioneS(String newDescrizione) { + this.descrizioneS = newDescrizione; + } + + public long getId_fieldCacheS() { + return this.id_fieldCacheS; + } + + public String getFieldTagS() { + return (this.fieldTagS == null) ? "" : this.fieldTagS.trim(); + } + + public String getDescrizioneS() { + return (this.descrizioneS == null) ? "" : this.descrizioneS.trim(); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/JsonUploadFileResponse.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/JsonUploadFileResponse.java new file mode 100644 index 00000000..64436061 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/JsonUploadFileResponse.java @@ -0,0 +1,52 @@ +package it.acxent.common; + +public class JsonUploadFileResponse { + private String fileName; + + private String fileNameLink; + + private String message; + + private boolean result; + + public JsonUploadFileResponse() {} + + public JsonUploadFileResponse(boolean result, String message, String fileName, String fileNameLink) { + this.result = result; + this.message = message; + this.fileName = fileName; + this.fileNameLink = fileNameLink; + } + + public String getFileName() { + return this.fileName; + } + + public String getMessage() { + return this.message; + } + + public void setFileName(String imgPath) { + this.fileName = imgPath; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isResult() { + return this.result; + } + + public void setResult(boolean result) { + this.result = result; + } + + public String getFileNameLink() { + return this.fileNameLink; + } + + public void setFileNameLink(String fileNameLink) { + this.fileNameLink = fileNameLink; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/JsonUploadImageResponse.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/JsonUploadImageResponse.java new file mode 100644 index 00000000..431dfd53 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/JsonUploadImageResponse.java @@ -0,0 +1,41 @@ +package it.acxent.common; + +public class JsonUploadImageResponse { + private String imgPath; + + private String message; + + private boolean result; + + public JsonUploadImageResponse() {} + + public JsonUploadImageResponse(boolean result, String message, String imgpath) { + this.result = result; + this.message = message; + this.imgPath = imgpath; + } + + public String getImgPath() { + return this.imgPath; + } + + public String getMessage() { + return this.message; + } + + public void setImgPath(String imgPath) { + this.imgPath = imgPath; + } + + public void setMessage(String message) { + this.message = message; + } + + public boolean isResult() { + return this.result; + } + + public void setResult(boolean result) { + this.result = result; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Lang.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Lang.java new file mode 100644 index 00000000..89a83e13 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Lang.java @@ -0,0 +1,42 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.DBAdapterException; +import it.acxent.db.ResParm; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.SQLException; + +public class Lang extends DBAdapter implements Serializable { + private static final long serialVersionUID = 4734855776441745596L; + + private String lang; + + protected void deleteCascade() {} + + public static Vectumerator findAllLangAvailable(ApplParmFull ap) { + Vectumerator vec = new Vectumerator<>(); + String lingue = ap.getParm("LANG_AVAILABLE").getTesto(); + StringTokenizer st = new StringTokenizer(lingue, ","); + while (st.hasMoreTokens()) { + Lang lg = new Lang(); + lg.setLang(st.nextToken()); + vec.add(lg); + } + return vec; + } + + protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException { + return null; + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang; + } + + public void setLang(String lang) { + this.lang = lang; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/OrderedRowId.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/OrderedRowId.java new file mode 100644 index 00000000..8342f9f2 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/OrderedRowId.java @@ -0,0 +1,33 @@ +package it.acxent.common; + +public class OrderedRowId { + private long id; + + private long prevId; + + private long nextId; + + public long getId() { + return this.id; + } + + public void setId(long id) { + this.id = id; + } + + public long getPrevId() { + return this.prevId; + } + + public void setPrevId(long prevId) { + this.prevId = prevId; + } + + public long getNextId() { + return this.nextId; + } + + public void setNextId(long nextId) { + this.nextId = nextId; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Parm.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Parm.java new file mode 100644 index 00000000..c7e3439c --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Parm.java @@ -0,0 +1,2137 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.mail.MailProperties; +import it.acxent.reg.EcDc; +import it.acxent.rest._AblRestAdapter; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.awt.Color; +import java.io.File; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.Enumeration; +import javax.servlet.http.HttpServletRequest; + +public class Parm extends DBAdapter implements Serializable { + private static final long serialVersionUID = -1311795148673561804L; + + public static final String P_IS_LOCALHOST = "IS_LOCALHOST"; + + public static final String P_LOG_MAIL_ATTACH = "LOG_MAIL_ATTACH"; + + public static final String P_LOG_MAIL_ENABLE = "LOG_MAIL_ENABLE"; + + public static final String P_PWD_REUSE_TIMES = "PWD_REUSE_TIMES"; + + public static final String P_PWD_COMPLESSA = "PWD_COMPLESSA"; + + public static final String P_REWRITE_URL_ENABLE = "REWRITE_URL_ENABLE"; + + public static final String P_DEBUG = "DEBUG"; + + public static final String P_BLACKLIST_AUTO_FILL = "BLACKLIST_AUTO_FILL"; + + public static final String P_BLACKLIST_AUTO_ENABLE = "BLACKLIST_AUTO_ENABLE"; + + public static final String P_BLACKLIST_EMAIL_ENABLE = "BLACKLIST_EMAIL_ENABLE"; + + public static final String P_BLACKLIST_FATAL_COUNT = "BLACKLIST_FATAL_COUNT"; + + public static final String P_BLACKLIST_MAX_REQUEST_COUNT = "BLACKLIST_MAX_REQUEST_COUNT"; + + public static final String P_USER_PROFILE_ID_MAILING_LIST = "USER_PROFILE_ID_MAILING_LIST"; + + public static final String P_WWW_ADDRESS = "P_WWW_ADDRESS"; + + public static final String P_USE_CONTROL_CODE_ACCESS = "USE_CONTROL_CODE_ACCESS"; + + public static final String P_BLOCK_DATA_TEXT = "BLOCK_DATA_TEXT"; + + public static final String P_BLOCK_DATA_ON = "BLOCK_DATA_ON"; + + public static final String P_BLOCK_DATA_OFF = "BLOCK_DATA_OFF"; + + public static final String P_REWRITE_URL_RULES = "REWRITE_URL_RULES"; + + public static final String P_REWRITE_URL_LANG = "REWRITE_URL_LANG"; + + public static final String P_REWRITE_URL_FILE_PATH = "REWRITE_URL_FILE_PATH"; + + public static final String P_WATERMARK_TEXT = "WATERMARK_TEXT"; + + public static final String P_WATERMARK_COPYRIGHT = "WATERMARK_COPYRIGHT"; + + public static final String P_WATERMARK_NUMBER = "WATERMARK_NUMBER"; + + public static final String P_WATERMARK_IMG = "WATERMARK_IMG"; + + public static final String P_WATERMARK_VIDEO = "WATERMARK_VIDEO"; + + public static final String P_LOG_USERS_DELETES = "LOG_USERS_DELETES"; + + public static final String P_DAILY_CRONTAB_MAIN_LOG_FILE = "DAILY_CRONTAB_MAIN_LOG_FILE"; + + public static final String P_DAILY_CRONTAB_ENABLE = "DAILY_CRONTAB_ENABLE"; + + public static final String P_DAILY_CRONTAB = "DAILY_CRONTAB"; + + public static final String P_DAILY_CRONTAB_INSTANCE = "DAILY_CRONTAB_INSTANCE"; + + public static final String P_LOG_CRONTAB_MAIL = "LOG_CRONTAB_MAIL"; + + public static final String P_CRONTAB_LOCALHOST = "CRONTAB_LOCALHOST"; + + public static final String P_LANG = "LANG"; + + public static final String P_USE_GOOGLE_TRANSLATOR = "USE_GOOGLE_TRANSLATOR"; + + public static final String P_CHECK_TMST_SQL = "CHECK_TMST_SQL"; + + public static final String P_USER_PROFILE_ID_WWW = "USER_PROFILE_ID_WWW"; + + public static final String P_USER_PROFILE_ID_NO_REG = "USER_PROFILE_ID_NO_REG"; + + public static final String P_USER_PROFILE_ID_STANDARD_USER = "USER_PROFILE_ID_STANDARD_USER"; + + public static final String P_USER_MIN_MAIL_RECUPERO = "USER_MIN_MAIL_RECUPERO"; + + public static final String P_LOG_USERS_UPDATES = "LOG_USERS_UPDATES"; + + public static final String TABLE_NAME_PARM = "PARM"; + + public static final String P_ANNO_START = "ANNO_START"; + + public static final String P_ANNO_STOP = "ANNO_STOP"; + + public static final String P_CHANGE_LOG_TEXT = "CHANGE_LOG_TEXT"; + + public static final String P_MAILING_LIST_FILE = "MAIL_LIST_FILE"; + + public static final String P_SVLT_CONTEXT = "SVLT_CONTEXT"; + + public static final String P_MAX_NUMBER_OF_THREAD = "MAX_NUMBER_OF_THREAD"; + + public static final String P_SINGLE_SIGN_ON = "SINGLE_SIGN_ON"; + + public static final String P_FAVICON_ADMIN = "FAVICON_ADMIN"; + + public static final String P_LOGO_DOCS = "LOGO_DOCS"; + + public static final String P_LOGO_DOCS_ALTERNATIVO = "LOGO_DOCS_ALTERNATIVO"; + + public static final String P_SHORTCUT_ICON = "SHORTCUT_ICON"; + + public static final String P_PAGE_ROW = "PAGE_ROW"; + + public static final long PWD_CRYPT_TYPE_CRYPT = 1L; + + public static final long PWD_CRYPT_TYPE_MD5 = 2L; + + public static final long PWD_CRYPT_TYPE_SHA_256 = 3L; + + public static final String P_PWD_CRYPT = "PWD_CRYPT"; + + public static final long PWD_CRYPT_TYPE_PLAIN = 0L; + + public static final String P_RECEIVE_FILE_SERVLET = "RECEIVE_FILE_SERVLET"; + + public static final String P_PWD_LUNGHEZZA = "PWD_REUSE_LUNGHEZZA"; + + public static final String P_DOC_PATH = "DOC_PATH"; + + public static final String P_DEFAULT_TTF_PATH = "TTF_PATH"; + + public static final String P_LOGO_DOCS_W = "LOGO_DOCS_W"; + + public static final String P_LOGO_MENU = "LOGO_MENU"; + + public static final String P_PATH_IMG_ART = "PATH_IMG_ART"; + + public static final String P_TEST = "TEST"; + + public static final String P_TEST_ID_USER = "TEST_ID_USER"; + + public static final String P_DEBUG_LEVEL = "DEBUG_LEVEL"; + + public static final String P_LOGO_SX = "LOGO_SX"; + + public static final String P_TITLE = "TITLE"; + + public static final String P_PWD_DAYS = "PWD_DAYS"; + + public static final String P_LOGO_DOCS_H = "LOGO_DOCS_H"; + + public static final String P_USE_LOGON_COOKIE = "USE_LOGON_COOKIE"; + + public static final String P_LANG_AVAILABLE = "LANG_AVAILABLE"; + + public static final String P_LANG_PRI_SEC_ENABLE = "LANG_PRI_SEC_ENABLE"; + + public static final String P_LANG_PRIMARY = "LANG_PRIMARY"; + + public static final String P_LANG_SECONARY = "LANG_SECONARY"; + + public static final String P_DATA_FORMAT = "DATA_FORMAT"; + + public static final String P_PATH_USR_IMG_PROFILO = "PATH_USR_IMG_PROFILO"; + + public static final String P_CREATE_GRANT = "CREATE_GRANT"; + + public static final String P_STYLES = "STYLES"; + + public static final String P_MAIN_STYLE = "MAIN_STYLE"; + + public static final String P_DEBUG_DEFAULT_FILE = "/var/log/f3jar.log"; + + public static final String P_SERVERNAME = "SERVERNAME"; + + public static final String P_DICTIONARY_PROPERTY_DEFAULT_FILE = "dict"; + + public static final String P_DICTIONARY_PROPERTY_FILE = "DICT_PROP_FILE"; + + public static final String P_DOCBASE = "DOCBASE"; + + public static final String P_DB_VERSION = "DB_VERSION"; + + public static final String P_LIB_VERSION = "LIB_VERSION"; + + public static final String P_LOCALE = "LOCALE"; + + public static final String P_DEBUG_LOG_FILE = "LOG_FILE"; + + public static final String P_DICTIONARY_MISS_PROPERTY_PATH = "DICT_MISS_PROP_PTH"; + + public static final String P_PATH_TMP = "PATH_TMP"; + + public static final String P_TIME_FORMAT = "TIME_FORMAT"; + + public static final String P_USE_BLACKLIST = "USE_BLACKLIST"; + + public static final String P_USE_GRANT = "GRANT"; + + public static final String P_USE_LOG = "USE_LOG"; + + public static final String P_LOG_GG = "LOG_GG"; + + public static final String P_LOG_MAIL_GG = "LOG_MAIL_GG"; + + public static final String P_VERSION = "VERSION"; + + public static final String P_WM_COPIA = "WM_COPIA"; + + public static final String P_AUTENTICAZIONE_LDAP_ENABLE = "AUTENTICAZIONE_LDAP_ENABLE"; + + public static final String P_AUTENTICAZIONE_LDAP_SERVER = "AUTENTICAZIONE_LDAP_SERVER"; + + public static final String P_AUTENTICAZIONE_LDAP_PORTA = "AUTENTICAZIONE_LDAP_PORTA"; + + public static final String P_AUTENTICAZIONE_LDAP_DOM_NAME = "AUTENTICAZIONE_LDAP_DOM_NAME"; + + public static final String P_MNU_ENABLE = "MNU_ENABLE"; + + public static final String P_DEBUG_QUERY_ENABLE = "DEBUG_QUERY_ENABLE"; + + public static final String P_DEBUG_QUERY_SLOW_MILLISEC = "DEBUG_QUERY_SLOW_MILLISEC"; + + public static final long DEBUG_QUERY_NO = 0L; + + public static final long DEBUG_QUERY_SOLO_SLOW_QUERY = 1L; + + public static final long DEBUG_QUERY_TUTTE = 2L; + + public static final String P_CRAWLER_BOT_LIST = "CRAWLER_BOT_LIST"; + + public static final String P_PATH_IMG_STEP_ID = "PATH_IMG_STEP_ID"; + + private String codice; + + private Color color; + + private String coloreHex; + + private Date dataParm; + + private String descrizione; + + private long flgAdmin; + + private long flgTipo; + + private long id_parm; + + private String nota; + + private double numero; + + private Time ora; + + private Timestamp timeStamp; + + private String testo; + + private String tipoParm; + + private String tipoParmNew; + + private SimpleDateFormat df; + + public static String P_USERMSG = "USER_MSG"; + + public static String P_RESOMSG = "RESO_MSG"; + + public static String P_LOSTPWDMSG = "LOSTPWD_MSG"; + + public static String P_MLISTMSG = "MLIST_MSG"; + + public static final String STATUS_TAG_INIT = "INIT"; + + public static final long TIPO_TEXT = 0L; + + public static final long TIPO_NUMBER = 1L; + + public static final long TIPO_DATE = 2L; + + public static final long TIPO_TIME = 3L; + + public static final long TIPO_COLOR = 4L; + + public static final long TIPO_BOOL = 5L; + + public static final long TIPO_TIMESTAMP = 6L; + + public static final String USE_LOG = "USE_LOG"; + + public static final String PARM_NEW_PWD_USER_1 = "newPwd1"; + + public static final String getStringToken(String theString, int index) { + if (theString == null) + return ""; + int i = 0; + StringTokenizer st = new StringTokenizer(theString, ","); + while (st.hasMoreTokens()) { + i++; + if (i == index) + return st.nextToken(); + st.nextToken(); + } + return ""; + } + + public static final void initMainParms(ApplParmFull ap, HttpServletRequest req, String servletRealPath, String newPwd1) { + boolean debug = false; + try { + logDebug(debug, "initMainParms:start"); + if (ap != null) { + if (newPwd1 != null && !newPwd1.isEmpty()) { + Users user = new Users(ap); + user.findByPrimaryKey(1L); + long flgCrypt = user.getParm("PWD_CRYPT").getNumeroLong(); + String l_password = newPwd1; + if (flgCrypt == 1L) { + l_password = EcDc.encodeIntKey(newPwd1, 7); + } else if (flgCrypt == 2L) { + l_password = EcDc.cryptMD5(newPwd1); + } else if (flgCrypt == 3L) { + l_password = EcDc.cryptSHA(newPwd1, "SHA-256"); + } + user.setPwd(l_password); + user.save(); + } + Parm bean = new Parm(ap); + String serverName = ""; + if (req != null) { + System.out.println("########### REQUEST HEADERS ############"); + Enumeration headers = req.getHeaderNames(); + while (headers.hasMoreElements()) { + String header = headers.nextElement(); + System.out.println(header + ": " + header); + } + System.out.println("############################################"); + if (req.getHeader("x-forwarded-proto") == null) { + serverName = req.getScheme() + "://" + req.getScheme() + req.getServerName() + "/"; + } else { + serverName = req.getHeader("x-forwarded-proto") + "://" + req.getHeader("x-forwarded-proto") + req.getServerName() + "/"; + } + } + String l_tipoParm = "LOG BL"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("USE_LOG"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("USE_LOG"); + bean.setDescrizione("USE_LOG"); + bean.setFlgTipo(5L); + bean.setNumero(1.0D); + bean.setNota("Abilita la registrazione dei movimenti sul DB sulla tabella LOG. La tabella LOG, LOG_MAIL e LOG_MAIL_ATTACH devono essere su un database con nome [databasse]_log"); + bean.save(); + bean.findByCodice("USE_BLACKLIST"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("USE_BLACKLIST"); + bean.setDescrizione("USE_BLACKLIST"); + bean.setFlgTipo(5L); + bean.setNumero(1.0D); + bean.setNota("Abilita la tabella BLACKLIST"); + bean.save(); + bean.findByCodice("LOG_USERS_DELETES"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LOG_USERS_DELETES"); + bean.setDescrizione("LOG_USERS_DELETES"); + bean.setFlgTipo(5L); + bean.setNota("Registra tutte le cancellazioni effettuate dagli utenti.
Default:NO"); + bean.save(); + bean.findByCodice("LOG_GG"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LOG_GG"); + bean.setDescrizione("LOG_GG"); + bean.setFlgTipo(1L); + bean.setNota("Numero di giorni di mantenimento dei log. 0--> nessuna scadenza.
ATTENZIONE! IL PARAMETRO DAILY_CRONTAB_ENABLE DEVE ESSERE ABILITATO.
"); + bean.save(); + bean.findByCodice("LOG_MAIL_GG"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LOG_MAIL_GG"); + bean.setDescrizione("LOG_MAIL_GG"); + bean.setFlgTipo(1L); + bean.setNota("Numero di giorni di mantenimento dei log MAIL. 0--> nessuna scadenza.
ATTENZIONE! IL PARAMETRO DAILY_CRONTAB_ENABLE DEVE ESSERE ABILITATO.
"); + bean.save(); + bean.findByCodice("LOG_CRONTAB_MAIL"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LOG_CRONTAB_MAIL"); + bean.setDescrizione("LOG_CRONTAB_MAIL"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("acolzi@f3.com"); + bean.setNota("Indirizzo email a cui vengono spediti i risultati della crontab dei LOG."); + bean.save(); + bean.findByCodice("LOG_USERS_UPDATES"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LOG_USERS_UPDATES"); + bean.setDescrizione("LOG_USERS_UPDATES"); + bean.setFlgTipo(5L); + bean.setNota("Registra tutte gli aggiornamenti effettuate dagli utenti.
Default:NO"); + bean.save(); + bean.findByCodice("LOG_MAIL_ENABLE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LOG_MAIL_ENABLE"); + bean.setDescrizione("LOG_MAIL_ENABLE"); + bean.setFlgTipo(5L); + bean.setNota("Abilita la memorizzazione delle mail su LOG_MAIL.
Default:NO "); + bean.save(); + bean.findByCodice("LOG_MAIL_ATTACH"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LOG_MAIL_ATTACH"); + bean.setDescrizione("LOG_MAIL_ATTACH"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_attach/_log/"); + bean.setNota("Percorso dove vengono salvati gli attach delle mail, relativo a docbase. Deve finire con /"); + bean.save(); + l_tipoParm = "MAILING LIST"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("MAIL_LIST_FILE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIL_LIST_FILE"); + bean.setDescrizione("MAIL_LIST_FILE"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("/usr/local/minimalist/dominio/list"); + bean.setNota("PATH ASSOLUTO. MAILING LIST UTENTI"); + bean.save(); + l_tipoParm = "HELP"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("HELP_ATTACH_PATH"); + bean.delete(); + bean.findByCodice("HELP_IMG_PATH"); + bean.delete(); + bean.delete(); + bean.findByCodice("HELP_PUBLIC_CODES"); + bean.delete(); + l_tipoParm = "POLICY"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("PWD_CRYPT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PWD_CRYPT"); + bean.setDescrizione("PWD_CRYPT"); + bean.setFlgTipo(1L); + bean.setNota("UTILIZZA PASSWORD SUL DB CRIPTATE: 0=NO, 1=SI,2=MD5,3=SHA-256"); + bean.save(); + bean.findByCodice("AUTENTICAZIONE_LDAP_ENABLE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("AUTENTICAZIONE_LDAP_ENABLE"); + bean.setDescrizione("AUTENTICAZIONE_LDAP_ENABLE"); + bean.setFlgTipo(5L); + bean.setNota("ABILITA AUTENTICAZIONE LDAP (DOMAIN CONTROLLER)
COMPILARE SERVER LDAP, DOMINIO E PORTA"); + bean.save(); + bean.findByCodice("AUTENTICAZIONE_LDAP_SERVER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("AUTENTICAZIONE_LDAP_SERVER"); + bean.setDescrizione("AUTENTICAZIONE_LDAP_SERVER"); + bean.setFlgTipo(0L); + bean.setNota("NOME O INDIRIZZO IP DEL SERVER LDAP/DOMAIN CONTROLLER"); + bean.save(); + bean.findByCodice("AUTENTICAZIONE_LDAP_PORTA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("AUTENTICAZIONE_LDAP_PORTA"); + bean.setDescrizione("AUTENTICAZIONE_LDAP_PORTA"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(389.0D); + bean.setNota("PORTA SERVER LDAP (DI SOLITO 389)"); + bean.save(); + bean.findByCodice("AUTENTICAZIONE_LDAP_DOM_NAME"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("AUTENTICAZIONE_LDAP_DOM_NAME"); + bean.setDescrizione("AUTENTICAZIONE_LDAP_DOM_NAME"); + bean.setFlgTipo(0L); + bean.setNota("NOME DOMAIN CONTROLLER PER AUTENTICAZIONE LDAP"); + bean.save(); + bean.findByCodice("PWD_DAYS"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PWD_DAYS"); + bean.setDescrizione("PWD_DAYS"); + bean.setFlgTipo(1L); + bean.setNota("NUMERO GIORNI DURATA PASSWORD. 0= NESSUNA SCADENZA."); + bean.save(); + bean.findByCodice("PWD_REUSE_TIMES"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PWD_REUSE_TIMES"); + bean.setDescrizione("PWD_REUSE_TIMES"); + bean.setFlgTipo(1L); + bean.setNota("NUMERO DI PASSWORD DA NON RIUTILIZZARE: 0=NESSUN CONTROLLO "); + bean.save(); + bean.findByCodice("PWD_COMPLESSA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PWD_COMPLESSA"); + bean.setDescrizione("PWD_COMPLESSA"); + bean.setFlgTipo(5L); + bean.setNota("PASSWORD COMPLESSA:
SE IMPOSTATO A TRUE: 1 MAIUSCOLA, 1 MINUSCOLA, 1 NUMERO, 1 CARATTERE SPECIALE"); + bean.save(); + bean.findByCodice("PWD_REUSE_LUNGHEZZA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PWD_REUSE_LUNGHEZZA"); + bean.setDescrizione("PWD_REUSE_LUNGHEZZA"); + bean.setFlgTipo(1L); + bean.setNota("0: QUANTO CI PARE"); + bean.save(); + bean.findByCodice("SINGLE_SIGN_ON"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SINGLE_SIGN_ON"); + bean.setDescrizione("SINGLE_SIGN_ON"); + bean.setFlgTipo(0L); + bean.setTesto("false"); + bean.setNota("EFFETTUA IL LOGON DIRETTAMENTE TRAMITE IL NOME UTENTE DI ACCESSO.
false: login e password
true: single sign on"); + bean.save(); + l_tipoParm = "VERSIONE"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("VERSION"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("VERSION"); + bean.setDescrizione("VERSION"); + bean.setFlgTipo(0L); + bean.setNota("NB: valori maiuscoli separati da ,"); + bean.save(); + l_tipoParm = "CRONTAB"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("DAILY_CRONTAB"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DAILY_CRONTAB"); + bean.setDescrizione("DAILY_CRONTAB"); + bean.setFlgTipo(0L); + bean.setNota("Elenco classi che implementano l'interfaccia CrontabInterface. Una classe per linea.
Si esegue il seguente schema:

CronInterfaceClass [email] --> viene eseguito alle 00:00 di ogni giorno
CronInterfaceClass minute hour mday month wday [email]
CronInterfaceClass 01 0 * * * aa@aa.com,bb@bb.com
Il valore * vuol dire 'ogni'
il valore /n vuol dire 'ogni n' (se n=10 nei minuti, è vero per 0,10,20,30,40,50 minuti ovvero il test è min%n=0)
N.B. il campo email è opzionale."); + bean.save(); + bean.findByCodice("DAILY_CRONTAB_INSTANCE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DAILY_CRONTAB_INSTANCE"); + bean.setDescrizione("DAILY_CRONTAB_INSTANCE"); + bean.setFlgTipo(0L); + bean.setNota("Se l'applicazione risiede su + istanze, la crontab deve partire su una sola istanza.
Se questo parametro è vuoto, parte comunque ma su + istanze non è l'ideale.
Quindi se questo parametro è impostato, la crontab parte solo se coincide con il paramento instance sul web.xml"); + bean.save(); + bean.findByCodice("DAILY_CRONTAB_ENABLE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DAILY_CRONTAB_ENABLE"); + bean.setDescrizione("DAILY_CRONTAB_ENABLE"); + bean.setFlgTipo(5L); + bean.setNota("Abilita la crontab."); + bean.save(); + bean.findByCodice("DAILY_CRONTAB_MAIN_LOG_FILE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DAILY_CRONTAB_MAIN_LOG_FILE"); + bean.setDescrizione("DAILY_CRONTAB_MAIN_LOG_FILE"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) { + String str = ap.getDatabase().substring(ap.getDatabase().lastIndexOf('/'), ap.getDatabase().length()); + bean.setTesto("/var/log" + str.trim() + "Crontab.log"); + } + bean.setNota("File di log della crontab."); + bean.save(); + bean.findByCodice("CRONTAB_LOCALHOST"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CRONTAB_LOCALHOST"); + bean.setDescrizione("CRONTAB_LOCALHOST"); + bean.setFlgTipo(5L); + bean.setNota("Se true esegue la crontab in localhost"); + bean.save(); + l_tipoParm = "ADMIN"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("FAVICON_ADMIN"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FAVICON_ADMIN"); + bean.setDescrizione("FAVICON_ADMIN"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("admin/_V4/_img/logo/favicon.ico"); + bean.setNota("Percorso favicon pagine amministrative. Default
admin/_V4/_img/favicon.ico"); + bean.save(); + bean.findByCodice("IS_LOCALHOST"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("IS_LOCALHOST"); + bean.setDescrizione("IS_LOCALHOST"); + bean.setFlgTipo(5L); + if (serverName.indexOf("localhost") >= 0) { + bean.setNumero(1.0D); + } else { + bean.setNumero(0.0D); + } + bean.setNota("MI MEMORIZZO SE SIAMO IN LOCALHOST O NO. PER DEBUG"); + bean.save(); + bean.findByCodice("PATH_USR_IMG_PROFILO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PATH_USR_IMG_PROFILO"); + bean.setDescrizione("PATH_USR_IMG_PROFILO"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_img/_imgUsers/"); + bean.setNota("Path relativo a docbase che finisce con /"); + bean.save(); + bean.findByCodice("USER_PROFILE_ID_MAILING_LIST"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("USER_PROFILE_ID_MAILING_LIST"); + bean.setDescrizione("USER_PROFILE_ID_MAILING_LIST"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(10.0D); + bean.setNota("ID user profile che identifica l'utente MAILING LIST"); + bean.save(); + bean.findByCodice("USER_PROFILE_ID_WWW"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("USER_PROFILE_ID_WWW"); + bean.setDescrizione("USER_PROFILE_ID_WWW"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(9.0D); + bean.setNota("ID user profile che identifica l'utente WWW"); + bean.save(); + bean.findByCodice("USER_PROFILE_ID_NO_REG"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("USER_PROFILE_ID_NO_REG"); + bean.setDescrizione("USER_PROFILE_ID_NO_REG"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(12.0D); + bean.setNota("ID user profile che identifica l'utente WWW che effettua ordini senza registrarsi"); + bean.save(); + bean.findByCodice("USER_PROFILE_ID_STANDARD_USER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("USER_PROFILE_ID_STANDARD_USER"); + bean.setDescrizione("USER_PROFILE_ID_STANDARD_USER"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(11.0D); + bean.setNota("ID user profile che identifica l'utente standard (operazioni limitate sul sito)"); + bean.save(); + bean.findByCodice("USER_MIN_MAIL_RECUPERO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("USER_MIN_MAIL_RECUPERO"); + bean.setDescrizione("USER_MIN_MAIL_RECUPERO"); + bean.setFlgTipo(1L); + bean.setNota("MINUTI NECESSARI PER POTER EFFETTUARE UN NUOVO INVIO DATI DI RECUPERO VIA EMAIL ("); + bean.save(); + bean.findByCodice("CHECK_TMST_SQL"); + bean.delete(); + bean.findByCodice("ANNO_START"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("ANNO_START"); + bean.setDescrizione("ANNO_START"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(2015.0D); + bean.setNota("ANNO DI INIZIO PER COMBO SU RICERCHE "); + bean.save(); + bean.findByCodice("CHANGE_LOG_TEXT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CHANGE_LOG_TEXT"); + bean.setDescrizione("CHANGE_LOG_TEXT"); + bean.setFlgTipo(0L); + bean.setNota("Definisce il testo da visualizzare dopo il logon solo per la prima volta."); + bean.save(); + bean.findByCodice("TTF_PATH"); + bean.delete(); + bean.findByCodice("PAGE_ROW"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PAGE_ROW"); + bean.setDescrizione("PAGE_ROW"); + bean.setFlgTipo(1L); + if (bean.getNumeroInt() == 0) + bean.setNumero(12.0D); + bean.setNota("NUMERO RIGHE PER PAGINA PER IL SALTO PAGINA"); + bean.save(); + bean.findByCodice("TEST"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("TEST"); + bean.setDescrizione("TEST"); + bean.setFlgTipo(5L); + bean.setNota("Abilita le funzioni di test, come ad esempio sandbox paypal"); + bean.save(); + bean.findByCodice("TEST_ID_USER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("TEST"); + bean.setDescrizione("TEST_ID_USER"); + bean.setFlgTipo(5L); + bean.setNota("SE TEST E' ATTIVATO, UTILIZZATO PER BYPASSARE VARI CONTROLLI COME PER RECORD ORDER SU TEST BANCHE"); + bean.save(); + bean.findByCodice("CREATE_GRANT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CREATE_GRANT"); + bean.setDescrizione("CREATE_GRANT"); + bean.setFlgTipo(5L); + bean.setNumero(1.0D); + bean.setNota("Crea automaticamente i grant sulla tabella ACCESS"); + bean.save(); + bean.findByCodice("DOCBASE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DOCBASE"); + bean.setDescrizione("DOCBASE"); + bean.setFlgTipo(0L); + String temp = servletRealPath; + if (temp != null) { + if (!temp.endsWith(DBAdapter.SEPARATOR)) + temp = temp + temp; + bean.setTesto(temp.replace('\\', '/')); + } + bean.setNota("NB: deve finire con una sola /"); + bean.save(); + bean.findByCodice("DB_VERSION"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DB_VERSION"); + bean.setDescrizione("DB_VERSION"); + bean.setFlgTipo(0L); + bean.setNota("VERSIONE DB. TIENE TRACCIA FINO A CHE ALTER SONO ARRIVATO.
ALLA FINE DI OGNI FILE DI ALTER AGGIUNGERE:
UPDATE PARM SET testo='xxx' where codice='DB_VERSION';
Dove xxx è la versione dell'ultimo alter a cui sono arrivato"); + bean.save(); + bean.findByCodice("P_WWW_ADDRESS"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("P_WWW_ADDRESS"); + bean.setDescrizione("P_WWW_ADDRESS"); + bean.setFlgTipo(0L); + bean.setTesto(serverName); + bean.setNota("INDIRIZZO WWW (https://WWW.MIOSITO.COM) PER LINK SULLE EMAIL"); + bean.save(); + bean.findByCodice("USE_LOGON_COOKIE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("USE_LOGON_COOKIE"); + bean.setDescrizione("USE_LOGON_COOKIE"); + bean.setFlgTipo(0L); + bean.setTesto("false"); + bean.setNota("Attiva o disattiva i cookie per il logon automatico. Valori corretti: true, false"); + bean.save(); + bean.findByCodice("SERVERNAME"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SERVERNAME"); + bean.setDescrizione("SERVERNAME"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("http://localhost:8080/"); + bean.setNota("Utilizzato per comandi tipo getLinkPreview.\nEs.: http://localhost:8080/"); + bean.save(); + bean.findByCodice("SHORTCUT_ICON"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SHORTCUT_ICON"); + bean.setDescrizione("SHORTCUT_ICON"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("..\\img\\Icons\\shIcon\\shi.gif"); + bean.setNota("Icona del Browser: path completo ad una icona. Di solito sono su admin\\img\\Icons\\shIcon\\24x24.gif"); + bean.save(); + bean.findByCodice("SVLT_CONTEXT"); + bean.delete(); + bean.findByCodice("LOGO_SX"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LOGO_SX"); + bean.setDescrizione("LOGO_SX"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("Logo Applicazione"); + bean.setNota("Va bene qualsiasi codice html, anche tag img.UTILIZZATO DAL METODO ACServlet.isRequestFromCrawler(..)"); + bean.save(); + l_tipoParm = "ADMIN FORMAT"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("LOCALE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LOCALE"); + bean.setDescrizione("Locale "); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("IT"); + bean.setNota("Default: IT"); + bean.save(); + bean.findByCodice("LANG"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LANG"); + bean.setDescrizione("Lang "); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("IT"); + bean.setNota("Default: IT. Utilizzato quando non abbiamo ne' lang su user che sulla request."); + bean.save(); + bean.findByCodice("USE_GOOGLE_TRANSLATOR"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("USE_GOOGLE_TRANSLATOR"); + bean.setDescrizione("Lang "); + bean.setFlgTipo(5L); + bean.setNota("ABILITA IL TASTO TRADUCI SUI BEAN CHE SUPPORTANO DESC_TXT_LANG."); + bean.save(); + bean.findByCodice("LANG_AVAILABLE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LANG_AVAILABLE"); + bean.setDescrizione("Lingue supportate "); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("it,en"); + bean.setNota("Default: it,en. Definisce le lingue gestite dal sito.
Utilizzare codici lingua separati da virgola.
In genere, se è una lingua diversa da it e en, uso en di default
L'ordine di inserimento identifica la lingua primaria e secondaria utilizzata in getDescrizionePS per i campi di ricerca in amministrazione"); + bean.save(); + bean.findByCodice("LANG_PRI_SEC_ENABLE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LANG_PRI_SEC_ENABLE"); + bean.setDescrizione("Abilita lingua primaria e secondaria"); + bean.setFlgTipo(5L); + bean.setNota("Abilita lingua primaria e secondaria per gestione descrizioni in lingua.
Si basa sull'ordine immesso su LANG_AVAILABLE"); + bean.save(); + bean.findByCodice("STYLES"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("STYLES"); + bean.setDescrizione("CSS DISPONIBILI SELEZIONABILI DALL'UTENTE"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_std,_desk,_purple,_red,_www"); + bean.setNota("NON UTILIZZATO PER ADESSO!!! Campi separati da ','. Sono gli stili sotto la dir admin/menu/_css/
Di solito li nomino con _ iniziale. Mettere il nome completo con _ senza estensione .css"); + bean.save(); + bean.findByCodice("MAIN_STYLE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIN_STYLE"); + bean.setDescrizione("CSS STANDARD"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_std"); + bean.setNota("CSS STANDARD PER LE PAGINE AMMINISTRATIVE QUANDO NON ALTRIMENTI DEFINITO SU USER
Sono gli stili sotto la dir admin/menu/_css/
Di solito li nomino con _ iniziale. Mettere il nome completo con _ senza estensione .css
Per adesso sono disponibili i seguenti stili:
_std,_desk,_purple,_red,_www"); + bean.save(); + bean.findByCodice("TIME_FORMAT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("TIME_FORMAT"); + bean.setDescrizione("Time format"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("hh:mm"); + bean.setNota("Default: hh:mm"); + bean.save(); + bean.findByCodice("DATA_FORMAT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DATA_FORMAT"); + bean.setDescrizione("Data format"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("dd/MM/yyyy"); + bean.setNota("Default: dd/MM/yyyy"); + bean.save(); + l_tipoParm = "APPS"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("PATH_IMG_ART"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PATH_IMG_ART"); + bean.setDescrizione("PATH_IMG_ART"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_img/_imgArt/"); + bean.setNota("Path relativo a docbase che finisce con /"); + bean.save(); + bean.findByCodice("PATH_IMG_STEP_ID"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PATH_IMG_STEP_ID"); + bean.setDescrizione("PATH_IMG_STEP_ID"); + bean.setFlgTipo(1L); + bean.setNota("Se > 0 le immagini dei record sono suddivise secondo dir definite dallo step. Ad esempio se stepid=100000, i primi 10000 id sono sotto _10000, da 10000 a 20000 sono sotto _20000 e cos' via.
Se ci sono ad esempio 5 immagini per articolo, i file sotto la dir sono 5*10000 ...."); + bean.save(); + bean.findByCodice("PATH_TMP"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("PATH_TMP"); + bean.setDescrizione("PATH_TMP"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_tmp/"); + bean.setNota("Path relativo a docbase. Finisce con /. Di solito _tmp/"); + bean.save(); + checkAndMakeDir(bean.getDocBase() + bean.getDocBase()); + l_tipoParm = "WATERMARK"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("WM_COPIA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("WM_COPIA"); + bean.setDescrizione("Watermark PDF"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("admin/img/wmCopia.jpg"); + bean.setNota("Immagine con path relativo watermark \"COPIA\" per le immagini. Standard per A4"); + bean.save(); + bean.findByCodice("WM_COPIA"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("WM_COPIA"); + bean.setDescrizione("Watermark PDF"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("admin/img/wmCopia.jpg"); + bean.setNota("Immagine con path relativo watermark \"COPIA\" per le immagini. Standard per A4"); + bean.save(); + bean.findByCodice("WATERMARK_TEXT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("WATERMARK_TEXT"); + bean.setDescrizione("WATERMARK_TEXT"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("Copyright (c)"); + bean.setNota("TESTO CHE VIENE INSERITO NELLE IMMAGINI COME WATERMARK PERSONALIZZATO"); + bean.save(); + bean.findByCodice("WATERMARK_COPYRIGHT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("WATERMARK_COPYRIGHT"); + bean.setDescrizione("WATERMARK_COPYRIGHT"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("(c) Le immagini sono di proprietà di ____. E' vietata la riproduzione anche parziale. "); + bean.setNota("TESTO di copyright"); + bean.save(); + bean.findByCodice("WATERMARK_NUMBER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("WATERMARK_NUMBER"); + bean.setDescrizione("WATERMARK_NUMBER"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(1.0D); + bean.setNota("Numero di watermark da inserire nelle immagini. Se <=0 sarà 1"); + bean.save(); + bean.findByCodice("WATERMARK_IMG"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("WATERMARK_IMG"); + bean.setDescrizione("WATERMARK_IMG"); + bean.setFlgTipo(0L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(1.0D); + bean.setNota("PATH IMMAGINE WATERMARK PER FOTO"); + bean.save(); + bean.findByCodice("WATERMARK_VIDEO"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("WATERMARK_VIDEO"); + bean.setDescrizione("WATERMARK_VIDEO"); + bean.setFlgTipo(0L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(1.0D); + bean.setNota("PATH IMMAGINE WATERMARK PER VIDEO"); + bean.save(); + l_tipoParm = "DEBUG"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("DEBUG"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DEBUG"); + bean.setDescrizione("Debug: true/false"); + bean.setFlgTipo(0L); + bean.setTesto("true"); + bean.setNumero(1.0D); + bean.setNota("Attiva o disattiva il debug. Valori corretti: true, false"); + bean.save(); + bean.findByCodice("LOG_FILE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LOG_FILE"); + bean.setDescrizione("File log"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("/var/log/f3jar.log"); + bean.setNota("File log di default: /var/log/f3jar.log"); + bean.save(); + bean.findByCodice("DEBUG_LEVEL"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DEBUG_LEVEL"); + bean.setDescrizione("Livello debug: da 0 a 5"); + bean.setFlgTipo(1L); + bean.setNumero(0.0D); + bean.setNota("Per solo errori fatal: debug=true e debugLevel=0"); + bean.save(); + bean.findByCodice("TO_DEBUG"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("TO_DEBUG"); + bean.setDescrizione("TO_DEBUG"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("crontab@acxent.it"); + bean.setNota("Mail a cui vengono inviati gli errori FATAL! Default: crontab@acxent.it"); + bean.save(); + bean.findByCodice("DEBUG_QUERY_ENABLE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DEBUG_QUERY_ENABLE"); + bean.setDescrizione("DEBUG_QUERY_ENABLE"); + bean.setFlgTipo(1L); + bean.setNumero(0.0D); + bean.setNota("ABILITA IL DEBUG DELLE QUERY.
0 --> DISABILITATO
1 --> ATTIVO SOLO SLOW QUERY (DEBUG_QUERY_SLOW_MILLISEC DEVE ESSERE >0)
2 --> ATTIVO SEMPRE "); + bean.save(); + bean.findByCodice("DEBUG_QUERY_SLOW_MILLISEC"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DEBUG_QUERY_SLOW_MILLISEC"); + bean.setDescrizione("DEBUG_QUERY_SLOW_MILLISEC"); + bean.setFlgTipo(1L); + bean.setNumero(0.0D); + bean.setNota("MILLISECONDI OLTRE I QUALI LA QUERY VIENE CONSIDERATA SLOW. AGGIUNGE IN OUTPT ANCHE LA PAROLA SLOW_QUERY"); + bean.save(); + bean.findByCodice("BLACKLIST_AUTO_ENABLE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("BLACKLIST_AUTO_ENABLE"); + bean.setDescrizione("BLACKLIST_AUTO_ENABLE"); + bean.setFlgTipo(5L); + bean.setNota("Attiva il riempimento automatico della tabella blacklist"); + bean.save(); + bean.findByCodice("BLACKLIST_AUTO_FILL"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("BLACKLIST_AUTO_FILL"); + bean.setDescrizione("BLACKLIST_AUTO_FILL"); + bean.setFlgTipo(5L); + bean.setNota("Insieme a blacklist auto enable, rende effettivamente attiva la blacklist"); + bean.save(); + bean.findByCodice("BLACKLIST_FATAL_COUNT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("BLACKLIST_FATAL_COUNT"); + bean.setDescrizione("BLACKLIST_FATAL_COUNT"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(5.0D); + bean.setNota("Numero di fatal al minuto. Viene comunque fatta una proporzione"); + bean.save(); + bean.findByCodice("BLACKLIST_MAX_REQUEST_COUNT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("BLACKLIST_MAX_REQUEST_COUNT"); + bean.setDescrizione("BLACKLIST_MAX_REQUEST_COUNT"); + bean.setFlgTipo(1L); + if (bean.getNumero() == 0.0D) + bean.setNumero(5.0D); + bean.setNota("Numero di richieste massime al minuto. Utilizzato dal metodo checkBlacklist generico, di solito per invio form in genere.
Per il mailer ci sono parametri ad Hoc (MAILER).
Viene comunque fatta una proporzione"); + bean.save(); + bean.findByCodice("BLACKLIST_EMAIL_ENABLE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("BLACKLIST_EMAIL_ENABLE"); + bean.setDescrizione("BLACKLIST_EMAIL_ENABLE"); + bean.setFlgTipo(5L); + bean.setNota("Abilita blacklist email su logon utente (inutiie??)"); + bean.save(); + l_tipoParm = "DICT"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("DICT_PROP_FILE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DICT_PROP_FILE"); + bean.setDescrizione("File dizionario"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("dict"); + bean.setNota("Prefisso file dizionario del tipo [pref]_en.properties. Se vuoto default file: dict\nDeve essere nel classpath!!"); + bean.save(); + bean.findByCodice("DICT_MISS_PROP_PTH"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("DICT_MISS_PROP_PTH"); + bean.setDescrizione("Path file dizionari mancanti"); + bean.setFlgTipo(0L); + bean.setNota("Path file dizionari mancanti. Default: / .\nNota bene: deve finire con /"); + bean.save(); + l_tipoParm = "MAIL"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("USE_CONTROL_CODE_ACCESS"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("USE_CONTROL_CODE_ACCESS"); + bean.setDescrizione("USE_CONTROL_CODE_ACCESS"); + bean.setFlgTipo(5L); + bean.setNota("Usa contro code access per siti web."); + bean.save(); + bean.findByCodice("BCC"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("BCC"); + bean.setDescrizione("BCC"); + bean.setFlgTipo(0L); + bean.setNota("Blank carbon copy"); + bean.save(); + bean.findByCodice("MAILING_LIST_TOT_IND_BCC"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAILING_LIST_TOT_IND_BCC"); + bean.setDescrizione("MAILING_LIST_TOT_IND_BCC"); + bean.setFlgTipo(1L); + bean.setNota("NUMERO DI INDIRIZZI MAIL PER INVIO IN BCC NEL CASO CHE SI VOGLIA INVIARE N MESSAGGI INSIEME IN BCC NEGLI INVII MASSIVI."); + bean.save(); + bean.findByCodice("CC"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("CC"); + bean.setDescrizione("CC"); + bean.setFlgTipo(0L); + bean.setNota("Carbon copy"); + bean.save(); + bean.findByCodice("FROM"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("FROM"); + bean.setDescrizione("FROM"); + bean.setFlgTipo(0L); + bean.setNota("Email from"); + bean.save(); + bean.findByCodice("SMTP"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SMTP"); + bean.setDescrizione("SMTP"); + bean.setFlgTipo(0L); + bean.setNota("Server SMTP"); + bean.save(); + bean.findByCodice("SUBJECT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SUBJECT"); + bean.setDescrizione("SUBJECT"); + bean.setFlgTipo(0L); + bean.setNota("Oggetto standard in tutti gli invio di email"); + bean.save(); + bean.findByCodice("TO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("TO"); + bean.setDescrizione("TO"); + bean.setFlgTipo(0L); + bean.setNota("To quando non specificato in sendMailMessage"); + bean.save(); + bean.findByCodice("TO_TEST"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("TO_TEST"); + bean.setDescrizione("TO_TEST"); + bean.setFlgTipo(0L); + bean.setNota("TO DI TEST. SE IMPOSTATO VENGONO INGNORATI CC, BCC E TUTTO VIENTE INVIATO A TO_TEST"); + bean.save(); + bean.findByCodice("BCC"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("BCC"); + bean.setDescrizione("BCC"); + bean.setFlgTipo(0L); + bean.setNota("BLANK CARBON COPY"); + bean.save(); + bean.findByCodice("NO_REPLY"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("NO_REPLY"); + bean.setDescrizione("NO_REPLY"); + bean.setFlgTipo(0L); + bean.setNota("INDIRIZZO A CUI INVIARE E DA CUI INVIARE LE MAIL DI NEWSLETTER"); + bean.save(); + bean.findByCodice("SMTP_USER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SMTP_USER"); + bean.setDescrizione("SMTP_USER"); + bean.setFlgTipo(0L); + bean.setNota("UTENTE PER AUTENTICAZIONE SMTP"); + bean.save(); + bean.findByCodice("SMTP_PASSWORD"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SMTP_PASSWORD"); + bean.setDescrizione("SMTP_PASSWORD"); + bean.setFlgTipo(0L); + bean.setNota("PASSWORD PER AUTENTICAZIONE SMTP"); + bean.save(); + bean.findByCodice("SMTP_PORT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SMTP_PORT"); + bean.setDescrizione("SMTP_PORT"); + bean.setFlgTipo(1L); + bean.setNota("PORTA SMTP. DEFAULT: 25"); + bean.save(); + bean.findByCodice("SMTP_USE_AUTH"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SMTP_USE_AUTH"); + bean.setDescrizione("SMTP_USE_AUTH"); + bean.setFlgTipo(5L); + bean.setNota("ABILITA SMTP AUTH"); + bean.save(); + bean.findByCodice("SMTP_STARTTLS"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("SMTP_STARTTLS"); + bean.setDescrizione("SMTP_STARTTLS"); + bean.setFlgTipo(5L); + bean.setNota("ABILITA SMTP STARTTLS"); + bean.save(); + l_tipoParm = "MAILER SERVLET"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("MAIL_MSG_PATH_MAILER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIL_MSG_PATH_MAILER"); + bean.setDescrizione("MAIL_MSG_PATH_MAILER"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("mailMessage/"); + bean.setNota("PERCORSO RELATIVO A DOCBASE DOVE TROVO I FILE UTILIZZATI PER FORMATTARE IL MESSAGGIO (/ finale).
IL FILE VIENE INVIATO NELLA REQUEST. SE NON C'E', MANDA I PARAMETRI CHE TROVA"); + bean.save(); + bean.findByCodice("MAIL_TO_MAILER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIL_TO_MAILER"); + bean.setDescrizione("MAIL_TO_MAILER"); + bean.setFlgTipo(0L); + bean.setNota("INDIRIZZO EMAIL DESTINAZIONE DEL MAILER SE NON VIENE DEFINITO mailTo SUL FORM PER L'INVIO DELLA MAIL.
POTREBBE ANCHE ESSERE DEFINITO COME PARAMETRO SULLA REQUEST. IN QUEL CASO CONTIENTE IL CODICE PARM DOVE E' IMPOSTATA LA MAIL_TO
ES.: MAIL_TO_MAILER NELA REQUEST E'=MAIL_PRODOTTI. NELLA TABELLA PARM MAIL_PRODOTTIE'= PIPPO@ACXENT.COM"); + bean.save(); + bean.findByCodice("MAIL_BCC_MAILER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIL_BCC_MAILER"); + bean.setDescrizione("MAIL_BCC_MAILER"); + bean.setFlgTipo(0L); + bean.setNota("INDIRIZZO EMAIL DESTINAZIONE BCC DEL MAILER. SE NON DEFINITO VIENE UTILIZZATO IL PARAMETRO BCC"); + bean.save(); + bean.findByCodice("MAIL_FROM_MAILER"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIL_FROM_MAILER"); + bean.setDescrizione("MAIL_FROM_MAILER"); + bean.setFlgTipo(0L); + bean.setNota("INDIRIZZO EMAIL FROM DEL MAILER SE NON VIENE DEFINITO mailFrom SUL FORM PER L'INVIO DELLA MAIL"); + bean.save(); + bean.findByCodice("MAIL_BLACKLIST_AUTO_FILL"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIL_BLACKLIST_AUTO_FILL"); + bean.setDescrizione("MAIL_BLACKLIST_AUTO_FILL"); + bean.setFlgTipo(5L); + bean.setNota("CARICA IN BLACKLIST AUTOMATICAMENTE UN IP SE QUESTO SUPERA MAIL_BLACKLIST_MAX_COUNT INVII AL MINUTO. ATTIVATO AUTOMATICAMENTE SE MAIL_BLACKLIST_AUTO_ENABLE=TRUE "); + bean.save(); + bean.findByCodice("MAIL_BLACKLIST_AUTO_ENABLE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIL_BLACKLIST_AUTO_ENABLE"); + bean.setDescrizione("MAIL_BLACKLIST_AUTO_ENABLE"); + bean.setFlgTipo(5L); + bean.setNota("ATTIVA AUTOMATICAMENTE GLI IP APPENA MESSI IN BLACKLIST."); + bean.save(); + bean.findByCodice("MAIL_BLACKLIST_MAX_COUNT"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MAIL_BLACKLIST_MAX_COUNT"); + bean.setDescrizione("MAIL_BLACKLIST_MAX_COUNT"); + bean.setFlgTipo(1L); + if (bean.getNumero() <= 0.0D) + bean.setNumero(3.0D); + bean.setNota("NUMERO DI INVII AL MINUTO DI MAILER PER ENTRARE AUTOMATICAMENTE IN BLACKLIST"); + bean.save(); + l_tipoParm = "DOCUMENTI"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("LOGO_DOCS"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LOGO_DOCS"); + bean.setDescrizione("LOGO_DOCS"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_img/logo/logo.jpg"); + bean.setNota("Percorso relativo rispetto a docbase del logo per le stampe dei documenti"); + bean.save(); + bean.findByCodice("LOGO_DOCS_ALTERNATIVO"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LOGO_DOCS_ALTERNATIVO"); + bean.setDescrizione("LOGO_DOCS_ALTERNATIVO"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("_img/logo/logo.jpg"); + bean.setNota("Percorso relativo rispetto a docbase del logo alternativo per le stampe dei documenti"); + bean.save(); + bean.findByCodice("LOGO_DOCS_W"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LOGO_DOCS_W"); + bean.setDescrizione("LOGO_DOCS_W"); + bean.setFlgTipo(1L); + bean.setNota("Larghezza logo per le stampe documenti. Se 0 non viene impostata."); + bean.save(); + bean.findByCodice("LOGO_DOCS_H"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("LOGO_DOCS_H"); + bean.setDescrizione("LOGO_DOCS_H"); + bean.setFlgTipo(1L); + bean.setNota("Altezza logo per le stampe documenti. Se 0 non viene impostata."); + bean.save(); + l_tipoParm = "RECEIVE FILES"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("RECEIVE_FILE_SERVLET"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("RECEIVE_FILE_SERVLET"); + bean.setDescrizione("RECEIVE_FILE_SERVLET"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("http://serverremoto/fe4/ReceiveFile.abl"); + bean.setNota("Servlet per la ricezione file.
Es.: http://127.0.0.1:8080/fe4/ReceiveFile.abl"); + bean.save(); + l_tipoParm = "DATE BLOCCO APP."; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("BLOCK_DATA_OFF"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("BLOCK_DATA_OFF"); + bean.setDescrizione("BLOCK_DATA_OFF"); + bean.setFlgTipo(2L); + bean.setNota("DATA FINE BLOCCO. SE NULLA IL BLOCCO NON HA MAI FINE"); + bean.save(); + bean.findByCodice("BLOCK_DATA_ON"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("BLOCK_DATA_ON"); + bean.setDescrizione("BLOCK_DATA_ON"); + bean.setFlgTipo(2L); + bean.setNota("DATA INIZIO BLOCCO. SE NULLA IL BLOCCO NON AVVIENE MAI"); + bean.save(); + bean.findByCodice("BLOCK_DATA_TEXT"); + bean.setFlgAdmin(0L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("BLOCK_DATA_TEXT"); + bean.setDescrizione("BLOCK_DATA_TEXT"); + bean.setFlgTipo(0L); + bean.setNota("TESTO OPZIONALE CHE APPARE SE LA DATA E' TRA INIZIO E FINE BLOCCO"); + bean.save(); + l_tipoParm = "REWRITE URL "; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("REWRITE_URL_ENABLE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("REWRITE_URL_ENABLE"); + bean.setDescrizione("REWRITE_URL_ENABLE"); + bean.setFlgTipo(5L); + bean.setNota("ABILITA IL REWRITE URL."); + bean.save(); + bean.findByCodice("REWRITE_URL_LANG"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("REWRITE_URL_LANG"); + bean.setDescrizione("REWRITE_URL_LANG"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("it,en"); + bean.setNota("LINGUE ABILITATE PER IL REWRITE URL. SE COME ULTIMO PARAMETRO DELL'URL, MI INDICA LA LINGUA DA UTILIZZARE"); + bean.save(); + bean.findByCodice("REWRITE_URL_RULES"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("REWRITE_URL_RULES"); + bean.setDescrizione("REWRITE_URL_RULES"); + bean.setFlgTipo(0L); + bean.setNota("esempio di rewrite url
xxxxxcxxxx-xxx-xx-xx-xx_cod-parms-lang.html
oppure
xxxxxxxx-xxx-xx-x-xxxx-x_cod-parms.html
oppure
desc1+desc2+desxn+cod-parms.html o desc1+desc2+desxn+cod-parms-lang.html
In questo caso il codice e' l'elemento prima del primo -
il codice mi serve ad individuare la regola
cod,servlet,cmd,act,parmsRule

parms sono del tipo
630-44-434-ad3334
e sono tutti codici o chiavi di ricerca
metre parmsRule indica per ogni chiave che trovo, il campo
corrispondente da passare
nel seguente formato
@id_articolo@id_marca@id_famiglia@id_sottoFamiglia
nel caso di parametri fissi, il formato è del tipo @test=olina e nella creazione dell'url va ignorata
esempio di url
ARCHIVIO%20FOTO-Angolini_01-630-44-434-ad3334-it.html
LIGHTING+&+STUDIO+Flash+Off-Camera+articoli-323-0--1-15.html
ARCHIVIO%20FOTO-Angolini_01-630-44-434-ad3334.html

esempio di regola (CAMPO PARM RW_URL_RULES)
01,Catalogo.abl,search,,@id_articolo@id_marca@id_famiglia@id_sottoFamiglia

ho bisogno anche di un elenco di lang che supporto. Se finiscono
con uno di quei lang è la lingua, altrimenti è un parametro
(CAMPO PARM RW_URL_LANG)it,en,de,fr
(CAMPO PARM RW_URL_ENABLE)
Ovviamente, se si usa apache, ci vuole il mapping su .html"); + bean.save(); + bean.findByCodice("REWRITE_URL_FILE_PATH"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("REWRITE_URL_FILE_PATH"); + bean.setDescrizione("REWRITE_URL_FILE_PATH"); + bean.setFlgTipo(0L); + if (bean.getTesto().isEmpty()) + bean.setTesto("/admin/_alterTable/"); + bean.setNota("PATH ASSOLUTO DELLA ALTERTABLE NEL QUALE SALVARE IL FILE rewrite.txt"); + bean.save(); + l_tipoParm = "MENU"; + StatusMsg.updateMsgByTag(ap, "INIT", l_tipoParm); + bean.findByCodice("MNU_ENABLE"); + bean.setFlgAdmin(1L); + bean.setTipoParm(l_tipoParm); + bean.setCodice("MNU_ENABLE"); + bean.setDescrizione("MNU_ENABLE"); + bean.setFlgTipo(5L); + bean.setNota("ABILITA O MENO IL CONTROLLO SUI PARAMETRI MNU.
SERVE A GESTIRE I MENU IN BASE ALLE VERSIONI INSTALLATE"); + bean.save(); + _AblRestAdapter.initApplicationParms(ap); + StatusMsg.deleteMsgByTag(ap, "INIT"); + } + } catch (Exception e) { + logDebug(debug, "initMainParms: errore!!!: "); + e.printStackTrace(); + throw e; + } + logDebug(debug, "initMainParms:fine"); + } + + public Parm() {} + + public Parm(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public void findByCodice(String l_codice) { + String s_Sql_Find = "select A.* from PARM AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice='" + l_codice + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug("Parm.findByCodice():" + e.getMessage()); + } + } + + public Vectumerator findByCR(ParmCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from PARM AS A"; + String s_Sql_Order = " ORDER BY codice"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = prepareSqlLikeString(st.nextToken(), getApFull().getDbType()); + txt.append("(A.codice like '%" + token + "%' or A.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (!CR.getTipoParm().isEmpty()) + wc.addWc("A.tipoParm='" + CR.getTipoParm() + "'"); + if (CR.getId_user() != 1L) { + wc.addWc("(A.flgAdmin is null or flgAdmin=0)"); + } else if (CR.getFlgAdmin() == 0L) { + wc.addWc("(A.flgAdmin is null or flgAdmin=0)"); + } else if (CR.getFlgAdmin() > 0L) { + wc.addWc("A.flgAdmin=" + CR.getFlgAdmin()); + } + if (CR.getFlgTipo() == 0L) { + wc.addWc("(A.flgTipo is null or flgTipo=0)"); + } else if (CR.getFlgTipo() > 0L) { + wc.addWc("A.flgTipo=" + CR.getFlgTipo()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findTipiParm() { + String s_Sql_Find = "select distinct A.tipoParm from PARM AS A"; + String s_Sql_OrderBy = " order by A.tipoParm"; + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getCodice() { + return (this.codice == null) ? "" : this.codice.toUpperCase().trim(); + } + + public String getColoreHex() { + return (this.coloreHex == null) ? "" : this.coloreHex; + } + + public Date getDataParm() { + return this.dataParm; + } + + public String getDataParmString() { + return getDataFormat().format(this.dataParm); + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public long getFlgAdmin() { + return this.flgAdmin; + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public long getId_parm() { + return this.id_parm; + } + + public String getNota() { + return (this.nota == null) ? "" : this.nota; + } + + public String getNota(int len) { + if (getNota().length() < len) + return getNota(); + return getNota().substring(1, len); + } + + public double getNumero() { + return this.numero; + } + + public double getNumeroDouble() { + return this.numero; + } + + public float getNumeroFloat() { + return (float)this.numero; + } + + public int getNumeroInt() { + return (int)this.numero; + } + + public long getNumeroLong() { + return (long)this.numero; + } + + public Time getOra() { + return this.ora; + } + + public String getOraS() { + return (this.ora == null) ? "" : this.ora.toString(); + } + + public String getTesto() { + return (this.testo == null) ? "" : this.testo.trim(); + } + + public String getTesto(int len) { + if (getTesto().length() < len) + return getTesto(); + return getTesto().substring(0, len) + "..."; + } + + public String getTesto4String() { + if (getTesto().isEmpty()) + return getTesto(); + String temp = getTesto(); + StringBuffer res = new StringBuffer(); + for (int i = 0; i < temp.length() - 1; i++) { + if (temp.charAt(i) == '\\') { + switch (temp.charAt(i + 1)) { + case 'n': + res.append('\n'); + break; + case 't': + res.append('\t'); + break; + case '\\': + res.append('\\'); + break; + default: + res.append('\\'); + res.append(temp.charAt(i + 1)); + break; + } + i++; + } else { + res.append(temp.charAt(i)); + } + } + res.append(temp.charAt(temp.length() - 1)); + return res.toString(); + } + + public String getTipo() { + if (getFlgTipo() == 0L) + return "Txt "; + if (getFlgTipo() == 1L) + return "Num. "; + if (getFlgTipo() == 2L) + return "Date "; + if (getFlgTipo() == 3L) + return "Time "; + if (getFlgTipo() == 4L) + return "Col. "; + if (getFlgTipo() == 5L) + return "Bool "; + if (getFlgTipo() == 6L) + return "Timestamp "; + return "??"; + } + + public String getTipoParm() { + return (this.tipoParm == null) ? "" : this.tipoParm; + } + + public String getTipoParmNew() { + return (this.tipoParmNew == null) ? "" : this.tipoParmNew; + } + + public String getValore() { + if (getFlgTipo() == 0L) + return getTesto(25); + if (getFlgTipo() == 1L) + return getNf().format(getNumero()); + if (getFlgTipo() == 2L) + return getDataFormat().format(getDataParm()); + if (getFlgTipo() == 3L) + return getOraS(); + if (getFlgTipo() == 4L) + return getColoreHex(); + if (getFlgTipo() == 6L) + return getTimeStampValue(); + if (getFlgTipo() == 5L) + return (getNumero() == 1.0D) ? "true" : "false"; + return "??"; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + if (!getTipoParmNew().isEmpty()) + setTipoParm(getTipoParmNew()); + if (getCodice().isEmpty()) + setCodice(String.valueOf(getId_parm())); + super.prepareSave(ps); + } + + public void setCodice(String codice) { + this.codice = codice; + } + + public void setColor(Color color) { + this.color = color; + } + + public void setColoreHex(String coloreHex) { + this.coloreHex = coloreHex; + } + + public void setDataParm(Date newData) { + this.dataParm = newData; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setFlgAdmin(long flgAdmin) { + this.flgAdmin = flgAdmin; + } + + public void setFlgTipo(long flgTipo) { + this.flgTipo = flgTipo; + } + + public void setId_parm(long newId_parm) { + this.id_parm = newId_parm; + } + + public void setNota(String nota) { + this.nota = nota; + } + + public void setNumero(double newNumero) { + this.numero = newNumero; + } + + public void setOra(Time newOra) { + this.ora = newOra; + } + + public void setTesto(String newTesto) { + this.testo = newTesto; + } + + public void setTipoParm(String tipoParm) { + this.tipoParm = tipoParm; + } + + public void setTipoParmNew(String tipoParmNew) { + this.tipoParmNew = tipoParmNew; + } + + protected boolean useNullFor0() { + return false; + } + + public SimpleDateFormat getDataFormat() { + if (this.df == null) { + Parm bean = getApFull().getParm("DATA_FORMAT"); + if (bean.getTesto().isEmpty()) { + this.df = new SimpleDateFormat(SimpleDateFormat.ITALIAN_DF); + } else { + this.df = new SimpleDateFormat(bean.getTesto()); + } + } + return this.df; + } + + public SimpleDateFormat getDataFormatNoHT() { + if (this.df == null) { + Parm bean = getApFull().getParmNoHt("DATA_FORMAT"); + if (bean.getTesto().isEmpty()) { + this.df = new SimpleDateFormat("dd/MM/yyyy"); + } else { + this.df = new SimpleDateFormat(bean.getTesto()); + } + } + return this.df; + } + + public String getValoreNoHT() { + if (getFlgTipo() == 0L) + return getTesto(25); + if (getFlgTipo() == 1L) + return getNf().format(getNumero()); + if (getFlgTipo() == 2L) + return getDataFormatNoHT().format(getDataParm()); + if (getFlgTipo() == 3L) + return getOraS(); + if (getFlgTipo() == 4L) + return getColoreHex(); + if (getFlgTipo() == 5L) + return (getNumero() == 1.0D) ? "true" : "false"; + return "??"; + } + + public Color getColor() { + if (this.color == null) + this.color = getColorFromHex(getColoreHex()); + return this.color; + } + + public void appendAndSaveTesto(String newTesto) { + if (getDBState() == 1) { + setTesto(getTesto() + "\n" + getTesto()); + save(); + } + } + + public String getFontColoreHex() { + String BLACK = "000"; + if (getColoreHex().isEmpty()) + return "000"; + if (getColoreHex().startsWith("#")) + setColoreHex(getColoreHex().substring(1)); + if (getColoreHex().length() == 6) { + double r = (double)Integer.parseInt(getColoreHex().substring(0, 2), 16) / 255.0D; + double g = (double)Integer.parseInt(getColoreHex().substring(2, 4), 16) / 255.0D; + double b = (double)Integer.parseInt(getColoreHex().substring(4, 6), 16) / 255.0D; + double col = 0.213D * r + 0.715D * g + 0.072D * b; + String ret = "000"; + if (col < 0.5D) { + ret = "FFF"; + } else { + ret = "000"; + } + return ret; + } + return "000"; + } + + public ResParm svuotaCartellaTmp() { + ResParm rp = new ResParm(true); + String tmpDirName = getParm("DOCBASE").getTesto() + getParm("DOCBASE").getTesto(); + File tmpDir = new File(tmpDirName); + File[] tmpFiles = tmpDir.listFiles(); + int numFileCancellati = 0; + if (tmpFiles != null) + try { + for (File tmpFile2 : tmpFiles) { + File tmpFile = tmpFile2; + if (!tmpFile.getName().toLowerCase().endsWith("index.html")) { + numFileCancellati++; + tmpFile.delete(); + } + } + } catch (Exception e) { + e.printStackTrace(); + rp.setException(e); + } + rp.setMsg("Cartella temporanea " + tmpDirName + " cancellatei " + numFileCancellati + " files."); + return rp; + } + + public boolean isTrue() { + return (this.numero == 1.0D); + } + + public boolean isFalse() { + return !(this.numero == 1.0D); + } + + public static final ResParm sendTestMail(ApplParmFull ap) { + ResParm rp = new ResParm(true); + MailProperties mp = new MailProperties(); + String eMail = ap.getParm("TO").getTesto(); + mp.put("TO", eMail); + mp.setProperty("FROM", ap.getParm("FROM").getTesto()); + mp.put("SUBJECT", + ap.getParm("SUBJECT").getTesto() + " Test Message - " + ap.getParm("SUBJECT").getTesto()); + mp.setProperty("BCC", ""); + mp.setProperty("CC", ""); + mp.put("MSG", "This is a test message from webapp " + ap.getDatabase()); + try { + Parm bean = new Parm(ap); + bean.sendMailMessage(mp); + } catch (Exception e) { + e.printStackTrace(); + rp.setMsg(new Timestamp( + System.currentTimeMillis()).toString() + " SEND TEST MAIL ERROR TO " + new Timestamp(System.currentTimeMillis()).toString() + "\n" + eMail); + rp.setStatus(false); + } + return rp; + } + + public ResParm save() { + if (getTipoParm().isEmpty()); + return super.save(); + } + + public String getDbVersions() { + String s_Sql_Find = "select A.* from PARM AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice like'DB_VERSION%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = (Vectumerator)findRows(stmt); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + Parm row = vec.nextElement(); + if (!row.getTesto().isEmpty()) { + sb.append(row.getTesto()); + if (vec.hasMoreElements()) + sb.append(" "); + } + } + return sb.toString(); + } catch (SQLException e) { + removeCPConnection(); + handleDebug("Parm.getDbVersions():" + e.getMessage()); + return "getDbVersions error!"; + } + } + + public String getLibVersions() { + String s_Sql_Find = "select A.* from PARM AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice like'LIB_VERSION%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = (Vectumerator)findRows(stmt); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + Parm row = vec.nextElement(); + if (!row.getTesto().isEmpty()) { + sb.append(row.getTesto()); + if (vec.hasMoreElements()) + sb.append(" "); + } + } + return sb.toString(); + } catch (SQLException e) { + removeCPConnection(); + handleDebug("Parm.getDbVersions():" + e.getMessage()); + return "getDbVersions error!"; + } + } + + public String getDbVersionsLte() { + String s_Sql_Find = "select A.* from PARM AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice like'DB_VERSION%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = (Vectumerator)findRows(stmt); + StringBuilder sb = new StringBuilder(); + sb.append("
  • "); + sb.append(getApFull().getDatabase()); + sb.append("
  • "); + while (vec.hasMoreElements()) { + Parm row = vec.nextElement(); + if (!row.getTesto().isEmpty()) { + sb.append("
  • "); + sb.append(row.getTesto()); + sb.append("
  • "); + if (vec.hasMoreElements()) + sb.append("\n"); + } + } + return sb.toString(); + } catch (SQLException e) { + removeCPConnection(); + handleDebug("Parm.getDbVersions():" + e.getMessage()); + return "
  • getDbVersionsHtml error!
  • "; + } + } + + public String getDbVersionsLte4() { + String s_Sql_Find = "select A.* from PARM AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice like'DB_VERSION%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = (Vectumerator)findRows(stmt); + StringBuilder sb = new StringBuilder(); + sb.append("
  • "); + sb.append(" "); + sb.append(getApFull().getDatabase()); + sb.append("
  • "); + while (vec.hasMoreElements()) { + Parm row = vec.nextElement(); + if (!row.getTesto().isEmpty()) { + sb.append("
  • "); + sb.append(" "); + sb.append(row.getTesto()); + sb.append("
  • "); + if (vec.hasMoreElements()) + sb.append("\n"); + } + } + return sb.toString(); + } catch (SQLException e) { + removeCPConnection(); + handleDebug("Parm.getDbVersions():" + e.getMessage()); + return "
  • getDbVersionsHtml error!
  • "; + } + } + + public String getLibVersionsLte() { + String s_Sql_Find = "select A.* from PARM AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice like'LIB_VERSION%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = (Vectumerator)findRows(stmt); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + Parm row = vec.nextElement(); + if (!row.getTesto().isEmpty()) { + sb.append("
  • "); + sb.append(row.getTesto()); + sb.append("
  • "); + if (vec.hasMoreElements()) + sb.append("\n"); + } + } + return sb.toString(); + } catch (SQLException e) { + removeCPConnection(); + handleDebug("Parm.getDbVersions():" + e.getMessage()); + return "
  • getDbVersionsHtml error!
  • "; + } + } + + public String getLibVersionsLte4() { + String s_Sql_Find = "select A.* from PARM AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice like'LIB_VERSION%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + Vectumerator vec = (Vectumerator)findRows(stmt); + StringBuilder sb = new StringBuilder(); + while (vec.hasMoreElements()) { + Parm row = vec.nextElement(); + if (!row.getTesto().isEmpty()) { + sb.append("
  • "); + sb.append(row.getTesto()); + sb.append("
  • "); + if (vec.hasMoreElements()) + sb.append("\n"); + } + } + return sb.toString(); + } catch (SQLException e) { + removeCPConnection(); + handleDebug("Parm.getDbVersions():" + e.getMessage()); + return "
  • getLibVersionsLte4 error!
  • "; + } + } + + public String getLibVersionsLte4(String app) { + String s_Sql_Find = "select A.* from PARM AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice ='LIB_VERSION_" + app + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + return getTesto(); + } catch (SQLException e) { + removeCPConnection(); + handleDebug("Parm.getDbVersions(app):" + e.getMessage()); + return "getLibVersionsLte4(app) error!"; + } + } + + public Timestamp getTimeStamp() { + return this.timeStamp; + } + + public String getTimeStampValue() { + return (this.timeStamp == null) ? "" : getTimeStamp().toString(); + } + + public void setTimeStamp(Timestamp timeStamp) { + this.timeStamp = timeStamp; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/ParmCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/ParmCR.java new file mode 100644 index 00000000..dbd0f093 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/ParmCR.java @@ -0,0 +1,73 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ParmCR extends CRAdapter { + private String tipoParm; + + private long id_userProfile; + + private long id_user; + + public ParmCR() {} + + public ParmCR(ApplParmFull newAp) { + setApFull(newAp); + } + + public String getTipoParm() { + return (this.tipoParm == null) ? "" : + this.tipoParm; + } + + public void setTipoParm(String newTxtRicerca) { + this.tipoParm = newTxtRicerca; + } + + private long flgAdmin = -1L; + + private long flgTipo = -1L; + + private long id_parm; + + public long getId_user() { + return this.id_user; + } + + public void setId_user(long id_user) { + this.id_user = id_user; + } + + public long getId_userProfile() { + return this.id_userProfile; + } + + public void setId_userProfile(long id_userProfile) { + this.id_userProfile = id_userProfile; + } + + public long getFlgAdmin() { + return this.flgAdmin; + } + + public void setFlgAdmin(long flgAdmin) { + this.flgAdmin = flgAdmin; + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public void setFlgTipo(long flgTipo) { + this.flgTipo = flgTipo; + } + + public long getId_parm() { + return this.id_parm; + } + + public void setId_parm(long id_parm) { + this.id_parm = id_parm; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/PdfWatermarkEvent.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/PdfWatermarkEvent.java new file mode 100644 index 00000000..e8619c37 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/PdfWatermarkEvent.java @@ -0,0 +1,113 @@ +package it.acxent.common; + +import com.lowagie.text.Document; +import com.lowagie.text.Image; +import com.lowagie.text.PageSize; +import com.lowagie.text.Paragraph; +import com.lowagie.text.Rectangle; +import com.lowagie.text.pdf.PdfContentByte; +import com.lowagie.text.pdf.PdfPageEvent; +import com.lowagie.text.pdf.PdfWriter; +import java.awt.Color; + +public class PdfWatermarkEvent implements PdfPageEvent { + private String wmFileName; + + public PdfWatermarkEvent(String wmFileName, boolean printMiddleDash, Rectangle l_pageSize) { + this.wmFileName = wmFileName; + this.printMiddleDash = printMiddleDash; + setPageSize(this.pageSize); + } + + public PdfWatermarkEvent(String wmFileName, boolean printMiddleDash) { + this.wmFileName = wmFileName; + this.printMiddleDash = printMiddleDash; + } + + public void onChapter(PdfWriter arg0, Document arg1, float arg2, Paragraph arg3) {} + + public void onChapterEnd(PdfWriter arg0, Document arg1, float arg2) {} + + public void onCloseDocument(PdfWriter arg0, Document arg1) {} + + public void onEndPage(PdfWriter arg0, Document arg1) {} + + public void onGenericTag(PdfWriter arg0, Document arg1, Rectangle arg2, String arg3) {} + + public void onOpenDocument(PdfWriter arg0, Document arg1) {} + + public void onParagraph(PdfWriter arg0, Document arg1, float arg2) {} + + public void onParagraphEnd(PdfWriter arg0, Document arg1, float arg2) {} + + public void onSection(PdfWriter arg0, Document arg1, float arg2, int arg3, Paragraph arg4) {} + + public void onSectionEnd(PdfWriter arg0, Document arg1, float arg2) {} + + public void onStartPage(PdfWriter writer, Document arg1) { + if (isPrintMiddleDash()) { + float middleY = getPageSize().getHeight() / 2.0F; + PdfContentByte cb = writer.getDirectContent(); + cb.moveTo(0.0F, middleY); + cb.setLineDash(5.0F, 5.0F, 10.0F); + cb.setLineWidth(0.5F); + cb.setColorStroke(Color.gray); + cb.lineTo(getPageSize().getWidth(), middleY); + cb.stroke(); + } + if (!getWmFileName().isEmpty()) { + PdfContentByte cb = writer.getDirectContent(); + try { + Image wmImage = Image.getInstance(getWmFileName()); + wmImage.setRotationDegrees(45.0F); + wmImage.scaleToFit( + wmImage.getHeight() * 30.0F / wmImage.getHeight(), 30.0F); + float newH = 30.0F; + float newW = wmImage.getHeight() * newH / wmImage.getHeight(); + int nCol = 3; + int nRow = 6; + float xStep = (getPageSize().getWidth() - 2.0F * newW) / (float)nCol; + float yStep = (getPageSize().getHeight() - 2.0F * newH) / (float)nRow; + for (int i = 0; i < nCol; i++) { + for (int j = 0; j < nRow; j++) { + float x = (float)((double)i + 0.5D) * xStep; + float y = (float)((double)j + 0.5D) * yStep; + wmImage.setAbsolutePosition(x, y); + cb.addImage(wmImage); + } + } + cb.stroke(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + private boolean printMiddleDash = false; + + private Rectangle pageSize; + + public String getWmFileName() { + return (this.wmFileName == null) ? "" : this.wmFileName; + } + + public void setWmFileName(String wmFileName) { + this.wmFileName = wmFileName; + } + + public boolean isPrintMiddleDash() { + return this.printMiddleDash; + } + + public void setPrintMiddleDash(boolean printMiddleDash) { + this.printMiddleDash = printMiddleDash; + } + + public Rectangle getPageSize() { + return (this.pageSize == null) ? PageSize.A4 : this.pageSize; + } + + public void setPageSize(Rectangle pageSize) { + this.pageSize = pageSize; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Postazione.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Postazione.java new file mode 100644 index 00000000..5a28ee29 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Postazione.java @@ -0,0 +1,202 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Postazione extends DBAdapter implements PostazioneI, Serializable { + private static final long serialVersionUID = -8782732844262606524L; + + private long id_postazione; + + private String descrizione; + + private String ipAddress; + + private String stampanteA4; + + private String stampanteEtichette; + + private String endpointFirma; + + private String hostname; + + private long id_tipoPostazione; + + private TipoPostazione tipoPostazione; + + public Postazione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Postazione() {} + + public void setId_postazione(long newId_postazione) { + this.id_postazione = newId_postazione; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setIpAddress(String newIpAddress) { + this.ipAddress = newIpAddress; + } + + public void setStampanteA4(String newStampanteLaser) { + this.stampanteA4 = newStampanteLaser; + } + + public void setStampanteEtichette(String newStampanteEtichette) { + this.stampanteEtichette = newStampanteEtichette; + } + + public long getId_postazione() { + return this.id_postazione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getIpAddress() { + return (this.ipAddress == null) ? "" : this.ipAddress.trim(); + } + + public String getStampanteA4() { + return (this.stampanteA4 == null) ? "" : this.stampanteA4.trim(); + } + + public String getStampanteEtichette() { + return (this.stampanteEtichette == null) ? "" : this.stampanteEtichette.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(PostazioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from POSTAZIONE AS A"; + String s_Sql_Order = " order By A.descrizione"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + public void findByIp(String l_ip) { + String s_Sql_Find = "select A.* from POSTAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.ipAddress='" + l_ip + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public void findByHostname(String l_hostname) { + String s_Sql_Find = "select A.* from POSTAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.hostname='" + l_hostname + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getStampanteA4Script() { + return getStampanteA4().replaceAll("\\\\", "\\\\\\\\"); + } + + public String getStampanteEtichetteScript() { + return getStampanteEtichette().replaceAll("\\\\", "\\\\\\\\"); + } + + public String getHostname() { + return (this.hostname == null) ? "" : this.hostname.trim(); + } + + public void setHostname(String hostname) { + this.hostname = hostname; + } + + public String getEndpointFirma() { + return (this.endpointFirma == null) ? "" : this.endpointFirma.trim(); + } + + public void setEndpointFirma(String endpointFirma) { + this.endpointFirma = endpointFirma; + } + + public long getId_tipoPostazione() { + return this.id_tipoPostazione; + } + + public void setId_tipoPostazione(long id_tipoPostazione) { + this.id_tipoPostazione = id_tipoPostazione; + setTipoPostazione(null); + } + + public TipoPostazione getTipoPostazione() { + this.tipoPostazione = (TipoPostazione)getSecondaryObject((DBAdapter)this.tipoPostazione, TipoPostazione.class, getId_tipoPostazione()); + return this.tipoPostazione; + } + + public void setTipoPostazione(TipoPostazione tipoPostazione) { + this.tipoPostazione = tipoPostazione; + } + + public String getDescrizioneLogon() { + StringBuilder sb = new StringBuilder("Descrizione: "); + sb.append(getDescrizione()); + sb.append("
    Indirizzo IP: "); + sb.append(getIpAddress()); + if (!getHostname().isEmpty()) { + sb.append("
    Hostname: "); + sb.append(getHostname()); + } + if (!getStampanteA4().isEmpty()) { + sb.append("
    Stampante A4: "); + sb.append(getStampanteA4()); + } + if (!getStampanteEtichette().isEmpty()) { + sb.append("
    Stampante Etichetyte: "); + sb.append(getStampanteEtichette()); + } + if (!getEndpointFirma().isEmpty()) { + sb.append("
    Endpoint Firma: "); + sb.append(getEndpointFirma()); + } + return sb.toString(); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/PostazioneCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/PostazioneCR.java new file mode 100644 index 00000000..db188493 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/PostazioneCR.java @@ -0,0 +1,100 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; + +public class PostazioneCR extends CRAdapter { + private static final long serialVersionUID = -4627724827847959132L; + + private long id_postazione; + + private String descrizione; + + private String ipAddress; + + private String stampanteLaser; + + private String stampanteEtichette; + + private TipoPostazione tipoPostazione; + + private long id_tipoPostazione; + + private String hostname; + + public PostazioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public PostazioneCR() {} + + public void setId_postazione(long newId_postazione) { + this.id_postazione = newId_postazione; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setIpAddress(String newIpAddress) { + this.ipAddress = newIpAddress; + } + + public void setStampanteLaser(String newStampanteLaser) { + this.stampanteLaser = newStampanteLaser; + } + + public void setStampanteEtichette(String newStampanteEtichette) { + this.stampanteEtichette = newStampanteEtichette; + } + + public long getId_postazione() { + return this.id_postazione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : + this.descrizione.trim(); + } + + public String getIpAddress() { + return (this.ipAddress == null) ? "" : this.ipAddress.trim(); + } + + public String getStampanteLaser() { + return (this.stampanteLaser == null) ? "" : + this.stampanteLaser.trim(); + } + + public String getStampanteEtichette() { + return (this.stampanteEtichette == null) ? "" : + this.stampanteEtichette.trim(); + } + + public TipoPostazione getTipoPostazione() { + this.tipoPostazione = (TipoPostazione)getSecondaryObject((DBAdapter)this.tipoPostazione, TipoPostazione.class, getId_tipoPostazione()); + return this.tipoPostazione; + } + + public void setTipoPostazione(TipoPostazione tipoPostazione) { + this.tipoPostazione = tipoPostazione; + } + + public long getId_tipoPostazione() { + return this.id_tipoPostazione; + } + + public void setId_tipoPostazione(long id_tipoPostazione) { + this.id_tipoPostazione = id_tipoPostazione; + setTipoPostazione(null); + } + + public String getHostname() { + return (this.hostname == null) ? AB_EMPTY_STRING : this.hostname.trim(); + } + + public void setHostname(String hostname) { + this.hostname = hostname; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/PostazioneI.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/PostazioneI.java new file mode 100644 index 00000000..bcaecd27 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/PostazioneI.java @@ -0,0 +1,43 @@ +package it.acxent.common; + +import it.acxent.util.Vectumerator; + +public interface PostazioneI { + void setId_postazione(long paramLong); + + void setDescrizione(String paramString); + + void setIpAddress(String paramString); + + void setStampanteA4(String paramString); + + void setStampanteEtichette(String paramString); + + long getId_postazione(); + + long getId_tipoPostazione(); + + TipoPostazione getTipoPostazione(); + + String getDescrizione(); + + String getIpAddress(); + + String getStampanteA4(); + + String getStampanteEtichette(); + + Vectumerator findByCR(PostazioneCR paramPostazioneCR, int paramInt1, int paramInt2); + + void findByIp(String paramString); + + void findByHostname(String paramString); + + String getStampanteA4Script(); + + String getStampanteEtichetteScript(); + + String getEndpointFirma(); + + String getDescrizioneLogon(); +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/SimboliLavaggio.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/SimboliLavaggio.java new file mode 100644 index 00000000..74383a5a --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/SimboliLavaggio.java @@ -0,0 +1,279 @@ +package it.acxent.common; + +import it.acxent.util.Vectumerator; +import java.util.Enumeration; +import java.util.Hashtable; + +public class SimboliLavaggio { + private long lavaggio; + + private long candeggio; + + private long stiratura; + + private long pulituraSecco; + + private long asciugatura; + + private long asciugaturaNaturale; + + private static Hashtable dbSimboli; + + public static final int NESSUN_SIMBOLO = 0; + + public static final int LAVAGGIO_NO = 101; + + public static final int LAVAGGIO_A_MANO = 102; + + public static final int LAVAGGIO_DELICATO_MAX_30_1 = 103; + + public static final int LAVAGGIO_DELICATO_MAX_30_2 = 104; + + public static final int LAVAGGIO_DELICATO_MAX_30_3 = 105; + + public static final int LAVAGGIO_DELICATO_MAX_40_1 = 106; + + public static final int LAVAGGIO_DELICATO_MAX_40_2 = 107; + + public static final int LAVAGGIO_DELICATO_MAX_40_3 = 108; + + public static final int LAVAGGIO_DELICATO_MAX_50_1 = 109; + + public static final int LAVAGGIO_DELICATO_MAX_50_2 = 110; + + public static final int LAVAGGIO_DELICATO_MAX_60_1 = 111; + + public static final int LAVAGGIO_DELICATO_MAX_60_2 = 112; + + public static final int LAVAGGIO_DELICATO_MAX_70_1 = 113; + + public static final int LAVAGGIO_DELICATO_MAX_95_1 = 114; + + public static final int LAVAGGIO_DELICATO_MAX_95_2 = 115; + + public static final int LAVAGGIO_ACQUA_PROFESSIONALE_1 = 601; + + public static final int LAVAGGIO_ACQUA_PROFESSIONALE_2 = 602; + + public static final int LAVAGGIO_ACQUA_PROFESSIONALE_3 = 603; + + public static final int CANDEGGIO_NO = 201; + + public static final int CANDEGGIO_CLORO_E_PERBORATO = 202; + + public static final int CANDEGGIO_SOLO_PERBORATO = 203; + + public static final int CANDEGGIO_CON_CLORO = 204; + + public static final int ASCIUGARE_NO = 301; + + public static final int ASCIUGARE_TEMP_INF_60 = 302; + + public static final int ASCIUGARE_ALTA_TEMP = 303; + + public static final int ASCIUGARE_SI = 304; + + public static final int ASCIUGARE_NATURALE_1 = 701; + + public static final int ASCIUGARE_NATURALE_2 = 702; + + public static final int ASCIUGARE_NATURALE_3 = 703; + + public static final int ASCIUGARE_NATURALE_4 = 704; + + public static final int ASCIUGARE_NATURALE_5 = 705; + + public static final int ASCIUGARE_NATURALE_6 = 706; + + public static final int STIRO_NO = 401; + + public static final int STIRO_BASSA_TEMP = 402; + + public static final int STIRO_MEDIA_TEMP = 403; + + public static final int STIRO_ALTA_TEMP = 404; + + public static final int PULITURA_NO = 501; + + public static final int PULITURA_TUTTI_I_SOLVENTI_1 = 502; + + public static final int PULITURA_TUTTI_I_SOLVENTI_IN_USO_A = 503; + + public static final int PULITURA_BENZIA_AVIO_E_R113 = 504; + + public static final int PULITURA_BENZIA_AVIO_E_R113_CON_LIMITI_TEMP_UMIDITA = 505; + + public static final int PULITURA_IDROC_E_TRIFLUORO_TRICLOROETANO = 506; + + public static final int PULITURA_IDROC_E_TRIFLUORO_TRICLOROETANO_CON_LIMITI = 507; + + private long lavaggioProfessionale; + + public SimboliLavaggio() { + getDbSimboli(); + } + + public SimboloLavaggio getAsciugatura() { + if (getDbSimboli().containsKey(new Long(this.asciugatura))) + return getDbSimboli().get(new Long(this.asciugatura)); + return new SimboloLavaggio(); + } + + public Vectumerator getAsciugature() { + return getSimboli(1, 3); + } + + public Vectumerator getCandeggi() { + return getSimboli(11, 12); + } + + public SimboloLavaggio getCandeggio() { + if (getDbSimboli().containsKey(new Long(this.candeggio))) + return getDbSimboli().get(new Long(this.candeggio)); + return new SimboloLavaggio(); + } + + private Hashtable getDbSimboli() { + if (dbSimboli == null) { + dbSimboli = new Hashtable<>(40); + dbSimboli.put(new Long(0L), new SimboloLavaggio(0, "Nessun Simbolo")); + dbSimboli.put(new Long(101L), new SimboloLavaggio(101, "Non Lavare")); + dbSimboli.put(new Long(102L), new SimboloLavaggio(102, "Lavare a mano")); + dbSimboli.put(new Long(103L), new SimboloLavaggio(103, "Lavaggio delicato max 30°")); + dbSimboli.put(new Long(104L), new SimboloLavaggio(104, "Lavaggio delicato max 30°")); + dbSimboli.put(new Long(105L), new SimboloLavaggio(105, "Lavaggio delicato max 30°")); + dbSimboli.put(new Long(106L), new SimboloLavaggio(106, "Lavaggio delicato max 40°")); + dbSimboli.put(new Long(107L), new SimboloLavaggio(107, "Lavaggio delicato max 40°")); + dbSimboli.put(new Long(108L), new SimboloLavaggio(108, "Lavaggio delicato max 40°")); + dbSimboli.put(new Long(109L), new SimboloLavaggio(109, "Lavaggio delicato max 50°")); + dbSimboli.put(new Long(110L), new SimboloLavaggio(110, "Lavaggio delicato max 50°")); + dbSimboli.put(new Long(111L), new SimboloLavaggio(111, "Lavaggio delicato max 60°")); + dbSimboli.put(new Long(112L), new SimboloLavaggio(112, "Lavaggio delicato max 60°")); + dbSimboli.put(new Long(113L), new SimboloLavaggio(113, "Lavaggio delicato max 70°")); + dbSimboli.put(new Long(114L), new SimboloLavaggio(114, "Lavaggio delicato max 95°")); + dbSimboli.put(new Long(115L), new SimboloLavaggio(115, "Lavaggio delicato max 95°")); + dbSimboli.put(new Long(201L), new SimboloLavaggio(201, "Non Candeggiabile")); + dbSimboli.put(new Long(202L), new SimboloLavaggio(202, "Ammesso candeggio cloro e perborato")); + dbSimboli.put(new Long(203L), new SimboloLavaggio(203, "Ammesso candeggio solo perborato")); + dbSimboli.put(new Long(204L), new SimboloLavaggio(204, "Ammesso candeggio con cloro")); + dbSimboli.put(new Long(301L), new SimboloLavaggio(301, "Non Asciugare")); + dbSimboli.put(new Long(302L), new SimboloLavaggio(302, "Temperatura inferiore a 60°")); + dbSimboli.put(new Long(303L), new SimboloLavaggio(303, "Alta Temperatura")); + dbSimboli.put(new Long(304L), new SimboloLavaggio(304, "Asciugare")); + dbSimboli.put(new Long(401L), new SimboloLavaggio(401, "Non stirare")); + dbSimboli.put(new Long(402L), new SimboloLavaggio(402, "Bassa Temperatura")); + dbSimboli.put(new Long(403L), new SimboloLavaggio(403, "Media Temperatura")); + dbSimboli.put(new Long(404L), new SimboloLavaggio(404, "Alta temperatura")); + dbSimboli.put(new Long(501L), new SimboloLavaggio(501, "Non pulire a secco")); + dbSimboli.put(new Long(502L), new SimboloLavaggio(502, "Tutti i solventi")); + dbSimboli.put(new Long(503L), new SimboloLavaggio(503, "Tutti i solventi in uso")); + dbSimboli.put(new Long(504L), new SimboloLavaggio(504, "Benzina Avio e R113")); + dbSimboli.put(new Long(505L), new SimboloLavaggio(505, "Benzina Avio e R113 nel rispetto dei limiti di temperatura e umidita'")); + dbSimboli.put(new Long(506L), new SimboloLavaggio(506, "Lavaggio con idrocarburi e trifluoro-tricloroetano")); + dbSimboli.put(new Long(507L), new SimboloLavaggio(507, "Lavaggio con idrocarburi e trifluoro-tricloroetano nel rispetto dei limiti di temperatura e umidita'")); + dbSimboli.put(new Long(601L), new SimboloLavaggio(601, "Lavaggio ad acqua professionale")); + dbSimboli.put(new Long(602L), new SimboloLavaggio(602, "Lavaggio ad acqua professionale")); + dbSimboli.put(new Long(603L), new SimboloLavaggio(603, "Lavaggio ad acqua professionale")); + dbSimboli.put(new Long(701L), new SimboloLavaggio(701, "Asciugatura Naturale")); + dbSimboli.put(new Long(702L), new SimboloLavaggio(702, "Asciugatura Naturale")); + dbSimboli.put(new Long(703L), new SimboloLavaggio(703, "Asciugatura Naturale")); + dbSimboli.put(new Long(704L), new SimboloLavaggio(704, "Asciugatura Naturale")); + dbSimboli.put(new Long(705L), new SimboloLavaggio(705, "Asciugatura Naturale")); + dbSimboli.put(new Long(706L), new SimboloLavaggio(706, "Asciugatura Naturale")); + } + return dbSimboli; + } + + public Vectumerator getLavaggi() { + return getSimboli(41, 49); + } + + public SimboloLavaggio getLavaggio() { + if (getDbSimboli().containsKey(new Long(this.lavaggio))) + return getDbSimboli().get(new Long(this.lavaggio)); + return new SimboloLavaggio(); + } + + public SimboloLavaggio getPulituraSecco() { + if (getDbSimboli().containsKey(new Long(this.pulituraSecco))) + return getDbSimboli().get(new Long(this.pulituraSecco)); + return new SimboloLavaggio(); + } + + public Vectumerator getPulitureSecco() { + return getSimboli(31, 34); + } + + private Vectumerator getSimboli(int start, int end) { + Vectumerator vec = new Vectumerator<>(); + for (int i = start; i <= end; i++) + vec.addElement(getDbSimboli().get(new Long((long)i))); + return vec; + } + + public SimboloLavaggio getStiratura() { + if (getDbSimboli().containsKey(new Long(this.stiratura))) + return getDbSimboli().get(new Long(this.stiratura)); + return new SimboloLavaggio(); + } + + public Vectumerator getStirature() { + return getSimboli(21, 24); + } + + public Vectumerator getTuttiSimboli() { + Vectumerator vec = new Vectumerator<>(); + Enumeration enu = getDbSimboli().elements(); + while (enu.hasMoreElements()) + vec.addElement(enu.nextElement()); + return vec; + } + + public void setAsciugatura(long newAsciugatura) { + this.asciugatura = newAsciugatura; + } + + public void setCandeggio(long newCandeggio) { + this.candeggio = newCandeggio; + } + + public void setLavaggio(long newLavaggio) { + this.lavaggio = newLavaggio; + } + + public void setPulituraSecco(long newPulituraSecco) { + this.pulituraSecco = newPulituraSecco; + } + + public void setStiratura(long newStiratura) { + this.stiratura = newStiratura; + } + + public long getAsciugaturaNaturale() { + return this.asciugaturaNaturale; + } + + public void setAsciugaturaNaturale(long asciugaturaNaturale) { + this.asciugaturaNaturale = asciugaturaNaturale; + } + + public long getLavaggioProfessionale() { + return this.lavaggioProfessionale; + } + + public void setLavaggioProfessionale(long lavaggioProfessionale) { + this.lavaggioProfessionale = lavaggioProfessionale; + } + + public boolean hasTuttiISimboli() { + if (this.candeggio == 0L || this.asciugatura == 0L || this.lavaggio == 0L || this.pulituraSecco == 0L || this.stiratura == 0L) + return false; + return true; + } + + public boolean hasAlmenoUnSimbolo() { + if (this.candeggio != 0L || this.asciugatura != 0L || this.lavaggio != 0L || this.pulituraSecco != 0L || this.stiratura != 0L) + return true; + return false; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/SimboloLavaggio.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/SimboloLavaggio.java new file mode 100644 index 00000000..4bfaa6ba --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/SimboloLavaggio.java @@ -0,0 +1,30 @@ +package it.acxent.common; + +public class SimboloLavaggio { + private int codiceSimbolo; + + private String descrizione; + + public SimboloLavaggio() {} + + public SimboloLavaggio(int codiceSimbolo, String descrizione) { + this.codiceSimbolo = codiceSimbolo; + this.descrizione = descrizione; + } + + public int getCodiceSimbolo() { + return this.codiceSimbolo; + } + + public String getDescrizione() { + return this.descrizione; + } + + public void setCodiceSimbolo(int newCodiceSimbolo) { + this.codiceSimbolo = newCodiceSimbolo; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/StatusMsg.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/StatusMsg.java new file mode 100644 index 00000000..a333ce04 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/StatusMsg.java @@ -0,0 +1,188 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import java.util.Hashtable; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.ConcurrentHashMap; + +public class StatusMsg extends DBAdapter { + private static final long serialVersionUID = -8904636781719831584L; + + private static final Map instancesByApCode = new ConcurrentHashMap<>(); + + private Hashtable tagMessageTable; + + private static final String DIV_CLOSE = ""; + + private static final String DIV_OPEN = "
    "; + + private static class Key { + private String tag; + + private String hostname; + + public Key(String tag, String hostname) { + this.tag = tag; + this.hostname = hostname; + } + + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + Key key = (Key)o; + return (Objects.equals(this.tag, key.tag) && Objects.equals(this.hostname, key.hostname)); + } + + public int hashCode() { + return Objects.hash(this.tag, this.hostname); + } + + public String toString() { + return this.tag.trim() + " (" + this.tag.trim() + ")"; + } + } + + private StatusMsg() { + this.tagMessageTable = new Hashtable<>(); + } + + private StatusMsg(ApplParmFull newApplParmFull) { + setApFull(newApplParmFull); + this.tagMessageTable = new Hashtable<>(); + } + + public ResParm delete() { + return null; + } + + public void findByPrimaryKey(Object obj) {} + + public int getDBState() { + return 1; + } + + public ResParm save() { + return null; + } + + public void setNuovaIstanzaOggettoRemoto(boolean flag) {} + + public Object[] getFieldSetArg(String parmValue, Class type) { + return null; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + private void removeTag(String tag) { + Key key = new Key(tag, DBAdapter.getLocalHostname()); + if (this.tagMessageTable.containsKey(key)) { + this.tagMessageTable.remove(key); + } else { + DBAdapter.printDebug("Errore: Il tag '" + tag + "' non esiste. hostname " + DBAdapter.getLocalHostname()); + for (Map.Entry entry : this.tagMessageTable.entrySet()) + DBAdapter.printDebug("Chiave: '" + ((Key)entry.getKey()).tag + " " + ((Key)entry.getKey()).hostname + "', Valore: " + (String)entry.getValue()); + } + } + + protected boolean isDatabaseBean() { + return false; + } + + public static StatusMsg getInstance(ApplParmFull ap) { + String apCode = (ap != null) ? ap.getApCode() : "default"; + return instancesByApCode.computeIfAbsent(apCode, k -> new StatusMsg(ap)); + } + + private synchronized void reset() { + this.tagMessageTable = new Hashtable<>(); + } + + private void updateTagMessage(String tag, String message) { + Key key = new Key(tag, DBAdapter.getLocalHostname()); + this.tagMessageTable.put(key, message); + } + + public String getMessage(String tag) { + Key key = new Key(tag, DBAdapter.getLocalHostname()); + return this.tagMessageTable.get(key); + } + + private String getStatusMsgHtmlReal() { + StringBuilder sb = new StringBuilder(); + for (Key key : this.tagMessageTable.keySet()) { + String message = this.tagMessageTable.get(key); + sb.append("
    "); + sb.append("#"); + sb.append(key.toString()); + sb.append(": "); + sb.append(DBAdapter.convertStringToHtml(message)); + sb.append("
    "); + } + return sb.toString(); + } + + public void printAllTagsAndMessagesForEach() { + for (Key key : this.tagMessageTable.keySet()) + String str = this.tagMessageTable.get(key); + } + + @Deprecated + public static final synchronized void xappendMsgByTag(String l_tag, String l_msg) { + appendMsgByTag(null, l_tag, l_msg); + } + + public static final synchronized void appendMsgByTag(ApplParmFull l_apFull, String l_tag, String l_msg) { + StatusMsg store = getInstance(l_apFull); + String currentMsg = store.getMessage(l_tag); + store.updateTagMessage(l_tag, currentMsg + "\n" + currentMsg); + } + + @Deprecated + public static final synchronized void xdeleteAllMsg() { + deleteAllMsg(null); + } + + public static final synchronized void deleteAllMsg(ApplParmFull l_apFull) { + StatusMsg store = getInstance(l_apFull); + store.reset(); + } + + @Deprecated + public static final synchronized void xdeleteMsgByTag(String l_tag) { + deleteMsgByTag(null, l_tag); + } + + public static final synchronized void deleteMsgByTag(ApplParmFull l_apFull, String l_tag) { + StatusMsg store = getInstance(l_apFull); + store.removeTag(l_tag); + } + + @Deprecated + public static final synchronized String xgetStatusMsgHtml() { + return getStatusMsgHtml(null); + } + + public static final synchronized String getStatusMsgHtml(ApplParmFull l_apFull) { + StatusMsg store = getInstance(l_apFull); + return store.getStatusMsgHtmlReal(); + } + + @Deprecated + public static final synchronized void xupdateMsgByTag(String l_tag, String l_msg) { + updateMsgByTag(null, l_tag, l_msg); + } + + public static final synchronized void updateMsgByTag(ApplParmFull l_apFull, String l_tag, String l_msg) { + StatusMsg store = getInstance(l_apFull); + store.updateTagMessage(l_tag, l_msg); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/StatusMsgCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/StatusMsgCR.java new file mode 100644 index 00000000..c6603f9c --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/StatusMsgCR.java @@ -0,0 +1,43 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +@Deprecated +public class StatusMsgCR extends CRAdapter { + private long id_statusMsg; + + private String tag; + + private String msg; + + public StatusMsgCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public StatusMsgCR() {} + + public void setId_statusMsg(long newId_statusMsg) { + this.id_statusMsg = newId_statusMsg; + } + + public void setTag(String newTag) { + this.tag = newTag; + } + + public void setMsg(String newMsg) { + this.msg = newMsg; + } + + public long getId_statusMsg() { + return this.id_statusMsg; + } + + public String getTag() { + return (this.tag == null) ? "" : this.tag.trim(); + } + + public String getMsg() { + return (this.msg == null) ? "" : this.msg.trim(); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TableDesc.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TableDesc.java new file mode 100644 index 00000000..a39c8aa8 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TableDesc.java @@ -0,0 +1,736 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TableDesc extends DBAdapter implements Serializable { + private static final long serialVersionUID = 1501275837045L; + + public static final long FORM_FIELD_INPUT = 0L; + + public static final long FORM_FIELD_COMBO = 1L; + + public static final long FORM_FIELD_COMBO_FLG = 2L; + + public static final long FORM_FIELD_CHECKBOX = 3L; + + public static final long FORM_FIELD_RADIOBUTON = 4L; + + public static final long FORM_FIELD_TEXT_AREA = 5L; + + public static final long FORM_FIELD_AJAX = 6L; + + private long id_tableDesc; + + private long flgAjaxUseSubmit; + + private String ajaxNextAction; + + private String label; + + private long flgTipo; + + private long flgReadOnly; + + private long ordine; + + private long rowNumbCR; + + private long colLg; + + private long colXsCR; + + private String ajaxSearchString; + + private String valoreDefaultCR; + + private boolean firstField; + + private Access access; + + private long maxLenght; + + private long flgHidden; + + private long colLgCR; + + private long colXs; + + private long ordineCR; + + private long rowNumb; + + private long flgPk; + + private long numColSearch; + + private long flgFormField; + + private long flgCR; + + private long tabOrder; + + private String tabName; + + private String comboFlgValuelist; + + private String toolTip; + + private long flgHtml; + + private long ajaxNChar; + + private String nomeColonna; + + private long flgAjaxUseMono; + + private String id_access; + + private String ajaxJavascriptmodify; + + private String ajaxJavascriptnew; + + private String ajaxFieldsMapping; + + private long flgMandatory; + + private String ajaxTable; + + public TableDesc(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TableDesc() {} + + public void setId_tableDesc(long newId_tableDesc) { + this.id_tableDesc = newId_tableDesc; + } + + public void setId_access(String newId_access) { + this.id_access = newId_access; + setAccess(null); + } + + public void setNomeColonna(String newNomeColonna) { + this.nomeColonna = newNomeColonna; + } + + public void setLabel(String newLabel) { + this.label = newLabel; + } + + public void setFlgTipo(long newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public void setFlgCR(long newFlgCR) { + this.flgCR = newFlgCR; + } + + public void setOrdine(long newOrdine) { + this.ordine = newOrdine; + } + + public void setRowNumb(long newRowNumb) { + this.rowNumb = newRowNumb; + } + + public void setColLg(long newColLg) { + this.colLg = newColLg; + } + + public void setColXs(long newColXs) { + this.colXs = newColXs; + } + + public void setAjaxSearchString(String newAjaxSearchString) { + this.ajaxSearchString = newAjaxSearchString; + } + + public void setAjaxFieldsMapping(String newAjaxReturnValues) { + this.ajaxFieldsMapping = newAjaxReturnValues; + } + + public long getId_tableDesc() { + return this.id_tableDesc; + } + + public String getId_access() { + return (this.id_access == null) ? "" : this.id_access.trim(); + } + + public String getNomeColonna() { + return (this.nomeColonna == null) ? "" : this.nomeColonna.trim(); + } + + public String getLabel() { + return (this.label == null) ? "" : this.label.trim(); + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public long getFlgCR() { + return this.flgCR; + } + + public long getOrdine() { + return this.ordine; + } + + public long getRowNumb() { + return this.rowNumb; + } + + public long getColLg() { + return this.colLg; + } + + public long getColXs() { + return this.colXs; + } + + public String getAjaxSearchString() { + return (this.ajaxSearchString == null) ? "" : this.ajaxSearchString.trim(); + } + + public String getAjaxFieldsMapping() { + return (this.ajaxFieldsMapping == null) ? "" : this.ajaxFieldsMapping.trim(); + } + + public void setAccess(Access newAccess) { + this.access = newAccess; + } + + public Access getAccess() { + this.access = (Access)getSecondaryObject(this.access, Access.class, getId_access()); + return this.access; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findHiddenByTable(String l_id_access) { + String s_Sql_Find = "select A.* from TABLE_DESC AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_access='" + l_id_access + "'"); + wc.addWc("A.flgHidden=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findPrimaryDetailFieldsByTable(String l_id_access) { + String s_Sql_Find = "select A.* from TABLE_DESC AS A"; + String s_Sql_Order = " order by A.rowNumb, A.ordine"; + WcString wc = new WcString(); + wc.addWc("A.id_access='" + l_id_access + "'"); + wc.addWc("(A.flgHidden is null or A.flgHidden=0)"); + wc.addWc("A.rowNumb>0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + public void findByTabellaColonna(String nomeTabella, String nomeColonna) { + String s_Sql_Find = "select A.* from TABLE_DESC AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_access='" + nomeTabella + "'"); + wc.addWc("A.nomeColonna='" + nomeColonna + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + } + } + + public Vectumerator findByTabella(String nomeTabella, long l_flgSearchType) { + String s_Sql_Find; + String s_Sql_Find_mysql = "select A.*, if(A.numColSearch is null,9999999999,A.numColSearch) as numColSearchOrder from TABLE_DESC AS A"; + String s_Sql_Find_sqlserver = "select A.*, case when A.numColSearch is null then 9999999999 else A.numColSearch end as numColSearchOrder from TABLE_DESC AS A"; + if (getApFull().getAp().getDbType() == 13 || + getApFull().getAp().getDbType() == 14) { + s_Sql_Find = s_Sql_Find_sqlserver; + } else { + s_Sql_Find = s_Sql_Find_mysql; + } + String s_Sql_Order = " order by A.flgPk desc,A.nomeColonna"; + if (l_flgSearchType == 1L) { + s_Sql_Order = " order by A.flgPk desc,A.rowNumbCR,A.ordineCR, A.nomeColonna"; + } else if (l_flgSearchType == 2L) { + s_Sql_Order = " order by numColSearchOrder, A.nomeColonna"; + } else if (l_flgSearchType == 3L) { + s_Sql_Order = " order by A.flgPk desc,A.rowNumb,A.ordine, A.nomeColonna"; + } + WcString wc = new WcString(); + wc.addWc("A.id_access='" + nomeTabella + "'"); + if (l_flgSearchType == 1L) + wc.addWc("A.flgCR=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + public long getMaxLenght() { + return this.maxLenght; + } + + public void setMaxLenght(long maxLenght) { + this.maxLenght = maxLenght; + } + + public long getFlgHidden() { + return this.flgHidden; + } + + public void setFlgHidden(long flgHidden) { + this.flgHidden = flgHidden; + } + + public long getRowNumbCR() { + return this.rowNumbCR; + } + + public void setRowNumbCR(long rowNumbCR) { + this.rowNumbCR = rowNumbCR; + } + + public long getColXsCR() { + return this.colXsCR; + } + + public void setColXsCR(long colXsCR) { + this.colXsCR = colXsCR; + } + + public long getColLgCR() { + return this.colLgCR; + } + + public void setColLgCR(long colLgCR) { + this.colLgCR = colLgCR; + } + + public long getOrdineCR() { + return this.ordineCR; + } + + public void setOrdineCR(long ordineCR) { + this.ordineCR = ordineCR; + } + + public long getFlgPk() { + return this.flgPk; + } + + public void setFlgPk(long flgPk) { + this.flgPk = flgPk; + } + + public long getNumColSearch() { + return this.numColSearch; + } + + public void setNumColSearch(long numColSearch) { + this.numColSearch = numColSearch; + } + + public Vectumerator findByCR(TableDescCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TABLE_DESC AS A"; + String s_Sql_Order = " order by nomeColonna"; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.id_access like '%" + token + "%' )"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + public String getComboDescColumnMethod() { + if (getNomeColonna().indexOf("id_") != 0 || getFlgPk() == 1L) + return ""; + Access fkAccess = getFkAccess(); + String comboDescColumn = fkAccess.getComboDescColumn(getNomeColonna()); + if (comboDescColumn != null) { + String theFkBean = getNomeColonna().substring(3, 4).toUpperCase() + getNomeColonna().substring(3, 4).toUpperCase(); + String getMethodName = "get" + theFkBean + "()"; + if (comboDescColumn.isEmpty()) + return getMethodName + ".getDescrizione()"; + return getMethodName + ".get" + getMethodName + comboDescColumn.substring(0, 1).toUpperCase() + "()"; + } + return ""; + } + + public String getComboDescColumnFk() { + if (getNomeColonna().indexOf("id_") != 0 || getFlgPk() == 1L) + return ""; + Access fkAccess = getFkAccess(); + String comboDescColumn = fkAccess.getComboDescColumn(getNomeColonna()); + if (comboDescColumn != null) + return comboDescColumn; + return "descrizione"; + } + + public static final String getFormField(long l_flgFormField) { + switch ((int)l_flgFormField) { + case 6: + return "Ajax search"; + case 3: + return "CheckBox"; + case 1: + return "ComboBox"; + case 2: + return "ComboBox con flg"; + case 0: + return "Text"; + case 4: + return "Radio Button"; + case 5: + return "Text Area"; + } + return "??"; + } + + public final String getFormField() { + return getFormField(getFlgFormField()); + } + + public void setFlgFormField(long flgFormField) { + this.flgFormField = flgFormField; + } + + public static final String getTipo(long l_flgTipo) { + switch ((int)l_flgTipo) { + case 12: + return "Varchar"; + case 1: + return "Char"; + case -16: + return "Long N Varchar"; + case -1: + return "Long Varchar"; + case 4: + return "Integer"; + case -5: + return "Bigint"; + case 5: + return "Smallint"; + case 8: + return "Double"; + case 3: + return "Decimal"; + case 6: + return "Float"; + case 91: + return "Data"; + case 92: + return "Time"; + case 2013: + return "Time with timezone"; + case 93: + return "Timestamp"; + case 16: + return "Boolean"; + } + return "Non Gestito: " + l_flgTipo; + } + + public final String getTipo() { + return getTipo(getFlgTipo()); + } + + public long getFlgReadOnly() { + return this.flgReadOnly; + } + + public void setFlgReadOnly(long flgReadOnly) { + this.flgReadOnly = flgReadOnly; + } + + public long getTabOrder() { + return this.tabOrder; + } + + public void setTabOrder(long tabOrder) { + this.tabOrder = tabOrder; + } + + public String getTabName() { + return (this.tabName == null) ? "" : this.tabName.trim(); + } + + public void setTabName(String tabName) { + this.tabName = tabName; + } + + public Vectumerator findCRFieldsByTable(String l_id_access) { + String s_Sql_Find = "select A.* from TABLE_DESC AS A"; + String s_Sql_Order = " order by A.rowNumbCR, A.ordineCR"; + WcString wc = new WcString(); + wc.addWc("A.id_access='" + l_id_access + "'"); + wc.addWc("(A.flgHidden is null or A.flgHidden=0)"); + wc.addWc("A.flgCR=1"); + wc.addWc("A.rowNumbCR>0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findCRListFieldsByTable(String l_id_access) { + String s_Sql_Find = "select A.* from TABLE_DESC AS A"; + String s_Sql_Order = " order by A.numColSearch"; + WcString wc = new WcString(); + wc.addWc("A.id_access='" + l_id_access + "'"); + wc.addWc("A.numColSearch>0"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + public boolean isFirstField() { + return this.firstField; + } + + public void setFirstField(boolean firstField) { + this.firstField = firstField; + } + + public String getComboFlgValuelist() { + return (this.comboFlgValuelist == null) ? "" : this.comboFlgValuelist.trim(); + } + + public void setComboFlgValuelist(String newOptionValues) { + this.comboFlgValuelist = newOptionValues; + } + + public String getToolTip() { + return (this.toolTip == null) ? "" : this.toolTip.trim(); + } + + public void setToolTip(String toolTip) { + this.toolTip = toolTip; + } + + public long getFlgHtml() { + return this.flgHtml; + } + + public void setFlgHtml(long flgHtml) { + this.flgHtml = flgHtml; + } + + public ResParm updateFields(String fieldName, String value) { + if (getId_tableDesc() == 0L) + return new ResParm(false, "Errore! Impossibile aggiornare un bean nuovo."); + long valueL = 0L; + try { + valueL = Long.parseLong(value); + } catch (Exception e) {} + if (fieldName.equals("label")) { + setLabel(value); + } else if (fieldName.equals("ajaxTable")) { + setAjaxTable(value); + } else if (fieldName.equals("flgMandatory")) { + setFlgMandatory(valueL); + } else if (fieldName.equals("flgFormField")) { + setFlgFormField(valueL); + } else if (fieldName.equals("flgHidden")) { + setFlgHidden(valueL); + } else if (fieldName.equals("flgReadOnly")) { + setFlgReadOnly(valueL); + } else if (fieldName.equals("valoreDefaultCR")) { + setValoreDefaultCR(value); + } else if (fieldName.equals("flgHtml")) { + setFlgHtml(valueL); + } else if (fieldName.equals("maxLenght")) { + setMaxLenght(valueL); + } else if (fieldName.equals("comboFlgValuelist")) { + setComboFlgValuelist(value); + } else if (fieldName.equals("ajaxFieldsMapping")) { + setAjaxFieldsMapping(value); + } else if (fieldName.equals("toolTip")) { + setToolTip(value); + } else if (fieldName.equals("ajaxSearchString")) { + setAjaxSearchString(value); + } else if (fieldName.equals("ajaxReturnValues")) { + setAjaxFieldsMapping(value); + } else if (fieldName.equals("flgCR")) { + setFlgCR(valueL); + } else if (fieldName.equals("rowNumb")) { + setRowNumb(valueL); + } else if (fieldName.equals("ordine")) { + setOrdine(valueL); + } else if (fieldName.equals("colLg")) { + setColLg(valueL); + } else if (fieldName.equals("colXs")) { + setColXs(valueL); + } else if (fieldName.equals("rowNumbCR")) { + setRowNumbCR(valueL); + } else if (fieldName.equals("ordineCR")) { + setOrdineCR(valueL); + } else if (fieldName.equals("colLgCR")) { + setColLgCR(valueL); + } else if (fieldName.equals("colXsCR")) { + setColXsCR(valueL); + } else if (fieldName.equals("numColSearch")) { + setNumColSearch(valueL); + } + return save(); + } + + public long getFlgFormField() { + return this.flgFormField; + } + + public long getAjaxNChar() { + return this.ajaxNChar; + } + + public void setAjaxNChar(long nChar) { + this.ajaxNChar = nChar; + } + + public String getAjaxNextAction() { + return (this.ajaxNextAction == null) ? "" : this.ajaxNextAction.trim(); + } + + public void setAjaxNextAction(String ajaxNextAction) { + this.ajaxNextAction = ajaxNextAction; + } + + public long getFlgAjaxUseSubmit() { + return this.flgAjaxUseSubmit; + } + + public void setFlgAjaxUseSubmit(long flgAjaxUseSubmit) { + this.flgAjaxUseSubmit = flgAjaxUseSubmit; + } + + public long getFlgAjaxUseMono() { + return this.flgAjaxUseMono; + } + + public void setFlgAjaxUseMono(long flgAjaxUseMono) { + this.flgAjaxUseMono = flgAjaxUseMono; + } + + public String getAjaxJavascriptmodify() { + return (this.ajaxJavascriptmodify == null) ? "" : this.ajaxJavascriptmodify.trim(); + } + + public void setAjaxJavascriptmodify(String ajaxJavascriptmodify) { + this.ajaxJavascriptmodify = ajaxJavascriptmodify; + } + + public String getAjaxJavascriptnew() { + return (this.ajaxJavascriptnew == null) ? "" : this.ajaxJavascriptnew.trim(); + } + + public void setAjaxJavascriptnew(String ajaxJavascriptnew) { + this.ajaxJavascriptnew = ajaxJavascriptnew; + } + + public Access getFkAccess() { + if (getNomeColonna().indexOf("id_") != 0 || getFlgPk() == 1L) + return new Access(getApFull()); + String id_access = Access.convertFieldToTableName(getNomeColonna().substring(3)); + Access access = new Access(getApFull()); + access.findByPrimaryKey(id_access); + return access; + } + + public String getValoreDefaultCR() { + return (this.valoreDefaultCR == null) ? "" : this.valoreDefaultCR.trim(); + } + + public void setValoreDefaultCR(String valoreDefaultCR) { + this.valoreDefaultCR = valoreDefaultCR; + } + + public Vectumerator findByTabellaDefaultValue(String nomeTabella) { + String s_Sql_Find = "select A.*, if(A.numColSearch is null,9999999999,A.numColSearch) as numColSearchOrder from TABLE_DESC AS A"; + String s_Sql_Order = " order by A.flgPk desc,A.nomeColonna"; + WcString wc = new WcString(); + wc.addWc("A.id_access='" + nomeTabella + "'"); + wc.addWc("A.defaultValueCR is not null"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } + + public long getFlgMandatory() { + return this.flgMandatory; + } + + public void setFlgMandatory(long flgMandatory) { + this.flgMandatory = flgMandatory; + } + + public String getAjaxTable() { + return (this.ajaxTable == null) ? "" : this.ajaxTable.trim(); + } + + public void setAjaxTable(String ajaxTable) { + this.ajaxTable = ajaxTable; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TableDescCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TableDescCR.java new file mode 100644 index 00000000..544e5666 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TableDescCR.java @@ -0,0 +1,180 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TableDescCR extends CRAdapter { + private long id_tableDesc; + + private String id_access; + + private String nomeColonna; + + private String lebel; + + private long flgTipo; + + private long flgCR; + + private long ordine; + + private long rowNumb; + + private long colLg; + + private long colXs; + + private String optionValues; + + private String comboDescColumn; + + private String ajaxSearchString; + + private String ajaxReturnValues; + + public static final long SEARCH_TYPE_ELENCO_COLONNE = 0L; + + public static final long SEARCH_TYPE_VISTA_CR = 1L; + + public static final long SEARCH_TYPE_VISTA_CR_LISTA = 2L; + + public static final long SEARCH_TYPE_VISTA_DETTAGLIO = 3L; + + private Access access; + + public TableDescCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TableDescCR() {} + + public void setId_tableDesc(long newId_tableDesc) { + this.id_tableDesc = newId_tableDesc; + } + + public void setId_access(String newId_access) { + this.id_access = newId_access; + setAccess(null); + } + + public void setNomeColonna(String newNomeColonna) { + this.nomeColonna = newNomeColonna; + } + + public void setLebel(String newLebel) { + this.lebel = newLebel; + } + + public void setFlgTipo(long newFlgTipo) { + this.flgTipo = newFlgTipo; + } + + public void setFlgCR(long newFlgCR) { + this.flgCR = newFlgCR; + } + + public void setOrdine(long newOrdine) { + this.ordine = newOrdine; + } + + public void setRowNumb(long newRowNumb) { + this.rowNumb = newRowNumb; + } + + public void setColLg(long newColLg) { + this.colLg = newColLg; + } + + public void setColXs(long newColXs) { + this.colXs = newColXs; + } + + public void setOptionValues(String newOptionValues) { + this.optionValues = newOptionValues; + } + + public void setComboDescColumn(String newComboDescColumn) { + this.comboDescColumn = newComboDescColumn; + } + + public void setAjaxSearchString(String newAjaxSearchString) { + this.ajaxSearchString = newAjaxSearchString; + } + + public void setAjaxReturnValues(String newAjaxReturnValues) { + this.ajaxReturnValues = newAjaxReturnValues; + } + + public long getId_tableDesc() { + return this.id_tableDesc; + } + + public String getId_access() { + return (this.id_access == null) ? "" : this.id_access.trim(); + } + + public String getNomeColonna() { + return (this.nomeColonna == null) ? "" : this.nomeColonna.trim(); + } + + public String getLebel() { + return (this.lebel == null) ? "" : this.lebel.trim(); + } + + public long getFlgTipo() { + return this.flgTipo; + } + + public long getFlgCR() { + return this.flgCR; + } + + public long getOrdine() { + return this.ordine; + } + + public long getRowNumb() { + return this.rowNumb; + } + + public long getColLg() { + return this.colLg; + } + + public long getColXs() { + return this.colXs; + } + + public String getOptionValues() { + return (this.optionValues == null) ? "" : this.optionValues.trim(); + } + + public String getComboDescColumn() { + return (this.comboDescColumn == null) ? "" : this.comboDescColumn.trim(); + } + + public String getAjaxSearchString() { + return (this.ajaxSearchString == null) ? "" : this.ajaxSearchString.trim(); + } + + public String getAjaxReturnValues() { + return (this.ajaxReturnValues == null) ? "" : this.ajaxReturnValues.trim(); + } + + public void setAccess(Access newAccess) { + this.access = newAccess; + } + + public Access getAccess() { + this.access = (Access)getSecondaryObject(this.access, Access.class, getId_access()); + return this.access; + } + + public final String getTipo() { + return TableDesc.getTipo(getFlgTipo()); + } + + public static final String getTipo(long l_flgTipo) { + return TableDesc.getTipo(l_flgTipo); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TipoInterface.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TipoInterface.java new file mode 100644 index 00000000..fcf57dbc --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TipoInterface.java @@ -0,0 +1,35 @@ +package it.acxent.common; + +import it.acxent.util.Vectumerator; + +public interface TipoInterface { + Vectumerator findFigli(int paramInt1, int paramInt2); + + long getNumeroFigli(long paramLong); + + long getId_tipoPadre(); + + String getDescrizione(); + + String getDescrizioneCompleta(); + + String getDescrizione4Script(); + + long getFlgUsaVarianti(); + + long getId_tipo(); + + String getDescrizione(String paramString); + + String getDescrizione4Script(String paramString); + + String getDescrizioneCompleta(String paramString); + + String getDescrizione(String paramString, int paramInt); + + String getDescrizione(String paramString1, String paramString2); + + String getDescrizione(String paramString1, String paramString2, int paramInt); + + String getDescrizione(int paramInt); +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TipoPostazione.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TipoPostazione.java new file mode 100644 index 00000000..bd0592bf --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TipoPostazione.java @@ -0,0 +1,70 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class TipoPostazione extends DBAdapter implements Serializable { + private long id_tipoPostazione; + + private String descrizione; + + public TipoPostazione(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoPostazione() {} + + public void setId_tipoPostazione(long newId_tipoAzienda) { + this.id_tipoPostazione = newId_tipoAzienda; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoPostazione() { + return this.id_tipoPostazione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(TipoPostazioneCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from TIPO_POSTAZIONE AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return (Vectumerator)findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return (Vectumerator)AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TipoPostazioneCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TipoPostazioneCR.java new file mode 100644 index 00000000..f4e103ac --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TipoPostazioneCR.java @@ -0,0 +1,32 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class TipoPostazioneCR extends CRAdapter { + private long id_tipoPostazione; + + private String descrizione; + + public TipoPostazioneCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public TipoPostazioneCR() {} + + public void setId_tipoPostazione(long newId_tipoAzienda) { + this.id_tipoPostazione = newId_tipoAzienda; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public long getId_tipoPostazione() { + return this.id_tipoPostazione; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TtFont.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TtFont.java new file mode 100644 index 00000000..2944894b --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/TtFont.java @@ -0,0 +1,176 @@ +package it.acxent.common; + +import com.lowagie.text.Font; +import com.lowagie.text.pdf.BaseFont; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.Vectumerator; +import java.awt.Color; +import java.io.File; +import java.util.Arrays; +import java.util.Enumeration; +import java.util.Hashtable; + +public class TtFont extends DBAdapter { + private String ttfName; + + private String ttfPath; + + private Parm parm; + + private static Hashtable fonts; + + private static final Font PDF_f_Default = new Font(2, 10.0F, 0); + + private static final int PDF_fsize_Default = 10; + + private static TtFont ttFontInstance; + + static final String WIN_DEFAULT_TTF_PATH = "C:/windows/fonts/"; + + private TtFont() {} + + private TtFont(ApplParmFull newApplParmFull) { + setApFull(newApplParmFull); + } + + public ResParm delete() { + return null; + } + + public Vectumerator findAll() { + int numRec = 0; + File dir = new File(getTtfPath()); + File[] fonts = dir.listFiles(); + if (fonts != null) { + Arrays.sort(fonts); + File theFont = null; + Vectumerator vec = new Vectumerator(); + try { + for (File font : fonts) { + theFont = font; + if (theFont.getName().toLowerCase().endsWith("ttf")) { + numRec++; + TtFont myBean = new TtFont(getApFull()); + myBean.setTtfName(theFont.getName()); + vec.addElement(myBean); + } + } + vec.setTotNumberOfRecords(numRec); + return vec; + } catch (Exception e) { + e.printStackTrace(); + return DBAdapter.AB_EMPTY_VECTUMERATOR; + } + } + return DBAdapter.AB_EMPTY_VECTUMERATOR; + } + + public void findByPrimaryKey(Object obj) {} + + public int getDBState() { + return 1; + } + + public String getTtfPath() { + return getDocBase() + "admin/_V4/_font/"; + } + + public ResParm save() { + return null; + } + + public void setNuovaIstanzaOggettoRemoto(boolean flag) {} + + public Object[] getFieldSetArg(String parmValue, Class type) { + return null; + } + + public void setTtfPath(String ttfPath) { + this.ttfPath = ttfPath; + } + + public String getTtfName() { + return this.ttfName; + } + + public void setTtfName(String ttfName) { + this.ttfName = ttfName; + } + + public String getTtf() { + return getTtfPath() + getTtfPath(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Parm getParm(String theKey) { + if (this.parm == null) + this.parm = new Parm(getApFull()); + try { + this.parm.findByCodice(theKey); + return this.parm; + } catch (Exception e) { + handleDebug(e); + return this.parm; + } + } + + public Font getFont(String baseFont, int size, int type, Color theColor) { + Long fontKey = new Long((long)(baseFont.hashCode() + size + type + ((theColor == null) ? 0 : theColor.hashCode()))); + if (!getFonts().containsKey(fontKey)) + try { + Font ft; + if (baseFont.isEmpty()) { + ft = PDF_f_Default; + } else { + BaseFont bf = BaseFont.createFont(baseFont, "Identity-H", true); + int fontSize = size; + if (fontSize <= 0) + fontSize = 10; + if (theColor == null) { + ft = new Font(bf, (float)fontSize, type, Color.black); + } else { + ft = new Font(bf, (float)fontSize, type, theColor); + } + } + getFonts().put(fontKey, ft); + return ft; + } catch (Exception e) { + e.printStackTrace(); + return PDF_f_Default; + } + return (Font)getFonts().get(fontKey); + } + + protected boolean isDatabaseBean() { + return false; + } + + public static synchronized TtFont getInstance(ApplParmFull ap) { + if (ttFontInstance == null) + ttFontInstance = new TtFont(ap); + return ttFontInstance; + } + + public static synchronized void reset() { + Enumeration enu = getFonts().elements(); + while (enu.hasMoreElements()) { + Font row = enu.nextElement(); + getFonts().remove(row); + row = null; + } + fonts = null; + } + + private static Hashtable getFonts() { + if (fonts == null) + fonts = new Hashtable(); + return fonts; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserAccess.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserAccess.java new file mode 100644 index 00000000..a99843bf --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserAccess.java @@ -0,0 +1,119 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; + +public class UserAccess extends DBAdapter implements Serializable { + private long flgRW; + + private String id_access; + + private long id_userAccess; + + private Access access; + + private Users users; + + private long id_users; + + public Vectumerator findAccesssByUser(long l_id_user, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from USER_ACCESS AS A, ACCESS AS B"; + String s_Sql_Order = " order by B.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_access =B.id_access"); + wc.addWc("A.id_users =" + l_id_user); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public UserAccess() {} + + public UserAccess(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public long getFlgRW() { + return this.flgRW; + } + + public String getRW() { + return DBAdapter.getRW(getFlgRW()); + } + + public String getId_access() { + return (this.id_access == null) ? "" : this.id_access; + } + + public long getId_users() { + return this.id_users; + } + + public Access getAccess() { + this.access = (Access)getSecondaryObject(this.access, Access.class, getId_access()); + return this.access; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject(this.users, Users.class, new Long(getId_users())); + return this.users; + } + + public void setFlgRW(long newFlgRW) { + this.flgRW = newFlgRW; + } + + public void setId_access(String newId_access) { + this.id_access = newId_access; + setAccess(null); + } + + public void setId_users(long newId_user) { + this.id_users = newId_user; + setUsers(null); + } + + public void setAccess(Access newAccess) { + this.access = newAccess; + } + + public void setUsers(Users newUser) { + this.users = newUser; + } + + public long getId_userAccess() { + return this.id_userAccess; + } + + public void setId_userAccess(long id_userAccess) { + this.id_userAccess = id_userAccess; + } + + public void findByUserAccess(long l_id_user, String l_id_access) { + String s_Sql_Find = "select A.* from USER_ACCESS AS A"; + WcString wc = new WcString(); + wc.addWc("A.id_users =" + l_id_user); + wc.addWc("A.id_access ='" + l_id_access + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserAccessGroup.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserAccessGroup.java new file mode 100644 index 00000000..be046ad0 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserAccessGroup.java @@ -0,0 +1,167 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class UserAccessGroup extends DBAdapter implements Serializable { + private long id_userAccessGroup; + + private long id_accessGroup; + + private long id_users; + + private AccessGroup accessGroup; + + private Users users; + + public UserAccessGroup(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public UserAccessGroup() {} + + public void setId_userAccessGroup(long newId_userAccessGroup) { + this.id_userAccessGroup = newId_userAccessGroup; + } + + public void setId_accessGroup(long newId_accessGroup) { + this.id_accessGroup = newId_accessGroup; + setAccessGroup(null); + } + + public void setId_users(long newId_users) { + this.id_users = newId_users; + setUsers(null); + } + + public long getId_userAccessGroup() { + return this.id_userAccessGroup; + } + + public long getId_accessGroup() { + return this.id_accessGroup; + } + + public long getId_users() { + return this.id_users; + } + + public void setAccessGroup(AccessGroup newAccessGroup) { + this.accessGroup = newAccessGroup; + } + + public AccessGroup getAccessGroup() { + this.accessGroup = (AccessGroup)getSecondaryObject((DBAdapter)this.accessGroup, AccessGroup.class, + getId_accessGroup()); + return this.accessGroup; + } + + public void setUsers(Users newUsers) { + this.users = newUsers; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, getId_users()); + return this.users; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(UserAccessGroupCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from USER_ACCESS_GROUP AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.descrizione like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByUser(long l_id_user, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from USER_ACCESS_GROUP AS A, USERS as B, ACCESS_GROUP AS C"; + String s_Sql_Order = " order by C.descrizione, B.cognome, B.nome"; + WcString wc = new WcString(); + wc.addWc("A.id_users =B.id_users"); + wc.addWc("A.id_accessGroup =C.id_accessGroup"); + wc.addWc("A.id_users =" + l_id_user); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findByAccessGroup(long l_id_accessGroup, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from USER_ACCESS_GROUP AS A, USERS AS B, ACCESS_GROUP AS C"; + String s_Sql_Order = " order by C.descrizione, B.cognome, B.nome"; + WcString wc = new WcString(); + wc.addWc("A.id_users =B.id_users"); + wc.addWc("A.id_accessGroup=C.id_accessGroup"); + wc.addWc("A.id_accessGroup =" + l_id_accessGroup); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByAccessGroupUser(long l_id_accessGroup, long l_id_user) { + String s_Sql_Find = "select A.* from USER_ACCESS_GROUP AS A"; + String wc = ""; + wc = buildWc(wc, "A.id_users =" + l_id_user); + wc = buildWc(wc, "A.id_accessGroup =" + l_id_accessGroup); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e); + } + } + + public void findByAccessUser(String l_id_access, long l_id_user) { + String s_Sql_Find = "select A.* from USER_ACCESS_GROUP AS A, ACCESS_GROUP_ACCESS AS B, ACCESS AS C"; + String s_Sql_Order = " order by C.descrizione"; + WcString wc = new WcString(); + wc.addWc("A.id_accessGroup =B.id_accessGroup"); + wc.addWc("B.id_access=C.id_access"); + wc.addWc("A.id_users =" + l_id_user); + wc.addWc("B.id_access ='" + l_id_access + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e); + } + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserAccessGroupCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserAccessGroupCR.java new file mode 100644 index 00000000..1724320d --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserAccessGroupCR.java @@ -0,0 +1,71 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; + +public class UserAccessGroupCR extends CRAdapter { + private long id_userAccessGroup; + + private long id_accessGroup; + + private long id_users; + + private AccessGroup accessGroup; + + private Users users; + + public UserAccessGroupCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public UserAccessGroupCR() {} + + public void setId_userAccessGroup(long newId_userAccessGroup) { + this.id_userAccessGroup = newId_userAccessGroup; + } + + public void setId_accessGroup(long newId_accessGroup) { + this.id_accessGroup = newId_accessGroup; + setAccessGroup(null); + } + + public void setId_users(long newId_users) { + this.id_users = newId_users; + setUsers(null); + } + + public long getId_userAccessGroup() { + return this.id_userAccessGroup; + } + + public long getId_accessGroup() { + return this.id_accessGroup; + } + + public long getId_users() { + return this.id_users; + } + + public void setAccessGroup(AccessGroup newAccessGroup) { + this.accessGroup = newAccessGroup; + } + + public AccessGroup getAccessGroup() { + this.accessGroup = (AccessGroup)getSecondaryObject((DBAdapter)this.accessGroup, AccessGroup.class, + + getId_accessGroup()); + return this.accessGroup; + } + + public void setUsers(Users newUsers) { + this.users = newUsers; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, + + getId_users()); + return this.users; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserProfile.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserProfile.java new file mode 100644 index 00000000..b3c01a72 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserProfile.java @@ -0,0 +1,154 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.util.Hashtable; +import java.util.StringTokenizer; + +public class UserProfile extends DBAdapter implements Serializable { + private static final long serialVersionUID = 7761376941380158250L; + + public static final long TIPO_CLIENTE = 10L; + + public static final long TIPO_FORNITORE = 20L; + + private long id_userProfile; + + private String descrizione; + + private String policy; + + public UserProfile() {} + + public UserProfile(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + public boolean checkRights(long l_id_profiloUtente) { + if (getPolicy().equals("*")) + return true; + StringTokenizer st = new StringTokenizer(getPolicy(), ","); + while (st.hasMoreTokens()) { + if (l_id_profiloUtente == Long.parseLong(st.nextToken())) + return true; + } + return false; + } + + protected void deleteCascade() {} + + public void fillObject(Hashtable htable) {} + + public Vectumerator findProfiles(String l_listaProfili) { + String s_Sql_Find = "select A.* from USER_PROFILE AS A"; + String wc = ""; + if (l_listaProfili.equals("#")) { + wc = " where id_userProfile is null"; + } else if (!l_listaProfili.equals("*")) { + StringTokenizer st = new StringTokenizer(l_listaProfili, ","); + while (st.hasMoreTokens()) { + if (!wc.isEmpty()) { + wc = wc + " or id_userProfile=" + wc; + continue; + } + wc = " where id_userProfile=" + st.nextToken(); + } + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findUserProfiles() { + String s_Sql_Find = "select A.* from USER_PROFILE AS A"; + String wc = " where id_userProfile !=1"; + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findUserProfiles(String policy) { + String s_Sql_Find = "select A.* from USER_PROFILE AS A"; + String wc = ""; + wc = managePolicyFind(policy, wc); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione; + } + + public long getId_userProfile() { + return this.id_userProfile; + } + + public String getPolicy() { + if (getId_userProfile() == 1L) + return "*"; + return (this.policy == null) ? "#" : this.policy; + } + + protected String managePolicyFind(String policy, String l_wc) { + if (policy.equals("#") || policy.isEmpty()) { + l_wc = buildWc(l_wc, "A.id_userProfile is null"); + } else if (!policy.equals("*")) { + StringTokenizer st = new StringTokenizer(policy, ","); + String l_wcOr = ""; + while (st.hasMoreTokens()) { + if (!l_wcOr.isEmpty()) { + l_wcOr = l_wcOr + " or id_userProfile=" + l_wcOr; + continue; + } + l_wcOr = " id_userProfile=" + st.nextToken(); + } + l_wc = buildWc(l_wc, "(" + l_wcOr + ")"); + } + return l_wc; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setId_userProfile(long newId_profiloUtente) { + this.id_userProfile = newId_profiloUtente; + } + + public void setPolicy(String newPolicy) { + this.policy = newPolicy; + } + + protected void setPrimaryKey(long newPrimaryKey) { + setId_userProfile(newPrimaryKey); + } + + protected boolean isUseSafeUpdate() { + return true; + } + + public Vectumerator findByCR(UserProfileCR CR, int pageNumber, int pageRows) { + return findAll(); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserProfileCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserProfileCR.java new file mode 100644 index 00000000..0e741f80 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserProfileCR.java @@ -0,0 +1,22 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class UserProfileCR extends CRAdapter { + private String descrizioneS; + + public UserProfileCR() {} + + public UserProfileCR(ApplParmFull newAp) { + super(newAp); + } + + public String getDescrizioneS() { + return (this.descrizioneS == null) ? AB_EMPTY_STRING : this.descrizioneS.trim(); + } + + public void setDescrizioneS(String descrizioneS) { + this.descrizioneS = descrizioneS; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserWhitelist.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserWhitelist.java new file mode 100644 index 00000000..0aa49c8a --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserWhitelist.java @@ -0,0 +1,109 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class UserWhitelist extends DBAdapter implements Serializable { + private long id_userWhitelist; + + private long id_whitelist; + + private long id_users; + + private Whitelist whitelist; + + private Users users; + + public UserWhitelist(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public UserWhitelist() {} + + public void setId_userWhitelist(long newId_usersWhitelist) { + this.id_userWhitelist = newId_usersWhitelist; + } + + public void setId_whitelist(long newId_whitelist) { + this.id_whitelist = newId_whitelist; + setWhitelist(null); + } + + public void setId_users(long newId_users) { + this.id_users = newId_users; + setUsers(null); + } + + public long getId_userWhitelist() { + return this.id_userWhitelist; + } + + public long getId_whitelist() { + return this.id_whitelist; + } + + public long getId_users() { + return this.id_users; + } + + public void setWhitelist(Whitelist newWhitelist) { + this.whitelist = newWhitelist; + } + + public Whitelist getWhitelist() { + this.whitelist = (Whitelist)getSecondaryObject((DBAdapter)this.whitelist, Whitelist.class, + + getId_whitelist()); + return this.whitelist; + } + + public void setUsers(Users newUsers) { + this.users = newUsers; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, + + getId_users()); + return this.users; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(UserWhitelistCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from USERS_WHITELIST AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserWhitelistCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserWhitelistCR.java new file mode 100644 index 00000000..57982587 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UserWhitelistCR.java @@ -0,0 +1,71 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; + +public class UserWhitelistCR extends CRAdapter { + private long id_userWhitelist; + + private long id_whitelist; + + private long id_users; + + private Whitelist whitelist; + + private Users users; + + public UserWhitelistCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public UserWhitelistCR() {} + + public void setId_userWhitelist(long newId_usersWhitelist) { + this.id_userWhitelist = newId_usersWhitelist; + } + + public void setId_whitelist(long newId_whitelist) { + this.id_whitelist = newId_whitelist; + setWhitelist(null); + } + + public void setId_users(long newId_users) { + this.id_users = newId_users; + setUsers(null); + } + + public long getId_userWhitelist() { + return this.id_userWhitelist; + } + + public long getId_whitelist() { + return this.id_whitelist; + } + + public long getId_users() { + return this.id_users; + } + + public void setWhitelist(Whitelist newWhitelist) { + this.whitelist = newWhitelist; + } + + public Whitelist getWhitelist() { + this.whitelist = (Whitelist)getSecondaryObject((DBAdapter)this.whitelist, Whitelist.class, + + getId_whitelist()); + return this.whitelist; + } + + public void setUsers(Users newUsers) { + this.users = newUsers; + } + + public Users getUsers() { + this.users = (Users)getSecondaryObject((DBAdapter)this.users, Users.class, + + getId_users()); + return this.users; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Users.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Users.java new file mode 100644 index 00000000..aa3c237b --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Users.java @@ -0,0 +1,2466 @@ +package it.acxent.common; + +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.DBAdapterException; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.log.Log; +import it.acxent.log.LogCR; +import it.acxent.mail.MailMessage; +import it.acxent.pre.Presenza; +import it.acxent.util.AbMessages; +import it.acxent.util.FileMailingListManager; +import it.acxent.util.LdapCredential; +import it.acxent.util.PasswordPolicy; +import it.acxent.util.RandomString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.io.Serializable; +import java.net.URLEncoder; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.Hashtable; +import java.util.Locale; +import java.util.Vector; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class Users extends DBAdapter implements UsersI, AddImgInterface, Serializable { + private static final long serialVersionUID = -6889158764928498295L; + + public static final long SOCIAL_LOGIN_TYPE_GOOGLE = 0L; + + public static final long SOCIAL_LOGIN_TYPE_FACEBOOK = 1L; + + public static final String OLD_PWD_SEP = "|"; + + public static final String PWD_SPECIAL_CHAR = "@#$%-_!?^"; + + public static final long CHECK_LOGIN_OK = 5L; + + public static final long CHECK_LOGIN_KO = 0L; + + public static final long CHECK_LOGIN_CHANGE_PWD = 6L; + + public static final String NEW_PASSWORD_CHANGE_DEFAULT_PAGE = "newpassword.jsp"; + + public static final long ID_USER_PROFILE_UTENTE_STANDARD = 11L; + + public static final long MAILING_LIST_OK = 0L; + + public static final long MAILING_LIST_ERR_EMAIL_DUP_WEB = 1L; + + public static final long MAILING_LIST_ERR_EMAIL_DUP_ML = 2L; + + public static final long MAILING_LIST_RECORD_ERROR = 9L; + + private String controlCode; + + private String style; + + private String cognome; + + private Date dataFineVld; + + private Date dataScadenzaPwd; + + private Date dataInizioVld; + + private String eMail; + + private String flgValido; + + private long id_userProfile; + + private long id_users; + + private long flgPresenza; + + private String lang; + + private Hashtable htAccess; + + private String login; + + private String nome; + + private String pwd; + + private UserProfile userProfile; + + private Parm parm; + + private String currentIp; + + private String createIp; + + private Date dataInserimento; + + private String oldPwd; + + private String pwdCrypt; + + private long id_postazione; + + private Postazione postazione; + + private String secretKey; + + private String citta; + + private String codFisc; + + private String indirizzo; + + private String nominativo; + + private String numeroCivico; + + private String pIva; + + private String provincia; + + private String telefono; + + private String capSped; + + private String cittaSped; + + private String contatto; + + private long flgMl; + + private long flgPrivComunicazione; + + private long flgPrivSensibili; + + private long flgPrivTrattamento; + + private String langMl; + + private String numeroCivicoSped; + + private String provinciaSped; + + private String indirizzoSped; + + private String presso; + + private long flgSesso; + + private String fax; + + private String cell; + + private String nota; + + private long flgChangeLog; + + private Time oraInserimento; + + private Date dataCreazionePwd; + + private long flgEmailOk; + + private String imgProfilo; + + private Date dataNascita; + + private String cittaNascita; + + private String provinciaNascita; + + private long flgCondizioni; + + private String elencoIpAbilitati; + + private String pwdSuper; + + private long flgSuper; + + private long flgUsaDomainController; + + private String utenteDominio; + + private String cap; + + private String codiceAlt; + + private String socialId; + + private long flgSocialIdType; + + private long flgNoStatusMsg; + + private Timestamp tsInvioMailRecupero; + + private String currentHostname; + + public ResParm addAccess(UserAccess row) { + UserAccess bean = new UserAccess(getApFull()); + bean.findByUserAccess(row.getId_users(), row.getId_access()); + bean.setFlgRW(row.getFlgRW()); + bean.setId_users(getId_users()); + bean.setId_access(row.getId_access()); + return bean.save(); + } + + public ResParm delAccess(UserAccess row) { + UserAccess bean = new UserAccess(getApFull()); + if (row.getId_userAccess() > 0L) { + bean.findByPrimaryKey(row.getId_userAccess()); + } else { + bean.findByUserAccess(row.getId_users(), row.getId_access()); + } + return bean.delete(); + } + + public long getGrantType(String l_id_permesso) { + return getGrantType(l_id_permesso, true); + } + + public long getGrantType(String l_id_permesso, boolean adminAlwaysYes) { + if (getId_users() == 1L && getParm("CREATE_GRANT").isTrue()) + ResParm resParm = new Access(getApFull()).addAccess(l_id_permesso); + if (getId_users() == 0L) + return 0L; + if (getId_users() == 1L || (getId_userProfile() == 1L && adminAlwaysYes)) + return 4L; + return getGrantType(getHtAccess(), l_id_permesso); + } + + public long getGrantTypeDb(String l_id_permesso) { + if (getParm("CREATE_GRANT").isTrue()) + new Access(getApFull()).addAccess(l_id_permesso); + if (getId_users() == 0L) + return 0L; + if (getId_userProfile() == 1L) + return 4L; + if (getParm("GRANT").getNumeroInt() == 0) + return 4L; + UserAccess up = new UserAccess(getApFull()); + up.findByUserAccess(getId_users(), l_id_permesso); + if (up.getDBState() == 1) + return up.getFlgRW(); + UserAccessGroup uag = new UserAccessGroup(getApFull()); + uag.findByAccessUser(l_id_permesso, getId_users()); + if (uag.getDBState() == 1) + return uag.getAccessGroup().getFlgRW(l_id_permesso); + return 0L; + } + + public Users() {} + + public Users(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + @Deprecated + public Users checkLogonUtenteOld(String l_login, String l_password, String l_ip) { + Users theUser = null; + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A "; + try { + String wc = "where login=? and pwd=? and flgValido='S' and dataFineVld is null"; + PreparedStatement ps = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + ps.setString(1, l_login); + ps.setString(2, l_password); + theUser = (Users)getFirstRecord(ps); + } catch (DBAdapterException dbae) { + handleDebug(dbae); + removeCPConnection(); + } catch (SQLException sqle) { + if (sqle.getSQLState() == "08S01") + removeCPConnection(); + handleDebug(sqle, 0); + } + return theUser; + } + + public ResParm findLogonUtenteSso(String l_login, String l_ip) { + ResParm rp = new ResParm(true); + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A "; + try { + String wc = "where login=? "; + PreparedStatement ps = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + ps.setString(1, l_login); + findFirstRecord(ps); + if (getId_users() == 0L) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginErrato(getApFull(), l_ip, "login SSO: " + l_login); + } else if (getDataFineVld() != null) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginCancellato(getApFull(), l_ip, getId_users(), getDataFineVld()); + } else if (getFlgValido().equals("N")) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginNonValido(getApFull(), l_ip, getId_users()); + } else if (getId_users() != 1L && getParm("BLACKLIST_EMAIL_ENABLE").isTrue()) { + Blacklist bl = new Blacklist(getApFull()); + bl.findByEmail(getEMail()); + if ((long)bl.getDBState() == 1L) { + rp.setMsg( + AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL") + ": your email address is blacklisted!"); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginBlacklisted(getApFull(), l_ip, getId_users(), bl.getId_blacklist()); + } else if (isUseLogAccess()) { + Log.addLogin(getApFull(), l_ip, getId_users()); + } + } else if (isUseLogAccess()) { + Log.addLogin(getApFull(), l_ip, getId_users()); + } + } catch (DBAdapterException dbae) { + handleDebug(dbae); + removeCPConnection(); + } catch (SQLException sqle) { + if (sqle.getSQLState() == "08S01") + removeCPConnection(); + handleDebug(sqle, 0); + } + return rp; + } + + public void logOff(String l_ip) { + if (isUseLogAccess()) + Log.addLogout(getApFull(), l_ip, getId_users()); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(UsersCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + String s_Sql_order = " order by A.cognome, A.nome"; + WcString wc = new WcString(); + wc.addWc("dataFineVld is null"); + wc = managePolicyFind(CR, wc); + if (!CR.isCode1()) + wc.addWc("A.id_users <>1"); + if (!CR.getFlgValido().isEmpty()) + wc.addWc("A.flgValido='" + CR.getFlgValido() + "'"); + if (CR.getFlgPresenza() == 0L) { + wc.addWc("(A.flgPresenza is null or A.flgPresenza=0)"); + } else if (CR.getFlgPresenza() == 1L) { + wc.addWc("A.flgPresenza =1"); + } + if (CR.getFlgMl() == 0L) { + wc.addWc("(A.flgMl is null or A.flgMl=0)"); + } else if (CR.getFlgMl() == 1L) { + wc.addWc("A.flgMl =1"); + } + if (CR.getFlgControlCode() == 0L) { + wc.addWc("(A.controlCode is null or A.controlCode='')"); + } else if (CR.getFlgMl() == 1L) { + wc.addWc("(A.controlCode is not null and A.controlCode!='')"); + } + if (!CR.getTxtRicerca().trim().isEmpty()) { + String temp = CR.getTxtRicerca().trim().replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp, " "); + StringBuffer txt = new StringBuffer("("); + int countToken = 0; + while (st.hasMoreTokens()) { + String token = prepareSqlString(st.nextToken()); + countToken++; + if (countToken > 1) + token = "%" + token; + txt.append("(A.nome like'%" + token + "%' or A.cognome like'%" + token + "%' or A.login like'%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (!CR.getSearchTxt().trim().isEmpty()) { + String temp = CR.getSearchTxt().trim().replace("*", "%"); + StringTokenizer st = new StringTokenizer(temp, " "); + StringBuffer txt = new StringBuffer("("); + int countToken = 0; + while (st.hasMoreTokens()) { + String token = prepareSqlString(st.nextToken()); + countToken++; + if (countToken > 1) + token = "%" + token; + txt.append("(A.nome like'%" + token + "%' or A.cognome like'%" + token + "%' or A.login like'%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (!CR.getEMail().isEmpty()) + wc.addWc("A.eMail like '%" + CR.getEMail() + "%'"); + if (!CR.getLogin().isEmpty()) + wc.addWc("A.login like '%" + CR.getLogin() + "%'"); + if (CR.getId_userProfile() != 0L) + wc.addWc("A.id_userProfile=" + CR.getId_userProfile()); + if (CR.getId_usersS() != 0L) + wc.addWc("A.id_users=" + CR.getId_usersS()); + if (CR.getLastUpdTmst() != null) + wc.addWc("A.lastUpdTmst>?"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + if (CR.getLastUpdTmst() != null) + stmt.setTimestamp(1, CR.getLastUpdTmst()); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator getUserAccess(int pageNumber, int pageRows) { + return new UserAccess(getApFull()).findAccesssByUser(getId_users(), pageNumber, pageRows); + } + + public Vectumerator getUserAccessGroup(int pageNumber, int pageRows) { + return new UserAccessGroup(getApFull()).findByUser(getId_users(), pageNumber, pageRows); + } + + public void findUsersByLogin(String theLogin) { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + String wc = " where dataFineVld is null"; + wc = buildWc(wc, "A.id_users <>1"); + wc = buildWc(wc, "A.flgValido='S'"); + if (!theLogin.isEmpty()) + wc = buildWc(wc, "A.login='" + theLogin + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt, true); + } catch (Exception e) { + handleDebug(e); + } + } + + public void findUsersByControlCode(String theControlCode) { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + WcString wc = new WcString(); + wc.addWc("dataFineVld is null"); + wc.addWc("A.id_users <>1"); + wc.addWc("A.controlCode='" + theControlCode + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt, true); + } catch (Exception e) { + handleDebug(e); + } + } + + public void findUsersByControlCodeEmail(String theControlCode, String theEmail) { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + WcString wc = new WcString(); + wc.addWc("dataFineVld is null"); + wc.addWc("A.id_users <>1"); + wc.addWc("A.controlCode='" + theControlCode + "'"); + wc.addWc("A.eMail='" + theEmail + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt, true); + } catch (Exception e) { + handleDebug(e); + } + } + + public void findUsersByEmail(String theEMail) { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + WcString wc = new WcString(); + wc.addWc("dataFineVld is null"); + wc.addWc("A.id_users <>1"); + if (!theEMail.isEmpty()) + wc.addWc("A.eMail='" + theEMail + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e); + } + } + + public void findUsersBySocialId(String l_socialId, long l_flgSocialIdType) { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + WcString wc = new WcString(); + wc.addWc("dataFineVld is null"); + wc.addWc("A.id_users <>1"); + if (!l_socialId.isEmpty()) + wc.addWc("A.socialId='" + l_socialId + "'"); + if (l_flgSocialIdType == 0L) { + wc.addWc("(A.flgSocialIdType is null or A.flgSocialIdType =0)"); + } else if (l_flgSocialIdType > 0L) { + wc.addWc("A.flgSocialIdType=" + l_flgSocialIdType); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e); + } + } + + public void findUsersByCodiceFiscale(String l_codFisc) { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + WcString wc = new WcString(); + wc.addWc("dataFineVld is null"); + wc.addWc("A.id_users <>1"); + if (!l_codFisc.isEmpty()) + wc.addWc("A.codFisc='" + l_codFisc + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e); + } + } + + public void findUsersByPartitaIva(String l_pIva) { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + WcString wc = new WcString(); + wc.addWc("dataFineVld is null"); + wc.addWc("A.id_users <>1"); + if (!l_pIva.isEmpty()) + wc.addWc("A.pIva='" + l_pIva + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e); + } + } + + public Vectumerator findUsersByProfileMax(long l_id_profiloUtente) { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + String s_Sql_order = " order by A.cognome, A.nome"; + String wc = " where dataFineVld is null"; + wc = buildWc(wc, "A.id_users <>1"); + wc = buildWc(wc, "A.flgValido='S'"); + if (l_id_profiloUtente != 0L) + wc = buildWc(wc, "A.id_userProfile<=" + l_id_profiloUtente); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findUsersPresenze() { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + String s_Sql_order = " order by A.cognome, A.nome"; + String wc = " where dataFineVld is null"; + wc = buildWc(wc, "A.id_users <>1"); + wc = buildWc(wc, "A.flgPresenza=1"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findUsersByProfileNomeCognome(long l_id_profiloUtente, String theNome, String theCognome) { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + String s_Sql_order = " order by A.cognome, A.nome"; + String wc = " where dataFineVld is null"; + wc = buildWc(wc, "A.id_users <>1"); + wc = buildWc(wc, "A.flgValido='S'"); + if (l_id_profiloUtente != 0L) + wc = buildWc(wc, "A.id_userProfile=" + l_id_profiloUtente); + if (!theNome.isEmpty()) + wc = buildWc(wc, "A.nome like'" + theNome + "%'"); + if (!theCognome.isEmpty()) + wc = buildWc(wc, "A.cognome like'" + theCognome + "%'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + return findRows(stmt); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findUsersByProfileText(long l_id_profiloUtente, String testoLibero, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + String s_Sql_order = " order by A.cognome, A.nome"; + String wc = " where dataFineVld is null"; + wc = buildWc(wc, "A.id_users <>1"); + wc = buildWc(wc, "A.flgValido='S'"); + if (l_id_profiloUtente != 0L) + wc = buildWc(wc, "A.id_userProfile=" + l_id_profiloUtente); + if (!testoLibero.isEmpty()) + wc = buildWc(wc, "(A.nome like'" + testoLibero + "%' or A.cognome like'" + testoLibero + "%')"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + return findRows(stmt, pageNumber, pageRows); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getControlCode() { + return (this.controlCode == null) ? "" : this.controlCode; + } + + public String getCognome() { + return (this.cognome == null) ? "" : this.cognome.trim(); + } + + public String getDescrizione() { + return getCognomeNome(); + } + + public String getCognomeNome() { + return getCognome() + " " + getCognome(); + } + + public Date getDataFineVld() { + return this.dataFineVld; + } + + public Date getDataInizioVld() { + return this.dataInizioVld; + } + + public String getEMail() { + return (this.eMail == null) ? "" : this.eMail.trim(); + } + + public String getFlgValido() { + return (this.flgValido == null) ? "N" : this.flgValido; + } + + public long getId_userProfile() { + return this.id_userProfile; + } + + public long getId_users() { + return this.id_users; + } + + public String getLangUser() { + return getLang(); + } + + public String getLang() { + if (this.lang == null || this.lang.equals("")) + this.lang = Locale.ITALY.getCountry().toLowerCase(); + return this.lang; + } + + public String getLogin() { + return (this.login == null) ? "" : this.login.trim(); + } + + public String getNomeSigla() { + if (getNome().isEmpty()) + return ""; + return getNome().substring(0, 1).toUpperCase(); + } + + public String getNomeCognome() { + return getNome() + " " + getNome(); + } + + public String getPwd() { + return (this.pwd == null) ? "" : this.pwd.trim(); + } + + protected long getPrimaryKey() { + return getId_users(); + } + + public UserProfile getUserProfile() { + if (this.userProfile == null && getId_userProfile() != 0L) + try { + this.userProfile = new UserProfile(getApFull()); + this.userProfile.findByPrimaryKey(new Long(getId_userProfile())); + } catch (Exception e) {} + return (this.userProfile == null) ? new UserProfile() : this.userProfile; + } + + public boolean hasRights(long l_id_profiloUtente) { + return getUserProfile().checkRights(l_id_profiloUtente); + } + + public boolean isDeleteLogic() { + return true; + } + + public boolean isUseControCodeAccess() { + return (getParm("USE_CONTROL_CODE_ACCESS").getNumeroLong() == 1L); + } + + protected boolean isUseLogAccess() { + return (getParm("USE_LOG").getNumeroLong() == 1L); + } + + @Deprecated + protected String managePolicyFind(UsersCR CR, String l_wc) { + if (CR.getId_userProfile() != 0L) { + l_wc = buildWc(l_wc, "A.id_userProfile=" + CR.getId_userProfile()); + } else if (CR.getPolicy().equals("#")) { + l_wc = buildWc(l_wc, "A.id_userProfile is null"); + } else if (!CR.getPolicy().equals("*")) { + java.util.StringTokenizer st = new java.util.StringTokenizer(CR.getPolicy(), ","); + String l_wcOr = ""; + while (st.hasMoreTokens()) { + if (!l_wcOr.isEmpty()) { + l_wcOr = l_wcOr + " or id_userProfile=" + l_wcOr; + continue; + } + l_wcOr = " id_userProfile=" + st.nextToken(); + } + l_wc = buildWc(l_wc, "(" + l_wcOr + ")"); + } + return l_wc; + } + + public void setControlCode(String newCodiceControllo) { + this.controlCode = newCodiceControllo; + } + + public void setCognome(String newCognome) { + this.cognome = newCognome; + } + + public void setDataFineVld(Date newDataFineVld) { + this.dataFineVld = newDataFineVld; + } + + public void setDataInizioVld(Date newDataInizioVld) { + this.dataInizioVld = newDataInizioVld; + } + + public void setEMail(String newEMail) { + this.eMail = newEMail; + } + + public void setFlgValido(String newFlgValido) { + if (newFlgValido.equals("0")) { + this.flgValido = "N"; + } else if (newFlgValido.equals("1")) { + this.flgValido = "S"; + } else { + this.flgValido = newFlgValido; + } + } + + public void setId_userProfile(long newId_profiloUtente) { + this.id_userProfile = newId_profiloUtente; + setUserProfile(null); + } + + public void setId_users(long newId_utente) { + this.id_users = newId_utente; + } + + public void setLang(String newLang) { + this.lang = newLang; + } + + public void setLogin(String newLogin) { + this.login = newLogin; + } + + public void setNome(String newNome) { + this.nome = newNome; + } + + public void setPwd(String newPassword) { + this.pwd = newPassword; + } + + public void setUserProfile(UserProfile newProfiloUtente) { + this.userProfile = newProfiloUtente; + } + + public String getStyle() { + return (this.style == null) ? "" : this.style; + } + + public void setStyle(String string) { + this.style = string; + } + + public Vectumerator findAll(UsersCR CR) { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + String s_Sql_order = " order by A.cognome, A.nome"; + String wc = " where dataFineVld is null"; + if (!CR.isCode1()) + wc = buildWc(wc, "A.id_users <>1"); + if (!CR.getFlgValido().isEmpty()) + wc = buildWc(wc, "A.flgValido='" + CR.getFlgValido() + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + return findRows(stmt, 0, 0); + } catch (Exception e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Parm getParm(long theKey) { + if (this.parm == null) + this.parm = new Parm(getApFull()); + try { + this.parm.findByPrimaryKey(new Long(theKey)); + return this.parm; + } catch (Exception e) { + handleDebug(e); + return this.parm; + } + } + + public boolean isLogonDuplicated() { + String s_Sql_Find = "select * from " + getTableBeanName() + " AS A "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.login='" + getLogin() + "'"); + wc.addWc("A.id_users !=" + getId_users()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + DBAdapter bean = (DBAdapter)getFirstRecord(stmt); + if (bean != null && bean.getDBState() == 1) + return true; + return false; + } catch (Exception e) { + handleDebug(e); + return true; + } + } + + public boolean isEmailDuplicated() { + String s_Sql_Find = "select * from " + getTableBeanName() + " AS A "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.eMail='" + getEMail() + "'"); + wc.addWc("A.id_users !=" + getId_users()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + DBAdapter bean = (DBAdapter)getFirstRecord(stmt); + if (bean != null && bean.getDBState() == 1) + return true; + return false; + } catch (Exception e) { + handleDebug(e); + return true; + } + } + + public Vectumerator getLogs(LogCR CR, int pageNumber, int pageRows) { + CR.setId_users(getId_users()); + return new Log(getApFull()).findByCR(CR, pageNumber, pageRows); + } + + public ResParm addLog(Log row) { + Log bean = new Log(getApFull()); + if (row.getId_log() > 0L) { + bean.findByPrimaryKey(row.getId_log()); + if (bean != null) { + row.setDBState(bean.getDBState()); + } else { + row.setDBState(0); + } + } + row.setId_users(getId_users()); + return row.save(); + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + if (getDBState() == 0 && isUseControCodeAccess()) + setControlCode(String.valueOf((long)(Math.random() * 1.0E8D))); + if (getDataInserimento() == null) { + setDataInserimento(getToday()); + Calendar cal = Calendar.getInstance(); + setOraInserimento(new Time(cal.getTimeInMillis())); + setCreateIp(getReqIpAddress()); + } + setCurrentIp(getReqIpAddress()); + super.prepareSave(ps); + } + + public ResParm addAccessGroup(UserAccessGroup row) { + UserAccessGroup bean = new UserAccessGroup(getApFull()); + bean.findByPrimaryKey(row.getId_userAccessGroup()); + if (bean != null) + row.setDBState(bean.getDBState()); + row.setId_users(getId_users()); + return row.save(); + } + + public ResParm delAccessGroup(UserAccessGroup row) { + UserAccessGroup bean = new UserAccessGroup(getApFull()); + bean.findByPrimaryKey(row.getId_userAccessGroup()); + return bean.delete(); + } + + public Hashtable getHtAccess() { + if (this.htAccess == null && getId_users() != 0L) { + this.htAccess = new Hashtable<>(); + UserAccess ua = new UserAccess(getApFull()); + Vectumerator vec = ua.findAccesssByUser(getId_users(), 0, 0); + while (vec.hasMoreElements()) { + UserAccess row = vec.nextElement(); + String l_access = row.getAccess().getId_access(); + Long l_rw = new Long(row.getFlgRW()); + if (!this.htAccess.containsKey(l_access)) + this.htAccess.put(l_access, l_rw); + } + UserAccessGroup uag = new UserAccessGroup(getApFull()); + AccessGroupAccess aga = new AccessGroupAccess(getApFull()); + vec = uag.findByUser(getId_users(), 0, 0); + while (vec.hasMoreElements()) { + UserAccessGroup row = (UserAccessGroup)vec.nextElement(); + Vectumerator vecAga = aga.findByAccessGroup(row.getId_accessGroup(), 0, 0); + while (vecAga.hasMoreElements()) { + AccessGroupAccess rowAga = vecAga.nextElement(); + String l_access = rowAga.getAccess().getId_access(); + Long l_rw = new Long(rowAga.getFlgRW()); + if (!this.htAccess.containsKey(l_access)) { + this.htAccess.put(l_access, l_rw); + continue; + } + Long l_rwRec = this.htAccess.get(l_access); + if (l_rwRec < l_rw) + this.htAccess.put(l_access, l_rw); + } + } + } + return this.htAccess; + } + + public void setHtAccess(Hashtable htAccess) { + this.htAccess = htAccess; + } + + public static long getGrantType(Hashtable ht, String l_id_permesso) { + if (ht != null) { + if (ht.containsKey(l_id_permesso)) { + Long l_rw = ht.get(l_id_permesso); + return l_rw; + } + return 0L; + } + return 4L; + } + + public long getFlgPresenza() { + return this.flgPresenza; + } + + public void setFlgPresenza(long flgPresenza) { + this.flgPresenza = flgPresenza; + } + + public Date getDataInserimento() { + return this.dataInserimento; + } + + public void setDataInserimento(Date dataInserimento) { + this.dataInserimento = dataInserimento; + } + + public ResParm delAllLogs() { + if (getId_users() > 0L) + return Log.delUserLog(getApFull(), getId_users()); + return new ResParm(false, "ERRORE! Id_users <=0"); + } + + public long getNextMovValido() { + Presenza bean = getUltimoMovimento(); + if (bean.getDBState() == 0) + return 1L; + if (bean.getFlgIngressoUscita() == 1L) + return 2L; + return 1L; + } + + public Presenza getUltimoMovimento() { + Presenza bean = new Presenza(getApFull()); + return bean.getUltimoMovimentoByUsersData(getId_users(), getToday()); + } + + public String getCurrentIp() { + return (this.currentIp == null) ? "" : this.currentIp.trim(); + } + + public void setCurrentIp(String currentIp) { + this.currentIp = currentIp; + } + + public String getCreateIp() { + return (this.createIp == null) ? "" : this.createIp.trim(); + } + + public void setCreateIp(String createIp) { + this.createIp = createIp; + } + + public void initApplicationParms(ApplParmFull ap) { + if (ap != null); + } + + protected String sqlStringfindAll() { + return "select * from USERS as A where A.id_users <>1 order by A.cognome, A.nome"; + } + + public Date getDataScadenzaPwd() { + return this.dataScadenzaPwd; + } + + public void setDataScadenzaPwd(Date dataScadenzaPwd) { + this.dataScadenzaPwd = dataScadenzaPwd; + } + + public String getOldPwd() { + return (this.oldPwd == null) ? "" : this.oldPwd.trim(); + } + + public void setOldPwd(String oldPwd) { + this.oldPwd = oldPwd; + } + + public String getPwdCrypt() { + return (this.pwdCrypt == null) ? "" : this.pwdCrypt.trim(); + } + + public void setPwdCrypt(String pwdCrypt) { + this.pwdCrypt = pwdCrypt; + } + + public long getId_postazione() { + return this.id_postazione; + } + + public PostazioneI getPostazione() { + this.postazione = (Postazione)getSecondaryObject((DBAdapter)this.postazione, Postazione.class, getId_postazione()); + return this.postazione; + } + + public void setId_postazione(long id_postazione) { + this.id_postazione = id_postazione; + setPostazione(null); + } + + public void setPostazione(Postazione postazione) { + this.postazione = postazione; + } + + public static final ResParm updateAllPwdCrypt(ApplParmFull ap) { + Users bean = new Users(ap); + long flgCrypt = bean.getParm("PWD_CRYPT").getNumeroLong(); + ResParm rp = new ResParm(true); + if (flgCrypt > 0L) { + bean.findByPrimaryKey(1L); + String plainPwd = bean.getPwd(); + String newPwd = ap.getEncryptedPassword(plainPwd); + bean.setPwd(newPwd); + rp = bean.save(); + if (rp.getStatus()) { + Vectumerator vec = bean.findAll(); + while (vec.hasMoreElements()) { + Users row = (Users)vec.nextElement(); + if (!row.getPwd().isEmpty()) { + plainPwd = row.getPwd(); + newPwd = ap.getEncryptedPassword(plainPwd); + row.setPwd(newPwd); + row.setPwdCrypt(plainPwd); + rp.append(row.save()); + if (!rp.getStatus()) + break; + } + } + } + } else { + rp.setMsg("Plain Password!!"); + } + return rp; + } + + public Date getDataCreazionePwd() { + return this.dataCreazionePwd; + } + + public void setDataCreazionePwd(Date dataCreazionePwd) { + this.dataCreazionePwd = dataCreazionePwd; + } + + public String getCap() { + return (this.cap == null) ? "" : this.cap; + } + + public String getCitta() { + return (this.citta == null) ? "" : this.citta; + } + + public String getCodFisc() { + return (this.codFisc == null) ? "" : this.codFisc; + } + + public String getIndirizzo() { + return (this.indirizzo == null) ? "" : this.indirizzo; + } + + public String getNominativo() { + return (this.nominativo == null) ? "" : this.nominativo; + } + + public String getNumeroCivico() { + return (this.numeroCivico == null) ? "" : this.numeroCivico; + } + + public String getPIva() { + return (this.pIva == null) ? "" : this.pIva; + } + + public String getProvincia() { + return (this.provincia == null) ? "" : this.provincia; + } + + public String getTelefono() { + return (this.telefono == null) ? "" : this.telefono; + } + + public String getCapSped() { + return (this.capSped == null) ? "" : this.capSped; + } + + public String getCittaSped() { + return (this.cittaSped == null) ? "" : this.cittaSped; + } + + public String getIndirizzoSped() { + return (this.indirizzoSped == null) ? "" : this.indirizzoSped; + } + + public String getNumeroCivicoSped() { + return (this.numeroCivicoSped == null) ? "" : this.numeroCivicoSped; + } + + public String getProvinciaSped() { + return (this.provinciaSped == null) ? "" : this.provinciaSped; + } + + public String getContatto() { + return (this.contatto == null) ? "" : this.contatto.trim(); + } + + public void setContatto(String contatto) { + this.contatto = contatto; + } + + public long getFlgMl() { + return this.flgMl; + } + + public void setFlgMl(long flgMl) { + this.flgMl = flgMl; + } + + public long getFlgPrivComunicazione() { + return this.flgPrivComunicazione; + } + + public void setFlgPrivComunicazione(long flgPrivComunicazione) { + this.flgPrivComunicazione = flgPrivComunicazione; + } + + public long getFlgPrivSensibili() { + return this.flgPrivSensibili; + } + + public void setFlgPrivSensibili(long flgPrivSensibili) { + this.flgPrivSensibili = flgPrivSensibili; + } + + public long getFlgPrivTrattamento() { + return this.flgPrivTrattamento; + } + + public void setFlgPrivTrattamento(long flgPrivTrattamento) { + this.flgPrivTrattamento = flgPrivTrattamento; + } + + public String getLangMl() { + return (this.langMl == null) ? "" : this.langMl; + } + + public void setLangMl(String langMl) { + this.langMl = langMl; + } + + public void setCap(String cap) { + this.cap = cap; + } + + public void setCitta(String citta) { + this.citta = citta; + } + + public void setCodFisc(String codFisc) { + this.codFisc = codFisc; + } + + public void setIndirizzo(String indirizzo) { + this.indirizzo = indirizzo; + } + + public void setNominativo(String nominativo) { + this.nominativo = nominativo; + } + + public void setPIva(String iva) { + this.pIva = iva; + } + + public void setProvincia(String provincia) { + this.provincia = provincia; + } + + public void setTelefono(String telefono) { + this.telefono = telefono; + } + + public void setCapSped(String capSped) { + this.capSped = capSped; + } + + public void setCittaSped(String cittaSped) { + this.cittaSped = cittaSped; + } + + public void setNumeroCivicoSped(String numeroCivicoSped) { + this.numeroCivicoSped = numeroCivicoSped; + } + + public void setProvinciaSped(String provinciaSped) { + this.provinciaSped = provinciaSped; + } + + public void setIndirizzoSped(String indirizzoSped) { + this.indirizzoSped = indirizzoSped; + } + + protected String getUserMailMessage(String lang) { + if (lang != null && lang.isEmpty()) + lang = "it"; + String temp = getDocBase() + getDocBase(); + if (lang != null && !lang.isEmpty()) { + int dot = temp.lastIndexOf("."); + if (dot > 0) + temp = temp.substring(0, dot) + "_" + temp.substring(0, dot) + lang.toLowerCase(); + } + return temp; + } + + public String getPresso() { + return (this.presso == null) ? "" : this.presso.trim(); + } + + public void setPresso(String presso) { + this.presso = presso; + } + + public long getFlgSesso() { + return this.flgSesso; + } + + public void setFlgSesso(long flgSesso) { + this.flgSesso = flgSesso; + } + + public boolean isCodFiscDuplicated() { + if (!getCodFisc().isEmpty()) { + String s_Sql_Find = "select * from USERS AS A "; + String s_Sql_Order = ""; + String wc = ""; + wc = buildWc(wc, "A.codFisc='" + getCodFisc() + "'"); + wc = buildWc(wc, "A.id_users !=" + getId_users()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + Users bean = (Users)getFirstRecord(stmt); + if (bean != null && bean.getDBState() == 1) + return true; + return false; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + return false; + } + + public boolean isEmailDuplicatedNoMl() { + String s_Sql_Find = "select * from " + getTableBeanName() + " AS A "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.eMail='" + getEMail() + "'"); + wc.addWc("A.id_users !=" + getId_users()); + wc.addWc("A.id_userProfile !=" + getIdUserProfileMailingList()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + DBAdapter bean = (DBAdapter)getFirstRecord(stmt); + if (bean != null && bean.getDBState() == 1) + return true; + return false; + } catch (Exception e) { + handleDebug(e); + return true; + } + } + + public boolean isPIvaCodfiscDuplicated() { + return (isPIvaDuplicated() || isCodFiscDuplicated()); + } + + public boolean isPIvaDuplicated() { + if (!getPIva().isEmpty()) { + String s_Sql_Find = "select * from USERS AS A "; + String s_Sql_Order = ""; + String wc = ""; + wc = buildWc(wc, "A.pIva='" + getPIva() + "'"); + wc = buildWc(wc, "A.id_users !=" + getId_users()); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc); + Users bean = (Users)getFirstRecord(stmt); + if (bean != null && bean.getDBState() == 1) + return true; + return false; + } catch (Exception e) { + handleDebug(e); + return false; + } + } + return false; + } + + public boolean isTodayUser() { + if (getDataInserimento() == null) + return false; + if (getDateDiff(getDataInserimento(), getToday()) > 0L) + return false; + return true; + } + + public ResParm rebuildMl(UsersCR CR) { + ResParm rp = new ResParm(); + synchronized (this) { + String fileIt = getMailingListFile() + "_it"; + String fileEn = getMailingListFile() + "_en"; + FileMailingListManager fmlm_it = FileMailingListManager.getInstance(fileIt); + FileMailingListManager fmlm_en = FileMailingListManager.getInstance(fileEn); + CR.setFlgValido("S"); + CR.setFlgMl(1L); + CR.setFlgControlCode(0L); + CR.setPolicy("*"); + Vectumerator vec = findByCR(CR, 0, 0); + Vector emailVecIt = new Vector<>(); + Vector emailVecEn = new Vector<>(); + int numEmailIt = 0, numEmailEn = 0; + while (vec.hasMoreElements()) { + Users userRow = vec.nextElement(); + if (!userRow.getEMail().isEmpty()) { + if (userRow.getLangMl().equals("it")) { + emailVecIt.add(userRow.getEMail()); + numEmailIt++; + continue; + } + emailVecEn.add(userRow.getEMail()); + numEmailEn++; + } + } + boolean mlRet = fmlm_it.rebuild(emailVecIt); + mlRet = (mlRet && fmlm_en.rebuild(emailVecEn)); + if (!mlRet) { + rp.appendMsg(" Attenzione!! Mailing list non aggiornata. Contattare l'amministratore."); + } else { + rp.appendMsg(" Rebuild Mailing list riuscito con successo. Numero componenti mailing list: " + numEmailIt + " italiano, " + numEmailEn + " inglese"); + } + } + return rp; + } + + public String getMailingListFile() { + return getParm("MAIL_LIST_FILE").getTesto(); + } + + public String getFax() { + return (this.fax == null) ? "" : this.fax.trim(); + } + + public void setFax(String fax) { + this.fax = fax; + } + + public String getCell() { + return (this.cell == null) ? "" : this.cell.trim(); + } + + public void setCell(String cell) { + this.cell = cell; + } + + public void setNumeroCivico(String numeroCivico) { + this.numeroCivico = numeroCivico; + } + + public ResParm sendLostPasswordMailMessage(String lostEmail, String id_profiles) { + return sendLostPasswordMailMessage(lostEmail, getLangMl(), id_profiles); + } + + public ResParm sendLostPasswordMailMessage(String lostEmail, String lang, String id_profiles) { + ResParm rp = new ResParm(true); + try { + if (lang.isEmpty()) + lang = "it"; + Users bean = new Users(getApFull()); + UsersCR CR = new UsersCR(); + CR.setEMail(lostEmail); + bean.findUsersByEmail(lostEmail); + if (bean.getDBState() == 1) { + long minTs = getParm("USER_MIN_MAIL_RECUPERO").getNumeroLong(); + boolean sendMail = false; + if (minTs == 0L) { + sendMail = true; + } else if (bean.getTsInvioMailRecupero() == null) { + sendMail = true; + } else { + long minsDiff = (getNow().getTime() - bean.getTsInvioMailRecupero().getTime()) / 60000L; + if (minsDiff >= minTs) + sendMail = true; + } + if (bean.getPwd().isEmpty()) { + String tempPwd = PasswordPolicy.getRandomPassword(8, false); + bean.setPwd(tempPwd); + bean.save(); + } + if (sendMail) { + MailMessage mf = new MailMessage(getApFull(), getLostPwdMailMessage(lang)); + mf.setQuestionMark(false); + mf.setString("login", bean.getLogin()); + if (bean.isSocialAccount()) { + mf.setString("pwd", bean.getPwd() + " " + bean.getPwd() + " " + translate("oppure tramite", lang) + " social account"); + mf.setString("extra", + translate("Puoi accedere tramite il tuo account", lang) + " " + translate("Puoi accedere tramite il tuo account", lang) + ".
    " + bean.getSocialIdType() + " " + + translate("Se non puoi più accedere al tuo account", lang) + ", " + bean.getSocialIdType()); + } else { + mf.setString("pwd", bean.getPwd()); + } + mf.setString("nominativo", bean.getNominativo()); + mf.setString("nome", bean.getNome()); + mf.setString("cognome", bean.getCognome()); + rp = mf.sendMailMessageSystem(bean.getEMail(), mf.getMailSubject() + " " + mf.getMailSubject() + " ", true); + if (rp.getStatus()) { + bean.setTsInvioMailRecupero(new Timestamp(getNow().getTime())); + bean.save(); + } + } else { + rp.setStatus(false); + rp.setMsg(translate("Impossibile inviare una nuova mail di recupero. Attendere alcuni minuti ...........", lang)); + } + } else { + rp.setStatus(false); + rp.setMsg("Email non in archivio"); + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e.toString() + "\n" + e.toString()); + } + return rp; + } + + public ResParm sendMLMailMessage(String ipAddress, String lang) { + ResParm rp = new ResParm(true); + try { + if (lang.equals("")) + lang = "it"; + MailMessage mf = new MailMessage(getApFull(), getDocBase() + getDocBase()); + mf.setQuestionMark(false); + mf.setString("ip", ipAddress); + java.util.Date d = new java.util.Date(System.currentTimeMillis()); + mf.setString("timestamp", d.toString()); + if (!getControlCode().isEmpty()) { + String codiceConferma = "" + translate("Clicca qui per attivare", getLangMl()) + " "; + mf.setString("codiceConferma", codiceConferma); + } + rp = mf.sendMailMessageSystem(getEMail(), mf.getMailSubject() + " " + mf.getMailSubject(), true); + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e.toString() + "\n" + e.toString()); + } + return rp; + } + + public ResParm sendUserDataMailMessageCrypt(String l_password) { + return sendUserDataMailMessageCrypt(getLang(), l_password); + } + + public ResParm sendUserDataMailMessageCrypt(String lang, String l_password) { + ResParm rp = new ResParm(true); + try { + if (getDBState() == 1) { + String userMailMessage = getUserMailMessage(lang); + if (isUseControCodeAccess() && !getControlCode().isEmpty()) + userMailMessage = userMailMessage.substring(0, userMailMessage.length() - 5) + "CC" + userMailMessage.substring(0, userMailMessage.length() - 5); + MailMessage mf = new MailMessage(getApFull(), userMailMessage); + mf.setQuestionMark(false); + if (!getControlCode().isEmpty()) + mf.setString("controlCode", getControlCode() + "&e=" + getControlCode()); + mf.setString("login", getLogin()); + if (l_password.isEmpty()) { + mf.setString("pwd", "******"); + } else { + mf.setString("pwd", l_password); + } + mf.setString("nominativo", getNominativo()); + mf.setString("nome", getNome()); + mf.setString("cognome", getCognome()); + mf.setString("indirizzo", getIndirizzo()); + mf.setString("numero", getNumeroCivico()); + mf.setString("cap", getCap()); + mf.setString("citta", getCitta()); + mf.setString("provincia", getProvincia()); + mf.setString("codfisc", getCodFisc()); + mf.setString("piva", getPIva()); + mf.setString("email", getEMail()); + mf.setString("nota", getNota()); + if (getIndirizzoSped().trim().isEmpty()) { + if (getPresso().isEmpty()) { + mf.setString("indirizzoSped", getIndirizzo()); + } else { + mf.setString("indirizzoSped", getIndirizzo() + " c/o " + getIndirizzo()); + } + mf.setString("numeroSped", getNumeroCivico()); + mf.setString("capSped", getCap()); + mf.setString("cittaSped", getCitta()); + mf.setString("provinciaSped", getProvincia()); + } else { + if (getPresso().isEmpty()) { + mf.setString("indirizzoSped", getIndirizzoSped()); + } else { + mf.setString("indirizzoSped", getIndirizzoSped() + " c/o " + getIndirizzoSped()); + } + mf.setString("numeroSped", getNumeroCivicoSped()); + mf.setString("capSped", getCapSped()); + mf.setString("cittaSped", getCittaSped()); + mf.setString("provinciaSped", getProvinciaSped()); + } + mf.setString("telefono", getTelefono()); + rp = mf.sendMailMessageSystem(getEMail(), mf.getMailSubject() + mf.getMailSubject(), true); + } else { + rp.setStatus(false); + rp.setMsg("Email non in archivio"); + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e.getMessage()); + } + return rp; + } + + public String getNota() { + return (this.nota == null) ? "" : this.nota.trim(); + } + + public void setNota(String nota) { + this.nota = nota; + } + + protected String getLostPwdMailMessage(String lang) { + if (lang != null && lang.isEmpty()) + lang = "it"; + String temp = getDocBase() + getDocBase(); + if (lang != null && !lang.isEmpty()) { + int dot = temp.lastIndexOf("."); + if (dot > 0) + temp = temp.substring(0, dot) + "_" + temp.substring(0, dot) + lang.toLowerCase(); + } + return temp; + } + + public String getMLMailMessage(String lang) { + String temp = getParm(Parm.P_MLISTMSG).getTesto(); + if (lang != null && !lang.isEmpty()) { + int dot = temp.lastIndexOf("."); + if (dot > 0) + temp = temp.substring(0, dot) + "_" + temp.substring(0, dot) + lang.toLowerCase(); + } + return temp; + } + + public ResParm sendMLMailMessageOLD(String ipAddress) { + return sendMLMailMessage(ipAddress, getLangMl()); + } + + private ResParm findLogonUtenteLDAP(String l_login, String l_password, String l_ip) { + ResParm rp = new ResParm(true); + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A "; + try { + String wc = "where utenteDominio=? and flgUsaDomainController=1"; + PreparedStatement ps = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + ps.setString(1, l_login); + findFirstRecord(ps); + if (getId_users() == 0L) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginErrato(getApFull(), l_ip, "login: " + l_login + " pwd: " + l_password); + } else if (getDataFineVld() != null) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginCancellato(getApFull(), l_ip, getId_users(), getDataFineVld()); + } else if (getFlgValido().equals("N")) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginNonValido(getApFull(), l_ip, getId_users()); + } else if (!isLogonIpAbilitato(l_ip)) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL") + ": your logon ip address is not enabled!"); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginIpNonConsentito(getApFull(), l_ip, getId_users()); + } else if (getId_users() != 1L && getParm("BLACKLIST_EMAIL_ENABLE").isTrue()) { + Blacklist bl = new Blacklist(getApFull()); + bl.findByEmail(getEMail()); + if ((long)bl.getDBState() == 1L) { + rp.setMsg( + AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL") + ": your email address is blacklisted!"); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginBlacklisted(getApFull(), l_ip, getId_users(), bl.getId_blacklist()); + } + } + } catch (DBAdapterException dbae) { + handleDebug(dbae); + removeCPConnection(); + } catch (SQLException sqle) { + if (sqle.getSQLState() == "08S01") + removeCPConnection(); + handleDebug(sqle, 0); + } + if (rp.getStatus()) { + LdapCredential ldc = new LdapCredential(getParm("AUTENTICAZIONE_LDAP_SERVER").getTesto(), + getParm("AUTENTICAZIONE_LDAP_DOM_NAME").getTesto()); + rp = ldc.checkDomainUser(l_login, l_password); + } + return rp; + } + + public long getFlgChangeLog() { + return this.flgChangeLog; + } + + public void setFlgChangeLog(long flgChangeLog) { + this.flgChangeLog = flgChangeLog; + } + + public ResParm setAllChangeLog(long l_flgChangeLog) { + String s_sql = "update USERS SET flgChangeLog=" + l_flgChangeLog; + return update(s_sql); + } + + public void resetChangeLog() { + if (getDBState() == 1) { + setFlgChangeLog(0L); + save(); + } + } + + public String getChangeLog() { + String temp = getParm("CHANGE_LOG_TEXT").getTesto(); + return temp; + } + + public static final String getMovimento(long l_flgIngressoUscita) { + return Log.getMovimento(l_flgIngressoUscita); + } + + public Time getOraInserimento() { + return this.oraInserimento; + } + + public void setOraInserimento(Time oraCreazione) { + this.oraInserimento = oraCreazione; + } + + public long getIdUserProfileMailingList() { + return getParm("USER_PROFILE_ID_MAILING_LIST").getNumeroLong(); + } + + public long getIdUserProfileWww() { + return getParm("USER_PROFILE_ID_WWW").getNumeroLong(); + } + + public long getIdUserProfileNoReg() { + return getParm("USER_PROFILE_ID_NO_REG").getNumeroLong(); + } + + public long getIdUserProfileStandardUser() { + return getParm("USER_PROFILE_ID_STANDARD_USER").getNumeroLong(); + } + + public Vectumerator findStili() { + String stili = getParm("STYLES").getTesto(); + if (stili.isEmpty()) + return new Vectumerator<>(); + Vectumerator res = new Vectumerator<>(); + StringTokenizer st = new StringTokenizer(stili, ","); + while (st.hasMoreTokens()) { + String currentStile = st.nextToken(); + res.add(currentStile); + } + return res; + } + + public void findByEmail(String l_eMail) { + String s_Sql_Find = "select * from USERS AS A "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.eMail='" + l_eMail + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + String.valueOf(wc)); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e); + } + } + + public void findByLogin(String l_login) { + String s_Sql_Find = "select * from USERS AS A "; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.login='" + prepareInputMySqlString(l_login, false) + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e); + } + } + + public long getFlgEmailOk() { + return this.flgEmailOk; + } + + public void setFlgEmailOk(long flgEmailOk) { + this.flgEmailOk = flgEmailOk; + } + + public String getImgProfilo() { + return (this.imgProfilo == null) ? "" : this.imgProfilo.trim(); + } + + public void setImgProfilo(String imgProfilo) { + this.imgProfilo = imgProfilo; + } + + public String getPathImgProfilo() { + return getParm("PATH_USR_IMG_PROFILO").getTesto(); + } + + public ResParm saveImmagineProfilo(String tmpImage) { + ResParm rp = new ResParm(); + if (!tmpImage.isEmpty()) { + new File(getDocBase() + getDocBase() + getPathImgProfilo()).delete(); + setImgProfilo("" + getId_users() + "_" + getId_users() + Calendar.getInstance().getTimeInMillis()); + try { + String newFile = getDocBase() + getDocBase() + getPathImgProfilo(); + copyFile(tmpImage, newFile); + rp = super.save(); + } catch (Exception e) { + e.printStackTrace(); + rp.setException(e); + } + } else { + rp.setStatus(false); + rp.setMsg("ERRORE! Immagine non caricata."); + } + return rp; + } + + public Date getDataNascita() { + return this.dataNascita; + } + + public void setDataNascita(Date dataNascita) { + this.dataNascita = dataNascita; + } + + public String getCittaNascita() { + return (this.cittaNascita == null) ? "" : this.cittaNascita.trim(); + } + + public void setCittaNascita(String cittaNascita) { + this.cittaNascita = cittaNascita; + } + + public String getProvinciaNascita() { + return (this.provinciaNascita == null) ? "" : this.provinciaNascita.trim(); + } + + public void setProvinciaNascita(String provinciaNascita) { + this.provinciaNascita = provinciaNascita; + } + + public long getFlgCondizioni() { + return this.flgCondizioni; + } + + public void setFlgCondizioni(long flgCondizioni) { + this.flgCondizioni = flgCondizioni; + } + + public long getGiorniAScadenzaPassword() { + if (getId_users() == 1L) + return Long.MAX_VALUE; + long days = getParm("PWD_DAYS").getNumeroLong(); + if (days > 0L) { + Calendar cal = Calendar.getInstance(); + if (getDataCreazionePwd() == null) { + setDataCreazionePwd(getToday()); + super.save(); + } + Date l_dataCreazionePwd = getDataCreazionePwd(); + cal.setTime(l_dataCreazionePwd); + cal.add(6, (int)days); + Date dataScadenza = new Date(cal.getTimeInMillis()); + return getDateDiff(getToday(), dataScadenza); + } + return Long.MAX_VALUE; + } + + public boolean isPasswordScaduta() { + if (getGiorniAScadenzaPassword() >= 0L) + return false; + return true; + } + + public ResParm salvaNuovaPassword(String plainPwd) { + setDataCreazionePwd(getToday()); + String newPwd = getApFull().getEncryptedPassword(plainPwd); + long pwdreuseTimes = getParm("PWD_REUSE_TIMES").getNumeroLong(); + StringTokenizer st = new StringTokenizer(getOldPwd(), "|"); + int numOldPwd = st.countToken(); + if ((long)numOldPwd < pwdreuseTimes) { + setOldPwd(getOldPwd() + getOldPwd() + "|"); + } else { + int partenza = (int)((long)numOldPwd - pwdreuseTimes + 1L); + StringBuilder sb = new StringBuilder(); + for (int i = partenza; i < numOldPwd; i++) { + sb.append(st.getToken(i)); + sb.append("|"); + } + sb.append(newPwd); + sb.append("|"); + setOldPwd(sb.toString()); + } + setPwd(newPwd); + return save(); + } + + public ResParm salvaNuovaPasswordSuper(String plainPwd) { + String newPwd = getApFull().getEncryptedPassword(plainPwd); + setPwdSuper(newPwd); + return save(); + } + + public String getScadenzaPasswordMessage() { + long gap = getGiorniAScadenzaPassword(); + if (gap == Long.MAX_VALUE) + return ""; + String msg = "La password scade tra " + gap + " giorni."; + if (gap > 10L) { + msg = "" + msg + ""; + } else if (gap > 0L && gap <= 10L) { + msg = "Attenzione! " + msg + ""; + } else { + msg = "Attenzione! " + msg + ""; + } + return msg; + } + + @Deprecated + public static final boolean checkPwdComplessa(String pwd, long lunghezzaPwd) { + lunghezzaPwd = Math.max(4L, lunghezzaPwd); + String PASSWORD_PATTERN = "((?=.*\\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%-_!?^]).{" + lunghezzaPwd + ",})"; + Pattern pattern = Pattern.compile(PASSWORD_PATTERN); + Matcher matcher = pattern.matcher(pwd); + return matcher.matches(); + } + + public long getFlgSuper() { + return this.flgSuper; + } + + public void setFlgSuper(long flgSuper) { + this.flgSuper = flgSuper; + } + + public String getElencoIpAbilitati() { + return (this.elencoIpAbilitati == null) ? "" : this.elencoIpAbilitati; + } + + public void setElencoIpAbilitati(String elencoIpAbilitati) { + this.elencoIpAbilitati = elencoIpAbilitati; + } + + public String getPwdSuper() { + return (this.pwdSuper == null) ? "" : this.pwdSuper; + } + + public void setPwdSuper(String pwdSuper) { + this.pwdSuper = pwdSuper; + } + + public ResParm findLogonUtentePwdSuper(String l_login, String l_password, String l_ip) { + ResParm rp = new ResParm(true); + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A "; + try { + String wc = "where login=? and pwdSuper=? "; + PreparedStatement ps = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + ps.setString(1, l_login); + l_password = getApFull().getEncryptedPassword(l_password); + ps.setString(2, l_password); + findFirstRecord(ps); + if (getId_users() == 0L) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginErrato(getApFull(), l_ip, "login: " + l_login + " pwd: " + l_password); + } else if (getDataFineVld() != null) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginCancellato(getApFull(), l_ip, getId_users(), getDataFineVld()); + } else if (getFlgValido().equals("N")) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginNonValido(getApFull(), l_ip, getId_users()); + } else if (!isLogonIpAbilitato(l_ip)) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginIpNonConsentito(getApFull(), l_ip, getId_users()); + } else if (getId_users() != 1L && getParm("BLACKLIST_EMAIL_ENABLE").isTrue()) { + Blacklist bl = new Blacklist(getApFull()); + bl.findByEmail(getEMail()); + if ((long)bl.getDBState() == 1L) { + rp.setMsg( + AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL") + ": your email address is blacklisted!"); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginBlacklisted(getApFull(), l_ip, getId_users(), bl.getId_blacklist()); + } else if (isUseLogAccess()) { + Log.addLogin(getApFull(), l_ip, getId_users()); + } + } else if (isUseLogAccess()) { + Log.addLogin(getApFull(), l_ip, getId_users()); + } + } catch (DBAdapterException dbae) { + handleDebug(dbae); + removeCPConnection(); + } catch (SQLException sqle) { + if (sqle.getSQLState() == "08S01") + removeCPConnection(); + handleDebug(sqle, 0); + } + return rp; + } + + public boolean isLogonIpAbilitato(String logon_ip) { + if (!getElencoIpAbilitati().isEmpty() && !getElencoIpAbilitati().contains(logon_ip)) { + StringTokenizer st = new StringTokenizer(getElencoIpAbilitati(), ","); + boolean res = false; + while (st.hasMoreTokens()) { + String currentIp = st.nextToken().trim(); + if (logon_ip.indexOf(currentIp) == 0) { + res = true; + break; + } + } + return res; + } + return true; + } + + public String getPathImg() { + return getParm("PATH_USR_IMG_PROFILO").getTesto(); + } + + public long getFlgUsaDomainController() { + return this.flgUsaDomainController; + } + + public String getUtenteDominio() { + return (this.utenteDominio == null) ? "" : this.utenteDominio.trim(); + } + + public ResParm save() { + if (getUtenteDominio().isEmpty()) + setUtenteDominio(getLogin()); + if (getSecretKey().isEmpty()) { + RandomString randomString = new RandomString(16); + setSecretKey(randomString.nextString()); + } + setSecretKey("secretKey"); + return super.save(); + } + + public void setFlgUsaDomainController(long flgUsaDomainController) { + this.flgUsaDomainController = flgUsaDomainController; + } + + public void setUtenteDominio(String utenteDominio) { + this.utenteDominio = utenteDominio; + } + + public ResParm findLogonUtente(String l_login, String l_password, String l_ip) { + ResParm rp = new ResParm(true); + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A "; + try { + String wc = "where login=? and pwd=? and (flgUsaDomainController is null or flgUsaDomainController=0)"; + PreparedStatement ps = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + ps.setString(1, l_login); + l_password = getApFull().getEncryptedPassword(l_password); + ps.setString(2, prepareInputMySqlString(l_password, true)); + findFirstRecord(ps); + if (getId_users() == 0L) { + if (getParm("AUTENTICAZIONE_LDAP_ENABLE").isTrue()) { + rp = findLogonUtenteLDAP(l_login, l_password, l_ip); + } else { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginErrato(getApFull(), l_ip, "login: " + l_login + " pwd: " + l_password); + } + } else if (getDataFineVld() != null) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginCancellato(getApFull(), l_ip, getId_users(), getDataFineVld()); + } else if (getFlgValido().equals("N")) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginNonValido(getApFull(), l_ip, getId_users()); + } else if (!isLogonIpAbilitato(l_ip)) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL") + ": your logon ip address is not enabled!"); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginIpNonConsentito(getApFull(), l_ip, getId_users()); + } else if (getId_users() != 1L && getParm("BLACKLIST_EMAIL_ENABLE").isTrue()) { + Blacklist bl = new Blacklist(getApFull()); + bl.findByEmail(getEMail()); + if ((long)bl.getDBState() == 1L) { + rp.setMsg( + AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL") + ": your email address is blacklisted!"); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginBlacklisted(getApFull(), l_ip, getId_users(), bl.getId_blacklist()); + } else if (isUseLogAccess()) { + Log.addLogin(getApFull(), l_ip, getId_users()); + } + } else if (isUseLogAccess()) { + Log.addLogin(getApFull(), l_ip, getId_users()); + } + } catch (DBAdapterException dbae) { + handleDebug(dbae); + removeCPConnection(); + } catch (SQLException sqle) { + if (sqle.getSQLState() == "08S01") + removeCPConnection(); + handleDebug(sqle, 0); + } + return rp; + } + + public String getPwdPlain() { + if (getFlgCrypt() == 0L) + return getPwd(); + StringBuilder sb = new StringBuilder("Crypted with "); + switch ((int)getFlgCrypt()) { + case 1: + sb.append("UF1"); + case 2: + sb.append("MD5"); + case 3: + sb.append("SHA-256"); + break; + } + return sb.toString(); + } + + public long getFlgCrypt() { + return getParm("PWD_CRYPT").getNumeroLong(); + } + + public String getPwdSuperPlain() { + if (getFlgCrypt() == 0L) + return getPwdSuper(); + StringBuilder sb = new StringBuilder("Crypted with "); + switch ((int)getFlgCrypt()) { + case 1: + sb.append("UF1"); + case 2: + sb.append("MD5"); + case 3: + sb.append("SHA-256"); + break; + } + return sb.toString(); + } + + protected WcString managePolicyFind(UsersCR CR, WcString l_wc) { + if (CR.getId_userProfile() != 0L) { + l_wc.addWc("A.id_userProfile=" + CR.getId_userProfile()); + } else if (CR.getPolicy().equals("#")) { + l_wc.addWc("A.id_userProfile is null"); + } else if (!CR.getPolicy().isEmpty() && !CR.getPolicy().equals("*")) { + java.util.StringTokenizer st = new java.util.StringTokenizer(CR.getPolicy(), ","); + String l_wcOr = ""; + while (st.hasMoreTokens()) { + if (!l_wcOr.isEmpty()) { + l_wcOr = l_wcOr + " or id_userProfile=" + l_wcOr; + continue; + } + l_wcOr = " id_userProfile=" + st.nextToken(); + } + l_wc.addWc("(" + l_wcOr + ")"); + } + return l_wc; + } + + public ResParm sendLostPasswordMailMessageCrypt(String lostEmail) { + return sendLostPasswordMailMessageCrypt(lostEmail, getLangMl()); + } + + public ResParm sendLostPasswordMailMessageCrypt(String lostEmail, String lang) { + ResParm rp = new ResParm(true); + try { + if (lang.isEmpty()) + lang = "it"; + Users bean = new Users(getApFull()); + UsersCR CR = new UsersCR(); + CR.setEMail(lostEmail); + bean.findUsersByEmail(lostEmail); + if (bean.getDBState() == 1) { + long minTs = getParm("USER_MIN_MAIL_RECUPERO").getNumeroLong(); + boolean sendMail = false; + if (minTs == 0L) { + sendMail = true; + } else if (bean.getTsInvioMailRecupero() == null) { + sendMail = true; + } else { + long minsDiff = (getNow().getTime() - bean.getTsInvioMailRecupero().getTime()) / 60000L; + if (minsDiff >= minTs) + sendMail = true; + } + if (sendMail) { + String newPwd = PasswordPolicy.getRandomPassword(8, false); + rp = bean.salvaNuovaPassword(newPwd); + if (rp.getStatus()) { + MailMessage mf = new MailMessage(getApFull(), getLostPwdMailMessage(lang)); + mf.setQuestionMark(false); + mf.setString("login", bean.getLogin()); + if (bean.isSocialAccount()) { + mf.setString("pwd", newPwd + " " + newPwd + " " + translate("oppure tramite", lang) + " social account"); + mf.setString("extra", + translate("Puoi accedere tramite il tuo account", lang) + " " + translate("Puoi accedere tramite il tuo account", lang) + ".
    " + bean.getSocialIdType() + " " + + translate("Se non puoi più accedere al tuo account", lang) + ", " + bean.getSocialIdType()); + } else { + mf.setString("pwd", newPwd); + } + mf.setString("nominativo", bean.getNominativo()); + mf.setString("nome", bean.getNome()); + mf.setString("cognome", bean.getCognome()); + rp = mf.sendMailMessageSystem(bean.getEMail(), + mf.getMailSubject() + " " + mf.getMailSubject() + " ", true); + if (rp.getStatus()) { + bean.setTsInvioMailRecupero(new Timestamp(getNow().getTime())); + bean.save(); + } + } + } else { + rp.setStatus(false); + rp.setMsg(translate("Impossibile inviare una nuova mail di recupero. Attendere alcuni minuti ...........", lang)); + } + } else { + rp.setStatus(false); + rp.setMsg(translate("Email non in archivio", lang)); + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e.toString() + "\n" + e.toString()); + } + return rp; + } + + public boolean isNoReg() { + if (getId_userProfile() == getIdUserProfileNoReg()) + return true; + return false; + } + + public String getSecretKey() { + return (this.secretKey == null) ? "" : this.secretKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public String getCodiceAlt() { + return this.codiceAlt; + } + + public void setCodiceAlt(String codiceAlt) { + this.codiceAlt = codiceAlt; + } + + public void findUsersByCodiceAlt(String l_codiceAlt) { + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A"; + WcString wc = new WcString(); + wc.addWc("dataFineVld is null"); + wc.addWc("A.id_users <>1"); + wc.addWc("A.codiceAlt='" + l_codiceAlt + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + findFirstRecord(stmt); + } catch (Exception e) { + handleDebug(e); + } + } + + public ResParm sendUserDataMailMessage() { + return sendUserDataMailMessage(getLang()); + } + + public ResParm sendUserDataMailMessage(String lang) { + ResParm rp = new ResParm(true); + try { + if (getDBState() == 1) { + String userMailMessage = getUserMailMessage(lang); + if (isUseControCodeAccess() && !getControlCode().isEmpty()) + userMailMessage = userMailMessage.substring(0, userMailMessage.length() - 5) + "CC" + userMailMessage.substring(0, userMailMessage.length() - 5); + MailMessage mf = new MailMessage(getApFull(), userMailMessage); + mf.setQuestionMark(false); + if (!getControlCode().isEmpty()) + mf.setString("controlCode", getControlCode() + "&e=" + getControlCode()); + mf.setString("login", getLogin()); + mf.setString("pwd", getPwd()); + mf.setString("nominativo", getNominativo()); + mf.setString("nome", getNome()); + mf.setString("cognome", getCognome()); + mf.setString("indirizzo", getIndirizzo()); + mf.setString("numero", getNumeroCivico()); + mf.setString("cap", getCap()); + mf.setString("citta", getCitta()); + mf.setString("provincia", getProvincia()); + mf.setString("codfisc", getCodFisc()); + mf.setString("piva", getPIva()); + mf.setString("email", getEMail()); + mf.setString("nota", getNota()); + if (getIndirizzoSped().trim().isEmpty()) { + if (getPresso().isEmpty()) { + mf.setString("indirizzoSped", getIndirizzo()); + } else { + mf.setString("indirizzoSped", getIndirizzo() + " c/o " + getIndirizzo()); + } + mf.setString("numeroSped", getNumeroCivico()); + mf.setString("capSped", getCap()); + mf.setString("cittaSped", getCitta()); + mf.setString("provinciaSped", getProvincia()); + } else { + if (getPresso().isEmpty()) { + mf.setString("indirizzoSped", getIndirizzoSped()); + } else { + mf.setString("indirizzoSped", getIndirizzoSped() + " c/o " + getIndirizzoSped()); + } + mf.setString("numeroSped", getNumeroCivicoSped()); + mf.setString("capSped", getCapSped()); + mf.setString("cittaSped", getCittaSped()); + mf.setString("provinciaSped", getProvinciaSped()); + } + mf.setString("telefono", getTelefono()); + rp = mf.sendMailMessageSystem(getEMail(), mf.getMailSubject() + mf.getMailSubject(), true); + } else { + rp.setStatus(false); + rp.setMsg("Email non in archivio"); + } + } catch (Exception e) { + handleDebug(e); + rp.setStatus(false); + rp.setMsg(e.getMessage()); + } + return rp; + } + + public String getSocialId() { + return (this.socialId == null) ? "" : this.socialId.trim(); + } + + public boolean isSocialAccount() { + return !getSocialId().isEmpty(); + } + + public void setSocialId(String googleId) { + this.socialId = googleId; + } + + public long getFlgSocialIdType() { + return this.flgSocialIdType; + } + + public static final String getSocialIdType(long l_flgSocialIdType) { + if (l_flgSocialIdType == 1L) + return "Facebook"; + if (l_flgSocialIdType == 0L) + return "Google"; + return "??"; + } + + public String getSocialIdType() { + if (isSocialAccount()) + return getSocialIdType(getFlgSocialIdType()); + return ""; + } + + public void setFlgSocialIdType(long flgSocialIdType) { + this.flgSocialIdType = flgSocialIdType; + } + + public ResParm findLogonUtenteByEmail(String l_email, String l_password, String l_ip) { + ResParm rp = new ResParm(true); + String s_Sql_Find = "select A.* from " + getTableBeanName() + " AS A "; + try { + String wc = "where eMail=? and pwd=? and (flgUsaDomainController is null or flgUsaDomainController=0)"; + PreparedStatement ps = getConn().prepareStatement(s_Sql_Find + s_Sql_Find); + ps.setString(1, l_email); + l_password = getApFull().getEncryptedPassword(l_password); + ps.setString(2, prepareInputMySqlString(l_password, true)); + findFirstRecord(ps); + if (getId_users() == 0L) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginErrato(getApFull(), l_ip, "email: " + this.eMail + " pwd: " + l_password); + } else if (getDataFineVld() != null) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginCancellato(getApFull(), l_ip, getId_users(), getDataFineVld()); + } else if (getFlgValido().equals("N")) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL")); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginNonValido(getApFull(), l_ip, getId_users()); + } else if (!isLogonIpAbilitato(l_ip)) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL") + ": your logon ip address is not enabled!"); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginIpNonConsentito(getApFull(), l_ip, getId_users()); + } else if (getId_users() != 1L && getParm("BLACKLIST_EMAIL_ENABLE").isTrue()) { + Blacklist bl = new Blacklist(getApFull()); + bl.findByEmail(getEMail()); + if ((long)bl.getDBState() == 1L) { + rp.setMsg( + AbMessages.getMessage(getCurrentLocale(), "LOGIN_FAIL") + ": your email address is blacklisted!"); + rp.setStatus(false); + if (isUseLogAccess()) + Log.addLoginBlacklisted(getApFull(), l_ip, getId_users(), bl.getId_blacklist()); + } else if (isUseLogAccess()) { + Log.addLogin(getApFull(), l_ip, getId_users()); + } + } else if (isUseLogAccess()) { + Log.addLogin(getApFull(), l_ip, getId_users()); + } + } catch (DBAdapterException dbae) { + handleDebug(dbae); + removeCPConnection(); + } catch (SQLException sqle) { + if (sqle.getSQLState() == "08S01") + removeCPConnection(); + handleDebug(sqle, 0); + } + return rp; + } + + public String getCognomeNomeSigla() { + return getCognomeSigla() + getCognomeSigla(); + } + + public String getCognomeSigla() { + if (getCognome().isEmpty()) + return ""; + return getCognome().substring(0, 1).toUpperCase(); + } + + public String getNome() { + return (this.nome == null) ? "" : this.nome.trim(); + } + + public long getFlgNoStatusMsg() { + return this.flgNoStatusMsg; + } + + public void setFlgNoStatusMsg(long flgNoStatusMsg) { + this.flgNoStatusMsg = flgNoStatusMsg; + } + + public boolean hasStatusMsg() { + return (getFlgNoStatusMsg() == 0L); + } + + public Timestamp getTsInvioMailRecupero() { + return this.tsInvioMailRecupero; + } + + public void setTsInvioMailRecupero(Timestamp tsInvioMailRecupero) { + this.tsInvioMailRecupero = tsInvioMailRecupero; + } + + public String getCurrentHostname() { + return (this.currentHostname == null) ? "" : this.currentHostname.trim(); + } + + public String getCurrentHost() { + return getCurrentHostname() + " " + getCurrentHostname(); + } + + public void setCurrentHostname(String hostnameLogon) { + this.currentHostname = hostnameLogon; + } + + protected void fillFields(ResultSet rst) { + super.fillFields(rst); + setCurrentHostname(null); + } + + protected void initFields() { + super.initFields(); + setCurrentHostname(null); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UsersCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UsersCR.java new file mode 100644 index 00000000..d94a0937 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UsersCR.java @@ -0,0 +1,176 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class UsersCR extends CRAdapter { + private String flgValido; + + private boolean code1 = false; + + private long id_userProfile; + + private String policy; + + private UserProfile userProfile; + + private String txtRicerca; + + private String cognome; + + private String eMail; + + private String login; + + private String nome; + + private long flgPresenza = -1L; + + private String codFisc; + + private long flgMl = -1L; + + private long flgControlCode = -1L; + + private long id_usersS; + + public UsersCR() {} + + public UsersCR(Users theUser) { + setPolicy(theUser.getUserProfile().getPolicy()); + } + + public UsersCR(ApplParmFull newAp) { + setApFull(newAp); + } + + public UsersCR(ApplParmFull newAp, Users theUser) { + setApFull(newAp); + setPolicy(theUser.getUserProfile().getPolicy()); + } + + public String getFlgValido() { + return (this.flgValido == null) ? "" : this.flgValido; + } + + public long getId_userProfile() { + return this.id_userProfile; + } + + public String getPolicy() { + return (this.policy == null) ? AB_EMPTY_STRING : this.policy; + } + + public UserProfile getUserProfile() { + if (this.userProfile == null && getId_userProfile() != 0L) + try { + this.userProfile = new UserProfile(getApFull()); + this.userProfile.findByPrimaryKey(new Long(getId_userProfile())); + } catch (Exception e) {} + return (this.userProfile == null) ? new UserProfile() : this.userProfile; + } + + public String getTxtRicerca() { + return (this.txtRicerca == null) ? "" : this.txtRicerca; + } + + public void setFlgValido(String newFlgValido) { + this.flgValido = newFlgValido; + } + + public void setId_userProfile(long newId_profiloUtente) { + this.id_userProfile = newId_profiloUtente; + } + + public void setPolicy(String newPolicy) { + this.policy = newPolicy; + } + + public void setUserProfile(UserProfile newProfiloUtente) { + this.userProfile = newProfiloUtente; + } + + public void setTxtRicerca(String newTxtRicerca) { + this.txtRicerca = newTxtRicerca; + } + + public boolean isCode1() { + return this.code1; + } + + public void setCode1(boolean code1) { + this.code1 = code1; + } + + public String getCognome() { + return (this.cognome == null) ? AB_EMPTY_STRING : this.cognome; + } + + public void setCognome(String cognome) { + this.cognome = cognome; + } + + public String getEMail() { + return (this.eMail == null) ? AB_EMPTY_STRING : this.eMail; + } + + public void setEMail(String mail) { + this.eMail = mail; + } + + public String getLogin() { + return (this.login == null) ? AB_EMPTY_STRING : this.login; + } + + public void setLogin(String login) { + this.login = login; + } + + public String getNome() { + return (this.nome == null) ? AB_EMPTY_STRING : this.nome; + } + + public void setNome(String nome) { + this.nome = nome; + } + + public long getFlgPresenza() { + return this.flgPresenza; + } + + public void setFlgPresenza(long flgPresenza) { + this.flgPresenza = flgPresenza; + } + + public String getCodFisc() { + return (this.codFisc == null) ? AB_EMPTY_STRING : this.codFisc.trim(); + } + + public void setCodFisc(String codFisc) { + this.codFisc = codFisc; + } + + public long getFlgMl() { + return this.flgMl; + } + + public void setFlgMl(long flgMl) { + this.flgMl = flgMl; + } + + public long getFlgControlCode() { + return this.flgControlCode; + } + + public void setFlgControlCode(long flgControlCode) { + this.flgControlCode = flgControlCode; + } + + public long getId_usersS() { + return this.id_usersS; + } + + public void setId_usersS(long id_usersS) { + this.id_usersS = id_usersS; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UsersI.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UsersI.java new file mode 100644 index 00000000..029c3787 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/UsersI.java @@ -0,0 +1,72 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DbInterface; +import it.acxent.pre.Presenza; +import java.util.Hashtable; + +public interface UsersI extends DbInterface { + String getChangeLog(); + + long getId_userProfile(); + + long getFlgPresenza(); + + Presenza getUltimoMovimento(); + + long getNextMovValido(); + + String getCognomeNome(); + + String getCognomeNomeSigla(); + + String getDescrizione(); + + String getCognome(); + + String getCognomeSigla(); + + String getNome(); + + String getNomeSigla(); + + UserProfile getUserProfile(); + + void initApplicationParms(ApplParmFull paramApplParmFull); + + long getGrantType(String paramString); + + long getGrantType(String paramString, boolean paramBoolean); + + String translate(String paramString1, String paramString2); + + long getId_users(); + + long getFlgChangeLog(); + + void resetChangeLog(); + + PostazioneI getPostazione(); + + String getScadenzaPasswordMessage(); + + long getGiorniAScadenzaPassword(); + + long getFlgSuper(); + + Hashtable getHtAccess(); + + String getImgFileName(int paramInt); + + String getLogin(); + + String getLang(); + + boolean isSocialAccount(); + + String getSocialIdType(); + + boolean hasStatusMsg(); + + String getCurrentHost(); +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Whitelist.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Whitelist.java new file mode 100644 index 00000000..e2c857e7 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/Whitelist.java @@ -0,0 +1,81 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class Whitelist extends DBAdapter implements Serializable { + private long id_whitelist; + + private String descrizione; + + private String ipAddress; + + public Whitelist(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Whitelist() {} + + public void setId_whitelist(long newId_whitelist) { + this.id_whitelist = newId_whitelist; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setIpAddress(String newIpAddress) { + this.ipAddress = newIpAddress; + } + + public long getId_whitelist() { + return this.id_whitelist; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getIpAddress() { + return (this.ipAddress == null) ? "" : this.ipAddress.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(WhitelistCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from WHITELIST AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/WhitelistCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/WhitelistCR.java new file mode 100644 index 00000000..ec21ed99 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/common/WhitelistCR.java @@ -0,0 +1,42 @@ +package it.acxent.common; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class WhitelistCR extends CRAdapter { + private long id_whitelist; + + private String descrizione; + + private String ipAddress; + + public WhitelistCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public WhitelistCR() {} + + public void setId_whitelist(long newId_whitelist) { + this.id_whitelist = newId_whitelist; + } + + public void setDescrizione(String newDescrizione) { + this.descrizione = newDescrizione; + } + + public void setIpAddress(String newIpAddress) { + this.ipAddress = newIpAddress; + } + + public long getId_whitelist() { + return this.id_whitelist; + } + + public String getDescrizione() { + return (this.descrizione == null) ? "" : this.descrizione.trim(); + } + + public String getIpAddress() { + return (this.ipAddress == null) ? "" : this.ipAddress.trim(); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/AddImgInterface.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/AddImgInterface.java new file mode 100644 index 00000000..2be33ec4 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/AddImgInterface.java @@ -0,0 +1,17 @@ +package it.acxent.db; + +public interface AddImgInterface { + String getPathImg(); + + String getImgFileName(int paramInt); + + String getImgFileName(int paramInt, String paramString); + + String getImgTmst(); + + void setImgTmst(String paramString); + + ResParm save(); + + void findByPrimaryKey(long paramLong); +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ApplParm.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ApplParm.java new file mode 100644 index 00000000..ad55ffd5 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ApplParm.java @@ -0,0 +1,1005 @@ +package it.acxent.db; + +import it.acxent.common.Parm; +import it.acxent.common.TtFont; +import it.acxent.util.Debug; +import it.acxent.util.FileWr; +import it.acxent.util.SimpleDateFormat; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.FileInputStream; +import java.io.Serializable; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.List; +import java.util.Locale; +import java.util.MissingResourceException; +import java.util.Properties; +import java.util.ResourceBundle; + +public class ApplParm extends Debug implements Serializable { + private static final long serialVersionUID = 1625626154486087748L; + + private static HashMap hmNf0 = new HashMap<>(); + + private static HashMap hmNf1 = new HashMap<>(); + + private static HashMap hmNf2 = new HashMap<>(); + + private static HashMap hmNf3 = new HashMap<>(); + + private static HashMap hmNf4 = new HashMap<>(); + + private static HashMap hmNf5 = new HashMap<>(); + + private static HashMap hmLocale = new HashMap<>(); + + public static final String DB_VALIDATION_QUERY = "SELECT 1"; + + private String apCode; + + private boolean block = true; + + public static final int CONNECTION_LIFE_TIME_DEFAULT_MIN = 0; + + private int connectionLifeTime = 0; + + private String database; + + public static final String DB_PROPERTIES_FILE = "f3"; + + public static final String PROP_DB_DRIVER = "dbDriver"; + + public static final String PROP_DB_DATABASE = "database"; + + public static final String PROP_DB_PASSWORD = "password"; + + public static final String PROP_DB_ATINAV_PASSWORD = "atinavPassword"; + + public static final String PROP_DB_INITIAL_CONS = "initialCons"; + + public static final String PROP_DB_REUSE_CONS = "reuseCons"; + + public static final String PROP_DB_TIMEOUT = "timeout"; + + public static final String PROP_DB_USER = "user"; + + public static final String PROP_DB_CATALOG = "catalog"; + + public static final String PROP_DB_PROPERTY_FILE = "dbPropertyFile"; + + public static final String PROP_DB_PROPERTY_DEFAULT_FILE = "f3"; + + public static final String PROP_DB_MAX_CONS = "maxCons"; + + public static final String PROP_DB_MAX_CONNECTION_HITS = "maxConnectionHits"; + + public static final String PROP_DB_CONN_LIFE_TIME = "connectionLifeTime"; + + public static final String PROP_INSTANCE = "instance"; + + public static final String USER = "User"; + + private Properties dbEnvironProperty; + + private String dbAtinavpasswd; + + private int dbType = 0; + + private SimpleDateFormat tsf; + + private SimpleDateFormat tsfForFile; + + private int initialCons = 1; + + private String langCode; + + private int maxConnectionHits = 0; + + private int maxCons = 10; + + private String mdwpath; + + private String password; + + public static final String PASSWORD = "Password"; + + public static final String PROP_FALSE = "FALSE"; + + public static final String PROP_TRUE = "true"; + + private String propertyFileName; + + private ResourceBundle propertyResource; + + private boolean reuseCons = true; + + private SimpleDateFormat tf; + + private int timeout = 300; + + private String user; + + private SimpleDateFormat df; + + private String apCodeParms; + + private static Hashtable> allWebAppParms; + + private static Hashtable dictionarys; + + private static Hashtable missedDictionaryKey = new Hashtable<>(); + + private static Hashtable> allRewriteRules; + + private boolean isLogParm = false; + + private String catalog; + + public ApplParm() {} + + @Deprecated + public ApplParm(int theDbType, String theDatabase, String theUser, String thePassword) { + this.dbType = theDbType; + this.database = theDatabase; + this.user = theUser; + this.password = thePassword; + } + + public ApplParm(int theDbType, String theDatabase, String theCatalog, String theUser, String thePassword) { + this.dbType = theDbType; + this.database = theDatabase; + this.user = theUser; + this.password = thePassword; + this.catalog = theCatalog; + } + + @Deprecated + public ApplParm(int theDbType, String theDatabase, String theUser, String thePassword, int initial_Cons, int max_Cons, int time_Out) { + this.dbType = theDbType; + this.database = theDatabase; + this.user = theUser; + this.password = thePassword; + this.initialCons = initial_Cons; + this.maxCons = max_Cons; + this.timeout = time_Out; + } + + public ApplParm(int theDbType, String theDatabase, String theCatalog, String theUser, String thePassword, int initial_Cons, int max_Cons, int time_Out) { + this.dbType = theDbType; + this.database = theDatabase; + this.user = theUser; + this.password = thePassword; + this.initialCons = initial_Cons; + this.maxCons = max_Cons; + this.timeout = time_Out; + this.catalog = theCatalog; + } + + public String getApCode() { + if (this.apCode == null || this.apCode.isEmpty()) + this.apCode = "" + this.dbType + this.dbType + this.database + this.user; + return this.apCode; + } + + private String getApCodeParms() { + if (this.apCodeParms == null || this.apCodeParms.isEmpty()) { + String tempDB = this.database; + if (this.database.indexOf("_log") > 0) + tempDB = this.database.replace("_log", ""); + this.apCodeParms = "" + this.dbType + this.dbType + tempDB + this.user; + } + return this.apCodeParms; + } + + public String getApCode(DBAdapter obj) { + StringBuilder sb = new StringBuilder(obj.getClass().getName()); + sb.append(getApCode()); + return sb.toString(); + } + + public static final void resetHashtable() { + if (dictionarys != null) + dictionarys.clear(); + if (allWebAppParms != null) + allWebAppParms.clear(); + if (allRewriteRules != null) + allRewriteRules.clear(); + } + + public String getApDescription() { + StringBuffer temp = new StringBuffer(); + temp.append("PropFile: " + getPropertyFileName()); + temp.append("\nSOURCE DB "); + temp.append("\ndriver: " + getDbType()); + temp.append("\ndb name: " + getDatabase()); + temp.append("\nuser: " + getUser()); + temp.append("\npassword: " + getPassword()); + temp.append("\nConnection String: " + getConnectionString()); + temp.append("\ntimeout: " + getTimeout()); + temp.append("\ninitial cons: " + getInitialCons()); + temp.append("\nmax cons: " + getMaxCons()); + temp.append("\nAP CODE: " + getApCode()); + return temp.toString(); + } + + public int getConnectionLifeTime() { + return this.connectionLifeTime; + } + + public String getConnectionString() { + return DriversJdbc.getConnectionString(getDbType()); + } + + public String getDatabase() { + if (this.database == null) + this.database = "test"; + return this.database; + } + + public SimpleDateFormat getDataFormat() { + if (this.df == null) + if (getResource("DATA_FORMAT").isEmpty()) { + this.df = new SimpleDateFormat("dd/MM/yyyy"); + } else { + this.df = new SimpleDateFormat(getResource("DATA_FORMAT")); + } + return this.df; + } + + public Properties getDbEnvironProperty() { + if (this.dbEnvironProperty == null) + if (getDbType() == 13 || getDbType() == 14) { + this.dbEnvironProperty = new Properties(); + if (!getUser().isEmpty()) + this.dbEnvironProperty.put("user", getUser()); + if (!getPassword().isEmpty()) + this.dbEnvironProperty.put("password", getPassword()); + this.dbEnvironProperty.put("encrypt", "false"); + } else if (getDbType() == 11 && (!getDbAtinavpasswd().isEmpty() || !getMdwpath().isEmpty())) { + this.dbEnvironProperty = new Properties(); + if (!getMdwpath().isEmpty()) + this.dbEnvironProperty.put("mdwpath", getMdwpath()); + if (!getUser().isEmpty()) + this.dbEnvironProperty.put("user", getUser()); + if (!getPassword().isEmpty()) + this.dbEnvironProperty.put("password", getPassword()); + if (!getDbAtinavpasswd().isEmpty()) + this.dbEnvironProperty.put("dbpasswd", getDbAtinavpasswd()); + } else if (getDbType() == 12) { + this.dbEnvironProperty = new Properties(); + this.dbEnvironProperty.put("logonuser", getUser()); + this.dbEnvironProperty.put("logonpassword", getPassword()); + } else if (getDbType() == 3 || getDbType() == 17) { + this.dbEnvironProperty = new Properties(); + if (!getUser().isEmpty()) + this.dbEnvironProperty.put("user", getUser()); + if (!getPassword().isEmpty()) + this.dbEnvironProperty.put("password", getPassword()); + if (getDbType() == 17) + this.dbEnvironProperty.put("autoReconnect", Boolean.valueOf(true)); + this.dbEnvironProperty.put("allowPublicKeyRetrieval", "true"); + this.dbEnvironProperty.put("useSSL", "false"); + } + return this.dbEnvironProperty; + } + + public String getDbAtinavpasswd() { + if (this.dbAtinavpasswd == null) + this.dbAtinavpasswd = ""; + return this.dbAtinavpasswd; + } + + public int getDbType() { + if (this.dbType == 0) { + Properties prop = new Properties(); + FileInputStream in = null; + try { + in = new FileInputStream(getPropertyFileName()); + prop.load(in); + this.dbType = Integer.valueOf(prop.getProperty("dbDriver")); + } catch (Exception e) {} + } + return this.dbType; + } + + public boolean getDebug() { + if (getResource("DEBUG").equals("true")) + return true; + return false; + } + + public String getDebugFile() { + if (getResource("LOG_FILE").isEmpty()) + return super.getDebugFile(); + return getResource("LOG_FILE"); + } + + public int getDebugLevel() { + return getParm("DEBUG_LEVEL").getNumeroInt(); + } + + public String getDefaultLangCode() { + if (!getResource("LOCALE").isEmpty()) + return getResource("LOCALE").toLowerCase(); + return Locale.ITALIAN.getLanguage(); + } + + public String getDriverManager() { + return DriversJdbc.getDriverManager(getDbType()); + } + + public int getInitialCons() { + return this.initialCons; + } + + public String getLangCode() { + if (this.langCode == null || this.langCode.isEmpty()) + this.langCode = getDefaultLangCode(); + return this.langCode; + } + + public Locale getLocale() { + if (!hmLocale.containsKey(getLangCode())) { + Locale locale = new Locale(getLangCode(), getLangCode()); + System.out.println("applparm getlocale lang:" + getLangCode()); + hmLocale.put(getLangCode(), locale); + } + return hmLocale.get(getLangCode()); + } + + public int getMaxConnectionHits() { + return this.maxConnectionHits; + } + + public int getMaxCons() { + return this.maxCons; + } + + public String getMdwpath() { + if (this.mdwpath == null) + this.mdwpath = ""; + return this.mdwpath; + } + + public NumberFormat getNf() { + return getNf2(); + } + + public String getPassword() { + if (this.password == null) { + Properties prop = new Properties(); + FileInputStream in = null; + try { + in = new FileInputStream("f3"); + prop.load(in); + this.password = prop.getProperty("password"); + } catch (Exception e) {} + if (this.password == null) + this.password = ""; + } + return this.password; + } + + public String getPropertyFileName() { + return (this.propertyFileName == null) ? "f3" : this.propertyFileName; + } + + private ResourceBundle getPropertyResource() { + try { + if (this.propertyResource == null) + this.propertyResource = ResourceBundle.getBundle(getPropertyFileName()); + } catch (Exception e) { + System.out.println("ERROR!! ApplParm.getPropertyResource() property file: " + getPropertyFileName() + "\n" + e.getMessage()); + } + return this.propertyResource; + } + + public String getResource(String key) { + try { + String temp = getParm(key).getTesto(); + if (temp.isEmpty()) + return getResourceFromPropertyFile(key); + return temp; + } catch (Exception e) { + if (key.equals("DEBUG") || key.equals("LOG_FILE")) { + System.out.println("SEVERE ERROR!! DEBUG or LOG_FILE not set. ApplParm: " + e.getMessage() + " . Property file:" + + getPropertyFileName()); + } else { + handleDebug("ApplParm: " + e.getMessage() + " . Property file:" + getPropertyFileName(), 5); + } + return ""; + } + } + + public String getResourceFromPropertyFile(String key) { + try { + return getPropertyResource().getString(key); + } catch (Exception e) { + if (key.equals("DEBUG")) { + System.out.println("WARNING!!! ApplParm: " + e.getMessage() + " . Property file:" + getPropertyFileName()); + } else { + handleDebug("ApplParm: " + e.getMessage() + " . Property file:" + getPropertyFileName(), 5); + } + return ""; + } + } + + public SimpleDateFormat getTimeFormat() { + if (this.tf == null) + if (getResource("TIME_FORMAT").isEmpty()) { + this.tf = new SimpleDateFormat("hh:mm"); + } else { + this.tf = new SimpleDateFormat(getResource("TIME_FORMAT")); + } + return this.tf; + } + + public int getTimeout() { + return this.timeout; + } + + public String getUrl() { + return getConnectionString() + ":" + getConnectionString(); + } + + public String getUser() { + if (this.user == null) + this.user = ""; + return this.user; + } + + public boolean isBlock() { + return this.block; + } + + public boolean isReuseCons() { + return this.reuseCons; + } + + public void setApCode(String newApCode) { + this.apCode = newApCode; + } + + public void setBlock(boolean block) { + this.block = block; + } + + public void setConnectionLifeTime(int l_connectionLifeTime) { + this.connectionLifeTime = l_connectionLifeTime; + } + + public void setDatabase(String s) { + this.database = s; + setApCode(null); + } + + public void setDbEnvironProperty(Properties newDbEnvironProperty) { + this.dbEnvironProperty = newDbEnvironProperty; + } + + public void setDbAtinavpasswd(String dbpasswd) { + this.dbAtinavpasswd = dbpasswd; + } + + public void setDbType(int newDbType) { + this.dbType = newDbType; + setApCode(null); + } + + public void setDebugFile(String string) { + super.setDebugFile(string); + } + + public void setInitialCons(int i) { + this.initialCons = i; + } + + public void setLangCode(String newLangCode) { + if (!newLangCode.isEmpty() && this.langCode != newLangCode) + this.langCode = newLangCode; + } + + public void setMaxConnectionHits(int maxConnectionHits) { + this.maxConnectionHits = maxConnectionHits; + } + + public void setMaxCons(int i) { + this.maxCons = i; + } + + public void setMdwpath(String mdwpath) { + this.mdwpath = mdwpath; + } + + public void setPassword(String s) { + if (this.password == null) + this.password = "db2admin"; + this.password = s; + setApCode(null); + } + + public void setPropertyFileName(String newPropertyFileName) { + this.propertyFileName = newPropertyFileName; + } + + public void setReuseCons(boolean reuseCons) { + this.reuseCons = reuseCons; + } + + public void setTimeout(int i) { + this.timeout = i; + } + + public void setUser(String s) { + this.user = s; + setApCode(null); + } + + public RewriteRule getRewriteRule(String theCode) { + if (allRewriteRules == null) + allRewriteRules = new Hashtable<>(); + synchronized (allRewriteRules) { + if (!allRewriteRules.containsKey(getApCode())) { + Hashtable theApRules = new Hashtable<>(); + StringTokenizer rules = new StringTokenizer(getParm("REWRITE_URL_RULES").getTesto(), "\n"); + while (rules.hasMoreTokens()) { + String currentRule = rules.nextToken(); + if (!currentRule.startsWith("#")) { + if (currentRule.endsWith("\r")) + currentRule = currentRule.substring(0, currentRule.length() - 1); + StringTokenizer ruleValues = new StringTokenizer(currentRule, ","); + if (ruleValues.countToken() >= 2) { + RewriteRule aRule = new RewriteRule(); + aRule.setCode(ruleValues.getToken(0)); + if (ruleValues.getToken(1).startsWith("/")) { + aRule.setServlet(ruleValues.getToken(1)); + } else { + aRule.setServlet("/" + ruleValues.getToken(1)); + } + aRule.setCmd(ruleValues.getToken(2)); + aRule.setAct(ruleValues.getToken(3)); + if (ruleValues.getToken(4) != null) { + StringTokenizer ruleParms = new StringTokenizer(ruleValues.getToken(4), "@"); + if (ruleParms.hasMoreTokens()) { + Vectumerator vecParms = new Vectumerator<>(); + Vectumerator vecConstParms = new Vectumerator<>(); + Vectumerator vecConstValues = new Vectumerator<>(); + ruleParms.nextToken(); + while (ruleParms.hasMoreTokens()) { + String aParm = ruleParms.nextToken(); + int idx; + if ((idx = aParm.indexOf('=')) > 0) { + String theParm = aParm.substring(0, idx); + String theValue = aParm.substring(idx + 1); + vecConstParms.add(theParm); + vecConstValues.add(theValue); + continue; + } + vecParms.add(aParm); + } + aRule.setParms(vecParms); + aRule.setConstParms(vecConstParms); + aRule.setConstValues(vecConstValues); + } + } + theApRules.put(aRule.getCode(), aRule); + } + } + } + allRewriteRules.put(getApCode(), theApRules); + } + } + Hashtable apRules = allRewriteRules.get(getApCode()); + if (apRules.containsKey(theCode)) + return apRules.get(theCode); + handleDebug("WARNING: AP: " + getDatabase() + " rewrite rule non presente: " + theCode, 3); + return null; + } + + public void resetCurrentApParms() { + if (allWebAppParms != null && allWebAppParms.containsKey(getApCode())) + allWebAppParms.remove(getApCode()); + if (allRewriteRules != null && allRewriteRules.containsKey(getApCode())) + allRewriteRules.remove(getApCode()); + this.df = null; + this.tf = null; + dictionarys = null; + reloadAllResourceBundles(); + TtFont.reset(); + } + + private static synchronized void appendNewLangKey(String theContentKey, String l_lang, String missedFileName) { + try { + if (!missedDictionaryKey.containsKey(theContentKey + "_" + theContentKey)) { + missedFileName = missedFileName + "_missed"; + try { + ResourceBundle rb = ResourceBundle.getBundle(missedFileName, new Locale(l_lang, l_lang)); + rb.getString(theContentKey); + } catch (Exception e) { + FileWr fw = new FileWr(missedFileName + "_" + missedFileName + ".properties", true); + fw.writeLine(theContentKey + "="); + fw.closeFile(); + } + missedDictionaryKey.put(theContentKey + "_" + theContentKey, theContentKey); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + private String getMissDictionaryPropertyPath() { + String temp = getResource("DICT_MISS_PROP_PTH"); + return temp.isEmpty() ? "/" : temp; + } + + private String getDictionaryPropertyFile() { + String temp = getResource("DICT_PROP_FILE"); + return temp.isEmpty() ? "dict" : temp; + } + + public String translate(String sentence, String l_lang) { + String sentenceKeyH = String.valueOf(sentence.hashCode()); + return translate(sentenceKeyH, sentence, l_lang); + } + + public String translate(String sentenceKeyH, String sentence, String l_lang) { + String sentenceKey = sentence; + sentenceKey = sentence.replace('\n', ' '); + sentenceKey = sentenceKey.replace('\r', ' '); + sentenceKey = sentenceKey.trim().replaceAll(" +", "_"); + String sentenceKeyNew = sentenceKeyH + "_" + sentenceKeyH; + l_lang = l_lang.toLowerCase(); + if (l_lang.isEmpty() || l_lang.equals(getDefaultLangCode())) + return sentence; + try { + ResourceBundle rb; + String translation = null; + if (!getDictionarys().containsKey(l_lang + l_lang)) { + rb = ResourceBundle.getBundle(getDictionaryPropertyFile(), new Locale(l_lang, l_lang)); + dictionarys.put(l_lang + l_lang, rb); + } else { + rb = dictionarys.get(l_lang + l_lang); + } + if (rb.containsKey(sentenceKey)) { + translation = rb.getString(sentenceKey); + } else if (rb.containsKey(sentenceKeyH)) { + translation = rb.getString(sentenceKeyH); + } else { + translation = rb.getString(sentenceKeyNew); + } + if (translation == null || translation.isEmpty()) { + if (translation != null) + appendNewLangKey(sentenceKeyNew, l_lang, getMissDictionaryPropertyPath() + getMissDictionaryPropertyPath()); + return "." + sentence + "."; + } + return translation; + } catch (MissingResourceException mre) { + String temp = "Translate key for " + getDictionaryPropertyFile() + "_" + l_lang + " missed: " + sentenceKey; + appendNewLangKey(sentenceKeyNew, l_lang, getMissDictionaryPropertyPath() + getMissDictionaryPropertyPath()); + handleDebug(temp, 2); + return "." + sentence + "."; + } catch (Exception e) { + handleDebug(e, 2); + return "Translate failed"; + } + } + + public NumberFormat getNf0() { + if (!hmNf0.containsKey(getLocale())) { + getLocale(); + NumberFormat nf = NumberFormat.getInstance(Locale.ITALIAN); + nf.setMaximumFractionDigits(0); + nf.setMinimumFractionDigits(0); + hmNf0.put(getLocale(), nf); + } + return hmNf0.get(getLocale()); + } + + public NumberFormat getNf2() { + if (!hmNf2.containsKey(getLocale())) { + getLocale(); + NumberFormat nf = NumberFormat.getInstance(Locale.ITALIAN); + nf.setMaximumFractionDigits(2); + nf.setMinimumFractionDigits(2); + hmNf2.put(getLocale(), nf); + } + return hmNf2.get(getLocale()); + } + + public NumberFormat getNf3() { + if (!hmNf3.containsKey(getLocale())) { + getLocale(); + NumberFormat nf = NumberFormat.getInstance(Locale.ITALIAN); + nf.setMaximumFractionDigits(3); + nf.setMinimumFractionDigits(3); + hmNf3.put(getLocale(), nf); + } + return hmNf3.get(getLocale()); + } + + public String getConnectionsCreateTs() { + ConnectionPool cp = ConnectionPool.getInstance(this); + StringBuilder res = new StringBuilder(); + int i = 0; + List freeSnapshot = new ArrayList<>(cp.getFree()); + for (CPConnection row : freeSnapshot) { + i++; + res.append("F #").append(i).append(" ").append(row.getLifeTime()).append("-->").append(row.getHits()).append(" hits"); + res.append("
    "); + } + List usedSnapshot = new ArrayList<>(cp.getUsed()); + i = 0; + if (!usedSnapshot.isEmpty()) { + res.append("
    "); + for (CPConnection row : usedSnapshot) { + i++; + res.append("U #").append(i).append(" ").append(row.getLifeTime()).append(" (").append(row.getCallTime()).append(")") + .append("-->").append(row.getHits()).append(" hits").append(" --> depth: ").append(row.getTxOwnerDepth()); + if (!row.getReqIpAddress().isEmpty()) + res.append("
    ip: ").append(row.getReqIpAddress()); + if (!row.getReqUrl().isEmpty()) + res.append("
    Url: ").append(row.getReqUrl()); + if (row.getLastUpdId_user() != 0L) + res.append("
    User id: ").append(row.getLastUpdId_user()); + if (!row.getLastCallingStackTrace().isEmpty()) + res.append("
    ").append(DBAdapter.convertStringToHtml(row.getLastCallingStackTrace())); + res.append("
    "); + } + res.append("
    "); + } + return res.toString(); + } + + public NumberFormat getNf4() { + if (!hmNf4.containsKey(getLocale())) { + getLocale(); + NumberFormat nf = NumberFormat.getInstance(Locale.ITALIAN); + nf.setMaximumFractionDigits(4); + nf.setMinimumFractionDigits(4); + hmNf4.put(getLocale(), nf); + } + return hmNf4.get(getLocale()); + } + + public NumberFormat getNf5() { + if (!hmNf5.containsKey(getLocale())) { + getLocale(); + NumberFormat nf = NumberFormat.getInstance(Locale.ITALIAN); + nf.setMaximumFractionDigits(5); + nf.setMinimumFractionDigits(5); + hmNf5.put(getLocale(), nf); + } + return hmNf5.get(getLocale()); + } + + public NumberFormat getNf1() { + if (!hmNf1.containsKey(getLocale())) { + getLocale(); + NumberFormat nf = NumberFormat.getInstance(Locale.ITALIAN); + nf.setMaximumFractionDigits(1); + nf.setMinimumFractionDigits(1); + hmNf1.put(getLocale(), nf); + } + return hmNf1.get(getLocale()); + } + + public Parm xxxxgetParmXXXXXX(String theKey) { + int logLevel = 2; + if (allWebAppParms == null) + allWebAppParms = new Hashtable<>(); + if (!allWebAppParms.containsKey(getApCodeParms())) + synchronized (allWebAppParms) { + if (!allWebAppParms.containsKey(getApCodeParms())) { + Hashtable theParms = new Hashtable<>(); + Parm parm = new Parm(new ApplParmFull(this)); + Vectumerator vec = parm.findAll(); + while (vec.hasMoreElements()) { + Parm row = (Parm)vec.nextElement(); + theParms.put(row.getCodice(), row); + } + allWebAppParms.put(getApCodeParms(), theParms); + } + } + theKey = theKey.trim().toUpperCase(); + Hashtable parms = allWebAppParms.get(getApCodeParms()); + if (parms.containsKey(theKey)) + return parms.get(theKey); + Parm bean = new Parm(); + if (theKey.equals("DEBUG")) { + bean.setCodice("DEBUG"); + bean.setTesto("false"); + bean.setNumero(1.0D); + } else if (theKey.equals("LOCALE")) { + bean.setCodice("LOCALE"); + bean.setTesto("it"); + } else if (theKey.equals("LOG_USERS_UPDATES")) { + bean.setCodice("LOG_USERS_UPDATES"); + bean.setNumero(0.0D); + } else { + if (theKey.equals("FROM") || theKey.equals("TO_DEBUG") || + theKey.equals("SMTP")) + logLevel = 2; + handleDebug("Parm.getParm(theKey): codice NON PRESENTE: " + theKey, logLevel); + } + System.out.println("WARNING: AP: " + getDatabase() + " codice non presente: " + theKey); + return bean; + } + + public SimpleDateFormat getTimestampFormat() { + if (this.tsf == null) + this.tsf = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + return this.tsf; + } + + public SimpleDateFormat getTimestampFormatForFiles() { + if (this.tsfForFile == null) + this.tsfForFile = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); + return this.tsfForFile; + } + + public static final void resetHashtable(String apCode) { + if (dictionarys != null) { + dictionarys.clear(); + dictionarys = null; + } + if (allWebAppParms != null && allWebAppParms.containsKey(apCode)) + allWebAppParms.remove(apCode); + if (allRewriteRules != null && allRewriteRules.containsKey(apCode)) + allRewriteRules.remove(apCode); + } + + public void reloadAllResourceBundles() { + try { + ResourceBundle.clearCache(); + this.propertyResource = null; + } catch (Exception e) { + System.err.println("ApplPrm.reloadAllResourceBundles : " + e.getMessage()); + } + } + + private static Hashtable getDictionarys() { + if (dictionarys == null) + dictionarys = new Hashtable<>(); + return dictionarys; + } + + public Parm getParmNoHt(String theKey) { + if (theKey.equals("DEBUG")) { + Parm bean = new Parm(); + bean.setCodice("DEBUG"); + bean.setTesto(getResourceFromPropertyFile(theKey)); + if (bean.getTesto().equals("true")) + bean.setNumero(1.0D); + return bean; + } + if (theKey.equals("LOCALE")) { + Parm bean = new Parm(); + bean.setCodice("LOCALE"); + bean.setTesto(getResourceFromPropertyFile(theKey)); + return bean; + } + Parm parm = new Parm(new ApplParmFull(this)); + try { + parm.findByCodice(theKey); + return parm; + } catch (Exception e) { + handleDebug(e, 3); + return parm; + } + } + + public Parm getParm(String theKey) { + if (allWebAppParms == null) + allWebAppParms = new Hashtable<>(); + int logLevel = 2; + if (!allWebAppParms.containsKey(getApCodeParms())) { + if (theKey.equals("DEBUG")) { + Parm parm = new Parm(); + parm.setCodice("DEBUG"); + parm.setTesto("false"); + parm.setNumero(0.0D); + return parm; + } + if (theKey.equals("LOCALE")) { + Parm parm = new Parm(); + parm.setCodice("LOCALE"); + parm.setTesto("it"); + return parm; + } + if (theKey.equals("LOG_USERS_UPDATES")) { + Parm parm = new Parm(); + parm.setCodice("LOG_USERS_UPDATES"); + parm.setNumero(0.0D); + return parm; + } + if (theKey.equals("DEBUG_QUERY_ENABLE")) { + Parm parm = new Parm(); + parm.setCodice("DEBUG_QUERY_ENABLE"); + parm.setNumero(0.0D); + return parm; + } + if (theKey.equals("DEBUG_LEVEL")) { + Parm parm = new Parm(); + parm.setCodice("DEBUG_LEVEL"); + parm.setNumero(0.0D); + return parm; + } + } + if (!allWebAppParms.containsKey(getApCodeParms())) + synchronized (allWebAppParms) { + if (!allWebAppParms.containsKey(getApCodeParms())) { + Hashtable theParms = new Hashtable<>(); + Parm parm = new Parm(new ApplParmFull(this)); + Vectumerator vec = parm.findAll(); + while (vec.hasMoreElements()) { + Parm row = (Parm)vec.nextElement(); + theParms.put(row.getCodice(), row); + } + if (theParms.containsKey("LANG_AVAILABLE")) { + Parm pLangAvail = theParms.get("LANG_AVAILABLE"); + StringTokenizer st = new StringTokenizer(pLangAvail.getTesto(), ","); + if (st.hasMoreTokens()) { + Parm p = new Parm(new ApplParmFull(this)); + p.setCodice("LANG_PRIMARY"); + p.setTesto(st.nextToken()); + theParms.put(p.getCodice(), p); + } + if (st.hasMoreTokens()) { + Parm p = new Parm(new ApplParmFull(this)); + p.setCodice("LANG_SECONARY"); + p.setTesto(st.nextToken()); + theParms.put(p.getCodice(), p); + } + } + allWebAppParms.put(getApCodeParms(), theParms); + } + } + theKey = theKey.trim().toUpperCase(); + Hashtable parms = allWebAppParms.get(getApCodeParms()); + if (parms != null && parms.containsKey(theKey)) + return parms.get(theKey); + Parm bean = new Parm(); + if (theKey.equals("DEBUG")) { + bean.setCodice("DEBUG"); + bean.setTesto("false"); + bean.setNumero(1.0D); + } else if (theKey.equals("LOCALE")) { + bean.setCodice("LOCALE"); + bean.setTesto("it"); + } else { + if (theKey.equals("FROM") || theKey.equals("TO_DEBUG") || + theKey.equals("SMTP")) + logLevel = 2; + handleDebug("Parm.getParm(theKey): codice NON PRESENTE: " + theKey, logLevel); + } + DBAdapter.printDebug("WARNING: AP: " + getDatabase() + " codice non presente: " + theKey); + return bean; + } + + public boolean isParmsHtReadyxxx() { + if (allWebAppParms != null && allWebAppParms.containsKey(getApCodeParms())) + return true; + return false; + } + + public String getCatalog() { + return this.catalog; + } + + public void setCatalog(String databaseName) { + this.catalog = databaseName; + } + + public long getTotalHits() { + ConnectionPool cp = ConnectionPool.getInstance(this); + long totalHits = 0L; + for (CPConnection row : new ArrayList<>(cp.getFree())) + totalHits += (long)row.getHits(); + for (CPConnection row : new ArrayList<>(cp.getUsed())) + totalHits += (long)row.getHits(); + return totalHits; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ApplParmFull.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ApplParmFull.java new file mode 100644 index 00000000..791a53c5 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ApplParmFull.java @@ -0,0 +1,497 @@ +package it.acxent.db; + +import it.acxent.common.Parm; +import it.acxent.common.Users; +import it.acxent.reg.EcDc; +import it.acxent.util.SimpleDateFormat; +import java.io.Serializable; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.Time; +import java.sql.Timestamp; +import java.text.NumberFormat; +import java.util.Locale; +import java.util.Properties; +import javax.servlet.ServletContext; + +public class ApplParmFull implements Serializable { + private static final long serialVersionUID = 5716730193350553875L; + + private ApplParm ap; + + private long lastUpdId_user; + + private String reqIpAddress; + + private Users lastUpdUser; + + private String reqUrl; + + private String msg; + + public ApplParmFull(ApplParm applParm, long lastUpdId_user, String reqIpAddress, String reqUrl) { + this.ap = applParm; + this.lastUpdId_user = lastUpdId_user; + this.reqIpAddress = reqIpAddress; + this.reqUrl = reqUrl; + } + + public long getLastUpdId_user() { + return this.lastUpdId_user; + } + + public void setLastUpdId_user(long lastUpdId_user) { + this.lastUpdId_user = lastUpdId_user; + setLastUpdUser(null); + } + + public String getReqIpAddress() { + return (this.reqIpAddress == null) ? "" : this.reqIpAddress.trim(); + } + + public void setReqIpAddress(String reqIpAddress) { + this.reqIpAddress = reqIpAddress; + } + + public ApplParmFull() {} + + public ApplParmFull(ApplParm applParm) { + this.ap = applParm; + } + + public ApplParm getAp() { + return this.ap; + } + + public void setAp(ApplParm applParm) { + this.ap = applParm; + } + + public Parm getParm(String theKey) { + return getAp().getParm(theKey); + } + + public int getParmValue(String theKey, int defaultValue) { + Parm parm = getParm(theKey); + if (parm == null || parm.getId_parm() == 0L) + return defaultValue; + return parm.getNumeroInt(); + } + + public long getParmValue(String theKey, long defaultValue) { + Parm parm = getParm(theKey); + if (parm == null || parm.getId_parm() == 0L) + return defaultValue; + return parm.getNumeroLong(); + } + + public double getParmValue(String theKey, double defaultValue) { + Parm parm = getParm(theKey); + if (parm == null || parm.getId_parm() == 0L) + return defaultValue; + return parm.getNumeroDouble(); + } + + public String getParmValue(String theKey, String defaultValue) { + Parm parm = getParm(theKey); + if (parm == null || parm.getId_parm() == 0L) + return defaultValue; + return parm.getTesto(); + } + + public boolean getParmValue(String theKey, boolean defaultValue) { + Parm parm = getParm(theKey); + if (parm == null || parm.getId_parm() == 0L) + return defaultValue; + return (parm.getNumeroLong() != 0L); + } + + public Date getParmValue(String theKey, Date defaultValue) { + Parm parm = getParm(theKey); + if (parm == null || parm.getId_parm() == 0L) + return defaultValue; + return parm.getDataParm(); + } + + public Time getParmValue(String theKey, Time defaultValue) { + Parm parm = getParm(theKey); + if (parm == null || parm.getId_parm() == 0L) + return defaultValue; + return parm.getOra(); + } + + public Timestamp getParmValue(String theKey, Timestamp defaultValue) { + Parm parm = getParm(theKey); + if (parm == null || parm.getId_parm() == 0L) + return defaultValue; + return parm.getTimeStamp(); + } + + public String getApCode() { + return getAp().getApCode(); + } + + public int hashCode() { + return this.ap.hashCode(); + } + + public void handleDebug(Exception exception) { + this.ap.handleDebug(exception); + } + + public void handleDebug(Exception exception, int logLevel) { + this.ap.handleDebug(exception, logLevel); + } + + public void handleDebug(PreparedStatement ps) { + this.ap.handleDebug(ps); + } + + public void handleDebug(PreparedStatement ps, int logLevel) { + this.ap.handleDebug(ps, logLevel); + } + + public void handleDebug(String s) { + this.ap.handleDebug(s); + } + + public void handleDebug(String s, int logLevel) { + this.ap.handleDebug(s, logLevel); + } + + public String getApCode(DBAdapter obj) { + return this.ap.getApCode(obj); + } + + public void setDebug(boolean flag) { + this.ap.setDebug(flag); + } + + public void setDebugLevel(int i) { + this.ap.setDebugLevel(i); + } + + public void writeLog(String msg) { + this.ap.writeLog(msg); + } + + public String getApDescription() { + return this.ap.getApDescription(); + } + + public int getConnectionLifeTime() { + return this.ap.getConnectionLifeTime(); + } + + public String getConnectionString() { + return this.ap.getConnectionString(); + } + + public String getDatabase() { + return this.ap.getDatabase(); + } + + public String getCatalog() { + return this.ap.getCatalog(); + } + + public SimpleDateFormat getDataFormat() { + return this.ap.getDataFormat(); + } + + public String toString() { + return this.ap.toString(); + } + + public Properties getDbEnvironProperty() { + return this.ap.getDbEnvironProperty(); + } + + public String getDbAtinavpasswd() { + return this.ap.getDbAtinavpasswd(); + } + + public int getDbType() { + return this.ap.getDbType(); + } + + public boolean getDebug() { + return this.ap.getDebug(); + } + + public String getDebugFile() { + return this.ap.getDebugFile(); + } + + public int getDebugLevel() { + return this.ap.getDebugLevel(); + } + + public String getDefaultLangCode() { + return this.ap.getDefaultLangCode(); + } + + public String getDriverManager() { + return this.ap.getDriverManager(); + } + + public int getInitialCons() { + return this.ap.getInitialCons(); + } + + public String getLangCode() { + return this.ap.getLangCode(); + } + + public Locale getLocale() { + return this.ap.getLocale(); + } + + public int getMaxConnectionHits() { + return this.ap.getMaxConnectionHits(); + } + + public int getMaxCons() { + return this.ap.getMaxCons(); + } + + public String getMdwpath() { + return this.ap.getMdwpath(); + } + + public NumberFormat getNf() { + return this.ap.getNf(); + } + + public String getPassword() { + return this.ap.getPassword(); + } + + public String getPropertyFileName() { + return this.ap.getPropertyFileName(); + } + + public String getResource(String key) { + return this.ap.getResource(key); + } + + public String getPropertyFile() { + return this.ap.getPropertyFile(); + } + + public void setPropertyFile(String propertyFile) { + this.ap.setPropertyFile(propertyFile); + } + + public final String getSoftwareVersion() { + return this.ap.getSoftwareVersion(); + } + + public String getResourceFromPropertyFile(String key) { + return this.ap.getResourceFromPropertyFile(key); + } + + public final String getSoftwareVersionLog() { + return this.ap.getSoftwareVersionLog(); + } + + public SimpleDateFormat getTimeFormat() { + return this.ap.getTimeFormat(); + } + + public int getTimeout() { + return this.ap.getTimeout(); + } + + public String getUrl() { + return this.ap.getUrl(); + } + + public String getUser() { + return this.ap.getUser(); + } + + public boolean isBlock() { + return this.ap.isBlock(); + } + + public boolean isReuseCons() { + return this.ap.isReuseCons(); + } + + public void setApCode(String newApCode) { + this.ap.setApCode(newApCode); + } + + public void setBlock(boolean block) { + this.ap.setBlock(block); + } + + public void setConnectionLifeTime(int l_connectionLifeTime) { + this.ap.setConnectionLifeTime(l_connectionLifeTime); + } + + public void setDatabase(String s) { + this.ap.setDatabase(s); + } + + public void setDbEnvironProperty(Properties newDbEnvironProperty) { + this.ap.setDbEnvironProperty(newDbEnvironProperty); + } + + public void setDbAtinavpasswd(String dbpasswd) { + this.ap.setDbAtinavpasswd(dbpasswd); + } + + public void setDbType(int newDbType) { + this.ap.setDbType(newDbType); + } + + public void setDebugFile(String string) { + this.ap.setDebugFile(string); + } + + public void setInitialCons(int i) { + this.ap.setInitialCons(i); + } + + public void setLangCode(String newLangCode) { + this.ap.setLangCode(newLangCode); + } + + public void setMaxConnectionHits(int maxConnectionHits) { + this.ap.setMaxConnectionHits(maxConnectionHits); + } + + public void setMaxCons(int i) { + this.ap.setMaxCons(i); + } + + public void setMdwpath(String mdwpath) { + this.ap.setMdwpath(mdwpath); + } + + public void setPassword(String s) { + this.ap.setPassword(s); + } + + public void setPropertyFileName(String newPropertyFileName) { + this.ap.setPropertyFileName(newPropertyFileName); + } + + public void setReuseCons(boolean reuseCons) { + this.ap.setReuseCons(reuseCons); + } + + public void setTimeout(int i) { + this.ap.setTimeout(i); + } + + public void setUser(String s) { + this.ap.setUser(s); + } + + public RewriteRule getRewriteRule(String theCode) { + return this.ap.getRewriteRule(theCode); + } + + public void resetCurrentApParms() { + this.ap.resetCurrentApParms(); + } + + public String translate(String sentence, String l_lang) { + return this.ap.translate(sentence, l_lang); + } + + public String translate(String sentenceKeyH, String sentence, String l_lang) { + return this.ap.translate(sentenceKeyH, sentence, l_lang); + } + + public NumberFormat getNf0() { + return this.ap.getNf0(); + } + + public NumberFormat getNf2() { + return this.ap.getNf2(); + } + + public NumberFormat getNf3() { + return this.ap.getNf3(); + } + + public String getConnectionsCreateTs() { + return this.ap.getConnectionsCreateTs(); + } + + public NumberFormat getNf4() { + return this.ap.getNf4(); + } + + public NumberFormat getNf1() { + return this.ap.getNf1(); + } + + public SimpleDateFormat getTimestampFormat() { + return this.ap.getTimestampFormat(); + } + + public Parm getParmNoHt(String theKey) { + return this.ap.getParmNoHt(theKey); + } + + public Users getLastUpdUser() { + if (this.lastUpdUser == null && getLastUpdId_user() > 0L) { + this.lastUpdUser = new Users(this); + this.lastUpdUser.findByPrimaryKey(getLastUpdId_user()); + } + return (this.lastUpdUser == null) ? new Users(this) : this.lastUpdUser; + } + + public void setLastUpdUser(Users lastUpdUser) { + this.lastUpdUser = lastUpdUser; + } + + public String getReqUrl() { + return (this.reqUrl == null) ? "" : this.reqUrl.trim(); + } + + public void setReqUrl(String reqUrl) { + this.reqUrl = reqUrl; + } + + public String getEncryptedPassword(String plainPassword) { + long flgCrypt = getParm("PWD_CRYPT").getNumeroLong(); + String cryptedPwd = plainPassword; + if (flgCrypt == 1L) { + cryptedPwd = EcDc.encodeDizionario(plainPassword, "Xg3Z5sFQ"); + } else if (flgCrypt == 2L) { + cryptedPwd = EcDc.cryptMD5(plainPassword); + } else if (flgCrypt == 3L) { + cryptedPwd = EcDc.cryptSHA(plainPassword, "SHA-256"); + } + return cryptedPwd; + } + + public String getMsg() { + return (this.msg == null) ? "" : this.msg.trim(); + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public boolean isCrontabEnable(ServletContext servletContext) { + if ((long)getParm("DAILY_CRONTAB_ENABLE").getNumeroInt() == 1L) { + String webappInstance = servletContext.getInitParameter("instance"); + String dbInstance = getParm("DAILY_CRONTAB_INSTANCE").getTesto(); + if (dbInstance.isEmpty() || dbInstance.equals(webappInstance)) { + if (getParm("IS_LOCALHOST").isFalse() || ( + getParm("IS_LOCALHOST").isTrue() && getParm("CRONTAB_LOCALHOST").isTrue())) + return true; + return false; + } + return false; + } + return false; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/BeanValidator.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/BeanValidator.java new file mode 100644 index 00000000..2c6a2306 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/BeanValidator.java @@ -0,0 +1,48 @@ +package it.acxent.db; + +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import jakarta.validation.ConstraintViolation; +import jakarta.validation.Validation; +import jakarta.validation.Validator; +import jakarta.validation.ValidatorFactory; +import java.util.Set; + +public class BeanValidator { + private static final ValidatorFactory factory = Validation.buildDefaultValidatorFactory(); + + private static final Validator validator = factory.getValidator(); + + public static ResParm validate(Object bean) { + Set> violations = validator.validate(bean, new Class[0]); + ResParm result = new ResParm(); + if (violations.isEmpty()) { + result.setStatus(true); + result.setMsg("Validation passed"); + JsonObject jsonOk = new JsonObject(); + jsonOk.addProperty("status", Boolean.valueOf(true)); + jsonOk.addProperty("message", "Validation passed"); + result.setJsonResult(jsonOk); + return result; + } + result.setStatus(false); + StringBuilder sb = new StringBuilder(); + JsonObject json = new JsonObject(); + json.addProperty("status", Boolean.valueOf(false)); + JsonArray errors = new JsonArray(); + for (ConstraintViolation v : violations) { + String field = v.getPropertyPath().toString(); + String message = v.getMessage(); + sb.append("- ").append(field).append(": ").append(message).append("\n"); + JsonObject error = new JsonObject(); + error.addProperty("field", field); + error.addProperty("message", message); + errors.add((JsonElement)error); + } + json.add("errors", (JsonElement)errors); + result.setMsg(sb.toString().trim()); + result.setJsonResult(json); + return result; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/CPConnection.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/CPConnection.java new file mode 100644 index 00000000..7320f482 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/CPConnection.java @@ -0,0 +1,296 @@ +package it.acxent.db; + +import it.acxent.util.Debug; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.Calendar; + +public class CPConnection extends Debug { + private static final long serialVersionUID = -616911378329804676L; + + private volatile boolean released; + + private ApplParm ap; + + private Connection conn; + + private Timestamp createTs; + + private int hits; + + private String lastCallingStackTrace; + + private Timestamp callTs; + + private String reqUrl; + + private long lastUpdId_user; + + private String reqIpAddress; + + private ResParm rp; + + private boolean txFailed = false; + + private int txOwnerDepth = 0; + + private boolean txStarted = false; + + public static CPConnection getInstance(ApplParm ap) { + CPConnection cpC = null; + synchronized (ap) { + cpC = new CPConnection(ap); + cpC.setRp(cpC.initConn()); + } + return cpC; + } + + private CPConnection(ApplParm newAp) { + this.ap = newAp; + } + + public boolean isReleased() { + return this.released; + } + + public void markReleased() { + this.released = true; + } + + public boolean isTxStarted() { + return this.txStarted; + } + + public void setTxStarted(boolean txStarted) { + this.txStarted = txStarted; + } + + public synchronized void acquire() { + this.txOwnerDepth++; + } + + public boolean isTxActive() { + return (this.txOwnerDepth > 0); + } + + public synchronized void startTX() throws SQLException { + if (this.txOwnerDepth == 0) { + DBAdapter.printDebug(false, "startTX: Avvio TX (Depth 0 -> 1), setAutoCommit(false)"); + getConn().setAutoCommit(true); + } else { + DBAdapter.printDebug(false, "startTX: Incremento Depth TX (" + this.txOwnerDepth + " -> " + this.txOwnerDepth + 1 + ")"); + } + this.txOwnerDepth++; + } + + public void addHit() { + this.hits++; + } + + public void close() { + try { + if (this.conn != null && !this.conn.isClosed()) + this.conn.close(); + } catch (SQLException e) { + handleDebug(e, 0); + } + if (this == DBAdapter.getThreadLocal(getApFull().getApCode()).get()) + DBAdapter.getThreadLocal(getApFull().getApCode()).remove(); + } + + protected void finalize() throws Throwable { + close(); + this.conn = null; + } + + public ApplParm getApFull() { + return this.ap; + } + + public Connection getConn() { + return this.conn; + } + + public void setConnNul() { + this.conn = null; + } + + public Timestamp getCreateTs() { + return this.createTs; + } + + public boolean getDebug() { + if (getApFull() != null) + return getApFull().getDebug(); + return super.getDebug(); + } + + public String getDebugFile() { + if (getApFull() != null) + return getApFull().getDebugFile(); + return getDebugFile(); + } + + public int getDebugLevel() { + if (getApFull() != null) + return getApFull().getDebugLevel(); + return getDebugLevel(); + } + + public int getHits() { + return this.hits; + } + + public String getLastCallingStackTrace() { + return (this.lastCallingStackTrace == null) ? "" : this.lastCallingStackTrace.trim(); + } + + public Timestamp getCallTs() { + return this.callTs; + } + + private ResParm initConn() { + ResParm rp = new ResParm(true); + if (this.conn == null) { + try { + if (this.ap.getDbEnvironProperty() != null) { + this.conn = DriverManager.getConnection(this.ap.getConnectionString() + ":" + this.ap.getConnectionString(), this.ap.getDbEnvironProperty()); + } else { + this.conn = DriverManager.getConnection(this.ap.getConnectionString() + ":" + this.ap.getConnectionString(), this.ap.getUser(), this.ap.getPassword()); + } + this.createTs = new Timestamp(Calendar.getInstance().getTime().getTime()); + this.hits = 0; + rp.setStatus(true); + } catch (Exception e) { + rp.setStatus(false); + rp.setMsg("CPConnection.initConn: Error during connection.....: " + e.getMessage() + "\nDatabase resource: " + + this.ap.getDatabase() + "\nDatabase catalog: " + this.ap.getCatalog() + "\nDatabase type: " + this.ap.getDbType() + "\nDatabase url: " + + this.ap.getUrl() + "\nUser: " + this.ap.getUser() + "\nPassword: " + this.ap.getPassword() + "\nDbpasswd: " + + this.ap.getDbAtinavpasswd() + "\n" + e.getMessage()); + } + } else { + rp.setStatus(false); + rp.setMsg("CPConnection.initConn: connessione nulla!!"); + } + return rp; + } + + public boolean isValid() { + try { + Connection c = getConn(); + if (c == null || c.isClosed()) + return false; + if (getApFull().getDbType() == 17) + return c.isValid(0); + return true; + } catch (Exception e) { + handleDebug(e, 0); + return false; + } + } + + public void setLastCallingStackTrace(String lastCallingStackTrace) { + this.lastCallingStackTrace = lastCallingStackTrace; + } + + public void setCallTs(Timestamp lastFreeTs) { + this.callTs = lastFreeTs; + } + + public long getLifeTimeSeconds() { + long mt1 = getCreateTs().getTime(); + long mt2 = Calendar.getInstance().getTimeInMillis(); + return (mt2 - mt1) / 1000L; + } + + public String getLifeTime() { + return DBAdapter.secToHourMinSec(getLifeTimeSeconds()); + } + + public String getCallTime() { + long ctm = getCallTimeMilliSeconds(); + if (ctm < 10000L) { + int sec = (int)ctm / 1000; + int ms = (int)(ctm - (long)(sec * 1000)); + return "" + sec + "," + sec + " ms"; + } + return DBAdapter.secToHourMinSec(ctm / 1000L); + } + + public long getCallTimeMilliSeconds() { + if (getCallTs() != null) { + long mt1 = getCallTs().getTime(); + long mt2 = Calendar.getInstance().getTimeInMillis(); + return mt2 - mt1; + } + return 0L; + } + + public String getReqIpAddress() { + return (this.reqIpAddress == null) ? "" : this.reqIpAddress; + } + + public void setReqIpAddress(String reqIpAddress) { + this.reqIpAddress = reqIpAddress; + } + + public String getReqUrl() { + return (this.reqUrl == null) ? "" : this.reqUrl; + } + + public void setReqUrl(String reqUrl) { + this.reqUrl = reqUrl; + } + + public long getLastUpdId_user() { + return this.lastUpdId_user; + } + + public void setLastUpdId_user(long lastUpdId_user) { + this.lastUpdId_user = lastUpdId_user; + } + + public ResParm getRp() { + return this.rp; + } + + public void setRp(ResParm rp) { + this.rp = rp; + } + + public void setTxFailed(boolean v) { + this.txFailed = v; + } + + public boolean isTxFailed() { + return this.txFailed; + } + + public void incrementTxOwnerDepth() { + this.txOwnerDepth++; + } + + public void setTxOwnerDepth(int l_depth) { + this.txOwnerDepth = l_depth; + } + + public void forceReleaseTransaction() { + this.txOwnerDepth = 1; + } + + public void decrementTxOwnerDepth() { + if (this.txOwnerDepth > 0) + this.txOwnerDepth--; + } + + public int getTxOwnerDepth() { + return this.txOwnerDepth; + } + + public void resetTxFlags() { + this.txFailed = false; + this.txOwnerDepth = 0; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/CRAdapter.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/CRAdapter.java new file mode 100644 index 00000000..6fb87716 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/CRAdapter.java @@ -0,0 +1,503 @@ +package it.acxent.db; + +import it.acxent.annotation.CRDescriptor; +import it.acxent.common.Parm; +import it.acxent.util.Debug; +import java.io.Serializable; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.sql.Date; +import java.sql.Time; +import java.sql.Timestamp; +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +public class CRAdapter extends Debug implements Serializable { + private static final long serialVersionUID = -693587215327844433L; + + public static String AB_EMPTY_STRING = ""; + + protected HashMap crFieldDescriptor; + + private ApplParmFull apFull; + + private Timestamp createTmst; + + private String searchTxt; + + protected DBAdapter getSecondaryObject(DBAdapter obj, Class objClass, long pkLongValue) { + return getSecondaryObject(obj, objClass, Long.valueOf(pkLongValue)); + } + + protected DBAdapter getSecondaryObject(DBAdapter obj, Class objClass, Object pkValue) { + try { + return DBAdapter.getSecondaryObject(getApFull(), obj, objClass, pkValue); + } catch (Exception e) { + handleDebug(e); + return obj; + } + } + + private boolean searchRequest = false; + + private long flgOrderBy; + + private long flgTipoReport; + + private int pageRow; + + private int pageNumber; + + private int searchPageNumber; + + private String currentTab; + + private String cmd; + + private String flgReport; + + private long id_users; + + private String act; + + private String lang; + + private long flgShowDeleteLogic = 0L; + + private String currentFocus; + + private String _id; + + private String filePdf; + + private String fileName; + + private Timestamp lastUpdTmst; + + private String searchRighe; + + private String searchRighe2; + + private long flgMobileView = 1L; + + private String TAG_THREAD_MSG; + + public CRAdapter() {} + + public CRAdapter(ApplParmFull newAp) { + setApFull(newAp); + } + + public ApplParmFull getApFull() { + return this.apFull; + } + + public String getFlgReport() { + return (this.flgReport == null) ? "" : this.flgReport.trim(); + } + + public String getLang() { + return (this.lang == null) ? "it" : this.lang.trim().toLowerCase(); + } + + public int getSearchPageNumber() { + return (this.searchPageNumber == 0) ? 1 : this.searchPageNumber; + } + + public boolean isSearchRequest() { + return this.searchRequest; + } + + public void setApFull(ApplParmFull newAp) { + this.apFull = newAp; + } + + public void setFlgReport(String newFlgReport) { + this.flgReport = newFlgReport; + } + + public void setLang(String newLang) { + this.lang = newLang; + } + + public void setSearchPageNumber(int newSearchPageNumber) { + this.searchPageNumber = newSearchPageNumber; + } + + public void setSearchRequest(boolean newSearchRequest) { + this.searchRequest = newSearchRequest; + } + + public long getFlgTipoReport() { + return this.flgTipoReport; + } + + public void setFlgTipoReport(long flgTipoReport) { + this.flgTipoReport = flgTipoReport; + } + + public int getPageNumber() { + return this.pageNumber; + } + + public void setPageNumber(int pageNumber) { + this.pageNumber = pageNumber; + } + + public int getPageRow() { + return this.pageRow; + } + + public void setPageRow(int pageRow) { + this.pageRow = pageRow; + } + + public String getSearchTxt() { + return (this.searchTxt == null) ? AB_EMPTY_STRING : this.searchTxt.trim(); + } + + public void setSearchTxt(String searchTxt) { + this.searchTxt = searchTxt; + } + + public String getCurrentTab() { + return (this.currentTab == null) ? AB_EMPTY_STRING : this.currentTab.trim(); + } + + public void setCurrentTab(String currentTab) { + this.currentTab = currentTab; + } + + public long getFlgOrderBy() { + return this.flgOrderBy; + } + + public void setFlgOrderBy(long flgOrderBy) { + this.flgOrderBy = flgOrderBy; + } + + public long getId_users() { + return this.id_users; + } + + public void setId_users(long newId_users) { + this.id_users = newId_users; + } + + public String getCmd() { + return (this.cmd == null) ? AB_EMPTY_STRING : this.cmd.trim(); + } + + public void setCmd(String cmd) { + this.cmd = cmd; + } + + public String getAct() { + return (this.act == null) ? AB_EMPTY_STRING : this.act.trim(); + } + + public void setAct(String act) { + this.act = act; + } + + public long getFlgShowDeleteLogic() { + return this.flgShowDeleteLogic; + } + + public void setFlgShowDeleteLogic(long flgShowDeleteLogic) { + this.flgShowDeleteLogic = flgShowDeleteLogic; + } + + public String getCurrentFocus() { + return (this.currentFocus == null) ? AB_EMPTY_STRING : this.currentFocus.trim(); + } + + public void setCurrentFocus(String currentFocus) { + this.currentFocus = currentFocus; + } + + public String get_id() { + return (this._id == null) ? AB_EMPTY_STRING : this._id.trim(); + } + + public void set_id(String anchor) { + this._id = anchor; + } + + public String getFilePdf() { + return this.filePdf; + } + + public void setFilePdf(String filePdf) { + this.filePdf = filePdf; + } + + private void buildDescrizioneCRMap() { + boolean debug = false; + initCrFieldDescriptor(); + Class currentclClass = getClass(); + while (!currentclClass.getName().equals("it.acxent.db.CRAdapter")) { + Field[] ff1 = currentclClass.getDeclaredFields(); + int order = 1000; + for (Field element : ff1) { + String name = element.getName(); + String desc = name; + CRDescriptor annotation = element.getAnnotation(CRDescriptor.class); + if (annotation == null || annotation.abilita()) { + if (annotation != null) + desc = annotation.descrizione(); + Object valueUpd = getCRValueByFieldname(name, element.getType(), this); + String valueS = convertCRValueToString(valueUpd, element.getType()); + DBAdapter.logDebug(debug, "buildDescrizioneCRMap: " + desc + " (" + name + "): " + valueS); + DBAdapter.logDebug(debug, name + ": " + name); + if (!valueS.isEmpty()) + if (getCrFieldDescriptor().containsKey(desc)) { + FieldsDescriptor currentCRFD = getCrFieldDescriptor().get(desc); + currentCRFD.setVal(valueS); + getCrFieldDescriptor().put(desc, currentCRFD); + } else { + getCrFieldDescriptor().put(desc, new FieldsDescriptor(desc, (long)order, desc, + convertCRValueToString(valueUpd, element.getType()))); + order++; + } + } + } + currentclClass = currentclClass.getSuperclass(); + } + } + + private static Object getCRValueByFieldname(String filedName, Class tipo, CRAdapter thiss) { + String functionName = "get" + filedName.substring(0, 1).toUpperCase() + filedName.substring(1); + Object value = null; + try { + Method method = thiss.getClass().getMethod(functionName); + value = method.invoke(thiss); + if (filedName.startsWith("flg") && value instanceof Long) { + String descColumn = filedName.substring(3); + functionName = "get" + descColumn.substring(0, 1).toUpperCase() + descColumn.substring(1); + Class[] parm = new Class[1]; + parm[0] = long.class; + Long[] parmValue = { (Long)value }; + method = thiss.getClass().getMethod(functionName); + value = method.invoke(thiss); + } else if (filedName.startsWith("id_")) { + functionName = "get" + filedName.substring(3, 4).toUpperCase() + filedName.substring(4); + method = thiss.getClass().getMethod(functionName); + Object currentObj = method.invoke(thiss); + Method descMethod = currentObj.getClass().getMethod("getDescrizione"); + value = descMethod.invoke(currentObj); + } + } catch (SecurityException e) { + + } catch (NoSuchMethodException e) { + + } catch (IllegalArgumentException e) { + e.printStackTrace(); + } catch (IllegalAccessException e) { + + } catch (InvocationTargetException e) {} + return value; + } + + private static boolean isNotEmpty(Object valueUpd, Class tipo) { + boolean ret = false; + if (valueUpd != null) { + String sclass = valueUpd.getClass().getName(); + if (sclass.indexOf("Long") > 0 || sclass.indexOf("Double") > 0 || sclass.indexOf("String") > 0 || sclass.indexOf("Date") > 0 || + sclass.indexOf("Time") > 0) + if (tipo.getName() == "long") { + if ((Long)valueUpd == 0L || (Long)valueUpd == -1L) { + ret = false; + } else { + ret = true; + } + } else if (tipo.getName() == "double") { + if ((Double)valueUpd == 0.0D) { + ret = false; + } else { + ret = true; + } + } else if (tipo.getName().indexOf("String") > 0) { + if (((String)valueUpd).equals("") || ((String)valueUpd).isEmpty()) { + ret = false; + } else { + ret = true; + } + } else if (tipo.getName().indexOf("Date") > 0) { + Date data = (Date)valueUpd; + if (data == null) { + ret = false; + } else { + ret = true; + } + } else if (tipo.getName().indexOf("Time") > 0) { + if ((Time)valueUpd == null) { + ret = false; + } else { + ret = true; + } + } + } + return ret; + } + + private final String convertCRValueToString(Object valueUpd, Class tipo) { + String ret = AB_EMPTY_STRING; + if (valueUpd != null) { + String sclass = valueUpd.getClass().getName(); + if (sclass.indexOf("String") > 0) { + ret = (String)valueUpd; + } else if (sclass.indexOf("Long") > 0 || sclass.indexOf("Double") > 0 || sclass.indexOf("String") > 0 || sclass.indexOf("Date") > 0 || + sclass.indexOf("Time") > 0) { + if (tipo.getName() == "long") { + if ((Long)valueUpd > 0L) + ret = valueUpd.toString(); + } else if (tipo.getName() == "double" || tipo.getName() == "float") { + if ((Double)valueUpd > 0.0D) + ret = getApFull().getNf().format(valueUpd); + } else if (tipo.getName().indexOf("String") > 0) { + ret = (String)valueUpd; + } else if (tipo.getName().indexOf("Date") > 0) { + Date data = (Date)valueUpd; + if (data != null) + if (getApFull() == null) { + ret = data.toString(); + } else { + ret = getApFull().getDataFormat().format(data); + } + } else if (tipo.getName().indexOf("Time") > 0 && + (Time)valueUpd != null) { + ret = getApFull().getTimeFormat().format((Time)valueUpd); + } + } + } + return ret.trim(); + } + + public String getFileName() { + return (this.fileName == null) ? AB_EMPTY_STRING : this.fileName.trim(); + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public Parm getParm(String theKey) { + if (getApFull() != null) + return getApFull().getAp().getParm(theKey); + return new Parm(); + } + + public final boolean checkVersion(String theKey) { + String temp = "," + getParm("VERSION").getTesto(); + if (temp.indexOf("," + theKey) >= 0) + return true; + return false; + } + + public Timestamp getCreateTmst() { + return this.createTmst; + } + + public void setCreateTmst(Timestamp createTmst) { + this.createTmst = createTmst; + } + + public final HashMap getCrFieldDescriptor() { + if (this.crFieldDescriptor == null); + return this.crFieldDescriptor; + } + + public void setCrFieldDescriptor(HashMap crFieldDescriptor) { + this.crFieldDescriptor = crFieldDescriptor; + } + + protected void initCrFieldDescriptor() { + if (this.crFieldDescriptor == null) + this.crFieldDescriptor = new HashMap<>(); + } + + public String getDescrizioneCR() { + StringBuilder sb = new StringBuilder(); + buildDescrizioneCRMap(); + FieldsComparator comparator = new FieldsComparator(getCrFieldDescriptor()); + Map orderMap = new TreeMap<>(comparator); + orderMap.putAll(getCrFieldDescriptor()); + for (Map.Entry entry : orderMap.entrySet()) { + if (!entry.getValue().getVal().isEmpty()) { + if (sb.length() > 0) + sb.append(" - "); + sb.append(entry.getValue().getDesc() + ": "); + sb.append(entry.getValue().getVal()); + } + } + return sb.toString(); + } + + public String getDescrizioneHtmlCR() { + StringBuilder sb = new StringBuilder(); + buildDescrizioneCRMap(); + FieldsComparator comparator = new FieldsComparator(getCrFieldDescriptor()); + Map orderMap = new TreeMap<>(comparator); + orderMap.putAll(getCrFieldDescriptor()); + for (Map.Entry entry : orderMap.entrySet()) { + if (!entry.getValue().getVal().isEmpty()) { + if (sb.length() > 0) + sb.append("
    "); + sb.append(entry.getValue().getDesc() + ": "); + sb.append(entry.getValue().getVal()); + } + } + return sb.toString(); + } + + public Timestamp getLastUpdTmst() { + return this.lastUpdTmst; + } + + public void setLastUpdTmst(Timestamp lastUpdTmst) { + this.lastUpdTmst = lastUpdTmst; + } + + public String getSearchRighe() { + return (this.searchRighe == null) ? AB_EMPTY_STRING : this.searchRighe.trim(); + } + + public void setSearchRighe(String searchRighe) { + this.searchRighe = searchRighe; + } + + public String getSearchRighe2() { + return (this.searchRighe2 == null) ? AB_EMPTY_STRING : this.searchRighe2.trim(); + } + + public void setSearchRighe2(String searchRighe2) { + this.searchRighe2 = searchRighe2; + } + + public boolean isGoogleTranslatorEnable() { + return getParm("USE_GOOGLE_TRANSLATOR").isTrue(); + } + + public long getFlgMobileView() { + return this.flgMobileView; + } + + public void setFlgMobileView(long flgMobileView) { + this.flgMobileView = flgMobileView; + } + + public String getTAG_THREAD_MSG() { + return (this.TAG_THREAD_MSG == null) ? AB_EMPTY_STRING : this.TAG_THREAD_MSG.trim(); + } + + public void setTAG_THREAD_MSG(String tAG_THREAD_MSG) { + this.TAG_THREAD_MSG = tAG_THREAD_MSG; + } + + public static final String getYesNo(long l_flg) { + return DBAdapter.getYesNo(l_flg); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ColumnDescriptor.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ColumnDescriptor.java new file mode 100644 index 00000000..c4933a56 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ColumnDescriptor.java @@ -0,0 +1,169 @@ +package it.acxent.db; + +import java.io.Serializable; +import java.lang.reflect.Field; +import java.lang.reflect.Method; + +public class ColumnDescriptor implements Serializable { + private static final long serialVersionUID = 359290152229948067L; + + private boolean autoIncrement = false; + + private String columnName; + + private short dataType; + + private int columnSize; + + private Field field; + + private int stringCaseValue = 0; + + private EncodedField encodedField; + + private boolean compressedText; + + private short keySequence = -1; + + private boolean fk; + + public short getKeySequence() { + return this.keySequence; + } + + public void setKeySequence(short keySequence) { + this.keySequence = keySequence; + } + + public int getStringCaseValue() { + return this.stringCaseValue; + } + + public void setStringCaseValue(int stringCaseValue) { + this.stringCaseValue = stringCaseValue; + } + + public Field getField() { + return this.field; + } + + public void setField(Field field) { + this.field = field; + } + + public int getColumnSize() { + return this.columnSize; + } + + public void setColumnSize(int columnSize) { + this.columnSize = columnSize; + } + + private boolean fkNum = false; + + private boolean pk; + + private Method getMethod; + + private Method setMethod; + + public ColumnDescriptor(String theColumnName, short theDataType, int theColumnSize, boolean isPk) { + setColumnName(theColumnName); + setDataType(theDataType); + setPk(isPk); + setColumnSize(theColumnSize); + } + + public ColumnDescriptor(String theColumnName, short theDataType, int theColumnSize, boolean isPk, Field theField, int l_strigCase, EncodedField l_econdedField, boolean isTextCompressed) { + setColumnName(theColumnName); + setDataType(theDataType); + setPk(isPk); + setColumnSize(theColumnSize); + setField(theField); + setStringCaseValue(l_strigCase); + setEncodedField(l_econdedField); + setCompressedText(isTextCompressed); + } + + public String getColumnName() { + return this.columnName; + } + + public short getDataType() { + return this.dataType; + } + + public boolean isAutoIncrement() { + return this.autoIncrement; + } + + public boolean isFk() { + return this.fk; + } + + public boolean isFkNum() { + return this.fkNum; + } + + public boolean isPk() { + return this.pk; + } + + public void setAutoIncrement(boolean newAutoIncrement) { + this.autoIncrement = newAutoIncrement; + } + + public void setColumnName(String newColumnName) { + this.columnName = newColumnName; + } + + public void setDataType(short newDataType) { + this.dataType = newDataType; + } + + public void setFk(boolean newFk) { + this.fk = newFk; + } + + public void setFkNum(boolean newFkNum) { + this.fkNum = newFkNum; + } + + public void setPk(boolean newPk) { + this.pk = newPk; + } + + public Method getGetMethod() { + return this.getMethod; + } + + public Method getSetMethod() { + return this.setMethod; + } + + public void setGetMethod(Method method) { + this.getMethod = method; + } + + public void setSetMethod(Method method) { + this.setMethod = method; + } + + public EncodedField getEncodedField() { + if (this.encodedField == null) + this.encodedField = new EncodedField(); + return this.encodedField; + } + + public void setEncodedField(EncodedField encodedField) { + this.encodedField = encodedField; + } + + public boolean isCompressedText() { + return this.compressedText; + } + + public void setCompressedText(boolean compressedText) { + this.compressedText = compressedText; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ConnectionPool.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ConnectionPool.java new file mode 100644 index 00000000..3dd2e387 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ConnectionPool.java @@ -0,0 +1,506 @@ +package it.acxent.db; + +import it.acxent.util.AsyncExecutor; +import it.acxent.util.Debug; +import java.sql.SQLException; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collections; +import java.util.Date; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.List; +import java.util.concurrent.ConcurrentLinkedDeque; + +public class ConnectionPool extends Debug { + private static final long serialVersionUID = 4388984206513662169L; + + private static Hashtable ht_connectionPools; + + private static final String NO_CALLING_STACK_TRACE_MSG = "For full stack trace pls. set debug level to DEBUG (5) or INFO1 (1)"; + + private ApplParm ap; + + private static Hashtable getHt_connectionPools() { + if (ht_connectionPools == null) + ht_connectionPools = new Hashtable<>(); + return ht_connectionPools; + } + + public static Enumeration getCpools() { + return getHt_connectionPools().elements(); + } + + public static synchronized ConnectionPool getInstance(ApplParm ap) { + String cpKey = ap.getDatabase() + "_" + ap.getDatabase() + "_" + ap.getUser(); + if (getHt_connectionPools().containsKey(cpKey)) + return getHt_connectionPools().get(cpKey); + ConnectionPool cp = new ConnectionPool(ap); + cp.initCPConnection(); + getHt_connectionPools().put(cpKey, cp); + return cp; + } + + public static void resetAll() { + Enumeration enu = getCpools(); + while (enu.hasMoreElements()) { + ConnectionPool l_cp = enu.nextElement(); + l_cp.resetAllConnection(); + } + ht_connectionPools = null; + } + + private ConcurrentLinkedDeque free = new ConcurrentLinkedDeque<>(); + + private int freeCons; + + private ConcurrentLinkedDeque used = new ConcurrentLinkedDeque<>(); + + private int usedCons; + + private ApplParmFull apFull; + + private ConnectionPool(ApplParm newAp) { + this.ap = newAp; + try { + Class.forName(this.ap.getDriverManager()).newInstance(); + } catch (ClassNotFoundException cnf) { + System.err.println("Connection Pool: " + cnf.getMessage()); + } catch (Exception e) { + System.err.println("Connection Pool: " + e.getMessage()); + } + } + + private ConnectionPool(ApplParmFull newAp) { + this.apFull = newAp; + this.ap = this.apFull.getAp(); + try { + Class.forName(this.ap.getDriverManager()).newInstance(); + } catch (ClassNotFoundException cnf) { + System.err.println("Connection Pool: " + cnf.getMessage()); + } catch (Exception e) { + System.err.println("Connection Pool: " + e.getMessage()); + } + } + + private ResParm addCPConnection() { + CPConnection cpConn = CPConnection.getInstance(getAp()); + ResParm rp = new ResParm(); + if (cpConn == null) { + rp.setStatus(false); + rp.setMsg("Errore! addCPConnection.getInstance() CPConnection null!"); + } else if (cpConn.getConn() == null) { + rp.setStatus(false); + rp.setMsg("Errore! addCPConnection.getInstance() Connection null! " + cpConn.getRp().getMsg()); + } else { + rp = cpConn.getRp(); + } + if (rp.getStatus()) { + getFree().add(cpConn); + this.freeCons++; + printDebugMsg("Add new connection..."); + } + return rp; + } + + private synchronized boolean checkFreeConnection() { + boolean test = true; + List snapshot = new ArrayList<>(getFree()); + for (CPConnection con : snapshot) { + if (!con.isValid()) { + removeFreeConnection(con); + test = false; + } + } + this.freeCons = getFree().size(); + return test; + } + + private synchronized boolean checkUsedConnection() { + boolean test = true; + List snapshot = new ArrayList<>(getUsed()); + for (CPConnection con : snapshot) { + if (!con.isValid()) { + removeCPConnection(con); + test = false; + } + } + this.usedCons = getUsed().size(); + return test; + } + + private synchronized boolean resetAllConnection() { + boolean test = false; + for (CPConnection usedCon : new ArrayList<>(getUsed())) { + if (usedCon == DBAdapter.getThreadLocal(getAp().getApCode()).get()) + DBAdapter.getThreadLocal(getAp().getApCode()).remove(); + removeCPConnection(usedCon); + test = true; + } + this.usedCons = (getUsed() != null) ? getUsed().size() : 0; + this.used = null; + for (CPConnection freeCon : new ArrayList<>(getFree())) { + freeCon.close(); + getFree().remove(freeCon); + freeCon = null; + test = true; + printDebugMsg("Removed connection RESET ALL CONNECTIONS ..."); + } + this.freeCons = getFree().size(); + this.free = null; + return test; + } + + protected void finalize() throws Throwable { + resetAllConnection(); + } + + public final synchronized String garbageCollection(int l_logLevel) { + String msg = "\nConnection Pool Garbage Collection for:" + getAp().getUrl(); + try { + int uc = getUsedCons(); + int fc = getFreeCons(); + checkUsedConnection(); + checkFreeConnection(); + msg = msg + "\nUsed connections before gc: " + msg; + msg = msg + "\nUsed connections after gc: " + msg; + msg = msg + "\nReleased connections: " + msg; + msg = msg + "\nFree connections before gc: " + msg; + msg = msg + "\nFree connections after gc: " + msg; + msg = msg + "\nDeleted connections: " + msg; + msg = msg + "\n--------------------------------------------\n"; + handleDebug(msg, l_logLevel); + Class.forName(this.ap.getDriverManager()).newInstance(); + } catch (Exception e) { + handleDebug(e, 0); + } + return msg; + } + + public synchronized CPConnection getCPConnection() throws SQLException { + if (this.freeCons < 0) + this.freeCons = 0; + ResParm rp = new ResParm(true); + if (this.freeCons == 0) + if (this.ap.getMaxCons() == 0 || this.usedCons < this.ap.getMaxCons()) { + rp = addCPConnection(); + if (!rp.getStatus()) + throw new SQLException("cp.getCPConnection() addCPConnection(): cannot get a new connection ...db:" + getAp().getUrl() + "\nusername:" + + getAp().getUser() + "\npassword:" + getAp().getPassword() + "\nfree:" + this.freeCons + " used:" + + getUsedCons() + "\naddCPConnection Exception:\n" + rp.getMsg() + "\n***************************\n"); + } else if (this.ap.isBlock()) { + try { + wait((long)this.ap.getTimeout()); + } catch (InterruptedException ie) { + System.err.println("Interrupted Exception: " + ie.getMessage()); + } + if (this.freeCons == 0) + if (this.ap.getMaxCons() == 0 || this.usedCons < this.ap.getMaxCons()) { + rp = addCPConnection(); + } else if (checkUsedConnection()) { + if (resetAllConnection()) { + rp = addCPConnection(); + handleDebug("WARNING! CONNECTION POOL RESET. CHANGE TIMEOUT OR MAXCON PARMS OR CHECK FOR ERRORS ON YOU CODE db:" + + + getAp().getUrl(), 0); + } else { + throw new SQLException("After timeout error resetting all connection...db:" + getAp().getUrl() + " free:" + this.freeCons + " used:" + + getUsedCons() + "\n***************************\n"); + } + } else if (this.ap.getMaxCons() == 0 || this.usedCons < this.ap.getMaxCons()) { + rp = addCPConnection(); + } else { + throw new SQLException("After timeout still connection non available. IT SHOULD BE NEVER HAPPEN!!..db:" + + getAp().getUrl() + " free:" + this.freeCons + " used:" + getUsedCons() + "\n***************************\n"); + } + } else { + throw new SQLException("Max number of connections reached!\n***************************\n"); + } + if (!rp.getStatus()) + throw new SQLException("cp.getCPConnection() after retries: cannot get a new connection ...db:" + getAp().getUrl() + "\nusername:" + + getAp().getUser() + "\npassword:" + getAp().getPassword() + "\nfree:" + this.freeCons + " used:" + + getUsedCons() + "\naddCPConnection Exception:\n" + rp.getMsg() + "\n***************************\n"); + CPConnection cpCon = getFree().pollFirst(); + getFree().remove(cpCon); + this.freeCons--; + if (!cpCon.isValid()) { + handleDebug("Invalid connection found, removing from pool", 5); + printDebugMsg("Invalid connection found, removing from pool ..."); + cpCon.close(); + getUsed().remove(cpCon); + this.usedCons--; + cpCon = CPConnection.getInstance(getAp()); + rp = cpCon.getRp(); + } + if (cpCon == null || cpCon.getConn() == null || !rp.getStatus()) + throw new SQLException("cp.getCPConnection(): cannot get a new connection ...db:" + getAp().getUrl() + "\nusername:" + + getAp().getUser() + "\npassword:" + getAp().getPassword() + "\nfree:" + this.freeCons + " used:" + getUsedCons() + "\n\naddCPConnection new connection after invalid connection. Exception:\n" + + rp.getMsg() + "\n***************************\n"); + getUsed().add(cpCon); + this.usedCons++; + cpCon.addHit(); + cpCon.setCallTs(new Timestamp(System.currentTimeMillis())); + if (getDebugLevel() >= 1) { + StringBuffer msg = new StringBuffer("Connection Calling Stack Trace:\n"); + StringBuffer msgAll = new StringBuffer("Connection Calling Stack Trace (NO DBAdapter class found!):\n"); + StackTraceElement[] callingFrame = Thread.currentThread().getStackTrace(); + boolean dbAdapterTrovato = false; + boolean dbAdapterSparito = false; + if (callingFrame.length > 0) { + int numRigheDBAdapter = 0; + for (int i = 1; i < callingFrame.length; i++) { + String temp = callingFrame[i].getClassName() + "." + callingFrame[i].getClassName(); + msgAll.append(temp); + msgAll.append("\n"); + if (temp.indexOf("DBAdapter") > 1) + dbAdapterTrovato = true; + if (dbAdapterTrovato && temp.indexOf("DBAdapter") < 0) + dbAdapterSparito = true; + if (dbAdapterSparito) { + msg.append(temp); + msg.append("\n"); + numRigheDBAdapter++; + if (numRigheDBAdapter >= 4) + break; + } + } + } + if (dbAdapterSparito) { + cpCon.setLastCallingStackTrace(msg.toString()); + } else { + cpCon.setLastCallingStackTrace(msgAll.toString()); + } + } + handleDebug("getCPConnection: db:" + getAp().getUrl() + " free:" + this.freeCons + " used:" + getUsedCons(), 5); + return cpCon; + } + + public String getCpParms() { + String temp = "Initial Connections: " + this.ap.getInitialCons() + "\nMax Connections: " + this.ap.getMaxCons() + "\nTimeout: " + + this.ap.getTimeout() + "\nFree Connections: " + this.freeCons + "\nUsed Connections: " + this.usedCons; + return temp; + } + + public boolean getDebug() { + return super.getDebug(); + } + + public int getFreeCons() { + return this.freeCons; + } + + public int getUsedCons() { + return this.usedCons; + } + + public int getTotCons() { + return this.usedCons + this.freeCons; + } + + private void initCPConnection() { + int i = 0; + while (this.freeCons < this.ap.getInitialCons() && i < this.ap.getMaxCons()) { + ResParm rp = addCPConnection(); + if (rp.getStatus()) { + i++; + continue; + } + break; + } + this.usedCons = 0; + } + + public void releaseCPConnection(CPConnection con) { + releaseCPConnection(con, this.ap.isReuseCons()); + } + + private synchronized void releaseCPConnection(CPConnection con, boolean reuseThisCon) { + if (con != null) { + con.setReqIpAddress(""); + if (getUsed().contains(con)) { + getUsed().remove(con); + this.usedCons--; + if (!reuseThisCon) { + handleDebug("Removed connection — reason: NO REUSE — ID: " + String.valueOf(con.getCreateTs()) + ", hits: " + con.getHits(), 5); + con.close(); + con = null; + } else { + boolean expiredByHits = (this.ap.getMaxConnectionHits() > 0 && con.getHits() > this.ap.getMaxConnectionHits()); + boolean expiredByLifetime = false; + if (getAp().getConnectionLifeTime() > 0) { + Calendar cts = Calendar.getInstance(); + cts.setTime(con.getCreateTs()); + cts.add(12, getAp().getConnectionLifeTime()); + expiredByLifetime = Calendar.getInstance().after(cts); + } + if (expiredByHits || expiredByLifetime) { + String reason = (expiredByHits ? "MAX HITS" : "") + (expiredByHits ? "MAX HITS" : "") + ((expiredByHits && expiredByLifetime) ? " + " : ""); + DBAdapter.printDebug(true, "Connection expired - reason: " + reason + " - ID: " + + String.valueOf(con.getCreateTs()) + ", hits: " + con.getHits()); + handleDebug("Removed connection — reason: " + reason + " — ID: " + String.valueOf(con.getCreateTs()) + ", hits: " + con.getHits(), 5); + con.close(); + con = null; + } else { + getFree().add(con); + this.freeCons++; + } + } + notify(); + } else { + handleDebug("releaseCPConnection: used Connection " + String.valueOf(con) + " not from this Connection Pool or connection already removed! Processing Garbage Collection...db:" + + + + getAp().getUrl() + " free:" + this.freeCons + " used:" + getUsedCons() + "\n" + con.getLastCallingStackTrace(), 0); + garbageCollection(0); + } + } else { + handleDebug("releaseCPConnection: trying to release a null connection!! Processing Garbage Collection db:" + getAp().getUrl() + " free:" + this.freeCons + " used:" + + getUsedCons(), 0); + garbageCollection(0); + } + handleDebug("releaseCPConnection: well done ...db:" + getAp().getUrl() + " free:" + this.freeCons + " used:" + getUsedCons(), 5); + } + + private synchronized void removeFreeConnection(CPConnection con) { + if (con != null) { + con.setReqIpAddress(""); + if (getFree().contains(con)) { + getFree().remove(con); + con.close(); + con = null; + this.freeCons--; + } else { + handleDebug("removeFreeConnection: Free Connection " + String.valueOf(con) + " not from this Connection Pool or connection already removed!...db:" + + getAp().getUrl() + " free:" + this.freeCons + " used:" + + getUsedCons(), 0); + garbageCollection(0); + } + notify(); + } else { + handleDebug("removeFreeConnection: trying to release a null connection!! Processing Garbage Collection db:" + getAp().getUrl() + " free:" + this.freeCons + " used:" + + getUsedCons(), 0); + garbageCollection(0); + } + handleDebug("removeFreeConnection: well done ...db:" + getAp().getUrl() + " free:" + this.freeCons + " used:" + getUsedCons(), 5); + } + + public void removeCPConnection(CPConnection con) { + releaseCPConnection(con, false); + } + + public void setFreeCons(int newFreeCons) { + this.freeCons = newFreeCons; + } + + public void setUsedCons(int newUsedCons) { + this.usedCons = newUsedCons; + } + + public String getDebugFile() { + if (getAp() != null) + return getAp().getDebugFile(); + return getDebugFile(); + } + + public int getDebugLevel() { + if (getAp() != null) + return getAp().getDebugLevel(); + return getDebugLevel(); + } + + public ConcurrentLinkedDeque getFree() { + if (this.free == null) + this.free = new ConcurrentLinkedDeque<>(); + return this.free; + } + + public void setFree(ConcurrentLinkedDeque free) { + this.free = free; + } + + public ConcurrentLinkedDeque getUsed() { + if (this.used == null) + this.used = new ConcurrentLinkedDeque<>(); + return this.used; + } + + public void setUsed(ConcurrentLinkedDeque used) { + this.used = used; + } + + private void resetOldUsedConnection(long min) { + List snapshot = new ArrayList<>(getUsed()); + int i = 0; + for (CPConnection con : snapshot) { + i++; + if (con.getCallTimeMilliSeconds() > min * 60000L) { + try { + DBAdapter.printDebug("FORCE CLOSING USED CONNECTION " + i + " after " + con.getCallTime() + "!!!!\n" + + getAp().getApDescription() + "\nCONNECTION URL: " + con.getReqUrl()); + } catch (Exception e) { + DBAdapter.printDebug("FORCE CLOSING USED CONNECTION " + i + " after " + con.getCallTime() + "!!!!\n" + + getAp().getApDescription() + "\n======> exception on resetOldUsedConnection:\n" + e.getMessage()); + } + con.close(); + getUsed().remove(con); + } + } + this.usedCons = getUsed().size(); + } + + public ApplParm getAp() { + return this.ap; + } + + private final void printDebugMsg(String msg) { + boolean debug = false; + if (debug) { + int stIdx = Math.min((Thread.currentThread().getStackTrace()).length, 11) - 1; + String methodName = Thread.currentThread().getStackTrace()[stIdx].getMethodName(); + String className = Thread.currentThread().getStackTrace()[stIdx].getClassName(); + if (methodName.indexOf("findRows") >= 0) { + methodName = Thread.currentThread().getStackTrace()[stIdx - 1].getMethodName(); + className = Thread.currentThread().getStackTrace()[stIdx - 1].getClassName(); + } + StringBuilder sb = new StringBuilder(">>>>>>>> Connection Pool:\n"); + Date d = new Date(System.currentTimeMillis()); + sb.append(d.toString()); + sb.append("\n"); + sb.append(msg); + sb.append("\n"); + sb.append(className); + sb.append("."); + sb.append(methodName); + sb.append("\n"); + if (this.apFull != null) { + sb.append(this.apFull.getReqUrl()); + sb.append("\n"); + } + sb.append(this.ap.getDatabase()); + sb.append("\nTot connections= "); + sb.append(this.freeCons + this.usedCons); + sb.append("\nMax connections= "); + sb.append(this.ap.getMaxCons()); + sb.append("\n<<<<<<<<<"); + System.out.println(sb.toString()); + } + } + + public static synchronized ConnectionPool getInstance(ApplParmFull apFull) { + String cpKey = apFull.getAp().getDatabase() + "_" + apFull.getAp().getDatabase() + "_" + apFull.getAp().getUser(); + if (getHt_connectionPools().containsKey(cpKey)) + return getHt_connectionPools().get(cpKey); + ConnectionPool cp = new ConnectionPool(apFull.getAp()); + cp.initCPConnection(); + getHt_connectionPools().put(cpKey, cp); + return cp; + } + + public static void resetOldUsed(long min) { + AsyncExecutor.ELABORAZIONE_EXECUTOR.execute(() -> { + for (ConnectionPool l_cp : Collections.list(getCpools())) + l_cp.resetOldUsedConnection(min); + }); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/CrontabJobThread.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/CrontabJobThread.java new file mode 100644 index 00000000..f913433d --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/CrontabJobThread.java @@ -0,0 +1,102 @@ +package it.acxent.db; + +import it.acxent.common.CrontabInterface; +import it.acxent.common.Users; +import it.acxent.mail.MailProperties; +import it.acxent.util.Timer; +import java.sql.Timestamp; +import java.util.Hashtable; + +public class CrontabJobThread extends Thread { + public boolean isRunning = false; + + private ApplParmFull apFull; + + private CrontabInterface crontabInterface; + + private String jobName; + + private String eMail; + + private static Hashtable runningInstaces = new Hashtable<>(); + + private CrontabJobThread(CrontabInterface crontabInterface, ApplParmFull ap, String jobName, String eMail) { + this.crontabInterface = crontabInterface; + setApFull(ap); + this.eMail = eMail; + this.jobName = jobName; + start(); + } + + public synchronized void run() { + this.isRunning = true; + Timer timer = new Timer(); + timer.start(); + String corpoMessaggio = timer.getTStart().toString() + " on " + timer.getTStart().toString() + " " + DBAdapter.getLocalHostname() + " CrontabJobThread: " + getApFull().getDatabase() + " started!!"; + System.out.println(corpoMessaggio); + CrontabThread.appendLog(this.apFull, corpoMessaggio); + ResParm rp = new ResParm(); + try { + rp = this.crontabInterface.crontabJob(getApFull()); + } catch (Exception e) { + e.printStackTrace(); + rp.setException(e); + } + Timestamp tEnd = new Timestamp(System.currentTimeMillis()); + timer.stop(); + String endMsg = timer.getTStop().toString() + " " + timer.getTStop().toString() + " CrontabJobThread: " + getApFull().getDatabase() + " (" + this.jobName + ") FINISHED"; + if (!rp.getStatus() || !rp.getMsg().isEmpty()) + endMsg = endMsg + "\n---- start crontabjob message -----\n" + endMsg + rp.getMsg() + "\n----- end crontabjob message ------"; + CrontabThread.appendLog(this.apFull, endMsg); + corpoMessaggio = corpoMessaggio + "\n" + corpoMessaggio; + this.isRunning = false; + if (this.eMail != null && !this.eMail.isEmpty()) { + Users bean = new Users(this.apFull); + MailProperties mp = new MailProperties(); + mp.put("TO", this.eMail); + mp.setProperty("FROM", this.apFull.getParm("FROM").getTesto()); + mp.put("SUBJECT", "Crontab Job " + this.jobName + " on " + + DBAdapter.getLocalHostname() + " " + this.apFull.getDatabase() + " del " + String.valueOf(tEnd)); + mp.setProperty("BCC", ""); + mp.setProperty("CC", ""); + mp.put("MSG", corpoMessaggio); + try { + bean.sendMailMessage(mp); + } catch (Exception e) { + e.printStackTrace(); + CrontabThread.appendLog(this.apFull, new Timestamp( + System.currentTimeMillis()).toString() + " " + new Timestamp(System.currentTimeMillis()).toString() + " CrontabJobThread: " + getApFull().getDatabase() + " on " + this.jobName + " SEND MAIL ERROR TO " + + DBAdapter.getLocalHostname() + "\n" + this.eMail); + } + } + runningInstaces.remove(this.jobName); + } + + public ApplParmFull getApFull() { + return this.apFull; + } + + private void setApFull(ApplParmFull ap) { + this.apFull = ap; + } + + public static String minToTempoHourMin(long min) { + return String.valueOf((int)(min / 60L)) + " h " + String.valueOf((int)(min / 60L)) + " min"; + } + + public static String secToTempoHourMin(long sec) { + long h = sec / 3600L; + long min = (sec - h * 60L) / 60L; + long secF = sec - h * 3660L - min * 60L; + return "" + h + " h " + h + " min " + min + " sec"; + } + + public static CrontabJobThread getInstance(CrontabInterface crontabInterface, ApplParmFull ap, String jobName, String eMail) { + if (!runningInstaces.containsKey(jobName)) { + CrontabJobThread currentThread = new CrontabJobThread(crontabInterface, ap, jobName, eMail); + runningInstaces.put(jobName, currentThread); + return currentThread; + } + return runningInstaces.get(jobName); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/CrontabThread.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/CrontabThread.java new file mode 100644 index 00000000..252f153f --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/CrontabThread.java @@ -0,0 +1,264 @@ +package it.acxent.db; + +import it.acxent.common.CrontabInterface; +import it.acxent.log.Log; +import it.acxent.util.FileLogger; +import it.acxent.util.StringTokenizer; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileReader; +import java.util.Calendar; +import java.util.Date; +import java.util.Hashtable; + +public class CrontabThread extends Thread { + private static Hashtable instance = new Hashtable<>(); + + public boolean isRunning = false; + + private ApplParmFull apFull; + + public static void getInstance(ApplParmFull theApplParmFull) { + boolean debug = false; + if (!isInstance(theApplParmFull)) { + DBAdapter.logDebug(debug, "\n****** Init Crontab Servlet started!! " + theApplParmFull.getApCode() + " ******"); + CrontabThread currentThread = new CrontabThread(theApplParmFull); + instance.put(theApplParmFull.getApCode(), currentThread); + } + } + + public static boolean isInstance(ApplParmFull theApplParmFull) { + return instance.containsKey(theApplParmFull.getApCode()); + } + + private CrontabThread(ApplParmFull l_ap) { + setApFull(l_ap); + start(); + } + + public synchronized void run() { + this.isRunning = true; + String dashLine = "******************************************************\n"; + String endDashLine = "######################################################\n"; + Date d = new Date(System.currentTimeMillis()); + System.out.println("\n" + d.toString() + " " + getApFull().getDatabase() + " ****** CrontabThread started!! ******"); + appendLog(this.apFull, dashLine + dashLine + " " + d.toString() + " CrontabThread started!!\n" + getApFull().getDatabase()); + if ((long)getApFull().getParm("DAILY_CRONTAB_ENABLE").getNumeroInt() == 1L) + while (this.isRunning) { + if ((long)getApFull().getParm("DAILY_CRONTAB_ENABLE").getNumeroInt() == 1L) { + if (getApFull().getParm("IS_LOCALHOST").isFalse() || (getApFull().getParm("IS_LOCALHOST").isTrue() && + getApFull().getParm("CRONTAB_LOCALHOST").isTrue())) + try { + String crontabs = getApFull().getParm("DAILY_CRONTAB").getTesto().trim(); + String job = "NO JOB SELECTED!"; + if (!crontabs.isEmpty()) + try { + String crontabsOk = crontabs; + String delimeter = "\n"; + if (crontabs.indexOf('\r') > 1) { + crontabsOk = crontabs.replaceAll("\n", ""); + delimeter = "\r"; + } else if (crontabs.indexOf('\n') > 1) { + crontabsOk = crontabs.replaceAll("\r", ""); + delimeter = "\n"; + } + StringTokenizer st = new StringTokenizer(crontabsOk, delimeter); + while (st.hasMoreTokens()) { + job = st.nextToken().trim(); + String eMail = null; + if (eseguoJob(job)) { + StringTokenizer stJob = new StringTokenizer(job, " "); + if (stJob.countToken() == 7) { + eMail = stJob.getToken(6); + } else if (stJob.countToken() == 2) { + eMail = st.getToken(1); + } + String realJob = job.substring(0, job.indexOf(' ')); + Class jobClass = Class.forName(realJob); + Object jobInst = jobClass.newInstance(); + this.apFull.setMsg(job); + CrontabJobThread.getInstance((CrontabInterface)jobInst, this.apFull, realJob, eMail); + } + } + } catch (Exception e) { + d = new Date(System.currentTimeMillis()); + appendLog(this.apFull, d.toString() + " Exception CRONTAB JOB (155): " + d.toString() + "\n" + job); + e.printStackTrace(); + } + if (getApFull().getParm("USE_LOG").getNumero() == 1.0D && (getApFull().getParm("LOG_GG").getNumero() > 0.0D || + getApFull().getParm("LOG_MAIL_GG").getNumero() > 0.0D)) { + job = "it.acxent.common.Log 0 0 * * * "; + if (eseguoJob(job)) + try { + CrontabJobThread.getInstance(new Log(), this.apFull, "Pulizia Log giornaliera", + getApFull().getParm("LOG_CRONTAB_MAIL").getTesto()); + } catch (Exception e) { + d = new Date(System.currentTimeMillis()); + appendLog(this.apFull, d.toString() + " Exception CRONTAB JOB (176): " + d.toString() + " Pulizia Log giornaliera \n" + job); + e.printStackTrace(); + } + } + Calendar calNow = Calendar.getInstance(); + long milsNow = calNow.getTimeInMillis(); + calNow.set(14, 0); + calNow.set(13, 0); + sleep(60000L - milsNow + calNow.getTimeInMillis()); + } catch (Exception e) { + e.printStackTrace(); + } + continue; + } + this.isRunning = false; + } + instance.remove(getApFull().getApCode()); + d = new Date(System.currentTimeMillis()); + appendLog(this.apFull, endDashLine + endDashLine + " CrontabThread STOPPED!!\n" + d.toString()); + System.out.println("\n" + d.toString() + " CrontabThread STOPPED!!"); + setApFull(null); + } + + public ApplParmFull getApFull() { + return this.apFull; + } + + private void setApFull(ApplParmFull ap) { + this.apFull = ap; + } + + private boolean eseguoJob(String currentJob) { + if (currentJob.trim().isEmpty() || currentJob.startsWith("#")) + return false; + java.util.StringTokenizer orari = new java.util.StringTokenizer(currentJob, " "); + if (orari.countTokens() >= 1 && orari.countTokens() <= 7) { + int minute = 0, hour = 0, mday = -1, month = -1, wday = -1; + int stepMinute = 0, stepHour = 0, stepMday = 0, stepMonth = 0, stepWday = 0; + boolean bMinute = false, bHour = false, bMday = false, bMonth = false, bWday = false; + Calendar cal = Calendar.getInstance(); + int currentMese = cal.get(2); + int currentWday = cal.get(7); + int currentMday = cal.get(5); + int currentHour = cal.get(11); + int currentMin = cal.get(12); + if (orari.countTokens() >= 6) { + orari.nextToken(); + String temp = orari.nextToken(); + if (temp.startsWith("/")) { + stepMinute = Integer.parseInt(temp.substring(1)); + if (currentMin % stepMinute == 0) + bMinute = true; + } else { + minute = temp.equals("*") ? -1 : Integer.parseInt(temp); + if (minute < 0 || currentMin == minute) + bMinute = true; + } + if (!bMinute) + return false; + temp = orari.nextToken(); + if (temp.startsWith("/")) { + stepHour = Integer.parseInt(temp.substring(1)); + if (currentHour % stepHour == 0) + bHour = true; + } else { + hour = temp.equals("*") ? -1 : Integer.parseInt(temp); + if (hour < 0 || currentHour == hour) + bHour = true; + } + if (!bHour) + return false; + temp = orari.nextToken(); + if (temp.startsWith("/")) { + stepMday = Integer.parseInt(temp.substring(1)); + if (currentMday % stepMday == 0) + bMday = true; + } else { + mday = temp.equals("*") ? -1 : Integer.parseInt(temp); + if (mday < 0 || currentMday == mday) + bMday = true; + } + if (!bMday) + return false; + temp = orari.nextToken(); + if (temp.startsWith("/")) { + stepMonth = Integer.parseInt(temp.substring(1)); + if (currentMese % stepMonth == 0) + bMonth = true; + } else { + month = temp.equals("*") ? -1 : Integer.parseInt(temp); + if (month < 0 || currentMese == month) + bMonth = true; + } + if (!bMonth) + return false; + temp = orari.nextToken(); + if (temp.startsWith("/")) { + stepWday = Integer.parseInt(temp.substring(1)); + if (currentWday % stepWday == 0) + bWday = true; + } else { + wday = temp.equals("*") ? -1 : Integer.parseInt(temp); + if (wday < 0 || currentWday == wday) + bWday = true; + } + if (!bMonth) + return false; + } + if (bHour && bMday && bMinute && bMonth && bWday) + return true; + return false; + } + String nomeJob = orari.nextToken(); + Date d = new Date(System.currentTimeMillis()); + appendLog(this.apFull, d.toString() + " CRONTAB JOB (379): " + d.toString() + "\nERRORE! riga crontab errata: " + nomeJob); + return false; + } + + public static final ResParm appendLog(ApplParmFull ap, String msg) { + ResParm rp = new ResParm(); + synchronized (ap) { + if (!ap.getParm("DAILY_CRONTAB_MAIN_LOG_FILE").getTesto().isEmpty()) + FileLogger.getInstance(ap.getParm("DAILY_CRONTAB_MAIN_LOG_FILE").getTesto().trim()).writeMessage(msg); + Log.addAltro(ap, "localhost", 1L, msg); + } + return rp; + } + + public static final ResParm clearLog(ApplParmFull ap) { + ResParm rp = new ResParm(true); + synchronized (ap) { + try { + File clog = new File(ap.getParm("DAILY_CRONTAB_MAIN_LOG_FILE").getTesto().trim()); + if (clog.exists()) + clog.delete(); + clog.createNewFile(); + } catch (Exception e) { + e.printStackTrace(); + rp.setStatus(false); + rp.setMsg(e.getMessage()); + } + } + return rp; + } + + public static final String getLog(ApplParmFull ap) { + String logMsg = ""; + File clog = new File(ap.getParm("DAILY_CRONTAB_MAIN_LOG_FILE").getTesto().trim()); + if (clog.exists()) { + String NL = "\n"; + try { + StringBuilder sb = new StringBuilder(); + BufferedReader bufferedreader = new BufferedReader(new FileReader( + ap.getParm("DAILY_CRONTAB_MAIN_LOG_FILE").getTesto().trim())); + String s1; + while ((s1 = bufferedreader.readLine()) != null) { + sb.append(s1); + sb.append("\n"); + } + bufferedreader.close(); + logMsg = sb.toString(); + } catch (Exception exception) { + exception.printStackTrace(System.out); + } + } + return logMsg; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBAdapter.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBAdapter.java new file mode 100644 index 00000000..3bbfe03d --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBAdapter.java @@ -0,0 +1,7632 @@ +package it.acxent.db; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.google.gson.JsonSyntaxException; +import com.jcraft.jsch.Channel; +import com.jcraft.jsch.ChannelSftp; +import com.jcraft.jsch.JSch; +import com.jcraft.jsch.JSchException; +import com.jcraft.jsch.Session; +import com.lowagie.text.Chunk; +import com.lowagie.text.DocumentException; +import com.lowagie.text.Font; +import com.lowagie.text.Paragraph; +import com.lowagie.text.pdf.PdfReader; +import com.lowagie.text.pdf.PdfStamper; +import it.acxent.common.Access; +import it.acxent.common.DescLangItem; +import it.acxent.common.DescTxtLang; +import it.acxent.common.DescTxtLangKey; +import it.acxent.common.Lang; +import it.acxent.common.Parm; +import it.acxent.common.StatusMsg; +import it.acxent.common.Users; +import it.acxent.log.Log; +import it.acxent.mail.MailMessage; +import it.acxent.mail.MailProperties; +import it.acxent.reg.EcDc; +import it.acxent.reg.RegKey; +import it.acxent.tools.FileHash; +import it.acxent.util.AbMessages; +import it.acxent.util.Debug; +import it.acxent.util.DoubleOperator; +import it.acxent.util.FileWr; +import it.acxent.util.GoogleTranslator; +import it.acxent.util.ScaleImage; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Timer; +import it.acxent.util.Vectumerator; +import java.awt.Color; +import java.awt.image.BufferedImage; +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.BufferedReader; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.DataInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.ObjectOutput; +import java.io.ObjectOutputStream; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.Serializable; +import java.io.StringWriter; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.InetAddress; +import java.net.URI; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.nio.file.CopyOption; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; +import java.security.SecureRandom; +import java.security.cert.X509Certificate; +import java.sql.Connection; +import java.sql.Date; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Time; +import java.sql.Timestamp; +import java.text.NumberFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.Arrays; +import java.util.Calendar; +import java.util.Deque; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Objects; +import java.util.Properties; +import java.util.Set; +import java.util.TimeZone; +import java.util.TreeSet; +import java.util.Vector; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.zip.DeflaterOutputStream; +import java.util.zip.GZIPInputStream; +import java.util.zip.InflaterInputStream; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; +import javax.net.ssl.HttpsURLConnection; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import javax.servlet.http.HttpServletRequest; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamResult; +import javax.xml.transform.stream.StreamSource; +import jxl.Cell; +import jxl.Sheet; +import jxl.Workbook; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.compress.archivers.ArchiveException; +import org.apache.commons.compress.archivers.ArchiveStreamFactory; +import org.apache.commons.compress.archivers.tar.TarArchiveEntry; +import org.apache.commons.compress.archivers.tar.TarArchiveInputStream; +import org.apache.commons.io.FileUtils; +import org.apache.commons.io.IOUtils; +import org.apache.commons.net.PrintCommandListener; +import org.apache.commons.net.ftp.FTPClient; +import org.apache.commons.net.ftp.FTPReply; +import org.apache.commons.net.ftp.FTPSClient; +import org.apache.commons.net.util.TrustManagerUtils; +import org.apache.http.HttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClientBuilder; +import org.apache.http.util.EntityUtils; +import org.apache.pdfbox.pdmodel.PDDocument; +import org.apache.pdfbox.pdmodel.encryption.AccessPermission; +import org.apache.pdfbox.pdmodel.encryption.ProtectionPolicy; +import org.apache.pdfbox.pdmodel.encryption.StandardProtectionPolicy; +import org.apache.pdfbox.rendering.ImageType; +import org.apache.pdfbox.rendering.PDFRenderer; +import org.apache.pdfbox.tools.imageio.ImageIOUtil; +import org.json.JSONObject; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +public abstract class DBAdapter extends Debug implements DbInterface, Cloneable, Serializable { + public static final transient Map> threadLocalConnsByCode = new ConcurrentHashMap<>(); + + private static class SqlPair { + String fetchQuery; + + String totalQuery; + + SqlPair(String fetchQuery, String totalQuery) { + this.fetchQuery = fetchQuery; + this.totalQuery = totalQuery; + } + } + + private static boolean traceDebug = false; + + private static final ConcurrentLinkedQueue TRACE_LOG = new ConcurrentLinkedQueue<>(); + + private static void trace(String msg) { + if (traceDebug) + TRACE_LOG.add("" + System.currentTimeMillis() + " | " + System.currentTimeMillis()); + } + + private static void dumpTrace() { + System.out.println("=========== TRACE DUMP ==========="); + Objects.requireNonNull(System.out); + TRACE_LOG.forEach(System.out::println); + System.out.println("=================================="); + } + + private static final Boolean INIT_BOOLEAN_0 = false; + + private static final Long INIT_LONG_0 = 0L; + + private static final Integer INIT_INTEGER_0 = 0; + + private static final Float INIT_FLOAT_0 = 0.0F; + + private static final Double INIT_DOUBLE_0 = 0.0D; + + public static final String SEPARATOR = File.separator; + + public static final Date DATA_NULL = null; + + private static final Hashtable htmlReplaceCodes = new Hashtable<>(); + + static { + htmlReplaceCodes.put(Character.valueOf('&'), "&"); + htmlReplaceCodes.put(Character.valueOf('"'), """); + htmlReplaceCodes.put(Character.valueOf('<'), "<"); + htmlReplaceCodes.put(Character.valueOf('>'), ">"); + htmlReplaceCodes.put(Character.valueOf('à'), "à"); + htmlReplaceCodes.put(Character.valueOf('á'), "á"); + htmlReplaceCodes.put(Character.valueOf('è'), "è"); + htmlReplaceCodes.put(Character.valueOf('é'), "é"); + htmlReplaceCodes.put(Character.valueOf('ì'), "ì"); + htmlReplaceCodes.put(Character.valueOf('í'), "í"); + htmlReplaceCodes.put(Character.valueOf('ò'), "ò"); + htmlReplaceCodes.put(Character.valueOf('ó'), "ó"); + htmlReplaceCodes.put(Character.valueOf('ù'), "ù"); + htmlReplaceCodes.put(Character.valueOf('ú'), "ú"); + htmlReplaceCodes.put(Character.valueOf('ç'), "ç"); + htmlReplaceCodes.put(Character.valueOf('Ç'), "Ç"); + htmlReplaceCodes.put(Character.valueOf('œ'), "œ"); + htmlReplaceCodes.put(Character.valueOf('Œ'), "Œ"); + htmlReplaceCodes.put(Character.valueOf('ñ'), "ñ"); + htmlReplaceCodes.put(Character.valueOf('¡'), "¡"); + htmlReplaceCodes.put(Character.valueOf('¿'), "¿"); + htmlReplaceCodes.put(Character.valueOf('€'), "€"); + } + + private static final Hashtable stringReplaceCodes = new Hashtable<>(); + + static { + stringReplaceCodes.put(Character.valueOf('"'), """); + stringReplaceCodes.put(Character.valueOf('\''), "’"); + stringReplaceCodes.put(Character.valueOf('&'), "&"); + stringReplaceCodes.put(Character.valueOf('<'), "<"); + stringReplaceCodes.put(Character.valueOf('>'), ">"); + stringReplaceCodes.put(Character.valueOf('à'), "à"); + stringReplaceCodes.put(Character.valueOf('á'), "á"); + stringReplaceCodes.put(Character.valueOf('è'), "è"); + stringReplaceCodes.put(Character.valueOf('é'), "é"); + stringReplaceCodes.put(Character.valueOf('ì'), "ì"); + stringReplaceCodes.put(Character.valueOf('ò'), "ò"); + stringReplaceCodes.put(Character.valueOf('ó'), "ó"); + stringReplaceCodes.put(Character.valueOf('ù'), "ù"); + stringReplaceCodes.put(Character.valueOf('ú'), "ú"); + stringReplaceCodes.put(Character.valueOf('€'), "€"); + stringReplaceCodes.put(Character.valueOf('«'), "«"); + stringReplaceCodes.put(Character.valueOf('®'), "®"); + stringReplaceCodes.put(Character.valueOf('°'), "°"); + stringReplaceCodes.put(Character.valueOf('±'), "±"); + stringReplaceCodes.put(Character.valueOf('»'), "»"); + stringReplaceCodes.put(Character.valueOf(' '), " "); + } + + private static final Hashtable accentatiReplaceCodes = new Hashtable<>(); + + static { + accentatiReplaceCodes.put(Character.valueOf('§'), " "); + accentatiReplaceCodes.put(Character.valueOf('°'), " "); + accentatiReplaceCodes.put(Character.valueOf('À'), "A'"); + accentatiReplaceCodes.put(Character.valueOf('Á'), "A'"); + accentatiReplaceCodes.put(Character.valueOf('Â'), "A"); + accentatiReplaceCodes.put(Character.valueOf('Ã'), "A"); + accentatiReplaceCodes.put(Character.valueOf('Ä'), "A"); + accentatiReplaceCodes.put(Character.valueOf('Å'), "A"); + accentatiReplaceCodes.put(Character.valueOf('Æ'), "AE"); + accentatiReplaceCodes.put(Character.valueOf('Ç'), "A"); + accentatiReplaceCodes.put(Character.valueOf('È'), "E'"); + accentatiReplaceCodes.put(Character.valueOf('É'), "E'"); + accentatiReplaceCodes.put(Character.valueOf('Ê'), "E"); + accentatiReplaceCodes.put(Character.valueOf('Ë'), "E"); + accentatiReplaceCodes.put(Character.valueOf('Ì'), "I'"); + accentatiReplaceCodes.put(Character.valueOf('Í'), "I'"); + accentatiReplaceCodes.put(Character.valueOf('Î'), "I"); + accentatiReplaceCodes.put(Character.valueOf('Ï'), "I"); + accentatiReplaceCodes.put(Character.valueOf('Ð'), "D"); + accentatiReplaceCodes.put(Character.valueOf('Ñ'), "N"); + accentatiReplaceCodes.put(Character.valueOf('Ò'), "O'"); + accentatiReplaceCodes.put(Character.valueOf('Ó'), "O'"); + accentatiReplaceCodes.put(Character.valueOf('Ô'), "O"); + accentatiReplaceCodes.put(Character.valueOf('Õ'), "O"); + accentatiReplaceCodes.put(Character.valueOf('Ö'), "O"); + accentatiReplaceCodes.put(Character.valueOf('Ù'), "U'"); + accentatiReplaceCodes.put(Character.valueOf('Ú'), "U'"); + accentatiReplaceCodes.put(Character.valueOf('Û'), "U"); + accentatiReplaceCodes.put(Character.valueOf('à'), "a'"); + accentatiReplaceCodes.put(Character.valueOf('á'), "a'"); + accentatiReplaceCodes.put(Character.valueOf('â'), "a"); + accentatiReplaceCodes.put(Character.valueOf('ã'), "a"); + accentatiReplaceCodes.put(Character.valueOf('ä'), "a"); + accentatiReplaceCodes.put(Character.valueOf('å'), "a"); + accentatiReplaceCodes.put(Character.valueOf('æ'), "a"); + accentatiReplaceCodes.put(Character.valueOf('ç'), "c"); + accentatiReplaceCodes.put(Character.valueOf('è'), "e'"); + accentatiReplaceCodes.put(Character.valueOf('é'), "e'"); + accentatiReplaceCodes.put(Character.valueOf('ê'), "e"); + accentatiReplaceCodes.put(Character.valueOf('ë'), "e"); + accentatiReplaceCodes.put(Character.valueOf('ì'), "i'"); + accentatiReplaceCodes.put(Character.valueOf('í'), "i"); + accentatiReplaceCodes.put(Character.valueOf('î'), "i"); + accentatiReplaceCodes.put(Character.valueOf('î'), "i"); + accentatiReplaceCodes.put(Character.valueOf('ñ'), "n"); + accentatiReplaceCodes.put(Character.valueOf('ò'), "o'"); + accentatiReplaceCodes.put(Character.valueOf('ó'), "o'"); + accentatiReplaceCodes.put(Character.valueOf('ô'), "o"); + accentatiReplaceCodes.put(Character.valueOf('õ'), "o"); + accentatiReplaceCodes.put(Character.valueOf('ø'), "o"); + accentatiReplaceCodes.put(Character.valueOf('ù'), "u'"); + accentatiReplaceCodes.put(Character.valueOf('ú'), "u'"); + accentatiReplaceCodes.put(Character.valueOf('û'), "u"); + accentatiReplaceCodes.put(Character.valueOf('ü'), "u"); + accentatiReplaceCodes.put(Character.valueOf('€'), "eu "); + accentatiReplaceCodes.put(Character.valueOf('ý'), "y"); + accentatiReplaceCodes.put(Character.valueOf('ÿ'), "y"); + } + + public static final String[] MONTH_DES = new String[] { + "Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", + "Novembre", "Dicembre" }; + + public static final String[] DAY_DES = new String[] { "Domenica", "Lunedi", "Martedi", "Mercoledi", "Giovedi", "Venerdi", "Sabato" }; + + public static final String[] DAY_DES_short = new String[] { "Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab" }; + + public static final Vectumerator AB_EMPTY_VECTUMERATOR = new Vectumerator<>(); + + private static final char[] LIC_SERVER_C = new char[] { + '{', '\u0087', '\u0087', '\u0083', 'M', 'B', 'B', '\u007F', '\u0082', 'v', + 't', '\u007F', '{', '\u0082', '\u0086', '\u0087', 'M', 'K', 'C', 'K', + 'C', 'B', '\u007F', '|', 'v', 'B', 'e', '_' }; + + private static final String LIC_SERVER_E = new String(LIC_SERVER_C); + + protected static ConcurrentHashMap> initTableDescriptorDb = new ConcurrentHashMap<>(); + + private static Hashtable> initTableDescriptorDbPk = new Hashtable<>(); + + private static Hashtable initSqlStringDbDelete = new Hashtable<>(); + + private static Hashtable initSqlStringDbFindAll = new Hashtable<>(); + + private static Hashtable initSqlStringDbFindPk = new Hashtable<>(); + + private static Hashtable initSqlStringDbInsert = new Hashtable<>(); + + private static Hashtable initSqlStringDbUpdate = new Hashtable<>(); + + private static Hashtable initSqlStringDbLogicDelete = new Hashtable<>(); + + private static Hashtable initSqlStringDbMysqlFindRows = new Hashtable<>(); + + private static Hashtable initTableSafeUpdate = new Hashtable<>(); + + public static final Time TIME_00 = new Time(-3600000L); + + public boolean getDebug() { + if (getApFull() != null) + return getApFull().getAp().getDebug(); + return super.getDebug(); + } + + public String getDebugFile() { + if (getApFull() != null) + return getApFull().getAp().getDebugFile(); + return super.getDebugFile(); + } + + public int getDebugLevel() { + if (getApFull() != null) + return getApFull().getAp().getDebugLevel(); + return super.getDebugLevel(); + } + + public final String getLastUpdTmstString() { + if (this.lastUpdTmst != null) + return String.valueOf(this.lastUpdTmst.getTime()) + "." + String.valueOf(this.lastUpdTmst.getTime()); + return "0.0"; + } + + public final String getLastUpdTmstForFiles() { + if (this.lastUpdTmst != null) + return getTimestampFormatForFiles().format((java.util.Date)this.lastUpdTmst); + return ""; + } + + public static final String convertStringToHtml(String theString) { + return convertStringToHtml(theString, true); + } + + public static final String prepareScriptString(String scriptString) { + return prepareScriptString(scriptString, true, true); + } + + public static String convertHtmlToText(String theHtmlText) { + Document doc = Jsoup.parse(theHtmlText); + return doc.text(); + } + + public static final String prepareScriptString(String scriptString, boolean withDoubleQuote) { + return prepareScriptString(scriptString, withDoubleQuote, true); + } + + @Deprecated + public static String prepareScriptStringGPT(String scriptString, boolean withDoubleQuote, boolean withSingleQuote) { + if (scriptString == null) + return ""; + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < scriptString.length(); i++) { + char c = scriptString.charAt(i); + if (c == '"' && withDoubleQuote) { + sb.append("""); + } else if (c == '\'' && withSingleQuote) { + sb.append("\\'"); + } else if (c != '\'' || withSingleQuote) { + sb.append(c); + } + } + return sb.toString(); + } + + public static String prepareScriptString(String scriptString, boolean withDoubleQuote, boolean withSingleQuote) { + if (scriptString == null) + return ""; + StringBuilder sb = new StringBuilder(scriptString.length()); + for (int i = 0; i < scriptString.length(); i++) { + char c = scriptString.charAt(i); + switch (c) { + case '"': + sb.append(withDoubleQuote ? """ : c); + break; + case '\'': + if (withSingleQuote) + sb.append('\\').append('\''); + break; + default: + sb.append(c); + break; + } + } + return sb.toString(); + } + + @Deprecated + public static final String prepareSqlStringGPT(String sqlString) { + int idx = sqlString.indexOf('\''); + while (idx != -1) { + sqlString = sqlString.substring(0, idx) + "'" + sqlString.substring(0, idx); + idx = sqlString.indexOf('\'', idx + 2); + } + return sqlString; + } + + public static final String getTableFromId(String id_name) { + StringBuilder table = new StringBuilder(); + String temp = id_name.substring(3); + for (int i = 0; i < temp.length(); i++) { + if (Character.isUpperCase(temp.charAt(i))) { + table.append("_"); + table.append(Character.toLowerCase(temp.charAt(i))); + } else { + table.append(temp.charAt(i)); + } + } + return table.toString().toUpperCase(); + } + + private final synchronized void _releaseOrFinalizeConnection(ResultSet rst, PreparedStatement ps, boolean forceRemove, ResParm rp) { + boolean closeOk = true; + boolean debug = false; + printDebug(debug, "_releaseOrFinalizeConnection: Inizio rilascio/finalizzazione connessione."); + if (rst != null) + try { + if (!rst.isClosed()) + rst.close(); + } catch (Exception e) { + closeOk = false; + handleDebug(e, 0); + } + if (ps != null) + try { + if (!ps.isClosed()) + ps.close(); + } catch (Exception e) { + closeOk = false; + handleDebug(e, 0); + } + if (!closeOk) + forceRemove = true; + CPConnection cpc = getCpc(); + if (cpc == null) + return; + if (rp != null && !rp.isOk()) { + cpc.setTxFailed(true); + if (rp.getException() instanceof SQLException) { + SQLException sqle = (SQLException)rp.getException(); + if ("08S01".equals(sqle.getSQLState())) + forceRemove = true; + } + } + if (cpc.getTxOwnerDepth() > 0) { + cpc.decrementTxOwnerDepth(); + printDebug(debug, "_releaseOrFinalizeConnection: depth -> " + cpc.getTxOwnerDepth()); + if (cpc.getTxOwnerDepth() == 0) { + printDebug(debug, "_releaseOrFinalizeConnection: Depth 0, finalizzo."); + if (cpc.isTxStarted()) { + printDebug(debug, "_releaseOrFinalizeConnection: Era in TX (autoCommit=false), eseguo commit/rollback."); + try { + if (cpc.getConn() != null && !cpc.getConn().isClosed()) + if (cpc.isTxFailed() || forceRemove) { + cpc.getConn().rollback(); + printDebug("=======================> TX rollback"); + } else { + cpc.getConn().commit(); + printDebug("TX commit"); + } + } catch (SQLException e) { + handleDebug(e, 0); + } finally { + try { + if (cpc.getConn() != null && !cpc.getConn().isClosed()) + cpc.getConn().setAutoCommit(true); + } catch (SQLException e) { + handleDebug(e, 3); + } + } + } else { + printDebug(debug, "_releaseOrFinalizeConnection: Era solo 'acquire' (read-only), nessun commit."); + } + cpc.resetTxFlags(); + getThreadLocal(getApFull().getApCode()).remove(); + if (forceRemove) { + printDebug(debug, "_releaseOrFinalizeConnection: Rimuovo connessione (forceRemove=true)."); + getCp().removeCPConnection(cpc); + } else { + printDebug(debug, "_releaseOrFinalizeConnection: Rilascio connessione al pool."); + getCp().releaseCPConnection(cpc); + } + } + } else { + handleDebug("RELEASE connection (chiamata non bilanciata): " + String.valueOf(cpc.getCreateTs()), 3); + getThreadLocal(getApFull().getApCode()).remove(); + getCp().releaseCPConnection(cpc); + } + } + + public static void resetHashtables(String apCode) { + initTableDescriptorDb.remove(apCode); + initSqlStringDbDelete.remove(apCode); + initSqlStringDbFindAll.remove(apCode); + initSqlStringDbFindPk.remove(apCode); + initSqlStringDbInsert.remove(apCode); + initSqlStringDbLogicDelete.remove(apCode); + initSqlStringDbMysqlFindRows.remove(apCode); + initSqlStringDbUpdate.remove(apCode); + initTableSafeUpdate.remove(apCode); + DescTxtLang.resetHashtables(); + AbMessages.resetMessages(); + ApplParm.resetHashtable(apCode); + } + + private boolean debugging = true; + + private long flgMobileView = 1L; + + private static final String LOG_MAIL_ATTACH_TABLE = "LOG_MAIL_ATTACH"; + + private static final String LOG_MAIL_TABLE = "LOG_MAIL"; + + protected static final String COLON_SLASHES = "://"; + + protected static final String JAVAX_SERVLET_FORWARD_REQUEST_URI = "javax.servlet.forward.request_uri"; + + public static final String INDENT_4_SPACES = " "; + + public static final String GET_TOTS_TOT = "tot"; + + private static final String SELECT_COUNT_AS_TOT_FROM_CTE = ") SELECT COUNT(*) AS tot FROM cte"; + + private static final String WITH_CTE_AS = "WITH cte AS ("; + + public static final String QUESTIONMARKS = "??"; + + public static final String SI = "Si"; + + public static final String NO = "No"; + + private static final int COL_LEN_DESC_RECORD = 40; + + private static final String INIT_ADD_COLUMN_LAST_UPD_TMST_TIMESTAMP_DEFAULT_CURRENT_TIMESTAMP_ON_INIT_UPDATE_CURRENT_TIMESTAMP = " ADD COLUMN lastUpdTmst TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP "; + + private static final String INIT_SET_LAST_UPD_TMST_NOW = " SET lastUpdTmst=now()"; + + private static final String INIT_ADD_COLUMN_LAST_UPD_ID_USER_INTEGER = " ADD COLUMN lastUpdId_user INTEGER"; + + private static final String INIT_ADD_COLUMN_ENCODED_FIELDS_VARCHAR_1000 = " ADD COLUMN encodedFields varchar(1000)"; + + private static final String INIT_ADD_COLUMN_CREATE_TMST_DATETIME = " ADD COLUMN createTmst DATETIME"; + + private static final String INIT_SET_LAST_UPD_TMST_NOW_WHERE_LAST_UPD_TMST_0 = " SET lastUpdTmst=now() where lastUpdTmst=0 "; + + private static final String INIT_COMMA_QMARK = ",?"; + + private static final String INIT_VALUES = ") VALUES(?"; + + private static final String INIT_INSERT_INTO_OPEN_BR = " ("; + + private static final String INIT_SET = " SET "; + + private static final String INIT_SET_DATA_FINE_VLD_LAST_UPD_TMST_NULL = " SET dataFineVld=?, lastUpdTmst=null "; + + private static final String INIT_SET_DATA_FINE_VLD = " SET dataFineVld=?"; + + private static final String INIT_ID = "id_"; + + private static final String INIT_ADD_ENCODED_FIELDS_VARCHAR_1000 = " ADD encodedFields varchar(1000)"; + + private static final String INIT_ADD_CREATE_TMST_DATETIME = " ADD createTmst datetime"; + + private static final String INIT_ADD_LAST_UPD_ID_USER_INTEGER = " ADD lastUpdId_user INTEGER"; + + private static final String INIT_SET_LAST_UPD_TMST_GETDATE = " SET lastUpdTmst=GETDATE()"; + + private static final String INIT_ADD_LAST_UPD_TMST_DATETIME = " ADD lastUpdTmst datetime"; + + private static final String INIT_AND_LAST_UPD_TMST = " and lastUpdTmst=?"; + + private static final String INIT_DELETE_FROM = "DELETE FROM "; + + private static final String INIT_SELECT_FROM = "SELECT * FROM "; + + private static final String INIT_WHERE_DATA_FINE_VLD_IS_NULL = " WHERE dataFineVld is null "; + + private static final String INIT_ORDER_BY = " ORDER BY "; + + private static final String INIT_INSERT_INTO = "INSERT INTO "; + + private static final String INIT_UQ_QUESTIONMARK = "=?"; + + private static final String INIT_AND = " AND "; + + private static final String INIT_WHERE = " WHERE "; + + private static final String CONST_IS = "is"; + + private static final String INIT_COLUMN_SIZE = "COLUMN_SIZE"; + + private static final String INIT_DATA_TYPE = "DATA_TYPE"; + + private static final String INIT_COLUMN_NAME = "COLUMN_NAME"; + + private static final String INIT_FKCOLUMN_NAME = "FKCOLUMN_NAME"; + + private static final String INIT_UPDATE = "UPDATE "; + + private static final String INIT_ALTER_TABLE = "ALTER TABLE "; + + private static final String LIMIT = "limit"; + + private static final String FINDROWS_SELECT_1 = "select 1"; + + private static final String FINDROWS_AS_X = ") as _X"; + + private static final String FINDROWS_SELECT_COUNT_AS_TOT_FROM = "select count(*) as tot from ("; + + private static final String FINDROWS_LIMIT_MYSQL_QUERY = " limit "; + + public static final String BR = "
    "; + + public static final String NEW_LINE = "\n"; + + public static final String LINE_SEPARATOR = "-----------------------------------------------"; + + public static final String SEPARATOR_DOS = "\\"; + + public static final String SEPARATOR_UX = "/"; + + private static final String SEPARATOR_DOUBLE_DOS = "\\\\"; + + private static final String SEPARATOR_DOUBLE_UX = "//"; + + private static final char SEPARATOR_DOS_CHAR = '\\'; + + private static final char SEPARATOR_UX_CHAR = '/'; + + public static final String PLUS = "+"; + + public static final String MINUS = "-"; + + public static final String SLASH = "/"; + + public static final String BACK_SLASH = "/"; + + public static final String URL_WORD_SEPARATOR = "-"; + + public static final String UNDERSCORE = "_"; + + public static final char UNDERSCORE_CHAR = '_'; + + public static final String HASHTAG = "#"; + + public static final String EXT_GIF = ".gif"; + + public static final String EXT_JPG = ".jpg"; + + public static final String EXT_PNG = ".png"; + + public static final String EXT_JPEG = ".jpeg"; + + public static final String EXT_BMP = ".bmp"; + + public static final String EXT_TIF = ".tif"; + + public static final String EXT_TIFF = ".tiff"; + + public static final String EXT_PDF = ".pdf"; + + public static final String EXT_TXT = ".txt"; + + public static final String EXT_HTM = ".htm"; + + public static final String EXT_HTML = ".html"; + + public static final String EXT_XML = ".xml"; + + public static final String EXT_ZIP = ".zip"; + + public static final String EXT_DOC = ".doc"; + + public static final String EXT_DOCX = ".docx"; + + public static final String EXT_XLS = ".xls"; + + public static final String EXT_XLSX = ".xlsx"; + + public static final String EXT_CSV = ".cxv"; + + private static final long serialVersionUID = -878185466202377842L; + + private static final boolean _AB_TRY = true; + + private static final String STRING_COGNOME = "cognome"; + + public static final String SEP_CODICI = ","; + + public static final String SPACE = " "; + + public static final String SPACE_PIPE_SPACE = " | "; + + public static final String PIPE = "|"; + + public static final String COMMA_SPACE = ", "; + + public static final String POINT_SPACE = ". "; + + public static final String COMMA = ","; + + public static final String COLON = ":"; + + public static final String COLON_SPACE = ": "; + + public static final String SINGOL_QUOTE = "'"; + + public static final String SEMICOLON = ";"; + + public static final String SEMICOLON_SPACE = "; "; + + public static final long ID_0 = 0L; + + public static final String GO = "GO"; + + private static final String STRING_CASE_EMAIL = "email"; + + private static final String ACCESS_TABLE = "ACCESS"; + + private static final String DESC_TXT_LANG_TABLE = "DESC_TXT_LANG"; + + private static final String LOG_TABLE = "LOG"; + + public static final String NULL_TIMESTAMP = "'0000-00-00 00:00:00'"; + + public static final String AB_EMPTY_STRING = ""; + + public static final String AB_SPACE_STRING = " "; + + public static final String AB_NEW_LINE_STRING = "\n"; + + public static final String AB_NO = "N"; + + public static final long AB_NO_I = 0L; + + public static final String AB_SI = "S"; + + public static final String AB_TRUE = "true"; + + public static final String AB_FALSE = "false"; + + public static final long AB_SI_I = 1L; + + public static final long AB_ALL = -1L; + + public static final String AB_YES = "S"; + + public static final long AB_YES_I = 1L; + + private static final String LIC_KEY_EXPIRED_MESSAGE = "Sorry! the key is expired!. Please renew the acxent package at https://www.acxent.it"; + + private static final String LIC_FILE_NAME_E = "|vAtu"; + + private static String licFullFileName; + + private static long numberOfHits; + + private static final long MNH = 10002L; + + private static RegKey regKey; + + private Vector descTxtLangValues; + + public static final int ST_EDIT = 1; + + public static final int ST_LOCK = 2; + + public static final int ST_NEW = 0; + + public static final String CONST_SET = "set"; + + public static final String CONST_GET = "get"; + + public static final String CONST_DOT = "."; + + private Timestamp lastUpdTmst; + + private Timestamp createTmst; + + protected Users lastUpdUser; + + private String beanNotes; + + private String reqUrl; + + public static final String COL_LAST_UPD_ID_USER = "lastUpdId_user"; + + public static final String COL_CREATE_TMST = "createTmst"; + + public static final String COL_ENCODED_FIELDS = "encodedFields"; + + public static final String LANG_DEFAULT = "it"; + + public static final String COL_LAST_UPD_TMST = "lastUpdTmst"; + + public static final String COL_LAST_UPD_TMST_NONE = "0.0"; + + protected static final String BLANK = " "; + + protected static final String ZERO = "0000000000000000000000000000000000000000000000000000000"; + + private String descrizione; + + private transient ConnectionPool cp; + + private String versionString; + + private Date dataFineVld; + + private int DBState; + + private String currentFocus; + + private String imgTmst; + + private Vector rstColums; + + private String reqIpAddress; + + private String sqlQuery; + + private long lastUpdId_user; + + private long prtCommand; + + private String currentLang; + + private String logRecord; + + private String currentTab; + + private long id_ditta; + + private long step; + + private String encodedFields; + + protected Users userLogon; + + private long currentTabId; + + protected static final String STRING_DESCRIPTION = "description"; + + protected static final String STRING_NOMINATIVO = "nominativo"; + + protected static final String STRING_DATA_FINE_VLD = "dataFineVld"; + + public static final String STRING_DESCRIZIONE = "descrizione"; + + public static final String CSN_ISO_8859_1 = "ISO-8859-1"; + + public static final String CSN_UTF_8 = "UTF-8"; + + public static final String JPEG = "JPEG"; + + protected static final int STRING_CASE_1STUP = 3; + + protected static final int STRING_CASE_ASIS = 0; + + protected static final int STRING_CASE_UPPERCASE = 1; + + protected static final int STRING_CASE_LOWERCASE = 2; + + private static final boolean _AB_FULL = true; + + public static final int GRANT_NO = 0; + + public static final int GRANT_R = 1; + + public static final int GRANT_RM = 2; + + public static final int GRANT_RW = 3; + + public static final int GRANT_RWD = 4; + + public DBAdapter(ApplParmFull newApplParmFull) { + setApFull(newApplParmFull); + if (getApFull() != null) { + setLastUpdId_user(getApFull().getLastUpdId_user()); + setReqIpAddress(getApFull().getReqIpAddress()); + setReqUrl(getApFull().getReqUrl()); + } + } + + public static final boolean isClassExist(String className) { + try { + Class.forName(className); + return true; + } catch (ClassNotFoundException e) { + return false; + } + } + + private void activateRegKey() {} + + protected String buildHavingWc(String wc, String sc) { + if (wc.isEmpty()) + return " HAVING " + sc; + return wc + " AND " + wc; + } + + @Deprecated + protected String buildWc(String wc, String sc) { + if (wc.isEmpty()) { + if (!sc.trim().isEmpty()) + return " WHERE " + sc; + return ""; + } + if (!sc.trim().isEmpty()) + return wc + " AND " + wc; + return wc; + } + + private final void checkLic() {} + + protected long createPkwithSelMax(String table, String pkColumn) { + long myPK = 1L; + boolean forceRemove = false; + String S_Sql = "Select max(" + pkColumn + ") as id from " + table; + ResultSet rst = null; + PreparedStatement ps = null; + acquireConnection(); + ResParm rp = new ResParm(true); + try { + ps = getConn().prepareStatement(S_Sql); + rst = ps.executeQuery(); + if (rst.next()) + myPK = rst.getLong(1) + 1L; + } catch (SQLException e) { + rp = gestisciSQLException(e); + forceRemove = !rp.isOk(); + } catch (Exception e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + } finally { + releaseConnection(rst, ps, forceRemove); + } + return myPK; + } + + private final String dcd(String theString) { + return EcDc.decodeIntKey(theString, 19); + } + + public ResParm delete() { + ResParm rp = new ResParm(); + PreparedStatement ps = null; + boolean forceRemove = false; + long pkValue = getPkValue(); + beginTransaction(); + try { + rp = checkDeleteCascade(); + if (!rp.isOk()) { + if (rp.getMsg().isEmpty()) + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "DELETE_FAIL") + " " + AbMessages.getMessage(getCurrentLocale(), "DELETE_FAIL")); + handleDebug(rp.getMsg(), 5); + getCpc().setTxFailed(true); + return rp; + } + if (isDeleteLogic()) { + rp = logicDelete(); + if (!rp.isOk()) + getCpc().setTxFailed(true); + return rp; + } + deleteCascade(); + if (getDBState() != 1) + return rp; + ps = getConn().prepareStatement(sqlStringDelete()); + prepareDeleteKeyField(ps); + setSqlQuery(ps.toString()); + int affectedRows = ps.executeUpdate(); + if (affectedRows != 1) { + StringBuilder msg = new StringBuilder(AbMessages.getMessage(getCurrentLocale(), "DELETE_FAIL")); + Log.addCancellazioneRecordFallita(this, msg.toString()); + if (isSafeUpdateOn()) { + msg.append(AbMessages.getMessage(getCurrentLocale(), "ALREADY_SAVED")); + if (getLastUpdId_user() != 0L) + msg.append(" - ").append(getLastUpdUser().getLogin()); + } + rp.setStatus(false); + rp.setMsg(msg.toString()); + handleDebug(rp.getMsg(), 3); + getCpc().setTxFailed(true); + return rp; + } + deleteDescLangIfNeeded(pkValue); + logCancellazione(); + afterDelete(); + initFields(); + setDBState(0); + rp.setStatus(true); + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "DELETE_OK")); + handleDebug(rp.getMsg(), 5); + } catch (SQLException sqle) { + rp = gestisciSQLException(sqle); + forceRemove = !rp.isOk(); + if ("08S01".equals(sqle.getSQLState())) + forceRemove = true; + getCpc().setTxFailed(true); + Log.addCancellazioneRecordFallita(this, sqle.getMessage()); + rp.setStatus(false); + } catch (Exception e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + getCpc().setTxFailed(true); + Log.addCancellazioneRecordFallita(this, e.getMessage()); + } finally { + endTransaction(null, ps, forceRemove, rp); + } + return rp; + } + + public ResParm delete(PreparedStatement ps) { + return update(ps); + } + + public ResParm delete(String sqlString) { + return update(sqlString); + } + + protected boolean isColumnInResultSet(ResultSet rst, String columnName) { + if (rst == null || columnName == null) + return false; + if (this.rstColums == null) + try { + this.rstColums = new Vector<>(); + for (int i = 1; i <= rst.getMetaData().getColumnCount(); i++) + this.rstColums.add(rst.getMetaData().getColumnName(i)); + } catch (Exception e) { + e.printStackTrace(); + } + if (this.rstColums.contains(columnName)) + return true; + return false; + } + + protected void resetRstColumns() { + this.rstColums = null; + } + + @Deprecated + protected void fillObjectGPT(Hashtable htable) { + Enumeration parms = htable.keys(); + String parmName = ""; + String setMethodName = ""; + Object[] args = { null }; + Class[] param = new Class[] { null }; + Object obj = this; + while (parms.hasMoreElements()) { + parmName = parms.nextElement(); + Object parmValue = htable.get(parmName); + try { + Field field = getField(obj, parmName); + param[0] = field.getType(); + setMethodName = "set" + parmName.substring(0, 1).toUpperCase() + parmName.substring(1); + Method mth = obj.getClass().getMethod(setMethodName, param); + args[0] = parmValue; + mth.invoke(obj, args); + } catch (Exception e) { + e.printStackTrace(System.out); + } + } + } + + protected void fillObject(Hashtable htable) { + for (String parmName : htable.keySet()) { + Object parmValue = htable.get(parmName); + try { + Field field = getField(this, parmName); + if (field == null) + continue; + Class fieldType = field.getType(); + String setMethodName = "set" + Character.toUpperCase(parmName.charAt(0)) + parmName.substring(1); + Method setter = getClass().getMethod(setMethodName, fieldType); + Object valueToSet = convertValueIfNeeded(parmValue, fieldType); + setter.invoke(this, valueToSet); + } catch (Exception e) { + handleDebug("Errore durante il set del campo '" + parmName + "': " + e.getMessage(), 2); + } + } + } + + private Object convertValueIfNeeded(Object value, Class targetType) { + if (value == null) + return null; + if (targetType.isAssignableFrom(value.getClass())) + return value; + if (value instanceof String) { + String strVal = (String)value; + try { + if (targetType == Integer.class || targetType == int.class) + return Integer.parseInt(strVal); + if (targetType == Long.class || targetType == long.class) + return Long.parseLong(strVal); + if (targetType == Double.class || targetType == double.class) + return Double.parseDouble(strVal); + if (targetType == Boolean.class || targetType == boolean.class) + return Boolean.parseBoolean(strVal); + if (targetType == Timestamp.class) + return Timestamp.valueOf(strVal); + if (targetType == Date.class) + return Date.valueOf(strVal); + } catch (Exception e) { + handleDebug("Errore conversione valore '" + strVal + "' in " + targetType.getName(), 2); + } + } + return value; + } + + protected void fillObject(Object sourceObj) { + String parmName = ""; + String setMethodName = ""; + String getMethodName = ""; + Object[] args = { null }; + Class[] param = new Class[] { null }; + Object obj = this; + Field[] srcField = sourceObj.getClass().getDeclaredFields(); + for (Field element : srcField) { + try { + parmName = element.getName(); + getMethodName = "get" + parmName.substring(0, 1).toUpperCase() + parmName.substring(1); + Method mth = sourceObj.getClass().getMethod(getMethodName, null); + Object parmValue = mth.invoke(sourceObj, null); + Field field = getField(obj, parmName); + param[0] = field.getType(); + setMethodName = "set" + parmName.substring(0, 1).toUpperCase() + parmName.substring(1); + mth = obj.getClass().getMethod(setMethodName, param); + args[0] = parmValue; + mth.invoke(obj, args); + } catch (Exception e) { + handleDebug(e, 4); + handleDebug("fillObject(Object): error on source filed " + parmName, 4); + } + } + } + + public Vectumerator findAll() { + return findAll(0, 0); + } + + public void findByPrimaryKey(Object pk) { + acquireConnection(); + ResultSet rst = null; + PreparedStatement ps = null; + boolean forceRemove = false; + ResParm rp = new ResParm(true); + try { + if (checkProfile(getTableBeanName()) <= 0L) { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "GRANT_NO_R")); + return; + } + checkLic(); + ps = getConn().prepareStatement(sqlStringfindByPrimaryKey()); + prepareKeyField(ps, pk); + setSqlQuery(ps.toString()); + rst = ps.executeQuery(); + if (!rst.next()) { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "READ_FAIL"), 5); + setDBState(0); + initFields(); + } else { + if (getClassName().equals(DescTxtLang.class.getName())) { + DescTxtLang bean = (DescTxtLang)this; + DescTxtLangKey beanPk = (DescTxtLangKey)pk; + bean.setIdTabella(beanPk.getIdTabella()); + bean.setCampo(beanPk.getCampo()); + bean.setTabella(beanPk.getTabella()); + bean.setLang(beanPk.getLang()); + } + fillFields(rst); + handleDebug(AbMessages.getMessage(getCurrentLocale(), "READ_OK"), 5); + setDBState(1); + } + } catch (SQLException sqle) { + rp = gestisciSQLException(sqle); + forceRemove = !rp.isOk(); + handleDebug("findByPrimaryKey\nsqlstring: " + sqlStringfindByPrimaryKey() + "\nSqlException:\n" + + createDebugMessage(0, null, sqle, getApFull()), 0); + } catch (Exception e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + handleDebug("findByPrimaryKey\nsqlstring: " + sqlStringfindByPrimaryKey() + "\nException:\n" + + createDebugMessage(0, null, e, getApFull()), 0); + } finally { + releaseConnection(rst, ps, forceRemove); + } + } + + public ResParm refreshBean() { + boolean debug = false; + ResParm rp = new ResParm(true); + ResultSet rst = null; + PreparedStatement ps = null; + boolean forceRemove = false; + acquireConnection(); + try { + checkLic(); + ps = getConn().prepareStatement(sqlStringfindByPrimaryKey()); + setPkFieldsFromBean(ps, 1); + setSqlQuery(ps.toString()); + rst = ps.executeQuery(); + if (!rst.next()) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "REFRESH_BEAN_FAILED")); + rp.setStatus(false); + handleDebug(rp.getMsg() + "\nsqlquery: " + rp.getMsg(), 0); + logDebug(debug, "refreshBean sql ERRORE: " + ps.toString()); + setDBState(0); + initFields(); + } else { + fillFields(rst); + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "READ_OK")); + handleDebug(rp.getMsg(), 5); + rp.setStatus(true); + setDBState(1); + } + } catch (SQLException sqle) { + rp = gestisciSQLException(sqle); + forceRemove = !rp.isOk(); + if (getCpc() != null) + getCpc().setTxFailed(true); + } catch (Exception e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + if (getCpc() != null) + getCpc().setTxFailed(true); + } finally { + releaseConnection(rst, ps, forceRemove); + } + if (!rp.isOk()) + return null; + return rp; + } + + public void findByPrimaryKey(long l_pk) { + findByPrimaryKey(Long.valueOf(l_pk)); + } + + public void findFirstRecord(PreparedStatement ps, boolean releaseCon) { + ResultSet rst = null; + boolean forceRemove = false; + ResParm rp = new ResParm(true); + acquireConnection(); + try { + if (checkProfile(getTableBeanName()) <= 0L) { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "GRANT_NO_R")); + return; + } + setSqlQuery(ps.toString()); + rst = ps.executeQuery(); + initFields(); + if (!rst.next()) { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "READ_FAIL"), 5); + setDBState(0); + } else { + fillFields(rst); + handleDebug(AbMessages.getMessage(getCurrentLocale(), "READ_OK"), 5); + setDBState(1); + } + } catch (SQLException sqle) { + rp = gestisciSQLException(sqle); + forceRemove = !rp.isOk(); + handleDebug(sqle, 0); + setDBState(0); + } catch (Exception e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + handleDebug(e, 0); + setDBState(0); + } finally { + releaseConnection(rst, ps, forceRemove); + } + } + + public void findFirstRecord(PreparedStatement ps) { + findFirstRecord(ps, true); + } + + public DbInterface getFirstRecord(PreparedStatement ps) { + DBAdapter myBean = null; + boolean forceRemove = false; + ResParm rp = new ResParm(true); + ResultSet rst = null; + acquireConnection(); + try { + if (checkProfile(getTableBeanName()) <= 0L) { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "GRANT_NO_R")); + return null; + } + setSqlQuery(ps.toString()); + rst = ps.executeQuery(); + if (!rst.next()) { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "READ_FAIL"), 5); + } else { + myBean = (DBAdapter)clone(); + myBean.initFields(); + myBean.fillFields(rst); + myBean.setDBState(1); + handleDebug(AbMessages.getMessage(getCurrentLocale(), "READ_OK"), 5); + } + } catch (SQLException sqle) { + rp = gestisciSQLException(sqle); + forceRemove = !rp.isOk(); + handleDebug(sqle, 0); + myBean = null; + } catch (Exception e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + handleDebug(e, 2); + myBean = null; + } finally { + releaseConnection(rst, ps, forceRemove); + } + return myBean; + } + + protected Vectumerator findRows(PreparedStatement ps) { + return findRows(ps, 0, 0); + } + + public static final String prepareSqlString(String input, boolean isLike, boolean convertPerc, int dbType) { + if (input == null) + return null; + input = input.replace('’', '\'').replace('‘', '\'').replace('`', '\'').replace('´', '\'').replace('“', '"').replace('”', '"'); + if (dbType == 3 || dbType == 5 || dbType == 17) { + if (isLike) { + input = input.replace("\\", "\\\\\\\\").replace("%", "\\%"); + } else { + input = input.replace("\\", "\\\\"); + } + if (convertPerc) + if (!isLike) + input = input.replace("%", "\\%"); + input = input.replace("'", "\\'"); + } else if (dbType == 13 || dbType == 14) { + input = input.replace("\\", "\\\\"); + if (isLike) + input = input.replace("%", "[%]"); + input = input.replace("'", "''"); + } + return input; + } + + public static final String prepareSqlLikeString(String input, int dbType) { + return prepareSqlString(input, true, false, dbType); + } + + public static final String prepareInputMSSqlString(String sqlString, boolean convertPerc) { + return prepareSqlString(sqlString, false, convertPerc, 14); + } + + public static final String prepareInputMySqlString(String sqlString, boolean convertPerc) { + return prepareSqlString(sqlString, false, convertPerc, 17); + } + + @Deprecated + public static final String prepareSqlString(String sqlString) { + return prepareSqlString(sqlString, false, false, 17); + } + + private Vectumerator findRowsNotOptimized(PreparedStatement ps, int page, int pageRows) { + if (page <= 0) + page = 1; + setSqlQuery(ps.toString()); + Vectumerator vec = new Vectumerator<>(); + boolean debug = false; + Timer timer = new Timer(); + String methodName = ""; + if (checkProfile(getTableBeanName()) <= 0L) { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "GRANT_NO_R")); + return AB_EMPTY_VECTUMERATOR; + } + if (debug) { + timer.start(); + methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); + if (methodName.contains("findRows")) + methodName = Thread.currentThread().getStackTrace()[3].getMethodName(); + } + boolean forceRemove = false; + ResultSet rst = null; + int numRec = 0; + acquireConnection(); + try { + checkLic(); + boolean lastRecord = false; + if (pageRows == 0) { + rst = ps.executeQuery(); + while (rst.next()) { + fillAndAddBean(rst, vec); + numRec++; + } + lastRecord = true; + } else { + ps.setFetchSize((page - 1) * pageRows + pageRows); + rst = ps.executeQuery(); + if (page > 1) { + int i; + int skip = (page - 1) * pageRows; + switch (getApFull().getAp().getDbType()) { + case 0: + case 11: + case 13: + case 14: + for (i = 1; i <= skip; i++) { + if (!rst.next()) { + lastRecord = true; + break; + } + } + break; + default: + rst.first(); + rst.absolute(skip); + break; + } + } + int stop = (page - 1) * pageRows + pageRows; + while (numRec < stop && + rst.next()) { + DBAdapter bean = (DBAdapter)clone(); + bean.initFields(); + bean.fillFields(rst); + bean.setDBState(1); + vec.addElement(bean); + numRec++; + } + vec.setPageRow(pageRows); + vec.setPageNumber(page); + if (numRec < stop) { + lastRecord = true; + } else if (!rst.next()) { + lastRecord = true; + } else { + numRec++; + } + } + if (vec.isEmpty()) { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "NO_RECORDS_FOUND"), 5); + } else { + if (ps.getResultSetType() == 1003) { + if (!lastRecord) + while (rst.next()) + numRec++; + vec.setTotNumberOfRecords(numRec); + } else { + vec.setTotNumberOfRecords(rst.last() ? rst.getRow() : 0); + } + handleDebug(AbMessages.getMessage(getCurrentLocale(), "READ_OK"), 5); + } + } catch (SQLException sqle) { + forceRemove = true; + if ("08S01".equals(sqle.getSQLState())) + removeCPConnection(); + handleDebug(sqle, 0); + return AB_EMPTY_VECTUMERATOR; + } catch (Exception e) { + forceRemove = true; + handleDebug(e, 2); + return AB_EMPTY_VECTUMERATOR; + } finally { + releaseConnection(rst, ps, forceRemove); + } + if (debug) { + timer.stop(); + vec.setQueryTime(methodName + " : " + methodName); + } + return vec; + } + + private Class[] getClassParamByDataType(short dataType) { + Class[] returnClass = new Class[1]; + switch (dataType) { + case 6: + case 7: + returnClass[0] = float.class; + break; + case -6: + case 5: + returnClass[0] = int.class; + break; + case 4: + returnClass[0] = long.class; + break; + case -7: + returnClass[0] = boolean.class; + break; + case 2: + case 3: + case 8: + returnClass[0] = double.class; + break; + case -16: + case -15: + case -9: + case -1: + case 1: + case 12: + case 1111: + returnClass[0] = String.class; + break; + case 91: + returnClass[0] = Date.class; + break; + case 92: + returnClass[0] = Time.class; + break; + case 93: + returnClass[0] = Timestamp.class; + break; + default: + returnClass[0] = String.class; + break; + } + return returnClass; + } + + public Connection getConn() { + return getConn(true); + } + + public Connection getConn(boolean isIncrementTxtOwnerDepth) { + CPConnection cpc = getCpc(); + if (cpc == null) + return null; + return cpc.getConn(); + } + + public void beginTransaction() { + try { + getCpc().startTX(); + } catch (SQLException e) { + handleDebug(e, 0); + getCpc().setTxFailed(true); + } + } + + public void acquireConnection() { + getCpc().acquire(); + } + + public void endTransaction(ResultSet rst, PreparedStatement ps, boolean forceRemove, ResParm rp) { + _releaseOrFinalizeConnection(rst, ps, forceRemove, rp); + } + + public void endTransaction(ResParm rp) { + _releaseOrFinalizeConnection(null, null, false, rp); + } + + public CPConnection getCpc() { + StackTraceElement[] st = Thread.currentThread().getStackTrace(); + trace("getCpc called by: " + st[2].getClassName() + "." + st[2].getMethodName()); + ThreadLocal threadLocal = getThreadLocal(getApFull().getApCode()); + try { + CPConnection cpc = threadLocal.get(); + if (cpc == null || cpc.getConn() == null || cpc.getConn().isClosed() || !cpc.isValid()) { + if (cpc != null) + threadLocal.remove(); + cpc = getCp().getCPConnection(); + cpc.setReqIpAddress(getReqIpAddress()); + cpc.setReqUrl(getReqUrl()); + cpc.setLastUpdId_user(getLastUpdId_user()); + threadLocal.set(cpc); + } + return cpc; + } catch (SQLException|RuntimeException e) { + handleDebug(e, 0); + return null; + } + } + + protected long getCount(PreparedStatement ps, String columnName) { + long result = 0L; + ResultSet rst = null; + boolean forceRemove = false; + ResParm rp = new ResParm(true); + acquireConnection(); + try { + setSqlQuery(ps.toString()); + rst = ps.executeQuery(); + if (!rst.next()) { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "READ_FAIL SEL_MAX_FAIL"), 5); + } else { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "READ_OK"), 5); + result = rst.getLong(columnName); + } + } catch (SQLException sqle) { + rp = gestisciSQLException(sqle); + forceRemove = !rp.isOk(); + handleDebug(sqle, 0); + } catch (Exception e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + handleDebug(e, 2); + } finally { + releaseConnection(rst, ps, forceRemove); + } + return result; + } + + private ConnectionPool getCp() { + if (this.cp == null && getApFull() != null) + this.cp = ConnectionPool.getInstance(getApFull()); + return this.cp; + } + + public final String getCpDescription() { + ConnectionPool l_cp = getCp(); + if (l_cp != null) { + StringBuilder sb = new StringBuilder(); + if (getApFull() != null) { + sb.append(getApFull().getApDescription()); + } else { + sb.append("APFULL NULL!!"); + } + sb.append("\nFree cons: "); + sb.append(getCp().getFreeCons()); + sb.append("\nUsed cons: "); + sb.append(getCp().getUsedCons()); + sb.append("\nConnections stats:\n"); + sb.append(convertHtmlToString(getApFull().getAp().getConnectionsCreateTs())); + return sb.toString(); + } + return "Connection pool NULL!! Ap: " + getApFull().getApDescription(); + } + + protected Locale getCurrentLocale() { + if (getApFull().getLangCode().isEmpty()) + return getApFull().getAp().getLocale(); + return Locale.forLanguageTag(getApFull().getLangCode()); + } + + protected boolean isUseSafeUpdate() { + return false; + } + + private boolean isSafeUpdateOn() { + return initTableSafeUpdate.get(getApFull().getAp().getApCode(this)); + } + + public Date getDataFineVld() { + return this.dataFineVld; + } + + public int getDBState() { + return this.DBState; + } + + public static Date getFirstOfYear(int theYear) { + Calendar cal = Calendar.getInstance(); + cal.set(1, theYear); + Calendar foy = Calendar.getInstance(); + foy.set(cal.get(1), 0, 1); + Date firstOfYear = new Date(foy.getTime().getTime()); + return firstOfYear; + } + + public static final String getTimeNameForFileUpload() { + Calendar cal = Calendar.getInstance(); + String temp = String.valueOf(cal.getTimeInMillis()); + String randS = String.valueOf((long)(Math.random() * 1000.0D)); + return temp + temp; + } + + public static Date getFirstOfYearCurrentDate() { + Calendar cal = Calendar.getInstance(); + Calendar foy = Calendar.getInstance(); + foy.set(cal.get(1), 0, 1); + Date firstOfYear = new Date(foy.getTime().getTime()); + return firstOfYear; + } + + public static void logDebug(boolean debug, String msg) { + if (debug) + printDebug("\n##LOGDEBUG ### " + String.valueOf(getTimestamp()) + " " + Thread.currentThread().getStackTrace()[4].getMethodName() + "->" + + Thread.currentThread().getStackTrace()[3].getMethodName() + "->" + + Thread.currentThread().getStackTrace()[2].getMethodName() + ": " + msg); + } + + public static void logDebug(boolean debug, long msg) { + logDebug(debug, "" + msg); + } + + public static void logDebug(boolean debug, int msg) { + logDebug(debug, "" + msg); + } + + public static String subString(String theString, int length) { + if (theString.length() <= length) + return theString; + return theString.substring(0, length - 1); + } + + public static Date getLastOfYear(int theYear) { + Calendar cal = Calendar.getInstance(); + cal.set(1, theYear); + Calendar loy = Calendar.getInstance(); + loy.set(cal.get(1), 11, 31); + Date lastOfYear = new Date(loy.getTime().getTime()); + return lastOfYear; + } + + public static Date getLastOfYearCurrentDate() { + Calendar cal = Calendar.getInstance(); + Calendar loy = Calendar.getInstance(); + loy.set(cal.get(1), 11, 31); + Date lastOfYear = new Date(loy.getTime().getTime()); + return lastOfYear; + } + + public static long getDateDiff(Date date1, Date date2) { + if (date1 != null && date2 != null) { + Calendar c1 = Calendar.getInstance(); + Calendar c2 = Calendar.getInstance(); + c1.setTime(date1); + if (date2 != null) + c2.setTime(date2); + c1.set(11, 0); + c1.set(12, 0); + c1.set(13, 0); + c1.set(14, 0); + c2.set(11, 0); + c2.set(12, 0); + c2.set(13, 0); + c2.set(14, 0); + double DdifInDays = (double)(c2.getTime().getTime() - c1.getTime().getTime()) / 8.64E7D; + long difInDays = Math.round(DdifInDays); + return difInDays; + } + return 0L; + } + + public static long getDateDiff(java.util.Date date1, java.util.Date date2) { + Date d1 = new Date(date1.getTime()); + Date d2 = new Date(date2.getTime()); + return getDateDiff(d1, d2); + } + + public static long getTimeDiff(Time time1, Time time2) { + long c1, c2; + if (time1 == null) { + c1 = 0L; + } else { + Calendar cal = Calendar.getInstance(); + cal.setTimeInMillis(time1.getTime()); + c1 = (long)(cal.get(11) * 3600 + cal.get(12) * 60 + cal.get(13)); + } + if (time2 == null) { + c2 = 0L; + } else { + Calendar cal = Calendar.getInstance(); + cal.setTimeInMillis(time2.getTime()); + c2 = (long)(cal.get(11) * 3600 + cal.get(12) * 60 + cal.get(13)); + } + long difInSecs = c2 - c1; + return difInSecs; + } + + public static long getTimestampDiff(Timestamp ts1, Timestamp ts2) { + if (ts1 == null) + ts1 = getNowTs(); + if (ts2 == null) + ts2 = getNowTs(); + long difInSecs = (ts2.getTime() - ts1.getTime()) / 1000L; + return difInSecs; + } + + public static long getTimestampDiff(Time ts1, Time ts2) { + if (ts1 == null) + ts1 = getNow(); + if (ts2 == null) + ts2 = getNow(); + long difInSecs = (ts2.getTime() - ts1.getTime()) / 1000L; + return difInSecs; + } + + public static long getTimeDiff(Timestamp time1, Timestamp time2) { + long c1, c2; + if (time1 == null) { + c1 = 0L; + } else { + c1 = time1.getTime(); + } + if (time2 == null) { + c2 = 0L; + } else { + c2 = time2.getTime(); + } + long difInSecs = (c2 - c1) / 1000L; + return difInSecs; + } + + public static String getDateDay(Date date) { + Calendar cal = Calendar.getInstance(); + if (date != null) { + cal.setTime(date); + return DAY_DES[cal.get(7) - 1]; + } + return ""; + } + + public static Date convertStringToDate(String date) { + SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy"); + java.util.Date data = null; + Date dataRet = null; + if (!date.isEmpty()) + try { + data = formatter.parse(date); + dataRet = new Date(data.getTime()); + } catch (Exception e) {} + return dataRet; + } + + public final String convertTimestampToString(Timestamp tmst) { + if (tmst == null || getApFull() == null) + return ""; + return getTimestampFormat().format((java.util.Date)tmst); + } + + public static Time convertStringToTime(String ora) { + try { + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); + java.util.Date ora1 = sdf.parse(ora); + return new Time(ora1.getTime()); + } catch (ParseException e) { + return null; + } + } + + public static Date getDateByDate(Date date, long operation, int field, int amount) { + Calendar cal = Calendar.getInstance(); + if (date != null) { + cal.setTime(date); + if (operation == 1L) + amount *= -1; + cal.add(field, amount); + return new Date(cal.getTimeInMillis()); + } + return null; + } + + public static String getDateDayByDay(long day) { + return DAY_DES[(int)day - 1]; + } + + public String getLongDayByDate(Date data) { + Calendar cal = Calendar.getInstance(); + cal.setTime(data); + long day = (long)(cal.get(7) - 1); + return DAY_DES[(int)day]; + } + + public String getShortDayByDate(Date data) { + Calendar cal = Calendar.getInstance(); + cal.setTime(data); + long day = (long)(cal.get(7) - 1); + return DAY_DES_short[(int)day]; + } + + public String getDocBase() { + return getParm("DOCBASE").getTesto(); + } + + protected double getDoubleCol(PreparedStatement ps, String columnName, boolean releaseCon) { + double result = 0.0D; + ResultSet rst = null; + boolean forceRemove = false; + ResParm rp = new ResParm(true); + acquireConnection(); + try { + setSqlQuery(ps.toString()); + rst = ps.executeQuery(); + if (!rst.next()) { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "READ_FAIL SEL_MAX_FAIL"), 5); + } else { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "READ_OK"), 5); + result = rst.getDouble(columnName); + } + } catch (SQLException sqle) { + rp = gestisciSQLException(sqle); + forceRemove = !rp.isOk(); + handleDebug(sqle, 0); + } catch (Exception e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + handleDebug(e, 2); + } finally { + releaseConnection(rst, ps, forceRemove); + } + return result; + } + + private Field getField(Object obj, String parmName) throws Exception { + Field field = null; + Class cls = obj.getClass(); + while (!cls.equals(Object.class)) { + try { + field = cls.getDeclaredField(parmName); + break; + } catch (NoSuchFieldException nsfe) { + cls = cls.getSuperclass(); + if (cls.equals(DBAdapter.class)) + throw nsfe; + } catch (Exception e) { + throw e; + } + } + return field; + } + + public PrintWriter getHTML(String xslFile, PrintWriter pw) throws Exception { + return null; + } + + public PrintWriter getHTML(String xmlFile, String xslFile, PrintWriter pw) throws Exception { + return null; + } + + public String getImageExtension(String imageName) { + try { + String fullImageName = getDocBase() + "/" + getDocBase(); + if (isFileExist(fullImageName)) + return ""; + if (isFileExist(fullImageName + ".jpg")) + return ".jpg"; + if (isFileExist(fullImageName + ".gif")) + return ".gif"; + return ""; + } catch (Exception e) { + handleDebug(e); + return ""; + } + } + + public String getImageFileExtension(String imageName) { + try { + String fullImageName = getApFull().getAp().getResource("imgPath") + "/" + getApFull().getAp().getResource("imgPath"); + if (isFileExist(fullImageName)) + return ""; + if (isFileExist(fullImageName + ".jpg")) + return ".jpg"; + if (isFileExist(fullImageName + ".gif")) + return ".gif"; + return ""; + } catch (Exception e) { + handleDebug(e); + return ""; + } + } + + private Object[] getInitValueByeDataType(short dataType) { + Object[] returnObj = new Object[1]; + switch (dataType) { + case 6: + case 7: + returnObj[0] = INIT_FLOAT_0; + break; + case -6: + case 5: + returnObj[0] = INIT_INTEGER_0; + break; + case 4: + returnObj[0] = INIT_LONG_0; + break; + case -7: + returnObj[0] = INIT_BOOLEAN_0; + break; + case 3: + case 8: + returnObj[0] = INIT_DOUBLE_0; + break; + default: + returnObj[0] = null; + break; + } + return returnObj; + } + + protected long getLastInsertId() throws SQLException { + long myPK = 1L; + PreparedStatement ps = null; + ResultSet rst = null; + boolean forceRemove = false; + ResParm rp = new ResParm(true); + acquireConnection(); + try { + String str1, seq, tableName, S_Sql, str2; + switch (getApFull().getAp().getDbType()) { + case 3: + case 5: + case 17: + str1 = "Select LAST_INSERT_ID() as id "; + ps = getConn().prepareStatement(str1); + rst = ps.executeQuery(); + if (rst.next()) + myPK = rst.getLong(1); + break; + case 4: + seq = getPostgresSequenceName(); + str2 = "Select currval('" + seq + "') as id "; + ps = getConn().prepareStatement(str2); + rst = ps.executeQuery(); + if (rst.next()) + myPK = rst.getLong(1); + break; + case 9: + tableName = getTableBeanName(); + str2 = "Select dbinfo('sqlca.sqlerrd1') as id from " + tableName; + ps = getConn().prepareStatement(str2); + rst = ps.executeQuery(); + if (rst.next()) + myPK = rst.getLong(1); + break; + case 13: + case 14: + S_Sql = "SELECT @@IDENTITY AS id "; + ps = getConn().prepareStatement(S_Sql); + rst = ps.executeQuery(); + if (rst.next()) + myPK = rst.getLong(1); + break; + default: + S_Sql = "Select LAST_INSERT_ID() as id "; + ps = getConn().prepareStatement(S_Sql); + rst = ps.executeQuery(); + if (rst.next()) + myPK = rst.getLong(1); + break; + } + } catch (SQLException sqle) { + rp = gestisciSQLException(sqle); + forceRemove = !rp.isOk(); + handleDebug(sqle, 0); + throw sqle; + } catch (Exception e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + handleDebug(e, 0); + throw new SQLException(e.getMessage()); + } finally { + releaseConnection(rst, ps, forceRemove); + } + return myPK; + } + + public void resetBean() { + initFields(); + setDBState(0); + releaseConnection(null, null, false); + } + + private final String getLicFullFileName() { + if (licFullFileName == null) { + String classPath = System.getProperty("java.class.path"); + StringTokenizer st = new StringTokenizer(classPath, System.getProperty("path.separator")); + while (st.hasMoreTokens()) { + String temp = st.nextToken() + st.nextToken() + System.getProperty("file.separator"); + if (new File(temp).exists()) { + licFullFileName = temp; + break; + } + } + if (licFullFileName == null) { + String temp = classPath.substring(0, classPath.indexOf(System.getProperty("path.separator"))); + licFullFileName = temp + temp + System.getProperty("file.separator"); + } + } + handleDebug(licFullFileName); + return licFullFileName; + } + + public Users getLastUpdUser() { + this.lastUpdUser = (Users)getSecondaryObject(this.lastUpdUser, Users.class, new Long(getLastUpdId_user())); + return this.lastUpdUser; + } + + protected double getMax(PreparedStatement ps, boolean releaseCon) { + return getDoubleCol(ps, "_max", releaseCon); + } + + protected double getMax(PreparedStatement ps) { + return getDoubleCol(ps, "_max", true); + } + + protected double getMax(String l_sql, boolean releaseCon) throws DBAdapterException, SQLException { + PreparedStatement ps = getConn().prepareStatement(l_sql); + return getMax(ps, releaseCon); + } + + public NumberFormat getNf() { + return getNf2(); + } + + public NumberFormat getNf0() { + return getApFull().getAp().getNf0(); + } + + public NumberFormat getNf2() { + return getApFull().getAp().getNf2(); + } + + private String getPostgresSequenceName() { + ColumnDescriptor cd = getPrimaryKeyDescriptor(); + if (cd != null) { + String columnName = cd.getColumnName(); + String tableName = getTableBeanName(); + return tableName.substring(0, Math.min(13, tableName.length())) + "_" + tableName.substring(0, Math.min(13, tableName.length())) + "_seq"; + } + handleDebug("getPostgresSequenceName: Primary key descriptor is null for " + getTableBeanName(), 2); + return getTableBeanName() + "_ERROR_PK_DESC_SEQ"; + } + + protected int setPkFieldsFromBean(PreparedStatement ps, int startIndex) throws SQLException, Exception { + LinkedHashMap primaryKeyDescriptors = initTableDescriptorDbPk.get(getApFull().getAp().getApCode(this)); + if (primaryKeyDescriptors == null) + throw new SQLException("Primary key descriptors not initialized for " + getClassName()); + int paramIndex = startIndex; + for (ColumnDescriptor cd : primaryKeyDescriptors.values()) { + short dataType = cd.getDataType(); + Object pkValue = cd.getGetMethod().invoke(this, null); + setPSByDataType(ps, dataType, paramIndex, pkValue); + paramIndex++; + } + return paramIndex - 1; + } + + private String getRealColumnName(Class theClass, String columnName) { + if (getApFull().getAp().getDbType() != 2) { + Field[] fields = theClass.getDeclaredFields(); + for (Field field : fields) { + String fieldName = field.getName(); + if (fieldName.equals(columnName) || fieldName.toLowerCase().equals(columnName) || + fieldName.toUpperCase().equals(columnName)) + return fieldName; + } + if (theClass.equals(Object.class)) + return null; + return getRealColumnName(theClass.getSuperclass(), columnName); + } + return columnName; + } + + private RegKey getRegKey() { + if (regKey == null) { + regKey = new RegKey(); + regKey.setKey("_TL_", new Integer(0)); + regKey.setKey("_MH_", new Long(10002L)); + String temp = "\n-------------- LICENSE INFO -----------------\n"; + int tli = regKey.getKeyI("_TL_"); + String maxhits = String.valueOf(regKey.getKeyL("_MH_")); + String custno = String.valueOf(regKey.getKeyL("_CN_")); + String licno = regKey.getKeyS("_LIC"); + if (tli == 1) { + temp = temp + "Unlimited"; + } else if (tli == 0) { + temp = temp + "Development: max Hits: " + temp; + } else if (tli == 2) { + temp = temp + "Time Limit"; + } else { + temp = temp + "??"; + } + temp = temp + " - Cust. Numb.:" + temp; + temp = temp + " - Lic. Numb.:" + temp; + temp = temp + "\n-------------------------------------------\n"; + handleDebug(temp); + } + return regKey; + } + + protected DBAdapter getSecondaryObject(DBAdapter obj, Class objClass, long pkLongValue) { + return getSecondaryObject(obj, objClass, new Long(pkLongValue)); + } + + public static final DBAdapter getSecondaryObject(ApplParmFull ap, DBAdapter obj, Class objClass, Object pkValue) throws Exception { + if (obj == null) { + boolean pkNull = false; + if (pkValue instanceof String) { + if (((String)pkValue).isEmpty()) + pkNull = true; + } else if (pkValue instanceof Long && + (Long)pkValue == 0L) { + pkNull = true; + } + if (obj == null && !pkNull && ap != null) { + obj = objClass.getDeclaredConstructor(null).newInstance(); + obj.setApFull(ap); + obj.findByPrimaryKey(pkValue); + } else if (pkNull || ap == null) { + obj = objClass.getDeclaredConstructor(null).newInstance(); + obj.setApFull(ap); + } + } + return obj; + } + + protected DBAdapter getSecondaryObject(DBAdapter obj, Class objClass, Object pkValue) { + try { + return getSecondaryObject(getApFull(), obj, objClass, pkValue); + } catch (Exception e) { + handleDebug(e); + return obj; + } + } + + protected double getSum(PreparedStatement ps, boolean releaseCon) { + return getDoubleCol(ps, "_sum", releaseCon); + } + + protected double getSum(PreparedStatement ps) { + return getDoubleCol(ps, "_sum", true); + } + + protected double getSum(String l_sql, boolean releaseCon) { + try { + PreparedStatement ps = getConn().prepareStatement(l_sql); + return getSum(ps, releaseCon); + } catch (Exception e) { + handleDebug(e); + return 0.0D; + } + } + + public String getTableBeanName() { + String temp = getClass().toString(); + temp = temp.substring(temp.lastIndexOf('.') + 1, temp.length()); + StringBuffer tn = new StringBuffer(); + tn.append(temp.charAt(0)); + for (int i = 1; i < temp.length(); i++) { + if (Character.isUpperCase(temp.charAt(i))) + tn.append('_'); + tn.append(Character.toUpperCase(temp.charAt(i))); + } + return tn.toString(); + } + + protected String getClassName() { + return getClass().getName(); + } + + protected double getTots(PreparedStatement ps) { + double result = 0.0D; + ResultSet rst = null; + boolean forceRemove = false; + ResParm rp = new ResParm(true); + acquireConnection(); + try { + checkLic(); + setSqlQuery(ps.toString()); + rst = ps.executeQuery(); + if (!rst.next()) { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "READ_FAIL SEL_SUM_FAIL"), 5); + } else { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "READ_OK"), 5); + result = rst.getDouble("tot"); + } + } catch (SQLException sqle) { + rp = gestisciSQLException(sqle); + forceRemove = !rp.isOk(); + handleDebug(sqle, 0); + } catch (Exception e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + handleDebug(e, 2); + } finally { + releaseConnection(rst, ps, forceRemove); + } + return result; + } + + protected double getTots(String l_sql) { + PreparedStatement ps = null; + try { + ps = getConn().prepareStatement(l_sql); + return getTots(ps); + } catch (SQLException sqle) { + ResParm rp = gestisciSQLException(sqle); + boolean forceRemove = !rp.isOk(); + releaseConnection(null, ps, forceRemove); + handleDebug(sqle, 0); + return -1.0D; + } catch (Exception e) { + ResParm rp = gestisciEccezioneGenerica(e); + boolean forceRemove = !rp.isOk(); + releaseConnection(null, ps, forceRemove); + handleDebug(e, 0); + return -1.0D; + } + } + + private final Field getDeclaredField(String realColumnName) { + Field theField = null; + Class currentClass = getClass(); + String startingClass = currentClass.getSimpleName(); + while (theField == null) { + try { + theField = currentClass.getDeclaredField(realColumnName); + } catch (NoSuchFieldException e) {} + if (currentClass.getSimpleName().equals("DBAdapter")) + break; + currentClass = currentClass.getSuperclass(); + } + if (theField == null) + System.out.println("\n##### INIT BEAN NoSuchFieldException ##### " + startingClass + " " + realColumnName + ": "); + return theField; + } + + protected void initFields() { + if (getApFull() != null) { + Hashtable columnDescriptor = initTableDescriptorDb.get(getApFull().getAp().getApCode(this)); + Enumeration enu = columnDescriptor.elements(); + while (enu.hasMoreElements()) { + ColumnDescriptor cd = enu.nextElement(); + short dataType = cd.getDataType(); + try { + Method mth = cd.getSetMethod(); + mth.invoke(this, getInitValueByeDataType(dataType)); + } catch (Exception e) { + handleDebug(e); + } + } + } + } + + public boolean isDeleteLogic() { + Access theBeanAccess = Access.getAccess(this, getApFull()); + return false; + } + + protected boolean isDatabaseBean() { + return true; + } + + public boolean isDbTable() { + return true; + } + + public static final boolean isFileExist(String fileNameCode) { + return new File(fileNameCode).exists(); + } + + public static boolean deleteFile(String fileNameCode) { + File file = new File(fileNameCode); + if (!file.exists()) { + printDebug("deleteFile: il file non esiste -> " + fileNameCode); + return false; + } + if (!file.isFile()) { + printDebug("deleteFile: il path non è un file -> " + fileNameCode); + return false; + } + boolean deleted = file.delete(); + if (!deleted) + printDebug("deleteFile: impossibile cancellare -> " + fileNameCode); + return deleted; + } + + public boolean isImageExist(String imageName) { + try { + String fullImageName = getDocBase() + "/" + getDocBase(); + if (isFileExist(fullImageName)) + return true; + if (isFileExist(fullImageName + ".jpg")) + return true; + return isFileExist(fullImageName + ".gif"); + } catch (Exception e) { + handleDebug(e, 3); + return false; + } + } + + public boolean isImageFileExist(String imageName) { + try { + String fullImageName = getApFull().getAp().getResource("imgPath") + "/" + getApFull().getAp().getResource("imgPath"); + if (isFileExist(fullImageName)) + return true; + if (isFileExist(fullImageName + ".jpg")) + return true; + return isFileExist(fullImageName + ".gif"); + } catch (Exception e) { + handleDebug(e, 3); + return false; + } + } + + private ResParm logicDelete() { + ResParm rp = new ResParm(); + PreparedStatement ps = null; + boolean forceRemove = false; + String apCode = getApFull().getAp().getApCode(this); + String sqlString = initSqlStringDbLogicDelete.get(apCode); + if (sqlString == null) { + String msg = "SQL logic delete non trovato per apCode=" + apCode; + handleDebug(msg, 2); + return new ResParm(false, msg); + } + acquireConnection(); + try { + ps = getConn().prepareStatement(sqlString); + prepareLogicDeleteKeyField(ps); + setSqlQuery(ps.toString()); + int affectedRows = ps.executeUpdate(); + if (affectedRows == 0) { + String msg = AbMessages.getMessage(getCurrentLocale(), "DELETE_FAIL 0"); + rp.setStatus(false); + rp.setMsg(msg); + handleDebug(msg, 3); + getCpc().setTxFailed(true); + } else { + initFields(); + setDBState(0); + rp.setStatus(true); + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "DELETE_OK")); + handleDebug(rp.getMsg(), 5); + } + } catch (SQLException e) { + rp = gestisciSQLException(e); + forceRemove = !rp.isOk(); + getCpc().setTxFailed(true); + Log.addCancellazioneRecordFallita(this, e.getMessage()); + } catch (Exception e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + getCpc().setTxFailed(true); + Log.addCancellazioneRecordFallita(this, e.getMessage()); + } finally { + releaseConnection(null, ps, forceRemove); + } + return rp; + } + + public Vectumerator migraFindAll() throws DBAdapterException { + String s_Sql_Find = sqlStringfindAll(); + int idx = s_Sql_Find.toLowerCase().indexOf("where"); + if (idx > 0) { + s_Sql_Find = s_Sql_Find.substring(0, idx); + } else { + idx = s_Sql_Find.toLowerCase().indexOf("order"); + if (idx > 0) + s_Sql_Find = s_Sql_Find.substring(0, idx); + } + handleDebug(s_Sql_Find); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find); + return findRows(stmt); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected void prepareDeleteKeyField(PreparedStatement ps) throws SQLException, Exception { + int lastPkIndex = setPkFieldsFromBean(ps, 1); + if (isSafeUpdateOn() && getDBState() == 1) + ps.setTimestamp(lastPkIndex + 1, getLastUpdTmst()); + } + + protected void prepareKeyField(PreparedStatement ps, Object pk) throws SQLException, Exception { + LinkedHashMap primaryKeyDescriptors = initTableDescriptorDbPk.get(getApFull().getAp().getApCode(this)); + if (primaryKeyDescriptors == null) + throw new SQLException("Primary key descriptors not initialized for " + getClassName() + " with apCode " + + getApFull().getAp().getApCode(this)); + if (primaryKeyDescriptors.size() == 1) { + ColumnDescriptor cd = primaryKeyDescriptors.values().iterator().next(); + short dataType = cd.getDataType(); + setPSByDataType(ps, dataType, 1, pk); + } else { + int paramIndex = 1; + for (ColumnDescriptor currentCd : primaryKeyDescriptors.values()) { + short dataType = currentCd.getDataType(); + String columnName = currentCd.getColumnName(); + Method mth = pk.getClass().getMethod("get" + columnName.substring(0, 1).toUpperCase() + columnName.substring(1), null); + Object pkValue = mth.invoke(pk, null); + setPSByDataType(ps, dataType, paramIndex, pkValue); + paramIndex++; + } + } + } + + protected void prepareLogicDeleteKeyField(PreparedStatement ps) throws SQLException, Exception { + int numPk = 0; + numPk++; + ps.setDate(numPk, new Date(new java.util.Date().getTime())); + numPk = setPkFieldsFromBean(ps, numPk + 1); + if (isSafeUpdateOn() && getDBState() == 1) + ps.setTimestamp(numPk + 1, getLastUpdTmst()); + } + + protected void preparePrimaryKeyBeforeInsert() {} + + protected void prepareSave(PreparedStatement ps) throws SQLException { + if (ps.isClosed()) + throw new SQLException("prepareSave: PreparedStatement is closed"); + try { + Hashtable columnDescriptor = initTableDescriptorDb.get(getApFull().getAp().getApCode(this)); + int totCol = columnDescriptor.size(); + int numCol = 0; + int numColEncodedFields = 0; + StringBuilder encodedFields = new StringBuilder(); + for (ColumnDescriptor cd : columnDescriptor.values()) { + numCol++; + printDebug(false, "Preparing save for numCol:" + numCol + " column: " + cd.getColumnName()); + if (cd.getColumnName().equals("lastUpdTmst")) { + setTimestampForLastUpd(ps, cd, numCol); + continue; + } + if (cd.getColumnName().equals("createTmst") && getCreateTmst() == null) { + ps.setTimestamp(numCol, new Timestamp(System.currentTimeMillis())); + continue; + } + if (cd.getColumnName().equals("encodedFields")) { + numColEncodedFields = numCol; + setPSByDataType(ps, cd.getDataType(), numCol, ""); + continue; + } + Object value = cd.getGetMethod().invoke(this); + value = normalizeNullValues(cd, value); + if (cd.isPk()) { + boolean includeInInsert = shouldIncludePkInInsert(cd); + if (includeInInsert) { + setPSByDataType(ps, cd.getDataType(), numCol, value); + } else { + totCol--; + numCol--; + continue; + } + if (shouldSetPostgresSequence(cd, value)) + setPostgresSequence(value); + continue; + } + value = handleSpecialTypes(cd, value); + setPSByDataType(ps, cd.getDataType(), numCol, value); + if (cd.getEncodedField().isCodifica()) + encodedFields.append((encodedFields.length() == 0) ? cd.getEncodedField().getEncodedFieldsPrefix() : ",") + .append(cd.getColumnName()); + } + if (getDBState() == 1) + totCol = setPkWhereCondition(ps, totCol); + if (encodedFields.length() > 0) + setPSByDataType(ps, 12, numColEncodedFields, EcDc.encodeAES(encodedFields.toString(), "Xg3Z5sFQ")); + if (isSafeUpdateOn() && getDBState() == 1) + setSafeUpdateTimestamp(ps, totCol + 1); + } catch (Exception e) { + throw new SQLException("Errore nella preparazione dei parametri del PreparedStatement", e); + } + } + + private void setTimestampForLastUpd(PreparedStatement ps, ColumnDescriptor cd, int index) throws SQLException { + if (getApFull().getAp().getDbType() == 13 || + getApFull().getAp().getDbType() == 14) { + ps.setTimestamp(index, null); + } else { + ps.setTimestamp(index, new Timestamp(System.currentTimeMillis())); + } + } + + private Object normalizeNullValues(ColumnDescriptor cd, Object value) { + if (value instanceof String && ((String)value).isEmpty() && !cd.isPk() && useNullForString()) + return null; + return value; + } + + private boolean shouldIncludePkInInsert(ColumnDescriptor cd) { + return (!cd.isAutoIncrement() || (getDBState() == 0 && getApFull().getAp().getDbType() != 4 && + getApFull().getAp().getDbType() != 13 && + getApFull().getAp().getDbType() != 14)); + } + + private boolean shouldSetPostgresSequence(ColumnDescriptor cd, Object value) { + return (cd.isAutoIncrement() && getApFull().getAp().getDbType() == 4 && getDBState() == 0 && value instanceof Long && (Long)value > + 1L); + } + + private void setPostgresSequence(Object value) throws Exception { + String seqSql = "SELECT setval('" + getPostgresSequenceName() + "'," + (Long)value - 1L + ")"; + try (PreparedStatement pspg = getConn().prepareStatement(seqSql)) { + pspg.execute(); + } + } + + private int setPkWhereCondition(PreparedStatement ps, int baseIndex) throws Exception { + LinkedHashMap pkDescriptors = initTableDescriptorDbPk.get(getApFull().getAp().getApCode(this)); + int currentColumn = baseIndex; + for (ColumnDescriptor cd : pkDescriptors.values()) { + Object value = cd.getGetMethod().invoke(this); + currentColumn++; + setPSByDataType(ps, cd.getDataType(), currentColumn, value); + } + return currentColumn; + } + + private Object handleSpecialTypes(ColumnDescriptor cd, Object value) throws Exception { + if (value == null) + return null; + switch (cd.getDataType()) { + case 6: + case 7: + return (useNullFor0() && (Float)value == 0.0F) ? null : value; + case -6: + case 5: + return (useNullFor0() && (Integer)value == 0) ? null : value; + case 4: + if ((Long)value == 0L && (cd.isPk() || cd.isFk() || useNullFor0())) + return null; + return value; + case 2: + case 3: + case 8: + return (useNullFor0() && (Double)value == 0.0D) ? null : value; + } + if (cd.isCompressedText()) + return compressText((String)value); + return value; + } + + private void setSafeUpdateTimestamp(PreparedStatement ps, int index) throws SQLException { + System.out.println("setSafeUpdateTimestamp:" + index + " column: LastUpdTmst"); + ps.setTimestamp(index, getLastUpdTmst()); + } + + protected final synchronized void releaseCPConnection() { + CPConnection cpc = getCpc(); + if (cpc == null) + return; + if (cpc.getTxOwnerDepth() > 0) { + cpc.decrementTxOwnerDepth(); + printDebug(false, "releaseCPConnection: decrement cpc.getTxOwnerDepth(): " + cpc.getTxOwnerDepth()); + if (cpc.getTxOwnerDepth() < 0) { + String msg = "ATTENZIONE: txOwnerDepth negativo! Forse releaseCPConnection() chiamato troppe volte."; + handleDebug(msg, 3); + cpc.resetTxFlags(); + getThreadLocal(getApFull().getApCode()).remove(); + getCp().releaseCPConnection(cpc); + return; + } + if (cpc.getTxOwnerDepth() == 0) { + printDebug(false, "releaseCPConnection: Depth è 0, finalizzo transazione."); + try { + if (cpc.isTxFailed()) { + cpc.getConn().rollback(); + handleDebug("TX rollback", 5); + printDebug("=======================> ATTENZIONE! TX rollback"); + } else { + cpc.getConn().commit(); + handleDebug("TX commit", 5); + printDebug("TX commit"); + } + } catch (SQLException e) { + handleDebug(e, 0); + } finally { + try { + if (cpc.getConn() != null && !cpc.getConn().isClosed()) + cpc.getConn().setAutoCommit(true); + } catch (SQLException e) { + handleDebug(e, 3); + } + cpc.resetTxFlags(); + getThreadLocal(getApFull().getApCode()).remove(); + getCp().releaseCPConnection(cpc); + } + } + } else { + handleDebug("RELEASE connection (fuori TX): " + String.valueOf(cpc.getCreateTs()), 5); + getThreadLocal(getApFull().getApCode()).remove(); + getCp().releaseCPConnection(cpc); + } + } + + public void releaseConnection(ResultSet rst, PreparedStatement ps, boolean forceRemove) { + _releaseOrFinalizeConnection(rst, ps, forceRemove, null); + } + + protected final void removeCPConnection() { + CPConnection cpc = getCpc(); + if (cpc == null) + return; + printDebug(false, "Connection removed FORZATAMENTE. (Depth era: " + cpc.getTxOwnerDepth() + ")"); + try { + if (cpc.getConn() != null && !cpc.getConn().isClosed()) { + cpc.getConn().rollback(); + cpc.getConn().setAutoCommit(true); + } + } catch (SQLException e) { + handleDebug(e, 3); + } finally { + cpc.resetTxFlags(); + getThreadLocal(getApFull().getApCode()).remove(); + getCp().removeCPConnection(cpc); + } + } + + protected void retrieveAutoIncrementID() throws SQLException { + try { + ColumnDescriptor cd = getPrimaryKeyDescriptor(); + if (cd == null) { + handleDebug("Primary key descriptors not initialized", 2); + return; + } + if (cd != null) + if (cd.isAutoIncrement()) { + long currentId = (Long)cd.getGetMethod().invoke(this, null); + if (currentId == 0L) { + long newId = getLastInsertId(); + cd.getSetMethod().invoke(this, newId); + } + } + } catch (InvocationTargetException|IllegalAccessException|IllegalArgumentException e) { + throw new RuntimeException("Errore nel metodo retrieveAutoIncrementID()", e); + } + } + + public void setApFull(ApplParmFull newFieldApFull) { + this.apFull = newFieldApFull; + this.cp = null; + if (newFieldApFull != null && isDbTable()) + initBean(); + } + + public void setDataFineVld(Date newDataFineVld) { + this.dataFineVld = newDataFineVld; + } + + public void setDBState(int newDBState) { + this.DBState = newDBState; + } + + public void setLastUpdUser(Users user) { + this.lastUpdUser = user; + } + + private String prepareStringForDb(String value, boolean isCompressed) { + if (isCompressed) + return value; + int dbType = getApFull().getAp().getDbType(); + switch (dbType) { + case 3: + case 5: + case 17: + return prepareInputMySqlString(value, true); + case 13: + case 14: + return prepareInputMSSqlString(value, true); + } + return value; + } + + private void setPSByDataType(PreparedStatement ps, int dataType, int position, Object value) { + setPSByDataType(ps, dataType, position, value, false); + } + + private void setPSByDataType(PreparedStatement ps, int dataType, int position, Object value, boolean isCompressed) { + try { + boolean debug = false; + if (value == null) { + ps.setObject(position, null); + } else { + int dbType; + String val; + switch (dataType) { + case 6: + case 7: + ps.setFloat(position, ((Float)value).floatValue()); + break; + case -6: + case 5: + ps.setInt(position, ((Integer)value).intValue()); + break; + case 4: + ps.setLong(position, ((Long)value).longValue()); + break; + case -7: + ps.setBoolean(position, ((Boolean)value).booleanValue()); + break; + case 2: + case 3: + case 8: + ps.setDouble(position, ((Double)value).doubleValue()); + break; + case -16: + case -15: + case -9: + case -1: + case 1: + case 12: + case 1111: + if (isCompressed) { + ps.setString(position, (String)value); + break; + } + dbType = getApFull().getAp().getDbType(); + val = (String)value; + if (dbType == 3 || dbType == 5 || dbType == 17) { + ps.setString(position, prepareInputMySqlString(val, true)); + } else if (dbType == 13 || dbType == 14) { + ps.setString(position, prepareInputMSSqlString(val, true)); + } else { + ps.setString(position, val); + } + break; + case 91: + if (value instanceof Date) { + ps.setDate(position, (Date)value); + } else if (value instanceof Time) { + ps.setTime(position, (Time)value); + } else { + ps.setString(position, value.toString()); + } + break; + case 92: + if (value instanceof Date) { + ps.setDate(position, (Date)value); + } else if (value instanceof Time) { + ps.setTime(position, (Time)value); + } else if (value instanceof Timestamp) { + ps.setTimestamp(position, (Timestamp)value); + } else { + ps.setString(position, value.toString()); + } + break; + case 93: + printDebug(debug, "setPSByDataType: Setting TIMESTAMP at position " + position + " with value: " + String.valueOf(value)); + if (value instanceof Timestamp) { + ps.setTimestamp(position, (Timestamp)value); + } else if (value instanceof Date) { + ps.setTimestamp(position, new Timestamp(((Date)value).getTime())); + } else if (value instanceof java.util.Date) { + ps.setTimestamp(position, new Timestamp(((java.util.Date)value).getTime())); + } else if (value instanceof Time) { + ps.setTimestamp(position, new Timestamp(((Time)value).getTime())); + } else if (value instanceof String) { + String s = (String)value; + if (s.trim().isEmpty() || s.equalsIgnoreCase("null")) { + ps.setNull(position, 93); + break; + } + try { + Timestamp ts = Timestamp.valueOf(s.replace('T', ' ')); + ps.setTimestamp(position, ts); + } catch (IllegalArgumentException ex) { + printDebug(debug, "setPSByDataType: Setting TIMESTAMP at position " + position + " with value: " + String.valueOf(value) + " Formato timestamp non valido: " + s); + handleDebug("Formato timestamp non valido: " + s, 3); + ps.setNull(position, 93); + } + } else { + handleDebug("Tipo non gestito in TIMESTAMP: " + String.valueOf(value.getClass()), 3); + ps.setNull(position, 93); + } + break; + default: + ps.setObject(position, value); + break; + } + } + } catch (SQLException e) { + handleDebug("Errore durante il setPSByDataType: posizione=" + position + ", tipo=" + dataType + ", valore=" + String.valueOf(value), 2); + throw new RuntimeException("Errore nel setPSByDataType", e); + } + } + + private void setDateTimeParameter(PreparedStatement ps, int position, Object value) throws SQLException { + if (value instanceof Timestamp) { + ps.setTimestamp(position, (Timestamp)value); + } else if (value instanceof Time) { + ps.setTime(position, (Time)value); + } else if (value instanceof Date) { + ps.setDate(position, (Date)value); + } else { + ps.setString(position, value.toString()); + } + } + + protected String sqlStringDelete() { + return initSqlStringDbDelete.get(getClassName() + getClassName()); + } + + protected String sqlStringfindAll() { + return initSqlStringDbFindAll.get(getClassName() + getClassName()); + } + + protected String sqlStringfindByPrimaryKey() { + return initSqlStringDbFindPk.get(getApFull().getAp().getApCode(this)); + } + + protected String sqlStringInsert() { + return initSqlStringDbInsert.get(getClassName() + getClassName()); + } + + protected String sqlStringUpdate() { + return initSqlStringDbUpdate.get(getClassName() + getClassName()); + } + + private final synchronized void storeRegKeyFile() { + try { + String plainFile = "xcdfv"; + ObjectOutput out = new ObjectOutputStream(new FileOutputStream(plainFile)); + out.writeObject(getRegKey()); + out.close(); + new EcDc(plainFile, getLicFullFileName()).encodeFile(); + new File(plainFile).delete(); + } catch (Exception fe) { + handleDebug(fe); + } + } + + public ResParm update(String sqlString) { + ResParm rp = new ResParm(); + boolean forceRemove = false; + acquireConnection(); + try (PreparedStatement ps = getConn().prepareStatement(sqlString)) { + setSqlQuery(ps.toString()); + checkLic(); + int numUpd = ps.executeUpdate(); + if (numUpd == 0) { + rp.setStatus(true); + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "UPDATE_0")); + rp.setErrorCode(-1L); + handleDebug(rp.getMsg(), 3); + } else { + rp.setStatus(true); + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "SAVE_OK")); + handleDebug(rp.getMsg(), 5); + } + } catch (SQLException sqle) { + rp = gestisciSQLException(sqle); + forceRemove = !rp.isOk(); + getCpc().setTxFailed(true); + } catch (Exception e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + getCpc().setTxFailed(true); + } finally { + releaseConnection(null, null, forceRemove); + } + return rp; + } + + public ResParm update(PreparedStatement ps) { + setSqlQuery(ps.toString()); + ResParm rp = new ResParm(); + boolean forceRemove = false; + acquireConnection(); + try { + checkLic(); + int numUpd = ps.executeUpdate(); + if (numUpd == 0) { + rp.setStatus(true); + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "UPDATE_0")); + rp.setErrorCode(-1L); + handleDebug(rp.getMsg(), 3); + } else { + rp.setStatus(true); + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "SAVE_OK")); + handleDebug(rp.getMsg(), 5); + } + } catch (SQLException sqle) { + rp = gestisciSQLException(sqle); + forceRemove = !rp.isOk(); + getCpc().setTxFailed(true); + } catch (Exception e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + getCpc().setTxFailed(true); + } finally { + releaseConnection(null, ps, forceRemove); + } + return rp; + } + + protected boolean useNullFor0() { + return true; + } + + public final long getLastUpdId_user() { + return this.lastUpdId_user; + } + + public final Timestamp getLastUpdTmst() { + return this.lastUpdTmst; + } + + public final void setLastUpdId_user(long l) { + this.lastUpdId_user = l; + } + + public final void setLastUpdTmst(Timestamp timestamp) { + this.lastUpdTmst = timestamp; + } + + public Parm getParmDB(String theKey) { + if (getApFull() != null) { + Parm bean = new Parm(getApFull()); + bean.findByCodice(theKey); + if (bean.getDBState() == 1) + return bean; + if (theKey.equals("DEBUG")) { + bean.setCodice("DEBUG"); + bean.setTesto("false"); + bean.setNumero(1.0D); + } else if (theKey.equals("LOCALE")) { + bean.setCodice("LOCALE"); + bean.setTesto("it"); + } else { + int logLevel = 2; + handleDebug("DBAdapter.getParmDB(theKey): codice NON PRESENTE: " + theKey, logLevel); + } + return bean; + } + return new Parm(); + } + + public Parm getParm(String theKey) { + if (getApFull() != null) + return getApFull().getAp().getParm(theKey); + return new Parm(); + } + + public int getParmValue(String theKey, int defaultValue) { + if (getApFull() != null) + return getApFull().getParmValue(theKey, defaultValue); + return defaultValue; + } + + public long getParmValue(String theKey, long defaultValue) { + if (getApFull() != null) + return getApFull().getParmValue(theKey, defaultValue); + return defaultValue; + } + + public String getParmValue(String theKey, String defaultValue) { + if (getApFull() != null) + return getApFull().getParmValue(theKey, defaultValue); + return defaultValue; + } + + public double getParmValue(String theKey, double defaultValue) { + if (getApFull() != null) + return getApFull().getParmValue(theKey, defaultValue); + return defaultValue; + } + + public final boolean checkVersion(String theKey) { + String temp = "," + getVersionString(); + if (temp.indexOf("," + theKey) >= 0) + return true; + return false; + } + + private String getVersionString() { + if (isDebugging()) + return getParm("VERSION").getTesto(); + if (this.versionString == null) + this.versionString = getParm("VERSION").getTesto(); + return this.versionString; + } + + public boolean isDebugging() { + return this.debugging; + } + + public void setDebugging(boolean debugging) { + this.debugging = debugging; + } + + public Object clone() throws CloneNotSupportedException { + DBAdapter bean = (DBAdapter)super.clone(); + return bean; + } + + protected final String getLangField(String field, String lang) { + try { + if (lang == null || lang.isEmpty()) + lang = getApFull().getAp().getLocale().getLanguage(); + Method getMth = getClass().getMethod("get" + field.substring(0, 1).toUpperCase() + field.substring(1) + "_" + lang, null); + Object value = getMth.invoke(this, null); + return (String)value; + } catch (Exception e) { + handleDebug(e, 3); + return ""; + } + } + + public String getCurrentTab() { + return (this.currentTab == null) ? "" : this.currentTab; + } + + public void setCurrentTab(String currentTab) { + this.currentTab = currentTab; + } + + public it.acxent.util.SimpleDateFormat getDataFormat() { + return getApFull().getAp().getDataFormat(); + } + + public it.acxent.util.SimpleDateFormat getTimeFormat() { + return getApFull().getAp().getTimeFormat(); + } + + public boolean isLocalhost() { + return getApFull().getParm("IS_LOCALHOST").isTrue(); + } + + public ApplParmFull getApFull() { + return this.apFull; + } + + protected long checkProfile(String l_permesso) { + return 4L; + } + + public String translate(String sentence, String l_lang) { + if (getApFull() != null) + return getApFull().getAp().translate(sentence, l_lang); + return ".." + sentence + ".."; + } + + public String getImgFileName(int imgNumber) { + return getImgFileName(imgNumber, getImgTmst()); + } + + public String getImgFileName(long imgNumber) { + return getImgFileName((int)imgNumber); + } + + public String getImgFileName(int imgNumber, String oldTmst) { + try { + return "" + getPkValue() + "_" + getPkValue() + "_" + oldTmst + ".jpg"; + } catch (Exception e) { + handleDebug(e); + return "ERROREIMGFILENAME"; + } + } + + public String getImgTmst() { + return (this.imgTmst == null) ? "" : this.imgTmst; + } + + public static final String getAccessType(long l_flgRw) { + switch ((int)l_flgRw) { + case 0: + return "Nessuno"; + case 1: + return "Lettura"; + case 2: + return "Lettura/Modifica"; + case 3: + return "Lettura/Scrittura"; + case 4: + return "Lettura/Scrittura/Cancellazione"; + } + return "??"; + } + + public static final String getRW(long l_flgRw) { + switch ((int)l_flgRw) { + case 0: + return "N"; + case 1: + return "R"; + case 2: + return "RM"; + case 3: + return "RW"; + case 4: + return "RWD"; + } + return "??"; + } + + public static final void copyDir(String sourceDir, String targetDir) throws IOException { + File inputDir = new File(sourceDir); + if (inputDir.exists() && inputDir.isDirectory()) { + File[] dirList = inputDir.listFiles(); + for (File element : dirList) { + if (element.isDirectory()) { + copyDir(element.getAbsolutePath(), targetDir + "/" + targetDir); + } else { + File dirTarget = new File(targetDir); + if (!dirTarget.exists()) + dirTarget.mkdirs(); + copyFile(element.getAbsolutePath(), targetDir + "/" + targetDir); + } + } + } + } + + public static final boolean mkDirs(String pathOrFile) { + boolean debug = false; + File f = new File(pathOrFile); + File targetDir = f.isDirectory() ? f : f.getParentFile(); + if (targetDir == null) { + printDebug(debug, "mkDirs: impossibile determinare la directory padre -> " + pathOrFile); + return false; + } + if (targetDir.exists()) { + if (targetDir.isDirectory()) + return true; + printDebug(debug, "mkDirs: esiste un file con lo stesso nome -> " + String.valueOf(targetDir)); + return false; + } + boolean created = targetDir.mkdirs(); + if (!created) + printDebug(debug, "mkDirs: impossibile creare la directory -> " + String.valueOf(targetDir)); + return created; + } + + public static final String getVersion() { + String temp = getVersionLog(); + try { + return temp.substring(0, temp.indexOf("\n")); + } catch (Exception e) { + return "getVersion error"; + } + } + + public final String getVersionHtml() { + String temp = getVersionHtmlLog(); + if (temp.indexOf("\n") >= 0) + return temp.substring(0, temp.indexOf("\n")); + return ""; + } + + public final String getVersionDB() { + try { + Parm parm = new Parm(getApFull()); + return parm.getDbVersions(); + } catch (Exception e) { + return "NO DB SET"; + } + } + + public final String getVersionDBLte() { + try { + Parm parm = new Parm(getApFull()); + return parm.getDbVersionsLte(); + } catch (Exception e) { + return "NO DB SET"; + } + } + + public final String getVersionLibLte() { + try { + Parm parm = new Parm(getApFull()); + return parm.getLibVersionsLte(); + } catch (Exception e) { + return "NO DB SET"; + } + } + + public final String getVersionLib() { + try { + Parm parm = new Parm(getApFull()); + return parm.getLibVersions(); + } catch (Exception e) { + return "NO DB SET"; + } + } + + public static String numberToString(double numeroD, boolean sempreDecimali) { + long numero = (long)numeroD; + DoubleOperator nd = new DoubleOperator(numeroD); + nd.subtract(numero); + nd.multiply(100); + long decimali = (long)nd.getResult(); + if (numero == 0L) + return "Zero"; + String[] cifra = new String[29]; + cifra[1] = ""; + cifra[2] = "uno"; + cifra[3] = "due"; + cifra[4] = "tre"; + cifra[5] = "quattro"; + cifra[6] = "cinque"; + cifra[7] = "sei"; + cifra[8] = "sette"; + cifra[9] = "otto"; + cifra[10] = "nove"; + cifra[11] = "dieci"; + cifra[12] = "undici"; + cifra[13] = "dodici"; + cifra[14] = "tredici"; + cifra[15] = "quattordici"; + cifra[16] = "quindici"; + cifra[17] = "sedici"; + cifra[18] = "diciassette"; + cifra[19] = "diciotto"; + cifra[20] = "diciannove"; + cifra[21] = "venti"; + cifra[22] = "trenta"; + cifra[23] = "quaranta"; + cifra[24] = "cinquanta"; + cifra[25] = "sessanta"; + cifra[26] = "settanta"; + cifra[27] = "ottanta"; + cifra[28] = "novanta"; + StringBuilder inLettere = new StringBuilder(); + for (int esp = 3; esp >= 0; esp--) { + double temp = (double)numero / Math.pow(1000.0D, (double)esp); + int fraz1 = (int)temp; + if (fraz1 > 0) { + int fraz2 = fraz1; + if (fraz2 > 99) { + int fraz3 = fraz2 / 100; + fraz2 -= fraz3 * 100; + inLettere.append((fraz3 == 1) ? "cento" : (cifra[fraz3 + 1] + "cento")); + } + if (fraz2 <= 20) { + inLettere.append(cifra[fraz2 + 1]); + } else { + int fraz3 = fraz2 / 10; + inLettere.append(cifra[fraz3 + 19]); + fraz2 -= fraz3 * 10; + if (fraz2 == 1 || fraz2 == 8) + inLettere.setLength(inLettere.length() - 1); + inLettere.append(cifra[fraz2 + 1]); + } + switch (esp) { + case 1: + if (fraz1 == 1) { + inLettere.setLength(inLettere.length() - 3); + inLettere.append("mille"); + } else { + inLettere.append("mila"); + } + break; + case 2: + inLettere.append((fraz1 == 1) ? "unmilione" : "milioni"); + break; + case 3: + inLettere.append((fraz1 == 1) ? "unmiliardo" : "miliardi"); + break; + } + numero -= (long)fraz1 * (long)Math.pow(1000.0D, (double)esp); + } + } + if (decimali == 0L) + return sempreDecimali ? (String.valueOf(inLettere) + "/00") : inLettere.toString(); + return String.valueOf(inLettere) + "/" + String.valueOf(inLettere); + } + + public static final ResParm createFileFromByteArray(ByteArrayOutputStream ba, String fileName) { + ResParm rp = new ResParm(true); + try { + FileOutputStream fos = new FileOutputStream(new File(fileName)); + fos.write(ba.toByteArray()); + fos.close(); + } catch (Exception e) { + e.printStackTrace(); + rp.setStatus(false); + rp.setMsg(e); + } + return rp; + } + + public static final ResParm createFileFromByteArray(byte[] ba, String fileName) { + ResParm rp = new ResParm(true); + try { + FileOutputStream fos = new FileOutputStream(new File(fileName)); + fos.write(ba); + fos.close(); + } catch (Exception e) { + e.printStackTrace(); + rp.setStatus(false); + rp.setMsg(e); + } + return rp; + } + + public static final ByteArrayOutputStream getByteArrayFromFile(String fileName) { + ByteArrayOutputStream ba = new ByteArrayOutputStream(); + try { + File myFile = new File(fileName); + FileInputStream inputFile = new FileInputStream(myFile); + int bytes = (int)myFile.length(); + byte[] buffer = new byte[bytes]; + bytes = inputFile.read(buffer); + while (bytes != -1) { + ba.write(buffer, 0, bytes); + bytes = inputFile.read(buffer); + } + inputFile.close(); + return ba; + } catch (Exception e) { + e.printStackTrace(); + return ba; + } + } + + public static final String getBase64StringFromFile(String fileName) { + return ""; + } + + public void setImgTmst(String imgTmst) { + this.imgTmst = imgTmst; + } + + @Deprecated + protected int getStringValueCaseOLD(String l_columnName) { + return 0; + } + + protected int getStringValueCase(String l_columnName) { + if (l_columnName.toLowerCase().contains("email")) + return 0; + int l_stringCaseValue = 0; + Hashtable columnDescriptorHT = initTableDescriptorDb.get(getApFull().getAp().getApCode(this)); + if (columnDescriptorHT.containsKey(l_columnName)) + l_stringCaseValue = columnDescriptorHT.get(l_columnName).getStringCaseValue(); + return l_stringCaseValue; + } + + protected EncodedField getEncodedStatus(String l_columnName) { + Hashtable columnDescriptorHT = initTableDescriptorDb.get(getApFull().getAp().getApCode(this)); + if (columnDescriptorHT.containsKey(l_columnName)) + return columnDescriptorHT.get(l_columnName).getEncodedField(); + return new EncodedField(); + } + + public String getPathTmp() { + if (getApFull() == null) + return ""; + return getApFull().getAp().getResource("PATH_TMP"); + } + + public String getPathTmpFull() { + String temp = getDocBase() + getDocBase(); + checkAndMakeDir(temp); + return temp; + } + + public static final boolean checkAndMakeDir(String targetDir) { + File fileDir = new File(targetDir); + if (fileDir.exists()) + return true; + return fileDir.mkdirs(); + } + + protected String getMailBcc() { + if (!getParm("BCC").getTesto().isEmpty()) + return getParm("BCC").getTesto(); + return ""; + } + + protected String getMailToTest() { + if (!getParm("TO_TEST").getTesto().isEmpty()) + return getParm("TO_TEST").getTesto(); + return ""; + } + + protected String getLangPrimary() { + if (getParm("LANG_PRI_SEC_ENABLE").isTrue()) { + if (!getParm("LANG_PRIMARY").getTesto().isEmpty()) + return getParm("LANG_PRIMARY").getTesto(); + return ""; + } + return ""; + } + + protected String getLangSecondary() { + if (getParm("LANG_PRI_SEC_ENABLE").isTrue()) { + if (!getParm("LANG_SECONARY").getTesto().isEmpty()) + return getParm("LANG_SECONARY").getTesto(); + return ""; + } + return ""; + } + + protected String getMailCc() { + if (!getParm("CC").getTesto().isEmpty()) + return getParm("CC").getTesto(); + return ""; + } + + protected String getMailFrom() { + if (!getParm("FROM").getTesto().isEmpty()) + return getParm("FROM").getTesto(); + return ""; + } + + protected String getMailSMTPServer() { + if (!getParm("SMTP").getTesto().isEmpty()) + return getParm("SMTP").getTesto(); + return ""; + } + + protected String getMailSubject() { + if (!getParm("SUBJECT").getTesto().isEmpty()) + return getParm("SUBJECT").getTesto(); + return ""; + } + + protected String getMailTo() { + if (!getParm("TO").getTesto().isEmpty()) + return getParm("TO").getTesto(); + return ""; + } + + protected String getMailToSfx(String _suffix) { + String newParmKey = "TO_" + _suffix.toUpperCase(); + if (!getParm(newParmKey).getTesto().isEmpty()) + return getParm(newParmKey).getTesto(); + return ""; + } + + protected boolean useNullForString() { + return true; + } + + public String getReqIpAddress() { + return (this.reqIpAddress == null) ? "" : this.reqIpAddress; + } + + public static final String getETA(long startTmst, long currentTmst, long totRecord, long currentRecord) { + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + SimpleDateFormat dfMS = new SimpleDateFormat("HH:mm:ss "); + long durataPevista = (currentTmst - startTmst) * totRecord / currentRecord; + long etaFinale = durataPevista + startTmst; + long tempoRimanente = durataPevista - currentTmst + startTmst; + String temp = "Start: " + df.format((java.util.Date)new Date(startTmst)) + " current: " + df.format((java.util.Date)new Date(currentTmst)) + " elab:" + + dfMS.format((java.util.Date)new Time(currentTmst - startTmst - 3600000L)) + " ETA: " + dfMS.format((java.util.Date)new Time(tempoRimanente - 3600000L)) + " (" + + df.format((java.util.Date)new Date(etaFinale)) + ")"; + return temp; + } + + @Deprecated + public static final String prepareMySqlStringGPT(String sqlString, boolean convertPerc) { + if (sqlString == null) + return null; + sqlString = sqlString.replace("\\", "\\\\"); + if (convertPerc) + sqlString = sqlString.replace("%", "\\%"); + sqlString = sqlString.replace("'", "\\'"); + return sqlString; + } + + @Deprecated + public static final String XXXprepareMySqlQueryStringGPT(String sqlString, boolean isLike) { + if (sqlString == null) + return null; + sqlString = sqlString.replace('’', '\'').replace('‘', '\'').replace('`', '\'').replace('´', '\'').replace('“', '"').replace('”', '"'); + if (isLike) + sqlString = sqlString.replace("\\", "\\\\").replace("%", "\\%").replace("_", "\\_"); + if (sqlString.contains("\\")) { + sqlString = sqlString.replace("\\", "\\\\\\\\"); + sqlString = sqlString.replace("'", "''"); + } else { + sqlString = sqlString.replace("'", "%''"); + } + return sqlString; + } + + @Deprecated + private static String XXXXXinternalPrepareMySqlString(String sqlString, boolean escapeLikeChars, boolean normalizeSmartQuotes) { + if (sqlString == null) + return null; + if (normalizeSmartQuotes) + sqlString = sqlString.replace('’', '\'').replace('‘', '\'').replace('`', '\'').replace('´', '\'').replace('“', '"').replace('”', '"'); + if (escapeLikeChars) { + sqlString = sqlString.replace("\\", "\\\\\\\\").replace("%", "\\%").replace("_", "\\_"); + } else { + sqlString = sqlString.replace("\\", "\\\\"); + } + sqlString = sqlString.replace("'", "\\'"); + return sqlString; + } + + public static final String readMySqlString(String sqlString, boolean convertPerc) { + sqlString = sqlString.replace("\\\\", "\\"); + if (convertPerc) + sqlString = sqlString.replace("\\%", "%"); + sqlString = sqlString.replace("\\'", "'"); + return sqlString; + } + + public static String convertTo1stCap(String theString) { + if (theString == null || theString.isEmpty()) + return ""; + StringBuffer sb = new StringBuffer(); + StringTokenizer st = new StringTokenizer(theString, " "); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + if (token.length() > 1) { + if (token.indexOf("'") > 0) { + StringTokenizer st2 = new StringTokenizer(token, "'"); + while (st2.hasMoreTokens()) { + String token2 = st2.nextToken(); + if (token2.length() > 1) { + sb.append(token2.substring(0, 1).toUpperCase()); + sb.append(token2.substring(1, token2.length()).toLowerCase()); + if (st2.hasMoreTokens()) + sb.append("'"); + continue; + } + sb.append(token2.toUpperCase()); + if (st2.hasMoreTokens()) + sb.append("'"); + } + } else { + sb.append(token.substring(0, 1).toUpperCase()); + sb.append(token.substring(1, token.length()).toLowerCase()); + } + } else { + sb.append(token.toUpperCase()); + } + if (st.hasMoreTokens()) + sb.append(" "); + } + if (theString.endsWith("'")) + sb.append("'"); + return sb.toString(); + } + + public static Date getToday() { + Calendar cal = Calendar.getInstance(); + Date date = new Date(cal.getTime().getTime()); + return date; + } + + public static Date getToday(int days) { + Calendar cal = Calendar.getInstance(); + if (days != 0) + cal.add(6, days); + Date date = new Date(cal.getTime().getTime()); + return date; + } + + public static int getCurrentYear() { + Calendar cal = Calendar.getInstance(); + return cal.get(1); + } + + public static final String convertMinToHourMin(double min) { + return convertMinToHourMin((long)min); + } + + public static final String secToHourMinSec(long sec) { + int h = (int)(sec / 3600L); + int m = (int)((sec - (long)(h * 3600)) / 60L); + int s = (int)(sec - (long)(h * 3600) - (long)(m * 60)); + return "" + h + ":" + h + ":" + m; + } + + public static final String decodeUrl(String theUrl) { + String temp = EcDc.decodeIntKey(theUrl, 7); + try { + return temp; + } catch (Exception e) { + return ""; + } + } + + public static final String encodeUrl(String theUrl) { + try { + return URLEncoder.encode(EcDc.encodeIntKey(String.valueOf(theUrl), 7), "ISO-8859-1"); + } catch (Exception e) { + return "Error! Encode Exception"; + } + } + + public static final String spaceLeft(long longValue, int len) { + return spaceLeft(String.valueOf(longValue), len); + } + + public static final String spaceLeft(String source, int len) { + if (len <= source.length()) + return source.substring(0, len); + return String.format("%" + len - source.length() + "s", "") + String.format("%" + len - source.length() + "s", ""); + } + + public static final String charLeft(String source, int len, String l_char) { + if (len <= source.length()) + return source.substring(0, len); + return String.format("%" + len - source.length() + "s", "").replace(" ", l_char) + String.format("%" + len - source.length() + "s", "").replace(" ", l_char); + } + + public static final String spaceRight(long longValue, int len) { + return spaceRight(String.valueOf(longValue), len); + } + + public static final String spaceRight(String source, int len) { + if (len <= source.length()) + return source.substring(0, len); + return source + source; + } + + public static final String charRight(String source, int len, String l_char) { + if (len <= source.length()) + return source.substring(0, len); + return source + source; + } + + public static final String zeroLeft(double doubleValue, int len) { + return zeroLeft(String.valueOf(doubleValue), len); + } + + public static final String zeroLeft(long longValue, int len) { + return zeroLeft(String.valueOf(longValue), len); + } + + public static final String zeroLeft(String source, int len) { + if (len <= source.length()) + return source.substring(0, len); + return String.format("%" + len - source.length() + "s", "").replace(' ', '0') + String.format("%" + len - source.length() + "s", "").replace(' ', '0'); + } + + public void setReqIpAddress(String reqIpAddress) { + this.reqIpAddress = reqIpAddress; + } + + protected String getDocLogoPath() { + return getParm("LOGO_DOCS").getTesto(); + } + + protected String getDocLogoAlternativoPath() { + return getParm("LOGO_DOCS_ALTERNATIVO").getTesto(); + } + + protected float getDocLogoWidth() { + return getParm("LOGO_DOCS_W").getNumeroFloat(); + } + + protected float getDocLogoHeight() { + return getParm("LOGO_DOCS_H").getNumeroFloat(); + } + + public String getImgTmst(int imgNumber) { + StringTokenizer temp = new StringTokenizer(getImgTmst(), ","); + if (temp.countToken() >= imgNumber) + return temp.getToken(imgNumber); + return ""; + } + + public String getDescRecord() { + if (getApFull() != null) { + StringBuffer sb = new StringBuffer(); + sb.append("\n"); + sb.append("---------------------------"); + sb.append("BEAN DESCRIPTION"); + sb.append("---------------------------"); + sb.append("\n"); + sb.append(getTableBeanName()); + sb.append("\n"); + try { + sb.append("PK: "); + LinkedHashMap primaryKeyDescriptors = initTableDescriptorDbPk.get(getApFull().getAp().getApCode(this)); + if (primaryKeyDescriptors != null) { + Iterator pkIterator = primaryKeyDescriptors.values().iterator(); + while (pkIterator.hasNext()) { + ColumnDescriptor cd = pkIterator.next(); + sb.append(cd.getColumnName()); + sb.append(":"); + sb.append(String.valueOf(cd.getGetMethod().invoke(this, null))); + if (pkIterator.hasNext()) + sb.append("-"); + } + } else { + sb.append("ERROR! primaryKeyDescriptors null!!"); + } + sb.append("\n"); + Hashtable columneDescriptor = initTableDescriptorDb.get(getApFull().getAp().getApCode(this)); + if (columneDescriptor != null) { + Enumeration enu = columneDescriptor.elements(); + while (enu.hasMoreElements()) { + ColumnDescriptor cd = enu.nextElement(); + sb.append(cd.getColumnName()); + sb.append(": "); + sb.append(String.valueOf(cd.getGetMethod().invoke(this, null))); + if (enu.hasMoreElements()) + sb.append("\n"); + } + } else { + sb.append("ERROR! columneDescriptor null!!"); + } + } catch (Exception e) { + sb.append("\nErrore! \n"); + sb.append(e.getMessage()); + } + sb.append("\n"); + sb.append("---------------------------"); + sb.append("REQUEST URL"); + sb.append("---------------------------"); + sb.append("\n"); + sb.append(getApFull().getReqUrl()); + sb.append("\n"); + sb.append("REQUEST IP: "); + sb.append(getApFull().getReqIpAddress()); + sb.append("\n"); + if (getSqlQuery() != null) { + sb.append("---------------------------"); + sb.append("SQL QUERY"); + sb.append("---------------------------"); + sb.append("\n"); + sb.append(": "); + sb.append(getSqlQuery()); + sb.append("\n"); + } + return sb.toString().trim(); + } + return "--"; + } + + public String getPathLogoDocumenti() { + return getParm("LOGO_DOCS").getTesto(); + } + + public static final Color getColorFromHex(String hexString) { + Color color; + if (hexString.isEmpty()) { + color = new Color(0, 0, 0); + } else { + int r = Integer.parseInt(hexString.substring(1, 3), 16); + int g = Integer.parseInt(hexString.substring(3, 5), 16); + int b = Integer.parseInt(hexString.substring(5, 7), 16); + color = new Color(r, g, b); + } + return color; + } + + public static void resetUsedConnections() { + if (initTableDescriptorDb != null); + AbMessages.resetMessages(); + ApplParm.resetHashtable(); + System.gc(); + } + + public static Time getNow() { + Calendar cal = Calendar.getInstance(); + Time time = new Time(cal.getTime().getTime()); + return time; + } + + public static Timestamp getNowTs() { + Calendar cal = Calendar.getInstance(); + Timestamp time = new Timestamp(cal.getTime().getTime()); + return time; + } + + public static String getNowTsB() { + return getNowTs().toString() + " "; + } + + public long getPrtCommand() { + return this.prtCommand; + } + + public void setPrtCommand(long prtCommand) { + this.prtCommand = prtCommand; + } + + public boolean isEmpty() { + if (getDBState() == 0) + return true; + return false; + } + + public NumberFormat getNf1() { + return getApFull().getAp().getNf1(); + } + + public NumberFormat getNf3() { + return getApFull().getAp().getNf3(); + } + + public NumberFormat getNf4() { + return getApFull().getAp().getNf4(); + } + + public NumberFormat getNf5() { + return getApFull().getAp().getNf5(); + } + + protected boolean isLogUserDeletes() { + return (getParm("LOG_USERS_DELETES").getNumero() == 1.0D); + } + + protected boolean isLogUserUpdates() { + return (getParm("LOG_USERS_UPDATES").getNumero() == 1.0D); + } + + protected void afterDelete() {} + + protected ResParm sendMailMessage(MailProperties prop) throws Exception { + MailMessage mm = new MailMessage(getApFull()); + if (prop.getProperty("ID_USERS") == null) + prop.setProperty("ID_USERS", String.valueOf(getApFull().getLastUpdId_user())); + ResParm rp = mm.sendMailMessage(prop, true); + return rp; + } + + public String getScaledImageName(String imgName, String scaledPrefix, int scaledWidth, int scaledHeight, int scaledFactor, int rotateDegree, boolean checkScaled, boolean useTimestamp) { + ScaleImage si; + String fullImgName = getDocBase() + getDocBase(); + if (rotateDegree == 0) { + si = new ScaleImage(fullImgName, scaledPrefix, (long)scaledFactor, scaledWidth, scaledHeight, checkScaled, false); + } else { + si = new ScaleImage(fullImgName, scaledPrefix, (long)scaledFactor, scaledWidth, scaledHeight, rotateDegree, checkScaled, false); + } + ResParm rp = si.scaleIt(); + if (rp.getStatus()) { + String temp = si.getTheScaledImageName(); + return temp.substring(getDocBase().length()); + } + return null; + } + + public String getScaledImageName(String imgName, String scaledPrefix, int scaledWidth, int scaledHeight, boolean useTimestamp) { + return getScaledImageName(imgName, scaledPrefix, scaledWidth, scaledHeight, 0, 0, false, useTimestamp); + } + + public static File xmlToHtml(String xmlFile, String xlsFile, String resultFile) throws TransformerException, DocumentException, IOException { + File res = new File(resultFile); + TransformerFactory tFactory = TransformerFactory.newInstance(); + Transformer transformer = tFactory.newTransformer(new StreamSource(xlsFile)); + transformer.transform(new StreamSource(xmlFile), new StreamResult(new FileOutputStream(resultFile))); + String url = new File(resultFile).toURI().toURL().toString(); + System.out.println(url); + return res; + } + + protected static final String convertStringCase(String l_string, int stringCaseType) { + String temp = l_string; + switch (stringCaseType) { + case 1: + if (temp != null) { + temp = temp.toUpperCase(); + temp = temp.replaceAll("&EURO;", "€"); + } + break; + case 2: + if (temp != null) + temp = temp.toLowerCase(); + break; + case 3: + if (temp != null) + temp = convertTo1stCap(temp); + break; + } + return temp; + } + + public static final void copyFile(String sourceFile, String targetFile) { + Path sourcePath = Paths.get(sourceFile); + Path targetPath = Paths.get(targetFile); + try { + Files.copy(sourcePath, targetPath, StandardCopyOption.REPLACE_EXISTING); + } catch (IOException e) { + e.printStackTrace(System.out); + } + } + + public static final void moveFile(String sourceFile, String targetFile) { + Path sourcePath = Paths.get(sourceFile); + Path targetPath = Paths.get(targetFile); + try { + Files.move(sourcePath, targetPath, StandardCopyOption.REPLACE_EXISTING); + } catch (IOException e) { + e.printStackTrace(System.out); + } + } + + protected static float getPdfPointSize(long l_mm) { + DoubleOperator dop = new DoubleOperator((float)l_mm); + dop.divide(25.4D); + dop.multiply(72); + dop.setScale(6, 5); + return (float)dop.getResult(); + } + + public static final String zeroLeft(int intValue, int len) { + return zeroLeft(String.valueOf(intValue), len); + } + + public static boolean zipDir(File directory, String zipfile, boolean saveOriginalPath) { + boolean ok = true; + System.out.println("ZipDir: start zipping: " + directory.getName()); + if (directory.isDirectory()) { + URI base = directory.toURI(); + Deque queue = new LinkedList<>(); + queue.push(directory); + OutputStream out = null; + ZipOutputStream zout = null; + try { + out = new FileOutputStream(zipfile); + zout = new ZipOutputStream(out); + while (!queue.isEmpty()) { + directory = queue.pop(); + for (File kid : directory.listFiles()) { + String name = base.relativize(kid.toURI()).getPath(); + if (kid.isDirectory()) { + queue.push(kid); + name = name.endsWith("/") ? name : (name + "/"); + zout.putNextEntry(new ZipEntry(name)); + } else { + zout.putNextEntry(new ZipEntry(name)); + System.out.println("ZipDir: adding file" + kid.getCanonicalPath()); + InputStream in = new FileInputStream(kid); + try { + byte[] buffer = new byte[1024]; + while (true) { + int readCount = in.read(buffer); + if (readCount < 0) + break; + zout.write(buffer, 0, readCount); + } + } finally { + in.close(); + } + zout.closeEntry(); + } + } + } + } catch (Exception e) { + ok = false; + e.printStackTrace(); + } finally { + try { + if (zout != null) + zout.close(); + } catch (Exception e2) { + ok = false; + e2.printStackTrace(); + } + } + } + if (ok) { + System.out.println("ZipDir: " + directory.getName()); + } else { + System.out.println("ZipDir: Error zipping " + directory.getName() + " on file " + zipfile); + } + return ok; + } + + public static final String deCrypt(String l_id_ordineCript) { + String temp = EcDc.decodeIntKey(l_id_ordineCript, 7); + return temp; + } + + public static final String crypt(String l_id) { + try { + return EcDc.encodeIntKey(l_id, 7); + } catch (Exception e) { + return "Error! Encode Exception"; + } + } + + public static Time getMidDay() { + int hour = 14; + int min = 0; + int sec = 0; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + + public static Time getMidnight() { + int hour = 23; + int min = 59; + int sec = 59; + return new Time((long)((hour - 1) * 3600000 + min * 60000 + sec * 1000)); + } + + public static boolean deleteDir(File dir) { + boolean ok = true; + if (dir.isDirectory()) { + String[] children = dir.list(); + if (children.length > 0) { + int i = 0; + while (ok && i < children.length) { + ok = deleteDir(new File(dir, children[i])); + i++; + } + } + } + if (ok) { + System.out.println("deleteDir; cancello " + dir.getName()); + return dir.delete(); + } + return ok; + } + + public static boolean unzipAndrea(String zipFile) { + System.out.println("unzipping " + zipFile); + try { + int BUFFER = 2048; + File file = new File(zipFile); + FileInputStream fis = new FileInputStream(file); + ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis)); + String newPath = zipFile.substring(0, zipFile.length() - 4); + new File(newPath).mkdir(); + ZipEntry entry; + while ((entry = zis.getNextEntry()) != null) { + String currentEntry = entry.getName(); + File destFile = new File(newPath, currentEntry); + destFile = new File(newPath, destFile.getName()); + File destinationParent = destFile.getParentFile(); + destinationParent.mkdirs(); + if (!entry.isDirectory()) { + byte[] data = new byte[BUFFER]; + FileOutputStream fos = new FileOutputStream(destFile); + BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER); + int currentByte; + while ((currentByte = zis.read(data, 0, BUFFER)) != -1) + dest.write(data, 0, currentByte); + dest.flush(); + dest.close(); + fos.close(); + } + if (currentEntry.endsWith(".zip")) + unzip(destFile.getAbsolutePath()); + } + zis.close(); + fis.close(); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + private DescTxtLangKey getDescTxtLangKey(String campo, String lang) { + if (getDBState() == 1) + return new DescTxtLangKey(getTableBeanName(), getPkValue(), campo, lang); + return new DescTxtLangKey(); + } + + private long getPkValue() { + long pkValue = 0L; + ColumnDescriptor cd = getPrimaryKeyDescriptor(); + if (cd != null) + try { + if (cd.getDataType() == 4) { + pkValue = (Long)cd.getGetMethod().invoke(this, null); + } else { + handleDebug("getPkValue: La chiave primaria non è di tipo long (Types.INTEGER).", 3); + } + } catch (Exception e) { + handleDebug(e); + } + return pkValue; + } + + public void setDescTxtLang(String campo_lang, String value) { + if (campo_lang.indexOf("_") > 0) { + String campo = campo_lang.substring(0, campo_lang.indexOf("_")); + String lang = campo_lang.substring(campo_lang.indexOf("_") + 1); + setDescTxtLang(campo, lang, value); + } + } + + public boolean useDescLangTables() { + return false; + } + + public Vector getDescTxtLangValues() { + if (this.descTxtLangValues == null) + this.descTxtLangValues = new Vector<>(); + return this.descTxtLangValues; + } + + public void setDescTxtLangValues(Vector descTxtLangValues) { + this.descTxtLangValues = descTxtLangValues; + } + + public String getDescTxtLang(String campo, String lang) { + if (getApFull() != null) { + DescTxtLang dtl = new DescTxtLang(getApFull()); + dtl.findByPrimaryKey(getDescTxtLangKey(campo, lang)); + return dtl.getDescrizione().trim(); + } + return ""; + } + + public String getDescTxtLangScript(String campo_lang) { + if (campo_lang.indexOf("_") > 0) { + String campo = campo_lang.substring(0, campo_lang.indexOf("_")); + String lang = campo_lang.substring(campo_lang.indexOf("_") + 1); + return getDescTxtLangScript(campo, lang); + } + return ""; + } + + public String getDescTxtLangScript(String campo, String lang) { + if (getApFull() != null) { + DescTxtLang dtl = new DescTxtLang(getApFull()); + dtl.findByPrimaryKey(getDescTxtLangKey(campo, lang)); + return dtl.getDescrizioneScript(); + } + return ""; + } + + public String getCurrentLang() { + return (this.currentLang == null) ? "it" : this.currentLang.trim(); + } + + public void setCurrentLang(String currentLang) { + this.currentLang = currentLang; + } + + public void setDescTxtLang(String campo, String lang, String value) { + getDescTxtLangValues().add(new DescLangItem(campo, lang, value)); + } + + public String getLogRecord() { + return (this.logRecord == null) ? "" : this.logRecord.trim(); + } + + public void setLogRecord(String logRecord) { + this.logRecord = logRecord; + } + + public it.acxent.util.SimpleDateFormat getTimestampFormat() { + return getApFull().getAp().getTimestampFormat(); + } + + public it.acxent.util.SimpleDateFormat getTimestampFormatForFiles() { + return getApFull().getAp().getTimestampFormatForFiles(); + } + + public String getDescTxtLang(String campo_lang) { + if (campo_lang.indexOf("_") > 0) { + String campo = campo_lang.substring(0, campo_lang.indexOf("_")); + String lang = campo_lang.substring(campo_lang.indexOf("_") + 1); + return getDescTxtLang(campo, lang); + } + return ""; + } + + public String getDescTxtAllLang(String campo) { + StringBuilder sb = new StringBuilder(); + Vectumerator vec = Lang.findAllLangAvailable(getApFull()); + while (vec.hasMoreElements()) { + Lang row = vec.nextElement(); + sb.append(row.getLang()); + sb.append(": "); + sb.append(getDescTxtLang(campo, row.getLang())); + if (vec.hasMoreElements()) + sb.append("\n"); + } + return sb.toString(); + } + + public String getDescTxtAllLangScript(String campo) { + return convertStringToHtml(getDescTxtAllLang(campo)); + } + + @Deprecated + protected void fillFieldsGPT(ResultSet rst) { + boolean debug = false; + Object[] columnValue = new Object[1]; + Hashtable columnDescriptor = initTableDescriptorDb.get(getApFull().getAp().getApCode(this)); + Enumeration enu = columnDescriptor.elements(); + while (enu.hasMoreElements()) { + ColumnDescriptor cd = enu.nextElement(); + short dataType = cd.getDataType(); + String columnName = cd.getColumnName(); + if (debug) + if (columnName.equals("id_users")) + System.out.println(columnName); + try { + String temp; + switch (dataType) { + case 6: + case 7: + columnValue[0] = new Float(rst.getFloat(columnName)); + break; + case -6: + case 5: + columnValue[0] = new Integer(rst.getInt(columnName)); + break; + case 4: + columnValue[0] = new Long(rst.getLong(columnName)); + break; + case -7: + columnValue[0] = new Boolean(rst.getBoolean(columnName)); + break; + case 2: + case 3: + case 8: + columnValue[0] = new Double(rst.getDouble(columnName)); + break; + case -16: + case -15: + case -9: + case -1: + case 1: + case 12: + temp = null; + if (cd.isCompressedText()) { + try { + temp = decompressText(rst.getString(columnName)); + } catch (Exception e) { + temp = rst.getString(columnName); + } + } else { + switch (cd.getStringCaseValue()) { + case 0: + temp = rst.getString(columnName); + break; + case 1: + temp = rst.getString(columnName); + if (temp != null) { + temp = temp.toUpperCase(); + temp = temp.replaceAll("&EURO;", "€"); + } + break; + case 2: + temp = rst.getString(columnName); + if (temp != null) + temp = temp.toLowerCase(); + break; + case 3: + temp = rst.getString(columnName); + if (temp != null) + temp = convertTo1stCap(temp); + break; + default: + temp = rst.getString(columnName); + break; + } + } + if (temp != null) + if (getApFull().getAp().getDbType() == 3 || + getApFull().getAp().getDbType() == 5 || + getApFull().getAp().getDbType() == 17) { + if (!cd.isCompressedText()) + temp = readMySqlString(temp, true); + } else if ((getApFull().getAp().getDbType() == 13 || + getApFull().getAp().getDbType() == 14) && + !cd.isCompressedText()) { + temp = readMSSqlString(temp, true); + } + columnValue[0] = temp; + break; + case 91: + columnValue[0] = rst.getDate(columnName); + break; + case 92: + columnValue[0] = rst.getTime(columnName); + break; + case 93: + columnValue[0] = rst.getTimestamp(columnName); + break; + default: + columnValue[0] = null; + break; + } + if (columnName.equals("lastUpdTmst") && columnValue[0] == null) + columnValue[0] = new Timestamp(3600L); + if (debug) + System.out.println("fillfields: " + columnName + " " + String.valueOf(columnValue)); + cd.getSetMethod().invoke(this, columnValue); + } catch (Exception e) { + handleDebug(e, 3); + } + } + if (isSafeUpdateOn()) + try { + setLastUpdTmst(rst.getTimestamp("lastUpdTmst")); + } catch (Exception e) { + handleDebug(e, 3); + } + } + + protected void fillFields(ResultSet rst) { + Hashtable columnDescriptor = initTableDescriptorDb.get(getApFull().getAp().getApCode(this)); + Object[] columnValue = new Object[1]; + for (ColumnDescriptor cd : columnDescriptor.values()) { + String columnName = cd.getColumnName(); + short dataType = cd.getDataType(); + try { + switch (dataType) { + case 6: + case 7: + columnValue[0] = rst.getFloat(columnName); + break; + case -6: + case 5: + columnValue[0] = rst.getInt(columnName); + break; + case 4: + columnValue[0] = rst.getLong(columnName); + break; + case -7: + columnValue[0] = rst.getBoolean(columnName); + break; + case 2: + case 3: + case 8: + columnValue[0] = rst.getDouble(columnName); + break; + case -16: + case -15: + case -9: + case -1: + case 1: + case 12: + columnValue[0] = processStringColumn(cd, rst.getString(columnName)); + break; + case 91: + columnValue[0] = rst.getDate(columnName); + break; + case 92: + columnValue[0] = rst.getTime(columnName); + break; + case 93: + columnValue[0] = rst.getTimestamp(columnName); + break; + default: + columnValue[0] = null; + break; + } + if (columnName.equals("lastUpdTmst") && columnValue[0] == null) + columnValue[0] = new Timestamp(3600L); + cd.getSetMethod().invoke(this, columnValue); + } catch (Exception e) { + handleDebug("Errore su colonna " + columnName + ": " + e.getMessage(), 3); + } + } + if (isSafeUpdateOn()) + try { + setLastUpdTmst(rst.getTimestamp("lastUpdTmst")); + } catch (Exception e) { + handleDebug("Errore lettura lastUpdTmst: " + e.getMessage(), 3); + } + } + + private String processStringColumn(ColumnDescriptor cd, String raw) { + if (raw == null) + return null; + String temp = raw; + if (cd.isCompressedText()) + try { + temp = decompressText(raw); + } catch (Exception e) {} + switch (cd.getStringCaseValue()) { + case 1: + temp = temp.toUpperCase().replace("&EURO;", "€"); + break; + case 2: + temp = temp.toLowerCase(); + break; + case 3: + temp = convertTo1stCap(temp); + break; + } + int dbType = getApFull().getAp().getDbType(); + if (!cd.isCompressedText()) + if (dbType == 3 || dbType == 5 || dbType == 17) { + temp = readMySqlString(temp, true); + } else if (dbType == 13 || dbType == 14) { + temp = readMSSqlString(temp, true); + } + return temp; + } + + public ResParm xmlExport(String fileName, boolean append, boolean close) { + return xmlExport(fileName, sqlStringfindAll(), append, close); + } + + public ResParm xmlExport(String fileName, String sqlFind, boolean append, boolean close) { + ResParm rp = new ResParm(true); + int i = 0; + int se1 = 10; + int se2 = 100; + ResultSet rst = null; + boolean forceRemove = false; + PreparedStatement ps = null; + acquireConnection(); + try (FileWr fw = new FileWr(fileName, append)) { + XmlTableExporter _exporter = new XmlTableExporter(fw); + if (!append) + _exporter.startFile(); + _exporter.startTable(getTableBeanName()); + ps = getConn().prepareStatement(sqlFind); + setSqlQuery(ps.toString()); + rst = ps.executeQuery(); + int numcols = rst.getMetaData().getColumnCount(); + System.out.println("Export DB: Start exporting table " + getTableBeanName()); + while (rst.next()) { + _exporter.startRow(); + for (int idx = 1; idx <= numcols; idx++) { + String name = rst.getMetaData().getColumnName(idx); + String val = rst.getString(idx); + _exporter.addColumn(name, val); + } + _exporter.endRow(); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + _exporter.endTable(); + if (close) + _exporter.endFile(); + } catch (SQLException sqle) { + rp = gestisciSQLException(sqle); + forceRemove = !rp.isOk(); + handleDebug(sqle, 0); + rp.setException(sqle); + } catch (FileNotFoundException e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + handleDebug(e, 0); + rp.setException(e); + } catch (IOException e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + handleDebug(e, 0); + rp.setException(e); + } finally { + releaseConnection(rst, ps, forceRemove); + } + return rp; + } + + public ResParm xmlImport(String xmlFile) { + boolean debug = false; + ResParm rp = new ResParm(); + StringBuilder msg = new StringBuilder(); + HashSet importedPks = new HashSet<>(); + long numRecord = 0L; + try { + Hashtable columnDescriptor = initTableDescriptorDb.get(getApFull().getAp().getApCode(this)); + org.w3c.dom.Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new File(xmlFile)); + Element dbapdapter = doc.getDocumentElement(); + NodeList rowTables = dbapdapter.getChildNodes(); + for (int t = 0; t < rowTables.getLength(); t++) { + Node tableNode = rowTables.item(t); + if (tableNode.getNodeType() == 1) { + Element table = (Element)tableNode; + String tableName = table.getAttribute("name"); + String colName = ""; + String colValue = ""; + Object[] columnValue = new Object[1]; + if (tableName.equals(getTableBeanName())) { + NodeList rows = table.getChildNodes(); + for (int i = 0; i < rows.getLength(); i++) { + Node currentRow = rows.item(i); + if (currentRow.getNodeType() == 1) { + initFields(); + setDBState(0); + NodeList columns = currentRow.getChildNodes(); + for (int j = 0; j < columns.getLength(); j++) { + Node currentColumn = columns.item(j); + if (currentColumn.getNodeType() == 1) { + Element detail = (Element)currentColumn; + colName = detail.getAttribute("name"); + if (detail.getFirstChild() != null) { + colValue = detail.getFirstChild().getNodeValue(); + } else { + colValue = ""; + } + ColumnDescriptor cd = columnDescriptor.get(colName); + if (cd != null && cd.isPk()) { + if (debug) + System.out.println("\n----- new record -----"); + numRecord++; + importedPks.add(colValue); + if (cd.getDataType() == 4) { + findByPrimaryKey(Long.parseLong(colValue)); + } else { + findByPrimaryKey(colValue); + } + } + if (debug) + printDebug(colName + ": " + colName); + if (cd != null) { + String temp; + int dataType = cd.getDataType(); + switch (dataType) { + case 6: + case 7: + if (colValue.equals("null")) + colValue = "0"; + columnValue[0] = new Float(colValue); + break; + case -6: + case 5: + if (colValue.equals("null")) + colValue = "0"; + columnValue[0] = new Integer(colValue); + break; + case 4: + if (colValue.equals("null")) + colValue = "0"; + columnValue[0] = new Long(colValue); + break; + case -7: + columnValue[0] = new Boolean(colValue); + break; + case 2: + case 3: + case 8: + if (colValue.equals("null")) + colValue = "0"; + columnValue[0] = new Double(colValue); + break; + case -16: + case -15: + case -9: + case -1: + case 1: + case 12: + case 1111: + if (colValue.equals("null")) { + columnValue[0] = null; + break; + } + switch (getStringValueCase(colName)) { + case 0: + columnValue[0] = colValue; + break; + case 1: + temp = colValue; + if (temp != null) { + temp = temp.toUpperCase(); + temp = temp.replaceAll("&EURO;", "€"); + } + columnValue[0] = temp; + break; + case 2: + temp = colValue; + if (temp != null) + temp = temp.toLowerCase(); + columnValue[0] = temp; + break; + case 3: + temp = colValue; + if (temp != null) + temp = convertTo1stCap(temp); + columnValue[0] = temp; + break; + } + columnValue[0] = colValue; + break; + case 91: + if (colValue.equals("null")) { + columnValue[0] = null; + } else { + columnValue[0] = Date.valueOf(colValue); + } + break; + case 92: + if (colValue.equals("null")) { + columnValue[0] = null; + } else { + columnValue[0] = Time.valueOf(colValue); + } + break; + case 93: + if (colValue.equals("null")) { + columnValue[0] = null; + } else { + columnValue[0] = Timestamp.valueOf(colValue); + } + break; + default: + columnValue[0] = null; + break; + } + if (debug) + System.out.println(" colvalue: " + colValue); + cd.getSetMethod().invoke(this, columnValue); + } else if (debug) { + System.out.println(" colonna non presente nel db!!"); + } + } + } + rp = save(); + if (!rp.getStatus()) { + msg.append(rp.getMsg()); + msg.append("\n"); + } + } + } + } + } + } + } catch (SAXException e) { + handleDebug(e, 2); + } catch (IOException e) { + handleDebug(e, 2); + rp.setStatus(false); + rp.setMsg(e.getMessage()); + } catch (ParserConfigurationException e) { + handleDebug(e, 2); + rp.setStatus(false); + rp.setMsg(e.getMessage()); + } catch (Exception e) { + handleDebug(e, 2); + rp.setStatus(false); + rp.setMsg(e.getMessage()); + } + rp.setMsg(msg.toString() + "\nNum. Record Importati: " + msg.toString()); + rp.setReturnObj(importedPks); + return rp; + } + + public static final String convertStringToHtml(String theString, boolean changeNl) { + if (theString != null) { + String temp = theString.replace("\r\n", "\n"); + temp = temp.replace("\n\r", "\n"); + StringBuffer modifiedContent = new StringBuffer(); + for (int i = 0; i < temp.length(); i++) { + if (htmlReplaceCodes.containsKey(Character.valueOf(temp.charAt(i)))) { + modifiedContent.append(htmlReplaceCodes.get(Character.valueOf(temp.charAt(i)))); + } else if (changeNl && (temp.charAt(i) == '\n' || temp.charAt(i) == '\r')) { + modifiedContent.append("
    "); + } else if (changeNl && temp.charAt(i) == '\'') { + modifiedContent.append("'"); + } else { + modifiedContent.append(temp.charAt(i)); + } + } + return modifiedContent.toString(); + } + return ""; + } + + @Deprecated + public static boolean zipDirOld(File dir, String zipFileName, boolean saveOriginalPath) { + boolean ok = true; + if (dir.isDirectory()) + try { + FileOutputStream dest = new FileOutputStream(zipFileName); + ZipOutputStream zos = new ZipOutputStream(dest); + BufferedInputStream origin = null; + int BUFFER = 2048; + byte[] data = new byte[BUFFER]; + String[] filenames = dir.list(); + for (String filename2 : filenames) { + String filename = dir.getPath() + "/" + dir.getPath(); + if (!dir.isDirectory()) { + ZipEntry entry; + FileInputStream fi = new FileInputStream(filename); + origin = new BufferedInputStream(fi, BUFFER); + if (saveOriginalPath) { + entry = new ZipEntry(filename); + } else { + entry = new ZipEntry(filename2); + } + zos.putNextEntry(entry); + int count; + while ((count = origin.read(data, 0, BUFFER)) != -1) + zos.write(data, 0, count); + } else { + ZipEntry entry; + if (saveOriginalPath) { + entry = new ZipEntry(filename); + } else { + entry = new ZipEntry(filename2); + } + zos.putNextEntry(entry); + } + origin.close(); + zos.closeEntry(); + } + zos.close(); + } catch (Exception e) { + ok = false; + } finally {} + if (ok) { + System.out.println("ZipDir" + dir.getName()); + } else { + System.out.println("ZipDirError zipping " + dir.getName() + " on file " + zipFileName); + } + return ok; + } + + public static final String convertStringToLink(String descString) { + String temp = descString; + temp = temp.replace("\t", " "); + temp = temp.replace("/", "-"); + temp = temp.replace("-­", "-"); + temp = temp.replace("_­", "-"); + temp = temp.replace("_", "-"); + temp = temp.replace("–", "-"); + temp = temp.replace("\"", ""); + temp = temp.replace("&", "e"); + temp = temp.replace("€", "€"); + temp = temp.replace("%", "x100"); + temp = temp.replace("×", "x"); + temp = temp.replace("®", "(R)"); + temp = temp.replace("©", "(C)"); + temp = temp.replace("à", "a"); + temp = temp.replace("ò", "o"); + temp = temp.replace("ì", "i"); + temp = temp.replace("ù", "u"); + temp = temp.replace("è", "e"); + temp = temp.replace("é", "e"); + temp = temp.replace(" ", " "); + temp = temp.replace(" ", " "); + temp = temp.replace("°", ""); + temp = temp.replace("Ø", "0"); + temp = temp.replace(".", ""); + temp = temp.replace("'", ""); + temp = temp.replace(">", "gt"); + temp = temp.replace("<", "lt"); + temp = temp.replace("’", ""); + temp = temp.replace("^", ""); + boolean usaMinus = true; + if (usaMinus) { + temp = temp.replace(" ", "-"); + temp = temp.replace("\n", "-"); + temp = temp.replace("\r", "-"); + temp = temp.replace(":", "-"); + temp = temp.replace("/", "-"); + temp = temp.replace("\\", "-"); + temp = temp.replace("++", "-"); + temp = temp.replace("++", "-"); + temp = temp.replace("++", "-"); + temp = temp.replace("++", "-"); + } else { + temp = temp.replace(" ", "+"); + temp = temp.replace("\n", "+"); + temp = temp.replace("\r", "+"); + temp = temp.replace(":", "+"); + temp = temp.replace("/", "+"); + temp = temp.replace("\\", "+"); + temp = temp.replace("++", "+"); + temp = temp.replace("++", "+"); + temp = temp.replace("++", "+"); + temp = temp.replace("++", "+"); + } + return temp; + } + + public static Timestamp getTimestamp() { + Calendar cal = Calendar.getInstance(); + Timestamp ts = new Timestamp(cal.getTime().getTime()); + return ts; + } + + public static boolean unzip(String zipFile) { + return unzip(zipFile, zipFile.substring(0, zipFile.length() - 4)); + } + + public String getCurrentFocus() { + return (this.currentFocus == null) ? "" : this.currentFocus; + } + + public void setCurrentFocus(String currentFocus) { + this.currentFocus = currentFocus; + } + + public long getId_ditta() { + return this.id_ditta; + } + + public void setId_ditta(long id_ditta) { + this.id_ditta = id_ditta; + } + + public String get_Id() { + String l_idS = ""; + if (isDatabaseBean()) { + if (getApFull() == null) + return l_idS; + ColumnDescriptor cd = getPrimaryKeyDescriptor(); + if (cd != null) + try { + if (cd.getDataType() == 4) { + l_idS = String.valueOf(((Long)cd.getGetMethod().invoke(this, null)).longValue()); + } else { + Object value = cd.getGetMethod().invoke(this, null); + l_idS = (value != null) ? String.valueOf(value) : ""; + } + } catch (Exception e) { + handleDebug(e); + } + } + return l_idS; + } + + public long get_IdL() { + long l_idS = 0L; + if (isDatabaseBean()) { + if (getApFull() == null) + return 0L; + ColumnDescriptor cd = getPrimaryKeyDescriptor(); + if (cd != null) + try { + if (cd.getDataType() == 4) { + l_idS = (Long)cd.getGetMethod().invoke(this, null); + } else { + l_idS = -1L; + } + } catch (Exception e) { + handleDebug(e); + l_idS = -1L; + } + } + return l_idS; + } + + public String get_IdName() { + if (getPrimaryKeyDescriptor() == null) + return ""; + return getPrimaryKeyDescriptor().getColumnName(); + } + + public String getLastUpdInfo() { + StringBuilder sb = new StringBuilder(); + if (getDBState() > 0) { + if (getCreateTmst() != null) { + sb.append("Create on: "); + sb.append(getTimestampFormat().format((java.util.Date)getCreateTmst())); + sb.append(" "); + } + if (getLastUpdTmst() != null) { + sb.append("Last upd: "); + sb.append(getTimestampFormat().format((java.util.Date)getLastUpdTmst())); + sb.append(" - "); + sb.append(getLastUpdUser().getCognomeNome()); + } + } + return sb.toString(); + } + + public static final String dateToString(Date data, String format) { + if (format.equals("")) + format = "dd/MM/yyyy"; + SimpleDateFormat df = new SimpleDateFormat(format); + return df.format((java.util.Date)data); + } + + public static final Date stringToDate(String data) { + String[] splitData = data.split("/"); + if (splitData.length > 2) { + Calendar cal = Calendar.getInstance(); + cal.set(5, Integer.valueOf(splitData[0]).intValue()); + cal.set(2, Integer.valueOf(splitData[1]) - 1); + if (splitData[2].length() > 2) { + cal.set(1, Integer.valueOf(splitData[2]).intValue()); + } else { + cal.set(1, Integer.valueOf("20" + splitData[2]).intValue()); + } + Date ret = new Date(cal.getTimeInMillis()); + return ret; + } + return null; + } + + public static void resetHashtables() { + if (initTableDescriptorDb != null) + initTableDescriptorDb.clear(); + if (initSqlStringDbDelete != null) + initSqlStringDbDelete.clear(); + if (initSqlStringDbFindAll != null) + initSqlStringDbFindAll.clear(); + if (initSqlStringDbFindPk != null) + initSqlStringDbFindPk.clear(); + if (initSqlStringDbInsert != null) + initSqlStringDbInsert.clear(); + if (initSqlStringDbLogicDelete != null) + initSqlStringDbLogicDelete.clear(); + if (initSqlStringDbMysqlFindRows != null) + initSqlStringDbMysqlFindRows.clear(); + if (initSqlStringDbUpdate != null) + initSqlStringDbUpdate.clear(); + if (initTableSafeUpdate != null) + initTableSafeUpdate.clear(); + DescTxtLang.resetHashtables(); + AbMessages.resetMessages(); + ApplParm.resetHashtable(); + System.gc(); + } + + public static boolean unzip(String zipFile, String destDir) { + System.out.println("unzipping " + zipFile); + try { + int BUFFER = 2048; + File file = new File(zipFile); + FileInputStream fis = new FileInputStream(file); + ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis)); + String newPath = destDir; + new File(newPath).mkdirs(); + ZipEntry entry; + while ((entry = zis.getNextEntry()) != null) { + String currentEntry = entry.getName(); + File destFile = new File(newPath, currentEntry); + if (currentEntry.lastIndexOf(File.separator) >= 0) { + String destinationDir = newPath + newPath; + File destinationParent = new File(destinationDir); + destinationParent.mkdirs(); + } + if (!entry.isDirectory()) { + byte[] data = new byte[BUFFER]; + FileOutputStream fos = new FileOutputStream(destFile); + BufferedOutputStream dest = new BufferedOutputStream(fos, BUFFER); + int currentByte; + while ((currentByte = zis.read(data, 0, BUFFER)) != -1) + dest.write(data, 0, currentByte); + dest.flush(); + dest.close(); + fos.close(); + } else { + new File(newPath + "/" + newPath).mkdir(); + } + if (currentEntry.endsWith(".zip")) + unzip(destFile.getAbsolutePath()); + } + zis.close(); + fis.close(); + return true; + } catch (Exception e) { + e.printStackTrace(); + return false; + } + } + + public static final Paragraph creaParagrafoConGrassetto(String testo, Font theFont, Font theFontB) { + return creaParagrafoConGrassetto(testo, theFont, theFontB, 0.0F); + } + + public static final Paragraph creaParagrafoConGrassetto(String testo, Font theFont, Font theFontB, float spacing) { + Paragraph p; + if (spacing == 0.0F) { + p = new Paragraph(); + } else { + p = new Paragraph(spacing); + } + while (testo.indexOf("") >= 0) { + int idx1 = testo.indexOf(""); + int idx2 = testo.indexOf(""); + String tb = testo.substring(idx1 + 3, idx2); + if (idx1 != 0) { + String temp = testo.substring(0, idx1); + p.add(new Chunk(temp, theFont)); + } + p.add(new Chunk(tb, theFontB)); + testo = testo.substring(idx2 + 4, testo.length()); + } + p.add(new Chunk(testo, theFont)); + return p; + } + + public static final Paragraph creaParagrafoConGrassetto(String testo, Font theFont, Font theFontB, Font theFontI, float spacing) { + Paragraph p = (spacing == 0.0F) ? new Paragraph() : new Paragraph(spacing); + String regex = "((.*?))|((.*?))|([^<]+)"; + Pattern pattern = Pattern.compile(regex, 32); + Matcher matcher = pattern.matcher(testo); + while (matcher.find()) { + if (matcher.group(2) != null) { + String boldText = matcher.group(2); + p.add(new Chunk(boldText, theFontB)); + continue; + } + if (matcher.group(4) != null) { + String italicText = matcher.group(4); + p.add(new Chunk(italicText, theFontI)); + continue; + } + if (matcher.group(5) != null) { + String normalText = matcher.group(5); + p.add(new Chunk(normalText, theFont)); + } + } + return p; + } + + public static final String getVersionLog() { + String packageName = "/it/acxent/db/"; + return Debug.getResourceAsString(packageName + "versionLog.txt"); + } + + public final String getVersionHtmlLog() { + String l_fileName = getDocBase() + "/admin/_V4/__LTE_version.txt"; + BufferedReader reader = null; + String currentLine = ""; + StringBuilder sb = new StringBuilder(); + try { + reader = new BufferedReader(new FileReader(l_fileName)); + if (reader != null) + while ((currentLine = reader.readLine()) != null) { + sb.append(currentLine); + sb.append("\n"); + } + } catch (Exception exception) { + handleDebug(exception); + exception.printStackTrace(); + } finally { + try { + reader.close(); + } catch (Exception e) { + handleDebug(e); + } + } + return sb.toString(); + } + + public static final void gunzip(String inFile, String outFile) { + byte[] buffer = new byte[1024]; + try { + GZIPInputStream gzis = new GZIPInputStream(new FileInputStream(inFile)); + FileOutputStream out = new FileOutputStream(outFile); + int len; + while ((len = gzis.read(buffer)) > 0) + out.write(buffer, 0, len); + gzis.close(); + out.close(); + File file = new File(inFile); + file.delete(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static final void untar(String inFile, String outFolder) { + try { + File file = new File(outFolder); + if (!file.exists()) + file.mkdirs(); + List untaredFiles = new LinkedList<>(); + InputStream is = new FileInputStream(inFile); + TarArchiveInputStream debInputStream = (TarArchiveInputStream)new ArchiveStreamFactory().createArchiveInputStream("tar", is); + TarArchiveEntry entry = null; + while ((entry = (TarArchiveEntry)debInputStream.getNextEntry()) != null) { + File outputFile = new File(outFolder, entry.getName()); + if (entry.isDirectory()) { + if (!outputFile.exists()) + if (!outputFile.mkdirs()) + throw new IllegalStateException(String.format("Failed to create directory %s.", outputFile.getAbsolutePath())); + } else { + OutputStream outputFileStream = new FileOutputStream(outputFile); + IOUtils.copy((InputStream)debInputStream, outputFileStream); + outputFileStream.close(); + } + untaredFiles.add(outputFile); + } + debInputStream.close(); + file = new File(inFile); + file.delete(); + } catch (ArchiveException e) { + e.printStackTrace(); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + protected String getMailToDebug() { + if (!getParm("TO_DEBUG").getTesto().isEmpty()) + return getParm("TO_DEBUG").getTesto(); + return ""; + } + + public static boolean isNumeric(String number) { + if (number.matches("((-|\\+)?[0-9]+(\\.[0-9]+)?)+")) + return true; + return false; + } + + public String getReqUrl() { + return (this.reqUrl == null) ? "" : this.reqUrl.trim(); + } + + public String getSqlQuery() { + return this.sqlQuery; + } + + public void setSqlQuery(String sqlQuery) { + this.sqlQuery = sqlQuery; + } + + public static int getWorkingDaysByTwoDates(Date startDate, Date endDate) { + Calendar startCal = Calendar.getInstance(); + startCal.setTime(startDate); + Calendar endCal = Calendar.getInstance(); + endCal.setTime(endDate); + int workDays = 0; + if (startCal.getTimeInMillis() == endCal.getTimeInMillis()) + return 0; + if (startCal.getTimeInMillis() > endCal.getTimeInMillis()) { + startCal.setTime(endDate); + endCal.setTime(startDate); + } + do { + startCal.add(5, 1); + if (startCal.get(7) == 7 || startCal.get(7) == 1) + continue; + workDays++; + } while (startCal.getTimeInMillis() < endCal.getTimeInMillis()); + return workDays; + } + + public int getWorkingDaysBetweenTwoDates(Date startDate, Date endDate) { + return getWorkingDaysByTwoDates(startDate, endDate); + } + + public static String getDateInline(Date data) { + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yy"); + String dataInline = df.format((java.util.Date)data); + return dataInline.replace("/", ""); + } + + public static String getDateInline4(Date data) { + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); + String dataInline = df.format((java.util.Date)data); + return dataInline.replace("/", ""); + } + + public static int getImportoInCentesimi(double importo) { + DoubleOperator dop = new DoubleOperator(importo); + dop.multiply(100); + return (int)dop.getResult(); + } + + public void setReqUrl(String reqUrl) { + this.reqUrl = reqUrl; + } + + public static final double conIva(double prezzoSenzaIva, double l_aliquota) { + if (l_aliquota != 0.0D && prezzoSenzaIva != 0.0D) { + DoubleOperator ppi = new DoubleOperator(prezzoSenzaIva); + ppi.setScale(4, 5); + ppi.multiply(l_aliquota); + ppi.divide(100.0F); + ppi.add(prezzoSenzaIva); + ppi.setScale(2, 5); + return ppi.getResult(); + } + return prezzoSenzaIva; + } + + public static final double scorporaIva(double prezzoConIva, double l_aliquota) { + if (prezzoConIva != 0.0D && prezzoConIva != 0.0D) { + DoubleOperator dop = new DoubleOperator(l_aliquota); + dop.setScale(4, 5); + dop.divide(100.0F); + dop.add(1); + DoubleOperator dop2 = new DoubleOperator(prezzoConIva); + dop2.setScale(4, 5); + dop2.divide(dop); + dop2.setScale(2, 5); + return dop2.getResult(); + } + return 0.0D; + } + + public static final String readMSSqlString(String sqlString, boolean convertPerc) { + sqlString = sqlString.replace("\\\\", "\\"); + if (convertPerc); + sqlString = sqlString.replace("''", "'"); + return sqlString; + } + + public static final String convertMinToHourMin(long min) { + int h = (int)(min / 60L); + int m = (int)(min - (long)(h * 60)); + return "" + h + ":" + h; + } + + public static final Date getDateFromString(String theDate) { + try { + if (theDate.endsWith("aaaa")) + theDate = theDate.replace("aaaa", String.valueOf(Calendar.getInstance().get(1))); + if (theDate.endsWith("/")) + theDate = theDate.substring(0, theDate.length() - 1); + theDate = theDate.replace('-', '/'); + if (theDate.indexOf('/') < 0) + if (theDate.length() == 4) { + theDate = theDate.substring(0, 2) + "/" + theDate.substring(0, 2); + } else if (theDate.length() == 6) { + theDate = theDate.substring(0, 2) + "/" + theDate.substring(0, 2) + "/" + theDate.substring(2, 4); + } + int j = 0; + int i = 0; + String temp = theDate; + while ((i = temp.indexOf('/')) > 0) { + temp = temp.substring(i + 1); + j++; + } + if (j == 2) { + i = theDate.lastIndexOf('/'); + int anno = Integer.valueOf(temp); + if (anno < 100) { + anno += 2000; + theDate = theDate.substring(0, i + 1) + theDate.substring(0, i + 1); + } + } else if (j == 1) { + theDate = theDate + "/" + theDate; + } + return convertStringToDate(theDate); + } catch (Exception e) { + return null; + } + } + + public static final Time getTimeFromString(String theTime) { + try { + if (theTime.matches("[0-9][0-9]")) { + theTime = theTime + ":00"; + } else if (theTime.matches("[0-9][0-9]:")) { + theTime = theTime + "00"; + } else if (theTime.matches("[0-9]")) { + theTime = "0" + theTime + ":00"; + } else if (theTime.matches("[0-9][0-9][0-9][0-9]")) { + theTime = theTime.substring(0, 2) + ":" + theTime.substring(0, 2); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+")) { + java.util.StringTokenizer st = new java.util.StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + TimeZone tz = Calendar.getInstance().getTimeZone(); + return new Time((long)(hour * 3600000 + min * 60000 + sec * 1000 - tz.getOffset(0L))); + } + if (theTime.matches("[0-9]{1,2}+:[0-9]{1,2}+:[0-9]{1,2}+")) { + java.util.StringTokenizer st = new java.util.StringTokenizer(theTime, ":"); + int hour = Integer.parseInt(st.nextToken()); + int min = Integer.parseInt(st.nextToken()); + int sec = st.hasMoreElements() ? Integer.parseInt(st.nextToken()) : 0; + TimeZone tz = Calendar.getInstance().getTimeZone(); + return new Time((long)(hour * 3600000 + min * 60000 + sec * 1000 - tz.getOffset(0L))); + } + return null; + } catch (Exception e) { + return null; + } + } + + public static String searchStringFromFile(String filePath, String searchQuery) throws IOException { + searchQuery = searchQuery.trim(); + BufferedReader br = null; + try { + br = new BufferedReader(new InputStreamReader(new FileInputStream(filePath))); + String line; + while ((line = br.readLine()) != null) { + if (line.contains(searchQuery)) + return line; + } + } finally { + try { + if (br != null) + br.close(); + } catch (Exception e) { + System.err.println("Exception while closing bufferedreader " + e.toString()); + } + } + return null; + } + + public String getDescrizione() { + return this.descrizione; + } + + public void setDescrizione(String descrizione) { + this.descrizione = descrizione; + } + + public final Timestamp getCreateTmst() { + return this.createTmst; + } + + public void setCreateTmst(Timestamp createTmst) { + this.createTmst = createTmst; + } + + protected Vectumerator findRows(PreparedStatement ps, int page, int pageRows) { + boolean ottimizza = false; + switch (getApFull().getAp().getDbType()) { + case 3: + case 17: + ottimizza = !ps.toString().contains("limit"); + if (!ottimizza) + handleDebug("findRows con limit: " + ps.toString(), 2); + break; + } + if (page < 0) + page = 0; + if (pageRows < 0) + pageRows = 0; + if (!ottimizza || (page == 1 && pageRows == 1) || pageRows == 0) + return findRowsNotOptimized(ps, page, pageRows); + acquireConnection(); + if (page == 0) + page = 1; + setSqlQuery(ps.toString()); + boolean debug = isDebugEnabled(); + Timer timer = new Timer(); + if (checkProfile(getTableBeanName()) <= 0L) { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "GRANT_NO_R")); + return AB_EMPTY_VECTUMERATOR; + } + if (debug) + timer.start(); + ResultSet rst = null; + boolean forceRemove = false; + Vectumerator vec = new Vectumerator<>(); + int i = 0; + Connection conn = null; + try { + checkLic(); + SqlPair sqlPair = buildOptimizedQueries(ps, page, pageRows); + ps.close(); + conn = getConn(false); + ps = conn.prepareStatement(sqlPair.fetchQuery); + rst = ps.executeQuery(); + trace("findRowsException: Thread=" + Thread.currentThread().getId() + " conn=" + String.valueOf((conn != null) ? conn : "null") + " PRIMA DI WHILE RST"); + while (rst.next()) { + i++; + trace("findRowsException: Thread=" + Thread.currentThread().getId() + " conn=" + String.valueOf((conn != null) ? conn : "null") + " ciclo RST i=" + i); + fillAndAddBean(rst, vec); + } + vec.setPageRow(pageRows); + vec.setPageNumber(page); + if (!vec.isEmpty()) { + PreparedStatement psTot = getConn().prepareStatement(sqlPair.totalQuery); + vec.setTotNumberOfRecords((int)getTots(psTot)); + handleDebug(AbMessages.getMessage(getCurrentLocale(), "READ_OK"), 5); + } else { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "NO_RECORDS_FOUND"), 5); + } + } catch (SQLException sqle) { + getCpc().setTxFailed(true); + try { + trace("findRowsException: i:" + i + " Thread=" + Thread.currentThread().getId() + " conn=" + String.valueOf((conn != null) ? conn : "null") + " msg=" + + sqle.getMessage()); + } catch (Throwable t) { + trace("findRowsException: i:" + i + " failed to trace connection info: " + t.getMessage()); + } + traceDebug = false; + dumpTrace(); + forceRemove = true; + if ("08S01".equals(sqle.getSQLState())) + removeCPConnection(); + handleDebug(sqle, 0); + return AB_EMPTY_VECTUMERATOR; + } catch (Exception e) { + getCpc().setTxFailed(true); + forceRemove = true; + handleDebug(e, 2); + return AB_EMPTY_VECTUMERATOR; + } finally { + releaseConnection(rst, ps, forceRemove); + } + if (debug) { + timer.stop(); + vec.setQueryTime("" + timer.getDurataMilliSec() + " ms"); + printDebugQuery(getApFull(), timer, this); + } + return vec; + } + + private SqlPair buildOptimizedQueries(PreparedStatement ps, int page, int pageRows) { + String rawSql = ps.toString(); + String baseQuery = rawSql.substring(rawSql.indexOf(':') + 1).trim(); + String fetchQuery = (pageRows > 0) ? addPagination(baseQuery, page, pageRows) : baseQuery; + String totalQuery = "SELECT COUNT(*) AS tot FROM (" + baseQuery + ") AS X"; + return new SqlPair(fetchQuery, totalQuery); + } + + private String addPagination(String baseQuery, int page, int pageRows) { + int start = Math.max(0, (page - 1) * pageRows); + return baseQuery + " LIMIT " + baseQuery + "," + start; + } + + public final String getCreateTmstS() { + return convertTimestampToString(getCreateTmst()); + } + + public final String getLastUpdTmstS() { + return convertTimestampToString(getLastUpdTmst()); + } + + public String getDescrizione(String lang) { + if (lang == null || lang.isEmpty()) + lang = "it"; + if (useDescLangTables()) { + String temp = getDescTxtLang("descrizione", lang); + if (temp.isEmpty() && !lang.equals("it")) + return "." + getDescTxtLang("descrizione", "it") + "."; + return temp; + } + if (lang.equals("it")) + return getDescrizione(); + return translate(getDescrizione(), lang); + } + + public String getDescrizionePS(String lang) { + if (lang.isEmpty()) + lang = "it"; + if (useDescLangTables()) { + if (lang.equals(getLangPrimary()) || lang.equals(getLangSecondary())) { + StringBuilder stringBuilder = new StringBuilder(getDescTxtLang("descrizione", getLangPrimary())); + stringBuilder.append(" "); + stringBuilder.append(getDescTxtLang("descrizione", getLangSecondary())); + return stringBuilder.toString().trim(); + } + StringBuilder temp = new StringBuilder(getDescTxtLang("descrizione", lang)); + temp.append(" "); + temp.append(getDescTxtLang("descrizione", getLangPrimary())); + return temp.toString().trim(); + } + if (lang.equals("it")) + return getDescrizione(); + return translate(getDescrizione(), lang); + } + + public long getStep() { + return this.step; + } + + public void setStep(long step) { + this.step = step; + } + + public static final String getPathMeseAnno(Date data) { + Calendar cal = Calendar.getInstance(); + cal.setTime(data); + int mese = cal.get(2); + int anno = cal.get(1); + if (mese < 10) { + String meseS = "0" + mese; + } else { + String meseS = String.valueOf(mese); + } + return "" + anno + "/" + anno + "/"; + } + + public static final String appendSuffixToFile(String theFile, String suffix) { + int lastDot = theFile.lastIndexOf("."); + String result = theFile.substring(0, lastDot) + theFile.substring(0, lastDot) + suffix; + return result; + } + + public static final int getSommaArray(int[] array) { + if (array != null) { + int tot = 0; + for (int element : array) + tot += element; + return tot; + } + return 0; + } + + public static final String convertHtmlToString(String htmlString) { + String temp = htmlString.replace("\n", " "); + temp = temp.replace("\r", " "); + temp = temp.replace("
    ", "\n"); + temp = temp.replace("
    ", "\n"); + temp = temp.replace("
    ", "\n"); + temp = temp.replace("
    ", "\n"); + temp = temp.replace("
    ", "\n"); + temp = temp.replace("
    ", "\n"); + Set keys = stringReplaceCodes.keySet(); + for (Character key : keys) { + if (temp.indexOf(stringReplaceCodes.get(key)) >= 0) + temp = temp.replace(stringReplaceCodes.get(key), key.toString()); + } + return temp; + } + + public static final String convertStringToStringNoAccenti(String htmlString) { + String temp = htmlString; + Set keys = accentatiReplaceCodes.keySet(); + for (Character key : keys) { + if (temp.indexOf(key.toString()) >= 0) + temp = temp.replace(key.toString(), accentatiReplaceCodes.get(key)); + } + return temp; + } + + public static final String convertStringToISO_8859_1(String value) { + if (value == null) + return null; + if (value.isEmpty()) + return ""; + try { + byte[] latin1 = value.getBytes("ISO-8859-1"); + return new String(latin1).replace("?", " "); + } catch (Exception e) { + return value; + } + } + + public static final String eliminaDoppioniInStringa(String laStringa, int minLen, boolean puntievirgole) { + return eliminaDoppioniInStringa(laStringa, " ", minLen, puntievirgole); + } + + public static final String eliminaDoppioniInStringa(String laStringa, String sep, int minLen, boolean puntievirgole) { + StringTokenizer st = new StringTokenizer(laStringa, sep); + StringBuilder sb = new StringBuilder(); + LinkedHashSet hsLC = new LinkedHashSet<>(); + LinkedHashSet hs = new LinkedHashSet<>(); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + if (token.length() >= minLen) { + if (token.endsWith(",") || token.endsWith(".")) + token = token.substring(0, token.length() - 1); + if (token.startsWith(",") || token.startsWith(".")) + token = token.substring(1, token.length()); + if (hsLC.add(token.toLowerCase())) { + hs.add(token); + if (puntievirgole) { + if (token.indexOf(".") > 0) { + hs.add(token.replace(".", ",")); + continue; + } + if (token.indexOf(",") > 0) + hs.add(token.replace(",", ".")); + } + } + } + } + Iterator itr = hs.iterator(); + while (itr.hasNext()) { + sb.append(itr.next()); + if (itr.hasNext()) + sb.append(sep); + } + return sb.toString(); + } + + public static final String eliminaDoppioniInStringa(String laStringa) { + return eliminaDoppioniInStringa(laStringa, 1, false); + } + + public static final String eliminaDoppioniTokenInStringa(String laStringa, String l_separatore) { + StringTokenizer st = new StringTokenizer(laStringa, l_separatore); + StringBuilder sb = new StringBuilder(); + LinkedHashSet hs = new LinkedHashSet<>(); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + if (token.length() > 1) + hs.add(token); + } + for (String element : hs) { + sb.append(element); + sb.append(l_separatore); + } + String temp = sb.toString(); + if (temp.isEmpty()) + return ""; + return temp.substring(0, temp.length() - 1).trim(); + } + + public String getEncodedFields() { + return (this.encodedFields == null) ? "" : this.encodedFields.trim(); + } + + public void setEncodedFields(String encodingFields) { + this.encodedFields = encodingFields; + } + + public Users getUserLogon(long l_id_users) { + if (this.userLogon == null && l_id_users > 0L) { + this.userLogon = new Users(getApFull()); + this.userLogon.findByPrimaryKey(l_id_users); + } + return (this.userLogon == null) ? new Users(getApFull()) : this.userLogon; + } + + public void setUserLogon(Users userLogon) { + this.userLogon = userLogon; + } + + public ResParm translateAllDbDesc(String mainLang) { + ResParm rp = new ResParm(); + long numTrad = 0L, numTradErr = 0L; + if (useDescLangTables()) { + String descLang = "", desc254Lang = ""; + String availableLang = getParm("LANG_AVAILABLE").getTesto(); + DescTxtLang dtl = new DescTxtLang(getApFull()); + Vectumerator vec = dtl.findCampiByIdtabellaLangTabella(getPkValue(), mainLang, getTableBeanName()); + while (vec.hasMoreElements()) { + DescTxtLang row = vec.nextElement(); + StringTokenizer stLang = new StringTokenizer(availableLang, ","); + for (int i = 0; i < stLang.countToken(); i++) { + String currentLang = stLang.getToken(i); + if (!currentLang.toLowerCase().equals(mainLang.toLowerCase())) { + dtl.findByPrimaryKey(getDescTxtLangKey(row.getCampo(), currentLang)); + if (dtl.getDBState() == 0) { + if (!row.getDescrizione().isEmpty()) { + descLang = GoogleTranslator.translate(row.getDescrizione(), mainLang, currentLang); + if (descLang.length() > 254) { + desc254Lang = descLang.substring(0, 254); + } else { + desc254Lang = descLang; + } + } else { + descLang = ""; + desc254Lang = ""; + } + if (!descLang.isEmpty()) { + dtl.setCampo(row.getCampo()); + dtl.setLang(currentLang); + dtl.setTabella(getTableBeanName()); + dtl.setIdTabella(getPkValue()); + dtl.setDescrizione(descLang); + dtl.setDescrizione254(desc254Lang); + rp = dtl.save(); + if (rp.getStatus()) { + numTrad++; + System.out.println("translateAllDbDesc: campo: " + dtl.getCampo() + " lang: " + dtl.getLang() + " val: " + + dtl.getDescrizione254()); + } else { + numTradErr++; + } + } + } + } + } + } + } + if (numTradErr > 0L) { + rp.setMsg("Attenzione! Tradotte " + numTrad + " descrizioni. NON Tradotte " + numTradErr + " descrizioni"); + } else { + rp.setMsg("Tradotte " + numTrad + " descrizioni"); + } + return rp; + } + + private static synchronized void appendNewMissedDescTxtLang(DescTxtLang dtl) {} + + public final boolean isGoogleTranslatorEnable() { + return (useDescLangTables() && getParm("USE_GOOGLE_TRANSLATOR").isTrue()); + } + + public ResParm save() { + ResParm rp = new ResParm(); + boolean forceRemove = false; + acquireConnection(); + try { + if (!haPermessiScrittura()) { + rp = errorePermessiScrittura(rp); + getCpc().setTxFailed(true); + return rp; + } + rp = doSave(); + } catch (SQLException e) { + rp = gestisciSQLException(e); + forceRemove = !rp.isOk(); + getCpc().setTxFailed(true); + } catch (Exception e) { + rp = gestisciEccezioneGenerica(e); + forceRemove = !rp.isOk(); + getCpc().setTxFailed(true); + } finally { + releaseConnection(null, null, forceRemove); + } + logAggiornamento(rp); + return rp; + } + + private ResParm doSave() throws SQLException { + ResParm rp = new ResParm(); + boolean isNuovo = (getDBState() == 0); + String sql = isNuovo ? sqlStringInsert() : sqlStringUpdate(); + if (isNuovo) + preparePrimaryKeyBeforeInsert(); + try (PreparedStatement ps = getConn().prepareStatement(sql)) { + prepareSave(ps); + setSqlQuery(ps.toString()); + handleDebug(sql, 5); + int numUpd = ps.executeUpdate(); + if (numUpd != 1) + return erroreSafeUpdate(numUpd); + if (isNuovo) + retrieveAutoIncrementID(); + ResParm rpSu = refreshBean(); + if (rpSu.getStatus() && useDescLangTables()) + gestisciDescTxtLang(); + if (rpSu.getStatus()) { + rp.setStatus(true); + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "SAVE_OK")); + handleDebug(rp.getMsg(), 5); + } else { + rp.setStatus(false); + rp.setMsg(rpSu.getMsg()); + Log.addAggiornamentoRecordFallito(this, rpSu.getMsg()); + } + } + setDBState(1); + return rp; + } + + private void gestisciDescTxtLang() { + DescTxtLang dtl = new DescTxtLang(getApFull()); + Vector v = getDescTxtLangValues(); + if (v == null) + return; + for (DescLangItem item : v) { + dtl.findByPrimaryKey(getDescTxtLangKey(item.getCampo(), item.getLang())); + dtl.setCampo(item.getCampo()); + dtl.setLang(item.getLang()); + dtl.setTabella(getTableBeanName()); + dtl.setIdTabella(getPkValue()); + if (item.getValue().isEmpty()) { + dtl.delete(); + continue; + } + dtl.setDescrizione(item.getValue()); + dtl.setDescrizione254((item.getValue().length() > 254) ? item.getValue().substring(0, 254) : item.getValue()); + dtl.save(); + } + setDescTxtLangValues(null); + } + + private boolean haPermessiScrittura() { + return (checkProfile(getTableBeanName()) >= 3L); + } + + private ResParm errorePermessiScrittura(ResParm rp) { + rp.setStatus(false); + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "GRANT_NO_RW")); + return rp; + } + + private ResParm erroreSafeUpdate(int numUpd) { + ResParm rp = new ResParm(); + rp.setStatus(false); + StringBuffer msg = new StringBuffer(AbMessages.getMessage(getCurrentLocale(), "SAVE_FAIL")); + if (isSafeUpdateOn()) { + msg.append(AbMessages.getMessage(getCurrentLocale(), "ALREADY_SAVED")); + if (getLastUpdId_user() != 0L) { + refreshBean(); + msg.append(" ").append(getLastUpdUser().getCognomeNome()); + } + } + rp.setMsg(msg.toString()); + handleDebug(rp.getMsg(), 3); + return rp; + } + + private ResParm gestisciSQLException(SQLException e) { + ResParm rp = new ResParm(); + rp.setStatus(true); + if ("23000".equals(e.getSQLState()) || "S0003" + .equals(e.getSQLState())) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "DUPLICATE_KEY") + " " + AbMessages.getMessage(getCurrentLocale(), "DUPLICATE_KEY")); + } else { + if ("08S01".equals(e.getSQLState())) { + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "COMMUNICATION_ERROR") + " " + AbMessages.getMessage(getCurrentLocale(), "COMMUNICATION_ERROR")); + rp.setStatus(false); + } + if (!isOnLogDb()) { + handleDebug(e, 0); + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "ERROR") + " " + AbMessages.getMessage(getCurrentLocale(), "ERROR")); + } else { + String msg = AbMessages.getMessage(getCurrentLocale(), "LOG_ERROR") + " db: " + AbMessages.getMessage(getCurrentLocale(), "LOG_ERROR") + "\n" + getApFull().getDatabase(); + printDebug("" + Thread.currentThread().getStackTrace()[1].getLineNumber() + " " + Thread.currentThread().getStackTrace()[1].getLineNumber()); + rp.setMsg(msg); + } + } + return rp; + } + + private ResParm gestisciEccezioneGenerica(Exception e) { + ResParm rp = new ResParm(); + rp.setStatus(false); + if (!isOnLogDb()) { + handleDebug(e, 0); + rp.setMsg(AbMessages.getMessage(getCurrentLocale(), "ERROR") + " " + AbMessages.getMessage(getCurrentLocale(), "ERROR")); + } else { + String msg = AbMessages.getMessage(getCurrentLocale(), "LOG_ERROR") + " db: " + AbMessages.getMessage(getCurrentLocale(), "LOG_ERROR") + "\n" + getApFull().getDatabase(); + printDebug("" + Thread.currentThread().getStackTrace()[1].getLineNumber() + " " + Thread.currentThread().getStackTrace()[1].getLineNumber()); + rp.setMsg(msg); + } + return rp; + } + + private boolean isOnLogDb() { + return getApFull().getDatabase().contains("_log"); + } + + private void logAggiornamento(ResParm rp) { + if (!isLogUserUpdates() || getTableBeanName().startsWith("LOG")) + return; + if (getDBState() == 0) { + Log.addCreazioneRecord(this); + } else { + Log.addAggiornamentoRecord(this); + } + } + + private final void initBean() { + boolean debug = false; + if (!isDatabaseBean()) + return; + setDescTxtLangValues(null); + String tableName = getTableBeanName(); + printDebug(debug, "initBean tableName: " + tableName + " db: " + getApFull().getApCode()); + if (getApFull() == null) + return; + int dbType = getApFull().getAp().getDbType(); + if (dbType == 0 || dbType == 11 || dbType == 12) + return; + getRegKey(); + String catalog = getApFull().getCatalog(); + String apCode = getApFull().getAp().getApCode(this); + initTableDescriptorDb.computeIfAbsent(apCode, key -> { + try { + printDebug(true, "initBean " + tableName + " inizializzo metadati tabella per db [" + catalog + "] su host [" + + getApFull().getDatabase() + "]"); + return buildTableDescriptor(catalog, tableName, debug); + } catch (Exception e) { + handleDebug(e, 0); + printDebug(true, "initBean ===> ERRORE!! catalog=" + catalog + " table=" + tableName + " " + e.getMessage()); + return new Hashtable(); + } + }); + } + + private Hashtable buildTableDescriptor(String catalog, String tableName, boolean debug) throws SQLException, NoSuchMethodException { + Hashtable columnDescriptorHT = new Hashtable<>(); + Hashtable columnDescCaseHT = new Hashtable<>(); + LinkedHashMap primaryKeyDescriptorsHt = new LinkedHashMap<>(); + LinkedHashSet pkColumns = new LinkedHashSet<>(); + Set fkColumns = new HashSet<>(); + boolean l_safeUpdateOn = false; + ResultSet rstColumns = null; + Access access = null; + if (tableName.equalsIgnoreCase("foto")); + try { + if (!tableName.equalsIgnoreCase("ACCESS") && !tableName.equalsIgnoreCase("LOG") && + !tableName.equalsIgnoreCase("LOG_MAIL") && !tableName.equalsIgnoreCase("LOG_MAIL_ATTACH")) { + rstColumns = getConn().getMetaData().getTables(catalog, null, "ACCESS", null); + if (rstColumns.next()) { + access = new Access(getApFull()); + access.findByPrimaryKey(tableName); + l_safeUpdateOn = (access.getFlgSafeUpdate() == 1L); + } + rstColumns.close(); + } + } catch (Exception e) { + handleDebug(e, 2); + printDebug(true, "initBean ===> ERRORE!! catalog=" + catalog + " table=" + tableName + " " + e.getMessage()); + } finally { + if (rstColumns != null) + try { + rstColumns.close(); + } catch (Exception e2) { + handleDebug(e2, 0); + printDebug(true, "initBean ===> ERRORE!! catalog=" + catalog + " table=" + tableName + " " + e2.getMessage()); + } + } + String apCode = getApFull().getAp().getApCode(this); + initTableSafeUpdate.put(apCode, Boolean.valueOf(l_safeUpdateOn)); + ensureStandardColumns(catalog, tableName, debug); + printDebug(debug, "buildTableDescriptor " + tableName + " foreignKey"); + fkColumns = loadForeignKeys(catalog, tableName, debug); + printDebug(debug, "buildTableDescriptor " + tableName + " primaryKey"); + pkColumns = loadPrimaryKeys(catalog, tableName, debug); + printDebug(debug, "buildTableDescriptor " + tableName + " column descriptors"); + loadColumnDescriptors(catalog, tableName, pkColumns, fkColumns, access, debug, columnDescriptorHT, primaryKeyDescriptorsHt, columnDescCaseHT); + initTableDescriptorDbPk.put(apCode, primaryKeyDescriptorsHt); + printDebug(debug, "buildTableDescriptor " + tableName + " buildSqlStatements"); + buildSqlStatements(tableName, primaryKeyDescriptorsHt.keySet(), columnDescriptorHT, l_safeUpdateOn, apCode); + return columnDescriptorHT; + } + + private void loadColumnDescriptors(String catalog, String tableName, LinkedHashSet pkColumns, Set fkColumns, Access access, boolean debug, Map columnDescriptorHT, LinkedHashMap primaryKeyDescriptorsHt, Map columnDescCaseHT) throws SQLException, NoSuchMethodException { + ResultSet rstColumns = null; + Connection conn = getConn(); + try { + rstColumns = conn.getMetaData().getColumns(catalog, null, tableName, null); + if (!rstColumns.isBeforeFirst()) { + rstColumns.close(); + rstColumns = conn.getMetaData().getColumns(catalog, null, tableName.toLowerCase(), null); + } + while (rstColumns.next()) { + short dataType = rstColumns.getShort("DATA_TYPE"); + String columnName = rstColumns.getString("COLUMN_NAME"); + int columnSize = rstColumns.getInt("COLUMN_SIZE"); + String realColumnName = getRealColumnName(getClass(), columnName); + int stringCaseValue = 0; + boolean isTextCompressed = false; + EncodedField encodedField = new EncodedField(); + if (access != null && !tableName.toUpperCase().equals("DESC_TXT_LANG") && (dataType == 12 || dataType == 1 || dataType == -16 || dataType == -1 || dataType == -15 || dataType == -9)) { + stringCaseValue = access.getTableColumnStringValueCase(realColumnName); + encodedField = access.getTableColumnEncodedField(realColumnName); + isTextCompressed = access.isTableColumnStringCompressed(realColumnName); + } + if (realColumnName != null) { + boolean isPk = pkColumns.contains(columnName); + boolean isFk = fkColumns.contains(columnName); + ColumnDescriptor cd = new ColumnDescriptor(realColumnName, dataType, columnSize, isPk, getDeclaredField(realColumnName), stringCaseValue, encodedField, (!isPk && !isFk && isTextCompressed)); + if (isPk) { + if (dataType == 4 && pkColumns.size() == 1 && realColumnName.startsWith("id_")) + cd.setAutoIncrement(true); + if (isFk) { + cd.setFk(true); + if (dataType == 4 || dataType == 5) + cd.setFkNum(true); + } + setGetterSetter(cd, realColumnName, dataType); + primaryKeyDescriptorsHt.put(columnName, cd); + } else { + if (isFk) { + cd.setFk(true); + if (dataType == 4 || dataType == 5) + cd.setFkNum(true); + } + setGetterSetter(cd, realColumnName, dataType); + } + columnDescriptorHT.put(columnName, cd); + columnDescCaseHT.put(columnName, Integer.valueOf(stringCaseValue)); + continue; + } + if (!columnName.equals("lastUpdTmst")) + handleDebug("WARNING!!! NO PROPERTY FOUND FOR COLUMN " + columnName); + } + } catch (Exception e) { + handleDebug(e, 0); + printDebug(true, "initBean ===> ERRORE!! catalog=" + catalog + " table=" + tableName + " " + e.getMessage()); + } finally { + if (rstColumns != null) + try { + rstColumns.close(); + } catch (Exception e) { + handleDebug(e, 0); + } + } + } + + private void setGetterSetter(ColumnDescriptor cd, String realColumnName, short dataType) throws NoSuchMethodException { + if (dataType == -7) { + cd.setGetMethod(getClass().getMethod("is" + capitalize(realColumnName), null)); + } else { + cd.setGetMethod(getClass().getMethod("get" + capitalize(realColumnName), null)); + } + if (dataType != 93 || (getApFull().getAp().getDbType() != 13 && + getApFull().getAp().getDbType() != 14)) { + cd.setSetMethod(getClass().getMethod("set" + capitalize(realColumnName), getClassParamByDataType(dataType))); + } else { + Method mth = null; + try { + mth = getClass().getMethod("set" + capitalize(realColumnName), getClassParamByDataType((short)93)); + } catch (Exception e) {} + if (mth == null) + try { + mth = getClass().getMethod("set" + capitalize(realColumnName), getClassParamByDataType((short)91)); + cd.setDataType((short)91); + } catch (Exception e) {} + if (mth == null) + try { + mth = getClass().getMethod("set" + capitalize(realColumnName), getClassParamByDataType((short)92)); + cd.setDataType((short)92); + } catch (Exception e) {} + cd.setSetMethod(mth); + } + } + + private String capitalize(String name) { + return name.substring(0, 1).toUpperCase() + name.substring(0, 1).toUpperCase(); + } + + private void buildSqlStatements(String tableName, Set pkColumns, Map columnDescriptorHT, boolean safeUpdate, String apCode) { + StringBuilder sqlInsert = new StringBuilder(); + StringBuilder sqlInsertValue = new StringBuilder(); + StringBuilder sqlUpdate = new StringBuilder(); + StringBuilder whereCondition = new StringBuilder(); + String orderBy = ""; + String whereFindAll = ""; + try { + for (String pk : pkColumns) { + if (whereCondition.length() == 0) { + whereCondition.append(" WHERE ").append(pk).append("=?"); + continue; + } + whereCondition.append(" AND ").append(pk).append("=?"); + } + for (ColumnDescriptor cd : columnDescriptorHT.values()) { + String columnName = cd.getColumnName(); + if (!cd.isAutoIncrement() || (getApFull().getAp().getDbType() != 4 && + getApFull().getAp().getDbType() != 13 && + getApFull().getAp().getDbType() != 14)) + if (sqlInsert.length() == 0) { + sqlInsert.append("INSERT INTO ").append(tableName).append(" (").append(columnName); + sqlInsertValue.append(") VALUES(?"); + } else { + sqlInsert.append(", ").append(columnName); + sqlInsertValue.append(",?"); + } + if (!cd.isAutoIncrement()) + if (sqlUpdate.length() == 0) { + sqlUpdate.append("UPDATE ").append(tableName).append(" SET ").append(columnName).append("=?"); + } else { + sqlUpdate.append(", ").append(columnName).append("=?"); + } + if (orderBy.isEmpty() && (columnName.equals("descrizione") || columnName.equals("description") || + columnName.equals("nominativo") || columnName.equals("cognome"))) + orderBy = " ORDER BY " + columnName; + if (whereFindAll.isEmpty() && columnName.equals("dataFineVld")) + whereFindAll = " WHERE dataFineVld is null "; + } + sqlInsertValue.append(")"); + sqlInsert.append((CharSequence)sqlInsertValue); + sqlUpdate.append((CharSequence)whereCondition); + String sqlFindAll = "SELECT * FROM " + tableName + whereFindAll + orderBy; + String sqlFindByPk = "SELECT * FROM " + tableName + String.valueOf(whereCondition); + String sqlDelete = "DELETE FROM " + tableName + String.valueOf(whereCondition); + String sqlLogicDelete = "UPDATE " + tableName + " SET dataFineVld=?" + String.valueOf(whereCondition); + if (safeUpdate) { + sqlUpdate.append(" and lastUpdTmst=?"); + sqlDelete = sqlDelete + " and lastUpdTmst=?"; + sqlLogicDelete = "UPDATE " + tableName + " SET dataFineVld=?, lastUpdTmst=null " + String.valueOf(whereCondition) + " and lastUpdTmst=?"; + } + initSqlStringDbInsert.put(apCode, sqlInsert.toString()); + initSqlStringDbUpdate.put(apCode, sqlUpdate.toString()); + initSqlStringDbFindAll.put(apCode, sqlFindAll); + initSqlStringDbFindPk.put(apCode, sqlFindByPk); + initSqlStringDbDelete.put(apCode, sqlDelete); + initSqlStringDbLogicDelete.put(apCode, sqlLogicDelete); + handleDebug("\n------------- INIT SQL STRINGS for " + tableName + " -------------\nInsert: " + String.valueOf(sqlInsert) + "\nUpdate: " + String.valueOf(sqlUpdate) + "\nDelete: " + sqlDelete + "\nLogic Delete: " + sqlLogicDelete + "\nFind All: " + sqlFindAll + "\nFind by PK: " + sqlFindByPk + "\n", 5); + } catch (Exception e) { + handleDebug(e, 0); + printDebug(true, "initBean ===> ERRORE!! table=" + tableName + " " + e.getMessage()); + } + } + + private LinkedHashSet loadPrimaryKeys(String catalog, String tableName, boolean debug) throws SQLException { + LinkedHashSet pkColumns = new LinkedHashSet<>(); + ResultSet rstPk = null; + try { + rstPk = getConn().getMetaData().getPrimaryKeys(catalog, null, tableName); + while (rstPk.next()) { + String columnName = rstPk.getString("COLUMN_NAME"); + pkColumns.add(columnName); + printDebug(debug, "initBean " + tableName + " primaryKey : " + columnName); + } + if (pkColumns.isEmpty()) + handleDebug("WARNING!!!! Table " + tableName + " without a primary key."); + } catch (Exception e) { + handleDebug(e, 0); + printDebug(true, "initBean ===> ERRORE!! catalog=" + catalog + " table=" + tableName + " " + e.getMessage()); + } finally { + if (rstPk != null) + try { + rstPk.close(); + } catch (Exception e) { + handleDebug(e, 0); + } + } + return pkColumns; + } + + private void ensureStandardColumns(String catalog, String tableName, boolean debug) throws SQLException { + int dbType = getApFull().getAp().getDbType(); + if (dbType == 3 || dbType == 5 || dbType == 17) { + ensureMySqlColumns(catalog, tableName, debug); + } else if (dbType == 13 || dbType == 14) { + ensureSqlServerColumns(catalog, tableName, debug); + } + } + + private void ensureMySqlColumns(String catalog, String tableName, boolean debug) throws SQLException { + Connection conn = getConn(); + PreparedStatement ps = null; + ResultSet rstColumns = null; + try { + printDebug(debug, "initBean " + tableName + " lastUpdTmst "); + rstColumns = conn.getMetaData().getColumns(catalog, null, tableName, "lastUpdTmst"); + if (!rstColumns.next()) { + rstColumns.close(); + ps = conn.prepareStatement("ALTER TABLE " + tableName + " ADD COLUMN lastUpdTmst TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP "); + ps.execute(); + ps.close(); + ps = null; + ps = conn.prepareStatement("UPDATE " + tableName + " SET lastUpdTmst=now()"); + try { + ps.execute(); + } catch (Exception e) { + handleDebug(e, 2); + printDebug(true, "initBean ===> ERRORE!! catalog=" + catalog + " table=" + tableName + " " + e.getMessage()); + } + ps.close(); + ps = null; + } else { + rstColumns.close(); + } + rstColumns = null; + printDebug(debug, "initBean " + tableName + " lastUpdId_user "); + rstColumns = conn.getMetaData().getColumns(catalog, null, tableName, "lastUpdId_user"); + if (!rstColumns.next()) { + rstColumns.close(); + ps = conn.prepareStatement("ALTER TABLE " + tableName + " ADD COLUMN lastUpdId_user INTEGER"); + ps.execute(); + ps.close(); + ps = null; + } else { + rstColumns.close(); + } + rstColumns = null; + printDebug(debug, "initBean " + tableName + " createTmst "); + rstColumns = conn.getMetaData().getColumns(catalog, null, tableName, "createTmst"); + if (!rstColumns.next()) { + rstColumns.close(); + ps = conn.prepareStatement("UPDATE " + tableName + " SET lastUpdTmst=now() where lastUpdTmst=0 "); + ps.execute(); + ps.close(); + ps = null; + ps = conn.prepareStatement("ALTER TABLE " + tableName + " ADD COLUMN createTmst DATETIME"); + ps.execute(); + ps.close(); + ps = null; + } else { + rstColumns.close(); + } + rstColumns = null; + printDebug(debug, "initBean " + tableName + " encodedFields "); + rstColumns = conn.getMetaData().getColumns(catalog, null, tableName, "encodedFields"); + if (!rstColumns.next()) { + rstColumns.close(); + ps = conn.prepareStatement("ALTER TABLE " + tableName + " ADD COLUMN encodedFields varchar(1000)"); + ps.execute(); + ps.close(); + ps = null; + } else { + rstColumns.close(); + } + rstColumns = null; + printDebug(debug, "initBean " + tableName + " idx_safeupdate "); + String idColumnName = "id_" + tableName.toLowerCase(); + rstColumns = conn.getMetaData().getColumns(catalog, null, tableName, idColumnName); + boolean idExists = rstColumns.next(); + rstColumns.close(); + rstColumns = null; + rstColumns = conn.getMetaData().getColumns(catalog, null, tableName, "lastUpdTmst"); + boolean lastUpdExists = rstColumns.next(); + rstColumns.close(); + rstColumns = null; + if (idExists && lastUpdExists) { + ResultSet rstIndex = conn.getMetaData().getIndexInfo(catalog, null, tableName, false, false); + boolean found = false; + while (rstIndex.next()) { + String indexName = rstIndex.getString("INDEX_NAME"); + if (("idx_safeupdate_" + tableName.toLowerCase()).equalsIgnoreCase(indexName)) { + found = true; + break; + } + } + rstIndex.close(); + if (!found) { + String createIndex = "CREATE INDEX idx_safeupdate_" + tableName.toLowerCase() + " ON " + tableName + " (" + idColumnName + ", lastUpdTmst)"; + ps = conn.prepareStatement(createIndex); + ps.execute(); + ps.close(); + ps = null; + } + } + } catch (Exception e) { + handleDebug(e, 2); + printDebug(true, "initBean ===> ERRORE!! catalog=" + catalog + " table=" + tableName + " " + e.getMessage()); + } finally { + if (rstColumns != null) + try { + rstColumns.close(); + } catch (Exception e) { + handleDebug(e, 0); + printDebug(true, "ERRORE!! catalog=" + catalog + " table=" + tableName + " " + e.getMessage()); + } + if (ps != null) + try { + ps.close(); + } catch (Exception e) { + handleDebug(e, 0); + printDebug(true, "ERRORE!! catalog=" + catalog + " table=" + tableName + " " + e.getMessage()); + } + } + } + + private Set loadForeignKeys(String catalog, String tableName, boolean debug) throws SQLException { + Set fkColumns = new HashSet<>(); + ResultSet rstFk = null; + try { + rstFk = getConn().getMetaData().getImportedKeys(catalog, null, tableName); + if (!rstFk.isBeforeFirst()) { + rstFk.close(); + rstFk = getConn().getMetaData().getImportedKeys(catalog, null, tableName.toLowerCase()); + } + while (rstFk.next()) { + String columnName = rstFk.getString("FKCOLUMN_NAME"); + fkColumns.add(columnName); + printDebug(debug, "initBean " + tableName + " foreignKey : " + columnName); + } + } catch (Exception e) { + handleDebug(e, 2); + printDebug(true, "initBean ===> ERRORE!! catalog=" + catalog + " table=" + tableName + " " + e.getMessage()); + } finally { + if (rstFk != null) + try { + rstFk.close(); + } catch (Exception e) { + handleDebug(e, 0); + } + } + return fkColumns; + } + + private void ensureSqlServerColumns(String catalog, String tableName, boolean debug) throws SQLException { + Connection conn = getConn(); + PreparedStatement ps = null; + ResultSet rstColumns = null; + try { + printDebug(debug, "initBean " + tableName + " lastUpdTmst "); + rstColumns = conn.getMetaData().getColumns(catalog, null, tableName, "lastUpdTmst"); + if (!rstColumns.next()) { + rstColumns.close(); + ps = conn.prepareStatement("ALTER TABLE " + tableName + " ADD lastUpdTmst datetime"); + ps.execute(); + ps.close(); + ps = null; + ps = conn.prepareStatement("UPDATE " + tableName + " SET lastUpdTmst=GETDATE()"); + ps.execute(); + ps.close(); + ps = null; + } else { + rstColumns.close(); + } + rstColumns = null; + printDebug(debug, "initBean " + tableName + " colLastUpdIdUser "); + rstColumns = conn.getMetaData().getColumns(catalog, null, tableName, "lastUpdId_user"); + if (!rstColumns.next()) { + rstColumns.close(); + ps = conn.prepareStatement("ALTER TABLE " + tableName + " ADD lastUpdId_user INTEGER"); + ps.execute(); + ps.close(); + ps = null; + } else { + rstColumns.close(); + } + rstColumns = null; + printDebug(debug, "initBean " + tableName + " createtmst "); + rstColumns = conn.getMetaData().getColumns(catalog, null, tableName, "createTmst"); + if (!rstColumns.next()) { + rstColumns.close(); + ps = conn.prepareStatement("ALTER TABLE " + tableName + " ADD createTmst datetime"); + ps.execute(); + ps.close(); + ps = null; + } else { + rstColumns.close(); + } + rstColumns = null; + printDebug(debug, "initBean " + tableName + " encodedfields "); + rstColumns = conn.getMetaData().getColumns(catalog, null, tableName, "encodedFields"); + if (!rstColumns.next()) { + rstColumns.close(); + ps = conn.prepareStatement("ALTER TABLE " + tableName + " ADD encodedFields varchar(1000)"); + ps.execute(); + ps.close(); + ps = null; + } else { + rstColumns.close(); + } + rstColumns = null; + printDebug(debug, "initBean " + tableName + " idx_safeupdate "); + String idColumnName = "id_" + tableName.toLowerCase(); + rstColumns = conn.getMetaData().getColumns(catalog, null, tableName, idColumnName); + boolean idExists = rstColumns.next(); + rstColumns.close(); + rstColumns = null; + rstColumns = conn.getMetaData().getColumns(catalog, null, tableName, "lastUpdTmst"); + boolean lastUpdExists = rstColumns.next(); + rstColumns.close(); + rstColumns = null; + if (idExists && lastUpdExists) { + ResultSet rstIndex = conn.getMetaData().getIndexInfo(catalog, null, tableName, false, false); + boolean found = false; + while (rstIndex.next()) { + String indexName = rstIndex.getString("INDEX_NAME"); + if (("idx_safeupdate_" + tableName.toLowerCase()).equalsIgnoreCase(indexName)) { + found = true; + break; + } + } + rstIndex.close(); + if (!found) { + String createIndex = "CREATE INDEX idx_safeupdate_" + tableName.toLowerCase() + " ON " + tableName + " (" + idColumnName + ", lastUpdTmst)"; + ps = conn.prepareStatement(createIndex); + ps.execute(); + ps.close(); + ps = null; + } + } + } catch (Exception e) { + handleDebug(e, 2); + printDebug(true, "initBean ===> ERRORE!! catalog=" + catalog + " table=" + tableName + " " + e.getMessage()); + } finally { + if (rstColumns != null) + try { + rstColumns.close(); + } catch (Exception e) { + handleDebug(e, 0); + } + if (ps != null) + try { + ps.close(); + } catch (Exception e) { + handleDebug(e, 0); + } + } + } + + public static final void printDebugQuery(ApplParmFull apFull, Timer timer, DBAdapter bean) { + boolean calledFromApplParm = Arrays.stream(Thread.currentThread().getStackTrace()) + .anyMatch(e -> e.getClassName().contains("db.ApplParm")); + if (!calledFromApplParm) { + long debugQuery = apFull.getParm("DEBUG_QUERY_ENABLE").getNumeroLong(); + long slowQueryMs = apFull.getParm("DEBUG_QUERY_SLOW_MILLISEC").getNumeroLong(); + System.out.println("###### durata query:" + timer.getDurataMilliSec()); + if (debugQuery > 0L && (debugQuery == 2L || (debugQuery == 1L && slowQueryMs > 0L && + timer.getDurataMilliSec() > slowQueryMs))) { + StringBuilder sb = new StringBuilder(); + String methodName = Thread.currentThread().getStackTrace()[2].getMethodName(); + if (methodName.indexOf("findRows") >= 0) + methodName = Thread.currentThread().getStackTrace()[3].getMethodName(); + sb.append(">>>>>>>>>>>>>>>>>>>>>>\n"); + sb.append(bean.getClassName()); + sb.append("."); + sb.append(methodName); + sb.append("\n"); + sb.append(apFull.getReqUrl()); + sb.append("\n"); + java.util.Date d = new java.util.Date(System.currentTimeMillis()); + sb.append(d.toString()); + sb.append("\nip: "); + sb.append(apFull.getReqIpAddress()); + sb.append("\n"); + sb.append(bean.getSqlQuery()); + if (slowQueryMs > 0L && timer.getDurataMilliSec() > slowQueryMs) { + sb.append("\nSLOW QUERY! ("); + sb.append(slowQueryMs); + sb.append(" ms)"); + } + sb.append("\nDurata query: ms "); + sb.append(timer.getDurataMilliSec()); + sb.append("\n<<<<<<<<<<<<"); + System.out.println(sb.toString()); + } + } + } + + public static final int countStringInString(String search, String text) { + Pattern pattern = Pattern.compile(search); + Matcher matcher = pattern.matcher(text); + int stringOccurrences = 0; + while (matcher.find()) + stringOccurrences++; + return stringOccurrences; + } + + public static final ResParm getFileFromUrl(String urlSrc, String dest) { + ResParm rp = new ResParm(true); + try { + if (urlSrc.startsWith("https:")) { + TrustManager[] trustAllCerts = { new X509TrustManager() { + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + public void checkClientTrusted(X509Certificate[] certs, String authType) {} + + public void checkServerTrusted(X509Certificate[] certs, String authType) {} + } }; + SSLContext sc = SSLContext.getInstance("TLS"); + sc.init(null, trustAllCerts, new SecureRandom()); + HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); + URL url = new URL(urlSrc); + URLConnection connection = url.openConnection(); + FileUtils.copyURLToFile(connection.getURL(), new File(dest)); + } else { + FileUtils.copyURLToFile(new URL(urlSrc), new File(dest)); + } + } catch (Exception e) { + rp.setStatus(false); + rp.setException(e); + } + return rp; + } + + private void writeObject(ObjectOutputStream aOutputStream) throws IOException { + aOutputStream.defaultWriteObject(); + } + + public static final ResParm getFileViaFtp(String server, String user, String pass, String fileDaPrendere, String fileLocale) { + boolean debug = false; + int port = 21; + ResParm rp = new ResParm(false); + FTPClient ftp = new FTPClient(); + System.out.println("getFileViaFtp: " + server + " " + port + " " + user + " " + pass + " " + fileDaPrendere + " " + fileLocale); + try { + ftp.connect(server, port); + int reply = ftp.getReplyCode(); + if (!FTPReply.isPositiveCompletion(reply)) { + ftp.disconnect(); + rp.setMsg("FTP server refused connection."); + return rp; + } + if (!ftp.login(user, pass)) { + ftp.logout(); + rp.setMsg("FTP server refused connection."); + return rp; + } + ftp.enterRemotePassiveMode(); + ftp.enterLocalPassiveMode(); + ftp.setFileType(2); + File downloadFile = new File(fileLocale); + OutputStream os = new BufferedOutputStream(new FileOutputStream(downloadFile)); + boolean success = ftp.retrieveFile(fileDaPrendere, os); + os.close(); + if (success) { + rp.setStatus(true); + rp.setMsg("File " + fileDaPrendere + " salvato in " + fileLocale); + } else { + rp.setMsg("Errore! Impossibile salvare File " + fileDaPrendere + " in " + fileLocale); + } + } catch (IOException ex) { + System.out.println("getFileViaFtp: " + ex.getMessage()); + rp.setException(ex); + rp.setMsg(ex.getMessage()); + rp.setStatus(false); + } finally { + try { + if (ftp.isConnected()) { + ftp.logout(); + ftp.disconnect(); + } + } catch (IOException ex) { + System.out.println("getFileViaFtp: " + ex.getMessage()); + rp.setException(ex); + rp.setMsg(ex.getMessage()); + rp.setStatus(false); + } + } + return rp; + } + + public static final ResParm getFileFromUrl(String urlSrc, String dest, String l_user, String l_pwd) { + ResParm rp = new ResParm(); + try { + URL url = new URL(urlSrc); + URLConnection con = url.openConnection(); + String userPassword = l_user + ":" + l_user; + String basicAuth = new String(Base64.encodeBase64(userPassword.getBytes())); + con.setRequestProperty("Authorization", "Basic " + basicAuth); + con.setRequestProperty("REQUEST_METHOD", "POST"); + con.setDoInput(true); + con.setDoOutput(true); + con.setUseCaches(true); + con.setRequestProperty("Content-Type", "multipart-formdata"); + DataInputStream dataIn = new DataInputStream(con.getInputStream()); + BufferedOutputStream buffOut = new BufferedOutputStream(new FileOutputStream(dest)); + int c = 1024; + byte[] b = new byte[c]; + int cnt = 0; + while ((cnt = dataIn.read(b)) > -1) + buffOut.write(b, 0, cnt); + buffOut.flush(); + buffOut.close(); + rp.setStatus(true); + rp.setMsg("getFileFromUrl: file " + dest + " ready."); + } catch (Exception e) { + rp.setStatus(false); + rp.setException(e); + } + return rp; + } + + public static boolean isSerializable(Object object) { + String filename = "file.ser"; + try { + FileOutputStream file = new FileOutputStream(filename); + ObjectOutputStream out = new ObjectOutputStream(file); + out.writeObject(object); + out.close(); + file.close(); + new File(filename).delete(); + return true; + } catch (IOException ex) { + System.out.println("IOException is caught: "); + ex.printStackTrace(); + ex.getMessage(); + return false; + } + } + + public String getWwwAddressParm() { + return getParm("P_WWW_ADDRESS").getTesto(); + } + + public static final ResParm getFileViaSFtp(String server, int port, String user, String pass, String fileDaPrendere, String fileLocale) { + boolean debug = false; + port = (port <= 0) ? 22 : port; + ResParm rp = new ResParm(false); + System.out.println("getFileViaSFtp: " + server + " " + port + " " + user + " " + pass + " " + fileDaPrendere + " " + fileLocale); + JSch jsch = new JSch(); + Session session = null; + ChannelSftp sftpChannel = null; + try { + session = jsch.getSession(user, server); + session.setConfig("StrictHostKeyChecking", "no"); + session.setPassword(pass); + session.connect(); + Channel channel = session.openChannel("sftp"); + channel.connect(); + sftpChannel = (ChannelSftp)channel; + sftpChannel.get(fileDaPrendere, fileLocale); + sftpChannel.exit(); + rp.setStatus(true); + } catch (Exception ex) { + System.out.println("getFileViaSFtp: " + ex.getMessage()); + rp.setException(ex); + rp.setMsg(ex.getMessage()); + rp.setStatus(false); + } finally { + try { + if (session.isConnected()) + sftpChannel.exit(); + } catch (Exception ex) { + System.out.println("getFileViaSFtp: " + ex.getMessage()); + rp.setException(ex); + rp.setMsg(ex.getMessage()); + rp.setStatus(false); + } + } + return rp; + } + + public static final ResParm sendFileViaFtp(String server, String user, String pass, String fileDainviare, String fileRemoto) { + return sendFileViaFtp(server, user, pass, true, true, 10000, 20000, fileDainviare, fileRemoto); + } + + public static final ResParm sendFileViaFtp(String server, String user, String pass, boolean isLocalPassive, boolean isRemotePassive, int activeMinPort, int activeMaxPort, String fileDainviare, String fileRemoto) { + boolean debug = false; + int port = 21; + ResParm rp = new ResParm(false); + FTPClient ftp = new FTPClient(); + System.out.println("sendFileViaFtp: " + server + " " + port + " " + user + " " + pass + " " + fileDainviare + " --> " + fileRemoto); + try { + ftp.connect(server, port); + int reply = ftp.getReplyCode(); + if (!FTPReply.isPositiveCompletion(reply)) { + ftp.disconnect(); + rp.setMsg("FTP server refused connection."); + return rp; + } + if (!ftp.login(user, pass)) { + ftp.logout(); + rp.setMsg("FTP server refused connection."); + return rp; + } + if (isRemotePassive) + ftp.enterRemotePassiveMode(); + if (isLocalPassive) + ftp.enterLocalPassiveMode(); + if (activeMinPort > 0 && activeMaxPort > activeMinPort) + ftp.setActivePortRange(activeMinPort, activeMaxPort); + ftp.setFileType(2); + File uploadFile = new File(fileDainviare); + BufferedInputStream bis = new BufferedInputStream(new FileInputStream(uploadFile)); + boolean success = ftp.storeFile(fileRemoto, bis); + bis.close(); + if (success) { + rp.setStatus(true); + rp.setMsg("File " + fileDainviare + " inviato con nome " + fileRemoto); + } else { + rp.setMsg("Errore! Impossibile inviare File " + fileDainviare); + } + } catch (IOException ex) { + System.out.println("sendFileViaFtp: " + ex.getMessage()); + rp.setException(ex); + rp.setMsg(ex.getMessage()); + rp.setStatus(false); + } finally { + try { + if (ftp.isConnected()) { + ftp.logout(); + ftp.disconnect(); + } + } catch (IOException ex) { + System.out.println("sendFileViaFtp: " + ex.getMessage()); + rp.setException(ex); + rp.setMsg(ex.getMessage()); + rp.setStatus(false); + } + } + return rp; + } + + public static final synchronized ResParm convertXlsToCsv(ApplParmFull apFull, String filenameXls, String filenameCsv) { + String TAG_THREAD_MSG = "XLS TO CSV "; + Timer timer = new Timer(); + timer.start(); + StatusMsg.updateMsgByTag(apFull, "XLS TO CSV ", "...inizio ..."); + ResParm rp = new ResParm(true); + String SEP = ";"; + long totRighe = 0L; + int i = 0; + int se1 = 10; + int se2 = 100; + try { + Workbook wb = null; + wb = Workbook.getWorkbook(new File(filenameXls)); + Sheet sheet = wb.getSheet(0); + int numero_righe_vuote = 0; + int numero_colonne_vuote = 0; + boolean noMoreCols = false; + i = 0; + int col = 0; + FileWr outCvsFile = new FileWr(filenameCsv, "UTF-8", false); + while (numero_righe_vuote < 10) { + totRighe++; + StringBuilder currentLine = new StringBuilder(); + numero_colonne_vuote = 0; + col = 0; + noMoreCols = false; + while (numero_colonne_vuote < 10 && !noMoreCols) { + try { + Cell currentcCell = sheet.getCell(col, i); + if (currentcCell.getContents().isEmpty()) + numero_colonne_vuote++; + currentLine.append(currentcCell.getContents()); + currentLine.append(";"); + } catch (Exception e) { + numero_colonne_vuote++; + } + col++; + } + if (currentLine.length() == 0) { + numero_righe_vuote++; + } else { + outCvsFile.writeLine(currentLine.toString()); + } + StatusMsg.updateMsgByTag(apFull, "XLS TO CSV ", " righe processate: " + i + " righe vuote: " + numero_righe_vuote); + i++; + if (se1 > 0 && i % se1 == 0) + System.out.print("."); + if (se2 > 0 && i % se2 == 0) + System.out.println(i); + } + outCvsFile.closeFile(); + System.out.println("Fine"); + totRighe = (long)i; + } catch (Exception e) { + System.out.println("ERRORE!!! riga " + i + " " + e.getMessage()); + rp.setStatus(false); + rp.setMsg(e); + } + timer.stop(); + StatusMsg.updateMsgByTag(apFull, "XLS TO CSV ", "Conversione xsl avvenuto con successo. Righe processate: " + totRighe + " durata: " + + timer.getDurataSec() + " sec."); + StatusMsg.deleteMsgByTag(apFull, "XLS TO CSV "); + return rp; + } + + public static final String getFontColoreHex(String backgroundColor) { + String BLACK = "000"; + if (backgroundColor.isEmpty()) + return "000"; + if (backgroundColor.startsWith("#")) + backgroundColor = backgroundColor.substring(1); + if (backgroundColor.length() == 6) { + double r = (double)Integer.parseInt(backgroundColor.substring(0, 2), 16) / 255.0D; + double g = (double)Integer.parseInt(backgroundColor.substring(2, 4), 16) / 255.0D; + double b = (double)Integer.parseInt(backgroundColor.substring(4, 6), 16) / 255.0D; + double col = 0.213D * r + 0.715D * g + 0.072D * b; + String ret = "000"; + if (col < 0.5D) { + ret = "FFF"; + } else { + ret = "000"; + } + return ret; + } + return "000"; + } + + public static final ResParm encryptPdf(String user, String pwd, String src, String dest) { + ResParm rp = new ResParm(true); + try { + PDDocument document = PDDocument.load(new File(src)); + AccessPermission accessPermission = new AccessPermission(); + StandardProtectionPolicy policy = new StandardProtectionPolicy(pwd, user, accessPermission); + policy.setEncryptionKeyLength(256); + policy.setPermissions(accessPermission); + document.protect((ProtectionPolicy)policy); + document.save(dest); + document.close(); + if (!new File(dest).exists()) { + rp.setStatus(false); + rp.setMsg("Errore. Non trovo il file criptato " + dest); + } + } catch (Exception e) { + e.printStackTrace(); + rp.setStatus(false); + rp.setException(e); + } + return rp; + } + + public String getBeanNotes() { + return (this.beanNotes == null) ? "" : this.beanNotes.trim(); + } + + public void setBeanNotes(String beanNotes) { + this.beanNotes = beanNotes; + } + + public static final double arrotonda(double prezzo, double decimale) { + DoubleOperator round = new DoubleOperator(prezzo); + round.divide(decimale); + round.setScale(0, 2); + DoubleOperator value = new DoubleOperator(decimale); + value.setScale(2, 5); + value.multiply(round.getResult()); + return value.getResult(); + } + + public static String replaceLast(String text, String source, String target) { + StringBuilder b = new StringBuilder(text); + b.replace(text.lastIndexOf(source), text.lastIndexOf(source) + source.length(), target); + return b.toString(); + } + + public static ResParm getJSONObjectFromUrl(String urlSrc) { + boolean debug = false; + ResParm rp = new ResParm(); + try { + if (debug) + System.out.println("DBAdapter --> getJSONObjectFromUrl"); + CloseableHttpClient closeableHttpClient = HttpClientBuilder.create().build(); + HttpGet request = new HttpGet(urlSrc); + request.setHeader("Accept-Encoding", "application/gzip"); + HttpResponse resp = closeableHttpClient.execute((HttpUriRequest)request); + String content = EntityUtils.toString(resp.getEntity()); + int statusCode = resp.getStatusLine().getStatusCode(); + if (statusCode == 200) { + JSONObject jo = new JSONObject(content); + rp.setStatus(true); + rp.setReturnObj(jo); + } else { + rp.setMsg(content); + rp.setStatus(false); + } + } catch (Exception e) { + System.out.println(e.getMessage()); + e.printStackTrace(); + rp.setMsg(e); + rp.setStatus(false); + } + return rp; + } + + public long getFlgMobileView() { + return this.flgMobileView; + } + + public void setFlgMobileView(long flgMobileView) { + this.flgMobileView = flgMobileView; + } + + public Vectumerator findAll(int pageNumber, int pageRows) { + Vectumerator vec = AB_EMPTY_VECTUMERATOR; + if (checkProfile(getTableBeanName()) <= 0L) { + handleDebug(AbMessages.getMessage(getCurrentLocale(), "GRANT_NO_R")); + return vec; + } + String sql = sqlStringfindAll(); + handleDebug(sql, 5); + PreparedStatement ps = null; + boolean forceRemove = false; + try { + ps = getConn().prepareStatement(sql); + vec = findRows(ps, pageNumber, pageRows); + } catch (SQLException sqle) { + forceRemove = true; + if ("08S01".equals(sqle.getSQLState())) + removeCPConnection(); + handleDebug(sqle, 0); + } catch (Exception e) { + forceRemove = true; + handleDebug(e, 2); + } + return vec; + } + + public static final String convertPathToCurrentFileSystemSeparator(String theFilePath) { + String temp; + if (SEPARATOR.equals("\\")) { + if (theFilePath.indexOf("/") >= 0) { + temp = theFilePath.replace('/', '\\'); + } else { + temp = theFilePath; + } + while (temp.indexOf("\\\\") >= 0) + temp = temp.replace("\\\\", "\\"); + return temp; + } + if (theFilePath.indexOf("\\") >= 0) { + temp = theFilePath.replace('\\', '/'); + } else { + temp = theFilePath; + } + while (temp.indexOf("//") >= 0) + temp = temp.replace("//", "/"); + return temp; + } + + public long getCurrentTabId() { + return this.currentTabId; + } + + public void setCurrentTabId(long currentTabId) { + this.currentTabId = currentTabId; + } + + public boolean isCurrentTabIdOk(long l_theTabid) { + if (getCurrentTabId() == 0L) + return true; + return (getCurrentTabId() == l_theTabid); + } + + public String getDescRecordHeader() { + if (getApFull() != null) { + StringBuffer sb = new StringBuffer(); + sb.append("\n"); + try { + LinkedHashMap primaryKeyDescriptors = initTableDescriptorDbPk.get(getApFull().getAp().getApCode(this)); + if (primaryKeyDescriptors != null) { + for (ColumnDescriptor cd : primaryKeyDescriptors.values()) { + sb.append(cd.getColumnName()); + sb.append(spaceLeft("|", Math.max(1, 40 - cd.getColumnName().length()))); + } + } else { + sb.append("ERROR! primaryKeyDescriptors null!!"); + } + Hashtable columneDescriptor = initTableDescriptorDb.get(getApFull().getAp().getApCode(this)); + if (columneDescriptor != null) { + Enumeration enu = columneDescriptor.elements(); + while (enu.hasMoreElements()) { + ColumnDescriptor cd = enu.nextElement(); + sb.append(cd.getColumnName()); + sb.append(spaceLeft("|", Math.max(1, 40 - cd.getColumnName().length()))); + } + } else { + sb.append("ERROR! columneDescriptor null!!"); + } + } catch (Exception e) { + sb.append("\nErrore! \n"); + sb.append(e.getMessage()); + } + return sb.toString().trim(); + } + return "No ap --"; + } + + public String getDescRecordLine() { + if (getApFull() != null) { + StringBuffer sb = new StringBuffer(); + sb.append("\n"); + try { + LinkedHashMap primaryKeyDescriptors = initTableDescriptorDbPk.get(getApFull().getAp().getApCode(this)); + if (primaryKeyDescriptors != null) { + for (ColumnDescriptor cd : primaryKeyDescriptors.values()) { + String temp = String.valueOf(cd.getGetMethod().invoke(this, null)); + sb.append(temp); + sb.append(spaceLeft("|", Math.max(1, 40 - temp.length()))); + } + } else { + sb.append("ERROR! primaryKeyDescriptors null!!"); + } + Hashtable columneDescriptor = initTableDescriptorDb.get(getApFull().getAp().getApCode(this)); + if (columneDescriptor != null) { + Enumeration enu = columneDescriptor.elements(); + while (enu.hasMoreElements()) { + ColumnDescriptor cd = enu.nextElement(); + String temp = String.valueOf(cd.getGetMethod().invoke(this, null)); + sb.append(temp); + sb.append(spaceLeft("|", Math.max(1, 40 - temp.length()))); + } + } else { + sb.append("ERROR! columneDescriptor null!!"); + } + } catch (Exception e) { + sb.append("\nErrore! \n"); + sb.append(e.getMessage()); + } + return sb.toString().trim(); + } + return "Ap null "; + } + + public static final ResParm sendFileViaFtps(String server, int port, String md5, String user, String pass, String fileDainviare, String fileRemoto) { + boolean debug = false; + String protocol = "ssl"; + ResParm rp = new ResParm(false); + FTPSClient ftp = new FTPSClient(protocol, false); + ftp.addProtocolCommandListener(new PrintCommandListener(new PrintWriter(System.out), true)); + ftp.setTrustManager(TrustManagerUtils.getAcceptAllTrustManager()); + ftp.setStrictReplyParsing(true); + System.out.println("sendFileViaFtp: " + server + " " + port + " " + user + " " + pass + " " + fileDainviare + " --> " + fileRemoto); + try { + ftp.connect(server, port); + int reply = ftp.getReplyCode(); + if (!FTPReply.isPositiveCompletion(reply)) { + ftp.disconnect(); + rp.setMsg("FTP server refused connection."); + return rp; + } + if (!ftp.login(user, pass)) { + ftp.logout(); + rp.setMsg("FTP server refused connection."); + return rp; + } + ftp.enterRemotePassiveMode(); + ftp.enterLocalPassiveMode(); + ftp.setFileType(2); + File uploadFile = new File(fileDainviare); + BufferedInputStream bis = new BufferedInputStream(new FileInputStream(uploadFile)); + boolean success = ftp.storeFile(fileRemoto, bis); + bis.close(); + if (success) { + rp.setStatus(true); + rp.setMsg("File " + fileDainviare + " inviato con nome " + fileRemoto); + } else { + rp.setMsg("Errore! Impossibile inviare File " + fileDainviare); + } + } catch (IOException ex) { + System.out.println("sendFileViaFtp: " + ex.getMessage()); + rp.setException(ex); + rp.setMsg(ex.getMessage()); + rp.setStatus(false); + } finally { + try { + if (ftp.isConnected()) { + ftp.logout(); + ftp.disconnect(); + } + } catch (IOException ex) { + System.out.println("sendFileViaFtp: " + ex.getMessage()); + rp.setException(ex); + rp.setMsg(ex.getMessage()); + rp.setStatus(false); + } + } + return rp; + } + + public static final ResParm sendFileViaSFtp(String server, int port, String knownHostPublicKey, String user, String pass, String fileDainviare, String fileRemoto) { + boolean debug = false; + int SESSION_TIMEOUT = 10000; + int CHANNEL_TIMEOUT = 5000; + ResParm rp = new ResParm(false); + Session jschSession = null; + Channel sftp = null; + ChannelSftp channelSftp = null; + System.out.println("sendFileViaSFtp: " + server + " " + port + " " + user + " " + pass + " " + fileDainviare + " --> " + fileRemoto); + try { + JSch jsch = new JSch(); + Properties config = new Properties(); + if (knownHostPublicKey != null && !knownHostPublicKey.isEmpty()) { + jsch.setKnownHosts(new ByteArrayInputStream(knownHostPublicKey.getBytes(StandardCharsets.UTF_8))); + config.put("StrictHostKeyChecking", "yes"); + } else { + config.put("StrictHostKeyChecking", "no"); + } + jschSession = jsch.getSession(user, server, port); + jschSession.setConfig(config); + jschSession.setPassword(pass); + jschSession.connect(10000); + sftp = jschSession.openChannel("sftp"); + sftp.connect(5000); + channelSftp = (ChannelSftp)sftp; + channelSftp.put(fileDainviare, fileRemoto); + channelSftp.exit(); + } catch (JSchException|com.jcraft.jsch.SftpException ex) { + System.out.println("sendFileViaSFtp: " + ex.getMessage()); + rp.setException(ex); + rp.setMsg(ex.getMessage()); + rp.setStatus(false); + } finally { + try { + if (channelSftp != null) + channelSftp.exit(); + } catch (Exception ex) { + System.out.println("sendFileViaSFtp: " + ex.getMessage()); + rp.setException(ex); + rp.setMsg(ex.getMessage()); + rp.setStatus(false); + } + } + return rp; + } + + public long getPathIdStep() { + return getParm("PATH_IMG_STEP_ID").getNumeroLong(); + } + + public String getPathIdStepDir() { + if (getPathIdStep() <= 0L) + return ""; + if (get_IdL() > 0L); + return "_" + getPathIdStep() * (get_IdL() / getPathIdStep() + 1L) + "/"; + } + + public static final TreeSet generateImageFromPDF(String filenamePdf, String targetDir, String extension, boolean grayScale, ApplParmFull apFull, String TAG_THREAD_MSG) { + try { + if (apFull != null) + StatusMsg.updateMsgByTag(apFull, TAG_THREAD_MSG, "Ceazione immagini da pdf " + filenamePdf + " in corso ...."); + TreeSet res = new TreeSet<>(); + File filePdf = new File(filenamePdf); + String fileNamePdf = filePdf.getName(); + PDDocument document = PDDocument.load(filePdf); + PDFRenderer pdfRenderer = new PDFRenderer(document); + for (int page = 0; page < document.getNumberOfPages(); page++) { + try { + BufferedImage bim; + if (grayScale) { + bim = pdfRenderer.renderImageWithDPI(page, 300.0F, ImageType.GRAY); + } else { + bim = pdfRenderer.renderImageWithDPI(page, 300.0F, ImageType.RGB); + } + String currentFile = String.format(filePdf.getName() + "-%d.%s", page + 1, extension); + String currentFileFull = targetDir + targetDir; + System.out.println(currentFile); + res.add(currentFileFull); + ImageIOUtil.writeImage(bim, currentFileFull, 300); + if (apFull != null) + StatusMsg.updateMsgByTag(apFull, TAG_THREAD_MSG, "Ceazione immagini da pdf " + fileNamePdf + " -----> " + currentFile + " (" + page + 1 + "/" + + document.getNumberOfPages() + ")"); + } catch (Exception e) { + e.printStackTrace(); + } + } + document.close(); + StatusMsg.updateMsgByTag(apFull, TAG_THREAD_MSG, "Ceazione immagini da pdf " + fileNamePdf + " concluso..."); + return res; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + public static final TreeSet generateImageFromPDF(String filenamePdf, String targetDir, String extension, boolean grayScale) { + return generateImageFromPDF(filenamePdf, targetDir, extension, grayScale, null, null); + } + + public static final TreeSet generateImageFromPDF(String filenamePdf, String targetDir, String extension) { + return generateImageFromPDF(filenamePdf, targetDir, extension, false, null, null); + } + + public String getStringValueOfField(String theField) { + DBAdapter currentObj = this; + Object resObj = ""; + String res = ""; + StringTokenizer st = new StringTokenizer(theField, "."); + try { + while (st.hasMoreTokens()) { + String currentField = st.nextToken(); + String getMethodName = "get" + currentField.substring(0, 1).toUpperCase() + currentField.substring(1); + Method getMth = currentObj.getClass().getMethod(getMethodName, null); + resObj = getMth.invoke(currentObj, null); + if (st.hasMoreTokens()) { + if (resObj instanceof DBAdapter) { + currentObj = (DBAdapter)resObj; + continue; + } + handleDebug("getStringValueOfField: " + theField + " probabilmente errato", 1); + break; + } + } + if (resObj instanceof String) { + res = (String)resObj; + } else if (resObj instanceof Long) { + res = String.valueOf(resObj); + } else if (resObj instanceof Double) { + res = getNf().format(resObj); + } else if (resObj instanceof Date) { + res = getDataFormat().format((Date)resObj); + } else if (resObj instanceof Integer) { + res = String.valueOf(resObj); + } else if (resObj instanceof Time) { + res = getTimeFormat().format((Time)resObj); + } else if (resObj instanceof Float) { + res = getNf().format(resObj); + } else { + res = String.valueOf(resObj); + } + } catch (Exception e) { + e.printStackTrace(); + } + return res; + } + + public ApplParmFull getApFullCache() { + if (this.apFullCache == null && getApFull() != null) { + ApplParm apTemp = getApFull().getAp(); + ApplParm apCache = new ApplParm(apTemp.getDbType(), apTemp.getDatabase() + "_cache", apTemp.getCatalog() + "_cache", + apTemp.getUser(), apTemp.getPassword(), apTemp.getInitialCons(), apTemp.getMaxCons(), apTemp.getTimeout()); + this.apFullCache = new ApplParmFull(apCache); + } + return this.apFullCache; + } + + public static final String getLocalHostname() { + String hostname; + try { + hostname = InetAddress.getLocalHost().getHostName(); + } catch (Exception e) { + hostname = "N/A"; + } + return hostname; + } + + @Deprecated + public static final ResParm encryptPdfOldLowagie(String user, String pwd, String src, String dest) { + ResParm rp = new ResParm(true); + try { + System.out.println("invio referto 71 " + src + " dest: " + dest); + PdfReader reader = new PdfReader(src); + System.out.println("invio referto 72"); + PdfStamper stamper = new PdfStamper(reader, new FileOutputStream(dest)); + System.out.println("invio referto 73"); + System.out.println("invio referto 73 bis PdfWriter.ALLOW_PRINTING: 2052"); + System.out.println("invio referto 73 ter PdfWriter.ENCRYPTION_AES_128: 2"); + System.out.println("invio referto 73 4 user: " + user); + System.out.println("invio referto 73 5 pwd: " + pwd); + System.out.println("invio referto 73 6 stamper: " + String.valueOf(stamper)); + try { + stamper.setEncryption(user.getBytes(), pwd.getBytes(), 2052, 2); + } catch (Exception e) { + System.out.println("invio referto 73 7 exc: " + e.getMessage()); + e.printStackTrace(); + } + System.out.println("invio referto 74"); + stamper.close(); + reader.close(); + System.out.println("invio referto 75"); + if (!new File(dest).exists()) { + System.out.println("invio referto 76"); + rp.setStatus(false); + rp.setMsg("Errore. Non trovo il file criptato " + dest); + } + } catch (Exception e) { + System.out.println("invio referto 77"); + e.printStackTrace(); + rp.setStatus(false); + rp.setException(e); + } + return rp; + } + + public static final ResParm exeqSqlFile(ApplParmFull apFull, File file, String tagMsg) { + ResParm rp = new ResParm(); + StringBuilder logMsg = new StringBuilder("Escuzione query file " + file.getName()); + boolean status = true; + Parm parm = new Parm(apFull); + try { + BufferedReader reader = new BufferedReader(new FileReader(file.getAbsolutePath())); + StringBuilder queryBuilder = new StringBuilder(); + int queryNumber = 0, lineNumber = 0; + String line; + while ((line = reader.readLine()) != null) { + lineNumber++; + if (!line.startsWith("#")) { + if (!line.equals("GO")) { + queryBuilder.append(line.trim()); + queryBuilder.append(" "); + } + if (line.endsWith(";") || line.equals("GO")) { + queryNumber++; + StatusMsg.appendMsgByTag(apFull, tagMsg, "File " + + file.getName() + " Linea " + lineNumber + " query " + queryNumber); + System.out.println("****************************************************\nexeqSqlFile:" + file.getName() + " eseguo query\n" + + queryBuilder.toString()); + rp = parm.update(queryBuilder.toString()); + if (!rp.getStatus()) { + status = false; + System.out.println(queryBuilder.toString() + "\n" + queryBuilder.toString()); + logMsg.append("\n"); + logMsg.append("Linea " + lineNumber + " query " + queryNumber + "\n" + queryBuilder.toString()); + logMsg.append("\n"); + logMsg.append("Errore: " + rp.getMsg()); + break; + } + queryBuilder.setLength(0); + } + } + } + logMsg.append("\n"); + logMsg.append("Fine esecuzione di " + queryNumber + " query di aggiornamento."); + } catch (Exception e) { + e.printStackTrace(); + logMsg.append("\n"); + logMsg.append("Eccezione: " + e.getMessage()); + } + logMsg.append("\n"); + logMsg.append("-----------------------------------------------"); + rp.setMsg(logMsg.toString()); + System.out.println(rp.getMsg()); + rp.setStatus(status); + return rp; + } + + public static void println(String testo) { + System.out.println(testo); + } + + public static void printDebug(String testo) { + printDebug(true, testo); + } + + public static void printDebug(boolean debug, String testo) { + if (debug) { + StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); + String callerClassName = stackTrace[2].getClassName(); + System.out.println(getNowTsB() + getNowTsB() + ": " + callerClassName + " "); + } + } + + public static void println(long testo) { + System.out.println(testo); + } + + public static void print(String testo) { + System.out.print(testo); + } + + public static void print(long testo) { + System.out.print(testo); + } + + public static final String getCompleteRequestUrl(HttpServletRequest request) { + String res = request.getScheme() + "://" + request.getScheme() + request.getServerName(); + return res; + } + + public static final boolean isRequestCanonical(HttpServletRequest request, String canonical) { + String noSchemeUrl = "://" + request.getServerName() + String.valueOf(request.getAttribute("javax.servlet.forward.request_uri")); + return canonical.endsWith(noSchemeUrl); + } + + public static final String getYesNo(long l_flg) { + if (l_flg == -1L) + return ""; + if (l_flg == 0L) + return "No"; + if (l_flg == 1L) + return "Si"; + return "??"; + } + + public static final String compressText(String text) throws IOException { + byte[] data = text.getBytes(); + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(data.length); + try (DeflaterOutputStream deflaterOutputStream = new DeflaterOutputStream(byteArrayOutputStream)) { + deflaterOutputStream.write(data); + } + return byteArrayOutputStream.toString("ISO-8859-1"); + } + + public static final String decompressText(String compressedText) throws IOException { + byte[] compressedData = compressedText.getBytes("ISO-8859-1"); + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(compressedData); + try (InflaterInputStream inflaterInputStream = new InflaterInputStream(byteArrayInputStream)) { + ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + int data; + while ((data = inflaterInputStream.read()) != -1) + byteArrayOutputStream.write(data); + return byteArrayOutputStream.toString(); + } + } + + public static boolean isNullOrEmpty(String str) { + return (str == null || str.length() == 0); + } + + public static int countOccurrences(String text, String target) { + int count = 0; + int index = 0; + while ((index = text.indexOf(target, index)) != -1) { + count++; + index += target.length(); + } + return count; + } + + public static final void sleepInSecond(int secondi) { + try { + printDebug(" sleepInSecond: " + secondi + "...."); + Thread.sleep((long)(secondi * 1000)); + printDebug(" sleepInSecond: " + secondi + " DONE"); + } catch (InterruptedException e) { + e.printStackTrace(); + printDebug(" sleepInSecond: " + secondi + " ERRORE: " + e.getMessage()); + } + } + + public static final void sleepInMilliSecond(int ms) { + try { + Thread.sleep((long)ms); + } catch (InterruptedException e) { + e.printStackTrace(); + printDebug(" sleepInMilliSecond: " + ms + " ERRORE: " + e.getMessage()); + } + } + + public static final String getPathFromFileName(String theFile) { + int idx = theFile.lastIndexOf("/"); + if (idx < 0) + idx = theFile.lastIndexOf("/"); + if (idx < 0) + return ""; + return theFile.substring(0, idx); + } + + public static final String getFileMd5(String filename) { + if (new File(filename).exists()) { + FileHash fh = new FileHash(filename, "MD5"); + return fh.getFileHash(); + } + return ""; + } + + public static String gsonToString(JsonObject jsonData) { + Gson gson = new GsonBuilder().setPrettyPrinting().create(); + StringWriter writer = new StringWriter(); + gson.toJson((JsonElement)jsonData, writer); + return writer.toString().replaceAll("(?m)^ ", " "); + } + + public static final String removeDuplicates(String input, String separator) { + if (input == null || input.isEmpty()) + return ""; + String[] parts = input.split(separator); + Set uniqueSet = new LinkedHashSet<>(); + for (String part : parts) + uniqueSet.add(part.trim()); + return String.join(separator, uniqueSet); + } + + public static JsonObject tryParseJsonObject(String json) { + try { + JsonElement parsed = JsonParser.parseString(json); + if (parsed.isJsonObject()) + return parsed.getAsJsonObject(); + printDebug("Il contenuto è JSON valido ma non è un oggetto JSON."); + } catch (JsonSyntaxException|IllegalStateException e) { + printDebug("Errore nel parsing del JSON:"); + printDebug(json); + e.printStackTrace(); + } + return null; + } + + public static void checkSerializable(Object obj) { + try(ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos)) { + oos.writeObject(obj); + System.out.println("Oggetto serializzabile correttamente."); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static ThreadLocal getThreadLocal(String l_apCode) { + return threadLocalConnsByCode.computeIfAbsent(l_apCode, k -> new ThreadLocal()); + } + + public final String getVersionDBLte4() { + try { + Parm parm = new Parm(getApFull()); + return parm.getDbVersionsLte4(); + } catch (Exception e) { + return "NO DB SET"; + } + } + + public String getVersionLibLte4() { + try { + Parm parm = new Parm(getApFull()); + return parm.getLibVersionsLte4(); + } catch (Exception e) { + return "NO DB SET"; + } + } + + public String getVersionLibLte4(String app) { + try { + Parm parm = new Parm(getApFull()); + return parm.getLibVersionsLte4(app); + } catch (Exception e) { + return "..."; + } + } + + public static int countJpgFiles(String directoryPath) { + File dir = new File(directoryPath); + if (!dir.exists() || !dir.isDirectory()) + return -1; + File[] files = dir.listFiles((dir1, name) -> name.toLowerCase().endsWith(".jpg")); + return (files == null) ? 0 : files.length; + } + + public void setLongPrimaryKey(long pk) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { + ColumnDescriptor cd = getPrimaryKeyDescriptor(); + if (cd == null) { + handleDebug("setLongPrimaryKey: Primary key descriptors not initialized.", 2); + return; + } + if (cd != null) + cd.getSetMethod().invoke(this, pk); + } + + private void deleteDescLangIfNeeded(long pkValue) throws Exception { + if (useDescLangTables()) { + DescTxtLang dtl = new DescTxtLang(getApFull()); + dtl.deleteByTabellaIdtabella(getTableBeanName(), pkValue); + } + } + + private void logCancellazione() { + if (isLogUserDeletes() && !getTableBeanName().startsWith("LOG")) + if (isSafeUpdateOn()) { + Log.addCancellazioneRecordLogico(this); + } else { + Log.addCancellazioneRecord(this); + } + } + + public static final String getDayTimeTimestamp() { + return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd-HH-mm")); + } + + public static final String getDayTimestamp() { + return LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + } + + public static final String convertSpacesToMinus(String input) { + return input.replace(" ", "-"); + } + + public ColumnDescriptor getPrimaryKeyDescriptor() { + if (isDatabaseBean()) { + LinkedHashMap primaryKeyDescriptors = initTableDescriptorDbPk.get(getApFull().getAp().getApCode(this)); + if (primaryKeyDescriptors == null) + return null; + if (primaryKeyDescriptors.size() == 1) + return primaryKeyDescriptors.values().iterator().next(); + return null; + } + return null; + } + + private boolean isDebugEnabled() { + return (getParm("DEBUG_QUERY_ENABLE").getNumeroLong() > 0L); + } + + protected void fillAndAddBean(ResultSet rst, Vectumerator vec) throws Exception { + DBAdapter bean = (DBAdapter)clone(); + bean.initFields(); + bean.fillFields(rst); + bean.setDBState(1); + vec.addElement(bean); + } + + public DBAdapter() {} + + protected abstract ResParm checkDeleteCascade() throws DBAdapterException, SQLException; + + protected abstract void deleteCascade(); +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBAdapterException.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBAdapterException.java new file mode 100644 index 00000000..1242abd8 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBAdapterException.java @@ -0,0 +1,66 @@ +package it.acxent.db; + +import java.sql.SQLException; + +public class DBAdapterException extends SQLException { + private ResParm rp = null; + + private boolean duplicateKeyError = false; + + private String mySQLState; + + public DBAdapterException() {} + + public DBAdapterException(Exception e) { + super(e.toString()); + } + + public DBAdapterException(String s) { + super(s); + } + + public DBAdapterException(String s, ResParm rp) { + super(s); + setRp(rp); + } + + public DBAdapterException(SQLException sqle) { + super(sqle.getMessage()); + setSQLState(sqle.getSQLState()); + if (sqle.getSQLState() != null) + if (sqle.getSQLState().equals("S1000") || + sqle.getSQLState().equals("S1009")) { + this.duplicateKeyError = true; + } else { + this.duplicateKeyError = false; + } + } + + public String getMessage() { + if (isDuplicateKeyError()) + return "Duplicated Key error!!!"; + return super.getMessage(); + } + + public ResParm getRp() { + return this.rp; + } + + public String getSQLState() { + if (this.mySQLState == null) + return super.getSQLState(); + return this.mySQLState; + } + + public boolean isDuplicateKeyError() { + return this.duplicateKeyError; + } + + private void setRp(ResParm newRp) { + this.rp = newRp; + } + + private void setSQLState(String newSQLState) { + this.mySQLState = newSQLState; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBAdapterNoDb.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBAdapterNoDb.java new file mode 100644 index 00000000..821bdf6d --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBAdapterNoDb.java @@ -0,0 +1,35 @@ +package it.acxent.db; + +public class DBAdapterNoDb extends DBAdapter { + private static final long serialVersionUID = -6061346319271726745L; + + public ResParm delete() { + return null; + } + + public void findByPrimaryKey(Object obj) {} + + public int getDBState() { + return 1; + } + + public ResParm save() { + return null; + } + + public void setNuovaIstanzaOggettoRemoto(boolean flag) {} + + public Object[] getFieldSetArg(String parmValue, Class type) { + return null; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + protected boolean isDatabaseBean() { + return false; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBAdapterSaveResponse.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBAdapterSaveResponse.java new file mode 100644 index 00000000..1a93f163 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBAdapterSaveResponse.java @@ -0,0 +1,61 @@ +package it.acxent.db; + +public class DBAdapterSaveResponse { + private String _id; + + private String lastUpdTmst; + + private String lastUpdInfo; + + private String msg; + + private boolean status; + + public DBAdapterSaveResponse(String _id, String lastUpdTmst, String lastUpdInfo, String msg, boolean status) { + this._id = _id; + this.lastUpdInfo = lastUpdInfo; + this.lastUpdTmst = lastUpdTmst; + this.msg = msg; + this.status = status; + } + + public String get_id() { + return this._id; + } + + public void set_id(String _id) { + this._id = _id; + } + + public String getMsg() { + return this.msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public String getLastUpdTmst() { + return this.lastUpdTmst; + } + + public void setLastUpdTmst(String lastUpdTmst) { + this.lastUpdTmst = lastUpdTmst; + } + + public String getLastUpdInfo() { + return this.lastUpdInfo; + } + + public void setLastUpdInfo(String lastUpdInfo) { + this.lastUpdInfo = lastUpdInfo; + } + + public boolean isStatus() { + return this.status; + } + + public void setStatus(boolean dbStatus) { + this.status = dbStatus; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBReflectAdapter.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBReflectAdapter.java new file mode 100644 index 00000000..b38e4ae9 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBReflectAdapter.java @@ -0,0 +1,46 @@ +package it.acxent.db; + +import it.acxent.util.Debug; +import it.acxent.util.SimpleDateFormat; +import java.sql.Date; +import java.text.ParseException; + +public abstract class DBReflectAdapter extends Debug implements DBReflectInterface { + private ApplParm fieldAp; + + public ApplParm getApFull() { + return this.fieldAp; + } + + public Object[] getFieldSetArg(String parmValue, Class type) throws ParseException { + Object[] retParm = { null }; + if (type.equals(String.class)) { + retParm[0] = parmValue; + } else if (type.equals(Long.class) || + type.getName().equals("long")) { + retParm[0] = new Long(parmValue); + } else if (type.equals(Integer.class) || + type.getName().equals("int")) { + retParm[0] = new Integer(parmValue); + } else if (type.equals(Double.class) || + type.getName().equals("double")) { + retParm[0] = Double.valueOf(parmValue.replace(',', '.')); + } else if (type.equals(Float.class) || + type.getName().equals("float")) { + retParm[0] = Float.valueOf(parmValue.replace(',', '.')); + } else if (type.equals(Date.class)) { + try { + retParm[0] = new Date(getApFull().getDataFormat().parse(parmValue) + .getTime()); + } catch (ParseException e) {} + retParm[0] = new Date(new SimpleDateFormat("dd/MM/yy") + + .parse(parmValue).getTime()); + } + return retParm; + } + + public void setAp(ApplParm newFieldAp) { + this.fieldAp = newFieldAp; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBReflectInterface.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBReflectInterface.java new file mode 100644 index 00000000..2e27789f --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DBReflectInterface.java @@ -0,0 +1,7 @@ +package it.acxent.db; + +import java.text.ParseException; + +public interface DBReflectInterface { + Object[] getFieldSetArg(String paramString, Class paramClass) throws ParseException; +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DbInterface.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DbInterface.java new file mode 100644 index 00000000..100ab78d --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DbInterface.java @@ -0,0 +1,67 @@ +package it.acxent.db; + +import it.acxent.common.DescLangItem; +import it.acxent.util.Vectumerator; +import java.util.Vector; + +public interface DbInterface { + ResParm delete(); + + Vectumerator findAll(); + + Vectumerator findAll(int paramInt1, int paramInt2); + + void findByPrimaryKey(Object paramObject); + + int getDBState(); + + ResParm save(); + + ResParm translateAllDbDesc(String paramString); + + String getReqIpAddress(); + + void setReqIpAddress(String paramString); + + boolean useDescLangTables(); + + boolean isGoogleTranslatorEnable(); + + void setDescTxtLangValues(Vector paramVector); + + String getCurrentFocus(); + + String getCurrentLang(); + + String getCurrentTab(); + + String getLastUpdTmstString(); + + String getLastUpdTmstForFiles(); + + String get_Id(); + + long get_IdL(); + + String get_IdName(); + + String getReqUrl(); + + String getSqlQuery(); + + String getVersionDB(); + + String getVersionDBLte(); + + String getVersionDBLte4(); + + String getVersionLib(); + + String getVersionLibLte(); + + String getVersionLibLte4(); + + String getVersionLibLte4(String paramString); + + String getVersionHtml(); +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DriversJdbc.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DriversJdbc.java new file mode 100644 index 00000000..62778912 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/DriversJdbc.java @@ -0,0 +1,144 @@ +package it.acxent.db; + +import java.io.Serializable; + +public class DriversJdbc implements Serializable { + private static final long serialVersionUID = -6271689236194338969L; + + public static final String SLQSTATE_COMMUNICATION_ERROR = "08S01"; + + public static final String SLQSTATE_SQLSERVER_LOCK_REQUEST_TIME_EXEDEED = "S0003"; + + public static final String SLQSTATE_INTEGRITY_CONSTRAINT_VIOLATION = "23000"; + + public static final String MYSQL_UTF8_CONNECTION_STRING = "?useUnicode=true&characterEncoding=UTF-8"; + + private static final int TOT_NUMBER_OF_DRIVERS = 18; + + public static final int JDBC_ODBC = 0; + + public static final int ORACLE = 1; + + public static final int HSQLDB = 2; + + public static final int MYSQL_CONNECTORJ = 3; + + public static final int POSTGRES = 4; + + public static final int MARIA_DB = 5; + + public static final int SYBASE = 6; + + public static final int INTERBASE = 7; + + public static final int DB2 = 8; + + public static final int INFORMIX = 9; + + public static final int ZYH_DBF = 10; + + public static final int ATINAV_ACCESS = 11; + + public static final int EASY_JDBC = 12; + + public static final int MS_SQL_SERVER_2000 = 13; + + public static final int MS_SQL_SERVER_2005_2008 = 14; + + public static final int PERVASIVE_PSQL_JDBC = 15; + + public static final int UCANACCESS = 16; + + public static final int MYSQL8_CONNECTORJ = 17; + + private static String[] driverDescription; + + private static String[] driverManager; + + private static String[] connectionString; + + public static final String LAST_INSERT_ID_MYSQL = "Select LAST_INSERT_ID() as id "; + + public static final String LAST_INSERT_ID_MS_SQL_SERVER = "SELECT @@IDENTITY AS id "; + + public static final String LAST_INSERT_ID_INFORMIX = "Select dbinfo('sqlca.sqlerrd1') as id from "; + + public static String getConnectionString(int i) { + if (connectionString == null) { + connectionString = new String[18]; + connectionString[0] = "jdbc:odbc"; + connectionString[1] = "jdbc:oracle"; + connectionString[2] = "jdbc:hsqldb"; + connectionString[3] = "jdbc:mysql"; + connectionString[4] = "jdbc:postgresql"; + connectionString[5] = "jdbc:mariadb"; + connectionString[6] = "jdbc:sybase:Tds"; + connectionString[7] = "jdbc:interbase"; + connectionString[8] = "jdbc:db2"; + connectionString[9] = "jdbc:informix-sqli"; + connectionString[10] = "jdbc:DBF"; + connectionString[11] = "jdbc:atinav"; + connectionString[12] = "jdbc:easysoft"; + connectionString[13] = "jdbc:microsoft:sqlserver"; + connectionString[14] = "jdbc:sqlserver"; + connectionString[15] = "jdbc:pervasive"; + connectionString[16] = "jdbc:ucanaccess"; + connectionString[17] = "jdbc:mysql"; + } + return connectionString[i]; + } + + public static String getDriverDescription(int i) { + if (driverDescription == null) { + driverDescription = new String[18]; + driverDescription[0] = "JDBC-ODBC:\t[;=] (es:UID=me;PWD=secret)"; + driverDescription[1] = "ORACLE THIN: "; + driverDescription[2] = "HSQLDB DRIVER:\thsql://[hostname] (Server Mode)\n\t\t[DatabasePath] (Stand alone)"; + driverDescription[3] = "jdbc:mysql://[hostname][,failoverhost...][:port]/[dbname][?param1=value1][¶m2=value2]"; + driverDescription[4] = "POSTGRES:\t[//[hostname]/][dbname]:"; + driverDescription[5] = "MARIA DB:\t//[hostname][:port]/[DB?user=[dbuser]&password=[dbpassword]]: "; + driverDescription[6] = "SYBASE: "; + driverDescription[7] = "INTERBASE: "; + driverDescription[8] = "DB2: "; + driverDescription[9] = "INFORMIX IFX:\t[//][host]:[port]/[dbname]:INFORMIXSERVER=[dbservername]: "; + driverDescription[10] = "ZYH DBF-FOXPRO:\t/[path to dbf files] or [//][host][:port]/[DatabasePath]: "; + driverDescription[11] = "ATINAV-ACCESS:\t[hostname]:[serverportno]:[databasepath] (port usually is 7227): "; + driverDescription[12] = "EasySoft JDBC-ODBC:\t//[hostname]/[DSN]: "; + driverDescription[13] = "MS Sql Server 2000 JDBC driver:\t//[hostname]:1433;databaseName=[dbname];user=[dbuser];password=[dbpassword];: "; + driverDescription[14] = "MS Sql Server 2005/2008 JDBC driver:\t//[hostname]:1433;databaseName=[dbname];user=[dbuser];password=[dbpassword];: "; + driverDescription[15] = "Pervasive PSQL 10 JDBC driver:\t//[hostname]:1583/[DATABASE][;encoding=;encrypt=;encryption=] "; + driverDescription[16] = "UCanAccess JDBC driver:\t//db_or_accdb_file_path"; + driverDescription[17] = "MYSQL8 - jdbc:mysql://[hostname][,failoverhost...][:port]/[dbname][?param1=value1][¶m2=value2]"; + } + return driverDescription[i]; + } + + public static String getDriverManager(int i) { + if (driverManager == null) { + driverManager = new String[18]; + driverManager[0] = "sun.jdbc.odbc.JdbcOdbcDriver"; + driverManager[1] = "oracle.jdbc.ddndlthin"; + driverManager[2] = "org.hsqldb.jdbcDriver"; + driverManager[3] = "com.mysql.jdbc.Driver"; + driverManager[4] = "org.postgresql.Driver"; + driverManager[5] = "org.mariadb.jdbc.Driver"; + driverManager[6] = "com.sybase.jdbc.SybDriver"; + driverManager[7] = "interbase.interclient.Driver"; + driverManager[8] = "COM.ibm.db2.jdbc.app.DB2Driver"; + driverManager[9] = "com.informix.jdbc.IfxDriver"; + driverManager[10] = "zyh.sql.dbf.DBFDriver"; + driverManager[11] = "acs.jdbc.Driver"; + driverManager[12] = "easysoft.sql.jobDriver"; + driverManager[13] = "com.microsoft.jdbc.sqlserver.SQLServerDriver"; + driverManager[14] = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; + driverManager[15] = "com.pervasive.jdbc.v2.Driver"; + driverManager[16] = "net.ucanaccess.jdbc.UcanaccessDriver"; + driverManager[17] = "com.mysql.cj.jdbc.Driver"; + } + return driverManager[i]; + } + + public static int getTotNumberOfDrivers() { + return 18; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/EncodedField.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/EncodedField.java new file mode 100644 index 00000000..385a9a8b --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/EncodedField.java @@ -0,0 +1,61 @@ +package it.acxent.db; + +import java.io.Serializable; + +public class EncodedField implements Serializable { + private static final long serialVersionUID = 5011020454180333811L; + + public static final long MODALITA_MASTER = 0L; + + public static final long MODALITA_USER = 1L; + + public EncodedField(boolean codifica, long flgAlgoritmo, long modalita) { + this.flgAlgoritmo = flgAlgoritmo; + this.codifica = codifica; + this.flgModalita = modalita; + } + + private long flgAlgoritmo = 1L; + + private boolean codifica = false; + + private long flgModalita; + + public EncodedField() {} + + public long getFlgAlgoritmo() { + return this.flgAlgoritmo; + } + + public void setFlgAlgoritmo(long flgAlgoritmo) { + this.flgAlgoritmo = flgAlgoritmo; + } + + public boolean isCodifica() { + return this.codifica; + } + + public void setCodifica(boolean codifica) { + this.codifica = codifica; + } + + public long getFlgModalita() { + return this.flgModalita; + } + + public void setFlgModalita(long modalita) { + this.flgModalita = modalita; + } + + public String getEncodedFieldsPrefix() { + return "" + getFlgModalita() + "," + getFlgModalita() + ",0"; + } + + public static final String getModalita(long l_flgModalita) { + if (l_flgModalita == 0L) + return "Master Key"; + if (l_flgModalita == 1L) + return "User"; + return ""; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/FieldsComparator.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/FieldsComparator.java new file mode 100644 index 00000000..3d1a18f5 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/FieldsComparator.java @@ -0,0 +1,18 @@ +package it.acxent.db; + +import java.util.Comparator; +import java.util.Map; + +public class FieldsComparator implements Comparator { + Map map; + + public FieldsComparator(Map map) { + this.map = map; + } + + public int compare(Object o1, Object o2) { + if (this.map.get(o1).getOrder() == this.map.get(o2).getOrder()) + return 1; + return Long.valueOf(this.map.get(o1).getOrder()).compareTo(Long.valueOf(this.map.get(o2).getOrder())); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/FieldsDescriptor.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/FieldsDescriptor.java new file mode 100644 index 00000000..5152242a --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/FieldsDescriptor.java @@ -0,0 +1,54 @@ +package it.acxent.db; + +import java.io.Serializable; + +public class FieldsDescriptor implements Serializable { + private static final long serialVersionUID = 556854217105509091L; + + private String fieldName; + + private long order; + + private String desc; + + private String val; + + public FieldsDescriptor(String fieldName, long order, String desc, String val) { + this.fieldName = fieldName; + this.order = order; + this.desc = desc; + this.val = val; + } + + public String getFieldName() { + return (this.fieldName == null) ? "" : this.fieldName.trim(); + } + + public void setFieldName(String fieldName) { + this.fieldName = fieldName; + } + + public long getOrder() { + return this.order; + } + + public void setOrder(long order) { + this.order = order; + } + + public String getDesc() { + return (this.desc == null) ? "" : this.desc.trim(); + } + + public void setDesc(String desc) { + this.desc = (desc == null) ? "" : desc.trim(); + } + + public String getVal() { + return (this.val == null) ? "" : this.val.trim(); + } + + public void setVal(String val) { + this.val = val; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/JdbcStub.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/JdbcStub.java new file mode 100644 index 00000000..70ae98b2 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/JdbcStub.java @@ -0,0 +1,88 @@ +package it.acxent.db; + +import it.acxent.util.Debug; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +public class JdbcStub extends Debug { + private boolean isRegistered; + + private Statement stmt; + + private ResultSet rst; + + private Connection conn; + + private ApplParm ap; + + public JdbcStub(ApplParm applparm) throws SQLException { + this.isRegistered = false; + this.ap = applparm; + if (!this.isRegistered) + synchronized (this) { + try { + Class.forName(this.ap.getDriverManager()).newInstance(); + } catch (Exception exception) { + System.err.println("Errore: " + exception.getMessage()); + } + this.isRegistered = true; + } + String s = this.ap.getConnectionString() + ":" + this.ap.getConnectionString(); + handleDebug("Connecting... with " + s + " user:" + this.ap.getUser() + " Pwd:" + this.ap.getPassword()); + if (this.ap.getUser().isEmpty()) { + setConn(DriverManager.getConnection(s)); + } else { + setConn(DriverManager.getConnection(s, this.ap.getUser(), this.ap.getPassword())); + } + handleDebug("Connessione ok"); + } + + public JdbcStub(Connection connection) { + this.isRegistered = false; + this.conn = connection; + } + + public void Close() throws SQLException { + if (this.stmt != null) + this.stmt.close(); + } + + public ResultSet ExecuteQuery(String s) throws SQLException { + try { + this.stmt = this.conn.createStatement(); + this.rst = this.stmt.executeQuery(s); + return this.rst; + } catch (SQLException _ex) { + throw _ex; + } + } + + public int ExecuteUpdate(String s) throws SQLException { + Close(); + try { + this.stmt = this.conn.createStatement(); + int i = this.stmt.executeUpdate(s); + return i; + } catch (SQLException sqlexception) { + sqlexception.printStackTrace(System.out); + throw new SQLException(); + } finally { + this.stmt.close(); + } + } + + protected void finalize() throws SQLException { + Close(); + } + + public Connection getConn() { + return this.conn; + } + + public void setConn(Connection connection) { + this.conn = connection; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/OrString.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/OrString.java new file mode 100644 index 00000000..dd205ea1 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/OrString.java @@ -0,0 +1,44 @@ +package it.acxent.db; + +public class OrString { + private static final String OR = " OR "; + + private static final String SPACE = " "; + + private StringBuilder theString; + + private static final String START = " ("; + + private static final String STOP = ") "; + + public String toString() { + return getTheString().toString() + ") "; + } + + public void addOr(String l_or) { + if (!l_or.trim().isEmpty()) { + if (getTheString().length() == 0) { + getTheString().append(" ("); + } else { + getTheString().append(" OR "); + } + getTheString().append(" "); + getTheString().append(l_or); + } + } + + private StringBuilder getTheString() { + if (this.theString == null) + this.theString = new StringBuilder(); + return this.theString; + } + + public static final String prepareSqlStatement(String sqlString) { + int idx = sqlString.indexOf('\''); + while (idx != -1) { + sqlString = sqlString.substring(0, idx) + "'" + sqlString.substring(0, idx); + idx = sqlString.indexOf('\'', idx + 2); + } + return sqlString; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ResParm.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ResParm.java new file mode 100644 index 00000000..be6d90c8 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/ResParm.java @@ -0,0 +1,221 @@ +package it.acxent.db; + +import com.google.gson.JsonObject; +import it.acxent.util.Out; +import java.util.HashMap; +import java.util.Map; + +public class ResParm { + public static final String _JSON_RESULT = "_jsonResult"; + + public static final String _RETURN_OBJ = "_returnObj"; + + private static final String ERRO = "erro"; + + private String fileName; + + private String[] fileNames; + + private String msg; + + private boolean status; + + private long errorCode = 0L; + + private Exception exception; + + private String infoMsg; + + private Map extraInfo; + + public ResParm() { + setStatus(true); + } + + public ResParm(boolean l_status, String l_msg) { + setStatus(l_status); + setMsg(l_msg); + } + + public ResParm(boolean l_status) { + setStatus(l_status); + setMsg(""); + } + + public ResParm(boolean l_status, Exception e) { + setStatus(l_status); + setException(e); + setMsg(e.getMessage()); + } + + public String getMsg() { + return (this.msg == null) ? "" : this.msg; + } + + public void setExtraInfo(String key, Object value) { + if (this.extraInfo == null) + this.extraInfo = new HashMap<>(); + this.extraInfo.put(key, value); + } + + public T getExtraInfo(String key, T defaultValue) { + if (this.extraInfo == null || !this.extraInfo.containsKey(key)) + return defaultValue; + try { + return (T)this.extraInfo.get(key); + } catch (ClassCastException e) { + return defaultValue; + } + } + + public boolean hasExtraInfo(String key) { + return (this.extraInfo != null && this.extraInfo.containsKey(key)); + } + + public Map getAllExtraInfo() { + return this.extraInfo; + } + + public boolean getStatus() { + return this.status; + } + + public boolean isOk() { + return getStatus(); + } + + public void appendMsg(String s) { + setMsg(getMsg() + getMsg()); + } + + public void append(ResParm rp2) { + setStatus((getStatus() && rp2.getStatus())); + if (getMsg().isEmpty()) { + if (!rp2.getMsg().isEmpty()) + setMsg(rp2.getMsg()); + } else if (!rp2.getMsg().isEmpty()) { + setMsg(getMsg() + "->" + getMsg()); + } + if (getInfoMsg().isEmpty()) { + if (!rp2.getInfoMsg().isEmpty()) + setInfoMsg(rp2.getInfoMsg()); + } else if (!rp2.getInfoMsg().isEmpty()) { + setInfoMsg(getInfoMsg() + "->" + getInfoMsg()); + } + setExtraInfo(rp2.getExtraInfo()); + } + + public void setStatus(boolean flag) { + this.status = flag; + } + + public Exception getException() { + return this.exception; + } + + public String getExceptionStackTrace() { + if (getException() != null) { + Out o = new Out(System.out); + getException().printStackTrace(o); + return getException().toString() + "\n" + getException().toString(); + } + return ""; + } + + public void setException(Exception exception) { + this.exception = exception; + } + + public void setMsg(String s) { + this.msg = s; + } + + public void setMsg(StringBuilder s) { + this.msg = s.toString(); + } + + public void setMsg(Exception e) { + setException(e); + this.msg = e.toString() + ": " + e.toString(); + } + + public long getErrorCode() { + return this.errorCode; + } + + public void setErrorCode(long errorCode) { + this.errorCode = errorCode; + } + + public String getErrMsg() { + if (!getStatus() && getMsg().toLowerCase().indexOf("erro") < 0) + return "Error! " + getMsg(); + return getMsg(); + } + + public String getInfoMsg() { + return (this.infoMsg == null) ? "" : ( + this.infoMsg.startsWith(" ") ? this.infoMsg : (" " + this.infoMsg.trim())); + } + + public void setInfoMsg(String infoMsg) { + this.infoMsg = infoMsg; + } + + public void appendInfoMsg(String s) { + setInfoMsg(getInfoMsg() + getInfoMsg()); + } + + public Object getReturnObj() { + if (this.extraInfo != null && this.extraInfo.containsKey("_returnObj")) + return this.extraInfo.get("_returnObj"); + return null; + } + + @Deprecated + public void setReturnObj(Object returnObj) { + setExtraInfo("_returnObj", returnObj); + } + + public String getFileName() { + return this.fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String[] getFileNames() { + return this.fileNames; + } + + public void setFileNames(String[] fileNames) { + this.fileNames = fileNames; + } + + public JsonObject getJsonResult() { + if (this.extraInfo != null && this.extraInfo.containsKey("_jsonResult")) { + Object val = this.extraInfo.get("_jsonResult"); + if (val instanceof JsonObject) + return (JsonObject)val; + } + return null; + } + + @Deprecated + public void setJsonResult(JsonObject jsonResult) { + setExtraInfo("_jsonResult", jsonResult); + } + + public String toString() { + return "ResParm [status=" + this.status + ", msg=" + this.msg + ", extraInfo=" + String.valueOf(this.extraInfo) + "]"; + } + + public Map getExtraInfo() { + return this.extraInfo; + } + + public void setExtraInfo(Map extraInfo) { + this.extraInfo = extraInfo; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/RewriteRule.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/RewriteRule.java new file mode 100644 index 00000000..4170a903 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/RewriteRule.java @@ -0,0 +1,84 @@ +package it.acxent.db; + +import it.acxent.util.Vectumerator; + +public class RewriteRule { + private String cmd; + + private String servlet; + + private String code; + + private Vectumerator parms; + + private String act; + + private Vectumerator constValues; + + private Vectumerator constParms; + + public String getCmd() { + return this.cmd; + } + + public void setCmd(String cmd) { + this.cmd = cmd; + } + + public String getAct() { + return this.act; + } + + public void setAct(String act) { + this.act = act; + } + + public String getCode() { + return this.code; + } + + public void setCode(String code) { + this.code = code; + } + + public Vectumerator getParms() { + return this.parms; + } + + public void setParms(Vectumerator parms) { + this.parms = parms; + } + + public String getServlet() { + return this.servlet; + } + + public void setServlet(String servlet) { + this.servlet = servlet; + } + + public String getParm(int idx) { + if (getParms() != null) { + if (idx < getParms().getTotNumberOfRecords()) + return getParms().get(idx); + return null; + } + return null; + } + + public Vectumerator getConstValues() { + return this.constValues; + } + + public void setConstValues(Vectumerator values) { + this.constValues = values; + } + + public Vectumerator getConstParms() { + return this.constParms; + } + + public void setConstParms(Vectumerator constParms) { + this.constParms = constParms; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/StringAdapter.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/StringAdapter.java new file mode 100644 index 00000000..559efa4b --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/StringAdapter.java @@ -0,0 +1,21 @@ +package it.acxent.db; + +import java.sql.SQLException; + +public class StringAdapter extends DBAdapter { + public StringAdapter() {} + + public StringAdapter(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + protected ResParm checkDeleteCascade() throws DBAdapterException, SQLException { + return null; + } + + protected void deleteCascade() {} + + protected boolean isDatabaseBean() { + return false; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/WcString.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/WcString.java new file mode 100644 index 00000000..3bd80aa3 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/WcString.java @@ -0,0 +1,94 @@ +package it.acxent.db; + +public class WcString { + private static final String GROUP_BY = " GROUP BY"; + + private static final String WHERE = " WHERE"; + + private static final String SPACE = " "; + + private StringBuilder wcString; + + private StringBuilder theGroupBy; + + private StringBuilder havingString; + + private static final String AND = " AND "; + + private static final String HAVING = " HAVING"; + + public String toString() { + return getWcString().toString() + " " + getWcString().toString() + " " + getTheGroupBy().toString(); + } + + public void addWc(String l_wc) { + if (!l_wc.trim().isEmpty()) { + if (getWcString().length() == 0) { + getWcString().append(" WHERE"); + } else { + getWcString().append(" AND "); + } + getWcString().append(" "); + getWcString().append(l_wc); + } + } + + public void addHavingWc(String l_wc) { + if (getHavingString().length() == 0) { + getHavingString().append(" HAVING"); + } else { + getHavingString().append(" AND "); + } + getHavingString().append(" "); + getHavingString().append(l_wc); + } + + private StringBuilder getWcString() { + if (this.wcString == null) + this.wcString = new StringBuilder(); + return this.wcString; + } + + public void addGroupBy(String l_column) { + if (!l_column.trim().isEmpty()) { + if (getTheGroupBy().length() == 0) { + getTheGroupBy().append(" GROUP BY"); + } else { + getTheGroupBy().append(","); + } + getTheGroupBy().append(" "); + getTheGroupBy().append(l_column); + } + } + + private StringBuilder getTheGroupBy() { + if (this.theGroupBy == null) + this.theGroupBy = new StringBuilder(); + return this.theGroupBy; + } + + public String toStringWOWhere() { + if (getWcString().length() == 0) + return getWcString().toString(); + return getWcString().toString().substring(" WHERE".length() + " ".length()); + } + + public void setWhere(String l_whereCondition) { + this.wcString = new StringBuilder(l_whereCondition); + } + + public static final String prepareSqlStatement(String sqlString) { + int idx = sqlString.indexOf('\''); + while (idx != -1) { + sqlString = sqlString.substring(0, idx) + "'" + sqlString.substring(0, idx); + idx = sqlString.indexOf('\'', idx + 2); + } + return sqlString; + } + + private StringBuilder getHavingString() { + if (this.havingString == null) + this.havingString = new StringBuilder(); + return this.havingString; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/XmlTableExporter.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/XmlTableExporter.java new file mode 100644 index 00000000..6db1af1b --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/XmlTableExporter.java @@ -0,0 +1,87 @@ +package it.acxent.db; + +import it.acxent.util.FileWr; +import java.io.IOException; + +public class XmlTableExporter { + private static final String START_DB = ""; + this._fw.writeLine(stg); + } + + public void endDbExport() throws IOException { + this._fw.writeLine(""); + } + + public void startTable(String tableName) throws IOException { + String stg = ""; + this._fw.writeLine(stg); + } + + public void endTable() throws IOException { + this._fw.writeLine("
    "); + } + + public void endFile() throws IOException { + this._fw.writeLine(""); + } + + public void startRow() throws IOException { + this._fw.writeLine(""); + } + + public void endRow() throws IOException { + this._fw.writeLine(""); + } + + public void addColumn(String name, String val) throws IOException { + String stg; + if (val != null && (val.indexOf("<") > 0 || val.indexOf(">") > 0)) { + stg = ""; + } else { + stg = "" + val + ""; + } + this._fw.writeLine(stg); + } + + public void startFile() throws IOException { + this._fw.writeLine(""); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/demo.gif b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/demo.gif new file mode 100644 index 00000000..8a65c57d Binary files /dev/null and b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/demo.gif differ diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/package-info.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/package-info.java new file mode 100644 index 00000000..5f008f5e --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/package-info.java @@ -0,0 +1 @@ +package com.f3.db; \ No newline at end of file diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/versionLog.txt b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/versionLog.txt new file mode 100644 index 00000000..21ab5110 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/db/versionLog.txt @@ -0,0 +1 @@ +acxent-core 4log diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/ExcludeKeywords.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/ExcludeKeywords.java new file mode 100644 index 00000000..730c1236 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/ExcludeKeywords.java @@ -0,0 +1,97 @@ +package it.acxent.help; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class ExcludeKeywords extends DBAdapter implements Serializable { + private String id_excludeKeywords; + + private String lang; + + private String theKey; + + public ExcludeKeywords(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ExcludeKeywords() {} + + public void setId_excludeKeywords(String newId_excludeKeywords) { + this.id_excludeKeywords = newId_excludeKeywords; + } + + public void setLang(String newLang) { + this.lang = newLang; + } + + public String getId_excludeKeywords() { + return (this.id_excludeKeywords == null) ? "" : + this.id_excludeKeywords.trim(); + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang.trim(); + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public void findByKeyLang(String l_key, String lang) { + String s_Sql_Find = "select A.* from EXCLUDE_KEYWORDS AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.lang='" + lang + "'"); + wc.addWc("A.theKey='" + prepareInputMySqlString(l_key, false) + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public String getTheKey() { + return (this.theKey == null) ? "" : this.theKey.trim(); + } + + public void setTheKey(String theKey) { + this.theKey = theKey; + } + + public Vectumerator findByCR(ExcludeKeywordsCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from EXCLUDE_KEYWORDS AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/ExcludeKeywordsCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/ExcludeKeywordsCR.java new file mode 100644 index 00000000..b03598ef --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/ExcludeKeywordsCR.java @@ -0,0 +1,32 @@ +package it.acxent.help; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; + +public class ExcludeKeywordsCR extends CRAdapter { + private String id_excludeKeywords; + + private String theKey; + + public ExcludeKeywordsCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public ExcludeKeywordsCR() {} + + public void setId_excludeKeywords(String newId_excludeKeywords) { + this.id_excludeKeywords = newId_excludeKeywords; + } + + public String getId_excludeKeywords() { + return (this.id_excludeKeywords == null) ? "" : this.id_excludeKeywords.trim(); + } + + public String getTheKey() { + return (this.theKey == null) ? AB_EMPTY_STRING : this.theKey.trim(); + } + + public void setTheKey(String theKey) { + this.theKey = theKey; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/Help.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/Help.java new file mode 100644 index 00000000..88179420 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/Help.java @@ -0,0 +1,691 @@ +package it.acxent.help; + +import it.acxent.common.DescTxtLang; +import it.acxent.db.AddImgInterface; +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.io.IOException; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import javax.servlet.http.HttpServletRequest; + +public class Help extends DBAdapter implements Serializable, AddImgInterface { + private static final String INDICE_DELIM = ":"; + + private long id_help; + + private long id_helpPadre; + + private String codice; + + private String descrizione_en; + + private long livello; + + private String indici; + + private long flgFoglia; + + private long flgVisibile; + + private long ordine; + + private long flgTipoHelp; + + private String text_it; + + private String text_en; + + private Help helpPadre; + + private String descrizione_it; + + private String titolo_en; + + private String titolo_it; + + private String imgTmst; + + public static final String COD_INTRO = "INTRO"; + + public static final String COD_ALL = "*"; + + public static final String P_HELP_IMG_PATH = "HELP_IMG_PATH"; + + public static final String P_HELP_PUBLIC_CODES = "HELP_PUBLIC_CODES"; + + public static final String P_HELP_ATTACH_PATH = "HELP_ATTACH_PATH"; + + public static final String P_HELP_EXPORT_PATH = "HELP_EXPORT_PATH"; + + public static final String ATTR_COD = "cod"; + + public Help(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public Help() {} + + public void setId_help(long newId_help) { + this.id_help = newId_help; + } + + public void setId_helpPadre(long newId_helpPadre) { + this.id_helpPadre = newId_helpPadre; + setHelpPadre(null); + } + + public void setDescrizione_it(String newDescrizione_it) { + this.descrizione_it = newDescrizione_it; + } + + public void setDescrizione_en(String newDescrizione_en) { + this.descrizione_en = newDescrizione_en; + } + + public void setLivello(long newLivello) { + this.livello = newLivello; + } + + public void setIndici(String newIndici) { + this.indici = newIndici; + } + + public void setFlgFoglia(long newFlgFoglia) { + this.flgFoglia = newFlgFoglia; + } + + public void setFlgVisibile(long newFlgNascondi) { + this.flgVisibile = newFlgNascondi; + } + + public void setOrdine(long newOrdine) { + this.ordine = newOrdine; + } + + public void setFlgTipoHelp(long newFlgTipoHelp) { + this.flgTipoHelp = newFlgTipoHelp; + } + + public void setText_it(String newText_it) { + this.text_it = newText_it; + } + + public void setText_en(String newText_en) { + this.text_en = newText_en; + } + + public long getId_help() { + return this.id_help; + } + + public long getId_helpPadre() { + return this.id_helpPadre; + } + + public String getTitolo(String lang) { + return getDescTxtLang("titolo", lang); + } + + public String getTitolo() { + return getTitolo("it"); + } + + public String getText(String lang) { + return getDescTxtLang("text", lang); + } + + public String getText() { + return getText("it"); + } + + public String getDescrizione_en() { + return (this.descrizione_en == null) ? "" : this.descrizione_en.trim(); + } + + public long getLivello() { + return this.livello; + } + + public ResParm indicizzaKeyword() { + ResParm rp = new ResParm(true); + if (getId_help() > 0L) { + int MINCHAR = 4; + int MAXCHAR = 30; + int contMaxMin = 0; + String START_TAG = "<"; + String END_TAG = ">"; + rp = new HelpKeyword(getApFull()).deleteByHelp(getId_help()); + if (rp.getStatus()) { + String lang = "it"; + boolean foundTag = false; + String temp = getText_it(); + temp = temp.replace(START_TAG, " " + START_TAG + " "); + temp = temp.replace(END_TAG, " " + END_TAG + " "); + temp = temp.replace(" ", " "); + temp = temp.replace(".", " "); + temp = temp.replace(",", " "); + temp = temp.replace("'", " "); + temp = temp.replace(":", " "); + temp = temp.replace(";", " "); + temp = temp.replace("!", " "); + temp = temp.replace("#", " "); + temp = temp.replace("@", " "); + StringTokenizer st = new StringTokenizer(temp, " "); + ExcludeKeywords ek = new ExcludeKeywords(getApFull()); + int numKeyw = 0; + String[] sc = { "(", ")", "è", "ù", "à", "ì" }; + String[] scS = { "", "", "è", "ù", "à", "ì" }; + while (st.hasMoreTokens()) { + String token = st.nextToken(); + for (int i = 0; i < sc.length; i++) { + if (token.indexOf(sc[i]) >= 0) + token = token.replace(sc[i], scS[i]); + } + foundTag = false; + if (token.contains(START_TAG)) { + contMaxMin++; + foundTag = true; + } + if (token.contains(END_TAG)) { + contMaxMin--; + foundTag = true; + } + if (!foundTag && contMaxMin == 0 && token.length() > MINCHAR && token.length() <= MAXCHAR) { + ek.findByKeyLang(token, lang); + if (ek.getDBState() == 0) { + HelpKeyword hk = new HelpKeyword(getApFull()); + hk.setId_help(getId_help()); + hk.setLang(lang); + hk.setTheKey(token); + hk.save(); + numKeyw++; + System.out.println(token); + } + } + } + rp.setMsg("Creazione keyword per help con chiave " + getCodice() + ". Create " + numKeyw + " chiavi."); + } + } + return rp; + } + + public long getFlgFoglia() { + return this.flgFoglia; + } + + public long getFlgVisibile() { + return this.flgVisibile; + } + + public long getOrdine() { + return this.ordine; + } + + public long getFlgTipoHelp() { + return this.flgTipoHelp; + } + + public String getText_it() { + return (this.text_it == null) ? "" : this.text_it.trim(); + } + + public String getText_en() { + return (this.text_en == null) ? "" : this.text_en.trim(); + } + + public void setHelpPadre(Help newHelpPadre) { + this.helpPadre = newHelpPadre; + } + + public Help getHelpPadre() { + this.helpPadre = (Help)getSecondaryObject((DBAdapter)this.helpPadre, Help.class, getId_helpPadre()); + return this.helpPadre; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + public Vectumerator findByCR(HelpCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from HELP AS A left join HELP_KEYWORD AS B on A.id_help=B.id_help"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.codice like '%" + token + "%' or B.theKey like '%" + token + "%' or A.titolo_it like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + if (CR.getId_helpPadre() != 0L) + wc.addWc("A.id_helpPadre=" + CR.getId_helpPadre()); + if (CR.getFlgVisibile() == 0L) { + wc.addWc("(A.flgVisibile is null or A.flgVisibile=" + CR.getFlgVisibile() + ")"); + } else if (CR.getFlgVisibile() > 0L) { + wc.addWc("A.flgVisibile=" + CR.getFlgVisibile()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public ResParm addNuovoSottoHelp(Help l_help) { + Help sf = new Help(getApFull()); + sf.setDescrizione_it(l_help.getDescrizione_it()); + sf.setId_helpPadre(getId_help()); + ResParm rp = new ResParm(); + rp = sf.save(); + return rp; + } + + public ResParm addHelpFiglio(Help l_help) { + Help bean = new Help(getApFull()); + bean.findByPrimaryKey(l_help.getId_help()); + if (((bean.getId_help() == 0L) ? true : false) | (!indiciContains(bean.getId_help()) ? true : false)) { + bean.setId_helpPadre(getId_help()); + bean.setLivello(l_help.getLivello()); + return bean.save(); + } + return new ResParm(false, "Impossibile aggiungere figlio: legame circolare! "); + } + + protected String calcolaIndici() { + StringBuffer idx = new StringBuffer(":"); + idx.append(calcolaIndiciR()); + idx.append(":"); + return idx.toString(); + } + + private StringBuffer calcolaIndiciR() { + StringBuffer idx = new StringBuffer(String.valueOf(getId_help())); + if (getId_helpPadre() != 0L) { + idx.insert(0, ":"); + idx.insert(0, (CharSequence)getHelpPadre().calcolaIndiciR()); + } + return idx; + } + + private long calcolaOrdine() { + try { + String s_sqlFind = "select max(ordine) as _max from HELP WHERE id_help!=" + getId_help(); + if (getId_helpPadre() != 0L) { + s_sqlFind = s_sqlFind + " and id_helpPadre=" + s_sqlFind; + } else { + s_sqlFind = s_sqlFind + " and (id_helpPadre=0 or id_helpPadre is null)"; + } + PreparedStatement ps = getConn().prepareStatement(s_sqlFind); + long res = (long)getMax(ps, true) + 1L; + long decine = res / 10L; + return (decine + 1L) * 10L; + } catch (Exception e) { + handleDebug(e); + return 0L; + } + } + + protected void deleteCascade() { + Vectumerator figli = findFigli(new HelpCR(), 0, 0); + while (figli.hasMoreElements()) + figli.nextElement().delete(); + } + + private Vectumerator xfindFigli(boolean soloVisibili, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from HELP AS A"; + String s_Sql_Order = " order by A.ordine, A.descrizione_it"; + WcString wc = new WcString(); + if (getId_help() == 0L) { + wc.addWc("(A.id_helpPadre=0 or A.id_helpPadre is null)"); + } else { + wc.addWc("A.id_helpPadre=" + getId_help()); + } + if (soloVisibili) + wc.addWc("(A.flgVisibile=1)"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findFigliVisibili(int pageNumber, int pageRows) { + HelpCR CR = new HelpCR(getApFull()); + CR.setFlgVisibile(1L); + return findFigli(CR, pageNumber, pageRows); + } + + public Vectumerator findPadri() { + Vectumerator vec = new Vectumerator(); + Help currentPadre = getHelpPadre(); + while (currentPadre.getId_help() != 0L) { + vec.add(currentPadre); + currentPadre = currentPadre.getHelpPadre(); + } + vec.setOrderBackward(); + return vec; + } + + protected boolean indiciContains(long l_key) { + StringTokenizer st = new StringTokenizer(getIndici(), ":"); + String s_key = String.valueOf(l_key); + while (st.hasMoreTokens()) { + if (st.nextToken().equals(s_key)) + return true; + } + return false; + } + + public boolean isFoglia() { + Vectumerator vec = findFigli(1, 1); + if (vec.hasMoreElements()) + return false; + return true; + } + + protected void prepareSave(PreparedStatement ps) throws SQLException { + setFlgFoglia(isFoglia() ? 1L : 0L); + if (getOrdine() == 0L) + setOrdine(calcolaOrdine()); + if (getId_helpPadre() == 0L) { + setLivello(0L); + } else { + setLivello(getHelpPadre().getLivello() + 1L); + } + super.prepareSave(ps); + } + + public ResParm save() { + setIndici(calcolaIndici()); + boolean newRecord = (getId_help() == 0L); + String idxPadre = getHelpPadre().getIndici(); + String temp = ":" + getId_help() + ":"; + if (getId_help() == 0L || idxPadre.indexOf(temp) < 0 || (getId_help() != 0L && getId_help() != getId_helpPadre())) { + ResParm resParm = super.save(); + if (resParm.getStatus() && newRecord) { + setIndici(calcolaIndici()); + resParm = super.save(); + } + return resParm; + } + ResParm rp = new ResParm(false, "Impossibile salvare!. Legame circolare."); + return rp; + } + + protected boolean useNullFor0() { + return false; + } + + public String getCodice() { + return (this.codice == null) ? "" : this.codice.trim(); + } + + public void setCodice(String codice) { + this.codice = codice; + } + + public String getDescrizioneCompleta() { + if (getId_help() == 0L) + return ""; + return getCodice() + " - " + getCodice(); + } + + public String getTitolo_en() { + return (this.titolo_en == null) ? "" : this.titolo_en; + } + + public void setTitolo_en(String titoloEn) { + this.titolo_en = titoloEn; + } + + public String getTitolo_it() { + return (this.titolo_it == null) ? "" : this.titolo_it; + } + + public void setTitolo_it(String titoloIt) { + this.titolo_it = titoloIt; + } + + public String getDescrizioneCompleta(String lang) { + return getCodice() + " - " + getCodice(); + } + + public Vectumerator findFigli(int pageNumber, int pageRows) { + HelpCR CR = new HelpCR(getApFull()); + return findFigli(CR, pageNumber, pageRows); + } + + public Vectumerator findFigli(HelpCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from HELP AS A"; + String s_Sql_Order = " order by A.ordine, A.titolo_it"; + WcString wc = new WcString(); + if (getId_help() == 0L) { + wc.addWc("(A.id_helpPadre=0 or A.id_helpPadre is null)"); + } else { + wc.addWc("A.id_helpPadre=" + getId_help()); + } + if (CR.getFlgVisibile() == 0L) { + wc.addWc("(A.flgVisibile=0 or A.flgVisibile is null)"); + } else if (CR.getFlgVisibile() == 1L) { + wc.addWc("A.flgVisibile=1"); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public String getDescrizione4Script() { + return prepareScriptString(getTitolo()); + } + + public String getDescrizione4Script(String lang) { + return prepareScriptString(getTitolo(lang)); + } + + public String getDescrizionePadri() { + Vectumerator vec = findPadri(); + StringBuffer temp = new StringBuffer(); + while (vec.hasMoreElements()) { + Help row = vec.nextElement(); + temp.append(row.getCodice()); + if (vec.hasMoreElements()) + temp.append("-"); + } + return temp.toString(); + } + + public String getDescrizione_it() { + return (this.descrizione_it == null) ? "" : this.descrizione_it.trim(); + } + + public void findByCodice(String l_codice) { + String s_Sql_Find = "select A.* from HELP AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.codice='" + l_codice + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public ResParm addAllegato(HelpAllegato row) { + HelpAllegato bean = new HelpAllegato(getApFull()); + bean.findByHelpNomeFile(row.getId_help(), row.getNomeFile()); + if (bean.getDBState() == 1) + return new ResParm(false, "Nome File Duplicato"); + row.setDBState(0); + ResParm rp = row.save(); + return rp; + } + + public ResParm delAllegato(HelpAllegato row) { + HelpAllegato bean = new HelpAllegato(getApFull()); + bean.findByPrimaryKey(row.getId_helpAllegato()); + return bean.delete(); + } + + public Vectumerator getHelpAllegati() { + return new HelpAllegato(getApFull()).findById_help(getId_help(), 0, 0); + } + + public ResParm addHelp(HelpRel row) { + HelpRel bean = new HelpRel(getApFull()); + if (row.getId_helpRel() != 0L) { + bean.findByPrimaryKey(row.getId_helpRel()); + } else { + bean.findById_helpId_help1(row.getId_help(), row.getId_help1()); + } + if (bean.getDBState() == 1) { + row.setDBState(bean.getDBState()); + row.setId_helpRel(bean.getId_helpRel()); + } + ResParm rp = row.save(); + return rp; + } + + private String prepareTextHtml(String l_text, HttpServletRequest req) { + String res = l_text; + res = l_text.replaceAll("v/_img", "_img"); + return res; + } + + public Vectumerator getHelpRel() { + return new HelpRel(getApFull()).findById_help(getId_help(), 0, 0); + } + + public String getTextHelpHtml_it(HttpServletRequest req) { + return prepareTextHtml(getText_it(), req); + } + + public ResParm delHelp(HelpRel row) { + HelpRel bean = new HelpRel(getApFull()); + bean.findByPrimaryKey(row.getId_helpRel()); + return bean.delete(); + } + + public String getTextHelpHtml_en(HttpServletRequest req) { + return prepareTextHtml(getText_en(), req); + } + + public String getImgTmst() { + return this.imgTmst; + } + + public void setImgTmst(String imgTmst) { + this.imgTmst = imgTmst; + } + + public String getImgFileName(int imgNumber) { + return getImgFileName(imgNumber, getImgTmst()); + } + + public String getImgFileName(int imgNumber, String oldTmst) { + if (oldTmst == null) + oldTmst = ""; + return "" + getId_help() + "_" + getId_help() + "_" + oldTmst + ".jpg"; + } + + public String getPathAllegato() { + return getParm("HELP_ATTACH_PATH").getTesto(); + } + + public String getPathAssolutoExport() { + return getPathTmpFull() + getPathTmpFull(); + } + + public String getIndici() { + return (this.indici == null) ? "" : this.indici.trim(); + } + + public String getTextBreve() { + int LEN = 200; + if (getText().length() <= LEN) + return getText(); + return getText().substring(0, LEN) + "...."; + } + + public String getPathImg() { + return getParm("HELP_IMG_PATH").getTesto(); + } + + public boolean useDescLangTables() { + return true; + } + + public void setText(String newText) { + setDescTxtLang("text", "it", newText); + } + + public ResParm exportHelp() { + ResParm rp = new ResParm(true); + HelpAllegato ha = new HelpAllegato(getApFull()); + HelpRel hr = new HelpRel(getApFull()); + HelpKeyword hkw = new HelpKeyword(getApFull()); + try { + copyDir(getDocBase() + getDocBase(), getPathAssolutoExport() + "_atch/"); + copyDir(getDocBase() + getDocBase(), getPathAssolutoExport() + "_img/"); + } catch (IOException e) { + rp.setMsg("Errore nella copia delle directory _atch / _img."); + rp.setStatus(false); + e.printStackTrace(); + } + DescTxtLang dtl = new DescTxtLang(getApFull()); + boolean ok = zipDir(new File(getPathAssolutoExport()), getPathTmpFull() + "helpExp.zip", false); + if (!ok) { + rp.setMsg("Errore nella preparazione dello zip."); + rp.setStatus(false); + } else { + rp.setMsg("Esportazione eseguita con successo."); + } + return rp; + } + + public ResParm importHelp() { + ResParm rp = new ResParm(true); + File dir = new File(getPathAssolutoExport()); + if (dir.exists()) + deleteDir(dir); + unzipAndrea(getPathTmpFull() + "helpExp.zip"); + rp = xmlImport(getPathAssolutoExport() + "help.xml"); + HelpAllegato ha = new HelpAllegato(getApFull()); + rp.append(ha.xmlImport(getPathAssolutoExport() + "helpAll.xml")); + HelpRel hr = new HelpRel(getApFull()); + rp.append(hr.xmlImport(getPathAssolutoExport() + "helpRel.xml")); + HelpKeyword hkw = new HelpKeyword(getApFull()); + rp.append(hkw.xmlImport(getPathAssolutoExport() + "helpKey.xml")); + DescTxtLang dtl = new DescTxtLang(getApFull()); + rp.append(dtl.xmlImport(getPathAssolutoExport() + "desc_txt_lang.xml")); + try { + copyDir(getPathAssolutoExport() + "_atch/", getDocBase() + getDocBase()); + copyDir(getPathAssolutoExport() + "_img/", getDocBase() + getDocBase()); + } catch (IOException e) { + rp.setMsg("Errore nella copia delle directory _atch / _img."); + rp.setStatus(false); + e.printStackTrace(); + } + return rp; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpAllegato.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpAllegato.java new file mode 100644 index 00000000..700fe5d2 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpAllegato.java @@ -0,0 +1,159 @@ +package it.acxent.help; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.File; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import javax.servlet.http.HttpServletRequest; + +public class HelpAllegato extends DBAdapter implements Serializable { + private long id_helpAllegato; + + private long id_help; + + private String nomeFile; + + private Help help; + + private long flgTipoAllegato; + + public HelpAllegato(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public HelpAllegato() {} + + public void setId_helpAllegato(long newId_allegato) { + this.id_helpAllegato = newId_allegato; + } + + public void setId_help(long newId_help) { + this.id_help = newId_help; + setHelp(null); + } + + public void setNomeFile(String newNomeFile) { + this.nomeFile = newNomeFile; + } + + public long getId_helpAllegato() { + return this.id_helpAllegato; + } + + public long getId_help() { + return this.id_help; + } + + public String getNomeFile() { + return (this.nomeFile == null) ? "" : this.nomeFile; + } + + public String getNomeFileCompleto() { + return getNomeFileCompleto(getHelp().getPathImg()); + } + + private String getNomeFileCompleto(String l_path) { + return l_path + l_path; + } + + public String xgetNomeFileAbsUrl(HttpServletRequest req) { + return (req.getContextPath().equals("/") ? "" : req.getContextPath()) + "/" + (req.getContextPath().equals("/") ? "" : req.getContextPath()) + + getParm("HELP_ATTACH_PATH").getTesto() + "_" + + getId_help(); + } + + public void setHelp(Help newHelp) { + this.help = newHelp; + } + + public Help getHelp() { + this.help = (Help)getSecondaryObject((DBAdapter)this.help, Help.class, getId_help()); + return this.help; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() { + new File(getNomeFileCompleto()).delete(); + } + + public Vectumerator findByCR(HelpAllegatoCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from ALLEGATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findById_help(long l_id_help, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from HELP_ALLEGATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_help=" + l_id_help); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findByHelpNomeFile(long l_id_help, String l_id_nomeFile) { + String s_Sql_Find = "select A.* from HELP_ALLEGATO AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("A.id_help=" + l_id_help); + wc.addWc("A.nomeFile='" + l_id_nomeFile + "'"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public long getFlgTipoAllegato() { + return this.flgTipoAllegato; + } + + public void setFlgTipoAllegato(long flgTipoAllegato) { + this.flgTipoAllegato = flgTipoAllegato; + } + + public String xgetNomeFileRel() { + return getParm("HELP_ATTACH_PATH").getTesto() + getParm("HELP_ATTACH_PATH").getTesto() + "_" + getId_help(); + } + + public String getNomeFileSuDisco() { + return "" + getId_help() + "_" + getId_help(); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpAllegatoCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpAllegatoCR.java new file mode 100644 index 00000000..675ce869 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpAllegatoCR.java @@ -0,0 +1,57 @@ +package it.acxent.help; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; + +public class HelpAllegatoCR extends CRAdapter { + private long id_helpAllegato; + + private long id_help; + + private String nomeFile; + + private Help help; + + public HelpAllegatoCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public HelpAllegatoCR() {} + + public void setId_helpAllegato(long newId_allegato) { + this.id_helpAllegato = newId_allegato; + } + + public void setId_help(long newId_help) { + this.id_help = newId_help; + setHelp(null); + } + + public void setNomeFile(String newNomeFile) { + this.nomeFile = newNomeFile; + } + + public long getId_helpAllegato() { + return this.id_helpAllegato; + } + + public long getId_help() { + return this.id_help; + } + + public String getNomeFile() { + return (this.nomeFile == null) ? "" : this.nomeFile; + } + + public void setHelp(Help newHelp) { + this.help = newHelp; + } + + public Help getHelp() { + this.help = (Help)getSecondaryObject((DBAdapter)this.help, Help.class, + + getId_help()); + return this.help; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpCR.java new file mode 100644 index 00000000..92f275bc --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpCR.java @@ -0,0 +1,187 @@ +package it.acxent.help; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; + +public class HelpCR extends CRAdapter { + private long id_help; + + private long id_helpPadre; + + private String descrizione_it; + + private String descrizione_en; + + private long livello; + + private String indici; + + private long flgFoglia; + + private long flgVisibile = -1L; + + private long ordine; + + private long flgTipoHelp; + + private String text_it; + + private String text_en; + + private String keywords_it; + + private String keywords_en; + + private Help helpPadre; + + private String codice; + + private String strPathExport; + + public HelpCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public HelpCR() {} + + public void setId_help(long newId_help) { + this.id_help = newId_help; + } + + public void setId_helpPadre(long newId_helpPadre) { + this.id_helpPadre = newId_helpPadre; + setHelpPadre(null); + } + + public void setDescrizione_it(String newDescrizione_it) { + this.descrizione_it = newDescrizione_it; + } + + public void setDescrizione_en(String newDescrizione_en) { + this.descrizione_en = newDescrizione_en; + } + + public void setLivello(long newLivello) { + this.livello = newLivello; + } + + public void setIndici(String newIndici) { + this.indici = newIndici; + } + + public void setFlgFoglia(long newFlgFoglia) { + this.flgFoglia = newFlgFoglia; + } + + public void setFlgVisibile(long newFlgNascondi) { + this.flgVisibile = newFlgNascondi; + } + + public void setOrdine(long newOrdine) { + this.ordine = newOrdine; + } + + public void setFlgTipoHelp(long newFlgTipoHelp) { + this.flgTipoHelp = newFlgTipoHelp; + } + + public void setText_it(String newText_it) { + this.text_it = newText_it; + } + + public void setText_en(String newText_en) { + this.text_en = newText_en; + } + + public void setKeywords_it(String newKeywords_it) { + this.keywords_it = newKeywords_it; + } + + public void setKeywords_en(String newKeywords_en) { + this.keywords_en = newKeywords_en; + } + + public long getId_help() { + return this.id_help; + } + + public long getId_helpPadre() { + return this.id_helpPadre; + } + + public String getDescrizione_it() { + return (this.descrizione_it == null) ? "" : this.descrizione_it.trim(); + } + + public String getDescrizione_en() { + return (this.descrizione_en == null) ? "" : this.descrizione_en.trim(); + } + + public long getLivello() { + return this.livello; + } + + public String getIndici() { + return (this.indici == null) ? "" : this.indici.trim(); + } + + public long getFlgFoglia() { + return this.flgFoglia; + } + + public long getFlgVisibile() { + return this.flgVisibile; + } + + public long getOrdine() { + return this.ordine; + } + + public long getFlgTipoHelp() { + return this.flgTipoHelp; + } + + public String getText_it() { + return (this.text_it == null) ? "" : this.text_it.trim(); + } + + public String getText_en() { + return (this.text_en == null) ? "" : this.text_en.trim(); + } + + public String getKeywords_it() { + return (this.keywords_it == null) ? "" : this.keywords_it.trim(); + } + + public String getKeywords_en() { + return (this.keywords_en == null) ? "" : this.keywords_en.trim(); + } + + public void setHelpPadre(Help newHelpPadre) { + this.helpPadre = newHelpPadre; + } + + public Help getHelpPadre() { + this.helpPadre = (Help)getSecondaryObject((DBAdapter)this.helpPadre, Help.class, + + getId_helpPadre()); + return this.helpPadre; + } + + public String getCodice() { + return (this.codice == null) ? AB_EMPTY_STRING : this.codice.trim(); + } + + public void setCodice(String codice) { + this.codice = codice; + } + + public String getStrPathExport() { + return (this.strPathExport == null) ? "xyz" : this.strPathExport; + } + + public void setStrPathExport(String pathExport) { + this.strPathExport = pathExport; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpKeyword.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpKeyword.java new file mode 100644 index 00000000..68b2e79c --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpKeyword.java @@ -0,0 +1,109 @@ +package it.acxent.help; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class HelpKeyword extends DBAdapter implements Serializable { + private long id_helpKeyword; + + private String lang; + + private String theKey; + + private long id_help; + + private Help help; + + public HelpKeyword(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public HelpKeyword() {} + + public void setId_helpKeyword(long newId_helpKeyword) { + this.id_helpKeyword = newId_helpKeyword; + } + + public void setLang(String newLang) { + this.lang = newLang; + } + + public void setTheKey(String newTheKey) { + this.theKey = newTheKey; + } + + public void setId_help(long newId_help) { + this.id_help = newId_help; + setHelp(null); + } + + public long getId_helpKeyword() { + return this.id_helpKeyword; + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang.trim(); + } + + public String getTheKey() { + return (this.theKey == null) ? "" : this.theKey.trim(); + } + + public long getId_help() { + return this.id_help; + } + + public void setHelp(Help newHelp) { + this.help = newHelp; + } + + public Help getHelp() { + this.help = (Help)getSecondaryObject((DBAdapter)this.help, Help.class, getId_help()); + return this.help; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(HelpKeywordCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from HELP_KEYWORD AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + removeCPConnection(); + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + protected ResParm deleteByHelp(long l_id_help) { + String s_sql_delete = "delete from HELP_KEYWORD where id_help=" + l_id_help; + return delete(s_sql_delete); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpKeywordCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpKeywordCR.java new file mode 100644 index 00000000..2d7bbfb0 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpKeywordCR.java @@ -0,0 +1,67 @@ +package it.acxent.help; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; + +public class HelpKeywordCR extends CRAdapter { + private long id_helpKeyword; + + private String lang; + + private String theKey; + + private long id_help; + + private Help help; + + public HelpKeywordCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public HelpKeywordCR() {} + + public void setId_helpKeyword(long newId_helpKeyword) { + this.id_helpKeyword = newId_helpKeyword; + } + + public void setLang(String newLang) { + this.lang = newLang; + } + + public void setTheKey(String newTheKey) { + this.theKey = newTheKey; + } + + public void setId_help(long newId_help) { + this.id_help = newId_help; + setHelp(null); + } + + public long getId_helpKeyword() { + return this.id_helpKeyword; + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang.trim(); + } + + public String getTheKey() { + return (this.theKey == null) ? "" : this.theKey.trim(); + } + + public long getId_help() { + return this.id_help; + } + + public void setHelp(Help newHelp) { + this.help = newHelp; + } + + public Help getHelp() { + this.help = (Help)getSecondaryObject((DBAdapter)this.help, Help.class, + + getId_help()); + return this.help; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpRel.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpRel.java new file mode 100644 index 00000000..828aa9ad --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpRel.java @@ -0,0 +1,150 @@ +package it.acxent.help; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.db.WcString; +import it.acxent.util.StringTokenizer; +import it.acxent.util.Vectumerator; +import java.io.Serializable; +import java.sql.PreparedStatement; +import java.sql.SQLException; + +public class HelpRel extends DBAdapter implements Serializable { + private long id_helpRel; + + private long id_help1; + + private long id_help; + + private Help help1; + + private Help help; + + public HelpRel(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public HelpRel() {} + + public void setId_helpRel(long newId_helpRel) { + this.id_helpRel = newId_helpRel; + } + + public void setId_help1(long newId_help1) { + this.id_help1 = newId_help1; + setHelp1(null); + } + + public void setId_help(long newId_help2) { + this.id_help = newId_help2; + setHelp(null); + } + + public long getId_helpRel() { + return this.id_helpRel; + } + + public long getId_help1() { + return this.id_help1; + } + + public long getId_help() { + return this.id_help; + } + + public void setHelp1(Help newHelp1) { + this.help1 = newHelp1; + } + + public Help getHelp1() { + this.help1 = (Help)getSecondaryObject((DBAdapter)this.help1, Help.class, getId_help1()); + return this.help1; + } + + public void setHelp(Help newHelp2) { + this.help = newHelp2; + } + + public Help getHelp() { + this.help = (Help)getSecondaryObject((DBAdapter)this.help, Help.class, getId_help()); + return this.help; + } + + protected ResParm checkDeleteCascade() { + return new ResParm(true); + } + + protected void deleteCascade() {} + + public Vectumerator findByCR(HelpRelCR CR, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from HELP_REL AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + if (!CR.getSearchTxt().trim().isEmpty()) { + StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(), " "); + StringBuffer txt = new StringBuffer("("); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + txt.append("(A.Cognome like '%" + token + "%' or A.Nome like '%" + token + "%')"); + if (st.hasMoreTokens()) + txt.append(" and "); + } + txt.append(")"); + wc.addWc(txt.toString()); + } + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public Vectumerator findById_help(long l_id_help, int pageNumber, int pageRows) { + String s_Sql_Find = "select A.* from HELP_REL AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("(id_help1=" + l_id_help + " or id_help=" + l_id_help + ")"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + return findRows(stmt, pageNumber, pageRows); + } catch (SQLException e) { + handleDebug(e); + return AB_EMPTY_VECTUMERATOR; + } + } + + public void findById_helpId_help1(long l_id_help, long l_id_help1) { + String s_Sql_Find = "select A.* from HELP_REL AS A"; + String s_Sql_Order = ""; + WcString wc = new WcString(); + wc.addWc("((id_help1=" + l_id_help1 + " and id_help=" + l_id_help + ") or(id_help1=" + l_id_help + " and id_help=" + l_id_help1 + "))"); + try { + PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + + wc.toString()); + findFirstRecord(stmt); + } catch (SQLException e) { + handleDebug(e); + } + } + + public Help getHelpAssociato(long l_id) { + if (l_id == getId_help1()) + return getHelp(); + if (l_id == getId_help()) + return getHelp1(); + return new Help(getApFull()); + } + + public long getId_help1(long l_id) { + if (l_id == getId_help1()) + return getId_help(); + if (l_id == getId_help()) + return getId_help1(); + return 0L; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpRelCR.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpRelCR.java new file mode 100644 index 00000000..64d72a75 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/HelpRelCR.java @@ -0,0 +1,71 @@ +package it.acxent.help; + +import it.acxent.db.ApplParmFull; +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; + +public class HelpRelCR extends CRAdapter { + private String id_helpRel; + + private long id_help1; + + private long id_help2; + + private Help help1; + + private Help help2; + + public HelpRelCR(ApplParmFull newApplParmFull) { + super(newApplParmFull); + } + + public HelpRelCR() {} + + public void setId_helpRel(String newId_helpRel) { + this.id_helpRel = newId_helpRel; + } + + public void setId_help1(long newId_help1) { + this.id_help1 = newId_help1; + setHelp1(null); + } + + public void setId_help2(long newId_help2) { + this.id_help2 = newId_help2; + setHelp2(null); + } + + public String getId_helpRel() { + return (this.id_helpRel == null) ? "" : this.id_helpRel.trim(); + } + + public long getId_help1() { + return this.id_help1; + } + + public long getId_help2() { + return this.id_help2; + } + + public void setHelp1(Help newHelp1) { + this.help1 = newHelp1; + } + + public Help getHelp1() { + this.help1 = (Help)getSecondaryObject((DBAdapter)this.help1, Help.class, + + getId_help1()); + return this.help1; + } + + public void setHelp2(Help newHelp2) { + this.help2 = newHelp2; + } + + public Help getHelp2() { + this.help2 = (Help)getSecondaryObject((DBAdapter)this.help2, Help.class, + + getId_help2()); + return this.help2; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/servlet/ExcludeKeywordsSvlt.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/servlet/ExcludeKeywordsSvlt.java new file mode 100644 index 00000000..4b35af48 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/servlet/ExcludeKeywordsSvlt.java @@ -0,0 +1,31 @@ +package it.acxent.help.servlet; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.help.ExcludeKeywords; +import it.acxent.help.ExcludeKeywordsCR; +import it.acxent.servlet.AblServletSvlt; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ExcludeKeywordsSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new ExcludeKeywords(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new ExcludeKeywordsCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return true; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/servlet/HelpASvlt.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/servlet/HelpASvlt.java new file mode 100644 index 00000000..b2973278 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/servlet/HelpASvlt.java @@ -0,0 +1,192 @@ +package it.acxent.help.servlet; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.db.ResParm; +import it.acxent.help.Help; +import it.acxent.help.HelpAllegato; +import it.acxent.help.HelpCR; +import it.acxent.help.HelpRel; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.AbMessages; +import it.acxent.util.Vectumerator; +import java.io.File; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class HelpASvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) { + long l_id = 0L; + ResParm rp = new ResParm(true, ""); + l_id = getRequestLongParameter(req, "id_help"); + Help bean = new Help(getApFull(req)); + try { + bean.findByPrimaryKey(l_id); + if (getAct(req).equals("addAllegato")) { + HelpAllegato row = new HelpAllegato(getApFull(req)); + fillObject(req, row); + rp = bean.addAllegato(row); + rp.append(creaFileAllegato(bean, req, res)); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getAct(req).equals("delAllegato")) { + HelpAllegato row = new HelpAllegato(getApFull(req)); + fillObject(req, row); + rp = bean.delAllegato(row); + sendMessage(req, + + AbMessages.getMessage(getLocale(req), "SAVE_OK") + ": Allegato Cancellato"); + showBean(req, res); + } else if (getAct(req).equals("addHelp")) { + HelpRel row = new HelpRel(getApFull(req)); + if (getRequestLongParameter(req, "id_help") != 0L) { + fillObject(req, row); + rp = bean.addHelp(row); + sendMessage(req, rp.getMsg()); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } else if (getAct(req).equals("delHelp")) { + HelpRel row = new HelpRel(getApFull(req)); + if (getRequestLongParameter(req, "id_help") != 0L) { + fillObject(req, row); + bean.delHelp(row); + sendMessage(req, AbMessages.getMessage(getLocale(req), "DELETE_OK")); + } else { + sendMessage(req, AbMessages.getMessage(getLocale(req), "READ_FAIL")); + } + showBean(req, res); + } + } catch (Exception e) { + forceMessage(req, + AbMessages.getMessage(getLocale(req), "SAVE_FAIL")); + showBean(req, res); + } + } + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Help bean = (Help)beanA; + req.setAttribute("listaAllegati", bean.getHelpAllegati()); + req.setAttribute("listaHelpRel", bean.getHelpRel()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Help(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new HelpCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected boolean isSimpleServlet(HttpServletRequest req) { + return false; + } + + protected void xmanageMultipartRequest(HttpServletRequest req, HttpServletResponse res) { + String targetDir = getParm("PATH_TMP").getTesto(); + String[] fileNameParameters = { "nomeFile" }; + try { + if (getLoginUserGrant(req, new Help().getTableBeanName()) >= 3L) { + if (manageMultipartRequestParameters(req, 2000, fileNameParameters, null, null, targetDir)) { + processNoEncTypeRequest(req, res); + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "MR_FILE_ERROR")); + showBean(req, res); + } + } else { + sendGrantMessage(req, AbMessages.getMessage(getLocale(req), "GRANT_NO_RW")); + showBean(req, res); + } + } catch (Exception e) { + handleDebug(e); + } + } + + protected ResParm creaFileAllegato(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + synchronized (this) { + ResParm rp = new ResParm(true, ""); + Help bean = (Help)beanA; + String targetDir = getDocBase() + getDocBase(); + File pathDir = new File(targetDir); + if (!pathDir.exists()) + pathDir.mkdirs(); + String targetFile = targetDir + targetDir + "_"; + Vectumerator completeFileNames = (Vectumerator) + req.getAttribute("completeAttachName"); + Vectumerator fileNames = (Vectumerator) + req.getAttribute("attachName"); + if (completeFileNames.hasMoreElements()) { + String sourceFile = completeFileNames.nextElement(); + String fileName = fileNames.elementAt(0); + targetFile = targetFile + targetFile; + if (isFileExist(sourceFile)) { + new File(targetFile).delete(); + new File(sourceFile).renameTo(new File(targetFile)); + } + } + return rp; + } + } + + protected boolean isLoadImageServlet() { + return true; + } + + protected ResParm afterImgFileSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Help bean = (Help)beanA; + String oldImgTmst = bean.getImgTmst(); + ResParm rp = super.afterImgFileSave(bean, req, res); + String temp = bean.getText(); + long l_totImgNumber = getRequestLongParameter(req, "totImgNumber"); + if (l_totImgNumber == 0L) + l_totImgNumber = 4L; + for (int i = 1; (long)i <= l_totImgNumber; i++) + temp = temp.replaceAll(bean.getImgFileName(i, oldImgTmst), + bean.getImgFileName(i)); + bean.setText(temp); + rp.append(bean.save()); + return rp; + } + + protected void otherCommands(HttpServletRequest req, HttpServletResponse res) { + if (getCmd(req).equals("idx")) { + Help bean = new Help(getApFull(req)); + long l_id_help = getRequestLongParameter(req, "id_help"); + bean.findByPrimaryKey(l_id_help); + ResParm rp = bean.indicizzaKeyword(); + sendMessage(req, rp.getMsg()); + showBean(req, res); + } else if (getCmd(req).equals("idxAll")) { + Help bean = new Help(getApFull(req)); + HelpCR CR = new HelpCR(getApFull(req)); + fillObject(req, CR); + Vectumerator vec = bean.findByCR(CR, 0, 0); + int numHelpIdx = 0; + while (vec.hasMoreElements()) { + Help row = vec.nextElement(); + ResParm rp = row.indicizzaKeyword(); + if (rp.getStatus()) + numHelpIdx++; + } + sendMessage(req, "Numero record indicizzati: " + numHelpIdx); + search(req, res); + } else if (getCmd(req).equals("exporta")) { + Help hlp = new Help(getApFull(req)); + ResParm rp = hlp.exportHelp(); + req.setAttribute("strPathExport", getPathTmp() + "helpExp.zip"); + sendMessage(req, rp.getMsg()); + search(req, res); + } else if (getCmd(req).equals("importa")) { + Help hlp = new Help(getApFull(req)); + ResParm rp = hlp.importHelp(); + sendMessage(req, rp.getMsg()); + search(req, res); + } + super.otherCommands(req, res); + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/servlet/HelpSvlt.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/servlet/HelpSvlt.java new file mode 100644 index 00000000..c1f9c5ed --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/servlet/HelpSvlt.java @@ -0,0 +1,86 @@ +package it.acxent.help.servlet; + +import it.acxent.db.CRAdapter; +import it.acxent.db.DBAdapter; +import it.acxent.help.Help; +import it.acxent.help.HelpCR; +import it.acxent.servlet.AblServletSvlt; +import it.acxent.util.StringTokenizer; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class HelpSvlt extends AblServletSvlt { + protected void addRows(HttpServletRequest req, HttpServletResponse res) {} + + protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) { + Help bean = (Help)beanA; + req.setAttribute("listaAllegati", bean.getHelpAllegati()); + req.setAttribute("listaPadri", bean.findPadri()); + req.setAttribute("listaHelpRel", bean.getHelpRel()); + } + + protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {} + + protected DBAdapter getBean(HttpServletRequest req) { + return new Help(getApFull(req)); + } + + protected CRAdapter getBeanCR(HttpServletRequest req) { + return new HelpCR(getApFull(req)); + } + + protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {} + + protected void sqlActions(HttpServletRequest req, HttpServletResponse res) { + showBean(req, res); + } + + protected void search(HttpServletRequest req, HttpServletResponse res) { + HelpCR CR = new HelpCR(getApFull(req)); + fillObject(req, CR); + if (CR.getSearchTxt().isEmpty()) { + sendMessage(req, "Campo di ricerca vuoto"); + } else { + Help help = new Help(getApFull(req)); + req.setAttribute("list", + help.findByCR(CR, getPageNumber(req), getPageRow())); + } + req.setAttribute("CR", CR); + setJspPageRelative("helpCR.jsp", req); + callJsp(req, res); + } + + protected boolean isSecureServlet(HttpServletRequest req) { + if (getParm("HELP_PUBLIC_CODES").getTesto().trim() + .equals("*")) + return false; + if (getParm("HELP_PUBLIC_CODES").getTesto().trim() + .isEmpty()) + return true; + StringTokenizer st = new StringTokenizer(getParm("HELP_PUBLIC_CODES") + .getTesto().trim(), ","); + while (st.hasMoreTokens()) { + String cod = st.nextToken().trim().toLowerCase(); + if (getRequestParameter(req, "cod").toLowerCase() + .indexOf(cod) >= 0) + return false; + } + return true; + } + + protected void showBean(HttpServletRequest req, HttpServletResponse res) { + String l_codice = getRequestParameter(req, "cod"); + if (!l_codice.isEmpty()) { + Help bean = new Help(getApFull(req)); + bean.findByCodice(l_codice); + req.setAttribute("bean", bean); + if (bean.getDBState() == 0) + sendMessage(req, "ERRORE: help per " + l_codice + " non presente."); + } + super.showBean(req, res); + } + + protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) { + return "admin/help/v/helpView.jsp"; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/taglib/HelpListJQTreeTag.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/taglib/HelpListJQTreeTag.java new file mode 100644 index 00000000..f663f03d --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/taglib/HelpListJQTreeTag.java @@ -0,0 +1,120 @@ +package it.acxent.help.taglib; + +import it.acxent.db.DBAdapter; +import it.acxent.help.Help; +import it.acxent.help.HelpCR; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import javax.servlet.jsp.JspException; + +public class HelpListJQTreeTag extends AbstractDbTag { + private StringBuffer bodyString; + + private Help help; + + private long id_help; + + private boolean solovisibili; + + private HelpCR CR = new HelpCR(); + + public int doAfterBody() throws JspException { + try { + if (isSolovisibili()) + this.CR.setFlgVisibile(1L); + String body = getBodyContent().getString().trim(); + if (!body.isEmpty()) { + this.bodyString = new StringBuffer(); + this.bodyString.append("
      "); + Vectumerator vec = getHelp().findFigli(this.CR, 0, 0); + while (vec.hasMoreElements()) + aggiungiFigli(this.bodyString, vec.nextElement()); + this.bodyString.append("
    "); + } + } catch (Exception e) { + this.bodyString.append("Nessu argomento visibile..."); + } + return 0; + } + + public int doEndTag() throws JspException { + try { + if (getBodyContent() == null) + throw new JspException("Tag tarlist: doEndTag(): body content must be NOT empty"); + getBodyContent().getEnclosingWriter().print(this.bodyString); + } catch (IOException ioe) { + throw new JspException("Tag HelpListJQTreeTag: doEndTag(): " + + ioe.getMessage()); + } + return super.doEndTag(); + } + + public int doStartTag() { + return 2; + } + + protected StringBuffer aggiungiFigli(StringBuffer sb, Help currentHelp) { + long numris = 0L; + if (currentHelp.getId_help() != 0L) { + Vectumerator vec1 = currentHelp.findFigli(this.CR, 0, 0); + if (vec1.getTotNumberOfRecords() > 0) { + if (currentHelp.getId_help() != 0L) { + sb.append("
  • "); + sb.append(currentHelp.getDescrizione4Script()); + sb.append(""); + } + sb.append("
      "); + while (vec1.hasMoreElements()) + aggiungiFigli(sb, vec1.nextElement()); + sb.append("
    "); + sb.append("
  • \n"); + } else { + sb.append("
  • "); + sb.append(currentHelp.getDescrizione4Script()); + sb.append("
  • \n"); + } + } + return sb; + } + + public Help getHelp() { + if (this.help == null && getId_help() != 0L) + try { + DBAdapter help = getHelpBean(); + help.findByPrimaryKey(getId_help()); + } catch (Exception e) { + e.printStackTrace(); + } + return (this.help == null) ? (Help)getHelpBean() : this.help; + } + + public long getId_help() { + return this.id_help; + } + + public void setHelp(Help help) { + this.help = help; + } + + public void setId_help(long id_help) { + this.id_help = id_help; + setHelp(null); + } + + protected DBAdapter getHelpBean() { + return new Help(getApFull()); + } + + public boolean isSolovisibili() { + return this.solovisibili; + } + + public void setSolovisibili(boolean solovisibili) { + this.solovisibili = solovisibili; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/taglib/HelpListTreeTag.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/taglib/HelpListTreeTag.java new file mode 100644 index 00000000..8853f869 --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/taglib/HelpListTreeTag.java @@ -0,0 +1,165 @@ +package it.acxent.help.taglib; + +import it.acxent.db.DBAdapter; +import it.acxent.help.Help; +import it.acxent.help.HelpCR; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.ReturnItem; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import javax.servlet.jsp.JspException; + +public class HelpListTreeTag extends AbstractDbTag { + private StringBuffer bodyString; + + private long id_help; + + private Help help; + + private boolean solovisibili; + + public int doAfterBody() throws JspException { + try { + String body = getBodyContent().getString().trim(); + if (!body.isEmpty()) { + this.bodyString = new StringBuffer(); + this.bodyString.append(""); + } + return 0; + } catch (Exception e) { + throw new JspException("Tag tarlist: doAfterBody(): " + + e.getMessage()); + } + } + + public int doEndTag() throws JspException { + try { + if (getBodyContent() == null) + throw new JspException("Tag tarlist: doEndTag(): body content must be NOT empty"); + getBodyContent().getEnclosingWriter().print(this.bodyString); + } catch (IOException ioe) { + throw new JspException("Tag HelpListTreeTag: doEndTag(): " + + ioe.getMessage()); + } + return super.doEndTag(); + } + + public int doStartTag() { + return 2; + } + + protected StringBuffer aggiungiFigli(StringBuffer sb, Help currentHelp) { + HelpCR CR = new HelpCR(); + if (isSolovisibili()) + CR.setFlgVisibile(1L); + Vectumerator vec = currentHelp.findFigli(CR, 0, 0); + ReturnItem RI = (ReturnItem)getReq().getAttribute("RI"); + if (RI != null) { + RI.setRiValues(""); + RI.addRiValues(currentHelp.getId_help()); + RI.addRiValues(currentHelp.getDescrizioneCompleta()); + } + if (vec.hasMoreElements()) { + sb.append("var _"); + sb.append(currentHelp.getId_help()); + if (currentHelp.getId_help() != getId_help()) { + sb.append("=new WebFXTreeItem(\""); + } else { + sb.append("=new WebFXTree(\""); + } + if (currentHelp.getId_help() != 0L) { + sb.append(currentHelp.getDescrizione4Script()); + } else { + sb.append("Elenco Argomenti"); + } + if (RI != null) { + sb.append("\",\"javascript:selectKey("); + sb.append(RI.getSelectedKey()); + sb.append(")\");\n\t"); + } else { + sb.append("\",\"javascript:selectHelp('"); + sb.append(currentHelp.getCodice()); + sb.append("')\");\n\t"); + } + if (currentHelp.getId_help() != 0L) { + sb.append("_" + currentHelp.getId_helpPadre()); + sb.append(".add(_"); + sb.append(currentHelp.getId_help()); + sb.append(");\n\t"); + } + while (vec.hasMoreElements()) + aggiungiFigli(sb, vec.nextElement()); + } else { + sb.append("_" + currentHelp.getId_helpPadre()); + sb.append(".add(new WebFXTreeItem(\""); + sb.append(currentHelp.getDescrizione4Script()); + if (RI != null) { + sb.append("\",\"javascript:selectKey("); + sb.append(RI.getSelectedKey()); + sb.append(")\"));\n\t"); + } else { + sb.append("\",\"javascript:selectHelp('"); + sb.append(currentHelp.getCodice()); + sb.append("')\"));\n\t"); + } + } + return sb; + } + + private String getCbName(String fbn) { + int idxStart = fbn.substring(0, fbn.length() - 1).lastIndexOf("/") + 1; + int idxEnd = fbn.length() - 1; + return fbn.substring(idxStart, idxEnd); + } + + private String getParentBranchName(String fbn) { + int idxStart = 0; + int idxEnd = fbn.substring(0, fbn.length() - 1).lastIndexOf("/") + 1; + return fbn.substring(idxStart, idxEnd); + } + + private String getLeafName(String fbn) { + int idxStart = fbn.substring(0, fbn.length() - 1).lastIndexOf("/") + 1; + int idxEnd = fbn.length(); + return fbn.substring(idxStart, idxEnd); + } + + public long getId_help() { + return this.id_help; + } + + public Help getHelp() { + if (this.help == null && getId_help() != 0L) + try { + DBAdapter help = getHelpBean(); + help.findByPrimaryKey(getId_help()); + } catch (Exception e) { + e.printStackTrace(); + } + return (this.help == null) ? (Help)getHelpBean() : this.help; + } + + public void setId_help(long id_help) { + this.id_help = id_help; + setHelp(null); + } + + public void setHelp(Help help) { + this.help = help; + } + + protected DBAdapter getHelpBean() { + return new Help(getApFull()); + } + + public boolean isSolovisibili() { + return this.solovisibili; + } + + public void setSolovisibili(boolean solovisibili) { + this.solovisibili = solovisibili; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/taglib/WhileHelpTag.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/taglib/WhileHelpTag.java new file mode 100644 index 00000000..f868542b --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/taglib/WhileHelpTag.java @@ -0,0 +1,132 @@ +package it.acxent.help.taglib; + +import it.acxent.help.Help; +import it.acxent.help.HelpCR; +import it.acxent.taglib.AbstractDbTag; +import it.acxent.util.Vectumerator; +import java.io.IOException; +import java.io.Writer; +import javax.servlet.jsp.JspException; + +public class WhileHelpTag extends AbstractDbTag { + private String rowbeanname; + + private Vectumerator theList; + + private String lang; + + private long id_HelpPadre; + + private long id_HelpPadreSelected; + + private long id_reparto; + + private String flgStockOfferte; + + public int doAfterBody() throws JspException { + try { + boolean flgOk = false; + Help obj = null; + while (this.theList.hasMoreElements()) { + if (!(obj = this.theList.nextElement()).getDescrizioneCompleta(getLang()).equals("")) { + flgOk = true; + break; + } + } + if (flgOk) { + this.pageContext.setAttribute(getRowbeanname(), obj); + return 2; + } + this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter()); + return 0; + } catch (IOException ioexception) { + throw new JspException(ioexception.getMessage()); + } catch (Exception exception) { + throw new JspException(exception.getMessage()); + } + } + + public void doInitBody() {} + + public int doStartTag() { + try { + if (getId_HelpPadre() != 0L && + getId_HelpPadre() != getId_HelpPadreSelected()) + return 0; + Help bean = new Help(getApFull()); + if (getId_HelpPadre() != 0L) + bean.findByPrimaryKey(getId_HelpPadre()); + HelpCR CR = new HelpCR(); + CR.setFlgVisibile(1L); + this.theList = bean.findFigli(CR, 0, 0); + } catch (Exception e) { + this.theList = new Vectumerator(); + } + if (this.theList == null) + return 0; + this.pageContext.getRequest().setAttribute("listaTipi", this.theList); + this.theList.moveFirst(); + boolean flgOk = false; + Help obj = null; + while (this.theList.hasMoreElements()) { + if (!(obj = this.theList.nextElement()).getDescrizioneCompleta(getLang()).equals("")) { + flgOk = true; + break; + } + } + if (flgOk) { + this.pageContext.setAttribute(getRowbeanname(), obj); + return 2; + } + return 0; + } + + public String getRowbeanname() { + return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname; + } + + public void setRowbeanname(String s) { + this.rowbeanname = s; + } + + public long getId_HelpPadreSelected() { + return this.id_HelpPadreSelected; + } + + public void setId_HelpPadreSelected(long id_HelpPadreSelected) { + this.id_HelpPadreSelected = id_HelpPadreSelected; + } + + public String getLang() { + return (this.lang == null) ? "" : this.lang; + } + + public void setLang(String lang) { + this.lang = lang; + } + + public long getId_HelpPadre() { + return this.id_HelpPadre; + } + + public void setId_HelpPadre(long id_HelpPadre) { + this.id_HelpPadre = id_HelpPadre; + } + + public long getId_reparto() { + return this.id_reparto; + } + + public void setId_reparto(long id_reparto) { + this.id_reparto = id_reparto; + } + + public String getFlgStockOfferte() { + return (this.flgStockOfferte == null) ? "" : + this.flgStockOfferte; + } + + public void setFlgStockOfferte(String flgStato) { + this.flgStockOfferte = flgStato; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/taglib/WhileHelpTagExtraInfo.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/taglib/WhileHelpTagExtraInfo.java new file mode 100644 index 00000000..21b7394e --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/help/taglib/WhileHelpTagExtraInfo.java @@ -0,0 +1,15 @@ +package it.acxent.help.taglib; + +import javax.servlet.jsp.tagext.TagData; +import javax.servlet.jsp.tagext.TagExtraInfo; +import javax.servlet.jsp.tagext.VariableInfo; + +public class WhileHelpTagExtraInfo extends TagExtraInfo { + public VariableInfo[] getVariableInfo(TagData tagdata) { + String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? + tagdata.getAttributeString("rowbeanname") : + "rowBean"; + String rowBeanClass = "it.acxent.help.Help"; + return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0) }; + } +} diff --git a/decompiled-libs/www/acxent-core-1.0.1/it/acxent/jsp/Ab.java b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/jsp/Ab.java new file mode 100644 index 00000000..05a4fb5c --- /dev/null +++ b/decompiled-libs/www/acxent-core-1.0.1/it/acxent/jsp/Ab.java @@ -0,0 +1,511 @@ +package it.acxent.jsp; + +import it.acxent.util.StringTokenizer; +import java.util.Enumeration; +import java.util.Locale; +import javax.servlet.http.HttpServletRequest; + +public final class Ab { + public static final String LOCALE_RUSSIAN = "ru"; + + public static final String LOCALE_CHINESE_CN = "cn"; + + public static final String LOCALE_CHINESE_CH = "ch"; + + public static final String LOCALE_ESPANOL = "es"; + + public static final String JS_SCRIPT_OPEN = "\n\n"; + + public static final String jsDateInput(String nextFocus, String printDate) { + return jsDateInput(nextFocus, printDate, false, null); + } + + private static final String jsDateInput(String nextFocus, String printDate, boolean submit, String jscript) { + String onKeyUp, onKeyDown, onBlur; + if (jscript == null) + jscript = "Ab.submitForm(event);"; + String nextField = (nextFocus == null || nextFocus.indexOf('(') >= 0) ? "" : (" nextField=\"" + + nextFocus + "\" "); + String onFocus = " onFocus=\"this.select();\""; + String onChange = " onChange=\"checkDate(this)\""; + if (nextFocus == null) { + onKeyUp = " onKeyUp=\"formatDate(this, event.keyCode,'up')\""; + } else { + onKeyUp = " onKeyUp=\"if(event.keyCode==13) {Ab.focusNextOnCr(event,'" + nextFocus + "');} else if(event.keyCode==112) {Ab.focusNextOnCr(event,'" + nextFocus + "');} else {formatDate(this,event.keyCode,'up')}\" "; + } + if (submit) { + onKeyDown = " onKeyDown=\"if(event.keyCode==13 ) {if(checkDate(this)){" + jscript + "}} else {Ab.formatDate(this, event.keyCode,'down')}\" "; + } else { + onKeyDown = " onKeyDown=\"formatDate(this, event.keyCode,'down')\""; + } + if (printDate == null) { + onBlur = ""; + } else { + onBlur = " onBlur=\"printDate(this,'" + printDate + "');\""; + } + return nextField + nextField + onFocus + onChange + onKeyDown + onKeyUp; + } + + public static final String jsDateInputS(String jscript) { + return jsDateInput(null, null, true, jscript); + } + + public static final String jsDateInput(String nextFocus) { + return jsDateInput(nextFocus, null); + } + + public static final String jsDateInputDS(String printDate) { + return jsDateInput(null, printDate, true, null); + } + + public static final String jsNumberInputS() { + return jsNumberInput(null, true, null); + } + + public static final String onSubmitSave() { + return "if (getElementById('NS').value==0){alert('pio');if(checkFields()) formSaveCommand();else return false;}else return false;"; + } + + public static final String jsDateInputS() { + return jsDateInput(null, null, true, null); + } + + public static final String jsCr(String nextFocus) { + return jsCr(nextFocus, 0L); + } + + public static final String jsCr(String nextFocus, long fieldLength) { + String onFocus = " onFocus=\"if(this.type!='select-one') this.select();\""; + if (nextFocus != null && !nextFocus.isEmpty()) { + String onKeyUp; + String nextField = (nextFocus == null || nextFocus.indexOf('(') >= 0) ? "" : (" nextField=\"" + + nextFocus + "\" "); + String onKeyDown = " onkeydown=\"if(this.type=='select-one' && event.keyCode==13) event.preventDefault()\""; + if (fieldLength > 0L) { + onKeyUp = " onKeyUp=\"Ab.focusNext(this,event,'" + nextFocus + "'," + fieldLength + ");\""; + } else { + onKeyUp = " onKeyUp=\"Ab.focusNextOnCr(event,'" + nextFocus + "');\""; + } + return nextField + nextField + onFocus + onKeyDown; + } + return onFocus; + } + + public static final String jsCrS() { + return jsCrS("Ab.submitForm(event);"); + } + + public static final String jsSwInit(String searchFields) { + StringTokenizer st = new StringTokenizer(searchFields, ","); + StringBuffer initScript = new StringBuffer("\n\n"); + String dummy = ""; + return String.valueOf(initScript) + String.valueOf(initScript); + } + + public static final String jsSwD(String theSvlt, String searchField, String nextFocus, String returnFields) { + return jsSw("dettaglio", theSvlt, searchField, nextFocus, returnFields); + } + + public static final String jsSwR(String theSvlt, String searchField, String nextFocus, String returnFields) { + return jsSw("ricerca", theSvlt, searchField, nextFocus, returnFields); + } + + public static final String jsSetFocus(String focusField) { + StringBuilder focusScript = new StringBuilder("\n\n"); + return focusScript.toString(); + } + + private static final String jsAjSearchText(String theSvlt, String searchField, String divList, String returnFields, long nChar, String nextFocus, boolean useSubmit, boolean useMono) { + String onKeyUp; + String nextField = (nextFocus == null || nextFocus.indexOf('(') >= 0) ? "" : (" nextField=\"" + + nextFocus + "\" "); + String onFocus = " onFocus=\"this.select();\""; + String onMouseUp = ""; + String mono = useMono ? "M" : ""; + if (nChar > 0L) { + if (useSubmit) { + onKeyUp = " onKeyUp='caricaLista" + mono + "(\"" + theSvlt + "\",\"" + searchField + "\",\"" + divList + "\",\"" + returnFields + "\",event," + nChar + ",\"\",true)'"; + } else { + onKeyUp = " onKeyUp='caricaLista" + mono + "(\"" + theSvlt + "\",\"" + searchField + "\",\"" + divList + "\",\"" + returnFields + "\",event," + nChar + ",\"" + nextFocus + "\")'"; + } + } else if (useSubmit) { + onKeyUp = " onKeyUp='caricaListaS" + mono + "(\"" + theSvlt + "\",\"" + searchField + "\",\"" + divList + "\",\"" + returnFields + "\",event,\"\",true)'"; + } else { + onKeyUp = " onKeyUp='caricaListaS" + mono + "(\"" + theSvlt + "\",\"" + searchField + "\",\"" + divList + "\",\"" + returnFields + "\",event,\"" + nextFocus + "\")'"; + } + return nextField + nextField + onFocus + onKeyUp; + } + + public static final String jsAjSearchText4(String theSvlt, String searchField, String divList, String returnFields, long nChar, String nextFocus) { + return jsAjSearchText4(theSvlt, searchField, divList, returnFields, nChar, nextFocus, false, false); + } + + public static final String jsAjSearchTextS(String theSvlt, String searchField, String divList, String returnFields, long nChar) { + return jsAjSearchText(theSvlt, searchField, divList, returnFields, nChar, "", true, false); + } + + public static final String styAjSearchText(long width) { + if (width == 0L) + width = 300L; + String theStyle = "style=\"vertical-align:top; position:absolute; width: " + width + "px; height:auto; background-color: #FFFFFF; z-index: 100; border-right:thin;border-left:thin;border-bottom:solid; border-color:#999999;overflow: auto; visibility: hidden;display: none;\""; + return theStyle; + } + + public static final String divAjSearchDiv4(String theSearchDiv) { + String theDIv = "
    "; + return theDIv; + } + + public static final String inputAjSearchDivOld(long idx, String sk, String divList, String descValue) { + String inputField = "= 0) ? "" : (" nextField=\"" + + nextFocus + "\" "); + String onFocus = " onFocus=\"this.select();\""; + if (submit) { + onKeyUp = " onKeyUp=\"if(event.keyCode==13 ) {{" + jscript + "}} else if(event.keyCode==112) {Ab.focusNextOnCr(event,'" + nextFocus + "');} else {formatTime(this, event.keyCode,'up')}\" "; + } else if (nextFocus == null) { + onKeyUp = " onKeyUp=\"formatTime(this, event.keyCode,'up')\""; + } else { + onKeyUp = " onKeyUp=\"if(event.keyCode==13) {Ab.focusNextOnCr(event,'" + nextFocus + "');} else if(event.keyCode==112) {Ab.focusNextOnCr(event,'" + nextFocus + "');} else {formatTime(this,event.keyCode,'up')}\" "; + } + String onKeyDown = " onKeyDown=\"formatTime(this, event.keyCode,'down')\""; + String onBlur = " onBlur=\"parseTime(this)\""; + return nextField + nextField + onFocus + onKeyDown + onKeyUp; + } + + public static final String jsDateInput() { + return jsDateInput(null, null); + } + + public static final String jsNumberInputS(String jscript) { + return jsNumberInput(null, true, jscript); + } + + public static final String jsNumberInput() { + return jsNumberInput(null, true, null); + } + + public static final String jsSw(String form, String theSvlt, String searchField, String nextFocus, String returnFields) { + String onKeyUp; + String varChanged = searchField + "Changed"; + if (form == null || form.isEmpty()) + form = "dettaglio"; + StringTokenizer st = new StringTokenizer(returnFields, ","); + StringBuffer rf = new StringBuffer(); + while (st.hasMoreTokens()) { + String token = st.nextToken(); + if (rf.length() > 0) + rf.append(","); + rf.append(form); + rf.append("."); + rf.append(token); + } + String onFocus = " onFocus=\"this.select();\""; + String onKeyDown = ""; + if (nextFocus != null && !nextFocus.isEmpty()) { + onKeyUp = " onKeyUp=\"if(event.keyCode==13) {document.getElementById('" + nextFocus + "').focus();}\" "; + } else { + onKeyUp = " onKeyUp=\"if(event.keyCode==13) {onblur();}\" "; + } + String onBlur = " onBlur=\"if(" + varChanged + "){openSW('" + theSvlt + "'+ " + form + "." + searchField + ".value,'" + + rf.toString(); + if (nextFocus != null && !nextFocus.isEmpty()) { + onBlur = onBlur + ",NSF." + onBlur + "." + form + "');" + nextFocus + "=false;}\" "; + } else { + onBlur = onBlur + "');" + onBlur + "=false;}\" "; + } + String onChange = "onChange=\"" + varChanged + "=true;\""; + return onBlur + onBlur + onKeyDown + onKeyUp + onChange; + } + + public static final String jsAjSearchTextM(String theSvlt, String searchField, String divList, String returnFields, long nChar, String nextFocus) { + return jsAjSearchText(theSvlt, searchField, divList, returnFields, nChar, nextFocus, false, true); + } + + public static final String jsAjSearchTextSM(String theSvlt, String searchField, String divList, String returnFields, long nChar) { + return jsAjSearchText(theSvlt, searchField, divList, returnFields, nChar, "", true, true); + } + + public static final String jsCrS(String jscript) { + String onFocus = " onFocus=\"if(this.type!='select-one') this.select();\""; + String onKeyDown = " onKeyDown=\"if(event.keyCode==13) " + jscript + "\""; + String onKeyUp = " onKeyUp=\"if(event.keyCode==112) {Ab.focusNextOnCr(event,'');}\""; + return onFocus + onFocus + onKeyDown; + } + + public static final String jsDateInputDS(String printDate, String jscript) { + return jsDateInput(null, printDate, true, jscript); + } + + public static final String jsNumberInput(String nextFocus) { + return jsNumberInput(nextFocus, false, null); + } + + private static final String jsNumberInput(String nextFocus, boolean submit, String jscript) { + String onKeyUp, onKeyDown; + if (jscript == null) + jscript = "Ab.submitForm(event);"; + String nextField = (nextFocus == null || nextFocus.indexOf('(') >= 0) ? "" : (" nextField=\"" + + nextFocus + "\" "); + String onFocus = " onFocus=\"this.select();\""; + if (nextFocus == null) { + onKeyUp = " onKeyUp=\"checkNumber(this, event.keyCode,'up')\""; + } else { + onKeyUp = " onKeyUp=\"if(event.keyCode==13) {Ab.focusNextOnCr(event,'" + nextFocus + "');} else if(event.keyCode==112) {Ab.focusNextOnCr(event,'" + nextFocus + "');} else {checkNumber(this,event.keyCode,'up')}\" "; + } + if (submit) { + onKeyDown = " onKeyDown=\"if(event.keyCode==13 ) {{" + jscript + "}} \" "; + } else { + onKeyDown = ""; + } + return nextField + nextField + onFocus + onKeyDown; + } + + public static final String jsTimeInput() { + return jsTimeInput(null, false, null); + } + + public static final String jsTimeInput(String nextFocus) { + return jsTimeInput(nextFocus, false, null); + } + + public static final String jsTimeInputS() { + return jsTimeInput(null, true, null); + } + + public static final String jsTimeInputS(String jscript) { + return jsTimeInput(null, true, jscript); + } + + public static final String jsAjSearchTextSM(String theSvlt, String searchField, String divList, String returnFields, long nChar, String nextFocus) { + return jsAjSearchText(theSvlt, searchField, divList, returnFields, nChar, nextFocus, true, true); + } + + public static final String inputAjSearchDiv4(long idx, String sk, String divList, String descValue) { + String inputField = ""; + return inputField; + } + + private static final String jsTimeInputOld(String nextFocus, boolean submit, String jscript) { + String onKeyUp, onKeyDown; + if (jscript == null) + jscript = "Ab.submitForm(event);"; + String onFocus = " onFocus=\"this.select();\""; + if (nextFocus == null) { + onKeyUp = " onKeyUp=\"formatTime(this, event.keyCode,'up')\""; + } else { + onKeyUp = " onKeyUp=\"if(event.keyCode==13) {Ab.focusNextOnCr(event,'" + nextFocus + "');} else {formatTime(this,event.keyCode,'up')}\" "; + } + if (submit) { + onKeyDown = " onKeyDown=\"if(event.keyCode==13 ) {{" + jscript + "}} else {formatTime(this, event.keyCode,'down')}\" "; + } else { + onKeyDown = " onKeyDown=\"formatTime(this, event.keyCode,'down')\""; + } + return onFocus + onFocus + onKeyDown; + } + + public static final String formatBeanMsg(String msg) { + return formatBeanMsg(msg, null); + } + + public static final String getLangDesc(String lang) { + if (lang.equals(Locale.ITALIAN.toString())) + return "Italiano"; + if (lang.equals(Locale.ENGLISH.toString())) + return "English"; + if (lang.equals(Locale.GERMAN.toString())) + return "German"; + if (lang.equals("ru")) + return "русский"; + if (lang.equals("cn") || lang.equals("ch")) + return "中国"; + if (lang.equals("es")) + return "Español"; + if (lang.equals(Locale.FRENCH.toString())) + return "Français"; + if (lang.equals(Locale.JAPANESE.toString())) + return "日本語"; + return lang.toUpperCase(); + } + + public static final String formatBeanMsg(String msg, String grantMsg) { + StringBuilder sb = new StringBuilder(); + if (grantMsg != null && !grantMsg.isEmpty()) { + sb.append(" "); + } + if (msg != null && !msg.isEmpty()) { + String labelClass = "class='msgOk'>"; + String alert = ""; + if (msg.toLowerCase().indexOf("err") >= 0) { + labelClass = "class='msgError'>"; + } else if (msg.toLowerCase().indexOf("warning") >= 0 || msg.toLowerCase().indexOf("attenzione") >= 0) { + labelClass = "class='msgWarn'>"; + } + sb.append("