210 lines
10 KiB
Java
210 lines
10 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.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 PC-Maher
|
|
*/
|
|
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);
|
|
}
|
|
|
|
}
|