<?php

//the global file operation
include("../public/impOpreation.php");

//global varable
global $showoutside;

//to check if the page from .htacess
//$showoutside = $_GET['sn'];
// get the config file
include_once("../public/config.php");

//here the db files that include in the file
include("../public/include_dao.php");


require_once('../models/sql/ConnectionProperty.class.php');
//Programsetting
require_once('../models/dao/ProgramsettingsDAO.class.php');
require_once('../models/dto/Programsetting.class.php');
require_once('../models/mysql/ProgramsettingsMySqlDAO.class.php');
require_once('../models/mysql/ext/ProgramsettingsMySqlExtDAO.class.php');

//get the do the action
$do = $_GET['do'];

$langs = $_SESSION['erp_lang'];
include_once("../views/languages/$langs/success.php");
include_once("../views/languages/$langs/error.php");

/* ======================

  Controller Name :- gt4setting

  ======================== */
//Programsetting
$programSetting = new Programsetting();
$programSettingDAO = new ProgramsettingsMySqlDAO();
$programSettingEX = new ProgramsettingsMySqlExtDAO();

//check and use the condition that suite this action
$dbhost = ConnectionProperty::getHost();
$dbuser = ConnectionProperty::getUser();
$dbpassword = ConnectionProperty::getPassword();

//include_once("../public/auth.php");
//here the global templates
if (empty($do) || $do == "show" || $do == "sucess" || $do == "error") {
    $smarty->display("header.html");
}


//$t = explode('/controllers', $_SERVER['REQUEST_URI'])[0];
//$t = end(explode('/', $t)); //folder of project name eg "erp"
$projectURL = 'http://' . $_SERVER['HTTP_HOST'] . explode('controllers', $_SERVER['REQUEST_URI'])[0] . 'controllers/';
$sessionList = array();
$sessionList['attempt'] = 0;
$sessionList['userid'] = 1;
$sessionList['usergroupid'] = 1;
$sessionList['username'] = 'admin';
$sessionList['usergroupname'] = 'admin';
$sessionList['saveid'] = '1';
$sessionList['employeename'] = 'admin';
$sessionList['searchinonesave'] = 0;
$sessionList['branchId'] = 0;
$sessionList['hidecat'] = 1;
$sessionList['clientnegative'] = 1;
$sessionList['suplliernegative'] = 1;
$sessionList['storenegative'] = 1;

//check and use the condetion that suite this action
if (empty($do) || $do == "show") {
    // Read in entire file
    $databsesNames = file_get_contents("../views/default/archiveview/dbNames.txt");
    $databsesNames = trim($databsesNames);
    $databases = array_reverse(explode(",", $databsesNames));
    $smarty->assign("databases", $databases);


    $smarty->display("automationtestview/dbchoice.html");
    //$smarty->display("automationtestview/add.html");
} elseif ($do == "en") {
    $password = filter_input(INPUT_POST, "password");
    $save = file_get_contents("../models/sql/Save.txt");
    $save = trim($save);
    if ($password == $save) {
        $db = $_POST["db"];
        $newdbname = $_POST["newdbname"];
        //-db
        if ($db == "-1") {
            //new data base create it
            $conn = new mysqli($dbhost, $dbuser, $dbpassword);
            if ($conn->connect_error) {
                die("Connection failed: " . $conn->connect_error);
            }
            $sql = "CREATE DATABASE IF NOT EXISTS " . $newdbname;
            if ($conn->query($sql) === TRUE) {
                //echo "Database created successfully";
            } else {
                //echo "Error creating database: " . $conn->error;
            }
            $conn->close();
            $dbname = $newdbname;
            $sessionList['dbname'] = $dbname;
            ####
            run_sql_file("../__db/syncStructure.sql"); //it is empty structure of db
            $response = CURL_IT(array('username' => 'admin', 'password' => 'manager', 'db' => $dbname), $projectURL . 'login.php?do=en'); //dont send session to make login and insert default values //'curlpost' => '1', 'sessionlist' => json_encode($sessionList),
            $response = CURL_IT(array('curlpost' => '1', 'sessionlist' => json_encode($sessionList)), $projectURL . 'index.php');
        } else {
            //db already exist
            $dbname = $db;
        }
        //-what user want to insert
        if (!empty($dbname)) {
            $_SESSION['dbname'] = $dbname;
            $smarty->assign("curltestdb", $dbname);

            $youtubes = $youtubeLinkDAO->queryAll();
            $smarty->assign("youtubes", $youtubes);
            $smarty->display("automationtestview/show.html");
        } else {
            echo -2;
        }
    } else {
        echo -1; //wrong password
    }
} elseif ($do == "sql") {
    $type = $_POST['type'];
    $sessionList['dbname'] = $_POST['curltestdb'];
    if (isset($sessionList['dbname'], $type) && !empty($sessionList['dbname']) && !empty($type)) {
        //$response = CURL_IT(array('curlpost' => '1', 'sessionlist' => json_encode($sessionList), 'user' => 'me', 'fatma' => 'younis'), $projectURL . 'syncstructure.php');
        try {
            $sqlQuery = array();
            switch ($type) {
                case "emptyDB":
                    //empty db
                    CURL_IT(array('curlpost' => '1', 'sessionlist' => json_encode($sessionList), 'type' => 'emptyDB'), $projectURL . 'gt4setting.php?do=sql');
                    //fill it with default data
                    CURL_IT(array('username' => 'admin', 'password' => 'manager', 'db' => $sessionList['dbname']), $projectURL . 'login.php?do=en'); //dont send session to make login and insert default values //'curlpost' => '1', 'sessionlist' => json_encode($sessionList),
                    CURL_IT(array('curlpost' => '1', 'sessionlist' => json_encode($sessionList)), $projectURL . 'index.php');
                    break;
                case "addCategories":
                    addCategories();
                    break;
                case "addProducts":
                    addProducts();
                    break;
                case "addClients":
                    addClients();
                    break;
                case "addSuppliers":
                    addSuppliers();
                    break;
                case "addSellBill1":
                    addSellBill1();
                    break;
                case "addSellBill2":
                    addSellBill2();
                    break;
                case "addSellBill3":
                    addSellBill3();
                    break;
                case "addSellBill4":
                    addSellBill4();
                    break;
                case "addRetSellBill1":
                    addRetSellBill1();
                    break;
                case "addRetSellBill2":
                    addRetSellBill2();
                    break;
                case "addbuyBill1":
                    addbuyBill1();
                    break;
                case "addbuyBill2":
                    addbuyBill2();
                    break;
                case "addRetBuyBill1":
                    addRetBuyBill1();
                    break;
                case "addRetBuyBill2":
                    addRetBuyBill2();
                    break;
                case "editSellBill1":
                    editSellBill1();
                    break;
                case "delSellBill3":
                    delSellBill3();
                    break;
                case "editbuyBill1":
                    editbuyBill1();
                    break;
                case "delbuyBill2":
                    delbuyBill2();
                    break;
                case "editRetSellBill1":
                    editRetSellBill1();
                    break;
                case "delRetSellBill2":
                    delRetSellBill2();
                    break;
                case "editRetBuyBill1":
                    editRetBuyBill1();
                    break;
                case "delRetBuyBill2":
                    delRetBuyBill2();
                    break;
                case "client3_payeddept1":
                    client3_payeddept1();
                    break;
                case "supplier4_payeddept1":
                    supplier4_payeddept1();
                    break;
                case "dropDB":
                    //new data base create it
                    $conn = new mysqli($dbhost, $dbuser, $dbpassword);
                    if ($conn->connect_error) {
                        die("Connection failed: " . $conn->connect_error);
                    }
                    $sql = "DROP DATABASE IF EXISTS " . $sessionList['dbname'];
                    if ($conn->query($sql) === TRUE) {
                        unlink('../avalableParcodes/' . $sessionList['dbname'] . '.txt'); //remove avalableParcode file
                        $mask = '../db_backups/' . $sessionList['dbname'] . '_*.*'; //remove db_backups files
                        array_map('unlink', glob($mask));
                        echo -4; //do logout // with echo 1 below "so it is -41"
                        //echo "Database created successfully";
                    } else {
                        echo -2; //show error msg
                        //echo "Error creating database: " . $conn->error;
                    }
                    $conn->close();
                    break;
                default:
                    break;
            }
            echo 1;
        } catch (Exception $e) {
            //echo $e;
            echo -2;
            //header("location:?do=error");
        }
    } else {
        echo -1;
    }
} elseif ($do == "sucess") {
    $smarty->display("succes.html");
} elseif ($do == "error") {
    $smarty->display("error.html");
}

//here the global templates
//$smarty->assign('customValidation', 1);

if (empty($do) || $do == "show" || $do == "sucess" || $do == "error") {
    $smarty->assign("automationtest", 1);
    $smarty->display("footer.html");
}
/* ===============================
  function in this CONTROLLER
  ================================ */

function run_sql_file($location) {
    global $dbhost;
    global $dbuser;
    global $dbpassword;
    global $dbname;
    $conn = mysqli_connect($dbhost, $dbuser, $dbpassword, $dbname);
    if (!$conn) {
        throw new Exception('could not connect to database');
    }

    //$charset = mysql_client_encoding($conn);
    mysqli_query($conn, "SET NAMES 'utf8'");
    mysqli_query($conn, 'SET CHARACTER_SET utf8');

    //load file
    $commands = file_get_contents($location);

    //delete comments
    $lines = explode("\n", $commands);
    $commands = '';
    foreach ($lines as $line) {
        $line = trim($line);
        if ($line && strpos($line, '--') !== 0) {
            $commands .= $line . "\n";
        }
    }

    //convert to array
    $commands = explode(";", $commands);
    /* 	print_r("<pre>");
      print_r($commands);
      print_r("<pre>"); */
    //run commands
    $total = $success = 0;
    foreach ($commands as $command) {

        if (trim($command)) {
            if (mysqli_query($conn, $command)) {
                $success += 1;
                $total += 1;
            }
//            if (!empty($error = mysql_error())) {
//                echo 'Mysql error ' . $error . "<br />\n";
//            }
            // $success += (@mysql_query($command)==false ? 0 : 1);
            // $total += 1;
        }
    }

    //return number of successful queries and total number of queries found
    return array(
        "success" => $success,
        "total" => $total
    );
}

