logo
down
shadow

How to implement a subtotal of all orders?


How to implement a subtotal of all orders?

By : alorothman
Date : November 15 2020, 06:54 AM
I wish this help you Ember.RSVP.all returns a promise, which is what you are returning, you can just make an observer and update subtotal on change:
code :
// app/controllers/application.js
  import Ember from 'ember';

  export default Ember.ObjectController.extend({
    subtotal: null,
    totalsChanged: function() {
      var productCollectionPromises = this.get('orders').getEach('product');
      var sum = 0;

      Ember.RSVP.all(productCollectionPromises).then(productCollections => {
        productCollections.forEach(function(product){
          sum += product.get('amountInCents');
        });

        this.set('subtotal', sum);
      });
    }.observes('orders.@each.total'),
  });


Share : facebook icon twitter icon
Implement Subtotal feature of Excel

Implement Subtotal feature of Excel


By : Mahdi.s
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I use a quite old verion of POI but this is how I did it:
I also needed multiple nested groups so I had a model for the rows where the indent level was stored as well (it was a tree so the indent was implicit). I traversed the model with a visitor to get the group start and end row numbers. Then called HSSFSheet.groupRow subsequently for each group. If I remember correctly, the order of the group calls is important.
Get remaining orders(difference) from orders processing and new cart orders

Get remaining orders(difference) from orders processing and new cart orders


By : Rick Mondal
Date : March 29 2020, 07:55 AM
around this issue To get your remaining order calculation from existing customer "processing" orders items and actual cart items, you can try this custom function (with an optional $user_id argument).
This is the code:
code :
function get_remaining_orders( $user_id = null ){

    if( empty($user_id) && is_user_logged_in() )
        $user_id = get_current_user_id();

    if( ! empty($user_id) && ! is_admin() ){

        $order_max = 50;
        $processing_orders_items_count = 0;
        $cart_count = 0;

        $customer_orders = get_posts( array(
            'meta_key' => '_customer_user',
            'meta_value' => $user_id,
            'post_type'   => 'shop_order',
            'numberposts' => -1,
            'post_status' => 'wc-processing' // 'processing' order status only
        ) );

        if(!empty($customer_orders))
            foreach($customer_orders as $customer_order_values){
                $customer_order = wc_get_order( $customer_order_values->ID );
                $processing_orders_items_count += $customer_order->get_item_count('line_item');
            }

        if(!WC()->cart->is_empty())
            $cart_count = WC()->cart->get_cart_contents_count( );

        $ouput = $order_max - ($processing_orders_items_count + $cart_count);

        return $ouput;
    }
}

// USAGE: for a specific user ID (here for example $user_id is 22):
get_remaining_orders( 22 );

// USAGE: returning the value in a variable for current user:
$remaining_orders = get_remaining_orders();

// USAGE: displaying the value for current user (example):
echo 'Total remaining orders are ' . get_remaining_orders();
function get_remaining_orders(){

    if( !is_admin() ){

        $order_max = 50;
        $processing_orders_items_count = 0;
        $cart_count = 0;

        $customer_orders = get_posts( array(
            'post_type'   => 'shop_order',
            'numberposts' => -1,
            'post_status' => 'wc-processing' // 'processing' order status only
        ) );

        if(!empty($customer_orders))
            foreach($customer_orders as $customer_order_values){
                $customer_order = wc_get_order( $customer_order_values->ID );
                $processing_orders_items_count += $customer_order->get_item_count('line_item');
            }

        if(!WC()->cart->is_empty())
            $cart_count = WC()->cart->get_cart_contents_count( );

        $ouput = $order_max - ($processing_orders_items_count + $cart_count);

        return $ouput;
    }
}

// USAGE: returning the value in a variable:
$remaining_orders = get_remaining_orders();

// USAGE: displaying the value (example):
echo 'Total remaining orders are ' . get_remaining_orders();
MS ACCESS: Exclude a subtotal of a primary group from a grand subtotal

MS ACCESS: Exclude a subtotal of a primary group from a grand subtotal


By : Sabatini Federico
Date : March 29 2020, 07:55 AM
I wish this helpful for you I've got a budget report that is broken down by category. Included in these categories is an OPTIONAL section. I would like to show the OPTIONALS in the main report but exclude them from the grand total. Everything works perfectly except I cannot figure out how to exclude (or subtract) the OPTIONALS. Please see attached image of design view of report. !]1 , It would be something like this:
code :
=Sum(IIf(Category_Optional=True,0,Value))
Show subtotal excl. tax, add subtotal tax as separate row on Woocommerce checkout

Show subtotal excl. tax, add subtotal tax as separate row on Woocommerce checkout


