first commit
This commit is contained in:
@@ -0,0 +1,196 @@
|
||||
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 java.util.logging.Level;
|
||||
import java.util.logging.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 {
|
||||
|
||||
@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.getLogger(CommandeCltDetail.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
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,203 @@
|
||||
/*
|
||||
* 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.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 java.util.logging.Level;
|
||||
import java.util.logging.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 PC-Maher
|
||||
*/
|
||||
public class CommandeCltDialogConfirmationController implements Initializable {
|
||||
/**
|
||||
* Initializes the controller class.
|
||||
*/
|
||||
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 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.getLogger(CommandeCltDialogConfirmationController.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
|
||||
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.CommandeClt;
|
||||
import Models.CommandeClt.CommandeCltDB;
|
||||
import Models.CommandeClt.CommandeCltListe;
|
||||
import com.gluonhq.charm.glisten.control.ProgressBar;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.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 CommandeCltGestionController implements Initializable {
|
||||
|
||||
@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();
|
||||
}
|
||||
});
|
||||
|
||||
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.getLogger(DevisCltGestionController.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//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));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user