//
// Created by arch on 27.10.17.
//
#include "Rent.h"
Rent::Rent(const lt::local_date_time &startRentData, Vehicle *vehicle, Client *client) :
startRentData(startRentData),
vehicle(vehicle),
client(client),
stopRentData(startRentData)
{
std:: cout <<"\n" << this->startRentData<<"\n";
boost::uuids::uuid uuid = boost::uuids::random_generator()();
this->uniqId =boost::lexical_cast<std::string>(uuid);
this->price = vehicle->getrentPrice();
//std::cout<<this->uniqId<< std::endl;
}
std:: string Rent::rentInfo(){
return this->uniqId + " Samochod: " + vehicle->vehicleInfo() + "\n";
}
namespace lt = boost::local_time;
namespace pt = boost::posix_time;
float Rent::stopRent(lt::local_date_time ldt){
std::cout << ldt << std::endl;
std::cout << "Roznica czasu:"<< std::endl;
this->stopRentData = ldt;
std::cout << this-> stopRentData;
pt::time_duration dur = ldt - this->startRentData;
int seconds = dur.total_seconds();
int days = seconds / 86400;
if((seconds % 86400)>0){
days++;
}
this->rentDays = days;
this->rentCost = days * this->price;
std::cout <<days<<std::endl;
std::cout <<this->rentCost<<std::endl;
return 0;
}
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}