## java – I have to subtract from the total the amount of a column whose line has been deleted from a Jtbale

I'm doing a project where there are tables with a delete button at the end of each one. When adding rows, the amount of the column containing the price value will be added to the total. What I want is that when the line is deleted, the amount of the deleted column is subtracted from the total to be pasted.

## Magento 2 now receives the total expenses of a custom customer attribute for each customer

``````public function test(\$setup)
{
/** @var CustomerSetup \$customerSetup */
\$customerSetup = \$this->customerSetupFactory->create(('setup' => \$setup));

Customer::ENTITY,
'Test',
(

'label'                 => 'test',
'input'                 => 'text',
'required'              => false,
'sort_order'            => 1000,
'position'              => 1000,
'visible'               => true,
'system'                => false,
'is_used_in_grid'       => true,
'is_visible_in_grid'    => false,
'is_filterable_in_grid' => false,
'is_searchable_in_grid' => false,
'default'               => '0'
)
);

/** @var  \$attribute */
\$attribute->save();

\$setup->endSetup();
}

public function upgrade(SchemaSetupInterface \$setup, ModuleContextInterface \$context)
{
\$installer = \$setup;

\$installer->startSetup();

if (version_compare(\$context->getVersion(), '0.0.1', '<')) {
\$installer->getTable('customer_grid_flat'),
'Test',
(
'type' => MagentoFrameworkDBDdlTable::TYPE_TEXT,
'nullable' => false,
'length' => '255',
'comment' => 'test'
)
);
}

\$installer->endSetup();
}
``````

}

This is my code and I can see the test in the client section of the administrator, that's what I wanted.
But for now, I'm not sure how to fill in the current amount ordered by customers.
I want to update the test field when the customer spends and updates the value.

Please, can someone guide me or give advice to progress in this area?

This is an example of what I want to do.
If Customer A buys a 10-pound product that needs to be added to the test field
If Customer A purchases again and indicates that the product costs 119.86 pounds, the total must be 129.86 in the test field.

## magento2 – How to remove shopping cart, shipping and paying the product price and total amount page in magento 2

Only I have to show the number of quantity items in the shopping cart, shipping and payment page.

if anyone knows the answer, please share the exact code and folder structure. since I am new to magento.

Any help would be appreciated. Thank you!

Screen capture of the shipping page:

Screenshot of the payment page:

## game design – how would a total set of TCG cards be implemented against the specific instances of those cards in the deck, hand, court, etc.? of a player?

For example, say that there are maybe 5 cards in the game, let's use:

Launcher of axes (3 costs, Creature, 5 Power, 3 Defense, Rush ability)

Elemental Ice (2 costs, creature, 2 powers, 5 defense, crystallization ability)

Party Trick (3-cost, spell, swap power and defense of a single creature)

Blade Master (3 costs, creature, 3 powers, 3 defense, + 1 / + 1 gains for each other creature in the field)

Minefield (3 costs, Trap, deals X damage to all enemies, where X is the number of creatures on the side of the opponent)

With this in mind, some have default values, which would be easy to store in the database, others would probably remain in the form of 0 or some other default value until their effects come into play, etc. Simple enough.

My question is more about how to manage the cards and their values ​​once they are in the game, in the hand of a player and in the field.

For example:

Ax-Thrower is a 5/3 creature, but let's say that it's buffered in one way or another – how to differentiate an object that is the basic version of a map, version the modified version in one way or another? The only values ​​stored in the database would be the base values, not the modified, correct values? Except if there was some kind of suspend functionality, in which case I should also follow the changed values.

My initial thought of an implementation, at least for the databases, was:

Cards (ID, Name) – Basic Card

CardVersions (ID, CardID, Version, ImagePath, CardStatsID) – The card statistics depend on the version.

CardStats (ID, Cost, Power, Defense) – Statistics for a given version

Now, these are the "basic" cards, here's how the specific instances are handled:

PlayerCards (ID, PlayerID, CardID, Count) – Player Cards

Decks (ID, PlayerID, Name) – Player decks

DeckCards (ID, DeckID, PlayerCardID, Count) – How many cards in a given deck

Which is a good start, I think, for cards in a player's deck.

For the cards in the hand of a player / on his field, are these simply references to PlayerCards with objects having editable versions of the stats? For example, a gamecard with the original statistics and modified statistics, where the majority of the time, the modified statistics will be the original statistics to start, but will change as the cards are improved or their abilities are invoked?

Am I missing a super simple solution to what I imagine, a common case for GTCs?

## Sum and total sql – Battery overflow

Hi, I have the following sql: `SELECT sum (value) as outputs,
(select sum (value) FROM run WHERE id_type = 1) revenue

Of `lancamentos`

WHERE type_id = 2

group by id_tipo

`

It works well, I need it to make the difference between the recipes – the outputs, in a total column.

like that:

Inputs | Outings | Total
1,000 | -450 | 550.00

## The grand total should be updated automatically in the credit memo in magento2 admin

I want to update the grand total on the fly when we change the Refund shipping, Refund of adjustment, Adjustment fees in the order credit note.

