00001 <?
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00026 define ("phpcompta_password","dany");
00027 define ("domaine","");
00028
00029 define ("DEBUG","true");
00030
00031
00032
00033
00034 define ("ENCJRN",1);
00035
00036 define("FACT",2);
00037
00038 define ("FICHE_READ",3);
00039
00040 define ("IMP",4);
00041
00042 define("FORM",5);
00043
00044 define ("MPCMN",6);
00045
00046 define ("GJRN",7);
00047
00048 define ("PARM",8);
00049
00050 define ("SECU",9);
00051
00052 define ("DEVISE",18);
00053
00054 define ("PERIODE",19);
00055
00056 define ("BALANCE",20);
00057
00058 define ("CENTRALIZE",10);
00059 define ("VEN",11);
00060 define ("BQE",12);
00061 define ("ODS",13);
00062
00063 define ("FICHE_WRITE",15);
00064 define ("STOCK_WRITE",16);
00065 define ("STOCK_READ",17);
00066 define ("EXP_IMP_ECR",21);
00067 define ("IMP_BQE",22);
00068
00069 define ("NOERROR",0);
00070 define ("BADPARM",1);
00071 define ("BADDATE",2);
00072 define ("NOTPERIODE",3);
00073 define ("PERIODCLOSED",4);
00074 define ("INVALID_ECH",5);
00075 define ("RAPPT_ALREADY_USED",6);
00076 define ("RAPPT_NOT_EXIST",7);
00077 define ("DIFF_AMOUNT",8);
00078 define ("RAPPT_NOMATCH_AMOUNT",9);
00079 define ("NO_PERIOD_SELECTED",10);
00080 define ("NO_POST_SELECTED",11);
00081 define ("LAST",1);
00082 define ("FIRST",0);
00083 define ("ERROR",12);
00084
00085
00086 define('ACTION','1,5,6,7,8');
00087
00088
00089 define ("YES",1);
00090 define ("NO",0);
00091 define ("OPEN",1);
00092 define ("CLOSED",0);
00093 define ("NOTCENTRALIZED",3);
00094
00095
00096 define ("MENU_FACT",1);
00097 define ("MENU_FICHE",2);
00098 define ("MENU_PARAM",3);
00099
00100
00101 define ("ALL_FICHE_DEF_REF", 1000);
00102
00103
00104 define ("ATTR_DEF_ACCOUNT",5);
00105 define ("ATTR_DEF_NAME",1);
00106 define ("ATTR_DEF_PRIX_ACHAT",7);
00107 define ("ATTR_DEF_PRIX_VENTE",6);
00108 define ("ATTR_DEF_TVA",2);
00109 define ("ATTR_DEF_NUMTVA",13);
00110 define ("ATTR_DEF_ADRESS",14);
00111 define ("ATTR_DEF_CP",15);
00112 define ("ATTR_DEF_PAYS",16);
00113 define ("ATTR_DEF_STOCK",19);
00114 define ("ATTR_DEF_TEL",17);
00115 define ("ATTR_DEF_EMAIL",18);
00116 define ("ATTR_DEF_COMPANY",25);
00117 define ("ATTR_DEF_FAX",26);
00118
00119
00120 define ("FICHE_TYPE_CLIENT",9);
00121 define ("FICHE_TYPE_VENTE",1);
00122 define ("FICHE_TYPE_FOURNISSEUR",8);
00123 define ("FICHE_TYPE_FIN",4);
00124 define ("FICHE_TYPE_CONTACT",16);
00125 define ("FICHE_TYPE_ADM_TAX",14);
00126 define ("ATTR_DEF_DEPENSE_NON_DEDUCTIBLE",20);
00127 define ("ATTR_DEF_TVA_NON_DEDUCTIBLE",21);
00128 define ("ATTR_DEF_TVA_NON_DEDUCTIBLE_RECUP",22);
00129 define ("ATTR_DEF_QUICKCODE",23);
00130 define ("JS_SEARCH_POSTE","<SCRIPT language=\"javascript\">function SearchPoste(p_sessid,p_ctl,p_jrn)
00131 {
00132 var win=window.open('poste_search.php?p_jrn='+p_jrn+'&p_ctl='+p_ctl+'&PHPSESSID='+p_sessid,'Cherche','toolbar=no,width=600,height=600,scrollbars=yes,resizable=yes');
00133 }
00134 function SearchPosteFilter(p_sessid,p_ctl,p_filter,jrn)
00135 {
00136 var win=window.open('poste_search.php?p_jrn='+jrn+'&p_ctl='+p_ctl+'&PHPSESSID='+p_sessid+'&filter='+p_filter,'Cherche','toolbar=no,width=600,height=600,scrollbars=yes,resizable=yes');
00137 }
00138 function GetIt() {
00139 window.close();
00140 }
00141 function SetItChild(p_ctl,p_value) {
00142 self.opener.SetItParent(p_ctl,p_value);
00143 window.close();
00144 }
00145 function SetItParent(p_ctl,p_value) {
00146
00147 var f=document.getElementsByName(p_ctl);
00148 for (var h=0; h < f.length; h++) {
00149 f[h].value=p_value;
00150 }
00151
00152 }
00153 /* SetValue( p_ctl,p_value )
00154 /* p_ctl is the name of the control
00155 /* p_value is the value to set in
00156 */
00157 function SetValue(p_ctl,p_value)
00158 {
00159
00160 var f=document.getElementsByName(p_ctl);
00161 for (var h=0; h < f.length; h++) {
00162 f[h].value=p_value;
00163 }
00164
00165
00166 }
00167 </SCRIPT>"
00168 );
00169 define ("JS_SHOW_TVA","<SCRIPT language=\"javascript\">
00170 function ShowTva(p_sessid,ctl)
00171 {
00172 var win=window.open('show_tva.php?ctl='+ctl+'&PHPSESSID='+p_sessid,'Montre','scrollbar,toolbar=no,width=300,height=300,resizable=yes');
00173 }
00174 function GetIt(ctl,tva_id) {
00175 self.opener.SetValue(ctl,tva_id)
00176 window.close();
00177 }
00178
00179 </SCRIPT>"
00180 );
00181
00182 define ("JS_VIEW_JRN_DETAIL","<script language=\"javascript\">function viewDetail(p_value,p_sessid)
00183 {
00184 var win=window.open('jrn_op_detail.php?jrn_op='+p_value+'&PHPSESSID='+p_sessid,'Cherche','toolbar=no,width=400,height=400,scrollbars=yes,resizable=yes');
00185 }
00186
00187 </script>");
00188 define ("JS_VIEW_JRN_CANCEL","<script language=\"javascript\" >function cancelOperation(p_value,p_sessid,p_jrn)
00189 {
00190 var win=window.open('annulation.php?p_jrn='+p_jrn+'&jrn_op='+p_value+'&PHPSESSID='+p_sessid,'Annule','toolbar=no,width=400,height=400,scrollbars=yes,resizable=yes');
00191 }
00192 function RefreshMe() {
00193 window.location.reload();
00194 }
00195 </script>");
00196 define ("JS_VIEW_JRN_MODIFY","<script language=\"javascript\">function modifyOperation(p_value,p_sessid,p_jrn)
00197 {
00198 var win=window.open('modify_op.php?action=update&p_jrn='+p_jrn+'&line='+p_value+'&PHPSESSID='+p_sessid,'Modifie','toolbar=no,width=500,height=400,scrollbars=yes,resizable=yes');
00199 }
00200 function RefreshMe() {
00201 window.location.reload();
00202 }
00203 function dropLink(p_value,p_value2,p_sessid) {
00204 var win=window.open('modify_op.php?action=delete&line='+p_value+'&line2='+p_value2+'&PHPSESSID='+p_sessid,'Liaison','toolbar=no,width=500,height=400,scrollbars=yes,resizable=yes');
00205 }
00206
00207
00208 </script>");
00209 define ("JS_UPDATE_PCMN","<script language=\"javascript\">function PcmnUpdate(p_value,p_lib,p_parent,p_sessid)
00210 {
00211 var win=window.open('line_update.php?l='+p_value+'&n='+p_lib+'&p='+p_parent+'&PHPSESSID='+p_sessid,'Modifie','toolbar=no,width=500,height=400,scrollbars=yes,resizable=yes');
00212 }
00213 function RefreshMe() {
00214 window.location.reload();
00215 }
00216
00217
00218 </script>");
00219
00220 define ("JS_SEARCH_CARD","
00221 <script language=\"javascript\">
00222 /* type must be cred or deb and name is
00223 * the control's name
00224 */
00225 function SearchCard(p_sessid,type,name,jrn)
00226 {
00227 var a=window.open('fiche_search.php?p_jrn='+jrn+'&PHPSESSID='+p_sessid+'&type='+type+'&name='+name,'item','toolbar=no,width=350,height=450,scrollbars=yes');
00228 }
00229 function NewCard(p_sessid,type,name,jrn)
00230 {
00231 var a=window.open('fiche_new.php?p_jrn='+jrn+'&PHPSESSID='+p_sessid+'&type='+type+'&name='+name,'item','toolbar=no,width=350,height=450,scrollbars=yes');
00232 }
00233 /* SetValue( p_ctl,p_value )
00234 /* p_ctl is the name of the control
00235 /* p_value is the value to set in
00236 */
00237 function SetValue(p_ctl,p_value)
00238 {
00239
00240 var f=document.getElementsByName(p_ctl);
00241 for (var h=0; h < f.length; h++) {
00242 f[h].value=p_value;
00243 }
00244
00245
00246 }
00247 /* Parameters
00248 * i = ctl _name
00249 * p_id = code id (fiche.f_id)
00250 *¨p_label = label
00251 * p_sell vw_fiche_attr.vw_sell
00252 * p_buy vw_fiche_attr.vw_buy
00253 * p_tva_id vw_fiche_attr.tva_id
00254 * p_tva_label vw_fiche_attr.tva_label
00255 */
00256 function SetData(i,p_id,p_label,p_sell,p_buy,p_tva_id, p_tva_label)
00257 {
00258 SetValue(i,p_id);
00259 // for the form we use 1. and for span 2.
00260 //1. document.form_detail.eval(a).value=p_buy;
00261 //2. document.getElementById(a).innerHTML=p_sell;
00262
00263 // Compute name of label ctl
00264 var a=i+'_label';
00265 document.getElementById(a).innerHTML=p_label;
00266
00267 // Compute name of sell ctl
00268 var a=i+'_sell';
00269 // if the object exist
00270 var e=document.getElementsByName(a)
00271 if ( e.length != 0 ) {
00272 SetValue(a,p_sell);
00273
00274 }
00275
00276 // Compute name of buy ctl
00277 var a=i+'_buy';
00278 // if the object exist
00279 var e=document.getElementsByName(a)
00280 if ( e.length != 0 ) {
00281 SetValue(a,p_buy);
00282 }
00283 // Compute name of tva_id ctl
00284 var a=i+'_tva_id';
00285 // if the object exist
00286 var e=document.getElementsByName(a)
00287 if ( e.length != 0 ) {
00288 SetValue(a,p_tva_id);
00289 }
00290
00291 // Compute name of tva_label ctl
00292 var a=i+'_tva_label';
00293 // if the object exist
00294 if (document.getElementById(a) ) {
00295 document.getElementById(a).innerHTML=p_tva_label;
00296 }
00297 }
00298
00299
00300 </script>
00301
00302
00303 ");
00304
00305 define ("JS_CONCERNED_OP","
00306 <script language=\"javascript\">
00307
00308 function SearchJrn(p_sessid,p_ctl)
00309 {
00310 var win=window.open('jrn_search.php?p_ctl='+p_ctl+'&PHPSESSID='+p_sessid,'Cherche','toolbar=no,width=600,height=600,scrollbars=yes');
00311 }
00312 function GetIt(p_ctl,p_value) {
00313 self.opener.SetIt(p_value,p_ctl);
00314 window.close();
00315 }
00316 /* SetValue( p_ctl,p_value )
00317 /* p_ctl is the name of the control
00318 /* p_value is the value to set in
00319 */
00320 function SetIt(p_value,p_ctl) {
00321
00322 var f=document.getElementsByName(p_ctl);
00323 for (var h=0; h < f.length; h++) {
00324 f[h].value=p_value;
00325 }
00326
00327
00328 }
00329
00330
00331 </script>
00332 ");
00333
00334 define ("JS_CALC_LINE","
00335
00336 <form name=\"calc_line\" onSubmit=\"cal()\">
00337 <input type=\"text\" size=\"20\" name=\"calculator\" onBlur=\"cal()\">
00338 Answer:<span id=\"name\"></span>
00339 <br>
00340
00341 <!-- <input type=\"button\" name=\"B1\" value=\"Calculate\" > -->
00342
00343 <input type=\"reset\" name=\"B2\" value=\"Reset\"><br>
00344
00345
00346 </form>
00347 <SCRIPT language=\"javascript\">
00348
00349 function cal()
00350 {
00351 document.getElementById(\"name\").innerHTML=
00352 eval(document.calc_line.calculator.value)
00353 }
00354 </script>
00355
00356
00357
00358 "
00359 );
00360
00361 define ("JS_TVA","<script language=\"javascript\">
00362
00363 function ChangeTVA(p_ctl,p_value) {
00364 if (document.getElementById(p_ctl) ) {
00365 var f=document.getElementsByName(p_value);
00366 for ( var i=0; i < f.length ; i++) {
00367 document.getElementById(p_ctl).innerHTML=f[i].value;
00368 }
00369 }
00370 }
00371
00372 </script>");
00373
00374 define ("SQL_LIST_ALL_INVOICE","");
00375
00376 define ("SQL_LIST_UNPAID_INVOICE"," where (jr_rapt is null or jr_rapt = '') and jr_valid = true ");
00377 define ("SQL_LIST_UNPAID_INVOICE_DATE_LIMIT" ," where (jr_rapt is null or jr_rapt = '')
00378 and to_date(to_char(jr_ech,'DD.MM.YYYY'),'DD.MM.YYYY') < to_date(to_char(now(),'DD.MM.YYYY'),'DD.MM.YYYY') and jr_valid = true" );
00379 ?>