Пример #1
0
 public function testDiscardQuotation()
 {
     sleep(1);
     $client = Client::GetClient(2);
     //Creation
     $quotation = Quotation::CreateQuotation($client);
     $service = SurveyOfficeService::Create('Engineering Survey', 'Survey of the engineering kind', floatval(17500));
     $ql = QuotationLine::Create($quotation->id, $service->name, 'Task Description', 2, $service->rate, 16);
     $quotation->addToQuote($ql);
     $this->assertInstanceOf('Quotation', $quotation);
     //discarding
     $quotation->discard();
     //should fail
     $quotation = Quotation::GetQuotation($quotation->id);
     $this->assertTrue($quotation == null);
     //discarding
     //Quotation::Delete($quotation->id);
 }
Пример #2
0
 public function generateQuote($clientid, $items)
 {
     $client = Client::GetClient($clientid);
     $quotation = Quotation::CreateQuotation($client);
     foreach ($items as $item) {
         $ql = QuotationLine::Create($quotation->id, $item['service'], $item['task'], $item['qty'], $item['price'], $item['tax']);
         $quotation->addToQuote($ql);
     }
     if ($quotation->generate()) {
         echo 1;
     } else {
         echo 0;
     }
 }