diff --git a/src/components/Partner_Facture.js b/src/components/Partner_Facture.js
index 392ddbe..af35271 100644
--- a/src/components/Partner_Facture.js
+++ b/src/components/Partner_Facture.js
@@ -48,6 +48,9 @@ const Partner_Facture = (props) => {
const [rowss, setRows] = useState([]);
const [selectionModel, setSelectionModel] = React.useState([]);
+ const [rows_invoice_lines, setrows_invoice_lines] = useState([]);
+ const [selectionModel_invoice_lines, setselectionModel_invoice_lines] = React.useState([]);
+
var date_today_90j = new Date();
date_today_90j.setDate(date_today_90j.getDate() + 90);
@@ -65,32 +68,21 @@ const Partner_Facture = (props) => {
const columns = [
{ field: '_id', headerName: '_id', hide: true },
{ field: 'id', headerName: 'id', hide: true },
- { field: 'order_header_ref_interne', headerName: 'Reference', width: 100, hide: false, editable: false },
- { field: 'order_header_type', headerName: 'Type', width: 100, hide: false, editable: false },
- {
- field: 'order_header_status', headerName: 'Statut', width: 100, hide: false, editable: false,
- valueFormatter: (params) => {
- if (String(params.value) === "-1")
- return "Annulé";
- else if (String(params.value) === "0")
- return "Brouillon";
- else if (String(params.value) === "1")
- return "En cours";
- else if (String(params.value) === "2")
- return "Traité";
- else if (String(params.value) === "3")
- return "Facturé";
- else
- return "?";
+ { field: 'invoice_header_ref_interne', headerName: 'Num Facture', width: 100, hide: false, editable: false },
+ { field: 'order_header_ref_interne', headerName: 'Reference Cmd', width: 100, hide: false, editable: false },
+ { field: 'invoice_header_type', headerName: 'Type', width: 100, hide: false, editable: false },
+ { field: 'invoice_date', headerName: 'Date Facture', width: 150, hide: false, editable: false },
- },
- },
{ field: 'order_header_client_id', headerName: 'Client_Id', width: 150, hide: true, editable: false },
{ field: 'order_header_client_nom', headerName: 'Nom Client', width: 150, hideable: false, flex: 1 },
{ field: 'order_header_vendeur_id', headerName: 'Vendeur Id', width: 150, hide: true, editable: false },
{ field: 'order_header_vendeur_nom_prenom', headerName: 'Vendeur', width: 150, hideable: false, flex: 1, editable: false },
- { field: 'order_header_date_cmd', headerName: 'Date', width: 150, hide: false, editable: false },
- { field: 'order_header_date_expiration', headerName: 'Date Expiration', width: 150, hide: false, editable: false },
+ { field: 'order_header_date_cmd', headerName: 'Date Cmd', width: 150, hide: true, editable: false },
+ { field: 'total_header_hors_taxe_after_header_reduction', headerName: 'Montant HT', width: 150, hide: false, editable: false },
+ { field: 'order_header_tax_amount', headerName: 'Taxe', width: 150, hide: false, editable: false },
+ { field: 'total_header_toutes_taxes', headerName: 'Montant TTC', width: 150, hide: false, editable: false },
+
+
/* {
@@ -175,8 +167,354 @@ const Partner_Facture = (props) => {
]
+ const columns_invoice_lines = [
+ { field: '_id', headerName: '_id', hide: true, editable: false },
+ { field: 'id', headerName: 'id', hide: true, editable: false },
+ { field: 'order_line_formation', headerName: 'intenal_url', width: 0, hide: true, editable: false },
+ { field: 'order_line_formation_title', headerName: 'Titre', width: 250, hide: false, editable: false, flex: 1 },
+ { field: 'order_line_formation_external_code', headerName: 'Code Formation', width: 150, hide: false, editable: false },
+ { field: 'order_line_formation_duration', headerName: 'Durée', width: 80, hide: false, editable: false },
+
+ { field: 'order_line_qty', headerName: 'Qte', width: 100, hide: false, editable: false },
+ { field: 'order_line_prix_unitaire', headerName: 'Prix Unit.', width: 100, hide: false, editable: false },
+ { field: 'order_header_id', headerName: 'Id_Entete', hide: true, editable: false },
+ { field: 'order_header_ref_interne', headerName: 'Ref_Interne', hide: true, editable: false },
+ { field: 'order_line_type', headerName: 'Type', width: 100, hide: false, editable: false },
+
+ {
+ field: "Detail", headerName: 'Voir detail',
+ renderCell: (cellValues) => {
+ return (
+
+
+
+ );
+ }
+ },
+ {
+ field: "delete", headerName: 'Supprimer',
+ renderCell: (cellValues) => {
+ return (
+
+ {
+ // handleClick_delete(event, cellValues);
+ }}
+ >
+
+
+ }
+ modal
+ nested
+ position="center center"
+ >
+ {close => (
+
+
+
MySy Information
+
+ {' '}
+
+ En confirmant cette opération, la ligne sera définitivement supprimée.
+
+
+
+
+
+
+
+
+
+
+
+
+ )}
+
+
+
+ );
+ }
+ },
+ { field: 'order_line_comment', headerName: 'Commentaire', width: 150, hide: true, editable: false, },
+
+ ]
+
+
+ const [selected_invoice_line_id, setselected_invoice_line_id] = useState();
+ const [p_add_line_item, setp_add_line_item] = useState();
+ const [p_add_line_item_internal_url, setp_add_line_item_internal_url] = useState();
+ const [p_add_line_item_title, setp_add_line_item_title] = useState();
+ const [p_add_line_item_qty, setp_add_line_item_qty] = useState();
+ const [p_add_line_item_price, setp_add_line_item_price] = useState();
+ const [p_add_line_item_comment, setp_add_line_item_comment] = useState();
+ const [p_add_line_item_status, setp_add_line_item_status] = useState();
+ const [p_add_line_item_type, setp_add_line_item_type] = useState();
+
+ const [p_add_line_item_type_reduction, setp_add_line_item_type_reduction] = useState("fixe");
+ const [p_add_line_item_reduction_value, setp_add_line_item_reduction_value] = useState();
+ const [p_add_line_item_reduction_total_amount, setp_add_line_item_reduction_total_amount] = useState();
+ const [p_add_line_item_total_amount_ht, setp_add_line_item_total_amount_ht] = useState();
+ const [p_add_line_item_taxe, setp_add_line_item_taxe] = useState();
+ const [p_add_line_item_taxe_amount, setp_add_line_item_taxe_amount] = useState();
+ const [p_add_line_item_total_amount_ttc, setp_add_line_item_total_amount_ttc] = useState();
+ const [p_add_line_item_duration_concat, setp_add_line_item_duration_concat] = useState();
+
+
+
+ function Display_Detail_Invoice_Line(event, cellValues) {
+
+ var invoice_line_id = String(cellValues.row._id);
+
+ var order_line_formation = String(cellValues.row.order_line_formation);
+ var order_line_qty = String(cellValues.row.order_line_qty);
+ var order_line_prix_unitaire = String(cellValues.row.order_line_prix_unitaire);
+
+ setselected_invoice_line_id(invoice_line_id);
+
+ setp_add_line_item(order_line_formation);
+ setp_add_line_item_qty(order_line_qty);
+ setp_add_line_item_price(order_line_prix_unitaire);
+ setp_add_line_item_status(String(cellValues.row.order_line_status));
+ setp_add_line_item_type(String(cellValues.row.order_line_type));
+ setp_add_line_item_comment(String(cellValues.row.order_line_comment));
+
+
+ Get_Given_Line_Of_Partner_Invoice_Line_Data(invoice_line_id, invoice_internal_ref);
+
+
+
+ //setDialog_Detail_Article_open(true);
+ //alert(" afficher le detail de la ligne " + String(order_line_id));
+
+ }
+
+ const [Get_Given_Line_Of_Partner_Invoice_Line_Data_api, setGet_Given_Line_Of_Partner_Invoice_Line_Data_api] = useState();
+ const [Get_Given_Line_Of_Partner_Invoice_Line_Data_message, setGet_Given_Line_Of_Partner_Invoice_Line_Data_message] = useState();
+ const [Get_Given_Line_Of_Partner_Invoice_Line_Data_result, setGet_Given_Line_Of_Partner_Invoice_Line_Data_result] = useState();
+ function Get_Given_Line_Of_Partner_Invoice_Line_Data(local_invoice_line_id, local_invoice_header_ref_interne) {
+
+ var form = new FormData();
+
+ const stored_cookie = getCookie('tokenmysypart');
+ form.append("token", stored_cookie);
+ form.append("invoice_line_id", local_invoice_line_id);
+ form.append("invoice_header_ref_interne", local_invoice_header_ref_interne);
+
+
+ var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Line_Of_Partner_Invoice_Lines/";
+
+ axios.post(myurl, form).then(res => {
+
+ if (String(res.data.status) === "true") {
+ //console.log(" In Get_Given_Line_Of_Partner_Invoice_Line_Data res.data.status = " + res.data.status);
+ //console.log(" In Get_Given_Line_Of_Partner_Invoice_Line_Data res.data.message r_class = " + res.data.message);
+ setGet_Given_Line_Of_Partner_Invoice_Line_Data_api("true");
+ setGet_Given_Line_Of_Partner_Invoice_Line_Data_result(res.data.message);
+
+ if (res.data.message.length > 0) {
+ var mylocal_order = JSON.parse(res.data.message);
+
+
+ if (mylocal_order.order_line_formation) {
+ setp_add_line_item(mylocal_order.order_line_formation);
+ }
+
+
+ if (mylocal_order.order_line_qty) {
+ setp_add_line_item_qty(mylocal_order.order_line_qty);
+ }
+
+
+
+ if (mylocal_order.order_line_prix_unitaire) {
+ setp_add_line_item_price(mylocal_order.order_line_prix_unitaire);
+ }
+
+
+ /*if (mylocal_order.order_header_id) {
+ setp_detail_header_type_reduction(mylocal_order.order_header_id);
+ }
+
+
+ if (mylocal_order.order_header_ref_interne) {
+ setp_detail_header_type_reduction_valeur(mylocal_order.order_header_ref_interne);
+ }*/
+
+
+ if (mylocal_order.order_line_montant_reduction) {
+ setp_add_line_item_reduction_total_amount(mylocal_order.order_line_montant_reduction);
+ }
+
+
+
+ if (mylocal_order.order_line_montant_toutes_taxes) {
+ setp_add_line_item_total_amount_ttc(mylocal_order.order_line_montant_toutes_taxes);
+
+ }
+
+
+ if (mylocal_order.order_line_tax) {
+ setp_add_line_item_taxe(mylocal_order.order_line_tax);
+ }
+
+
+ if (mylocal_order.order_line_tax_amount) {
+ setp_add_line_item_taxe_amount(mylocal_order.order_line_tax_amount);
+ }
+
+
+ if (mylocal_order.order_line_type_reduction) {
+ setp_add_line_item_type_reduction(mylocal_order.order_line_type_reduction);
+ }
+
+
+ if (mylocal_order.order_line_type_valeur) {
+ setp_add_line_item_reduction_value(mylocal_order.order_line_type_valeur);
+ }
+
+
+ if (mylocal_order.order_line_type) {
+ setp_add_line_item_type(mylocal_order.order_line_type);
+ }
+
+
+ if (mylocal_order.order_line_status) {
+ setp_add_line_item_status(mylocal_order.order_line_status);
+ }
+
+
+ if (mylocal_order.order_line_comment) {
+ setp_add_line_item_comment(mylocal_order.order_line_comment);
+ }
+
+
+ if (mylocal_order.title) {
+ setp_add_line_item_title(mylocal_order.title);
+ }
+
+ if (mylocal_order.order_line_montant_hors_taxes) {
+ setp_add_line_item_total_amount_ht(mylocal_order.order_line_montant_hors_taxes);
+
+ }
+
+
+ /*if (mylocal_order.domaine) {
+ setp_detail_header_montant_reduction(mylocal_order.domaine);
+ }*/
+
+
+ if (mylocal_order.duration_concat) {
+ setp_add_line_item_duration_concat(mylocal_order.duration_concat);
+ }
+
+
+ ;
+
+ } else {
+ alert(" Aucune ligne de facture recuperée");
+ }
+
+
+ } else if (String(res.data.status) === String("Err_Connexion")) {
+ alert('Erreur: ' + res.data.message);
+ history.push("/Connexion");
+ }
+
+ else {
+ setGet_Given_Line_Of_Partner_Invoice_Line_Data_api("false");
+ setGet_Given_Line_Of_Partner_Invoice_Line_Data_message(res.data.message);
+ alert(res.data.message);
+ }
+
+ }).catch((error) => {
+ console.warn('Not good man :( Get_Given_Line_Of_Partner_Invoice_Line_Data = ', error);
+ setGet_Given_Line_Of_Partner_Invoice_Line_Data_api("false");
+ alert(" Impossible de recuperer les données de la ligne de facture");
+ //setmyApimyApiMessage("")
+ })
+ }
+
+
const [isLoading, setLoading] = useState();
+ const [p_detail_header_client_nom, setp_detail_header_client_nom] = useState();
+ const [p_detail_header_client_nom_id, setp_detail_header_client_nom_id] = useState();
+
+ const [p_detail_header_description, setp_detail_header_description] = useState();
+ const [p_detail_header_comment, setp_detail_header_comment] = useState();
+ const [p_detail_header_date_cmd, setp_detail_header_date_cmd] = useState(new Date().toLocaleDateString('fr-FR'));
+ const [p_detail_header_date_expiration, setp_detail_header_date_expiration] = useState(date_today_90j.toLocaleDateString('fr-FR'));
+ const [p_detail_header_condition_paiement, setp_detail_header_condition_paiement] = useState();
+ const [p_detail_header_ref_client, setp_detail_header_ref_client] = useState();
+ const [p_detail_header_ref_interne, setp_detail_header_ref_interne] = useState();
+
+ const [p_detail_header_vendeur_nom, setp_detail_header_vendeur_nom] = useState();
+ const [p_detail_header_vendeur_nom_id, setp_detail_header_vendeur_nom_id] = useState();
+
+
+ const [p_detail_header_invoice_header_ref_interne, setp_detail_header_invoice_header_ref_interne] = useState();
+ const [p_detail_header_invoice_header_type, setp_detail_header_invoice_header_type] = useState();
+ const [p_detail_header_invoice_date, setp_detail_header_invoice_date] = useState();
+
+
+ const [p_detail_header_type, setp_detail_header_type] = useState();
+ const [p_detail_header_statut, setp_detail_header_statut] = useState();
+ const [p_detail_header_vendeur_id, setp_detail_header_vendeur_id] = useState();
+ const [p_detail_header_client_id, setp_detail_header_client_id] = useState();
+ const [p_detail_header_statut_label, setp_detail_header_statut_label] = useState();
+
+ const [p_detail_header_date_cmd_val, setp_detail_header_date_cmd_val] = useState(new Date().toLocaleDateString('fr-FR'));
+ const [p_detail_header_date_expiration_val, setp_detail_header_date_expiration_val] = useState(date_today_90j.toLocaleDateString('fr-FR'));
+ const [p_detail_header_fact_adr, setp_detail_header_fact_adr] = useState();
+ const [p_detail_header_fact_code_postal, setp_detail_header_fact_code_postal] = useState();
+ const [p_detail_header_fact_ville, setp_detail_header_fact_ville] = useState();
+ const [p_detail_header_fact_pays, setp_detail_header_fact_pays] = useState();
+
+
+ const [p_detail_header_liv_adr, setp_detail_header_liv_adr] = useState();
+ const [p_detail_header_liv_code_postal, setp_detail_header_liv_code_postal] = useState();
+ const [p_detail_header_liv_ville, sep_detail_header_liv_ville] = useState();
+ const [p_detail_header_liv_pays, setp_detail_header_liv_pays] = useState();
+ const [p_detail_header_total_ht, setp_detail_header_total_ht] = useState();
+ const [p_detail_header_total_tax, setp_detail_header_total_tax] = useState();
+ const [p_detail_header_total_ttc, setp_detail_header_total_ttc] = useState();
+ const [p_detail_header_type_reduction, setp_detail_header_type_reduction] = useState();
+ const [p_detail_header_total_reduction_amount, setp_detail_header_total_reduction_amount] = useState();
+ const [p_detail_header_type_reduction_valeur, setp_detail_header_type_reduction_valeur] = useState();
+ const [p_detail_header_montant_reduction, setp_detail_header_montant_reduction] = useState();
+ const [p_detail_total_header_hors_taxe_before_header_reduction, setp_detail_total_header_hors_taxe_before_header_reduction] = useState();
+ const [p_detail_total_header_hors_taxe_after_header_reduction, setp_detail_total_header_hors_taxe_after_header_reduction] = useState();
+ const [p_detail_order_header_tax_amount, setp_detail_order_header_tax_amount] = useState();
+ const [p_detail_total_header_toutes_taxes, setp_detail_total_header_toutes_taxes] = useState();
+
+
+
+ const [p_detail_total_lines_hors_taxe_before_lines_reduction, setp_detail_total_lines_hors_taxe_before_lines_reduction] = useState();
+ const [p_detail_total_lines_hors_taxe_after_lines_reduction, setp_detail_total_lines_hors_taxe_after_lines_reduction] = useState();
const [Get_List_Partner_Clients_api, setGet_List_Partner_Clients_api] = useState();
const [Get_List_Partner_Clients_message, setGet_List_Partner_Clients_message] = useState();
@@ -254,7 +592,7 @@ const Partner_Facture = (props) => {
})
}
- const myRef_head = useRef(null);
+ const myRef = useRef(null);
useEffect(() => {
@@ -265,6 +603,754 @@ const Partner_Facture = (props) => {
myRef_head.current.scrollIntoView({ behavior: "smooth" });
}, [])
+ const [display_detail_invoice, setdisplay_detail_invoice] = React.useState();
+
+ const myRef_head = useRef(null);
+ const [selected_id, setselected_id] = useState("");
+ const [selected_order_line_id, setselected_order_line_id] = useState("");
+ const [selected_order_header_type, setselected_order_header_type] = useState();
+
+ const [order_internal_ref, setorder_internal_ref] = useState("");
+ const [invoice_internal_ref, setinvoice_internal_ref] = useState("");
+
+ function handleClick_edit_invoice_From_Line(selected_row_id) {
+
+ //submenu_detail_employe();
+
+ var line = JSON.parse(rowss[selected_row_id]);
+
+ //console.log("### line = ", line);
+ var invoice_id = line._id;
+ setselected_id(invoice_id);
+
+ var order_ref = line.order_header_ref_interne;
+ setorder_internal_ref(order_ref);
+
+ var invoice_ref = line.invoice_header_ref_interne;
+ setinvoice_internal_ref(invoice_ref);
+
+
+ //console.log(" ### employe_id = ", employe_id);
+ Display_Detail_Invoice_data(invoice_id);
+
+
+
+ if (myRef) {
+ myRef.current.scrollIntoView({ behavior: "smooth" });
+ }
+
+ }
+
+
+ function Display_Detail_Invoice_data(invoice_id) {
+ //clearDetailAttendeFields();
+
+ setdisplay_detail_invoice("1");
+
+
+ setLoading(true);
+ Get_Invoice_Data(invoice_id);
+ Get_Partner_Invoice_Lines_from_header_id(invoice_id);
+
+ }
+
+
+ const [GetAttendee_api, setGetAttendee_api] = useState();
+ const [GetAttendee_message, setGetAttendee_message] = useState();
+ const [GetAttendee_result, setGetAttendee_result] = useState();
+ function Get_Invoice_Data(invoice_id) {
+
+
+ var form = new FormData();
+
+ const stored_cookie = getCookie('tokenmysypart');
+ form.append("token", stored_cookie);
+ form.append("_id", invoice_id);
+
+
+ var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Partner_Invoice/";
+
+ setLoading(true);
+
+ axios.post(myurl, form).then(res => {
+
+ if (String(res.data.status) === "true") {
+ setLoading(false);
+ //console.log(" In Get_Invoice_Data res.data.status = " + res.data.status);
+ //console.log(" In Get_Invoice_Data res.data.message r_class = " + res.data.message);
+ setGetAttendee_api("true");
+ setGetAttendee_result(res.data.message);
+
+ if (res.data.message.length > 0) {
+ var mylocal_order = JSON.parse(res.data.message);
+
+
+ if (mylocal_order.invoice_header_ref_interne)
+ setp_detail_header_invoice_header_ref_interne(mylocal_order.invoice_header_ref_interne);
+
+
+ if (mylocal_order.invoice_header_type)
+ setp_detail_header_invoice_header_type(mylocal_order.invoice_header_type);
+
+
+ if (mylocal_order.invoice_date)
+ setp_detail_header_invoice_date(mylocal_order.invoice_date);
+
+
+
+ //document.getElementsByName("detail_header_type")[0].value = "";
+ if (mylocal_order.order_header_type)
+ setp_detail_header_type(mylocal_order.order_header_type);
+
+
+
+ //document.getElementsByName("detail_header_ref_interne")[0].value = "";
+ if (mylocal_order.order_header_ref_interne) {
+ setp_detail_header_ref_interne(mylocal_order.order_header_ref_interne);
+ }
+
+ //document.getElementsByName("detail_header_ref_cient")[0].value = "";
+ if (mylocal_order.order_header_ref_client) {
+ setp_detail_header_ref_interne(mylocal_order.order_header_ref_client);
+ }
+
+
+ //document.getElementsByName("detail_header_date_cmd")[0].value = "";
+ if (mylocal_order.order_header_date_cmd) {
+ setp_detail_header_date_cmd(mylocal_order.order_header_date_cmd);
+ setp_detail_header_date_cmd_val(mylocal_order.order_header_date_cmd);
+ }
+
+ //document.getElementsByName("detail_header_date_expiration")[0].value = "";
+ if (mylocal_order.order_header_date_expiration) {
+ setp_detail_header_date_expiration(mylocal_order.order_header_date_expiration);
+ setp_detail_header_date_expiration_val(mylocal_order.order_header_date_cmd);
+ }
+
+
+ //document.getElementsByName("detail_nom_client")[0].value = "";
+ if (mylocal_order.order_header_client_nom) {
+ setp_detail_header_client_nom(mylocal_order.order_header_client_nom);
+ setp_detail_header_client_nom_id(mylocal_order.order_header_client_id);
+ }
+
+
+ //document.getElementsByName("detail_header_description")[0].value = "";
+ if (mylocal_order.order_header_description) {
+ setp_detail_header_description(mylocal_order.order_header_description);
+ }
+
+ //document.getElementsByName("detail_header_comment")[0].value = "";
+ if (mylocal_order.order_header_comment) {
+ setp_detail_header_comment(mylocal_order.order_header_comment);
+ }
+
+
+ // document.getElementsByName("detail_header_vendeur_nom_prenom")[0].value = "";
+ if (mylocal_order.order_header_vendeur_nom_prenom) {
+ setp_detail_header_vendeur_nom(mylocal_order.order_header_vendeur_nom_prenom);
+ setp_detail_header_vendeur_nom_id(mylocal_order.order_header_vendeur_id);
+ }
+
+
+ // Recuperation des adresses (livraison / lieu execution - Facturation )
+ //document.getElementsByName("detail_header_fact_adresse")[0].value = "";
+ if (mylocal_order.order_header_adr_fact_adresse) {
+ setp_detail_header_fact_adr(mylocal_order.order_header_adr_fact_adresse);
+ }
+
+ //document.getElementsByName("detail_header_fact_code_postal")[0].value = "";
+ if (mylocal_order.order_header_adr_fact_code_postal) {
+ setp_detail_header_fact_code_postal(mylocal_order.order_header_adr_fact_code_postal);
+ }
+
+ //document.getElementsByName("detail_header_fact_ville")[0].value = "";
+ if (mylocal_order.order_header_adr_fact_ville) {
+ setp_detail_header_fact_ville(mylocal_order.order_header_adr_fact_ville);
+ }
+
+ //document.getElementsByName("detail_header_fact_pays")[0].value = "";
+ if (mylocal_order.order_header_adr_fact_pays) {
+ setp_detail_header_fact_pays(mylocal_order.order_header_adr_fact_pays);
+ }
+
+ //document.getElementsByName("detail_header_liv_adresse")[0].value = "";
+ if (mylocal_order.order_header_adr_liv_adresse) {
+ setp_detail_header_liv_adr(mylocal_order.order_header_adr_liv_adresse);
+ }
+
+ //document.getElementsByName("detail_header_liv_code_postal")[0].value = "";
+ if (mylocal_order.order_header_adr_liv_code_postal) {
+ setp_detail_header_liv_code_postal(mylocal_order.order_header_adr_liv_code_postal);
+ }
+
+ //document.getElementsByName("detail_header_liv_ville")[0].value = "";
+ if (mylocal_order.order_header_adr_liv_ville) {
+ sep_detail_header_liv_ville(mylocal_order.order_header_adr_liv_ville);
+ }
+
+ //document.getElementsByName("detail_header_liv_pays")[0].value = "";
+ if (mylocal_order.order_header_adr_liv_pays) {
+ setp_detail_header_liv_pays(mylocal_order.order_header_adr_liv_pays);
+ }
+
+
+ // Recuperation des montant, taxes et autres reductions
+ //document.getElementsByName("detail_header_total_ht")[0].value = "";
+ if (mylocal_order.order_header_total_ht) {
+ setp_detail_header_total_ht(mylocal_order.order_header_total_ht);
+ }
+
+ //document.getElementsByName("detail_header_total_tax")[0].value = "";
+ if (mylocal_order.order_header_tax_amount) {
+ setp_detail_header_total_tax(mylocal_order.order_header_tax_amount);
+ }
+
+
+ //document.getElementsByName("detail_header_total_ttc")[0].value = "";
+ if (mylocal_order.order_header_total_ttc) {
+ setp_detail_header_total_ttc(mylocal_order.order_header_total_ttc);
+ }
+
+ //document.getElementsByName("detail_header_type_reduction")[0].value = "";
+ if (mylocal_order.order_header_type_reduction) {
+ setp_detail_header_type_reduction(mylocal_order.order_header_type_reduction);
+ }
+
+ //document.getElementsByName("detail_header_type_reduction_valeur")[0].value = "";
+ if (mylocal_order.order_header_type_reduction_valeur) {
+ setp_detail_header_type_reduction_valeur(mylocal_order.order_header_type_reduction_valeur);
+ }
+
+
+ if (mylocal_order.order_header_montant_reduction) {
+ setp_detail_header_total_reduction_amount(mylocal_order.order_header_montant_reduction);
+ }
+
+
+ if (mylocal_order.total_lines_montant_reduction) {
+ setp_detail_header_montant_reduction(mylocal_order.total_lines_montant_reduction);
+ }
+
+ if (mylocal_order.total_header_hors_taxe_before_header_reduction) {
+ setp_detail_total_header_hors_taxe_before_header_reduction(mylocal_order.total_header_hors_taxe_before_header_reduction);
+ }
+
+ if (mylocal_order.total_header_hors_taxe_after_header_reduction) {
+ setp_detail_total_header_hors_taxe_after_header_reduction(mylocal_order.total_header_hors_taxe_after_header_reduction);
+ }
+
+ if (mylocal_order.order_header_tax_amount) {
+ setp_detail_order_header_tax_amount(mylocal_order.order_header_tax_amount);
+ }
+
+
+ if (mylocal_order.total_header_toutes_taxes) {
+ setp_detail_total_header_toutes_taxes(mylocal_order.total_header_toutes_taxes);
+ }
+
+ if (mylocal_order.total_lines_hors_taxe_before_lines_reduction) {
+ setp_detail_total_lines_hors_taxe_before_lines_reduction(mylocal_order.total_lines_hors_taxe_before_lines_reduction);
+ }
+
+ if (mylocal_order.total_lines_hors_taxe_after_lines_reduction) {
+ setp_detail_total_lines_hors_taxe_after_lines_reduction(mylocal_order.total_lines_hors_taxe_after_lines_reduction);
+ }
+
+
+
+ disable_Order_Header_DetailFields();
+ //order_header_submenu_main();
+
+ } else {
+ alert(" Aucune commande/devis recuperé");
+ }
+
+
+ } else if (String(res.data.status) === String("Err_Connexion")) {
+ setLoading(false);
+ alert('Erreur: ' + res.data.message);
+ history.push("/Connexion");
+ }
+
+ else {
+ setLoading(false);
+ setGetAttendee_api("false");
+ setGetAttendee_message(res.data.message);
+ alert(res.data.message);
+ }
+
+ }).catch((error) => {
+ setLoading(false);
+ console.warn('Not good man :( Get_Invoice_Data = ', error);
+ setGetAttendee_api("false");
+ alert(" Impossible de recuperer les données de la facture");
+ //setmyApimyApiMessage("")
+ })
+ }
+
+ const [header_submenu, setheader_submenu] = useState("");
+ async function order_header_submenu_main() {
+ setheader_submenu("main");
+
+ await sleep(5);
+
+ if (document.getElementById("order_header_main")) {
+ document.getElementById("order_header_main").style.backgroundColor = "#104277";
+ document.getElementById("order_header_main").style.color = "white";
+ }
+
+ if (document.getElementById("order_header_detail")) {
+ document.getElementById("order_header_detail").style.backgroundColor = "#d8edfc";
+ document.getElementById("order_header_detail").style.color = "black";
+ }
+
+ if (document.getElementById("order_header_facturation")) {
+ document.getElementById("order_header_facturation").style.backgroundColor = "#d8edfc";
+ document.getElementById("order_header_facturation").style.color = "black";
+ }
+
+
+ disable_Order_Header_DetailFields();
+
+ }
+
+ async function order_header_submenu_detail() {
+ setheader_submenu("detail");
+
+ await sleep(5);
+
+ if (document.getElementById("order_header_detail")) {
+ document.getElementById("order_header_detail").style.backgroundColor = "#104277";
+ document.getElementById("order_header_detail").style.color = "white";
+ }
+
+ if (document.getElementById("order_header_main")) {
+ document.getElementById("order_header_main").style.backgroundColor = "#d8edfc";
+ document.getElementById("order_header_main").style.color = "black";
+ }
+
+ if (document.getElementById("order_header_facturation")) {
+ document.getElementById("order_header_facturation").style.backgroundColor = "#d8edfc";
+ document.getElementById("order_header_facturation").style.color = "black";
+ }
+
+ disable_Order_Header_DetailFields();
+
+ }
+
+ async function order_header_submenu_facturation() {
+ setheader_submenu("facturation");
+
+ await sleep(5);
+
+ if (document.getElementById("order_header_facturation")) {
+ document.getElementById("order_header_facturation").style.backgroundColor = "#104277";
+ document.getElementById("order_header_facturation").style.color = "white";
+ }
+
+ if (document.getElementById("order_header_detail")) {
+ document.getElementById("order_header_detail").style.backgroundColor = "#d8edfc";
+ document.getElementById("order_header_detail").style.color = "black";
+ }
+
+ if (document.getElementById("order_header_main")) {
+ document.getElementById("order_header_main").style.backgroundColor = "#d8edfc";
+ document.getElementById("order_header_main").style.color = "black";
+ }
+
+
+ disable_Order_Header_DetailFields();
+
+ }
+
+ const sleep = (milliseconds) => {
+ return new Promise(resolve => setTimeout(resolve, milliseconds))
+ }
+
+
+ function print_invoice_pdf() {
+ const stored_cookie = getCookie('tokenmysypart');
+
+ var nom_fichier_cmd = "Facture_" + invoice_internal_ref + ".pdf";
+ console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id);
+
+ var url = process.env.REACT_APP_API_URL + "myclass/api/GerneratePDF_Partner_Invoice/" + stored_cookie + "/" + selected_id;
+
+ console.log(" nom_fichier_cmd = ", nom_fichier_cmd, " --- selected_id = ", selected_id, " --- url =", url);
+
+ axios.get(url, { responseType: 'blob', },)
+ .then((res) => {
+ fileDownload(res.data, nom_fichier_cmd)
+ }).catch((error) => {
+ console.error('Error:', error);
+
+ });
+ }
+
+
+ const [Send_Invoice_By_Email_api, setSend_Invoice_By_Email_api] = useState();
+ const [Send_Invoice_By_Email_message, setSend_Invoice_By_Email_message] = useState();
+ const [Send_Invoice_By_Email_result, setSend_Invoice_By_Email_result] = useState();
+ function Send_Invoice_By_Email() {
+ var form = new FormData();
+ //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA");
+
+
+ const stored_cookie = getCookie('tokenmysypart');
+ form.append("token", stored_cookie);
+ form.append("invoice_id", selected_id);
+
+
+ //console.log("### form = ", form);
+ var myurl = process.env.REACT_APP_API_URL + "myclass/api/Send_Partner_Invoice_By_Email/";
+
+
+ axios.post(myurl, form).then(res => {
+ //console.log(" In Add_Update_One_Order_Line_Data res.data.status = " + res.data.status);
+ //console.log(" In Add_Update_One_Order_Line_Data res.data.message r_class = " + res.data.message);
+
+ if (String(res.data.status) === String("true")) {
+ setSend_Invoice_By_Email_api("true");
+ setSend_Invoice_By_Email_message(res.data.message);
+ alert(res.data.message);
+ }
+ else {
+ setSend_Invoice_By_Email_api("false");
+ setSend_Invoice_By_Email_message(res.data.message);
+ alert(res.data.message);
+ }
+
+ }).catch((error) => {
+
+ console.warn('Send_Invoice_By_Email : Not good man :( Send_Invoice_By_Email = ' + error);
+ setSend_Invoice_By_Email_api("false");
+
+ alert(" Impossible d'envoyer la facture par email");
+
+
+ })
+
+
+ }
+
+
+
+ const [Get_Partner_Invoice_Lines_from_header_id_api, setGet_Partner_Invoice_Lines_from_header_id_api] = useState();
+ const [Get_Partner_Invoice_Lines_from_header_id_message, setGet_Partner_Invoice_Lines_from_header_id_message] = useState();
+ const [Get_Partner_Invoice_Lines_from_header_id_result, setGet_Partner_Invoice_Lines_from_header_id_result] = useState();
+ function Get_Partner_Invoice_Lines_from_header_id(local_invoice_header_id) {
+
+ var form = new FormData();
+
+
+ const stored_cookie = getCookie('tokenmysypart');
+ form.append("token", stored_cookie);
+ form.append("invoice_header_id", local_invoice_header_id);
+
+ var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Partner_Invoice_Lines/";
+ setLoading(true);
+ axios.post(myurl, form).then(res => {
+
+ if (String(res.data.status) === String("true")) {
+ setLoading(false);
+ //console.log(" In Get_Partner_Invoice_Lines_from_header_id res.data.status = " + res.data.status);
+ //console.log(" In Get_Partner_Invoice_Lines_from_header_id res.data.message r_class = " + res.data.message);
+ setGet_Partner_Invoice_Lines_from_header_id_api("true");
+ setGet_Partner_Invoice_Lines_from_header_id_result(res.data.message);
+ setrows_invoice_lines(res.data.message);
+ }
+ else {
+ setLoading(false);
+ setGet_Partner_Invoice_Lines_from_header_id_api("false");
+ setGet_Partner_Invoice_Lines_from_header_id_message(res.data.message);
+ alert(res.data.message);
+ }
+
+ }).catch((error) => {
+ setLoading(false);
+ console.warn('Not good man :( Get_Partner_Invoice_Lines_from_header_id = ', error);
+ setGet_Partner_Invoice_Lines_from_header_id_api("false");
+ alert(" Impossible de recuperer le detail de la facture");
+ //setmyApimyApiMessage("")
+ })
+ }
+
+
+ function Enable_Order_Header_DetailFields() {
+
+
+ if (document.getElementsByName("detail_header_type")[0]) {
+ document.getElementsByName("detail_header_type")[0].disabled = false;
+ document.getElementsByName("detail_header_type")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_status")[0]) {
+ document.getElementsByName("detail_header_status")[0].disabled = false;
+ document.getElementsByName("detail_header_status")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_ref_interne")[0]) {
+ document.getElementsByName("detail_header_ref_interne")[0].disabled = false;
+ document.getElementsByName("detail_header_ref_interne")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_date_cmd")[0]) {
+ document.getElementsByName("detail_header_date_cmd")[0].disabled = false;
+ document.getElementsByName("detail_header_date_cmd")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_date_expiration")[0]) {
+ document.getElementsByName("detail_header_date_expiration")[0].disabled = false;
+ document.getElementsByName("detail_header_date_expiration")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_nom_client")[0]) {
+ document.getElementsByName("detail_nom_client")[0].disabled = false;
+ document.getElementsByName("detail_nom_client")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_description")[0]) {
+ document.getElementsByName("detail_header_description")[0].disabled = false;
+ document.getElementsByName("detail_header_description")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_comment")[0]) {
+ document.getElementsByName("detail_header_comment")[0].disabled = false;
+ document.getElementsByName("detail_header_comment")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_vendeur_nom_prenom")[0]) {
+ document.getElementsByName("detail_header_vendeur_nom_prenom")[0].disabled = false;
+ document.getElementsByName("detail_header_vendeur_nom_prenom")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ //----
+ if (document.getElementsByName("detail_header_ref_cient")[0]) {
+ document.getElementsByName("detail_header_ref_cient")[0].disabled = false;
+ document.getElementsByName("detail_header_ref_cient")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_fact_adresse")[0]) {
+ document.getElementsByName("detail_header_fact_adresse")[0].disabled = false;
+ document.getElementsByName("detail_header_fact_adresse")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_fact_code_postal")[0]) {
+ document.getElementsByName("detail_header_fact_code_postal")[0].disabled = false;
+ document.getElementsByName("detail_header_fact_code_postal")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_fact_ville")[0]) {
+ document.getElementsByName("detail_header_fact_ville")[0].disabled = false;
+ document.getElementsByName("detail_header_fact_ville")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_fact_pays")[0]) {
+ document.getElementsByName("detail_header_fact_pays")[0].disabled = false;
+ document.getElementsByName("detail_header_fact_pays")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_liv_adresse")[0]) {
+ document.getElementsByName("detail_header_liv_adresse")[0].disabled = false;
+ document.getElementsByName("detail_header_liv_adresse")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_liv_code_postal")[0]) {
+ document.getElementsByName("detail_header_liv_code_postal")[0].disabled = false;
+ document.getElementsByName("detail_header_liv_code_postal")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_liv_ville")[0]) {
+ document.getElementsByName("detail_header_liv_ville")[0].disabled = false;
+ document.getElementsByName("detail_header_liv_ville")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_liv_pays")[0]) {
+ document.getElementsByName("detail_header_liv_pays")[0].disabled = false;
+ document.getElementsByName("detail_header_liv_pays")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_total_ht")[0]) {
+ document.getElementsByName("detail_header_total_ht")[0].disabled = false;
+ document.getElementsByName("detail_header_total_ht")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_total_tax")[0]) {
+ document.getElementsByName("detail_header_total_tax")[0].disabled = false;
+ document.getElementsByName("detail_header_total_tax")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_total_ttc")[0]) {
+ document.getElementsByName("detail_header_total_ttc")[0].disabled = false;
+ document.getElementsByName("detail_header_total_ttc")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+
+ if (document.getElementsByName("detail_header_type_reduction")[0]) {
+ document.getElementsByName("detail_header_type_reduction")[0].disabled = false;
+ document.getElementsByName("detail_header_type_reduction")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_type_reduction_valeur")[0]) {
+ document.getElementsByName("detail_header_type_reduction_valeur")[0].disabled = false;
+ document.getElementsByName("detail_header_type_reduction_valeur")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+ if (document.getElementsByName("detail_header_montant_reduction")[0]) {
+ document.getElementsByName("detail_header_montant_reduction")[0].disabled = false;
+ document.getElementsByName("detail_header_montant_reduction")[0].style.backgroundColor = "#FFFFFF";
+ }
+
+
+ }
+
+ function disable_Order_Header_DetailFields() {
+
+
+ if (document.getElementsByName("detail_header_num_facture")[0]) {
+ document.getElementsByName("detail_header_num_facture")[0].disabled = true;
+ document.getElementsByName("detail_header_num_facture")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_type_document")[0]) {
+ document.getElementsByName("detail_header_type_document")[0].disabled = true;
+ document.getElementsByName("detail_header_type_document")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_date_facture")[0]) {
+ document.getElementsByName("detail_header_date_facture")[0].disabled = true;
+ document.getElementsByName("detail_header_date_facture")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+
+ if (document.getElementsByName("detail_header_type")[0]) {
+ document.getElementsByName("detail_header_type")[0].disabled = true;
+ document.getElementsByName("detail_header_type")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_status")[0]) {
+ document.getElementsByName("detail_header_status")[0].disabled = true;
+ document.getElementsByName("detail_header_status")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_ref_interne")[0]) {
+ document.getElementsByName("detail_header_ref_interne")[0].disabled = true;
+ document.getElementsByName("detail_header_ref_interne")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_date_cmd")[0]) {
+ document.getElementsByName("detail_header_date_cmd")[0].disabled = true;
+ document.getElementsByName("detail_header_date_cmd")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_date_expiration")[0]) {
+ document.getElementsByName("detail_header_date_expiration")[0].disabled = true;
+ document.getElementsByName("detail_header_date_expiration")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_nom_client")[0]) {
+ document.getElementsByName("detail_nom_client")[0].disabled = true;
+ document.getElementsByName("detail_nom_client")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_description")[0]) {
+ document.getElementsByName("detail_header_description")[0].disabled = true;
+ document.getElementsByName("detail_header_description")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_comment")[0]) {
+ document.getElementsByName("detail_header_comment")[0].disabled = true;
+ document.getElementsByName("detail_header_comment")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_vendeur_nom_prenom")[0]) {
+ document.getElementsByName("detail_header_vendeur_nom_prenom")[0].disabled = true;
+ document.getElementsByName("detail_header_vendeur_nom_prenom")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ //---
+ if (document.getElementsByName("detail_header_ref_cient")[0]) {
+ document.getElementsByName("detail_header_ref_cient")[0].disabled = true;
+ document.getElementsByName("detail_header_ref_cient")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_fact_adresse")[0]) {
+ document.getElementsByName("detail_header_fact_adresse")[0].disabled = true;
+ document.getElementsByName("detail_header_fact_adresse")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_fact_code_postal")[0]) {
+ document.getElementsByName("detail_header_fact_code_postal")[0].disabled = true;
+ document.getElementsByName("detail_header_fact_code_postal")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_fact_ville")[0]) {
+ document.getElementsByName("detail_header_fact_ville")[0].disabled = true;
+ document.getElementsByName("detail_header_fact_ville")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_fact_pays")[0]) {
+ document.getElementsByName("detail_header_fact_pays")[0].disabled = true;
+ document.getElementsByName("detail_header_fact_pays")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_liv_adresse")[0]) {
+ document.getElementsByName("detail_header_liv_adresse")[0].disabled = true;
+ document.getElementsByName("detail_header_liv_adresse")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_liv_code_postal")[0]) {
+ document.getElementsByName("detail_header_liv_code_postal")[0].disabled = true;
+ document.getElementsByName("detail_header_liv_code_postal")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_liv_ville")[0]) {
+ document.getElementsByName("detail_header_liv_ville")[0].disabled = true;
+ document.getElementsByName("detail_header_liv_ville")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_liv_pays")[0]) {
+ document.getElementsByName("detail_header_liv_pays")[0].disabled = true;
+ document.getElementsByName("detail_header_liv_pays")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_total_ht")[0]) {
+ document.getElementsByName("detail_header_total_ht")[0].disabled = true;
+ document.getElementsByName("detail_header_total_ht")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_total_tax")[0]) {
+ document.getElementsByName("detail_header_total_tax")[0].disabled = true;
+ document.getElementsByName("detail_header_total_tax")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_total_ttc")[0]) {
+ document.getElementsByName("detail_header_total_ttc")[0].disabled = true;
+ document.getElementsByName("detail_header_total_ttc")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+
+ if (document.getElementsByName("detail_header_type_reduction")[0]) {
+ document.getElementsByName("detail_header_type_reduction")[0].disabled = true;
+ document.getElementsByName("detail_header_type_reduction")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_type_reduction_valeur")[0]) {
+ document.getElementsByName("detail_header_type_reduction_valeur")[0].disabled = true;
+ document.getElementsByName("detail_header_type_reduction_valeur")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+ if (document.getElementsByName("detail_header_montant_reduction")[0]) {
+ document.getElementsByName("detail_header_montant_reduction")[0].disabled = true;
+ document.getElementsByName("detail_header_montant_reduction")[0].style.backgroundColor = "#ECEFF1";
+ }
+
+
+ }
+
+
+
return (
@@ -573,15 +1659,15 @@ const Partner_Facture = (props) => {
checkboxSelection
onSelectionModelChange={(newSelectionModel) => {
setSelectionModel(newSelectionModel);
- /* if (newSelectionModel.length === 1)
- handleClick_edit_order_From_Line(newSelectionModel);
+ if (newSelectionModel.length === 1)
+ handleClick_edit_invoice_From_Line(newSelectionModel);
if (newSelectionModel.length !== 1) {
- clean_order_detail_fields();
- setsubmenu();
- setdisplay_detail_order();
-
+ //clean_order_detail_fields();
+ //setsubmenu();
+ setdisplay_detail_invoice();
- }*/
+
+ }
}}
selectionModel={selectionModel}
@@ -591,14 +1677,24 @@ const Partner_Facture = (props) => {
id: index,
_id: JSON.parse(item)._id,
order_header_ref_interne: JSON.parse(item).order_header_ref_interne,
- order_header_type: JSON.parse(item).order_header_type,
- order_header_status: JSON.parse(item).order_header_status,
+
+ invoice_header_ref_interne: JSON.parse(item).invoice_header_ref_interne,
+ invoice_header_type: JSON.parse(item).invoice_header_type,
+ order_header_date_expiration: JSON.parse(item).order_header_date_expiration,
+ invoice_date: JSON.parse(item).invoice_date,
+ total_header_hors_taxe_after_header_reduction: JSON.parse(item).total_header_hors_taxe_after_header_reduction,
+
+ order_header_tax_amount: JSON.parse(item).order_header_tax_amount,
+ total_header_toutes_taxes: JSON.parse(item).total_header_toutes_taxes,
+
+
order_header_client_id: JSON.parse(item).order_header_client_id,
order_header_client_nom: JSON.parse(item).order_header_client_nom,
order_header_vendeur_id: JSON.parse(item).order_header_vendeur_id,
order_header_vendeur_nom_prenom: JSON.parse(item).order_header_vendeur_nom_prenom,
order_header_date_cmd: JSON.parse(item).order_header_date_cmd,
- order_header_date_expiration: JSON.parse(item).order_header_date_expiration,
+
+
}
))}
@@ -660,6 +1756,672 @@ const Partner_Facture = (props) => {
+
+ {String(display_detail_invoice) === "1" &&
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {String(header_submenu) !== "detail" && String(header_submenu) !== "facturation" &&
+
+
Num Facture
+
+
+
+
Type Document
+
+
+
+
Date Facture
+
+
+
+
+
+
+
Ref. Commande
+
+
+
+
Date Commande
+
+
+
+
+
+
+
Nom Client
+
+
+
+
+
+
Commande Ref. Externe
+
+
+
+
Description
+
+
+
+
Commentaire
+
+
+
+
Vendeur
+
+
+
+
}
+
+
+
+ {String(header_submenu) === "detail" &&
+ {/*
+
+
+
+
*/}
+
+
+
+
+
Type de Reduction (entete)
+
+
+
+
+
+
Valeur reduction (entete)
+
+
+
+
Montant Reduction (entete)
+
+
+
+
+
+
Total Ligne HT avant reduction
+
+
+
+
Total Ligne Reduction
+
+
+
+
Total Ligne HT apres reduction
+
+
+
+
+
Total Ligne Taxes
+
+
+
+
Entete : Total reduction
+
+
+
+
+
+
Entete : Total HT avant reduction d'entete
+
+
+
+
Entete : Total HT apres reduction d'entete
+
+
+
+
}
+
+ {String(header_submenu) === "facturation" &&
+
+
Adresse Facturation
+
+
+
+
Code postal
+
+
+
+
Ville
+
+
+
+
Pays
+
+
+
+
+
+
Adresse Livraison
+
+
+
+
Code postal
+
+
+
+
Ville
+
+
+
+
Pays
+
+
+
+
+
}
+
+
+
+
+
+
+
+
+
+
+
+
+ ----
+
+
+
+
+
+
+
+ {
+ //setselectionModel_order_lines(newSelectionModel);
+ /*if (newSelectionModel.length === 1)
+ handleClick_edit_order_From_Line(newSelectionModel);
+ if (newSelectionModel.length !== 1) {
+ setsubmenu();
+ setdisplay_detail_order();
+ setadd_One_Order();
+ }*/
+ }}
+ selectionModel={selectionModel_invoice_lines}
+
+ localeText={frFR.components.MuiDataGrid.defaultProps.localeText}
+ rows={rows_invoice_lines.map((item, index) => (
+ {
+ id: index,
+ _id: JSON.parse(item)._id,
+ order_line_formation: JSON.parse(item).order_line_formation,
+ order_line_qty: JSON.parse(item).order_line_qty,
+ order_line_status: JSON.parse(item).order_line_status,
+ order_line_prix_unitaire: JSON.parse(item).order_line_prix_unitaire,
+ order_header_id: JSON.parse(item).order_header_id,
+ order_header_ref_interne: JSON.parse(item).order_header_ref_interne,
+ order_line_type: JSON.parse(item).order_line_type,
+ order_line_formation_title: JSON.parse(item).title,
+ order_line_formation_duration: JSON.parse(item).duration_concat,
+ order_line_comment: JSON.parse(item).order_line_comment,
+ order_line_formation_external_code: JSON.parse(item).order_line_formation_external_code,
+
+ }
+ ))}
+
+ columns={columns_invoice_lines}
+ pageSize={10}
+ className="datagridclass"
+
+ rowsPerPageOptions={[10]}
+ //disableSelectionOnClick
+ components={{
+ Toolbar: GridToolbar,
+ }}
+
+
+ />
+
+
+
+
+
+
+
+
}
+
)