function CURL_IT($post, $url) {
    global $ch;
    // set post fields
//    $post = [
//        'data_arr' => json_encode($data_arr), //encode it as it is array
//    ];

    $ch = curl_init();
    //
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    //curl_setopt($ch, CURLOPT_COOKIESESSION, true); //this to keep session if you use the $ch without curl_init again//not workong
    curl_setopt($ch, CURLOPT_POSTFIELDS, $post); //
    //Disable CURLOPT_SSL_VERIFYHOST and CURLOPT_SSL_VERIFYPEER by setting them to false.
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//    curl_setopt($ch, CURLOPT_SSLVERSION, 1);
//    curl_setopt($ch, CURLOPT_SSL_CIPHER_LIST, 'TLSv1');
    //curl_setopt($ch, CURLOPT_TIMEOUT, 10); //
    // execute!
    $response = curl_exec($ch);
    if ($response === false) {
        //echo 'Error : ' . curl_error($ch);
    }
    if (curl_error($ch)) {
        //echo curl_error($ch);
    }

    // close the connection, release resources used
    curl_close($ch);
    // do anything you want with your response
    //var_dump($response);
    return $response;
}

function addCategories() {
    global $projectURL;
    global $sessionList;
    CURL_IT(array('curlpost' => '1', 'sessionlist' => json_encode($sessionList), 'productCatName' => 'شتوى'), $projectURL . 'productCatController.php?do=add');
    CURL_IT(array('curlpost' => '1', 'sessionlist' => json_encode($sessionList), 'productCatName' => 'صيفى'), $projectURL . 'productCatController.php?do=add');
}

function addProducts() {
    global $projectURL;
    global $sessionList;
    //products of catid=1
    $post = array('curlpost' => '1', 'sessionlist' => json_encode($sessionList),
        'productCatId' => 1,
        'productItr' => 3,
        'productindextype' => 0,
        'unitsItr1' => 0,
        'hide_precentage' => 1,
        'hide_realprice' => 1,
        'hide_isCaf' => '',
        'hide_isRestaurent' => 0,
        'productName1' => 'جاكيت',
        'productBuyPrice1' => 150,
        'productbuypricereal1' => 150,
        'buypricereal_precentage1' => 0,
        'productSellAllPrice1' => 300,
        'buytotal_precentage1' => 100.00,
        'productSellHalfPrice1' => 350,
        'buyhalf_precentage1' => 133.33,
        'productSellUnitPrice1' => 400,
        'buypart_precentage1' => 166.67,
        'productquantity1' => 0,
        'parcode1' => '',
        'expireDate1' => 0,
        'productDate1' => date('Y-m-d'),
        'limitamount1' => 0,
        'inMenu1' => 0,
        'type1' => 0,
        'isservice1' => 0,
        'productDescription1' => '',
        'hidden_unitItr1' => 0,
        'hidden_unitItr4' => 0,
        'unitsItr2' => 0,
        'productName2' => 'بلوفر',
        'productBuyPrice2' => 60,
        'productbuypricereal2' => 60,
        'buypricereal_precentage2' => 0,
        'productSellAllPrice2' => 150,
        'buytotal_precentage2' => 150.00,
        'productSellHalfPrice2' => 100,
        'buyhalf_precentage2' => 66.67,
        'productSellUnitPrice2' => 70,
        'buypart_precentage2' => 16.67,
        'productquantity2' => 10,
        'parcode2' => '',
        'expireDate2' => 0,
        'productDate2' => date('Y-m-d'),
        'limitamount2' => 0,
        'inMenu2' => 0,
        'type2' => 0,
        'isservice2' => 0,
        'productDescription2' => '',
        'hidden_unitItr2' => 0,
        'unitsItr3' => 0,
        'productName3' => 'سوتشيرت',
        'productBuyPrice3' => 100,
        'productbuypricereal3' => 100,
        'buypricereal_precentage3' => 0,
        'productSellAllPrice3' => 200,
        'buytotal_precentage3' => 100.00,
        'productSellHalfPrice3' => 250,
        'buyhalf_precentage3' => 150.00,
        'productSellUnitPrice3' => 300,
        'buypart_precentage3' => 200.00,
        'productquantity3' => 20,
        'parcode3' => '',
        'expireDate3' => 0,
        'productDate3' => date('Y-m-d'),
        'limitamount3' => 0,
        'inMenu3' => 0,
        'type3' => 0,
        'isservice3' => 0,
        'productDescription3' => '',
        'hidden_unitItr3' => 0,
    );
    $respo = CURL_IT($post, $projectURL . 'productController.php?do=add');

    //products of catid=2
    $post = array('curlpost' => '1', 'sessionlist' => json_encode($sessionList),
        'productCatId' => 2,
        'productItr' => 3,
        'productindextype' => 0,
        'unitsItr1' => 0,
        'hide_precentage' => 1,
        'hide_realprice' => 1,
        'hide_isCaf' => '',
        'hide_isRestaurent' => 0,
        'productName1' => 'قميص',
        'productBuyPrice1' => 80,
        'productbuypricereal1' => 80,
        'buypricereal_precentage1' => 0,
        'productSellAllPrice1' => 90,
        'buytotal_precentage1' => 12.50,
        'productSellHalfPrice1' => 100,
        'buyhalf_precentage1' => 25.00,
        'productSellUnitPrice1' => 120,
        'buypart_precentage1' => 50.00,
        'productquantity1' => 0,
        'parcode1' => '',
        'expireDate1' => 0,
        'productDate1' => date('Y-m-d'),
        'limitamount1' => 0,
        'inMenu1' => 0,
        'type1' => 0,
        'isservice1' => 0,
        'productDescription1' => '',
        'hidden_unitItr1' => 0,
        'hidden_unitItr4' => 0,
        'unitsItr2' => 0,
        'productName2' => 'تيشيرت',
        'productBuyPrice2' => 70,
        'productbuypricereal2' => 70,
        'buypricereal_precentage2' => 0,
        'productSellAllPrice2' => 80,
        'buytotal_precentage2' => 14.29,
        'productSellHalfPrice2' => 90,
        'buyhalf_precentage2' => 28.57,
        'productSellUnitPrice2' => 110,
        'buypart_precentage2' => 57.14,
        'productquantity2' => 5,
        'parcode2' => '',
        'expireDate2' => 0,
        'productDate2' => date('Y-m-d'),
        'limitamount2' => 0,
        'inMenu2' => 0,
        'type2' => 0,
        'isservice2' => 0,
        'productDescription2' => '',
        'hidden_unitItr2' => 0,
        'unitsItr3' => 0,
        'productName3' => 'هيكول',
        'productBuyPrice3' => 90,
        'productbuypricereal3' => 90,
        'buypricereal_precentage3' => 0,
        'productSellAllPrice3' => 70,
        'buytotal_precentage3' => -22.22,
        'productSellHalfPrice3' => 90,
        'buyhalf_precentage3' => 0.00,
        'productSellUnitPrice3' => 120,
        'buypart_precentage3' => 33.33,
        'productquantity3' => 15,
        'parcode3' => '',
        'expireDate3' => 0,
        'productDate3' => date('Y-m-d'),
        'limitamount3' => 0,
        'inMenu3' => 0,
        'type3' => 0,
        'isservice3' => 0,
        'productDescription3' => '',
        'hidden_unitItr3' => 0,
    );
    CURL_IT($post, $projectURL . 'productController.php?do=add');
}

function addClients() {
    global $projectURL;
    global $sessionList;
    CURL_IT(array('curlpost' => '1', 'sessionlist' => json_encode($sessionList), 'txtName' => 'شريف', 'txtDebt' => 0, 'debtLimit' => 1000, 'store_all' => 1, 'clientareaid' => 0), $projectURL . 'clientController.php?do=add');
    CURL_IT(array('curlpost' => '1', 'sessionlist' => json_encode($sessionList), 'txtName' => 'ابوزيد', 'txtDebt' => 1000, 'debtLimit' => 1000, 'store_all' => 1, 'clientareaid' => 0), $projectURL . 'clientController.php?do=add');
    CURL_IT(array('curlpost' => '1', 'sessionlist' => json_encode($sessionList), 'txtName' => 'عزمي', 'txtDebt' => 2000, 'debtLimit' => 1000, 'store_all' => 1, 'clientareaid' => 0), $projectURL . 'clientController.php?do=add');
}

function addSuppliers() {
    global $projectURL;
    global $sessionList;
    CURL_IT(array('curlpost' => '1', 'sessionlist' => json_encode($sessionList), 'txtName' => 'عماد', 'txtDebt' => 0), $projectURL . 'supplierController.php?do=add');
    CURL_IT(array('curlpost' => '1', 'sessionlist' => json_encode($sessionList), 'txtName' => 'احمد', 'txtDebt' => 500), $projectURL . 'supplierController.php?do=add');
    CURL_IT(array('curlpost' => '1', 'sessionlist' => json_encode($sessionList), 'txtName' => 'حازم', 'txtDebt' => 2000), $projectURL . 'supplierController.php?do=add');
}

