Exemplo n.º 1
0
 public function recur()
 {
     $invoice = $this->select($this->id, $this->domain_id);
     $ni = new invoice();
     $ni->domain_id = $invoice['domain_id'];
     // Next Index is obtained during insert
     // $ni->index_id     = $invoice['index_id'];
     $ni->biller_id = $invoice['biller_id'];
     $ni->customer_id = $invoice['customer_id'];
     $ni->type_id = $invoice['type_id'];
     $ni->preference_id = $invoice['preference_id'];
     //$ni->date = $invoice['date_original'];
     // Use todays date
     $ni->date = date('Y-m-d');
     $ni->custom_field1 = $invoice['custom_field1'];
     $ni->custom_field2 = $invoice['custom_field2'];
     $ni->custom_field3 = $invoice['custom_field3'];
     $ni->custom_field4 = $invoice['custom_field4'];
     $ni->note = $invoice['note'];
     $ni_id = $ni->insert();
     //insert each line item
     $nii = new invoice();
     $nii->invoice_id = $ni_id;
     $nii->domain_id = $ni->domain_id;
     foreach ($invoice['invoice_items'] as $k => $v) {
         $nii->quantity = $v['quantity'];
         $nii->product_id = $v['product_id'];
         $nii->unit_price = $v['unit_price'];
         $nii->tax_amount = $v['tax_amount'];
         $nii->gross_total = $v['gross_total'];
         $nii->description = $v['description'];
         $nii->total = $v['total'];
         $nii->attribute = $v['attribute'];
         $nii->tax = $v['tax'];
         $nii_id = $nii->insert_item();
     }
     return $ni_id;
 }
Exemplo n.º 2
0
	public function recur()
	{
		$invoice = invoice::select($this->id);
		$ni = new invoice();
		$ni->biller_id = $invoice['biller_id'];
		$ni->customer_id = $invoice['customer_id'];
		$ni->type_id = $invoice['type_id'];
		$ni->preference_id = $invoice['preference_id'];
		//$ni->date = $invoice['date_original'];
		$ni->date = date('Y-m-d');
		$ni->custom_field1 = $invoice['custom_field1'];
		$ni->custom_field2 = $invoice['custom_field2'];
		$ni->custom_field3 = $invoice['custom_field3'];
		$ni->custom_field4 = $invoice['custom_field4'];
		$ni->note = $invoice['note'];
		$ni_id = $ni->insert();
		//insert each line item
		foreach ($invoice['invoice_items'] as $key => $value)
		{
			$nii = new invoice();
			$nii->invoice_id=$ni_id;
			$nii->quantity=$invoice['invoice_items'][$key]['quantity'];
			$nii->product_id=$invoice['invoice_items'][$key]['product_id'];
			$nii->unit_price=$invoice['invoice_items'][$key]['unit_price'];
			$nii->tax_amount=$invoice['invoice_items'][$key]['tax_amount'];
			$nii->gross_total=$invoice['invoice_items'][$key]['gross_total'];
			$nii->description=$invoice['invoice_items'][$key]['description'];
			$nii->total=$invoice['invoice_items'][$key]['total'];
			$nii->tax=$invoice['invoice_items'][$key]['tax'];
			$nii_id = $nii->insert_item();
		}

		return $ni_id;
	}
Exemplo n.º 3
0
			if($_POST["quantity$i"] != null)
            {

				//new line item added in edit page
				if($_POST["line_item$i"] == "")
				{
                    $ii = new invoice;
                    $ii->invoice_id = $id;
                    $ii->quantity = $_POST["quantity$i"];
                    $ii->product_id = $_POST["products$i"];
                    $ii->line_number = $i;
                    $ii->line_item_tax_id = $_POST["tax_id"][$i];
                    $ii->description = $_POST["description$i"];
                    $ii->unit_price = $_POST["unit_price$i"] ;
                    $ii->insert_item();
				}

				if($_POST["line_item$i"] != "")
				{
					updateInvoiceItem($_POST["line_item$i"],$_POST["quantity$i"],$_POST["products$i"],$i,$_POST['tax_id'][$i],$_POST["description$i"],$_POST["unit_price$i"]);
					$saved;
					//$saved =  true;
/*
				}
				else {
					die(end($dbh->errorInfo()));
*/
				}
			}
		}