コード例 #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 removeActivity($id)
 {
     foreach ($this->activities as $key => $activity) {
         if ($activity->id == $id) {
             QuotationLine::DiscardLine($activity->qlid);
             ProjectActivity::DiscardActivity($id);
             unset($this->activities[$key]);
             break;
         }
     }
 }
コード例 #3
0
ファイル: index.php プロジェクト: xander-mbaka/momentum
 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;
     }
 }
コード例 #4
0
 function __construct($quoteId, $date, $clientId, $amount, $tax, $total, $user)
 {
     $this->id = $quoteId;
     $this->transactionId = $quoteId;
     $this->date = $date;
     $this->type = 'Quotation';
     $this->party = Client::GetClient($clientId);
     $this->amount = floatval($amount);
     $this->tax = floatval($tax);
     $this->total = floatval($total);
     $this->description = 'Quotation for ' . $this->party->name;
     if (is_null($user)) {
         $this->user = SessionManager::GetUsername();
     } else {
         $this->user = $user;
     }
     $this->lineItems = QuotationLine::GetQuoteItems($quoteId);
 }