/* * 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 TableViewListeProduitPassCommClt ; @FXML public TableColumn TabColReference; @FXML public TableColumn TabColDesignaton; @FXML public TableColumn TabColQuantite ; @FXML public TableColumn TabColPrixHT; @FXML public TableColumn TabColRemise; @FXML public TableColumn TabColTotalHT; @FXML public TableColumn TabColTVA; @FXML public TableColumn TabColTotalTTC; @Override public void initialize(URL url, ResourceBundle rb) { TabColReference.setCellValueFactory(new PropertyValueFactory("reference")); TabColDesignaton.setCellValueFactory(new PropertyValueFactory("designation")); TabColQuantite.setCellValueFactory(new PropertyValueFactory("quantite")); TabColQuantite.setStyle( "-fx-alignment: CENTER; -fx-font-weight:bold; -fx-font-size: 10pt;"); TabColQuantite.getStyleClass().add("Center"); TabColPrixHT.setCellValueFactory(new PropertyValueFactory("PrixHT")); TabColPrixHT.setStyle( "-fx-alignment: CENTER;"); TabColPrixHT.getStyleClass().add("Center"); TabColRemise.setCellValueFactory(new PropertyValueFactory("Remise")); TabColRemise.setStyle( "-fx-alignment: CENTER;"); TabColRemise.getStyleClass().add("Center"); TabColTotalHT.setCellValueFactory(new PropertyValueFactory("TotalHT")); TabColTotalHT.setStyle( "-fx-alignment: CENTER;"); TabColTotalHT.getStyleClass().add("Center"); TabColTVA.setCellValueFactory(new PropertyValueFactory("TVA")); TabColTVA.setStyle( "-fx-alignment: CENTER;"); TabColTVA.getStyleClass().add("Center"); TabColTotalTTC.setCellValueFactory(new PropertyValueFactory("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); } }