Heray-Was-Here
Server : Apache
System : Linux mail.lomejor.cr 6.8.0-1059-azure #65~22.04.1-Ubuntu SMP Thu May 28 16:59:19 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.2.31
Disable Function : NONE
Directory :  /var/www/dev/htdocs/custom/customizeforms/class/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /var/www/dev/htdocs/custom/customizeforms/class/cron_atualizabanco.class.php
<?php




class AtualizaBanco extends CommonObject
{

 
public function LimpaTabelas() {
    
 global $db;
 
 
//  $agora=date("Y-m-d H:i:s");
//    $db->query('SET foreign_key_checks = 0');

// $query06 = "delete from  ".MAIN_DB_PREFIX."societe "; 
// $resultado06 = $db->query($query06);
 
// $query06 = "delete from  ".MAIN_DB_PREFIX."categorie"; 
// $resultado06 = $db->query($query06);
 
// $query06 = "delete from  ".MAIN_DB_PREFIX."socpeople "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."commande "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."bank_account "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."don "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  lx_events ";
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."facture "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."facture_fourn "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."mailing "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."paiement "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."paiementfourn "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."product "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."projet "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."projet_task ";
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."propal "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."propaldet "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."adherent_type "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."actioncomm "; 
// $resultado06 = $db->query($query06);


// $query06 = "delete from  llx_categorizeall_regras"; 
// $resultado06 = $db->query($query06);


// $query06 = "delete from  ".MAIN_DB_PREFIX."commande "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."commandedet "; 
// $resultado06 = $db->query($query06);
 

// $query06 = "delete from  ".MAIN_DB_PREFIX."facture"; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."facturedet "; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."bank_account"; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."paiement_facture"; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."paiement"; 
// $resultado06 = $db->query($query06);

// $query06 = "delete from  ".MAIN_DB_PREFIX."bank"; 
// $resultado06 = $db->query($query06);
 
//  $query06 = "delete from  ".MAIN_DB_PREFIX."product_stock"; 
// $resultado06 = $db->query($query06);
 
//   $query06 = "delete from  ".MAIN_DB_PREFIX."projet"; 
// $resultado06 = $db->query($query06);

//  $query06 = "delete from  ".MAIN_DB_PREFIX."projet_task"; 
// $resultado06 = $db->query($query06);
 
 
 
  
 

// $db->query('SET foreign_key_checks = 1');

// $query06 = "update  ".MAIN_DB_PREFIX."customizeforms set situacao='1', valor_padrao='', label='', conteudo='', tooltip='' where campo_nome!='cabecalho' or  campo_nome!='rodape'"; 

// $resultado06 = $db->query($query06);

 
// $query06 = "update  ".MAIN_DB_PREFIX."customizeforms set situacao='0', valor_padrao='', label='', conteudo='', tooltip='' where campo_nome='cabecalho' or  campo_nome='rodape'"; 
// $resultado06 = $db->query($query06);

// $query36 = "update  ".MAIN_DB_PREFIX."customizeforms set situacao='1', valor_padrao='<b>This is a Test Header by Customizeforms</b><br><ol> <li>Click on the tooltips to see the presentation of the modifications that were made<li>To make Invisible Fields just edit the field and select Invisible there is no example try it now!<li>Feel free to change the values in module Customizeforms<li>All values are updated daily.<li>Attention Inserting a new item may not be possible. Please note that this form is a test form and all fields have been automatically configured to understand functionality in customizeforms module.</ol>', label='This is a Test Label Header', conteudo='', tooltip='' where campo_nome='cabecalho' ";
// $resultado36 = $db->query($query36);

// $query36 = "update  ".MAIN_DB_PREFIX."customizeforms set situacao='1', valor_padrao='<b>This is a Test Footer by Customizeforms </b>', label='This is a Test Label Footer', conteudo='', tooltip='' where campo_nome='rodape' ";

// $resultado36 = $db->query($query36);

//  $query36 = "update  ".MAIN_DB_PREFIX."customizeforms set   valor_padrao='', label='', conteudo='Set content this value 1 \r\n Set content this value 2 \r\n Set content this value 3\r\n Set content this value 4', tooltip='<b>This is a Test Tooltip  by Customizeforms</b><br>The list to insert content in all text fields ' where campo_tipo='textarea' and campo_nome!='cabecalho' and  campo_nome!='rodape'";
 
// $resultado36 = $db->query($query36);

//  $query36 = "update  ".MAIN_DB_PREFIX."customizeforms set    valor_padrao='', label='', conteudo='', tooltip='<b>This is a Test Tooltip  by Customizeforms</b> ' where campo_tipo='input' and campo_nome!='cabecalho' and  campo_nome!='rodape' and rowid%7=0";
 
// $resultado36 = $db->query($query36);

//  $query36 = "update  ".MAIN_DB_PREFIX."customizeforms set    valor_padrao='', label='', conteudo='', tooltip='<b>This is a Tooltip  by Customizeforms</b>  ' where campo_tipo='input' and campo_nome!='cabecalho' and  campo_nome!='rodape' and rowid%5=0";
 
// $resultado36 = $db->query($query36);

//  $query36 = "update  ".MAIN_DB_PREFIX."customizeforms set   situacao='2',   valor_padrao='', label='', conteudo='Test 1\r\nTest 2\r\nTest 3\r\nTest 4', tooltip='<b>This is a  Tooltip  by Customizeforms</b><br>The list to insert content in all text fields in this case the input field is disabled force select by list define' where campo_tipo='input' and campo_nome!='cabecalho' and  campo_nome!='rodape' and rowid%5=0  and situacao!=3";
 
// $resultado36 = $db->query($query36);

//  $query36 = "update  ".MAIN_DB_PREFIX."customizeforms set   situacao='3',   valor_padrao='', label='', conteudo='', tooltip='<b>This is a Test Tooltip  by Customizeforms</b><br>This field is mandatory' where campo_tipo='select' and rowid%5=0";
 
// $resultado36 = $db->query($query36);

//  $query36 = "update  ".MAIN_DB_PREFIX."customizeforms set   situacao='2',   valor_padrao='', label='', conteudo='', tooltip='<b>This is  Tooltip  by Customizeforms</b><br>This field is disabled' where campo_tipo='select' and tooltip='' and situacao!=3 and rowid%3=0";
 
// $resultado36 = $db->query($query36);


//  $query36 = "update  ".MAIN_DB_PREFIX."customizeforms set     valor_padrao='Default Value by Customizeforms', label='', conteudo='', tooltip='' where campo_tipo='input'   and tooltip=''";
 
// $resultado36 = $db->query($query36);


//  $query36 = "update  ".MAIN_DB_PREFIX."customizeforms set     situacao='1',   valor_padrao='now(+10)', label='', conteudo='', tooltip='This Date is automated by customizefors<br>Just write now(0) to current day, now(+10) in default value (for 10 days later -  example) ' where  campo_nome='re' or  campo_nome='liv_' or  campo_nome='ech'  or  campo_nome='ap' or  campo_nome='p2' or  campo_nome='projectstart' or  campo_nome='projectend' or  campo_nome='datep' or  campo_nome='datev'   or  campo_nome='datesp'  or  campo_nome='dateep'   or  campo_nome='dateo'   or  campo_nome='datee'  or  campo_nome='dateofbirth'   or  campo_nome='dateemployment'   or  campo_nome='datestartvalidity'   or  campo_nome='dateendvalidity'   ";
 
 
 
 
// $resultado36 = $db->query($query36);


// $query36 = "update  ".MAIN_DB_PREFIX."customizeforms set   valor_padrao='1', label='', conteudo='', tooltip='<b>This is a  Tooltip  by Customizeforms</b><br>The default value in all extrafields is set to 1!' where extra=1";
// $resultado36 = $db->query($query36);

//   $query07 = "insert into  `".MAIN_DB_PREFIX."societe` (`rowid`,`nom`,`status`,`code_client`,`fk_typent`,`client`,`fournisseur`,`tms`,`datec`,`fk_pays`,`fk_departement`,`fk_currency`,`address`,`town`) values(1,'Test Company 1',1,'CU2001-0001',1,1,1,'".$agora."','".$agora."',56,925,'BRL','Av. Protásio Alves, 1555','Porto Alegre')"; 

//   $resultado07 = $db->query($query07);
 
//   $query07 = "insert into  `".MAIN_DB_PREFIX."societe` (`rowid`,`nom`,`status`,`code_client`,`fk_typent`,`client`,`fournisseur`,`tms`,`datec`,`fk_pays`,`fk_departement`,`fk_currency`,`address`,`town`) values(2,'Test Company 2',1,'CU2001-0002',1,1,1,'".$agora."','".$agora."',56,925,'BRL','Av. Brasil, 1555','Cachoeira do Sul')"; 

//   $resultado07 = $db->query($query07);
//   $query07 = "insert into  `".MAIN_DB_PREFIX."societe` (`rowid`,`nom`,`status`,`code_client`,`fk_typent`,`client`,`fournisseur`,`tms`,`datec`,`fk_pays`,`fk_departement`,`fk_currency`,`address`,`town`) values(3,'Test Company 3',1,'CU2001-0003',1,1,1,'".$agora."','".$agora."',56,925,'BRL','Av. Brasil, 1555','Santa Cruz do Sul')"; 

//   $resultado07 = $db->query($query07);
  
//     $query07 = "insert into  `".MAIN_DB_PREFIX."societe` (`rowid`,`nom`,`status`,`code_client`,`fk_typent`,`client`,`fournisseur`,`tms`,`datec`,`fk_pays`,`fk_departement`,`fk_currency`,`address`,`town`) values(4,'Test Company 4',1,'CU2001-0004',1,1,1,'".$agora."','".$agora."',56,928,'BRL','Av. Brasil, 1555','Florianópolis')"; 
//       $resultado07 = $db->query($query07);
      
//     $query07 = "insert into  `".MAIN_DB_PREFIX."societe` (`rowid`,`nom`,`status`,`code_client`,`fk_typent`,`client`,`fournisseur`,`tms`,`datec`,`fk_pays`,`fk_departement`,`fk_currency`,`address`,`town`) values(5,'Test Company 5',1,'CU2001-0005',1,1,1,'".$agora."','".$agora."',56,928,'BRL','Av. Brasil, 1555','Palhoça')"; 
//       $resultado07 = $db->query($query07);
      
       
//     ///Categorias
 
//          $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."categorie` (`rowid`, `entity`, `fk_parent`, `label`,  `type`, `description`,  `color`,`visible`) VALUES (1, '1', '0', 'Vendor Category Test 1', '1','Category Test 1','#b7ded2','1');";
             
//         $resultado36 = $db->query($sqlinsert);
 
//          $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."categorie` (`rowid`, `entity`, `fk_parent`, `label`,  `type`, `description`,  `color`,`visible`) VALUES (2, '1', '0', 'Customer Category Test 1', '2','Customer Category Test 1','#f6a6b2','1');";
             
//         $resultado36 = $db->query($sqlinsert);
 
 
//          $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."categorie` (`rowid`, `entity`, `fk_parent`, `label`,  `type`, `description`,  `color`,`visible`) VALUES (3, '1', '0', 'Contact Category Test 1', '4','Contact Category Test 1','#f7c297','1');";
             
//         $resultado36 = $db->query($sqlinsert);
 
//           $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."categorie` (`rowid`, `entity`, `fk_parent`, `label`,  `type`, `description`,  `color`,`visible`) VALUES (4, '1', '0', 'Product-Service Category Test 1', '0','Product-Service Category Test 1','#ffecb8','1');";
             
//         $resultado36 = $db->query($sqlinsert);
        
         
//           $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."categorie` (`rowid`, `entity`, `fk_parent`, `label`,  `type`, `description`,  `color`,`visible`) VALUES (5, '1', '0', 'FinancialAccount Category Test 1', '5','FinancialAccount Category Test 1','#90d2d8','1');";
             
//         $resultado36 = $db->query($sqlinsert);
  
  
//           $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."categorie` (`rowid`, `entity`, `fk_parent`, `label`,  `type`, `description`,  `color`,`visible`) VALUES (6, '1', '0', 'LeadOrProject Category Test 1', '6','LeadOrProject Category Test 1','#f6db5f','1');";
             
//         $resultado36 = $db->query($sqlinsert);
  
    
//           $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."categorie` (`rowid`, `entity`, `fk_parent`, `label`,  `type`, `description`,  `color`,`visible`) VALUES (7, '1', '0', 'User Category Test 1', '7','User Category Test 1','#ffb554','1');";
             
//         $resultado36 = $db->query($sqlinsert);
  
  
    
//           $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."categorie` (`rowid`, `entity`, `fk_parent`, `label`,  `type`, `description`,  `color`,`visible`) VALUES (8, '1', '0', 'Member Category Test 1', '3','Member Category Test 1','#9e3d64','1');";
             
//         $resultado36 = $db->query($sqlinsert);
        
//  $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."adherent_type` (`rowid`, `entity`, `tms`, `libelle`) VALUES (1, '1', '".$agora."', 'Member Type 1');";
             
//         $resultado36 = $db->query($sqlinsert);  
        
        
        
        
//       $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."product` (`rowid`, `ref`, `entity`, `ref_ext`, `datec`, `tms`, `fk_parent`, `label`, `description`, `note_public`, `note`, `customcode`, `fk_country`, `price`, `price_ttc`, `price_min`, `price_min_ttc`, `price_base_type`, `cost_price`, `default_vat_code`, `tva_tx`, `recuperableonly`, `localtax1_tx`, `localtax1_type`, `localtax2_tx`, `localtax2_type`, `fk_user_author`, `fk_user_modif`, `tosell`, `tobuy`, `onportal`, `tobatch`, `fk_product_type`, `duration`, `seuil_stock_alerte`, `url`, `barcode`, `fk_barcode_type`, `accountancy_code_sell`, `accountancy_code_sell_intra`, `accountancy_code_sell_export`, `accountancy_code_buy`, `partnumber`, `weight`, `weight_units`, `length`, `length_units`, `width`, `width_units`, `height`, `height_units`, `surface`, `surface_units`, `volume`, `volume_units`, `stock`, `pmp`, `fifo`, `lifo`, `fk_default_warehouse`, `canvas`, `finished`, `hidden`, `import_key`, `model_pdf`, `fk_price_expression`, `desiredstock`, `fk_unit`, `price_autogen`, `fk_project`) VALUES (1, 'Product Test 1', '1', NULL, '".$agora."', '".$agora."', '0', 'Product Test 1', '', NULL, '', '', NULL, '45.00000000', '45.00000000', '0.00000000', '0.00000000', '', NULL, NULL, '0.000', '0', '0.000', '0', '0.000', '0', '1', '1', '1', '1', '0', '0', '0', '', '0', NULL, NULL, NULL, '', '', '', '', NULL, NULL, NULL, '0', '0', NULL, NULL, '0', NULL, '0', NULL, NULL, '0', NULL, '0.00000000', NULL, NULL, NULL, '', NULL, '0', NULL, NULL, NULL, '0', NULL, '0', NULL);";
       
//             $resultado36 = $db->query($sqlinsert);  
        
  
           
//       $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."product` (`rowid`, `ref`, `entity`, `ref_ext`, `datec`, `tms`, `fk_parent`, `label`, `description`, `note_public`, `note`, `customcode`, `fk_country`, `price`, `price_ttc`, `price_min`, `price_min_ttc`, `price_base_type`, `cost_price`, `default_vat_code`, `tva_tx`, `recuperableonly`, `localtax1_tx`, `localtax1_type`, `localtax2_tx`, `localtax2_type`, `fk_user_author`, `fk_user_modif`, `tosell`, `tobuy`, `onportal`, `tobatch`, `fk_product_type`, `duration`, `seuil_stock_alerte`, `url`, `barcode`, `fk_barcode_type`, `accountancy_code_sell`, `accountancy_code_sell_intra`, `accountancy_code_sell_export`, `accountancy_code_buy`, `partnumber`, `weight`, `weight_units`, `length`, `length_units`, `width`, `width_units`, `height`, `height_units`, `surface`, `surface_units`, `volume`, `volume_units`, `stock`, `pmp`, `fifo`, `lifo`, `fk_default_warehouse`, `canvas`, `finished`, `hidden`, `import_key`, `model_pdf`, `fk_price_expression`, `desiredstock`, `fk_unit`, `price_autogen`, `fk_project`) VALUES (2, 'Product Test 2', '1', NULL, '2020-01-07 18:15:13', '2020-01-07 15:16:04', '0', 'Product Test 2', '', NULL, '', '', NULL, '145.00000000', '145.00000000', '0.00000000', '0.00000000', '', NULL, NULL, '0.000', '0', '0.000', '0', '0.000', '0', '1', '1', '1', '1', '0', '0', '0', '', '0', NULL, NULL, NULL, '', '', '', '', NULL, NULL, NULL, '0', '0', NULL, NULL, '0', NULL, '0', NULL, NULL, '0', NULL, '0.00000000', NULL, NULL, NULL, '', NULL, '0', NULL, NULL, NULL, '0', NULL, '0', NULL);";
       
//             $resultado36 = $db->query($sqlinsert);  
            
            
        
//       $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."product` (`rowid`, `ref`, `entity`, `ref_ext`, `datec`, `tms`, `fk_parent`, `label`, `description`, `note_public`, `note`, `customcode`, `fk_country`, `price`, `price_ttc`, `price_min`, `price_min_ttc`, `price_base_type`, `cost_price`, `default_vat_code`, `tva_tx`, `recuperableonly`, `localtax1_tx`, `localtax1_type`, `localtax2_tx`, `localtax2_type`, `fk_user_author`, `fk_user_modif`, `tosell`, `tobuy`, `onportal`, `tobatch`, `fk_product_type`, `duration`, `seuil_stock_alerte`, `url`, `barcode`, `fk_barcode_type`, `accountancy_code_sell`, `accountancy_code_sell_intra`, `accountancy_code_sell_export`, `accountancy_code_buy`, `partnumber`, `weight`, `weight_units`, `length`, `length_units`, `width`, `width_units`, `height`, `height_units`, `surface`, `surface_units`, `volume`, `volume_units`, `stock`, `pmp`, `fifo`, `lifo`, `fk_default_warehouse`, `canvas`, `finished`, `hidden`, `import_key`, `model_pdf`, `fk_price_expression`, `desiredstock`, `fk_unit`, `price_autogen`, `fk_project`) VALUES (3, 'Product Test 3', '1', NULL, '".$agora."', '".$agora."', '0', 'Product Test 3', '', NULL, '', '', NULL, '195.00000000', '195.00000000', '0.00000000', '0.00000000', '', NULL, NULL, '0.000', '0', '0.000', '0', '0.000', '0', '1', '1', '1', '1', '0', '0', '0', '', '0', NULL, NULL, NULL, '', '', '', '', NULL, NULL, NULL, '0', '0', NULL, NULL, '0', NULL, '0', NULL, NULL, '0', NULL, '0.00000000', NULL, NULL, NULL, '', NULL, '0', NULL, NULL, NULL, '0', NULL, '0', NULL);";
       
//             $resultado36 = $db->query($sqlinsert);  
  
  
        
//       $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."product` (`rowid`, `ref`, `entity`, `ref_ext`, `datec`, `tms`, `fk_parent`, `label`, `description`, `note_public`, `note`, `customcode`, `fk_country`, `price`, `price_ttc`, `price_min`, `price_min_ttc`, `price_base_type`, `cost_price`, `default_vat_code`, `tva_tx`, `recuperableonly`, `localtax1_tx`, `localtax1_type`, `localtax2_tx`, `localtax2_type`, `fk_user_author`, `fk_user_modif`, `tosell`, `tobuy`, `onportal`, `tobatch`, `fk_product_type`, `duration`, `seuil_stock_alerte`, `url`, `barcode`, `fk_barcode_type`, `accountancy_code_sell`, `accountancy_code_sell_intra`, `accountancy_code_sell_export`, `accountancy_code_buy`, `partnumber`, `weight`, `weight_units`, `length`, `length_units`, `width`, `width_units`, `height`, `height_units`, `surface`, `surface_units`, `volume`, `volume_units`, `stock`, `pmp`, `fifo`, `lifo`, `fk_default_warehouse`, `canvas`, `finished`, `hidden`, `import_key`, `model_pdf`, `fk_price_expression`, `desiredstock`, `fk_unit`, `price_autogen`, `fk_project`) VALUES (4, 'Product Test 4', '1', NULL, '".$agora."', '".$agora."', '0', 'Product Test 4', '', NULL, '', '', NULL, '195.00000000', '195.00000000', '0.00000000', '0.00000000', '', NULL, NULL, '0.000', '0', '0.000', '0', '0.000', '0', '1', '1', '1', '1', '0', '0', '0', '', '0', NULL, NULL, NULL, '', '', '', '', NULL, NULL, NULL, '0', '0', NULL, NULL, '0', NULL, '0', NULL, NULL, '0', NULL, '0.00000000', NULL, NULL, NULL, '', NULL, '0', NULL, NULL, NULL, '0', NULL, '0', NULL);";
       
//             $resultado36 = $db->query($sqlinsert); 
            
              
//       $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."product` (`rowid`, `ref`, `entity`, `ref_ext`, `datec`, `tms`, `fk_parent`, `label`, `description`, `note_public`, `note`, `customcode`, `fk_country`, `price`, `price_ttc`, `price_min`, `price_min_ttc`, `price_base_type`, `cost_price`, `default_vat_code`, `tva_tx`, `recuperableonly`, `localtax1_tx`, `localtax1_type`, `localtax2_tx`, `localtax2_type`, `fk_user_author`, `fk_user_modif`, `tosell`, `tobuy`, `onportal`, `tobatch`, `fk_product_type`, `duration`, `seuil_stock_alerte`, `url`, `barcode`, `fk_barcode_type`, `accountancy_code_sell`, `accountancy_code_sell_intra`, `accountancy_code_sell_export`, `accountancy_code_buy`, `partnumber`, `weight`, `weight_units`, `length`, `length_units`, `width`, `width_units`, `height`, `height_units`, `surface`, `surface_units`, `volume`, `volume_units`, `stock`, `pmp`, `fifo`, `lifo`, `fk_default_warehouse`, `canvas`, `finished`, `hidden`, `import_key`, `model_pdf`, `fk_price_expression`, `desiredstock`, `fk_unit`, `price_autogen`, `fk_project`) VALUES (5, 'Service Test 1', '1', NULL, '".$agora."', '".$agora."', '0', 'Service Test 1', '', NULL, '', '', NULL, '195.00000000', '195.00000000', '0.00000000', '0.00000000', '', NULL, NULL, '0.000', '0', '0.000', '0', '0.000', '0', '1', '1', '1', '1', '0', '0', '1', '', '0', NULL, NULL, NULL, '', '', '', '', NULL, NULL, NULL, '0', '0', NULL, NULL, '0', NULL, '0', NULL, NULL, '0', NULL, '0.00000000', NULL, NULL, NULL, '', NULL, '0', NULL, NULL, NULL, '0', NULL, '0', NULL);";
       
//             $resultado36 = $db->query($sqlinsert);  
            
            
            
              
//       $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."product` (`rowid`, `ref`, `entity`, `ref_ext`, `datec`, `tms`, `fk_parent`, `label`, `description`, `note_public`, `note`, `customcode`, `fk_country`, `price`, `price_ttc`, `price_min`, `price_min_ttc`, `price_base_type`, `cost_price`, `default_vat_code`, `tva_tx`, `recuperableonly`, `localtax1_tx`, `localtax1_type`, `localtax2_tx`, `localtax2_type`, `fk_user_author`, `fk_user_modif`, `tosell`, `tobuy`, `onportal`, `tobatch`, `fk_product_type`, `duration`, `seuil_stock_alerte`, `url`, `barcode`, `fk_barcode_type`, `accountancy_code_sell`, `accountancy_code_sell_intra`, `accountancy_code_sell_export`, `accountancy_code_buy`, `partnumber`, `weight`, `weight_units`, `length`, `length_units`, `width`, `width_units`, `height`, `height_units`, `surface`, `surface_units`, `volume`, `volume_units`, `stock`, `pmp`, `fifo`, `lifo`, `fk_default_warehouse`, `canvas`, `finished`, `hidden`, `import_key`, `model_pdf`, `fk_price_expression`, `desiredstock`, `fk_unit`, `price_autogen`, `fk_project`) VALUES (6, 'Service Test 2', '1', NULL, '".$agora."', '".$agora."', '0', 'Service Test 2', '', NULL, '', '', NULL, '195.00000000', '195.00000000', '0.00000000', '0.00000000', '', NULL, NULL, '0.000', '0', '0.000', '0', '0.000', '0', '1', '1', '1', '1', '0', '0', '1', '', '0', NULL, NULL, NULL, '', '', '', '', NULL, NULL, NULL, '0', '0', NULL, NULL, '0', NULL, '0', NULL, NULL, '0', NULL, '0.00000000', NULL, NULL, NULL, '', NULL, '0', NULL, NULL, NULL, '0', NULL, '0', NULL);";
       
//             $resultado36 = $db->query($sqlinsert);  
            
            
            
              
//       $sqlinsert = "INSERT INTO `".MAIN_DB_PREFIX."product` (`rowid`, `ref`, `entity`, `ref_ext`, `datec`, `tms`, `fk_parent`, `label`, `description`, `note_public`, `note`, `customcode`, `fk_country`, `price`, `price_ttc`, `price_min`, `price_min_ttc`, `price_base_type`, `cost_price`, `default_vat_code`, `tva_tx`, `recuperableonly`, `localtax1_tx`, `localtax1_type`, `localtax2_tx`, `localtax2_type`, `fk_user_author`, `fk_user_modif`, `tosell`, `tobuy`, `onportal`, `tobatch`, `fk_product_type`, `duration`, `seuil_stock_alerte`, `url`, `barcode`, `fk_barcode_type`, `accountancy_code_sell`, `accountancy_code_sell_intra`, `accountancy_code_sell_export`, `accountancy_code_buy`, `partnumber`, `weight`, `weight_units`, `length`, `length_units`, `width`, `width_units`, `height`, `height_units`, `surface`, `surface_units`, `volume`, `volume_units`, `stock`, `pmp`, `fifo`, `lifo`, `fk_default_warehouse`, `canvas`, `finished`, `hidden`, `import_key`, `model_pdf`, `fk_price_expression`, `desiredstock`, `fk_unit`, `price_autogen`, `fk_project`) VALUES (7, 'Service Test 3', '1', NULL, '".$agora."', '".$agora."', '0', 'Service Test 3', '', NULL, '', '', NULL, '195.00000000', '195.00000000', '0.00000000', '0.00000000', '', NULL, NULL, '0.000', '0', '0.000', '0', '0.000', '0', '1', '1', '1', '1', '0', '0', '1', '', '0', NULL, NULL, NULL, '', '', '', '', NULL, NULL, NULL, '0', '0', NULL, NULL, '0', NULL, '0', NULL, NULL, '0', NULL, '0.00000000', NULL, NULL, NULL, '', NULL, '0', NULL, NULL, NULL, '0', NULL, '0', NULL);";
       
//             $resultado36 = $db->query($sqlinsert);  
            
            
            
// $sql31 = "update  ".MAIN_DB_PREFIX."product set seuil_stock_alerte=60, stock=45, desiredstock=100,fk_barcode_type=6 where rowid=1" ;
// $resultp31 = $db->query($sql31); 


// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."product_stock` (`rowid`, `tms`, `fk_product`, `fk_entrepot`, `reel`, `import_key`) VALUES (1, '".$agora."', '1', '1', '45', NULL);";
// $resultp31 = $db->query($sql31); 

// $sql31 = "update  ".MAIN_DB_PREFIX."product set seuil_stock_alerte=30, stock=777, desiredstock=100,fk_barcode_type=6  where rowid=2" ;
// $resultp31 = $db->query($sql31); 


// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."product_stock` (`rowid`, `tms`, `fk_product`, `fk_entrepot`, `reel`, `import_key`) VALUES (2, '".$agora."', '2', '1', '777', NULL);";
// $resultp31 = $db->query($sql31); 


// $sql31 = "update  ".MAIN_DB_PREFIX."product set seuil_stock_alerte=30, stock=16, desiredstock=100  where rowid=3" ;
// $resultp31 = $db->query($sql31); 


// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."product_stock` (`rowid`, `tms`, `fk_product`, `fk_entrepot`, `reel`, `import_key`) VALUES (3, '".$agora."', '3', '1', '16', NULL);";
// $resultp31 = $db->query($sql31); 


// $sql31 = "update  ".MAIN_DB_PREFIX."product set seuil_stock_alerte=30, stock=26, desiredstock=100  where rowid=4" ;
// $resultp31 = $db->query($sql31); 


// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."product_stock` (`rowid`, `tms`, `fk_product`, `fk_entrepot`, `reel`, `import_key`) VALUES (4, '".$agora."', '4', '1', '26', NULL);";
// $resultp31 = $db->query($sql31); 


                   
//             $codigo="CO2001-0002";

//              $cliente="ORDER TEST #2";
//              $empresa="2";
//              $notapublica="ORDER TEST 2";
//              $nova=2;
             
// $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande (";
//         $sql.= "rowid";
//         $sql.= ", ref";
//         $sql.= ", ref_client";
//         $sql.= ", fk_soc";
//         $sql.= ", tms";
//         $sql.= ", date_creation";
//         $sql.= ", date_valid";
//         $sql.= ", date_commande";
//         $sql.= ", fk_statut";
//         $sql.= ", amount_ht";
//         $sql.= ", remise";
//         $sql.= ", total_ht";
//         $sql.= ", fk_user_author";
//         $sql.= ", note_private";
//         $sql.= ", note_public";
//         $sql.= ", model_pdf";
 
        	
//         $sql.= ", fk_cond_reglement";
//         $sql.= ", fk_mode_reglement";
//         $sql.= ", fk_multicurrency";
//         $sql.= ", multicurrency_code";
//         $sql.= ", multicurrency_tx"; 
		
//         $sql.= ") ";
//         $sql.= " VALUES (";
//         $sql.= $nova;
//         $sql.= ",'".$codigo."'";
//         $sql.= ",'".utf8_decode($cliente)."'";
//         $sql.= ",'".utf8_decode($empresa)."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ", 1";
//         $sql.= ", 0";
//         $sql.= ", 0";
//         $sql.= ", 0";
//         $sql.= ", '1'";
//         $sql.= ",'".utf8_decode($notapublica)."'";
//         $sql.= ",''";
//         $sql.= ", 'einstein'";
 
//         $sql.= ", 1";
//         $sql.= ", 0";
//         $sql.= ", 0";
//         $sql.= ", 'BRL'";
//         $sql.= ", 1";
 

//         $sql.= ");";
 
                 
//  $resultp = $db->query($sql);
 
 
            
//  $_SESSION["shopping_cart"][$i]["product_id"]=3;
//  $_SESSION["shopping_cart"][$i]["product_quantity"]=20;
 
//  $diasent = 10;  
// $nday = time() + ( 24 * 60 * 60 *$diasent);    
// $datae=date("Y-m-d h:i:s");
// $datae2=date("Y-m-d H:i:s", $nday);


//  $query2 = "SELECT price, label   FROM `".MAIN_DB_PREFIX."product` where `rowid`='".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $result2 = $db->query($query2);
// $row = mysqli_fetch_object($result2);



// $preco=$row->price;
// $_SESSION["shopping_cart"][$i]["product_name"]=$row->label;
// $descricao=$row->label;

// $quantidade=$_SESSION["shopping_cart"][$i]["product_quantity"];
// $taxas=0;
// $total_ht=$quantidade*$preco;
// $total_tva=$quantidade*$taxas;
// $total_ttc=$total_ht+$total_tva;

//  $descricao=$_SESSION["shopping_cart"][$i]["product_name"];
 
 
      
// $sql3 = "INSERT INTO ".MAIN_DB_PREFIX."commandedet (";
// $sql3.= "fk_commande";

// $sql3.= ",fk_product";

// $sql3.= ", description";
// $sql3.= ", tva_tx";
// $sql3.= ", qty";
// $sql3.= ", remise_percent";
// $sql3.= ", price";
// $sql3.= ", subprice";
// $sql3.= ", total_ht";
// $sql3.= ", total_tva";
// $sql3.= ", total_ttc";
// $sql3.= ", product_type";
// // $sql3.= ", date_start";
// // $sql3.= ", date_end";
// $sql3.= ", rang";
// $sql3.= ", multicurrency_code";
// $sql3.= ", multicurrency_subprice";
// $sql3.= ", multicurrency_total_ht";
// $sql3.= ", multicurrency_total_tva";
// $sql3.= ", multicurrency_total_ttc";
// $sql3.= ") ";
// $sql3.= " VALUES (";
// $sql3.= "'".$nova."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $sql3.= ",'".utf8_decode($descricao)."'";
// $sql3.= ",'".$taxas."'";
// $sql3.= ",'".$quantidade."'";
// $sql3.= ",'".$desconto."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_tipo"]."'";	
// // $sql3.= ",'".$datae."'";			
// // $sql3.= ",'".$datae2."'";
// $sql3.= ",'".($ordemg!=""?$ordemg:$order_id)."'";			
// $sql3.= ",'BRL'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";

// $sql3.= ");";
 
   
// $resultp3 = $db->query($sql3);

  
// $sql31 = "update  ".MAIN_DB_PREFIX."commande set total_ht=total_ht+".$total_ht.", tva=tva+".$total_tva.", total_ttc=total_ttc+".$total_ht.", multicurrency_total_ht=multicurrency_total_ht+".$total_ht.", multicurrency_total_tva=multicurrency_total_tva+".$total_tva.", multicurrency_total_ttc=multicurrency_total_ttc+".$total_ht." where rowid=".$nova."" ;








// //NOvo orçamento

 
//  $_SESSION["shopping_cart"][$i]["product_id"]=2;
//  $_SESSION["shopping_cart"][$i]["product_quantity"]=20;
 
//  $diasent = 10;  
// $nday = time() + ( 24 * 60 * 60 *$diasent);    
// $datae=date("Y-m-d h:i:s");
// $datae2=date("Y-m-d H:i:s", $nday);


//  $query2 = "SELECT price, label   FROM `".MAIN_DB_PREFIX."product` where `rowid`='".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $result2 = $db->query($query2);
// $row = mysqli_fetch_object($result2);



// $preco=$row->price;
// $_SESSION["shopping_cart"][$i]["product_name"]=$row->label;
// $descricao=$row->label;

// $quantidade=$_SESSION["shopping_cart"][$i]["product_quantity"];
// $taxas=0;
// $total_ht=$quantidade*$preco;
// $total_tva=$quantidade*$taxas;
// $total_ttc=$total_ht+$total_tva;

//  $descricao=$_SESSION["shopping_cart"][$i]["product_name"];
 
 
      
// $sql3 = "INSERT INTO ".MAIN_DB_PREFIX."commandedet (";
// $sql3.= "fk_commande";

// $sql3.= ",fk_product";

// $sql3.= ", description";
// $sql3.= ", tva_tx";
// $sql3.= ", qty";
// $sql3.= ", remise_percent";
// $sql3.= ", price";
// $sql3.= ", subprice";
// $sql3.= ", total_ht";
// $sql3.= ", total_tva";
// $sql3.= ", total_ttc";
// $sql3.= ", product_type";
// // $sql3.= ", date_start";
// // $sql3.= ", date_end";
// $sql3.= ", rang";
// $sql3.= ", multicurrency_code";
// $sql3.= ", multicurrency_subprice";
// $sql3.= ", multicurrency_total_ht";
// $sql3.= ", multicurrency_total_tva";
// $sql3.= ", multicurrency_total_ttc";
// $sql3.= ") ";
// $sql3.= " VALUES (";
// $sql3.= "'".$nova."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $sql3.= ",'".utf8_decode($descricao)."'";
// $sql3.= ",'".$taxas."'";
// $sql3.= ",'".$quantidade."'";
// $sql3.= ",'".$desconto."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_tipo"]."'";	
// // $sql3.= ",'".$datae."'";			
// // $sql3.= ",'".$datae2."'";
// $sql3.= ",'".($ordemg!=""?$ordemg:$order_id)."'";			
// $sql3.= ",'BRL'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";

// $sql3.= ");";
 
   
// $resultp3 = $db->query($sql3);

  
// $sql31 = "update  ".MAIN_DB_PREFIX."commande set total_ht=total_ht+".$total_ht.", tva=tva+".$total_tva.", total_ttc=total_ttc+".$total_ht.", multicurrency_total_ht=multicurrency_total_ht+".$total_ht.", multicurrency_total_tva=multicurrency_total_tva+".$total_tva.", multicurrency_total_ttc=multicurrency_total_ttc+".$total_ht." where rowid=".$nova."" ;
    
// $resultp31 = $db->query($sql31); 

//             $codigo="CO2001-0001";

//              $cliente="ORDER TEST #1";
//              $empresa="1";
//              $notapublica="COMMANDE TEST";
//              $nova=1;
             
// $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande (";
//         $sql.= "rowid";
//         $sql.= ", ref";
//         $sql.= ", ref_client";
//         $sql.= ", fk_soc";
//         $sql.= ", tms";
//         $sql.= ", date_creation";
//         $sql.= ", date_valid";
//         $sql.= ", date_commande";
//         $sql.= ", fk_statut";
//         $sql.= ", amount_ht";
//         $sql.= ", remise";
//         $sql.= ", total_ht";
//         $sql.= ", fk_user_author";
//         $sql.= ", note_private";
//         $sql.= ", note_public";
//         $sql.= ", model_pdf";
 
        	
//         $sql.= ", fk_cond_reglement";
//         $sql.= ", fk_mode_reglement";
//         $sql.= ", fk_multicurrency";
//         $sql.= ", multicurrency_code";
//         $sql.= ", multicurrency_tx"; 
		
//         $sql.= ") ";
//         $sql.= " VALUES (";
//         $sql.= $nova;
//         $sql.= ",'".$codigo."'";
//         $sql.= ",'".utf8_decode($cliente)."'";
//         $sql.= ",'".utf8_decode($empresa)."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ", 1";
//         $sql.= ", 0";
//         $sql.= ", 0";
//         $sql.= ", 0";
//         $sql.= ", '1'";
//         $sql.= ",'".utf8_decode($notapublica)."'";
//         $sql.= ",''";
//         $sql.= ", 'einstein'";
 
//         $sql.= ", 1";
//         $sql.= ", 0";
//         $sql.= ", 0";
//         $sql.= ", 'BRL'";
//         $sql.= ", 1";
 

//         $sql.= ");";
 
                 
//  $resultp = $db->query($sql);
 
 
            
//  $_SESSION["shopping_cart"][$i]["product_id"]=1;
//  $_SESSION["shopping_cart"][$i]["product_quantity"]=20;
 
//  $diasent = 10;  
// $nday = time() + ( 24 * 60 * 60 *$diasent);    
// $datae=date("Y-m-d h:i:s");
// $datae2=date("Y-m-d H:i:s", $nday);


//  $query2 = "SELECT price, label   FROM `".MAIN_DB_PREFIX."product` where `rowid`='".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $result2 = $db->query($query2);
// $row = mysqli_fetch_object($result2);



// $preco=$row->price;
// $_SESSION["shopping_cart"][$i]["product_name"]=$row->label;
// $descricao=$row->label;

// $quantidade=$_SESSION["shopping_cart"][$i]["product_quantity"];
// $taxas=0;
// $total_ht=$quantidade*$preco;
// $total_tva=$quantidade*$taxas;
// $total_ttc=$total_ht+$total_tva;

//  $descricao=$_SESSION["shopping_cart"][$i]["product_name"];
 
 
      
// $sql3 = "INSERT INTO ".MAIN_DB_PREFIX."commandedet (";
// $sql3.= "fk_commande";

// $sql3.= ",fk_product";

// $sql3.= ", description";
// $sql3.= ", tva_tx";
// $sql3.= ", qty";
// $sql3.= ", remise_percent";
// $sql3.= ", price";
// $sql3.= ", subprice";
// $sql3.= ", total_ht";
// $sql3.= ", total_tva";
// $sql3.= ", total_ttc";
// $sql3.= ", product_type";
// // $sql3.= ", date_start";
// // $sql3.= ", date_end";
// $sql3.= ", rang";
// $sql3.= ", multicurrency_code";
// $sql3.= ", multicurrency_subprice";
// $sql3.= ", multicurrency_total_ht";
// $sql3.= ", multicurrency_total_tva";
// $sql3.= ", multicurrency_total_ttc";
// $sql3.= ") ";
// $sql3.= " VALUES (";
// $sql3.= "'".$nova."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $sql3.= ",'".utf8_decode($descricao)."'";
// $sql3.= ",'".$taxas."'";
// $sql3.= ",'".$quantidade."'";
// $sql3.= ",'".$desconto."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_tipo"]."'";	
// // $sql3.= ",'".$datae."'";			
// // $sql3.= ",'".$datae2."'";
// $sql3.= ",'".($ordemg!=""?$ordemg:$order_id)."'";			
// $sql3.= ",'BRL'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";

// $sql3.= ");";
 
   
// $resultp3 = $db->query($sql3);

  
// $sql31 = "update  ".MAIN_DB_PREFIX."commande set total_ht=total_ht+".$total_ht.", tva=tva+".$total_tva.", total_ttc=total_ttc+".$total_ht.", multicurrency_total_ht=multicurrency_total_ht+".$total_ht.", multicurrency_total_tva=multicurrency_total_tva+".$total_tva.", multicurrency_total_ttc=multicurrency_total_ttc+".$total_ht." where rowid=".$nova."" ;

 
//  $_SESSION["shopping_cart"][$i]["product_id"]=3;
//  $_SESSION["shopping_cart"][$i]["product_quantity"]=20;
 
//  $diasent = 10;  
// $nday = time() + ( 24 * 60 * 60 *$diasent);    
// $datae=date("Y-m-d h:i:s");
// $datae2=date("Y-m-d H:i:s", $nday);


//  $query2 = "SELECT price, label   FROM `".MAIN_DB_PREFIX."product` where `rowid`='".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $result2 = $db->query($query2);
// $row = mysqli_fetch_object($result2);



// $preco=$row->price;
// $_SESSION["shopping_cart"][$i]["product_name"]=$row->label;
// $descricao=$row->label;

// $quantidade=$_SESSION["shopping_cart"][$i]["product_quantity"];
// $taxas=0;
// $total_ht=$quantidade*$preco;
// $total_tva=$quantidade*$taxas;
// $total_ttc=$total_ht+$total_tva;

//  $descricao=$_SESSION["shopping_cart"][$i]["product_name"];
 
 
      
// $sql3 = "INSERT INTO ".MAIN_DB_PREFIX."commandedet (";
// $sql3.= "fk_commande";

// $sql3.= ",fk_product";

// $sql3.= ", description";
// $sql3.= ", tva_tx";
// $sql3.= ", qty";
// $sql3.= ", remise_percent";
// $sql3.= ", price";
// $sql3.= ", subprice";
// $sql3.= ", total_ht";
// $sql3.= ", total_tva";
// $sql3.= ", total_ttc";
// $sql3.= ", product_type";
// // $sql3.= ", date_start";
// // $sql3.= ", date_end";
// $sql3.= ", rang";
// $sql3.= ", multicurrency_code";
// $sql3.= ", multicurrency_subprice";
// $sql3.= ", multicurrency_total_ht";
// $sql3.= ", multicurrency_total_tva";
// $sql3.= ", multicurrency_total_ttc";
// $sql3.= ") ";
// $sql3.= " VALUES (";
// $sql3.= "'".$nova."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $sql3.= ",'".utf8_decode($descricao)."'";
// $sql3.= ",'".$taxas."'";
// $sql3.= ",'".$quantidade."'";
// $sql3.= ",'".$desconto."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_tipo"]."'";	
// // $sql3.= ",'".$datae."'";			
// // $sql3.= ",'".$datae2."'";
// $sql3.= ",'".($ordemg!=""?$ordemg:$order_id)."'";			
// $sql3.= ",'BRL'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";

// $sql3.= ");";
 
   
// $resultp3 = $db->query($sql3);

  
// $sql31 = "update  ".MAIN_DB_PREFIX."commande set total_ht=total_ht+".$total_ht.", tva=tva+".$total_tva.", total_ttc=total_ttc+".$total_ht.", multicurrency_total_ht=multicurrency_total_ht+".$total_ht.", multicurrency_total_tva=multicurrency_total_tva+".$total_tva.", multicurrency_total_ttc=multicurrency_total_ttc+".$total_ht." where rowid=".$nova."" ;
    
// $resultp31 = $db->query($sql31); 


 
// $sql31 = "INSERT INTO `llx_categorizeall_regras` (`rowid`, `regra_nome`, `regra_tipo`, `regra_texto`, `form_nome`, `situacao`, `json`, `quant`, `ids`, `idcat`, `modif`, `cor`, `ini`, `fim`) VALUES (1, 'Best Orders Customer Validated/Pay 2020', '2', 'If <b>Orders-Customer</b> <font color=blue>In the break</font> <b>Values between 0 and 100000</b> ( between 2020-01-01  and 2021-01-01 Situation Validated / Confirmed<font color=red> or</font>  Situation Billing / Payment)<br>', 'ThirdParty', '2', '{\"form\":\"ThirdParty\",\"nomecat\":\"Best Orders Customer Validated/Pay 2020\",\"edita\":\"0\",\"0\":{\"id\":\"2\",\"tipo\":\"input\",\"label\":\"Orders-Customer\",\"nome\":\"commande_count\",\"banco\":\"commande_count\",\"extra\":\"0\",\"operador\":\"5\",\"textooperador\":\"In the break\",\"textovalorpadrao\":\"<b>Values between 0 and 100000</b> ( between 2020-01-01  and 2021-01-01 Situation Validated / Confirmed<font color=red> or</font>  Situation Billing / Payment)\",\"dadosvalorpadrao\":{\"0\":{\"0\":\"0\",\"1\":\"100000\",\"2\":\"2020-01-01\",\"3\":\"2021-01-01\",\"4\":\"1\",\"5\":\"1\"},\"1\":{\"0\":\"0\",\"1\":\"100000\",\"2\":\"2020-01-01\",\"3\":\"2021-01-01\",\"4\":\"4\",\"5\":\"1\"}}}}', '2', '1, 2', '11', '2020-01-08 20:03:24', 'ff7f00', '0000-00-00', '0000-00-00');";
    
// $resultp31 = $db->query($sql31); 
   
// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie` (`rowid`, `entity`, `fk_parent`, `label`, `type`, `description`, `color`,`visible`) VALUES (11, '1', '0', 'Best Orders Customer Validated/Pay 2020', '2','[CategorizeAll] If Orders-Customer In the break Values between 0 and 100000 ( between 2020-01-01 and 2021-01-01 Situation Validated / Confirmed or Situation Billing / Payment)','ff7f00','0');";
// $resultp31 = $db->query($sql31); 
// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie_societe` (`fk_categorie`, `fk_soc`) VALUES ('11', '1');";

// $resultp31 = $db->query($sql31); 
// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie_societe` (`fk_categorie`, `fk_soc`) VALUES ('11', ' 2');";
// $resultp31 = $db->query($sql31); 




// $sql31 = "INSERT INTO `llx_categorizeall_regras` (`rowid`, `regra_nome`, `regra_tipo`, `regra_texto`, `form_nome`, `situacao`, `json`, `quant`, `ids`, `idcat`, `modif`, `cor`, `ini`, `fim`) VALUES (2, 'Brasil Customer', '2', 'If <b>Prospect / Customer</b> <font color=blue>Equal</font> Customer<br>If <b>Country</b> <font color=blue>Equal</font> Brazil%20(BR)<br>', 'ThirdParty', '2', '{\\\"form\\\":\\\"ThirdParty\\\",\\\"nomecat\\\":\\\"Brasil Customers \\\",\\\"edita\\\":\\\"16\\\",\\\"0\\\":{\\\"id\\\":\\\"1\\\",\\\"tipo\\\":\\\"select\\\",\\\"label\\\":\\\"Prospect+%2F+Customer\\\",\\\"nome\\\":\\\"client\\\",\\\"banco\\\":\\\"client\\\",\\\"extra\\\":\\\"0\\\",\\\"operador\\\":\\\"1\\\",\\\"textooperador\\\":\\\"Equal\\\",\\\"dadosvalorpadrao\\\":{\\\"0\\\":\\\"1\\\"},\\\"textovalorpadrao\\\":\\\"Customer\\\"},\\\"1\\\":{\\\"id\\\":\\\"1\\\",\\\"tipo\\\":\\\"select\\\",\\\"label\\\":\\\"Country\\\",\\\"nome\\\":\\\"country_id\\\",\\\"banco\\\":\\\"fk_pays\\\",\\\"extra\\\":\\\"0\\\",\\\"operador\\\":\\\"1\\\",\\\"textooperador\\\":\\\"Equal\\\",\\\"dadosvalorpadrao\\\":{\\\"0\\\":\\\"56\\\"},\\\"textovalorpadrao\\\":\\\"Brazil%20(BR)\\\"}}', '5', '1, 2, 3, 4, 5', '12', '2020-01-08 20:32:37', 'ffbf00', '0000-00-00', '0000-00-00');";

// $resultp31 = $db->query($sql31); 

// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie` (`rowid`, `entity`, `fk_parent`, `label`, `type`, `description`, `color`,`visible`) VALUES (12, '1', '0', 'Brasil Customers ', '2','[CategorizeAll] If Prospect / Customer Equal Customer If Country Equal Brazil (BR)','ffbf00','0');";
// $resultp31 = $db->query($sql31); 
// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie_societe` (`fk_categorie`, `fk_soc`) VALUES ('12', '1');";
// $resultp31 = $db->query($sql31); 
// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie_societe` (`fk_categorie`, `fk_soc`) VALUES ('12', ' 2');";
// $resultp31 = $db->query($sql31); 
// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie_societe` (`fk_categorie`, `fk_soc`) VALUES ('12', ' 3');";
// $resultp31 = $db->query($sql31); 
// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie_societe` (`fk_categorie`, `fk_soc`) VALUES ('12', ' 4');";
// $resultp31 = $db->query($sql31); 
// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie_societe` (`fk_categorie`, `fk_soc`) VALUES ('12', ' 5');";
// $resultp31 = $db->query($sql31); 




// $sql31 = "INSERT INTO `llx_categorizeall_regras` (`rowid`, `regra_nome`, `regra_tipo`, `regra_texto`, `form_nome`, `situacao`, `json`, `quant`, `ids`, `idcat`, `modif`, `cor`, `ini`, `fim`) VALUES (5, 'Rio Grande do Sul Customers', '2', 'If <b>Prospect / Customer</b> <font color=blue>Equal</font> Customer<br>If <b>Country</b> <font color=blue>Equal</font> Brazil%20(BR)<br>If <b>Region - State</b> <font color=blue>Equal</font> RS%20-%20Rio%20Grande%20do%20Sul<br>', 'ThirdParty', '2', '{\\\"form\\\":\\\"ThirdParty\\\",\\\"nomecat\\\":\\\"Rio Grande do Sul Customers \\\",\\\"edita\\\":\\\"16\\\",\\\"0\\\":{\\\"id\\\":\\\"1\\\",\\\"tipo\\\":\\\"select\\\",\\\"label\\\":\\\"Prospect+%2F+Customer\\\",\\\"nome\\\":\\\"client\\\",\\\"banco\\\":\\\"client\\\",\\\"extra\\\":\\\"0\\\",\\\"operador\\\":\\\"1\\\",\\\"textooperador\\\":\\\"Equal\\\",\\\"dadosvalorpadrao\\\":{\\\"0\\\":\\\"1\\\"},\\\"textovalorpadrao\\\":\\\"Customer\\\"},\\\"1\\\":{\\\"id\\\":\\\"1\\\",\\\"tipo\\\":\\\"select\\\",\\\"label\\\":\\\"Country\\\",\\\"nome\\\":\\\"country_id\\\",\\\"banco\\\":\\\"fk_pays\\\",\\\"extra\\\":\\\"0\\\",\\\"operador\\\":\\\"1\\\",\\\"textooperador\\\":\\\"Equal\\\",\\\"dadosvalorpadrao\\\":{\\\"0\\\":\\\"56\\\"},\\\"textovalorpadrao\\\":\\\"Brazil%20(BR)\\\"},\\\"2\\\":{\\\"id\\\":\\\"2\\\",\\\"tipo\\\":\\\"select\\\",\\\"label\\\":\\\"Region+-+State\\\",\\\"nome\\\":\\\"state_id\\\",\\\"banco\\\":\\\"fk_departement\\\",\\\"extra\\\":\\\"0\\\",\\\"operador\\\":\\\"1\\\",\\\"textooperador\\\":\\\"Equal\\\",\\\"dadosvalorpadrao\\\":{\\\"0\\\":\\\"925\\\"},\\\"textovalorpadrao\\\":\\\"RS%20-%20Rio%20Grande%20do%20Sul\\\"}}', '3', '1, 2, 3', '13', '2020-01-08 20:35:34', 'bf0000', '0000-00-00', '0000-00-00');";

// $resultp31 = $db->query($sql31); 


// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie` (`rowid`, `entity`, `fk_parent`, `label`, `type`, `description`, `color`,`visible`) VALUES (13, '1', '0', 'Rio Grande do Sul Customers ', '2','[CategorizeAll] If Prospect / Customer Equal Customer If Country Equal Brazil (BR) If Region - State Equal RS - Rio Grande do Sul','bf0000','0');";

// $resultp31 = $db->query($sql31); 

// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie_societe` (`fk_categorie`, `fk_soc`) VALUES ('13', '1');";

// $resultp31 = $db->query($sql31); 
// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie_societe` (`fk_categorie`, `fk_soc`) VALUES ('13', ' 2');";

// $resultp31 = $db->query($sql31); 
// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie_societe` (`fk_categorie`, `fk_soc`) VALUES ('13', ' 3');";

// $resultp31 = $db->query($sql31); 








// //NOvo orçamento

 
//  $_SESSION["shopping_cart"][$i]["product_id"]=2;
//  $_SESSION["shopping_cart"][$i]["product_quantity"]=20;
 
//  $diasent = 10;  
// $nday = time() + ( 24 * 60 * 60 *$diasent);    
// $datae=date("Y-m-d h:i:s");
// $datae2=date("Y-m-d H:i:s", $nday);


//  $query2 = "SELECT price, label   FROM `".MAIN_DB_PREFIX."product` where `rowid`='".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $result2 = $db->query($query2);
// $row = mysqli_fetch_object($result2);



// $preco=$row->price;
// $_SESSION["shopping_cart"][$i]["product_name"]=$row->label;
// $descricao=$row->label;

// $quantidade=$_SESSION["shopping_cart"][$i]["product_quantity"];
// $taxas=0;
// $total_ht=$quantidade*$preco;
// $total_tva=$quantidade*$taxas;
// $total_ttc=$total_ht+$total_tva;

//  $descricao=$_SESSION["shopping_cart"][$i]["product_name"];
 
 
      
// $sql3 = "INSERT INTO ".MAIN_DB_PREFIX."commandedet (";
// $sql3.= "fk_commande";

// $sql3.= ",fk_product";

// $sql3.= ", description";
// $sql3.= ", tva_tx";
// $sql3.= ", qty";
// $sql3.= ", remise_percent";
// $sql3.= ", price";
// $sql3.= ", subprice";
// $sql3.= ", total_ht";
// $sql3.= ", total_tva";
// $sql3.= ", total_ttc";
// $sql3.= ", product_type";
// // $sql3.= ", date_start";
// // $sql3.= ", date_end";
// $sql3.= ", rang";
// $sql3.= ", multicurrency_code";
// $sql3.= ", multicurrency_subprice";
// $sql3.= ", multicurrency_total_ht";
// $sql3.= ", multicurrency_total_tva";
// $sql3.= ", multicurrency_total_ttc";
// $sql3.= ") ";
// $sql3.= " VALUES (";
// $sql3.= "'".$nova."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $sql3.= ",'".utf8_decode($descricao)."'";
// $sql3.= ",'".$taxas."'";
// $sql3.= ",'".$quantidade."'";
// $sql3.= ",'".$desconto."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_tipo"]."'";	
// // $sql3.= ",'".$datae."'";			
// // $sql3.= ",'".$datae2."'";
// $sql3.= ",'".($ordemg!=""?$ordemg:$order_id)."'";			
// $sql3.= ",'BRL'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";

// $sql3.= ");";
 
   
// $resultp3 = $db->query($sql3);

  
// $sql31 = "update  ".MAIN_DB_PREFIX."commande set total_ht=total_ht+".$total_ht.", tva=tva+".$total_tva.", total_ttc=total_ttc+".$total_ht.", multicurrency_total_ht=multicurrency_total_ht+".$total_ht.", multicurrency_total_tva=multicurrency_total_tva+".$total_tva.", multicurrency_total_ttc=multicurrency_total_ttc+".$total_ht." where rowid=".$nova."" ;
    
// $resultp31 = $db->query($sql31); 

//             $codigo="CO2001-0001";

//              $cliente="ORDER TEST #1";
//              $empresa="1";
//              $notapublica="COMMANDE TEST";
//              $nova=1;
             
// $sql = "INSERT INTO ".MAIN_DB_PREFIX."commande (";
//         $sql.= "rowid";
//         $sql.= ", ref";
//         $sql.= ", ref_client";
//         $sql.= ", fk_soc";
//         $sql.= ", tms";
//         $sql.= ", date_creation";
//         $sql.= ", date_valid";
//         $sql.= ", date_commande";
//         $sql.= ", fk_statut";
//         $sql.= ", amount_ht";
//         $sql.= ", remise";
//         $sql.= ", total_ht";
//         $sql.= ", fk_user_author";
//         $sql.= ", note_private";
//         $sql.= ", note_public";
//         $sql.= ", model_pdf";
 
        	
//         $sql.= ", fk_cond_reglement";
//         $sql.= ", fk_mode_reglement";
//         $sql.= ", fk_multicurrency";
//         $sql.= ", multicurrency_code";
//         $sql.= ", multicurrency_tx"; 
		
//         $sql.= ") ";
//         $sql.= " VALUES (";
//         $sql.= $nova;
//         $sql.= ",'".$codigo."'";
//         $sql.= ",'".utf8_decode($cliente)."'";
//         $sql.= ",'".utf8_decode($empresa)."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ", 1";
//         $sql.= ", 0";
//         $sql.= ", 0";
//         $sql.= ", 0";
//         $sql.= ", '1'";
//         $sql.= ",'".utf8_decode($notapublica)."'";
//         $sql.= ",''";
//         $sql.= ", 'einstein'";
 
//         $sql.= ", 1";
//         $sql.= ", 0";
//         $sql.= ", 0";
//         $sql.= ", 'BRL'";
//         $sql.= ", 1";
 

//         $sql.= ");";
 
                 
//  $resultp = $db->query($sql);
 
 
            
//  $_SESSION["shopping_cart"][$i]["product_id"]=1;
//  $_SESSION["shopping_cart"][$i]["product_quantity"]=20;
 
//  $diasent = 10;  
// $nday = time() + ( 24 * 60 * 60 *$diasent);    
// $datae=date("Y-m-d h:i:s");
// $datae2=date("Y-m-d H:i:s", $nday);


//  $query2 = "SELECT price, label   FROM `".MAIN_DB_PREFIX."product` where `rowid`='".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $result2 = $db->query($query2);
// $row = mysqli_fetch_object($result2);



// $preco=$row->price;
// $_SESSION["shopping_cart"][$i]["product_name"]=$row->label;
// $descricao=$row->label;

// $quantidade=$_SESSION["shopping_cart"][$i]["product_quantity"];
// $taxas=0;
// $total_ht=$quantidade*$preco;
// $total_tva=$quantidade*$taxas;
// $total_ttc=$total_ht+$total_tva;

//  $descricao=$_SESSION["shopping_cart"][$i]["product_name"];
 
 
      
// $sql3 = "INSERT INTO ".MAIN_DB_PREFIX."commandedet (";
// $sql3.= "fk_commande";

// $sql3.= ",fk_product";

// $sql3.= ", description";
// $sql3.= ", tva_tx";
// $sql3.= ", qty";
// $sql3.= ", remise_percent";
// $sql3.= ", price";
// $sql3.= ", subprice";
// $sql3.= ", total_ht";
// $sql3.= ", total_tva";
// $sql3.= ", total_ttc";
// $sql3.= ", product_type";
// // $sql3.= ", date_start";
// // $sql3.= ", date_end";
// $sql3.= ", rang";
// $sql3.= ", multicurrency_code";
// $sql3.= ", multicurrency_subprice";
// $sql3.= ", multicurrency_total_ht";
// $sql3.= ", multicurrency_total_tva";
// $sql3.= ", multicurrency_total_ttc";
// $sql3.= ") ";
// $sql3.= " VALUES (";
// $sql3.= "'".$nova."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $sql3.= ",'".utf8_decode($descricao)."'";
// $sql3.= ",'".$taxas."'";
// $sql3.= ",'".$quantidade."'";
// $sql3.= ",'".$desconto."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_tipo"]."'";	
// // $sql3.= ",'".$datae."'";			
// // $sql3.= ",'".$datae2."'";
// $sql3.= ",'".($ordemg!=""?$ordemg:$order_id)."'";			
// $sql3.= ",'BRL'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";

// $sql3.= ");";
 
   
// $resultp3 = $db->query($sql3);

  
// $sql31 = "update  ".MAIN_DB_PREFIX."commande set total_ht=total_ht+".$total_ht.", tva=tva+".$total_tva.", total_ttc=total_ttc+".$total_ht.", multicurrency_total_ht=multicurrency_total_ht+".$total_ht.", multicurrency_total_tva=multicurrency_total_tva+".$total_tva.", multicurrency_total_ttc=multicurrency_total_ttc+".$total_ht." where rowid=".$nova."" ;

 
//  $_SESSION["shopping_cart"][$i]["product_id"]=3;
//  $_SESSION["shopping_cart"][$i]["product_quantity"]=20;
 
//  $diasent = 10;  
// $nday = time() + ( 24 * 60 * 60 *$diasent);    
// $datae=date("Y-m-d h:i:s");
// $datae2=date("Y-m-d H:i:s", $nday);


//  $query2 = "SELECT price, label   FROM `".MAIN_DB_PREFIX."product` where `rowid`='".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $result2 = $db->query($query2);
// $row = mysqli_fetch_object($result2);



// $preco=$row->price;
// $_SESSION["shopping_cart"][$i]["product_name"]=$row->label;
// $descricao=$row->label;

// $quantidade=$_SESSION["shopping_cart"][$i]["product_quantity"];
// $taxas=0;
// $total_ht=$quantidade*$preco;
// $total_tva=$quantidade*$taxas;
// $total_ttc=$total_ht+$total_tva;

//  $descricao=$_SESSION["shopping_cart"][$i]["product_name"];
 
 
      
// $sql3 = "INSERT INTO ".MAIN_DB_PREFIX."commandedet (";
// $sql3.= "fk_commande";

// $sql3.= ",fk_product";

// $sql3.= ", description";
// $sql3.= ", tva_tx";
// $sql3.= ", qty";
// $sql3.= ", remise_percent";
// $sql3.= ", price";
// $sql3.= ", subprice";
// $sql3.= ", total_ht";
// $sql3.= ", total_tva";
// $sql3.= ", total_ttc";
// $sql3.= ", product_type";
// // $sql3.= ", date_start";
// // $sql3.= ", date_end";
// $sql3.= ", rang";
// $sql3.= ", multicurrency_code";
// $sql3.= ", multicurrency_subprice";
// $sql3.= ", multicurrency_total_ht";
// $sql3.= ", multicurrency_total_tva";
// $sql3.= ", multicurrency_total_ttc";
// $sql3.= ") ";
// $sql3.= " VALUES (";
// $sql3.= "'".$nova."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $sql3.= ",'".utf8_decode($descricao)."'";
// $sql3.= ",'".$taxas."'";
// $sql3.= ",'".$quantidade."'";
// $sql3.= ",'".$desconto."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_tipo"]."'";	
// // $sql3.= ",'".$datae."'";			
// // $sql3.= ",'".$datae2."'";
// $sql3.= ",'".($ordemg!=""?$ordemg:$order_id)."'";			
// $sql3.= ",'BRL'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";

// $sql3.= ");";
 
   
// $resultp3 = $db->query($sql3);

  
// $sql31 = "update  ".MAIN_DB_PREFIX."commande set total_ht=total_ht+".$total_ht.", tva=tva+".$total_tva.", total_ttc=total_ttc+".$total_ht.", multicurrency_total_ht=multicurrency_total_ht+".$total_ht.", multicurrency_total_tva=multicurrency_total_tva+".$total_tva.", multicurrency_total_ttc=multicurrency_total_ttc+".$total_ht." where rowid=".$nova."" ;
    
// $resultp31 = $db->query($sql31); 














 

//             $codigo="CO2001-0001";

//              $cliente="SALE TEST #1";
//              $empresa="1";
//              $notapublica="SALE TEST 1";
//              $nova=1;
             
// $sql = "INSERT INTO ".MAIN_DB_PREFIX."facture (";
//         $sql.= "rowid";
//         $sql.= ", ref";
//         $sql.= ", ref_client";
//         $sql.= ", fk_soc";
//         $sql.= ", tms";
//         $sql.= ", datec";
//         $sql.= ", date_valid";
//         $sql.= ", datef";
//         $sql.= ", fk_statut";
//         $sql.= ", total";
//         $sql.= ", remise";
//         $sql.= ", total_ttc";
//         $sql.= ", fk_user_author";
//         $sql.= ", note_private";
//         $sql.= ", note_public";
//         $sql.= ", model_pdf";
//         $sql.= ", paye"; 
        	
//         $sql.= ", fk_cond_reglement";
//         $sql.= ", fk_mode_reglement";
//         $sql.= ", fk_multicurrency";
//         $sql.= ", multicurrency_code";
//         $sql.= ", multicurrency_tx"; 
		
//         $sql.= ") ";
//         $sql.= " VALUES (";
//         $sql.= $nova;
//         $sql.= ",'".$codigo."'";
//         $sql.= ",'".utf8_decode($cliente)."'";
//         $sql.= ",'".utf8_decode($empresa)."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ",'".$agora."'";
//         $sql.= ", 2";
//         $sql.= ", 0";
//         $sql.= ", 0";
//         $sql.= ", 0";
//         $sql.= ", '1'";
//         $sql.= ",'".utf8_decode($notapublica)."'";
//         $sql.= ",''";
//         $sql.= ", 'crabe'";
//       $sql.= ", 1";
//         $sql.= ", 1";
//         $sql.= ", 0";
//         $sql.= ", 0";
//         $sql.= ", 'BRL'";
//         $sql.= ", 0";
 

//         $sql.= ");";
 
                 
//  $resultp = $db->query($sql);
 

            
//  $_SESSION["shopping_cart"][$i]["product_id"]=1;
//  $_SESSION["shopping_cart"][$i]["product_quantity"]=20;
 
//  $diasent = 10;  
// $nday = time() + ( 24 * 60 * 60 *$diasent);    
// $datae=date("Y-m-d h:i:s");
// $datae2=date("Y-m-d H:i:s", $nday);


//  $query2 = "SELECT price, label   FROM `".MAIN_DB_PREFIX."product` where `rowid`='".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $result2 = $db->query($query2);
// $row = mysqli_fetch_object($result2);



// $preco=$row->price;
// $_SESSION["shopping_cart"][$i]["product_name"]=$row->label;
// $descricao=$row->label;

// $quantidade=$_SESSION["shopping_cart"][$i]["product_quantity"];
// $taxas=0;
// $total_ht=$quantidade*$preco;
// $total_tva=$quantidade*$taxas;
// $total_ttc=$total_ht+$total_tva;

//  $descricao=$_SESSION["shopping_cart"][$i]["product_name"];
 
 
      
// $sql3 = "INSERT INTO ".MAIN_DB_PREFIX."facturedet (";
// $sql3.= "fk_facture";

// $sql3.= ",fk_product";

// $sql3.= ", description";
// $sql3.= ", tva_tx";
// $sql3.= ", qty";
// $sql3.= ", remise_percent";
// $sql3.= ", price";
// $sql3.= ", subprice";
// $sql3.= ", total_ht";
// $sql3.= ", total_tva";
// $sql3.= ", total_ttc";
// $sql3.= ", product_type";
// // $sql3.= ", date_start";
// // $sql3.= ", date_end";
// $sql3.= ", rang";
// $sql3.= ", multicurrency_code";
// $sql3.= ", multicurrency_subprice";
// $sql3.= ", multicurrency_total_ht";
// $sql3.= ", multicurrency_total_tva";
// $sql3.= ", multicurrency_total_ttc";
// $sql3.= ") ";
// $sql3.= " VALUES (";
// $sql3.= "'".$nova."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $sql3.= ",'".utf8_decode($descricao)."'";
// $sql3.= ",'".$taxas."'";
// $sql3.= ",'".$quantidade."'";
// $sql3.= ",'".$desconto."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_tipo"]."'";	
// // $sql3.= ",'".$datae."'";			
// // $sql3.= ",'".$datae2."'";
// $sql3.= ",'".($ordemg!=""?$ordemg:$order_id)."'";			
// $sql3.= ",'BRL'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";

// $sql3.= ");";
 
   
// $resultp3 = $db->query($sql3);

  
// $sql31 = "update  ".MAIN_DB_PREFIX."facture set amount=amount+".$total_ht.", total=total+".$total_ht.", tva=tva+".$total_tva.", total_ttc=total_ttc+".$total_ht.", multicurrency_total_ht=multicurrency_total_ht+".$total_ht.", multicurrency_total_tva=multicurrency_total_tva+".$total_tva.", multicurrency_total_ttc=multicurrency_total_ttc+".$total_ht." where rowid=".$nova."" ;

//  $resultp31 = $db->query($sql31);
 
//  $_SESSION["shopping_cart"][$i]["product_id"]=3;
//  $_SESSION["shopping_cart"][$i]["product_quantity"]=20;
 
//  $diasent = 10;  
// $nday = time() + ( 24 * 60 * 60 *$diasent);    
// $datae=date("Y-m-d h:i:s");
// $datae2=date("Y-m-d H:i:s", $nday);


//  $query2 = "SELECT price, label   FROM `".MAIN_DB_PREFIX."product` where `rowid`='".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $result2 = $db->query($query2);
// $row = mysqli_fetch_object($result2);



// $preco=$row->price;
// $_SESSION["shopping_cart"][$i]["product_name"]=$row->label;
// $descricao=$row->label;

// $quantidade=$_SESSION["shopping_cart"][$i]["product_quantity"];
// $taxas=0;
// $total_ht=$quantidade*$preco;
// $total_tva=$quantidade*$taxas;
// $total_ttc=$total_ht+$total_tva;

//  $descricao=$_SESSION["shopping_cart"][$i]["product_name"];
 
 
      
// $sql3 = "INSERT INTO ".MAIN_DB_PREFIX."facturedet (";
// $sql3.= "fk_facture";

// $sql3.= ",fk_product";

// $sql3.= ", description";
// $sql3.= ", tva_tx";
// $sql3.= ", qty";
// $sql3.= ", remise_percent";
// $sql3.= ", price";
// $sql3.= ", subprice";
// $sql3.= ", total_ht";
// $sql3.= ", total_tva";
// $sql3.= ", total_ttc";
// $sql3.= ", product_type";
// // $sql3.= ", date_start";
// // $sql3.= ", date_end";
// $sql3.= ", rang";
// $sql3.= ", multicurrency_code";
// $sql3.= ", multicurrency_subprice";
// $sql3.= ", multicurrency_total_ht";
// $sql3.= ", multicurrency_total_tva";
// $sql3.= ", multicurrency_total_ttc";
// $sql3.= ") ";
// $sql3.= " VALUES (";
// $sql3.= "'".$nova."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_id"]."'";
// $sql3.= ",'".utf8_decode($descricao)."'";
// $sql3.= ",'".$taxas."'";
// $sql3.= ",'".$quantidade."'";
// $sql3.= ",'".$desconto."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";
// $sql3.= ", '".$_SESSION["shopping_cart"][$i]["product_tipo"]."'";	
// // $sql3.= ",'".$datae."'";			
// // $sql3.= ",'".$datae2."'";
// $sql3.= ",'".($ordemg!=""?$ordemg:$order_id)."'";			
// $sql3.= ",'BRL'";
// $sql3.= ",'".$preco."'";
// $sql3.= ",'".$total_ht."'";
// $sql3.= ",'".$total_tva."'";
// $sql3.= ",'".$total_ttc."'";

// $sql3.= ");";
 
   
// $resultp3 = $db->query($sql3);

  
// $sql31 = "update  ".MAIN_DB_PREFIX."facture set amount=amount+".$total_ht.", total=total+".$total_ht.", tva=tva+".$total_tva.", total_ttc=total_ttc+".$total_ht.", multicurrency_total_ht=multicurrency_total_ht+".$total_ht.", multicurrency_total_tva=multicurrency_total_tva+".$total_tva.", multicurrency_total_ttc=multicurrency_total_ttc+".$total_ht." where rowid=".$nova."" ;
    
// $resultp31 = $db->query($sql31); 



// $query07 = "insert into  `".MAIN_DB_PREFIX."bank_account` (rowid,tms,datec,ref,label,fk_pays,state_id,currency_code) values(1,'".$agora."','".$agora."','Test Bank','Test Bank',56,925,'USD')"; 
// $resultado06 = $db->query($query07);

// $query07 = "INSERT INTO `".MAIN_DB_PREFIX."paiement` (`rowid`, `ref`, `entity`, `datec`, `tms`, `datep`, `amount`, `multicurrency_amount`, `fk_paiement`, `num_paiement`, `note`, `ext_payment_id`, `ext_payment_site`, `fk_bank`, `fk_user_creat`, `fk_user_modif`, `statut`, `fk_export_compta`) VALUES (1, 'PAY2001-0001', '1', '".$agora."', '".$agora."', '".$agora."', '4800.00000000', '0.00000000', '1', '', '', NULL, NULL, '1', '1', NULL, '0', '0');"; 



// $resultado06 = $db->query($query07);

// $query07 = "INSERT INTO `llx72_bank` (`rowid`, `datec`, `tms`, `datev`, `dateo`, `amount`, `label`, `fk_account`, `fk_user_author`, `fk_user_rappro`, `fk_type`, `num_releve`, `num_chq`, `numero_compte`, `rappro`, `note`, `fk_bordereau`, `banque`, `emetteur`, `author`) VALUES (1, '".$agora."', '".$agora."', '".$agora."', '".$agora."', '4800.00000000', '(CustomerInvoicePayment)', '1', '1', NULL, '04', NULL, NULL, '', '0', NULL, '0', NULL, 'Test Company 1', NULL);"; 



// $resultado06 = $db->query($query07);

// $query07 = "insert into  `".MAIN_DB_PREFIX."paiement_facture` (rowid,fk_paiement,	fk_facture,amount) values(1,1,1,4800)"; 
// $resultado06 = $db->query($query07);

// //echo $query07;


//   $query07 = "insert into  `".MAIN_DB_PREFIX."socpeople` (`rowid`,`civility`,`lastname`,`fk_soc`,`fk_pays`,`fk_user_creat`,`statut`,`tms`,`datec`)values(1,'MR','Test Contact',1,56,1,1,'".$agora."','".$agora."')"; 
//   $resultado07 = $db->query($query07);

 
 
//  $query07 = "INSERT INTO `".MAIN_DB_PREFIX."projet` (`rowid`, `fk_soc`, `datec`, `tms`, `dateo`, `datee`, `ref`, `entity`, `title`, `description`, `fk_user_creat`, `fk_user_modif`, `public`, `fk_statut`, `fk_opp_status`, `opp_percent`, `date_close`, `fk_user_close`, `note_private`, `note_public`, `opp_amount`, `budget_amount`, `bill_time`, `model_pdf`, `import_key`) VALUES (1, '1', '".$agora."', '".$agora."', '".$agora."', '".$datae2."', 'PJ2001-0001', '1', 'Test Project 1', 'Test Project', '1', NULL, '0', '0', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0', NULL, NULL);"; 
//   $resultado07 = $db->query($query07);
 
 
//  $query07 = "INSERT INTO `".MAIN_DB_PREFIX."projet_task` (`rowid`, `ref`, `entity`, `fk_projet`, `fk_task_parent`, `datec`, `tms`, `dateo`, `datee`, `datev`, `label`, `description`, `duration_effective`, `planned_workload`, `progress`, `priority`, `fk_user_creat`, `fk_user_modif`, `fk_user_valid`, `fk_statut`, `note_private`, `note_public`, `rang`, `model_pdf`, `import_key`) VALUES (1, 'TK2001-0001', '1', '1', '0', '2020-01-09 14:19:17', '".$agora."', '".$agora."', '".$datae2."', NULL, 'Test Task 1', '', '0', NULL, NULL, '0', '1', NULL, NULL, '0', NULL, NULL, '0', NULL, NULL);"; 
//   $resultado07 = $db->query($query07);
 
 

 
// $sql31 = "INSERT INTO `llx_categorizeall_regras` (`rowid`, `regra_nome`, `regra_tipo`, `regra_texto`, `form_nome`, `situacao`, `json`, `quant`, `ids`, `idcat`, `modif`, `cor`, `ini`, `fim`) VALUES (4, 'Best Sale Products', '0', 'If <b>Type</b> <font color=blue>Equal</font> Product<br>If <b>Invoices-Customer</b> <font color=blue>In the break</font> <b>Values between 0 and 100000</b> ( between 2020-01-01  and 2027-01-01 Situation Billing / Payment)<br>', 'Product-Service', '2', '{\\\"form\\\":\\\"Product-Service\\\",\\\"nomecat\\\":\\\"Best Sale Products\\\",\\\"edita\\\":\\\"94\\\",\\\"0\\\":{\\\"id\\\":\\\"0\\\",\\\"tipo\\\":\\\"select\\\",\\\"label\\\":\\\"Type\\\",\\\"nome\\\":\\\"fk_product_type\\\",\\\"banco\\\":\\\"fk_product_type\\\",\\\"extra\\\":\\\"0\\\",\\\"operador\\\":\\\"1\\\",\\\"textooperador\\\":\\\"Equal\\\",\\\"dadosvalorpadrao\\\":{\\\"0\\\":\\\"0\\\"},\\\"textovalorpadrao\\\":\\\"Product\\\"},\\\"1\\\":{\\\"id\\\":\\\"2\\\",\\\"tipo\\\":\\\"input\\\",\\\"label\\\":\\\"Invoices-Customer\\\",\\\"nome\\\":\\\"facture_count\\\",\\\"banco\\\":\\\"facture_count\\\",\\\"extra\\\":\\\"0\\\",\\\"operador\\\":\\\"5\\\",\\\"textooperador\\\":\\\"In the break\\\",\\\"textovalorpadrao\\\":\\\"<b>Values between 0 and 100000</b> ( between 2020-01-01  and 2027-01-01 Situation Billing / Payment)\\\",\\\"dadosvalorpadrao\\\":{\\\"0\\\":{\\\"0\\\":\\\"0\\\",\\\"1\\\":\\\"100000\\\",\\\"2\\\":\\\"2020-01-01\\\",\\\"3\\\":\\\"2027-01-01\\\",\\\"4\\\":\\\"4\\\",\\\"5\\\":\\\"1\\\"}}}}', '2', '1, 3', '14', '".$agora."', 'ffff00', '0000-00-00', '0000-00-00');";
    
// $resultp31 = $db->query($sql31); 


// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie` (`rowid`, `entity`, `fk_parent`, `label`, `type`, `description`, `color`,`visible`) VALUES (14, '1', '0', 'Best Sales Products', '0','[CategorizeAll] If Type Equal Product If Invoices-Customer In the break Values between 0 and 100000 ( between 2020-01-01 and 2027-01-01 Situation Billing / Payment)','ffff00','0');";
    
// $resultp31 = $db->query($sql31); 

// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie_product` (`fk_categorie`, `fk_product`) VALUES ('14', '1');";
    
// $resultp31 = $db->query($sql31); 

// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie_product` (`fk_categorie`, `fk_product`) VALUES ('14', ' 3');";
    
// $resultp31 = $db->query($sql31); 

// $sql31 = "INSERT INTO `llx_categorizeall_regras` (`rowid`, `regra_nome`, `regra_tipo`, `regra_texto`, `form_nome`, `situacao`, `json`, `quant`, `ids`, `idcat`, `modif`, `cor`, `ini`, `fim`) VALUES (6, 'Best Sales Products Selling price <100', '0', 'If <b>Selling price</b> <font color=blue>In the break</font> between 0  and 100<br>If <b>Tags/categories</b> <font color=blue>Equal</font> Best%20Sales%20Products<br>', 'Product-Service', '2', '{\\\"form\\\":\\\"Product-Service\\\",\\\"nomecat\\\":\\\"Best Sales Products 2020 Selling price <100\\\",\\\"edita\\\":\\\"0\\\",\\\"0\\\":{\\\"id\\\":\\\"1\\\",\\\"tipo\\\":\\\"input\\\",\\\"label\\\":\\\"Selling+price\\\",\\\"nome\\\":\\\"price\\\",\\\"banco\\\":\\\"price\\\",\\\"extra\\\":\\\"0\\\",\\\"operador\\\":\\\"5\\\",\\\"textooperador\\\":\\\"In the break\\\",\\\"textovalorpadrao\\\":\\\"between 0  and 100\\\",\\\"dadosvalorpadrao\\\":{\\\"0\\\":{\\\"0\\\":\\\"0\\\",\\\"1\\\":\\\"100\\\"}}},\\\"1\\\":{\\\"id\\\":\\\"1\\\",\\\"tipo\\\":\\\"select\\\",\\\"label\\\":\\\"Tags%2Fcategories\\\",\\\"nome\\\":\\\"categories\\\",\\\"banco\\\":\\\"categories\\\",\\\"extra\\\":\\\"0\\\",\\\"operador\\\":\\\"1\\\",\\\"textooperador\\\":\\\"Equal\\\",\\\"dadosvalorpadrao\\\":{\\\"0\\\":\\\"14\\\"},\\\"textovalorpadrao\\\":\\\"Best%20Sales%20Products%20\\\"}}', '1', '1', '15', '2020-01-09 16:54:20', '007f00', '0000-00-00', '0000-00-00');";
    
// $resultp31 = $db->query($sql31); 


// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie` (`rowid`, `entity`, `fk_parent`, `label`, `type`, `description`, `color`,`visible`) VALUES (15, '1', '0', 'Best Sales Products Selling price <100', '0','[CategorizeAll] If Selling price In the break between 0 and 100 If Tags/categories Equal Best Sales Products','007f00','0');";
    
// $resultp31 = $db->query($sql31); 


// $sql31 = "INSERT INTO `".MAIN_DB_PREFIX."categorie_product` (`fk_categorie`, `fk_product`) VALUES ('15', '1');";
    
// $resultp31 = $db->query($sql31); 


//  
 
//  
 
//  $query07 = "insert into  `".MAIN_DB_PREFIX."don` (tms,datec,entity,ref,amount) values('".$agora."','".$agora."',1,'Test Donation',1000)";
 
//  $resultado06 = $db->query($query07);
 
 
  


// $query06 = "update  ".MAIN_DB_PREFIX."customizeforms set situacao='1', valor_padrao='', label='', conteudo='', tooltip='' where campo_nome!='cabecalho' or  campo_nome!='rodape'"; 

// $resultado06 = $db->query($query06);

 
// $query06 = "update  ".MAIN_DB_PREFIX."customizeforms set situacao='0', valor_padrao='', label='', conteudo='', tooltip='' where campo_nome='cabecalho' or  campo_nome='rodape'"; 
// $resultado06 = $db->query($query06);
 
 
    }
}


?>

Hry