//save on the saving date when inputing for the current month
     if ($period == date('Y-m-')) {
         $period .= date('d');
     } else {
         $period .= date('t', strtotime($period . '-01'));
     }
     $colname = $spanid_exp[3];
     $quantity = null;
     $value = null;
     $incoming = null;
     $incoming_value = null;
     $outgoing = null;
     $outgoing_value = null;
     ${$colname} = $newvalue;
     if ($based == 'sp') {
         scorecard::saveManualDataWarehouseSP($period, $based_id, $quantity, $value, $incoming, $incoming_value, $outgoing, $outgoing_value);
     }
     $ajaxResult = array();
     $ajaxResult['spanid'] = $spanid;
     $ajaxResult['status'] = '1';
     $ajaxResult['newvalue'] = scorecard::finalDisplayFormat($colname, $newvalue);
     ajaxReturn($ajaxResult);
     exit;
 } elseif ($_POST['me_action'] == 'LOADTABLES') {
     $def_col_width = ' w080';
     $classname_label = 'label w150';
     $periods = array();
     $periods_plan = array();
     for ($m = 1; $m <= 12; $m++) {
         $year = $year_previous;
         $month = str_pad($m, 2, '0', STR_PAD_LEFT);