Exemplo n.º 1
0
function procDistanceTime2($coor, $thiscoor, $ref, $mode)
{
    $xdistance = ABS($thiscoor['x'] - $coor['x']);
    if ($xdistance > WORLD_MAX) {
        $xdistance = 2 * WORLD_MAX + 1 - $xdistance;
    }
    $ydistance = ABS($thiscoor['y'] - $coor['y']);
    if ($ydistance > WORLD_MAX) {
        $ydistance = 2 * WORLD_MAX + 1 - $ydistance;
    }
    $distance = SQRT(POW($xdistance, 2) + POW($ydistance, 2));
    if (!$mode) {
        if ($ref == 1) {
            $speed = 16;
        } else {
            if ($ref == 2) {
                $speed = 12;
            } else {
                if ($ref == 3) {
                    $speed = 24;
                } else {
                    if ($ref == 300) {
                        $speed = 5;
                    } else {
                        $speed = 1;
                    }
                }
            }
        }
    } else {
        $speed = $ref;
    }
    return round($distance / $speed * 3600 / INCREASE_SPEED);
}
Exemplo n.º 2
0
/**
 * compose time offset string
 * @param int $mns -- offset in minutes
 * @return string hh:mm
 */
function Offset($mns)
{
    $n = ABS($mns);
    $h = floor($n / 60);
    $m = $n % 60;
    $c = $mns > 0 ? '-' : '+';
    $c .= str_pad($h, 2, '0', STR_PAD_LEFT) . ':' . str_pad($m, 2, '0', STR_PAD_LEFT);
    return $c;
}
Exemplo n.º 3
0
 public function procDistanceTime($coor, $thiscoor, $ref, $mode)
 {
     global $bid28, $bid14, $building;
     $xdistance = ABS($thiscoor['x'] - $coor['x']);
     if ($xdistance > WORLD_MAX) {
         $xdistance = 2 * WORLD_MAX + 1 - $xdistance;
     }
     $ydistance = ABS($thiscoor['y'] - $coor['y']);
     if ($ydistance > WORLD_MAX) {
         $ydistance = 2 * WORLD_MAX + 1 - $ydistance;
     }
     $distance = SQRT(POW($xdistance, 2) + POW($ydistance, 2));
     if (!$mode) {
         if ($ref == 1) {
             $speed = 16;
         } else {
             if ($ref == 2) {
                 $speed = 12;
             } else {
                 if ($ref == 3) {
                     $speed = 24;
                 } else {
                     if ($ref == 300) {
                         $speed = 5;
                     } else {
                         $speed = 1;
                     }
                 }
             }
         }
     } else {
         $speed = $ref;
         if ($building->getTypeLevel(14) != 0 && $distance >= TS_THRESHOLD) {
             $speed = $speed * ($bid14[$building->gettypeLevel(14)]['attri'] / 100);
         }
     }
     if ($speed != 0) {
         return round($distance / $speed * 3600 / INCREASE_SPEED);
     } else {
         return round($distance * 3600 / INCREASE_SPEED);
     }
 }
