php-e-invoice-it icon indicating copy to clipboard operation
php-e-invoice-it copied to clipboard

Allow to add more line of DettagliPagamento

Open mdeprezzo opened this issue 7 months ago • 0 comments

just add these controls? Something like that:

    /**
     * Add payment detail line item
     */
    public function addPaymentDetailLineItem( int $n, int $bodyIndex = 1 )
    {
        if ($n < 1) {
            return $this;
        }

        if ($bodyIndex < 1) {
            throw new \Exception("Invalid body index '$bodyIndex'");
        }

        $body = $this->getBody($bodyIndex);
        $line = $this->getElement('DatiPagamento', $body);

        for ($i = 0; $i < $n; $i++) {
            $this->addElement($line->cloneNode(true), $body);
        }

        return $this;
    }

    /**
     * Get payment detail line item i
     */
    public function getPaymentDetailLineItem( int $i, int $bodyIndex = 1 )
    {
        $body = $this->getBody($bodyIndex);
        return $this->getElement("DatiPagamento[$i]", $body);
    }

    /**
     * Set number of payment detail line items
     */
    public function setPaymentDetailLineItemCount( int $n, int $bodyIndex = 1 )
    {
        return $this->addPaymentDetailLineItem($n - 1, $bodyIndex);
    } 

mdeprezzo avatar Dec 02 '23 13:12 mdeprezzo