function addSellBill1() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'bns' => '05ef7994057772',
        'bn' => date('Y-m-d H:i:s'),
        'tempclientName' => 'شريف',
        'carNumber' => '',
        'carType' => '',
        'carChase' => '',
        'carMotor' => '',
        'Costcenter' => '-1',
        'supplier' => 2,
        'hidden_debt' => 0,
        'pricetype' => 0,
        'hiddenpricetype' => 0,
        'hiddenpritype' => 1,
        'userstoreid' => 0,
        'userstoreidForClient' => 1,
        'storeid' => 1,
        'sellerid' => -1,
        'comment' => '',
        'newproductItr' => '',
        'newproductTabIndex' => '',
        'billnameid' => 3,
        'settingreturn' => 1,
        'settingclient' => 0,
        'settingstore' => 0,
        'settingseller' => 1,
        'settingparcode' => 0,
        'settingdate' => 0,
        'settingnewproduct' => 1,
        'settingcomment' => 1,
        'settingdiscount' => 1,
        'settingQuantitiyFocus' => 1,
        'settingUnit' => 1,
        'settingQuantityAlert' => 0,
        'morestore' => 1,
        'sumSameProductForStore' => 0,
        'usePriceTypeOfClient' => 0,
        'saveBtnGoesTo' => 1,
        'printURL' => '',
        'sellerIsRequired' => 0,
        'searchvalue' => 1,
        'directDiscount' => 0,
        'percentageDiscount' => 10,
        'ordertype' => 0,
        'saveeffect' => 0,
        'discountrowtype' => 0,
        'multiclient' => 1,
        'showdiscountrow' => 1,
        'showbouns' => 1,
        'showclientdetail' => 1,
        'showtotal' => 0,
        'shownumber' => 0,
        'payedSetting' => 0,
        'hidden_itr' => 2,
        'parcode1' => '00001',
        'parcodeType1' => 'parcode',
        'productserailid1' => 0,
        'productQty1' => 'undefined', ////////
        'prstorid1' => -1,
        'product1' => 1,
        'comment1' => '',
        'productunit1' => 1,
        'pronum1' => 1,
        'scunitname1' => 0,
        'bouns1' => 0,
        'proprice1' => 400,
        'quantity1' => '',
        'productpricetype1' => 0,
        'prodis1' => 0,
        'discounttype1' => 0.00,
        'hidden_prototal1' => 400.00,
        'sellbillprice' => 400,
        'returnhidden_itr' => 1,
        'returnparcode1' => '',
        'returnparcodeType1' => '',
        'returnproductserailid1' => '',
        'returnproductQty1' => '',
        'reprstorid1' => -1,
        'returnproduct1' => '',
        'returncomment1' => '',
        'returnproductunit1' => -1,
        'returnpronum1' => 1,
        'returnscunitname1' => 0,
        'returnproprice1' => 0,
        'returnprodis1' => 0,
        'returndiscounttype1' => 0,
        'returnhidden_prototal1' => 0,
        'returnsellbillprice' => 0,
        'genpay2' => '',
        'sellQuantity' => 1,
        'returnsellQuantity' => 0,
        'sellbilltotalbill' => 400,
        'distype' => 1,
        'gendis' => 0,
        'tax' => 0,
        'sellbillaftertotalbill' => 400,
        'genpay' => 250,
        'gen4totalinput' => 150,
        'clientdebtafter' => 150,
        'round_numbers' => 0,
        'previousPriceStatus' => 0,
        'storenegative' => 1
    );
    $res = CURL_IT($post, $projectURL . 'sellbillController.php?do=add');
}

function addSellBill2() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'bns' => '05ef7a53f5ae56',
        'bn' => date('Y-m-d H:i:s'),
        'tempclientName' => 'ابوزيد',
        'carNumber' => '',
        'carType' => '',
        'carChase' => '',
        'carMotor' => '',
        'Costcenter' => -1,
        'supplier' => 3,
        'hidden_debt' => 1000,
        'pricetype' => 0,
        'hiddenpricetype' => 0,
        'hiddenpritype' => 1,
        'userstoreid' => 0,
        'userstoreidForClient' => 1,
        'storeid' => 1,
        'sellerid' => -1,
        'comment' => '',
        'newproductItr' => '',
        'newproductTabIndex' => '',
        'billnameid' => 3,
        'settingreturn' => 1,
        'settingclient' => 0,
        'settingstore' => 0,
        'settingseller' => 1,
        'settingparcode' => 0,
        'settingdate' => 0,
        'settingnewproduct' => 1,
        'settingcomment' => 1,
        'settingdiscount' => 1,
        'settingQuantitiyFocus' => 1,
        'settingUnit' => 1,
        'settingQuantityAlert' => 0,
        'morestore' => 1,
        'sumSameProductForStore' => 0,
        'usePriceTypeOfClient' => 0,
        'saveBtnGoesTo' => 1,
        'printURL' => '',
        'sellerIsRequired' => 0,
        'searchvalue' => 1,
        'directDiscount' => 0,
        'percentageDiscount' => 10,
        'ordertype' => 0,
        'saveeffect' => 0,
        'discountrowtype' => 0,
        'multiclient' => 1,
        'showdiscountrow' => 1,
        'showbouns' => 1,
        'showclientdetail' => 1,
        'showtotal' => 0,
        'shownumber' => 0,
        'payedSetting' => 0,
        'hidden_itr' => 6,
        'parcode1' => '00004',
        'parcodeType1' => 'parcode',
        'productserailid1' => 0,
        'productQty1' => 'undefined',
        'prstorid1' => -1,
        'product1' => 4,
        'comment1' => '',
        'productunit1' => 4,
        'pronum1' => 1,
        'scunitname1' => 0,
        'bouns1' => 0,
        'proprice1' => 120,
        'quantity1' => '',
        'productpricetype1' => 0,
        'prodis1' => 0,
        'discounttype1' => 0.00,
        'hidden_prototal1' => 120.00,
        'parcode2' => '00006',
        'parcodeType2' => 'parcode',
        'productserailid2' => 0,
        'productQty2' => 'undefined',
        'product2' => 6,
        'comment2' => '',
        'productunit2' => 6,
        'pronum2' => 2,
        'scunitname2' => 0,
        'bouns2' => 0,
        'proprice2' => 120,
        'quantity2' => '',
        'productpricetype2' => 0,
        'prodis2' => 0,
        'discounttype2' => 0.00,
        'hidden_prototal2' => 240.00,
        'parcode3' => '00005',
        'parcodeType3' => 'parcode',
        'productserailid3' => 0,
        'productQty3' => 'undefined',
        'product3' => 5,
        'comment3' => '',
        'productunit3' => 5,
        'pronum3' => 3,
        'scunitname3' => 0,
        'bouns3' => 0,
        'proprice3' => 110,
        'quantity3' => '',
        'productpricetype3' => 0,
        'prodis3' => 0,
        'discounttype3' => 0.00,
        'hidden_prototal3' => 330.00,
        'parcode4' => '00003',
        'parcodeType4' => 'parcode',
        'productserailid4' => 0,
        'productQty4' => 'undefined',
        'product4' => 3,
        'comment4' => '',
        'productunit4' => 3,
        'pronum4' => 2,
        'scunitname4' => 0,
        'bouns4' => 0,
        'proprice4' => 300,
        'quantity4' => '',
        'productpricetype4' => 0,
        'prodis4' => 0,
        'discounttype4' => 0.00,
        'hidden_prototal4' => 600.00,
        'parcode5' => '00002',
        'parcodeType5' => 'parcode',
        'productserailid5' => 0,
        'productQty5' => 'undefined',
        'product5' => 2,
        'comment5' => '',
        'productunit5' => 2,
        'pronum5' => 2,
        'scunitname5' => 0,
        'bouns5' => 0,
        'proprice5' => 70,
        'quantity5' => '',
        'productpricetype5' => 0,
        'prodis5' => 0,
        'discounttype5' => 0.00,
        'hidden_prototal5' => 140.00,
        'sellbillprice' => 1430,
        'returnhidden_itr' => 1,
        'returnparcode1' => '',
        'returnparcodeType1' => '',
        'returnproductserailid1' => '',
        'returnproductQty1' => '',
        'reprstorid1' => -1,
        'returnproduct1' => '',
        'returncomment1' => '',
        'returnproductunit1' => -1,
        'returnpronum1' => 1,
        'returnscunitname1' => 0,
        'returnproprice1' => 0,
        'returnprodis1' => 0,
        'returndiscounttype1' => 0,
        'returnhidden_prototal1' => 0,
        'returnsellbillprice' => 0,
        'genpay2' => '',
        'sellQuantity' => 10,
        'returnsellQuantity' => 0,
        'sellbilltotalbill' => 1430,
        'distype' => 1,
        'gendis' => 0,
        'tax' => 0,
        'sellbillaftertotalbill' => 1430,
        'genpay' => 1230,
        'gen4totalinput' => 200,
        'clientdebtafter' => 1200,
        'round_numbers' => 0,
        'previousPriceStatus' => 0,
        'storenegative' => 1,
    );
    CURL_IT($post, $projectURL . 'sellbillController.php?do=add');
}

