Files
PowerPME_maven/src/main/java/Controllers/FactureClt/FactureCltDialogConfirmationController.java
T
2026-05-16 17:34:53 +02:00

187 lines
7.2 KiB
Java

/*
* 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.CommandeClt.*;
import Models.Produit.ListeProduit;
import Controllers.Traitement.MyWindow;
import Models.CommandeClt.CommandeClt;
import Models.FactureClt.FactureClt;
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 FactureCltDialogConfirmationController 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 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.getLogger(FactureCltDialogConfirmationController.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);
}
}