diff --git a/src/components/Partner.js b/src/components/Partner.js index b3e37b3..0a1d6fb 100644 --- a/src/components/Partner.js +++ b/src/components/Partner.js @@ -1602,8 +1602,8 @@ const Partner = (props) => { {String(menu) !== "mes_cmd" && }> DEVIS & COMMANDES} {String(menu) === "mes_cmd" && }>DEVIS & COMMANDES } - {String(menu) !== "factures_client" && }> FACTURES } - {String(menu) === "factures_client" && }> FACTURES } + {String(menu) !== "factures_client" && }> FACTURES & AVOIRS } + {String(menu) === "factures_client" && }> FACTURES & AVOIRS } @@ -1667,7 +1667,7 @@ const Partner = (props) => { {String(menu) !== "dashbord_inscriptions" && }> INSCRIPTIONS } {String(menu) === "dashbord_inscriptions" && }> INSCRIPTIONS } - {String(menu) !== "dashbord_factures" && }> FACTURES } + {String(menu) !== "dashbord_factures" && }> FACTURES } {String(menu) === "dashbord_factures" && }> FACTURES } @@ -2294,7 +2294,7 @@ const Partner = (props) => {

- + {String(menu) !== "factures_client" &&
 
} {String(menu) === "factures_client" &&
 
}
diff --git a/src/components/Partner_Domaine_Categorie_Metier.js b/src/components/Partner_Domaine_Categorie_Metier.js index df08832..6d2d13c 100644 --- a/src/components/Partner_Domaine_Categorie_Metier.js +++ b/src/components/Partner_Domaine_Categorie_Metier.js @@ -1955,7 +1955,6 @@ const Partner_Domaine_Categorie_Metier = (props) => {
-
diff --git a/src/components/Partner_Facture.js b/src/components/Partner_Facture.js index 69e64c7..521952d 100644 --- a/src/components/Partner_Facture.js +++ b/src/components/Partner_Facture.js @@ -40,6 +40,9 @@ import DialogActions from '@mui/material/DialogActions'; import DialogContent from '@mui/material/DialogContent'; import DialogContentText from '@mui/material/DialogContentText'; import DialogTitle from '@mui/material/DialogTitle'; +import Link from '@mui/material/Link'; +import { PiDotsThree } from "react-icons/pi"; +import { gridClasses } from '@mui/x-data-grid'; const Partner_Facture = (props) => { @@ -65,6 +68,38 @@ const Partner_Facture = (props) => { const [p_filtre4, setp_filtre4] = useState(); const [p_filtre4_value, setp_filtre4_value] = useState(); + + function ExpandableCell_50({ value }) { + const [expanded, setExpanded] = React.useState(false); + + return ( + + ); + } + + + const columns = [ { field: '_id', headerName: '_id', hide: true }, { field: 'id', headerName: 'id', hide: true }, @@ -81,6 +116,8 @@ const Partner_Facture = (props) => { { 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 }, + { field: 'reste_to_paye', headerName: 'A payer', width: 150, hide: false, editable: false }, + { field: 'credit_note_ref', headerName: 'Ref. Avoir', width: 150, hide: true, editable: false }, @@ -265,6 +302,126 @@ const Partner_Facture = (props) => { ] + const columns_paiement = [ + { field: '_id', headerName: '_id', hide: true }, + { field: 'id', headerName: 'id', hide: true }, + { field: 'invoice_id', headerName: 'invoice_id', width: 0, hide: true, editable: false }, + { field: 'paiement_date', headerName: 'Date', minWidth: 200, flex: 1, renderCell: (params) => , }, + { field: 'paiement_ref', headerName: 'Réference', minWidth: 200, flex: 1, renderCell: (params) => , }, + { field: 'paiement_amount', headerName: 'Montant', minWidth: 200, flex: 1, renderCell: (params) => , }, + { field: 'paiement_mode', headerName: 'Mode', minWidth: 200, flex: 1, renderCell: (params) => , }, + + { + field: "delete", headerName: 'Supprimer', + renderCell: (cellValues) => { + return ( + + + + + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + + En confirmant cette opération, le paiement sera définitivement supprimé.
+ +
+
+
+ + +
+
+ +
+
+
+ )} +
+ + + ); + } + } + + ] + + const [handleClick_delete_Paiement_api, sethandleClick_delete_Paiement_api] = useState(); + const [handleClick_delete_Paiement_message, sethandleClick_delete_Paiement_message] = useState(); + const [handleClick_delete_Paiement_result, sethandleClick_delete_Paiement_result] = useState(); + function handleClick_delete_Paiement(event, cellValues) { + + var paiement_id = cellValues.row._id; + + var form = new FormData(); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("_id", paiement_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Delete_Given_Invoice_Paiement/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + + setLoading(false); + if (String(res.data.status) === String("true")) { + //console.log(" In handleClick_delete_Paiement res.data.status = " + res.data.status); + //console.log(" In handleClick_delete_Paiement res.data.message r_class = " + res.data.message); + sethandleClick_delete_Paiement_api("true"); + sethandleClick_delete_Paiement_result(res.data.message); + + Getall_Invoice_Paiement(); + Getall_Invoice_Paiement_Payed_Remain_Amounts(); + clear_Paiement_DetailFields() + + alert(res.data.message); + + } + else { + sethandleClick_delete_Paiement_api("false"); + sethandleClick_delete_Paiement_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( handleClick_delete_Paiement = ', error); + sethandleClick_delete_Paiement_api("false"); + alert(" Impossible de supprimer le paiement"); + //setmyApimyApiMessage("") + }) + } + + + const [selectionModel_paiement, setselectionModel_paiement] = React.useState([]); + + const [gridline_paiment_id, setgridline_paiment_id] = useState(""); const [selected_invoice_line_id, setselected_invoice_line_id] = useState(); const [p_add_line_item, setp_add_line_item] = useState(); @@ -287,6 +444,143 @@ const Partner_Facture = (props) => { + + const [New_Getall_Invoice_Paiement_result, setNew_Getall_Invoice_Paiement_result] = useState([]); + + const [Getall_Invoice_Paiement_api, setGetall_Invoice_Paiement_api] = useState(); + const [Getall_Invoice_Paiement_message, setGetall_Invoice_Paiement_message] = useState(); + const [Getall_Invoice_Paiement_result, setGetall_Invoice_Paiement_result] = useState(); + function Getall_Invoice_Paiement(event) { + + var form = new FormData(); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("invoice_id", selected_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Invoice_Liste_Payement/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + + setLoading(false); + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Invoice_Paiement res.data.status = " + res.data.status); + //console.log(" In Getall_Invoice_Paiement res.data.message r_class = " + res.data.message); + setGetall_Invoice_Paiement_api("true"); + setGetall_Invoice_Paiement_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + //--- + var localid = JSON.parse(x).id; + var local_id = JSON.parse(x)._id; + var local_paiement_ref = JSON.parse(x).paiement_ref; + var local_paiement_amount = JSON.parse(x).paiement_amount; + var local_paiement_mode = JSON.parse(x).paiement_mode; + var local_paiement_date = JSON.parse(x).paiement_date; + + + //--- + var node = { + "_id": local_id, + "id": localid, + "label": local_paiement_ref + " " + local_paiement_amount, + "paiement_amount": local_paiement_amount, + "paiement_mode": local_paiement_mode, + "paiement_date": local_paiement_date + }; + new_data2.push(node); + }); + + if (new_data2.length > 0) + setNew_Getall_Invoice_Paiement_result(new_data2); + + } + else { + setGetall_Invoice_Paiement_api("false"); + setGetall_Invoice_Paiement_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Getall_Invoice_Paiement = ', error); + setGetall_Invoice_Paiement_api("false"); + alert(" Impossible de recuperer la liste des paiements"); + //setmyApimyApiMessage("") + }) + } + + + const [New_Getall_Invoice_Paiement_Payed_Remain_Amounts_result, setNew_Getall_Invoice_Paiement_Payed_Remain_Amounts_result] = useState([]); + + const [Getall_Invoice_Paiement_Payed_Remain_Amounts_api, setGetall_Invoice_Paiement_Payed_Remain_Amounts_api] = useState(); + const [Getall_Invoice_Paiement_Payed_Remain_Amounts_message, setGetall_Invoice_Paiement_Payed_Remain_Amounts_message] = useState(); + const [Getall_Invoice_Paiement_Payed_Remain_Amounts_result, setGetall_Invoice_Paiement_Payed_Remain_Amounts_result] = useState(); + function Getall_Invoice_Paiement_Payed_Remain_Amounts(event) { + + var form = new FormData(); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("invoice_id", selected_id); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Invoice_Total_Amount_Payed_And_Remaining_Amount/"; + + setLoading(true); + axios.post(myurl, form).then(res => { + + setLoading(false); + if (String(res.data.status) === String("true")) { + //console.log(" In Getall_Invoice_Paiement_Payed_Remain_Amounts res.data.status = " + res.data.status); + //console.log(" In Getall_Invoice_Paiement_Payed_Remain_Amounts res.data.message r_class = " + res.data.message); + setGetall_Invoice_Paiement_Payed_Remain_Amounts_api("true"); + setGetall_Invoice_Paiement_Payed_Remain_Amounts_result(res.data.message); + + var new_data2 = []; + const new_data = res.data.message.map((x) => { + + var local_total_amount = JSON.parse(x).total_amount; + var local_payed_amount = JSON.parse(x).payed_amount; + var local_remaining_amount = JSON.parse(x).remaining_amount; + + + + //--- + var node = { + "total_amount": local_total_amount, + "payed_amount": local_payed_amount, + "remaining_amount": local_remaining_amount, + + }; + new_data2.push(node); + }); + + if (new_data2.length > 0) { + setNew_Getall_Invoice_Paiement_Payed_Remain_Amounts_result(new_data2); + //console.log(" ### new_data2 = ", new_data2) + } + + } + else { + setGetall_Invoice_Paiement_Payed_Remain_Amounts_api("false"); + setGetall_Invoice_Paiement_Payed_Remain_Amounts_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Getall_Invoice_Paiement_Payed_Remain_Amounts = ', error); + setGetall_Invoice_Paiement_Payed_Remain_Amounts_api("false"); + alert(" Impossible de recuperer les montants de la facture"); + //setmyApimyApiMessage("") + }) + } + function Display_Detail_Invoice_Line(event, cellValues) { var invoice_line_id = String(cellValues.row._id); @@ -481,6 +775,8 @@ const Partner_Facture = (props) => { const [p_detail_header_vendeur_nom_id, setp_detail_header_vendeur_nom_id] = useState(); + const [p_detail_header_invoice_header_annotation, setp_detail_header_invoice_header_annotation] = 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(); @@ -514,6 +810,10 @@ const Partner_Facture = (props) => { 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_credit_note_ref, setp_detail_header_credit_note_ref] = 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(); @@ -609,6 +909,7 @@ const Partner_Facture = (props) => { Get_List_Partner_Clients(); Getall_Parter_Invoice_No_Filter(); + if (document.getElementById('myRef_head')) { var divh = document.getElementById('myRef_head').offsetTop; window.scrollTo({ @@ -617,6 +918,8 @@ const Partner_Facture = (props) => { }); } + + }, []) const [display_detail_invoice, setdisplay_detail_invoice] = React.useState(); @@ -646,6 +949,7 @@ const Partner_Facture = (props) => { setinvoice_internal_ref(invoice_ref); + //console.log(" ### employe_id = ", employe_id); Display_Detail_Invoice_data(invoice_id); @@ -657,6 +961,9 @@ const Partner_Facture = (props) => { behavior: "smooth", }); } + setp_detail_paiement_id(""); + order_header_submenu_main(); + } @@ -709,11 +1016,19 @@ const Partner_Facture = (props) => { if (mylocal_order.invoice_header_type) setp_detail_header_invoice_header_type(mylocal_order.invoice_header_type); + else { + setp_detail_header_invoice_header_type(""); + } if (mylocal_order.invoice_date) setp_detail_header_invoice_date(mylocal_order.invoice_date); + if (mylocal_order.annotation) + setp_detail_header_invoice_header_annotation(mylocal_order.annotation); + else + setp_detail_header_invoice_header_annotation(""); + //document.getElementsByName("detail_header_type")[0].value = ""; @@ -754,6 +1069,14 @@ const Partner_Facture = (props) => { } + if (mylocal_order.credit_note_ref) { + setp_detail_header_credit_note_ref(mylocal_order.credit_note_ref); + + } else { + setp_detail_header_credit_note_ref(""); + } + + //document.getElementsByName("detail_nom_client")[0].value = ""; if (mylocal_order.order_header_client_nom) { @@ -947,21 +1270,23 @@ const Partner_Facture = (props) => { 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"; - } + submenu_color_management("main"); + /* 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(); @@ -972,20 +1297,22 @@ const Partner_Facture = (props) => { 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"; - } + submenu_color_management("detail"); - 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"; - } + /* 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(); @@ -996,26 +1323,83 @@ const Partner_Facture = (props) => { 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"; - } + submenu_color_management("facturation"); - 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"; - } + /* 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(); } + async function order_header_submenu_paiement() { + setheader_submenu("paiement"); + + Getall_Invoice_Paiement(); + Getall_Invoice_Paiement_Payed_Remain_Amounts(); + + await sleep(5); + + submenu_color_management("paiement"); + + /* 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"; + } + */ + + + } + + + function submenu_color_management(current_menu) { + const list_sous_menu = ["order_header_facturation", "order_header_detail", "order_header_main", "order_header_detail", "paiement"] + + for (let i = 0; i < list_sous_menu.length; i++) { + + var sous_menu = list_sous_menu[i]; + if (String(sous_menu) !== current_menu) { + if (document.getElementById(sous_menu)) { + document.getElementById(sous_menu).style.backgroundColor = "#d8edfc"; + document.getElementById(sous_menu).style.color = "black"; + document.getElementById(sous_menu).style.fontWeight = "normal"; + } + } + + } + + if (document.getElementById(current_menu)) { + document.getElementById(current_menu).style.backgroundColor = "#104277"; + document.getElementById(current_menu).style.color = "white"; + document.getElementById(current_menu).style.fontWeight = "bold"; + } + + } + const sleep = (milliseconds) => { return new Promise(resolve => setTimeout(resolve, milliseconds)) } @@ -1556,6 +1940,363 @@ const Partner_Facture = (props) => { const [Dialog_1_open, setDialog_1_open] = React.useState(false); + + const [Get_Given_Paiement_Data_api, setGet_Given_Paiement_Data_api] = useState(); + const [Get_Given_Paiement_Data_message, setGet_Given_Paiement_Data_message] = useState(); + const [Get_Given_Paiement_Data_result, setGet_Given_Paiement_Data_result] = useState(); + function Get_Given_Paiement_Data(local_paiement_id) { + + + var form = new FormData(); + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("_id", local_paiement_id); + + //console.log(" ## form = ", form); + + var myurl = process.env.REACT_APP_API_URL + "myclass/api/Get_Given_Invoice_Paiement/"; + setLoading(true); + axios.post(myurl, form).then(res => { + setLoading(false); + if (String(res.data.status) === "true") { + //console.log(" In Get_Given_Paiement_Data res.data.status = " + res.data.status); + //console.log(" In Get_Given_Paiement_Data res.data.message r_class = " + res.data.message); + setGet_Given_Paiement_Data_api("true"); + setGet_Given_Paiement_Data_result(res.data.message); + + if (res.data.message.length > 0) { + var mylocal_document = JSON.parse(res.data.message); + + if (mylocal_document.paiement_amount) + setp_detail_paiement_amount(mylocal_document.paiement_amount); + else + setp_detail_paiement_amount(""); + + if (mylocal_document.paiement_mode) + setp_detail_paiement_mode(mylocal_document.paiement_mode); + else + setp_detail_paiement_mode(""); + + if (mylocal_document.paiement_ref) + setp_detail_paiement_ref(mylocal_document.paiement_ref); + else + setp_detail_paiement_ref(""); + + if (mylocal_document.paiement_date) + setp_detail_paiement_date(mylocal_document.paiement_date); + else + setp_detail_paiement_date(new Date().toLocaleDateString('fr-FR')); + + + if (mylocal_document.commentaire) + setp_detail_paiement_comment(mylocal_document.commentaire); + else + setp_detail_paiement_comment(""); + + + + + } else { + alert(" Aucun paiement recuperé"); + } + + + } else if (String(res.data.status) === String("Err_Connexion")) { + alert('Erreur: ' + res.data.message); + history.push("/Connexion"); + } + + else { + setGet_Given_Paiement_Data_api("false"); + setGet_Given_Paiement_Data_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('Not good man :( Get_Given_Paiement_Data = ', error); + setGet_Given_Paiement_Data_api("false"); + alert(" Impossible de recuperer les données du paiement"); + //setmyApimyApiMessage("") + }) + } + + + const [Dialog_Paiement_1_message, setDialog_Paiement_1_message] = React.useState(false); + const [Dialog_Paiement_1_open, setDialog_Paiement_1_open] = React.useState(false); + + function Dialog_1_handle_change_Paiement(message) { + setDialog_Paiement_1_message(message); + setDialog_Paiement_1_open(true); + } + + const Dialog_Paiement_1_handleClose = () => { + //alert(" Utiliser le bouton 'fermer' "); + //setOpen(false); + }; + + const Dialog_Paiement_1_handleClose_buton = () => { + clear_Paiement_DetailFields(); + setDialog_Paiement_1_open(false); + + if (document.getElementById('myRef')) { + var divh = document.getElementById('myRef').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + + }; + + const [p_detail_paiement_id, setp_detail_paiement_id] = useState(""); + const [p_detail_paiement_amount, setp_detail_paiement_amount] = useState(""); + + const [p_detail_paiement_date, setp_detail_paiement_date] = useState(new Date().toLocaleDateString('fr-FR')); + + const [p_detail_paiement_ref, setp_detail_paiement_ref] = useState(""); + const [p_detail_paiement_comment, setp_detail_paiement_comment] = useState(""); + const [p_detail_paiement_mode, setp_detail_paiement_mode] = useState(""); + const [p_detail_paiement_invoice_id, setp_detail_paiement_invoice_id] = useState(""); + + + + function clear_Paiement_DetailFields() { + setp_detail_paiement_id(""); + setp_detail_paiement_amount(""); + setp_detail_paiement_date(new Date().toLocaleDateString('fr-FR')); + setp_detail_paiement_ref(""); + setp_detail_paiement_comment(""); + } + + + const [Add_Update_Paiement_Data_api, setAdd_Update_Paiement_Data_api] = useState(); + const [Add_Update_Paiement_Data_message, setAdd_Update_Paiement_Data_message] = useState(); + const [Add_Update_Paiement_Data_result, setAdd_Update_Paiement_Data_result] = useState(); + function Add_Update_Paiement_Data() { + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("invoice_id", selected_id); + form.append("paiement_amount", p_detail_paiement_amount); + form.append("paiement_mode", p_detail_paiement_mode); + form.append("paiement_ref", p_detail_paiement_ref); + form.append("paiement_date", p_detail_paiement_date); + form.append("commentaire", p_detail_paiement_comment); + + + //console.log(" form == ", form); + + var myurl = ""; + if (p_detail_paiement_id && String(p_detail_paiement_id).length > 2) { + + form.append("_id", p_detail_paiement_id); + myurl = process.env.REACT_APP_API_URL + "myclass/api/Update_Invoice_Paiement/"; + } + else + myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Invoice_Paiement/"; + + setLoading(true); + + axios.post(myurl, form).then(res => { + setLoading(false); + //console.log(" In Add_Update_Paiement_Data res.data.status = " + res.data.status); + //console.log(" In Add_Update_Paiement_Data res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + + setAdd_Update_Paiement_Data_api("true"); + setAdd_Update_Paiement_Data_result(res.data.message); + + Getall_Invoice_Paiement(); + Getall_Invoice_Paiement_Payed_Remain_Amounts(); + clear_Paiement_DetailFields() + + Dialog_Paiement_1_handleClose_buton(); + + alert(res.data.message); + if (document.getElementById('myRef')) { + var divh = document.getElementById('myRef').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + + + } + else { + setAdd_Update_Paiement_Data_api("false"); + setAdd_Update_Paiement_Data_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('UpdateStagiaireData : Not good man :( Add_Update_Paiement_Data = ' + error); + setAdd_Update_Paiement_Data_api("false"); + alert(" Impossible d'ajouter ou mettre à jour le paiement "); + + }) + } + + + + const [Create_Invoice_Credit_Note_api, setCreate_Invoice_Credit_Note_api] = useState(); + const [Create_Invoice_Credit_Note_message, setCreate_Invoice_Credit_Note_message] = useState(); + const [Create_Invoice_Credit_Note_result, setCreate_Invoice_Credit_Note_result] = useState(); + function Create_Invoice_Credit_Note() { + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("_id", selected_id); + + + //console.log(" form == ", form); + + var myurl = myurl = process.env.REACT_APP_API_URL + "myclass/api/Create_Invoice_Avoir_Total/"; + + setLoading(true); + + axios.post(myurl, form).then(res => { + setLoading(false); + //console.log(" In Create_Invoice_Credit_Note res.data.status = " + res.data.status); + //console.log(" In Create_Invoice_Credit_Note res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + + setCreate_Invoice_Credit_Note_api("true"); + setCreate_Invoice_Credit_Note_result(res.data.message); + + Get_List_Partner_Clients(); + Getall_Parter_Invoice_No_Filter(); + + Display_Detail_Invoice_data(selected_id); + + alert(res.data.message); + + if (document.getElementById('myRef_head')) { + var divh = document.getElementById('myRef_head').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + + + } + else { + setCreate_Invoice_Credit_Note_api("false"); + setCreate_Invoice_Credit_Note_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('UpdateStagiaireData : Not good man :( Create_Invoice_Credit_Note = ' + error); + setCreate_Invoice_Credit_Note_api("false"); + alert(" Impossible d'ajouter ou mettre à jour le paiement "); + + }) + } + + const [Dialog_annotation_1_message, setDialog_annotation_1_message] = React.useState(false); + const [Dialog_annotation_1_open, setDialog_annotation_1_open] = React.useState(false); + + function Dialog_1_handle_change_annotation(message) { + setDialog_annotation_1_message(message); + setDialog_annotation_1_open(true); + } + + const Dialog_annotation_1_handleClose = () => { + //alert(" Utiliser le bouton 'fermer' "); + //setOpen(false); + }; + + const Dialog_annotation_1_handleClose_buton = () => { + + setDialog_annotation_1_open(false); + + /* if (document.getElementById('myRef')) { + var divh = document.getElementById('myRef').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + }*/ + + }; + + const [Add_Update_annotation_Data_api, setAdd_Update_annotation_Data_api] = useState(); + const [Add_Update_annotation_Data_message, setAdd_Update_annotation_Data_message] = useState(); + const [Add_Update_annotation_Data_result, setAdd_Update_annotation_Data_result] = useState(); + function Add_Update_annotation_Data() { + var form = new FormData(); + //form.append("token","K3cw63eKokKSbV4spjQ48SUNnfy80yrXfA"); + + + const stored_cookie = getCookie('tokenmysypart'); + form.append("token", stored_cookie); + form.append("_id", selected_id); + form.append("annotation", p_detail_header_invoice_header_annotation); + + + //console.log(" form == ", form); + + var myurl = myurl = process.env.REACT_APP_API_URL + "myclass/api/Add_Update_Invoice_Annotation/"; + + setLoading(true); + + axios.post(myurl, form).then(res => { + setLoading(false); + //console.log(" In Add_Update_annotation_Data res.data.status = " + res.data.status); + //console.log(" In Add_Update_annotation_Data res.data.message r_class = " + res.data.message); + + if (String(res.data.status) === String("true")) { + + setAdd_Update_annotation_Data_api("true"); + setAdd_Update_annotation_Data_result(res.data.message); + + + Dialog_annotation_1_handleClose_buton(); + + alert(res.data.message); + if (document.getElementById('myRef')) { + var divh = document.getElementById('myRef').offsetTop; + window.scrollTo({ + top: divh, + behavior: "smooth", + }); + } + + + } + else { + setAdd_Update_annotation_Data_api("false"); + setAdd_Update_annotation_Data_message(res.data.message); + alert(res.data.message); + } + + }).catch((error) => { + setLoading(false); + console.warn('UpdateStagiaireData : Not good man :( Add_Update_annotation_Data = ' + error); + setAdd_Update_annotation_Data_api("false"); + alert(" Impossible d'ajouter ou mettre à jour l'annotation "); + + }) + } + + + + + return (
@@ -1775,6 +2516,200 @@ const Partner_Facture = (props) => { + {/*** Paiement */} + + + Paiement + + + {Dialog_Paiement_1_message} + + + + +
Réf. Paiement + { + setp_detail_paiement_ref(e.target.value); + } + } + /> + +
+ + +
Montant + { + setp_detail_paiement_amount(e.target.value); + } + } + /> + +
+ +
Mode Paiement + { + setp_detail_paiement_mode(e.target.value); + } + } + /> + +
+ + {p_detail_paiement_date &&
Date paiement
+ { + setp_detail_paiement_date(format(date, 'd/MM/yyyy')); + + } + } + showTimeSelect={false} + dateFormat="dd/MM/yyyy" + className="disabled_style enable_style session_caract_Dialog_DatePicker" + locale='fr-FR' + fullWidth + + /> + +
} + +
Commentaire + { + setp_detail_paiement_comment(e.target.value); + } + } + /> + +
+ + + +
+ + + +
+
+ + {String(p_detail_paiement_id).trim().length > 2 && } + {String(p_detail_paiement_id).trim() === "" && } +
+ +
+ +
+
+ +
+ +
+ + {/*** Fin Paiement */} + + + {/*** annotation */} + + + Annotation + + + {Dialog_annotation_1_message} + + + + + + { + setp_detail_header_invoice_header_annotation(e.target.value); + } + } + maxRows={10} + variant="outlined" + fullWidth + /> + + + + + +
+
+ +
+ +
+ +
+
+ +
+ +
+ + {/*** Fin annotation */} +

Vos Factures

@@ -2085,6 +3020,14 @@ const Partner_Facture = (props) => { color: 'black', }, + + '& .line--statut--payed': { + backgroundColor: '#EAFAF1', + color: '#239B56', + fontWeight: '700' + }, + + }} > { onRowDoubleClick={(newSelectionModel) => { setgridline_id(newSelectionModel.row.id); + + handleClick_edit_invoice_From_Line(newSelectionModel.row.id); } } @@ -2133,6 +3078,9 @@ const Partner_Facture = (props) => { order_header_vendeur_nom_prenom: JSON.parse(item).order_header_vendeur_nom_prenom, order_header_date_cmd: JSON.parse(item).order_header_date_cmd, + reste_to_paye: JSON.parse(item).reste_to_paye, + credit_note_ref: JSON.parse(item).credit_note_ref, + } @@ -2150,28 +3098,14 @@ const Partner_Facture = (props) => { //sx={datagridSx} getCellClassName={(params) => { - - //field === "order_header_status" - if (params.field === "order_header_status" && String(params.value) == "0") { - return 'cell--status--brouillon'; - } - - if (params.field === "order_header_status" && String(params.value) == "1") { - - return 'cell--status--encours'; - } - - if (params.field === "order_header_status" && String(params.value) == "2") { - return 'cell--status--traite'; - } - - if (params.field === "order_header_status" && String(params.value) == "3") { - return 'cell--status--facture'; - } - }} getRowClassName={(params) => { + if (parseInt(parseFloat(params.row.reste_to_paye)) <= 0 && String(params.row.invoice_header_type) === "facture") { + + return 'line--statut--payed'; + } + // Pour la gestion de la couleur de zone double cliquée if (String(params.row.id) === String(gridline_id)) { return 'line--statut--selected'; @@ -2206,10 +3140,12 @@ const Partner_Facture = (props) => { + +
-
+ {String(header_submenu) !== "paiement" &&
{String(header_submenu) !== "detail" && String(header_submenu) !== "facturation" &&
@@ -2440,8 +3376,6 @@ const Partner_Facture = (props) => {
} - - {String(header_submenu) === "detail" &&
{/*
@@ -2815,19 +3749,250 @@ const Partner_Facture = (props) => {
} + + +
+
 
+ + + + +
 
+ + + {p_detail_header_invoice_header_type && String(p_detail_header_invoice_header_type) === "facture" && + String(p_detail_header_credit_note_ref) === "" && + Annuler (Avoir) + + + + } + modal + nested + position="center center" + > + {close => ( +
+ +
MySy Information
+
+ {' '} + En confirmant cette opération, La facture sera annulée et un avoir créé .
+ +
+
+
+ + +
+
+ +
+
+
+ )} +
}
-
+
} + + + {String(header_submenu) === "paiement" &&
+ + {Getall_Invoice_Paiement_result && +
+ {New_Getall_Invoice_Paiement_Payed_Remain_Amounts_result && +
+ {New_Getall_Invoice_Paiement_Payed_Remain_Amounts_result[0]['remaining_amount'] && + parseFloat(New_Getall_Invoice_Paiement_Payed_Remain_Amounts_result[0]['remaining_amount']) > 0 && } + + {New_Getall_Invoice_Paiement_Payed_Remain_Amounts_result[0]['remaining_amount'] && + parseFloat(New_Getall_Invoice_Paiement_Payed_Remain_Amounts_result[0]['remaining_amount']) <= 0 && } +
} + +
+   + + + { + setselectionModel_paiement(newSelectionModel); + //console.log("ch selected--" + newSelectionModel_insc); + }} + selectionModel={selectionModel_paiement} + + localeText={frFR.components.MuiDataGrid.defaultProps.localeText} + rows={Getall_Invoice_Paiement_result.map((item, index) => ( + { + id: index, + _id: JSON.parse(item)._id, + invoice_id: JSON.parse(item).invoice_id, + paiement_amount: JSON.parse(item).paiement_amount, + paiement_mode: JSON.parse(item).paiement_mode, + paiement_ref: JSON.parse(item).paiement_ref, + paiement_date: JSON.parse(item).paiement_date, + + } + ))} + + columns={columns_paiement} + pageSize={10} + className="datagridclass" + + getCellClassName={(params) => { + + + }} + + onRowDoubleClick={(newSelectionModel) => { + + setgridline_paiment_id(newSelectionModel.row.id); + setp_detail_paiement_id(newSelectionModel.row._id); + Get_Given_Paiement_Data(newSelectionModel.row._id); + + setDialog_Paiement_1_open(true); + } + } + + rowsPerPageOptions={[10]} + disableSelectionOnClick + components={{ + Toolbar: GridToolbar, + }} + + getRowClassName={(params) => { + + // Pour la gestion de la couleur de zone double cliquée + if (String(params.row.id) === String(gridline_paiment_id)) { + return 'line--statut--selected'; + } + else if (parseInt(String(params.row.id)) % 2 === 0) { + return 'line--statut--pair'; + } + else if (parseInt(String(params.row.id)) % 2 !== 0) { + return 'line--statut--impair'; + } + }} + + getEstimatedRowHeight={() => 200} + getRowHeight={() => "auto"} + sx={{ + + [`& .${gridClasses.cell}`]: { + py: 1, + }, + }} + + /> + + + +
+ + +
+
+ +
+ +
+ +
+ +
+
+ + +
} +
}
-
+ {String(header_submenu) !== "paiement" &&
-
+
}
} diff --git a/src/styles/components/_displayPartnerunite_enseignement.scss b/src/styles/components/_displayPartnerunite_enseignement.scss index 57f2057..b07844d 100644 --- a/src/styles/components/_displayPartnerunite_enseignement.scss +++ b/src/styles/components/_displayPartnerunite_enseignement.scss @@ -2733,6 +2733,7 @@ text-align: left; font-size: small; margin-bottom: 1rem !important; + background-color: #FFFFFF; } .session_caract_Dialog_comment_2_lines { @@ -2743,6 +2744,7 @@ text-align: left; font-size: small; margin-bottom: 1rem !important; + background-color: #FFFFFF; } diff --git a/src/styles/components/_displaypartnersession.scss b/src/styles/components/_displaypartnersession.scss index f76103c..355ce25 100644 --- a/src/styles/components/_displaypartnersession.scss +++ b/src/styles/components/_displaypartnersession.scss @@ -2727,6 +2727,7 @@ text-align: left; font-size: small; margin-bottom: 1rem !important; + background-color: #FFFFFF; } .session_caract_Dialog_comment_2_lines { @@ -2737,6 +2738,7 @@ text-align: left; font-size: small; margin-bottom: 1rem !important; + background-color: #FFFFFF; } @@ -2791,7 +2793,7 @@ .MuiPaper-root{ border-radius: 10px !important; - background: #F8F9F9 !important; + background: #FFFFFF !important; max-width: none !important; } diff --git a/src/styles/components/_partner_facture.scss b/src/styles/components/_partner_facture.scss index efac486..c009aa8 100644 --- a/src/styles/components/_partner_facture.scss +++ b/src/styles/components/_partner_facture.scss @@ -3,8 +3,8 @@ .tooltip_css { background: #81BC3A; z-index: 9999; - } - + } + .Mui-disabled { font-size: small !important; padding: 0px !important; @@ -111,6 +111,7 @@ letter-spacing: 0.1rem; font-weight: normal; width: 100%; + max-height: 2rem !important; } .detail_class_submenu:hover:active, @@ -249,7 +250,7 @@ width: 6%; } - + .icon_plus_line { width: 3%; } @@ -594,6 +595,18 @@ margin-bottom: 1rem; padding-top: 0.5rem !important; } + + .block_paiement_montant { + float: right; + margin-right: 1rem; + width: 90%; + border-radius: 10px; + border: 1px solid aliceblue; + margin-top: 5px; + padding: 5px; + background: #fffdf0; + } + } @media only screen and (min-width: 601px) and (max-width: 991px) { @@ -660,9 +673,10 @@ border: 1px solid #9cf; color: #3b3e40; font-family: "verdana", "Quicksand", "Signika", sans-serif; - font-size: small; + font-size: 10px; letter-spacing: 0.1rem; font-weight: normal; + max-height: 2rem !important; } .detail_class_submenu:hover:active, @@ -819,7 +833,7 @@ width: 6%; } - + .icon_plus_line { width: 4%; } @@ -1162,6 +1176,18 @@ padding-top: 0.5rem !important; } + .block_paiement_montant { + float: right; + margin-right: 1rem; + width: 50%; + border-radius: 10px; + border: 1px solid aliceblue; + margin-top: 5px; + padding: 5px; + background: #fffdf0; + } + + } @media only screen and (min-width: 992px) and (max-width: 1199px) { @@ -1254,9 +1280,10 @@ border: 1px solid #9cf; color: #3b3e40; font-family: "verdana", "Quicksand", "Signika", sans-serif; - font-size: small; + font-size: 10px; letter-spacing: 0.1rem; font-weight: normal; + max-height: 2rem !important; } .detail_class_submenu:hover:active, @@ -1329,7 +1356,7 @@ } - + .css-11u53oe-MuiSelect-select-MuiInputBase-input-MuiOutlinedInput-input { padding: 1px !important; @@ -1417,7 +1444,7 @@ width: 8%; } - + .icon_plus_line { width: 3%; } @@ -1636,6 +1663,18 @@ font-weight: normal; } + .block_paiement_montant { + float: right; + margin-right: 1rem; + width: 30%; + border-radius: 10px; + border: 1px solid aliceblue; + margin-top: 5px; + padding: 5px; + background: #fffdf0; + } + + } @media only screen and (min-width: 1200px) { @@ -1728,9 +1767,10 @@ border: 1px solid #9cf; color: #3b3e40; font-family: "verdana", "Quicksand", "Signika", sans-serif; - font-size: small; + font-size: 10px; letter-spacing: 0.1rem; font-weight: normal; + max-height: 2rem !important; } .detail_class_submenu:hover:active, @@ -2231,7 +2271,7 @@ text-align: center; } - .css-l4u8b9-MuiInputBase-root-MuiInput-root{ + .css-l4u8b9-MuiInputBase-root-MuiInput-root { text-align: left !important; } @@ -2259,18 +2299,29 @@ margin-left: 10px; margin-right: 10px; } - + + + .block_paiement_montant { + float: right; + margin-right: 1rem; + width: 30%; + border-radius: 10px; + border: 1px solid aliceblue; + margin-top: 5px; + padding: 5px; + background: #fffdf0; + } } // end media - .css-md26zr-MuiInputBase-root-MuiOutlinedInput-root{ + .css-md26zr-MuiInputBase-root-MuiOutlinedInput-root { height: 3.5rem !important; } - .css-1bp1ao6{ + .css-1bp1ao6 { height: 3.5rem !important; } @@ -2333,27 +2384,27 @@ align-items: center; text-align: center; margin-bottom: 0.5rem !important; - } - - .separator::before, - .separator::after { + } + + .separator::before, + .separator::after { content: ''; flex: 1; border-bottom: 1px solid #e0e0e0; - } - - .separator:not(:empty)::before { - margin-right: .35em; - } - - .separator:not(:empty)::after { - margin-left: .35em; - } + } - .MuiSelect-select{ + .separator:not(:empty)::before { + margin-right: .35em; + } + + .separator:not(:empty)::after { + margin-left: .35em; + } + + .MuiSelect-select { //height: 3rem !important; - } + } }