By : Stephane
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , Updated: First, for info, woocommerce templates are made to be overridden via your active theme.
Once you have copied the template checkout/review-order.php to the "woocommerce" subfolder located in your theme (as explained on the linked documentation above), open/edit this template and replace the following code block (line 58 to 61):
code :
<tr class="cart-subtotal">
    <th><?php _e( 'Subtotal', 'woocommerce' ); ?></th>
    <td><?php wc_cart_totals_subtotal_html(); ?></td>
</tr>
<tr class="cart-subtotal">
    <th><?php printf( __( 'Subtotal %s', 'woocommerce' ), '<small>(excl. tax)<small>' );?></th>
    <td><?php echo wc_price( WC()->cart->get_subtotal() ); ?></td>
</tr>

<tr class="cart-subtotal-tax">
    <th><?php _e( 'Subtotal tax', 'woocommerce' ); ?></th>
    <td><?php echo wc_price( WC()->cart->get_subtotal_tax() ); ?></td>
</tr>
Multiple (nested) Subtotal VBA Code with Inserting Sum Formula in the Subtotal

Multiple (nested) Subtotal VBA Code with Inserting Sum Formula in the Subtotal


By : Potti
Date : March 29 2020, 07:55 AM
seems to work fine Actually this is much more complicated then it looks like:
It can do this for unlimited criteria columns and unlimited subtotal sum rows. Just don't forget to adjust the costants:
code :
Const StartRow As Long = 2      'omit headers
Const CriteriaCount As Long = 3 'amount of criteria columns (here countries + cities + Houses)
Const SumtotalCount As Long = 3 'amount columns to sumtotal
Option Explicit

Public Sub CreateSubtotals()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Worksheets("Example")

    Const StartRow As Long = 2      'omit headers
    Const CriteriaCount As Long = 3 'amount of criteria columns (here countries + cities + Hauses)
    Const SumtotalCount As Long = 3 'amount columns to sumtotal

    Dim Criteria() As Variant
    Criteria = ws.Cells(StartRow, 1).Resize(ColumnSize:=CriteriaCount).Value

    ReDim StartRows(1 To CriteriaCount)
    Dim i As Long
    For i = LBound(StartRows) To UBound(StartRows)
        StartRows(i) = StartRow
    Next i

    Dim iRow As Long, iCol As Long
    iRow = StartRow + 1

    Dim LastRow As Long
    LastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row

    Dim RowsAdded As Long, CriteriaChanged As Boolean

    Do While iRow < LastRow + 2
        For iCol = CriteriaCount To 1 Step -1
            CriteriaChanged = False
            For i = 1 To iCol
                If Criteria(1, i) <> ws.Cells(iRow, i).Value Then CriteriaChanged = True
            Next i

            If CriteriaChanged Then
                ws.Rows(iRow).Insert
                RowsAdded = RowsAdded + 1

                ws.Cells(iRow, iCol).Value = "Subtotal " & Criteria(1, iCol)
                If iCol = CriteriaCount Then
                    ws.Cells(iRow, CriteriaCount + 1).Resize(ColumnSize:=SumtotalCount).Formula = "=Sum(" & ws.Cells(StartRows(iCol), CriteriaCount + 1).Resize(RowSize:=iRow - StartRows(iCol)).Address(True, False) & ")"
                Else
                    ws.Cells(iRow, CriteriaCount + 1).Resize(ColumnSize:=SumtotalCount).Formula = "=Sumif(" & ws.Cells(StartRows(iCol), iCol + 1).Resize(RowSize:=iRow - StartRows(iCol)).Address(True, True) & ",""Subtotal*""," & ws.Cells(StartRows(iCol), CriteriaCount + 1).Resize(RowSize:=iRow - StartRows(iCol)).Address(True, False) & ")"
                End If

                ws.Cells(iRow, iCol).Resize(ColumnSize:=SumtotalCount + CriteriaCount - iCol + 1).Interior.ThemeColor = 7 + iCol 'whatever you want

                For i = iCol To UBound(StartRows)
                    StartRows(i) = 0
                Next i
                iRow = iRow + 1
            End If
        Next iCol

        If RowsAdded <> 0 Then
            Criteria = ws.Cells(iRow, 1).Resize(ColumnSize:=CriteriaCount).Value
            For i = LBound(StartRows) To UBound(StartRows)
                If StartRows(i) = 0 Then StartRows(i) = iRow
            Next i

            LastRow = LastRow + RowsAdded 'if we insert a row we must increas last row
            RowsAdded = 0
        End If

        iRow = iRow + 1
    Loop
End Sub
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org