185 lines
8.7 KiB
Java
185 lines
8.7 KiB
Java
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);
|
|
}
|
|
}
|
|
|
|
} |