function addSellBill3() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'bns' => '05ef7b44e30d79',
        'bn' => date('Y-m-d H:i:s'),
        'tempclientName' => 'نقدي',
        'carNumber' => '',
        'carType' => '',
        'carChase' => '',
        'carMotor' => '',
        'Costcenter' => -1,
        'supplier' => 1,
        'hidden_debt' => 0,
        'pricetype' => 0,
        'hiddenpricetype' => 0,
        'hiddenpritype' => 1,
        'userstoreid' => 0,
        'userstoreidForClient' => 1,
        'storeid' => 1,
        'sellerid' => -1,
        'comment' => '',
        'newproductItr' => '',
        'newproductTabIndex' => '',
        'billnameid' => 3,
        'settingreturn' => 1,
        'settingclient' => 0,
        'settingstore' => 0,
        'settingseller' => 1,
        'settingparcode' => 0,
        'settingdate' => 0,
        'settingnewproduct' => 1,
        'settingcomment' => 1,
        'settingdiscount' => 1,
        'settingQuantitiyFocus' => 1,
        'settingUnit' => 1,
        'settingQuantityAlert' => 0,
        'morestore' => 1,
        'sumSameProductForStore' => 0,
        'usePriceTypeOfClient' => 0,
        'saveBtnGoesTo' => 1,
        'printURL' => '',
        'sellerIsRequired' => 0,
        'searchvalue' => 1,
        'directDiscount' => 0,
        'percentageDiscount' => 10,
        'ordertype' => 0,
        'saveeffect' => 0,
        'discountrowtype' => 0,
        'multiclient' => 1,
        'showdiscountrow' => 1,
        'showbouns' => 1,
        'showclientdetail' => 1,
        'showtotal' => 0,
        'shownumber' => 0,
        'payedSetting' => 0,
        'hidden_itr' => 2,
        'parcode1' => '00006',
        'parcodeType1' => 'parcode',
        'productserailid1' => 0,
        'productQty1' => 'undefined',
        'prstorid1' => -1,
        'product1' => 6,
        'comment1' => '',
        'productunit1' => 6,
        'pronum1' => 3,
        'scunitname1' => 0,
        'bouns1' => 0,
        'proprice1' => 70,
        'quantity1' => '',
        'productpricetype1' => 0,
        'prodis1' => 0,
        'discounttype1' => 0.00,
        'hidden_prototal1' => 210.00,
        'sellbillprice' => 210,
        'returnhidden_itr' => 1,
        'returnparcode1' => '',
        'returnparcodeType1' => '',
        'returnproductserailid1' => '',
        'returnproductQty1' => '',
        'reprstorid1' => -1,
        'returnproduct1' => '',
        'returncomment1' => '',
        'returnproductunit1' => -1,
        'returnpronum1' => 1,
        'returnscunitname1' => 0,
        'returnproprice1' => 0,
        'returnprodis1' => 0,
        'returndiscounttype1' => 0,
        'returnhidden_prototal1' => 0,
        'returnsellbillprice' => 0,
        'genpay2' => '',
        'sellQuantity' => 3,
        'returnsellQuantity' => 0,
        'sellbilltotalbill' => 210,
        'distype' => 1,
        'gendis' => 0,
        'tax' => 0,
        'sellbillaftertotalbill' => 210,
        'genpay' => 210,
        'gen4totalinput' => 0,
        'clientdebtafter' => 0,
        'round_numbers' => 0,
        'previousPriceStatus' => 0,
        'storenegative' => 1,
    );
    $res = CURL_IT($post, $projectURL . 'sellbillController.php?do=add');
}

function addSellBill4() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'bns' => '05ef7ba69dbe4c',
        'bn' => date('Y-m-d H:i:s'),
        'tempclientName' => 'نقدي',
        'carNumber' => '',
        'carType' => '',
        'carChase' => '',
        'carMotor' => '',
        'Costcenter' => -1,
        'supplier' => 1,
        'hidden_debt' => 0,
        'pricetype' => 0,
        'hiddenpricetype' => 0,
        'hiddenpritype' => 1,
        'userstoreid' => 0,
        'userstoreidForClient' => 1,
        'storeid' => 1,
        'sellerid' => -1,
        'comment' => '',
        'newproductItr' => '',
        'newproductTabIndex' => '',
        'billnameid' => 3,
        'settingreturn' => 1,
        'settingclient' => 0,
        'settingstore' => 0,
        'settingseller' => 1,
        'settingparcode' => 0,
        'settingdate' => 0,
        'settingnewproduct' => 1,
        'settingcomment' => 1,
        'settingdiscount' => 1,
        'settingQuantitiyFocus' => 1,
        'settingUnit' => 1,
        'settingQuantityAlert' => 0,
        'morestore' => 1,
        'sumSameProductForStore' => 0,
        'usePriceTypeOfClient' => 0,
        'saveBtnGoesTo' => 1,
        'printURL' => '',
        'sellerIsRequired' => 0,
        'searchvalue' => 1,
        'directDiscount' => 0,
        'percentageDiscount' => 10,
        'ordertype' => 0,
        'saveeffect' => 0,
        'discountrowtype' => 0,
        'multiclient' => 1,
        'showdiscountrow' => 1,
        'showbouns' => 1,
        'showclientdetail' => 1,
        'showtotal' => 0,
        'shownumber' => 0,
        'payedSetting' => 0,
        'hidden_itr' => 6,
        'parcode1' => '00001',
        'parcodeType1' => 'parcode',
        'productserailid1' => 0,
        'productQty1' => 'undefined',
        'prstorid1' => -1,
        'product1' => 1,
        'comment1' => '',
        'productunit1' => 1,
        'pronum1' => 2,
        'scunitname1' => 0,
        'bouns1' => 0,
        'proprice1' => 300,
        'quantity1' => '',
        'productpricetype1' => 0,
        'prodis1' => 0,
        'discounttype1' => 0.00,
        'hidden_prototal1' => 600.00,
        'parcode2' => '00006',
        'parcodeType2' => 'parcode',
        'productserailid2' => 0,
        'productQty2' => 'undefined',
        'product2' => 6,
        'comment2' => '',
        'productunit2' => 6,
        'pronum2' => 3,
        'scunitname2' => 0,
        'bouns2' => 0,
        'proprice2' => 70,
        'quantity2' => '',
        'productpricetype2' => 0,
        'prodis2' => 0,
        'discounttype2' => 0.00,
        'hidden_prototal2' => 210.00,
        'parcode3' => '00005',
        'parcodeType3' => 'parcode',
        'productserailid3' => 0,
        'productQty3' => 'undefined',
        'product3' => 5,
        'comment3' => '',
        'productunit3' => 5,
        'pronum3' => 1,
        'scunitname3' => 0,
        'bouns3' => 0,
        'proprice3' => 80,
        'quantity3' => '',
        'productpricetype3' => 0,
        'prodis3' => 0,
        'discounttype3' => 0.00,
        'hidden_prototal3' => 80.00,
        'parcode4' => '00004',
        'parcodeType4' => 'parcode',
        'productserailid4' => 0,
        'productQty4' => 'undefined',
        'product4' => 4,
        'comment4' => '',
        'productunit4' => 4,
        'pronum4' => 1,
        'scunitname4' => 0,
        'bouns4' => 0,
        'proprice4' => 90,
        'quantity4' => '',
        'productpricetype4' => 0,
        'prodis4' => 0,
        'discounttype4' => 0.00,
        'hidden_prototal4' => 90.00,
        'parcode5' => '00002',
        'parcodeType5' => 'parcode',
        'productserailid5' => 0,
        'productQty5' => 'undefined',
        'product5' => 2,
        'comment5' => '',
        'productunit5' => 2,
        'pronum5' => 2,
        'scunitname5' => 0,
        'bouns5' => 0,
        'proprice5' => 150,
        'quantity5' => '',
        'productpricetype5' => 0,
        'prodis5' => 0,
        'discounttype5' => 0.00,
        'hidden_prototal5' => 300.00,
        'parcode6' => '',
        'parcodeType6' => '',
        'productserailid6' => '',
        'productQty6' => '',
        'product6' => '',
        'comment6' => '',
        'pronum6' => 1,
        'scunitname6' => 0,
        'bouns6' => 0,
        'proprice6' => 0,
        'prodis6' => 0,
        'discounttype6' => 0,
        'hidden_prototal6' => 0,
        'sellbillprice' => 1280,
        'returnhidden_itr' => 1,
        'returnparcode1' => '',
        'returnparcodeType1' => '',
        'returnproductserailid1' => '',
        'returnproductQty1' => '',
        'reprstorid1' => -1,
        'returnproduct1' => '',
        'returncomment1' => '',
        'returnproductunit1' => -1,
        'returnpronum1' => 1,
        'returnscunitname1' => 0,
        'returnproprice1' => 0,
        'returnprodis1' => 0,
        'returndiscounttype1' => 0,
        'returnhidden_prototal1' => 0,
        'returnsellbillprice' => 0,
        'genpay2' => '',
        'sellQuantity' => 9,
        'returnsellQuantity' => 0,
        'sellbilltotalbill' => 1280,
        'distype' => 1,
        'gendis' => 0,
        'tax' => 0,
        'sellbillaftertotalbill' => 1280,
        'genpay' => 1280,
        'gen4totalinput' => 0,
        'clientdebtafter' => 0,
        'round_numbers' => 0,
        'previousPriceStatus' => 0,
        'storenegative' => 1,
    );
    $res = CURL_IT($post, $projectURL . 'sellbillController.php?do=add');
}

