コード例 #1
0
        private void BtnCostCalculate_Click(object sender, EventArgs e)
        {
            LaBelleAPI.CostCalculator_Reset();

            uint nUnitPrice;
            uint nAmount;

            if (CheckBagPlateCharge.Checked)
            {
                nUnitPrice = Convert.ToUInt32(EditBagPlateChangeUnitPrice.Text);
                nAmount = Convert.ToUInt32(EditBagPlateChangeAmount.Text);

                LaBelleAPI.CostCalculator_SetValue((uint)LaBelleAPI.CostType.Cost_BagPlateCharge, nUnitPrice, nAmount);
            }

            if (CheckBoxPlateCharge.Checked)
            {
                nUnitPrice = Convert.ToUInt32(EditBoxPlateChangeUnitPrice.Text);
                nAmount = Convert.ToUInt32(EditBoxPlateChangeAmount.Text);

                LaBelleAPI.CostCalculator_SetValue((uint)LaBelleAPI.CostType.Cost_BoxPlateCharge, nUnitPrice, nAmount);
            }

            if (CheckBarcode.Checked)
            {
                nUnitPrice = Convert.ToUInt32(EditBarcodeUnitPrice.Text);
                nAmount = Convert.ToUInt32(EditBarcodeAmount.Text);

                LaBelleAPI.CostCalculator_SetValue((uint)LaBelleAPI.CostType.Cost_Barcode, nUnitPrice, nAmount);
            }

            if (CheckBag.Checked)
            {
                nUnitPrice = Convert.ToUInt32(EditBagUnitPrice.Text);
                nAmount = Convert.ToUInt32(EditBagAmount.Text);

                LaBelleAPI.CostCalculator_SetValue((uint)LaBelleAPI.CostType.Cost_Bag, nUnitPrice, nAmount);
            }

            if (CheckBox.Checked)
            {
                nUnitPrice = Convert.ToUInt32(EditBoxUnitPrice.Text);
                nAmount = Convert.ToUInt32(EditBoxAmount.Text);

                LaBelleAPI.CostCalculator_SetValue((uint)LaBelleAPI.CostType.Cost_Box, nUnitPrice, nAmount);
            }

            if (CheckCarton.Checked)
            {
                nUnitPrice = Convert.ToUInt32(EditCartonUnitPrice.Text);
                nAmount = Convert.ToUInt32(EditCartonAmount.Text);

                LaBelleAPI.CostCalculator_SetValue((uint)LaBelleAPI.CostType.Cost_Carton, nUnitPrice, nAmount);
            }

            if (CheckProduct.Checked)
            {
                nUnitPrice = Convert.ToUInt32(EditFacialMaskUnitPrice.Text);
                nAmount = Convert.ToUInt32(EditFacialMaskAmount.Text);

                LaBelleAPI.CostCalculator_SetValue((uint)LaBelleAPI.CostType.Cost_Product, nUnitPrice, nAmount);
            }

            if (CheckShippingFee.Checked)
            {
                nUnitPrice = Convert.ToUInt32(EditShippingFee.Text);
                nAmount = 1;

                LaBelleAPI.CostCalculator_SetValue((uint)LaBelleAPI.CostType.Cost_ShippingFee, nUnitPrice, nAmount);
            }

            LaBelleAPI.CostCalculator_Calculate();

            uint nTotalCost;
            uint nUnitCost;

            LaBelleAPI.CostCalculator_GetTotalPrice(out nTotalCost);
            LaBelleAPI.CostCalculator_GetUnitPrice(out nUnitCost);

            EditTotalCost.Text = nTotalCost.ToString();
            EditUnitCost.Text = nUnitCost.ToString();

            if (CheckWriteToDB.Checked)
            {
                dbLaBelleExcel.Insert(strTableName, Convert.ToUInt32(EditNumber.Text), EditGenTime.Text, EditNote.Text);
                if (nLaBelleFormStatus == LABELLE_FORM_STATUS.LABELLE_FORM_STATUS_NEW)
                {
                    nLaBelleFormStatus = LABELLE_FORM_STATUS.LABELLE_FORM_STATUS_EDIT;
                    this.Text = String.Format(strLaBelleFormCaption[(uint)nLaBelleFormStatus], LaBelleCmnDef.strProductName[(uint)nProductType]);
                }

            }
        }
コード例 #2
0
        private void BtnCostCalculate_Click(object sender, EventArgs e)
        {
            if (!checkCtrlInput())
                return;

            calculateCost();

            if (CheckWriteToDB.Checked)
            {
                if (nLaBelleFormStatus == LABELLE_FORM_STATUS.LABELLE_FORM_STATUS_NEW)
                {
                    dbLaBelleExcel.Insert(strTableName, Convert.ToUInt32(EditNumber.Text), EditGenTime.Text, EditNote.Text);

                    nLaBelleFormStatus = LABELLE_FORM_STATUS.LABELLE_FORM_STATUS_EDIT;
                    this.Text = String.Format(strLaBelleFormCaption[(uint)nLaBelleFormStatus], LaBelleCmnDef.strProductName[(uint)nProductType]);

                    setWndID();
                }
                else
                {
                    dbLaBelleExcel.Update(strTableName, Convert.ToUInt32(EditNumber.Text), EditGenTime.Text, EditNote.Text);
                }
            }
        }