getPlainBills(); foreach($remote_bills as $tmp) { $new_bill_id = $bill->create("", array_slice($tmp, 1)); $new_bills_count++; // check for bill_products $remote_bill_products = $bill_product_net->getByBillId($tmp[0]); foreach($remote_bill_products as $tmp1) { $tmp1[1] = $new_bill_id; $bill_product->create(array_slice($tmp1, 1)); $new_position_count++; } } $main_box->add(new NTKLabel("", "neue Rechnungen: ".$new_bills_count), 200, 0, "background-color: #dfe7f3;"); $main_box->add(new NTKLabel("", "neue Positionen: ".$new_position_count), 200, 0, "background-color: #dfe7f3;"); // now we should have added all bills let's delete them remote $bill_net->clearTable(); $bill_product_net->clearTable(); ?>