function addRetSellBill1() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'bns' => '05ef7be0f7636f',
        'bn' => date('Y-m-d H:i:s'),
        'tempclientName' => 'ابوزيد',
        'carNumber' => '',
        'carType' => '',
        'carChase' => '',
        'carMotor' => '',
        'Costcenter' => -1,
        'supplier' => 3,
        'hidden_debt' => 1200,
        'pricetype' => 0,
        'hiddenpricetype' => 0,
        'hiddenpritype' => 1,
        'userstoreid' => 0,
        'userstoreidForClient' => 1,
        'storeid' => 1,
        'sellerid' => -1,
        'comment' => '',
        'newproductItr' => '',
        'newproductTabIndex' => '',
        'billnameid' => 5,
        'settingreturn' => 0,
        'settingclient' => 0,
        'settingstore' => 0,
        'settingseller' => 1,
        'settingparcode' => 0,
        'settingdate' => 0,
        'settingnewproduct' => 1,
        'settingcomment' => 1,
        'settingdiscount' => 1,
        'settingQuantitiyFocus' => 1,
        'settingUnit' => 1,
        'settingQuantityAlert' => 1,
        'morestore' => 1,
        'sumSameProductForStore' => 0,
        'usePriceTypeOfClient' => 0,
        'saveBtnGoesTo' => 1,
        'printURL' => '',
        'sellerIsRequired' => 0,
        'searchvalue' => 1,
        'directDiscount' => 0,
        'percentageDiscount' => 10,
        'ordertype' => 0,
        'saveeffect' => 0,
        'discountrowtype' => 0,
        'multiclient' => 1,
        'showdiscountrow' => 1,
        'showbouns' => 1,
        'showclientdetail' => 1,
        'showtotal' => 0,
        'shownumber' => 0,
        'payedSetting' => 0,
        'hidden_itr' => 1,
        'parcode1' => '',
        'parcodeType1' => '',
        'productserailid1' => '',
        'productQty1' => '',
        'prstorid1' => -1,
        'product1' => '',
        'comment1' => '',
        'productunit1' => -1,
        'pronum1' => 1,
        'scunitname1' => 0,
        'bouns1' => 0,
        'proprice1' => 0,
        'prodis1' => 0,
        'discounttype1' => 0,
        'hidden_prototal1' => 0,
        'sellbillprice' => 0,
        'returnhidden_itr' => 5,
        'returnparcode1' => '00005',
        'returnparcodeType1' => 'parcode',
        'returnproductserailid1' => 0,
        'reprstorid1' => -1,
        'returnproduct1' => 5,
        'returncomment1' => '',
        'returnproductunit1' => 5,
        'returnpronum1' => 1,
        'returnscunitname1' => 0,
        'returnproprice1' => 110,
        'quantity1' => '',
        'returnproductpricetype1' => 1,
        'returnprodis1' => 0,
        'returndiscounttype1' => 0,
        'returnhidden_prototal1' => 110,
        'returnparcode2' => '00003',
        'returnparcodeType2' => 'parcode',
        'returnproductserailid2' => 0,
        'returnproduct2' => 3,
        'returncomment2' => '',
        'returnproductunit2' => 3,
        'returnpronum2' => 1,
        'returnscunitname2' => 0,
        'returnproprice2' => 300,
        'quantity2' => '',
        'returnproductpricetype2' => 1,
        'returnprodis2' => 0,
        'returndiscounttype2' => 0,
        'returnhidden_prototal2' => 300,
        'returnparcode3' => '00006',
        'returnparcodeType3' => 'parcode',
        'returnproductserailid3' => 0,
        'returnproduct3' => 6,
        'returncomment3' => '',
        'returnproductunit3' => 6,
        'returnpronum3' => 1,
        'returnscunitname3' => 0,
        'returnproprice3' => 120,
        'quantity3' => '',
        'returnproductpricetype3' => 1,
        'returnprodis3' => 0,
        'returndiscounttype3' => 0,
        'returnhidden_prototal3' => 120,
        'returnparcode4' => '00002',
        'returnparcodeType4' => 'parcode',
        'returnproductserailid4' => 0,
        'returnproduct4' => 2,
        'returncomment4' => '',
        'returnproductunit4' => 2,
        'returnpronum4' => 1,
        'returnscunitname4' => 0,
        'returnproprice4' => 70,
        'quantity4' => '',
        'returnproductpricetype4' => 1,
        'returnprodis4' => 0,
        'returndiscounttype4' => 0,
        'returnhidden_prototal4' => 70,
        'returnsellbillprice' => 600,
        'genpay2' => '',
        'sellQuantity' => 0,
        'returnsellQuantity' => 4,
        'sellbilltotalbill' => -600,
        'distype' => 1,
        'gendis' => 0,
        'tax' => 0,
        'sellbillaftertotalbill' => -600,
        'genpay' => 300,
        'gen4totalinput' => -300,
        'clientdebtafter' => 900,
        'round_numbers' => 0,
        'previousPriceStatus' => 0,
        'storenegative' => 1,
    );
    $res = CURL_IT($post, $projectURL . 'sellbillController.php?do=add');
}

function addRetSellBill2() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'bns' => '05ef7c33ea9828',
        'bn' => date('Y-m-d H:i:s'),
        'tempclientName' => 'نقدي',
        'carNumber' => '',
        'carType' => '',
        'carChase' => '',
        'carMotor' => '',
        'Costcenter' => -1,
        'supplier' => 1,
        'hidden_debt' => 0,
        'pricetype' => 0,
        'hiddenpricetype' => 0,
        'hiddenpritype' => 1,
        'userstoreid' => 0,
        'userstoreidForClient' => 1,
        'storeid' => 1,
        'sellerid' => -1,
        'comment' => '',
        'newproductItr' => '',
        'newproductTabIndex' => '',
        'billnameid' => 5,
        'settingreturn' => 0,
        'settingclient' => 0,
        'settingstore' => 0,
        'settingseller' => 1,
        'settingparcode' => 0,
        'settingdate' => 0,
        'settingnewproduct' => 1,
        'settingcomment' => 1,
        'settingdiscount' => 1,
        'settingQuantitiyFocus' => 1,
        'settingUnit' => 1,
        'settingQuantityAlert' => 1,
        'morestore' => 1,
        'sumSameProductForStore' => 0,
        'usePriceTypeOfClient' => 0,
        'saveBtnGoesTo' => 1,
        'printURL' => '',
        'sellerIsRequired' => 0,
        'searchvalue' => 1,
        'directDiscount' => 0,
        'percentageDiscount' => 10,
        'ordertype' => 0,
        'saveeffect' => 0,
        'discountrowtype' => 0,
        'multiclient' => 1,
        'showdiscountrow' => 1,
        'showbouns' => 1,
        'showclientdetail' => 1,
        'showtotal' => 0,
        'shownumber' => 0,
        'payedSetting' => 0,
        'hidden_itr' => 1,
        'parcode1' => '',
        'parcodeType1' => '',
        'productserailid1' => '',
        'productQty1' => '',
        'prstorid1' => -1,
        'product1' => '',
        'comment1' => '',
        'productunit1' => -1,
        'pronum1' => 1,
        'scunitname1' => 0,
        'bouns1' => 0,
        'proprice1' => 0,
        'prodis1' => 0,
        'discounttype1' => 0,
        'hidden_prototal1' => 0,
        'sellbillprice' => 0,
        'returnhidden_itr' => 5,
        'returnparcode1' => '00005',
        'returnparcodeType1' => 'parcode',
        'returnproductserailid1' => 0,
        'reprstorid1' => -1,
        'returnproduct1' => 5,
        'returncomment1' => '',
        'returnproductunit1' => 5,
        'returnpronum1' => 2,
        'returnscunitname1' => 0,
        'returnproprice1' => 80,
        'returnquantity1' => '',
        'returnproductpricetype1' => 0,
        'returnprodis1' => 0,
        'returndiscounttype1' => 0,
        'returnhidden_prototal1' => 160,
        'returnparcode2' => '00003',
        'returnparcodeType2' => 'parcode',
        'returnproductserailid2' => 0,
        'returnproduct2' => 3,
        'returncomment2' => '',
        'returnproductunit2' => 3,
        'returnpronum2' => 1,
        'returnscunitname2' => 0,
        'returnproprice2' => 200,
        'returnquantity2' => '',
        'returnproductpricetype2' => 0,
        'returnprodis2' => 0,
        'returndiscounttype2' => 0,
        'returnhidden_prototal2' => 200,
        'returnparcode3' => '00006',
        'returnparcodeType3' => 'parcode',
        'returnproductserailid3' => 0,
        'returnproduct3' => 6,
        'returncomment3' => '',
        'returnproductunit3' => 6,
        'returnpronum3' => 2,
        'returnscunitname3' => 0,
        'returnproprice3' => 70,
        'returnquantity3' => '',
        'returnproductpricetype3' => 0,
        'returnprodis3' => 0,
        'returndiscounttype3' => 0,
        'returnhidden_prototal3' => 140,
        'returnparcode4' => '00002',
        'returnparcodeType4' => 'parcode',
        'returnproductserailid4' => 0,
        'returnproduct4' => 2,
        'returncomment4' => '',
        'returnproductunit4' => 2,
        'returnpronum4' => 3,
        'returnscunitname4' => 0,
        'returnproprice4' => 150,
        'returnquantity4' => '',
        'returnproductpricetype4' => 0,
        'returnprodis4' => 0,
        'returndiscounttype4' => 0,
        'returnhidden_prototal4' => 450,
        'returnsellbillprice' => 950,
        'genpay2' => '',
        'sellQuantity' => 0,
        'returnsellQuantity' => 8,
        'sellbilltotalbill' => -950,
        'distype' => 1,
        'gendis' => 0,
        'tax' => 0,
        'sellbillaftertotalbill' => -950,
        'genpay' => -950,
        'gen4totalinput' => 0,
        'clientdebtafter' => 0,
        'round_numbers' => 0,
        'previousPriceStatus' => 0,
        'storenegative' => 1,
    );
    $res = CURL_IT($post, $projectURL . 'sellbillController.php?do=add');
}

