Example #1
0
$task = isset($_REQUEST["task"]) ? $_REQUEST["task"] : "";
switch ($task) {
    case "ProcessPayment":
        ProcessPayment();
    case "getProgress":
        getProgress();
    case "confirmation":
        confirmation();
    case "Remove":
        Remove();
        //-----------------------------
    //-----------------------------
    case "registerDoc":
        registerDoc();
    case "deleteDoc":
        deleteDoc();
    case "DifferSalaryItems":
        DifferSalaryItems();
    case "ProcessArrearPayment":
        ProcessArrearPayment();
}
function ProcessPayment()
{
    $paymentCalcObj = new manage_payment_calculation();
    $paymentCalcObj->__YEAR = DateModules::GetYear($_POST["end_date"]);
    $paymentCalcObj->__MONTH = DateModules::GetMonth($_POST["end_date"]);
    $paymentCalcObj->__CALC_NORMALIZE_TAX = isset($_POST['tax_normalize']) ? "1" : "0";
    $paymentCalcObj->__START_NORMALIZE_TAX_MONTH = $_POST['tax_n_m'];
    $paymentCalcObj->__START_NORMALIZE_TAX_YEAR = $_POST['tax_normalized_year'];
    $paymentCalcObj->__BACKPAY_BEGIN_FROM = 1;
    $paymentCalcObj->__CALC_NEGATIVE_FICHE = isset($_POST['negative_fiche']) ? "1" : "0";
    $feed = new stdClass();
    $feed->points = $points;
    $feed->handle = $doc->value->handle;
    $feed->date = $doc->value->date;
    $feed->type = "points";
    $feed->_id = $doc->id;

    try {
      $response = $couch->updateDoc("updates", "feed", $feed, $feed->_id);
      if( !empty($response) && $response == "ok" )
        return true;
      else
        echo '{ "success": false, "message": "There was an error while saving. Please try again." }';
        exit(0);
    } catch(Exception $e) {
      echo '{ "success": false, "error": { "message": "'.$e->getMessage().'", "code": "'.$e->getCode().'" } }';
      exit(0);
    }
}

foreach($results->rows as $pointsDoc){
    if( empty($points[$pointsDoc->id]) ) deleteDoc($pointsDoc);

    $pointsFromDb = join('|', $pointsDoc->value->points);
    $pointsFromAdmin = join('|', $points[$pointsDoc->id]);
    if($pointsFromDb != $pointsFromAdmin){
        updateDoc($pointsDoc, $points[$pointsDoc->id]);
    }
}

echo '{"success": true}';
Example #3
0
     accessDenied();
     break;
 case isset($_GET['view']) || isset($_POST['search']) || isset($_GET['search']):
     view($_GET, $_POST);
     break;
 case isset($_GET['sys']):
     site($_GET);
     break;
 case isset($_GET['sortindex']):
     sortItem($_GET);
     break;
 case isset($_GET['delid']) && !empty($_COOKIE[md5("role")]):
     delete($_GET);
     break;
 case (isset($_GET['deldoc']) || isset($_GET['item'])) && !empty($_COOKIE[md5("role")]):
     deleteDoc($_GET);
     break;
 case isset($_GET['chgdoc']) || isset($_POST['chgdoc']):
     changeDoc($_POST, $_GET);
     break;
 case isset($_GET['chid']) || isset($_POST['chid']):
     change($_POST, $_GET, $_FILES);
     break;
 case isset($_GET['ins']) || isset($_POST['ins']):
     insert($_GET, $_POST, $_FILES);
     break;
 case isset($_GET['users']) || isset($_POST['users']):
     users($_GET, $_POST);
     break;
 case isset($_GET['delusr']) && !empty($_COOKIE[md5("role")]):
     deleteUsr($_GET);