Skip to main content

SqliteCostAccountingRepository

Struct SqliteCostAccountingRepository 

Source
pub struct SqliteCostAccountingRepository { /* private fields */ }
Available on crate feature sqlite only.

Implementations§

Trait Implementations§

Source§

impl CostAccountingRepository for SqliteCostAccountingRepository

Source§

fn get_item_cost(&self, sku: &str) -> Result<Option<ItemCost>>

Get item cost by SKU
Source§

fn set_item_cost(&self, input: SetItemCost) -> Result<ItemCost>

Set/update item cost
Source§

fn list_item_costs(&self, filter: ItemCostFilter) -> Result<Vec<ItemCost>>

List item costs
Source§

fn update_average_cost( &self, sku: &str, quantity: Decimal, unit_cost: Decimal, ) -> Result<ItemCost>

Update average cost (called when receiving inventory)
Source§

fn update_last_cost(&self, sku: &str, unit_cost: Decimal) -> Result<ItemCost>

Update last cost
Source§

fn create_cost_layer(&self, input: CreateCostLayer) -> Result<CostLayer>

Create a cost layer
Source§

fn get_cost_layer(&self, id: Uuid) -> Result<Option<CostLayer>>

Get cost layer by ID
Source§

fn list_cost_layers(&self, filter: CostLayerFilter) -> Result<Vec<CostLayer>>

List cost layers
Source§

fn issue_fifo(&self, input: IssueCostLayers) -> Result<Vec<CostTransaction>>

Issue from cost layers (FIFO)
Source§

fn issue_lifo(&self, input: IssueCostLayers) -> Result<Vec<CostTransaction>>

Issue from cost layers (LIFO)
Source§

fn get_layers_remaining(&self, sku: &str) -> Result<Decimal>

Get remaining quantity in layers for SKU
Source§

fn record_cost_transaction( &self, sku: &str, transaction_type: CostTransactionType, quantity: Decimal, unit_cost: Decimal, layer_id: Option<Uuid>, reference_type: Option<&str>, reference_id: Option<Uuid>, notes: Option<&str>, ) -> Result<CostTransaction>

Record a cost transaction
Source§

fn list_cost_transactions( &self, filter: CostTransactionFilter, ) -> Result<Vec<CostTransaction>>

List cost transactions
Source§

fn record_variance(&self, input: RecordCostVariance) -> Result<CostVariance>

Record a cost variance
Source§

fn list_variances( &self, filter: CostVarianceFilter, ) -> Result<Vec<CostVariance>>

List cost variances
Source§

fn get_variance_summary( &self, from: DateTime<Utc>, to: DateTime<Utc>, ) -> Result<Decimal>

Get variance summary for period
Source§

fn create_adjustment( &self, input: CreateCostAdjustment, ) -> Result<CostAdjustment>

Create a cost adjustment
Source§

fn get_adjustment(&self, id: Uuid) -> Result<Option<CostAdjustment>>

Get adjustment by ID
Source§

fn list_adjustments( &self, filter: CostAdjustmentFilter, ) -> Result<Vec<CostAdjustment>>

List adjustments
Source§

fn approve_adjustment( &self, id: Uuid, approved_by: &str, ) -> Result<CostAdjustment>

Approve adjustment
Source§

fn apply_adjustment(&self, id: Uuid) -> Result<CostAdjustment>

Apply adjustment (update item cost)
Source§

fn reject_adjustment(&self, id: Uuid) -> Result<CostAdjustment>

Reject adjustment
Source§

fn calculate_rollup( &self, sku: &str, bom_id: Option<Uuid>, ) -> Result<CostRollup>

Calculate cost rollup for manufactured item
Source§

fn get_rollup(&self, sku: &str) -> Result<Option<CostRollup>>

Get latest rollup for SKU
Source§

fn get_inventory_valuation( &self, cost_method: CostMethod, ) -> Result<InventoryValuation>

Get inventory valuation
Source§

fn get_sku_cost_summary(&self, sku: &str) -> Result<Option<SkuCostSummary>>

Get SKU cost summary
Source§

fn get_total_inventory_value(&self) -> Result<Decimal>

Get total inventory value
Source§

impl Debug for SqliteCostAccountingRepository

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more