Exemplo n.º 1
0
        $row['discount_amount'] = format_number($row['discount_amount']);
    }
    if ($row['subtotal_amount'] != null) {
        $row['subtotal_amount'] = format_number($row['subtotal_amount']);
    }
    if ($row['tax_amount'] != null) {
        $row['tax_amount'] = format_number($row['tax_amount']);
    }
    if ($row['subtotal_tax_amount'] != null) {
        $row['subtotal_tax_amount'] = format_number($row['subtotal_tax_amount']);
    }
    if ($row['total_amount'] != null) {
        $row['total_amount'] = format_number($row['total_amount']);
    }
    $group_contract = new AOS_Line_Item_Groups();
    $group_contract->populateFromRow($row);
    $group_contract->save();
    $group_id_map[$old_id] = $group_contract->id;
}
//Setting Line Items
$sql = "SELECT * FROM aos_products_quotes WHERE parent_type = 'AOS_Quotes' AND parent_id = '" . $quote->id . "' AND deleted = 0";
$result = $this->bean->db->query($sql);
while ($row = $this->bean->db->fetchByAssoc($result)) {
    $row['id'] = '';
    $row['parent_id'] = $contract->id;
    $row['parent_type'] = 'AOS_Contracts';
    if ($row['product_cost_price'] != null) {
        $row['product_cost_price'] = format_number($row['product_cost_price']);
    }
    $row['product_list_price'] = format_number($row['product_list_price']);
    if ($row['product_discount'] != null) {
Exemplo n.º 2
0
        $row['discount_amount'] = format_number($row['discount_amount']);
    }
    if ($row['subtotal_amount'] != null) {
        $row['subtotal_amount'] = format_number($row['subtotal_amount']);
    }
    if ($row['tax_amount'] != null) {
        $row['tax_amount'] = format_number($row['tax_amount']);
    }
    if ($row['subtotal_tax_amount'] != null) {
        $row['subtotal_tax_amount'] = format_number($row['subtotal_tax_amount']);
    }
    if ($row['total_amount'] != null) {
        $row['total_amount'] = format_number($row['total_amount']);
    }
    $group_invoice = new AOS_Line_Item_Groups();
    $group_invoice->populateFromRow($row);
    $group_invoice->save();
}
//Setting Line Items
$sql = "SELECT * FROM aos_products_quotes WHERE parent_type = 'AOS_Quotes' AND parent_id = '" . $quote->id . "' AND deleted = 0";
$result = $this->bean->db->query($sql);
while ($row = $this->bean->db->fetchByAssoc($result)) {
    $row['id'] = '';
    $row['parent_id'] = $invoice->id;
    $row['parent_type'] = 'AOS_Invoices';
    if ($row['product_cost_price'] != null) {
        $row['product_cost_price'] = format_number($row['product_cost_price']);
    }
    $row['product_list_price'] = format_number($row['product_list_price']);
    if ($row['product_discount'] != null) {
        $row['product_discount'] = format_number($row['product_discount']);