request = $request;
$this->ledger = $this->request->get('ledger');
}
public function getLedger(){
return $this->setLedgerXML();
}
public function setLedgerXML(){
$ledger = '
All Masters
'.TallyListener::$companyName.'
'.$this->getAddress().'
'.$this->getCustomerName().'
';
if($this->getEmail()) {
$ledger .= '' . $this->getEmail() . '';
}
if($this->getPinCode()) {
$ledger .= '' . $this->getPinCode() . '';
}
$ledger.= ''.$this->country.'
'.$this->getSundry().'
'.$this->country.'';
if($this->getPhoneNumber()) {
$ledger .= '' . $this->getPhoneNumber() . '';
}
if($this->getStateName()){
$ledger.= ''.$this->getStateName().'';
}
$ledger.= 'Yes
'.$this->getUniqueNameString().'
'.$this->ledger->id.'
';
return $ledger;
}
/**
* @return mixed
*/
public function getPincode()
{
return $this->ledger->pincode;
}
/**
* @return string
*/
public function getAddress(): string
{
$addressString = '';
foreach ($this->getFormattedAddress() as $address){
$addressString .= '
'.$address.'';
}
return $addressString;
}
public function getFormattedAddress(){
return count(explode(' ', $this->ledger->address)) > 60 ? [$this->ledger->address] : explode('|',wordwrap($this->ledger->address, 60, "|"));
}
/**
* @return mixed
*/
public function getCustomerName()
{
return str_replace('&','',$this->ledger->name);
}
/**
* @return mixed
*/
public function getEmail()
{
return $this->ledger->email;
}
/**
* @return mixed
*/
public function getSundry()
{
return ($this->request->get('sundry') == 'CR') ? $this->Creditors : $this->Debtors;
}
/**
* @return mixed
*/
public function getPhoneNumber()
{
return $this->ledger->mobile_number;
}
/**
* @return mixed
*/
public function getStateName()
{
return $this->ledger->state;
}
public function getUniqueNameString(){
return $this->getCustomerName().'-'.$this->ledger->id;
}
}