function addbuyBill1() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'scunitnamevalue' => 0,
        'productAndQuantityOnly' => 0,
        'billtype2' => 0,
        'billnameid' => 1,
        'returnBillSetting' => 1,
        'storeSetting' => 0,
        'parcodeSetting' => 1,
        'dateSetting' => 0,
        'newProductSetting' => 0,
        'noteSetting' => 0,
        'productDiscountSetting' => 1,
        'quantityOrParcodeSetting' => 1,
        'payNumSetting' => 1,
        'unitSetting' => 1,
        'commentSetting' => 0,
        'searchvalue' => 1,
        'payedSetting' => 0,
        'saveBtnGoesTo' => 0,
        'printURL' => '',
        'shownumber' => 1,
        'Costcenter' => -1,
        'pay_num' => '05ef7eff37743c',
        'pay_num_optional' => '',
        'bn' => date('Y-m-d H:i:s'),
        'supplier' => 2,
        'hidden_debt' => 0,
        'storeId' => 1,
        'comment' => '',
        'hide_discount' => 0,
        'realprice_precentage1' => 0,
        'realprice_precentage_re1' => 0,
        'hidden_itr' => 5,
        'parcode1' => '00005',
        'product1' => 5,
        'note1' => '',
        'unitId1' => 5,
        'pronum1' => 2,
        'scunitname1' => 0,
        'proprice1' => 70,
        'productpricetype1' => 0,
        'prodis1' => 0,
        'hidden_prototal1' => 140,
        'parcode2' => '00003',
        'product2' => 3,
        'note2' => '',
        'unitId2' => 3,
        'pronum2' => 2,
        'scunitname2' => 0,
        'proprice2' => 100,
        'productpricetype2' => 0,
        'prodis2' => 0,
        'realprice_precentage2' => 0,
        'hidden_prototal2' => 200,
        'parcode3' => '00004',
        'product3' => 4,
        'note3' => '',
        'unitId3' => 4,
        'pronum3' => 3,
        'scunitname3' => 0,
        'proprice3' => 80,
        'productpricetype3' => 0,
        'prodis3' => 0,
        'realprice_precentage3' => 0,
        'hidden_prototal3' => 240,
        'parcode4' => '00001',
        'product4' => 1,
        'note4' => '',
        'unitId4' => 1,
        'pronum4' => 1,
        'scunitname4' => 0,
        'proprice4' => 150,
        'productpricetype4' => 0,
        'prodis4' => 0,
        'realprice_precentage4' => 0,
        'hidden_prototal4' => 150,
        'totalBuyBill' => 730,
        'hidden_itr_re' => 1,
        'parcode_re1' => '',
        'product_re1' => '',
        'note_re1' => '',
        'pronum_re1' => 1,
        'scunitname_re1' => 0,
        'proprice_re1' => 0,
        'prodis_re1' => 0,
        'hidden_prototal_re1' => 0,
        'returnBuyBillTotal' => 0,
        'genpay2' => '',
        'totalbeforediscount' => 730,
        'discount_type' => 0,
        'gendis' => 0,
        'payedtax' => 0,
        'totalafterdiscount' => 730,
        'genpay' => 430,
        'supplierdebtafter' => 300,
        'round_numbers' => 0,
        'storenegative' => 1,
    );
    $res = CURL_IT($post, $projectURL . 'buyBillController.php?do=add');
}

function addbuyBill2() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'scunitnamevalue' => 0,
        'productAndQuantityOnly' => 0,
        'billtype2' => 0,
        'billnameid' => 1,
        'returnBillSetting' => 1,
        'storeSetting' => 0,
        'parcodeSetting' => 1,
        'dateSetting' => 0,
        'newProductSetting' => 0,
        'noteSetting' => 0,
        'productDiscountSetting' => 1,
        'quantityOrParcodeSetting' => 1,
        'payNumSetting' => 1,
        'unitSetting' => 1,
        'commentSetting' => 0,
        'searchvalue' => 1,
        'payedSetting' => 0,
        'saveBtnGoesTo' => 0,
        'printURL' => '',
        'shownumber' => 1,
        'Costcenter' => -1,
        'pay_num' => '05ef7f405887ee',
        'pay_num_optional' => '',
        'bn' => date('Y-m-d H:i:s'),
        'supplier' => 1,
        'hidden_debt' => 0,
        'storeId' => 1,
        'comment' => '',
        'hide_discount' => 0,
        'realprice_precentage1' => 0,
        'realprice_precentage_re1' => 0,
        'hidden_itr' => 4,
        'parcode1' => '00004',
        'product1' => 4,
        'note1' => '',
        'unitId1' => 4,
        'pronum1' => 1,
        'scunitname1' => 0,
        'proprice1' => 80,
        'productpricetype1' => 0,
        'prodis1' => 0,
        'hidden_prototal1' => 80,
        'parcode2' => '00002',
        'product2' => 2,
        'note2' => '',
        'unitId2' => 2,
        'pronum2' => 3,
        'scunitname2' => 0,
        'proprice2' => 60,
        'productpricetype2' => 0,
        'prodis2' => 0,
        'realprice_precentage2' => 0,
        'hidden_prototal2' => 180,
        'parcode3' => '00006',
        'product3' => 6,
        'note3' => '',
        'unitId3' => 6,
        'pronum3' => 4,
        'scunitname3' => 0,
        'proprice3' => 90,
        'productpricetype3' => 0,
        'prodis3' => 0,
        'realprice_precentage3' => 0,
        'hidden_prototal3' => 360,
        'totalBuyBill' => 620,
        'hidden_itr_re' => 1,
        'parcode_re1' => '',
        'product_re1' => '',
        'note_re1' => '',
        'pronum_re1' => 1,
        'scunitname_re1' => 0,
        'proprice_re1' => 0,
        'prodis_re1' => 0,
        'hidden_prototal_re1' => 0,
        'returnBuyBillTotal' => 0,
        'genpay2' => '',
        'totalbeforediscount' => 620,
        'discount_type' => 0,
        'gendis' => 20,
        'payedtax' => 0,
        'totalafterdiscount' => 600,
        'genpay' => 600,
        'supplierdebtafter' => 0,
        'round_numbers' => 0,
        'storenegative' => 1,
    );
    $res = CURL_IT($post, $projectURL . 'buyBillController.php?do=add');
}

function addRetBuyBill1() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'scunitnamevalue' => 0,
        'productAndQuantityOnly' => 0,
        'billtype2' => 0,
        'billnameid' => 6,
        'returnBillSetting' => 0,
        'storeSetting' => 0,
        'parcodeSetting' => 1,
        'dateSetting' => 0,
        'newProductSetting' => 0,
        'noteSetting' => 0,
        'productDiscountSetting' => 1,
        'quantityOrParcodeSetting' => 0,
        'payNumSetting' => 0,
        'unitSetting' => 1,
        'commentSetting' => 0,
        'searchvalue' => 1,
        'payedSetting' => 0,
        'saveBtnGoesTo' => 0,
        'printURL' => '',
        'shownumber' => 1,
        'Costcenter' => -1,
        'pay_num' => '05ef7f9016254f',
        'pay_num_optional' => '',
        'bn' => date('Y-m-d H:i:s'),
        'supplier' => 4,
        'hidden_debt' => 2000,
        'storeId' => 1,
        'comment' => '',
        'hide_discount' => 0,
        'realprice_precentage1' => 0,
        'realprice_precentage_re1' => 0,
        'hidden_itr' => 1,
        'parcode1' => '',
        'product1' => '',
        'note1' => '',
        'pronum1' => 1,
        'scunitname1' => 0,
        'proprice1' => 0,
        'prodis1' => 0,
        'hidden_prototal1' => 0,
        'totalBuyBill' => 0,
        'hidden_itr_re' => 3,
        'parcode_re1' => '00004',
        'product_re1' => 4,
        'note_re1' => '',
        'unitId_re1' => 4,
        'pronum_re1' => 2,
        'scunitname_re1' => 0,
        'proprice_re1' => 80,
        'productpricetype1' => 0,
        'prodis_re1' => 0,
        'hidden_prototal_re1' => 160,
        'parcode_re2' => '00002',
        'product_re2' => 2,
        'note_re2' => '',
        'unitId_re2' => 2,
        'pronum_re2' => 4,
        'scunitname_re2' => 0,
        'proprice_re2' => 60,
        'productpricetype2' => 0,
        'prodis_re2' => 0,
        'realprice_precentage_re2' => 0,
        'hidden_prototal_re2' => 240,
        'parcode_re3' => '00006',
        'product_re3' => 6,
        'note_re3' => '',
        'unitId_re3' => 6,
        'pronum_re3' => 3,
        'scunitname_re3' => 0,
        'proprice_re3' => 90,
        'productpricetype3' => 0,
        'prodis_re3' => 0,
        'realprice_precentage_re3' => 0,
        'hidden_prototal_re3' => 270,
        'returnBuyBillTotal' => 670,
        'genpay2' => '',
        'totalbeforediscount' => -670,
        'discount_type' => 0,
        'gendis' => 0,
        'payedtax' => 0,
        'totalafterdiscount' => -670,
        'genpay' => 240,
        'supplierdebtafter' => 1570,
        'round_numbers' => 0,
        'storenegative' => 1,
    );
    $res = CURL_IT($post, $projectURL . 'buyBillController.php?do=add');
}

