Initial commit
This commit is contained in:
18
conf/log4j.xml
Normal file
18
conf/log4j.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
|
||||
<log4j:configuration debug="true" xmlns:log4j='http://jakarta.apache.org/log4j/'>
|
||||
<appender name="file" class="org.apache.log4j.RollingFileAppender">
|
||||
<param name="append" value="false" />
|
||||
<param name="maxFileSize" value="10KB" />
|
||||
<param name="maxBackupIndex" value="5" />
|
||||
<!-- For Tomcat -->
|
||||
<param name="file" value="./conf/logs/myStruts1App.log" />
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />
|
||||
</layout>
|
||||
</appender>
|
||||
<root>
|
||||
<level value="ERROR" />
|
||||
<appender-ref ref="file" />
|
||||
</root>
|
||||
</log4j:configuration>
|
||||
39
conf/logo.xml
Normal file
39
conf/logo.xml
Normal file
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Logo>
|
||||
<Connexion>
|
||||
<PathImage>./conf/logo1.png</PathImage>
|
||||
<FitWidth>110</FitWidth>
|
||||
<FitHeight>108</FitHeight>
|
||||
<LayoutX>40</LayoutX>
|
||||
<LayoutY>80</LayoutY>
|
||||
</Connexion>
|
||||
<Principal>
|
||||
<PathImage>./conf/logo2.png</PathImage>
|
||||
<FitWidth>150</FitWidth>
|
||||
<FitHeight>40</FitHeight>
|
||||
<LayoutX>9</LayoutX>
|
||||
<LayoutY>5</LayoutY>
|
||||
</Principal>
|
||||
<FactureCltPrint>
|
||||
<PathImage>./conf/logo1.png</PathImage>
|
||||
<FitWidth>92</FitWidth>
|
||||
<FitHeight>82</FitHeight>
|
||||
<LayoutX>358</LayoutX>
|
||||
<LayoutY>8</LayoutY>
|
||||
</FactureCltPrint>
|
||||
<BonLivraisonCltPrint>
|
||||
<PathImage>./conf/logo1.png</PathImage>
|
||||
<FitWidth>92</FitWidth>
|
||||
<FitHeight>82</FitHeight>
|
||||
<LayoutX>358</LayoutX>
|
||||
<LayoutY>8</LayoutY>
|
||||
</BonLivraisonCltPrint>
|
||||
<DevisCltPrint>
|
||||
<PathImage>./conf/logo1.png</PathImage>
|
||||
<FitWidth>84</FitWidth>
|
||||
<FitHeight>87</FitHeight>
|
||||
<LayoutX>345</LayoutX>
|
||||
<LayoutY>35</LayoutY>
|
||||
</DevisCltPrint>
|
||||
</Logo>
|
||||
|
||||
BIN
conf/logo1.png
Normal file
BIN
conf/logo1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
BIN
conf/logo2.png
Normal file
BIN
conf/logo2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.9 KiB |
0
conf/logs/myStruts1App.log
Normal file
0
conf/logs/myStruts1App.log
Normal file
36
conf/parametre.xml
Normal file
36
conf/parametre.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<parametre>
|
||||
<SimpleData>
|
||||
<BonEnter>40</BonEnter>
|
||||
<DevisClt>30</DevisClt>
|
||||
<CommandeClt>35</CommandeClt>
|
||||
<BonLivraisonClt>30</BonLivraisonClt>
|
||||
<FactureClt>28</FactureClt>
|
||||
<BonReception>40</BonReception>
|
||||
<FactureFrs>40</FactureFrs>
|
||||
</SimpleData>
|
||||
<Company>
|
||||
<Name>Societé X</Name>
|
||||
<Place>Tunis</Place>
|
||||
<Address>2 rue elmouez mornaguia</Address>
|
||||
<SIREN>533 459 590</SIREN> <!-- Système d’Identification du Répertoire des Entreprises -->
|
||||
<MF>533 459 590</MF> <!-- Matricule Fiscale -->
|
||||
<IF>533 459 590</IF> <!-- Identité Fiscale -->
|
||||
<Tele>71 554 885</Tele>
|
||||
<Fax>71 847 965</Fax>
|
||||
<Mail>contact@powerpme.com</Mail>
|
||||
<Site>www.powerpme.com</Site>
|
||||
</Company>
|
||||
<Currency>
|
||||
<Sign>DT</Sign>
|
||||
<Name>dinar</Name>
|
||||
<Thousandth>millime</Thousandth>
|
||||
</Currency>
|
||||
<Banque>
|
||||
<Bank>Banque Nationale Agricole en Tunisie</Bank>
|
||||
<RIP>18 145 1495872366763 08</RIP>
|
||||
<RIB>TN59 1700 1000 0002 3667 9587</RIB>
|
||||
</Banque>
|
||||
<NomLocalPC>Magasin I</NomLocalPC>
|
||||
<Timbre>0.600</Timbre>
|
||||
</parametre>
|
||||
95
conf/print.xml
Normal file
95
conf/print.xml
Normal file
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Print>
|
||||
<TraiteClt>
|
||||
<AnchorPaneTraiteClt>
|
||||
<prefHeight>689</prefHeight>
|
||||
<prefWidth>457</prefWidth>
|
||||
</AnchorPaneTraiteClt>
|
||||
<CompanyName>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX>18</LayoutX>
|
||||
<LayoutY>293</LayoutY>
|
||||
</CompanyName>
|
||||
<CompanyPlace>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX>42</LayoutX>
|
||||
<LayoutY>252</LayoutY>
|
||||
</CompanyPlace>
|
||||
<CompanyAddress>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX>305</LayoutX>
|
||||
<LayoutY>301</LayoutY>
|
||||
<prefHeight>57</prefHeight>
|
||||
<prefWidth>149</prefWidth>
|
||||
</CompanyAddress>
|
||||
<CompanySIREN>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX>18</LayoutX>
|
||||
<LayoutY>332</LayoutY>
|
||||
</CompanySIREN>
|
||||
<NomCompletClt>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX>151</LayoutX>
|
||||
<LayoutY>136</LayoutY>
|
||||
</NomCompletClt>
|
||||
<CIN>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX>155</LayoutX>
|
||||
<LayoutY>164</LayoutY>
|
||||
</CIN>
|
||||
<Bank>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX>468</LayoutX>
|
||||
<LayoutY>279</LayoutY>
|
||||
<prefHeight>34</prefHeight>
|
||||
<prefWidth>201</prefWidth>
|
||||
</Bank>
|
||||
<AmountLetter>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX>151</LayoutX>
|
||||
<LayoutY>194</LayoutY>
|
||||
</AmountLetter>
|
||||
<AmountFigures>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX>400</LayoutX>
|
||||
<LayoutY>131</LayoutY>
|
||||
</AmountFigures>
|
||||
<DateDeadline>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX>5</LayoutX>
|
||||
<LayoutY>88</LayoutY>
|
||||
</DateDeadline>
|
||||
</TraiteClt>
|
||||
<TraiteFrs>
|
||||
<AnchorPane>
|
||||
<prefHeight>400</prefHeight>
|
||||
<prefWidth>600</prefWidth>
|
||||
</AnchorPane>
|
||||
<CompanyName>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX></LayoutX>
|
||||
<LayoutY></LayoutY>
|
||||
</CompanyName>
|
||||
<CompanyPlace>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX></LayoutX>
|
||||
<LayoutY></LayoutY>
|
||||
</CompanyPlace>
|
||||
<Bank>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX></LayoutX>
|
||||
<LayoutY></LayoutY>
|
||||
</Bank>
|
||||
<RIP>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX></LayoutX>
|
||||
<LayoutY></LayoutY>
|
||||
</RIP>
|
||||
<RIB>
|
||||
<Visible>true</Visible>
|
||||
<LayoutX></LayoutX>
|
||||
<LayoutY></LayoutY>
|
||||
</RIB>
|
||||
</TraiteFrs>
|
||||
</Print>
|
||||
|
||||
0
jshell.history
Normal file
0
jshell.history
Normal file
19
nb-configuration.xml
Normal file
19
nb-configuration.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-shared-configuration>
|
||||
<!--
|
||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||
The configuration is intended to be shared among all the users of project and
|
||||
therefore it is assumed to be part of version control checkout.
|
||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||
-->
|
||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||
<!--
|
||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||
-->
|
||||
<netbeans.compile.on.save>all</netbeans.compile.on.save>
|
||||
<netbeans.hint.jdkPlatform>JDK_22</netbeans.hint.jdkPlatform>
|
||||
</properties>
|
||||
</project-shared-configuration>
|
||||
40
nbactions.xml
Normal file
40
nbactions.xml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<actions>
|
||||
<action>
|
||||
<actionName>run</actionName>
|
||||
<packagings>
|
||||
<packaging>jar</packaging>
|
||||
</packagings>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
<goal>javafx:run</goal>
|
||||
</goals>
|
||||
</action>
|
||||
<action>
|
||||
<actionName>debug</actionName>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
<goal>javafx:run@ide-debug</goal>
|
||||
</goals>
|
||||
<properties>
|
||||
<jpda.listen>true</jpda.listen>
|
||||
</properties>
|
||||
</action>
|
||||
<action>
|
||||
<actionName>profile</actionName>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
<goal>javafx:run@ide-profile</goal>
|
||||
</goals>
|
||||
</action>
|
||||
<action>
|
||||
<actionName>CUSTOM-jlink</actionName>
|
||||
<displayName>jlink</displayName>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
<!-- compile not needed with javafx-maven-plugin v0.0.5 -->
|
||||
<goal>compile</goal>
|
||||
<goal>javafx:jlink</goal>
|
||||
</goals>
|
||||
</action>
|
||||
</actions>
|
||||
147
pom.xml
Normal file
147
pom.xml
Normal file
@@ -0,0 +1,147 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.mycompany</groupId>
|
||||
<artifactId>PowerPME_Demo</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>11</maven.compiler.source>
|
||||
<maven.compiler.target>11</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-controls</artifactId>
|
||||
<version>13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-fxml</artifactId>
|
||||
<version>13</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-web</artifactId>
|
||||
<version>17.0.7</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ibm.icu</groupId>
|
||||
<artifactId>icu4j</artifactId>
|
||||
<version>3.4.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.controlsfx</groupId>
|
||||
<artifactId>controlsfx</artifactId>
|
||||
<version>11.2.1</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>2.1.214</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.12.1</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformers>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<mainClass>Controllers.Main</mainClass>
|
||||
</transformer>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
|
||||
<resource>META-INF/spring.handlers</resource>
|
||||
</transformer>
|
||||
</transformers>
|
||||
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
<shadedClassifierName>jar-with-dependencies</shadedClassifierName>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<release>11</release>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-maven-plugin</artifactId>
|
||||
<version>0.0.4</version>
|
||||
<configuration>
|
||||
<mainClass>Controllers.App</mainClass>
|
||||
<options>
|
||||
<option>--add-exports</option>
|
||||
<option>javafx.base/com.sun.javafx.event=org.controlsfx.controls</option>
|
||||
</options>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<!-- Default configuration for running -->
|
||||
<!-- Usage: mvn clean javafx:run -->
|
||||
<id>default-cli</id>
|
||||
</execution>
|
||||
<execution>
|
||||
<!-- Configuration for manual attach debugging -->
|
||||
<!-- Usage: mvn clean javafx:run@debug -->
|
||||
<id>debug</id>
|
||||
<configuration>
|
||||
<options>
|
||||
<option>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:8000</option>
|
||||
</options>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<!-- Configuration for automatic IDE debugging -->
|
||||
<id>ide-debug</id>
|
||||
<configuration>
|
||||
<options>
|
||||
<option>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</option>
|
||||
</options>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<!-- Configuration for automatic IDE profiling -->
|
||||
<id>ide-profile</id>
|
||||
<configuration>
|
||||
<options>
|
||||
<option>${profiler.jvmargs.arg1}</option>
|
||||
<option>${profiler.jvmargs.arg2}</option>
|
||||
<option>${profiler.jvmargs.arg3}</option>
|
||||
<option>${profiler.jvmargs.arg4}</option>
|
||||
<option>${profiler.jvmargs.arg5}</option>
|
||||
</options>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
982
src/db/H2database_Schema.sql
Normal file
982
src/db/H2database_Schema.sql
Normal file
@@ -0,0 +1,982 @@
|
||||
CREATE TABLE IF NOT EXISTS local (
|
||||
nom VARCHAR(300) NOT NULL PRIMARY KEY,
|
||||
adresse VARCHAR(300),
|
||||
tele INT,
|
||||
fax INT
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS profile (
|
||||
idprofile INT AUTO_INCREMENT PRIMARY KEY,
|
||||
nom VARCHAR(45) NOT NULL,
|
||||
prenom VARCHAR(45) NOT NULL,
|
||||
naissance DATE,
|
||||
sexe BOOLEAN,
|
||||
num_tele INT,
|
||||
mail VARCHAR(45),
|
||||
adresse VARCHAR(60),
|
||||
date_creation DATE,
|
||||
pays VARCHAR(45)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS authentification (
|
||||
idauhentification INT AUTO_INCREMENT PRIMARY KEY,
|
||||
login VARCHAR(45) NOT NULL,
|
||||
password VARCHAR(45) NOT NULL,
|
||||
type_compte VARCHAR(45) NOT NULL,
|
||||
question_secrete VARCHAR(50) NOT NULL,
|
||||
reponce_question VARCHAR(50) NOT NULL,
|
||||
etat_compte BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
stock_negatif BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
id_profile INT NOT NULL,
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS client (
|
||||
codeclient BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
cin INT NOT NULL,
|
||||
nomcomplet VARCHAR(300),
|
||||
nom VARCHAR(300) NOT NULL,
|
||||
prenom VARCHAR(300) NOT NULL,
|
||||
naissance DATE NOT NULL,
|
||||
telefix BIGINT,
|
||||
telemobile BIGINT,
|
||||
adresse VARCHAR(400) NOT NULL,
|
||||
codepostale BIGINT,
|
||||
mail VARCHAR(300),
|
||||
sexe BOOLEAN NOT NULL,
|
||||
date_add TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS categorie (
|
||||
nomcategorie VARCHAR(45) NOT NULL PRIMARY KEY,
|
||||
unitemesure BOOLEAN NOT NULL
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS produit (
|
||||
reference VARCHAR(300) NOT NULL PRIMARY KEY,
|
||||
designation VARCHAR(800) NOT NULL,
|
||||
nomcategorie_cate VARCHAR(300) NOT NULL,
|
||||
marque VARCHAR(300),
|
||||
garantie INT,
|
||||
prix_achat_ht FLOAT NOT NULL,
|
||||
tva_achat FLOAT NOT NULL,
|
||||
prix_achat_ttc FLOAT NOT NULL,
|
||||
marge FLOAT NOT NULL,
|
||||
prix_vente_ht FLOAT NOT NULL,
|
||||
tva_vente FLOAT NOT NULL,
|
||||
prix_vente_ttc FLOAT NOT NULL,
|
||||
description TEXT,
|
||||
qualite INT,
|
||||
poids VARCHAR(300),
|
||||
couleur VARCHAR(300),
|
||||
dimension VARCHAR(300),
|
||||
vitesse VARCHAR(300),
|
||||
puissance VARCHAR(300),
|
||||
capacite VARCHAR(300),
|
||||
datecreation DATE,
|
||||
FOREIGN KEY (nomcategorie_cate) REFERENCES categorie (nomcategorie)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS client (
|
||||
codeclient BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
cin INT NOT NULL,
|
||||
nomcomplet VARCHAR(300),
|
||||
nom VARCHAR(300) NOT NULL,
|
||||
prenom VARCHAR(300) NOT NULL,
|
||||
naissance DATE NOT NULL,
|
||||
telefix BIGINT,
|
||||
telemobile BIGINT,
|
||||
adresse VARCHAR(400) NOT NULL,
|
||||
codepostale BIGINT,
|
||||
mail VARCHAR(300),
|
||||
sexe BOOLEAN NOT NULL,
|
||||
date_add TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS categorie (
|
||||
nomcategorie VARCHAR(45) NOT NULL PRIMARY KEY,
|
||||
unitemesure BOOLEAN NOT NULL
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS produit (
|
||||
reference VARCHAR(300) NOT NULL PRIMARY KEY,
|
||||
designation VARCHAR(800) NOT NULL,
|
||||
nomcategorie_cate VARCHAR(300) NOT NULL,
|
||||
marque VARCHAR(300),
|
||||
garantie INT,
|
||||
prix_achat_ht FLOAT NOT NULL,
|
||||
tva_achat FLOAT NOT NULL,
|
||||
prix_achat_ttc FLOAT NOT NULL,
|
||||
marge FLOAT NOT NULL,
|
||||
prix_vente_ht FLOAT NOT NULL,
|
||||
tva_vente FLOAT NOT NULL,
|
||||
prix_vente_ttc FLOAT NOT NULL,
|
||||
description TEXT,
|
||||
qualite INT,
|
||||
poids VARCHAR(300),
|
||||
couleur VARCHAR(300),
|
||||
dimension VARCHAR(300),
|
||||
vitesse VARCHAR(300),
|
||||
puissance VARCHAR(300),
|
||||
capacite VARCHAR(300),
|
||||
datecreation DATE,
|
||||
FOREIGN KEY (nomcategorie_cate) REFERENCES categorie (nomcategorie)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS cltentreprise (
|
||||
idcliententreprise BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
nomentrepise VARCHAR(300) NOT NULL,
|
||||
gerant VARCHAR(300) NOT NULL,
|
||||
matricule_fiscale BIGINT,
|
||||
adresse VARCHAR(400),
|
||||
telefix BIGINT NOT NULL,
|
||||
telefix2 BIGINT,
|
||||
fax BIGINT,
|
||||
code_postal BIGINT,
|
||||
mail VARCHAR(400),
|
||||
date_add TIMESTAMP NOT NULL,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS cltcontact (
|
||||
idcltcontact BIGINT AUTO_INCREMENT PRIMARY KEY,
|
||||
nom VARCHAR(300) NOT NULL,
|
||||
prenom VARCHAR(300) NOT NULL,
|
||||
cin BIGINT,
|
||||
gsm1 BIGINT NOT NULL,
|
||||
gsm2 VARCHAR(300),
|
||||
mail VARCHAR(300),
|
||||
idcltentreprise BIGINT NOT NULL,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
FOREIGN KEY (idcltentreprise) REFERENCES cltentreprise (idcliententreprise),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS entre (
|
||||
id_entre BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
date DATE NOT NULL,
|
||||
heur TIME NOT NULL,
|
||||
local_emetteur VARCHAR(45) NOT NULL,
|
||||
local_recepteur VARCHAR(45) NOT NULL,
|
||||
transporteur VARCHAR(45),
|
||||
FOREIGN KEY (local_emetteur) REFERENCES local (nom),
|
||||
FOREIGN KEY (local_recepteur) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS liste_produit_entre (
|
||||
id_bon_entre BIGINT NOT NULL,
|
||||
reference_produit VARCHAR(300) NOT NULL,
|
||||
quantite INT,
|
||||
tva INT,
|
||||
prix_vente_ttc FLOAT,
|
||||
designation VARCHAR(800),
|
||||
FOREIGN KEY (id_bon_entre) REFERENCES entre (id_entre),
|
||||
FOREIGN KEY (reference_produit) REFERENCES produit (reference)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS sortie (
|
||||
id_sortie BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
date DATE NOT NULL,
|
||||
heur TIME NOT NULL,
|
||||
local_emetteur VARCHAR(45) NOT NULL,
|
||||
local_recepteur VARCHAR(45) NOT NULL,
|
||||
transporteur VARCHAR(45),
|
||||
FOREIGN KEY (local_emetteur) REFERENCES local (nom),
|
||||
FOREIGN KEY (local_recepteur) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS liste_produit_sortie (
|
||||
id_bon_sortie BIGINT AUTO_INCREMENT NOT NULL,
|
||||
reference_produit VARCHAR(300) NOT NULL,
|
||||
quantite INT,
|
||||
prix_vente_ttc FLOAT,
|
||||
tva INT,
|
||||
designation VARCHAR(800),
|
||||
PRIMARY KEY (id_bon_sortie, reference_produit),
|
||||
FOREIGN KEY (id_bon_sortie) REFERENCES sortie (id_sortie),
|
||||
FOREIGN KEY (reference_produit) REFERENCES produit (reference)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS cltpassageur (
|
||||
idcltpassageur BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
nom VARCHAR(300) NOT NULL,
|
||||
prenom VARCHAR(300) NOT NULL,
|
||||
adresse VARCHAR(300),
|
||||
sexe SMALLINT NOT NULL,
|
||||
tele BIGINT,
|
||||
gsm BIGINT,
|
||||
naissance DATE,
|
||||
date_add TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS devisclt (
|
||||
iddevis BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
date_creation DATE NOT NULL,
|
||||
fin_validite DATE,
|
||||
typeclt SMALLINT NOT NULL,
|
||||
type_reglement SMALLINT NOT NULL DEFAULT 0,
|
||||
codeclient BIGINT,
|
||||
idcliententreprise BIGINT,
|
||||
idcltpassageur BIGINT,
|
||||
total_h_t_net FLOAT NOT NULL,
|
||||
total_tva FLOAT NOT NULL,
|
||||
timbre_loi FLOAT NOT NULL,
|
||||
net_a_payer FLOAT NOT NULL,
|
||||
remise FLOAT NOT NULL DEFAULT 0,
|
||||
idprofile INT NOT NULL,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
FOREIGN KEY (codeclient) REFERENCES client (codeclient),
|
||||
FOREIGN KEY (idcliententreprise) REFERENCES cltentreprise (idcliententreprise),
|
||||
FOREIGN KEY (idcltpassageur) REFERENCES cltpassageur (idcltpassageur),
|
||||
FOREIGN KEY (idprofile) REFERENCES profile (idprofile),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS factureclt (
|
||||
idfactureclt BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
type_reglement SMALLINT NOT NULL,
|
||||
mode_paiement SMALLINT NOT NULL,
|
||||
date_facture DATE NOT NULL,
|
||||
typeclt SMALLINT NOT NULL,
|
||||
idcltentreprise BIGINT,
|
||||
idcltexiste BIGINT,
|
||||
idcltpassageur BIGINT,
|
||||
devise VARCHAR(10),
|
||||
total_h_t_net FLOAT NOT NULL,
|
||||
total_tva FLOAT NOT NULL,
|
||||
remise FLOAT NOT NULL DEFAULT 0,
|
||||
timbre_loi FLOAT NOT NULL,
|
||||
net_a_payer FLOAT NOT NULL,
|
||||
type_facilite SMALLINT,
|
||||
avance FLOAT DEFAULT 0,
|
||||
total_montant_traites FLOAT,
|
||||
nbr_traite INT,
|
||||
montant_interet FLOAT,
|
||||
taux_interet FLOAT,
|
||||
idcommande_commandeclt BIGINT NOT NULL,
|
||||
id_bon_livraisonclt BIGINT,
|
||||
profile_idprofile INT NOT NULL,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
FOREIGN KEY (profile_idprofile) REFERENCES profile (idprofile),
|
||||
FOREIGN KEY (idcltentreprise) REFERENCES cltentreprise (idcliententreprise),
|
||||
FOREIGN KEY (idcltexiste) REFERENCES client (codeclient),
|
||||
FOREIGN KEY (idcltpassageur) REFERENCES cltpassageur (idcltpassageur),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS commandeclt (
|
||||
idcommande BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
date_commande DATE NOT NULL,
|
||||
typeclt SMALLINT NOT NULL,
|
||||
type_reglement SMALLINT NOT NULL,
|
||||
codeclient BIGINT,
|
||||
idcliententreprise BIGINT,
|
||||
idcltpassageur BIGINT,
|
||||
total_h_t_net FLOAT NOT NULL,
|
||||
total_tva FLOAT NOT NULL,
|
||||
remise FLOAT NOT NULL DEFAULT 0,
|
||||
timbre_loi FLOAT NOT NULL,
|
||||
net_a_payer FLOAT NOT NULL,
|
||||
iddevis BIGINT,
|
||||
id_bon_livraisonclt BIGINT,
|
||||
id_factureclt BIGINT,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
idprofile_editeur INT NOT NULL,
|
||||
FOREIGN KEY (codeclient) REFERENCES client (codeclient),
|
||||
FOREIGN KEY (idcliententreprise) REFERENCES cltentreprise (idcliententreprise),
|
||||
FOREIGN KEY (idcltpassageur) REFERENCES cltpassageur (idcltpassageur),
|
||||
FOREIGN KEY (idprofile_editeur) REFERENCES profile (idprofile),
|
||||
FOREIGN KEY (iddevis) REFERENCES devisclt (iddevis),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS bon_livraisonclt (
|
||||
idbon_livraisonclt BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
type_client SMALLINT NOT NULL,
|
||||
id_clt_entreprise BIGINT,
|
||||
id_clt_passageur BIGINT,
|
||||
id_clt_existe BIGINT,
|
||||
heur_livraison TIME,
|
||||
date_livraison_prevu DATE NOT NULL,
|
||||
adresse_livraison VARCHAR(45) NOT NULL,
|
||||
transporteur VARCHAR(45),
|
||||
frais FLOAT,
|
||||
poids_produit INT,
|
||||
tele1 VARCHAR(45),
|
||||
tele2 VARCHAR(45),
|
||||
devise VARCHAR(10) NOT NULL,
|
||||
total_h_t_net FLOAT,
|
||||
total_tva FLOAT,
|
||||
remise FLOAT,
|
||||
net_a_payer FLOAT,
|
||||
id_commandeclt BIGINT NOT NULL,
|
||||
idprofile_editeur INT NOT NULL,
|
||||
date_creation DATE NOT NULL,
|
||||
local_nom VARCHAR(45) NOT NULL,
|
||||
FOREIGN KEY (idprofile_editeur) REFERENCES profile (idprofile),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom),
|
||||
FOREIGN KEY (id_clt_entreprise) REFERENCES cltentreprise (idcliententreprise),
|
||||
FOREIGN KEY (id_clt_passageur) REFERENCES cltpassageur (idcltpassageur),
|
||||
FOREIGN KEY (id_clt_existe) REFERENCES client (codeclient)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
ALTER TABLE factureclt ADD CONSTRAINT CONSTRAINT_INDEX_fact_bon_clt_454 FOREIGN KEY (id_bon_livraisonclt) REFERENCES bon_livraisonclt (idbon_livraisonclt)ON DELETE CASCADE;
|
||||
ALTER TABLE factureclt ADD CONSTRAINT CONSTRAINT_INDEX_fact_com_clt_547 FOREIGN KEY (idcommande_commandeclt) REFERENCES commandeclt (idcommande)ON DELETE CASCADE;
|
||||
ALTER TABLE commandeclt ADD CONSTRAINT CONSTRAINT_INDEX_com_fact_clt_884 FOREIGN KEY (id_factureclt) REFERENCES factureclt (idfactureclt) ON DELETE CASCADE;
|
||||
ALTER TABLE commandeclt ADD CONSTRAINT CONSTRAINT_INDEX_com_bon_liv_clt_2 FOREIGN KEY (id_bon_livraisonclt) REFERENCES bon_livraisonclt (idbon_livraisonclt) ON DELETE CASCADE;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS fournisseur (
|
||||
id_fournisseur INT AUTO_INCREMENT PRIMARY KEY,
|
||||
nom VARCHAR(45) NOT NULL,
|
||||
adresse VARCHAR(45) NOT NULL,
|
||||
formes VARCHAR(45),
|
||||
tele1 BIGINT NOT NULL,
|
||||
tele2 BIGINT,
|
||||
fax BIGINT,
|
||||
mail VARCHAR(45),
|
||||
site_web VARCHAR(45),
|
||||
specialite VARCHAR(100)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS commande_frs (
|
||||
id_commande_frs INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
date_commande DATE NOT NULL,
|
||||
heur_commande TIME NOT NULL,
|
||||
mode_reglement VARCHAR(45) NOT NULL,
|
||||
devise VARCHAR(45) NOT NULL,
|
||||
total_h_t_net FLOAT NOT NULL,
|
||||
total_tva FLOAT NOT NULL,
|
||||
timbre_loi FLOAT NOT NULL,
|
||||
net_a_payer FLOAT NOT NULL,
|
||||
id_fournisseur INT NOT NULL,
|
||||
id_profile INT NOT NULL,
|
||||
FOREIGN KEY (id_fournisseur) REFERENCES fournisseur (id_fournisseur),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS reglement_frs (
|
||||
id_reglement_frs BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
id_fournisseur INT NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
date_creation TIMESTAMP NOT NULL,
|
||||
type_paiement SMALLINT NOT NULL,
|
||||
mode_paiement SMALLINT,
|
||||
etat_reglement SMALLINT NOT NULL,
|
||||
id_profile INT NOT NULL,
|
||||
FOREIGN KEY (id_fournisseur) REFERENCES fournisseur (id_fournisseur),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS facture_frs (
|
||||
id_facture_frs BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
numero VARCHAR(45) NOT NULL,
|
||||
date_creation TIMESTAMP NOT NULL,
|
||||
type_reglement SMALLINT,
|
||||
etat_reglement SMALLINT,
|
||||
devise VARCHAR(10) NOT NULL,
|
||||
total_h_t_net FLOAT NOT NULL,
|
||||
remise FLOAT NOT NULL,
|
||||
total_tva FLOAT NOT NULL,
|
||||
timbre_loi FLOAT NOT NULL,
|
||||
net_a_payer FLOAT NOT NULL,
|
||||
bon_reception SMALLINT,
|
||||
id_fournisseur INT NOT NULL,
|
||||
local_reception VARCHAR(300) NOT NULL,
|
||||
id_commande_frs INT,
|
||||
id_profile INT NOT NULL,
|
||||
id_reglement_frs BIGINT,
|
||||
FOREIGN KEY (id_fournisseur) REFERENCES fournisseur (id_fournisseur),
|
||||
FOREIGN KEY (local_reception) REFERENCES local (nom),
|
||||
FOREIGN KEY (id_commande_frs) REFERENCES commande_frs (id_commande_frs),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile),
|
||||
FOREIGN KEY (id_reglement_frs) REFERENCES reglement_frs (id_reglement_frs)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS bonreception_frs (
|
||||
id_bonreception BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
numero VARCHAR(45) NOT NULL,
|
||||
date_reception TIMESTAMP NOT NULL,
|
||||
transporteur VARCHAR(45),
|
||||
net_a_payer FLOAT,
|
||||
id_fournisseur INT NOT NULL,
|
||||
local_reception VARCHAR(45) NOT NULL,
|
||||
id_profile INT NOT NULL,
|
||||
id_facture_frs BIGINT,
|
||||
FOREIGN KEY (id_fournisseur) REFERENCES fournisseur (id_fournisseur),
|
||||
FOREIGN KEY (local_reception) REFERENCES local (nom),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile),
|
||||
FOREIGN KEY (id_facture_frs) REFERENCES facture_frs (id_facture_frs)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS cheque_clt (
|
||||
id_chequeclt INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
numero VARCHAR(300) NOT NULL,
|
||||
banque VARCHAR(300) NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
nom_complet VARCHAR(400),
|
||||
etat_cheque SMALLINT,
|
||||
date_paiement DATE NOT NULL,
|
||||
date_creation TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
id_factureclt BIGINT,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
id_profile INT NOT NULL,
|
||||
FOREIGN KEY (id_factureclt) REFERENCES factureclt (idfactureclt),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS carte_bancaire_clt (
|
||||
id_carte_bancaire BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
num_transation VARCHAR(150) NOT NULL,
|
||||
nom_banque VARCHAR(45),
|
||||
num_carte VARCHAR(100),
|
||||
nom_complet VARCHAR(45),
|
||||
date_transation TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
montant FLOAT NOT NULL,
|
||||
id_factureclt BIGINT,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
id_profile INT NOT NULL,
|
||||
FOREIGN KEY (id_factureclt) REFERENCES factureclt (idfactureclt),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS vente_sans_facture (
|
||||
id_vente_sans_facture BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
date_vente TIMESTAMP NOT NULL,
|
||||
paiement SMALLINT NOT NULL,
|
||||
nom_prenom_client VARCHAR(50),
|
||||
operation SMALLINT,
|
||||
date_operation TIMESTAMP,
|
||||
montant FLOAT NOT NULL,
|
||||
id_chequeclt INT,
|
||||
id_carte_bancaire BIGINT,
|
||||
id_profile INT NOT NULL,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
FOREIGN KEY (id_chequeclt) REFERENCES cheque_clt (id_chequeclt),
|
||||
FOREIGN KEY (id_carte_bancaire) REFERENCES carte_bancaire_clt (id_carte_bancaire),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS stock_detail (
|
||||
id_detail_stock BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
local_nom VARCHAR(45) NOT NULL,
|
||||
reference_produit VARCHAR(300) NOT NULL,
|
||||
quantite FLOAT NOT NULL,
|
||||
date_add TIMESTAMP NOT NULL,
|
||||
id_profile INT NOT NULL,
|
||||
id_bon_entre BIGINT,
|
||||
id_bon_sortie BIGINT,
|
||||
id_bon_livraison BIGINT,
|
||||
id_bon_reception BIGINT,
|
||||
id_facture_frs BIGINT,
|
||||
id_vente_sans_facture BIGINT,
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom),
|
||||
FOREIGN KEY (reference_produit) REFERENCES produit (reference),
|
||||
FOREIGN KEY (id_bon_entre) REFERENCES entre (id_entre),
|
||||
FOREIGN KEY (id_bon_sortie) REFERENCES sortie (id_sortie),
|
||||
FOREIGN KEY (id_bon_livraison) REFERENCES bon_livraisonclt (idbon_livraisonclt),
|
||||
FOREIGN KEY (id_bon_reception) REFERENCES bonreception_frs (id_bonreception),
|
||||
FOREIGN KEY (id_facture_frs) REFERENCES facture_frs (id_facture_frs),
|
||||
FOREIGN KEY (id_vente_sans_facture) REFERENCES vente_sans_facture (id_vente_sans_facture),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS liste_produit_commandeclt (
|
||||
id_liste_produit_commandeclt BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
commande_idcommande BIGINT NOT NULL,
|
||||
produit_reference VARCHAR(40) NOT NULL,
|
||||
designation_produit VARCHAR(800) NOT NULL,
|
||||
quantite INT NOT NULL,
|
||||
p_u_h_t FLOAT NOT NULL,
|
||||
remise INT,
|
||||
p_u_h_t_net FLOAT NOT NULL,
|
||||
tva INT NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
FOREIGN KEY (commande_idcommande) REFERENCES commandeclt (idcommande),
|
||||
FOREIGN KEY (produit_reference) REFERENCES produit (reference),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS traite_clt (
|
||||
id_traite BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
date_traite DATE NOT NULL,
|
||||
montant_traite FLOAT NOT NULL,
|
||||
date_creation TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
id_factureclt BIGINT NOT NULL,
|
||||
date_paiement TIMESTAMP,
|
||||
montant_payer FLOAT,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
id_profile INT NOT NULL,
|
||||
FOREIGN KEY (id_factureclt) REFERENCES factureclt (idfactureclt),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS traite_paiement_espace_clt (
|
||||
id_traite_paiement_espace BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
id_traite BIGINT NOT NULL,
|
||||
date_payer TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
montant_payer FLOAT NOT NULL,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
id_profile INT NOT NULL,
|
||||
FOREIGN KEY (id_traite) REFERENCES traite_clt (id_traite),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS devis_frs (
|
||||
id_devis_frs INT NOT NULL PRIMARY KEY,
|
||||
id_fournisseur INT NOT NULL,
|
||||
date_creation DATE NOT NULL,
|
||||
devis VARCHAR(10) NOT NULL,
|
||||
total_h_t_net FLOAT NOT NULL,
|
||||
total_tva FLOAT NOT NULL,
|
||||
timbre_loi FLOAT NOT NULL,
|
||||
net_a_payer FLOAT NOT NULL,
|
||||
id_profile INT NOT NULL,
|
||||
FOREIGN KEY (id_fournisseur) REFERENCES fournisseur (id_fournisseur),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS list_produit_devisclt (
|
||||
id_list_produit_devisclt BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
iddevis_devis BIGINT NOT NULL,
|
||||
reference_produit VARCHAR(300) NOT NULL,
|
||||
designation_produit VARCHAR(800) NOT NULL,
|
||||
quantie INT NOT NULL,
|
||||
p_u_h_t FLOAT NOT NULL,
|
||||
remise INT NOT NULL,
|
||||
p_u_h_t_net FLOAT NOT NULL,
|
||||
tva INT NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
FOREIGN KEY (reference_produit) REFERENCES produit (reference),
|
||||
FOREIGN KEY (iddevis_devis) REFERENCES devisclt (iddevis),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS liste_produit_devis_frs (
|
||||
reference_produit VARCHAR(40) NOT NULL PRIMARY KEY,
|
||||
id_devis_frs INT NOT NULL,
|
||||
quantite INT NOT NULL,
|
||||
p_u_h_t FLOAT NOT NULL,
|
||||
remise INT,
|
||||
p_u_h_t_net FLOAT NOT NULL,
|
||||
tva INT NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
FOREIGN KEY (reference_produit) REFERENCES produit (reference),
|
||||
FOREIGN KEY (id_devis_frs) REFERENCES devis_frs (id_devis_frs)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS contact_frs (
|
||||
idcontactfrs INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
nom VARCHAR(45) NOT NULL,
|
||||
prenom VARCHAR(45) NOT NULL,
|
||||
tele1 BIGINT NOT NULL,
|
||||
tele2 BIGINT,
|
||||
email VARCHAR(45),
|
||||
id_fournisseur INT NOT NULL,
|
||||
FOREIGN KEY (id_fournisseur) REFERENCES fournisseur (id_fournisseur)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS list_prod_factclt (
|
||||
id_list_prod_factclt BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
idfactureclt_factureclt BIGINT NOT NULL,
|
||||
produit_reference VARCHAR(300) NOT NULL,
|
||||
designation_produit VARCHAR(800) NOT NULL,
|
||||
quantite INT NOT NULL,
|
||||
p_u_h_t FLOAT NOT NULL,
|
||||
remise INT,
|
||||
p_u_h_t_net FLOAT NOT NULL,
|
||||
tva INT NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
FOREIGN KEY (idfactureclt_factureclt) REFERENCES factureclt (idfactureclt),
|
||||
FOREIGN KEY (produit_reference) REFERENCES produit (reference),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS liste_prod_livraison (
|
||||
id_liste_prod_livraison BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
id_bon_livraison_clt BIGINT NOT NULL,
|
||||
produit_reference VARCHAR(40) NOT NULL,
|
||||
designation_produit VARCHAR(800) NOT NULL,
|
||||
quantite INT NOT NULL,
|
||||
p_u_h_t FLOAT NOT NULL,
|
||||
remise INT NOT NULL,
|
||||
p_u_h_t_net FLOAT NOT NULL,
|
||||
tva INT NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
local_nom VARCHAR(45) NOT NULL,
|
||||
FOREIGN KEY (id_bon_livraison_clt) REFERENCES bon_livraisonclt (idbon_livraisonclt),
|
||||
FOREIGN KEY (produit_reference) REFERENCES produit (reference),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS liste_prod_commande_frs (
|
||||
id_liste_prod_commande_frs INT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
id_commande_frs INT NOT NULL,
|
||||
designation_produit VARCHAR(45) NOT NULL,
|
||||
quantite INT NOT NULL,
|
||||
p_u_h_t FLOAT NOT NULL,
|
||||
remise INT,
|
||||
p_u_h_t_net FLOAT NOT NULL,
|
||||
tva INT NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
FOREIGN KEY (id_commande_frs) REFERENCES commande_frs (id_commande_frs)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS list_prod_reception_frs (
|
||||
id_achat BIGINT AUTO_INCREMENT NOT NULL,
|
||||
id_bonreception_frs BIGINT NOT NULL,
|
||||
reference VARCHAR(300) NOT NULL,
|
||||
quantite INT NOT NULL,
|
||||
p_u_h_t FLOAT NOT NULL,
|
||||
p_u_h_t_net FLOAT NOT NULL,
|
||||
tva INT NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
PRIMARY KEY (id_achat),
|
||||
FOREIGN KEY (id_bonreception_frs) REFERENCES bonreception_frs (id_bonreception),
|
||||
FOREIGN KEY (reference) REFERENCES produit (reference)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS list_prod_fact_frs (
|
||||
id_list_prod_fact_frs INT AUTO_INCREMENT NOT NULL,
|
||||
id_facture_frs BIGINT NOT NULL,
|
||||
reference VARCHAR(40) NOT NULL,
|
||||
designation_produit VARCHAR(100) NOT NULL,
|
||||
quantite INT NOT NULL,
|
||||
p_u_h_t FLOAT NOT NULL,
|
||||
remise INT,
|
||||
p_u_h_t_net FLOAT NOT NULL,
|
||||
tva INT NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
PRIMARY KEY (id_list_prod_fact_frs),
|
||||
FOREIGN KEY (id_facture_frs) REFERENCES facture_frs (id_facture_frs),
|
||||
FOREIGN KEY (reference) REFERENCES produit (reference)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS factclt_avoir (
|
||||
idavoir BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
date_creation VARCHAR(45) NOT NULL,
|
||||
type_avoir SMALLINT NOT NULL,
|
||||
devis VARCHAR(45) NOT NULL,
|
||||
total_h_t_net FLOAT NOT NULL,
|
||||
total_tva FLOAT NOT NULL,
|
||||
timbre_loi FLOAT NOT NULL,
|
||||
net_a_reduire FLOAT NOT NULL,
|
||||
factureclt_idfactureclt BIGINT NOT NULL,
|
||||
profile_idprofile INT NOT NULL,
|
||||
local_nom VARCHAR(45) NOT NULL,
|
||||
FOREIGN KEY (factureclt_idfactureclt) REFERENCES factureclt (idfactureclt),
|
||||
FOREIGN KEY (profile_idprofile) REFERENCES profile (idprofile),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS traite_paiement_carte_clt (
|
||||
id_traite_paiement_carte BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
id_traite BIGINT NOT NULL,
|
||||
montant_payer FLOAT NOT NULL,
|
||||
numero_carte VARCHAR(300) NOT NULL,
|
||||
banque VARCHAR(300) NOT NULL,
|
||||
date_payer TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
id_profile INT NOT NULL,
|
||||
FOREIGN KEY (id_traite) REFERENCES traite_clt (id_traite),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS traite_paiement_cheque_clt (
|
||||
id_traite_paiement_cheque BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
id_traite BIGINT NOT NULL,
|
||||
montant_payer FLOAT NOT NULL,
|
||||
numero VARCHAR(300) NOT NULL,
|
||||
banque VARCHAR(300) NOT NULL,
|
||||
nom_complet VARCHAR(400),
|
||||
date_payer DATE NOT NULL,
|
||||
date_creation TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
etat_cheque SMALLINT,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
id_profile INT NOT NULL,
|
||||
FOREIGN KEY (id_traite) REFERENCES traite_clt (id_traite),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS historique_cheque_clt (
|
||||
id_historique_cheque_clt BIGINT AUTO_INCREMENT NOT NULL,
|
||||
etat_cheque SMALLINT NOT NULL,
|
||||
date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
id_chequeclt INT,
|
||||
id_traite_paiement_cheque BIGINT,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
id_profile INT NOT NULL,
|
||||
PRIMARY KEY (id_historique_cheque_clt),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile),
|
||||
FOREIGN KEY (id_chequeclt) REFERENCES cheque_clt (id_chequeclt),
|
||||
FOREIGN KEY (id_traite_paiement_cheque) REFERENCES traite_paiement_cheque_clt (id_traite_paiement_cheque)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS caisseclt (
|
||||
id_caisseclt INT AUTO_INCREMENT NOT NULL,
|
||||
date_mouvement TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
type_mouvement SMALLINT,
|
||||
id_factureclt BIGINT,
|
||||
id_avoir_factclt BIGINT,
|
||||
id_vente_sans_facture BIGINT,
|
||||
montant FLOAT NOT NULL,
|
||||
id_traite_paiement_espace BIGINT,
|
||||
id_traite_paiement_carte BIGINT,
|
||||
id_traite_paiement_cheque BIGINT,
|
||||
id_historique_cheque_clt BIGINT,
|
||||
id_profile INT NOT NULL,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
PRIMARY KEY (id_caisseclt),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile),
|
||||
FOREIGN KEY (id_factureclt) REFERENCES factureclt (idfactureclt),
|
||||
FOREIGN KEY (id_avoir_factclt) REFERENCES factclt_avoir (idavoir),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom),
|
||||
FOREIGN KEY (id_traite_paiement_espace) REFERENCES traite_paiement_espace_clt (id_traite_paiement_espace),
|
||||
FOREIGN KEY (id_traite_paiement_carte) REFERENCES traite_paiement_carte_clt (id_traite_paiement_carte),
|
||||
FOREIGN KEY (id_traite_paiement_cheque) REFERENCES traite_paiement_cheque_clt (id_traite_paiement_cheque),
|
||||
FOREIGN KEY (id_historique_cheque_clt) REFERENCES historique_cheque_clt (id_historique_cheque_clt),
|
||||
FOREIGN KEY (id_vente_sans_facture) REFERENCES vente_sans_facture (id_vente_sans_facture)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS bond_retourclt (
|
||||
idbonderetourclt BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
factclt_avoir_idavoir BIGINT NOT NULL,
|
||||
heur_retour TIME NOT NULL,
|
||||
date_retour DATE NOT NULL,
|
||||
transpoteur VARCHAR(45),
|
||||
quantite INT NOT NULL,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
FOREIGN KEY (factclt_avoir_idavoir) REFERENCES factclt_avoir (idavoir),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS list_prod_avoir_factclt (
|
||||
id_list_prod_avoir_factclt BIGINT AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
idfactclt_avoir_prod BIGINT NOT NULL,
|
||||
quantite INT NOT NULL,
|
||||
p_u_h_t FLOAT NOT NULL,
|
||||
remise FLOAT NOT NULL,
|
||||
p_u_h_t_net FLOAT NOT NULL,
|
||||
tva FLOAT NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
designation VARCHAR(400),
|
||||
produit_reference VARCHAR(300),
|
||||
designation_produit VARCHAR(400),
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
FOREIGN KEY (idfactclt_avoir_prod) REFERENCES factclt_avoir (idavoir),
|
||||
FOREIGN KEY (produit_reference) REFERENCES produit (reference),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS liste_prod_retour (
|
||||
id_retour BIGINT NOT NULL PRIMARY KEY,
|
||||
id_bonde_retourclt BIGINT NOT NULL,
|
||||
quantite FLOAT NOT NULL,
|
||||
p_u_h_t FLOAT NOT NULL,
|
||||
remise FLOAT NOT NULL,
|
||||
p_u_h_t_net FLOAT NOT NULL,
|
||||
tva FLOAT NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
designation_produit VARCHAR(800) NOT NULL,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
FOREIGN KEY (id_bonde_retourclt) REFERENCES bond_retourclt (idbonderetourclt),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS detail_retour (
|
||||
id_retour BIGINT NOT NULL,
|
||||
id_detail BIGINT NOT NULL,
|
||||
FOREIGN KEY (id_retour) REFERENCES liste_prod_retour (id_retour),
|
||||
FOREIGN KEY (id_detail) REFERENCES stock_detail (id_detail_stock)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS stock (
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
produit_reference VARCHAR(300) NOT NULL,
|
||||
quantite INT NOT NULL,
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom),
|
||||
FOREIGN KEY (produit_reference) REFERENCES produit (reference)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS carte_electronique_frs (
|
||||
id_carte_electronique_frs BIGINT AUTO_INCREMENT NOT NULL,
|
||||
id_reglement_frs BIGINT NOT NULL,
|
||||
numero_transaction VARCHAR(45) NOT NULL,
|
||||
numero_carte BIGINT,
|
||||
banque VARCHAR(45),
|
||||
date_transaction TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
montant FLOAT NOT NULL,
|
||||
PRIMARY KEY (id_carte_electronique_frs),
|
||||
FOREIGN KEY (id_reglement_frs) REFERENCES reglement_frs (id_reglement_frs)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS cheque_frs (
|
||||
id_cheque_frs BIGINT AUTO_INCREMENT NOT NULL,
|
||||
id_reglement_frs BIGINT NOT NULL,
|
||||
numero INT NOT NULL,
|
||||
banque VARCHAR(45) NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
nom_complet VARCHAR(100),
|
||||
date_paiement DATE NOT NULL,
|
||||
date_creation TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id_cheque_frs),
|
||||
FOREIGN KEY (id_reglement_frs) REFERENCES reglement_frs (id_reglement_frs)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS traite_frs (
|
||||
id_traite_frs BIGINT AUTO_INCREMENT NOT NULL,
|
||||
id_reglement_frs BIGINT NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
date_paiement DATE NOT NULL,
|
||||
date_creation TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (id_traite_frs),
|
||||
FOREIGN KEY (id_reglement_frs) REFERENCES reglement_frs (id_reglement_frs)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS frais (
|
||||
id_frais BIGINT AUTO_INCREMENT NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
object VARCHAR(500) NOT NULL,
|
||||
context TEXT,
|
||||
personne VARCHAR(200),
|
||||
mode_paiement SMALLINT NOT NULL,
|
||||
numero VARCHAR(45),
|
||||
banque VARCHAR(45),
|
||||
date_cheque DATE,
|
||||
id_profile INT NOT NULL,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
date_creation TIMESTAMP NOT NULL,
|
||||
PRIMARY KEY (id_frais),
|
||||
FOREIGN KEY (id_profile) REFERENCES profile (idprofile),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom)
|
||||
);
|
||||
COMMIT;
|
||||
|
||||
|
||||
CREATE TABLE IF NOT EXISTS liste_prod_vente_sans_facture (
|
||||
id_liste_prod_vente_sans_facture BIGINT AUTO_INCREMENT NOT NULL,
|
||||
id_vente_sans_facture BIGINT NOT NULL,
|
||||
produit_reference VARCHAR(300) NOT NULL,
|
||||
designation_produit VARCHAR(800) NOT NULL,
|
||||
quantite INT NOT NULL,
|
||||
p_u_h_t FLOAT NOT NULL,
|
||||
remise FLOAT NOT NULL,
|
||||
p_u_h_t_net FLOAT NOT NULL,
|
||||
tva FLOAT NOT NULL,
|
||||
montant FLOAT NOT NULL,
|
||||
local_nom VARCHAR(300) NOT NULL,
|
||||
PRIMARY KEY (id_liste_prod_vente_sans_facture),
|
||||
FOREIGN KEY (produit_reference) REFERENCES produit (reference),
|
||||
FOREIGN KEY (local_nom) REFERENCES local (nom),
|
||||
FOREIGN KEY (id_vente_sans_facture) REFERENCES vente_sans_facture (id_vente_sans_facture)
|
||||
);
|
||||
COMMIT;
|
||||
2104
src/db/H2database_SimpleData.sql
Normal file
2104
src/db/H2database_SimpleData.sql
Normal file
File diff suppressed because it is too large
Load Diff
1
src/logs/myStruts1App.log
Normal file
1
src/logs/myStruts1App.log
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
46
src/main/java/Controllers/App.java
Normal file
46
src/main/java/Controllers/App.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package Controllers;
|
||||
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Models.H2JDBC;
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.apache.log4j.xml.DOMConfigurator;
|
||||
|
||||
/**
|
||||
* JavaFX App
|
||||
*/
|
||||
public class App extends Application {
|
||||
|
||||
H2JDBC h2jdbc = new H2JDBC();
|
||||
|
||||
@Override
|
||||
public void start(Stage stage) throws IOException {
|
||||
|
||||
DOMConfigurator.configure("./conf/log4j.xml");
|
||||
|
||||
h2jdbc.createDB();
|
||||
h2jdbc.InsertSimpleData();
|
||||
|
||||
System.out.println("=============================");
|
||||
|
||||
MyWindow.NewMyStage();
|
||||
MyWindow.setMyParent((Parent) FXMLLoader.load(getClass().getResource("/Views/Authentification.fxml")));
|
||||
Scene scene = new Scene(MyWindow.myParent);
|
||||
MyWindow.myStage.setScene(scene);
|
||||
MyWindow.myStage.show();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
launch();
|
||||
}
|
||||
|
||||
}
|
||||
265
src/main/java/Controllers/AuthentificationController.java
Normal file
265
src/main/java/Controllers/AuthentificationController.java
Normal file
@@ -0,0 +1,265 @@
|
||||
package Controllers;
|
||||
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Models.SimpleDataAchat;
|
||||
import Models.SimpleDataVente;
|
||||
import Models.User.Profile;
|
||||
import Models.User.ProfileDB;
|
||||
import Models.User.User;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
|
||||
public class AuthentificationController implements Initializable{
|
||||
|
||||
@FXML
|
||||
private Label label;
|
||||
|
||||
@FXML
|
||||
private TextField Login;
|
||||
|
||||
|
||||
@FXML
|
||||
private AnchorPane Content;
|
||||
|
||||
@FXML
|
||||
private ImageView ImageViewLogo;
|
||||
|
||||
@FXML
|
||||
private ProgressBar ProgressBarAuthentification;
|
||||
|
||||
private Service<Void> ThreadAuthentification;
|
||||
|
||||
Profile profile;
|
||||
|
||||
int nbrBonEnter ;
|
||||
int nbrDevisClt ;
|
||||
int nbrCommandeClt ;
|
||||
int nbrBonLivraisonClt ;
|
||||
int nbrFactureClt ;
|
||||
int nbrBonReception ;
|
||||
int nbrFactureFrs ;
|
||||
|
||||
Logger logger = Logger.getLogger(AuthentificationController.class.getName());
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb)
|
||||
{
|
||||
Content.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
Connexion();
|
||||
}
|
||||
}
|
||||
});
|
||||
setImageLogo();
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void handleButtonAction(ActionEvent event) throws IOException {
|
||||
this.Connexion();
|
||||
}
|
||||
|
||||
private void Connexion()
|
||||
{
|
||||
Login.setStyle("-fx-border-color: transparent;");
|
||||
Login.setStyle("-fx-border-color: transparent;");
|
||||
|
||||
String login= Login.getText();
|
||||
|
||||
Login.setStyle("-fx-border-color: transparent;");
|
||||
|
||||
ProgressBarAuthentification.setVisible(true);
|
||||
ThreadAuthentification = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
ParametreSystem parametre = new ParametreSystem();
|
||||
|
||||
boolean resultJsonParametre = parametre.SetJsonParametre("http://powerpme.com/demo/parametre?login="+login);
|
||||
|
||||
if(resultJsonParametre == false)
|
||||
{
|
||||
profile = new ProfileDB().getProfileByConnexion("3", "3");
|
||||
User.idprofile= profile.getIdprofile();
|
||||
User.nom = profile.getNom();
|
||||
User.prenom=profile.getPrenom();
|
||||
User.UserLocal=profile.getAuthentification().getLocalNom();
|
||||
User.SotckNegatif= profile.getAuthentification().isStockNegatif();
|
||||
parametre.SetParametre();
|
||||
}
|
||||
|
||||
setNbrSimpleData();
|
||||
SimpleDataVente simpleDataVente = new SimpleDataVente();
|
||||
simpleDataVente.setDataBonEnter(nbrBonEnter);
|
||||
simpleDataVente.setDataDevisClt(nbrDevisClt);
|
||||
simpleDataVente.setDataCommandeClt(nbrCommandeClt);
|
||||
simpleDataVente.setDataBonLivraisonClt(nbrBonLivraisonClt);
|
||||
simpleDataVente.setDataFactureClt(nbrFactureClt);
|
||||
|
||||
SimpleDataAchat simpleDataAchat = new SimpleDataAchat();
|
||||
simpleDataAchat.setDataBonReception(nbrBonReception);
|
||||
simpleDataAchat.setDataFactureFrs(nbrFactureFrs);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadAuthentification.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event)
|
||||
{
|
||||
//Fermer la fenétre de authentification
|
||||
//((Node)(event.getSource())).getScene().getWindow().hide();
|
||||
Content.getScene().getWindow().hide();
|
||||
MyWindow.NewMyStage();
|
||||
try {
|
||||
MyWindow.setMyParent((Parent) FXMLLoader.load(getClass().getResource("/Views/Principal.fxml")));
|
||||
Scene scene = new Scene(MyWindow.myParent);
|
||||
MyWindow.myStage.setScene(scene);
|
||||
MyWindow.myStage.show();
|
||||
} catch (IOException ex) {
|
||||
logger.error("AuthentificationController : Principal.fxml :" + ex.getMessage());
|
||||
}
|
||||
ProgressBarAuthentification.setVisible(false);
|
||||
}
|
||||
});
|
||||
ThreadAuthentification.start();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void setImageLogo()
|
||||
{
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
try {
|
||||
// optional, but recommended
|
||||
// process XML securely, avoid attacks like XML External Entities (XXE)
|
||||
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
|
||||
// parse XML file
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
|
||||
//PowerERP\conf\logo.xml
|
||||
Document doc = db.parse(new File("./conf/logo.xml"));
|
||||
|
||||
doc.getDocumentElement().normalize();
|
||||
|
||||
Element elementCNX = (Element) doc.getElementsByTagName("Connexion").item(0);
|
||||
|
||||
String pathLogo = elementCNX.getElementsByTagName("PathImage").item(0).getTextContent();
|
||||
FileInputStream fis = new FileInputStream(pathLogo);
|
||||
ImageViewLogo.setImage(new Image(fis));
|
||||
|
||||
ImageViewLogo.setFitWidth(Double.parseDouble(elementCNX.getElementsByTagName("FitWidth").item(0).getTextContent()));
|
||||
ImageViewLogo.setFitHeight(Double.parseDouble(elementCNX.getElementsByTagName("FitHeight").item(0).getTextContent()));
|
||||
ImageViewLogo.setLayoutX(Double.parseDouble(elementCNX.getElementsByTagName("LayoutX").item(0).getTextContent()));
|
||||
ImageViewLogo.setLayoutY(Double.parseDouble(elementCNX.getElementsByTagName("LayoutY").item(0).getTextContent()));
|
||||
}
|
||||
catch (ParserConfigurationException | SAXException | IOException e) {
|
||||
System.out.println("error AuthentificationController/setImageLogo "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setNbrSimpleData()
|
||||
{
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
try {
|
||||
// optional, but recommended
|
||||
// process XML securely, avoid attacks like XML External Entities (XXE)
|
||||
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
|
||||
// parse XML file
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
|
||||
//PowerERP\conf\parametre.xml
|
||||
Document doc = db.parse(new File("./conf/parametre.xml"));
|
||||
|
||||
doc.getDocumentElement().normalize();
|
||||
|
||||
Element elementSimpleData = (Element) doc.getElementsByTagName("SimpleData").item(0);
|
||||
|
||||
String strBonEnter = elementSimpleData.getElementsByTagName("BonEnter").item(0).getTextContent();
|
||||
nbrBonEnter = Integer.parseInt(strBonEnter);
|
||||
|
||||
String strDevisClt = elementSimpleData.getElementsByTagName("DevisClt").item(0).getTextContent();
|
||||
nbrDevisClt = Integer.parseInt(strDevisClt);
|
||||
|
||||
String strCommandeClt = elementSimpleData.getElementsByTagName("CommandeClt").item(0).getTextContent();
|
||||
nbrCommandeClt = Integer.parseInt(strCommandeClt);
|
||||
|
||||
String strBonLivraisonClt = elementSimpleData.getElementsByTagName("BonLivraisonClt").item(0).getTextContent();
|
||||
nbrBonLivraisonClt = Integer.parseInt(strBonLivraisonClt);
|
||||
|
||||
String strFactureClt = elementSimpleData.getElementsByTagName("FactureClt").item(0).getTextContent();
|
||||
nbrFactureClt = Integer.parseInt(strFactureClt);
|
||||
|
||||
String strBonReception = elementSimpleData.getElementsByTagName("BonReception").item(0).getTextContent();
|
||||
nbrBonReception = Integer.parseInt(strBonReception);
|
||||
|
||||
String strFactureFrs = elementSimpleData.getElementsByTagName("FactureFrs").item(0).getTextContent();
|
||||
nbrFactureFrs = Integer.parseInt(strFactureFrs);
|
||||
}
|
||||
catch (ParserConfigurationException | SAXException | IOException e) {
|
||||
System.out.println("error AuthentificationController/setNbrSimpleData "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private String fetchJsonData(String urlString) throws Exception
|
||||
{
|
||||
URL url = new URL(urlString);
|
||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
||||
connection.setRequestMethod("GET");
|
||||
|
||||
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
|
||||
String inputLine;
|
||||
StringBuilder content = new StringBuilder();
|
||||
while ((inputLine = in.readLine()) != null) {
|
||||
content.append(inputLine);
|
||||
}
|
||||
in.close();
|
||||
connection.disconnect();
|
||||
|
||||
return content.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,410 @@
|
||||
package Controllers.BonLivraisonClt;
|
||||
|
||||
import Models.CommandeClt.CommandeCltDB;
|
||||
import Models.CommandeClt.CommandeCltListe;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class BonLivraisonCltAjouterController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneBLCltAjouterEtape1;
|
||||
|
||||
@FXML private ProgressBar ProgressBarBLCltAjouter;
|
||||
|
||||
@FXML private Button ButtonSearchBLCltAjouter;
|
||||
|
||||
@FXML public TableView<CommandeCltListe> TableViewCommande;
|
||||
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColCodeCommande;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColModePaiement;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColTypeClient;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColCodeClient;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColTotalCommande;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColDateCreation ;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColCodeDevis;
|
||||
@FXML public TableColumn<CommandeCltListe ,Boolean>TabColAction ;
|
||||
|
||||
@FXML public TextField TextFieldCodeCommande;
|
||||
@FXML public DatePicker DatePickerCreation;
|
||||
@FXML public RadioButton RadioComptant;
|
||||
@FXML public RadioButton RadioFacilite;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
private Service<Void> ThreadSearchBLCltAjouter;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
Logger logger = Logger.getLogger(BonLivraisonCltAjouterController.class.getName());
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
TableViewCommande.setEditable(true);
|
||||
|
||||
TabColCodeCommande.setStyle( "-fx-alignment: CENTER;");TabColCodeCommande.getStyleClass().add("Center");
|
||||
TabColCodeCommande.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("CodeCommande"));
|
||||
|
||||
TabColTypeClient.setStyle( "-fx-alignment: CENTER;");TabColTypeClient.getStyleClass().add("Center");
|
||||
TabColTypeClient.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("TypeClient"));
|
||||
|
||||
TabColCodeClient.setStyle( "-fx-alignment: CENTER;");TabColCodeClient.getStyleClass().add("Center");
|
||||
TabColCodeClient.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("CodeClient"));
|
||||
|
||||
TabColModePaiement.setStyle( "-fx-alignment: CENTER;");TabColModePaiement.getStyleClass().add("Center");
|
||||
TabColModePaiement.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("ModePaiement"));
|
||||
|
||||
TabColTotalCommande.setStyle( "-fx-alignment: CENTER;");TabColTotalCommande.getStyleClass().add("Center");
|
||||
TabColTotalCommande.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("TotalCommande"));
|
||||
|
||||
TabColDateCreation.setStyle( "-fx-alignment: CENTER;");TabColDateCreation.getStyleClass().add("Center");
|
||||
TabColDateCreation.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("DateCreation"));
|
||||
|
||||
TabColCodeDevis.setStyle( "-fx-alignment: CENTER;");TabColCodeDevis.getStyleClass().add("Center");
|
||||
TabColCodeDevis.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("CodeDevis"));
|
||||
|
||||
|
||||
TabColAction.setSortable(true);
|
||||
TabColAction.setStyle( "-fx-alignment: CENTER;");TabColAction.getStyleClass().add("Center");
|
||||
TabColAction.setCellFactory(new Callback<TableColumn<CommandeCltListe, Boolean>, TableCell<CommandeCltListe, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<CommandeCltListe, Boolean> call(TableColumn<CommandeCltListe, Boolean> personBooleanTableColumn) {
|
||||
return new BonLivraisonCltAjouterController.ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
ButtonSearchBLCltAjouter.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchBLCltAjouter();
|
||||
}
|
||||
});
|
||||
|
||||
AnchorPaneBLCltAjouterEtape1.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchBLCltAjouter();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
RadioComptant.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchBLCltAjouter();
|
||||
}
|
||||
});
|
||||
|
||||
RadioFacilite.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchBLCltAjouter();
|
||||
}
|
||||
});
|
||||
|
||||
GestionSearchBLCltAjouter();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private class ButtonCell extends TableCell<CommandeCltListe, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconedit.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){ //Action when the button is pressed
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
try {
|
||||
CommandeCltListe current = (CommandeCltListe) ButtonCell.this.getTableView().getItems().get(ButtonCell.this.getIndex());
|
||||
String CodeCommande = current.getCodeCommande();
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/BonLivraisonClt/BonLivraisonCltAjouterEtape2.fxml"));
|
||||
Parent NodeBonLivraisonCltAjouterEtape2 = (Parent)fxmlLoader.load();
|
||||
BonLivraisonCltAjouterEtape2Controller BonLivraisonCltAjouterEtape2= fxmlLoader.getController();
|
||||
|
||||
AnchorPaneBLCltAjouterEtape1.getChildren().clear();
|
||||
AnchorPaneBLCltAjouterEtape1.getChildren().add(NodeBonLivraisonCltAjouterEtape2);
|
||||
|
||||
BonLivraisonCltAjouterEtape2.SetDataCommandeClt(CodeCommande);
|
||||
} catch (IOException ex) {
|
||||
logger.error("BonLivraisonCltAjouterController : BonLivraisonCltAjouterEtape2.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchBLCltAjouter()
|
||||
{
|
||||
ProgressBarBLCltAjouter.setVisible(true);
|
||||
|
||||
ButtonSearchBLCltAjouter.setDisable(true);
|
||||
|
||||
ThreadSearchBLCltAjouter = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DateCreation = "";
|
||||
if(DatePickerCreation.getValue() != null){
|
||||
DateCreation = DatePickerCreation.getValue().toString();
|
||||
}
|
||||
|
||||
// 0comptant 1facilité
|
||||
String TypeRegement = "";
|
||||
if(RadioComptant.isSelected()){
|
||||
TypeRegement = "0";
|
||||
}else if(RadioFacilite.isSelected()){
|
||||
TypeRegement = "1";
|
||||
}
|
||||
|
||||
ObservableList<CommandeCltListe> ListBLCltAjouters = new CommandeCltDB().SearchCommandeCltNotBonLivrison(
|
||||
position,
|
||||
nbrligne,
|
||||
TextFieldCodeCommande.getText(),
|
||||
DateCreation,
|
||||
TypeRegement);
|
||||
|
||||
TableViewCommande.setItems(ListBLCltAjouters);
|
||||
|
||||
totalcount = new CommandeCltDB().nbrCommandeCltNotBonLivrison(TextFieldCodeCommande.getText(), DateCreation, TypeRegement);
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchBLCltAjouter.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarBLCltAjouter.setVisible(false);
|
||||
ButtonSearchBLCltAjouter.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchBLCltAjouter.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchBLCltAjouter(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarBLCltAjouter.setVisible(true);
|
||||
|
||||
ButtonSearchBLCltAjouter.setDisable(true);
|
||||
|
||||
ThreadSearchBLCltAjouter = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateCreation = "";
|
||||
if(DatePickerCreation.getValue() != null){
|
||||
DateCreation = DatePickerCreation.getValue().toString();
|
||||
}
|
||||
|
||||
// 0comptant 1facilité
|
||||
String TypeRegement = "";
|
||||
if(RadioComptant.isSelected()){
|
||||
TypeRegement = "0";
|
||||
}else if(RadioFacilite.isSelected()){
|
||||
TypeRegement = "1";
|
||||
}
|
||||
|
||||
ObservableList<CommandeCltListe> ListBLCltAjouters = new CommandeCltDB().SearchCommandeCltNotBonLivrison(ParmPosition, ParamNbrligne, TextFieldCodeCommande.getText(), DateCreation, TypeRegement);
|
||||
|
||||
TableViewCommande.setItems(ListBLCltAjouters);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchBLCltAjouter.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarBLCltAjouter.setVisible(false);
|
||||
ButtonSearchBLCltAjouter.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchBLCltAjouter.start();
|
||||
}
|
||||
|
||||
private void GestionSearchBLCltAjouter()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchBLCltAjouter(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchBLCltAjouter(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchBLCltAjouter(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchBLCltAjouter(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchBLCltAjouter(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,300 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.BonLivraisonClt;
|
||||
|
||||
import Controllers.Dialog.Dialog;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Models.Produit.ListeProduit;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.BonLivraisonClt.BonLivraisonClt;
|
||||
import Models.BonLivraisonClt.BonLivraisonCltDB;
|
||||
import Models.BonLivraisonClt.BonLivraisonCltProduitList;
|
||||
import Models.CommandeClt.CommandeClt;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.text.Text;
|
||||
import Models.Client.Client;
|
||||
import Models.Client.ClientEntreprise;
|
||||
import Models.Client.ClientPassager;
|
||||
import Models.CommandeClt.CommandeCltDB;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.util.Callback;
|
||||
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
*
|
||||
* @author Maher
|
||||
*/
|
||||
public class BonLivraisonCltAjouterEtape2Controller implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneBLCltAjouterEtape2;
|
||||
|
||||
@FXML private Text TextType;
|
||||
@FXML private Text TextCode;
|
||||
@FXML private Text TextNom;
|
||||
@FXML private Text TextPrenom;
|
||||
@FXML private Text TextAdresse;
|
||||
@FXML private Text TextDateNaissance;
|
||||
@FXML private Text TextTele1;
|
||||
@FXML private Text TextTele2;
|
||||
@FXML private Text TxtPrenom;
|
||||
@FXML private Text TxtDateNaissance;
|
||||
|
||||
@FXML public TableView<BonLivraisonCltProduitList> TableViewBonLivraisonCltProduitList;
|
||||
@FXML public TableColumn<BonLivraisonCltProduitList ,String> TabColReference;
|
||||
@FXML public TableColumn<BonLivraisonCltProduitList ,String> TabColDesignation ;
|
||||
@FXML public TableColumn<BonLivraisonCltProduitList ,String> TabColMarque;
|
||||
@FXML public TableColumn<BonLivraisonCltProduitList ,String> TabColCategorie;
|
||||
@FXML public TableColumn<BonLivraisonCltProduitList ,String> TabColProdDisponible;
|
||||
@FXML public TableColumn<BonLivraisonCltProduitList ,String> TabColQuantite;
|
||||
@FXML public TableColumn<BonLivraisonCltProduitList ,String> TabColPrixTTC;
|
||||
|
||||
@FXML private TextField TextFieldHeurLivraison ;
|
||||
@FXML private TextField TextFieldNumTele1 ;
|
||||
@FXML private TextField TextFieldNumTele2 ;
|
||||
@FXML private TextField TextFieldTransporteur ;
|
||||
@FXML private TextField TextFieldPoidProduit;
|
||||
@FXML private DatePicker DatePickerDateLivraison;
|
||||
@FXML private TextArea TextAreaAdressLivraison;
|
||||
@FXML private TextField TextFieldFraisTransport ;
|
||||
|
||||
ObservableList<BonLivraisonCltProduitList> ObservableListBLCltPro = FXCollections.observableArrayList();
|
||||
BonLivraisonClt BonLivraison = new BonLivraisonClt();
|
||||
Text Txt = new Text();
|
||||
|
||||
contro clt = new contro();
|
||||
|
||||
public CommandeClt Commande;
|
||||
|
||||
boolean DisponibleProduit = true;
|
||||
|
||||
Logger logger = Logger.getLogger(BonLivraisonCltAjouterEtape2Controller.class.getName());
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<BonLivraisonCltProduitList, String>("Reference"));
|
||||
TabColDesignation.setCellValueFactory(new PropertyValueFactory<BonLivraisonCltProduitList, String>("Designation"));
|
||||
TabColMarque.setCellValueFactory(new PropertyValueFactory<BonLivraisonCltProduitList, String>("Marque"));
|
||||
TabColCategorie.setCellValueFactory(new PropertyValueFactory<BonLivraisonCltProduitList, String>("Categorie"));
|
||||
|
||||
TabColProdDisponible.setCellValueFactory(new PropertyValueFactory<BonLivraisonCltProduitList, String>("ProdDisponible"));
|
||||
TabColProdDisponible.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColProdDisponible.getStyleClass().add("Center");
|
||||
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<BonLivraisonCltProduitList, String>("QuantiteProd"));
|
||||
|
||||
TabColPrixTTC.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixTTC.getStyleClass().add("Center");
|
||||
TabColPrixTTC.setCellValueFactory(new PropertyValueFactory<BonLivraisonCltProduitList, String>("PrixTTC"));
|
||||
|
||||
TabColProdDisponible.setCellFactory(new Callback<TableColumn<BonLivraisonCltProduitList,String>,TableCell<BonLivraisonCltProduitList,String>>(){
|
||||
@Override
|
||||
public TableCell<BonLivraisonCltProduitList, String> call(TableColumn<BonLivraisonCltProduitList, String> param) {
|
||||
TableCell<BonLivraisonCltProduitList, String> cell = new TableCell<BonLivraisonCltProduitList, String>(){
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
if(item!= null && item.equals("1")){
|
||||
Text text = new Text("Oui");
|
||||
text.setFill(Color.web("#428BCA"));
|
||||
text.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||
setGraphic(text);
|
||||
}else if(item!= null && item.equals("0")){
|
||||
DisponibleProduit = false;
|
||||
Text text = new Text("Non");
|
||||
text.setFill(Color.web("#EA4335"));
|
||||
text.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||
setGraphic(text);
|
||||
}else{
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
TextFieldFraisTransport.setText("0");
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void CreateBonLivraisonCltButtonAction(ActionEvent event) throws IOException {
|
||||
if( clt.ContrNumerique(TextFieldNumTele1, Txt) &&
|
||||
clt.ContrNumerique(TextFieldNumTele2, Txt) &&
|
||||
clt.ContrNumerique(TextFieldPoidProduit, Txt) &&
|
||||
clt.ContrNull(TextAreaAdressLivraison, Txt)&&
|
||||
clt.ContrHour(TextFieldHeurLivraison, Txt) ){
|
||||
if(DisponibleProduit){
|
||||
NextEtap();
|
||||
}else{
|
||||
final Dialog MyDialog= new Dialog();
|
||||
Node node = MyDialog.DialogNotification();
|
||||
MyDialog.Titre.setText("Attention produit non disponible en stock");
|
||||
MyDialog.Message.setText("Lorsque vous cliquez sur Valider votre stock sera négative");
|
||||
MyDialog.DefaultAnnuler();
|
||||
MyDialog.Valider.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
MyDialog.PaneDialog.setVisible(false);
|
||||
NextEtap();
|
||||
}
|
||||
});
|
||||
MyDialog.Show(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetBonLivraision(){
|
||||
BonLivraison.setTele1(TextFieldNumTele1.getText());
|
||||
BonLivraison.setTele2(TextFieldNumTele2.getText());
|
||||
BonLivraison.setHeurLivraison(TextFieldHeurLivraison.getText());
|
||||
if(DatePickerDateLivraison.getValue()!=null){
|
||||
BonLivraison.setDateLivraisonPreveu(DatePickerDateLivraison.getValue().toString());
|
||||
}
|
||||
BonLivraison.setTransporteur(TextFieldTransporteur.getText());
|
||||
BonLivraison.setPoidProduit(TextFieldPoidProduit.getText());
|
||||
BonLivraison.setAdresseLivraison(TextAreaAdressLivraison.getText());
|
||||
BonLivraison.setFrais(TextFieldFraisTransport.getText());
|
||||
|
||||
if(clt.isNumericNotnull(TextFieldFraisTransport.getText())){
|
||||
float PayerAFraisT = Adaptateur.StringToFloat(BonLivraison.getNetAPayer());
|
||||
float FraisTransport = Adaptateur.StringToFloat(TextFieldFraisTransport.getText());
|
||||
float NetAPayer = PayerAFraisT + FraisTransport;
|
||||
BonLivraison.setNetAPayer(Adaptateur.floatDeleZero(NetAPayer));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void NextEtap(){
|
||||
try {
|
||||
ConvertCommandeToBonLivraision();
|
||||
SetBonLivraision();
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/BonLivraisonClt/BonLivraisonCltAjouterEtape3.fxml"));
|
||||
Parent NodeBonLivraisonCltAjouterEtape3 = (Parent)fxmlLoader.load();
|
||||
|
||||
BonLivraisonCltAjouterEtape3Controller BonLivraisonCltAjouterEtape3= fxmlLoader.getController();
|
||||
BonLivraisonCltAjouterEtape3.BonLivraisonStep2ToStep3(BonLivraison, Commande.getCodecommandeclt());
|
||||
|
||||
AnchorPaneBLCltAjouterEtape2.getChildren().clear();
|
||||
AnchorPaneBLCltAjouterEtape2.getChildren().add(NodeBonLivraisonCltAjouterEtape3);
|
||||
} catch (IOException ex) {
|
||||
logger.error("BonLivraisonCltAjouterEtape2Controller : NextEtap :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void ConvertCommandeToBonLivraision(){
|
||||
BonLivraison.setIdCommande(Commande.getCodecommandeclt());
|
||||
//0 Personne 1 Entreprise 2 Passager
|
||||
Integer TypeClt = Commande.getTypeClient();
|
||||
BonLivraison.setTypeClient(TypeClt);
|
||||
if(TypeClt == 0){
|
||||
BonLivraison.setCltPersonne(Commande.getCltPersonne());
|
||||
BonLivraison.setAdresseLivraison(Commande.CltPersonne.getAdresse());
|
||||
}else if(TypeClt == 1){
|
||||
BonLivraison.setCltEntreprise(Commande.getCltEntreprise());
|
||||
BonLivraison.setAdresseLivraison(Commande.CltEntreprise.getAdresse());
|
||||
}else if(TypeClt == 2){
|
||||
BonLivraison.setCltPassager(Commande.getCltPassager());
|
||||
BonLivraison.setAdresseLivraison(Commande.CltPassager.getAdresse());
|
||||
}
|
||||
|
||||
BonLivraison.setListeproduit(Commande.getListeproduit());
|
||||
BonLivraison.setTotalHorsTaxNet(Commande.getTotalHorsTaxNet());
|
||||
BonLivraison.setTotalTVA(Commande.getTotalTVA());
|
||||
BonLivraison.setRemise(Commande.getRemise());
|
||||
BonLivraison.setNetAPayer(Commande.getNetAPayer());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SetDataCommandeClt(String CodeCommande){
|
||||
CommandeCltDB CommandeDB= new CommandeCltDB();
|
||||
Commande = CommandeDB.getCommandeClt(CodeCommande);
|
||||
Integer TypeClient = Commande.getTypeClient();
|
||||
if(TypeClient == 0){
|
||||
Client Personne= Commande.getCltPersonne();
|
||||
TextType.setText("ancien client");
|
||||
TextCode.setText(Personne.getCodeclient());
|
||||
TextNom.setText(Personne.getNom());
|
||||
TextPrenom.setText(Personne.getPrenom());
|
||||
TextAdresse.setText(Personne.getAdresse());
|
||||
TextAreaAdressLivraison.setText(Personne.getAdresse());
|
||||
TextDateNaissance.setText(Adaptateur.NormalDateFormat(Personne.getNaissance().toString()));
|
||||
TextTele1.setText(Personne.getTelefixString());
|
||||
TextTele2.setText(Personne.getTelemobileString());
|
||||
TextFieldNumTele1.setText(Personne.getTelefixString());
|
||||
TextFieldNumTele2.setText(Personne.getTelemobileString());
|
||||
}else if(TypeClient == 1){
|
||||
ClientEntreprise Entreprise = Commande.getCltEntreprise();
|
||||
TextType.setText("Entrepise");
|
||||
TextCode.setText(Entreprise.getCodeString());
|
||||
TxtPrenom.setText("Matricule");
|
||||
TextPrenom.setText(Entreprise.getMatricule());
|
||||
TxtDateNaissance.setText("E-Mail");
|
||||
TextDateNaissance.setText(Entreprise.getMail());
|
||||
TextNom.setText(Entreprise.getNom());
|
||||
TextAdresse.setText(Entreprise.getAdresse());
|
||||
TextAreaAdressLivraison.setText(Entreprise.getAdresse());
|
||||
TextTele1.setText(Entreprise.getTele1String());
|
||||
TextTele2.setText(Entreprise.getTele2String());
|
||||
TextFieldNumTele1.setText(Entreprise.getTele1String());
|
||||
TextFieldNumTele2.setText(Entreprise.getTele2String());
|
||||
}else if(TypeClient == 2){
|
||||
ClientPassager Passager = Commande.getCltPassager();
|
||||
TextType.setText("Passager");
|
||||
TextCode.setText(Passager.getCodeclient());
|
||||
TextNom.setText(Passager.getNom());
|
||||
TextPrenom.setText(Passager.getPrenom());
|
||||
TextAdresse.setText(Passager.getAdresse());
|
||||
TextAreaAdressLivraison.setText(Passager.getAdresse());
|
||||
TextDateNaissance.setText(Passager.getNaissance());
|
||||
TextTele1.setText(Passager.getTelefixString());
|
||||
TextTele2.setText(Passager.getTelemobileString());
|
||||
TextFieldNumTele1.setText(Passager.getTelefixString());
|
||||
TextFieldNumTele2.setText(Passager.getTelemobileString());
|
||||
}
|
||||
|
||||
DatePickerDateLivraison.setValue(LocalDate.now());
|
||||
|
||||
SetDataListeproduit();
|
||||
}
|
||||
|
||||
public void SetDataListeproduit(){
|
||||
ObservableList<ListeProduit> DataListeproduit = Commande.getListeproduit();
|
||||
|
||||
BonLivraisonCltDB BonLivraisonDB= new BonLivraisonCltDB();
|
||||
ObservableListBLCltPro = BonLivraisonDB.GetListBonLivraisonCltSotck(DataListeproduit);
|
||||
|
||||
TableViewBonLivraisonCltProduitList.setItems(ObservableListBLCltPro);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.BonLivraisonClt;
|
||||
|
||||
import Models.BonLivraisonClt.BonLivraisonClt;
|
||||
import Models.BonLivraisonClt.BonLivraisonCltDB;
|
||||
import Models.CommandeClt.CommandeCltDB;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.ProgressIndicator;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Maher
|
||||
*/
|
||||
public class BonLivraisonCltAjouterEtape3Controller implements Initializable {
|
||||
|
||||
@FXML public ProgressIndicator ProgressBonLivraion;
|
||||
@FXML public ImageView ImageBonLivraion;
|
||||
@FXML public Text TextBonLivraion;
|
||||
|
||||
BonLivraisonClt BonLivraison = new BonLivraisonClt();
|
||||
BonLivraisonCltDB BonLivraisonDB = new BonLivraisonCltDB();
|
||||
|
||||
private String IdBonLivraison;
|
||||
private String CodeCommandeclt;
|
||||
private Service<Void> ThreadBonLivraison;
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
}
|
||||
|
||||
public void BonLivraisonStep2ToStep3(BonLivraisonClt bon_livraison_clt, String code_commandeclt){
|
||||
BonLivraison = bon_livraison_clt;
|
||||
CodeCommandeclt = code_commandeclt;
|
||||
LanchSaveBonLivraison();
|
||||
}
|
||||
|
||||
public void LanchSaveBonLivraison(){
|
||||
ThreadBonLivraison = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call(){
|
||||
IdBonLivraison = BonLivraisonDB.AddBonLivraisonClt(BonLivraison);
|
||||
new CommandeCltDB().UpdateCommandeCltSetIdBonLivraison(CodeCommandeclt, IdBonLivraison);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadBonLivraison.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBonLivraion.setVisible(false);
|
||||
TextBonLivraion.setText("La bon livraison numéro "+IdBonLivraison+" a été enregistrés avec succès");
|
||||
ImageBonLivraion.setVisible(true);
|
||||
}
|
||||
});
|
||||
ThreadBonLivraison.start();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,348 @@
|
||||
package Controllers.BonLivraisonClt;
|
||||
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Models.BonLivraisonClt.BonLivraisonClt;
|
||||
import Models.BonLivraisonClt.BonLivraisonCltDB;
|
||||
import Models.Produit.ListeProduit;
|
||||
import Models.User.Profile;
|
||||
import Models.User.ProfileDB;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.print.PageRange;
|
||||
import javafx.print.PrinterJob;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Control;
|
||||
import javafx.scene.control.ProgressIndicator;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class BonLivraisonCltDetailController{
|
||||
|
||||
@FXML private TableView<ListeProduit> TableViewListeProduit ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColReference;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDesignation;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColQuantite ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColPrixHT;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColRemise;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTotalHT;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTVA;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTotalTTC;
|
||||
|
||||
@FXML private TableView<ListeProduit> TableViewListeProduitTempo ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColReferenceTempo;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDesignationTempo;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColQuantiteTempo ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColPrixHTTempo;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColRemiseTempo;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTotalHTTempo;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTVATempo;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTotalTTCTempo;
|
||||
|
||||
|
||||
@FXML public AnchorPane AnchorPrincipal ;
|
||||
@FXML public AnchorPane AnchorSecondaire ;
|
||||
@FXML private ProgressIndicator ProgressBonLivraion ;
|
||||
|
||||
@FXML public Text TextIdBonLivraison ;
|
||||
|
||||
@FXML private Text TextTypeClt ;
|
||||
@FXML private Text TextNom ;
|
||||
@FXML private Text TextPrenom ;
|
||||
@FXML private Text TextAdressClt ;
|
||||
|
||||
@FXML private Text TextDateCreation ;
|
||||
@FXML private Text TextLocale ;
|
||||
@FXML private Text TextNomPrenomProfile ;
|
||||
|
||||
@FXML private Text TextHeurLivraison ;
|
||||
@FXML private Text TextDateLivraison ;
|
||||
@FXML private Text TextTransporteur ;
|
||||
@FXML private Text TextFraisLivraison ;
|
||||
@FXML private Text TextAdressLivraison ;
|
||||
|
||||
private Service<Void> ThreadBonLivraison;
|
||||
public Node nodeFxml;
|
||||
public String IdBonLivraison;
|
||||
|
||||
ObservableList<Map<String, Object>> items = FXCollections.<Map<String, Object>>observableArrayList();
|
||||
int TotalHeightPage = 0;
|
||||
|
||||
BonLivraisonClt BonLivraison = new BonLivraisonClt();
|
||||
Profile profile = new Profile();
|
||||
|
||||
Logger logger = Logger.getLogger(BonLivraisonCltDetailController.class.getName());
|
||||
|
||||
public BonLivraisonCltDetailController(){
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/BonLivraisonClt/BonLivraisonCltDetail.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
nodeFxml = (Node) fxmlLoader.load();
|
||||
} catch (IOException ex) {
|
||||
logger.error("BonLivraisonCltDetailController : BonLivraisonCltDetail.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void SetIdBonLivraison(String id_bon_livraison){
|
||||
IdBonLivraison = id_bon_livraison;
|
||||
|
||||
TableViewListeProduit.setEditable(true);
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColDesignation.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColRemise.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColRemise.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColRemise.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTotalTTC.getStyleClass().add("Center");
|
||||
|
||||
TabColReference.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColQuantite.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColRemise.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
|
||||
initializeTempo();
|
||||
|
||||
LanchBonLivraison();
|
||||
}
|
||||
|
||||
public void LanchBonLivraison(){
|
||||
ThreadBonLivraison = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
BonLivraison = new BonLivraisonCltDB().GetBonLivraisonClt(IdBonLivraison);
|
||||
profile = new ProfileDB().getpro(Integer.parseInt(BonLivraison.getIdProfileEditeur()));
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadBonLivraison.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
TextIdBonLivraison.setText(BonLivraison.getIdBonLivrasionClt());
|
||||
|
||||
//0 Personne 1 Entreprise 2 Passager
|
||||
if(BonLivraison.getTypeClient() == 0){
|
||||
TextTypeClt.setText("Ancien client") ;
|
||||
TextNom.setText(BonLivraison.CltPersonne.getNom()) ;
|
||||
TextPrenom.setText(BonLivraison.CltPersonne.getPrenom()) ;
|
||||
TextAdressClt.setText(BonLivraison.CltPersonne.getAdresse());
|
||||
}else if(BonLivraison.getTypeClient() == 1){
|
||||
TextTypeClt.setText("Entreprise") ;
|
||||
TextNom.setText(BonLivraison.CltEntreprise.getNom()) ;
|
||||
TextPrenom.setText(BonLivraison.CltEntreprise.getMatricule()) ;
|
||||
TextAdressClt.setText(BonLivraison.CltEntreprise.getAdresse());
|
||||
}else if(BonLivraison.getTypeClient() == 2){
|
||||
TextTypeClt.setText("Passager") ;
|
||||
TextNom.setText(BonLivraison.CltPassager.getNom()) ;
|
||||
TextPrenom.setText(BonLivraison.CltPassager.getPrenom()) ;
|
||||
TextAdressClt.setText(BonLivraison.CltPassager.getAdresse());
|
||||
}
|
||||
|
||||
TextNomPrenomProfile.setText(profile.getNom()+" "+profile.getPrenom()) ;
|
||||
|
||||
TextDateCreation.setText(BonLivraison.getDateCreation()) ;
|
||||
TextLocale.setText(BonLivraison.getLocalNom()) ;
|
||||
|
||||
TextHeurLivraison.setText(BonLivraison.getHeurLivraison()) ;
|
||||
TextDateLivraison.setText(BonLivraison.getDateLivraisonPreveu()) ;
|
||||
TextTransporteur.setText(BonLivraison.getTransporteur()) ;
|
||||
TextFraisLivraison.setText(BonLivraison.getFrais()) ;
|
||||
TextAdressLivraison.setText(BonLivraison.getAdresseLivraison()) ;
|
||||
|
||||
ObservableList<ListeProduit> DataListeProduit = BonLivraison.getListeproduit();
|
||||
TableViewListeProduit.setItems(DataListeProduit);
|
||||
TableViewListeProduitTempo.setItems(DataListeProduit);
|
||||
|
||||
ProgressBonLivraion.setVisible(false);
|
||||
AnchorSecondaire.setVisible(true);
|
||||
}
|
||||
});
|
||||
ThreadBonLivraison.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Show()
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(nodeFxml);
|
||||
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void ExitButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPrincipal.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void PDFBonLivraisonCltButtonAction(ActionEvent event) throws IOException {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void initializeTempo()
|
||||
{
|
||||
TabColReferenceTempo.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColReferenceTempo.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColReferenceTempo.getStyleClass().add("Center");
|
||||
|
||||
TabColDesignationTempo.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
TabColDesignationTempo.setCellFactory(new Callback<TableColumn<ListeProduit,String>,TableCell<ListeProduit,String>>(){
|
||||
@Override
|
||||
public TableCell<ListeProduit, String> call(TableColumn<ListeProduit, String> param) {
|
||||
TableCell<ListeProduit, String> cell = new TableCell<ListeProduit, String>(){
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
if (item == null) {
|
||||
super.setText(null);
|
||||
super.setGraphic(null);
|
||||
} else {
|
||||
String newItem = item.trim().toLowerCase();
|
||||
Text text = new Text(newItem);
|
||||
super.setPrefHeight(Control.USE_COMPUTED_SIZE);
|
||||
text.wrappingWidthProperty().bind(super.widthProperty());
|
||||
super.setGraphic(text);
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int selectdIndex = getTableRow().getIndex();
|
||||
|
||||
if(selectdIndex>=0){
|
||||
Map<String, Object> item1 = new HashMap<>();
|
||||
item1.put("produit", (ListeProduit) getTableRow().getItem());
|
||||
item1.put("designation", newItem);
|
||||
item1.put("height", text.getBoundsInLocal().getHeight());
|
||||
items.add(item1);
|
||||
TotalHeightPage += text.getBoundsInLocal().getHeight();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
TabColQuantiteTempo.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColQuantiteTempo.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColQuantiteTempo.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixHTTempo.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColPrixHTTempo.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixHTTempo.getStyleClass().add("Center");
|
||||
|
||||
TabColRemiseTempo.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColRemiseTempo.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColRemiseTempo.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalHTTempo.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColTotalHTTempo.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalHTTempo.getStyleClass().add("Center");
|
||||
|
||||
TabColTVATempo.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColTVATempo.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTVATempo.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalTTCTempo.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColTotalTTCTempo.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalTTCTempo.getStyleClass().add("Center");
|
||||
|
||||
TabColReferenceTempo.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColQuantiteTempo.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColRemiseTempo.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
private void PrintBonLivraisonCltButtonAction(ActionEvent event) throws IOException {
|
||||
|
||||
ObservableList<ListeProduit> ListProd = BonLivraison.getListeproduit();
|
||||
|
||||
PrinterJob jobPrint = PrinterJob.createPrinterJob();
|
||||
|
||||
try {
|
||||
|
||||
jobPrint.getJobSettings().setPageRanges(new PageRange(1, 1));
|
||||
|
||||
if (jobPrint.showPrintDialog(null)) {
|
||||
|
||||
FXMLLoader fxmlLoaderPrintLivraison = new FXMLLoader(getClass().getResource("/Views/BonLivraisonClt/BonLivraisonCltPrint.fxml"));
|
||||
final Node ParentFxmlPrintLivraison = (Node)fxmlLoaderPrintLivraison.load();
|
||||
BonLivraisonCltPrintController PrintLivraison = fxmlLoaderPrintLivraison.getController();
|
||||
|
||||
PrintLivraison.setBonLivraisonClt(BonLivraison, ListProd, "1/1", true);
|
||||
|
||||
jobPrint.printPage(ParentFxmlPrintLivraison);
|
||||
|
||||
jobPrint.endJob();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
System.err.println("BondeEntrerDetailController PrintBonEntreButtonAction ! \n"+ex.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,381 @@
|
||||
package Controllers.BonLivraisonClt;
|
||||
|
||||
import Models.BonLivraisonClt.BonLivraisonCltDB;
|
||||
import Models.BonLivraisonClt.BonLivraisonCltGestionList;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author maher
|
||||
*/
|
||||
public class BonLivraisonCltGestionController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane PaneBonLivraisonCltGestion;
|
||||
|
||||
@FXML private ProgressBar ProgressBarBonLivraisonClt;
|
||||
|
||||
@FXML private Button ButtonSearchBonLivraisonClt;
|
||||
|
||||
@FXML public TableView<BonLivraisonCltGestionList> TableViewBonLivraisonCltListGestion;
|
||||
@FXML public TableColumn<BonLivraisonCltGestionList ,String> TabColIdBonLivrasionClt;
|
||||
@FXML public TableColumn<BonLivraisonCltGestionList ,String> TabColDateHeurLivraison ;
|
||||
@FXML public TableColumn<BonLivraisonCltGestionList ,String> TabColAdresseLivraison;
|
||||
@FXML public TableColumn<BonLivraisonCltGestionList ,String> TabColCodeClt;
|
||||
@FXML public TableColumn<BonLivraisonCltGestionList ,String> TabColIdFactureClt ;
|
||||
@FXML public TableColumn<BonLivraisonCltGestionList ,String> TabColTransporteur;
|
||||
@FXML public TableColumn<BonLivraisonCltGestionList ,Boolean>TabColBlDetail ;
|
||||
|
||||
@FXML public TextField TextFieldIdBonLivrasionClt ;
|
||||
@FXML public DatePicker DatePickerDateLivraison;
|
||||
@FXML public TextField TextFieldCodeClt;
|
||||
@FXML public TextField TextFieldIdFactureClt;
|
||||
@FXML public TextField TextFieldTransporteur;
|
||||
@FXML public TextField TextFieldAdresseLivraison;
|
||||
|
||||
@FXML private AnchorPane ListerPages;
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount ;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
private Service<Void> ThreadSearchBonLivraisonClt;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
//comboboxnombre des lignes tableview
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
TableViewBonLivraisonCltListGestion.setEditable(true);
|
||||
|
||||
TabColIdBonLivrasionClt.setStyle( "-fx-alignment: CENTER;");TabColIdBonLivrasionClt.getStyleClass().add("Center");
|
||||
TabColIdBonLivrasionClt.setCellValueFactory(new PropertyValueFactory<BonLivraisonCltGestionList, String>("IdBonLivrasionClt"));
|
||||
|
||||
TabColDateHeurLivraison.setStyle( "-fx-alignment: CENTER;");TabColDateHeurLivraison.getStyleClass().add("Center");
|
||||
TabColDateHeurLivraison.setCellValueFactory(new PropertyValueFactory<BonLivraisonCltGestionList, String>("DateHeurLivraison"));
|
||||
|
||||
TabColAdresseLivraison.setStyle( "-fx-alignment: CENTER;");TabColAdresseLivraison.getStyleClass().add("Center");
|
||||
TabColAdresseLivraison.setCellValueFactory(new PropertyValueFactory<BonLivraisonCltGestionList, String>("AdresseLivraison"));
|
||||
|
||||
TabColCodeClt.setStyle( "-fx-alignment: CENTER;");TabColCodeClt.getStyleClass().add("Center");
|
||||
TabColCodeClt.setCellValueFactory(new PropertyValueFactory<BonLivraisonCltGestionList, String>("CodeClt"));
|
||||
|
||||
TabColIdFactureClt.setStyle( "-fx-alignment: CENTER;");TabColIdFactureClt.getStyleClass().add("Center");
|
||||
TabColIdFactureClt.setCellValueFactory(new PropertyValueFactory<BonLivraisonCltGestionList, String>("IdFactureClt"));
|
||||
|
||||
TabColTransporteur.setStyle( "-fx-alignment: CENTER;");TabColTransporteur.getStyleClass().add("Center");
|
||||
TabColTransporteur.setCellValueFactory(new PropertyValueFactory<BonLivraisonCltGestionList, String>("Transporteur"));
|
||||
|
||||
TabColBlDetail.setStyle( "-fx-alignment: CENTER;");TabColBlDetail.getStyleClass().add("Center");
|
||||
TabColBlDetail.setCellFactory(new Callback<TableColumn<BonLivraisonCltGestionList, Boolean>, TableCell<BonLivraisonCltGestionList, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<BonLivraisonCltGestionList, Boolean> call(TableColumn<BonLivraisonCltGestionList, Boolean> personBooleanTableColumn) {
|
||||
return new ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ButtonSearchBonLivraisonClt.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchBonLivraisonClt();
|
||||
}
|
||||
});
|
||||
|
||||
PaneBonLivraisonCltGestion.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchBonLivraisonClt();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SearchBonLivraisonClt();
|
||||
|
||||
GestionSearchBonLivraisonClt();
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void AjouterBonLivraisonCltButtonAction(ActionEvent event) throws IOException {
|
||||
PaneBonLivraisonCltGestion.getChildren().clear();
|
||||
PaneBonLivraisonCltGestion.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/BonLivraisonClt/BonLivraisonCltAjouter.fxml")));
|
||||
}
|
||||
|
||||
|
||||
private class ButtonCell extends TableCell<BonLivraisonCltGestionList, Boolean> {
|
||||
final Button cellButton = new Button();
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/detailbutton.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){ //Action when the button is pressed
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
BonLivraisonCltGestionList current = (BonLivraisonCltGestionList) ButtonCell.this.getTableView().getItems().get(ButtonCell.this.getIndex());
|
||||
String IdBonLivrasionClt = current.getIdBonLivrasionClt();
|
||||
|
||||
BonLivraisonCltDetailController BonLivraisonCltDetail = new BonLivraisonCltDetailController();
|
||||
BonLivraisonCltDetail.Show();
|
||||
BonLivraisonCltDetail.SetIdBonLivraison(IdBonLivrasionClt);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView client Entreprise *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchBonLivraisonClt()
|
||||
{
|
||||
ProgressBarBonLivraisonClt.setVisible(true);
|
||||
|
||||
ButtonSearchBonLivraisonClt.setDisable(true);
|
||||
|
||||
ThreadSearchBonLivraisonClt = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DateLivraison = "";
|
||||
if(DatePickerDateLivraison.getValue() != null){
|
||||
DateLivraison = DatePickerDateLivraison.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<BonLivraisonCltGestionList> ListBonLivraisonClts = new BonLivraisonCltDB().SearchBonLivraisonCltGestion(
|
||||
position,
|
||||
nbrligne,
|
||||
TextFieldIdBonLivrasionClt.getText(),
|
||||
DateLivraison,
|
||||
TextFieldCodeClt.getText(),
|
||||
TextFieldIdFactureClt.getText(),
|
||||
TextFieldTransporteur.getText(),
|
||||
TextFieldAdresseLivraison.getText());
|
||||
|
||||
TableViewBonLivraisonCltListGestion.setItems(ListBonLivraisonClts);
|
||||
|
||||
totalcount = new BonLivraisonCltDB().nbrSearchBonLivraisonCltGestion(TextFieldIdBonLivrasionClt.getText(), DateLivraison, TextFieldCodeClt.getText(), TextFieldIdFactureClt.getText(), TextFieldTransporteur.getText(), TextFieldAdresseLivraison.getText());
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchBonLivraisonClt.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarBonLivraisonClt.setVisible(false);
|
||||
ButtonSearchBonLivraisonClt.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchBonLivraisonClt.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchBonLivraisonClt(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarBonLivraisonClt.setVisible(true);
|
||||
|
||||
ButtonSearchBonLivraisonClt.setDisable(true);
|
||||
|
||||
ThreadSearchBonLivraisonClt = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateLivraison = "";
|
||||
if(DatePickerDateLivraison.getValue() != null){
|
||||
DateLivraison = DatePickerDateLivraison.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<BonLivraisonCltGestionList> ListBonLivraisonClts = new BonLivraisonCltDB().SearchBonLivraisonCltGestion(ParmPosition, ParamNbrligne, TextFieldIdBonLivrasionClt.getText(), DateLivraison, TextFieldCodeClt.getText(), TextFieldIdFactureClt.getText(), TextFieldTransporteur.getText(), TextFieldAdresseLivraison.getText());
|
||||
|
||||
TableViewBonLivraisonCltListGestion.setItems(ListBonLivraisonClts);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchBonLivraisonClt.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarBonLivraisonClt.setVisible(false);
|
||||
ButtonSearchBonLivraisonClt.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchBonLivraisonClt.start();
|
||||
}
|
||||
|
||||
private void GestionSearchBonLivraisonClt()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchBonLivraisonClt(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchBonLivraisonClt(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchBonLivraisonClt(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchBonLivraisonClt(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchBonLivraisonClt(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.BonLivraisonClt;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import static Controllers.Traitement.Adaptateur.StringToStringEspaceCurrency;
|
||||
import static Controllers.Traitement.Adaptateur.StringToStringEspace;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.BonLivraisonClt.BonLivraisonClt;
|
||||
import Models.Client.Client;
|
||||
import Models.Client.ClientEntreprise;
|
||||
import Models.Client.ClientPassager;
|
||||
import Models.Produit.ListeProduit;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Control;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class BonLivraisonCltPrintController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneTotal;
|
||||
|
||||
@FXML public ImageView ImageViewLogo;
|
||||
|
||||
@FXML private Text TextSteNom;
|
||||
@FXML private Text TextSteAdress;
|
||||
@FXML private Text TextSteTeleFax;
|
||||
@FXML private Text TextSteIFCR;
|
||||
@FXML private Text TextSteRIB;
|
||||
@FXML private Text TextSteEmailSite;
|
||||
|
||||
@FXML private Text TextNumBonLivraison;
|
||||
@FXML private Text TextDateBonLivraison;
|
||||
@FXML private Text TextNumCommande;
|
||||
|
||||
@FXML private Text TextCltNomPrenom;
|
||||
@FXML private Text TextCltTele;
|
||||
@FXML private Text TextCltAdress;
|
||||
|
||||
@FXML private TableView<ListeProduit> TableViewListeProduit ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColReference;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDesignation;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColQuantite ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColPrixHT;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColRemise;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTotalHT;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTVA;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTotalTTC;
|
||||
|
||||
|
||||
@FXML private Text TextTotalRemise;
|
||||
@FXML private Text TextTotalHT;
|
||||
@FXML private Text TextTotalTVA;
|
||||
@FXML private Text TexFraisTransport;
|
||||
@FXML private Text TextNetPayer;
|
||||
|
||||
@FXML private Text TextPagination;
|
||||
|
||||
contro clt = new contro();
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
setImageLogo();
|
||||
|
||||
TextSteNom.setText(ParametreSystem.CompanyName);
|
||||
TextSteAdress.setText(ParametreSystem.CompanyAddress);
|
||||
TextSteTeleFax.setText(ParametreSystem.CompanyTele+" | Fax: "+ParametreSystem.CompanyFax);
|
||||
TextSteIFCR.setText(ParametreSystem.CompanyIF+" | M.F: "+ParametreSystem.CompanyMF);
|
||||
TextSteRIB.setText(ParametreSystem.RIB);
|
||||
TextSteEmailSite.setText(ParametreSystem.CompanyMail+" | Site:"+ParametreSystem.CompanySite);
|
||||
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColReference.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColReference.getStyleClass().add("Center");
|
||||
|
||||
TabColDesignation.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
TabColDesignation.setCellFactory(new Callback<TableColumn<ListeProduit,String>,TableCell<ListeProduit,String>>(){
|
||||
@Override
|
||||
public TableCell<ListeProduit, String> call(TableColumn<ListeProduit, String> param) {
|
||||
TableCell<ListeProduit, String> cell = new TableCell<ListeProduit, String>(){
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
if (item == null) {
|
||||
super.setText(null);
|
||||
super.setGraphic(null);
|
||||
} else {
|
||||
String newItem = item.trim().toLowerCase();
|
||||
Text text = new Text(newItem);
|
||||
super.setPrefHeight(Control.USE_COMPUTED_SIZE);
|
||||
text.wrappingWidthProperty().bind(super.widthProperty());
|
||||
super.setGraphic(text);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColRemise.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColRemise.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColRemise.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColTotalTTC.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalTTC.getStyleClass().add("Center");
|
||||
|
||||
TabColReference.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColQuantite.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColRemise.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
}
|
||||
|
||||
public void setBonLivraisonClt(BonLivraisonClt BonLivraison, ObservableList<ListeProduit> ListProd, String Pagination, boolean PaneTotalVisible) {
|
||||
|
||||
TextNumBonLivraison.setText("N°"+BonLivraison.getIdBonLivrasionClt());
|
||||
TextNumCommande.setText(BonLivraison.getIdCommande());
|
||||
TextDateBonLivraison.setText(Adaptateur.NormalDateFormat(BonLivraison.getDateLivraisonPreveu()));
|
||||
|
||||
TextPagination.setText(Pagination);
|
||||
|
||||
String AdressClt = "";
|
||||
//0 Personne 1 Entreprise 2 Passager
|
||||
if(BonLivraison.getTypeClient() == 0){
|
||||
Client CltPersonne = BonLivraison.getCltPersonne();
|
||||
TextCltNomPrenom.setText(CltPersonne.getCodeclient()+" - "+CltPersonne.getPrenom()+" "+CltPersonne.getNom());
|
||||
AdressClt = CltPersonne.getAdresse();
|
||||
if( (!clt.isStringNull(CltPersonne.getTelemobileString())) && (!clt.isStringNull(CltPersonne.getTelefixString())) ) {
|
||||
TextCltTele.setText(CltPersonne.getTelemobile()+" | "+CltPersonne.getTelefix());
|
||||
}else if(!clt.isStringNull(CltPersonne.getTelemobileString())){
|
||||
TextCltTele.setText(CltPersonne.getTelemobileString());
|
||||
}else if(!clt.isStringNull(CltPersonne.getTelefixString())){
|
||||
TextCltTele.setText(CltPersonne.getTelefixString());
|
||||
}
|
||||
}else if(BonLivraison.getTypeClient() == 1){
|
||||
ClientEntreprise CltEntreprise = BonLivraison.getCltEntreprise();
|
||||
TextCltNomPrenom.setText(CltEntreprise.getCodeString()+" - "+CltEntreprise.getNom());
|
||||
TextCltTele.setText(CltEntreprise.getTele1()+" | "+CltEntreprise.getTele2());
|
||||
AdressClt = CltEntreprise.getAdresse();
|
||||
}else if(BonLivraison.getTypeClient() == 2){
|
||||
ClientPassager CltPassager = BonLivraison.getCltPassager();
|
||||
TextCltNomPrenom.setText(CltPassager.getCodeclient()+" - "+CltPassager.getNom()+" "+CltPassager.getPrenom());
|
||||
TextCltTele.setText(CltPassager.getTelemobile()+" | "+CltPassager.getTelefix());
|
||||
AdressClt = CltPassager.getAdresse();
|
||||
}
|
||||
|
||||
if(clt.isNumericNotnull(BonLivraison.getAdresseLivraison())){
|
||||
TextCltAdress.setText(BonLivraison.getAdresseLivraison());
|
||||
}else{
|
||||
TextCltAdress.setText(AdressClt);
|
||||
}
|
||||
|
||||
TextTotalHT.setText(StringToStringEspace(BonLivraison.getTotalHorsTaxNet()));
|
||||
TextTotalTVA.setText(StringToStringEspace(BonLivraison.getTotalTVA()));
|
||||
TextTotalRemise.setText(StringToStringEspace(BonLivraison.getRemise()));
|
||||
TexFraisTransport.setText(StringToStringEspace(BonLivraison.getFrais()));
|
||||
TextNetPayer.setText(StringToStringEspaceCurrency(BonLivraison.getNetAPayer()));
|
||||
|
||||
TableViewListeProduit.setItems(ListProd);
|
||||
|
||||
AnchorPaneTotal.setVisible(PaneTotalVisible);
|
||||
}
|
||||
|
||||
|
||||
private void setImageLogo()
|
||||
{
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
try {
|
||||
// optional, but recommended
|
||||
// process XML securely, avoid attacks like XML External Entities (XXE)
|
||||
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
|
||||
// parse XML file
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
|
||||
//PowerERP\conf\logo.xml
|
||||
Document doc = db.parse(new File("./conf/logo.xml"));
|
||||
|
||||
doc.getDocumentElement().normalize();
|
||||
|
||||
Element elementCNX = (Element) doc.getElementsByTagName("BonLivraisonCltPrint").item(0);
|
||||
|
||||
String pathLogo = elementCNX.getElementsByTagName("PathImage").item(0).getTextContent();
|
||||
FileInputStream fis = new FileInputStream(pathLogo);
|
||||
ImageViewLogo.setImage(new Image(fis));
|
||||
|
||||
ImageViewLogo.setFitWidth(Double.parseDouble(elementCNX.getElementsByTagName("FitWidth").item(0).getTextContent()));
|
||||
ImageViewLogo.setFitHeight(Double.parseDouble(elementCNX.getElementsByTagName("FitHeight").item(0).getTextContent()));
|
||||
ImageViewLogo.setLayoutX(Double.parseDouble(elementCNX.getElementsByTagName("LayoutX").item(0).getTextContent()));
|
||||
ImageViewLogo.setLayoutY(Double.parseDouble(elementCNX.getElementsByTagName("LayoutY").item(0).getTextContent()));
|
||||
}
|
||||
catch (ParserConfigurationException | SAXException | IOException e) {
|
||||
System.out.println("error AuthentificationController/setImageLogo "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,619 @@
|
||||
package Controllers.BonReceptionFrs;
|
||||
|
||||
import Controllers.CommandeClt.CommandeCltPasserController;
|
||||
import Controllers.Dialog.MessageControle;
|
||||
import Controllers.Produit.RechercherProduitController;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.BonReceptionFrs.BonReceptionDB;
|
||||
import Models.BonReceptionFrs.BonReceptionFrs;
|
||||
import Models.BonReceptionFrs.BonReceptionProduitList;
|
||||
import Models.Fournisseur.Fournisseur;
|
||||
import Models.Fournisseur.FournisseurDB;
|
||||
import Models.Produit.ListeProduit;
|
||||
import Models.Produit.Produit;
|
||||
import Models.Produit.ProduitDB;
|
||||
import Models.Stock.StockDB;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.ProgressIndicator;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
import org.controlsfx.control.textfield.TextFields;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class BonReceptionAjouterFrsController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(BonReceptionAjouterFrsController.class.getName());
|
||||
|
||||
@FXML public AnchorPane PaneBonReceptionAjouterFrs ;
|
||||
@FXML public Text NetAPayer ;
|
||||
@FXML public Button RechercheProduit ;
|
||||
@FXML public Button ButtonBonReceptionAjouter;
|
||||
|
||||
@FXML public TableView<ListeProduit> TableViewListeProduit ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColReference;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDesignaton;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColQuantite ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColPrixHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTotalHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTVA;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTotalTTC;
|
||||
@FXML public TableColumn<ListeProduit ,Boolean> TabColAddAction ;
|
||||
|
||||
@FXML public TextField TextFieldNumero ;
|
||||
@FXML public TextField TextFieldTransporteur ;
|
||||
@FXML public TextField TextFieldHeur ;
|
||||
@FXML private TextField TextFieldFournisseur ;
|
||||
@FXML public DatePicker DatePickerDateReception;
|
||||
|
||||
@FXML public ChoiceBox ChoiceBoxLocalReception ;
|
||||
|
||||
@FXML public Text TextNumero ;
|
||||
@FXML public Text TextHeur ;
|
||||
@FXML public Text TextDateReception;
|
||||
@FXML public Text TextFournisseur ;
|
||||
@FXML public Text TextLocalReception ;
|
||||
|
||||
@FXML public ProgressIndicator ProgressIndicatorSaveBonReception ;
|
||||
|
||||
public ObservableList<ListeProduit> data = FXCollections.observableArrayList();
|
||||
Produit produit= new Produit();
|
||||
ProduitDB produitDB= new ProduitDB();
|
||||
contro Controle = new contro();
|
||||
|
||||
public ArrayList<String> ListFournisseur = new ArrayList<>();
|
||||
public ArrayList<String> ListLocale = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
DatePickerDateReception.setValue(LocalDate.now());
|
||||
TextFieldHeur.setText(LocalDateTime.now().getHour()+":"+LocalDateTime.now().getMinute());
|
||||
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColDesignaton.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTotalTTC.getStyleClass().add("Center");
|
||||
|
||||
TabColReference.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColQuantite.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
|
||||
TabColAddAction.setSortable(true);
|
||||
TabColAddAction.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<ListeProduit, Boolean>,
|
||||
ObservableValue<Boolean>>() {
|
||||
@Override
|
||||
public ObservableValue<Boolean> call(TableColumn.CellDataFeatures<ListeProduit, Boolean> p) {
|
||||
return new SimpleBooleanProperty(p.getValue() != null);
|
||||
}
|
||||
});
|
||||
|
||||
// create a cell value factory with an add button for each row in the table.
|
||||
TabColAddAction.setCellFactory(new Callback<TableColumn<ListeProduit, Boolean>, TableCell<ListeProduit, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<ListeProduit, Boolean> call(TableColumn<ListeProduit, Boolean> personBooleanTableColumn) {
|
||||
return new BonReceptionAjouterFrsController.ButtonCell();
|
||||
}
|
||||
});
|
||||
TabColAddAction.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColAddAction.getStyleClass().add("Center");
|
||||
|
||||
StockDB Stock = new StockDB();
|
||||
ListLocale = Stock.getAllListLocal();
|
||||
ChoiceBoxLocalReception.getItems().addAll(ListLocale);
|
||||
|
||||
ListFournisseur = new FournisseurDB().getIdNomFournisseur();
|
||||
TextFields.bindAutoCompletion(TextFieldFournisseur, ListFournisseur);
|
||||
|
||||
this.ReferenceMouseClick();
|
||||
this.QantiteMouseClick();
|
||||
|
||||
|
||||
TabColAddAction.setSortable(true);
|
||||
TabColAddAction.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<ListeProduit, Boolean>,
|
||||
ObservableValue<Boolean>>() {
|
||||
@Override
|
||||
public ObservableValue<Boolean> call(TableColumn.CellDataFeatures<ListeProduit, Boolean> p) {
|
||||
return new SimpleBooleanProperty(p.getValue() != null);
|
||||
}
|
||||
});
|
||||
|
||||
// create a cell value factory with an add button for each row in the table.
|
||||
TabColAddAction.setCellFactory(new Callback<TableColumn<ListeProduit, Boolean>, TableCell<ListeProduit, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<ListeProduit, Boolean> call(TableColumn<ListeProduit, Boolean> personBooleanTableColumn) {
|
||||
return new BonReceptionAjouterFrsController.ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
TableViewListeProduit.setItems(data);
|
||||
|
||||
|
||||
//Ajouter une ligne vide clors ce que en click sur la tableview
|
||||
TableViewListeProduit.setOnMouseClicked(new EventHandler<javafx.scene.input.MouseEvent>(){
|
||||
public void handle(MouseEvent event){
|
||||
int nbrligne = TableViewListeProduit.getItems().size() ;
|
||||
if(nbrligne == 0){
|
||||
data.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduit.setItems(data);
|
||||
}
|
||||
else{
|
||||
ListeProduit Liste = TableViewListeProduit.getItems().get(nbrligne - 1);
|
||||
if(!Liste.getTotalTTC().isEmpty()){
|
||||
data.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduit.setItems(data);
|
||||
TableViewListeProduit.getSelectionModel().select(nbrligne);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ButtonBonReceptionAjouter.setOnAction(new EventHandler<ActionEvent>() { //supprimer le message du suucés et reaficher les formulaires
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
ButtonBonReceptionAjouter.setText("");
|
||||
ButtonBonReceptionAjouter.setDisable(true);
|
||||
ProgressIndicatorSaveBonReception.setVisible(true);
|
||||
if( Controle.ContrNull(TextFieldNumero, TextNumero) &&
|
||||
Controle.ContrNull(TextFieldFournisseur, TextFournisseur) &&
|
||||
Controle.ContrNullDatePicker(DatePickerDateReception, TextDateReception) &&
|
||||
Controle.ContrHour(TextFieldHeur, TextHeur) &&
|
||||
Controle.ContrNullValue(ChoiceBoxLocalReception, TextLocalReception)
|
||||
){
|
||||
|
||||
Runnable task = new Runnable(){// Create a Runnable
|
||||
public void run(){
|
||||
Platform.runLater(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
if(data.size()>0){
|
||||
BonReceptionDB BonRecepDB= new BonReceptionDB();
|
||||
String Numero = TextFieldNumero.getText();
|
||||
String IdFournisseur = TextFieldFournisseur.getText().split(" - ", -1)[0];
|
||||
String IdBonReception = BonRecepDB.getBonReceptionFrs(null, Numero, IdFournisseur).getIdBonReception();
|
||||
if(IdBonReception != null){
|
||||
TextFieldNumero.setStyle("-fx-border-color:#f20606;");
|
||||
TextNumero.setText("Bon réception existe déja");
|
||||
}else{
|
||||
BonReceptionFrs BonReception = setBonReceptionFrs();
|
||||
BonReception = BonRecepDB.setBonReceptionFrsDB(BonReception);
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/BonReceptionFrs/BonReceptionDetailFrs.fxml"));
|
||||
Parent ParentFxmlFournisseur = (Parent)fxmlLoader.load();
|
||||
|
||||
BonReceptionDetailFrsController BonReceptionDetailFrs = fxmlLoader.getController();
|
||||
BonReceptionDetailFrs.setDataBonReceptionDetailFrs(BonReception.getIdBonReception());
|
||||
BonReceptionDetailFrs.PaneSucessFrs.setVisible(true);
|
||||
PaneBonReceptionAjouterFrs.getChildren().clear();
|
||||
PaneBonReceptionAjouterFrs.getChildren().add(ParentFxmlFournisseur);
|
||||
|
||||
}catch (IOException ex) {
|
||||
logger.error("BonReceptionAjouterFrsController : BonReceptionDetailFrs.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}else{
|
||||
final MessageControle messagecontrol = new MessageControle();
|
||||
Text text3 = new Text();
|
||||
text3.setText("Vous devez ajouter au moin un produit à la liste des produits");
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 13));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
messagecontrol.ShowNotification();
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Thread backgroundThread = new Thread(task);// Run the task in a background thread
|
||||
backgroundThread.setDaemon(true);// Terminate the running thread if the application exits
|
||||
backgroundThread.start();// Start the thread
|
||||
}
|
||||
|
||||
ButtonBonReceptionAjouter.setText("Enregister La Bon de Réception");
|
||||
ButtonBonReceptionAjouter.setDisable(false);
|
||||
ProgressIndicatorSaveBonReception.setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void getBonReceptionFrs(BonReceptionFrs BonReception)
|
||||
{
|
||||
TextFieldNumero.setText(BonReception.getNumero());
|
||||
TextFieldHeur.setText(BonReception.getHeur());
|
||||
TextFieldTransporteur.setText(BonReception.getTransporteur());
|
||||
DatePickerDateReception.setValue(Adaptateur.StringToLocalDate(BonReception.getDate()));
|
||||
|
||||
|
||||
Fournisseur Frs = BonReception.getFournisseur();
|
||||
if(Frs != null){
|
||||
TextFieldFournisseur.setText(Frs.getCode()+" - "+Frs.getNom());
|
||||
}
|
||||
|
||||
String Local = BonReception.getLocal();
|
||||
if(Local != null){
|
||||
int indexLocale = ListLocale.indexOf(Local);
|
||||
ChoiceBoxLocalReception.getSelectionModel().select(indexLocale);
|
||||
}
|
||||
}
|
||||
|
||||
public BonReceptionFrs setBonReceptionFrs()
|
||||
{
|
||||
BonReceptionFrs BonReception = new BonReceptionFrs();
|
||||
|
||||
if(!TextFieldFournisseur.getText().equals("")){
|
||||
String[] Fournisseur = TextFieldFournisseur.getText().split(" - ", -1);
|
||||
Fournisseur Frs = new Fournisseur();
|
||||
Frs.setCode(Fournisseur[0]);
|
||||
Frs.setNom(Fournisseur[1]);
|
||||
BonReception.setFournisseur(Frs);
|
||||
}
|
||||
|
||||
|
||||
if(DatePickerDateReception.getValue() != null){
|
||||
BonReception.setDate(DatePickerDateReception.getValue().toString());
|
||||
}
|
||||
|
||||
if(ChoiceBoxLocalReception.getValue() != null){
|
||||
BonReception.setLocal(ChoiceBoxLocalReception.getValue().toString());
|
||||
}
|
||||
|
||||
BonReception.setHeur(TextFieldHeur.getText());
|
||||
|
||||
BonReception.setNumero(Adaptateur.addSlashes(TextFieldNumero.getText()));
|
||||
BonReception.setTransporteur(Adaptateur.addSlashes(TextFieldTransporteur.getText()));
|
||||
BonReception.setNetPayer(NetAPayer.getText());
|
||||
|
||||
ObservableList<BonReceptionProduitList> ObservableListBonReceptionFrs = FXCollections.observableArrayList();
|
||||
for(ListeProduit liste : data){
|
||||
if(!liste.getReference().equals("")){
|
||||
ObservableListBonReceptionFrs.add(new BonReceptionProduitList("", "", liste.getReference(), "", liste.getQuantite(), liste.getPrixHT(), liste.getTotalHT(), liste.getTVA(), liste.getTotalTTC()));
|
||||
}
|
||||
}
|
||||
BonReception.setListProduit(ObservableListBonReceptionFrs);
|
||||
|
||||
return BonReception;
|
||||
}
|
||||
|
||||
|
||||
//Define the button cell
|
||||
private class ButtonCell extends TableCell<ListeProduit, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-danger");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/icondelete.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
//Action when the button is pressed
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
int selectdIndex = getTableRow().getIndex();
|
||||
data.remove(selectdIndex);
|
||||
CalculeListeProduit();
|
||||
TableViewListeProduit.setStyle(".table-row-cell:selected{ -fx-background-color:transparent ;}");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
private void AddLigneButtonAction(ActionEvent event) throws IOException {
|
||||
int nbrligne = TableViewListeProduit.getItems().size() ;
|
||||
if(nbrligne == 0){
|
||||
data.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduit.setItems(data);
|
||||
}
|
||||
else{
|
||||
ListeProduit Liste = TableViewListeProduit.getItems().get(nbrligne - 1);
|
||||
if(!Liste.getTotalTTC().isEmpty()){
|
||||
data.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduit.setItems(data);
|
||||
TableViewListeProduit.getSelectionModel().select(nbrligne);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ReferenceMouseClick(){
|
||||
TabColReference.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ListeProduit, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ListeProduit, String> t) {
|
||||
produit = produitDB.getProduit(t.getNewValue());
|
||||
if(produit.getReference() != null){
|
||||
ListeProduit Liste = new ListeProduit(produit.getReference(),produit.getDesignation(),"1", produit.getPrixachatht(), "0", "", produit.getTvaachat(),"0");
|
||||
AffectationTableView(Liste,t.getTablePosition().getRow()) ;
|
||||
}
|
||||
else{
|
||||
AffectationTableView(new ListeProduit("","","","","","","",""),t.getTablePosition().getRow()) ;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void QantiteMouseClick(){
|
||||
TabColQuantite.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ListeProduit, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ListeProduit, String> t) {
|
||||
String newquantite = t.getNewValue() ;
|
||||
try{
|
||||
newquantite = newquantite.replace(',','.');
|
||||
if(Float.parseFloat(newquantite)<1){
|
||||
newquantite = "1";
|
||||
}
|
||||
}
|
||||
catch(NumberFormatException nfe){
|
||||
newquantite = "1";
|
||||
}
|
||||
|
||||
ListeProduit Liste = t.getRowValue() ;
|
||||
|
||||
if(Liste.getReference().isEmpty()){ //le cas en ajoute un quantité dans un ligne vide
|
||||
TableViewListeProduit.getColumns().get(t.getTablePosition().getRow()).setVisible(false);
|
||||
TableViewListeProduit.getColumns().get(t.getTablePosition().getRow()).setVisible(true);
|
||||
}
|
||||
else{
|
||||
Liste.setQuantite(newquantite);
|
||||
ListeProduit NewList = new ListeProduit(Liste.getReference(),Liste.getDesignation(), newquantite,Liste.getPrixHT(), Liste.getRemise(),"",Liste.getTVA(),"");
|
||||
//NewList = CalculeProduit(NewList);
|
||||
AffectationTableView(NewList,t.getTablePosition().getRow()) ;
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void AffectationTableView(ListeProduit ListeProd, int EmplacementLigne){
|
||||
boolean result = false ;
|
||||
int indise=0;
|
||||
int Position = 0;
|
||||
|
||||
if(data.size()>0){
|
||||
do{ //Vérifier si le produit exsiste deja
|
||||
if(data.get(indise).getReference().equals(ListeProd.getReference())){
|
||||
result = true ;
|
||||
Position = indise ;
|
||||
//System.out.println("existe Position:"+indise);
|
||||
}
|
||||
indise++;
|
||||
}while(data.size()>indise && !result);
|
||||
|
||||
if(result){ //si la ligne exsite déja
|
||||
if(EmplacementLigne!= -1){
|
||||
if(Position == EmplacementLigne){
|
||||
data.set(Position, ListeProd);
|
||||
}
|
||||
else{
|
||||
data.set(EmplacementLigne, new ListeProduit("","","","","","","",""));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(EmplacementLigne!= -1){
|
||||
data.set(EmplacementLigne, ListeProd);
|
||||
}else{
|
||||
data.add(ListeProd);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
data.add(ListeProd);
|
||||
}
|
||||
|
||||
CalculeListeProduit();
|
||||
|
||||
TableViewListeProduit.setItems(data);
|
||||
TableViewListeProduit.setVisible(false);
|
||||
TableViewListeProduit.setVisible(true);
|
||||
}
|
||||
|
||||
private void CalculeListeProduit(){ //calculer et afficher la détail des produits
|
||||
float netaPayer = 0;
|
||||
float Remises = 0;
|
||||
float totalTVA = 0;
|
||||
float total_H_T_Net= 0;
|
||||
NetAPayer.setText("");
|
||||
|
||||
//calcule
|
||||
for(ListeProduit liste : data){
|
||||
float totaht = Adaptateur.StringToFloat(liste.getTotalHT()) ;
|
||||
float prix_U_H_T = Adaptateur.StringToFloat(liste.getPrixHT()) ;
|
||||
float remises = Adaptateur.StringToFloat(liste.getRemise().replace("%", "")) ;
|
||||
float tva = Adaptateur.StringToFloat(liste.getTVA().replace("%", ""));
|
||||
float qte = Adaptateur.StringToFloat(liste.getQuantite());
|
||||
|
||||
totalTVA = totalTVA + ((totaht * tva) /100) ;
|
||||
Remises = Remises + (prix_U_H_T * remises)/100 ;
|
||||
total_H_T_Net = total_H_T_Net + totaht ;
|
||||
}
|
||||
|
||||
if(total_H_T_Net>0){
|
||||
netaPayer = total_H_T_Net + totalTVA;
|
||||
NetAPayer.setText(Adaptateur.ArrondFloatToString(netaPayer));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Object[] getDefaultSaveDataImport(){
|
||||
Object[] ArrayObject = new Object[10];
|
||||
ArrayObject[0] = this.data;
|
||||
ArrayObject[1] = setBonReceptionFrs();
|
||||
return ArrayObject;
|
||||
}
|
||||
|
||||
public void SetDefaultSaveDataImport(Object[] ArrayObject){
|
||||
if(ArrayObject[0] != null){
|
||||
this.data = (ObservableList<ListeProduit>) ArrayObject[0];
|
||||
this.CalculeListeProduit();
|
||||
this.TableViewListeProduit.setItems(data);
|
||||
}
|
||||
if(ArrayObject[1] != null){
|
||||
BonReceptionFrs BonReception = (BonReceptionFrs) ArrayObject[1];
|
||||
getBonReceptionFrs(BonReception);
|
||||
}
|
||||
if(ArrayObject[6] != null){
|
||||
this.SetProduit( (Produit) ArrayObject[6] );
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void RechercheProduitButtonAction(ActionEvent event) throws IOException {
|
||||
|
||||
final RechercherProduitController rechercheproduit = new RechercherProduitController(false);
|
||||
|
||||
rechercheproduit.ArrayObjectDataSave = this.getDefaultSaveDataImport();
|
||||
|
||||
rechercheproduit.Show();
|
||||
|
||||
rechercheproduit.TabColAction.setCellFactory(new Callback<TableColumn<Produit, String>, TableCell<Produit, String>>() {
|
||||
@Override
|
||||
public TableCell<Produit, String> call(TableColumn<Produit, String> paramP) {
|
||||
return new TableCell<Produit, String>() {
|
||||
final Button cellButton = new Button("");
|
||||
{
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconaffecter.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent arg0) {
|
||||
try {
|
||||
// get Selected ItemButtonCell
|
||||
rechercheproduit.ArrayObjectDataSave[6] = ((Produit)getTableRow().getItem());
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/BonReceptionFrs/BonReceptionAjouterFrs.fxml"));
|
||||
Parent ParentBonReceptionAjouterFXML = (Parent) fxmlLoader.load();
|
||||
|
||||
BonReceptionAjouterFrsController BonReceptionAjouterFrs = fxmlLoader.getController();
|
||||
|
||||
|
||||
BonReceptionAjouterFrs.SetDefaultSaveDataImport(rechercheproduit.ArrayObjectDataSave);
|
||||
|
||||
|
||||
MyWindow mywindows = new MyWindow();
|
||||
mywindows.Refresh(ParentBonReceptionAjouterFXML, 2);
|
||||
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.error("CommandeCltPasserController : RechercheProduitButtonAction : BonReceptionAjouterFrs.fxml : " + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected void updateItem(String paramT, boolean isEmpty) {
|
||||
super.updateItem(paramT, isEmpty);
|
||||
if (!isEmpty) {
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void SetProduit(Produit produit){
|
||||
|
||||
//Supprimer les igne vide
|
||||
if((data.size()>0) && (data.get(data.size()-1).getReference().isEmpty())){
|
||||
data.remove(data.size()-1);
|
||||
}
|
||||
|
||||
if(produit != null){
|
||||
ListeProduit ListeProd = new ListeProduit(produit.getReference(),produit.getDesignation(),"1",produit.getPrixachatht(),"0",produit.getPrixachatttc(),produit.getTvaachat(),"0");
|
||||
AffectationTableView(ListeProd,-1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
package Controllers.BonReceptionFrs;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Models.BonReceptionFrs.BonReceptionDB;
|
||||
import Models.BonReceptionFrs.BonReceptionFrs;
|
||||
import Models.BonReceptionFrs.BonReceptionProduitList;
|
||||
import Models.Fournisseur.Fournisseur;
|
||||
import Models.User.Profile;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class BonReceptionDetailFrsController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane PaneBonReceptionDetailFrs ;
|
||||
|
||||
@FXML public AnchorPane PaneSucessFrs ;
|
||||
|
||||
@FXML public AnchorPane AnchorPaneDetailInformation;
|
||||
|
||||
@FXML private AnchorPane AnchorPaneLoading;
|
||||
|
||||
@FXML private Text TextNumero;
|
||||
@FXML private Text TextDateReception;
|
||||
@FXML private Text TextHeurReception;
|
||||
@FXML private Text TextLocalReception;
|
||||
@FXML private Text TextTransporteur;
|
||||
@FXML private Text TextProfile;
|
||||
@FXML private Text TextNomFrs;
|
||||
@FXML private Text TextSpecialiteFrs;
|
||||
@FXML private Text TextFormesFrs;
|
||||
@FXML private Text TextAdresseFrs;
|
||||
@FXML private Text TextTele1Frs;
|
||||
@FXML private Text TextTele2Frs;
|
||||
@FXML private Text TextNetPayer;
|
||||
|
||||
@FXML public TableView<BonReceptionProduitList> TableViewListeProduit ;
|
||||
@FXML public TableColumn<BonReceptionProduitList ,String> TabColReference;
|
||||
@FXML public TableColumn<BonReceptionProduitList ,String> TabColDesignation;
|
||||
@FXML public TableColumn<BonReceptionProduitList ,String> TabColQuantite ;
|
||||
@FXML public TableColumn<BonReceptionProduitList ,String> TabColPrixHT;
|
||||
@FXML public TableColumn<BonReceptionProduitList ,String> TabColTotalHT;
|
||||
@FXML public TableColumn<BonReceptionProduitList ,String> TabColTVA;
|
||||
@FXML public TableColumn<BonReceptionProduitList ,String> TabColTotalTTC;
|
||||
|
||||
private Service<Void> ThreadBonReceptionDetailFrs;
|
||||
|
||||
BonReceptionFrs BonReception;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<BonReceptionProduitList, String>("reference"));
|
||||
TabColDesignation.setCellValueFactory(new PropertyValueFactory<BonReceptionProduitList, String>("designation"));
|
||||
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<BonReceptionProduitList, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixHT.setCellValueFactory(new PropertyValueFactory<BonReceptionProduitList, String>("PrixUnitaireHorsTaxe"));
|
||||
TabColPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalHT.setCellValueFactory(new PropertyValueFactory<BonReceptionProduitList, String>("PrixUnitaireHorsTaxenNet"));
|
||||
TabColTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTVA.setCellValueFactory(new PropertyValueFactory<BonReceptionProduitList, String>("Tva"));
|
||||
TabColTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalTTC.setCellValueFactory(new PropertyValueFactory<BonReceptionProduitList, String>("Montant"));
|
||||
TabColTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTotalTTC.getStyleClass().add("Center");
|
||||
}
|
||||
|
||||
|
||||
public void setDataBonReceptionDetailFrs(final String IdBonReceptionFrs){
|
||||
ThreadBonReceptionDetailFrs = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
BonReception = new BonReceptionDB().getBonReceptionFrs(IdBonReceptionFrs, null, null);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadBonReceptionDetailFrs.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
TextNumero.setText(BonReception.getNumero());
|
||||
TextDateReception.setText(BonReception.getDate());
|
||||
TextHeurReception.setText(BonReception.getHeur());
|
||||
TextLocalReception.setText(BonReception.getLocal());
|
||||
TextTransporteur.setText(BonReception.getTransporteur());
|
||||
|
||||
Profile profile = BonReception.getProfile();
|
||||
TextProfile.setText(profile.getNom()+" "+profile.getPrenom());
|
||||
|
||||
Fournisseur Frs = BonReception.getFournisseur();
|
||||
TextNomFrs.setText(Frs.getNom());
|
||||
TextSpecialiteFrs.setText(Frs.getSpecialite());
|
||||
TextFormesFrs.setText(Frs.getFormes());
|
||||
TextAdresseFrs.setText(Frs.getAdresse());
|
||||
TextTele1Frs.setText(Frs.getTele1());
|
||||
TextTele2Frs.setText(Frs.getTele2());
|
||||
ObservableList<BonReceptionProduitList> BRProduitList = BonReception.getListProduit();
|
||||
float NetPayer = 0;
|
||||
for(int i=0; i<BRProduitList.size(); i++){
|
||||
String TTC = BRProduitList.get(i).getMontant();
|
||||
NetPayer += Adaptateur.StringToFloat(TTC);
|
||||
}
|
||||
TextNetPayer.setText(Adaptateur.FloatToStringEspaceCurrency(NetPayer));
|
||||
|
||||
TableViewListeProduit.setItems(BRProduitList);
|
||||
|
||||
PaneBonReceptionDetailFrs.setVisible(true);
|
||||
AnchorPaneLoading.setVisible(false);
|
||||
}
|
||||
});
|
||||
ThreadBonReceptionDetailFrs.start();
|
||||
}
|
||||
|
||||
public void setContainsDetailInformation()
|
||||
{
|
||||
AnchorPane.setTopAnchor(AnchorPaneDetailInformation, 15.0);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,480 @@
|
||||
package Controllers.BonReceptionFrs;
|
||||
|
||||
import Models.BonReceptionFrs.BonReceptionGestionDB;
|
||||
import Models.BonReceptionFrs.BonReceptionGestionList;
|
||||
import Models.Fournisseur.FournisseurDB;
|
||||
import Models.Stock.StockDB;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.controlsfx.control.textfield.TextFields;
|
||||
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class BonReceptionGestionFrsController implements Initializable {
|
||||
|
||||
@FXML public AnchorPane PaneBonReceptionGestion ;
|
||||
|
||||
@FXML private ProgressBar ProgressBarBonReceptionFrs;
|
||||
|
||||
@FXML public TableView<BonReceptionGestionList> TableViewBonReceptionGestion;
|
||||
@FXML public TableColumn<BonReceptionGestionList ,String> TabColNumero;
|
||||
@FXML public TableColumn<BonReceptionGestionList ,String> TabColFournisseur;
|
||||
@FXML public TableColumn<BonReceptionGestionList ,String> TabColDate;
|
||||
@FXML public TableColumn<BonReceptionGestionList ,String> TabColHeur;
|
||||
@FXML public TableColumn<BonReceptionGestionList ,String> TabColLocalReception;
|
||||
@FXML public TableColumn<BonReceptionGestionList ,String> TabColTransporteur;
|
||||
@FXML public TableColumn<BonReceptionGestionList ,String> TabColFacture;
|
||||
@FXML public TableColumn<BonReceptionGestionList ,Boolean> TabColDetail;
|
||||
|
||||
@FXML public TextField TextFieldNumero ;
|
||||
@FXML public TextField TextFieldTransporteur ;
|
||||
@FXML public TextField TextFieldFacture ;
|
||||
@FXML public DatePicker DatePickerDateReception;
|
||||
@FXML private TextField TextFieldFournisseur;
|
||||
@FXML public ChoiceBox ChoiceBoxLocalReception ;
|
||||
|
||||
@FXML public AnchorPane PaneProgressBonReception;
|
||||
|
||||
@FXML private Button ButtonSearchBonReceptionFrs;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount ;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
private Service<Void> ThreadSearchBonReceptionGestionFrs;
|
||||
|
||||
public static ArrayList<String> ListFournisseur = new ArrayList<>();
|
||||
public static ArrayList<String> ListLocale = new ArrayList<>();
|
||||
|
||||
String LocalReception = "";
|
||||
String IdFournisseur = "";
|
||||
|
||||
Logger logger = Logger.getLogger(BonReceptionGestionFrsController.class.getName());
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
TabColNumero.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColNumero.getStyleClass().add("Center");
|
||||
TabColNumero.setCellValueFactory(new PropertyValueFactory<BonReceptionGestionList, String>("Numero"));
|
||||
|
||||
TabColFournisseur.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColFournisseur.getStyleClass().add("Center");
|
||||
TabColFournisseur.setCellValueFactory(new PropertyValueFactory<BonReceptionGestionList, String>("Fournisseur"));
|
||||
|
||||
TabColDate.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDate.getStyleClass().add("Center");
|
||||
TabColDate.setCellValueFactory(new PropertyValueFactory<BonReceptionGestionList, String>("Date"));
|
||||
|
||||
TabColHeur.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColHeur.getStyleClass().add("Center");
|
||||
TabColHeur.setCellValueFactory(new PropertyValueFactory<BonReceptionGestionList, String>("Heur"));
|
||||
|
||||
TabColLocalReception.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColLocalReception.getStyleClass().add("Center");
|
||||
TabColLocalReception.setCellValueFactory(new PropertyValueFactory<BonReceptionGestionList, String>("LocalReception"));
|
||||
|
||||
TabColTransporteur.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTransporteur.getStyleClass().add("Center");
|
||||
TabColTransporteur.setCellValueFactory(new PropertyValueFactory<BonReceptionGestionList, String>("Transporteur"));
|
||||
|
||||
TabColFacture.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColFacture.getStyleClass().add("Center");
|
||||
TabColFacture.setCellValueFactory(new PropertyValueFactory<BonReceptionGestionList, String>("Facture"));
|
||||
|
||||
TabColDetail.setStyle( "-fx-alignment: CENTER;");TabColDetail.getStyleClass().add("Center");
|
||||
TabColDetail.setCellFactory(new Callback<TableColumn<BonReceptionGestionList, Boolean>, TableCell<BonReceptionGestionList, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<BonReceptionGestionList, Boolean> call(TableColumn<BonReceptionGestionList, Boolean> personBooleanTableColumn) {
|
||||
return new ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
setDefaultFormData();
|
||||
|
||||
ChoiceBoxLocalReception.valueProperty().addListener(new ChangeListener<String>() {
|
||||
@Override
|
||||
public void changed(ObservableValue ov, String t, String ValLocal) {
|
||||
LocalReception = ValLocal;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
TextFieldFournisseur.textProperty().addListener(new ChangeListener<String>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
||||
if(newValue.contains(" - ")){
|
||||
String[] array = newValue.split(" - ", -1);
|
||||
IdFournisseur = array[0];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ButtonSearchBonReceptionFrs.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchBonReceptionGestionFrs();
|
||||
}
|
||||
});
|
||||
|
||||
PaneBonReceptionGestion.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchBonReceptionGestionFrs();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
GestionSearchBonReceptionFrs();
|
||||
|
||||
SearchBonReceptionGestionFrs();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private class ButtonCell extends TableCell<BonReceptionGestionList, Boolean> {
|
||||
final Button cellButton = new Button();
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/detailbutton.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){ //Action when the button is pressed
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
try {
|
||||
BonReceptionGestionList BonReceptionGestion = (BonReceptionGestionList)getTableRow().getItem();
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/BonReceptionFrs/BonReceptionDetailFrs.fxml"));
|
||||
Parent ParentFxmlFournisseur = (Parent)fxmlLoader.load();
|
||||
BonReceptionDetailFrsController BonReceptionDetailFrs = fxmlLoader.getController();
|
||||
BonReceptionDetailFrs.setDataBonReceptionDetailFrs(BonReceptionGestion.getCode());
|
||||
PaneBonReceptionGestion.getChildren().clear();
|
||||
PaneBonReceptionGestion.getChildren().add(ParentFxmlFournisseur);
|
||||
BonReceptionDetailFrs.setContainsDetailInformation();
|
||||
}catch (IOException ex) {
|
||||
logger.error(ex.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void BonReceptionAjouterFrsButtonAction(ActionEvent event) throws IOException {
|
||||
PaneBonReceptionGestion.getChildren().clear();
|
||||
PaneBonReceptionGestion.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/BonReceptionFrs/BonReceptionAjouterFrs.fxml")));
|
||||
}
|
||||
|
||||
|
||||
private void setDefaultFormData()
|
||||
{
|
||||
ProgressBarBonReceptionFrs.setVisible(true);
|
||||
|
||||
ThreadSearchBonReceptionGestionFrs = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
try{
|
||||
ListFournisseur = new FournisseurDB().getIdNomFournisseur();
|
||||
TextFields.bindAutoCompletion(TextFieldFournisseur, ListFournisseur);
|
||||
|
||||
ListLocale = new StockDB().getAllListLocal();
|
||||
ChoiceBoxLocalReception.getItems().addAll(ListLocale);
|
||||
}catch (Exception ex) {
|
||||
logger.error(ex.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadSearchBonReceptionGestionFrs.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarBonReceptionFrs.setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
ThreadSearchBonReceptionGestionFrs.setOnFailed(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
logger.error(ThreadSearchBonReceptionGestionFrs.getException());
|
||||
}
|
||||
});
|
||||
|
||||
ThreadSearchBonReceptionGestionFrs.start();
|
||||
}
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchBonReceptionGestionFrs()
|
||||
{
|
||||
ProgressBarBonReceptionFrs.setVisible(true);
|
||||
|
||||
ButtonSearchBonReceptionFrs.setDisable(true);
|
||||
|
||||
ThreadSearchBonReceptionGestionFrs = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DateReception = "";
|
||||
if(DatePickerDateReception.getValue() != null){
|
||||
DateReception = DatePickerDateReception.getValue().toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
ObservableList<BonReceptionGestionList> ListBonReceptionGestionFrs = new BonReceptionGestionDB().SearchBonReceptionGestionFrs(
|
||||
position,
|
||||
nbrligne,
|
||||
TextFieldNumero.getText(),
|
||||
TextFieldTransporteur.getText(),
|
||||
TextFieldFacture.getText(),
|
||||
DateReception,
|
||||
IdFournisseur,
|
||||
LocalReception);
|
||||
|
||||
TableViewBonReceptionGestion.setItems(ListBonReceptionGestionFrs);
|
||||
|
||||
totalcount = new BonReceptionGestionDB().nbrBonReceptionGestionFrsGestion(TextFieldNumero.getText(), TextFieldTransporteur.getText(), TextFieldFacture.getText(), DateReception, IdFournisseur, LocalReception);
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchBonReceptionGestionFrs.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarBonReceptionFrs.setVisible(false);
|
||||
ButtonSearchBonReceptionFrs.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchBonReceptionGestionFrs.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchBonReceptionGestionFrs(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarBonReceptionFrs.setVisible(true);
|
||||
|
||||
ButtonSearchBonReceptionFrs.setDisable(true);
|
||||
|
||||
ThreadSearchBonReceptionGestionFrs = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateReception = "";
|
||||
if(DatePickerDateReception.getValue() != null){
|
||||
DateReception = DatePickerDateReception.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<BonReceptionGestionList> ListBonReceptionGestionFrss = new BonReceptionGestionDB().SearchBonReceptionGestionFrs(ParmPosition, ParamNbrligne, TextFieldNumero.getText(), TextFieldTransporteur.getText(), TextFieldFacture.getText(), DateReception, IdFournisseur, LocalReception);
|
||||
|
||||
TableViewBonReceptionGestion.setItems(ListBonReceptionGestionFrss);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchBonReceptionGestionFrs.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarBonReceptionFrs.setVisible(false);
|
||||
ButtonSearchBonReceptionFrs.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchBonReceptionGestionFrs.start();
|
||||
}
|
||||
|
||||
private void GestionSearchBonReceptionFrs()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchBonReceptionGestionFrs(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchBonReceptionGestionFrs(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchBonReceptionGestionFrs(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchBonReceptionGestionFrs(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchBonReceptionGestionFrs(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
458
src/main/java/Controllers/Caisse/CaisseEntreController.java
Normal file
458
src/main/java/Controllers/Caisse/CaisseEntreController.java
Normal file
@@ -0,0 +1,458 @@
|
||||
package Controllers.Caisse;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.Caisse.CaisseDB;
|
||||
import Models.Caisse.CaisseEntreListe;
|
||||
import Models.Caisse.CaisseListe;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.print.PageLayout;
|
||||
import javafx.print.PageOrientation;
|
||||
import javafx.print.PageRange;
|
||||
import javafx.print.Paper;
|
||||
import javafx.print.Printer;
|
||||
import javafx.print.PrinterJob;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class CaisseEntreController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(CaisseEntreController.class.getName());
|
||||
|
||||
@FXML private AnchorPane AnchorPaneCaisseClt;
|
||||
|
||||
@FXML private ProgressBar ProgressBarCaisseEnterClt;
|
||||
|
||||
@FXML private DatePicker DatePickerDebut;
|
||||
@FXML private DatePicker DatePickerFin;
|
||||
|
||||
@FXML private Text TotalEnter;
|
||||
|
||||
@FXML private CheckBox CheckBoxChequeClt;
|
||||
@FXML private CheckBox CheckBoxEspace;
|
||||
@FXML private CheckBox CheckBoxCarteBancaire;
|
||||
|
||||
@FXML private CheckBox CheckBoxPaiementTraite ;
|
||||
@FXML private CheckBox CheckBoxVenteComptant ;
|
||||
@FXML private CheckBox CheckBoxVenteCommandeAvance ;
|
||||
@FXML private CheckBox CheckBoxVenteFaciliteAvance ;
|
||||
@FXML private CheckBox CheckBoxVersementCheque ; //l’encaissement
|
||||
|
||||
@FXML public TableView<CaisseListe> TableViewCaisseCltEnter ;
|
||||
|
||||
@FXML private TableColumn<CaisseListe ,String> TabColChequeClt;
|
||||
@FXML private TableColumn<CaisseListe ,String> TabColEspace;
|
||||
@FXML private TableColumn<CaisseListe ,String> TabColCarteBancaire;
|
||||
|
||||
@FXML private TableColumn<CaisseListe ,String> TabColIdCaisse;
|
||||
@FXML private TableColumn<CaisseListe ,String> TabColType;
|
||||
@FXML private TableColumn<CaisseListe ,String> TabColDate;
|
||||
@FXML private TableColumn<CaisseListe ,String> TabColMontant;
|
||||
@FXML private TableColumn<CaisseListe ,String> TabColChequeCltNumero;
|
||||
@FXML private TableColumn<CaisseListe ,String> TabColChequeCltBanque;
|
||||
@FXML private TableColumn<CaisseListe ,String> TabColEspaceNom;
|
||||
@FXML private TableColumn<CaisseListe ,String> TabColEspacePrenom;
|
||||
@FXML private TableColumn<CaisseListe ,String> TabColCateBancaireNumero;
|
||||
@FXML private TableColumn<CaisseListe ,String> TabColCateBancaireBanque;
|
||||
|
||||
@FXML private Button ButtonEnter;
|
||||
@FXML private Button ButtonPrintCaisseEntre;
|
||||
|
||||
private Service<Void> ThreadCaisseEnter;
|
||||
|
||||
CaisseDB CaisseDB= new CaisseDB();
|
||||
|
||||
ObservableList<CaisseListe> ObsListCaisseCltEnter;
|
||||
ObservableList<CaisseListe> TempoObsListCaisseCltEnter;
|
||||
private String DateDebut ;
|
||||
private String DateFin;
|
||||
|
||||
contro clt = new contro();
|
||||
|
||||
public void getDetailEnterCheck()
|
||||
{
|
||||
TempoObsListCaisseCltEnter = FXCollections.observableArrayList();
|
||||
|
||||
boolean CheckChequeClt = CheckBoxChequeClt.isSelected();
|
||||
boolean CheckEspace = CheckBoxEspace.isSelected();
|
||||
boolean CheckCarteBancaire= CheckBoxCarteBancaire.isSelected();
|
||||
|
||||
boolean CheckPaiementTraite = CheckBoxPaiementTraite.isSelected();
|
||||
boolean CheckVenteComptant = CheckBoxVenteComptant.isSelected();
|
||||
boolean CheckVenteCommandeAvance = CheckBoxVenteCommandeAvance.isSelected();
|
||||
boolean CheckVenteFaciliteAvance = CheckBoxVenteFaciliteAvance.isSelected();
|
||||
boolean CheckVersementCheque = CheckBoxVersementCheque.isSelected();
|
||||
|
||||
boolean SelectedCheck;
|
||||
boolean SelectedCheckEspace;
|
||||
boolean SelectedCheckChequeClt;
|
||||
boolean SelectedCheckCarteBancaire;
|
||||
|
||||
float FloatTotalEnter = 0;
|
||||
|
||||
// 0-Vente Comptant | 1-Vente Facilité Avance | 2 Vente Commande Avance | 3 traite clt | 4 ChequeClt
|
||||
if(ObsListCaisseCltEnter.size()>0){
|
||||
int indice = 0;
|
||||
while(indice<ObsListCaisseCltEnter.size()){
|
||||
|
||||
CaisseListe ListCaisseCltEnter = ObsListCaisseCltEnter.get(indice);
|
||||
|
||||
SelectedCheck = false;
|
||||
SelectedCheckEspace = false;
|
||||
SelectedCheckChequeClt = false;
|
||||
SelectedCheckCarteBancaire = false;
|
||||
|
||||
//Paiement Espace
|
||||
if(CheckEspace && ( (ListCaisseCltEnter.getEspaceNom()!= "") || (ListCaisseCltEnter.getEspacePrenom()!= "")) ){
|
||||
SelectedCheckEspace = true;
|
||||
}
|
||||
|
||||
//Paiement Chèque
|
||||
if(CheckChequeClt && ( (ListCaisseCltEnter.getChequeCltBanque()!= "") || (ListCaisseCltEnter.getChequeCltNumero()!= "")) ){
|
||||
SelectedCheckChequeClt = true;
|
||||
}
|
||||
|
||||
//Paiement Carte Bancaire
|
||||
if(CheckCarteBancaire && ( (ListCaisseCltEnter.getCateBancaireBanque()!= "") || (ListCaisseCltEnter.getCateBancaireNumero()!= "")) ){
|
||||
SelectedCheckCarteBancaire = true;
|
||||
}
|
||||
|
||||
//0-Vente Comptant
|
||||
if(CheckVenteComptant && (ListCaisseCltEnter.getCodeType().equals("0")) && (SelectedCheckEspace || SelectedCheckChequeClt || SelectedCheckCarteBancaire) ){
|
||||
SelectedCheck = true;
|
||||
}
|
||||
|
||||
//1-Vente Facilité Avance
|
||||
if(CheckVenteFaciliteAvance && (ListCaisseCltEnter.getCodeType().equals("1")) && (SelectedCheckEspace || SelectedCheckChequeClt || SelectedCheckCarteBancaire) ){ SelectedCheck = true; }
|
||||
|
||||
//2 Vente Commande Avance
|
||||
if(CheckVenteCommandeAvance && (ListCaisseCltEnter.getCodeType().equals("2")) && (SelectedCheckEspace || SelectedCheckChequeClt || SelectedCheckCarteBancaire) ){ SelectedCheck = true; }
|
||||
|
||||
//3 traite clt
|
||||
if(CheckPaiementTraite && (ListCaisseCltEnter.getCodeType().equals("3")) && (SelectedCheckEspace || SelectedCheckChequeClt || SelectedCheckCarteBancaire) ){ SelectedCheck = true; }
|
||||
|
||||
//4 ChequeClt
|
||||
if(CheckVersementCheque && (ListCaisseCltEnter.getCodeType().equals("4")) && (SelectedCheckEspace || SelectedCheckChequeClt || SelectedCheckCarteBancaire) ){ SelectedCheck = true; }
|
||||
|
||||
//5 Vente Sans Facture
|
||||
if(CheckVenteComptant && (ListCaisseCltEnter.getCodeType().equals("5")) && (SelectedCheckEspace || SelectedCheckChequeClt || SelectedCheckCarteBancaire) ){ SelectedCheck = true; }
|
||||
|
||||
if(SelectedCheck){
|
||||
FloatTotalEnter += ListCaisseCltEnter.getFloatMontant();
|
||||
TempoObsListCaisseCltEnter.add(ListCaisseCltEnter);
|
||||
}
|
||||
|
||||
indice++;
|
||||
}
|
||||
TableViewCaisseCltEnter.setItems(TempoObsListCaisseCltEnter);
|
||||
TotalEnter.setText(Adaptateur.FloatToStringEspaceCurrency(FloatTotalEnter));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
DatePickerDebut.setValue(LocalDate.now());
|
||||
DatePickerFin.setValue(LocalDate.now());
|
||||
|
||||
DateDebut = DatePickerDebut.getValue().toString();
|
||||
DateFin = DatePickerFin.getValue().toString();
|
||||
|
||||
TabColChequeClt.setStyle( "-fx-alignment: CENTER;");TabColChequeClt.getStyleClass().add("Center");
|
||||
TabColEspace.setStyle( "-fx-alignment: CENTER;");TabColEspace.getStyleClass().add("Center");
|
||||
TabColCarteBancaire.setStyle( "-fx-alignment: CENTER;");TabColCarteBancaire.getStyleClass().add("Center");
|
||||
|
||||
TabColIdCaisse.setStyle( "-fx-alignment: CENTER;");TabColIdCaisse.getStyleClass().add("Center");
|
||||
TabColIdCaisse.setCellValueFactory(new PropertyValueFactory<CaisseListe, String>("IdCaisseClt"));
|
||||
|
||||
TabColType.setStyle( "-fx-alignment: CENTER;");TabColType.getStyleClass().add("Center");
|
||||
TabColType.setCellValueFactory(new PropertyValueFactory<CaisseListe, String>("Type"));
|
||||
|
||||
TabColDate.setStyle( "-fx-alignment: CENTER;");TabColDate.getStyleClass().add("Center");
|
||||
TabColDate.setCellValueFactory(new PropertyValueFactory<CaisseListe, String>("Date"));
|
||||
|
||||
TabColMontant.setStyle( "-fx-alignment: CENTER;");TabColMontant.getStyleClass().add("Center");
|
||||
TabColMontant.setCellValueFactory(new PropertyValueFactory<CaisseListe, String>("Montant"));
|
||||
|
||||
TabColChequeCltNumero.setStyle( "-fx-alignment: CENTER;");TabColChequeCltNumero.getStyleClass().add("Center");
|
||||
TabColChequeCltNumero.setCellValueFactory(new PropertyValueFactory<CaisseListe, String>("ChequeCltNumero"));
|
||||
|
||||
TabColChequeCltBanque.setStyle( "-fx-alignment: CENTER;");TabColChequeCltBanque.getStyleClass().add("Center");
|
||||
TabColChequeCltBanque.setCellValueFactory(new PropertyValueFactory<CaisseListe, String>("ChequeCltBanque"));
|
||||
|
||||
TabColEspaceNom.setStyle( "-fx-alignment: CENTER;");TabColEspaceNom.getStyleClass().add("Center");
|
||||
TabColEspaceNom.setCellValueFactory(new PropertyValueFactory<CaisseListe, String>("EspaceNom"));
|
||||
|
||||
TabColEspacePrenom.setStyle( "-fx-alignment: CENTER;");TabColEspacePrenom.getStyleClass().add("Center");
|
||||
TabColEspacePrenom.setCellValueFactory(new PropertyValueFactory<CaisseListe, String>("EspacePrenom"));
|
||||
|
||||
TabColCateBancaireNumero.setStyle( "-fx-alignment: CENTER;");TabColCateBancaireNumero.getStyleClass().add("Center");
|
||||
TabColCateBancaireNumero.setCellValueFactory(new PropertyValueFactory<CaisseListe, String>("CateBancaireNumero"));
|
||||
|
||||
TabColCateBancaireBanque.setStyle( "-fx-alignment: CENTER;");TabColCateBancaireBanque.getStyleClass().add("Center");
|
||||
TabColCateBancaireBanque.setCellValueFactory(new PropertyValueFactory<CaisseListe, String>("CateBancaireBanque"));
|
||||
|
||||
ButtonEnter.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent actionEvent) {
|
||||
try{
|
||||
DateDebut = DatePickerDebut.getConverter().fromString(DatePickerDebut.getEditor().getText()).toString();
|
||||
DateFin = DatePickerFin.getConverter().fromString(DatePickerFin.getEditor().getText()).toString();
|
||||
getCaisseEnterThread();
|
||||
}catch(Exception ex){}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
this.FiltreCaisse();
|
||||
|
||||
this.CaisseEntrePrintButton();
|
||||
}
|
||||
|
||||
private void FiltreCaisse()
|
||||
{
|
||||
CheckBoxChequeClt.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailEnterCheck();
|
||||
}
|
||||
});
|
||||
CheckBoxEspace.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailEnterCheck();
|
||||
}
|
||||
});
|
||||
CheckBoxCarteBancaire.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailEnterCheck();
|
||||
}
|
||||
});
|
||||
|
||||
CheckBoxPaiementTraite.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailEnterCheck();
|
||||
}
|
||||
});
|
||||
CheckBoxVenteComptant.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailEnterCheck();
|
||||
}
|
||||
});
|
||||
CheckBoxVenteCommandeAvance.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailEnterCheck();
|
||||
}
|
||||
});
|
||||
CheckBoxVenteFaciliteAvance.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailEnterCheck();
|
||||
}
|
||||
});
|
||||
|
||||
CheckBoxVersementCheque.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailEnterCheck();
|
||||
}
|
||||
});
|
||||
CheckBoxVersementCheque.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailEnterCheck();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void getCaisseEnterThread()
|
||||
{
|
||||
TotalEnter.setText("--");
|
||||
|
||||
DatePickerDebut.setDisable(true);
|
||||
DatePickerFin.setDisable(true);
|
||||
ButtonEnter.setDisable(true);
|
||||
ButtonPrintCaisseEntre.setDisable(true);
|
||||
|
||||
ProgressBarCaisseEnterClt.setVisible(true);
|
||||
TableViewCaisseCltEnter.setItems(null);
|
||||
|
||||
CheckBoxChequeClt.setSelected(true);
|
||||
CheckBoxEspace.setSelected(true);
|
||||
CheckBoxCarteBancaire.setSelected(true);
|
||||
|
||||
CheckBoxPaiementTraite.setSelected(true);
|
||||
CheckBoxVenteComptant.setSelected(true);
|
||||
CheckBoxVenteCommandeAvance.setSelected(true);
|
||||
CheckBoxVenteFaciliteAvance.setSelected(true);
|
||||
CheckBoxVersementCheque.setSelected(true);
|
||||
|
||||
|
||||
ThreadCaisseEnter = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
ObsListCaisseCltEnter = CaisseDB.GetDataCaisseCltEnter(DateDebut, DateFin);
|
||||
int indice = 0;
|
||||
float FloatTotalEnter = 0;
|
||||
while(indice<ObsListCaisseCltEnter.size()){
|
||||
FloatTotalEnter += ObsListCaisseCltEnter.get(indice).getFloatMontant();
|
||||
indice++;
|
||||
}
|
||||
|
||||
TotalEnter.setText(Adaptateur.FloatToStringEspaceCurrency(FloatTotalEnter));
|
||||
|
||||
TempoObsListCaisseCltEnter = ObsListCaisseCltEnter;
|
||||
|
||||
TableViewCaisseCltEnter.setItems(ObsListCaisseCltEnter);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadCaisseEnter.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarCaisseEnterClt.setVisible(false);
|
||||
DatePickerDebut.setDisable(false);
|
||||
DatePickerFin.setDisable(false);
|
||||
ButtonEnter.setDisable(false);
|
||||
ButtonPrintCaisseEntre.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadCaisseEnter.start();
|
||||
}
|
||||
|
||||
|
||||
private void CaisseEntrePrintButton()
|
||||
{
|
||||
ButtonPrintCaisseEntre.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
String strPaiment = "";
|
||||
if(CheckBoxChequeClt.isSelected()){ strPaiment += "Chéque | "; }
|
||||
if(CheckBoxEspace.isSelected()){ strPaiment += "Espéce | "; }
|
||||
if(CheckBoxCarteBancaire.isSelected()){ strPaiment += "Carte Bancaire | "; }
|
||||
strPaiment = strPaiment.substring(0, strPaiment.length() - 3);
|
||||
|
||||
String strType = "";
|
||||
if(CheckBoxPaiementTraite.isSelected()){ strType += "Traite | "; }
|
||||
if(CheckBoxVenteComptant.isSelected()){ strType += "Vente Comptant | "; }
|
||||
if(CheckBoxVenteCommandeAvance.isSelected()){ strType += "Vente Commande Avance | "; }
|
||||
if(CheckBoxVenteFaciliteAvance.isSelected()){ strType += "Vente Facilité Avance | "; }
|
||||
if(CheckBoxVersementCheque.isSelected()){ strType += "Chèque | "; }
|
||||
|
||||
strType = strType.substring(0, strType.length() - 3);
|
||||
|
||||
int SizelistCaisseCltEntert = TempoObsListCaisseCltEnter.size();
|
||||
int total = SizelistCaisseCltEntert / 13 + 1 ;
|
||||
int page = 0;
|
||||
|
||||
String strEspace; String strCheque; String strCarteBancaire;
|
||||
|
||||
PrinterJob jobPrint = PrinterJob.createPrinterJob();
|
||||
|
||||
jobPrint.getJobSettings().setPageRanges(new PageRange(1, total));
|
||||
|
||||
if (jobPrint.showPrintDialog(null))
|
||||
{
|
||||
Printer printer = jobPrint.getPrinter();
|
||||
PageLayout pageLayout = printer.createPageLayout(Paper.A4, PageOrientation.LANDSCAPE, Printer.MarginType.DEFAULT);
|
||||
|
||||
for (int i=0; i<SizelistCaisseCltEntert; i+=13)
|
||||
{
|
||||
try {
|
||||
ObservableList<CaisseEntreListe> listTemp = FXCollections.observableArrayList();
|
||||
|
||||
for (int j=i; (j<(i+13)) && (j<SizelistCaisseCltEntert); j++)
|
||||
{
|
||||
CaisseListe ListCaisseClt = TempoObsListCaisseCltEnter.get(j);
|
||||
|
||||
strEspace =""; strCheque=""; strCarteBancaire="";
|
||||
|
||||
if(!clt.isStringNull(ListCaisseClt.getChequeCltNumero())){
|
||||
strCheque = ListCaisseClt.getChequeCltNumero()+" - " +ListCaisseClt.getChequeCltBanque();
|
||||
}else if(!clt.isStringNull(ListCaisseClt.getCateBancaireNumero())){
|
||||
strCarteBancaire = ListCaisseClt.getCateBancaireNumero()+" - "+ListCaisseClt.getCateBancaireBanque();
|
||||
}else{
|
||||
strEspace = ListCaisseClt.getEspaceNom()+" "+ListCaisseClt.getEspacePrenom();
|
||||
}
|
||||
|
||||
listTemp.add(new CaisseEntreListe(
|
||||
ListCaisseClt.getIdCaisseClt(),
|
||||
ListCaisseClt.getCodeType(),
|
||||
ListCaisseClt.getType(),
|
||||
ListCaisseClt.getDate(),
|
||||
ListCaisseClt.getMontant(),
|
||||
strCheque,
|
||||
strEspace,
|
||||
strCarteBancaire,
|
||||
ListCaisseClt.getFloatMontant()
|
||||
));
|
||||
}
|
||||
FXMLLoader fxmlLoaderCaisseEntrePrint = new FXMLLoader(getClass().getResource("/Views/Caisse/CaisseEntrePrint.fxml"));
|
||||
final Node ParentFxmlCaisseEntrePrint = (Node)fxmlLoaderCaisseEntrePrint.load();
|
||||
CaisseEntrePrintController caisseEntrePrintController = fxmlLoaderCaisseEntrePrint.getController();
|
||||
page++;
|
||||
|
||||
caisseEntrePrintController.setCaisseEntrePrint(
|
||||
Adaptateur.NormalDateFormat(DateDebut)+" à "+Adaptateur.NormalDateFormat(DateFin),
|
||||
ParametreSystem.NomLocalPC,
|
||||
TotalEnter.getText(),
|
||||
strPaiment,
|
||||
page+"/"+total,
|
||||
strType,
|
||||
listTemp);
|
||||
|
||||
jobPrint.printPage(pageLayout, ParentFxmlCaisseEntrePrint);
|
||||
} catch (IOException ex) {
|
||||
logger.error("CaisseEntreController : CaisseEntrePrint.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
jobPrint.endJob();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package Controllers.Caisse;
|
||||
|
||||
import Models.Caisse.CaisseEntreListe;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class CaisseEntrePrintController implements Initializable {
|
||||
|
||||
@FXML private Text TextDate;
|
||||
@FXML private Text TextLocal;
|
||||
@FXML private Text TextMontant;
|
||||
@FXML private Text TextPaiement;
|
||||
@FXML private Text TextPage;
|
||||
@FXML private Text TextType;
|
||||
|
||||
@FXML public TableView<CaisseEntreListe> TableViewCaisseCltEnter ;
|
||||
|
||||
@FXML private TableColumn<CaisseEntreListe ,String> TabColIdCaisse;
|
||||
@FXML private TableColumn<CaisseEntreListe ,String> TabColType;
|
||||
@FXML private TableColumn<CaisseEntreListe ,String> TabColDate;
|
||||
@FXML private TableColumn<CaisseEntreListe ,String> TabColMontant;
|
||||
@FXML private TableColumn<CaisseEntreListe ,String> TabColChequeClt;
|
||||
@FXML private TableColumn<CaisseEntreListe ,String> TabColEspece;
|
||||
@FXML private TableColumn<CaisseEntreListe ,String> TabColCateBancaire;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TabColIdCaisse.setStyle( "-fx-alignment: CENTER;");TabColIdCaisse.getStyleClass().add("Center");
|
||||
TabColIdCaisse.setCellValueFactory(new PropertyValueFactory<CaisseEntreListe, String>("IdCaisseClt"));
|
||||
|
||||
TabColType.setCellValueFactory(new PropertyValueFactory<CaisseEntreListe, String>("Type"));
|
||||
|
||||
TabColDate.setCellValueFactory(new PropertyValueFactory<CaisseEntreListe, String>("Date"));
|
||||
|
||||
TabColMontant.setStyle( "-fx-alignment: CENTER;");TabColMontant.getStyleClass().add("Center");
|
||||
TabColMontant.setCellValueFactory(new PropertyValueFactory<CaisseEntreListe, String>("Montant"));
|
||||
|
||||
TabColChequeClt.setCellValueFactory(new PropertyValueFactory<CaisseEntreListe, String>("Cheque"));
|
||||
|
||||
TabColEspece.setCellValueFactory(new PropertyValueFactory<CaisseEntreListe, String>("Espece"));
|
||||
|
||||
TabColCateBancaire.setCellValueFactory(new PropertyValueFactory<CaisseEntreListe, String>("CateBancaire"));
|
||||
}
|
||||
|
||||
|
||||
public void setCaisseEntrePrint(String Date,
|
||||
String Local,
|
||||
String Montant,
|
||||
String Paiement,
|
||||
String Page,
|
||||
String Type,
|
||||
ObservableList<CaisseEntreListe> obsListCaisseCltEnter )
|
||||
{
|
||||
TextDate.setText(Date);
|
||||
TextLocal.setText(Local);
|
||||
TextMontant.setText(Montant);
|
||||
TextPaiement.setText(Paiement);
|
||||
TextPage.setText(Page);
|
||||
TextType.setText(Type);
|
||||
|
||||
TableViewCaisseCltEnter.setItems(obsListCaisseCltEnter);
|
||||
}
|
||||
}
|
||||
439
src/main/java/Controllers/Caisse/CaisseSortieController.java
Normal file
439
src/main/java/Controllers/Caisse/CaisseSortieController.java
Normal file
@@ -0,0 +1,439 @@
|
||||
package Controllers.Caisse;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.Caisse.CaisseDB;
|
||||
import Models.Caisse.CaisseSortieListe;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.print.PageLayout;
|
||||
import javafx.print.PageOrientation;
|
||||
import javafx.print.PageRange;
|
||||
import javafx.print.Paper;
|
||||
import javafx.print.Printer;
|
||||
import javafx.print.PrinterJob;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class CaisseSortieController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(CaisseSortieController.class.getName());
|
||||
|
||||
@FXML private AnchorPane AnchorPaneCaisseClt;
|
||||
|
||||
@FXML private DatePicker DatePickerDebut;
|
||||
@FXML private DatePicker DatePickerFin;
|
||||
|
||||
@FXML private Text TotalSortie;
|
||||
|
||||
@FXML private CheckBox CheckBoxChequeClt;
|
||||
@FXML private CheckBox CheckBoxEspace;
|
||||
@FXML private CheckBox CheckBoxCarteBancaire;
|
||||
|
||||
@FXML private CheckBox CheckBoxAchatFrs;
|
||||
@FXML private CheckBox CheckBoxFraisFrs;
|
||||
@FXML private CheckBox CheckBoxTraiteFrs;
|
||||
@FXML private CheckBox CheckBoxAvoirV;
|
||||
|
||||
@FXML private Button ButtonSortie;
|
||||
@FXML private Button ButtonPrintCaisseSortie;
|
||||
|
||||
@FXML private ProgressBar ProgressBarCaisseSortieFrs;
|
||||
@FXML private TableView<CaisseSortieListe> TableViewCaisseFrsSortie ;
|
||||
|
||||
@FXML private TableColumn<CaisseSortieListe ,String> TabColIdCaisseFrs;
|
||||
@FXML private TableColumn<CaisseSortieListe ,String> TabColTypeFrs;
|
||||
@FXML private TableColumn<CaisseSortieListe ,String> TabColDateFrs;
|
||||
@FXML private TableColumn<CaisseSortieListe ,String> TabColMontantFrs;
|
||||
|
||||
@FXML private TableColumn<CaisseSortieListe ,String> TabColEspeceFrs;
|
||||
@FXML private TableColumn<CaisseSortieListe ,String> TabColChequeFrs;
|
||||
@FXML private TableColumn<CaisseSortieListe ,String> TabColCarteBancaireFrs;
|
||||
|
||||
private Service<Void> ThreadCaisseSortie;
|
||||
|
||||
CaisseDB CaisseDB= new CaisseDB();
|
||||
|
||||
ObservableList<CaisseSortieListe> ObsListCaisseFrsSortie;
|
||||
ObservableList<CaisseSortieListe> TempoObsListCaisseFrsSortie;
|
||||
|
||||
private String DateDebut ;
|
||||
private String DateFin;
|
||||
|
||||
contro clt = new contro();
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
DatePickerDebut.setValue(LocalDate.now());
|
||||
DatePickerFin.setValue(LocalDate.now());
|
||||
|
||||
DateDebut = DatePickerDebut.getValue().toString();
|
||||
DateFin = DatePickerFin.getValue().toString();
|
||||
|
||||
|
||||
TabColIdCaisseFrs.setStyle( "-fx-alignment: CENTER;");TabColIdCaisseFrs.getStyleClass().add("Center");
|
||||
TabColIdCaisseFrs.setCellValueFactory(new PropertyValueFactory<CaisseSortieListe, String>("IdCaisseClt"));
|
||||
|
||||
TabColTypeFrs.setStyle( "-fx-alignment: CENTER;");TabColTypeFrs.getStyleClass().add("Center");
|
||||
TabColTypeFrs.setCellValueFactory(new PropertyValueFactory<CaisseSortieListe, String>("Type"));
|
||||
|
||||
TabColDateFrs.setStyle( "-fx-alignment: CENTER;");TabColDateFrs.getStyleClass().add("Center");
|
||||
TabColDateFrs.setCellValueFactory(new PropertyValueFactory<CaisseSortieListe, String>("Date"));
|
||||
|
||||
TabColMontantFrs.setStyle( "-fx-alignment: CENTER;");TabColMontantFrs.getStyleClass().add("Center");
|
||||
TabColMontantFrs.setCellValueFactory(new PropertyValueFactory<CaisseSortieListe, String>("Montant"));
|
||||
|
||||
TabColEspeceFrs.setStyle( "-fx-alignment: CENTER;");TabColEspeceFrs.getStyleClass().add("Center");
|
||||
TabColEspeceFrs.setCellValueFactory(new PropertyValueFactory<CaisseSortieListe, String>("Espece"));
|
||||
|
||||
TabColChequeFrs.setStyle( "-fx-alignment: CENTER;");TabColChequeFrs.getStyleClass().add("Center");
|
||||
TabColChequeFrs.setCellValueFactory(new PropertyValueFactory<CaisseSortieListe, String>("Cheque"));
|
||||
|
||||
TabColCarteBancaireFrs.setStyle( "-fx-alignment: CENTER;");TabColCarteBancaireFrs.getStyleClass().add("Center");
|
||||
TabColCarteBancaireFrs.setCellValueFactory(new PropertyValueFactory<CaisseSortieListe, String>("CarteBancaire"));
|
||||
|
||||
ButtonSortie.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent actionEvent) {
|
||||
try{
|
||||
DateDebut = DatePickerDebut.getConverter().fromString(DatePickerDebut.getEditor().getText()).toString();
|
||||
DateFin = DatePickerFin.getConverter().fromString(DatePickerFin.getEditor().getText()).toString();
|
||||
getCaisseSortieThread();
|
||||
}catch(Exception ex){}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
this.FiltreCaisse();
|
||||
|
||||
this.CaisseSortiePrintButton();
|
||||
|
||||
}
|
||||
|
||||
private void FiltreCaisse(){
|
||||
CheckBoxChequeClt.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailSortieCheck();
|
||||
}
|
||||
});
|
||||
CheckBoxEspace.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailSortieCheck();
|
||||
}
|
||||
});
|
||||
CheckBoxCarteBancaire.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailSortieCheck();
|
||||
}
|
||||
});
|
||||
|
||||
CheckBoxAchatFrs.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailSortieCheck();
|
||||
}
|
||||
});
|
||||
CheckBoxFraisFrs.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailSortieCheck();
|
||||
}
|
||||
});
|
||||
CheckBoxTraiteFrs.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailSortieCheck();
|
||||
}
|
||||
});
|
||||
|
||||
CheckBoxAvoirV.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
getDetailSortieCheck();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void getCaisseSortieThread()
|
||||
{
|
||||
TotalSortie.setText("--");
|
||||
|
||||
DatePickerDebut.setDisable(true);
|
||||
DatePickerFin.setDisable(true);
|
||||
ButtonSortie.setDisable(true);
|
||||
ButtonPrintCaisseSortie.setDisable(true);
|
||||
|
||||
ProgressBarCaisseSortieFrs.setVisible(true);
|
||||
TableViewCaisseFrsSortie.setItems(null);
|
||||
|
||||
CheckBoxChequeClt.setSelected(true);
|
||||
CheckBoxEspace.setSelected(true);
|
||||
CheckBoxCarteBancaire.setSelected(true);
|
||||
|
||||
//Sortie
|
||||
CheckBoxAchatFrs.setSelected(true);
|
||||
CheckBoxFraisFrs.setSelected(true);
|
||||
|
||||
ThreadCaisseSortie = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
/*******************Sortie**********************/
|
||||
ObsListCaisseFrsSortie = CaisseDB.GetDataCaisseFrsSortie(DateDebut, DateFin);
|
||||
System.out.println(ObsListCaisseFrsSortie.size());
|
||||
TempoObsListCaisseFrsSortie = ObsListCaisseFrsSortie;
|
||||
|
||||
int indiceSortie = 0;
|
||||
float FloatTotalSortie = 0;
|
||||
while(indiceSortie<ObsListCaisseFrsSortie.size()){
|
||||
FloatTotalSortie += ObsListCaisseFrsSortie.get(indiceSortie).getFloatMontant();
|
||||
indiceSortie++;
|
||||
}
|
||||
|
||||
TotalSortie.setText(Adaptateur.FloatToStringEspaceCurrency(FloatTotalSortie));
|
||||
|
||||
TableViewCaisseFrsSortie.setItems(ObsListCaisseFrsSortie);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadCaisseSortie.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarCaisseSortieFrs.setVisible(false);
|
||||
DatePickerDebut.setDisable(false);
|
||||
DatePickerFin.setDisable(false);
|
||||
ButtonPrintCaisseSortie.setDisable(false);
|
||||
ButtonSortie.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadCaisseSortie.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void getDetailSortieCheck(){
|
||||
|
||||
TempoObsListCaisseFrsSortie = FXCollections.observableArrayList();
|
||||
|
||||
boolean CheckCheque = CheckBoxChequeClt.isSelected();
|
||||
boolean CheckEspace = CheckBoxEspace.isSelected();
|
||||
boolean CheckCarteBancaire= CheckBoxCarteBancaire.isSelected();
|
||||
|
||||
boolean CheckFrais = CheckBoxFraisFrs.isSelected();
|
||||
boolean CheckAchat = CheckBoxAchatFrs.isSelected();
|
||||
boolean CheckTraite = CheckBoxTraiteFrs.isSelected();
|
||||
boolean CheckAvoirV = CheckBoxAvoirV.isSelected();
|
||||
|
||||
float FloatTotalSortie = 0;
|
||||
|
||||
// 0-Vente Comptant | 1-Vente Facilité Avance | 2 Vente Commande Avance | 3 traite clt | 4 ChequeClt
|
||||
if(ObsListCaisseFrsSortie.size()>0){
|
||||
int indice = 0;
|
||||
while(indice<ObsListCaisseFrsSortie.size()){
|
||||
|
||||
CaisseSortieListe ListCaisseFrsSortie = ObsListCaisseFrsSortie.get(indice);
|
||||
|
||||
//Achat
|
||||
if(CheckAchat && (ListCaisseFrsSortie.getType().equals("Achat")) ){
|
||||
|
||||
//Paiement Espace
|
||||
if(CheckEspace && (ListCaisseFrsSortie.getCodeType().equals("Espèce")) ){
|
||||
FloatTotalSortie += ListCaisseFrsSortie.getFloatMontant();
|
||||
TempoObsListCaisseFrsSortie.add(ListCaisseFrsSortie);
|
||||
}
|
||||
|
||||
//Paiement Chèque
|
||||
if(CheckCheque && (ListCaisseFrsSortie.getCodeType().equals("Chèque")) ){
|
||||
FloatTotalSortie += ListCaisseFrsSortie.getFloatMontant();
|
||||
TempoObsListCaisseFrsSortie.add(ListCaisseFrsSortie);
|
||||
}
|
||||
|
||||
//Paiement Carte Bancaire
|
||||
if(CheckCarteBancaire && (ListCaisseFrsSortie.getCodeType().equals("Carte Bancaire")) ){
|
||||
FloatTotalSortie += ListCaisseFrsSortie.getFloatMontant();
|
||||
TempoObsListCaisseFrsSortie.add(ListCaisseFrsSortie);
|
||||
}
|
||||
|
||||
//Traite Frs
|
||||
if(CheckTraite && (ListCaisseFrsSortie.getCodeType().equals("Traite")) ){
|
||||
FloatTotalSortie += ListCaisseFrsSortie.getFloatMontant();
|
||||
TempoObsListCaisseFrsSortie.add(ListCaisseFrsSortie);
|
||||
}
|
||||
}
|
||||
|
||||
//Frais
|
||||
if(CheckFrais && (ListCaisseFrsSortie.getType().equals("Frais")) ){
|
||||
|
||||
//Paiement Espace
|
||||
if(CheckEspace && (ListCaisseFrsSortie.getCodeType().equals("Espèce")) ){
|
||||
FloatTotalSortie += ListCaisseFrsSortie.getFloatMontant();
|
||||
TempoObsListCaisseFrsSortie.add(ListCaisseFrsSortie);
|
||||
}
|
||||
|
||||
//Paiement Chèque
|
||||
if(CheckCheque && (ListCaisseFrsSortie.getCodeType().equals("Chèque")) ){
|
||||
FloatTotalSortie += ListCaisseFrsSortie.getFloatMontant();
|
||||
TempoObsListCaisseFrsSortie.add(ListCaisseFrsSortie);
|
||||
}
|
||||
|
||||
//Paiement Carte Bancaire
|
||||
if(CheckCarteBancaire && (ListCaisseFrsSortie.getCodeType().equals("Carte Bancaire")) ){
|
||||
FloatTotalSortie += ListCaisseFrsSortie.getFloatMontant();
|
||||
TempoObsListCaisseFrsSortie.add(ListCaisseFrsSortie);
|
||||
}
|
||||
}
|
||||
|
||||
//Avoir Vente Sans Facture
|
||||
if(CheckAvoirV && (ListCaisseFrsSortie.getType().equals("Avoir VSF")) ){
|
||||
|
||||
//Paiement Espace
|
||||
if(CheckEspace && (ListCaisseFrsSortie.getCodeType().equals("Espèce")) ){
|
||||
FloatTotalSortie += ListCaisseFrsSortie.getFloatMontant();
|
||||
TempoObsListCaisseFrsSortie.add(ListCaisseFrsSortie);
|
||||
}
|
||||
|
||||
//Paiement Chèque
|
||||
if(CheckCheque && (ListCaisseFrsSortie.getCodeType().equals("Chèque")) ){
|
||||
FloatTotalSortie += ListCaisseFrsSortie.getFloatMontant();
|
||||
TempoObsListCaisseFrsSortie.add(ListCaisseFrsSortie);
|
||||
}
|
||||
|
||||
//Paiement Carte Bancaire
|
||||
if(CheckCarteBancaire && (ListCaisseFrsSortie.getCodeType().equals("Carte Bancaire")) ){
|
||||
FloatTotalSortie += ListCaisseFrsSortie.getFloatMontant();
|
||||
TempoObsListCaisseFrsSortie.add(ListCaisseFrsSortie);
|
||||
}
|
||||
}
|
||||
|
||||
//Traite
|
||||
if(CheckTraite && (ListCaisseFrsSortie.getType().equals("Traite")) ){
|
||||
|
||||
//Paiement Espace
|
||||
if(CheckEspace && (ListCaisseFrsSortie.getCodeType().equals("Espèce")) ){
|
||||
FloatTotalSortie += ListCaisseFrsSortie.getFloatMontant();
|
||||
TempoObsListCaisseFrsSortie.add(ListCaisseFrsSortie);
|
||||
}
|
||||
|
||||
}
|
||||
indice++;
|
||||
}
|
||||
TableViewCaisseFrsSortie.setItems(null);
|
||||
TableViewCaisseFrsSortie.setItems(TempoObsListCaisseFrsSortie);
|
||||
TotalSortie.setText(Adaptateur.FloatToStringEspaceCurrency(FloatTotalSortie));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void CaisseSortiePrintButton()
|
||||
{
|
||||
ButtonPrintCaisseSortie.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
String strPaiment = "";
|
||||
if(CheckBoxChequeClt.isSelected()){ strPaiment += "Chéque | "; }
|
||||
if(CheckBoxEspace.isSelected()){ strPaiment += "Espéce | "; }
|
||||
if(CheckBoxCarteBancaire.isSelected()){ strPaiment += "Carte Bancaire | "; }
|
||||
strPaiment = strPaiment.substring(0, strPaiment.length() - 3);
|
||||
|
||||
String strType = "";
|
||||
if(CheckBoxAchatFrs.isSelected()){ strType += "Achat | "; }
|
||||
if(CheckBoxFraisFrs.isSelected()){ strType += "Frais | "; }
|
||||
if(CheckBoxTraiteFrs.isSelected()){ strType += "Traite | "; }
|
||||
if(CheckBoxAvoirV.isSelected()){ strType += "Avoir | "; }
|
||||
strType = strType.substring(0, strType.length() - 3);
|
||||
|
||||
int SizelistCaisseCltSortiet = TempoObsListCaisseFrsSortie.size();
|
||||
int total = SizelistCaisseCltSortiet / 13 + 1 ;
|
||||
int page = 0;
|
||||
|
||||
PrinterJob jobPrint = PrinterJob.createPrinterJob();
|
||||
|
||||
|
||||
|
||||
jobPrint.getJobSettings().setPageRanges(new PageRange(1, total));
|
||||
|
||||
if (jobPrint.showPrintDialog(null))
|
||||
{
|
||||
Printer printer = jobPrint.getPrinter();
|
||||
PageLayout pageLayout = printer.createPageLayout(Paper.A4, PageOrientation.LANDSCAPE, Printer.MarginType.DEFAULT);
|
||||
|
||||
for (int i=0; i<SizelistCaisseCltSortiet; i+=13)
|
||||
{
|
||||
try {
|
||||
ObservableList<CaisseSortieListe> listTemp = FXCollections.observableArrayList();
|
||||
|
||||
for (int j=i; (j<(i+13)) && (j<SizelistCaisseCltSortiet); j++)
|
||||
{
|
||||
CaisseSortieListe ListCaisseClt = TempoObsListCaisseFrsSortie.get(j);
|
||||
|
||||
listTemp.add(ListCaisseClt);
|
||||
}
|
||||
FXMLLoader fxmlLoaderCaisseSortiePrint = new FXMLLoader(getClass().getResource("/Views/Caisse/CaisseSortiePrint.fxml"));
|
||||
final Node ParentFxmlCaisseSortiePrint = (Node)fxmlLoaderCaisseSortiePrint.load();
|
||||
CaisseSortiePrintController caisseSortiePrintController = fxmlLoaderCaisseSortiePrint.getController();
|
||||
page++;
|
||||
|
||||
caisseSortiePrintController.setCaisseSortiePrint(
|
||||
Adaptateur.NormalDateFormat(DateDebut)+" à "+Adaptateur.NormalDateFormat(DateFin),
|
||||
ParametreSystem.NomLocalPC,
|
||||
TotalSortie.getText(),
|
||||
strPaiment,
|
||||
page+"/"+total,
|
||||
strType,
|
||||
listTemp);
|
||||
|
||||
jobPrint.printPage(pageLayout, ParentFxmlCaisseSortiePrint);
|
||||
} catch (IOException ex) {
|
||||
logger.error("CaisseSortieController : CaisseSortiePrintButton : CaisseSortiePrint.fxml : " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
jobPrint.endJob();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package Controllers.Caisse;
|
||||
|
||||
import Models.Caisse.CaisseSortieListe;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class CaisseSortiePrintController implements Initializable {
|
||||
|
||||
@FXML private Text TextDate;
|
||||
@FXML private Text TextLocal;
|
||||
@FXML private Text TextMontant;
|
||||
@FXML private Text TextPaiement;
|
||||
@FXML private Text TextPage;
|
||||
@FXML private Text TextType;
|
||||
|
||||
@FXML public TableView<CaisseSortieListe> TableViewCaisseCltSortie ;
|
||||
|
||||
@FXML private TableColumn<CaisseSortieListe ,String> TabColIdCaisse;
|
||||
@FXML private TableColumn<CaisseSortieListe ,String> TabColType;
|
||||
@FXML private TableColumn<CaisseSortieListe ,String> TabColDate;
|
||||
@FXML private TableColumn<CaisseSortieListe ,String> TabColMontant;
|
||||
@FXML private TableColumn<CaisseSortieListe ,String> TabColChequeClt;
|
||||
@FXML private TableColumn<CaisseSortieListe ,String> TabColEspece;
|
||||
@FXML private TableColumn<CaisseSortieListe ,String> TabColCarteBancaire;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TabColIdCaisse.setStyle( "-fx-alignment: CENTER;");TabColIdCaisse.getStyleClass().add("Center");
|
||||
TabColIdCaisse.setCellValueFactory(new PropertyValueFactory<CaisseSortieListe, String>("IdCaisseClt"));
|
||||
|
||||
TabColType.setCellValueFactory(new PropertyValueFactory<CaisseSortieListe, String>("Type"));
|
||||
|
||||
TabColDate.setCellValueFactory(new PropertyValueFactory<CaisseSortieListe, String>("Date"));
|
||||
|
||||
TabColMontant.setStyle( "-fx-alignment: CENTER;");TabColMontant.getStyleClass().add("Center");
|
||||
TabColMontant.setCellValueFactory(new PropertyValueFactory<CaisseSortieListe, String>("Montant"));
|
||||
|
||||
TabColChequeClt.setCellValueFactory(new PropertyValueFactory<CaisseSortieListe, String>("Cheque"));
|
||||
|
||||
TabColEspece.setCellValueFactory(new PropertyValueFactory<CaisseSortieListe, String>("Espece"));
|
||||
|
||||
TabColCarteBancaire.setCellValueFactory(new PropertyValueFactory<CaisseSortieListe, String>("CarteBancaire"));
|
||||
}
|
||||
|
||||
|
||||
public void setCaisseSortiePrint(String Date,
|
||||
String Local,
|
||||
String Montant,
|
||||
String Paiement,
|
||||
String Page,
|
||||
String Type,
|
||||
ObservableList<CaisseSortieListe> obsListCaisseCltSortie )
|
||||
{
|
||||
TextDate.setText(Date);
|
||||
TextLocal.setText(Local);
|
||||
TextMontant.setText(Montant);
|
||||
TextPaiement.setText(Paiement);
|
||||
TextPage.setText(Page);
|
||||
TextType.setText(Type);
|
||||
|
||||
TableViewCaisseCltSortie.setItems(obsListCaisseCltSortie);
|
||||
}
|
||||
}
|
||||
221
src/main/java/Controllers/Caisse/FraisAjouterController.java
Normal file
221
src/main/java/Controllers/Caisse/FraisAjouterController.java
Normal file
@@ -0,0 +1,221 @@
|
||||
|
||||
package Controllers.Caisse;
|
||||
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.Caisse.Frais;
|
||||
import Models.Caisse.FraisDB;
|
||||
import Models.User.User;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.ProgressIndicator;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Duration;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class FraisAjouterController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(FraisAjouterController.class.getName());
|
||||
|
||||
@FXML private AnchorPane PaneAjouterFrais ;
|
||||
@FXML private AnchorPane AnchorPaneFrais ;
|
||||
@FXML private StackPane StackPaneSucces;
|
||||
|
||||
@FXML private ProgressIndicator ProgrssLoading;
|
||||
@FXML private Button ButtonAjouterFrais;
|
||||
|
||||
@FXML private TextField TextFieldMontant;
|
||||
|
||||
@FXML private RadioButton RadioEspace;
|
||||
|
||||
@FXML private RadioButton RadioCheque;
|
||||
@FXML private GridPane GridPaneCheque;
|
||||
@FXML private TextField TextFieldNumeroCheque;
|
||||
@FXML private TextField TextFieldBanqueCheque;
|
||||
@FXML private DatePicker DatePickerDateCheque;
|
||||
|
||||
@FXML private RadioButton RadioCarte;
|
||||
@FXML private GridPane GridPaneCarte;
|
||||
@FXML private TextField TextFieldNumeroTransation;
|
||||
@FXML private TextField TextFieldBanqueCarte;
|
||||
|
||||
|
||||
@FXML private TextField TextFieldObject;
|
||||
@FXML private TextField TextFieldPersonne;
|
||||
@FXML private TextArea TextAreaContext ;
|
||||
|
||||
@FXML private Text ErreurMontant;
|
||||
@FXML private Text ErreurNumeroCheque;
|
||||
@FXML private Text ErreurBanqueCheque;
|
||||
@FXML private Text ErreurDateCheque;
|
||||
|
||||
@FXML private Text ErreurTransaction;
|
||||
@FXML private Text ErreurBanqueCart;
|
||||
@FXML private Text ErreurObject;
|
||||
|
||||
private Service<Void> ThreadFrais;
|
||||
|
||||
Frais frais = new Frais();
|
||||
FraisDB fraisDB = new FraisDB();
|
||||
contro ctl= new contro() ;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
frais.setPaiement("0");
|
||||
this.TypePaiement();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void AjouterFraisButtonAction(ActionEvent event) throws IOException {
|
||||
if(this.ContoleFrais()){
|
||||
ButtonAjouterFrais.setDisable(true);
|
||||
ButtonAjouterFrais.setText("");
|
||||
ThreadFrais = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
ProgrssLoading.setVisible(true);
|
||||
frais = fraisDB.setFrais(frais);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadFrais.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(400), AnchorPaneFrais);
|
||||
ft.setFromValue(1.0);
|
||||
ft.setToValue(0.0);
|
||||
ft.play();
|
||||
ft.setOnFinished(new EventHandler<ActionEvent>() {
|
||||
//message de succés
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
StackPaneSucces.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
ThreadFrais.start();
|
||||
}
|
||||
}
|
||||
|
||||
private Boolean ContoleFrais(){
|
||||
|
||||
Boolean result = false;
|
||||
|
||||
if( ctl.ContrReelNotNull(TextFieldMontant,ErreurMontant) &&
|
||||
ctl.ContrNull(TextFieldObject,ErreurObject) ){
|
||||
frais.setMontant(TextFieldMontant.getText());
|
||||
frais.setObject(TextFieldObject.getText());
|
||||
frais.setPersonne(TextFieldPersonne.getText());
|
||||
|
||||
frais.setDateCreation(LocalDateTime.now().toString());
|
||||
frais.setProfile(User.idprofile+"");
|
||||
frais.setLocalNom(User.UserLocal);
|
||||
|
||||
frais.setContext(TextAreaContext.getText());
|
||||
|
||||
if( frais.getPaiement().equals("1") &&
|
||||
ctl.ContrNull(TextFieldNumeroCheque, ErreurNumeroCheque) &&
|
||||
ctl.ContrNull(TextFieldBanqueCheque, ErreurBanqueCheque) &&
|
||||
ctl.ContrNullDatePicker(DatePickerDateCheque, ErreurDateCheque)){
|
||||
frais.setNumero(TextFieldNumeroCheque.getText());
|
||||
frais.setBanque(TextFieldBanqueCheque.getText());
|
||||
frais.setDateCheque(DatePickerDateCheque.getValue().toString());
|
||||
result = true;
|
||||
}else if(frais.getPaiement().equals("2") &&
|
||||
ctl.ContrNull(TextFieldNumeroTransation, ErreurTransaction) &&
|
||||
ctl.ContrNull(TextFieldBanqueCarte, ErreurBanqueCart) ){
|
||||
frais.setBanque(TextFieldBanqueCarte.getText());
|
||||
frais.setNumero(TextFieldNumeroTransation.getText());
|
||||
result = true;
|
||||
}else if(frais.getPaiement().equals("0")){
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void TypePaiement(){
|
||||
//0 :espèce 1:Chèque 2 :carte bancaire
|
||||
RadioEspace.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
GridPaneCheque.setVisible(false);
|
||||
GridPaneCarte.setVisible(false);
|
||||
frais.setPaiement("0");
|
||||
}
|
||||
});
|
||||
RadioCheque.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
GridPaneCheque.setVisible(true);
|
||||
GridPaneCarte.setVisible(false);
|
||||
frais.setPaiement("1");
|
||||
}
|
||||
});
|
||||
RadioCarte.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
GridPaneCheque.setVisible(false);
|
||||
GridPaneCarte.setVisible(true);
|
||||
frais.setPaiement("2");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//ajouter un nouvelle catégorie
|
||||
@FXML
|
||||
private void AfficherAjouterFraisButtonAction(ActionEvent event) throws IOException
|
||||
{
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(400), StackPaneSucces);
|
||||
ft.setFromValue(1.0);
|
||||
ft.setToValue(0.0);
|
||||
ft.setOnFinished(new EventHandler<ActionEvent>() {
|
||||
//message de succés
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Caisse/FraisAjouter.fxml"));
|
||||
Parent NodeDetail = (Parent)fxmlLoader.load();
|
||||
PaneAjouterFrais.getChildren().add(NodeDetail);
|
||||
} catch (IOException ex) {
|
||||
logger.error("FraisAjouterController : AfficherAjouterFraisButtonAction : FraisAjouter.fxml : " + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
ft.play();
|
||||
}
|
||||
|
||||
}
|
||||
158
src/main/java/Controllers/Caisse/FraisDetailController.java
Normal file
158
src/main/java/Controllers/Caisse/FraisDetailController.java
Normal file
@@ -0,0 +1,158 @@
|
||||
package Controllers.Caisse;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Models.Caisse.Frais;
|
||||
import Models.Caisse.FraisDB;
|
||||
import Models.Reglement.Reglement;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.ProgressIndicator;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.web.HTMLEditor;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher
|
||||
*/
|
||||
public class FraisDetailController {
|
||||
|
||||
public Node nodeFxml ;
|
||||
|
||||
@FXML public AnchorPane AnchorPrincipal ;
|
||||
|
||||
@FXML public AnchorPane PaneDetailFrais;
|
||||
|
||||
@FXML private Text TextMontant;
|
||||
@FXML private Text TextPaiement;
|
||||
@FXML private Text TextChequeNumero;
|
||||
@FXML private Text TextChequeBanque;
|
||||
@FXML private Text TextChequeDate;
|
||||
@FXML private Text TextCarteTransation;
|
||||
@FXML private Text TextCarteBanque;
|
||||
@FXML private Text TextPersonne;
|
||||
@FXML private Text TextDateCreation;
|
||||
@FXML private Text TextProfile;
|
||||
@FXML private Text TextObject;
|
||||
|
||||
@FXML private GridPane GridPaneCheque;
|
||||
@FXML private GridPane GridPaneCarte;
|
||||
|
||||
@FXML private TextArea TextAreaContext ;
|
||||
|
||||
@FXML private ProgressIndicator ProgressFrais;
|
||||
|
||||
private Service<Void> ThreadFraisDetail;
|
||||
|
||||
Frais frais = new Frais();
|
||||
|
||||
public FraisDetailController(){
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Caisse/FraisDetail.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
nodeFxml = (Node) fxmlLoader.load();
|
||||
} catch (Exception ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void setFrais(Frais frais){
|
||||
TextMontant.setText(frais.getMontant());
|
||||
TextPaiement.setText(frais.getPaiementString());
|
||||
|
||||
if(frais.getPaiement().equals("1")){
|
||||
GridPaneCheque.setVisible(true);
|
||||
TextChequeNumero.setText(frais.getNumero());
|
||||
TextChequeBanque.setText(frais.getBanque());
|
||||
TextChequeDate.setText(frais.getDateCheque());
|
||||
}
|
||||
|
||||
if(frais.getPaiement().equals("2")){
|
||||
GridPaneCarte.setVisible(true);
|
||||
TextCarteTransation.setText(frais.getNumero());
|
||||
TextCarteBanque.setText(frais.getBanque());
|
||||
}
|
||||
|
||||
TextPersonne.setText(frais.getPersonne());
|
||||
TextDateCreation.setText(frais.getDateCreation());
|
||||
TextProfile.setText(frais.getProfile());
|
||||
TextObject.setText(frais.getObject());
|
||||
if(frais.getContext() != null){
|
||||
if(!frais.getContext().equals("")){
|
||||
TextAreaContext.setText(frais.getContext());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void LanchShowFrais(final String IdFrais){
|
||||
|
||||
ThreadFraisDetail = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
frais = new FraisDB().getFrais(IdFrais);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadFraisDetail.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
setFrais(frais);
|
||||
ProgressFrais.setVisible(false);
|
||||
PaneDetailFrais.setVisible(true);
|
||||
}
|
||||
});
|
||||
ThreadFraisDetail.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
private void ExitButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPrincipal.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Show()
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(nodeFxml);
|
||||
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
}
|
||||
424
src/main/java/Controllers/Caisse/FraisGestionController.java
Normal file
424
src/main/java/Controllers/Caisse/FraisGestionController.java
Normal file
@@ -0,0 +1,424 @@
|
||||
package Controllers.Caisse;
|
||||
|
||||
import Models.Caisse.Frais;
|
||||
import Models.Caisse.FraisDB;
|
||||
import Models.Stock.StockDB;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher
|
||||
*/
|
||||
public class FraisGestionController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane PaneGestionFrais ;
|
||||
|
||||
@FXML private TextField TextFieldCodeFrais;
|
||||
@FXML private TextField TextFieldObject;
|
||||
@FXML private TextField TextFieldPresonne;
|
||||
|
||||
@FXML private ComboBox ComboBoxLocale ;
|
||||
@FXML private ComboBox ComboBoxPaiement;
|
||||
@FXML private DatePicker DatePickerCreate;
|
||||
|
||||
@FXML private ProgressBar ProgressBarFraisGestion;
|
||||
@FXML private Button ButtonSearchFraisGestion;
|
||||
|
||||
@FXML private TableView<Frais> TableViewFrais;
|
||||
@FXML private TableColumn<Frais ,String> TabColIdFrais;
|
||||
@FXML private TableColumn<Frais ,String> TabColMontant;
|
||||
@FXML private TableColumn<Frais ,String> TabColObject;
|
||||
@FXML private TableColumn<Frais ,String> TabColDateCreation;
|
||||
@FXML private TableColumn<Frais ,String> TabColPaiement;
|
||||
@FXML private TableColumn<Frais ,String> TabColProfile;
|
||||
@FXML private TableColumn<Frais ,String> TabColLocalNom;
|
||||
@FXML private TableColumn<Frais ,Boolean>TabColDetail ;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount ;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
private Service<Void> ThreadSearchFraisGestion;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
ComboBoxLocale.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
@Override
|
||||
public void handle(MouseEvent t) {
|
||||
if(ComboBoxLocale.getItems().size() == 0){
|
||||
ComboBoxLocale.getItems().addAll(new StockDB().getAllListLocal());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//0:Espèce 1:Chèque 2 :carte bancaire
|
||||
ComboBoxPaiement.setItems(FXCollections.observableArrayList("Espèces","Chèque","Carte Bancaire"));
|
||||
|
||||
TabColIdFrais.setStyle( "-fx-alignment: CENTER;");TabColIdFrais.getStyleClass().add("Center");
|
||||
TabColIdFrais.setCellValueFactory(new PropertyValueFactory<Frais, String>("IdFrais"));
|
||||
|
||||
TabColMontant.setStyle( "-fx-alignment: CENTER;");TabColMontant.getStyleClass().add("Center");
|
||||
TabColMontant.setCellValueFactory(new PropertyValueFactory<Frais, String>("Montant"));
|
||||
|
||||
TabColObject.setStyle( "-fx-alignment: CENTER;");TabColObject.getStyleClass().add("Center");
|
||||
TabColObject.setCellValueFactory(new PropertyValueFactory<Frais, String>("Object"));
|
||||
|
||||
TabColDateCreation.setStyle( "-fx-alignment: CENTER;");TabColDateCreation.getStyleClass().add("Center");
|
||||
TabColDateCreation.setCellValueFactory(new PropertyValueFactory<Frais, String>("DateCreation"));
|
||||
|
||||
TabColPaiement.setStyle( "-fx-alignment: CENTER;");TabColPaiement.getStyleClass().add("Center");
|
||||
TabColPaiement.setCellValueFactory(new PropertyValueFactory<Frais, String>("Paiement"));
|
||||
TabColPaiement.setCellFactory(new Callback<TableColumn<Frais,String>,TableCell<Frais,String>>(){
|
||||
@Override
|
||||
public TableCell<Frais, String> call(TableColumn<Frais, String> param) {
|
||||
TableCell<Frais, String> cell = new TableCell<Frais, String>(){
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
////0 :espace 1:Chèque 2 :carte bancaire
|
||||
if(item!=null && item.equals("0")){
|
||||
Text text = new Text("Espèce");
|
||||
text.setFont(Font.font("Arial", FontWeight.NORMAL, 14));
|
||||
setGraphic(text);
|
||||
}else if(item!=null && item.equals("1")){
|
||||
Text text = new Text("Chèque");
|
||||
text.setFont(Font.font("Arial", FontWeight.NORMAL, 14));
|
||||
setGraphic(text);
|
||||
}else if(item!=null && item.equals("2")){
|
||||
Text text = new Text("Carte Bancaire");
|
||||
text.setFont(Font.font("Arial", FontWeight.NORMAL, 14));
|
||||
setGraphic(text);
|
||||
}else{
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
TabColProfile.setStyle( "-fx-alignment: CENTER;");TabColProfile.getStyleClass().add("Center");
|
||||
TabColProfile.setCellValueFactory(new PropertyValueFactory<Frais, String>("Profile"));
|
||||
|
||||
TabColLocalNom.setStyle( "-fx-alignment: CENTER;");TabColLocalNom.getStyleClass().add("Center");
|
||||
TabColLocalNom.setCellValueFactory(new PropertyValueFactory<Frais, String>("LocalNom"));
|
||||
|
||||
TabColDetail.setSortable(true);
|
||||
TabColDetail.setStyle( "-fx-alignment: CENTER;");TabColDetail.getStyleClass().add("Center");
|
||||
TabColDetail.setCellFactory(new Callback<TableColumn<Frais, Boolean>, TableCell<Frais, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<Frais, Boolean> call(TableColumn<Frais, Boolean> personBooleanTableColumn) {
|
||||
return new ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ButtonSearchFraisGestion.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchFraisGestion();
|
||||
}
|
||||
});
|
||||
|
||||
PaneGestionFrais.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchFraisGestion();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
GestionSearchFournisseur();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Define the button cell
|
||||
private class ButtonCell extends TableCell<Frais, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/detailbutton.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){ //Action when the button is pressed
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
Frais frais = ((Frais)getTableRow().getItem());
|
||||
FraisDetailController FraisDetail = new FraisDetailController();
|
||||
FraisDetail.LanchShowFrais(frais.getIdFrais());
|
||||
FraisDetail.Show();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void AjouterFraisButtonAction(ActionEvent event) throws IOException {
|
||||
PaneGestionFrais.getChildren().clear();
|
||||
PaneGestionFrais.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Caisse/FraisAjouter.fxml")));
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchFraisGestion()
|
||||
{
|
||||
ProgressBarFraisGestion.setVisible(true);
|
||||
|
||||
ButtonSearchFraisGestion.setDisable(true);
|
||||
|
||||
ThreadSearchFraisGestion = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DateCreation = "";
|
||||
if(DatePickerCreate.getValue() != null){
|
||||
DateCreation = DatePickerCreate.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<Frais> ListFraisGestions = new FraisDB().SearchFraisGestion(
|
||||
position,
|
||||
nbrligne,
|
||||
TextFieldCodeFrais.getText(),
|
||||
TextFieldObject.getText(),
|
||||
TextFieldPresonne.getText(),
|
||||
(String) ComboBoxLocale.getValue(),
|
||||
(String) ComboBoxPaiement.getValue(),
|
||||
DateCreation);
|
||||
|
||||
TableViewFrais.setItems(ListFraisGestions);
|
||||
|
||||
totalcount = new FraisDB().nbrFraisGestion(TextFieldCodeFrais.getText(), TextFieldObject.getText(), TextFieldPresonne.getText(), (String) ComboBoxLocale.getValue(), (String) ComboBoxPaiement.getValue(), DateCreation);
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchFraisGestion.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarFraisGestion.setVisible(false);
|
||||
ButtonSearchFraisGestion.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchFraisGestion.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchFraisGestion(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarFraisGestion.setVisible(true);
|
||||
|
||||
ButtonSearchFraisGestion.setDisable(true);
|
||||
|
||||
ThreadSearchFraisGestion = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateCreation = "";
|
||||
if(DatePickerCreate.getValue() != null){
|
||||
DateCreation = DatePickerCreate.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<Frais> ListFraisGestions = new FraisDB().SearchFraisGestion(ParmPosition, ParamNbrligne, TextFieldCodeFrais.getText(), TextFieldObject.getText(), TextFieldPresonne.getText(), (String) ComboBoxLocale.getValue(), (String) ComboBoxPaiement.getValue(), DateCreation);
|
||||
|
||||
TableViewFrais.setItems(ListFraisGestions);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchFraisGestion.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarFraisGestion.setVisible(false);
|
||||
ButtonSearchFraisGestion.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchFraisGestion.start();
|
||||
}
|
||||
|
||||
private void GestionSearchFournisseur()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchFraisGestion(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchFraisGestion(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchFraisGestion(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchFraisGestion(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchFraisGestion(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package Controllers.Categorie;
|
||||
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Models.Categorie.Categorie;
|
||||
import Models.Categorie.CategorieDB;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.ToggleGroup;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class AjouterCategorieController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(AjouterCategorieController.class.getName());
|
||||
|
||||
public Node nodeFxml ;
|
||||
|
||||
@FXML public AnchorPane AnchorPrincipal ;
|
||||
|
||||
@FXML public TextField NomCategorie ;
|
||||
@FXML private Text erreurCategorie ;
|
||||
@FXML public ToggleGroup unite ;
|
||||
@FXML private RadioButton piece ;
|
||||
@FXML private RadioButton kilo;
|
||||
@FXML private RadioButton metre;
|
||||
@FXML private RadioButton litre;
|
||||
@FXML public Button ButtonAjouterCategory ;
|
||||
|
||||
Categorie categorie = new Categorie();
|
||||
CategorieDB dbcategorie = new CategorieDB();
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
piece.setUserData("0");
|
||||
kilo.setUserData("1");
|
||||
metre.setUserData("2");
|
||||
litre.setUserData("3");
|
||||
}
|
||||
|
||||
|
||||
public AjouterCategorieController(){
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Categorie/AjouterCategorie.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
nodeFxml = (Node) fxmlLoader.load();
|
||||
} catch (IOException ex) {
|
||||
logger.error("AjouterCategorieController : AjouterCategorie.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public String AjouterCategorieTraitement(){
|
||||
if(NomCategorie.getText().length()==0){ //catégorie est vide
|
||||
erreurCategorie.setText("catégorie vide");
|
||||
NomCategorie.setStyle("-fx-border-color:#f20606;");
|
||||
}
|
||||
else if(dbcategorie.verifyCategorie(NomCategorie.getText())){
|
||||
erreurCategorie.setText("catégorie existe déjà");
|
||||
NomCategorie.setStyle("-fx-border-color:#f20606;");
|
||||
}
|
||||
else{
|
||||
erreurCategorie.setText("");
|
||||
NomCategorie.setStyle("-fx-border-color: transparent;");
|
||||
categorie.setNomcategorie(NomCategorie.getText());
|
||||
categorie.setUnitemesure(Integer.parseInt(unite.getSelectedToggle().getUserData().toString()));
|
||||
if(dbcategorie.addCategorie(categorie)){
|
||||
AnchorPrincipal.setVisible(false);
|
||||
return NomCategorie.getText();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void AnnulerCategorieButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPrincipal.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
public void Show()
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(nodeFxml);
|
||||
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,323 @@
|
||||
|
||||
package Controllers.ChequeClt;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Models.ChequeClt.ChequeClt;
|
||||
import Models.ChequeClt.ChequeCltDB;
|
||||
import Models.ChequeClt.ChequeCltHistoriqueListe;
|
||||
import java.io.IOException;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ProgressIndicator;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher
|
||||
*/
|
||||
public class ChequeCltDetailController {
|
||||
|
||||
Logger logger = Logger.getLogger(ChequeCltDetailController.class.getName());
|
||||
|
||||
@FXML public AnchorPane AnchorPrincipal ;
|
||||
@FXML private AnchorPane AnchorSecondaire;
|
||||
|
||||
@FXML private ProgressIndicator ProgressCheque;
|
||||
|
||||
@FXML private Text TextTypeClt;
|
||||
@FXML private Text TextCode;
|
||||
@FXML private Text TextNom;
|
||||
@FXML private Text TextPrenom;
|
||||
@FXML private Text TextTele1;
|
||||
@FXML private Text TextTele2;
|
||||
@FXML private Text TextAdress;
|
||||
|
||||
@FXML private Text TextNumCheque1;
|
||||
@FXML private Text TextNumCheque2;
|
||||
@FXML private Text TextBanque;
|
||||
@FXML private Text TextDateCheque;
|
||||
@FXML private Text TextMontant;
|
||||
@FXML private Text TextFacture;
|
||||
@FXML private Text TextUtilisateur;
|
||||
|
||||
@FXML private RadioButton RadioVerser;
|
||||
@FXML private RadioButton RadioSansProvision;
|
||||
@FXML private RadioButton RadioContreCheque;
|
||||
|
||||
@FXML private Button UpdateEtatButton;
|
||||
@FXML public Button ButtonExitChequeCltDetail;
|
||||
|
||||
@FXML public TableView<ChequeCltHistoriqueListe> TableViewChequeCltHistorique;
|
||||
|
||||
@FXML public TableColumn<ChequeCltHistoriqueListe ,String> TabColDate;
|
||||
@FXML public TableColumn<ChequeCltHistoriqueListe ,String> TabColHeur;
|
||||
@FXML public TableColumn<ChequeCltHistoriqueListe ,Integer> TabColEtat;
|
||||
@FXML public TableColumn<ChequeCltHistoriqueListe ,String> TabColUtili;
|
||||
|
||||
public Node nodeFxml;
|
||||
public String IdChequeClt;
|
||||
public String LastEtat;
|
||||
public Integer Source;
|
||||
ChequeClt Cheque = new ChequeClt();
|
||||
|
||||
public ChequeCltDetailController(){
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/ChequeClt/ChequeCltDetail.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
nodeFxml = (Node) fxmlLoader.load();
|
||||
} catch (IOException ex) {
|
||||
logger.error("ChequeCltDetailController : ChequeCltDetail.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(nodeFxml);
|
||||
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void ControleUpdateEtatButton(){
|
||||
|
||||
if(Cheque.getLastEtat() != null){
|
||||
if(Cheque.getLastEtat() == 2){
|
||||
UpdateEtatButton.setDisable(true);
|
||||
}else{
|
||||
RadioVerser.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
if(Cheque.getLastEtat() == 1){
|
||||
UpdateEtatButton.setDisable(true);
|
||||
}else if((Cheque.getLastEtat() == 0) || (Cheque.getLastEtat() == 1)){
|
||||
UpdateEtatButton.setDisable(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
RadioSansProvision.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
if(Cheque.getLastEtat() == 0){
|
||||
UpdateEtatButton.setDisable(true);
|
||||
}else if((Cheque.getLastEtat() == 1) || (Cheque.getLastEtat() == 2)){
|
||||
UpdateEtatButton.setDisable(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void Initialize(String id_cheque, Integer source) {
|
||||
IdChequeClt = id_cheque;
|
||||
Source = source;// 0==>Cheque(table cheque_clt) 1==>Traite(table traite_paiement_cheque_clt)
|
||||
|
||||
TabColDate.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDate.getStyleClass().add("Center");
|
||||
TabColDate.setCellValueFactory(new PropertyValueFactory<ChequeCltHistoriqueListe, String>("DateOperation"));
|
||||
|
||||
TabColHeur.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColHeur.getStyleClass().add("Center");
|
||||
TabColHeur.setCellValueFactory(new PropertyValueFactory<ChequeCltHistoriqueListe, String>("HeurOperation"));
|
||||
|
||||
TabColEtat.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColEtat.getStyleClass().add("Center");
|
||||
TabColEtat.setCellValueFactory(new PropertyValueFactory("Etat"));
|
||||
TabColEtat.setCellValueFactory(new PropertyValueFactory<ChequeCltHistoriqueListe, Integer>("Etat"));
|
||||
TabColEtat.setCellFactory(new Callback<TableColumn<ChequeCltHistoriqueListe,Integer>,TableCell<ChequeCltHistoriqueListe,Integer>>(){
|
||||
@Override
|
||||
public TableCell<ChequeCltHistoriqueListe, Integer> call(TableColumn<ChequeCltHistoriqueListe, Integer> param) {
|
||||
TableCell<ChequeCltHistoriqueListe, Integer> cell = new TableCell<ChequeCltHistoriqueListe, Integer>(){
|
||||
@Override
|
||||
public void updateItem(Integer item, boolean empty) {
|
||||
// 0 cheque sans provision 1 Verser (Valider) 2 Contre chéque(espace)
|
||||
if(item!= null && item == 0){
|
||||
Text text = new Text("chèque sans provision");
|
||||
text.setFill(Color.web("#EA4335"));
|
||||
text.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||
setGraphic(text);
|
||||
}else if(item!= null && item == 1){
|
||||
Text text = new Text("verser");
|
||||
text.setFill(Color.web("#428BCA"));
|
||||
text.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||
setGraphic(text);
|
||||
}else if(item!= null && item == 2){
|
||||
Text text = new Text("contre chèque");
|
||||
text.setFill(Color.web("#34A853"));
|
||||
text.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||
setGraphic(text);
|
||||
}else{
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
TabColUtili.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColUtili.getStyleClass().add("Center");
|
||||
TabColUtili.setCellValueFactory(new PropertyValueFactory<ChequeCltHistoriqueListe, String>("Utilisateur"));
|
||||
|
||||
ButtonUpdateEtatAction();
|
||||
|
||||
startTask();
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void startTask(){
|
||||
|
||||
ProgressCheque.setVisible(true);
|
||||
AnchorSecondaire.setVisible(false);
|
||||
|
||||
// Create a Runnable
|
||||
Runnable task = new Runnable(){
|
||||
public void run(){
|
||||
Platform.runLater(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
SetIdChequeClt();
|
||||
ProgressCheque.setVisible(false);
|
||||
AnchorSecondaire.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Thread backgroundThread = new Thread(task);// Run the task in a background thread
|
||||
backgroundThread.setDaemon(true);// Terminate the running thread if the application exits
|
||||
backgroundThread.start();// Start the thread
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void SetIdChequeClt(){
|
||||
ChequeCltDB ChequeDB = new ChequeCltDB();
|
||||
Cheque = ChequeDB.getChequeClt(IdChequeClt, Source);
|
||||
|
||||
Integer TypeClt = Cheque.getTypeClient();
|
||||
if(TypeClt == 0){
|
||||
TextTypeClt.setText("Ancien");
|
||||
TextCode.setText(Cheque.getCltPersonne().getCodeclient());
|
||||
TextNom.setText(Cheque.getCltPersonne().getNom());
|
||||
TextPrenom.setText(Cheque.getCltPersonne().getPrenom());
|
||||
TextTele1.setText(Cheque.getCltPersonne().getTelefixString());
|
||||
TextTele2.setText(Cheque.getCltPersonne().getTelemobileString());
|
||||
TextAdress.setText(Cheque.getCltPersonne().getAdresse());
|
||||
}else if(TypeClt == 1){
|
||||
TextTypeClt.setText("Entreprise");
|
||||
TextCode.setText(Cheque.getCltEntreprise().getCodeString());
|
||||
TextNom.setText(Cheque.getCltEntreprise().getNom());
|
||||
TextPrenom.setText(Cheque.getCltEntreprise().getMatricule());
|
||||
TextTele1.setText(Cheque.getCltEntreprise().getTele1String());
|
||||
TextTele2.setText(Cheque.getCltEntreprise().getTele2String());
|
||||
TextAdress.setText(Cheque.getCltEntreprise().getAdresse());
|
||||
}else if(TypeClt == 2){
|
||||
TextTypeClt.setText("Passager");
|
||||
TextCode.setText(Cheque.getCltPassager().getCodeclient());
|
||||
TextNom.setText(Cheque.getCltPassager().getNom());
|
||||
TextPrenom.setText(Cheque.getCltPassager().getPrenom());
|
||||
TextTele1.setText(Cheque.getCltPassager().getTelefixString());
|
||||
TextTele2.setText(Cheque.getCltPassager().getTelemobileString());
|
||||
TextAdress.setText(Cheque.getCltPassager().getAdresse());
|
||||
}
|
||||
|
||||
TextNumCheque1.setText(Cheque.getNumeroChequeClt());
|
||||
TextNumCheque2.setText(Cheque.getNumeroChequeClt());
|
||||
TextBanque.setText(Cheque.getBanqueChequeClt());
|
||||
TextDateCheque.setText(Cheque.getDatePaiement());
|
||||
TextMontant.setText(Adaptateur.FloatToStringEspaceCurrency(Cheque.getMontantFloatChequeClt()));
|
||||
TextFacture.setText(Cheque.getCodeFactureClt());
|
||||
TextUtilisateur.setText(Cheque.getProfile().getNom()+" "+Cheque.getProfile().getPrenom());
|
||||
|
||||
//Etat 0 cheque sans provision 1 Verser (Valider) 2 Contre chéque(espace)
|
||||
if(Cheque.getLastEtat() != null){
|
||||
if(Cheque.getLastEtat() == 1){
|
||||
RadioVerser.setSelected(true);
|
||||
UpdateEtatButton.setDisable(true);
|
||||
}else if(Cheque.getLastEtat() == 0){
|
||||
RadioSansProvision.setSelected(true);
|
||||
UpdateEtatButton.setDisable(true);
|
||||
}else if(Cheque.getLastEtat() == 2){
|
||||
RadioContreCheque.setSelected(true);
|
||||
UpdateEtatButton.setDisable(true);
|
||||
}
|
||||
}
|
||||
|
||||
ObservableList<ChequeCltHistoriqueListe> ObservableListHistChequeClt = Cheque.getHistoriqueListe();
|
||||
Integer LastListHistCheque = ObservableListHistChequeClt.size()-1;
|
||||
if(LastListHistCheque>=0){
|
||||
LastEtat = ObservableListHistChequeClt.get(LastListHistCheque).getEtat().toString();
|
||||
}
|
||||
|
||||
TableViewChequeCltHistorique.setItems(ObservableListHistChequeClt);
|
||||
|
||||
ControleUpdateEtatButton();
|
||||
}
|
||||
|
||||
|
||||
public void ButtonUpdateEtatAction(){
|
||||
UpdateEtatButton.setOnAction(new EventHandler<ActionEvent>() { //supprimer le message du suucés et reaficher les formulaires
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
boolean isSelectedVerser = RadioVerser.isSelected();
|
||||
boolean isSelectedProvision = RadioSansProvision.isSelected();
|
||||
boolean isSelectedContre = RadioContreCheque.isSelected();
|
||||
|
||||
ChequeCltDB ChequeDB = new ChequeCltDB();
|
||||
|
||||
//Etat 0 cheque sans provision 1 Verser (Valider) 2 Contre chéque(espace)
|
||||
//Source 0==>Cheque(table cheque_clt) 1==>Traite(table traite_paiement_cheque_clt)
|
||||
if(isSelectedVerser == true){
|
||||
ChequeDB.setHistoriqueCheque(1, Source, Cheque);
|
||||
}else if(isSelectedProvision == true){
|
||||
ChequeDB.setHistoriqueCheque(0, Source, Cheque);
|
||||
}else if(isSelectedContre == true){
|
||||
ChequeDB.setHistoriqueCheque(2, Source, Cheque);
|
||||
}
|
||||
startTask();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,484 @@
|
||||
package Controllers.ChequeClt;
|
||||
|
||||
import Models.ChequeClt.ChequeCltDB;
|
||||
import Models.ChequeClt.ChequeCltGestionListe;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class ChequeCltGestionController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane PaneChequeCltGestion;
|
||||
|
||||
@FXML private ProgressBar ProgressBarChequeCltGestion;
|
||||
|
||||
@FXML private Button ButtonSearchChequeCltGestion;
|
||||
|
||||
@FXML public TableView<ChequeCltGestionListe> TableViewChequeCltGestion ;
|
||||
|
||||
@FXML private TableColumn TabColChequeClt;
|
||||
@FXML private TableColumn TabColClient;
|
||||
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColNumeroCheque;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColBanque;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColDateCheque;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColMontant;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColCodeClt;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColTypeClt;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColNomClt;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColPrenomClt;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColIdFacture;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColEtat;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,Boolean> TabColDetail;
|
||||
|
||||
@FXML private TextField TextFieldNumeroCheque ;
|
||||
@FXML private TextField TextFieldBanque ;
|
||||
@FXML private TextField TextFieldCodeClt ;
|
||||
@FXML private TextField TextFieldCINClt ;
|
||||
@FXML private TextField TextFieldNomClt ;
|
||||
@FXML private TextField TextFieldPrenomClt;
|
||||
@FXML private TextField TextFieldIdFacture ;
|
||||
|
||||
@FXML private DatePicker DatePickerCheque ;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
private Service<Void> ThreadSearchChequeCltGestion;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
TabColChequeClt.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt; -fx-border-color: #4DAE4D;");
|
||||
TabColChequeClt.getStyleClass().add("Center");
|
||||
|
||||
TabColClient.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt; -fx-border-color:#428BCA;");
|
||||
TabColClient.getStyleClass().add("Center");
|
||||
|
||||
TabColNumeroCheque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("NumeroCheque"));
|
||||
TabColNumeroCheque.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNumeroCheque.getStyleClass().add("Center");
|
||||
|
||||
TabColBanque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("Banque"));
|
||||
TabColBanque.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColBanque.getStyleClass().add("Center");
|
||||
|
||||
TabColDateCheque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("DateCheque"));
|
||||
TabColDateCheque.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDateCheque.getStyleClass().add("Center");
|
||||
|
||||
TabColMontant.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("Montant"));
|
||||
TabColMontant.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColMontant.getStyleClass().add("Center");
|
||||
|
||||
TabColCodeClt.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("CodeClt"));
|
||||
TabColCodeClt.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt; ");
|
||||
TabColCodeClt.getStyleClass().add("Center");
|
||||
|
||||
TabColTypeClt.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("TypeClt"));
|
||||
TabColTypeClt.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTypeClt.getStyleClass().add("Center");
|
||||
|
||||
TabColNomClt.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("NomClt"));
|
||||
TabColNomClt.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNomClt.getStyleClass().add("Center");
|
||||
|
||||
TabColPrenomClt.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("PrenomClt"));
|
||||
TabColPrenomClt.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColPrenomClt.getStyleClass().add("Center");
|
||||
|
||||
TabColIdFacture.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("IdFacture"));
|
||||
TabColIdFacture.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColIdFacture.getStyleClass().add("Center");
|
||||
|
||||
TabColEtat.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("Etat"));
|
||||
TabColEtat.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColEtat.getStyleClass().add("Center");
|
||||
|
||||
TabColEtat.setCellFactory(new Callback<TableColumn<ChequeCltGestionListe,String>,TableCell<ChequeCltGestionListe,String>>(){
|
||||
@Override
|
||||
public TableCell<ChequeCltGestionListe, String> call(TableColumn<ChequeCltGestionListe, String> param) {
|
||||
TableCell<ChequeCltGestionListe, String> cell = new TableCell<ChequeCltGestionListe, String>(){
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
if(item!=null && item.equals("0")){
|
||||
Text text = new Text("sans provision");
|
||||
text.setFill(Color.web("#ff0000"));
|
||||
text.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||
setGraphic(text);
|
||||
}else if(item!=null && item.equals("1")){
|
||||
Text text = new Text("verser");
|
||||
text.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||
setGraphic(text);
|
||||
}else if(item!=null && item.equals("2")){
|
||||
Text text = new Text("contre chèque");
|
||||
text.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||
setGraphic(text);
|
||||
}else{
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
TabColDetail.setStyle( "-fx-alignment: CENTER;");TabColDetail.getStyleClass().add("Center");
|
||||
TabColDetail.setCellFactory(new Callback<TableColumn<ChequeCltGestionListe, Boolean>, TableCell<ChequeCltGestionListe, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<ChequeCltGestionListe, Boolean> call(TableColumn<ChequeCltGestionListe, Boolean> personBooleanTableColumn) {
|
||||
return new ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
ButtonSearchChequeCltGestion.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchChequeCltGestion();
|
||||
}
|
||||
});
|
||||
|
||||
PaneChequeCltGestion.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchChequeCltGestion();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SearchChequeCltGestion();
|
||||
|
||||
GestionSearchChequeClt();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void ChequeCltVerserButtonAction(ActionEvent event) throws IOException {
|
||||
PaneChequeCltGestion.getChildren().clear();
|
||||
PaneChequeCltGestion.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/ChequeClt/ChequeCltVercer.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void ChequeCltProvisionButtonAction(ActionEvent event) throws IOException {
|
||||
PaneChequeCltGestion.getChildren().clear();
|
||||
PaneChequeCltGestion.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/ChequeClt/ChequeCltProvision.fxml")));
|
||||
}
|
||||
|
||||
|
||||
private class ButtonCell extends TableCell<ChequeCltGestionListe, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/detailbutton.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){ //Action when the button is pressed
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
final ChequeCltGestionListe current = (ChequeCltGestionListe) ButtonCell.this.getTableView().getItems().get(ButtonCell.this.getIndex());
|
||||
String IdChequeClt = current.getIdCheque();
|
||||
Integer Source = current.getSource();
|
||||
|
||||
final ChequeCltDetailController ChequeCltDetail = new ChequeCltDetailController();
|
||||
ChequeCltDetail.Show();
|
||||
ChequeCltDetail.Initialize(IdChequeClt, Source);
|
||||
|
||||
ChequeCltDetail.ButtonExitChequeCltDetail.setOnAction(new EventHandler<ActionEvent>() { //supprimer le message du suucés et reaficher les formulaires
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
ChequeCltDetail.AnchorPrincipal.setVisible(false);
|
||||
if(ChequeCltDetail.LastEtat != null){
|
||||
ObservableList<ChequeCltGestionListe> DataListChequeClt = ButtonCell.this.getTableView().getItems();
|
||||
DataListChequeClt.get(ButtonCell.this.getIndex()).setEtat(ChequeCltDetail.LastEtat);
|
||||
TableViewChequeCltGestion.setItems(DataListChequeClt);
|
||||
|
||||
//actualiser la ligne
|
||||
TabColEtat.setVisible(false);
|
||||
TabColEtat.setVisible(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchChequeCltGestion()
|
||||
{
|
||||
ProgressBarChequeCltGestion.setVisible(true);
|
||||
|
||||
ButtonSearchChequeCltGestion.setDisable(true);
|
||||
|
||||
ThreadSearchChequeCltGestion = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DateCheque = "";
|
||||
if(DatePickerCheque.getValue() != null){
|
||||
DateCheque = DatePickerCheque.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<ChequeCltGestionListe> ListChequeCltGestions = new ChequeCltDB().SearchChequeCltGestion(
|
||||
position,
|
||||
nbrligne,
|
||||
TextFieldNumeroCheque.getText(),
|
||||
TextFieldBanque.getText(),
|
||||
DateCheque,
|
||||
TextFieldCodeClt.getText(),
|
||||
TextFieldCINClt.getText(),
|
||||
TextFieldIdFacture.getText(),
|
||||
TextFieldNomClt.getText(),
|
||||
TextFieldPrenomClt.getText());
|
||||
|
||||
TableViewChequeCltGestion.setItems(ListChequeCltGestions);
|
||||
|
||||
totalcount = new ChequeCltDB().nbrChequeCltGestion(TextFieldNumeroCheque.getText(),
|
||||
TextFieldBanque.getText(),
|
||||
DateCheque,
|
||||
TextFieldCodeClt.getText(),
|
||||
TextFieldCINClt.getText(),
|
||||
TextFieldIdFacture.getText(),
|
||||
TextFieldNomClt.getText(),
|
||||
TextFieldPrenomClt.getText());
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchChequeCltGestion.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarChequeCltGestion.setVisible(false);
|
||||
ButtonSearchChequeCltGestion.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchChequeCltGestion.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchChequeCltGestion(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarChequeCltGestion.setVisible(true);
|
||||
|
||||
ButtonSearchChequeCltGestion.setDisable(true);
|
||||
|
||||
ThreadSearchChequeCltGestion = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateCheque = "";
|
||||
if(DatePickerCheque.getValue() != null){
|
||||
DateCheque = DatePickerCheque.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<ChequeCltGestionListe> ListChequeCltGestions = new ChequeCltDB().SearchChequeCltGestion(ParmPosition, ParamNbrligne, TextFieldNumeroCheque.getText(), TextFieldBanque.getText(), DateCheque, TextFieldCodeClt.getText(), TextFieldCINClt.getText(), TextFieldIdFacture.getText(), TextFieldNomClt.getText(), TextFieldPrenomClt.getText());
|
||||
|
||||
TableViewChequeCltGestion.setItems(ListChequeCltGestions);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchChequeCltGestion.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarChequeCltGestion.setVisible(false);
|
||||
ButtonSearchChequeCltGestion.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchChequeCltGestion.start();
|
||||
}
|
||||
|
||||
private void GestionSearchChequeClt()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchChequeCltGestion(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchChequeCltGestion(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchChequeCltGestion(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchChequeCltGestion(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchChequeCltGestion(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,466 @@
|
||||
package Controllers.ChequeClt;
|
||||
|
||||
import Controllers.TraiteClt.TraiteCltPrintRetardController;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Models.ChequeClt.ChequeCltDB;
|
||||
import Models.ChequeClt.ChequeCltGestionListe;
|
||||
import Models.Stock.StockDB;
|
||||
import Models.TraiteClt.TraiteCltDB;
|
||||
import Models.TraiteClt.TraiteCltGestionListe;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.print.PageLayout;
|
||||
import javafx.print.PageOrientation;
|
||||
import javafx.print.PageRange;
|
||||
import javafx.print.Paper;
|
||||
import javafx.print.Printer;
|
||||
import javafx.print.PrinterJob;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class ChequeCltProvisionController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneChequeCltProvision;
|
||||
|
||||
@FXML private ProgressBar ProgressBarChequeCltProvision;
|
||||
|
||||
@FXML private Button ButtonSearchChequeCltProvision;
|
||||
@FXML private Button ButtonPrintChequeCltProvision;
|
||||
|
||||
@FXML private TableView<ChequeCltGestionListe> TableViewChequeCltAvercer ;
|
||||
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColNumeroCheque;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColBanque;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColDateCheque;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColMontant;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColTypeClt;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColNomClt;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColPrenomClt;
|
||||
|
||||
@FXML private DatePicker DatePickerCheque ;
|
||||
@FXML private ChoiceBox ChoiceBoxLocal ;
|
||||
|
||||
@FXML private TextField TextFieldBanque ;
|
||||
@FXML private TextField TextFieldCodeClt ;
|
||||
@FXML private TextField TextFieldCINClt ;
|
||||
@FXML private TextField TextFieldNomPrenomClt ;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
ObservableList<ChequeCltGestionListe> ListPrintChequeCltProvision;
|
||||
|
||||
private Service<Void> ThreadSearchChequeCltProvision;
|
||||
private Service<Void> ThreadPrintChequeCltProvision;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
TabColNumeroCheque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("NumeroCheque"));
|
||||
TabColNumeroCheque.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNumeroCheque.getStyleClass().add("Center");
|
||||
|
||||
TabColBanque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("Banque"));
|
||||
TabColBanque.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColBanque.getStyleClass().add("Center");
|
||||
|
||||
TabColDateCheque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("DateCheque"));
|
||||
TabColDateCheque.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDateCheque.getStyleClass().add("Center");
|
||||
|
||||
TabColMontant.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("Montant"));
|
||||
TabColMontant.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColMontant.getStyleClass().add("Center");
|
||||
|
||||
TabColTypeClt.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("TypeClt"));
|
||||
TabColTypeClt.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTypeClt.getStyleClass().add("Center");
|
||||
|
||||
|
||||
TabColNomClt.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("NomClt"));
|
||||
TabColNomClt.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNomClt.getStyleClass().add("Center");
|
||||
|
||||
TabColPrenomClt.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("PrenomClt"));
|
||||
TabColPrenomClt.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColPrenomClt.getStyleClass().add("Center");
|
||||
|
||||
ArrayList<String> ListLocale = new StockDB().getAllListLocal();
|
||||
ChoiceBoxLocal.getItems().addAll(ListLocale);
|
||||
|
||||
ButtonSearchChequeCltProvision.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchChequeCltProvision();
|
||||
}
|
||||
});
|
||||
|
||||
AnchorPaneChequeCltProvision.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchChequeCltProvision();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
GestionSearchChequeCltProvision();
|
||||
|
||||
ButtonPrintChequeCltProvision.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
ImprimerChequeCltProvision();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void ImprimerChequeCltProvision()
|
||||
{
|
||||
ProgressBarChequeCltProvision.setVisible(true);
|
||||
|
||||
ButtonPrintChequeCltProvision.setDisable(true);
|
||||
|
||||
ThreadPrintChequeCltProvision = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateDebut = "";
|
||||
if(DatePickerCheque.getValue() != null){
|
||||
DateDebut = DatePickerCheque.getValue().toString();
|
||||
}
|
||||
|
||||
ListPrintChequeCltProvision = new ChequeCltDB().SearchChequeCltProvision(
|
||||
0,
|
||||
0,
|
||||
DateDebut,
|
||||
(String) ChoiceBoxLocal.getValue(),
|
||||
TextFieldBanque.getText(),
|
||||
TextFieldCodeClt.getText(),
|
||||
TextFieldCINClt.getText(),
|
||||
TextFieldNomPrenomClt.getText(),
|
||||
true);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadPrintChequeCltProvision.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
|
||||
int SizeListeChequeCltProvision = ListPrintChequeCltProvision.size();
|
||||
|
||||
System.out.println(SizeListeChequeCltProvision);
|
||||
|
||||
int total = SizeListeChequeCltProvision / 15 + 1 ;
|
||||
int page = 0;
|
||||
|
||||
PrinterJob jobPrint = PrinterJob.createPrinterJob();
|
||||
|
||||
jobPrint.getJobSettings().setPageRanges(new PageRange(1, total));
|
||||
|
||||
if (jobPrint.showPrintDialog(null))
|
||||
{
|
||||
Printer printer = jobPrint.getPrinter();
|
||||
PageLayout pageLayout = printer.createPageLayout(Paper.A4, PageOrientation.LANDSCAPE, Printer.MarginType.DEFAULT);
|
||||
|
||||
for (int i=0; i<SizeListeChequeCltProvision; i+=15)
|
||||
{
|
||||
try {
|
||||
ObservableList<ChequeCltGestionListe> listTemp = FXCollections.observableArrayList();
|
||||
|
||||
for (int j=i; (j<(i+15)) && (j<SizeListeChequeCltProvision); j++)
|
||||
{
|
||||
ChequeCltGestionListe ListChequeClt = ListPrintChequeCltProvision.get(j);
|
||||
listTemp.add(new ChequeCltGestionListe(
|
||||
ListChequeClt.getIdCheque(),
|
||||
ListChequeClt.getNumeroCheque(),
|
||||
ListChequeClt.getBanque(),
|
||||
ListChequeClt.getDateCheque(),
|
||||
ListChequeClt.getMontant(),
|
||||
ListChequeClt.getCodeClt(),
|
||||
ListChequeClt.getTypeClt(),
|
||||
ListChequeClt.getNomClt(),
|
||||
ListChequeClt.getPrenomClt(),
|
||||
ListChequeClt.getIdFacture(),
|
||||
ListChequeClt.getEtat(),
|
||||
ListChequeClt.getSource(),
|
||||
ListChequeClt.getSelected()
|
||||
));
|
||||
}
|
||||
|
||||
FXMLLoader fxmlLoaderChequeCltProvisionPrint = new FXMLLoader(getClass().getResource("/Views/ChequeClt/ChequeCltProvisionPrint.fxml"));
|
||||
final Node ParentFxmlChequeCltProvisionPrint = (Node)fxmlLoaderChequeCltProvisionPrint.load();
|
||||
ChequeCltProvisionPrintController chequeCltProvisionPrintController = fxmlLoaderChequeCltProvisionPrint.getController();
|
||||
page++;
|
||||
|
||||
chequeCltProvisionPrintController.setChequeCltProvision(Integer.toString(SizeListeChequeCltProvision), page+"/"+total, listTemp);
|
||||
|
||||
jobPrint.printPage(pageLayout, ParentFxmlChequeCltProvisionPrint);
|
||||
} catch (IOException ex) {
|
||||
System.out.println(ex.getMessage());
|
||||
}
|
||||
}
|
||||
jobPrint.endJob();
|
||||
}
|
||||
|
||||
ProgressBarChequeCltProvision.setVisible(false);
|
||||
ButtonPrintChequeCltProvision.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadPrintChequeCltProvision.start();
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchChequeCltProvision()
|
||||
{
|
||||
ProgressBarChequeCltProvision.setVisible(true);
|
||||
|
||||
ButtonSearchChequeCltProvision.setDisable(true);
|
||||
|
||||
ThreadSearchChequeCltProvision = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DateDebut = "";
|
||||
if(DatePickerCheque.getValue() != null){
|
||||
DateDebut = DatePickerCheque.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<ChequeCltGestionListe> ListChequeCltProvisions = new ChequeCltDB().SearchChequeCltProvision(
|
||||
position,
|
||||
nbrligne,
|
||||
DateDebut,
|
||||
(String) ChoiceBoxLocal.getValue(),
|
||||
TextFieldBanque.getText(),
|
||||
TextFieldCodeClt.getText(),
|
||||
TextFieldCINClt.getText(),
|
||||
TextFieldNomPrenomClt.getText(),
|
||||
false);
|
||||
|
||||
TableViewChequeCltAvercer.setItems(ListChequeCltProvisions);
|
||||
|
||||
totalcount = new ChequeCltDB().nbrChequeCltProvision(DateDebut,
|
||||
(String) ChoiceBoxLocal.getValue(),
|
||||
TextFieldBanque.getText(),
|
||||
TextFieldCodeClt.getText(),
|
||||
TextFieldCINClt.getText(),
|
||||
TextFieldNomPrenomClt.getText());
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchChequeCltProvision.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarChequeCltProvision.setVisible(false);
|
||||
ButtonSearchChequeCltProvision.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchChequeCltProvision.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchChequeCltProvision(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarChequeCltProvision.setVisible(true);
|
||||
|
||||
ButtonSearchChequeCltProvision.setDisable(true);
|
||||
|
||||
ThreadSearchChequeCltProvision = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateDebut = "";
|
||||
if(DatePickerCheque.getValue() != null){
|
||||
DateDebut = DatePickerCheque.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<ChequeCltGestionListe> ListChequeCltProvisions = new ChequeCltDB().SearchChequeCltProvision(ParmPosition, ParamNbrligne, DateDebut, (String) ChoiceBoxLocal.getValue(), TextFieldBanque.getText(), TextFieldCodeClt.getText(), TextFieldCINClt.getText(), TextFieldNomPrenomClt.getText(), false);
|
||||
|
||||
TableViewChequeCltAvercer.setItems(ListChequeCltProvisions);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchChequeCltProvision.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarChequeCltProvision.setVisible(false);
|
||||
ButtonSearchChequeCltProvision.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchChequeCltProvision.start();
|
||||
}
|
||||
|
||||
private void GestionSearchChequeCltProvision()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchChequeCltProvision(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchChequeCltProvision(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchChequeCltProvision(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchChequeCltProvision(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchChequeCltProvision(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package Controllers.ChequeClt;
|
||||
|
||||
import Models.ChequeClt.ChequeCltGestionListe;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class ChequeCltProvisionPrintController implements Initializable {
|
||||
|
||||
@FXML private Text TextNbr ;
|
||||
@FXML private Text TextPage ;
|
||||
|
||||
@FXML private TableView<ChequeCltGestionListe> TableViewChequeCltProvision ;
|
||||
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColNumeroCheque;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColBanque;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColDateCheque;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColMontant;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColNomClt;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColPrenomClt;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColLocal;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TabColNumeroCheque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("NumeroCheque"));
|
||||
TabColNumeroCheque.setStyle( "-fx-alignment: CENTER; -fx-font-size: 10pt;");
|
||||
TabColNumeroCheque.getStyleClass().add("Center");
|
||||
|
||||
TabColBanque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("Banque"));
|
||||
TabColBanque.setStyle( "-fx-alignment: CENTER; -fx-font-size: 10pt;");
|
||||
TabColBanque.getStyleClass().add("Center");
|
||||
|
||||
TabColDateCheque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("DateCheque"));
|
||||
TabColDateCheque.setStyle( "-fx-alignment: CENTER; -fx-font-size: 10pt;");
|
||||
TabColDateCheque.getStyleClass().add("Center");
|
||||
|
||||
TabColMontant.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("Montant"));
|
||||
TabColMontant.setStyle( "-fx-alignment: CENTER; -fx-font-size: 10pt;");
|
||||
TabColMontant.getStyleClass().add("Center");
|
||||
|
||||
TabColNomClt.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("NomClt"));
|
||||
TabColNomClt.setStyle( "-fx-alignment: CENTER; -fx-font-size: 10pt;");
|
||||
TabColNomClt.getStyleClass().add("Center");
|
||||
|
||||
TabColPrenomClt.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("PrenomClt"));
|
||||
TabColPrenomClt.setStyle( "-fx-alignment: CENTER; -fx-font-size: 10pt;");
|
||||
TabColPrenomClt.getStyleClass().add("Center");
|
||||
|
||||
TabColLocal.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("etat"));
|
||||
TabColLocal.setStyle( "-fx-alignment: CENTER; -fx-font-size: 10pt;");
|
||||
TabColLocal.getStyleClass().add("Center");
|
||||
}
|
||||
|
||||
public void setChequeCltProvision(
|
||||
String Nbr,
|
||||
String Page,
|
||||
ObservableList<ChequeCltGestionListe> obsListChequeCltListe)
|
||||
{
|
||||
TextNbr.setText(Nbr);
|
||||
TextPage.setText(Page);
|
||||
TableViewChequeCltProvision.setItems(obsListChequeCltListe);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,274 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.ChequeClt;
|
||||
|
||||
import Models.ChequeClt.ChequeCltDB;
|
||||
import Models.ChequeClt.ChequeCltGestionListe;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.util.Callback;
|
||||
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher
|
||||
*/
|
||||
public class ChequeCltVercerController implements Initializable {
|
||||
|
||||
@FXML private ProgressBar ProgressBarVerser;
|
||||
@FXML private CheckBox CheckboxSelectionner;
|
||||
@FXML private Button ButtonVerserSelection;
|
||||
|
||||
@FXML private Label LabelNbrSelectionner ;
|
||||
|
||||
@FXML private DatePicker DatePickerDateDebut;
|
||||
@FXML private DatePicker DatePickerDateFin;
|
||||
|
||||
@FXML private TableView<ChequeCltGestionListe> TableViewChequeCltVerser ;
|
||||
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,Boolean> TabColSelectionner;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColNumeroCheque;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColBanque;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColDateCheque;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColMontant;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColTypeClt;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColNomClt;
|
||||
@FXML private TableColumn<ChequeCltGestionListe ,String> TabColPrenomClt;
|
||||
|
||||
ChequeCltDB ChequeDB= new ChequeCltDB();
|
||||
ObservableList<ChequeCltGestionListe> DataListChequeClt;
|
||||
|
||||
private String StrDateDebut;
|
||||
private String StrDateFin;
|
||||
private Integer NbrSelect;
|
||||
private Integer NbrCount;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
DatePickerDateDebut.setValue(LocalDate.now());
|
||||
DatePickerDateFin.setValue(LocalDate.now());
|
||||
|
||||
StrDateDebut = DatePickerDateDebut.getValue().toString();
|
||||
StrDateFin = DatePickerDateFin.getValue().toString();
|
||||
|
||||
GetChequeCltAvercer();
|
||||
|
||||
CheckboxSelectionner.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
NbrSelect = 0;
|
||||
ButtonVerserSelection.setDisable(true);
|
||||
ButtonVerserSelection.setOpacity(0.82);
|
||||
if(CheckboxSelectionner.isSelected()){
|
||||
for(ChequeCltGestionListe ListChequeClt : DataListChequeClt){
|
||||
ListChequeClt.setSelected(true);
|
||||
NbrSelect++;
|
||||
}
|
||||
} else {
|
||||
for(ChequeCltGestionListe ListChequeClt : DataListChequeClt){
|
||||
ListChequeClt.setSelected(false);
|
||||
}
|
||||
}
|
||||
if(NbrSelect>0){
|
||||
ButtonVerserSelection.setDisable(false);
|
||||
ButtonVerserSelection.setOpacity(1);
|
||||
}
|
||||
TableViewChequeCltVerser.setItems(DataListChequeClt);
|
||||
LabelNbrSelectionner.setText(NbrSelect+"/"+NbrCount);
|
||||
TabColSelectionner.setVisible(false);
|
||||
TabColSelectionner.setVisible(true);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
TabColNumeroCheque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("NumeroCheque"));
|
||||
TabColNumeroCheque.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNumeroCheque.getStyleClass().add("Center");
|
||||
|
||||
TabColBanque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("Banque"));
|
||||
TabColBanque.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColBanque.getStyleClass().add("Center");
|
||||
|
||||
TabColDateCheque.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("DateCheque"));
|
||||
TabColDateCheque.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDateCheque.getStyleClass().add("Center");
|
||||
|
||||
TabColMontant.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("Montant"));
|
||||
TabColMontant.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColMontant.getStyleClass().add("Center");
|
||||
|
||||
TabColTypeClt.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("TypeClt"));
|
||||
TabColTypeClt.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTypeClt.getStyleClass().add("Center");
|
||||
|
||||
|
||||
TabColNomClt.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("NomClt"));
|
||||
TabColNomClt.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNomClt.getStyleClass().add("Center");
|
||||
|
||||
TabColPrenomClt.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, String>("PrenomClt"));
|
||||
TabColPrenomClt.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColPrenomClt.getStyleClass().add("Center");
|
||||
|
||||
TabColSelectionner.setCellValueFactory(new PropertyValueFactory<ChequeCltGestionListe, Boolean>("Selected"));
|
||||
TabColSelectionner.setStyle("-fx-alignment: CENTER;");
|
||||
TabColSelectionner.getStyleClass().add("Center");
|
||||
TabColSelectionner.setCellFactory(new Callback<TableColumn<ChequeCltGestionListe,Boolean>,TableCell<ChequeCltGestionListe,Boolean>>(){
|
||||
@Override
|
||||
public TableCell<ChequeCltGestionListe, Boolean> call(TableColumn<ChequeCltGestionListe, Boolean> param) {
|
||||
TableCell<ChequeCltGestionListe, Boolean> cell = new TableCell<ChequeCltGestionListe, Boolean>(){
|
||||
@Override
|
||||
public void updateItem(Boolean item, boolean empty) {
|
||||
if(item!=null){
|
||||
final CheckBox Check= new CheckBox();
|
||||
Check.setSelected(item);
|
||||
Check.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
ChequeCltGestionListe DataListChequeClt = ((ChequeCltGestionListe)getTableRow().getItem());
|
||||
if(Check.isSelected()){
|
||||
DataListChequeClt.setSelected(true);
|
||||
NbrSelect++;
|
||||
} else {
|
||||
DataListChequeClt.setSelected(true);
|
||||
NbrSelect--;
|
||||
}
|
||||
LabelNbrSelectionner.setText(NbrSelect+"/"+NbrCount);
|
||||
if(NbrSelect>0){
|
||||
ButtonVerserSelection.setDisable(false);
|
||||
ButtonVerserSelection.setOpacity(1);
|
||||
}else{
|
||||
ButtonVerserSelection.setDisable(true);
|
||||
ButtonVerserSelection.setOpacity(0.82);
|
||||
}
|
||||
}
|
||||
});
|
||||
setGraphic(Check);
|
||||
}else{
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
DatePickerDateDebut.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent actionEvent) {
|
||||
try{
|
||||
StrDateDebut = DatePickerDateDebut.getConverter().fromString(DatePickerDateDebut.getEditor().getText()).toString();
|
||||
GetChequeCltAvercer();
|
||||
}catch(Exception ex){}
|
||||
|
||||
}
|
||||
});
|
||||
DatePickerDateDebut.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
try{
|
||||
StrDateDebut = DatePickerDateDebut.getConverter().fromString(DatePickerDateDebut.getEditor().getText()).toString();
|
||||
GetChequeCltAvercer();
|
||||
}catch(Exception ex){}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
DatePickerDateFin.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent actionEvent){
|
||||
try{
|
||||
StrDateFin = DatePickerDateFin.getConverter().fromString(DatePickerDateFin.getEditor().getText()).toString();
|
||||
GetChequeCltAvercer();
|
||||
}catch(Exception ex){}
|
||||
}
|
||||
});
|
||||
DatePickerDateFin.setOnKeyReleased(new EventHandler<KeyEvent>(){
|
||||
@Override
|
||||
public void handle(KeyEvent ke){
|
||||
try{
|
||||
StrDateFin = DatePickerDateFin.getConverter().fromString(DatePickerDateFin.getEditor().getText()).toString();
|
||||
GetChequeCltAvercer();
|
||||
}catch(Exception ex){}
|
||||
}
|
||||
});
|
||||
|
||||
ButtonVerserSelection.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent arg0) {
|
||||
List<String> ArrayChequeClt = new ArrayList<>();
|
||||
List<String> ArrayChequePaiementTraite = new ArrayList<>(); //traite_paiement_cheque_clt
|
||||
for(ChequeCltGestionListe ListChequeClt : DataListChequeClt){
|
||||
if( (ListChequeClt.getSelected()) && (ListChequeClt.getSource() == 0) ){
|
||||
ArrayChequeClt.add(ListChequeClt.getIdCheque());
|
||||
}
|
||||
if( (ListChequeClt.getSelected()) && (ListChequeClt.getSource() == 1) ){
|
||||
ArrayChequePaiementTraite.add(ListChequeClt.getIdCheque());
|
||||
}
|
||||
}
|
||||
Integer NbrUpdateChequeClt = ChequeDB.UpdateChequeCltVerser(ArrayChequeClt, ArrayChequePaiementTraite);
|
||||
if(NbrUpdateChequeClt>0){
|
||||
GetChequeCltAvercer();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void GetChequeCltAvercer(){
|
||||
|
||||
ProgressBarVerser.setVisible(true);
|
||||
|
||||
// Create a Runnable
|
||||
Runnable task = new Runnable(){
|
||||
public void run(){
|
||||
Platform.runLater(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
DataListChequeClt = ChequeDB.GetDataChequeAverser(StrDateDebut, StrDateFin);
|
||||
TableViewChequeCltVerser.setItems(DataListChequeClt);
|
||||
NbrCount = DataListChequeClt.size();
|
||||
NbrSelect = 0;
|
||||
LabelNbrSelectionner.setText(NbrSelect+"/"+NbrCount);
|
||||
ProgressBarVerser.setVisible(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Thread backgroundThread = new Thread(task);// Run the task in a background thread
|
||||
backgroundThread.setDaemon(true);// Terminate the running thread if the application exits
|
||||
backgroundThread.start();// Start the thread
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
|
||||
package Controllers.Client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
|
||||
|
||||
public class AjouterClientController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(AjouterClientController.class.getName());
|
||||
|
||||
@FXML private AnchorPane AnchorPaneCltBody ;
|
||||
@FXML public StackPane typecompte ;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
try {
|
||||
//AnchorPaneCltBody.getChildren().clear();
|
||||
AnchorPaneCltBody.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Client/AjouterClientPersonne.fxml")));
|
||||
} catch (IOException ex) {
|
||||
logger.error("AjouterClientController : AjouterClientPersonne.fxml :" + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void AjouterClientEntrepriseRadioAction(ActionEvent event) throws IOException {
|
||||
AnchorPaneCltBody.getChildren().clear();
|
||||
AnchorPaneCltBody.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Client/AjouterClientEntreprise.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void AjouterClientPersonneRadioAction(ActionEvent event) throws IOException {
|
||||
AnchorPaneCltBody.getChildren().clear();
|
||||
AnchorPaneCltBody.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Client/AjouterClientPersonne.fxml")));
|
||||
}
|
||||
|
||||
public void delete(){
|
||||
typecompte.getChildren().clear();
|
||||
// System.out.println("dfgsdf");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,448 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.Client;
|
||||
|
||||
import Controllers.Dialog.Notification;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.Client.ClientEntreprise;
|
||||
import Models.Client.ClientEntrepriseContact;
|
||||
import Models.Client.ClientEntrepriseContactDB;
|
||||
import Models.Client.ClientEntrepriseDB;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Duration;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
*
|
||||
* @author Maher
|
||||
*/
|
||||
public class AjouterClientEntrepriseController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneAjouterClientEntreprise ;
|
||||
@FXML private AnchorPane AnchorPaneAjouterCltEntreprise ;
|
||||
|
||||
@FXML private Text ErreurClientEntrepriseCode ;
|
||||
@FXML private Text ErreurClientEntrepriseNom ;
|
||||
@FXML private Text ErreurClientEntrepriseGerant ;
|
||||
@FXML private Text ErreurClientEntrepriseMatricule ;
|
||||
@FXML private Text ErreurClientEntrepriseAdresse ;
|
||||
@FXML private Text ErreurClientEntreprisePostale ;
|
||||
@FXML private Text ErreurClientEntrepriseTele1 ;
|
||||
@FXML private Text ErreurClientEntrepriseTele2 ;
|
||||
@FXML private Text ErreurClientEntrepriseMail ;
|
||||
@FXML private Text ErreurClientEntrepriseFax ;
|
||||
@FXML private Text ErreurClientEntrepriseContactNom ;
|
||||
@FXML private Text ErreurClientEntrepriseContactPrenom ;
|
||||
@FXML private Text ErreurClientEntrepriseContactCIN ;
|
||||
@FXML private Text ErreurClientEntrepriseContactMail ;
|
||||
@FXML private Text ErreurClientEntrepriseContactTele1 ;
|
||||
@FXML private Text ErreurClientEntrepriseContactTele2 ;
|
||||
|
||||
@FXML private TextField ChampClientEntrepriseCode;
|
||||
@FXML private TextField ChampClientEntrepriseNom;
|
||||
@FXML private TextField ChampClientEntrepriseGerant ;
|
||||
@FXML private TextField ChampClientEntrepriseMatricule;
|
||||
@FXML private TextField ChampClientEntrepriseAdresse;
|
||||
@FXML private TextField ChampClientEntreprisePostale;
|
||||
@FXML private TextField ChampClientEntrepriseTele1;
|
||||
@FXML private TextField ChampClientEntrepriseTele2;
|
||||
@FXML private TextField ChampClientEntrepriseMail;
|
||||
@FXML private TextField ChampClientEntrepriseFax;
|
||||
@FXML private TextField ChampClientEntrepriseContactNom;
|
||||
@FXML private TextField ChampClientEntrepriseContactPrenom;
|
||||
@FXML private TextField ChampClientEntrepriseContactCIN;
|
||||
@FXML private TextField ChampClientEntrepriseContactMail;
|
||||
@FXML private TextField ChampClientEntrepriseContactTele1;
|
||||
@FXML private TextField ChampClientEntrepriseContactTele2;
|
||||
|
||||
|
||||
|
||||
contro ctl= new contro() ;
|
||||
ClientEntreprise MyClientEntreprise = new ClientEntreprise();
|
||||
ClientEntrepriseContact MyClientEntrepriseContact = new ClientEntrepriseContact();
|
||||
ClientEntrepriseDB MyCltEtrDB = new ClientEntrepriseDB();
|
||||
ClientEntrepriseContactDB MyCltEtrCta = new ClientEntrepriseContactDB();
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
//lors de clique sur le textfilde Code de l'entreprise
|
||||
ChampClientEntrepriseCode.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
public void handle(KeyEvent ke) {
|
||||
try {// if is number
|
||||
Integer.parseInt(ChampClientEntrepriseCode.getText());
|
||||
int cin =Integer.parseInt(ChampClientEntrepriseCode.getText());
|
||||
if(MyCltEtrDB.verifyCodeEntreprise(cin)){
|
||||
ErreurClientEntrepriseCode.setText("Code entreprise existe déja");
|
||||
ChampClientEntrepriseCode.setStyle("-fx-border-color:#f20606;");
|
||||
}
|
||||
else{
|
||||
ErreurClientEntrepriseCode.setText("");
|
||||
ChampClientEntrepriseCode.setStyle("-fx-border-color: transparent;");
|
||||
}
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
ErreurClientEntrepriseCode.setText("Code doit être un numéro");
|
||||
ChampClientEntrepriseCode.setStyle("-fx-border-color:#f20606;");
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
public void AjouterClientEntrepriseButtonAction(ActionEvent event) throws IOException {
|
||||
if(!ControlesEtr()){
|
||||
if(!ControlesEtrContact()){
|
||||
//recupération des données dont l'objet
|
||||
this.getClientEntreprise();
|
||||
//l'insertion des données dont la Base des données et afficher le message du succés
|
||||
if(MyCltEtrDB.addEntreprise(MyClientEntreprise)){
|
||||
this.getClientEntrepriseContact();
|
||||
if(MyCltEtrCta.addClientEntrepriseContact(MyClientEntrepriseContact)){
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(400), AnchorPaneAjouterCltEntreprise);
|
||||
ft.setFromValue(1.0);
|
||||
ft.setToValue(0.0);
|
||||
ft.play();
|
||||
ft.setOnFinished(new EventHandler<ActionEvent>() {
|
||||
//message de succés
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
Image success = new Image(getClass().getResourceAsStream("/Public/icon/successfully.png"));
|
||||
ImageView iv1 = new ImageView();
|
||||
iv1.setImage(success);
|
||||
|
||||
Text text= new Text();
|
||||
text.setText("l'ajouter a été effectuée avec succès");
|
||||
text.setFont(Font.loadFont(getClass().getResourceAsStream("/Public/Fonts/Raleway-SemiBold.ttf"), 20));
|
||||
|
||||
Button AddClient = new Button("OK");
|
||||
AddClient.getStyleClass().add("btn-primary");
|
||||
AddClient.setPrefSize(100, 30);
|
||||
|
||||
final StackPane stackpane = new StackPane();
|
||||
stackpane.setLayoutX(140);
|
||||
stackpane.setLayoutY(100);
|
||||
stackpane.setPrefHeight(200);
|
||||
stackpane.setPrefWidth(200);
|
||||
stackpane.getChildren().add(iv1);
|
||||
stackpane.getChildren().add(text);
|
||||
stackpane.getChildren().add(AddClient);
|
||||
StackPane.setAlignment(iv1, Pos.BASELINE_CENTER);
|
||||
StackPane.setAlignment(text, Pos.TOP_CENTER);
|
||||
StackPane.setAlignment(AddClient, Pos.CENTER);
|
||||
|
||||
AnchorPaneAjouterClientEntreprise.setLeftAnchor(stackpane, 83.0);
|
||||
AnchorPaneAjouterClientEntreprise.setRightAnchor(stackpane, 83.0);
|
||||
AnchorPaneAjouterClientEntreprise.setTopAnchor(stackpane,200.0);
|
||||
AnchorPaneAjouterClientEntreprise.setBottomAnchor(stackpane,200.0);
|
||||
AnchorPaneAjouterClientEntreprise.getChildren().add(stackpane);
|
||||
|
||||
AddClient.setOnAction(new EventHandler<ActionEvent>() { //supprimer le message du suucés et reaficher les formulaires
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
stackpane.setVisible(false);
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(400), AnchorPaneAjouterCltEntreprise);
|
||||
ft.setFromValue(0.0);
|
||||
ft.setToValue(1.0);
|
||||
ft.play();
|
||||
restechamp();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void restechamp(){
|
||||
ChampClientEntrepriseCode.setText("");
|
||||
ChampClientEntrepriseNom.setText("");
|
||||
ChampClientEntrepriseGerant.setText("");
|
||||
ChampClientEntrepriseMatricule.setText("");
|
||||
ChampClientEntrepriseAdresse.setText("");
|
||||
ChampClientEntreprisePostale.setText("");
|
||||
ChampClientEntrepriseTele1.setText("");
|
||||
ChampClientEntrepriseTele2.setText("");
|
||||
ChampClientEntrepriseMail.setText("");
|
||||
ChampClientEntrepriseFax.setText("");
|
||||
ChampClientEntrepriseContactNom.setText("");
|
||||
ChampClientEntrepriseContactPrenom.setText("");
|
||||
ChampClientEntrepriseContactCIN.setText("");
|
||||
ChampClientEntrepriseContactMail.setText("");
|
||||
ChampClientEntrepriseContactTele1.setText("");
|
||||
ChampClientEntrepriseContactTele2.setText("");
|
||||
}
|
||||
|
||||
|
||||
private void getClientEntreprise(){
|
||||
MyClientEntreprise.setCodeString(ChampClientEntrepriseCode.getText());
|
||||
MyClientEntreprise.setNom(ChampClientEntrepriseNom.getText());
|
||||
MyClientEntreprise.setGerant(ChampClientEntrepriseGerant.getText());
|
||||
MyClientEntreprise.setMatricule(ChampClientEntrepriseMatricule.getText());
|
||||
MyClientEntreprise.setAdresse(ChampClientEntrepriseAdresse.getText());
|
||||
MyClientEntreprise.setPostaleString(ChampClientEntreprisePostale.getText());
|
||||
MyClientEntreprise.setTele1String(ChampClientEntrepriseTele1.getText());
|
||||
MyClientEntreprise.setTele2String(ChampClientEntrepriseTele2.getText());
|
||||
MyClientEntreprise.setMail(ChampClientEntrepriseMail.getText());
|
||||
MyClientEntreprise.setFaxString(ChampClientEntrepriseFax.getText());
|
||||
}
|
||||
|
||||
private void getClientEntrepriseContact(){
|
||||
MyClientEntrepriseContact.setNom(ChampClientEntrepriseContactNom.getText());
|
||||
MyClientEntrepriseContact.setPrenom(ChampClientEntrepriseContactPrenom.getText());
|
||||
MyClientEntrepriseContact.setCINString(ChampClientEntrepriseContactCIN.getText());
|
||||
MyClientEntrepriseContact.setTele1String(ChampClientEntrepriseContactTele1.getText());
|
||||
MyClientEntrepriseContact.setTele2String(ChampClientEntrepriseContactTele2.getText());
|
||||
MyClientEntrepriseContact.setMail(ChampClientEntrepriseContactMail.getText());
|
||||
MyClientEntrepriseContact.setIdcltentreprise(MyClientEntreprise.getCode());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//methode qui afficher une fenêtre de notification "code client Etreprise générer par le systeme
|
||||
private void getidcltEtr(){
|
||||
if(MyCltEtrDB.getidClientEtr()>=0){
|
||||
final Notification notification = new Notification();
|
||||
|
||||
notification.DetailMSG.getChildren().clear();
|
||||
|
||||
final String ch = String.valueOf(MyCltEtrDB.getidClientEtr()+1) ;
|
||||
Text text1 = new Text();
|
||||
text1.setText("Code Entreprise vide \n \n");
|
||||
text1.setFont(Font.font("Arial", FontWeight.BOLD, 15));
|
||||
text1.setFill(Color.web("#363a38"));
|
||||
notification.DetailMSG.getChildren().add(text1);
|
||||
|
||||
Text text2 = new Text();
|
||||
text2.setText("Voulez vous que system génére le code d'entreprise par le numéro suivant:");
|
||||
text2.setFont(Font.font("Arial", FontWeight.NORMAL, 15));
|
||||
text2.setFill(Color.web("#363a38"));
|
||||
notification.DetailMSG.getChildren().add(text2);
|
||||
|
||||
Text text3 = new Text();
|
||||
text3.setText(ch);
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
notification.DetailMSG.getChildren().add(text3);
|
||||
|
||||
notification.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
notification.stackpane.setVisible(false);
|
||||
ChampClientEntrepriseCode.setText(ch);
|
||||
}
|
||||
});
|
||||
notification.ShowNotification();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private boolean ControlesEtr(){
|
||||
|
||||
boolean result=false ;
|
||||
|
||||
if(ChampClientEntrepriseCode.getText().length()==0){
|
||||
this.getidcltEtr();
|
||||
result= true ;
|
||||
}
|
||||
else if(ctl.isNumericNotnull(ChampClientEntrepriseCode.getText())){
|
||||
ChampClientEntrepriseCode.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseCode.setText("Code doit être un numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
if(ChampClientEntrepriseNom.getText().length()<3){
|
||||
ChampClientEntrepriseNom.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseNom.setText("Nom doit dépasser 3 caractère");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseNom.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseNom.setText("");
|
||||
if(ChampClientEntrepriseGerant.getText().length()<3){
|
||||
ChampClientEntrepriseGerant.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseGerant.setText("Gérant doit dépasser 3 caractère");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseGerant.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseGerant.setText("");
|
||||
if(ctl.isNumeric(ChampClientEntrepriseMatricule.getText())){
|
||||
ChampClientEntrepriseMatricule.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseMatricule.setText("Matricule doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseMatricule.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseMatricule.setText("");
|
||||
if(ChampClientEntrepriseAdresse.getText().length()<3){
|
||||
ChampClientEntrepriseAdresse.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseAdresse.setText("L'adresse doit dépasser 3 caractère");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseAdresse.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseAdresse.setText("");
|
||||
|
||||
if(ctl.isNumeric(ChampClientEntreprisePostale.getText())){
|
||||
ChampClientEntreprisePostale.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntreprisePostale.setText("code doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntreprisePostale.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntreprisePostale.setText("");
|
||||
if(ctl.isNumericNotnull(ChampClientEntrepriseTele1.getText())){
|
||||
ChampClientEntrepriseTele1.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseTele1.setText("Tele doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseTele1.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseTele1.setText("");
|
||||
if(ctl.isNumeric(ChampClientEntrepriseTele2.getText())){
|
||||
ChampClientEntrepriseTele2.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseTele2.setText("Tele2 doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseTele2.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseTele2.setText("");
|
||||
if(ctl.isNumeric(ChampClientEntrepriseFax.getText())){
|
||||
ChampClientEntrepriseFax.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseFax.setText("Fax doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseFax.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseFax.setText("");
|
||||
if(ChampClientEntrepriseMail.getText().length()>0 && ChampClientEntrepriseMail.getText().indexOf("@")< 0){
|
||||
ChampClientEntrepriseMail.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseMail.setText("invalide mail");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseMail.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseMail.setText("");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return result ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private boolean ControlesEtrContact(){
|
||||
boolean result=false ;
|
||||
if(ChampClientEntrepriseContactNom.getText().length()<4){
|
||||
ChampClientEntrepriseContactNom.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseContactNom.setText("Nom doit dépasser 4 caractère");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseContactNom.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseContactNom.setText("");
|
||||
if(ChampClientEntrepriseContactPrenom.getText().length()<4){
|
||||
ChampClientEntrepriseContactPrenom.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseContactPrenom.setText("Prénom doit dépasser 4 caractère");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseContactPrenom.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseContactPrenom.setText("");
|
||||
if(ctl.isNumeric(ChampClientEntrepriseContactCIN.getText())){
|
||||
ChampClientEntrepriseContactCIN.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseContactCIN.setText("CIN doit être un numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseContactCIN.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseContactCIN.setText("");
|
||||
if(ChampClientEntrepriseContactMail.getText().length()>0){
|
||||
if(ChampClientEntrepriseContactMail.getText().indexOf("@")< 0){
|
||||
ChampClientEntrepriseContactMail.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseContactMail.setText("invalide mail");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseContactMail.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseContactMail.setText("");
|
||||
}
|
||||
}
|
||||
if(ctl.isNumericNotnull(ChampClientEntrepriseContactTele1.getText())){
|
||||
ChampClientEntrepriseContactTele1.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseContactTele1.setText("Tele doit être un numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseContactTele1.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseContactTele1.setText("");
|
||||
if(ctl.isNumeric(ChampClientEntrepriseContactTele2.getText())){
|
||||
ChampClientEntrepriseContactTele2.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseContactTele2.setText("Tele doit être un numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseContactTele2.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseContactTele2.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return result ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,373 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.Client;
|
||||
|
||||
import Controllers.Dialog.Notification;
|
||||
import Controllers.Dialog.ShowDialog;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.Client.Client;
|
||||
import Models.Client.ClientDB;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.ToggleGroup;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Duration;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
*
|
||||
* @author Maher
|
||||
*/
|
||||
public class AjouterClientPersonneController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneAjouterClientPersonne ;
|
||||
@FXML private AnchorPane AnchorPaneAjouterCltPersonne ;
|
||||
@FXML private TextField AjouterClientCode;
|
||||
@FXML private TextField AjouterClientCIN;
|
||||
@FXML private TextField AjouterClientNomComplet;
|
||||
@FXML private TextField AjouterClientNom;
|
||||
@FXML private TextField AjouterClientPrenom;
|
||||
@FXML private DatePicker AjouterClientNaissance;
|
||||
@FXML private TextField AjouterClientTeleFixe;
|
||||
@FXML private TextField AjouterClientTeleMobile;
|
||||
@FXML private TextField AjouterClientAdresse;
|
||||
@FXML private TextField AjouterClientCodePostal;
|
||||
@FXML private TextField AjouterClientMail;
|
||||
@FXML public ToggleGroup groupesexe;
|
||||
@FXML private RadioButton AjouterClientSexeHomme;
|
||||
@FXML private RadioButton AjouterClientSexeFemme;
|
||||
|
||||
|
||||
@FXML private Text ErreurCode ;
|
||||
@FXML private Text ErreurCIN ;
|
||||
@FXML private Text ErreurNomComplet ;
|
||||
@FXML private Text ErreurNom ;
|
||||
@FXML private Text ErreurPrenom ;
|
||||
@FXML private Text ErreurNaissance ;
|
||||
@FXML private Text ErreurTeleFixe ;
|
||||
@FXML private Text ErreurTeleMobile ;
|
||||
@FXML private Text ErreurAdresse ;
|
||||
@FXML private Text ErreurCodePostal ;
|
||||
@FXML private Text ErreurMail ;
|
||||
@FXML private Text ErreurSexe ;
|
||||
|
||||
contro ctl= new contro() ;
|
||||
Client Myclient = new Client();
|
||||
ClientDB dbclient = new ClientDB();
|
||||
|
||||
|
||||
@FXML
|
||||
public void AjouterClientPersonneButtonAction(ActionEvent event) throws IOException {
|
||||
|
||||
if(!this.Controles()){
|
||||
|
||||
this.getclient(); //recupératiion des données dont l'objet Myclient
|
||||
|
||||
if(dbclient.addClient(Myclient)){ //l'insertion des données dont la Base des données et afficher le message du succés
|
||||
|
||||
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(400), AnchorPaneAjouterCltPersonne);
|
||||
ft.setFromValue(1.0);
|
||||
ft.setToValue(0.0);
|
||||
ft.play();
|
||||
ft.setOnFinished(new EventHandler<ActionEvent>() {
|
||||
//message de succés
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
//Image success = new Image(file.toURI().toString()+"successfully.png");
|
||||
Image success = new Image(getClass().getResourceAsStream("/Public/icon/successfully.png"));
|
||||
ImageView iv1 = new ImageView();
|
||||
iv1.setImage(success);
|
||||
|
||||
Text text= new Text();
|
||||
text.setText("l'ajouter a été effectuée avec succès");
|
||||
text.setFont(Font.loadFont(getClass().getResourceAsStream("/Public/Fonts/Raleway-SemiBold.ttf"), 20));
|
||||
|
||||
Button AddClient = new Button("OK");
|
||||
AddClient.getStyleClass().add("btn-success");
|
||||
AddClient.setPrefSize(100, 30);
|
||||
|
||||
final StackPane stackpane = new StackPane();
|
||||
stackpane.setLayoutX(140);
|
||||
stackpane.setLayoutY(100);
|
||||
stackpane.setPrefHeight(200);
|
||||
stackpane.setPrefWidth(200);
|
||||
stackpane.getChildren().add(iv1);
|
||||
stackpane.getChildren().add(text);
|
||||
stackpane.getChildren().add(AddClient);
|
||||
StackPane.setAlignment(iv1, Pos.BASELINE_CENTER);
|
||||
StackPane.setAlignment(text, Pos.TOP_CENTER);
|
||||
StackPane.setAlignment(AddClient, Pos.CENTER);
|
||||
|
||||
AnchorPaneAjouterClientPersonne.setLeftAnchor(stackpane, 83.0);
|
||||
AnchorPaneAjouterClientPersonne.setRightAnchor(stackpane, 83.0);
|
||||
AnchorPaneAjouterClientPersonne.setTopAnchor(stackpane,220.0);
|
||||
AnchorPaneAjouterClientPersonne.setBottomAnchor(stackpane,220.0);
|
||||
AnchorPaneAjouterClientPersonne.getChildren().add(stackpane);
|
||||
|
||||
AddClient.setOnAction(new EventHandler<ActionEvent>() { //supprimer le message du suucés et reaficher les formulaires
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
stackpane.setVisible(false);
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(400), AnchorPaneAjouterCltPersonne);
|
||||
ft.setFromValue(0.0);
|
||||
ft.setToValue(1.0);
|
||||
ft.play();
|
||||
restechamp();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else{
|
||||
ShowDialog SD = new ShowDialog();
|
||||
SD.ShowAletDialog();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void getclient()
|
||||
{
|
||||
Myclient.setCinString(AjouterClientCIN.getText());
|
||||
Myclient.setCodeclient(AjouterClientCode.getText());
|
||||
Myclient.setNomcomplet(AjouterClientNomComplet.getText());
|
||||
Myclient.setNom(AjouterClientNom.getText());
|
||||
Myclient.setPrenom(AjouterClientPrenom.getText());
|
||||
Myclient.setNaissanceDatePicker(AjouterClientNaissance.getValue());
|
||||
Myclient.setTelefixString(AjouterClientTeleFixe.getText());
|
||||
Myclient.setTelemobileString(AjouterClientTeleMobile.getText());
|
||||
Myclient.setSexeString(groupesexe.getSelectedToggle().getUserData().toString());
|
||||
Myclient.setAdresse(AjouterClientAdresse.getText());
|
||||
Myclient.setCodepostal(AjouterClientCodePostal.getText());
|
||||
Myclient.setMail(AjouterClientMail.getText());
|
||||
}
|
||||
|
||||
|
||||
//methode qui afficher une fenêtre de notification "code client générer par le systeme
|
||||
private void getidclt(){
|
||||
final Notification notification = new Notification();
|
||||
|
||||
notification.DetailMSG.getChildren().clear();
|
||||
|
||||
final String ch = String.valueOf(dbclient.getidClient()+1) ;
|
||||
Text text1 = new Text();
|
||||
text1.setText("Code client vide \n \n");
|
||||
text1.setFont(Font.font("Arial", FontWeight.BOLD, 15));
|
||||
text1.setFill(Color.web("#363a38"));
|
||||
notification.DetailMSG.getChildren().add(text1);
|
||||
|
||||
Text text2 = new Text();
|
||||
text2.setText("Voulez vous que system génére le code client par le numéro suivant:");
|
||||
text2.setFont(Font.font("Arial", FontWeight.NORMAL, 15));
|
||||
text2.setFill(Color.web("#363a38"));
|
||||
notification.DetailMSG.getChildren().add(text2);
|
||||
|
||||
Text text3 = new Text();
|
||||
text3.setText(ch);
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
notification.DetailMSG.getChildren().add(text3);
|
||||
|
||||
notification.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
notification.stackpane.setVisible(false);
|
||||
AjouterClientCode.setText(ch);
|
||||
}
|
||||
});
|
||||
notification.ShowNotification();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//fider tous les champs du formulaires
|
||||
private void restechamp(){
|
||||
AjouterClientCIN.setText("");
|
||||
AjouterClientCode.setText("");
|
||||
AjouterClientNomComplet.setText("");
|
||||
AjouterClientNom.setText("");
|
||||
AjouterClientPrenom.setText("");
|
||||
AjouterClientNaissance.setValue(null);
|
||||
AjouterClientTeleFixe.setText("");
|
||||
AjouterClientTeleMobile.setText("");
|
||||
AjouterClientCodePostal.setText("");
|
||||
AjouterClientAdresse.setText("");
|
||||
AjouterClientMail.setText("");
|
||||
AjouterClientSexeHomme.setSelected(false);
|
||||
AjouterClientSexeFemme.setSelected(false);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
AjouterClientSexeHomme.setUserData("Homme");
|
||||
AjouterClientSexeFemme.setUserData("Femme");
|
||||
}
|
||||
|
||||
|
||||
|
||||
private boolean Controles(){
|
||||
boolean result ;
|
||||
if(AjouterClientCode.getText().length()== 0){ //code client vide
|
||||
this.getidclt();
|
||||
result= true ;
|
||||
}
|
||||
else if(ctl.isNumeric(AjouterClientCode.getText())){ //code client n'est pas un numero
|
||||
AjouterClientCode.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurCode.setText("code client doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else if(dbclient.verifyIdClient(Integer.parseInt(AjouterClientCode.getText()))){ //code client existe déja
|
||||
AjouterClientCode.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurCode.setText("code client existe déja");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientCode.setStyle("-fx-border-color:transparent;");
|
||||
ErreurCode.setText("");
|
||||
if((AjouterClientCIN.getText().length()!= 8) || (ctl.isNumericNotnull(AjouterClientCIN.getText()))){
|
||||
ErreurCIN.setText("CIN doit être 8 numéro");
|
||||
AjouterClientCIN.setStyle("-fx-border-color:#f20606;");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ErreurCIN.setText("");
|
||||
AjouterClientCIN.setStyle("-fx-border-color: transparent;");
|
||||
if(dbclient.verifyCinClient(Integer.parseInt(AjouterClientCIN.getText()))){
|
||||
ErreurCIN.setText("CIN existe déja");
|
||||
AjouterClientCIN.setStyle("-fx-border-color:#f20606;");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ErreurCIN.setText("");
|
||||
AjouterClientCIN.setStyle("-fx-border-color: transparent;");
|
||||
if(AjouterClientNomComplet.getText().length()<10){
|
||||
ErreurNomComplet.setText("Client doit dépasser 10 catactaire");
|
||||
AjouterClientNomComplet.setStyle("-fx-border-color:#f20606;");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ErreurNomComplet.setText("");
|
||||
AjouterClientNomComplet.setStyle("-fx-border-color: transparent;");
|
||||
if(AjouterClientPrenom.getText().length()<3){
|
||||
AjouterClientPrenom.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurPrenom.setText("le prénom doit dépasser 3 caractaire");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ErreurPrenom.setText("");
|
||||
AjouterClientPrenom.setStyle("-fx-border-color: transparent;");
|
||||
if(AjouterClientNom.getText().length()<3){
|
||||
AjouterClientNom.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurNom.setText("Prénom doit dépasser 3 caractaire");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientNom.setStyle("-fx-border-color: transparent;");
|
||||
ErreurNom.setText("");
|
||||
if(AjouterClientNaissance.getValue()==null){
|
||||
AjouterClientNaissance.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurNaissance.setText("Date de naissance vide");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientNaissance.setStyle("-fx-border-color: transparent;");
|
||||
ErreurNaissance.setText("");
|
||||
if(ctl.isNumericNotnull(AjouterClientTeleFixe.getText())){
|
||||
AjouterClientTeleFixe.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurTeleFixe.setText("tele doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientTeleFixe.setStyle("-fx-border-color: transparent;");
|
||||
ErreurTeleFixe.setText("");
|
||||
if(AjouterClientTeleMobile.getText().length()>0){
|
||||
if(ctl.isNumeric(AjouterClientTeleMobile.getText())){
|
||||
AjouterClientTeleMobile.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurTeleMobile.setText("tele doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientTeleMobile.setStyle("-fx-border-color: transparent;");
|
||||
ErreurTeleMobile.setText("");
|
||||
}
|
||||
}
|
||||
if(groupesexe.getSelectedToggle()== null){
|
||||
ErreurSexe.setText("Veuillez sélectionner le sexe");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ErreurSexe.setText("");
|
||||
if(AjouterClientAdresse.getText().length()<4){
|
||||
AjouterClientAdresse.setStyle("-fx-border-color: #f20606;");
|
||||
ErreurAdresse.setText("Adresse doit dépasser 4 caractaire");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientAdresse.setStyle("-fx-border-color: transparent;");
|
||||
ErreurAdresse.setText("");
|
||||
if(ctl.isNumeric(AjouterClientCodePostal.getText())){
|
||||
AjouterClientCodePostal.setStyle("-fx-border-color: #f20606;");
|
||||
ErreurCodePostal.setText("code doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientCodePostal.setStyle("-fx-border-color: transparent;");
|
||||
ErreurCodePostal.setText("");
|
||||
if(AjouterClientMail.getText().length()> 0){
|
||||
if(AjouterClientMail.getText().indexOf("@")< 0){
|
||||
AjouterClientMail.setStyle("-fx-border-color: #f20606;");
|
||||
ErreurMail.setText("invalide mail");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientMail.setStyle("-fx-border-color: transparent;");
|
||||
ErreurMail.setText("");
|
||||
result= false ;
|
||||
}
|
||||
}
|
||||
else{
|
||||
result= false ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result ;
|
||||
}
|
||||
|
||||
}
|
||||
552
src/main/java/Controllers/Client/DetailClientController.java
Normal file
552
src/main/java/Controllers/Client/DetailClientController.java
Normal file
@@ -0,0 +1,552 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.Client;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.Client.Client;
|
||||
import Models.Client.ClientDB;
|
||||
import Models.Client.ClientEntreprise;
|
||||
import Models.Client.ClientEntrepriseContact;
|
||||
import Models.Client.ClientEntrepriseDB;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.ToggleGroup;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Duration;
|
||||
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class DetailClientController implements Initializable {
|
||||
|
||||
@FXML private StackPane StackPaneSucessCltPersonne;
|
||||
@FXML private AnchorPane AnchorPaneModifierCltPersonne;
|
||||
@FXML private AnchorPane AnchorPaneModifierCltEntreprise;
|
||||
|
||||
@FXML public Text Nomclt ;
|
||||
@FXML public Text Codeclt ;
|
||||
|
||||
@FXML private TextField AjouterClientCode;
|
||||
@FXML private TextField AjouterClientCIN;
|
||||
@FXML private TextField AjouterClientNomComplet;
|
||||
@FXML private TextField AjouterClientNom;
|
||||
@FXML private TextField AjouterClientPrenom;
|
||||
@FXML private DatePicker AjouterClientNaissance;
|
||||
@FXML private TextField AjouterClientTeleFixe;
|
||||
@FXML private TextField AjouterClientTeleMobile;
|
||||
@FXML private TextField AjouterClientAdresse;
|
||||
@FXML private TextField AjouterClientCodePostal;
|
||||
@FXML private TextField AjouterClientMail;
|
||||
@FXML public ToggleGroup groupesexe;
|
||||
@FXML private RadioButton RadioButtonSexeHomme;
|
||||
@FXML private RadioButton RadioButtonSexeFemme;
|
||||
|
||||
@FXML private Text ErreurCode ;
|
||||
@FXML private Text ErreurCIN ;
|
||||
@FXML private Text ErreurNomComplet ;
|
||||
@FXML private Text ErreurNom ;
|
||||
@FXML private Text ErreurPrenom ;
|
||||
@FXML private Text ErreurNaissance ;
|
||||
@FXML private Text ErreurTeleFixe ;
|
||||
@FXML private Text ErreurTeleMobile ;
|
||||
@FXML private Text ErreurAdresse ;
|
||||
@FXML private Text ErreurCodePostal ;
|
||||
@FXML private Text ErreurMail ;
|
||||
@FXML private Text ErreurSexe ;
|
||||
|
||||
@FXML private Text ErreurClientEntrepriseNom ;
|
||||
@FXML private Text ErreurClientEntrepriseGerant ;
|
||||
@FXML private Text ErreurClientEntrepriseMatricule ;
|
||||
@FXML private Text ErreurClientEntrepriseAdresse ;
|
||||
@FXML private Text ErreurClientEntreprisePostale ;
|
||||
@FXML private Text ErreurClientEntrepriseTele1 ;
|
||||
@FXML private Text ErreurClientEntrepriseTele2 ;
|
||||
@FXML private Text ErreurClientEntrepriseMail ;
|
||||
@FXML private Text ErreurClientEntrepriseFax ;
|
||||
@FXML private Text ErreurClientEntrepriseContactNom ;
|
||||
@FXML private Text ErreurClientEntrepriseContactPrenom ;
|
||||
@FXML private Text ErreurClientEntrepriseContactCIN ;
|
||||
@FXML private Text ErreurClientEntrepriseContactMail ;
|
||||
@FXML private Text ErreurClientEntrepriseContactTele1 ;
|
||||
@FXML private Text ErreurClientEntrepriseContactTele2 ;
|
||||
|
||||
@FXML private TextField ChampClientEntrepriseNom;
|
||||
@FXML private TextField ChampClientEntrepriseGerant ;
|
||||
@FXML private TextField ChampClientEntrepriseMatricule;
|
||||
@FXML private TextField ChampClientEntrepriseAdresse;
|
||||
@FXML private TextField ChampClientEntreprisePostale;
|
||||
@FXML private TextField ChampClientEntrepriseTele1;
|
||||
@FXML private TextField ChampClientEntrepriseTele2;
|
||||
@FXML private TextField ChampClientEntrepriseMail;
|
||||
@FXML private TextField ChampClientEntrepriseFax;
|
||||
@FXML private TextField ChampClientEntrepriseContactNom;
|
||||
@FXML private TextField ChampClientEntrepriseContactPrenom;
|
||||
@FXML private TextField ChampClientEntrepriseContactCIN;
|
||||
@FXML private TextField ChampClientEntrepriseContactMail;
|
||||
@FXML private TextField ChampClientEntrepriseContactTele1;
|
||||
@FXML private TextField ChampClientEntrepriseContactTele2;
|
||||
|
||||
|
||||
ClientDB clientDB = new ClientDB();
|
||||
ClientEntrepriseDB EntrepriseCltDB = new ClientEntrepriseDB();
|
||||
|
||||
ClientEntreprise entreprise = new ClientEntreprise();
|
||||
ClientEntrepriseContact contactEtr = new ClientEntrepriseContact();
|
||||
|
||||
contro ctl= new contro() ;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
RadioButtonSexeFemme.setUserData("0");
|
||||
RadioButtonSexeHomme.setUserData("1");
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setDataClient(String codeclt)
|
||||
{
|
||||
AnchorPaneModifierCltEntreprise.setVisible(false);
|
||||
AnchorPaneModifierCltPersonne.setVisible(true);
|
||||
|
||||
Client client = clientDB.getClient(codeclt);
|
||||
|
||||
Codeclt.setText(codeclt);
|
||||
Nomclt.setText(client.getNom()+" "+client.getPrenom());
|
||||
|
||||
AjouterClientCode.setText(client.getCodeclient());
|
||||
AjouterClientCIN.setText(client.getCinString());
|
||||
AjouterClientNomComplet.setText(client.getNomcomplet());
|
||||
AjouterClientNom.setText(client.getNom());
|
||||
AjouterClientPrenom.setText(client.getPrenom());
|
||||
AjouterClientNaissance.setValue(Adaptateur.StringToLocalDate(client.getNaissance().toString()));
|
||||
AjouterClientTeleFixe.setText(client.getTelefixString());
|
||||
AjouterClientTeleMobile.setText(client.getTelemobileString());
|
||||
AjouterClientAdresse.setText(client.getAdresse());
|
||||
AjouterClientCodePostal.setText(client.getCodepostal());
|
||||
AjouterClientMail.setText(client.getMail());
|
||||
if(client.getSexe() == 1){ RadioButtonSexeHomme.setSelected(true); }
|
||||
if(client.getSexe() == 0){ RadioButtonSexeFemme.setSelected(true); }
|
||||
}
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
private void UpdateClientButtonAction(ActionEvent event) throws IOException
|
||||
{
|
||||
Client client = new Client();
|
||||
if(!this.ControlesClient())
|
||||
{
|
||||
client.setCinString(AjouterClientCIN.getText());
|
||||
client.setCodeclient(AjouterClientCode.getText());
|
||||
client.setNomcomplet(AjouterClientNomComplet.getText());
|
||||
client.setNom(AjouterClientNom.getText());
|
||||
client.setPrenom(AjouterClientPrenom.getText());
|
||||
client.setNaissanceDatePicker(AjouterClientNaissance.getValue());
|
||||
client.setTelefixString(AjouterClientTeleFixe.getText());
|
||||
client.setTelemobileString(AjouterClientTeleMobile.getText());
|
||||
client.setSexeString(groupesexe.getSelectedToggle().getUserData().toString());
|
||||
client.setAdresse(AjouterClientAdresse.getText());
|
||||
client.setCodepostal(AjouterClientCodePostal.getText());
|
||||
client.setMail(AjouterClientMail.getText());
|
||||
|
||||
if(clientDB.updateClient(client))
|
||||
{
|
||||
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(400), AnchorPaneModifierCltPersonne);
|
||||
ft.setFromValue(1.0);
|
||||
ft.setToValue(0.0);
|
||||
ft.play();
|
||||
ft.setOnFinished(new EventHandler<ActionEvent>() {
|
||||
//message de succés
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
StackPaneSucessCltPersonne.setVisible(true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private boolean ControlesClient()
|
||||
{
|
||||
boolean result ;
|
||||
|
||||
AjouterClientCode.setStyle("-fx-border-color:transparent;");
|
||||
ErreurCode.setText("");
|
||||
if((AjouterClientCIN.getText().length()!= 8) || (ctl.isNumericNotnull(AjouterClientCIN.getText()))){
|
||||
ErreurCIN.setText("CIN doit être 8 numéro");
|
||||
AjouterClientCIN.setStyle("-fx-border-color:#f20606;");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
|
||||
ErreurCIN.setText("");
|
||||
AjouterClientCIN.setStyle("-fx-border-color: transparent;");
|
||||
if(AjouterClientNomComplet.getText().length()<10){
|
||||
ErreurNomComplet.setText("Client doit dépasser 10 catactaire");
|
||||
AjouterClientNomComplet.setStyle("-fx-border-color:#f20606;");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ErreurNomComplet.setText("");
|
||||
AjouterClientNomComplet.setStyle("-fx-border-color: transparent;");
|
||||
if(AjouterClientPrenom.getText().length()<3){
|
||||
AjouterClientPrenom.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurPrenom.setText("le prénom doit dépasser 3 caractaire");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ErreurPrenom.setText("");
|
||||
AjouterClientPrenom.setStyle("-fx-border-color: transparent;");
|
||||
if(AjouterClientNom.getText().length()<3){
|
||||
AjouterClientNom.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurNom.setText("Prénom doit dépasser 3 caractaire");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientNom.setStyle("-fx-border-color: transparent;");
|
||||
ErreurNom.setText("");
|
||||
if(AjouterClientNaissance.getValue()==null){
|
||||
AjouterClientNaissance.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurNaissance.setText("Date de naissance vide");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientNaissance.setStyle("-fx-border-color: transparent;");
|
||||
ErreurNaissance.setText("");
|
||||
if(ctl.isNumericNotnull(AjouterClientTeleFixe.getText())){
|
||||
AjouterClientTeleFixe.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurTeleFixe.setText("tele doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientTeleFixe.setStyle("-fx-border-color: transparent;");
|
||||
ErreurTeleFixe.setText("");
|
||||
if(AjouterClientTeleMobile.getText() != ""){
|
||||
if(ctl.isNumeric(AjouterClientTeleMobile.getText())){
|
||||
AjouterClientTeleMobile.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurTeleMobile.setText("tele doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientTeleMobile.setStyle("-fx-border-color: transparent;");
|
||||
ErreurTeleMobile.setText("");
|
||||
}
|
||||
}
|
||||
if(groupesexe.getSelectedToggle()== null){
|
||||
ErreurSexe.setText("Veuillez sélectionner le sexe");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ErreurSexe.setText("");
|
||||
if(AjouterClientAdresse.getText().length()<4){
|
||||
AjouterClientAdresse.setStyle("-fx-border-color: #f20606;");
|
||||
ErreurAdresse.setText("Adresse doit dépasser 4 caractaire");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientAdresse.setStyle("-fx-border-color: transparent;");
|
||||
ErreurAdresse.setText("");
|
||||
if(ctl.isNumeric(AjouterClientCodePostal.getText())){
|
||||
AjouterClientCodePostal.setStyle("-fx-border-color: #f20606;");
|
||||
ErreurCodePostal.setText("code doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientCodePostal.setStyle("-fx-border-color: transparent;");
|
||||
ErreurCodePostal.setText("");
|
||||
if(AjouterClientMail.getText().length()> 0){
|
||||
if(AjouterClientMail.getText().indexOf("@")< 0){
|
||||
AjouterClientMail.setStyle("-fx-border-color: #f20606;");
|
||||
ErreurMail.setText("invalide mail");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
AjouterClientMail.setStyle("-fx-border-color: transparent;");
|
||||
ErreurMail.setText("");
|
||||
result= false ;
|
||||
}
|
||||
}
|
||||
else{
|
||||
result= false ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result ;
|
||||
}
|
||||
|
||||
/**********************Clt Entreprise******************************/
|
||||
|
||||
public void setDataEntreprise(String codeEtr)
|
||||
{
|
||||
|
||||
AnchorPaneModifierCltPersonne.setVisible(false);
|
||||
AnchorPaneModifierCltEntreprise.setVisible(true);
|
||||
entreprise = EntrepriseCltDB.GetClientEtr(codeEtr);
|
||||
|
||||
Codeclt.setText(codeEtr);
|
||||
Nomclt.setText(entreprise.getNom());
|
||||
|
||||
ChampClientEntrepriseNom.setText(entreprise.getNom());
|
||||
ChampClientEntrepriseGerant.setText(entreprise.getGerant()) ;
|
||||
ChampClientEntrepriseMatricule.setText(entreprise.getMatricule());
|
||||
ChampClientEntrepriseAdresse.setText(entreprise.getAdresse());
|
||||
ChampClientEntreprisePostale.setText(entreprise.getPostalString());
|
||||
ChampClientEntrepriseTele1.setText(entreprise.getTele1String());
|
||||
ChampClientEntrepriseTele2.setText(entreprise.getTele2String());
|
||||
ChampClientEntrepriseMail.setText(entreprise.getMail());
|
||||
ChampClientEntrepriseFax.setText(entreprise.getFaxString());
|
||||
|
||||
contactEtr = entreprise.getContact();
|
||||
ChampClientEntrepriseContactNom.setText(contactEtr.getNom());
|
||||
ChampClientEntrepriseContactPrenom.setText(contactEtr.getPrenom());
|
||||
ChampClientEntrepriseContactCIN.setText(contactEtr.getCINString());
|
||||
ChampClientEntrepriseContactMail.setText(contactEtr.getMail());
|
||||
ChampClientEntrepriseContactTele1.setText(contactEtr.getTele1String());
|
||||
ChampClientEntrepriseContactTele2.setText(contactEtr.getTele2String());
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void UpdateClientEntrepriseButtonAction(ActionEvent event) throws IOException
|
||||
{
|
||||
if(!ControlesEtr()){
|
||||
if(!ControlesEtrContact()){
|
||||
|
||||
entreprise.setNom(ChampClientEntrepriseNom.getText());
|
||||
entreprise.setGerant(ChampClientEntrepriseGerant.getText());
|
||||
entreprise.setMatricule(ChampClientEntrepriseMatricule.getText());
|
||||
entreprise.setAdresse(ChampClientEntrepriseAdresse.getText());
|
||||
entreprise.setPostaleString(ChampClientEntreprisePostale.getText());
|
||||
entreprise.setTele1String(ChampClientEntrepriseTele1.getText());
|
||||
entreprise.setTele2String(ChampClientEntrepriseTele2.getText());
|
||||
entreprise.setMail(ChampClientEntrepriseMail.getText());
|
||||
entreprise.setFaxString(ChampClientEntrepriseFax.getText());
|
||||
|
||||
contactEtr.setNom(ChampClientEntrepriseContactNom.getText());
|
||||
contactEtr.setPrenom(ChampClientEntrepriseContactPrenom.getText());
|
||||
contactEtr.setCINString(ChampClientEntrepriseContactCIN.getText());
|
||||
contactEtr.setTele1String(ChampClientEntrepriseContactTele1.getText());
|
||||
contactEtr.setTele2String(ChampClientEntrepriseContactTele2.getText());
|
||||
contactEtr.setMail(ChampClientEntrepriseContactMail.getText());
|
||||
|
||||
entreprise.setContact(contactEtr);
|
||||
|
||||
if(EntrepriseCltDB.updateEntreprise(entreprise))
|
||||
{
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(400), AnchorPaneModifierCltEntreprise);
|
||||
ft.setFromValue(1.0);
|
||||
ft.setToValue(0.0);
|
||||
ft.play();
|
||||
ft.setOnFinished(new EventHandler<ActionEvent>() {
|
||||
//message de succés
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
StackPaneSucessCltPersonne.setVisible(true);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private boolean ControlesEtr()
|
||||
{
|
||||
|
||||
boolean result=false ;
|
||||
|
||||
if(ChampClientEntrepriseNom.getText().length()<3){
|
||||
ChampClientEntrepriseNom.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseNom.setText("Nom doit dépasser 3 caractère");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseNom.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseNom.setText("");
|
||||
if(ChampClientEntrepriseGerant.getText().length()<3){
|
||||
ChampClientEntrepriseGerant.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseGerant.setText("Gérant doit dépasser 3 caractère");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseGerant.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseGerant.setText("");
|
||||
if(ctl.isNumeric(ChampClientEntrepriseMatricule.getText())){
|
||||
ChampClientEntrepriseMatricule.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseMatricule.setText("Matricule doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseMatricule.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseMatricule.setText("");
|
||||
if(ChampClientEntrepriseAdresse.getText().length()<3){
|
||||
ChampClientEntrepriseAdresse.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseAdresse.setText("L'adresse doit dépasser 3 caractère");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseAdresse.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseAdresse.setText("");
|
||||
|
||||
if(ctl.isNumeric(ChampClientEntreprisePostale.getText())){
|
||||
ChampClientEntreprisePostale.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntreprisePostale.setText("code doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntreprisePostale.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntreprisePostale.setText("");
|
||||
if(ctl.isNumericNotnull(ChampClientEntrepriseTele1.getText())){
|
||||
ChampClientEntrepriseTele1.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseTele1.setText("Tele doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseTele1.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseTele1.setText("");
|
||||
if(ctl.isNumeric(ChampClientEntrepriseTele2.getText())){
|
||||
ChampClientEntrepriseTele2.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseTele2.setText("Tele2 doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseTele2.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseTele2.setText("");
|
||||
if(ctl.isNumeric(ChampClientEntrepriseFax.getText())){
|
||||
ChampClientEntrepriseFax.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseFax.setText("Fax doit être numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseFax.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseFax.setText("");
|
||||
if(ChampClientEntrepriseMail.getText().length()>0 && ChampClientEntrepriseMail.getText().indexOf("@")< 0){
|
||||
ChampClientEntrepriseMail.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseMail.setText("invalide mail");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseMail.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseMail.setText("");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return result ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private boolean ControlesEtrContact(){
|
||||
boolean result=false ;
|
||||
if(ChampClientEntrepriseContactNom.getText().length()<4){
|
||||
ChampClientEntrepriseContactNom.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseContactNom.setText("Nom doit dépasser 4 caractère");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseContactNom.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseContactNom.setText("");
|
||||
if(ChampClientEntrepriseContactPrenom.getText().length()<4){
|
||||
ChampClientEntrepriseContactPrenom.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseContactPrenom.setText("Prénom doit dépasser 4 caractère");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseContactPrenom.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseContactPrenom.setText("");
|
||||
if(ctl.isNumeric(ChampClientEntrepriseContactCIN.getText())){
|
||||
ChampClientEntrepriseContactCIN.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseContactCIN.setText("CIN doit être un numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseContactCIN.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseContactCIN.setText("");
|
||||
if(ChampClientEntrepriseContactMail.getText().length()>0){
|
||||
if(ChampClientEntrepriseContactMail.getText().indexOf("@")< 0){
|
||||
ChampClientEntrepriseContactMail.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseContactMail.setText("invalide mail");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseContactMail.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseContactMail.setText("");
|
||||
}
|
||||
}
|
||||
if(ctl.isNumericNotnull(ChampClientEntrepriseContactTele1.getText())){
|
||||
ChampClientEntrepriseContactTele1.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseContactTele1.setText("Tele doit être un numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseContactTele1.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseContactTele1.setText("");
|
||||
if(ctl.isNumeric(ChampClientEntrepriseContactTele2.getText())){
|
||||
ChampClientEntrepriseContactTele2.setStyle("-fx-border-color:#f20606;");
|
||||
ErreurClientEntrepriseContactTele2.setText("Tele doit être un numéro");
|
||||
result= true ;
|
||||
}
|
||||
else{
|
||||
ChampClientEntrepriseContactTele2.setStyle("-fx-border-color:transparent;");
|
||||
ErreurClientEntrepriseContactTele2.setText("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return result ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,420 @@
|
||||
package Controllers.Client;
|
||||
|
||||
import Models.Client.ClientEntrepriseDB;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class GestionClientEntrepriseController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(GestionClientEntrepriseController.class.getName());
|
||||
|
||||
@FXML private AnchorPane AnchorPaneGestionClt;
|
||||
|
||||
@FXML private ProgressBar ProgressBarClientEntreprise;
|
||||
|
||||
@FXML private Button ButtonSearchClientEntreprise;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount ;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
@FXML private TextField GestionClientCodeEtr;
|
||||
@FXML private TextField GestionClientNomEtr;
|
||||
@FXML private TextField GestionClientGerantEtr;
|
||||
@FXML private TextField GestionClientMatriculeEtr;
|
||||
@FXML private TextField GestionClientAdresseEtr;
|
||||
@FXML private TextField GestionClientTelephoneEtr;
|
||||
|
||||
@FXML private TableView<ListeClientEntreprise> TableViewListeClientEntreprise ;
|
||||
|
||||
@FXML private TableColumn<ListeClientEntreprise ,String> CodeClientEtr;
|
||||
@FXML private TableColumn<ListeClientEntreprise ,String> NomEntreprise;
|
||||
@FXML private TableColumn<ListeClientEntreprise ,String> Gerant ;
|
||||
@FXML private TableColumn<ListeClientEntreprise ,String> matricule;
|
||||
@FXML private TableColumn<ListeClientEntreprise ,String> Adresse;
|
||||
@FXML private TableColumn<ListeClientEntreprise ,Integer> Telephone;
|
||||
@FXML private TableColumn<ListeClientEntreprise, Boolean> Action ;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
private Service<Void> ThreadSearchClientEntreprise;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
CodeClientEtr.setCellValueFactory(new PropertyValueFactory<ListeClientEntreprise, String>("code"));
|
||||
NomEntreprise.setCellValueFactory(new PropertyValueFactory<ListeClientEntreprise, String>("NomEntreprise"));
|
||||
Gerant.setCellValueFactory(new PropertyValueFactory<ListeClientEntreprise, String>("Gerant"));
|
||||
matricule.setCellValueFactory(new PropertyValueFactory<ListeClientEntreprise, String>("matricule"));
|
||||
Adresse.setCellValueFactory(new PropertyValueFactory<ListeClientEntreprise, String>("Adresse"));
|
||||
Telephone.setCellValueFactory(new PropertyValueFactory<ListeClientEntreprise, Integer>("Telephone"));
|
||||
|
||||
Action.setSortable(true);
|
||||
Action.setStyle( "-fx-alignment: CENTER;");Action.getStyleClass().add("Center");
|
||||
Action.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<ListeClientEntreprise, Boolean>,ObservableValue<Boolean>>() {
|
||||
@Override
|
||||
public ObservableValue<Boolean> call(TableColumn.CellDataFeatures<ListeClientEntreprise, Boolean> p) {
|
||||
return new SimpleBooleanProperty(p.getValue() != null);
|
||||
}
|
||||
});
|
||||
|
||||
// create a cell value factory with an add button for each row in the table.
|
||||
Action.setCellFactory(new Callback<TableColumn<ListeClientEntreprise, Boolean>, TableCell<ListeClientEntreprise, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<ListeClientEntreprise, Boolean> call(TableColumn<ListeClientEntreprise, Boolean> personBooleanTableColumn) {
|
||||
return new ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//DOUBLE CLIQUE SUR UN CLIENT
|
||||
TableViewListeClientEntreprise.setOnMouseClicked(new EventHandler<javafx.scene.input.MouseEvent>(){
|
||||
public void handle(MouseEvent event){
|
||||
if(event.getClickCount()>1){
|
||||
if(TableViewListeClientEntreprise.getSelectionModel().getSelectedIndex()>=0){
|
||||
|
||||
try {
|
||||
AnchorPaneGestionClt.getChildren().clear();
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Client/DetailClient.fxml"));
|
||||
Parent root = (Parent)fxmlLoader.load();
|
||||
DetailClientController DcltCtl = fxmlLoader.<DetailClientController>getController();
|
||||
DcltCtl.setDataEntreprise(TableViewListeClientEntreprise.getSelectionModel().getSelectedItem().getCode());
|
||||
AnchorPaneGestionClt.getChildren().add(root);
|
||||
//
|
||||
//DcltCtl.setUser("sqdfqsdf");
|
||||
} catch (IOException ex) {
|
||||
logger.error("GestionClientEntrepriseController : DetailClient.fxml :" + ex.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ButtonSearchClientEntreprise.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchClientEntreprise();
|
||||
}
|
||||
});
|
||||
|
||||
AnchorPaneGestionClt.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchClientEntreprise();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SearchClientEntreprise();
|
||||
|
||||
GestionSearchClientEntreprise();
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void AjouterClientPersonneRadioAction(ActionEvent event) throws IOException {
|
||||
AnchorPaneGestionClt.getChildren().clear();
|
||||
AnchorPaneGestionClt.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Client/GestionClientPersonne.fxml")));
|
||||
}
|
||||
|
||||
|
||||
//Define the button cell
|
||||
private class ButtonCell extends TableCell<ListeClientEntreprise, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
|
||||
ButtonCell(){
|
||||
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/detailbutton.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
//Action when the button is pressed
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
// get Selected Item
|
||||
ListeClientEntreprise currentEntreprise = (ListeClientEntreprise) ButtonCell.this.getTableView().getItems().get(ButtonCell.this.getIndex());
|
||||
try {
|
||||
AnchorPaneGestionClt.getChildren().clear();
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Client/DetailClient.fxml"));
|
||||
Parent root = (Parent)fxmlLoader.load();
|
||||
DetailClientController DcltCtl = fxmlLoader.<DetailClientController>getController();
|
||||
DcltCtl.setDataEntreprise(currentEntreprise.getCode());
|
||||
|
||||
AnchorPaneGestionClt.getChildren().add(root);
|
||||
} catch (IOException ex) {
|
||||
logger.error("GestionClientEntrepriseController : ButtonCell : DetailClient.fxml : " + ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchClientEntreprise()
|
||||
{
|
||||
ProgressBarClientEntreprise.setVisible(true);
|
||||
|
||||
ButtonSearchClientEntreprise.setDisable(true);
|
||||
|
||||
ThreadSearchClientEntreprise = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
ObservableList<ListeClientEntreprise> ListeCltEntreprise = new ClientEntrepriseDB().SearchCltEntrepriseGestion(
|
||||
position,
|
||||
nbrligne,
|
||||
GestionClientCodeEtr.getText(),
|
||||
GestionClientNomEtr.getText(),
|
||||
GestionClientGerantEtr.getText(),
|
||||
GestionClientMatriculeEtr.getText(),
|
||||
GestionClientAdresseEtr.getText(),
|
||||
GestionClientTelephoneEtr.getText());
|
||||
|
||||
TableViewListeClientEntreprise.setItems(ListeCltEntreprise);
|
||||
|
||||
totalcount = new ClientEntrepriseDB().nbrCltEntrepriseGestion(GestionClientCodeEtr.getText(), GestionClientNomEtr.getText(), GestionClientGerantEtr.getText(), GestionClientMatriculeEtr.getText(), GestionClientAdresseEtr.getText(), GestionClientTelephoneEtr.getText());
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchClientEntreprise.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarClientEntreprise.setVisible(false);
|
||||
ButtonSearchClientEntreprise.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchClientEntreprise.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void NextLastSearchClientEntreprise(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarClientEntreprise.setVisible(true);
|
||||
|
||||
ButtonSearchClientEntreprise.setDisable(true);
|
||||
|
||||
ThreadSearchClientEntreprise = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
ObservableList<ListeClientEntreprise> ListeCltEntreprise = new ClientEntrepriseDB().SearchCltEntrepriseGestion(
|
||||
ParmPosition,
|
||||
ParamNbrligne,
|
||||
GestionClientCodeEtr.getText(),
|
||||
GestionClientNomEtr.getText(),
|
||||
GestionClientGerantEtr.getText(),
|
||||
GestionClientMatriculeEtr.getText(),
|
||||
GestionClientAdresseEtr.getText(),
|
||||
GestionClientTelephoneEtr.getText());
|
||||
|
||||
TableViewListeClientEntreprise.setItems(ListeCltEntreprise);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchClientEntreprise.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarClientEntreprise.setVisible(false);
|
||||
ButtonSearchClientEntreprise.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchClientEntreprise.start();
|
||||
}
|
||||
|
||||
private void GestionSearchClientEntreprise()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchClientEntreprise(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchClientEntreprise(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchClientEntreprise(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchClientEntreprise(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchClientEntreprise(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,415 @@
|
||||
package Controllers.Client;
|
||||
|
||||
import Models.Client.ClientDB;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class GestionClientPersonneController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(GestionClientPersonneController.class.getName());
|
||||
|
||||
@FXML private AnchorPane AnchorPaneGestionClt;
|
||||
|
||||
@FXML private AnchorPane AnchorPaneCltBody ;
|
||||
|
||||
@FXML private ProgressBar ProgressBarClientPersonne;
|
||||
|
||||
@FXML private Button ButtonSearchClientPersonne;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount ;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
@FXML private TextField GestionClientcode;
|
||||
@FXML private TextField GestionClientcin;
|
||||
@FXML private TextField GestionClientnomcomplet;
|
||||
@FXML private TextField GestionClientnom;
|
||||
@FXML private TextField GestionClientprenom;
|
||||
@FXML private DatePicker DatePickerNaissance;
|
||||
|
||||
@FXML private TableView<ListeClient> TableViewListeClient ;
|
||||
|
||||
@FXML private TableColumn<ListeClient ,Integer> codeclient;
|
||||
@FXML private TableColumn<ListeClient ,Integer> cin;
|
||||
@FXML private TableColumn<ListeClient ,String> nomcomplet;
|
||||
@FXML private TableColumn<ListeClient ,String> nom;
|
||||
@FXML private TableColumn<ListeClient ,String> prenom;
|
||||
@FXML private TableColumn<ListeClient ,Integer> tele;
|
||||
@FXML private TableColumn<ListeClient, Boolean> Action ;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
private Service<Void> ThreadSearchClientPersonne;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
codeclient.setCellValueFactory(new PropertyValueFactory<ListeClient, Integer>("code"));
|
||||
|
||||
cin.setCellValueFactory(new PropertyValueFactory<ListeClient, Integer>("cin"));
|
||||
|
||||
nomcomplet.setCellValueFactory(new PropertyValueFactory<ListeClient, String>("nomcomplet"));
|
||||
|
||||
nom.setCellValueFactory(new PropertyValueFactory<ListeClient, String>("nom"));
|
||||
|
||||
prenom.setCellValueFactory(new PropertyValueFactory<ListeClient, String>("prenom"));
|
||||
|
||||
tele.setCellValueFactory(new PropertyValueFactory<ListeClient, Integer>("tele"));
|
||||
|
||||
Action.setSortable(true);
|
||||
Action.setStyle( "-fx-alignment: CENTER;");Action.getStyleClass().add("Center");
|
||||
Action.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<ListeClient, Boolean>, ObservableValue<Boolean>>() {
|
||||
@Override
|
||||
public ObservableValue<Boolean> call(TableColumn.CellDataFeatures<ListeClient, Boolean> p) {
|
||||
return new SimpleBooleanProperty(p.getValue() != null);
|
||||
}
|
||||
});
|
||||
|
||||
// create a cell value factory with an add button for each row in the table.
|
||||
Action.setCellFactory(new Callback<TableColumn<ListeClient, Boolean>, TableCell<ListeClient, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<ListeClient, Boolean> call(TableColumn<ListeClient, Boolean> personBooleanTableColumn) {
|
||||
return new GestionClientPersonneController.ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
ButtonSearchClientPersonne.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchClientPersonne();
|
||||
}
|
||||
});
|
||||
|
||||
AnchorPaneGestionClt.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchClientPersonne();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SearchClientPersonne();
|
||||
|
||||
GestionSearchClientPersonne();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Define the button cell
|
||||
private class ButtonCell extends TableCell<ListeClient, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
|
||||
ButtonCell(){
|
||||
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/detailbutton.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
//Action when the button is pressed
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
// get Selected Item
|
||||
ListeClient currentPerson = (ListeClient) ButtonCell.this.getTableView().getItems().get(ButtonCell.this.getIndex());
|
||||
try {
|
||||
AnchorPaneGestionClt.getChildren().clear();
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Client/DetailClient.fxml"));
|
||||
Parent root = (Parent)fxmlLoader.load();
|
||||
DetailClientController DcltCtl = fxmlLoader.<DetailClientController>getController();
|
||||
DcltCtl.setDataClient(currentPerson.getCode().toString());
|
||||
AnchorPaneGestionClt.getChildren().add(root);
|
||||
} catch (IOException ex) {
|
||||
logger.error("GestionClientPersonneController : ButtonCell : DetailClient.fxml : " + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// modifer pour client entreprise
|
||||
@FXML
|
||||
public void AjouterClientEntrepriseRadioAction(ActionEvent event) throws IOException {
|
||||
AnchorPaneGestionClt.getChildren().clear();
|
||||
AnchorPaneGestionClt.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Client/GestionClientEntreprise.fxml")));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchClientPersonne()
|
||||
{
|
||||
ProgressBarClientPersonne.setVisible(true);
|
||||
|
||||
ButtonSearchClientPersonne.setDisable(true);
|
||||
|
||||
ThreadSearchClientPersonne = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DateNaissance = "";
|
||||
if(DatePickerNaissance.getValue() != null){
|
||||
DateNaissance = DatePickerNaissance.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<ListeClient> ListeCltPersonne = new ClientDB().SearchCltPersonneGestion(
|
||||
position,
|
||||
nbrligne,
|
||||
GestionClientcode.getText(),
|
||||
GestionClientcin.getText(),
|
||||
GestionClientnomcomplet.getText(),
|
||||
GestionClientnom.getText(),
|
||||
GestionClientprenom.getText(),
|
||||
DateNaissance);
|
||||
|
||||
TableViewListeClient.setItems(ListeCltPersonne);
|
||||
|
||||
totalcount = new ClientDB().nbrCltPersonneGestion(GestionClientcode.getText(), GestionClientcin.getText(), GestionClientnomcomplet.getText(), GestionClientnom.getText(), GestionClientprenom.getText(), DateNaissance);
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchClientPersonne.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarClientPersonne.setVisible(false);
|
||||
ButtonSearchClientPersonne.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchClientPersonne.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void NextLastSearchClientPersonne(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarClientPersonne.setVisible(true);
|
||||
|
||||
ButtonSearchClientPersonne.setDisable(true);
|
||||
|
||||
ThreadSearchClientPersonne = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateNaissance = "";
|
||||
if(DatePickerNaissance.getValue() != null){
|
||||
DateNaissance = DatePickerNaissance.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<ListeClient> ListeCltPersonne = new ClientDB().SearchCltPersonneGestion(
|
||||
ParmPosition,
|
||||
ParamNbrligne,
|
||||
GestionClientcode.getText(),
|
||||
GestionClientcin.getText(),
|
||||
GestionClientnomcomplet.getText(),
|
||||
GestionClientnom.getText(),
|
||||
GestionClientprenom.getText(),
|
||||
DateNaissance);
|
||||
|
||||
TableViewListeClient.setItems(ListeCltPersonne);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchClientPersonne.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarClientPersonne.setVisible(false);
|
||||
ButtonSearchClientPersonne.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchClientPersonne.start();
|
||||
}
|
||||
|
||||
private void GestionSearchClientPersonne()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchClientPersonne(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchClientPersonne(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchClientPersonne(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchClientPersonne(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchClientPersonne(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
82
src/main/java/Controllers/Client/ListeClient.java
Normal file
82
src/main/java/Controllers/Client/ListeClient.java
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.Client;
|
||||
|
||||
import javafx.beans.property.SimpleIntegerProperty;
|
||||
import javafx.beans.property.SimpleLongProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class ListeClient {
|
||||
private final SimpleStringProperty code;
|
||||
private final SimpleStringProperty cin;
|
||||
private final SimpleStringProperty nomcomplet;
|
||||
private final SimpleStringProperty nom;
|
||||
private final SimpleStringProperty prenom;
|
||||
private final SimpleStringProperty naissance_str;
|
||||
private final SimpleStringProperty adresse;
|
||||
private final SimpleStringProperty tele;
|
||||
private final SimpleStringProperty tele2;
|
||||
private final SimpleIntegerProperty sexe;
|
||||
|
||||
public ListeClient(String code, String cin, String nomcomplet, String nom, String prenom, String naissance_str, String adresse, String tele, String tele2, Integer sexe) {
|
||||
this.code = new SimpleStringProperty(code);
|
||||
this.cin = new SimpleStringProperty(cin);
|
||||
this.nomcomplet = new SimpleStringProperty(nomcomplet);
|
||||
this.nom = new SimpleStringProperty(nom);
|
||||
this.prenom = new SimpleStringProperty(prenom);
|
||||
this.naissance_str = new SimpleStringProperty(naissance_str);
|
||||
this.adresse = new SimpleStringProperty(adresse);
|
||||
this.tele = new SimpleStringProperty(tele);
|
||||
this.tele2 = new SimpleStringProperty(tele2);
|
||||
this.sexe = new SimpleIntegerProperty(sexe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getCode() {
|
||||
return code.get();
|
||||
}
|
||||
|
||||
public String getCin() {
|
||||
return cin.get();
|
||||
}
|
||||
|
||||
public String getNomcomplet() {
|
||||
return nomcomplet.get();
|
||||
}
|
||||
|
||||
public String getNom() {
|
||||
return nom.get();
|
||||
}
|
||||
|
||||
public String getPrenom() {
|
||||
return prenom.get();
|
||||
}
|
||||
|
||||
public String getNaissanceString() {
|
||||
return naissance_str.get();
|
||||
}
|
||||
|
||||
public String getAdresse() {
|
||||
return adresse.get();
|
||||
}
|
||||
|
||||
public String getTele() {
|
||||
return tele.get();
|
||||
}
|
||||
|
||||
public String getTele2() {
|
||||
return tele2.get();
|
||||
}
|
||||
|
||||
public Integer getSexe() {
|
||||
return sexe.get();
|
||||
}
|
||||
}
|
||||
66
src/main/java/Controllers/Client/ListeClientEntreprise.java
Normal file
66
src/main/java/Controllers/Client/ListeClientEntreprise.java
Normal file
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.Client;
|
||||
|
||||
|
||||
import javafx.beans.property.SimpleLongProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Maher
|
||||
*/
|
||||
public class ListeClientEntreprise {
|
||||
|
||||
private final SimpleStringProperty code;
|
||||
private final SimpleStringProperty NomEntreprise;
|
||||
private final SimpleStringProperty gerant;
|
||||
private final SimpleStringProperty matricule;
|
||||
private final SimpleStringProperty adresse;
|
||||
private final SimpleStringProperty Telephone;
|
||||
private final SimpleStringProperty Telephone2;
|
||||
|
||||
public ListeClientEntreprise(String code, String nomEtr, String gerant, String matricule, String adresse, String Telephone, String Telephone2) {
|
||||
this.code = new SimpleStringProperty(code);
|
||||
this.NomEntreprise = new SimpleStringProperty(nomEtr);
|
||||
this.gerant = new SimpleStringProperty(gerant);
|
||||
this.matricule = new SimpleStringProperty(matricule);
|
||||
this.adresse = new SimpleStringProperty(adresse);
|
||||
this.Telephone = new SimpleStringProperty(Telephone);
|
||||
this.Telephone2 = new SimpleStringProperty(Telephone2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getCode() {
|
||||
return code.get();
|
||||
}
|
||||
|
||||
public String getNomEntreprise() {
|
||||
return NomEntreprise.get();
|
||||
}
|
||||
|
||||
public String getGerant() {
|
||||
return gerant.get();
|
||||
}
|
||||
|
||||
public String getMatricule() {
|
||||
return matricule.get();
|
||||
}
|
||||
|
||||
public String getAdresse() {
|
||||
return adresse.get();
|
||||
}
|
||||
|
||||
public String getTelephone() {
|
||||
return Telephone.get();
|
||||
}
|
||||
|
||||
public String getTelephone2() {
|
||||
return Telephone2.get();
|
||||
}
|
||||
|
||||
}
|
||||
47
src/main/java/Controllers/Client/MenuClientController.java
Normal file
47
src/main/java/Controllers/Client/MenuClientController.java
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.Client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
*
|
||||
* @author Maher
|
||||
*/
|
||||
public class MenuClientController implements Initializable {
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
|
||||
@FXML private AnchorPane AnchorPaneAjouterClient ;
|
||||
|
||||
@FXML
|
||||
private void AjouterClientButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPaneAjouterClient.getChildren().clear();
|
||||
AnchorPaneAjouterClient.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Client/AjouterClient.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void detailClientButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPaneAjouterClient.getChildren().clear();
|
||||
AnchorPaneAjouterClient.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Client/GestionClientPersonne.fxml")));
|
||||
}
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,365 @@
|
||||
package Controllers.Client;
|
||||
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Models.Client.ClientEntrepriseDB;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class RechercherClientEntrepriseController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(RechercherClientEntrepriseController.class.getName());
|
||||
|
||||
@FXML public AnchorPane AnchoreClientEntre ;
|
||||
|
||||
public Node nodeFxmlEtr ;
|
||||
|
||||
@FXML private ProgressBar ProgressBarClientEntreprise;
|
||||
|
||||
@FXML public RadioButton cltPer ;
|
||||
@FXML public RadioButton cltEtr ;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount ;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
@FXML private Button ButtonSearchClientEntreprise;
|
||||
|
||||
@FXML private TextField RerchercheCodeEtr;
|
||||
@FXML private TextField RerchercheNomEtr;
|
||||
@FXML private TextField RerchercheGerantEtr;
|
||||
@FXML private TextField RerchercheMatriculeEtr;
|
||||
@FXML private TextField RerchercheAdresseEtr;
|
||||
@FXML private TextField RerchercheTelephoneEtr;
|
||||
|
||||
@FXML private TableView<ListeClientEntreprise> TableViewListeClientEntreprise ;
|
||||
|
||||
@FXML private TableColumn<ListeClientEntreprise ,String> TableColumnCodeClientEtr;
|
||||
@FXML private TableColumn<ListeClientEntreprise ,String> TableColumnNomEntreprise;
|
||||
@FXML private TableColumn<ListeClientEntreprise ,String> TableColumnGerant ;
|
||||
@FXML private TableColumn<ListeClientEntreprise ,String> TableColumnMatricule;
|
||||
@FXML private TableColumn<ListeClientEntreprise ,String> TableColumnAdresse;
|
||||
@FXML private TableColumn<ListeClientEntreprise ,Integer> TableColumnTelephone;
|
||||
@FXML public TableColumn<ListeClientEntreprise, String> TableColumnActionEtre ;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
private Service<Void> ThreadSearchRechercheClientEntreprise;
|
||||
|
||||
public RechercherClientEntrepriseController(){
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Client/RechercherClientEntreprise.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
nodeFxmlEtr = (Node) fxmlLoader.load();
|
||||
} catch (IOException ex) {
|
||||
logger.error("RechercherClientEntrepriseController : RechercherClientEntreprise.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TableColumnCodeClientEtr.setCellValueFactory(new PropertyValueFactory<ListeClientEntreprise, String>("code"));
|
||||
TableColumnNomEntreprise.setCellValueFactory(new PropertyValueFactory<ListeClientEntreprise, String>("NomEntreprise"));
|
||||
TableColumnGerant.setCellValueFactory(new PropertyValueFactory<ListeClientEntreprise, String>("Gerant"));
|
||||
TableColumnMatricule.setCellValueFactory(new PropertyValueFactory<ListeClientEntreprise, String>("matricule"));
|
||||
TableColumnAdresse.setCellValueFactory(new PropertyValueFactory<ListeClientEntreprise, String>("Adresse"));
|
||||
TableColumnTelephone.setCellValueFactory(new PropertyValueFactory<ListeClientEntreprise, Integer>("Telephone"));
|
||||
|
||||
TableColumnActionEtre.setStyle( "-fx-alignment: CENTER;");
|
||||
TableColumnActionEtre.getStyleClass().add("Center");
|
||||
|
||||
//comboboxnombre des lignes tableview
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
ButtonSearchClientEntreprise.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchClientEntreprise();
|
||||
}
|
||||
});
|
||||
|
||||
AnchoreClientEntre.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchClientEntreprise();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
GestionSearchClientEntreprise();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
private void QuiterButtonAction(ActionEvent event) throws IOException {
|
||||
AnchoreClientEntre.setVisible(false);
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(nodeFxmlEtr);
|
||||
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
|
||||
cltEtr.setSelected(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchClientEntreprise()
|
||||
{
|
||||
ProgressBarClientEntreprise.setVisible(true);
|
||||
|
||||
ButtonSearchClientEntreprise.setDisable(true);
|
||||
|
||||
ThreadSearchRechercheClientEntreprise = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
ObservableList<ListeClientEntreprise> ListeCltEntreprise = new ClientEntrepriseDB().SearchCltEntrepriseGestion(
|
||||
position,
|
||||
nbrligne,
|
||||
RerchercheCodeEtr.getText(),
|
||||
RerchercheNomEtr.getText(),
|
||||
RerchercheGerantEtr.getText(),
|
||||
RerchercheMatriculeEtr.getText(),
|
||||
RerchercheAdresseEtr.getText(),
|
||||
RerchercheTelephoneEtr.getText());
|
||||
|
||||
TableViewListeClientEntreprise.setItems(ListeCltEntreprise);
|
||||
|
||||
totalcount = new ClientEntrepriseDB().nbrCltEntrepriseGestion(RerchercheCodeEtr.getText(), RerchercheNomEtr.getText(), RerchercheGerantEtr.getText(), RerchercheMatriculeEtr.getText(), RerchercheAdresseEtr.getText(), RerchercheTelephoneEtr.getText());
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchRechercheClientEntreprise.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarClientEntreprise.setVisible(false);
|
||||
ButtonSearchClientEntreprise.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchRechercheClientEntreprise.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void NextLastSearchClientEntreprise(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarClientEntreprise.setVisible(true);
|
||||
|
||||
ButtonSearchClientEntreprise.setDisable(true);
|
||||
|
||||
ThreadSearchRechercheClientEntreprise = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
ObservableList<ListeClientEntreprise> ListeCltEntreprise = new ClientEntrepriseDB().SearchCltEntrepriseGestion(
|
||||
ParmPosition,
|
||||
ParamNbrligne,
|
||||
RerchercheCodeEtr.getText(),
|
||||
RerchercheNomEtr.getText(),
|
||||
RerchercheGerantEtr.getText(),
|
||||
RerchercheMatriculeEtr.getText(),
|
||||
RerchercheAdresseEtr.getText(),
|
||||
RerchercheTelephoneEtr.getText());
|
||||
|
||||
TableViewListeClientEntreprise.setItems(ListeCltEntreprise);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchRechercheClientEntreprise.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarClientEntreprise.setVisible(false);
|
||||
ButtonSearchClientEntreprise.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchRechercheClientEntreprise.start();
|
||||
}
|
||||
|
||||
private void GestionSearchClientEntreprise()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchClientEntreprise(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchClientEntreprise(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchClientEntreprise(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchClientEntreprise(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchClientEntreprise(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,396 @@
|
||||
package Controllers.Client;
|
||||
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Models.Client.Client;
|
||||
import Models.Client.ClientDB;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class RechercherClientPersonneController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(RechercherClientPersonneController.class.getName());
|
||||
|
||||
@FXML public AnchorPane AnchoreClientPerson ;
|
||||
|
||||
@FXML public StackPane StackpaneClient ;
|
||||
|
||||
@FXML private ProgressBar ProgressBarClientPersonne;
|
||||
|
||||
@FXML private Button ButtonSearchClientPersonne;
|
||||
|
||||
@FXML public RadioButton cltEntreprise ;
|
||||
@FXML public RadioButton cltPersonne ;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount ;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
@FXML private TableView<ListeClient> TableViewListeClient ;
|
||||
|
||||
@FXML private TableColumn<ListeClient ,String> codeclient;
|
||||
@FXML private TableColumn<ListeClient ,Integer> cin;
|
||||
@FXML private TableColumn<ListeClient ,String> nomcomplet;
|
||||
@FXML private TableColumn<ListeClient ,String> nom;
|
||||
@FXML private TableColumn<ListeClient ,String> prenom;
|
||||
@FXML private TableColumn<ListeClient ,String> tele;
|
||||
@FXML public TableColumn<ListeClient, String> Action ;
|
||||
|
||||
@FXML private TextField GestionClientcode;
|
||||
@FXML private TextField GestionClientcin;
|
||||
@FXML private TextField GestionClientnomcomplet;
|
||||
@FXML private TextField GestionClientnom;
|
||||
@FXML private TextField GestionClientprenom;
|
||||
@FXML private DatePicker DatePickerNaissance;
|
||||
|
||||
public Node nodeFxml ;
|
||||
|
||||
Client client = new Client();
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
public Object[] ArrayObjectDataSave = new Object[10];
|
||||
|
||||
private Service<Void> ThreadSearchRerchecheClientPersonne;
|
||||
|
||||
public RechercherClientPersonneController() {
|
||||
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Client/RechercherClientPersonne.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
nodeFxml = (Node) fxmlLoader.load();
|
||||
} catch (IOException ex) {
|
||||
logger.error("RechercherClientPersonneController : RechercherClientPersonne.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
NbrLigne.setItems(cursors);
|
||||
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
codeclient.setCellValueFactory(new PropertyValueFactory<ListeClient, String>("code"));
|
||||
|
||||
cin.setCellValueFactory(new PropertyValueFactory<ListeClient, Integer>("cin"));
|
||||
|
||||
nomcomplet.setCellValueFactory(new PropertyValueFactory<ListeClient, String>("nomcomplet"));
|
||||
|
||||
nom.setCellValueFactory(new PropertyValueFactory<ListeClient, String>("nom"));
|
||||
|
||||
prenom.setCellValueFactory(new PropertyValueFactory<ListeClient, String>("prenom"));
|
||||
|
||||
tele.setCellValueFactory(new PropertyValueFactory<ListeClient, String>("tele"));
|
||||
|
||||
Action.setStyle( "-fx-alignment: CENTER;");
|
||||
Action.getStyleClass().add("Center");
|
||||
|
||||
ButtonSearchClientPersonne.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchClientPersonne();
|
||||
}
|
||||
});
|
||||
|
||||
AnchoreClientPerson.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchClientPersonne();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
GestionSearchClientPersonne();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
private void QuiterButtonAction(ActionEvent event) throws IOException {
|
||||
AnchoreClientPerson.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ShowDialg()
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(nodeFxml);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
|
||||
cltPersonne.setSelected(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchClientPersonne()
|
||||
{
|
||||
ProgressBarClientPersonne.setVisible(true);
|
||||
|
||||
ButtonSearchClientPersonne.setDisable(true);
|
||||
|
||||
ThreadSearchRerchecheClientPersonne = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DateNaissance = "";
|
||||
if(DatePickerNaissance.getValue() != null){
|
||||
DateNaissance = DatePickerNaissance.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<ListeClient> ListeCltPersonne = new ClientDB().SearchCltPersonneGestion(
|
||||
position,
|
||||
nbrligne,
|
||||
GestionClientcode.getText(),
|
||||
GestionClientcin.getText(),
|
||||
GestionClientnomcomplet.getText(),
|
||||
GestionClientnom.getText(),
|
||||
GestionClientprenom.getText(),
|
||||
DateNaissance);
|
||||
|
||||
TableViewListeClient.setItems(ListeCltPersonne);
|
||||
|
||||
totalcount = new ClientDB().nbrCltPersonneGestion(GestionClientcode.getText(), GestionClientcin.getText(), GestionClientnomcomplet.getText(), GestionClientnom.getText(), GestionClientprenom.getText(), DateNaissance);
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchRerchecheClientPersonne.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarClientPersonne.setVisible(false);
|
||||
ButtonSearchClientPersonne.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchRerchecheClientPersonne.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void NextLastSearchClientPersonne(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarClientPersonne.setVisible(true);
|
||||
|
||||
ButtonSearchClientPersonne.setDisable(true);
|
||||
|
||||
ThreadSearchRerchecheClientPersonne = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateNaissance = "";
|
||||
if(DatePickerNaissance.getValue() != null){
|
||||
DateNaissance = DatePickerNaissance.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<ListeClient> ListeCltPersonne = new ClientDB().SearchCltPersonneGestion(
|
||||
ParmPosition,
|
||||
ParamNbrligne,
|
||||
GestionClientcode.getText(),
|
||||
GestionClientcin.getText(),
|
||||
GestionClientnomcomplet.getText(),
|
||||
GestionClientnom.getText(),
|
||||
GestionClientprenom.getText(),
|
||||
DateNaissance);
|
||||
|
||||
TableViewListeClient.setItems(ListeCltPersonne);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchRerchecheClientPersonne.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarClientPersonne.setVisible(false);
|
||||
ButtonSearchClientPersonne.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchRerchecheClientPersonne.start();
|
||||
}
|
||||
|
||||
private void GestionSearchClientPersonne()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchClientPersonne(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchClientPersonne(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchClientPersonne(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchClientPersonne(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchClientPersonne(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
197
src/main/java/Controllers/CommandeClt/CommandeCltDetail.java
Normal file
197
src/main/java/Controllers/CommandeClt/CommandeCltDetail.java
Normal file
@@ -0,0 +1,197 @@
|
||||
package Controllers.CommandeClt;
|
||||
|
||||
import Controllers.BonLivraisonClt.BonLivraisonCltAjouterEtape2Controller;
|
||||
import Models.Produit.ListeProduit;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Models.CommandeClt.CommandeClt;
|
||||
import Models.CommandeClt.CommandeCltDB;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class CommandeCltDetail implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(CommandeCltDetail.class.getName());
|
||||
|
||||
@FXML private AnchorPane PaneAjouter ;
|
||||
@FXML private AnchorPane AnchorPaneCommandeCltDetail ;
|
||||
@FXML private AnchorPane AnchorPaneLoadingCommandeDetail ;
|
||||
@FXML public AnchorPane AnchorPaneSucces ;
|
||||
@FXML public AnchorPane AnchorPaneInfoCommandeClt;
|
||||
@FXML private Text CodeCommande;
|
||||
@FXML private Text DateCreation;
|
||||
@FXML private Text Reglement;
|
||||
@FXML private Text NetAPayer;
|
||||
@FXML private Text TotalTVA;
|
||||
@FXML private Text CodeDevis;
|
||||
|
||||
@FXML private Text TypeClt;
|
||||
@FXML private Text Nom;
|
||||
@FXML private Text Prenom;
|
||||
@FXML private Text Adresse;
|
||||
@FXML private Text TELE1;
|
||||
@FXML private Text TELE2;
|
||||
|
||||
@FXML private Text TextPrenom ;
|
||||
@FXML private Text TextMatricule ;
|
||||
|
||||
@FXML private TableView<ListeProduit> TableViewListeProduit ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColReference;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDesignation;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColQuantite ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColPrixHT;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColRemise;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTotalHT;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTVA;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTotalTTC;
|
||||
|
||||
@FXML private Button ButtonCreationBonLivraison;
|
||||
|
||||
private Service<Void> ThreadCommandeCltDetail;
|
||||
|
||||
CommandeClt commandeClt;
|
||||
String idCommandeClt;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TableViewListeProduit.setEditable(false);
|
||||
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColDesignation.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColRemise.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColRemise.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColRemise.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTotalTTC.getStyleClass().add("Center");
|
||||
|
||||
ButtonCreationBonLivraison.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/BonLivraisonClt/BonLivraisonCltAjouterEtape2.fxml"));
|
||||
Parent NodeBonLivraisonCltAjouterEtape2 = (Parent)fxmlLoader.load();
|
||||
BonLivraisonCltAjouterEtape2Controller BonLivraisonCltAjouterEtape2= fxmlLoader.getController();
|
||||
|
||||
PaneAjouter.getChildren().clear();
|
||||
PaneAjouter.getChildren().add(NodeBonLivraisonCltAjouterEtape2);
|
||||
|
||||
BonLivraisonCltAjouterEtape2.SetDataCommandeClt(idCommandeClt);
|
||||
} catch (IOException ex) {
|
||||
logger.error("CommandeCltDetail : BonLivraisonCltAjouterEtape2.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void SowDetailCommandeClt(String codeCommande)
|
||||
{
|
||||
idCommandeClt = codeCommande;
|
||||
ThreadCommandeCltDetail = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
commandeClt = new CommandeCltDB().getCommandeClt(codeCommande);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadCommandeCltDetail.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
CodeCommande.setText(commandeClt.getCodecommandeclt());
|
||||
DateCreation.setText(Adaptateur.NormalDateFormat(commandeClt.getDate()));
|
||||
Reglement.setText(commandeClt.getTypeRegementString());
|
||||
TotalTVA.setText(commandeClt.getTotalTVA());
|
||||
TypeClt.setText(commandeClt.getTypeClientString());
|
||||
CodeDevis.setText(commandeClt.getCodeDevis());
|
||||
|
||||
if(commandeClt.getTypeClient()==0){
|
||||
TextPrenom.setVisible(true);
|
||||
TextMatricule.setVisible(false);
|
||||
Nom.setText(commandeClt.CltPersonne.getNom());
|
||||
Prenom.setText(commandeClt.CltPersonne.getPrenom());
|
||||
Adresse.setText(commandeClt.CltPersonne.getAdresse());
|
||||
TELE1.setText(commandeClt.CltPersonne.getTelefixString());
|
||||
TELE2.setText(commandeClt.CltPersonne.getTelemobileString());
|
||||
}
|
||||
|
||||
if(commandeClt.getTypeClient()==1){
|
||||
TextPrenom.setVisible(false);
|
||||
TextMatricule.setVisible(true);
|
||||
Nom.setText(commandeClt.CltEntreprise.getNom());
|
||||
Prenom.setText(commandeClt.CltEntreprise.getMatricule());
|
||||
Adresse.setText(commandeClt.CltEntreprise.getAdresse());
|
||||
TELE1.setText(commandeClt.CltEntreprise.getTele1String());
|
||||
TELE2.setText(commandeClt.CltEntreprise.getTele2String());
|
||||
}
|
||||
|
||||
if(commandeClt.getTypeClient()==2){
|
||||
TextPrenom.setVisible(true);
|
||||
TextMatricule.setVisible(false);
|
||||
Nom.setText(commandeClt.CltPassager.getNom());
|
||||
Prenom.setText(commandeClt.CltPassager.getPrenom());
|
||||
Adresse.setText(commandeClt.CltPassager.getAdresse());
|
||||
TELE1.setText(commandeClt.CltPassager.getTelefixString());
|
||||
TELE2.setText(commandeClt.CltPassager.getTelemobileString());
|
||||
}
|
||||
if(commandeClt.getCodeBonLivraison() == null){
|
||||
ButtonCreationBonLivraison.setVisible(true);
|
||||
}else{
|
||||
ButtonCreationBonLivraison.setVisible(false);
|
||||
}
|
||||
|
||||
NetAPayer.setText(commandeClt.getNetAPayer());
|
||||
TableViewListeProduit.setItems(commandeClt.getListeproduit());
|
||||
AnchorPaneLoadingCommandeDetail.setVisible(false);
|
||||
AnchorPaneCommandeCltDetail.setVisible(true);
|
||||
}
|
||||
});
|
||||
ThreadCommandeCltDetail.start();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
package Controllers.CommandeClt;
|
||||
|
||||
import Models.Produit.ListeProduit;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Models.CommandeClt.CommandeClt;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class CommandeCltDialogConfirmationController implements Initializable {
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
public Node nodeFxml ;
|
||||
|
||||
Logger logger = Logger.getLogger(CommandeCltDialogConfirmationController.class.getName());
|
||||
|
||||
@FXML public AnchorPane AnchorPrincipal ;
|
||||
@FXML public Button Enregister ;
|
||||
@FXML private Text DateCreation;
|
||||
@FXML private Text Reglement;
|
||||
@FXML private Text NetAPayer;
|
||||
@FXML private Text TotalHorsTaxNet;
|
||||
@FXML private Text TotalTVA;
|
||||
@FXML private Text CodeDevis;
|
||||
|
||||
@FXML private Text TypeClt;
|
||||
@FXML private Text Nom;
|
||||
@FXML private Text Prenom;
|
||||
@FXML private Text Adresse;
|
||||
@FXML private Text TELE1;
|
||||
@FXML private Text TELE2;
|
||||
|
||||
@FXML private Text TextPrenom ;
|
||||
@FXML private Text TextMatricule ;
|
||||
@FXML private Text TextCodeDevis;
|
||||
|
||||
@FXML public TableView<ListeProduit> TableViewListeProduitPassCommClt ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColReference;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDesignation;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColQuantite ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColPrixHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColRemise;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTotalHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTVA;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTotalTTC;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColDesignation.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColRemise.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColRemise.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColRemise.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTotalTTC.getStyleClass().add("Center");
|
||||
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconsave.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
Enregister.setGraphic(buttonGraphic);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void GetCommandeClt(CommandeClt commandeclt){
|
||||
DateCreation.setText(Adaptateur.NormalDateFormat(commandeclt.getDate()));
|
||||
|
||||
|
||||
if(commandeclt.getTypeRegement().equals("0")){
|
||||
Reglement.setText("comptant");
|
||||
}else if(commandeclt.getTypeRegement().equals("1")){
|
||||
Reglement.setText("facilité");
|
||||
}
|
||||
NetAPayer.setText(commandeclt.getNetAPayer());
|
||||
TotalHorsTaxNet.setText(commandeclt.getTotalHorsTaxNet());
|
||||
TotalTVA.setText(commandeclt.getTotalTVA());
|
||||
|
||||
if(commandeclt.getCodeDevis()!=null){
|
||||
CodeDevis.setVisible(true);
|
||||
TextCodeDevis.setVisible(true);
|
||||
CodeDevis.setText(commandeclt.getCodeDevis());
|
||||
}
|
||||
|
||||
|
||||
TypeClt.setText(commandeclt.getTypeClientString());
|
||||
|
||||
if(commandeclt.getTypeClient()==0){
|
||||
TextPrenom.setVisible(true);
|
||||
TextMatricule.setVisible(false);
|
||||
Nom.setText(commandeclt.CltPersonne.getNom());
|
||||
Prenom.setText(commandeclt.CltPersonne.getPrenom());
|
||||
Adresse.setText(commandeclt.CltPersonne.getAdresse());
|
||||
TELE1.setText(commandeclt.CltPersonne.getTelefixString());
|
||||
TELE2.setText(commandeclt.CltPersonne.getTelemobileString());
|
||||
}
|
||||
|
||||
if(commandeclt.getTypeClient()==1){
|
||||
TextPrenom.setVisible(false);
|
||||
TextMatricule.setVisible(true);
|
||||
Nom.setText(commandeclt.CltEntreprise.getNom());
|
||||
Prenom.setText(commandeclt.CltEntreprise.getMatricule());
|
||||
Adresse.setText(commandeclt.CltEntreprise.getAdresse());
|
||||
TELE1.setText(commandeclt.CltEntreprise.getTele1String());
|
||||
TELE2.setText(commandeclt.CltEntreprise.getTele2String());
|
||||
}
|
||||
|
||||
if(commandeclt.getTypeClient()==2){
|
||||
TextPrenom.setVisible(true);
|
||||
TextMatricule.setVisible(false);
|
||||
Nom.setText(commandeclt.CltPassager.getNom());
|
||||
Prenom.setText(commandeclt.CltPassager.getPrenom());
|
||||
Adresse.setText(commandeclt.CltPassager.getAdresse());
|
||||
TELE1.setText(commandeclt.CltPassager.getTelefixString());
|
||||
TELE2.setText(commandeclt.CltPassager.getTelemobileString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
TableViewListeProduitPassCommClt.setItems(commandeclt.getListeproduit());
|
||||
}
|
||||
|
||||
|
||||
public CommandeCltDialogConfirmationController(){
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/CommandeClt/CommandeCltDialogConfirmation.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
nodeFxml = (Node) fxmlLoader.load();
|
||||
} catch (IOException ex) {
|
||||
logger.error("CommandeCltDialogConfirmationController : CommandeCltDialogConfirmation.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(nodeFxml);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void ExitButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPrincipal.setVisible(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,466 @@
|
||||
package Controllers.CommandeClt;
|
||||
|
||||
import Controllers.DevisClt.DevisCltGestionController;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Models.CommandeClt.CommandeCltDB;
|
||||
import Models.CommandeClt.CommandeCltListe;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class CommandeCltGestionController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(CommandeCltGestionController.class.getName());
|
||||
|
||||
@FXML private AnchorPane PaneGestion ;
|
||||
|
||||
@FXML private ProgressBar ProgressBarCommande;
|
||||
|
||||
@FXML private Button ButtonSearchCommande ;
|
||||
|
||||
@FXML private AnchorPane ListerPages;
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount ;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount =0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
|
||||
private Service<Void> ThreadSearchCommande;
|
||||
|
||||
@FXML public TableView<CommandeCltListe> TableViewGestionCommande;
|
||||
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColCodeCommande;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColModePaiement;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColTypeClient;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColCodeClient;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColTotalCommande;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColDateCreation ;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColCodeDevis;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColFacture;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColBonLivraison;
|
||||
@FXML public TableColumn<CommandeCltListe ,Boolean>TabColAction ;
|
||||
|
||||
@FXML public TextField TextFieldCodeCommande;
|
||||
@FXML public TextField TextFieldCodeClient;
|
||||
@FXML public TextField TextFieldNameClient;
|
||||
@FXML public TextField TextFieldCodeDevis;
|
||||
@FXML public DatePicker DatePickerCreation;
|
||||
@FXML public RadioButton RadioComptant;
|
||||
@FXML public RadioButton RadioFacilite;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
//comboboxnombre des lignes tableview
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
TableViewGestionCommande.setEditable(true);
|
||||
|
||||
TabColCodeCommande.setStyle( "-fx-alignment: CENTER;");TabColCodeCommande.getStyleClass().add("Center");
|
||||
TabColCodeCommande.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("CodeCommande"));
|
||||
|
||||
TabColTypeClient.setStyle( "-fx-alignment: CENTER;");TabColTypeClient.getStyleClass().add("Center");
|
||||
TabColTypeClient.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("TypeClient"));
|
||||
|
||||
TabColCodeClient.setStyle( "-fx-alignment: CENTER;");TabColCodeClient.getStyleClass().add("Center");
|
||||
TabColCodeClient.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("CodeClient"));
|
||||
|
||||
TabColModePaiement.setStyle( "-fx-alignment: CENTER;");TabColModePaiement.getStyleClass().add("Center");
|
||||
TabColModePaiement.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("ModePaiement"));
|
||||
|
||||
TabColTotalCommande.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalCommande.getStyleClass().add("Center");
|
||||
TabColTotalCommande.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("TotalCommande"));
|
||||
TabColTotalCommande.setCellFactory(new Callback<TableColumn<CommandeCltListe,String>,TableCell<CommandeCltListe,String>>(){
|
||||
@Override
|
||||
public TableCell<CommandeCltListe, String> call(TableColumn<CommandeCltListe, String> param) {
|
||||
TableCell<CommandeCltListe, String> cell = new TableCell<CommandeCltListe, String>(){
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
if(item!= null){
|
||||
Text text = new Text(Adaptateur.StringToStringEspace(item));
|
||||
setGraphic(text);
|
||||
}else{
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
TabColDateCreation.setStyle( "-fx-alignment: CENTER;");TabColDateCreation.getStyleClass().add("Center");
|
||||
TabColDateCreation.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("DateCreation"));
|
||||
|
||||
TabColCodeDevis.setStyle( "-fx-alignment: CENTER;");TabColCodeDevis.getStyleClass().add("Center");
|
||||
TabColCodeDevis.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("CodeDevis"));
|
||||
|
||||
TabColFacture.setStyle( "-fx-alignment: CENTER;");TabColFacture.getStyleClass().add("Center");
|
||||
TabColFacture.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("CodeFacture"));
|
||||
|
||||
TabColBonLivraison.setStyle( "-fx-alignment: CENTER;");TabColBonLivraison.getStyleClass().add("Center");
|
||||
TabColBonLivraison.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("CodeBonLivraison"));
|
||||
|
||||
|
||||
TabColAction.setSortable(true);
|
||||
TabColAction.setStyle( "-fx-alignment: CENTER;");TabColAction.getStyleClass().add("Center");
|
||||
TabColAction.setCellFactory(new Callback<TableColumn<CommandeCltListe, Boolean>, TableCell<CommandeCltListe, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<CommandeCltListe, Boolean> call(TableColumn<CommandeCltListe, Boolean> personBooleanTableColumn) {
|
||||
return new ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ButtonSearchCommande.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchCommande();
|
||||
}
|
||||
});
|
||||
|
||||
PaneGestion.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchCommande();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
RadioComptant.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchCommande();
|
||||
}
|
||||
});
|
||||
|
||||
RadioFacilite.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchCommande();
|
||||
}
|
||||
});
|
||||
|
||||
SearchCommande();
|
||||
|
||||
GestionSearchCommande();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void PasserCommandeCltButtonAction(ActionEvent event) throws IOException {
|
||||
|
||||
//inisialiser les données de Sauvgarde des opération
|
||||
CommandeCltPasserController.TypeClient = 2 ;
|
||||
CommandeCltPasserController.codeclient = null ;
|
||||
CommandeCltPasserController.codecliententre = null ;
|
||||
CommandeCltPasserController.Mode = null ;
|
||||
CommandeCltPasserController.CodeDevis = null;
|
||||
CommandeCltPasserController.data.clear();
|
||||
|
||||
PaneGestion.getChildren().clear();
|
||||
PaneGestion.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/CommandeClt/CommandeCltPasser.fxml")));
|
||||
}
|
||||
|
||||
|
||||
//Define the button cell
|
||||
private class ButtonCell extends TableCell<CommandeCltListe, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconedit.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){ //Action when the button is pressed
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
// get Selected Item
|
||||
CommandeCltListe current = (CommandeCltListe) ButtonCell.this.getTableView().getItems().get(ButtonCell.this.getIndex());
|
||||
String codeCommande = current.getCodeCommande();
|
||||
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/CommandeClt/CommandeCltDetail.fxml"));
|
||||
Parent NodeDetail = (Parent)fxmlLoader.load();
|
||||
CommandeCltDetail CommandeCltdetail = fxmlLoader.getController();
|
||||
CommandeCltdetail.AnchorPaneSucces.setVisible(false);
|
||||
CommandeCltdetail.AnchorPaneInfoCommandeClt.setPrefHeight(574);
|
||||
AnchorPane.setTopAnchor(CommandeCltdetail.AnchorPaneInfoCommandeClt, 5.0);
|
||||
|
||||
CommandeCltdetail.SowDetailCommandeClt(codeCommande);
|
||||
PaneGestion.getChildren().add(NodeDetail);
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.error("CommandeCltGestionController : CommandeCltDetail.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView client Entreprise *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchCommande()
|
||||
{
|
||||
ProgressBarCommande.setVisible(true);
|
||||
|
||||
ButtonSearchCommande.setDisable(true);
|
||||
|
||||
ThreadSearchCommande = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DateCreation = "";
|
||||
if(DatePickerCreation.getValue() != null){
|
||||
DateCreation = DatePickerCreation.getValue().toString();
|
||||
}
|
||||
|
||||
// 0comptant 1facilité
|
||||
String TypeRegement = "";
|
||||
if(RadioComptant.isSelected()){
|
||||
TypeRegement = "0";
|
||||
}else if(RadioFacilite.isSelected()){
|
||||
TypeRegement = "1";
|
||||
}
|
||||
|
||||
ObservableList<CommandeCltListe> ListCommandes = new CommandeCltDB().SearchCommande(
|
||||
position,
|
||||
nbrligne,
|
||||
TypeRegement,
|
||||
TextFieldCodeCommande.getText(),
|
||||
TextFieldCodeClient.getText(),
|
||||
TextFieldNameClient.getText(),
|
||||
TextFieldCodeDevis.getText(),
|
||||
DateCreation);
|
||||
TableViewGestionCommande.setItems(ListCommandes);
|
||||
|
||||
totalcount = new CommandeCltDB().nbrSearchCommande(TypeRegement, TextFieldCodeCommande.getText(), TextFieldCodeClient.getText(), TextFieldNameClient.getText(), TextFieldCodeDevis.getText(), DateCreation);
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchCommande.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarCommande.setVisible(false);
|
||||
ButtonSearchCommande.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchCommande.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchCommande(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarCommande.setVisible(true);
|
||||
|
||||
ButtonSearchCommande.setDisable(true);
|
||||
|
||||
ThreadSearchCommande = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateCreation = "";
|
||||
if(DatePickerCreation.getValue() != null){
|
||||
DateCreation = DatePickerCreation.getValue().toString();
|
||||
}
|
||||
|
||||
// 0comptant 1facilité
|
||||
String TypeRegement = "";
|
||||
if(RadioComptant.isSelected()){
|
||||
TypeRegement = "0";
|
||||
}else if(RadioFacilite.isSelected()){
|
||||
TypeRegement = "1";
|
||||
}
|
||||
|
||||
ObservableList<CommandeCltListe> ListCommandes = new CommandeCltDB().SearchCommande(ParmPosition, ParamNbrligne, TypeRegement, TextFieldCodeCommande.getText(), TextFieldCodeClient.getText(), TextFieldNameClient.getText(), TextFieldCodeDevis.getText(), DateCreation);
|
||||
|
||||
TableViewGestionCommande.setItems(ListCommandes);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchCommande.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarCommande.setVisible(false);
|
||||
ButtonSearchCommande.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchCommande.start();
|
||||
}
|
||||
|
||||
private void GestionSearchCommande()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchCommande(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchCommande(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchCommande(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchCommande(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchCommande(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,998 @@
|
||||
package Controllers.CommandeClt;
|
||||
|
||||
import Controllers.Client.ListeClient;
|
||||
import Controllers.Client.ListeClientEntreprise;
|
||||
import Controllers.Client.RechercherClientEntrepriseController;
|
||||
import Controllers.Client.RechercherClientPersonneController;
|
||||
import Controllers.DevisClt.DevisImporterController;
|
||||
import Controllers.Dialog.MessageControle;
|
||||
import Models.Produit.ListeProduit;
|
||||
import Controllers.Produit.RechercherProduitController;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.Client.Client;
|
||||
import Models.Client.ClientDB;
|
||||
import Models.Client.ClientEntreprise;
|
||||
import Models.Client.ClientEntrepriseDB;
|
||||
import Models.Client.ClientPassager;
|
||||
import Models.CommandeClt.CommandeClt;
|
||||
import Models.CommandeClt.CommandeCltDB;
|
||||
import Models.DevisClt.Devis;
|
||||
import Models.DevisClt.DevisCltListe;
|
||||
import Models.DevisClt.DevisDB;
|
||||
import Models.Produit.Produit;
|
||||
import Models.Produit.ProduitDB;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.ToggleGroup;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class CommandeCltPasserController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(CommandeCltPasserController.class.getName());
|
||||
|
||||
@FXML private AnchorPane PaneAjouter ;
|
||||
|
||||
@FXML public Text TotalTVA ;
|
||||
@FXML public Text Remise ;
|
||||
@FXML public Text NetAPayer ;
|
||||
@FXML public Text Timbre ;
|
||||
@FXML public Text TotalHTNet ;
|
||||
|
||||
@FXML public Button Enregister ;
|
||||
@FXML public Button ClientExisteDejat ;
|
||||
@FXML public Button ClientDefault ;
|
||||
@FXML public Button RechercheProduit ;
|
||||
|
||||
@FXML public TextField Nom ;
|
||||
@FXML public TextField Prenom ;
|
||||
@FXML public TextField Adresse ;
|
||||
@FXML public TextField TELE1 ;
|
||||
@FXML public TextField TELE2 ;
|
||||
|
||||
@FXML public Text TextMatricule ;
|
||||
@FXML public Text TextPrenom;
|
||||
@FXML public Text TextSexe;
|
||||
@FXML public Text TextDateNaisssance;
|
||||
|
||||
@FXML public Text TextCltExistCode;
|
||||
@FXML public Text CltExistCode;
|
||||
@FXML public Text CltExistNom;
|
||||
@FXML public Text CltExistPrenom;
|
||||
@FXML public Text CltExistDateNaissance;
|
||||
@FXML public Text CltExistAdresse;
|
||||
@FXML public Text CltExistTELE1;
|
||||
@FXML public Text CltExistTELE2;
|
||||
|
||||
@FXML public DatePicker DateNaisssance ;
|
||||
|
||||
@FXML public ComboBox ModeReglement ;
|
||||
|
||||
@FXML public TableView<ListeProduit> TableViewListeProduit ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColReference;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDesignaton;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColQuantite ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColPrixHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColRemise;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTotalHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTVA;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTotalTTC;
|
||||
@FXML public TableColumn<ListeProduit ,Boolean> TabColAddAction ;
|
||||
|
||||
@FXML private ToggleGroup ToggleGroupSexe;
|
||||
@FXML private RadioButton SexeHomme;
|
||||
@FXML private RadioButton SexeFemme;
|
||||
|
||||
public static Integer TypeClient ; // 0Personne 1Entreprise 2Passeger
|
||||
public static String codeclient ;
|
||||
public static String codecliententre;
|
||||
public static String Mode; // Comptant Facilité
|
||||
public static String CodeDevis;
|
||||
|
||||
public static ObservableList<ListeProduit> data=FXCollections.observableArrayList();
|
||||
|
||||
|
||||
CommandeClt commandeclt = new CommandeClt();
|
||||
Produit produit= new Produit();
|
||||
ProduitDB produitDB= new ProduitDB();
|
||||
|
||||
public void SauvgardeTraitement(){
|
||||
if(TypeClient != null){
|
||||
|
||||
if(TypeClient == 0){
|
||||
this.SetClient(codeclient);
|
||||
}
|
||||
if(TypeClient == 1){
|
||||
this.SetClientEntre(codecliententre);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
this.SauvgardeTraitement();
|
||||
|
||||
TableViewListeProduit.setEditable(true);
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColDesignaton.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColRemise.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColRemise.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColRemise.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTotalTTC.getStyleClass().add("Center");
|
||||
|
||||
TabColReference.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColQuantite.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColRemise.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
|
||||
ModeReglement.setValue(Mode);
|
||||
|
||||
this.ReferenceMouseClick();
|
||||
this.QantiteMouseClick();
|
||||
this.RemiseMouseClick();
|
||||
|
||||
|
||||
TabColAddAction.setSortable(true);
|
||||
TabColAddAction.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<ListeProduit, Boolean>,
|
||||
ObservableValue<Boolean>>() {
|
||||
@Override
|
||||
public ObservableValue<Boolean> call(TableColumn.CellDataFeatures<ListeProduit, Boolean> p) {
|
||||
return new SimpleBooleanProperty(p.getValue() != null);
|
||||
}
|
||||
});
|
||||
|
||||
// create a cell value factory with an add button for each row in the table.
|
||||
TabColAddAction.setCellFactory(new Callback<TableColumn<ListeProduit, Boolean>, TableCell<ListeProduit, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<ListeProduit, Boolean> call(TableColumn<ListeProduit, Boolean> personBooleanTableColumn) {
|
||||
return new CommandeCltPasserController.ButtonCell();
|
||||
}
|
||||
});
|
||||
TabColAddAction.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColAddAction.getStyleClass().add("Center");
|
||||
|
||||
TableViewListeProduit.setItems(data);
|
||||
CalculeListeProduit();
|
||||
|
||||
//Ajouter une ligne vide clors ce que en click sur la tableview
|
||||
TableViewListeProduit.setOnMouseClicked(new EventHandler<javafx.scene.input.MouseEvent>(){
|
||||
public void handle(MouseEvent event){
|
||||
int nbrligne = TableViewListeProduit.getItems().size() ;
|
||||
if(nbrligne == 0){
|
||||
data.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduit.setItems(data);
|
||||
}
|
||||
else{
|
||||
ListeProduit Liste = TableViewListeProduit.getItems().get(nbrligne - 1);
|
||||
if(!Liste.getTotalTTC().isEmpty()){
|
||||
data.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduit.setItems(data);
|
||||
TableViewListeProduit.getSelectionModel().select(nbrligne);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void SaveButtonAction(ActionEvent event) throws IOException {
|
||||
final CommandeCltDialogConfirmationController CommandeCltDialogConfirmation = new CommandeCltDialogConfirmationController();
|
||||
if(ControleObject()){
|
||||
this.SetObject();
|
||||
CommandeCltDialogConfirmation.GetCommandeClt(commandeclt);
|
||||
CommandeCltDialogConfirmation.Enregister.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
CommandeCltDialogConfirmation.AnchorPrincipal.setVisible(false);
|
||||
CommandeCltDB commandecltDB = new CommandeCltDB();
|
||||
|
||||
commandeclt = commandecltDB.AddCommandeClt(commandeclt);
|
||||
|
||||
if(!commandeclt.getCodecommandeclt().isEmpty()){
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/CommandeClt/CommandeCltDetail.fxml"));
|
||||
Parent NodeDetail = (Parent)fxmlLoader.load();
|
||||
CommandeCltDetail commandecltDetail = fxmlLoader.getController();
|
||||
commandecltDetail.SowDetailCommandeClt(commandeclt.getCodecommandeclt());
|
||||
PaneAjouter.getChildren().add(NodeDetail);
|
||||
} catch (IOException ex) {
|
||||
logger.error("CommandeCltPasserController : CommandeCltDetail.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
CommandeCltDialogConfirmation.Show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Define the button cell
|
||||
private class ButtonCell extends TableCell<ListeProduit, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-danger");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/icondelete.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
//Action when the button is pressed
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
int selectdIndex = getTableRow().getIndex();
|
||||
data.remove(selectdIndex);
|
||||
CalculeListeProduit();
|
||||
TableViewListeProduit.setStyle(".table-row-cell:selected{ -fx-background-color:transparent ;}");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void AddLigneButtonAction(ActionEvent event) throws IOException {
|
||||
int nbrligne = TableViewListeProduit.getItems().size() ;
|
||||
if(nbrligne == 0){
|
||||
data.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduit.setItems(data);
|
||||
}
|
||||
else{
|
||||
ListeProduit Liste = TableViewListeProduit.getItems().get(nbrligne - 1);
|
||||
if(!Liste.getTotalTTC().isEmpty()){
|
||||
data.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduit.setItems(data);
|
||||
TableViewListeProduit.getSelectionModel().select(nbrligne);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean ControleObject(){
|
||||
boolean resulta = false ;
|
||||
if(data.size()<1){
|
||||
final MessageControle messagecontrol = new MessageControle();
|
||||
Text text3 = new Text();
|
||||
text3.setText("Vous devez ajouter au moin un produit à la liste des produits");
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 13));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
messagecontrol.ShowNotification();
|
||||
}
|
||||
else if(ModeReglement.getValue()==null){
|
||||
ModeReglement.setStyle("-fx-border-color:#f20606;");
|
||||
}
|
||||
else if(TypeClient == 2){ // 0Personne 1Entreprise 2Passeger
|
||||
ModeReglement.setStyle("-fx-border-color:transparent;");
|
||||
contro clt =new contro();
|
||||
if(Nom.getText().isEmpty()){
|
||||
Nom.setStyle("-fx-border-color:#f20606;");
|
||||
}
|
||||
else if(Prenom.getText().isEmpty()){
|
||||
Nom.setStyle("-fx-border-color:transparent;");
|
||||
Prenom.setStyle("-fx-border-color:#f20606;");
|
||||
|
||||
}
|
||||
else if(Adresse.getText().isEmpty()){
|
||||
Prenom.setStyle("-fx-border-color:transparent;");
|
||||
Adresse.setStyle("-fx-border-color:#f20606;");
|
||||
|
||||
}
|
||||
else if(clt.isNumericNotnull(TELE1.getText())){
|
||||
Adresse.setStyle("-fx-border-color:transparent;");
|
||||
TELE1.setStyle("-fx-border-color:#f20606;");
|
||||
}
|
||||
else if(clt.isNumeric(TELE2.getText())){
|
||||
TELE1.setStyle("-fx-border-color:transparent;");
|
||||
TELE2.setStyle("-fx-border-color:#f20606;");
|
||||
}
|
||||
else{
|
||||
TELE2.setStyle("-fx-border-color:transparent;");
|
||||
ModeReglement.setStyle("-fx-border-color:#b5b5b5;");
|
||||
resulta = true ;
|
||||
}
|
||||
}
|
||||
else{
|
||||
ModeReglement.setStyle("-fx-border-color:#b5b5b5;");
|
||||
resulta = true ;
|
||||
}
|
||||
|
||||
return resulta ;
|
||||
}
|
||||
private void SetObject(){
|
||||
commandeclt.setTypeClient(TypeClient);
|
||||
commandeclt.setTypeRegementString(ModeReglement.getValue().toString());
|
||||
commandeclt.setCodeDevis(CodeDevis);
|
||||
commandeclt.setNetAPayer(NetAPayer.getText());
|
||||
commandeclt.setTotalTVA(TotalTVA.getText());
|
||||
commandeclt.setTotalHorsTaxNet(TotalHTNet.getText());
|
||||
commandeclt.setRemise(Remise.getText());
|
||||
|
||||
if(TypeClient == 0){
|
||||
Client CltPersonne = new Client();
|
||||
CltPersonne.setCodeclient(CltExistCode.getText());
|
||||
CltPersonne.setNom(CltExistNom.getText());
|
||||
CltPersonne.setPrenom(TextPrenom.getText());
|
||||
CltPersonne.setAdresse(CltExistAdresse.getText());
|
||||
CltPersonne.setTelefixString(CltExistTELE1.getText());
|
||||
CltPersonne.setTelemobileString(CltExistTELE2.getText());
|
||||
commandeclt.setCltPersonne(CltPersonne);
|
||||
}else if(TypeClient == 1){
|
||||
//TextCltExistCode CltExistCode CltExistNom CltExistPrenom
|
||||
ClientEntreprise CltEntreprise = new ClientEntreprise();
|
||||
CltEntreprise.setCodeString(CltExistCode.getText());
|
||||
CltEntreprise.setNom(CltExistNom.getText());
|
||||
CltEntreprise.setMatricule(CltExistPrenom.getText());
|
||||
CltEntreprise.setAdresse(CltExistAdresse.getText());
|
||||
CltEntreprise.setTele1String(CltExistTELE1.getText());
|
||||
CltEntreprise.setTele2String(CltExistTELE2.getText());
|
||||
commandeclt.setCltEntreprise(CltEntreprise);
|
||||
}else if(TypeClient == 2){
|
||||
ClientPassager CltPassager = new ClientPassager();
|
||||
CltPassager.setNom(Nom.getText());
|
||||
CltPassager.setPrenom(Prenom.getText());
|
||||
CltPassager.setAdresse(Adresse.getText());
|
||||
CltPassager.setTelefixString(TELE1.getText());
|
||||
CltPassager.setTelemobileString(TELE2.getText());
|
||||
CltPassager.setNaissance(Adaptateur.DatabaseDateLocalDate(DateNaisssance.getValue()));
|
||||
RadioButton SelectedRadioSexe = (RadioButton) ToggleGroupSexe.getSelectedToggle();
|
||||
CltPassager.setSexeString(SelectedRadioSexe.getEllipsisString());
|
||||
|
||||
commandeclt.setCltPassager(CltPassager);
|
||||
}
|
||||
|
||||
//controle le cas ou on a une ligne vide a la fin de la liste
|
||||
if(data.get(data.size()-1).getTotalTTC().isEmpty()){
|
||||
data.remove(data.size()-1);
|
||||
}
|
||||
commandeclt.setListeproduit(data);
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void DevisCltImportButtonAction(ActionEvent event) throws IOException {
|
||||
DevisImporterController DevisImporter = new DevisImporterController();
|
||||
DevisImporter.Show();
|
||||
|
||||
DevisImporter.TabColDetail.setCellFactory(new Callback<TableColumn<DevisCltListe,Boolean>,TableCell<DevisCltListe,Boolean>>(){
|
||||
@Override
|
||||
public TableCell<DevisCltListe, Boolean> call(TableColumn<DevisCltListe, Boolean> param) {
|
||||
TableCell<DevisCltListe, Boolean> cell = new TableCell<DevisCltListe, Boolean>(){
|
||||
@Override
|
||||
public void updateItem(Boolean item, boolean empty) {
|
||||
Button cellButton = new Button();
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconaffecter.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){ //Action when the button is pressed
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
try {
|
||||
DevisCltListe current = ((DevisCltListe)getTableRow().getItem());
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/CommandeClt/CommandeCltPasser.fxml"));
|
||||
Parent ParentCommandeClt = (Parent) fxmlLoader.load();
|
||||
|
||||
CommandeCltPasserController CommandeCltPasser = fxmlLoader.getController();
|
||||
|
||||
Devis devis = new DevisDB().getDevis(current.getCodeDevis());
|
||||
|
||||
CommandeCltPasserController.data.addAll(devis.getListeproduit());
|
||||
CommandeCltPasserController.TypeClient = devis.getTypeClient();
|
||||
CommandeCltPasserController.CodeDevis = devis.getCodeDevis();
|
||||
CommandeCltPasser.ModeReglement.setValue(devis.getTypeRegementString());
|
||||
if(devis.getTypeClient() == 0 ){
|
||||
CommandeCltPasserController.codeclient = devis.getCodeClient();
|
||||
System.out.println("codeclt"+devis.getCodeClient());
|
||||
CommandeCltPasser.SetClient(devis.getCodeClient());
|
||||
}else if(devis.getTypeClient() == 1){
|
||||
CommandeCltPasserController.codecliententre = devis.getCodeClient();
|
||||
CommandeCltPasser.SetClientEntre(devis.getCodeClient());
|
||||
}else if(devis.getTypeClient() == 2){
|
||||
ClientPassager passager = devis.getPassager();
|
||||
CommandeCltPasser.Nom.setText(passager.getNom());
|
||||
CommandeCltPasser.Prenom.setText(passager.getPrenom());
|
||||
CommandeCltPasser.Adresse.setText(passager.getAdresse());
|
||||
CommandeCltPasser.TELE1.setText(passager.getTelefixString());
|
||||
CommandeCltPasser.TELE2.setText(passager.getTelemobileString());
|
||||
}
|
||||
|
||||
CommandeCltPasser.TotalTVA.setText(devis.getTotalTVA());
|
||||
CommandeCltPasser.Remise.setText(devis.getRemise());
|
||||
CommandeCltPasser.NetAPayer.setText(devis.getNetAPayer());
|
||||
CommandeCltPasser.Timbre.setText(devis.getTimbre());
|
||||
CommandeCltPasser.TotalHTNet.setText(devis.getTotalHorsTaxNet());
|
||||
|
||||
//Refrechir le Panel
|
||||
MyWindow mywindows = new MyWindow();
|
||||
mywindows.Refresh(ParentCommandeClt, 3);
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.error("CommandeCltPasserController : CommandeCltPasser.fxml "+ ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
//Methode qui pérmet de traite les recherche du client Personne
|
||||
@FXML
|
||||
private void ClientExisteDejatButtonAction(ActionEvent event) throws IOException {
|
||||
|
||||
final RechercherClientPersonneController RechercheClient = new RechercherClientPersonneController();
|
||||
|
||||
RechercheClient.Action.setCellFactory(new Callback<TableColumn<ListeClient, String>, TableCell<ListeClient, String>>() {
|
||||
@Override
|
||||
public TableCell<ListeClient, String> call(TableColumn<ListeClient, String> paramP) {
|
||||
return new TableCell<ListeClient, String>() {
|
||||
final Button cellButton = new Button("");
|
||||
{
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconaffecter.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent arg0) {
|
||||
try {
|
||||
// get Selected Item
|
||||
ListeClient ClientPerson = ((ListeClient)getTableRow().getItem());
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/CommandeClt/CommandeCltPasser.fxml"));
|
||||
Parent commandeclt = (Parent) fxmlLoader.load();
|
||||
|
||||
CommandeCltPasserController CommandeCltPasser = fxmlLoader.getController();
|
||||
CommandeCltPasser.SetClient(ClientPerson.getCode());
|
||||
|
||||
//Traitement de Sauvgarde
|
||||
CommandeCltPasserController.TypeClient = 0 ;
|
||||
CommandeCltPasserController.codeclient = ClientPerson.getCode();
|
||||
|
||||
//Refrechir le Panel
|
||||
MyWindow mywindows = new MyWindow();
|
||||
mywindows.Refresh(commandeclt, 3);
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.error("CommandeCltPasserController : ClientExisteDejatButtonAction : CommandeCltPasser.fxml " + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected void updateItem(String paramT, boolean isEmpty) {
|
||||
super.updateItem(paramT, isEmpty);
|
||||
if (!isEmpty) {
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
//afficher la fenaitre
|
||||
RechercheClient.ShowDialg();
|
||||
|
||||
final RechercherClientEntrepriseController RechercheClientEntre = new RechercherClientEntrepriseController();
|
||||
|
||||
RechercheClient.cltEntreprise.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
RechercheClient.AnchoreClientPerson.setVisible(false);
|
||||
RechercheClientEntre.AnchoreClientEntre.setVisible(true);
|
||||
RechercheClientEntre.Show();
|
||||
}
|
||||
});
|
||||
|
||||
//Action when the button is pressed
|
||||
|
||||
|
||||
RechercheClientEntre.cltPer.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
RechercheClientEntre.AnchoreClientEntre.setVisible(false);
|
||||
RechercheClient.AnchoreClientPerson.setVisible(true);
|
||||
RechercheClient.ShowDialg();
|
||||
}
|
||||
});
|
||||
|
||||
RechercheClientEntre.TableColumnActionEtre.setCellFactory(new Callback<TableColumn<ListeClientEntreprise, String>, TableCell<ListeClientEntreprise, String>>() {
|
||||
@Override
|
||||
public TableCell<ListeClientEntreprise, String> call(TableColumn<ListeClientEntreprise, String> paramP) {
|
||||
return new TableCell<ListeClientEntreprise, String>() {
|
||||
final Button cellButton = new Button("");
|
||||
{
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconaffecter.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent arg0) {
|
||||
try {
|
||||
// get Selected Item
|
||||
ListeClientEntreprise currentPerson = ((ListeClientEntreprise)getTableRow().getItem());
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/CommandeClt/CommandeCltPasser.fxml"));
|
||||
Parent commandeclt = (Parent) fxmlLoader.load();
|
||||
|
||||
//Traitement de Sauvgarde
|
||||
CommandeCltPasserController.TypeClient = 1 ;
|
||||
CommandeCltPasserController.codecliententre = currentPerson.getCode();
|
||||
|
||||
CommandeCltPasserController CommandeCltPasser = fxmlLoader.getController();
|
||||
CommandeCltPasser.SetClientEntre(currentPerson.getCode());
|
||||
|
||||
//Refrechir le Panel
|
||||
MyWindow mywindows = new MyWindow();
|
||||
mywindows.Refresh(commandeclt, 3);
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.error("CommandeCltPasserController : CommandeCltPasser.fxml :" + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateItem(String paramT, boolean isEmpty) {
|
||||
super.updateItem(paramT, isEmpty);
|
||||
if (!isEmpty) {
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void QantiteMouseClick(){
|
||||
TabColQuantite.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ListeProduit, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ListeProduit, String> t) {
|
||||
String newquantite = t.getNewValue() ;
|
||||
try{
|
||||
newquantite = newquantite.replace(',','.');
|
||||
if(Float.parseFloat(newquantite)<1){
|
||||
newquantite = "1";
|
||||
}
|
||||
}
|
||||
catch(NumberFormatException nfe){
|
||||
newquantite = "1";
|
||||
}
|
||||
|
||||
|
||||
ListeProduit Liste = t.getRowValue() ;
|
||||
|
||||
|
||||
if(Liste.getReference().isEmpty()){ //le cas en ajoute un quantité dans un ligne vide
|
||||
TableViewListeProduit.getColumns().get(t.getTablePosition().getRow()).setVisible(false);
|
||||
TableViewListeProduit.getColumns().get(t.getTablePosition().getRow()).setVisible(true);
|
||||
}
|
||||
else{
|
||||
Liste.setQuantite(newquantite);
|
||||
ListeProduit NewList = new ListeProduit(Liste.getReference(),Liste.getDesignation(), newquantite,Liste.getPrixHT(), Liste.getRemise(),"",Liste.getTVA(),"");
|
||||
//NewList = CalculeProduit(NewList);
|
||||
AffectationTableView(NewList,t.getTablePosition().getRow()) ;
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void RemiseMouseClick(){
|
||||
TabColRemise.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ListeProduit, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ListeProduit, String> t) {
|
||||
String newRemise = t.getNewValue() ;
|
||||
try{
|
||||
newRemise = newRemise.replace(',','.');
|
||||
if(Float.parseFloat(newRemise)<0){
|
||||
newRemise = "0";
|
||||
}
|
||||
}
|
||||
catch(NumberFormatException nfe){
|
||||
newRemise = "0";
|
||||
}
|
||||
|
||||
ListeProduit Liste = t.getRowValue() ;
|
||||
|
||||
if(Liste.getReference().isEmpty()){ //le cas en ajoute un remise dans un ligne vide
|
||||
TableViewListeProduit.getColumns().get(t.getTablePosition().getRow()).setVisible(false);
|
||||
TableViewListeProduit.getColumns().get(t.getTablePosition().getRow()).setVisible(true);
|
||||
}
|
||||
else{
|
||||
Liste.setRemise(newRemise);
|
||||
ListeProduit NewList = new ListeProduit(Liste.getReference(),Liste.getDesignation(), Liste.getQuantite(),Liste.getPrixHT(), newRemise, "", Liste.getTVA(), "");
|
||||
AffectationTableView(NewList, t.getTablePosition().getRow());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ReferenceMouseClick(){
|
||||
TabColReference.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ListeProduit, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ListeProduit, String> t) {
|
||||
produit = produitDB.getProduit(t.getNewValue());
|
||||
if(produit.getReference() != null){
|
||||
ListeProduit Liste = new ListeProduit(produit.getReference(),produit.getDesignation(),"1",produit.getPrixventeht(),"0","",produit.getTvavente(),"0");
|
||||
AffectationTableView(Liste,t.getTablePosition().getRow()) ;
|
||||
}
|
||||
else{
|
||||
AffectationTableView(new ListeProduit("","","","","","","",""),t.getTablePosition().getRow()) ;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void RechercheProduitButtonAction(ActionEvent event) throws IOException {
|
||||
final RechercherProduitController rechercheproduit = new RechercherProduitController(true);
|
||||
|
||||
rechercheproduit.Show();
|
||||
|
||||
rechercheproduit.TabColAction.setCellFactory(new Callback<TableColumn<Produit, String>, TableCell<Produit, String>>() {
|
||||
@Override
|
||||
public TableCell<Produit, String> call(TableColumn<Produit, String> paramP) {
|
||||
return new TableCell<Produit, String>() {
|
||||
final Button cellButton = new Button("");
|
||||
{
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconaffecter.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent arg0) {
|
||||
try {
|
||||
// get Selected ItemButtonCell
|
||||
Produit currentPerson = ((Produit)getTableRow().getItem());
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/CommandeClt/CommandeCltPasser.fxml"));
|
||||
Parent commandeclt = (Parent) fxmlLoader.load();
|
||||
|
||||
CommandeCltPasserController CommandeCltPasser = fxmlLoader.getController();
|
||||
CommandeCltPasser.SetProduit(currentPerson.getReference());
|
||||
|
||||
MyWindow mywindows = new MyWindow();
|
||||
mywindows.Refresh(commandeclt, 3);
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.error("CommandeCltPasserController : RechercheProduitButtonAction ; CommandeCltPasser.fxml :" + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected void updateItem(String paramT, boolean isEmpty) {
|
||||
super.updateItem(paramT, isEmpty);
|
||||
if (!isEmpty) {
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void AffectationTableView(ListeProduit ListeProd, int EmplacementLigne){
|
||||
boolean result = false ;
|
||||
int indise=0;
|
||||
int Position = 0;
|
||||
|
||||
if(data.size()>0){
|
||||
do{ //Vérifier si le produit exsiste deja
|
||||
if(data.get(indise).getReference().equals(ListeProd.getReference())){
|
||||
result = true ;
|
||||
Position = indise ;
|
||||
//System.out.println("existe Position:"+indise);
|
||||
}
|
||||
indise++;
|
||||
}while(data.size()>indise && !result);
|
||||
|
||||
if(result){ //si la ligne exsite déja
|
||||
if(EmplacementLigne!= -1){
|
||||
if(Position == EmplacementLigne){
|
||||
data.set(Position, ListeProd);
|
||||
}
|
||||
else{
|
||||
data.set(EmplacementLigne, new ListeProduit("","","","","","","",""));
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(EmplacementLigne!= -1){
|
||||
data.set(EmplacementLigne, ListeProd);
|
||||
}
|
||||
else{
|
||||
data.add(ListeProd);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
data.add(ListeProd);
|
||||
}
|
||||
|
||||
CalculeListeProduit();
|
||||
|
||||
|
||||
TableViewListeProduit.setItems(data);
|
||||
TableViewListeProduit.setVisible(false);
|
||||
TableViewListeProduit.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void CalculeListeProduit(){ //calculer et afficher la détail des produits
|
||||
float netaPayer = 0;
|
||||
float Remises = 0;
|
||||
float totalTVA = 0;
|
||||
float total_H_T_Net= 0;
|
||||
TotalTVA.setText("");
|
||||
Remise.setText("");
|
||||
NetAPayer.setText("");
|
||||
Timbre.setText("");
|
||||
TotalHTNet.setText("");
|
||||
|
||||
//calcule
|
||||
for(ListeProduit liste : data){
|
||||
float totaht = Adaptateur.StringToFloat(liste.getTotalHT()) ;
|
||||
float prix_U_H_T = Adaptateur.StringToFloat(liste.getPrixHT()) ;
|
||||
float remises = Adaptateur.StringToFloat(liste.getRemise().replace("%", "")) ;
|
||||
float tva = Adaptateur.StringToFloat(liste.getTVA().replace("%", ""));
|
||||
float qte = Adaptateur.StringToFloat(liste.getQuantite());
|
||||
|
||||
totalTVA = totalTVA + ((totaht * tva) /100) ;
|
||||
|
||||
Remises = Remises + (prix_U_H_T * remises)/100 ;
|
||||
|
||||
total_H_T_Net = total_H_T_Net + totaht ;
|
||||
|
||||
}
|
||||
|
||||
if(total_H_T_Net>0){
|
||||
float timbre = Adaptateur.StringToFloat(ParametreSystem.Timbre);
|
||||
netaPayer = total_H_T_Net + totalTVA + timbre ;
|
||||
|
||||
TotalTVA.setText(Adaptateur.ArrondFloatToString(totalTVA));
|
||||
Remise.setText(Adaptateur.ArrondFloatToString(Remises));
|
||||
NetAPayer.setText(Adaptateur.ArrondFloatToString(netaPayer));
|
||||
Timbre.setText(ParametreSystem.Timbre);
|
||||
TotalHTNet.setText(Adaptateur.ArrondFloatToString(total_H_T_Net));
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void ClientRessetDefautButtonAction(ActionEvent event) throws IOException {
|
||||
CommandeCltPasserController.TypeClient = 2 ;
|
||||
ClientExisteDejat.setVisible(true);
|
||||
Nom.setVisible(true);
|
||||
Prenom.setVisible(true);
|
||||
DateNaisssance.setVisible(true);
|
||||
Adresse.setVisible(true);
|
||||
TELE1.setVisible(true);
|
||||
TELE2.setVisible(true);
|
||||
TextSexe.setVisible(true);
|
||||
SexeHomme.setVisible(true);
|
||||
SexeFemme.setVisible(true);
|
||||
TextDateNaisssance.setVisible(true);
|
||||
|
||||
TextCltExistCode.setVisible(false);
|
||||
ClientDefault.setVisible(false);
|
||||
CltExistCode.setVisible(false);
|
||||
CltExistNom.setVisible(false);
|
||||
CltExistPrenom.setVisible(false);
|
||||
CltExistAdresse.setVisible(false);
|
||||
CltExistTELE1.setVisible(false);
|
||||
CltExistTELE2.setVisible(false);
|
||||
CltExistDateNaissance.setVisible(false);
|
||||
}
|
||||
|
||||
public void SetClient(String codeclt)
|
||||
{
|
||||
Client client = new Client();
|
||||
ClientDB clientdb = new ClientDB();
|
||||
CommandeCltPasserController.TypeClient = 0 ;
|
||||
client = clientdb.getClient(codeclt);
|
||||
|
||||
ClientExisteDejat.setVisible(false);
|
||||
Nom.setVisible(false);
|
||||
Prenom.setVisible(false);
|
||||
DateNaisssance.setVisible(false);
|
||||
Adresse.setVisible(false);
|
||||
TELE1.setVisible(false);
|
||||
TELE2.setVisible(false);
|
||||
TextSexe.setVisible(true);
|
||||
SexeHomme.setVisible(true);
|
||||
SexeFemme.setVisible(true);
|
||||
|
||||
CltExistCode.setText(client.getCodeclient());
|
||||
CltExistNom.setText(client.getNom());
|
||||
CltExistPrenom.setText(client.getPrenom());
|
||||
CltExistDateNaissance.setText(" "+client.getDateNaissanceString());
|
||||
CltExistAdresse.setText(client.getAdresse());
|
||||
CltExistTELE1.setText(client.getTelefixString());
|
||||
CltExistTELE2.setText(client.getTelemobileString());
|
||||
if(client.getSexe() == 1){
|
||||
SexeHomme.setSelected(true);
|
||||
}else if(client.getSexe() == 0){
|
||||
SexeFemme.setSelected(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
TextDateNaisssance.setVisible(true);
|
||||
TextCltExistCode.setVisible(true);
|
||||
ClientDefault.setVisible(true);
|
||||
CltExistCode.setVisible(true);
|
||||
CltExistNom.setVisible(true);
|
||||
CltExistPrenom.setVisible(true);
|
||||
CltExistDateNaissance.setVisible(true);
|
||||
CltExistAdresse.setVisible(true);
|
||||
CltExistTELE1.setVisible(true);
|
||||
CltExistTELE2.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void SetProduit(String Refprod){
|
||||
produit = produitDB.getProduit(Refprod);
|
||||
ListeProduit ListeProd = new ListeProduit(produit.getReference(),produit.getDesignation(),"1",produit.getPrixventeht(),"0",produit.getPrixventettc(),produit.getTvavente(),"0");
|
||||
//Supprimer les igne vide
|
||||
if((data.size()>0) && (data.get(data.size()-1).getReference().isEmpty())){
|
||||
data.remove(data.size()-1);
|
||||
}
|
||||
|
||||
AffectationTableView(ListeProd,-1);
|
||||
}
|
||||
public void SetClientEntre(String codecliententre)
|
||||
{
|
||||
ClientEntreprise ClientEtr = new ClientEntreprise();
|
||||
ClientEntrepriseDB ClientEtrDB = new ClientEntrepriseDB();
|
||||
ClientEtr = ClientEtrDB.GetClientEtr(codecliententre);
|
||||
CommandeCltPasserController.TypeClient = 1 ;
|
||||
|
||||
TextMatricule.setVisible(true);
|
||||
TextPrenom.setVisible(false);
|
||||
TextSexe.setVisible(false);
|
||||
SexeHomme.setVisible(false);
|
||||
SexeFemme.setVisible(false);
|
||||
DateNaisssance.setVisible(false);
|
||||
|
||||
ClientExisteDejat.setVisible(false);
|
||||
CltExistDateNaissance.setVisible(false);
|
||||
TextDateNaisssance.setVisible(false);
|
||||
Nom.setVisible(false);
|
||||
Prenom.setVisible(false);
|
||||
Adresse.setVisible(false);
|
||||
TELE1.setVisible(false);
|
||||
TELE2.setVisible(false);
|
||||
|
||||
CltExistCode.setText(ClientEtr.getCode().toString());
|
||||
CltExistNom.setText(ClientEtr.getNom());
|
||||
CltExistPrenom.setText(ClientEtr.getMatricule());
|
||||
CltExistAdresse.setText(ClientEtr.getAdresse());
|
||||
CltExistTELE1.setText(ClientEtr.getTele1().toString());
|
||||
CltExistTELE2.setText(ClientEtr.getTele2().toString());
|
||||
|
||||
TextCltExistCode.setVisible(true);
|
||||
ClientDefault.setVisible(true);
|
||||
CltExistCode.setVisible(true);
|
||||
CltExistNom.setVisible(true);
|
||||
CltExistPrenom.setVisible(true);
|
||||
CltExistAdresse.setVisible(true);
|
||||
CltExistTELE1.setVisible(true);
|
||||
CltExistTELE2.setVisible(true);
|
||||
}
|
||||
}
|
||||
910
src/main/java/Controllers/DevisClt/DevisAjouterController.java
Normal file
910
src/main/java/Controllers/DevisClt/DevisAjouterController.java
Normal file
@@ -0,0 +1,910 @@
|
||||
|
||||
package Controllers.DevisClt;
|
||||
|
||||
import Controllers.Client.ListeClient;
|
||||
import Controllers.Client.ListeClientEntreprise;
|
||||
import Controllers.Client.RechercherClientEntrepriseController;
|
||||
import Controllers.Client.RechercherClientPersonneController;
|
||||
import Controllers.Dialog.MessageControle;
|
||||
import Models.Produit.ListeProduit;
|
||||
import Controllers.Produit.RechercherProduitController;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.Client.Client;
|
||||
import Models.Client.ClientDB;
|
||||
import Models.Client.ClientEntreprise;
|
||||
import Models.Client.ClientEntrepriseDB;
|
||||
import Models.Client.ClientPassager;
|
||||
import Models.DevisClt.Devis;
|
||||
import Models.DevisClt.DevisDB;
|
||||
import Models.Produit.Produit;
|
||||
import Models.Produit.ProduitDB;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.ToggleGroup;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class DevisAjouterController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(DevisAjouterController.class.getName());
|
||||
|
||||
@FXML private AnchorPane PaneDevisAjouter ;
|
||||
|
||||
@FXML private Text DevisTotalTVA ;
|
||||
@FXML private Text DevisRemise ;
|
||||
@FXML private Text DevisNetAPayer ;
|
||||
@FXML private Text DevisTimbre ;
|
||||
@FXML private Text DevisTotalHTNet ;
|
||||
|
||||
@FXML private ToggleGroup ToggleGroupSexe;
|
||||
@FXML private RadioButton SexeHomme;
|
||||
@FXML private RadioButton SexeFemme;
|
||||
|
||||
@FXML public Button EnregisterDevis ;
|
||||
@FXML public Button ClientExisteDejat ;
|
||||
@FXML public Button ClientDefault ;
|
||||
@FXML public Button RechercheProduit ;
|
||||
|
||||
@FXML public TextField DevisNom ;
|
||||
@FXML public TextField DevisPrenom ;
|
||||
@FXML public TextField DevisAdresse ;
|
||||
@FXML public TextField DevisTELE1 ;
|
||||
@FXML public TextField DevisTELE2 ;
|
||||
|
||||
@FXML public Text TextMatricule ;
|
||||
@FXML public Text TextPrenom;
|
||||
|
||||
@FXML public Text TextCltExistCode;
|
||||
@FXML public Text CltExistCode;
|
||||
@FXML public Text CltExistNom;
|
||||
@FXML public Text CltExistPrenom;
|
||||
@FXML public Text CltExistAdresse;
|
||||
@FXML public Text CltExistTELE1;
|
||||
@FXML public Text CltExistTELE2;
|
||||
|
||||
@FXML public DatePicker DateCreation ;
|
||||
@FXML public DatePicker DateFinValidite ;
|
||||
|
||||
@FXML public ComboBox ModeReglement ;
|
||||
|
||||
@FXML public TableView<ListeProduit> TableViewListeProduitDevis ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisReference;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisDesignaton;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisQuantite ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisPrixHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisRemise;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisTotalHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisTVA;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisTotalTTC;
|
||||
@FXML public TableColumn<ListeProduit ,Boolean> TabColDevisAddAction ;
|
||||
|
||||
public static Integer TypeClient ; // 0Personne 1Entreprise 2Passeger
|
||||
public static String codeclient ;
|
||||
public static String codecliententre;
|
||||
public static Object Mode;
|
||||
public static LocalDate FinValidite;
|
||||
|
||||
public static ObservableList<ListeProduit> data=FXCollections.observableArrayList();
|
||||
|
||||
Devis devis = new Devis();
|
||||
Produit produit= new Produit();
|
||||
ProduitDB produitDB= new ProduitDB();
|
||||
|
||||
|
||||
public void SauvgardeTraitement()
|
||||
{
|
||||
if(TypeClient != null){
|
||||
|
||||
if(TypeClient == 0){
|
||||
this.SetClient(codeclient);
|
||||
}
|
||||
if(TypeClient == 1){
|
||||
this.SetClientEntre(codecliententre);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
this.SauvgardeTraitement();
|
||||
|
||||
DateCreation.setValue(LocalDate.now());
|
||||
|
||||
TableViewListeProduitDevis.setEditable(true);
|
||||
TabColDevisReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColDevisDesignaton.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
|
||||
TabColDevisQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColDevisQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDevisQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColDevisPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisRemise.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColDevisRemise.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisRemise.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColDevisTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColDevisTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColDevisTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDevisTotalTTC.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisReference.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColDevisQuantite.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColDevisRemise.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
|
||||
this.ReferenceMouseClick();
|
||||
this.QantiteMouseClick();
|
||||
this.RemiseMouseClick();
|
||||
|
||||
|
||||
|
||||
TabColDevisAddAction.setSortable(true);
|
||||
TabColDevisAddAction.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<ListeProduit, Boolean>,
|
||||
ObservableValue<Boolean>>() {
|
||||
@Override
|
||||
public ObservableValue<Boolean> call(TableColumn.CellDataFeatures<ListeProduit, Boolean> p) {
|
||||
return new SimpleBooleanProperty(p.getValue() != null);
|
||||
}
|
||||
});
|
||||
|
||||
// create a cell value factory with an add button for each row in the table.
|
||||
TabColDevisAddAction.setCellFactory(new Callback<TableColumn<ListeProduit, Boolean>, TableCell<ListeProduit, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<ListeProduit, Boolean> call(TableColumn<ListeProduit, Boolean> personBooleanTableColumn) {
|
||||
return new DevisAjouterController.ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
TableViewListeProduitDevis.setItems(data);
|
||||
CalculeListeProduit();
|
||||
|
||||
//Ajouter une ligne vide lorce ce que en click sur la tableview
|
||||
TableViewListeProduitDevis.setOnMouseClicked(new EventHandler<javafx.scene.input.MouseEvent>(){
|
||||
public void handle(MouseEvent event){
|
||||
int nbrligne = TableViewListeProduitDevis.getItems().size() ;
|
||||
if(nbrligne == 0){
|
||||
data.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduitDevis.setItems(data);
|
||||
}
|
||||
else{
|
||||
ListeProduit Liste = TableViewListeProduitDevis.getItems().get(nbrligne - 1);
|
||||
if(!Liste.getTotalTTC().isEmpty()){
|
||||
data.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduitDevis.setItems(data);
|
||||
TableViewListeProduitDevis.getSelectionModel().select(nbrligne);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void SaveDevisButtonAction(ActionEvent event) throws IOException {
|
||||
final DevisDialogConfirmationController DevisDialogConfirmation = new DevisDialogConfirmationController();
|
||||
if(ControleDevis()){
|
||||
this.SetDevis();
|
||||
|
||||
DevisDialogConfirmation.Getdevis(devis);
|
||||
DevisDialogConfirmation.DevisEnregister.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
DevisDialogConfirmation.AnchorPrincipal.setVisible(false);
|
||||
DevisDB devisdb = new DevisDB();
|
||||
String codedevis = devisdb.AddDevis(devis);
|
||||
if(!codedevis.isEmpty()){
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Devis/DevisDetail.fxml"));
|
||||
Parent NodeDetail = (Parent)fxmlLoader.load();
|
||||
DevisDetailController devisdetail = fxmlLoader.getController();
|
||||
devisdetail.SowDetailDevis(codedevis);
|
||||
PaneDevisAjouter.getChildren().add(NodeDetail);
|
||||
} catch (IOException ex) {
|
||||
logger.error("DevisAjouterController : DevisDetail.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
DevisDialogConfirmation.Show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Define the button cell
|
||||
private class ButtonCell extends TableCell<ListeProduit, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-danger");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/icondelete.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
//Action when the button is pressed
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
int selectdIndex = getTableRow().getIndex();
|
||||
data.remove(selectdIndex);
|
||||
CalculeListeProduit();
|
||||
TableViewListeProduitDevis.setStyle(".table-row-cell:selected{ -fx-background-color:transparent ;}");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void AddLigneButtonAction(ActionEvent event) throws IOException {
|
||||
int nbrligne = TableViewListeProduitDevis.getItems().size() ;
|
||||
if(nbrligne == 0){
|
||||
data.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduitDevis.setItems(data);
|
||||
}
|
||||
else{
|
||||
ListeProduit Liste = TableViewListeProduitDevis.getItems().get(nbrligne - 1);
|
||||
if(!Liste.getTotalTTC().isEmpty()){
|
||||
data.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduitDevis.setItems(data);
|
||||
TableViewListeProduitDevis.getSelectionModel().select(nbrligne);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean ControleDevis(){
|
||||
boolean resulta = false ;
|
||||
if(data.size()<1){
|
||||
final MessageControle messagecontrol = new MessageControle();
|
||||
Text text3 = new Text();
|
||||
text3.setText("Vous devez ajouter au moin un produit à la liste des produits");
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 13));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
messagecontrol.ShowNotification();
|
||||
}
|
||||
//DateFinValidite ModeReglement
|
||||
else if(DateFinValidite.getValue()==null){
|
||||
DateFinValidite.setStyle("-fx-border-color:#f20606;");
|
||||
}
|
||||
else if(ModeReglement.getValue()==null){
|
||||
DateFinValidite.setStyle("-fx-border-color:#b5b5b5;");
|
||||
ModeReglement.setStyle("-fx-border-color:#f20606;");
|
||||
}
|
||||
else if(TypeClient == 2){ // 0Personne 1Entreprise 2Passeger
|
||||
ModeReglement.setStyle("-fx-border-color:transparent;");
|
||||
contro clt =new contro();
|
||||
if(DevisNom.getText().isEmpty()){
|
||||
DevisNom.setStyle("-fx-border-color:#f20606;");
|
||||
}
|
||||
else if(DevisPrenom.getText().isEmpty()){
|
||||
DevisNom.setStyle("-fx-border-color:transparent;");
|
||||
DevisPrenom.setStyle("-fx-border-color:#f20606;");
|
||||
|
||||
}
|
||||
else if(DevisAdresse.getText().isEmpty()){
|
||||
DevisPrenom.setStyle("-fx-border-color:transparent;");
|
||||
DevisAdresse.setStyle("-fx-border-color:#f20606;");
|
||||
|
||||
}
|
||||
else if(clt.isNumericNotnull(DevisTELE1.getText())){
|
||||
DevisAdresse.setStyle("-fx-border-color:transparent;");
|
||||
DevisTELE1.setStyle("-fx-border-color:#f20606;");
|
||||
}
|
||||
else if(clt.isNumeric(DevisTELE2.getText())){
|
||||
DevisTELE1.setStyle("-fx-border-color:transparent;");
|
||||
DevisTELE2.setStyle("-fx-border-color:#f20606;");
|
||||
}
|
||||
else{
|
||||
DevisTELE2.setStyle("-fx-border-color:transparent;");
|
||||
DateFinValidite.setStyle("-fx-border-color:#b5b5b5;");
|
||||
ModeReglement.setStyle("-fx-border-color:#b5b5b5;");
|
||||
resulta = true ;
|
||||
}
|
||||
}
|
||||
else{
|
||||
DateFinValidite.setStyle("-fx-border-color:#b5b5b5;");
|
||||
ModeReglement.setStyle("-fx-border-color:#b5b5b5;");
|
||||
resulta = true ;
|
||||
}
|
||||
|
||||
return resulta ;
|
||||
}
|
||||
private void SetDevis()
|
||||
{
|
||||
devis.setDateCreation(Adaptateur.NormalDateFormat(DateCreation.getValue()));
|
||||
devis.setTypeClient(TypeClient);
|
||||
devis.setTypeRegementString(ModeReglement.getValue().toString());
|
||||
devis.setValidite(Adaptateur.NormalDateFormat(DateFinValidite.getValue()));
|
||||
|
||||
devis.setNetAPayer(DevisNetAPayer.getText());
|
||||
devis.setTotalTVA(DevisTotalTVA.getText());
|
||||
devis.setTotalHorsTaxNet(DevisTotalHTNet.getText());
|
||||
|
||||
if(TypeClient == 0)
|
||||
{
|
||||
Client client = new ClientDB().getClient(CltExistCode.getText());
|
||||
devis.setClient(client);
|
||||
devis.setCodeClient(CltExistCode.getText());
|
||||
}
|
||||
else if(TypeClient == 1)
|
||||
{
|
||||
ClientEntreprise entreprise = new ClientEntrepriseDB().GetClientEtr(CltExistCode.getText());
|
||||
devis.setEntreprise(entreprise);
|
||||
devis.setCodeClient(CltExistCode.getText());
|
||||
}
|
||||
else if(TypeClient == 2)
|
||||
{
|
||||
ClientPassager passager = new ClientPassager();
|
||||
passager.setNom(DevisNom.getText());
|
||||
passager.setPrenom(DevisPrenom.getText());
|
||||
passager.setAdresse(DevisAdresse.getText());
|
||||
RadioButton SelectedRadioSexe = (RadioButton) ToggleGroupSexe.getSelectedToggle();
|
||||
passager.setSexeString(SelectedRadioSexe.getEllipsisString());
|
||||
passager.setTelefixString(DevisTELE1.getText());
|
||||
passager.setTelemobileString(DevisTELE2.getText());
|
||||
devis.setPassager(passager);
|
||||
}
|
||||
|
||||
//controle le cas ou on a une ligne vide a la fin de la liste
|
||||
if(data.get(data.size()-1).getTotalTTC().isEmpty()){
|
||||
data.remove(data.size()-1);
|
||||
}
|
||||
devis.setListeproduit(data);
|
||||
}
|
||||
|
||||
|
||||
//Methode qui pérmet de traite les recherche du client Personne
|
||||
@FXML
|
||||
private void ClientExisteDejatButtonAction(ActionEvent event) throws IOException {
|
||||
|
||||
final RechercherClientPersonneController RechercheClient = new RechercherClientPersonneController();
|
||||
|
||||
RechercheClient.Action.setCellFactory(new Callback<TableColumn<ListeClient, String>, TableCell<ListeClient, String>>() {
|
||||
@Override
|
||||
public TableCell<ListeClient, String> call(TableColumn<ListeClient, String> paramP) {
|
||||
return new TableCell<ListeClient, String>() {
|
||||
final Button cellButton = new Button("");
|
||||
{
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconaffecter.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent arg0) {
|
||||
try {
|
||||
// get Selected Item
|
||||
ListeClient ClientPerson = ((ListeClient)getTableRow().getItem());
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Devis/DevisAjouter.fxml"));
|
||||
Parent devis = (Parent) fxmlLoader.load();
|
||||
|
||||
|
||||
//Traitement de Sauvgarde
|
||||
DevisAjouterController.TypeClient = 0 ;
|
||||
DevisAjouterController.codeclient = ClientPerson.getCode();
|
||||
DevisAjouterController.FinValidite = DateFinValidite.getValue();
|
||||
DevisAjouterController.Mode = ModeReglement.getValue();
|
||||
|
||||
DevisAjouterController devisajouter = fxmlLoader.getController();
|
||||
devisajouter.SetClient(ClientPerson.getCode());
|
||||
devisajouter.ModeReglement.setValue(DevisAjouterController.Mode);
|
||||
devisajouter.DateFinValidite.setValue(DevisAjouterController.FinValidite);
|
||||
|
||||
//Refrechir le Panel
|
||||
MyWindow mywindows = new MyWindow();
|
||||
mywindows.Refresh(devis, 3);
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.error("DevisAjouterController : ClientExisteDejatButtonAction : DevisAjouter.fxml :" + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected void updateItem(String paramT, boolean isEmpty) {
|
||||
super.updateItem(paramT, isEmpty);
|
||||
if (!isEmpty) {
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
//afficher la fenaitre
|
||||
RechercheClient.ShowDialg();
|
||||
|
||||
final RechercherClientEntrepriseController RechercheClientEntre = new RechercherClientEntrepriseController();
|
||||
|
||||
RechercheClient.cltEntreprise.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
RechercheClient.AnchoreClientPerson.setVisible(false);
|
||||
RechercheClientEntre.AnchoreClientEntre.setVisible(true);
|
||||
RechercheClientEntre.Show();
|
||||
}
|
||||
});
|
||||
|
||||
//Action when the button is pressed
|
||||
|
||||
|
||||
RechercheClientEntre.cltPer.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
RechercheClientEntre.AnchoreClientEntre.setVisible(false);
|
||||
RechercheClient.AnchoreClientPerson.setVisible(true);
|
||||
RechercheClient.ShowDialg();
|
||||
}
|
||||
});
|
||||
|
||||
RechercheClientEntre.TableColumnActionEtre.setCellFactory(new Callback<TableColumn<ListeClientEntreprise, String>, TableCell<ListeClientEntreprise, String>>() {
|
||||
@Override
|
||||
public TableCell<ListeClientEntreprise, String> call(TableColumn<ListeClientEntreprise, String> paramP) {
|
||||
return new TableCell<ListeClientEntreprise, String>() {
|
||||
final Button cellButton = new Button("");
|
||||
{
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconaffecter.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent arg0) {
|
||||
try {
|
||||
// get Selected Item
|
||||
ListeClientEntreprise currentPerson = ((ListeClientEntreprise)getTableRow().getItem());
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Devis/DevisAjouter.fxml"));
|
||||
Parent devis = (Parent) fxmlLoader.load();
|
||||
|
||||
//Traitement de Sauvgarde
|
||||
DevisAjouterController.TypeClient = 1 ;
|
||||
DevisAjouterController.codecliententre = currentPerson.getCode();
|
||||
DevisAjouterController.FinValidite = DateFinValidite.getValue();
|
||||
DevisAjouterController.Mode = ModeReglement.getValue();
|
||||
|
||||
DevisAjouterController devisajouter = fxmlLoader.getController();
|
||||
|
||||
devisajouter.SetClientEntre(currentPerson.getCode());
|
||||
devisajouter.ModeReglement.setValue(DevisAjouterController.Mode);
|
||||
devisajouter.DateFinValidite.setValue(DevisAjouterController.FinValidite);
|
||||
|
||||
//Refrechir le Panel
|
||||
MyWindow mywindows = new MyWindow();
|
||||
mywindows.Refresh(devis, 3);
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.error("DevisAjouterController : DevisAjouter.fxml :" + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateItem(String paramT, boolean isEmpty) {
|
||||
super.updateItem(paramT, isEmpty);
|
||||
if (!isEmpty) {
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void QantiteMouseClick(){
|
||||
TabColDevisQuantite.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ListeProduit, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ListeProduit, String> t) {
|
||||
String newquantite = t.getNewValue() ;
|
||||
try{
|
||||
newquantite = newquantite.replace(',','.');
|
||||
if(Float.parseFloat(newquantite)<1){
|
||||
newquantite = "1";
|
||||
}
|
||||
}
|
||||
catch(NumberFormatException nfe){
|
||||
newquantite = "1";
|
||||
}
|
||||
|
||||
|
||||
ListeProduit Liste = t.getRowValue() ;
|
||||
|
||||
|
||||
if(Liste.getReference().isEmpty()){ //le cas en ajoute un quantité dans un ligne vide
|
||||
TableViewListeProduitDevis.getColumns().get(t.getTablePosition().getRow()).setVisible(false);
|
||||
TableViewListeProduitDevis.getColumns().get(t.getTablePosition().getRow()).setVisible(true);
|
||||
}
|
||||
else{
|
||||
Liste.setQuantite(newquantite);
|
||||
ListeProduit NewList = new ListeProduit(Liste.getReference(),Liste.getDesignation(), newquantite,Liste.getPrixHT(), Liste.getRemise(),"",Liste.getTVA(),"");
|
||||
//NewList = CalculeProduit(NewList);
|
||||
AffectationTableView(NewList,t.getTablePosition().getRow()) ;
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void RemiseMouseClick(){
|
||||
TabColDevisRemise.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ListeProduit, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ListeProduit, String> t) {
|
||||
String newRemise = t.getNewValue() ;
|
||||
try{
|
||||
newRemise = newRemise.replace(',','.');
|
||||
if(Float.parseFloat(newRemise)<0){
|
||||
newRemise = "0";
|
||||
}
|
||||
}
|
||||
catch(NumberFormatException nfe){
|
||||
newRemise = "0";
|
||||
}
|
||||
|
||||
ListeProduit Liste = t.getRowValue() ;
|
||||
|
||||
if(Liste.getReference().isEmpty()){ //le cas en ajoute un remise dans un ligne vide
|
||||
TableViewListeProduitDevis.getColumns().get(t.getTablePosition().getRow()).setVisible(false);
|
||||
TableViewListeProduitDevis.getColumns().get(t.getTablePosition().getRow()).setVisible(true);
|
||||
}
|
||||
else{
|
||||
Liste.setRemise(newRemise);
|
||||
ListeProduit NewList = new ListeProduit(Liste.getReference(),Liste.getDesignation(), Liste.getQuantite(),Liste.getPrixHT(), newRemise, "", Liste.getTVA(), "");
|
||||
AffectationTableView(NewList, t.getTablePosition().getRow());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void ReferenceMouseClick(){
|
||||
TabColDevisReference.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ListeProduit, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ListeProduit, String> t) {
|
||||
produit = produitDB.getProduit(t.getNewValue());
|
||||
if(produit.getReference() != null){
|
||||
ListeProduit Liste = new ListeProduit(produit.getReference(),produit.getDesignation(),"1",produit.getPrixventeht(),"0","",produit.getTvavente(),"0");
|
||||
AffectationTableView(Liste,t.getTablePosition().getRow()) ;
|
||||
}
|
||||
else{
|
||||
AffectationTableView(new ListeProduit("","","","","","","",""),t.getTablePosition().getRow()) ;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void RechercheProduitButtonAction(ActionEvent event) throws IOException {
|
||||
|
||||
double PrefWidthPaneDevis = PaneDevisAjouter.getPrefWidth();
|
||||
double PrefHeightPaneDevis = PaneDevisAjouter.getPrefHeight();
|
||||
|
||||
final RechercherProduitController rechercheproduit = new RechercherProduitController(true);
|
||||
|
||||
rechercheproduit.Show();
|
||||
|
||||
rechercheproduit.TabColAction.setCellFactory(new Callback<TableColumn<Produit, String>, TableCell<Produit, String>>() {
|
||||
@Override
|
||||
public TableCell<Produit, String> call(TableColumn<Produit, String> paramP) {
|
||||
return new TableCell<Produit, String>() {
|
||||
final Button cellButton = new Button("");
|
||||
{
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconaffecter.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent arg0) {
|
||||
try {
|
||||
DevisAjouterController.FinValidite = DateFinValidite.getValue();
|
||||
DevisAjouterController.Mode = ModeReglement.getValue();
|
||||
// get Selected ItemButtonCell
|
||||
Produit currentPerson = ((Produit)getTableRow().getItem());
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Devis/DevisAjouter.fxml"));
|
||||
Parent devis = (Parent) fxmlLoader.load();
|
||||
|
||||
DevisAjouterController devisajouter = fxmlLoader.getController();
|
||||
devisajouter.SetProduit(currentPerson.getReference());
|
||||
|
||||
devisajouter.ModeReglement.setValue(DevisAjouterController.Mode);
|
||||
devisajouter.DateFinValidite.setValue(DevisAjouterController.FinValidite);
|
||||
|
||||
devisajouter.PaneDevisAjouter.setPrefSize(PrefWidthPaneDevis, PrefHeightPaneDevis);
|
||||
|
||||
|
||||
MyWindow mywindows = new MyWindow();
|
||||
mywindows.Refresh(devis, 3);
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.error("DevisAjouterController : RechercheProduitButtonAction :" + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected void updateItem(String paramT, boolean isEmpty) {
|
||||
super.updateItem(paramT, isEmpty);
|
||||
if (!isEmpty) {
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void AffectationTableView(ListeProduit ListeProd, int EmplacementLigne){
|
||||
boolean result = false ;
|
||||
int indise=0;
|
||||
int Position = 0;
|
||||
|
||||
if(data.size()>0){
|
||||
do{ //Vérifier si le produit exsiste deja
|
||||
if(data.get(indise).getReference().equals(ListeProd.getReference())){
|
||||
result = true ;
|
||||
Position = indise ;
|
||||
}
|
||||
indise++;
|
||||
}while(data.size()>indise && !result);
|
||||
|
||||
if(result){ //si la ligne exsite déja
|
||||
if(EmplacementLigne!= -1){
|
||||
if(Position == EmplacementLigne){
|
||||
data.set(Position, ListeProd);
|
||||
}
|
||||
else{
|
||||
data.set(EmplacementLigne, new ListeProduit("","","","","","","",""));
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(EmplacementLigne!= -1){
|
||||
data.set(EmplacementLigne, ListeProd);
|
||||
}
|
||||
else{
|
||||
data.add(ListeProd);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
data.add(ListeProd);
|
||||
}
|
||||
|
||||
CalculeListeProduit();
|
||||
|
||||
|
||||
TableViewListeProduitDevis.setItems(data);
|
||||
TableViewListeProduitDevis.setVisible(false);
|
||||
TableViewListeProduitDevis.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void CalculeListeProduit(){ //calculer et afficher la détail des produits
|
||||
float NetaPayer = 0;
|
||||
float Remise = 0;
|
||||
float TotalTVA = 0;
|
||||
float Total_H_T_Net= 0;
|
||||
DevisTotalTVA.setText("");
|
||||
DevisRemise.setText("");
|
||||
DevisNetAPayer.setText("");
|
||||
DevisTimbre.setText("");
|
||||
DevisTotalHTNet.setText("");
|
||||
|
||||
//calcule
|
||||
for(ListeProduit liste : data){
|
||||
float totaht = Adaptateur.StringToFloat(liste.getTotalHT()) ;
|
||||
float prix_U_H_T = Adaptateur.StringToFloat(liste.getPrixHT()) ;
|
||||
float remise = Adaptateur.StringToFloat(liste.getRemise().replace("%", "")) ;
|
||||
float tva = Adaptateur.StringToFloat(liste.getTVA().replace("%", ""));
|
||||
float qte = Adaptateur.StringToFloat(liste.getQuantite());
|
||||
|
||||
TotalTVA = TotalTVA + ((totaht * tva) /100) ;
|
||||
|
||||
Remise = Remise + (prix_U_H_T * remise)/100 ;
|
||||
|
||||
Total_H_T_Net = Total_H_T_Net + totaht ;
|
||||
|
||||
}
|
||||
|
||||
if(Total_H_T_Net>0){
|
||||
float timbre = Adaptateur.StringToFloat(ParametreSystem.Timbre);
|
||||
NetaPayer = Total_H_T_Net + TotalTVA + timbre ;
|
||||
|
||||
DevisTotalTVA.setText(Adaptateur.ArrondFloatToString(TotalTVA));
|
||||
DevisRemise.setText(Adaptateur.ArrondFloatToString(Remise));
|
||||
devis.setRemise(Adaptateur.ArrondFloatToString(Remise));
|
||||
DevisNetAPayer.setText(Adaptateur.ArrondFloatToString(NetaPayer));
|
||||
DevisTimbre.setText(ParametreSystem.Timbre);
|
||||
DevisTotalHTNet.setText(Adaptateur.ArrondFloatToString(Total_H_T_Net));
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void ClientRessetDefautButtonAction(ActionEvent event) throws IOException {
|
||||
DevisAjouterController.TypeClient = 2 ;
|
||||
ClientExisteDejat.setVisible(true);
|
||||
DevisNom.setVisible(true);
|
||||
DevisPrenom.setVisible(true);
|
||||
DevisAdresse.setVisible(true);
|
||||
DevisTELE1.setVisible(true);
|
||||
DevisTELE2.setVisible(true);
|
||||
|
||||
TextCltExistCode.setVisible(false);
|
||||
ClientDefault.setVisible(false);
|
||||
CltExistCode.setVisible(false);
|
||||
CltExistNom.setVisible(false);
|
||||
CltExistPrenom.setVisible(false);
|
||||
CltExistAdresse.setVisible(false);
|
||||
CltExistTELE1.setVisible(false);
|
||||
CltExistTELE2.setVisible(false);
|
||||
}
|
||||
|
||||
public void SetClient(String codeclt){
|
||||
Client client = new Client();
|
||||
ClientDB clientdb = new ClientDB();
|
||||
DevisAjouterController.TypeClient = 0 ;
|
||||
client = clientdb.getClient(codeclt);
|
||||
|
||||
ClientExisteDejat.setVisible(false);
|
||||
DevisNom.setVisible(false);
|
||||
DevisPrenom.setVisible(false);
|
||||
DevisAdresse.setVisible(false);
|
||||
DevisTELE1.setVisible(false);
|
||||
DevisTELE2.setVisible(false);
|
||||
|
||||
|
||||
CltExistCode.setText(client.getCodeclient().toString());
|
||||
CltExistNom.setText(client.getNom());
|
||||
CltExistPrenom.setText(client.getPrenom());
|
||||
CltExistAdresse.setText(client.getAdresse());
|
||||
CltExistTELE1.setText(client.getTelefix().toString());
|
||||
CltExistTELE2.setText(client.getTelemobileString());
|
||||
|
||||
TextCltExistCode.setVisible(true);
|
||||
ClientDefault.setVisible(true);
|
||||
CltExistCode.setVisible(true);
|
||||
CltExistNom.setVisible(true);
|
||||
CltExistPrenom.setVisible(true);
|
||||
CltExistAdresse.setVisible(true);
|
||||
CltExistTELE1.setVisible(true);
|
||||
CltExistTELE2.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void SetProduit(String Refprod){
|
||||
produit = produitDB.getProduit(Refprod);
|
||||
ListeProduit ListeProd = new ListeProduit(produit.getReference(),produit.getDesignation(),"1",produit.getPrixventeht(),"0",produit.getPrixventettc(),produit.getTvavente(),"0");
|
||||
//Supprimer les igne vide
|
||||
if((data.size()>0) && (data.get(data.size()-1).getReference().isEmpty())){
|
||||
data.remove(data.size()-1);
|
||||
}
|
||||
|
||||
AffectationTableView(ListeProd,-1);
|
||||
}
|
||||
public void SetClientEntre(String codecliententre){
|
||||
|
||||
ClientEntreprise ClientEtr = new ClientEntreprise();
|
||||
ClientEntrepriseDB ClientEtrDB = new ClientEntrepriseDB();
|
||||
ClientEtr = ClientEtrDB.GetClientEtr(codecliententre);
|
||||
DevisAjouterController.TypeClient = 1 ;
|
||||
|
||||
TextMatricule.setVisible(true);
|
||||
TextPrenom.setVisible(false);
|
||||
|
||||
ClientExisteDejat.setVisible(false);
|
||||
DevisNom.setVisible(false);
|
||||
DevisPrenom.setVisible(false);
|
||||
DevisAdresse.setVisible(false);
|
||||
DevisTELE1.setVisible(false);
|
||||
DevisTELE2.setVisible(false);
|
||||
|
||||
CltExistCode.setText(ClientEtr.getCode().toString());
|
||||
CltExistNom.setText(ClientEtr.getNom());
|
||||
CltExistPrenom.setText(ClientEtr.getMatricule());
|
||||
CltExistAdresse.setText(ClientEtr.getAdresse());
|
||||
CltExistTELE1.setText(ClientEtr.getTele1().toString());
|
||||
CltExistTELE2.setText(ClientEtr.getTele2().toString());
|
||||
|
||||
TextCltExistCode.setVisible(true);
|
||||
ClientDefault.setVisible(true);
|
||||
CltExistCode.setVisible(true);
|
||||
CltExistNom.setVisible(true);
|
||||
CltExistPrenom.setVisible(true);
|
||||
CltExistAdresse.setVisible(true);
|
||||
CltExistTELE1.setVisible(true);
|
||||
CltExistTELE2.setVisible(true);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,427 @@
|
||||
package Controllers.DevisClt;
|
||||
|
||||
import Models.DevisClt.DevisCltListe;
|
||||
import Models.DevisClt.DevisDB;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class DevisCltGestionController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(DevisCltGestionController.class.getName());
|
||||
|
||||
@FXML private AnchorPane PaneDevisGestion ;
|
||||
|
||||
@FXML private ProgressBar ProgressBarDevisClt;
|
||||
|
||||
@FXML private Button ButtonSearchDevisClt;
|
||||
|
||||
@FXML private AnchorPane ListerPages;
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount ;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
@FXML public TableView<DevisCltListe> TableViewGestionDevis;
|
||||
|
||||
@FXML public TableColumn<DevisCltListe ,String> TabColCodeDevis;
|
||||
@FXML public TableColumn<DevisCltListe ,String> TabColModePaiement;
|
||||
@FXML public TableColumn<DevisCltListe ,String> TabColTypeClient;
|
||||
@FXML public TableColumn<DevisCltListe ,String> TabColCodeClient;
|
||||
@FXML public TableColumn<DevisCltListe ,String> TabColTotalDevis;
|
||||
@FXML public TableColumn<DevisCltListe ,String> TabColDateCreation ;
|
||||
@FXML public TableColumn<DevisCltListe ,String> TabColDateFinValidite;
|
||||
@FXML public TableColumn<DevisCltListe ,Boolean>TabColDetail ;
|
||||
|
||||
@FXML public TextField TextFieldCodeDevis ;
|
||||
@FXML public TextField TextFieldCodeClient ;
|
||||
@FXML public TextField TextFieldNomPrenomClient ;
|
||||
@FXML public TextField TextFieldCinClient;
|
||||
@FXML public DatePicker DatePickerCreation ;
|
||||
@FXML public RadioButton RadioComptant;
|
||||
@FXML public RadioButton RadioFacilite;
|
||||
|
||||
private Service<Void> ThreadSearchDevisClt;
|
||||
|
||||
@FXML
|
||||
private void AddDevisButtonAction(ActionEvent event) throws IOException {
|
||||
|
||||
//inisialiser les données de Sauvgarde des opération
|
||||
DevisAjouterController.TypeClient = 2 ;
|
||||
DevisAjouterController.codeclient = null ;
|
||||
DevisAjouterController.codecliententre = null ;
|
||||
DevisAjouterController.data.clear();
|
||||
DevisAjouterController.FinValidite = null;
|
||||
DevisAjouterController.Mode = null;
|
||||
|
||||
PaneDevisGestion.getChildren().clear();
|
||||
PaneDevisGestion.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Devis/DevisAjouter.fxml")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
//comboboxnombre des lignes tableview
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
TableViewGestionDevis.setEditable(true);
|
||||
|
||||
TabColCodeDevis.setStyle( "-fx-alignment: CENTER;");TabColCodeDevis.getStyleClass().add("Center");
|
||||
TabColCodeDevis.setCellValueFactory(new PropertyValueFactory<DevisCltListe, String>("CodeDevis"));
|
||||
|
||||
TabColTypeClient.setStyle( "-fx-alignment: CENTER;");TabColTypeClient.getStyleClass().add("Center");
|
||||
TabColTypeClient.setCellValueFactory(new PropertyValueFactory<DevisCltListe, String>("TypeClient"));
|
||||
|
||||
TabColCodeClient.setStyle( "-fx-alignment: CENTER;");TabColCodeClient.getStyleClass().add("Center");
|
||||
TabColCodeClient.setCellValueFactory(new PropertyValueFactory<DevisCltListe, String>("CodeClient"));
|
||||
|
||||
TabColModePaiement.setStyle( "-fx-alignment: CENTER;");TabColModePaiement.getStyleClass().add("Center");
|
||||
TabColModePaiement.setCellValueFactory(new PropertyValueFactory<DevisCltListe, String>("ModePaiement"));
|
||||
|
||||
TabColTotalDevis.setStyle( "-fx-alignment: CENTER;");TabColTotalDevis.getStyleClass().add("Center");
|
||||
TabColTotalDevis.setCellValueFactory(new PropertyValueFactory<DevisCltListe, String>("TotalDevis"));
|
||||
|
||||
TabColDateCreation.setStyle( "-fx-alignment: CENTER;");TabColDateCreation.getStyleClass().add("Center");
|
||||
TabColDateCreation.setCellValueFactory(new PropertyValueFactory<DevisCltListe, String>("DateCreation"));
|
||||
|
||||
TabColDateFinValidite.setStyle( "-fx-alignment: CENTER;");TabColDateFinValidite.getStyleClass().add("Center");
|
||||
TabColDateFinValidite.setCellValueFactory(new PropertyValueFactory<DevisCltListe, String>("FinValidite"));
|
||||
|
||||
TabColDetail.setSortable(true);
|
||||
TabColDetail.setStyle( "-fx-alignment: CENTER;");TabColDetail.getStyleClass().add("Center");
|
||||
TabColDetail.setCellFactory(new Callback<TableColumn<DevisCltListe, Boolean>, TableCell<DevisCltListe, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<DevisCltListe, Boolean> call(TableColumn<DevisCltListe, Boolean> personBooleanTableColumn) {
|
||||
return new ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
ButtonSearchDevisClt.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchDevisClt();
|
||||
}
|
||||
});
|
||||
|
||||
PaneDevisGestion.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchDevisClt();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SearchDevisClt();
|
||||
|
||||
GestionSearchDevisClt();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Define the button cell
|
||||
private class ButtonCell extends TableCell<DevisCltListe, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconedit.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){ //Action when the button is pressed
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
// get Selected Item
|
||||
DevisCltListe current = (DevisCltListe) ButtonCell.this.getTableView().getItems().get(ButtonCell.this.getIndex());
|
||||
String codedevis = current.getCodeDevis();
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Devis/DevisDetail.fxml"));
|
||||
Parent NodeDetail = (Parent)fxmlLoader.load();
|
||||
DevisDetailController devisdetail = fxmlLoader.getController();
|
||||
devisdetail.AnchorPaneSucces.setVisible(false);
|
||||
devisdetail.TextSucces.setText("Information Devis");
|
||||
devisdetail.TextSucces.setLayoutX(30);
|
||||
devisdetail.TextSucces.setFont(Font.font("Arial", FontWeight.NORMAL, 21));
|
||||
devisdetail.TextDescSucces.setVisible(false);
|
||||
devisdetail.SowDetailDevis(codedevis);
|
||||
PaneDevisGestion.getChildren().add(NodeDetail);
|
||||
} catch (IOException ex) {
|
||||
logger.error("DevisCltGestionController : DevisDetail.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView client Entreprise *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchDevisClt()
|
||||
{
|
||||
ProgressBarDevisClt.setVisible(true);
|
||||
|
||||
ButtonSearchDevisClt.setDisable(true);
|
||||
|
||||
ThreadSearchDevisClt = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DateCreation = "";
|
||||
if(DatePickerCreation.getValue() != null){
|
||||
DateCreation = DatePickerCreation.getValue().toString();
|
||||
}
|
||||
|
||||
// 0comptant 1facilité
|
||||
String TypeRegement = "";
|
||||
if(RadioComptant.isSelected()){
|
||||
TypeRegement = "0";
|
||||
}else if(RadioFacilite.isSelected()){
|
||||
TypeRegement = "1";
|
||||
}
|
||||
|
||||
ObservableList<DevisCltListe> ListDevisClts = new DevisDB().SearchDevisCltGestion(
|
||||
position,
|
||||
nbrligne,
|
||||
TextFieldCodeDevis.getText(),
|
||||
TextFieldCodeClient.getText(),
|
||||
TypeRegement,
|
||||
DateCreation,
|
||||
TextFieldNomPrenomClient.getText(),
|
||||
TextFieldCinClient.getText());
|
||||
|
||||
TableViewGestionDevis.setItems(ListDevisClts);
|
||||
|
||||
totalcount = new DevisDB().nbrDevisCltGestion(TextFieldCodeDevis.getText(), TextFieldCodeClient.getText(), TypeRegement, DateCreation, TextFieldNomPrenomClient.getText(), TextFieldCinClient.getText());
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchDevisClt.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarDevisClt.setVisible(false);
|
||||
ButtonSearchDevisClt.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchDevisClt.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchDevisClt(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarDevisClt.setVisible(true);
|
||||
|
||||
ButtonSearchDevisClt.setDisable(true);
|
||||
|
||||
ThreadSearchDevisClt = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateCreation = "";
|
||||
if(DatePickerCreation.getValue() != null){
|
||||
DateCreation = DatePickerCreation.getValue().toString();
|
||||
}
|
||||
|
||||
// 0comptant 1facilité
|
||||
String TypeRegement = "";
|
||||
if(RadioComptant.isSelected()){
|
||||
TypeRegement = "0";
|
||||
}else if(RadioFacilite.isSelected()){
|
||||
TypeRegement = "1";
|
||||
}
|
||||
|
||||
ObservableList<DevisCltListe> ListDevisClts = new DevisDB().SearchDevisCltGestion(ParmPosition, ParamNbrligne, TextFieldCodeDevis.getText(), TextFieldCodeClient.getText(), TypeRegement, DateCreation, TextFieldNomPrenomClient.getText(), TextFieldCinClient.getText());
|
||||
|
||||
TableViewGestionDevis.setItems(ListDevisClts);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchDevisClt.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarDevisClt.setVisible(false);
|
||||
ButtonSearchDevisClt.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchDevisClt.start();
|
||||
}
|
||||
|
||||
private void GestionSearchDevisClt()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchDevisClt(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchDevisClt(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchDevisClt(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchDevisClt(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchDevisClt(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
249
src/main/java/Controllers/DevisClt/DevisCltPrintController.java
Normal file
249
src/main/java/Controllers/DevisClt/DevisCltPrintController.java
Normal file
@@ -0,0 +1,249 @@
|
||||
package Controllers.DevisClt;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Models.DevisClt.Devis;
|
||||
import Models.Produit.ListeProduit;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Control;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class DevisCltPrintController implements Initializable {
|
||||
|
||||
@FXML public ImageView ImageViewLogo;
|
||||
|
||||
@FXML private Text TextSteNom1;
|
||||
@FXML private Text TextReference;
|
||||
@FXML private Text TextDate;
|
||||
@FXML private Text TextEcheance;
|
||||
@FXML private Text TextClient;
|
||||
|
||||
@FXML private Text TextNumDevie;
|
||||
@FXML private Text TextTotalHT;
|
||||
@FXML private Text TextTVA;
|
||||
@FXML private Text TextTotalTTC;
|
||||
|
||||
@FXML private Text TextSteNom2;
|
||||
@FXML private Text TextSteContact;
|
||||
@FXML private Text TextSteSIREN;
|
||||
|
||||
|
||||
@FXML private TableView<ListProdDevis> TableViewProdDevis ;
|
||||
@FXML private TableColumn<ListProdDevis ,String> TabColDevisReference;
|
||||
@FXML private TableColumn<ListProdDevis ,String> TabColDevisDesignation;
|
||||
@FXML private TableColumn<ListProdDevis ,String> TabColDevisQuantite ;
|
||||
@FXML private TableColumn<ListProdDevis ,String> TabColDevisPrix;
|
||||
@FXML private TableColumn<ListProdDevis ,String> TabColDevisMontant;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
setImageLogo();
|
||||
|
||||
TabColDevisReference.setCellValueFactory(new PropertyValueFactory<ListProdDevis, String>("Reference"));
|
||||
|
||||
TabColDevisDesignation.setCellValueFactory(new PropertyValueFactory<ListProdDevis, String>("Description"));
|
||||
TabColDevisDesignation.setCellFactory(new Callback<TableColumn<ListProdDevis, String>,TableCell<ListProdDevis, String>>(){
|
||||
@Override
|
||||
public TableCell<ListProdDevis, String> call(TableColumn<ListProdDevis, String> param) {
|
||||
TableCell<ListProdDevis, String> cell = new TableCell<ListProdDevis, String>(){
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
if (item == null) {
|
||||
super.setText(null);
|
||||
super.setGraphic(null);
|
||||
} else {
|
||||
String newItem = item.trim().toLowerCase();
|
||||
Text text = new Text(newItem);
|
||||
super.setPrefHeight(Control.USE_COMPUTED_SIZE);
|
||||
text.wrappingWidthProperty().bind(super.widthProperty());
|
||||
super.setGraphic(text);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
TabColDevisQuantite.setCellValueFactory(new PropertyValueFactory<ListProdDevis, String>("Quantite"));
|
||||
TabColDevisQuantite.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisPrix.setCellValueFactory(new PropertyValueFactory<ListProdDevis, String>("Prix"));
|
||||
TabColDevisPrix.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisPrix.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisMontant.setCellValueFactory(new PropertyValueFactory<ListProdDevis, String>("Montant"));
|
||||
TabColDevisMontant.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisMontant.getStyleClass().add("Center");
|
||||
|
||||
|
||||
TextSteNom1.setText(ParametreSystem.CompanyName);
|
||||
TextSteNom2.setText("Ste:"+ParametreSystem.CompanyName+" | Adress:"+ParametreSystem.CompanyAddress+" | Tele: "+ParametreSystem.CompanyTele);
|
||||
TextSteContact.setText("Fax:"+ParametreSystem.CompanyFax+" | Mail:"+ParametreSystem.CompanyMail+" | Site:"+ParametreSystem.CompanySite);
|
||||
TextSteSIREN.setText(ParametreSystem.CompanySIREN);
|
||||
}
|
||||
|
||||
public void SetDevis(Devis devis)
|
||||
{
|
||||
TextNumDevie.setText(devis.getCodeDevis());
|
||||
TextReference.setText(devis.getCodeDevis());
|
||||
TextDate.setText(Adaptateur.NormalDateFormat(devis.getDateCreation()));
|
||||
TextEcheance.setText(devis.getValidite());
|
||||
|
||||
if(devis.getTypeClient()==0){
|
||||
TextClient.setText(devis.getCodeClient()+" - "+devis.getClient().getNom()+" - "+devis.getClient().getPrenom());
|
||||
}else if(devis.getTypeClient()==1){
|
||||
TextClient.setText(devis.getCodeClient()+" - "+devis.getEntreprise().getNom()+" - "+devis.getEntreprise().getMatricule());
|
||||
}
|
||||
else if(devis.getTypeClient()==2){
|
||||
TextClient.setText(devis.getCodeClient()+" - "+devis.getPassager().getNom()+" - "+devis.getPassager().getPrenom());
|
||||
}
|
||||
ObservableList<ListProdDevis> PodDevis = FXCollections.observableArrayList();
|
||||
|
||||
for(ListeProduit liste : devis.getListeproduit())
|
||||
{
|
||||
if(!liste.getReference().equals(""))
|
||||
{
|
||||
float remise = Adaptateur.ArrondStringToFloat(liste.getRemise().replace("%", "")) ;
|
||||
float prixht = Adaptateur.ArrondStringToFloat(liste.getPrixHT()) ;
|
||||
float tva = Adaptateur.StringToFloat(liste.getTVA().replace("%", "")) ;
|
||||
float qte = Adaptateur.StringToFloat(liste.getQuantite()) ;
|
||||
|
||||
float totalht = (prixht - ((prixht * remise)/100)) ;
|
||||
float prixttc = totalht + ((totalht * tva)/100) ;
|
||||
|
||||
float montant = prixttc * qte;
|
||||
|
||||
PodDevis.add(new ListProdDevis(liste.getReference(), liste.getDesignation(), liste.getQuantite(), Adaptateur.FloatToStringEspace(prixttc), Adaptateur.FloatToStringEspace(montant)));
|
||||
}
|
||||
}
|
||||
|
||||
TextTVA.setText(Adaptateur.StringToStringEspaceCurrency(devis.getTotalTVA()));
|
||||
TextTotalHT.setText(Adaptateur.StringToStringEspaceCurrency(devis.getTotalHorsTaxNet()));
|
||||
TextTotalTTC.setText(Adaptateur.StringToStringEspaceCurrency(devis.getNetAPayer()));
|
||||
|
||||
TableViewProdDevis.setItems(PodDevis);
|
||||
}
|
||||
|
||||
private void setImageLogo()
|
||||
{
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
try {
|
||||
// optional, but recommended
|
||||
// process XML securely, avoid attacks like XML External Entities (XXE)
|
||||
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
|
||||
// parse XML file
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
|
||||
//PowerERP\conf\logo.xml
|
||||
Document doc = db.parse(new File("./conf/logo.xml"));
|
||||
|
||||
doc.getDocumentElement().normalize();
|
||||
|
||||
Element elementCNX = (Element) doc.getElementsByTagName("DevisCltPrint").item(0);
|
||||
|
||||
String pathLogo = elementCNX.getElementsByTagName("PathImage").item(0).getTextContent();
|
||||
FileInputStream fis = new FileInputStream(pathLogo);
|
||||
ImageViewLogo.setImage(new Image(fis));
|
||||
|
||||
ImageViewLogo.setFitWidth(Double.parseDouble(elementCNX.getElementsByTagName("FitWidth").item(0).getTextContent()));
|
||||
ImageViewLogo.setFitHeight(Double.parseDouble(elementCNX.getElementsByTagName("FitHeight").item(0).getTextContent()));
|
||||
ImageViewLogo.setLayoutX(Double.parseDouble(elementCNX.getElementsByTagName("LayoutX").item(0).getTextContent()));
|
||||
ImageViewLogo.setLayoutY(Double.parseDouble(elementCNX.getElementsByTagName("LayoutY").item(0).getTextContent()));
|
||||
}
|
||||
catch (ParserConfigurationException | SAXException | IOException e) {
|
||||
System.out.println("error AuthentificationController/setImageLogo "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static class ListProdDevis {
|
||||
|
||||
private final SimpleStringProperty Reference;
|
||||
private final SimpleStringProperty Description;
|
||||
private final SimpleStringProperty Quantite;
|
||||
private final SimpleStringProperty Prix;
|
||||
private final SimpleStringProperty Montant;
|
||||
|
||||
private ListProdDevis(String reference, String description, String quantite, String prix, String montant) {
|
||||
this.Reference = new SimpleStringProperty(reference);
|
||||
this.Description = new SimpleStringProperty(description);
|
||||
this.Quantite = new SimpleStringProperty(quantite);
|
||||
this.Prix = new SimpleStringProperty(prix);
|
||||
this.Montant = new SimpleStringProperty(montant);
|
||||
}
|
||||
|
||||
public String getReference() {
|
||||
return Reference.get();
|
||||
}
|
||||
|
||||
public void setReference(String reference) {
|
||||
Reference.set(reference);
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return Description.get();
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
Description.set(description);
|
||||
}
|
||||
|
||||
public String getQuantite() {
|
||||
return Quantite.get();
|
||||
}
|
||||
|
||||
public void setQuantite(String quantite) {
|
||||
Quantite.set(quantite);
|
||||
}
|
||||
|
||||
public String getPrix() {
|
||||
return Prix.get();
|
||||
}
|
||||
|
||||
public void setPrix(String prix) {
|
||||
Prix.set(prix);
|
||||
}
|
||||
|
||||
public String getMontant() {
|
||||
return Montant.get();
|
||||
}
|
||||
|
||||
public void setMontant(String montant) {
|
||||
Montant.set(montant);
|
||||
}
|
||||
}
|
||||
}
|
||||
192
src/main/java/Controllers/DevisClt/DevisDetailController.java
Normal file
192
src/main/java/Controllers/DevisClt/DevisDetailController.java
Normal file
@@ -0,0 +1,192 @@
|
||||
package Controllers.DevisClt;
|
||||
|
||||
import Models.Produit.ListeProduit;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Models.Client.Client;
|
||||
import Models.Client.ClientEntreprise;
|
||||
import Models.Client.ClientPassager;
|
||||
import Models.DevisClt.Devis;
|
||||
import Models.DevisClt.DevisDB;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.print.PageRange;
|
||||
import javafx.print.PrinterJob;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class DevisDetailController implements Initializable {
|
||||
|
||||
@FXML public AnchorPane AnchorPaneSucces;
|
||||
@FXML public AnchorPane AnchorPaneDevisDetail;
|
||||
@FXML public AnchorPane AnchorPaneLoadingDevisDetail;
|
||||
|
||||
@FXML public Text TextSucces;
|
||||
@FXML public Text TextDescSucces;
|
||||
|
||||
@FXML private Text DevisDateCreation;
|
||||
@FXML private Text DevisFinValidite;
|
||||
@FXML private Text DevisReglement;
|
||||
@FXML private Text DevisNetAPayer;
|
||||
@FXML private Text DevisTotalHorsTaxNet;
|
||||
@FXML private Text DevisCode;
|
||||
|
||||
@FXML private Text DevisTypeClt;
|
||||
@FXML private Text DevisNom;
|
||||
@FXML private Text DevisPrenom;
|
||||
@FXML private Text DevisAdresse;
|
||||
@FXML private Text DevisTELE1;
|
||||
@FXML private Text DevisTELE2;
|
||||
|
||||
@FXML private Text DevisTextPrenom ;
|
||||
@FXML private Text DevisTextMatricule ;
|
||||
|
||||
@FXML private TableView<ListeProduit> TableViewListeProduitDevis ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDevisReference;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDevisDesignaton;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDevisQuantite ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDevisPrixHT;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDevisRemise;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDevisTotalHT;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDevisTVA;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDevisTotalTTC;
|
||||
|
||||
Devis devis = new Devis();
|
||||
|
||||
private Service<Void> ThreadDevisDetail;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TabColDevisReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColDevisDesignaton.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
|
||||
TabColDevisQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColDevisQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDevisQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColDevisPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisRemise.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColDevisRemise.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisRemise.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColDevisTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColDevisTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColDevisTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDevisTotalTTC.getStyleClass().add("Center");
|
||||
}
|
||||
|
||||
public void SowDetailDevis(String codedevis)
|
||||
{
|
||||
ThreadDevisDetail = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
devis = new DevisDB().getDevis(codedevis);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadDevisDetail.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
DevisDateCreation.setText(Adaptateur.NormalDateFormat(devis.getDateCreation()));
|
||||
DevisFinValidite.setText(devis.getValidite());
|
||||
DevisReglement.setText(devis.getTypeRegementString());
|
||||
DevisTotalHorsTaxNet.setText(Adaptateur.StringToStringEspace(devis.getTotalHorsTaxNet()));
|
||||
DevisCode.setText(codedevis);
|
||||
DevisTypeClt.setText(devis.getTypeClientString());
|
||||
|
||||
if(devis.getTypeClient()==0)
|
||||
{
|
||||
Client client = devis.getClient();
|
||||
DevisNom.setText(client.getNom());
|
||||
DevisTextPrenom.setVisible(true);
|
||||
DevisTextMatricule.setVisible(false);
|
||||
DevisPrenom.setText(client.getPrenom());
|
||||
DevisAdresse.setText(client.getAdresse());
|
||||
DevisTELE1.setText(client.getTelefixString());
|
||||
DevisTELE2.setText(client.getTelemobileString());
|
||||
}else if(devis.getTypeClient()==1)
|
||||
{
|
||||
ClientEntreprise entreprise = devis.getEntreprise();
|
||||
DevisNom.setText(entreprise.getNom());
|
||||
DevisTextPrenom.setVisible(false);
|
||||
DevisTextMatricule.setVisible(true);
|
||||
DevisPrenom.setText(devis.getMatricule());
|
||||
DevisAdresse.setText(entreprise.getAdresse());
|
||||
DevisTELE1.setText(entreprise.getTele1String());
|
||||
DevisTELE2.setText(entreprise.getTele2String());
|
||||
}else if(devis.getTypeClient()==2)
|
||||
{
|
||||
ClientPassager passager = devis.getPassager();
|
||||
DevisNom.setText(passager.getNom());
|
||||
DevisTextPrenom.setVisible(true);
|
||||
DevisTextMatricule.setVisible(false);
|
||||
DevisPrenom.setText(passager.getPrenom());
|
||||
DevisAdresse.setText(passager.getAdresse());
|
||||
DevisTELE1.setText(passager.getTelefixString());
|
||||
DevisTELE2.setText(passager.getTelemobileString());
|
||||
}
|
||||
|
||||
DevisNetAPayer.setText(Adaptateur.StringToStringEspaceCurrency(devis.getNetAPayer()));
|
||||
|
||||
TableViewListeProduitDevis.setItems(devis.getListeproduit());
|
||||
AnchorPaneDevisDetail.setVisible(true);
|
||||
AnchorPaneLoadingDevisDetail.setVisible(false);
|
||||
}
|
||||
});
|
||||
ThreadDevisDetail.start();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void DevisPrintButtonAction(ActionEvent event) throws IOException {
|
||||
PrinterJob jobPrint = PrinterJob.createPrinterJob();
|
||||
jobPrint.getJobSettings().setPageRanges(new PageRange(1, 1));
|
||||
|
||||
if (jobPrint.showPrintDialog(null)) {
|
||||
|
||||
FXMLLoader fxmlLoaderPrintDevis = new FXMLLoader(getClass().getResource("/Views/Devis/DevisCltPrint.fxml"));
|
||||
final Node ParentFxmlPrintDevis = (Node)fxmlLoaderPrintDevis.load();
|
||||
DevisCltPrintController PrintDevis = fxmlLoaderPrintDevis.getController();
|
||||
|
||||
PrintDevis.SetDevis(devis);
|
||||
|
||||
jobPrint.printPage(ParentFxmlPrintDevis);
|
||||
|
||||
jobPrint.endJob();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,183 @@
|
||||
package Controllers.DevisClt;
|
||||
|
||||
import Models.Produit.ListeProduit;
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Models.Client.Client;
|
||||
import Models.Client.ClientEntreprise;
|
||||
import Models.Client.ClientPassager;
|
||||
import Models.DevisClt.Devis;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class DevisDialogConfirmationController implements Initializable {
|
||||
|
||||
public Node nodeFxml ;
|
||||
|
||||
Logger logger = Logger.getLogger(DevisDialogConfirmationController.class.getName());
|
||||
|
||||
@FXML public AnchorPane AnchorPrincipal ;
|
||||
@FXML public Button DevisEnregister ;
|
||||
@FXML private Text DevisDateCreation;
|
||||
@FXML private Text DevisFinValidite;
|
||||
@FXML private Text DevisReglement;
|
||||
@FXML private Text DevisNetAPayer;
|
||||
@FXML private Text DevisTotalHorsTaxNet;
|
||||
@FXML private Text DevisTotalTVA;
|
||||
|
||||
@FXML private Text DevisTypeClt;
|
||||
@FXML private Text DevisNom;
|
||||
@FXML private Text DevisPrenom;
|
||||
@FXML private Text DevisAdresse;
|
||||
@FXML private Text DevisTELE1;
|
||||
@FXML private Text DevisTELE2;
|
||||
|
||||
@FXML private Text DevisTextPrenom ;
|
||||
@FXML private Text DevisTextMatricule ;
|
||||
|
||||
@FXML public TableView<ListeProduit> TableViewListeProduitDevis ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisReference;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisDesignaton;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisQuantite ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisPrixHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisRemise;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisTotalHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisTVA;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDevisTotalTTC;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TabColDevisReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColDevisDesignaton.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
|
||||
TabColDevisQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColDevisQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDevisQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColDevisPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisRemise.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColDevisRemise.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisRemise.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColDevisTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColDevisTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDevisTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColDevisTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColDevisTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDevisTotalTTC.getStyleClass().add("Center");
|
||||
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconsave.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
DevisEnregister.setGraphic(buttonGraphic);
|
||||
}
|
||||
|
||||
public void Getdevis(Devis devis)
|
||||
{
|
||||
DevisDateCreation.setText(devis.getDateCreation());
|
||||
DevisFinValidite.setText(devis.getValidite());
|
||||
DevisReglement.setText(devis.getTypeRegement());
|
||||
|
||||
DevisNetAPayer.setText(devis.getNetAPayer());
|
||||
DevisTotalHorsTaxNet.setText(devis.getTotalHorsTaxNet());
|
||||
DevisTotalTVA.setText(devis.getTotalTVA());
|
||||
DevisTypeClt.setText(devis.getTypeClientString());
|
||||
|
||||
if(devis.getTypeClient()==0)
|
||||
{
|
||||
Client client = devis.getClient();
|
||||
DevisNom.setText(client.getNom());
|
||||
DevisTextPrenom.setVisible(true);
|
||||
DevisTextMatricule.setVisible(false);
|
||||
DevisPrenom.setText(client.getPrenom());
|
||||
DevisAdresse.setText(client.getAdresse());
|
||||
DevisTELE1.setText(client.getTelefixString());
|
||||
DevisTELE2.setText(client.getTelemobileString());
|
||||
}else if(devis.getTypeClient()==1)
|
||||
{
|
||||
ClientEntreprise entreprise = devis.getEntreprise();
|
||||
DevisNom.setText(entreprise.getNom());
|
||||
DevisTextPrenom.setVisible(false);
|
||||
DevisTextMatricule.setVisible(true);
|
||||
DevisPrenom.setText(devis.getMatricule());
|
||||
DevisAdresse.setText(entreprise.getAdresse());
|
||||
DevisTELE1.setText(entreprise.getTele1String());
|
||||
DevisTELE2.setText(entreprise.getTele2String());
|
||||
}else if(devis.getTypeClient()==2)
|
||||
{
|
||||
ClientPassager passager = devis.getPassager();
|
||||
DevisNom.setText(passager.getNom());
|
||||
DevisTextPrenom.setVisible(true);
|
||||
DevisTextMatricule.setVisible(false);
|
||||
DevisPrenom.setText(passager.getPrenom());
|
||||
DevisAdresse.setText(passager.getAdresse());
|
||||
DevisTELE1.setText(passager.getTelefixString());
|
||||
DevisTELE2.setText(passager.getTelemobileString());
|
||||
}
|
||||
|
||||
TableViewListeProduitDevis.setItems(devis.getListeproduit());
|
||||
}
|
||||
|
||||
|
||||
public DevisDialogConfirmationController(){
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Devis/DevisDialogConfirmation.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
nodeFxml = (Node) fxmlLoader.load();
|
||||
} catch (IOException ex) {
|
||||
logger.error("DevisDialogConfirmationController : DevisDialogConfirmation.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(nodeFxml);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void ExitButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPrincipal.setVisible(false);
|
||||
}
|
||||
|
||||
}
|
||||
397
src/main/java/Controllers/DevisClt/DevisImporterController.java
Normal file
397
src/main/java/Controllers/DevisClt/DevisImporterController.java
Normal file
@@ -0,0 +1,397 @@
|
||||
package Controllers.DevisClt;
|
||||
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Models.DevisClt.DevisCltListe;
|
||||
import Models.DevisClt.DevisDB;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class DevisImporterController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(DevisImporterController.class.getName());
|
||||
|
||||
@FXML private AnchorPane anchorpane ;
|
||||
|
||||
@FXML private ProgressBar ProgressBarDevisClt;
|
||||
|
||||
@FXML private Button ButtonSearchDevisClt;
|
||||
|
||||
@FXML public TableView<DevisCltListe> TableViewGestionDevis;
|
||||
|
||||
@FXML public TableColumn<DevisCltListe ,String> TabColCodeDevis;
|
||||
@FXML public TableColumn<DevisCltListe ,String> TabColModePaiement;
|
||||
@FXML public TableColumn<DevisCltListe ,String> TabColTypeClient;
|
||||
@FXML public TableColumn<DevisCltListe ,String> TabColCodeClient;
|
||||
@FXML public TableColumn<DevisCltListe ,String> TabColTotalDevis;
|
||||
@FXML public TableColumn<DevisCltListe ,String> TabColDateCreation ;
|
||||
@FXML public TableColumn<DevisCltListe ,String> TabColDateFinValidite;
|
||||
@FXML public TableColumn<DevisCltListe ,Boolean>TabColDetail ;
|
||||
|
||||
@FXML public TextField TextFieldCodeDevis ;
|
||||
@FXML public TextField TextFieldCodeClient ;
|
||||
@FXML public DatePicker DatePickerCreation ;
|
||||
@FXML public TextField TextFieldNomPrenomClient ;
|
||||
@FXML public TextField TextFieldCinClient;
|
||||
@FXML public RadioButton RadioComptant;
|
||||
@FXML public RadioButton RadioFacilite;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount ;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
public Node node;
|
||||
|
||||
private Service<Void> ThreadSearchDevisCltRechercher;
|
||||
|
||||
public DevisImporterController() {
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Devis/DevisImporter.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
node = (Node) fxmlLoader.load();
|
||||
} catch (IOException ex) {
|
||||
logger.error("DevisImporterController : DevisImporter.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Show()
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(node);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
//comboboxnombre des lignes tableview
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
TableViewGestionDevis.setEditable(true);
|
||||
|
||||
TabColCodeDevis.setStyle( "-fx-alignment: CENTER;");TabColCodeDevis.getStyleClass().add("Center");
|
||||
TabColCodeDevis.setCellValueFactory(new PropertyValueFactory<DevisCltListe, String>("CodeDevis"));
|
||||
|
||||
TabColTypeClient.setStyle( "-fx-alignment: CENTER;");TabColTypeClient.getStyleClass().add("Center");
|
||||
TabColTypeClient.setCellValueFactory(new PropertyValueFactory<DevisCltListe, String>("TypeClient"));
|
||||
|
||||
TabColCodeClient.setStyle( "-fx-alignment: CENTER;");TabColCodeClient.getStyleClass().add("Center");
|
||||
TabColCodeClient.setCellValueFactory(new PropertyValueFactory<DevisCltListe, String>("CodeClient"));
|
||||
|
||||
TabColModePaiement.setStyle( "-fx-alignment: CENTER;");TabColModePaiement.getStyleClass().add("Center");
|
||||
TabColModePaiement.setCellValueFactory(new PropertyValueFactory<DevisCltListe, String>("ModePaiement"));
|
||||
|
||||
TabColTotalDevis.setStyle( "-fx-alignment: CENTER;");TabColTotalDevis.getStyleClass().add("Center");
|
||||
TabColTotalDevis.setCellValueFactory(new PropertyValueFactory<DevisCltListe, String>("TotalDevis"));
|
||||
|
||||
TabColDateCreation.setStyle( "-fx-alignment: CENTER;");TabColDateCreation.getStyleClass().add("Center");
|
||||
TabColDateCreation.setCellValueFactory(new PropertyValueFactory<DevisCltListe, String>("DateCreation"));
|
||||
|
||||
TabColDateFinValidite.setStyle( "-fx-alignment: CENTER;");TabColDateFinValidite.getStyleClass().add("Center");
|
||||
TabColDateFinValidite.setCellValueFactory(new PropertyValueFactory<DevisCltListe, String>("FinValidite"));
|
||||
|
||||
TabColDetail.setSortable(true);
|
||||
TabColDetail.setStyle( "-fx-alignment: CENTER;");TabColDetail.getStyleClass().add("Center");
|
||||
|
||||
ButtonSearchDevisClt.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchDevisClt();
|
||||
}
|
||||
});
|
||||
|
||||
anchorpane.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchDevisClt();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
GestionSearchDevisClt();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void QuiterButtonAction(ActionEvent event) throws IOException {
|
||||
anchorpane.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchDevisClt()
|
||||
{
|
||||
ProgressBarDevisClt.setVisible(true);
|
||||
|
||||
ButtonSearchDevisClt.setDisable(true);
|
||||
|
||||
ThreadSearchDevisCltRechercher = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DateCreation = "";
|
||||
if(DatePickerCreation.getValue() != null){
|
||||
DateCreation = DatePickerCreation.getValue().toString();
|
||||
}
|
||||
|
||||
// 0comptant 1facilité
|
||||
String TypeRegement = "";
|
||||
if(RadioComptant.isSelected()){
|
||||
TypeRegement = "0";
|
||||
}else if(RadioFacilite.isSelected()){
|
||||
TypeRegement = "1";
|
||||
}
|
||||
|
||||
ObservableList<DevisCltListe> ListDevisClts = new DevisDB().SearchDevisCltGestion(
|
||||
position,
|
||||
nbrligne,
|
||||
TextFieldCodeDevis.getText(),
|
||||
TextFieldCodeClient.getText(),
|
||||
TypeRegement,
|
||||
DateCreation,
|
||||
TextFieldNomPrenomClient.getText(),
|
||||
TextFieldCinClient.getText());
|
||||
|
||||
TableViewGestionDevis.setItems(ListDevisClts);
|
||||
|
||||
totalcount = new DevisDB().nbrDevisCltGestion(TextFieldCodeDevis.getText(), TextFieldCodeClient.getText(), TypeRegement, DateCreation, TextFieldNomPrenomClient.getText(), TextFieldCinClient.getText());
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchDevisCltRechercher.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarDevisClt.setVisible(false);
|
||||
ButtonSearchDevisClt.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchDevisCltRechercher.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchDevisClt(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarDevisClt.setVisible(true);
|
||||
|
||||
ButtonSearchDevisClt.setDisable(true);
|
||||
|
||||
ThreadSearchDevisCltRechercher = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateCreation = "";
|
||||
if(DatePickerCreation.getValue() != null){
|
||||
DateCreation = DatePickerCreation.getValue().toString();
|
||||
}
|
||||
|
||||
// 0comptant 1facilité
|
||||
String TypeRegement = "";
|
||||
if(RadioComptant.isSelected()){
|
||||
TypeRegement = "0";
|
||||
}else if(RadioFacilite.isSelected()){
|
||||
TypeRegement = "1";
|
||||
}
|
||||
|
||||
ObservableList<DevisCltListe> ListDevisClts = new DevisDB().SearchDevisCltGestion(ParmPosition, ParamNbrligne, TextFieldCodeDevis.getText(), TextFieldCodeClient.getText(), TypeRegement, DateCreation, TextFieldNomPrenomClient.getText(), TextFieldCinClient.getText());
|
||||
|
||||
TableViewGestionDevis.setItems(ListDevisClts);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchDevisCltRechercher.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarDevisClt.setVisible(false);
|
||||
ButtonSearchDevisClt.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchDevisCltRechercher.start();
|
||||
}
|
||||
|
||||
private void GestionSearchDevisClt()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchDevisClt(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchDevisClt(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchDevisClt(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchDevisClt(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchDevisClt(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
118
src/main/java/Controllers/DevisClt/ListProduitDevis.java
Normal file
118
src/main/java/Controllers/DevisClt/ListProduitDevis.java
Normal file
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.DevisClt;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class ListProduitDevis {
|
||||
|
||||
|
||||
private final SimpleStringProperty reference;
|
||||
private final SimpleStringProperty designaton;
|
||||
private final SimpleStringProperty quantite;
|
||||
private final SimpleStringProperty PrixHT;
|
||||
private final SimpleStringProperty Remise;
|
||||
private final SimpleStringProperty TotalHT;
|
||||
private final SimpleStringProperty TVA;
|
||||
private final SimpleStringProperty TotalTTC;
|
||||
|
||||
public ListProduitDevis(String reference, String designaton, String quantite, String PrixHT, String Remise, String TotalHT, String TVA, String TotalTTC) {
|
||||
|
||||
if(!reference.isEmpty()){
|
||||
|
||||
float remise = Adaptateur.ArrondStringToFloat(Remise.replace("%", "")) ;
|
||||
float prixht = Adaptateur.ArrondStringToFloat(PrixHT) ;
|
||||
float tva = Adaptateur.StringToFloat(TVA) ;
|
||||
float qte = Adaptateur.StringToFloat(quantite) ;
|
||||
float totalht = (prixht - ((prixht * remise)/100))* qte ;
|
||||
float totalttc = totalht + ((totalht * tva)/100) ;
|
||||
if(!Remise.contains("%")){ Remise=Remise+"%"; }
|
||||
if(!TVA.contains("%")){ TVA=TVA+"%"; }
|
||||
TotalHT = Adaptateur.ArrondFloatToString(totalht);
|
||||
TotalTTC= Adaptateur.ArrondFloatToString(totalttc);
|
||||
}
|
||||
|
||||
|
||||
this.reference = new SimpleStringProperty(reference);
|
||||
this.designaton = new SimpleStringProperty(designaton);
|
||||
this.quantite = new SimpleStringProperty(quantite);
|
||||
this.PrixHT = new SimpleStringProperty(PrixHT);
|
||||
this.Remise = new SimpleStringProperty(Remise);
|
||||
this.TotalHT = new SimpleStringProperty(TotalHT);
|
||||
this.TVA = new SimpleStringProperty(TVA);
|
||||
this.TotalTTC = new SimpleStringProperty(TotalTTC);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getReference() {
|
||||
return reference.get();
|
||||
}
|
||||
|
||||
public void setReference(String Reference) {
|
||||
reference.set(Reference);
|
||||
}
|
||||
|
||||
public String getDesignaton() {
|
||||
return designaton.get();
|
||||
}
|
||||
|
||||
public void setDesignaton(String Designaton) {
|
||||
designaton.set(Designaton);
|
||||
}
|
||||
|
||||
public String getQuantite() {
|
||||
return quantite.get();
|
||||
}
|
||||
public void setQuantite(String Quantite) {
|
||||
quantite.set(Quantite);
|
||||
}
|
||||
|
||||
public String getPrixHT() {
|
||||
return PrixHT.get();
|
||||
|
||||
}
|
||||
public void setPrixHT(String prixHT) {
|
||||
PrixHT.set(prixHT);
|
||||
}
|
||||
|
||||
public String getRemise() {
|
||||
return Remise.get();
|
||||
}
|
||||
public void setRemise(String remise) {
|
||||
Remise.set(remise);
|
||||
}
|
||||
|
||||
public String getTotalHT() {
|
||||
return TotalHT.get();
|
||||
|
||||
}
|
||||
public void setTotalHT(String totalHT) {
|
||||
TotalHT.set(totalHT);
|
||||
}
|
||||
|
||||
public String getTVA() {
|
||||
return TVA.get();
|
||||
|
||||
}
|
||||
public void setTVA(String tva) {
|
||||
TVA.set(tva);
|
||||
}
|
||||
|
||||
public String getTotalTTC() {
|
||||
return TotalTTC.get();
|
||||
}
|
||||
|
||||
public void setTotalTTC(String totalTTC) {
|
||||
TotalTTC.set(totalTTC);
|
||||
}
|
||||
|
||||
}
|
||||
83
src/main/java/Controllers/Dialog/Dialog.java
Normal file
83
src/main/java/Controllers/Dialog/Dialog.java
Normal file
@@ -0,0 +1,83 @@
|
||||
|
||||
package Controllers.Dialog;
|
||||
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import java.io.IOException;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class Dialog {
|
||||
|
||||
Logger logger = Logger.getLogger(Dialog.class.getName());
|
||||
|
||||
public double Height = MyWindow.myStage.getHeight() ;
|
||||
public double Width = MyWindow.myStage.getWidth() ;
|
||||
|
||||
@FXML public Text Titre;
|
||||
@FXML public Text Message;
|
||||
@FXML public Button Valider;
|
||||
@FXML public Button Annuler;
|
||||
@FXML public AnchorPane PaneDialog;
|
||||
|
||||
|
||||
public Node DialogNotification() throws IOException{
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Dialog/DialogNotification.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
Node node = (Node)fxmlLoader.load();
|
||||
return node;
|
||||
}
|
||||
|
||||
public Node DialogAlert() {
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Dialog/DialogAlert.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
Node node;
|
||||
node = (Node)fxmlLoader.load();
|
||||
return node;
|
||||
} catch (IOException ex) {
|
||||
logger.error("Dialog : DialogAlert.fxml :" + ex.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void DefaultAnnuler(){
|
||||
Annuler.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
PaneDialog.setVisible(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void Show(Node node)
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(node);
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package Controllers.Dialog;
|
||||
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import java.io.IOException;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class DialogSuccessController {
|
||||
|
||||
Logger logger = Logger.getLogger(DialogSuccessController.class.getName());
|
||||
|
||||
public Node nodeFxml ;
|
||||
|
||||
@FXML public Button Valider;
|
||||
@FXML public Text Message;
|
||||
@FXML public AnchorPane PaneDialog;
|
||||
|
||||
|
||||
public DialogSuccessController() {
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Dialog/DialogSuccess.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
nodeFxml = (Node) fxmlLoader.load();
|
||||
} catch (IOException ex) {
|
||||
logger.error("DialogSuccessController : DialogSuccess.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Show()
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(nodeFxml);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
}
|
||||
123
src/main/java/Controllers/Dialog/MessageControle.java
Normal file
123
src/main/java/Controllers/Dialog/MessageControle.java
Normal file
@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.Dialog;
|
||||
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.text.TextFlow;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Maher
|
||||
*/
|
||||
public class MessageControle {
|
||||
|
||||
public double Height = MyWindow.myStage.getHeight() ;
|
||||
public double Width = MyWindow.myStage.getWidth() ;
|
||||
public Button bouttonNo = new Button();
|
||||
public Button bouttonOK = new Button();
|
||||
public Text titre = new Text();
|
||||
public TextFlow DetailMSG = new TextFlow();
|
||||
public Text titreMSG = new Text();
|
||||
public Text detail = new Text();
|
||||
public StackPane stackpane = new StackPane();
|
||||
|
||||
|
||||
public Node Setnotification(){
|
||||
|
||||
|
||||
Group group = new Group();
|
||||
|
||||
AnchorPane Ap = new AnchorPane();
|
||||
Ap.setStyle("-fx-background-color: rgba(0,0,0,0.6);");
|
||||
|
||||
Pane pa1 = new Pane();
|
||||
pa1.setStyle("-fx-background-color:#ffffff; -fx-border-color: #212121; -fx-border-radius: 10 10 0 0; -fx-background-radius: 10 10 0 0;");
|
||||
pa1.setPrefHeight(200);
|
||||
pa1.setPrefWidth(497);
|
||||
|
||||
Pane pa2 = new Pane();
|
||||
pa2.setStyle("-fx-background-color:linear-gradient(to bottom, #585858, #333333); -fx-background-radius: 10 10 0 0;");
|
||||
pa2.setPrefHeight(30);
|
||||
pa2.setPrefWidth(497);
|
||||
|
||||
Pane pa3 = new Pane();
|
||||
pa3.setStyle("-fx-background-color:linear-gradient(to bottom, #E2E2E2, #EDEDED); -fx-border-color: #B4B4B4;");
|
||||
pa3.setLayoutY(30);
|
||||
pa3.setPrefHeight(100);
|
||||
pa3.setPrefWidth(497);
|
||||
|
||||
titre.setText("Alert Dialog");
|
||||
titre.setFont(Font.font("System", FontWeight.BOLD, 13));
|
||||
titre.setFill(Color.web("#ffffff"));
|
||||
titre.setLayoutX(17);
|
||||
titre.setLayoutY(22);
|
||||
|
||||
Image imgicon = new Image(getClass().getResourceAsStream("/Public/icon/iconalert.png"));
|
||||
ImageView icon = new ImageView(imgicon);
|
||||
icon.setLayoutX(410);
|
||||
icon.setLayoutY(50);
|
||||
icon.setFitWidth(64);
|
||||
icon.setFitHeight(64);
|
||||
|
||||
|
||||
DetailMSG.setPrefHeight(120);
|
||||
DetailMSG.setPrefWidth(400);
|
||||
DetailMSG.setLayoutX(20);
|
||||
DetailMSG.setLayoutY(60);
|
||||
|
||||
|
||||
bouttonOK.setText("Ok");
|
||||
bouttonOK.setFont(Font.font ("System", FontWeight.BOLD, 12));
|
||||
bouttonOK.setPrefWidth(73);
|
||||
bouttonOK.setPrefHeight(30);
|
||||
bouttonOK.setLayoutX(210);
|
||||
bouttonOK.setLayoutY(150);
|
||||
|
||||
group.getChildren().addAll(pa1, pa2, pa3, titre, icon, DetailMSG, bouttonOK);
|
||||
|
||||
stackpane.setVisible(true);
|
||||
stackpane.getChildren().add(Ap);
|
||||
stackpane.getChildren().add(group);
|
||||
|
||||
return stackpane;
|
||||
|
||||
}
|
||||
|
||||
public void ShowNotification()
|
||||
{
|
||||
Node node = this.Setnotification();
|
||||
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(node);
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
}
|
||||
125
src/main/java/Controllers/Dialog/Notification.java
Normal file
125
src/main/java/Controllers/Dialog/Notification.java
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.Dialog;
|
||||
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.text.TextFlow;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class Notification {
|
||||
public double Height = MyWindow.myStage.getHeight() ;
|
||||
public double Width = MyWindow.myStage.getWidth() ;
|
||||
public Button bouttonNo = new Button();
|
||||
public Button bouttonOK = new Button();
|
||||
public Text titre = new Text();
|
||||
public TextFlow DetailMSG = new TextFlow();
|
||||
public Text titreMSG = new Text();
|
||||
public Text detail = new Text();
|
||||
public StackPane stackpane = new StackPane();
|
||||
|
||||
|
||||
|
||||
public Node Setnotification(){
|
||||
|
||||
Group group = new Group();
|
||||
|
||||
AnchorPane Ap = new AnchorPane();
|
||||
Ap.setStyle("-fx-background-color: rgba(0,0,0,0.6);");
|
||||
|
||||
Pane pa1 = new Pane();
|
||||
pa1.setStyle("-fx-background-color:#ffffff; -fx-border-color: #212121; -fx-border-radius: 10 10 0 0; -fx-background-radius: 10 10 0 0;");
|
||||
pa1.setPrefHeight(200);
|
||||
pa1.setPrefWidth(497);
|
||||
|
||||
Pane pa2 = new Pane();
|
||||
pa2.setStyle("-fx-background-color:linear-gradient(to bottom, #585858, #333333); -fx-background-radius: 10 10 0 0;");
|
||||
pa2.setPrefHeight(30);
|
||||
pa2.setPrefWidth(497);
|
||||
|
||||
titre.setText("Dialog de notification");
|
||||
titre.setFont(Font.font("System", FontWeight.BOLD, 13));
|
||||
titre.setFill(Color.web("#ffffff"));
|
||||
titre.setLayoutX(17);
|
||||
titre.setLayoutY(22);
|
||||
|
||||
Image imgicon = new Image(getClass().getResourceAsStream("/Public/icon/dialoginform.png"));
|
||||
ImageView icon = new ImageView(imgicon);
|
||||
icon.setLayoutX(20);
|
||||
icon.setLayoutY(60);
|
||||
icon.setFitWidth(46);
|
||||
icon.setFitHeight(50);
|
||||
|
||||
DetailMSG.setPrefHeight(120);
|
||||
DetailMSG.setPrefWidth(400);
|
||||
DetailMSG.setLayoutX(80);
|
||||
DetailMSG.setLayoutY(55);
|
||||
|
||||
bouttonOK.setText("Valider");
|
||||
bouttonOK.setFont(Font.font ("System", FontWeight.BOLD, 12));
|
||||
bouttonOK.setStyle("{-fx-background-color:#EFEFEF; -fx-border-color: #959595; -fx-border-radius: 5 5 5 5;} hover:{-fx-background-color:#E6E6E6;}");
|
||||
bouttonOK.setPrefWidth(73);
|
||||
bouttonOK.setPrefHeight(30);
|
||||
bouttonOK.setLayoutX(320);
|
||||
bouttonOK.setLayoutY(160);
|
||||
|
||||
bouttonNo.setText("Annuler");
|
||||
bouttonNo.setFont(Font.font ("System", FontWeight.BOLD, 12));
|
||||
bouttonNo.setStyle("{-fx-background-color:#EFEFEF; -fx-border-color: #959595; -fx-border-radius: 5 5 5 5;} hover:{-fx-background-color:#E6E6E6;}");
|
||||
bouttonNo.setPrefWidth(73);
|
||||
bouttonNo.setPrefHeight(30);
|
||||
bouttonNo.setLayoutX(410);
|
||||
bouttonNo.setLayoutY(160);
|
||||
bouttonNo.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
group.getChildren().addAll(pa1, pa2, titre, icon, DetailMSG, bouttonOK, bouttonNo);
|
||||
|
||||
stackpane.setVisible(true);
|
||||
stackpane.getChildren().add(Ap);
|
||||
stackpane.getChildren().add(group);
|
||||
|
||||
return stackpane;
|
||||
}
|
||||
|
||||
public void ShowNotification()
|
||||
{
|
||||
Node node = this.Setnotification();
|
||||
|
||||
StackPane Sp = new StackPane();
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(node);
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
}
|
||||
306
src/main/java/Controllers/Dialog/ShowDialog.java
Normal file
306
src/main/java/Controllers/Dialog/ShowDialog.java
Normal file
@@ -0,0 +1,306 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.Dialog;
|
||||
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.text.TextFlow;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Maher
|
||||
*/
|
||||
public class ShowDialog{
|
||||
|
||||
public static String titre ;
|
||||
public static String detail ;
|
||||
|
||||
public static String getTitre() {
|
||||
return titre;
|
||||
}
|
||||
|
||||
public static String getDetail() {
|
||||
return detail;
|
||||
}
|
||||
|
||||
public static void setTitre(String titre) {
|
||||
ShowDialog.titre = titre;
|
||||
}
|
||||
|
||||
public static void setDetail(String detail) {
|
||||
ShowDialog.detail = detail;
|
||||
}
|
||||
|
||||
|
||||
public Node DialogAlert(String MsgTitre, String MsgDetail){
|
||||
|
||||
final StackPane stackpane = new StackPane();
|
||||
Group group = new Group();
|
||||
|
||||
AnchorPane Ap = new AnchorPane();
|
||||
Ap.setStyle("-fx-background-color: rgba(0,0,0,0.6);");
|
||||
Ap.addEventFilter(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
|
||||
@Override
|
||||
public void handle(MouseEvent mouseEvent) {
|
||||
System.out.println("mouse click detected! ");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Pane pa1 = new Pane();
|
||||
pa1.setStyle("-fx-background-color:#ffffff; -fx-border-color: #212121; -fx-border-radius: 10 10 0 0; -fx-background-radius: 10 10 0 0;");
|
||||
pa1.setPrefHeight(231);
|
||||
pa1.setPrefWidth(497);
|
||||
|
||||
Pane pa2 = new Pane();
|
||||
pa2.setStyle("-fx-background-color:linear-gradient(to bottom, #585858, #333333); -fx-background-radius: 10 10 0 0;");
|
||||
pa2.setPrefHeight(36);
|
||||
pa2.setPrefWidth(497);
|
||||
|
||||
Text titre = new Text();
|
||||
titre.setText("Exception Dialog");
|
||||
titre.setFont(Font.font("System", FontWeight.BOLD, 13));
|
||||
titre.setFill(Color.web("#ffffff"));
|
||||
titre.setLayoutX(17);
|
||||
titre.setLayoutY(22);
|
||||
|
||||
Pane pa3 = new Pane();
|
||||
pa3.setStyle("-fx-background-color:linear-gradient(to bottom, #E2E2E2, #EDEDED); -fx-border-color: #B4B4B4;");
|
||||
pa3.setLayoutY(36);
|
||||
pa3.setPrefHeight(48);
|
||||
pa3.setPrefWidth(497);
|
||||
|
||||
//Image imgicon = new Image(getClass().getResourceAsStream("/Public/icon/dialoginform.png"));
|
||||
//ImageView icon = new ImageView(imgicon);
|
||||
Image image = new Image(getClass().getResourceAsStream("/Public/icon/dialog_error.png"));
|
||||
ImageView icon = new ImageView(image);
|
||||
icon.setLayoutX(440);
|
||||
icon.setLayoutY(40);
|
||||
icon.setFitWidth(38);
|
||||
icon.setFitHeight(38);
|
||||
|
||||
Text titreMSG = new Text();
|
||||
titreMSG.setText(MsgTitre);
|
||||
titreMSG.setFont(Font.font("System", FontWeight.NORMAL, 13));
|
||||
titreMSG.setFill(Color.web("#000000"));
|
||||
titreMSG.setLayoutX(27);
|
||||
titreMSG.setLayoutY(65);
|
||||
|
||||
Text detail = new Text();
|
||||
detail.setText(MsgDetail);
|
||||
detail.setFont(Font.font("System", FontWeight.NORMAL, 12));
|
||||
detail.setFill(Color.web("#000000"));
|
||||
TextFlow DetailMSG = new TextFlow(detail);
|
||||
DetailMSG.setPrefHeight(92);
|
||||
DetailMSG.setPrefWidth(344);
|
||||
DetailMSG.setLayoutX(28);
|
||||
DetailMSG.setLayoutY(95);
|
||||
|
||||
|
||||
Button boutton = new Button();
|
||||
boutton.setText("Valider");
|
||||
boutton.setFont(Font.font ("System", FontWeight.BOLD, 12));
|
||||
boutton.setStyle("{-fx-background-color:#EFEFEF; -fx-border-color: #959595; -fx-border-radius: 5 5 5 5;} hover:{-fx-background-color:#E6E6E6;}");
|
||||
boutton.setPrefWidth(84);
|
||||
boutton.setPrefHeight(31);
|
||||
boutton.setLayoutX(388);
|
||||
boutton.setLayoutY(186);
|
||||
boutton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
group.getChildren().addAll(pa1, pa2, titre, pa3, titreMSG, icon, DetailMSG, boutton);
|
||||
|
||||
|
||||
|
||||
|
||||
stackpane.getChildren().add(Ap);
|
||||
stackpane.getChildren().add(group);
|
||||
|
||||
|
||||
|
||||
|
||||
return stackpane ;
|
||||
}
|
||||
|
||||
|
||||
public Node DialogNotification(String MsgTitre, String MsgDetail){
|
||||
|
||||
final StackPane stackpane = new StackPane();
|
||||
Group group = new Group();
|
||||
|
||||
AnchorPane Ap = new AnchorPane();
|
||||
Ap.setStyle("-fx-background-color: rgba(0,0,0,0.6);");
|
||||
Ap.addEventFilter(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() {
|
||||
@Override
|
||||
public void handle(MouseEvent mouseEvent) {
|
||||
System.out.println("mouse click detected! ");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Pane pa1 = new Pane();
|
||||
pa1.setStyle("-fx-background-color:#ffffff; -fx-border-color: #212121; -fx-border-radius: 10 10 0 0; -fx-background-radius: 10 10 0 0;");
|
||||
pa1.setPrefHeight(231);
|
||||
pa1.setPrefWidth(497);
|
||||
|
||||
Pane pa2 = new Pane();
|
||||
pa2.setStyle("-fx-background-color:linear-gradient(to bottom, #585858, #333333); -fx-background-radius: 10 10 0 0;");
|
||||
pa2.setPrefHeight(36);
|
||||
pa2.setPrefWidth(497);
|
||||
|
||||
Text titre = new Text();
|
||||
titre.setText("Dialog de notification");
|
||||
titre.setFont(Font.font("System", FontWeight.BOLD, 13));
|
||||
titre.setFill(Color.web("#ffffff"));
|
||||
titre.setLayoutX(17);
|
||||
titre.setLayoutY(22);
|
||||
|
||||
Pane pa3 = new Pane();
|
||||
pa3.setStyle("-fx-background-color:linear-gradient(to bottom, #E2E2E2, #EDEDED); -fx-border-color: #B4B4B4;");
|
||||
pa3.setLayoutY(36);
|
||||
pa3.setPrefHeight(48);
|
||||
pa3.setPrefWidth(497);
|
||||
|
||||
Image image = new Image(getClass().getResourceAsStream("/Public/icon/dialog_notification.png"));
|
||||
ImageView icon = new ImageView(image);
|
||||
icon.setLayoutX(440);
|
||||
icon.setLayoutY(40);
|
||||
icon.setFitWidth(40);
|
||||
icon.setFitHeight(40);
|
||||
|
||||
Text titreMSG = new Text();
|
||||
titreMSG.setText(MsgTitre);
|
||||
titreMSG.setFont(Font.font("System", FontWeight.NORMAL, 16));
|
||||
titreMSG.setFill(Color.web("#000000"));
|
||||
titreMSG.setLayoutX(27);
|
||||
titreMSG.setLayoutY(65);
|
||||
|
||||
Text detail = new Text();
|
||||
detail.setText(MsgDetail);
|
||||
detail.setFont(Font.font("System", FontWeight.NORMAL, 15));
|
||||
detail.setFill(Color.web("#000000"));
|
||||
TextFlow DetailMSG = new TextFlow(detail);
|
||||
DetailMSG.setPrefHeight(92);
|
||||
DetailMSG.setPrefWidth(344);
|
||||
DetailMSG.setLayoutX(28);
|
||||
DetailMSG.setLayoutY(95);
|
||||
|
||||
|
||||
|
||||
Button bouttonOK = new Button();
|
||||
bouttonOK.setText("Valider");
|
||||
bouttonOK.setFont(Font.font ("System", FontWeight.BOLD, 12));
|
||||
bouttonOK.setStyle("{-fx-background-color:#EFEFEF; -fx-border-color: #959595; -fx-border-radius: 5 5 5 5;} hover:{-fx-background-color:#E6E6E6;}");
|
||||
bouttonOK.setPrefWidth(73);
|
||||
bouttonOK.setPrefHeight(28);
|
||||
bouttonOK.setLayoutX(300);
|
||||
bouttonOK.setLayoutY(186);
|
||||
bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Button bouttonNo = new Button();
|
||||
bouttonNo.setText("Annuler");
|
||||
bouttonNo.setFont(Font.font ("System", FontWeight.BOLD, 12));
|
||||
bouttonNo.setStyle("{-fx-background-color:#EFEFEF; -fx-border-color: #959595; -fx-border-radius: 5 5 5 5;} hover:{-fx-background-color:#E6E6E6;}");
|
||||
bouttonNo.setPrefWidth(73);
|
||||
bouttonNo.setPrefHeight(28);
|
||||
bouttonNo.setLayoutX(400);
|
||||
bouttonNo.setLayoutY(186);
|
||||
bouttonNo.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
group.getChildren().addAll(pa1, pa2, titre, pa3, titreMSG, icon, DetailMSG, bouttonOK, bouttonNo);
|
||||
|
||||
|
||||
|
||||
|
||||
stackpane.getChildren().add(Ap);
|
||||
stackpane.getChildren().add(group);
|
||||
|
||||
|
||||
|
||||
|
||||
return stackpane ;
|
||||
}
|
||||
|
||||
public void ShowAletDialog()
|
||||
{
|
||||
Node node = DialogAlert(titre, detail);
|
||||
|
||||
StackPane Sp = new StackPane();
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(node);
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
Stage stage = MyWindow.myStage;
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void ShowNotificationDialog(String Titre, String Detail)
|
||||
{
|
||||
Node node = DialogNotification(Titre, Detail);
|
||||
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(node);
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
Stage stage = MyWindow.myStage;
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
public void Show(Node node)
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(node);
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,416 @@
|
||||
package Controllers.FactureClt;
|
||||
|
||||
import Models.CommandeClt.CommandeCltDB;
|
||||
import Models.CommandeClt.CommandeCltListe;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class FactureCltAjouterController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(FactureCltAjouterController.class.getName());
|
||||
|
||||
@FXML private AnchorPane PaneFactCltAjouter ;
|
||||
|
||||
@FXML private ProgressBar ProgressBarFactureCltCommande;
|
||||
|
||||
@FXML private Button ButtonSearchFactureCltCommande ;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0 ;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
@FXML public TableView<CommandeCltListe> TableViewGestionCommande;
|
||||
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColCodeCommande;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColModePaiement;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColTypeClient;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColCodeClient;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColTotalCommande;
|
||||
@FXML public TableColumn<CommandeCltListe ,String> TabColDateCreation ;
|
||||
@FXML public TableColumn<CommandeCltListe ,Boolean>TabColAction ;
|
||||
|
||||
@FXML public TextField TextFieldCodeCommande;
|
||||
@FXML public TextField TextFieldCodeClient;
|
||||
@FXML public TextField TextFieldNameClient;
|
||||
@FXML public TextField TextFieldCodeDevis;
|
||||
@FXML public DatePicker DatePickerCreation;
|
||||
@FXML public RadioButton RadioComptant;
|
||||
@FXML public RadioButton RadioFacilite;
|
||||
|
||||
private Service<Void> ThreadSearchFactureCltCommande;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
//comboboxnombre des lignes tableview
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
TableViewGestionCommande.setEditable(true);
|
||||
|
||||
TabColCodeCommande.setStyle( "-fx-alignment: CENTER;");TabColCodeCommande.getStyleClass().add("Center");
|
||||
TabColCodeCommande.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("CodeCommande"));
|
||||
|
||||
TabColTypeClient.setStyle( "-fx-alignment: CENTER;");TabColTypeClient.getStyleClass().add("Center");
|
||||
TabColTypeClient.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("TypeClient"));
|
||||
|
||||
TabColCodeClient.setStyle( "-fx-alignment: CENTER;");TabColCodeClient.getStyleClass().add("Center");
|
||||
TabColCodeClient.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("CodeClient"));
|
||||
|
||||
TabColModePaiement.setStyle( "-fx-alignment: CENTER;");TabColModePaiement.getStyleClass().add("Center");
|
||||
TabColModePaiement.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("ModePaiement"));
|
||||
|
||||
TabColTotalCommande.setStyle( "-fx-alignment: CENTER;");TabColTotalCommande.getStyleClass().add("Center");
|
||||
TabColTotalCommande.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("TotalCommande"));
|
||||
|
||||
TabColDateCreation.setStyle( "-fx-alignment: CENTER;");TabColDateCreation.getStyleClass().add("Center");
|
||||
TabColDateCreation.setCellValueFactory(new PropertyValueFactory<CommandeCltListe, String>("DateCreation"));
|
||||
|
||||
TabColAction.setSortable(true);
|
||||
TabColAction.setStyle( "-fx-alignment: CENTER;");TabColAction.getStyleClass().add("Center");
|
||||
TabColAction.setCellFactory(new Callback<TableColumn<CommandeCltListe, Boolean>, TableCell<CommandeCltListe, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<CommandeCltListe, Boolean> call(TableColumn<CommandeCltListe, Boolean> personBooleanTableColumn) {
|
||||
return new ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
ButtonSearchFactureCltCommande.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchFactureCltCommande();
|
||||
}
|
||||
});
|
||||
|
||||
PaneFactCltAjouter.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchFactureCltCommande();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
RadioComptant.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchFactureCltCommande();
|
||||
}
|
||||
});
|
||||
|
||||
RadioFacilite.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchFactureCltCommande();
|
||||
}
|
||||
});
|
||||
|
||||
GestionSearchFactureCltCommande();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Define the button cell
|
||||
private class ButtonCell extends TableCell<CommandeCltListe, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconedit.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){ //Action when the button is pressed
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
try {
|
||||
// get Selected Item
|
||||
CommandeCltListe current = (CommandeCltListe) ButtonCell.this.getTableView().getItems().get(ButtonCell.this.getIndex());
|
||||
String codeCommande = current.getCodeCommande();
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureClt/FactureCltAjouterDetailSelect.fxml"));
|
||||
Parent NodeDetailSelect = (Parent)fxmlLoader.load();
|
||||
FactureCltAjouterDetailSelectController FactureCltAjouterDetailSelect = fxmlLoader.getController();
|
||||
FactureCltAjouterDetailSelect.setDataCommande(codeCommande);
|
||||
PaneFactCltAjouter.getChildren().clear();
|
||||
PaneFactCltAjouter.getChildren().add(NodeDetailSelect);
|
||||
} catch (IOException ex) {
|
||||
logger.error("FactureCltAjouterController : FactureCltAjouterDetailSelect.fxml :" + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchFactureCltCommande()
|
||||
{
|
||||
ProgressBarFactureCltCommande.setVisible(true);
|
||||
|
||||
ButtonSearchFactureCltCommande.setDisable(true);
|
||||
|
||||
ThreadSearchFactureCltCommande = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DateCreation = "";
|
||||
if(DatePickerCreation.getValue() != null){
|
||||
DateCreation = DatePickerCreation.getValue().toString();
|
||||
}
|
||||
|
||||
// 0comptant 1facilité
|
||||
String TypeRegement = "";
|
||||
if(RadioComptant.isSelected()){
|
||||
TypeRegement = "0";
|
||||
}else if(RadioFacilite.isSelected()){
|
||||
TypeRegement = "1";
|
||||
}
|
||||
|
||||
ObservableList<CommandeCltListe> ListFactureCltCommandes = new CommandeCltDB().SearchCommande(
|
||||
position,
|
||||
nbrligne,
|
||||
TypeRegement,
|
||||
TextFieldCodeCommande.getText(),
|
||||
TextFieldCodeClient.getText(),
|
||||
TextFieldNameClient.getText(),
|
||||
TextFieldCodeDevis.getText(),
|
||||
DateCreation);
|
||||
|
||||
TableViewGestionCommande.setItems(ListFactureCltCommandes);
|
||||
|
||||
totalcount = new CommandeCltDB().nbrSearchCommande(TypeRegement, TextFieldCodeCommande.getText(), TextFieldCodeClient.getText(), TextFieldNameClient.getText(), TextFieldCodeDevis.getText(), DateCreation);
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchFactureCltCommande.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarFactureCltCommande.setVisible(false);
|
||||
ButtonSearchFactureCltCommande.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchFactureCltCommande.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchFactureCltCommande(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarFactureCltCommande.setVisible(true);
|
||||
|
||||
ButtonSearchFactureCltCommande.setDisable(true);
|
||||
|
||||
ThreadSearchFactureCltCommande = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateCreation = "";
|
||||
if(DatePickerCreation.getValue() != null){
|
||||
DateCreation = DatePickerCreation.getValue().toString();
|
||||
}
|
||||
|
||||
// 0comptant 1facilité
|
||||
String TypeRegement = "";
|
||||
if(RadioComptant.isSelected()){
|
||||
TypeRegement = "0";
|
||||
}else if(RadioFacilite.isSelected()){
|
||||
TypeRegement = "1";
|
||||
}
|
||||
|
||||
ObservableList<CommandeCltListe> ListFactureCltCommandes = new CommandeCltDB().SearchCommande(ParmPosition, ParamNbrligne, TypeRegement, TextFieldCodeCommande.getText(), TextFieldCodeClient.getText(), TextFieldNameClient.getText(), TextFieldCodeDevis.getText(), DateCreation);
|
||||
|
||||
TableViewGestionCommande.setItems(ListFactureCltCommandes);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchFactureCltCommande.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarFactureCltCommande.setVisible(false);
|
||||
ButtonSearchFactureCltCommande.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchFactureCltCommande.start();
|
||||
}
|
||||
|
||||
private void GestionSearchFactureCltCommande()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchFactureCltCommande(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchFactureCltCommande(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchFactureCltCommande(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchFactureCltCommande(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchFactureCltCommande(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package Controllers.FactureClt;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Models.Produit.ListeProduit;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Models.CommandeClt.CommandeClt;
|
||||
import Models.CommandeClt.CommandeCltDB;
|
||||
import Models.FactureClt.FactureClt;
|
||||
import Models.User.User;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class FactureCltAjouterDetailSelectController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneFactAddDetailSelect ;
|
||||
|
||||
private String TypeRegement;
|
||||
public CommandeClt Commande;
|
||||
public FactureClt Facture = new FactureClt();
|
||||
@FXML private Text InfoCltNom ;
|
||||
@FXML private Text InfoCltPrenom ;
|
||||
@FXML private Text InfoCltAdress ;
|
||||
@FXML private Text InfoCommCode ;
|
||||
@FXML private Text InfoCommDateCreation ;
|
||||
@FXML private Text InfoCommTypeReglement ;
|
||||
@FXML private Text InfoCommTotalTVA ;
|
||||
@FXML private Text InfoCommRemise ;
|
||||
@FXML private Text InfoCommTotalHTNet ;
|
||||
@FXML private Text InfoCommNetAPayer ;
|
||||
@FXML private Text TextPrenomMatricule;
|
||||
|
||||
@FXML private TableView<ListeProduit> TableViewListeProduitCommClt ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColReference;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDesignaton;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColQuantite ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColPrixHT;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColRemise;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTotalHT;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTVA;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTotalTTC;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TableViewListeProduitCommClt.setEditable(false);
|
||||
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColDesignaton.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColRemise.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColRemise.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColRemise.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTotalTTC.getStyleClass().add("Center");
|
||||
|
||||
}
|
||||
|
||||
public void setDataCommande(String CodeCommande){
|
||||
CommandeCltDB CommandeDB = new CommandeCltDB();
|
||||
Commande = CommandeDB.getCommandeClt(CodeCommande);
|
||||
|
||||
if(Commande.getTypeClient()==0){
|
||||
InfoCltNom.setText(Commande.CltPersonne.getNom());
|
||||
InfoCltPrenom.setText(Commande.CltPersonne.getPrenom());
|
||||
InfoCltAdress.setText(Commande.CltPersonne.getAdresse());
|
||||
}
|
||||
|
||||
if(Commande.getTypeClient()==1){
|
||||
InfoCltNom.setText(Commande.CltEntreprise.getNom());
|
||||
InfoCltPrenom.setText(Commande.CltEntreprise.getMatricule());
|
||||
InfoCltAdress.setText(Commande.CltEntreprise.getAdresse());
|
||||
TextPrenomMatricule.setText("Matricule");
|
||||
}
|
||||
|
||||
if(Commande.getTypeClient()==2){
|
||||
InfoCltNom.setText(Commande.CltPassager.getNom());
|
||||
InfoCltPrenom.setText(Commande.CltPassager.getPrenom());
|
||||
InfoCltAdress.setText(Commande.CltPassager.getAdresse());
|
||||
}
|
||||
|
||||
//Adaptateur.StringToStringEspaceCurrency()
|
||||
InfoCommCode.setText(Commande.getCodecommandeclt());
|
||||
InfoCommDateCreation.setText(Adaptateur.NormalDateFormat(Commande.getDate()));
|
||||
InfoCommTypeReglement.setText(Commande.getTypeRegementString());
|
||||
TypeRegement = Commande.getTypeRegement();
|
||||
InfoCommTotalTVA.setText(Adaptateur.StringToStringEspaceCurrency(Commande.getTotalTVA()));
|
||||
InfoCommRemise.setText(Adaptateur.StringToStringEspaceCurrency(Commande.getRemise()));
|
||||
InfoCommTotalHTNet.setText(Adaptateur.StringToStringEspaceCurrency(Commande.getTotalHorsTaxNet()));
|
||||
InfoCommNetAPayer.setText(Adaptateur.StringToStringEspaceCurrency(Commande.getNetAPayer()));
|
||||
TableViewListeProduitCommClt.setItems(Commande.getListeproduit());
|
||||
this.SetDataFacture();
|
||||
}
|
||||
|
||||
public void SetDataFacture()
|
||||
{
|
||||
Facture.setIdCommandeClt(Commande.getCodecommandeclt());
|
||||
Facture.setIdBonLivraisonClt(Commande.getCodeBonLivraison());
|
||||
|
||||
Facture.setTypeClient(Commande.getTypeClient());
|
||||
|
||||
if(Commande.getTypeClient() == 0){
|
||||
Facture.setCltPersonne(Commande.getCltPersonne());
|
||||
}else if(Commande.getTypeClient() == 1){
|
||||
Facture.setCltEntreprise(Commande.getCltEntreprise());
|
||||
}else if(Commande.getTypeClient() == 2){
|
||||
Facture.setCltPassager(Commande.getCltPassager());
|
||||
}
|
||||
Facture.setDateFacture(Adaptateur.getDefaultCurrentDate("yyyy-MM-dd"));
|
||||
Facture.setTypeRegement(Commande.getTypeRegement());
|
||||
Facture.setNetAPayer(Commande.getNetAPayer());
|
||||
Facture.setTotalTVA(Commande.getTotalTVA());
|
||||
Facture.setTotalHorsTaxNet(Commande.getTotalHorsTaxNet());
|
||||
Facture.setRemise(Commande.getRemise());
|
||||
Facture.setTimbre(Commande.getTimbre());
|
||||
Facture.setDevise(Commande.getCodeDevis());
|
||||
Facture.setCodeUser(User.idprofile);
|
||||
}
|
||||
|
||||
|
||||
//Boutton Présédent
|
||||
@FXML
|
||||
private void FactureCltAjouterButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPaneFactAddDetailSelect.getChildren().clear();
|
||||
AnchorPaneFactAddDetailSelect.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/FactureClt/FactureCltAjouter.fxml")));
|
||||
}
|
||||
|
||||
//Boutton Suivant
|
||||
@FXML
|
||||
private void FactureCltPaiementButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPaneFactAddDetailSelect.getChildren().clear();
|
||||
if(TypeRegement.equals("0")){
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureClt/FactureCltAjouterPaiementComptent.fxml"));
|
||||
Parent NodeAjouterPaiementComptent = (Parent)fxmlLoader.load();
|
||||
FactureCltAjouterPaiementComptentController FactureCltAjouterPaiementComptent = fxmlLoader.getController();
|
||||
FactureCltAjouterPaiementComptent.commande = Commande;
|
||||
FactureCltAjouterPaiementComptent.TextNetaPayer.setText(Adaptateur.StringToStringEspaceCurrency(Commande.getNetAPayer()));
|
||||
AnchorPaneFactAddDetailSelect.getChildren().add(NodeAjouterPaiementComptent);
|
||||
}
|
||||
else if(TypeRegement.equals("1")){
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureClt/FactureCltAjouterPaiementFacilite.fxml"));
|
||||
Parent NodeAjouterPaiementFacilite= (Parent)fxmlLoader.load();
|
||||
FactureCltAjouterPaiementFaciliteController FactureCltAjouterPaiementFacilite= fxmlLoader.getController();
|
||||
FactureCltAjouterPaiementFacilite.commande = Commande;
|
||||
FactureCltAjouterPaiementFacilite.Facture = Facture;
|
||||
FactureCltAjouterPaiementFacilite.TextNetaPayer.setText(Adaptateur.StringToStringEspaceCurrency(Commande.getNetAPayer()));
|
||||
AnchorPaneFactAddDetailSelect.getChildren().add(NodeAjouterPaiementFacilite);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.FactureClt;
|
||||
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Models.CommandeClt.CommandeClt;
|
||||
import Models.FactureClt.FactureClt;
|
||||
import Models.ChequeClt.ChequeList;
|
||||
import Models.FactureClt.FactureCltChequeListe;
|
||||
import Models.FactureClt.FactureCltDB;
|
||||
import Models.TraiteClt.TraiteList;
|
||||
import Models.FactureClt.FactureCltTraiteListe;
|
||||
import Models.ChequeClt.ChequeClt;
|
||||
import Models.TraiteClt.TraiteClt;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
*
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class FactureCltAjouterDetailTraiteController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane PaneFactureCltAjouterDetailTraite;
|
||||
|
||||
@FXML public AnchorPane PaneTableViewTraites ;
|
||||
@FXML public AnchorPane PaneTableViewCheques;
|
||||
|
||||
@FXML public Text TextNom ;
|
||||
@FXML public Text TextPrenomMatricule;
|
||||
@FXML public Text TextPrenom ;
|
||||
@FXML public Text TextAdress ;
|
||||
|
||||
@FXML public Text TextAvance ;
|
||||
@FXML public Text TextTypeReglement ; // Traite | Cheque
|
||||
@FXML public Text TextMontantInteret ;
|
||||
|
||||
|
||||
@FXML public Text TextDetail ;
|
||||
@FXML public Text TextNbrTraite ;
|
||||
@FXML public Text TextBanque ;
|
||||
@FXML public Text Banque ;
|
||||
@FXML public Text TextMontantTraite ;
|
||||
@FXML public Text ValMontantTraite;
|
||||
@FXML public TableView<FactureCltTraiteListe> TableViewListeTraites ;
|
||||
@FXML public TableColumn<FactureCltTraiteListe ,String> TabColDateTraites;
|
||||
@FXML public TableColumn<FactureCltTraiteListe ,String> TabColMontantTraites;
|
||||
|
||||
@FXML public TableView<FactureCltChequeListe> TableViewListeCheques ;
|
||||
@FXML public TableColumn<FactureCltChequeListe ,String> TabColDateCheques;
|
||||
@FXML public TableColumn<FactureCltChequeListe ,String> TabColNumeroCheques;
|
||||
@FXML public TableColumn<FactureCltChequeListe ,String> TabColBanqueCheques;
|
||||
@FXML public TableColumn<FactureCltChequeListe ,String> TabColMontantCheques;
|
||||
|
||||
final ObservableList<FactureCltTraiteListe> dataListe = FXCollections.observableArrayList();
|
||||
final ObservableList<FactureCltChequeListe> dataListeCheque = FXCollections.observableArrayList();
|
||||
|
||||
public ObservableList<TraiteList> data_List_Traite = FXCollections.observableArrayList();
|
||||
public ObservableList<ChequeList> data_List_Cheque = FXCollections.observableArrayList();
|
||||
|
||||
public boolean TypeFacilite = true; // True Traite | False Cheque
|
||||
|
||||
public CommandeClt commande;
|
||||
public FactureClt Facture ;
|
||||
public String TextTauxInteret;
|
||||
public String Net_A_Payer;
|
||||
public String Avance ;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
TabColDateTraites.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDateTraites.getStyleClass().add("Center");
|
||||
TabColDateTraites.setCellValueFactory(new PropertyValueFactory<FactureCltTraiteListe, String>("DateTraites"));
|
||||
|
||||
TabColMontantTraites.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColMontantTraites.getStyleClass().add("Center");
|
||||
TabColMontantTraites.setCellValueFactory(new PropertyValueFactory<FactureCltTraiteListe, String>("MontantTraites"));
|
||||
|
||||
TabColDateCheques.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDateCheques.getStyleClass().add("Center");
|
||||
TabColDateCheques.setCellValueFactory(new PropertyValueFactory<FactureCltChequeListe, String>("DateCheques"));
|
||||
|
||||
TabColNumeroCheques.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColNumeroCheques.getStyleClass().add("Center");
|
||||
TabColNumeroCheques.setCellValueFactory(new PropertyValueFactory<FactureCltChequeListe, String>("NumeroCheques"));
|
||||
|
||||
TabColBanqueCheques.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColBanqueCheques.getStyleClass().add("Center");
|
||||
TabColBanqueCheques.setCellValueFactory(new PropertyValueFactory<FactureCltChequeListe, String>("BanqueCheques"));
|
||||
|
||||
TabColMontantCheques.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColMontantCheques.getStyleClass().add("Center");
|
||||
TabColMontantCheques.setCellValueFactory(new PropertyValueFactory<FactureCltChequeListe, String>("MontantCheques"));
|
||||
|
||||
|
||||
}
|
||||
public void SetDataTraiteFacilite(FactureClt facture){
|
||||
this.Facture = facture;
|
||||
TextAvance.setText(Facture.getAvance()+" "+ParametreSystem.CurrencySign);
|
||||
TextMontantInteret.setText(Facture.getMontantInteret());
|
||||
ValMontantTraite.setText(Facture.getTotalMontantTraite()+" "+ParametreSystem.CurrencySign);
|
||||
TextNbrTraite.setText(Facture.getNbrTraite());
|
||||
TextTauxInteret = Facture.getTauxInteret();
|
||||
Net_A_Payer = Facture.getNetAPayer();
|
||||
TypeFacilite = Facture.getTypeFaciliteBoolean();
|
||||
if(TypeFacilite == true){
|
||||
TextTypeReglement.setText("Traite");
|
||||
PaneTableViewCheques.setVisible(false);
|
||||
PaneTableViewTraites.setVisible(true);
|
||||
TextMontantTraite.setText("Montant Traite:");
|
||||
ArrayList<TraiteClt> ListTraites = Facture.getListeTraites();
|
||||
for(int i=0; i<ListTraites.size(); i++){
|
||||
//data_List_Traite.add(new FactureCltTraiteList(ListTraites.get(i).getMontantTraiteClt(),new Date()));
|
||||
dataListe.add(new FactureCltTraiteListe(ListTraites.get(i).getDateTraiteClt(),ListTraites.get(i).getMontantTraiteClt()+" "+ParametreSystem.CurrencySign ));
|
||||
}
|
||||
TableViewListeTraites.setItems(dataListe);
|
||||
}else if(TypeFacilite == false){
|
||||
Banque.setVisible(true);
|
||||
TextTypeReglement.setText("Cheque");
|
||||
PaneTableViewTraites.setVisible(false);
|
||||
PaneTableViewCheques.setVisible(true);
|
||||
TextMontantTraite.setText("Montant Chéques:");
|
||||
ArrayList<ChequeClt> dataListCheque = Facture.getListeCheques();
|
||||
TextBanque.setText( dataListCheque.get(0).getBanqueChequeClt());
|
||||
for(int i=0; i<dataListCheque.size(); i++){
|
||||
dataListeCheque.add(new FactureCltChequeListe( dataListCheque.get(i).getDatePaiement(),
|
||||
dataListCheque.get(i).getNumeroChequeClt(),
|
||||
dataListCheque.get(i).getBanqueChequeClt(),
|
||||
dataListCheque.get(i).getMontantChequeClt()));
|
||||
}
|
||||
TableViewListeCheques.setItems(dataListeCheque);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Boutton Présédent
|
||||
@FXML
|
||||
private void FactureCltAjouterLastButtonAction(ActionEvent event) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureClt/FactureCltAjouterPaiementFacilite.fxml"));
|
||||
Parent NodePaneFactureCltAjouterPaiementFacilite = (Parent)fxmlLoader.load();
|
||||
FactureCltAjouterPaiementFaciliteController FactureCltAjouterPaiementFacilite = fxmlLoader.getController();
|
||||
FactureCltAjouterPaiementFacilite.TextFieldAvance.setText(Avance);
|
||||
FactureCltAjouterPaiementFacilite.TextFieldNbrTraite.setText(TextNbrTraite.getText());
|
||||
FactureCltAjouterPaiementFacilite.TextFieldTauxIntere.setText(TextTauxInteret);
|
||||
FactureCltAjouterPaiementFacilite.TextMontant_Traite.setVisible(true);
|
||||
FactureCltAjouterPaiementFacilite.TextMontant_Interet.setVisible(true);
|
||||
FactureCltAjouterPaiementFacilite.TextMontantTraite.setVisible(true);
|
||||
FactureCltAjouterPaiementFacilite.TextMontantInteret.setVisible(true);
|
||||
FactureCltAjouterPaiementFacilite.TextNetaPayer.setText(TextTauxInteret);
|
||||
FactureCltAjouterPaiementFacilite.TextMontantTraite.setText(ValMontantTraite.getText());
|
||||
FactureCltAjouterPaiementFacilite.TextMontantInteret.setText(TextMontantInteret.getText());
|
||||
FactureCltAjouterPaiementFacilite.TextNetaPayer.setText(Net_A_Payer+" "+ParametreSystem.CurrencySign);
|
||||
FactureCltAjouterPaiementFacilite.commande = commande;
|
||||
if(TypeFacilite == true){
|
||||
FactureCltAjouterPaiementFacilite.TypeSelect = true;
|
||||
FactureCltAjouterPaiementFacilite.RadioTraite.setSelected(true);
|
||||
FactureCltAjouterPaiementFacilite.dataList = data_List_Traite;
|
||||
FactureCltAjouterPaiementFacilite.SetTableViewTraite();
|
||||
|
||||
}
|
||||
else if(TypeFacilite == false){
|
||||
FactureCltAjouterPaiementFacilite.TypeSelect = false;
|
||||
FactureCltAjouterPaiementFacilite.RadioCheque.setSelected(true);
|
||||
FactureCltAjouterPaiementFacilite.dataListCheque = data_List_Cheque;
|
||||
FactureCltAjouterPaiementFacilite.SetTableViewCheque();
|
||||
}
|
||||
|
||||
PaneFactureCltAjouterDetailTraite.getChildren().clear();
|
||||
PaneFactureCltAjouterDetailTraite.getChildren().add(NodePaneFactureCltAjouterPaiementFacilite);
|
||||
|
||||
}
|
||||
|
||||
//Boutton Suivant
|
||||
@FXML
|
||||
private void FactureCltSaveButtonAction(ActionEvent event) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureClt/FactureCltDetail.fxml"));
|
||||
Parent NodeFactureCltDetail = (Parent)fxmlLoader.load();
|
||||
FactureCltDetailController FactureCltDetail= fxmlLoader.getController();
|
||||
FactureCltDB FactureDB= new FactureCltDB();
|
||||
String CodeFacture = FactureDB.AddFactureClt(Facture);
|
||||
FactureCltDetail.codeFactClt = CodeFacture;
|
||||
FactureCltDetail.SowDetailFactureClt(true);
|
||||
PaneFactureCltAjouterDetailTraite.getChildren().clear();
|
||||
PaneFactureCltAjouterDetailTraite.getChildren().add(NodeFactureCltDetail);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package Controllers.FactureClt;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.Caisse.CarteBancaireClt;
|
||||
import Models.CommandeClt.CommandeClt;
|
||||
import Models.FactureClt.FactureClt;
|
||||
import Models.FactureClt.FactureCltDB;
|
||||
import Models.User.User;
|
||||
import Models.ChequeClt.ChequeClt;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Date;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class FactureCltAjouterPaiementComptentController implements Initializable {
|
||||
|
||||
@FXML public Text TextNetaPayer ;
|
||||
|
||||
@FXML private AnchorPane PaneFactureCltAjouterPaiementComptent;
|
||||
@FXML public AnchorPane PaneCheque;
|
||||
@FXML public AnchorPane PaneCarte;
|
||||
@FXML public TextField FactureCltChequeNomBanque;
|
||||
@FXML public TextField FactureCltChequeNumero;
|
||||
@FXML public TextField FactureCltChequeNomComple;
|
||||
@FXML public DatePicker FactureCltChequeDatePaiement;
|
||||
|
||||
@FXML public Text MsgCltChequeNomBanque;
|
||||
@FXML public Text MsgCltChequeNumero;
|
||||
@FXML public Text MsgCltChequeNomComple;
|
||||
@FXML public Text MsgCltChequeDatePaiement;
|
||||
|
||||
@FXML public TextField TextFieldCarteNumeroTransation;
|
||||
@FXML public TextField TextFieldCarteNomBanque;
|
||||
@FXML public TextField TextFieldCarteNumero;
|
||||
@FXML public TextField TextFieldCarteNomComplet;
|
||||
|
||||
@FXML public Text MsgCltCarteNumeroTransation;
|
||||
@FXML public Text MsgCltCarteNumeroCarte;
|
||||
|
||||
public Integer TypeSelect = 0; // 0:espace 1:Cheque 2:Carte Bancaire
|
||||
|
||||
public FactureClt Facture = new FactureClt();
|
||||
public CommandeClt commande;
|
||||
|
||||
contro clt = new contro();
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
public void RadioEspaceAction(ActionEvent event) throws IOException {
|
||||
PaneCheque.setVisible(false);
|
||||
PaneCarte.setVisible(false);
|
||||
TypeSelect = 0;
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void RadioChequeAction(ActionEvent event) throws IOException {
|
||||
PaneCarte.setVisible(false);
|
||||
PaneCheque.setVisible(true);
|
||||
TypeSelect = 1;
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void RadioCarteAction(ActionEvent event) throws IOException {
|
||||
PaneCheque.setVisible(false);
|
||||
PaneCarte.setVisible(true);
|
||||
TypeSelect = 2;
|
||||
}
|
||||
|
||||
//Boutton Suivant
|
||||
@FXML
|
||||
private void FactureCltAjouterSuivantAction(ActionEvent event) throws IOException {
|
||||
this.SetDataFacture();
|
||||
FactureCltDB FactureDB= new FactureCltDB();
|
||||
if(TypeSelect == 0){
|
||||
Facture.setModePaiement("0");
|
||||
String CodeFacture = FactureDB.AddFactureClt(Facture);
|
||||
if(CodeFacture != null){
|
||||
this.FactureCltDetail(CodeFacture);
|
||||
}
|
||||
}else if(TypeSelect == 1){
|
||||
Facture.setModePaiement("1");
|
||||
|
||||
if( clt.ContrNull(FactureCltChequeNomBanque, MsgCltChequeNomBanque) &&
|
||||
clt.ContrNumeriqueNotnull(FactureCltChequeNumero, MsgCltChequeNumero) &&
|
||||
clt.ContrNullDatePicker(FactureCltChequeDatePaiement, MsgCltChequeDatePaiement)){
|
||||
|
||||
ChequeClt Cheque = new ChequeClt();
|
||||
Cheque.setBanqueChequeClt(FactureCltChequeNomBanque.getText());
|
||||
Cheque.setNumeroChequeClt(FactureCltChequeNumero.getText());
|
||||
Cheque.setNomCompletChequeClt(FactureCltChequeNomComple.getText());
|
||||
Cheque.setDatePaiement(FactureCltChequeDatePaiement.getValue().toString());
|
||||
Cheque.setMontantChequeClt(Facture.getNetAPayer());
|
||||
Facture.setCheque(Cheque);
|
||||
|
||||
String CodeFacture = FactureDB.AddFactureClt(Facture);
|
||||
if(CodeFacture != null){
|
||||
this.FactureCltDetail(CodeFacture);
|
||||
}
|
||||
}
|
||||
}else if(TypeSelect == 2){
|
||||
Facture.setModePaiement("2");
|
||||
if( clt.ContrNull(TextFieldCarteNumeroTransation, MsgCltCarteNumeroTransation) &&
|
||||
clt.ContrNumerique(TextFieldCarteNumero, MsgCltCarteNumeroCarte) )
|
||||
{
|
||||
CarteBancaireClt CarteBancaire = new CarteBancaireClt();
|
||||
CarteBancaire.setNumeroTransation(TextFieldCarteNumeroTransation.getText());
|
||||
CarteBancaire.setNomBanque(TextFieldCarteNomBanque.getText());
|
||||
CarteBancaire.setNumeroCarte(TextFieldCarteNumero.getText());
|
||||
CarteBancaire.setNomComplet(TextFieldCarteNomComplet.getText());
|
||||
CarteBancaire.setMontant(Facture.getNetAPayer());
|
||||
CarteBancaire.setLocalNom(ParametreSystem.NomLocalPC);
|
||||
CarteBancaire.setIdProfile(User.idprofile);
|
||||
Facture.setCarteBancaire(CarteBancaire);
|
||||
String CodeFacture = FactureDB.AddFactureClt(Facture);
|
||||
if(CodeFacture != null){
|
||||
this.FactureCltDetail(CodeFacture);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//Boutton Présédent
|
||||
@FXML
|
||||
private void FactureCltAjouterButtonAction(ActionEvent event) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureClt/FactureCltAjouterDetailSelect.fxml"));
|
||||
Parent NodeFactureCltAjouterDetailSelect = (Parent)fxmlLoader.load();
|
||||
FactureCltAjouterDetailSelectController FactureCltAjouterDetailSelect = fxmlLoader.getController();
|
||||
FactureCltAjouterDetailSelect.setDataCommande(commande.getCodecommandeclt());
|
||||
PaneFactureCltAjouterPaiementComptent.getChildren().clear();
|
||||
PaneFactureCltAjouterPaiementComptent.getChildren().add(NodeFactureCltAjouterDetailSelect);
|
||||
|
||||
}
|
||||
|
||||
public void FactureCltDetail(String CodeFacture) throws IOException{
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureClt/FactureCltDetail.fxml"));
|
||||
Parent NodeFactureCltDetail = (Parent)fxmlLoader.load();
|
||||
FactureCltDetailController FactureCltDetail= fxmlLoader.getController();
|
||||
|
||||
FactureCltDetail.codeFactClt = CodeFacture;
|
||||
FactureCltDetail.SowDetailFactureClt(true);
|
||||
PaneFactureCltAjouterPaiementComptent.getChildren().clear();
|
||||
PaneFactureCltAjouterPaiementComptent.getChildren().add(NodeFactureCltDetail);
|
||||
}
|
||||
|
||||
public void SetDataFacture(){
|
||||
Facture.setIdCommandeClt(commande.getCodecommandeclt());
|
||||
Facture.setTypeClient(commande.getTypeClient());
|
||||
|
||||
if(commande.getTypeClient() == 0){
|
||||
Facture.setCltPersonne(commande.getCltPersonne());
|
||||
}else if(commande.getTypeClient() == 1){
|
||||
Facture.setCltEntreprise(commande.getCltEntreprise());
|
||||
}else if(commande.getTypeClient() == 2){
|
||||
Facture.setCltPassager(commande.getCltPassager());
|
||||
}
|
||||
Facture.setDateFacture(Adaptateur.getDefaultCurrentDate("yyyy-MM-dd"));
|
||||
Facture.setTypeRegement(commande.getTypeRegement());
|
||||
Facture.setNetAPayer(commande.getNetAPayer());
|
||||
Facture.setTotalTVA(commande.getTotalTVA());
|
||||
Facture.setTotalHorsTaxNet(commande.getTotalHorsTaxNet());
|
||||
Facture.setRemise(commande.getRemise());
|
||||
Facture.setTimbre(commande.getTimbre());
|
||||
Facture.setDevise(commande.getCodeDevis());
|
||||
Facture.setCodeUser(User.idprofile);
|
||||
Facture.setListeproduit(commande.getListeproduit());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,616 @@
|
||||
package Controllers.FactureClt;
|
||||
|
||||
import Controllers.Dialog.MessageControle;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.CommandeClt.CommandeClt;
|
||||
import Models.TraiteClt.DatePickerCell;
|
||||
import Models.ChequeClt.DatePickerCellCheque;
|
||||
import Models.FactureClt.FactureClt;
|
||||
import Models.ChequeClt.ChequeList;
|
||||
import Models.TraiteClt.TraiteList;
|
||||
import Models.ChequeClt.ChequeClt;
|
||||
import Models.TraiteClt.TraiteClt;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
|
||||
/**
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class FactureCltAjouterPaiementFaciliteController implements Initializable {
|
||||
|
||||
|
||||
@FXML private AnchorPane PaneFactureCltAjouterPaiementFacilite;
|
||||
|
||||
@FXML public AnchorPane PaneTableViewTraite ;
|
||||
@FXML public AnchorPane PaneTableViewCheque;
|
||||
@FXML public Text TextMontant_Traite;
|
||||
@FXML public Text TextMontant_Interet;
|
||||
|
||||
@FXML public RadioButton RadioCheque;
|
||||
@FXML public RadioButton RadioTraite;
|
||||
|
||||
@FXML public Text TextNetaPayer ;
|
||||
@FXML public Text TextMontantTraite;
|
||||
@FXML public Text TextMontantInteret;
|
||||
|
||||
@FXML public TextField TextFieldAvance;
|
||||
@FXML public TextField TextFieldNbrTraite;
|
||||
@FXML public TextField TextFieldTauxIntere;
|
||||
@FXML public Text TextAvance;
|
||||
@FXML public Text TextNbrTraite;
|
||||
@FXML public Text TextTauxIntere;
|
||||
|
||||
@FXML public TableView<TraiteList> TableViewListeTraite ;
|
||||
@FXML public TableColumn TabColDateTraite;
|
||||
@FXML public TableColumn<TraiteList ,String> TabColMontantTraite;
|
||||
|
||||
@FXML public TableView<ChequeList> TableViewListeCheque ;
|
||||
@FXML public TableColumn TabColDateCheque;
|
||||
@FXML public TableColumn<ChequeList ,String> TabColNumeroCheque;
|
||||
@FXML public TableColumn<ChequeList ,String> TabColBanqueCheque;
|
||||
@FXML public TableColumn<ChequeList ,String> TabColMontantCheque;
|
||||
|
||||
public CommandeClt commande;
|
||||
public FactureClt Facture ;
|
||||
public boolean TypeSelect = true; // True Traite | False Cheque
|
||||
|
||||
float NetaPayer, TotalMontantTraite, MontantInteret, Avance, NbrTraite, TauxIntere;
|
||||
|
||||
public ObservableList<TraiteList> dataList = FXCollections.observableArrayList();
|
||||
public ObservableList<ChequeList> dataListCheque = FXCollections.observableArrayList();
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TableViewListeTraite.setEditable(true);
|
||||
|
||||
TabColMontantTraite.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColMontantTraite.getStyleClass().add("Center");
|
||||
TabColMontantTraite.setCellValueFactory(new PropertyValueFactory<TraiteList, String>("MontantTraite"));
|
||||
TabColMontantTraite.setCellFactory(TextFieldTableCell.<TraiteList>forTableColumn()); //Ajouter l'option textfield
|
||||
//Valier l'opertion
|
||||
TabColMontantTraite.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<TraiteList, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<TraiteList, String> t) {
|
||||
String NewQuantite = t.getNewValue();
|
||||
((TraiteList) t.getTableView().getItems().get(t.getTablePosition().getRow())).setMontantTraite(NewQuantite);
|
||||
}
|
||||
});
|
||||
|
||||
TabColDateTraite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDateTraite.getStyleClass().add("Center");
|
||||
TabColDateTraite.setCellValueFactory(new PropertyValueFactory<TraiteList, Date>("date"));
|
||||
TabColDateTraite.setEditable(true);
|
||||
|
||||
TabColDateTraite.setCellFactory(new Callback<TableColumn, TableCell>() {
|
||||
@Override
|
||||
public TableCell call(TableColumn p) {
|
||||
DatePickerCell datePick = new DatePickerCell(dataList);
|
||||
return datePick;
|
||||
}
|
||||
});
|
||||
TableViewListeTraite.setItems(dataList);
|
||||
|
||||
|
||||
//Cheque
|
||||
TabColNumeroCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColNumeroCheque.getStyleClass().add("Center");
|
||||
TabColNumeroCheque.setCellValueFactory(new PropertyValueFactory<ChequeList, String>("NumeroCheque"));
|
||||
TabColNumeroCheque.setCellFactory(TextFieldTableCell.<ChequeList>forTableColumn()); //Ajouter l'option textfield
|
||||
//Valier l'opertion
|
||||
TabColNumeroCheque.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ChequeList, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ChequeList, String> t) {
|
||||
String NewNumeroCheque = t.getNewValue();
|
||||
contro clt = new contro();
|
||||
if(!clt.isNumeric(NewNumeroCheque)){
|
||||
if(t.getTablePosition().getRow() == 0){
|
||||
Integer NumeroCheque = Integer.valueOf(NewNumeroCheque);
|
||||
int indise = 0;
|
||||
while(indise<dataListCheque.size()){
|
||||
((ChequeList) t.getTableView().getItems().get(indise)).setNumeroCheque(NumeroCheque.toString());
|
||||
indise++;NumeroCheque++;
|
||||
}
|
||||
}else{
|
||||
((ChequeList) t.getTableView().getItems().get(t.getTablePosition().getRow())).setNumeroCheque(NewNumeroCheque);
|
||||
}
|
||||
}else{
|
||||
((ChequeList) t.getTableView().getItems().get(t.getTablePosition().getRow())).setNumeroCheque(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
TabColBanqueCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColBanqueCheque.getStyleClass().add("Center");
|
||||
TabColBanqueCheque.setCellValueFactory(new PropertyValueFactory<ChequeList, String>("BanqueCheque"));
|
||||
TabColBanqueCheque.setCellFactory(TextFieldTableCell.<ChequeList>forTableColumn()); //Ajouter l'option textfield
|
||||
//Valier l'opertion
|
||||
TabColBanqueCheque.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ChequeList, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ChequeList, String> t) {
|
||||
String NewBanque = t.getNewValue();
|
||||
if(t.getTablePosition().getRow() == 0){
|
||||
int indise = 0;
|
||||
while(indise<dataListCheque.size()){
|
||||
((ChequeList) t.getTableView().getItems().get(indise)).setBanqueCheque(NewBanque);
|
||||
indise++;
|
||||
}
|
||||
}else{
|
||||
((ChequeList) t.getTableView().getItems().get(t.getTablePosition().getRow())).setBanqueCheque(NewBanque);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
TabColMontantCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColMontantCheque.getStyleClass().add("Center");
|
||||
TabColMontantCheque.setCellValueFactory(new PropertyValueFactory<ChequeList, String>("MontantCheque"));
|
||||
TabColMontantCheque.setCellFactory(TextFieldTableCell.<ChequeList>forTableColumn()); //Ajouter l'option textfield
|
||||
//Valier l'opertion
|
||||
TabColMontantCheque.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ChequeList, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ChequeList, String> t) {
|
||||
String NewQuantite = t.getNewValue();
|
||||
((ChequeList) t.getTableView().getItems().get(t.getTablePosition().getRow())).setMontantCheque(NewQuantite);
|
||||
}
|
||||
});
|
||||
|
||||
TabColDateCheque.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDateCheque.getStyleClass().add("Center");
|
||||
TabColDateCheque.setCellValueFactory(new PropertyValueFactory<ChequeList, Date>("date"));
|
||||
TabColDateCheque.setEditable(true);
|
||||
TabColDateCheque.setCellFactory(new Callback<TableColumn, TableCell>() {
|
||||
@Override
|
||||
public TableCell call(TableColumn p) {
|
||||
DatePickerCellCheque datePick = new DatePickerCellCheque(dataListCheque);
|
||||
return datePick;
|
||||
}
|
||||
});
|
||||
|
||||
TableViewListeCheque.setItems(dataListCheque);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void CalculeTraite(){
|
||||
dataList.clear();
|
||||
PaneTableViewCheque.setVisible(false);
|
||||
PaneTableViewTraite.setVisible(true);
|
||||
|
||||
NbrTraite = Adaptateur.StringToFloat(TextFieldNbrTraite.getText());
|
||||
TauxIntere = Adaptateur.StringToFloat(TextFieldTauxIntere.getText());
|
||||
|
||||
MontantInteret = ((NetaPayer - Avance) * TauxIntere) / 100 ;
|
||||
TotalMontantTraite = (NetaPayer - Avance) + MontantInteret ;
|
||||
|
||||
TextMontantInteret.setText(Adaptateur.ArrondFloatToString(MontantInteret)+" "+ParametreSystem.CurrencySign);
|
||||
TextMontantTraite.setText(Adaptateur.ArrondFloatToString(TotalMontantTraite)+" "+ParametreSystem.CurrencySign);
|
||||
|
||||
Integer divTotal = Adaptateur.Diviseur(TotalMontantTraite);
|
||||
float modeTotal = Adaptateur.Modulo(TotalMontantTraite);
|
||||
|
||||
float Value = (float) TotalMontantTraite / NbrTraite;
|
||||
Integer div = Adaptateur.Diviseur(Value);
|
||||
|
||||
|
||||
Date date= new Date();
|
||||
Calendar cal = Calendar.getInstance();
|
||||
|
||||
Integer Somme = 0;
|
||||
|
||||
for(int i=0; i<NbrTraite; i++){
|
||||
cal.setTime(date);
|
||||
cal.add(Calendar.MONTH, i+1);
|
||||
if(i != NbrTraite-1){
|
||||
Somme = Somme + div ;
|
||||
dataList.add(new TraiteList(Adaptateur.floatDeleZero(div), cal.getTime()));
|
||||
}else{
|
||||
dataList.add(new TraiteList(Adaptateur.floatDeleZero((divTotal - Somme) + modeTotal) , cal.getTime()));
|
||||
}
|
||||
}
|
||||
TextMontantInteret.setVisible(true);
|
||||
TextMontantTraite.setVisible(true);
|
||||
TextMontant_Traite.setVisible(true);
|
||||
TextMontant_Interet.setVisible(true);
|
||||
|
||||
}
|
||||
|
||||
private void CalculeCheque(){
|
||||
dataListCheque.clear();
|
||||
PaneTableViewTraite.setVisible(false);
|
||||
PaneTableViewCheque.setVisible(true);
|
||||
|
||||
NbrTraite = Adaptateur.StringToFloat(TextFieldNbrTraite.getText());
|
||||
TauxIntere = Adaptateur.StringToFloat(TextFieldTauxIntere.getText());
|
||||
|
||||
MontantInteret = ((NetaPayer - Avance) * TauxIntere) / 100 ;
|
||||
TotalMontantTraite = (NetaPayer - Avance) + MontantInteret ;
|
||||
|
||||
TextMontantInteret.setText(Adaptateur.ArrondFloatToString(MontantInteret)+" "+ParametreSystem.CurrencySign);
|
||||
TextMontantTraite.setText(Adaptateur.ArrondFloatToString(TotalMontantTraite)+" "+ParametreSystem.CurrencySign);
|
||||
|
||||
Integer divTotal = Adaptateur.Diviseur(TotalMontantTraite);
|
||||
float modeTotal = Adaptateur.Modulo(TotalMontantTraite);
|
||||
|
||||
float Value = (float) TotalMontantTraite / NbrTraite;
|
||||
Integer div = Adaptateur.Diviseur(Value);
|
||||
|
||||
|
||||
Date date= new Date();
|
||||
Calendar cal = Calendar.getInstance();
|
||||
|
||||
Integer Somme = 0;
|
||||
|
||||
for(int i=0; i<NbrTraite; i++){
|
||||
cal.setTime(date);
|
||||
cal.add(Calendar.MONTH, i+1);
|
||||
if(i != NbrTraite-1){
|
||||
Somme = Somme + div ;
|
||||
dataListCheque.add(new ChequeList(cal.getTime(),"","",Adaptateur.floatDeleZero(div)));
|
||||
}else{
|
||||
dataListCheque.add(new ChequeList(cal.getTime(),"","",Adaptateur.floatDeleZero((divTotal - Somme) + modeTotal)));
|
||||
}
|
||||
}
|
||||
TextMontantInteret.setVisible(true);
|
||||
TextMontantTraite.setVisible(true);
|
||||
TextMontant_Traite.setVisible(true);
|
||||
TextMontant_Interet.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
//Suivant
|
||||
@FXML
|
||||
private void FactureCltAjouterSuivantButtonAction(ActionEvent event) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureClt/FactureCltAjouterDetailTraite.fxml"));
|
||||
Parent NodeDetailTraite = (Parent)fxmlLoader.load();
|
||||
FactureCltAjouterDetailTraiteController FactureCltAjouterDetailTraite = fxmlLoader.getController();
|
||||
|
||||
|
||||
if(commande.getTypeClient()==0){
|
||||
FactureCltAjouterDetailTraite.TextNom.setText(commande.CltPersonne.getNom());
|
||||
FactureCltAjouterDetailTraite.TextPrenom.setText(commande.CltPersonne.getPrenom());
|
||||
FactureCltAjouterDetailTraite.TextAdress.setText(commande.CltPersonne.getAdresse());
|
||||
}else if(commande.getTypeClient()==1){
|
||||
FactureCltAjouterDetailTraite.TextNom.setText(commande.CltEntreprise.getNom());
|
||||
FactureCltAjouterDetailTraite.TextPrenom.setText(commande.CltEntreprise.getMatricule());
|
||||
FactureCltAjouterDetailTraite.TextAdress.setText(commande.CltEntreprise.getAdresse());
|
||||
FactureCltAjouterDetailTraite.TextPrenomMatricule.setText("Matricule");
|
||||
FactureCltAjouterDetailTraite.TextPrenom.setText(commande.CltEntreprise.getMatricule());
|
||||
}else if(commande.getTypeClient()==2){
|
||||
FactureCltAjouterDetailTraite.TextNom.setText(commande.CltPassager.getNom());
|
||||
FactureCltAjouterDetailTraite.TextPrenom.setText(commande.CltPassager.getPrenom());
|
||||
FactureCltAjouterDetailTraite.TextAdress.setText(commande.CltPassager.getAdresse());
|
||||
}
|
||||
|
||||
|
||||
if(TypeSelect == true){
|
||||
if(this.ControleListTraite()){
|
||||
SetDataFactureClt(true);
|
||||
PaneFactureCltAjouterPaiementFacilite.getChildren().clear();
|
||||
PaneFactureCltAjouterPaiementFacilite.getChildren().add(NodeDetailTraite);
|
||||
FactureCltAjouterDetailTraite.data_List_Traite = dataList;
|
||||
FactureCltAjouterDetailTraite.SetDataTraiteFacilite(Facture);
|
||||
}
|
||||
}else{
|
||||
if(this.ControleListCheque()){
|
||||
SetDataFactureClt(false);
|
||||
PaneFactureCltAjouterPaiementFacilite.getChildren().clear();
|
||||
PaneFactureCltAjouterPaiementFacilite.getChildren().add(NodeDetailTraite);
|
||||
FactureCltAjouterDetailTraite.data_List_Cheque = dataListCheque;
|
||||
FactureCltAjouterDetailTraite.SetDataTraiteFacilite(Facture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void SetDataFactureClt(boolean type_reglement){
|
||||
Facture.setAvance(TextFieldAvance.getText());
|
||||
Facture.setTotalMontantTraite(Adaptateur.ArrondFloatToString(TotalMontantTraite));
|
||||
Facture.setNbrTraite(TextFieldNbrTraite.getText());
|
||||
Facture.setMontantInteret(Adaptateur.ArrondFloatToString(MontantInteret));
|
||||
Facture.setTauxInteret(TextFieldTauxIntere.getText());
|
||||
Facture.setTypeRegement(commande.getTypeRegement());
|
||||
if(commande.getTypeClient() == 0){
|
||||
Facture.setCltPersonne(commande.getCltPersonne());
|
||||
}else if(commande.getTypeClient() == 1){
|
||||
Facture.setCltEntreprise(commande.getCltEntreprise());
|
||||
}else if(commande.getTypeClient() == 2){
|
||||
Facture.setCltPassager(commande.getCltPassager());
|
||||
}
|
||||
|
||||
Facture.setListeproduit(commande.getListeproduit());
|
||||
if(type_reglement == true){
|
||||
Facture.setTypeFacilite("0");
|
||||
ArrayList<TraiteClt> ListTraites = new ArrayList();
|
||||
for(int i=0; i<dataList.size(); i++){
|
||||
TraiteClt Traite = new TraiteClt();
|
||||
Traite.setDateCreationTraiteClt(new Date().toString());
|
||||
String DateTraite = new SimpleDateFormat("dd/MM/yyyy").format(dataList.get(i).getDate());
|
||||
Traite.setDateTraiteClt(DateTraite);
|
||||
Traite.setMontantTraiteClt(dataList.get(i).getMontantTraite());
|
||||
ListTraites.add(Traite);
|
||||
}
|
||||
Facture.setListeTraites(ListTraites);
|
||||
}else if(type_reglement == false){
|
||||
Facture.setTypeFacilite("1");
|
||||
ArrayList<ChequeClt> ListCheque = new ArrayList();
|
||||
for(int i=0; i<dataListCheque.size(); i++){
|
||||
ChequeClt Cheque = new ChequeClt();
|
||||
Cheque.setNumeroChequeClt(dataListCheque.get(i).getNumeroCheque());
|
||||
Cheque.setBanqueChequeClt(dataListCheque.get(i).getBanqueCheque());
|
||||
Cheque.setMontantChequeClt(dataListCheque.get(i).getMontantCheque());
|
||||
String DateChequePaiement = new SimpleDateFormat("yyyy-MM-dd").format(dataListCheque.get(i).getDate());
|
||||
Cheque.setDatePaiement(DateChequePaiement);
|
||||
Cheque.setDateCreation(new Date().toString());
|
||||
ListCheque.add(Cheque);
|
||||
}
|
||||
Facture.setListeCheques(ListCheque);
|
||||
}
|
||||
}
|
||||
//Boutton Traitement
|
||||
@FXML
|
||||
private void FactureCltAjouterTraitementButtonAction(ActionEvent event) throws IOException {
|
||||
if(this.Controle()){
|
||||
if(TypeSelect == true){
|
||||
this.CalculeTraite();
|
||||
}else{
|
||||
this.CalculeCheque();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Radio Cheque
|
||||
@FXML
|
||||
private void FactureCltAjouterChequeButtonAction(ActionEvent event) throws IOException {
|
||||
TypeSelect = false;
|
||||
TextMontant_Traite.setVisible(false);TextMontant_Interet.setVisible(false);
|
||||
PaneTableViewTraite.setVisible(false);PaneTableViewCheque.setVisible(false);
|
||||
TextMontantInteret.setVisible(false);TextMontantTraite.setVisible(false);
|
||||
if(this.Controle()){
|
||||
this.CalculeCheque();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//Radio Traite
|
||||
@FXML
|
||||
private void FactureCltAjouterTraiteButtonAction(ActionEvent event) throws IOException {
|
||||
TypeSelect = true;
|
||||
TextMontant_Traite.setVisible(false);TextMontant_Interet.setVisible(false);
|
||||
PaneTableViewTraite.setVisible(false);PaneTableViewCheque.setVisible(false);
|
||||
TextMontantInteret.setVisible(false);TextMontantTraite.setVisible(false);
|
||||
if(this.Controle()){
|
||||
this.CalculeTraite();
|
||||
}
|
||||
}
|
||||
|
||||
//Boutton Présédent
|
||||
@FXML
|
||||
private void FactureCltAjouterButtonAction(ActionEvent event) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureClt/FactureCltAjouterDetailSelect.fxml"));
|
||||
Parent NodeFactureCltAjouterDetailSelect = (Parent)fxmlLoader.load();
|
||||
FactureCltAjouterDetailSelectController FactureCltAjouterDetailSelect = fxmlLoader.getController();
|
||||
FactureCltAjouterDetailSelect.setDataCommande(commande.getCodecommandeclt());
|
||||
PaneFactureCltAjouterPaiementFacilite.getChildren().clear();
|
||||
PaneFactureCltAjouterPaiementFacilite.getChildren().add(NodeFactureCltAjouterDetailSelect);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SetTableViewTraite(){
|
||||
PaneTableViewTraite.setVisible(true);
|
||||
TableViewListeTraite.setItems(dataList);
|
||||
}
|
||||
|
||||
public void SetTableViewCheque(){
|
||||
PaneTableViewCheque.setVisible(true);
|
||||
TableViewListeCheque.setItems(dataListCheque);
|
||||
}
|
||||
|
||||
private Boolean ControleListTraite(){
|
||||
boolean Resulta = true;
|
||||
boolean MontantTraite = true;
|
||||
int indise = 0;
|
||||
float Somme = 0;
|
||||
while(indise<dataList.size()){
|
||||
if(dataList.get(indise).getMontantTraite().equals("0")){
|
||||
MontantTraite = false;
|
||||
}
|
||||
Somme = Somme + Adaptateur.ArrondStringToFloat(dataList.get(indise).getMontantTraite());
|
||||
indise++;
|
||||
}
|
||||
if(!MontantTraite){
|
||||
final MessageControle messagecontrol = new MessageControle();
|
||||
Text text3 = new Text();
|
||||
text3.setText("Le montant des traites doit être différent de zéro (0)");
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 13));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
messagecontrol.ShowNotification();
|
||||
Resulta = false;
|
||||
}
|
||||
else if(Adaptateur.ArrondFloatToFloat(Somme) != Adaptateur.ArrondFloatToFloat(TotalMontantTraite)){
|
||||
final MessageControle messagecontrol = new MessageControle();
|
||||
|
||||
Text text3 = new Text();
|
||||
text3.setText("La sommes des traites est différent à la montant de TotalMontantTraite");
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 13));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
messagecontrol.ShowNotification();
|
||||
|
||||
Resulta = false;
|
||||
}
|
||||
|
||||
return Resulta;
|
||||
}
|
||||
|
||||
private Boolean ControleListCheque(){
|
||||
boolean Resulta = true;
|
||||
boolean NumeroCheque = true;
|
||||
boolean MontantCheque = true;
|
||||
boolean Banque = true;
|
||||
int indise = 0;
|
||||
float Somme = 0;
|
||||
contro clt = new contro();
|
||||
|
||||
while(indise<dataListCheque.size()){
|
||||
|
||||
if(!clt.isNumericNotnull(dataListCheque.get(indise).getNumeroCheque())){
|
||||
NumeroCheque = false;
|
||||
}
|
||||
if(dataListCheque.get(indise).getBanqueCheque().isEmpty()){
|
||||
Banque = false;
|
||||
}
|
||||
if(dataListCheque.get(indise).getMontantCheque().equals("0") || dataListCheque.get(indise).getNumeroCheque().isEmpty()){
|
||||
MontantCheque = false;
|
||||
}
|
||||
Somme = Somme + Adaptateur.ArrondStringToFloat(dataListCheque.get(indise).getMontantCheque());
|
||||
indise++;
|
||||
}
|
||||
|
||||
System.out.println(Adaptateur.ArrondFloatToFloat(Somme));
|
||||
System.out.println(Adaptateur.ArrondFloatToFloat(TotalMontantTraite));
|
||||
|
||||
if(NumeroCheque){
|
||||
final MessageControle messagecontrol = new MessageControle();
|
||||
Text text3 = new Text();
|
||||
text3.setText("Incorrect Numéro Chéque");
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 13));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
messagecontrol.ShowNotification();
|
||||
Resulta = false;
|
||||
}
|
||||
else if(!Banque){
|
||||
final MessageControle messagecontrol = new MessageControle();
|
||||
Text text3 = new Text();
|
||||
text3.setText("Le nom de la banque est vide");
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 13));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
messagecontrol.ShowNotification();
|
||||
Resulta = false;
|
||||
}
|
||||
else if(!MontantCheque){
|
||||
final MessageControle messagecontrol = new MessageControle();
|
||||
Text text3 = new Text();
|
||||
text3.setText("Incorrect montant chéque");
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 13));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
messagecontrol.ShowNotification();
|
||||
Resulta = false;
|
||||
}
|
||||
else if(Adaptateur.ArrondFloatToFloat(Somme) != Adaptateur.ArrondFloatToFloat(TotalMontantTraite)){
|
||||
final MessageControle messagecontrol = new MessageControle();
|
||||
Text text3 = new Text();
|
||||
text3.setText("La sommes des chéques est différent à la montant de TotalMontantTraite");
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 13));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
messagecontrol.ShowNotification();
|
||||
Resulta = false;
|
||||
}
|
||||
|
||||
return Resulta;
|
||||
}
|
||||
|
||||
|
||||
private Boolean Controle(){
|
||||
contro clt = new contro();
|
||||
|
||||
if(clt.ContrNumeriqueNotnull(TextFieldAvance, TextAvance) &&
|
||||
clt.ContrNumeriqueNotnull(TextFieldNbrTraite, TextNbrTraite) &&
|
||||
clt.ContrNumeriqueNotnull(TextFieldTauxIntere, TextTauxIntere)){
|
||||
|
||||
NetaPayer = Adaptateur.StringToFloat(commande.getNetAPayer());
|
||||
Avance = Adaptateur.StringToFloat(TextFieldAvance.getText());
|
||||
if(NetaPayer< Avance){
|
||||
TextFieldAvance.setStyle("-fx-border-color:#f20606;");
|
||||
TextAvance.setText("doit être inférieur a Net A payer");
|
||||
return false ;
|
||||
}else if(Adaptateur.StringToFloat(TextFieldNbrTraite.getText())<= 0){
|
||||
TextFieldNbrTraite.setStyle("-fx-border-color:#f20606;");
|
||||
TextNbrTraite.setText("doit être supérieur a 0");
|
||||
return false ;
|
||||
}else{
|
||||
TextAvance.setText("");
|
||||
TextFieldAvance.setStyle("-fx-border-color: transparent;");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,364 @@
|
||||
package Controllers.FactureClt;
|
||||
|
||||
import Controllers.TraiteClt.TraiteCltPrintController;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Models.Produit.ListeProduit;
|
||||
import Models.FactureClt.FactureClt;
|
||||
import Models.FactureClt.FactureCltChequeListe;
|
||||
import Models.FactureClt.FactureCltDB;
|
||||
import Models.FactureClt.FactureCltTraiteListe;
|
||||
import Models.ChequeClt.ChequeClt;
|
||||
import Models.TraiteClt.TraiteClt;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.print.JobSettings;
|
||||
import javafx.print.PageLayout;
|
||||
import javafx.print.PageOrientation;
|
||||
import javafx.print.PageRange;
|
||||
import javafx.print.Paper;
|
||||
import javafx.print.Printer;
|
||||
import javafx.print.PrinterJob;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class FactureCltDetailController implements Initializable{
|
||||
|
||||
Logger logger = Logger.getLogger(FactureCltDetailController.class.getName());
|
||||
|
||||
@FXML public AnchorPane PaneSucces;
|
||||
|
||||
@FXML public AnchorPane AnchorPaneLoading;
|
||||
@FXML public AnchorPane AnchorPaneDetailFactureClt;
|
||||
|
||||
@FXML private Text DateCreation;
|
||||
@FXML private Text Reglement;
|
||||
@FXML private Text NetAPayer;
|
||||
@FXML private Text TotalHorsTaxNet;
|
||||
@FXML private Text TotalTVA;
|
||||
@FXML private Text CodeFactClt;
|
||||
|
||||
@FXML private Text TypeClt;
|
||||
@FXML private Text Nom;
|
||||
@FXML private Text Prenom;
|
||||
@FXML private Text Adresse;
|
||||
@FXML private Text TELE1;
|
||||
@FXML private Text TELE2;
|
||||
|
||||
@FXML private Text TextPrenom ;
|
||||
@FXML private Text TextMatricule ;
|
||||
|
||||
@FXML private Text TextMontant;
|
||||
@FXML private Text ValMontant;
|
||||
|
||||
|
||||
@FXML private TableView<ListeProduit> TableViewListeProduit ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColReference;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDesignation;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColQuantite ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColPrixHT;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColRemise;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTotalHT;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTVA;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTotalTTC;
|
||||
|
||||
|
||||
@FXML private TableView<FactureCltTraiteListe> TableViewListeTraites ;
|
||||
@FXML private TableColumn<FactureCltTraiteListe ,String> TabColDateTraites;
|
||||
@FXML private TableColumn<FactureCltTraiteListe ,String> TabColMontantTraites;
|
||||
|
||||
@FXML private TableView<FactureCltChequeListe> TableViewListeCheques ;
|
||||
@FXML private TableColumn<FactureCltChequeListe ,String> TabColDateCheques;
|
||||
@FXML private TableColumn<FactureCltChequeListe ,String> TabColNumeroCheques;
|
||||
@FXML private TableColumn<FactureCltChequeListe ,String> TabColBanqueCheques;
|
||||
@FXML private TableColumn<FactureCltChequeListe ,String> TabColMontantCheques;
|
||||
|
||||
@FXML public Button ButtonImprimerTraite;
|
||||
@FXML private Tab TabTypeRegement;
|
||||
|
||||
private Service<Void> ThreadFactureCltDetail;
|
||||
|
||||
FactureClt factureClt;
|
||||
|
||||
public String codeFactClt;
|
||||
|
||||
public boolean NewFacture;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TableViewListeProduit.setEditable(false);
|
||||
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColDesignation.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColRemise.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColRemise.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColRemise.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTotalTTC.getStyleClass().add("Center");
|
||||
|
||||
TabColDateTraites.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDateTraites.getStyleClass().add("Center");
|
||||
TabColDateTraites.setCellValueFactory(new PropertyValueFactory<FactureCltTraiteListe, String>("DateTraites"));
|
||||
|
||||
TabColMontantTraites.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColMontantTraites.getStyleClass().add("Center");
|
||||
TabColMontantTraites.setCellValueFactory(new PropertyValueFactory<FactureCltTraiteListe, String>("MontantTraites"));
|
||||
|
||||
TabColDateCheques.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDateCheques.getStyleClass().add("Center");
|
||||
TabColDateCheques.setCellValueFactory(new PropertyValueFactory<FactureCltChequeListe, String>("DateCheques"));
|
||||
|
||||
TabColNumeroCheques.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColNumeroCheques.getStyleClass().add("Center");
|
||||
TabColNumeroCheques.setCellValueFactory(new PropertyValueFactory<FactureCltChequeListe, String>("NumeroCheques"));
|
||||
|
||||
TabColBanqueCheques.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColBanqueCheques.getStyleClass().add("Center");
|
||||
TabColBanqueCheques.setCellValueFactory(new PropertyValueFactory<FactureCltChequeListe, String>("BanqueCheques"));
|
||||
|
||||
TabColMontantCheques.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColMontantCheques.getStyleClass().add("Center");
|
||||
TabColMontantCheques.setCellValueFactory(new PropertyValueFactory<FactureCltChequeListe, String>("MontantCheques"));
|
||||
|
||||
|
||||
ButtonPrintTraite();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void FactureCltPrintButtonAction(ActionEvent event) throws IOException {
|
||||
|
||||
PrinterJob jobPrint = PrinterJob.createPrinterJob();
|
||||
|
||||
try {
|
||||
|
||||
jobPrint.getJobSettings().setPageRanges(new PageRange(1, 1));
|
||||
|
||||
if (jobPrint.showPrintDialog(null)) {
|
||||
|
||||
FXMLLoader fxmlLoaderPrintFactureClt = new FXMLLoader(getClass().getResource("/Views/FactureClt/FactureCltPrint.fxml"));
|
||||
final Node ParentFxmlPrintFactureClt = (Node)fxmlLoaderPrintFactureClt.load();
|
||||
FactureCltPrintController PrintFactureClt = fxmlLoaderPrintFactureClt.getController();
|
||||
|
||||
if(NewFacture){
|
||||
PrintFactureClt.setFactureClt(factureClt, false);
|
||||
}else{
|
||||
PrintFactureClt.setFactureClt(factureClt, true);
|
||||
}
|
||||
|
||||
jobPrint.printPage(ParentFxmlPrintFactureClt);
|
||||
|
||||
jobPrint.endJob();
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
System.err.println("Erreur dans: Controllers.FactureClt.FactureCltDetailController.FactureCltPrintButtonAction ");
|
||||
System.err.println(ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void SowDetailFactureClt(boolean newFacture)
|
||||
{
|
||||
ThreadFactureCltDetail = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
NewFacture = newFacture;
|
||||
FactureCltDB factureCltDB = new FactureCltDB();
|
||||
|
||||
factureClt = factureCltDB.getFactureClt(codeFactClt);
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadFactureCltDetail.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
CodeFactClt.setText(factureClt.getCodeFactureClt());
|
||||
DateCreation.setText(Adaptateur.NormalDateFormat(factureClt.getDateFacture()));
|
||||
Reglement.setText(factureClt.getTypeRegementString());
|
||||
TotalHorsTaxNet.setText(Adaptateur.StringToStringEspaceCurrency(factureClt.getTotalHorsTaxNet()));
|
||||
TotalTVA.setText(Adaptateur.StringToStringEspaceCurrency(factureClt.getTotalTVA()));
|
||||
TypeClt.setText(factureClt.getTypeClientString());
|
||||
NetAPayer.setText(Adaptateur.StringToStringEspaceCurrency(factureClt.getNetAPayer()));
|
||||
|
||||
if(factureClt.getTypeClient()==0 ){
|
||||
TextPrenom.setVisible(true);
|
||||
TextMatricule.setVisible(false);
|
||||
|
||||
Nom.setText(factureClt.CltPersonne.getNom());
|
||||
Prenom.setText(factureClt.CltPersonne.getPrenom());
|
||||
Adresse.setText(factureClt.CltPersonne.getAdresse());
|
||||
TELE1.setText(factureClt.CltPersonne.getTelemobileString());
|
||||
TELE2.setText(factureClt.CltPersonne.getTelefixString());
|
||||
}
|
||||
|
||||
if(factureClt.getTypeClient()==1){
|
||||
TextPrenom.setVisible(false);
|
||||
TextMatricule.setVisible(true);
|
||||
|
||||
Nom.setText(factureClt.CltEntreprise.getNom());
|
||||
Prenom.setText(factureClt.CltEntreprise.getMatricule());
|
||||
Adresse.setText(factureClt.CltEntreprise.getAdresse());
|
||||
TELE1.setText(factureClt.CltEntreprise.getTele1String());
|
||||
TELE2.setText(factureClt.CltEntreprise.getTele2String());
|
||||
}
|
||||
|
||||
if(factureClt.getTypeClient()==2 ){
|
||||
TextPrenom.setVisible(true);
|
||||
TextMatricule.setVisible(false);
|
||||
|
||||
Nom.setText(factureClt.CltPassager.getNom());
|
||||
Prenom.setText(factureClt.CltPassager.getPrenom());
|
||||
Adresse.setText(factureClt.CltPassager.getAdresse());
|
||||
TELE1.setText(factureClt.CltPassager.getTelefixString());
|
||||
TELE2.setText(factureClt.CltPassager.getTelemobileString());
|
||||
}
|
||||
TableViewListeProduit.setItems(factureClt.getListeproduit());
|
||||
|
||||
if(factureClt.getTypeRegementInteger() == 1)
|
||||
{
|
||||
ValMontant.setText(Adaptateur.StringToStringEspaceCurrency(factureClt.getTotalMontantTraite()));
|
||||
TabTypeRegement.setClosable(false);
|
||||
TabTypeRegement.setDisable(false);
|
||||
if(factureClt.getTypeFaciliteBoolean()){ //true Traite | false Cheque
|
||||
TabTypeRegement.setText("Liste des traites");
|
||||
TextMontant.setText("Total Montant Traites:");
|
||||
TableViewListeTraites.setVisible(true);
|
||||
//ButtonImprimerTraite.setVisible(true);
|
||||
ObservableList<FactureCltTraiteListe> dataListe = FXCollections.observableArrayList();
|
||||
ArrayList<TraiteClt> ListTraites = factureClt.getListeTraites();
|
||||
for(int i=0; i<ListTraites.size(); i++)
|
||||
{
|
||||
dataListe.add(new FactureCltTraiteListe(ListTraites.get(i).getDateTraiteClt(), Adaptateur.StringToStringEspaceCurrency(ListTraites.get(i).getMontantTraiteClt()) ));
|
||||
}
|
||||
TableViewListeTraites.setItems(dataListe);
|
||||
}else{
|
||||
TextMontant.setText("Total Montant Cheques:");
|
||||
TableViewListeCheques.setVisible(true);
|
||||
TabTypeRegement.setText("Liste des Chéques");
|
||||
ArrayList<ChequeClt> dataListCheque = factureClt.getListeCheques();
|
||||
ObservableList<FactureCltChequeListe> dataListeCheque = FXCollections.observableArrayList();
|
||||
for(int i=0; i<dataListCheque.size(); i++){
|
||||
dataListeCheque.add(new FactureCltChequeListe(dataListCheque.get(i).getDatePaiement(),dataListCheque.get(i).getNumeroChequeClt(),dataListCheque.get(i).getBanqueChequeClt(),dataListCheque.get(i).getMontantChequeClt()));
|
||||
}
|
||||
TableViewListeCheques.setItems(dataListeCheque);
|
||||
}
|
||||
}
|
||||
AnchorPaneLoading.setVisible(false);
|
||||
AnchorPaneDetailFactureClt.setVisible(true);
|
||||
|
||||
}
|
||||
});
|
||||
ThreadFactureCltDetail.start();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void ButtonPrintTraite()
|
||||
{
|
||||
ButtonImprimerTraite.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent e) {
|
||||
ArrayList<TraiteClt> ListTraites = factureClt.getListeTraites();
|
||||
String strCIN= "";
|
||||
String strNomComplet = "";
|
||||
|
||||
if(factureClt.getTypeClient() == 0){
|
||||
strCIN = factureClt.getCltPersonne().getCinString();
|
||||
strNomComplet = factureClt.getCltPersonne().getNomcomplet();
|
||||
}else if(factureClt.getTypeClient() == 1){
|
||||
strCIN = factureClt.getCltEntreprise().getMatricule();
|
||||
strNomComplet = factureClt.getCltEntreprise().getNom();
|
||||
}
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/TraiteClt/TraiteCltPrint.fxml"));
|
||||
try {
|
||||
Parent FxmlPrintTraite = (Parent)fxmlLoader.load();
|
||||
TraiteCltPrintController TraiteCltPrint = fxmlLoader.getController();
|
||||
|
||||
PrinterJob jobPrint = PrinterJob.createPrinterJob();
|
||||
|
||||
Printer printer = Printer.getDefaultPrinter();
|
||||
PageLayout pageLayout = printer.createPageLayout(Paper.NA_LETTER,PageOrientation.PORTRAIT, 0, 0, 0, 0);
|
||||
JobSettings jobSettings = jobPrint.getJobSettings();
|
||||
jobSettings.setPageLayout(pageLayout);
|
||||
|
||||
jobPrint.getJobSettings().setPageRanges(new PageRange(1, ListTraites.size()));
|
||||
if (jobPrint.showPrintDialog(null))
|
||||
{
|
||||
for(int i=0; i<ListTraites.size(); i++)
|
||||
{
|
||||
TraiteCltPrint.SetData(Adaptateur.ChiffreToLettre(new BigDecimal(ListTraites.get(i).getMontantTraiteClt())),
|
||||
Adaptateur.StringToStringEspaceCurrency(ListTraites.get(i).getMontantTraiteClt()),
|
||||
ListTraites.get(i).getDateTraiteClt(),
|
||||
strNomComplet,
|
||||
strCIN);
|
||||
jobPrint.printPage(FxmlPrintTraite);
|
||||
}
|
||||
}
|
||||
jobPrint.endJob();
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.error("FactureCltDetailController : TraiteCltPrint.fxml :" + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
|
||||
package Controllers.FactureClt;
|
||||
|
||||
import Models.Produit.ListeProduit;
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Models.FactureClt.FactureClt;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class FactureCltDialogConfirmationController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(FactureCltDialogConfirmationController.class.getName());
|
||||
|
||||
public Node nodeFxml ;
|
||||
|
||||
@FXML public AnchorPane AnchorPrincipal ;
|
||||
@FXML public Button Enregister ;
|
||||
@FXML private Text DateCreation;
|
||||
@FXML private Text Reglement;
|
||||
@FXML private Text NetAPayer;
|
||||
@FXML private Text TotalHorsTaxNet;
|
||||
@FXML private Text TotalTVA;
|
||||
|
||||
@FXML private Text TypeClt;
|
||||
@FXML private Text Nom;
|
||||
@FXML private Text Prenom;
|
||||
@FXML private Text Adresse;
|
||||
@FXML private Text TELE1;
|
||||
@FXML private Text TELE2;
|
||||
|
||||
@FXML private Text TextPrenom ;
|
||||
@FXML private Text TextMatricule ;
|
||||
|
||||
@FXML public TableView<ListeProduit> TableViewListeProduitPassCommClt ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColReference;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDesignaton;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColQuantite ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColPrixHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColRemise;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTotalHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTVA;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTotalTTC;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColDesignaton.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColRemise.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColRemise.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColRemise.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTotalTTC.getStyleClass().add("Center");
|
||||
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconsave.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
Enregister.setGraphic(buttonGraphic);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void GetFactureClt(FactureClt factureclt){
|
||||
DateCreation.setText(factureclt.getDateFacture());
|
||||
Reglement.setText(factureclt.getTypeRegement());
|
||||
|
||||
NetAPayer.setText(factureclt.getNetAPayer());
|
||||
TotalHorsTaxNet.setText(factureclt.getTotalHorsTaxNet());
|
||||
TotalTVA.setText(factureclt.getTotalTVA());
|
||||
|
||||
TypeClt.setText(factureclt.getTypeClientString());
|
||||
|
||||
/*
|
||||
if(FactureCltAjouterController.TypeClient == 0){
|
||||
TextPrenom.setVisible(true);
|
||||
TextMatricule.setVisible(false);
|
||||
Nom.setText(factureclt.CltPersonne.getNom());
|
||||
Prenom.setText(factureclt.CltPersonne.getPrenom());
|
||||
Adresse.setText(factureclt.CltPersonne.getAdresse());
|
||||
TELE1.setText(factureclt.CltPersonne.getTelefixString());
|
||||
TELE2.setText(factureclt.CltPersonne.getTelemobileString());
|
||||
}
|
||||
else if(FactureCltAjouterController.TypeClient == 1){
|
||||
TextPrenom.setVisible(false);
|
||||
TextMatricule.setVisible(true);
|
||||
Prenom.setText(factureclt.CltEntreprise.getMatricule());
|
||||
Adresse.setText(factureclt.CltEntreprise.getAdresse());
|
||||
TELE1.setText(factureclt.CltEntreprise.getTele1().toString());
|
||||
TELE2.setText(factureclt.CltEntreprise.getTele2().toString());
|
||||
}
|
||||
else if(FactureCltAjouterController.TypeClient == 2){
|
||||
TextPrenom.setVisible(true);
|
||||
TextMatricule.setVisible(false);
|
||||
Nom.setText(factureclt.CltPassager.getNom());
|
||||
Prenom.setText(factureclt.CltPassager.getPrenom());
|
||||
Adresse.setText(factureclt.CltPassager.getAdresse());
|
||||
TELE1.setText(factureclt.CltPassager.getTelefix().toString());
|
||||
TELE2.setText(factureclt.CltPassager.getTelemobile().toString());
|
||||
}
|
||||
*/
|
||||
TableViewListeProduitPassCommClt.setItems(factureclt.getListeproduit());
|
||||
}
|
||||
|
||||
|
||||
public FactureCltDialogConfirmationController(){
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureClt/FactureCltDialogConfirmation.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
nodeFxml = (Node) fxmlLoader.load();
|
||||
} catch (IOException ex) {
|
||||
logger.error("FactureCltDialogConfirmationController : FactureCltDialogConfirmation.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public void Show()
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(nodeFxml);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void ExitButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPrincipal.setVisible(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,457 @@
|
||||
package Controllers.FactureClt;
|
||||
|
||||
import Models.FactureClt.FactureCltDB;
|
||||
import javafx.collections.FXCollections;
|
||||
import Models.FactureClt.FactureCltGestionList;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class FactureCltGestionController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(FactureCltGestionController.class.getName());
|
||||
|
||||
@FXML private AnchorPane PaneFactureGestion ;
|
||||
|
||||
@FXML private ProgressBar ProgressBarFactureClt;
|
||||
|
||||
@FXML private Button ButtonSearchFactureClt;
|
||||
|
||||
@FXML public TableView<FactureCltGestionList> TableViewFactureCltListGestion;
|
||||
|
||||
@FXML public TableColumn<FactureCltGestionList ,String> TabColCodeFacture;
|
||||
@FXML public TableColumn<FactureCltGestionList ,String> TabColTypeClient;
|
||||
@FXML public TableColumn<FactureCltGestionList ,String> TabColCodeClient;
|
||||
@FXML public TableColumn<FactureCltGestionList ,String> TabColMode ;
|
||||
@FXML public TableColumn<FactureCltGestionList ,String> TabColTotal;
|
||||
@FXML public TableColumn<FactureCltGestionList ,String> TabColCodeCommande;
|
||||
@FXML public TableColumn<FactureCltGestionList ,String> TabColCreation;
|
||||
@FXML public TableColumn<FactureCltGestionList ,Boolean>TabColDetail ;
|
||||
|
||||
@FXML public TextField TextFieldCodeFacture ;
|
||||
@FXML public TextField TextFieldCodeClient ;
|
||||
@FXML public TextField TextFieldCodeCommande ;
|
||||
@FXML public DatePicker PickerDateCreation;
|
||||
|
||||
@FXML public RadioButton RadioComptant;
|
||||
@FXML public RadioButton RadioFacilite;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
private Service<Void> ThreadSearchFactureClt;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
//comboboxnombre des lignes tableview
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
TableViewFactureCltListGestion.setEditable(true);
|
||||
|
||||
TabColCodeFacture.setStyle( "-fx-alignment: CENTER;");TabColCodeFacture.getStyleClass().add("Center");
|
||||
TabColCodeFacture.setCellValueFactory(new PropertyValueFactory<FactureCltGestionList, String>("CodeFacture"));
|
||||
|
||||
TabColTypeClient.setStyle( "-fx-alignment: CENTER;");TabColTypeClient.getStyleClass().add("Center");
|
||||
TabColTypeClient.setCellValueFactory(new PropertyValueFactory<FactureCltGestionList, String>("TypeClient"));
|
||||
|
||||
TabColCodeClient.setStyle( "-fx-alignment: CENTER;");TabColCodeClient.getStyleClass().add("Center");
|
||||
TabColCodeClient.setCellValueFactory(new PropertyValueFactory<FactureCltGestionList, String>("CodeClient"));
|
||||
|
||||
TabColMode.setStyle( "-fx-alignment: CENTER;");TabColMode.getStyleClass().add("Center");
|
||||
TabColMode.setCellValueFactory(new PropertyValueFactory<FactureCltGestionList, String>("Mode"));
|
||||
TabColMode.setCellFactory(new Callback<TableColumn<FactureCltGestionList,String>,TableCell<FactureCltGestionList,String>>(){
|
||||
@Override
|
||||
public TableCell<FactureCltGestionList, String> call(TableColumn<FactureCltGestionList, String> param) {
|
||||
TableCell<FactureCltGestionList, String> cell = new TableCell<FactureCltGestionList, String>(){
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
if(item!= null && item.equals("Comptant")){
|
||||
Text text = new Text(item);
|
||||
text.setFill(Color.web("#428BCA"));
|
||||
text.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||
setGraphic(text);
|
||||
}else if(item!= null && item.equals("Facilité")){
|
||||
Text text = new Text(item);
|
||||
text.setFill(Color.web("#000000"));
|
||||
text.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||
setGraphic(text);
|
||||
}else{
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
TabColTotal.setStyle( "-fx-alignment: CENTER;");TabColTotal.getStyleClass().add("Center");
|
||||
TabColTotal.setCellValueFactory(new PropertyValueFactory<FactureCltGestionList, String>("Total"));
|
||||
|
||||
TabColCodeCommande.setStyle( "-fx-alignment: CENTER;");TabColCodeCommande.getStyleClass().add("Center");
|
||||
TabColCodeCommande.setCellValueFactory(new PropertyValueFactory<FactureCltGestionList, String>("CodeCommande"));
|
||||
|
||||
TabColCreation.setStyle( "-fx-alignment: CENTER;");TabColCreation.getStyleClass().add("Center");
|
||||
TabColCreation.setCellValueFactory(new PropertyValueFactory<FactureCltGestionList, String>("DateCreation"));
|
||||
|
||||
TabColDetail.setStyle( "-fx-alignment: CENTER;");TabColDetail.getStyleClass().add("Center");
|
||||
TabColDetail.setCellFactory(new Callback<TableColumn<FactureCltGestionList, Boolean>, TableCell<FactureCltGestionList, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<FactureCltGestionList, Boolean> call(TableColumn<FactureCltGestionList, Boolean> personBooleanTableColumn) {
|
||||
return new ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
ButtonSearchFactureClt.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchFactureClt();
|
||||
}
|
||||
});
|
||||
|
||||
PaneFactureGestion.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchFactureClt();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
RadioComptant.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchFactureClt();
|
||||
}
|
||||
});
|
||||
|
||||
RadioFacilite.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchFactureClt();
|
||||
}
|
||||
});
|
||||
|
||||
SearchFactureClt();
|
||||
|
||||
GestionSearchFactureClt();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private class ButtonCell extends TableCell<FactureCltGestionList, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/detailbutton.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){ //Action when the button is pressed
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
try {
|
||||
// get Selected Item
|
||||
FactureCltGestionList current = (FactureCltGestionList) ButtonCell.this.getTableView().getItems().get(ButtonCell.this.getIndex());
|
||||
String code_facture = current.getCodeFacture();
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureClt/FactureCltDetail.fxml"));
|
||||
Parent NodeFactureCltDetail = (Parent)fxmlLoader.load();
|
||||
FactureCltDetailController FactureCltDetail= fxmlLoader.getController();
|
||||
FactureCltDetail.PaneSucces.setVisible(false);
|
||||
|
||||
FactureCltDetail.codeFactClt = code_facture;
|
||||
FactureCltDetail.SowDetailFactureClt(false);
|
||||
PaneFactureGestion.getChildren().clear();
|
||||
PaneFactureGestion.getChildren().add(NodeFactureCltDetail);
|
||||
FactureCltDetail.ButtonImprimerTraite.setVisible(false);
|
||||
} catch (IOException ex) {
|
||||
logger.error("FactureCltGestionController : FactureCltDetail.fxml :" + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void FactureCltAjouterButtonAction(ActionEvent event) throws IOException {
|
||||
PaneFactureGestion.getChildren().clear();
|
||||
PaneFactureGestion.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/FactureClt/FactureCltAjouter.fxml")));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchFactureClt()
|
||||
{
|
||||
ProgressBarFactureClt.setVisible(true);
|
||||
|
||||
ButtonSearchFactureClt.setDisable(true);
|
||||
|
||||
ThreadSearchFactureClt = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DateCreation = "";
|
||||
if(PickerDateCreation.getValue() != null){
|
||||
DateCreation = PickerDateCreation.getValue().toString();
|
||||
}
|
||||
|
||||
// 0comptant 1facilité
|
||||
String TypeRegement = "";
|
||||
if(RadioComptant.isSelected()){
|
||||
TypeRegement = "0";
|
||||
}else if(RadioFacilite.isSelected()){
|
||||
TypeRegement = "1";
|
||||
}
|
||||
|
||||
ObservableList<FactureCltGestionList> ListFactureClts = new FactureCltDB().SearchFactureCltGestion(
|
||||
position,
|
||||
nbrligne,
|
||||
TextFieldCodeFacture.getText(),
|
||||
TextFieldCodeClient.getText(),
|
||||
TypeRegement,
|
||||
TextFieldCodeCommande.getText(),
|
||||
DateCreation);
|
||||
|
||||
TableViewFactureCltListGestion.setItems(ListFactureClts);
|
||||
|
||||
totalcount = new FactureCltDB().nbrFactureCltGestion(TextFieldCodeFacture.getText(),
|
||||
TextFieldCodeClient.getText(),
|
||||
TypeRegement,
|
||||
TextFieldCodeCommande.getText(),
|
||||
DateCreation);
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchFactureClt.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarFactureClt.setVisible(false);
|
||||
ButtonSearchFactureClt.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchFactureClt.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchFactureClt(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarFactureClt.setVisible(true);
|
||||
|
||||
ButtonSearchFactureClt.setDisable(true);
|
||||
|
||||
ThreadSearchFactureClt = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateCreation = "";
|
||||
if(PickerDateCreation.getValue() != null){
|
||||
DateCreation = PickerDateCreation.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<FactureCltGestionList> ListFactureClts = new FactureCltDB().SearchFactureCltGestion(ParmPosition, ParamNbrligne, TextFieldCodeFacture.getText(), TextFieldCodeClient.getText(), "", TextFieldCodeCommande.getText(), DateCreation);
|
||||
|
||||
TableViewFactureCltListGestion.setItems(ListFactureClts);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchFactureClt.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarFactureClt.setVisible(false);
|
||||
ButtonSearchFactureClt.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchFactureClt.start();
|
||||
}
|
||||
|
||||
private void GestionSearchFactureClt()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchFactureClt(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchFactureClt(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchFactureClt(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchFactureClt(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchFactureClt(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,228 @@
|
||||
package Controllers.FactureClt;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Models.Client.Client;
|
||||
import Models.Client.ClientEntreprise;
|
||||
import Models.Client.ClientPassager;
|
||||
import Models.FactureClt.FactureClt;
|
||||
import Models.Produit.ListeProduit;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.print.PageRange;
|
||||
import javafx.print.PrinterJob;
|
||||
import javafx.scene.control.Control;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class FactureCltPrintController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneTotal;
|
||||
|
||||
@FXML public ImageView ImageViewLogo;
|
||||
|
||||
@FXML private Text TextSteNom;
|
||||
@FXML private Text TextSteAdress;
|
||||
@FXML private Text TextSteTeleFax;
|
||||
@FXML private Text TextSteIFCR;
|
||||
@FXML private Text TextSteRIB;
|
||||
@FXML private Text TextSteEmailSite;
|
||||
|
||||
@FXML private Text TextNumFacture;
|
||||
@FXML private Text TextDateFacture;
|
||||
@FXML private Text TextNumCommande;
|
||||
@FXML private Text TextPagination;
|
||||
|
||||
@FXML private Text TextCltNomPrenom;
|
||||
@FXML private Text TextCltTele;
|
||||
@FXML private Text TextCltAdress;
|
||||
|
||||
@FXML private Text TextDuplicata;
|
||||
|
||||
@FXML private TableView<ListeProduit> TableViewListeProduit ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColReference;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColDesignation;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColQuantite ;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColPrixHT;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColRemise;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTotalHT;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTVA;
|
||||
@FXML private TableColumn<ListeProduit ,String> TabColTotalTTC;
|
||||
|
||||
@FXML private Text TextTotalRemise;
|
||||
@FXML private Text TextTotalHT;
|
||||
@FXML private Text TextTotalTVA;
|
||||
@FXML private Text TextTimbre;
|
||||
@FXML private Text TextNetPayer;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
setImageLogo();
|
||||
|
||||
TextSteNom.setText(ParametreSystem.CompanyName);
|
||||
TextSteAdress.setText(ParametreSystem.CompanyAddress);
|
||||
TextSteTeleFax.setText(ParametreSystem.CompanyTele+" | Fax: "+ParametreSystem.CompanyFax);
|
||||
TextSteIFCR.setText(ParametreSystem.CompanyIF+" | M.F: "+ParametreSystem.CompanyMF);
|
||||
TextSteRIB.setText(ParametreSystem.RIB);
|
||||
TextSteEmailSite.setText(ParametreSystem.CompanyMail+" | Site:"+ParametreSystem.CompanySite);
|
||||
|
||||
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColReference.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColReference.getStyleClass().add("Center");
|
||||
|
||||
TabColDesignation.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
TabColDesignation.setCellFactory(new Callback<TableColumn<ListeProduit,String>,TableCell<ListeProduit,String>>(){
|
||||
@Override
|
||||
public TableCell<ListeProduit, String> call(TableColumn<ListeProduit, String> param) {
|
||||
TableCell<ListeProduit, String> cell = new TableCell<ListeProduit, String>(){
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
if (item == null) {
|
||||
super.setText(null);
|
||||
super.setGraphic(null);
|
||||
} else {
|
||||
String newItem = item.trim().toLowerCase();
|
||||
Text text = new Text(newItem);
|
||||
super.setPrefHeight(Control.USE_COMPUTED_SIZE);
|
||||
text.wrappingWidthProperty().bind(super.widthProperty());
|
||||
super.setGraphic(text);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColRemise.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColRemise.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColRemise.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColTotalTTC.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalTTC.getStyleClass().add("Center");
|
||||
|
||||
TabColReference.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColQuantite.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColRemise.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
}
|
||||
|
||||
|
||||
public void setFactureClt(FactureClt factureClt, boolean duplicata)
|
||||
{
|
||||
if(duplicata){
|
||||
TextDuplicata.setVisible(true);
|
||||
}else{
|
||||
TextDuplicata.setVisible(false);
|
||||
}
|
||||
|
||||
TableViewListeProduit.setItems(factureClt.getListeproduit());
|
||||
|
||||
TextNumFacture.setText(factureClt.getCodeFactureClt());
|
||||
TextDateFacture.setText(Adaptateur.NormalDateFormat(factureClt.getDateFacture()));
|
||||
TextNumCommande.setText(factureClt.getIdCommandeClt());
|
||||
TextPagination.setText("1/1");
|
||||
|
||||
//0 Personne 1 Entreprise 2 Passager
|
||||
if(factureClt.getTypeClient() == 0){
|
||||
Client client = factureClt.getCltPersonne();
|
||||
TextCltNomPrenom.setText(client.getNom()+" "+client.getPrenom());
|
||||
TextCltTele.setText(client.getTelefixString());
|
||||
TextCltAdress.setText(client.getAdresse());
|
||||
}else if(factureClt.getTypeClient() == 1){
|
||||
ClientEntreprise entreprise = factureClt.getCltEntreprise();
|
||||
TextCltNomPrenom.setText(entreprise.getNom());
|
||||
TextCltTele.setText(entreprise.getTele1String());
|
||||
TextCltAdress.setText(entreprise.getAdresse());
|
||||
}else if(factureClt.getTypeClient() == 2){
|
||||
ClientPassager passager = factureClt.getCltPassager();
|
||||
TextCltNomPrenom.setText(passager.getNom()+" "+passager.getPrenom());
|
||||
TextCltTele.setText(passager.getTelefixString());
|
||||
TextCltAdress.setText(passager.adresse);
|
||||
}
|
||||
|
||||
TextTotalRemise.setText(Adaptateur.StringToStringEspace(factureClt.getRemise()));
|
||||
TextTotalHT.setText(Adaptateur.StringToStringEspace(factureClt.getTotalHorsTaxNet()));
|
||||
TextTotalTVA.setText(Adaptateur.StringToStringEspace(factureClt.getTotalTVA()));
|
||||
TextTimbre.setText(Adaptateur.StringToStringEspace(factureClt.getTimbre()));
|
||||
TextNetPayer.setText(Adaptateur.StringToStringEspace(factureClt.getNetAPayer()));
|
||||
|
||||
}
|
||||
|
||||
private void setImageLogo()
|
||||
{
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
try {
|
||||
// optional, but recommended
|
||||
// process XML securely, avoid attacks like XML External Entities (XXE)
|
||||
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
|
||||
// parse XML file
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
|
||||
//PowerERP\conf\logo.xml
|
||||
Document doc = db.parse(new File("./conf/logo.xml"));
|
||||
|
||||
doc.getDocumentElement().normalize();
|
||||
|
||||
Element elementCNX = (Element) doc.getElementsByTagName("FactureCltPrint").item(0);
|
||||
|
||||
String pathLogo = elementCNX.getElementsByTagName("PathImage").item(0).getTextContent();
|
||||
FileInputStream fis = new FileInputStream(pathLogo);
|
||||
ImageViewLogo.setImage(new Image(fis));
|
||||
|
||||
ImageViewLogo.setFitWidth(Double.parseDouble(elementCNX.getElementsByTagName("FitWidth").item(0).getTextContent()));
|
||||
ImageViewLogo.setFitHeight(Double.parseDouble(elementCNX.getElementsByTagName("FitHeight").item(0).getTextContent()));
|
||||
ImageViewLogo.setLayoutX(Double.parseDouble(elementCNX.getElementsByTagName("LayoutX").item(0).getTextContent()));
|
||||
ImageViewLogo.setLayoutY(Double.parseDouble(elementCNX.getElementsByTagName("LayoutY").item(0).getTextContent()));
|
||||
}
|
||||
catch (ParserConfigurationException | SAXException | IOException e) {
|
||||
System.out.println("error AuthentificationController/setImageLogo "+e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,680 @@
|
||||
package Controllers.FactureFrs;
|
||||
|
||||
import Controllers.CommandeClt.CommandeCltPasserController;
|
||||
import Controllers.Dialog.MessageControle;
|
||||
import Controllers.Produit.RechercherProduitController;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.FactureFrs.FactureFrs;
|
||||
import Models.FactureFrs.FactureFrsDB;
|
||||
import Models.Fournisseur.Fournisseur;
|
||||
import Models.Fournisseur.FournisseurDB;
|
||||
import Models.Produit.ListeProduit;
|
||||
import Models.Produit.Produit;
|
||||
import Models.Produit.ProduitDB;
|
||||
import Models.Stock.StockDB;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import javafx.application.Platform;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.ProgressIndicator;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
import org.controlsfx.control.textfield.TextFields;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class FactureFrsAjouterController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(FactureFrsAjouterController.class.getName());
|
||||
|
||||
@FXML public AnchorPane PaneFactureFrsAjouter ;
|
||||
|
||||
@FXML public Text TotalTVA ;
|
||||
@FXML public Text Remise ;
|
||||
@FXML public Text NetAPayer ;
|
||||
@FXML public Text Timbre ;
|
||||
@FXML public Text TotalHTNet ;
|
||||
|
||||
@FXML public Button RechercheProduit ;
|
||||
@FXML public Button ButtonFactureFrsAjouter;
|
||||
|
||||
@FXML public TableView<ListeProduit> TableViewListeProduit ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColReference;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDesignaton;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColQuantite ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColPrixHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTotalHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColRemise;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTVA;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTotalTTC;
|
||||
@FXML public TableColumn<ListeProduit ,Boolean> TabColAddAction ;
|
||||
|
||||
|
||||
@FXML public TextField TextFieldNumero ;
|
||||
@FXML public TextField TextFieldTransporteur ;
|
||||
@FXML public TextField TextFieldHeur ;
|
||||
@FXML private TextField TextFieldFournisseur ;
|
||||
@FXML public DatePicker DatePickerDateReception;
|
||||
|
||||
|
||||
|
||||
@FXML public ChoiceBox ChoiceBoxLocalReception ;
|
||||
|
||||
@FXML public Text TextNumero ;
|
||||
@FXML public Text TextHeur ;
|
||||
@FXML public Text TextDateReception;
|
||||
@FXML public Text TextFournisseur ;
|
||||
@FXML public Text TextLocalReception ;
|
||||
|
||||
@FXML public ProgressIndicator ProgressIndicatorSaveFactureFrs ;
|
||||
|
||||
|
||||
public ObservableList<ListeProduit> ListProd = FXCollections.observableArrayList();
|
||||
Produit produit= new Produit();
|
||||
ProduitDB produitDB= new ProduitDB();
|
||||
contro Controle = new contro();
|
||||
|
||||
public ArrayList<String> ListFournisseur = new ArrayList<>();
|
||||
public ArrayList<String> ListLocale = new ArrayList<>();
|
||||
|
||||
float netaPayer = 0;
|
||||
float Remises = 0;
|
||||
float totalTVA = 0;
|
||||
float total_H_T_Net= 0;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
DatePickerDateReception.setValue(LocalDate.now());
|
||||
TextFieldHeur.setText(LocalDateTime.now().getHour()+":"+LocalDateTime.now().getMinute());
|
||||
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColDesignaton.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColRemise.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColRemise.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColRemise.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTotalTTC.getStyleClass().add("Center");
|
||||
|
||||
TabColReference.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColQuantite.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
TabColRemise.setCellFactory(TextFieldTableCell.<ListeProduit>forTableColumn());
|
||||
|
||||
TabColAddAction.setSortable(true);
|
||||
TabColAddAction.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<ListeProduit, Boolean>,
|
||||
ObservableValue<Boolean>>() {
|
||||
@Override
|
||||
public ObservableValue<Boolean> call(TableColumn.CellDataFeatures<ListeProduit, Boolean> p) {
|
||||
return new SimpleBooleanProperty(p.getValue() != null);
|
||||
}
|
||||
});
|
||||
|
||||
// create a cell value factory with an add button for each row in the table.
|
||||
TabColAddAction.setCellFactory(new Callback<TableColumn<ListeProduit, Boolean>, TableCell<ListeProduit, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<ListeProduit, Boolean> call(TableColumn<ListeProduit, Boolean> personBooleanTableColumn) {
|
||||
return new FactureFrsAjouterController.ButtonCell();
|
||||
}
|
||||
});
|
||||
TabColAddAction.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColAddAction.getStyleClass().add("Center");
|
||||
|
||||
StockDB Stock = new StockDB();
|
||||
ListLocale = Stock.getAllListLocal();
|
||||
ChoiceBoxLocalReception.getItems().addAll(ListLocale);
|
||||
|
||||
ListFournisseur = new FournisseurDB().getIdNomFournisseur();
|
||||
TextFields.bindAutoCompletion(TextFieldFournisseur, ListFournisseur);
|
||||
|
||||
|
||||
this.ReferenceMouseClick();
|
||||
this.QantiteMouseClick();
|
||||
this.RemiseMouseClick();
|
||||
|
||||
TabColAddAction.setSortable(true);
|
||||
TabColAddAction.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<ListeProduit, Boolean>,
|
||||
ObservableValue<Boolean>>() {
|
||||
@Override
|
||||
public ObservableValue<Boolean> call(TableColumn.CellDataFeatures<ListeProduit, Boolean> p) {
|
||||
return new SimpleBooleanProperty(p.getValue() != null);
|
||||
}
|
||||
});
|
||||
|
||||
// create a cell value factory with an add button for each row in the table.
|
||||
TabColAddAction.setCellFactory(new Callback<TableColumn<ListeProduit, Boolean>, TableCell<ListeProduit, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<ListeProduit, Boolean> call(TableColumn<ListeProduit, Boolean> personBooleanTableColumn) {
|
||||
return new FactureFrsAjouterController.ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
TableViewListeProduit.setItems(ListProd);
|
||||
|
||||
|
||||
//Ajouter une ligne vide clors ce que en click sur la tableview
|
||||
TableViewListeProduit.setOnMouseClicked(new EventHandler<javafx.scene.input.MouseEvent>(){
|
||||
public void handle(MouseEvent event){
|
||||
int nbrligne = TableViewListeProduit.getItems().size() ;
|
||||
if(nbrligne == 0){
|
||||
ListProd.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduit.setItems(ListProd);
|
||||
}
|
||||
else{
|
||||
ListeProduit Liste = TableViewListeProduit.getItems().get(nbrligne - 1);
|
||||
if(!Liste.getTotalTTC().isEmpty()){
|
||||
ListProd.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduit.setItems(ListProd);
|
||||
TableViewListeProduit.getSelectionModel().select(nbrligne);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ButtonFactureFrsAjouter.setOnAction(new EventHandler<ActionEvent>() { //supprimer le message du suucés et reaficher les formulaires
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
|
||||
ButtonFactureFrsAjouter.setText("");
|
||||
ButtonFactureFrsAjouter.setDisable(true);
|
||||
ProgressIndicatorSaveFactureFrs.setVisible(true);
|
||||
|
||||
if( Controle.ContrNumeriqueNotnull(TextFieldNumero, TextNumero) &&
|
||||
Controle.ContrNull(TextFieldFournisseur, TextFournisseur) &&
|
||||
Controle.ContrNullDatePicker(DatePickerDateReception, TextDateReception) &&
|
||||
Controle.ContrHour(TextFieldHeur, TextHeur) &&
|
||||
Controle.ContrNullValue(ChoiceBoxLocalReception, TextLocalReception)
|
||||
){
|
||||
|
||||
Runnable task = new Runnable(){// Create a Runnable
|
||||
public void run(){
|
||||
Platform.runLater(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
String Numero = TextFieldNumero.getText();
|
||||
String IdFournisseur = TextFieldFournisseur.getText().split(" - ", -1)[0];
|
||||
FactureFrsDB FactureDB = new FactureFrsDB();
|
||||
String IdFactureFrs = FactureDB.getFactureFrs(null, Numero, IdFournisseur).getIdFactureFrs();
|
||||
if(IdFactureFrs != null){
|
||||
TextFieldNumero.setStyle("-fx-border-color:#f20606;");
|
||||
TextNumero.setText("Facture Fournisseur existe déja");
|
||||
}else{
|
||||
if(ListProd.size()>0){
|
||||
FactureFrs FactureFrs = SetFacture();
|
||||
FactureDB.setFactureFrsDB(FactureFrs);
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureFrs/FactureFrsDetail.fxml"));
|
||||
Parent ParentFxmlFournisseur = (Parent)fxmlLoader.load();
|
||||
|
||||
FactureFrsDetailController FactureFrsDetail = fxmlLoader.getController();
|
||||
FactureFrsDetail.setDataFactureDetailFrs(FactureFrs.getIdFactureFrs());
|
||||
FactureFrsDetail.PaneSucessFrs.setVisible(true);
|
||||
PaneFactureFrsAjouter.getChildren().clear();
|
||||
PaneFactureFrsAjouter.getChildren().add(ParentFxmlFournisseur);
|
||||
|
||||
}catch (IOException ex) {
|
||||
logger.error("FactureFrsAjouterController : FactureFrsDetail.fxml :" + ex.getMessage());
|
||||
}
|
||||
}else{
|
||||
final MessageControle messagecontrol = new MessageControle();
|
||||
Text text3 = new Text();
|
||||
text3.setText("Vous devez ajouter au moin un produit à la liste des produits");
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 13));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
messagecontrol.ShowNotification();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Thread backgroundThread = new Thread(task);// Run the task in a background thread
|
||||
backgroundThread.setDaemon(true);// Terminate the running thread if the application exits
|
||||
backgroundThread.start();// Start the thread
|
||||
}
|
||||
|
||||
ButtonFactureFrsAjouter.setText("Enregister La Facture");
|
||||
ButtonFactureFrsAjouter.setDisable(false);
|
||||
ProgressIndicatorSaveFactureFrs.setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public FactureFrs SetFacture(){
|
||||
FactureFrs Facture = new FactureFrs();
|
||||
|
||||
if(!TextFieldFournisseur.getText().equals("")){
|
||||
String[] Fournisseur = TextFieldFournisseur.getText().split(" - ", -1);
|
||||
Fournisseur Frs = new Fournisseur();
|
||||
Frs.setCode(Fournisseur[0]);
|
||||
Frs.setNom(Fournisseur[1]);
|
||||
Facture.setFournisseur(Frs);
|
||||
}
|
||||
|
||||
if(ChoiceBoxLocalReception.getValue() != null){
|
||||
Facture.setLocal(ChoiceBoxLocalReception.getValue().toString());
|
||||
}
|
||||
|
||||
if(DatePickerDateReception.getValue() != null){
|
||||
Facture.setDateCreation(DatePickerDateReception.getValue().toString());
|
||||
}
|
||||
|
||||
Facture.setNumero(TextFieldNumero.getText());
|
||||
Facture.setHeurCreation(TextFieldHeur.getText());
|
||||
Facture.setTotalHorsTaxNet(Adaptateur.floatDeleZero(total_H_T_Net));
|
||||
Facture.setTotalTVA(Adaptateur.floatDeleZero(totalTVA));
|
||||
Facture.setRemise(Adaptateur.floatDeleZero(Remises));
|
||||
Facture.setNetAPayer(Adaptateur.floatDeleZero(netaPayer));
|
||||
Facture.setTimbre(Timbre.getText());
|
||||
Facture.setListProduit(ListProd);
|
||||
Facture.setTypeReglement(null);
|
||||
Facture.setEtatReglement(null);
|
||||
|
||||
|
||||
return Facture;
|
||||
}
|
||||
|
||||
|
||||
public void getFacture(FactureFrs Facture){
|
||||
|
||||
TextFieldNumero.setText(Facture.getNumero());
|
||||
TextFieldHeur.setText(Facture.getHeurCreation());
|
||||
DatePickerDateReception.setValue(Adaptateur.StringToLocalDate(Facture.getDateCreation()));
|
||||
|
||||
Fournisseur Frs = Facture.getFournisseur();
|
||||
if(Frs != null){
|
||||
TextFieldFournisseur.setText(Frs.getCode()+" - "+Frs.getNom());
|
||||
}
|
||||
|
||||
String Local = Facture.getLocal();
|
||||
if(Local != null){
|
||||
int indexLocale = ListLocale.indexOf(Local);
|
||||
ChoiceBoxLocalReception.getSelectionModel().select(indexLocale);
|
||||
}
|
||||
}
|
||||
|
||||
//Define the button cell
|
||||
private class ButtonCell extends TableCell<ListeProduit, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-danger");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/icondelete.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
//Action when the button is pressed
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
int selectdIndex = getTableRow().getIndex();
|
||||
ListProd.remove(selectdIndex);
|
||||
CalculeListeProduit();
|
||||
TableViewListeProduit.setStyle(".table-row-cell:selected{ -fx-background-color:transparent ;}");
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@FXML
|
||||
private void AddLigneButtonAction(ActionEvent event) throws IOException {
|
||||
int nbrligne = TableViewListeProduit.getItems().size() ;
|
||||
if(nbrligne == 0){
|
||||
ListProd.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduit.setItems(ListProd);
|
||||
}
|
||||
else{
|
||||
ListeProduit Liste = TableViewListeProduit.getItems().get(nbrligne - 1);
|
||||
if(!Liste.getTotalTTC().isEmpty()){
|
||||
ListProd.add(new ListeProduit("","","","","","","",""));
|
||||
TableViewListeProduit.setItems(ListProd);
|
||||
TableViewListeProduit.getSelectionModel().select(nbrligne);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ReferenceMouseClick(){
|
||||
TabColReference.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ListeProduit, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ListeProduit, String> t) {
|
||||
produit = produitDB.getProduit(t.getNewValue());
|
||||
if(produit.getReference() != null){
|
||||
ListeProduit Liste = new ListeProduit(produit.getReference(),produit.getDesignation(),"1",produit.getPrixachatht(),"0","",produit.getTvaachat(),"0");
|
||||
AffectationTableView(Liste,t.getTablePosition().getRow()) ;
|
||||
}
|
||||
else{
|
||||
AffectationTableView(new ListeProduit("","","","","","","",""),t.getTablePosition().getRow()) ;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void QantiteMouseClick(){
|
||||
TabColQuantite.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ListeProduit, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ListeProduit, String> t) {
|
||||
String newquantite = t.getNewValue() ;
|
||||
try{
|
||||
newquantite = newquantite.replace(',','.');
|
||||
if(Float.parseFloat(newquantite)<1){
|
||||
newquantite = "1";
|
||||
}
|
||||
}
|
||||
catch(NumberFormatException nfe){
|
||||
newquantite = "1";
|
||||
}
|
||||
|
||||
ListeProduit Liste = t.getRowValue() ;
|
||||
|
||||
if(Liste.getReference().isEmpty()){ //le cas en ajoute un quantité dans un ligne vide
|
||||
TableViewListeProduit.getColumns().get(t.getTablePosition().getRow()).setVisible(false);
|
||||
TableViewListeProduit.getColumns().get(t.getTablePosition().getRow()).setVisible(true);
|
||||
}
|
||||
else{
|
||||
Liste.setQuantite(newquantite);
|
||||
ListeProduit NewList = new ListeProduit(Liste.getReference(),Liste.getDesignation(), newquantite,Liste.getPrixHT(), Liste.getRemise(),"",Liste.getTVA(),"");
|
||||
//NewList = CalculeProduit(NewList);
|
||||
AffectationTableView(NewList,t.getTablePosition().getRow()) ;
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void RemiseMouseClick(){
|
||||
TabColRemise.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ListeProduit, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ListeProduit, String> t) {
|
||||
String newRemise = t.getNewValue() ;
|
||||
try{
|
||||
newRemise = newRemise.replace(',','.');
|
||||
if(Float.parseFloat(newRemise)<0){
|
||||
newRemise = "0";
|
||||
}
|
||||
}
|
||||
catch(NumberFormatException nfe){
|
||||
newRemise = "0";
|
||||
}
|
||||
|
||||
ListeProduit Liste = t.getRowValue() ;
|
||||
|
||||
if(Liste.getReference().isEmpty()){ //le cas en ajoute un remise dans un ligne vide
|
||||
TableViewListeProduit.getColumns().get(t.getTablePosition().getRow()).setVisible(false);
|
||||
TableViewListeProduit.getColumns().get(t.getTablePosition().getRow()).setVisible(true);
|
||||
}
|
||||
else{
|
||||
Liste.setRemise(newRemise);
|
||||
ListeProduit NewList = new ListeProduit(Liste.getReference(),Liste.getDesignation(), Liste.getQuantite(),Liste.getPrixHT(), newRemise, "", Liste.getTVA(), "");
|
||||
AffectationTableView(NewList, t.getTablePosition().getRow());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
private void AffectationTableView(ListeProduit ListeProd, int EmplacementLigne){
|
||||
boolean result = false ;
|
||||
int indise=0;
|
||||
int Position = 0;
|
||||
|
||||
if(ListProd.size()>0){
|
||||
do{ //Vérifier si le produit exsiste deja
|
||||
if(ListProd.get(indise).getReference().equals(ListeProd.getReference())){
|
||||
result = true ;
|
||||
Position = indise ;
|
||||
//System.out.println("existe Position:"+indise);
|
||||
}
|
||||
indise++;
|
||||
}while(ListProd.size()>indise && !result);
|
||||
|
||||
if(result){ //si la ligne exsite déja
|
||||
if(EmplacementLigne!= -1){
|
||||
if(Position == EmplacementLigne){
|
||||
ListProd.set(Position, ListeProd);
|
||||
}
|
||||
else{
|
||||
ListProd.set(EmplacementLigne, new ListeProduit("","","","","","","",""));
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(EmplacementLigne!= -1){
|
||||
ListProd.set(EmplacementLigne, ListeProd);
|
||||
}else{
|
||||
ListProd.add(ListeProd);
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
ListProd.add(ListeProd);
|
||||
}
|
||||
|
||||
CalculeListeProduit();
|
||||
|
||||
TableViewListeProduit.setItems(ListProd);
|
||||
TableViewListeProduit.setVisible(false);
|
||||
TableViewListeProduit.setVisible(true);
|
||||
}
|
||||
|
||||
private void CalculeListeProduit(){ //calculer et afficher la détail des produits
|
||||
netaPayer = 0;
|
||||
Remises = 0;
|
||||
totalTVA = 0;
|
||||
total_H_T_Net= 0;
|
||||
|
||||
TotalTVA.setText("");
|
||||
Remise.setText("");
|
||||
NetAPayer.setText("");
|
||||
Timbre.setText("");
|
||||
TotalHTNet.setText("");
|
||||
|
||||
//calcule
|
||||
for(ListeProduit liste : ListProd){
|
||||
float totaht = Adaptateur.StringToFloat(liste.getTotalHT()) ;
|
||||
float prix_U_H_T = Adaptateur.StringToFloat(liste.getPrixHT()) ;
|
||||
float remises = Adaptateur.StringToFloat(liste.getRemise().replace("%", "")) ;
|
||||
float tva = Adaptateur.StringToFloat(liste.getTVA().replace("%", ""));
|
||||
float qte = Adaptateur.StringToFloat(liste.getQuantite());
|
||||
|
||||
totalTVA = totalTVA + ((totaht * tva) /100) ;
|
||||
Remises = Remises + (prix_U_H_T * remises)/100 ;
|
||||
total_H_T_Net = total_H_T_Net + totaht ;
|
||||
}
|
||||
|
||||
if(total_H_T_Net>0){
|
||||
float timbre = Adaptateur.StringToFloat(ParametreSystem.Timbre);
|
||||
netaPayer = total_H_T_Net + totalTVA + timbre ;
|
||||
TotalTVA.setText(Adaptateur.FloatToStringEspace(totalTVA));
|
||||
Remise.setText(Adaptateur.FloatToStringEspace(Remises));
|
||||
NetAPayer.setText(Adaptateur.FloatToStringEspaceCurrency(netaPayer));
|
||||
Timbre.setText(ParametreSystem.Timbre);
|
||||
TotalHTNet.setText(Adaptateur.FloatToStringEspace(total_H_T_Net));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Object[] getDefaultSaveDataImport(){
|
||||
Object[] ArrayObject = new Object[10];
|
||||
ArrayObject[0] = this.ListProd;
|
||||
ArrayObject[1] = SetFacture();
|
||||
return ArrayObject;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void SetDefaultSaveDataImport(Object[] ArrayObject){
|
||||
if(ArrayObject[0] != null){
|
||||
this.ListProd = (ObservableList<ListeProduit>) ArrayObject[0];
|
||||
this.CalculeListeProduit();
|
||||
this.TableViewListeProduit.setItems(ListProd);
|
||||
}
|
||||
if(ArrayObject[1] != null){
|
||||
FactureFrs Facture = (FactureFrs) ArrayObject[1];
|
||||
getFacture(Facture);
|
||||
}
|
||||
|
||||
if(ArrayObject[6] != null){
|
||||
this.SetProduit( (Produit) ArrayObject[6] );
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void RechercheProduitButtonAction(ActionEvent event) throws IOException {
|
||||
|
||||
final RechercherProduitController rechercheproduit = new RechercherProduitController(false);
|
||||
|
||||
rechercheproduit.ArrayObjectDataSave = this.getDefaultSaveDataImport();
|
||||
|
||||
rechercheproduit.Show();
|
||||
|
||||
rechercheproduit.TabColAction.setCellFactory(new Callback<TableColumn<Produit, String>, TableCell<Produit, String>>() {
|
||||
@Override
|
||||
public TableCell<Produit, String> call(TableColumn<Produit, String> paramP) {
|
||||
return new TableCell<Produit, String>() {
|
||||
final Button cellButton = new Button("");
|
||||
{
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconaffecter.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent arg0) {
|
||||
try {
|
||||
// get Selected ItemButtonCell
|
||||
rechercheproduit.ArrayObjectDataSave[6] = ((Produit)getTableRow().getItem());
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureFrs/FactureFrsAjouter.fxml"));
|
||||
Parent ParentBonReceptionAjouterFXML = (Parent) fxmlLoader.load();
|
||||
|
||||
FactureFrsAjouterController FactureFrsAjouter = fxmlLoader.getController();
|
||||
|
||||
FactureFrsAjouter.SetDefaultSaveDataImport(rechercheproduit.ArrayObjectDataSave);
|
||||
|
||||
|
||||
MyWindow mywindows = new MyWindow();
|
||||
mywindows.Refresh(ParentBonReceptionAjouterFXML, 2);
|
||||
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.error("FactureFrsAjouterController : FactureFrsAjouter.fxml :" + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
protected void updateItem(String paramT, boolean isEmpty) {
|
||||
super.updateItem(paramT, isEmpty);
|
||||
if (!isEmpty) {
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void SetProduit(Produit produit){
|
||||
|
||||
//Supprimer les igne vide
|
||||
if((ListProd.size()>0) && (ListProd.get(ListProd.size()-1).getReference().isEmpty())){
|
||||
ListProd.remove(ListProd.size()-1);
|
||||
}
|
||||
|
||||
if(produit != null){
|
||||
ListeProduit ListeProd = new ListeProduit(produit.getReference(),produit.getDesignation(),"1",produit.getPrixachatht(),"0",produit.getPrixachatttc(),produit.getTvaachat(),"0");
|
||||
AffectationTableView(ListeProd,-1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,632 @@
|
||||
|
||||
package Controllers.FactureFrs;
|
||||
|
||||
import Controllers.Dialog.MessageControle;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.BonReceptionFrs.BonReceptionDB;
|
||||
import Models.BonReceptionFrs.BonReceptionFrs;
|
||||
import Models.BonReceptionFrs.BonReceptionList;
|
||||
import Models.BonReceptionFrs.BonReceptionProduitList;
|
||||
import Models.FactureFrs.FactureFrs;
|
||||
import Models.FactureFrs.FactureFrsDB;
|
||||
import Models.Fournisseur.Fournisseur;
|
||||
import Models.Fournisseur.FournisseurDB;
|
||||
import Models.Produit.ListeProduit;
|
||||
import Models.Stock.StockDB;
|
||||
import Models.User.Profile;
|
||||
import Models.User.User;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.ProgressIndicator;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
import org.controlsfx.control.textfield.TextFields;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
*
|
||||
* @author Maher
|
||||
*/
|
||||
public class FactureFrsBonReceptionAjouterController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(FactureFrsBonReceptionAjouterController.class.getName());
|
||||
|
||||
@FXML public AnchorPane PaneFactureBRFrsAjouter ;
|
||||
|
||||
@FXML public TableView<BonReceptionList> TableViewBonReception ;
|
||||
@FXML public TableColumn<BonReceptionList ,String> TabColReference;
|
||||
@FXML public TableColumn<BonReceptionList ,String> TabColFournisseur;
|
||||
@FXML public TableColumn<BonReceptionList ,String> TabColDate;
|
||||
@FXML public TableColumn<BonReceptionList ,String> TabColLocalReception;
|
||||
@FXML public TableColumn<BonReceptionList ,String> TabColNetPayer;
|
||||
@FXML public TableColumn<BonReceptionList ,Boolean> TabColRechAddAction;
|
||||
|
||||
|
||||
@FXML public TableView<BonReceptionList> TableViewBonReceptionSelected;
|
||||
@FXML public TableColumn<BonReceptionList ,String> TabColReferenceSelected;
|
||||
@FXML public TableColumn<BonReceptionList ,String> TabColFournisseurSelected;
|
||||
@FXML public TableColumn<BonReceptionList ,String> TabColDateSelected;
|
||||
@FXML public TableColumn<BonReceptionList ,String> TabColLocalReceptionSelected;
|
||||
@FXML public TableColumn<BonReceptionList ,String> TabColNetPayerSelected;
|
||||
@FXML public TableColumn<BonReceptionList ,Boolean> TabColSupprimer;
|
||||
|
||||
@FXML public TextField TextFieldNumero ;
|
||||
@FXML public TextField TextFieldNetPayer ;
|
||||
@FXML private TextField TextFieldFournisseur ;
|
||||
@FXML public ChoiceBox ChoiceBoxLocalReception ;
|
||||
@FXML public DatePicker DatePickerDateReception;
|
||||
|
||||
@FXML public TextField TextFieldNumeroFac ;
|
||||
@FXML public TextField TextFieldHeurFac ;
|
||||
@FXML public DatePicker DatePickerDateFac;
|
||||
@FXML public Text TextCltNumeroFac ;
|
||||
@FXML public Text TextCltHeurFac ;
|
||||
@FXML public Text TextCltDateFac ;
|
||||
|
||||
@FXML public Text TextTotalFacture;
|
||||
|
||||
|
||||
@FXML public Button ButtonFactureBLAjouter;
|
||||
@FXML public ProgressIndicator ProgressIndicatorBonReception;
|
||||
@FXML public ProgressIndicator ProgressIndicatorSaveFactureBLAjouter;
|
||||
|
||||
public ArrayList<String> ListFournisseur = new ArrayList<>();
|
||||
public ArrayList<String> ListLocale = new ArrayList<>();
|
||||
|
||||
ObservableList<BonReceptionList> ObservableListBonReception = FXCollections.observableArrayList();
|
||||
|
||||
BonReceptionDB BonRecepDB= new BonReceptionDB();
|
||||
|
||||
contro Controle = new contro();
|
||||
|
||||
String StringSeleFournissuer ;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<BonReceptionList, String>("Numero"));
|
||||
|
||||
TabColFournisseur.setCellValueFactory(new PropertyValueFactory<BonReceptionList, String>("Fournisseur"));
|
||||
TabColFournisseur.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColFournisseur.getStyleClass().add("Center");
|
||||
|
||||
TabColDate.setCellValueFactory(new PropertyValueFactory<BonReceptionList, String>("Date"));
|
||||
TabColDate.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDate.getStyleClass().add("Center");
|
||||
|
||||
TabColNetPayer.setCellValueFactory(new PropertyValueFactory<BonReceptionList, String>("NetPayer"));
|
||||
TabColNetPayer.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNetPayer.getStyleClass().add("Center");
|
||||
|
||||
TabColLocalReception.setCellValueFactory(new PropertyValueFactory<BonReceptionList, String>("LocalReception"));
|
||||
TabColLocalReception.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColLocalReception.getStyleClass().add("Center");
|
||||
|
||||
TabColRechAddAction.setSortable(true);
|
||||
TabColRechAddAction.setStyle( "-fx-alignment: CENTER;");
|
||||
|
||||
TabColRechAddAction.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<BonReceptionList, Boolean>,
|
||||
ObservableValue<Boolean>>() {
|
||||
@Override
|
||||
public ObservableValue<Boolean> call(TableColumn.CellDataFeatures<BonReceptionList, Boolean> p) {
|
||||
return new SimpleBooleanProperty(p.getValue() != null);
|
||||
}
|
||||
});
|
||||
|
||||
// create a cell value factory with an add button for each row in the table.
|
||||
TabColRechAddAction.setCellFactory(new Callback<TableColumn<BonReceptionList, Boolean>, TableCell<BonReceptionList, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<BonReceptionList, Boolean> call(TableColumn<BonReceptionList, Boolean> personBooleanTableColumn) {
|
||||
return new FactureFrsBonReceptionAjouterController.ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
TabColReferenceSelected.setCellValueFactory(new PropertyValueFactory<BonReceptionList, String>("Numero"));
|
||||
|
||||
TabColFournisseurSelected.setCellValueFactory(new PropertyValueFactory<BonReceptionList, String>("Fournisseur"));
|
||||
TabColFournisseurSelected.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColFournisseurSelected.getStyleClass().add("Center");
|
||||
|
||||
TabColDateSelected.setCellValueFactory(new PropertyValueFactory<BonReceptionList, String>("Date"));
|
||||
TabColDateSelected.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDateSelected.getStyleClass().add("Center");
|
||||
|
||||
TabColNetPayerSelected.setCellValueFactory(new PropertyValueFactory<BonReceptionList, String>("NetPayer"));
|
||||
TabColNetPayerSelected.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNetPayerSelected.getStyleClass().add("Center");
|
||||
|
||||
TabColLocalReceptionSelected.setCellValueFactory(new PropertyValueFactory<BonReceptionList, String>("LocalReception"));
|
||||
TabColLocalReceptionSelected.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColLocalReceptionSelected.getStyleClass().add("Center");
|
||||
|
||||
TabColSupprimer.setSortable(true);
|
||||
TabColSupprimer.setStyle( "-fx-alignment: CENTER;");
|
||||
|
||||
TabColSupprimer.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<BonReceptionList, Boolean>,
|
||||
ObservableValue<Boolean>>() {
|
||||
@Override
|
||||
public ObservableValue<Boolean> call(TableColumn.CellDataFeatures<BonReceptionList, Boolean> p) {
|
||||
return new SimpleBooleanProperty(p.getValue() != null);
|
||||
}
|
||||
});
|
||||
|
||||
// create a cell value factory with an add button for each row in the table.
|
||||
TabColSupprimer.setCellFactory(new Callback<TableColumn<BonReceptionList, Boolean>, TableCell<BonReceptionList, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<BonReceptionList, Boolean> call(TableColumn<BonReceptionList, Boolean> personBooleanTableColumn) {
|
||||
return new FactureFrsBonReceptionAjouterController.ButtonCellRemove();
|
||||
}
|
||||
});
|
||||
|
||||
ListFournisseur = new FournisseurDB().getIdNomFournisseur();
|
||||
TextFields.bindAutoCompletion(TextFieldFournisseur, ListFournisseur);
|
||||
|
||||
StockDB Stock = new StockDB();
|
||||
ListLocale = Stock.getAllListLocal();
|
||||
ChoiceBoxLocalReception.getItems().addAll(ListLocale);
|
||||
|
||||
DatePickerDateFac.setValue(LocalDate.now());
|
||||
TextFieldHeurFac.setText(LocalDateTime.now().getHour()+":"+LocalDateTime.now().getMinute());
|
||||
|
||||
RechecheBonReception();
|
||||
|
||||
getRechecheBonReception("");
|
||||
|
||||
AjouterFactureBL();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//Define the button cell
|
||||
private class ButtonCell extends TableCell<BonReceptionList, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconaffecter.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
//Action when the button is pressed
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
BonReceptionList BonReceptionListSelect = (BonReceptionList)getTableRow().getItem();
|
||||
AffectBonReception(BonReceptionListSelect);
|
||||
}
|
||||
});
|
||||
}
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Define the button cell
|
||||
private class ButtonCellRemove extends TableCell<BonReceptionList, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
|
||||
ButtonCellRemove(){
|
||||
cellButton.getStyleClass().add("btn-danger");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/icondelete.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
//Action when the button is pressed
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
int selectdIndex = getTableRow().getIndex();
|
||||
ObservableListBonReception.remove(selectdIndex);
|
||||
CalculeFacture();
|
||||
TableViewBonReceptionSelected.setItems(ObservableListBonReception);
|
||||
TableViewBonReceptionSelected.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void getRechecheBonReception(final String KeyWordSearch )
|
||||
{
|
||||
try {
|
||||
ProgressIndicatorBonReception.setVisible(true);
|
||||
TableViewBonReception.setVisible(false);
|
||||
|
||||
// Create a Runnable
|
||||
Runnable task = new Runnable(){
|
||||
public void run(){
|
||||
Platform.runLater(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
|
||||
TableViewBonReception.setItems(BonRecepDB.getBonReceptionNotFact(KeyWordSearch));
|
||||
ProgressIndicatorBonReception.setVisible(false);
|
||||
TableViewBonReception.setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Thread backgroundThread = new Thread(task); // Run the task in a background thread
|
||||
backgroundThread.setDaemon(true); // Terminate the running thread if the application exits
|
||||
backgroundThread.start(); // Start the thread
|
||||
|
||||
}catch (Exception ex) {
|
||||
System.err.println("Exception getRechecheBonReception \n"+ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private boolean ContrFournissuer()
|
||||
{
|
||||
final MessageControle messagecontrol = new MessageControle();
|
||||
Text text3 = new Text();
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 13));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
if(ObservableListBonReception.size()>0){
|
||||
boolean result = true ;
|
||||
StringSeleFournissuer = ObservableListBonReception.get(0).getFournisseur();
|
||||
int indise = 1;
|
||||
//Verifier si la produit exsiste déja
|
||||
while(indise<=ObservableListBonReception.size() && result){
|
||||
result = ObservableListBonReception.get(indise-1).getFournisseur().equals(StringSeleFournissuer);
|
||||
indise++;
|
||||
}
|
||||
|
||||
//si le fournisseur n'exsiste pas
|
||||
if(!result){
|
||||
text3.setText("Les fournisseurs sélectionnés sont différents");
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
messagecontrol.ShowNotification();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//si la facture existe déja
|
||||
String IdFournisseur = StringSeleFournissuer.split(" - ", -1)[0];
|
||||
FactureFrsDB FactureDB = new FactureFrsDB();
|
||||
|
||||
FactureFrs Facture = FactureDB.getFactureFrs(null, TextFieldNumeroFac.getText(), IdFournisseur);
|
||||
if(Facture.getIdFactureFrs() != null){
|
||||
text3.setText("Cette facture existe déja");
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
messagecontrol.ShowNotification();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else{
|
||||
//si la liste est vide
|
||||
text3.setText("Vous devez ajouter au moin un Bon Réception à la liste");
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
messagecontrol.ShowNotification();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void AjouterFactureBL()
|
||||
{
|
||||
ButtonFactureBLAjouter.setOnAction(new EventHandler<ActionEvent>() { //supprimer le message du suucés et reaficher les formulaires
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
|
||||
if( Controle.ContrNumeriqueNotnull(TextFieldNumeroFac, TextCltNumeroFac) &&
|
||||
ContrFournissuer() &&
|
||||
Controle.ContrHour(TextFieldHeurFac, TextCltHeurFac) &&
|
||||
Controle.ContrNullDatePicker(DatePickerDateFac, TextCltDateFac)){
|
||||
|
||||
|
||||
ButtonFactureBLAjouter.setText("");
|
||||
ButtonFactureBLAjouter.setDisable(true);
|
||||
ProgressIndicatorSaveFactureBLAjouter.setVisible(true);
|
||||
|
||||
Runnable task = new Runnable(){// Create a Runnable
|
||||
public void run(){
|
||||
Platform.runLater(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
|
||||
FactureFrs Facture = setFactureBRFrs();
|
||||
FactureFrsDB FactureDB = new FactureFrsDB();
|
||||
FactureDB.setFactureBRDB(Facture);
|
||||
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureFrs/FactureFrsDetail.fxml"));
|
||||
Parent ParentFxmlFournisseur = (Parent)fxmlLoader.load();
|
||||
|
||||
FactureFrsDetailController FactureFrsDetail = fxmlLoader.getController();
|
||||
FactureFrsDetail.setDataFactureDetailFrs(Facture.getIdFactureFrs());
|
||||
FactureFrsDetail.PaneSucessFrs.setVisible(true);
|
||||
PaneFactureBRFrsAjouter.getChildren().clear();
|
||||
PaneFactureBRFrsAjouter.getChildren().add(ParentFxmlFournisseur);
|
||||
|
||||
}catch (IOException ex) {
|
||||
logger.error("FactureFrsBonReceptionAjouterController : FactureFrsDetail.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Thread backgroundThread = new Thread(task);// Run the task in a background thread
|
||||
backgroundThread.setDaemon(true);// Terminate the running thread if the application exits
|
||||
backgroundThread.start();
|
||||
}
|
||||
|
||||
ButtonFactureBLAjouter.setText("Enregister Facture BR");
|
||||
ButtonFactureBLAjouter.setDisable(false);
|
||||
ProgressIndicatorSaveFactureBLAjouter.setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public FactureFrs setFactureBRFrs()
|
||||
{
|
||||
FactureFrs FactureBRFrs = new FactureFrs();
|
||||
FactureBRFrs.setNumero(TextFieldNumeroFac.getText());
|
||||
FactureBRFrs.setHeurCreation(TextFieldHeurFac.getText());
|
||||
FactureBRFrs.setDateCreation(DatePickerDateFac.getValue().toString());
|
||||
|
||||
String IdFournisseur = StringSeleFournissuer.split(" - ", -1)[0];
|
||||
Fournisseur Frs = new Fournisseur();
|
||||
Frs.setCode(IdFournisseur);
|
||||
FactureBRFrs.setFournisseur(Frs);
|
||||
|
||||
FactureBRFrs.setDevise(ParametreSystem.CurrencySign);
|
||||
|
||||
Profile profile= new Profile();
|
||||
profile.setIdprofile(User.idprofile);
|
||||
FactureBRFrs.setProfile(profile);
|
||||
|
||||
FactureBRFrs.setLocal(ParametreSystem.NomLocalPC);
|
||||
|
||||
float total_hors_tax_net = 0;
|
||||
float total_tva = 0;
|
||||
float net_a_payer = 0;
|
||||
|
||||
ArrayList<String> listRefeProduct = new ArrayList<>();
|
||||
ArrayList<BonReceptionProduitList> listProd = new ArrayList<>();
|
||||
ObservableList<ListeProduit> ListProduit = FXCollections.observableArrayList() ;
|
||||
|
||||
ObservableList<BonReceptionFrs> ListeBonReception = FXCollections.observableArrayList() ;
|
||||
for(int i=0; i<ObservableListBonReception.size(); i++){
|
||||
BonReceptionFrs BonReception = BonRecepDB.getBonReceptionFrs(ObservableListBonReception.get(i).getCode(), null, null);
|
||||
ObservableList<BonReceptionProduitList> ObservableListProduit = BonReception.getListProduit();
|
||||
for(int j=0; j<ObservableListProduit.size();j++){
|
||||
listProd.add(ObservableListProduit.get(j));
|
||||
listRefeProduct.add(ObservableListProduit.get(j).getReference());
|
||||
float tva = Adaptateur.StringToFloat(ObservableListProduit.get(j).getTva());
|
||||
float total_hors_tax = Adaptateur.StringToFloat(ObservableListProduit.get(j).getPrixUnitaireHorsTaxenNet());
|
||||
total_tva += (total_hors_tax * tva) /100 ;
|
||||
total_hors_tax_net += Adaptateur.StringToFloat(ObservableListProduit.get(j).getPrixUnitaireHorsTaxenNet());
|
||||
net_a_payer += Adaptateur.StringToFloat(ObservableListProduit.get(j).getMontant());
|
||||
}
|
||||
ListeBonReception.add(BonReception);
|
||||
}
|
||||
|
||||
listRefeProduct = (ArrayList) listRefeProduct.stream().distinct().collect(Collectors.toList());
|
||||
for(String Refe : listRefeProduct){
|
||||
float quantite = 0;
|
||||
float p_u_h_t = 0;
|
||||
float p_u_h_t_net = 0;
|
||||
float tva = 0;
|
||||
float montant = 0;
|
||||
String designation = "";
|
||||
for(int j=0; j<listProd.size(); j++){
|
||||
if(Refe.equals(listProd.get(j).getReference())){
|
||||
quantite += Adaptateur.StringToFloat(listProd.get(j).getQuantite());
|
||||
p_u_h_t += Adaptateur.StringToFloat(listProd.get(j).getPrixUnitaireHorsTaxe());
|
||||
p_u_h_t_net += Adaptateur.StringToFloat(listProd.get(j).getPrixUnitaireHorsTaxenNet());
|
||||
tva = Adaptateur.StringToFloat(listProd.get(j).getTva());
|
||||
montant += Adaptateur.StringToFloat(listProd.get(j).getMontant());
|
||||
designation = listProd.get(j).getDesignation();
|
||||
}
|
||||
}
|
||||
ListProduit.add(new ListeProduit(Refe, designation, Adaptateur.ArrondFloatToString(quantite), Adaptateur.ArrondFloatToString(p_u_h_t), "0", Adaptateur.ArrondFloatToString(p_u_h_t_net), Adaptateur.ArrondFloatToString(tva), Adaptateur.ArrondFloatToString(montant)));
|
||||
}
|
||||
FactureBRFrs.setListProduit(ListProduit);
|
||||
|
||||
FactureBRFrs.setTotalHorsTaxNet(Adaptateur.ArrondFloatToString(total_hors_tax_net));
|
||||
FactureBRFrs.setTotalTVA(Adaptateur.ArrondFloatToString(total_tva));
|
||||
FactureBRFrs.setRemise("0");
|
||||
FactureBRFrs.setTimbre(ParametreSystem.Timbre);
|
||||
FactureBRFrs.setListeBonReception(ListeBonReception);
|
||||
|
||||
net_a_payer += Adaptateur.StringToFloat(ParametreSystem.Timbre);
|
||||
FactureBRFrs.setNetAPayer(Adaptateur.ArrondFloatToString(net_a_payer));
|
||||
|
||||
return FactureBRFrs;
|
||||
}
|
||||
|
||||
private void AffectBonReception(BonReceptionList BRList){
|
||||
//lorce qu'il y a plus que ligne
|
||||
if(ObservableListBonReception.size()>0){
|
||||
boolean result = false ;
|
||||
int indise = 1;
|
||||
//Verifier si la produit exsiste déja
|
||||
while(indise<=ObservableListBonReception.size() && !result){
|
||||
result = ObservableListBonReception.get(indise-1).getCode().equals(BRList.getCode());
|
||||
indise++;
|
||||
}
|
||||
//si le produit n'exsiste pas on la joute à la table view
|
||||
if(!result){
|
||||
ObservableListBonReception.add(BRList);
|
||||
}
|
||||
}
|
||||
else{
|
||||
ObservableListBonReception.add(BRList);
|
||||
}
|
||||
CalculeFacture();
|
||||
TableViewBonReceptionSelected.setItems(ObservableListBonReception);
|
||||
TableViewBonReceptionSelected.refresh();
|
||||
}
|
||||
|
||||
|
||||
private void CalculeFacture(){
|
||||
float somme = 0;
|
||||
|
||||
for(int i=0; i<ObservableListBonReception.size(); i++){
|
||||
somme += Adaptateur.ArrondStringToFloat(ObservableListBonReception.get(i).getNetPayer());
|
||||
}
|
||||
|
||||
if(somme > 0){
|
||||
somme += Adaptateur.ArrondStringToFloat(ParametreSystem.Timbre);
|
||||
TextTotalFacture.setText(Adaptateur.ArrondFloatToString(somme)+" "+ParametreSystem.CurrencySign);
|
||||
}else{
|
||||
TextTotalFacture.setText("");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void RechecheBonReception(){
|
||||
TextFieldNumero.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
String numero = Adaptateur.addSlashes(TextFieldNumero.getText());
|
||||
if(numero.isEmpty()){
|
||||
TableViewBonReception.setItems(null);
|
||||
}
|
||||
else{
|
||||
getRechecheBonReception(" AND (BR.numero LIKE '"+numero+"%') ");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
TextFieldNetPayer.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
String netpayer = TextFieldNetPayer.getText();
|
||||
if(netpayer.isEmpty()){
|
||||
TableViewBonReception.setItems(null);
|
||||
}
|
||||
else{
|
||||
getRechecheBonReception(" AND (BR.net_a_payer LIKE '"+netpayer+"%') ");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
DatePickerDateReception.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent actionEvent) {
|
||||
try{
|
||||
getRechecheBonReception(" AND (to_char(BR.date_reception, 'yyyy-mm-dd') = "+"'"+DatePickerDateReception.getValue().toString()+"')");
|
||||
}catch(Exception ex){}
|
||||
}
|
||||
});
|
||||
DatePickerDateReception.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
try{
|
||||
String DateReception = DatePickerDateReception.getConverter().fromString(DatePickerDateReception.getEditor().getText()).toString();
|
||||
getRechecheBonReception(" AND (to_char(BR.date_reception, 'yyyy-mm-dd') = "+"'"+DateReception+"')");
|
||||
}catch(Exception ex){}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
TextFieldFournisseur.textProperty().addListener(new ChangeListener<String>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
||||
if(newValue.contains(" - ")){
|
||||
String[] array = newValue.split(" - ", -1);
|
||||
getRechecheBonReception(" AND (BR.id_fournisseur = '"+array[0]+"') ");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ChoiceBoxLocalReception.valueProperty().addListener(new ChangeListener<String>() {
|
||||
@Override
|
||||
public void changed(ObservableValue ov, String t, String ValLocal) {
|
||||
getRechecheBonReception(" AND (BR.local_reception LIKE '"+ValLocal+"%') ");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.FactureFrs;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Models.BonReceptionFrs.BonReceptionFrs;
|
||||
import Models.FactureFrs.FactureFrs;
|
||||
import Models.FactureFrs.FactureFrsDB;
|
||||
import Models.Fournisseur.Fournisseur;
|
||||
import Models.Produit.ListeProduit;
|
||||
import Models.User.Profile;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.application.Platform;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Tab;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
*
|
||||
* @author Maher
|
||||
*/
|
||||
public class FactureFrsDetailController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane PaneFactureFrsDetail ;
|
||||
@FXML private AnchorPane AnchorPaneLoading;
|
||||
|
||||
@FXML public AnchorPane PaneSucessFrs ;
|
||||
|
||||
@FXML private Tab TabBonReception;
|
||||
|
||||
@FXML private Text TextNumero;
|
||||
@FXML private Text TextDateReception;
|
||||
@FXML private Text TextTypeReglement; //type reglement: 0 comptant 1 facilité
|
||||
@FXML private Text TextLocalReception;
|
||||
@FXML private Text TextEtatReglement; //0 :payer 1 :en cour 3: non pays
|
||||
@FXML private Text TextProfile;
|
||||
@FXML private Text TextNomFrs;
|
||||
@FXML private Text TextSpecialiteFrs;
|
||||
@FXML private Text TextFormesFrs;
|
||||
@FXML private Text TextAdresseFrs;
|
||||
@FXML private Text TextTele1Frs;
|
||||
@FXML private Text TextTele2Frs;
|
||||
|
||||
|
||||
@FXML private Text TotalTVA ;
|
||||
@FXML private Text Remise ;
|
||||
@FXML private Text NetAPayer ;
|
||||
@FXML private Text Timbre ;
|
||||
@FXML private Text TotalHTNet ;
|
||||
|
||||
@FXML public TableView<ListeProduit> TableViewListeProduit ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColReference;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColDesignation;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColQuantite ;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColPrixHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColRemise;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTotalHT;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTVA;
|
||||
@FXML public TableColumn<ListeProduit ,String> TabColTotalTTC;
|
||||
|
||||
@FXML public TableView<BonReceptionFrs> TableViewBonReception;
|
||||
@FXML public TableColumn<BonReceptionFrs ,String> TabColNumero;
|
||||
@FXML public TableColumn<BonReceptionFrs ,String> TabColDate;
|
||||
@FXML public TableColumn<BonReceptionFrs ,String> TabColHeur;
|
||||
@FXML public TableColumn<BonReceptionFrs ,String> TabColLocalReception;
|
||||
@FXML public TableColumn<BonReceptionFrs ,String> TabColTransporteur;
|
||||
@FXML public TableColumn<BonReceptionFrs ,String> TabColNetPayer;
|
||||
|
||||
private Service<Void> ThreadFactureFrsDetail;
|
||||
|
||||
FactureFrs Facture ;
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("reference"));
|
||||
TabColDesignation.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("designation"));
|
||||
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("PrixHT"));
|
||||
TabColPrixHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixHT.getStyleClass().add("Center");
|
||||
|
||||
TabColRemise.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("Remise"));
|
||||
TabColRemise.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColRemise.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalHT.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalHT"));
|
||||
TabColTotalHT.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTotalHT.getStyleClass().add("Center");
|
||||
|
||||
TabColTVA.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TVA"));
|
||||
TabColTVA.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColTVA.getStyleClass().add("Center");
|
||||
|
||||
TabColTotalTTC.setCellValueFactory(new PropertyValueFactory<ListeProduit, String>("TotalTTC"));
|
||||
TabColTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTotalTTC.getStyleClass().add("Center");
|
||||
|
||||
TabColNumero.setCellValueFactory(new PropertyValueFactory<BonReceptionFrs, String>("Numero"));
|
||||
|
||||
TabColDate.setCellValueFactory(new PropertyValueFactory<BonReceptionFrs, String>("Date"));
|
||||
TabColDate.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDate.getStyleClass().add("Center");
|
||||
|
||||
TabColHeur.setCellValueFactory(new PropertyValueFactory<BonReceptionFrs, String>("Heur"));
|
||||
TabColHeur.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColHeur.getStyleClass().add("Center");
|
||||
|
||||
|
||||
TabColLocalReception.setCellValueFactory(new PropertyValueFactory<BonReceptionFrs, String>("Local"));
|
||||
TabColLocalReception.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColLocalReception.getStyleClass().add("Center");
|
||||
|
||||
|
||||
TabColTransporteur.setCellValueFactory(new PropertyValueFactory<BonReceptionFrs, String>("Transporteur"));
|
||||
TabColTransporteur.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTransporteur.getStyleClass().add("Center");
|
||||
|
||||
TabColNetPayer.setCellValueFactory(new PropertyValueFactory<BonReceptionFrs, String>("NetPayer"));
|
||||
TabColNetPayer.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNetPayer.getStyleClass().add("Center");
|
||||
}
|
||||
|
||||
|
||||
public void setDataFactureDetailFrs(final String IdFactureFrs){
|
||||
ThreadFactureFrsDetail = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
Facture = new FactureFrsDB().getFactureFrs(IdFactureFrs, null, null);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadFactureFrsDetail.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
TextNumero.setText(Facture.getNumero());
|
||||
TextDateReception.setText(Facture.getDateCreation()+" "+Facture.getHeurCreation());
|
||||
TextTypeReglement.setText(Facture.getTypeReglementString());
|
||||
TextLocalReception.setText(Facture.getLocal());
|
||||
TextEtatReglement.setText(Facture.getEtatReglementString());
|
||||
|
||||
Profile profile = Facture.getProfile();
|
||||
TextProfile.setText(profile.getNom()+" "+profile.getPrenom());
|
||||
|
||||
|
||||
TotalTVA.setText(Adaptateur.FloatToStringEspaceCurrency(Facture.getFTotalTVA()));
|
||||
Remise.setText(Adaptateur.FloatToStringEspaceCurrency(Facture.getFRemise()));
|
||||
NetAPayer.setText(Adaptateur.FloatToStringEspaceCurrency(Facture.getFNetAPayer()));
|
||||
Timbre.setText(Adaptateur.FloatToStringEspaceCurrency(Facture.getFTimbre()));
|
||||
TotalHTNet.setText(Adaptateur.FloatToStringEspaceCurrency(Facture.getFTotalHorsTaxNet()));
|
||||
|
||||
Fournisseur Frs = Facture.getFournisseur();
|
||||
TextNomFrs.setText(Frs.getNom());
|
||||
TextSpecialiteFrs.setText(Frs.getSpecialite());
|
||||
TextFormesFrs.setText(Frs.getFormes());
|
||||
TextAdresseFrs.setText(Frs.getAdresse());
|
||||
TextTele1Frs.setText(Frs.getTele1());
|
||||
TextTele2Frs.setText(Frs.getTele2());
|
||||
|
||||
ObservableList<ListeProduit> ProduitList = Facture.getListProduit();
|
||||
TableViewListeProduit.setItems(ProduitList);
|
||||
TableViewListeProduit.refresh();
|
||||
|
||||
if(Facture.getBonReception() == null){
|
||||
TabBonReception.setText("");
|
||||
TabBonReception.setDisable(true);
|
||||
}else{
|
||||
ObservableList<BonReceptionFrs> ListBonReception = Facture.getListeBonReception();
|
||||
TableViewBonReception.setItems(ListBonReception);
|
||||
TableViewBonReception.refresh();
|
||||
}
|
||||
|
||||
PaneFactureFrsDetail.setVisible(true);
|
||||
AnchorPaneLoading.setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
ThreadFactureFrsDetail.start();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,483 @@
|
||||
package Controllers.FactureFrs;
|
||||
|
||||
import Models.FactureFrs.FactureFrs;
|
||||
import Models.FactureFrs.FactureFrsDB;
|
||||
import Models.Fournisseur.FournisseurDB;
|
||||
import Models.Stock.StockDB;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableColumn.CellDataFeatures;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
import org.controlsfx.control.textfield.TextFields;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class FactureFrsGestionController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneFactureFrsGestion ;
|
||||
|
||||
@FXML private ProgressBar ProgressBarFactureFrs;
|
||||
|
||||
@FXML private Button ButtonSearchFactureFrs;
|
||||
|
||||
@FXML public TableView<FactureFrs> TableViewBonReception;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColNumero;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColFrs;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColDate;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColHeur;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColLocalReception;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColNetPayer;
|
||||
@FXML public TableColumn<FactureFrs ,Boolean>TabColDetail ;
|
||||
|
||||
@FXML public TextField TextFieldNumero ;
|
||||
@FXML public TextField TextFieldFournisseur ;
|
||||
@FXML public DatePicker DatePickerDateReception;
|
||||
@FXML public ChoiceBox ChoiceBoxLocalReception ;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
private Service<Void> ThreadSearchFactureFrs;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
String LocalReception = "";
|
||||
String IdFournisseur = "";
|
||||
|
||||
public ArrayList<String> ListFournisseur = new ArrayList<>();
|
||||
public ArrayList<String> ListLocale = new ArrayList<>();
|
||||
|
||||
DecimalFormat Formatter = new DecimalFormat("##,###.## ");
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
setDefaultFormData();
|
||||
|
||||
TabColNumero.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("Numero"));
|
||||
|
||||
TabColFrs.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColFrs.getStyleClass().add("Center");
|
||||
TabColFrs.setCellValueFactory(new Callback<CellDataFeatures<FactureFrs,String>, ObservableValue<String>>() {
|
||||
@Override
|
||||
public ObservableValue<String> call(CellDataFeatures<FactureFrs, String> data) {
|
||||
return new SimpleStringProperty(data.getValue().getFournisseur().getNom());
|
||||
}
|
||||
});
|
||||
|
||||
TabColDate.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("DateCreation"));
|
||||
TabColDate.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDate.getStyleClass().add("Center");
|
||||
|
||||
TabColHeur.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("HeurCreation"));
|
||||
TabColHeur.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColHeur.getStyleClass().add("Center");
|
||||
|
||||
TabColLocalReception.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("Local"));
|
||||
TabColLocalReception.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColLocalReception.getStyleClass().add("Center");
|
||||
|
||||
TabColNetPayer.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("NetAPayer"));
|
||||
TabColNetPayer.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNetPayer.getStyleClass().add("Center");
|
||||
TabColNetPayer.setCellFactory(new Callback<TableColumn<FactureFrs,String>,TableCell<FactureFrs,String>>(){
|
||||
@Override
|
||||
public TableCell<FactureFrs, String> call(TableColumn<FactureFrs, String> param) {
|
||||
TableCell<FactureFrs, String> cell = new TableCell<FactureFrs, String>(){
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
if(item!= null){
|
||||
Text text = new Text(Formatter.format(Float.parseFloat(item)));
|
||||
setGraphic(text);
|
||||
}else{
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
TabColDetail.setStyle( "-fx-alignment: CENTER;");TabColDetail.getStyleClass().add("Center");
|
||||
TabColDetail.setCellFactory(new Callback<TableColumn<FactureFrs, Boolean>, TableCell<FactureFrs, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<FactureFrs, Boolean> call(TableColumn<FactureFrs, Boolean> personBooleanTableColumn) {
|
||||
return new ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
TextFieldFournisseur.textProperty().addListener(new ChangeListener<String>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
||||
if(newValue.contains(" - ")){
|
||||
String[] array = newValue.split(" - ", -1);
|
||||
IdFournisseur = array[0];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ChoiceBoxLocalReception.valueProperty().addListener(new ChangeListener<String>() {
|
||||
@Override
|
||||
public void changed(ObservableValue ov, String t, String ValLocal) {
|
||||
LocalReception = ValLocal;
|
||||
}
|
||||
});
|
||||
|
||||
ButtonSearchFactureFrs.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchFactureFrs();
|
||||
}
|
||||
});
|
||||
|
||||
AnchorPaneFactureFrsGestion.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchFactureFrs();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SearchFactureFrs();
|
||||
|
||||
GestionSearchFactureFrs();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private class ButtonCell extends TableCell<FactureFrs, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/detailbutton.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){ //Action when the button is pressed
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/FactureFrs/FactureFrsDetail.fxml"));
|
||||
Parent ParentFxmlFournisseur = (Parent)fxmlLoader.load();
|
||||
|
||||
FactureFrs FournisseurList = ((FactureFrs)getTableRow().getItem());
|
||||
|
||||
FactureFrsDetailController FactureFrsDetail = fxmlLoader.getController();
|
||||
FactureFrsDetail.setDataFactureDetailFrs(FournisseurList.getIdFactureFrs());
|
||||
FactureFrsDetail.PaneSucessFrs.setVisible(false);
|
||||
|
||||
AnchorPaneFactureFrsGestion.getChildren().clear();
|
||||
AnchorPaneFactureFrsGestion.getChildren().add(ParentFxmlFournisseur);
|
||||
} catch (Exception ex) {
|
||||
System.err.println("FactureFrsGestionController ButtonCell ! \n"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void FactureFrsBonReceptionAjouterButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPaneFactureFrsGestion.getChildren().clear();
|
||||
AnchorPaneFactureFrsGestion.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/FactureFrs/FactureFrsBonReceptionAjouter.fxml")));
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void FactureFrsAjouterButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPaneFactureFrsGestion.getChildren().clear();
|
||||
AnchorPaneFactureFrsGestion.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/FactureFrs/FactureFrsAjouter.fxml")));
|
||||
}
|
||||
|
||||
private void setDefaultFormData()
|
||||
{
|
||||
ProgressBarFactureFrs.setVisible(true);
|
||||
|
||||
ThreadSearchFactureFrs = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
ListFournisseur = new FournisseurDB().getIdNomFournisseur();
|
||||
TextFields.bindAutoCompletion(TextFieldFournisseur, ListFournisseur);
|
||||
|
||||
ListLocale = new StockDB().getAllListLocal();
|
||||
ChoiceBoxLocalReception.getItems().addAll(ListLocale);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadSearchFactureFrs.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarFactureFrs.setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchFactureFrs.start();
|
||||
}
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchFactureFrs()
|
||||
{
|
||||
ProgressBarFactureFrs.setVisible(true);
|
||||
|
||||
ButtonSearchFactureFrs.setDisable(true);
|
||||
|
||||
ThreadSearchFactureFrs = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DateReception = "";
|
||||
if(DatePickerDateReception.getValue() != null){
|
||||
DateReception = DatePickerDateReception.getValue().toString();
|
||||
}
|
||||
|
||||
|
||||
ObservableList<FactureFrs> ListFactureFrss = new FactureFrsDB().SearchFactureFrsGestion(
|
||||
position,
|
||||
nbrligne,
|
||||
TextFieldNumero.getText(),
|
||||
IdFournisseur,
|
||||
LocalReception,
|
||||
DateReception);
|
||||
|
||||
TableViewBonReception.setItems(ListFactureFrss);
|
||||
|
||||
totalcount = new FactureFrsDB().nbrFactureFrsGestion(TextFieldNumero.getText(), IdFournisseur, LocalReception, DateReception);
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchFactureFrs.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarFactureFrs.setVisible(false);
|
||||
ButtonSearchFactureFrs.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchFactureFrs.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchFactureFrs(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarFactureFrs.setVisible(true);
|
||||
|
||||
ButtonSearchFactureFrs.setDisable(true);
|
||||
|
||||
ThreadSearchFactureFrs = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DateReception = "";
|
||||
if(DatePickerDateReception.getValue() != null){
|
||||
DateReception = DatePickerDateReception.getValue().toString();
|
||||
}
|
||||
|
||||
ObservableList<FactureFrs> ListFactureFrs = new FactureFrsDB().SearchFactureFrsGestion(ParmPosition, ParamNbrligne, TextFieldNumero.getText(), IdFournisseur, LocalReception, DateReception);
|
||||
|
||||
TableViewBonReception.setItems(ListFactureFrs);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchFactureFrs.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarFactureFrs.setVisible(false);
|
||||
ButtonSearchFactureFrs.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchFactureFrs.start();
|
||||
}
|
||||
|
||||
private void GestionSearchFactureFrs()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchFactureFrs(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchFactureFrs(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchFactureFrs(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchFactureFrs(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchFactureFrs(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,345 @@
|
||||
package Controllers.Fournisseur;
|
||||
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.Fournisseur.Fournisseur;
|
||||
import Models.Fournisseur.FournisseurContactDB;
|
||||
import Models.Fournisseur.FournisseurContactList;
|
||||
import Models.Fournisseur.FournisseurDB;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class FournisseurGererController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(FournisseurGererController.class.getName());
|
||||
|
||||
@FXML public AnchorPane PanePrincipalFournisseur;
|
||||
@FXML public AnchorPane AnchorPaneLoadingFournisseur;
|
||||
|
||||
@FXML public Text TitreSecondaire;
|
||||
|
||||
@FXML private AnchorPane PaneFournisseurAjouter;
|
||||
|
||||
@FXML public Button AjouterContactFrsButton;
|
||||
@FXML public Button ButtonGererAjouterFrs;
|
||||
@FXML public Button ButtonGererModifierFrs;
|
||||
|
||||
@FXML public TextField TextFieldNomFrs ;
|
||||
@FXML public TextField TextFieldSpecialiteFrs ;
|
||||
@FXML public TextField TextFieldTele1Frs ;
|
||||
@FXML public TextField TextFieldTele2Frs ;
|
||||
@FXML public TextField TextFieldFaxFrs ;
|
||||
@FXML public TextField TextFieldMailFrs ;
|
||||
@FXML public TextField TextFieldSiteWebFrs ;
|
||||
@FXML public TextField TextFieldAdresseFrs ;
|
||||
@FXML public ChoiceBox ChoiceBoxFormes;
|
||||
|
||||
|
||||
@FXML public Text TextNomFrs ;
|
||||
@FXML public Text TextSpecialiteFrs ;
|
||||
@FXML public Text TextTele1Frs ;
|
||||
@FXML public Text TextTele2Frs ;
|
||||
@FXML public Text TextFaxFrs ;
|
||||
@FXML public Text TextMailFrs ;
|
||||
@FXML public Text TextSiteWebFrs ;
|
||||
@FXML public Text TextAdresseFrs ;
|
||||
|
||||
@FXML public TableView<FournisseurContactList> TableViewFournisseurContactFrs;
|
||||
@FXML public TableColumn<FournisseurContactList ,String> TabColCodeContactFrs;
|
||||
@FXML public TableColumn<FournisseurContactList ,String> TabColNomContactFrs;
|
||||
@FXML public TableColumn<FournisseurContactList ,String> TabColPrenomContactFrs;
|
||||
@FXML public TableColumn<FournisseurContactList ,String> TabColTele1ContactFrs;
|
||||
@FXML public TableColumn<FournisseurContactList ,String> TabColTele2ContactFrs;
|
||||
@FXML public TableColumn<FournisseurContactList ,String> TabColEmailContactFrs;
|
||||
|
||||
@FXML public TextField TextFieldNomContactFrs ;
|
||||
@FXML public TextField TextFieldPrenomContactFrs ;
|
||||
@FXML public TextField TextFieldTele1ContactFrs ;
|
||||
@FXML public TextField TextFieldTele2ContactFrs ;
|
||||
@FXML public TextField TextFieldMailContactFrs ;
|
||||
|
||||
@FXML public Text TextNomCltContactFrs ;
|
||||
@FXML public Text TextPrenomCltContactFrs ;
|
||||
@FXML public Text TextTele1CltContactFrs ;
|
||||
@FXML public Text TextTele2CltContactFrs ;
|
||||
@FXML public Text TextMailCltContactFrs ;
|
||||
|
||||
public ObservableList<FournisseurContactList> ObservableListContactFrs = FXCollections.observableArrayList();
|
||||
|
||||
private Service<Void> ThreadFournisseurGerer;
|
||||
|
||||
contro Controle = new contro();
|
||||
|
||||
Fournisseur Frs;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
ChoiceBoxFormes.setItems(FXCollections.observableArrayList("SARL","EURL","SAS","SASU","SA","SNC"));
|
||||
ChoiceBoxFormes.getSelectionModel().selectFirst();
|
||||
|
||||
TabColCodeContactFrs.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColCodeContactFrs.getStyleClass().add("Center");
|
||||
TabColCodeContactFrs.setCellValueFactory(new PropertyValueFactory<FournisseurContactList, String>("Code"));
|
||||
|
||||
TabColNomContactFrs.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNomContactFrs.getStyleClass().add("Center");
|
||||
TabColNomContactFrs.setCellValueFactory(new PropertyValueFactory<FournisseurContactList, String>("Nom"));
|
||||
|
||||
|
||||
TabColPrenomContactFrs.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColPrenomContactFrs.getStyleClass().add("Center");
|
||||
TabColPrenomContactFrs.setCellValueFactory(new PropertyValueFactory<FournisseurContactList, String>("Prenom"));
|
||||
|
||||
|
||||
TabColTele1ContactFrs.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTele1ContactFrs.getStyleClass().add("Center");
|
||||
TabColTele1ContactFrs.setCellValueFactory(new PropertyValueFactory<FournisseurContactList, String>("Tele1"));
|
||||
|
||||
TabColTele2ContactFrs.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTele2ContactFrs.getStyleClass().add("Center");
|
||||
TabColTele2ContactFrs.setCellValueFactory(new PropertyValueFactory<FournisseurContactList, String>("Tele2"));
|
||||
|
||||
|
||||
TabColEmailContactFrs.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColEmailContactFrs.getStyleClass().add("Center");
|
||||
TabColEmailContactFrs.setCellValueFactory(new PropertyValueFactory<FournisseurContactList, String>("Mail"));
|
||||
|
||||
|
||||
AjouterContactFrsButton.getStyleClass().add("btn-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconaffecter.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
AjouterContactFrsButton.setGraphic(buttonGraphic);
|
||||
|
||||
|
||||
//Bouton Ajouter
|
||||
ButtonGererAjouterFrs.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent e) {
|
||||
if( Controle.ContrNull(TextFieldNomFrs, TextNomFrs) &&
|
||||
Controle.ContrNull(TextFieldSpecialiteFrs, TextSpecialiteFrs) &&
|
||||
Controle.ContrNumeriqueNotnull(TextFieldTele1Frs, TextTele1Frs) &&
|
||||
Controle.ContrNumerique(TextFieldTele2Frs, TextTele2Frs) &&
|
||||
Controle.ContrNumerique(TextFieldFaxFrs, TextFaxFrs) &&
|
||||
Controle.ContrNull(TextFieldAdresseFrs, TextAdresseFrs)
|
||||
){
|
||||
|
||||
|
||||
Fournisseur fournisseur = SetDataFournissuer();
|
||||
FournisseurDB FrsDB = new FournisseurDB();
|
||||
fournisseur = FrsDB.SetFournisseurDB(fournisseur);
|
||||
|
||||
if(fournisseur.getCode()!= null){
|
||||
PaneFournisseurAjouter.getChildren().clear();
|
||||
try {
|
||||
PaneFournisseurAjouter.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Fournisseur/FournisseurGestion.fxml")));
|
||||
} catch (IOException ex) {
|
||||
logger.error("FournisseurGererController : FournisseurGestion.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
public void clickItem(MouseEvent event)
|
||||
{
|
||||
if (event.getClickCount() == 2) //Checking double click
|
||||
{
|
||||
FournisseurContactList FrsContact = TableViewFournisseurContactFrs.getSelectionModel().getSelectedItem();
|
||||
TextFieldNomContactFrs.setText(FrsContact.getNom());
|
||||
TextFieldPrenomContactFrs.setText(FrsContact.getPrenom());
|
||||
TextFieldTele1ContactFrs.setText(FrsContact.getTele1());
|
||||
TextFieldTele2ContactFrs.setText(FrsContact.getTele2());
|
||||
TextFieldMailContactFrs.setText(FrsContact.getMail());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Fournisseur SetDataFournissuer(){
|
||||
Fournisseur fournisseur= new Fournisseur();
|
||||
fournisseur.setNom(TextFieldNomFrs.getText());
|
||||
fournisseur.setSpecialite(TextFieldSpecialiteFrs.getText());
|
||||
fournisseur.setFormes(ChoiceBoxFormes.getValue().toString());
|
||||
fournisseur.setTele1(TextFieldTele1Frs.getText());
|
||||
fournisseur.setTele2(TextFieldTele2Frs.getText());
|
||||
fournisseur.setFax(TextFieldFaxFrs.getText());
|
||||
fournisseur.setMail(TextFieldMailFrs.getText());
|
||||
fournisseur.setSiteWeb(TextFieldSiteWebFrs.getText());
|
||||
fournisseur.setAdresse(TextFieldAdresseFrs.getText());
|
||||
fournisseur.setContactFrs(ObservableListContactFrs);
|
||||
return fournisseur;
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void AjouterContactFrsButtonAction(ActionEvent event) throws IOException {
|
||||
|
||||
if( Controle.ContrNull(TextFieldNomContactFrs, TextNomCltContactFrs) &&
|
||||
Controle.ContrNull(TextFieldPrenomContactFrs, TextPrenomCltContactFrs) &&
|
||||
Controle.ContrNumeriqueNotnull(TextFieldTele1ContactFrs, TextTele1CltContactFrs) &&
|
||||
Controle.ContrNumerique(TextFieldTele2ContactFrs, TextTele2CltContactFrs) ){
|
||||
int indise = 0;
|
||||
boolean notexiste = true;
|
||||
while(indise<ObservableListContactFrs.size() && notexiste){
|
||||
if( (TextFieldNomContactFrs.getText().equals(ObservableListContactFrs.get(indise).getNom())) && (TextFieldPrenomContactFrs.getText().equals(ObservableListContactFrs.get(indise).getPrenom()) ) )
|
||||
{
|
||||
ObservableListContactFrs.get(indise).SetTele1(TextFieldTele1ContactFrs.getText());
|
||||
ObservableListContactFrs.get(indise).SetTele2(TextFieldTele2ContactFrs.getText());
|
||||
ObservableListContactFrs.get(indise).SetMail(TextFieldMailContactFrs.getText());
|
||||
notexiste = false;
|
||||
}
|
||||
indise++;
|
||||
}
|
||||
|
||||
if(notexiste){
|
||||
ObservableListContactFrs.add(new FournisseurContactList("", TextFieldNomContactFrs.getText(), TextFieldPrenomContactFrs.getText(), TextFieldTele1ContactFrs.getText(), TextFieldTele2ContactFrs.getText(), TextFieldMailContactFrs.getText()));
|
||||
}
|
||||
|
||||
TableViewFournisseurContactFrs.setItems(ObservableListContactFrs);
|
||||
TableViewFournisseurContactFrs.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public void SetDataFournissuer(final String CodeFrs){
|
||||
PanePrincipalFournisseur.setVisible(false);
|
||||
AnchorPaneLoadingFournisseur.setVisible(true);
|
||||
TitreSecondaire.setText("Fournisseur / Modifier");
|
||||
ButtonGererModifierFrs.setVisible(true);
|
||||
ButtonGererAjouterFrs.setVisible(false);
|
||||
|
||||
ThreadFournisseurGerer = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
Frs = new FournisseurDB().GetFournisseurDB(CodeFrs);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadFournisseurGerer.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ObservableListContactFrs = Frs.getContactFrs();
|
||||
TableViewFournisseurContactFrs.setItems(Frs.getContactFrs());
|
||||
|
||||
TextFieldNomFrs.setText(Frs.getNom());
|
||||
TextFieldSpecialiteFrs.setText(Frs.getSpecialite()) ;
|
||||
TextFieldTele1Frs.setText(Frs.getTele1()) ;
|
||||
TextFieldTele2Frs.setText(Frs.getTele2()) ;
|
||||
TextFieldFaxFrs.setText(Frs.getFax()) ;
|
||||
TextFieldMailFrs.setText(Frs.getMail()) ;
|
||||
TextFieldSiteWebFrs.setText(Frs.getSiteWeb()) ;
|
||||
TextFieldAdresseFrs.setText(Frs.getAdresse()) ;
|
||||
|
||||
if(Frs.getFormes() != null){
|
||||
if(Frs.getFormes().equals("SARL")){
|
||||
ChoiceBoxFormes.getSelectionModel().select(0);
|
||||
}else if(Frs.getFormes().equals("EURL")){
|
||||
ChoiceBoxFormes.getSelectionModel().select(1);
|
||||
}else if(Frs.getFormes().equals("SAS")){
|
||||
ChoiceBoxFormes.getSelectionModel().select(2);
|
||||
}else if(Frs.getFormes().equals("SASU")){
|
||||
ChoiceBoxFormes.getSelectionModel().select(3);
|
||||
}else if(Frs.getFormes().equals("SA")){
|
||||
ChoiceBoxFormes.getSelectionModel().select(4);
|
||||
}else if(Frs.getFormes().equals("SNC")){
|
||||
ChoiceBoxFormes.getSelectionModel().select(5);
|
||||
}
|
||||
}
|
||||
|
||||
PanePrincipalFournisseur.setVisible(true);
|
||||
AnchorPaneLoadingFournisseur.setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
ThreadFournisseurGerer.start();
|
||||
|
||||
|
||||
ButtonGererModifierFrs.setOnAction(new EventHandler<ActionEvent>() {
|
||||
|
||||
@Override
|
||||
public void handle(ActionEvent e) {
|
||||
|
||||
if( Controle.ContrNull(TextFieldNomFrs, TextNomFrs) &&
|
||||
Controle.ContrNull(TextFieldSpecialiteFrs, TextSpecialiteFrs) &&
|
||||
Controle.ContrNumeriqueNotnull(TextFieldTele1Frs, TextTele1Frs) &&
|
||||
Controle.ContrNumerique(TextFieldTele2Frs, TextTele2Frs) &&
|
||||
Controle.ContrNumerique(TextFieldFaxFrs, TextFaxFrs) &&
|
||||
Controle.ContrNull(TextFieldAdresseFrs, TextAdresseFrs)
|
||||
){
|
||||
Fournisseur fournisseur = SetDataFournissuer();
|
||||
fournisseur.setCode(CodeFrs);
|
||||
FournisseurDB FrourDB= new FournisseurDB();
|
||||
boolean ResultUpdate = FrourDB.UpdFournisseurDB(fournisseur);
|
||||
if(ResultUpdate){
|
||||
FournisseurContactDB FrsContactDB= new FournisseurContactDB();
|
||||
ObservableList<FournisseurContactList> ObservableNewListContactFrs = FXCollections.observableArrayList();
|
||||
for(FournisseurContactList ContactList : ObservableListContactFrs){
|
||||
if(ContactList.getCode().length()>0){
|
||||
FrsContactDB.UpdListFournisseurContact(ContactList.getCode(), ContactList.getNom(), ContactList.getPrenom(), ContactList.getTele1(), ContactList.getTele2(), ContactList.getMail());
|
||||
}else{
|
||||
ObservableNewListContactFrs.add(ContactList);
|
||||
}
|
||||
}
|
||||
if(ObservableNewListContactFrs.size()>0){
|
||||
FrsContactDB.SetListFournisseurContact(ObservableNewListContactFrs, CodeFrs);
|
||||
PaneFournisseurAjouter.getChildren().clear();
|
||||
}
|
||||
try {
|
||||
PaneFournisseurAjouter.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Fournisseur/FournisseurGestion.fxml")));
|
||||
} catch (IOException ex) {
|
||||
logger.error("FournisseurGererController : FournisseurGestion.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,396 @@
|
||||
package Controllers.Fournisseur;
|
||||
|
||||
|
||||
import Models.Fournisseur.FournisseurDB;
|
||||
import Models.Fournisseur.FournisseurGestionList;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class FournisseurGestionController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(FournisseurGestionController.class.getName());
|
||||
|
||||
@FXML private AnchorPane PaneFournisseurGestion ;
|
||||
|
||||
@FXML private ProgressBar ProgressBarFournisseurGestion;
|
||||
|
||||
@FXML public TableView<FournisseurGestionList> TableViewFournisseurGestion;
|
||||
@FXML public TableColumn<FournisseurGestionList ,String> TabColCodeFournisseur;
|
||||
@FXML public TableColumn<FournisseurGestionList ,String> TabColNomFournisseur;
|
||||
@FXML public TableColumn<FournisseurGestionList ,String> TabColTele1Fournisseur;
|
||||
@FXML public TableColumn<FournisseurGestionList ,String> TabColTele2Fournisseur;
|
||||
@FXML public TableColumn<FournisseurGestionList ,String> TabColFaxFournisseur;
|
||||
@FXML public TableColumn<FournisseurGestionList ,String> TabColMailFournisseur;
|
||||
@FXML public TableColumn<FournisseurGestionList ,String> TabColAdresseFournisseur;
|
||||
@FXML public TableColumn<FournisseurGestionList ,Boolean>TabColDetail ;
|
||||
|
||||
@FXML public TextField TextFieldCodeFournisseur ;
|
||||
@FXML public TextField TextFieldNomFournisseur ;
|
||||
@FXML public TextField TextFieldAdresseFournisseur ;
|
||||
@FXML public TextField TextFieldTeleFournisseur ;
|
||||
@FXML public TextField TextFieldFaxFournisseur ;
|
||||
@FXML public TextField TextFieldMailFournisseur ;
|
||||
|
||||
@FXML private Button ButtonSearchFournisseurGestion;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount ;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
|
||||
private Service<Void> ThreadSearchFournisseurGestion;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
//comboboxnombre des lignes tableview
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
TableViewFournisseurGestion.setEditable(true);
|
||||
|
||||
TabColCodeFournisseur.setStyle( "-fx-alignment: CENTER;");TabColCodeFournisseur.getStyleClass().add("Center");
|
||||
TabColCodeFournisseur.setCellValueFactory(new PropertyValueFactory<FournisseurGestionList, String>("Code"));
|
||||
|
||||
TabColNomFournisseur.setStyle( "-fx-alignment: CENTER;");TabColNomFournisseur.getStyleClass().add("Center");
|
||||
TabColNomFournisseur.setCellValueFactory(new PropertyValueFactory<FournisseurGestionList, String>("Nom"));
|
||||
|
||||
TabColTele1Fournisseur.setStyle( "-fx-alignment: CENTER;");TabColTele1Fournisseur.getStyleClass().add("Center");
|
||||
TabColTele1Fournisseur.setCellValueFactory(new PropertyValueFactory<FournisseurGestionList, String>("Tele1"));
|
||||
|
||||
TabColTele2Fournisseur.setStyle( "-fx-alignment: CENTER;");TabColTele2Fournisseur.getStyleClass().add("Center");
|
||||
TabColTele2Fournisseur.setCellValueFactory(new PropertyValueFactory<FournisseurGestionList, String>("Tele2"));
|
||||
|
||||
TabColFaxFournisseur.setStyle( "-fx-alignment: CENTER;");TabColFaxFournisseur.getStyleClass().add("Center");
|
||||
TabColFaxFournisseur.setCellValueFactory(new PropertyValueFactory<FournisseurGestionList, String>("Fax"));
|
||||
|
||||
TabColMailFournisseur.setStyle( "-fx-alignment: CENTER;");TabColMailFournisseur.getStyleClass().add("Center");
|
||||
TabColMailFournisseur.setCellValueFactory(new PropertyValueFactory<FournisseurGestionList, String>("Mail"));
|
||||
|
||||
TabColAdresseFournisseur.setStyle( "-fx-alignment: CENTER;");TabColAdresseFournisseur.getStyleClass().add("Center");
|
||||
TabColAdresseFournisseur.setCellValueFactory(new PropertyValueFactory<FournisseurGestionList, String>("Adresse"));
|
||||
|
||||
TabColDetail.setStyle( "-fx-alignment: CENTER;");TabColDetail.getStyleClass().add("Center");
|
||||
TabColDetail.setCellFactory(new Callback<TableColumn<FournisseurGestionList, Boolean>, TableCell<FournisseurGestionList, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<FournisseurGestionList, Boolean> call(TableColumn<FournisseurGestionList, Boolean> personBooleanTableColumn) {
|
||||
return new ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
ButtonSearchFournisseurGestion.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchFournisseurGestion();
|
||||
}
|
||||
});
|
||||
|
||||
PaneFournisseurGestion.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchFournisseurGestion();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SearchFournisseurGestion();
|
||||
|
||||
GestionSearchFournisseur();
|
||||
}
|
||||
|
||||
|
||||
private class ButtonCell extends TableCell<FournisseurGestionList, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/detailbutton.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){ //Action when the button is pressed
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
|
||||
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Fournisseur/FournisseurGerer.fxml"));
|
||||
Parent ParentFxmlFournisseur = (Parent)fxmlLoader.load();
|
||||
|
||||
FournisseurGererController FournisseurGerer = fxmlLoader.getController();
|
||||
|
||||
FournisseurGestionList FournisseurList = ((FournisseurGestionList)getTableRow().getItem());
|
||||
FournisseurGerer.SetDataFournissuer(FournisseurList.getCode());
|
||||
|
||||
|
||||
PaneFournisseurGestion.getChildren().clear();
|
||||
PaneFournisseurGestion.getChildren().add(ParentFxmlFournisseur);
|
||||
} catch (IOException ex) {
|
||||
logger.error("FournisseurGestionController : FournisseurGerer.fxml :" + ex.getMessage());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void FournisseurAjouterButtonAction(ActionEvent event) throws IOException {
|
||||
PaneFournisseurGestion.getChildren().clear();
|
||||
PaneFournisseurGestion.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Fournisseur/FournisseurGerer.fxml")));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchFournisseurGestion()
|
||||
{
|
||||
ProgressBarFournisseurGestion.setVisible(true);
|
||||
|
||||
ButtonSearchFournisseurGestion.setDisable(true);
|
||||
|
||||
ThreadSearchFournisseurGestion = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
ObservableList<FournisseurGestionList> ListFournisseurGestions = new FournisseurDB().SearchFournisseurGestion(
|
||||
position,
|
||||
nbrligne,
|
||||
TextFieldCodeFournisseur.getText(),
|
||||
TextFieldNomFournisseur.getText(),
|
||||
TextFieldAdresseFournisseur.getText(),
|
||||
TextFieldTeleFournisseur.getText(),
|
||||
TextFieldFaxFournisseur.getText(),
|
||||
TextFieldMailFournisseur.getText());
|
||||
|
||||
TableViewFournisseurGestion.setItems(ListFournisseurGestions);
|
||||
|
||||
totalcount = new FournisseurDB().nbrFournisseurGestion(TextFieldCodeFournisseur.getText(), TextFieldNomFournisseur.getText(), TextFieldAdresseFournisseur.getText(), TextFieldTeleFournisseur.getText(), TextFieldFaxFournisseur.getText(), TextFieldMailFournisseur.getText());
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchFournisseurGestion.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarFournisseurGestion.setVisible(false);
|
||||
ButtonSearchFournisseurGestion.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchFournisseurGestion.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchFournisseurGestion(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarFournisseurGestion.setVisible(true);
|
||||
|
||||
ButtonSearchFournisseurGestion.setDisable(true);
|
||||
|
||||
ThreadSearchFournisseurGestion = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
ObservableList<FournisseurGestionList> ListFournisseurGestions = new FournisseurDB().SearchFournisseurGestion(ParmPosition, ParamNbrligne, TextFieldCodeFournisseur.getText(), TextFieldNomFournisseur.getText(), TextFieldAdresseFournisseur.getText(), TextFieldTeleFournisseur.getText(), TextFieldFaxFournisseur.getText(), TextFieldMailFournisseur.getText());
|
||||
|
||||
TableViewFournisseurGestion.setItems(ListFournisseurGestions);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchFournisseurGestion.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarFournisseurGestion.setVisible(false);
|
||||
ButtonSearchFournisseurGestion.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchFournisseurGestion.start();
|
||||
}
|
||||
|
||||
private void GestionSearchFournisseur()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchFournisseurGestion(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchFournisseurGestion(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchFournisseurGestion(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchFournisseurGestion(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchFournisseurGestion(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
38
src/main/java/Controllers/Home/AideController.java
Normal file
38
src/main/java/Controllers/Home/AideController.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package Controllers.Home;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.util.Duration;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class AideController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneAide ;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
FadeTransitionNode(AnchorPaneAide);
|
||||
|
||||
}
|
||||
|
||||
public void FadeTransitionNode(Node AnchorPane){
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(200), AnchorPane);
|
||||
ft.setFromValue(0);
|
||||
ft.setToValue(1.0);
|
||||
ft.play();
|
||||
}
|
||||
|
||||
}
|
||||
44
src/main/java/Controllers/Home/ContactController.java
Normal file
44
src/main/java/Controllers/Home/ContactController.java
Normal file
@@ -0,0 +1,44 @@
|
||||
package Controllers.Home;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.util.Duration;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class ContactController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneContact ;
|
||||
|
||||
@FXML public ChoiceBox ChoiceBoxMsgSujet;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
ChoiceBoxMsgSujet.setItems(FXCollections.observableArrayList("Une question relative à un problème technique.",
|
||||
"Besoin d'une nouvelle fonctionnalité."));
|
||||
|
||||
FadeTransitionNode(AnchorPaneContact);
|
||||
|
||||
}
|
||||
|
||||
public void FadeTransitionNode(Node AnchorPane){
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(200), AnchorPane);
|
||||
ft.setFromValue(0);
|
||||
ft.setToValue(1.0);
|
||||
ft.play();
|
||||
}
|
||||
|
||||
}
|
||||
119
src/main/java/Controllers/Home/DashboardController.java
Normal file
119
src/main/java/Controllers/Home/DashboardController.java
Normal file
@@ -0,0 +1,119 @@
|
||||
package Controllers.Home;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Models.Home.HomeDB;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.Node;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.chart.BarChart;
|
||||
import javafx.scene.chart.PieChart;
|
||||
import javafx.scene.chart.XYChart;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Duration;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class DashboardController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneDashboard ;
|
||||
|
||||
@FXML private Text TextYearDashboard;
|
||||
@FXML private Text TextNbrClient;
|
||||
@FXML private Text TextNbrVente;
|
||||
@FXML private Text TextNbrCheque;
|
||||
|
||||
@FXML public BarChart BarChartVente;
|
||||
@FXML private PieChart PieChartVente;
|
||||
|
||||
@FXML private ProgressBar ProgressBarLoading;
|
||||
|
||||
private Service<Void> ThreadDashboard;
|
||||
|
||||
String Year = Adaptateur.getDefaultCurrentDate("yyyy");
|
||||
|
||||
HomeDB Homedb = new HomeDB();
|
||||
|
||||
XYChart.Series series1 = new XYChart.Series();
|
||||
ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList();
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TextYearDashboard.setText("L'année "+Year);
|
||||
|
||||
FadeTransitionNode(AnchorPaneDashboard);
|
||||
|
||||
ProgressBarLoading.setVisible(true);
|
||||
ThreadDashboard = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
series1 = Homedb.HomeChiffreAffaireByMois();
|
||||
series1.setName(ParametreSystem.NomLocalPC);
|
||||
|
||||
pieChartData = Homedb.HomeVente(Year);
|
||||
|
||||
NombreVCV();
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadDashboard.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
BarChartVente.getData().addAll(series1);
|
||||
PieChartVente.setData(pieChartData);
|
||||
ProgressBarLoading.setVisible(false);
|
||||
|
||||
}
|
||||
});
|
||||
ThreadDashboard.start();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void FadeTransitionNode(Node AnchorPane){
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(200), AnchorPane);
|
||||
ft.setFromValue(0);
|
||||
ft.setToValue(1.0);
|
||||
ft.play();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void NombreVCV()
|
||||
{
|
||||
Map map = Homedb.HomeNbr();
|
||||
TextNbrClient.setText(map.get("client").toString());
|
||||
TextNbrVente.setText(map.get("factureclt").toString());
|
||||
TextNbrCheque.setText(map.get("cheque").toString());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
35
src/main/java/Controllers/Home/LogicielController.java
Normal file
35
src/main/java/Controllers/Home/LogicielController.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package Controllers.Home;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.util.Duration;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class LogicielController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneLogiciel ;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
FadeTransitionNode(AnchorPaneLogiciel);
|
||||
}
|
||||
|
||||
public void FadeTransitionNode(Node AnchorPane){
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(200), AnchorPane);
|
||||
ft.setFromValue(0);
|
||||
ft.setToValue(1.0);
|
||||
ft.play();
|
||||
}
|
||||
|
||||
}
|
||||
35
src/main/java/Controllers/Home/MentionsController.java
Normal file
35
src/main/java/Controllers/Home/MentionsController.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package Controllers.Home;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.util.Duration;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class MentionsController implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneMentions ;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
FadeTransitionNode(AnchorPaneMentions);
|
||||
}
|
||||
|
||||
public void FadeTransitionNode(Node AnchorPane){
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(200), AnchorPane);
|
||||
ft.setFromValue(0);
|
||||
ft.setToValue(1.0);
|
||||
ft.play();
|
||||
}
|
||||
|
||||
}
|
||||
11
src/main/java/Controllers/Main.java
Normal file
11
src/main/java/Controllers/Main.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package Controllers;
|
||||
|
||||
/**
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
App.main(args);
|
||||
}
|
||||
}
|
||||
335
src/main/java/Controllers/PrincipalController.java
Normal file
335
src/main/java/Controllers/PrincipalController.java
Normal file
@@ -0,0 +1,335 @@
|
||||
package Controllers;
|
||||
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Models.User.User;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Accordion;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TitledPane;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Element;
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
public class PrincipalController implements Initializable{
|
||||
|
||||
@FXML public AnchorPane window ;
|
||||
@FXML public AnchorPane Content ;
|
||||
@FXML public Pane TitrePane;
|
||||
@FXML public Label UsernomprenomBlad;
|
||||
@FXML public Label LabelDefaultLocal;
|
||||
|
||||
@FXML public ImageView ImageViewLogoPrincipal;
|
||||
@FXML public ImageView ImageViewProfile;
|
||||
|
||||
@FXML public Accordion accord;
|
||||
@FXML public TitledPane TitledPaneAccueil;
|
||||
@FXML public TitledPane TitledPaneAchat;
|
||||
@FXML public TitledPane TitledPaneVente;
|
||||
@FXML public TitledPane TitledPaneStock;
|
||||
@FXML public TitledPane TitledPaneDiver;
|
||||
|
||||
Logger logger = Logger.getLogger(PrincipalController.class.getName());
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
setImageLogo();
|
||||
|
||||
UsernomprenomBlad.setText(User.nom+" "+User.prenom);
|
||||
|
||||
LabelDefaultLocal.setText(User.UserLocal);
|
||||
|
||||
ImageViewProfile.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
try {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/User/Profile.fxml")));
|
||||
} catch (IOException ex) {
|
||||
logger.error("PrincipalController : Profile.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**********************Accueil************************/
|
||||
try {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Home/Dashboard.fxml")));
|
||||
} catch (IOException ex) {
|
||||
logger.error("PrincipalController : Dashboard.fxml :" + ex.getMessage());
|
||||
}
|
||||
accord.setExpandedPane(TitledPaneAccueil);
|
||||
|
||||
|
||||
|
||||
/********************get Width and Height Content **************************/
|
||||
|
||||
Content.widthProperty().addListener(new ChangeListener<Number>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends Number> observableValue, Number oldSceneWidth, Number newSceneWidth) {
|
||||
MyWindow.PrincipalContentWidth = newSceneWidth;
|
||||
}
|
||||
});
|
||||
|
||||
Content.heightProperty().addListener(new ChangeListener<Number>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends Number> observableValue, Number oldSceneHeight, Number newSceneHeight) {
|
||||
MyWindow.PrincipalContentHeight = newSceneHeight;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void DefaultSelectedTitledPane(Integer number_titled_Pane){
|
||||
if(number_titled_Pane == 1){
|
||||
accord.setExpandedPane(TitledPaneAccueil);
|
||||
}else if(number_titled_Pane == 2){
|
||||
accord.setExpandedPane(TitledPaneAchat);
|
||||
}else if(number_titled_Pane == 3){
|
||||
accord.setExpandedPane(TitledPaneVente);
|
||||
}else if(number_titled_Pane == 4){
|
||||
accord.setExpandedPane(TitledPaneStock);
|
||||
}else if(number_titled_Pane == 5){
|
||||
accord.setExpandedPane(TitledPaneDiver);
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************Accueil****************************************/
|
||||
@FXML
|
||||
private void DashbordButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Home/Dashboard.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void AideButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Home/Aide.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void ContactButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Home/Contact.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void LogicielButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Home/Logiciel.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void MentionsButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Home/Mentions.fxml")));
|
||||
}
|
||||
|
||||
/*********************************Pour l'Achat************************************/
|
||||
@FXML
|
||||
private void FournisseurButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Fournisseur/FournisseurGestion.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void BonReceptionButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/BonReceptionFrs/BonReceptionGestionFrs.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void FactureFrsButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/FactureFrs/FactureFrsGestion.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void ReglementButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Reglement/ReglementGestion.fxml")));
|
||||
}
|
||||
/*********************************Pour la Vente***********************************/
|
||||
|
||||
@FXML
|
||||
private void VenteRapideCltButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/VenteRapideClt/VenteRapideClt.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void PasserCommandeCltButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/CommandeClt/CommandeCltGestion.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void BonLivraisonCltButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/BonLivraisonClt/BonLivraisonCltGestion.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void FactureCltButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/FactureClt/FactureCltGestion.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void MenuClientButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Client/MenuClient.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void DevisCltButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Devis/DevisCltGestion.fxml")));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************************Pour Produit**********************************/
|
||||
@FXML
|
||||
private void AjouterProduitButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Produit/AjouterProduit.fxml")));
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void GestionProduitButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Produit/GestionProduit.fxml")));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************************Pour l'utilisateur***********************************/
|
||||
@FXML
|
||||
private void AddUserButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/User/AddUser.fxml")));
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void GestionUtilisateurButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/User/GestionUtilisateur.fxml")));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/********************************* Stock ***********************************/
|
||||
|
||||
@FXML
|
||||
private void BondeSortieButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Stock/BondeSortie.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void BondeEntrerButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Stock/BondeEntrer.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void EtatStockButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Stock/EtatStockCategorie.fxml")));
|
||||
}
|
||||
|
||||
/********************************* Caisse ***********************************/
|
||||
|
||||
@FXML
|
||||
private void ChequeCltButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/ChequeClt/ChequeCltGestion.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void CaisseEntreButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Caisse/CaisseEntre.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void CaisseSortieButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Caisse/CaisseSortie.fxml")));
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void FraisButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Caisse/FraisGestion.fxml")));
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void TraiteCltButtonAction(ActionEvent event) throws IOException {
|
||||
window.getChildren().clear();
|
||||
window.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/TraiteClt/TraiteCltGestion.fxml")));
|
||||
}
|
||||
|
||||
private void setImageLogo()
|
||||
{
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
try {
|
||||
// optional, but recommended
|
||||
// process XML securely, avoid attacks like XML External Entities (XXE)
|
||||
dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
|
||||
|
||||
// parse XML file
|
||||
DocumentBuilder db = dbf.newDocumentBuilder();
|
||||
|
||||
//PowerERP\conf\logo.xml
|
||||
Document doc = db.parse(new File("./conf/logo.xml"));
|
||||
|
||||
doc.getDocumentElement().normalize();
|
||||
|
||||
Element elementCNX = (Element) doc.getElementsByTagName("Principal").item(0);
|
||||
|
||||
String pathLogo = elementCNX.getElementsByTagName("PathImage").item(0).getTextContent();
|
||||
FileInputStream fis = new FileInputStream(pathLogo);
|
||||
ImageViewLogoPrincipal.setImage(new Image(fis));
|
||||
|
||||
ImageViewLogoPrincipal.setFitWidth(Double.parseDouble(elementCNX.getElementsByTagName("FitWidth").item(0).getTextContent()));
|
||||
ImageViewLogoPrincipal.setFitHeight(Double.parseDouble(elementCNX.getElementsByTagName("FitHeight").item(0).getTextContent()));
|
||||
ImageViewLogoPrincipal.setLayoutX(Double.parseDouble(elementCNX.getElementsByTagName("LayoutX").item(0).getTextContent()));
|
||||
ImageViewLogoPrincipal.setLayoutY(Double.parseDouble(elementCNX.getElementsByTagName("LayoutY").item(0).getTextContent()));
|
||||
}
|
||||
catch (ParserConfigurationException | SAXException | IOException e) {
|
||||
System.out.println("error AuthentificationController/setImageLogo "+e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
324
src/main/java/Controllers/Produit/AjouterProduitController.java
Normal file
324
src/main/java/Controllers/Produit/AjouterProduitController.java
Normal file
@@ -0,0 +1,324 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.Produit;
|
||||
|
||||
import Controllers.Categorie.AjouterCategorieController;
|
||||
import Controllers.Dialog.ShowDialog;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.Categorie.CategorieDB;
|
||||
import Models.Produit.Produit;
|
||||
import Models.Produit.ProduitDB;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ColorPicker;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.scene.web.HTMLEditor;
|
||||
import javafx.util.Duration;
|
||||
import org.controlsfx.control.textfield.TextFields;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
*
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class AjouterProduitController implements Initializable {
|
||||
|
||||
@FXML private ProgressBar ProgressBarAjouterProduit;
|
||||
|
||||
//private AnchorPane Content ;
|
||||
@FXML private AnchorPane AnchorPaneAjouterprod ;
|
||||
@FXML private AnchorPane AnchorPaneAjouterProduit ;
|
||||
@FXML private TextField AjouterProduitReference;
|
||||
@FXML private TextField AjouterProduitdesignation ;
|
||||
@FXML private TextField AjouterProduitGarantie ;
|
||||
@FXML private TextField AjouterProduitMarque ;
|
||||
|
||||
@FXML private TextField AjouterProduitPrixAchatTTC ;
|
||||
@FXML private TextField AjouterProduittvaAchat ;
|
||||
@FXML private TextField AjouterProduitPrixAchatHT ;
|
||||
|
||||
@FXML private TextField AjouterProduitMarge ;
|
||||
|
||||
@FXML private TextField AjouterProduitPrixVenteTTC ;
|
||||
@FXML private TextField AjouterProduittvaVente ;
|
||||
@FXML private TextField AjouterProduitPrixVenteHT ;
|
||||
|
||||
@FXML private TextField AjouterProduitQualite ;
|
||||
@FXML private TextField AjouterProduitPoids ;
|
||||
@FXML private TextField AjouterProduitDimensions;
|
||||
@FXML private TextField AjouterProduitVitesse;
|
||||
@FXML private TextField AjouterProduitPuissance;
|
||||
@FXML private TextField AjouterProduitCapacite;
|
||||
|
||||
@FXML public TextField AjouterProduitcategorie ;
|
||||
@FXML private ColorPicker AjouterProduitCouleur ;
|
||||
@FXML private TextArea TextAreaDescription ;
|
||||
|
||||
|
||||
@FXML private Text ErreurReference ;
|
||||
@FXML private Text ErreurDesignation ;
|
||||
@FXML private Text ErreurPrixVenteHT;
|
||||
@FXML private Text ErreurtvaVente ;
|
||||
@FXML private Text ErreurPrixVenteTTC;
|
||||
|
||||
@FXML private Text ErreurGarantie ;
|
||||
@FXML private Text Erreurcategorie ;
|
||||
@FXML private Text ErreurMarque ;
|
||||
@FXML private Text ErreurQualite;
|
||||
@FXML private Text ErreurPrixAchatHT;
|
||||
@FXML private Text ErreurtvaAchat ;
|
||||
@FXML private Text ErreurPrixAchatTTC;
|
||||
|
||||
@FXML private Text ErreurMarge;
|
||||
|
||||
@FXML private Text TextCurrencySign;
|
||||
|
||||
@FXML private GridPane GridPaneSuccessAddProd;
|
||||
@FXML private Button ButtonResetFormProduit;
|
||||
@FXML private Text TextSuccessAddProd;
|
||||
|
||||
private Service<Void> ThreadAjouterProduit;
|
||||
|
||||
String address = " ";
|
||||
contro ctl= new contro() ;
|
||||
Produit prod = new Produit();
|
||||
ProduitDB dbproduit = new ProduitDB();
|
||||
CategorieDB dbcategorie = new CategorieDB();
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
TextSuccessAddProd.setFont(Font.loadFont(getClass().getResourceAsStream("/Public/Fonts/Raleway-SemiBold.ttf"), 20));
|
||||
|
||||
setCategorieFormData();
|
||||
|
||||
TextCurrencySign.setText(ParametreSystem.CurrencySign);
|
||||
|
||||
|
||||
AjouterProduittvaAchat.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke){
|
||||
|
||||
if(!ctl.isFloatNotnull(AjouterProduitPrixAchatHT.getText()) && !ctl.isFloatNotnull(AjouterProduittvaAchat.getText())){
|
||||
float prixachatht = Adaptateur.StringToFloat(AjouterProduitPrixAchatHT.getText());
|
||||
float tvavente = Adaptateur.StringToFloat(AjouterProduittvaAchat.getText());
|
||||
float prixachatttc = prixachatht + (prixachatht*tvavente)/100 ;
|
||||
AjouterProduitPrixAchatTTC.setText(Adaptateur.ArrondFloatToString(prixachatttc));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AjouterProduitMarge.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke){
|
||||
if(!ctl.isFloatNotnull(AjouterProduitPrixAchatTTC.getText().replace(',','.')) && !ctl.isFloatNotnull(AjouterProduitMarge.getText().replace(',','.')) ){
|
||||
float marge = Adaptateur.StringToFloat(AjouterProduitMarge.getText());
|
||||
float prixachatttc = Adaptateur.StringToFloat(AjouterProduitPrixAchatTTC.getText());
|
||||
float prixventht = prixachatttc + (prixachatttc*marge)/100 ;
|
||||
AjouterProduitPrixVenteHT.setText(Adaptateur.ArrondFloatToString(prixventht));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AjouterProduittvaVente.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke){
|
||||
if(!ctl.isFloatNotnull(AjouterProduitPrixVenteHT.getText().replace(',','.')) && !ctl.isFloatNotnull(AjouterProduittvaVente.getText().replace(',','.'))){
|
||||
float prixventht = Adaptateur.StringToFloat(AjouterProduitPrixVenteHT.getText());
|
||||
float tvavente = Adaptateur.StringToFloat(AjouterProduittvaVente.getText());
|
||||
|
||||
float prixventttc = prixventht + ((prixventht*tvavente)/100) ;
|
||||
//System.out.println("Prix H.T: "+prixventht*6+" TVA: "+((prixventht*tvavente)/100)*6+" PrixTTC"+prixventttc*6);
|
||||
AjouterProduitPrixVenteTTC.setText(Adaptateur.ArrondFloatToString(prixventttc));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
//ajouter un nouvelle catégorie
|
||||
@FXML
|
||||
private void AjouterCategorieButtonAction(ActionEvent event) throws IOException {
|
||||
final AjouterCategorieController AjouterCategorie = new AjouterCategorieController();
|
||||
AjouterCategorie.Show();
|
||||
AjouterCategorie.ButtonAjouterCategory.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent e) {
|
||||
String NewCategory = AjouterCategorie.AjouterCategorieTraitement();
|
||||
AjouterProduitcategorie.setText(NewCategory);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void AjouterProduitButtonAction(ActionEvent event) throws IOException {
|
||||
|
||||
if( ctl.ContrNull(AjouterProduitReference,ErreurReference) &&
|
||||
ctl.ContrNull(AjouterProduitdesignation, ErreurDesignation)&&
|
||||
ctl.ContrNull(AjouterProduitcategorie, Erreurcategorie)&&
|
||||
ctl.ContrNull(AjouterProduitMarque, ErreurMarque)&&
|
||||
ctl.ContrNumerique(AjouterProduitGarantie, ErreurGarantie)&&
|
||||
ctl.ContrNumerique(AjouterProduitQualite, ErreurQualite)&&
|
||||
ctl.ContrReelNotNull(AjouterProduitPrixAchatHT, ErreurPrixAchatHT)&&
|
||||
ctl.ContrReelNotNull(AjouterProduittvaAchat, ErreurtvaAchat)&&
|
||||
ctl.ContrReelNotNull(AjouterProduitPrixAchatTTC, ErreurPrixAchatTTC)&&
|
||||
ctl.ContrReelNotNull(AjouterProduitMarge, ErreurMarge) &&
|
||||
ctl.ContrReelNotNull(AjouterProduitPrixVenteHT, ErreurPrixVenteHT)&&
|
||||
ctl.ContrReelNotNull(AjouterProduittvaVente, ErreurtvaVente)&&
|
||||
ctl.ContrReelNotNull(AjouterProduitPrixVenteTTC, ErreurPrixVenteTTC)){
|
||||
|
||||
if(!new CategorieDB().verifyCategorie(AjouterProduitcategorie.getText())){
|
||||
Erreurcategorie.setText("categorie n'existe pas");
|
||||
Erreurcategorie.setStyle("-fx-border-color:#f20606;");
|
||||
}else{
|
||||
this.getProduit();
|
||||
if(dbproduit.addProduit(prod)){ //l'insertion des données dont la Base des données et afficher le message du succés
|
||||
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(400), AnchorPaneAjouterProduit);
|
||||
ft.setFromValue(1.0);
|
||||
ft.setToValue(0.0);
|
||||
ft.play();
|
||||
|
||||
ft.setOnFinished(new EventHandler<ActionEvent>() {
|
||||
//message de succés
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
|
||||
GridPaneSuccessAddProd.setVisible(true);
|
||||
|
||||
ButtonResetFormProduit.setOnAction(new EventHandler<ActionEvent>() { //supprimer le message du suucés et reaficher les formulaires
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
GridPaneSuccessAddProd.setVisible(false);
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(400), AnchorPaneAjouterProduit);
|
||||
ft.setFromValue(0.0);
|
||||
ft.setToValue(1.0);
|
||||
ft.play();
|
||||
restechamp();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
ShowDialog SD = new ShowDialog();
|
||||
SD.ShowAletDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//récuperation des formulaire dans l'objet Produit
|
||||
private void getProduit()
|
||||
{
|
||||
prod.setReference(AjouterProduitReference.getText());
|
||||
prod.setDesignation(AjouterProduitdesignation.getText());
|
||||
prod.setCategorie(AjouterProduitcategorie.getText());
|
||||
|
||||
prod.setGarantieString(AjouterProduitGarantie.getText());
|
||||
prod.setMarque(AjouterProduitMarque.getText());
|
||||
|
||||
prod.setPrixachatttc(AjouterProduitPrixAchatTTC.getText());
|
||||
prod.setPrixachatht(AjouterProduitPrixAchatHT.getText());
|
||||
prod.setTvaachat(AjouterProduittvaAchat.getText());
|
||||
|
||||
prod.setMarge(AjouterProduitMarge.getText());
|
||||
|
||||
prod.setPrixventettc(AjouterProduitPrixVenteTTC.getText());
|
||||
prod.setPrixventeht(AjouterProduitPrixVenteHT.getText());
|
||||
prod.setTvavente(AjouterProduittvaVente.getText());
|
||||
|
||||
if(AjouterProduitQualite.getText().isEmpty()){ prod.setQualite(1); } else{ prod.setQualite(Integer.parseInt(AjouterProduitQualite.getText())); }
|
||||
|
||||
prod.setPoids(AjouterProduitPoids.getText());
|
||||
prod.setCapacite(AjouterProduitCapacite.getText());
|
||||
prod.setDimensions(AjouterProduitDimensions.getText());
|
||||
prod.setVitesse(AjouterProduitVitesse.getText());
|
||||
prod.setPuissance(AjouterProduitPuissance.getText());
|
||||
prod.setCouleur(AjouterProduitCouleur.getValue().toString());
|
||||
prod.setDescription(TextAreaDescription.getText());
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void restechamp()
|
||||
{
|
||||
AjouterProduitReference.setText("");
|
||||
AjouterProduitdesignation.setText("");
|
||||
AjouterProduitGarantie.setText("");
|
||||
AjouterProduitcategorie.setText("");
|
||||
AjouterProduittvaAchat.setText("");
|
||||
AjouterProduitPrixAchatHT.setText("");
|
||||
AjouterProduitPrixVenteHT.setText("");
|
||||
AjouterProduittvaVente.setText("");
|
||||
AjouterProduitGarantie.setText("");
|
||||
AjouterProduitMarque.setText("");
|
||||
AjouterProduitPoids.setText("");
|
||||
AjouterProduitPrixAchatTTC.setText("");
|
||||
AjouterProduitPrixVenteTTC.setText("");
|
||||
AjouterProduitMarge.setText("");
|
||||
AjouterProduitDimensions.setText("");
|
||||
AjouterProduitVitesse.setText("");
|
||||
AjouterProduitPuissance.setText("");
|
||||
AjouterProduitCapacite.setText("");
|
||||
AjouterProduitCouleur.setValue(Color.TRANSPARENT);
|
||||
TextAreaDescription.setText("");
|
||||
|
||||
}
|
||||
|
||||
private void setCategorieFormData()
|
||||
{
|
||||
ProgressBarAjouterProduit.setVisible(true);
|
||||
|
||||
ThreadAjouterProduit = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
TextFields.bindAutoCompletion(AjouterProduitcategorie, new CategorieDB().getListCategorie());
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadAjouterProduit.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarAjouterProduit.setVisible(false);
|
||||
}
|
||||
});
|
||||
ThreadAjouterProduit.start();
|
||||
}
|
||||
}
|
||||
540
src/main/java/Controllers/Produit/GestionProduitController.java
Normal file
540
src/main/java/Controllers/Produit/GestionProduitController.java
Normal file
@@ -0,0 +1,540 @@
|
||||
package Controllers.Produit;
|
||||
|
||||
import Models.Categorie.CategorieDB;
|
||||
import Models.Produit.Produit;
|
||||
import Models.Produit.ProduitDB;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
import org.controlsfx.control.textfield.TextFields;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class GestionProduitController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(GestionProduitController.class.getName());
|
||||
|
||||
@FXML private Button addProduit ;
|
||||
@FXML private Button ButtonSearchProduit ;
|
||||
@FXML private Label LabelCount ;
|
||||
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
@FXML private AnchorPane AnchorPaneGestionClt;
|
||||
@FXML private AnchorPane ListerPages;
|
||||
|
||||
@FXML private ProgressBar ProgressBarProduit;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
|
||||
@FXML private AnchorPane AnchorPaneProduit;
|
||||
@FXML private TextField GestionProduitReference ;
|
||||
@FXML private TextField GestionProduitDesignation;
|
||||
@FXML private TextField GestionProduitMarque;
|
||||
@FXML private TextField GestionProduitCategorie;
|
||||
|
||||
|
||||
@FXML private TableView<Produit> TableViewListeGestionProduit ;
|
||||
|
||||
@FXML private TableColumn<Produit ,String> TabColReference;
|
||||
@FXML private TableColumn<Produit ,String> TabColDesignation;
|
||||
@FXML private TableColumn<Produit ,String> TabColMarque ;
|
||||
@FXML private TableColumn<Produit ,String> TabColCategorie;
|
||||
@FXML private TableColumn<Produit ,String> TabColPrixTTC;
|
||||
@FXML private TableColumn<Produit ,String> TabColQuantite;
|
||||
@FXML private TableColumn<Produit, Boolean> TabColAction ;
|
||||
|
||||
private Service<Void> ThreadSearchProduit;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0 ;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
public static String refprod ;
|
||||
|
||||
ProduitDB ProdDB =new ProduitDB();
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
getCategorie();
|
||||
|
||||
|
||||
//comboboxnombre des lignes tableview
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
this.AjouterProduit();
|
||||
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<Produit, String>("reference"));
|
||||
TabColDesignation.setCellValueFactory(new PropertyValueFactory<Produit, String>("designation"));
|
||||
TabColMarque.setCellValueFactory(new PropertyValueFactory<Produit, String>("marque"));
|
||||
TabColCategorie.setCellValueFactory(new PropertyValueFactory<Produit, String>("categorie"));
|
||||
TabColPrixTTC.setCellValueFactory(new PropertyValueFactory<Produit, String>("prixventettc"));
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<Produit, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
|
||||
TabColAction.setSortable(true);
|
||||
TabColAction.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColAction.getStyleClass().add("Center");
|
||||
TabColAction.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Produit, Boolean>,ObservableValue<Boolean>>(){
|
||||
@Override
|
||||
public ObservableValue<Boolean> call(TableColumn.CellDataFeatures<Produit, Boolean> p) {
|
||||
return new SimpleBooleanProperty(p.getValue() != null);
|
||||
}
|
||||
});
|
||||
|
||||
// create a cell value factory with an add button for each row in the table.
|
||||
TabColAction.setCellFactory(new Callback<TableColumn<Produit, Boolean>, TableCell<Produit, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<Produit, Boolean> call(TableColumn<Produit, Boolean> personBooleanTableColumn) {
|
||||
return new ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//double clique sur une ligne
|
||||
TableViewListeGestionProduit.setOnMouseClicked(new EventHandler<javafx.scene.input.MouseEvent>(){
|
||||
public void handle(MouseEvent event){
|
||||
if(event.getClickCount()>1){
|
||||
if(TableViewListeGestionProduit.getSelectionModel().getSelectedIndex()>=0){
|
||||
//System.out.println(getCode());
|
||||
GestionProduitController.refprod=TableViewListeGestionProduit.getSelectionModel().getSelectedItem().getReference();
|
||||
AnchorPaneProduit.getChildren().clear();
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Produit/ModifierProduit.fxml"));
|
||||
Parent root = (Parent)fxmlLoader.load();
|
||||
AnchorPaneProduit.getChildren().add(root);
|
||||
} catch (IOException ex) {
|
||||
logger.error("GestionProduitController : ModifierProduit.fxml :" + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
GestionSearchProduit();
|
||||
|
||||
ButtonSearchProduit.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchProduit();
|
||||
}
|
||||
});
|
||||
|
||||
AnchorPaneProduit.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchProduit();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
SearchProduit();
|
||||
}
|
||||
|
||||
|
||||
private void getCategorie()
|
||||
{
|
||||
ProgressBarProduit.setVisible(true);
|
||||
|
||||
ThreadSearchProduit = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
TextFields.bindAutoCompletion(GestionProduitCategorie, new CategorieDB().getListCategorie());
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchProduit.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarProduit.setVisible(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchProduit.start();
|
||||
}
|
||||
|
||||
|
||||
private void AjouterProduit()
|
||||
{
|
||||
addProduit.getStyleClass().add("btn-success");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconadd.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
addProduit.setGraphic(buttonGraphic);
|
||||
|
||||
addProduit.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override public void handle(ActionEvent e) {
|
||||
try {
|
||||
AnchorPaneProduit.getChildren().clear();
|
||||
AnchorPaneProduit.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Produit/AjouterProduit.fxml")));
|
||||
} catch (IOException ex) {
|
||||
logger.error("GestionProduitController : AjouterProduit.fxml :" + ex.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
//Define the button cell
|
||||
private class ButtonCell extends TableCell<Produit, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
|
||||
ButtonCell(){
|
||||
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconedit.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
//Action when the button is pressed
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
// get Selected Item
|
||||
Produit currentPerson = (Produit) ButtonCell.this.getTableView().getItems().get(ButtonCell.this.getIndex());
|
||||
GestionProduitController.refprod=currentPerson.getReference();
|
||||
AnchorPaneProduit.getChildren().clear();
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Produit/ModifierProduit.fxml"));
|
||||
Parent root = (Parent)fxmlLoader.load();
|
||||
AnchorPaneProduit.getChildren().add(root);
|
||||
} catch (IOException ex) {
|
||||
logger.error("GestionProduitController : ModifierProduit.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void getReferenceProduitOnclick(){
|
||||
GestionProduitReference.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if(totalcount<10){
|
||||
ListerPages.setVisible(false);
|
||||
}
|
||||
else{
|
||||
ListerPages.setVisible(true);
|
||||
}
|
||||
SearchProduit();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void getDesignationProduitOnclick(){
|
||||
GestionProduitDesignation.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if(totalcount<10){
|
||||
ListerPages.setVisible(false);
|
||||
}
|
||||
else{
|
||||
ListerPages.setVisible(true);
|
||||
}
|
||||
SearchProduit();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void getMarqueProduitOnclick(){
|
||||
GestionProduitMarque.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if(totalcount<10){
|
||||
ListerPages.setVisible(false);
|
||||
}
|
||||
else{
|
||||
ListerPages.setVisible(true);
|
||||
}
|
||||
SearchProduit();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void getCategorieProduitOnclick(){
|
||||
GestionProduitCategorie.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if(totalcount<10){
|
||||
ListerPages.setVisible(false);
|
||||
}
|
||||
else{
|
||||
ListerPages.setVisible(true);
|
||||
}
|
||||
SearchProduit();
|
||||
}
|
||||
});
|
||||
GestionProduitCategorie.textProperty().addListener(new ChangeListener<String>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
||||
SearchProduit();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView client Entreprise *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchProduit()
|
||||
{
|
||||
ProgressBarProduit.setVisible(true);
|
||||
|
||||
ButtonSearchProduit.setDisable(true);
|
||||
|
||||
ThreadSearchProduit = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
ObservableList<Produit> ListProduits = new ProduitDB().SearchProduit(position, nbrligne, true, GestionProduitReference.getText(), GestionProduitCategorie.getText(), GestionProduitMarque.getText(), GestionProduitDesignation.getText());
|
||||
TableViewListeGestionProduit.setItems(ListProduits);
|
||||
|
||||
totalcount = new ProduitDB().nbrSearchProduit(true, GestionProduitReference.getText(), GestionProduitCategorie.getText(), GestionProduitMarque.getText(), GestionProduitDesignation.getText());
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchProduit.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarProduit.setVisible(false);
|
||||
ButtonSearchProduit.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchProduit.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchProduit(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarProduit.setVisible(true);
|
||||
|
||||
ButtonSearchProduit.setDisable(true);
|
||||
|
||||
ThreadSearchProduit = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{//
|
||||
|
||||
ObservableList<Produit> ListProduits = new ProduitDB().SearchProduit(ParmPosition, ParamNbrligne, true, GestionProduitReference.getText(), GestionProduitCategorie.getText(), GestionProduitMarque.getText(), GestionProduitDesignation.getText());
|
||||
|
||||
TableViewListeGestionProduit.setItems(ListProduits);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchProduit.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarProduit.setVisible(false);
|
||||
ButtonSearchProduit.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchProduit.start();
|
||||
}
|
||||
|
||||
private void GestionSearchProduit()
|
||||
{
|
||||
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchProduit(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchProduit(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchProduit(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchProduit(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchProduit(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
294
src/main/java/Controllers/Produit/ModifierProduitController.java
Normal file
294
src/main/java/Controllers/Produit/ModifierProduitController.java
Normal file
@@ -0,0 +1,294 @@
|
||||
package Controllers.Produit;
|
||||
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.Categorie.CategorieDB;
|
||||
import Models.Produit.Produit;
|
||||
import Models.Produit.ProduitDB;
|
||||
import java.io.IOException;
|
||||
import java.math.RoundingMode;
|
||||
import java.net.URL;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.animation.FadeTransition;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.geometry.Pos;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ColorPicker;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.TextArea;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Duration;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class ModifierProduitController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(ModifierProduitController.class.getName());
|
||||
|
||||
public String Reference = GestionProduitController.refprod;
|
||||
|
||||
//private AnchorPane Content ;
|
||||
@FXML private AnchorPane AnchorPaneModifierprod ;
|
||||
@FXML private AnchorPane AnchorPaneModifierProduit ;
|
||||
@FXML private TextField ModifierProduitReference;
|
||||
@FXML private TextField ModifierProduitdesignation ;
|
||||
@FXML private TextField ModifierProduitGarantie ;
|
||||
@FXML private TextField ModifierProduitMarque ;
|
||||
@FXML private ComboBox ModifierProduitcategorie ;
|
||||
@FXML private ColorPicker ModifierProduitCouleur ;
|
||||
@FXML private TextArea ModifierProduitDescription ;
|
||||
|
||||
@FXML private TextField ModifierProduitPrixAchatTTC ;
|
||||
@FXML private TextField ModifierProduittvaAchat ;
|
||||
@FXML private TextField ModifierProduitPrixAchatHT ;
|
||||
|
||||
@FXML private TextField ModifierProduitMarge ;
|
||||
|
||||
@FXML private TextField ModifierProduitPrixVenteTTC ;
|
||||
@FXML private TextField ModifierProduittvaVente ;
|
||||
@FXML private TextField ModifierProduitPrixVenteHT ;
|
||||
|
||||
@FXML private TextField ModifierProduitQualite;
|
||||
@FXML private TextField ModifierProduitPoids ;
|
||||
@FXML private TextField ModifierProduitDimensions;
|
||||
@FXML private TextField ModifierProduitVitesse;
|
||||
@FXML private TextField ModifierProduitPuissance;
|
||||
@FXML private TextField ModifierProduitCapacite;
|
||||
|
||||
@FXML private Text ErreurReference ;
|
||||
@FXML private Text ErreurDesignation ;
|
||||
|
||||
@FXML private Text ErreurQualite ;
|
||||
@FXML private Text ErreurGarantie ;
|
||||
@FXML private Text Erreurcategorie ;
|
||||
@FXML private Text ErreurMarque ;
|
||||
|
||||
@FXML private Text ErreurPrixAchatHT ;
|
||||
@FXML private Text ErreurtvaAchat ;
|
||||
@FXML private Text ErreurPrixAchatTTC ;
|
||||
|
||||
@FXML private Text ErreurMarge ;
|
||||
|
||||
@FXML private Text ErreurPrixVenteHT ;
|
||||
@FXML private Text ErreurtvaVente ;
|
||||
@FXML private Text ErreurPrixVenteTTC ;
|
||||
|
||||
contro ctl= new contro() ;
|
||||
Produit prod = new Produit();
|
||||
ProduitDB dbproduit = new ProduitDB();
|
||||
CategorieDB dbcategorie = new CategorieDB();
|
||||
DecimalFormat df = new DecimalFormat("#.000");
|
||||
|
||||
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
//liste categorie
|
||||
ModifierProduitcategorie.getItems().addAll(dbcategorie.getListCategorie());
|
||||
|
||||
prod = dbproduit.getProduit(Reference);
|
||||
|
||||
ModifierProduitReference.setText(prod.getReference());
|
||||
ModifierProduitMarque.setText(prod.getMarque()) ;
|
||||
ModifierProduitGarantie.setText(String.valueOf(prod.getGarantie())) ;
|
||||
ModifierProduitdesignation.setText(prod.getDesignation()) ;
|
||||
ModifierProduitcategorie.setValue(prod.getCategorie()) ;
|
||||
|
||||
df.setMaximumFractionDigits(3);
|
||||
|
||||
ModifierProduitPrixAchatHT.setText(prod.getPrixachatht());
|
||||
ModifierProduittvaAchat.setText(prod.getTvaachat()) ;
|
||||
ModifierProduitPrixAchatTTC.setText(prod.getPrixachatttc());
|
||||
|
||||
ModifierProduitMarge.setText(prod.getMarge()) ;
|
||||
|
||||
ModifierProduitPrixVenteHT.setText(prod.getPrixventeht()) ;
|
||||
ModifierProduittvaVente.setText(prod.getTvavente());
|
||||
ModifierProduitPrixVenteTTC.setText(prod.getPrixventettc()) ;
|
||||
|
||||
Color c = Color.web(prod.getCouleur());
|
||||
ModifierProduitCouleur.setValue(c) ;
|
||||
ModifierProduitDescription.setText(prod.getDescription()) ;
|
||||
ModifierProduitQualite.setText(prod.getQualiteString());
|
||||
ModifierProduitPoids.setText(prod.getPoids()) ;
|
||||
ModifierProduitDimensions.setText(prod.getDimensions());
|
||||
ModifierProduitVitesse.setText(prod.getVitesse());
|
||||
ModifierProduitPuissance.setText(prod.getPuissance());
|
||||
ModifierProduitCapacite.setText(prod.getCapacite());
|
||||
|
||||
ModifierProduittvaAchat.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke){
|
||||
|
||||
if(!ctl.isFloatNotnull(ModifierProduitPrixAchatHT.getText()) && !ctl.isFloatNotnull(ModifierProduittvaAchat.getText())){
|
||||
float prixachatht = Float.parseFloat(ModifierProduitPrixAchatHT.getText().replace(',','.'));
|
||||
float tvavente = Float.parseFloat(ModifierProduittvaAchat.getText().replace(',','.'));
|
||||
float prixachatttc = prixachatht + (prixachatht*tvavente)/100 ;
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
ModifierProduitPrixAchatTTC.setText(df.format(prixachatttc).replace(',','.'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ModifierProduitMarge.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke){
|
||||
if(!ctl.isFloatNotnull(ModifierProduitPrixAchatTTC.getText()) && !ctl.isFloatNotnull(ModifierProduitMarge.getText()) ){
|
||||
float marge = Float.parseFloat(ModifierProduitMarge.getText().replace(',','.'));
|
||||
float prixachatttc = Float.parseFloat(ModifierProduitPrixAchatTTC.getText().replace(',','.'));
|
||||
float prixventht = prixachatttc + (prixachatttc*marge)/100 ;
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
ModifierProduitPrixVenteHT.setText(df.format(prixventht).replace(',','.'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ModifierProduittvaVente.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke){
|
||||
if(!ctl.isFloatNotnull(ModifierProduitPrixVenteHT.getText()) && !ctl.isFloatNotnull(ModifierProduittvaVente.getText())){
|
||||
float prixventht = Float.parseFloat(ModifierProduitPrixVenteHT.getText().replace(',','.'));
|
||||
float tvavente = Float.parseFloat(ModifierProduittvaVente.getText().replace(',','.'));
|
||||
float prixventttc = prixventht + (prixventht*tvavente)/100 ;
|
||||
df.setRoundingMode(RoundingMode.DOWN);
|
||||
ModifierProduitPrixVenteTTC.setText(df.format(prixventttc).replace(',','.'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void ModifierProduitButtonAction(ActionEvent event) throws IOException {
|
||||
if( ctl.ContrNull(ModifierProduitReference,ErreurReference) &&
|
||||
ctl.ContrNull(ModifierProduitdesignation, ErreurDesignation)&&
|
||||
ctl.ContrNullValue(ModifierProduitcategorie, Erreurcategorie)&&
|
||||
ctl.ContrNull(ModifierProduitMarque, ErreurMarque)&&
|
||||
ctl.ContrNumerique(ModifierProduitGarantie, ErreurGarantie)&&
|
||||
ctl.ContrNumerique(ModifierProduitQualite, ErreurQualite)&&
|
||||
ctl.ContrReelNotNull(ModifierProduitPrixAchatHT, ErreurPrixAchatHT)&&
|
||||
ctl.ContrReelNotNull(ModifierProduittvaAchat, ErreurtvaAchat)&&
|
||||
ctl.ContrReelNotNull(ModifierProduitPrixAchatTTC, ErreurPrixAchatTTC)&&
|
||||
ctl.ContrReelNotNull(ModifierProduitMarge, ErreurMarge) &&
|
||||
ctl.ContrReelNotNull(ModifierProduitPrixVenteHT, ErreurPrixVenteHT)&&
|
||||
ctl.ContrReelNotNull(ModifierProduittvaVente, ErreurtvaVente)&&
|
||||
ctl.ContrReelNotNull(ModifierProduitPrixVenteTTC, ErreurPrixVenteTTC) ){
|
||||
|
||||
if(dbproduit.UpdateProduit(getProduit(),Reference)==1){
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(400), AnchorPaneModifierProduit);
|
||||
ft.setFromValue(1.0);
|
||||
ft.setToValue(0.0);
|
||||
ft.play();
|
||||
|
||||
ft.setOnFinished(new EventHandler<ActionEvent>() {
|
||||
//message de succés
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
Image success = new Image(getClass().getResourceAsStream("/Public/icon/successfully.png"));
|
||||
ImageView iv1 = new ImageView();
|
||||
iv1.setImage(success);
|
||||
|
||||
Text text= new Text();
|
||||
text.setText("La modification a été effectuée avec succès");
|
||||
text.setFont(Font.loadFont(getClass().getResourceAsStream("/Public/Fonts/Raleway-SemiBold.ttf"), 20));
|
||||
|
||||
Button buttonOk = new Button("OK");
|
||||
buttonOk.getStyleClass().add("btn-primary");
|
||||
buttonOk.setPrefSize(100, 30);
|
||||
|
||||
final StackPane stackpane = new StackPane();
|
||||
stackpane.setLayoutX(140);
|
||||
stackpane.setLayoutY(100);
|
||||
stackpane.setPrefHeight(200);
|
||||
stackpane.setPrefWidth(200);
|
||||
stackpane.getChildren().add(iv1);
|
||||
stackpane.getChildren().add(text);
|
||||
stackpane.getChildren().add(buttonOk);
|
||||
StackPane.setAlignment(iv1, Pos.BASELINE_CENTER);
|
||||
StackPane.setAlignment(text, Pos.TOP_CENTER);
|
||||
StackPane.setAlignment(buttonOk, Pos.CENTER);
|
||||
|
||||
AnchorPaneModifierprod.setLeftAnchor(stackpane, 83.0);
|
||||
AnchorPaneModifierprod.setRightAnchor(stackpane, 83.0);
|
||||
AnchorPaneModifierprod.setTopAnchor(stackpane,220.0);
|
||||
AnchorPaneModifierprod.setBottomAnchor(stackpane,220.0);
|
||||
AnchorPaneModifierprod.getChildren().add(stackpane);
|
||||
|
||||
buttonOk.setOnAction(new EventHandler<ActionEvent>() { //supprimer le message du suucés et reaficher les formulaires
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
stackpane.setVisible(false);
|
||||
try {
|
||||
AnchorPaneModifierprod.getChildren().clear();
|
||||
AnchorPaneModifierprod.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Produit/GestionProduit.fxml")));
|
||||
} catch (IOException ex) {
|
||||
logger.error("ModifierProduitController : ModifierProduitButtonAction :" + ex.getMessage());
|
||||
}
|
||||
FadeTransition ft = new FadeTransition(Duration.millis(400), AnchorPaneModifierprod);
|
||||
ft.setFromValue(0.0);
|
||||
ft.setToValue(1.0);
|
||||
ft.play();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
private Produit getProduit()
|
||||
{
|
||||
Produit prodUpdate = new Produit();
|
||||
|
||||
prodUpdate.setReference(ModifierProduitReference.getText());
|
||||
prodUpdate.setDesignation(ModifierProduitdesignation.getText());
|
||||
prodUpdate.setCategorie(ModifierProduitcategorie.getValue().toString());
|
||||
prodUpdate.setGarantieString(ModifierProduitGarantie.getText());
|
||||
prodUpdate.setMarque(ModifierProduitMarque.getText());
|
||||
|
||||
prodUpdate.setPrixachatttc(ModifierProduitPrixAchatTTC.getText().replace(',','.'));
|
||||
prodUpdate.setPrixachatht(ModifierProduitPrixAchatHT.getText().replace(',','.'));
|
||||
prodUpdate.setTvaachat(ModifierProduittvaAchat.getText().replace(',','.'));
|
||||
|
||||
prodUpdate.setMarge(ModifierProduitMarge.getText().replace(',','.'));
|
||||
|
||||
prodUpdate.setPrixventettc(ModifierProduitPrixVenteTTC.getText().replace(',','.'));
|
||||
prodUpdate.setPrixventeht(ModifierProduitPrixVenteHT.getText().replace(',','.'));
|
||||
prodUpdate.setTvavente(ModifierProduittvaVente.getText().replace(',','.'));
|
||||
|
||||
prodUpdate.setQualiteString(ModifierProduitQualite.getText());
|
||||
|
||||
prodUpdate.setPoids(ModifierProduitPoids.getText());
|
||||
prodUpdate.setCapacite(ModifierProduitCapacite.getText());
|
||||
prodUpdate.setDimensions(ModifierProduitDimensions.getText());
|
||||
prodUpdate.setVitesse(ModifierProduitVitesse.getText());
|
||||
prodUpdate.setPuissance(ModifierProduitPuissance.getText());
|
||||
prodUpdate.setCouleur(ModifierProduitCouleur.getValue().toString());
|
||||
prodUpdate.setDescription(ModifierProduitDescription.getText());
|
||||
|
||||
return prodUpdate ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,469 @@
|
||||
package Controllers.Produit;
|
||||
|
||||
import Models.Produit.Produit;
|
||||
import Controllers.DevisClt.DevisAjouterController;
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Models.Categorie.CategorieDB;
|
||||
import Models.Produit.ProduitDB;
|
||||
import Models.User.User;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
import org.controlsfx.control.textfield.TextFields;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class RechercherProduitController {
|
||||
|
||||
Logger logger = Logger.getLogger(RechercherProduitController.class.getName());
|
||||
|
||||
@FXML public AnchorPane anchorpane ;
|
||||
|
||||
@FXML private ProgressBar ProgressBarProduit;
|
||||
|
||||
@FXML private Button ButtonSearchProduit;
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount ;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
@FXML private TextField GestionProduitReference ;
|
||||
@FXML private TextField GestionProduitDesignation;
|
||||
@FXML private TextField GestionProduitMarque;
|
||||
@FXML private TextField GestionProduitCategorie;
|
||||
|
||||
@FXML private TableView<Produit> TableViewListeGestionProduit ;
|
||||
|
||||
@FXML private TableColumn<Produit ,String> TabColReference;
|
||||
@FXML private TableColumn<Produit ,String> TabColDesignaton;
|
||||
@FXML private TableColumn<Produit ,String> TabColMarque ;
|
||||
@FXML private TableColumn<Produit ,String> TabColCategorie;
|
||||
@FXML private TableColumn<Produit ,String> TabColPrixAchatTTC;
|
||||
@FXML private TableColumn<Produit ,String> TabColPrixVenteTTC;
|
||||
@FXML private TableColumn<Produit ,String> TabColQuantite;
|
||||
@FXML public TableColumn<Produit ,String> TabColAction ;
|
||||
|
||||
@FXML private AnchorPane PaneStockNegaNon;
|
||||
@FXML private Text TextEnStock;
|
||||
@FXML private RadioButton StockNegaOui;
|
||||
@FXML private RadioButton StockNegaNon;
|
||||
|
||||
public Node nodeFxml ;
|
||||
|
||||
private Boolean StockNegatif = false;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
public static String refprod ;
|
||||
|
||||
public Object[] ArrayObjectDataSave = new Object[10];
|
||||
|
||||
private Service<Void> ThreadSearchRerchecheProduit;
|
||||
|
||||
|
||||
public RechercherProduitController(Boolean TypePrixTTC) { //TypePrixTTC true Vente | false Achat
|
||||
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Produit/RechercherProduit.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
nodeFxml = (Node) fxmlLoader.load();
|
||||
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
|
||||
TextFields.bindAutoCompletion(GestionProduitCategorie, new CategorieDB().getListCategorie());
|
||||
|
||||
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<Produit, String>("reference"));
|
||||
TabColDesignaton.setCellValueFactory(new PropertyValueFactory<Produit, String>("designation"));
|
||||
TabColMarque.setCellValueFactory(new PropertyValueFactory<Produit, String>("marque"));
|
||||
TabColCategorie.setCellValueFactory(new PropertyValueFactory<Produit, String>("categorie"));
|
||||
|
||||
TabColPrixAchatTTC.setCellValueFactory(new PropertyValueFactory<Produit, String>("prixachatttc"));
|
||||
TabColPrixAchatTTC.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixAchatTTC.getStyleClass().add("Center");
|
||||
|
||||
TabColPrixVenteTTC.setCellValueFactory(new PropertyValueFactory<Produit, String>("prixventettc"));
|
||||
TabColPrixVenteTTC.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColPrixVenteTTC.getStyleClass().add("Center");
|
||||
|
||||
if(TypePrixTTC){
|
||||
TabColPrixVenteTTC.setVisible(true);
|
||||
TabColPrixAchatTTC.setVisible(false);
|
||||
}else{
|
||||
TabColPrixAchatTTC.setVisible(true);
|
||||
TabColPrixVenteTTC.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<Produit, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
|
||||
TabColAction.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColAction.getStyleClass().add("Center");
|
||||
|
||||
if(TypePrixTTC){//Vente Stock peux être négatif table produit
|
||||
if(User.SotckNegatif){ //L'utilisateur à le droit de vente en négative
|
||||
PaneStockNegaNon.setVisible(true);
|
||||
TextEnStock.setVisible(true);
|
||||
}
|
||||
}else{ //Achat table produit
|
||||
PaneStockNegaNon.setVisible(true);
|
||||
TextEnStock.setVisible(true);
|
||||
}
|
||||
|
||||
//table stock
|
||||
StockNegaOui.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
StockNegatif = false;
|
||||
SearchProduit();
|
||||
}
|
||||
});
|
||||
|
||||
//table produit
|
||||
StockNegaNon.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
StockNegatif = true;
|
||||
SearchProduit();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
ButtonSearchProduit.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchProduit();
|
||||
}
|
||||
});
|
||||
|
||||
anchorpane.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchProduit();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
GestionSearchProduit();
|
||||
|
||||
} catch (IOException ex) {
|
||||
logger.error("RechercherProduitController : RechercherProduit.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Show()
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(nodeFxml);
|
||||
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
//Define the button cell
|
||||
private class ButtonCell extends TableCell<Produit, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
|
||||
ButtonCell(){
|
||||
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconaffecter.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
//Action when the button is pressed
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
try {
|
||||
// get Selected ItemButtonCell
|
||||
Produit currentPerson = (Produit) ButtonCell.this.getTableView().getItems().get(ButtonCell.this.getIndex());
|
||||
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Devis/DevisAjouter.fxml"));
|
||||
Parent devis = (Parent) fxmlLoader.load();
|
||||
|
||||
DevisAjouterController devisajouter = fxmlLoader.getController();
|
||||
devisajouter.SetProduit(currentPerson.getReference());
|
||||
|
||||
MyWindow mywindows = new MyWindow();
|
||||
mywindows.Refresh(devis, 3);
|
||||
} catch (IOException ex) {
|
||||
logger.error("RechercherProduitController : ButtonCell :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void QuiterButtonAction(ActionEvent event) throws IOException {
|
||||
anchorpane.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchProduit()
|
||||
{
|
||||
ProgressBarProduit.setVisible(true);
|
||||
|
||||
ButtonSearchProduit.setDisable(true);
|
||||
|
||||
ThreadSearchRerchecheProduit = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
ObservableList<Produit> ListeCltPersonne = new ProduitDB().SearchProduit(
|
||||
position,
|
||||
nbrligne,
|
||||
StockNegatif,
|
||||
GestionProduitReference.getText(),
|
||||
GestionProduitCategorie.getText(),
|
||||
GestionProduitMarque.getText(),
|
||||
GestionProduitDesignation.getText());
|
||||
|
||||
TableViewListeGestionProduit.setItems(null);
|
||||
TableViewListeGestionProduit.refresh();
|
||||
TableViewListeGestionProduit.setItems(ListeCltPersonne);
|
||||
|
||||
totalcount = new ProduitDB().nbrSearchProduit(StockNegatif, GestionProduitReference.getText(), GestionProduitCategorie.getText(), GestionProduitMarque.getText(), GestionProduitDesignation.getText());
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchRerchecheProduit.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarProduit.setVisible(false);
|
||||
ButtonSearchProduit.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchRerchecheProduit.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void NextLastSearchProduit(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarProduit.setVisible(true);
|
||||
|
||||
ButtonSearchProduit.setDisable(true);
|
||||
|
||||
ThreadSearchRerchecheProduit = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
ObservableList<Produit> ListeCltPersonne = new ProduitDB().SearchProduit(
|
||||
ParmPosition,
|
||||
ParamNbrligne,
|
||||
StockNegatif,
|
||||
GestionProduitReference.getText(),
|
||||
GestionProduitCategorie.getText(),
|
||||
GestionProduitMarque.getText(),
|
||||
GestionProduitDesignation.getText());
|
||||
|
||||
TableViewListeGestionProduit.setItems(ListeCltPersonne);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchRerchecheProduit.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarProduit.setVisible(false);
|
||||
ButtonSearchProduit.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchRerchecheProduit.start();
|
||||
}
|
||||
|
||||
private void GestionSearchProduit()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchProduit(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchProduit(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchProduit(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchProduit(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchProduit(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,561 @@
|
||||
package Controllers.Reglement;
|
||||
|
||||
import Models.Fournisseur.FournisseurDB;
|
||||
import Models.Reglement.Reglement;
|
||||
import Models.Reglement.ReglementDB;
|
||||
import javafx.scene.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import org.controlsfx.control.textfield.TextFields;
|
||||
import java.net.URL;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.RadioButton;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.input.MouseEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class GestionReglementController implements Initializable {
|
||||
|
||||
@FXML private ProgressBar ProgressBarGestionReglement;
|
||||
|
||||
@FXML private Button ButtonSearchGestionReglement;
|
||||
|
||||
@FXML private AnchorPane AnchorPaneGestionReglement;
|
||||
|
||||
@FXML private TextField TextFieldFournisseur ;
|
||||
@FXML public TextField TextFieldNumero ;
|
||||
@FXML public TextField TextFieldMontant ;
|
||||
|
||||
@FXML private ComboBox ComboBoxModePaiement;
|
||||
@FXML private DatePicker DatePickerDatePayer;
|
||||
@FXML private RadioButton RadioComptant;
|
||||
@FXML private RadioButton RadioFacilite;
|
||||
|
||||
@FXML public TableView<Reglement> TableViewReglementFrs;
|
||||
@FXML public TableColumn<Reglement ,String> TabColNumero;
|
||||
@FXML public TableColumn<Reglement ,String> TabColMontant;
|
||||
@FXML public TableColumn<Reglement ,String> TabColModePaiement;
|
||||
@FXML public TableColumn<Reglement ,String> TabColFournisseur;
|
||||
@FXML public TableColumn<Reglement ,String> TabColTypePaiement;
|
||||
@FXML public TableColumn<Reglement ,String> TabColDatePayement;
|
||||
@FXML public TableColumn<Reglement ,Boolean> TabColDetail;
|
||||
|
||||
|
||||
@FXML private Text ActuellePage ;
|
||||
@FXML private Text NbrPage ;
|
||||
@FXML private Group nextgroupe ;
|
||||
@FXML private Group avancergroupe ;
|
||||
@FXML private Group lastgroupe ;
|
||||
@FXML private Group retourgroupe ;
|
||||
@FXML private Label LabelCount;
|
||||
@FXML private ChoiceBox NbrLigne ;
|
||||
|
||||
private Service<Void> ThreadSearchGestionReglement;
|
||||
|
||||
ObservableList cursors = FXCollections.observableArrayList("10","15","20");
|
||||
private Integer nbrligne = 10 ;
|
||||
private Integer totalcount = 0;
|
||||
private Integer nbrpage = 0;
|
||||
private Integer actuellepage = 1;
|
||||
Integer position = 0;
|
||||
|
||||
public ArrayList<String> ListFournisseur = new ArrayList<>();
|
||||
|
||||
ReglementDB reglementDB= new ReglementDB();
|
||||
|
||||
DecimalFormat Formatter = new DecimalFormat("##,###.## ");
|
||||
|
||||
ObservableList ListPaiement = FXCollections.observableArrayList("Espace", "Chèque", "Carte bancaire", "Traite");
|
||||
|
||||
String IdFournisseur = "";
|
||||
String Paiement = "";
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
setFournisseurFormData();
|
||||
|
||||
ComboBoxModePaiement.setItems(ListPaiement);
|
||||
|
||||
NbrLigne.setItems(cursors);
|
||||
NbrLigne.getSelectionModel().selectFirst();
|
||||
|
||||
TabColNumero.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNumero.getStyleClass().add("Center");
|
||||
TabColNumero.setCellValueFactory(new PropertyValueFactory<Reglement, String>("Numero"));
|
||||
|
||||
TabColFournisseur.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColFournisseur.getStyleClass().add("Center");
|
||||
TabColFournisseur.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<Reglement,String>, ObservableValue<String>>() {
|
||||
@Override
|
||||
public ObservableValue<String> call(TableColumn.CellDataFeatures<Reglement, String> data) {
|
||||
return new SimpleStringProperty(data.getValue().getFournisseur().getNom());
|
||||
}
|
||||
});
|
||||
|
||||
TabColModePaiement.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColModePaiement.getStyleClass().add("Center");
|
||||
TabColModePaiement.setCellValueFactory(new PropertyValueFactory<Reglement, String>("ModePaiement"));
|
||||
TabColModePaiement.setCellFactory(new Callback<TableColumn<Reglement,String>,TableCell<Reglement,String>>(){
|
||||
@Override
|
||||
public TableCell<Reglement, String> call(TableColumn<Reglement, String> param) {
|
||||
TableCell<Reglement, String> cell = new TableCell<Reglement, String>(){
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
//0 :espace | 1:Chèque | 2 :carte bancaire | 3: Traite
|
||||
if(item!= null && item.equals("0")){
|
||||
Text text = new Text("Espace");
|
||||
text.setFont(Font.font("Arial", FontWeight.NORMAL, 14));
|
||||
setGraphic(text);
|
||||
}else if(item!= null && item.equals("1")){
|
||||
Text text = new Text("Chèque");
|
||||
text.setFont(Font.font("Arial", FontWeight.NORMAL, 14));
|
||||
setGraphic(text);
|
||||
}else if(item!= null && item.equals("2")){
|
||||
Text text = new Text("Carte Bancaire");
|
||||
text.setFont(Font.font("Arial", FontWeight.NORMAL, 14));
|
||||
setGraphic(text);
|
||||
}else if(item!= null && item.equals("3")){
|
||||
Text text = new Text("Traite");
|
||||
text.setFont(Font.font("Arial", FontWeight.NORMAL, 14));
|
||||
setGraphic(text);
|
||||
}else{
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
TabColMontant.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColMontant.getStyleClass().add("Center");
|
||||
TabColMontant.setCellValueFactory(new PropertyValueFactory<Reglement, String>("Montant"));
|
||||
TabColMontant.setCellFactory(new Callback<TableColumn<Reglement,String>,TableCell<Reglement,String>>(){
|
||||
@Override
|
||||
public TableCell<Reglement, String> call(TableColumn<Reglement, String> param) {
|
||||
TableCell<Reglement, String> cell = new TableCell<Reglement, String>(){
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
if(item!= null){
|
||||
Text text = new Text(Formatter.format(Float.parseFloat(item)));
|
||||
setGraphic(text);
|
||||
}else{
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
TabColTypePaiement.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTypePaiement.getStyleClass().add("Center");
|
||||
TabColTypePaiement.setCellValueFactory(new PropertyValueFactory<Reglement, String>("TypePaiement"));
|
||||
TabColTypePaiement.setCellFactory(new Callback<TableColumn<Reglement,String>,TableCell<Reglement,String>>(){
|
||||
@Override
|
||||
public TableCell<Reglement, String> call(TableColumn<Reglement, String> param) {
|
||||
TableCell<Reglement, String> cell = new TableCell<Reglement, String>(){
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
if(item!= null && item.equals("0")){
|
||||
Text text = new Text("Comptant");
|
||||
text.setFill(Color.web("#428BCA"));
|
||||
text.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||
setGraphic(text);
|
||||
}else if(item!= null && item.equals("1")){
|
||||
Text text = new Text("Facilité");
|
||||
text.setFill(Color.web("#000000"));
|
||||
text.setFont(Font.font("Arial", FontWeight.BOLD, 14));
|
||||
setGraphic(text);
|
||||
}else{
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
TabColDatePayement.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDatePayement.getStyleClass().add("Center");
|
||||
TabColDatePayement.setCellValueFactory(new PropertyValueFactory<Reglement, String>("DateTimeCreation"));
|
||||
|
||||
|
||||
|
||||
TabColDetail.setStyle( "-fx-alignment: CENTER;");TabColDetail.getStyleClass().add("Center");
|
||||
TabColDetail.setCellFactory(new Callback<TableColumn<Reglement, Boolean>, TableCell<Reglement, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<Reglement, Boolean> call(TableColumn<Reglement, Boolean> personBooleanTableColumn) {
|
||||
return new ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
TextFieldFournisseur.textProperty().addListener(new ChangeListener<String>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
||||
if(newValue.contains(" - ")){
|
||||
String[] array = newValue.split(" - ", -1);
|
||||
IdFournisseur = array[0];
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
ComboBoxModePaiement.valueProperty().addListener(new ChangeListener<String>() {
|
||||
@Override
|
||||
public void changed(ObservableValue ov, String t, String ValLocal) {
|
||||
//0 :espace | 1:Chèque | 2 :carte bancaire | 3: Traite
|
||||
if(ValLocal.equals("Espace")){
|
||||
Paiement = "0";
|
||||
}else if(ValLocal.equals("Chèque")){
|
||||
Paiement = "1";
|
||||
}else if(ValLocal.equals("Carte bancaire")){
|
||||
Paiement = "2";
|
||||
}else if(ValLocal.equals("Traite")){
|
||||
Paiement = "3";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
ButtonSearchGestionReglement.setOnMouseClicked(new EventHandler<MouseEvent>() {
|
||||
public void handle(MouseEvent me) {
|
||||
SearchGestionReglement();
|
||||
}
|
||||
});
|
||||
|
||||
AnchorPaneGestionReglement.setOnKeyPressed(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
if (ke.getCode().equals(KeyCode.ENTER)) {
|
||||
SearchGestionReglement();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
GestionSearchGestionReglement();
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
private void ReglementAjouterButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPaneGestionReglement.getChildren().clear();
|
||||
AnchorPaneGestionReglement.getChildren().add((Node) FXMLLoader.load(getClass().getResource("/Views/Reglement/ReglementAjouter1.fxml")));
|
||||
}
|
||||
|
||||
|
||||
private class ButtonCell extends TableCell<Reglement, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/detailbutton.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){ //Action when the button is pressed
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
Reglement reglement = ((Reglement)getTableRow().getItem());
|
||||
ReglementDialogDetailController ReglementDialogDetail = new ReglementDialogDetailController();
|
||||
ReglementDialogDetail.Show();
|
||||
ReglementDialogDetail.LanchShowReglement(reglement.getNumero());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void setFournisseurFormData()
|
||||
{
|
||||
ProgressBarGestionReglement.setVisible(true);
|
||||
|
||||
ThreadSearchGestionReglement = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
ListFournisseur = new FournisseurDB().getIdNomFournisseur();
|
||||
TextFields.bindAutoCompletion(TextFieldFournisseur, ListFournisseur);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadSearchGestionReglement.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarGestionReglement.setVisible(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchGestionReglement.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/****************************************************************************** *
|
||||
* *
|
||||
* Methode last Next TableView *
|
||||
* * *
|
||||
******************************************************************************/
|
||||
|
||||
private void SearchGestionReglement()
|
||||
{
|
||||
ProgressBarGestionReglement.setVisible(true);
|
||||
|
||||
ButtonSearchGestionReglement.setDisable(true);
|
||||
|
||||
ThreadSearchGestionReglement = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
position = 0;
|
||||
|
||||
actuellepage = 1;
|
||||
|
||||
String DatePayer = "";
|
||||
if(DatePickerDatePayer.getValue() != null){
|
||||
DatePayer = DatePickerDatePayer.getValue().toString();
|
||||
}
|
||||
|
||||
// 0comptant 1facilité
|
||||
String TypeRegement = "";
|
||||
if(RadioComptant.isSelected()){
|
||||
TypeRegement = "0";
|
||||
}else if(RadioFacilite.isSelected()){
|
||||
TypeRegement = "1";
|
||||
}
|
||||
|
||||
ObservableList<Reglement> ListGestionReglements = new ReglementDB().SearchGestionReglementGestion(
|
||||
position,
|
||||
nbrligne,
|
||||
TextFieldNumero.getText(),
|
||||
IdFournisseur,
|
||||
TextFieldMontant.getText(),
|
||||
DatePayer,
|
||||
TypeRegement,
|
||||
Paiement);
|
||||
|
||||
TableViewReglementFrs.setItems(ListGestionReglements);
|
||||
|
||||
totalcount = new ReglementDB().nbrGestionReglementGestion(TextFieldNumero.getText(), IdFournisseur, TextFieldMontant.getText(), DatePayer, TypeRegement, Paiement);
|
||||
|
||||
if(totalcount > 0){
|
||||
ActuellePage.setText("1");
|
||||
}else{
|
||||
ActuellePage.setText("0");
|
||||
}
|
||||
|
||||
if(totalcount % nbrligne==0){
|
||||
nbrpage = totalcount / nbrligne ;
|
||||
}
|
||||
else{
|
||||
nbrpage = (totalcount / nbrligne) + 1 ;
|
||||
}
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchGestionReglement.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarGestionReglement.setVisible(false);
|
||||
ButtonSearchGestionReglement.setDisable(false);
|
||||
LabelCount.setText(totalcount.toString());
|
||||
|
||||
}
|
||||
});
|
||||
ThreadSearchGestionReglement.start();
|
||||
}
|
||||
|
||||
|
||||
private void NextLastSearchGestionReglement(Integer ParmPosition, Integer ParamNbrligne)
|
||||
{
|
||||
ProgressBarGestionReglement.setVisible(true);
|
||||
|
||||
ButtonSearchGestionReglement.setDisable(true);
|
||||
|
||||
ThreadSearchGestionReglement = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
|
||||
String DatePayer = "";
|
||||
if(DatePickerDatePayer.getValue() != null){
|
||||
DatePayer = DatePickerDatePayer.getValue().toString();
|
||||
}
|
||||
|
||||
|
||||
// 0comptant 1facilité
|
||||
String TypeRegement = "";
|
||||
if(RadioComptant.isSelected()){
|
||||
TypeRegement = "0";
|
||||
}else if(RadioFacilite.isSelected()){
|
||||
TypeRegement = "1";
|
||||
}
|
||||
|
||||
ObservableList<Reglement> ListGestionReglement = new ReglementDB().SearchGestionReglementGestion(ParmPosition, ParamNbrligne, TextFieldNumero.getText(), IdFournisseur, TextFieldMontant.getText(), DatePayer, TypeRegement, Paiement);
|
||||
|
||||
TableViewReglementFrs.setItems(ListGestionReglement);
|
||||
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
ThreadSearchGestionReglement.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressBarGestionReglement.setVisible(false);
|
||||
ButtonSearchGestionReglement.setDisable(false);
|
||||
}
|
||||
});
|
||||
ThreadSearchGestionReglement.start();
|
||||
}
|
||||
|
||||
private void GestionSearchGestionReglement()
|
||||
{
|
||||
NbrLigne.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
|
||||
|
||||
public void changed(ObservableValue ov, Number value, Number new_value) {
|
||||
nbrligne= Integer.parseInt((String) cursors.get(new_value.intValue()));
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
position=0;
|
||||
ActuellePage.setText("1");
|
||||
actuellepage=1;
|
||||
NextLastSearchGestionReglement(position, nbrligne);
|
||||
}
|
||||
});
|
||||
|
||||
if(totalcount % nbrligne==0){ nbrpage = totalcount / nbrligne ;}
|
||||
else{ nbrpage = (totalcount / nbrligne) + 1 ; }
|
||||
NbrPage.setText(Integer.toString(nbrpage));
|
||||
|
||||
|
||||
//next page
|
||||
nextgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage<nbrpage)
|
||||
{
|
||||
position=position+nbrligne;
|
||||
NextLastSearchGestionReglement(position, nbrligne);
|
||||
actuellepage=actuellepage+1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page
|
||||
lastgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage>1)
|
||||
{
|
||||
position=position-nbrligne;
|
||||
NextLastSearchGestionReglement(position, nbrligne);
|
||||
actuellepage=actuellepage-1 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//next page avec pas de 5
|
||||
avancergroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage+3<nbrpage)
|
||||
{
|
||||
position=(position+4)+nbrligne;
|
||||
NextLastSearchGestionReglement(position, nbrligne);
|
||||
actuellepage=actuellepage+3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//last page avec un pas de -5
|
||||
retourgroupe.setOnMousePressed(new EventHandler<MouseEvent>(){
|
||||
@Override
|
||||
public void handle(MouseEvent event) {
|
||||
if(actuellepage-3>1){
|
||||
position=(position-4)-nbrligne;
|
||||
NextLastSearchGestionReglement(position, nbrligne);
|
||||
actuellepage=actuellepage-3 ;
|
||||
ActuellePage.setText(Integer.toString(actuellepage));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,423 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.Reglement;
|
||||
|
||||
import Controllers.Dialog.MessageControle;
|
||||
import Models.FactureFrs.FactureFrs;
|
||||
import Models.FactureFrs.FactureFrsDB;
|
||||
import Models.Fournisseur.FournisseurDB;
|
||||
import Models.Stock.StockDB;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.ProgressIndicator;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.input.KeyEvent;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.FontWeight;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
import org.controlsfx.control.textfield.TextFields;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
*
|
||||
* @author Maher
|
||||
*/
|
||||
public class ReglementAjouter1Controller implements Initializable {
|
||||
|
||||
@FXML private AnchorPane AnchorPaneReglementAjouter1;
|
||||
|
||||
@FXML private ProgressIndicator ProgressFactureFrs;
|
||||
|
||||
@FXML public TableView<FactureFrs> TableViewFactureFrs;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColNumero;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColFrs;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColDate;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColLocalReception;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColNetPayer;
|
||||
@FXML public TableColumn<FactureFrs ,Boolean>TabColDetail ;
|
||||
|
||||
@FXML public TableView<FactureFrs> TableViewSeleFactureFrs;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColSeleNumero;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColSeleFrs;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColSeleDate;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColSeleHeur;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColSeleLocalReception;
|
||||
@FXML public TableColumn<FactureFrs ,String> TabColSeleNetPayer;
|
||||
@FXML public TableColumn<FactureFrs ,Boolean>TabColSeleSupprimer ;
|
||||
|
||||
@FXML public TextField TextFieldNumero ;
|
||||
@FXML private TextField TextFieldFournisseu ;
|
||||
@FXML public TextField TextFieldNetAPayer ;
|
||||
@FXML public DatePicker DatePickerDateReception;
|
||||
|
||||
@FXML public ChoiceBox ChoiceBoxLocalReception ;
|
||||
|
||||
public ArrayList<String> ListFournisseur = new ArrayList<>();
|
||||
public ArrayList<String> ListLocale = new ArrayList<>();
|
||||
|
||||
ObservableList<FactureFrs> DataSelectFacture = FXCollections.observableArrayList();
|
||||
|
||||
public FactureFrsDB FactureDB = new FactureFrsDB();
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
|
||||
StockDB Stock = new StockDB();
|
||||
ListLocale = Stock.getAllListLocal();
|
||||
ChoiceBoxLocalReception.getItems().addAll(ListLocale);
|
||||
|
||||
FournisseurDB FrsDB = new FournisseurDB();
|
||||
ListFournisseur = FrsDB.getIdNomFournisseur();
|
||||
TextFields.bindAutoCompletion(TextFieldFournisseu, ListFournisseur);
|
||||
|
||||
TabColNumero.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("Numero"));
|
||||
|
||||
TabColFrs.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColFrs.getStyleClass().add("Center");
|
||||
TabColFrs.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<FactureFrs,String>, ObservableValue<String>>() {
|
||||
@Override
|
||||
public ObservableValue<String> call(TableColumn.CellDataFeatures<FactureFrs, String> data) {
|
||||
return new SimpleStringProperty(data.getValue().getFournisseur().getNom());
|
||||
}
|
||||
});
|
||||
|
||||
TabColDate.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("DateCreation"));
|
||||
TabColDate.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDate.getStyleClass().add("Center");
|
||||
|
||||
|
||||
TabColLocalReception.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("Local"));
|
||||
TabColLocalReception.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColLocalReception.getStyleClass().add("Center");
|
||||
|
||||
TabColNetPayer.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("NetAPayer"));
|
||||
TabColNetPayer.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNetPayer.getStyleClass().add("Center");
|
||||
|
||||
TabColDetail.setStyle( "-fx-alignment: CENTER;");TabColDetail.getStyleClass().add("Center");
|
||||
TabColDetail.setCellFactory(new Callback<TableColumn<FactureFrs, Boolean>, TableCell<FactureFrs, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<FactureFrs, Boolean> call(TableColumn<FactureFrs, Boolean> personBooleanTableColumn) {
|
||||
return new ReglementAjouter1Controller.ButtonCell();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
TabColSeleNumero.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("Numero"));
|
||||
|
||||
TabColSeleFrs.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColSeleFrs.getStyleClass().add("Center");
|
||||
TabColSeleFrs.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<FactureFrs,String>, ObservableValue<String>>() {
|
||||
@Override
|
||||
public ObservableValue<String> call(TableColumn.CellDataFeatures<FactureFrs, String> data) {
|
||||
return new SimpleStringProperty(data.getValue().getFournisseur().getNom());
|
||||
}
|
||||
});
|
||||
|
||||
TabColSeleDate.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("DateCreation"));
|
||||
TabColSeleDate.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColSeleDate.getStyleClass().add("Center");
|
||||
|
||||
TabColSeleHeur.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("HeurCreation"));
|
||||
TabColSeleHeur.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColSeleHeur.getStyleClass().add("Center");
|
||||
|
||||
TabColSeleLocalReception.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("Local"));
|
||||
TabColSeleLocalReception.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColSeleLocalReception.getStyleClass().add("Center");
|
||||
|
||||
TabColSeleNetPayer.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("NetAPayer"));
|
||||
TabColSeleNetPayer.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColSeleNetPayer.getStyleClass().add("Center");
|
||||
|
||||
TabColSeleSupprimer.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColSeleSupprimer.getStyleClass().add("Center");
|
||||
TabColSeleSupprimer.setSortable(true);
|
||||
|
||||
TabColSeleSupprimer.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<FactureFrs, Boolean>,
|
||||
ObservableValue<Boolean>>() {
|
||||
@Override
|
||||
public ObservableValue<Boolean> call(TableColumn.CellDataFeatures<FactureFrs, Boolean> p) {
|
||||
return new SimpleBooleanProperty(p.getValue() != null);
|
||||
}
|
||||
});
|
||||
|
||||
// create a cell value factory with an add button for each row in the table.
|
||||
TabColSeleSupprimer.setCellFactory(new Callback<TableColumn<FactureFrs, Boolean>, TableCell<FactureFrs, Boolean>>() {
|
||||
@Override
|
||||
public TableCell<FactureFrs, Boolean> call(TableColumn<FactureFrs, Boolean> personBooleanTableColumn) {
|
||||
return new ReglementAjouter1Controller.ButtonCellRemove();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
getChercherFactureFrs();
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void DetailReglementButtonAction(ActionEvent event) throws IOException
|
||||
{
|
||||
if(DataSelectFacture.size()>0){
|
||||
if(ControleListFacture()){
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Reglement/ReglementAjouter2.fxml"));
|
||||
Parent NodeReglementAjouter2 = (Parent)fxmlLoader.load();
|
||||
|
||||
ReglementAjouter2Controller ReglementAjouter2 = fxmlLoader.getController();
|
||||
ReglementAjouter2.SetDataFactureFrs(DataSelectFacture);
|
||||
|
||||
AnchorPaneReglementAjouter1.getChildren().clear();
|
||||
AnchorPaneReglementAjouter1.getChildren().add(NodeReglementAjouter2);
|
||||
}else{
|
||||
final MessageControle messagecontrol = new MessageControle();
|
||||
Text text3 = new Text();
|
||||
text3.setText("Les fournisseurs sélectionnés sont différents");
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 13));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
messagecontrol.ShowNotification();
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
final MessageControle messagecontrol = new MessageControle();
|
||||
Text text3 = new Text();
|
||||
text3.setText("Vous devez ajouter au moin une facture à la liste des factures");
|
||||
text3.setFont(Font.font("Arial", FontWeight.BOLD, 13));
|
||||
text3.setFill(Color.web("#363a38"));
|
||||
messagecontrol.DetailMSG.getChildren().add(text3);
|
||||
messagecontrol.bouttonOK.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
messagecontrol.stackpane.setVisible(false);
|
||||
}
|
||||
});
|
||||
messagecontrol.ShowNotification();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void getChercherFactureFrs(){
|
||||
TextFieldNumero.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
getDataFactureFrs("numero", " LIKE '"+TextFieldNumero.getText()+"%'");
|
||||
}
|
||||
});
|
||||
DatePickerDateReception.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent actionEvent) {
|
||||
try{
|
||||
getDataFactureFrs("to_char(date_creation, 'yyyy-mm-dd')", " = '"+DatePickerDateReception.getValue().toString()+"'");
|
||||
}catch(Exception ex){}
|
||||
}
|
||||
});
|
||||
DatePickerDateReception.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
try{
|
||||
String DateReception = DatePickerDateReception.getConverter().fromString(DatePickerDateReception.getEditor().getText()).toString();
|
||||
getDataFactureFrs("to_char(date_creation, 'yyyy-mm-dd')", " = '"+DateReception+"'");
|
||||
}catch(Exception ex){}
|
||||
}
|
||||
});
|
||||
|
||||
ChoiceBoxLocalReception.valueProperty().addListener(new ChangeListener<String>() {
|
||||
@Override
|
||||
public void changed(ObservableValue ov, String t, String ValLocal) {
|
||||
getDataFactureFrs("local_reception", " LIKE '"+ValLocal+"%'");
|
||||
}
|
||||
});
|
||||
|
||||
TextFieldNetAPayer.setOnKeyReleased(new EventHandler<KeyEvent>() {
|
||||
@Override
|
||||
public void handle(KeyEvent ke) {
|
||||
getDataFactureFrs("net_a_payer", "LIKE '"+TextFieldNetAPayer.getText()+"%'");
|
||||
}
|
||||
});
|
||||
|
||||
TextFieldFournisseu.textProperty().addListener(new ChangeListener<String>() {
|
||||
@Override
|
||||
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
|
||||
if(newValue.contains(" - ")){
|
||||
String[] array = newValue.split(" - ", -1);
|
||||
getDataFactureFrs("id_fournisseur", " = "+array[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void setDataFactureFrs(ObservableList<FactureFrs> data_facture){
|
||||
DataSelectFacture = data_facture;
|
||||
TableViewSeleFactureFrs.setItems(data_facture);
|
||||
TableViewSeleFactureFrs.refresh();
|
||||
}
|
||||
|
||||
private void getDataFactureFrs(final String tab, final String mot){
|
||||
|
||||
ProgressFactureFrs.setVisible(true);
|
||||
TableViewFactureFrs.setItems(null);
|
||||
TableViewFactureFrs.setVisible(false);
|
||||
|
||||
// Create a Runnable
|
||||
Runnable task = new Runnable(){
|
||||
public void run(){
|
||||
Platform.runLater(new Runnable(){
|
||||
@Override
|
||||
public void run(){
|
||||
try {
|
||||
ObservableList<FactureFrs> ListFactureFrs = FactureDB.getDataFactureFrs(tab, mot, null, null);
|
||||
TableViewFactureFrs.setItems(ListFactureFrs);
|
||||
ProgressFactureFrs.setVisible(false);
|
||||
TableViewFactureFrs.setVisible(true);
|
||||
TableViewFactureFrs.refresh();
|
||||
} catch (Exception ex) {
|
||||
System.err.println("Erreur SQL ! \n"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
Thread backgroundThread = new Thread(task); // Run the task in a background thread
|
||||
backgroundThread.setDaemon(true); // Terminate the running thread if the application exits
|
||||
backgroundThread.start(); // Start the thread
|
||||
}
|
||||
|
||||
|
||||
private boolean ControleListFacture(){
|
||||
boolean result = true ;
|
||||
String CodeFirst = DataSelectFacture.get(0).getFournisseur().getCode();
|
||||
for( FactureFrs FactSele : DataSelectFacture ) {
|
||||
if(!FactSele.getFournisseur().getCode().equals(CodeFirst)){
|
||||
result = false ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private class ButtonCell extends TableCell<FactureFrs, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
ButtonCell(){
|
||||
cellButton.getStyleClass().add("btn-icon-primary");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconaffecter.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){ //Action when the button is pressed
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
try {
|
||||
FactureFrs ListFactureFrs = (FactureFrs) ButtonCell.this.getTableView().getItems().get(ButtonCell.this.getIndex());
|
||||
|
||||
//Verifier si la Facture existe déja
|
||||
boolean result = true ;
|
||||
for( FactureFrs FactSele : DataSelectFacture ) {
|
||||
if(FactSele.getNumero().equals(ListFactureFrs.getNumero())){
|
||||
result = false ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(result){
|
||||
DataSelectFacture.add(ListFactureFrs);
|
||||
TableViewSeleFactureFrs.setItems(DataSelectFacture);
|
||||
TableViewSeleFactureFrs.refresh();
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
System.err.println("ReglementAjouter1Controller ButtonCell ! \n"+ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Define the button cell
|
||||
private class ButtonCellRemove extends TableCell<FactureFrs, Boolean> {
|
||||
|
||||
final Button cellButton = new Button();
|
||||
|
||||
ButtonCellRemove(){
|
||||
cellButton.getStyleClass().add("btn-danger");
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/icondelete.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
cellButton.setGraphic(buttonGraphic);
|
||||
|
||||
//Action when the button is pressed
|
||||
cellButton.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
int selectdIndex = getTableRow().getIndex();
|
||||
DataSelectFacture.remove(selectdIndex);
|
||||
TableViewSeleFactureFrs.setItems(DataSelectFacture);
|
||||
TableViewSeleFactureFrs.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
//Display button if the row is not empty
|
||||
@Override
|
||||
protected void updateItem(Boolean t, boolean empty) {
|
||||
if(!empty){
|
||||
setGraphic(cellButton);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,494 @@
|
||||
|
||||
package Controllers.Reglement;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.contro;
|
||||
import Models.ChequeClt.ChequeList;
|
||||
import Models.TraiteClt.DatePickerCell;
|
||||
import Models.ChequeClt.DatePickerCellCheque;
|
||||
import Models.FactureFrs.FactureFrs;
|
||||
import Models.Reglement.CarteElectroniqueFrs;
|
||||
import Models.Reglement.ChequeFrs;
|
||||
import Models.Reglement.Reglement;
|
||||
import Models.Reglement.TraiteFrs;
|
||||
import Models.TraiteClt.TraiteList;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.control.cell.TextFieldTableCell;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher
|
||||
*/
|
||||
public class ReglementAjouter2Controller implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(ReglementAjouter2Controller.class.getName());
|
||||
|
||||
@FXML private AnchorPane AnchorPaneReglementAjouter2;
|
||||
@FXML private AnchorPane PaneComptant;
|
||||
@FXML private AnchorPane PaneFacilite;
|
||||
|
||||
@FXML private AnchorPane PaneFaciliteCheque;
|
||||
@FXML private AnchorPane PaneFaciliteTraite;
|
||||
|
||||
@FXML private Text TextNbrFacture;
|
||||
@FXML private Text TextTotalFacture;
|
||||
|
||||
@FXML private GridPane GridPaneCheque;
|
||||
@FXML private GridPane GridPaneCarte;
|
||||
|
||||
@FXML private TextField TextFieldNbrEcheance;
|
||||
@FXML private Text TextCtlNbrEcheance;
|
||||
@FXML private Text TotalEcheance;
|
||||
|
||||
@FXML private TextField TextFieldChequeNomBanque;
|
||||
@FXML private TextField TextFieldChequeNumero;
|
||||
@FXML private TextField TextFieldChequeNomComple;
|
||||
@FXML private DatePicker DatePickerChequeDate;
|
||||
@FXML private Text TextCtlChequeNomBanque;
|
||||
@FXML private Text TextCtlChequeNumero;
|
||||
@FXML private Text TextCtlChequeNomComple;
|
||||
@FXML private Text TextCtlChequeDate;
|
||||
|
||||
@FXML private TextField TextFieldCarteNomBanque;
|
||||
@FXML private TextField TextFieldCarteNumeroCart;
|
||||
@FXML private TextField TextFieldCarteNumeroTransaction;
|
||||
@FXML private TextField TextFieldCarteHeurTransaction;
|
||||
@FXML private DatePicker DatePickerCarteDate;
|
||||
@FXML private Text TextCtlCartNomBanque;
|
||||
@FXML private Text TextCtlCartNumeroCart;
|
||||
@FXML private Text TextCtlCartNumeroTransaction;
|
||||
@FXML private Text TextCtlCartDateHeurTransaction;
|
||||
|
||||
@FXML public TableView<TraiteList> TableViewListeTraite ;
|
||||
@FXML public TableColumn TabColDateTraite;
|
||||
@FXML public TableColumn<TraiteList ,String> TabColMontantTraite;
|
||||
|
||||
@FXML public TableView<ChequeList> TableViewListeCheque ;
|
||||
@FXML public TableColumn TabColDateCheque;
|
||||
@FXML public TableColumn<ChequeList ,String> TabColNumeroCheque;
|
||||
@FXML public TableColumn<ChequeList ,String> TabColBanqueCheque;
|
||||
@FXML public TableColumn<ChequeList ,String> TabColMontantCheque;
|
||||
|
||||
float TotalFact = 0;
|
||||
boolean clt_total_echeance = true;
|
||||
private int SelectComptantFacilite ; // 0 Comptant | 1 Facilité
|
||||
private int PayerEesCheqCar = 0; //Payer en: 0 espèce | 1 Chéque | 2 Carte électronique
|
||||
private int facilite_traite_cheque = 0; // 0 traite | 1 cheque
|
||||
|
||||
ObservableList<FactureFrs> DataFacture = FXCollections.observableArrayList();
|
||||
|
||||
public ObservableList<TraiteList> ListT = FXCollections.observableArrayList();
|
||||
public ObservableList<ChequeList> ListCheque = FXCollections.observableArrayList();
|
||||
|
||||
Reglement reglement = new Reglement();
|
||||
|
||||
contro clt = new contro();
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
TableViewListeTraite.setEditable(true);
|
||||
TabColMontantTraite.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColMontantTraite.getStyleClass().add("Center");
|
||||
TabColMontantTraite.setCellValueFactory(new PropertyValueFactory<TraiteList, String>("MontantTraite"));
|
||||
TabColMontantTraite.setCellFactory(TextFieldTableCell.<TraiteList>forTableColumn()); //Ajouter l'option textfield
|
||||
//Valier l'opertion
|
||||
TabColMontantTraite.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<TraiteList, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<TraiteList, String> t) {
|
||||
String NewMontant = t.getNewValue().replace('.',',');
|
||||
((TraiteList) t.getTableView().getItems().get(t.getTablePosition().getRow())).setMontantTraite(NewMontant);
|
||||
CalculeTotalTrait();
|
||||
}
|
||||
});
|
||||
|
||||
TabColDateTraite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDateTraite.getStyleClass().add("Center");
|
||||
TabColDateTraite.setCellValueFactory(new PropertyValueFactory<TraiteList, Date>("date"));
|
||||
TabColDateTraite.setCellFactory(new Callback<TableColumn, TableCell>() {
|
||||
@Override
|
||||
public TableCell call(TableColumn p) {
|
||||
DatePickerCell datePick = new DatePickerCell(ListT);
|
||||
return datePick;
|
||||
}
|
||||
});
|
||||
TableViewListeTraite.setItems(ListT);
|
||||
|
||||
|
||||
|
||||
//Cheque
|
||||
TabColNumeroCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColNumeroCheque.getStyleClass().add("Center");
|
||||
TabColNumeroCheque.setCellValueFactory(new PropertyValueFactory<ChequeList, String>("NumeroCheque"));
|
||||
TabColNumeroCheque.setCellFactory(TextFieldTableCell.<ChequeList>forTableColumn()); //Ajouter l'option textfield
|
||||
//Valier l'opertion
|
||||
TabColNumeroCheque.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ChequeList, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ChequeList, String> t) {
|
||||
String NewNumeroCheque = t.getNewValue();
|
||||
contro clt = new contro();
|
||||
if(!clt.isNumeric(NewNumeroCheque)){
|
||||
if(t.getTablePosition().getRow() == 0){
|
||||
Integer NumeroCheque = Integer.valueOf(NewNumeroCheque);
|
||||
int indise = 0;
|
||||
while(indise<ListCheque.size()){
|
||||
((ChequeList) t.getTableView().getItems().get(indise)).setNumeroCheque(NumeroCheque.toString());
|
||||
indise++;NumeroCheque++;
|
||||
}
|
||||
}else{
|
||||
((ChequeList) t.getTableView().getItems().get(t.getTablePosition().getRow())).setNumeroCheque(NewNumeroCheque);
|
||||
}
|
||||
}else{
|
||||
((ChequeList) t.getTableView().getItems().get(t.getTablePosition().getRow())).setNumeroCheque(null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
TabColBanqueCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColBanqueCheque.getStyleClass().add("Center");
|
||||
TabColBanqueCheque.setCellValueFactory(new PropertyValueFactory<ChequeList, String>("BanqueCheque"));
|
||||
TabColBanqueCheque.setCellFactory(TextFieldTableCell.<ChequeList>forTableColumn()); //Ajouter l'option textfield
|
||||
//Valier l'opertion
|
||||
TabColBanqueCheque.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ChequeList, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ChequeList, String> t) {
|
||||
String NewBanque = t.getNewValue();
|
||||
if(t.getTablePosition().getRow() == 0){
|
||||
int indise = 0;
|
||||
while(indise<ListCheque.size()){
|
||||
((ChequeList) t.getTableView().getItems().get(indise)).setBanqueCheque(NewBanque);
|
||||
indise++;
|
||||
}
|
||||
}else{
|
||||
((ChequeList) t.getTableView().getItems().get(t.getTablePosition().getRow())).setBanqueCheque(NewBanque);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
TabColMontantCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColMontantCheque.getStyleClass().add("Center");
|
||||
TabColMontantCheque.setCellValueFactory(new PropertyValueFactory<ChequeList, String>("MontantCheque"));
|
||||
TabColMontantCheque.setCellFactory(TextFieldTableCell.<ChequeList>forTableColumn()); //Ajouter l'option textfield
|
||||
//Valier l'opertion
|
||||
TabColMontantCheque.setOnEditCommit(new EventHandler<TableColumn.CellEditEvent<ChequeList, String>>() {
|
||||
@Override
|
||||
public void handle(TableColumn.CellEditEvent<ChequeList, String> t) {
|
||||
String NewQuantite = t.getNewValue();
|
||||
((ChequeList) t.getTableView().getItems().get(t.getTablePosition().getRow())).setMontantCheque(NewQuantite);
|
||||
CalculeTotalCheque();
|
||||
}
|
||||
});
|
||||
|
||||
TabColDateCheque.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDateCheque.getStyleClass().add("Center");
|
||||
TabColDateCheque.setCellValueFactory(new PropertyValueFactory<ChequeList, Date>("date"));
|
||||
TabColDateCheque.setEditable(true);
|
||||
TabColDateCheque.setCellFactory(new Callback<TableColumn, TableCell>() {
|
||||
@Override
|
||||
public TableCell call(TableColumn p) {
|
||||
DatePickerCellCheque datePick = new DatePickerCellCheque(ListCheque);
|
||||
return datePick;
|
||||
}
|
||||
});
|
||||
|
||||
TableViewListeCheque.setItems(ListCheque);
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void DetailRelementSuitButtonAction(ActionEvent event) throws IOException {
|
||||
final Reglement reglement = new Reglement();
|
||||
boolean clt_reglement = true;
|
||||
|
||||
if(SelectComptantFacilite == 0){
|
||||
reglement.setTypePaiement("0");
|
||||
|
||||
//0 espèce | 1 Chéque | 2 Carte électronique
|
||||
if(PayerEesCheqCar == 0){
|
||||
reglement.setModePaiement("0");
|
||||
}else if(PayerEesCheqCar == 1){
|
||||
reglement.setModePaiement("1");
|
||||
if(clt.ContrNull(TextFieldChequeNomBanque, TextCtlChequeNomBanque) &&
|
||||
clt.ContrNumeriqueNotnull(TextFieldChequeNumero, TextCtlChequeNumero) &&
|
||||
clt.ContrNull(TextFieldChequeNomComple, TextCtlChequeNomComple)&&
|
||||
clt.ContrNullDatePicker(DatePickerChequeDate, TextCtlChequeDate) ){
|
||||
|
||||
ChequeFrs Cheque = new ChequeFrs();
|
||||
Cheque.setBanqueChequeFrs(TextFieldChequeNomBanque.getText());
|
||||
Cheque.setNumeroChequeFrs(TextFieldChequeNumero.getText());
|
||||
Cheque.setNomCompletChequeFrs(TextFieldChequeNomComple.getText());
|
||||
Cheque.setDatePaiement(DatePickerChequeDate.getValue().toString());
|
||||
Cheque.setMontantChequeFrs(Adaptateur.ArrondFloatToString(TotalFact));
|
||||
reglement.setCheque(Cheque);
|
||||
}else{ clt_reglement = false; }
|
||||
|
||||
}else if(PayerEesCheqCar == 2){
|
||||
reglement.setModePaiement("2");
|
||||
if(clt.ContrNull(TextFieldCarteNomBanque, TextCtlCartNomBanque) &&
|
||||
clt.ContrNumeriqueNotnull(TextFieldCarteNumeroCart, TextCtlCartNumeroCart) &&
|
||||
clt.ContrNumeriqueNotnull(TextFieldCarteNumeroTransaction, TextCtlCartNumeroTransaction)&&
|
||||
clt.ContrNullDatePicker(DatePickerCarteDate, TextCtlCartDateHeurTransaction) &&
|
||||
clt.ContrHour(TextFieldCarteHeurTransaction, TextCtlCartDateHeurTransaction) ){
|
||||
CarteElectroniqueFrs CarteElectronique = new CarteElectroniqueFrs();
|
||||
CarteElectronique.setBanque(TextFieldCarteNomBanque.getText());
|
||||
CarteElectronique.setNumeroTransaction(TextFieldCarteNumeroTransaction.getText());
|
||||
CarteElectronique.setCodeCarte(TextFieldCarteNumeroCart.getText());
|
||||
CarteElectronique.setDateTransaction(DatePickerCarteDate.getValue().toString());
|
||||
CarteElectronique.setHeurTransaction(TextFieldCarteHeurTransaction.getText());
|
||||
CarteElectronique.setMantant(Adaptateur.ArrondFloatToString(TotalFact));
|
||||
reglement.setCarte(CarteElectronique);
|
||||
}else{ clt_reglement = false; }
|
||||
}
|
||||
}else if(SelectComptantFacilite == 1){
|
||||
reglement.setTypePaiement("1");
|
||||
|
||||
//1 Chéque | 3 Traite
|
||||
if(facilite_traite_cheque == 0){
|
||||
if(clt_total_echeance){
|
||||
reglement.setModePaiement("3");
|
||||
ObservableList<TraiteFrs> TraitFrs = FXCollections.observableArrayList();
|
||||
for(TraiteList List : ListT ) {
|
||||
String DatePaiement = new SimpleDateFormat("yyyy-MM-dd").format(List.getDate());
|
||||
TraitFrs.add(new TraiteFrs("", DatePaiement, null, List.getMontantTraite().replace(",", "."), null));
|
||||
}
|
||||
reglement.setListTraite(TraitFrs);
|
||||
}else{ clt_reglement = false; }
|
||||
|
||||
}else if(facilite_traite_cheque == 1){
|
||||
if(clt_total_echeance){
|
||||
reglement.setModePaiement("1");
|
||||
ObservableList<ChequeFrs> CollCheque = FXCollections.observableArrayList();
|
||||
for(ChequeList List : ListCheque ) {
|
||||
String CodeChequeFrs = "";
|
||||
String NumeroChequeFrs = List.getNumeroCheque();
|
||||
String BanqueChequeFrs = List.getBanqueCheque();
|
||||
String MontantChequeFrs = List.getMontantCheque();
|
||||
String DateCreation = LocalDateTime.now().toString();
|
||||
String DatePaiement = new SimpleDateFormat("yyyy-MM-dd").format(List.getDate());
|
||||
//controle numero chéque et nom banque
|
||||
if(NumeroChequeFrs.equals("") || BanqueChequeFrs.equals("")){
|
||||
clt_reglement = false;
|
||||
}
|
||||
CollCheque.add(new ChequeFrs(CodeChequeFrs, NumeroChequeFrs, BanqueChequeFrs, MontantChequeFrs, null, DatePaiement, DateCreation));
|
||||
}
|
||||
reglement.setListCheque(CollCheque);
|
||||
}else{ clt_reglement = false; }
|
||||
}
|
||||
}
|
||||
|
||||
if(clt_reglement){
|
||||
reglement.setMontant(Adaptateur.ArrondFloatToString(TotalFact));
|
||||
reglement.setListFacture(DataFacture);
|
||||
reglement.setDateTimeCreation(LocalDateTime.now().toString());
|
||||
reglement.setFournisseur(DataFacture.get(0).getFournisseur());
|
||||
reglement.setEtatReglement("0");
|
||||
|
||||
final ReglementDialogConfirmationController ReglementDialogConfirmation = new ReglementDialogConfirmationController();
|
||||
ReglementDialogConfirmation.Enregister.setOnAction(new EventHandler<ActionEvent>(){
|
||||
@Override
|
||||
public void handle(ActionEvent t) {
|
||||
try {
|
||||
ReglementDialogConfirmation.AnchorPrincipal.setVisible(false);
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Reglement/ReglementAjouter3.fxml"));
|
||||
Parent NodeReglementAjouter3 = (Parent)fxmlLoader.load();
|
||||
|
||||
ReglementAjouter3Controller ReglementAjouter3 = fxmlLoader.getController();
|
||||
ReglementAjouter3.setDataReglement(reglement);
|
||||
|
||||
AnchorPaneReglementAjouter2.getChildren().clear();
|
||||
AnchorPaneReglementAjouter2.getChildren().add(NodeReglementAjouter3);
|
||||
} catch (IOException ex) {
|
||||
logger.error("ReglementAjouter2Controller : ReglementAjouter3.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
ReglementDialogConfirmation.setReglement(reglement);
|
||||
ReglementDialogConfirmation.Show();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void AjouterTraitementButtonAction(ActionEvent event) throws IOException {
|
||||
Date date= new Date();
|
||||
Calendar cal = Calendar.getInstance();
|
||||
if(clt.ContrNumeriqueNotnull(TextFieldNbrEcheance, TextCtlNbrEcheance)){
|
||||
ListT.clear();
|
||||
Integer IntegerNbrEcheance = Adaptateur.Diviseur(Adaptateur.StringToFloat(TextFieldNbrEcheance.getText()));
|
||||
float Value = (float) TotalFact / IntegerNbrEcheance;
|
||||
Integer div = Adaptateur.Diviseur(Value);
|
||||
float Somme = 0;
|
||||
if(facilite_traite_cheque == 0){
|
||||
PaneFaciliteCheque.setVisible(false);
|
||||
PaneFaciliteTraite.setVisible(true);
|
||||
for(int i=0; i<IntegerNbrEcheance; i++){
|
||||
cal.setTime(date);
|
||||
cal.add(Calendar.MONTH, i+1);
|
||||
Somme += div;
|
||||
if(i == IntegerNbrEcheance-1){
|
||||
float reste = div + (TotalFact - Somme) ;
|
||||
ListT.add(new TraiteList(Adaptateur.ArrondFloatToString(reste), cal.getTime()));
|
||||
}else{
|
||||
ListT.add(new TraiteList(Adaptateur.floatDeleZero(div), cal.getTime()));
|
||||
}
|
||||
}
|
||||
TableViewListeTraite.setItems(ListT);
|
||||
CalculeTotalTrait();
|
||||
}else if(facilite_traite_cheque == 1){
|
||||
for(int i=0; i<IntegerNbrEcheance; i++){
|
||||
cal.setTime(date);
|
||||
cal.add(Calendar.MONTH, i+1);
|
||||
Somme += div;
|
||||
if(i == IntegerNbrEcheance-1){
|
||||
float reste = div + (TotalFact - Somme) ;
|
||||
ListCheque.add(new ChequeList(cal.getTime(),"","",Adaptateur.ArrondFloatToString(reste)));
|
||||
}else{
|
||||
ListCheque.add(new ChequeList(cal.getTime(),"","",Adaptateur.floatDeleZero(div)));
|
||||
}
|
||||
}
|
||||
CalculeTotalCheque();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void SetDataFactureFrs(ObservableList<FactureFrs> DataFact){
|
||||
DataFacture = DataFact;
|
||||
for( FactureFrs Facture : DataFact ) {
|
||||
TotalFact += Adaptateur.StringToFloat(Facture.getNetAPayer());
|
||||
}
|
||||
TextTotalFacture.setText(Adaptateur.FloatToStringEspaceCurrency(TotalFact));
|
||||
TotalEcheance.setText("0 / "+Adaptateur.ArrondFloatToString(TotalFact));
|
||||
|
||||
TotalFact = Adaptateur.ArrondFloatToFloat(TotalFact);
|
||||
|
||||
TextNbrFacture.setText(DataFact.size()+"");
|
||||
}
|
||||
|
||||
|
||||
public void CalculeTotalTrait(){
|
||||
float Somme = 0;
|
||||
for(TraiteList List : ListT ) {
|
||||
Somme += Adaptateur.StringToFloat(List.getMontantTraite());
|
||||
}
|
||||
TotalEcheance.setText(Adaptateur.ArrondFloatToString(Somme)+" / "+Adaptateur.ArrondFloatToString(TotalFact));
|
||||
|
||||
if(Adaptateur.ArrondFloatToString(Somme).equals(Adaptateur.ArrondFloatToString(TotalFact))){
|
||||
TotalEcheance.setFill(Color.web("#000000"));
|
||||
clt_total_echeance = true;
|
||||
}else{
|
||||
TotalEcheance.setFill(Color.web("#f20606"));
|
||||
clt_total_echeance = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void CalculeTotalCheque(){
|
||||
float Somme = 0;
|
||||
for(ChequeList List : ListCheque ) {
|
||||
Somme += Adaptateur.StringToFloat(List.getMontantCheque());
|
||||
}
|
||||
TotalEcheance.setText(Adaptateur.ArrondFloatToString(Somme)+" / "+Adaptateur.ArrondFloatToString(TotalFact));
|
||||
|
||||
if(Adaptateur.ArrondFloatToString(Somme).equals(Adaptateur.ArrondFloatToString(TotalFact))){
|
||||
TotalEcheance.setFill(Color.web("#000000"));
|
||||
clt_total_echeance = true;
|
||||
}else{
|
||||
TotalEcheance.setFill(Color.web("#f20606"));
|
||||
clt_total_echeance = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void ReglementAjouter1ButtonAction(ActionEvent event) throws IOException {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Reglement/ReglementAjouter1.fxml"));
|
||||
Parent NodeReglementAjouter1 = (Parent)fxmlLoader.load();
|
||||
|
||||
ReglementAjouter1Controller ReglementAjouter1 = fxmlLoader.getController();
|
||||
ReglementAjouter1.setDataFactureFrs(DataFacture);
|
||||
|
||||
AnchorPaneReglementAjouter2.getChildren().clear();
|
||||
AnchorPaneReglementAjouter2.getChildren().add(NodeReglementAjouter1);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void RadioComptantAction(ActionEvent event) throws IOException {
|
||||
SelectComptantFacilite = 0;
|
||||
PaneComptant.setVisible(true);
|
||||
PaneFacilite.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
public void RadioEspeceAction(ActionEvent event) throws IOException {
|
||||
PayerEesCheqCar = 0;
|
||||
GridPaneCheque.setVisible(false);
|
||||
GridPaneCarte.setVisible(false);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void RadioChequeAction(ActionEvent event) throws IOException {
|
||||
PayerEesCheqCar = 1;
|
||||
GridPaneCheque.setVisible(true);
|
||||
GridPaneCarte.setVisible(false);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void RadioCarteAction(ActionEvent event) throws IOException {
|
||||
PayerEesCheqCar = 2;
|
||||
GridPaneCheque.setVisible(false);
|
||||
GridPaneCarte.setVisible(true);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void RadioFaciliteAction(ActionEvent event) throws IOException {
|
||||
SelectComptantFacilite = 1;
|
||||
PaneComptant.setVisible(false);
|
||||
PaneFacilite.setVisible(true);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void RadioFaciliteTraiteAction(ActionEvent event) throws IOException {
|
||||
facilite_traite_cheque = 0;
|
||||
PaneFaciliteCheque.setVisible(false);
|
||||
PaneFaciliteTraite.setVisible(true);
|
||||
}
|
||||
|
||||
@FXML
|
||||
public void RadioFaciliteChequeAction(ActionEvent event) throws IOException {
|
||||
facilite_traite_cheque = 1;
|
||||
PaneFaciliteCheque.setVisible(true);
|
||||
PaneFaciliteTraite.setVisible(false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package Controllers.Reglement;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Models.FactureFrs.FactureFrs;
|
||||
import Models.Reglement.ChequeFrs;
|
||||
import Models.Reglement.Reglement;
|
||||
import Models.Reglement.ReglementDB;
|
||||
import Models.Reglement.TraiteFrs;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.ProgressIndicator;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher
|
||||
*/
|
||||
public class ReglementAjouter3Controller implements Initializable {
|
||||
|
||||
@FXML public ProgressIndicator ProgressReglement;
|
||||
@FXML private AnchorPane PaneDetailTraite;
|
||||
private Service<Void> ThreadReglement;
|
||||
|
||||
@FXML private Text TextCodeReglement;
|
||||
@FXML private Text TextTypePaiement;
|
||||
@FXML private Text TextModePaiement;
|
||||
@FXML private Text TextDateCreation;
|
||||
@FXML private Text TextTotalReglement;
|
||||
@FXML private Text TextProfile;
|
||||
|
||||
@FXML private Text TextCodeFrs;
|
||||
@FXML private Text TextNomFrs;
|
||||
@FXML private Text TextTele1Frs;
|
||||
@FXML private Text TextTele2Frs;
|
||||
|
||||
@FXML private GridPane GridPaneCheque;
|
||||
@FXML private GridPane GridPaneCarte;
|
||||
|
||||
@FXML private Text TextCartNomBanque;
|
||||
@FXML private Text TextCartNumeroCart;
|
||||
@FXML private Text TextCartNumeroTransaction;
|
||||
@FXML private Text TextCartDateHeurTransaction;
|
||||
|
||||
@FXML private Text TextChequeNomBanque;
|
||||
@FXML private Text TextChequeNumero;
|
||||
@FXML private Text TextChequeNomComple;
|
||||
@FXML private Text TextChequeDate;
|
||||
|
||||
@FXML private Button ButtonImprimer;
|
||||
|
||||
@FXML private TableView<ChequeFrs> TableViewListeCheque ;
|
||||
@FXML private TableColumn<ChequeFrs ,String> TabColDateCheque;
|
||||
@FXML private TableColumn<ChequeFrs ,String> TabColNumeroCheque;
|
||||
@FXML private TableColumn<ChequeFrs ,String> TabColBanqueCheque;
|
||||
@FXML private TableColumn<ChequeFrs ,String> TabColMontantCheque;
|
||||
|
||||
@FXML private TableView<TraiteFrs> TableViewListeTraite ;
|
||||
@FXML private TableColumn<TraiteFrs ,String> TabColDateTraite;
|
||||
@FXML private TableColumn<TraiteFrs ,String> TabColMontantTraite;
|
||||
|
||||
|
||||
|
||||
@FXML private TableView<FactureFrs> TableViewFactureFrs;
|
||||
@FXML private TableColumn<FactureFrs ,String> TabColNumeroFact;
|
||||
@FXML private TableColumn<FactureFrs ,String> TabColProfile;
|
||||
@FXML private TableColumn<FactureFrs ,String> TabColDate;
|
||||
@FXML private TableColumn<FactureFrs ,String> TabColHeur;
|
||||
@FXML private TableColumn<FactureFrs ,String> TabColLocalReception;
|
||||
@FXML private TableColumn<FactureFrs ,String> TabColNetPayer;
|
||||
|
||||
Reglement reglement = new Reglement();
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
TabColMontantTraite.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColMontantTraite.getStyleClass().add("Center");
|
||||
TabColMontantTraite.setCellValueFactory(new PropertyValueFactory<TraiteFrs, String>("Montant"));
|
||||
|
||||
TabColDateTraite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDateTraite.getStyleClass().add("Center");
|
||||
TabColDateTraite.setCellValueFactory(new PropertyValueFactory<TraiteFrs, String>("DatePaiement"));
|
||||
|
||||
|
||||
TabColNumeroCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColNumeroCheque.getStyleClass().add("Center");
|
||||
TabColNumeroCheque.setCellValueFactory(new PropertyValueFactory<ChequeFrs, String>("NumeroChequeFrs"));
|
||||
|
||||
TabColBanqueCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColBanqueCheque.getStyleClass().add("Center");
|
||||
TabColBanqueCheque.setCellValueFactory(new PropertyValueFactory<ChequeFrs, String>("BanqueChequeFrs"));
|
||||
|
||||
TabColDateCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDateCheque.getStyleClass().add("Center");
|
||||
TabColDateCheque.setCellValueFactory(new PropertyValueFactory<ChequeFrs, String>("DatePaiement"));
|
||||
|
||||
TabColMontantCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColMontantCheque.getStyleClass().add("Center");
|
||||
TabColMontantCheque.setCellValueFactory(new PropertyValueFactory<ChequeFrs, String>("MontantChequeFrs"));
|
||||
|
||||
TabColNumeroFact.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("Numero"));
|
||||
|
||||
TabColProfile.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColProfile.getStyleClass().add("Center");
|
||||
TabColProfile.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<FactureFrs,String>, ObservableValue<String>>() {
|
||||
@Override
|
||||
public ObservableValue<String> call(TableColumn.CellDataFeatures<FactureFrs, String> data) {
|
||||
return new SimpleStringProperty(data.getValue().getProfile().getNom()+" "+data.getValue().getProfile().getPrenom());
|
||||
}
|
||||
});
|
||||
|
||||
TabColDate.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("DateCreation"));
|
||||
TabColDate.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDate.getStyleClass().add("Center");
|
||||
|
||||
TabColHeur.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("HeurCreation"));
|
||||
TabColHeur.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColHeur.getStyleClass().add("Center");
|
||||
|
||||
TabColLocalReception.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("Local"));
|
||||
TabColLocalReception.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColLocalReception.getStyleClass().add("Center");
|
||||
|
||||
TabColNetPayer.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("NetAPayer"));
|
||||
TabColNetPayer.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNetPayer.getStyleClass().add("Center");
|
||||
}
|
||||
|
||||
public void setDataReglement(Reglement regl){
|
||||
reglement = regl;
|
||||
LanchSaveReglement();
|
||||
}
|
||||
|
||||
public void setReglement(){
|
||||
|
||||
TextCodeReglement.setText(reglement.getNumero());
|
||||
TextTypePaiement.setText(reglement.getTypePaiementString());
|
||||
TextModePaiement.setText(reglement.getModePaiementString());
|
||||
TextDateCreation.setText(reglement.getDateTimeCreationString());
|
||||
TextTotalReglement.setText(Adaptateur.StringToStringEspaceCurrency(reglement.getMontant()));
|
||||
|
||||
TextProfile.setText(reglement.getProfile().getPrenom()+" "+reglement.getProfile().getNom());
|
||||
|
||||
TextCodeFrs.setText(reglement.getFournisseur().getCode());
|
||||
TextNomFrs.setText(reglement.getFournisseur().getNom());
|
||||
TextTele1Frs.setText(reglement.getFournisseur().getTele1());
|
||||
TextTele2Frs.setText(reglement.getFournisseur().getTele2());
|
||||
|
||||
TableViewFactureFrs.setItems(reglement.getListFacture());
|
||||
// 0 Comptant
|
||||
if(reglement.getTypePaiement().equals("0")){
|
||||
|
||||
//0 espèce
|
||||
if(reglement.getModePaiement().equals("0")){
|
||||
|
||||
//1 Chéque
|
||||
}else if(reglement.getModePaiement().equals("1")){
|
||||
GridPaneCheque.setVisible(true);
|
||||
TextChequeNomBanque.setText(reglement.getCheque().getBanqueChequeFrs());
|
||||
TextChequeNumero.setText(reglement.getCheque().getNumeroChequeFrs());
|
||||
TextChequeNomComple.setText(reglement.getCheque().getNomCompletChequeFrs());
|
||||
TextChequeDate.setText(reglement.getCheque().getDateCreation());
|
||||
|
||||
//2 Carte électronique
|
||||
}else if(reglement.getModePaiement().equals("2")){
|
||||
GridPaneCarte.setVisible(true);
|
||||
TextCartNomBanque.setText(reglement.getCarte().getBanque());
|
||||
TextCartNumeroCart.setText(reglement.getCarte().getNumeroCarte());
|
||||
TextCartNumeroTransaction.setText(reglement.getCarte().getNumeroTransaction());
|
||||
TextCartDateHeurTransaction.setText(reglement.getCarte().getDateTransaction()+" "+reglement.getCarte().getHeurTransaction());
|
||||
}
|
||||
|
||||
|
||||
//1 Facilité
|
||||
}else if(reglement.getTypePaiement().equals("1")){
|
||||
|
||||
//1 Chéque
|
||||
if(reglement.getModePaiement().equals("1")){
|
||||
TableViewListeCheque.setVisible(true);
|
||||
ObservableList<ChequeFrs> NewListCheque = FXCollections.observableArrayList();
|
||||
for(ChequeFrs Cheque : reglement.getListCheque()) {
|
||||
String CodeChequeFrs = Cheque.getCodeChequeFrs();
|
||||
String NumeroChequeFrs = Cheque.getNumeroChequeFrs();
|
||||
String BanqueChequeFrs = Cheque.getBanqueChequeFrs();
|
||||
String MontantChequeFrs = Adaptateur.StringDeleZero(Cheque.getMontantChequeFrs());
|
||||
String NomCompletChequeFrs = Cheque.getNomCompletChequeFrs();
|
||||
String DatePaiement = Adaptateur.NormalDateFormat(Cheque.getDatePaiement());
|
||||
String DateCreation = Adaptateur.NormalDateTimeFormat(Cheque.getDateCreation());
|
||||
NewListCheque.add(new ChequeFrs(CodeChequeFrs, NumeroChequeFrs, BanqueChequeFrs, MontantChequeFrs, NomCompletChequeFrs, DatePaiement, DateCreation));
|
||||
}
|
||||
TableViewListeCheque.setItems(NewListCheque);
|
||||
|
||||
|
||||
//3 Traite
|
||||
}else if(reglement.getModePaiement().equals("3")){
|
||||
TableViewListeTraite.setVisible(true);
|
||||
ButtonImprimer.setVisible(true);
|
||||
TableViewListeTraite.setItems(reglement.getListTraiteString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void LanchSaveReglement(){
|
||||
ThreadReglement = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
ReglementDB reglementDB = new ReglementDB();
|
||||
reglement = reglementDB.setReglementDB(reglement);
|
||||
reglement = reglementDB.getReglementDB(reglement.getNumero());
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadReglement.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressReglement.setVisible(false);
|
||||
setReglement();
|
||||
PaneDetailTraite.setVisible(true);
|
||||
}
|
||||
});
|
||||
ThreadReglement.start();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
|
||||
package Controllers.Reglement;
|
||||
|
||||
import Controllers.CommandeClt.CommandeCltDialogConfirmationController;
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Models.FactureFrs.FactureFrs;
|
||||
import Models.Reglement.ChequeFrs;
|
||||
import Models.Reglement.Reglement;
|
||||
import Models.Reglement.TraiteFrs;
|
||||
import Models.User.User;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.image.Image;
|
||||
import javafx.scene.image.ImageView;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
*
|
||||
* @author Maher
|
||||
*/
|
||||
public class ReglementDialogConfirmationController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(ReglementDialogConfirmationController.class.getName());
|
||||
|
||||
public Node nodeFxml ;
|
||||
|
||||
@FXML public AnchorPane AnchorPrincipal ;
|
||||
@FXML public Button Enregister ;
|
||||
|
||||
@FXML private AnchorPane AnchorDetailReglement;
|
||||
|
||||
@FXML private Text TextTypePaiement;
|
||||
@FXML private Text TextModePaiement;
|
||||
@FXML private Text TextDateCreation;
|
||||
@FXML private Text TextNombreFact;
|
||||
@FXML private Text TextTotalReglement;
|
||||
@FXML private Text TextProfile;
|
||||
|
||||
@FXML private Text TextCodeFrs;
|
||||
@FXML private Text TextNomFrs;
|
||||
@FXML private Text TextFormesFrs;
|
||||
@FXML private Text TextTele1Frs;
|
||||
@FXML private Text TextTele2Frs;
|
||||
@FXML private Text TextmailFrs;
|
||||
|
||||
@FXML private GridPane GridPaneCheque;
|
||||
@FXML private GridPane GridPaneCarte;
|
||||
|
||||
@FXML private Text TextCartNomBanque;
|
||||
@FXML private Text TextCartNumeroCart;
|
||||
@FXML private Text TextCartNumeroTransaction;
|
||||
@FXML private Text TextCartDateHeurTransaction;
|
||||
|
||||
@FXML private Text TextChequeNomBanque;
|
||||
@FXML private Text TextChequeNumero;
|
||||
@FXML private Text TextChequeNomComple;
|
||||
@FXML private Text TextChequeDate;
|
||||
|
||||
@FXML private TableView<ChequeFrs> TableViewListeCheque ;
|
||||
@FXML private TableColumn<ChequeFrs ,String> TabColDateCheque;
|
||||
@FXML private TableColumn<ChequeFrs ,String> TabColNumeroCheque;
|
||||
@FXML private TableColumn<ChequeFrs ,String> TabColBanqueCheque;
|
||||
@FXML private TableColumn<ChequeFrs ,String> TabColMontantCheque;
|
||||
|
||||
@FXML private TableView<TraiteFrs> TableViewListeTraite ;
|
||||
@FXML private TableColumn<TraiteFrs ,String> TabColDateTraite;
|
||||
@FXML private TableColumn<TraiteFrs ,String> TabColMontantTraite;
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
//Cheque
|
||||
TabColNumeroCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColNumeroCheque.getStyleClass().add("Center");
|
||||
TabColNumeroCheque.setCellValueFactory(new PropertyValueFactory<ChequeFrs, String>("NumeroChequeFrs"));
|
||||
|
||||
TabColBanqueCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColBanqueCheque.getStyleClass().add("Center");
|
||||
TabColBanqueCheque.setCellValueFactory(new PropertyValueFactory<ChequeFrs, String>("BanqueChequeFrs"));
|
||||
|
||||
TabColMontantCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColMontantCheque.getStyleClass().add("Center");
|
||||
TabColMontantCheque.setCellValueFactory(new PropertyValueFactory<ChequeFrs, String>("MontantChequeFrs"));
|
||||
|
||||
TabColDateCheque.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDateCheque.getStyleClass().add("Center");
|
||||
TabColDateCheque.setCellValueFactory(new PropertyValueFactory<ChequeFrs, String>("DatePaiement"));
|
||||
|
||||
|
||||
TabColDateTraite.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDateTraite.getStyleClass().add("Center");
|
||||
TabColDateTraite.setCellValueFactory(new PropertyValueFactory<TraiteFrs, String>("DatePaiement"));
|
||||
|
||||
TabColMontantTraite.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColMontantTraite.getStyleClass().add("Center");
|
||||
TabColMontantTraite.setCellValueFactory(new PropertyValueFactory<TraiteFrs, String>("Montant"));
|
||||
|
||||
Image coffeeImage = new Image(getClass().getResourceAsStream("/Public/icon/iconsave.png"));
|
||||
ImageView buttonGraphic = new ImageView();
|
||||
buttonGraphic.setImage(coffeeImage);
|
||||
Enregister.setGraphic(buttonGraphic);
|
||||
}
|
||||
|
||||
|
||||
public void setReglement(Reglement reglement){
|
||||
|
||||
TextModePaiement.setText(reglement.getModePaiementString());
|
||||
TextTypePaiement.setText(reglement.getTypePaiementString());
|
||||
|
||||
if(reglement.getTypePaiement().equals("0")){
|
||||
if(reglement.getModePaiement().equals("0")){
|
||||
AnchorDetailReglement.setVisible(false);
|
||||
}else if(reglement.getModePaiement().equals("1")){
|
||||
GridPaneCheque.setVisible(true);
|
||||
TextChequeNomBanque.setText(reglement.getCheque().getBanqueChequeFrs());
|
||||
TextChequeNumero.setText(reglement.getCheque().getNumeroChequeFrs());
|
||||
TextChequeNomComple.setText(reglement.getCheque().getNomCompletChequeFrs());
|
||||
TextChequeDate.setText(reglement.getCheque().getDatePaiement());
|
||||
}else if(reglement.getModePaiement().equals("2")){
|
||||
GridPaneCarte.setVisible(true);
|
||||
TextCartNomBanque.setText(reglement.getCarte().getBanque());
|
||||
TextCartNumeroCart.setText(reglement.getCarte().getCodeCarte());
|
||||
TextCartNumeroTransaction.setText(reglement.getCarte().getNumeroTransaction());
|
||||
TextCartDateHeurTransaction.setText(Adaptateur.NormalDateFormat(reglement.getCarte().getDateTransaction())+" "+reglement.getCarte().getHeurTransaction());
|
||||
}
|
||||
}
|
||||
|
||||
if(reglement.getTypePaiement().equals("1")){
|
||||
AnchorDetailReglement.setVisible(true);
|
||||
if(reglement.getListTraite() != null){
|
||||
TableViewListeTraite.setVisible(true);
|
||||
TableViewListeTraite.setItems(reglement.getListTraiteString());
|
||||
}else if(reglement.getListCheque() != null){
|
||||
TableViewListeCheque.setVisible(true);
|
||||
ObservableList<ChequeFrs> NewListCheque = FXCollections.observableArrayList();
|
||||
for(ChequeFrs Cheque : reglement.getListCheque()) {
|
||||
String CodeChequeFrs = Cheque.getCodeChequeFrs();
|
||||
String NumeroChequeFrs = Cheque.getNumeroChequeFrs();
|
||||
String BanqueChequeFrs = Cheque.getBanqueChequeFrs();
|
||||
String MontantChequeFrs = Adaptateur.StringDeleZero(Cheque.getMontantChequeFrs());
|
||||
String NomCompletChequeFrs = Cheque.getNomCompletChequeFrs();
|
||||
String DatePaiement = Adaptateur.NormalDateFormat(Cheque.getDatePaiement());
|
||||
String DateCreation = Adaptateur.NormalDateTimeFormat(Cheque.getDateCreation());
|
||||
NewListCheque.add(new ChequeFrs(CodeChequeFrs, NumeroChequeFrs, BanqueChequeFrs, MontantChequeFrs, NomCompletChequeFrs, DatePaiement, DateCreation));
|
||||
}
|
||||
TableViewListeCheque.setItems(NewListCheque);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
ObservableList<FactureFrs> ListFacture = reglement.getListFacture();
|
||||
float Somme = 0;
|
||||
for(FactureFrs facture : ListFacture ) {
|
||||
Somme += Adaptateur.StringToFloat(facture.getNetAPayer());
|
||||
}
|
||||
|
||||
TextTotalReglement.setText(Adaptateur.FloatToStringEspaceCurrency(Somme));
|
||||
TextNombreFact.setText(ListFacture.size()+"");
|
||||
|
||||
TextDateCreation.setText(Adaptateur.NormalDateFormat(reglement.getDateTimeCreation()));
|
||||
TextProfile.setText(User.nom+" "+User.prenom);
|
||||
|
||||
TextCodeFrs.setText(reglement.getFournisseur().getCode());
|
||||
TextNomFrs.setText(reglement.getFournisseur().getNom());
|
||||
TextFormesFrs.setText(reglement.getFournisseur().getFormes());
|
||||
TextTele1Frs.setText(reglement.getFournisseur().getTele1());
|
||||
TextTele2Frs.setText(reglement.getFournisseur().getTele2());
|
||||
TextmailFrs.setText(reglement.getFournisseur().getMail());
|
||||
}
|
||||
|
||||
public ReglementDialogConfirmationController(){
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Reglement/ReglementDialogConfirmation.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
nodeFxml = (Node) fxmlLoader.load();
|
||||
} catch (IOException ex) {
|
||||
logger.error("ReglementDialogConfirmationController : ReglementDialogConfirmation.fxml :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void ExitButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPrincipal.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Show()
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(nodeFxml);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,309 @@
|
||||
|
||||
package Controllers.Reglement;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Controllers.Traitement.MyWindow;
|
||||
import Controllers.Traitement.ParametreSystem;
|
||||
import Models.FactureFrs.FactureFrs;
|
||||
import Models.Reglement.ChequeFrs;
|
||||
import Models.Reglement.Reglement;
|
||||
import Models.Reglement.ReglementDB;
|
||||
import Models.Reglement.TraiteFrs;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ResourceBundle;
|
||||
import org.apache.log4j.Logger;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.concurrent.Service;
|
||||
import javafx.concurrent.Task;
|
||||
import javafx.concurrent.WorkerStateEvent;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.control.ProgressIndicator;
|
||||
import javafx.scene.control.TableCell;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
import javafx.stage.Stage;
|
||||
import javafx.util.Callback;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
*
|
||||
* @author Maher
|
||||
*/
|
||||
public class ReglementDialogDetailController implements Initializable {
|
||||
|
||||
Logger logger = Logger.getLogger(ReglementDialogDetailController.class.getName());
|
||||
|
||||
public Node nodeFxml ;
|
||||
|
||||
@FXML public AnchorPane AnchorPrincipal ;
|
||||
@FXML public ProgressIndicator ProgressReglement;
|
||||
@FXML public AnchorPane PaneDetailReglement;
|
||||
|
||||
@FXML private Text TextCodeReglement;
|
||||
@FXML private Text TextTypePaiement;
|
||||
@FXML private Text TextModePaiement;
|
||||
@FXML private Text TextDateCreation;
|
||||
@FXML private Text TextTotalReglement;
|
||||
@FXML private Text TextProfile;
|
||||
|
||||
@FXML private Text TextCodeFrs;
|
||||
@FXML private Text TextNomFrs;
|
||||
@FXML private Text TextTele1Frs;
|
||||
@FXML private Text TextTele2Frs;
|
||||
|
||||
@FXML private GridPane GridPaneCheque;
|
||||
@FXML private GridPane GridPaneCarte;
|
||||
|
||||
@FXML private Text TextCartNomBanque;
|
||||
@FXML private Text TextCartNumeroCart;
|
||||
@FXML private Text TextCartNumeroTransaction;
|
||||
@FXML private Text TextCartDateHeurTransaction;
|
||||
|
||||
@FXML private Text TextChequeNomBanque;
|
||||
@FXML private Text TextChequeNumero;
|
||||
@FXML private Text TextChequeNomComple;
|
||||
@FXML private Text TextChequeDate;
|
||||
|
||||
@FXML private TableView<ChequeFrs> TableViewListeCheque ;
|
||||
@FXML private TableColumn<ChequeFrs ,String> TabColDateCheque;
|
||||
@FXML private TableColumn<ChequeFrs ,String> TabColNumeroCheque;
|
||||
@FXML private TableColumn<ChequeFrs ,String> TabColBanqueCheque;
|
||||
@FXML private TableColumn<ChequeFrs ,String> TabColMontantCheque;
|
||||
|
||||
@FXML private TableView<TraiteFrs> TableViewListeTraite ;
|
||||
@FXML private TableColumn<TraiteFrs ,String> TabColDateTraite;
|
||||
@FXML private TableColumn<TraiteFrs ,String> TabColMontantTraite;
|
||||
|
||||
|
||||
@FXML private TableView<FactureFrs> TableViewFactureFrs;
|
||||
@FXML private TableColumn<FactureFrs ,String> TabColNumeroFact;
|
||||
@FXML private TableColumn<FactureFrs ,String> TabColProfile;
|
||||
@FXML private TableColumn<FactureFrs ,String> TabColDate;
|
||||
@FXML private TableColumn<FactureFrs ,String> TabColHeur;
|
||||
@FXML private TableColumn<FactureFrs ,String> TabColLocalReception;
|
||||
@FXML private TableColumn<FactureFrs ,String> TabColNetPayer;
|
||||
|
||||
private Service<Void> ThreadReglement;
|
||||
|
||||
DecimalFormat Formatter = new DecimalFormat("##,###.## ");
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
TabColMontantTraite.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColMontantTraite.getStyleClass().add("Center");
|
||||
TabColMontantTraite.setCellValueFactory(new PropertyValueFactory<TraiteFrs, String>("Montant"));
|
||||
|
||||
TabColDateTraite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDateTraite.getStyleClass().add("Center");
|
||||
TabColDateTraite.setCellValueFactory(new PropertyValueFactory<TraiteFrs, String>("DatePaiement"));
|
||||
|
||||
|
||||
TabColNumeroCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColNumeroCheque.getStyleClass().add("Center");
|
||||
TabColNumeroCheque.setCellValueFactory(new PropertyValueFactory<ChequeFrs, String>("NumeroChequeFrs"));
|
||||
|
||||
TabColBanqueCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColBanqueCheque.getStyleClass().add("Center");
|
||||
TabColBanqueCheque.setCellValueFactory(new PropertyValueFactory<ChequeFrs, String>("BanqueChequeFrs"));
|
||||
|
||||
TabColDateCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColDateCheque.getStyleClass().add("Center");
|
||||
TabColDateCheque.setCellValueFactory(new PropertyValueFactory<ChequeFrs, String>("DatePaiement"));
|
||||
|
||||
TabColMontantCheque.setStyle( "-fx-alignment: CENTER;");
|
||||
TabColMontantCheque.getStyleClass().add("Center");
|
||||
TabColMontantCheque.setCellValueFactory(new PropertyValueFactory<ChequeFrs, String>("MontantChequeFrs"));
|
||||
|
||||
TabColNumeroFact.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("Numero"));
|
||||
|
||||
TabColProfile.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColProfile.getStyleClass().add("Center");
|
||||
TabColProfile.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<FactureFrs,String>, ObservableValue<String>>() {
|
||||
@Override
|
||||
public ObservableValue<String> call(TableColumn.CellDataFeatures<FactureFrs, String> data) {
|
||||
return new SimpleStringProperty(data.getValue().getProfile().getNom()+" "+data.getValue().getProfile().getPrenom());
|
||||
}
|
||||
});
|
||||
|
||||
TabColDate.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("DateCreation"));
|
||||
TabColDate.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColDate.getStyleClass().add("Center");
|
||||
|
||||
TabColHeur.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("HeurCreation"));
|
||||
TabColHeur.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColHeur.getStyleClass().add("Center");
|
||||
|
||||
TabColLocalReception.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("Local"));
|
||||
TabColLocalReception.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColLocalReception.getStyleClass().add("Center");
|
||||
|
||||
TabColNetPayer.setCellValueFactory(new PropertyValueFactory<FactureFrs, String>("NetAPayer"));
|
||||
TabColNetPayer.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColNetPayer.getStyleClass().add("Center");
|
||||
TabColNetPayer.setCellFactory(new Callback<TableColumn<FactureFrs,String>,TableCell<FactureFrs,String>>(){
|
||||
@Override
|
||||
public TableCell<FactureFrs, String> call(TableColumn<FactureFrs, String> param) {
|
||||
TableCell<FactureFrs, String> cell = new TableCell<FactureFrs, String>(){
|
||||
@Override
|
||||
public void updateItem(String item, boolean empty) {
|
||||
if(item!= null){
|
||||
Text text = new Text(Formatter.format(Float.parseFloat(item)));
|
||||
setGraphic(text);
|
||||
}else{
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
return cell;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void LanchShowReglement(final String IdReglement){
|
||||
|
||||
ThreadReglement = new Service<Void>(){
|
||||
@Override
|
||||
protected Task<Void> createTask(){
|
||||
return new Task<Void>(){
|
||||
@Override
|
||||
protected Void call() throws Exception{
|
||||
Reglement reglement = new ReglementDB().getReglementDB(IdReglement);
|
||||
setReglement(reglement);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
ThreadReglement.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
|
||||
@Override
|
||||
public void handle(WorkerStateEvent event){
|
||||
ProgressReglement.setVisible(false);
|
||||
PaneDetailReglement.setVisible(true);
|
||||
}
|
||||
});
|
||||
ThreadReglement.start();
|
||||
}
|
||||
|
||||
public void setReglement(Reglement reglement){
|
||||
|
||||
TextCodeReglement.setText(reglement.getNumero());
|
||||
TextTypePaiement.setText(reglement.getTypePaiementString());
|
||||
TextModePaiement.setText(reglement.getModePaiementString());
|
||||
TextDateCreation.setText(reglement.getDateTimeCreationString());
|
||||
|
||||
|
||||
TextTotalReglement.setText(Formatter.format(Float.parseFloat(reglement.getMontant()))+" "+ParametreSystem.CurrencySign);
|
||||
TextProfile.setText(reglement.getProfile().getPrenom()+" "+reglement.getProfile().getNom());
|
||||
|
||||
TextCodeFrs.setText(reglement.getFournisseur().getCode());
|
||||
TextNomFrs.setText(reglement.getFournisseur().getNom());
|
||||
TextTele1Frs.setText(reglement.getFournisseur().getTele1());
|
||||
TextTele2Frs.setText(reglement.getFournisseur().getTele2());
|
||||
|
||||
TableViewFactureFrs.setItems(reglement.getListFacture());
|
||||
// 0 Comptant
|
||||
if(reglement.getTypePaiement().equals("0")){
|
||||
|
||||
//0 espèce
|
||||
if(reglement.getModePaiement().equals("0")){
|
||||
|
||||
//1 Chéque
|
||||
}else if(reglement.getModePaiement().equals("1")){
|
||||
GridPaneCheque.setVisible(true);
|
||||
TextChequeNomBanque.setText(reglement.getCheque().getBanqueChequeFrs());
|
||||
TextChequeNumero.setText(reglement.getCheque().getNumeroChequeFrs());
|
||||
TextChequeNomComple.setText(reglement.getCheque().getNomCompletChequeFrs());
|
||||
TextChequeDate.setText(reglement.getCheque().getDateCreation());
|
||||
|
||||
//2 Carte électronique
|
||||
}else if(reglement.getModePaiement().equals("2")){
|
||||
GridPaneCarte.setVisible(true);
|
||||
TextCartNomBanque.setText(reglement.getCarte().getBanque());
|
||||
TextCartNumeroCart.setText(reglement.getCarte().getNumeroCarte());
|
||||
TextCartNumeroTransaction.setText(reglement.getCarte().getNumeroTransaction());
|
||||
TextCartDateHeurTransaction.setText(reglement.getCarte().getDateTransaction()+" "+reglement.getCarte().getHeurTransaction());
|
||||
}
|
||||
|
||||
|
||||
//1 Facilité
|
||||
}else if(reglement.getTypePaiement().equals("1")){
|
||||
|
||||
//1 Chéque
|
||||
if(reglement.getModePaiement().equals("1")){
|
||||
TableViewListeCheque.setVisible(true);
|
||||
ObservableList<ChequeFrs> NewListCheque = FXCollections.observableArrayList();
|
||||
for(ChequeFrs Cheque : reglement.getListCheque()) {
|
||||
String CodeChequeFrs = Cheque.getCodeChequeFrs();
|
||||
String NumeroChequeFrs = Cheque.getNumeroChequeFrs();
|
||||
String BanqueChequeFrs = Cheque.getBanqueChequeFrs();
|
||||
String MontantChequeFrs = Adaptateur.StringDeleZero(Cheque.getMontantChequeFrs());
|
||||
String NomCompletChequeFrs = Cheque.getNomCompletChequeFrs();
|
||||
String DatePaiement = Adaptateur.NormalDateFormat(Cheque.getDatePaiement());
|
||||
String DateCreation = Adaptateur.NormalDateTimeFormat(Cheque.getDateCreation());
|
||||
NewListCheque.add(new ChequeFrs(CodeChequeFrs, NumeroChequeFrs, BanqueChequeFrs, MontantChequeFrs, NomCompletChequeFrs, DatePaiement, DateCreation));
|
||||
}
|
||||
TableViewListeCheque.setItems(NewListCheque);
|
||||
|
||||
|
||||
//3 Traite
|
||||
}else if(reglement.getModePaiement().equals("3")){
|
||||
TableViewListeTraite.setVisible(true);
|
||||
TableViewListeTraite.setItems(reglement.getListTraiteString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ReglementDialogDetailController(){
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("/Views/Reglement/ReglementDialogDetail.fxml"));
|
||||
fxmlLoader.setController(this);
|
||||
nodeFxml = (Node) fxmlLoader.load();
|
||||
} catch (IOException ex) {
|
||||
logger.error("ReglementDialogDetailController : constructeur :" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void ExitButtonAction(ActionEvent event) throws IOException {
|
||||
AnchorPrincipal.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Show()
|
||||
{
|
||||
StackPane Sp = new StackPane();
|
||||
|
||||
Scene scene = new Scene(Sp);
|
||||
|
||||
Sp.setPrefSize((double)MyWindow.PrincipalContentWidth, (double)MyWindow.PrincipalContentHeight);
|
||||
|
||||
Sp.getChildren().add(MyWindow.myParent);
|
||||
Sp.getChildren().add(nodeFxml);
|
||||
|
||||
Stage stage = MyWindow.myStage;
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package Controllers.Reglement;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher Ben Tili
|
||||
*/
|
||||
public class TraiteFrsPrintController implements Initializable {
|
||||
|
||||
@FXML private Text TextCompanyName;
|
||||
@FXML private Text TextCompanyPlace;
|
||||
@FXML private Text TextCompanyAddress;
|
||||
@FXML private Text TextBank;
|
||||
@FXML private Text TextRIP;
|
||||
@FXML private Text TextRIB;
|
||||
@FXML private Text TextAmountLetter;
|
||||
@FXML private Text TextAmountFigures;
|
||||
@FXML private Text TextDateDeadline;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package Controllers.Stock;
|
||||
|
||||
import Controllers.Traitement.Adaptateur;
|
||||
import Models.User.User;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.fxml.Initializable;
|
||||
import javafx.scene.control.TableColumn;
|
||||
import javafx.scene.control.TableView;
|
||||
import javafx.scene.control.cell.PropertyValueFactory;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
/**
|
||||
* FXML Controller class
|
||||
* @author Maher
|
||||
*/
|
||||
public class BondeEnterPrintController implements Initializable {
|
||||
|
||||
@FXML private Text TextLocale;
|
||||
@FXML private Text TextCode;
|
||||
@FXML private Text TextTitreBon; //Bon d'entrée pour | Bon de sortie à
|
||||
@FXML private Text TextTypeSource; //Emetteur | Récepteur
|
||||
@FXML private Text TextValSource;
|
||||
|
||||
@FXML private Text TextDate;
|
||||
@FXML private Text TextUser;
|
||||
@FXML private Text TextTransporteur;
|
||||
@FXML private Text TextPagination;
|
||||
|
||||
@FXML private TableView<ListProduitBon> TableViewProduit ;
|
||||
@FXML private TableColumn<ListProduitBon, String> TabColReference;
|
||||
@FXML private TableColumn<ListProduitBon, String> TabColDesignation;
|
||||
@FXML private TableColumn<ListProduitBon ,String> TabColTVA;
|
||||
@FXML private TableColumn<ListProduitBon ,String> TabColTotalTTC;
|
||||
@FXML private TableColumn<ListProduitBon, String> TabColQuantite;
|
||||
|
||||
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
@Override
|
||||
public void initialize(URL url, ResourceBundle rb) {
|
||||
TabColReference.setCellValueFactory(new PropertyValueFactory<ListProduitBon, String>("reference"));
|
||||
TabColDesignation.setCellValueFactory(new PropertyValueFactory<ListProduitBon, String>("designaton"));
|
||||
TabColTVA.setCellValueFactory(new PropertyValueFactory<ListProduitBon, String>("tva"));
|
||||
TabColTVA.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTVA.getStyleClass().add("Center");
|
||||
TabColTotalTTC.setCellValueFactory(new PropertyValueFactory<ListProduitBon, String>("prixttc"));
|
||||
TabColTotalTTC.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColTotalTTC.getStyleClass().add("Center");
|
||||
TabColQuantite.setCellValueFactory(new PropertyValueFactory<ListProduitBon, String>("quantite"));
|
||||
TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;");
|
||||
TabColQuantite.getStyleClass().add("Center");
|
||||
}
|
||||
|
||||
public void setDataBonEnter(ObservableList<ListProduitBon> listProduits, String TitreBon, String Local, String TypeSource, String ValSource, String Code, String Date, String Heur, String Transporteur, String Pagination){
|
||||
|
||||
TableViewProduit.setItems(null);
|
||||
TableViewProduit.setItems(listProduits);
|
||||
|
||||
TextTitreBon.setText(TitreBon);
|
||||
|
||||
TextLocale.setText(Local);
|
||||
TextCode.setText(Code);
|
||||
TextTypeSource.setText(TypeSource);
|
||||
TextValSource.setText(ValSource);
|
||||
|
||||
TextDate.setText(Adaptateur.NormalDateFormat(Date)+" "+Heur);
|
||||
TextUser.setText(User.nom+" "+User.prenom);
|
||||
TextTransporteur.setText(Transporteur);
|
||||
TextPagination.setText(Pagination);
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user