Get the debit sum of all entries of a journal voucher

@param  int $id Journal Voucher id

@return integer
354082
public function byJournalVoucherId($id, $databaseConnectionName = null)
  {
    if(empty($databaseConnectionName))
    {
      $databaseConnectionName = $this->databaseConnectionName;
    }

    return $this->JournalEntry->setConnection($databaseConnectionName)->where('journal_voucher_id', '=', $id)->get();
  }
204531
public function exportById($id): array
    {
        $entryType = Craft::$app->sections->getEntryTypeById((int) $id);

        return $this->export($entryType);
    }
1007003
public function getDocumentById(string $id)
    {
        $arguments = $this->getRequestArguments();

        $assignments = [];
        if ($this->settings['paging']['detailPagePaging'] && array_key_exists('underlyingQuery', $arguments)) {
            // If underlying query has been sent, fetch more data to enable paging arrows.
            $underlyingQueryInfo = $arguments['underlyingQuery'];

            $index = FrontendUtility::getIndexes($underlyingQueryInfo);

            foreach ($arguments['underlyingQuery'] as $key => $value) {
                $arguments[$key] = $value;
            }

            $this->createQueryForArguments($arguments);
            $this->query->setStart($index['previousIndex']);
            $this->query->setRows($index['nextIndex'] - $index['previousIndex'] + 1);

            $assignments = $this->getRecordsWithUnderlyingQuery($assignments, $index, $id, $arguments);
        } else {
            // Without underlying query information, just get the record specified.
            $assignments = $this->getTheRecordSpecified($id, $assignments);
        }

        return $assignments;
    }
658895
public function fullById(int $id)
    {
        $all = $this->full($id);

        return $this->checkAndReturnResult($all);
    }
1329517
public function getByCommerceOrder(string $id)
    {
        // Log Debug
        $this->flow->getLogger()->debug("Retrieving Payment by CommerceOrder $id");

        return $this->make(
            $this->performGet('commerceId', $id, ['method' => 'getStatusByCommerceId'])
        );
    }
312589
protected function getPayload($id)
    {
        $rawPayload = $this->getRedis()->hget($this->getRedisJobNamespace(), $id);

        return static::parsePayload($rawPayload);
    }
1128833
public static function get_entry_by_id($id) {
        global $DB, $USER;

        $params = self::validate_parameters(self::get_entry_by_id_parameters(), array('id' => $id));
        $id = $params['id'];
        $warnings = array();

        // Get and validate the glossary.
        $entry = $DB->get_record('glossary_entries', array('id' => $id), '*', MUST_EXIST);
        list($glossary, $context) = self::validate_glossary($entry->glossaryid);

        if (empty($entry->approved) && $entry->userid != $USER->id && !has_capability('mod/glossary:approve', $context)) {
            throw new invalid_parameter_exception('invalidentry');
        }

        $entry = glossary_get_entry_by_id($id);
        self::fill_entry_details($entry, $context);

        return array(
            'entry' => $entry,
            'ratinginfo' => \core_rating\external\util::get_rating_info($glossary, $context, 'mod_glossary', 'entry',
                array($entry)),
            'warnings' => $warnings
        );
    }
418689
public function findInvoice($id)
	{
		$invoice = $this->subscription()->findInvoice($id);

		if ($invoice && $invoice->customer == $this->getBraintreeId()) {
			return $invoice;
		}
	}
255212
public function socialsCount($id)
    {
        // I know eloquent does this, but having trouble so hand crafting using DB
        $record =  DB::table('socials')->where('social_type_id', '=', $id)->get();
        return count($record);
    }
1276729
public function get_preapproval_payment($id) {
        $request = array(
            "uri" => "/preapproval/{$id}",
            "params" => array(
                "access_token" => $this->get_access_token()
            )
        );

        $preapproval_payment_result = MPRestClient::get($request);
        return $preapproval_payment_result;
    }
1049094
public function costsDeleteById($id)
    {
        if (!empty($id)) {
            throw new \InvalidArgumentException(
                'Parameter `id` must contains a data'
            );
        }

        /* @noinspection PhpUndefinedMethodInspection */
        return $this->client->makeRequest(
            sprintf('/costs/%s/delete', $id),
            "POST"
        );
    }
193218
protected function getAbstractId($id)
    {
        if (isset($this->aliases[$id])) {
            $id = $this->aliases[$id];
        }

        return $id;
    }
1042220
public function getSub($id)
	{
		$target = Member::find($id);
		$department_ids = $this->getSubDepartments($target->department);
		$position_ids = $this->getSubPositions($target->position);

		$self_department = $target->department;

		$arr = [];

		foreach ($position_ids as $p) {
			$recs = Member::where('department', $self_department)
						  ->where('position', $p)
			              ->where('id', '>', 1)
			              ->where('state', 0)
			              ->where('new', 1)
			              ->where('private', 1)
			              ->where('show', 0)
			              ->get();
			if(count($recs)){
				foreach ($recs as $rec) {
					$arr[] = $rec->work_id;
				}
				break;
			}
		}//end foreach

		array_shift($department_ids);

		foreach ($department_ids as $d) {
			foreach ($position_ids as $p) {
				$recs = Member::where('department', $d)
						  ->where('position', $p)
			              ->where('id', '>', 1)
			              ->where('state', 0)
			              ->where('new', 1)
			              ->where('private', 1)
			              ->where('show', 0)
			              ->get();
			    if(count($recs)){
			    	foreach ($recs as $rec) {
			    		$arr[] = $rec->work_id;
			    	}
			    	break;
			    }
			}
		}// end foreach 

		return $arr;
	}
390851
public function findById($id)
    {
        $businessEntity = $this->reader->findById($id);
        if ($businessEntity === null) {
            throw new \Exception('"'.$id.'" does not seems to be a valid BusinessEntity');
        }

        return $businessEntity;
    }
460886
public function getCharge($id)
    {
        $result = $this->request('GET', '/charges/' . $id);

        return $this->objectConverter->convert($result);
    }
908736
private function getIncreasedValueEntry($id)
    {
        $value = intval($this->get($id));
        $value++;
        if ($this->isTtlMode()) {
            $value = [
                static::ENTRY_VALUE      => $value,
                static::ENTRY_EXPIRATION => null,
            ];
        }
        return $value;
    }
147288
function calcular_total($id = null){
		if (!empty($id)) $this->id = $id;

		$subtotal = $this->calcular_subtotal();
		$totalPorcentajeDescuento = $this->calcular_descuentos();

		$conversionDescuento = 1-($totalPorcentajeDescuento/100);

		$total = cqs_round(  $subtotal * $conversionDescuento );

		return $total;
	}