function addRetBuyBill2() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'scunitnamevalue' => 0,
        'productAndQuantityOnly' => 0,
        'billtype2' => 0,
        'billnameid' => 6,
        'returnBillSetting' => 0,
        'storeSetting' => 0,
        'parcodeSetting' => 1,
        'dateSetting' => 0,
        'newProductSetting' => 0,
        'noteSetting' => 0,
        'productDiscountSetting' => 1,
        'quantityOrParcodeSetting' => 0,
        'payNumSetting' => 0,
        'unitSetting' => 1,
        'commentSetting' => 0,
        'searchvalue' => 1,
        'payedSetting' => 0,
        'saveBtnGoesTo' => 0,
        'printURL' => '',
        'shownumber' => 1,
        'Costcenter' => -1,
        'pay_num' => '05ef7fdda5a8a1',
        'pay_num_optional' => '',
        'bn' => date('Y-m-d H:i:s'),
        'supplier' => 1,
        'hidden_debt' => 0,
        'storeId' => 1,
        'comment' => '',
        'hide_discount' => 0,
        'realprice_precentage1' => 0,
        'realprice_precentage_re1' => 0,
        'hidden_itr' => 1,
        'parcode1' => '',
        'product1' => '',
        'note1' => '',
        'pronum1' => 1,
        'scunitname1' => 0,
        'proprice1' => 0,
        'prodis1' => 0,
        'hidden_prototal1' => 0,
        'totalBuyBill' => 0,
        'hidden_itr_re' => 4,
        'parcode_re1' => '00003',
        'product_re1' => 3,
        'note_re1' => '',
        'unitId_re1' => 3,
        'pronum_re1' => 2,
        'scunitname_re1' => 0,
        'proprice_re1' => 100,
        'productpricetype1' => 0,
        'prodis_re1' => 0,
        'hidden_prototal_re1' => 200,
        'parcode_re2' => '00002',
        'product_re2' => 2,
        'note_re2' => '',
        'unitId_re2' => 2,
        'pronum_re2' => 3,
        'scunitname_re2' => 0,
        'proprice_re2' => 60,
        'productpricetype2' => 0,
        'prodis_re2' => 0,
        'realprice_precentage_re2' => 0,
        'hidden_prototal_re2' => 180,
        'parcode_re3' => '00006',
        'product_re3' => 6,
        'note_re3' => '',
        'unitId_re3' => 6,
        'pronum_re3' => 2,
        'scunitname_re3' => 0,
        'proprice_re3' => 90,
        'productpricetype3' => 0,
        'prodis_re3' => 0,
        'realprice_precentage_re3' => 0,
        'hidden_prototal_re3' => 180,
        'parcode_re4' => '00001',
        'product_re4' => 1,
        'note_re4' => '',
        'unitId_re4' => 1,
        'pronum_re4' => 1,
        'scunitname_re4' => 0,
        'proprice_re4' => 150,
        'productpricetype4' => 0,
        'prodis_re4' => 0,
        'realprice_precentage_re4' => 0,
        'hidden_prototal_re4' => 150,
        'returnBuyBillTotal' => 710,
        'genpay2' => '',
        'totalbeforediscount' => -710,
        'discount_type' => 0,
        'gendis' => 0,
        'payedtax' => 0,
        'totalafterdiscount' => -710,
        'genpay' => 710,
        'supplierdebtafter' => 0,
        'round_numbers' => 0,
        'storenegative' => 1,
    );
    CURL_IT($post, $projectURL . 'buyBillController.php?do=add');
}

function editSellBill1() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'oldid' => 1,
        'bns' => '05ef7994057772',
        'bn' => date('Y-m-d H:i:s'),
        'carNumber' => '',
        'carType' => '',
        'carChase' => '',
        'carMotor' => '',
        'tempclientName' => 'شريف',
        'Costcenter' => -1,
        'supplier' => 2,
        'hidden_debt' => 150,
        'pricetype' => 0,
        'hiddenpricetype' => 0,
        'userstoreid' => 0,
        'userstoreidForClient' => 1,
        'storeid' => 1,
        'sellerid' => -1,
        'comment' => '',
        'newproductItr' => '',
        'newproductTabIndex' => '',
        'billnameid' => 3,
        'settingreturn' => 1,
        'settingclient' => 0,
        'settingstore' => 0,
        'settingseller' => 1,
        'settingparcode' => 0,
        'settingdate' => 0,
        'settingnewproduct' => 1,
        'settingcomment' => 1,
        'settingdiscount' => 1,
        'settingQuantitiyFocus' => 1,
        'settingUnit' => 1,
        'settingQuantityAlert' => 0,
        'morestore' => 1,
        'sumSameProductForStore' => 0,
        'usePriceTypeOfClient' => 0,
        'sellerIsRequired' => 0,
        'searchvalue' => 1,
        'directDiscount' => 0,
        'percentageDiscount' => 10,
        'ordertype' => 0,
        'saveeffect' => 0,
        'discountrowtype' => 0,
        'multiclient' => 1,
        'showdiscountrow' => 1,
        'showbouns' => 1,
        'showclientdetail' => 1,
        'showtotal' => 0,
        'shownumber' => 0,
        'payedSetting' => 0,
        'hidden_itr' => 4,
        'parcode1' => '00003',
        'parcodeType1' => 'parcode',
        'productserailid1' => 0,
        'productQty1' => 'undefined',
        'prstorid1' => 1,
        'product1' => 3,
        'oldproduct1' => 1,
        'oldname1' => 'جاكيت/شتوى',
        'comment1' => '',
        'productunit1' => 3,
        'pronum1' => 2,
        'scunitname1' => 0,
        'bouns1' => '',
        'proprice1' => 300,
        'quantity1' => '',
        'productpricetype1' => 0,
        'prodis1' => 0,
        'discounttype1' => 0.00,
        'hidden_prototal1' => 600.00,
        'parcode2' => '00001',
        'parcodeType2' => 'parcode',
        'productserailid2' => 0,
        'productQty2' => 'undefined',
        'product2' => 1,
        'comment2' => '',
        'productunit2' => 1,
        'pronum2' => 1,
        'scunitname2' => 0,
        'bouns2' => 0,
        'proprice2' => 400,
        'quantity2' => '',
        'productpricetype2' => 1,
        'prodis2' => 0,
        'discounttype2' => 0.00,
        'hidden_prototal2' => 400.00,
        'parcode3' => '00006',
        'parcodeType3' => 'parcode',
        'productserailid3' => 0,
        'productQty3' => 'undefined',
        'product3' => 6,
        'comment3' => '',
        'productunit3' => 6,
        'pronum3' => 1,
        'scunitname3' => 0,
        'bouns3' => 0,
        'proprice3' => 120,
        'quantity3' => '',
        'productpricetype3' => 0,
        'prodis3' => 0,
        'discounttype3' => 0.00,
        'hidden_prototal3' => 120.00,
        'sellbillprice' => 1120,
        'controlname' => 'sellbillController',
        'returnhidden_itr' => '',
        'returnsellbillprice' => '',
        'returndailyentryid' => '',
        'genpay2' => 0,
        'sellQuantity' => 4,
        'returnsellQuantity' => '',
        'sellbilltotalbill' => 1120,
        'distype' => 1,
        'gendis' => 0,
        'tax' => 0,
        'sellbillaftertotalbill' => 1120,
        'dailyID' => 9,
        'genpay' => 480,
        'clientdebtafter' => 790,
        'round_numbers' => 0,
        'previousPriceStatus' => 0,
        'storenegative' => 1,
    );
    CURL_IT($post, $projectURL . 'sellbillController.php?do=update');
}

function delSellBill3() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
    );
    CURL_IT($post, $projectURL . 'sellbillController.php?do=delete&sellbillid=3&action=11');
}

function editbuyBill1() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'billnameid' => 1,
        'billidnor' => 1,
        'controlname' => 'buyBillController.php',
        'scunitnamevalue' => 0,
        'productAndQuantityOnly' => 0,
        'returnBillSetting' => 1,
        'storeSetting' => 0,
        'parcodeSetting' => 1,
        'dateSetting' => 0,
        'newProductSetting' => 0,
        'noteSetting' => 0,
        'productDiscountSetting' => 1,
        'quantityOrParcodeSetting' => 1,
        'payNumSetting' => 1,
        'unitSetting' => 1,
        'commentSetting' => 0,
        'searchvalue' => 1,
        'settingQuantitiyFocus' => 1,
        'payedSetting' => 0,
        'shownumber' => 1,
        'Costcenter' => -1,
        'pay_num' => '05ef7eff37743c',
        'pay_num_optional' => '05ef7eff37743c',
        'bn' => date('Y-m-d H:i:s'),
        'supplier' => 2,
        'returndailyEntryId' => '',
        'dailyentryid' => 14,
        'buybillsupplierid' => 2,
        'hidden_debt' => 300,
        'storeId' => 1,
        'comment' => '',
        'hidden_itr' => 4,
        'parcode2' => '00003',
        'product2' => 3,
        'oldproduct2' => 3,
        'oldname2' => 'سوتشيرت/شتوى',
        'note2' => '',
        'unitId2' => 3,
        'pronum2' => 2,
        'scunitname2' => 0,
        'proprice2' => 100,
        'prodis2' => 0,
        'hidden_prototal2' => 200,
        'parcode3' => '00004',
        'product3' => 4,
        'oldproduct3' => 4,
        'oldname3' => 'قميص/صيفى',
        'note3' => '',
        'unitId3' => 4,
        'pronum3' => 3,
        'scunitname3' => 0,
        'proprice3' => 80,
        'prodis3' => 0,
        'hidden_prototal3' => 240,
        'parcode4' => '00001',
        'product4' => 1,
        'oldproduct4' => 1,
        'oldname4' => 'جاكيت/شتوى',
        'note4' => '',
        'unitId4' => 1,
        'pronum4' => 3,
        'scunitname4' => 0,
        'proprice4' => 150,
        'prodis4' => 0,
        'hidden_prototal4' => 450,
        'norbuyBillTotal' => 890,
        'totalBuyBill' => 890,
        'hidden_itr_re' => '',
        'norbuyBillTotal_re' => '',
        'genpay2' => 0,
        'totalbeforediscount' => 890,
        'discount_type' => 0,
        'gendis' => 0,
        'payedtax' => 0,
        'totalafterdiscount' => 890,
        'genpay' => 500,
        'supplierdebtafter' => 690,
        'round_numbers' => 0,
        'storenegative' => 1,
    );
    CURL_IT($post, $projectURL . 'buyBillController.php?do=update');
}