Exemplo n.º 4
0
function create_results($res,$title) {
	global $table,$row,$row_category;

	$table.=$row_category;
	$table = str_replace("##TITLE##",$title,$table);
	$x=1;
	while($res->next_record()) {
		$smicro = $res->f("start");
		$stmicro = $res->f("stop");
		$smicro = explode(".",$smicro);
		$stmicro = explode(".",$stmicro);
		$micro = (ABS($stmicro[1]-$smicro[1]));
		if ($micro<1000) $micro = "0".$micro;
		if ($micro<100) $micro = "0".$micro;
		$rtable.=$row;
		$rtable =str_replace("##FULL_NAME##",$res->f("full_name"),$rtable);
		$rtable =str_replace("##PLACE##",$x,$rtable);
		$rtable =str_replace("##TIME##",$res->f("end_time"),$rtable);
		$rtable =str_replace("##TIME2##",substr($micro,0,2),$rtable);
		$x++;
		}
	$table = str_replace("##RESULTS##",$rtable,$table);
	$rtable = '';
}
                 $_POST['ItemDue_' . $OrderLine->LineNumber] = DateAdd(Date($_SESSION['DefaultDateFormat']), 'd', $_SESSION['Items' . $identifier]->DeliveryDays);
             }
             if (isset($_POST['OverrideDiscount_' . $OrderLine->LineNumber])) {
                 $_POST['OverrideDiscount_' . $OrderLine->LineNumber] = 1;
             } else {
                 $_POST['OverrideDiscount_' . $OrderLine->LineNumber] = 0;
             }
             if ($Quantity < 0 or $Price < 0 or $DiscountPercentage > 100 or $DiscountPercentage < 0) {
                 prnMsg(_('The item could not be updated because you are attempting to set the quantity ordered to less than 0 or the price less than 0 or the discount more than 100% or less than 0%'), 'warn');
             } elseif ($_SESSION['Items' . $identifier]->Some_Already_Delivered($OrderLine->LineNumber) != 0 and $_SESSION['Items' . $identifier]->LineItems[$OrderLine->LineNumber]->Price != $Price) {
                 prnMsg(_('The item you attempting to modify the price for has already had some quantity invoiced at the old price the items unit price cannot be modified retrospectively'), 'warn');
             } elseif ($_SESSION['Items' . $identifier]->Some_Already_Delivered($OrderLine->LineNumber) != 0 and $_SESSION['Items' . $identifier]->LineItems[$OrderLine->LineNumber]->DiscountPercent != $DiscountPercentage / 100) {
                 prnMsg(_('The item you attempting to modify has had some quantity invoiced at the old discount percent the items discount cannot be modified retrospectively'), 'warn');
             } elseif ($_SESSION['Items' . $identifier]->LineItems[$OrderLine->LineNumber]->QtyInv > $Quantity) {
                 prnMsg(_('You are attempting to make the quantity ordered a quantity less than has already been invoiced') . '. ' . _('The quantity delivered and invoiced cannot be modified retrospectively'), 'warn');
             } elseif ($OrderLine->Quantity != $Quantity or $OrderLine->Price != $Price or ABS($OrderLine->DiscountPercent - $DiscountPercentage / 100) > 0.001 or $OrderLine->Narrative != $Narrative or $OrderLine->ItemDue != $_POST['ItemDue_' . $OrderLine->LineNumber] or $OrderLine->POLine != $_POST['POLine_' . $OrderLine->LineNumber] or $OrderLine->OverrideDiscount != $_POST['OverrideDiscount_' . $OrderLine->LineNumber] or isset($PropertiesArray)) {
                 $_SESSION['Items' . $identifier]->update_cart_item($OrderLine->LineNumber, $Quantity, $Price, $_POST['Units_' . $OrderLine->LineNumber], $_POST['ConversionFactor_' . $OrderLine->LineNumber], $DiscountPercentage / 100, $_POST['OverrideDiscount_' . $OrderLine->LineNumber], $Narrative, 'Yes', $_POST['ItemDue_' . $OrderLine->LineNumber], $_POST['POLine_' . $OrderLine->LineNumber], $_POST['GPPercent_' . $OrderLine->LineNumber], $PropertiesArray[$OrderLine->LineNumber]);
             }
         }
         //page not called from itself - POST variables not set
     }
 }
 if (isset($_POST['DeliveryDetails'])) {
     echo '<meta http-equiv="Refresh" content="0; url=' . $rootpath . '/DeliveryDetails.php?identifier=' . $identifier . '">';
     prnMsg(_('You should automatically be forwarded to the entry of the delivery details page') . '. ' . _('if this does not happen') . ' (' . _('if the browser does not support META Refresh') . ') ' . '<a href="' . $rootpath . '/DeliveryDetails.php?identifier=' . $identifier . '">' . _('click here') . '</a> ' . _('to continue'), 'info');
     exit;
 }
 if (isset($NewItem)) {
     /* get the item details from the database and hold them in the cart object make the quantity 1 by default then add it to the cart */
     /*Now figure out if the item is a kit set - the field MBFlag='K'*/
     $sql = "SELECT stockmaster.mbflag\n\t\t   \t\tFROM stockmaster\n\t\t\t\tWHERE stockmaster.stockid='" . $NewItem . "'";
Exemplo n.º 6
0
				<th class="ascending">' . _('Cheque No') . '</th>
				<th class="ascending">' . _('Ref') . '</th>
				<th class="ascending">' . $TypeName . '</th>
				<th class="ascending">' . _('Date') . '</th>
				<th class="ascending">' . _('Amount') . '</th>
				<th class="ascending">' . _('Outstanding') . '</th>
				<th colspan="3">' . _('Clear') . ' / ' . _('Unclear') . '</th>
			</tr>';
    $k = 0;
    //row colour counter
    $i = 1;
    //no of rows counter
    while ($myrow = DB_fetch_array($PaymentsResult)) {
        $DisplayTranDate = ConvertSQLDate($myrow['transdate']);
        $Outstanding = $myrow['amt'] - $myrow['amountcleared'];
        if (ABS($Outstanding) < 0.008999999999999999) {
            /*the payment is cleared dont show the check box*/
            printf('<tr style="background-color:#CCCEEE">
						<td>%s</td>
						<td>%s</td>
						<td>%s</td>
						<td class="number">%s</td>
						<td class="number">%s</td>
						<td colspan="2">%s</td>
						<td><input type="checkbox" name="Unclear_%s" /><input type="hidden" name="BankTrans_%s" value="%s" /></td>
					</tr>', $myrow['ref'], $myrow['banktranstype'], $DisplayTranDate, locale_number_format($myrow['amt'], $CurrDecimalPlaces), locale_number_format($Outstanding, $CurrDecimalPlaces), _('Unclear'), $i, $i, $myrow['banktransid']);
        } else {
            if ($k == 1) {
                echo '<tr class="EvenTableRows">';
                $k = 0;
            } else {
Exemplo n.º 7
0
/* end of if quick entry */
/*Now do non-quick entry delete/edits/adds */
if (isset($_SESSION['Items' . $identifier]) or isset($NewItem)) {
    if (isset($_GET['Delete'])) {
        $_SESSION['Items' . $identifier]->remove_from_cart($_GET['Delete']);
        /*Don't do any DB updates*/
    }
    $AlreadyWarnedAboutCredit = false;
    foreach ($_SESSION['Items' . $identifier]->LineItems as $OrderLine) {
        if (isset($_POST['Quantity_' . $OrderLine->LineNumber])) {
            $Quantity = round(filter_number_format($_POST['Quantity_' . $OrderLine->LineNumber]), $OrderLine->DecimalPlaces);
            if (ABS($OrderLine->Price - filter_number_format($_POST['Price_' . $OrderLine->LineNumber])) > 0.01) {
                /*There is a new price being input for the line item */
                $Price = filter_number_format($_POST['Price_' . $OrderLine->LineNumber]);
                $_POST['GPPercent_' . $OrderLine->LineNumber] = ($Price * (1 - filter_number_format($_POST['Discount_' . $OrderLine->LineNumber]) / 100) - $OrderLine->StandardCost * $ExRate) / ($Price * (1 - filter_number_format($_POST['Discount_' . $OrderLine->LineNumber])) / 100);
            } elseif (ABS($OrderLine->GPPercent - filter_number_format($_POST['GPPercent_' . $OrderLine->LineNumber])) >= 0.01) {
                /* A GP % has been input so need to do a recalculation of the price at this new GP Percentage */
                prnMsg(_('Recalculated the price from the GP % entered - the GP % was') . ' ' . $OrderLine->GPPercent . '  the new GP % is ' . filter_number_format($_POST['GPPercent_' . $OrderLine->LineNumber]), 'info');
                $Price = $OrderLine->StandardCost * $ExRate / (1 - (filter_number_format($_POST['GPPercent_' . $OrderLine->LineNumber]) + filter_number_format($_POST['Discount_' . $OrderLine->LineNumber])) / 100);
            } else {
                $Price = filter_number_format($_POST['Price_' . $OrderLine->LineNumber]);
            }
            $DiscountPercentage = filter_number_format($_POST['Discount_' . $OrderLine->LineNumber]);
            if ($_SESSION['AllowOrderLineItemNarrative'] == 1) {
                $Narrative = $_POST['Narrative_' . $OrderLine->LineNumber];
            } else {
                $Narrative = '';
            }
            if (!isset($OrderLine->DiscountPercent)) {
                $OrderLine->DiscountPercent = 0;
            }
Exemplo n.º 8
0
 public function multipleAdjustmentAction()
 {
     $stock_master = new Model_StockMaster();
     $stock_batch = new Model_StockBatch();
     $stock_detail = new Model_StockDetail();
     $warehouse_data = new Model_WarehousesData();
     $form = new Form_MultipleAdjustment();
     $form_values = array();
     $temp = array();
     $arr_data = array('transaction_number' => "", 'stock_id' => "", 'transaction_date' => date("d/m/Y"), 'warehouse_name' => "", 'success' => $this->_request->success);
     $form_values['transaction_type_id'] = 2;
     $form_values['adjustment_type'] = 2;
     $stock_id = "";
     $master_id = "";
     if (!empty($this->_request->hdn_stock_id)) {
         $stock_id = $this->_request->hdn_stock_id;
     }
     if (!empty($this->_request->hdn_master_id)) {
         $master_id = $this->_request->hdn_master_id;
     }
     if (!empty($this->_request->warehouse)) {
         $warehouse_id = $this->_request->warehouse;
     }
     if ($this->_request->isPost()) {
         $em = Zend_Registry::get('doctrine');
         $em->getConnection()->beginTransaction();
         try {
             if (!empty($master_id)) {
                 //Start update issue period
                 $array = $this->_request->getParams();
                 $stock_master->updateStockPeriod($master_id, $array);
                 //End update issue period
                 $transaction_number = $stock_master->updateStockMasterTemp($master_id, $this->_request->comments);
                 $stock_detail->updateStockDetailTemp($master_id);
                 //Save Data in warehouse_data table
                 $warehouse_data->addReport($master_id, 2);
                 /*
                  * Auto Receive for 6th level
                  * $stock_master->autoReceiveData($master_id);
                  */
                 $this->view->msg = 'Stock has been issued successfully. Your voucher number is ';
                 $this->view->voucher = $transaction_number;
                 $this->view->master_id = $master_id;
                 $em->getConnection()->commit();
             } elseif ($form->isValid($this->_request->getPost())) {
                 $editissue = $this->_request->getPost('issueedit');
                 if ($editissue == "Yes") {
                     $d_id = $this->_request->getPost('detailid');
                     $obj_stock_detail = $em->getRepository("StockDetail")->find($d_id);
                     $old_batch_id = $obj_stock_detail->getStockBatch()->getPkId();
                     $data = $form->getValues();
                     $obj_stock_master = $obj_stock_detail->getStockMaster();
                     $master_update = false;
                     $arr_date = explode("/", $data['transaction_date']);
                     if (intval($arr_date[1]) . "-" . intval($arr_date[2]) != intval($obj_stock_detail->getStockMaster()->getTransactionDate()->format("m")) . "-" . intval($obj_stock_detail->getStockMaster()->getTransactionDate()->format("Y"))) {
                         $trans = $stock_master->getTransactionNumber(2, $data['transaction_date']);
                         $obj_stock_master->setTransactionNumber($trans['trans_no']);
                         $obj_stock_master->setTransactionCounter($trans['id']);
                         $master_update = true;
                     }
                     $obj_stock_master->setTransactionDate(new \DateTime(App_Controller_Functions::dateToDbFormat($data['transaction_date'])));
                     if (!empty($warehouse_id)) {
                         $to_wh = $em->getRepository("Warehouses")->find($warehouse_id);
                         $obj_stock_master->setToWarehouse($to_wh);
                         $master_update = true;
                     }
                     if ($master_update) {
                         $em->persist($obj_stock_master);
                         $em->flush();
                     }
                     $qunty = str_replace(",", "", $data['quantity']);
                     $obj_stock_detail->setQuantity("-" . $qunty);
                     $vvms = $this->_em->getRepository("VvmStages")->find($data['vvm_stage']);
                     $obj_stock_detail->setVvmStage($vvms);
                     $stock_b = $em->getRepository("StockBatch")->find($data['number']);
                     $obj_stock_detail->setStockBatch($stock_b);
                     if (!empty($data['item_unit_id'])) {
                         $item_unit = $em->getRepository("ItemUnits")->find($data['item_unit_id']);
                         $obj_stock_detail->setItemUnit($item_unit);
                     }
                     $em->persist($obj_stock_detail);
                     $em->flush();
                     list($dd, $mm, $yy) = explode("/", $data['transaction_date']);
                     $item_id = $data['item_id'];
                     $wh_id = $this->_identity->getWarehouseId();
                     $user_id = $this->_userid;
                     $query = "SELECT AdjustQty(" . $data['number'] . "," . $wh_id . ") FROM DUAL";
                     $str_sql = $em->getConnection()->prepare($query);
                     $str_sql->execute();
                     $query = "SELECT AdjustQty(" . $old_batch_id . "," . $wh_id . ") FROM DUAL";
                     $str_sql = $em->getConnection()->prepare($query);
                     $str_sql->execute();
                     $query = "SELECT REPUpdateData({$mm},{$yy},{$item_id},{$wh_id},{$user_id}) FROM DUAL";
                     $str_sql = $em->getConnection()->prepare($query);
                     $str_sql->execute();
                 } else {
                     $temp = $form->getValues();
                     $data = array_merge($temp, $form_values);
                     $data['warehouse'] = $warehouse_id;
                     if (empty($this->_request->transaction_number)) {
                         $stock_id = $stock_master->addStockMaster($data);
                     }
                     if (isset($data['quantity']) && !empty($data['quantity'])) {
                         $qty = str_replace(",", "", $data['quantity']);
                     }
                     if (isset($data['available_quantity']) && !empty($data['available_quantity'])) {
                         $ava_qty = str_replace(",", "", $data['available_quantity']);
                     }
                     if ((int) $qty > (int) $ava_qty || (int) $qty == (int) $ava_qty) {
                         $data['quantity'] = $ava_qty;
                         $autorun = true;
                     }
                     list($batch_id, $priority) = explode("|", $this->_request->number);
                     $form_values['item_unit_id'] = $this->_request->item_unit_id;
                     $form_values['stock_master_id'] = $stock_id;
                     $form_values['stock_batch_id'] = $batch_id;
                     $data = array_merge($temp, $form_values);
                     $detail_id = $stock_detail->addStockDetail($data);
                     $stock_batch->adjustQuantityByWarehouse($batch_id);
                     if ($autorun == true) {
                         $stock_batch->autoRunningLEFOBatch($form->getValue('item_id'));
                         $stock_batch->form_values['pk_id'] = $batch_id;
                         $stock_batch->form_values['status'] = Model_StockBatch::FINISHED;
                         $stock_batch->changeStatus();
                     }
                     /* $placement = new Model_Placements();
                        $placement->form_values['stock_batch_id'] = $batch_id;
                        $placement->form_values['quantity'] = $data['quantity'];
                        $placement->form_values['placement_location_id'] = $data['pick_from'];
                        $placement->form_values['stock_detail_id'] = $detail_id;
                        $placement->addPlacement(); */
                 }
                 $em->getConnection()->commit();
                 $this->redirect("/stock/multiple-adjustment");
                 // For Data Show
                 $temp_stock_list = $stock_master->getTempStocksList();
                 if ($temp_stock_list != false) {
                     //  $form->transaction_number->setValue($temp_stock_list[0]['transaction_number']);
                     $form->transaction_date->setValue(date("d/m/Y h:i A", strtotime($temp_stock_list[0]['transaction_date'])));
                     $form->warehouse_name->setValue($temp_stock_list[0]['to_warehouse']);
                     $form->transaction_reference->setValue($temp_stock_list[0]['transaction_reference']);
                     $form->hdn_to_warehouse_id->setValue($temp_stock_list[0]['to_warehouse_id']);
                     $form->product->setValue($temp_stock_list[0]['to_warehouse_id']);
                     $arr_data['warehouse_name'] = $temp_stock_list[0]['to_warehouse'];
                     // $arr_data['warehouse_name'] = $temp_stock_list[0]['to_warehouse'];
                     $form->activity_id->setValue($temp_stock_list[0]['activity_id']);
                     $arr_data['tempstocks'] = $temp_stock_list;
                     $form->makeFieldReadonly();
                 } else {
                     $form->transaction_date->setValue(date("d/m/Y h:i A"));
                 }
             }
         } catch (Exception $e) {
             $em->getConnection()->rollback();
             $em->close();
             App_FileLogger::info($e);
             switch ($e->getMessage()) {
                 case 'PLCD_QTY_GREATER_THAN_ISSUE_QTY':
                     $this->view->status = false;
                     $this->view->msg = "Issue quantity should not greater than placed quantity!";
                     break;
             }
         }
         $this->view->form = $form;
         $this->view->arr_data = $arr_data;
         if ($this->_request->type == 's') {
             $this->redirect("/stock/issue-search");
         }
     }
     $stock_master->form_values = $form_values;
     $temp_stock = $stock_master->getTempStock();
     if ($temp_stock != false) {
         $arr_data = array_merge($arr_data, $temp_stock);
     }
     if (!empty($temp_stock['stock_id'])) {
         $form->hdn_stock_id->setValue($temp_stock['stock_id']);
         $form->hdn_master_id->setValue($temp_stock['stock_id']);
     } elseif (!empty($stockid)) {
         $form->hdn_stock_id->setValue($stock_id);
         $form->hdn_master_id->setValue($stock_id);
     }
     $this->view->form = $form;
     $base_url = Zend_Registry::get('baseurl');
     switch ($this->_user_level) {
         case 1:
         case 2:
         case 3:
             $this->view->menu_type = 1;
             $this->view->inlineScript()->appendFile($base_url . '/js/all_level_combos.js');
             break;
         case 4:
         case 5:
         case 6:
             $this->view->menu_type = 2;
             $this->view->inlineScript()->appendFile($base_url . '/js/level_combos.js');
             break;
     }
     // Edit Issue Start
     if (!empty($this->_request->id)) {
         $detail_id = $this->_request->id;
         $issue = $this->_em->getRepository("StockDetail")->find($detail_id);
         $form->transaction_number->setValue($issue->getStockMaster()->getTransactionNumber());
         $form->transaction_date->setValue($issue->getStockMaster()->getTransactionDate()->format("d/m/Y h:i A"));
         $form->warehouse_name->setValue($issue->getStockMaster()->getToWarehouse()->getWarehouseName());
         $form->transaction_reference->setValue($issue->getStockMaster()->getTransactionReference());
         //$form->activity_id->setValue($issue->getStockMaster()->getStakeholderActivity()->getPkId());
         $arr_data['warehouse_name'] = $issue->getStockMaster()->getToWarehouse()->getWarehouseName();
         $form->item_id->setValue($issue->getStockBatch()->getItemPackSize()->getPkId());
         $form->fillBatchCombo($issue->getStockBatch()->getItemPackSize()->getPkId());
         $form->number->setValue($issue->getStockBatch()->getPkId());
         $form->vvm_stage->setValue($issue->getVvmStage());
         $form->quantity->setValue($issue->getQuantity());
         $av_qty = $issue->getStockBatch()->getQuantity() + ABS($issue->getQuantity());
         $form->available_quantity->setValue($av_qty);
         $form->expiry_date->setValue($issue->getStockBatch()->getExpiryDate()->format("d/m/Y"));
         $this->view->issueedit = true;
         $this->view->detail_id = $this->_request->id;
     }
     // Edit Issue End
     $this->view->arr_data = $arr_data;
     $this->view->type = $this->_request->getParam("t", "issue");
     $this->view->wh_id = $this->_identity->getWarehouseId();
     $this->view->params = array("province" => $this->_identity->getProvinceId(), "district" => $this->_identity->getDistrictId());
     $this->view->role = $this->_identity->getRoleId();
 }
Exemplo n.º 9
0
                    }
                    echo '<td></td>
						<td class="number"><b>' . locale_money_format(-$PeriodTotal, $_SESSION['CompanyRecord']['currencydefault']) . '</b></td>
						<td></td>
						</tr>';
                } else {
                    //its a debit balance b/fwd
                    if ($PandLAccount == True) {
                        $RunningTotal = 0;
                    }
                    echo '<td class="number"><b>' . locale_money_format($PeriodTotal, $_SESSION['CompanyRecord']['currencydefault']) . '</b></td>
						<td colspan="2"></td>
						</tr>';
                }
                $IntegrityReport .= '<br />' . _('Period') . ': ' . $PeriodNo . _('Account movement per transaction') . ': ' . locale_money_format($PeriodTotal, $_SESSION['CompanyRecord']['currencydefault']) . ' ' . _('Movement per ChartDetails record') . ': ' . locale_money_format($ChartDetailRow['actual'], $_SESSION['CompanyRecord']['currencydefault']) . ' ' . _('Period difference') . ': ' . locale_money_format($PeriodTotal - $ChartDetailRow['actual'], $_SESSION['CompanyRecord']['currencydefault']);
                if (ABS($PeriodTotal - $ChartDetailRow['actual']) > 0.01) {
                    $ShowIntegrityReport = True;
                }
            }
            $PeriodNo = $myrow['periodno'];
            $PeriodTotal = 0;
        }
        if ($k == 1) {
            echo '<tr class="EvenTableRows">';
            $k = 0;
        } else {
            echo '<tr class="OddTableRows">';
            $k++;
        }
        $RunningTotal += $myrow['amount'];
        $PeriodTotal += $myrow['amount'];
Exemplo n.º 10
0
     if ($positiontime >= $glb_time) {
         $dtime = substr($globalwaketime, 0, 5);
         $flagtime = strtotime($theExactTime . " " . $this->config->item('flagtime'));
         if ($flagtime < $glb_time) {
             $this->config->set_item('flagtime', $globalwaketime);
         }
     }
 }
 ///////////////////////////////
 if (isset($dtime)) {
     ///////////////////////////////////////////////////////
     $atime = substr($time->time, 0, 5);
     $nextDay = $dtime > $atime ? 1 : 0;
     $dep = EXPLODE(':', $dtime);
     $arr = EXPLODE(':', $atime);
     $diff = ABS(MKTIME($dep[0], $dep[1], 0, DATE('n'), DATE('j'), DATE('y')) - MKTIME($arr[0], $arr[1], 0, DATE('n'), DATE('j') + $nextDay, DATE('y')));
     $hours = FLOOR($diff / (60 * 60));
     $mins = FLOOR(($diff - $hours * 60 * 60) / 60);
     $secs = FLOOR($diff - ($hours * 60 * 60 + $mins * 60));
     if (STRLEN($hours) < 2) {
         $hours = "0" . $hours;
     }
     if (STRLEN($mins) < 2) {
         $mins = "0" . $mins;
     }
     $hours += $mins / 60;
     ///////////////////////////////////////////
     if ($flagw == 1 && $hours > 3 || $flagw == 0 && $hours >= 0.5) {
         $timedata['currenttime'] = $time->time;
         $timedata['flagw'] = $flagw;
         $timedata['type'] = "Snack";
Exemplo n.º 11
0
}
/* end of if quick entry */
/*Now do non-quick entry delete/edits/adds */
if (isset($_SESSION['Items' . $identifier]) or isset($NewItem)) {
    if (isset($_GET['Delete'])) {
        $_SESSION['Items' . $identifier]->remove_from_cart($_GET['Delete']);
        /*Don't do any DB updates*/
    }
    foreach ($_SESSION['Items' . $identifier]->LineItems as $ReturnItemLine) {
        if (isset($_POST['Quantity_' . $ReturnItemLine->LineNumber])) {
            $Quantity = round(filter_number_format($_POST['Quantity_' . $ReturnItemLine->LineNumber]), $ReturnItemLine->DecimalPlaces);
            if (ABS($ReturnItemLine->Price - filter_number_format($_POST['Price_' . $ReturnItemLine->LineNumber])) > 0.01) {
                /*There is a new price being input for the line item */
                $Price = filter_number_format($_POST['Price_' . $ReturnItemLine->LineNumber]);
                $_POST['GPPercent_' . $ReturnItemLine->LineNumber] = ($Price * (1 - filter_number_format($_POST['Discount_' . $ReturnItemLine->LineNumber]) / 100) - $ReturnItemLine->StandardCost * $ExRate) / ($Price * (1 - filter_number_format($_POST['Discount_' . $ReturnItemLine->LineNumber])) / 100);
            } elseif (ABS($ReturnItemLine->GPPercent - filter_number_format($_POST['GPPercent_' . $ReturnItemLine->LineNumber])) >= 0.01) {
                /* A GP % has been input so need to do a recalculation of the price at this new GP Percentage */
                prnMsg(_('Recalculated the price from the GP % entered - the GP % was') . ' ' . $ReturnItemLine->GPPercent . '  the new GP % is ' . filter_number_format($_POST['GPPercent_' . $ReturnItemLine->LineNumber]), 'info');
                $Price = $ReturnItemLine->StandardCost * $ExRate / (1 - (filter_number_format($_POST['GPPercent_' . $ReturnItemLine->LineNumber]) + filter_number_format($_POST['Discount_' . $ReturnItemLine->LineNumber])) / 100);
            } else {
                $Price = filter_number_format($_POST['Price_' . $ReturnItemLine->LineNumber]);
            }
            $DiscountPercentage = filter_number_format($_POST['Discount_' . $ReturnItemLine->LineNumber]);
            if ($_SESSION['AllowOrderLineItemNarrative'] == 1) {
                $Narrative = $_POST['Narrative_' . $ReturnItemLine->LineNumber];
            } else {
                $Narrative = '';
            }
            if (!isset($ReturnItemLine->DiscountPercent)) {
                $ReturnItemLine->DiscountPercent = 0;
            }
 public function give_rate_by_id_kom($id)
 {
     $data['id_user'] = Users::where('id', '=', Session::get('user_id'))->first()->id;
     $data['id_komunitas'] = $id;
     $data['rating'] = Input::get('rating');
     $jml = $this->rating->count_rate_row_by_id($data['id_user']);
     $jmlplus = $jml + 1;
     $total = $this->rating->count_all_rating_by_id($data['id_user']);
     $totalplus = $total + $data['rating'];
     $avgrate['avg_rate'] = $totalplus / $jmlplus;
     $jml2 = $this->komunitas->count_komunitas_rate_by_id($id);
     $jml2plus = $jml2 + 1;
     $ratetotal = $this->komunitas->count_totalrate_by_idkom($id);
     $totalrate = $ratetotal + $data['rating'];
     $ratekom['avg_rate'] = $totalrate / $jml2plus;
     UserRating::create($data);
     UserAvgRate::where('id_user', '=', Session::get('user_id'))->update($avgrate);
     Komunitas::where('id', '=', $id)->update($ratekom);
     $totrate = $this->rating->count_rate_row_by_id($data['id_user']);
     if ($totrate > 1) {
         $ratesim = $this->rating->get_all_user_rate($data['id_user'], $id);
         //$ratesim = $this->komunitas->get_komunitas_rated_except($id);
         foreach ($ratesim as $rated) {
             $similar['id_kom1'] = $id;
             $similar['id_kom2'] = $rated->id_komunitas;
             //$similar['id_kom2'] = $rated->id;
             $user_avg = $this->average->get_average_rate($data['id_user']);
             $rate1 = $this->rating->get_rating_only($data['id_user'], $similar['id_kom1']);
             $rate2 = $this->rating->get_rating_only($data['id_user'], $similar['id_kom2']);
             $similar['similarity'] = ($rate1 - $user_avg) * ($rate2 - $user_avg) / (sqrt(pow($rate1 - $user_avg, 2)) * sqrt(pow($rate2 - $user_avg, 2)));
             $check = $this->komsimilarity->is_compared($similar['id_kom1'], $similar['id_kom2']);
             if ($check == TRUE) {
                 KomSimilarity::where('id_kom1', '=', $id)->where('id_kom2', '=', $rated->id_komunitas)->update($similar);
             } else {
                 KomSimilarity::create($similar);
             }
         }
         // $allkom = Komunitas::get();
         $allkom = $this->komunitas->get_komunitas_rated_except($id);
         foreach ($allkom as $kom) {
             $israted = $this->rating->is_rated($data['id_user'], $kom->id);
             if ($israted == FALSE) {
                 $ceksimilarity = $this->komsimilarity->get_similarity($kom->id);
                 foreach ($ceksimilarity as $mirip) {
                     // $ratekomp = $this->rating->get_rating_only($data['id_user'], $mirip->id_kom2);
                     $ratekomp = $this->rating->get_rating($mirip->id_kom2);
                     $simvalue = $this->komsimilarity->get_similarity_value($mirip->id_kom1, $mirip->id_kom2);
                     $predict['id_user'] = $data['id_user'];
                     $predict['id_komunitas'] = $mirip->id_kom2;
                     $predict['rate_predict'] = $ratekomp * $simvalue / ABS($simvalue);
                     $ceki = $this->predict->is_predicted($data['id_user'], $mirip->id_kom2);
                     if ($ceki == TRUE) {
                         KomRatePredict::where('id_user', '=', $data['id_user'])->where('id_komunitas', '=', $mirip->id_kom2)->update($predict);
                     } else {
                         KomRatePredict::create($predict);
                     }
                 }
             }
         }
     }
     // // $allkom = Komunitas::get();
     // $allkom = $this->komunitas->get_komunitas_rated_except($id);
     // foreach ($allkom as $kom) {
     // 	$israted  = $this->rating->is_rated($data['id_user'], $kom->id);
     // 	if ($israted == FALSE) {
     // 		$ceksimilarity = $this->komsimilarity->get_similarity($kom->id);
     // 		foreach ($ceksimilarity as $mirip) {
     // 			$cekrating  = $this->rating->is_rated($data['id_user'], $mirip->id_kom2);
     // 			if ($cekrating == FALSE) {
     // 				$ratekomp = $this->rating->get_rating_only($data['id_user'], $mirip->id_kom1);
     // 				$simvalue = $this->komsimilarity->get_similarity_value($mirip->id_kom1, $mirip->id_kom2);
     // 				$predict['id_user'] = $data['id_user'];
     // 				$predict['id_komunitas'] = $mirip->id_kom2;
     // 				$predict['rate_predict'] = (($ratekomp * $simvalue)/(ABS($simvalue)));
     // 				$ceki = $this->predict->is_predicted($data['id_user'], $mirip->id_kom2);
     // 				if ($ceki == TRUE) {
     // 					KomRatePredict::update($predict);
     // 				} else {
     // 					KomRatePredict::create($predict);
     // 				}
     // 			}
     // 		}
     // 	}
     // }
     $slug = Komunitas::where('id', '=', $id)->first()->slug;
     return Redirect::to('/komunitas/' . $slug);
 }
 public function getPlannedIssueByWh($wh_id)
 {
     $str_sql = $this->_em->createQueryBuilder()->select("fa")->from("PipelineConsignments", "fa")->where("fa.fromWarehouse = " . $wh_id)->andWhere("fa.status != 'Received'")->andWhere("fa.transactionType = 2")->andWhere("fa.itemPackSize IN (" . Zend_Registry::get('barcode_products') . ")");
     $rows = $str_sql->getQuery()->getResult();
     if (count($rows) > 0) {
         $arr_data = array();
         foreach ($rows as $row) {
             $arr_data[] = array('record_id' => $row->getPkId(), 'trans_no' => $row->getVoucherNumber(), 'arrival_date' => $row->getExpectedArrivalDate()->format("Y-m-d"), 'reference_no' => $row->getReferenceNumber(), 'description' => $row->getDescription(), 'gtin' => $row->getManufacturer()->getGtin(), 'quantity_per_pack' => $row->getManufacturer()->getQuantityPerPack(), 'item_pack_size_id' => $row->getItemPackSize()->getPkId(), 'item_category' => $row->getItemPackSize()->getItemCategory()->getPkId(), 'item_name' => $row->getItemPackSize()->getItemName(), 'batch_no' => $row->getBatchNumber(), 'batch_id' => $row->getStockBatch() != null ? $row->getStockBatch()->getPkId() : 0, 'production_date' => $row->getProductionDate() != null ? $row->getProductionDate()->format("Y-m-d") : '', 'expiry_date' => $row->getExpiryDate()->format("Y-m-d"), 'manufacturer' => $row->getManufacturer()->getStakeholder()->getStakeholderName(), 'manufacturer_id' => $row->getManufacturer()->getStakeholder()->getPkId(), 'stakeholder_item_pack_size_id' => $row->getManufacturer()->getPkId(), 'quantity' => $row->getQuantity(), 'received_quantity' => ABS($row->getReceivedQuantity()), 'from_wh_name' => $row->getFromWarehouse()->getWarehouseName(), 'from_wh_id' => $row->getFromWarehouse()->getPkId(), 'to_wh_id' => $row->getToWarehouse()->getPkId(), 'to_wh_name' => $row->getToWarehouse()->getWarehouseName());
         }
         return $arr_data;
     } else {
         return array(array("message" => "No record found"));
     }
 }
Exemplo n.º 14
0
function get_eliminated_pointcount($slide, $len, $path1)
{
    $WP_EXACT_MATCH_ERROR = get_config_var("min_wp_dist");
    //	$WP_EXACT_MATCH_ERROR=3;
    $pointcount = 0;
    $iend = (int) (($path1['lk'] - $slide) / $len);
    for ($i = 0; $i < $iend; $i++) {
        $matchcount = 0;
        $start = $slide + $len * $i;
        $end = $start + $len;
        for ($j = $start; $j <= $end; $j++) {
            $dist_x = ABS($path1[$j + $len]['x'] - $path1[$j]['x']);
            $dist_y = ABS($path1[$j + $len]['y'] - $path1[$j]['y']);
            $dist = sqrt($dist_x * $dist_x + $dist_y * $dist_y);
            //parse_debug_report("len=$len, slide=$slide,iend=$iend, start=$start, end=$end,j=$j,j2=".($j+$len)." total nodes =".$path1['lk']." dist=$dist x1=".$path1[$j+$len]['x']." y1 =".$path1[$j+$len]['y']." x2=".$path1[$j]['x']." y2=".$path1[$j]['y']."");
            if ($dist < $WP_EXACT_MATCH_ERROR) {
                $matchcount++;
            }
        }
        if ($matchcount == $len) {
            $pointcount += $len;
        }
        //		$pointcount += $matchcount;
    }
    return $pointcount;
}
Exemplo n.º 15
0
function tender($right, $strl)
{
    $tender_upc = "";
    $dollar = $_SESSION["dollarOver"];
    // // set_error_handler("prehkeys_dataError");
    if ($_SESSION["LastID"] == 0) {
        boxMsg("transaction in progress");
    } elseif ($strl > 999999) {
        xboxMsg("tender amount of " . truncate2($strl / 100) . "<BR>exceeds allowable limit");
    } elseif ($right == "WT") {
        xboxMsg("WIC tender not applicable");
    } elseif ($right == "CK" && $_SESSION["ttlflag"] == 1 && ($_SESSION["isMember"] != 0 || $_SESSION["isStaff"] != 0) && $strl / 100 - $_SESSION["amtdue"] - 0.005 > $dollar && $_SESSION["cashOverLimit"] == 1) {
        boxMsg("member or staff check tender cannot exceed total purchase by over \$" . $dollar . ".00");
    } elseif (($right == "CC" || $right == "TB") && $strl / 100 > $_SESSION["amtdue"] + 0.005 && $_SESSION["refundTotal"] == 0) {
        xboxMsg("credit card tender cannot exceed purchase amount");
    } elseif ($right == "FS" && $strl / 100 > $_SESSION["fsEligible"] + 0.005 && $_SESSION["refundTotal"] == 0) {
        xboxMsg("EBT food tender cannot exceed eligible amount");
    } elseif ($right == "EF" && truncate2($strl / 100) > $_SESSION["fsEligible"]) {
        xboxMsg("no way!");
    } else {
        getsubtotals();
        if ($_SESSION["ttlflag"] == 1 && ($right == "CX" || $right == "MI")) {
            // added ttlflag on 2/28/05 apbw
            $charge_ok = chargeOk();
            if ($right == "CX" && $charge_ok == 1 && strlen($_SESSION["memberID"]) == 5 && substr($_SESSION["memberID"], 0, 1) == "5") {
                $charge_ok = 1;
            } elseif ($right == "MI" && $charge_ok == 1) {
                $charge_ok = 1;
            } else {
                $charge_ok = 0;
            }
        }
        //		else $_SESSION["chargetender"] = 0;		// commented out by apbw 2/14/05 - reset flag in printlib only
        $strl = $strl / 100;
        if ($_SESSION["ttlflag"] == 0) {
            boxMsg("transaction must be totaled before tender can be accepted");
        } elseif (($right == "FS" || $right == "EF") && $_SESSION["fntlflag"] == 0) {
            boxMsg("eligble amount must be totaled before foodstamp tender can be accepted");
        } elseif ($right == "EF" && $_SESSION["fntlflag"] == 1 && $_SESSION["fsEligible"] + 10 <= $strl) {
            xboxMsg("Foodstamp tender cannot exceed elible amount by over \$10.00");
        } elseif ($right == "CX" && $charge_ok == 0) {
            xboxMsg("member " . $_SESSION["memberID"] . "<BR>is not authorized<BR>to make corporate charges");
        } elseif ($right == "MI" && $_SESSION["isStaff"] == 0) {
            // apbw 2/15/05 SCR
            xboxMsg("member " . $_SESSION["memberID"] . "<BR>is not authorized<BR>to make employee charges");
            // apbw 2/15/05 SCR
        } elseif ($right == "MI" && $charge_ok == 0 && $_SESSION["availBal"] < 0) {
            xboxMsg("member " . $_SESSION["memberID"] . "<BR> has \$" . $_SESSION["availBal"] . " available.");
        } elseif ($right == "MI" && $charge_ok == 1 && $_SESSION["availBal"] < 0) {
            xboxMsg("member " . $_SESSION["memberID"] . "<BR>is over limit");
        } elseif ($right == "MI" && $charge_ok == 0) {
            xboxMsg("member " . $_SESSION["memberID"] . "<BR>is not authorized to make employee charges");
        } elseif ($right == "MI" && $charge_ok == 1 && $_SESSION["availBal"] + $_SESSION["memChargeTotal"] - $strl <= 0) {
            xboxMsg("member " . $_SESSION["memberID"] . "<br> has exceeded charge limit");
        } elseif ($right == "MI" && $charge_ok == 1 && ABS($_SESSION["memChargeTotal"]) + $strl >= $_SESSION["availBal"] + 0.005 && $_SESSION["store"] == "WFC") {
            $memChargeRemain = $_SESSION["availBal"];
            $memChargeCommitted = $memChargeRemain + $_SESSION["memChargeTotal"];
            xboxMsg("available balance for charge <br>is only \$" . $memChargeCommitted . ".<br><b><font size = 5>\$" . number_format($memChargeRemain, 2) . "</font></b><br>may still be used on this purchase.");
        } elseif (($right == "MI" || $right == "CX") && truncate2($_SESSION["amtdue"]) < truncate2($strl)) {
            xboxMsg("charge tender exceeds purchase amount");
        } else {
            $query = "select * from tenders where tendercode = '" . $right . "'";
            $db = pDataConnect();
            $result = sql_query($query, $db);
            $num_rows = sql_num_rows($result);
            if ($num_rows == 0) {
                inputUnknown();
            } else {
                $row = sql_fetch_array($result);
                $tender_code = $right;
                $tendered = -1 * $strl;
                if ($tender_code == "CC" && $_SESSION["CCintegrate"] == 1) {
                    $tender_upc = $_SESSION["troutd"];
                }
                /* else{
                				$tender_desc = $row["TenderName"];
                			}
                			*/
                $tender_desc = $row["TenderName"];
                $_SESSION["tenderamt"] = $strl;
                $unit_price = 0;
                if ($tender_code == "FS" && $strl > $_SESSION["fsEligible"] && $strl < $_SESSION["subtotal"]) {
                    $unit_price = -1 * $_SESSION["fsEligible"];
                } elseif ($tender_code == "FS") {
                    $unit_price = -1 * $strl;
                }
                if ($strl - $_SESSION["amtdue"] > 0) {
                    $_SESSION["change"] = $strl - $_SESSION["amtdue"];
                } else {
                    $_SESSION["change"] = 0;
                }
                // ccm-rle 9-23-09 This is where the pop-up screen requires check endorsement. CCM will comment out because they don't require check endorsement. problem is this is the start of a if statement and without it the else needs to be removed as well and the following bracket
                //				if ($right == "CK" && $_SESSION["msgrepeat"] == 0) {
                //					$_SESSION["boxMsg"] = "<BR>insert check</B><BR>press [enter] to endorse<P><FONT size='-1'>[clear] to cancel</FONT>";
                //					$_SESSION["endorseType"] = "check";
                //					boxMsgscreen();
                //				}
                //				elseif ($right == "TC" && $_SESSION["msgrepeat"] == 0) {		//	commented out to prevent gift cert franking
                //					$_SESSION["boxMsg"] = "<B> insert gift certificate<B><BR>press [enter] to endorse<P><FONT size='-1'>[clear] to cancel</FONT>";
                //					$_SESSION["endorseType"] = "check";
                //					boxMsgscreen();
                //				}
                // ccm-rle 9-23-09 commented out the following else because check endorsing no longer needed
                //				else {
                addItem($tender_upc, $tender_desc, "T", $tender_code, "", 0, 0, $unit_price, $tendered, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                $_SESSION["msgrepeat"] = 0;
                $_SESSION["TenderType"] = $tender_code;
                /***added by apbw 2/1/05 SCR ***/
                /*** session tender type set by apbw 2/28/05 ***/
                if ($_SESSION["TenderType"] == "MI" || $_SESSION["TenderType"] == "CX") {
                    // apbw 2/28/05 SCR
                    $_SESSION["chargetender"] = 1;
                    // apbw 2/28/05 SCR
                }
                // apbw 2/28/05 SCR
                getsubtotals();
                //					if ($right == "FS" || $right == "EF") {
                //						addfsTaxExempt();
                //					}
                if ($right == "FS") {
                    $fs = -1 * $_SESSION["fsEligible"];
                    $fs_ones = ($fs * 100 - $fs * 100 % 100) / 100;
                    $fs_change = $fs - $fs_ones;
                    if ($fs_ones > 0) {
                        addfsones($fs_ones);
                    }
                    if ($fs_change > 0) {
                        addchange($fs_change);
                    }
                    getsubtotals();
                }
                if ($_SESSION["amtdue"] <= 0.005) {
                    $_SESSION["change"] = -1 * $_SESSION["amtdue"];
                    $cash_return = $_SESSION["change"];
                    if ($right != "FS") {
                        addchange($cash_return);
                    }
                    if ($right == "CK" && $cash_return > 0) {
                        $_SESSION["cashOverAmt"] = 1;
                    }
                    // apbw/cvr 3/5/05 cash back beep
                    $_SESSION["End"] = 1;
                    printReceiptfooter();
                } else {
                    $_SESSION["change"] = 0;
                    $_SESSION["fntlflag"] = 0;
                    ttl();
                    lastpage();
                }
                // ccm-rle 9-23-09 commented out following bracket to compensate for removing if and else for check endorsement
                //				}
            }
        }
    }
}
Exemplo n.º 16
0
     $OrderLine->DiscountPercent = 0;
 }
 if (!Is_Date($_POST['ItemDue_' . $OrderLine->LineNumber])) {
     prnMsg(_('An invalid date entry was made for ') . ' ' . $NewItem . ' ' . _('The date entry') . ' ' . $ItemDue . ' ' . _('must be in the format') . ' ' . $_SESSION['DefaultDateFormat'], 'warn');
     //Attempt to default the due date to something sensible?
     $_POST['ItemDue_' . $OrderLine->LineNumber] = DateAdd(Date($_SESSION['DefaultDateFormat']), 'd', $_SESSION['Items' . $identifier]->DeliveryDays);
 }
 if ($Quantity < 0 or $Price < 0 or $DiscountPercentage > 100 or $DiscountPercentage < 0) {
     prnMsg(_('The item could not be updated because you are attempting to set the quantity ordered to less than 0 or the price less than 0 or the discount more than 100% or less than 0%'), 'warn');
 } elseif ($_SESSION['Items' . $identifier]->Some_Already_Delivered($OrderLine->LineNumber) != 0 and $_SESSION['Items' . $identifier]->LineItems[$OrderLine->LineNumber]->Price != $Price) {
     prnMsg(_('The item you attempting to modify the price for has already had some quantity invoiced at the old price the items unit price cannot be modified retrospectively'), 'warn');
 } elseif ($_SESSION['Items' . $identifier]->Some_Already_Delivered($OrderLine->LineNumber) != 0 and $_SESSION['Items' . $identifier]->LineItems[$OrderLine->LineNumber]->DiscountPercent != $DiscountPercentage / 100) {
     prnMsg(_('The item you attempting to modify has had some quantity invoiced at the old discount percent the items discount cannot be modified retrospectively'), 'warn');
 } elseif ($_SESSION['Items' . $identifier]->LineItems[$OrderLine->LineNumber]->QtyInv > $Quantity) {
     prnMsg(_('You are attempting to make the quantity ordered a quantity less than has already been invoiced') . '. ' . _('The quantity delivered and invoiced cannot be modified retrospectively'), 'warn');
 } elseif ($OrderLine->Quantity != $Quantity or $OrderLine->Price != $Price or ABS($OrderLine->DiscountPercent - $DiscountPercentage / 100) > 0.001 or $OrderLine->Narrative != $Narrative or $OrderLine->ItemDue != $_POST['ItemDue_' . $OrderLine->LineNumber] or $OrderLine->POLine != $_POST['POLine_' . $OrderLine->LineNumber]) {
     $WithinCreditLimit = true;
     if ($_SESSION['CheckCreditLimits'] > 0 and $AlreadyWarnedAboutCredit == false) {
         /*Check credit limits is 1 for warn breach their credit limit and 2 for prohibit sales */
         $DifferenceInOrderValue = $Quantity * $Price * (1 - $DiscountPercentage / 100) - $OrderLine->Quantity * $OrderLine->Price * (1 - $OrderLine->DiscountPercent);
         $_SESSION['Items' . $identifier]->CreditAvailable -= $DifferenceInOrderValue;
         if ($_SESSION['CheckCreditLimits'] == 1 and $_SESSION['Items' . $identifier]->CreditAvailable <= 0) {
             prnMsg(_('The customer account will breach their credit limit'), 'warn');
             $AlreadyWarnedAboutCredit = true;
         } elseif ($_SESSION['CheckCreditLimits'] == 2 and $_SESSION['Items' . $identifier]->CreditAvailable <= 0) {
             prnMsg(_('This change would put the customer over their credit limit and is prohibited'), 'warn');
             $WithinCreditLimit = false;
             $_SESSION['Items' . $identifier]->CreditAvailable += $DifferenceInOrderValue;
             $AlreadyWarnedAboutCredit = true;
         }
     }
Exemplo n.º 17
0
    echo '<td>' . $JournalItem->Narrative . "</td>\n\t\t\t\t\t\t\t\t\t<td><a href='" . $_SERVER['PHP_SELF'] . '?' . SID . '&Delete=' . $JournalItem->ID . "'>" . _('Delete') . '</a></td>
							</tr>';
}
echo '<tr class="EvenTableRows"><td></td>
					<td align=right><b> Total </b></td>
					<td align=right><b>' . number_format($debittotal, 2) . '</b></td>
					<td align=right><b>' . number_format($credittotal, 2) . '</b></td>';
if ($debittotal != $credittotal) {
    echo '<td align=center style="background-color: #fddbdb"><b>Required to balance - ' . number_format(abs($debittotal - $credittotal), 2);
}
if ($debittotal > $credittotal) {
    echo ' Credit';
} else {
    if ($debittotal < $credittotal) {
        echo ' Debit';
    }
}
echo '</b></td></tr></table></td></tr></table>';
if (ABS($_SESSION['JournalDetail']->JournalTotal) < 0.001 and $_SESSION['JournalDetail']->GLItemCounter > 0) {
    echo "<br><br><input type=submit name='CommitBatch' value='" . _('Accept and Process Journal') . "'>";
} elseif (count($_SESSION['JournalDetail']->GLEntries) > 0) {
    echo '<br><br>';
    prnMsg(_('The journal must balance ie debits equal to credits before it can be processed'), 'warn');
}
if (!isset($_GET['NewJournal']) or $_GET['NewJournal'] == '') {
    echo "<script>defaultControl(document.form.GLManualCode);</script>";
} else {
    echo "<script>defaultControl(document.form.JournalProcessDate);</script>";
}
echo '</form>';
include 'includes/footer.inc';
Exemplo n.º 18
0
function tender($right, $strl)
{
    $tender_upc = "";
    $dollar = $_SESSION["dollarOver"];
    if ($_SESSION["LastID"] == 0) {
        boxMsg("transaction in progress");
    } elseif ($strl > 999999) {
        xboxMsg("tender amount of " . truncate2($strl / 100) . "<br />exceeds allowable limit");
    } elseif ($right == "WT") {
        xboxMsg("WIC tender not applicable");
    } elseif ($right == "CK" && $_SESSION["ttlflag"] == 1 && ($_SESSION["isMember"] != 0 || $_SESSION["isStaff"] != 0) && $strl / 100 - $_SESSION["amtdue"] - 0.005 > $dollar && $_SESSION["cashOverLimit"] == 1) {
        boxMsg("member or staff check tender cannot exceed total purchase by over \$" . $dollar . ".00");
    } elseif (($right == "CC" || $right == "TB") && $strl / 100 > $_SESSION["amtdue"] + 0.005 && $_SESSION["refundTotal"] == 0) {
        xboxMsg("credit card tender cannot exceed purchase amount");
    } elseif ($right == "FS" && $strl / 100 > $_SESSION["fsEligible"] + 0.005 && $_SESSION["refundTotal"] == 0) {
        xboxMsg("EBT food tender cannot exceed eligible amount");
    } elseif ($right == "EF" && truncate2($strl / 100) > $_SESSION["fsEligible"]) {
        xboxMsg("no way!");
    } else {
        getsubtotals();
        if ($_SESSION["ttlflag"] == 1 && ($right == "CX" || $right == "MI")) {
            // added ttlflag on 2/28/05 apbw
            $charge_ok = chargeOk();
            if ($right == "CX" && $charge_ok == 1) {
                $charge_ok = 1;
            } elseif ($right == "MI" && $charge_ok == 1) {
                $charge_ok = 1;
            } else {
                $charge_ok = 0;
            }
        }
        $strl = $strl / 100;
        if ($_SESSION["ttlflag"] == 0) {
            boxMsg("transaction must be totaled before tender can be accepted");
        } elseif (($right == "FS" || $right == "EF") && $_SESSION["fntlflag"] == 0) {
            boxMsg("eligble amount must be totaled before foodstamp tender can be accepted");
        } elseif ($right == "EF" && $_SESSION["fntlflag"] == 1 && $_SESSION["fsEligible"] + 10 <= $strl) {
            xboxMsg("Foodstamp tender cannot exceed elible amount by over \$10.00");
        } elseif ($right == "CX" && $charge_ok == 0) {
            xboxMsg("member " . $_SESSION["memberID"] . "<br />is not authorized<br />to make corporate charges");
        } elseif ($right == "MI" && $_SESSION["isStaff"] == 0) {
            // apbw 2/15/05 SCR
            xboxMsg("member " . $_SESSION["memberID"] . "<br />is not authorized<br />to make employee charges");
            // apbw 2/15/05 SCR
        } elseif ($right == "MI" && $charge_ok == 0 && $_SESSION["availBal"] < 0) {
            xboxMsg("member " . $_SESSION["memberID"] . "<br /> has \$" . $_SESSION["availBal"] . " available.");
        } elseif ($right == "MI" && $charge_ok == 1 && $_SESSION["availBal"] < 0) {
            xboxMsg("member " . $_SESSION["memberID"] . "<br />is over limit");
        } elseif ($right == "MI" && $charge_ok == 0) {
            xboxMsg("member " . $_SESSION["memberID"] . "<br />is not authorized to make employee charges");
        } elseif ($right == "MI" && $charge_ok == 1 && $_SESSION["availBal"] + $_SESSION["memChargeTotal"] - $strl <= 0) {
            xboxMsg("member " . $_SESSION["memberID"] . "<br /> has exceeded charge limit");
        } elseif ($right == "MI" && $charge_ok == 1 && ABS($_SESSION["memChargeTotal"]) + $strl >= $_SESSION["availBal"] + 0.005 && $_SESSION["store"] == "WFC") {
            $memChargeRemain = $_SESSION["availBal"];
            $memChargeCommitted = $memChargeRemain + $_SESSION["memChargeTotal"];
            xboxMsg("available balance for charge <br />is only \$" . $memChargeCommitted . ".<br /><b><font size = 5>\$" . number_format($memChargeRemain, 2) . "</font></b><br />may still be used on this purchase.");
        } elseif (($right == "MI" || $right == "CX") && truncate2($_SESSION["amtdue"]) < truncate2($strl)) {
            xboxMsg("charge tender exceeds purchase amount");
        } else {
            $query = "select * from tenders where tendercode = '" . $right . "'";
            $db = pDataConnect();
            $result = sql_query($query, $db);
            $num_rows = sql_num_rows($result);
            if ($num_rows == 0) {
                inputUnknown();
            } else {
                $row = sql_fetch_array($result);
                $tender_code = $right;
                $tendered = -1 * $strl;
                if ($tender_code == "CC" && $_SESSION["CCintegrate"] == 1) {
                    $tender_upc = $_SESSION["troutd"];
                }
                $tender_desc = $row["TenderName"];
                $_SESSION["tenderamt"] = $strl;
                $unit_price = 0;
                if ($tender_code == "FS" && $strl > $_SESSION["fsEligible"] && $strl < $_SESSION["subtotal"]) {
                    $unit_price = -1 * $_SESSION["fsEligible"];
                } elseif ($tender_code == "FS") {
                    $unit_price = -1 * $strl;
                }
                if ($strl - $_SESSION["amtdue"] > 0) {
                    $_SESSION["change"] = $strl - $_SESSION["amtdue"];
                } else {
                    $_SESSION["change"] = 0;
                }
                if ($right == "CK" && $_SESSION["msgrepeat"] == 0) {
                    $_SESSION["boxMsg"] = "<br />insert check<br />press [enter] to endorse<p><font size='-1'>[clear] to cancel</font></p>";
                    $_SESSION["endorseType"] = "check";
                    boxMsgscreen();
                } else {
                    addItem($tender_upc, $tender_desc, "T", $tender_code, "", 0, 0, 0, $unit_price, $tendered, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '');
                    $_SESSION["msgrepeat"] = 0;
                    $_SESSION["TenderType"] = $tender_code;
                    /***added by apbw 2/1/05 SCR ***/
                    /*** session tender type set by apbw 2/28/05 ***/
                    if ($_SESSION["TenderType"] == "MI" || $_SESSION["TenderType"] == "CX") {
                        $_SESSION["chargetender"] = 1;
                        // apbw 2/28/05 SCR
                    }
                    // apbw 2/28/05 SCR
                    getsubtotals();
                    if ($right == "FS") {
                        $fs = -1 * $_SESSION["fsEligible"];
                        $fs_ones = ($fs * 100 - $fs * 100 % 100) / 100;
                        $fs_change = $fs - $fs_ones;
                        if ($fs_ones > 0) {
                            addfsones($fs_ones);
                        }
                        if ($fs_change > 0) {
                            addchange($fs_change);
                        }
                        getsubtotals();
                    }
                    if ($_SESSION["amtdue"] <= 0.005) {
                        $_SESSION["change"] = -1 * $_SESSION["amtdue"];
                        $cash_return = $_SESSION["change"];
                        if ($right != "FS") {
                            addchange($cash_return);
                        }
                        if ($right == "CK" && $cash_return > 0) {
                            $_SESSION["cashOverAmt"] = 1;
                            // apbw/cvr 3/5/05 cash back beep
                        }
                        $_SESSION["End"] = 1;
                        printReceiptfooter();
                    } else {
                        $_SESSION["change"] = 0;
                        $_SESSION["fntlflag"] = 0;
                        ttl();
                        lastpage();
                    }
                }
            }
        }
    }
}
Exemplo n.º 19
0
 function getHourDiff($firstHour, $secondHour)
 {
     $dtime = substr($firstHour, 0, 5);
     $atime = substr($secondHour, 0, 5);
     $nextDay = $dtime > $atime ? 1 : 0;
     $dep = EXPLODE(':', $dtime);
     $arr = EXPLODE(':', $atime);
     $diff = ABS(MKTIME($dep[0], $dep[1], 0, DATE('n'), DATE('j'), DATE('y')) - MKTIME($arr[0], $arr[1], 0, DATE('n'), DATE('j') + $nextDay, DATE('y')));
     $hours = FLOOR($diff / (60 * 60));
     $mins = FLOOR(($diff - $hours * 60 * 60) / 60);
     $secs = FLOOR($diff - ($hours * 60 * 60 + $mins * 60));
     if (STRLEN($hours) < 2) {
         $hours = "0" . $hours;
     }
     if (STRLEN($mins) < 2) {
         $mins = "0" . $mins;
     }
     if (STRLEN($secs) < 2) {
         $secs = "0" . $secs;
     }
     $temp = floatval($mins / 60);
     $temp += $hours;
     return $temp;
 }
Exemplo n.º 20
0
 private function getComboCodeList($from_codelist, $md_value)
 {
     $rs = '';
     if ($from_codelist == '') {
         setMickaLog("from_codelist={$from_codelist}!", 'ERROR', 'EditForm.getComboCodeList');
         return $rs;
     }
     $from_codelist = (int) $from_codelist;
     $pom_from_codelist = ABS($from_codelist);
     //setMickaLog("from_codelist=$pom_from_codelist", 'DEBUG', 'EditForm.php (getComboCodeList)');
     if (array_key_exists($pom_from_codelist, $this->code_list_array)) {
         foreach ($this->code_list_array[$pom_from_codelist] as $pom_value) {
             //my_print_r($pom_value);
             if ($from_codelist == 1460 && $this->mds == 0 && $pom_value['d'] < 0) {
                 continue;
             }
             if ($from_codelist == 1460 && $this->mds == 10 && $pom_value['d'] > 0) {
                 continue;
             }
             foreach ($pom_value as $key => $value) {
                 if ($key == 't') {
                     $pom_t = $value;
                 }
                 if ($key == 'd') {
                     $pom_d = $value;
                 }
                 if ($key == 'n') {
                     $pom_n = $value;
                 }
             }
             if ($from_codelist > 0) {
                 if ($md_value == $pom_n) {
                     $rs .= '<option value="' . $pom_n . '" selected>' . $pom_t;
                 } else {
                     $rs .= '<option value="' . $pom_n . '">' . $pom_t;
                 }
             } elseif ($from_codelist < 0) {
                 if ($md_value == $pom_d) {
                     $rs .= '<option value="' . $pom_d . '" selected>' . $pom_t;
                 } else {
                     $rs .= '<option value="' . $pom_d . '">' . $pom_t;
                 }
             }
         }
     }
     return $rs;
 }
Exemplo n.º 21
0
 public function procDistanceTime($coor, $thiscoor, $ref, $mode)
 {
     global $bid14, $database, $generator;
     $resarray = $database->getResourceLevel($generator->getBaseID($coor['x'], $coor['y']));
     $xdistance = ABS($thiscoor['x'] - $coor['x']);
     if ($xdistance > WORLD_MAX) {
         $xdistance = 2 * WORLD_MAX + 1 - $xdistance;
     }
     $ydistance = ABS($thiscoor['y'] - $coor['y']);
     if ($ydistance > WORLD_MAX) {
         $ydistance = 2 * WORLD_MAX + 1 - $ydistance;
     }
     $distance = SQRT(POW($xdistance, 2) + POW($ydistance, 2));
     if (!$mode) {
         if ($ref == 1) {
             $speed = 16;
         } else {
             if ($ref == 2) {
                 $speed = 12;
             } else {
                 if ($ref == 3) {
                     $speed = 24;
                 } else {
                     if ($ref == 300) {
                         $speed = 5;
                     } else {
                         $speed = 1;
                     }
                 }
             }
         }
     } else {
         $speed = $ref;
         if ($this->getsort_typeLevel(14, $resarray) != 0 && $distance >= TS_THRESHOLD) {
             $speed = $speed * ($bid14[$this->getsort_typeLevel(14, $resarray)]['attri'] / 100);
         }
     }
     if ($speed != 0) {
         return round($distance / $speed * 3600 / INCREASE_SPEED);
     } else {
         return round($distance * 3600 / INCREASE_SPEED);
     }
 }
Exemplo n.º 22
0
 public function procDistanceTime($coor, $thiscoor, $ref, $vid)
 {
     global $bid28, $bid14;
     $xdistance = ABS($thiscoor['x'] - $coor['x']);
     if ($xdistance > WORLD_MAX) {
         $xdistance = 2 * WORLD_MAX + 1 - $xdistance;
     }
     $ydistance = ABS($thiscoor['y'] - $coor['y']);
     if ($ydistance > WORLD_MAX) {
         $ydistance = 2 * WORLD_MAX + 1 - $ydistance;
     }
     $distance = SQRT(POW($xdistance, 2) + POW($ydistance, 2));
     $speed = $ref;
     if ($this->getTypeLevel(14, $vid) != 0 && $distance >= TS_THRESHOLD) {
         $speed = $speed * ($bid14[$this->getTypeLevel(14, $vid)]['attri'] / 100);
     }
     if ($speed != 0) {
         return round($distance / $speed * 3600 / INCREASE_SPEED);
     } else {
         return round($distance * 3600 / INCREASE_SPEED);
     }
 }
Exemplo n.º 23
0
 function getTimeDiff($dtime, $atime)
 {
     $dtime = substr($dtime, 0, 5);
     $atime = substr($atime, 0, 5);
     $nextDay = $dtime > $atime ? 1 : 0;
     $dep = EXPLODE(':', $dtime);
     $arr = EXPLODE(':', $atime);
     $diff = ABS(MKTIME($dep[0], $dep[1], 0, DATE('n'), DATE('j'), DATE('y')) - MKTIME($arr[0], $arr[1], 0, DATE('n'), DATE('j') + $nextDay, DATE('y')));
     $hours = FLOOR($diff / (60 * 60));
     $mins = FLOOR(($diff - $hours * 60 * 60) / 60);
     $secs = FLOOR($diff - ($hours * 60 * 60 + $mins * 60));
     if (STRLEN($hours) < 2) {
         $hours = "0" . $hours;
     }
     if (STRLEN($mins) < 2) {
         $mins = "0" . $mins;
     }
     if (STRLEN($secs) < 2) {
         $secs = "0" . $secs;
     }
     return $hours . ':' . $mins . ':' . $secs;
 }
 /**
  * Aktualisiert den Gerätestatus
  * @param from Request DeviceID DeviceID
  * @return true/false
  *
  */
 public function updateDeviceStatus($ErrorString = "", $StatusString = "")
 {
     $Request = new Request();
     $ID = $Request->getAsInt("DeviceID");
     $Status = $Request->getAsInt("DeviceStatus");
     $DeviceManager = new DeviceManager();
     $Status = ABS($Status - 1);
     $DeviceManager->updateStatusById($ID, $Status);
     /* TODO: Rückgabe prüfen!!! */
     return true;
 }
Exemplo n.º 25
0
        }
        echo '<td>' . $AllocnItem->TransType . '</td>
			<td>' . $AllocnItem->TypeNo . '</td>
			<td class="number">' . $AllocnItem->TransDate . '</td>
			<td class="number">' . locale_number_format($AllocnItem->TransAmount, $_SESSION['Alloc']->CurrDecimalPlaces) . '</td>
			<td class="number">' . locale_number_format($YetToAlloc, $_SESSION['Alloc']->CurrDecimalPlaces) . '</td>';
        $j++;
        if ($AllocnItem->TransAmount < 0) {
            $Balance += $YetToAlloc;
            echo '<td>' . $curTrans . '</td>
						<td class="number">' . locale_number_format($Balance, $_SESSION['Alloc']->CurrDecimalPlaces) . '</td>
					</tr>';
        } else {
            echo '<td class="number"><input type="hidden" name="YetToAlloc' . $Counter . '" value="' . round($YetToAlloc, $_SESSION['Alloc']->CurrDecimalPlaces) . '" />';
            echo '<input tabindex="' . $j . '" type="checkbox" title="' . _('Check this box to allocate the entire amouunt of this transaction. Just enter the amount without ticking this check box for a partial allocation') . '" name="All' . $Counter . '"';
            if (ABS($AllocnItem->AllocAmt - $YetToAlloc) < 0.01) {
                echo ' checked="checked" />';
            } else {
                echo ' />';
            }
            $Balance += $YetToAlloc - $AllocnItem->AllocAmt;
            $j++;
            echo '<input tabindex="' . $j . '" type="text" class="number" ' . ($j == 1 ? 'autofocus="autofocus"' : '') . ' name="Amt' . $Counter . '" title="' . _('Enter the amount of this transaction to be allocated. Nothing should be entered here if the entire transaction is to be allocated, use the check box') . '" maxlength="12" size="13" value="' . locale_number_format(round($AllocnItem->AllocAmt, $_SESSION['Alloc']->CurrDecimalPlaces), $_SESSION['Alloc']->CurrDecimalPlaces) . '" />
					<input type="hidden" name="AllocID' . $Counter . '" value="' . $AllocnItem->ID . '" ></td>
					<td class="number">' . locale_number_format($Balance, $_SESSION['Alloc']->CurrDecimalPlaces) . '</td>
				</tr>';
        }
        $TotalAllocated += round($AllocnItem->AllocAmt, $_SESSION['Alloc']->CurrDecimalPlaces);
        $Counter++;
    }
    echo '<tr>
Exemplo n.º 26
0
        $module_id .= "<option value='{$rs['id']}' {$ckk}>{$rs['name']}</option>";
    }
    $module_id .= " </select>";
    require dirname(__FILE__) . "/" . "head.php";
    require dirname(__FILE__) . "/" . "template/sort/menu.htm";
    require dirname(__FILE__) . "/" . "template/sort/addsort.htm";
    require dirname(__FILE__) . "/" . "foot.php";
} elseif ($job == "listsort" && $Apower[sort_listsort]) {
    //统计文章总数
    @extract($db->get_one("SELECT COUNT(*) AS NUM FROM {$pre}article"));
    if (ABS($webdb[articleNUM] - $NUM) > 100) {
        write_config_cache(array('articleNUM' => $NUM));
    }
    //统计栏目总数
    @extract($db->get_one("SELECT COUNT(*) AS sortNUM FROM {$pre}sort"));
    if (ABS($webdb[sortNUM] - $sortNUM) > 10) {
        write_config_cache(array('sortNUM' => $sortNUM));
    }
    if ($only && $mid === '') {
        $listdb[] = array('id' => 0, 'name' => '文章模型');
        $query = $db->query("SELECT * FROM {$pre}article_module ORDER BY list DESC");
        while ($rs = $db->fetch_array($query)) {
            $listdb[] = $rs;
        }
        foreach ($listdb as $key => $rs) {
            @extract($db->get_one("SELECT COUNT(*) AS NUM FROM {$pre}sort WHERE fmid='{$rs['id']}'"));
            $rs[NUM] = intval($NUM);
            $listdb[$key] = $rs;
        }
        require dirname(__FILE__) . "/" . "head.php";
        require dirname(__FILE__) . "/" . "template/sort/choose_sort.htm";
Exemplo n.º 27
0
if (!isset($_POST['IncreasePercent'])) {
    $_POST['IncreasePercent'] = 0;
}
echo '<tr><td>' . _('Percentage Increase (positive) or decrease (negative)') . "</td>\n                <td><input name='IncreasePercent' size=4 maxlength=4 VALUE=" . $_POST['IncreasePercent'] . "></td></tr></table>";
echo "<div class='centre'><p><input type=submit name='UpdatePrices' VALUE='" . _('Update Prices') . '\'  onclick="return confirm(\'' . _('Are you sure you wish to update all the prices according to the criteria selected?') . '\');"></div>';
echo '</form>';
if (isset($_POST['UpdatePrices']) and isset($_POST['StkCat'])) {
    echo '<br>' . _('So we are using a price list/sales type of') . ' : ' . $_POST['PriceList'];
    echo '<br>' . _('and a stock category code of') . ' : ' . $_POST['StkCat'];
    echo '<br>' . _('and a increase percent of') . ' : ' . $_POST['IncreasePercent'];
    if ($_POST['PriceList'] == '0') {
        echo '<br>' . _('The price list/sales type to be updated must be selected first');
        include 'includes/footer.inc';
        exit;
    }
    if (ABS($_POST['IncreasePercent']) < 0.5 or ABS($_POST['IncreasePercent']) > 40 or !is_numeric($_POST['IncreasePercent'])) {
        echo '<br>' . _('The increase or decrease to be applied is expected to be an integer between 1 and 40 it is not necessary to enter the') . ' ' . '%' . ' ' . _('sign') . ' - ' . _('the amount is assumed to be a percentage');
        include 'includes/footer.inc';
        exit;
    }
    echo '<p>' . _('Price list') . ' ' . $_POST['PriceList'] . ' ' . _('prices for') . ' ' . $_POST['WhichPrices'] . ' ' . _('for the stock category') . ' ' . $_POST['StkCat'] . ' ' . _('will been incremented by') . ' ' . $_POST['IncreasePercent'] . ' ' . _('percent');
    $sql = "SELECT stockid FROM stockmaster WHERE categoryid='" . $_POST['StkCat'] . "'";
    $PartsResult = DB_query($sql, $db);
    $IncrementPercentage = $_POST['IncreasePercent'] / 100;
    while ($myrow = DB_fetch_array($PartsResult)) {
        if ($_POST['WhichPrices'] == 'Only Non-customer special prices') {
            $sql = "UPDATE prices SET price=price*(1+" . $IncrementPercentage . ")\n\t\t\t\t\t\t\tWHERE typeabbrev='" . $_POST['PriceList'] . "'\n\t\t\t\t\t\t\tAND stockid='" . $myrow['stockid'] . "'\n\t\t\t\t\t\t\tAND typeabbrev='" . $_POST['PriceList'] . "'\n\t\t\t\t\t\t\tAND debtorno=''";
        } else {
            if ($_POST['WhichPrices'] == 'Only customer special prices') {
                $sql = "UPDATE prices SET price=price*(1+" . $IncrementPercentage . ")\n\t\t\t\t\t\t\tWHERE typeabbrev='" . $_POST['PriceList'] . "'\n\t\t\t\t\t\t\tAND stockid='" . $myrow['stockid'] . "'\n\t\t\t\t\t\t\tAND typeabbrev='" . $_POST['PriceList'] . "'\n\t\t\t\t\t\t\tAND debtorno!=''";
            } else {
Exemplo n.º 28
0
                    }
                    echo '<td></td>
							<td class="number"><b>' . locale_number_format(-$PeriodTotal, $_SESSION['CompanyRecord']['decimalplaces']) . '</b></td>
							<td></td>
						</tr>';
                } else {
                    //its a debit balance b/fwd
                    if ($PandLAccount == True) {
                        $RunningTotal = 0;
                    }
                    echo '<td class="number"><b>' . locale_number_format($PeriodTotal, $_SESSION['CompanyRecord']['decimalplaces']) . '</b></td>
							<td colspan="2"></td>
						</tr>';
                }
                $IntegrityReport .= '<br />' . _('Period') . ': ' . $PeriodNo . _('Account movement per transaction') . ': ' . locale_number_format($PeriodTotal, $_SESSION['CompanyRecord']['decimalplaces']) . ' ' . _('Movement per ChartDetails record') . ': ' . locale_number_format($ChartDetailRow['actual'], $_SESSION['CompanyRecord']['decimalplaces']) . ' ' . _('Period difference') . ': ' . locale_number_format($PeriodTotal - $ChartDetailRow['actual'], 3);
                if (ABS($PeriodTotal - $ChartDetailRow['actual']) > 0.01 and $_POST['tag'] == 0) {
                    $ShowIntegrityReport = True;
                }
            }
            $PeriodNo = $myrow['periodno'];
            $PeriodTotal = 0;
        }
        if ($k == 1) {
            echo '<tr class="EvenTableRows">';
            $k = 0;
        } else {
            echo '<tr class="OddTableRows">';
            $k++;
        }
        $RunningTotal += $myrow['amount'];
        $PeriodTotal += $myrow['amount'];
Exemplo n.º 29
0
     exit;
 }
 if (DB_num_rows($CustomerResult) == 0) {
     $Title = _('Customer Balances') . ' - ' . _('Problem Report');
     include 'includes/header.inc';
     prnMsg(_('The customer details listing has no clients to report on'), 'warn');
     echo '<br /><a href="' . $RootPath . '/index.php">' . _('Back to the menu') . '</a>';
     include 'includes/footer.inc';
     exit;
 }
 include 'includes/PDFDebtorBalsPageHeader.inc';
 $TotBal = 0;
 while ($DebtorBalances = DB_fetch_array($CustomerResult, $db)) {
     $Balance = $DebtorBalances['balance'] - $DebtorBalances['afterdatetrans'] + $DebtorBalances['afterdatediffonexch'];
     $FXBalance = $DebtorBalances['fxbalance'] - $DebtorBalances['fxafterdatetrans'];
     if (abs($Balance) > 0.008999999999999999 or ABS($FXBalance) > 0.008999999999999999) {
         $DisplayBalance = locale_number_format($DebtorBalances['balance'] - $DebtorBalances['afterdatetrans'], $DebtorBalances['decimalplaces']);
         $DisplayFXBalance = locale_number_format($DebtorBalances['fxbalance'] - $DebtorBalances['fxafterdatetrans'], $DebtorBalances['decimalplaces']);
         $TotBal += $Balance;
         $LeftOvers = $pdf->addTextWrap($Left_Margin + 3, $YPos, 220 - $Left_Margin, $FontSize, $DebtorBalances['debtorno'] . ' - ' . html_entity_decode($DebtorBalances['name'], ENT_QUOTES, 'UTF-8'), 'left');
         $LeftOvers = $pdf->addTextWrap(220, $YPos, 60, $FontSize, $DisplayBalance, 'right');
         $LeftOvers = $pdf->addTextWrap(280, $YPos, 60, $FontSize, $DisplayFXBalance, 'right');
         $LeftOvers = $pdf->addTextWrap(350, $YPos, 100, $FontSize, $DebtorBalances['currency'], 'left');
         $YPos -= $line_height;
         if ($YPos < $Bottom_Margin + $line_height) {
             include 'includes/PDFDebtorBalsPageHeader.inc';
         }
     }
 }
 /*end customer aged analysis while loop */
 $YPos -= $line_height;
 public function inputKBT($x1, $y1, $z1, $x2, $y2, $z2, $alfa2, $beta2, $lp)
 {
     $SLP = $lp * sin($alfa2);
     $XHP = $x2 - $SLP * sin($beta2);
     $YHP = $y2 - $SLP * cos($beta2);
     $ZHP = $z2 - $lp * cos($alfa2);
     $X1prim = 0;
     $Y1prim = 0;
     $XHPprim = ($XHP - $x1) * cos($beta2) - ($YHP - $y1) * sin($beta2);
     $YHPprim = ($XHP - $x1) * sin($beta2) + ($YHP - $y1) * cos($beta2);
     $X2prim = ($x2 - $x1) * cos($beta2) - ($y2 - $y1) * sin($beta2);
     $Y2prim = ($x2 - $x1) * sin($beta2) + ($y2 - $y1) * cos($beta2);
     $IKS = $XHPprim;
     $IGREK = $YHPprim;
     $R = ABS(($IKS * $IKS + $IGREK * $IGREK) / 2 / $IKS);
     $delta0 = arcsin(abs($IGREK / $R));
     if ($IKS > 0) {
         $wsk = 1;
         $a = $IKS - $R;
         $b = $IGREK;
         if ($a >= 0 && $b >= 0) {
             $delta = pi() - $delta0;
         }
         if ($a >= 0 && $b < 0) {
             $delta = pi() + $delta0;
         }
         if ($a < 0 && $b >= 0) {
             $delta = $delta0;
         }
         if ($a < 0 && $b < 0) {
             $delta = 2 * pi() - $delta0;
         }
     } elseif ($IKS <= 0) {
         $wsk = -1;
         $a = $IKS + $R;
         $b = $IGREK;
         if ($a >= 0 && $b >= 0) {
             $delta = $delta0;
         }
         if ($a >= 0 && $b < 0) {
             $delta = 2 * pi() - $delta0;
         }
         if ($a < 0 && $b >= 0) {
             $delta = pi() - $delta0;
         }
         if ($a < 0 && $b < 0) {
             $delta = pi() + $delta0;
         }
     }
     $res['wskH'] = $wsk;
     $res['RH'] = $R;
     $res['deltaH'] = $delta;
     $res['SLK'] = $RH * $deltaH;
     $res['SLC'] = $SLK + $Slp;
     $S1 = 0;
     $S2 = $SLC;
     $S1prim = 0;
     $Z1prim = 0;
     $SHPprim = $SLK * cos($alfa2) - ($Z2 - $lp * cos($alfa2) - $Z1) * sin($alfa2);
     $ZHPprim = $SLK * sin($alfa2) + ($Z2 - $lp * cos($alfa2) - $Z1) * cos($alfa2);
     $S2prim = ($S2 - $S1) * cos($alfa2) - ($Z2 - $Z1) * sin($alfa2);
     $Z2prim = ($S2 - $S1) * sin($alfa2) + ($Z2 - $Z1) * cos($alfa2);
     $IKS = $SHPprim;
     $IGREK = $ZHPprim;
     $R = ABS(($IKS * $IKS + $IGREK * $IGREK) / 2 / $IKS);
     $delta0 = arcsin(abs($IGREK / $R));
     if ($IKS > 0) {
         $wsk = 1;
         $a = $IKS - $R;
         $b = $IGREK;
         if ($a >= 0 && $b >= 0) {
             $delta = pi() - $delta0;
         }
         if ($a >= 0 && $b < 0) {
             $delta = pi() + $delta0;
         }
         if ($a < 0 && $b >= 0) {
             $delta = $delta0;
         }
         if ($a < 0 && $b < 0) {
             $delta = 2 * pi() - $delta0;
         }
     } elseif ($IKS <= 0) {
         $wsk = -1;
         $a = $IKS + $R;
         $b = $IGREK;
         if ($a >= 0 && $b >= 0) {
             $delta = $delta0;
         }
         if ($a >= 0 && $b < 0) {
             $delta = 2 * pi() - $delta0;
         }
         if ($a < 0 && $b >= 0) {
             $delta = pi() - $delta0;
         }
         if ($a < 0 && $b < 0) {
             $delta = pi() + $delta0;
         }
     }
     $res['wskV'] = $wsk;
     $res['RV'] = $R;
     $res['deltaV'] = $delta;
     $res['LK'] = $RV * $deltaV;
     $res['LC'] = $LK * $lp;
     return $res;
 }