alpha_full/admin/catalog/articles/articles.js
2026-04-06 22:58:51 +02:00

209 lines
7.0 KiB
JavaScript
Executable File

function rechercherParFam(){
if (document.getElementById('idFamRech').value !=0 ) {
if (document.getElementById('codeOpe')) {document.getElementById('codeOpe').value="cat";}
document.fArt.submit();
}
}
function rechercherParSousCat(){
// alert('rechercherParCat');
if (document.getElementById('idCatRech').value !=0) {
// alert('idCatRech '+ document.getElementById('idCatRech').value );
if (document.getElementById('codeOpe')) {document.getElementById('codeOpe').value="sousCat";}
}
else {
// on désactive le filtre
if (document.getElementById('codeOpe')) {document.getElementById('codeOpe').value="cat";}
}
document.fArt.submit();
}
function rechercherParRef(){
//alert('rechercherParRef');
if (document.getElementById('idRefRech').value !='-' && document.getElementById('idRefRech').value !='' ) {
if (document.getElementById('idRefRech').value !=0){
if (document.getElementById('codeOpe')) {document.getElementById('codeOpe').value="ref";}
}
else{
// on désactive le filtre
if (document.getElementById('codeOpe')) {document.getElementById('codeOpe').value="cat";}
}
document.fArt.submit();
}
else {
alert('Référence vide ou invalide');
}
}
function rechercherParNom(){
debugLocal=0;
if(debugLocal==1) {
if (document.getElementById('nomPrdRech')) alert ('nomPrdRech = ' + document.getElementById('nomPrdRech').value );
else alert ('nomPrdRech ps atteint');
}
if (document.getElementById('nomPrdRech').value !=0) {
if (document.getElementById('codeOpe')) {document.getElementById('codeOpe').value="nom";}
}
else {
// on désactive le filtre
if (document.getElementById('codeOpe')) {document.getElementById('codeOpe').value="cat";}
}
document.fArt.submit();
}
function previousArt(){
debugLocal=0;
if(debugLocal==1) alert('previousArt');
if (document.getElementById('idPrdRech')){document.getElementById('idPrdRech').value=document.getElementById('idPrd').value;}
if (document.getElementById('codeOpeDeplacement')){document.getElementById('codeOpeDeplacement').value="moins";}
if (document.getElementById('codeOpe')){document.getElementById('codeOpe').value="";}
document.fArt.submit();
}
function nextArt(){
debugLocal=0;
if (document.getElementById('idPrdRech')){document.getElementById('idPrdRech').value=document.getElementById('idPrd').value;}
if(debugLocal==1) alert('nextArt');
if (document.getElementById('codeOpeDeplacement')){document.getElementById('codeOpeDeplacement').value="plus";}
if (document.getElementById('codeOpe')){document.getElementById('codeOpe').value="";}
document.fArt.submit();
}
function updateGond(){
//alert('updateGond');
if (document.getElementById('codeOpe')){document.getElementById('codeOpe').value="majG";}
var check=document.getElementById('gondole');
if (check.checked==false)
{document.getElementById('gondole').value='0';}
else
{document.getElementById('gondole').value='1';}
//alert('checked='+document.getElementById('gondole').value);
document.fArt.submit();
}
function updateNouveaute(){
//alert('updateNouveaute');
if (document.getElementById('codeOpe')){document.getElementById('codeOpe').value="majA";}
if (document.getElementById('nouveaute') ){
var check=document.getElementById('nouveaute');
if (check.checked==false)
{document.getElementById('nouveaute').value='0';}
else
{document.getElementById('nouveaute').value='1';}
}
//alert('checked='+document.getElementById('nouveaute').value);
document.fArt.submit();
}
function updatePrd(){
debugLocal=0;
if (debugLocal==1) alert('updatePrd');
if (document.getElementById('codeOpe')){document.getElementById('codeOpe').value="majA";}
if (document.getElementById('codeOpeDeplacement')){document.getElementById('codeOpeDeplacement').value="";}
if (document.getElementById('idPrdRech')){document.getElementById('idPrdRech').value=document.getElementById('idPrd').value;}
document.fArt.submit();
}
function KP(){
var x = event.keyCode;
if (x==13){
// alert (x);
updatePrd();
}
}
function desactivPrd(idPrd) {
//alert (' OH OH Desactiv'+idPrd);
if (document.getElementById('codeOpe')){document.getElementById('codeOpe').value="desactivPrd";}
document.fArt.submit();
}
function activPrd(idPrd){
// alert ('Desactiv'+idPrd);
if (document.getElementById('codeOpe')){document.getElementById('codeOpe').value="activPrd";}
document.fArt.submit();
}
function upCreateArt(){
if (document.getElementById('codeOpe')){document.getElementById('codeOpe').value="faireInsert";}
document.createProduit.submit();
}
function upCategorieListeFromFamille(){
document.createProduit.submit();
}
function deleteNotice(){
var r=confirm('Confirmez la supression de cette notice');
if (r == true) {
document.getElementById('codeOpe').value='deleteNotice';
document.fArt.submit();
}
}
function upHTFromTTC(prixTtc){
debugLocal=0;
if (debugLocal==1) alert('upHTFromTTC = '+prixTtc);
var tauxTVA= document.getElementById('theTaux').value;
tauxTVA= parseFloat(tauxTVA)/100;
if (debugLocal==1) alert('tauxTVA = '+tauxTVA);
prixTtc=prixTtc.replace(',','.')
prixTtc=prixTtc.replace(' ','')
prixTtc=prixTtc.replace(' ','')
prixTtc= parseFloat(prixTtc).toFixed(4);
var prixHt = parseFloat(prixTtc) / (1+ parseFloat(tauxTVA) ) ;
if (document.getElementById('prixHt')) document.getElementById('prixHt').value=prixHt;
if (document.getElementById('prixTtc')) document.getElementById('prixTtc').value=prixTtc;
if (debugLocal==1) alert(' fin updatePrdPrix = '+prixHt);
}
function upTTCFromHT(prixHt){
debugLocal=0;
if (debugLocal==1) alert('upTTCFromHT = '+prixHt);
var tauxTVA= document.getElementById('theTaux').value;
tauxTVA= parseFloat(tauxTVA)/100;
if (debugLocal==1) alert('tauxTVA = '+tauxTVA);
prixHt=prixHt.replace(',','.')
prixHt=prixHt.replace(' ','')
prixHt=prixHt.replace(' ','')
prixHt= parseFloat(prixHt).toFixed(4);
var prixTtc = parseFloat(prixHt) + ( parseFloat(tauxTVA) * parseFloat(prixHt) ) ;
if (document.getElementById('prixHt')) document.getElementById('prixHt').value=prixHt;
if (document.getElementById('prixTtc')) document.getElementById('prixTtc').value=prixTtc;
if (debugLocal==1) alert(' fin updatePrdPrix = '+prixTtc);
}
function upTva(tauxTva){
debugLocal=0;
if (debugLocal==1) alert('upTva = '+tauxTva);
tauxTva= parseFloat(tauxTva)/100;
if (debugLocal==1) alert('tauxTva = '+tauxTva);
if (document.getElementById('prixHt')) prixHt= document.getElementById('prixHt').value;
if (debugLocal==1) alert('prixHt avant formattage = '+prixHt);
prixHt=prixHt.replace(',','.')
prixHt=prixHt.replace(' ','')
prixHt=prixHt.replace(' ','')
prixHt= parseFloat(prixHt).toFixed(4);
if (debugLocal==1) alert('prixHt apres formattage = '+prixHt);
prixTtc = parseFloat(prixHt) + ( parseFloat(tauxTva) * parseFloat(prixHt) ) ;
if (document.getElementById('prixTtc')) document.getElementById('prixTtc').value=prixTtc;
if (debugLocal==1) alert(' fin updatePrdPrix = '+prixTtc);
}