WIP Contracts 2024-06-05

This commit is contained in:
Frank Schubert
2024-06-05 16:26:19 +02:00
parent 2855a45208
commit 51d2f7717a
5 changed files with 104 additions and 43 deletions

View File

@@ -30,10 +30,8 @@ class Admin_IvtContractImport {
13322 => 2623,
2034 => false,
561 => false,
11409 => 1222, // x-tec 1842
14192 => 2596,
//tourismusverband thermen- & vulkanland
11221 => 1120,
11222 => 1044,
@@ -42,22 +40,42 @@ class Admin_IvtContractImport {
11225 => 1002,
11226 => 999,
11227 => 1000,
2987 => 4126, // Atos
14890 => 3612,
14891 => 3612,
13551 => 2776, // Wolfgang Lipp
14908 => 2776,
13552 => 2055,
10550 => 230, // Anneliese Wabnegg
10551 => 230,
10995 => 1190
10995 => 1190,
12040 => 1687, // peter junior koch
12179 => 1687,
12982 => 1863, // reinhard strauss
12983 => 1863,
13188 => false, // magna
10909 => 2820, // bernd zöhrer
12101 => false,
14679 => 2820,
10041 => 3351, // walter würfel
15759 => 3351,
10483 => 1042, // joachim novak
10850 => 1042,
13216 => 1310, // theo werner koblischek
13217 => 1310,
13456 => 2060,
13746 => 3614, // manfred hartmann
13747 => 3614,
13436 => 2076, // hernuß josef gmbh
13437 => 2076,
13440 => 2077,
13441 => 2077,
14295 => 3172, // Christa Eisenberger-Strobl
15545 => 3172,
14189 => 3322, // andeßner-angleitner
16722 => 3322,
16267 => 3079, // schmuck marianne
16786 => 3079
];
}
@@ -73,7 +91,8 @@ class Admin_IvtContractImport {
$last_cid = 0;
$i = 0;
foreach(IvtCustomerProductModel::search(["lasdt_date>", "2023-04-01"], "cid") as $ivt_contract) {
foreach(IvtCustomerProductModel::search(["lastdate>", "2023-04-01"]) as $ivt_contract) {
//if($ivt_contract->cid < 104200) continue;
//if($i > 1000 && $ivt_contract->cid != $last_cid) break; // only break after the last ivtcontract of this customer
$last_cid = $ivt_contract->cid;

View File

@@ -467,6 +467,22 @@ class ContractModel {
$where .= " AND Contract.price >= $price";
}
}
if(array_key_exists("billing_period", $filter)) {
$billing_period = $filter['billing_period'];
if(is_numeric($billing_period)) {
$where .= " AND Contract.billing_period=$billing_period";
}
}
if(array_key_exists("finish_date>", $filter)) {
$finish_date = $filter['finish_date>'];
if(is_numeric($finish_date)) {
$where .= " AND Contract.finish_date >= $finish_date";
}
}
if(array_key_exists("add-where", $filter)) {
$where .= " ".$filter['add-where'];

View File

@@ -33,9 +33,9 @@ class IvtCustomerProduct extends mfBaseModel {
if($name == "product") {
$ivtproduct = new IvtProduct($this->pid);
if($ivtproduct->id) {
$this->ivtproduct = $ivtproduct;
$this->product = $ivtproduct;
}
return $this->ivtproduct;
return $this->product;
}
if($name == "customer") {

View File

@@ -15,7 +15,7 @@ class IvtCustomerProductModel {
$res = $db->select("customer_product", "*", "1=1 ORDER BY $order");
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new IvtCustomerTelephoneNr($data);
$items[] = new IvtCustomerProduct($data);
}
}
return $items;
@@ -28,7 +28,7 @@ class IvtCustomerProductModel {
$res = $db->select("customer_product", "*", "$where ORDER BY id LIMIT 1");
if($db->num_rows($res)) {
$data = $db->fetch_object($res);
$item = new IvtCustomerTelephoneNr($data);
$item = new IvtCustomerProduct($data);
if($item->id) {
return $item;
} else {
@@ -63,7 +63,7 @@ class IvtCustomerProductModel {
if(is_array($limit) && count($limit)) {
if(is_numeric($limit['start']) && is_numeric($limit['count'])) {
$sql .= " LIMIT ".$limit['start'].", ".$limit['count'];
} elseif(is_numeric($count)) {
} elseif(is_numeric($limit['count'])) {
$sql .= " LIMIT ".$limit['count'];
}
}
@@ -71,7 +71,7 @@ class IvtCustomerProductModel {
$res = $db->query($sql);
if($db->num_rows($res)) {
while($data = $db->fetch_object($res)) {
$items[] = new IvtCustomerTelephoneNr($data);
$items[] = new IvtCustomerProduct($data);
}
}
return $items;
@@ -79,24 +79,7 @@ class IvtCustomerProductModel {
private static function getSqlFilter($filter) {
$where = "1=1 ";
/*
if(array_key_exists("status_id", $filter)) {
$status_id = $filter['status_id'];
if(is_numeric($status_id)) {
$where .= " AND IvtCustomerProduct.status_id=$status_id";
}
}
if(array_key_exists("street", $filter)) {
$street = FronkDB::singleton()->escape($filter["street"]);
if($street) {
$where .= " AND street like '%$street%'";
}
}
*/
if(array_key_exists("cid", $filter)) {
$cid = $filter['cid'];
if(is_numeric($cid)) {
@@ -118,10 +101,11 @@ class IvtCustomerProductModel {
}
}
if(array_key_exists("last_date>", $filter)) {
$last_date = $filter['last_date>'];
if(is_numeric($last_date)) {
$where .= " AND last_date >=$last_date";
//var_dump($filter);exit;
if(array_key_exists("lastdate>", $filter)) {
$lastdate = $filter['lastdate>'];
if($lastdate) {
$where .= " AND lastdate >= $lastdate";
}
}

View File

@@ -15,8 +15,50 @@ $me = new User(1);
define("INTERNAL_USER_ID", $me->id);
define("INTERNAL_USER_USERNAME", $me->username);
$block = new Voicenumberblock(2);
$free = $block->getFreeNumbers();
$chars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ';
$charsLength = strlen($chars);
echo implode("\n", $free);
echo "\n";
$c = 0;
$db = FronkDB::singleton();
$res = $db->query("SELECT id FROM Preorder WHERE oaid IS NOT NULL ORDER BY RAND()");
/*while($data = $db->fetch_object($res)) {
if($c > 1000) break;
$preorder = new Preorder($data->id);
if(!$preorder->oaid) {
echo "no oaid ".$preorder->id."\n";
}
$oaid = $preorder->oaid;
$ucode = '';
for($i = 0; $i < 20; $i++) {
$ucode .= $chars[rand(0, $charsLength - 1)];
}
echo "$oaid;$ucode\n";
$c++;
}*/
$stati = PreorderstatusModel::getAll();
while($data = $db->fetch_object($res)) {
if($c > 1000) break;
$preorder = new Preorder($data->id);
if(!$preorder->oaid) {
echo "no oaid ".$preorder->id."\n";
}
$oaid = $preorder->oaid;
$r = rand(0, count($stati)-1);
$new_status = $stati[$r];
if(!$new_status->code) {
fwrite(STDERR, "status not found\n");
continue;
}
echo "$oaid;".$new_status->code."\n";
$c++;
}