private function check_recibo() { $this->anticipo = FALSE; if ($this->factura) { $this->recibo->nombrecliente = $this->factura->nombrecliente; $this->recibo->cifnif = $this->factura->cifnif; $this->recibo->apartado = $this->factura->apartado; $this->recibo->ciudad = $this->factura->ciudad; $this->recibo->codpais = $this->factura->codpais; $this->recibo->codpostal = $this->factura->codpostal; $this->recibo->direccion = $this->factura->direccion; $this->recibo->provincia = $this->factura->provincia; /// ¿El recibo viene de un anticipo? $pago = new pago(); foreach ($pago->all_from_recibo($this->recibo->idrecibo) as $a) { $this->anticipo = $a; } if ($this->recibo->estado != 'Pagado' and is_null($this->recibo->idremesa)) { $this->recibo->coddivisa = $this->factura->coddivisa; $this->recibo->tasaconv = $this->factura->tasaconv; $this->recibo->codpago = $this->factura->codpago; $this->recibo->codserie = $this->factura->codserie; $cbc = new cuenta_banco_cliente(); foreach ($cbc->all_from_cliente($this->recibo->codcliente) as $cuenta) { if (is_null($this->recibo->codcuenta)) { $this->recibo->codcuenta = $cuenta->codcuenta; $this->recibo->iban = $cuenta->iban; $this->recibo->swift = $cuenta->swift; } } } $this->recibo->save(); } }