function delbuyBill2() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
    );
    CURL_IT($post, $projectURL . 'buyBillController.php?do=delete&id=2');
}

function editRetSellBill1() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'oldid' => 1,
        'bns' => '05ef7be0f7636f',
        'bn' => date('Y-m-d H:i:s'),
        'carNumber' => '',
        'carType' => '',
        'carChase' => '',
        'carMotor' => '',
        'tempclientName' => 'ابوزيد',
        'Costcenter' => -1,
        'supplier' => 3,
        'hidden_debt' => 900,
        'pricetype' => 0,
        'hiddenpricetype' => 0,
        'userstoreid' => 0,
        'userstoreidForClient' => 1,
        'storeid' => 1,
        'sellerid' => -1,
        'comment' => '',
        'newproductItr' => '',
        'newproductTabIndex' => '',
        'billnameid' => 5,
        'settingreturn' => 0,
        'settingclient' => 0,
        'settingstore' => 0,
        'settingseller' => 1,
        'settingparcode' => 0,
        'settingdate' => 0,
        'settingnewproduct' => 1,
        'settingcomment' => 1,
        'settingdiscount' => 1,
        'settingQuantitiyFocus' => 1,
        'settingUnit' => 1,
        'settingQuantityAlert' => 1,
        'morestore' => 1,
        'sumSameProductForStore' => 0,
        'usePriceTypeOfClient' => 0,
        'sellerIsRequired' => 0,
        'searchvalue' => 1,
        'directDiscount' => 0,
        'percentageDiscount' => 10,
        'ordertype' => 0,
        'saveeffect' => 0,
        'discountrowtype' => 0,
        'multiclient' => 1,
        'showdiscountrow' => 1,
        'showbouns' => 1,
        'showclientdetail' => 1,
        'showtotal' => 0,
        'shownumber' => 0,
        'payedSetting' => 0,
        'hidden_itr' => '',
        'sellbillprice' => '',
        'controlname' => 'returnsellbillController',
        'returnhidden_itr' => 4,
        'returnparcode1' => '00005',
        'returnparcodeType1' => '',
        'returnproductserailid1' => '',
        'returnproductQty1' => '',
        'reprstorid1' => 1,
        'returnproduct1' => 5,
        'reoldproduct1' => 5,
        'reoldname1' => 'تيشيرت/صيفى',
        'returncomment1' => '',
        'returnproductunit1' => 5,
        'oldunit1' => 5,
        'oldunitname1' => 'قطعة',
        'returnpronum1' => 1,
        'returnscunitname1' => 0,
        'returnproprice1' => 110,
        'returnprodis1' => 0,
        'returndiscounttype1' => 0,
        'returnhidden_prototal1' => 110,
        'returnparcode3' => '00006',
        'returnparcodeType3' => '',
        'returnproductserailid3' => '',
        'returnproductQty3' => '',
        'reprstorid3' => 1,
        'returnproduct3' => 6,
        'reoldproduct3' => 6,
        'reoldname3' => 'هيكول/صيفى',
        'returncomment3' => '',
        'returnproductunit3' => 6,
        'oldunit3' => 6,
        'oldunitname3' => 'قطعة',
        'returnpronum3' => 2,
        'returnscunitname3' => 0,
        'returnproprice3' => 120,
        'returnprodis3' => 0,
        'returndiscounttype3' => 0,
        'returnhidden_prototal3' => 240,
        'returnparcode4' => '00002',
        'returnparcodeType4' => '',
        'returnproductserailid4' => '',
        'returnproductQty4' => '',
        'reprstorid4' => 1,
        'returnproduct4' => 2,
        'reoldproduct4' => 2,
        'reoldname4' => 'بلوفر/شتوى',
        'returncomment4' => '',
        'returnproductunit4' => 2,
        'oldunit4' => 2,
        'oldunitname4' => 'قطعة',
        'returnpronum4' => 1,
        'returnscunitname4' => 0,
        'returnproprice4' => 70,
        'returnprodis4' => 0,
        'returndiscounttype4' => 0,
        'returnhidden_prototal4' => 70,
        'returnsellbillprice' => 420,
        'returndailyentryid' => 13,
        'genpay2' => 0,
        'sellQuantity' => '',
        'returnsellQuantity' => 4,
        'sellbilltotalbill' => -420,
        'distype' => 1,
        'gendis' => 0,
        'tax' => 0,
        'sellbillaftertotalbill' => -420,
        'dailyID' => '',
        'genpay' => 300,
        'clientdebtafter' => 780,
        'round_numbers' => 0,
        'previousPriceStatus' => 0,
        'storenegative' => 1,
    );
    CURL_IT($post, $projectURL . 'sellbillController.php?do=update');
}

function delRetSellBill2() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
    );
    CURL_IT($post, $projectURL . 'returnsellbillController.php?do=delete&returnsellbillid=2&action=0');
}

function editRetBuyBill1() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'billnameid' => 6,
        'billidnor' => 1,
        'controlname' => 'returnBuyBillController.php',
        'scunitnamevalue' => 0,
        'productAndQuantityOnly' => 0,
        'returnBillSetting' => 0,
        'storeSetting' => 0,
        'parcodeSetting' => 1,
        'dateSetting' => 0,
        'newProductSetting' => 0,
        'noteSetting' => 0,
        'productDiscountSetting' => 1,
        'quantityOrParcodeSetting' => 0,
        'payNumSetting' => 0,
        'unitSetting' => 0,
        'commentSetting' => 0,
        'searchvalue' => 1,
        'settingQuantitiyFocus' => 0,
        'payedSetting' => 0,
        'shownumber' => 1,
        'Costcenter' => -1,
        'pay_num' => '05ef7f9016254f',
        'pay_num_optional' => '05ef7f9016254f',
        'bn' => date('Y-m-d H:i:s'),
        'supplier' => 4,
        'returndailyEntryId' => 16,
        'dailyentryid' => '',
        'buybillsupplierid' => '',
        'hidden_debt' => 1570,
        'storeId' => 1,
        'comment' => '',
        'hidden_itr' => 0,
        'norbuyBillTotal' => '',
        'totalBuyBill' => 0,
        'hidden_itr_re' => 2,
        'parcode_re1' => '00004',
        'product_re1' => 4,
        'reoldproduct1' => 4,
        'reoldname1' => 'قميص/صيفى',
        'note_re1' => '',
        'unitId_re1' => 4,
        'pronum_re1' => 4,
        'scunitname_re1' => 0,
        'proprice_re1' => 80,
        'prodis_re1' => 0,
        'hidden_prototal_re1' => 320,
        'parcode_re2' => '00002',
        'product_re2' => 2,
        'reoldproduct2' => 2,
        'reoldname2' => 'بلوفر/شتوى',
        'note_re2' => '',
        'unitId_re2' => 2,
        'pronum_re2' => 4,
        'scunitname_re2' => 0,
        'proprice_re2' => 60,
        'prodis_re2' => 0,
        'hidden_prototal_re2' => 240,
        'norbuyBillTotal_re' => 560,
        'genpay2' => 0,
        'totalbeforediscount' => -560,
        'discount_type' => 0,
        'gendis' => 0,
        'payedtax' => 0,
        'totalafterdiscount' => -560,
        'genpay' => 300,
        'supplierdebtafter' => 1310,
        'round_numbers' => 0,
        'storenegative' => 1,
    );
    CURL_IT($post, $projectURL . 'buyBillController.php?do=update');
}

function delRetBuyBill2() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
    );
    CURL_IT($post, $projectURL . 'returnBuyBillController.php?do=delete&id=2&action=0');
}

function client3_payeddept1() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'clientid' => 3,
        'saveid' => 1,
        'voucher' => 16,
        'oldvoucher' => 16,
        'lastDate' => date('Y-m-d'),
        'clientnegative' => 1,
        'currentDate' => date('Y-m-d'),
        'debtBefore' => 1080,
        'payedDept' => 500,
        'debtAfter' => 580,
        'comment' => '',
        'add_print' => 0,
        'clientpremium' => '',
        'premiumid' => '',
    );
    CURL_IT($post, $projectURL . 'clientPayedDeptController.php?do=add');
}

function supplier4_payeddept1() {
    global $projectURL;
    global $sessionList;
    $post = array(
        'curlpost' => '1',
        'sessionlist' => json_encode($sessionList),
        'supplierid' => 4,
        'saveid' => 1,
        'voucher' => 3,
        'lastDate' => date('Y-m-d'),
        'currentDate' => date('Y-m-d'),
        'suplliernegative' => 1,
        'debtBefore' => 1740,
        'payedDept' => 890,
        'comment' => '',
        'add_print' => 0,
    );
    CURL_IT($post, $projectURL . 'supplierPayedDeptController.php?do=add');
}
?>