## plugin development – How can I apply a custom discount to the total prices of each product based on their categories on the WooCommerce shopping cart and payment pages?

I code a wordpress plugin that will work on a multi-vendor commerce site. I have a list of discounts (in percentage) that applies to all products categories I have on the woocommerce website stored on a separate database with my wordpress database. And I wish to give to some members (who have a certain identifier) when validating and on the basket page these discounts depending on the products (that is to say the categories to which the products belong) they have on the basket.

In short, this identifier should work as a woocommerce coupon, but this time it was obtained and validated from an external database.

For example, product category x, y, z has respective discounts of 2%, 3% and 4% on the database. Thus, if a user adds the products a, b, c to the basket and the product belongs to the category x, b => y and c => z.

This plugin displays an input field in which the user must type his name. ID to obtain the discounts applicable to the products available on the basket, the plug-in must therefore apply a discount of 2% on the product a, of 3% on the product b and 4% on the product c and to recalculate the sub-total.

And all this happens via Ajax, I was able to exit the form, use Ajax to validate the entered ID. I need help to get the product categories in the cart or checkout in order to retrieve the discounts on these products in my database and the hook to use to apply the discount and recalculate the sub-item. total. Please, I need help, thanks in advance.

## Discrete geometry – Total length of a set with the same projections as a square

Take a convex polygon $$P$$. I speak mostly about the unit box, but I would also like to have your opinion on polygons in general. We want to take a family of line segments in the interior $$P$$ who have the same projections as $$P$$ (that is, any crossing line $$P$$ cut one of the segments). Let $$L$$ the minimum total length of these segments. What is $$L$$?

I have the following limitations:

Upper limit: $$The sqrt {2} + frac { sqrt6} {2} about 2,639$$

Take the following construction so that the three segments meet at angles of $$2 pi / 3$$ (The diagonal gray dahsed is not one of the segments of construction). The sum of the lengths is $$sqrt {2} + frac { sqrt6} {2}$$.

Lower bound: $$L age 2$$.

The sum of the lengths of the orthogonal projections on the two diagonals is $$2 sqrt {2}$$. For any segment of length $$a$$ and angle $$theta$$ diagonally, the sum of its projections is $$a | sin theta | + a | cos theta | sqrt {2}$$. So $$L sqrt {2} ge 2 sqrt {2}$$hence the lower limit.

I've tried to improve the lower bound by using other combinations of projections, or by dividing the square into subforms and using different projections on different subforms, but I could not do anything get better.

## performance tuning – Omit the values ​​of an amount calculated by Total

This question follows the quickest way to calculate the determinants on the (lists of) machine precision numbers.

The context: I am interested in calculating products of the type

$$prod_ {1 = ell neq j} ^ N frac { mu_ ell- lambda_j} { lambda_ ell – lambda_j}.$$

and want to do this by vectoring the product. The most effective way to do this would be to use the ExpSumLog trick, where the summation is actually implemented via `Total`. The implementation from the link is as follows

``````L = 200.;
a = Sort@RandomReal({-(Pi), (Pi)}, L);
b = Sort@RandomReal({-(Pi), (Pi)}, L);

myProduct(a_, b_) := Module({X, bminusa, aminusa, u, Len},
Len = Length(b);
X = ConstantArray(-a, Len);
bminusa = KroneckerProduct(b, ConstantArray(1., Len)) + X;
aminusa = KroneckerProduct(a, ConstantArray(1., Len)) + X;
Exp(
ConstantArray(1., Len).Subtract(
Log(bminusa +
DiagonalMatrix(SparseArray(1. - Diagonal(bminusa)))),
Log(aminusa +
IdentityMatrix(Len, SparseArray,
WorkingPrecision -> MachinePrecision)))))

myProductExact(a_, b_) := Module({},
Table(Exp(
Sum(Log(Indexed(b, l) - Indexed(a, j)) -
Log(Indexed(a, l) - Indexed(a, j)), {l,
DeleteCases(Range@Length@a, j)})), {j, Range@Length@a})
)

myProduct(a, b)((3))
myProduct(a, b)((5))
myProduct(a, b)((7))

myProductExact(a, b)((3))
myProductExact(a, b)((5))
myProductExact(a, b)((7))
``````

My question is whether there are more optimal solutions for creating these vectors (especially those that have a little more precision than the solution presented above)? Clearly, the `Sum` This command allows a much more intuitive implementation of the product, as opposed to `Total`, for which I do not know how to create this vector. It should be noted that speed is essential only if precision is maintained at a reasonable level. I have done some calculations using partially the implementation of the product above, with variances of up to 10%, which is not acceptable in the model with which I work .

## microsoft excel – Determine how to combine a set of numbers to reach a known total

I have 79 different numbers in Excel and I have to determine which of these numbers corresponds to a known total.

Due to the range of values, it is difficult to observe / extrapolate which numbers I can add to reach this total. The tricky part is that this may not be possible with the current number set and I currently have no way of saying if this is the case.

Is it possible to do it with Excel or should I turn to different software to find a solution?