# `viw_accproductstoreinstoredetail` (view)


- **Updatable:** NO

## Columns

| # | Name | Type | Null |
|---|---|---|---|
| 1 | `sId` | `varchar(100)` | NO |
| 2 | `sSubsidiaryId` | `varchar(100)` | NO |
| 3 | `sBrandsId` | `varchar(100)` | NO |
| 4 | `sProductId` | `varchar(100)` | NO |
| 5 | `tCreateDate` | `datetime` | NO |
| 6 | `sDefineNo` | `varchar(100)` | YES |
| 7 | `sCustomerId` | `varchar(50)` | YES |
| 8 | `dProductQty` | `decimal(18,6)` | NO |
| 9 | `iDay` | `bigint` | YES |
| 10 | `dCostPrice` | `decimal(25,13)` | YES |
| 11 | `dCostMoney` | `decimal(18,2)` | YES |
| 12 | `sConfirmMonth` | `varchar(100)` | YES |

## Definition

```sql
select `a`.`sId` AS `sId`,`a`.`sSubsidiaryId` AS `sSubsidiaryId`,`a`.`sBrandsId` AS `sBrandsId`,`a`.`sProductId` AS `sProductId`,`a`.`tCreateDate` AS `tCreateDate`,`a`.`sDefineNo` AS `sDefineNo`,`b`.`sCustomerId` AS `sCustomerId`,(case when ((`a`.`sFormId` = '192116810113315228246447250') or (`a`.`sFormId` = '11811781131121915179924871530')) then `a`.`dProductQty` else -(`a`.`dProductQty`) end) AS `dProductQty`,(to_days(now()) - to_days(`a`.`tCreateDate`)) AS `iDay`,`a`.`dCostPrice` AS `dCostPrice`,(case when ((`a`.`sFormId` = '192116810113315228246447250') or (`a`.`sFormId` = '11811781131121915179924871530')) then `a`.`dCostMoney` else -(`a`.`dCostMoney`) end) AS `dCostMoney`,`a`.`sConfirmMonth` AS `sConfirmMonth` from (`accproductstore` `a` left join `eleproduct` `b` on((`a`.`sProductId` = `b`.`sId`))) where ((`a`.`bConfirm` = 1) and (`a`.`sFormId` in ('192116810113315228246447250','101251240115015920999005840','11811781131121915179924491520','11811781131121915179924871530','101251240115015959853077870'))) union all select `b`.`sSlaveId` AS `sSlaveId`,`b`.`sSubsidiaryId` AS `sSubsidiaryId`,`b`.`sBrandsId` AS `sBrandsId`,`b`.`sProductId` AS `sProductId`,`b`.`tCreateDate` AS `tCreateDate`,`b`.`sDefineNo` AS `sDefineNo`,`b`.`sCustomerId` AS `sCustomerId`,`b`.`dProductQty` AS `dProductQty`,(to_days(now()) - to_days(`b`.`tCreateDate`)) AS `datediff(NOW(), tCreateDate)`,`b`.`dCostPrice` AS `dCostPrice`,`b`.`dCostMoney` AS `dCostMoney`,date_format(`b`.`tCreateDate`,'%Y%m') AS `DATE_FORMAT(tCreateDate,'%Y%m')` from `viw_accproductinit` `b` where (`b`.`bCheck` = 1)
```

## Narrative

_No human-written narrative yet._
